@@ -966,10 +966,10 @@ discard block |
||
966 | 966 | */ |
967 | 967 | public function getFunctionName() |
968 | 968 | { |
969 | - // function name is used as base for caching, so it must be unique for |
|
970 | - // every combination of settings that changes code in compiled template |
|
969 | + // function name is used as base for caching, so it must be unique for |
|
970 | + // every combination of settings that changes code in compiled template |
|
971 | 971 | |
972 | - if (!$this->_functionName) { |
|
972 | + if (!$this->_functionName) { |
|
973 | 973 | |
974 | 974 | // just to make tempalte name recognizable |
975 | 975 | $basename = preg_replace('/\.[a-z]{3,5}$/', '', basename($this->_source->getRealPath())); |
@@ -989,7 +989,7 @@ discard block |
||
989 | 989 | $hash = strtr(rtrim(base64_encode($hash),"="),"+/=","_A_"); |
990 | 990 | |
991 | 991 | $this->_functionName = $this->getFunctionNamePrefix($this->_source->getLastModifiedTime()) . |
992 | - $basename . '__' . $hash; |
|
992 | + $basename . '__' . $hash; |
|
993 | 993 | } |
994 | 994 | return $this->_functionName; |
995 | 995 | } |
@@ -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) |
@@ -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,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 | /** |
16 | 16 | * Base class for prefilters. |
@@ -1,28 +1,28 @@ |
||
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 | - * Stores XMLNS aliases fluctuation in the xml flow. |
|
17 | - * |
|
18 | - * This class is used to bind a PHPTAL namespace to an alias, for example using |
|
19 | - * xmlns:t="http://xml.zope.org/namespaces/tal" and later use t:repeat instead |
|
20 | - * of tal:repeat. |
|
21 | - * |
|
22 | - * @package PHPTAL |
|
23 | - * @subpackage Dom |
|
24 | - * @author Laurent Bedubourg <[email protected]> |
|
25 | - */ |
|
16 | + * Stores XMLNS aliases fluctuation in the xml flow. |
|
17 | + * |
|
18 | + * This class is used to bind a PHPTAL namespace to an alias, for example using |
|
19 | + * xmlns:t="http://xml.zope.org/namespaces/tal" and later use t:repeat instead |
|
20 | + * of tal:repeat. |
|
21 | + * |
|
22 | + * @package PHPTAL |
|
23 | + * @subpackage Dom |
|
24 | + * @author Laurent Bedubourg <[email protected]> |
|
25 | + */ |
|
26 | 26 | class PHPTAL_Dom_XmlnsState |
27 | 27 | { |
28 | 28 | /** Create a new XMLNS state inheriting provided aliases. */ |
@@ -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 Andrew Crites <[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 Andrew Crites <[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 | /** |
@@ -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 |