public static function UrlHelper::filterBadProtocol in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/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.
4 calls to UrlHelper::filterBadProtocol()
- CommentTokenReplaceTest::testCommentTokenReplacement in core/
modules/ comment/ src/ Tests/ CommentTokenReplaceTest.php - Creates a comment, then tests the tokens generated from it.
- UrlHelperTest::testFilterBadProtocol in core/
tests/ Drupal/ Tests/ Component/ Utility/ UrlHelperTest.php - Tests bad protocol filtering and escaping.
- Xss::attributes in core/
lib/ Drupal/ Component/ Utility/ Xss.php - Processes a string of HTML attributes.
- XssUnitTest::testBadProtocolStripping in core/
modules/ system/ src/ Tests/ Common/ XssUnitTest.php - Checks that harmful protocols are stripped.
File
- core/
lib/ Drupal/ Component/ Utility/ UrlHelper.php, line 271 - Contains \Drupal\Component\Utility\UrlHelper.
Class
- UrlHelper
- Helper class URL based methods.
Namespace
Drupal\Component\UtilityCode
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));
}