Changeset 2019336 for classic-editor
- Timestamp:
- 01/25/2019 09:42:32 PM (7 years ago)
- Location:
- classic-editor/trunk
- Files:
-
- 6 deleted
- 3 edited
-
LICENSE.md (modified) (1 diff)
-
classic-editor.php (modified) (13 diffs)
-
readme.txt (modified) (3 diffs)
-
screenshot-1.png (deleted)
-
screenshot-2.png (deleted)
-
screenshot-3.png (deleted)
-
screenshot-4.png (deleted)
-
screenshot-5.png (deleted)
-
screenshot-6.png (deleted)
Legend:
- Unmodified
- Added
- Removed
-
classic-editor/trunk/LICENSE.md
r1986885 r2019336 1 1 ### WordPress - Web publishing software 2 2 3 Copyright 2011-201 8by the contributors3 Copyright 2011-2019 by the contributors 4 4 5 5 This program is free software; you can redistribute it and/or modify -
classic-editor/trunk/classic-editor.php
r1990537 r2019336 6 6 * Plugin URI: https://wordpress.org/plugins/classic-editor/ 7 7 * 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. 8 * Version: 1. 38 * Version: 1.4-beta1 9 9 * Author: WordPress Contributors 10 10 * Author URI: https://github.com/WordPress/classic-editor/ … … 13 13 * Text Domain: classic-editor 14 14 * Domain Path: /languages 15 * Network: true16 15 * 17 16 * This program is free software; you can redistribute it and/or modify it under the terms of the GNU … … 29 28 if ( ! class_exists( 'Classic_Editor' ) ) : 30 29 class Classic_Editor { 31 const plugin_version = 1.2;32 30 private static $settings; 33 31 private static $supported_post_types = array(); … … 50 48 51 49 if ( ! $settings['hide-settings-ui'] ) { 52 // Show the plugin's admin settings, and a link to themin the plugins list table.50 // Add a link to the plugin's settings and/or network admin settings in the plugins list table. 53 51 add_filter( 'plugin_action_links', array( __CLASS__, 'add_settings_link' ), 10, 2 ); 52 add_filter( 'network_admin_plugin_action_links', array( __CLASS__, 'add_settings_link' ), 10, 2 ); 53 54 54 add_action( 'admin_init', array( __CLASS__, 'register_settings' ) ); 55 55 … … 201 201 if ( is_multisite() ) { 202 202 $defaults = array( 203 'editor' => 'classic',203 'editor' => get_network_option( null, 'classic-editor-replace' ) === 'block' ? 'block' : 'classic', 204 204 'allow-users' => false, 205 205 ); … … 435 435 436 436 public static function network_settings() { 437 $is_checked = ( get_network_option( null, 'classic-editor-allow-sites' ) === 'allow' ); 437 $editor = get_network_option( null, 'classic-editor-replace' ); 438 $is_checked = ( get_network_option( null, 'classic-editor-allow-sites' ) === 'allow' ); 438 439 439 440 ?> 441 <h2 id="classic-editor-options"><?php _e( 'Editor Settings', 'classic-editor' ); ?></h2> 440 442 <table class="form-table"> 443 <?php wp_nonce_field( 'allow-site-admin-settings', 'classic-editor-network-settings' ); ?> 441 444 <tr> 442 <th scope="row"><?php _e x( 'Classic Editor', 'Editor Name', 'classic-editor' ); ?></th>445 <th scope="row"><?php _e( 'Default editor for all sites', 'classic-editor' ); ?></th> 443 446 <td> 444 <?php wp_nonce_field( 'allow-site-admin-settings', 'classic-editor-network-settings' ); ?> 445 <input type="checkbox" name="classic-editor-allow-sites" id="classic-editor-allow-sites" value="allow"<?php if ( $is_checked ) echo ' checked'; ?>> 446 <label for="classic-editor-allow-sites"><?php _e( 'Allow site admins to change settings', 'classic-editor' ); ?></label> 447 <p class="description"><?php _e( 'By default the Block Editor is replaced with the Classic Editor and users cannot switch editors.', 'classic-editor' ); ?></p> 447 <p> 448 <input type="radio" name="classic-editor-replace" id="classic-editor-classic" value="classic"<?php if ( $editor !== 'block' ) echo ' checked'; ?> /> 449 <label for="classic-editor-classic"><?php _ex( 'Classic Editor', 'Editor Name', 'classic-editor' ); ?></label> 450 </p> 451 <p> 452 <input type="radio" name="classic-editor-replace" id="classic-editor-block" value="block"<?php if ( $editor === 'block' ) echo ' checked'; ?> /> 453 <label for="classic-editor-block"><?php _ex( 'Block Editor', 'Editor Name', 'classic-editor' ); ?></label> 454 </p> 455 </td> 456 </tr> 457 <tr> 458 <th scope="row"><?php _e( 'Change settings', 'classic-editor' ); ?></th> 459 <td> 460 <input type="checkbox" name="classic-editor-allow-sites" id="classic-editor-allow-sites" value="allow"<?php if ( $is_checked ) echo ' checked'; ?>> 461 <label for="classic-editor-allow-sites"><?php _e( 'Allow site admins to change settings', 'classic-editor' ); ?></label> 462 <p class="description"><?php _e( 'By default the Block Editor is replaced with the Classic Editor and users cannot switch editors.', 'classic-editor' ); ?></p> 448 463 </td> 449 464 </tr> … … 458 473 wp_verify_nonce( $_POST['classic-editor-network-settings'], 'allow-site-admin-settings' ) 459 474 ) { 475 if ( isset( $_POST['classic-editor-replace'] ) && $_POST['classic-editor-replace'] === 'block' ) { 476 update_network_option( null, 'classic-editor-replace', 'block' ); 477 } else { 478 update_network_option( null, 'classic-editor-replace', 'classic' ); 479 } 460 480 if ( isset( $_POST['classic-editor-allow-sites'] ) && $_POST['classic-editor-allow-sites'] === 'allow' ) { 461 481 update_network_option( null, 'classic-editor-allow-sites', 'allow' ); … … 473 493 $pagenow !== 'about.php' || 474 494 $settings['hide-settings-ui'] || 475 $settings['editor'] === 'block' || 495 $settings['editor'] === 'block' || 476 496 $settings['allow-users'] || 477 497 ! current_user_can( 'edit_posts' ) … … 486 506 487 507 if ( current_user_can( 'manage_options' ) ) { 488 $message .= ' ' . sprintf( __( 'Change the %1$sClassic Editor settings%2$s.', 'classic-editor' ), '<a href="options-writing.php#classic-editor-options">', '</a>' ); 508 if ( is_network_admin() ) { 509 $url = 'settings.php#classic-editor-options'; 510 } else { 511 $url = 'options-writing.php#classic-editor-options'; 512 } 513 514 $message .= ' ' . sprintf( __( 'Change the %1$sClassic Editor settings%2$s.', 'classic-editor' ), sprintf( '<a href="%s">', $url ), '</a>' ); 489 515 } 490 516 … … 661 687 plugins_url( 'js/block-editor-plugin.js', __FILE__ ), 662 688 array( 'wp-element', 'wp-components', 'lodash' ), 663 self::plugin_version,689 '1.4', 664 690 true 665 691 ); … … 679 705 680 706 if ( $file === 'classic-editor/classic-editor.php' && ! $settings['hide-settings-ui'] && current_user_can( 'manage_options' ) ) { 681 (array) $links[] = sprintf( '<a href="%s">%s</a>', admin_url( 'options-writing.php#classic-editor-options' ), __( 'Settings', 'classic-editor' ) ); 707 if ( current_filter() === 'plugin_action_links' ) { 708 $url = admin_url( 'options-writing.php#classic-editor-options' ); 709 } else { 710 $url = admin_url( '/network/settings.php#classic-editor-options' ); 711 } 712 713 // Prevent warnings in PHP 7.0+ when a plugin uses this filter incorrectly. 714 $links = (array) $links; 715 $links[] = sprintf( '<a href="%s">%s</a>', $url, __( 'Settings', 'classic-editor' ) ); 682 716 } 683 717 … … 885 919 public static function activate() { 886 920 if ( is_multisite() ) { 921 add_network_option( null, 'classic-editor-replace', 'classic' ); 887 922 add_network_option( null, 'classic-editor-allow-sites', 'disallow' ); 888 923 } … … 897 932 public static function uninstall() { 898 933 if ( is_multisite() ) { 934 delete_network_option( null, 'classic-editor-replace' ); 899 935 delete_network_option( null, 'classic-editor-allow-sites' ); 900 936 } -
classic-editor/trunk/readme.txt
r1998246 r2019336 29 29 30 30 == Changelog == 31 32 = 1.4 = 33 * On network installations removed the restriction for only network activation. 34 * Added support for network administrators to choose the default network-wide editor. 35 * Fixed the settings link in the warning on network About screen. 31 36 32 37 = 1.3 = … … 80 85 Initial release. 81 86 87 == Frequently Asked Questions == 88 89 = Default settings = 90 91 When activated this plugin will restore the previous ("classic") WordPress editor and hide the new Block Editor ("Gutenberg"). 92 These settings can be changed at the Settings => Writing screen. 93 94 = Default settings for network installation = 95 96 There are two options: 97 98 * When network-activated this plugin will set the Classic Editor as default and prevent site administrators and users from changing editors. 99 The settings can be changed and default network-wide editor can be selected on the Network Settings screen. 100 * When not network-activated each site administrator will be able to activate the plugin and choose options for their users. 101 82 102 == Screenshots == 83 103 1. Admin settings on the Settings -> Writing screen. … … 86 106 4. Link to switch to the Block Editor while editing a post in the Classic Editor. Visible when the users are allowed to switch editors. 87 107 5. Link to switch to the Classic Editor while editing a post in the Block Editor. Visible when the users are allowed to switch editors. 88 6. Network setting to allow site admins to change the default options.108 6. Network settings to select the default editor for the network and allow site admins to change it.
Note: See TracChangeset
for help on using the changeset viewer.