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-theme-json-data.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* WP_Theme_JSON_Data class
[2] Fix | Delete
*
[3] Fix | Delete
* @package WordPress
[4] Fix | Delete
* @subpackage Theme
[5] Fix | Delete
* @since 6.1.0
[6] Fix | Delete
*/
[7] Fix | Delete
[8] Fix | Delete
/**
[9] Fix | Delete
* Class to provide access to update a theme.json structure.
[10] Fix | Delete
*/
[11] Fix | Delete
#[AllowDynamicProperties]
[12] Fix | Delete
class WP_Theme_JSON_Data {
[13] Fix | Delete
[14] Fix | Delete
/**
[15] Fix | Delete
* Container of the data to update.
[16] Fix | Delete
*
[17] Fix | Delete
* @since 6.1.0
[18] Fix | Delete
* @var WP_Theme_JSON
[19] Fix | Delete
*/
[20] Fix | Delete
private $theme_json = null;
[21] Fix | Delete
[22] Fix | Delete
/**
[23] Fix | Delete
* The origin of the data: default, theme, user, etc.
[24] Fix | Delete
*
[25] Fix | Delete
* @since 6.1.0
[26] Fix | Delete
* @var string
[27] Fix | Delete
*/
[28] Fix | Delete
private $origin = '';
[29] Fix | Delete
[30] Fix | Delete
/**
[31] Fix | Delete
* Constructor.
[32] Fix | Delete
*
[33] Fix | Delete
* @since 6.1.0
[34] Fix | Delete
*
[35] Fix | Delete
* @link https://developer.wordpress.org/block-editor/reference-guides/theme-json-reference/
[36] Fix | Delete
*
[37] Fix | Delete
* @param array $data Array following the theme.json specification.
[38] Fix | Delete
* @param string $origin The origin of the data: default, theme, user.
[39] Fix | Delete
*/
[40] Fix | Delete
public function __construct( $data = array( 'version' => WP_Theme_JSON::LATEST_SCHEMA ), $origin = 'theme' ) {
[41] Fix | Delete
$this->origin = $origin;
[42] Fix | Delete
$this->theme_json = new WP_Theme_JSON( $data, $this->origin );
[43] Fix | Delete
}
[44] Fix | Delete
[45] Fix | Delete
/**
[46] Fix | Delete
* Updates the theme.json with the the given data.
[47] Fix | Delete
*
[48] Fix | Delete
* @since 6.1.0
[49] Fix | Delete
*
[50] Fix | Delete
* @param array $new_data Array following the theme.json specification.
[51] Fix | Delete
*
[52] Fix | Delete
* @return WP_Theme_JSON_Data The own instance with access to the modified data.
[53] Fix | Delete
*/
[54] Fix | Delete
public function update_with( $new_data ) {
[55] Fix | Delete
$this->theme_json->merge( new WP_Theme_JSON( $new_data, $this->origin ) );
[56] Fix | Delete
return $this;
[57] Fix | Delete
}
[58] Fix | Delete
[59] Fix | Delete
/**
[60] Fix | Delete
* Returns an array containing the underlying data
[61] Fix | Delete
* following the theme.json specification.
[62] Fix | Delete
*
[63] Fix | Delete
* @since 6.1.0
[64] Fix | Delete
*
[65] Fix | Delete
* @return array
[66] Fix | Delete
*/
[67] Fix | Delete
public function get_data() {
[68] Fix | Delete
return $this->theme_json->get_raw_data();
[69] Fix | Delete
}
[70] Fix | Delete
[71] Fix | Delete
/**
[72] Fix | Delete
* Returns theme JSON object.
[73] Fix | Delete
*
[74] Fix | Delete
* @since 6.6.0
[75] Fix | Delete
*
[76] Fix | Delete
* @return WP_Theme_JSON The theme JSON structure stored in this data object.
[77] Fix | Delete
*/
[78] Fix | Delete
public function get_theme_json() {
[79] Fix | Delete
return $this->theme_json;
[80] Fix | Delete
}
[81] Fix | Delete
}
[82] Fix | Delete
[83] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function