Passed
Push — master ( 09ce37...db619f )
by Ferry
04:38
created
src/helpers/Plugin.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -15,26 +15,26 @@  discard block
 block discarded – undo
15 15
 
16 16
     public static function has($key)
17 17
     {
18
-        if(file_exists(app_path("CBPlugins/".$key))) return true;
18
+        if (file_exists(app_path("CBPlugins/".$key))) return true;
19 19
         else return false;
20 20
     }
21 21
 
22 22
     public static function isNeedUpgrade($pluginKey, $versionToCompare)
23 23
     {
24 24
         $pluginJson = json_decode(file_get_contents(app_path("CBPlugins/".$pluginKey."/plugin.json")), true);
25
-        if($pluginJson) {
26
-            return version_compare($pluginJson['version'], $versionToCompare,"!=");
27
-        }else{
25
+        if ($pluginJson) {
26
+            return version_compare($pluginJson['version'], $versionToCompare, "!=");
27
+        } else {
28 28
             return false;
29 29
         }
30 30
     }
31 31
 
32 32
     public static function registerDefaultRoute($dir)
33 33
     {
34
-        Route::group(['middleware' => ['web',\crocodicstudio\crudbooster\middlewares\CBDeveloper::class],
34
+        Route::group(['middleware' => ['web', \crocodicstudio\crudbooster\middlewares\CBDeveloper::class],
35 35
             'prefix'=>"developer/".getSetting('developer_path'),
36
-            'namespace' => 'App\CBPlugins\\'.basename(dirname("./../".$dir)).'\Controllers'], function () use ($dir) {
37
-            cb()->routeController("plugins/".basename(dirname("./../".$dir)),"\App\CBPlugins\\".basename(dirname("./../".$dir))."\Controllers\\".basename(dirname("./../".$dir))."Controller");
36
+            'namespace' => 'App\CBPlugins\\'.basename(dirname("./../".$dir)).'\Controllers'], function() use ($dir) {
37
+            cb()->routeController("plugins/".basename(dirname("./../".$dir)), "\App\CBPlugins\\".basename(dirname("./../".$dir))."\Controllers\\".basename(dirname("./../".$dir))."Controller");
38 38
         });
39 39
     }
40 40
 
@@ -43,11 +43,11 @@  discard block
 block discarded – undo
43 43
         $plugins = scandir(app_path("CBPlugins"));
44 44
 
45 45
         $result = [];
46
-        foreach($plugins as $plugin) {
47
-            if($plugin != "." && $plugin != "..") {
46
+        foreach ($plugins as $plugin) {
47
+            if ($plugin != "." && $plugin != "..") {
48 48
                 $basename = basename($plugin);
49 49
                 $row = json_decode(file_get_contents(app_path("CBPlugins".DIRECTORY_SEPARATOR.$plugin.DIRECTORY_SEPARATOR."plugin.json")), true);
50
-                if($row) {
50
+                if ($row) {
51 51
                     $result[] = [
52 52
                         "name"=>$row['name'],
53 53
                         "version"=>$row['version'],
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -15,8 +15,11 @@  discard block
 block discarded – undo
15 15
 
16 16
     public static function has($key)
17 17
     {
18
-        if(file_exists(app_path("CBPlugins/".$key))) return true;
19
-        else return false;
18
+        if(file_exists(app_path("CBPlugins/".$key))) {
19
+            return true;
20
+        } else {
21
+            return false;
22
+        }
20 23
     }
21 24
 
22 25
     public static function isNeedUpgrade($pluginKey, $versionToCompare)
@@ -24,7 +27,7 @@  discard block
 block discarded – undo
24 27
         $pluginJson = json_decode(file_get_contents(app_path("CBPlugins/".$pluginKey."/plugin.json")), true);
25 28
         if($pluginJson) {
26 29
             return version_compare($pluginJson['version'], $versionToCompare,"!=");
27
-        }else{
30
+        } else{
28 31
             return false;
29 32
         }
30 33
     }
Please login to merge, or discard this patch.
src/controllers/DeveloperDashboardController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
     public function getIndex() {
19 19
         $data = [];
20 20
         $data['page_title'] = "Dashboard";
21
-        return view('crudbooster::dev_layouts.modules.dashboard',$data);
21
+        return view('crudbooster::dev_layouts.modules.dashboard', $data);
22 22
     }
23 23
     
24 24
     public function postSkipTutorial()
Please login to merge, or discard this patch.
src/controllers/DeveloperMailController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 
25 25
     public function getIndex() {
26 26
         $data = [];
27
-        return view($this->view.".index",$data);
27
+        return view($this->view.".index", $data);
28 28
     }
29 29
 
30 30
     public function postSave()
@@ -38,6 +38,6 @@  discard block
 block discarded – undo
38 38
             "MAIL_ENCRYPTION"=>request("MAIL_ENCRYPTION")
39 39
         ]);
40 40
 
41
-        return cb()->redirectBack("Mail configuration has been updated!","success");
41
+        return cb()->redirectBack("Mail configuration has been updated!", "success");
42 42
     }
43 43
 }
44 44
\ No newline at end of file
Please login to merge, or discard this patch.
src/controllers/AdminProfileController.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -11,11 +11,11 @@  discard block
 block discarded – undo
11 11
     public function getIndex() {
12 12
         $data = [];
13 13
         $data['page_title'] = cbLang("profile");
14
-        return view('crudbooster::profile',$data);
14
+        return view('crudbooster::profile', $data);
15 15
     }
16 16
 
17 17
     public function postUpdate() {
18
-        validator(request()->all(),[
18
+        validator(request()->all(), [
19 19
             'name'=>'required|max:255|min:3',
20 20
             'email'=>'required|email',
21 21
             'photo'=>'image',
@@ -26,20 +26,20 @@  discard block
 block discarded – undo
26 26
             $data = [];
27 27
             $data['name'] = request('name');
28 28
             $data['email'] = request('email');
29
-            if(request('password')) {
29
+            if (request('password')) {
30 30
                 $data['password'] = Hash::make(request('password'));
31 31
             }
32
-            if(request()->hasFile('photo')) {
32
+            if (request()->hasFile('photo')) {
33 33
                 $data['photo'] = cb()->uploadFile('photo', true, 200, 200);
34 34
             }
35 35
 
36 36
             DB::table("users")->where("id", auth()->id())->update($data);
37
-        }catch (\Exception $e) {
37
+        } catch (\Exception $e) {
38 38
             Log::error($e);
39
-            return cb()->redirectBack(cbLang("something_went_wrong"),"warning");
39
+            return cb()->redirectBack(cbLang("something_went_wrong"), "warning");
40 40
         }
41 41
 
42
-        return cb()->redirectBack("The profile data has been updated!","success");
42
+        return cb()->redirectBack("The profile data has been updated!", "success");
43 43
     }
44 44
 
45 45
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@
 block discarded – undo
34 34
             }
35 35
 
36 36
             DB::table("users")->where("id", auth()->id())->update($data);
37
-        }catch (\Exception $e) {
37
+        } catch (\Exception $e) {
38 38
             Log::error($e);
39 39
             return cb()->redirectBack(cbLang("something_went_wrong"),"warning");
40 40
         }
Please login to merge, or discard this patch.
src/controllers/DeveloperAuthController.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -19,25 +19,25 @@
 block discarded – undo
19 19
     }
20 20
 
21 21
     public function postLoginDeveloper() {
22
-        try{
22
+        try {
23 23
             cb()->validation([
24 24
                 'username'=>'required',
25 25
                 'password'=>'required'
26 26
             ]);
27 27
 
28
-            if(request('username') == getSetting('developer_username')
28
+            if (request('username') == getSetting('developer_username')
29 29
                 && request('password') == getSetting("developer_password")) {
30 30
 
31 31
                 session(['developer'=>getSetting('developer_username')]);
32 32
 
33 33
                 return redirect(cb()->getDeveloperUrl());
34 34
 
35
-            }else{
36
-                return cb()->redirectBack( cbLang("password_and_username_is_wrong"));
35
+            } else {
36
+                return cb()->redirectBack(cbLang("password_and_username_is_wrong"));
37 37
             }
38 38
 
39
-        }catch (CBValidationException $e) {
40
-            return cb()->redirect(cb()->getLoginUrl(),$e->getMessage(),'warning');
39
+        } catch (CBValidationException $e) {
40
+            return cb()->redirect(cb()->getLoginUrl(), $e->getMessage(), 'warning');
41 41
         }
42 42
     }
43 43
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,11 +32,11 @@
 block discarded – undo
32 32
 
33 33
                 return redirect(cb()->getDeveloperUrl());
34 34
 
35
-            }else{
35
+            } else{
36 36
                 return cb()->redirectBack( cbLang("password_and_username_is_wrong"));
37 37
             }
38 38
 
39
-        }catch (CBValidationException $e) {
39
+        } catch (CBValidationException $e) {
40 40
             return cb()->redirect(cb()->getLoginUrl(),$e->getMessage(),'warning');
41 41
         }
42 42
     }
Please login to merge, or discard this patch.
src/controllers/AdminAuthController.php 2 patches
Braces   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -33,7 +33,9 @@  discard block
 block discarded – undo
33 33
 
34 34
     public function getLogin()
35 35
     {
36
-        if(!auth()->guest()) return redirect(cb()->getAdminUrl());
36
+        if(!auth()->guest()) {
37
+            return redirect(cb()->getAdminUrl());
38
+        }
37 39
 
38 40
         cbHook()->hookGetLogin();
39 41
 
@@ -43,7 +45,9 @@  discard block
 block discarded – undo
43 45
     public function postLogin()
44 46
     {
45 47
         try{
46
-            if($this->isSuspendedLogin()) throw new CBValidationException(cbLang("you_have_been_suspended"));
48
+            if($this->isSuspendedLogin()) {
49
+                throw new CBValidationException(cbLang("you_have_been_suspended"));
50
+            }
47 51
 
48 52
             cb()->validation([
49 53
                 'email'=>'required|email',
@@ -58,7 +62,7 @@  discard block
 block discarded – undo
58 62
                 $this->incrementFailedLogin();
59 63
                 return redirect(cb()->getLoginUrl())->with(['message'=>cbLang('password_and_username_is_wrong'),'message_type'=>'warning']);
60 64
             }
61
-        }catch (CBValidationException $e) {
65
+        } catch (CBValidationException $e) {
62 66
             return cb()->redirect(cb()->getAdminUrl("login"),$e->getMessage(),'warning');
63 67
         }
64 68
     }
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -20,31 +20,31 @@  discard block
 block discarded – undo
20 20
 
21 21
     public function getLogin()
22 22
     {
23
-        if(!auth()->guest()) return redirect(cb()->getAdminUrl());
23
+        if (!auth()->guest()) return redirect(cb()->getAdminUrl());
24 24
 
25 25
         cbHook()->hookGetLogin();
26 26
 
27 27
         $data = [];
28
-        $data['no1'] = rand(1,10);
29
-        $data['no2'] = rand(1,10);
30
-        Session::put("captcha_result", $data['no1']+$data['no2']);
28
+        $data['no1'] = rand(1, 10);
29
+        $data['no2'] = rand(1, 10);
30
+        Session::put("captcha_result", $data['no1'] + $data['no2']);
31 31
 
32 32
         $themeView = getThemePath("login");
33
-        $loginView = str_replace(".blade.php", "", getSetting('login_page_view',$themeView));
34
-        return view($loginView, $data );
33
+        $loginView = str_replace(".blade.php", "", getSetting('login_page_view', $themeView));
34
+        return view($loginView, $data);
35 35
     }
36 36
 
37 37
     public function postLogin()
38 38
     {
39
-        try{
40
-            if($this->isSuspendedLogin()) throw new CBValidationException(cbLang("you_have_been_suspended"));
39
+        try {
40
+            if ($this->isSuspendedLogin()) throw new CBValidationException(cbLang("you_have_been_suspended"));
41 41
 
42 42
             cb()->validation([
43 43
                 'email'=>'required|email',
44 44
                 'password'=>'required'
45 45
             ]);
46 46
 
47
-            $credential = request()->only(['email','password']);
47
+            $credential = request()->only(['email', 'password']);
48 48
             if (auth()->attempt($credential)) {
49 49
 
50 50
                 // When login user success, clear suspend attempt
@@ -55,10 +55,10 @@  discard block
 block discarded – undo
55 55
                 return redirect(cb()->getAdminUrl());
56 56
             } else {
57 57
                 $this->incrementFailedLogin();
58
-                return redirect(cb()->getLoginUrl())->with(['message'=>cbLang('password_and_username_is_wrong'),'message_type'=>'warning']);
58
+                return redirect(cb()->getLoginUrl())->with(['message'=>cbLang('password_and_username_is_wrong'), 'message_type'=>'warning']);
59 59
             }
60
-        }catch (CBValidationException $e) {
61
-            return cb()->redirect(cb()->getAdminUrl("login"),$e->getMessage(),'warning');
60
+        } catch (CBValidationException $e) {
61
+            return cb()->redirect(cb()->getAdminUrl("login"), $e->getMessage(), 'warning');
62 62
         }
63 63
     }
64 64
 
Please login to merge, or discard this patch.
src/helpers/Helper.php 3 patches
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -220,20 +220,20 @@  discard block
 block discarded – undo
220 220
 }
221 221
 
222 222
 if(!function_exists('extract_unit')) {	
223
-	/*
223
+    /*
224 224
 	Credits: Bit Repository
225 225
 	URL: http://www.bitrepository.com/extract-content-between-two-delimiters-with-php.html
226 226
 	*/
227
-	function extract_unit($string, $start, $end)
228
-	{
229
-	$pos = stripos($string, $start);
230
-	$str = substr($string, $pos);
231
-	$str_two = substr($str, strlen($start));
232
-	$second_pos = stripos($str_two, $end);
233
-	$str_three = substr($str_two, 0, $second_pos);
234
-	$unit = trim($str_three); // remove whitespaces
235
-	return $unit;
236
-	}
227
+    function extract_unit($string, $start, $end)
228
+    {
229
+    $pos = stripos($string, $start);
230
+    $str = substr($string, $pos);
231
+    $str_two = substr($str, strlen($start));
232
+    $second_pos = stripos($str_two, $end);
233
+    $str_three = substr($str_two, 0, $second_pos);
234
+    $unit = trim($str_three); // remove whitespaces
235
+    return $unit;
236
+    }
237 237
 }
238 238
 
239 239
 /* 
@@ -407,22 +407,22 @@  discard block
 block discarded – undo
407 407
 }
408 408
 
409 409
 if(!function_exists('rrmdir')) {
410
-	/*
410
+    /*
411 411
 	* http://stackoverflow.com/questions/3338123/how-do-i-recursively-delete-a-directory-and-its-entire-contents-files-sub-dir
412 412
 	*/
413
-	function rrmdir($dir) { 
414
-	   if (is_dir($dir)) { 
415
-	     $objects = scandir($dir); 
416
-	     foreach ($objects as $object) { 
417
-	       if ($object != "." && $object != "..") { 
418
-	         if (is_dir($dir."/".$object))
419
-	           rrmdir($dir."/".$object);
420
-	         else
421
-	           unlink($dir."/".$object); 
422
-	       } 
423
-	     }
424
-	     rmdir($dir); 
425
-	   } 
426
-	 }
413
+    function rrmdir($dir) { 
414
+        if (is_dir($dir)) { 
415
+            $objects = scandir($dir); 
416
+            foreach ($objects as $object) { 
417
+            if ($object != "." && $object != "..") { 
418
+                if (is_dir($dir."/".$object))
419
+                rrmdir($dir."/".$object);
420
+                else
421
+                unlink($dir."/".$object); 
422
+            } 
423
+            }
424
+            rmdir($dir); 
425
+        } 
426
+        }
427 427
 }
428 428
 
Please login to merge, or discard this patch.
Braces   +25 added lines, -17 removed lines patch added patch discarded remove patch
@@ -2,8 +2,11 @@  discard block
 block discarded – undo
2 2
 if(!function_exists("isConfigCached")) {
3 3
     function isConfigCached()
4 4
     {
5
-        if(env("APP_NAME")=="" || env("APP_NAME")==null) return true;
6
-        else return false;
5
+        if(env("APP_NAME")=="" || env("APP_NAME")==null) {
6
+            return true;
7
+        } else {
8
+            return false;
9
+        }
7 10
     }
8 11
 }
9 12
 
@@ -113,7 +116,9 @@  discard block
 block discarded – undo
113 116
         }
114 117
 
115 118
         $str = substr($str, 0, -1);
116
-        if (!file_put_contents($envFile, $str)) return false;
119
+        if (!file_put_contents($envFile, $str)) {
120
+            return false;
121
+        }
117 122
         return true;
118 123
     }
119 124
 }
@@ -316,7 +321,7 @@  discard block
 block discarded – undo
316 321
             $settings = file_get_contents(storage_path('.cbconfig'));
317 322
             $settings = decrypt($settings);
318 323
             $settings = unserialize($settings);
319
-        }else{
324
+        } else{
320 325
             $settings = [];
321 326
         }
322 327
 
@@ -341,14 +346,14 @@  discard block
 block discarded – undo
341 346
             $settings = file_get_contents(storage_path('.cbconfig'));
342 347
             $settings = decrypt($settings);
343 348
             $settings = unserialize($settings);
344
-        }else{
349
+        } else{
345 350
             $settings = [];
346 351
         }
347 352
 
348 353
         if(isset($settings[$key])) {
349 354
             \Illuminate\Support\Facades\Cache::forever("setting_".$key, $settings[$key]);
350 355
             return $settings[$key]?:$default;
351
-        }else{
356
+        } else{
352 357
             return $default;
353 358
         }
354 359
     }
@@ -434,7 +439,7 @@  discard block
 block discarded – undo
434 439
         $url = request($name);
435 440
         if(filter_var($url, FILTER_VALIDATE_URL)) {
436 441
             return $url;
437
-        }else{
442
+        } else{
438 443
             return request()->url();
439 444
         }
440 445
     }
