mirror of
https://github.com/e107inc/e107.git
synced 2025-07-31 20:00:37 +02:00
New functionality to allow parsing of vars and shortcodes with single pass or parseTemplate
This commit is contained in:
@@ -9,8 +9,8 @@
|
||||
* Text processing and parsing functions
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_handlers/e_parse_class.php,v $
|
||||
* $Revision: 1.92 $
|
||||
* $Date: 2010-01-23 03:25:31 $
|
||||
* $Revision: 1.93 $
|
||||
* $Date: 2010-01-23 16:41:50 $
|
||||
* $Author: mcfly_e107 $
|
||||
*
|
||||
*/
|
||||
@@ -1892,10 +1892,20 @@ class e_parse
|
||||
}
|
||||
}
|
||||
|
||||
class templateVars
|
||||
class e_vars
|
||||
{
|
||||
private $vars;
|
||||
|
||||
public function __construct($array='')
|
||||
{
|
||||
$this->setVars($array);
|
||||
}
|
||||
|
||||
public function __set($key, $value)
|
||||
{
|
||||
$this->vars[$key] = $value;
|
||||
}
|
||||
|
||||
public function __get($key)
|
||||
{
|
||||
if(isset($this->vars[$key]))
|
||||
@@ -1907,13 +1917,27 @@ class templateVars
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function emptyVars()
|
||||
{
|
||||
$this->vars = array();
|
||||
}
|
||||
|
||||
public function __set($key, $value)
|
||||
public function setVars($array='', $empty = true)
|
||||
{
|
||||
$this->vars[$key] = $value;
|
||||
if($empty) { $this->vars = array(); }
|
||||
if(is_array($array))
|
||||
{
|
||||
foreach($array as $key => $val)
|
||||
{
|
||||
$this->vars[$key] = $val;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function addVars($array='')
|
||||
{
|
||||
$this->setVars($array);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -9,9 +9,9 @@
|
||||
* e107 Shortcode handler
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_handlers/shortcode_handler.php,v $
|
||||
* $Revision: 1.40 $
|
||||
* $Date: 2009-12-17 22:47:20 $
|
||||
* $Author: e107steved $
|
||||
* $Revision: 1.41 $
|
||||
* $Date: 2010-01-23 16:41:56 $
|
||||
* $Author: mcfly_e107 $
|
||||
*/
|
||||
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
@@ -149,6 +149,7 @@ class e_shortcode
|
||||
var $registered_codes = array(); // Shortcodes added by plugins
|
||||
var $scClasses = array(); // Batch shortcode classes
|
||||
var $scOverride = array(); // Array of codes found in override/ dir
|
||||
private $eVars = '';
|
||||
|
||||
function e_shortcode($noload=false)
|
||||
{
|
||||
@@ -321,11 +322,15 @@ class e_shortcode
|
||||
return in_array($code, $this->scOverride);
|
||||
}
|
||||
|
||||
function parseCodes($text, $useSCFiles = true, $extraCodes = '')
|
||||
function parseCodes($text, $useSCFiles = true, $extraCodes = '', &$eVars='')
|
||||
{
|
||||
$saveParseSCFiles = $this->parseSCFiles; // In case of nested call
|
||||
$this->parseSCFiles = $useSCFiles;
|
||||
|
||||
if(is_object($eVars)) {
|
||||
$this->eVars = $eVars;
|
||||
}
|
||||
|
||||
//object support
|
||||
if(is_object($extraCodes))
|
||||
{
|
||||
@@ -356,6 +361,11 @@ class e_shortcode
|
||||
{
|
||||
global $pref, $e107cache, $menu_pref, $sc_style, $parm, $sql;
|
||||
|
||||
if(is_object($this->eVars)) {
|
||||
if($this->eVars->$matches[1]) {
|
||||
return $this->eVars->$matches[1];
|
||||
}
|
||||
}
|
||||
if(strpos($matches[1], E_NL) !== false) { return $matches[0]; }
|
||||
|
||||
if (strpos($matches[1], '='))
|
||||
|
Reference in New Issue
Block a user