mirror of
https://github.com/e107inc/e107.git
synced 2025-05-06 04:06:08 +02:00
Shortcode handler fix..
This commit is contained in:
parent
14044fc25a
commit
58ef32c990
@ -715,10 +715,7 @@ class e_parse_shortcode
|
|||||||
*/
|
*/
|
||||||
function doCode($matches)
|
function doCode($matches)
|
||||||
{
|
{
|
||||||
global $pref, $e107cache, $menu_pref, $sc_style;
|
global $pref, $e107cache, $menu_pref, $sc_style, $parm, $sql;
|
||||||
// global $parm, $sql; XXX Why Global $parm?
|
|
||||||
|
|
||||||
$sql = e107::getDb();
|
|
||||||
|
|
||||||
if ($this->eVars)
|
if ($this->eVars)
|
||||||
{
|
{
|
||||||
@ -732,37 +729,26 @@ class e_parse_shortcode
|
|||||||
return $matches[0];
|
return $matches[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
// look for the $sc_mode FIRST to avoid issues with '=' eg. {SETIMAGE=something|w=200}
|
if (strpos($matches[1], '='))
|
||||||
// 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], '|'))
|
|
||||||
{
|
{
|
||||||
list($rawcode, $sc_mode) = explode("|", $matches[1], 2);
|
list($code, $parm) = explode('=', $matches[1], 2);
|
||||||
$rawcode = trim($rawcode);
|
}
|
||||||
|
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);
|
$sc_mode = trim($sc_mode);
|
||||||
//
|
|
||||||
// print_a("{".$matches[1]."} RAWCODE: ".$rawcode." MODE: ".$sc_mode." ");
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$sc_mode = '';
|
$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 = trim($parm);
|
||||||
$parm = str_replace(array('[[', ']]'), array('{', '}'), $parm);
|
$parm = str_replace(array('[[', ']]'), array('{', '}'), $parm);
|
||||||
|
|
||||||
@ -906,17 +892,9 @@ class e_parse_shortcode
|
|||||||
$ret = call_user_func(array($_class, $_function), $parm);
|
$ret = call_user_func(array($_class, $_function), $parm);
|
||||||
}
|
}
|
||||||
elseif (function_exists($_function))
|
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
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user