Compare commits
	
		
			1 Commits
		
	
	
		
			upstream/1
			...
			upstream
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					4c6c1cade7 | 
@@ -1,36 +0,0 @@
 | 
				
			|||||||
<?php
 | 
					 | 
				
			||||||
if (!defined('PHPUnit_MAIN_METHOD')) {
 | 
					 | 
				
			||||||
    define('PHPUnit_MAIN_METHOD', 'HTML_Template_IT_AllTests::main');
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
require_once 'PHPUnit/TextUI/TestRunner.php';
 | 
					 | 
				
			||||||
require_once 'PHPUnit/Framework/TestSuite.php';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
require_once 'ITTest.php';
 | 
					 | 
				
			||||||
require_once 'ITXTest.php';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
class HTML_Template_IT_AllTests
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    public static function main()
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        PHPUnit_TextUI_TestRunner::run(self::suite());
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public static function suite()
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        $suite = new PHPUnit_Framework_TestSuite('HTML_Template_IT tests');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        $suite->addTestSuite('ITTest');
 | 
					 | 
				
			||||||
        $suite->addTestSuite('ITXTest');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        return $suite;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
if (PHPUnit_MAIN_METHOD == 'HTML_Template_IT_AllTests::main') {
 | 
					 | 
				
			||||||
    HTML_Template_IT_AllTests::main();
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
?>
 | 
					 | 
				
			||||||
@@ -1,13 +0,0 @@
 | 
				
			|||||||
<!-- BEGIN block_one -->
 | 
					 | 
				
			||||||
{glob}:{var1}#
 | 
					 | 
				
			||||||
<!-- END block_one -->
 | 
					 | 
				
			||||||
<!-- BEGIN block_two -->
 | 
					 | 
				
			||||||
{glob}:{var2}#
 | 
					 | 
				
			||||||
<!-- END block_two -->
 | 
					 | 
				
			||||||
<!-- BEGIN block_three -->
 | 
					 | 
				
			||||||
{glob}:{var3}
 | 
					 | 
				
			||||||
    <!-- BEGIN block_four -->
 | 
					 | 
				
			||||||
    |{glob}:{var4}
 | 
					 | 
				
			||||||
    <!-- END block_four -->
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
<!-- END block_three -->
 | 
					 | 
				
			||||||
@@ -48,7 +48,7 @@ define('IT_UNKNOWN_OPTION', -6);
 | 
				
			|||||||
 * one you can build. template::parse() [phplib template = Isotemplate] requests
 | 
					 * 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.
 | 
					 * 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
 | 
					 * 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.
 | 
					 * quite unusual for php skripter like me.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * I noticed that I do not any control on which block gets parsed into which one.
 | 
					 * I noticed that I do not any control on which block gets parsed into which one.
 | 
				
			||||||
@@ -278,9 +278,9 @@ class HTML_Template_IT
 | 
				
			|||||||
     * should be preserved although they are empty (no placeholder replaced).
 | 
					     * 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
 | 
					     * 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 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
 | 
					     * 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
 | 
					     * 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
 | 
					     * the filled and empty basket templates have different layout. I decided
 | 
				
			||||||
     * to introduce blocks that to not contain any placeholder but only
 | 
					     * to introduce blocks that to not contain any placeholder but only
 | 
				
			||||||
@@ -299,14 +299,6 @@ class HTML_Template_IT
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
     var $touchedBlocks = array();
 | 
					     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();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Variable cache.
 | 
					     * Variable cache.
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
@@ -394,7 +386,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.
 | 
					     * file root directory.
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
     * Make sure that you call this constructor if you derive your template
 | 
					     * Make sure that you call this constructor if you derive your template
 | 
				
			||||||
@@ -748,7 +740,7 @@ class HTML_Template_IT
 | 
				
			|||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Sets a variable value.
 | 
					     * 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"
 | 
					     * or with one array $variables["varname"] = "value"
 | 
				
			||||||
     * given setVariable($variables) quite like phplib templates set_var().
 | 
					     * given setVariable($variables) quite like phplib templates set_var().
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
@@ -869,7 +861,7 @@ class HTML_Template_IT
 | 
				
			|||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Sets the template.
 | 
					     * 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.
 | 
					     * LoadTemplatefile() or set the template manually using this function.
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
     * @param string $template               template content
 | 
					     * @param string $template               template content
 | 
				
			||||||
@@ -1002,7 +994,7 @@ class HTML_Template_IT
 | 
				
			|||||||
    } // end func getGlobalvariables
 | 
					    } // 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
 | 
					     * @param string $string string that gets scanned
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
@@ -1065,7 +1057,7 @@ class HTML_Template_IT
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    function getFile($filename)
 | 
					    function getFile($filename)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        if ($filename{0} == '/' && substr($this->fileRoot, -1) == '/') {
 | 
					        if ($filename[0] == '/' && substr($this->fileRoot, -1) == '/') {
 | 
				
			||||||
            $filename = substr($filename, 1);
 | 
					            $filename = substr($filename, 1);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -36,7 +36,7 @@ require_once 'HTML/Template/IT_Error.php';
 | 
				
			|||||||
*
 | 
					*
 | 
				
			||||||
* With this class you get the full power of the phplib template class.
 | 
					* 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
 | 
					* 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
 | 
					* 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
 | 
					* user configurable websites. Using blocks not in the main template allows
 | 
				
			||||||
* you to modify some parts of your layout easily.
 | 
					* you to modify some parts of your layout easily.
 | 
				
			||||||
*
 | 
					*
 | 
				
			||||||
@@ -173,7 +173,7 @@ class HTML_Template_ITX extends HTML_Template_IT
 | 
				
			|||||||
     * Replaces an existing block with new content.
 | 
					     * Replaces an existing block with new content.
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
     * This function will replace a block of the template and all blocks
 | 
					     * 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.
 | 
					     * you can dynamically change your template.
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
     * Note that changing the template structure violates one of the IT[X]
 | 
					     * Note that changing the template structure violates one of the IT[X]
 | 
				
			||||||
@@ -311,7 +311,7 @@ class HTML_Template_ITX extends HTML_Template_IT
 | 
				
			|||||||
        } elseif (count($parents) > 1) {
 | 
					        } elseif (count($parents) > 1) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            reset($parents);
 | 
					            reset($parents);
 | 
				
			||||||
            while (list($k, $parent) = each($parents)) {
 | 
					            foreach ($parents as $k => $parent) {
 | 
				
			||||||
                $msg .= "$parent, ";
 | 
					                $msg .= "$parent, ";
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            $msg = substr($parent, -2);
 | 
					            $msg = substr($parent, -2);
 | 
				
			||||||
@@ -373,7 +373,7 @@ class HTML_Template_ITX extends HTML_Template_IT
 | 
				
			|||||||
     *
 | 
					     *
 | 
				
			||||||
     * @return   string  Name of the (first) block that contains
 | 
					     * @return   string  Name of the (first) block that contains
 | 
				
			||||||
     *                   the specified placeholder.
 | 
					     *                   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.
 | 
					     *                   an empty string is returned.
 | 
				
			||||||
     * @throws   IT_Error
 | 
					     * @throws   IT_Error
 | 
				
			||||||
     * @access   public
 | 
					     * @access   public
 | 
				
			||||||
@@ -397,7 +397,7 @@ class HTML_Template_ITX extends HTML_Template_IT
 | 
				
			|||||||
            if (is_array($variables = $this->blockvariables[$block])) {
 | 
					            if (is_array($variables = $this->blockvariables[$block])) {
 | 
				
			||||||
                // search the value in the list of blockvariables
 | 
					                // search the value in the list of blockvariables
 | 
				
			||||||
                reset($variables);
 | 
					                reset($variables);
 | 
				
			||||||
                while (list($k, $variable) = each($variables)) {
 | 
					                foreach ($variables as $k => $variable) {
 | 
				
			||||||
                    if ($k == $placeholder) {
 | 
					                    if ($k == $placeholder) {
 | 
				
			||||||
                        $found = $block;
 | 
					                        $found = $block;
 | 
				
			||||||
                        break;
 | 
					                        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
 | 
					            // search all blocks and return the name of the first block that
 | 
				
			||||||
            // contains the placeholder
 | 
					            // contains the placeholder
 | 
				
			||||||
            reset($this->blockvariables);
 | 
					            reset($this->blockvariables);
 | 
				
			||||||
            while (list($blockname, $variables) = each($this->blockvariables)) {
 | 
					            foreach ($this->blockvariables as $blockname => $variables) {
 | 
				
			||||||
                if (is_array($variables) && isset($variables[$placeholder])) {
 | 
					                if (is_array($variables) && isset($variables[$placeholder])) {
 | 
				
			||||||
                    $found = $blockname;
 | 
					                    $found = $blockname;
 | 
				
			||||||
                    break;
 | 
					                    break;
 | 
				
			||||||
@@ -430,7 +430,7 @@ class HTML_Template_ITX extends HTML_Template_IT
 | 
				
			|||||||
    function performCallback()
 | 
					    function performCallback()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        reset($this->functions);
 | 
					        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 (isset($this->callback[$function['name']])) {
 | 
				
			||||||
                if ($this->callback[$function['name']]['expandParameters']) {
 | 
					                if ($this->callback[$function['name']]['expandParameters']) {
 | 
				
			||||||
                    $callFunction = 'call_user_func_array';
 | 
					                    $callFunction = 'call_user_func_array';
 | 
				
			||||||
@@ -493,7 +493,7 @@ class HTML_Template_ITX extends HTML_Template_IT
 | 
				
			|||||||
     *
 | 
					     *
 | 
				
			||||||
     * This is an absolutely evil feature. If your application makes heavy
 | 
					     * This is an absolutely evil feature. If your application makes heavy
 | 
				
			||||||
     * use of such callbacks and you're even implementing if-then etc. on
 | 
					     * 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.
 | 
					     * actually how PHP came into life. Anyway, sometimes it's handy.
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
     * Consider also using XML/XSLT or native PHP. And please do not push
 | 
					     * Consider also using XML/XSLT or native PHP. And please do not push
 | 
				
			||||||
@@ -528,7 +528,7 @@ class HTML_Template_ITX extends HTML_Template_IT
 | 
				
			|||||||
     * @return     boolean   False on failure.
 | 
					     * @return     boolean   False on failure.
 | 
				
			||||||
     * @throws     IT_Error
 | 
					     * @throws     IT_Error
 | 
				
			||||||
     * @access     public
 | 
					     * @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.
 | 
					     *             version 1.2 and might be dropped in further versions.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    function setCallbackFunction($tplfunction, $callbackfunction,
 | 
					    function setCallbackFunction($tplfunction, $callbackfunction,
 | 
				
			||||||
@@ -536,7 +536,7 @@ class HTML_Template_ITX extends HTML_Template_IT
 | 
				
			|||||||
    $expandCallbackParameters = false) {
 | 
					    $expandCallbackParameters = false) {
 | 
				
			||||||
        if ($tplfunction == '' || $callbackfunction == '') {
 | 
					        if ($tplfunction == '' || $callbackfunction == '') {
 | 
				
			||||||
            return new IT_Error("No template function "."('$tplfunction')".
 | 
					            return new IT_Error("No template function "."('$tplfunction')".
 | 
				
			||||||
                                " and/or no callback function ('$callback') given.",
 | 
					                                " and/or no callback function ('$callbackfunction') given.",
 | 
				
			||||||
                                __FILE__, __LINE__);
 | 
					                                __FILE__, __LINE__);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        $this->callback[$tplfunction] = array(
 | 
					        $this->callback[$tplfunction] = array(
 | 
				
			||||||
@@ -567,7 +567,7 @@ class HTML_Template_ITX extends HTML_Template_IT
 | 
				
			|||||||
    } // end func setCallbackFunctiontable
 | 
					    } // end func setCallbackFunctiontable
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Recursively removes all data assiciated with a block, including
 | 
					     * Recursively removes all data associated with a block, including
 | 
				
			||||||
     * all inner blocks
 | 
					     * all inner blocks
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
     * @param string $block block to be removed
 | 
					     * @param string $block block to be removed
 | 
				
			||||||
@@ -610,7 +610,7 @@ class HTML_Template_ITX extends HTML_Template_IT
 | 
				
			|||||||
    } // end func getBlocklist
 | 
					    } // end func getBlocklist
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Checks wheter a block exists.
 | 
					     * Checks whether a block exists.
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
     * @param string $blockname Blockname
 | 
					     * @param string $blockname Blockname
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
@@ -647,7 +647,7 @@ class HTML_Template_ITX extends HTML_Template_IT
 | 
				
			|||||||
    } // end func getBlockvariables
 | 
					    } // end func getBlockvariables
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Checks wheter a block variable exists.
 | 
					     * Checks whether a block variable exists.
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
     * @param string $block    Blockname
 | 
					     * @param string $block    Blockname
 | 
				
			||||||
     * @param string $variable Variablename
 | 
					     * @param string $variable Variablename
 | 
				
			||||||
@@ -696,7 +696,7 @@ class HTML_Template_ITX extends HTML_Template_IT
 | 
				
			|||||||
            while ($head != '' && $args2 = $this->getValue($head, ',')) {
 | 
					            while ($head != '' && $args2 = $this->getValue($head, ',')) {
 | 
				
			||||||
                $arg2 = trim($args2);
 | 
					                $arg2 = trim($args2);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                $args[] = ('"' == $arg2{0} || "'" == $arg2{0}) ?
 | 
					                $args[] = ('"' == $arg2[0] || "'" == $arg2[0]) ?
 | 
				
			||||||
                                    substr($arg2, 1, -1) : $arg2;
 | 
					                                    substr($arg2, 1, -1) : $arg2;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                if ($arg2 == $head) {
 | 
					                if ($arg2 == $head) {
 | 
				
			||||||
@@ -712,7 +712,7 @@ class HTML_Template_ITX extends HTML_Template_IT
 | 
				
			|||||||
    } // end func buildFunctionlist
 | 
					    } // 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 '.
 | 
					     * $delimiter but ignores $delimiter enclosed by " or '.
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
     * @param string $code      The code which should be parsed
 | 
					     * @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]);
 | 
					        reset($this->blockvariables[$block]);
 | 
				
			||||||
        while (list($varname, $val) = each($this->blockvariables[$block])) {
 | 
					        foreach ($this->blockvariables[$block] as $varname => $val) {
 | 
				
			||||||
            if (isset($variables[$varname])) {
 | 
					            if (isset($variables[$varname])) {
 | 
				
			||||||
                unset($this->blockvariables[$block][$varname]);
 | 
					                unset($this->blockvariables[$block][$varname]);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
@@ -840,10 +840,10 @@ class HTML_Template_ITX extends HTML_Template_IT
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        $parents = array();
 | 
					        $parents = array();
 | 
				
			||||||
        reset($this->blocklist);
 | 
					        reset($this->blocklist);
 | 
				
			||||||
        while (list($blockname, $content) = each($this->blocklist)) {
 | 
					        foreach ($this->blocklist as $blockname => $content) {
 | 
				
			||||||
            reset($this->blockvariables[$blockname]);
 | 
					            reset($this->blockvariables[$blockname]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            while (list($varname, $val) = each($this->blockvariables[$blockname])) {
 | 
					            foreach ($this->blockvariables[$blockname] as $varname => $val) {
 | 
				
			||||||
                if ($variable == $varname) {
 | 
					                if ($variable == $varname) {
 | 
				
			||||||
                    $parents[] = $blockname;
 | 
					                    $parents[] = $blockname;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
@@ -858,8 +858,8 @@ class HTML_Template_ITX extends HTML_Template_IT
 | 
				
			|||||||
     * calls die() depending on the flags
 | 
					     * calls die() depending on the flags
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
     * @param string $message Warning
 | 
					     * @param string $message Warning
 | 
				
			||||||
     * @param string $file    File where the warning occured
 | 
					     * @param string $file    File where the warning occurred
 | 
				
			||||||
     * @param int    $line    Linenumber where the warning occured
 | 
					     * @param int    $line    Linenumber where the warning occurred
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
     * @see      $warn, $printWarning, $haltOnWarning
 | 
					     * @see      $warn, $printWarning, $haltOnWarning
 | 
				
			||||||
     * @access   private
 | 
					     * @access   private
 | 
				
			||||||
@@ -53,8 +53,8 @@ class IT_Error extends PEAR_Error
 | 
				
			|||||||
     * Creates an cache error object.
 | 
					     * Creates an cache error object.
 | 
				
			||||||
     * 
 | 
					     * 
 | 
				
			||||||
     * @param string $msg  error message
 | 
					     * @param string $msg  error message
 | 
				
			||||||
     * @param string $file file where the error occured
 | 
					     * @param string $file file where the error occurred
 | 
				
			||||||
     * @param string $line linenumber where the error occured
 | 
					     * @param string $line linenumber where the error occurred
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    function __construct($msg, $file = __FILE__, $line = __LINE__)
 | 
					    function __construct($msg, $file = __FILE__, $line = __LINE__)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
@@ -1,8 +1,15 @@
 | 
				
			|||||||
<?php
 | 
					<?php
 | 
				
			||||||
require_once 'HTML/Template/IT.php';
 | 
					 | 
				
			||||||
require_once 'PHPUnit/Framework/TestCase.php';
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
class ITTest extends PHPUnit_Framework_TestCase
 | 
					// As we want to run on PHP < 7.1,
 | 
				
			||||||
 | 
					// we can't use return type declaration in fixtures.
 | 
				
			||||||
 | 
					// Therefore we use PHPUnitPolyFills snakecase fixtures set_up/tear_down
 | 
				
			||||||
 | 
					// instead of setUp/tearDown.
 | 
				
			||||||
 | 
					// See https://github.com/Yoast/PHPUnit-Polyfills?tab=readme-ov-file#option-1-yoastphpunitpolyfillstestcasestestcase
 | 
				
			||||||
 | 
					use Yoast\PHPUnitPolyfills\TestCases\TestCase;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					require_once 'HTML/Template/IT.php';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class ITTest extends Yoast\PHPUnitPolyfills\TestCases\TestCase
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
   /**
 | 
					   /**
 | 
				
			||||||
    * An HTML_Template_IT object
 | 
					    * An HTML_Template_IT object
 | 
				
			||||||
@@ -10,12 +17,12 @@ class ITTest extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
    */
 | 
					    */
 | 
				
			||||||
    var $tpl;
 | 
					    var $tpl;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    function setUp()
 | 
					    protected function set_up()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $this->tpl = new HTML_Template_IT(dirname(__FILE__) . '/templates');
 | 
					        $this->tpl = new HTML_Template_IT(dirname(__FILE__) . '/templates');
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    function tearDown()
 | 
					    protected function tear_down()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        unset($this->tpl);
 | 
					        unset($this->tpl);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -173,56 +180,6 @@ class ITTest extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    // Not available in stock class
 | 
					    // Not available in stock class
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   /**
 | 
					 | 
				
			||||||
    *
 | 
					 | 
				
			||||||
    */
 | 
					 | 
				
			||||||
    /*
 | 
					 | 
				
			||||||
    function testHideBlock()
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        if (!$this->_methodExists('hideBlock')) {
 | 
					 | 
				
			||||||
            return;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        $result = $this->tpl->loadTemplateFile('blockiteration.html', false, true);
 | 
					 | 
				
			||||||
        if (PEAR::isError($result)) {
 | 
					 | 
				
			||||||
            $this->assertTrue(false, 'Error loading template file: '. $result->getMessage());
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        $this->tpl->setVariable(array(
 | 
					 | 
				
			||||||
            'outer' => 'data',
 | 
					 | 
				
			||||||
            'inner' => 'stuff'
 | 
					 | 
				
			||||||
        ));
 | 
					 | 
				
			||||||
        // inner_block is not empty, but should be removed nonetheless
 | 
					 | 
				
			||||||
        $this->tpl->hideBlock('inner_block');
 | 
					 | 
				
			||||||
        $this->assertEquals('data#', $this->_stripWhitespace($this->tpl->get()));
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
	*/
 | 
					 | 
				
			||||||
   /**
 | 
					 | 
				
			||||||
    *
 | 
					 | 
				
			||||||
    */
 | 
					 | 
				
			||||||
    /*
 | 
					 | 
				
			||||||
	function testSetGlobalVariable()
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        if (!$this->_methodExists('setGlobalVariable')) {
 | 
					 | 
				
			||||||
            return;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        $result = $this->tpl->loadTemplateFile('globals.html', false, true);
 | 
					 | 
				
			||||||
        if (PEAR::isError($result)) {
 | 
					 | 
				
			||||||
            $this->assertTrue(false, 'Error loading template file: '. $result->getMessage());
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        $this->tpl->setGlobalVariable('glob', 'glob');
 | 
					 | 
				
			||||||
        // {var2} is not, block_two should be removed
 | 
					 | 
				
			||||||
        $this->tpl->setVariable(array(
 | 
					 | 
				
			||||||
            'var1' => 'one',
 | 
					 | 
				
			||||||
            'var3' => 'three'
 | 
					 | 
				
			||||||
        ));
 | 
					 | 
				
			||||||
        for ($i = 0; $i < 3; $i++) {
 | 
					 | 
				
			||||||
            $this->tpl->setVariable('var4', $i + 1);
 | 
					 | 
				
			||||||
            $this->tpl->parse('block_four');
 | 
					 | 
				
			||||||
        } // for
 | 
					 | 
				
			||||||
        $this->assertEquals('glob:one#glob:three|glob:1|glob:2|glob:3#', $this->_stripWhitespace($this->tpl->get()));
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
	*/
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Test for bug #9501. preg_replace treat $<NUM> and \<NUM> as
 | 
					     * Test for bug #9501. preg_replace treat $<NUM> and \<NUM> as
 | 
				
			||||||
     * backreferences. IT escapes them.
 | 
					     * backreferences. IT escapes them.
 | 
				
			||||||
@@ -1,6 +1,5 @@
 | 
				
			|||||||
<?php
 | 
					<?php
 | 
				
			||||||
require_once 'HTML/Template/ITX.php';
 | 
					require_once 'HTML/Template/ITX.php';
 | 
				
			||||||
require_once 'PHPUnit/Framework/TestCase.php';
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
require_once 'ITTest.php';
 | 
					require_once 'ITTest.php';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -24,7 +23,7 @@ class Callbacks
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
class ITXTest extends ITTest
 | 
					class ITXTest extends ITTest
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    function setUp()
 | 
					    function set_up()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $this->tpl = new HTML_Template_ITX(dirname(__FILE__) . '/templates');
 | 
					        $this->tpl = new HTML_Template_ITX(dirname(__FILE__) . '/templates');
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
-----BEGIN PGP SIGNATURE-----
 | 
					-----BEGIN PGP SIGNATURE-----
 | 
				
			||||||
 | 
					
 | 
				
			||||||
iEYEABECAAYFAlpl7wAACgkQcqMhusJF8XUPAgCgkkhDLmcbWpQvpV5aXtWXmSME
 | 
					iF0EABECAB0WIQQQ9oz3P4qkJvYXdSlyoyG6wkXxdQUCZ0NbqAAKCRByoyG6wkXx
 | 
				
			||||||
1eAAoMuMxtygcY5OOoitupbXVn1sDGYF
 | 
					dVaEAKDCvxZ1ZQmbPgqRjUAkC72ylQzpOwCeO5mQBEJ3+ziJdLnBvRv7trd0l68=
 | 
				
			||||||
=tmsd
 | 
					=9MLm
 | 
				
			||||||
-----END PGP SIGNATURE-----
 | 
					-----END PGP SIGNATURE-----
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										47
									
								
								package.xml
									
									
									
									
									
								
							
							
						
						
									
										47
									
								
								package.xml
									
									
									
									
									
								
							@@ -1,5 +1,5 @@
 | 
				
			|||||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
					<?xml version="1.0" encoding="UTF-8"?>
 | 
				
			||||||
<package packagerversion="1.10.5" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd">
 | 
					<package packagerversion="1.10.13" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd">
 | 
				
			||||||
 <name>HTML_Template_IT</name>
 | 
					 <name>HTML_Template_IT</name>
 | 
				
			||||||
 <channel>pear.php.net</channel>
 | 
					 <channel>pear.php.net</channel>
 | 
				
			||||||
 <summary>Integrated Templates</summary>
 | 
					 <summary>Integrated Templates</summary>
 | 
				
			||||||
@@ -36,19 +36,22 @@ There are two classes to use for templating. HTML_Template_IT is used for basic
 | 
				
			|||||||
  <email>ulf.wendel@phpdoc.de</email>
 | 
					  <email>ulf.wendel@phpdoc.de</email>
 | 
				
			||||||
  <active>no</active>
 | 
					  <active>no</active>
 | 
				
			||||||
 </developer>
 | 
					 </developer>
 | 
				
			||||||
 <date>2018-01-22</date>
 | 
					 <date>2024-11-24</date>
 | 
				
			||||||
 <time>14:02:10</time>
 | 
					 <time>16:59:33</time>
 | 
				
			||||||
 <version>
 | 
					 <version>
 | 
				
			||||||
  <release>1.3.1</release>
 | 
					  <release>1.3.2</release>
 | 
				
			||||||
  <api>1.3.0</api>
 | 
					  <api>1.3.0</api>
 | 
				
			||||||
 </version>
 | 
					 </version>
 | 
				
			||||||
 <stability>
 | 
					 <stability>
 | 
				
			||||||
  <release>stable</release>
 | 
					  <release>stable</release>
 | 
				
			||||||
  <api>stable</api>
 | 
					  <api>stable</api>
 | 
				
			||||||
 </stability>
 | 
					 </stability>
 | 
				
			||||||
 <license>Modified BSD license</license>
 | 
					 <license>BSD-3-Clause</license>
 | 
				
			||||||
 <notes>
 | 
					 <notes>
 | 
				
			||||||
- PR #2: Fixes for deprecated code
 | 
					- PR # 5: Support for PHP 7.2
 | 
				
			||||||
 | 
					- PR # 9: Remove unused code
 | 
				
			||||||
 | 
					- PR #11: fix: Array and string offset access syntax with curly braces is no longer supported
 | 
				
			||||||
 | 
					- PR #12: Remove PHP under 5.6 and add last versions of PHP 7
 | 
				
			||||||
 </notes>
 | 
					 </notes>
 | 
				
			||||||
 <contents>
 | 
					 <contents>
 | 
				
			||||||
  <dir name="/">
 | 
					  <dir name="/">
 | 
				
			||||||
@@ -57,18 +60,16 @@ There are two classes to use for templating. HTML_Template_IT is used for basic
 | 
				
			|||||||
   <file md5sum="342278cc5fe8ca6c66591cd5ee389402" name="examples/templates/addblockfile_list.tpl.htm" role="doc" />
 | 
					   <file md5sum="342278cc5fe8ca6c66591cd5ee389402" name="examples/templates/addblockfile_list.tpl.htm" role="doc" />
 | 
				
			||||||
   <file md5sum="697f694a67db6b96d247a24bdfd44f9b" name="examples/templates/addblockfile_main.tpl.htm" role="doc" />
 | 
					   <file md5sum="697f694a67db6b96d247a24bdfd44f9b" name="examples/templates/addblockfile_main.tpl.htm" role="doc" />
 | 
				
			||||||
   <file md5sum="834e1e6d40b2f34906aa17f9969bd891" name="examples/templates/main.tpl.htm" role="doc" />
 | 
					   <file md5sum="834e1e6d40b2f34906aa17f9969bd891" name="examples/templates/main.tpl.htm" role="doc" />
 | 
				
			||||||
   <file md5sum="ff54f9a70504c2c64f81b9d4e1897c3b" name="HTML/Template/IT.php" role="php" />
 | 
					   <file md5sum="531abbcc1ca42d2bd330b7f82851a06f" name="HTML/Template/IT.php" role="php" />
 | 
				
			||||||
   <file md5sum="226a20af0aa45c0838863f73103b91af" name="HTML/Template/ITX.php" role="php" />
 | 
					   <file md5sum="aa98c643aac5305b888851bdb7bf494d" name="HTML/Template/ITX.php" role="php" />
 | 
				
			||||||
   <file md5sum="52a5e675aec5f68c4c3111a17307a860" name="HTML/Template/IT_Error.php" role="php" />
 | 
					   <file md5sum="806ee7726ac7fdf74ce13a610fb30ddc" name="HTML/Template/IT_Error.php" role="php" />
 | 
				
			||||||
   <file md5sum="e576a94c06b323e4cfc6bcf9dda017c2" name="tests/AllTests.php" role="test" />
 | 
					   <file md5sum="304e1a435c31469840de4dc77dfaa2d5" name="tests/ITTest.php" role="test" />
 | 
				
			||||||
   <file md5sum="a12627343ed2962dc629181dd4fa1994" name="tests/ITTest.php" role="test" />
 | 
					   <file md5sum="0f23dcc3d5992a01f50c75e05c70080a" name="tests/ITXTest.php" role="test" />
 | 
				
			||||||
   <file md5sum="e0d736f03900f6fc9e6132c7549a96b8" name="tests/ITXTest.php" role="test" />
 | 
					 | 
				
			||||||
   <file md5sum="bca97392b741f553d10203f04549a423" name="tests/templates/addblock.html" role="test" />
 | 
					   <file md5sum="bca97392b741f553d10203f04549a423" name="tests/templates/addblock.html" role="test" />
 | 
				
			||||||
   <file md5sum="d4e1caf0b07b85e49e0e82ab83e91ed3" name="tests/templates/blockiteration.html" role="test" />
 | 
					   <file md5sum="d4e1caf0b07b85e49e0e82ab83e91ed3" name="tests/templates/blockiteration.html" role="test" />
 | 
				
			||||||
   <file md5sum="aa11dc0ba8c94c71f0ed6e448770f913" name="tests/templates/blocks.html" role="test" />
 | 
					   <file md5sum="aa11dc0ba8c94c71f0ed6e448770f913" name="tests/templates/blocks.html" role="test" />
 | 
				
			||||||
   <file md5sum="7014497a69b346957fb3d2b5fa44ffd4" name="tests/templates/bug_9853_01.tpl" role="test" />
 | 
					   <file md5sum="7014497a69b346957fb3d2b5fa44ffd4" name="tests/templates/bug_9853_01.tpl" role="test" />
 | 
				
			||||||
   <file md5sum="385013ff6be875da2888087e96c6a93c" name="tests/templates/bug_9853_02.tpl" role="test" />
 | 
					   <file md5sum="385013ff6be875da2888087e96c6a93c" name="tests/templates/bug_9853_02.tpl" role="test" />
 | 
				
			||||||
   <file md5sum="ed6cb6de29d69890c611f11ce90e1e85" name="tests/templates/globals.html" role="test" />
 | 
					 | 
				
			||||||
   <file md5sum="8ac12c5d1c85787dd44ed5c93a392dfe" name="tests/templates/include.html" role="test" />
 | 
					   <file md5sum="8ac12c5d1c85787dd44ed5c93a392dfe" name="tests/templates/include.html" role="test" />
 | 
				
			||||||
   <file md5sum="bd4c99366021b8bd88ba220ec829eae5" name="tests/templates/loadtemplatefile.html" role="test" />
 | 
					   <file md5sum="bd4c99366021b8bd88ba220ec829eae5" name="tests/templates/loadtemplatefile.html" role="test" />
 | 
				
			||||||
   <file md5sum="8747e8c70d20b6c86d1d19af2eadd874" name="tests/templates/placeholderreplacementscope.html" role="test" />
 | 
					   <file md5sum="8747e8c70d20b6c86d1d19af2eadd874" name="tests/templates/placeholderreplacementscope.html" role="test" />
 | 
				
			||||||
@@ -325,10 +326,28 @@ Changes since last stable release (1.2.1):
 | 
				
			|||||||
    <api>stable</api>
 | 
					    <api>stable</api>
 | 
				
			||||||
   </stability>
 | 
					   </stability>
 | 
				
			||||||
   <date>2018-01-22</date>
 | 
					   <date>2018-01-22</date>
 | 
				
			||||||
   <license>Modified BSD license</license>
 | 
					   <license>BSD-3-Clause</license>
 | 
				
			||||||
   <notes>
 | 
					   <notes>
 | 
				
			||||||
- PR #2: Fixes for deprecated code
 | 
					- PR #2: Fixes for deprecated code
 | 
				
			||||||
   </notes>
 | 
					   </notes>
 | 
				
			||||||
  </release>
 | 
					  </release>
 | 
				
			||||||
 | 
					  <release>
 | 
				
			||||||
 | 
					   <version>
 | 
				
			||||||
 | 
					    <release>1.3.2</release>
 | 
				
			||||||
 | 
					    <api>1.3.0</api>
 | 
				
			||||||
 | 
					   </version>
 | 
				
			||||||
 | 
					   <stability>
 | 
				
			||||||
 | 
					    <release>stable</release>
 | 
				
			||||||
 | 
					    <api>stable</api>
 | 
				
			||||||
 | 
					   </stability>
 | 
				
			||||||
 | 
					   <date>2024-11-24</date>
 | 
				
			||||||
 | 
					   <license>BSD-3-Clause</license>
 | 
				
			||||||
 | 
					   <notes>
 | 
				
			||||||
 | 
					- PR  #5: Support for PHP 7.2
 | 
				
			||||||
 | 
					- PR  #9: Remove unused code
 | 
				
			||||||
 | 
					- PR #11: fix: Array and string offset access syntax with curly braces is no longer supported
 | 
				
			||||||
 | 
					- PR #12: Remove PHP under 5.6 and add last versions of PHP 7
 | 
				
			||||||
 | 
					   </notes>
 | 
				
			||||||
 | 
					  </release>
 | 
				
			||||||
 </changelog>
 | 
					 </changelog>
 | 
				
			||||||
</package>
 | 
					</package>
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user