From 21f3f2ed19693c3f61f7159b74553c6d7c35e939 Mon Sep 17 00:00:00 2001 From: Cameron Date: Wed, 1 Apr 2015 23:02:17 -0700 Subject: [PATCH] allow the 'caption=xxxx' menu parameter to function on all news menus. --- e107_plugins/news/news_months_menu.php | 15 +++++++++--- e107_plugins/news/other_news2_menu.php | 34 ++++++++++++++++++++------ e107_plugins/news/other_news_menu.php | 22 +++++++++++++++-- e107_themes/bootstrap/admin_theme.php | 6 ++--- 4 files changed, 60 insertions(+), 17 deletions(-) diff --git a/e107_plugins/news/news_months_menu.php b/e107_plugins/news/news_months_menu.php index 000d7a299..664de24ab 100644 --- a/e107_plugins/news/news_months_menu.php +++ b/e107_plugins/news/news_months_menu.php @@ -11,6 +11,12 @@ if (!defined('e107_INIT')) { exit; } $cString = 'nq_news_months_menu_'.md5($parm); $cached = e107::getCache()->retrieve($cString); +if(!empty($parm)) +{ + parse_str($parm, $parms); +} + + if(false === $cached) { if(!function_exists('newsFormatDate')) @@ -25,11 +31,12 @@ if(false === $cached) } } + if(!isset($parms['showarchive'])) + { + $parms['showarchive'] = 0; + } - //parse_str($parm, $parms); // FIXME - menu settings... - $parms['showarchive'] = 0; - //e107::plugLan('blogcalendar_menu'); // e107::lan('blogcalendar_menu', e_LANGUAGE); // FIXME decide on language file structure (#743) e107::includeLan(e_PLUGIN.'blogcalendar_menu/languages/English.php'); @@ -38,7 +45,7 @@ if(false === $cached) $marray = e107::getDate()->terms('month'); - // TODO parms + //$parms['year'] = "2011 0"; if(vartrue($parms['year'])) { diff --git a/e107_plugins/news/other_news2_menu.php b/e107_plugins/news/other_news2_menu.php index 802b59fad..485c60ecc 100644 --- a/e107_plugins/news/other_news2_menu.php +++ b/e107_plugins/news/other_news2_menu.php @@ -15,11 +15,10 @@ */ if (!defined('e107_INIT')) { exit; } -// FIXME full rewrite -global $e107cache; + // Load Data -if($cacheData = $e107cache->retrieve("nq_othernews2")) +if($cacheData = e107::getCache()->retrieve("nq_othernews2")) { echo $cacheData; return; @@ -31,19 +30,38 @@ unset($text); global $OTHERNEWS2_STYLE; $ix = new news; +if(!empty($parm)) +{ + parse_str($parm, $parms); +} + if(!$OTHERNEWS2_STYLE) { if(deftrue('BOOTSTRAP')) // v2.x { define("OTHERNEWS_COLS",false); $template = e107::getTemplate('news', 'news_menu', 'other2'); - $OTHERNEWS2_STYLE = $template['item']; + $OTHERNEWS2_STYLE = $template['item']; + + if(!empty($parms['caption'])) + { + $template['caption'] = e107::getParser()->toHtml($parms['caption'],true,'TITLE'); + } } else //v1.x { $template['start'] = ''; $template['end'] = ''; - $template['caption'] = TD_MENU_L2; + + + if(!empty($parms['caption'])) + { + $template['caption'] = e107::getParser()->toHtml($parms['caption'],true,'TITLE'); + } + else + { + $template['caption'] = TD_MENU_L2; + } $OTHERNEWS2_STYLE = " @@ -108,7 +126,7 @@ LEFT JOIN #news_category AS nc ON n.news_category = nc.category_id WHERE n.news_class IN (".USERCLASS_LIST.") AND n.news_start < ".time()." AND (n.news_end=0 || n.news_end>".time().") AND FIND_IN_SET(3, n.news_render_type) ORDER BY n.news_datestamp DESC LIMIT 0,". defset('OTHERNEWS2_LIMIT',5); -if ($sql->gen($query)) +if (e107::getDb()->gen($query)) { $text = $tp->parseTemplate($template['start'],true); @@ -157,10 +175,10 @@ if ($sql->gen($query)) // Save Data ob_start(); - $ns->tablerender($template['caption'], $text, 'other_news2'); + e107::getRender()->tablerender($template['caption'], $text, 'other_news2'); $cache_data = ob_get_flush(); - $e107cache->set("nq_othernews2", $cache_data); + e107::getCache()->set("nq_othernews2", $cache_data); } diff --git a/e107_plugins/news/other_news_menu.php b/e107_plugins/news/other_news_menu.php index cd9a107a2..bb1458c1d 100644 --- a/e107_plugins/news/other_news_menu.php +++ b/e107_plugins/news/other_news_menu.php @@ -15,7 +15,7 @@ */ if (!defined('e107_INIT')) { exit; } -// FIXME full rewrite + // Load Data if($cacheData = e107::getCache()->retrieve("nq_othernews")) { @@ -24,6 +24,9 @@ if($cacheData = e107::getCache()->retrieve("nq_othernews")) } + + + require_once(e_HANDLER."news_class.php"); unset($text); global $OTHERNEWS_STYLE; @@ -32,6 +35,11 @@ $ix = new news; $caption = TD_MENU_L1; +if(!empty($parm)) +{ + parse_str($parm, $parms); +} + if(!$OTHERNEWS_STYLE) { if(deftrue('BOOTSTRAP')) // v2.x @@ -41,13 +49,23 @@ if(!$OTHERNEWS_STYLE) $item_selector = '
'; - + + if(!empty($parms['caption'])) + { + $template['caption'] = e107::getParser()->toHtml($parms['caption'],true,'TITLE'); + } + $caption = "
".$template['caption']." ".$item_selector."
"; $OTHERNEWS_STYLE = $template['item']; } else //v1.x { + + if(!empty($parms['caption'])) + { + $caption = e107::getParser()->toHtml($parms['caption'], true,'TITLE'); + } $template['start'] = ''; $template['end'] = ''; diff --git a/e107_themes/bootstrap/admin_theme.php b/e107_themes/bootstrap/admin_theme.php index 18abf85cb..ce64d2d07 100644 --- a/e107_themes/bootstrap/admin_theme.php +++ b/e107_themes/bootstrap/admin_theme.php @@ -132,7 +132,7 @@ class bootstrap_admintheme if(deftrue('e_IFRAME')) { - echo ' + echo '
'.$text.' @@ -185,7 +185,7 @@ class bootstrap_admintheme */ case 'no_caption' : - echo ' + echo '
'.$text.' @@ -196,7 +196,7 @@ class bootstrap_admintheme default: - echo ' + echo '

'.$caption.'