From 6c790d9ab631b750aaab776ae2aad3255d440532 Mon Sep 17 00:00:00 2001 From: CaMer0n Date: Tue, 24 Apr 2012 11:22:07 +0000 Subject: [PATCH] renamed internal shortcode variable from 'eParserVars' to 'var'. ie. use $this->var['field_name'] inside shortcode batches. --- e107_handlers/shortcode_handler.php | 10 +++++----- e107_plugins/gallery/gallery.php | 3 ++- .../shortcodes/batch/gallery_shortcodes.php | 16 ++++++++-------- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/e107_handlers/shortcode_handler.php b/e107_handlers/shortcode_handler.php index ad001bf9f..ef6eabd34 100644 --- a/e107_handlers/shortcode_handler.php +++ b/e107_handlers/shortcode_handler.php @@ -689,7 +689,7 @@ class e_parse_shortcode } // egister passed eVars object on init - call it manually? - // $this->callScFunc($_class, 'setVars', $this->eParserVars); + // $this->callScFunc($_class, 'setVars', $this->var); } // FIXME - register passed eVars object - BAD solution - called on EVERY sc method call @@ -895,7 +895,7 @@ class e_shortcode * Stores passed to shortcode handler simple parser object * @var e_vars */ - protected $eParserVars = null; + protected $var = null; // value returned by each shortcode. /** * Storage for shortcode values @@ -916,7 +916,7 @@ class e_shortcode */ public function setParserVars($eVars) { - $this->eParserVars = $eVars; + $this->var = $eVars; return $this; } @@ -927,8 +927,8 @@ class e_shortcode */ public function getParserVars() { - if(null === $this->eParserVars) $this->eParserVars = new e_vars(); - return $this->eParserVars; + if(null === $this->var) $this->var = new e_vars(); + return $this->var; } /** diff --git a/e107_plugins/gallery/gallery.php b/e107_plugins/gallery/gallery.php index 9e86e197f..ad2ed4ee4 100644 --- a/e107_plugins/gallery/gallery.php +++ b/e107_plugins/gallery/gallery.php @@ -107,7 +107,8 @@ class gallery foreach($list as $row) { - $sc->setParserVars($row); + $sc->setParserVars($row); + echo "THIS=".$sc->getScVar['gallery_caption']; $inner .= $tp->parseTemplate($template['LIST_ITEM'],TRUE); } diff --git a/e107_plugins/gallery/shortcodes/batch/gallery_shortcodes.php b/e107_plugins/gallery/shortcodes/batch/gallery_shortcodes.php index d3abd2c72..cfeb025b6 100644 --- a/e107_plugins/gallery/shortcodes/batch/gallery_shortcodes.php +++ b/e107_plugins/gallery/shortcodes/batch/gallery_shortcodes.php @@ -20,8 +20,8 @@ class gallery_shortcodes extends e_shortcode function sc_gallery_caption($parm='') { $tp = e107::getParser(); - $text = ""; - $text .= $this->eParserVars['media_caption']; + $text = ""; + $text .= $this->var['media_caption']; $text .= ""; return $text; } @@ -30,8 +30,8 @@ class gallery_shortcodes extends e_shortcode { $tp = e107::getParser(); $att = ($parm) ?$parm : 'aw=190&ah=150'; - $text = ""; - $text .= ""; + $text = ""; + $text .= ""; $text .= ""; return $text; } @@ -39,8 +39,8 @@ class gallery_shortcodes extends e_shortcode function sc_gallery_cat_title($parm='') { $tp = e107::getParser(); - $text = ""; - $text .= $tp->toHtml($this->eParserVars['media_cat_title']); + $text = ""; + $text .= $tp->toHtml($this->var['media_cat_title']); $text .= ""; return $text; } @@ -48,8 +48,8 @@ class gallery_shortcodes extends e_shortcode function sc_gallery_cat_thumb($parm='') { $att = ($parm) ?$parm : 'aw=190&ah=150'; - $text = ""; - $text .= ""; + $text = ""; + $text .= ""; $text .= ""; return $text; }