Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. IFrameUrlHelper.php

function 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\media

Code

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;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal