@@ -89,7 +89,7 @@ |
||
| 89 | 89 | * |
| 90 | 90 | * @param string $sTemplate |
| 91 | 91 | * @param boolean $return |
| 92 | - * @return mixed |
|
| 92 | + * @return null|string |
|
| 93 | 93 | */ |
| 94 | 94 | public function display($sTemplate, $return = FALSE) { |
| 95 | 95 | // Start benchmark |
@@ -1,4 +1,6 @@ |
||
| 1 | -<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); |
|
| 1 | +<?php if (!defined('BASEPATH')) { |
|
| 2 | + exit('No direct script access allowed'); |
|
| 3 | +} |
|
| 2 | 4 | |
| 3 | 5 | require "dwoo/dwooAutoload.php"; |
| 4 | 6 | |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | /** |
| 29 | 29 | * Dwoo_Adapters_ZendFramework_PluginProxy's constructor. |
| 30 | 30 | * |
| 31 | - * @param Zend_View_Interface $view |
|
| 31 | + * @param Dwoo_Adapters_ZendFramework_View $view |
|
| 32 | 32 | */ |
| 33 | 33 | public function __construct(Zend_View_Interface $view) { |
| 34 | 34 | $this->view = $view; |
@@ -66,7 +66,6 @@ |
||
| 66 | 66 | * merges the given array(s) with the current data with array_merge |
| 67 | 67 | * |
| 68 | 68 | * @param array $data the array to merge |
| 69 | - * @param array $data2 $data3 ... other arrays to merge, optional, etc. |
|
| 70 | 69 | */ |
| 71 | 70 | public function mergeData(array $data) |
| 72 | 71 | { |
@@ -45,8 +45,9 @@ discard block |
||
| 45 | 45 | if ($name === null) { |
| 46 | 46 | $this->data = array(); |
| 47 | 47 | } elseif (is_array($name)) { |
| 48 | - foreach ($name as $index) |
|
| 49 | - unset($this->data[$index]); |
|
| 48 | + foreach ($name as $index) { |
|
| 49 | + unset($this->data[$index]); |
|
| 50 | + } |
|
| 50 | 51 | } else { |
| 51 | 52 | unset($this->data[$name]); |
| 52 | 53 | } |
@@ -90,8 +91,9 @@ discard block |
||
| 90 | 91 | { |
| 91 | 92 | if (is_array($name)) { |
| 92 | 93 | reset($name); |
| 93 | - while (list($k,$v) = each($name)) |
|
| 94 | - $this->data[$k] = $v; |
|
| 94 | + while (list($k,$v) = each($name)) { |
|
| 95 | + $this->data[$k] = $v; |
|
| 96 | + } |
|
| 95 | 97 | } else { |
| 96 | 98 | $this->data[$name] = $val; |
| 97 | 99 | } |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | /** |
| 25 | 25 | * compiles the provided string down to php code |
| 26 | 26 | * |
| 27 | - * @param string $templateStr the template to compile |
|
| 27 | + * @param string $template the template to compile |
|
| 28 | 28 | * @return string a compiled php code string |
| 29 | 29 | */ |
| 30 | 30 | public function compile(Dwoo_Core $dwoo, Dwoo_ITemplate $template); |
@@ -34,6 +34,7 @@ discard block |
||
| 34 | 34 | * |
| 35 | 35 | * @see Dwoo_Core::addPlugin |
| 36 | 36 | * @param array $customPlugins an array of custom plugins |
| 37 | + * @return void |
|
| 37 | 38 | */ |
| 38 | 39 | public function setCustomPlugins(array $customPlugins); |
| 39 | 40 | |
@@ -44,6 +45,7 @@ discard block |
||
| 44 | 45 | * set it on the Dwoo object as it will be passed onto the compiler automatically |
| 45 | 46 | * |
| 46 | 47 | * @param Dwoo_Security_Policy $policy the security policy object |
| 48 | + * @return void |
|
| 47 | 49 | */ |
| 48 | 50 | public function setSecurityPolicy(Dwoo_Security_Policy $policy = null); |
| 49 | 51 | } |
@@ -42,6 +42,9 @@ |
||
| 42 | 42 | |
| 43 | 43 | protected $corePluginDir; |
| 44 | 44 | |
| 45 | + /** |
|
| 46 | + * @param string $cacheDir |
|
| 47 | + */ |
|
| 45 | 48 | public function __construct($cacheDir) |
| 46 | 49 | { |
| 47 | 50 | $this->corePluginDir = DWOO_DIRECTORY . 'plugins'; |
@@ -278,7 +278,7 @@ |
||
| 278 | 278 | * |
| 279 | 279 | * @param Dwoo_Core $dwoo the dwoo instance that requests it |
| 280 | 280 | * @param string $output the template output |
| 281 | - * @return mixed full path of the cached file or false upon failure |
|
| 281 | + * @return false|string full path of the cached file or false upon failure |
|
| 282 | 282 | */ |
| 283 | 283 | public function cache(Dwoo_Core $dwoo, $output) |
| 284 | 284 | { |
@@ -53,6 +53,10 @@ |
||
| 53 | 53 | return $output; |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | + /** |
|
| 57 | + * @param string $dynamicId |
|
| 58 | + * @param string $compiledFile |
|
| 59 | + */ |
|
| 56 | 60 | public static function unescape($output, $dynamicId, $compiledFile) |
| 57 | 61 | { |
| 58 | 62 | $output = preg_replace_callback('/<dwoo:dynamic_('.$dynamicId.')>(.+?)<\/dwoo:dynamic_'.$dynamicId.'>/s', array('self', 'unescapePhp'), $output, -1, $count); |
@@ -1538,8 +1538,9 @@ |
||
| 1538 | 1538 | array_pop($this->scopeTree); |
| 1539 | 1539 | $this->scope =& $this->data; |
| 1540 | 1540 | $cnt = count($this->scopeTree); |
| 1541 | - for ($i=0;$i<$cnt;$i++) |
|
| 1542 | - $this->scope =& $this->scope[$this->scopeTree[$i]]; |
|
| 1541 | + for ($i=0;$i<$cnt;$i++) { |
|
| 1542 | + $this->scope =& $this->scope[$this->scopeTree[$i]]; |
|
| 1543 | + } |
|
| 1543 | 1544 | } elseif ($bit === '__' || $bit === '_root') { |
| 1544 | 1545 | $this->scope =& $this->data; |
| 1545 | 1546 | $this->scopeTree = array(); |
@@ -1484,7 +1484,7 @@ |
||
| 1484 | 1484 | * |
| 1485 | 1485 | * @param mixed $value the value to assign |
| 1486 | 1486 | * @param string $scope the variable string, using dwoo variable syntax (i.e. "var.subvar[subsubvar]->property") |
| 1487 | - * @return bool true if assigned correctly or false if a problem occured while parsing the var string |
|
| 1487 | + * @return null|false true if assigned correctly or false if a problem occured while parsing the var string |
|
| 1488 | 1488 | */ |
| 1489 | 1489 | public function assignInScope($value, $scope) |
| 1490 | 1490 | { |
@@ -297,9 +297,10 @@ discard block |
||
| 297 | 297 | |
| 298 | 298 | public function unregister_prefilter($callback) |
| 299 | 299 | { |
| 300 | - foreach ($this->_filters['pre'] as $index => $processor) |
|
| 301 | - if ($processor->callback === $callback) { |
|
| 300 | + foreach ($this->_filters['pre'] as $index => $processor) { |
|
| 301 | + if ($processor->callback === $callback) { |
|
| 302 | 302 | $this->compiler->removePostProcessor($processor); |
| 303 | + } |
|
| 303 | 304 | unset($this->_filters['pre'][$index]); |
| 304 | 305 | } |
| 305 | 306 | } |
@@ -314,9 +315,10 @@ discard block |
||
| 314 | 315 | |
| 315 | 316 | public function unregister_postfilter($callback) |
| 316 | 317 | { |
| 317 | - foreach ($this->_filters['post'] as $index => $processor) |
|
| 318 | - if ($processor->callback === $callback) { |
|
| 318 | + foreach ($this->_filters['post'] as $index => $processor) { |
|
| 319 | + if ($processor->callback === $callback) { |
|
| 319 | 320 | $this->compiler->removePostProcessor($processor); |
| 321 | + } |
|
| 320 | 322 | unset($this->_filters['post'][$index]); |
| 321 | 323 | } |
| 322 | 324 | } |
@@ -331,9 +333,10 @@ discard block |
||
| 331 | 333 | |
| 332 | 334 | public function unregister_outputfilter($callback) |
| 333 | 335 | { |
| 334 | - foreach ($this->_filters['output'] as $index => $filter) |
|
| 335 | - if ($filter->callback === $callback) { |
|
| 336 | + foreach ($this->_filters['output'] as $index => $filter) { |
|
| 337 | + if ($filter->callback === $callback) { |
|
| 336 | 338 | $this->removeOutputFilter($filter); |
| 339 | + } |
|
| 337 | 340 | unset($this->_filters['output'][$index]); |
| 338 | 341 | } |
| 339 | 342 | } |
@@ -419,10 +422,11 @@ discard block |
||
| 419 | 422 | } |
| 420 | 423 | |
| 421 | 424 | $data = $this->dataProvider->getData(); |
| 422 | - if ($name === null) |
|
| 423 | - return $data; |
|
| 424 | - elseif (isset($data[$name])) |
|
| 425 | - return $data[$name]; |
|
| 425 | + if ($name === null) { |
|
| 426 | + return $data; |
|
| 427 | + } elseif (isset($data[$name])) { |
|
| 428 | + return $data[$name]; |
|
| 429 | + } |
|
| 426 | 430 | return null; |
| 427 | 431 | } |
| 428 | 432 | |
@@ -450,8 +454,9 @@ discard block |
||
| 450 | 454 | |
| 451 | 455 | protected function makeTemplate($file, $cacheId, $compileId) |
| 452 | 456 | { |
| 453 | - if ($compileId === null) |
|
| 454 | - $compileId = $this->compile_id; |
|
| 457 | + if ($compileId === null) { |
|
| 458 | + $compileId = $this->compile_id; |
|
| 459 | + } |
|
| 455 | 460 | |
| 456 | 461 | $hash = bin2hex(md5($file.$cacheId.$compileId, true)); |
| 457 | 462 | if (!isset(self::$tplCache[$hash])) { |
@@ -511,8 +516,7 @@ discard block |
||
| 511 | 516 | { |
| 512 | 517 | interface Smarty {} |
| 513 | 518 | class Dwoo_Smarty_Adapter extends Dwoo_Smarty__Adapter implements Smarty {} |
| 514 | -} |
|
| 515 | -else |
|
| 519 | +} else |
|
| 516 | 520 | { |
| 517 | 521 | class Dwoo_Smarty_Adapter extends Dwoo_Smarty__Adapter {} |
| 518 | 522 | } |