1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-10 16:46:50 +02:00

renamed internal shortcode variable from 'eParserVars' to 'var'. ie. use $this->var['field_name'] inside shortcode batches.

This commit is contained in:
CaMer0n
2012-04-24 11:22:07 +00:00
parent 711a2965de
commit 6c790d9ab6
3 changed files with 15 additions and 14 deletions

View File

@@ -689,7 +689,7 @@ class e_parse_shortcode
} }
// egister passed eVars object on init - call it manually? // 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 // 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 * Stores passed to shortcode handler simple parser object
* @var e_vars * @var e_vars
*/ */
protected $eParserVars = null; protected $var = null; // value returned by each shortcode.
/** /**
* Storage for shortcode values * Storage for shortcode values
@@ -916,7 +916,7 @@ class e_shortcode
*/ */
public function setParserVars($eVars) public function setParserVars($eVars)
{ {
$this->eParserVars = $eVars; $this->var = $eVars;
return $this; return $this;
} }
@@ -927,8 +927,8 @@ class e_shortcode
*/ */
public function getParserVars() public function getParserVars()
{ {
if(null === $this->eParserVars) $this->eParserVars = new e_vars(); if(null === $this->var) $this->var = new e_vars();
return $this->eParserVars; return $this->var;
} }
/** /**

View File

@@ -107,7 +107,8 @@ class gallery
foreach($list as $row) foreach($list as $row)
{ {
$sc->setParserVars($row); $sc->setParserVars($row);
echo "THIS=".$sc->getScVar['gallery_caption'];
$inner .= $tp->parseTemplate($template['LIST_ITEM'],TRUE); $inner .= $tp->parseTemplate($template['LIST_ITEM'],TRUE);
} }

View File

@@ -20,8 +20,8 @@ class gallery_shortcodes extends e_shortcode
function sc_gallery_caption($parm='') function sc_gallery_caption($parm='')
{ {
$tp = e107::getParser(); $tp = e107::getParser();
$text = "<a title='".$tp->toAttribute($this->eParserVars['media_caption'])."' href='".e107::getParser()->replaceConstants($this->eParserVars['media_url'],'abs')."' rel='lightbox[Gallery2]' >"; $text = "<a title='".$tp->toAttribute($this->var['media_caption'])."' href='".e107::getParser()->replaceConstants($this->var['media_url'],'abs')."' rel='lightbox[Gallery2]' >";
$text .= $this->eParserVars['media_caption']; $text .= $this->var['media_caption'];
$text .= "</a>"; $text .= "</a>";
return $text; return $text;
} }
@@ -30,8 +30,8 @@ class gallery_shortcodes extends e_shortcode
{ {
$tp = e107::getParser(); $tp = e107::getParser();
$att = ($parm) ?$parm : 'aw=190&ah=150'; $att = ($parm) ?$parm : 'aw=190&ah=150';
$text = "<a title='".$tp->toAttribute($this->eParserVars['media_caption'])."' href='".e107::getParser()->replaceConstants($this->eParserVars['media_url'],'abs')."' rel='lightbox[Gallery]' >"; $text = "<a title='".$tp->toAttribute($this->var['media_caption'])."' href='".e107::getParser()->replaceConstants($this->var['media_url'],'abs')."' rel='lightbox[Gallery]' >";
$text .= "<img src='".e107::getParser()->thumbUrl($this->eParserVars['media_url'],$att)."' alt='' />"; $text .= "<img src='".e107::getParser()->thumbUrl($this->var['media_url'],$att)."' alt='' />";
$text .= "</a>"; $text .= "</a>";
return $text; return $text;
} }
@@ -39,8 +39,8 @@ class gallery_shortcodes extends e_shortcode
function sc_gallery_cat_title($parm='') function sc_gallery_cat_title($parm='')
{ {
$tp = e107::getParser(); $tp = e107::getParser();
$text = "<a href='".e_SELF."?cat=".$this->eParserVars['media_cat_category']."'>"; $text = "<a href='".e_SELF."?cat=".$this->var['media_cat_category']."'>";
$text .= $tp->toHtml($this->eParserVars['media_cat_title']); $text .= $tp->toHtml($this->var['media_cat_title']);
$text .= "</a>"; $text .= "</a>";
return $text; return $text;
} }
@@ -48,8 +48,8 @@ class gallery_shortcodes extends e_shortcode
function sc_gallery_cat_thumb($parm='') function sc_gallery_cat_thumb($parm='')
{ {
$att = ($parm) ?$parm : 'aw=190&ah=150'; $att = ($parm) ?$parm : 'aw=190&ah=150';
$text = "<a href='".e_SELF."?cat=".$this->eParserVars['media_cat_category']."'>"; $text = "<a href='".e_SELF."?cat=".$this->var['media_cat_category']."'>";
$text .= "<img src='".e107::getParser()->thumbUrl($this->eParserVars['media_cat_image'],$att)."' alt='' />"; $text .= "<img src='".e107::getParser()->thumbUrl($this->var['media_cat_image'],$att)."' alt='' />";
$text .= "</a>"; $text .= "</a>";
return $text; return $text;
} }