@@ -8,9 +8,9 @@ |
||
8 | 8 | } |
9 | 9 | |
10 | 10 | // load composer packages |
11 | -$loader = require root . '/vendor/autoload.php'; |
|
11 | +$loader = require root.'/vendor/autoload.php'; |
|
12 | 12 | // enable autoload for general namespaces user apps |
13 | 13 | $loader->add('Apps\\', root); |
14 | -$loader->add('Apps\\', root . '/vendor/phpffcms/demo-app-package/src'); // todo: remove me |
|
14 | +$loader->add('Apps\\', root.'/vendor/phpffcms/demo-app-package/src'); // todo: remove me |
|
15 | 15 | $loader->add('Extend\\', root); |
16 | 16 | $loader->add('Widgets\\', root); |
@@ -3,4 +3,4 @@ |
||
3 | 3 | define('root', __DIR__); |
4 | 4 | error_reporting(E_ALL ^ E_NOTICE); |
5 | 5 | |
6 | -require_once(root . '/Loader/Console/index.php'); |
|
7 | 6 | \ No newline at end of file |
7 | +require_once(root.'/Loader/Console/index.php'); |
|
8 | 8 | \ No newline at end of file |
@@ -22,13 +22,13 @@ |
||
22 | 22 | // widget is not founded, deny run |
23 | 23 | if ($wData === null) { |
24 | 24 | if (App::$Debug !== null) { |
25 | - App::$Debug->addMessage('Widget with name "' . App::$Security->strip_tags(self::$name) . '"[' . self::$class . '] is not founded!', 'error'); |
|
25 | + App::$Debug->addMessage('Widget with name "'.App::$Security->strip_tags(self::$name).'"['.self::$class.'] is not founded!', 'error'); |
|
26 | 26 | } |
27 | 27 | return null; |
28 | 28 | } |
29 | 29 | |
30 | 30 | // if widget is disabled - lets return nothing |
31 | - if ((int)$wData->disabled === 1) { |
|
31 | + if ((int) $wData->disabled === 1) { |
|
32 | 32 | return null; |
33 | 33 | } |
34 | 34 |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | } |
24 | 24 | |
25 | 25 | // add localizations |
26 | - App::$Translate->append(App::$Alias->currentViewPath . '/I18n/' . App::$Request->getLanguage() . '.php'); |
|
26 | + App::$Translate->append(App::$Alias->currentViewPath.'/I18n/'.App::$Request->getLanguage().'.php'); |
|
27 | 27 | |
28 | 28 | parent::__construct(); |
29 | 29 | } |
@@ -38,14 +38,14 @@ discard block |
||
38 | 38 | // if app class extend current class we can get origin name |
39 | 39 | $aliasName = Str::lastIn(get_class($this), '\\', true); |
40 | 40 | // check if this controller is enabled |
41 | - $this->application = MemoryObject::instance()->get('cache.apps.' . $appName . $aliasName); |
|
41 | + $this->application = MemoryObject::instance()->get('cache.apps.'.$appName.$aliasName); |
|
42 | 42 | if ($this->application === null) { |
43 | 43 | $this->application = AppRecord::where('type', '=', 'app') |
44 | 44 | ->where('sys_name', '=', $appName) |
45 | 45 | ->orWhere('sys_name', '=', $aliasName) |
46 | 46 | ->first(); |
47 | 47 | if ($this->application !== null) { |
48 | - MemoryObject::instance()->set('cache.apps.' . $appName . $aliasName, $this->application); |
|
48 | + MemoryObject::instance()->set('cache.apps.'.$appName.$aliasName, $this->application); |
|
49 | 49 | } |
50 | 50 | } |
51 | 51 | |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | } |
56 | 56 | |
57 | 57 | // check if disabled (0 = enabled, anything else = on) |
58 | - return (int)$this->application->disabled === 0; |
|
58 | + return (int) $this->application->disabled === 0; |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
@@ -67,10 +67,10 @@ discard block |
||
67 | 67 | if ($this->configs !== null) { |
68 | 68 | return $this->configs; |
69 | 69 | } |
70 | - $configs = (array)unserialize($this->application->configs); // data always stored like a "string" objects |
|
70 | + $configs = (array) unserialize($this->application->configs); // data always stored like a "string" objects |
|
71 | 71 | foreach ($configs as $cfg => $value) { |
72 | 72 | if (Obj::isLikeInt($value)) { |
73 | - $configs[$cfg] = (int)$value; // convert string 1 "1" to int 1 1 |
|
73 | + $configs[$cfg] = (int) $value; // convert string 1 "1" to int 1 1 |
|
74 | 74 | } |
75 | 75 | } |
76 | 76 | $this->configs = $configs; |
@@ -25,7 +25,7 @@ |
||
25 | 25 | */ |
26 | 26 | public function get() |
27 | 27 | { |
28 | - return App::$Alias->scriptUrl . '/api/captcha/gregwar?time=' . microtime(true) . '&lang=' . App::$Request->getLanguage(); |
|
28 | + return App::$Alias->scriptUrl.'/api/captcha/gregwar?time='.microtime(true).'&lang='.App::$Request->getLanguage(); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | /** |
@@ -39,9 +39,9 @@ discard block |
||
39 | 39 | public function get() |
40 | 40 | { |
41 | 41 | // build google captcha ;) |
42 | - $html = '<div class="g-recaptcha" data-sitekey="' . self::$siteKey . '"></div> |
|
42 | + $html = '<div class="g-recaptcha" data-sitekey="'.self::$siteKey.'"></div> |
|
43 | 43 | <script type="text/javascript" |
44 | - src="https://www.google.com/recaptcha/api.js?hl=' . App::$Request->getLanguage() . '"> |
|
44 | + src="https://www.google.com/recaptcha/api.js?hl=' . App::$Request->getLanguage().'"> |
|
45 | 45 | </script>'; |
46 | 46 | return $html; |
47 | 47 | } |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | ]); |
65 | 65 | |
66 | 66 | // make request and parse response |
67 | - $url = $request->getSchemeAndHttpHost() . $request->getRequestUri(); |
|
67 | + $url = $request->getSchemeAndHttpHost().$request->getRequestUri(); |
|
68 | 68 | $response = Url::getRemoteContent($url); |
69 | 69 | $object = json_decode($response); |
70 | 70 |
@@ -22,11 +22,11 @@ discard block |
||
22 | 22 | $cfg = $this->getConfigs(); |
23 | 23 | // check cache is defined |
24 | 24 | if ($this->cache === null || !Obj::isLikeInt($this->cache)) { |
25 | - $this->cache = (int)$cfg['cache']; |
|
25 | + $this->cache = (int) $cfg['cache']; |
|
26 | 26 | } |
27 | 27 | // check tag count is defined |
28 | 28 | if ($this->count === null || !Obj::isLikeInt($this->count)) { |
29 | - $this->count = (int)$cfg['count']; |
|
29 | + $this->count = (int) $cfg['count']; |
|
30 | 30 | } |
31 | 31 | } |
32 | 32 | |
@@ -40,10 +40,10 @@ discard block |
||
40 | 40 | if ($this->cache === 0) { |
41 | 41 | $records = $this->makeQuery(); |
42 | 42 | } else { |
43 | - $records === App::$Cache->get('widget.contenttag.' . $classHash); |
|
43 | + $records === App::$Cache->get('widget.contenttag.'.$classHash); |
|
44 | 44 | if ($records === null) { |
45 | 45 | $records = $this->makeQuery(); |
46 | - App::$Cache->set('widget.contenttag' . $classHash, $records, $this->cache); |
|
46 | + App::$Cache->set('widget.contenttag'.$classHash, $records, $this->cache); |
|
47 | 47 | } |
48 | 48 | } |
49 | 49 |
@@ -78,7 +78,7 @@ |
||
78 | 78 | |
79 | 79 | /** |
80 | 80 | * Make query to database |
81 | - * @return object |
|
81 | + * @return string |
|
82 | 82 | */ |
83 | 83 | private function makeQuery() |
84 | 84 | { |
@@ -10,18 +10,18 @@ discard block |
||
10 | 10 | |
11 | 11 | class Contenttag extends AbstractWidget |
12 | 12 | { |
13 | - use OopTools; |
|
13 | + use OopTools; |
|
14 | 14 | |
15 | - public $count; |
|
16 | - public $cache; |
|
15 | + public $count; |
|
16 | + public $cache; |
|
17 | 17 | |
18 | - public $tpl = 'widgets/contenttag/default'; |
|
18 | + public $tpl = 'widgets/contenttag/default'; |
|
19 | 19 | |
20 | - /** |
|
21 | - * Set default configurations if not defined |
|
22 | - * {@inheritDoc} |
|
23 | - * @see \Ffcms\Core\Arch\Widget::init() |
|
24 | - */ |
|
20 | + /** |
|
21 | + * Set default configurations if not defined |
|
22 | + * {@inheritDoc} |
|
23 | + * @see \Ffcms\Core\Arch\Widget::init() |
|
24 | + */ |
|
25 | 25 | public function init() |
26 | 26 | { |
27 | 27 | $cfg = $this->getConfigs(); |
@@ -43,29 +43,29 @@ discard block |
||
43 | 43 | public function display() |
44 | 44 | { |
45 | 45 | // get special properties hash |
46 | - $classHash = $this->createStringClassSnapshotHash(); |
|
46 | + $classHash = $this->createStringClassSnapshotHash(); |
|
47 | 47 | |
48 | - // get records rows from cache or directly from db |
|
49 | - $records = null; |
|
50 | - if ($this->cache === 0) { |
|
51 | - $records = $this->makeQuery(); |
|
52 | - } else { |
|
53 | - $records === App::$Cache->get('widget.contenttag.' . $classHash); |
|
54 | - if ($records === null) { |
|
55 | - $records = $this->makeQuery(); |
|
56 | - App::$Cache->set('widget.contenttag' . $classHash, $records, $this->cache); |
|
57 | - } |
|
58 | - } |
|
48 | + // get records rows from cache or directly from db |
|
49 | + $records = null; |
|
50 | + if ($this->cache === 0) { |
|
51 | + $records = $this->makeQuery(); |
|
52 | + } else { |
|
53 | + $records === App::$Cache->get('widget.contenttag.' . $classHash); |
|
54 | + if ($records === null) { |
|
55 | + $records = $this->makeQuery(); |
|
56 | + App::$Cache->set('widget.contenttag' . $classHash, $records, $this->cache); |
|
57 | + } |
|
58 | + } |
|
59 | 59 | |
60 | - // check if result is not empty |
|
60 | + // check if result is not empty |
|
61 | 61 | if ($records === null || $records->count() < 1) { |
62 | 62 | return __('Content tags is not found'); |
63 | 63 | } |
64 | 64 | |
65 | 65 | // render view |
66 | - return App::$View->render($this->tpl, [ |
|
67 | - 'records' => $records |
|
68 | - ]); |
|
66 | + return App::$View->render($this->tpl, [ |
|
67 | + 'records' => $records |
|
68 | + ]); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | /** |
@@ -75,11 +75,11 @@ discard block |
||
75 | 75 | private function makeQuery() |
76 | 76 | { |
77 | 77 | return TagRecord::select([ |
78 | - App::$Database->getConnection()->raw('SQL_CALC_FOUND_ROWS tag'), |
|
79 | - App::$Database->getConnection()->raw('COUNT(*) AS count') |
|
80 | - ])->groupBy('tag') |
|
81 | - ->orderBy('count', 'DESC') |
|
82 | - ->take($this->count) |
|
83 | - ->get(); |
|
78 | + App::$Database->getConnection()->raw('SQL_CALC_FOUND_ROWS tag'), |
|
79 | + App::$Database->getConnection()->raw('COUNT(*) AS count') |
|
80 | + ])->groupBy('tag') |
|
81 | + ->orderBy('count', 'DESC') |
|
82 | + ->take($this->count) |
|
83 | + ->get(); |
|
84 | 84 | } |
85 | 85 | } |
86 | 86 | \ No newline at end of file |
@@ -12,7 +12,7 @@ |
||
12 | 12 | // this environment is based on json response type |
13 | 13 | define('env_type', 'json'); |
14 | 14 | |
15 | -require_once(root . '/Loader/Autoload.php'); |
|
15 | +require_once(root.'/Loader/Autoload.php'); |
|
16 | 16 | |
17 | 17 | // make fast-access alias \App::$Object |
18 | 18 | // class_alias('Ffcms\Core\App', 'App'); |
@@ -12,7 +12,7 @@ |
||
12 | 12 | // this environment is based on json response type |
13 | 13 | define('env_type', 'json'); |
14 | 14 | |
15 | -require_once(root . '/Loader/Autoload.php'); |
|
15 | +require_once(root.'/Loader/Autoload.php'); |
|
16 | 16 | |
17 | 17 | // make fast-access alias \App::$Object |
18 | 18 | // class_alias('Ffcms\Core\App', 'App'); |