diff --git a/e107_core/shortcodes/single/setimage.php b/e107_core/shortcodes/single/setimage.php new file mode 100644 index 000000000..50e778875 --- /dev/null +++ b/e107_core/shortcodes/single/setimage.php @@ -0,0 +1,10 @@ +thumbWidth = vartrue($options['w'],100); + } + +?> diff --git a/e107_handlers/e_parse_class.php b/e107_handlers/e_parse_class.php index 20999b85b..79b4c6e04 100644 --- a/e107_handlers/e_parse_class.php +++ b/e107_handlers/e_parse_class.php @@ -65,6 +65,8 @@ class e_parse extends e_parser // Highlight query var $e_query; + + public $thumbWidth = 100; // Set up the defaults var $e_optDefault = array( @@ -1833,7 +1835,7 @@ class e_parse extends e_parser } else { - if(!vartrue($options['w']) && !vartrue($options['h'])) $options['w'] = 100; + if(!vartrue($options['w']) && !vartrue($options['h'])) $options['w'] = $this->thumbWidth; $thurl .= 'w='.((integer) vartrue($options['w'], 0)).'&h='.((integer) vartrue($options['h'], 0)); } @@ -2445,6 +2447,13 @@ class e_parser + // Parse i_xxxx to bootstrap glyph format. + public function glyph($text) + { + $text = preg_replace('/\[(i_[\w]*)\]/',"", $text); + return $text; + } + /** * Perform and render XSS Test Comparison diff --git a/e107_handlers/form_handler.php b/e107_handlers/form_handler.php index d3574ec72..a431684bb 100644 --- a/e107_handlers/form_handler.php +++ b/e107_handlers/form_handler.php @@ -2331,6 +2331,7 @@ class e_form if($link) $value = "".$value.""; } + if(!vartrue($attributes['noedit']) && vartrue($parms['editable']) && !vartrue($parms['link'])) // avoid bad markup, better solution coming up { $mode = preg_replace('/[^\w]/', '', vartrue($_GET['mode'], '')); diff --git a/e107_handlers/shortcode_handler.php b/e107_handlers/shortcode_handler.php index 964d563ea..16fb8f490 100644 --- a/e107_handlers/shortcode_handler.php +++ b/e107_handlers/shortcode_handler.php @@ -715,7 +715,10 @@ class e_parse_shortcode */ function doCode($matches) { - global $pref, $e107cache, $menu_pref, $sc_style, $parm, $sql; + global $pref, $e107cache, $menu_pref, $sc_style; + // global $parm, $sql; XXX Why Global $parm? + + $sql = e107::getDb(); if ($this->eVars) { @@ -728,27 +731,38 @@ class e_parse_shortcode { return $matches[0]; } - - if (strpos($matches[1], '=')) + + // 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], '|')) { - 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); + list($rawcode, $sc_mode) = explode("|", $matches[1], 2); + $rawcode = trim($rawcode); $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); @@ -893,7 +907,15 @@ class e_parse_shortcode } elseif (function_exists($_function)) { - $ret = call_user_func($_function, $parm); + if($sc_mode) + { + $ret = call_user_func($_function, $parm, $sc_mode); // v2.x + } + else + { + $ret = call_user_func($_function, $parm); + } + } } else