diff --git a/src/wp-admin/tools.php b/src/wp-admin/tools.php index d03c64fa61252..ae891bdf10afd 100644 --- a/src/wp-admin/tools.php +++ b/src/wp-admin/tools.php @@ -51,6 +51,31 @@ ) ); +get_current_screen()->add_help_tab( + array( + 'id' => 'import', + 'title' => __( 'Import' ), + 'content' => '

' . __( 'In previous versions of WordPress, all importers were built-in. They have been turned into plugins since most people only use them once or infrequently.' ) . '

', + ) +); + +get_current_screen()->add_help_tab( + array( + 'id' => 'export', + 'title' => __( 'Export' ), + 'content' => '

' . __( 'You can export a file of your site’s content in order to import it into another installation or platform. The export file will be an XML file format called WXR. Posts, pages, comments, custom fields, categories, and tags can be included. You can choose for the WXR file to include only certain posts or pages by setting the dropdown filters to limit the export by category, author, date range by month, or publishing status.' ) . '

', + ) +); + +get_current_screen()->add_help_tab( + array( + 'id' => 'code-editing', + 'title' => __( 'Code Editing Tools' ), + 'content' => '

' . __( 'You can use the theme file editor to edit the individual CSS and PHP files which make up your theme.' ) . '

' . + '

' . __( '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.' ) . '

', + ) +); + get_current_screen()->set_help_sidebar( '

' . __( 'For more information:' ) . '

' . '

' . __( 'Documentation on Tools' ) . '

' . @@ -64,10 +89,18 @@

cap->manage_terms ) || current_user_can( $tags->cap->manage_terms ) ) : + $tools_screen_has_content = true; ?>

@@ -83,8 +116,216 @@
$importer ) { + $import_options[ $import_slug ] = array( + 'label' => $importer['name'], + 'description' => $importer['description'], + ); + } + } + + /** + * Filters the list of import options described on the Tools screen. + * + * Defaults to the popular importers returned by wp_get_popular_importers(), + * and is empty for users who cannot install plugins. The list is informational: + * the importers themselves are installed and run from the Import screen. + * + * @since 7.2.0 + * + * @param array[] $import_options { + * Array of import options, keyed by importer slug. + * + * @type array ...$0 { + * @type string $label Name of the importer. + * @type string $description Short description of what the importer imports. + * } + * } + */ + $import_options = apply_filters( 'tools_screen_import_options', $import_options ); + + $tools_screen_has_content = true; + ?> +
+

+ + + +

+ +

+
+ __( 'All content' ), + 'posts' => __( 'Posts' ), + 'pages' => __( 'Pages' ), + 'attachment' => __( 'Media' ), + ); + + $exportable_post_types = get_post_types( + array( + '_builtin' => false, + 'can_export' => true, + ), + 'objects' + ); + + foreach ( $exportable_post_types as $exportable_post_type ) { + $export_options[ $exportable_post_type->name ] = $exportable_post_type->label; + } + + /** + * Filters the list of export options described on the Tools screen. + * + * By default this mirrors the choices offered on the Export screen, including + * any custom post type registered with 'can_export' support. + * + * @since 7.2.0 + * + * @param string[] $export_options Array of export option labels, keyed by the value of the + * matching `content` parameter on the Export screen. + */ + $export_options = apply_filters( 'tools_screen_export_options', $export_options ); + + if ( ! empty( $export_options ) ) : + $tools_screen_has_content = true; + ?> +
+

+ +

+ +

+
+ __( 'Theme File Editor' ), + 'url' => admin_url( 'theme-editor.php' ), + 'description' => __( 'You can use the theme file editor to edit the individual CSS and PHP files which make up your theme.' ), + ); + } + + if ( current_user_can( 'edit_plugins' ) ) { + $code_editing_options['plugin-editor'] = array( + 'label' => __( 'Plugin File Editor' ), + 'url' => admin_url( 'plugin-editor.php' ), + 'description' => __( '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.' ), + ); + } +} + +/** + * Filters the list of code editing tools shown on the Tools screen. + * + * Entries are only added by default when the current user is allowed to use + * them, so this filter runs after the capability checks. Any entry added here + * is displayed as-is. + * + * @since 7.2.0 + * + * @param array[] $code_editing_options { + * Array of code editing tools, keyed by tool slug. + * + * @type array ...$0 { + * @type string $label Name of the tool, used as the link text. + * @type string $url URL of the screen the tool lives on. + * @type string $description Short description of what the tool does. + * } + * } + */ +$code_editing_options = apply_filters( 'tools_screen_code_editing_options', $code_editing_options ); + +if ( ! empty( $code_editing_options ) ) : + $tools_screen_has_content = true; + ?> +
+

+ +
+ ' . __( 'No tools are available for your account.' ) . '

'; +} + ?>