@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | Column::make(__('messages.Page'), "littlelink_name") |
| 40 | 40 | ->sortable() |
| 41 | 41 | ->searchable() |
| 42 | - ->format(function ($value, $row, Column $column) { |
|
| 42 | + ->format(function($value, $row, Column $column) { |
|
| 43 | 43 | if (!$row->littlelink_name == NULL) { |
| 44 | 44 | return "<a href='" . url('') . "/@" . htmlspecialchars($row->littlelink_name) . "' target='_blank' class='text-info'><i class='bi bi-box-arrow-up-right'></i> " . htmlspecialchars($row->littlelink_name) . " </a>"; |
| 45 | 45 | } else { |
@@ -51,23 +51,23 @@ discard block |
||
| 51 | 51 | ->sortable() |
| 52 | 52 | ->searchable(), |
| 53 | 53 | Column::make(__('messages.Links'), "id") |
| 54 | - ->format(function ($value, $row) { |
|
| 54 | + ->format(function($value, $row) { |
|
| 55 | 55 | $linkCount = Link::where('user_id', $row->id)->count(); |
| 56 | 56 | return $linkCount; |
| 57 | 57 | }), |
| 58 | 58 | Column::make(__('messages.Clicks'), "id") |
| 59 | - ->format(function ($value, $row) { |
|
| 59 | + ->format(function($value, $row) { |
|
| 60 | 60 | $clicksSum = Link::where('user_id', $row->id)->sum('click_number'); |
| 61 | 61 | return $clicksSum; |
| 62 | 62 | }), |
| 63 | 63 | Column::make(__('messages.E-Mail'), "email_verified_at") |
| 64 | 64 | ->sortable() |
| 65 | - ->format(function ($value, $row, Column $column) { |
|
| 65 | + ->format(function($value, $row, Column $column) { |
|
| 66 | 66 | if (env('REGISTER_AUTH') !== 'auth') { |
| 67 | 67 | if ($row->role == 'admin' && $row->email_verified_at != '') { |
| 68 | 68 | return '<div class="text-center">-</div>'; |
| 69 | 69 | } else { |
| 70 | - if($row->email_verified_at == ''){ |
|
| 70 | + if ($row->email_verified_at == '') { |
|
| 71 | 71 | $verifyLinkBool = 'true'; |
| 72 | 72 | } else { |
| 73 | 73 | $verifyLinkBool = 'false'; |
@@ -77,9 +77,9 @@ discard block |
||
| 77 | 77 | 'id' => $row->id |
| 78 | 78 | ]); |
| 79 | 79 | if ($row->email_verified_at == '') { |
| 80 | - return '<div class="text-center"><a style="cursor:pointer" data-id="'.$verifyLink.'" class="user-email text-danger"><span class="badge bg-danger">' . __('messages.Pending') . '</span></a></div>'; |
|
| 80 | + return '<div class="text-center"><a style="cursor:pointer" data-id="' . $verifyLink . '" class="user-email text-danger"><span class="badge bg-danger">' . __('messages.Pending') . '</span></a></div>'; |
|
| 81 | 81 | } else { |
| 82 | - return '<div class="text-center"><a style="cursor:pointer" data-id="'.$verifyLink.'" class="user-email text-danger"><span class="badge bg-success">' . __('messages.Verified') . '</span></a></div>'; |
|
| 82 | + return '<div class="text-center"><a style="cursor:pointer" data-id="' . $verifyLink . '" class="user-email text-danger"><span class="badge bg-success">' . __('messages.Verified') . '</span></a></div>'; |
|
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | 85 | } else { |
@@ -89,15 +89,15 @@ discard block |
||
| 89 | 89 | })->html(), |
| 90 | 90 | Column::make(__('messages.Status'), "block") |
| 91 | 91 | ->sortable() |
| 92 | - ->format(function ($value, $row, Column $column) { |
|
| 92 | + ->format(function($value, $row, Column $column) { |
|
| 93 | 93 | if ($row->role === 'admin' && $row->id === 1) { |
| 94 | 94 | return '<div class="text-center">-</div>'; |
| 95 | 95 | } else { |
| 96 | 96 | $route = route('blockUser', ['block' => $row->block, 'id' => $row->id]); |
| 97 | 97 | if ($row->block === 'yes') { |
| 98 | - $badge = '<div class="text-center"><a style="cursor:pointer" data-id="'.$route.'" class="user-block text-danger"><span class="badge bg-danger">'.__('messages.Pending').'</span></a></div>'; |
|
| 98 | + $badge = '<div class="text-center"><a style="cursor:pointer" data-id="' . $route . '" class="user-block text-danger"><span class="badge bg-danger">' . __('messages.Pending') . '</span></a></div>'; |
|
| 99 | 99 | } elseif ($row->block === 'no') { |
| 100 | - $badge = '<div class="text-center"><a style="cursor:pointer" data-id="'.$route.'" class="user-block text-danger"><span class="badge bg-success">'.__('messages.Approved').'</span></a></div>'; |
|
| 100 | + $badge = '<div class="text-center"><a style="cursor:pointer" data-id="' . $route . '" class="user-block text-danger"><span class="badge bg-success">' . __('messages.Approved') . '</span></a></div>'; |
|
| 101 | 101 | } |
| 102 | 102 | return "<a href=\"$route\">$badge</a>"; |
| 103 | 103 | } |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | ->html(), |
| 106 | 106 | Column::make(__('messages.Created at'), "created_at") |
| 107 | 107 | ->sortable() |
| 108 | - ->format(function ($value) { |
|
| 108 | + ->format(function($value) { |
|
| 109 | 109 | if ($value) { |
| 110 | 110 | return $value->format('d/m/y'); |
| 111 | 111 | } else { |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | }), |
| 115 | 115 | Column::make(__('messages.Last seen'), "updated_at") |
| 116 | 116 | ->sortable() |
| 117 | - ->format(function ($value) { |
|
| 117 | + ->format(function($value) { |
|
| 118 | 118 | $now = now(); |
| 119 | 119 | $diff = $now->diff($value); |
| 120 | 120 | |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | } |
| 130 | 130 | }), |
| 131 | 131 | Column::make(__('messages.Action'), "id") |
| 132 | - ->format(function ($value, $row, Column $column) { |
|
| 132 | + ->format(function($value, $row, Column $column) { |
|
| 133 | 133 | return view('components.table-components.action', ['user' => $row]); |
| 134 | 134 | }), |
| 135 | 135 | ]; |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | public function boot() |
| 28 | 28 | { |
| 29 | 29 | Paginator::useBootstrap(); |
| 30 | - Validator::extend('isunique', function ($attribute, $value, $parameters, $validator) { |
|
| 30 | + Validator::extend('isunique', function($attribute, $value, $parameters, $validator) { |
|
| 31 | 31 | $value = strtolower($value); |
| 32 | 32 | $query = DB::table($parameters[0])->whereRaw("LOWER({$attribute}) = ?", [$value]); |
| 33 | 33 | |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | return $query->count() === 0; |
| 39 | 39 | }); |
| 40 | - Validator::extend('exturl', function ($attribute, $value, $parameters, $validator) { |
|
| 40 | + Validator::extend('exturl', function($attribute, $value, $parameters, $validator) { |
|
| 41 | 41 | $allowed_schemes = ['http', 'https', 'mailto', 'tel']; |
| 42 | 42 | return in_array(parse_url($value, PHP_URL_SCHEME), $allowed_schemes, true); |
| 43 | 43 | }); |
@@ -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 | }); |
@@ -221,7 +221,9 @@ discard block |
||
| 221 | 221 | // Step 5: User and Button Information |
| 222 | 222 | $userId = Auth::user()->id; |
| 223 | 223 | $button = Button::where('name', $request->button)->first(); |
| 224 | - if ($button && empty($LinkTitle)) $LinkTitle = $button->alt; |
|
| 224 | + if ($button && empty($LinkTitle)) { |
|
| 225 | + $LinkTitle = $button->alt; |
|
| 226 | + } |
|
| 225 | 227 | |
| 226 | 228 | // Step 6: Prepare Link Data |
| 227 | 229 | // (Handled by the included file) |
@@ -484,14 +486,16 @@ discard block |
||
| 484 | 486 | 'button' => 'required', |
| 485 | 487 | ]); |
| 486 | 488 | |
| 487 | - if (stringStartsWith($request->link, 'http://') == 'true' or stringStartsWith($request->link, 'https://') == 'true' or stringStartsWith($request->link, 'mailto:') == 'true') |
|
| 488 | - $link1 = $request->link; |
|
| 489 | - else |
|
| 490 | - $link1 = 'https://' . $request->link; |
|
| 491 | - if (stringEndsWith($request->link, '/') == 'true') |
|
| 492 | - $link = rtrim($link1, "/ "); |
|
| 493 | - else |
|
| 494 | - $link = $link1; |
|
| 489 | + if (stringStartsWith($request->link, 'http://') == 'true' or stringStartsWith($request->link, 'https://') == 'true' or stringStartsWith($request->link, 'mailto:') == 'true') { |
|
| 490 | + $link1 = $request->link; |
|
| 491 | + } else { |
|
| 492 | + $link1 = 'https://' . $request->link; |
|
| 493 | + } |
|
| 494 | + if (stringEndsWith($request->link, '/') == 'true') { |
|
| 495 | + $link = rtrim($link1, "/ "); |
|
| 496 | + } else { |
|
| 497 | + $link = $link1; |
|
| 498 | + } |
|
| 495 | 499 | $title = $request->title; |
| 496 | 500 | $order = $request->order; |
| 497 | 501 | $button = $request->button; |
@@ -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 | |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | // Get image information using getimagesize |
| 53 | 53 | $imageInfo = getimagesize($file); |
| 54 | 54 | if (!$imageInfo) { |
| 55 | - return 'dark'; |
|
| 55 | + return 'dark'; |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | // Get the image type |
@@ -60,14 +60,14 @@ discard block |
||
| 60 | 60 | |
| 61 | 61 | // Load the image based on its type |
| 62 | 62 | switch ($type) { |
| 63 | - case IMAGETYPE_JPEG: |
|
| 63 | + case IMAGETYPE_JPEG: |
|
| 64 | 64 | case IMAGETYPE_JPEG2000: |
| 65 | 65 | $img = imagecreatefromjpeg($file); |
| 66 | 66 | break; |
| 67 | - case IMAGETYPE_PNG: |
|
| 67 | + case IMAGETYPE_PNG: |
|
| 68 | 68 | $img = imagecreatefrompng($file); |
| 69 | 69 | break; |
| 70 | - default: |
|
| 70 | + default: |
|
| 71 | 71 | return 'dark'; |
| 72 | 72 | } |
| 73 | 73 | |
@@ -78,29 +78,29 @@ discard block |
||
| 78 | 78 | // Calculate the average brightness of the image |
| 79 | 79 | $total_brightness = 0; |
| 80 | 80 | for ($x=0; $x<$width; $x++) { |
| 81 | - for ($y=0; $y<$height; $y++) { |
|
| 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; |
| 85 | 85 | $b = $rgb & 0xFF; |
| 86 | 86 | $brightness = (int)(($r + $g + $b) / 3); |
| 87 | 87 | $total_brightness += $brightness; |
| 88 | - } |
|
| 88 | + } |
|
| 89 | 89 | } |
| 90 | 90 | $avg_brightness = $total_brightness / ($width * $height); |
| 91 | 91 | |
| 92 | 92 | // Determine if the image is more dark or light |
| 93 | 93 | if ($avg_brightness < 128) { |
| 94 | - return 'dark'; |
|
| 94 | + return 'dark'; |
|
| 95 | 95 | } else { |
| 96 | - return 'light'; |
|
| 96 | + return 'light'; |
|
| 97 | + } |
|
| 98 | + } catch (\Throwable $th) { |
|
| 99 | + return null; |
|
| 100 | + } |
|
| 97 | 101 | } |
| 98 | - } catch (\Throwable $th) { |
|
| 99 | - return null; |
|
| 100 | - } |
|
| 101 | - } |
|
| 102 | 102 | |
| 103 | - function infoIcon($tip) { |
|
| 103 | + function infoIcon($tip) { |
|
| 104 | 104 | echo ' |
| 105 | 105 | <div class="d-flex justify-content-center align-items-center"> |
| 106 | 106 | <a data-bs-toggle="tooltip" data-bs-placement="bottom" title="' . $tip . '"> |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | </a> |
| 111 | 111 | </div> |
| 112 | 112 | '; |
| 113 | - } |
|
| 113 | + } |
|
| 114 | 114 | |
| 115 | 115 | function external_file_get_contents($url) { |
| 116 | 116 | $ch = curl_init(); |
@@ -153,43 +153,43 @@ discard block |
||
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | if(!function_exists('setBlockAssetContext')) { |
| 156 | - function setBlockAssetContext($type = null) { |
|
| 157 | - static $currentType = null; |
|
| 158 | - if ($type !== null) { |
|
| 159 | - $currentType = $type; |
|
| 160 | - } |
|
| 161 | - return $currentType; |
|
| 162 | - } |
|
| 156 | + function setBlockAssetContext($type = null) { |
|
| 157 | + static $currentType = null; |
|
| 158 | + if ($type !== null) { |
|
| 159 | + $currentType = $type; |
|
| 160 | + } |
|
| 161 | + return $currentType; |
|
| 162 | + } |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | // Get custom block assets |
| 166 | 166 | if(!function_exists('block_asset')) { |
| 167 | - function block_asset($file) { |
|
| 168 | - $type = setBlockAssetContext(); // Retrieve the current type context |
|
| 169 | - return url("block-asset/$type?asset=$file"); |
|
| 170 | - } |
|
| 167 | + function block_asset($file) { |
|
| 168 | + $type = setBlockAssetContext(); // Retrieve the current type context |
|
| 169 | + return url("block-asset/$type?asset=$file"); |
|
| 170 | + } |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | if(!function_exists('get_block_file_contents')) { |
| 174 | - function get_block_file_contents($file) { |
|
| 175 | - $type = setBlockAssetContext(); // Retrieve the current type context |
|
| 176 | - return file_get_contents(base_path("blocks/$type/$file")); |
|
| 177 | - } |
|
| 174 | + function get_block_file_contents($file) { |
|
| 175 | + $type = setBlockAssetContext(); // Retrieve the current type context |
|
| 176 | + return file_get_contents(base_path("blocks/$type/$file")); |
|
| 177 | + } |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | function block_text_translation_check($text) { |
| 181 | - if (empty($text)) { |
|
| 181 | + if (empty($text)) { |
|
| 182 | 182 | return false; |
| 183 | - } |
|
| 184 | - $translate = __("messages.$text"); |
|
| 185 | - return $translate === "messages.$text" ? true : false; |
|
| 183 | + } |
|
| 184 | + $translate = __("messages.$text"); |
|
| 185 | + return $translate === "messages.$text" ? true : false; |
|
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | function block_text($text) { |
| 189 | - $translate = __("messages.$text"); |
|
| 190 | - return $translate === "messages.$text" ? $text : $translate; |
|
| 189 | + $translate = __("messages.$text"); |
|
| 190 | + return $translate === "messages.$text" ? $text : $translate; |
|
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | function bt($text) { |
| 194 | - return block_text($text); |
|
| 194 | + return block_text($text); |
|
| 195 | 195 | } |
| 196 | 196 | \ No newline at end of file |
@@ -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")); |