@@ -11,13 +11,13 @@ |
||
| 11 | 11 | |
| 12 | 12 | public function handle(Request $request, Closure $next) |
| 13 | 13 | { |
| 14 | - $cookiesAlreadySet = $request->hasCookie(strtolower(config('app.name')).'_session') || $request->hasCookie('XSRF-TOKEN'); |
|
| 14 | + $cookiesAlreadySet = $request->hasCookie(strtolower(config('app.name')) . '_session') || $request->hasCookie('XSRF-TOKEN'); |
|
| 15 | 15 | |
| 16 | 16 | if ($cookiesAlreadySet) { |
| 17 | 17 | return $next($request); |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | - Cookie::queue(Cookie::forget(str_replace(' ', '_', strtolower(config('app.name')).'_session'))); |
|
| 20 | + Cookie::queue(Cookie::forget(str_replace(' ', '_', strtolower(config('app.name')) . '_session'))); |
|
| 21 | 21 | Cookie::queue(Cookie::forget('XSRF-TOKEN')); |
| 22 | 22 | config(['session.driver' => 'array']); |
| 23 | 23 | |
@@ -65,7 +65,7 @@ |
||
| 65 | 65 | 'text', |
| 66 | 66 | ]; |
| 67 | 67 | |
| 68 | - $sorted = $linkTypes->sortBy(function ($item) use ($custom_order) { |
|
| 68 | + $sorted = $linkTypes->sortBy(function($item) use ($custom_order) { |
|
| 69 | 69 | $index = array_search($item->typename, $custom_order); |
| 70 | 70 | return $index !== false ? $index : count($custom_order); |
| 71 | 71 | }); |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | |
| 48 | 48 | function analyzeImageBrightness($file) { |
| 49 | 49 | try { |
| 50 | - $file = base_path('assets/img/background-img/'.$file); |
|
| 50 | + $file = base_path('assets/img/background-img/' . $file); |
|
| 51 | 51 | |
| 52 | 52 | // Get image information using getimagesize |
| 53 | 53 | $imageInfo = getimagesize($file); |
@@ -77,8 +77,8 @@ discard block |
||
| 77 | 77 | |
| 78 | 78 | // Calculate the average brightness of the image |
| 79 | 79 | $total_brightness = 0; |
| 80 | - for ($x=0; $x<$width; $x++) { |
|
| 81 | - for ($y=0; $y<$height; $y++) { |
|
| 80 | + for ($x = 0; $x < $width; $x++) { |
|
| 81 | + for ($y = 0; $y < $height; $y++) { |
|
| 82 | 82 | $rgb = imagecolorat($img, $x, $y); |
| 83 | 83 | $r = ($rgb >> 16) & 0xFF; |
| 84 | 84 | $g = ($rgb >> 8) & 0xFF; |
@@ -132,10 +132,10 @@ discard block |
||
| 132 | 132 | function footer($key) |
| 133 | 133 | { |
| 134 | 134 | $upperStr = strtoupper($key); |
| 135 | - if (env('TITLE_FOOTER_'.$upperStr) == "") { |
|
| 136 | - $title = __('messages.footer.'.$key); |
|
| 135 | + if (env('TITLE_FOOTER_' . $upperStr) == "") { |
|
| 136 | + $title = __('messages.footer.' . $key); |
|
| 137 | 137 | } else { |
| 138 | - $title = env('TITLE_FOOTER_'.$upperStr); |
|
| 138 | + $title = env('TITLE_FOOTER_' . $upperStr); |
|
| 139 | 139 | } |
| 140 | 140 | return $title; |
| 141 | 141 | } |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | return $str; |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | -if(!function_exists('setBlockAssetContext')) { |
|
| 155 | +if (!function_exists('setBlockAssetContext')) { |
|
| 156 | 156 | function setBlockAssetContext($type = null) { |
| 157 | 157 | static $currentType = null; |
| 158 | 158 | if ($type !== null) { |
@@ -163,14 +163,14 @@ discard block |
||
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | // Get custom block assets |
| 166 | -if(!function_exists('block_asset')) { |
|
| 166 | +if (!function_exists('block_asset')) { |
|
| 167 | 167 | function block_asset($file) { |
| 168 | 168 | $type = setBlockAssetContext(); // Retrieve the current type context |
| 169 | 169 | return url("block-asset/$type?asset=$file"); |
| 170 | 170 | } |
| 171 | 171 | } |
| 172 | 172 | |
| 173 | -if(!function_exists('get_block_file_contents')) { |
|
| 173 | +if (!function_exists('get_block_file_contents')) { |
|
| 174 | 174 | function get_block_file_contents($file) { |
| 175 | 175 | $type = setBlockAssetContext(); // Retrieve the current type context |
| 176 | 176 | return file_get_contents(base_path("blocks/$type/$file")); |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | //Show littlelink page. example => http://127.0.0.1:8000/+admin |
| 85 | 85 | public function littlelink(request $request) |
| 86 | 86 | { |
| 87 | - if(isset($request->useif)){ |
|
| 87 | + if (isset($request->useif)) { |
|
| 88 | 88 | $littlelink_name = User::select('littlelink_name')->where('id', $request->littlelink)->value('littlelink_name'); |
| 89 | 89 | $id = $request->littlelink; |
| 90 | 90 | } else { |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | return abort(404); |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | - return redirect(url('@'.$user)); |
|
| 163 | + return redirect(url('@' . $user)); |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | //Show add/update form |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | $LinkURL = $request->link; |
| 196 | 196 | |
| 197 | 197 | // Step 3: Load Link Type Logic |
| 198 | - if($request->typename == 'predefined' || $request->typename == 'link') { |
|
| 198 | + if ($request->typename == 'predefined' || $request->typename == 'link') { |
|
| 199 | 199 | // Determine button id based on whether a custom or predefined button is used |
| 200 | 200 | $button_id = ($request->typename == 'link') ? ($request->GetSiteIcon == 1 ? 2 : 1) : null; |
| 201 | 201 | $button = ($request->typename != 'link') ? Button::where('name', $request->button)->first() : null; |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | |
| 249 | 249 | if ($OrigLink) { |
| 250 | 250 | $currentValues = $OrigLink->getAttributes(); |
| 251 | - $nonNullFilteredLinkData = array_filter($filteredLinkData, function($value) {return !is_null($value);}); |
|
| 251 | + $nonNullFilteredLinkData = array_filter($filteredLinkData, function($value) {return !is_null($value); }); |
|
| 252 | 252 | $updatedValues = array_merge($currentValues, $nonNullFilteredLinkData); |
| 253 | 253 | $OrigLink->update($updatedValues); |
| 254 | 254 | $message = "Link updated"; |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | |
| 311 | 311 | if (substr($linkId, -1) == '+') { |
| 312 | 312 | $linkWithoutPlus = str_replace('+', '', $linkId); |
| 313 | - return redirect(url('info/'.$linkWithoutPlus)); |
|
| 313 | + return redirect(url('info/' . $linkWithoutPlus)); |
|
| 314 | 314 | } |
| 315 | 315 | |
| 316 | 316 | $link = Link::find($linkId); |
@@ -401,11 +401,11 @@ discard block |
||
| 401 | 401 | |
| 402 | 402 | $directory = base_path("assets/favicon/icons"); |
| 403 | 403 | $files = scandir($directory); |
| 404 | - foreach($files as $file) { |
|
| 405 | - if (strpos($file, $linkId.".") !== false) { |
|
| 406 | - $pathinfo = pathinfo($file, PATHINFO_EXTENSION);}} |
|
| 404 | + foreach ($files as $file) { |
|
| 405 | + if (strpos($file, $linkId . ".") !== false) { |
|
| 406 | + $pathinfo = pathinfo($file, PATHINFO_EXTENSION); }} |
|
| 407 | 407 | if (isset($pathinfo)) { |
| 408 | - try{File::delete(base_path("assets/favicon/icons")."/".$linkId.".".$pathinfo);} catch (exception $e) {} |
|
| 408 | + try {File::delete(base_path("assets/favicon/icons") . "/" . $linkId . "." . $pathinfo); } catch (exception $e) {} |
|
| 409 | 409 | } |
| 410 | 410 | |
| 411 | 411 | return redirect('/studio/links'); |
@@ -418,11 +418,11 @@ discard block |
||
| 418 | 418 | |
| 419 | 419 | $directory = base_path("assets/favicon/icons"); |
| 420 | 420 | $files = scandir($directory); |
| 421 | - foreach($files as $file) { |
|
| 422 | - if (strpos($file, $linkId.".") !== false) { |
|
| 423 | - $pathinfo = pathinfo($file, PATHINFO_EXTENSION);}} |
|
| 421 | + foreach ($files as $file) { |
|
| 422 | + if (strpos($file, $linkId . ".") !== false) { |
|
| 423 | + $pathinfo = pathinfo($file, PATHINFO_EXTENSION); }} |
|
| 424 | 424 | if (isset($pathinfo)) { |
| 425 | - try{File::delete(base_path("assets/favicon/icons")."/".$linkId.".".$pathinfo);} catch (exception $e) {} |
|
| 425 | + try {File::delete(base_path("assets/favicon/icons") . "/" . $linkId . "." . $pathinfo); } catch (exception $e) {} |
|
| 426 | 426 | } |
| 427 | 427 | |
| 428 | 428 | return redirect('/studio/links'); |
@@ -546,7 +546,7 @@ discard block |
||
| 546 | 546 | 'sometimes', |
| 547 | 547 | 'max:255', |
| 548 | 548 | 'string', |
| 549 | - 'isunique:users,id,'.$userId, |
|
| 549 | + 'isunique:users,id,' . $userId, |
|
| 550 | 550 | ], |
| 551 | 551 | 'name' => 'sometimes|max:255|string', |
| 552 | 552 | 'image' => 'sometimes|image|mimes:jpeg,jpg,png,webp|max:2048', // Max file size: 2MB |
@@ -571,7 +571,7 @@ discard block |
||
| 571 | 571 | $sharebtn = $request->sharebtn; |
| 572 | 572 | $tablinks = $request->tablinks; |
| 573 | 573 | |
| 574 | - if(env('HOME_URL') !== '' && $pageName != $littlelink_name && $littlelink_name == env('HOME_URL')){ |
|
| 574 | + if (env('HOME_URL') !== '' && $pageName != $littlelink_name && $littlelink_name == env('HOME_URL')) { |
|
| 575 | 575 | EnvEditor::editKey('HOME_URL', $pageName); |
| 576 | 576 | } |
| 577 | 577 | |
@@ -805,7 +805,7 @@ discard block |
||
| 805 | 805 | // echo Auth::id(); |
| 806 | 806 | $id = $request->id; |
| 807 | 807 | |
| 808 | - if($id == Auth::id() and $id != "1") { |
|
| 808 | + if ($id == Auth::id() and $id != "1") { |
|
| 809 | 809 | |
| 810 | 810 | Link::where('user_id', $id)->delete(); |
| 811 | 811 | |
@@ -852,7 +852,7 @@ discard block |
||
| 852 | 852 | $fileName = "links-$domain-$date.json"; |
| 853 | 853 | $headers = [ |
| 854 | 854 | 'Content-Type' => 'application/json', |
| 855 | - 'Content-Disposition' => 'attachment; filename="'.$fileName.'"', |
|
| 855 | + 'Content-Disposition' => 'attachment; filename="' . $fileName . '"', |
|
| 856 | 856 | ]; |
| 857 | 857 | return response()->json($userData, 200, $headers); |
| 858 | 858 | |
@@ -874,7 +874,7 @@ discard block |
||
| 874 | 874 | $userData = $user->toArray(); |
| 875 | 875 | $userData['links'] = $links->toArray(); |
| 876 | 876 | |
| 877 | - if (file_exists(base_path(findAvatar($userId)))){ |
|
| 877 | + if (file_exists(base_path(findAvatar($userId)))) { |
|
| 878 | 878 | $imagePath = base_path(findAvatar($userId)); |
| 879 | 879 | $imageData = base64_encode(file_get_contents($imagePath)); |
| 880 | 880 | $userData['image_data'] = $imageData; |
@@ -888,7 +888,7 @@ discard block |
||
| 888 | 888 | $fileName = "user_data-$domain-$date.json"; |
| 889 | 889 | $headers = [ |
| 890 | 890 | 'Content-Type' => 'application/json', |
| 891 | - 'Content-Disposition' => 'attachment; filename="'.$fileName.'"', |
|
| 891 | + 'Content-Disposition' => 'attachment; filename="' . $fileName . '"', |
|
| 892 | 892 | ]; |
| 893 | 893 | return response()->json($userData, 200, $headers); |
| 894 | 894 | |