@@ -107,7 +107,7 @@ discard block |
||
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 |
||
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 |
||
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 | /** |
@@ -98,6 +98,6 @@ |
||
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 | } |
@@ -44,14 +44,14 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | $out = ''; |
73 | 73 | foreach ($params as $attr=>$val) { |
74 | 74 | $out .= ' '.$attr.'='; |
75 | - if (trim($val, '"\'')=='' || $val=='null') { |
|
75 | + if (trim($val, '"\'') == '' || $val == 'null') { |
|
76 | 76 | $out .= str_replace($delim, '\\'.$delim, '""'); |
77 | 77 | } elseif (substr($val, 0, 1) === $delim && substr($val, -1) === $delim) { |
78 | 78 | $out .= str_replace($delim, '\\'.$delim, '"'.substr($val, 1, -1).'"'); |
@@ -88,8 +88,8 @@ discard block |
||
88 | 88 | $escapedVal = '.'.$val.'.'; |
89 | 89 | } |
90 | 90 | |
91 | - $out .= str_replace($delim, '\\'.$delim, '"') . |
|
92 | - $delim . $escapedVal . $delim . |
|
91 | + $out .= str_replace($delim, '\\'.$delim, '"'). |
|
92 | + $delim.$escapedVal.$delim. |
|
93 | 93 | str_replace($delim, '\\'.$delim, '"'); |
94 | 94 | } |
95 | 95 | } |
@@ -45,8 +45,7 @@ |
||
45 | 45 | * |
46 | 46 | * @var array |
47 | 47 | */ |
48 | - protected $allowedPhpFunctions = array |
|
49 | - ( |
|
48 | + protected $allowedPhpFunctions = array( |
|
50 | 49 | 'str_repeat' => true, |
51 | 50 | 'number_format' => true, |
52 | 51 | 'htmlentities' => true, |
@@ -97,14 +97,14 @@ |
||
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); |
@@ -1,12 +1,12 @@ |
||
1 | 1 | <?php if (!defined('BASEPATH')) exit('No direct script access allowed'); |
2 | 2 | |
3 | 3 | // The name of the directory where templates are located. |
4 | -$config['template_dir'] = dirname(FCPATH) . '/../application/views/'; |
|
4 | +$config['template_dir'] = dirname(FCPATH).'/../application/views/'; |
|
5 | 5 | |
6 | 6 | // The directory where compiled templates are located |
7 | -$config['compileDir'] = dirname(FCPATH) . '/../compile/'; |
|
7 | +$config['compileDir'] = dirname(FCPATH).'/../compile/'; |
|
8 | 8 | |
9 | 9 | //This tells Dwoo whether or not to cache the output of the templates to the $cache_dir. |
10 | 10 | $config['caching'] = 0; |
11 | -$config['cacheDir'] = dirname(FCPATH) . '/../cache/'; |
|
11 | +$config['cacheDir'] = dirname(FCPATH).'/../cache/'; |
|
12 | 12 | $config['cacheTime'] = 0; |
@@ -31,9 +31,9 @@ |
||
31 | 31 | return $this->getPluginProxy()->view->$name; |
32 | 32 | } |
33 | 33 | $trace = debug_backtrace(); |
34 | - trigger_error('Undefined property via __get(): ' . $name . |
|
35 | - ' in ' . $trace[0]['file'] . |
|
36 | - ' on line ' . $trace[0]['line'], E_USER_NOTICE); |
|
34 | + trigger_error('Undefined property via __get(): '.$name. |
|
35 | + ' in '.$trace[0]['file']. |
|
36 | + ' on line '.$trace[0]['line'], E_USER_NOTICE); |
|
37 | 37 | return null; |
38 | 38 | } |
39 | 39 | } |
40 | 40 | \ No newline at end of file |
@@ -97,26 +97,26 @@ discard block |
||
97 | 97 | |
98 | 98 | // Setting options to Dwoo objects... |
99 | 99 | foreach ($opt as $type => $settings) { |
100 | - if (!method_exists($this, 'set' . $type)) { |
|
100 | + if (!method_exists($this, 'set'.$type)) { |
|
101 | 101 | throw new Dwoo_Exception("Unknown type $type"); |
102 | 102 | } |
103 | 103 | |
104 | 104 | if (is_string($settings) || is_object($settings)) { |
105 | - call_user_func(array($this, 'set' . $type), $settings); |
|
105 | + call_user_func(array($this, 'set'.$type), $settings); |
|
106 | 106 | } elseif (is_array($settings)) { |
107 | 107 | // Set requested class |
108 | 108 | if (array_key_exists('type', $settings)) { |
109 | - call_user_func(array($this, 'set' . $type), $settings['type']); |
|
109 | + call_user_func(array($this, 'set'.$type), $settings['type']); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | if (in_array($type, $classes)) { |
113 | 113 | // Call get so that the class is initialized |
114 | - $rel = call_user_func(array($this, 'get' . $type)); |
|
114 | + $rel = call_user_func(array($this, 'get'.$type)); |
|
115 | 115 | |
116 | 116 | // Call set*() methods so that all the settings are set. |
117 | 117 | foreach ($settings as $method => $value) { |
118 | - if (method_exists($rel, 'set' . $method)) { |
|
119 | - call_user_func(array($rel, 'set' . $method), $value); |
|
118 | + if (method_exists($rel, 'set'.$method)) { |
|
119 | + call_user_func(array($rel, 'set'.$method), $value); |
|
120 | 120 | } |
121 | 121 | } |
122 | 122 | } elseif ('templateFile' == $type) { |
@@ -356,8 +356,8 @@ discard block |
||
356 | 356 | } |
357 | 357 | |
358 | 358 | foreach ($this->_templateFileSettings as $method => $value) { |
359 | - if (method_exists($dwooTemplateFile, 'set' . $method)) { |
|
360 | - call_user_func(array($dwooTemplateFile, 'set' . $method), $value); |
|
359 | + if (method_exists($dwooTemplateFile, 'set'.$method)) { |
|
360 | + call_user_func(array($dwooTemplateFile, 'set'.$method), $value); |
|
361 | 361 | } |
362 | 362 | } |
363 | 363 |