@@ -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_PreFilter_StripComments extends PHPTAL_PreFilter |
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 | class PHPTAL_Tokenizer |
16 | 16 | { |
@@ -36,7 +36,9 @@ discard block |
||
36 | 36 | |
37 | 37 | function skipSpace() |
38 | 38 | { |
39 | - while ($this->current_token === 'SPACE') $this->nextToken(); |
|
39 | + while ($this->current_token === 'SPACE') { |
|
40 | + $this->nextToken(); |
|
41 | + } |
|
40 | 42 | } |
41 | 43 | |
42 | 44 | function nextToken() |
@@ -47,7 +49,9 @@ discard block |
||
47 | 49 | } |
48 | 50 | |
49 | 51 | //if (!preg_match_all($this->regex, $this->str, $m, PREG_SET_ORDER, $this->offset)) throw new Exception("FAIL {$this->regex} at {$this->offset}"); |
50 | - if (!preg_match($this->regex, $this->str, $m, null, $this->offset)) throw new Exception("FAIL {$this->regex} didn't match '{$this->str}' at {$this->offset}"); |
|
52 | + if (!preg_match($this->regex, $this->str, $m, null, $this->offset)) { |
|
53 | + throw new Exception("FAIL {$this->regex} didn't match '{$this->str}' at {$this->offset}"); |
|
54 | + } |
|
51 | 55 | |
52 | 56 | $this->offset += strlen($m[0]); // in bytes |
53 | 57 |
@@ -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 | /** |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | * @see PHPTAL_Php_TalesInternal::compileToPHPExpressions() |
37 | 37 | * @return string |
38 | 38 | */ |
39 | -function phptal_tale($expression, $nothrow=false) |
|
39 | +function phptal_tale($expression, $nothrow = false) |
|
40 | 40 | { |
41 | 41 | return PHPTAL_Php_TalesInternal::compileToPHPExpression($expression, $nothrow); |
42 | 42 | } |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | * @param bool $nothrow if true, invalid expression will return NULL (at run time) rather than throwing exception |
52 | 52 | * @return string or array |
53 | 53 | */ |
54 | -function phptal_tales($expression, $nothrow=false) |
|
54 | +function phptal_tales($expression, $nothrow = false) |
|
55 | 55 | { |
56 | 56 | return PHPTAL_Php_TalesInternal::compileToPHPExpressions($expression, $nothrow); |
57 | 57 | } |
@@ -58,5 +58,5 @@ |
||
58 | 58 | * @param string $key - translation key, e.g. "hello ${username}!" |
59 | 59 | * @param string $htmlescape - if true, you should HTML-escape translated string. You should never HTML-escape interpolated variables. |
60 | 60 | */ |
61 | - function translate($key, $htmlescape=true); |
|
61 | + function translate($key, $htmlescape = true); |
|
62 | 62 | } |
@@ -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 Laurent Bedubourg <[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 Laurent Bedubourg <[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 | /** |
@@ -29,7 +29,7 @@ |
||
29 | 29 | public function resolve($path) |
30 | 30 | { |
31 | 31 | foreach ($this->_repositories as $repository) { |
32 | - $file = $repository . DIRECTORY_SEPARATOR . $path; |
|
32 | + $file = $repository.DIRECTORY_SEPARATOR.$path; |
|
33 | 33 | if (file_exists($file)) { |
34 | 34 | return new PHPTAL_FileSource($file); |
35 | 35 | } |
@@ -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 | * Exception that is related to location within a template. |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | public $srcLine; |
27 | 27 | private $is_src_accurate; |
28 | 28 | |
29 | - public function __construct($msg, $srcFile='', $srcLine=0) |
|
29 | + public function __construct($msg, $srcFile = '', $srcLine = 0) |
|
30 | 30 | { |
31 | 31 | parent::__construct($msg); |
32 | 32 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | |
41 | 41 | if ($this->is_src_accurate) { |
42 | 42 | $this->file = $this->srcFile; |
43 | - $this->line = (int)$this->srcLine; |
|
43 | + $this->line = (int) $this->srcLine; |
|
44 | 44 | } |
45 | 45 | } |
46 | 46 | |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | |
68 | 68 | if ($this->is_src_accurate) { |
69 | 69 | $this->file = $this->srcFile; |
70 | - $this->line = (int)$this->srcLine; |
|
70 | + $this->line = (int) $this->srcLine; |
|
71 | 71 | } |
72 | 72 | } |
73 | 73 | |
@@ -86,8 +86,8 @@ discard block |
||
86 | 86 | $eval_path = NULL; |
87 | 87 | |
88 | 88 | // searches backtrace to find template file |
89 | - foreach($this->getTrace() as $tr) { |
|
90 | - if (!isset($tr['file'],$tr['line'])) continue; |
|
89 | + foreach ($this->getTrace() as $tr) { |
|
90 | + if (!isset($tr['file'], $tr['line'])) continue; |
|
91 | 91 | |
92 | 92 | if ($this->isTemplatePath($tr['file'])) { |
93 | 93 | return array($tr['file'], $tr['line']); |
@@ -98,13 +98,13 @@ discard block |
||
98 | 98 | if (false !== strpos($tr['file'], 'eval()')) { |
99 | 99 | $eval_line = $tr['line']; |
100 | 100 | } |
101 | - else if ($eval_line && isset($tr['function'],$tr['args'],$tr['args'][0]) && |
|
101 | + else if ($eval_line && isset($tr['function'], $tr['args'], $tr['args'][0]) && |
|
102 | 102 | $this->isTemplatePath("/".$tr['function'].".php") && $tr['args'][0] instanceof PHPTAL) { |
103 | 103 | return array($tr['args'][0]->getCodePath(), $eval_line); |
104 | 104 | } |
105 | 105 | } |
106 | 106 | |
107 | - return array(NULL,NULL); |
|
107 | + return array(NULL, NULL); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | /** |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | $this->srcFile = $this->file; |
120 | 120 | $this->srcLine = $this->line; |
121 | 121 | |
122 | - list($file,$line) = $this->findFileAndLine(); |
|
122 | + list($file, $line) = $this->findFileAndLine(); |
|
123 | 123 | |
124 | 124 | if (NULL === $file) { |
125 | 125 | return false; |
@@ -134,23 +134,23 @@ discard block |
||
134 | 134 | return false; |
135 | 135 | } |
136 | 136 | |
137 | - $found_line=false; |
|
138 | - $found_file=false; |
|
137 | + $found_line = false; |
|
138 | + $found_file = false; |
|
139 | 139 | |
140 | 140 | // scan lines backwards looking for "from line" comments |
141 | 141 | $end = min(count($lines), $line)-1; |
142 | - for($i=$end; $i >= 0; $i--) { |
|
142 | + for ($i = $end; $i >= 0; $i--) { |
|
143 | 143 | if (preg_match('/tag "[^"]*" from line (\d+)/', $lines[$i], $m)) { |
144 | 144 | $this->srcLine = intval($m[1]); |
145 | - $found_line=true; |
|
145 | + $found_line = true; |
|
146 | 146 | break; |
147 | 147 | } |
148 | 148 | } |
149 | 149 | |
150 | - foreach(preg_grep('/Generated by PHPTAL from/',$lines) as $line) { |
|
150 | + foreach (preg_grep('/Generated by PHPTAL from/', $lines) as $line) { |
|
151 | 151 | if (preg_match('/Generated by PHPTAL from (.*) \(/', $line, $m)) { |
152 | 152 | $this->srcFile = $m[1]; |
153 | - $found_file=true; |
|
153 | + $found_file = true; |
|
154 | 154 | break; |
155 | 155 | } |
156 | 156 | } |
@@ -46,7 +46,9 @@ discard block |
||
46 | 46 | |
47 | 47 | public function __toString() |
48 | 48 | { |
49 | - if (!$this->srcFile || $this->is_src_accurate) return parent::__toString(); |
|
49 | + if (!$this->srcFile || $this->is_src_accurate) { |
|
50 | + return parent::__toString(); |
|
51 | + } |
|
50 | 52 | return "From {$this->srcFile} around line {$this->srcLine}\n".parent::__toString(); |
51 | 53 | } |
52 | 54 | |
@@ -87,7 +89,9 @@ discard block |
||
87 | 89 | |
88 | 90 | // searches backtrace to find template file |
89 | 91 | foreach($this->getTrace() as $tr) { |
90 | - if (!isset($tr['file'],$tr['line'])) continue; |
|
92 | + if (!isset($tr['file'],$tr['line'])) { |
|
93 | + continue; |
|
94 | + } |
|
91 | 95 | |
92 | 96 | if ($this->isTemplatePath($tr['file'])) { |
93 | 97 | return array($tr['file'], $tr['line']); |
@@ -97,8 +101,7 @@ discard block |
||
97 | 101 | // However, function name matches template path and eval() is visible in backtrace. |
98 | 102 | if (false !== strpos($tr['file'], 'eval()')) { |
99 | 103 | $eval_line = $tr['line']; |
100 | - } |
|
101 | - else if ($eval_line && isset($tr['function'],$tr['args'],$tr['args'][0]) && |
|
104 | + } else if ($eval_line && isset($tr['function'],$tr['args'],$tr['args'][0]) && |
|
102 | 105 | $this->isTemplatePath("/".$tr['function'].".php") && $tr['args'][0] instanceof PHPTAL) { |
103 | 106 | return array($tr['args'][0]->getCodePath(), $eval_line); |
104 | 107 | } |
@@ -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,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 | * Objects passed to PHPTAL::setPre/PostFilter() must implement this interface |