From 716678a3b716f1bf4f274ec3068d776cc7356207 Mon Sep 17 00:00:00 2001 From: Cameron Date: Tue, 19 Apr 2016 16:57:44 -0700 Subject: [PATCH] PHP Notice and BC Fixes. --- .../shortcodes/batch/news_shortcodes.php | 27 ++++++++++++++----- e107_plugins/download/download.php | 18 +++++++++++++ e107_plugins/news/news_carousel_menu.php | 4 ++- e107_plugins/news/other_news2_menu.php | 6 ++++- e107_plugins/news/other_news_menu.php | 5 +++- e107_plugins/newsfeed/newsfeed_functions.php | 2 +- 6 files changed, 51 insertions(+), 11 deletions(-) diff --git a/e107_core/shortcodes/batch/news_shortcodes.php b/e107_core/shortcodes/batch/news_shortcodes.php index 24e598455..813674033 100644 --- a/e107_core/shortcodes/batch/news_shortcodes.php +++ b/e107_core/shortcodes/batch/news_shortcodes.php @@ -34,6 +34,8 @@ class news_shortcodes extends e_shortcode protected $commentsEngine = 'e107'; private $imageItem; + + public $param = array(); function __construct($eVars = null) @@ -80,7 +82,10 @@ class news_shortcodes extends e_shortcode { $tp = e107::getParser(); e107::getBB()->setClass("news"); // For automatic bbcode image resizing. - + + + $news_body = ''; + if($parm != 'extended') { $news_body = $tp->toHTML($this->news_item['news_body'], true, 'BODY, fromadmin', $this->news_item['news_author']); @@ -90,7 +95,9 @@ class news_shortcodes extends e_shortcode { $news_body .= $tp->toHTML($this->news_item['news_extended'], true, 'BODY, fromadmin', $this->news_item['news_author']); } + e107::getBB()->clearClass(); + return $news_body; } @@ -511,7 +518,8 @@ class news_shortcodes extends e_shortcode { $tp = e107::getParser(); $text = $tp->toHtml($this->news_item['news_body'],true); - $text = str_replace("
","\n",$text); + $breaks = array('
','
'); + $text = str_replace($breaks,"\n",$text); $text = strip_tags($text); $tmp = preg_split('/(\.\s|!|\r|\n|\?)/i', trim($text)); $tmp = array_filter($tmp); @@ -597,18 +605,23 @@ class news_shortcodes extends e_shortcode $_src = $src = ($newsThumb[0] == '{' || $parms[1] == 'placeholder') ? e107::getParser()->replaceConstants($newsThumb, 'abs') : e_IMAGE_ABS."newspost_images/".$newsThumb; - if($parms[2] || $parms[1] == 'placeholder') + if(!empty($parms[2]) || $parms[1] == 'placeholder') { // $srcset = "srcset='".$tp->thumbSrcSet($src,'all')."' size='100vw' "; - $src = e107::getParser()->thumbUrl($src, $parms[2]); + $attr = !empty($parms[2]) ? $parms[2] : null; + $src = e107::getParser()->thumbUrl($src, $attr); $dimensions = e107::getParser()->thumbDimensions(); } } - - - + + if(empty($parms[1])) + { + $parms = array(1 => null); + } + + switch($parms[1]) { case 'src': diff --git a/e107_plugins/download/download.php b/e107_plugins/download/download.php index f9528ba43..2daaec3b2 100644 --- a/e107_plugins/download/download.php +++ b/e107_plugins/download/download.php @@ -19,6 +19,24 @@ if (!e107::isInstalled('download')) } e107::lan('download',false, true); // Loads e_PLUGIN.'download/languages/'.e_LANGUAGE.'/English_front.php' + + $bcList = array( + 'LAN_dl_19' => 'LAN_CATEGORY', + 'LAN_dl_17' => 'LAN_FILES', + "LAN_dl_20" => "LAN_FILES", + "LAN_dl_21" => "LAN_SIZE", + "LAN_dl_22" => "LAN_DATE", + "LAN_dl_23" => "LAN_FILE", + "LAN_dl_24" => "LAN_AUTHOR", + "LAN_dl_25" => "LAN_ASCENDING", + "LAN_dl_26" => "LAN_DESCENDING", + "LAN_dl_27" => "LAN_GO", + "LAN_dl_28" => "LAN_NAME" + ); + + e107::getLanguage()->bcDefs($bcList); + + require_once(e_PLUGIN.'download/handlers/download_class.php'); require_once(e_PLUGIN.'download/handlers/category_class.php'); diff --git a/e107_plugins/news/news_carousel_menu.php b/e107_plugins/news/news_carousel_menu.php index 1851c3cb6..02387dd8a 100644 --- a/e107_plugins/news/news_carousel_menu.php +++ b/e107_plugins/news/news_carousel_menu.php @@ -23,9 +23,11 @@ if(isset($parms['caption'][e_LANGUAGE])) $limit = vartrue($parms['count'],5); $tp = e107::getParser(); -$template = e107::getTemplate('news', 'news_menu', 'carousel'); +$template = e107::getTemplate('news', 'news_menu', 'carousel', false, true); $nobody_regexp = "'(^|,)(".str_replace(",", "|", e_UC_NOBODY).")(,|$)'"; + +e107::getDebug()->log("News Carousel Menu ".print_a($parms,true)); $query = " SELECT n.*, nc.category_id, nc.category_name, nc.category_sef, nc.category_icon, diff --git a/e107_plugins/news/other_news2_menu.php b/e107_plugins/news/other_news2_menu.php index 44baf4852..918951dcd 100644 --- a/e107_plugins/news/other_news2_menu.php +++ b/e107_plugins/news/other_news2_menu.php @@ -39,7 +39,11 @@ if(!$OTHERNEWS2_STYLE) { if(deftrue('BOOTSTRAP')) // v2.x { - define("OTHERNEWS_COLS",false); + if(!defined("OTHERNEWS_COLS")) + { + define("OTHERNEWS_COLS",false); + } + $template = e107::getTemplate('news', 'news_menu', 'other2'); $OTHERNEWS2_STYLE = $template['item']; diff --git a/e107_plugins/news/other_news_menu.php b/e107_plugins/news/other_news_menu.php index fc02371f5..8ce2186eb 100644 --- a/e107_plugins/news/other_news_menu.php +++ b/e107_plugins/news/other_news_menu.php @@ -51,7 +51,10 @@ if(!$OTHERNEWS_STYLE) { if(deftrue('BOOTSTRAP')) // v2.x { - define("OTHERNEWS_COLS",false); + if(!defined("OTHERNEWS_COLS")) + { + define("OTHERNEWS_COLS",false); + } $template = e107::getTemplate('news', 'news_menu', 'other'); $item_selector = '
diff --git a/e107_plugins/newsfeed/newsfeed_functions.php b/e107_plugins/newsfeed/newsfeed_functions.php index 11000e7b3..ee4a79b89 100644 --- a/e107_plugins/newsfeed/newsfeed_functions.php +++ b/e107_plugins/newsfeed/newsfeed_functions.php @@ -387,7 +387,7 @@ class newsfeedClass if($which == 'all') { - $ret['title'] = $NEWSFEED_MENU_CAPTION; + $ret['title'] = (!empty($NEWSFEED_MENU_CAPTION)) ? $NEWSFEED_MENU_CAPTION : ''; } else {