@@ -52,14 +52,14 @@ |
||
| 52 | 52 | |
| 53 | 53 | $macroname = strtr($this->expression, '-', '_'); |
| 54 | 54 | |
| 55 | - // throw error if attempting to define and use macro at same time |
|
| 56 | - // [should perhaps be a TemplateException? but I don't know how to set that up...] |
|
| 57 | - if ($defineAttr = $this->phpelement->getAttributeNodeNS( |
|
| 58 | - 'http://xml.zope.org/namespaces/metal', 'define-macro')) { |
|
| 59 | - if ($defineAttr->getValue() == $macroname) |
|
| 60 | - throw new PHPTAL_TemplateException("Cannot simultaneously define and use macro '$macroname'", |
|
| 61 | - $this->phpelement->getSourceFile(), $this->phpelement->getSourceLine()); |
|
| 62 | - } |
|
| 55 | + // throw error if attempting to define and use macro at same time |
|
| 56 | + // [should perhaps be a TemplateException? but I don't know how to set that up...] |
|
| 57 | + if ($defineAttr = $this->phpelement->getAttributeNodeNS( |
|
| 58 | + 'http://xml.zope.org/namespaces/metal', 'define-macro')) { |
|
| 59 | + if ($defineAttr->getValue() == $macroname) |
|
| 60 | + throw new PHPTAL_TemplateException("Cannot simultaneously define and use macro '$macroname'", |
|
| 61 | + $this->phpelement->getSourceFile(), $this->phpelement->getSourceLine()); |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | 64 | // local macro (no filename specified) and non dynamic macro name |
| 65 | 65 | // can be called directly if it's a known function (just generated or seen in previous compilation) |
@@ -67,12 +67,12 @@ |
||
| 67 | 67 | } elseif ($cache_per_expression == 'nothing') { |
| 68 | 68 | /* do nothing */ |
| 69 | 69 | } elseif ($cache_per_expression) { |
| 70 | - $code = $codewriter->evaluateExpression($cache_per_expression); |
|
| 70 | + $code = $codewriter->evaluateExpression($cache_per_expression); |
|
| 71 | 71 | |
| 72 | - if (is_array($code)) throw new PHPTAL_ParserException("Chained expressions in per-cache directive are not supported", |
|
| 72 | + if (is_array($code)) throw new PHPTAL_ParserException("Chained expressions in per-cache directive are not supported", |
|
| 73 | 73 | $this->phpelement->getSourceFile(), $this->phpelement->getSourceLine()); |
| 74 | 74 | |
| 75 | - $cache_tag = '('.$code.')."@".' . $cache_tag; |
|
| 75 | + $cache_tag = '('.$code.')."@".' . $cache_tag; |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | $this->cache_filename_var = $codewriter->createTempVariable(); |
@@ -1,17 +1,17 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * PHPTAL templating engine |
|
| 4 | - * |
|
| 5 | - * PHP Version 5 |
|
| 6 | - * |
|
| 7 | - * @category HTML |
|
| 8 | - * @package PHPTAL |
|
| 9 | - * @author Laurent Bedubourg <[email protected]> |
|
| 10 | - * @author Kornel Lesiński <[email protected]> |
|
| 11 | - * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License |
|
| 12 | - * @version SVN: $Id$ |
|
| 13 | - * @link http://phptal.org/ |
|
| 14 | - */ |
|
| 3 | + * PHPTAL templating engine |
|
| 4 | + * |
|
| 5 | + * PHP Version 5 |
|
| 6 | + * |
|
| 7 | + * @category HTML |
|
| 8 | + * @package PHPTAL |
|
| 9 | + * @author Laurent Bedubourg <[email protected]> |
|
| 10 | + * @author Kornel Lesiński <[email protected]> |
|
| 11 | + * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License |
|
| 12 | + * @version SVN: $Id$ |
|
| 13 | + * @link http://phptal.org/ |
|
| 14 | + */ |
|
| 15 | 15 | |
| 16 | 16 | |
| 17 | 17 | /** |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | public function interpolateTalesVarsInHTML($src) |
| 154 | 154 | { |
| 155 | 155 | return preg_replace_callback('/((?:\$\$)*)\$\{(structure |text )?(.*?)\}|((?:\$\$)+)\{/isS', |
| 156 | - array($this,'_interpolateTalesVarsInHTMLCallback'), $src); |
|
| 156 | + array($this,'_interpolateTalesVarsInHTMLCallback'), $src); |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | /** |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | public function interpolateTalesVarsInCDATA($src) |
| 173 | 173 | { |
| 174 | 174 | return preg_replace_callback('/((?:\$\$)*)\$\{(structure |text )?(.*?)\}|((?:\$\$)+)\{/isS', |
| 175 | - array($this,'_interpolateTalesVarsInCDATACallback'), $src); |
|
| 175 | + array($this,'_interpolateTalesVarsInCDATACallback'), $src); |
|
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | /** |
@@ -1,16 +1,16 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * PHPTAL templating engine |
|
| 4 | - * |
|
| 5 | - * PHP Version 5 |
|
| 6 | - * |
|
| 7 | - * @category HTML |
|
| 8 | - * @package PHPTAL |
|
| 9 | - * @author Kornel Lesiński <[email protected]> |
|
| 10 | - * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License |
|
| 11 | - * @version SVN: $Id: $ |
|
| 12 | - * @link http://phptal.org/ |
|
| 13 | - */ |
|
| 3 | + * PHPTAL templating engine |
|
| 4 | + * |
|
| 5 | + * PHP Version 5 |
|
| 6 | + * |
|
| 7 | + * @category HTML |
|
| 8 | + * @package PHPTAL |
|
| 9 | + * @author Kornel Lesiński <[email protected]> |
|
| 10 | + * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License |
|
| 11 | + * @version SVN: $Id: $ |
|
| 12 | + * @link http://phptal.org/ |
|
| 13 | + */ |
|
| 14 | 14 | |
| 15 | 15 | /** |
| 16 | 16 | * Removes all unnecessary whitespace from XHTML documents. |
@@ -172,8 +172,8 @@ discard block |
||
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | if ($element->getNamespaceURI() !== 'http://www.w3.org/1999/xhtml' |
| 175 | - && $element->getNamespaceURI() !== '') { |
|
| 176 | - return false; |
|
| 175 | + && $element->getNamespaceURI() !== '') { |
|
| 176 | + return false; |
|
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | return in_array($element->getLocalName(), self::$breaks_line); |
@@ -189,8 +189,8 @@ discard block |
||
| 189 | 189 | private function isInlineBlock(PHPTAL_Dom_Element $element) |
| 190 | 190 | { |
| 191 | 191 | if ($element->getNamespaceURI() !== 'http://www.w3.org/1999/xhtml' |
| 192 | - && $element->getNamespaceURI() !== '') { |
|
| 193 | - return false; |
|
| 192 | + && $element->getNamespaceURI() !== '') { |
|
| 193 | + return false; |
|
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | return in_array($element->getLocalName(), self::$inline_blocks); |
@@ -209,45 +209,45 @@ discard block |
||
| 209 | 209 | $attrs_by_qname[$attrnode->getQualifiedName()] = $attrnode; |
| 210 | 210 | } |
| 211 | 211 | |
| 212 | - if (count($attrs_by_qname) > 1) { |
|
| 213 | - uksort($attrs_by_qname, array($this, 'compareQNames')); |
|
| 214 | - $element->setAttributeNodes(array_values($attrs_by_qname)); |
|
| 215 | - } |
|
| 212 | + if (count($attrs_by_qname) > 1) { |
|
| 213 | + uksort($attrs_by_qname, array($this, 'compareQNames')); |
|
| 214 | + $element->setAttributeNodes(array_values($attrs_by_qname)); |
|
| 215 | + } |
|
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | /** |
| 219 | - * pre-defined order of attributes roughly by popularity |
|
| 220 | - */ |
|
| 221 | - private static $attributes_order = array( |
|
| 219 | + * pre-defined order of attributes roughly by popularity |
|
| 220 | + */ |
|
| 221 | + private static $attributes_order = array( |
|
| 222 | 222 | 'href','src','class','rel','type','title','width','height','alt','content','name','style','lang','id', |
| 223 | 223 | ); |
| 224 | 224 | |
| 225 | - /** |
|
| 226 | - * compare names according to $attributes_order array. |
|
| 227 | - * Elements that are not in array, are considered greater than all elements in array, |
|
| 228 | - * and are sorted alphabetically. |
|
| 229 | - */ |
|
| 230 | - private static function compareQNames($a, $b) { |
|
| 231 | - $a_index = array_search($a, self::$attributes_order); |
|
| 232 | - $b_index = array_search($b, self::$attributes_order); |
|
| 233 | - |
|
| 234 | - if ($a_index !== false && $b_index !== false) { |
|
| 235 | - return $a_index - $b_index; |
|
| 236 | - } |
|
| 237 | - if ($a_index === false && $b_index === false) { |
|
| 238 | - return strcmp($a, $b); |
|
| 239 | - } |
|
| 240 | - return ($a_index === false) ? 1 : -1; |
|
| 241 | - } |
|
| 225 | + /** |
|
| 226 | + * compare names according to $attributes_order array. |
|
| 227 | + * Elements that are not in array, are considered greater than all elements in array, |
|
| 228 | + * and are sorted alphabetically. |
|
| 229 | + */ |
|
| 230 | + private static function compareQNames($a, $b) { |
|
| 231 | + $a_index = array_search($a, self::$attributes_order); |
|
| 232 | + $b_index = array_search($b, self::$attributes_order); |
|
| 233 | + |
|
| 234 | + if ($a_index !== false && $b_index !== false) { |
|
| 235 | + return $a_index - $b_index; |
|
| 236 | + } |
|
| 237 | + if ($a_index === false && $b_index === false) { |
|
| 238 | + return strcmp($a, $b); |
|
| 239 | + } |
|
| 240 | + return ($a_index === false) ? 1 : -1; |
|
| 241 | + } |
|
| 242 | 242 | |
| 243 | 243 | /** |
| 244 | 244 | * HTML5 doesn't care about boilerplate |
| 245 | 245 | */ |
| 246 | - private function elementSpecificOptimizations(PHPTAL_Dom_Element $element) |
|
| 247 | - { |
|
| 248 | - if ($element->getNamespaceURI() !== 'http://www.w3.org/1999/xhtml' |
|
| 249 | - && $element->getNamespaceURI() !== '') { |
|
| 250 | - return; |
|
| 246 | + private function elementSpecificOptimizations(PHPTAL_Dom_Element $element) |
|
| 247 | + { |
|
| 248 | + if ($element->getNamespaceURI() !== 'http://www.w3.org/1999/xhtml' |
|
| 249 | + && $element->getNamespaceURI() !== '') { |
|
| 250 | + return; |
|
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | if ($this->getPHPTAL()->getOutputMode() !== PHPTAL::HTML5) { |
@@ -255,11 +255,11 @@ discard block |
||
| 255 | 255 | } |
| 256 | 256 | |
| 257 | 257 | // <meta charset> |
| 258 | - if ('meta' === $element->getLocalName() && |
|
| 259 | - $element->getAttributeNS('','http-equiv') === 'Content-Type') { |
|
| 260 | - $element->removeAttributeNS('','http-equiv'); |
|
| 261 | - $element->removeAttributeNS('','content'); |
|
| 262 | - $element->setAttributeNS('','charset',strtolower($this->getPHPTAL()->getEncoding())); |
|
| 258 | + if ('meta' === $element->getLocalName() && |
|
| 259 | + $element->getAttributeNS('','http-equiv') === 'Content-Type') { |
|
| 260 | + $element->removeAttributeNS('','http-equiv'); |
|
| 261 | + $element->removeAttributeNS('','content'); |
|
| 262 | + $element->setAttributeNS('','charset',strtolower($this->getPHPTAL()->getEncoding())); |
|
| 263 | 263 | } |
| 264 | 264 | elseif (('link' === $element->getLocalName() && $element->getAttributeNS('','rel') === 'stylesheet') || |
| 265 | 265 | ('style' === $element->getLocalName())) { |
@@ -1,16 +1,16 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * PHPTAL templating engine |
|
| 4 | - * |
|
| 5 | - * PHP Version 5 |
|
| 6 | - * |
|
| 7 | - * @category HTML |
|
| 8 | - * @package PHPTAL |
|
| 9 | - * @author Kornel Lesiński <[email protected]> |
|
| 10 | - * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License |
|
| 11 | - * @version SVN: $Id:$ |
|
| 12 | - * @link http://phptal.org/ |
|
| 13 | - */ |
|
| 3 | + * PHPTAL templating engine |
|
| 4 | + * |
|
| 5 | + * PHP Version 5 |
|
| 6 | + * |
|
| 7 | + * @category HTML |
|
| 8 | + * @package PHPTAL |
|
| 9 | + * @author Kornel Lesiński <[email protected]> |
|
| 10 | + * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License |
|
| 11 | + * @version SVN: $Id:$ |
|
| 12 | + * @link http://phptal.org/ |
|
| 13 | + */ |
|
| 14 | 14 | |
| 15 | 15 | class PHPTAL_Tokenizer |
| 16 | 16 | { |
@@ -1,17 +1,17 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * PHPTAL templating engine |
|
| 4 | - * |
|
| 5 | - * PHP Version 5 |
|
| 6 | - * |
|
| 7 | - * @category HTML |
|
| 8 | - * @package PHPTAL |
|
| 9 | - * @author Laurent Bedubourg <[email protected]> |
|
| 10 | - * @author Kornel Lesiński <[email protected]> |
|
| 11 | - * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License |
|
| 12 | - * @version SVN: $Id$ |
|
| 13 | - * @link http://phptal.org/ |
|
| 14 | - */ |
|
| 3 | + * PHPTAL templating engine |
|
| 4 | + * |
|
| 5 | + * PHP Version 5 |
|
| 6 | + * |
|
| 7 | + * @category HTML |
|
| 8 | + * @package PHPTAL |
|
| 9 | + * @author Laurent Bedubourg <[email protected]> |
|
| 10 | + * @author Kornel Lesiński <[email protected]> |
|
| 11 | + * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License |
|
| 12 | + * @version SVN: $Id$ |
|
| 13 | + * @link http://phptal.org/ |
|
| 14 | + */ |
|
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | 17 | * You're probably not using PHPTAL class properly |
@@ -1,17 +1,17 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * PHPTAL templating engine |
|
| 4 | - * |
|
| 5 | - * PHP Version 5 |
|
| 6 | - * |
|
| 7 | - * @category HTML |
|
| 8 | - * @package PHPTAL |
|
| 9 | - * @author Laurent Bedubourg <[email protected]> |
|
| 10 | - * @author Kornel Lesiński <[email protected]> |
|
| 11 | - * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License |
|
| 12 | - * @version SVN: $Id$ |
|
| 13 | - * @link http://phptal.org/ |
|
| 14 | - */ |
|
| 3 | + * PHPTAL templating engine |
|
| 4 | + * |
|
| 5 | + * PHP Version 5 |
|
| 6 | + * |
|
| 7 | + * @category HTML |
|
| 8 | + * @package PHPTAL |
|
| 9 | + * @author Laurent Bedubourg <[email protected]> |
|
| 10 | + * @author Kornel Lesiński <[email protected]> |
|
| 11 | + * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License |
|
| 12 | + * @version SVN: $Id$ |
|
| 13 | + * @link http://phptal.org/ |
|
| 14 | + */ |
|
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | 17 | * You're probably not using PHPTAL class properly |
@@ -1,17 +1,17 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * PHPTAL templating engine |
|
| 4 | - * |
|
| 5 | - * PHP Version 5 |
|
| 6 | - * |
|
| 7 | - * @category HTML |
|
| 8 | - * @package PHPTAL |
|
| 9 | - * @author Laurent Bedubourg <[email protected]> |
|
| 10 | - * @author Kornel Lesiński <[email protected]> |
|
| 11 | - * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License |
|
| 12 | - * @version SVN: $Id$ |
|
| 13 | - * @link http://phptal.org/ |
|
| 14 | - */ |
|
| 3 | + * PHPTAL templating engine |
|
| 4 | + * |
|
| 5 | + * PHP Version 5 |
|
| 6 | + * |
|
| 7 | + * @category HTML |
|
| 8 | + * @package PHPTAL |
|
| 9 | + * @author Laurent Bedubourg <[email protected]> |
|
| 10 | + * @author Kornel Lesiński <[email protected]> |
|
| 11 | + * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License |
|
| 12 | + * @version SVN: $Id$ |
|
| 13 | + * @link http://phptal.org/ |
|
| 14 | + */ |
|
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | 17 | * You're probably not using PHPTAL class properly |
@@ -1,17 +1,17 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * PHPTAL templating engine |
|
| 4 | - * |
|
| 5 | - * PHP Version 5 |
|
| 6 | - * |
|
| 7 | - * @category HTML |
|
| 8 | - * @package PHPTAL |
|
| 9 | - * @author Laurent Bedubourg <[email protected]> |
|
| 10 | - * @author Kornel Lesiński <[email protected]> |
|
| 11 | - * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License |
|
| 12 | - * @version SVN: $Id$ |
|
| 13 | - * @link http://phptal.org/ |
|
| 14 | - */ |
|
| 3 | + * PHPTAL templating engine |
|
| 4 | + * |
|
| 5 | + * PHP Version 5 |
|
| 6 | + * |
|
| 7 | + * @category HTML |
|
| 8 | + * @package PHPTAL |
|
| 9 | + * @author Laurent Bedubourg <[email protected]> |
|
| 10 | + * @author Kornel Lesiński <[email protected]> |
|
| 11 | + * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License |
|
| 12 | + * @version SVN: $Id$ |
|
| 13 | + * @link http://phptal.org/ |
|
| 14 | + */ |
|
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | 17 | * You're probably not using PHPTAL class properly |