1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-16 19:44:09 +02:00

Fixes #1186 - Added edit button for custom pages. Improved debugging of shortcodes and shortcode wrappers.

This commit is contained in:
Cameron
2016-04-02 10:51:18 -07:00
parent ec3e92b0d6
commit 46b2518e82
5 changed files with 78 additions and 10 deletions

View File

@@ -80,6 +80,8 @@ class e_parse_shortcode
* @var array
*/
protected $wrappers = array();
protected $wrapper = null; // current wrapper being processed.
protected $wrapperDebugDone = false;
/**
* Former $sc_style global variable. Internally used - performance reasons
@@ -754,7 +756,7 @@ class e_parse_shortcode
$this->addedCodes = &$extraCodes;
// TEMPLATEID_WRAPPER support - see contact template
// must be registered in e_shortcode object (batch) via wrapper() method before parsing
// must be registered in e_shortcode object (batch) via () method before parsing
// Do it only once per parsing cylcle and not on every doCode() loop - performance
if(method_exists($this->addedCodes, 'wrapper'))
{
@@ -764,6 +766,8 @@ class e_parse_shortcode
if(!empty($tmpWrap)) // FIX for #3 above.
{
$this->wrappers = array_merge($this->wrappers,$tmpWrap);
$this->wrapper = $this->addedCodes->getWrapperID();
}
}
@@ -1092,7 +1096,22 @@ class e_parse_shortcode
}
}
if(E107_DBG_BBSC && $this->wrapperDebugDone==false && !empty($this->wrappers))
{
list($wrapTmpl, $wrapID1, $wrapID2) = explode('/',$this->wrapper,3);
$wrapActive = strtoupper($wrapTmpl)."_WRAPPER['".$wrapID1."']";
if(!empty($wrapID2))
{
$wrapActive .= "['".$wrapID2."']";
}
// e107::getMessage()->addDebug("Active Wrapper: \$".$wrapActive);
$this->wrapperDebugDone = true;
global $db_debug;
$db_debug->logCode(3, $this->wrapper,null, '<pre>To use, add to the '.$wrapTmpl.' template:<br />$'.$wrapActive.'[\'SHORTCODE_NAME\'] = "(html before){---}(html after)";</pre>');
}
if (isset($ret) && ($ret != '' || is_numeric($ret)))
{
@@ -1320,6 +1339,13 @@ class e_shortcode
return $this;
}
public function getWrapperID()
{
return $this->wrapper;
}
/**
* Set external array data to be used in the batch
* Use setVars() - preferred.