Re: [PHP] Simple Email System (SES) Provider

2012-06-01 Thread Bastien Koert
On Fri, Jun 1, 2012 at 8:32 PM, Don Wieland  wrote:
> Hi all,
>
> I built a system in PHP/mySQL where a group of users post events, sign-up
> for events, change their arrival times, remove thier names from events, and
> post related notes on the events. Each time an action is done, an email is
> generated to the entire group that their has been a change. Pretty standard
> stuff...
>
> Today I just got an Mail Delivery System email with this error:
>
> Domain dwdcweb.info has exceeded the max emails per hour (350/350 (100%))
> allowed.  Message will be reattempted later
>
> I contacted my VPS provider and they just alerted me that there is a limit
> on how many emails my server can send per hour.
>
> They recommended I find a 3rd party service provider with support PHP API
> connections.
>
> My budget is limited. Does anyone have any suggestions of companies that
> might work for my scenario?
>
> Any feedback is appreciated ;-)
>
> Don
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

Amazon has an email service you can plug in to with php

http://aws.amazon.com/ses/


-- 

Bastien

Cat, the other other white meat

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Simple Email System (SES) Provider

2012-06-01 Thread Don Wieland

Hi all,

I built a system in PHP/mySQL where a group of users post events, sign- 
up for events, change their arrival times, remove thier names from  
events, and post related notes on the events. Each time an action is  
done, an email is generated to the entire group that their has been a  
change. Pretty standard stuff...


Today I just got an Mail Delivery System email with this error:

Domain dwdcweb.info has exceeded the max emails per hour (350/350  
(100%)) allowed.  Message will be reattempted later


I contacted my VPS provider and they just alerted me that there is a  
limit on how many emails my server can send per hour.


They recommended I find a 3rd party service provider with support PHP  
API connections.


My budget is limited. Does anyone have any suggestions of companies  
that might work for my scenario?


Any feedback is appreciated ;-)

Don

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Open Call: Official PHP Mirror

2012-06-01 Thread Daniel Brown
Greetings, all;

Have you ever wanted to get directly involved in the PHP project
in an official capacity, but don't have the time, resources, or
knowledge required to contribute to the core, documentation, or other
roles?  Did you know about our Official Mirrors program?

Starting today, we are putting out an open call to all web
development firms, web hosts, ISPs, and academic institutions to apply
to our official php.net mirror waiting list.  And if you're
interested, please, read on.  If not, delete this email with extreme
prejudice and muttered profanity.

We're presently undergoing a complete overhaul of the mirror
infrastructure, and will quite likely need to replace some of the
mirrors in some countries.  It's for this reason that we want to
invite others to join the program and help support one of the world's
most popular and most prolific open source projects in history.  Sure,
it's a short history, but still --- it makes for impressive
discussions at the pub, should you find yourself surrounded by
like-minded geeks.

Who should apply?

Any web development firm, web hosting provider, ISP, or recognized
academic institution capable of providing a LA*P server running PHP
5.3.10+ or PHP 5.4.0+ with at least 60GB bandwidth per month allocated
at 10Mbps or better, with the server physically located in the country
for which you wish to provide service.

Who should not apply?

Third-party sponsors, those who want to try to run the mirror from
their Blackberry, people without servers located in the respective
country for which they're applying, shared hosting clients, Droids,
Borg, Klingons, Romulans, toddlers, and the gum disease known as
"gingivitis."

Want to know more?

Please ask.

Want to join the waiting list?

Fill out the form at http://php.parasane.net/mirrors/waitinglist.php

We now return you to your regularly-scheduled Friday, already in
progress.  Unless it's already Saturday in your time zone, in which
case you've been warped through a time-shift paradox.  Way to go.

-- 

Network Infrastructure Manager
http://www.php.net/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Happy Diamond Jubilee everyone!

2012-06-01 Thread Paul M Foster
On Fri, Jun 01, 2012 at 06:44:17PM +0100, Ashley Sheridan wrote:

> This is a bit of a shameless plug, but it is a Friday and a pretty
> special weekend over here.
> 
> I recently got to work on something a bit fun at work in my spare time
> and they liked it so much that it got used internally to celebrate the
> jubilee weekend.
> 
> This is the result http://jubilee.themlondon.com 
> 
> For those of you interested, the leg-work is done by a bunch of PHP
> scripts run in the background via cron, split into 3 tasks:
> 
> 
>  1. A script goes out and searches Twitter for tweets that mention
> the jubilee, one instance per keyword and records those to a DB
> to limit the draw on the Twitter API
>  2. A second script goes over those tweets and pulls in all the
> non-default profile images for each unique user
>  3. Lastly, the image is built as 12 separate tiles every half hour,
> using PHP and GD to match the average colour of each profile pic
> to a spot on the image, and then these are stitched together for
> the final image
> 
> Anyway, hope you guys all have a great weekend, more so if you're
> unlucky enough to be working over the whole 4 days :-/

