@@ -78,57 +78,57 @@ |
||
78 | 78 | |
79 | 79 | $timestamp = $this->isUnixTimestamp === true ? strtotime(date('Y-m-d H:i:s')) : date('Y-m-d H:i:s'); |
80 | 80 | |
81 | - if ( ! isset($sets[ 'record_status' ])) { |
|
82 | - $sets[ 'record_status' ] = $this->recordStatus; |
|
81 | + if ( ! isset($sets['record_status'])) { |
|
82 | + $sets['record_status'] = $this->recordStatus; |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | if (empty($this->primary_keys)) { |
86 | 86 | $primary_key = isset($this->primary_key) ? $this->primary_key : 'id'; |
87 | 87 | |
88 | - if (empty($sets[ $primary_key ])) { |
|
89 | - if ( ! isset($sets[ 'record_create_user' ])) { |
|
90 | - $sets[ 'record_create_user' ] = $this->recordUser; |
|
88 | + if (empty($sets[$primary_key])) { |
|
89 | + if ( ! isset($sets['record_create_user'])) { |
|
90 | + $sets['record_create_user'] = $this->recordUser; |
|
91 | 91 | } |
92 | 92 | |
93 | - if ( ! isset($sets[ 'record_create_timestamp' ])) { |
|
94 | - $sets[ 'record_create_timestamp' ] = $timestamp; |
|
93 | + if ( ! isset($sets['record_create_timestamp'])) { |
|
94 | + $sets['record_create_timestamp'] = $timestamp; |
|
95 | 95 | } |
96 | 96 | } |
97 | 97 | } else { |
98 | 98 | foreach ($this->primary_keys as $primary_key) { |
99 | - if (empty($sets[ $primary_key ])) { |
|
100 | - if ( ! isset($sets[ 'record_create_user' ])) { |
|
101 | - $sets[ 'record_create_user' ] = $this->recordUser; |
|
99 | + if (empty($sets[$primary_key])) { |
|
100 | + if ( ! isset($sets['record_create_user'])) { |
|
101 | + $sets['record_create_user'] = $this->recordUser; |
|
102 | 102 | } |
103 | 103 | |
104 | - if ( ! isset($sets[ 'record_create_timestamp' ])) { |
|
105 | - $sets[ 'record_create_timestamp' ] = $timestamp; |
|
104 | + if ( ! isset($sets['record_create_timestamp'])) { |
|
105 | + $sets['record_create_timestamp'] = $timestamp; |
|
106 | 106 | } |
107 | 107 | } |
108 | 108 | } |
109 | 109 | } |
110 | 110 | |
111 | - $sets[ 'record_update_user' ] = $this->recordUser; |
|
111 | + $sets['record_update_user'] = $this->recordUser; |
|
112 | 112 | |
113 | - if ( ! isset($sets[ 'record_update_timestamp' ])) { |
|
114 | - $sets[ 'record_update_timestamp' ] = $timestamp; |
|
113 | + if ( ! isset($sets['record_update_timestamp'])) { |
|
114 | + $sets['record_update_timestamp'] = $timestamp; |
|
115 | 115 | } |
116 | 116 | } |
117 | 117 | |
118 | 118 | protected function updateRecordSets(array &$sets) |
119 | 119 | { |
120 | - $sets[ 'record_status' ] = $this->recordStatus; |
|
121 | - $sets[ 'record_update_user' ] = $this->recordUser; |
|
120 | + $sets['record_status'] = $this->recordStatus; |
|
121 | + $sets['record_update_user'] = $this->recordUser; |
|
122 | 122 | |
123 | 123 | $timestamp = $this->isUnixTimestamp === true ? strtotime(date('Y-m-d H:i:s')) : date('Y-m-d H:i:s'); |
124 | 124 | |
125 | - if ( ! isset($sets[ 'record_update_timestamp' ])) { |
|
126 | - $sets[ 'record_update_timestamp' ] = $timestamp; |
|
125 | + if ( ! isset($sets['record_update_timestamp'])) { |
|
126 | + $sets['record_update_timestamp'] = $timestamp; |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | if ($this->recordStatus === 'PUBLISH') { |
130 | - $sets[ 'record_delete_timestamp' ] = null; |
|
131 | - $sets[ 'record_delete_user' ] = null; |
|
130 | + $sets['record_delete_timestamp'] = null; |
|
131 | + $sets['record_delete_user'] = null; |
|
132 | 132 | } |
133 | 133 | } |
134 | 134 | } |
135 | 135 | \ No newline at end of file |
@@ -81,10 +81,10 @@ discard block |
||
81 | 81 | |
82 | 82 | if (empty($where)) { |
83 | 83 | if (empty($this->primaryKeys)) { |
84 | - $where[ $primaryKey ] = $sets[ $primaryKey ]; |
|
84 | + $where[$primaryKey] = $sets[$primaryKey]; |
|
85 | 85 | } else { |
86 | 86 | foreach ($this->primaryKeys as $primaryKey) { |
87 | - $where[ $primaryKey ] = $sets[ $primaryKey ]; |
|
87 | + $where[$primaryKey] = $sets[$primaryKey]; |
|
88 | 88 | } |
89 | 89 | } |
90 | 90 | } |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | $collection = isset($collection) ? $collection : $this->collection; |
119 | 119 | |
120 | 120 | if (method_exists($this, 'insertRecordSets')) { |
121 | - foreach($sets as $set) { |
|
121 | + foreach ($sets as $set) { |
|
122 | 122 | $this->insertRecordSets($set); |
123 | 123 | } |
124 | 124 | } |
@@ -147,11 +147,11 @@ discard block |
||
147 | 147 | |
148 | 148 | $where = []; |
149 | 149 | if (empty($this->primaryKeys)) { |
150 | - $where[ $primaryKey ] = $sets[ $primaryKey ]; |
|
151 | - $this->qb->where($primaryKey, $sets[ $primaryKey ]); |
|
150 | + $where[$primaryKey] = $sets[$primaryKey]; |
|
151 | + $this->qb->where($primaryKey, $sets[$primaryKey]); |
|
152 | 152 | } else { |
153 | 153 | foreach ($this->primaryKeys as $primaryKey) { |
154 | - $where[ $primaryKey ] = $sets[ $primaryKey ]; |
|
154 | + $where[$primaryKey] = $sets[$primaryKey]; |
|
155 | 155 | } |
156 | 156 | } |
157 | 157 | |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | $this->primaryKeys = []; |
161 | 161 | |
162 | 162 | if (method_exists($this, 'updateRecordSets')) { |
163 | - foreach($sets as $set) { |
|
163 | + foreach ($sets as $set) { |
|
164 | 164 | $this->updateRecordSets($set); |
165 | 165 | } |
166 | 166 | } |
@@ -199,19 +199,19 @@ discard block |
||
199 | 199 | $where = []; |
200 | 200 | |
201 | 201 | if (empty($this->primaryKeys)) { |
202 | - $where[ $primaryKey ] = $id; |
|
203 | - $sets[ $primaryKey ] = $id; |
|
202 | + $where[$primaryKey] = $id; |
|
203 | + $sets[$primaryKey] = $id; |
|
204 | 204 | } elseif (is_array($id)) { |
205 | 205 | foreach ($this->primaryKeys as $primaryKey) { |
206 | - $where[ $primaryKey ] = $sets[ $primaryKey ]; |
|
207 | - $sets[ $primaryKey ] = $id[ $primaryKey ]; |
|
206 | + $where[$primaryKey] = $sets[$primaryKey]; |
|
207 | + $sets[$primaryKey] = $id[$primaryKey]; |
|
208 | 208 | } |
209 | 209 | } else { |
210 | 210 | foreach ($this->primaryKeys as $primaryKey) { |
211 | - $where[ $primaryKey ] = $sets[ $primaryKey ]; |
|
211 | + $where[$primaryKey] = $sets[$primaryKey]; |
|
212 | 212 | } |
213 | 213 | |
214 | - $sets[ reset($this->primaryKeys) ] = $id; |
|
214 | + $sets[reset($this->primaryKeys)] = $id; |
|
215 | 215 | } |
216 | 216 | |
217 | 217 | // Reset Primary Keys |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | $affectedRows = []; |
262 | 262 | |
263 | 263 | foreach ($ids as $id) { |
264 | - $affectedRows[ $id ] = $this->trash($id); |
|
264 | + $affectedRows[$id] = $this->trash($id); |
|
265 | 265 | } |
266 | 266 | |
267 | 267 | return $affectedRows; |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | $affectedRows = []; |
275 | 275 | |
276 | 276 | foreach ($ids as $id) { |
277 | - $affectedRows[ $id ] = $this->trashBy($id, $where, $collection); |
|
277 | + $affectedRows[$id] = $this->trashBy($id, $where, $collection); |
|
278 | 278 | } |
279 | 279 | |
280 | 280 | return $affectedRows; |
@@ -292,13 +292,13 @@ discard block |
||
292 | 292 | |
293 | 293 | $where = []; |
294 | 294 | if (empty($this->primaryKeys)) { |
295 | - $where[ $primaryKey ] = $id; |
|
295 | + $where[$primaryKey] = $id; |
|
296 | 296 | } elseif (is_array($id)) { |
297 | 297 | foreach ($this->primaryKeys as $primaryKey) { |
298 | - $where[ $primaryKey ] = $id[ $primaryKey ]; |
|
298 | + $where[$primaryKey] = $id[$primaryKey]; |
|
299 | 299 | } |
300 | 300 | } else { |
301 | - $where[ reset($this->primaryKeys) ] = $id; |
|
301 | + $where[reset($this->primaryKeys)] = $id; |
|
302 | 302 | } |
303 | 303 | |
304 | 304 | // Reset Primary Keys |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | $affectedRows = []; |
337 | 337 | |
338 | 338 | foreach ($ids as $id) { |
339 | - $affectedRows[ $id ] = $this->delete($id, $force, $collection); |
|
339 | + $affectedRows[$id] = $this->delete($id, $force, $collection); |
|
340 | 340 | } |
341 | 341 | |
342 | 342 | return $affectedRows; |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | $affectedRows = []; |
348 | 348 | |
349 | 349 | foreach ($ids as $id) { |
350 | - $affectedRows[ $id ] = $this->deleteBy($id, $where, $force, $collection); |
|
350 | + $affectedRows[$id] = $this->deleteBy($id, $where, $force, $collection); |
|
351 | 351 | } |
352 | 352 | |
353 | 353 | return $affectedRows; |
@@ -364,19 +364,19 @@ discard block |
||
364 | 364 | $where = []; |
365 | 365 | |
366 | 366 | if (empty($this->primaryKeys)) { |
367 | - $where[ $primaryKey ] = $id; |
|
368 | - $sets[ $primaryKey ] = $id; |
|
367 | + $where[$primaryKey] = $id; |
|
368 | + $sets[$primaryKey] = $id; |
|
369 | 369 | } elseif (is_array($id)) { |
370 | 370 | foreach ($this->primaryKeys as $primaryKey) { |
371 | - $where[ $primaryKey ] = $sets[ $primaryKey ]; |
|
372 | - $sets[ $primaryKey ] = $id[ $primaryKey ]; |
|
371 | + $where[$primaryKey] = $sets[$primaryKey]; |
|
372 | + $sets[$primaryKey] = $id[$primaryKey]; |
|
373 | 373 | } |
374 | 374 | } else { |
375 | 375 | foreach ($this->primaryKeys as $primaryKey) { |
376 | - $where[ $primaryKey ] = $sets[ $primaryKey ]; |
|
376 | + $where[$primaryKey] = $sets[$primaryKey]; |
|
377 | 377 | } |
378 | 378 | |
379 | - $sets[ reset($this->primaryKeys) ] = $id; |
|
379 | + $sets[reset($this->primaryKeys)] = $id; |
|
380 | 380 | } |
381 | 381 | |
382 | 382 | // Reset Primary Keys |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | $affectedRows = []; |
420 | 420 | |
421 | 421 | foreach ($ids as $id) { |
422 | - $affectedRows[ $id ] = $this->publish($id, $collection); |
|
422 | + $affectedRows[$id] = $this->publish($id, $collection); |
|
423 | 423 | } |
424 | 424 | |
425 | 425 | return $affectedRows; |
@@ -432,7 +432,7 @@ discard block |
||
432 | 432 | $affectedRows = []; |
433 | 433 | |
434 | 434 | foreach ($ids as $id) { |
435 | - $affectedRows[ $id ] = $this->publishBy($id, $where, $collection); |
|
435 | + $affectedRows[$id] = $this->publishBy($id, $where, $collection); |
|
436 | 436 | } |
437 | 437 | |
438 | 438 | return $affectedRows; |
@@ -77,58 +77,58 @@ |
||
77 | 77 | { |
78 | 78 | $timestamp = $this->unixTimestamp === true ? strtotime(date('Y-m-d H:i:s')) : date('Y-m-d H:i:s'); |
79 | 79 | |
80 | - if ( ! isset($sets[ 'record_status' ])) { |
|
81 | - $sets[ 'record_status' ] = $this->recordStatus; |
|
80 | + if ( ! isset($sets['record_status'])) { |
|
81 | + $sets['record_status'] = $this->recordStatus; |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | if (empty($this->primaryKeys)) { |
85 | 85 | $primaryKey = isset($this->primaryKey) ? $this->primaryKey : 'id'; |
86 | 86 | |
87 | - if (empty($sets[ $primaryKey ])) { |
|
88 | - if ( ! isset($sets[ 'record_create_user' ])) { |
|
89 | - $sets[ 'record_create_user' ] = $this->recordUser; |
|
87 | + if (empty($sets[$primaryKey])) { |
|
88 | + if ( ! isset($sets['record_create_user'])) { |
|
89 | + $sets['record_create_user'] = $this->recordUser; |
|
90 | 90 | } |
91 | 91 | |
92 | - if ( ! isset($sets[ 'record_create_timestamp' ])) { |
|
93 | - $sets[ 'record_create_timestamp' ] = $timestamp; |
|
92 | + if ( ! isset($sets['record_create_timestamp'])) { |
|
93 | + $sets['record_create_timestamp'] = $timestamp; |
|
94 | 94 | } elseif ($this->unixTimestamp) { |
95 | - $sets[ 'record_create_timestamp' ] = strtotime($sets[ 'record_create_timestamp' ]); |
|
95 | + $sets['record_create_timestamp'] = strtotime($sets['record_create_timestamp']); |
|
96 | 96 | } |
97 | 97 | } |
98 | 98 | } else { |
99 | 99 | foreach ($this->primaryKeys as $primaryKey) { |
100 | - if (empty($sets[ $primaryKey ])) { |
|
101 | - if ( ! isset($sets[ 'record_create_user' ])) { |
|
102 | - $sets[ 'record_create_user' ] = $this->recordUser; |
|
100 | + if (empty($sets[$primaryKey])) { |
|
101 | + if ( ! isset($sets['record_create_user'])) { |
|
102 | + $sets['record_create_user'] = $this->recordUser; |
|
103 | 103 | } |
104 | 104 | |
105 | - if ( ! isset($sets[ 'record_create_timestamp' ])) { |
|
106 | - $sets[ 'record_create_timestamp' ] = $timestamp; |
|
105 | + if ( ! isset($sets['record_create_timestamp'])) { |
|
106 | + $sets['record_create_timestamp'] = $timestamp; |
|
107 | 107 | } elseif ($this->unixTimestamp) { |
108 | - $sets[ 'record_create_timestamp' ] = strtotime($sets[ 'record_create_timestamp' ]); |
|
108 | + $sets['record_create_timestamp'] = strtotime($sets['record_create_timestamp']); |
|
109 | 109 | } |
110 | 110 | } |
111 | 111 | } |
112 | 112 | } |
113 | 113 | |
114 | - $sets[ 'record_update_user' ] = $this->recordUser; |
|
114 | + $sets['record_update_user'] = $this->recordUser; |
|
115 | 115 | |
116 | - if ( ! isset($sets[ 'record_update_timestamp' ])) { |
|
117 | - $sets[ 'record_update_timestamp' ] = $timestamp; |
|
116 | + if ( ! isset($sets['record_update_timestamp'])) { |
|
117 | + $sets['record_update_timestamp'] = $timestamp; |
|
118 | 118 | } elseif ($this->unixTimestamp) { |
119 | - $sets[ 'record_update_timestamp' ] = strtotime($sets[ 'record_update_timestamp' ]); |
|
119 | + $sets['record_update_timestamp'] = strtotime($sets['record_update_timestamp']); |
|
120 | 120 | } |
121 | 121 | } |
122 | 122 | |
123 | 123 | protected function updateRecordSets(array &$sets) |
124 | 124 | { |
125 | - $sets[ 'record_status' ] = $this->recordStatus; |
|
126 | - $sets[ 'record_update_user' ] = $this->recordUser; |
|
125 | + $sets['record_status'] = $this->recordStatus; |
|
126 | + $sets['record_update_user'] = $this->recordUser; |
|
127 | 127 | |
128 | 128 | $timestamp = $this->unixTimestamp === true ? strtotime(date('Y-m-d H:i:s')) : date('Y-m-d H:i:s'); |
129 | 129 | |
130 | - if ( ! isset($sets[ 'record_update_timestamp' ])) { |
|
131 | - $sets[ 'record_update_timestamp' ] = $timestamp; |
|
130 | + if ( ! isset($sets['record_update_timestamp'])) { |
|
131 | + $sets['record_update_timestamp'] = $timestamp; |
|
132 | 132 | } |
133 | 133 | } |
134 | 134 |
@@ -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 |
@@ -40,7 +40,7 @@ |
||
40 | 40 | $intermediaryReferenceForeignKey = null |
41 | 41 | ) { |
42 | 42 | |
43 | - $this->currentModel =& $currentModel; |
|
43 | + $this->currentModel = & $currentModel; |
|
44 | 44 | $this->currentTable = $currentModel->table; |
45 | 45 | $this->currentPrimaryKey = $currentModel->primaryKey; |
46 | 46 |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | $ormResult = new \SplFixedArray($result->count()); |
46 | 46 | |
47 | 47 | foreach ($result as $key => $row) { |
48 | - $ormResult[ $key ] = new Result\Row($row, $model); |
|
48 | + $ormResult[$key] = new Result\Row($row, $model); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | parent::__construct($ormResult->toArray()); |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | $rows = empty($rows) ? 0 : $rows; |
75 | 75 | |
76 | 76 | $limit = input()->get('limit'); |
77 | - $limit = empty( $limit ) ? $this->info->limit : $limit; |
|
77 | + $limit = empty($limit) ? $this->info->limit : $limit; |
|
78 | 78 | |
79 | 79 | return new Pagination($rows, $limit); |
80 | 80 | } |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | |
62 | 62 | public function offsetGet($offset) |
63 | 63 | { |
64 | - if($this->offsetExists($offset)) { |
|
64 | + if ($this->offsetExists($offset)) { |
|
65 | 65 | return parent::offsetGet($offset); |
66 | 66 | } elseif (null !== ($result = $this->__call($offset))) { |
67 | 67 | return $result; |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | if (method_exists($model, $method)) { |
80 | 80 | $model->row = $this; |
81 | 81 | |
82 | - if(false !== ($result = call_user_func_array([&$model, $method], $args))) { |
|
82 | + if (false !== ($result = call_user_func_array([&$model, $method], $args))) { |
|
83 | 83 | $this->offsetSet($method, $result); |
84 | 84 | |
85 | 85 | return $result; |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | $args = func_get_args(); |
56 | 56 | |
57 | 57 | if ($countArgs = count($args)) { |
58 | - if(services()->has('config')) { |
|
58 | + if (services()->has('config')) { |
|
59 | 59 | $config = services('config'); |
60 | 60 | |
61 | 61 | if ($countArgs == 1) { |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | */ |
83 | 83 | function cache() |
84 | 84 | { |
85 | - if(services()->has('cache')) { |
|
85 | + if (services()->has('cache')) { |
|
86 | 86 | return services()->get('cache'); |
87 | 87 | } |
88 | 88 | |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | */ |
103 | 103 | function hooks() |
104 | 104 | { |
105 | - if(services()->has('hooks')) { |
|
105 | + if (services()->has('hooks')) { |
|
106 | 106 | return services()->get('hooks'); |
107 | 107 | } |
108 | 108 | |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | $args = func_get_args(); |
142 | 142 | |
143 | 143 | if (count($args)) { |
144 | - return o2system()->models->get($args[ 0 ]); |
|
144 | + return o2system()->models->get($args[0]); |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | return o2system()->models; |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | $args = func_get_args(); |
164 | 164 | |
165 | 165 | if (count($args)) { |
166 | - return o2system()->modules->getModule($args[ 0 ]); |
|
166 | + return o2system()->modules->getModule($args[0]); |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | return o2system()->modules; |
@@ -201,8 +201,8 @@ discard block |
||
201 | 201 | $args = func_get_args(); |
202 | 202 | |
203 | 203 | if (count($args)) { |
204 | - if(isset($_SESSION[ $args[0] ])) { |
|
205 | - return $_SESSION[ $args[0] ]; |
|
204 | + if (isset($_SESSION[$args[0]])) { |
|
205 | + return $_SESSION[$args[0]]; |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | return null; |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | $args = func_get_args(); |
244 | 244 | |
245 | 245 | if (count($args)) { |
246 | - if(services()->has('view')) { |
|
246 | + if (services()->has('view')) { |
|
247 | 247 | $view = services('view'); |
248 | 248 | |
249 | 249 | return call_user_func_array([&$view, 'load'], $args); |
@@ -37,9 +37,9 @@ |
||
37 | 37 | public function __construct() |
38 | 38 | { |
39 | 39 | if ($config = config()->loadFile('database', true)) { |
40 | - if ( ! empty($config[ 'default' ][ 'hostname' ]) AND ! empty($config[ 'default' ][ 'username' ])) { |
|
40 | + if ( ! empty($config['default']['hostname']) AND ! empty($config['default']['username'])) { |
|
41 | 41 | |
42 | - if(profiler() !== false) { |
|
42 | + if (profiler() !== false) { |
|
43 | 43 | profiler()->watch('Starting Database Service'); |
44 | 44 | } |
45 | 45 |