Upgrade to 3.5.5

This commit is contained in:
Bastian Allgeier
2021-05-11 11:55:32 +02:00
parent de3560f3d6
commit efeff45192
146 changed files with 2008 additions and 1075 deletions

View File

@@ -23,6 +23,13 @@ use Laminas\Escaper\Escaper;
*/
class Escape
{
/**
* The internal singleton escaper instance
*
* @var \Laminas\Escaper\Escaper
*/
protected static $escaper;
/**
* Escape common HTML attributes data
*
@@ -43,7 +50,7 @@ class Escape
*/
public static function attr($string)
{
return (new Escaper('utf-8'))->escapeHtmlAttr($string);
return static::escaper()->escapeHtmlAttr($string);
}
/**
@@ -64,7 +71,17 @@ class Escape
*/
public static function css($string)
{
return (new Escaper('utf-8'))->escapeCss($string);
return static::escaper()->escapeCss($string);
}
/**
* Get the escaper instance (and create if needed)
*
* @return \Laminas\Escaper\Escaper
*/
protected static function escaper()
{
return static::$escaper = static::$escaper ?? new Escaper('utf-8');
}
/**
@@ -84,7 +101,7 @@ class Escape
*/
public static function html($string)
{
return (new Escaper('utf-8'))->escapeHtml($string);
return static::escaper()->escapeHtml($string);
}
/**
@@ -102,7 +119,7 @@ class Escape
*/
public static function js($string)
{
return (new Escaper('utf-8'))->escapeJs($string);
return static::escaper()->escapeJs($string);
}
/**