From e05425fbb2b315a50d4e15dabe13c886b2803c93 Mon Sep 17 00:00:00 2001 From: Cameron Date: Fri, 16 Dec 2016 10:53:59 -0800 Subject: [PATCH] PHP 7.1 Fixes. --- e107_core/shortcodes/batch/news_shortcodes.php | 10 +++++++--- e107_handlers/menu_class.php | 2 +- e107_handlers/shortcode_handler.php | 7 ++++++- e107_plugins/social/e_shortcode.php | 3 +-- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/e107_core/shortcodes/batch/news_shortcodes.php b/e107_core/shortcodes/batch/news_shortcodes.php index 6a26de117..6b250685f 100644 --- a/e107_core/shortcodes/batch/news_shortcodes.php +++ b/e107_core/shortcodes/batch/news_shortcodes.php @@ -512,10 +512,10 @@ class news_shortcodes extends e_shortcode } } - function sc_extended($parm='') + function sc_extended($parm=null) { - $class = vartrue($parm['class']) ? "class='".$parm['class']."'" : ''; + $class = !empty($parm['class']) ? "class='".$parm['class']."'" : ''; if ($this->news_item['news_extended'] && ($this->param['current_action'] != 'extend' || $parm == 'force')) { @@ -931,6 +931,10 @@ class news_shortcodes extends e_shortcode /* @deprecated - use {NEWS_CATEGORY_ICON} instead */ function sc_newscaticon($parm = array()) { + if(is_string($parm)) + { + $parm = array('type'=>$parm); + } // BC $category_icon = str_replace('../', '', trim($this->news_item['category_icon'])); if (!$category_icon) { return ''; } @@ -955,7 +959,7 @@ class news_shortcodes extends e_shortcode $icon = e107::getParser()->toIcon($category_icon, $parm); - switch($parm) + switch($parm['type']) { /* @deprecated - Will cause issues with glyphs */ case 'src': diff --git a/e107_handlers/menu_class.php b/e107_handlers/menu_class.php index 746651832..6d7577ec5 100644 --- a/e107_handlers/menu_class.php +++ b/e107_handlers/menu_class.php @@ -140,7 +140,7 @@ class e_menu */ public function pref() { - return $this->_current_parms; + return (empty($this->_current_parms)) ? array() : $this->_current_parms; } diff --git a/e107_handlers/shortcode_handler.php b/e107_handlers/shortcode_handler.php index 1a80b054d..c466106c7 100644 --- a/e107_handlers/shortcode_handler.php +++ b/e107_handlers/shortcode_handler.php @@ -1007,7 +1007,12 @@ class e_parse_shortcode $parm = trim($parm); $parm = str_replace(array('[[', ']]'), array('{', '}'), $parm); } - + + if(empty($parm)) + { + $parm = array(); + } + if (E107_DBG_BBSC || E107_DBG_SC || E107_DBG_TIMEDETAILS) { diff --git a/e107_plugins/social/e_shortcode.php b/e107_plugins/social/e_shortcode.php index e8a1a40d4..9e3d0251b 100644 --- a/e107_plugins/social/e_shortcode.php +++ b/e107_plugins/social/e_shortcode.php @@ -187,9 +187,8 @@ class social_shortcodes extends e_shortcode * $socialArray = array('url'=>'your-url-here', 'title'=>'your-title-here'); e107::getScBatch('social')->setVars($socialArray); */ - function sc_socialshare($parm='') // Designed so that no additional JS required. + function sc_socialshare($parm=array()) // Designed so that no additional JS required. { - $pref = e107::pref('social'); if(varset($pref['sharing_mode']) == 'off')