UrlHelper::filterBadProtocol

public static UrlHelper::filterBadProtocol($string)

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.

File

core/lib/Drupal/Component/Utility/UrlHelper.php, line 274

Class

UrlHelper
Helper class URL based methods.

Namespace

Drupal\Component\Utility

Code

1
2
3
4
5
6
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));
}
doc_Drupal
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.