*Very* nice work!

Paul

-- 
Paul M. Foster
http://noferblatz.com
http://quillandmouse.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Happy Diamond Jubilee everyone!

2012-06-01 Thread Jason Pruim
And this is when I realize that I still have so much to learn Looks amazing 
ash!


Jason Pruim
352.234.3175 Google Voice
352.682.1073 Cell

On Jun 1, 2012, at 1:44 PM, Ashley Sheridan  wrote:

> This is a bit of a shameless plug, but it is a Friday and a pretty
> special weekend over here.
> 
> I recently got to work on something a bit fun at work in my spare time
> and they liked it so much that it got used internally to celebrate the
> jubilee weekend.
> 
> This is the result http://jubilee.themlondon.com 
> 
> For those of you interested, the leg-work is done by a bunch of PHP
> scripts run in the background via cron, split into 3 tasks:
> 
> 
> 1. A script goes out and searches Twitter for tweets that mention
>the jubilee, one instance per keyword and records those to a DB
>to limit the draw on the Twitter API
> 2. A second script goes over those tweets and pulls in all the
>non-default profile images for each unique user
> 3. Lastly, the image is built as 12 separate tiles every half hour,
>using PHP and GD to match the average colour of each profile pic
>to a spot on the image, and then these are stitched together for
>the final image
> 
> Anyway, hope you guys all have a great weekend, more so if you're
> unlucky enough to be working over the whole 4 days :-/
> 
> -- 
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
> 
> 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Exception Handling

2012-06-01 Thread James Colannino
On Fri, Jun 1, 2012 at 12:51 PM, Marco Behnke  wrote:

Ah, I guess that is the problem. Your application framework uses namespaces.
> I guess you should try
>
> catch (\Exception $e)
>
> instead of
>
> catch (Exception $e)
>
> :-)
>

Ah, that was probably it.  Will try it out tonight to confirm.  Thanks!

James


Re: [PHP] is there a way to stop HTMLPurifier/CSStidy from forcing input CSS into all lowercase?

2012-06-01 Thread Govinda
we got off list, without meaning to, it seems.

Here are  the last few posts in the thread:


> 
>>> On Fri, Jun 1, 2012 at 12:46 AM, Govinda  
>>> wrote:
> Perhaps you should spend some time looking for a better text editor
> for your OS. :)  When the current tools I use does not give
> satisfactory progress in what I'd like to do, I replace the tool(s).
 
 I am happy with my editor.  It (BBedit) has good multi-file 
 search-replace... and I can also generate that/a full list of where all is 
 strtolower()..  BUT I do not want to just willy nilly comment out/remove 
 all those instances of strtolower(), because even if it seems to "work", I 
 won't really know what damage I may have done to the library(ies).  If I 
 can find just the one instance that is the culprit, without spending days 
 trying every single spot, one at a time, then great.. but since a lot of 
 the code in those libraries is a bit over my head (without spending a lot 
 of time on it), I want something more definitive than just stabbing at 
 every strtolower().
 
 I appreciate your time and attention.   When I post my OP, I was/am hoping 
 for a reply where someone knows what really is the situation; where is the 
 specific offending line(s) I can hack in the source, or better yet, just 
 how can we set CSStidy config options through HTMLpurifier at runtime, and 
 so not hack the source at all.
 
 -Govinda
>>> 
>>> You don't need to modify every strtolower statement.  Just open up the
>>> files and look at that code block and the surrounding code blocks.  If
>>> that doesn't make sense, then most likely it's not what you're looking
>>> for.
>> 
>> 
>> I tried that..  and some of the instances of strtolower() I thought very 
>> well could be the culprit.. and so I commented it out... but it did not help 
>> (it was not the culprit, or else it was still being overridden by another 
>> one).
>> 
>> Many other instances I could not tell by looking at the code.
>> 
>> Some were pretty clearly not the culprit.
>> 
>>>  In Notepad++, double clicking on a line in the search results
>>> window will open up the file and bring you right to that line.  If
>>> BBedit doesn't do that, then refer back to my comment about the tools
>>> you use :)  Just my 2 cents.
>> 
>> BBedit too does do that  :-)
>> 
>>> 
>>> BTW, I rather dig through the code 1st and see what strength and
>>> weakness that framework provides and to fully comprehend if all its
>>> bells and whistles are as others claim.  What may work for others may
>>> not for you.  For example, in all my past searches for a PHP
>>> framework, only Yii managed to fulfill the most of what I want in a
>>> framework, including and specifically ability to create CRUD UI by
>>> just specifying the table name after the DB configurations are set.
>>> But more than that, Yii went beyond my expectation by providing the
>>> client side validation for the CRUD too.  Granted the UI doesn't fit
>>> my liking but it does more than the other frameworks I've looked at.
>>> :)
>> 
>> I have been pleased with the frameworks and libraries I have picked to help 
>> me out.. even HTMLpurifier and CSStidy have been great.. It was not until 
>> now (too deep in to want to go back) that I realized I have this one issue.
>> 
>> I am just about to hand off this code.. just need to find a way to 
>> patch/workaround this one thing.. have another new project stating monday.
>> 
>> In case I seem irreverent.. it is not my intention... I appreciate you even 
>> bothering to reply :-)
>> -Govinda
> 
> Have you tried using xdebug and step through the code to look for
> changes?  IIRC, xdebug is capable of monitoring variables and their
> values.

