Passed
Push — master ( 96b24d...af997f )
by Karel
14:49
created
src/Providers/ChuckMenuServiceProvider.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
      */
24 24
     public function register()
25 25
     {
26
-        $this->app->bind('ChuckMenu', function () {
26
+        $this->app->bind('ChuckMenu', function() {
27 27
             return new \Chuckbe\Chuckcms\Chuck\Accessors\Menu();
28 28
         });
29 29
     }
Please login to merge, or discard this patch.
src/Controllers/MenuController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -104,7 +104,7 @@
 block discarded – undo
104 104
     {
105 105
         $menuitem = new MenuItems();
106 106
         $menuitem->label = request()->input('labelmenu');
107
-        $menuitem->link = 'page:'.request()->input('linkmenu');
107
+        $menuitem->link = 'page:' . request()->input('linkmenu');
108 108
         $menuitem->menu = request()->input('idmenu');
109 109
         $menuitem->sort = MenuItems::getNextSortRoot(request()->input('idmenu'));
110 110
         $menuitem->save();
Please login to merge, or discard this patch.
src/Controllers/PageController.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -206,14 +206,14 @@  discard block
 block discarded – undo
206 206
         if ($request->has('lang')) {
207 207
             app()->setLocale($request->get('lang'));
208 208
         } else {
209
-            return redirect()->to(URL::current().'?lang='.app()->getLocale());
209
+            return redirect()->to(URL::current() . '?lang=' . app()->getLocale());
210 210
         }
211 211
         $page = $this->page->getByIdWithBlocks($page_id);
212 212
         $template = $this->template->where('id', $page->template_id)->first();
213 213
         $pageblocks = $this->pageBlockRepository->getRenderedByPageBlocks($this->pageblock->getAllByPageId($page->id));
214 214
 
215
-        $block_dir = array_slice(scandir('chuckbe/'.$template->slug.'/blocks'), 2);
216
-        $blocks = $this->dirToArray($template->path.'/blocks');
215
+        $block_dir = array_slice(scandir('chuckbe/' . $template->slug . '/blocks'), 2);
216
+        $blocks = $this->dirToArray($template->path . '/blocks');
217 217
 
218 218
         return view('chuckcms::backend.pages.pagebuilder.index', compact('template', 'page', 'pageblocks', 'blocks'));
219 219
     }
@@ -225,24 +225,24 @@  discard block
 block discarded – undo
225 225
         $cdir = scandir($dir);
226 226
         foreach ($cdir as $key => $value) {
227 227
             if (!in_array($value, ['.', '..'])) {
228
-                if (is_dir($dir.DIRECTORY_SEPARATOR.$value)) {
229
-                    $result[$value] = $this->dirToArray($dir.DIRECTORY_SEPARATOR.$value);
228
+                if (is_dir($dir . DIRECTORY_SEPARATOR . $value)) {
229
+                    $result[$value] = $this->dirToArray($dir . DIRECTORY_SEPARATOR . $value);
230 230
                 } else {
231 231
                     if ($value !== '.DS_Store' && (strpos($value, '.html') !== false)) {
232 232
                         $blockKey = str_replace('.html', '', $value);
233 233
                         $blockName = str_replace('-', ' ', $blockKey);
234
-                        if (file_exists($dir.DIRECTORY_SEPARATOR.$blockKey.'.jpg')) {
235
-                            $blockImage = $dir.DIRECTORY_SEPARATOR.$blockKey.'.jpg';
236
-                        } elseif (file_exists($dir.DIRECTORY_SEPARATOR.$blockKey.'.jpeg')) {
237
-                            $blockImage = $dir.DIRECTORY_SEPARATOR.$blockKey.'.jpeg';
238
-                        } elseif (file_exists($dir.DIRECTORY_SEPARATOR.$blockKey.'.png')) {
239
-                            $blockImage = $dir.DIRECTORY_SEPARATOR.$blockKey.'.png';
234
+                        if (file_exists($dir . DIRECTORY_SEPARATOR . $blockKey . '.jpg')) {
235
+                            $blockImage = $dir . DIRECTORY_SEPARATOR . $blockKey . '.jpg';
236
+                        } elseif (file_exists($dir . DIRECTORY_SEPARATOR . $blockKey . '.jpeg')) {
237
+                            $blockImage = $dir . DIRECTORY_SEPARATOR . $blockKey . '.jpeg';
238
+                        } elseif (file_exists($dir . DIRECTORY_SEPARATOR . $blockKey . '.png')) {
239
+                            $blockImage = $dir . DIRECTORY_SEPARATOR . $blockKey . '.png';
240 240
                         } else {
241 241
                             $blockImage = 'https://ui-avatars.com/api/?length=5&size=150&name=BLOCK&background=0D8ABC&color=fff&font-size=0.2';
242 242
                         }
243 243
                         $result[$blockKey] = [
244 244
                             'name'     => $blockName,
245
-                            'location' => $dir.DIRECTORY_SEPARATOR.$value,
245
+                            'location' => $dir . DIRECTORY_SEPARATOR . $value,
246 246
                             'img'      => $blockImage,
247 247
                         ];
248 248
                     }
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
         if ($request->has('lang')) {
264 264
             app()->setLocale($request->get('lang'));
265 265
         } else {
266
-            return redirect()->to(URL::current().'?lang='.app()->getLocale());
266
+            return redirect()->to(URL::current() . '?lang=' . app()->getLocale());
267 267
         }
268 268
         $page = $this->page->getByIdWithBlocks($page_id);
269 269
         $template = $this->template->where('id', $page->template_id)->first();
Please login to merge, or discard this patch.
src/Controllers/FormController.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -54,15 +54,15 @@  discard block
 block discarded – undo
54 54
         $form_slug = $request->get('slug');
55 55
         $fields_slug = 'text';
56 56
 
57
-        $form['fields'][$form_slug.'_'.$fields_slug]['label'] = 'Text';
58
-        $form['fields'][$form_slug.'_'.$fields_slug]['type'] = 'text';
59
-        $form['fields'][$form_slug.'_'.$fields_slug]['class'] = 'form-control';
60
-        $form['fields'][$form_slug.'_'.$fields_slug]['parentclass'] = null;
61
-        $form['fields'][$form_slug.'_'.$fields_slug]['placeholder'] = 'Text';
62
-        $form['fields'][$form_slug.'_'.$fields_slug]['validation'] = 'required';
63
-        $form['fields'][$form_slug.'_'.$fields_slug]['value'] = null;
64
-        $form['fields'][$form_slug.'_'.$fields_slug]['attributes']['id'] = 'text_input_id';
65
-        $form['fields'][$form_slug.'_'.$fields_slug]['required'] = 'true';
57
+        $form['fields'][$form_slug . '_' . $fields_slug]['label'] = 'Text';
58
+        $form['fields'][$form_slug . '_' . $fields_slug]['type'] = 'text';
59
+        $form['fields'][$form_slug . '_' . $fields_slug]['class'] = 'form-control';
60
+        $form['fields'][$form_slug . '_' . $fields_slug]['parentclass'] = null;
61
+        $form['fields'][$form_slug . '_' . $fields_slug]['placeholder'] = 'Text';
62
+        $form['fields'][$form_slug . '_' . $fields_slug]['validation'] = 'required';
63
+        $form['fields'][$form_slug . '_' . $fields_slug]['value'] = null;
64
+        $form['fields'][$form_slug . '_' . $fields_slug]['attributes']['id'] = 'text_input_id';
65
+        $form['fields'][$form_slug . '_' . $fields_slug]['required'] = 'true';
66 66
 
67 67
         $form['actions']['store'] = true;
68 68
         $form['actions']['send'] = false;
@@ -99,18 +99,18 @@  discard block
 block discarded – undo
99 99
         $fields_slug = $request->get('fields_slug');
100 100
         $countFS = count($fields_slug);
101 101
         for ($i = 0; $i < $countFS; $i++) {
102
-            $form['fields'][$form_slug.'_'.$fields_slug[$i]]['label'] = $request->get('fields_label')[$i];
103
-            $form['fields'][$form_slug.'_'.$fields_slug[$i]]['type'] = $request->get('fields_type')[$i];
104
-            $form['fields'][$form_slug.'_'.$fields_slug[$i]]['class'] = $request->get('fields_class')[$i];
105
-            $form['fields'][$form_slug.'_'.$fields_slug[$i]]['parentclass'] = $request->get('fields_parentclass')[$i];
106
-            $form['fields'][$form_slug.'_'.$fields_slug[$i]]['placeholder'] = $request->get('fields_placeholder')[$i];
107
-            $form['fields'][$form_slug.'_'.$fields_slug[$i]]['validation'] = $request->get('fields_validation')[$i];
108
-            $form['fields'][$form_slug.'_'.$fields_slug[$i]]['value'] = $request->get('fields_value')[$i];
102
+            $form['fields'][$form_slug . '_' . $fields_slug[$i]]['label'] = $request->get('fields_label')[$i];
103
+            $form['fields'][$form_slug . '_' . $fields_slug[$i]]['type'] = $request->get('fields_type')[$i];
104
+            $form['fields'][$form_slug . '_' . $fields_slug[$i]]['class'] = $request->get('fields_class')[$i];
105
+            $form['fields'][$form_slug . '_' . $fields_slug[$i]]['parentclass'] = $request->get('fields_parentclass')[$i];
106
+            $form['fields'][$form_slug . '_' . $fields_slug[$i]]['placeholder'] = $request->get('fields_placeholder')[$i];
107
+            $form['fields'][$form_slug . '_' . $fields_slug[$i]]['validation'] = $request->get('fields_validation')[$i];
108
+            $form['fields'][$form_slug . '_' . $fields_slug[$i]]['value'] = $request->get('fields_value')[$i];
109 109
             $countFAN = count(explode(';', $request->get('fields_attributes_name')[$i]));
110 110
             for ($k = 0; $k < $countFAN; $k++) {
111
-                $form['fields'][$form_slug.'_'.$fields_slug[$i]]['attributes'][explode(';', $request->get('fields_attributes_name')[$i])[$k]] = explode(';', $request->get('fields_attributes_value')[$i])[$k];
111
+                $form['fields'][$form_slug . '_' . $fields_slug[$i]]['attributes'][explode(';', $request->get('fields_attributes_name')[$i])[$k]] = explode(';', $request->get('fields_attributes_value')[$i])[$k];
112 112
             }
113
-            $form['fields'][$form_slug.'_'.$fields_slug[$i]]['required'] = $request->get('fields_required')[$i];
113
+            $form['fields'][$form_slug . '_' . $fields_slug[$i]]['required'] = $request->get('fields_required')[$i];
114 114
         }
115 115
 
116 116
         $form['actions']['store'] = $request->get('action_store') == 'true' ? true : false;
Please login to merge, or discard this patch.
src/Controllers/Auth/RegisterController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
 
39 39
     protected function redirectTo()
40 40
     {
41
-        return '/'.Auth::user()->roles()->first()->redirect;
41
+        return '/' . Auth::user()->roles()->first()->redirect;
42 42
     }
43 43
 
44 44
     /**
Please login to merge, or discard this patch.
src/Controllers/Auth/LoginController.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 
37 37
     protected function redirectTo()
38 38
     {
39
-        return '/'.Auth::user()->roles()->first()->redirect;
39
+        return '/' . Auth::user()->roles()->first()->redirect;
40 40
     }
41 41
 
42 42
     /**
@@ -57,10 +57,10 @@  discard block
 block discarded – undo
57 57
     protected function validateLogin(\Illuminate\Http\Request $request)
58 58
     {
59 59
         $this->validate($request, [
60
-            $this->username() => 'required|exists:users,'.$this->username().',active,1',
60
+            $this->username() => 'required|exists:users,' . $this->username() . ',active,1',
61 61
             'password'        => 'required',
62 62
         ], [
63
-            $this->username().'.exists' => 'The selected email is invalid or the account is not active.',
63
+            $this->username() . '.exists' => 'The selected email is invalid or the account is not active.',
64 64
         ]);
65 65
     }
66 66
 }
Please login to merge, or discard this patch.
src/Controllers/ContentController.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
     {
126 126
         $repeater = Content::where('slug', $slug)->first();
127 127
 
128
-        $filename = $repeater->slug.'.json';
128
+        $filename = $repeater->slug . '.json';
129 129
         $handle = fopen($filename, 'w+');
130 130
         fputs($handle, $repeater->toJson(JSON_PRETTY_PRINT));
131 131
         fclose($handle);
@@ -144,18 +144,18 @@  discard block
 block discarded – undo
144 144
         $fields_slug = $request->get('fields_slug');
145 145
         $count = count($fields_slug);
146 146
         for ($i = 0; $i < $count; $i++) {
147
-            $content['fields'][$content_slug.'_'.$fields_slug[$i]]['label'] = $request->get('fields_label')[$i];
148
-            $content['fields'][$content_slug.'_'.$fields_slug[$i]]['type'] = $request->get('fields_type')[$i];
149
-            $content['fields'][$content_slug.'_'.$fields_slug[$i]]['class'] = $request->get('fields_class')[$i];
150
-            $content['fields'][$content_slug.'_'.$fields_slug[$i]]['placeholder'] = $request->get('fields_placeholder')[$i];
151
-            $content['fields'][$content_slug.'_'.$fields_slug[$i]]['validation'] = $request->get('fields_validation')[$i];
152
-            $content['fields'][$content_slug.'_'.$fields_slug[$i]]['value'] = $request->get('fields_value')[$i];
147
+            $content['fields'][$content_slug . '_' . $fields_slug[$i]]['label'] = $request->get('fields_label')[$i];
148
+            $content['fields'][$content_slug . '_' . $fields_slug[$i]]['type'] = $request->get('fields_type')[$i];
149
+            $content['fields'][$content_slug . '_' . $fields_slug[$i]]['class'] = $request->get('fields_class')[$i];
150
+            $content['fields'][$content_slug . '_' . $fields_slug[$i]]['placeholder'] = $request->get('fields_placeholder')[$i];
151
+            $content['fields'][$content_slug . '_' . $fields_slug[$i]]['validation'] = $request->get('fields_validation')[$i];
152
+            $content['fields'][$content_slug . '_' . $fields_slug[$i]]['value'] = $request->get('fields_value')[$i];
153 153
             $fieldsCount = count(explode(';', $request->get('fields_attributes_name')[$i]));
154 154
             for ($k = 0; $k < $fieldsCount; $k++) {
155
-                $content['fields'][$content_slug.'_'.$fields_slug[$i]]['attributes'][explode(';', $request->get('fields_attributes_name')[$i])[$k]] = explode(';', $request->get('fields_attributes_value')[$i])[$k];
155
+                $content['fields'][$content_slug . '_' . $fields_slug[$i]]['attributes'][explode(';', $request->get('fields_attributes_name')[$i])[$k]] = explode(';', $request->get('fields_attributes_value')[$i])[$k];
156 156
             }
157
-            $content['fields'][$content_slug.'_'.$fields_slug[$i]]['required'] = $request->get('fields_required')[$i];
158
-            $content['fields'][$content_slug.'_'.$fields_slug[$i]]['table'] = $request->get('fields_table')[$i];
157
+            $content['fields'][$content_slug . '_' . $fields_slug[$i]]['required'] = $request->get('fields_required')[$i];
158
+            $content['fields'][$content_slug . '_' . $fields_slug[$i]]['table'] = $request->get('fields_table')[$i];
159 159
         }
160 160
 
161 161
         $content['actions']['store'] = $request->get('action_store');
Please login to merge, or discard this patch.
src/Chuck/Accessors/Menu.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -41,10 +41,10 @@  discard block
 block discarded – undo
41 41
             return view('chuckcms::vendor.chuck-menu.menu-front-end', $data);
42 42
         }
43 43
         if ($fileslug == null) {
44
-            return view($tslug.'::vendor.chuck-menu.menu-front-end', $data);
44
+            return view($tslug . '::vendor.chuck-menu.menu-front-end', $data);
45 45
         }
46 46
 
47
-        return view($tslug.'::vendor.chuck-menu.'.$fileslug, $data);
47
+        return view($tslug . '::vendor.chuck-menu.' . $fileslug, $data);
48 48
     }
49 49
 
50 50
     public function scripts()
@@ -54,14 +54,14 @@  discard block
 block discarded – undo
54 54
 
55 55
     public function select($name = 'menu', $menulist = [])
56 56
     {
57
-        $html = '<select name="'.$name.'">';
57
+        $html = '<select name="' . $name . '">';
58 58
 
59 59
         foreach ($menulist as $key => $val) {
60 60
             $active = '';
61 61
             if (request()->input('menu') == $key) {
62 62
                 $active = 'selected="selected"';
63 63
             }
64
-            $html .= '<option '.$active.' value="'.$key.'">'.$val.'</option>';
64
+            $html .= '<option ' . $active . ' value="' . $key . '">' . $val . '</option>';
65 65
         }
66 66
         $html .= '</select>';
67 67
 
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
         $menuItem = new MenuItems();
81 81
         $menu_list = $menuItem->getall($menu_id);
82 82
 
83
-        $roots = $menu_list->where('menu', (int) $menu_id)->where('parent', 0);
83
+        $roots = $menu_list->where('menu', (int)$menu_id)->where('parent', 0);
84 84
 
85 85
         $items = self::tree($roots, $menu_list);
86 86
 
Please login to merge, or discard this patch.
src/Chuck/PageBlockRepository.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -42,9 +42,9 @@  discard block
 block discarded – undo
42 42
                 // PAGEBLOCK CONTAINS A LOOP, LET'S RETRIEVE IT
43 43
                 if (strpos($findThis[0], 'LOOP') !== false) {
44 44
                     $repeater_slug = implode(' ', $this->getResources($body, '[LOOP=', ']'));
45
-                    $repeater_body = implode(' ', $this->getResources($body, '[LOOP='.$repeater_slug.']', '[/LOOP]'));
45
+                    $repeater_body = implode(' ', $this->getResources($body, '[LOOP=' . $repeater_slug . ']', '[/LOOP]'));
46 46
 
47
-                    $newbody = str_replace('[LOOP='.$repeater_slug.']'.$repeater_body.'[/LOOP]', $this->getRepeaterContents($repeater_slug, $repeater_body), $body);
47
+                    $newbody = str_replace('[LOOP=' . $repeater_slug . ']' . $repeater_body . '[/LOOP]', $this->getRepeaterContents($repeater_slug, $repeater_body), $body);
48 48
 
49 49
                 // THERE IS NO LOOP, CONTINUE
50 50
                 } elseif (strpos($findThis[0], 'FORM') !== false) {// PAGEBLOCK CONTAINS A FORM, LET'S RETRIEVE IT
@@ -92,9 +92,9 @@  discard block
 block discarded – undo
92 92
             // PAGEBLOCK CONTAINS A LOOP, LET'S RETRIEVE IT
93 93
             if (strpos($findThis[0], 'LOOP') !== false) {
94 94
                 $repeater_slug = implode(' ', $this->getResources($body, '[LOOP=', ']'));
95
-                $repeater_body = implode(' ', $this->getResources($body, '[LOOP='.$repeater_slug.']', '[/LOOP]'));
95
+                $repeater_body = implode(' ', $this->getResources($body, '[LOOP=' . $repeater_slug . ']', '[/LOOP]'));
96 96
 
97
-                $newbody = str_replace('[LOOP='.$repeater_slug.']'.$repeater_body.'[/LOOP]', $this->getRepeaterContents($repeater_slug, $repeater_body), $body);
97
+                $newbody = str_replace('[LOOP=' . $repeater_slug . ']' . $repeater_body . '[/LOOP]', $this->getRepeaterContents($repeater_slug, $repeater_body), $body);
98 98
 
99 99
             // THERE IS NO LOOP, CONTINUE
100 100
             } elseif (strpos($findThis[0], 'FORM') !== false) {// PAGEBLOCK CONTAINS A FORM, LET'S RETRIEVE IT
@@ -152,12 +152,12 @@  discard block
 block discarded – undo
152 152
         $body = $page_block_body;
153 153
         foreach ($resources as $resource) {
154 154
             $res_arr = explode('+', $resource);
155
-            $res_slug = (string) $res_arr[0];
156
-            $res_json = (string) $res_arr[1];
155
+            $res_slug = (string)$res_arr[0];
156
+            $res_json = (string)$res_arr[1];
157 157
             $res_object = Resource::where('slug', $res_slug)->first();
158 158
             $json = $res_object->json[app()->getLocale()];
159 159
             $match = $json[$res_json];
160
-            $body = str_replace('['.$res_slug.'+'.$res_json.']', $match, $body);
160
+            $body = str_replace('[' . $res_slug . '+' . $res_json . ']', $match, $body);
161 161
         }
162 162
 
163 163
         return $body;
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
         $slug = $form_slug;
169 169
         $form = Form::where('slug', $slug)->first();
170 170
         $render = View::make('chuckcms::backend.forms.render', ['form' => $form])->render();
171
-        $html = str_replace('[FORM='.$slug.']', $render, $page_block_body);
171
+        $html = str_replace('[FORM=' . $slug . ']', $render, $page_block_body);
172 172
 
173 173
         return $html;
174 174
     }
@@ -179,12 +179,12 @@  discard block
 block discarded – undo
179 179
         if (strpos($repeater_slug, ' LIMIT=') !== false) {
180 180
             $explode = explode(' LIMIT=', $repeater_slug);
181 181
             $slug = $explode[0];
182
-            $limit = (int) $explode[1];
182
+            $limit = (int)$explode[1];
183 183
             $contents = Repeater::where('slug', $slug)->take($limit)->get();
184 184
         } else {
185 185
             $contents = Repeater::where('slug', $slug)->get();
186 186
         }
187
-        $resources = $this->getResources($page_block_body, '['.$slug.'+', ']');
187
+        $resources = $this->getResources($page_block_body, '[' . $slug . '+', ']');
188 188
         $new_body = [];
189 189
         $i = 0;
190 190
         foreach ($contents as $content) {
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
             foreach ($resources as $resource) {
193 193
                 $json = $content->json;
194 194
                 $match = $json[$resource];
195
-                $body = str_replace('['.$slug.'+'.$resource.']', $match, $body);
195
+                $body = str_replace('[' . $slug . '+' . $resource . ']', $match, $body);
196 196
             }
197 197
             $new_body[] = $body;
198 198
             $i++;
Please login to merge, or discard this patch.