mirror of
https://github.com/e107inc/e107.git
synced 2025-08-01 20:30:39 +02:00
Shortcode fixes and introduction of new format. {SC: get-string} eg. {MYSHORTCODE:w=100&h=50}
This is returned to the shortcode as an array('w'=>100, 'h'=>50); Use {SETIMAGE:w=100} to set the default thumbnail width.
This commit is contained in:
@@ -1,10 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
// Aloow theme templates to set the default Image Resizing of thumb.php
|
// Aloow theme templates to set the default Image Resizing of thumb.php
|
||||||
|
|
||||||
function setimage_shortcode($parm, $mode)
|
function setimage_shortcode($parm, $mode='')
|
||||||
{
|
{
|
||||||
parse_str($mode,$options);
|
e107::getParser()->thumbWidth = vartrue($parm['w'],100);
|
||||||
e107::getParser()->thumbWidth = vartrue($options['w'],100);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@@ -96,6 +96,15 @@ class _system_cron
|
|||||||
// Very basic and needs improvement. (for large DBs)
|
// Very basic and needs improvement. (for large DBs)
|
||||||
function dbBackup()
|
function dbBackup()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
$sql = e107::getDb();
|
||||||
|
$sql->backup('*');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
|
|
||||||
require(e_BASE."e107_config.php");
|
require(e_BASE."e107_config.php");
|
||||||
|
|
||||||
$sql = e107::getDb();
|
$sql = e107::getDb();
|
||||||
|
@@ -715,7 +715,10 @@ class e_parse_shortcode
|
|||||||
*/
|
*/
|
||||||
function doCode($matches)
|
function doCode($matches)
|
||||||
{
|
{
|
||||||
|
|
||||||
global $pref, $e107cache, $menu_pref, $sc_style, $parm, $sql;
|
global $pref, $e107cache, $menu_pref, $sc_style, $parm, $sql;
|
||||||
|
|
||||||
|
$parmArray = false;
|
||||||
|
|
||||||
if ($this->eVars)
|
if ($this->eVars)
|
||||||
{
|
{
|
||||||
@@ -729,7 +732,14 @@ class e_parse_shortcode
|
|||||||
return $matches[0];
|
return $matches[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strpos($matches[1], '='))
|
if(preg_match('/^([A-Z]*):(.*)/', $matches[1], $newMatch))
|
||||||
|
{
|
||||||
|
$code = $newMatch[1];
|
||||||
|
$parmStr = trim($newMatch[2]);
|
||||||
|
parse_str($parmStr,$parm);
|
||||||
|
$parmArray = true;
|
||||||
|
}
|
||||||
|
elseif (strpos($matches[1], '='))
|
||||||
{
|
{
|
||||||
list($code, $parm) = explode('=', $matches[1], 2);
|
list($code, $parm) = explode('=', $matches[1], 2);
|
||||||
}
|
}
|
||||||
@@ -749,9 +759,14 @@ class e_parse_shortcode
|
|||||||
{
|
{
|
||||||
$sc_mode = '';
|
$sc_mode = '';
|
||||||
}
|
}
|
||||||
$parm = trim($parm);
|
|
||||||
$parm = str_replace(array('[[', ']]'), array('{', '}'), $parm);
|
if($parmArray == false)
|
||||||
|
{
|
||||||
|
$parm = trim($parm);
|
||||||
|
$parm = str_replace(array('[[', ']]'), array('{', '}'), $parm);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (E107_DBG_BBSC || E107_DBG_SC || E107_DBG_TIMEDETAILS)
|
if (E107_DBG_BBSC || E107_DBG_SC || E107_DBG_TIMEDETAILS)
|
||||||
{
|
{
|
||||||
global $db_debug;
|
global $db_debug;
|
||||||
@@ -887,13 +902,12 @@ class e_parse_shortcode
|
|||||||
include_once(e_CORE.'shortcodes/single/'.strtolower($code).'.php');
|
include_once(e_CORE.'shortcodes/single/'.strtolower($code).'.php');
|
||||||
|
|
||||||
if (class_exists($_class, false)) // prevent __autoload - performance
|
if (class_exists($_class, false)) // prevent __autoload - performance
|
||||||
|
|
||||||
{
|
{
|
||||||
$ret = call_user_func(array($_class, $_function), $parm);
|
$ret = call_user_func(array($_class, $_function), array($parm, $sc_mode));
|
||||||
}
|
}
|
||||||
elseif (function_exists($_function))
|
elseif (function_exists($_function))
|
||||||
{
|
{
|
||||||
$ret = call_user_func($_function, $parm);
|
$ret = call_user_func($_function, $parm, $sc_mode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user