AFAICT that is a brilliant idea -  put a watch on the var(s) until I can trace 
just exactly where the offending line is.  
[snip]
 I have yet to bring my tools up to speed to do that here in PHP.  I won't have 
time before this thing is out the door..   but thanks for reminding me I need 
to check out something like xdebug sooner than later.

-G
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Using default argument values in the middle of the argument list

2012-06-01 Thread 324706

Hi,

as I accidentally found out that PHP allows default argument values
to occur not only at the end of parameter list:

function ( Classname $a, Classname $b = null, Classname $c ) ...

Unfortunately, documentation does not state what is supposed to happen in  
such situation.

It appears $b can be an instance of Classname or a null.

I've draw up simple test case (https://gist.github.com/2829626) to verify  
my assumption
and it seems to work at least since PHP 5.3.0. It is extremely useful to  
allow null

value and retain the power of type hints at the same time.

Is there anything else to test? Does it work for your setup? Can it be  
used that way?

And if yes, can it be officially documented?

Do not hesitate to prove I'm wrong.

-- Oliver

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Exception Handling

2012-06-01 Thread Marco Behnke
Am 01.06.12 17:08, schrieb James Colannino:
>
> Hey Marco,
>
> Thanks for the reply!  That was the first thing I checked.
>
> class Database_Exception extends \FuelException {}
> class Fuel_Exception extends \Exception {}
>
> It's extending Exception, as expected.  Also, can you throw classes
> that don't extend Exception?  It was always my understanding that
> doing so would cause a fatal error.

Ah, I guess that is the problem. Your application framework uses namespaces.
I guess you should try

catch (\Exception $e)

instead of

catch (Exception $e)

:-)

>
> James
>


-- 
Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz




signature.asc
Description: OpenPGP digital signature


Re: [PHP] Happy Diamond Jubilee everyone!

2012-06-01 Thread Daniel Brown
On Fri, Jun 1, 2012 at 1:44 PM, Ashley Sheridan
 wrote:
> This is a bit of a shameless plug, but it is a Friday and a pretty
> special weekend over here.
>
> I recently got to work on something a bit fun at work in my spare time
> and they liked it so much that it got used internally to celebrate the
> jubilee weekend.
>
> This is the result http://jubilee.themlondon.com
>
> For those of you interested, the leg-work is done by a bunch of PHP
> scripts run in the background via cron, split into 3 tasks:
>
>
>     1. A script goes out and searches Twitter for tweets that mention
>        the jubilee, one instance per keyword and records those to a DB
>        to limit the draw on the Twitter API
>     2. A second script goes over those tweets and pulls in all the
>        non-default profile images for each unique user
>     3. Lastly, the image is built as 12 separate tiles every half hour,
>        using PHP and GD to match the average colour of each profile pic
>        to a spot on the image, and then these are stitched together for
>        the final image
>
> Anyway, hope you guys all have a great weekend, more so if you're
> unlucky enough to be working over the whole 4 days :-/

Congrats, Ash, and nice work.  Looks great!

-- 

Network Infrastructure Manager
http://www.php.net/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Happy Diamond Jubilee everyone!

2012-06-01 Thread Ashley Sheridan
This is a bit of a shameless plug, but it is a Friday and a pretty
special weekend over here.

I recently got to work on something a bit fun at work in my spare time
and they liked it so much that it got used internally to celebrate the
jubilee weekend.

This is the result http://jubilee.themlondon.com 

For those of you interested, the leg-work is done by a bunch of PHP
scripts run in the background via cron, split into 3 tasks:


 1. A script goes out and searches Twitter for tweets that mention
the jubilee, one instance per keyword and records those to a DB
to limit the draw on the Twitter API
 2. A second script goes over those tweets and pulls in all the
non-default profile images for each unique user
 3. Lastly, the image is built as 12 separate tiles every half hour,
using PHP and GD to match the average colour of each profile pic
to a spot on the image, and then these are stitched together for
the final image

Anyway, hope you guys all have a great weekend, more so if you're
unlucky enough to be working over the whole 4 days :-/

