function IFrameUrlHelper::isSecure
Same name in other branches
- 9 core/modules/media/src/IFrameUrlHelper.php \Drupal\media\IFrameUrlHelper::isSecure()
- 8.9.x core/modules/media/src/IFrameUrlHelper.php \Drupal\media\IFrameUrlHelper::isSecure()
- 11.x core/modules/media/src/IFrameUrlHelper.php \Drupal\media\IFrameUrlHelper::isSecure()
Checks if an oEmbed URL can be securely displayed in an frame.
Parameters
string $url: The URL to check.
Return value
bool TRUE if the URL is considered secure, otherwise FALSE.
File
-
core/
modules/ media/ src/ IFrameUrlHelper.php, line 72
Class
- IFrameUrlHelper
- Providers helper functions for displaying oEmbed resources in an iFrame.
Namespace
Drupal\mediaCode
public function isSecure($url) {
if (!$url) {
return FALSE;
}
$url_host = parse_url($url, PHP_URL_HOST);
$system_host = parse_url($this->requestContext
->getCompleteBaseUrl(), PHP_URL_HOST);
// The URL is secure if its domain is not the same as the domain of the base
// URL of the current request.
return $url_host && $system_host && $url_host !== $system_host;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.