@@ -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 | } |
@@ -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 | } |
@@ -64,11 +64,11 @@ |
||
| 64 | 64 | |
| 65 | 65 | if (ini_get('display_errors')) { |
| 66 | 66 | $title = get_class($e).': '.htmlspecialchars($e->getMessage()); |
| 67 | - $body = "<p><strong>\n".htmlspecialchars($e->getMessage()).'</strong></p>' . |
|
| 67 | + $body = "<p><strong>\n".htmlspecialchars($e->getMessage()).'</strong></p>'. |
|
| 68 | 68 | '<p>In '.htmlspecialchars($line)."</p><pre>\n".htmlspecialchars($e->getTraceAsString()).'</pre>'; |
| 69 | 69 | } else { |
| 70 | 70 | $title = "PHPTAL Exception"; |
| 71 | - $body = "<p>This page cannot be displayed.</p><hr/>" . |
|
| 71 | + $body = "<p>This page cannot be displayed.</p><hr/>". |
|
| 72 | 72 | "<p><small>Enable <code>display_errors</code> to see detailed message.</small></p>"; |
| 73 | 73 | } |
| 74 | 74 | |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | * |
| 102 | 102 | * @return void |
| 103 | 103 | */ |
| 104 | - public function setDocType($doctype,$called_from_macro) |
|
| 104 | + public function setDocType($doctype, $called_from_macro) |
|
| 105 | 105 | { |
| 106 | 106 | // FIXME: this is temporary workaround for problem of DOCTYPE disappearing in cloned PHPTAL object (because clone keeps _parentContext) |
| 107 | 107 | if (!$this->_docType) { |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | */ |
| 247 | 247 | public function pushSlots() |
| 248 | 248 | { |
| 249 | - $this->_slotsStack[] = $this->_slots; |
|
| 249 | + $this->_slotsStack[] = $this->_slots; |
|
| 250 | 250 | $this->_slots = array(); |
| 251 | 251 | } |
| 252 | 252 | |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | } else $pathinfo = ''; |
| 321 | 321 | |
| 322 | 322 | if (!empty($basename)) { |
| 323 | - $basename = "'" . $basename . "' "; |
|
| 323 | + $basename = "'".$basename."' "; |
|
| 324 | 324 | } |
| 325 | 325 | |
| 326 | 326 | if (is_array($base)) { |
@@ -350,7 +350,7 @@ discard block |
||
| 350 | 350 | * @access private |
| 351 | 351 | * @return mixed |
| 352 | 352 | */ |
| 353 | - public static function path($base, $path, $nothrow=false) |
|
| 353 | + public static function path($base, $path, $nothrow = false) |
|
| 354 | 354 | { |
| 355 | 355 | if ($base === null) { |
| 356 | 356 | if ($nothrow) return null; |
@@ -414,7 +414,7 @@ discard block |
||
| 414 | 414 | $base = $base->__call($current, array()); |
| 415 | 415 | continue; |
| 416 | 416 | } |
| 417 | - catch(BadMethodCallException $e) {} |
|
| 417 | + catch (BadMethodCallException $e) {} |
|
| 418 | 418 | } |
| 419 | 419 | |
| 420 | 420 | if (is_callable($base)) { |
@@ -433,7 +433,7 @@ discard block |
||
| 433 | 433 | // array handling |
| 434 | 434 | if (is_array($base)) { |
| 435 | 435 | // key or index |
| 436 | - if (array_key_exists((string)$current, $base)) { |
|
| 436 | + if (array_key_exists((string) $current, $base)) { |
|
| 437 | 437 | $base = $base[$current]; |
| 438 | 438 | continue; |
| 439 | 439 | } |
@@ -481,7 +481,7 @@ discard block |
||
| 481 | 481 | * @see PHPTAL_Context::path() |
| 482 | 482 | * @deprecated |
| 483 | 483 | */ |
| 484 | -function phptal_path($base, $path, $nothrow=false) |
|
| 484 | +function phptal_path($base, $path, $nothrow = false) |
|
| 485 | 485 | { |
| 486 | 486 | return PHPTAL_Context::path($base, $path, $nothrow); |
| 487 | 487 | } |
@@ -496,7 +496,7 @@ discard block |
||
| 496 | 496 | function phptal_isempty($var) |
| 497 | 497 | { |
| 498 | 498 | return $var === null || $var === false || $var === '' |
| 499 | - || ((is_array($var) || $var instanceof Countable) && count($var)===0); |
|
| 499 | + || ((is_array($var) || $var instanceof Countable) && count($var) === 0); |
|
| 500 | 500 | } |
| 501 | 501 | |
| 502 | 502 | /** |
@@ -535,7 +535,7 @@ discard block |
||
| 535 | 535 | if (is_string($var)) { |
| 536 | 536 | return $var; |
| 537 | 537 | } elseif (is_bool($var)) { |
| 538 | - return (int)$var; |
|
| 538 | + return (int) $var; |
|
| 539 | 539 | } elseif (is_array($var)) { |
| 540 | 540 | return implode(', ', array_map('phptal_tostring', $var)); |
| 541 | 541 | } elseif ($var instanceof SimpleXMLElement) { |
@@ -549,7 +549,7 @@ discard block |
||
| 549 | 549 | return $xml; |
| 550 | 550 | } |
| 551 | 551 | } |
| 552 | - return (string)phptal_unravel_closure($var); |
|
| 552 | + return (string) phptal_unravel_closure($var); |
|
| 553 | 553 | } |
| 554 | 554 | |
| 555 | 555 | /** |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | |
| 184 | 184 | $this->generateSurroundFoot($codewriter); |
| 185 | 185 | } |
| 186 | - catch(PHPTAL_TemplateException $e) { |
|
| 186 | + catch (PHPTAL_TemplateException $e) { |
|
| 187 | 187 | $e->hintSrcPosition($this->getSourceFile(), $this->getSourceLine()); |
| 188 | 188 | throw $e; |
| 189 | 189 | } |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | /** Returns true if the element contains specified PHPTAL attribute. */ |
| 213 | 213 | public function hasAttribute($qname) |
| 214 | 214 | { |
| 215 | - foreach($this->attribute_nodes as $attr) if ($attr->getQualifiedName() == $qname) return true; |
|
| 215 | + foreach ($this->attribute_nodes as $attr) if ($attr->getQualifiedName() == $qname) return true; |
|
| 216 | 216 | return false; |
| 217 | 217 | } |
| 218 | 218 | |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | |
| 242 | 242 | public function getAttributeNode($qname) |
| 243 | 243 | { |
| 244 | - foreach($this->attribute_nodes as $attr) if ($attr->getQualifiedName() === $qname) return $attr; |
|
| 244 | + foreach ($this->attribute_nodes as $attr) if ($attr->getQualifiedName() === $qname) return $attr; |
|
| 245 | 245 | return null; |
| 246 | 246 | } |
| 247 | 247 | |
@@ -348,15 +348,15 @@ discard block |
||
| 348 | 348 | } |
| 349 | 349 | } |
| 350 | 350 | |
| 351 | - public function generateContent(PHPTAL_Php_CodeWriter $codewriter = null, $realContent=false) |
|
| 351 | + public function generateContent(PHPTAL_Php_CodeWriter $codewriter = null, $realContent = false) |
|
| 352 | 352 | { |
| 353 | 353 | if (!$this->isEmptyNode($codewriter->getOutputMode())) { |
| 354 | 354 | if ($realContent || !count($this->contentAttributes)) { |
| 355 | - foreach($this->childNodes as $child) { |
|
| 355 | + foreach ($this->childNodes as $child) { |
|
| 356 | 356 | $child->generateCode($codewriter); |
| 357 | 357 | } |
| 358 | 358 | } |
| 359 | - else foreach($this->contentAttributes as $att) { |
|
| 359 | + else foreach ($this->contentAttributes as $att) { |
|
| 360 | 360 | $att->before($codewriter); |
| 361 | 361 | $att->after($codewriter); |
| 362 | 362 | } |
@@ -434,7 +434,7 @@ discard block |
||
| 434 | 434 | private function isEmptyNode($mode) |
| 435 | 435 | { |
| 436 | 436 | return (($mode === PHPTAL::XHTML || $mode === PHPTAL::HTML5) && PHPTAL_Dom_Defs::getInstance()->isEmptyTagNS($this->getNamespaceURI(), $this->getLocalName())) || |
| 437 | - ( $mode === PHPTAL::XML && !$this->hasContent()); |
|
| 437 | + ($mode === PHPTAL::XML && !$this->hasContent()); |
|
| 438 | 438 | } |
| 439 | 439 | |
| 440 | 440 | private function hasContent() |
@@ -468,7 +468,7 @@ discard block |
||
| 468 | 468 | throw new PHPTAL_TemplateException(sprintf("Attribute conflict in < %s > '%s' cannot appear with '%s'", |
| 469 | 469 | $this->qualifiedName, |
| 470 | 470 | $key, |
| 471 | - $temp[$nsattr->getPriority()][0]->getNamespace()->getPrefix() . ':' . $temp[$nsattr->getPriority()][0]->getLocalName() |
|
| 471 | + $temp[$nsattr->getPriority()][0]->getNamespace()->getPrefix().':'.$temp[$nsattr->getPriority()][0]->getLocalName() |
|
| 472 | 472 | ), $this->getSourceFile(), $this->getSourceLine()); |
| 473 | 473 | } |
| 474 | 474 | $temp[$nsattr->getPriority()] = array($nsattr, $domattr); |
@@ -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) { |
@@ -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; |
@@ -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 | |
@@ -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) { |