summaryrefslogtreecommitdiff
path: root/LibertySystem.php
diff options
context:
space:
mode:
authorMax Kremmel <xing@synapse.plus.com>2006-04-10 13:58:10 +0000
committerMax Kremmel <xing@synapse.plus.com>2006-04-10 13:58:10 +0000
commitde4f1d22b1d85586cfef95dfb1efaba39c87427d (patch)
treee33e0545a2b3d214ac8c363239dfeb89688bc5bb /LibertySystem.php
parent03b7715af49ca2448dcd8fab2400a1edaaba8e90 (diff)
downloadliberty-de4f1d22b1d85586cfef95dfb1efaba39c87427d.tar.gz
liberty-de4f1d22b1d85586cfef95dfb1efaba39c87427d.tar.bz2
liberty-de4f1d22b1d85586cfef95dfb1efaba39c87427d.zip
change behaviour of liberty data plugin parsing: plugins and their contents are not parsed by format parser anymore. if you want to parse text within the plugin, you need to call the parser yourself from within the plugin, you need to call LibertyContent::parseData manually
Diffstat (limited to 'LibertySystem.php')
-rwxr-xr-xLibertySystem.php21
1 files changed, 17 insertions, 4 deletions
diff --git a/LibertySystem.php b/LibertySystem.php
index 863db13..f3bdd5f 100755
--- a/LibertySystem.php
+++ b/LibertySystem.php
@@ -3,7 +3,7 @@
* System class for handling the liberty package
*
* @package liberty
-* @version $Header: /cvsroot/bitweaver/_bit_liberty/LibertySystem.php,v 1.22 2006/03/25 20:50:16 squareing Exp $
+* @version $Header: /cvsroot/bitweaver/_bit_liberty/LibertySystem.php,v 1.23 2006/04/10 13:58:10 squareing Exp $
* @author spider <spider@steelsun.com>
*/
@@ -278,7 +278,7 @@ class LibertySystem extends LibertyBase {
}
function parse_data_plugins( &$data, &$preparsed, &$noparsed, &$pParser ) {
- global $gLibertySystem;
+ global $gLibertySystem, $gParsedDataPlugins;
// Find the plugins
// note: $curlyTags[0] is the complete match, $curlyTags[1] is plugin name, $curlyTags[2] is plugin arguments
preg_match_all("/\{\/?([A-Za-z]+)([^\}]*)\}/", $data, $curlyTags);
@@ -387,8 +387,10 @@ function parse_data_plugins( &$data, &$preparsed, &$noparsed, &$pParser ) {
$ret = preg_replace( "/\~(\/?)[np]p\~/", '', $ret );
}
- // Replace plugin section with its output in data
- $data = substr_replace($data, $ret, $pos, $pos_end - $pos + strlen($plugin_end));
+ // pass plugin output to hash and place a unique key in the text for later replacement
+ $key = md5( microtime( rand() ) );
+ $gParsedDataPlugins[$key] = $ret;
+ $data = substr_replace( $data, $key, $pos, $pos_end - $pos + strlen( $plugin_end ) );
}
}
$i--;
@@ -401,6 +403,17 @@ function parse_data_plugins( &$data, &$preparsed, &$noparsed, &$pParser ) {
}
}
+// parse_data_plugins places all plugin data in $gParsedDataPlugins. The plugin
+// data is passed back into $data once all the parsing has finished
+function post_parse_data( &$pData ) {
+ global $gParsedDataPlugins;
+ if( !empty( $gParsedDataPlugins ) && is_array( $gParsedDataPlugins ) ) {
+ foreach( $gParsedDataPlugins as $key => $data ) {
+ $pData = str_replace( $key, $data, $pData );
+ }
+ }
+}
+
global $gLibertySystem;
$gLibertySystem = new LibertySystem();
?>