@@ -62,7 +62,7 @@ |
||
| 62 | 62 | // build error text |
| 63 | 63 | $rawResponse = 'error'; |
| 64 | 64 | try { |
| 65 | - $rawResponse = App::$View->render('native/errors/' . $this->tpl, ['msg' => $this->text]); |
|
| 65 | + $rawResponse = App::$View->render('native/errors/'.$this->tpl, ['msg' => $this->text]); |
|
| 66 | 66 | if (Str::likeEmpty($rawResponse)) { |
| 67 | 67 | $rawResponse = $this->text; |
| 68 | 68 | } |
@@ -55,7 +55,7 @@ |
||
| 55 | 55 | protected function sendHTML($message = null) |
| 56 | 56 | { |
| 57 | 57 | header('HTTP/1.1 404 Not Found'); |
| 58 | - return '<!DOCTYPE html><html><head><title>An error has occurred</title></head><body><div style="width:60%; margin: auto; background-color: #fcc;border: 1px solid #faa; padding: 0.5em 1em;"><h1 style="font-size: 120%">Runtime error</h1><p>' . $message . '</p></div></body></html>'; |
|
| 58 | + return '<!DOCTYPE html><html><head><title>An error has occurred</title></head><body><div style="width:60%; margin: auto; background-color: #fcc;border: 1px solid #faa; padding: 0.5em 1em;"><h1 style="font-size: 120%">Runtime error</h1><p>'.$message.'</p></div></body></html>'; |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | /** |
@@ -297,7 +297,7 @@ |
||
| 297 | 297 | |
| 298 | 298 | $output = null; |
| 299 | 299 | foreach ($args as $string) { |
| 300 | - $output .= $string . $separator; |
|
| 300 | + $output .= $string.$separator; |
|
| 301 | 301 | } |
| 302 | 302 | |
| 303 | 303 | $output = rtrim($output, $separator); |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | * Find first entry in $string before $delimiter |
| 58 | 58 | * @param string $string |
| 59 | 59 | * @param string $delimiter |
| 60 | - * @return string|bool |
|
| 60 | + * @return false|string |
|
| 61 | 61 | */ |
| 62 | 62 | public static function firstIn($string, $delimiter) |
| 63 | 63 | { |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | * @param string $string |
| 73 | 73 | * @param string $delimiter |
| 74 | 74 | * @param bool $withoutDelimiter |
| 75 | - * @return string|bool |
|
| 75 | + * @return false|string |
|
| 76 | 76 | */ |
| 77 | 77 | public static function lastIn($string, $delimiter, $withoutDelimiter = false) |
| 78 | 78 | { |
@@ -214,8 +214,8 @@ discard block |
||
| 214 | 214 | |
| 215 | 215 | /** |
| 216 | 216 | * Case-ignore replace $needle to $replacement in string $haystack. Alias for function str_ireplace() |
| 217 | - * @param string|array $needle |
|
| 218 | - * @param string|array $replacement |
|
| 217 | + * @param string[] $needle |
|
| 218 | + * @param string $replacement |
|
| 219 | 219 | * @param string $haystack |
| 220 | 220 | * @return string |
| 221 | 221 | */ |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | /** |
| 311 | 311 | * Check is $string sounds like a phone number |
| 312 | 312 | * @param string $string |
| 313 | - * @return int |
|
| 313 | + * @return boolean |
|
| 314 | 314 | */ |
| 315 | 315 | public static function isPhone($string) |
| 316 | 316 | { |
@@ -319,9 +319,6 @@ discard block |
||
| 319 | 319 | |
| 320 | 320 | /** |
| 321 | 321 | * Concat string with add string by separator |
| 322 | - * @param string $separator |
|
| 323 | - * @param string $string1 |
|
| 324 | - * @param string $string2 |
|
| 325 | 322 | * @return string |
| 326 | 323 | */ |
| 327 | 324 | public static function concat() |
@@ -115,7 +115,7 @@ |
||
| 115 | 115 | |
| 116 | 116 | /** |
| 117 | 117 | * Get available languages in the filesystem |
| 118 | - * @return array |
|
| 118 | + * @return string[] |
|
| 119 | 119 | */ |
| 120 | 120 | public function getAvailableLangs() |
| 121 | 121 | { |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | if (Obj::isArray($params) && count($params) > 0) { |
| 56 | 56 | foreach ($params as $var => $value) { |
| 57 | - $text = Str::replace('%' . $var . '%', $value, $text); |
|
| 57 | + $text = Str::replace('%'.$var.'%', $value, $text); |
|
| 58 | 58 | } |
| 59 | 59 | } |
| 60 | 60 | return $text; |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | public function translate($text, array $params = []) |
| 70 | 70 | { |
| 71 | 71 | $index = null; |
| 72 | - $namespace = 'Apps\Controller\\' . env_name . '\\'; |
|
| 72 | + $namespace = 'Apps\Controller\\'.env_name.'\\'; |
|
| 73 | 73 | foreach (@debug_backtrace() as $caller) { |
| 74 | 74 | if (isset($caller['class']) && Str::startsWith($namespace, $caller['class'])) { |
| 75 | 75 | $index = Str::sub((string)$caller['class'], Str::length($namespace)); |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | */ |
| 86 | 86 | protected function load($index) |
| 87 | 87 | { |
| 88 | - $file = root . '/I18n/' . env_name . '/' . App::$Request->getLanguage() . '/' . $index . '.php'; |
|
| 88 | + $file = root.'/I18n/'.env_name.'/'.App::$Request->getLanguage().'/'.$index.'.php'; |
|
| 89 | 89 | if (!File::exist($file)) { |
| 90 | 90 | return []; |
| 91 | 91 | } |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | public function getAvailableLangs() |
| 124 | 124 | { |
| 125 | 125 | $langs = ['en']; |
| 126 | - $scan = Directory::scan(root . '/I18n/' . env_name . '/', GLOB_ONLYDIR, true); |
|
| 126 | + $scan = Directory::scan(root.'/I18n/'.env_name.'/', GLOB_ONLYDIR, true); |
|
| 127 | 127 | foreach ($scan as $row) { |
| 128 | 128 | $langs[] = trim($row, '/'); |
| 129 | 129 | } |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | return false; |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - $callback = (string)$class . '::' . (string)$method; |
|
| 79 | + $callback = (string)$class.'::'.(string)$method; |
|
| 80 | 80 | |
| 81 | 81 | // add instance to cron task manager |
| 82 | 82 | if (!isset($this->configs['instances'][$callback])) { |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | */ |
| 95 | 95 | public function remove($class, $method) |
| 96 | 96 | { |
| 97 | - $callback = $class . '::' . $method; |
|
| 97 | + $callback = $class.'::'.$method; |
|
| 98 | 98 | if (isset($this->configs['instances'][$callback])) { |
| 99 | 99 | unset($this->configs['instances'][$callback], $this->configs['log'][$callback]); |
| 100 | 100 | App::$Properties->writeConfig('Cron', $this->configs); |
@@ -103,8 +103,8 @@ |
||
| 103 | 103 | |
| 104 | 104 | /** |
| 105 | 105 | * Display form field. Allowed type: text, password, textarea, checkbox, select, checkboxes, file, captcha, email, hidden |
| 106 | - * @param $object |
|
| 107 | - * @param $type |
|
| 106 | + * @param string $object |
|
| 107 | + * @param string $type |
|
| 108 | 108 | * @param null|array $property |
| 109 | 109 | * @param null|string $helper |
| 110 | 110 | * @param null|string $layerFile |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | { |
| 82 | 82 | $form = self::buildSingleTag('form', $this->formProperty, false); |
| 83 | 83 | if ($this->model->_tokenRequired) { |
| 84 | - $form .= PHP_EOL . $this->field('_csrf_token', 'hidden', ['value' => $this->model->_csrf_token]); |
|
| 84 | + $form .= PHP_EOL.$this->field('_csrf_token', 'hidden', ['value' => $this->model->_csrf_token]); |
|
| 85 | 85 | } |
| 86 | 86 | return $form; |
| 87 | 87 | } |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | { |
| 102 | 102 | if ($this->model === null) { |
| 103 | 103 | if (App::$Debug !== null) { |
| 104 | - App::$Debug->addMessage('Form model is not defined for field name: [' . strip_tags($object) . ']'); |
|
| 104 | + App::$Debug->addMessage('Form model is not defined for field name: ['.strip_tags($object).']'); |
|
| 105 | 105 | } |
| 106 | 106 | return null; |
| 107 | 107 | } |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | // check if model contains current tag name as property |
| 116 | 116 | if (!property_exists($this->model, $propertyName)) { |
| 117 | 117 | if (App::$Debug !== null) { |
| 118 | - App::$Debug->addMessage('Form field ["' . $object . '"] is not defined in model: [' . get_class($this->model) . ']', 'error'); |
|
| 118 | + App::$Debug->addMessage('Form field ["'.$object.'"] is not defined in model: ['.get_class($this->model).']', 'error'); |
|
| 119 | 119 | } |
| 120 | 120 | return null; |
| 121 | 121 | } |
@@ -136,13 +136,13 @@ discard block |
||
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | // prepare labels text and label "for" attr |
| 139 | - $labelFor = $this->name . '-' . $propertyName; |
|
| 139 | + $labelFor = $this->name.'-'.$propertyName; |
|
| 140 | 140 | $labelText = $this->model->getLabel($object); |
| 141 | 141 | $itemValue = $this->model->{$propertyName}; |
| 142 | 142 | // sounds like a dot-separated $object |
| 143 | 143 | if ($propertyName !== $object) { |
| 144 | 144 | $nesting = trim(strstr($object, '.'), '.'); |
| 145 | - $labelFor .= '-' . Str::replace('.', '-', $nesting); |
|
| 145 | + $labelFor .= '-'.Str::replace('.', '-', $nesting); |
|
| 146 | 146 | $itemValue = Arr::getByPath($nesting, $itemValue); |
| 147 | 147 | } |
| 148 | 148 | |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | public function submitButton($title, array $property = []) |
| 174 | 174 | { |
| 175 | 175 | $property['type'] = 'submit'; |
| 176 | - $property['name'] = $this->name . '[submit]'; |
|
| 176 | + $property['name'] = $this->name.'[submit]'; |
|
| 177 | 177 | $property['value'] = $title; |
| 178 | 178 | return self::buildSingleTag('input', $property); |
| 179 | 179 | } |
@@ -187,10 +187,10 @@ discard block |
||
| 187 | 187 | { |
| 188 | 188 | // pre-validate form fields based on model rules and jquery.validation |
| 189 | 189 | if ($validate) { |
| 190 | - App::$Alias->addPlainCode('js', '$().ready(function() { $("#' . $this->name . '").validate(); });'); |
|
| 190 | + App::$Alias->addPlainCode('js', '$().ready(function() { $("#'.$this->name.'").validate(); });'); |
|
| 191 | 191 | App::$Alias->setCustomLibrary('js', '/vendor/bower/jquery-validation/dist/jquery.validate.min.js'); |
| 192 | 192 | if (App::$Request->getLanguage() !== 'en') { |
| 193 | - $localeFile = '/vendor/bower/jquery-validation/src/localization/messages_' . App::$Request->getLanguage() . '.js'; |
|
| 193 | + $localeFile = '/vendor/bower/jquery-validation/src/localization/messages_'.App::$Request->getLanguage().'.js'; |
|
| 194 | 194 | if (File::exist($localeFile)) { |
| 195 | 195 | App::$Alias->setCustomLibrary('js', $localeFile); |
| 196 | 196 | } |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | $formName = $this->model->getFormName(); |
| 202 | 202 | if (Obj::isArray($badAttr) && count($badAttr) > 0) { |
| 203 | 203 | foreach ($badAttr as $attr) { |
| 204 | - $itemId = $formName . '-' . $attr; |
|
| 204 | + $itemId = $formName.'-'.$attr; |
|
| 205 | 205 | $render = App::$View->render(static::$structLayer['jsnotify'], ['itemId' => $itemId]); |
| 206 | 206 | App::$Alias->addPlainCode('js', $render); |
| 207 | 207 | } |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | { |
| 18 | 18 | $hash = null; |
| 19 | 19 | foreach ($this as $property => $value) { |
| 20 | - $hash = md5($hash . $property . '=' . $value); |
|
| 20 | + $hash = md5($hash.$property.'='.$value); |
|
| 21 | 21 | } |
| 22 | 22 | return $hash; |
| 23 | 23 | } |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | public static function to($controller_action, $id = null, $add = null, array $params = null, $encode = true) |
| 24 | 24 | { |
| 25 | 25 | $pathway = self::buildPathway([$controller_action, $id, $add, $params], $encode); |
| 26 | - return App::$Alias->baseUrl . '/' . $pathway; |
|
| 26 | + return App::$Alias->baseUrl.'/'.$pathway; |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | /** |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | $controller = Str::lastIn($controller, '\\', true); |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | - $response = $controller . '/' . $action; |
|
| 63 | + $response = $controller.'/'.$action; |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | // check if controller and action is defined |
@@ -70,17 +70,17 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | // id is defined? |
| 72 | 72 | if (isset($to[1]) && !Str::likeEmpty($to[1])) { |
| 73 | - $response .= '/' . self::safeUri($to[1], $encode); |
|
| 73 | + $response .= '/'.self::safeUri($to[1], $encode); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | // add param is defined? |
| 77 | 77 | if (isset($to[2]) && !Str::likeEmpty($to[2])) { |
| 78 | - $response .= '/' . self::safeUri($to[2], $encode); |
|
| 78 | + $response .= '/'.self::safeUri($to[2], $encode); |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | // try to find static alias |
| 82 | - if (isset($routing['Alias'][env_name]) && Arr::in('/' . $response, $routing['Alias'][env_name])) { |
|
| 83 | - $pathAlias = array_search('/' . $response, $routing['Alias'][env_name]); |
|
| 82 | + if (isset($routing['Alias'][env_name]) && Arr::in('/'.$response, $routing['Alias'][env_name])) { |
|
| 83 | + $pathAlias = array_search('/'.$response, $routing['Alias'][env_name]); |
|
| 84 | 84 | if ($pathAlias !== false) { |
| 85 | 85 | $response = Str::lowerCase(trim($pathAlias, '/')); |
| 86 | 86 | } |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | } |
| 97 | 97 | $queryString = http_build_query($to[3]); |
| 98 | 98 | if (Str::length($queryString) > 0) { |
| 99 | - $response .= '?' . http_build_query($to[3]); |
|
| 99 | + $response .= '?'.http_build_query($to[3]); |
|
| 100 | 100 | } |
| 101 | 101 | if ($anchor !== false) { |
| 102 | 102 | $response .= $anchor; |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | public static function buildPathwayFromRequest() |
| 119 | 119 | { |
| 120 | 120 | return self::buildPathway([ |
| 121 | - Str::lowerCase(App::$Request->getController()) . '/' . Str::lowerCase(App::$Request->getAction()), |
|
| 121 | + Str::lowerCase(App::$Request->getController()).'/'.Str::lowerCase(App::$Request->getAction()), |
|
| 122 | 122 | App::$Request->getID(), |
| 123 | 123 | App::$Request->getAdd(), |
| 124 | 124 | App::$Request->query->all() |
@@ -140,9 +140,9 @@ discard block |
||
| 140 | 140 | $to = [$to]; |
| 141 | 141 | } |
| 142 | 142 | // call Url::to(args) |
| 143 | - $callbackTo = call_user_func_array([__NAMESPACE__ . '\Url', 'to'], $to); |
|
| 143 | + $callbackTo = call_user_func_array([__NAMESPACE__.'\Url', 'to'], $to); |
|
| 144 | 144 | |
| 145 | - return '<a href="' . $callbackTo . '"' . $compile_property . '>' . $name . '</a>'; |
|
| 145 | + return '<a href="'.$callbackTo.'"'.$compile_property.'>'.$name.'</a>'; |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | /** |
@@ -155,19 +155,19 @@ discard block |
||
| 155 | 155 | { |
| 156 | 156 | /** @var array $configs */ |
| 157 | 157 | $configs = \App::$Properties->getAll('default'); |
| 158 | - $httpHost = $configs['baseProto'] . '://' . $configs['baseDomain']; |
|
| 158 | + $httpHost = $configs['baseProto'].'://'.$configs['baseDomain']; |
|
| 159 | 159 | if ($configs['basePath'] !== '/') { |
| 160 | - $httpHost .= $configs['basePath'] . '/'; |
|
| 160 | + $httpHost .= $configs['basePath'].'/'; |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | // check if is this is URI not URL |
| 164 | 164 | if (!Str::startsWith($httpHost, $uri)) { |
| 165 | 165 | // check if lang is defined in URI or define it |
| 166 | 166 | if ($lang !== null && $configs['multiLanguage'] && !Str::startsWith($lang, $uri)) { |
| 167 | - $uri = $lang . '/' . ltrim($uri, '/'); |
|
| 167 | + $uri = $lang.'/'.ltrim($uri, '/'); |
|
| 168 | 168 | } |
| 169 | 169 | // add basic httpHost data |
| 170 | - $uri = rtrim($httpHost, '/') . '/' . ltrim($uri, '/'); |
|
| 170 | + $uri = rtrim($httpHost, '/').'/'.ltrim($uri, '/'); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | return $uri; |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | $this->baseDomain = App::$Properties->get('baseDomain'); |
| 93 | 93 | } |
| 94 | 94 | // build script url |
| 95 | - $this->scriptUrl = App::$Request->getScheme() . '://' . $this->baseDomain; |
|
| 95 | + $this->scriptUrl = App::$Request->getScheme().'://'.$this->baseDomain; |
|
| 96 | 96 | if (App::$Properties->get('basePath') !== '/') { |
| 97 | 97 | $this->scriptUrl .= rtrim(App::$Properties->get('basePath'), '/'); |
| 98 | 98 | } |
@@ -104,27 +104,27 @@ discard block |
||
| 104 | 104 | |
| 105 | 105 | $this->baseUrlNoLang = $this->baseUrl; |
| 106 | 106 | if (App::$Request->languageInPath() && App::$Request->getLanguage() !== null) { |
| 107 | - $this->baseUrl .= '/' . App::$Request->getLanguage(); |
|
| 107 | + $this->baseUrl .= '/'.App::$Request->getLanguage(); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | // add cron initiation from user if enabled |
| 111 | 111 | if ((bool)App::$Properties->get('userCron') && env_name === 'Front') { |
| 112 | - $this->addPlainCode('js', 'if(Math.random() > 0.8) { $.get("' . $this->scriptUrl . '/cron.php?rand=" + Math.random()); }'); |
|
| 112 | + $this->addPlainCode('js', 'if(Math.random() > 0.8) { $.get("'.$this->scriptUrl.'/cron.php?rand=" + Math.random()); }'); |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | // build vendor libs alias |
| 116 | - $this->vendorNamedLibrary['js']['jquery'] = $this->scriptUrl . '/vendor/bower/jquery/dist/jquery.min.js'; |
|
| 117 | - $this->vendorNamedLibrary['css']['bootstrap'] = $this->scriptUrl . '/vendor/bower/bootstrap/dist/css/bootstrap.min.css'; |
|
| 118 | - $this->vendorNamedLibrary['js']['bootstrap'] = $this->scriptUrl . '/vendor/bower/bootstrap/dist/js/bootstrap.min.js'; |
|
| 119 | - $this->vendorNamedLibrary['css']['fa'] = $this->scriptUrl . '/vendor/bower/components-font-awesome/css/font-awesome.min.css'; |
|
| 120 | - $this->vendorNamedLibrary['js']['jquery-ui'] = $this->scriptUrl . '/vendor/bower/jquery-ui/jquery-ui.min.js'; |
|
| 121 | - $this->vendorNamedLibrary['css']['jquery-ui'] = $this->scriptUrl . '/vendor/bower/jquery-ui/themes/base/jquery-ui.min.css'; |
|
| 116 | + $this->vendorNamedLibrary['js']['jquery'] = $this->scriptUrl.'/vendor/bower/jquery/dist/jquery.min.js'; |
|
| 117 | + $this->vendorNamedLibrary['css']['bootstrap'] = $this->scriptUrl.'/vendor/bower/bootstrap/dist/css/bootstrap.min.css'; |
|
| 118 | + $this->vendorNamedLibrary['js']['bootstrap'] = $this->scriptUrl.'/vendor/bower/bootstrap/dist/js/bootstrap.min.js'; |
|
| 119 | + $this->vendorNamedLibrary['css']['fa'] = $this->scriptUrl.'/vendor/bower/components-font-awesome/css/font-awesome.min.css'; |
|
| 120 | + $this->vendorNamedLibrary['js']['jquery-ui'] = $this->scriptUrl.'/vendor/bower/jquery-ui/jquery-ui.min.js'; |
|
| 121 | + $this->vendorNamedLibrary['css']['jquery-ui'] = $this->scriptUrl.'/vendor/bower/jquery-ui/themes/base/jquery-ui.min.css'; |
|
| 122 | 122 | |
| 123 | 123 | $themeAll = App::$Properties->get('theme'); |
| 124 | 124 | if (!isset($themeAll[env_name]) || Str::length($themeAll[env_name]) < 1) { |
| 125 | 125 | $themeAll[env_name] = 'default'; |
| 126 | 126 | } |
| 127 | - $this->currentViewUrl = $this->scriptUrl . '/Apps/View/' . env_name . '/' . $themeAll[env_name]; |
|
| 127 | + $this->currentViewUrl = $this->scriptUrl.'/Apps/View/'.env_name.'/'.$themeAll[env_name]; |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | /** |