You are here

public static function UrlHelper::filterBadProtocol in Service Container 7.2

Same name and namespace in other branches
  1. 7 lib/Drupal/Component/Utility/UrlHelper.php \Drupal\Component\Utility\UrlHelper::filterBadProtocol()

Processes an HTML attribute value and strips dangerous protocols from URLs.

Parameters

string $string: The string with the attribute value.

Return value

string Cleaned up and HTML-escaped version of $string.

1 call to UrlHelper::filterBadProtocol()
Xss::attributes in lib/Drupal/Component/Utility/Xss.php
Processes a string of HTML attributes.

File

lib/Drupal/Component/Utility/UrlHelper.php, line 271
Contains \Drupal\Component\Utility\UrlHelper.

Class

UrlHelper
Helper class URL based methods.

Namespace

Drupal\Component\Utility

Code

public static function filterBadProtocol($string) {

  // Get the plain text representation of the attribute value (i.e. its
  // meaning).
  $string = Html::decodeEntities($string);
  return Html::escape(static::stripDangerousProtocols($string));
}