Passed
Push — master ( 1fadb0...f949a1 )
by Mihail
08:15
created
Apps/ActiveRecord/ContentCategory.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
Apps/View/Admin/default/content/index.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -34,9 +34,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     ];
Please login to merge, or discard this patch.
Apps/View/Front/default/widgets/newcontent/default.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -12,15 +12,15 @@
 block discarded – undo
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 . '">&rarr; ' . $title . '</a><br />';
22
-    echo '<small class="pull-left">' . $categoryLink . '</small>';
23
-    echo '<small class="pull-right">' . $date . '</small>';
21
+    echo '<a href="'.$newsLink.'">&rarr; '.$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
 }
Please login to merge, or discard this patch.
Private/Database/Tables/App.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@
 block discarded – undo
56 56
 ]);
57 57
 
58 58
 $configs->newcontent = serialize([
59
-    'categories' => ['2','3'],
59
+    'categories' => ['2', '3'],
60 60
     'count' => '5',
61 61
     'cache' => '60'
62 62
 ]);
Please login to merge, or discard this patch.
Apps/Model/Admin/Application/FormInstall.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
     public function before()
44 44
     {
45 45
         foreach ($this->_apps as $app) {
46
-            $this->_definedControllers[] = (string)$app->sys_name;
46
+            $this->_definedControllers[] = (string) $app->sys_name;
47 47
         }
48 48
 
49 49
         parent::before();
@@ -79,14 +79,14 @@  discard block
 block discarded – undo
79 79
     public function make()
80 80
     {
81 81
         $cName = ucfirst(Str::lowerCase($this->sysname));
82
-        $cPath = 'Apps\Controller\Admin\\' . $cName;
82
+        $cPath = 'Apps\Controller\Admin\\'.$cName;
83 83
         // if object class is not loaded - prevent install
84
-        if (!class_exists($cPath) || !defined($cPath . '::VERSION')) {
84
+        if (!class_exists($cPath) || !defined($cPath.'::VERSION')) {
85 85
             return false;
86 86
         }
87 87
 
88 88
         // get ext version
89
-        $cVersion = constant($cPath . '::VERSION');
89
+        $cVersion = constant($cPath.'::VERSION');
90 90
         if ($cVersion === null || Str::likeEmpty($cVersion)) {
91 91
             $cVersion = '1.0.0';
92 92
         }
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 
103 103
         // callback to install method in extension
104 104
         if (method_exists($cPath, 'install')) {
105
-            call_user_func($cPath . '::install');
105
+            call_user_func($cPath.'::install');
106 106
         }
107 107
 
108 108
         return true;
Please login to merge, or discard this patch.
Apps/Controller/Api/Content.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -33,12 +33,12 @@  discard block
 block discarded – undo
33 33
         parent::before();
34 34
         $configs = AppRecord::getConfigs('app', 'Content');
35 35
         // prevent null-type config data
36
-        if ((int)$configs['gallerySize'] > 0) {
37
-            $this->maxSize = (int)$configs['gallerySize'] * 1024;
36
+        if ((int) $configs['gallerySize'] > 0) {
37
+            $this->maxSize = (int) $configs['gallerySize'] * 1024;
38 38
         }
39 39
 
40
-        if ((int)$configs['galleryResize'] > 0) {
41
-            $this->maxResize = (int)$configs['galleryResize'];
40
+        if ((int) $configs['galleryResize'] > 0) {
41
+            $this->maxResize = (int) $configs['galleryResize'];
42 42
         }
43 43
     }
44 44
     
@@ -117,8 +117,8 @@  discard block
 block discarded – undo
117 117
         }
118 118
 
119 119
         // check if directory exist
120
-        if (!Directory::exist('/upload/gallery/' . $id)) {
121
-            Directory::create('/upload/gallery/' . $id);
120
+        if (!Directory::exist('/upload/gallery/'.$id)) {
121
+            Directory::create('/upload/gallery/'.$id);
122 122
         }
123 123
 
124 124
         // get file object
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 
131 131
         // check file size
132 132
         if ($file->getSize() < 1 || $file->getSize() > $this->maxSize) {
133
-            throw new ForbiddenException(__('File size is too big. Max size: %size%kb', ['size' => (int)($this->maxSize/1024)]));
133
+            throw new ForbiddenException(__('File size is too big. Max size: %size%kb', ['size' => (int) ($this->maxSize / 1024)]));
134 134
         }
135 135
 
136 136
         // check file extension
@@ -139,41 +139,41 @@  discard block
 block discarded – undo
139 139
         }
140 140
 
141 141
         // create origin directory
142
-        $originPath = '/upload/gallery/' . $id . '/orig/';
142
+        $originPath = '/upload/gallery/'.$id.'/orig/';
143 143
         if (!Directory::exist($originPath)) {
144 144
             Directory::create($originPath);
145 145
         }
146 146
 
147 147
         // lets make a new file name
148
-        $fileName = App::$Security->simpleHash($file->getClientOriginalName() . $file->getSize());
149
-        $fileNewName = $fileName . '.' . $file->guessExtension();
148
+        $fileName = App::$Security->simpleHash($file->getClientOriginalName().$file->getSize());
149
+        $fileNewName = $fileName.'.'.$file->guessExtension();
150 150
         // check if image is already loaded
151
-        if (File::exist($originPath . $fileNewName)) {
151
+        if (File::exist($originPath.$fileNewName)) {
152 152
             throw new ForbiddenException(__('File is always exists!'));
153 153
         }
154 154
         // save file from tmp to gallery origin directory
155 155
         $file->move(Normalize::diskFullPath($originPath), $fileNewName);
156 156
 
157 157
         // lets resize preview image for it
158
-        $thumbPath = '/upload/gallery/' . $id . '/thumb/';
158
+        $thumbPath = '/upload/gallery/'.$id.'/thumb/';
159 159
         if (!Directory::exist($thumbPath)) {
160 160
             Directory::create($thumbPath);
161 161
         }
162 162
 
163 163
         $thumb = new Image();
164
-        $thumb->setCacheDir(root . '/Private/Cache/images');
164
+        $thumb->setCacheDir(root.'/Private/Cache/images');
165 165
 
166 166
         // open original file, resize it and save
167
-        $thumbSaveName = Normalize::diskFullPath($thumbPath) . '/' . $fileName . '.jpg';
168
-        $thumb->open(Normalize::diskFullPath($originPath) . DIRECTORY_SEPARATOR . $fileNewName)
167
+        $thumbSaveName = Normalize::diskFullPath($thumbPath).'/'.$fileName.'.jpg';
168
+        $thumb->open(Normalize::diskFullPath($originPath).DIRECTORY_SEPARATOR.$fileNewName)
169 169
             ->cropResize($this->maxResize)
170 170
             ->save($thumbSaveName, 'jpg', 90);
171 171
         $thumb = null;
172 172
 
173 173
         $this->setJsonHeader();
174 174
         return json_encode(['status' => 1, 'file' => [
175
-            'thumbnailUrl' => '/upload/gallery/' . $id . '/thumb/' . $fileName . '.jpg',
176
-            'url' => '/upload/gallery/' . $id . '/orig/' . $fileNewName,
175
+            'thumbnailUrl' => '/upload/gallery/'.$id.'/thumb/'.$fileName.'.jpg',
176
+            'url' => '/upload/gallery/'.$id.'/orig/'.$fileNewName,
177 177
             'name' => $fileNewName
178 178
         ]]);
179 179
     }
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
             throw new NativeException('Permission denied');
198 198
         }
199 199
 
200
-        $thumbDir = Normalize::diskFullPath('/upload/gallery/' . $id . '/orig/');
200
+        $thumbDir = Normalize::diskFullPath('/upload/gallery/'.$id.'/orig/');
201 201
         if (!Directory::exist($thumbDir)) {
202 202
             throw new NotFoundException('Nothing found');
203 203
         }
@@ -212,10 +212,10 @@  discard block
 block discarded – undo
212 212
             $fileExt = Str::lastIn($file, '.');
213 213
             $fileName = Str::sub($file, 0, -Str::length($fileExt));
214 214
             $output[] = [
215
-                'thumbnailUrl' => '/upload/gallery/' . $id . '/thumb/' . $fileName . '.jpg',
216
-                'url' => '/upload/gallery/' . $id . '/orig/' . $file,
215
+                'thumbnailUrl' => '/upload/gallery/'.$id.'/thumb/'.$fileName.'.jpg',
216
+                'url' => '/upload/gallery/'.$id.'/orig/'.$file,
217 217
                 'name' => $file,
218
-                'size' => File::size('/upload/gallery/' . $id . '/orig/' . $file)
218
+                'size' => File::size('/upload/gallery/'.$id.'/orig/'.$file)
219 219
             ];
220 220
         }
221 221
 
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
     public function actionGallerydelete($id, $file = null)
235 235
     {
236 236
         if ($file === null || Str::likeEmpty($file)) {
237
-            $file = (string)$this->request->query->get('file', null);
237
+            $file = (string) $this->request->query->get('file', null);
238 238
         }
239 239
         // check passed data
240 240
         if (Str::likeEmpty($file) || !Obj::isLikeInt($id)) {
@@ -249,8 +249,8 @@  discard block
 block discarded – undo
249 249
         }
250 250
 
251 251
         // generate path
252
-        $thumb = '/upload/gallery/' . $id . '/thumb/' . $fileName . '.jpg';
253
-        $full = '/upload/gallery/' . $id . '/orig/' . $file;
252
+        $thumb = '/upload/gallery/'.$id.'/thumb/'.$fileName.'.jpg';
253
+        $full = '/upload/gallery/'.$id.'/orig/'.$file;
254 254
 
255 255
         // check if file exists and remove
256 256
         if (File::exist($thumb) || File::exist($full)) {
Please login to merge, or discard this patch.
Apps/Model/Admin/Content/FormContentPublish.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
 
18 18
     /**
19 19
      * FormContentPublish constructor. Pass records inside
20
-     * @param Content[]|Collection $records
20
+     * @param \Ffcms\Core\Arch\ActiveModel $records
21 21
      */
22 22
     public function __construct($records)
23 23
     {
Please login to merge, or discard this patch.
Extend/Core/Arch/ApiController.php 1 patch
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,6 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Apps/Controller/Api/Main.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
         $connector = new \elFinderConnector(new \elFinder([
38 38
             'locale' => '',
39 39
             'roots' => [
40
-                ['driver' => 'LocalFileSystem', 'path' => root . '/upload/', 'URL' => App::$Alias->scriptUrl . '/upload/']
40
+                ['driver' => 'LocalFileSystem', 'path' => root.'/upload/', 'URL' => App::$Alias->scriptUrl.'/upload/']
41 41
             ]
42 42
         ]));
43 43
 
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
         if (App::$Cache->get('download.ffcms.api.news.'.$this->lang) !== null) {
106 106
             $news = App::$Cache->get('download.ffcms.api.news.'.$this->lang);
107 107
         } else {
108
-            $news = Url::download('https://ffcms.org/api/api/news?lang=' . $this->lang);
108
+            $news = Url::download('https://ffcms.org/api/api/news?lang='.$this->lang);
109 109
             if ($news !== null && !Str::likeEmpty($news)) {
110 110
                 App::$Cache->set('download.ffcms.api.news.'.$this->lang, $news, 3600 * 12);
111 111
             }
Please login to merge, or discard this patch.