@@ -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 |
@@ -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,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,22 +1,22 @@ |
||
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 | - * Fake template source that makes PHPTAL->setString() work |
|
17 | - * |
|
18 | - * @package PHPTAL |
|
19 | - */ |
|
16 | + * Fake template source that makes PHPTAL->setString() work |
|
17 | + * |
|
18 | + * @package PHPTAL |
|
19 | + */ |
|
20 | 20 | class PHPTAL_StringSource implements PHPTAL_Source |
21 | 21 | { |
22 | 22 | const NO_PATH_PREFIX = '<string '; |
@@ -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,22 +1,22 @@ |
||
1 | 1 | #!/usr/bin/env php |
2 | 2 | <?php |
3 | 3 | /** |
4 | - * This is lint tool for checking corectness of template syntax. |
|
5 | - * |
|
6 | - * You can run it on all your templates after upgrade of PHPTAL to check |
|
7 | - * for potential incompatibilities. |
|
8 | - * |
|
9 | - * Another good idea is to use it as SVN hook to ensure that you |
|
10 | - * commit only good templates to your repository. |
|
11 | - * |
|
12 | - * See more: |
|
13 | - * http://phptal.org/wiki/doku.php/lint |
|
14 | - * |
|
15 | - * or run |
|
16 | - * |
|
17 | - * ./phptal_lint.php -h |
|
18 | - * |
|
19 | - */ |
|
4 | + * This is lint tool for checking corectness of template syntax. |
|
5 | + * |
|
6 | + * You can run it on all your templates after upgrade of PHPTAL to check |
|
7 | + * for potential incompatibilities. |
|
8 | + * |
|
9 | + * Another good idea is to use it as SVN hook to ensure that you |
|
10 | + * commit only good templates to your repository. |
|
11 | + * |
|
12 | + * See more: |
|
13 | + * http://phptal.org/wiki/doku.php/lint |
|
14 | + * |
|
15 | + * or run |
|
16 | + * |
|
17 | + * ./phptal_lint.php -h |
|
18 | + * |
|
19 | + */ |
|
20 | 20 | |
21 | 21 | $lint = new PHPTAL_Lint_CLI(); |
22 | 22 | $lint->main(); |