[wp-hackers] applying filters & plugins

Ryan Boren ryan at boren.nu
Fri Sep 24 23:25:55 UTC 2004


On Sat, 2004-09-25 at 00:56 +0300, miro at apollo.lv wrote:
> Hi
> 
> First of all I must admit I'm a fan of Textile, and tried both original 
> Textile by Dean and other implementations (TextilePHP)..
> 
> Anyway, I like Jim and Lissa's 
> <http://jimandlissa.com/project/textilephp> TextilePHP and wanted to 
> make it pluggable to WP..
> 
> Since TextilePHP is a class, text formatting best is achieved by simply 
> calling $text = textile::process($text).
> 
> but, there's one limitation in WP's /wp-includes/apply_filters() 
> function which does not permit calling textile::process() as functions 
> are called by $string = $function($string) and PHP does not allow to 
> call methods witin initialized classes using $function(), even if 
> $function = 'class::method'..
> 
> my idea is:
> 
> 1) make WP call filter functions a little bit smarter - if methods are 
> called within uninitialized classes (they contain ::), call them using 
> call_user_func() function which allows method calling within class..
> 
> if (preg_match('/(\S*)::(\S*)/', $function, $reg)) {
> 	$string = call_user_func(array($reg[1], $reg[2]), $string);
> } else {
> 	$string = $function($string);
> }

Actually, someone submitted a similar patch that I've been meaning to
apply.  Take a look at bug 63 and add your comments.

http://mosquito.wordpress.org/bug_view_page.php?bug_id=0000063

Ryan




More information about the hackers mailing list