cvs: pear /HTML_TINX TINX.php
| From: | Sebastian Bergmann | Date: | Wed, 16 Jan 2002 13:57:07 +0000 |
| Subject: | cvs: pear /HTML_TINX TINX.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-1976@lists.php.net to get a copy of this message | ||
sebastian Wed Jan 16 08:57:07 2002 EDT
Modified files:
/pear/HTML_TINX TINX.php
Log:
Some maintainance work.
Index: pear/HTML_TINX/TINX.php
diff -u pear/HTML_TINX/TINX.php:1.6 pear/HTML_TINX/TINX.php:1.7
--- pear/HTML_TINX/TINX.php:1.6 Tue Jan 8 13:11:54 2002
+++ pear/HTML_TINX/TINX.php Wed Jan 16 08:57:07 2002
@@ -16,18 +16,14 @@
// | Author: Sebastian Bergmann <sb@sebastian-bergmann.de> |
// +----------------------------------------------------------------------+
//
-// $Id: TINX.php,v 1.6 2002/01/08 18:11:54 sebastian Exp $
+// $Id: TINX.php,v 1.7 2002/01/16 13:57:07 sebastian Exp $
//
/**
* TINX - This Is Not XSP
*
-* TINX is a small template engine that offers tag-triggered function
-* calls, similar to the concept of Apache Cocoon's XSP.
-*
-* You can assign standard template variables, let TINX fill in
-* template variables with global variables and call PHP functions
-* through <?php: ... /> tags.
+* TINX allows for tag-triggered function / method calls. The syntax is
+* similar to the one of Apache Cocoon's XSP, hence the name.
*
* Example
*
@@ -59,7 +55,7 @@
* <foobar>foobar(value1, value2) called.</foobar>
*
* @author Sebastian Bergmann <sb@sebastian-bergmann.de>
-* @version $Revision: 1.6 $
+* @version $Revision: 1.7 $
* @access public
*/
@@ -90,16 +86,16 @@
* @access private
*/
- var $_template_variable_delimiters;
+ var $_delimiters;
/**
* @var boolean
* @access private
*/
- var $_execute_tag_logic;
+ var $_execute_tags;
- // {{{ function HTML_TINX($file = '', $execute_tag_logic = false,
$template_variable_delimiters = array('{', '}')) {
+ // {{{ function HTML_TINX($file = '', $execute_tags = false, $delimiters =
array('{', '}'))
/**
* Constructor
@@ -111,10 +107,10 @@
* @access public
*/
- function HTML_TINX($file = '', $execute_tag_logic = false,
$template_variable_delimiters = array('{', '}')) {
+ function HTML_TINX($file = '', $execute_tags = false, $delimiters =
array('{', '}')) {
+ $this->setDelimiters($delimiters);
+ $this->setExecuteTags($execute_tags);
$this->setFile($file);
- $this->setParseParameters($execute_tag_logic);
- $this->setTemplateVariableDelimiters($template_variable_delimiters);
}
// }}}
@@ -136,7 +132,7 @@
}
// }}}
- // {{{ function setTemplateVariableDelimiters($start, $end = '')
+ // {{{ function setDelimiters($start, $end = '')
/**
* Set template variable delimiters.
@@ -146,29 +142,29 @@
* @access public
*/
- function setTemplateVariableDelimiters($start, $end = '') {
+ function setDelimiters($start, $end = '') {
if (is_string($start) && is_string($end) && sizeof($end)) {
- $this->_template_variable_delimiters = array($start, $end);
+ $this->_delimiters = array($start, $end);
}
else if (is_array($start)) {
- $this->_template_variable_delimiters = $start;
+ $this->_delimiters = $start;
}
}
// }}}
- // {{{ function setParseParameters($execute_tag_logic)
+ // {{{ function setExecuteTags($execute_tags)
/**
- *
+ * Enable/disable execution of tag-triggered
+ * function/method calls.
*
* @param boolean
- * @param boolean
* @access public
*/
- function setParseParameters($execute_tag_logic) {
- $this->_execute_tag_logic = $execute_tag_logic;
+ function setExecuteTags($execute_tags) {
+ $this->execute_tags = $execute_tags;
}
// }}}
@@ -185,16 +181,16 @@
function setVar($keys, $values) {
if (is_array($keys) && is_array($values) && sizeof($keys) ==
sizeof($values)) {
foreach ($keys as $key) {
- $this->_keys[] = $this->_template_variable_delimiters[0] .
+ $this->_keys[] = $this->_delimiters[0] .
$key .
- $this->_template_variable_delimiters[1];
+ $this->_delimiters[1];
}
$this->_values = array_merge($this->_values, $values);
} else {
- $this->_keys[] = $this->_template_variable_delimiters[0] .
+ $this->_keys[] = $this->_delimiters[0] .
$keys .
- $this->_template_variable_delimiters[1];
+ $this->_delimiters[1];
$this->_values[] = $values;
}
}
@@ -220,7 +216,7 @@
// <php:foo->bar parameters="param1,param2" />
// <php:foobar parameters="param1,param2" />
- if ($this->_execute_tag_logic) {
+ if ($this->_execute_tags) {
preg_match_all('/\<php:([^>]+)\/\>/im',
$this->_template,
$processing_instructions