You are here

public static function LinkitXss::descriptionFilter in Linkit 8.4

Same name and namespace in other branches
  1. 8.5 src/Utility/LinkitXss.php \Drupal\linkit\Utility\LinkitXss::descriptionFilter()

Description filter helper.

Parameters

$string: The string with raw HTML in it. It will be stripped of everything that can cause an XSS attack.

Return value

string An XSS safe version of $string, or an empty string if $string is not valid UTF-8.

See also

\Drupal\Component\Utility\Xss::filter()

3 calls to LinkitXss::descriptionFilter()
EntityMatcher::buildDescription in src/Plugin/Linkit/Matcher/EntityMatcher.php
Builds the description string used in the match array.
FileMatcher::buildDescription in src/Plugin/Linkit/Matcher/FileMatcher.php
Builds the description string used in the match array.
TermMatcher::buildDescription in src/Plugin/Linkit/Matcher/TermMatcher.php
Builds the description string used in the match array.

File

src/Utility/LinkitXss.php, line 30
Contains \Drupal\linkit\Utility\LinkitXss.

Class

LinkitXss
Extends the default XSS protection to simplify it for Linkits needs.

Namespace

Drupal\linkit\Utility

Code

public static function descriptionFilter($string) {
  return parent::filter($string, [
    'img',
  ] + Xss::getHtmlTagList());
}