1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 20:58:30 +01:00

Correction of shortcode global issue. As per e107 v1.x - shortcodes should only ever be registered globally using e_shortcode.php or xxx.sc files.

This commit is contained in:
Cameron 2013-05-31 18:40:56 -07:00
parent 8d94fa8b23
commit b8cdc71795
8 changed files with 27 additions and 26 deletions

View File

@ -415,11 +415,11 @@ class news {
setScVar('news_shortcodes', 'param', $param);
*/
// Retrieve batch sc object, set required vars
e107::getScBatch('news')
$sc = e107::getScBatch('news')
->setScVar('news_item', $news)
->setScVar('param', $param);
$text = e107::getParser()->parseTemplate($NEWS_PARSE, true);
$text = e107::getParser()->parseTemplate($NEWS_PARSE, true, $sc);
if ($mode == 'return')
{

View File

@ -376,7 +376,8 @@ class e_parse_shortcode
// If it already exists - don't include it again.
if (class_exists($className, false)) // don't allow __autoload()
{
$this->registerClassMethods($className, $path);
// $this->registerClassMethods($className, $path); // XXX Global registration should happen separately - here we want only the object.
$this->scClasses[$className] = new $className(); // located inside registerClassMethods()
return $this->scClasses[$className];
}
@ -386,8 +387,8 @@ class e_parse_shortcode
if (class_exists($className, false)) // don't allow __autoload()
{
// register instance directly to allow override
// $this->scClasses[$className] = new $className(); // located inside registerClassMethods()
$this->registerClassMethods($className, $path);
$this->scClasses[$className] = new $className(); // located inside registerClassMethods()
// $this->registerClassMethods($className, $path);
return $this->scClasses[$className];
}
elseif(E107_DBG_BBSC || E107_DBG_SC)

View File

@ -1382,7 +1382,7 @@ class e_navigation
$sc->setVars($_data);
$active = ($this->isActive($_data)) ? "_active" : "";
$itemTmpl = count($_data['link_sub']) > 0 ? $template['item_submenu'.$active] : $template['item'.$active];
$ret .= e107::getParser()->parseTemplate($itemTmpl, TRUE);
$ret .= e107::getParser()->parseTemplate($itemTmpl, TRUE, $sc);
$sc->active = ($active) ? true : false;
$sc->counter++;
}
@ -1638,7 +1638,7 @@ class navigation_shortcodes extends e_shortcode
$this->setVars($val);
$active = (e107::getNav()->isActive($val)) ? "_active" : "";
$tmpl = vartrue($val['link_sub']) ? varset($this->template['submenu_loweritem'.$active]) : varset($this->template['submenu_item'.$active]);
$text .= e107::getParser()->parseTemplate($tmpl, TRUE);
$text .= e107::getParser()->parseTemplate($tmpl, TRUE, $this);
}
$text .= e107::getParser()->parseTemplate(str_replace('{LINK_SUB}', '', $this->template['submenu_end']), true, $this);

View File

@ -94,7 +94,7 @@ class plugin_faqs_list_controller extends eControllerFront
$sc->tag = htmlspecialchars($tag, ENT_QUOTES, 'utf-8');
$sc->category = $category;
$text = $tp->parseTemplate($FAQ_START, true);
$text = $tp->parseTemplate($FAQ_START, true, $sc);
while ($rw = $sql->db_Fetch())
{
@ -104,20 +104,20 @@ class plugin_faqs_list_controller extends eControllerFront
{
if($prevcat !='')
{
$text .= $tp->parseTemplate($FAQ_LISTALL['end'], true);
$text .= $tp->parseTemplate($FAQ_LISTALL['end'], true, $sc);
}
$text .= "\n\n<!-- FAQ Start ".$rw['faq_info_order']."-->\n\n";
$text .= $tp->parseTemplate($FAQ_LISTALL['start'], true);
$text .= $tp->parseTemplate($FAQ_LISTALL['start'], true, $sc);
$start = TRUE;
}
$text .= $tp->parseTemplate($FAQ_LISTALL['item'], true);
$text .= $tp->parseTemplate($FAQ_LISTALL['item'], true, $sc);
$prevcat = $rw['faq_info_order'];
$sc->counter++;
if($category) $meta = $rw;
}
$text .= $tp->parseTemplate($FAQ_LISTALL['end'], true);
$text .= $tp->parseTemplate($FAQ_END, true);
$text .= $tp->parseTemplate($FAQ_LISTALL['end'], true, $sc);
$text .= $tp->parseTemplate($FAQ_END, true, $sc);
// add meta data if there is parent category
if(!empty($meta))

