Completed
Branch 1.2 (459185)
by David
04:06
created
lib/Dwoo/Adapters/CodeIgniter/libraries/Dwootemplate.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -97,14 +97,14 @@
 block discarded – undo
97 97
         $CI->benchmark->mark('dwoo_parse_start');
98 98
 
99 99
         // Check if file exists
100
-        if ( !file_exists($this->template_dir . $sTemplate ) ) {
100
+        if (!file_exists($this->template_dir.$sTemplate)) {
101 101
             $message = sprintf('Template file \'%s\' not found.', $sTemplate);
102 102
             show_error($message);
103 103
             log_message('error', $message);
104 104
         }
105 105
 
106 106
         // Create new template
107
-        $tpl = new Dwoo_Template_File($this->template_dir . $sTemplate);
107
+        $tpl = new Dwoo_Template_File($this->template_dir.$sTemplate);
108 108
 
109 109
         // render the template
110 110
         $template = $this->get($tpl, $this->dwoo_data);
Please login to merge, or discard this patch.
lib/Dwoo/Adapters/ZendFramework/PluginProxy.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
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;
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@
 block discarded – undo
59 59
 	 * @return string
60 60
 	 */
61 61
 	public function getCode($name, $params) {
62
-		return '$this->getPluginProxy()->view->'. $name .'('.Dwoo_Compiler::implode_r($params).')';
62
+		return '$this->getPluginProxy()->view->'.$name.'('.Dwoo_Compiler::implode_r($params).')';
63 63
 	}
64 64
 
65 65
 	/**
Please login to merge, or discard this patch.
lib/Dwoo/Data.php 2 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -66,7 +66,6 @@
 block discarded – undo
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
 	{
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 	{
93 93
 		if (is_array($name)) {
94 94
 			reset($name);
95
-			while (list($k,$v) = each($name))
95
+			while (list($k, $v) = each($name))
96 96
 				$this->data[$k] = $v;
97 97
 		} else {
98 98
 			$this->data[$name] = $val;
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 	 */
120 120
 	public function assignByRef($name, &$val)
121 121
 	{
122
-		$this->data[$name] =& $val;
122
+		$this->data[$name] = & $val;
123 123
 	}
124 124
 
125 125
 	/**
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 				}
141 141
 
142 142
 				if ($merge === true && is_array($val)) {
143
-					$this->data[$key] = $val + $this->data[$key];
143
+					$this->data[$key] = $val+$this->data[$key];
144 144
 				} else {
145 145
 					$this->data[$key][] = $val;
146 146
 				}
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 			}
154 154
 
155 155
 			if ($merge === true && is_array($val)) {
156
-				$this->data[$name] = $val + $this->data[$name];
156
+				$this->data[$name] = $val+$this->data[$name];
157 157
 			} else {
158 158
 				$this->data[$name][] = $val;
159 159
 			}
@@ -176,10 +176,10 @@  discard block
 block discarded – undo
176 176
 
177 177
    		if ($merge === true && is_array($val)) {
178 178
    			foreach ($val as $key => &$value) {
179
-   				$this->data[$name][$key] =& $value;
179
+   				$this->data[$name][$key] = & $value;
180 180
    			}
181 181
    		} else {
182
-   			$this->data[$name][] =& $val;
182
+   			$this->data[$name][] = & $val;
183 183
    		}
184 184
    	}
185 185
    	
Please login to merge, or discard this patch.
lib/Dwoo/ICompiler.php 1 patch
Doc Comments   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
lib/Dwoo/Loader.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -42,6 +42,9 @@
 block discarded – undo
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';
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -44,14 +44,14 @@  discard block
 block discarded – undo
44 44
 
45 45
 	public function __construct($cacheDir)
46 46
 	{
47
-		$this->corePluginDir = DWOO_DIRECTORY . 'plugins';
48
-		$this->cacheDir = rtrim($cacheDir, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
47
+		$this->corePluginDir = DWOO_DIRECTORY.'plugins';
48
+		$this->cacheDir = rtrim($cacheDir, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR;
49 49
 
50 50
 		// include class paths or rebuild paths if the cache file isn't there
51 51
 		$cacheFile = $this->cacheDir.'classpath.cache.d'.Dwoo_Core::RELEASE_TAG.'.php';
52 52
 		if (file_exists($cacheFile)) {
53 53
 			$classpath = file_get_contents($cacheFile);
54
-			$this->classPath = unserialize($classpath) + $this->classPath;
54
+			$this->classPath = unserialize($classpath)+$this->classPath;
55 55
 		} else {
56 56
 			$this->rebuildClassPathCache($this->corePluginDir, $cacheFile);
57 57
 		}
@@ -65,25 +65,25 @@  discard block
 block discarded – undo
65 65
 	 */
66 66
 	protected function rebuildClassPathCache($path, $cacheFile)
67 67
 	{
68
-		if ($cacheFile!==false) {
68
+		if ($cacheFile !== false) {
69 69
 			$tmp = $this->classPath;
70 70
 			$this->classPath = array();
71 71
 		}
72 72
 
73 73
 		// iterates over all files/folders
74
-		$list = glob(rtrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . '*');
74
+		$list = glob(rtrim($path, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.'*');
75 75
 		if (is_array($list)) {
76 76
 			foreach ($list as $f) {
77 77
 				if (is_dir($f)) {
78 78
 					$this->rebuildClassPathCache($f, false);
79 79
 				} else {
80
-					$this->classPath[str_replace(array('function.','block.','modifier.','outputfilter.','filter.','prefilter.','postfilter.','pre.','post.','output.','shared.','helper.'), '', basename($f, '.php'))] = $f;
80
+					$this->classPath[str_replace(array('function.', 'block.', 'modifier.', 'outputfilter.', 'filter.', 'prefilter.', 'postfilter.', 'pre.', 'post.', 'output.', 'shared.', 'helper.'), '', basename($f, '.php'))] = $f;
81 81
 				}
82 82
 			}
83 83
 		}
84 84
 
85 85
 		// save in file if it's the first call (not recursed)
86
-		if ($cacheFile!==false) {
86
+		if ($cacheFile !== false) {
87 87
 			if (!file_put_contents($cacheFile, serialize($this->classPath))) {
88 88
 				throw new Dwoo_Exception('Could not write into '.$cacheFile.', either because the folder is not there (create it) or because of the chmod configuration (please ensure this directory is writable by php), alternatively you can change the directory used with $dwoo->setCompileDir() or provide a custom loader object with $dwoo->setLoader()');
89 89
 			}
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 			!(include $this->classPath[$class]))
110 110
 		{
111 111
 			if ($forceRehash) {
112
-				$this->rebuildClassPathCache($this->corePluginDir, $this->cacheDir . 'classpath.cache.d'.Dwoo_Core::RELEASE_TAG.'.php');
112
+				$this->rebuildClassPathCache($this->corePluginDir, $this->cacheDir.'classpath.cache.d'.Dwoo_Core::RELEASE_TAG.'.php');
113 113
 				foreach ($this->paths as $path=>$file) {
114 114
 					$this->rebuildClassPathCache($path, $file);
115 115
 				}
@@ -142,11 +142,11 @@  discard block
 block discarded – undo
142 142
 		if (!$pluginDir) {
143 143
 			throw new Dwoo_Exception('Plugin directory does not exist or can not be read : '.$pluginDirectory);
144 144
 		}
145
-		$cacheFile = $this->cacheDir . 'classpath-'.substr(strtr($pluginDir, '/\\:'.PATH_SEPARATOR, '----'), strlen($pluginDir) > 80 ? -80 : 0).'.d'.Dwoo_Core::RELEASE_TAG.'.php';
145
+		$cacheFile = $this->cacheDir.'classpath-'.substr(strtr($pluginDir, '/\\:'.PATH_SEPARATOR, '----'), strlen($pluginDir) > 80 ? -80 : 0).'.d'.Dwoo_Core::RELEASE_TAG.'.php';
146 146
 		$this->paths[$pluginDir] = $cacheFile;
147 147
 		if (file_exists($cacheFile)) {
148 148
 			$classpath = file_get_contents($cacheFile);
149
-			$this->classPath = unserialize($classpath) + $this->classPath;
149
+			$this->classPath = unserialize($classpath)+$this->classPath;
150 150
 		} else {
151 151
 			$this->rebuildClassPathCache($pluginDir, $cacheFile);
152 152
 		}
Please login to merge, or discard this patch.
lib/Dwoo/Template/String.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -278,7 +278,7 @@
 block discarded – undo
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
 	{
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 		if (isset(self::$cache['cached'][$this->cacheId]) === true && file_exists($cachedFile)) {
268 268
 			// already checked, return cache file
269 269
 			return $cachedFile;
270
-		} elseif ($this->compilationEnforced !== true && file_exists($cachedFile) && ($cacheLength === -1 || filemtime($cachedFile) > ($_SERVER['REQUEST_TIME'] - $cacheLength)) && $this->isValidCompiledFile($this->getCompiledFilename($dwoo))) {
270
+		} elseif ($this->compilationEnforced !== true && file_exists($cachedFile) && ($cacheLength === -1 || filemtime($cachedFile) > ($_SERVER['REQUEST_TIME']-$cacheLength)) && $this->isValidCompiledFile($this->getCompiledFilename($dwoo))) {
271 271
 			// cache is still valid and can be loaded
272 272
 			self::$cache['cached'][$this->cacheId] = true;
273 273
 			return $cachedFile;
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
 		// thanks for his help on avoiding concurency issues
294 294
 		$temp = tempnam($cacheDir, 'temp');
295 295
 		if (!($file = @fopen($temp, 'wb'))) {
296
-			$temp = $cacheDir . uniqid('temp');
296
+			$temp = $cacheDir.uniqid('temp');
297 297
 			if (!($file = @fopen($temp, 'wb'))) {
298 298
 				trigger_error('Error writing temporary file \''.$temp.'\'', E_USER_WARNING);
299 299
 				return false;
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
 	{
330 330
 		$cachedFile = $this->getCacheFilename($dwoo);
331 331
 
332
-		return !file_exists($cachedFile) || (filectime($cachedFile) < (time() - $olderThan) && unlink($cachedFile));
332
+		return !file_exists($cachedFile) || (filectime($cachedFile) < (time()-$olderThan) && unlink($cachedFile));
333 333
 	}
334 334
 
335 335
 	/**
@@ -426,10 +426,10 @@  discard block
 block discarded – undo
426 426
 	protected function getCompiledFilename(Dwoo_Core $dwoo)
427 427
 	{
428 428
 		// no compile id was provided, set default
429
-		if ($this->compileId===null) {
429
+		if ($this->compileId === null) {
430 430
 			$this->compileId = $this->name;
431 431
 		}
432
-		return $dwoo->getCompileDir() . $this->compileId.'.d'.Dwoo_Core::RELEASE_TAG.'.php';
432
+		return $dwoo->getCompileDir().$this->compileId.'.d'.Dwoo_Core::RELEASE_TAG.'.php';
433 433
 	}
434 434
 
435 435
 	/**
@@ -453,9 +453,9 @@  discard block
 block discarded – undo
453 453
 			// force compiled id generation
454 454
 			$this->getCompiledFilename($dwoo);
455 455
 
456
-			$this->cacheId = str_replace('../', '__', $this->compileId . strtr($cacheId, '\\%?=!:;'.PATH_SEPARATOR, '/-------'));
456
+			$this->cacheId = str_replace('../', '__', $this->compileId.strtr($cacheId, '\\%?=!:;'.PATH_SEPARATOR, '/-------'));
457 457
 		}
458
-		return $dwoo->getCacheDir() . $this->cacheId.'.html';
458
+		return $dwoo->getCacheDir().$this->cacheId.'.html';
459 459
 	}
460 460
 
461 461
 	/**
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
 			$path = strtr(str_replace($baseDir, '', $path), '\\', '/');
505 505
 			$folders = explode('/', trim($path, '/'));
506 506
 			foreach ($folders as $folder) {
507
-				$baseDir .= $folder . DIRECTORY_SEPARATOR;
507
+				$baseDir .= $folder.DIRECTORY_SEPARATOR;
508 508
 				if (!chmod($baseDir, $chmod))
509 509
 				{
510 510
 					throw new Exception("Unable to chmod ".
Please login to merge, or discard this patch.
lib/plugins/builtin/blocks/dynamic.php 2 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -53,6 +53,10 @@
 block discarded – undo
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);
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -32,23 +32,23 @@
 block discarded – undo
32 32
 			return $content;
33 33
 		} catch (Dwoo_Compilation_Exception $e) {
34 34
 		}
35
-		$output = Dwoo_Compiler::PHP_OPEN .
35
+		$output = Dwoo_Compiler::PHP_OPEN.
36 36
 			'if($doCache) {'."\n\t".
37 37
 				'echo \'<dwoo:dynamic_\'.$dynamicId.\'>'.
38
-				str_replace('\'', '\\\'', $content) .
38
+				str_replace('\'', '\\\'', $content).
39 39
 				'</dwoo:dynamic_\'.$dynamicId.\'>\';'.
40 40
 			"\n} else {\n\t";
41
-				if(substr($content, 0, strlen(Dwoo_Compiler::PHP_OPEN)) == Dwoo_Compiler::PHP_OPEN) {
41
+				if (substr($content, 0, strlen(Dwoo_Compiler::PHP_OPEN)) == Dwoo_Compiler::PHP_OPEN) {
42 42
 					$output .= substr($content, strlen(Dwoo_Compiler::PHP_OPEN));
43 43
 				} else {
44
-					$output .= Dwoo_Compiler::PHP_CLOSE . $content;
44
+					$output .= Dwoo_Compiler::PHP_CLOSE.$content;
45 45
 				}
46
-				if(substr($output, -strlen(Dwoo_Compiler::PHP_CLOSE)) == Dwoo_Compiler::PHP_CLOSE) {
46
+				if (substr($output, -strlen(Dwoo_Compiler::PHP_CLOSE)) == Dwoo_Compiler::PHP_CLOSE) {
47 47
 					$output = substr($output, 0, -strlen(Dwoo_Compiler::PHP_CLOSE));
48 48
 				} else {
49 49
 					$output .= Dwoo_Compiler::PHP_OPEN;
50 50
 				}
51
-			$output .= "\n}". Dwoo_Compiler::PHP_CLOSE;
51
+			$output .= "\n}".Dwoo_Compiler::PHP_CLOSE;
52 52
 
53 53
 		return $output;
54 54
 	}
Please login to merge, or discard this patch.
lib/Dwoo/Template/File.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 	 * @return boolean True cache file existance and it's modification time
108 108
 	 */
109 109
 	protected function isValidCompiledFile($file) {
110
-		return parent::isValidCompiledFile($file) && (int)$this->getUid() <= filemtime($file);
110
+		return parent::isValidCompiledFile($file) && (int) $this->getUid() <= filemtime($file);
111 111
 	}
112 112
 
113 113
 	/**
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 			foreach ($this->includePath as $path) {
146 146
 				$path = rtrim($path, DIRECTORY_SEPARATOR);
147 147
 				if (file_exists($path.DIRECTORY_SEPARATOR.$this->file) === true) {
148
-					$this->resolvedPath = $path . DIRECTORY_SEPARATOR . $this->file;
148
+					$this->resolvedPath = $path.DIRECTORY_SEPARATOR.$this->file;
149 149
 					return $this->resolvedPath;
150 150
 				}
151 151
 			}
@@ -250,10 +250,10 @@  discard block
 block discarded – undo
250 250
 	protected function getCompiledFilename(Dwoo_Core $dwoo)
251 251
 	{
252 252
 		// no compile id was provided, set default
253
-		if ($this->compileId===null) {
253
+		if ($this->compileId === null) {
254 254
 			$this->compileId = str_replace('../', '__', strtr($this->getResourceIdentifier(), '\\:', '/-'));
255 255
 		}
256
-		return $dwoo->getCompileDir() . $this->compileId.'.d'.Dwoo_Core::RELEASE_TAG.'.php';
256
+		return $dwoo->getCompileDir().$this->compileId.'.d'.Dwoo_Core::RELEASE_TAG.'.php';
257 257
 	}
258 258
 
259 259
 	/**
Please login to merge, or discard this patch.
lib/Dwoo/Block/Plugin.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -98,6 +98,6 @@
 block discarded – undo
98 98
 	 */
99 99
 	public static function postProcessing(Dwoo_Compiler $compiler, array $params, $prepend, $append, $content)
100 100
 	{
101
-		return $content . Dwoo_Compiler::PHP_OPEN.$prepend.'$this->delStack();'.$append.Dwoo_Compiler::PHP_CLOSE;
101
+		return $content.Dwoo_Compiler::PHP_OPEN.$prepend.'$this->delStack();'.$append.Dwoo_Compiler::PHP_CLOSE;
102 102
 	}
103 103
 }
Please login to merge, or discard this patch.