@@ -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,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,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. */ |
@@ -76,7 +76,7 @@ |
||
| 76 | 76 | $prefix_to_uri[$prefix] = $value; |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - if ($qname == 'xmlns') {$changed=true;$current_default = $value;} |
|
| 79 | + if ($qname == 'xmlns') {$changed = true; $current_default = $value; } |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | if ($changed) { |
@@ -34,8 +34,12 @@ |
||
| 34 | 34 | |
| 35 | 35 | public function prefixToNamespaceURI($prefix) |
| 36 | 36 | { |
| 37 | - if ($prefix === 'xmlns') return 'http://www.w3.org/2000/xmlns/'; |
|
| 38 | - if ($prefix === 'xml') return 'http://www.w3.org/XML/1998/namespace'; |
|
| 37 | + if ($prefix === 'xmlns') { |
|
| 38 | + return 'http://www.w3.org/2000/xmlns/'; |
|
| 39 | + } |
|
| 40 | + if ($prefix === 'xml') { |
|
| 41 | + return 'http://www.w3.org/XML/1998/namespace'; |
|
| 42 | + } |
|
| 39 | 43 | |
| 40 | 44 | // domdefs provides fallback for all known phptal ns |
| 41 | 45 | if (isset($this->prefix_to_uri[$prefix])) { |
@@ -34,10 +34,12 @@ |
||
| 34 | 34 | $codewriter->pushHTML($codewriter->interpolateCDATA(str_replace('</', '<\/', $value))); |
| 35 | 35 | } elseif (($mode === PHPTAL::XHTML && $inCDATAelement) // safe for text/html |
| 36 | 36 | || ($mode === PHPTAL::XML && preg_match('/[<>&]/', $value)) // non-useless in XML |
| 37 | - || ($mode !== PHPTAL::HTML5 && preg_match('/<\?|\${structure/', $value))) // hacks with structure (in X[HT]ML) may need it |
|
| 37 | + || ($mode !== PHPTAL::HTML5 && preg_match('/<\?|\${structure/', $value))) { |
|
| 38 | + // hacks with structure (in X[HT]ML) may need it |
|
| 38 | 39 | { |
| 39 | 40 | // in text/html "</" is dangerous and the only sensible way to escape is ECMAScript string escapes. |
| 40 | 41 | if ($mode === PHPTAL::XHTML) $value = str_replace('</', '<\/', $value); |
| 42 | + } |
|
| 41 | 43 | |
| 42 | 44 | $codewriter->pushHTML($codewriter->interpolateCDATA('<![CDATA['.$value.']]>')); |
| 43 | 45 | } else { |
@@ -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 |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | */ |
| 22 | 22 | abstract class PHPTAL_Dom_DocumentBuilder |
| 23 | 23 | { |
| 24 | - protected $_stack; /* array<PHPTAL_Dom_Node> */ |
|
| 24 | + protected $_stack; /* array<PHPTAL_Dom_Node> */ |
|
| 25 | 25 | protected $_current; /* PHPTAL_Dom_Node */ |
| 26 | 26 | |
| 27 | 27 | protected $file, $line; |
@@ -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 |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | */ |
| 23 | 23 | class PHPTAL_Dom_PHPTALDocumentBuilder extends PHPTAL_Dom_DocumentBuilder |
| 24 | 24 | { |
| 25 | - private $_xmlns; /* PHPTAL_Dom_XmlnsState */ |
|
| 25 | + private $_xmlns; /* PHPTAL_Dom_XmlnsState */ |
|
| 26 | 26 | private $encoding; |
| 27 | 27 | |
| 28 | 28 | public function __construct() |
@@ -52,8 +52,8 @@ discard block |
||
| 52 | 52 | public function onDocumentEnd() |
| 53 | 53 | { |
| 54 | 54 | if (count($this->_stack) > 0) { |
| 55 | - $left='</'.$this->_current->getQualifiedName().'>'; |
|
| 56 | - for ($i = count($this->_stack)-1; $i>0; $i--) $left .= '</'.$this->_stack[$i]->getQualifiedName().'>'; |
|
| 55 | + $left = '</'.$this->_current->getQualifiedName().'>'; |
|
| 56 | + for ($i = count($this->_stack)-1; $i > 0; $i--) $left .= '</'.$this->_stack[$i]->getQualifiedName().'>'; |
|
| 57 | 57 | throw new PHPTAL_ParserException("Not all elements were closed before end of the document. Missing: ".$left, |
| 58 | 58 | $this->file, $this->line); |
| 59 | 59 | } |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | |
| 130 | 130 | $node = new PHPTAL_Dom_Element($element_qname, $namespace_uri, $attrnodes, $this->getXmlnsState()); |
| 131 | 131 | $this->pushNode($node); |
| 132 | - $this->_stack[] = $this->_current; |
|
| 132 | + $this->_stack[] = $this->_current; |
|
| 133 | 133 | $this->_current = $node; |
| 134 | 134 | } |
| 135 | 135 | |
@@ -53,7 +53,9 @@ |
||
| 53 | 53 | { |
| 54 | 54 | if (count($this->_stack) > 0) { |
| 55 | 55 | $left='</'.$this->_current->getQualifiedName().'>'; |
| 56 | - for ($i = count($this->_stack)-1; $i>0; $i--) $left .= '</'.$this->_stack[$i]->getQualifiedName().'>'; |
|
| 56 | + for ($i = count($this->_stack)-1; $i>0; $i--) { |
|
| 57 | + $left .= '</'.$this->_stack[$i]->getQualifiedName().'>'; |
|
| 58 | + } |
|
| 57 | 59 | throw new PHPTAL_ParserException("Not all elements were closed before end of the document. Missing: ".$left, |
| 58 | 60 | $this->file, $this->line); |
| 59 | 61 | } |
@@ -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 | /** |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | * |
| 104 | 104 | * Encoding must be set before calling addDomain! |
| 105 | 105 | */ |
| 106 | - public function addDomain($domain, $path='./locale/') |
|
| 106 | + public function addDomain($domain, $path = './locale/') |
|
| 107 | 107 | { |
| 108 | 108 | bindtextdomain($domain, $path); |
| 109 | 109 | if ($this->_encoding) { |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | * |
| 141 | 141 | * @param bool $htmlencode if true, output will be HTML-escaped. |
| 142 | 142 | */ |
| 143 | - public function translate($key, $htmlencode=true) |
|
| 143 | + public function translate($key, $htmlencode = true) |
|
| 144 | 144 | { |
| 145 | 145 | if ($this->_canonicalize) $key = self::_canonicalizeKey($key); |
| 146 | 146 | |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | $key_ = trim($key_); |
| 169 | 169 | $key_ = str_replace("\n", "", $key_); |
| 170 | 170 | $key_ = str_replace("\r", "", $key_); |
| 171 | - for ($i = 0; $i<strlen($key_); $i++) { |
|
| 171 | + for ($i = 0; $i < strlen($key_); $i++) { |
|
| 172 | 172 | $c = $key_[$i]; |
| 173 | 173 | $o = ord($c); |
| 174 | 174 | if ($o < 5 || $o > 127) { |
@@ -34,7 +34,9 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | public function __construct() |
| 36 | 36 | { |
| 37 | - if (!function_exists('gettext')) throw new PHPTAL_ConfigurationException("Gettext not installed"); |
|
| 37 | + if (!function_exists('gettext')) { |
|
| 38 | + throw new PHPTAL_ConfigurationException("Gettext not installed"); |
|
| 39 | + } |
|
| 38 | 40 | $this->useDomain("messages"); // PHP bug #21965 |
| 39 | 41 | } |
| 40 | 42 | |
@@ -75,11 +77,15 @@ discard block |
||
| 75 | 77 | $langs = func_get_args(); |
| 76 | 78 | |
| 77 | 79 | $langCode = $this->trySettingLanguages(LC_ALL, $langs); |
| 78 | - if ($langCode) return $langCode; |
|
| 80 | + if ($langCode) { |
|
| 81 | + return $langCode; |
|
| 82 | + } |
|
| 79 | 83 | |
| 80 | 84 | if (defined("LC_MESSAGES")) { |
| 81 | 85 | $langCode = $this->trySettingLanguages(LC_MESSAGES, $langs); |
| 82 | - if ($langCode) return $langCode; |
|
| 86 | + if ($langCode) { |
|
| 87 | + return $langCode; |
|
| 88 | + } |
|
| 83 | 89 | } |
| 84 | 90 | |
| 85 | 91 | throw new PHPTAL_ConfigurationException('Language(s) code(s) "'.implode(', ', $langs).'" not supported by your system'); |
@@ -142,7 +148,9 @@ discard block |
||
| 142 | 148 | */ |
| 143 | 149 | public function translate($key, $htmlencode=true) |
| 144 | 150 | { |
| 145 | - if ($this->_canonicalize) $key = self::_canonicalizeKey($key); |
|
| 151 | + if ($this->_canonicalize) { |
|
| 152 | + $key = self::_canonicalizeKey($key); |
|
| 153 | + } |
|
| 146 | 154 | |
| 147 | 155 | $value = gettext($key); |
| 148 | 156 | |
@@ -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 |