View File

@ -204,19 +204,19 @@ class faq
{
if($prevcat !='')
{
$text .= $tp->parseTemplate($FAQ_LISTALL_END, true);
$text .= $tp->parseTemplate($FAQ_LISTALL_END, true, $sc);
}
$text .= "\n\n<!-- FAQ Start ".$rw['faq_info_order']."-->\n\n";
$text .= $tp->parseTemplate($FAQ_LISTALL_START, true);
$text .= $tp->parseTemplate($FAQ_LISTALL_START, true, $sc);
$start = TRUE;
}
$text .= $tp->parseTemplate($FAQ_LISTALL_LOOP, true);
$text .= $tp->parseTemplate($FAQ_LISTALL_LOOP, true, $sc);
$prevcat = $rw['faq_info_order'];
}
$text .= $tp->parseTemplate($FAQ_LISTALL_END, true);
$text .= $tp->parseTemplate($FAQ_END, true);
$text .= $tp->parseTemplate($FAQ_LISTALL_END, true, $sc);
$text .= $tp->parseTemplate($FAQ_END, true, $sc);
$ret['title'] = FAQLAN_FAQ;
$ret['text'] = $text;

View File

@ -142,12 +142,12 @@ class plugin_gallery_index_controller extends eControllerFront
$sc->setVars($row)
->addVars($cat);
$inner .= $tp->parseTemplate($template['LIST_ITEM'],TRUE);
$inner .= $tp->parseTemplate($template['LIST_ITEM'],TRUE, $sc);
}
$text = $tp->parseTemplate($template['LIST_START'],TRUE);
$text = $tp->parseTemplate($template['LIST_START'],TRUE, $sc);
$text .= $inner;
$text .= $tp->parseTemplate($template['LIST_END'],TRUE);
$text .= $tp->parseTemplate($template['LIST_END'],TRUE, $sc);
$this->addTitle($catname)
->addTitle(LAN_PLUGIN_GALLERY_TITLE)

View File

@ -59,7 +59,7 @@ class gallery
foreach($this->catList as $val)
{
$sc->setVars($val);
$text .= e107::getParser()->parseTemplate($template['CAT_ITEM'],TRUE);
$text .= e107::getParser()->parseTemplate($template['CAT_ITEM'],TRUE, $sc);
}
$text = $template['CAT_START'].$text.$template['CAT_END'];
e107::getRender()->tablerender("Gallery",$text);
@ -86,12 +86,12 @@ class gallery
foreach($list as $row)
{
$sc->setVars($row);
$inner .= $tp->parseTemplate($template['LIST_ITEM'],TRUE);
$inner .= $tp->parseTemplate($template['LIST_ITEM'],TRUE, $sc);
}
$text = $tp->parseTemplate($template['LIST_START'],TRUE);
$text = $tp->parseTemplate($template['LIST_START'],TRUE, $sc);
$text .= $inner;
$text .= $tp->parseTemplate($template['LIST_END'],TRUE);
$text .= $tp->parseTemplate($template['LIST_END'],TRUE, $sc);
e107::getRender()->tablerender("Gallery :: ".$catname,$mes->render().$text);

View File

@ -468,7 +468,7 @@ class poll
// $OPTION = $tp->parseTemplate("{ANSWER}",true);
$text .= $tp->parseTemplate($template, true);
$text .= $tp->parseTemplate($template, true, $sc);
$count ++;
$sc->answerCount++;