Administration: Add "File" to Theme/Plugin Editor menu names and relocate "Plugin File Editor" to Tools for block themes.
[52232] relocated the Theme Editor menu item from Appearance to Tools for block themes. This commit relocates the Plugin Editor menu item from Plugins to Tools for block themes for a consistent workflow. Both the Theme Editor and Plugin Editor menu items are renamed to "Theme File Editor" and "Plugin File Editor" respectively. Why? To better identify their purpose, i.e. to directly edit the code in the theme or plugin files. The rename is not limited to only block themes. Follow-up to [52232]. Props poena, annezazu, audrasjb, clorith, courane01, costdev, dryanpress, desrosj, hellofromTonya, ipstenu, jameskoster, joen, johnbillion, joyously, manfcarlo, marybaum, pbiron, SergeyBiryukov, walbo, youknowriad. Fixes #54382. Built from https://develop.svn.wordpress.org/trunk@52406 git-svn-id: http://core.svn.wordpress.org/trunk@51998 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
5e08149bf4
commit
673ab8a677
|
@ -3146,7 +3146,7 @@ img {
|
||||||
width: 300px;
|
width: 300px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Theme/Plugin Editor */
|
/* Theme/Plugin file editor */
|
||||||
.alignleft h2 {
|
.alignleft h2 {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
@ -3199,7 +3199,7 @@ img {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Styles for Theme and Plugin editors.
|
* Styles for Theme and Plugin file editors.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Hide collapsed items. */
|
/* Hide collapsed items. */
|
||||||
|
|
|
@ -3145,7 +3145,7 @@ img {
|
||||||
width: 300px;
|
width: 300px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Theme/Plugin Editor */
|
/* Theme/Plugin file editor */
|
||||||
.alignleft h2 {
|
.alignleft h2 {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
@ -3198,7 +3198,7 @@ img {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Styles for Theme and Plugin editors.
|
* Styles for Theme and Plugin file editors.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Hide collapsed items. */
|
/* Hide collapsed items. */
|
||||||
|
|
|
@ -203,7 +203,7 @@ function codepress_get_lang( $filename ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds JavaScript required to make CodePress work on the theme/plugin editors.
|
* Adds JavaScript required to make CodePress work on the theme/plugin file editors.
|
||||||
*
|
*
|
||||||
* @since 2.8.0
|
* @since 2.8.0
|
||||||
* @deprecated 3.0.0
|
* @deprecated 3.0.0
|
||||||
|
|
|
@ -223,7 +223,7 @@ function wp_get_plugin_file_editable_extensions( $plugin ) {
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filters the list of file types allowed for editing in the plugin editor.
|
* Filters the list of file types allowed for editing in the plugin file editor.
|
||||||
*
|
*
|
||||||
* @since 2.8.0
|
* @since 2.8.0
|
||||||
* @since 4.9.0 Added the `$plugin` parameter.
|
* @since 4.9.0 Added the `$plugin` parameter.
|
||||||
|
@ -282,7 +282,7 @@ function wp_get_theme_file_editable_extensions( $theme ) {
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filters the list of file types allowed for editing in the theme editor.
|
* Filters the list of file types allowed for editing in the theme file editor.
|
||||||
*
|
*
|
||||||
* @since 4.4.0
|
* @since 4.4.0
|
||||||
*
|
*
|
||||||
|
|
|
@ -309,7 +309,7 @@ function iis7_save_url_rewrite_rules() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the "recently-edited" file for the plugin or theme editor.
|
* Update the "recently-edited" file for the plugin or theme file editor.
|
||||||
*
|
*
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
*
|
*
|
||||||
|
@ -332,7 +332,7 @@ function update_recently_edited( $file ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Makes a tree structure for the theme editor's file list.
|
* Makes a tree structure for the theme file editor's file list.
|
||||||
*
|
*
|
||||||
* @since 4.9.0
|
* @since 4.9.0
|
||||||
* @access private
|
* @access private
|
||||||
|
@ -354,7 +354,7 @@ function wp_make_theme_file_tree( $allowed_files ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Outputs the formatted file list for the theme editor.
|
* Outputs the formatted file list for the theme file editor.
|
||||||
*
|
*
|
||||||
* @since 4.9.0
|
* @since 4.9.0
|
||||||
* @access private
|
* @access private
|
||||||
|
@ -425,7 +425,7 @@ function wp_print_theme_file_tree( $tree, $level = 2, $size = 1, $index = 1 ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Makes a tree structure for the plugin editor's file list.
|
* Makes a tree structure for the plugin file editor's file list.
|
||||||
*
|
*
|
||||||
* @since 4.9.0
|
* @since 4.9.0
|
||||||
* @access private
|
* @access private
|
||||||
|
@ -447,7 +447,7 @@ function wp_make_plugin_file_tree( $plugin_editable_files ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Outputs the formatted file list for the plugin editor.
|
* Outputs the formatted file list for the plugin file editor.
|
||||||
*
|
*
|
||||||
* @since 4.9.0
|
* @since 4.9.0
|
||||||
* @access private
|
* @access private
|
||||||
|
|
|
@ -146,7 +146,7 @@ function get_page_templates( $post = null, $post_type = 'page' ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tidies a filename for url display by the theme editor.
|
* Tidies a filename for url display by the theme file editor.
|
||||||
*
|
*
|
||||||
* @since 2.9.0
|
* @since 2.9.0
|
||||||
* @access private
|
* @access private
|
||||||
|
|
|
@ -1309,7 +1309,7 @@ $( function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles tab keypresses in theme and plugin editor textareas.
|
* Handles tab keypresses in theme and plugin file editor textareas.
|
||||||
*
|
*
|
||||||
* @param {Event} e The event object.
|
* @param {Event} e The event object.
|
||||||
*
|
*
|
||||||
|
|
|
@ -241,28 +241,50 @@ if ( current_theme_supports( 'custom-background' ) && current_user_can( 'customi
|
||||||
|
|
||||||
unset( $appearance_cap );
|
unset( $appearance_cap );
|
||||||
|
|
||||||
// Add 'Theme Editor' to the bottom of the Appearance menu.
|
// Add 'Theme File Editor' to the bottom of the Appearance (non-block themes) or Tools (block themes) menu.
|
||||||
if ( ! is_multisite() ) {
|
if ( ! is_multisite() ) {
|
||||||
// Must use API on the admin_menu hook, direct modification is only possible on/before the _admin_menu hook.
|
// Must use API on the admin_menu hook, direct modification is only possible on/before the _admin_menu hook.
|
||||||
add_action( 'admin_menu', '_add_themes_utility_last', 101 );
|
add_action( 'admin_menu', '_add_themes_utility_last', 101 );
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Adds the 'Theme Editor' link to the bottom of the Appearance or Tools menu.
|
* Adds the 'Theme File Editor' menu item to the bottom of the Appearance (non-block themes)
|
||||||
|
* or Tools (block themes) menu.
|
||||||
*
|
*
|
||||||
* @access private
|
* @access private
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
* @since 5.9.0 'Theme Editor' link has moved to the Tools menu when a block theme is active.
|
* @since 5.9.0 Renamed 'Theme Editor' to 'Theme File Editor'.
|
||||||
|
* Relocates to Tools for block themes.
|
||||||
*/
|
*/
|
||||||
function _add_themes_utility_last() {
|
function _add_themes_utility_last() {
|
||||||
add_submenu_page(
|
add_submenu_page(
|
||||||
wp_is_block_theme() ? 'tools.php' : 'themes.php',
|
wp_is_block_theme() ? 'tools.php' : 'themes.php',
|
||||||
__( 'Theme Editor' ),
|
__( 'Theme File Editor' ),
|
||||||
__( 'Theme Editor' ),
|
__( 'Theme File Editor' ),
|
||||||
'edit_themes',
|
'edit_themes',
|
||||||
'theme-editor.php'
|
'theme-editor.php'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the 'Plugin File Editor' menu item after the 'Themes File Editor' in Tools
|
||||||
|
* for block themes.
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
|
* @since 5.9.0
|
||||||
|
*/
|
||||||
|
function _add_plugin_file_editor_to_tools() {
|
||||||
|
if ( ! wp_is_block_theme() ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
add_submenu_page(
|
||||||
|
'tools.php',
|
||||||
|
__( 'Plugin File Editor' ),
|
||||||
|
__( 'Plugin File Editor' ),
|
||||||
|
'edit_plugins',
|
||||||
|
'plugin-editor.php'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
$count = '';
|
$count = '';
|
||||||
if ( ! is_multisite() && current_user_can( 'update_plugins' ) ) {
|
if ( ! is_multisite() && current_user_can( 'update_plugins' ) ) {
|
||||||
if ( ! isset( $update_data ) ) {
|
if ( ! isset( $update_data ) ) {
|
||||||
|
@ -283,7 +305,12 @@ $submenu['plugins.php'][5] = array( __( 'Installed Plugins' ), 'activate_plugins
|
||||||
if ( ! is_multisite() ) {
|
if ( ! is_multisite() ) {
|
||||||
/* translators: Add new plugin. */
|
/* translators: Add new plugin. */
|
||||||
$submenu['plugins.php'][10] = array( _x( 'Add New', 'plugin' ), 'install_plugins', 'plugin-install.php' );
|
$submenu['plugins.php'][10] = array( _x( 'Add New', 'plugin' ), 'install_plugins', 'plugin-install.php' );
|
||||||
$submenu['plugins.php'][15] = array( __( 'Plugin Editor' ), 'edit_plugins', 'plugin-editor.php' );
|
if ( wp_is_block_theme() ) {
|
||||||
|
// Place the menu item below the Theme File Editor menu item.
|
||||||
|
add_action( 'admin_menu', '_add_plugin_file_editor_to_tools', 101 );
|
||||||
|
} else {
|
||||||
|
$submenu['plugins.php'][15] = array( __( 'Plugin File Editor' ), 'edit_plugins', 'plugin-editor.php' );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unset( $update_data );
|
unset( $update_data );
|
||||||
|
|
|
@ -79,7 +79,7 @@ if ( current_user_can( 'update_themes' ) && $update_data['counts']['themes'] ) {
|
||||||
}
|
}
|
||||||
$submenu['themes.php'][5] = array( __( 'Installed Themes' ), 'manage_network_themes', 'themes.php' );
|
$submenu['themes.php'][5] = array( __( 'Installed Themes' ), 'manage_network_themes', 'themes.php' );
|
||||||
$submenu['themes.php'][10] = array( _x( 'Add New', 'theme' ), 'install_themes', 'theme-install.php' );
|
$submenu['themes.php'][10] = array( _x( 'Add New', 'theme' ), 'install_themes', 'theme-install.php' );
|
||||||
$submenu['themes.php'][15] = array( __( 'Theme Editor' ), 'edit_themes', 'theme-editor.php' );
|
$submenu['themes.php'][15] = array( __( 'Theme File Editor' ), 'edit_themes', 'theme-editor.php' );
|
||||||
|
|
||||||
if ( current_user_can( 'update_plugins' ) && $update_data['counts']['plugins'] ) {
|
if ( current_user_can( 'update_plugins' ) && $update_data['counts']['plugins'] ) {
|
||||||
$menu[20] = array(
|
$menu[20] = array(
|
||||||
|
@ -104,7 +104,7 @@ if ( current_user_can( 'update_plugins' ) && $update_data['counts']['plugins'] )
|
||||||
}
|
}
|
||||||
$submenu['plugins.php'][5] = array( __( 'Installed Plugins' ), 'manage_network_plugins', 'plugins.php' );
|
$submenu['plugins.php'][5] = array( __( 'Installed Plugins' ), 'manage_network_plugins', 'plugins.php' );
|
||||||
$submenu['plugins.php'][10] = array( _x( 'Add New', 'plugin' ), 'install_plugins', 'plugin-install.php' );
|
$submenu['plugins.php'][10] = array( _x( 'Add New', 'plugin' ), 'install_plugins', 'plugin-install.php' );
|
||||||
$submenu['plugins.php'][15] = array( __( 'Plugin Editor' ), 'edit_plugins', 'plugin-editor.php' );
|
$submenu['plugins.php'][15] = array( __( 'Plugin File Editor' ), 'edit_plugins', 'plugin-editor.php' );
|
||||||
|
|
||||||
$menu[25] = array( __( 'Settings' ), 'manage_network_options', 'settings.php', '', 'menu-top menu-icon-settings', 'menu-settings', 'dashicons-admin-settings' );
|
$menu[25] = array( __( 'Settings' ), 'manage_network_options', 'settings.php', '', 'menu-top menu-icon-settings', 'menu-settings', 'dashicons-admin-settings' );
|
||||||
if ( defined( 'MULTISITE' ) && defined( 'WP_ALLOW_MULTISITE' ) && WP_ALLOW_MULTISITE ) {
|
if ( defined( 'MULTISITE' ) && defined( 'WP_ALLOW_MULTISITE' ) && WP_ALLOW_MULTISITE ) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Plugin editor network administration panel.
|
* Plugin file editor network administration panel.
|
||||||
*
|
*
|
||||||
* @package WordPress
|
* @package WordPress
|
||||||
* @subpackage Multisite
|
* @subpackage Multisite
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Theme editor network administration panel.
|
* Theme file editor network administration panel.
|
||||||
*
|
*
|
||||||
* @package WordPress
|
* @package WordPress
|
||||||
* @subpackage Multisite
|
* @subpackage Multisite
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Edit plugin editor administration panel.
|
* Edit plugin file editor administration panel.
|
||||||
*
|
*
|
||||||
* @package WordPress
|
* @package WordPress
|
||||||
* @subpackage Administration
|
* @subpackage Administration
|
||||||
|
@ -124,7 +124,7 @@ get_current_screen()->add_help_tab(
|
||||||
'id' => 'overview',
|
'id' => 'overview',
|
||||||
'title' => __( 'Overview' ),
|
'title' => __( 'Overview' ),
|
||||||
'content' =>
|
'content' =>
|
||||||
'<p>' . __( 'You can use the plugin editor to make changes to any of your plugins’ individual PHP files. Be aware that if you make changes, plugins updates will overwrite your customizations.' ) . '</p>' .
|
'<p>' . __( 'You can use the plugin file editor to make changes to any of your plugins’ individual PHP files. Be aware that if you make changes, plugins updates will overwrite your customizations.' ) . '</p>' .
|
||||||
'<p>' . __( 'Choose a plugin to edit from the dropdown menu and click the Select button. Click once on any file name to load it in the editor, and make your changes. Don’t forget to save your changes (Update File) when you’re finished.' ) . '</p>' .
|
'<p>' . __( 'Choose a plugin to edit from the dropdown menu and click the Select button. Click once on any file name to load it in the editor, and make your changes. Don’t forget to save your changes (Update File) when you’re finished.' ) . '</p>' .
|
||||||
'<p>' . __( 'The Documentation menu below the editor lists the PHP functions recognized in the plugin file. Clicking Look Up takes you to a web page about that particular function.' ) . '</p>' .
|
'<p>' . __( 'The Documentation menu below the editor lists the PHP functions recognized in the plugin file. Clicking Look Up takes you to a web page about that particular function.' ) . '</p>' .
|
||||||
'<p id="editor-keyboard-trap-help-1">' . __( 'When using a keyboard to navigate:' ) . '</p>' .
|
'<p id="editor-keyboard-trap-help-1">' . __( 'When using a keyboard to navigate:' ) . '</p>' .
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Theme editor administration panel.
|
* Theme file editor administration panel.
|
||||||
*
|
*
|
||||||
* @package WordPress
|
* @package WordPress
|
||||||
* @subpackage Administration
|
* @subpackage Administration
|
||||||
|
@ -27,7 +27,7 @@ get_current_screen()->add_help_tab(
|
||||||
'id' => 'overview',
|
'id' => 'overview',
|
||||||
'title' => __( 'Overview' ),
|
'title' => __( 'Overview' ),
|
||||||
'content' =>
|
'content' =>
|
||||||
'<p>' . __( 'You can use the theme editor to edit the individual CSS and PHP files which make up your theme.' ) . '</p>' .
|
'<p>' . __( 'You can use the theme file editor to edit the individual CSS and PHP files which make up your theme.' ) . '</p>' .
|
||||||
'<p>' . __( 'Begin by choosing a theme to edit from the dropdown menu and clicking the Select button. A list then appears of the theme’s template files. Clicking once on any file name causes the file to appear in the large Editor box.' ) . '</p>' .
|
'<p>' . __( 'Begin by choosing a theme to edit from the dropdown menu and clicking the Select button. A list then appears of the theme’s template files. Clicking once on any file name causes the file to appear in the large Editor box.' ) . '</p>' .
|
||||||
'<p>' . __( 'For PHP files, you can use the Documentation dropdown to select from functions recognized in that file. Look Up takes you to a web page with reference material about that particular function.' ) . '</p>' .
|
'<p>' . __( 'For PHP files, you can use the Documentation dropdown to select from functions recognized in that file. Look Up takes you to a web page with reference material about that particular function.' ) . '</p>' .
|
||||||
'<p id="editor-keyboard-trap-help-1">' . __( 'When using a keyboard to navigate:' ) . '</p>' .
|
'<p id="editor-keyboard-trap-help-1">' . __( 'When using a keyboard to navigate:' ) . '</p>' .
|
||||||
|
|
|
@ -3578,8 +3578,8 @@ function wp_enqueue_editor() {
|
||||||
*
|
*
|
||||||
* @type string $type The MIME type of the file to be edited.
|
* @type string $type The MIME type of the file to be edited.
|
||||||
* @type string $file Filename to be edited. Extension is used to sniff the type. Can be supplied as alternative to `$type` param.
|
* @type string $file Filename to be edited. Extension is used to sniff the type. Can be supplied as alternative to `$type` param.
|
||||||
* @type WP_Theme $theme Theme being edited when on theme editor.
|
* @type WP_Theme $theme Theme being edited when on the theme file editor.
|
||||||
* @type string $plugin Plugin being edited when on plugin editor.
|
* @type string $plugin Plugin being edited when on the plugin file editor.
|
||||||
* @type array $codemirror Additional CodeMirror setting overrides.
|
* @type array $codemirror Additional CodeMirror setting overrides.
|
||||||
* @type array $csslint CSSLint rule overrides.
|
* @type array $csslint CSSLint rule overrides.
|
||||||
* @type array $jshint JSHint rule overrides.
|
* @type array $jshint JSHint rule overrides.
|
||||||
|
@ -3669,8 +3669,8 @@ function wp_enqueue_code_editor( $args ) {
|
||||||
*
|
*
|
||||||
* @type string $type The MIME type of the file to be edited.
|
* @type string $type The MIME type of the file to be edited.
|
||||||
* @type string $file Filename to be edited. Extension is used to sniff the type. Can be supplied as alternative to `$type` param.
|
* @type string $file Filename to be edited. Extension is used to sniff the type. Can be supplied as alternative to `$type` param.
|
||||||
* @type WP_Theme $theme Theme being edited when on theme editor.
|
* @type WP_Theme $theme Theme being edited when on the theme file editor.
|
||||||
* @type string $plugin Plugin being edited when on plugin editor.
|
* @type string $plugin Plugin being edited when on the plugin file editor.
|
||||||
* @type array $codemirror Additional CodeMirror setting overrides.
|
* @type array $codemirror Additional CodeMirror setting overrides.
|
||||||
* @type array $csslint CSSLint rule overrides.
|
* @type array $csslint CSSLint rule overrides.
|
||||||
* @type array $jshint JSHint rule overrides.
|
* @type array $jshint JSHint rule overrides.
|
||||||
|
@ -4006,8 +4006,8 @@ function wp_get_code_editor_settings( $args ) {
|
||||||
*
|
*
|
||||||
* @type string $type The MIME type of the file to be edited.
|
* @type string $type The MIME type of the file to be edited.
|
||||||
* @type string $file Filename being edited.
|
* @type string $file Filename being edited.
|
||||||
* @type WP_Theme $theme Theme being edited when on theme editor.
|
* @type WP_Theme $theme Theme being edited when on the theme file editor.
|
||||||
* @type string $plugin Plugin being edited when on plugin editor.
|
* @type string $plugin Plugin being edited when on the plugin file editor.
|
||||||
* @type array $codemirror Additional CodeMirror setting overrides.
|
* @type array $codemirror Additional CodeMirror setting overrides.
|
||||||
* @type array $csslint CSSLint rule overrides.
|
* @type array $csslint CSSLint rule overrides.
|
||||||
* @type array $jshint JSHint rule overrides.
|
* @type array $jshint JSHint rule overrides.
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.9-beta3-52405';
|
$wp_version = '5.9-beta3-52406';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue