@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | $column = 'id'; |
| 64 | 64 | } elseif (filter_var($username, FILTER_VALIDATE_EMAIL)) { |
| 65 | 65 | $column = 'email'; |
| 66 | - } elseif (preg_match($this->config[ 'msisdnRegex' ], $username)) { |
|
| 66 | + } elseif (preg_match($this->config['msisdnRegex'], $username)) { |
|
| 67 | 67 | $column = 'msisdn'; |
| 68 | 68 | } |
| 69 | 69 | |
@@ -86,10 +86,10 @@ discard block |
||
| 86 | 86 | if (isset($account)) { |
| 87 | 87 | foreach ($account as $key => $value) { |
| 88 | 88 | if (strpos($key, 'record') !== false) { |
| 89 | - unset($account[ $key ]); |
|
| 89 | + unset($account[$key]); |
|
| 90 | 90 | } elseif (in_array($key, |
| 91 | 91 | ['password', 'pin', 'token', 'sso', 'id_sys_user', 'id_sys_module', 'id_sys_module_role'])) { |
| 92 | - unset($account[ $key ]); |
|
| 92 | + unset($account[$key]); |
|
| 93 | 93 | } |
| 94 | 94 | } |
| 95 | 95 | |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | public function loggedIn() |
| 114 | 114 | { |
| 115 | 115 | if (parent::loggedIn()) { |
| 116 | - $account = new Account($_SESSION[ 'account' ]); |
|
| 116 | + $account = new Account($_SESSION['account']); |
|
| 117 | 117 | |
| 118 | 118 | if ($user = models('users')->findWhere(['username' => $account->username], 1)) { |
| 119 | 119 | // Store Account Profile |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | $column = 'id'; |
| 163 | 163 | } elseif (filter_var($username, FILTER_VALIDATE_EMAIL)) { |
| 164 | 164 | $column = 'email'; |
| 165 | - } elseif (preg_match($this->config[ 'msisdnRegex' ], $username)) { |
|
| 165 | + } elseif (preg_match($this->config['msisdnRegex'], $username)) { |
|
| 166 | 166 | $column = 'msisdn'; |
| 167 | 167 | } elseif (strpos($username, 'token-') !== false) { |
| 168 | 168 | $username = str_replace('token-', '', $username); |
@@ -177,15 +177,15 @@ discard block |
||
| 177 | 177 | |
| 178 | 178 | foreach ($account as $key => $value) { |
| 179 | 179 | if (strpos($key, 'record') !== false) { |
| 180 | - unset($account[ $key ]); |
|
| 180 | + unset($account[$key]); |
|
| 181 | 181 | } elseif (in_array($key, ['password', 'pin', 'token', 'sso'])) { |
| 182 | - unset($account[ $key ]); |
|
| 182 | + unset($account[$key]); |
|
| 183 | 183 | } |
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | if ($column === 'token') { |
| 187 | 187 | models('users')->update([ |
| 188 | - 'id' => $account[ 'id' ], |
|
| 188 | + 'id' => $account['id'], |
|
| 189 | 189 | 'token' => null, |
| 190 | 190 | ]); |
| 191 | 191 | } |
@@ -209,9 +209,9 @@ discard block |
||
| 209 | 209 | */ |
| 210 | 210 | public function authorize(ServerRequest $request) |
| 211 | 211 | { |
| 212 | - if (isset($GLOBALS[ 'account' ][ 'role' ])) { |
|
| 212 | + if (isset($GLOBALS['account']['role'])) { |
|
| 213 | 213 | $uriSegments = $request->getUri()->getSegments()->getString(); |
| 214 | - $role = $GLOBALS[ 'account' ][ 'role' ]; |
|
| 214 | + $role = $GLOBALS['account']['role']; |
|
| 215 | 215 | if (in_array($role->code, ['DEVELOPER', 'ADMINISTRATOR'])) { |
| 216 | 216 | globals()->store('authority', new Authority([ |
| 217 | 217 | 'permission' => 'GRANTED', |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | public function getIframeCode() |
| 252 | 252 | { |
| 253 | 253 | if ($this->signedOn() && $this->loggedIn() === false) { |
| 254 | - return '<iframe id="sign-on-iframe" width="1" height="1" src="' . rtrim($this->config[ 'sso' ][ 'server' ], |
|
| 254 | + return '<iframe id="sign-on-iframe" width="1" height="1" src="' . rtrim($this->config['sso']['server'], |
|
| 255 | 255 | '/') . '" style="display: none; visibility: hidden;"></iframe>'; |
| 256 | 256 | } |
| 257 | 257 | |
@@ -420,12 +420,12 @@ discard block |
||
| 420 | 420 | $session->set('language', language()->getDefault()); |
| 421 | 421 | } |
| 422 | 422 | |
| 423 | - if (config('security')->protection[ 'csrf' ] === true) { |
|
| 423 | + if (config('security')->protection['csrf'] === true) { |
|
| 424 | 424 | $csrfProtection = new Security\Protections\Csrf(); |
| 425 | 425 | $this->services->add($csrfProtection, 'csrfProtection'); |
| 426 | 426 | } |
| 427 | 427 | |
| 428 | - if (config('security')->protection[ 'xss' ] === true) { |
|
| 428 | + if (config('security')->protection['xss'] === true) { |
|
| 429 | 429 | $xssProtection = new Security\Protections\Xss(); |
| 430 | 430 | $this->services->add($xssProtection, 'xssProtection'); |
| 431 | 431 | } |
@@ -484,7 +484,7 @@ discard block |
||
| 484 | 484 | $module->loadModel(); |
| 485 | 485 | |
| 486 | 486 | // Add View Resource Directory |
| 487 | - if($this->services->has('view')) { |
|
| 487 | + if ($this->services->has('view')) { |
|
| 488 | 488 | view()->addFilePath($module->getResourcesDir()); |
| 489 | 489 | presenter()->assets->pushFilePath($module->getResourcesDir()); |
| 490 | 490 | } |
@@ -608,7 +608,7 @@ discard block |
||
| 608 | 608 | } |
| 609 | 609 | |
| 610 | 610 | if (presenter()->partials->offsetExists('content')) { |
| 611 | - if(is_ajax()) { |
|
| 611 | + if (is_ajax()) { |
|
| 612 | 612 | echo presenter()->partials->content; |
| 613 | 613 | } else { |
| 614 | 614 | $htmlOutput = view()->render(); |
@@ -196,10 +196,10 @@ discard block |
||
| 196 | 196 | */ |
| 197 | 197 | public function setProperties(array $properties) |
| 198 | 198 | { |
| 199 | - if (isset($properties[ 'presets' ])) { |
|
| 200 | - $this->setPresets($properties[ 'presets' ]); |
|
| 199 | + if (isset($properties['presets'])) { |
|
| 200 | + $this->setPresets($properties['presets']); |
|
| 201 | 201 | |
| 202 | - unset($properties[ 'presets' ]); |
|
| 202 | + unset($properties['presets']); |
|
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | $this->properties = $properties; |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | $themes = []; |
| 290 | 290 | foreach ($directory->getTree() as $themeName => $themeTree) { |
| 291 | 291 | if (($theme = $this->getTheme($themeName)) instanceof Module\Theme) { |
| 292 | - $themes[ $themeName ] = $theme; |
|
| 292 | + $themes[$themeName] = $theme; |
|
| 293 | 293 | } |
| 294 | 294 | } |
| 295 | 295 | |
@@ -312,9 +312,9 @@ discard block |
||
| 312 | 312 | $dirPath = str_replace(PATH_APP, '', $this->getRealPath()); |
| 313 | 313 | $dirPathParts = explode(DIRECTORY_SEPARATOR, $dirPath); |
| 314 | 314 | |
| 315 | - if(count($dirPathParts)) { |
|
| 315 | + if (count($dirPathParts)) { |
|
| 316 | 316 | $dirPathParts = array_map('dash', $dirPathParts); |
| 317 | - $dirResources.= implode(DIRECTORY_SEPARATOR, $dirPathParts); |
|
| 317 | + $dirResources .= implode(DIRECTORY_SEPARATOR, $dirPathParts); |
|
| 318 | 318 | } |
| 319 | 319 | |
| 320 | 320 | if (is_null($subDir)) { |
@@ -61,9 +61,9 @@ discard block |
||
| 61 | 61 | $properties = json_decode(file_get_contents($propFilePath), true); |
| 62 | 62 | |
| 63 | 63 | if (json_last_error() === JSON_ERROR_NONE) { |
| 64 | - if (isset($properties[ 'config' ])) { |
|
| 65 | - $this->presets = $properties[ 'presets' ]; |
|
| 66 | - unset($properties[ 'presets' ]); |
|
| 64 | + if (isset($properties['config'])) { |
|
| 65 | + $this->presets = $properties['presets']; |
|
| 66 | + unset($properties['presets']); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | $this->properties = $properties; |
@@ -197,10 +197,10 @@ discard block |
||
| 197 | 197 | { |
| 198 | 198 | $extensions = ['.php', '.phtml', '.html', '.tpl']; |
| 199 | 199 | |
| 200 | - if (isset($this->presets[ 'extensions' ])) { |
|
| 201 | - array_unshift($partialsExtensions, $this->presets[ 'extension' ]); |
|
| 202 | - } elseif (isset($this->presets[ 'extension' ])) { |
|
| 203 | - array_unshift($extensions, $this->presets[ 'extension' ]); |
|
| 200 | + if (isset($this->presets['extensions'])) { |
|
| 201 | + array_unshift($partialsExtensions, $this->presets['extension']); |
|
| 202 | + } elseif (isset($this->presets['extension'])) { |
|
| 203 | + array_unshift($extensions, $this->presets['extension']); |
|
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | $found = false; |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | } |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | - return (bool) $found; |
|
| 222 | + return (bool)$found; |
|
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | // ------------------------------------------------------------------------ |
@@ -235,10 +235,10 @@ discard block |
||
| 235 | 235 | { |
| 236 | 236 | $extensions = ['.php', '.phtml', '.html', '.tpl']; |
| 237 | 237 | |
| 238 | - if (isset($this->presets[ 'extensions' ])) { |
|
| 239 | - array_unshift($partialsExtensions, $this->presets[ 'extension' ]); |
|
| 240 | - } elseif (isset($this->presets[ 'extension' ])) { |
|
| 241 | - array_unshift($extensions, $this->presets[ 'extension' ]); |
|
| 238 | + if (isset($this->presets['extensions'])) { |
|
| 239 | + array_unshift($partialsExtensions, $this->presets['extension']); |
|
| 240 | + } elseif (isset($this->presets['extension'])) { |
|
| 241 | + array_unshift($extensions, $this->presets['extension']); |
|
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | foreach ($extensions as $extension) { |
@@ -173,13 +173,13 @@ discard block |
||
| 173 | 173 | |
| 174 | 174 | if (isset($config) AND is_array($config)) { |
| 175 | 175 | // Set default timezone |
| 176 | - if (isset($config[ 'datetime' ][ 'timezone' ])) { |
|
| 177 | - date_default_timezone_set($config[ 'datetime' ][ 'timezone' ]); |
|
| 176 | + if (isset($config['datetime']['timezone'])) { |
|
| 177 | + date_default_timezone_set($config['datetime']['timezone']); |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | // Setup Language Ideom and Locale |
| 181 | - if (isset($config[ 'language' ])) { |
|
| 182 | - language()->setDefault($config[ 'language' ]); |
|
| 181 | + if (isset($config['language'])) { |
|
| 182 | + language()->setDefault($config['language']); |
|
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | config()->merge($config); |
@@ -409,8 +409,8 @@ discard block |
||
| 409 | 409 | $packageJsonFile = str_replace(['\\', '/'], DIRECTORY_SEPARATOR, $packageJsonFile); |
| 410 | 410 | $packageJsonFileInfo = pathinfo($packageJsonFile); |
| 411 | 411 | |
| 412 | - if ($packageJsonFileInfo[ 'filename' ] === 'widget' or |
|
| 413 | - $packageJsonFileInfo[ 'filename' ] === 'language' or |
|
| 412 | + if ($packageJsonFileInfo['filename'] === 'widget' or |
|
| 413 | + $packageJsonFileInfo['filename'] === 'language' or |
|
| 414 | 414 | strpos($packageJsonFile, '.svn') !== false // subversion properties file conflict. |
| 415 | 415 | ) { |
| 416 | 416 | continue; |
@@ -440,8 +440,8 @@ discard block |
||
| 440 | 440 | } |
| 441 | 441 | |
| 442 | 442 | if (strpos($packageJsonFile, |
| 443 | - $modularType = ucfirst(plural($packageJsonFileInfo[ 'filename' ])) . DIRECTORY_SEPARATOR) === false) { |
|
| 444 | - $modularType = ucfirst($packageJsonFileInfo[ 'filename' ]) . DIRECTORY_SEPARATOR; |
|
| 443 | + $modularType = ucfirst(plural($packageJsonFileInfo['filename'])) . DIRECTORY_SEPARATOR) === false) { |
|
| 444 | + $modularType = ucfirst($packageJsonFileInfo['filename']) . DIRECTORY_SEPARATOR; |
|
| 445 | 445 | } |
| 446 | 446 | |
| 447 | 447 | $modularType = strtolower(rtrim($modularType, DIRECTORY_SEPARATOR)); |
@@ -456,7 +456,7 @@ discard block |
||
| 456 | 456 | PATH_PUBLIC, |
| 457 | 457 | PATH_RESOURCES, |
| 458 | 458 | PATH_APP, |
| 459 | - $packageJsonFileInfo[ 'basename' ], |
|
| 459 | + $packageJsonFileInfo['basename'], |
|
| 460 | 460 | ucfirst($modularType) . DIRECTORY_SEPARATOR, |
| 461 | 461 | ], |
| 462 | 462 | '', |
@@ -466,7 +466,7 @@ discard block |
||
| 466 | 466 | ) |
| 467 | 467 | ); |
| 468 | 468 | |
| 469 | - $moduleSegments = array_map(function ($string) { |
|
| 469 | + $moduleSegments = array_map(function($string) { |
|
| 470 | 470 | return dash(snakecase($string)); |
| 471 | 471 | }, $moduleSegments); |
| 472 | 472 | |
@@ -474,14 +474,14 @@ discard block |
||
| 474 | 474 | str_replace( |
| 475 | 475 | PATH_ROOT, |
| 476 | 476 | '', |
| 477 | - $packageJsonFileInfo[ 'dirname' ] |
|
| 477 | + $packageJsonFileInfo['dirname'] |
|
| 478 | 478 | ), |
| 479 | 479 | false |
| 480 | 480 | ); |
| 481 | 481 | |
| 482 | - if (isset($packageJsonMetadata[ 'namespace' ])) { |
|
| 483 | - $moduleNamespace = $packageJsonMetadata[ 'namespace' ]; |
|
| 484 | - unset($packageJsonMetadata[ 'namespace' ]); |
|
| 482 | + if (isset($packageJsonMetadata['namespace'])) { |
|
| 483 | + $moduleNamespace = $packageJsonMetadata['namespace']; |
|
| 484 | + unset($packageJsonMetadata['namespace']); |
|
| 485 | 485 | } |
| 486 | 486 | |
| 487 | 487 | $moduleParentSegments = []; |
@@ -495,16 +495,16 @@ discard block |
||
| 495 | 495 | $registryKey = implode('/', $moduleSegments); |
| 496 | 496 | |
| 497 | 497 | if ($registryKey === '') { |
| 498 | - if ($packageJsonFileInfo[ 'dirname' ] . DIRECTORY_SEPARATOR !== PATH_APP and $modularType === 'app') { |
|
| 498 | + if ($packageJsonFileInfo['dirname'] . DIRECTORY_SEPARATOR !== PATH_APP and $modularType === 'app') { |
|
| 499 | 499 | $registryKey = dash(snakecase( |
| 500 | - pathinfo($packageJsonFileInfo[ 'dirname' ], PATHINFO_FILENAME))); |
|
| 500 | + pathinfo($packageJsonFileInfo['dirname'], PATHINFO_FILENAME))); |
|
| 501 | 501 | } |
| 502 | 502 | } |
| 503 | 503 | |
| 504 | - $registry[ $registryKey ] = (new DataStructures\Module( |
|
| 505 | - $packageJsonFileInfo[ 'dirname' ] |
|
| 504 | + $registry[$registryKey] = (new DataStructures\Module( |
|
| 505 | + $packageJsonFileInfo['dirname'] |
|
| 506 | 506 | )) |
| 507 | - ->setType($packageJsonFileInfo[ 'filename' ]) |
|
| 507 | + ->setType($packageJsonFileInfo['filename']) |
|
| 508 | 508 | ->setNamespace($moduleNamespace) |
| 509 | 509 | ->setSegments($moduleSegments) |
| 510 | 510 | ->setParentSegments($moduleParentSegments) |
@@ -666,8 +666,8 @@ discard block |
||
| 666 | 666 | $segment = dash($segment); |
| 667 | 667 | |
| 668 | 668 | if ($this->exists($segment)) { |
| 669 | - if ($this->registry[ $segment ] instanceof DataStructures\Module) { |
|
| 670 | - return $this->registry[ $segment ]; |
|
| 669 | + if ($this->registry[$segment] instanceof DataStructures\Module) { |
|
| 670 | + return $this->registry[$segment]; |
|
| 671 | 671 | } |
| 672 | 672 | } |
| 673 | 673 | |
@@ -703,8 +703,8 @@ discard block |
||
| 703 | 703 | */ |
| 704 | 704 | public function first() |
| 705 | 705 | { |
| 706 | - if (isset($this->registry[ '' ])) { |
|
| 707 | - return $this->registry[ '' ]; |
|
| 706 | + if (isset($this->registry[''])) { |
|
| 707 | + return $this->registry['']; |
|
| 708 | 708 | } elseif (reset($this->registry)->type === 'APP') { |
| 709 | 709 | return reset($this->registry); |
| 710 | 710 | } |
@@ -726,7 +726,7 @@ discard block |
||
| 726 | 726 | $segments = (is_array($segments) ? implode('/', array_map('dash', $segments)) : $segments); |
| 727 | 727 | |
| 728 | 728 | if ($this->exists($segments)) { |
| 729 | - return $this->registry[ $segments ]; |
|
| 729 | + return $this->registry[$segments]; |
|
| 730 | 730 | } |
| 731 | 731 | |
| 732 | 732 | return false; |
@@ -747,7 +747,7 @@ discard block |
||
| 747 | 747 | |
| 748 | 748 | foreach ($this as $key => $module) { |
| 749 | 749 | if ($module instanceof DataStructures\Module) { |
| 750 | - $namespaces[ $key ] = new SplNamespaceInfo($module->getNamespace(), $module->getRealPath()); |
|
| 750 | + $namespaces[$key] = new SplNamespaceInfo($module->getNamespace(), $module->getRealPath()); |
|
| 751 | 751 | } |
| 752 | 752 | } |
| 753 | 753 | |
@@ -816,7 +816,7 @@ discard block |
||
| 816 | 816 | |
| 817 | 817 | foreach ($this as $module) { |
| 818 | 818 | if ($module instanceof DataStructures\Module) { |
| 819 | - if(is_dir($dirPath = $module->getResourcesDir($subDir))) { |
|
| 819 | + if (is_dir($dirPath = $module->getResourcesDir($subDir))) { |
|
| 820 | 820 | $dirs[] = $dirPath; |
| 821 | 821 | } |
| 822 | 822 | } |
@@ -77,64 +77,64 @@ |
||
| 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 (isset($sets[ $primaryKey ])) { |
|
| 88 | - if (empty($sets[ $primaryKey ])) { |
|
| 89 | - unset($sets[ $primaryKey ]); |
|
| 87 | + if (isset($sets[$primaryKey])) { |
|
| 88 | + if (empty($sets[$primaryKey])) { |
|
| 89 | + unset($sets[$primaryKey]); |
|
| 90 | 90 | } |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - if (empty($sets[ $primaryKey ])) { |
|
| 94 | - if ( ! isset($sets[ 'record_create_user' ])) { |
|
| 95 | - $sets[ 'record_create_user' ] = $this->recordUser; |
|
| 93 | + if (empty($sets[$primaryKey])) { |
|
| 94 | + if ( ! isset($sets['record_create_user'])) { |
|
| 95 | + $sets['record_create_user'] = $this->recordUser; |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - if ( ! isset($sets[ 'record_create_timestamp' ])) { |
|
| 99 | - $sets[ 'record_create_timestamp' ] = $timestamp; |
|
| 98 | + if ( ! isset($sets['record_create_timestamp'])) { |
|
| 99 | + $sets['record_create_timestamp'] = $timestamp; |
|
| 100 | 100 | } elseif ($this->unixTimestamp) { |
| 101 | - $sets[ 'record_create_timestamp' ] = strtotime($sets[ 'record_create_timestamp' ]); |
|
| 101 | + $sets['record_create_timestamp'] = strtotime($sets['record_create_timestamp']); |
|
| 102 | 102 | } |
| 103 | 103 | } |
| 104 | 104 | } else { |
| 105 | 105 | foreach ($this->primaryKeys as $primaryKey) { |
| 106 | - if (empty($sets[ $primaryKey ])) { |
|
| 107 | - if ( ! isset($sets[ 'record_create_user' ])) { |
|
| 108 | - $sets[ 'record_create_user' ] = $this->recordUser; |
|
| 106 | + if (empty($sets[$primaryKey])) { |
|
| 107 | + if ( ! isset($sets['record_create_user'])) { |
|
| 108 | + $sets['record_create_user'] = $this->recordUser; |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | - if ( ! isset($sets[ 'record_create_timestamp' ])) { |
|
| 112 | - $sets[ 'record_create_timestamp' ] = $timestamp; |
|
| 111 | + if ( ! isset($sets['record_create_timestamp'])) { |
|
| 112 | + $sets['record_create_timestamp'] = $timestamp; |
|
| 113 | 113 | } elseif ($this->unixTimestamp) { |
| 114 | - $sets[ 'record_create_timestamp' ] = strtotime($sets[ 'record_create_timestamp' ]); |
|
| 114 | + $sets['record_create_timestamp'] = strtotime($sets['record_create_timestamp']); |
|
| 115 | 115 | } |
| 116 | 116 | } |
| 117 | 117 | } |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - $sets[ 'record_update_user' ] = $this->recordUser; |
|
| 120 | + $sets['record_update_user'] = $this->recordUser; |
|
| 121 | 121 | |
| 122 | - if ( ! isset($sets[ 'record_update_timestamp' ])) { |
|
| 123 | - $sets[ 'record_update_timestamp' ] = $timestamp; |
|
| 122 | + if ( ! isset($sets['record_update_timestamp'])) { |
|
| 123 | + $sets['record_update_timestamp'] = $timestamp; |
|
| 124 | 124 | } elseif ($this->unixTimestamp) { |
| 125 | - $sets[ 'record_update_timestamp' ] = strtotime($sets[ 'record_update_timestamp' ]); |
|
| 125 | + $sets['record_update_timestamp'] = strtotime($sets['record_update_timestamp']); |
|
| 126 | 126 | } |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | protected function updateRecordSets(array &$sets) |
| 130 | 130 | { |
| 131 | - $sets[ 'record_status' ] = $this->recordStatus; |
|
| 132 | - $sets[ 'record_update_user' ] = $this->recordUser; |
|
| 131 | + $sets['record_status'] = $this->recordStatus; |
|
| 132 | + $sets['record_update_user'] = $this->recordUser; |
|
| 133 | 133 | |
| 134 | 134 | $timestamp = $this->unixTimestamp === true ? strtotime(date('Y-m-d H:i:s')) : date('Y-m-d H:i:s'); |
| 135 | 135 | |
| 136 | - if ( ! isset($sets[ 'record_update_timestamp' ])) { |
|
| 137 | - $sets[ 'record_update_timestamp' ] = $timestamp; |
|
| 136 | + if ( ! isset($sets['record_update_timestamp'])) { |
|
| 137 | + $sets['record_update_timestamp'] = $timestamp; |
|
| 138 | 138 | } |
| 139 | 139 | } |
| 140 | 140 | |
@@ -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 | |
@@ -83,8 +83,8 @@ discard block |
||
| 83 | 83 | if (method_exists($this, 'insertRecordSets')) { |
| 84 | 84 | foreach ($sets as $set) { |
| 85 | 85 | $this->insertRecordSets($set); |
| 86 | - if ($this->recordOrdering === true && empty($sets[ 'record_ordering' ])) { |
|
| 87 | - $set[ 'record_ordering' ] = $this->getRecordOrdering($this->table); |
|
| 86 | + if ($this->recordOrdering === true && empty($sets['record_ordering'])) { |
|
| 87 | + $set['record_ordering'] = $this->getRecordOrdering($this->table); |
|
| 88 | 88 | } |
| 89 | 89 | } |
| 90 | 90 | } |
@@ -124,10 +124,10 @@ discard block |
||
| 124 | 124 | |
| 125 | 125 | if (empty($where)) { |
| 126 | 126 | if (empty($this->primaryKeys)) { |
| 127 | - $where[ $primaryKey ] = $sets[ $primaryKey ]; |
|
| 127 | + $where[$primaryKey] = $sets[$primaryKey]; |
|
| 128 | 128 | } else { |
| 129 | 129 | foreach ($this->primaryKeys as $primaryKey) { |
| 130 | - $where[ $primaryKey ] = $sets[ $primaryKey ]; |
|
| 130 | + $where[$primaryKey] = $sets[$primaryKey]; |
|
| 131 | 131 | } |
| 132 | 132 | } |
| 133 | 133 | } |
@@ -145,8 +145,8 @@ discard block |
||
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | if (method_exists($this, 'getRecordOrdering')) { |
| 148 | - if ($this->recordOrdering === true && empty($sets[ 'record_ordering' ])) { |
|
| 149 | - $sets[ 'record_ordering' ] = $this->getRecordOrdering($this->table); |
|
| 148 | + if ($this->recordOrdering === true && empty($sets['record_ordering'])) { |
|
| 149 | + $sets['record_ordering'] = $this->getRecordOrdering($this->table); |
|
| 150 | 150 | } |
| 151 | 151 | } |
| 152 | 152 | |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | return $this->db->getLastInsertId(); |
| 194 | 194 | } |
| 195 | 195 | |
| 196 | - return $result[ 0 ]->id; |
|
| 196 | + return $result[0]->id; |
|
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | // ------------------------------------------------------------------------ |
@@ -204,10 +204,10 @@ discard block |
||
| 204 | 204 | |
| 205 | 205 | if (empty($where)) { |
| 206 | 206 | if (empty($this->primaryKeys)) { |
| 207 | - $where[ $primaryKey ] = $sets[ $primaryKey ]; |
|
| 207 | + $where[$primaryKey] = $sets[$primaryKey]; |
|
| 208 | 208 | } else { |
| 209 | 209 | foreach ($this->primaryKeys as $primaryKey) { |
| 210 | - $where[ $primaryKey ] = $sets[ $primaryKey ]; |
|
| 210 | + $where[$primaryKey] = $sets[$primaryKey]; |
|
| 211 | 211 | } |
| 212 | 212 | } |
| 213 | 213 | } |
@@ -236,8 +236,8 @@ discard block |
||
| 236 | 236 | foreach ($sets as $set) { |
| 237 | 237 | $this->updateRecordSets($set); |
| 238 | 238 | |
| 239 | - if ($this->recordOrdering === true && empty($sets[ 'record_ordering' ])) { |
|
| 240 | - $set[ 'record_ordering' ] = $this->getRecordOrdering($this->table); |
|
| 239 | + if ($this->recordOrdering === true && empty($sets['record_ordering'])) { |
|
| 240 | + $set['record_ordering'] = $this->getRecordOrdering($this->table); |
|
| 241 | 241 | } |
| 242 | 242 | } |
| 243 | 243 | } |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | $affectedRows = []; |
| 272 | 272 | |
| 273 | 273 | foreach ($ids as $id) { |
| 274 | - $affectedRows[ $id ] = $this->softDelete($id); |
|
| 274 | + $affectedRows[$id] = $this->softDelete($id); |
|
| 275 | 275 | } |
| 276 | 276 | |
| 277 | 277 | return $affectedRows; |
@@ -294,19 +294,19 @@ discard block |
||
| 294 | 294 | $where = []; |
| 295 | 295 | |
| 296 | 296 | if (empty($this->primaryKeys)) { |
| 297 | - $where[ $primaryKey ] = $id; |
|
| 298 | - $sets[ $primaryKey ] = $id; |
|
| 297 | + $where[$primaryKey] = $id; |
|
| 298 | + $sets[$primaryKey] = $id; |
|
| 299 | 299 | } elseif (is_array($id)) { |
| 300 | 300 | foreach ($this->primaryKeys as $primaryKey) { |
| 301 | - $where[ $primaryKey ] = $sets[ $primaryKey ]; |
|
| 302 | - $sets[ $primaryKey ] = $id[ $primaryKey ]; |
|
| 301 | + $where[$primaryKey] = $sets[$primaryKey]; |
|
| 302 | + $sets[$primaryKey] = $id[$primaryKey]; |
|
| 303 | 303 | } |
| 304 | 304 | } else { |
| 305 | 305 | foreach ($this->primaryKeys as $primaryKey) { |
| 306 | - $where[ $primaryKey ] = $sets[ $primaryKey ]; |
|
| 306 | + $where[$primaryKey] = $sets[$primaryKey]; |
|
| 307 | 307 | } |
| 308 | 308 | |
| 309 | - $sets[ reset($this->primaryKeys) ] = $id; |
|
| 309 | + $sets[reset($this->primaryKeys)] = $id; |
|
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | // Reset Primary Keys |
@@ -340,7 +340,7 @@ discard block |
||
| 340 | 340 | $affectedRows = []; |
| 341 | 341 | |
| 342 | 342 | foreach ($ids as $id) { |
| 343 | - $affectedRows[ $id ] = $this->softDeleteBy($id, $where); |
|
| 343 | + $affectedRows[$id] = $this->softDeleteBy($id, $where); |
|
| 344 | 344 | } |
| 345 | 345 | |
| 346 | 346 | return $affectedRows; |
@@ -362,7 +362,7 @@ discard block |
||
| 362 | 362 | $affectedRows = []; |
| 363 | 363 | |
| 364 | 364 | foreach ($ids as $id) { |
| 365 | - $affectedRows[ $id ] = $this->delete($id, $force); |
|
| 365 | + $affectedRows[$id] = $this->delete($id, $force); |
|
| 366 | 366 | } |
| 367 | 367 | |
| 368 | 368 | return $affectedRows; |
@@ -376,13 +376,13 @@ discard block |
||
| 376 | 376 | |
| 377 | 377 | $where = []; |
| 378 | 378 | if (empty($this->primaryKeys)) { |
| 379 | - $where[ $primaryKey ] = $id; |
|
| 379 | + $where[$primaryKey] = $id; |
|
| 380 | 380 | } elseif (is_array($id)) { |
| 381 | 381 | foreach ($this->primaryKeys as $primaryKey) { |
| 382 | - $where[ $primaryKey ] = $id[ $primaryKey ]; |
|
| 382 | + $where[$primaryKey] = $id[$primaryKey]; |
|
| 383 | 383 | } |
| 384 | 384 | } else { |
| 385 | - $where[ reset($this->primaryKeys) ] = $id; |
|
| 385 | + $where[reset($this->primaryKeys)] = $id; |
|
| 386 | 386 | } |
| 387 | 387 | |
| 388 | 388 | // Reset Primary Keys |
@@ -411,7 +411,7 @@ discard block |
||
| 411 | 411 | $affectedRows = []; |
| 412 | 412 | |
| 413 | 413 | foreach ($ids as $id) { |
| 414 | - $affectedRows[ $id ] = $this->deleteBy($id, $where, $force); |
|
| 414 | + $affectedRows[$id] = $this->deleteBy($id, $where, $force); |
|
| 415 | 415 | } |
| 416 | 416 | |
| 417 | 417 | return $affectedRows; |
@@ -441,19 +441,19 @@ discard block |
||
| 441 | 441 | $where = []; |
| 442 | 442 | |
| 443 | 443 | if (empty($this->primaryKeys)) { |
| 444 | - $where[ $primaryKey ] = $id; |
|
| 445 | - $sets[ $primaryKey ] = $id; |
|
| 444 | + $where[$primaryKey] = $id; |
|
| 445 | + $sets[$primaryKey] = $id; |
|
| 446 | 446 | } elseif (is_array($id)) { |
| 447 | 447 | foreach ($this->primaryKeys as $primaryKey) { |
| 448 | - $where[ $primaryKey ] = $sets[ $primaryKey ]; |
|
| 449 | - $sets[ $primaryKey ] = $id[ $primaryKey ]; |
|
| 448 | + $where[$primaryKey] = $sets[$primaryKey]; |
|
| 449 | + $sets[$primaryKey] = $id[$primaryKey]; |
|
| 450 | 450 | } |
| 451 | 451 | } else { |
| 452 | 452 | foreach ($this->primaryKeys as $primaryKey) { |
| 453 | - $where[ $primaryKey ] = $sets[ $primaryKey ]; |
|
| 453 | + $where[$primaryKey] = $sets[$primaryKey]; |
|
| 454 | 454 | } |
| 455 | 455 | |
| 456 | - $sets[ reset($this->primaryKeys) ] = $id; |
|
| 456 | + $sets[reset($this->primaryKeys)] = $id; |
|
| 457 | 457 | } |
| 458 | 458 | |
| 459 | 459 | // Reset Primary Keys |
@@ -510,7 +510,7 @@ discard block |
||
| 510 | 510 | $affectedRows = []; |
| 511 | 511 | |
| 512 | 512 | foreach ($ids as $id) { |
| 513 | - $affectedRows[ $id ] = $this->publish($id); |
|
| 513 | + $affectedRows[$id] = $this->publish($id); |
|
| 514 | 514 | } |
| 515 | 515 | |
| 516 | 516 | return $affectedRows; |
@@ -530,7 +530,7 @@ discard block |
||
| 530 | 530 | $affectedRows = []; |
| 531 | 531 | |
| 532 | 532 | foreach ($ids as $id) { |
| 533 | - $affectedRows[ $id ] = $this->publishBy($id, $where); |
|
| 533 | + $affectedRows[$id] = $this->publishBy($id, $where); |
|
| 534 | 534 | } |
| 535 | 535 | |
| 536 | 536 | return $affectedRows; |
@@ -544,19 +544,19 @@ discard block |
||
| 544 | 544 | $where = []; |
| 545 | 545 | |
| 546 | 546 | if (empty($this->primaryKeys)) { |
| 547 | - $where[ $primaryKey ] = $id; |
|
| 548 | - $sets[ $primaryKey ] = $id; |
|
| 547 | + $where[$primaryKey] = $id; |
|
| 548 | + $sets[$primaryKey] = $id; |
|
| 549 | 549 | } elseif (is_array($id)) { |
| 550 | 550 | foreach ($this->primaryKeys as $primaryKey) { |
| 551 | - $where[ $primaryKey ] = $sets[ $primaryKey ]; |
|
| 552 | - $sets[ $primaryKey ] = $id[ $primaryKey ]; |
|
| 551 | + $where[$primaryKey] = $sets[$primaryKey]; |
|
| 552 | + $sets[$primaryKey] = $id[$primaryKey]; |
|
| 553 | 553 | } |
| 554 | 554 | } else { |
| 555 | 555 | foreach ($this->primaryKeys as $primaryKey) { |
| 556 | - $where[ $primaryKey ] = $sets[ $primaryKey ]; |
|
| 556 | + $where[$primaryKey] = $sets[$primaryKey]; |
|
| 557 | 557 | } |
| 558 | 558 | |
| 559 | - $sets[ reset($this->primaryKeys) ] = $id; |
|
| 559 | + $sets[reset($this->primaryKeys)] = $id; |
|
| 560 | 560 | } |
| 561 | 561 | |
| 562 | 562 | // Reset Primary Keys |
@@ -599,7 +599,7 @@ discard block |
||
| 599 | 599 | $affectedRows = []; |
| 600 | 600 | |
| 601 | 601 | foreach ($ids as $id) { |
| 602 | - $affectedRows[ $id ] = $this->publish($id); |
|
| 602 | + $affectedRows[$id] = $this->publish($id); |
|
| 603 | 603 | } |
| 604 | 604 | |
| 605 | 605 | return $affectedRows; |
@@ -612,7 +612,7 @@ discard block |
||
| 612 | 612 | $affectedRows = []; |
| 613 | 613 | |
| 614 | 614 | foreach ($ids as $id) { |
| 615 | - $affectedRows[ $id ] = $this->publishBy($id, $where); |
|
| 615 | + $affectedRows[$id] = $this->publishBy($id, $where); |
|
| 616 | 616 | } |
| 617 | 617 | |
| 618 | 618 | return $affectedRows; |
@@ -626,19 +626,19 @@ discard block |
||
| 626 | 626 | $where = []; |
| 627 | 627 | |
| 628 | 628 | if (empty($this->primaryKeys)) { |
| 629 | - $where[ $primaryKey ] = $id; |
|
| 630 | - $sets[ $primaryKey ] = $id; |
|
| 629 | + $where[$primaryKey] = $id; |
|
| 630 | + $sets[$primaryKey] = $id; |
|
| 631 | 631 | } elseif (is_array($id)) { |
| 632 | 632 | foreach ($this->primaryKeys as $primaryKey) { |
| 633 | - $where[ $primaryKey ] = $sets[ $primaryKey ]; |
|
| 634 | - $sets[ $primaryKey ] = $id[ $primaryKey ]; |
|
| 633 | + $where[$primaryKey] = $sets[$primaryKey]; |
|
| 634 | + $sets[$primaryKey] = $id[$primaryKey]; |
|
| 635 | 635 | } |
| 636 | 636 | } else { |
| 637 | 637 | foreach ($this->primaryKeys as $primaryKey) { |
| 638 | - $where[ $primaryKey ] = $sets[ $primaryKey ]; |
|
| 638 | + $where[$primaryKey] = $sets[$primaryKey]; |
|
| 639 | 639 | } |
| 640 | 640 | |
| 641 | - $sets[ reset($this->primaryKeys) ] = $id; |
|
| 641 | + $sets[reset($this->primaryKeys)] = $id; |
|
| 642 | 642 | } |
| 643 | 643 | |
| 644 | 644 | // Reset Primary Keys |
@@ -681,7 +681,7 @@ discard block |
||
| 681 | 681 | $affectedRows = []; |
| 682 | 682 | |
| 683 | 683 | foreach ($ids as $id) { |
| 684 | - $affectedRows[ $id ] = $this->publish($id); |
|
| 684 | + $affectedRows[$id] = $this->publish($id); |
|
| 685 | 685 | } |
| 686 | 686 | |
| 687 | 687 | return $affectedRows; |
@@ -694,7 +694,7 @@ discard block |
||
| 694 | 694 | $affectedRows = []; |
| 695 | 695 | |
| 696 | 696 | foreach ($ids as $id) { |
| 697 | - $affectedRows[ $id ] = $this->publishBy($id, $where); |
|
| 697 | + $affectedRows[$id] = $this->publishBy($id, $where); |
|
| 698 | 698 | } |
| 699 | 699 | |
| 700 | 700 | 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++; |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | */ |
| 170 | 170 | protected function getNumParents($id, $direct = true) |
| 171 | 171 | { |
| 172 | - if($direct) { |
|
| 172 | + if ($direct) { |
|
| 173 | 173 | if ($result = $this->qb |
| 174 | 174 | ->table($this->table) |
| 175 | 175 | ->select('id') |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | return $result->count(); |
| 179 | 179 | } |
| 180 | 180 | } else { |
| 181 | - if($parents = $this->getParents($id)) { |
|
| 181 | + if ($parents = $this->getParents($id)) { |
|
| 182 | 182 | return $parents->count(); |
| 183 | 183 | } |
| 184 | 184 | } |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | */ |
| 250 | 250 | protected function getNumChilds($idParent, $direct = true) |
| 251 | 251 | { |
| 252 | - if($direct) { |
|
| 252 | + if ($direct) { |
|
| 253 | 253 | if ($result = $this->qb |
| 254 | 254 | ->table($this->table) |
| 255 | 255 | ->select('id') |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | return $result->count(); |
| 259 | 259 | } |
| 260 | 260 | } else { |
| 261 | - if($childs = $this->getChilds($idParent)) { |
|
| 261 | + if ($childs = $this->getChilds($idParent)) { |
|
| 262 | 262 | return $childs->count(); |
| 263 | 263 | } |
| 264 | 264 | } |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | { |
| 33 | 33 | parent::__construct(); |
| 34 | 34 | |
| 35 | - if(services()->has('csrfProtection')) { |
|
| 35 | + if (services()->has('csrfProtection')) { |
|
| 36 | 36 | $this->addHeader('X-CSRF-TOKEN', services()->get('csrfProtection')->getToken()); |
| 37 | 37 | } |
| 38 | 38 | } |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | $error = new ErrorException($errorMessage, $errorSeverity, $errorFile, $errorLine, $errorContext); |
| 149 | 149 | |
| 150 | 150 | // Logged the error |
| 151 | - if(services()->has('logger')) { |
|
| 151 | + if (services()->has('logger')) { |
|
| 152 | 152 | logger()->error( |
| 153 | 153 | implode( |
| 154 | 154 | ' ', |
@@ -301,21 +301,21 @@ discard block |
||
| 301 | 301 | ]; |
| 302 | 302 | |
| 303 | 303 | $this->statusCode = $code; |
| 304 | - $this->reasonPhrase = $error[ 'title' ]; |
|
| 304 | + $this->reasonPhrase = $error['title']; |
|
| 305 | 305 | |
| 306 | 306 | if (is_string($vars)) { |
| 307 | 307 | $vars = ['message' => $vars]; |
| 308 | - } elseif (is_array($vars) and empty($vars[ 'message' ])) { |
|
| 309 | - $vars[ 'message' ] = $error[ 'message' ]; |
|
| 308 | + } elseif (is_array($vars) and empty($vars['message'])) { |
|
| 309 | + $vars['message'] = $error['message']; |
|
| 310 | 310 | } |
| 311 | 311 | |
| 312 | - if (isset($vars[ 'message' ])) { |
|
| 313 | - $error[ 'message' ] = $vars[ 'message' ]; |
|
| 312 | + if (isset($vars['message'])) { |
|
| 313 | + $error['message'] = $vars['message']; |
|
| 314 | 314 | } |
| 315 | 315 | |
| 316 | 316 | if (is_ajax() or $this->mimeType !== 'text/html') { |
| 317 | 317 | $this->statusCode = $code; |
| 318 | - $this->reasonPhrase = $error[ 'title' ]; |
|
| 318 | + $this->reasonPhrase = $error['title']; |
|
| 319 | 319 | $this->send($vars); |
| 320 | 320 | |
| 321 | 321 | exit(EXIT_ERROR); |