1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-01 12:20:44 +02:00

Bugtracker #4561 - possible fix for nested calls to shortcode handler

This commit is contained in:
e107steved
2008-10-30 20:21:55 +00:00
parent f8c42ff9ed
commit 01e378b0d4

View File

@@ -12,9 +12,9 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_handlers/shortcode_handler.php,v $ | $Source: /cvs_backup/e107_0.8/e107_handlers/shortcode_handler.php,v $
| $Revision: 1.13 $ | $Revision: 1.14 $
| $Date: 2008-03-13 19:15:56 $ | $Date: 2008-10-30 20:21:55 $
| $Author: lisa_ $ | $Author: e107steved $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@@ -32,15 +32,17 @@ function register_shortcode($code, $filename, $function, $force=false)
class e_shortcode class e_shortcode
{ {
var $scList; // The actual code - added by parsing files or when plugin codes encountered. Array key is the shortcode name. var $scList; // The actual code - added by parsing files or when plugin codes encountered. Array key is the shortcode name.
var $parseSCFiles; // True if shortcode file has been parsed var $parseSCFiles; // True if individual shortcode files are to be used
var $addedCodes; // Apparently not used var $addedCodes; // Apparently not used
var $registered_codes; // Shortcodes added by plugins var $registered_codes; // Shortcodes added by plugins
function e_shortcode() function e_shortcode()
{ {
global $pref, $register_sc; global $pref, $register_sc;
$this->shortcode_functions = array(); $this->parseSCFiles = TRUE; // Default probably never used, but make sure its defined.
$this->registered_codes = array(); // Think this used to access an undefined variable
if(varset($pref['shortcode_list'],'') != '') if(varset($pref['shortcode_list'],'') != '')
{ {
foreach($pref['shortcode_list'] as $path=>$namearray) foreach($pref['shortcode_list'] as $path=>$namearray)
@@ -74,6 +76,7 @@ class e_shortcode
function parseCodes($text, $useSCFiles = true, $extraCodes = '') function parseCodes($text, $useSCFiles = true, $extraCodes = '')
{ {
$saveParseSCFiles = $this->parseSCFiles; // In case of nested call
$this->parseSCFiles = $useSCFiles; $this->parseSCFiles = $useSCFiles;
if(is_array($extraCodes)) if(is_array($extraCodes))
{ {
@@ -83,6 +86,7 @@ class e_shortcode
} }
} }
$ret = preg_replace_callback('#\{(\S[^\x02]*?\S)\}#', array(&$this, 'doCode'), $text); $ret = preg_replace_callback('#\{(\S[^\x02]*?\S)\}#', array(&$this, 'doCode'), $text);
$this->parseSCFiles = $saveParseSCFiles; // Restore previous value
return $ret; return $ret;
} }