-- 
Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] Exception Handling

2012-06-01 Thread FeIn
Maybe "catch(Exception $e)" should be "catch(\Exception $e)"?

On Fri, Jun 1, 2012 at 5:25 PM, James Colannino  wrote:
> Hey guys,
>
> Haven't posted in a long time...  Happy Memorial Day!  I have an issue with
> exception handling.  I'm using a framework that throws a
> "Database_Exception" object.  I was expecting catch (Exception $var) to be
> sufficient to catch this, but it doesn't.  I have to do catch
> (Database_Exception $var) to make it work.  I've been reading that Exception
> should be sufficient, since every exception object is a child class of
> Exception.  Did this perhaps change in 5.4?  I think it was working properly
> in 5.3, but I'm not sure.
>
> Any clarification would be greatly appreciated!
>
> James
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Exception Handling

2012-06-01 Thread Mackintosh, Mike
-Original Message-
From: James Colannino [mailto:crankycycl...@gmail.com] 
Sent: Friday, June 01, 2012 11:14 AM
To: PHP-General List
Subject: Re: [PHP] Exception Handling

Hey Mike,

Thanks for the reply!  I saw this comment in the documentation
(http://www.php.net/manual/en/language.exceptions.extending.php) -- it's
the first one:

"|It's important to note that subclasses of the Exception class will be
caught by the default Exception handler"

Of course, I haven't tested the code they posted.  I'll do that tonight
and confirm or deny the expected result.

James
|

Well look at that..

class James_Exception extends \Exception{
function __construct($message){
parent::__construct($message);
}
}

try{
throw new James_Exception('Testing Exception Catch-All');
}
catch(Exception $e){
print_r($e);
}

Output:

"James_Exception Object
(
[message:protected] => Testing Exception Catch-All..."

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Exception Handling

2012-06-01 Thread James Colannino

On 06/01/12 07:32, Mackintosh, Mike wrote:

Hi James,

You would have to catch Database_Exception. It is also good practice to
also always catch exception afterwards.



Hey Mike,

Thanks for the reply!  I saw this comment in the documentation 
(http://www.php.net/manual/en/language.exceptions.extending.php) -- it's 
the first one:


"|It's important to note that subclasses of the Exception class will be 
caught by the default Exception handler"


Of course, I haven't tested the code they posted.  I'll do that tonight 
and confirm or deny the expected result.


James
|


Re: [PHP] Exception Handling

2012-06-01 Thread James Colannino

On 06/01/12 08:08, James Colannino wrote:

On 06/01/12 07:30, ma...@behnke.biz wrote:

James Colannino  hat am 1. Juni 2012 um 16:25
geschrieben:

Hey guys,

Haven't posted in a long time...  Happy Memorial Day!  I have an issue
with exception handling.  I'm using a framework that throws a
"Database_Exception" object.  I was expecting catch (Exception $var) to
be sufficient to catch this, but it doesn't.  I have to do catch
(Database_Exception $var) to make it work.  I've been reading that
Exception should be sufficient, since every exception object is a child
class of Exception.  Did this perhaps change in 5.4?  I think it was
working properly in 5.3, but I'm not sure.
Look at the definition of "Database_Exception" and see if it extends 
Exception,

I'll guess it doesn't.
Nothing changed in PHP 5.4 to that.



Hey Marco,

Thanks for the reply!  That was the first thing I checked.

class Database_Exception extends \FuelException {}
class Fuel_Exception extends \Exception {}

It's extending Exception, as expected.  Also, can you throw classes 
that don't extend Exception?  It was always my understanding that 
doing so would cause a fatal error.


I was right.  From the documentation 
(http://php.net/manual/en/language.exceptions.php):


"The thrown object must be an instance of the Exception 
 class or a subclass 
of Exception . Trying 
to throw an object that is not will result in a PHP Fatal Error."


James


Re: [PHP] Exception Handling

2012-06-01 Thread James Colannino

On 06/01/12 07:30, ma...@behnke.biz wrote:

James Colannino  hat am 1. Juni 2012 um 16:25
geschrieben:

Hey guys,

Haven't posted in a long time...  Happy Memorial Day!  I have an issue
with exception handling.  I'm using a framework that throws a
"Database_Exception" object.  I was expecting catch (Exception $var) to
be sufficient to catch this, but it doesn't.  I have to do catch
(Database_Exception $var) to make it work.  I've been reading that
Exception should be sufficient, since every exception object is a child
class of Exception.  Did this perhaps change in 5.4?  I think it was
working properly in 5.3, but I'm not sure.

Look at the definition of "Database_Exception" and see if it extends Exception,
I'll guess it doesn't.
Nothing changed in PHP 5.4 to that.



Hey Marco,

Thanks for the reply!  That was the first thing I checked.

class Database_Exception extends \FuelException {}
class Fuel_Exception extends \Exception {}

It's extending Exception, as expected.  Also, can you throw classes that 
don't extend Exception?  It was always my understanding that doing so 
would cause a fatal error.


James

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Exception Handling

2012-06-01 Thread Mackintosh, Mike
-Original Message-
From: James Colannino [mailto:crankycycl...@gmail.com] 
Sent: Friday, June 01, 2012 10:25 AM
To: PHP-General List
Subject: [PHP] Exception Handling

Hey guys,

Haven't posted in a long time...  Happy Memorial Day!  I have an issue
with exception handling.  I'm using a framework that throws a
"Database_Exception" object.  I was expecting catch (Exception $var) to
be sufficient to catch this, but it doesn't.  I have to do catch
(Database_Exception $var) to make it work.  I've been reading that
Exception should be sufficient, since every exception object is a child
class of Exception.  Did this perhaps change in 5.4?  I think it was
working properly in 5.3, but I'm not sure.

Any clarification would be greatly appreciated!

James

--

Hi James,

You would have to catch Database_Exception. It is also good practice to
also always catch exception afterwards.

Ex:

Class Database_Exception extends Exception{
Public function __construct($message){
parent::__construct($message);
}
}

Try{
$pdo = new PDO();
If($pdo === false){
Throw new Database_Exception("Failed To Connect");
}
}
Catch(Database_Exception $e){
Echo $e->getMessage();
}
Catch(Exception $e){
Echo $e->getMessage();
}

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Exception Handling

2012-06-01 Thread ma...@behnke.biz

James Colannino  hat am 1. Juni 2012 um 16:25
geschrieben:

> Hey guys,
>
> Haven't posted in a long time...  Happy Memorial Day!  I have an issue
> with exception handling.  I'm using a framework that throws a
> "Database_Exception" object.  I was expecting catch (Exception $var) to
> be sufficient to catch this, but it doesn't.  I have to do catch
> (Database_Exception $var) to make it work.  I've been reading that
> Exception should be sufficient, since every exception object is a child
> class of Exception.  Did this perhaps change in 5.4?  I think it was
> working properly in 5.3, but I'm not sure.


Look at the definition of "Database_Exception" and see if it extends Exception,
I'll guess it doesn't.
Nothing changed in PHP 5.4 to that.

>
> Any clarification would be greatly appreciated!
>
> James
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Exception Handling

2012-06-01 Thread James Colannino

Hey guys,

Haven't posted in a long time...  Happy Memorial Day!  I have an issue 
with exception handling.  I'm using a framework that throws a 
"Database_Exception" object.  I was expecting catch (Exception $var) to 
be sufficient to catch this, but it doesn't.  I have to do catch 
(Database_Exception $var) to make it work.  I've been reading that 
Exception should be sufficient, since every exception object is a child 
class of Exception.  Did this perhaps change in 5.4?  I think it was 
working properly in 5.3, but I'm not sure.


Any clarification would be greatly appreciated!

James

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] progress indicators in browsers for long running php scripts?

2012-06-01 Thread rene7705
Hi..

I've got several scripts now that may run for a long time; the
self-test script for my htmlMicroscope, my serviceLog component when
it calculates totals for a large number of hits, a curl script that is
likely to one day crawl a hundred or so RSS urls in a single update,
etc, etc.

I'd like to build a generic system (and opensource it) to allow PHP to
execute a long running script, and somehow get a progress bar with
"what am I doing now"-status-msg for such processes, in the browser.

The easiest thing, and maybe the only way this will work, is to load
up a site's framework html (so as to display the site), then call the
long-running script via ajax.
However, a long-running script needs set_time_limit(0), which is
something shared hosters just won't do for browsers.
A moderately good shared hoster will however allow you to
set_time_limit(0) for PHP cron jobs.

So I'd need to build a cron PHP daemon that listens for new tasks.
That won't be much of a problem, I've done it before.

But the task definition itself puzzles me a lot still.
I suppose I'd need an ID for the task/job, and include in the task def
what worker-php-script and worker-php-function to call, with also the
parameters for the worker function.
The worker function would then call back certain daemon functions to
push status updates to the browser.

And the browser can then just kick off the task, and poll every 5
seconds or so for very brief status updates in JSON format.

This is how I can import videos of any length into my CMS, and convert
them to flash video aswell (even optionally converting on another,
dedicated server).

Once again I'm asking you all for input and tips before I begin on
this new workDaemon component of mine..

I suppose most of you'd want a neat PHP object of it? Not my usual
procedural-only PHP coding?

With regards,
 and eager to hear your tips,
  Rene Veerman

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] How to insert a file in a class?

2012-06-01 Thread LAMP


On Jun 1, 2012, at 8:11 AM, LAMP wrote:



On Jun 1, 2012, at 7:46 AM, David OBrien wrote:




On Fri, Jun 1, 2012 at 8:41 AM, LAMP  wrote:
Hi to all.

Let's say there is a class

class Box
{
  var $box_title;
  var $box_content;

  function __construct()
  {
  $this->box = '';
  }


  function box_title($title)
  {
  $this->title = $title;
  }

  function box_content($content)
  {
  $this->content = $content;
  }

  function make_box()
  {
  $this->box = ''.$this->box_title.''.$this- 
>box_content;

  }


  function get_box()
  {
  return $this->box;
  }
}


$box = new Box();
$box->box_title('PHP Classes');
$box->box_content('Starting with PHP 5, the object model was  
rewritten to allow for better performance and more features. This  
was a major change from PHP 4. PHP 5 has a full object model.')

$box->make_box();
echo $box->get_box();

This works fine.

The problem I have is how to "include" a file as box_content? it  
could be plain text, but it could be a form or some kind of code.
$box->box_include(include(/path/to/file/file.php)) doesn't work, of  
course.


Wrapping up the whole code in a variable doesn't make a sense too:
# file.php
$content = '
  
  Email = 
  Pass = 
  
  ';

# main.php
$box = new Box();
$box->box_title('PHP Classes');
include(file.php);
$box->box_content($content);
$box->make_box();
echo $box->get_box();


Also, I'm sure I read once it's not correct to print directly from  
a class. First return a value/result to "main" code and then print.  
Correct?


LAMP

file_get_contents


I still can get the content of a file?!?
echo file_get_contents($content);
doesn't show anything. though,
echo htmlspecialchars(file_get_content($content));
will show the code. means it is "there"



Works perfect! Me dummy, forgot I had style="display: none;" within  
the dive tag :) :) :)

