@@ -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 | } |
@@ -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,31 +239,31 @@ 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 | $sanitizedText = $request->text; |
| 268 | 268 | $sanitizedText = strip_tags($sanitizedText, '<a><p><strong><i><ul><ol><li><blockquote><h2><h3><h4>'); |
| 269 | 269 | $sanitizedText = preg_replace("/<a([^>]*)>/i", "<a $1 rel=\"noopener noreferrer nofollow\">", $sanitizedText); |
@@ -272,21 +272,21 @@ discard block |
||
| 272 | 272 | 'button_id' => "93", |
| 273 | 273 | 'title' => $sanitizedText, |
| 274 | 274 | ]); |
| 275 | - }elseif($linkType->typename == "email"){ |
|
| 276 | - $LinkURL = "mailto:".$LinkURL; |
|
| 275 | + }elseif ($linkType->typename == "email") { |
|
| 276 | + $LinkURL = "mailto:" . $LinkURL; |
|
| 277 | 277 | $OrigLink->update([ |
| 278 | 278 | 'link' => $LinkURL, |
| 279 | 279 | 'button_id' => $button?->id, |
| 280 | 280 | 'title' => $LinkTitle, |
| 281 | 281 | ]); |
| 282 | - }elseif($linkType->typename == "telephone"){ |
|
| 283 | - $LinkURL = "tel:".$LinkURL; |
|
| 282 | + }elseif ($linkType->typename == "telephone") { |
|
| 283 | + $LinkURL = "tel:" . $LinkURL; |
|
| 284 | 284 | $OrigLink->update([ |
| 285 | 285 | 'link' => $LinkURL, |
| 286 | 286 | 'button_id' => $button?->id, |
| 287 | 287 | 'title' => $LinkTitle, |
| 288 | 288 | ]); |
| 289 | - }elseif($linkType->typename == "vcard"){ |
|
| 289 | + }elseif ($linkType->typename == "vcard") { |
|
| 290 | 290 | |
| 291 | 291 | $prefix = $request->input('prefix'); |
| 292 | 292 | $firstName = $request->input('first_name'); |
@@ -358,7 +358,7 @@ discard block |
||
| 358 | 358 | 'button_id' => 96, |
| 359 | 359 | 'title' => $LinkTitle, |
| 360 | 360 | ]); |
| 361 | - }else{ |
|
| 361 | + } else { |
|
| 362 | 362 | $OrigLink->update([ |
| 363 | 363 | 'link' => $LinkURL, |
| 364 | 364 | 'title' => $LinkTitle, |
@@ -366,7 +366,7 @@ discard block |
||
| 366 | 366 | ]); |
| 367 | 367 | } |
| 368 | 368 | |
| 369 | - $message .="updated"; |
|
| 369 | + $message .= "updated"; |
|
| 370 | 370 | |
| 371 | 371 | } else { |
| 372 | 372 | // ADDING NEW |
@@ -377,33 +377,33 @@ discard block |
||
| 377 | 377 | $links = new Link; |
| 378 | 378 | $links->link = $LinkURL; |
| 379 | 379 | $links->user_id = $userId; |
| 380 | - if($linkType->typename == "spacer"){ |
|
| 380 | + if ($linkType->typename == "spacer") { |
|
| 381 | 381 | $links->title = $SpacerHeight; |
| 382 | - }else{ |
|
| 382 | + } else { |
|
| 383 | 383 | $links->title = $LinkTitle; |
| 384 | 384 | } |
| 385 | - if($linkType->typename == "link" and $isCustomWebsite == "1"){ |
|
| 385 | + if ($linkType->typename == "link" and $isCustomWebsite == "1") { |
|
| 386 | 386 | $links->button_id = "2"; |
| 387 | - }elseif($linkType->typename == "link"){ |
|
| 387 | + }elseif ($linkType->typename == "link") { |
|
| 388 | 388 | $links->button_id = "1"; |
| 389 | - }elseif($linkType->typename == "spacer"){ |
|
| 389 | + }elseif ($linkType->typename == "spacer") { |
|
| 390 | 390 | $links->button_id = "43"; |
| 391 | - }elseif($linkType->typename == "heading"){ |
|
| 391 | + }elseif ($linkType->typename == "heading") { |
|
| 392 | 392 | $links->button_id = "42"; |
| 393 | - }elseif($linkType->typename == "text"){ |
|
| 393 | + }elseif ($linkType->typename == "text") { |
|
| 394 | 394 | $sanitizedText = $request->text; |
| 395 | 395 | $sanitizedText = strip_tags($sanitizedText, '<a><p><strong><i><ul><ol><li><blockquote><h2><h3><h4>'); |
| 396 | 396 | $sanitizedText = preg_replace("/<a([^>]*)>/i", "<a $1 rel=\"noopener noreferrer nofollow\">", $sanitizedText); |
| 397 | 397 | $sanitizedText = strip_tags_except_allowed_protocols($sanitizedText); |
| 398 | 398 | $links->button_id = "93"; |
| 399 | 399 | $links->title = $sanitizedText; |
| 400 | - }elseif($linkType->typename == "email"){ |
|
| 401 | - $links->link = "mailto:".$links->link; |
|
| 400 | + }elseif ($linkType->typename == "email") { |
|
| 401 | + $links->link = "mailto:" . $links->link; |
|
| 402 | 402 | $links->button_id = $button?->id; |
| 403 | - }elseif($linkType->typename == "telephone"){ |
|
| 404 | - $links->link = "tel:".$links->link; |
|
| 403 | + }elseif ($linkType->typename == "telephone") { |
|
| 404 | + $links->link = "tel:" . $links->link; |
|
| 405 | 405 | $links->button_id = $button?->id; |
| 406 | - }elseif($linkType->typename == "vcard"){ |
|
| 406 | + }elseif ($linkType->typename == "vcard") { |
|
| 407 | 407 | |
| 408 | 408 | $prefix = $request->input('prefix'); |
| 409 | 409 | $firstName = $request->input('first_name'); |
@@ -471,11 +471,11 @@ discard block |
||
| 471 | 471 | $links->link = $json ? $json : null; |
| 472 | 472 | |
| 473 | 473 | $links->button_id = 96; |
| 474 | - }else{ |
|
| 474 | + } else { |
|
| 475 | 475 | $links->button_id = $button?->id; |
| 476 | 476 | } |
| 477 | 477 | |
| 478 | - if(empty($links->button_id)) { |
|
| 478 | + if (empty($links->button_id)) { |
|
| 479 | 479 | return redirect(route('showButtons')); die; |
| 480 | 480 | } |
| 481 | 481 | |
@@ -542,7 +542,7 @@ discard block |
||
| 542 | 542 | |
| 543 | 543 | if (substr($linkId, -1) == '+') { |
| 544 | 544 | $linkWithoutPlus = str_replace('+', '', $linkId); |
| 545 | - return redirect(url('info/'.$linkWithoutPlus)); |
|
| 545 | + return redirect(url('info/' . $linkWithoutPlus)); |
|
| 546 | 546 | } |
| 547 | 547 | |
| 548 | 548 | $link = Link::find($linkId); |
@@ -633,11 +633,11 @@ discard block |
||
| 633 | 633 | |
| 634 | 634 | $directory = base_path("assets/favicon/icons"); |
| 635 | 635 | $files = scandir($directory); |
| 636 | - foreach($files as $file) { |
|
| 637 | - if (strpos($file, $linkId.".") !== false) { |
|
| 638 | - $pathinfo = pathinfo($file, PATHINFO_EXTENSION);}} |
|
| 636 | + foreach ($files as $file) { |
|
| 637 | + if (strpos($file, $linkId . ".") !== false) { |
|
| 638 | + $pathinfo = pathinfo($file, PATHINFO_EXTENSION); }} |
|
| 639 | 639 | if (isset($pathinfo)) { |
| 640 | - try{File::delete(base_path("assets/favicon/icons")."/".$linkId.".".$pathinfo);} catch (exception $e) {} |
|
| 640 | + try {File::delete(base_path("assets/favicon/icons") . "/" . $linkId . "." . $pathinfo); } catch (exception $e) {} |
|
| 641 | 641 | } |
| 642 | 642 | |
| 643 | 643 | return redirect('/studio/links'); |
@@ -650,11 +650,11 @@ discard block |
||
| 650 | 650 | |
| 651 | 651 | $directory = base_path("assets/favicon/icons"); |
| 652 | 652 | $files = scandir($directory); |
| 653 | - foreach($files as $file) { |
|
| 654 | - if (strpos($file, $linkId.".") !== false) { |
|
| 655 | - $pathinfo = pathinfo($file, PATHINFO_EXTENSION);}} |
|
| 653 | + foreach ($files as $file) { |
|
| 654 | + if (strpos($file, $linkId . ".") !== false) { |
|
| 655 | + $pathinfo = pathinfo($file, PATHINFO_EXTENSION); }} |
|
| 656 | 656 | if (isset($pathinfo)) { |
| 657 | - try{File::delete(base_path("assets/favicon/icons")."/".$linkId.".".$pathinfo);} catch (exception $e) {} |
|
| 657 | + try {File::delete(base_path("assets/favicon/icons") . "/" . $linkId . "." . $pathinfo); } catch (exception $e) {} |
|
| 658 | 658 | } |
| 659 | 659 | |
| 660 | 660 | return redirect('/studio/links'); |
@@ -778,7 +778,7 @@ discard block |
||
| 778 | 778 | 'sometimes', |
| 779 | 779 | 'max:255', |
| 780 | 780 | 'string', |
| 781 | - 'isunique:users,id,'.$userId, |
|
| 781 | + 'isunique:users,id,' . $userId, |
|
| 782 | 782 | ], |
| 783 | 783 | 'name' => 'sometimes|max:255|string', |
| 784 | 784 | 'image' => 'sometimes|image|mimes:jpeg,jpg,png,webp|max:2048', // Max file size: 2MB |
@@ -803,7 +803,7 @@ discard block |
||
| 803 | 803 | $sharebtn = $request->sharebtn; |
| 804 | 804 | $tablinks = $request->tablinks; |
| 805 | 805 | |
| 806 | - if(env('HOME_URL') !== '' && $pageName != $littlelink_name && $littlelink_name == env('HOME_URL')){ |
|
| 806 | + if (env('HOME_URL') !== '' && $pageName != $littlelink_name && $littlelink_name == env('HOME_URL')) { |
|
| 807 | 807 | EnvEditor::editKey('HOME_URL', $pageName); |
| 808 | 808 | } |
| 809 | 809 | |
@@ -892,7 +892,7 @@ discard block |
||
| 892 | 892 | |
| 893 | 893 | $user_id = Auth::user()->id; |
| 894 | 894 | $path = findBackground($user_id); |
| 895 | - $path = base_path('assets/img/background-img/'.$path); |
|
| 895 | + $path = base_path('assets/img/background-img/' . $path); |
|
| 896 | 896 | |
| 897 | 897 | if (File::exists($path)) { |
| 898 | 898 | File::delete($path); |
@@ -1029,7 +1029,7 @@ discard block |
||
| 1029 | 1029 | // echo Auth::id(); |
| 1030 | 1030 | $id = $request->id; |
| 1031 | 1031 | |
| 1032 | - if($id == Auth::id() and $id != "1") { |
|
| 1032 | + if ($id == Auth::id() and $id != "1") { |
|
| 1033 | 1033 | |
| 1034 | 1034 | Link::where('user_id', $id)->delete(); |
| 1035 | 1035 | |
@@ -1075,7 +1075,7 @@ discard block |
||
| 1075 | 1075 | $fileName = "links-$domain-$date.json"; |
| 1076 | 1076 | $headers = [ |
| 1077 | 1077 | 'Content-Type' => 'application/json', |
| 1078 | - 'Content-Disposition' => 'attachment; filename="'.$fileName.'"', |
|
| 1078 | + 'Content-Disposition' => 'attachment; filename="' . $fileName . '"', |
|
| 1079 | 1079 | ]; |
| 1080 | 1080 | return response()->json($userData, 200, $headers); |
| 1081 | 1081 | |
@@ -1097,18 +1097,18 @@ discard block |
||
| 1097 | 1097 | $userData = $user->toArray(); |
| 1098 | 1098 | $userData['links'] = $links->toArray(); |
| 1099 | 1099 | |
| 1100 | - function findAvatar($name){ |
|
| 1100 | + function findAvatar($name) { |
|
| 1101 | 1101 | $directory = base_path('assets/img'); |
| 1102 | 1102 | $files = scandir($directory); |
| 1103 | 1103 | $pathinfo = "error.error"; |
| 1104 | - foreach($files as $file) { |
|
| 1105 | - if (strpos($file, $name.'.') !== false) { |
|
| 1106 | - $pathinfo = "/img/" . $name. "." . pathinfo($file, PATHINFO_EXTENSION); |
|
| 1104 | + foreach ($files as $file) { |
|
| 1105 | + if (strpos($file, $name . '.') !== false) { |
|
| 1106 | + $pathinfo = "/img/" . $name . "." . pathinfo($file, PATHINFO_EXTENSION); |
|
| 1107 | 1107 | }} |
| 1108 | 1108 | return $pathinfo; |
| 1109 | 1109 | } |
| 1110 | 1110 | |
| 1111 | - if (file_exists(base_path(findAvatar($userId)))){ |
|
| 1111 | + if (file_exists(base_path(findAvatar($userId)))) { |
|
| 1112 | 1112 | $imagePath = base_path(findAvatar($userId)); |
| 1113 | 1113 | $imageData = base64_encode(file_get_contents($imagePath)); |
| 1114 | 1114 | $userData['image_data'] = $imageData; |
@@ -1122,7 +1122,7 @@ discard block |
||
| 1122 | 1122 | $fileName = "user_data-$domain-$date.json"; |
| 1123 | 1123 | $headers = [ |
| 1124 | 1124 | 'Content-Type' => 'application/json', |
| 1125 | - 'Content-Disposition' => 'attachment; filename="'.$fileName.'"', |
|
| 1125 | + 'Content-Disposition' => 'attachment; filename="' . $fileName . '"', |
|
| 1126 | 1126 | ]; |
| 1127 | 1127 | return response()->json($userData, 200, $headers); |
| 1128 | 1128 | |
@@ -212,8 +212,9 @@ 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'])) |
|
| 216 | - continue; |
|
| 215 | + if (str_starts_with($key, "_") || in_array($key, ['linktype_id', 'linktype_title', 'link_text', 'link_url'])) { |
|
| 216 | + continue; |
|
| 217 | + } |
|
| 217 | 218 | |
| 218 | 219 | $customParams[$key] = $param; |
| 219 | 220 | } |
@@ -221,8 +222,9 @@ discard block |
||
| 221 | 222 | $userId = Auth::user()->id; |
| 222 | 223 | $button = Button::where('name', $request->button)->first(); |
| 223 | 224 | |
| 224 | - if ($button && empty($LinkTitle)) |
|
| 225 | - $LinkTitle = $button->alt; |
|
| 225 | + if ($button && empty($LinkTitle)) { |
|
| 226 | + $LinkTitle = $button->alt; |
|
| 227 | + } |
|
| 226 | 228 | |
| 227 | 229 | if ($linkType->typename == 'video' && empty($LinkTitle)) { |
| 228 | 230 | $embed = OEmbed::get($LinkURL); |
@@ -245,25 +247,25 @@ discard block |
||
| 245 | 247 | 'title' => $LinkTitle, |
| 246 | 248 | 'button_id' => "2", |
| 247 | 249 | ]); |
| 248 | - }elseif($linkType->typename == "link"){ |
|
| 250 | + } elseif($linkType->typename == "link"){ |
|
| 249 | 251 | $OrigLink->update([ |
| 250 | 252 | 'link' => $LinkURL, |
| 251 | 253 | 'title' => $LinkTitle, |
| 252 | 254 | 'button_id' => "1", |
| 253 | 255 | ]); |
| 254 | - }elseif($linkType->typename == "spacer"){ |
|
| 256 | + } elseif($linkType->typename == "spacer"){ |
|
| 255 | 257 | $OrigLink->update([ |
| 256 | 258 | 'link' => $LinkURL, |
| 257 | 259 | 'title' => $customParams['height'] ?? null, |
| 258 | 260 | 'button_id' => "43", |
| 259 | 261 | ]); |
| 260 | - }elseif($linkType->typename == "heading"){ |
|
| 262 | + } elseif($linkType->typename == "heading"){ |
|
| 261 | 263 | $OrigLink->update([ |
| 262 | 264 | 'link' => $LinkURL, |
| 263 | 265 | 'title' => $LinkTitle, |
| 264 | 266 | 'button_id' => "42", |
| 265 | 267 | ]); |
| 266 | - }elseif($linkType->typename == "text"){ |
|
| 268 | + } elseif($linkType->typename == "text"){ |
|
| 267 | 269 | $sanitizedText = $request->text; |
| 268 | 270 | $sanitizedText = strip_tags($sanitizedText, '<a><p><strong><i><ul><ol><li><blockquote><h2><h3><h4>'); |
| 269 | 271 | $sanitizedText = preg_replace("/<a([^>]*)>/i", "<a $1 rel=\"noopener noreferrer nofollow\">", $sanitizedText); |
@@ -272,21 +274,21 @@ discard block |
||
| 272 | 274 | 'button_id' => "93", |
| 273 | 275 | 'title' => $sanitizedText, |
| 274 | 276 | ]); |
| 275 | - }elseif($linkType->typename == "email"){ |
|
| 277 | + } elseif($linkType->typename == "email"){ |
|
| 276 | 278 | $LinkURL = "mailto:".$LinkURL; |
| 277 | 279 | $OrigLink->update([ |
| 278 | 280 | 'link' => $LinkURL, |
| 279 | 281 | 'button_id' => $button?->id, |
| 280 | 282 | 'title' => $LinkTitle, |
| 281 | 283 | ]); |
| 282 | - }elseif($linkType->typename == "telephone"){ |
|
| 284 | + } elseif($linkType->typename == "telephone"){ |
|
| 283 | 285 | $LinkURL = "tel:".$LinkURL; |
| 284 | 286 | $OrigLink->update([ |
| 285 | 287 | 'link' => $LinkURL, |
| 286 | 288 | 'button_id' => $button?->id, |
| 287 | 289 | 'title' => $LinkTitle, |
| 288 | 290 | ]); |
| 289 | - }elseif($linkType->typename == "vcard"){ |
|
| 291 | + } elseif($linkType->typename == "vcard"){ |
|
| 290 | 292 | |
| 291 | 293 | $prefix = $request->input('prefix'); |
| 292 | 294 | $firstName = $request->input('first_name'); |
@@ -358,7 +360,7 @@ discard block |
||
| 358 | 360 | 'button_id' => 96, |
| 359 | 361 | 'title' => $LinkTitle, |
| 360 | 362 | ]); |
| 361 | - }else{ |
|
| 363 | + } else{ |
|
| 362 | 364 | $OrigLink->update([ |
| 363 | 365 | 'link' => $LinkURL, |
| 364 | 366 | 'title' => $LinkTitle, |
@@ -379,31 +381,31 @@ discard block |
||
| 379 | 381 | $links->user_id = $userId; |
| 380 | 382 | if($linkType->typename == "spacer"){ |
| 381 | 383 | $links->title = $SpacerHeight; |
| 382 | - }else{ |
|
| 384 | + } else{ |
|
| 383 | 385 | $links->title = $LinkTitle; |
| 384 | 386 | } |
| 385 | 387 | if($linkType->typename == "link" and $isCustomWebsite == "1"){ |
| 386 | 388 | $links->button_id = "2"; |
| 387 | - }elseif($linkType->typename == "link"){ |
|
| 389 | + } elseif($linkType->typename == "link"){ |
|
| 388 | 390 | $links->button_id = "1"; |
| 389 | - }elseif($linkType->typename == "spacer"){ |
|
| 391 | + } elseif($linkType->typename == "spacer"){ |
|
| 390 | 392 | $links->button_id = "43"; |
| 391 | - }elseif($linkType->typename == "heading"){ |
|
| 393 | + } elseif($linkType->typename == "heading"){ |
|
| 392 | 394 | $links->button_id = "42"; |
| 393 | - }elseif($linkType->typename == "text"){ |
|
| 395 | + } elseif($linkType->typename == "text"){ |
|
| 394 | 396 | $sanitizedText = $request->text; |
| 395 | 397 | $sanitizedText = strip_tags($sanitizedText, '<a><p><strong><i><ul><ol><li><blockquote><h2><h3><h4>'); |
| 396 | 398 | $sanitizedText = preg_replace("/<a([^>]*)>/i", "<a $1 rel=\"noopener noreferrer nofollow\">", $sanitizedText); |
| 397 | 399 | $sanitizedText = strip_tags_except_allowed_protocols($sanitizedText); |
| 398 | 400 | $links->button_id = "93"; |
| 399 | 401 | $links->title = $sanitizedText; |
| 400 | - }elseif($linkType->typename == "email"){ |
|
| 402 | + } elseif($linkType->typename == "email"){ |
|
| 401 | 403 | $links->link = "mailto:".$links->link; |
| 402 | 404 | $links->button_id = $button?->id; |
| 403 | - }elseif($linkType->typename == "telephone"){ |
|
| 405 | + } elseif($linkType->typename == "telephone"){ |
|
| 404 | 406 | $links->link = "tel:".$links->link; |
| 405 | 407 | $links->button_id = $button?->id; |
| 406 | - }elseif($linkType->typename == "vcard"){ |
|
| 408 | + } elseif($linkType->typename == "vcard"){ |
|
| 407 | 409 | |
| 408 | 410 | $prefix = $request->input('prefix'); |
| 409 | 411 | $firstName = $request->input('first_name'); |
@@ -471,7 +473,7 @@ discard block |
||
| 471 | 473 | $links->link = $json ? $json : null; |
| 472 | 474 | |
| 473 | 475 | $links->button_id = 96; |
| 474 | - }else{ |
|
| 476 | + } else{ |
|
| 475 | 477 | $links->button_id = $button?->id; |
| 476 | 478 | } |
| 477 | 479 | |
@@ -720,14 +722,16 @@ discard block |
||
| 720 | 722 | 'button' => 'required', |
| 721 | 723 | ]); |
| 722 | 724 | |
| 723 | - if (stringStartsWith($request->link, 'http://') == 'true' or stringStartsWith($request->link, 'https://') == 'true' or stringStartsWith($request->link, 'mailto:') == 'true') |
|
| 724 | - $link1 = $request->link; |
|
| 725 | - else |
|
| 726 | - $link1 = 'https://' . $request->link; |
|
| 727 | - if (stringEndsWith($request->link, '/') == 'true') |
|
| 728 | - $link = rtrim($link1, "/ "); |
|
| 729 | - else |
|
| 730 | - $link = $link1; |
|
| 725 | + if (stringStartsWith($request->link, 'http://') == 'true' or stringStartsWith($request->link, 'https://') == 'true' or stringStartsWith($request->link, 'mailto:') == 'true') { |
|
| 726 | + $link1 = $request->link; |
|
| 727 | + } else { |
|
| 728 | + $link1 = 'https://' . $request->link; |
|
| 729 | + } |
|
| 730 | + if (stringEndsWith($request->link, '/') == 'true') { |
|
| 731 | + $link = rtrim($link1, "/ "); |
|
| 732 | + } else { |
|
| 733 | + $link = $link1; |
|
| 734 | + } |
|
| 731 | 735 | $title = $request->title; |
| 732 | 736 | $order = $request->order; |
| 733 | 737 | $button = $request->button; |