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

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../public_h.../wp-inclu...
File: block-editor.php
'__unstableType' => 'presets',
[500] Fix | Delete
'isGlobalStyles' => true,
[501] Fix | Delete
),
[502] Fix | Delete
array(
[503] Fix | Delete
'css' => 'presets',
[504] Fix | Delete
'__unstableType' => 'presets',
[505] Fix | Delete
'isGlobalStyles' => true,
[506] Fix | Delete
),
[507] Fix | Delete
);
[508] Fix | Delete
foreach ( $presets as $preset_style ) {
[509] Fix | Delete
$actual_css = wp_get_global_stylesheet( array( $preset_style['css'] ) );
[510] Fix | Delete
if ( '' !== $actual_css ) {
[511] Fix | Delete
$preset_style['css'] = $actual_css;
[512] Fix | Delete
$global_styles[] = $preset_style;
[513] Fix | Delete
}
[514] Fix | Delete
}
[515] Fix | Delete
[516] Fix | Delete
if ( wp_theme_has_theme_json() ) {
[517] Fix | Delete
$block_classes = array(
[518] Fix | Delete
'css' => 'styles',
[519] Fix | Delete
'__unstableType' => 'theme',
[520] Fix | Delete
'isGlobalStyles' => true,
[521] Fix | Delete
);
[522] Fix | Delete
$actual_css = wp_get_global_stylesheet( array( $block_classes['css'] ) );
[523] Fix | Delete
if ( '' !== $actual_css ) {
[524] Fix | Delete
$block_classes['css'] = $actual_css;
[525] Fix | Delete
$global_styles[] = $block_classes;
[526] Fix | Delete
}
[527] Fix | Delete
[528] Fix | Delete
/*
[529] Fix | Delete
* Add the custom CSS as a separate stylesheet so any invalid CSS
[530] Fix | Delete
* entered by users does not break other global styles.
[531] Fix | Delete
*/
[532] Fix | Delete
$global_styles[] = array(
[533] Fix | Delete
'css' => wp_get_global_styles_custom_css(),
[534] Fix | Delete
'__unstableType' => 'user',
[535] Fix | Delete
'isGlobalStyles' => true,
[536] Fix | Delete
);
[537] Fix | Delete
} else {
[538] Fix | Delete
// If there is no `theme.json` file, ensure base layout styles are still available.
[539] Fix | Delete
$block_classes = array(
[540] Fix | Delete
'css' => 'base-layout-styles',
[541] Fix | Delete
'__unstableType' => 'base-layout',
[542] Fix | Delete
'isGlobalStyles' => true,
[543] Fix | Delete
);
[544] Fix | Delete
$actual_css = wp_get_global_stylesheet( array( $block_classes['css'] ) );
[545] Fix | Delete
if ( '' !== $actual_css ) {
[546] Fix | Delete
$block_classes['css'] = $actual_css;
[547] Fix | Delete
$global_styles[] = $block_classes;
[548] Fix | Delete
}
[549] Fix | Delete
}
[550] Fix | Delete
[551] Fix | Delete
$editor_settings['styles'] = array_merge( $global_styles, get_block_editor_theme_styles() );
[552] Fix | Delete
[553] Fix | Delete
$editor_settings['__experimentalFeatures'] = wp_get_global_settings();
[554] Fix | Delete
// These settings may need to be updated based on data coming from theme.json sources.
[555] Fix | Delete
if ( isset( $editor_settings['__experimentalFeatures']['color']['palette'] ) ) {
[556] Fix | Delete
$colors_by_origin = $editor_settings['__experimentalFeatures']['color']['palette'];
[557] Fix | Delete
$editor_settings['colors'] = isset( $colors_by_origin['custom'] ) ?
[558] Fix | Delete
$colors_by_origin['custom'] : (
[559] Fix | Delete
isset( $colors_by_origin['theme'] ) ?
[560] Fix | Delete
$colors_by_origin['theme'] :
[561] Fix | Delete
$colors_by_origin['default']
[562] Fix | Delete
);
[563] Fix | Delete
}
[564] Fix | Delete
if ( isset( $editor_settings['__experimentalFeatures']['color']['gradients'] ) ) {
[565] Fix | Delete
$gradients_by_origin = $editor_settings['__experimentalFeatures']['color']['gradients'];
[566] Fix | Delete
$editor_settings['gradients'] = isset( $gradients_by_origin['custom'] ) ?
[567] Fix | Delete
$gradients_by_origin['custom'] : (
[568] Fix | Delete
isset( $gradients_by_origin['theme'] ) ?
[569] Fix | Delete
$gradients_by_origin['theme'] :
[570] Fix | Delete
$gradients_by_origin['default']
[571] Fix | Delete
);
[572] Fix | Delete
}
[573] Fix | Delete
if ( isset( $editor_settings['__experimentalFeatures']['typography']['fontSizes'] ) ) {
[574] Fix | Delete
$font_sizes_by_origin = $editor_settings['__experimentalFeatures']['typography']['fontSizes'];
[575] Fix | Delete
$editor_settings['fontSizes'] = isset( $font_sizes_by_origin['custom'] ) ?
[576] Fix | Delete
$font_sizes_by_origin['custom'] : (
[577] Fix | Delete
isset( $font_sizes_by_origin['theme'] ) ?
[578] Fix | Delete
$font_sizes_by_origin['theme'] :
[579] Fix | Delete
$font_sizes_by_origin['default']
[580] Fix | Delete
);
[581] Fix | Delete
}
[582] Fix | Delete
if ( isset( $editor_settings['__experimentalFeatures']['color']['custom'] ) ) {
[583] Fix | Delete
$editor_settings['disableCustomColors'] = ! $editor_settings['__experimentalFeatures']['color']['custom'];
[584] Fix | Delete
unset( $editor_settings['__experimentalFeatures']['color']['custom'] );
[585] Fix | Delete
}
[586] Fix | Delete
if ( isset( $editor_settings['__experimentalFeatures']['color']['customGradient'] ) ) {
[587] Fix | Delete
$editor_settings['disableCustomGradients'] = ! $editor_settings['__experimentalFeatures']['color']['customGradient'];
[588] Fix | Delete
unset( $editor_settings['__experimentalFeatures']['color']['customGradient'] );
[589] Fix | Delete
}
[590] Fix | Delete
if ( isset( $editor_settings['__experimentalFeatures']['typography']['customFontSize'] ) ) {
[591] Fix | Delete
$editor_settings['disableCustomFontSizes'] = ! $editor_settings['__experimentalFeatures']['typography']['customFontSize'];
[592] Fix | Delete
unset( $editor_settings['__experimentalFeatures']['typography']['customFontSize'] );
[593] Fix | Delete
}
[594] Fix | Delete
if ( isset( $editor_settings['__experimentalFeatures']['typography']['lineHeight'] ) ) {
[595] Fix | Delete
$editor_settings['enableCustomLineHeight'] = $editor_settings['__experimentalFeatures']['typography']['lineHeight'];
[596] Fix | Delete
unset( $editor_settings['__experimentalFeatures']['typography']['lineHeight'] );
[597] Fix | Delete
}
[598] Fix | Delete
if ( isset( $editor_settings['__experimentalFeatures']['spacing']['units'] ) ) {
[599] Fix | Delete
$editor_settings['enableCustomUnits'] = $editor_settings['__experimentalFeatures']['spacing']['units'];
[600] Fix | Delete
unset( $editor_settings['__experimentalFeatures']['spacing']['units'] );
[601] Fix | Delete
}
[602] Fix | Delete
if ( isset( $editor_settings['__experimentalFeatures']['spacing']['padding'] ) ) {
[603] Fix | Delete
$editor_settings['enableCustomSpacing'] = $editor_settings['__experimentalFeatures']['spacing']['padding'];
[604] Fix | Delete
unset( $editor_settings['__experimentalFeatures']['spacing']['padding'] );
[605] Fix | Delete
}
[606] Fix | Delete
if ( isset( $editor_settings['__experimentalFeatures']['spacing']['customSpacingSize'] ) ) {
[607] Fix | Delete
$editor_settings['disableCustomSpacingSizes'] = ! $editor_settings['__experimentalFeatures']['spacing']['customSpacingSize'];
[608] Fix | Delete
unset( $editor_settings['__experimentalFeatures']['spacing']['customSpacingSize'] );
[609] Fix | Delete
}
[610] Fix | Delete
[611] Fix | Delete
if ( isset( $editor_settings['__experimentalFeatures']['spacing']['spacingSizes'] ) ) {
[612] Fix | Delete
$spacing_sizes_by_origin = $editor_settings['__experimentalFeatures']['spacing']['spacingSizes'];
[613] Fix | Delete
$editor_settings['spacingSizes'] = isset( $spacing_sizes_by_origin['custom'] ) ?
[614] Fix | Delete
$spacing_sizes_by_origin['custom'] : (
[615] Fix | Delete
isset( $spacing_sizes_by_origin['theme'] ) ?
[616] Fix | Delete
$spacing_sizes_by_origin['theme'] :
[617] Fix | Delete
$spacing_sizes_by_origin['default']
[618] Fix | Delete
);
[619] Fix | Delete
}
[620] Fix | Delete
[621] Fix | Delete
$editor_settings['__unstableResolvedAssets'] = _wp_get_iframed_editor_assets();
[622] Fix | Delete
$editor_settings['__unstableIsBlockBasedTheme'] = wp_is_block_theme();
[623] Fix | Delete
$editor_settings['localAutosaveInterval'] = 15;
[624] Fix | Delete
$editor_settings['disableLayoutStyles'] = current_theme_supports( 'disable-layout-styles' );
[625] Fix | Delete
$editor_settings['__experimentalDiscussionSettings'] = array(
[626] Fix | Delete
'commentOrder' => get_option( 'comment_order' ),
[627] Fix | Delete
'commentsPerPage' => get_option( 'comments_per_page' ),
[628] Fix | Delete
'defaultCommentsPage' => get_option( 'default_comments_page' ),
[629] Fix | Delete
'pageComments' => get_option( 'page_comments' ),
[630] Fix | Delete
'threadComments' => get_option( 'thread_comments' ),
[631] Fix | Delete
'threadCommentsDepth' => get_option( 'thread_comments_depth' ),
[632] Fix | Delete
'defaultCommentStatus' => get_option( 'default_comment_status' ),
[633] Fix | Delete
'avatarURL' => get_avatar_url(
[634] Fix | Delete
'',
[635] Fix | Delete
array(
[636] Fix | Delete
'size' => 96,
[637] Fix | Delete
'force_default' => true,
[638] Fix | Delete
'default' => get_option( 'avatar_default' ),
[639] Fix | Delete
)
[640] Fix | Delete
),
[641] Fix | Delete
);
[642] Fix | Delete
[643] Fix | Delete
$post_content_block_attributes = wp_get_post_content_block_attributes();
[644] Fix | Delete
[645] Fix | Delete
if ( isset( $post_content_block_attributes ) ) {
[646] Fix | Delete
$editor_settings['postContentAttributes'] = $post_content_block_attributes;
[647] Fix | Delete
}
[648] Fix | Delete
[649] Fix | Delete
/**
[650] Fix | Delete
* Filters the settings to pass to the block editor for all editor type.
[651] Fix | Delete
*
[652] Fix | Delete
* @since 5.8.0
[653] Fix | Delete
*
[654] Fix | Delete
* @param array $editor_settings Default editor settings.
[655] Fix | Delete
* @param WP_Block_Editor_Context $block_editor_context The current block editor context.
[656] Fix | Delete
*/
[657] Fix | Delete
$editor_settings = apply_filters( 'block_editor_settings_all', $editor_settings, $block_editor_context );
[658] Fix | Delete
[659] Fix | Delete
if ( ! empty( $block_editor_context->post ) ) {
[660] Fix | Delete
$post = $block_editor_context->post;
[661] Fix | Delete
[662] Fix | Delete
/**
[663] Fix | Delete
* Filters the settings to pass to the block editor.
[664] Fix | Delete
*
[665] Fix | Delete
* @since 5.0.0
[666] Fix | Delete
* @deprecated 5.8.0 Use the {@see 'block_editor_settings_all'} filter instead.
[667] Fix | Delete
*
[668] Fix | Delete
* @param array $editor_settings Default editor settings.
[669] Fix | Delete
* @param WP_Post $post Post being edited.
[670] Fix | Delete
*/
[671] Fix | Delete
$editor_settings = apply_filters_deprecated( 'block_editor_settings', array( $editor_settings, $post ), '5.8.0', 'block_editor_settings_all' );
[672] Fix | Delete
}
[673] Fix | Delete
[674] Fix | Delete
return $editor_settings;
[675] Fix | Delete
}
[676] Fix | Delete
[677] Fix | Delete
/**
[678] Fix | Delete
* Preloads common data used with the block editor by specifying an array of
[679] Fix | Delete
* REST API paths that will be preloaded for a given block editor context.
[680] Fix | Delete
*
[681] Fix | Delete
* @since 5.8.0
[682] Fix | Delete
*
[683] Fix | Delete
* @global WP_Post $post Global post object.
[684] Fix | Delete
* @global WP_Scripts $wp_scripts The WP_Scripts object for printing scripts.
[685] Fix | Delete
* @global WP_Styles $wp_styles The WP_Styles object for printing styles.
[686] Fix | Delete
*
[687] Fix | Delete
* @param (string|string[])[] $preload_paths List of paths to preload.
[688] Fix | Delete
* @param WP_Block_Editor_Context $block_editor_context The current block editor context.
[689] Fix | Delete
*/
[690] Fix | Delete
function block_editor_rest_api_preload( array $preload_paths, $block_editor_context ) {
[691] Fix | Delete
global $post, $wp_scripts, $wp_styles;
[692] Fix | Delete
[693] Fix | Delete
/**
[694] Fix | Delete
* Filters the array of REST API paths that will be used to preloaded common data for the block editor.
[695] Fix | Delete
*
[696] Fix | Delete
* @since 5.8.0
[697] Fix | Delete
*
[698] Fix | Delete
* @param (string|string[])[] $preload_paths Array of paths to preload.
[699] Fix | Delete
* @param WP_Block_Editor_Context $block_editor_context The current block editor context.
[700] Fix | Delete
*/
[701] Fix | Delete
$preload_paths = apply_filters( 'block_editor_rest_api_preload_paths', $preload_paths, $block_editor_context );
[702] Fix | Delete
[703] Fix | Delete
if ( ! empty( $block_editor_context->post ) ) {
[704] Fix | Delete
$selected_post = $block_editor_context->post;
[705] Fix | Delete
[706] Fix | Delete
/**
[707] Fix | Delete
* Filters the array of paths that will be preloaded.
[708] Fix | Delete
*
[709] Fix | Delete
* Preload common data by specifying an array of REST API paths that will be preloaded.
[710] Fix | Delete
*
[711] Fix | Delete
* @since 5.0.0
[712] Fix | Delete
* @deprecated 5.8.0 Use the {@see 'block_editor_rest_api_preload_paths'} filter instead.
[713] Fix | Delete
*
[714] Fix | Delete
* @param (string|string[])[] $preload_paths Array of paths to preload.
[715] Fix | Delete
* @param WP_Post $selected_post Post being edited.
[716] Fix | Delete
*/
[717] Fix | Delete
$preload_paths = apply_filters_deprecated( 'block_editor_preload_paths', array( $preload_paths, $selected_post ), '5.8.0', 'block_editor_rest_api_preload_paths' );
[718] Fix | Delete
}
[719] Fix | Delete
[720] Fix | Delete
if ( empty( $preload_paths ) ) {
[721] Fix | Delete
return;
[722] Fix | Delete
}
[723] Fix | Delete
[724] Fix | Delete
/*
[725] Fix | Delete
* Ensure the global $post, $wp_scripts, and $wp_styles remain the same after
[726] Fix | Delete
* API data is preloaded.
[727] Fix | Delete
* Because API preloading can call the_content and other filters, plugins
[728] Fix | Delete
* can unexpectedly modify the global $post or enqueue assets which are not
[729] Fix | Delete
* intended for the block editor.
[730] Fix | Delete
*/
[731] Fix | Delete
$backup_global_post = ! empty( $post ) ? clone $post : $post;
[732] Fix | Delete
$backup_wp_scripts = ! empty( $wp_scripts ) ? clone $wp_scripts : $wp_scripts;
[733] Fix | Delete
$backup_wp_styles = ! empty( $wp_styles ) ? clone $wp_styles : $wp_styles;
[734] Fix | Delete
[735] Fix | Delete
foreach ( $preload_paths as &$path ) {
[736] Fix | Delete
if ( is_string( $path ) && ! str_starts_with( $path, '/' ) ) {
[737] Fix | Delete
$path = '/' . $path;
[738] Fix | Delete
continue;
[739] Fix | Delete
}
[740] Fix | Delete
[741] Fix | Delete
if ( is_array( $path ) && is_string( $path[0] ) && ! str_starts_with( $path[0], '/' ) ) {
[742] Fix | Delete
$path[0] = '/' . $path[0];
[743] Fix | Delete
}
[744] Fix | Delete
}
[745] Fix | Delete
[746] Fix | Delete
unset( $path );
[747] Fix | Delete
[748] Fix | Delete
$preload_data = array_reduce(
[749] Fix | Delete
$preload_paths,
[750] Fix | Delete
'rest_preload_api_request',
[751] Fix | Delete
array()
[752] Fix | Delete
);
[753] Fix | Delete
[754] Fix | Delete
// Restore the global $post, $wp_scripts, and $wp_styles as they were before API preloading.
[755] Fix | Delete
$post = $backup_global_post;
[756] Fix | Delete
$wp_scripts = $backup_wp_scripts;
[757] Fix | Delete
$wp_styles = $backup_wp_styles;
[758] Fix | Delete
[759] Fix | Delete
wp_add_inline_script(
[760] Fix | Delete
'wp-api-fetch',
[761] Fix | Delete
sprintf(
[762] Fix | Delete
'wp.apiFetch.use( wp.apiFetch.createPreloadingMiddleware( %s ) );',
[763] Fix | Delete
wp_json_encode( $preload_data )
[764] Fix | Delete
),
[765] Fix | Delete
'after'
[766] Fix | Delete
);
[767] Fix | Delete
}
[768] Fix | Delete
[769] Fix | Delete
/**
[770] Fix | Delete
* Creates an array of theme styles to load into the block editor.
[771] Fix | Delete
*
[772] Fix | Delete
* @since 5.8.0
[773] Fix | Delete
*
[774] Fix | Delete
* @global array $editor_styles
[775] Fix | Delete
*
[776] Fix | Delete
* @return array An array of theme styles for the block editor.
[777] Fix | Delete
*/
[778] Fix | Delete
function get_block_editor_theme_styles() {
[779] Fix | Delete
global $editor_styles;
[780] Fix | Delete
[781] Fix | Delete
$styles = array();
[782] Fix | Delete
[783] Fix | Delete
if ( $editor_styles && current_theme_supports( 'editor-styles' ) ) {
[784] Fix | Delete
foreach ( $editor_styles as $style ) {
[785] Fix | Delete
if ( preg_match( '~^(https?:)?//~', $style ) ) {
[786] Fix | Delete
$response = wp_remote_get( $style );
[787] Fix | Delete
if ( ! is_wp_error( $response ) ) {
[788] Fix | Delete
$styles[] = array(
[789] Fix | Delete
'css' => wp_remote_retrieve_body( $response ),
[790] Fix | Delete
'__unstableType' => 'theme',
[791] Fix | Delete
'isGlobalStyles' => false,
[792] Fix | Delete
);
[793] Fix | Delete
}
[794] Fix | Delete
} else {
[795] Fix | Delete
$file = get_theme_file_path( $style );
[796] Fix | Delete
if ( is_file( $file ) ) {
[797] Fix | Delete
$styles[] = array(
[798] Fix | Delete
'css' => file_get_contents( $file ),
[799] Fix | Delete
'baseURL' => get_theme_file_uri( $style ),
[800] Fix | Delete
'__unstableType' => 'theme',
[801] Fix | Delete
'isGlobalStyles' => false,
[802] Fix | Delete
);
[803] Fix | Delete
}
[804] Fix | Delete
}
[805] Fix | Delete
}
[806] Fix | Delete
}
[807] Fix | Delete
[808] Fix | Delete
return $styles;
[809] Fix | Delete
}
[810] Fix | Delete
[811] Fix | Delete
/**
[812] Fix | Delete
* Returns the classic theme supports settings for block editor.
[813] Fix | Delete
*
[814] Fix | Delete
* @since 6.2.0
[815] Fix | Delete
* @since 6.6.0 Add support for 'editor-spacing-sizes' theme support.
[816] Fix | Delete
*
[817] Fix | Delete
* @return array The classic theme supports settings.
[818] Fix | Delete
*/
[819] Fix | Delete
function get_classic_theme_supports_block_editor_settings() {
[820] Fix | Delete
$theme_settings = array(
[821] Fix | Delete
'disableCustomColors' => get_theme_support( 'disable-custom-colors' ),
[822] Fix | Delete
'disableCustomFontSizes' => get_theme_support( 'disable-custom-font-sizes' ),
[823] Fix | Delete
'disableCustomGradients' => get_theme_support( 'disable-custom-gradients' ),
[824] Fix | Delete
'disableLayoutStyles' => get_theme_support( 'disable-layout-styles' ),
[825] Fix | Delete
'enableCustomLineHeight' => get_theme_support( 'custom-line-height' ),
[826] Fix | Delete
'enableCustomSpacing' => get_theme_support( 'custom-spacing' ),
[827] Fix | Delete
'enableCustomUnits' => get_theme_support( 'custom-units' ),
[828] Fix | Delete
);
[829] Fix | Delete
[830] Fix | Delete
// Theme settings.
[831] Fix | Delete
$color_palette = current( (array) get_theme_support( 'editor-color-palette' ) );
[832] Fix | Delete
if ( false !== $color_palette ) {
[833] Fix | Delete
$theme_settings['colors'] = $color_palette;
[834] Fix | Delete
}
[835] Fix | Delete
[836] Fix | Delete
$font_sizes = current( (array) get_theme_support( 'editor-font-sizes' ) );
[837] Fix | Delete
if ( false !== $font_sizes ) {
[838] Fix | Delete
$theme_settings['fontSizes'] = $font_sizes;
[839] Fix | Delete
}
[840] Fix | Delete
[841] Fix | Delete
$gradient_presets = current( (array) get_theme_support( 'editor-gradient-presets' ) );
[842] Fix | Delete
if ( false !== $gradient_presets ) {
[843] Fix | Delete
$theme_settings['gradients'] = $gradient_presets;
[844] Fix | Delete
}
[845] Fix | Delete
[846] Fix | Delete
$spacing_sizes = current( (array) get_theme_support( 'editor-spacing-sizes' ) );
[847] Fix | Delete
if ( false !== $spacing_sizes ) {
[848] Fix | Delete
$theme_settings['spacingSizes'] = $spacing_sizes;
[849] Fix | Delete
}
[850] Fix | Delete
[851] Fix | Delete
return $theme_settings;
[852] Fix | Delete
}
[853] Fix | Delete
[854] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function