Thanks to all for help.



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] How to insert a file in a class?

2012-06-01 Thread ma...@behnke.biz


LAMP  hat am 1. Juni 2012 um 14:41 geschrieben:

> include(file.php);
> $box->box_content($content);
> $box->make_box();
> echo $box->get_box();


Wrong approach.
Right is:

$content = file_get_contents('file.php');
$box->box_content($content);


Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] How to insert a file in a class?

2012-06-01 Thread LAMP


On Jun 1, 2012, at 7:46 AM, David OBrien wrote:




On Fri, Jun 1, 2012 at 8:41 AM, LAMP  wrote:
Hi to all.

Let's say there is a class

class Box
{
   var $box_title;
   var $box_content;

   function __construct()
   {
   $this->box = '';
   }


   function box_title($title)
   {
   $this->title = $title;
   }

   function box_content($content)
   {
   $this->content = $content;
   }

   function make_box()
   {
   $this->box = ''.$this->box_title.''.$this- 
>box_content;

   }


   function get_box()
   {
   return $this->box;
   }
}


$box = new Box();
$box->box_title('PHP Classes');
$box->box_content('Starting with PHP 5, the object model was  
rewritten to allow for better performance and more features. This  
was a major change from PHP 4. PHP 5 has a full object model.')

$box->make_box();
echo $box->get_box();

This works fine.

The problem I have is how to "include" a file as box_content? it  
could be plain text, but it could be a form or some kind of code.
$box->box_include(include(/path/to/file/file.php)) doesn't work, of  
course.


Wrapping up the whole code in a variable doesn't make a sense too:
# file.php
$content = '
   
   Email = 
   Pass = 
   
   ';

# main.php
$box = new Box();
$box->box_title('PHP Classes');
include(file.php);
$box->box_content($content);
$box->make_box();
echo $box->get_box();


Also, I'm sure I read once it's not correct to print directly from a  
class. First return a value/result to "main" code and then print.  
Correct?


LAMP

file_get_contents


I still can get the content of a file?!?
echo file_get_contents($content);
doesn't show anything. though,
echo htmlspecialchars(file_get_content($content));
will show the code. means it is "there"



Re: [PHP] How to insert a file in a class?

2012-06-01 Thread LAMP


On Jun 1, 2012, at 8:00 AM, Gibbs wrote:


On 01/06/12 13:41, LAMP wrote:

Hi to all.

Let's say there is a class

class Box
{
   var $box_title;
   var $box_content;

   function __construct()
   {
   $this->box = '';
   }


   function box_title($title)
   {
   $this->title = $title;
   }

   function box_content($content)
   {
   $this->content = $content;
   }

   function make_box()
   {
   $this->box = ''.$this->box_title.''.$this- 
>box_content;

   }


   function get_box()
   {
   return $this->box;
   }
}


$box = new Box();
$box->box_title('PHP Classes');
$box->box_content('Starting with PHP 5, the object model was  
rewritten to allow for better performance and more features. This  
was a major change from PHP 4. PHP 5 has a full object model.')

$box->make_box();
echo $box->get_box();

This works fine.

The problem I have is how to "include" a file as box_content? it  
could be plain text, but it could be a form or some kind of code.
$box->box_include(include(/path/to/file/file.php)) doesn't work, of  
course.


Wrapping up the whole code in a variable doesn't make a sense too:
# file.php
$content = '

   Email = 
   Pass = 

';

# main.php
$box = new Box();
$box->box_title('PHP Classes');
include(file.php);
$box->box_content($content);
$box->make_box();
echo $box->get_box();


Also, I'm sure I read once it's not correct to print directly from  
a class. First return a value/result to "main" code and then print.  
Correct?


LAMP



Couldn't you just do something like:

function box_content($file = NULL)
{
   $content = file_exists($file) ? include($file) : NULL;
   $this->content = $content;
}

It really depends what is being included (text, HTML, PHP etc).  
Personally I would create a different method for each different type  
as they will have to be treated and returned differently.


Gibbs


No. It doesn't work.
And yes, the content of the "box" could be anything.



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] How to insert a file in a class?

2012-06-01 Thread sertcetin

file_get_contents() ?


--
Ege Sertçetin

Alinti LAMP 


Hi to all.

Let's say there is a class

class Box
{
var $box_title;
var $box_content;

function __construct()
{
$this->box = '';
}


function box_title($title)
{
$this->title = $title;
}

function box_content($content)
{
$this->content = $content;
}

function make_box()
{
$this->box = ''.$this->box_title.''.$this->box_content;
}


function get_box()
{
return $this->box;
}
}


$box = new Box();
$box->box_title('PHP Classes');
$box->box_content('Starting with PHP 5, the object model was  
rewritten to allow for better performance and more features. This  
was a major change from PHP 4. PHP 5 has a full object model.')

$box->make_box();
echo $box->get_box();

This works fine.

The problem I have is how to "include" a file as box_content? it  
could be plain text, but it could be a form or some kind of code.

$box->box_include(include(/path/to/file/file.php)) doesn't work, of course.

Wrapping up the whole code in a variable doesn't make a sense too:
# file.php
$content = '

Email = 
Pass = 

';

# main.php
$box = new Box();
$box->box_title('PHP Classes');
include(file.php);
$box->box_content($content);
$box->make_box();
echo $box->get_box();


Also, I'm sure I read once it's not correct to print directly from a  
class. First return a value/result to "main" code and then print.  
Correct?


LAMP





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] How to insert a file in a class?

2012-06-01 Thread LAMP

Hi to all.

Let's say there is a class

class Box
{
var $box_title;
var $box_content;

function __construct()
{
$this->box = '';
}


function box_title($title)
{
$this->title = $title;
}

function box_content($content)
{
$this->content = $content;
}

function make_box()
{
$this->box = ''.$this->box_title.''.$this->box_content;
}


function get_box()
{
return $this->box;
}
}


$box = new Box();
$box->box_title('PHP Classes');
$box->box_content('Starting with PHP 5, the object model was rewritten  
to allow for better performance and more features. This was a major  
change from PHP 4. PHP 5 has a full object model.')

$box->make_box();
echo $box->get_box();

This works fine.

The problem I have is how to "include" a file as box_content? it could  
be plain text, but it could be a form or some kind of code.
$box->box_include(include(/path/to/file/file.php)) doesn't work, of  
course.


Wrapping up the whole code in a variable doesn't make a sense too:
# file.php
$content = '

Email = 
Pass = 

';

# main.php
$box = new Box();
$box->box_title('PHP Classes');
include(file.php);
$box->box_content($content);
$box->make_box();
echo $box->get_box();


Also, I'm sure I read once it's not correct to print directly from a  
class. First return a value/result to "main" code and then print.  
Correct?


LAMP



Re: [PHP] is there a way to stop HTMLPurifier/CSStidy from forcing input CSS into all lowercase?

2012-06-01 Thread Tommy Pham
On Thu, May 31, 2012 at 11:17 PM, Govinda  wrote:
>>
>> You need to get better tools.  I found this with Notepad++ for Windows
>> searching "case" within *.php files filter within the root directory
>> of the extracted zip/tarball:
>>
>>  H:\data\Downloads\dev\PHP\htmlpurifier-4.4.0\library\HTMLPurifier\AttrDef\CSS\Font.php
>> (6 hits)
>>       Line 45:         $lowercase_string = strtolower($string);
>>       Line 46:         if (isset($system_fonts[$lowercase_string])) {
>>       Line 47:             return $lowercase_string;
>>       Line 61:                 case 0:
>>       Line 77:                 case 1:
>>       Line 131:                 case 2:
>>
>> Haven't looked at the entire file or source code but that looks close
>> enough to me... ;)
>
> Thanks a lot for taking a look Tommy,
>
> I do have a decent text editor I use to code with... and had searched for 
> possible places where is the culprit strtolower() ... and so far no matter 
> which instances(s) I comment out, I cannot seem to turn off the behavior of 
> the library as a whole (either of them, or both) which is forcing the input 
> CSS to lowercase.
>

Perhaps you should spend some time looking for a better text editor
for your OS. :)  When the current tools I use does not give
satisfactory progress in what I'd like to do, I replace the tool(s).

> For example, I also just tried the exact place you suggested: this one:
>
> [snip]htmlpurifier-4.4.0\library\HTMLPurifier\AttrDef\CSS\Font.php
>
> ...and changed line 45 to this:
>
>        //$lowercase_string = strtolower($string);//Govinda hack
>        $lowercase_string = $string;
>
> but still no luck.
>
>
>>> Have you tried http://htmlpurifier.org/phorum/ and did you noticed
>>> "Since the project has been suspended, please only contact me if you
>>> intend to continue maintaining it." for CSSTidy?
>
> I hadn't posted on http://htmlpurifier.org/phorum because last time I did 
> that when I has also posted on stackoverlfow (SO), then the developer of 
> HTMLpurifier scolded me for the dupe ;-) ..  and he has already posted a 
> comment on my (this new) SO post, saying just, "Hmm, that's silly of CSS 
> Tidy. Maybe we should change that default.".  I assume he probably has a lot 
> on his plate, to the point that his answers are incredibly terse and not 
> necessarily very helpful.
>
> I did see the message about CSStidy no longer being developed (if that is the 
> meaning behind "suspended").  Yet when i was researching it, many people were 
> still recommending it.  No?  Do you know/prefer something else for the 
> purpose of cleaning user-input CSS bound for an external style sheet?
>
> Thanks
> -Govinda


