Passed
Push — main ( 80491e...c1a475 )
by Julian
04:23
created
app/Models/LinkType.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@
 block discarded – undo
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
         });
Please login to merge, or discard this patch.
app/Http/Controllers/UserController.php 2 patches
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
195 195
         $LinkURL = $request->link;
196 196
 
197 197
         // Step 3: Load Link Type Logic
198
-        if($request->typename == 'predefined') {
198
+        if ($request->typename == 'predefined') {
199 199
             $button = Button::where('name', $request->button)->first();
200 200
             $linkData = [
201 201
                 'link' => $LinkURL,
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 
245 245
         if ($OrigLink) {
246 246
             $currentValues = $OrigLink->getAttributes();
247
-            $nonNullFilteredLinkData = array_filter($filteredLinkData, function($value) {return !is_null($value);});
247
+            $nonNullFilteredLinkData = array_filter($filteredLinkData, function($value) {return !is_null($value); });
248 248
             $updatedValues = array_merge($currentValues, $nonNullFilteredLinkData);
249 249
             $OrigLink->update($updatedValues);
250 250
             $message = "Link updated";
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
 
307 307
         if (substr($linkId, -1) == '+') {
308 308
             $linkWithoutPlus = str_replace('+', '', $linkId);
309
-            return redirect(url('info/'.$linkWithoutPlus));
309
+            return redirect(url('info/' . $linkWithoutPlus));
310 310
         }
311 311
     
312 312
         $link = Link::find($linkId);
@@ -397,11 +397,11 @@  discard block
 block discarded – undo
397 397
 
398 398
         $directory = base_path("assets/favicon/icons");
399 399
         $files = scandir($directory);
400
-        foreach($files as $file) {
401
-        if (strpos($file, $linkId.".") !== false) {
402
-        $pathinfo = pathinfo($file, PATHINFO_EXTENSION);}}
400
+        foreach ($files as $file) {
401
+        if (strpos($file, $linkId . ".") !== false) {
402
+        $pathinfo = pathinfo($file, PATHINFO_EXTENSION); }}
403 403
         if (isset($pathinfo)) {
404
-        try{File::delete(base_path("assets/favicon/icons")."/".$linkId.".".$pathinfo);} catch (exception $e) {}
404
+        try {File::delete(base_path("assets/favicon/icons") . "/" . $linkId . "." . $pathinfo); } catch (exception $e) {}
405 405
         }
406 406
 
407 407
         return redirect('/studio/links');
@@ -414,11 +414,11 @@  discard block
 block discarded – undo
414 414
 
415 415
         $directory = base_path("assets/favicon/icons");
416 416
         $files = scandir($directory);
417
-        foreach($files as $file) {
418
-        if (strpos($file, $linkId.".") !== false) {
419
-        $pathinfo = pathinfo($file, PATHINFO_EXTENSION);}}
417
+        foreach ($files as $file) {
418
+        if (strpos($file, $linkId . ".") !== false) {
419
+        $pathinfo = pathinfo($file, PATHINFO_EXTENSION); }}
420 420
         if (isset($pathinfo)) {
421
-        try{File::delete(base_path("assets/favicon/icons")."/".$linkId.".".$pathinfo);} catch (exception $e) {}
421
+        try {File::delete(base_path("assets/favicon/icons") . "/" . $linkId . "." . $pathinfo); } catch (exception $e) {}
422 422
         }
423 423
 
424 424
         return redirect('/studio/links');
@@ -542,7 +542,7 @@  discard block
 block discarded – undo
542 542
                 'sometimes',
543 543
                 'max:255',
544 544
                 'string',
545
-                'isunique:users,id,'.$userId,
545
+                'isunique:users,id,' . $userId,
546 546
             ],
547 547
             'name' => 'sometimes|max:255|string',
548 548
             'image' => 'sometimes|image|mimes:jpeg,jpg,png,webp|max:2048', // Max file size: 2MB
@@ -567,7 +567,7 @@  discard block
 block discarded – undo
567 567
         $sharebtn = $request->sharebtn;
568 568
         $tablinks = $request->tablinks;
569 569
 
570
-        if(env('HOME_URL') !== '' && $pageName != $littlelink_name && $littlelink_name == env('HOME_URL')){
570
+        if (env('HOME_URL') !== '' && $pageName != $littlelink_name && $littlelink_name == env('HOME_URL')) {
571 571
             EnvEditor::editKey('HOME_URL', $pageName);
572 572
         }
573 573
     
@@ -801,7 +801,7 @@  discard block
 block discarded – undo
801 801
         // echo Auth::id();
802 802
         $id = $request->id;
803 803
 
804
-    if($id == Auth::id() and $id != "1") {
804
+    if ($id == Auth::id() and $id != "1") {
805 805
 
806 806
         Link::where('user_id', $id)->delete();
807 807
 
@@ -848,7 +848,7 @@  discard block
 block discarded – undo
848 848
         $fileName = "links-$domain-$date.json";
849 849
         $headers = [
850 850
             'Content-Type' => 'application/json',
851
-            'Content-Disposition' => 'attachment; filename="'.$fileName.'"',
851
+            'Content-Disposition' => 'attachment; filename="' . $fileName . '"',
852 852
         ];
853 853
         return response()->json($userData, 200, $headers);
854 854
 
@@ -870,7 +870,7 @@  discard block
 block discarded – undo
870 870
         $userData = $user->toArray();
871 871
         $userData['links'] = $links->toArray();
872 872
 
873
-        if (file_exists(base_path(findAvatar($userId)))){
873
+        if (file_exists(base_path(findAvatar($userId)))) {
874 874
             $imagePath = base_path(findAvatar($userId));
875 875
             $imageData = base64_encode(file_get_contents($imagePath));
876 876
             $userData['image_data'] = $imageData;
@@ -884,7 +884,7 @@  discard block
 block discarded – undo
884 884
         $fileName = "user_data-$domain-$date.json";
885 885
         $headers = [
886 886
             'Content-Type' => 'application/json',
887
-            'Content-Disposition' => 'attachment; filename="'.$fileName.'"',
887
+            'Content-Disposition' => 'attachment; filename="' . $fileName . '"',
888 888
         ];
889 889
         return response()->json($userData, 200, $headers);
890 890
     
Please login to merge, or discard this patch.
Braces   +13 added lines, -9 removed lines patch added patch discarded remove patch
@@ -221,7 +221,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.