@@ -99,64 +99,64 @@ discard block |
||
99 | 99 | { |
100 | 100 | $timestamp = $this->unixTimestamp === true ? strtotime(date('Y-m-d H:i:s')) : date('Y-m-d H:i:s'); |
101 | 101 | |
102 | - if(is_null($this->recordUser)) { |
|
103 | - if(globals()->offsetExists('account')) { |
|
102 | + if (is_null($this->recordUser)) { |
|
103 | + if (globals()->offsetExists('account')) { |
|
104 | 104 | $this->setRecordUser(globals()->account->id); |
105 | 105 | } |
106 | 106 | } |
107 | 107 | |
108 | - if ( ! isset($sets[ 'record_status' ])) { |
|
109 | - $sets[ 'record_status' ] = $this->recordStatus; |
|
108 | + if ( ! isset($sets['record_status'])) { |
|
109 | + $sets['record_status'] = $this->recordStatus; |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | if (empty($this->primaryKeys)) { |
113 | 113 | $primaryKey = isset($this->primaryKey) ? $this->primaryKey : 'id'; |
114 | 114 | |
115 | - if (isset($sets[ $primaryKey ])) { |
|
116 | - if (empty($sets[ $primaryKey ])) { |
|
117 | - unset($sets[ $primaryKey ]); |
|
115 | + if (isset($sets[$primaryKey])) { |
|
116 | + if (empty($sets[$primaryKey])) { |
|
117 | + unset($sets[$primaryKey]); |
|
118 | 118 | } |
119 | 119 | } |
120 | 120 | |
121 | - if (empty($sets[ $primaryKey ])) { |
|
122 | - if ( ! isset($sets[ 'record_create_user' ])) { |
|
123 | - $sets[ 'record_create_user' ] = $this->recordUser; |
|
121 | + if (empty($sets[$primaryKey])) { |
|
122 | + if ( ! isset($sets['record_create_user'])) { |
|
123 | + $sets['record_create_user'] = $this->recordUser; |
|
124 | 124 | } |
125 | 125 | |
126 | - if ( ! isset($sets[ 'record_create_timestamp' ])) { |
|
127 | - $sets[ 'record_create_timestamp' ] = $timestamp; |
|
126 | + if ( ! isset($sets['record_create_timestamp'])) { |
|
127 | + $sets['record_create_timestamp'] = $timestamp; |
|
128 | 128 | } elseif ($this->unixTimestamp) { |
129 | - $sets[ 'record_create_timestamp' ] = strtotime($sets[ 'record_create_timestamp' ]); |
|
129 | + $sets['record_create_timestamp'] = strtotime($sets['record_create_timestamp']); |
|
130 | 130 | } |
131 | 131 | } |
132 | 132 | } else { |
133 | 133 | foreach ($this->primaryKeys as $primaryKey) { |
134 | - if (empty($sets[ $primaryKey ])) { |
|
135 | - if ( ! isset($sets[ 'record_create_user' ])) { |
|
136 | - $sets[ 'record_create_user' ] = $this->recordUser; |
|
134 | + if (empty($sets[$primaryKey])) { |
|
135 | + if ( ! isset($sets['record_create_user'])) { |
|
136 | + $sets['record_create_user'] = $this->recordUser; |
|
137 | 137 | } |
138 | 138 | |
139 | - if ( ! isset($sets[ 'record_create_timestamp' ])) { |
|
140 | - $sets[ 'record_create_timestamp' ] = $timestamp; |
|
139 | + if ( ! isset($sets['record_create_timestamp'])) { |
|
140 | + $sets['record_create_timestamp'] = $timestamp; |
|
141 | 141 | } elseif ($this->unixTimestamp) { |
142 | - $sets[ 'record_create_timestamp' ] = strtotime($sets[ 'record_create_timestamp' ]); |
|
142 | + $sets['record_create_timestamp'] = strtotime($sets['record_create_timestamp']); |
|
143 | 143 | } |
144 | 144 | } |
145 | 145 | } |
146 | 146 | } |
147 | 147 | |
148 | - if ( ! isset($sets[ 'record_update_user' ])) { |
|
149 | - $sets[ 'record_update_user' ] = $this->recordUser; |
|
148 | + if ( ! isset($sets['record_update_user'])) { |
|
149 | + $sets['record_update_user'] = $this->recordUser; |
|
150 | 150 | } |
151 | 151 | |
152 | - if ( ! isset($sets[ 'record_update_timestamp' ])) { |
|
153 | - $sets[ 'record_update_timestamp' ] = $timestamp; |
|
152 | + if ( ! isset($sets['record_update_timestamp'])) { |
|
153 | + $sets['record_update_timestamp'] = $timestamp; |
|
154 | 154 | } elseif ($this->unixTimestamp) { |
155 | - $sets[ 'record_update_timestamp' ] = strtotime($sets[ 'record_update_timestamp' ]); |
|
155 | + $sets['record_update_timestamp'] = strtotime($sets['record_update_timestamp']); |
|
156 | 156 | } |
157 | 157 | |
158 | - if ( ! isset($sets[ 'record_ordering' ]) && $this->recordOrdering === true) { |
|
159 | - $sets[ 'record_ordering' ] = $this->getRecordOrdering(); |
|
158 | + if ( ! isset($sets['record_ordering']) && $this->recordOrdering === true) { |
|
159 | + $sets['record_ordering'] = $this->getRecordOrdering(); |
|
160 | 160 | } |
161 | 161 | } |
162 | 162 | |
@@ -169,24 +169,24 @@ discard block |
||
169 | 169 | */ |
170 | 170 | protected function updateRecordSets(array &$sets) |
171 | 171 | { |
172 | - if(is_null($this->recordUser)) { |
|
173 | - if(globals()->offsetExists('account')) { |
|
172 | + if (is_null($this->recordUser)) { |
|
173 | + if (globals()->offsetExists('account')) { |
|
174 | 174 | $this->setRecordUser(globals()->account->id); |
175 | 175 | } |
176 | 176 | } |
177 | 177 | |
178 | - if ( ! isset($sets[ 'record_status' ])) { |
|
179 | - $sets[ 'record_status' ] = $this->recordStatus; |
|
178 | + if ( ! isset($sets['record_status'])) { |
|
179 | + $sets['record_status'] = $this->recordStatus; |
|
180 | 180 | } |
181 | 181 | |
182 | - if ( ! isset($sets[ 'record_update_user' ])) { |
|
183 | - $sets[ 'record_update_user' ] = $this->recordUser; |
|
182 | + if ( ! isset($sets['record_update_user'])) { |
|
183 | + $sets['record_update_user'] = $this->recordUser; |
|
184 | 184 | } |
185 | 185 | |
186 | 186 | $timestamp = $this->unixTimestamp === true ? strtotime(date('Y-m-d H:i:s')) : date('Y-m-d H:i:s'); |
187 | 187 | |
188 | - if ( ! isset($sets[ 'record_update_timestamp' ])) { |
|
189 | - $sets[ 'record_update_timestamp' ] = $timestamp; |
|
188 | + if ( ! isset($sets['record_update_timestamp'])) { |
|
189 | + $sets['record_update_timestamp'] = $timestamp; |
|
190 | 190 | } |
191 | 191 | } |
192 | 192 | |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | */ |
200 | 200 | public function getRecordOrdering() |
201 | 201 | { |
202 | - if($this->recordOrdering === true) { |
|
202 | + if ($this->recordOrdering === true) { |
|
203 | 203 | return $this->qb->countAllResults($this->table) + 1; |
204 | 204 | } |
205 | 205 |
@@ -28,7 +28,7 @@ |
||
28 | 28 | */ |
29 | 29 | public function index() |
30 | 30 | { |
31 | - if($javascript = file_get_contents(PATH_PUBLIC . 'assets/sw.js')) { |
|
31 | + if ($javascript = file_get_contents(PATH_PUBLIC . 'assets/sw.js')) { |
|
32 | 32 | $javascript = str_replace(['{{$theme}}', '{{ $theme }}'], 'default', $javascript); |
33 | 33 | |
34 | 34 | header("Content-type: application/x-javascript"); |
@@ -156,8 +156,8 @@ |
||
156 | 156 | */ |
157 | 157 | public function reload() |
158 | 158 | { |
159 | - if(count($this->loaded)) { |
|
160 | - foreach($this->loaded as $filename) { |
|
159 | + if (count($this->loaded)) { |
|
160 | + foreach ($this->loaded as $filename) { |
|
161 | 161 | $this->loadFile($filename); |
162 | 162 | } |
163 | 163 | } |
@@ -105,12 +105,12 @@ discard block |
||
105 | 105 | } |
106 | 106 | |
107 | 107 | // autoload presenter assets |
108 | - if (isset($config[ 'assets' ])) { |
|
109 | - $this->assets->autoload($config[ 'assets' ]); |
|
108 | + if (isset($config['assets'])) { |
|
109 | + $this->assets->autoload($config['assets']); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | // autoload presenter theme |
113 | - if(isset($config['theme'])) { |
|
113 | + if (isset($config['theme'])) { |
|
114 | 114 | $this->setTheme($config['theme']); |
115 | 115 | } |
116 | 116 | |
@@ -128,19 +128,19 @@ discard block |
||
128 | 128 | */ |
129 | 129 | public function setTheme($theme) |
130 | 130 | { |
131 | - if($this->theme instanceof Theme) { |
|
131 | + if ($this->theme instanceof Theme) { |
|
132 | 132 | $this->assets->removeFilePath($this->theme->getRealPath()); |
133 | 133 | } |
134 | 134 | |
135 | 135 | if (is_bool($theme)) { |
136 | 136 | $this->theme = false; |
137 | - } elseif(($moduleTheme = modules()->top()->getTheme($theme, true)) instanceof Theme) { |
|
137 | + } elseif (($moduleTheme = modules()->top()->getTheme($theme, true)) instanceof Theme) { |
|
138 | 138 | $this->theme = $moduleTheme; |
139 | - } elseif(($appTheme = modules()->first()->getTheme($theme, true)) instanceof Theme) { |
|
139 | + } elseif (($appTheme = modules()->first()->getTheme($theme, true)) instanceof Theme) { |
|
140 | 140 | $this->theme = $appTheme; |
141 | 141 | } |
142 | 142 | |
143 | - if($this->theme) { |
|
143 | + if ($this->theme) { |
|
144 | 144 | if ( ! defined('PATH_THEME')) { |
145 | 145 | define('PATH_THEME', $this->theme->getRealPath()); |
146 | 146 | } |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | // add theme assets directory |
149 | 149 | $this->assets->pushFilePath($this->theme->getRealPath()); |
150 | 150 | |
151 | - if(is_dir($themeViewPath = $this->theme->getRealPath() . 'views' . DIRECTORY_SEPARATOR)) { |
|
151 | + if (is_dir($themeViewPath = $this->theme->getRealPath() . 'views' . DIRECTORY_SEPARATOR)) { |
|
152 | 152 | |
153 | 153 | // add theme view directory |
154 | 154 | view()->addFilePath($this->theme->getRealPath()); |
@@ -158,11 +158,11 @@ discard block |
||
158 | 158 | |
159 | 159 | $modules = modules()->getArrayCopy(); |
160 | 160 | |
161 | - foreach($modules as $module) { |
|
161 | + foreach ($modules as $module) { |
|
162 | 162 | if ( ! in_array($module->getType(), ['KERNEL', 'FRAMEWORK', 'APP'])) { |
163 | 163 | $moduleResourcesPath = str_replace(PATH_RESOURCES, '', $module->getResourcesDir()); |
164 | 164 | |
165 | - if(is_dir($themeViewPath . $moduleResourcesPath)) { |
|
165 | + if (is_dir($themeViewPath . $moduleResourcesPath)) { |
|
166 | 166 | view()->pushFilePath($themeViewPath . $moduleResourcesPath); |
167 | 167 | } |
168 | 168 | } |
@@ -203,25 +203,25 @@ discard block |
||
203 | 203 | $storage = $this->storage; |
204 | 204 | |
205 | 205 | // Add Properties |
206 | - $storage[ 'meta' ] = $this->meta; |
|
207 | - $storage[ 'page' ] = $this->page; |
|
208 | - $storage[ 'assets' ] = new SplArrayObject([ |
|
206 | + $storage['meta'] = $this->meta; |
|
207 | + $storage['page'] = $this->page; |
|
208 | + $storage['assets'] = new SplArrayObject([ |
|
209 | 209 | 'head' => $this->assets->getHead(), |
210 | 210 | 'body' => $this->assets->getBody(), |
211 | 211 | ]); |
212 | - $storage[ 'partials' ] = $this->partials; |
|
213 | - $storage[ 'widgets' ] = $this->widgets; |
|
214 | - $storage[ 'theme' ] = $this->theme; |
|
212 | + $storage['partials'] = $this->partials; |
|
213 | + $storage['widgets'] = $this->widgets; |
|
214 | + $storage['theme'] = $this->theme; |
|
215 | 215 | |
216 | 216 | // Add Services |
217 | - $storage[ 'config' ] = config(); |
|
218 | - $storage[ 'language' ] = language(); |
|
219 | - $storage[ 'session' ] = session(); |
|
220 | - $storage[ 'presenter' ] = presenter(); |
|
221 | - $storage[ 'input' ] = input(); |
|
217 | + $storage['config'] = config(); |
|
218 | + $storage['language'] = language(); |
|
219 | + $storage['session'] = session(); |
|
220 | + $storage['presenter'] = presenter(); |
|
221 | + $storage['input'] = input(); |
|
222 | 222 | |
223 | 223 | if (services()->has('csrfProtection')) { |
224 | - $storage[ 'csrfToken' ] = services()->get('csrfProtection')->getToken(); |
|
224 | + $storage['csrfToken'] = services()->get('csrfProtection')->getToken(); |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | return $storage; |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | self::POST_CONTROLLER, |
119 | 119 | self::POST_COMMANDER, |
120 | 120 | ])) { |
121 | - $this->closures[ $offset ][ spl_object_hash($closure) ] = $closure; |
|
121 | + $this->closures[$offset][spl_object_hash($closure)] = $closure; |
|
122 | 122 | } |
123 | 123 | } |
124 | 124 | |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | public function callEvent($event) |
133 | 133 | { |
134 | 134 | if (array_key_exists($event, $this->closures)) { |
135 | - foreach ($this->closures[ $event ] as $closure) { |
|
135 | + foreach ($this->closures[$event] as $closure) { |
|
136 | 136 | call_user_func($closure); |
137 | 137 | } |
138 | 138 | } |
@@ -173,7 +173,7 @@ |
||
173 | 173 | $phar->buildFromIterator(new \RecursiveIteratorIterator(new \RecursiveCallbackFilterIterator( |
174 | 174 | new \RecursiveDirectoryIterator(PATH_ROOT, |
175 | 175 | \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS), |
176 | - function ($current, $key, $iterator) { |
|
176 | + function($current, $key, $iterator) { |
|
177 | 177 | if ($current->isDir()) { |
178 | 178 | // exclude build directory |
179 | 179 | if ($current->getFilename() === 'build') { |
@@ -191,16 +191,16 @@ discard block |
||
191 | 191 | $options = input()->get(); |
192 | 192 | |
193 | 193 | if (empty($options)) { |
194 | - $_GET[ 'switch' ] = 'ON'; |
|
195 | - $_GET[ 'mode' ] = 'default'; |
|
196 | - $_GET[ 'lifetime' ] = 300; |
|
197 | - $_GET[ 'title' ] = language()->getLine(strtoupper('CLI_MAINTENANCE_TITLE')); |
|
198 | - $_GET[ 'message' ] = language()->getLine(strtoupper('CLI_MAINTENANCE_MESSAGE')); |
|
194 | + $_GET['switch'] = 'ON'; |
|
195 | + $_GET['mode'] = 'default'; |
|
196 | + $_GET['lifetime'] = 300; |
|
197 | + $_GET['title'] = language()->getLine(strtoupper('CLI_MAINTENANCE_TITLE')); |
|
198 | + $_GET['message'] = language()->getLine(strtoupper('CLI_MAINTENANCE_MESSAGE')); |
|
199 | 199 | } else { |
200 | - $_GET[ 'mode' ] = 'default'; |
|
201 | - $_GET[ 'lifetime' ] = 300; |
|
202 | - $_GET[ 'title' ] = language()->getLine(strtoupper('CLI_MAINTENANCE_TITLE')); |
|
203 | - $_GET[ 'message' ] = language()->getLine(strtoupper('CLI_MAINTENANCE_MESSAGE')); |
|
200 | + $_GET['mode'] = 'default'; |
|
201 | + $_GET['lifetime'] = 300; |
|
202 | + $_GET['title'] = language()->getLine(strtoupper('CLI_MAINTENANCE_TITLE')); |
|
203 | + $_GET['message'] = language()->getLine(strtoupper('CLI_MAINTENANCE_MESSAGE')); |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | $this->__callOptions(); |
@@ -213,11 +213,11 @@ discard block |
||
213 | 213 | (new Format()) |
214 | 214 | ->setContextualClass(Format::DANGER) |
215 | 215 | ->setString(language()->getLine('CLI_MAINTENANCE_ALREADY_STARTED', [ |
216 | - $maintenanceInfo[ 'mode' ], |
|
217 | - $maintenanceInfo[ 'datetime' ], |
|
218 | - date('r', strtotime($maintenanceInfo[ 'datetime' ]) + $maintenanceInfo[ 'lifetime' ]), |
|
219 | - $maintenanceInfo[ 'title' ], |
|
220 | - $maintenanceInfo[ 'message' ], |
|
216 | + $maintenanceInfo['mode'], |
|
217 | + $maintenanceInfo['datetime'], |
|
218 | + date('r', strtotime($maintenanceInfo['datetime']) + $maintenanceInfo['lifetime']), |
|
219 | + $maintenanceInfo['title'], |
|
220 | + $maintenanceInfo['message'], |
|
221 | 221 | ])) |
222 | 222 | ->setNewLinesAfter(1) |
223 | 223 | ); |
@@ -113,8 +113,8 @@ discard block |
||
113 | 113 | $options = input()->get(); |
114 | 114 | |
115 | 115 | if (empty($options)) { |
116 | - $_GET[ 'host' ] = 'localhost'; |
|
117 | - $_GET[ 'port' ] = 8000; |
|
116 | + $_GET['host'] = 'localhost'; |
|
117 | + $_GET['port'] = 8000; |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | $this->__callOptions(); |
@@ -126,12 +126,12 @@ discard block |
||
126 | 126 | ->setNewLinesAfter(1) |
127 | 127 | ); |
128 | 128 | |
129 | - $_SERVER[ 'DOCUMENT_ROOT' ] = PATH_PUBLIC; |
|
129 | + $_SERVER['DOCUMENT_ROOT'] = PATH_PUBLIC; |
|
130 | 130 | |
131 | 131 | output()->write( |
132 | 132 | (new Format()) |
133 | 133 | ->setContextualClass(Format::INFO) |
134 | - ->setString(language()->getLine('CLI_SERVE_DOC_ROOT', [$_SERVER[ 'DOCUMENT_ROOT' ]])) |
|
134 | + ->setString(language()->getLine('CLI_SERVE_DOC_ROOT', [$_SERVER['DOCUMENT_ROOT']])) |
|
135 | 135 | ->setNewLinesAfter(1) |
136 | 136 | ); |
137 | 137 |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | $directory = new \RecursiveIteratorIterator(new \RecursiveCallbackFilterIterator( |
97 | 97 | new \RecursiveDirectoryIterator(PATH_ROOT, |
98 | 98 | \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS), |
99 | - function ($current, $key, $iterator) { |
|
99 | + function($current, $key, $iterator) { |
|
100 | 100 | if ($current->isDir()) { |
101 | 101 | // exclude build directory |
102 | 102 | if (in_array($current->getFilename(), [ |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | |
119 | 119 | $files[] = $packageJsonFileInfo; |
120 | 120 | |
121 | - if ($packageJsonFileInfo[ 'filename' ] === 'language') { |
|
121 | + if ($packageJsonFileInfo['filename'] === 'language') { |
|
122 | 122 | if (is_cli()) { |
123 | 123 | output()->verbose( |
124 | 124 | (new Format()) |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | ); |
142 | 142 | } |
143 | 143 | |
144 | - $registry[ $package->getDirName() ] = $package; |
|
144 | + $registry[$package->getDirName()] = $package; |
|
145 | 145 | } elseif (is_cli()) { |
146 | 146 | output()->verbose( |
147 | 147 | (new Format()) |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | { |
186 | 186 | if (isset($package)) { |
187 | 187 | if ($this->registered($package)) { |
188 | - return $this->registry[ $package ]; |
|
188 | + return $this->registry[$package]; |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | return false; |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | */ |
206 | 206 | public function registered($package) |
207 | 207 | { |
208 | - return isset($this->registry[ $package ]); |
|
208 | + return isset($this->registry[$package]); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | // ------------------------------------------------------------------------ |