@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | $fullStoragePath = storage_path('app/'.$fullFilePath); |
| 35 | 35 | $lifetime = 31556926; // One year in seconds |
| 36 | 36 | |
| 37 | - if (! Storage::exists($fullFilePath)) { |
|
| 37 | + if (!Storage::exists($fullFilePath)) { |
|
| 38 | 38 | abort(404); |
| 39 | 39 | } |
| 40 | 40 | |
@@ -55,10 +55,10 @@ discard block |
||
| 55 | 55 | $h = Request::get('h') ?: $w; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - $imgRaw = Image::cache(function ($image) use ($fullStoragePath, $w, $h) { |
|
| 58 | + $imgRaw = Image::cache(function($image) use ($fullStoragePath, $w, $h) { |
|
| 59 | 59 | $im = $image->make($fullStoragePath); |
| 60 | 60 | if ($w) { |
| 61 | - if (! $h) { |
|
| 61 | + if (!$h) { |
|
| 62 | 62 | $im->fit($w); |
| 63 | 63 | } else { |
| 64 | 64 | $im->fit($w, $h); |
@@ -31,7 +31,7 @@ |
||
| 31 | 31 | $data['photo'] = cb()->uploadFile('photo', true, 200, 200); |
| 32 | 32 | } |
| 33 | 33 | DB::table("users")->where("id", auth()->id())->update($data); |
| 34 | - }catch (\Exception $e) { |
|
| 34 | + } catch (\Exception $e) { |
|
| 35 | 35 | Log::error($e); |
| 36 | 36 | return cb()->redirectBack("Something went wrong!","warning"); |
| 37 | 37 | } |
@@ -11,11 +11,11 @@ discard block |
||
| 11 | 11 | public function getIndex() { |
| 12 | 12 | $data = []; |
| 13 | 13 | $data['page_title'] = '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,19 +26,19 @@ discard block |
||
| 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 | DB::table("users")->where("id", auth()->id())->update($data); |
| 36 | - }catch (\Exception $e) { |
|
| 36 | + } catch (\Exception $e) { |
|
| 37 | 37 | Log::error($e); |
| 38 | - return cb()->redirectBack("Something went wrong!","warning"); |
|
| 38 | + return cb()->redirectBack("Something went wrong!", "warning"); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - return cb()->redirectBack("The profile data has been updated!","success"); |
|
| 41 | + return cb()->redirectBack("The profile data has been updated!", "success"); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | } |
@@ -118,49 +118,49 @@ discard block |
||
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | if(!function_exists('assetThumbnail')) { |
| 121 | - function assetThumbnail($path) { |
|
| 122 | - $path = str_replace('uploads/','uploads_thumbnail/',$path); |
|
| 123 | - return asset($path); |
|
| 124 | - } |
|
| 121 | + function assetThumbnail($path) { |
|
| 122 | + $path = str_replace('uploads/','uploads_thumbnail/',$path); |
|
| 123 | + return asset($path); |
|
| 124 | + } |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | if(!function_exists('assetResize')) { |
| 128 | - function assetResize($path,$width,$height=null,$quality=70) { |
|
| 129 | - $basename = basename($path); |
|
| 130 | - $pathWithoutName = str_replace($basename, '', $path); |
|
| 131 | - $newLocation = $pathWithoutName.'/w_'.$width.'_h_'.$height.'_'.$basename; |
|
| 132 | - if(Storage::exists($newLocation)) { |
|
| 133 | - return asset($newLocation); |
|
| 134 | - }else{ |
|
| 135 | - $img = Image::make(storage_path($path))->fit($width,$height); |
|
| 136 | - $img->save(storage_path($newLocation),$quality); |
|
| 137 | - return asset($newLocation); |
|
| 138 | - } |
|
| 139 | - } |
|
| 128 | + function assetResize($path,$width,$height=null,$quality=70) { |
|
| 129 | + $basename = basename($path); |
|
| 130 | + $pathWithoutName = str_replace($basename, '', $path); |
|
| 131 | + $newLocation = $pathWithoutName.'/w_'.$width.'_h_'.$height.'_'.$basename; |
|
| 132 | + if(Storage::exists($newLocation)) { |
|
| 133 | + return asset($newLocation); |
|
| 134 | + }else{ |
|
| 135 | + $img = Image::make(storage_path($path))->fit($width,$height); |
|
| 136 | + $img->save(storage_path($newLocation),$quality); |
|
| 137 | + return asset($newLocation); |
|
| 138 | + } |
|
| 139 | + } |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | if(!function_exists('extract_unit')) { |
| 143 | - /* |
|
| 143 | + /* |
|
| 144 | 144 | Credits: Bit Repository |
| 145 | 145 | URL: http://www.bitrepository.com/extract-content-between-two-delimiters-with-php.html |
| 146 | 146 | */ |
| 147 | - function extract_unit($string, $start, $end) |
|
| 148 | - { |
|
| 149 | - $pos = stripos($string, $start); |
|
| 150 | - $str = substr($string, $pos); |
|
| 151 | - $str_two = substr($str, strlen($start)); |
|
| 152 | - $second_pos = stripos($str_two, $end); |
|
| 153 | - $str_three = substr($str_two, 0, $second_pos); |
|
| 154 | - $unit = trim($str_three); // remove whitespaces |
|
| 155 | - return $unit; |
|
| 156 | - } |
|
| 147 | + function extract_unit($string, $start, $end) |
|
| 148 | + { |
|
| 149 | + $pos = stripos($string, $start); |
|
| 150 | + $str = substr($string, $pos); |
|
| 151 | + $str_two = substr($str, strlen($start)); |
|
| 152 | + $second_pos = stripos($str_two, $end); |
|
| 153 | + $str_three = substr($str_two, 0, $second_pos); |
|
| 154 | + $unit = trim($str_three); // remove whitespaces |
|
| 155 | + return $unit; |
|
| 156 | + } |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | |
| 160 | 160 | if(!function_exists('now')) { |
| 161 | - function now() { |
|
| 162 | - return date('Y-m-d H:i:s'); |
|
| 163 | - } |
|
| 161 | + function now() { |
|
| 162 | + return date('Y-m-d H:i:s'); |
|
| 163 | + } |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | /* |
@@ -324,22 +324,22 @@ discard block |
||
| 324 | 324 | } |
| 325 | 325 | |
| 326 | 326 | if(!function_exists('rrmdir')) { |
| 327 | - /* |
|
| 327 | + /* |
|
| 328 | 328 | * http://stackoverflow.com/questions/3338123/how-do-i-recursively-delete-a-directory-and-its-entire-contents-files-sub-dir |
| 329 | 329 | */ |
| 330 | - function rrmdir($dir) { |
|
| 331 | - if (is_dir($dir)) { |
|
| 332 | - $objects = scandir($dir); |
|
| 333 | - foreach ($objects as $object) { |
|
| 334 | - if ($object != "." && $object != "..") { |
|
| 335 | - if (is_dir($dir."/".$object)) |
|
| 336 | - rrmdir($dir."/".$object); |
|
| 337 | - else |
|
| 338 | - unlink($dir."/".$object); |
|
| 339 | - } |
|
| 340 | - } |
|
| 341 | - rmdir($dir); |
|
| 342 | - } |
|
| 343 | - } |
|
| 330 | + function rrmdir($dir) { |
|
| 331 | + if (is_dir($dir)) { |
|
| 332 | + $objects = scandir($dir); |
|
| 333 | + foreach ($objects as $object) { |
|
| 334 | + if ($object != "." && $object != "..") { |
|
| 335 | + if (is_dir($dir."/".$object)) |
|
| 336 | + rrmdir($dir."/".$object); |
|
| 337 | + else |
|
| 338 | + unlink($dir."/".$object); |
|
| 339 | + } |
|
| 340 | + } |
|
| 341 | + rmdir($dir); |
|
| 342 | + } |
|
| 343 | + } |
|
| 344 | 344 | } |
| 345 | 345 | |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | $newLocation = $pathWithoutName.'/w_'.$width.'_h_'.$height.'_'.$basename; |
| 177 | 177 | if(Storage::exists($newLocation)) { |
| 178 | 178 | return asset($newLocation); |
| 179 | - }else{ |
|
| 179 | + } else{ |
|
| 180 | 180 | $img = Image::make(storage_path($path))->fit($width,$height); |
| 181 | 181 | $img->save(storage_path($newLocation),$quality); |
| 182 | 182 | return asset($newLocation); |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | $settings = file_get_contents(storage_path('.cbconfig')); |
| 224 | 224 | $settings = decrypt($settings); |
| 225 | 225 | $settings = unserialize($settings); |
| 226 | - }else{ |
|
| 226 | + } else{ |
|
| 227 | 227 | $settings = []; |
| 228 | 228 | } |
| 229 | 229 | |
@@ -242,13 +242,13 @@ discard block |
||
| 242 | 242 | $settings = file_get_contents(storage_path('.cbconfig')); |
| 243 | 243 | $settings = decrypt($settings); |
| 244 | 244 | $settings = unserialize($settings); |
| 245 | - }else{ |
|
| 245 | + } else{ |
|
| 246 | 246 | $settings = []; |
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | if(isset($settings[$key])) { |
| 250 | 250 | return $settings[$key]?:$default; |
| 251 | - }else{ |
|
| 251 | + } else{ |
|
| 252 | 252 | return $default; |
| 253 | 253 | } |
| 254 | 254 | } |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | $url = request($name); |
| 335 | 335 | if(filter_var($url, FILTER_VALIDATE_URL)) { |
| 336 | 336 | return $url; |
| 337 | - }else{ |
|
| 337 | + } else{ |
|
| 338 | 338 | return request()->url(); |
| 339 | 339 | } |
| 340 | 340 | } |
@@ -346,14 +346,14 @@ discard block |
||
| 346 | 346 | $response = request($name); |
| 347 | 347 | if(is_string($response)) { |
| 348 | 348 | $response = sanitizeXSS($response); |
| 349 | - }elseif (is_array($response)) { |
|
| 349 | + } elseif (is_array($response)) { |
|
| 350 | 350 | array_walk_recursive($response, function(&$response) { |
| 351 | 351 | $response = sanitizeXSS($response); |
| 352 | 352 | }); |
| 353 | 353 | } |
| 354 | 354 | |
| 355 | 355 | return $response; |
| 356 | - }else{ |
|
| 356 | + } else{ |
|
| 357 | 357 | return Request::get($name); |
| 358 | 358 | } |
| 359 | 359 | } |
@@ -363,11 +363,13 @@ discard block |
||
| 363 | 363 | function min_var_export($input) { |
| 364 | 364 | if(is_array($input)) { |
| 365 | 365 | $buffer = []; |
| 366 | - foreach($input as $key => $value) |
|
| 367 | - $buffer[] = var_export($key, true)."=>".min_var_export($value); |
|
| 366 | + foreach($input as $key => $value) { |
|
| 367 | + $buffer[] = var_export($key, true)."=>".min_var_export($value); |
|
| 368 | + } |
|
| 368 | 369 | return "[".implode(",",$buffer)."]"; |
| 369 | - } else |
|
| 370 | - return var_export($input, true); |
|
| 370 | + } else { |
|
| 371 | + return var_export($input, true); |
|
| 372 | + } |
|
| 371 | 373 | } |
| 372 | 374 | } |
| 373 | 375 | |
@@ -380,10 +382,11 @@ discard block |
||
| 380 | 382 | $objects = scandir($dir); |
| 381 | 383 | foreach ($objects as $object) { |
| 382 | 384 | if ($object != "." && $object != "..") { |
| 383 | - if (is_dir($dir."/".$object)) |
|
| 384 | - rrmdir($dir."/".$object); |
|
| 385 | - else |
|
| 386 | - unlink($dir."/".$object); |
|
| 385 | + if (is_dir($dir."/".$object)) { |
|
| 386 | + rrmdir($dir."/".$object); |
|
| 387 | + } else { |
|
| 388 | + unlink($dir."/".$object); |
|
| 389 | + } |
|
| 387 | 390 | } |
| 388 | 391 | } |
| 389 | 392 | rmdir($dir); |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | | |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | -if(!function_exists("cbLang")) { |
|
| 12 | +if (!function_exists("cbLang")) { |
|
| 13 | 13 | /** |
| 14 | 14 | * @param string $key |
| 15 | 15 | * @param array $replace |
@@ -21,17 +21,17 @@ discard block |
||
| 21 | 21 | } |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | -if(!function_exists('rglob')) { |
|
| 24 | +if (!function_exists('rglob')) { |
|
| 25 | 25 | function rglob($pattern, $flags = 0) { |
| 26 | 26 | $files = glob($pattern, $flags); |
| 27 | - foreach (glob(dirname($pattern).'/*', GLOB_ONLYDIR|GLOB_NOSORT) as $dir) { |
|
| 27 | + foreach (glob(dirname($pattern).'/*', GLOB_ONLYDIR | GLOB_NOSORT) as $dir) { |
|
| 28 | 28 | $files = array_merge($files, rglob($dir.'/'.basename($pattern), $flags)); |
| 29 | 29 | } |
| 30 | 30 | return $files; |
| 31 | 31 | } |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | -if(!function_exists('convertPHPToMomentFormat')) { |
|
| 34 | +if (!function_exists('convertPHPToMomentFormat')) { |
|
| 35 | 35 | function convertPHPToMomentFormat($format) |
| 36 | 36 | { |
| 37 | 37 | $replacements = [ |
@@ -78,13 +78,13 @@ discard block |
||
| 78 | 78 | } |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | -if(!function_exists('slug')) { |
|
| 81 | +if (!function_exists('slug')) { |
|
| 82 | 82 | function slug($string, $separator = '-') { |
| 83 | 83 | return \Illuminate\Support\Str::slug($string, $separator); |
| 84 | 84 | } |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | -if(!function_exists('columnSingleton')) { |
|
| 87 | +if (!function_exists('columnSingleton')) { |
|
| 88 | 88 | /** |
| 89 | 89 | * @return \crocodicstudio\crudbooster\controllers\scaffolding\singletons\ColumnSingleton |
| 90 | 90 | */ |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | } |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | -if(!function_exists('cbHook')) |
|
| 96 | +if (!function_exists('cbHook')) |
|
| 97 | 97 | { |
| 98 | 98 | /** |
| 99 | 99 | * @return crocodicstudio\crudbooster\hooks\CBHook |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | } |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | -if(!function_exists('getTypeHook')) |
|
| 108 | +if (!function_exists('getTypeHook')) |
|
| 109 | 109 | { |
| 110 | 110 | /** |
| 111 | 111 | * @param string $type |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | } |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | -if(!function_exists('getPrimaryKey')) |
|
| 121 | +if (!function_exists('getPrimaryKey')) |
|
| 122 | 122 | { |
| 123 | 123 | function getPrimaryKey($table_name) |
| 124 | 124 | { |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | } |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | -if(!function_exists('cb')) |
|
| 129 | +if (!function_exists('cb')) |
|
| 130 | 130 | { |
| 131 | 131 | function cb() |
| 132 | 132 | { |
@@ -134,25 +134,25 @@ discard block |
||
| 134 | 134 | } |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | -if(!function_exists('cbAsset')) { |
|
| 137 | +if (!function_exists('cbAsset')) { |
|
| 138 | 138 | function cbAsset($path) { |
| 139 | 139 | return asset("cb_asset/".$path); |
| 140 | 140 | } |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | -if(!function_exists("cbConfig")) { |
|
| 143 | +if (!function_exists("cbConfig")) { |
|
| 144 | 144 | function cbConfig($name) { |
| 145 | 145 | return config("crudbooster.".$name); |
| 146 | 146 | } |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | -if(!function_exists("strRandom")) { |
|
| 149 | +if (!function_exists("strRandom")) { |
|
| 150 | 150 | function strRandom($length = 5) { |
| 151 | 151 | return \Illuminate\Support\Str::random($length); |
| 152 | 152 | } |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | -if(!function_exists('module')) { |
|
| 155 | +if (!function_exists('module')) { |
|
| 156 | 156 | function module() |
| 157 | 157 | { |
| 158 | 158 | $module = new \crocodicstudio\crudbooster\helpers\Module(); |
@@ -160,43 +160,43 @@ discard block |
||
| 160 | 160 | } |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | -if(!function_exists('getAdminLoginURL')) { |
|
| 163 | +if (!function_exists('getAdminLoginURL')) { |
|
| 164 | 164 | function getAdminLoginURL() |
| 165 | 165 | { |
| 166 | 166 | return url(config('crudbooster.ADMIN_LOGIN_PATH')); |
| 167 | 167 | } |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | -if(!function_exists('dummyPhoto')) { |
|
| 170 | +if (!function_exists('dummyPhoto')) { |
|
| 171 | 171 | function dummyPhoto() |
| 172 | 172 | { |
| 173 | 173 | return config('crudbooster.DUMMY_PHOTO'); |
| 174 | 174 | } |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | -if(!function_exists('assetThumbnail')) { |
|
| 177 | +if (!function_exists('assetThumbnail')) { |
|
| 178 | 178 | function assetThumbnail($path) { |
| 179 | - $path = str_replace('uploads/','uploads_thumbnail/',$path); |
|
| 179 | + $path = str_replace('uploads/', 'uploads_thumbnail/', $path); |
|
| 180 | 180 | return asset($path); |
| 181 | 181 | } |
| 182 | 182 | } |
| 183 | 183 | |
| 184 | -if(!function_exists('assetResize')) { |
|
| 185 | - function assetResize($path,$width,$height=null,$quality=70) { |
|
| 184 | +if (!function_exists('assetResize')) { |
|
| 185 | + function assetResize($path, $width, $height = null, $quality = 70) { |
|
| 186 | 186 | $basename = basename($path); |
| 187 | 187 | $pathWithoutName = str_replace($basename, '', $path); |
| 188 | 188 | $newLocation = $pathWithoutName.'/w_'.$width.'_h_'.$height.'_'.$basename; |
| 189 | - if(Storage::exists($newLocation)) { |
|
| 189 | + if (Storage::exists($newLocation)) { |
|
| 190 | 190 | return asset($newLocation); |
| 191 | - }else{ |
|
| 192 | - $img = Image::make(storage_path($path))->fit($width,$height); |
|
| 193 | - $img->save(storage_path($newLocation),$quality); |
|
| 191 | + } else { |
|
| 192 | + $img = Image::make(storage_path($path))->fit($width, $height); |
|
| 193 | + $img->save(storage_path($newLocation), $quality); |
|
| 194 | 194 | return asset($newLocation); |
| 195 | 195 | } |
| 196 | 196 | } |
| 197 | 197 | } |
| 198 | 198 | |
| 199 | -if(!function_exists('extract_unit')) { |
|
| 199 | +if (!function_exists('extract_unit')) { |
|
| 200 | 200 | /* |
| 201 | 201 | Credits: Bit Repository |
| 202 | 202 | URL: http://www.bitrepository.com/extract-content-between-two-delimiters-with-php.html |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | |
| 217 | -if(!function_exists('now')) { |
|
| 217 | +if (!function_exists('now')) { |
|
| 218 | 218 | function now() { |
| 219 | 219 | return date('Y-m-d H:i:s'); |
| 220 | 220 | } |
@@ -228,14 +228,14 @@ discard block |
||
| 228 | 228 | | |
| 229 | 229 | */ |
| 230 | 230 | |
| 231 | -if(!function_exists('putSetting')) { |
|
| 231 | +if (!function_exists('putSetting')) { |
|
| 232 | 232 | function putSetting($key, $value) |
| 233 | 233 | { |
| 234 | - if(file_exists(storage_path('.cbconfig'))) { |
|
| 234 | + if (file_exists(storage_path('.cbconfig'))) { |
|
| 235 | 235 | $settings = file_get_contents(storage_path('.cbconfig')); |
| 236 | 236 | $settings = decrypt($settings); |
| 237 | 237 | $settings = unserialize($settings); |
| 238 | - }else{ |
|
| 238 | + } else { |
|
| 239 | 239 | $settings = []; |
| 240 | 240 | } |
| 241 | 241 | |
@@ -247,26 +247,26 @@ discard block |
||
| 247 | 247 | } |
| 248 | 248 | } |
| 249 | 249 | |
| 250 | -if(!function_exists('getSetting')) { |
|
| 250 | +if (!function_exists('getSetting')) { |
|
| 251 | 251 | function getSetting($key, $default = null) |
| 252 | 252 | { |
| 253 | - if(file_exists(storage_path('.cbconfig'))) { |
|
| 253 | + if (file_exists(storage_path('.cbconfig'))) { |
|
| 254 | 254 | $settings = file_get_contents(storage_path('.cbconfig')); |
| 255 | 255 | $settings = decrypt($settings); |
| 256 | 256 | $settings = unserialize($settings); |
| 257 | - }else{ |
|
| 257 | + } else { |
|
| 258 | 258 | $settings = []; |
| 259 | 259 | } |
| 260 | 260 | |
| 261 | - if(isset($settings[$key])) { |
|
| 262 | - return $settings[$key]?:$default; |
|
| 263 | - }else{ |
|
| 261 | + if (isset($settings[$key])) { |
|
| 262 | + return $settings[$key] ?: $default; |
|
| 263 | + } else { |
|
| 264 | 264 | return $default; |
| 265 | 265 | } |
| 266 | 266 | } |
| 267 | 267 | } |
| 268 | 268 | |
| 269 | -if(!function_exists('timeAgo')) { |
|
| 269 | +if (!function_exists('timeAgo')) { |
|
| 270 | 270 | function timeAgo($datetime_to, $datetime_from = null, $full = false) |
| 271 | 271 | { |
| 272 | 272 | $datetime_from = ($datetime_from) ?: date('Y-m-d H:i:s'); |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | } |
| 298 | 298 | } |
| 299 | 299 | |
| 300 | - if (! $full) { |
|
| 300 | + if (!$full) { |
|
| 301 | 301 | $string = array_slice($string, 0, 1); |
| 302 | 302 | } |
| 303 | 303 | |
@@ -305,22 +305,22 @@ discard block |
||
| 305 | 305 | } |
| 306 | 306 | } |
| 307 | 307 | |
| 308 | -if(!function_exists("array_map_r")) { |
|
| 309 | - function array_map_r( $func, $arr ) |
|
| 308 | +if (!function_exists("array_map_r")) { |
|
| 309 | + function array_map_r($func, $arr) |
|
| 310 | 310 | { |
| 311 | 311 | $newArr = array(); |
| 312 | 312 | |
| 313 | - foreach( $arr as $key => $value ) |
|
| 313 | + foreach ($arr as $key => $value) |
|
| 314 | 314 | { |
| 315 | 315 | $key = $func($key); |
| 316 | - $newArr[ $key ] = ( is_array( $value ) ? array_map_r( $func, $value ) : ( is_array($func) ? call_user_func_array($func, $value) : $func( $value ) ) ); |
|
| 316 | + $newArr[$key] = (is_array($value) ? array_map_r($func, $value) : (is_array($func) ? call_user_func_array($func, $value) : $func($value))); |
|
| 317 | 317 | } |
| 318 | 318 | |
| 319 | 319 | return $newArr; |
| 320 | 320 | } |
| 321 | 321 | } |
| 322 | 322 | |
| 323 | -if(!function_exists("sanitizeXSS")) |
|
| 323 | +if (!function_exists("sanitizeXSS")) |
|
| 324 | 324 | { |
| 325 | 325 | function sanitizeXSS($value) |
| 326 | 326 | { |
@@ -332,7 +332,7 @@ discard block |
||
| 332 | 332 | } |
| 333 | 333 | } |
| 334 | 334 | |
| 335 | -if(!function_exists("requestAll")) { |
|
| 335 | +if (!function_exists("requestAll")) { |
|
| 336 | 336 | function requestAll() { |
| 337 | 337 | $all = array_map_r("sanitizeXSS", request()->all()); |
| 338 | 338 | return $all; |
@@ -341,22 +341,22 @@ discard block |
||
| 341 | 341 | |
| 342 | 342 | |
| 343 | 343 | |
| 344 | -if(!function_exists('getURLFormat')) { |
|
| 344 | +if (!function_exists('getURLFormat')) { |
|
| 345 | 345 | function getURLFormat($name) { |
| 346 | 346 | $url = request($name); |
| 347 | - if(filter_var($url, FILTER_VALIDATE_URL)) { |
|
| 347 | + if (filter_var($url, FILTER_VALIDATE_URL)) { |
|
| 348 | 348 | return $url; |
| 349 | - }else{ |
|
| 349 | + } else { |
|
| 350 | 350 | return request()->url(); |
| 351 | 351 | } |
| 352 | 352 | } |
| 353 | 353 | } |
| 354 | 354 | |
| 355 | -if(!function_exists('g')) { |
|
| 355 | +if (!function_exists('g')) { |
|
| 356 | 356 | function g($name, $safe = true) { |
| 357 | - if($safe == true) { |
|
| 357 | + if ($safe == true) { |
|
| 358 | 358 | $response = request($name); |
| 359 | - if(is_string($response)) { |
|
| 359 | + if (is_string($response)) { |
|
| 360 | 360 | $response = sanitizeXSS($response); |
| 361 | 361 | }elseif (is_array($response)) { |
| 362 | 362 | array_walk_recursive($response, function(&$response) { |
@@ -365,25 +365,25 @@ discard block |
||
| 365 | 365 | } |
| 366 | 366 | |
| 367 | 367 | return $response; |
| 368 | - }else{ |
|
| 368 | + } else { |
|
| 369 | 369 | return Request::get($name); |
| 370 | 370 | } |
| 371 | 371 | } |
| 372 | 372 | } |
| 373 | 373 | |
| 374 | -if(!function_exists('min_var_export')) { |
|
| 374 | +if (!function_exists('min_var_export')) { |
|
| 375 | 375 | function min_var_export($input) { |
| 376 | - if(is_array($input)) { |
|
| 376 | + if (is_array($input)) { |
|
| 377 | 377 | $buffer = []; |
| 378 | - foreach($input as $key => $value) |
|
| 378 | + foreach ($input as $key => $value) |
|
| 379 | 379 | $buffer[] = var_export($key, true)."=>".min_var_export($value); |
| 380 | - return "[".implode(",",$buffer)."]"; |
|
| 380 | + return "[".implode(",", $buffer)."]"; |
|
| 381 | 381 | } else |
| 382 | 382 | return var_export($input, true); |
| 383 | 383 | } |
| 384 | 384 | } |
| 385 | 385 | |
| 386 | -if(!function_exists('rrmdir')) { |
|
| 386 | +if (!function_exists('rrmdir')) { |
|
| 387 | 387 | /* |
| 388 | 388 | * http://stackoverflow.com/questions/3338123/how-do-i-recursively-delete-a-directory-and-its-entire-contents-files-sub-dir |
| 389 | 389 | */ |
@@ -41,7 +41,7 @@ |
||
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | public function send() { |
| 44 | - Mail::send("crudbooster::emails.blank", ['content' => $this->content], function ($message) { |
|
| 44 | + Mail::send("crudbooster::emails.blank", ['content' => $this->content], function($message) { |
|
| 45 | 45 | $message->priority(1); |
| 46 | 46 | $message->to($this->to_email); |
| 47 | 47 | $message->from($this->sender_email, $this->sender_name); |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | class CheckboxHelper |
| 12 | 12 | { |
| 13 | 13 | public static function parseValuesToArray($values) { |
| 14 | - $data = explode(";",$values); |
|
| 14 | + $data = explode(";", $values); |
|
| 15 | 15 | return $data; |
| 16 | 16 | } |
| 17 | 17 | |
@@ -1,12 +1,12 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -\Validator::extend('alpha_spaces', function ($attribute, $value) { |
|
| 3 | +\Validator::extend('alpha_spaces', function($attribute, $value) { |
|
| 4 | 4 | // This will only accept alpha and spaces. |
| 5 | 5 | // If you want to accept hyphens use: /^[\pL\s-]+$/u. |
| 6 | 6 | return preg_match('/^[\pL\s]+$/u', $value); |
| 7 | 7 | },'The :attribute should be letters and spaces only'); |
| 8 | 8 | |
| 9 | -\Validator::extend('alpha_num_spaces', function ($attribute, $value) { |
|
| 9 | +\Validator::extend('alpha_num_spaces', function($attribute, $value) { |
|
| 10 | 10 | // This will only accept alphanumeric and spaces. |
| 11 | 11 | return preg_match('/^[a-zA-Z0-9\s]+$/', $value); |
| 12 | 12 | },'The :attribute should be alphanumeric characters and spaces only'); |
| 13 | 13 | \ No newline at end of file |
@@ -18,8 +18,8 @@ |
||
| 18 | 18 | public function handle($request, Closure $next) |
| 19 | 19 | { |
| 20 | 20 | |
| 21 | - if(!session()->has("developer")) { |
|
| 22 | - return cb()->redirect(cb()->getDeveloperUrl("login"),"Please login for first"); |
|
| 21 | + if (!session()->has("developer")) { |
|
| 22 | + return cb()->redirect(cb()->getDeveloperUrl("login"), "Please login for first"); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | return $next($request); |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | */ |
| 13 | 13 | public function up() |
| 14 | 14 | { |
| 15 | - Schema::table('users', function (Blueprint $table) { |
|
| 15 | + Schema::table('users', function(Blueprint $table) { |
|
| 16 | 16 | $table->string('photo')->nullable(); |
| 17 | 17 | $table->integer('cb_roles_id'); |
| 18 | 18 | }); |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | public function down() |
| 27 | 27 | { |
| 28 | - Schema::table('users', function (Blueprint $table) { |
|
| 28 | + Schema::table('users', function(Blueprint $table) { |
|
| 29 | 29 | $table->dropColumn('cb_roles_id'); |
| 30 | 30 | $table->dropColumn('photo'); |
| 31 | 31 | }); |
@@ -4,7 +4,7 @@ |
||
| 4 | 4 | interface CBHook { |
| 5 | 5 | |
| 6 | 6 | public function hookGetLogin(); |
| 7 | - public function hookPostLogin(); |
|
| 8 | - public function beforeBackendMiddleware($request); |
|
| 7 | + public function hookPostLogin(); |
|
| 8 | + public function beforeBackendMiddleware($request); |
|
| 9 | 9 | public function afterBackendMiddleware($request, $response); |
| 10 | 10 | } |
| 11 | 11 | \ No newline at end of file |