Are you sure you fixed ALL of the offending lines containing
strtolower?  This is what Notepad++ returns when I search for
"strtolower":

Search "strtolower" (48 hits in 28 files)
  
H:\data\Downloads\dev\PHP\htmlpurifier-4.4.0\library\HTMLPurifier\AttrDef\CSS\Background.php
(1 hits)
Line 35: $bits = explode(' ', strtolower($string)); // bits to 
process
  
H:\data\Downloads\dev\PHP\htmlpurifier-4.4.0\library\HTMLPurifier\AttrDef\CSS\BackgroundPosition.php
(1 hits)
Line 80: $lbit = ctype_lower($bit) ? $bit : 
strtolower($bit);
  
H:\data\Downloads\dev\PHP\htmlpurifier-4.4.0\library\HTMLPurifier\AttrDef\CSS\Color.php
(1 hits)
Line 17: $lower = strtolower($color);
  
H:\data\Downloads\dev\PHP\htmlpurifier-4.4.0\library\HTMLPurifier\AttrDef\CSS\Font.php
(1 hits)
Line 45: $lowercase_string = strtolower($string);
  
H:\data\Downloads\dev\PHP\htmlpurifier-4.4.0\library\HTMLPurifier\AttrDef\CSS\ListStyle.php
(1 hits)
Line 30: $bits = explode(' ', strtolower($string)); // bits to 
process
  
