![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/mautic.corals.io/vendor/exercise/htmlpurifier-bundle/src/Twig/ |
<?php namespace Exercise\HTMLPurifierBundle\Twig; use Exercise\HTMLPurifierBundle\HTMLPurifiersRegistryInterface; use Twig\Extension\RuntimeExtensionInterface; class HTMLPurifierRuntime implements RuntimeExtensionInterface { private $purifiersRegistry; public function __construct(HTMLPurifiersRegistryInterface $registry) { $this->purifiersRegistry = $registry; } /** * Filters the input through an \HTMLPurifier service. * * @param string|null $string The html string to purify * @param string $profile A configuration profile name * * @return string The purified html string */ public function purify(?string $string, string $profile = 'default'): string { if (null === $string) { return ''; } return $this->getHTMLPurifierForProfile($profile)->purify($string); } /** * Gets the HTMLPurifier service corresponding to the given profile. * * @throws \InvalidArgumentException If the profile does not exist */ private function getHTMLPurifierForProfile(string $profile): \HTMLPurifier { return $this->purifiersRegistry->get($profile); } }