@@ -23,13 +23,13 @@ discard block |
||
| 23 | 23 | * keeps track whether last element had trailing whitespace (or didn't need it). |
| 24 | 24 | * If had_space==false, next element must keep leading space. |
| 25 | 25 | */ |
| 26 | - private $had_space=false; |
|
| 26 | + private $had_space = false; |
|
| 27 | 27 | |
| 28 | 28 | /** |
| 29 | 29 | * last text node before closing tag that may need trailing whitespace trimmed. |
| 30 | 30 | * It's often last-child, but comments, multiple end tags make that trickier. |
| 31 | 31 | */ |
| 32 | - private $most_recent_text_node=null; |
|
| 32 | + private $most_recent_text_node = null; |
|
| 33 | 33 | |
| 34 | 34 | function filterDOM(PHPTAL_Dom_Element $root) |
| 35 | 35 | { |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | // tal:replace makes element behave like text |
| 44 | - if ($root->getAttributeNS('http://xml.zope.org/namespaces/tal','replace')) { |
|
| 44 | + if ($root->getAttributeNS('http://xml.zope.org/namespaces/tal', 'replace')) { |
|
| 45 | 45 | $this->most_recent_text_node = null; |
| 46 | 46 | $this->had_space = false; |
| 47 | 47 | return; |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | // mostly block-level elements |
| 57 | 57 | // if element is conditional, it may not always break the line |
| 58 | - $breaks_line = $no_spaces || ($this->breaksLine($root) && !$root->getAttributeNS('http://xml.zope.org/namespaces/tal','condition')); |
|
| 58 | + $breaks_line = $no_spaces || ($this->breaksLine($root) && !$root->getAttributeNS('http://xml.zope.org/namespaces/tal', 'condition')); |
|
| 59 | 59 | |
| 60 | 60 | // start tag newline |
| 61 | 61 | if ($breaks_line) { |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | // HTML 5 (9.1.2.5) specifies quirk that a first *single* newline in <pre> can be removed |
| 78 | 78 | if (count($root->childNodes) && $root->childNodes[0] instanceof PHPTAL_Dom_Text) { |
| 79 | 79 | if (preg_match('/^\n[^\n]/', $root->childNodes[0]->getValueEscaped())) { |
| 80 | - $root->childNodes[0]->setValueEscaped(substr($root->childNodes[0]->getValueEscaped(),1)); |
|
| 80 | + $root->childNodes[0]->setValueEscaped(substr($root->childNodes[0]->getValueEscaped(), 1)); |
|
| 81 | 81 | } |
| 82 | 82 | } |
| 83 | 83 | $this->findElementToFilter($root); |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | // collapsed whitespace-only nodes are ignored (otherwise trimming of most_recent_text_node would be useless) |
| 102 | 102 | if ($norm !== '') { |
| 103 | 103 | $this->most_recent_text_node = $node; |
| 104 | - $this->had_space = (substr($norm,-1) == ' '); |
|
| 104 | + $this->had_space = (substr($norm, -1) == ' '); |
|
| 105 | 105 | } |
| 106 | 106 | } else if ($node instanceof PHPTAL_Dom_Element) { |
| 107 | 107 | $this->filterDOM($node); |
@@ -115,12 +115,12 @@ discard block |
||
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | // repeated element may need trailing space. |
| 118 | - if (!$breaks_line && $root->getAttributeNS('http://xml.zope.org/namespaces/tal','repeat')) { |
|
| 118 | + if (!$breaks_line && $root->getAttributeNS('http://xml.zope.org/namespaces/tal', 'repeat')) { |
|
| 119 | 119 | $this->most_recent_text_node = null; |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | // tal:content may replace element with something without space |
| 123 | - if (!$breaks_line && $root->getAttributeNS('http://xml.zope.org/namespaces/tal','content')) { |
|
| 123 | + if (!$breaks_line && $root->getAttributeNS('http://xml.zope.org/namespaces/tal', 'content')) { |
|
| 124 | 124 | $this->had_space = false; |
| 125 | 125 | $this->most_recent_text_node = null; |
| 126 | 126 | } |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | private static $no_interelement_space = array( |
| 139 | - 'html','head','table','thead','tfoot','select','optgroup','dl','ol','ul','tr','datalist', |
|
| 139 | + 'html', 'head', 'table', 'thead', 'tfoot', 'select', 'optgroup', 'dl', 'ol', 'ul', 'tr', 'datalist', |
|
| 140 | 140 | ); |
| 141 | 141 | |
| 142 | 142 | private function hasNoInterelementSpace(PHPTAL_Dom_Element $element) |
@@ -155,15 +155,15 @@ discard block |
||
| 155 | 155 | * li is deliberately omitted, as it's commonly used with display:inline in menus. |
| 156 | 156 | */ |
| 157 | 157 | private static $breaks_line = array( |
| 158 | - 'address','article','aside','base','blockquote','body','br','dd','div','dl','dt','fieldset','figure', |
|
| 159 | - 'footer','form','h1','h2','h3','h4','h5','h6','head','header','hgroup','hr','html','legend','link', |
|
| 160 | - 'meta','nav','ol','option','p','param','pre','section','style','table','tbody','td','th','thead', |
|
| 161 | - 'title','tr','ul','details', |
|
| 158 | + 'address', 'article', 'aside', 'base', 'blockquote', 'body', 'br', 'dd', 'div', 'dl', 'dt', 'fieldset', 'figure', |
|
| 159 | + 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'legend', 'link', |
|
| 160 | + 'meta', 'nav', 'ol', 'option', 'p', 'param', 'pre', 'section', 'style', 'table', 'tbody', 'td', 'th', 'thead', |
|
| 161 | + 'title', 'tr', 'ul', 'details', |
|
| 162 | 162 | ); |
| 163 | 163 | |
| 164 | 164 | private function breaksLine(PHPTAL_Dom_Element $element) |
| 165 | 165 | { |
| 166 | - if ($element->getAttributeNS('http://xml.zope.org/namespaces/metal','define-macro')) { |
|
| 166 | + if ($element->getAttributeNS('http://xml.zope.org/namespaces/metal', 'define-macro')) { |
|
| 167 | 167 | return true; |
| 168 | 168 | } |
| 169 | 169 | |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | * replaced elements need to preserve spaces before and after |
| 184 | 184 | */ |
| 185 | 185 | private static $inline_blocks = array( |
| 186 | - 'select','input','button','img','textarea','output','progress','meter', |
|
| 186 | + 'select', 'input', 'button', 'img', 'textarea', 'output', 'progress', 'meter', |
|
| 187 | 187 | ); |
| 188 | 188 | |
| 189 | 189 | private function isInlineBlock(PHPTAL_Dom_Element $element) |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | * pre-defined order of attributes roughly by popularity |
| 220 | 220 | */ |
| 221 | 221 | private static $attributes_order = array( |
| 222 | - 'href','src','class','rel','type','title','width','height','alt','content','name','style','lang','id', |
|
| 222 | + 'href', 'src', 'class', 'rel', 'type', 'title', 'width', 'height', 'alt', 'content', 'name', 'style', 'lang', 'id', |
|
| 223 | 223 | ); |
| 224 | 224 | |
| 225 | 225 | /** |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | $b_index = array_search($b, self::$attributes_order); |
| 233 | 233 | |
| 234 | 234 | if ($a_index !== false && $b_index !== false) { |
| 235 | - return $a_index - $b_index; |
|
| 235 | + return $a_index-$b_index; |
|
| 236 | 236 | } |
| 237 | 237 | if ($a_index === false && $b_index === false) { |
| 238 | 238 | return strcmp($a, $b); |
@@ -256,26 +256,26 @@ discard block |
||
| 256 | 256 | |
| 257 | 257 | // <meta charset> |
| 258 | 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())); |
|
| 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 | - elseif (('link' === $element->getLocalName() && $element->getAttributeNS('','rel') === 'stylesheet') || |
|
| 264 | + elseif (('link' === $element->getLocalName() && $element->getAttributeNS('', 'rel') === 'stylesheet') || |
|
| 265 | 265 | ('style' === $element->getLocalName())) { |
| 266 | 266 | // There's only one type of stylesheets that works. |
| 267 | - $element->removeAttributeNS('','type'); |
|
| 267 | + $element->removeAttributeNS('', 'type'); |
|
| 268 | 268 | |
| 269 | 269 | } elseif ('script' === $element->getLocalName()) { |
| 270 | - $element->removeAttributeNS('','language'); |
|
| 270 | + $element->removeAttributeNS('', 'language'); |
|
| 271 | 271 | |
| 272 | 272 | // Only remove type that matches default. E4X, vbscript, coffeescript, etc. must be preserved |
| 273 | - $type = $element->getAttributeNS('','type'); |
|
| 273 | + $type = $element->getAttributeNS('', 'type'); |
|
| 274 | 274 | $is_std = preg_match('/^(?:text|application)\/(?:ecma|java)script(\s*;\s*charset\s*=\s*[^;]*)?$/', $type); |
| 275 | 275 | |
| 276 | 276 | // Remote scripts should have type specified in HTTP headers. |
| 277 | - if ($is_std || $element->getAttributeNS('','src')) { |
|
| 278 | - $element->removeAttributeNS('','type'); |
|
| 277 | + if ($is_std || $element->getAttributeNS('', 'src')) { |
|
| 278 | + $element->removeAttributeNS('', 'type'); |
|
| 279 | 279 | } |
| 280 | 280 | } |
| 281 | 281 | } |
@@ -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 | } |
@@ -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 | /** |
@@ -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 | } |
@@ -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) { |