@@ -26,7 +26,7 @@ |
||
| 26 | 26 | public function __construct() |
| 27 | 27 | { |
| 28 | 28 | $config = config()->get('logger'); |
| 29 | - $config[ 'path' ] = PATH_CACHE . 'log' . DIRECTORY_SEPARATOR; |
|
| 29 | + $config['path'] = PATH_CACHE.'log'.DIRECTORY_SEPARATOR; |
|
| 30 | 30 | |
| 31 | 31 | parent::__construct(new Config($config)); |
| 32 | 32 | } |
@@ -38,12 +38,12 @@ |
||
| 38 | 38 | $debugIpAddresses = config('ipAddresses')->offsetGet('debug'); |
| 39 | 39 | |
| 40 | 40 | if (in_array($clientIpAddress, $debugIpAddresses)) { |
| 41 | - $_ENV[ 'DEBUG_STAGE' ] = 'DEVELOPER'; |
|
| 41 | + $_ENV['DEBUG_STAGE'] = 'DEVELOPER'; |
|
| 42 | 42 | |
| 43 | 43 | error_reporting(-1); |
| 44 | 44 | ini_set('display_errors', 1); |
| 45 | 45 | |
| 46 | - if (isset($_REQUEST[ 'PHP_INFO' ])) { |
|
| 46 | + if (isset($_REQUEST['PHP_INFO'])) { |
|
| 47 | 47 | phpinfo(); |
| 48 | 48 | exit(EXIT_SUCCESS); |
| 49 | 49 | } |
@@ -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; |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | $this->setConfig($config->getArrayCopy()); |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - if ( ! models('users')) { |
|
| 48 | + if (!models('users')) { |
|
| 49 | 49 | throw new RuntimeException('ACL_E_UNDEFINED_USERS_MODEL'); |
| 50 | 50 | } |
| 51 | 51 | } |
@@ -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,8 +386,8 @@ 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' ], |
|
| 390 | - '/') . '" style="display: none; visibility: hidden;"></iframe>'; |
|
| 389 | + return '<iframe id="sign-on-iframe" width="1" height="1" src="'.rtrim($this->config['sso']['server'], |
|
| 390 | + '/').'" style="display: none; visibility: hidden;"></iframe>'; |
|
| 391 | 391 | } |
| 392 | 392 | |
| 393 | 393 | return ''; |
@@ -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 |
@@ -44,7 +44,7 @@ |
||
| 44 | 44 | parent::__construct($dir); |
| 45 | 45 | |
| 46 | 46 | // Set Properties |
| 47 | - if (is_file($propertiesFilePath = $dir . DIRECTORY_SEPARATOR . 'language.json')) { |
|
| 47 | + if (is_file($propertiesFilePath = $dir.DIRECTORY_SEPARATOR.'language.json')) { |
|
| 48 | 48 | $properties = json_decode(file_get_contents($propertiesFilePath), true); |
| 49 | 49 | |
| 50 | 50 | if (json_last_error() === JSON_ERROR_NONE) { |
@@ -36,23 +36,23 @@ discard block |
||
| 36 | 36 | $name = []; |
| 37 | 37 | |
| 38 | 38 | if (count($parts) == 1) { |
| 39 | - $name[ 'first' ] = $parts[ 0 ]; |
|
| 40 | - $name[ 'middle' ] = null; |
|
| 41 | - $name[ 'last' ] = null; |
|
| 39 | + $name['first'] = $parts[0]; |
|
| 40 | + $name['middle'] = null; |
|
| 41 | + $name['last'] = null; |
|
| 42 | 42 | } elseif (count($parts) == 2) { |
| 43 | - $name[ 'first' ] = $parts[ 0 ]; |
|
| 44 | - $name[ 'middle' ] = null; |
|
| 45 | - $name[ 'last' ] = $parts[ 1 ]; |
|
| 43 | + $name['first'] = $parts[0]; |
|
| 44 | + $name['middle'] = null; |
|
| 45 | + $name['last'] = $parts[1]; |
|
| 46 | 46 | } elseif (count($parts) == 3) { |
| 47 | - $name[ 'first' ] = $parts[ 0 ]; |
|
| 48 | - $name[ 'middle' ] = $parts[ 1 ]; |
|
| 49 | - $name[ 'last' ] = $parts[ 2 ]; |
|
| 47 | + $name['first'] = $parts[0]; |
|
| 48 | + $name['middle'] = $parts[1]; |
|
| 49 | + $name['last'] = $parts[2]; |
|
| 50 | 50 | } else { |
| 51 | - $name[ 'first' ] = $parts[ 0 ]; |
|
| 52 | - $name[ 'middle' ] = $parts[ 1 ]; |
|
| 51 | + $name['first'] = $parts[0]; |
|
| 52 | + $name['middle'] = $parts[1]; |
|
| 53 | 53 | |
| 54 | 54 | $parts = array_slice($parts, 2); |
| 55 | - $name[ 'last' ] = implode(' ', $parts); |
|
| 55 | + $name['last'] = implode(' ', $parts); |
|
| 56 | 56 | } |
| 57 | 57 | } |
| 58 | 58 | |
@@ -73,13 +73,13 @@ discard block |
||
| 73 | 73 | $name = $this->offsetGet('first'); |
| 74 | 74 | |
| 75 | 75 | if ($this->offsetExists('middle')) { |
| 76 | - $name .= ' ' . $this->offsetGet('middle'); |
|
| 76 | + $name .= ' '.$this->offsetGet('middle'); |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | if ($this->offsetExists('last')) { |
| 80 | - $name .= ' ' . $this->offsetGet('last'); |
|
| 80 | + $name .= ' '.$this->offsetGet('last'); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - return (string)trim($name); |
|
| 83 | + return (string) trim($name); |
|
| 84 | 84 | } |
| 85 | 85 | } |
| 86 | 86 | \ No newline at end of file |
@@ -32,16 +32,16 @@ |
||
| 32 | 32 | { |
| 33 | 33 | $money = []; |
| 34 | 34 | if (is_numeric($amount)) { |
| 35 | - $money[ 'amount' ] = (int)$amount; |
|
| 35 | + $money['amount'] = (int) $amount; |
|
| 36 | 36 | } elseif (is_array($amount)) { |
| 37 | 37 | $money = $amount; |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - (int)$storage[ 'amount' ] = 0; |
|
| 41 | - $storage[ 'currency' ] = config()->getItem('units')->currency; |
|
| 40 | + (int) $storage['amount'] = 0; |
|
| 41 | + $storage['currency'] = config()->getItem('units')->currency; |
|
| 42 | 42 | |
| 43 | 43 | $storage = array_merge($storage, $money); |
| 44 | - (int)$storage[ 'amount' ] = empty($storage[ 'amount' ]) ? 0 : abs($storage[ 'amount' ]); |
|
| 44 | + (int) $storage['amount'] = empty($storage['amount']) ? 0 : abs($storage['amount']); |
|
| 45 | 45 | |
| 46 | 46 | $this->storage = $storage; |
| 47 | 47 | } |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | * A collection of helper function to work with object. |
| 16 | 16 | */ |
| 17 | 17 | // ------------------------------------------------------------------------ |
| 18 | -if ( ! function_exists('get_object_var')) { |
|
| 18 | +if (!function_exists('get_object_var')) { |
|
| 19 | 19 | /** |
| 20 | 20 | * get_object_var |
| 21 | 21 | * |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | // ------------------------------------------------------------------------ |
| 12 | 12 | |
| 13 | -if ( ! function_exists('base_url')) { |
|
| 13 | +if (!function_exists('base_url')) { |
|
| 14 | 14 | /** |
| 15 | 15 | * base_url |
| 16 | 16 | * |
@@ -26,9 +26,9 @@ discard block |
||
| 26 | 26 | ->withQuery(''); |
| 27 | 27 | |
| 28 | 28 | if ($uriConfig = config()->offsetGet('uri')) { |
| 29 | - if ( ! empty($uriConfig[ 'base' ])) { |
|
| 30 | - $base = (is_https() ? 'https' : 'http') . '://' . str_replace(['http://', 'https://'], '', |
|
| 31 | - $uriConfig[ 'base' ]); |
|
| 29 | + if (!empty($uriConfig['base'])) { |
|
| 30 | + $base = (is_https() ? 'https' : 'http').'://'.str_replace(['http://', 'https://'], '', |
|
| 31 | + $uriConfig['base']); |
|
| 32 | 32 | $uri = new \O2System\Kernel\Http\Message\Uri($base); |
| 33 | 33 | } |
| 34 | 34 | } |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | |
| 48 | 48 | // ------------------------------------------------------------------------ |
| 49 | 49 | |
| 50 | -if ( ! function_exists('domain_url')) { |
|
| 50 | +if (!function_exists('domain_url')) { |
|
| 51 | 51 | /** |
| 52 | 52 | * domain_url |
| 53 | 53 | * |
@@ -64,9 +64,9 @@ discard block |
||
| 64 | 64 | ->withQuery(''); |
| 65 | 65 | |
| 66 | 66 | if ($uriConfig = config()->offsetGet('uri')) { |
| 67 | - if ( ! empty($uriConfig[ 'base' ])) { |
|
| 68 | - $base = (is_https() ? 'https' : 'http') . '://' . str_replace(['http://', 'https://'], '', |
|
| 69 | - $uriConfig[ 'base' ]); |
|
| 67 | + if (!empty($uriConfig['base'])) { |
|
| 68 | + $base = (is_https() ? 'https' : 'http').'://'.str_replace(['http://', 'https://'], '', |
|
| 69 | + $uriConfig['base']); |
|
| 70 | 70 | $uri = new \O2System\Kernel\Http\Message\Uri($base); |
| 71 | 71 | } |
| 72 | 72 | } |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | |
| 90 | 90 | // ------------------------------------------------------------------------ |
| 91 | 91 | |
| 92 | -if ( ! function_exists('current_url')) { |
|
| 92 | +if (!function_exists('current_url')) { |
|
| 93 | 93 | /** |
| 94 | 94 | * current_url |
| 95 | 95 | * |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | } |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | -if ( ! function_exists('public_url')) { |
|
| 117 | +if (!function_exists('public_url')) { |
|
| 118 | 118 | /** |
| 119 | 119 | * public_url |
| 120 | 120 | * |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | |
| 131 | 131 | // ------------------------------------------------------------------------ |
| 132 | 132 | |
| 133 | -if ( ! function_exists('assets_url')) { |
|
| 133 | +if (!function_exists('assets_url')) { |
|
| 134 | 134 | /** |
| 135 | 135 | * assets_url |
| 136 | 136 | * |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | |
| 147 | 147 | // ------------------------------------------------------------------------ |
| 148 | 148 | |
| 149 | -if ( ! function_exists('storage_url')) { |
|
| 149 | +if (!function_exists('storage_url')) { |
|
| 150 | 150 | /** |
| 151 | 151 | * storage_url |
| 152 | 152 | * |
@@ -158,13 +158,13 @@ discard block |
||
| 158 | 158 | { |
| 159 | 159 | $urlPath = str_replace(PATH_STORAGE, '', $path); |
| 160 | 160 | |
| 161 | - return base_url('storage/' . $urlPath); |
|
| 161 | + return base_url('storage/'.$urlPath); |
|
| 162 | 162 | } |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | // ------------------------------------------------------------------------ |
| 166 | 166 | |
| 167 | -if ( ! function_exists('images_url')) { |
|
| 167 | +if (!function_exists('images_url')) { |
|
| 168 | 168 | /** |
| 169 | 169 | * images_url |
| 170 | 170 | * |
@@ -176,13 +176,13 @@ discard block |
||
| 176 | 176 | { |
| 177 | 177 | $urlPath = str_replace(PATH_STORAGE, '', $path); |
| 178 | 178 | |
| 179 | - return base_url('images/' . $urlPath); |
|
| 179 | + return base_url('images/'.$urlPath); |
|
| 180 | 180 | } |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | // ------------------------------------------------------------------------ |
| 184 | 184 | |
| 185 | -if ( ! function_exists('prepare_url')) { |
|
| 185 | +if (!function_exists('prepare_url')) { |
|
| 186 | 186 | /** |
| 187 | 187 | * prepare_url |
| 188 | 188 | * |
@@ -212,8 +212,8 @@ discard block |
||
| 212 | 212 | |
| 213 | 213 | $url = parse_url($uri); |
| 214 | 214 | |
| 215 | - if ( ! $url or ! isset($url[ 'scheme' ])) { |
|
| 216 | - return (is_https() ? 'https://' : 'http://') . $uri; |
|
| 215 | + if (!$url or !isset($url['scheme'])) { |
|
| 216 | + return (is_https() ? 'https://' : 'http://').$uri; |
|
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | return $uri; |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | |
| 223 | 223 | // ------------------------------------------------------------------------ |
| 224 | 224 | |
| 225 | -if ( ! function_exists('redirect_url')) { |
|
| 225 | +if (!function_exists('redirect_url')) { |
|
| 226 | 226 | /** |
| 227 | 227 | * redirect_url |
| 228 | 228 | * |
@@ -248,15 +248,15 @@ discard block |
||
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | // IIS environment likely? Use 'refresh' for better compatibility |
| 251 | - if ($method === 'auto' && isset($_SERVER[ 'SERVER_SOFTWARE' ]) && strpos( |
|
| 252 | - $_SERVER[ 'SERVER_SOFTWARE' ], |
|
| 251 | + if ($method === 'auto' && isset($_SERVER['SERVER_SOFTWARE']) && strpos( |
|
| 252 | + $_SERVER['SERVER_SOFTWARE'], |
|
| 253 | 253 | 'Microsoft-IIS' |
| 254 | 254 | ) !== false |
| 255 | 255 | ) { |
| 256 | 256 | $method = 'refresh'; |
| 257 | - } elseif ($method !== 'refresh' && (empty($code) OR ! is_numeric($code))) { |
|
| 258 | - if (isset($_SERVER[ 'SERVER_PROTOCOL' ], $_SERVER[ 'REQUEST_METHOD' ]) && $_SERVER[ 'SERVER_PROTOCOL' ] === 'HTTP/1.1') { |
|
| 259 | - $code = ($_SERVER[ 'REQUEST_METHOD' ] !== 'GET') |
|
| 257 | + } elseif ($method !== 'refresh' && (empty($code) OR !is_numeric($code))) { |
|
| 258 | + if (isset($_SERVER['SERVER_PROTOCOL'], $_SERVER['REQUEST_METHOD']) && $_SERVER['SERVER_PROTOCOL'] === 'HTTP/1.1') { |
|
| 259 | + $code = ($_SERVER['REQUEST_METHOD'] !== 'GET') |
|
| 260 | 260 | ? 303 // reference: http://en.wikipedia.org/wiki/Post/Redirect/Get |
| 261 | 261 | : 307; |
| 262 | 262 | } else { |
@@ -266,10 +266,10 @@ discard block |
||
| 266 | 266 | |
| 267 | 267 | switch ($method) { |
| 268 | 268 | case 'refresh': |
| 269 | - header('Refresh:0;url=' . $uri); |
|
| 269 | + header('Refresh:0;url='.$uri); |
|
| 270 | 270 | break; |
| 271 | 271 | default: |
| 272 | - header('Location: ' . $uri, true, $code); |
|
| 272 | + header('Location: '.$uri, true, $code); |
|
| 273 | 273 | break; |
| 274 | 274 | } |
| 275 | 275 | |