New upstream version 3.5.0

This commit is contained in:
geos_one
2025-08-08 11:12:01 +02:00
parent 8948a800bb
commit 8e3d35fd6e
153 changed files with 33544 additions and 22227 deletions

View File

@@ -11,7 +11,7 @@
* with this package in the file LICENSE, and is available through
* the world-wide-web at
* http://www.opensource.org/licenses/bsd-license.php
* If you did not receive a copy of the new BSDlicense and are unable
* If you did not receive a copy of the new BSD license and are unable
* to obtain it through the world-wide-web, please send a note to
* pajoye@php.net so we can mail you a copy immediately.
*
@@ -23,13 +23,12 @@
* @package HTML_Template_IT
* @author Ulf Wendel <uw@netuse.de>
* @license BSD http://www.opensource.org/licenses/bsd-license.php
* @version CVS: $Id: IT.php 3 2017-06-22 07:32:17Z martin $
* @version CVS: $Id$
* @link http://pear.php.net/packages/HTML_Template_IT
* @access public
*/
require_once 'PEAR.php';
$myPEAR = new PEAR();
define('IT_OK', 1);
define('IT_ERROR', -1);
@@ -49,7 +48,7 @@ define('IT_UNKNOWN_OPTION', -6);
* one you can build. template::parse() [phplib template = Isotemplate] requests
* you to name a source and a target where the current block gets parsed into.
* Source and target can be block names or even handler names. This API gives you
* a maximum of fexibility but you always have to know what you do which is
* a maximum of flexibility but you always have to know what you do which is
* quite unusual for php skripter like me.
*
* I noticed that I do not any control on which block gets parsed into which one.
@@ -148,7 +147,6 @@ class HTML_Template_IT
/**
* Clear cache on get()?
* @var boolean
* @acces public
*/
@@ -279,9 +277,9 @@ class HTML_Template_IT
* should be preserved although they are empty (no placeholder replaced).
* Think of a shopping basket. If it's empty you have to drop a message to
* the user. If it's filled you have to show the contents of
* the shopping baseket. Now where do you place the message that the basket
* the shopping basket. Now where do you place the message that the basket
* is empty? It's no good idea to place it in you applications as customers
* tend to like unecessary minor text changes. Having another template file
* tend to like unnecessary minor text changes. Having another template file
* for an empty basket means that it's very likely that one fine day
* the filled and empty basket templates have different layout. I decided
* to introduce blocks that to not contain any placeholder but only
@@ -289,7 +287,7 @@ class HTML_Template_IT
*
* Now if there is no replacement done in such a block the block will
* be recognized as "empty" and by default ($removeEmptyBlocks = true) be
* stripped off. To avoid thisyou can now call touchBlock() to avoid this.
* stripped off. To avoid this you can now call touchBlock() to avoid this.
*
* The array $touchedBlocks stores a list of touched block which must not
* be removed even if they are empty.
@@ -298,15 +296,7 @@ class HTML_Template_IT
* @see touchBlock(), $removeEmptyBlocks
* @access private
*/
var $touchedBlocks = array();
/**
* List of blocks which should not be shown even if not "empty"
* @var array $_hiddenBlocks
* @see hideBlock(), $removeEmptyBlocks
* @access private
*/
var $_hiddenBlocks = array();
var $touchedBlocks = array();
/**
* Variable cache.
@@ -395,7 +385,7 @@ class HTML_Template_IT
);
/**
* Builds some complex regular expressions and optinally sets the
* Builds some complex regular expressions and optionally sets the
* file root directory.
*
* Make sure that you call this constructor if you derive your template
@@ -415,15 +405,15 @@ class HTML_Template_IT
}
$this->variablesRegExp = '@' . $this->openingDelimiter .
'(' . $this->variablenameRegExp . ')' .
$this->closingDelimiter . '@sm';
'(' . $this->variablenameRegExp . ')' .
$this->closingDelimiter . '@sm';
$this->removeVariablesRegExp = '@' . $this->openingDelimiter .
"\s*(" . $this->variablenameRegExp .
")\s*" . $this->closingDelimiter .'@sm';
"\s*(" . $this->variablenameRegExp .
")\s*" . $this->closingDelimiter .'@sm';
$this->blockRegExp = '@<!--\s+BEGIN\s+(' . $this->blocknameRegExp .
')\s+-->(.*)<!--\s+END\s+\1\s+-->@sm';
')\s+-->(.*)<!--\s+END\s+\1\s+-->@sm';
$this->setRoot($root);
} // end constructor
@@ -440,8 +430,7 @@ class HTML_Template_IT
*/
function setOption($option, $value)
{
global $myPEAR;
switch ($option) {
switch ($option) {
case 'removeEmptyBlocks':
$this->removeEmptyBlocks = $value;
return IT_OK;
@@ -452,7 +441,7 @@ class HTML_Template_IT
return IT_OK;
}
return $myPEAR->raiseError(
return PEAR::raiseError(
$this->errorMessage(IT_UNKNOWN_OPTION) . ": '{$option}'",
IT_UNKNOWN_OPTION
);
@@ -472,12 +461,10 @@ class HTML_Template_IT
*/
function setOptions($options)
{
global $myPEAR;
if (is_array($options)) {
foreach ($options as $option => $value) {
$error = $this->setOption($option, $value);
if ($myPEAR->isError($error)) {
if (PEAR::isError($error)) {
return $error;
}
}
@@ -512,13 +499,12 @@ class HTML_Template_IT
*/
function get($block = '__global__')
{
global $myPEAR;
if ($block == '__global__' && !$this->flagGlobalParsed) {
if ($block == '__global__' && !$this->flagGlobalParsed) {
$this->parse('__global__');
}
if (!isset($this->blocklist[$block])) {
$this->err[] = $myPEAR->raiseError(
$this->err[] = PEAR::raiseError(
$this->errorMessage(IT_BLOCK_NOT_FOUND) . '"' . $block . "'",
IT_BLOCK_NOT_FOUND
);
@@ -562,11 +548,10 @@ class HTML_Template_IT
*/
function parse($block = '__global__', $flag_recursion = false)
{
global $myPEAR;
static $regs, $values;
static $regs, $values;
if (!isset($this->blocklist[$block])) {
return $myPEAR->raiseError(
return PEAR::raiseError(
$this->errorMessage(IT_BLOCK_NOT_FOUND) . '"' . $block . "'",
IT_BLOCK_NOT_FOUND
);
@@ -587,7 +572,7 @@ class HTML_Template_IT
if ($this->clearCacheOnParse) {
foreach ($this->variableCache as $name => $value) {
$regs[] = $this->openingDelimiter .
$name . $this->closingDelimiter;
$name . $this->closingDelimiter;
$values[] = $value;
@@ -601,7 +586,7 @@ class HTML_Template_IT
if (isset($this->variableCache[$allowedvar])) {
$regs[] = $this->openingDelimiter .
$allowedvar . $this->closingDelimiter;
$allowedvar . $this->closingDelimiter;
$values[] = $this->variableCache[$allowedvar];
unset($this->variableCache[$allowedvar]);
@@ -622,7 +607,7 @@ class HTML_Template_IT
}
$placeholder = $this->openingDelimiter . "__" .
$innerblock . "__" . $this->closingDelimiter;
$innerblock . "__" . $this->closingDelimiter;
$outer = str_replace(
$placeholder,
@@ -754,7 +739,7 @@ class HTML_Template_IT
/**
* Sets a variable value.
*
* The function can be used eighter like setVariable( "varname", "value")
* The function can be used either like setVariable( "varname", "value")
* or with one array $variables["varname"] = "value"
* given setVariable($variables) quite like phplib templates set_var().
*
@@ -791,9 +776,9 @@ class HTML_Template_IT
*/
function setCurrentBlock($block = '__global__')
{
global $myPEAR;
if (!isset($this->blocklist[$block])) {
return $myPEAR->raiseError(
return PEAR::raiseError(
$this->errorMessage(IT_BLOCK_NOT_FOUND)
. '"' . $block . "'",
IT_BLOCK_NOT_FOUND
@@ -817,9 +802,8 @@ class HTML_Template_IT
*/
function touchBlock($block)
{
global $myPEAR;
if (!isset($this->blocklist[$block])) {
return $myPEAR->raiseError(
if (!isset($this->blocklist[$block])) {
return PEAR::raiseError(
$this->errorMessage(IT_BLOCK_NOT_FOUND) . '"' . $block . "'",
IT_BLOCK_NOT_FOUND
);
@@ -876,7 +860,7 @@ class HTML_Template_IT
/**
* Sets the template.
*
* You can eighter load a template file from disk with
* You can either load a template file from disk with
* LoadTemplatefile() or set the template manually using this function.
*
* @param string $template template content
@@ -888,8 +872,8 @@ class HTML_Template_IT
* @return boolean
*/
function setTemplate( $template,
$removeUnknownVariables = true,
$removeEmptyBlocks = true) {
$removeUnknownVariables = true,
$removeEmptyBlocks = true) {
$this->removeUnknownVariables = $removeUnknownVariables;
$this->removeEmptyBlocks = $removeEmptyBlocks;
@@ -901,7 +885,7 @@ class HTML_Template_IT
$this->currentBlock = '__global__';
} else {
$this->template = '<!-- BEGIN __global__ -->' . $template .
'<!-- END __global__ -->';
'<!-- END __global__ -->';
$this->init();
}
@@ -925,8 +909,8 @@ class HTML_Template_IT
* $removeEmptyBlocks
*/
function loadTemplatefile( $filename,
$removeUnknownVariables = true,
$removeEmptyBlocks = true ) {;
$removeUnknownVariables = true,
$removeEmptyBlocks = true ) {;
$template = '';
if (!$this->flagCacheTemplatefile
|| $this->lastTemplatefile != $filename
@@ -936,9 +920,9 @@ class HTML_Template_IT
$this->lastTemplatefile = $filename;
return $template != '' ?
$this->setTemplate(
$template,
$removeUnknownVariables,
$this->setTemplate(
$template,
$removeUnknownVariables,
$removeEmptyBlocks) : false;
} // end func LoadTemplatefile
@@ -999,7 +983,7 @@ class HTML_Template_IT
foreach ($this->blockvariables['__global__'] as $allowedvar => $v) {
if (isset($this->variableCache[$allowedvar])) {
$regs[] = '@' . $this->openingDelimiter .
$allowedvar . $this->closingDelimiter . '@';
$allowedvar . $this->closingDelimiter . '@';
$values[] = $this->variableCache[$allowedvar];
unset($this->variableCache[$allowedvar]);
}
@@ -1009,7 +993,7 @@ class HTML_Template_IT
} // end func getGlobalvariables
/**
* Recusively builds a list of all blocks within the template.
* Recursively builds a list of all blocks within the template.
*
* @param string $string string that gets scanned
*
@@ -1019,8 +1003,7 @@ class HTML_Template_IT
*/
function findBlocks($string)
{
global $myPEAR;
$blocklist = array();
$blocklist = array();
if (preg_match_all($this->blockRegExp, $string, $regs, PREG_SET_ORDER)) {
foreach ($regs as $k => $match) {
@@ -1030,7 +1013,7 @@ class HTML_Template_IT
if (isset($this->blocklist[$blockname])) {
$msg = $this->errorMessage(IT_BLOCK_DUPLICATE, $blockname);
$this->err[] = $myPEAR->raiseError($msg, IT_BLOCK_DUPLICATE);
$this->err[] = PEAR::raiseError($msg, IT_BLOCK_DUPLICATE);
$this->flagBlocktrouble = true;
}
@@ -1073,15 +1056,14 @@ class HTML_Template_IT
*/
function getFile($filename)
{
global $myPEAR;
if ($filename{0} == '/' && substr($this->fileRoot, -1) == '/') {
if ($filename[0] == '/' && substr($this->fileRoot, -1) == '/') {
$filename = substr($filename, 1);
}
$filename = $this->fileRoot . $filename;
if (!($fh = @fopen($filename, 'r'))) {
$this->err[] = $myPEAR->raiseError(
$this->err[] = PEAR::raiseError(
$this->errorMessage(IT_TPL_NOT_FOUND) . ': "' .$filename .'"',
IT_TPL_NOT_FOUND
);
@@ -1097,10 +1079,9 @@ class HTML_Template_IT
$content = fread($fh, $fsize);
fclose($fh);
// "#<!-- INCLUDE (.*) -->#ime", wma/PEAR error
return preg_replace(
return preg_replace_callback(
"#<!-- INCLUDE (.*) -->#im",
"\$this->getFile('\\1')",
function ($m) { return $this->getFile($m[1]); },
$content
);
} // end func getFile
@@ -1148,13 +1129,13 @@ class HTML_Template_IT
function _preserveOpeningDelimiter($str)
{
return (false === strpos($str, $this->openingDelimiter))?
$str:
str_replace(
$this->openingDelimiter,
$this->openingDelimiter .
'%preserved%' . $this->closingDelimiter,
$str
);
$str:
str_replace(
$this->openingDelimiter,
$this->openingDelimiter .
'%preserved%' . $this->closingDelimiter,
$str
);
}
/**
@@ -1169,8 +1150,7 @@ class HTML_Template_IT
*/
function errorMessage($value, $blockname = '')
{
global $myPEAR;
static $errorMessages;
static $errorMessages;
if (!isset($errorMessages)) {
$errorMessages = array(
IT_OK => '',
@@ -1178,20 +1158,19 @@ class HTML_Template_IT
IT_TPL_NOT_FOUND => 'Cannot read the template file',
IT_BLOCK_NOT_FOUND => 'Cannot find this block',
IT_BLOCK_DUPLICATE => 'The name of a block must be'.
' uniquewithin a template.'.
' Found "' . $blockname . '" twice.'.
'Unpredictable results '.
'may appear.',
' uniquewithin a template.'.
' Found "' . $blockname . '" twice.'.
'Unpredictable results '.
'may appear.',
IT_UNKNOWN_OPTION => 'Unknown option'
);
}
if ($myPEAR->isError($value)) {
if (PEAR::isError($value)) {
$value = $value->getCode();
}
return isset($errorMessages[$value]) ?
$errorMessages[$value] : $errorMessages[IT_ERROR];
$errorMessages[$value] : $errorMessages[IT_ERROR];
}
} // end class IntegratedTemplate
?>
} // end class IntegratedTemplate

View File

@@ -11,7 +11,7 @@
* with this package in the file LICENSE, and is available through
* the world-wide-web at
* http://www.opensource.org/licenses/bsd-license.php
* If you did not receive a copy of the new BSDlicense and are unable
* If you did not receive a copy of the new BSD license and are unable
* to obtain it through the world-wide-web, please send a note to
* pajoye@php.net so we can mail you a copy immediately.
*
@@ -23,7 +23,7 @@
* @package HTML_Template_IT
* @author Ulf Wendel <uw@netuse.de>
* @license BSD http://www.opensource.org/licenses/bsd-license.php
* @version CVS: $Id: ITX.php 3 2017-06-22 07:32:17Z martin $
* @version CVS: $Id$
* @link http://pear.php.net/packages/HTML_Template_IT
* @access public
*/
@@ -32,24 +32,24 @@ require_once 'HTML/Template/IT.php';
require_once 'HTML/Template/IT_Error.php';
/**
* Integrated Template Extension - ITX
*
* With this class you get the full power of the phplib template class.
* You may have one file with blocks in it but you have as well one main file
* and multiple files one for each block. This is quite usefull when you have
* user configurable websites. Using blocks not in the main template allows
* you to modify some parts of your layout easily.
*
* Note that you can replace an existing block and add new blocks at runtime.
* Adding new blocks means changing a variable placeholder to a block.
*
* Integrated Template Extension - ITX
*
* With this class you get the full power of the phplib template class.
* You may have one file with blocks in it but you have as well one main file
* and multiple files one for each block. This is quite useful when you have
* user configurable websites. Using blocks not in the main template allows
* you to modify some parts of your layout easily.
*
* Note that you can replace an existing block and add new blocks at runtime.
* Adding new blocks means changing a variable placeholder to a block.
*
* @category HTML
* @package HTML_Template_IT
* @author Ulf Wendel <uw@netuse.de>
* @license BSD http://www.opensource.org/licenses/bsd-license.php
* @link http://pear.php.net/packages/HTML_Template_IT
* @access public
*/
*/
class HTML_Template_ITX extends HTML_Template_IT
{
/**
@@ -136,15 +136,15 @@ class HTML_Template_ITX extends HTML_Template_IT
* @access public
* @see HTML_Template_IT()
*/
function HTML_Template_ITX($root = '')
function __construct($root = '')
{
$this->checkblocknameRegExp = '@' . $this->blocknameRegExp . '@';
$this->functionRegExp = '@' . $this->functionPrefix . '(' .
$this->functionnameRegExp . ')\s*\(@sm';
$this->functionnameRegExp . ')\s*\(@sm';
$this->HTML_Template_IT($root);
parent::__construct($root);
} // end func constructor
/**
@@ -173,7 +173,7 @@ class HTML_Template_ITX extends HTML_Template_IT
* Replaces an existing block with new content.
*
* This function will replace a block of the template and all blocks
* contained in the replaced block and add a new block insted, means
* contained in the replaced block and add a new block instead, means
* you can dynamically change your template.
*
* Note that changing the template structure violates one of the IT[X]
@@ -199,8 +199,8 @@ class HTML_Template_ITX extends HTML_Template_IT
{
if (!isset($this->blocklist[$block])) {
return new IT_Error("The block "."'$block'".
" does not exist in the template and thus it can't be replaced.",
__FILE__, __LINE__);
" does not exist in the template and thus it can't be replaced.",
__FILE__, __LINE__);
}
if ($template == '') {
@@ -287,17 +287,17 @@ class HTML_Template_ITX extends HTML_Template_IT
// Don't trust any user even if it's a programmer or yourself...
if ($placeholder == '') {
return new IT_Error('No variable placeholder given.',
__FILE__, __LINE__);
__FILE__, __LINE__);
} elseif ($blockname == '' ||
!preg_match($this->checkblocknameRegExp, $blockname)
!preg_match($this->checkblocknameRegExp, $blockname)
) {
return new IT_Error("No or invalid blockname '$blockname' given.",
__FILE__, __LINE__);
__FILE__, __LINE__);
} elseif ($template == '') {
return new IT_Error('No block content given.', __FILE__, __LINE__);
} elseif (isset($this->blocklist[$blockname])) {
return new IT_Error('The block already exists.',
__FILE__, __LINE__);
__FILE__, __LINE__);
}
// find out where to insert the new block
@@ -305,25 +305,25 @@ class HTML_Template_ITX extends HTML_Template_IT
if (count($parents) == 0) {
return new IT_Error("The variable placeholder".
" '$placeholder' was not found in the template.",
__FILE__, __LINE__);
" '$placeholder' was not found in the template.",
__FILE__, __LINE__);
} elseif (count($parents) > 1) {
reset($parents);
while (list($k, $parent) = each($parents)) {
foreach ($parents as $k => $parent) {
$msg .= "$parent, ";
}
$msg = substr($parent, -2);
return new IT_Error("The variable placeholder "."'$placeholder'".
" must be unique, found in multiple blocks '$msg'.",
__FILE__, __LINE__);
" must be unique, found in multiple blocks '$msg'.",
__FILE__, __LINE__);
}
$template = "<!-- BEGIN $blockname -->"
. $template
. "<!-- END $blockname -->";
. $template
. "<!-- END $blockname -->";
$this->findBlocks($template);
if ($this->flagBlocktrouble) {
return false; // findBlocks() already throws an exception
@@ -373,7 +373,7 @@ class HTML_Template_ITX extends HTML_Template_IT
*
* @return string Name of the (first) block that contains
* the specified placeholder.
* If the placeholder was not found or an error occured
* If the placeholder was not found or an error occurred
* an empty string is returned.
* @throws IT_Error
* @access public
@@ -397,7 +397,7 @@ class HTML_Template_ITX extends HTML_Template_IT
if (is_array($variables = $this->blockvariables[$block])) {
// search the value in the list of blockvariables
reset($variables);
while (list($k, $variable) = each($variables)) {
foreach ($variables as $k => $variable) {
if ($k == $placeholder) {
$found = $block;
break;
@@ -409,7 +409,7 @@ class HTML_Template_ITX extends HTML_Template_IT
// search all blocks and return the name of the first block that
// contains the placeholder
reset($this->blockvariables);
while (list($blockname, $variables) = each($this->blockvariables)) {
foreach ($this->blockvariables as $blockname => $variables) {
if (is_array($variables) && isset($variables[$placeholder])) {
$found = $blockname;
break;
@@ -430,7 +430,7 @@ class HTML_Template_ITX extends HTML_Template_IT
function performCallback()
{
reset($this->functions);
while (list($func_id, $function) = each($this->functions)) {
foreach ($this->functions as $func_id => $function) {
if (isset($this->callback[$function['name']])) {
if ($this->callback[$function['name']]['expandParameters']) {
$callFunction = 'call_user_func_array';
@@ -439,14 +439,14 @@ class HTML_Template_ITX extends HTML_Template_IT
}
if ($this->callback[$function['name']]['object'] != '') {
$call = $callFunction(
$call = $callFunction(
array(
&$GLOBALS[$this->callback[$function['name']]['object']],
$this->callback[$function['name']]['function']),
$function['args']);
} else {
$call = $callFunction(
$call = $callFunction(
$this->callback[$function['name']]['function'],
$function['args']);
}
@@ -493,7 +493,7 @@ class HTML_Template_ITX extends HTML_Template_IT
*
* This is an absolutely evil feature. If your application makes heavy
* use of such callbacks and you're even implementing if-then etc. on
* the level of a template engine you're reiventing the wheel... - that's
* the level of a template engine you're reinventing the wheel... - that's
* actually how PHP came into life. Anyway, sometimes it's handy.
*
* Consider also using XML/XSLT or native PHP. And please do not push
@@ -528,22 +528,22 @@ class HTML_Template_ITX extends HTML_Template_IT
* @return boolean False on failure.
* @throws IT_Error
* @access public
* @deprecated The $callbackobject parameter is depricated since
* @deprecated The $callbackobject parameter is deprecated since
* version 1.2 and might be dropped in further versions.
*/
function setCallbackFunction($tplfunction, $callbackfunction,
$callbackobject = '',
$expandCallbackParameters = false) {
$callbackobject = '',
$expandCallbackParameters = false) {
if ($tplfunction == '' || $callbackfunction == '') {
return new IT_Error("No template function "."('$tplfunction')".
" and/or no callback function ('$callback') given.",
__FILE__, __LINE__);
" and/or no callback function ('$callbackfunction') given.",
__FILE__, __LINE__);
}
$this->callback[$tplfunction] = array(
'function' => $callbackfunction,
'object' => $callbackobject,
'expandParameters' => (boolean)
$expandCallbackParameters);
'function' => $callbackfunction,
'object' => $callbackobject,
'expandParameters' => (boolean)
$expandCallbackParameters);
return true;
} // end func setCallbackFunction
@@ -567,7 +567,7 @@ class HTML_Template_ITX extends HTML_Template_IT
} // end func setCallbackFunctiontable
/**
* Recursively removes all data assiciated with a block, including
* Recursively removes all data associated with a block, including
* all inner blocks
*
* @param string $block block to be removed
@@ -610,7 +610,7 @@ class HTML_Template_ITX extends HTML_Template_IT
} // end func getBlocklist
/**
* Checks wheter a block exists.
* Checks whether a block exists.
*
* @param string $blockname Blockname
*
@@ -647,7 +647,7 @@ class HTML_Template_ITX extends HTML_Template_IT
} // end func getBlockvariables
/**
* Checks wheter a block variable exists.
* Checks whether a block variable exists.
*
* @param string $block Blockname
* @param string $variable Variablename
@@ -687,8 +687,8 @@ class HTML_Template_ITX extends HTML_Template_IT
$search = $regs[0] . $head . ')';
$replace = $this->openingDelimiter .
'__function' . $num . '__' .
$this->closingDelimiter;
'__function' . $num . '__' .
$this->closingDelimiter;
$this->template = str_replace($search, $replace, $this->template);
$template = str_replace($search, $replace, $template);
@@ -697,7 +697,7 @@ class HTML_Template_ITX extends HTML_Template_IT
$arg2 = trim($args2);
$args[] = ('"' == $arg2{0} || "'" == $arg2{0}) ?
substr($arg2, 1, -1) : $arg2;
substr($arg2, 1, -1) : $arg2;
if ($arg2 == $head) {
break;
@@ -706,13 +706,13 @@ class HTML_Template_ITX extends HTML_Template_IT
}
$this->functions[$num++] = array('name' => $regs[1],
'args' => $args);
'args' => $args);
}
} // end func buildFunctionlist
/**
* Truncates the given code from the first occurence of
* Truncates the given code from the first occurrence of
* $delimiter but ignores $delimiter enclosed by " or '.
*
* @param string $code The code which should be parsed
@@ -782,7 +782,7 @@ class HTML_Template_ITX extends HTML_Template_IT
}
reset($this->blockvariables[$block]);
while (list($varname, $val) = each($this->blockvariables[$block])) {
foreach ($this->blockvariables[$block] as $varname => $val) {
if (isset($variables[$varname])) {
unset($this->blockvariables[$block][$varname]);
}
@@ -840,10 +840,10 @@ class HTML_Template_ITX extends HTML_Template_IT
{
$parents = array();
reset($this->blocklist);
while (list($blockname, $content) = each($this->blocklist)) {
foreach ($this->blocklist as $blockname => $content) {
reset($this->blockvariables[$blockname]);
while (list($varname, $val) = each($this->blockvariables[$blockname])) {
foreach ($this->blockvariables[$blockname] as $varname => $val) {
if ($variable == $varname) {
$parents[] = $blockname;
}
@@ -858,8 +858,8 @@ class HTML_Template_ITX extends HTML_Template_IT
* calls die() depending on the flags
*
* @param string $message Warning
* @param string $file File where the warning occured
* @param int $line Linenumber where the warning occured
* @param string $file File where the warning occurred
* @param int $line Linenumber where the warning occurred
*
* @see $warn, $printWarning, $haltOnWarning
* @access private
@@ -885,5 +885,4 @@ class HTML_Template_ITX extends HTML_Template_IT
}
} // end func warning
} // end class HTML_Template_ITX
?>
} // end class HTML_Template_ITX

View File

@@ -1,29 +1,29 @@
<?php
/**
* Integrated Template - IT
*
*
* PHP version 4
*
* Copyright (c) 1997-2007 Ulf Wendel, Pierre-Alain Joye,
* David Soria Parra
* Copyright (c) 1997-2007 Ulf Wendel, Pierre-Alain Joye,
* David Soria Parra
*
* This source file is subject to the New BSD license, That is bundled
* with this package in the file LICENSE, and is available through
* the world-wide-web at
* http://www.opensource.org/licenses/bsd-license.php
* If you did not receive a copy of the new BSD license and are unable
* to obtain it through the world-wide-web, please send a note to
* pajoye@php.net so we can mail you a copy immediately.
*
* Author: Ulf Wendel <ulf.wendel@phpdoc.de>
* Pierre-Alain Joye <pajoye@php.net>
* David Soria Parra <dsp@php.net>
*
* This source file is subject to the New BSD license, That is bundled
* with this package in the file LICENSE, and is available through
* the world-wide-web at
* http://www.opensource.org/licenses/bsd-license.php
* If you did not receive a copy of the new BSDlicense and are unable
* to obtain it through the world-wide-web, please send a note to
* pajoye@php.net so we can mail you a copy immediately.
*
* Author: Ulf Wendel <ulf.wendel@phpdoc.de>
* Pierre-Alain Joye <pajoye@php.net>
* David Soria Parra <dsp@php.net>
*
* @category HTML
* @package HTML_Template_IT
* @author Ulf Wendel <uw@netuse.de>
* @license BSD http://www.opensource.org/licenses/bsd-license.php
* @version CVS: $Id: IT_Error.php 3 2017-06-22 07:32:17Z martin $
* @version CVS: $Id$
* @link http://pear.php.net/packages/HTML_Template_IT
* @access public
*/
@@ -31,35 +31,34 @@
require_once "PEAR.php";
/**
* IT[X] Error class
*
* IT[X] Error class
*
* @category HTML
* @package HTML_Template_IT
* @author Ulf Wendel <uw@netuse.de>
* @license BSD http://www.opensource.org/licenses/bsd-license.php
* @link http://pear.php.net/packages/HTML_Template_IT
* @access public
*/
*/
class IT_Error extends PEAR_Error
{
/**
* Prefix of all error messages.
*
*
* @var string
*/
var $error_message_prefix = "IntegratedTemplate Error: ";
/**
* Creates an cache error object.
*
*
* @param string $msg error message
* @param string $file file where the error occured
* @param string $line linenumber where the error occured
* @param string $file file where the error occurred
* @param string $line linenumber where the error occurred
*/
function IT_Error($msg, $file = __FILE__, $line = __LINE__)
function __construct($msg, $file = __FILE__, $line = __LINE__)
{
$this->PEAR_Error(sprintf("%s [%s on line %d].", $msg, $file, $line));
$this->PEAR_Error(sprintf("%s [%s on line %d].", $msg, $file, $line));
} // end func IT_Error
} // end class IT_Error
?>
} // end class IT_Error