update lock clucknut
All checks were successful
All checks were successful
This commit is contained in:
241
vendor/nette/utils/src/Utils/Html.php
vendored
241
vendor/nette/utils/src/Utils/Html.php
vendored
@@ -17,113 +17,113 @@
|
||||
/**
|
||||
* HTML helper.
|
||||
*
|
||||
* @property string|null $accept
|
||||
* @property string|null $accesskey
|
||||
* @property string|null $action
|
||||
* @property string|null $align
|
||||
* @property string|null $allow
|
||||
* @property string|null $alt
|
||||
* @property bool|null $async
|
||||
* @property string|null $autocapitalize
|
||||
* @property string|null $autocomplete
|
||||
* @property bool|null $autofocus
|
||||
* @property bool|null $autoplay
|
||||
* @property string|null $charset
|
||||
* @property bool|null $checked
|
||||
* @property string|null $cite
|
||||
* @property string|null $class
|
||||
* @property int|null $cols
|
||||
* @property int|null $colspan
|
||||
* @property string|null $content
|
||||
* @property bool|null $contenteditable
|
||||
* @property bool|null $controls
|
||||
* @property string|null $coords
|
||||
* @property string|null $crossorigin
|
||||
* @property string|null $data
|
||||
* @property string|null $datetime
|
||||
* @property string|null $decoding
|
||||
* @property bool|null $default
|
||||
* @property bool|null $defer
|
||||
* @property string|null $dir
|
||||
* @property string|null $dirname
|
||||
* @property bool|null $disabled
|
||||
* @property bool|null $download
|
||||
* @property string|null $draggable
|
||||
* @property string|null $dropzone
|
||||
* @property string|null $enctype
|
||||
* @property string|null $for
|
||||
* @property string|null $form
|
||||
* @property string|null $formaction
|
||||
* @property string|null $formenctype
|
||||
* @property string|null $formmethod
|
||||
* @property bool|null $formnovalidate
|
||||
* @property string|null $formtarget
|
||||
* @property string|null $headers
|
||||
* @property int|null $height
|
||||
* @property bool|null $hidden
|
||||
* @property float|null $high
|
||||
* @property string|null $href
|
||||
* @property string|null $hreflang
|
||||
* @property string|null $id
|
||||
* @property string|null $integrity
|
||||
* @property string|null $inputmode
|
||||
* @property bool|null $ismap
|
||||
* @property string|null $itemprop
|
||||
* @property string|null $kind
|
||||
* @property string|null $label
|
||||
* @property string|null $lang
|
||||
* @property string|null $list
|
||||
* @property bool|null $loop
|
||||
* @property float|null $low
|
||||
* @property float|null $max
|
||||
* @property int|null $maxlength
|
||||
* @property int|null $minlength
|
||||
* @property string|null $media
|
||||
* @property string|null $method
|
||||
* @property float|null $min
|
||||
* @property bool|null $multiple
|
||||
* @property bool|null $muted
|
||||
* @property string|null $name
|
||||
* @property bool|null $novalidate
|
||||
* @property bool|null $open
|
||||
* @property float|null $optimum
|
||||
* @property string|null $pattern
|
||||
* @property string|null $ping
|
||||
* @property string|null $placeholder
|
||||
* @property string|null $poster
|
||||
* @property string|null $preload
|
||||
* @property string|null $radiogroup
|
||||
* @property bool|null $readonly
|
||||
* @property string|null $rel
|
||||
* @property bool|null $required
|
||||
* @property bool|null $reversed
|
||||
* @property int|null $rows
|
||||
* @property int|null $rowspan
|
||||
* @property string|null $sandbox
|
||||
* @property string|null $scope
|
||||
* @property bool|null $selected
|
||||
* @property string|null $shape
|
||||
* @property int|null $size
|
||||
* @property string|null $sizes
|
||||
* @property string|null $slot
|
||||
* @property int|null $span
|
||||
* @property string|null $spellcheck
|
||||
* @property string|null $src
|
||||
* @property string|null $srcdoc
|
||||
* @property string|null $srclang
|
||||
* @property string|null $srcset
|
||||
* @property int|null $start
|
||||
* @property float|null $step
|
||||
* @property string|null $style
|
||||
* @property int|null $tabindex
|
||||
* @property string|null $target
|
||||
* @property string|null $title
|
||||
* @property string|null $translate
|
||||
* @property string|null $type
|
||||
* @property string|null $usemap
|
||||
* @property string|null $value
|
||||
* @property int|null $width
|
||||
* @property string|null $wrap
|
||||
* @property ?string $accept
|
||||
* @property ?string $accesskey
|
||||
* @property ?string $action
|
||||
* @property ?string $align
|
||||
* @property ?string $allow
|
||||
* @property ?string $alt
|
||||
* @property ?bool $async
|
||||
* @property ?string $autocapitalize
|
||||
* @property ?string $autocomplete
|
||||
* @property ?bool $autofocus
|
||||
* @property ?bool $autoplay
|
||||
* @property ?string $charset
|
||||
* @property ?bool $checked
|
||||
* @property ?string $cite
|
||||
* @property ?string $class
|
||||
* @property ?int $cols
|
||||
* @property ?int $colspan
|
||||
* @property ?string $content
|
||||
* @property ?bool $contenteditable
|
||||
* @property ?bool $controls
|
||||
* @property ?string $coords
|
||||
* @property ?string $crossorigin
|
||||
* @property ?string $data
|
||||
* @property ?string $datetime
|
||||
* @property ?string $decoding
|
||||
* @property ?bool $default
|
||||
* @property ?bool $defer
|
||||
* @property ?string $dir
|
||||
* @property ?string $dirname
|
||||
* @property ?bool $disabled
|
||||
* @property ?bool $download
|
||||
* @property ?string $draggable
|
||||
* @property ?string $dropzone
|
||||
* @property ?string $enctype
|
||||
* @property ?string $for
|
||||
* @property ?string $form
|
||||
* @property ?string $formaction
|
||||
* @property ?string $formenctype
|
||||
* @property ?string $formmethod
|
||||
* @property ?bool $formnovalidate
|
||||
* @property ?string $formtarget
|
||||
* @property ?string $headers
|
||||
* @property ?int $height
|
||||
* @property ?bool $hidden
|
||||
* @property ?float $high
|
||||
* @property ?string $href
|
||||
* @property ?string $hreflang
|
||||
* @property ?string $id
|
||||
* @property ?string $integrity
|
||||
* @property ?string $inputmode
|
||||
* @property ?bool $ismap
|
||||
* @property ?string $itemprop
|
||||
* @property ?string $kind
|
||||
* @property ?string $label
|
||||
* @property ?string $lang
|
||||
* @property ?string $list
|
||||
* @property ?bool $loop
|
||||
* @property ?float $low
|
||||
* @property ?float $max
|
||||
* @property ?int $maxlength
|
||||
* @property ?int $minlength
|
||||
* @property ?string $media
|
||||
* @property ?string $method
|
||||
* @property ?float $min
|
||||
* @property ?bool $multiple
|
||||
* @property ?bool $muted
|
||||
* @property ?string $name
|
||||
* @property ?bool $novalidate
|
||||
* @property ?bool $open
|
||||
* @property ?float $optimum
|
||||
* @property ?string $pattern
|
||||
* @property ?string $ping
|
||||
* @property ?string $placeholder
|
||||
* @property ?string $poster
|
||||
* @property ?string $preload
|
||||
* @property ?string $radiogroup
|
||||
* @property ?bool $readonly
|
||||
* @property ?string $rel
|
||||
* @property ?bool $required
|
||||
* @property ?bool $reversed
|
||||
* @property ?int $rows
|
||||
* @property ?int $rowspan
|
||||
* @property ?string $sandbox
|
||||
* @property ?string $scope
|
||||
* @property ?bool $selected
|
||||
* @property ?string $shape
|
||||
* @property ?int $size
|
||||
* @property ?string $sizes
|
||||
* @property ?string $slot
|
||||
* @property ?int $span
|
||||
* @property ?string $spellcheck
|
||||
* @property ?string $src
|
||||
* @property ?string $srcdoc
|
||||
* @property ?string $srclang
|
||||
* @property ?string $srcset
|
||||
* @property ?int $start
|
||||
* @property ?float $step
|
||||
* @property ?string $style
|
||||
* @property ?int $tabindex
|
||||
* @property ?string $target
|
||||
* @property ?string $title
|
||||
* @property ?string $translate
|
||||
* @property ?string $type
|
||||
* @property ?string $usemap
|
||||
* @property ?string $value
|
||||
* @property ?int $width
|
||||
* @property ?string $wrap
|
||||
*
|
||||
* @method self accept(?string $val)
|
||||
* @method self accesskey(?string $val, bool $state = null)
|
||||
@@ -230,20 +230,23 @@
|
||||
* @method self value(?string $val)
|
||||
* @method self width(?int $val)
|
||||
* @method self wrap(?string $val)
|
||||
*
|
||||
* @implements \IteratorAggregate<int, self|string>
|
||||
* @implements \ArrayAccess<int, self|string>
|
||||
*/
|
||||
class Html implements \ArrayAccess, \Countable, \IteratorAggregate, HtmlStringable
|
||||
{
|
||||
/** @var array<string, mixed> element's attributes */
|
||||
public array $attrs = [];
|
||||
|
||||
/** void elements */
|
||||
/** @var array<string, int> void elements */
|
||||
public static array $emptyElements = [
|
||||
'img' => 1, 'hr' => 1, 'br' => 1, 'input' => 1, 'meta' => 1, 'area' => 1, 'embed' => 1, 'keygen' => 1,
|
||||
'source' => 1, 'base' => 1, 'col' => 1, 'link' => 1, 'param' => 1, 'basefont' => 1, 'frame' => 1,
|
||||
'isindex' => 1, 'wbr' => 1, 'command' => 1, 'track' => 1,
|
||||
];
|
||||
|
||||
/** @var array<int, HtmlStringable|string> nodes */
|
||||
/** @var array<int, self|string> nodes */
|
||||
protected array $children = [];
|
||||
|
||||
/** element's name */
|
||||
@@ -254,7 +257,7 @@ class Html implements \ArrayAccess, \Countable, \IteratorAggregate, HtmlStringab
|
||||
|
||||
/**
|
||||
* Constructs new HTML element.
|
||||
* @param array|string $attrs element's attributes or plain text content
|
||||
* @param array<string, mixed>|string|null $attrs element's attributes or plain text content
|
||||
*/
|
||||
public static function el(?string $name = null, array|string|null $attrs = null): static
|
||||
{
|
||||
@@ -355,6 +358,7 @@ final public function isEmpty(): bool
|
||||
|
||||
/**
|
||||
* Sets multiple attributes.
|
||||
* @param array<string, mixed> $attrs
|
||||
*/
|
||||
public function addAttributes(array $attrs): static
|
||||
{
|
||||
@@ -417,6 +421,7 @@ public function removeAttribute(string $name): static
|
||||
|
||||
/**
|
||||
* Unsets element's attributes.
|
||||
* @param list<string> $attributes
|
||||
*/
|
||||
public function removeAttributes(array $attributes): static
|
||||
{
|
||||
@@ -466,6 +471,7 @@ final public function __unset(string $name): void
|
||||
|
||||
/**
|
||||
* Overloaded setter for element's attribute.
|
||||
* @param mixed[] $args
|
||||
*/
|
||||
final public function __call(string $m, array $args): mixed
|
||||
{
|
||||
@@ -496,6 +502,7 @@ final public function __call(string $m, array $args): mixed
|
||||
|
||||
/**
|
||||
* Special setter for element's attribute.
|
||||
* @param array<string, mixed> $query
|
||||
*/
|
||||
final public function href(string $path, array $query = []): static
|
||||
{
|
||||
@@ -594,6 +601,7 @@ public function addText(\Stringable|string|int|null $text): static
|
||||
|
||||
/**
|
||||
* Creates and adds a new Html child.
|
||||
* @param array<string, mixed>|string|null $attrs
|
||||
*/
|
||||
final public function create(string $name, array|string|null $attrs = null): static
|
||||
{
|
||||
@@ -621,7 +629,7 @@ public function insert(?int $index, HtmlStringable|string $child, bool $replace
|
||||
|
||||
/**
|
||||
* Inserts (replaces) child node (\ArrayAccess implementation).
|
||||
* @param int|null $index position or null for appending
|
||||
* @param ?int $index position or null for appending
|
||||
* @param Html|string $child Html node or raw HTML string
|
||||
*/
|
||||
final public function offsetSet($index, $child): void
|
||||
@@ -634,7 +642,7 @@ final public function offsetSet($index, $child): void
|
||||
* Returns child node (\ArrayAccess implementation).
|
||||
* @param int $index
|
||||
*/
|
||||
final public function offsetGet($index): HtmlStringable|string
|
||||
final public function offsetGet($index): self|string
|
||||
{
|
||||
return $this->children[$index];
|
||||
}
|
||||
@@ -682,7 +690,7 @@ public function removeChildren(): void
|
||||
|
||||
/**
|
||||
* Iterates over elements.
|
||||
* @return \ArrayIterator<int, HtmlStringable|string>
|
||||
* @return \ArrayIterator<int, self|string>
|
||||
*/
|
||||
final public function getIterator(): \ArrayIterator
|
||||
{
|
||||
@@ -692,6 +700,7 @@ final public function getIterator(): \ArrayIterator
|
||||
|
||||
/**
|
||||
* Returns all children.
|
||||
* @return array<int, self|string>
|
||||
*/
|
||||
final public function getChildren(): array
|
||||
{
|
||||
@@ -764,10 +773,6 @@ final public function endTag(): string
|
||||
*/
|
||||
final public function attributes(): string
|
||||
{
|
||||
if (!is_array($this->attrs)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$s = '';
|
||||
$attrs = $this->attrs;
|
||||
foreach ($attrs as $key => $value) {
|
||||
@@ -780,7 +785,7 @@ final public function attributes(): string
|
||||
continue;
|
||||
|
||||
} elseif (is_array($value)) {
|
||||
if (strncmp($key, 'data-', 5) === 0) {
|
||||
if (str_starts_with($key, 'data-')) {
|
||||
$value = Json::encode($value);
|
||||
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user