H:\data\Downloads\dev\PHP\htmlpurifier-4.4.0\library\HTMLPurifier\AttrDef\CSS\TextDecoration.php
(1 hits)
Line 19: $string = strtolower($this->parseCDATA($string));
  
H:\data\Downloads\dev\PHP\htmlpurifier-4.4.0\library\HTMLPurifier\AttrDef\CSS.php
(2 hits)
Line 51: $property = strtolower($property);
Line 59: if (strtolower(trim($value)) !== 'inherit') {
  
H:\data\Downloads\dev\PHP\htmlpurifier-4.4.0\library\HTMLPurifier\AttrDef\Enum.php
(2 hits)
Line 7:  *  built-in strtolower and ctype_lower functions, 
which may
Line 40: $string = ctype_lower($string) ? $string :
strtolower($string);
  
H:\data\Downloads\dev\PHP\htmlpurifier-4.4.0\library\HTMLPurifier\AttrDef\HTML\Color.php
(1 hits)
Line 17: if (isset($colors[strtolower($string)])) return
$colors[$string];
  
H:\data\Downloads\dev\PHP\htmlpurifier-4.4.0\library\HTMLPurifier\AttrDef\HTML\LinkTypes.php
(1 hits)
Line 39: $part = strtolower(trim($part));
  
H:\data\Downloads\dev\PHP\htmlpurifier-4.4.0\library\HTMLPurifier\AttrDef\Lang.php
(3 hits)
Line 35: $subtags[0] = strtolower($subtags[0]);
Line 50: