@@ -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 | } |
@@ -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 | /** |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | * String html tags and escape quotes |
51 | 51 | * @param string|array $html |
52 | 52 | * @param boolean $escapeQuotes |
53 | - * @return string|array|null |
|
53 | + * @return string|null |
|
54 | 54 | */ |
55 | 55 | public function strip_tags($html, $escapeQuotes = true) |
56 | 56 | { |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | * @deprecated |
91 | 91 | * @param $var |
92 | 92 | * @param null $indent |
93 | - * @return mixed|string |
|
93 | + * @return string|null |
|
94 | 94 | */ |
95 | 95 | public function var_export54($var, $indent = null, $guessTypes = false) { |
96 | 96 | return Arr::exportVar($var, $indent, $guessTypes); |
@@ -22,7 +22,7 @@ |
||
22 | 22 | public function __construct() |
23 | 23 | { |
24 | 24 | $config = \HTMLPurifier_Config::createDefault(); |
25 | - $config->set('Cache.SerializerPath', root . '/Private/Cache/HTMLPurifier/'); |
|
25 | + $config->set('Cache.SerializerPath', root.'/Private/Cache/HTMLPurifier/'); |
|
26 | 26 | $config->set('HTML.Allowed', 'p,b,strong,em,a[href],i,span,ul,ol,li,blockquote,h2,h3,pre,code,img[src|alt|width|height]'); |
27 | 27 | //$config->set('URI.Base', 'http://www.example.com'); |
28 | 28 | //$config->set('URI.MakeAbsolute', true); |
@@ -5,7 +5,6 @@ |
||
5 | 5 | use Ffcms\Core\App; |
6 | 6 | use Ffcms\Core\Helper\Type\Any; |
7 | 7 | use Ffcms\Core\Helper\Type\Arr; |
8 | -use Ffcms\Core\Helper\Type\Obj; |
|
9 | 8 | use Ffcms\Core\Helper\Type\Str; |
10 | 9 | |
11 | 10 | /** |
@@ -60,8 +60,9 @@ discard block |
||
60 | 60 | } |
61 | 61 | |
62 | 62 | $text = strip_tags($html); |
63 | - if ($escapeQuotes) |
|
64 | - $text = $this->escapeQuotes($text); |
|
63 | + if ($escapeQuotes) { |
|
64 | + $text = $this->escapeQuotes($text); |
|
65 | + } |
|
65 | 66 | |
66 | 67 | return $text; |
67 | 68 | } |
@@ -113,8 +114,9 @@ discard block |
||
113 | 114 | */ |
114 | 115 | public static function password_hash($password, $salt = null) |
115 | 116 | { |
116 | - if ($salt === null || !Any::isStr($salt) || Str::length($salt) < 1) |
|
117 | - $salt = App::$Properties->get('passwordSalt'); |
|
117 | + if ($salt === null || !Any::isStr($salt) || Str::length($salt) < 1) { |
|
118 | + $salt = App::$Properties->get('passwordSalt'); |
|
119 | + } |
|
118 | 120 | |
119 | 121 | return crypt($password, $salt); |
120 | 122 | } |
@@ -126,8 +128,9 @@ discard block |
||
126 | 128 | */ |
127 | 129 | public static function simpleHash($string): ?string |
128 | 130 | { |
129 | - if (!Any::isLine($string)) |
|
130 | - return null; |
|
131 | + if (!Any::isLine($string)) { |
|
132 | + return null; |
|
133 | + } |
|
131 | 134 | |
132 | 135 | return dechex(crc32($string)); |
133 | 136 | } |
@@ -26,7 +26,7 @@ |
||
26 | 26 | |
27 | 27 | /** |
28 | 28 | * BootManager constructor. Pass composer loader inside |
29 | - * @param bool|object $loader |
|
29 | + * @param boolean $loader |
|
30 | 30 | */ |
31 | 31 | public function __construct($loader = false) |
32 | 32 | { |
@@ -8,7 +8,6 @@ |
||
8 | 8 | use Ffcms\Core\Helper\FileSystem\Directory; |
9 | 9 | use Ffcms\Core\Helper\FileSystem\File; |
10 | 10 | use Ffcms\Core\Helper\Type\Any; |
11 | -use Ffcms\Core\Helper\Type\Obj; |
|
12 | 11 | use Ffcms\Core\Helper\Type\Str; |
13 | 12 | |
14 | 13 | /** |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | // check if cache is enabled |
44 | 44 | if (App::$Cache !== null) { |
45 | 45 | // try to get bootable class map from cache, or initialize parsing |
46 | - $cache = App::$Cache->getItem('boot.' . env_name . '.class.map'); |
|
46 | + $cache = App::$Cache->getItem('boot.'.env_name.'.class.map'); |
|
47 | 47 | if (!$cache->isHit()) { |
48 | 48 | $this->compileBootableClasses(); |
49 | 49 | $cache->set($this->objects)->expiresAfter(static::CACHE_TREE_TIME); |
@@ -96,11 +96,11 @@ discard block |
||
96 | 96 | { |
97 | 97 | // list app root's |
98 | 98 | foreach ($this->appRoots as $app) { |
99 | - $app .= '/Apps/Controller/' . env_name; |
|
99 | + $app .= '/Apps/Controller/'.env_name; |
|
100 | 100 | $files = File::listFiles($app, ['.php'], true); |
101 | 101 | foreach ($files as $file) { |
102 | 102 | // define full class name with namespace |
103 | - $class = 'Apps\Controller\\' . env_name . '\\' . Str::cleanExtension($file); |
|
103 | + $class = 'Apps\Controller\\'.env_name.'\\'.Str::cleanExtension($file); |
|
104 | 104 | // check if class exists (must be loaded over autoloader), boot method exist and this is controller instanceof |
105 | 105 | if (class_exists($class) && method_exists($class, 'boot') && is_a($class, 'Ffcms\Core\Arch\Controller', true)) { |
106 | 106 | $this->objects[] = $class; |
@@ -110,14 +110,14 @@ discard block |
||
110 | 110 | |
111 | 111 | // list widget root's |
112 | 112 | foreach ($this->widgetRoots as $widget) { |
113 | - $widget .= '/Widgets/' . env_name; |
|
113 | + $widget .= '/Widgets/'.env_name; |
|
114 | 114 | // widgets are packed in directory, classname should be the same with root directory name |
115 | 115 | $dirs = Directory::scan($widget, GLOB_ONLYDIR, true); |
116 | 116 | if (!Any::isArray($dirs)) |
117 | 117 | continue; |
118 | 118 | |
119 | 119 | foreach ($dirs as $instance) { |
120 | - $class = 'Widgets\\' . env_name . '\\' . $instance . '\\' . $instance; |
|
120 | + $class = 'Widgets\\'.env_name.'\\'.$instance.'\\'.$instance; |
|
121 | 121 | if (class_exists($class) && method_exists($class, 'boot') && is_a($class, 'Ffcms\Core\Arch\Widget', true)) { |
122 | 122 | $this->objects[] = $class; |
123 | 123 | } |
@@ -81,11 +81,13 @@ discard block |
||
81 | 81 | } |
82 | 82 | |
83 | 83 | // set default root path if not found anything else |
84 | - if (count($this->appRoots) < 1) |
|
85 | - $this->appRoots = [root]; |
|
84 | + if (count($this->appRoots) < 1) { |
|
85 | + $this->appRoots = [root]; |
|
86 | + } |
|
86 | 87 | |
87 | - if (count($this->widgetRoots) < 1) |
|
88 | - $this->widgetRoots = [root]; |
|
88 | + if (count($this->widgetRoots) < 1) { |
|
89 | + $this->widgetRoots = [root]; |
|
90 | + } |
|
89 | 91 | } |
90 | 92 | |
91 | 93 | /** |
@@ -113,8 +115,9 @@ discard block |
||
113 | 115 | $widget .= '/Widgets/' . env_name; |
114 | 116 | // widgets are packed in directory, classname should be the same with root directory name |
115 | 117 | $dirs = Directory::scan($widget, GLOB_ONLYDIR, true); |
116 | - if (!Any::isArray($dirs)) |
|
117 | - continue; |
|
118 | + if (!Any::isArray($dirs)) { |
|
119 | + continue; |
|
120 | + } |
|
118 | 121 | |
119 | 122 | foreach ($dirs as $instance) { |
120 | 123 | $class = 'Widgets\\' . env_name . '\\' . $instance . '\\' . $instance; |
@@ -133,8 +136,9 @@ discard block |
||
133 | 136 | { |
134 | 137 | $this->startMeasure(__METHOD__); |
135 | 138 | |
136 | - if (!Any::isArray($this->objects)) |
|
137 | - return false; |
|
139 | + if (!Any::isArray($this->objects)) { |
|
140 | + return false; |
|
141 | + } |
|
138 | 142 | |
139 | 143 | foreach ($this->objects as $class) { |
140 | 144 | forward_static_call([$class, 'boot']); |
@@ -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 |
@@ -4,7 +4,6 @@ |
||
4 | 4 | |
5 | 5 | use Apps\ActiveRecord\App as AppRecord; |
6 | 6 | use Ffcms\Core\Helper\Type\Any; |
7 | -use Ffcms\Core\Helper\Type\Obj; |
|
8 | 7 | use Ffcms\Core\Helper\Type\Str; |
9 | 8 | use Ffcms\Core\Interfaces\iWidget; |
10 | 9 | use Ffcms\Core\Traits\DynamicGlobal; |
@@ -33,8 +33,9 @@ |
||
33 | 33 | $object = new self::$class; |
34 | 34 | if (Any::isArray($params) && count($params) > 0) { |
35 | 35 | foreach ($params as $property => $value) { |
36 | - if (property_exists($object, $property)) |
|
37 | - $object->{$property} = $value; |
|
36 | + if (property_exists($object, $property)) { |
|
37 | + $object->{$property} = $value; |
|
38 | + } |
|
38 | 39 | } |
39 | 40 | } |
40 | 41 |
@@ -210,7 +210,7 @@ |
||
210 | 210 | /** |
211 | 211 | * Get file md5 hash |
212 | 212 | * @param string $path |
213 | - * @return bool|string |
|
213 | + * @return false|string |
|
214 | 214 | */ |
215 | 215 | public static function getMd5($path) |
216 | 216 | { |
@@ -192,15 +192,15 @@ |
||
192 | 192 | return []; |
193 | 193 | } |
194 | 194 | |
195 | - $dir = opendir($path . '/.'); |
|
195 | + $dir = opendir($path.'/.'); |
|
196 | 196 | while ($item = readdir($dir)) { |
197 | - if (is_file($sub = $path . '/' . $item)) { |
|
197 | + if (is_file($sub = $path.'/'.$item)) { |
|
198 | 198 | $item_ext = Str::lastIn($item, '.'); |
199 | 199 | if ($ext === null || Arr::in($item_ext, $ext)) { |
200 | 200 | if ($returnRelative) { |
201 | 201 | $files[] = $item; |
202 | 202 | } else { |
203 | - $files[] = $path . DIRECTORY_SEPARATOR . $item; |
|
203 | + $files[] = $path.DIRECTORY_SEPARATOR.$item; |
|
204 | 204 | } |
205 | 205 | } |
206 | 206 | } else { |
@@ -35,7 +35,7 @@ |
||
35 | 35 | } |
36 | 36 | // get image link |
37 | 37 | $image = App::$Captcha->get(); |
38 | - $response = '<img id="src-secure-image" src="' . $image . '" alt="captcha" onClick="this.src=\''.$image.'&rnd=\'+Math.random()" />'; |
|
38 | + $response = '<img id="src-secure-image" src="'.$image.'" alt="captcha" onClick="this.src=\''.$image.'&rnd=\'+Math.random()" />'; |
|
39 | 39 | // render response tag with image |
40 | 40 | $this->properties['type'] = 'text'; |
41 | 41 | $response .= self::buildSingleTag('input', $this->properties); |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | // initialize new DOM model |
31 | 31 | $dom = new Dom(); |
32 | 32 | // return DOM-HTML, build based on closures! |
33 | - return $dom->{$elements['type']}(function () use ($dom, $elements) { |
|
33 | + return $dom->{$elements['type']}(function() use ($dom, $elements) { |
|
34 | 34 | // prepare output avg variable |
35 | 35 | $itemHTML = null; |
36 | 36 | // get active order level |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | |
72 | 72 | return $dom->li(function() use($dom, $item){ |
73 | 73 | $dropdownLink = $dom->a(function() use ($dom, $item){ |
74 | - return self::applyEscape($item['text'], $item['html'], $item['!secure']) . ' ' . $dom->span(function(){}, ['class' => 'caret']); |
|
74 | + return self::applyEscape($item['text'], $item['html'], $item['!secure']).' '.$dom->span(function() {}, ['class' => 'caret']); |
|
75 | 75 | }, $item['dropdown']); |
76 | 76 | |
77 | 77 | $dropdownElements = $dom->ul(function() use ($dom, $item){ |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | return $resp; |
83 | 83 | }, $item['menuProperty']); |
84 | 84 | |
85 | - return $dropdownLink . $dropdownElements; |
|
85 | + return $dropdownLink.$dropdownElements; |
|
86 | 86 | }, $item['property']); |
87 | 87 | |
88 | 88 | } |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | $item['linkProperty']['href'] = self::convertLink($item['link']); |
137 | 137 | |
138 | 138 | // build output <li@params><a @params>@text</li> |
139 | - return $dom->li(function () use ($dom, $text, $item) { |
|
139 | + return $dom->li(function() use ($dom, $text, $item) { |
|
140 | 140 | return $dom->a(function() use ($text) { |
141 | 141 | return $text; |
142 | 142 | }, $item['linkProperty']); |
@@ -24,8 +24,9 @@ discard block |
||
24 | 24 | public static function display($elements) |
25 | 25 | { |
26 | 26 | // check input elements |
27 | - if (!Arr::in($elements['type'], ['ul', 'ol']) || count($elements['items']) < 1) |
|
28 | - return null; |
|
27 | + if (!Arr::in($elements['type'], ['ul', 'ol']) || count($elements['items']) < 1) { |
|
28 | + return null; |
|
29 | + } |
|
29 | 30 | |
30 | 31 | // initialize new DOM model |
31 | 32 | $dom = new Dom(); |
@@ -62,11 +63,13 @@ discard block |
||
62 | 63 | */ |
63 | 64 | private static function buildDropdown($dom, $item) |
64 | 65 | { |
65 | - if (!Any::isArray($item['items'])) |
|
66 | - return null; |
|
66 | + if (!Any::isArray($item['items'])) { |
|
67 | + return null; |
|
68 | + } |
|
67 | 69 | |
68 | - if (!isset($item['menuProperty']['class'])) |
|
69 | - $item['menuProperty']['class'] = 'dropdown-menu'; |
|
70 | + if (!isset($item['menuProperty']['class'])) { |
|
71 | + $item['menuProperty']['class'] = 'dropdown-menu'; |
|
72 | + } |
|
70 | 73 | |
71 | 74 | return $dom->li(function() use($dom, $item){ |
72 | 75 | $dropdownLink = $dom->a(function() use ($dom, $item){ |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | /** |
42 | 42 | * Get label value by variable name |
43 | 43 | * @param string $param |
44 | - * @return mixed |
|
44 | + * @return string |
|
45 | 45 | */ |
46 | 46 | final public function getLabel($param) |
47 | 47 | { |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | |
66 | 66 | /** |
67 | 67 | * Set attribute labels for model variables |
68 | - * @return array |
|
68 | + * @return string |
|
69 | 69 | */ |
70 | 70 | public function labels(): array |
71 | 71 | { |
@@ -6,7 +6,6 @@ |
||
6 | 6 | use Ffcms\Core\App; |
7 | 7 | use Ffcms\Core\Exception\SyntaxException; |
8 | 8 | use Ffcms\Core\Helper\Type\Any; |
9 | -use Ffcms\Core\Helper\Type\Obj; |
|
10 | 9 | use Ffcms\Core\Helper\Type\Str; |
11 | 10 | use Ffcms\Core\Interfaces\iModel; |
12 | 11 | use Ffcms\Core\Traits\DynamicGlobal; |
@@ -143,8 +143,9 @@ discard block |
||
143 | 143 | } |
144 | 144 | // add message about wrong attribute to session holder, later display it |
145 | 145 | $attrLabel = $attr; |
146 | - if ($this->getLabel($attr) !== null) |
|
147 | - $attrLabel = $this->getLabel($attr); |
|
146 | + if ($this->getLabel($attr) !== null) { |
|
147 | + $attrLabel = $this->getLabel($attr); |
|
148 | + } |
|
148 | 149 | |
149 | 150 | App::$Session->getFlashBag()->add('warning', __('Field "%field%" is incorrect', ['field' => $attrLabel])); |
150 | 151 | } |
@@ -162,8 +163,9 @@ discard block |
||
162 | 163 | $properties = null; |
163 | 164 | // list all properties here, array_walk sucks on performance! |
164 | 165 | foreach ($this as $property => $value) { |
165 | - if (Str::startsWith('_', $property)) |
|
166 | - continue; |
|
166 | + if (Str::startsWith('_', $property)) { |
|
167 | + continue; |
|
168 | + } |
|
167 | 169 | |
168 | 170 | $properties[$property] = $value; |
169 | 171 | } |
@@ -177,8 +179,9 @@ discard block |
||
177 | 179 | public function clearProperties(): void |
178 | 180 | { |
179 | 181 | foreach ($this as $property => $value) { |
180 | - if (!Str::startsWith('_', $property)) |
|
181 | - $this->{$property} = null; |
|
182 | + if (!Str::startsWith('_', $property)) { |
|
183 | + $this->{$property} = null; |
|
184 | + } |
|
182 | 185 | } |
183 | 186 | } |
184 | 187 | |
@@ -195,12 +198,15 @@ discard block |
||
195 | 198 | foreach ($rules as $rule) { |
196 | 199 | if (Any::isArray($rule[0])) { // 2 or more rules [['field1', 'field2'], 'filter', 'filter_argv'] |
197 | 200 | foreach ($rule[0] as $tfield) { |
198 | - if ($tfield == $field) |
|
199 | - $response[$rule[1]] = $rule[2]; // ['min_length' => 1, 'required' => null] |
|
201 | + if ($tfield == $field) { |
|
202 | + $response[$rule[1]] = $rule[2]; |
|
203 | + } |
|
204 | + // ['min_length' => 1, 'required' => null] |
|
200 | 205 | } |
201 | 206 | } else { // 1 rule ['field1', 'filter', 'filter_argv'] |
202 | - if ($rule[0] === $field) |
|
203 | - $response[$rule[1]] = $rule[2]; |
|
207 | + if ($rule[0] === $field) { |
|
208 | + $response[$rule[1]] = $rule[2]; |
|
209 | + } |
|
204 | 210 | } |
205 | 211 | } |
206 | 212 |