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

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

git-svn-id: https://develop.svn.wordpress.org/trunk@45448 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz
2019-05-26 20:49:04 +00:00
parent ae81d63a2a
commit 9fcb362fa0
23 changed files with 2353 additions and 2187 deletions

View File

@@ -6,37 +6,53 @@
* @subpackage Administration
*/
if ( isset( $_GET['page'] ) && ! empty( $_POST ) ) {
// Ensure POST-ing to `tools.php?page=export_personal_data` and `tools.php?page=remove_personal_data`
// continues to work after creating the new files for exporting and erasing of personal data.
if ( $_GET['page'] === 'export_personal_data' ) {
require_once( ABSPATH . 'wp-admin/export-personal-data.php' );
return;
} elseif ( $_GET['page'] === 'remove_personal_data' ) {
require_once( ABSPATH . 'wp-admin/erase-personal-data.php' );
return;
}
}
/** WordPress Administration Bootstrap */
require_once( dirname( __FILE__ ) . '/admin.php' );
$is_privacy_guide = ( isset( $_GET['wp-privacy-policy-guide'] ) && current_user_can( 'manage_privacy_options' ) );
if ( $is_privacy_guide ) {
$title = __( 'Privacy Policy Guide' );
// "Borrow" xfn.js for now so we don't have to create new files.
wp_enqueue_script( 'xfn' );
} else {
$title = __( 'Tools' );
get_current_screen()->add_help_tab(
array(
'id' => 'converter',
'title' => __( 'Categories and Tags Converter' ),
'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>' .
'<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>',
)
);
get_current_screen()->set_help_sidebar(
'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
'<p>' . __( '<a href="https://codex.wordpress.org/Tools_Screen">Documentation on Tools</a>' ) . '</p>' .
'<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
);
// The privacy policy guide used to be outputted from here. Since WP 5.3 it is in wp-admin/privacy-policy-guide.php.
if ( isset( $_GET['wp-privacy-policy-guide'] ) ) {
wp_redirect( admin_url( 'privacy-policy-guide.php' ), 301 );
exit;
} elseif ( isset( $_GET['page'] ) ) {
// These were also moved to files in WP 5.3.
if ( $_GET['page'] === 'export_personal_data' ) {
wp_redirect( admin_url( 'export-personal-data.php' ), 301 );
exit;
} elseif ( $_GET['page'] === 'remove_personal_data' ) {
wp_redirect( admin_url( 'erase-personal-data.php' ), 301 );
exit;
}
}
$title = __( 'Tools' );
get_current_screen()->add_help_tab(
array(
'id' => 'converter',
'title' => __( 'Categories and Tags Converter' ),
'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>' .
'<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>',
)
);
get_current_screen()->set_help_sidebar(
'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
'<p>' . __( '<a href="https://codex.wordpress.org/Tools_Screen">Documentation on Tools</a>' ) . '</p>' .
'<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
);
require_once( ABSPATH . 'wp-admin/admin-header.php' );
?>
@@ -44,15 +60,6 @@ require_once( ABSPATH . 'wp-admin/admin-header.php' );
<h1><?php echo esc_html( $title ); ?></h1>
<?php
if ( $is_privacy_guide ) {
?>
<div class="wp-privacy-policy-guide">
<?php WP_Privacy_Policy_Content::privacy_policy_guide(); ?>
</div>
<?php
} else {
if ( current_user_can( 'import' ) ) :
$cats = get_taxonomy( 'category' );
$tags = get_taxonomy( 'post_tag' );
@@ -72,8 +79,9 @@ if ( $is_privacy_guide ) {
* @since 2.8.0
*/
do_action( 'tool_box' );
}
?>
</div>
<?php
include( ABSPATH . 'wp-admin/admin-footer.php' );