diff --git a/e107_core/shortcodes/batch/download_shortcodes.php b/e107_core/shortcodes/batch/download_shortcodes.php
deleted file mode 100644
index 7a9841bc6..000000000
--- a/e107_core/shortcodes/batch/download_shortcodes.php
+++ /dev/null
@@ -1,523 +0,0 @@
- e_sc -> parse_scbatch(__FILE__);
-/*
-SC_BEGIN DOWNLOAD_LIST_NAME
-global $row,$tp,$pref;
-if($parm == "nolink"){
- return $tp->toHTML($row['download_name'],TRUE,'LINKTEXT');
-}
-if($parm == "request"){
-
- $agreetext = $tp->toJS($tp->toHTML($pref['agree_text'],FALSE,'DESCRIPTION'));
- if($row['download_mirror_type']){
- $text = ($pref['agree_flag'] ? "" : "");
- }else{
- $text = ($pref['agree_flag'] ? "" : "");
- }
- $text .= $tp->toHTML($row['download_name'], FALSE, 'USER_TITLE')."";
- return $text;
-}
-
-return "".$tp->toHTML($row['download_name'],TRUE,'LINKTEXT')."";
-SC_END
-
-
-SC_BEGIN DOWNLOAD_LIST_AUTHOR
-global $row;
-return $row['download_author'];
-SC_END
-
-
-SC_BEGIN DOWNLOAD_LIST_REQUESTED
-global $row;
-return $row['download_requested'];
-SC_END
-
-
-SC_BEGIN DOWNLOAD_LIST_ICON
-global $row;
-$img = "
";
-if($parm == "link"){
- return "".$img."";
-}else{
- return $img;
-}
-return;
-SC_END
-
-
-SC_BEGIN DOWNLOAD_LIST_NEWICON
-global $row;
-return (USER && $row['download_datestamp'] > USERLV ? "
" : "");
-SC_END
-
-
-SC_BEGIN DOWNLOAD_LIST_FILESIZE
-global $row, $e107;
-return $e107->parseMemorySize($row['download_filesize']);
-SC_END
-
-
-SC_BEGIN DOWNLOAD_LIST_DATESTAMP
-global $row;
-$gen = new convert;
-return $gen->convert_date($row['download_datestamp'], "short");
-SC_END
-
-
-SC_BEGIN DOWNLOAD_LIST_THUMB
-global $row;
-$img = ($row['download_thumb']) ? "
" : "";
-if($parm == "link" && $row['download_thumb']){
- return "".$img."";
-}else{
- return $img;
-}
-SC_END
-
-
-SC_BEGIN DOWNLOAD_LIST_ID
-global $row;
-return $row['download_id'];
-SC_END
-
-
-SC_BEGIN DOWNLOAD_LIST_RATING
-global $row;
-$rater = new rater;
-$ratearray = $rater->getrating("download", $row['download_id']);
- if (!$ratearray[0]) {
- return LAN_dl_13;
- } else {
- return ($ratearray[2] ? "{$ratearray[1]}.{$ratearray[2]}/{$ratearray[0]}" : "{$ratearray[1]}/{$ratearray[0]}");
- }
-SC_END
-
-
-SC_BEGIN DOWNLOAD_LIST_LINK
-global $tp,$row,$pref;
-$agreetext = $tp->toJS($tp->toHTML($pref['agree_text'],FALSE,'DESCRIPTION'));
- if($row['download_mirror_type']){
- return ($pref['agree_flag'] ? "" : "");
- }else{
- return ($pref['agree_flag'] ? "" : "");
- }
-SC_END
-
-SC_BEGIN DOWNLOAD_LIST_NEXTPREV
- global $nextprev_parms,$tp;
- return $tp->parseTemplate("{NEXTPREV={$nextprev_parms}}");
-SC_END
-
-
-// ---------------------- Download View ----------------------------------------
-
-SC_BEGIN DOWNLOAD_VIEW_ID
-global $dl;
-return $dl['download_id'];
-SC_END
-
-
-SC_BEGIN DOWNLOAD_ADMIN_EDIT
-global $dl;
-return (ADMIN && getperms('6')) ? "
" : "";
-SC_END
-
-SC_BEGIN DOWNLOAD_CATEGORY
-global $dl;
-return $dl['download_category_name'];
-SC_END
-
-SC_BEGIN DOWNLOAD_CATEGORY_ICON
-global $dl;
-list($present,$missing) = explode(chr(1),$dl['download_category_icon']);
-if($present)
-{
- return "
";
-}
-
-SC_END
-
-SC_BEGIN DOWNLOAD_CATEGORY_DESCRIPTION
-global $tp,$dl;
-$text = $tp -> toHTML($dl['download_category_description'], TRUE,'DESCRIPTION');
-if($parm){
- return substr($text,0,$parm);
-}else{
- return $text;
-}
-SC_END
-
-SC_BEGIN DOWNLOAD_VIEW_NAME
-global $dl;
-$link['view'] = "".$dl['download_name']."";
-$link['request'] = "".$dl['download_name']."";
-
-if($parm){
- return $link[$parm];
-}
-return $dl['download_name'];
-SC_END
-
-SC_BEGIN DOWNLOAD_VIEW_NAME_LINKED
-global $pref,$dl,$tp;
-if ($pref['agree_flag'] == 1) {
- return "toJS($tp->toHTML($pref['agree_text'],FALSE,'DESCRIPTION'))."');\" title='".LAN_dl_46."'>".$dl['download_name']."";
-} else {
- return "".$dl['download_name']."";
-}
-SC_END
-
-SC_BEGIN DOWNLOAD_VIEW_AUTHOR
-global $dl;
-return ($dl['download_author'] ? $dl['download_author'] : "");
-SC_END
-
-
-SC_BEGIN DOWNLOAD_VIEW_AUTHOREMAIL
-global $tp,$dl;
-return ($dl['download_author_email']) ? $tp -> toHTML($dl['download_author_email'], TRUE, 'LINKTEXT') : "";
-SC_END
-
-SC_BEGIN DOWNLOAD_VIEW_AUTHORWEBSITE
-global $tp,$dl;
-return ($dl['download_author_website']) ? $tp -> toHTML($dl['download_author_website'], TRUE,'LINKTEXT') : "";
-SC_END
-
-
-
-SC_BEGIN DOWNLOAD_VIEW_DESCRIPTION
-global $tp, $dl;
-$maxlen = ($parm ? intval($parm) : 0);
-$text = ($dl['download_description'] ? $tp->toHTML($dl['download_description'], TRUE, 'DESCRIPTION') : "");
-if($maxlen){
- return substr($text, 0, $maxlen);
-}else{
- return $text;
-}
-return $text;
-SC_END
-
-SC_BEGIN DOWNLOAD_VIEW_DATE
-global $gen,$dl;
-return ($dl['download_datestamp']) ? $gen->convert_date($dl['download_datestamp'], $parm) : "";
-SC_END
-
-SC_BEGIN DOWNLOAD_VIEW_DATE_SHORT
-// deprecated: DOWNLOAD_VIEW_DATE should be used instead.
-global $gen,$dl;
-return ($dl['download_datestamp']) ? $gen->convert_date($dl['download_datestamp'], "short") : "";
-SC_END
-
-SC_BEGIN DOWNLOAD_VIEW_DATE_LONG
-// deprecated: DOWNLOAD_VIEW_DATE should be used instead.
-global $gen,$dl;
-return ($dl['download_datestamp']) ? $gen->convert_date($dl['download_datestamp'], "long") : "";
-SC_END
-
-
-
-SC_BEGIN DOWNLOAD_VIEW_IMAGE
-global $dl;
-if ($dl['download_thumb']) {
- return ($dl['download_image'] ? "
" : "
");
-}
-else if($dl['download_image']) {
- return "".LAN_dl_40."";
-}
-else
-{
- return LAN_dl_75;
-}
-SC_END
-
-SC_BEGIN DOWNLOAD_VIEW_IMAGEFULL
-global $dl;
-return ($dl['download_image']) ? "
" : "";
-SC_END
-
-SC_BEGIN DOWNLOAD_VIEW_LINK
-global $pref,$dl,$tp;
-if ($pref['agree_flag'] == 1) {
- $dnld_link = "toJS($tp->toHTML($pref['agree_text'],FALSE,'DESCRIPTION'))."');\">";
-} else {
- $dnld_link = "";
-}
-
-if($dl['download_mirror'])
-{
- if($dl['download_mirror_type'])
- {
- return "".LAN_dl_66."";
- }
- else
- {
- return $dnld_link."
";
- }
-}
-else
-{
- return $dnld_link."
";
-}
-SC_END
-
-SC_BEGIN DOWNLOAD_VIEW_FILESIZE
-global $dl, $e107;
-return ($dl['download_filesize']) ? $e107->parseMemorySize($dl['download_filesize']) : "";
-SC_END
-
-SC_BEGIN DOWNLOAD_VIEW_RATING
- require_once(e_HANDLER."rate_class.php");
- $rater = new rater;
- global $dl;
- $text = "
-
-
- ";
-
- if ($ratearray = $rater->getrating("download", $dl['download_id'])) {
- for($c = 1; $c <= $ratearray[1]; $c++) {
- $text .= " ";
- }
- if ($ratearray[2]) {
- $text .= " ";
- }
- if ($ratearray[2] == "") {
- $ratearray[2] = 0;
- }
- $text .= " ".$ratearray[1].".".$ratearray[2]." - ".$ratearray[0]." ";
- $text .= ($ratearray[0] == 1 ? LAN_dl_43 : LAN_dl_44);
- } else {
- $text .= LAN_dl_13;
- }
- $text .= " | ";
-
- if (!$rater->checkrated("download", $dl['download_id']) && USER) {
- $text .= $rater->rateselect(" ".LAN_dl_14, "download", $dl['download_id'])."";
- }
- else if(!USER) {
- $text .= " ";
- } else {
- $text .= LAN_THANK_YOU;
- }
- $text .= " |
";
-return $text;
-SC_END
-
-SC_BEGIN DOWNLOAD_REPORT_LINK
-global $dl,$pref;
-return (check_class($pref['download_reportbroken'])) ? "".LAN_dl_45."" : "";
-SC_END
-
-SC_BEGIN DOWNLOAD_VIEW_CAPTION
-global $dl;
- $text = $dl['download_category_name'];
- $text .= ($dl['download_category_description']) ? " [ ".$dl['download_category_description']." ]" : "";
-return $text;
-SC_END
-
-
-// --------- Download View Lans -----------------------------
-
-SC_BEGIN DOWNLOAD_VIEW_AUTHOR_LAN
-global $dl;
-return ($dl['download_author']) ? LAN_AUTHOR : "";
-SC_END
-
-SC_BEGIN DOWNLOAD_VIEW_AUTHOREMAIL_LAN
-global $dl;
-return ($dl['download_author_email']) ? LAN_dl_30 : "";
-SC_END
-
-SC_BEGIN DOWNLOAD_VIEW_AUTHORWEBSITE_LAN
-global $dl;
-return ($dl['download_author_website']) ? LAN_dl_31 : "";
-SC_END
-
-SC_BEGIN DOWNLOAD_VIEW_DATE_LAN
-global $dl;
-return ($dl['download_datestamp']) ? LAN_DATE : "";
-SC_END
-
-SC_BEGIN DOWNLOAD_VIEW_IMAGE_LAN
-return LAN_IMAGE;
-SC_END
-
-SC_BEGIN DOWNLOAD_VIEW_REQUESTED
-global $dl;
-return $dl['download_requested'];
-SC_END
-
-SC_BEGIN DOWNLOAD_VIEW_RATING_LAN
-return LAN_RATING;
-SC_END
-
-SC_BEGIN DOWNLOAD_VIEW_FILESIZE_LAN
-return LAN_SIZE;
-SC_END
-
-SC_BEGIN DOWNLOAD_VIEW_DESCRIPTION_LAN
-return LAN_DESCRIPTION;
-SC_END
-
-SC_BEGIN DOWNLOAD_VIEW_REQUESTED_LAN
-return LAN_dl_77;
-SC_END
-
-SC_BEGIN DOWNLOAD_VIEW_LINK_LAN
-return LAN_DOWNLOAD;
-SC_END
-
-
-
-// ----------- Download View : Previous and Next ---------------
-
-SC_BEGIN DOWNLOAD_VIEW_PREV
-global $dl,$sql;
-
- $dl_id = intval($dl['download_id']);
-
- if ($sql->db_Select("download", "*", "download_category='".intval($dl['download_category_id'])."' AND download_id < {$dl_id} AND download_active > 0 && download_visible IN (".USERCLASS_LIST.") ORDER BY download_datestamp DESC LIMIT 1")) {
- $row = $sql->db_Fetch();
- return "<< ".LAN_dl_33." [".$row['download_name']."]\n";
- } else {
- return " ";
- }
-SC_END
-
-SC_BEGIN DOWNLOAD_VIEW_NEXT
-global $dl,$sql;
-$dl_id = intval($dl['download_id']);
- if ($sql->db_Select("download", "*", "download_category='".intval($dl['download_category_id'])."' AND download_id > {$dl_id} AND download_active > 0 && download_visible IN (".USERCLASS_LIST.") ORDER BY download_datestamp ASC LIMIT 1")) {
- $row = $sql->db_Fetch();
- extract($row);
- return "[".$row['download_name']."] ".LAN_dl_34." >>\n";
- } else {
- return " ";
- }
-SC_END
-
-
-SC_BEGIN DOWNLOAD_BACK_TO_LIST
-global $dl;
-return "".LAN_BACK."";
-SC_END
-
-SC_BEGIN DOWNLOAD_BACK_TO_CATEGORY_LIST
- return "".LAN_dl_9."";
-SC_END
-
-
-// --------------- Download - Admin -----------------------------------
-
-SC_BEGIN DOWNLOAD_CATEGORY_SELECT
- global $sql;
- $cdc = $parm;
-
- $boxinfo = "\n";
- $qry = "
- SELECT dc.download_category_name, dc.download_category_order, dc.download_category_id, dc.download_category_parent,
- dc1.download_category_parent AS d_parent1
- FROM #download_category AS dc
- LEFT JOIN #download_category as dc1 ON dc1.download_category_id=dc.download_category_parent AND dc1.download_category_class IN (".USERCLASS_LIST.")
- LEFT JOIN #download_category as dc2 ON dc2.download_category_id=dc1.download_category_parent ";
- if (ADMIN === FALSE) $qry .= " WHERE dc.download_category_class IN (".USERCLASS_LIST.") ";
- $qry .= " ORDER by dc2.download_category_order, dc1.download_category_order, dc.download_category_order"; // This puts main categories first, then sub-cats, then sub-sub cats
-
- if (!$sql->gen($qry))
- {
- return "Error reading categories
";
- exit;
- }
-
- $boxinfo .= "\n";
- return $boxinfo;
-
-SC_END
-
-
-
-
-
-
-*/
-?>
diff --git a/e107_handlers/bbcode_handler.php b/e107_handlers/bbcode_handler.php
index 77b1dddec..25c08c63d 100644
--- a/e107_handlers/bbcode_handler.php
+++ b/e107_handlers/bbcode_handler.php
@@ -316,6 +316,7 @@ class e_bbcode
if (is_array($this->bbList) && array_key_exists($code, $this->bbList))
{ // Check the bbcode 'cache'
$bbcode = $this->bbList[$code];
+ $debugFile = "(cached)";
}
else
{ // Find the file
@@ -355,14 +356,13 @@ class e_bbcode
if (E107_DEBUG_LEVEL)
{
- global $db_debug;
-
$info = array(
'class' =>$className,
- 'path' => $debugFile
+ 'path' => $debugFile,
+ // 'text' => $full_text
);
- $db_debug->logCode(1, $code, $parm, print_a($info,true));
+ e107::getDebug()->logCode(1, $code, $parm, print_a($info,true));
}
global $e107_debug;
diff --git a/e107_handlers/db_debug_class.php b/e107_handlers/db_debug_class.php
index 028f03e98..a61f92490 100644
--- a/e107_handlers/db_debug_class.php
+++ b/e107_handlers/db_debug_class.php
@@ -514,8 +514,8 @@ class e107_db_debug {
\n";
- $description = array(1=>'Bbcode',2=>'Shortcode',3=>'Wrapper', 4=>'Shortcode Override');
- $style = array(1 => 'label-info', 2=>'label-primary', 3=>'label-warning', 'label-danger');
+ $description = array(1=>'Bbcode',2=>'Shortcode',3=>'Wrapper', 4=>'Shortcode Override', -2 => 'Shortcode Failure');
+ $style = array(1 => 'label-info', 2=>'label-primary', 3=>'label-warning', 'label-danger', -2 => 'label-danger');
foreach($this -> scbbcodes as $codes)
{
diff --git a/e107_handlers/e_parse_class.php b/e107_handlers/e_parse_class.php
index b8423c820..bade07bde 100644
--- a/e107_handlers/e_parse_class.php
+++ b/e107_handlers/e_parse_class.php
@@ -829,10 +829,6 @@ class e_parse extends e_parser
*/
function parseTemplate($text, $parseSCFiles = true, $extraCodes = null, $eVars = null)
{
- if(!empty($extraCodes) && $this->isSimpleParse($extraCodes)) // support for a combined simple and standard template parse. - (eg. used by signup email template.)
- {
- $text = $this->simpleParse($text, $extraCodes, false);
- }
if(!is_bool($parseSCFiles))
{
diff --git a/e107_handlers/mysql_class.php b/e107_handlers/mysql_class.php
index 5338ec48c..606f5d1cb 100644
--- a/e107_handlers/mysql_class.php
+++ b/e107_handlers/mysql_class.php
@@ -361,7 +361,7 @@ class e_db_mysql
/**
* @return void
- * @param unknown $sMarker
+ * @param string $sMarker
* @desc Enter description here...
* @access private
*/
diff --git a/e107_handlers/shortcode_handler.php b/e107_handlers/shortcode_handler.php
index 588727396..e28d859b7 100644
--- a/e107_handlers/shortcode_handler.php
+++ b/e107_handlers/shortcode_handler.php
@@ -28,80 +28,85 @@ if (!defined('e107_INIT'))
* e_shortcode - abstract batch class
*/
-/**
- * FIXME: to be removed
- */
-function register_shortcode($classFunc, $codes, $path = '', $force = false)
-{
- return e107::getScParser()->registerShortcode($classFunc, $codes, $path, $force);
-}
+ /**
+ * @deprecated
+ * @param $classFunc
+ * @param $codes
+ * @param string $path
+ * @param bool $force
+ * @return e_parse_shortcode
+ */
+ function register_shortcode($classFunc, $codes, $path = '', $force = false)
+ {
+ return e107::getScParser()->registerShortcode($classFunc, $codes, $path, $force);
+ }
-/**
- * FIXME: to be removed
- */
-function setScVar($className, $scVarName, $value)
-{
- return e107::getScParser()->setScVar($className, $scVarName, $value);
-}
+ /**
+ * @deprecated
+ * @param $className
+ * @param $scVarName
+ * @param $value
+ * @return e_parse_shortcode
+ */
+ function setScVar($className, $scVarName, $value)
+ {
+ return e107::getScParser()->setScVar($className, $scVarName, $value);
+ }
+
+ /**
+ * @deprecated FIXME: to be removed (once event calendar changed)
+ * @param $className
+ * @param $scFuncName
+ * @param string $param
+ * @return bool|mixed
+ */
+ function callScFunc($className, $scFuncName, $param = '')
+ {
+ return e107::getScParser()->callScFunc($className, $scFuncName, $param);
+ }
+
+ /**
+ * @deprecated FIXME: to be removed
+ * @param $class
+ * @param bool $force
+ * @param null $eVars
+ * @return e_shortcode
+ */
+ function initShortcodeClass($class, $force = false, $eVars = null)
+ {
+ return e107::getScParser()->initShortcodeClass($class, $eVars, $force);
+ }
-/**
- * FIXME: to be removed (once event calendar changed)
- */
-function callScFunc($className, $scFuncName, $param = '')
-{
- return e107::getScParser()->callScFunc($className, $scFuncName, $param);
-}
-/**
- * FIXME: to be removed
- */
-function initShortcodeClass($class, $force = false, $eVars = null)
-{
- return e107::getScParser()->initShortcodeClass($class, $eVars, $force);
-}
class e_parse_shortcode
{
- protected $scList = array(); // The actual code - added by parsing files or when plugin codes encountered. Array key is the shortcode name.
- protected $parseSCFiles; // True if individual shortcode files are to be used
- protected $addedCodes = NULL; // Pointer to a class or array to be used on a single call
- protected $registered_codes = array(); // Shortcodes added by plugins TODO make it private
- protected $scClasses = array(); // Batch shortcode classes - TODO make it private
- protected $scOverride = array(); // Array of codes found in override/shortcodes dir
- protected $scBatchOverride = array(); // Array of codes found in override/shortcodes/batch dir
- protected $ignoreCodes = array(); // Shortcodes to be ignored and remain unchanged. (ie. {THEME}, {e_PLUGIN} etc. )
- protected $addonOverride = array(); // Overrides coming from e_shortcode.php
- /**
- * @var e_vars
- */
- protected $eVars = null;
-
- /**
- * Wrappers array for the current parsing cycle, see contact_template.php and $CONTACT_WRAPPER variable
- * @var array
- */
- protected $wrappers = array();
- protected $wrapper = null; // current wrapper being processed.
- protected $wrapperDebugDone = array();
-
- /**
- * Former $sc_style global variable. Internally used - performance reasons
- * @var array
- */
- protected $sc_style = array();
+ protected $scList = array(); // The actual code - added by parsing files or when plugin codes encountered. Array key is the shortcode name.
+ protected $parseSCFiles = true; // True if individual shortcode files are to be used
+ protected $addedCodes = null; // Pointer to a class or array to be used on a single call
+ protected $registered_codes = array(); // Shortcodes added by plugins TODO make it private
+ protected $scClasses = array(); // Batch shortcode classes - TODO make it private
+ protected $scOverride = array(); // Array of codes found in override/shortcodes dir
+ protected $scBatchOverride = array(); // Array of codes found in override/shortcodes/batch dir
+ protected $ignoreCodes = array(); // Shortcodes to be ignored and remain unchanged. (ie. {THEME}, {e_PLUGIN} etc. )
+ protected $addonOverride = array(); // Overrides coming from e_shortcode.php
+ private $legacyBatch = array(); // List of legacy batch file codes. eg. using SC_BEGIN etc.
+ private $debug_legacy = array();
+ protected $eVars = null;
+ protected $wrappers = array(); // Wrappers array for the current parsing cycle, see contact_template.php and $CONTACT_WRAPPER variable
+ protected $wrapper = null; // current wrapper being processed.
+ protected $wrapperDebugDone = array(); // Flag to avoid repetition of debug info.
+ protected $sc_style = array(); // Former $sc_style global variable. Internally used - performance reasons
function __construct()
{
- $this->parseSCFiles = true; // Default probably never used, but make sure its defined.
- $this->ignoreCodes = e107::getParser()->getUrlConstants(); // ignore all URL shortcodes. ie. {e_PLUGIN}
+ $this->ignoreCodes = e107::getParser()->getUrlConstants(); // ignore all URL shortcodes. ie. {e_PLUGIN}
$this->loadOverrideShortcodes();
$this->loadThemeShortcodes();
$this->loadPluginShortcodes();
$this->loadPluginSCFiles();
//$this->loadCoreShortcodes(); DEPRECATED
-
-
}
/**
@@ -172,6 +177,8 @@ class e_parse_shortcode
return $this;
}
+
+
/**
* Add value to already registered SC object
*
@@ -222,9 +229,10 @@ class e_parse_shortcode
*
* @param string $className
* @param string $scFuncName
- * @param array $param - arguments passed to function
+ * @param array $args
+ * @return bool|mixed - NULL if class/method doesn't exist; otherwise whatever the function returns.
+ * @internal param array $param - arguments passed to function
*
- * @return mixed|boolean - NULL if class/method doesn't exist; otherwise whatever the function returns.
*/
protected function callScFuncA($className, $scFuncName, $args = array())
{
@@ -236,6 +244,8 @@ class e_parse_shortcode
return null;
}
+
+
/**
* Create shortcode object - don't forget you still can use e_shortcode.php
*
@@ -279,22 +289,22 @@ class e_parse_shortcode
* Normally you would use the proxy of this method - e107::getScBatch()
* Global File Override ClassName/Path examples:
* 1. Core signup shortcodes
- * - Origin ClassName: signup_shortcodes
- * - Origin Location: core/shortcodes/batch/signup_shortcodes.php
- * - File Override ClassName: override_signup_shortcodes
- * - File Override Location: core/override/shortcodes/batch/signup_shortcodes.php
- *
- * 2. Plugin 'gallery' global shortcode batch (e_shortcode.php)
- * - Origin ClassName: gallery_shortcodes //FIXME Should be gallery_shortcode? (more below)
- * - Origin Location: plugins/gallery/e_shortcode.php
- * - File Override ClassName: override_gallery_shortcodes
- * - File Override Location: core/override/shortcodes/batch/gallery_shortcodes.php
- *
+ * - Origin ClassName: signup_shortcodes
+ * - Origin Location: core/shortcodes/batch/signup_shortcodes.php
+ * - File Override ClassName: override_signup_shortcodes
+ * - File Override Location: core/override/shortcodes/batch/signup_shortcodes.php
+ *
+ * 2. Plugin 'gallery' global shortcode batch (e_shortcode.php)
+ * - Origin ClassName: gallery_shortcodes //FIXME Should be gallery_shortcode? (more below)
+ * - Origin Location: plugins/gallery/e_shortcode.php
+ * - File Override ClassName: override_gallery_shortcodes
+ * - File Override Location: core/override/shortcodes/batch/gallery_shortcodes.php
+ *
* 3. Plugin 'forum' regular shortcode batch
- * - Origin ClassName: plugin_forum_view_shortcodes //FIXME Should be forum_shortcodes? (more below)
- * - Origin Location: plugins/forum/shortcodes/batch/view_shortcodes.php
- * - File Override ClassName: override_plugin_forum_view_shortcodes
- * - File Override Location: core/override/shortcodes/batch/forum_view_shortcodes.php
+ * - Origin ClassName: plugin_forum_view_shortcodes //FIXME Should be forum_shortcodes? (more below)
+ * - Origin Location: plugins/forum/shortcodes/batch/view_shortcodes.php
+ * - File Override ClassName: override_plugin_forum_view_shortcodes
+ * - File Override Location: core/override/shortcodes/batch/forum_view_shortcodes.php
*
* getScObject('news_shortcodes', 'myplug', 'news2_shortcodes');
*
* @param string $className
- * @param string $plugName if true className is used., if string, string value is used.
+ * @param null $pluginName
* @param string $overrideClass if true, $className is used
* @return e_shortcode
+ * @internal param string $plugName if true className is used., if string, string value is used.
*/
public function getScObject($className, $pluginName = null, $overrideClass = null)
{
@@ -320,8 +331,10 @@ class e_parse_shortcode
e_shortcode.php = {plugin}_shortcode
{plugin}_shortcodes.php = {plugin}_shortcodes
*/
+
+ $path = null;
- if(trim($className)==""){ return; }
+ if(trim($className)==""){ return null; }
$_class_fname = $className;
if($pluginName === TRUE) //XXX When called manually by a plugin, not e_shortcode.php eg. $sc = e107::getScBatch('faqs',TRUE); for faqs_shortcode.php with class faqs_shortcode
@@ -625,6 +638,9 @@ class e_parse_shortcode
/**
* Common Auto-Register function for class methods.
+ * @param $class
+ * @param $path
+ * @param bool $force
* @return e_parse_shortcode
*/
protected function registerClassMethods($class, $path, $force = false)
@@ -735,8 +751,7 @@ class e_parse_shortcode
* ONLY globally register shortcodes when they are declared in e_shortcode.php - this is consistent with the logic of e_xxxx which affect e107 Outside of the plugin/sript. (gallery plugin follows this logic)
*
*/
-
-
+
if(isset($sc_style) && is_array($sc_style))
{
$this->sc_style = array_merge($sc_style, $this->sc_style); // XXX Commenting this out will fix #2 above.
@@ -814,8 +829,8 @@ class e_parse_shortcode
$this->addedCodes = $saveCodes;
$this->eVars = $saveVars; // restore eVars
$this->debug_legacy = null;
-
-
+ $this->legacyBatch = array();
+
// $this->sc_style = array(); //XXX Adding this will also fix #2 above.
@@ -824,12 +839,14 @@ class e_parse_shortcode
/**
- * Callback looks up and substitutes a shortcode
+ * Callback looks up and substitutes a shortcode
+ * @param $matches
+ * @return bool|int|mixed|string
*/
function doCode($matches)
{
// print_a($matches);
-
+
if(in_array($matches[0],$this->ignoreCodes)) // Ignore all {e_PLUGIN}, {THEME} etc. otherwise it will just return blank for these items.
{
return $matches[0];
@@ -896,7 +913,7 @@ class e_parse_shortcode
if (E107_DBG_BBSC || E107_DBG_SC || E107_DBG_TIMEDETAILS)
{
- $sql->db_Mark_Time("SC $code");
+ $sql->db_Mark_Time("SC ".$code);
}
if (E107_DBG_SC)
@@ -942,10 +959,22 @@ class e_parse_shortcode
}
}
- elseif (is_array($this->addedCodes) && array_key_exists($code, $this->addedCodes)) // Its array-based shortcode. Load the code for evaluation later.
+ elseif(is_array($this->addedCodes) && array_key_exists($code, $this->addedCodes)) // Its array-based shortcode. Load the code for evaluation later.
{
-
- $ret = $this->addedCodes[$code];
+
+ // $ret = $this->addedCodes[$code];
+
+ //$this->legacyBatch
+ if(in_array($code,$this->legacyBatch))
+ {
+ $scCode = $this->addedCodes[$code];
+ }
+ else
+ {
+ $ret = $this->addedCodes[$code];
+ }
+
+
// $_class = "n/a";
// $_function = "n/a";
$_type = 'array';
@@ -1079,11 +1108,14 @@ class e_parse_shortcode
if(!empty($scFile))
{
+ $_type = 'file';
+
if(file_exists($scFile))
{
$scCode = file_get_contents($scFile);
$this->scList[$code] = $scCode;
$_path = $scFile;
+
}
else
{
@@ -1111,28 +1143,31 @@ class e_parse_shortcode
if ($scCode) // legacy shortode to be evaluated.
{
+
try
{
$ret = @eval($scCode);
}
catch (Throwable $t) { // Executed only in PHP 7, will not match in PHP 5.x
- $string = print_a($scCode,true);
- $string .= "Added Coded
";
- $string .= print_a($this->addedCodes,true);
- e107::getMessage()->addDebug('Could not parse Shortcode '.$scFile.' :: {'.$code .'} '.$string);
+ $error = $this->debug_legacy;
+ $error['code'] = $code;
+ $error['problem'] = $scCode;
+
+ e107::getDebug()->logCode(-2, $code, null, print_a($error,true));
}
- catch (Exception $e)
- {
- echo $e->getMessage();
- }
-
- if($ret === false && E107_DEBUG_LEVEL > 0) // Error in Code.
+ if($ret === false && E107_DEBUG_LEVEL > 0 ) // Error in Code.
{
- // $string = print_a($scCode,true);
- // e107::getMessage()->addDebug('Could not parse Shortcode '.$scFile.' :: {'.$code .'} '.$string);
+
+ $error = $this->debug_legacy;
+ $error['code'] = $code;
+ $error['problem'] = $scCode;
+ $error['error'] = error_get_last();
+
+ e107::getDebug()->logCode(-2, $code, null, print_a($error,true));
+
}
}
@@ -1262,15 +1297,23 @@ class e_parse_shortcode
return isset($ret) ? $ret : '';
}
+
+
+
+ /**
+ * @param $fname
+ * @param string $type
+ * @return array
+ */
function parse_scbatch($fname, $type = 'file')
{
- global $e107cache, $eArrayStorage;
+ // global $e107cache, $eArrayStorage;
$cur_shortcodes = array();
if ($type == 'file')
{
$batch_cachefile = 'nomd5_scbatch_'.md5($fname);
// $cache_filename = $e107cache->cache_fname("nomd5_{$batchfile_md5}");
- $sc_cache = $e107cache->retrieve_sys($batch_cachefile);
+ $sc_cache = e107::getCache()->retrieve_sys($batch_cachefile);
if (!$sc_cache)
{
$sc_batch = file($fname);
@@ -1309,8 +1352,8 @@ class e_parse_shortcode
}
if ($type == 'file')
{
- $sc_cache = $eArrayStorage->WriteArray($cur_shortcodes, false);
- $e107cache->set_sys($batch_cachefile, $sc_cache);
+ $sc_cache = e107::serialize($cur_shortcodes, false);
+ e107::getCache()->set_sys($batch_cachefile, $sc_cache);
}
}
@@ -1332,6 +1375,10 @@ class e_parse_shortcode
}
}
}
+
+
+ $this->legacyBatch = array_keys($cur_shortcodes);
+
return $cur_shortcodes;
}
}
@@ -1377,6 +1424,8 @@ class e_shortcode
* which results in using the $CONTACT_WRAPPER['form'] wrapper in the parsing phase
* Template cannot be loaded via include, only by getTemplate or getCoreTemplate
* e107::getScBatch() must be used also.
+ * @param string $id
+ * @return $this|null
*/
public function wrapper($id = null)
{
@@ -1407,10 +1456,12 @@ class e_shortcode
$this->var = $eVars;
return $this;
}
-
+
/**
* Alias of setParserVars - Preferred use by Plugins.
* Sets the value of $sc->var
+ * @param $eVars
+ * @return e_shortcode
*/
public function setVars($eVars) // Alias of setParserVars();
{
diff --git a/e107_themes/bootstrap3/theme_shortcodes.php b/e107_themes/bootstrap3/theme_shortcodes.php
index bcf5121cf..a79efbfce 100644
--- a/e107_themes/bootstrap3/theme_shortcodes.php
+++ b/e107_themes/bootstrap3/theme_shortcodes.php
@@ -13,21 +13,21 @@
class theme_shortcodes extends e_shortcode
{
- public $override = true;
+ // public $override = true;
function __construct()
{
}
-
+/*
function sc_news_summary()
{
$sc = e107::getScBatch('news');
$data = $sc->getScVar('news_item');
return "".e107::getParser()->toHTML($data['news_summary'],'BODY')."";
- }
+ }*/
function sc_bootstrap_branding()