[pmwiki-devel] stripmagic
Patrick R. Michaud
pmichaud at pobox.com
Fri Dec 29 09:31:28 CST 2006
On Fri, Dec 29, 2006 at 12:07:43PM +0100, christian.ridderstrom at gmail.com wrote:
> On Thu, 28 Dec 2006, Patrick R. Michaud wrote:
>
> >Actually, this has nothing to do with magic_quotes_gpc. The /e option
> >always adds backslashes in front of quotes in the matched text, so you
> >need to be using PSS('$1') instead of '$1' in the above. Thus:
> >
> > Markup('includepage', '>if',
> > '/\\(:includepage\\s+(\\S.*?):\\)/ei',
> > "PRR(IncludePageText(\$pagename, PSS('$1')))");
> >
> >(The PSS() helper function removes any backslashes introduced by the /e
> >option.)
>
> I checked pmwiki.org, and PSS() is documented here
> http://pmwiki.org/wiki/PmWiki/Functions
>
> with the following text:
>
> PSS($string)
>
> This function should always be used, passing parameters to
> functions called via preg_replace. Especially when defining a
> replacement with the Markup() function. It removes the escape in
> front of quotation marks. This function is frequently used in
> scripts/stdmarkup.php, for example in the definition of the
> (:redirect:)-directive.
>
> I found it slightly confusing... Maybe an example would clarify it?
Actually, I think the text just needs clarification.
The PSS() function removes the backslashes that are
automatically inserted in front of quotation marks by
the /e option of PHP's preg_replace function. PSS() is
most commonly used in replacement arguments to Markup(),
when the pattern specifies /e and one or more of the
parenthesized subpatterns could contain a quote or backslash.
("PSS" stands for "PmWiki Strip Slashes".)
Is that any better?
Pm
More information about the pmwiki-devel
mailing list