WordPress.org

Make WordPress Core

Ticket #44360: tools.patch

File tools.patch, 2.7 KB (added by joshuanoyce, 12 months ago)
Line 
1<?php
2/**
3 * Tools Administration Screen.
4 *
5 * @package WordPress
6 * @subpackage Administration
7 */
8
9/** WordPress Administration Bootstrap */
10require_once( dirname( __FILE__ ) . '/admin.php' );
11
12$is_privacy_guide = ( isset( $_GET['wp-privacy-policy-guide'] ) && current_user_can( 'manage_privacy_options' ) );
13
14if ( $is_privacy_guide ) {
15        $title = __( 'Privacy Policy Guide' );
16
17        // "Borrow" xfn.js for now so we don't have to create new files.
18        wp_enqueue_script( 'xfn' );
19
20} else {
21
22        $title = __( 'Tools' );
23        /* translators: %s: category and tag information regarding teh 'Catergories and tags Converter' */
24        get_current_screen()->add_help_tab(
25                array(
26                        'id'      => 'converter',
27                        'title'   => __( 'Categories and Tags Converter' ),
28                        'content' => '<p>' . __( 'Categories have hierarchy, meaning that you can nest sub-categories. Tags do not have hierarchy and cannot be nested. Sometimes people start out using one on their posts, then later realize that the other would work better for their content.' ) . '</p>' .
29                        '<p>' . __( 'The Categories and Tags Converter link on this screen will take you to the Import screen, where that Converter is one of the plugins you can install. Once that plugin is installed, the Activate Plugin &amp; Run Importer link will take you to a screen where you can choose to convert tags into categories or vice versa.' ) . '</p>',
30                )
31        );
32
33        get_current_screen()->set_help_sidebar(
34                '<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
35                '<p>' . __( '<a href="https://codex.wordpress.org/Tools_Screen">Documentation on Tools</a>' ) . '</p>' .
36                '<p>' . __( '<a href="https://wordpress.org/support/">Support Forums</a>' ) . '</p>'
37        );
38}
39
40require_once( ABSPATH . 'wp-admin/admin-header.php' );
41
42?>
43<div class="wrap">
44<h1><?php echo esc_html( $title ); ?></h1>
45<?php
46
47if ( $is_privacy_guide ) {
48        ?>
49        <div class="wp-privacy-policy-guide">
50                <?php WP_Privacy_Policy_Content::privacy_policy_guide(); ?>
51        </div>
52        <?php
53
54} else {
55
56        if ( current_user_can( 'import' ) ) :
57                $cats = get_taxonomy( 'category' );
58                $tags = get_taxonomy( 'post_tag' );
59                if ( current_user_can( $cats->cap->manage_terms ) || current_user_can( $tags->cap->manage_terms ) ) :
60                        ?>
61        <div class="card">
62                <h2 class="title"><?php _e( 'Categories and Tags Converter' ); ?></h2>
63                <p><?php /* translators: %s: Categories and Tags Converter */
64                printf( __( 'If you want to convert your categories to tags (or vice versa), use the <a href="%s">Categories and Tags Converter</a> available from the Import screen.' ), 'import.php' ); ?></p>
65        </div>
66                        <?php
67        endif;
68        endif;
69
70        /**
71         * Fires at the end of the Tools Administration screen.
72         *
73         * @since 2.8.0
74         */
75        do_action( 'tool_box' );
76}
77?>
78</div>
79<?php
80include( ABSPATH . 'wp-admin/admin-footer.php' );