getSchemeAndHttpHost(); $insecure_url = str_replace('https://', 'http://', $url); foreach ($metatag_attachments['#attached']['html_head'] as &$attachment) { if (isset($attachment[0]['#attributes']['content'])) { $value = &$attachment[0]['#attributes']['content']; } elseif (isset($attachment[0]['#attributes']['href'])) { $value = &$attachment[0]['#attributes']['href']; } if (isset($value) && strpos($value, '||') !== FALSE) { $new_value = FALSE; foreach (explode('||', $value) as $option) { // We have to check against the URL because metatag will prepend our // special tag value with the site URL if the tag plugin uses // absolute URLs. if (!empty($option) && $option !== $url && $option !== $insecure_url) { // Make relative URLs absolute. if (strpos($option, '/') === 0) { $option = rtrim($url, '/') . $option; } $new_value = trim($option); break; } } $value = $new_value ?: ''; } } } }