@@ -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 { |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | return abort(404); |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | - return redirect(url('@'.$user)); |
|
| 143 | + return redirect(url('@' . $user)); |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | //Show add/update form |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | |
| 166 | 166 | $bid = $links->button_id; |
| 167 | 167 | |
| 168 | - if($bid == 1 or $bid == 2){ |
|
| 168 | + if ($bid == 1 or $bid == 2) { |
|
| 169 | 169 | $data['linkTypeID'] = "2"; |
| 170 | 170 | } elseif ($bid == 42) { |
| 171 | 171 | $data['linkTypeID'] = "3"; |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | $customParams = []; |
| 213 | 213 | foreach ($request->all() as $key => $param) { |
| 214 | 214 | //echo $key . " = " . $param . "<br />"; |
| 215 | - if (str_starts_with($key, "_") || in_array($key, ['linktype_id', 'linktype_title', 'link_text', 'link_url'])) |
|
| 215 | + if (str_starts_with($key, "_") || in_array($key, ['linktype_id', 'linktype_title', 'link_text', 'link_url'])) |
|
| 216 | 216 | continue; |
| 217 | 217 | |
| 218 | 218 | $customParams[$key] = $param; |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | } |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | - $message = (ucwords($button?->name) ?? ucwords($linkType->typename)). " has been "; |
|
| 234 | + $message = (ucwords($button?->name) ?? ucwords($linkType->typename)) . " has been "; |
|
| 235 | 235 | |
| 236 | 236 | if ($OrigLink) { |
| 237 | 237 | //EDITING EXISTING |
@@ -239,50 +239,50 @@ discard block |
||
| 239 | 239 | $isCustomWebsite = $customParams['GetSiteIcon'] ?? null; |
| 240 | 240 | $SpacerHeight = $customParams['height'] ?? null; |
| 241 | 241 | |
| 242 | - if($linkType->typename == "link" and $isCustomWebsite == "1"){ |
|
| 242 | + if ($linkType->typename == "link" and $isCustomWebsite == "1") { |
|
| 243 | 243 | $OrigLink->update([ |
| 244 | 244 | 'link' => $LinkURL, |
| 245 | 245 | 'title' => $LinkTitle, |
| 246 | 246 | 'button_id' => "2", |
| 247 | 247 | ]); |
| 248 | - }elseif($linkType->typename == "link"){ |
|
| 248 | + }elseif ($linkType->typename == "link") { |
|
| 249 | 249 | $OrigLink->update([ |
| 250 | 250 | 'link' => $LinkURL, |
| 251 | 251 | 'title' => $LinkTitle, |
| 252 | 252 | 'button_id' => "1", |
| 253 | 253 | ]); |
| 254 | - }elseif($linkType->typename == "spacer"){ |
|
| 254 | + }elseif ($linkType->typename == "spacer") { |
|
| 255 | 255 | $OrigLink->update([ |
| 256 | 256 | 'link' => $LinkURL, |
| 257 | 257 | 'title' => $customParams['height'] ?? null, |
| 258 | 258 | 'button_id' => "43", |
| 259 | 259 | ]); |
| 260 | - }elseif($linkType->typename == "heading"){ |
|
| 260 | + }elseif ($linkType->typename == "heading") { |
|
| 261 | 261 | $OrigLink->update([ |
| 262 | 262 | 'link' => $LinkURL, |
| 263 | 263 | 'title' => $LinkTitle, |
| 264 | 264 | 'button_id' => "42", |
| 265 | 265 | ]); |
| 266 | - }elseif($linkType->typename == "text"){ |
|
| 266 | + }elseif ($linkType->typename == "text") { |
|
| 267 | 267 | $OrigLink->update([ |
| 268 | 268 | 'button_id' => "93", |
| 269 | 269 | 'title' => $request->text, |
| 270 | 270 | ]); |
| 271 | - }elseif($linkType->typename == "email"){ |
|
| 272 | - $LinkURL = "mailto:".$LinkURL; |
|
| 271 | + }elseif ($linkType->typename == "email") { |
|
| 272 | + $LinkURL = "mailto:" . $LinkURL; |
|
| 273 | 273 | $OrigLink->update([ |
| 274 | 274 | 'link' => $LinkURL, |
| 275 | 275 | 'button_id' => $button?->id, |
| 276 | 276 | 'title' => $LinkTitle, |
| 277 | 277 | ]); |
| 278 | - }elseif($linkType->typename == "telephone"){ |
|
| 279 | - $LinkURL = "tel:".$LinkURL; |
|
| 278 | + }elseif ($linkType->typename == "telephone") { |
|
| 279 | + $LinkURL = "tel:" . $LinkURL; |
|
| 280 | 280 | $OrigLink->update([ |
| 281 | 281 | 'link' => $LinkURL, |
| 282 | 282 | 'button_id' => $button?->id, |
| 283 | 283 | 'title' => $LinkTitle, |
| 284 | 284 | ]); |
| 285 | - }elseif($linkType->typename == "vcard"){ |
|
| 285 | + }elseif ($linkType->typename == "vcard") { |
|
| 286 | 286 | |
| 287 | 287 | $prefix = $request->input('prefix'); |
| 288 | 288 | $firstName = $request->input('first_name'); |
@@ -354,7 +354,7 @@ discard block |
||
| 354 | 354 | 'button_id' => 96, |
| 355 | 355 | 'title' => $LinkTitle, |
| 356 | 356 | ]); |
| 357 | - }else{ |
|
| 357 | + } else { |
|
| 358 | 358 | $OrigLink->update([ |
| 359 | 359 | 'link' => $LinkURL, |
| 360 | 360 | 'title' => $LinkTitle, |
@@ -362,7 +362,7 @@ discard block |
||
| 362 | 362 | ]); |
| 363 | 363 | } |
| 364 | 364 | |
| 365 | - $message .="updated"; |
|
| 365 | + $message .= "updated"; |
|
| 366 | 366 | |
| 367 | 367 | } else { |
| 368 | 368 | // ADDING NEW |
@@ -373,29 +373,29 @@ discard block |
||
| 373 | 373 | $links = new Link; |
| 374 | 374 | $links->link = $LinkURL; |
| 375 | 375 | $links->user_id = $userId; |
| 376 | - if($linkType->typename == "spacer"){ |
|
| 376 | + if ($linkType->typename == "spacer") { |
|
| 377 | 377 | $links->title = $SpacerHeight; |
| 378 | - }else{ |
|
| 378 | + } else { |
|
| 379 | 379 | $links->title = $LinkTitle; |
| 380 | 380 | } |
| 381 | - if($linkType->typename == "link" and $isCustomWebsite == "1"){ |
|
| 381 | + if ($linkType->typename == "link" and $isCustomWebsite == "1") { |
|
| 382 | 382 | $links->button_id = "2"; |
| 383 | - }elseif($linkType->typename == "link"){ |
|
| 383 | + }elseif ($linkType->typename == "link") { |
|
| 384 | 384 | $links->button_id = "1"; |
| 385 | - }elseif($linkType->typename == "spacer"){ |
|
| 385 | + }elseif ($linkType->typename == "spacer") { |
|
| 386 | 386 | $links->button_id = "43"; |
| 387 | - }elseif($linkType->typename == "heading"){ |
|
| 387 | + }elseif ($linkType->typename == "heading") { |
|
| 388 | 388 | $links->button_id = "42"; |
| 389 | - }elseif($linkType->typename == "text"){ |
|
| 389 | + }elseif ($linkType->typename == "text") { |
|
| 390 | 390 | $links->button_id = "93"; |
| 391 | 391 | $links->title = $request->text; |
| 392 | - }elseif($linkType->typename == "email"){ |
|
| 393 | - $links->link = "mailto:".$links->link; |
|
| 392 | + }elseif ($linkType->typename == "email") { |
|
| 393 | + $links->link = "mailto:" . $links->link; |
|
| 394 | 394 | $links->button_id = $button?->id; |
| 395 | - }elseif($linkType->typename == "telephone"){ |
|
| 396 | - $links->link = "tel:".$links->link; |
|
| 395 | + }elseif ($linkType->typename == "telephone") { |
|
| 396 | + $links->link = "tel:" . $links->link; |
|
| 397 | 397 | $links->button_id = $button?->id; |
| 398 | - }elseif($linkType->typename == "vcard"){ |
|
| 398 | + }elseif ($linkType->typename == "vcard") { |
|
| 399 | 399 | |
| 400 | 400 | $prefix = $request->input('prefix'); |
| 401 | 401 | $firstName = $request->input('first_name'); |
@@ -463,11 +463,11 @@ discard block |
||
| 463 | 463 | $links->link = $json ? $json : null; |
| 464 | 464 | |
| 465 | 465 | $links->button_id = 96; |
| 466 | - }else{ |
|
| 466 | + } else { |
|
| 467 | 467 | $links->button_id = $button?->id; |
| 468 | 468 | } |
| 469 | 469 | |
| 470 | - if(empty($links->button_id)) { |
|
| 470 | + if (empty($links->button_id)) { |
|
| 471 | 471 | return redirect(route('showButtons')); die; |
| 472 | 472 | } |
| 473 | 473 | |
@@ -534,7 +534,7 @@ discard block |
||
| 534 | 534 | |
| 535 | 535 | if (substr($linkId, -1) == '+') { |
| 536 | 536 | $linkWithoutPlus = str_replace('+', '', $linkId); |
| 537 | - return redirect(url('info/'.$linkWithoutPlus)); |
|
| 537 | + return redirect(url('info/' . $linkWithoutPlus)); |
|
| 538 | 538 | } |
| 539 | 539 | |
| 540 | 540 | $link = Link::find($linkId); |
@@ -625,11 +625,11 @@ discard block |
||
| 625 | 625 | |
| 626 | 626 | $directory = base_path("assets/favicon/icons"); |
| 627 | 627 | $files = scandir($directory); |
| 628 | - foreach($files as $file) { |
|
| 629 | - if (strpos($file, $linkId.".") !== false) { |
|
| 630 | - $pathinfo = pathinfo($file, PATHINFO_EXTENSION);}} |
|
| 628 | + foreach ($files as $file) { |
|
| 629 | + if (strpos($file, $linkId . ".") !== false) { |
|
| 630 | + $pathinfo = pathinfo($file, PATHINFO_EXTENSION); }} |
|
| 631 | 631 | if (isset($pathinfo)) { |
| 632 | - try{File::delete(base_path("assets/favicon/icons")."/".$linkId.".".$pathinfo);} catch (exception $e) {} |
|
| 632 | + try {File::delete(base_path("assets/favicon/icons") . "/" . $linkId . "." . $pathinfo); } catch (exception $e) {} |
|
| 633 | 633 | } |
| 634 | 634 | |
| 635 | 635 | return redirect('/studio/links'); |
@@ -642,11 +642,11 @@ discard block |
||
| 642 | 642 | |
| 643 | 643 | $directory = base_path("assets/favicon/icons"); |
| 644 | 644 | $files = scandir($directory); |
| 645 | - foreach($files as $file) { |
|
| 646 | - if (strpos($file, $linkId.".") !== false) { |
|
| 647 | - $pathinfo = pathinfo($file, PATHINFO_EXTENSION);}} |
|
| 645 | + foreach ($files as $file) { |
|
| 646 | + if (strpos($file, $linkId . ".") !== false) { |
|
| 647 | + $pathinfo = pathinfo($file, PATHINFO_EXTENSION); }} |
|
| 648 | 648 | if (isset($pathinfo)) { |
| 649 | - try{File::delete(base_path("assets/favicon/icons")."/".$linkId.".".$pathinfo);} catch (exception $e) {} |
|
| 649 | + try {File::delete(base_path("assets/favicon/icons") . "/" . $linkId . "." . $pathinfo); } catch (exception $e) {} |
|
| 650 | 650 | } |
| 651 | 651 | |
| 652 | 652 | return redirect('/studio/links'); |
@@ -770,7 +770,7 @@ discard block |
||
| 770 | 770 | 'sometimes', |
| 771 | 771 | 'max:255', |
| 772 | 772 | 'string', |
| 773 | - 'isunique:users,id,'.$userId, |
|
| 773 | + 'isunique:users,id,' . $userId, |
|
| 774 | 774 | ], |
| 775 | 775 | 'name' => 'sometimes|max:255|string', |
| 776 | 776 | 'image' => 'sometimes|image|mimes:jpeg,jpg,png,webp|max:2048', // Max file size: 2MB |
@@ -794,7 +794,7 @@ discard block |
||
| 794 | 794 | $sharebtn = $request->sharebtn; |
| 795 | 795 | $tablinks = $request->tablinks; |
| 796 | 796 | |
| 797 | - if(env('HOME_URL') !== '' && $pageName != $littlelink_name && $littlelink_name == env('HOME_URL')){ |
|
| 797 | + if (env('HOME_URL') !== '' && $pageName != $littlelink_name && $littlelink_name == env('HOME_URL')) { |
|
| 798 | 798 | EnvEditor::editKey('HOME_URL', $pageName); |
| 799 | 799 | } |
| 800 | 800 | |
@@ -883,7 +883,7 @@ discard block |
||
| 883 | 883 | |
| 884 | 884 | $user_id = Auth::user()->id; |
| 885 | 885 | $path = findBackground($user_id); |
| 886 | - $path = base_path('assets/img/background-img/'.$path); |
|
| 886 | + $path = base_path('assets/img/background-img/' . $path); |
|
| 887 | 887 | |
| 888 | 888 | if (File::exists($path)) { |
| 889 | 889 | File::delete($path); |
@@ -1020,7 +1020,7 @@ discard block |
||
| 1020 | 1020 | // echo Auth::id(); |
| 1021 | 1021 | $id = $request->id; |
| 1022 | 1022 | |
| 1023 | - if($id == Auth::id() and $id != "1") { |
|
| 1023 | + if ($id == Auth::id() and $id != "1") { |
|
| 1024 | 1024 | |
| 1025 | 1025 | Link::where('user_id', $id)->delete(); |
| 1026 | 1026 | |
@@ -1066,7 +1066,7 @@ discard block |
||
| 1066 | 1066 | $fileName = "links-$domain-$date.json"; |
| 1067 | 1067 | $headers = [ |
| 1068 | 1068 | 'Content-Type' => 'application/json', |
| 1069 | - 'Content-Disposition' => 'attachment; filename="'.$fileName.'"', |
|
| 1069 | + 'Content-Disposition' => 'attachment; filename="' . $fileName . '"', |
|
| 1070 | 1070 | ]; |
| 1071 | 1071 | return response()->json($userData, 200, $headers); |
| 1072 | 1072 | |
@@ -1088,18 +1088,18 @@ discard block |
||
| 1088 | 1088 | $userData = $user->toArray(); |
| 1089 | 1089 | $userData['links'] = $links->toArray(); |
| 1090 | 1090 | |
| 1091 | - function findAvatar($name){ |
|
| 1091 | + function findAvatar($name) { |
|
| 1092 | 1092 | $directory = base_path('assets/img'); |
| 1093 | 1093 | $files = scandir($directory); |
| 1094 | 1094 | $pathinfo = "error.error"; |
| 1095 | - foreach($files as $file) { |
|
| 1096 | - if (strpos($file, $name.'.') !== false) { |
|
| 1097 | - $pathinfo = "/img/" . $name. "." . pathinfo($file, PATHINFO_EXTENSION); |
|
| 1095 | + foreach ($files as $file) { |
|
| 1096 | + if (strpos($file, $name . '.') !== false) { |
|
| 1097 | + $pathinfo = "/img/" . $name . "." . pathinfo($file, PATHINFO_EXTENSION); |
|
| 1098 | 1098 | }} |
| 1099 | 1099 | return $pathinfo; |
| 1100 | 1100 | } |
| 1101 | 1101 | |
| 1102 | - if (file_exists(base_path(findAvatar($userId)))){ |
|
| 1102 | + if (file_exists(base_path(findAvatar($userId)))) { |
|
| 1103 | 1103 | $imagePath = base_path(findAvatar($userId)); |
| 1104 | 1104 | $imageData = base64_encode(file_get_contents($imagePath)); |
| 1105 | 1105 | $userData['image_data'] = $imageData; |
@@ -1113,7 +1113,7 @@ discard block |
||
| 1113 | 1113 | $fileName = "user_data-$domain-$date.json"; |
| 1114 | 1114 | $headers = [ |
| 1115 | 1115 | 'Content-Type' => 'application/json', |
| 1116 | - 'Content-Disposition' => 'attachment; filename="'.$fileName.'"', |
|
| 1116 | + 'Content-Disposition' => 'attachment; filename="' . $fileName . '"', |
|
| 1117 | 1117 | ]; |
| 1118 | 1118 | return response()->json($userData, 200, $headers); |
| 1119 | 1119 | |