Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

news shortcodes moved to plugin #5066

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion e107_core/shortcodes/single/news_categories.sc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ $e107 = e107::getInstance();
$sql = e107::getDb();
$pref = e107::getPref();
$tp = e107::getParser();
$scbatch = e107::getScBatch('news');
$scbatch = e107::getScBatch('news', TRUE);



Expand Down
4 changes: 2 additions & 2 deletions e107_handlers/news_class.php
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ function render_newsitem($news, $mode = 'default', $n_restrict = '', $NEWS_TEMPL



$sc = e107::getScBatch('news')
$sc = e107::getScBatch('news', TRUE)
->wrapper($wrapperKey)
->setScVar('news_item', $news)
->setScVar('param', $param)
Expand Down Expand Up @@ -889,7 +889,7 @@ function render($template = array(), $parms = array(), $tablerender = true)
));

$parser = e107::getParser();
$batch = e107::getScBatch('news')
$batch = e107::getScBatch('news', TRUE)
->setScVar('param', $param);

$wrapperKey = ($parms['tmpl'].'/'.$parms['tmpl_key']);
Expand Down
2 changes: 1 addition & 1 deletion e107_plugins/news/e_gsitemap.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public function allPosts()
$data = $this->getNewsPosts();

/** @var news_shortcodes $sc */
$sc = e107::getScBatch('news');
$sc = e107::getScBatch('news', TRUE);

e107::getParser()->thumbWidth(1000);

Expand Down
8 changes: 4 additions & 4 deletions e107_plugins/news/latestnews_menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@
}

/* Prevent data-overwrite if menu is called within news template and more news shortcodes are called after */
$origParam = e107::getScBatch('news')->getScVar('param');
$origData = e107::getScBatch('news')->getScVar('news_item');
$origParam = e107::getScBatch('news', TRUE)->getScVar('param');
$origData = e107::getScBatch('news', TRUE)->getScVar('news_item');

$cached = $ntree->loadJoinActive(vartrue($parms['category'], 0), false, $treeparm)->render($template, $parms, true);
e107::getCache()->set($cacheString, $cached);

e107::getScBatch('news')->setScVar('param', $origParam);
e107::getScBatch('news')->setScVar('news_item', $origData);
e107::getScBatch('news', TRUE)->setScVar('param', $origParam);
e107::getScBatch('news', TRUE)->setScVar('news_item', $origData);

}

Expand Down
8 changes: 4 additions & 4 deletions e107_plugins/news/news.php
Original file line number Diff line number Diff line change
Expand Up @@ -1348,7 +1348,7 @@ private function renderViewTemplate()

$this->templateKey = $newsViewTemplate; // used for tablerender id.

$nsc = e107::getScBatch('news')->setScVar('news_item', $news); // Allow any news shortcode to be used in the 'caption'.
$nsc = e107::getScBatch('news', TRUE)->setScVar('news_item', $news); // Allow any news shortcode to be used in the 'caption'.
$caption = e107::getParser()->parseTemplate($tmp['caption'], true, $nsc);

$render = true;
Expand Down Expand Up @@ -1869,14 +1869,14 @@ private function renderDefaultTemplate()
$row['category_name'] = LAN_PLUGIN_NEWS_NAME;
}

$nsc = e107::getScBatch('news')->setScVar('news_item', $row)->setScVar('param', $param);
$nsc = e107::getScBatch('news', TRUE)->setScVar('news_item', $row)->setScVar('param', $param);
$this->caption = $tp->parseTemplate($tmpl['caption'], true, $nsc);

}

if(!empty($tmpl['start'])) //v2.1.5
{
$nsc = e107::getScBatch('news')->setScVar('news_item', $newsAr[1])->setScVar('param', $param);
$nsc = e107::getScBatch('news', TRUE)->setScVar('news_item', $newsAr[1])->setScVar('param', $param);
echo $tp->parseTemplate($tmpl['start'],true,$nsc);
}
elseif($sub_action && 'list' == $action && vartrue($newsAr[1]['category_name'])) //old v1.x stuff
Expand Down Expand Up @@ -1959,7 +1959,7 @@ private function renderDefaultTemplate()
if(!empty($tmpl['end']))
{
e107::setRegistry('core/news/pagination', $parms);
$nsc = e107::getScBatch('news')->setScVar('news_item', $newsAr[1])->setScVar('param', $param);
$nsc = e107::getScBatch('news', TRUE)->setScVar('news_item', $newsAr[1])->setScVar('param', $param);
echo $tp->parseTemplate($tmpl['end'], true, $nsc);
if(strpos($tmpl['end'], '{NEWS_PAGINATION') !== false) // BC fix.
{
Expand Down
2 changes: 1 addition & 1 deletion e107_plugins/news/news_carousel_menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@

// $tp->setThumbSize(800,0);

$sc = e107::getScBatch('news');
$sc = e107::getScBatch('news', TRUE);
$text = '';
$nav = array();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function sc_newssummary($parm=null)

public function sc_newsmetadiz($parm=null)
{
trigger_error('<b>{NEWSSUMMARY} is deprecated</b> Use {NEWS_DESCRIPTION} instead', E_USER_DEPRECATED); // NO LAN
trigger_error('<b>{NEWSMETADIZ} is deprecated</b> Use {NEWS_DESCRIPTION} instead', E_USER_DEPRECATED); // NO LAN
return $this->sc_news_description($parm);
}

Expand Down
4 changes: 2 additions & 2 deletions e107_tests/tests/unit/e_parse_shortcodeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -527,8 +527,8 @@ public function testNewsArchiveShortcodes()

public function testNewsShortcodes()
{
require_once(e_CORE."shortcodes/batch/news_shortcodes.php");

//require_once(e_CORE."shortcodes/batch/news_shortcodes.php");
require_once(e_PLUGIN . "news/shortcodes/batch/news_shortcodes.php");
try
{
/** @var news_shortcodes $sc */
Expand Down
4 changes: 2 additions & 2 deletions e107_themes/bootstrap3/theme_shortcodes.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function sc_footer()
/*
function sc_news_summary()
{
$sc = e107::getScBatch('news');
$sc = e107::getScBatch('news', TRUE);
$data = $sc->getScVar('news_item');

return "<span class='label label-danger'>".e107::getParser()->toHTML($data['news_summary'],'BODY')."</span>";
Expand Down Expand Up @@ -286,7 +286,7 @@ function sc_bootstrap_usernav($parm=null)
function sc_bootstrap_news_example($parm=null)
{
$news = e107::getObject('e_news_tree'); // get news class.
$sc = e107::getScBatch('news'); // get news shortcodes.
$sc = e107::getScBatch('news', TRUE); // get news shortcodes.
$tp = e107::getParser(); // get parser.

$newsCategory = 1; // null, number or array(1,3,4);
Expand Down
2 changes: 1 addition & 1 deletion e107_themes/bootstrap5/theme_shortcodes.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ function sc_breadcrumb($array)
function sc_theme_news_banner($parm=null)
{
/** @var news_shortcodes $news */
$sc = e107::getScBatch('news');
$sc = e107::getScBatch('news', TRUE);
$news = $sc->getScVar('news_item');

$ret = '';
Expand Down
Loading