mirror of
https://github.com/e107inc/e107.git
synced 2025-08-05 06:07:32 +02:00
e_parse - simple Parse default replace string option added; e_vars - empty check added
This commit is contained in:
@@ -9,8 +9,8 @@
|
|||||||
* Text processing and parsing functions
|
* Text processing and parsing functions
|
||||||
*
|
*
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_handlers/e_parse_class.php,v $
|
* $Source: /cvs_backup/e107_0.8/e107_handlers/e_parse_class.php,v $
|
||||||
* $Revision: 1.94 $
|
* $Revision: 1.95 $
|
||||||
* $Date: 2010-01-24 12:05:53 $
|
* $Date: 2010-02-03 11:06:31 $
|
||||||
* $Author: secretr $
|
* $Author: secretr $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
/**
|
/**
|
||||||
* @package e107
|
* @package e107
|
||||||
* @subpackage e107_handlers
|
* @subpackage e107_handlers
|
||||||
* @version $Id: e_parse_class.php,v 1.94 2010-01-24 12:05:53 secretr Exp $
|
* @version $Id: e_parse_class.php,v 1.95 2010-02-03 11:06:31 secretr Exp $
|
||||||
*
|
*
|
||||||
* Text processing and parsing functions.
|
* Text processing and parsing functions.
|
||||||
* Simple parse data model.
|
* Simple parse data model.
|
||||||
@@ -582,9 +582,9 @@ class e_parse
|
|||||||
return preg_replace_callback("#\{([a-zA-Z0-9_]+)\}#", array($this, 'simpleReplace'), $template);
|
return preg_replace_callback("#\{([a-zA-Z0-9_]+)\}#", array($this, 'simpleReplace'), $template);
|
||||||
}
|
}
|
||||||
|
|
||||||
function simpleReplace($tmp) {
|
protected function simpleReplace($tmp) {
|
||||||
$unset = ($this->replaceUnset ? '' : $tmp[0]);
|
$unset = ($this->replaceUnset !== false ? $this->replaceUnset : $tmp[0]);
|
||||||
return ($this->replaceVars->$tmp[1] ? $this->replaceVars->$tmp[1] : $unset);
|
return ($this->replaceVars->$tmp[1] !== null ? $this->replaceVars->$tmp[1] : $unset);
|
||||||
}
|
}
|
||||||
|
|
||||||
function htmlwrap($str, $width, $break = "\n", $nobreak = "a", $nobr = "pre", $utf = FALSE)
|
function htmlwrap($str, $width, $break = "\n", $nobreak = "a", $nobr = "pre", $utf = FALSE)
|
||||||
@@ -1918,7 +1918,7 @@ class e_vars
|
|||||||
*
|
*
|
||||||
* @param array $array [optional] initial data
|
* @param array $array [optional] initial data
|
||||||
*/
|
*/
|
||||||
public function __construct($array='')
|
public function __construct($array = array())
|
||||||
{
|
{
|
||||||
$this->setVars($array);
|
$this->setVars($array);
|
||||||
}
|
}
|
||||||
@@ -1965,6 +1965,16 @@ class e_vars
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if there is data available
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function isEmpty()
|
||||||
|
{
|
||||||
|
return empty($this->vars);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Magic setter
|
* Magic setter
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user