You are here

public static function Securepages::canAlterUrl in Secure Pages 8

Checks the URL to make sure it is a URL that can be altered.

Parameters

string $url: URL to check.

File

src/Securepages.php, line 215
Contains \Drupal\securepages\Securepages.

Class

Securepages
Utility class for global functionality.

Namespace

Drupal\securepages

Code

public static function canAlterUrl($url) {
  $base = Url::fromRoute('<front>', [], [
    'absolute' => TRUE,
  ])
    ->toString();
  return !UrlHelper::isExternal($url) || UrlHelper::externalIsLocal($url, $base);
}