mirror of
https://github.com/e107inc/e107.git
synced 2025-01-17 20:58:30 +01:00
Shortcode handler fix..
This commit is contained in:
parent
14044fc25a
commit
58ef32c990
@ -715,10 +715,7 @@ class e_parse_shortcode
|
||||
*/
|
||||
function doCode($matches)
|
||||
{
|
||||
global $pref, $e107cache, $menu_pref, $sc_style;
|
||||
// global $parm, $sql; XXX Why Global $parm?
|
||||
|
||||
$sql = e107::getDb();
|
||||
global $pref, $e107cache, $menu_pref, $sc_style, $parm, $sql;
|
||||
|
||||
if ($this->eVars)
|
||||
{
|
||||
@ -732,37 +729,26 @@ class e_parse_shortcode
|
||||
return $matches[0];
|
||||
}
|
||||
|
||||
// look for the $sc_mode FIRST to avoid issues with '=' eg. {SETIMAGE=something|w=200}
|
||||
// Shortcode Layout {CODE=PARM|MODE} XXX @Miro - do you also require support for the other way around? ie. {CODE|MODE=PARM} ?
|
||||
|
||||
if (strpos($matches[1], '|'))
|
||||
if (strpos($matches[1], '='))
|
||||
{
|
||||
list($rawcode, $sc_mode) = explode("|", $matches[1], 2);
|
||||
$rawcode = trim($rawcode);
|
||||
list($code, $parm) = explode('=', $matches[1], 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
$code = $matches[1];
|
||||
$parm = '';
|
||||
}
|
||||
//look for the $sc_mode
|
||||
if (strpos($code, '|'))
|
||||
{
|
||||
list($code, $sc_mode) = explode("|", $code, 2);
|
||||
$code = trim($code);
|
||||
$sc_mode = trim($sc_mode);
|
||||
//
|
||||
// print_a("{".$matches[1]."} RAWCODE: ".$rawcode." MODE: ".$sc_mode." ");
|
||||
}
|
||||
else
|
||||
{
|
||||
$sc_mode = '';
|
||||
$rawcode = $matches[1];
|
||||
}
|
||||
|
||||
if (strpos($rawcode, '='))
|
||||
{
|
||||
list($code, $parm) = explode('=', $rawcode, 2);
|
||||
// print_a("{".$matches[1]."} CODE: ".code." PARM: ".$parm." MODE: ".$sc_mode." ");
|
||||
}
|
||||
else
|
||||
{
|
||||
$code = $rawcode;
|
||||
$parm = '';
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
|
||||
$parm = trim($parm);
|
||||
$parm = str_replace(array('[[', ']]'), array('{', '}'), $parm);
|
||||
|
||||
@ -907,15 +893,7 @@ class e_parse_shortcode
|
||||
}
|
||||
elseif (function_exists($_function))
|
||||
{
|
||||
if($sc_mode)
|
||||
{
|
||||
$ret = call_user_func($_function, $parm, $sc_mode); // v2.x
|
||||
}
|
||||
else
|
||||
{
|
||||
$ret = call_user_func($_function, $parm);
|
||||
}
|
||||
|
||||
$ret = call_user_func($_function, $parm);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user