Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/wp-inclu...
File: class-wp-block-list.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Blocks API: WP_Block_List class
[2] Fix | Delete
*
[3] Fix | Delete
* @package WordPress
[4] Fix | Delete
* @since 5.5.0
[5] Fix | Delete
*/
[6] Fix | Delete
[7] Fix | Delete
/**
[8] Fix | Delete
* Class representing a list of block instances.
[9] Fix | Delete
*
[10] Fix | Delete
* @since 5.5.0
[11] Fix | Delete
*/
[12] Fix | Delete
#[AllowDynamicProperties]
[13] Fix | Delete
class WP_Block_List implements Iterator, ArrayAccess, Countable {
[14] Fix | Delete
[15] Fix | Delete
/**
[16] Fix | Delete
* Original array of parsed block data, or block instances.
[17] Fix | Delete
*
[18] Fix | Delete
* @since 5.5.0
[19] Fix | Delete
* @var array[]|WP_Block[]
[20] Fix | Delete
* @access protected
[21] Fix | Delete
*/
[22] Fix | Delete
protected $blocks;
[23] Fix | Delete
[24] Fix | Delete
/**
[25] Fix | Delete
* All available context of the current hierarchy.
[26] Fix | Delete
*
[27] Fix | Delete
* @since 5.5.0
[28] Fix | Delete
* @var array
[29] Fix | Delete
* @access protected
[30] Fix | Delete
*/
[31] Fix | Delete
protected $available_context;
[32] Fix | Delete
[33] Fix | Delete
/**
[34] Fix | Delete
* Block type registry to use in constructing block instances.
[35] Fix | Delete
*
[36] Fix | Delete
* @since 5.5.0
[37] Fix | Delete
* @var WP_Block_Type_Registry
[38] Fix | Delete
* @access protected
[39] Fix | Delete
*/
[40] Fix | Delete
protected $registry;
[41] Fix | Delete
[42] Fix | Delete
/**
[43] Fix | Delete
* Constructor.
[44] Fix | Delete
*
[45] Fix | Delete
* Populates object properties from the provided block instance argument.
[46] Fix | Delete
*
[47] Fix | Delete
* @since 5.5.0
[48] Fix | Delete
*
[49] Fix | Delete
* @param array[]|WP_Block[] $blocks Array of parsed block data, or block instances.
[50] Fix | Delete
* @param array $available_context Optional array of ancestry context values.
[51] Fix | Delete
* @param WP_Block_Type_Registry $registry Optional block type registry.
[52] Fix | Delete
*/
[53] Fix | Delete
public function __construct( $blocks, $available_context = array(), $registry = null ) {
[54] Fix | Delete
if ( ! $registry instanceof WP_Block_Type_Registry ) {
[55] Fix | Delete
$registry = WP_Block_Type_Registry::get_instance();
[56] Fix | Delete
}
[57] Fix | Delete
[58] Fix | Delete
$this->blocks = $blocks;
[59] Fix | Delete
$this->available_context = $available_context;
[60] Fix | Delete
$this->registry = $registry;
[61] Fix | Delete
}
[62] Fix | Delete
[63] Fix | Delete
/**
[64] Fix | Delete
* Returns true if a block exists by the specified block offset, or false
[65] Fix | Delete
* otherwise.
[66] Fix | Delete
*
[67] Fix | Delete
* @since 5.5.0
[68] Fix | Delete
*
[69] Fix | Delete
* @link https://www.php.net/manual/en/arrayaccess.offsetexists.php
[70] Fix | Delete
*
[71] Fix | Delete
* @param string $offset Offset of block to check for.
[72] Fix | Delete
* @return bool Whether block exists.
[73] Fix | Delete
*/
[74] Fix | Delete
#[ReturnTypeWillChange]
[75] Fix | Delete
public function offsetExists( $offset ) {
[76] Fix | Delete
return isset( $this->blocks[ $offset ] );
[77] Fix | Delete
}
[78] Fix | Delete
[79] Fix | Delete
/**
[80] Fix | Delete
* Returns the value by the specified block offset.
[81] Fix | Delete
*
[82] Fix | Delete
* @since 5.5.0
[83] Fix | Delete
*
[84] Fix | Delete
* @link https://www.php.net/manual/en/arrayaccess.offsetget.php
[85] Fix | Delete
*
[86] Fix | Delete
* @param string $offset Offset of block value to retrieve.
[87] Fix | Delete
* @return mixed|null Block value if exists, or null.
[88] Fix | Delete
*/
[89] Fix | Delete
#[ReturnTypeWillChange]
[90] Fix | Delete
public function offsetGet( $offset ) {
[91] Fix | Delete
$block = $this->blocks[ $offset ];
[92] Fix | Delete
[93] Fix | Delete
if ( isset( $block ) && is_array( $block ) ) {
[94] Fix | Delete
$block = new WP_Block( $block, $this->available_context, $this->registry );
[95] Fix | Delete
[96] Fix | Delete
$this->blocks[ $offset ] = $block;
[97] Fix | Delete
}
[98] Fix | Delete
[99] Fix | Delete
return $block;
[100] Fix | Delete
}
[101] Fix | Delete
[102] Fix | Delete
/**
[103] Fix | Delete
* Assign a block value by the specified block offset.
[104] Fix | Delete
*
[105] Fix | Delete
* @since 5.5.0
[106] Fix | Delete
*
[107] Fix | Delete
* @link https://www.php.net/manual/en/arrayaccess.offsetset.php
[108] Fix | Delete
*
[109] Fix | Delete
* @param string $offset Offset of block value to set.
[110] Fix | Delete
* @param mixed $value Block value.
[111] Fix | Delete
*/
[112] Fix | Delete
#[ReturnTypeWillChange]
[113] Fix | Delete
public function offsetSet( $offset, $value ) {
[114] Fix | Delete
if ( is_null( $offset ) ) {
[115] Fix | Delete
$this->blocks[] = $value;
[116] Fix | Delete
} else {
[117] Fix | Delete
$this->blocks[ $offset ] = $value;
[118] Fix | Delete
}
[119] Fix | Delete
}
[120] Fix | Delete
[121] Fix | Delete
/**
[122] Fix | Delete
* Unset a block.
[123] Fix | Delete
*
[124] Fix | Delete
* @since 5.5.0
[125] Fix | Delete
*
[126] Fix | Delete
* @link https://www.php.net/manual/en/arrayaccess.offsetunset.php
[127] Fix | Delete
*
[128] Fix | Delete
* @param string $offset Offset of block value to unset.
[129] Fix | Delete
*/
[130] Fix | Delete
#[ReturnTypeWillChange]
[131] Fix | Delete
public function offsetUnset( $offset ) {
[132] Fix | Delete
unset( $this->blocks[ $offset ] );
[133] Fix | Delete
}
[134] Fix | Delete
[135] Fix | Delete
/**
[136] Fix | Delete
* Rewinds back to the first element of the Iterator.
[137] Fix | Delete
*
[138] Fix | Delete
* @since 5.5.0
[139] Fix | Delete
*
[140] Fix | Delete
* @link https://www.php.net/manual/en/iterator.rewind.php
[141] Fix | Delete
*/
[142] Fix | Delete
#[ReturnTypeWillChange]
[143] Fix | Delete
public function rewind() {
[144] Fix | Delete
reset( $this->blocks );
[145] Fix | Delete
}
[146] Fix | Delete
[147] Fix | Delete
/**
[148] Fix | Delete
* Returns the current element of the block list.
[149] Fix | Delete
*
[150] Fix | Delete
* @since 5.5.0
[151] Fix | Delete
*
[152] Fix | Delete
* @link https://www.php.net/manual/en/iterator.current.php
[153] Fix | Delete
*
[154] Fix | Delete
* @return mixed Current element.
[155] Fix | Delete
*/
[156] Fix | Delete
#[ReturnTypeWillChange]
[157] Fix | Delete
public function current() {
[158] Fix | Delete
return $this->offsetGet( $this->key() );
[159] Fix | Delete
}
[160] Fix | Delete
[161] Fix | Delete
/**
[162] Fix | Delete
* Returns the key of the current element of the block list.
[163] Fix | Delete
*
[164] Fix | Delete
* @since 5.5.0
[165] Fix | Delete
*
[166] Fix | Delete
* @link https://www.php.net/manual/en/iterator.key.php
[167] Fix | Delete
*
[168] Fix | Delete
* @return mixed Key of the current element.
[169] Fix | Delete
*/
[170] Fix | Delete
#[ReturnTypeWillChange]
[171] Fix | Delete
public function key() {
[172] Fix | Delete
return key( $this->blocks );
[173] Fix | Delete
}
[174] Fix | Delete
[175] Fix | Delete
/**
[176] Fix | Delete
* Moves the current position of the block list to the next element.
[177] Fix | Delete
*
[178] Fix | Delete
* @since 5.5.0
[179] Fix | Delete
*
[180] Fix | Delete
* @link https://www.php.net/manual/en/iterator.next.php
[181] Fix | Delete
*/
[182] Fix | Delete
#[ReturnTypeWillChange]
[183] Fix | Delete
public function next() {
[184] Fix | Delete
next( $this->blocks );
[185] Fix | Delete
}
[186] Fix | Delete
[187] Fix | Delete
/**
[188] Fix | Delete
* Checks if current position is valid.
[189] Fix | Delete
*
[190] Fix | Delete
* @since 5.5.0
[191] Fix | Delete
*
[192] Fix | Delete
* @link https://www.php.net/manual/en/iterator.valid.php
[193] Fix | Delete
*/
[194] Fix | Delete
#[ReturnTypeWillChange]
[195] Fix | Delete
public function valid() {
[196] Fix | Delete
return null !== key( $this->blocks );
[197] Fix | Delete
}
[198] Fix | Delete
[199] Fix | Delete
/**
[200] Fix | Delete
* Returns the count of blocks in the list.
[201] Fix | Delete
*
[202] Fix | Delete
* @since 5.5.0
[203] Fix | Delete
*
[204] Fix | Delete
* @link https://www.php.net/manual/en/countable.count.php
[205] Fix | Delete
*
[206] Fix | Delete
* @return int Block count.
[207] Fix | Delete
*/
[208] Fix | Delete
#[ReturnTypeWillChange]
[209] Fix | Delete
public function count() {
[210] Fix | Delete
return count( $this->blocks );
[211] Fix | Delete
}
[212] Fix | Delete
}
[213] Fix | Delete
[214] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function