@@ -30,7 +30,7 @@ |
||
30 | 30 | $referenceModel, |
31 | 31 | $foreignKey = null |
32 | 32 | ) { |
33 | - $this->currentModel =& $currentModel; |
|
33 | + $this->currentModel = & $currentModel; |
|
34 | 34 | $this->currentTable = $currentModel->table; |
35 | 35 | $this->currentPrimaryKey = $currentModel->primaryKey; |
36 | 36 |
@@ -46,8 +46,8 @@ discard block |
||
46 | 46 | } |
47 | 47 | |
48 | 48 | if (method_exists($this, 'getRecordOrdering')) { |
49 | - if ($this->recordOrdering === true && empty($sets[ 'record_ordering' ])) { |
|
50 | - $sets[ 'record_ordering' ] = $this->getRecordOrdering($this->table); |
|
49 | + if ($this->recordOrdering === true && empty($sets['record_ordering'])) { |
|
50 | + $sets['record_ordering'] = $this->getRecordOrdering($this->table); |
|
51 | 51 | } |
52 | 52 | } |
53 | 53 | |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | protected function insertOrUpdate(array $sets) |
68 | 68 | { |
69 | 69 | // Try to find |
70 | - if($result = $this->qb->from($this->table)->getWhere($sets)) { |
|
70 | + if ($result = $this->qb->from($this->table)->getWhere($sets)) { |
|
71 | 71 | return $this->update($sets); |
72 | 72 | } else { |
73 | 73 | return $this->insert($sets); |
@@ -82,8 +82,8 @@ discard block |
||
82 | 82 | foreach ($sets as $set) { |
83 | 83 | $this->insertRecordSets($set); |
84 | 84 | |
85 | - if ($this->recordOrdering === true && empty($sets[ 'record_ordering' ])) { |
|
86 | - $set[ 'record_ordering' ] = $this->getRecordOrdering($this->table); |
|
85 | + if ($this->recordOrdering === true && empty($sets['record_ordering'])) { |
|
86 | + $set['record_ordering'] = $this->getRecordOrdering($this->table); |
|
87 | 87 | } |
88 | 88 | } |
89 | 89 | } |
@@ -121,10 +121,10 @@ discard block |
||
121 | 121 | |
122 | 122 | if (empty($where)) { |
123 | 123 | if (empty($this->primaryKeys)) { |
124 | - $where[ $primaryKey ] = $sets[ $primaryKey ]; |
|
124 | + $where[$primaryKey] = $sets[$primaryKey]; |
|
125 | 125 | } else { |
126 | 126 | foreach ($this->primaryKeys as $primaryKey) { |
127 | - $where[ $primaryKey ] = $sets[ $primaryKey ]; |
|
127 | + $where[$primaryKey] = $sets[$primaryKey]; |
|
128 | 128 | } |
129 | 129 | } |
130 | 130 | } |
@@ -142,8 +142,8 @@ discard block |
||
142 | 142 | } |
143 | 143 | |
144 | 144 | if (method_exists($this, 'getRecordOrdering')) { |
145 | - if ($this->recordOrdering === true && empty($sets[ 'record_ordering' ])) { |
|
146 | - $sets[ 'record_ordering' ] = $this->getRecordOrdering($this->table); |
|
145 | + if ($this->recordOrdering === true && empty($sets['record_ordering'])) { |
|
146 | + $sets['record_ordering'] = $this->getRecordOrdering($this->table); |
|
147 | 147 | } |
148 | 148 | } |
149 | 149 | |
@@ -195,10 +195,10 @@ discard block |
||
195 | 195 | |
196 | 196 | if (empty($where)) { |
197 | 197 | if (empty($this->primaryKeys)) { |
198 | - $where[ $primaryKey ] = $sets[ $primaryKey ]; |
|
198 | + $where[$primaryKey] = $sets[$primaryKey]; |
|
199 | 199 | } else { |
200 | 200 | foreach ($this->primaryKeys as $primaryKey) { |
201 | - $where[ $primaryKey ] = $sets[ $primaryKey ]; |
|
201 | + $where[$primaryKey] = $sets[$primaryKey]; |
|
202 | 202 | } |
203 | 203 | } |
204 | 204 | } |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | $this->primaryKeys = []; |
209 | 209 | |
210 | 210 | // Try to find |
211 | - if($result = $this->qb->from($this->table)->getWhere($where)) { |
|
211 | + if ($result = $this->qb->from($this->table)->getWhere($where)) { |
|
212 | 212 | return $this->update($sets, $where); |
213 | 213 | } else { |
214 | 214 | return $this->insert($sets); |
@@ -225,11 +225,11 @@ discard block |
||
225 | 225 | |
226 | 226 | $where = []; |
227 | 227 | if (empty($this->primaryKeys)) { |
228 | - $where[ $primaryKey ] = $sets[ $primaryKey ]; |
|
229 | - $this->qb->where($primaryKey, $sets[ $primaryKey ]); |
|
228 | + $where[$primaryKey] = $sets[$primaryKey]; |
|
229 | + $this->qb->where($primaryKey, $sets[$primaryKey]); |
|
230 | 230 | } else { |
231 | 231 | foreach ($this->primaryKeys as $primaryKey) { |
232 | - $where[ $primaryKey ] = $sets[ $primaryKey ]; |
|
232 | + $where[$primaryKey] = $sets[$primaryKey]; |
|
233 | 233 | } |
234 | 234 | } |
235 | 235 | |
@@ -241,8 +241,8 @@ discard block |
||
241 | 241 | foreach ($sets as $set) { |
242 | 242 | $this->updateRecordSets($set); |
243 | 243 | |
244 | - if ($this->recordOrdering === true && empty($sets[ 'record_ordering' ])) { |
|
245 | - $set[ 'record_ordering' ] = $this->getRecordOrdering($this->table); |
|
244 | + if ($this->recordOrdering === true && empty($sets['record_ordering'])) { |
|
245 | + $set['record_ordering'] = $this->getRecordOrdering($this->table); |
|
246 | 246 | } |
247 | 247 | } |
248 | 248 | } |
@@ -279,19 +279,19 @@ discard block |
||
279 | 279 | $where = []; |
280 | 280 | |
281 | 281 | if (empty($this->primaryKeys)) { |
282 | - $where[ $primaryKey ] = $id; |
|
283 | - $sets[ $primaryKey ] = $id; |
|
282 | + $where[$primaryKey] = $id; |
|
283 | + $sets[$primaryKey] = $id; |
|
284 | 284 | } elseif (is_array($id)) { |
285 | 285 | foreach ($this->primaryKeys as $primaryKey) { |
286 | - $where[ $primaryKey ] = $sets[ $primaryKey ]; |
|
287 | - $sets[ $primaryKey ] = $id[ $primaryKey ]; |
|
286 | + $where[$primaryKey] = $sets[$primaryKey]; |
|
287 | + $sets[$primaryKey] = $id[$primaryKey]; |
|
288 | 288 | } |
289 | 289 | } else { |
290 | 290 | foreach ($this->primaryKeys as $primaryKey) { |
291 | - $where[ $primaryKey ] = $sets[ $primaryKey ]; |
|
291 | + $where[$primaryKey] = $sets[$primaryKey]; |
|
292 | 292 | } |
293 | 293 | |
294 | - $sets[ reset($this->primaryKeys) ] = $id; |
|
294 | + $sets[reset($this->primaryKeys)] = $id; |
|
295 | 295 | } |
296 | 296 | |
297 | 297 | // Reset Primary Keys |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | $affectedRows = []; |
342 | 342 | |
343 | 343 | foreach ($ids as $id) { |
344 | - $affectedRows[ $id ] = $this->softDelete($id); |
|
344 | + $affectedRows[$id] = $this->softDelete($id); |
|
345 | 345 | } |
346 | 346 | |
347 | 347 | return $affectedRows; |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | $affectedRows = []; |
355 | 355 | |
356 | 356 | foreach ($ids as $id) { |
357 | - $affectedRows[ $id ] = $this->softDeleteBy($id, $where); |
|
357 | + $affectedRows[$id] = $this->softDeleteBy($id, $where); |
|
358 | 358 | } |
359 | 359 | |
360 | 360 | return $affectedRows; |
@@ -368,13 +368,13 @@ discard block |
||
368 | 368 | |
369 | 369 | $where = []; |
370 | 370 | if (empty($this->primaryKeys)) { |
371 | - $where[ $primaryKey ] = $id; |
|
371 | + $where[$primaryKey] = $id; |
|
372 | 372 | } elseif (is_array($id)) { |
373 | 373 | foreach ($this->primaryKeys as $primaryKey) { |
374 | - $where[ $primaryKey ] = $id[ $primaryKey ]; |
|
374 | + $where[$primaryKey] = $id[$primaryKey]; |
|
375 | 375 | } |
376 | 376 | } else { |
377 | - $where[ reset($this->primaryKeys) ] = $id; |
|
377 | + $where[reset($this->primaryKeys)] = $id; |
|
378 | 378 | } |
379 | 379 | |
380 | 380 | // Reset Primary Keys |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | $affectedRows = []; |
413 | 413 | |
414 | 414 | foreach ($ids as $id) { |
415 | - $affectedRows[ $id ] = $this->delete($id, $force); |
|
415 | + $affectedRows[$id] = $this->delete($id, $force); |
|
416 | 416 | } |
417 | 417 | |
418 | 418 | return $affectedRows; |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | $affectedRows = []; |
424 | 424 | |
425 | 425 | foreach ($ids as $id) { |
426 | - $affectedRows[ $id ] = $this->deleteBy($id, $where, $force); |
|
426 | + $affectedRows[$id] = $this->deleteBy($id, $where, $force); |
|
427 | 427 | } |
428 | 428 | |
429 | 429 | return $affectedRows; |
@@ -439,19 +439,19 @@ discard block |
||
439 | 439 | $where = []; |
440 | 440 | |
441 | 441 | if (empty($this->primaryKeys)) { |
442 | - $where[ $primaryKey ] = $id; |
|
443 | - $sets[ $primaryKey ] = $id; |
|
442 | + $where[$primaryKey] = $id; |
|
443 | + $sets[$primaryKey] = $id; |
|
444 | 444 | } elseif (is_array($id)) { |
445 | 445 | foreach ($this->primaryKeys as $primaryKey) { |
446 | - $where[ $primaryKey ] = $sets[ $primaryKey ]; |
|
447 | - $sets[ $primaryKey ] = $id[ $primaryKey ]; |
|
446 | + $where[$primaryKey] = $sets[$primaryKey]; |
|
447 | + $sets[$primaryKey] = $id[$primaryKey]; |
|
448 | 448 | } |
449 | 449 | } else { |
450 | 450 | foreach ($this->primaryKeys as $primaryKey) { |
451 | - $where[ $primaryKey ] = $sets[ $primaryKey ]; |
|
451 | + $where[$primaryKey] = $sets[$primaryKey]; |
|
452 | 452 | } |
453 | 453 | |
454 | - $sets[ reset($this->primaryKeys) ] = $id; |
|
454 | + $sets[reset($this->primaryKeys)] = $id; |
|
455 | 455 | } |
456 | 456 | |
457 | 457 | // Reset Primary Keys |
@@ -494,7 +494,7 @@ discard block |
||
494 | 494 | $affectedRows = []; |
495 | 495 | |
496 | 496 | foreach ($ids as $id) { |
497 | - $affectedRows[ $id ] = $this->publish($id); |
|
497 | + $affectedRows[$id] = $this->publish($id); |
|
498 | 498 | } |
499 | 499 | |
500 | 500 | return $affectedRows; |
@@ -507,7 +507,7 @@ discard block |
||
507 | 507 | $affectedRows = []; |
508 | 508 | |
509 | 509 | foreach ($ids as $id) { |
510 | - $affectedRows[ $id ] = $this->publishBy($id, $where); |
|
510 | + $affectedRows[$id] = $this->publishBy($id, $where); |
|
511 | 511 | } |
512 | 512 | |
513 | 513 | return $affectedRows; |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | ]); |
86 | 86 | } |
87 | 87 | |
88 | - $update[ 'id' ] = $row->id; |
|
88 | + $update['id'] = $row->id; |
|
89 | 89 | |
90 | 90 | if ($this->hasChilds($row->id)) { |
91 | 91 | $right = $this->rebuildTree($row->id, $right, $depth + 1); |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | ->update($update = [ |
96 | 96 | 'record_right' => $right, |
97 | 97 | ]); |
98 | - $update[ 'id' ] = $row->id; |
|
98 | + $update['id'] = $row->id; |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | $i++; |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | { |
194 | 194 | $childs = []; |
195 | 195 | |
196 | - if($result = $this->qb |
|
196 | + if ($result = $this->qb |
|
197 | 197 | ->table($this->table) |
198 | 198 | ->where('id_parent', $idParent) |
199 | 199 | ->get()) { |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | */ |
222 | 222 | protected function getNumChilds($idParent) |
223 | 223 | { |
224 | - if($result = $this->qb |
|
224 | + if ($result = $this->qb |
|
225 | 225 | ->table($this->table) |
226 | 226 | ->select('id') |
227 | 227 | ->where('id_parent', $idParent) |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | if ($filepath === $filePath) { |
164 | 164 | continue; |
165 | 165 | } |
166 | - $this->validSubModels[ camelcase(pathinfo($filepath, PATHINFO_FILENAME)) ] = $filepath; |
|
166 | + $this->validSubModels[camelcase(pathinfo($filepath, PATHINFO_FILENAME))] = $filepath; |
|
167 | 167 | } |
168 | 168 | } |
169 | 169 | } |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | } |
211 | 211 | } |
212 | 212 | |
213 | - if (empty($get[ $property ])) { |
|
213 | + if (empty($get[$property])) { |
|
214 | 214 | if (services()->has($property)) { |
215 | 215 | return services()->get($property); |
216 | 216 | } elseif ($this->hasSubModel($property)) { |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | final protected function hasSubModel($model) |
252 | 252 | { |
253 | 253 | if (array_key_exists($model, $this->validSubModels)) { |
254 | - return (bool)is_file($this->validSubModels[ $model ]); |
|
254 | + return (bool)is_file($this->validSubModels[$model]); |
|
255 | 255 | } |
256 | 256 | |
257 | 257 | return false; |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | ); |
75 | 75 | |
76 | 76 | if ($this->config->offsetExists('extensions')) { |
77 | - $this->setFileExtensions($this->config[ 'extensions' ]); |
|
77 | + $this->setFileExtensions($this->config['extensions']); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | $this->document = new Html\Document(); |
@@ -90,13 +90,13 @@ discard block |
||
90 | 90 | */ |
91 | 91 | public function &__get($property) |
92 | 92 | { |
93 | - $get[ $property ] = false; |
|
93 | + $get[$property] = false; |
|
94 | 94 | |
95 | 95 | if (property_exists($this, $property)) { |
96 | 96 | return $this->{$property}; |
97 | 97 | } |
98 | 98 | |
99 | - return $get[ $property ]; |
|
99 | + return $get[$property]; |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | public function parse($string, array $vars = []) |
@@ -153,8 +153,8 @@ discard block |
||
153 | 153 | $error = new ErrorException( |
154 | 154 | 'E_VIEW_NOT_FOUND', |
155 | 155 | 0, |
156 | - @$backtrace[ 0 ][ 'file' ], |
|
157 | - @$backtrace[ 0 ][ 'line' ], |
|
156 | + @$backtrace[0]['file'], |
|
157 | + @$backtrace[0]['line'], |
|
158 | 158 | [trim($filename)] |
159 | 159 | ); |
160 | 160 | |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | |
301 | 301 | public function render(array $options = []) |
302 | 302 | { |
303 | - if(profiler() !== false) { |
|
303 | + if (profiler() !== false) { |
|
304 | 304 | profiler()->watch('Starting View Rendering'); |
305 | 305 | } |
306 | 306 | |
@@ -405,9 +405,9 @@ discard block |
||
405 | 405 | if ($this->config->output['uglify'] === true) { |
406 | 406 | $htmlOutput = preg_replace( |
407 | 407 | [ |
408 | - '/\>[^\S ]+/s', // strip whitespaces after tags, except space |
|
409 | - '/[^\S ]+\</s', // strip whitespaces before tags, except space |
|
410 | - '/(\s)+/s', // shorten multiple whitespace sequences |
|
408 | + '/\>[^\S ]+/s', // strip whitespaces after tags, except space |
|
409 | + '/[^\S ]+\</s', // strip whitespaces before tags, except space |
|
410 | + '/(\s)+/s', // shorten multiple whitespace sequences |
|
411 | 411 | '/<!--(.|\s)*?-->/', // Remove HTML comments |
412 | 412 | '/<!--(.*)-->/Uis', |
413 | 413 | "/[[:blank:]]+/", |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | $htmlOutput = $beautifier->format($htmlOutput); |
430 | 430 | } |
431 | 431 | |
432 | - if(profiler() !== false) { |
|
432 | + if (profiler() !== false) { |
|
433 | 433 | profiler()->watch('Ending View Rendering'); |
434 | 434 | } |
435 | 435 |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | { |
25 | 25 | public function &__get($property) |
26 | 26 | { |
27 | - $get[ $property ] = false; |
|
27 | + $get[$property] = false; |
|
28 | 28 | |
29 | 29 | // CodeIgniter property aliasing |
30 | 30 | if ($property === 'load') { |
@@ -32,15 +32,15 @@ discard block |
||
32 | 32 | } |
33 | 33 | |
34 | 34 | if (services()->has($property)) { |
35 | - $get[ $property ] = services()->get($property); |
|
35 | + $get[$property] = services()->get($property); |
|
36 | 36 | } elseif (o2system()->__isset($property)) { |
37 | - $get[ $property ] = o2system()->__get($property); |
|
37 | + $get[$property] = o2system()->__get($property); |
|
38 | 38 | } elseif ($property === 'model') { |
39 | - $get[ $property ] = models('controller'); |
|
39 | + $get[$property] = models('controller'); |
|
40 | 40 | } elseif ($property === 'services' || $property === 'libraries') { |
41 | - $get[ $property ] = services(); |
|
41 | + $get[$property] = services(); |
|
42 | 42 | } |
43 | 43 | |
44 | - return $get[ $property ]; |
|
44 | + return $get[$property]; |
|
45 | 45 | } |
46 | 46 | } |
47 | 47 | \ No newline at end of file |
@@ -34,7 +34,7 @@ |
||
34 | 34 | protected function filter($type, $offset = null, $filter = FILTER_DEFAULT) |
35 | 35 | { |
36 | 36 | if (services()->has('xssProtection')) { |
37 | - if (!services()->get('xssProtection')->verify()) { |
|
37 | + if ( ! services()->get('xssProtection')->verify()) { |
|
38 | 38 | $string = parent::filter($type, $offset, $filter); |
39 | 39 | |
40 | 40 | if (is_string($string)) { |
@@ -36,7 +36,7 @@ |
||
36 | 36 | { |
37 | 37 | if (services()->has('csrfProtection')) { |
38 | 38 | if (hash_equals(input()->server('REQUEST_METHOD'), 'POST')) { |
39 | - if (!services()->get('csrfProtection')->verify()) { |
|
39 | + if ( ! services()->get('csrfProtection')->verify()) { |
|
40 | 40 | output()->sendError(403, [ |
41 | 41 | 'message' => language()->getLine('403_INVALID_CSRF') |
42 | 42 | ]); |
@@ -33,12 +33,12 @@ discard block |
||
33 | 33 | { |
34 | 34 | // Create Page breadcrumbs |
35 | 35 | $breadcrumb = new Breadcrumb(); |
36 | - $breadcrumb->createList( new Link( language()->getLine( 'HOME' ), base_url() ) ); |
|
37 | - $this->store( 'breadcrumb', $breadcrumb ); |
|
36 | + $breadcrumb->createList(new Link(language()->getLine('HOME'), base_url())); |
|
37 | + $this->store('breadcrumb', $breadcrumb); |
|
38 | 38 | |
39 | 39 | // Store Page Uri |
40 | 40 | $uri = new Uri(); |
41 | - $this->store( 'uri', $uri ); |
|
41 | + $this->store('uri', $uri); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | // ------------------------------------------------------------------------ |
@@ -50,12 +50,12 @@ discard block |
||
50 | 50 | * |
51 | 51 | * @return static |
52 | 52 | */ |
53 | - public function setHeader( $header ) |
|
53 | + public function setHeader($header) |
|
54 | 54 | { |
55 | - $header = trim( $header ); |
|
56 | - $this->store( 'header', $header ); |
|
57 | - presenter()->meta->offsetSet( 'subtitle', $header ); |
|
58 | - presenter()->meta->title->append( $header ); |
|
55 | + $header = trim($header); |
|
56 | + $this->store('header', $header); |
|
57 | + presenter()->meta->offsetSet('subtitle', $header); |
|
58 | + presenter()->meta->title->append($header); |
|
59 | 59 | |
60 | 60 | return $this; |
61 | 61 | } |
@@ -69,9 +69,9 @@ discard block |
||
69 | 69 | * |
70 | 70 | * @return static |
71 | 71 | */ |
72 | - public function setSubHeader( $subHeader ) |
|
72 | + public function setSubHeader($subHeader) |
|
73 | 73 | { |
74 | - $this->store( 'subHeader', trim( $subHeader ) ); |
|
74 | + $this->store('subHeader', trim($subHeader)); |
|
75 | 75 | |
76 | 76 | return $this; |
77 | 77 | } |
@@ -85,10 +85,10 @@ discard block |
||
85 | 85 | * |
86 | 86 | * @return static |
87 | 87 | */ |
88 | - public function setDescription( $description ) |
|
88 | + public function setDescription($description) |
|
89 | 89 | { |
90 | - $description = trim( $description ); |
|
91 | - $this->store( 'description', $description ); |
|
90 | + $description = trim($description); |
|
91 | + $this->store('description', $description); |
|
92 | 92 | |
93 | 93 | return $this; |
94 | 94 | } |