[pLog-svn] r6788 - plog/branches/lifetype-1.2/class/net

Jon Daley plogworld at jon.limedaley.com
Thu Feb 19 11:55:40 EST 2009


 	Yeah, I really like this feature.  I am not sure about the best 
way to describe it to people.  Any ideas?
 	Maybe just show some examples of how it works?

On Tue, 3 Feb 2009, endless enigma wrote:

> that's a nice one jon :)
>
> On Tue, 03 Feb 2009 02:52:41 +0100, <jondaley at devel.lifetype.net> wrote:
>
>> Author: jondaley
>> Date: 2009-02-02 20:52:41 -0500 (Mon, 02 Feb 2009)
>> New Revision: 6788
>> 
>> Modified:
>>   plog/branches/lifetype-1.2/class/net/customrequestgenerator.class.php
>> Log:
>> allow fancier custom URLs.  I'll write up some documentation at some point, 
>> but I've had a couple requests for this, and I'm now using it on my own 
>> blog.  This is actually quite handy for migrating people from 'search 
>> engine friendly' URLs to custom URLs, since now they both can be accepted, 
>> but the new URL is published.  The second preg_replace() call replaces all 
>> str_replace() calls, and the first preg_replace is the new feature
>> 
>> Modified: 
>> plog/branches/lifetype-1.2/class/net/customrequestgenerator.class.php
>> ===================================================================
>> --- plog/branches/lifetype-1.2/class/net/customrequestgenerator.class.php 
>> 2009-02-03 01:45:06 UTC (rev 6787)
>> +++ plog/branches/lifetype-1.2/class/net/customrequestgenerator.class.php 
>> 2009-02-03 01:52:41 UTC (rev 6788)
>> @@ -438,12 +438,11 @@
>>          */
>>         function _replaceTags( $format, $tags )
>>         {
>> -            $result = $format;
>> -            $result = str_replace( "$", "", $format );
>> -			$result = str_replace( "(", "", $result );
>> -			$result = str_replace( ")", "", $result );
>> -			$result = str_replace( "?", "", $result );
>> -			$result = str_replace( "\\", "", $result );
>> +                // allow such things as archive_link_format:
>> +                // /archives/(?:{year}/{month}/{day}/)?{postname}$
>> +                // 
>> /(?:post|archives)/(?:{year}/{month}/{day}/)?{postname}$
>> +            $result = preg_replace("/\(\?:([^\)\|]*)([^\)]*)\)/", "$1", 
>> $format);
>> +            $result = preg_replace("/[$()?\\\\]/", "", $result);
>>             foreach( $tags as $key => $value ) {
>>                 $result = str_replace( $key, $value, $result );
>>             }
>> 
>> _______________________________________________
>> pLog-svn mailing list
>> pLog-svn at devel.lifetype.net
>> http://limedaley.com/mailman/listinfo/plog-svn
>> 
>
>
>
>

-- 
Jon Daley
http://jon.limedaley.com
~~
There are really only two bases: 2 and e.
-- Michael Brian McElroy


More information about the pLog-svn mailing list