Miscellaneous fixes (#15162)

This commit is contained in:
Tony Murray
2023-07-25 18:08:10 -05:00
committed by GitHub
parent ffffdd2663
commit 3908bddb49
15 changed files with 44 additions and 34 deletions

View File

@@ -58,13 +58,15 @@ class Clean
* Clean a string for display in an html page.
* For use in non-blade pages
*
* @param string $value
* @param string|null $value
* @param array $purifier_config (key, value pair)
* @return string
*/
public static function html($value, $purifier_config = [])
public static function html($value, $purifier_config = []): string
{
static $purifier;
if (empty($value)) {
return '';
}
// If $purifier_config is non-empty then we don't want
// to convert html tags and allow these to be controlled
@@ -73,6 +75,8 @@ class Clean
$value = htmlentities($value);
}
static $purifier;
if (! $purifier instanceof HTMLPurifier) {
// initialize HTML Purifier here since this is the only user
$p_config = HTMLPurifier_Config::createDefault();