@@ -446,14 +451,14 @@  discard block
 block discarded – undo
446 451
             $response = request($name);
447 452
             if(is_string($response)) {
448 453
                 $response = sanitizeXSS($response);
449
-            }elseif (is_array($response)) {
454
+            } elseif (is_array($response)) {
450 455
                 array_walk_recursive($response, function(&$response) {
451 456
                     $response = sanitizeXSS($response);
452 457
                 });
453 458
             }
454 459
 
455 460
             return $response;
456
-        }else{
461
+        } else{
457 462
             return Request::get($name);
458 463
         }
459 464
     }
@@ -463,11 +468,13 @@  discard block
 block discarded – undo
463 468
     function min_var_export($input) {
464 469
         if(is_array($input)) {
465 470
             $buffer = [];
466
-            foreach($input as $key => $value)
467
-                $buffer[] = var_export($key, true)."=>".min_var_export($value);
471
+            foreach($input as $key => $value) {
472
+                            $buffer[] = var_export($key, true)."=>".min_var_export($value);
473
+            }
468 474
             return "[".implode(",",$buffer)."]";
469
-        } else
470
-            return var_export($input, true);
475
+        } else {
476
+                    return var_export($input, true);
477
+        }
471 478
     }
472 479
 }
473 480
 
@@ -480,10 +487,11 @@  discard block
 block discarded – undo
