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.../httpdocs/clone/wp-conte.../plugins/classic-...
File: classic-editor.php
<label for="classic-editor-allow-sites"><?php _e( 'Allow site admins to change settings', 'classic-editor' ); ?></label>
[500] Fix | Delete
<p class="description"><?php _e( 'By default the block editor is replaced with the classic editor and users cannot switch editors.', 'classic-editor' ); ?></p>
[501] Fix | Delete
</td>
[502] Fix | Delete
</tr>
[503] Fix | Delete
</table>
[504] Fix | Delete
<?php
[505] Fix | Delete
}
[506] Fix | Delete
[507] Fix | Delete
public static function save_network_settings() {
[508] Fix | Delete
if (
[509] Fix | Delete
isset( $_POST['classic-editor-network-settings'] ) &&
[510] Fix | Delete
current_user_can( 'manage_network_options' ) &&
[511] Fix | Delete
wp_verify_nonce( $_POST['classic-editor-network-settings'], 'allow-site-admin-settings' ) // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
[512] Fix | Delete
) {
[513] Fix | Delete
if ( isset( $_POST['classic-editor-replace'] ) && $_POST['classic-editor-replace'] === 'block' ) {
[514] Fix | Delete
update_network_option( null, 'classic-editor-replace', 'block' );
[515] Fix | Delete
} else {
[516] Fix | Delete
update_network_option( null, 'classic-editor-replace', 'classic' );
[517] Fix | Delete
}
[518] Fix | Delete
if ( isset( $_POST['classic-editor-allow-sites'] ) && $_POST['classic-editor-allow-sites'] === 'allow' ) {
[519] Fix | Delete
update_network_option( null, 'classic-editor-allow-sites', 'allow' );
[520] Fix | Delete
} else {
[521] Fix | Delete
update_network_option( null, 'classic-editor-allow-sites', 'disallow' );
[522] Fix | Delete
}
[523] Fix | Delete
}
[524] Fix | Delete
}
[525] Fix | Delete
[526] Fix | Delete
/**
[527] Fix | Delete
* Add a hidden field in edit-form-advanced.php
[528] Fix | Delete
* to help redirect back to the classic editor on saving.
[529] Fix | Delete
*/
[530] Fix | Delete
public static function add_redirect_helper() {
[531] Fix | Delete
?>
[532] Fix | Delete
<input type="hidden" name="classic-editor" value="" />
[533] Fix | Delete
<?php
[534] Fix | Delete
}
[535] Fix | Delete
[536] Fix | Delete
/**
[537] Fix | Delete
* Remember when the classic editor was used to edit a post.
[538] Fix | Delete
*/
[539] Fix | Delete
public static function remember_classic_editor( $post ) {
[540] Fix | Delete
$post_type = get_post_type( $post );
[541] Fix | Delete
[542] Fix | Delete
if ( $post_type && post_type_supports( $post_type, 'editor' ) ) {
[543] Fix | Delete
self::remember( $post->ID, 'classic-editor' );
[544] Fix | Delete
}
[545] Fix | Delete
}
[546] Fix | Delete
[547] Fix | Delete
/**
[548] Fix | Delete
* Remember when the block editor was used to edit a post.
[549] Fix | Delete
*/
[550] Fix | Delete
public static function remember_block_editor( $editor_settings, $context ) {
[551] Fix | Delete
if ( is_a( $context, 'WP_Post' ) ) {
[552] Fix | Delete
$post = $context;
[553] Fix | Delete
} elseif ( ! empty( $context->post ) ) {
[554] Fix | Delete
$post = $context->post;
[555] Fix | Delete
} else {
[556] Fix | Delete
return $editor_settings;
[557] Fix | Delete
}
[558] Fix | Delete
[559] Fix | Delete
$post_type = get_post_type( $post );
[560] Fix | Delete
[561] Fix | Delete
if ( $post_type && self::can_edit_post_type( $post_type ) ) {
[562] Fix | Delete
self::remember( $post->ID, 'block-editor' );
[563] Fix | Delete
}
[564] Fix | Delete
[565] Fix | Delete
return $editor_settings;
[566] Fix | Delete
}
[567] Fix | Delete
[568] Fix | Delete
private static function remember( $post_id, $editor ) {
[569] Fix | Delete
if ( get_post_meta( $post_id, 'classic-editor-remember', true ) !== $editor ) {
[570] Fix | Delete
update_post_meta( $post_id, 'classic-editor-remember', $editor );
[571] Fix | Delete
}
[572] Fix | Delete
}
[573] Fix | Delete
[574] Fix | Delete
/**
[575] Fix | Delete
* Choose which editor to use for a post.
[576] Fix | Delete
*
[577] Fix | Delete
* Passes through `$which_editor` for block editor (it's sets to `true` but may be changed by another plugin).
[578] Fix | Delete
*
[579] Fix | Delete
* @uses `use_block_editor_for_post` filter.
[580] Fix | Delete
*
[581] Fix | Delete
* @param boolean $use_block_editor True for block editor, false for classic editor.
[582] Fix | Delete
* @param WP_Post $post The post being edited.
[583] Fix | Delete
* @return boolean True for block editor, false for classic editor.
[584] Fix | Delete
*/
[585] Fix | Delete
public static function choose_editor( $use_block_editor, $post ) {
[586] Fix | Delete
$settings = self::get_settings();
[587] Fix | Delete
$editors = self::get_enabled_editors_for_post( $post );
[588] Fix | Delete
[589] Fix | Delete
// If no editor is supported, pass through `$use_block_editor`.
[590] Fix | Delete
if ( ! $editors['block_editor'] && ! $editors['classic_editor'] ) {
[591] Fix | Delete
return $use_block_editor;
[592] Fix | Delete
}
[593] Fix | Delete
[594] Fix | Delete
// Open the default editor when no $post and for "Add New" links,
[595] Fix | Delete
// or the alternate editor when the user is switching editors.
[596] Fix | Delete
// phpcs:disable WordPress.Security.NonceVerification.Recommended
[597] Fix | Delete
if ( empty( $post->ID ) || $post->post_status === 'auto-draft' ) {
[598] Fix | Delete
if (
[599] Fix | Delete
( $settings['editor'] === 'classic' && ! isset( $_GET['classic-editor__forget'] ) ) || // Add New
[600] Fix | Delete
( isset( $_GET['classic-editor'] ) && isset( $_GET['classic-editor__forget'] ) ) // Switch to classic editor when no draft post.
[601] Fix | Delete
) {
[602] Fix | Delete
$use_block_editor = false;
[603] Fix | Delete
}
[604] Fix | Delete
} elseif ( self::is_classic( $post->ID ) ) {
[605] Fix | Delete
$use_block_editor = false;
[606] Fix | Delete
}
[607] Fix | Delete
// phpcs:enable WordPress.Security.NonceVerification.Recommended
[608] Fix | Delete
[609] Fix | Delete
// Enforce the editor if set by plugins.
[610] Fix | Delete
if ( $use_block_editor && ! $editors['block_editor'] ) {
[611] Fix | Delete
$use_block_editor = false;
[612] Fix | Delete
} elseif ( ! $use_block_editor && ! $editors['classic_editor'] && $editors['block_editor'] ) {
[613] Fix | Delete
$use_block_editor = true;
[614] Fix | Delete
}
[615] Fix | Delete
[616] Fix | Delete
return $use_block_editor;
[617] Fix | Delete
}
[618] Fix | Delete
[619] Fix | Delete
/**
[620] Fix | Delete
* Keep the `classic-editor` query arg through redirects when saving posts.
[621] Fix | Delete
*/
[622] Fix | Delete
public static function redirect_location( $location ) {
[623] Fix | Delete
if (
[624] Fix | Delete
isset( $_REQUEST['classic-editor'] ) || // phpcs:ignore WordPress.Security.NonceVerification.Recommended
[625] Fix | Delete
( isset( $_POST['_wp_http_referer'] ) && strpos( $_POST['_wp_http_referer'], '&classic-editor' ) !== false ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing
[626] Fix | Delete
) {
[627] Fix | Delete
$location = add_query_arg( 'classic-editor', '', $location );
[628] Fix | Delete
}
[629] Fix | Delete
[630] Fix | Delete
return $location;
[631] Fix | Delete
}
[632] Fix | Delete
[633] Fix | Delete
/**
[634] Fix | Delete
* Keep the `classic-editor` query arg when looking at revisions.
[635] Fix | Delete
*/
[636] Fix | Delete
public static function get_edit_post_link( $url ) {
[637] Fix | Delete
$settings = self::get_settings();
[638] Fix | Delete
[639] Fix | Delete
if ( isset( $_REQUEST['classic-editor'] ) || $settings['editor'] === 'classic' ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
[640] Fix | Delete
$url = add_query_arg( 'classic-editor', '', $url );
[641] Fix | Delete
}
[642] Fix | Delete
[643] Fix | Delete
return $url;
[644] Fix | Delete
}
[645] Fix | Delete
[646] Fix | Delete
public static function add_meta_box( $post_type, $post ) {
[647] Fix | Delete
$editors = self::get_enabled_editors_for_post( $post );
[648] Fix | Delete
[649] Fix | Delete
if ( ! $editors['block_editor'] || ! $editors['classic_editor'] ) {
[650] Fix | Delete
// Editors cannot be switched.
[651] Fix | Delete
return;
[652] Fix | Delete
}
[653] Fix | Delete
[654] Fix | Delete
$id = 'classic-editor-switch-editor';
[655] Fix | Delete
$title = __( 'Editor', 'classic-editor' );
[656] Fix | Delete
$callback = array( __CLASS__, 'do_meta_box' );
[657] Fix | Delete
$args = array(
[658] Fix | Delete
'__back_compat_meta_box' => true,
[659] Fix | Delete
);
[660] Fix | Delete
[661] Fix | Delete
add_meta_box( $id, $title, $callback, null, 'side', 'default', $args );
[662] Fix | Delete
}
[663] Fix | Delete
[664] Fix | Delete
public static function do_meta_box( $post ) {
[665] Fix | Delete
$edit_url = get_edit_post_link( $post->ID, 'raw' );
[666] Fix | Delete
[667] Fix | Delete
// Switching to block editor.
[668] Fix | Delete
$edit_url = remove_query_arg( 'classic-editor', $edit_url );
[669] Fix | Delete
// Forget the previous value when going to a specific editor.
[670] Fix | Delete
$edit_url = add_query_arg( 'classic-editor__forget', '', $edit_url );
[671] Fix | Delete
[672] Fix | Delete
?>
[673] Fix | Delete
<p style="margin: 1em 0;">
[674] Fix | Delete
<a href="<?php echo esc_url( $edit_url ); ?>"><?php _e( 'Switch to block editor', 'classic-editor' ); ?></a>
[675] Fix | Delete
</p>
[676] Fix | Delete
<?php
[677] Fix | Delete
}
[678] Fix | Delete
[679] Fix | Delete
public static function enqueue_block_editor_scripts() {
[680] Fix | Delete
// get_enabled_editors_for_post() needs a WP_Post or post_ID.
[681] Fix | Delete
if ( empty( $GLOBALS['post'] ) ) {
[682] Fix | Delete
return;
[683] Fix | Delete
}
[684] Fix | Delete
[685] Fix | Delete
$editors = self::get_enabled_editors_for_post( $GLOBALS['post'] );
[686] Fix | Delete
[687] Fix | Delete
if ( ! $editors['classic_editor'] ) {
[688] Fix | Delete
// Editor cannot be switched.
[689] Fix | Delete
return;
[690] Fix | Delete
}
[691] Fix | Delete
[692] Fix | Delete
wp_enqueue_script(
[693] Fix | Delete
'classic-editor-plugin',
[694] Fix | Delete
plugins_url( 'js/block-editor-plugin.js', __FILE__ ),
[695] Fix | Delete
array( 'wp-element', 'wp-components', 'lodash' ),
[696] Fix | Delete
'1.4',
[697] Fix | Delete
true
[698] Fix | Delete
);
[699] Fix | Delete
[700] Fix | Delete
wp_localize_script(
[701] Fix | Delete
'classic-editor-plugin',
[702] Fix | Delete
'classicEditorPluginL10n',
[703] Fix | Delete
array( 'linkText' => __( 'Switch to classic editor', 'classic-editor' ) )
[704] Fix | Delete
);
[705] Fix | Delete
}
[706] Fix | Delete
[707] Fix | Delete
/**
[708] Fix | Delete
* Add a link to the settings on the Plugins screen.
[709] Fix | Delete
*/
[710] Fix | Delete
public static function add_settings_link( $links, $file ) {
[711] Fix | Delete
$settings = self::get_settings();
[712] Fix | Delete
[713] Fix | Delete
if ( $file === 'classic-editor/classic-editor.php' && ! $settings['hide-settings-ui'] && current_user_can( 'manage_options' ) ) {
[714] Fix | Delete
if ( current_filter() === 'plugin_action_links' ) {
[715] Fix | Delete
$url = admin_url( 'options-writing.php#classic-editor-options' );
[716] Fix | Delete
} else {
[717] Fix | Delete
$url = admin_url( '/network/settings.php#classic-editor-options' );
[718] Fix | Delete
}
[719] Fix | Delete
[720] Fix | Delete
// Prevent warnings in PHP 7.0+ when a plugin uses this filter incorrectly.
[721] Fix | Delete
$links = (array) $links;
[722] Fix | Delete
$links[] = sprintf( '<a href="%s">%s</a>', $url, __( 'Settings', 'classic-editor' ) );
[723] Fix | Delete
}
[724] Fix | Delete
[725] Fix | Delete
return $links;
[726] Fix | Delete
}
[727] Fix | Delete
[728] Fix | Delete
private static function can_edit_post_type( $post_type ) {
[729] Fix | Delete
$can_edit = false;
[730] Fix | Delete
[731] Fix | Delete
if ( function_exists( 'gutenberg_can_edit_post_type' ) ) {
[732] Fix | Delete
$can_edit = gutenberg_can_edit_post_type( $post_type );
[733] Fix | Delete
} elseif ( function_exists( 'use_block_editor_for_post_type' ) ) {
[734] Fix | Delete
$can_edit = use_block_editor_for_post_type( $post_type );
[735] Fix | Delete
}
[736] Fix | Delete
[737] Fix | Delete
return $can_edit;
[738] Fix | Delete
}
[739] Fix | Delete
[740] Fix | Delete
/**
[741] Fix | Delete
* Checks which editors are enabled for the post type.
[742] Fix | Delete
*
[743] Fix | Delete
* @param string $post_type The post type.
[744] Fix | Delete
* @return array Associative array of the editors and whether they are enabled for the post type.
[745] Fix | Delete
*/
[746] Fix | Delete
private static function get_enabled_editors_for_post_type( $post_type ) {
[747] Fix | Delete
if ( isset( self::$supported_post_types[ $post_type ] ) ) {
[748] Fix | Delete
return self::$supported_post_types[ $post_type ];
[749] Fix | Delete
}
[750] Fix | Delete
[751] Fix | Delete
$classic_editor = post_type_supports( $post_type, 'editor' );
[752] Fix | Delete
$block_editor = self::can_edit_post_type( $post_type );
[753] Fix | Delete
[754] Fix | Delete
$editors = array(
[755] Fix | Delete
'classic_editor' => $classic_editor,
[756] Fix | Delete
'block_editor' => $block_editor,
[757] Fix | Delete
);
[758] Fix | Delete
[759] Fix | Delete
/**
[760] Fix | Delete
* Filters the editors that are enabled for the post type.
[761] Fix | Delete
*
[762] Fix | Delete
* @param array $editors Associative array of the editors and whether they are enabled for the post type.
[763] Fix | Delete
* @param string $post_type The post type.
[764] Fix | Delete
*/
[765] Fix | Delete
$editors = apply_filters( 'classic_editor_enabled_editors_for_post_type', $editors, $post_type );
[766] Fix | Delete
self::$supported_post_types[ $post_type ] = $editors;
[767] Fix | Delete
[768] Fix | Delete
return $editors;
[769] Fix | Delete
}
[770] Fix | Delete
[771] Fix | Delete
/**
[772] Fix | Delete
* Checks which editors are enabled for the post.
[773] Fix | Delete
*
[774] Fix | Delete
* @param WP_Post $post The post object.
[775] Fix | Delete
* @return array Associative array of the editors and whether they are enabled for the post.
[776] Fix | Delete
*/
[777] Fix | Delete
private static function get_enabled_editors_for_post( $post ) {
[778] Fix | Delete
$post_type = get_post_type( $post );
[779] Fix | Delete
[780] Fix | Delete
if ( ! $post_type ) {
[781] Fix | Delete
return array(
[782] Fix | Delete
'classic_editor' => false,
[783] Fix | Delete
'block_editor' => false,
[784] Fix | Delete
);
[785] Fix | Delete
}
[786] Fix | Delete
[787] Fix | Delete
$editors = self::get_enabled_editors_for_post_type( $post_type );
[788] Fix | Delete
[789] Fix | Delete
/**
[790] Fix | Delete
* Filters the editors that are enabled for the post.
[791] Fix | Delete
*
[792] Fix | Delete
* @param array $editors Associative array of the editors and whether they are enabled for the post.
[793] Fix | Delete
* @param WP_Post $post The post object.
[794] Fix | Delete
*/
[795] Fix | Delete
return apply_filters( 'classic_editor_enabled_editors_for_post', $editors, $post );
[796] Fix | Delete
}
[797] Fix | Delete
[798] Fix | Delete
/**
[799] Fix | Delete
* Adds links to the post/page screens to edit any post or page in
[800] Fix | Delete
* the classic editor or block editor.
[801] Fix | Delete
*
[802] Fix | Delete
* @param array $actions Post actions.
[803] Fix | Delete
* @param WP_Post $post Edited post.
[804] Fix | Delete
* @return array Updated post actions.
[805] Fix | Delete
*/
[806] Fix | Delete
public static function add_edit_links( $actions, $post ) {
[807] Fix | Delete
// This is in Gutenberg, don't duplicate it.
[808] Fix | Delete
if ( array_key_exists( 'classic', $actions ) ) {
[809] Fix | Delete
unset( $actions['classic'] );
[810] Fix | Delete
}
[811] Fix | Delete
[812] Fix | Delete
if ( ! array_key_exists( 'edit', $actions ) ) {
[813] Fix | Delete
return $actions;
[814] Fix | Delete
}
[815] Fix | Delete
[816] Fix | Delete
$edit_url = get_edit_post_link( $post->ID, 'raw' );
[817] Fix | Delete
[818] Fix | Delete
if ( ! $edit_url ) {
[819] Fix | Delete
return $actions;
[820] Fix | Delete
}
[821] Fix | Delete
[822] Fix | Delete
$editors = self::get_enabled_editors_for_post( $post );
[823] Fix | Delete
[824] Fix | Delete
// Do not show the links if only one editor is available.
[825] Fix | Delete
if ( ! $editors['classic_editor'] || ! $editors['block_editor'] ) {
[826] Fix | Delete
return $actions;
[827] Fix | Delete
}
[828] Fix | Delete
[829] Fix | Delete
// Forget the previous value when going to a specific editor.
[830] Fix | Delete
$edit_url = add_query_arg( 'classic-editor__forget', '', $edit_url );
[831] Fix | Delete
[832] Fix | Delete
// Build the edit actions. See also: WP_Posts_List_Table::handle_row_actions().
[833] Fix | Delete
$title = _draft_or_post_title( $post->ID );
[834] Fix | Delete
[835] Fix | Delete
// Link to the block editor.
[836] Fix | Delete
$url = remove_query_arg( 'classic-editor', $edit_url );
[837] Fix | Delete
$text = _x( 'Edit (block editor)', 'Editor Name', 'classic-editor' );
[838] Fix | Delete
/* translators: %s: post title */
[839] Fix | Delete
$label = sprintf( __( 'Edit &#8220;%s&#8221; in the block editor', 'classic-editor' ), $title );
[840] Fix | Delete
$edit_block = sprintf( '<a href="%s" aria-label="%s">%s</a>', esc_url( $url ), esc_attr( $label ), $text );
[841] Fix | Delete
[842] Fix | Delete
// Link to the classic editor.
[843] Fix | Delete
$url = add_query_arg( 'classic-editor', '', $edit_url );
[844] Fix | Delete
$text = _x( 'Edit (classic editor)', 'Editor Name', 'classic-editor' );
[845] Fix | Delete
/* translators: %s: post title */
[846] Fix | Delete
$label = sprintf( __( 'Edit &#8220;%s&#8221; in the classic editor', 'classic-editor' ), $title );
[847] Fix | Delete
$edit_classic = sprintf( '<a href="%s" aria-label="%s">%s</a>', esc_url( $url ), esc_attr( $label ), $text );
[848] Fix | Delete
[849] Fix | Delete
$edit_actions = array(
[850] Fix | Delete
'classic-editor-block' => $edit_block,
[851] Fix | Delete
'classic-editor-classic' => $edit_classic,
[852] Fix | Delete
);
[853] Fix | Delete
[854] Fix | Delete
// Insert the new Edit actions instead of the Edit action.
[855] Fix | Delete
$edit_offset = array_search( 'edit', array_keys( $actions ), true );
[856] Fix | Delete
array_splice( $actions, $edit_offset, 1, $edit_actions );
[857] Fix | Delete
[858] Fix | Delete
return $actions;
[859] Fix | Delete
}
[860] Fix | Delete
[861] Fix | Delete
/**
[862] Fix | Delete
* Show the editor that will be used in a "post state" in the Posts list table.
[863] Fix | Delete
*/
[864] Fix | Delete
public static function add_post_state( $post_states, $post ) {
[865] Fix | Delete
if ( get_post_status( $post ) === 'trash' ) {
[866] Fix | Delete
return $post_states;
[867] Fix | Delete
}
[868] Fix | Delete
[869] Fix | Delete
$editors = self::get_enabled_editors_for_post( $post );
[870] Fix | Delete
[871] Fix | Delete
if ( ! $editors['classic_editor'] && ! $editors['block_editor'] ) {
[872] Fix | Delete
return $post_states;
[873] Fix | Delete
} elseif ( $editors['classic_editor'] && ! $editors['block_editor'] ) {
[874] Fix | Delete
// Forced to classic editor.
[875] Fix | Delete
$state = '<span class="classic-editor-forced-state">' . _x( 'classic editor', 'Editor Name', 'classic-editor' ) . '</span>';
[876] Fix | Delete
} elseif ( ! $editors['classic_editor'] && $editors['block_editor'] ) {
[877] Fix | Delete
// Forced to block editor.
[878] Fix | Delete
$state = '<span class="classic-editor-forced-state">' . _x( 'block editor', 'Editor Name', 'classic-editor' ) . '</span>';
[879] Fix | Delete
} else {
[880] Fix | Delete
$last_editor = get_post_meta( $post->ID, 'classic-editor-remember', true );
[881] Fix | Delete
[882] Fix | Delete
if ( $last_editor ) {
[883] Fix | Delete
$is_classic = ( $last_editor === 'classic-editor' );
[884] Fix | Delete
} elseif ( ! empty( $post->post_content ) ) {
[885] Fix | Delete
$is_classic = ! self::has_blocks( $post->post_content );
[886] Fix | Delete
} else {
[887] Fix | Delete
$settings = self::get_settings();
[888] Fix | Delete
$is_classic = ( $settings['editor'] === 'classic' );
[889] Fix | Delete
}
[890] Fix | Delete
[891] Fix | Delete
$state = $is_classic ? _x( 'Classic editor', 'Editor Name', 'classic-editor' ) : _x( 'Block editor', 'Editor Name', 'classic-editor' );
[892] Fix | Delete
}
[893] Fix | Delete
[894] Fix | Delete
// Fix PHP 7+ warnings if another plugin returns unexpected type.
[895] Fix | Delete
$post_states = (array) $post_states;
[896] Fix | Delete
$post_states['classic-editor-plugin'] = $state;
[897] Fix | Delete
[898] Fix | Delete
return $post_states;
[899] Fix | Delete
}
[900] Fix | Delete
[901] Fix | Delete
public static function add_edit_php_inline_style() {
[902] Fix | Delete
?>
[903] Fix | Delete
<style>
[904] Fix | Delete
.classic-editor-forced-state {
[905] Fix | Delete
font-style: italic;
[906] Fix | Delete
font-weight: 400;
[907] Fix | Delete
color: #72777c;
[908] Fix | Delete
font-size: small;
[909] Fix | Delete
}
[910] Fix | Delete
</style>
[911] Fix | Delete
<?php
[912] Fix | Delete
}
[913] Fix | Delete
[914] Fix | Delete
public static function on_admin_init() {
[915] Fix | Delete
global $pagenow;
[916] Fix | Delete
[917] Fix | Delete
if ( $pagenow !== 'post.php' ) {
[918] Fix | Delete
return;
[919] Fix | Delete
}
[920] Fix | Delete
[921] Fix | Delete
$settings = self::get_settings();
[922] Fix | Delete
$post_id = self::get_edited_post_id();
[923] Fix | Delete
[924] Fix | Delete
if ( $post_id && ( $settings['editor'] === 'classic' || self::is_classic( $post_id ) ) ) {
[925] Fix | Delete
// Move the Privacy Policy help notice back under the title field.
[926] Fix | Delete
remove_action( 'admin_notices', array( 'WP_Privacy_Policy_Content', 'notice' ) );
[927] Fix | Delete
add_action( 'edit_form_after_title', array( 'WP_Privacy_Policy_Content', 'notice' ) );
[928] Fix | Delete
}
[929] Fix | Delete
}
[930] Fix | Delete
[931] Fix | Delete
// Need to support WP < 5.0
[932] Fix | Delete
private static function has_blocks( $post = null ) {
[933] Fix | Delete
if ( ! is_string( $post ) ) {
[934] Fix | Delete
$wp_post = get_post( $post );
[935] Fix | Delete
[936] Fix | Delete
if ( $wp_post instanceof WP_Post ) {
[937] Fix | Delete
$post = $wp_post->post_content;
[938] Fix | Delete
}
[939] Fix | Delete
}
[940] Fix | Delete
[941] Fix | Delete
return false !== strpos( (string) $post, '<!-- wp:' );
[942] Fix | Delete
}
[943] Fix | Delete
[944] Fix | Delete
/**
[945] Fix | Delete
* Set defaults on activation.
[946] Fix | Delete
*/
[947] Fix | Delete
public static function activate() {
[948] Fix | Delete
register_uninstall_hook( __FILE__, array( __CLASS__, 'uninstall' ) );
[949] Fix | Delete
[950] Fix | Delete
if ( is_multisite() ) {
[951] Fix | Delete
add_network_option( null, 'classic-editor-replace', 'classic' );
[952] Fix | Delete
add_network_option( null, 'classic-editor-allow-sites', 'disallow' );
[953] Fix | Delete
}
[954] Fix | Delete
[955] Fix | Delete
add_option( 'classic-editor-replace', 'classic' );
[956] Fix | Delete
add_option( 'classic-editor-allow-users', 'disallow' );
[957] Fix | Delete
}
[958] Fix | Delete
[959] Fix | Delete
/**
[960] Fix | Delete
* Delete the options on uninstall.
[961] Fix | Delete
*/
[962] Fix | Delete
public static function uninstall() {
[963] Fix | Delete
if ( is_multisite() ) {
[964] Fix | Delete
delete_network_option( null, 'classic-editor-replace' );
[965] Fix | Delete
delete_network_option( null, 'classic-editor-allow-sites' );
[966] Fix | Delete
}
[967] Fix | Delete
[968] Fix | Delete
delete_option( 'classic-editor-replace' );
[969] Fix | Delete
delete_option( 'classic-editor-allow-users' );
[970] Fix | Delete
}
[971] Fix | Delete
}
[972] Fix | Delete
[973] Fix | Delete
add_action( 'plugins_loaded', array( 'Classic_Editor', 'init_actions' ) );
[974] Fix | Delete
[975] Fix | Delete
endif;
[976] Fix | Delete
[977] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function