Passed
Push — main ( 6aad9e...75935a )
by Julian
03:54
created
app/Http/Controllers/UserController.php 1 patch
Braces   +33 added lines, -29 removed lines patch added patch discarded remove patch
@@ -212,8 +212,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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,44 +247,44 @@  discard block
 block discarded – undo
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
                     $OrigLink->update([
268 270
                         'button_id' => "93",
269 271
                         'title' => $request->text,
270 272
                     ]);
271
-                }elseif($linkType->typename == "email"){
273
+                } elseif($linkType->typename == "email"){
272 274
                     $LinkURL = "mailto:".$LinkURL;
273 275
                     $OrigLink->update([
274 276
                         'link' => $LinkURL,
275 277
                         'button_id' => $button?->id,
276 278
                         'title' => $LinkTitle,
277 279
                     ]);
278
-                }elseif($linkType->typename == "telephone"){
280
+                } elseif($linkType->typename == "telephone"){
279 281
                     $LinkURL = "tel:".$LinkURL;
280 282
                     $OrigLink->update([
281 283
                         'link' => $LinkURL,
282 284
                         'button_id' => $button?->id,
283 285
                         'title' => $LinkTitle,
284 286
                     ]);
285
-                }elseif($linkType->typename == "vcard"){
287
+                } elseif($linkType->typename == "vcard"){
286 288
 
287 289
                     $prefix = $request->input('prefix');
288 290
                     $firstName = $request->input('first_name');
@@ -354,7 +356,7 @@  discard block
 block discarded – undo
354 356
                         'button_id' => 96,
355 357
                         'title' => $LinkTitle,
356 358
                     ]);
357
-                }else{
359
+                } else{
358 360
                     $OrigLink->update([
359 361
                         'link' => $LinkURL,
360 362
                         'title' => $LinkTitle,
@@ -375,27 +377,27 @@  discard block
 block discarded – undo
375 377
             $links->user_id = $userId;
376 378
             if($linkType->typename == "spacer"){
377 379
             $links->title = $SpacerHeight;
378
-            }else{
380
+            } else{
379 381
             $links->title = $LinkTitle;
380 382
             }
381 383
             if($linkType->typename == "link" and $isCustomWebsite == "1"){
382 384
                 $links->button_id = "2";
383
-            }elseif($linkType->typename == "link"){
385
+            } elseif($linkType->typename == "link"){
384 386
                 $links->button_id = "1";
385
-            }elseif($linkType->typename == "spacer"){
387
+            } elseif($linkType->typename == "spacer"){
386 388
                 $links->button_id = "43";
387
-            }elseif($linkType->typename == "heading"){
389
+            } elseif($linkType->typename == "heading"){
388 390
                 $links->button_id = "42";
389
-            }elseif($linkType->typename == "text"){
391
+            } elseif($linkType->typename == "text"){
390 392
                 $links->button_id = "93";
391 393
                 $links->title = $request->text;
392
-            }elseif($linkType->typename == "email"){
394
+            } elseif($linkType->typename == "email"){
393 395
                 $links->link = "mailto:".$links->link;
394 396
                 $links->button_id = $button?->id;
395
-            }elseif($linkType->typename == "telephone"){
397
+            } elseif($linkType->typename == "telephone"){
396 398
                 $links->link = "tel:".$links->link;
397 399
                 $links->button_id = $button?->id;
398
-            }elseif($linkType->typename == "vcard"){
400
+            } elseif($linkType->typename == "vcard"){
399 401
 
400 402
                 $prefix = $request->input('prefix');
401 403
                 $firstName = $request->input('first_name');
@@ -463,7 +465,7 @@  discard block
 block discarded – undo
463 465
                 $links->link = $json ? $json : null;               
464 466
 
465 467
                 $links->button_id = 96;
466
-            }else{
468
+            } else{
467 469
                 $links->button_id = $button?->id;
468 470
             }
469 471
 
@@ -712,14 +714,16 @@  discard block
 block discarded – undo
712 714
             'button' => 'required',
713 715
         ]);
714 716
 
715
-        if (stringStartsWith($request->link, 'http://') == 'true' or stringStartsWith($request->link, 'https://') == 'true' or stringStartsWith($request->link, 'mailto:') == 'true')
716
-            $link1 = $request->link;
717
-        else
718
-            $link1 = 'https://' . $request->link;
719
-        if (stringEndsWith($request->link, '/') == 'true')
720
-            $link = rtrim($link1, "/ ");
721
-        else
722
-        $link = $link1;
717
+        if (stringStartsWith($request->link, 'http://') == 'true' or stringStartsWith($request->link, 'https://') == 'true' or stringStartsWith($request->link, 'mailto:') == 'true') {
718
+                    $link1 = $request->link;
719
+        } else {
720
+                    $link1 = 'https://' . $request->link;
721
+        }
722
+        if (stringEndsWith($request->link, '/') == 'true') {
723
+                    $link = rtrim($link1, "/ ");
724
+        } else {
725
+                $link = $link1;
726
+        }
723 727
         $title = $request->title;
724 728
         $order = $request->order;
725 729
         $button = $request->button;
Please login to merge, or discard this patch.