Passed
Push — master ( 282193...e524f9 )
by Karel
05:16
created
src/Commands/GenerateSite.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 
71 71
         if ($validator->fails()) {
72 72
             $messages = $validator->errors();
73
-            foreach($messages->all() as $message) {
73
+            foreach ($messages->all() as $message) {
74 74
                 $this->error($message);
75 75
             }
76 76
         } else {
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
             $this->info('..         ..');
113 113
             $this->info('.         .');
114 114
             $this->info(' ');
115
-            $this->info('New site: '.$name.' ('.$domain.') generated successfully');
115
+            $this->info('New site: ' . $name . ' (' . $domain . ') generated successfully');
116 116
             $this->info(' ');
117 117
         }
118 118
 
Please login to merge, or discard this patch.
src/Chuck/PageBlockRepository.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -142,7 +142,7 @@
 block discarded – undo
142 142
         $contentStart += $startDelimiterLength;
143 143
         $contentEnd = strpos($str, $endDelimiter, $contentStart);
144 144
         if (false === $contentEnd) {
145
-          break;
145
+            break;
146 146
         }
147 147
         $contents[] = substr($str, $contentStart, $contentEnd - $contentStart);
148 148
         $startFrom = $contentEnd + $endDelimiterLength;
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -27,13 +27,13 @@  discard block
 block discarded – undo
27 27
     public function getRenderedByPageBlocks($ogpageblocks)
28 28
     {
29 29
         $pageblocks = [];
30
-        foreach($ogpageblocks as $pageblock){
30
+        foreach ($ogpageblocks as $pageblock) {
31 31
             $body = $pageblock->body;
32 32
             $findUrlTags = $this->getResources($body, '[%', '%]');
33 33
             $url = env('APP_URL', ChuckSite::getSetting('domain'));
34
-            if(count($findUrlTags) > 0) {
35
-                foreach($findUrlTags as $foundUrlTag) {
36
-                    if(strpos($foundUrlTag, 'URL') !== false) {
34
+            if (count($findUrlTags) > 0) {
35
+                foreach ($findUrlTags as $foundUrlTag) {
36
+                    if (strpos($foundUrlTag, 'URL') !== false) {
37 37
                         $body = str_replace('[%URL%]', $url, $body);
38 38
                     }
39 39
                 }
@@ -43,23 +43,23 @@  discard block
 block discarded – undo
43 43
             $findThis = $this->getResources($body, '[', ']');
44 44
             
45 45
             // THERE ARE DYNAMICS IN THIS PAGEBLOCK, LET'S RETRIEVE IT
46
-            if(count($findThis) > 0){
46
+            if (count($findThis) > 0) {
47 47
                 //@todo LOOP OVER findThis variable and resolve order for rendering
48 48
                 
49 49
                 // PAGEBLOCK CONTAINS A LOOP, LET'S RETRIEVE IT
50 50
                 if (strpos($findThis[0], 'LOOP') !== false) {
51
-                    $repeater_slug = implode(" ",$this->getResources($body, '[LOOP=', ']'));
52
-                    $repeater_body = implode(" ",$this->getResources($body, '[LOOP='.$repeater_slug.']', '[/LOOP]'));
51
+                    $repeater_slug = implode(" ", $this->getResources($body, '[LOOP=', ']'));
52
+                    $repeater_body = implode(" ", $this->getResources($body, '[LOOP=' . $repeater_slug . ']', '[/LOOP]'));
53 53
                     
54
-                    $newbody = str_replace('[LOOP='.$repeater_slug.']'.$repeater_body.'[/LOOP]',$this->getRepeaterContents($repeater_slug, $repeater_body),$body);
54
+                    $newbody = str_replace('[LOOP=' . $repeater_slug . ']' . $repeater_body . '[/LOOP]', $this->getRepeaterContents($repeater_slug, $repeater_body), $body);
55 55
 
56 56
                 // THERE IS NO LOOP, CONTINUE
57
-                }elseif(strpos($findThis[0], 'FORM') !== false) {// PAGEBLOCK CONTAINS A FORM, LET'S RETRIEVE IT
58
-                    $form_slug = implode(" ",$this->getResources($body, '[FORM=', ']'));
57
+                }elseif (strpos($findThis[0], 'FORM') !== false) {// PAGEBLOCK CONTAINS A FORM, LET'S RETRIEVE IT
58
+                    $form_slug = implode(" ", $this->getResources($body, '[FORM=', ']'));
59 59
                     
60
-                    $newbody = $this->getFormHtml($form_slug,$body);
61
-                }else{// THERE IS NO FORM, SO JUST RETRIEVE THE DYNAMIC CONTENT
62
-                    $newbody = $this->getResourceContent($findThis, $pageblock->id, $body);//Maybe write a function in the model?    
60
+                    $newbody = $this->getFormHtml($form_slug, $body);
61
+                } else {// THERE IS NO FORM, SO JUST RETRIEVE THE DYNAMIC CONTENT
62
+                    $newbody = $this->getResourceContent($findThis, $pageblock->id, $body); //Maybe write a function in the model?    
63 63
                 }
64 64
             } else {
65 65
                 $newbody = $body;
@@ -82,9 +82,9 @@  discard block
 block discarded – undo
82 82
         $body = $pageblock->body;
83 83
         $findUrlTags = $this->getResources($body, '[%', '%]');
84 84
         $url = env('APP_URL', ChuckSite::getSetting('domain'));
85
-        if(count($findUrlTags) > 0) {
86
-            foreach($findUrlTags as $foundUrlTag) {
87
-                if(strpos($foundUrlTag, 'URL') !== false) {
85
+        if (count($findUrlTags) > 0) {
86
+            foreach ($findUrlTags as $foundUrlTag) {
87
+                if (strpos($foundUrlTag, 'URL') !== false) {
88 88
                     $body = str_replace('[%URL%]', $url, $body);
89 89
                 }
90 90
             }
@@ -92,23 +92,23 @@  discard block
 block discarded – undo
92 92
 
93 93
         $findThis = $this->getResources($body, '[', ']');
94 94
         // THERE ARE DYNAMICS IN THIS PAGEBLOCK, LET'S RETRIEVE IT
95
-        if(count($findThis) > 0){
95
+        if (count($findThis) > 0) {
96 96
             //@todo LOOP OVER findThis variable and resolve order for rendering
97 97
             
98 98
             // PAGEBLOCK CONTAINS A LOOP, LET'S RETRIEVE IT
99 99
             if (strpos($findThis[0], 'LOOP') !== false) {
100
-                $repeater_slug = implode(" ",$this->getResources($body, '[LOOP=', ']'));
101
-                $repeater_body = implode(" ",$this->getResources($body, '[LOOP='.$repeater_slug.']', '[/LOOP]'));
100
+                $repeater_slug = implode(" ", $this->getResources($body, '[LOOP=', ']'));
101
+                $repeater_body = implode(" ", $this->getResources($body, '[LOOP=' . $repeater_slug . ']', '[/LOOP]'));
102 102
                 
103
-                $newbody = str_replace('[LOOP='.$repeater_slug.']'.$repeater_body.'[/LOOP]',$this->getRepeaterContents($repeater_slug, $repeater_body),$body);
103
+                $newbody = str_replace('[LOOP=' . $repeater_slug . ']' . $repeater_body . '[/LOOP]', $this->getRepeaterContents($repeater_slug, $repeater_body), $body);
104 104
 
105 105
             // THERE IS NO LOOP, CONTINUE
106
-            }elseif(strpos($findThis[0], 'FORM') !== false) {// PAGEBLOCK CONTAINS A FORM, LET'S RETRIEVE IT
107
-                $form_slug = implode(" ",$this->getResources($body, '[FORM=', ']'));
106
+            }elseif (strpos($findThis[0], 'FORM') !== false) {// PAGEBLOCK CONTAINS A FORM, LET'S RETRIEVE IT
107
+                $form_slug = implode(" ", $this->getResources($body, '[FORM=', ']'));
108 108
                 
109
-                $newbody = $this->getFormHtml($form_slug,$body);
110
-            } else{// THERE IS NO FORM, SO JUST RETRIEVE THE DYNAMIC CONTENT
111
-                $newbody = $this->getResourceContent($findThis, $pageblock->id, $body);//Maybe write a function in the model?    
109
+                $newbody = $this->getFormHtml($form_slug, $body);
110
+            } else {// THERE IS NO FORM, SO JUST RETRIEVE THE DYNAMIC CONTENT
111
+                $newbody = $this->getResourceContent($findThis, $pageblock->id, $body); //Maybe write a function in the model?    
112 112
             }
113 113
         } else {
114 114
             $newbody = $body;
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
     public function getResourceContent($resources, $page_block_id, $page_block_body)
155 155
     {
156 156
         $body = $page_block_body;
157
-        foreach($resources as $resource){
157
+        foreach ($resources as $resource) {
158 158
             $res_arr = explode('+', $resource);
159 159
             $res_slug = (string)$res_arr[0];
160 160
             $res_json = (string)$res_arr[1];
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
         $resources = $this->getResources($page_block_body, '[' . $slug . '+', ']');
191 191
         $new_body = [];
192 192
         $i = 0;
193
-        foreach($contents as $content){
193
+        foreach ($contents as $content) {
194 194
             $body = $page_block_body;
195 195
             foreach ($resources as $resource) {
196 196
                 $json = $content->json;
@@ -245,12 +245,12 @@  discard block
 block discarded – undo
245 245
     public function deleteById($id)
246 246
     {
247 247
         $pageblock = $this->pageblock->find($id);
248
-        if($pageblock){
248
+        if ($pageblock) {
249 249
             $og_order = $pageblock->order;
250 250
             //Decrement order of following pageblocks
251 251
             $pageblocks = $this->pageblock->where('page_id', $pageblock->page_id)->where('order', '>', $og_order)->decrement('order');
252 252
             //Delete pageblock
253
-            if($pageblock->delete()){
253
+            if ($pageblock->delete()) {
254 254
                 return 'success';
255 255
             } else {
256 256
                 return 'error';
Please login to merge, or discard this patch.
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -54,11 +54,11 @@  discard block
 block discarded – undo
54 54
                     $newbody = str_replace('[LOOP='.$repeater_slug.']'.$repeater_body.'[/LOOP]',$this->getRepeaterContents($repeater_slug, $repeater_body),$body);
55 55
 
56 56
                 // THERE IS NO LOOP, CONTINUE
57
-                }elseif(strpos($findThis[0], 'FORM') !== false) {// PAGEBLOCK CONTAINS A FORM, LET'S RETRIEVE IT
57
+                } elseif(strpos($findThis[0], 'FORM') !== false) {// PAGEBLOCK CONTAINS A FORM, LET'S RETRIEVE IT
58 58
                     $form_slug = implode(" ",$this->getResources($body, '[FORM=', ']'));
59 59
                     
60 60
                     $newbody = $this->getFormHtml($form_slug,$body);
61
-                }else{// THERE IS NO FORM, SO JUST RETRIEVE THE DYNAMIC CONTENT
61
+                } else{// THERE IS NO FORM, SO JUST RETRIEVE THE DYNAMIC CONTENT
62 62
                     $newbody = $this->getResourceContent($findThis, $pageblock->id, $body);//Maybe write a function in the model?    
63 63
                 }
64 64
             } else {
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
                 $newbody = str_replace('[LOOP='.$repeater_slug.']'.$repeater_body.'[/LOOP]',$this->getRepeaterContents($repeater_slug, $repeater_body),$body);
104 104
 
105 105
             // THERE IS NO LOOP, CONTINUE
106
-            }elseif(strpos($findThis[0], 'FORM') !== false) {// PAGEBLOCK CONTAINS A FORM, LET'S RETRIEVE IT
106
+            } elseif(strpos($findThis[0], 'FORM') !== false) {// PAGEBLOCK CONTAINS A FORM, LET'S RETRIEVE IT
107 107
                 $form_slug = implode(" ",$this->getResources($body, '[FORM=', ']'));
108 108
                 
109 109
                 $newbody = $this->getFormHtml($form_slug,$body);
Please login to merge, or discard this patch.
src/Chuck/UserRepository.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
 
9 9
 class UserRepository
10 10
 {
11
-	public function __construct(User $user)
11
+    public function __construct(User $user)
12 12
     {
13 13
         $this->user = $user;
14 14
     }
Please login to merge, or discard this patch.
src/Chuck/SiteRepository.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
 
10 10
     public static function updateOrCreateFromRequest($req)
11 11
     {
12
-    	$settings = [];
12
+        $settings = [];
13 13
         foreach ($req->get('socialmedia') as $smKey => $smValue) {
14 14
             $settings['socialmedia'][$smKey] = $smValue;
15 15
         }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
         foreach ($req->get('integrations') as $igsKey => $igsValue) {
20 20
             $settings['integrations'][$igsKey] = $igsValue;
21 21
         }
22
-        $settings['lang'] = implode(",",$req->get('lang'));
22
+        $settings['lang'] = implode(",", $req->get('lang'));
23 23
         $settings['domain'] = $req->get('site_domain'); //@todo remove domain from table only keep json
24 24
         
25 25
         // updateOrCreate the site
Please login to merge, or discard this patch.
src/Chuck/Accessors/Site.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -45,8 +45,8 @@  discard block
 block discarded – undo
45 45
         $settings = $site->settings;
46 46
         $locales = [];
47 47
         if ($settings !== null) { 
48
-            foreach(config('lang.allLocales') as $langKey => $langValue){
49
-                if( in_array($langKey, explode(',',$settings['lang']) ) ){
48
+            foreach (config('lang.allLocales') as $langKey => $langValue) {
49
+                if (in_array($langKey, explode(',', $settings['lang']))) {
50 50
                     $locales[$langKey] = $langValue;
51 51
                 }
52 52
             }
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
     {
93 93
         $split = explode('.', $var);
94 94
         foreach ($split as $value) {
95
-            if(array_key_exists($value, $settings)) {
95
+            if (array_key_exists($value, $settings)) {
96 96
                 $settings = $settings[$value];
97 97
             } else {
98 98
                 return null;
@@ -104,13 +104,13 @@  discard block
 block discarded – undo
104 104
 
105 105
     private function resolveSiteAttribute($var, $currentSite)
106 106
     {
107
-        if($var == 'domain') {
107
+        if ($var == 'domain') {
108 108
             return $currentSite->domain;
109 109
         }
110
-        if($var == 'name') {
110
+        if ($var == 'name') {
111 111
             return $currentSite->name;
112 112
         }
113
-        if($var == 'slug') {
113
+        if ($var == 'slug') {
114 114
             return $currentSite->slug;
115 115
         }
116 116
     }
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
@@ -35,13 +35,13 @@  discard block
 block discarded – undo
35 35
         $menus = $menuitems->getall(1);
36 36
 
37 37
         $data = ['menus' => $menus, 'indmenu' => $menu];
38
-        if($tslug == null) {
38
+        if ($tslug == null) {
39 39
             return view('chuckcms::vendor.chuck-menu.menu-front-end', $data);
40 40
         }
41
-        if($fileslug == null){
42
-            return view($tslug.'::vendor.chuck-menu.menu-front-end', $data);
41
+        if ($fileslug == null) {
42
+            return view($tslug . '::vendor.chuck-menu.menu-front-end', $data);
43 43
         }
44
-        return view($tslug.'::vendor.chuck-menu.' . $fileslug, $data);
44
+        return view($tslug . '::vendor.chuck-menu.' . $fileslug, $data);
45 45
     }
46 46
 
47 47
     public function scripts()
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
         $menuItem = new MenuItems;
76 76
         $menu_list = $menuItem->getall($menu_id);
77 77
 
78
-        $roots = $menu_list->where('menu', (integer) $menu_id)->where('parent', 0);
78
+        $roots = $menu_list->where('menu', (integer)$menu_id)->where('parent', 0);
79 79
 
80 80
         $items = self::tree($roots, $menu_list);
81 81
         return $items;
Please login to merge, or discard this patch.
src/Mail/UserActivationMail.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
     {
36 36
         return $this->from($this->mailData['from'], $this->mailData['from_name'])
37 37
                     ->to($this->mailData['to'], $this->mailData['to_name'])
38
-                    ->subject('Activeer je account op '.$this->settings['domain'])
38
+                    ->subject('Activeer je account op ' . $this->settings['domain'])
39 39
                     ->view('chuckcms::backend.mails.userActivationMail');
40 40
     }
41 41
 }
Please login to merge, or discard this patch.
src/Mail/FormActionMail.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -34,9 +34,9 @@
 block discarded – undo
34 34
                     ->to($this->mailData['to'], $this->mailData['to_name'])
35 35
                     ->subject($this->mailData['subject'])
36 36
                     ->view($this->mailData['template']);
37
-        if(is_array($this->mailData['files'])) {
38
-            foreach($this->mailData['files'] as $file) {
39
-                if($file !== null) {
37
+        if (is_array($this->mailData['files'])) {
38
+            foreach ($this->mailData['files'] as $file) {
39
+                if ($file !== null) {
40 40
                     $mail->attach(public_path($file));    
41 41
                 }
42 42
             }
Please login to merge, or discard this patch.
src/Controllers/PageController.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -160,7 +160,7 @@
 block discarded – undo
160 160
                         $blockKey = str_replace('.html', '', $value);
161 161
                         $blockName = str_replace('-', ' ', $blockKey);
162 162
                         if (file_exists($dir . DIRECTORY_SEPARATOR . $blockKey . '.jpg')) {
163
-                           $blockImage = $dir . DIRECTORY_SEPARATOR . $blockKey . '.jpg';
163
+                            $blockImage = $dir . DIRECTORY_SEPARATOR . $blockKey . '.jpg';
164 164
                         } elseif (file_exists($dir . DIRECTORY_SEPARATOR . $blockKey . '.jpeg')) {
165 165
                             $blockImage = $dir . DIRECTORY_SEPARATOR . $blockKey . '.jpeg';
166 166
                         } elseif (file_exists($dir . DIRECTORY_SEPARATOR . $blockKey . '.png')) {
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -101,12 +101,12 @@  discard block
 block discarded – undo
101 101
      */
102 102
     public function save(Request $request)
103 103
     {
104
-        $this->validate(request(), [ //@todo create custom Request class for page validation
104
+        $this->validate(request(), [//@todo create custom Request class for page validation
105 105
             'page_title' => 'max:185',
106 106
         ]);
107
-        if($request['create']){
107
+        if ($request['create']) {
108 108
             $page = $this->page->create($request);
109
-        } if($request['update']){
109
+        } if ($request['update']) {
110 110
             $page = $this->page->updatePage($request);
111 111
         }
112 112
         return redirect()->route('dashboard.pages');
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
      */
120 120
     public function delete(Request $request)
121 121
     {
122
-        $this->validate(request(), [ //@todo create custom Request class for page validation
122
+        $this->validate(request(), [//@todo create custom Request class for page validation
123 123
             'page_id' => 'required',
124 124
         ]);
125 125
         
@@ -138,8 +138,8 @@  discard block
 block discarded – undo
138 138
         $template = $this->template->where('id', $page->template_id)->where('type', 'default')->first();
139 139
         $pageblocks = $this->pageBlockRepository->getRenderedByPageBlocks($this->pageblock->getAllByPageId($page->id));
140 140
 
141
-        $block_dir = array_slice(scandir('chuckbe/'.$template->slug.'/blocks'), 2);        
142
-        $blocks = $this->dirToArray($template->path.'/blocks');
141
+        $block_dir = array_slice(scandir('chuckbe/' . $template->slug . '/blocks'), 2);        
142
+        $blocks = $this->dirToArray($template->path . '/blocks');
143 143
         
144 144
         return view('chuckcms::backend.pages.pagebuilder.index', compact('template', 'page', 'pageblocks', 'blocks'));
145 145
     }
@@ -151,12 +151,12 @@  discard block
 block discarded – undo
151 151
         $cdir = scandir($dir); 
152 152
         foreach ($cdir as $key => $value) 
153 153
         { 
154
-            if (!in_array($value,array(".",".."))) { 
154
+            if (!in_array($value, array(".", ".."))) { 
155 155
                 if (is_dir($dir . DIRECTORY_SEPARATOR . $value)) { 
156 156
                     $result[$value] = $this->dirToArray($dir . DIRECTORY_SEPARATOR . $value); 
157 157
                 } 
158 158
                 else { 
159
-                    if ($value !== '.DS_Store' && (strpos($value, '.html') !== false) ) {
159
+                    if ($value !== '.DS_Store' && (strpos($value, '.html') !== false)) {
160 160
                         $blockKey = str_replace('.html', '', $value);
161 161
                         $blockName = str_replace('-', ' ', $blockKey);
162 162
                         if (file_exists($dir . DIRECTORY_SEPARATOR . $blockKey . '.jpg')) {
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -154,8 +154,7 @@
 block discarded – undo
154 154
             if (!in_array($value,array(".",".."))) { 
155 155
                 if (is_dir($dir . DIRECTORY_SEPARATOR . $value)) { 
156 156
                     $result[$value] = $this->dirToArray($dir . DIRECTORY_SEPARATOR . $value); 
157
-                } 
158
-                else { 
157
+                } else { 
159 158
                     if ($value !== '.DS_Store' && (strpos($value, '.html') !== false) ) {
160 159
                         $blockKey = str_replace('.html', '', $value);
161 160
                         $blockName = str_replace('-', ' ', $blockKey);
Please login to merge, or discard this patch.