Add blueprints and fake content
This commit is contained in:
parent
1ff19bf38f
commit
8235816462
592 changed files with 22385 additions and 31535 deletions
|
@ -21,15 +21,14 @@
|
|||
"extra": {
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.3 || ~8.0.0",
|
||||
"laminas/laminas-zendframework-bridge": "^1.0"
|
||||
"php": "^7.3 || ~8.0.0 || ~8.1.0"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-iconv": "*",
|
||||
"ext-mbstring": "*"
|
||||
},
|
||||
"require-dev": {
|
||||
"laminas/laminas-coding-standard": "~1.0.0",
|
||||
"laminas/laminas-coding-standard": "~2.3.0",
|
||||
"phpunit/phpunit": "^9.3",
|
||||
"psalm/plugin-phpunit": "^0.12.2",
|
||||
"vimeo/psalm": "^3.16"
|
||||
|
@ -55,7 +54,7 @@
|
|||
"test": "phpunit --colors=always",
|
||||
"test-coverage": "phpunit --colors=always --coverage-clover clover.xml"
|
||||
},
|
||||
"replace": {
|
||||
"zendframework/zend-escaper": "^2.6.1"
|
||||
"conflict": {
|
||||
"zendframework/zend-escaper": "*"
|
||||
}
|
||||
}
|
||||
|
|
4170
kirby/vendor/laminas/laminas-escaper/composer.lock
generated
vendored
Normal file
4170
kirby/vendor/laminas/laminas-escaper/composer.lock
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
121
kirby/vendor/laminas/laminas-escaper/src/Escaper.php
vendored
121
kirby/vendor/laminas/laminas-escaper/src/Escaper.php
vendored
|
@ -1,13 +1,30 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @see https://github.com/laminas/laminas-escaper for the canonical source repository
|
||||
* @copyright https://github.com/laminas/laminas-escaper/blob/master/COPYRIGHT.md
|
||||
* @license https://github.com/laminas/laminas-escaper/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Laminas\Escaper;
|
||||
|
||||
use function bin2hex;
|
||||
use function ctype_digit;
|
||||
use function function_exists;
|
||||
use function hexdec;
|
||||
use function htmlspecialchars;
|
||||
use function iconv;
|
||||
use function in_array;
|
||||
use function mb_convert_encoding;
|
||||
use function ord;
|
||||
use function preg_match;
|
||||
use function preg_replace_callback;
|
||||
use function rawurlencode;
|
||||
use function sprintf;
|
||||
use function strlen;
|
||||
use function strtolower;
|
||||
use function strtoupper;
|
||||
use function substr;
|
||||
|
||||
use const ENT_QUOTES;
|
||||
use const ENT_SUBSTITUTE;
|
||||
|
||||
/**
|
||||
* Context specific methods for use in secure output escaping
|
||||
*/
|
||||
|
@ -24,10 +41,10 @@ class Escaper
|
|||
* @var array
|
||||
*/
|
||||
protected static $htmlNamedEntityMap = [
|
||||
34 => 'quot', // quotation mark
|
||||
38 => 'amp', // ampersand
|
||||
60 => 'lt', // less-than sign
|
||||
62 => 'gt', // greater-than sign
|
||||
34 => 'quot', // quotation mark
|
||||
38 => 'amp', // ampersand
|
||||
60 => 'lt', // less-than sign
|
||||
62 => 'gt', // greater-than sign
|
||||
];
|
||||
|
||||
/**
|
||||
|
@ -73,42 +90,61 @@ class Escaper
|
|||
* @var array
|
||||
*/
|
||||
protected $supportedEncodings = [
|
||||
'iso-8859-1', 'iso8859-1', 'iso-8859-5', 'iso8859-5',
|
||||
'iso-8859-15', 'iso8859-15', 'utf-8', 'cp866',
|
||||
'ibm866', '866', 'cp1251', 'windows-1251',
|
||||
'win-1251', '1251', 'cp1252', 'windows-1252',
|
||||
'1252', 'koi8-r', 'koi8-ru', 'koi8r',
|
||||
'big5', '950', 'gb2312', '936',
|
||||
'big5-hkscs', 'shift_jis', 'sjis', 'sjis-win',
|
||||
'cp932', '932', 'euc-jp', 'eucjp',
|
||||
'eucjp-win', 'macroman'
|
||||
'iso-8859-1',
|
||||
'iso8859-1',
|
||||
'iso-8859-5',
|
||||
'iso8859-5',
|
||||
'iso-8859-15',
|
||||
'iso8859-15',
|
||||
'utf-8',
|
||||
'cp866',
|
||||
'ibm866',
|
||||
'866',
|
||||
'cp1251',
|
||||
'windows-1251',
|
||||
'win-1251',
|
||||
'1251',
|
||||
'cp1252',
|
||||
'windows-1252',
|
||||
'1252',
|
||||
'koi8-r',
|
||||
'koi8-ru',
|
||||
'koi8r',
|
||||
'big5',
|
||||
'950',
|
||||
'gb2312',
|
||||
'936',
|
||||
'big5-hkscs',
|
||||
'shift_jis',
|
||||
'sjis',
|
||||
'sjis-win',
|
||||
'cp932',
|
||||
'932',
|
||||
'euc-jp',
|
||||
'eucjp',
|
||||
'eucjp-win',
|
||||
'macroman',
|
||||
];
|
||||
|
||||
/**
|
||||
* Constructor: Single parameter allows setting of global encoding for use by
|
||||
* the current object.
|
||||
*
|
||||
* @param string $encoding
|
||||
* @throws Exception\InvalidArgumentException
|
||||
*/
|
||||
public function __construct($encoding = null)
|
||||
public function __construct(?string $encoding = null)
|
||||
{
|
||||
if ($encoding !== null) {
|
||||
if (! is_string($encoding)) {
|
||||
throw new Exception\InvalidArgumentException(
|
||||
get_class($this) . ' constructor parameter must be a string, received ' . gettype($encoding)
|
||||
);
|
||||
}
|
||||
if ($encoding === '') {
|
||||
throw new Exception\InvalidArgumentException(
|
||||
get_class($this) . ' constructor parameter does not allow a blank value'
|
||||
static::class . ' constructor parameter does not allow a blank value'
|
||||
);
|
||||
}
|
||||
|
||||
$encoding = strtolower($encoding);
|
||||
if (! in_array($encoding, $this->supportedEncodings)) {
|
||||
throw new Exception\InvalidArgumentException(
|
||||
'Value of \'' . $encoding . '\' passed to ' . get_class($this)
|
||||
'Value of \'' . $encoding . '\' passed to ' . static::class
|
||||
. ' constructor parameter is invalid. Provide an encoding supported by htmlspecialchars()'
|
||||
);
|
||||
}
|
||||
|
@ -139,10 +175,9 @@ class Escaper
|
|||
* Escape a string for the HTML Body context where there are very few characters
|
||||
* of special meaning. Internally this will use htmlspecialchars().
|
||||
*
|
||||
* @param string $string
|
||||
* @return string
|
||||
*/
|
||||
public function escapeHtml($string)
|
||||
public function escapeHtml(string $string)
|
||||
{
|
||||
return htmlspecialchars($string, $this->htmlSpecialCharsFlags, $this->encoding);
|
||||
}
|
||||
|
@ -152,10 +187,9 @@ class Escaper
|
|||
* to escape that are not covered by htmlspecialchars() to cover cases where an attribute
|
||||
* might be unquoted or quoted illegally (e.g. backticks are valid quotes for IE).
|
||||
*
|
||||
* @param string $string
|
||||
* @return string
|
||||
*/
|
||||
public function escapeHtmlAttr($string)
|
||||
public function escapeHtmlAttr(string $string)
|
||||
{
|
||||
$string = $this->toUtf8($string);
|
||||
if ($string === '' || ctype_digit($string)) {
|
||||
|
@ -175,10 +209,9 @@ class Escaper
|
|||
* Backslash escaping is not used as it still leaves the escaped character as-is and so
|
||||
* is not useful in a HTML context.
|
||||
*
|
||||
* @param string $string
|
||||
* @return string
|
||||
*/
|
||||
public function escapeJs($string)
|
||||
public function escapeJs(string $string)
|
||||
{
|
||||
$string = $this->toUtf8($string);
|
||||
if ($string === '' || ctype_digit($string)) {
|
||||
|
@ -194,10 +227,9 @@ class Escaper
|
|||
* an entire URI - only a subcomponent being inserted. The function is a simple proxy
|
||||
* to rawurlencode() which now implements RFC 3986 since PHP 5.3 completely.
|
||||
*
|
||||
* @param string $string
|
||||
* @return string
|
||||
*/
|
||||
public function escapeUrl($string)
|
||||
public function escapeUrl(string $string)
|
||||
{
|
||||
return rawurlencode($string);
|
||||
}
|
||||
|
@ -206,10 +238,9 @@ class Escaper
|
|||
* Escape a string for the CSS context. CSS escaping can be applied to any string being
|
||||
* inserted into CSS and escapes everything except alphanumerics.
|
||||
*
|
||||
* @param string $string
|
||||
* @return string
|
||||
*/
|
||||
public function escapeCss($string)
|
||||
public function escapeCss(string $string)
|
||||
{
|
||||
$string = $this->toUtf8($string);
|
||||
if ($string === '' || ctype_digit($string)) {
|
||||
|
@ -236,7 +267,8 @@ class Escaper
|
|||
* The following replaces characters undefined in HTML with the
|
||||
* hex entity for the Unicode replacement character.
|
||||
*/
|
||||
if (($ord <= 0x1f && $chr != "\t" && $chr != "\n" && $chr != "\r")
|
||||
if (
|
||||
($ord <= 0x1f && $chr !== "\t" && $chr !== "\n" && $chr !== "\r")
|
||||
|| ($ord >= 0x7f && $ord <= 0x9f)
|
||||
) {
|
||||
return '�';
|
||||
|
@ -276,7 +308,7 @@ class Escaper
|
|||
protected function jsMatcher($matches)
|
||||
{
|
||||
$chr = $matches[0];
|
||||
if (strlen($chr) == 1) {
|
||||
if (strlen($chr) === 1) {
|
||||
return sprintf('\\x%02X', ord($chr));
|
||||
}
|
||||
$chr = $this->convertEncoding($chr, 'UTF-16BE', 'UTF-8');
|
||||
|
@ -285,7 +317,7 @@ class Escaper
|
|||
return sprintf('\\u%04s', $hex);
|
||||
}
|
||||
$highSurrogate = substr($hex, 0, 4);
|
||||
$lowSurrogate = substr($hex, 4, 4);
|
||||
$lowSurrogate = substr($hex, 4, 4);
|
||||
return sprintf('\\u%04s\\u%04s', $highSurrogate, $lowSurrogate);
|
||||
}
|
||||
|
||||
|
@ -299,7 +331,7 @@ class Escaper
|
|||
protected function cssMatcher($matches)
|
||||
{
|
||||
$chr = $matches[0];
|
||||
if (strlen($chr) == 1) {
|
||||
if (strlen($chr) === 1) {
|
||||
$ord = ord($chr);
|
||||
} else {
|
||||
$chr = $this->convertEncoding($chr, 'UTF-32BE', 'UTF-8');
|
||||
|
@ -310,7 +342,6 @@ class Escaper
|
|||
|
||||
/**
|
||||
* Converts a string to UTF-8 from the base encoding. The base encoding is set via this
|
||||
* class' constructor.
|
||||
*
|
||||
* @param string $string
|
||||
* @throws Exception\RuntimeException
|
||||
|
@ -335,7 +366,7 @@ class Escaper
|
|||
|
||||
/**
|
||||
* Converts a string from UTF-8 to the base encoding. The base encoding is set via this
|
||||
* class' constructor.
|
||||
*
|
||||
* @param string $string
|
||||
* @return string
|
||||
*/
|
||||
|
@ -356,7 +387,7 @@ class Escaper
|
|||
*/
|
||||
protected function isUtf8($string)
|
||||
{
|
||||
return ($string === '' || preg_match('/^./su', $string));
|
||||
return $string === '' || preg_match('/^./su', $string);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -377,7 +408,7 @@ class Escaper
|
|||
$result = mb_convert_encoding($string, $to, $from);
|
||||
} else {
|
||||
throw new Exception\RuntimeException(
|
||||
get_class($this)
|
||||
static::class
|
||||
. ' requires either the iconv or mbstring extension to be installed'
|
||||
. ' when escaping for non UTF-8 strings.'
|
||||
);
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @see https://github.com/laminas/laminas-escaper for the canonical source repository
|
||||
* @copyright https://github.com/laminas/laminas-escaper/blob/master/COPYRIGHT.md
|
||||
* @license https://github.com/laminas/laminas-escaper/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Laminas\Escaper\Exception;
|
||||
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @see https://github.com/laminas/laminas-escaper for the canonical source repository
|
||||
* @copyright https://github.com/laminas/laminas-escaper/blob/master/COPYRIGHT.md
|
||||
* @license https://github.com/laminas/laminas-escaper/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Laminas\Escaper\Exception;
|
||||
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @see https://github.com/laminas/laminas-escaper for the canonical source repository
|
||||
* @copyright https://github.com/laminas/laminas-escaper/blob/master/COPYRIGHT.md
|
||||
* @license https://github.com/laminas/laminas-escaper/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Laminas\Escaper\Exception;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue