WordPress.org

Make WordPress Core


Ignore:
Timestamp:
05/26/2019 08:49:04 PM (4 months ago)
Author:
azaozz
Message:

Privacy tools: Organize privacy functions into logical files and classes.

Props xkon, birgire, desrosj, garrett-eclipse, azaozz.
See #43895.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/tools.php

    r45140 r45448  
    77 */
    88
     9if ( isset( $_GET['page'] ) && ! empty( $_POST ) ) {
     10    // Ensure POST-ing to `tools.php?page=export_personal_data` and `tools.php?page=remove_personal_data`
     11    // continues to work after creating the new files for exporting and erasing of personal data.
     12    if ( $_GET['page'] === 'export_personal_data' ) {
     13        require_once( ABSPATH . 'wp-admin/export-personal-data.php' );
     14        return;
     15    } elseif ( $_GET['page'] === 'remove_personal_data' ) {
     16        require_once( ABSPATH . 'wp-admin/erase-personal-data.php' );
     17        return;
     18    }
     19}
     20
    921/** WordPress Administration Bootstrap */
    1022require_once( dirname( __FILE__ ) . '/admin.php' );
    1123
    12 $is_privacy_guide = ( isset( $_GET['wp-privacy-policy-guide'] ) && current_user_can( 'manage_privacy_options' ) );
     24// The privacy policy guide used to be outputted from here. Since WP 5.3 it is in wp-admin/privacy-policy-guide.php.
     25if ( isset( $_GET['wp-privacy-policy-guide'] ) ) {
     26    wp_redirect( admin_url( 'privacy-policy-guide.php' ), 301 );
     27    exit;
     28} elseif ( isset( $_GET['page'] ) ) {
     29    // These were also moved to files in WP 5.3.
     30    if ( $_GET['page'] === 'export_personal_data' ) {
     31        wp_redirect( admin_url( 'export-personal-data.php' ), 301 );
     32        exit;
     33    } elseif ( $_GET['page'] === 'remove_personal_data' ) {
     34        wp_redirect( admin_url( 'erase-personal-data.php' ), 301 );
     35        exit;
     36    }
     37}
    1338
    14 if ( $is_privacy_guide ) {
    15     $title = __( 'Privacy Policy Guide' );
     39$title = __( 'Tools' );
    1640
    17     // "Borrow" xfn.js for now so we don't have to create new files.
    18     wp_enqueue_script( 'xfn' );
     41get_current_screen()->add_help_tab(
     42    array(
     43        'id'      => 'converter',
     44        'title'   => __( 'Categories and Tags Converter' ),
     45        '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>' .
     46        '<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>',
     47    )
     48);
    1949
    20 } else {
    21 
    22     $title = __( 'Tools' );
    23 
    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</a>' ) . '</p>'
    37     );
    38 }
     50get_current_screen()->set_help_sidebar(
     51    '<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
     52    '<p>' . __( '<a href="https://codex.wordpress.org/Tools_Screen">Documentation on Tools</a>' ) . '</p>' .
     53    '<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
     54);
    3955
    4056require_once( ABSPATH . 'wp-admin/admin-header.php' );
     
    4460<h1><?php echo esc_html( $title ); ?></h1>
    4561<?php
    46 
    47 if ( $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 {
    5562
    5663    if ( current_user_can( 'import' ) ) :
     
    7380     */
    7481    do_action( 'tool_box' );
    75 }
     82
    7683?>
    7784</div>
    7885<?php
     86
    7987include( ABSPATH . 'wp-admin/admin-footer.php' );
Note: See TracChangeset for help on using the changeset viewer.