@@ -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 | /** |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | $hints[] = '<code>LIMIT</code> without <code>ORDER BY</code> causes non-deterministic results, depending on the query execution plan'; |
| 161 | 161 | } |
| 162 | 162 | if (preg_match('/LIKE\\s[\'"](%.*?)[\'"]/i', $query, $matches)) { |
| 163 | - $hints[] = 'An argument has a leading wildcard character: <code>' . $matches[1] . '</code>. |
|
| 163 | + $hints[] = 'An argument has a leading wildcard character: <code>'.$matches[1].'</code>. |
|
| 164 | 164 | The predicate with this argument is not sargable and cannot use an index if one exists.'; |
| 165 | 165 | } |
| 166 | 166 | return implode("<br />", $hints); |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | foreach ($traces as $trace) { |
| 176 | 176 | if (isset($trace['class']) && isset($trace['file']) && strpos( |
| 177 | 177 | $trace['file'], |
| 178 | - DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR |
|
| 178 | + DIRECTORY_SEPARATOR.'vendor'.DIRECTORY_SEPARATOR |
|
| 179 | 179 | ) === false |
| 180 | 180 | ) { |
| 181 | 181 | if (isset($trace['object']) && is_a($trace['object'], 'Twig_Template')) { |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | $line = isset($trace['line']) ? $trace['line'] : '?'; |
| 188 | 188 | } |
| 189 | 189 | |
| 190 | - return $this->normalizeFilename($file) . ':' . $line; |
|
| 190 | + return $this->normalizeFilename($file).':'.$line; |
|
| 191 | 191 | } elseif (isset($trace['function']) && $trace['function'] == 'Illuminate\Routing\{closure}') { |
| 192 | 192 | return 'Route binding'; |
| 193 | 193 | } |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | |
| 26 | 26 | // check if class exist |
| 27 | 27 | if (!class_exists(self::$class)) { |
| 28 | - return 'Error: Widget is not founded: ' . self::$class; |
|
| 28 | + return 'Error: Widget is not founded: '.self::$class; |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | // init class and pass properties |
@@ -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 | /** |
@@ -71,9 +71,9 @@ discard block |
||
| 71 | 71 | } else { |
| 72 | 72 | $this->startMeasure(__METHOD__); |
| 73 | 73 | |
| 74 | - $layoutPath = App::$Alias->currentViewPath . '/layout/' . $this->layout . '.php'; |
|
| 74 | + $layoutPath = App::$Alias->currentViewPath.'/layout/'.$this->layout.'.php'; |
|
| 75 | 75 | if (!File::exist($layoutPath)) { |
| 76 | - throw new NativeException('Layout not founded: ' . $layoutPath); |
|
| 76 | + throw new NativeException('Layout not founded: '.$layoutPath); |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | $body = $this->output; |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | // set custom css library's not included on static call |
| 93 | 93 | $cssIncludeCode = App::$View->showCodeLink('css'); |
| 94 | 94 | if (!Str::likeEmpty($cssIncludeCode)) { |
| 95 | - $content = Str::replace('</head>', $cssIncludeCode . '</head>', $content); |
|
| 95 | + $content = Str::replace('</head>', $cssIncludeCode.'</head>', $content); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | if (App::$Debug) { |
| 103 | 103 | $content = Str::replace( |
| 104 | 104 | ['</body>', '</head>'], |
| 105 | - [App::$Debug->renderOut() . '</body>', App::$Debug->renderHead() . '</head>'], |
|
| 105 | + [App::$Debug->renderOut().'</body>', App::$Debug->renderHead().'</head>'], |
|
| 106 | 106 | $content |
| 107 | 107 | ); |
| 108 | 108 | } |
@@ -55,16 +55,16 @@ discard block |
||
| 55 | 55 | $this->lang = App::$Request->getLanguage(); |
| 56 | 56 | // get theme config and build full path |
| 57 | 57 | $themeConfig = App::$Properties->get('theme'); |
| 58 | - $this->themePath = root . DIRECTORY_SEPARATOR . 'Apps' . DIRECTORY_SEPARATOR . 'View' . DIRECTORY_SEPARATOR . env_name; |
|
| 58 | + $this->themePath = root.DIRECTORY_SEPARATOR.'Apps'.DIRECTORY_SEPARATOR.'View'.DIRECTORY_SEPARATOR.env_name; |
|
| 59 | 59 | if (isset($themeConfig[env_name]) && Str::length($themeConfig[env_name]) > 0) { |
| 60 | - $this->themePath .= DIRECTORY_SEPARATOR . $themeConfig[env_name]; |
|
| 60 | + $this->themePath .= DIRECTORY_SEPARATOR.$themeConfig[env_name]; |
|
| 61 | 61 | } else { |
| 62 | - $this->themePath .= DIRECTORY_SEPARATOR . 'default'; |
|
| 62 | + $this->themePath .= DIRECTORY_SEPARATOR.'default'; |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | // check if theme is available |
| 66 | 66 | if (!Directory::exist($this->themePath)) { |
| 67 | - throw new NativeException('Apps theme is not founded: ' . Str::replace(root, null, $this->themePath)); |
|
| 67 | + throw new NativeException('Apps theme is not founded: '.Str::replace(root, null, $this->themePath)); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | // get input args and build class properties |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | |
| 107 | 107 | // path still not defined? |
| 108 | 108 | if (!$path) { |
| 109 | - throw new SyntaxException('View not found: ' . App::$Security->strip_tags($path)); |
|
| 109 | + throw new SyntaxException('View not found: '.App::$Security->strip_tags($path)); |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | // cleanup from slashes on start/end |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | // lets try to get full path for current theme |
| 136 | 136 | $tmpPath = $path; |
| 137 | 137 | if (!Str::startsWith($this->themePath, $path)) { |
| 138 | - $tmpPath = Normalize::diskPath($this->themePath . '/' . $path . '.php'); |
|
| 138 | + $tmpPath = Normalize::diskPath($this->themePath.'/'.$path.'.php'); |
|
| 139 | 139 | } |
| 140 | 140 | } else { // sounds like a object-depended view call from controller or etc |
| 141 | 141 | // get stack trace of callbacks |
@@ -151,14 +151,14 @@ discard block |
||
| 151 | 151 | |
| 152 | 152 | // depended controller is not founded? Let finish |
| 153 | 153 | if (!$calledController) { |
| 154 | - throw new SyntaxException('View render is failed: callback controller not founded! Call with relative path: ' . $path); |
|
| 154 | + throw new SyntaxException('View render is failed: callback controller not founded! Call with relative path: '.$path); |
|
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | // get controller name |
| 158 | - $controllerName = Str::sub($calledController, Str::length('Apps\Controller\\' . env_name . '\\')); |
|
| 158 | + $controllerName = Str::sub($calledController, Str::length('Apps\Controller\\'.env_name.'\\')); |
|
| 159 | 159 | $controllerName = Str::lowerCase($controllerName); |
| 160 | 160 | // get full path |
| 161 | - $tmpPath = $this->themePath . DIRECTORY_SEPARATOR . $controllerName . DIRECTORY_SEPARATOR . $path . '.php'; |
|
| 161 | + $tmpPath = $this->themePath.DIRECTORY_SEPARATOR.$controllerName.DIRECTORY_SEPARATOR.$path.'.php'; |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | // check if builded view full path is exist |
@@ -168,11 +168,11 @@ discard block |
||
| 168 | 168 | |
| 169 | 169 | // hmm, not founded. Lets try to find in caller directory (for widgets, apps packages and other) |
| 170 | 170 | if ($source !== null) { |
| 171 | - $tmpPath = Normalize::diskPath($source . DIRECTORY_SEPARATOR . $path . '.php'); |
|
| 171 | + $tmpPath = Normalize::diskPath($source.DIRECTORY_SEPARATOR.$path.'.php'); |
|
| 172 | 172 | if (File::exist($tmpPath)) { |
| 173 | 173 | // add notify for native views |
| 174 | 174 | if (App::$Debug) { |
| 175 | - App::$Debug->addMessage('Render native viewer: ' . Str::replace(root, null, $tmpPath), 'info'); |
|
| 175 | + App::$Debug->addMessage('Render native viewer: '.Str::replace(root, null, $tmpPath), 'info'); |
|
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | return $tmpPath; |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | if (App::$Debug) { |
| 183 | - App::$Debug->addMessage('Viewer not founded on rendering: ' . $path, 'warning'); |
|
| 183 | + App::$Debug->addMessage('Viewer not founded on rendering: '.$path, 'warning'); |
|
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | return null; |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | foreach ($items as $item) { |
| 277 | 277 | $item = trim($item, '/'); |
| 278 | 278 | if (!Str::startsWith(App::$Alias->scriptUrl, $item) && !Str::startsWith('http', $item)) { // is local without proto and domain |
| 279 | - $item = App::$Alias->scriptUrl . '/' . $item; |
|
| 279 | + $item = App::$Alias->scriptUrl.'/'.$item; |
|
| 280 | 280 | } |
| 281 | 281 | $output[] = $item; |
| 282 | 282 | } |
@@ -285,9 +285,9 @@ discard block |
||
| 285 | 285 | $output = null; |
| 286 | 286 | foreach ($clear as $row) { |
| 287 | 287 | if ($type === 'css') { |
| 288 | - $output .= '<link rel="stylesheet" type="text/css" href="' . $row . '">' . "\n"; |
|
| 288 | + $output .= '<link rel="stylesheet" type="text/css" href="'.$row.'">'."\n"; |
|
| 289 | 289 | } elseif ($type === 'js') { |
| 290 | - $output .= '<script src="' . $row . '"></script>' . "\n"; |
|
| 290 | + $output .= '<script src="'.$row.'"></script>'."\n"; |
|
| 291 | 291 | } |
| 292 | 292 | } |
| 293 | 293 | |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | |
| 311 | 311 | $code = null; |
| 312 | 312 | foreach (App::$Alias->getPlainCode($type) as $row) { |
| 313 | - $code .= $row . "\n"; |
|
| 313 | + $code .= $row."\n"; |
|
| 314 | 314 | } |
| 315 | 315 | |
| 316 | 316 | return $code; |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | } elseif (method_exists($class, $obj)) { // maybe its a function? |
| 140 | 140 | $class = $class::$obj; // call function |
| 141 | 141 | } else { |
| 142 | - throw new SyntaxException('Filter callback execution failed: ' . $filterName); |
|
| 142 | + throw new SyntaxException('Filter callback execution failed: '.$filterName); |
|
| 143 | 143 | } |
| 144 | 144 | } |
| 145 | 145 | } |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | if (method_exists($class, $method)) { |
| 149 | 149 | $check = @$class::$method($fieldValue, $filterArgs); |
| 150 | 150 | } else { |
| 151 | - throw new SyntaxException('Filter callback execution failed: ' . $filterName); |
|
| 151 | + throw new SyntaxException('Filter callback execution failed: '.$filterName); |
|
| 152 | 152 | } |
| 153 | 153 | } elseif (method_exists('Ffcms\Core\Helper\ModelFilters', $filterName)) { // only full namespace\class path based :( |
| 154 | 154 | if ($filterArgs != null) { |
@@ -157,14 +157,14 @@ discard block |
||
| 157 | 157 | $check = ModelFilters::$filterName($fieldValue); |
| 158 | 158 | } |
| 159 | 159 | } else { |
| 160 | - throw new SyntaxException('Filter "' . $filterName . '" is not exist'); |
|
| 160 | + throw new SyntaxException('Filter "'.$filterName.'" is not exist'); |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | // if one from all validation tests is fail - mark as incorrect attribute |
| 164 | 164 | if ($check !== true) { |
| 165 | 165 | $this->_badAttr[] = $propertyName; |
| 166 | 166 | if (App::$Debug) { |
| 167 | - App::$Debug->addMessage('Validation failed. Property: ' . $propertyName . ', filter: ' . $filterName, 'warning'); |
|
| 167 | + App::$Debug->addMessage('Validation failed. Property: '.$propertyName.', filter: '.$filterName, 'warning'); |
|
| 168 | 168 | } |
| 169 | 169 | } else { |
| 170 | 170 | $field_set_name = $propertyName; |
@@ -42,9 +42,9 @@ discard block |
||
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | // try to load from file |
| 45 | - $configFile = ucfirst(Str::lowerCase($configName)) . '.php'; |
|
| 46 | - if (File::exist('/Private/Config/' . $configFile)) { |
|
| 47 | - $this->data[$configName] = File::inc('/Private/Config/' . $configFile, true); |
|
| 45 | + $configFile = ucfirst(Str::lowerCase($configName)).'.php'; |
|
| 46 | + if (File::exist('/Private/Config/'.$configFile)) { |
|
| 47 | + $this->data[$configName] = File::inc('/Private/Config/'.$configFile, true); |
|
| 48 | 48 | return true; |
| 49 | 49 | } |
| 50 | 50 | |
@@ -137,12 +137,12 @@ discard block |
||
| 137 | 137 | */ |
| 138 | 138 | public function writeConfig(string $configFile, array $data): bool |
| 139 | 139 | { |
| 140 | - $path = '/Private/Config/' . ucfirst(Str::lowerCase($configFile)) . '.php'; |
|
| 140 | + $path = '/Private/Config/'.ucfirst(Str::lowerCase($configFile)).'.php'; |
|
| 141 | 141 | if (!File::exist($path) || !File::writable($path)) { |
| 142 | 142 | return false; |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | - $saveData = '<?php return ' . Arr::exportVar($data) . ';'; |
|
| 145 | + $saveData = '<?php return '.Arr::exportVar($data).';'; |
|
| 146 | 146 | File::write($path, $saveData); |
| 147 | 147 | // overload config values if changed |
| 148 | 148 | $this->load($configFile, true); |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | if (Any::isArray($params) && count($params) > 0) { |
| 57 | 57 | foreach ($params as $var => $value) { |
| 58 | - $text = Str::replace('%' . $var . '%', $value, $text); |
|
| 58 | + $text = Str::replace('%'.$var.'%', $value, $text); |
|
| 59 | 59 | } |
| 60 | 60 | } |
| 61 | 61 | return $text; |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | public function translate(string $text, array $params = null) |
| 71 | 71 | { |
| 72 | 72 | $index = null; |
| 73 | - $namespace = 'Apps\Controller\\' . env_name . '\\'; |
|
| 73 | + $namespace = 'Apps\Controller\\'.env_name.'\\'; |
|
| 74 | 74 | foreach (@debug_backtrace() as $caller) { |
| 75 | 75 | if (isset($caller['class']) && Str::startsWith($namespace, $caller['class'])) { |
| 76 | 76 | $index = Str::sub((string)$caller['class'], Str::length($namespace)); |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | */ |
| 87 | 87 | protected function load(string $index): ?array |
| 88 | 88 | { |
| 89 | - $file = root . '/I18n/' . env_name . '/' . App::$Request->getLanguage() . '/' . $index . '.php'; |
|
| 89 | + $file = root.'/I18n/'.env_name.'/'.App::$Request->getLanguage().'/'.$index.'.php'; |
|
| 90 | 90 | if (!File::exist($file)) { |
| 91 | 91 | return []; |
| 92 | 92 | } |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | public function getAvailableLangs(): array |
| 126 | 126 | { |
| 127 | 127 | $langs = ['en']; |
| 128 | - $scan = Directory::scan(root . '/I18n/' . env_name . '/', GLOB_ONLYDIR, true); |
|
| 128 | + $scan = Directory::scan(root.'/I18n/'.env_name.'/', GLOB_ONLYDIR, true); |
|
| 129 | 129 | foreach ($scan as $row) { |
| 130 | 130 | $langs[] = trim($row, '/'); |
| 131 | 131 | } |