Passed
Push — master ( bda6ce...afc50f )
by Mihail
05:03
created
Apps/View/Front/default/content/update.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -32,10 +32,10 @@
 block discarded – undo
32 32
 foreach (\App::$Properties->get('languages') as $lang) {
33 33
     $items[] = [
34 34
         'type' => 'tab',
35
-        'text' => __('Lang') . ': ' . Str::upperCase($lang),
35
+        'text' => __('Lang').': '.Str::upperCase($lang),
36 36
         'content' =>
37
-            $form->field('title.' . $lang, 'text', ['class' => 'form-control'], __('Please, enter the title of your material for current language locale')) .
38
-            $form->field('text.' . $lang, 'textarea', ['class' => 'form-control wysiwyg', 'rows' => 7, 'html' => true]),
37
+            $form->field('title.'.$lang, 'text', ['class' => 'form-control'], __('Please, enter the title of your material for current language locale')).
38
+            $form->field('text.'.$lang, 'textarea', ['class' => 'form-control wysiwyg', 'rows' => 7, 'html' => true]),
39 39
         'html' => true,
40 40
         'active' => $lang === \App::$Request->getLanguage(),
41 41
         '!secure' => true
Please login to merge, or discard this patch.
Apps/Controller/Api/Content.php 1 patch
Spacing   +21 added lines, -21 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
     
@@ -116,8 +116,8 @@  discard block
 block discarded – undo
116 116
         }
117 117
 
118 118
         // check if directory exist
119
-        if (!Directory::exist('/upload/gallery/' . $id)) {
120
-            Directory::create('/upload/gallery/' . $id);
119
+        if (!Directory::exist('/upload/gallery/'.$id)) {
120
+            Directory::create('/upload/gallery/'.$id);
121 121
         }
122 122
 
123 123
         // get file object
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 
130 130
         // check file size
131 131
         if ($file->getSize() < 1 || $file->getSize() > $this->maxSize) {
132
-            throw new ForbiddenException(__('File size is too big. Max size: %size%kb', ['size' => (int)($this->maxSize/1024)]));
132
+            throw new ForbiddenException(__('File size is too big. Max size: %size%kb', ['size' => (int) ($this->maxSize / 1024)]));
133 133
         }
134 134
 
135 135
         // check file extension
@@ -138,37 +138,37 @@  discard block
 block discarded – undo
138 138
         }
139 139
 
140 140
         // create origin directory
141
-        $originPath = '/upload/gallery/' . $id . '/orig/';
141
+        $originPath = '/upload/gallery/'.$id.'/orig/';
142 142
         if (!Directory::exist($originPath)) {
143 143
             Directory::create($originPath);
144 144
         }
145 145
 
146 146
         // lets make a new file name
147
-        $fileName = App::$Security->simpleHash($file->getClientOriginalName() . $file->getSize());
148
-        $fileNewName = $fileName . '.' . $file->guessExtension();
147
+        $fileName = App::$Security->simpleHash($file->getClientOriginalName().$file->getSize());
148
+        $fileNewName = $fileName.'.'.$file->guessExtension();
149 149
         // save file from tmp to gallery origin directory
150 150
         $file->move(Normalize::diskFullPath($originPath), $fileNewName);
151 151
 
152 152
         // lets resize preview image for it
153
-        $thumbPath = '/upload/gallery/' . $id . '/thumb/';
153
+        $thumbPath = '/upload/gallery/'.$id.'/thumb/';
154 154
         if (!Directory::exist($thumbPath)) {
155 155
             Directory::create($thumbPath);
156 156
         }
157 157
 
158 158
         $thumb = new Image();
159
-        $thumb->setCacheDir(root . '/Private/Cache/images');
159
+        $thumb->setCacheDir(root.'/Private/Cache/images');
160 160
 
161 161
         // open original file, resize it and save
162
-        $thumbSaveName = Normalize::diskFullPath($thumbPath) . '/' . $fileName . '.jpg';
163
-        $thumb->open(Normalize::diskFullPath($originPath) . DIRECTORY_SEPARATOR . $fileNewName)
162
+        $thumbSaveName = Normalize::diskFullPath($thumbPath).'/'.$fileName.'.jpg';
163
+        $thumb->open(Normalize::diskFullPath($originPath).DIRECTORY_SEPARATOR.$fileNewName)
164 164
             ->cropResize($this->maxResize)
165 165
             ->save($thumbSaveName, 'jpg', 90);
166 166
         $thumb = null;
167 167
 
168 168
         // dont ask me why there is 2nd lvl array (can contains multiply items to frontend response)
169 169
         $output = [
170
-            'thumbnailUrl' => '/upload/gallery/' . $id . '/thumb/' . $fileName . '.jpg',
171
-            'url' => '/upload/gallery/' . $id . '/orig/' . $fileNewName,
170
+            'thumbnailUrl' => '/upload/gallery/'.$id.'/thumb/'.$fileName.'.jpg',
171
+            'url' => '/upload/gallery/'.$id.'/orig/'.$fileNewName,
172 172
             'name' => $fileNewName
173 173
         ];
174 174
 
@@ -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,8 +212,8 @@  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 218
             ];
219 219
         }
@@ -245,8 +245,8 @@  discard block
 block discarded – undo
245 245
         }
246 246
 
247 247
         // generate path
248
-        $thumb = '/upload/gallery/' . $id . '/thumb/' . $fileName . '.jpg';
249
-        $full = '/upload/gallery/' . $id . '/orig/' . $file;
248
+        $thumb = '/upload/gallery/'.$id.'/thumb/'.$fileName.'.jpg';
249
+        $full = '/upload/gallery/'.$id.'/orig/'.$file;
250 250
 
251 251
         // check if file exists and remove
252 252
         if (File::exist($thumb) || File::exist($full)) {
Please login to merge, or discard this patch.