@@ -124,9 +124,15 @@ discard block |
||
| 124 | 124 | static public function path($expression, $nothrow=false) |
| 125 | 125 | { |
| 126 | 126 | $expression = trim($expression); |
| 127 | - if ($expression == 'default') return self::DEFAULT_KEYWORD; |
|
| 128 | - if ($expression == 'nothing') return self::NOTHING_KEYWORD; |
|
| 129 | - if ($expression == '') return self::NOTHING_KEYWORD; |
|
| 127 | + if ($expression == 'default') { |
|
| 128 | + return self::DEFAULT_KEYWORD; |
|
| 129 | + } |
|
| 130 | + if ($expression == 'nothing') { |
|
| 131 | + return self::NOTHING_KEYWORD; |
|
| 132 | + } |
|
| 133 | + if ($expression == '') { |
|
| 134 | + return self::NOTHING_KEYWORD; |
|
| 135 | + } |
|
| 130 | 136 | |
| 131 | 137 | // split OR expressions terminated by a string |
| 132 | 138 | if (preg_match('/^(.*?)\s*\|\s*?(string:.*)$/sm', $expression, $m)) { |
@@ -148,8 +154,7 @@ discard block |
||
| 148 | 154 | foreach ($exps as $i=>$exp) { |
| 149 | 155 | if(isset($string) || $i < count($exps) - 1) { |
| 150 | 156 | $result[] = self::compileToPHPExpressions(trim($exp), true); |
| 151 | - } |
|
| 152 | - else { |
|
| 157 | + } else { |
|
| 153 | 158 | // the last expression can thorw exception. |
| 154 | 159 | $result[] = self::compileToPHPExpressions(trim($exp), false); |
| 155 | 160 | } |
@@ -183,7 +188,11 @@ discard block |
||
| 183 | 188 | return '$ctx->path($ctx, ' . $next . ($expression === null ? '' : '."/".'.$expression) . ', true)'; |
| 184 | 189 | } |
| 185 | 190 | |
| 186 | - if (preg_match('/^\'[a-z][a-z0-9_]*\'$/i', $next)) $next = substr($next, 1, -1); else $next = '{'.$next.'}'; |
|
| 191 | + if (preg_match('/^\'[a-z][a-z0-9_]*\'$/i', $next)) { |
|
| 192 | + $next = substr($next, 1, -1); |
|
| 193 | + } else { |
|
| 194 | + $next = '{'.$next.'}'; |
|
| 195 | + } |
|
| 187 | 196 | |
| 188 | 197 | // if no sub part for this expression, just optimize the generated code |
| 189 | 198 | // and access the $ctx->var |
@@ -260,8 +269,7 @@ discard block |
||
| 260 | 269 | if ($inAccoladePath) { |
| 261 | 270 | $subPath .= $c; |
| 262 | 271 | $c = ''; |
| 263 | - } |
|
| 264 | - else { |
|
| 272 | + } else { |
|
| 265 | 273 | $c = '\\\\'; |
| 266 | 274 | } |
| 267 | 275 | break; |
@@ -270,8 +278,7 @@ discard block |
||
| 270 | 278 | if ($inAccoladePath) { |
| 271 | 279 | $subPath .= $c; |
| 272 | 280 | $c = ''; |
| 273 | - } |
|
| 274 | - else { |
|
| 281 | + } else { |
|
| 275 | 282 | $c = '\\\''; |
| 276 | 283 | } |
| 277 | 284 | break; |
@@ -384,7 +391,9 @@ discard block |
||
| 384 | 391 | static public function exists($src, $nothrow) |
| 385 | 392 | { |
| 386 | 393 | $src = trim($src); |
| 387 | - if (ctype_alnum($src)) return 'isset($ctx->'.$src.')'; |
|
| 394 | + if (ctype_alnum($src)) { |
|
| 395 | + return 'isset($ctx->'.$src.')'; |
|
| 396 | + } |
|
| 388 | 397 | return '(null !== ' . self::compileToPHPExpression($src, true) . ')'; |
| 389 | 398 | } |
| 390 | 399 | |
@@ -395,7 +404,9 @@ discard block |
||
| 395 | 404 | */ |
| 396 | 405 | static public function number($src, $nothrow) |
| 397 | 406 | { |
| 398 | - if (!is_numeric(trim($src))) throw new PHPTAL_ParserException("'$src' is not a number"); |
|
| 407 | + if (!is_numeric(trim($src))) { |
|
| 408 | + throw new PHPTAL_ParserException("'$src' is not a number"); |
|
| 409 | + } |
|
| 399 | 410 | return trim($src); |
| 400 | 411 | } |
| 401 | 412 | |
@@ -425,7 +436,9 @@ discard block |
||
| 425 | 436 | public static function compileToPHPExpression($expression, $nothrow=false) |
| 426 | 437 | { |
| 427 | 438 | $r = self::compileToPHPExpressions($expression, $nothrow); |
| 428 | - if (!is_array($r)) return $r; |
|
| 439 | + if (!is_array($r)) { |
|
| 440 | + return $r; |
|
| 441 | + } |
|
| 429 | 442 | |
| 430 | 443 | // this weird ternary operator construct is to execute noThrow inside the expression |
| 431 | 444 | return '($ctx->noThrow(true)||1?'.self::convertExpressionsToExpression($r, $nothrow).':"")'; |
@@ -437,9 +450,11 @@ discard block |
||
| 437 | 450 | */ |
| 438 | 451 | private static function convertExpressionsToExpression(array $array, $nothrow) |
| 439 | 452 | { |
| 440 | - if (count($array)==1) return '($ctx->noThrow('.($nothrow?'true':'false').')||1?('. |
|
| 453 | + if (count($array)==1) { |
|
| 454 | + return '($ctx->noThrow('.($nothrow?'true':'false').')||1?('. |
|
| 441 | 455 | ($array[0]==self::NOTHING_KEYWORD?'null':$array[0]). |
| 442 | 456 | '):"")'; |
| 457 | + } |
|
| 443 | 458 | |
| 444 | 459 | $expr = array_shift($array); |
| 445 | 460 | |
@@ -131,10 +131,12 @@ discard block |
||
| 131 | 131 | $this->length = '_PHPTAL_LENGTH_UNKNOWN_'; |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | - if ($this->length === '_PHPTAL_LENGTH_UNKNOWN_') // return length if end is discovered |
|
| 134 | + if ($this->length === '_PHPTAL_LENGTH_UNKNOWN_') { |
|
| 135 | + // return length if end is discovered |
|
| 135 | 136 | { |
| 136 | 137 | return $this->end ? $this->index + 1 : null; |
| 137 | 138 | } |
| 139 | + } |
|
| 138 | 140 | return $this->length; |
| 139 | 141 | } |
| 140 | 142 | |
@@ -173,7 +175,9 @@ discard block |
||
| 173 | 175 | $this->index++; |
| 174 | 176 | |
| 175 | 177 | // Prefetch the next element |
| 176 | - if ($this->validOnNext) $this->prefetch(); |
|
| 178 | + if ($this->validOnNext) { |
|
| 179 | + $this->prefetch(); |
|
| 180 | + } |
|
| 177 | 181 | |
| 178 | 182 | if ($this->uses_groups) { |
| 179 | 183 | // Notify the grouping helper of the change |
@@ -25,7 +25,9 @@ |
||
| 25 | 25 | public function __construct($path) |
| 26 | 26 | { |
| 27 | 27 | $this->_path = realpath($path); |
| 28 | - if ($this->_path === false) throw new PHPTAL_IOException("Unable to find real path of file '$path' (in ".getcwd().')'); |
|
| 28 | + if ($this->_path === false) { |
|
| 29 | + throw new PHPTAL_IOException("Unable to find real path of file '$path' (in ".getcwd().')'); |
|
| 30 | + } |
|
| 29 | 31 | } |
| 30 | 32 | |
| 31 | 33 | public function getRealPath() |
@@ -76,7 +76,9 @@ discard block |
||
| 76 | 76 | protected function findElementToFilter(PHPTAL_Dom_Element $root) |
| 77 | 77 | { |
| 78 | 78 | foreach ($root->childNodes as $node) { |
| 79 | - if (!$node instanceof PHPTAL_Dom_Element) continue; |
|
| 79 | + if (!$node instanceof PHPTAL_Dom_Element) { |
|
| 80 | + continue; |
|
| 81 | + } |
|
| 80 | 82 | |
| 81 | 83 | if ($node->getAttributeNS("http://www.w3.org/XML/1998/namespace", 'space') == 'default') { |
| 82 | 84 | $this->filterDOM($node); |
@@ -99,7 +101,9 @@ discard block |
||
| 99 | 101 | foreach ($element->getAttributeNodes() as $attrnode) { |
| 100 | 102 | |
| 101 | 103 | // skip replaced attributes (because getValueEscaped on them is meaningless) |
| 102 | - if ($attrnode->getReplacedState() !== PHPTAL_Dom_Attr::NOT_REPLACED) continue; |
|
| 104 | + if ($attrnode->getReplacedState() !== PHPTAL_Dom_Attr::NOT_REPLACED) { |
|
| 105 | + continue; |
|
| 106 | + } |
|
| 103 | 107 | |
| 104 | 108 | $val = $this->normalizeSpace($attrnode->getValueEscaped(), $attrnode->getEncoding()); |
| 105 | 109 | $attrnode->setValueEscaped(trim($val, ' ')); |
@@ -260,8 +260,7 @@ |
||
| 260 | 260 | $element->removeAttributeNS('','http-equiv'); |
| 261 | 261 | $element->removeAttributeNS('','content'); |
| 262 | 262 | $element->setAttributeNS('','charset',strtolower($this->getPHPTAL()->getEncoding())); |
| 263 | - } |
|
| 264 | - elseif (('link' === $element->getLocalName() && $element->getAttributeNS('','rel') === 'stylesheet') || |
|
| 263 | + } elseif (('link' === $element->getLocalName() && $element->getAttributeNS('','rel') === 'stylesheet') || |
|
| 265 | 264 | ('style' === $element->getLocalName())) { |
| 266 | 265 | // There's only one type of stylesheets that works. |
| 267 | 266 | $element->removeAttributeNS('','type'); |
@@ -116,8 +116,7 @@ discard block |
||
| 116 | 116 | } else { |
| 117 | 117 | throw new PHPTAL_ConfigurationException("Executed macro in file with DOCTYPE when using echoExecute(). This is not supported yet. Remove DOCTYPE or use PHPTAL->execute()."); |
| 118 | 118 | } |
| 119 | - } |
|
| 120 | - else if (!$this->_docType) { |
|
| 119 | + } else if (!$this->_docType) { |
|
| 121 | 120 | $this->_docType = $doctype; |
| 122 | 121 | } |
| 123 | 122 | } |
@@ -317,7 +316,9 @@ discard block |
||
| 317 | 316 | { |
| 318 | 317 | if ($current !== $path) { |
| 319 | 318 | $pathinfo = " (in path '.../$path')"; |
| 320 | - } else $pathinfo = ''; |
|
| 319 | + } else { |
|
| 320 | + $pathinfo = ''; |
|
| 321 | + } |
|
| 321 | 322 | |
| 322 | 323 | if (!empty($basename)) { |
| 323 | 324 | $basename = "'" . $basename . "' "; |
@@ -353,7 +354,9 @@ discard block |
||
| 353 | 354 | public static function path($base, $path, $nothrow=false) |
| 354 | 355 | { |
| 355 | 356 | if ($base === null) { |
| 356 | - if ($nothrow) return null; |
|
| 357 | + if ($nothrow) { |
|
| 358 | + return null; |
|
| 359 | + } |
|
| 357 | 360 | PHPTAL_Context::pathError($base, $path, $path, $path); |
| 358 | 361 | } |
| 359 | 362 | |
@@ -413,8 +416,7 @@ discard block |
||
| 413 | 416 | { |
| 414 | 417 | $base = $base->__call($current, array()); |
| 415 | 418 | continue; |
| 416 | - } |
|
| 417 | - catch(BadMethodCallException $e) {} |
|
| 419 | + } catch(BadMethodCallException $e) {} |
|
| 418 | 420 | } |
| 419 | 421 | |
| 420 | 422 | if (is_callable($base)) { |
@@ -444,8 +446,9 @@ discard block |
||
| 444 | 446 | continue; |
| 445 | 447 | } |
| 446 | 448 | |
| 447 | - if ($nothrow) |
|
| 448 | - return null; |
|
| 449 | + if ($nothrow) { |
|
| 450 | + return null; |
|
| 451 | + } |
|
| 449 | 452 | |
| 450 | 453 | PHPTAL_Context::pathError($base, $path, $current, $prev); |
| 451 | 454 | } |
@@ -467,8 +470,9 @@ discard block |
||
| 467 | 470 | |
| 468 | 471 | // if this point is reached, then the part cannot be resolved |
| 469 | 472 | |
| 470 | - if ($nothrow) |
|
| 471 | - return null; |
|
| 473 | + if ($nothrow) { |
|
| 474 | + return null; |
|
| 475 | + } |
|
| 472 | 476 | |
| 473 | 477 | PHPTAL_Context::pathError($base, $path, $current, $prev); |
| 474 | 478 | } |
@@ -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 | } |
@@ -94,7 +94,9 @@ discard block |
||
| 94 | 94 | $value = ''; |
| 95 | 95 | foreach ($this->childNodes as $node) { |
| 96 | 96 | // leave it alone if there is CDATA, comment, or anything else. |
| 97 | - if (!$node instanceof PHPTAL_Dom_Text) return; |
|
| 97 | + if (!$node instanceof PHPTAL_Dom_Text) { |
|
| 98 | + return; |
|
| 99 | + } |
|
| 98 | 100 | |
| 99 | 101 | $value .= $node->getValue(); |
| 100 | 102 | $valueEscaped .= $node->getValueEscaped(); |
@@ -118,7 +120,9 @@ discard block |
||
| 118 | 120 | |
| 119 | 121 | public function appendChild(PHPTAL_Dom_Node $child) |
| 120 | 122 | { |
| 121 | - if ($child->parentNode) $child->parentNode->removeChild($child); |
|
| 123 | + if ($child->parentNode) { |
|
| 124 | + $child->parentNode->removeChild($child); |
|
| 125 | + } |
|
| 122 | 126 | $child->parentNode = $this; |
| 123 | 127 | $this->childNodes[] = $child; |
| 124 | 128 | } |
@@ -141,7 +145,9 @@ discard block |
||
| 141 | 145 | if ($node === $oldElement) { |
| 142 | 146 | $oldElement->parentNode = NULL; |
| 143 | 147 | |
| 144 | - if ($newElement->parentNode) $newElement->parentNode->removeChild($child); |
|
| 148 | + if ($newElement->parentNode) { |
|
| 149 | + $newElement->parentNode->removeChild($child); |
|
| 150 | + } |
|
| 145 | 151 | $newElement->parentNode = $this; |
| 146 | 152 | |
| 147 | 153 | $this->childNodes[$k] = $newElement; |
@@ -182,8 +188,7 @@ discard block |
||
| 182 | 188 | } |
| 183 | 189 | |
| 184 | 190 | $this->generateSurroundFoot($codewriter); |
| 185 | - } |
|
| 186 | - catch(PHPTAL_TemplateException $e) { |
|
| 191 | + } catch(PHPTAL_TemplateException $e) { |
|
| 187 | 192 | $e->hintSrcPosition($this->getSourceFile(), $this->getSourceLine()); |
| 188 | 193 | throw $e; |
| 189 | 194 | } |
@@ -212,7 +217,9 @@ discard block |
||
| 212 | 217 | /** Returns true if the element contains specified PHPTAL attribute. */ |
| 213 | 218 | public function hasAttribute($qname) |
| 214 | 219 | { |
| 215 | - foreach($this->attribute_nodes as $attr) if ($attr->getQualifiedName() == $qname) return true; |
|
| 220 | + foreach($this->attribute_nodes as $attr) { |
|
| 221 | + if ($attr->getQualifiedName() == $qname) return true; |
|
| 222 | + } |
|
| 216 | 223 | return false; |
| 217 | 224 | } |
| 218 | 225 | |
@@ -224,7 +231,9 @@ discard block |
||
| 224 | 231 | public function getAttributeNodeNS($ns_uri, $localname) |
| 225 | 232 | { |
| 226 | 233 | foreach ($this->attribute_nodes as $attr) { |
| 227 | - if ($attr->getNamespaceURI() === $ns_uri && $attr->getLocalName() === $localname) return $attr; |
|
| 234 | + if ($attr->getNamespaceURI() === $ns_uri && $attr->getLocalName() === $localname) { |
|
| 235 | + return $attr; |
|
| 236 | + } |
|
| 228 | 237 | } |
| 229 | 238 | return null; |
| 230 | 239 | } |
@@ -241,7 +250,9 @@ discard block |
||
| 241 | 250 | |
| 242 | 251 | public function getAttributeNode($qname) |
| 243 | 252 | { |
| 244 | - foreach($this->attribute_nodes as $attr) if ($attr->getQualifiedName() === $qname) return $attr; |
|
| 253 | + foreach($this->attribute_nodes as $attr) { |
|
| 254 | + if ($attr->getQualifiedName() === $qname) return $attr; |
|
| 255 | + } |
|
| 245 | 256 | return null; |
| 246 | 257 | } |
| 247 | 258 | |
@@ -252,7 +263,9 @@ discard block |
||
| 252 | 263 | */ |
| 253 | 264 | public function getOrCreateAttributeNode($qname) |
| 254 | 265 | { |
| 255 | - if ($attr = $this->getAttributeNode($qname)) return $attr; |
|
| 266 | + if ($attr = $this->getAttributeNode($qname)) { |
|
| 267 | + return $attr; |
|
| 268 | + } |
|
| 256 | 269 | |
| 257 | 270 | $attr = new PHPTAL_Dom_Attr($qname, "", null, 'UTF-8'); // FIXME: should find namespace and encoding |
| 258 | 271 | $this->attribute_nodes[] = $attr; |
@@ -294,19 +307,27 @@ discard block |
||
| 294 | 307 | */ |
| 295 | 308 | public function hasRealContent() |
| 296 | 309 | { |
| 297 | - if (count($this->contentAttributes) > 0) return true; |
|
| 310 | + if (count($this->contentAttributes) > 0) { |
|
| 311 | + return true; |
|
| 312 | + } |
|
| 298 | 313 | |
| 299 | 314 | foreach ($this->childNodes as $node) { |
| 300 | - if (!$node instanceof PHPTAL_Dom_Text || $node->getValueEscaped() !== '') return true; |
|
| 315 | + if (!$node instanceof PHPTAL_Dom_Text || $node->getValueEscaped() !== '') { |
|
| 316 | + return true; |
|
| 317 | + } |
|
| 301 | 318 | } |
| 302 | 319 | return false; |
| 303 | 320 | } |
| 304 | 321 | |
| 305 | 322 | public function hasRealAttributes() |
| 306 | 323 | { |
| 307 | - if ($this->hasAttributeNS('http://xml.zope.org/namespaces/tal', 'attributes')) return true; |
|
| 324 | + if ($this->hasAttributeNS('http://xml.zope.org/namespaces/tal', 'attributes')) { |
|
| 325 | + return true; |
|
| 326 | + } |
|
| 308 | 327 | foreach ($this->attribute_nodes as $attr) { |
| 309 | - if ($attr->getReplacedState() !== PHPTAL_Dom_Attr::HIDDEN) return true; |
|
| 328 | + if ($attr->getReplacedState() !== PHPTAL_Dom_Attr::HIDDEN) { |
|
| 329 | + return true; |
|
| 330 | + } |
|
| 310 | 331 | } |
| 311 | 332 | return false; |
| 312 | 333 | } |
@@ -322,7 +343,9 @@ discard block |
||
| 322 | 343 | |
| 323 | 344 | public function generateHead(PHPTAL_Php_CodeWriter $codewriter) |
| 324 | 345 | { |
| 325 | - if ($this->headFootDisabled) return; |
|
| 346 | + if ($this->headFootDisabled) { |
|
| 347 | + return; |
|
| 348 | + } |
|
| 326 | 349 | if ($this->headPrintCondition) { |
| 327 | 350 | $codewriter->doIf($this->headPrintCondition); |
| 328 | 351 | } |
@@ -355,9 +378,10 @@ discard block |
||
| 355 | 378 | foreach($this->childNodes as $child) { |
| 356 | 379 | $child->generateCode($codewriter); |
| 357 | 380 | } |
| 358 | - } |
|
| 359 | - else foreach($this->contentAttributes as $att) { |
|
| 381 | + } else { |
|
| 382 | + foreach($this->contentAttributes as $att) { |
|
| 360 | 383 | $att->before($codewriter); |
| 384 | + } |
|
| 361 | 385 | $att->after($codewriter); |
| 362 | 386 | } |
| 363 | 387 | } |
@@ -365,10 +389,12 @@ discard block |
||
| 365 | 389 | |
| 366 | 390 | public function generateFoot(PHPTAL_Php_CodeWriter $codewriter) |
| 367 | 391 | { |
| 368 | - if ($this->headFootDisabled) |
|
| 369 | - return; |
|
| 370 | - if ($this->isEmptyNode($codewriter->getOutputMode())) |
|
| 371 | - return; |
|
| 392 | + if ($this->headFootDisabled) { |
|
| 393 | + return; |
|
| 394 | + } |
|
| 395 | + if ($this->isEmptyNode($codewriter->getOutputMode())) { |
|
| 396 | + return; |
|
| 397 | + } |
|
| 372 | 398 | |
| 373 | 399 | if ($this->footPrintCondition) { |
| 374 | 400 | $codewriter->doIf($this->footPrintCondition); |
@@ -481,15 +507,16 @@ discard block |
||
| 481 | 507 | $handler = $nsattr->createAttributeHandler($this, $domattr->getValue()); |
| 482 | 508 | $this->talHandlers[$prio] = $handler; |
| 483 | 509 | |
| 484 | - if ($nsattr instanceof PHPTAL_NamespaceAttributeSurround) |
|
| 485 | - $this->surroundAttributes[] = $handler; |
|
| 486 | - else if ($nsattr instanceof PHPTAL_NamespaceAttributeReplace) |
|
| 487 | - $this->replaceAttributes[] = $handler; |
|
| 488 | - else if ($nsattr instanceof PHPTAL_NamespaceAttributeContent) |
|
| 489 | - $this->contentAttributes[] = $handler; |
|
| 490 | - else |
|
| 491 | - throw new PHPTAL_ParserException("Unknown namespace attribute class ".get_class($nsattr), |
|
| 510 | + if ($nsattr instanceof PHPTAL_NamespaceAttributeSurround) { |
|
| 511 | + $this->surroundAttributes[] = $handler; |
|
| 512 | + } else if ($nsattr instanceof PHPTAL_NamespaceAttributeReplace) { |
|
| 513 | + $this->replaceAttributes[] = $handler; |
|
| 514 | + } else if ($nsattr instanceof PHPTAL_NamespaceAttributeContent) { |
|
| 515 | + $this->contentAttributes[] = $handler; |
|
| 516 | + } else { |
|
| 517 | + throw new PHPTAL_ParserException("Unknown namespace attribute class ".get_class($nsattr), |
|
| 492 | 518 | $this->getSourceFile(), $this->getSourceLine()); |
| 519 | + } |
|
| 493 | 520 | |
| 494 | 521 | } |
| 495 | 522 | } |
@@ -119,7 +119,9 @@ |
||
| 119 | 119 | */ |
| 120 | 120 | public function isValidAttributeNS($namespace_uri, $local_name) |
| 121 | 121 | { |
| 122 | - if (!$this->isHandledNamespace($namespace_uri)) return false; |
|
| 122 | + if (!$this->isHandledNamespace($namespace_uri)) { |
|
| 123 | + return false; |
|
| 124 | + } |
|
| 123 | 125 | |
| 124 | 126 | $attrs = $this->namespaces_by_uri[$namespace_uri]->getAttributes(); |
| 125 | 127 | return isset($attrs[$local_name]); |