You are not logged in.
Ever felt that there isn’t enough <txp:tags/>? Now there is — kinda. Call any PHP function with a TXP tag.
<txp:rah_function call="base64_encode">
Hello world!
</txp:rah_function>
<txp:rah_function call="str_replace" search="Hello" replace="Hi" subject="Hello world!" />
<txp:rah_function call="trim" charlist="H">
Hello world!
</txp:rah_function>
<txp:rah_function call="safe_strftime">
%Y
</txp:rah_function>
Rah-plugins | What? I’m a little confused… again :-) <txp:is_god />
Offline
Thank you Stuart :)
Rah-plugins | What? I’m a little confused… again :-) <txp:is_god />
Offline
Jukka, you may want to have a look at how the tag handler for <txp:php> uses the ‘allow_article_php_scripting’ preference and the has_privs() function call, because as it is now, your plugin can be used to circumvent several security related preferences:
Offline
ruud wrote:
Jukka, you may want to have a look at how the tag handler for
<txp:php>uses the ‘allow_article_php_scripting’ preference and the has_privs() function call, because as it is now, your plugin can be used to circumvent several security related preferences:
Yes, if the site has an author that really is a crack user. Will add those options. Thx.
Rah-plugins | What? I’m a little confused… again :-) <txp:is_god />
Offline
Released version 0.1.1. Changelog:
has_privs() and allow_scripting checks.Rah-plugins | What? I’m a little confused… again :-) <txp:is_god />
Offline
Fab-u-lous. Why didn’t I think of that? ;-)
The smd plugin menagerie — for when you need one more gribble of power from TXP.
TXP Builders – finely-crafted code, design and txp
Offline
Wow. This seems pretty powerful. As I’m not a PHP dev, thus lacking the ability to visualize how to take advantage of this, I’m looking forward to seeing what others might come up with.
Post your examples!
Does this deserve it’s own sub-category in the Tag Reference? Something different than “Programmer Tags”? Or would it be better to keep core and plugin tags separate? Ah, maybe that’s the sub-category: “Plugin Tags” ? Mmmm. No, kind of misleading, I think.
Last edited by Destry (2009-11-23 10:22:32)
EuroIA 2010 (Paris, Sept) | Paris Web 2010 (14-16 Oct) | Content Strategy Forum 2011 (London, 5-7 Sept), Official Announcement
Offline
This is awesome! I have a use-case, if I can figure out how to do it. I could probably use this plugin to replace pax_grep, and gain some additional flexibility, but I’m not sure how to set up the tag. Here’s an example:
<txp:pax_grep from="'\s|\t|\r|\n'" to=""/>
My
source
</txp:pax_grep>
I’ve tried some variations of this:
<txp:rah_function call="preg_replace" pattern="'\s|\t|\r|\n'" replacement="">
But I keep getting a Textpattern “Empty regular expression on line 1” error. Any hints?
Offline
johnstephens wrote:
…But I keep getting a Textpattern “Empty regular expression on line 1” error. Any hints?
Hi,
I think preg_replace requires a third parameter (subject) which is missing here.
Or are you wrapping the subject with the rah_function tag? In this case consider that the wrapped text becomes the first argument of the called function while it should be the last.
(from the instructions: “…If used as a container, contained code is used as the first attribute for the function”)
Last edited by redbot (2009-11-24 14:23:31)
Offline