You are here

protected static function Standard::getAllowedTags in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/editor/src/EditorXssFilter/Standard.php \Drupal\editor\EditorXssFilter\Standard::getAllowedTags()

Get all allowed tags from a restrictions data structure.

Parameters

array|FALSE $restrictions: Restrictions as returned by FilterInterface::getHTMLRestrictions().

Return value

array An array of allowed HTML tags.

See also

\Drupal\filter\Plugin\Filter\FilterInterface::getHTMLRestrictions()

1 call to Standard::getAllowedTags()
Standard::filterXss in core/modules/editor/src/EditorXssFilter/Standard.php
Filters HTML to prevent XSS attacks when a user edits it in a text editor.

File

core/modules/editor/src/EditorXssFilter/Standard.php, line 136
Contains \Drupal\editor\EditorXssFilter\Standard.

Class

Standard
Defines the standard text editor XSS filter.

Namespace

Drupal\editor\EditorXssFilter

Code

protected static function getAllowedTags($restrictions) {
  if ($restrictions === FALSE || !isset($restrictions['allowed'])) {
    return array();
  }
  $allowed_tags = array_keys($restrictions['allowed']);

  // Exclude the wildcard tag, which is used to set attribute restrictions on
  // all tags simultaneously.
  $allowed_tags = array_diff($allowed_tags, array(
    '*',
  ));
  return $allowed_tags;
}