@@ -2,7 +2,6 @@ |
||
2 | 2 | |
3 | 3 | namespace Apps\Controller\Front; |
4 | 4 | |
5 | -use Apps\ActiveRecord\Content as ContentEntity; |
|
6 | 5 | use Apps\ActiveRecord\Content as ContentRecord; |
7 | 6 | use Apps\ActiveRecord\ContentCategory; |
8 | 7 | use Apps\Model\Front\Content\EntityCategoryList; |
@@ -3,7 +3,6 @@ |
||
3 | 3 | namespace Apps\Model\Front\Content; |
4 | 4 | |
5 | 5 | |
6 | -use Apps\ActiveRecord\Content; |
|
7 | 6 | use Apps\ActiveRecord\Content as ContentRecord; |
8 | 7 | use Apps\ActiveRecord\ContentCategory; |
9 | 8 | use Apps\ActiveRecord\User; |
@@ -3,7 +3,6 @@ |
||
3 | 3 | namespace Apps\Model\Front\Profile; |
4 | 4 | |
5 | 5 | use Apps\ActiveRecord\Blacklist; |
6 | -use Ffcms\Core\App; |
|
7 | 6 | use Ffcms\Core\Arch\Model; |
8 | 7 | use Ffcms\Core\Interfaces\iUser; |
9 | 8 |
@@ -12,7 +12,6 @@ |
||
12 | 12 | use Ffcms\Core\Exception\NotFoundException; |
13 | 13 | use Apps\Model\Front\Content\EntityContentRead; |
14 | 14 | use Ffcms\Core\Helper\HTML\SimplePagination; |
15 | -use Ffcms\Core\Helper\Serialize; |
|
16 | 15 | use Ffcms\Core\Helper\Type\Str; |
17 | 16 | use Suin\RSSWriter\Channel; |
18 | 17 | use Suin\RSSWriter\Feed; |
@@ -86,18 +86,18 @@ discard block |
||
86 | 86 | $user = App::$User->identity(); |
87 | 87 | // user is not authed ? |
88 | 88 | if ($user === null || !App::$User->isAuth()) { |
89 | - $redirectUrl = App::$Alias->scriptUrl . '/user/login'; |
|
89 | + $redirectUrl = App::$Alias->scriptUrl.'/user/login'; |
|
90 | 90 | App::$Response->redirect($redirectUrl, true); |
91 | 91 | exit(); |
92 | 92 | } |
93 | 93 | |
94 | - $permission = env_name . '/' . App::$Request->getController() . '/' . App::$Request->getAction(); |
|
94 | + $permission = env_name.'/'.App::$Request->getController().'/'.App::$Request->getAction(); |
|
95 | 95 | |
96 | 96 | // doesn't have permission? get the f*ck out |
97 | 97 | if (!$user->getRole()->can($permission)) { |
98 | 98 | App::$Session->invalidate(); |
99 | 99 | |
100 | - $redirectUrl = App::$Alias->scriptUrl . '/user/login'; |
|
100 | + $redirectUrl = App::$Alias->scriptUrl.'/user/login'; |
|
101 | 101 | App::$Response->redirect($redirectUrl, true); |
102 | 102 | exit(); |
103 | 103 | } |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | */ |
145 | 145 | public function getConfigs() |
146 | 146 | { |
147 | - return $this->type === 'widget' ? (array)$this->widget->configs : (array)$this->application->configs; |
|
147 | + return $this->type === 'widget' ? (array) $this->widget->configs : (array) $this->application->configs; |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | /** |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | } |
32 | 32 | |
33 | 33 | // add localizations |
34 | - App::$Translate->append(App::$Alias->currentViewPath . '/I18n/' . App::$Request->getLanguage() . '.php'); |
|
34 | + App::$Translate->append(App::$Alias->currentViewPath.'/I18n/'.App::$Request->getLanguage().'.php'); |
|
35 | 35 | |
36 | 36 | parent::__construct(); |
37 | 37 | } |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | } |
55 | 55 | |
56 | 56 | // check if disabled (0 = enabled, anything else = on) |
57 | - return (int)$this->application->disabled === 0; |
|
57 | + return (int) $this->application->disabled === 0; |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
@@ -66,10 +66,10 @@ discard block |
||
66 | 66 | if ($this->configs !== null) { |
67 | 67 | return $this->configs; |
68 | 68 | } |
69 | - $configs = (array)$this->application->configs; |
|
69 | + $configs = (array) $this->application->configs; |
|
70 | 70 | foreach ($configs as $cfg => $value) { |
71 | 71 | if (Obj::isLikeInt($value)) { |
72 | - $configs[$cfg] = (int)$value; // convert string 1 "1" to int 1 1 |
|
72 | + $configs[$cfg] = (int) $value; // convert string 1 "1" to int 1 1 |
|
73 | 73 | } |
74 | 74 | } |
75 | 75 | $this->configs = $configs; |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | |
72 | 72 | // labels for custom fields |
73 | 73 | foreach (ProfileField::all() as $custom) { |
74 | - $labels['custom_data.' . $custom->id] = $custom->getLocaled('name'); |
|
74 | + $labels['custom_data.'.$custom->id] = $custom->getLocaled('name'); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | return $labels; |
@@ -97,12 +97,12 @@ discard block |
||
97 | 97 | // custom profile fields |
98 | 98 | foreach (ProfileField::all() as $custom) { |
99 | 99 | $rules[] = [ |
100 | - 'custom_data.' . $custom->id, |
|
100 | + 'custom_data.'.$custom->id, |
|
101 | 101 | 'used' |
102 | 102 | ]; |
103 | 103 | $rules[] = [ |
104 | - 'custom_data.' . $custom->id, |
|
105 | - (int)$custom->reg_cond === 1 ? 'direct_match' : 'reverse_match', |
|
104 | + 'custom_data.'.$custom->id, |
|
105 | + (int) $custom->reg_cond === 1 ? 'direct_match' : 'reverse_match', |
|
106 | 106 | $custom->reg_exp |
107 | 107 | ]; |
108 | 108 | } |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | */ |
35 | 35 | public static function all($columns = ['*']) |
36 | 36 | { |
37 | - $cacheName = 'activerecord.contentcategory.all.' . implode('.', $columns); |
|
37 | + $cacheName = 'activerecord.contentcategory.all.'.implode('.', $columns); |
|
38 | 38 | $records = MemoryObject::instance()->get($cacheName); |
39 | 39 | if ($records === null) { |
40 | 40 | $records = parent::all($columns); |
@@ -50,12 +50,12 @@ discard block |
||
50 | 50 | */ |
51 | 51 | public static function getByPath($path = '') |
52 | 52 | { |
53 | - if (MainApp::$Memory->get('cache.content.category.path.' . $path) !== null) { |
|
54 | - return MainApp::$Memory->get('cache.content.category.path.' . $path); |
|
53 | + if (MainApp::$Memory->get('cache.content.category.path.'.$path) !== null) { |
|
54 | + return MainApp::$Memory->get('cache.content.category.path.'.$path); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | $record = self::where('path', '=', $path)->first(); |
58 | - MainApp::$Memory->set('cache.content.category.path.' . $path, $record); |
|
58 | + MainApp::$Memory->set('cache.content.category.path.'.$path, $record); |
|
59 | 59 | return $record; |
60 | 60 | } |
61 | 61 | |
@@ -66,12 +66,12 @@ discard block |
||
66 | 66 | */ |
67 | 67 | public static function getById($id) |
68 | 68 | { |
69 | - if (MainApp::$Memory->get('cache.content.category.id.' . $id) !== null) { |
|
70 | - return MainApp::$Memory->get('cache.content.category.id.' . $id); |
|
69 | + if (MainApp::$Memory->get('cache.content.category.id.'.$id) !== null) { |
|
70 | + return MainApp::$Memory->get('cache.content.category.id.'.$id); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | $record = self::find($id); |
74 | - MainApp::$Memory->set('cache.content.category.id.' . $id, $record); |
|
74 | + MainApp::$Memory->set('cache.content.category.id.'.$id, $record); |
|
75 | 75 | return $record; |
76 | 76 | } |
77 | 77 | |
@@ -99,12 +99,12 @@ discard block |
||
99 | 99 | } else { |
100 | 100 | // set level marker based on slashes count in pathway |
101 | 101 | $slashCount = Str::entryCount($path, '/'); |
102 | - for ($i=-1; $i <= $slashCount; $i++) { |
|
102 | + for ($i = -1; $i <= $slashCount; $i++) { |
|
103 | 103 | $title .= '--'; |
104 | 104 | } |
105 | 105 | } |
106 | 106 | // add canonical title from db |
107 | - $title .= ' ' . $data->getLocaled('title'); |
|
107 | + $title .= ' '.$data->getLocaled('title'); |
|
108 | 108 | // set response as array [id => title, ... ] |
109 | 109 | $response[$data->id] = $title; |
110 | 110 | } |
@@ -34,9 +34,9 @@ discard block |
||
34 | 34 | <span class="sr-only">Toggle Dropdown</span> |
35 | 35 | </button> |
36 | 36 | <ul class="dropdown-menu" role="menu"> |
37 | - <li><?= Url::link(['content/index', null, null, ['type' => 'all']], '<i class="fa fa-list"></i> ' . __('All')) ?></li> |
|
38 | - <li><?= Url::link(['content/index', null, null, ['type' => 'moderate']], '<i class="fa fa-exclamation"></i> ' . __('Moderate')) ?></li> |
|
39 | - <li><?= Url::link(['content/index', null, null, ['type' => 'trash']], '<i class="fa fa-trash"></i> ' . __('Trash')) ?></li> |
|
37 | + <li><?= Url::link(['content/index', null, null, ['type' => 'all']], '<i class="fa fa-list"></i> '.__('All')) ?></li> |
|
38 | + <li><?= Url::link(['content/index', null, null, ['type' => 'moderate']], '<i class="fa fa-exclamation"></i> '.__('Moderate')) ?></li> |
|
39 | + <li><?= Url::link(['content/index', null, null, ['type' => 'trash']], '<i class="fa fa-trash"></i> '.__('Trash')) ?></li> |
|
40 | 40 | <li> |
41 | 41 | <a class="trigger right-caret"><i class="fa fa-table"></i> <?= __('Categories') ?></a> |
42 | 42 | <ul class="dropdown-menu sub-menu"> |
@@ -50,9 +50,9 @@ discard block |
||
50 | 50 | </div> |
51 | 51 | <?php |
52 | 52 | if ($type === 'trash') { |
53 | - echo Url::link(['content/clear'], '<i class="fa fa-minus"></i> ' . __('Remove all'), ['class' => 'btn btn-danger pull-right']); |
|
53 | + echo Url::link(['content/clear'], '<i class="fa fa-minus"></i> '.__('Remove all'), ['class' => 'btn btn-danger pull-right']); |
|
54 | 54 | } else { |
55 | - echo Url::link(['content/update', 0], '<i class="fa fa-plus"></i> ' . __('Add content'), ['class' => 'btn btn-primary pull-right']); |
|
55 | + echo Url::link(['content/update', 0], '<i class="fa fa-plus"></i> '.__('Add content'), ['class' => 'btn btn-primary pull-right']); |
|
56 | 56 | } |
57 | 57 | ?> |
58 | 58 | </div> |
@@ -61,23 +61,23 @@ discard block |
||
61 | 61 | <?php |
62 | 62 | |
63 | 63 | if ($records->count() < 1) { |
64 | - echo '<p class="alert alert-warning">' . __('Content is not found') . '</p>'; |
|
64 | + echo '<p class="alert alert-warning">'.__('Content is not found').'</p>'; |
|
65 | 65 | return; |
66 | 66 | } |
67 | 67 | |
68 | 68 | $items = []; |
69 | 69 | $moderate = false; |
70 | 70 | foreach ($records as $content) { |
71 | - $frontLink = \App::$Alias->scriptUrl . '/content/read'; |
|
71 | + $frontLink = \App::$Alias->scriptUrl.'/content/read'; |
|
72 | 72 | $frontPath = null; |
73 | 73 | if (!Str::likeEmpty($content->getCategory()->path)) { |
74 | - $frontLink .= '/' . $content->getCategory()->path; |
|
75 | - $frontPath .= '/' . $content->getCategory()->path; |
|
74 | + $frontLink .= '/'.$content->getCategory()->path; |
|
75 | + $frontPath .= '/'.$content->getCategory()->path; |
|
76 | 76 | } |
77 | - $frontLink .= '/' . $content->path; |
|
78 | - $frontPath .= '/' . $content->path; |
|
77 | + $frontLink .= '/'.$content->path; |
|
78 | + $frontPath .= '/'.$content->path; |
|
79 | 79 | $frontPath = Str::sub($frontPath, 0, 30); |
80 | - $actionIcons = '<a href="' . $frontLink . '" target="_blank"><i class="fa fa-eye fa-lg"></i></a> '; |
|
80 | + $actionIcons = '<a href="'.$frontLink.'" target="_blank"><i class="fa fa-eye fa-lg"></i></a> '; |
|
81 | 81 | $actionIcons .= Url::link(['content/update', $content->id], '<i class="fa fa-pencil fa-lg"></i> '); |
82 | 82 | if ($type === 'trash') { |
83 | 83 | $actionIcons .= Url::link(['content/restore', $content->id], '<i class="fa fa-refresh fa-lg"></i>'); |
@@ -85,16 +85,16 @@ discard block |
||
85 | 85 | $actionIcons .= Url::link(['content/delete', $content->id], '<i class="fa fa-trash-o fa-lg"></i>'); |
86 | 86 | } |
87 | 87 | |
88 | - if (!(bool)$content->display) { |
|
88 | + if (!(bool) $content->display) { |
|
89 | 89 | $moderate = true; |
90 | 90 | } |
91 | 91 | |
92 | 92 | $items[] = [ |
93 | - 'property' => ['class' => 'checkbox-row' . (!(bool)$content->display ? ' alert-warning' : null)], |
|
93 | + 'property' => ['class' => 'checkbox-row'.(!(bool) $content->display ? ' alert-warning' : null)], |
|
94 | 94 | 1 => ['text' => $content->id, 'html' => true, '!secure' => true], |
95 | - 2 => ['text' => (!(bool)$content->display ? '<i class="fa fa-exclamation text-warning"></i> ' : null) . Url::link(['content/update', $content->id], $content->getLocaled('title')), 'html' => true], |
|
95 | + 2 => ['text' => (!(bool) $content->display ? '<i class="fa fa-exclamation text-warning"></i> ' : null).Url::link(['content/update', $content->id], $content->getLocaled('title')), 'html' => true], |
|
96 | 96 | 3 => ['text' => $content->getCategory()->getLocaled('title')], |
97 | - 4 =>['text' => '<a href="' . $frontLink . '" target="_blank">' . $frontPath . '</a>', 'html' => true], |
|
97 | + 4 =>['text' => '<a href="'.$frontLink.'" target="_blank">'.$frontPath.'</a>', 'html' => true], |
|
98 | 98 | 5 => ['text' => Date::convertToDatetime($content->updated_at, Date::FORMAT_TO_SECONDS)], |
99 | 99 | 6 => ['text' => $actionIcons, 'html' => true, 'property' => ['class' => 'text-center']] |
100 | 100 | ]; |
@@ -12,15 +12,15 @@ |
||
12 | 12 | } |
13 | 13 | $title = Text::snippet($title, 50); |
14 | 14 | $date = Date::humanize($record->created_at); |
15 | - $categoryUrl = \App::$Alias->baseUrl . '/content/list/' . $record->cpath; |
|
16 | - $categoryLink = '<a href="' . $categoryUrl . '">' . \App::$Translate->getLocaleText($record->ctitle) . '</a>'; |
|
17 | - $newsLink = \App::$Alias->baseUrl . '/content/read/' . $record->cpath; |
|
18 | - $newsLink = rtrim($newsLink, '/') . '/' . $record->path; |
|
15 | + $categoryUrl = \App::$Alias->baseUrl.'/content/list/'.$record->cpath; |
|
16 | + $categoryLink = '<a href="'.$categoryUrl.'">'.\App::$Translate->getLocaleText($record->ctitle).'</a>'; |
|
17 | + $newsLink = \App::$Alias->baseUrl.'/content/read/'.$record->cpath; |
|
18 | + $newsLink = rtrim($newsLink, '/').'/'.$record->path; |
|
19 | 19 | |
20 | 20 | echo '<div class="row"><div class="col-md-12">'; |
21 | - echo '<a href="' . $newsLink . '">→ ' . $title . '</a><br />'; |
|
22 | - echo '<small class="pull-left">' . $categoryLink . '</small>'; |
|
23 | - echo '<small class="pull-right">' . $date . '</small>'; |
|
21 | + echo '<a href="'.$newsLink.'">→ '.$title.'</a><br />'; |
|
22 | + echo '<small class="pull-left">'.$categoryLink.'</small>'; |
|
23 | + echo '<small class="pull-right">'.$date.'</small>'; |
|
24 | 24 | echo '</div></div>'; |
25 | 25 | echo '<hr class="pretty" />'; |
26 | 26 | } |