480 487
 	     $objects = scandir($dir); 
481 488
 	     foreach ($objects as $object) { 
482 489
 	       if ($object != "." && $object != "..") { 
483
-	         if (is_dir($dir."/".$object))
484
-	           rrmdir($dir."/".$object);
485
-	         else
486
-	           unlink($dir."/".$object); 
490
+	         if (is_dir($dir."/".$object)) {
491
+	         	           rrmdir($dir."/".$object);
492
+	         } else {
493
+	         	           unlink($dir."/".$object);
494
+	         }
487 495
 	       } 
488 496
 	     }
489 497
 	     rmdir($dir); 
Please login to merge, or discard this patch.
Spacing   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -3,58 +3,58 @@  discard block
 block discarded – undo
3 3
 /*
4 4
  * Theme Helper
5 5
  */
6
-if(!function_exists("themeLoginBackground")) {
6
+if (!function_exists("themeLoginBackground")) {
7 7
     function themeLoginBackground() {
8 8
         return "crudbooster::layouts.login_background_css";
9 9
     }
10 10
 }
11
-if(!function_exists("themeFlashMessage")) {
11
+if (!function_exists("themeFlashMessage")) {
12 12
     function themeFlashMessage() {
13 13
         return "crudbooster::layouts.flash_message";
14 14
     }
15 15
 }
16 16
 
17
-if(!function_exists("themeAlertMessage")) {
17
+if (!function_exists("themeAlertMessage")) {
18 18
     function themeAlertMessage() {
19 19
         return "crudbooster::layouts.alert_message";
20 20
     }
21 21
 }
22 22
 
23
-if(!function_exists("themeLayoutPageTitleAndButton")) {
23
+if (!function_exists("themeLayoutPageTitleAndButton")) {
24 24
     function themeLayoutPageTitleAndButton() {
25 25
         return 'crudbooster::module.index.index_head_buttons';
26 26
     }
27 27
 }
28 28
 
29
-if(!function_exists("themeLayoutHead")) {
29
+if (!function_exists("themeLayoutHead")) {
30 30
     function themeLayoutHead() {
31 31
         return "crudbooster::layouts.head";
32 32
     }
33 33
 }
34
-if(!function_exists("themeTitle")) {
34
+if (!function_exists("themeTitle")) {
35 35
     function themeTitle($page_title) {
36
-        $page_title = isset($page_title)?$page_title:module()->getPageTitle();
37
-        return (isset($page_title))?cb()->getAppName().': '.strip_tags($page_title):"Admin Area";
36
+        $page_title = isset($page_title) ? $page_title : module()->getPageTitle();
37
+        return (isset($page_title)) ?cb()->getAppName().': '.strip_tags($page_title) : "Admin Area";
38 38
     }
39 39
 }
40 40
 
41
-if(!function_exists("getThemePath")) {
41
+if (!function_exists("getThemePath")) {
42 42
     function getThemePath($path = null) {
43
-        return getSetting("theme_path", "crudbooster::themes.adminlte").(($path)?".".$path:null);
43
+        return getSetting("theme_path", "crudbooster::themes.adminlte").(($path) ? ".".$path : null);
44 44
     }
45 45
 }
46 46
 
47 47
 // End Theme Helper
48 48
 
49
-if(!function_exists("isConfigCached")) {
49
+if (!function_exists("isConfigCached")) {
50 50
     function isConfigCached()
51 51
     {
52
-        if(env("APP_NAME")=="" || env("APP_NAME")==null) return true;
52
+        if (env("APP_NAME") == "" || env("APP_NAME") == null) return true;
53 53
         else return false;
54 54
     }
55 55
 }
56 56
 
57
-if(!function_exists("miscellanousSingleton")) {
57
+if (!function_exists("miscellanousSingleton")) {
58 58
     /**
59 59
      * @return \crocodicstudio\crudbooster\helpers\MiscellanousSingleton
60 60
      */
@@ -63,14 +63,14 @@  discard block
 block discarded – undo
63 63
     }
64 64
 }
65 65
 
66
-if(!function_exists("makeReferalUrl")) {
66
+if (!function_exists("makeReferalUrl")) {
67 67
     function makeReferalUrl($name = null) {
68 68
         $ref = [];
69 69
         $ref['url'] = request()->fullUrl();
70 70
         $ref['name'] = $name;
71 71
         $md5Hash = md5(serialize($ref));
72 72
 
73
-        if($exist = \Illuminate\Support\Facades\Cache::get("refurl_".$md5Hash)) {
73
+        if ($exist = \Illuminate\Support\Facades\Cache::get("refurl_".$md5Hash)) {
74 74
             return $exist['id'];
75 75
         }
76 76
 
@@ -82,12 +82,12 @@  discard block
 block discarded – undo
82 82
     }
83 83
 }
84 84
 
85
-if(!function_exists("getReferalUrl")) {
85
+if (!function_exists("getReferalUrl")) {
86 86
     function getReferalUrl($key = null) {
87
-        if(verifyReferalUrl()) {
87
+        if (verifyReferalUrl()) {
88 88
             $md5hash = \Illuminate\Support\Facades\Cache::get("refurl_token_".request("ref"));
89 89
             $ref = \Illuminate\Support\Facades\Cache::get("refurl_".$md5hash);
90
-            if($key) {
90
+            if ($key) {
91 91
                 return @$ref[$key];
92 92
             } else {
93 93
                 return $ref;
@@ -97,13 +97,13 @@  discard block
 block discarded – undo
97 97
     }
98 98
 }
99 99
 
100
-if(!function_exists("verifyReferalUrl")) {
100
+if (!function_exists("verifyReferalUrl")) {
101 101
     function verifyReferalUrl()
102 102
     {
103
-        if(request("ref")) {
104
-            if($md5hash = \Illuminate\Support\Facades\Cache::get("refurl_token_".request("ref"))) {
103
+        if (request("ref")) {
104
+            if ($md5hash = \Illuminate\Support\Facades\Cache::get("refurl_token_".request("ref"))) {
105 105
                 $ref = \Illuminate\Support\Facades\Cache::get("refurl_".$md5hash);
106
-                if(filter_var($ref['url'], FILTER_VALIDATE_URL)) {
106
+                if (filter_var($ref['url'], FILTER_VALIDATE_URL)) {
107 107
                     return true;
108 108
                 }
109 109
             }
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
     }
113 113
 }
114 114
 
115
-if(!function_exists("putHtaccess")) {
115
+if (!function_exists("putHtaccess")) {
116 116
     function putHtaccess($stringToPut)
117 117
     {
118 118
         file_put_contents(base_path(".htaccess"), "\n".$stringToPut, FILE_APPEND);
@@ -120,13 +120,13 @@  discard block
 block discarded – undo
120 120
     }
121 121
 }
122 122
 
123
-if(!function_exists("checkHtaccess")) {
123
+if (!function_exists("checkHtaccess")) {
124 124
     function checkHtaccess($stringToCheck)
125 125
     {
126
-        if(file_exists(base_path(".htaccess")) && file_exists(public_path(".htaccess"))) {
126
+        if (file_exists(base_path(".htaccess")) && file_exists(public_path(".htaccess"))) {
127 127
             $htaccess = file_get_contents(base_path(".htaccess"));
128
-            $htaccess2= file_get_contents(public_path(".htaccess"));
129
-            if(\Illuminate\Support\Str::contains($htaccess, $stringToCheck) && \Illuminate\Support\Str::contains($htaccess2, $stringToCheck)) {
128
+            $htaccess2 = file_get_contents(public_path(".htaccess"));
129
+            if (\Illuminate\Support\Str::contains($htaccess, $stringToCheck) && \Illuminate\Support\Str::contains($htaccess2, $stringToCheck)) {
130 130
                 return true;
131 131
             }
132 132
         }
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
     }
136 136
 }
137 137
 
138
-if(!function_exists("setEnvironmentValue")) {
138
+if (!function_exists("setEnvironmentValue")) {
139 139
     function setEnvironmentValue(array $values)
140 140
     {
141 141
         $envFile = app()->environmentFilePath();
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 }
167 167
 
168 168
 
169
-if(!function_exists("cbLang")) {
169
+if (!function_exists("cbLang")) {
170 170
     /**
171 171
      * @param string $key
172 172
      * @param array $replace
@@ -178,17 +178,17 @@  discard block
 block discarded – undo
178 178
     }
179 179
 }
180 180
 
181
-if(!function_exists('rglob')) {
181
+if (!function_exists('rglob')) {
182 182
     function rglob($pattern, $flags = 0) {
183 183
         $files = glob($pattern, $flags);
184
-        foreach (glob(dirname($pattern).'/*', GLOB_ONLYDIR|GLOB_NOSORT) as $dir) {
184
+        foreach (glob(dirname($pattern).'/*', GLOB_ONLYDIR | GLOB_NOSORT) as $dir) {
185 185
             $files = array_merge($files, rglob($dir.'/'.basename($pattern), $flags));
186 186
         }
187 187
         return $files;
188 188
     }
189 189
 }
190 190
 
191
-if(!function_exists('convertPHPToMomentFormat')) {
191
+if (!function_exists('convertPHPToMomentFormat')) {
192 192
     function convertPHPToMomentFormat($format)
193 193
     {
194 194
         $replacements = [
@@ -235,13 +235,13 @@  discard block
 block discarded – undo
235 235
     }
236 236
 }
237 237
 
238
-if(!function_exists('slug')) {
238
+if (!function_exists('slug')) {
239 239
     function slug($string, $separator = '-') {
240 240
         return \Illuminate\Support\Str::slug($string, $separator);
241 241
     }
242 242
 }
243 243
 
244
-if(!function_exists('columnSingleton')) {
244
+if (!function_exists('columnSingleton')) {
245 245
     /**
246 246
      * @return \crocodicstudio\crudbooster\controllers\scaffolding\singletons\ColumnSingleton
247 247
      */
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
     }
251 251
 }
252 252
 
253
-if(!function_exists('cbHook'))
253
+if (!function_exists('cbHook'))
254 254
 {
255 255
     /**
256 256
      * @return crocodicstudio\crudbooster\hooks\CBHook
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
     }
263 263
 }
264 264
 
265
-if(!function_exists('getTypeHook'))
265
+if (!function_exists('getTypeHook'))
266 266
 {
267 267
     /**
268 268
      * @param string $type
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
     }
276 276
 }
277 277
 
278
-if(!function_exists('getPrimaryKey'))
278
+if (!function_exists('getPrimaryKey'))
279 279
 {
280 280
     function getPrimaryKey($table_name)
281 281
     {
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
     }
284 284
 }
285 285
 
286
-if(!function_exists('cb'))
286
+if (!function_exists('cb'))
287 287
 {
288 288
     function cb()
289 289
     {
@@ -291,25 +291,25 @@  discard block
 block discarded – undo
291 291
     }
292 292
 }
293 293
 
294
-if(!function_exists('cbAsset')) {
294
+if (!function_exists('cbAsset')) {
295 295
     function cbAsset($path, $secure = null) {
296 296
         return asset("cb_asset/".$path, $secure);
297 297
     }
298 298
 }
299 299
 
300
-if(!function_exists("cbConfig")) {
300
+if (!function_exists("cbConfig")) {
301 301
     function cbConfig($name, $default = null) {
302 302
         return config("crudbooster.".$name, $default);
303 303
     }
304 304
 }
305 305
 
306
-if(!function_exists("strRandom")) {
306
+if (!function_exists("strRandom")) {
307 307
     function strRandom($length = 5) {
308 308
         return \Illuminate\Support\Str::random($length);
309 309
     }
310 310
 }
311 311
 
312
-if(!function_exists('module')) {
312
+if (!function_exists('module')) {
313 313
     function module()
314 314
     {
315 315
         $module = new \crocodicstudio\crudbooster\helpers\Module();
@@ -317,21 +317,21 @@  discard block
 block discarded – undo
317 317
     }
318 318
 }
319 319
 
320
-if(!function_exists('getAdminLoginURL')) {
320
+if (!function_exists('getAdminLoginURL')) {
321 321
     function getAdminLoginURL()
322 322
     {
323 323
         return cb()->getAdminUrl("login");
324 324
     }
325 325
 }
326 326
 
327
-if(!function_exists('dummyPhoto')) {
327
+if (!function_exists('dummyPhoto')) {
328 328
     function dummyPhoto()
329 329
     {
330 330
         return cbConfig("DUMMY_PHOTO");
331 331
     }
332 332
 }
333 333
 
334
-if(!function_exists('extract_unit')) {	
334
+if (!function_exists('extract_unit')) {	
335 335
 	/*
336 336
 	Credits: Bit Repository
337 337
 	URL: http://www.bitrepository.com/extract-content-between-two-delimiters-with-php.html
@@ -356,14 +356,14 @@  discard block
 block discarded – undo
356 356
 |
357 357
 */
358 358
 
359
-if(!function_exists('putSetting')) {
359
+if (!function_exists('putSetting')) {
360 360
     function putSetting($key, $value)
361 361
     {
362
-        if(file_exists(storage_path('.cbconfig'))) {
362
+        if (file_exists(storage_path('.cbconfig'))) {
363 363
             $settings = file_get_contents(storage_path('.cbconfig'));
364 364
             $settings = decrypt($settings);
365 365
             $settings = unserialize($settings);
366
-        }else{
366
+        } else {
367 367
             $settings = [];
368 368
         }
369 369
 
@@ -377,31 +377,31 @@  discard block
 block discarded – undo
377 377
     }
378 378
 }
379 379
 
380
-if(!function_exists('getSetting')) {
380
+if (!function_exists('getSetting')) {
381 381
     function getSetting($key, $default = null)
382 382
     {
383
-        if($cache = \Illuminate\Support\Facades\Cache::get("setting_".$key)) {
383
+        if ($cache = \Illuminate\Support\Facades\Cache::get("setting_".$key)) {
384 384
             return $cache;
385 385
         }
386 386
 
387
-        if(file_exists(storage_path('.cbconfig'))) {
387
+        if (file_exists(storage_path('.cbconfig'))) {
388 388
             $settings = file_get_contents(storage_path('.cbconfig'));
389 389
             $settings = decrypt($settings);
390 390
             $settings = unserialize($settings);
391
-        }else{
391
+        } else {
392 392
             $settings = [];
393 393
         }
394 394
 
395
-        if(isset($settings[$key])) {
395
+        if (isset($settings[$key])) {
396 396
             \Illuminate\Support\Facades\Cache::forever("setting_".$key, $settings[$key]);
397
-            return $settings[$key]?:$default;
398
-        }else{
397
+            return $settings[$key] ?: $default;
398
+        } else {
399 399
             return $default;
400 400
         }
401 401
     }
402 402
 }
403 403
 
404
-if(!function_exists('timeAgo')) {
404
+if (!function_exists('timeAgo')) {
405 405
     function timeAgo($datetime_to, $datetime_from = null, $full = false)
406 406
     {
407 407
         $datetime_from = ($datetime_from) ?: date('Y-m-d H:i:s');
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
             }
433 433
         }
434 434
 
435
-        if (! $full) {
435
+        if (!$full) {
436 436
             $string = array_slice($string, 0, 1);
437 437
         }
438 438
 
@@ -440,22 +440,22 @@  discard block
 block discarded – undo
440 440
     }
441 441
 }
442 442
 
443
-if(!function_exists("array_map_r")) {
444
-    function array_map_r( $func, $arr )
443
+if (!function_exists("array_map_r")) {
444
+    function array_map_r($func, $arr)
445 445
     {
446 446
         $newArr = array();
447 447
 
448
-        foreach( $arr as $key => $value )
448
+        foreach ($arr as $key => $value)
449 449
         {
450 450
             $key = $func($key);
451
-            $newArr[ $key ] = ( is_array( $value ) ? array_map_r( $func, $value ) : ( is_array($func) ? call_user_func_array($func, $value) : $func( $value ) ) );
451
+            $newArr[$key] = (is_array($value) ? array_map_r($func, $value) : (is_array($func) ? call_user_func_array($func, $value) : $func($value)));
452 452
         }
453 453
 
454 454
         return $newArr;
455 455
     }
456 456
 }
457 457
 
458
-if(!function_exists("sanitizeXSS"))
458
+if (!function_exists("sanitizeXSS"))
459 459
 {
460 460
     function sanitizeXSS($value)
461 461
     {
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
     }
468 468
 }
469 469
 
470
-if(!function_exists("requestAll")) {
470
+if (!function_exists("requestAll")) {
471 471
     function requestAll() {
472 472
         $all = array_map_r("sanitizeXSS", request()->all());
473 473
         return $all;
@@ -476,22 +476,22 @@  discard block
 block discarded – undo
476 476
 
477 477
 
478 478
 
479
-if(!function_exists('getURLFormat')) {
479
+if (!function_exists('getURLFormat')) {
480 480
     function getURLFormat($name) {
481 481
         $url = request($name);
482
-        if(filter_var($url, FILTER_VALIDATE_URL)) {
482
+        if (filter_var($url, FILTER_VALIDATE_URL)) {
483 483
             return $url;
484
-        }else{
484
+        } else {
485 485
             return request()->url();
486 486
         }
487 487
     }
488 488
 }
489 489
 
490
-if(!function_exists('g')) {
490
+if (!function_exists('g')) {
491 491
     function g($name, $safe = true) {
492
-        if($safe == true) {
492
+        if ($safe == true) {
493 493
             $response = request($name);
494
-            if(is_string($response)) {
494
+            if (is_string($response)) {
495 495
                 $response = sanitizeXSS($response);
496 496
             }elseif (is_array($response)) {
497 497
                 array_walk_recursive($response, function(&$response) {
@@ -500,25 +500,25 @@  discard block
 block discarded – undo
500 500
             }
501 501
 
502 502
             return $response;
503
-        }else{
503
+        } else {
504 504
             return Request::get($name);
505 505
         }
506 506
     }
507 507
 }
508 508
 
509
-if(!function_exists('min_var_export')) {
509
+if (!function_exists('min_var_export')) {
510 510
     function min_var_export($input) {
511
-        if(is_array($input)) {
511
+        if (is_array($input)) {
512 512
             $buffer = [];
513
-            foreach($input as $key => $value)
513
+            foreach ($input as $key => $value)
514 514
                 $buffer[] = var_export($key, true)."=>".min_var_export($value);
515
-            return "[".implode(",",$buffer)."]";
515
+            return "[".implode(",", $buffer)."]";
516 516
         } else
517 517
             return var_export($input, true);
518 518
     }
519 519
 }
520 520
 
521
-if(!function_exists('rrmdir')) {
521
+if (!function_exists('rrmdir')) {
522 522
 	/*
523 523
 	* http://stackoverflow.com/questions/3338123/how-do-i-recursively-delete-a-directory-and-its-entire-contents-files-sub-dir
524 524
 	*/
Please login to merge, or discard this patch.
src/helpers/CurlHelper.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 
26 26
     public function headers(array $headers) {
27 27
         $newHeaders = [];
28
-        foreach($headers as $key=>$val) {
28
+        foreach ($headers as $key=>$val) {
29 29
             $newHeaders[] = $key.": ".$val;
30 30
         }
31 31
         $this->headers = $newHeaders;
@@ -47,9 +47,9 @@  discard block
 block discarded – undo
47 47
         $err = curl_error($ch);
48 48
         curl_close($ch);
49 49
 
50
-        if($err) {
50
+        if ($err) {
51 51
             return $err;
52
-        }else {
52
+        } else {
53 53
             return $response;
54 54
         }
55 55
     }
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
 
50 50
         if($err) {
51 51
             return $err;
52
-        }else {
52
+        } else {
53 53
             return $response;
54 54
         }
55 55
     }
Please login to merge, or discard this patch.
src/commands/Install.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 
40 40
         if ($this->confirm('Do you have setting the database configuration at .env ?')) {
41 41
 
42
-            if (! file_exists(public_path('vendor')) ) {
42
+            if (!file_exists(public_path('vendor'))) {
43 43
                 mkdir(public_path('vendor'));
44 44
             }
45 45
 
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
             /*
53 53
              * Create CBPlugins
54 54
              */
55
-            if(!file_exists(app_path("CBPlugins"))) {
55
+            if (!file_exists(app_path("CBPlugins"))) {
56 56
                 mkdir(app_path("CBPlugins"));
57 57
             }
58 58
 
@@ -61,11 +61,11 @@  discard block
 block discarded – undo
61 61
              * We need it to change default laravel local filesystem from storage to public
62 62
              * We won't use symlink because of a security issue in many server
63 63
              */
64
-            if(!file_exists(public_path("storage"))) {
64
+            if (!file_exists(public_path("storage"))) {
65 65
                 $this->info("Create storage directory on /public");
66 66
                 mkdir(public_path("storage"));
67
-                file_put_contents(public_path("storage/.gitignore"),"!.gitignore");
68
-                file_put_contents(public_path("storage/index.html")," ");
67
+                file_put_contents(public_path("storage/.gitignore"), "!.gitignore");
68
+                file_put_contents(public_path("storage/index.html"), " ");
69 69
             }
70 70
 
71 71
             /*
@@ -74,8 +74,8 @@  discard block
 block discarded – undo
74 74
              * Disable php execution on /vendor/*
75 75
              */
76 76
             $this->info("Tweak some security for your laravel");
77
-            file_put_contents(base_path(".htaccess"), "\n\n# Generated by CRUDBooster\nServerSignature Off\nIndexIgnore *\nRewriteRule ^(.*)/vendor/.*\.(php|rb|py)$ - [F,L,NC]\nRewriteRule ^vendor/.*\.(php|rb|py)$ - [F,L,NC]\n<FilesMatch \"^\.\">\nOrder allow,deny\nDeny from all\n</FilesMatch>",FILE_APPEND);
78
-            file_put_contents(public_path(".htaccess"), "\n\n# Generated by CRUDBooster\nServerSignature Off\nIndexIgnore *\nRewriteRule ^(.*)/vendor/.*\.(php|rb|py)$ - [F,L,NC]\nRewriteRule ^vendor/.*\.(php|rb|py)$ - [F,L,NC]\n<FilesMatch \"^\.\">\nOrder allow,deny\nDeny from all\n</FilesMatch>",FILE_APPEND);
77
+            file_put_contents(base_path(".htaccess"), "\n\n# Generated by CRUDBooster\nServerSignature Off\nIndexIgnore *\nRewriteRule ^(.*)/vendor/.*\.(php|rb|py)$ - [F,L,NC]\nRewriteRule ^vendor/.*\.(php|rb|py)$ - [F,L,NC]\n<FilesMatch \"^\.\">\nOrder allow,deny\nDeny from all\n</FilesMatch>", FILE_APPEND);
78
+            file_put_contents(public_path(".htaccess"), "\n\n# Generated by CRUDBooster\nServerSignature Off\nIndexIgnore *\nRewriteRule ^(.*)/vendor/.*\.(php|rb|py)$ - [F,L,NC]\nRewriteRule ^vendor/.*\.(php|rb|py)$ - [F,L,NC]\n<FilesMatch \"^\.\">\nOrder allow,deny\nDeny from all\n</FilesMatch>", FILE_APPEND);
79 79
 
80 80
 
81 81
             $this->info('Dumping the autoloaded files and reloading all new files...');
Please login to merge, or discard this patch.