+ $profiles2 = array();
+
+ foreach ($profiles AS $profile) {
+ // Check for invalid profile urls. 13 should be the shortest possible profile length:
+ // http://a.bc/d
+ // Additionally check for invalid urls that would return the normalised value "http:"
+ if ((strlen($profile) >= 13) AND (normalise_link($profile) != "http:")) {
+ if (!in_array($profile, $profiles2))
+ $profiles2[] = $profile;
+
+ $profile = normalise_link($profile);
+ if (!in_array($profile, $profiles2))
+ $profiles2[] = $profile;
+
+ $profile = str_replace("http://", "https://", $profile);
+ if (!in_array($profile, $profiles2))
+ $profiles2[] = $profile;
+ }
+ }
+
+ $profiles = $profiles2;
+
+ $profile_list = "";
+
+ foreach ($profiles AS $profile) {
+ if ($profile_list != "")
+ $profile_list .= "', '";
+
+ $profile_list .= dbesc($profile);
+ }
+
+ $profile_list = "'".$profile_list."'";