@@ -1,9 +1,9 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -function f3($get=null) |
|
| 3 | +function f3($get = null) |
|
| 4 | 4 | { |
| 5 | - $f3=Base::instance(); |
|
| 6 | - return $get?$f3->get($get):$f3; |
|
| 5 | + $f3 = Base::instance(); |
|
| 6 | + return $get ? $f3->get($get) : $f3; |
|
| 7 | 7 | } |
| 8 | 8 | |
| 9 | 9 | function base_path($inner = '') |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | { |
| 36 | 36 | f3()->abort(); |
| 37 | 37 | } |
| 38 | -function status($code=404) |
|
| 38 | +function status($code = 404) |
|
| 39 | 39 | { |
| 40 | 40 | f3()->error($code); |
| 41 | 41 | } |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | if (is_array($template)) { |
| 61 | 61 | $layout = $template[0]; |
| 62 | 62 | $view = $template[1]; |
| 63 | - } else { |
|
| 63 | + }else { |
|
| 64 | 64 | $layout = 'layouts/app.htm'; |
| 65 | 65 | $view = $template; |
| 66 | 66 | } |
@@ -71,24 +71,24 @@ discard block |
||
| 71 | 71 | |
| 72 | 72 | function str_contains($haystack, $needles) |
| 73 | 73 | { |
| 74 | - foreach ((array)$needles as $needle) { |
|
| 75 | - if ($needle!=''&&mb_strpos($haystack, $needle)!==false) { |
|
| 74 | + foreach ((array) $needles as $needle) { |
|
| 75 | + if ($needle != '' && mb_strpos($haystack, $needle) !== false) { |
|
| 76 | 76 | return true; |
| 77 | 77 | } |
| 78 | 78 | } |
| 79 | 79 | return false; |
| 80 | 80 | } |
| 81 | -function extension($file, $default='json') |
|
| 81 | +function extension($file, $default = 'json') |
|
| 82 | 82 | { |
| 83 | - return $file.'.'.(pathinfo($file, PATHINFO_EXTENSION)?:$default); |
|
| 83 | + return $file.'.'.(pathinfo($file, PATHINFO_EXTENSION) ?: $default); |
|
| 84 | 84 | } |
| 85 | 85 | function flash($message, $type = 'success') |
| 86 | 86 | { |
| 87 | 87 | Flash::instance()->addMessage($message, $type); |
| 88 | 88 | } |
| 89 | -function trans($key, $params=null) |
|
| 89 | +function trans($key, $params = null) |
|
| 90 | 90 | { |
| 91 | - return f3()->format(f3()->get($key), ($params?:'')); |
|
| 91 | + return f3()->format(f3()->get($key), ($params ?: '')); |
|
| 92 | 92 | } |
| 93 | 93 | function error($error) |
| 94 | 94 | { |
@@ -101,11 +101,11 @@ discard block |
||
| 101 | 101 | foreach ($err as $e) { |
| 102 | 102 | flash($e, 'danger'); |
| 103 | 103 | } |
| 104 | - } else { |
|
| 104 | + }else { |
|
| 105 | 105 | flash($err, 'danger'); |
| 106 | 106 | } |
| 107 | 107 | } |
| 108 | - } else { |
|
| 108 | + }else { |
|
| 109 | 109 | flash($error, 'danger'); |
| 110 | 110 | } |
| 111 | 111 | } |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | { |
| 111 | 111 | preg_match('/^\s*+(?:\S++\s*+){1,'.$words.'}/u', $value, $matches); |
| 112 | 112 | |
| 113 | - if (! isset($matches[0]) || static::length($value) === static::length($matches[0])) { |
|
| 113 | + if (!isset($matches[0]) || static::length($value) === static::length($matches[0])) { |
|
| 114 | 114 | return $value; |
| 115 | 115 | } |
| 116 | 116 | |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | return static::$snakeCache[$key][$delimiter]; |
| 219 | 219 | } |
| 220 | 220 | |
| 221 | - if (! ctype_lower($value)) { |
|
| 221 | + if (!ctype_lower($value)) { |
|
| 222 | 222 | $value = preg_replace('/\s+/u', '', ucwords($value)); |
| 223 | 223 | |
| 224 | 224 | $value = static::lower(preg_replace('/(.)(?=[A-Z])/u', '$1'.$delimiter, $value)); |
@@ -55,18 +55,18 @@ |
||
| 55 | 55 | } elseif (array_key_exists('input', $key)) { |
| 56 | 56 | $inputClass = $key['input']; |
| 57 | 57 | } |
| 58 | - } else { |
|
| 58 | + }else { |
|
| 59 | 59 | $imgClass = $inputClass = $key; |
| 60 | 60 | } |
| 61 | 61 | } |
| 62 | 62 | if (method_exists($this, $func)) { |
| 63 | 63 | $response = $this->$key($length, $imgClass).$this->input($inputClass); |
| 64 | - } else { |
|
| 64 | + }else { |
|
| 65 | 65 | throw new Exception("Error Processing Captcha Method", 1); |
| 66 | 66 | } |
| 67 | 67 | } elseif (is_numeric($param)) { |
| 68 | 68 | $response = $this->img($param).$this->input(); |
| 69 | - } else { |
|
| 69 | + }else { |
|
| 70 | 70 | throw new Exception("Error Processing Captcha Parameters", 1); |
| 71 | 71 | } |
| 72 | 72 | |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | { |
| 17 | 17 | if (Registry::exists('APP')) { |
| 18 | 18 | $app = Registry::get('APP'); |
| 19 | - } else { |
|
| 19 | + }else { |
|
| 20 | 20 | $app = new self; |
| 21 | 21 | Registry::set('APP', $app); |
| 22 | 22 | } |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | |
| 36 | 36 | public function user() |
| 37 | 37 | { |
| 38 | - return $this->authenticatedUser = $this->app->get('SESSION.USER')?:false; |
|
| 38 | + return $this->authenticatedUser = $this->app->get('SESSION.USER') ?: false; |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | public function initialized($def = null) |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | |
| 46 | 46 | public function config($key = null) |
| 47 | 47 | { |
| 48 | - return $this->app->get($key?:'CONFIG') ; |
|
| 48 | + return $this->app->get($key ?: 'CONFIG'); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | public function status() |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | { |
| 82 | 82 | if ($file) { |
| 83 | 83 | $this->app->config(base_path("{path}/{$file}")); |
| 84 | - } else { |
|
| 84 | + }else { |
|
| 85 | 85 | foreach (glob(base_path("{$path}/*.ini")) as $file) { |
| 86 | 86 | $this->app->config($file); |
| 87 | 87 | } |
@@ -126,11 +126,11 @@ discard block |
||
| 126 | 126 | $this->configureCSRF($type); |
| 127 | 127 | } elseif ($this->app->CSRF) { |
| 128 | 128 | $this->session = new Session(null, 'CSRF'); |
| 129 | - } else { |
|
| 129 | + }else { |
|
| 130 | 130 | if ($type == 'jig' || $type == 'mongo' || $type == 'sql') { |
| 131 | 131 | $session = str_ireplace('/', '', 'DB\/'.$this->_getDBType($type).'\Session'); |
| 132 | 132 | $this->session = new $session($this->app->DB); |
| 133 | - } else { |
|
| 133 | + }else { |
|
| 134 | 134 | $this->session = new Session(); |
| 135 | 135 | } |
| 136 | 136 | } |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | public function configureAssets() |
| 157 | 157 | { |
| 158 | 158 | $assets = Assets::instance(); |
| 159 | - $this->app->set('ASSETS.onFileNotFound', function ($file) { |
|
| 159 | + $this->app->set('ASSETS.onFileNotFound', function($file) { |
|
| 160 | 160 | echo 'file not found: '.$file; |
| 161 | 161 | }); |
| 162 | 162 | } |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | { |
| 166 | 166 | if ($this->app->DEV) { |
| 167 | 167 | Falsum\Run::handler($this->app->DEBUG != 3); |
| 168 | - } else { |
|
| 168 | + }else { |
|
| 169 | 169 | $this->app->set('ONERROR', 'App\Core\Controllers\ErrorController->init'); |
| 170 | 170 | } |
| 171 | 171 | } |