@@ -29,11 +29,11 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public function __construct() |
31 | 31 | { |
32 | - if (empty($_SESSION[ 'o2system' ][ 'cart' ])) { |
|
33 | - $_SESSION[ 'o2system' ][ 'cart' ] = []; |
|
32 | + if (empty($_SESSION['o2system']['cart'])) { |
|
33 | + $_SESSION['o2system']['cart'] = []; |
|
34 | 34 | } |
35 | 35 | |
36 | - $this->storage =& $_SESSION[ 'o2system' ][ 'cart' ]; |
|
36 | + $this->storage = & $_SESSION['o2system']['cart']; |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | // ------------------------------------------------------------------------ |
@@ -56,29 +56,29 @@ discard block |
||
56 | 56 | ], $item); |
57 | 57 | |
58 | 58 | // set sku |
59 | - $sku = empty($item[ 'sku' ]) ? $item[ 'id' ] : $item[ 'sku' ]; |
|
59 | + $sku = empty($item['sku']) ? $item['id'] : $item['sku']; |
|
60 | 60 | |
61 | 61 | // set sub-total |
62 | - $item[ 'subTotal' ][ 'price' ] = $item[ 'price' ] * $item[ 'quantity' ]; |
|
63 | - $item[ 'subTotal' ][ 'discount' ] = 0; |
|
62 | + $item['subTotal']['price'] = $item['price'] * $item['quantity']; |
|
63 | + $item['subTotal']['discount'] = 0; |
|
64 | 64 | |
65 | - if (is_numeric($item[ 'discount' ])) { |
|
66 | - $item[ 'subTotal' ][ 'discount' ] = $item[ 'subTotal' ][ 'price' ] - $item[ 'discount' ]; |
|
67 | - } elseif (is_string($item[ 'discount' ]) && strpos($item[ 'discount' ], '+') !== false) { |
|
68 | - $discounts = explode('+', $item[ 'discount' ]); |
|
65 | + if (is_numeric($item['discount'])) { |
|
66 | + $item['subTotal']['discount'] = $item['subTotal']['price'] - $item['discount']; |
|
67 | + } elseif (is_string($item['discount']) && strpos($item['discount'], '+') !== false) { |
|
68 | + $discounts = explode('+', $item['discount']); |
|
69 | 69 | if (count($discounts)) { |
70 | - $item[ 'subTotal' ][ 'discount' ] = $item[ 'subTotal' ][ 'price' ] * (intval(reset($discounts)) / 100); |
|
70 | + $item['subTotal']['discount'] = $item['subTotal']['price'] * (intval(reset($discounts)) / 100); |
|
71 | 71 | foreach (array_slice($discounts, 1) as $discount) { |
72 | - $item[ 'subTotal' ][ 'discount' ] += $item[ 'subTotal' ][ 'discount' ] * (intval($discount) / 100); |
|
72 | + $item['subTotal']['discount'] += $item['subTotal']['discount'] * (intval($discount) / 100); |
|
73 | 73 | } |
74 | 74 | } |
75 | - } elseif (is_string($item[ 'discount' ]) && strpos($item[ 'discount' ], '%') !== false) { |
|
76 | - $item[ 'subTotal' ][ 'discount' ] = $item[ 'subTotal' ][ 'price' ] * (intval($item[ 'discount' ]) / 100); |
|
75 | + } elseif (is_string($item['discount']) && strpos($item['discount'], '%') !== false) { |
|
76 | + $item['subTotal']['discount'] = $item['subTotal']['price'] * (intval($item['discount']) / 100); |
|
77 | 77 | } |
78 | 78 | |
79 | - $item[ 'subTotal' ][ 'weight' ] = $item[ 'weight' ] * $item[ 'quantity' ]; |
|
79 | + $item['subTotal']['weight'] = $item['weight'] * $item['quantity']; |
|
80 | 80 | |
81 | - $this->storage[ $sku ] = $item; |
|
81 | + $this->storage[$sku] = $item; |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | // ------------------------------------------------------------------------ |
@@ -97,10 +97,10 @@ discard block |
||
97 | 97 | $item = array_merge($this->offsetGet($sku), $item); |
98 | 98 | |
99 | 99 | // update sub-total |
100 | - $item[ 'subTotal' ][ 'price' ] = $item[ 'price' ] * $item[ 'quantity' ]; |
|
101 | - $item[ 'subTotal' ][ 'weight' ] = $item[ 'weight' ] * $item[ 'quantity' ]; |
|
100 | + $item['subTotal']['price'] = $item['price'] * $item['quantity']; |
|
101 | + $item['subTotal']['weight'] = $item['weight'] * $item['quantity']; |
|
102 | 102 | |
103 | - $this->storage[ $sku ] = $item; |
|
103 | + $this->storage[$sku] = $item; |
|
104 | 104 | |
105 | 105 | return true; |
106 | 106 | } |
@@ -121,8 +121,8 @@ discard block |
||
121 | 121 | |
122 | 122 | if ($this->count()) { |
123 | 123 | foreach ($this->storage as $id => $item) { |
124 | - if (isset($item[ 'subTotal' ][ 'weight' ])) { |
|
125 | - $totalWeight += (int)$item[ 'weight' ]; |
|
124 | + if (isset($item['subTotal']['weight'])) { |
|
125 | + $totalWeight += (int)$item['weight']; |
|
126 | 126 | } |
127 | 127 | } |
128 | 128 | } |
@@ -143,8 +143,8 @@ discard block |
||
143 | 143 | |
144 | 144 | if ($this->count()) { |
145 | 145 | foreach ($this->storage as $id => $item) { |
146 | - if (isset($item[ 'subTotal' ][ 'price' ])) { |
|
147 | - $totalPrice += (int)$item[ 'price' ]; |
|
146 | + if (isset($item['subTotal']['price'])) { |
|
147 | + $totalPrice += (int)$item['price']; |
|
148 | 148 | } |
149 | 149 | } |
150 | 150 | } |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | */ |
160 | 160 | public function destroy() |
161 | 161 | { |
162 | - unset($_SESSION[ 'o2system' ][ 'cart' ]); |
|
162 | + unset($_SESSION['o2system']['cart']); |
|
163 | 163 | parent::destroy(); |
164 | 164 | } |
165 | 165 | } |
166 | 166 | \ No newline at end of file |
@@ -275,15 +275,15 @@ discard block |
||
275 | 275 | } elseif ($authority->first()->permission === 'GRANTED') { |
276 | 276 | // Access only granted cannot do modifier access |
277 | 277 | foreach ([ |
278 | - 'form', |
|
279 | - 'add', |
|
280 | - 'add-as-new', |
|
281 | - 'edit', |
|
282 | - 'update', |
|
283 | - 'insert', |
|
284 | - 'create', |
|
285 | - 'delete', |
|
286 | - ] as $segment |
|
278 | + 'form', |
|
279 | + 'add', |
|
280 | + 'add-as-new', |
|
281 | + 'edit', |
|
282 | + 'update', |
|
283 | + 'insert', |
|
284 | + 'create', |
|
285 | + 'delete', |
|
286 | + ] as $segment |
|
287 | 287 | ) { |
288 | 288 | if (in_array($segment, $segments)) { |
289 | 289 | return false; |
@@ -303,15 +303,15 @@ discard block |
||
303 | 303 | } elseif ($authority->first()->permission === 'GRANTED') { |
304 | 304 | // Access only granted cannot do modifier access |
305 | 305 | foreach ([ |
306 | - 'form', |
|
307 | - 'add', |
|
308 | - 'add-as-new', |
|
309 | - 'edit', |
|
310 | - 'update', |
|
311 | - 'insert', |
|
312 | - 'create', |
|
313 | - 'delete', |
|
314 | - ] as $segment |
|
306 | + 'form', |
|
307 | + 'add', |
|
308 | + 'add-as-new', |
|
309 | + 'edit', |
|
310 | + 'update', |
|
311 | + 'insert', |
|
312 | + 'create', |
|
313 | + 'delete', |
|
314 | + ] as $segment |
|
315 | 315 | ) { |
316 | 316 | if (in_array($segment, $segments)) { |
317 | 317 | return false; |
@@ -99,10 +99,10 @@ discard block |
||
99 | 99 | if (isset($account)) { |
100 | 100 | foreach ($account as $key => $value) { |
101 | 101 | if (strpos($key, 'record') !== false) { |
102 | - unset($account[ $key ]); |
|
102 | + unset($account[$key]); |
|
103 | 103 | } elseif (in_array($key, |
104 | 104 | ['password', 'pin', 'token', 'sso', 'id_sys_user', 'id_sys_module', 'id_sys_module_role'])) { |
105 | - unset($account[ $key ]); |
|
105 | + unset($account[$key]); |
|
106 | 106 | } |
107 | 107 | } |
108 | 108 | |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | $column = 'id'; |
132 | 132 | } elseif (filter_var($username, FILTER_VALIDATE_EMAIL)) { |
133 | 133 | $column = 'email'; |
134 | - } elseif (preg_match($this->config[ 'msisdnRegex' ], $username)) { |
|
134 | + } elseif (preg_match($this->config['msisdnRegex'], $username)) { |
|
135 | 135 | $column = 'msisdn'; |
136 | 136 | } |
137 | 137 | |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | public function loggedIn() |
156 | 156 | { |
157 | 157 | if (parent::loggedIn()) { |
158 | - if(is_object($_SESSION['account'])) { |
|
158 | + if (is_object($_SESSION['account'])) { |
|
159 | 159 | $account = new Account($_SESSION['account']->getArrayCopy()); |
160 | 160 | $username = $account->user->username; |
161 | 161 | } else { |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | $column = 'id'; |
212 | 212 | } elseif (filter_var($username, FILTER_VALIDATE_EMAIL)) { |
213 | 213 | $column = 'email'; |
214 | - } elseif (preg_match($this->config[ 'msisdnRegex' ], $username)) { |
|
214 | + } elseif (preg_match($this->config['msisdnRegex'], $username)) { |
|
215 | 215 | $column = 'msisdn'; |
216 | 216 | } elseif (strpos($username, 'token-') !== false) { |
217 | 217 | $username = str_replace('token-', '', $username); |
@@ -226,15 +226,15 @@ discard block |
||
226 | 226 | |
227 | 227 | foreach ($account as $key => $value) { |
228 | 228 | if (strpos($key, 'record') !== false) { |
229 | - unset($account[ $key ]); |
|
229 | + unset($account[$key]); |
|
230 | 230 | } elseif (in_array($key, ['password', 'pin', 'token', 'sso'])) { |
231 | - unset($account[ $key ]); |
|
231 | + unset($account[$key]); |
|
232 | 232 | } |
233 | 233 | } |
234 | 234 | |
235 | 235 | if ($column === 'token') { |
236 | 236 | models('users')->update([ |
237 | - 'id' => $account[ 'id' ], |
|
237 | + 'id' => $account['id'], |
|
238 | 238 | 'token' => null, |
239 | 239 | ]); |
240 | 240 | } |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | public function getIframeCode() |
387 | 387 | { |
388 | 388 | if ($this->signedOn() && $this->loggedIn() === false) { |
389 | - return '<iframe id="sign-on-iframe" width="1" height="1" src="' . rtrim($this->config[ 'sso' ][ 'server' ], |
|
389 | + return '<iframe id="sign-on-iframe" width="1" height="1" src="' . rtrim($this->config['sso']['server'], |
|
390 | 390 | '/') . '" style="display: none; visibility: hidden;"></iframe>'; |
391 | 391 | } |
392 | 392 |
@@ -220,16 +220,16 @@ discard block |
||
220 | 220 | $familyRelationships = []; |
221 | 221 | |
222 | 222 | foreach ([ |
223 | - 'PARENT', |
|
224 | - 'CHILD', |
|
225 | - 'SPOUSE', |
|
226 | - 'SIBLING', |
|
227 | - 'GRANDPARENTS', |
|
228 | - 'GRANDCHILD', |
|
229 | - 'PARENTS_SIBLING', |
|
230 | - 'SIBLINGS_CHILD', |
|
231 | - 'AUNTS_UNCLES_CHILD', |
|
232 | - ] as $relationship |
|
223 | + 'PARENT', |
|
224 | + 'CHILD', |
|
225 | + 'SPOUSE', |
|
226 | + 'SIBLING', |
|
227 | + 'GRANDPARENTS', |
|
228 | + 'GRANDCHILD', |
|
229 | + 'PARENTS_SIBLING', |
|
230 | + 'SIBLINGS_CHILD', |
|
231 | + 'AUNTS_UNCLES_CHILD', |
|
232 | + ] as $relationship |
|
233 | 233 | ) { |
234 | 234 | $familyRelationships[ $relationship ] = $this->language->getLine($relationship); |
235 | 235 | } |
@@ -245,13 +245,13 @@ discard block |
||
245 | 245 | $statuses = []; |
246 | 246 | |
247 | 247 | foreach ([ |
248 | - 'PUBLISH', |
|
249 | - 'UNPUBLISH', |
|
250 | - 'DRAFT', |
|
251 | - 'ARCHIVED', |
|
252 | - 'DELETED', |
|
253 | - 'LOCKED' |
|
254 | - ] as $status |
|
248 | + 'PUBLISH', |
|
249 | + 'UNPUBLISH', |
|
250 | + 'DRAFT', |
|
251 | + 'ARCHIVED', |
|
252 | + 'DELETED', |
|
253 | + 'LOCKED' |
|
254 | + ] as $status |
|
255 | 255 | ) { |
256 | 256 | $statuses[ $status ] = $this->language->getLine($status); |
257 | 257 | } |
@@ -270,12 +270,12 @@ discard block |
||
270 | 270 | $visibilities = []; |
271 | 271 | |
272 | 272 | foreach ([ |
273 | - 'PUBLIC', |
|
274 | - 'PROTECTED', |
|
275 | - 'PRIVATE', |
|
276 | - 'READONLY', |
|
277 | - 'MEMBERONLY', |
|
278 | - ] as $visibility |
|
273 | + 'PUBLIC', |
|
274 | + 'PROTECTED', |
|
275 | + 'PRIVATE', |
|
276 | + 'READONLY', |
|
277 | + 'MEMBERONLY', |
|
278 | + ] as $visibility |
|
279 | 279 | ) { |
280 | 280 | $visibilities[ $visibility ] = $this->language->getLine($visibility); |
281 | 281 | } |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | $religions = []; |
41 | 41 | |
42 | 42 | foreach (['ATHEIST', 'HINDU', 'BUDDHA', 'MOSLEM', 'CHRISTIAN', 'CATHOLIC', 'UNDEFINED'] as $religion) { |
43 | - $religions[ $religion ] = $this->language->getLine($religion); |
|
43 | + $religions[$religion] = $this->language->getLine($religion); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | return $religions; |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | $genders = []; |
55 | 55 | |
56 | 56 | foreach (['MALE', 'FEMALE', 'UNDEFINED'] as $gender) { |
57 | - $genders[ $gender ] = $this->language->getLine($gender); |
|
57 | + $genders[$gender] = $this->language->getLine($gender); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | return $genders; |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | $maritals = []; |
69 | 69 | |
70 | 70 | foreach (['SINGLE', 'MARRIED', 'DIVORCED', 'UNDEFINED'] as $marital) { |
71 | - $maritals[ $marital ] = $this->language->getLine($marital); |
|
71 | + $maritals[$marital] = $this->language->getLine($marital); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | return $maritals; |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | $bloodTypes = []; |
83 | 83 | |
84 | 84 | foreach (['A', 'B', 'AB', 'O', 'UNDEFINED'] as $bloodType) { |
85 | - $bloodTypes[ $bloodType ] = $this->language->getLine($bloodType); |
|
85 | + $bloodTypes[$bloodType] = $this->language->getLine($bloodType); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | return $bloodTypes; |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | |
106 | 106 | for ($i = $start; $i <= $end; $i++) { |
107 | 107 | $time = strtotime($year . 'W' . $week . $i); |
108 | - $days[ strtoupper(date('D', $time)) ] = $this->language->getLine( |
|
108 | + $days[strtoupper(date('D', $time))] = $this->language->getLine( |
|
109 | 109 | 'CAL_' . strtoupper(date($labelFormat, $time))); |
110 | 110 | } |
111 | 111 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | if ($leading) { |
127 | 127 | $date = strlen($date) == 1 ? '0' . $date : $date; |
128 | 128 | } |
129 | - $dates[ $date ] = $date; |
|
129 | + $dates[$date] = $date; |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | return $dates; |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | if ($leading) { |
149 | 149 | $month = strlen($month) == 1 ? '0' . $month : $month; |
150 | 150 | } |
151 | - $months[ $month ] = $this->language->getLine(strtoupper('CAL_' . date('F', |
|
151 | + $months[$month] = $this->language->getLine(strtoupper('CAL_' . date('F', |
|
152 | 152 | strtotime('1-' . $month . '-2000')))); |
153 | 153 | } |
154 | 154 | |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | $years = []; |
167 | 167 | |
168 | 168 | foreach (range($start, $end) as $year) { |
169 | - $years[ $year ] = $year; |
|
169 | + $years[$year] = $year; |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | return $years; |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | $identities = []; |
181 | 181 | |
182 | 182 | foreach (['UNDEFINED', 'IDENTITY_CARD', 'STUDENT_CARD', 'DRIVER_LICENSE', 'PASSPORT'] as $identity) { |
183 | - $identities[ $identity ] = $this->language->getLine($identity); |
|
183 | + $identities[$identity] = $this->language->getLine($identity); |
|
184 | 184 | } |
185 | 185 | |
186 | 186 | return $identities; |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | { |
194 | 194 | $sizes = []; |
195 | 195 | foreach (['XS', 'S', 'M', 'L', 'XL', 'XXL', 'XXXL'] as $size) { |
196 | - $sizes[ $size ] = $size; |
|
196 | + $sizes[$size] = $size; |
|
197 | 197 | } |
198 | 198 | |
199 | 199 | return $sizes; |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | { |
207 | 207 | $boolean = []; |
208 | 208 | foreach (['YES', 'NO'] as $bool) { |
209 | - $boolean[ $bool ] = $this->language->getLine('BOOL_' . $bool); |
|
209 | + $boolean[$bool] = $this->language->getLine('BOOL_' . $bool); |
|
210 | 210 | } |
211 | 211 | |
212 | 212 | return $boolean; |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | 'AUNTS_UNCLES_CHILD', |
232 | 232 | ] as $relationship |
233 | 233 | ) { |
234 | - $familyRelationships[ $relationship ] = $this->language->getLine($relationship); |
|
234 | + $familyRelationships[$relationship] = $this->language->getLine($relationship); |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | return $familyRelationships; |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | 'LOCKED' |
254 | 254 | ] as $status |
255 | 255 | ) { |
256 | - $statuses[ $status ] = $this->language->getLine($status); |
|
256 | + $statuses[$status] = $this->language->getLine($status); |
|
257 | 257 | } |
258 | 258 | |
259 | 259 | return $statuses; |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | 'MEMBERONLY', |
278 | 278 | ] as $visibility |
279 | 279 | ) { |
280 | - $visibilities[ $visibility ] = $this->language->getLine($visibility); |
|
280 | + $visibilities[$visibility] = $this->language->getLine($visibility); |
|
281 | 281 | } |
282 | 282 | |
283 | 283 | return $visibilities; |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | $languages = []; |
296 | 296 | |
297 | 297 | foreach ($this->language->getRegistry() as $language) { |
298 | - $languages[ $language->getParameter() ] = $language->getProperties()->name; |
|
298 | + $languages[$language->getParameter()] = $language->getProperties()->name; |
|
299 | 299 | } |
300 | 300 | |
301 | 301 | return $languages; |