unrestricted example


  private static function fromObjectWithHtmlRestrictions(object $object): HTMLRestrictions {
    if (!method_exists($object, 'getHTMLRestrictions')) {
      throw new \InvalidArgumentException();
    }

    $restrictions = $object->getHTMLRestrictions();
    if ($restrictions === FALSE || $restrictions === []) {
      return self::unrestricted();
    }

    // When allowing all tags on an attribute, transform FilterHtml output from     // ['tag' => ['*'=> TRUE]] to ['tag' => TRUE]     $allowed = $restrictions['allowed'];
    foreach ($allowed as $element => $attributes) {
      if (is_array($attributes) && isset($attributes['*']) && $attributes['*'] === TRUE) {
        $allowed[$element] = TRUE;
      }
    }

    
Home | Imprint | This part of the site doesn't use cookies.