Upgrade to 3.5.5
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user