plugin updates

This commit is contained in:
Tony Volpe
2024-07-22 09:27:59 -04:00
parent f13cad0e36
commit a903eec02d
2 changed files with 24 additions and 17 deletions

View File

@@ -5,7 +5,7 @@
* Plugin Name: Classic Editor * Plugin Name: Classic Editor
* Plugin URI: https://wordpress.org/plugins/classic-editor/ * Plugin URI: https://wordpress.org/plugins/classic-editor/
* Description: Enables the WordPress classic editor and the old-style Edit Post screen with TinyMCE, Meta Boxes, etc. Supports the older plugins that extend this screen. * Description: Enables the WordPress classic editor and the old-style Edit Post screen with TinyMCE, Meta Boxes, etc. Supports the older plugins that extend this screen.
* Version: 1.6.3 * Version: 1.6.4
* Author: WordPress Contributors * Author: WordPress Contributors
* Author URI: https://github.com/WordPress/classic-editor/ * Author URI: https://github.com/WordPress/classic-editor/
* License: GPLv2 or later * License: GPLv2 or later
@@ -57,7 +57,9 @@ class Classic_Editor {
if ( $settings['allow-users'] ) { if ( $settings['allow-users'] ) {
// User settings. // User settings.
add_action( 'personal_options_update', array( __CLASS__, 'save_user_settings' ) ); add_action( 'personal_options_update', array( __CLASS__, 'save_user_settings' ) );
add_action( 'edit_user_profile_update', array( __CLASS__, 'save_user_settings' ) );
add_action( 'profile_personal_options', array( __CLASS__, 'user_settings' ) ); add_action( 'profile_personal_options', array( __CLASS__, 'user_settings' ) );
add_action( 'edit_user_profile', array( __CLASS__, 'user_settings') );
} }
} }
@@ -198,7 +200,7 @@ class Classic_Editor {
} }
private static function get_settings( $refresh = 'no' ) { private static function get_settings( $refresh = 'no', $user_id = 0 ) {
/** /**
* Can be used to override the plugin's settings. Always hides the settings UI when used (as users cannot change the settings). * Can be used to override the plugin's settings. Always hides the settings UI when used (as users cannot change the settings).
* *
@@ -207,7 +209,7 @@ class Classic_Editor {
* 'editor' => 'classic', // Accepted values: 'classic', 'block'. * 'editor' => 'classic', // Accepted values: 'classic', 'block'.
* 'allow-users' => false, * 'allow-users' => false,
* *
* @param boolean To override the settings return an array with the above keys. * @param boolean To override the settings return an array with the above keys. Default false.
*/ */
$settings = apply_filters( 'classic_editor_plugin_settings', false ); $settings = apply_filters( 'classic_editor_plugin_settings', false );
@@ -270,7 +272,8 @@ class Classic_Editor {
// Override the defaults with the user options. // Override the defaults with the user options.
if ( ( ! isset( $GLOBALS['pagenow'] ) || $GLOBALS['pagenow'] !== 'options-writing.php' ) && $allow_users ) { if ( ( ! isset( $GLOBALS['pagenow'] ) || $GLOBALS['pagenow'] !== 'options-writing.php' ) && $allow_users ) {
$user_options = get_user_option( 'classic-editor-settings' );
$user_options = get_user_option( 'classic-editor-settings', $user_id );
if ( $user_options === 'block' || $user_options === 'classic' ) { if ( $user_options === 'block' || $user_options === 'classic' ) {
$editor = $user_options; $editor = $user_options;
@@ -402,8 +405,8 @@ class Classic_Editor {
return 'disallow'; return 'disallow';
} }
public static function settings_1() { public static function settings_1( $user_id = 0 ) {
$settings = self::get_settings( 'refresh' ); $settings = self::get_settings( 'refresh', $user_id );
?> ?>
<div class="classic-editor-options"> <div class="classic-editor-options">
@@ -446,18 +449,19 @@ class Classic_Editor {
/** /**
* Shown on the Profile page when allowed by admin. * Shown on the Profile page when allowed by admin.
*/ */
public static function user_settings() { public static function user_settings( $user = null ) {
global $user_can_edit; global $user_can_edit;
$settings = self::get_settings( 'update' ); $settings = self::get_settings( 'update' );
if ( if ( ! $user_can_edit || ! $settings['allow-users'] ) {
! defined( 'IS_PROFILE_PAGE' ) ||
! IS_PROFILE_PAGE ||
! $user_can_edit ||
! $settings['allow-users']
) {
return; return;
} }
if ( $user instanceof WP_User ) {
$user_id = (int) $user->ID;
} else {
$user_id = 0;
}
?> ?>
<table class="form-table"> <table class="form-table">
@@ -465,7 +469,7 @@ class Classic_Editor {
<th scope="row"><?php _e( 'Default Editor', 'classic-editor' ); ?></th> <th scope="row"><?php _e( 'Default Editor', 'classic-editor' ); ?></th>
<td> <td>
<?php wp_nonce_field( 'allow-user-settings', 'classic-editor-user-settings' ); ?> <?php wp_nonce_field( 'allow-user-settings', 'classic-editor-user-settings' ); ?>
<?php self::settings_1(); ?> <?php self::settings_1( $user_id ); ?>
</td> </td>
</tr> </tr>
</table> </table>

View File

@@ -1,9 +1,9 @@
=== Classic Editor === === Classic Editor ===
Contributors: wordpressdotorg, azaozz, melchoyce, chanthaboune, alexislloyd, pento, youknowriad, desrosj, luciano-croce Contributors: wordpressdotorg, azaozz, melchoyce, chanthaboune, alexislloyd, pento, youknowriad, desrosj, luciano-croce, ironprogrammer
Tags: gutenberg, disable, disable gutenberg, editor, classic editor, block editor Tags: gutenberg, disable, disable gutenberg, editor, classic editor, block editor
Requires at least: 4.9 Requires at least: 4.9
Tested up to: 6.2 Tested up to: 6.6
Stable tag: 1.6.3 Stable tag: 1.6.4
Requires PHP: 5.2.4 Requires PHP: 5.2.4
License: GPLv2 or later License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -29,6 +29,9 @@ By default, this plugin hides all functionality available in the new block edito
== Changelog == == Changelog ==
= 1.6.4 =
* Added support for administrators to choose the default editor for other users.
= 1.6.3 = = 1.6.3 =
* Added some WPCS fixes, props NicktheGeek on GitHub. * Added some WPCS fixes, props NicktheGeek on GitHub.
* Updated "Tested up to" in the readme and removed it from classic-editor.php. This should fix false positive errors in security plugins in the future. * Updated "Tested up to" in the readme and removed it from classic-editor.php. This should fix false positive errors in security plugins in the future.