cvs: pear /Text_Wiki/Text/Wiki/Parse Embed.php Include.php /Text_Wiki/Text/Wiki/Render/Xhtml Embed.php

From: Date: Fri, 11 Jun 2004 14:57:24 +0000
Subject: cvs: pear /Text_Wiki/Text/Wiki/Parse Embed.php Include.php /Text_Wiki/Text/Wiki/Render/Xhtml Embed.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-20516@lists.php.net to get a copy of this message
pmjones Fri Jun 11 10:57:24 2004 EDT Modified files: /pear/Text_Wiki/Text/Wiki/Parse Embed.php Include.php /pear/Text_Wiki/Text/Wiki/Render/Xhtml Embed.php Log: fixed bugs 1571 and 1573 http://cvs.php.net/diff.php/pear/Text_Wiki/Text/Wiki/Parse/Embed.php?r1=1.1&r2=1.2&ty=u Index: pear/Text_Wiki/Text/Wiki/Parse/Embed.php diff -u pear/Text_Wiki/Text/Wiki/Parse/Embed.php:1.1 pear/Text_Wiki/Text/Wiki/Parse/Embed.php:1.2 --- pear/Text_Wiki/Text/Wiki/Parse/Embed.php:1.1 Sun Jun 6 11:44:34 2004 +++ pear/Text_Wiki/Text/Wiki/Parse/Embed.php Fri Jun 11 10:57:23 2004 @@ -1,5 +1,5 @@ <?php -// $Id: Embed.php,v 1.1 2004/06/06 15:44:34 pmjones Exp $ +// $Id: Embed.php,v 1.2 2004/06/11 14:57:23 pmjones Exp $ /** @@ -26,6 +26,13 @@ 'base' => '/path/to/scripts/' ); + var $file = null; + + var $output = null; + + var $vars = null; + + /** * * The regular expression used to find source text matching this @@ -37,7 +44,7 @@ * */ - var $regex = '/(\[\[embed )(.+?)(\]\])/i'; + var $regex = '/(\[\[embed )(.+?)( .+?)?(\]\])/i'; /** @@ -57,12 +64,25 @@ function process(&$matches) { - $file = $this->getConf('base') . $matches[2]; - ob_start(); - include($file); - $options = array('text' => ob_get_contents()); - ob_end_clean(); - return $this->wiki->addToken($this->rule, $options); + // save the file location + $this->file = $this->getConf('base', './') . $matches[2]; + + // extract attribs as variables in the local space + $this->vars = $this->getAttrs($matches[3]); + unset($this->vars['this']); + extract($this->vars); + + // run the script + ob_start(); + include($this->file); + $this->output = ob_get_contents(); + ob_end_clean(); + + // done, place the script output directly in the source + return $this->wiki->addToken( + $this->rule, + array('text' => $this->output) + ); } } ?> http://cvs.php.net/diff.php/pear/Text_Wiki/Text/Wiki/Parse/Include.php?r1=1.1&r2=1.2&ty=u Index: pear/Text_Wiki/Text/Wiki/Parse/Include.php diff -u pear/Text_Wiki/Text/Wiki/Parse/Include.php:1.1 pear/Text_Wiki/Text/Wiki/Parse/Include.php:1.2 --- pear/Text_Wiki/Text/Wiki/Parse/Include.php:1.1 Sun Jun 6 11:44:34 2004 +++ pear/Text_Wiki/Text/Wiki/Parse/Include.php Fri Jun 11 10:57:23 2004 @@ -1,5 +1,5 @@ <?php -// $Id: Include.php,v 1.1 2004/06/06 15:44:34 pmjones Exp $ +// $Id: Include.php,v 1.2 2004/06/11 14:57:23 pmjones Exp $ /** @@ -24,10 +24,16 @@ class Text_Wiki_Parse_Include extends Text_Wiki_Parse { - $conf = array( + var $conf = array( 'base' => '/path/to/scripts/' ); + var $file = null; + + var $output = null; + + var $vars = null; + /** * * The regular expression used to find source text matching this @@ -39,7 +45,7 @@ * */ - var $regex = '/(\[\[include )(.+?)(\]\])/i'; + var $regex = '/(\[\[include )(.+?)( .+?)?(\]\])/i'; /** @@ -57,12 +63,22 @@ function process(&$matches) { - $file = $this->getConf(['base'], './') . $matches[2]; + // save the file location + $this->file = $this->getConf('base', './') . $matches[2]; + + // extract attribs as variables in the local space + $this->vars = $this->getAttrs($matches[3]); + unset($this->vars['this']); + extract($this->vars); + + // run the script ob_start(); - include($file); - $output = ob_get_contents(); + include($this->file); + $this->output = ob_get_contents(); ob_end_clean(); - return $output; + + // done, place the script output directly in the source + return $this->output; } } ?> http://cvs.php.net/diff.php/pear/Text_Wiki/Text/Wiki/Render/Xhtml/Embed.php?r1=1.1&r2=1.2&ty=u Index: pear/Text_Wiki/Text/Wiki/Render/Xhtml/Embed.php diff -u pear/Text_Wiki/Text/Wiki/Render/Xhtml/Embed.php:1.1 pear/Text_Wiki/Text/Wiki/Render/Xhtml/Embed.php:1.2 --- pear/Text_Wiki/Text/Wiki/Render/Xhtml/Embed.php:1.1 Sun Jun 6 11:44:35 2004 +++ pear/Text_Wiki/Text/Wiki/Render/Xhtml/Embed.php Fri Jun 11 10:57:24 2004 @@ -17,12 +17,7 @@ function token($options) { - $file = $this->getConf('base') . $options['path']; - ob_start(); - include($file); - $output = ob_get_contents(); - ob_end_clean(); - return $output; - } + return $options['text']; + } } ?>

« previous php.pear.cvs (#20516) next »