[pLog-svn] r3433 - plog/trunk/class/view/admin

Jon Daley plogworld at jon.limedaley.com
Thu May 18 11:41:02 GMT 2006


 	Heresy! You can do anything with a single regexp - solve world 
hunger, etc.  :)

 	So the problem with &aaaaaa; is that it is an invalid html escape 
sequence, and so should be ignored?  I guess you would need a list of the 
valid escape sequences and just do those.

 	Your example from php.net looks good.  If you don't want to do 
this right now, you should probably add it to bugs.lifetype, so we don't 
forget.

On Thu, 18 May 2006, Mark Wu wrote:
> Hi Jon:
>
> I tried the following regexpt before I commit the changes.
>
> "&[a-z0-9]+;"
>
> But it fail in some situation, it won't convert "&aaaaaaa;" to
> "&aaaaaaa;" ..... Actually, I want it to be convert to the new string.
>
> The most important thing is, I can not reproduce any soosa's error in my
> locale  machine (both linux/window, firefox/ie), that why I just only do
> this part ... :(
>
> If we want to convert all escape html, then... I think we need to write a
> function here, instead of a single regexp.. It is too hard to take care all
> situation in one regexp.
>
> Mark
>
>
>> -----Original Message-----
>> From: plog-svn-bounces at devel.lifetype.net
>> [mailto:plog-svn-bounces at devel.lifetype.net] On Behalf Of Jon Daley
>> Sent: Thursday, May 18, 2006 7:27 PM
>> To: plog-svn at devel.lifetype.net
>> Subject: Re: [pLog-svn] r3433 - plog/trunk/class/view/admin
>>
>>  	This looks really bizarre?  You are trying to replace &
>> with & only if it isn't already &?  There must be a
>> better way to do that.
>>
>> Also, perhaps you really want to replace a & if it isn't
>> followed by "[a-z0-9]+;" to cover all cases of escaped html?
>>
>>
>> On Thu, 18 May 2006, mark at devel.lifetype.net wrote:
>>> Author: mark
>>> Date: 2006-05-18 10:46:03 +0000 (Thu, 18 May 2006)
>>> New Revision: 3433
>>>
>>> Modified:
>>>   plog/trunk/class/view/admin/admineditpostview.class.php
>>> Log:
>>> Fixed the bug here: http://bugs.lifetype.net/view.php?id=896
>>>
>>> Modified: plog/trunk/class/view/admin/admineditpostview.class.php
>>> ===================================================================
>>> --- plog/trunk/class/view/admin/admineditpostview.class.php
>> 2006-05-18 10:41:43 UTC (rev 3432)
>>> +++ plog/trunk/class/view/admin/admineditpostview.class.php
>> 2006-05-18 10:46:03 UTC (rev 3433)
>>> @@ -50,8 +50,8 @@
>>>
>>> 	            // set information about the post itself
>> into the view
>>> 	            $this->setValue( "postTopic",
>> $this->_article->getTopic());
>>> -	            $this->setValue( "postText",
>> preg_replace('/&/', '&', $this->_article->getIntroText()));
>>> -	            $this->setValue( "postExtendedText",
>> preg_replace('/&/','&',$this->_article->getExtendedText()));
>>> +	            $this->setValue( "postText",
>> preg_replace('/(&|&)/', '&',
>> $this->_article->getIntroText()));
>>> +	            $this->setValue( "postExtendedText",
>> preg_replace('/(&|&)/','&',$this->_article->getExtende
>> dText()));
>>> 	            $this->setValue( "postSlug",
>> $this->_article->getPostSlug());
>>> 	            $this->setValue( "postId",
>> $this->_article->getId());
>>> 	            if( $this->_article->getCommentsEnabled())
>>>
>>> _______________________________________________
>>> pLog-svn mailing list
>>> pLog-svn at devel.lifetype.net
>>> http://devel.lifetype.net/mailman/listinfo/plog-svn
>>>
>>
>> **************************************
>> Jon Daley
>> http://jon.limedaley.com/
>>
>> The difference between genius and stupidity
>> is that genius has its limits.
>> -- Anonymous
>> _______________________________________________
>> pLog-svn mailing list
>> pLog-svn at devel.lifetype.net
>> http://devel.lifetype.net/mailman/listinfo/plog-svn
>
> _______________________________________________
> pLog-svn mailing list
> pLog-svn at devel.lifetype.net
> http://devel.lifetype.net/mailman/listinfo/plog-svn
>

**************************************
Jon Daley
http://jon.limedaley.com/

With memory prices this low, who needs to deallocate memory?


More information about the pLog-svn mailing list