uw Thu Jan 18 12:52:33 2001 EDT
Modified files:
/php4/pear/HTML ITX.php
Log:
Current version from the PHPLib CVS. Converted Tabs to spaces.
Error handling must be pearified.
Index: php4/pear/HTML/ITX.php
diff -u php4/pear/HTML/ITX.php:1.1 php4/pear/HTML/ITX.php:1.2
--- php4/pear/HTML/ITX.php:1.1 Wed Jan 17 08:15:17 2001
+++ php4/pear/HTML/ITX.php Thu Jan 18 12:52:33 2001
@@ -13,14 +13,11 @@
// | obtain it through the world-wide-web, please send a note to |
// | [EMAIL PROTECTED] so we can mail you a copy immediately. |
// +--+
-// | Authors: Ulf Wendel [EMAIL PROTECTED] |
+// | Authors: Ulf Wendel [EMAIL PROTECTED] |
// +--+
//
-// $Id: ITX.php,v 1.1 2001/01/17 16:15:17 sbergmann Exp $
+// $Id: ITX.php,v 1.2 2001/01/18 20:52:33 uw Exp $
//
-
-require_once "HTML/IT.php";
-
/**
* Integrated Template Extension - ITX
*
@@ -33,283 +30,627 @@
* Note that you can replace an existing block and add new blocks add runtime.
* Adding new blocks means changing a variable placeholder to a block.
*
-* @author Ulf Wendel [EMAIL PROTECTED]
-* @access public
-* @version $ID: $
-* @package PHPDoc
+* @author Ulf Wendel [EMAIL PROTECTED]
+* @accesspublic
+* @version $Id: ITX.php,v 1.2 2001/01/18 20:52:33 uw Exp $
*/
class IntegratedTemplateExtension extends IntegratedTemplate {
+
+/**
+* Array with all warnings.
+* @var array
+* @accesspublic
+* @see $printWarning, $haltOnWarning, warning()
+*/
+var $warn = array();
+
+/**
+* Print warnings?
+* @var array
+* @accesspublic
+* @see $haltOnWarning, $warn, warning()
+*/
+var $printWarning = false;
+
+/**
+* Call die() on warning?
+* @var boolean
+* @accesspublic
+* @see $warn, $printWarning, warning()
+*/
+var $haltOnWarning = false;
+
+/**
+* RegExp used to test for a valid blockname.
+* @varstring
+*/
+var $checkblocknameRegExp = "";
+
+/**
+* Functionnameprefix used when searching function calls in the template.
+* @varstring
+*/
+var $functionPrefix = "func_";
+
+/**
+* Functionname RegExp.
+* @varstring
+*/
+var $functionnameRegExp = "[_a-zA-Z]+[A-Za-z_0-9]*";
+
+/**
+* RegExp used to grep function calls in the template.
+*
+* The variable gets set by the constructor.
+*
+* @varstring
+* @seeIntegratedTemplateExtension()
+*/
+var $functionRegExp = "";
+
+/**
+* List of functions found in the template.
+*
+* @vararray
+*/
+var $functions = array();
+
+/**
+* List of callback functions specified by the user.
+*
+* @vararray
+*/
+var $callback = array();
+
+/**
+* Builds some complex regexps and calls the constructor of the parent class.
+*
+* Make sure that you call this constructor if you derive you own
+* template class from this one.
+*
+* @seeIntegratedTemplate()
+*/
+function IntegratedTemplateExtension($root = "") {
+
+$this-checkblocknameRegExp = "@" . $this-blocknameRegExp . "@";
+$this-functionRegExp = "@" . $this-functionPrefix . "(" .
+$this-functionnameRegExp . ")\s*\(@sm";
+
+$this-IntegratedTemplate($root);
+
+
+} // end func constructor
+
+function init() {
+
+$this-free();
+$this-buildFunctionlist();
+$this-findBlocks($this-template);
+$this-buildBlockvariablelist();
+
+} // end func init
+
+
+/**
+* Replaces an existing block with new content. Warning: not implemented yet.
+*
+* The Replacement does not affect previously added variables. All data is cached.
+* In case the new block does contain less or other variable placeholder the
+previously
+* passed data that is no longer referenced will be deleted. The internal list
+* of allowed variables gets updated as well.
+*
+* In case the original block contains other blocks it must eighter have
+placeholder
+* for the inner blocks or contain them. If you want to use placeholder the
+placeholder must
+* look like openingDelimiter."__".blockname."__".closingDelimiter .
+*
+* Due to the cache updates replaceBlock() and replaceBlockfile() are "expensive"
+operations
+* which means extensive usage will slow down your script. So try to avoid them
+and if
+* you can't do so try to use them before you pass lots of variables to the block