Privacy tools: Organize privacy functions into logical files and classes.
Props xkon, birgire, desrosj, garrett-eclipse, azaozz. See #43895. Built from https://develop.svn.wordpress.org/trunk@45448 git-svn-id: http://core.svn.wordpress.org/trunk@45259 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
67f944caa6
commit
87acdab81d
|
@ -0,0 +1,96 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Privacy tools, Erase Personal Data screen.
|
||||||
|
*
|
||||||
|
* @package WordPress
|
||||||
|
* @subpackage Administration
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** WordPress Administration Bootstrap */
|
||||||
|
require_once( dirname( __FILE__ ) . '/admin.php' );
|
||||||
|
|
||||||
|
if ( ! current_user_can( 'erase_others_personal_data' ) || ! current_user_can( 'delete_users' ) ) {
|
||||||
|
wp_die( __( 'Sorry, you are not allowed to erase data on this site.' ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! class_exists( 'WP_Privacy_Data_Removal_Requests_Table' ) ) {
|
||||||
|
require_once( ABSPATH . 'wp-admin/includes/class-wp-privacy-data-removal-requests-table.php' );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle list table actions.
|
||||||
|
_wp_personal_data_handle_actions();
|
||||||
|
|
||||||
|
// Cleans up failed and expired requests before displaying the list table.
|
||||||
|
_wp_personal_data_cleanup_requests();
|
||||||
|
|
||||||
|
wp_enqueue_script( 'privacy-tools' );
|
||||||
|
|
||||||
|
add_screen_option(
|
||||||
|
'per_page',
|
||||||
|
array(
|
||||||
|
'default' => 20,
|
||||||
|
'option' => 'remove_personal_data_requests_per_page',
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$_list_table_args = array(
|
||||||
|
'plural' => 'privacy_requests',
|
||||||
|
'singular' => 'privacy_request',
|
||||||
|
);
|
||||||
|
|
||||||
|
$requests_table = _get_list_table( 'WP_Privacy_Data_Removal_Requests_List_Table', $_list_table_args );
|
||||||
|
|
||||||
|
$requests_table->screen->set_screen_reader_content(
|
||||||
|
array(
|
||||||
|
'heading_views' => __( 'Filter erase personal data list' ),
|
||||||
|
'heading_pagination' => __( 'Erase personal data list navigation' ),
|
||||||
|
'heading_list' => __( 'Erase personal data list' ),
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$requests_table->process_bulk_action();
|
||||||
|
$requests_table->prepare_items();
|
||||||
|
|
||||||
|
require_once( ABSPATH . 'wp-admin/admin-header.php' );
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="wrap nosubsub">
|
||||||
|
<h1><?php esc_html_e( 'Erase Personal Data' ); ?></h1>
|
||||||
|
<hr class="wp-header-end" />
|
||||||
|
|
||||||
|
<?php settings_errors(); ?>
|
||||||
|
|
||||||
|
<form action="<?php echo esc_url( admin_url( 'erase-personal-data.php' ) ); ?>" method="post" class="wp-privacy-request-form">
|
||||||
|
<h2><?php esc_html_e( 'Add Data Erasure Request' ); ?></h2>
|
||||||
|
<p><?php esc_html_e( 'An email will be sent to the user at this email address asking them to verify the request.' ); ?></p>
|
||||||
|
|
||||||
|
<div class="wp-privacy-request-form-field">
|
||||||
|
<label for="username_or_email_for_privacy_request"><?php esc_html_e( 'Username or email address' ); ?></label>
|
||||||
|
<input type="text" required class="regular-text" id="username_or_email_for_privacy_request" name="username_or_email_for_privacy_request" />
|
||||||
|
<?php submit_button( __( 'Send Request' ), 'secondary', 'submit', false ); ?>
|
||||||
|
</div>
|
||||||
|
<?php wp_nonce_field( 'personal-data-request' ); ?>
|
||||||
|
<input type="hidden" name="action" value="add_remove_personal_data_request" />
|
||||||
|
<input type="hidden" name="type_of_action" value="remove_personal_data" />
|
||||||
|
</form>
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
<?php $requests_table->views(); ?>
|
||||||
|
|
||||||
|
<form class="search-form wp-clearfix">
|
||||||
|
<?php $requests_table->search_box( __( 'Search Requests' ), 'requests' ); ?>
|
||||||
|
<input type="hidden" name="filter-status" value="<?php echo isset( $_REQUEST['filter-status'] ) ? esc_attr( sanitize_text_field( $_REQUEST['filter-status'] ) ) : ''; ?>" />
|
||||||
|
<input type="hidden" name="orderby" value="<?php echo isset( $_REQUEST['orderby'] ) ? esc_attr( sanitize_text_field( $_REQUEST['orderby'] ) ) : ''; ?>" />
|
||||||
|
<input type="hidden" name="order" value="<?php echo isset( $_REQUEST['order'] ) ? esc_attr( sanitize_text_field( $_REQUEST['order'] ) ) : ''; ?>" />
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<form method="post">
|
||||||
|
<?php
|
||||||
|
$requests_table->display();
|
||||||
|
$requests_table->embed_scripts();
|
||||||
|
?>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
include( ABSPATH . 'wp-admin/admin-footer.php' );
|
|
@ -0,0 +1,96 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Privacy tools, Export Personal Data screen.
|
||||||
|
*
|
||||||
|
* @package WordPress
|
||||||
|
* @subpackage Administration
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** WordPress Administration Bootstrap */
|
||||||
|
require_once( dirname( __FILE__ ) . '/admin.php' );
|
||||||
|
|
||||||
|
if ( ! current_user_can( 'export_others_personal_data' ) ) {
|
||||||
|
wp_die( __( 'Sorry, you are not allowed to export personal data on this site.' ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! class_exists( 'WP_Privacy_Data_Export_Requests_Table' ) ) {
|
||||||
|
require_once( ABSPATH . 'wp-admin/includes/class-wp-privacy-data-export-requests-table.php' );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle list table actions.
|
||||||
|
_wp_personal_data_handle_actions();
|
||||||
|
|
||||||
|
// Cleans up failed and expired requests before displaying the list table.
|
||||||
|
_wp_personal_data_cleanup_requests();
|
||||||
|
|
||||||
|
wp_enqueue_script( 'privacy-tools' );
|
||||||
|
|
||||||
|
add_screen_option(
|
||||||
|
'per_page',
|
||||||
|
array(
|
||||||
|
'default' => 20,
|
||||||
|
'option' => 'export_personal_data_requests_per_page',
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$_list_table_args = array(
|
||||||
|
'plural' => 'privacy_requests',
|
||||||
|
'singular' => 'privacy_request',
|
||||||
|
);
|
||||||
|
|
||||||
|
$requests_table = _get_list_table( 'WP_Privacy_Data_Export_Requests_List_Table', $_list_table_args );
|
||||||
|
|
||||||
|
$requests_table->screen->set_screen_reader_content(
|
||||||
|
array(
|
||||||
|
'heading_views' => __( 'Filter export personal data list' ),
|
||||||
|
'heading_pagination' => __( 'Export personal data list navigation' ),
|
||||||
|
'heading_list' => __( 'Export personal data list' ),
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$requests_table->process_bulk_action();
|
||||||
|
$requests_table->prepare_items();
|
||||||
|
|
||||||
|
require_once( ABSPATH . 'wp-admin/admin-header.php' );
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="wrap nosubsub">
|
||||||
|
<h1><?php esc_html_e( 'Export Personal Data' ); ?></h1>
|
||||||
|
<hr class="wp-header-end" />
|
||||||
|
|
||||||
|
<?php settings_errors(); ?>
|
||||||
|
|
||||||
|
<form action="<?php echo esc_url( admin_url( 'export-personal-data.php' ) ); ?>" method="post" class="wp-privacy-request-form">
|
||||||
|
<h2><?php esc_html_e( 'Add Data Export Request' ); ?></h2>
|
||||||
|
<p><?php esc_html_e( 'An email will be sent to the user at this email address asking them to verify the request.' ); ?></p>
|
||||||
|
|
||||||
|
<div class="wp-privacy-request-form-field">
|
||||||
|
<label for="username_or_email_for_privacy_request"><?php esc_html_e( 'Username or email address' ); ?></label>
|
||||||
|
<input type="text" required class="regular-text" id="username_or_email_for_privacy_request" name="username_or_email_for_privacy_request" />
|
||||||
|
<?php submit_button( __( 'Send Request' ), 'secondary', 'submit', false ); ?>
|
||||||
|
</div>
|
||||||
|
<?php wp_nonce_field( 'personal-data-request' ); ?>
|
||||||
|
<input type="hidden" name="action" value="add_export_personal_data_request" />
|
||||||
|
<input type="hidden" name="type_of_action" value="export_personal_data" />
|
||||||
|
</form>
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
<?php $requests_table->views(); ?>
|
||||||
|
|
||||||
|
<form class="search-form wp-clearfix">
|
||||||
|
<?php $requests_table->search_box( __( 'Search Requests' ), 'requests' ); ?>
|
||||||
|
<input type="hidden" name="filter-status" value="<?php echo isset( $_REQUEST['filter-status'] ) ? esc_attr( sanitize_text_field( $_REQUEST['filter-status'] ) ) : ''; ?>" />
|
||||||
|
<input type="hidden" name="orderby" value="<?php echo isset( $_REQUEST['orderby'] ) ? esc_attr( sanitize_text_field( $_REQUEST['orderby'] ) ) : ''; ?>" />
|
||||||
|
<input type="hidden" name="order" value="<?php echo isset( $_REQUEST['order'] ) ? esc_attr( sanitize_text_field( $_REQUEST['order'] ) ) : ''; ?>" />
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<form method="post">
|
||||||
|
<?php
|
||||||
|
$requests_table->display();
|
||||||
|
$requests_table->embed_scripts();
|
||||||
|
?>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
include( ABSPATH . 'wp-admin/admin-footer.php' );
|
|
@ -45,11 +45,6 @@ add_action( 'admin_head', 'wp_color_scheme_settings' );
|
||||||
add_action( 'admin_head', 'wp_site_icon' );
|
add_action( 'admin_head', 'wp_site_icon' );
|
||||||
add_action( 'admin_head', '_ipad_meta' );
|
add_action( 'admin_head', '_ipad_meta' );
|
||||||
|
|
||||||
// Privacy tools
|
|
||||||
add_action( 'admin_menu', '_wp_privacy_hook_requests_page' );
|
|
||||||
add_action( 'load-tools_page_export_personal_data', '_wp_privacy_requests_screen_options' );
|
|
||||||
add_action( 'load-tools_page_remove_personal_data', '_wp_privacy_requests_screen_options' );
|
|
||||||
|
|
||||||
// Prerendering.
|
// Prerendering.
|
||||||
if ( ! is_customize_preview() ) {
|
if ( ! is_customize_preview() ) {
|
||||||
add_filter( 'admin_print_styles', 'wp_resource_hints', 1 );
|
add_filter( 'admin_print_styles', 'wp_resource_hints', 1 );
|
||||||
|
|
|
@ -40,6 +40,9 @@ require_once( ABSPATH . 'wp-admin/includes/import.php' );
|
||||||
/** WordPress Misc Administration API */
|
/** WordPress Misc Administration API */
|
||||||
require_once( ABSPATH . 'wp-admin/includes/misc.php' );
|
require_once( ABSPATH . 'wp-admin/includes/misc.php' );
|
||||||
|
|
||||||
|
/** WordPress Misc Administration API */
|
||||||
|
require_once( ABSPATH . 'wp-admin/includes/class-wp-privacy-policy-content.php' );
|
||||||
|
|
||||||
/** WordPress Options Administration API */
|
/** WordPress Options Administration API */
|
||||||
require_once( ABSPATH . 'wp-admin/includes/options.php' );
|
require_once( ABSPATH . 'wp-admin/includes/options.php' );
|
||||||
|
|
||||||
|
@ -67,6 +70,15 @@ require_once( ABSPATH . 'wp-admin/includes/list-table.php' );
|
||||||
/** WordPress Theme Administration API */
|
/** WordPress Theme Administration API */
|
||||||
require_once( ABSPATH . 'wp-admin/includes/theme.php' );
|
require_once( ABSPATH . 'wp-admin/includes/theme.php' );
|
||||||
|
|
||||||
|
/** WordPress Privacy Functions */
|
||||||
|
require_once( ABSPATH . 'wp-admin/includes/privacy-tools.php' );
|
||||||
|
|
||||||
|
/** WordPress Privacy List Table classes. */
|
||||||
|
// Previously in wp-admin/includes/user.php. Need to be loaded for backwards compatibility.
|
||||||
|
require_once( ABSPATH . 'wp-admin/includes/class-wp-privacy-requests-table.php' );
|
||||||
|
require_once( ABSPATH . 'wp-admin/includes/class-wp-privacy-data-export-requests-list-table.php' );
|
||||||
|
require_once( ABSPATH . 'wp-admin/includes/class-wp-privacy-data-removal-requests-list-table.php' );
|
||||||
|
|
||||||
/** WordPress User Administration API */
|
/** WordPress User Administration API */
|
||||||
require_once( ABSPATH . 'wp-admin/includes/user.php' );
|
require_once( ABSPATH . 'wp-admin/includes/user.php' );
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,129 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* List Table API: WP_Privacy_Data_Export_Requests_List_Table class
|
||||||
|
*
|
||||||
|
* @package WordPress
|
||||||
|
* @subpackage Administration
|
||||||
|
* @since 4.9.6
|
||||||
|
*/
|
||||||
|
|
||||||
|
if ( ! class_exists( 'WP_Privacy_Requests_Table' ) ) {
|
||||||
|
require_once( ABSPATH . 'wp-admin/includes/class-wp-privacy-requests-table.php' );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WP_Privacy_Data_Export_Requests_Table class.
|
||||||
|
*
|
||||||
|
* @since 4.9.6
|
||||||
|
*/
|
||||||
|
class WP_Privacy_Data_Export_Requests_List_Table extends WP_Privacy_Requests_Table {
|
||||||
|
/**
|
||||||
|
* Action name for the requests this table will work with.
|
||||||
|
*
|
||||||
|
* @since 4.9.6
|
||||||
|
*
|
||||||
|
* @var string $request_type Name of action.
|
||||||
|
*/
|
||||||
|
protected $request_type = 'export_personal_data';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Post type for the requests.
|
||||||
|
*
|
||||||
|
* @since 4.9.6
|
||||||
|
*
|
||||||
|
* @var string $post_type The post type.
|
||||||
|
*/
|
||||||
|
protected $post_type = 'user_request';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Actions column.
|
||||||
|
*
|
||||||
|
* @since 4.9.6
|
||||||
|
*
|
||||||
|
* @param WP_User_Request $item Item being shown.
|
||||||
|
* @return string Email column markup.
|
||||||
|
*/
|
||||||
|
public function column_email( $item ) {
|
||||||
|
/** This filter is documented in wp-admin/includes/ajax-actions.php */
|
||||||
|
$exporters = apply_filters( 'wp_privacy_personal_data_exporters', array() );
|
||||||
|
$exporters_count = count( $exporters );
|
||||||
|
$request_id = $item->ID;
|
||||||
|
$nonce = wp_create_nonce( 'wp-privacy-export-personal-data-' . $request_id );
|
||||||
|
|
||||||
|
$download_data_markup = '<div class="export-personal-data" ' .
|
||||||
|
'data-exporters-count="' . esc_attr( $exporters_count ) . '" ' .
|
||||||
|
'data-request-id="' . esc_attr( $request_id ) . '" ' .
|
||||||
|
'data-nonce="' . esc_attr( $nonce ) .
|
||||||
|
'">';
|
||||||
|
|
||||||
|
$download_data_markup .= '<span class="export-personal-data-idle"><button type="button" class="button-link export-personal-data-handle">' . __( 'Download Personal Data' ) . '</button></span>' .
|
||||||
|
'<span style="display:none" class="export-personal-data-processing" >' . __( 'Downloading Data...' ) . '</span>' .
|
||||||
|
'<span style="display:none" class="export-personal-data-success"><button type="button" class="button-link export-personal-data-handle">' . __( 'Download Personal Data Again' ) . '</button></span>' .
|
||||||
|
'<span style="display:none" class="export-personal-data-failed">' . __( 'Download failed.' ) . ' <button type="button" class="button-link">' . __( 'Retry' ) . '</button></span>';
|
||||||
|
|
||||||
|
$download_data_markup .= '</div>';
|
||||||
|
|
||||||
|
$row_actions = array(
|
||||||
|
'download-data' => $download_data_markup,
|
||||||
|
);
|
||||||
|
|
||||||
|
return sprintf( '<a href="%1$s">%2$s</a> %3$s', esc_url( 'mailto:' . $item->email ), $item->email, $this->row_actions( $row_actions ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Displays the next steps column.
|
||||||
|
*
|
||||||
|
* @since 4.9.6
|
||||||
|
*
|
||||||
|
* @param WP_User_Request $item Item being shown.
|
||||||
|
*/
|
||||||
|
public function column_next_steps( $item ) {
|
||||||
|
$status = $item->status;
|
||||||
|
|
||||||
|
switch ( $status ) {
|
||||||
|
case 'request-pending':
|
||||||
|
esc_html_e( 'Waiting for confirmation' );
|
||||||
|
break;
|
||||||
|
case 'request-confirmed':
|
||||||
|
/** This filter is documented in wp-admin/includes/ajax-actions.php */
|
||||||
|
$exporters = apply_filters( 'wp_privacy_personal_data_exporters', array() );
|
||||||
|
$exporters_count = count( $exporters );
|
||||||
|
$request_id = $item->ID;
|
||||||
|
$nonce = wp_create_nonce( 'wp-privacy-export-personal-data-' . $request_id );
|
||||||
|
|
||||||
|
echo '<div class="export-personal-data" ' .
|
||||||
|
'data-send-as-email="1" ' .
|
||||||
|
'data-exporters-count="' . esc_attr( $exporters_count ) . '" ' .
|
||||||
|
'data-request-id="' . esc_attr( $request_id ) . '" ' .
|
||||||
|
'data-nonce="' . esc_attr( $nonce ) .
|
||||||
|
'">';
|
||||||
|
|
||||||
|
?>
|
||||||
|
<span class="export-personal-data-idle"><button type="button" class="button export-personal-data-handle"><?php _e( 'Send Export Link' ); ?></button></span>
|
||||||
|
<span style="display:none" class="export-personal-data-processing button updating-message" ><?php _e( 'Sending Email...' ); ?></span>
|
||||||
|
<span style="display:none" class="export-personal-data-success success-message" ><?php _e( 'Email sent.' ); ?></span>
|
||||||
|
<span style="display:none" class="export-personal-data-failed"><?php _e( 'Email could not be sent.' ); ?> <button type="button" class="button export-personal-data-handle"><?php _e( 'Retry' ); ?></button></span>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
echo '</div>';
|
||||||
|
break;
|
||||||
|
case 'request-failed':
|
||||||
|
submit_button( __( 'Retry' ), 'secondary', 'privacy_action_email_retry[' . $item->ID . ']', false );
|
||||||
|
break;
|
||||||
|
case 'request-completed':
|
||||||
|
echo '<a href="' . esc_url(
|
||||||
|
wp_nonce_url(
|
||||||
|
add_query_arg(
|
||||||
|
array(
|
||||||
|
'action' => 'delete',
|
||||||
|
'request_id' => array( $item->ID ),
|
||||||
|
),
|
||||||
|
admin_url( 'export-personal-data.php' )
|
||||||
|
),
|
||||||
|
'bulk-privacy_requests'
|
||||||
|
)
|
||||||
|
) . '" class="button">' . esc_html__( 'Remove request' ) . '</a>';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,135 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* List Table API: WP_Privacy_Data_Removal_Requests_List_Table class
|
||||||
|
*
|
||||||
|
* @package WordPress
|
||||||
|
* @subpackage Administration
|
||||||
|
* @since 4.9.6
|
||||||
|
*/
|
||||||
|
|
||||||
|
if ( ! class_exists( 'WP_Privacy_Requests_Table' ) ) {
|
||||||
|
require_once( ABSPATH . 'wp-admin/includes/class-wp-privacy-requests-table.php' );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WP_Privacy_Data_Removal_Requests_Table class.
|
||||||
|
*
|
||||||
|
* @since 4.9.6
|
||||||
|
*/
|
||||||
|
class WP_Privacy_Data_Removal_Requests_List_Table extends WP_Privacy_Requests_Table {
|
||||||
|
/**
|
||||||
|
* Action name for the requests this table will work with.
|
||||||
|
*
|
||||||
|
* @since 4.9.6
|
||||||
|
*
|
||||||
|
* @var string $request_type Name of action.
|
||||||
|
*/
|
||||||
|
protected $request_type = 'remove_personal_data';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Post type for the requests.
|
||||||
|
*
|
||||||
|
* @since 4.9.6
|
||||||
|
*
|
||||||
|
* @var string $post_type The post type.
|
||||||
|
*/
|
||||||
|
protected $post_type = 'user_request';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Actions column.
|
||||||
|
*
|
||||||
|
* @since 4.9.6
|
||||||
|
*
|
||||||
|
* @param WP_User_Request $item Item being shown.
|
||||||
|
* @return string Email column markup.
|
||||||
|
*/
|
||||||
|
public function column_email( $item ) {
|
||||||
|
$row_actions = array();
|
||||||
|
|
||||||
|
// Allow the administrator to "force remove" the personal data even if confirmation has not yet been received.
|
||||||
|
$status = $item->status;
|
||||||
|
if ( 'request-confirmed' !== $status ) {
|
||||||
|
/** This filter is documented in wp-admin/includes/ajax-actions.php */
|
||||||
|
$erasers = apply_filters( 'wp_privacy_personal_data_erasers', array() );
|
||||||
|
$erasers_count = count( $erasers );
|
||||||
|
$request_id = $item->ID;
|
||||||
|
$nonce = wp_create_nonce( 'wp-privacy-erase-personal-data-' . $request_id );
|
||||||
|
|
||||||
|
$remove_data_markup = '<div class="remove-personal-data force-remove-personal-data" ' .
|
||||||
|
'data-erasers-count="' . esc_attr( $erasers_count ) . '" ' .
|
||||||
|
'data-request-id="' . esc_attr( $request_id ) . '" ' .
|
||||||
|
'data-nonce="' . esc_attr( $nonce ) .
|
||||||
|
'">';
|
||||||
|
|
||||||
|
$remove_data_markup .= '<span class="remove-personal-data-idle"><button type="button" class="button-link remove-personal-data-handle">' . __( 'Force Erase Personal Data' ) . '</button></span>' .
|
||||||
|
'<span style="display:none" class="remove-personal-data-processing" >' . __( 'Erasing Data...' ) . '</span>' .
|
||||||
|
'<span style="display:none" class="remove-personal-data-failed">' . __( 'Force Erase has failed.' ) . ' <button type="button" class="button-link remove-personal-data-handle">' . __( 'Retry' ) . '</button></span>';
|
||||||
|
|
||||||
|
$remove_data_markup .= '</div>';
|
||||||
|
|
||||||
|
$row_actions = array(
|
||||||
|
'remove-data' => $remove_data_markup,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return sprintf( '<a href="%1$s">%2$s</a> %3$s', esc_url( 'mailto:' . $item->email ), $item->email, $this->row_actions( $row_actions ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Next steps column.
|
||||||
|
*
|
||||||
|
* @since 4.9.6
|
||||||
|
*
|
||||||
|
* @param WP_User_Request $item Item being shown.
|
||||||
|
*/
|
||||||
|
public function column_next_steps( $item ) {
|
||||||
|
$status = $item->status;
|
||||||
|
|
||||||
|
switch ( $status ) {
|
||||||
|
case 'request-pending':
|
||||||
|
esc_html_e( 'Waiting for confirmation' );
|
||||||
|
break;
|
||||||
|
case 'request-confirmed':
|
||||||
|
/** This filter is documented in wp-admin/includes/ajax-actions.php */
|
||||||
|
$erasers = apply_filters( 'wp_privacy_personal_data_erasers', array() );
|
||||||
|
$erasers_count = count( $erasers );
|
||||||
|
$request_id = $item->ID;
|
||||||
|
$nonce = wp_create_nonce( 'wp-privacy-erase-personal-data-' . $request_id );
|
||||||
|
|
||||||
|
echo '<div class="remove-personal-data" ' .
|
||||||
|
'data-force-erase="1" ' .
|
||||||
|
'data-erasers-count="' . esc_attr( $erasers_count ) . '" ' .
|
||||||
|
'data-request-id="' . esc_attr( $request_id ) . '" ' .
|
||||||
|
'data-nonce="' . esc_attr( $nonce ) .
|
||||||
|
'">';
|
||||||
|
|
||||||
|
?>
|
||||||
|
<span class="remove-personal-data-idle"><button type="button" class="button remove-personal-data-handle"><?php _e( 'Erase Personal Data' ); ?></button></span>
|
||||||
|
<span style="display:none" class="remove-personal-data-processing button updating-message" ><?php _e( 'Erasing Data...' ); ?></span>
|
||||||
|
<span style="display:none" class="remove-personal-data-failed"><?php _e( 'Erasing Data has failed.' ); ?> <button type="button" class="button remove-personal-data-handle"><?php _e( 'Retry' ); ?></button></span>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
echo '</div>';
|
||||||
|
|
||||||
|
break;
|
||||||
|
case 'request-failed':
|
||||||
|
submit_button( __( 'Retry' ), 'secondary', 'privacy_action_email_retry[' . $item->ID . ']', false );
|
||||||
|
break;
|
||||||
|
case 'request-completed':
|
||||||
|
echo '<a href="' . esc_url(
|
||||||
|
wp_nonce_url(
|
||||||
|
add_query_arg(
|
||||||
|
array(
|
||||||
|
'action' => 'delete',
|
||||||
|
'request_id' => array( $item->ID ),
|
||||||
|
),
|
||||||
|
admin_url( 'erase-personal-data.php' )
|
||||||
|
),
|
||||||
|
'bulk-privacy_requests'
|
||||||
|
)
|
||||||
|
) . '" class="button">' . esc_html__( 'Remove request' ) . '</a>';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,716 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* WP_Privacy_Policy_Content class.
|
||||||
|
*
|
||||||
|
* @package WordPress
|
||||||
|
* @subpackage Administration
|
||||||
|
* @since 4.9.6
|
||||||
|
*/
|
||||||
|
|
||||||
|
final class WP_Privacy_Policy_Content {
|
||||||
|
|
||||||
|
private static $policy_content = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @since 4.9.6
|
||||||
|
*/
|
||||||
|
private function __construct() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add content to the postbox shown when editing the privacy policy.
|
||||||
|
*
|
||||||
|
* Plugins and themes should suggest text for inclusion in the site's privacy policy.
|
||||||
|
* The suggested text should contain information about any functionality that affects user privacy,
|
||||||
|
* and will be shown in the Suggested Privacy Policy Content postbox.
|
||||||
|
*
|
||||||
|
* Intended for use from `wp_add_privacy_policy_content()`.
|
||||||
|
*
|
||||||
|
* @since 4.9.6
|
||||||
|
*
|
||||||
|
* @param string $plugin_name The name of the plugin or theme that is suggesting content for the site's privacy policy.
|
||||||
|
* @param string $policy_text The suggested content for inclusion in the policy.
|
||||||
|
*/
|
||||||
|
public static function add( $plugin_name, $policy_text ) {
|
||||||
|
if ( empty( $plugin_name ) || empty( $policy_text ) ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = array(
|
||||||
|
'plugin_name' => $plugin_name,
|
||||||
|
'policy_text' => $policy_text,
|
||||||
|
);
|
||||||
|
|
||||||
|
if ( ! in_array( $data, self::$policy_content, true ) ) {
|
||||||
|
self::$policy_content[] = $data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Quick check if any privacy info has changed.
|
||||||
|
*
|
||||||
|
* @since 4.9.6
|
||||||
|
*/
|
||||||
|
public static function text_change_check() {
|
||||||
|
|
||||||
|
$policy_page_id = (int) get_option( 'wp_page_for_privacy_policy' );
|
||||||
|
|
||||||
|
// The site doesn't have a privacy policy.
|
||||||
|
if ( empty( $policy_page_id ) ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! current_user_can( 'edit_post', $policy_page_id ) ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$old = (array) get_post_meta( $policy_page_id, '_wp_suggested_privacy_policy_content' );
|
||||||
|
|
||||||
|
// Updates are not relevant if the user has not reviewed any suggestions yet.
|
||||||
|
if ( empty( $old ) ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$cached = get_option( '_wp_suggested_policy_text_has_changed' );
|
||||||
|
|
||||||
|
/*
|
||||||
|
* When this function is called before `admin_init`, `self::$policy_content`
|
||||||
|
* has not been populated yet, so use the cached result from the last
|
||||||
|
* execution instead.
|
||||||
|
*/
|
||||||
|
if ( ! did_action( 'admin_init' ) ) {
|
||||||
|
return 'changed' === $cached;
|
||||||
|
}
|
||||||
|
|
||||||
|
$new = self::$policy_content;
|
||||||
|
|
||||||
|
// Remove the extra values added to the meta.
|
||||||
|
foreach ( $old as $key => $data ) {
|
||||||
|
if ( ! empty( $data['removed'] ) ) {
|
||||||
|
unset( $old[ $key ] );
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$old[ $key ] = array(
|
||||||
|
'plugin_name' => $data['plugin_name'],
|
||||||
|
'policy_text' => $data['policy_text'],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Normalize the order of texts, to facilitate comparison.
|
||||||
|
sort( $old );
|
||||||
|
sort( $new );
|
||||||
|
|
||||||
|
// The == operator (equal, not identical) was used intentionally.
|
||||||
|
// See http://php.net/manual/en/language.operators.array.php
|
||||||
|
if ( $new != $old ) {
|
||||||
|
// A plugin was activated or deactivated, or some policy text has changed.
|
||||||
|
// Show a notice on the relevant screens to inform the admin.
|
||||||
|
add_action( 'admin_notices', array( 'WP_Privacy_Policy_Content', 'policy_text_changed_notice' ) );
|
||||||
|
$state = 'changed';
|
||||||
|
} else {
|
||||||
|
$state = 'not-changed';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Cache the result for use before `admin_init` (see above).
|
||||||
|
if ( $cached !== $state ) {
|
||||||
|
update_option( '_wp_suggested_policy_text_has_changed', $state );
|
||||||
|
}
|
||||||
|
|
||||||
|
return 'changed' === $state;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Output a warning when some privacy info has changed.
|
||||||
|
*
|
||||||
|
* @since 4.9.6
|
||||||
|
*/
|
||||||
|
public static function policy_text_changed_notice() {
|
||||||
|
global $post;
|
||||||
|
|
||||||
|
$screen = get_current_screen()->id;
|
||||||
|
|
||||||
|
if ( 'privacy' !== $screen ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
<div class="policy-text-updated notice notice-warning is-dismissible">
|
||||||
|
<p>
|
||||||
|
<?php
|
||||||
|
printf(
|
||||||
|
/* translators: %s: Privacy Policy Guide URL */
|
||||||
|
__( 'The suggested privacy policy text has changed. Please <a href="%s">review the guide</a> and update your privacy policy.' ),
|
||||||
|
esc_url( admin_url( 'privacy-policy-guide.php' ) )
|
||||||
|
);
|
||||||
|
?>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the cached policy info when the policy page is updated.
|
||||||
|
*
|
||||||
|
* @since 4.9.6
|
||||||
|
* @access private
|
||||||
|
*/
|
||||||
|
public static function _policy_page_updated( $post_id ) {
|
||||||
|
$policy_page_id = (int) get_option( 'wp_page_for_privacy_policy' );
|
||||||
|
|
||||||
|
if ( ! $policy_page_id || $policy_page_id !== (int) $post_id ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove updated|removed status.
|
||||||
|
$old = (array) get_post_meta( $policy_page_id, '_wp_suggested_privacy_policy_content' );
|
||||||
|
$done = array();
|
||||||
|
$update_cache = false;
|
||||||
|
|
||||||
|
foreach ( $old as $old_key => $old_data ) {
|
||||||
|
if ( ! empty( $old_data['removed'] ) ) {
|
||||||
|
// Remove the old policy text.
|
||||||
|
$update_cache = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! empty( $old_data['updated'] ) ) {
|
||||||
|
// 'updated' is now 'added'.
|
||||||
|
$done[] = array(
|
||||||
|
'plugin_name' => $old_data['plugin_name'],
|
||||||
|
'policy_text' => $old_data['policy_text'],
|
||||||
|
'added' => $old_data['updated'],
|
||||||
|
);
|
||||||
|
$update_cache = true;
|
||||||
|
} else {
|
||||||
|
$done[] = $old_data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $update_cache ) {
|
||||||
|
delete_post_meta( $policy_page_id, '_wp_suggested_privacy_policy_content' );
|
||||||
|
// Update the cache.
|
||||||
|
foreach ( $done as $data ) {
|
||||||
|
add_post_meta( $policy_page_id, '_wp_suggested_privacy_policy_content', $data );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check for updated, added or removed privacy policy information from plugins.
|
||||||
|
*
|
||||||
|
* Caches the current info in post_meta of the policy page.
|
||||||
|
*
|
||||||
|
* @since 4.9.6
|
||||||
|
*
|
||||||
|
* @return array The privacy policy text/informtion added by core and plugins.
|
||||||
|
*/
|
||||||
|
public static function get_suggested_policy_text() {
|
||||||
|
$policy_page_id = (int) get_option( 'wp_page_for_privacy_policy' );
|
||||||
|
$checked = array();
|
||||||
|
$time = time();
|
||||||
|
$update_cache = false;
|
||||||
|
$new = self::$policy_content;
|
||||||
|
$old = array();
|
||||||
|
|
||||||
|
if ( $policy_page_id ) {
|
||||||
|
$old = (array) get_post_meta( $policy_page_id, '_wp_suggested_privacy_policy_content' );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check for no-changes and updates.
|
||||||
|
foreach ( $new as $new_key => $new_data ) {
|
||||||
|
foreach ( $old as $old_key => $old_data ) {
|
||||||
|
$found = false;
|
||||||
|
|
||||||
|
if ( $new_data['policy_text'] === $old_data['policy_text'] ) {
|
||||||
|
// Use the new plugin name in case it was changed, translated, etc.
|
||||||
|
if ( $old_data['plugin_name'] !== $new_data['plugin_name'] ) {
|
||||||
|
$old_data['plugin_name'] = $new_data['plugin_name'];
|
||||||
|
$update_cache = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// A plugin was re-activated.
|
||||||
|
if ( ! empty( $old_data['removed'] ) ) {
|
||||||
|
unset( $old_data['removed'] );
|
||||||
|
$old_data['added'] = $time;
|
||||||
|
$update_cache = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$checked[] = $old_data;
|
||||||
|
$found = true;
|
||||||
|
} elseif ( $new_data['plugin_name'] === $old_data['plugin_name'] ) {
|
||||||
|
// The info for the policy was updated.
|
||||||
|
$checked[] = array(
|
||||||
|
'plugin_name' => $new_data['plugin_name'],
|
||||||
|
'policy_text' => $new_data['policy_text'],
|
||||||
|
'updated' => $time,
|
||||||
|
);
|
||||||
|
$found = $update_cache = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $found ) {
|
||||||
|
unset( $new[ $new_key ], $old[ $old_key ] );
|
||||||
|
continue 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! empty( $new ) ) {
|
||||||
|
// A plugin was activated.
|
||||||
|
foreach ( $new as $new_data ) {
|
||||||
|
if ( ! empty( $new_data['plugin_name'] ) && ! empty( $new_data['policy_text'] ) ) {
|
||||||
|
$new_data['added'] = $time;
|
||||||
|
$checked[] = $new_data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$update_cache = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! empty( $old ) ) {
|
||||||
|
// A plugin was deactivated.
|
||||||
|
foreach ( $old as $old_data ) {
|
||||||
|
if ( ! empty( $old_data['plugin_name'] ) && ! empty( $old_data['policy_text'] ) ) {
|
||||||
|
$data = array(
|
||||||
|
'plugin_name' => $old_data['plugin_name'],
|
||||||
|
'policy_text' => $old_data['policy_text'],
|
||||||
|
'removed' => $time,
|
||||||
|
);
|
||||||
|
|
||||||
|
$checked[] = $data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$update_cache = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $update_cache && $policy_page_id ) {
|
||||||
|
delete_post_meta( $policy_page_id, '_wp_suggested_privacy_policy_content' );
|
||||||
|
// Update the cache.
|
||||||
|
foreach ( $checked as $data ) {
|
||||||
|
add_post_meta( $policy_page_id, '_wp_suggested_privacy_policy_content', $data );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $checked;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a notice with a link to the guide when editing the privacy policy page.
|
||||||
|
*
|
||||||
|
* @since 4.9.6
|
||||||
|
* @since 5.0.0 The $post parameter is now optional.
|
||||||
|
*
|
||||||
|
* @param WP_Post|null $post The currently edited post. Default null.
|
||||||
|
*/
|
||||||
|
public static function notice( $post = null ) {
|
||||||
|
if ( is_null( $post ) ) {
|
||||||
|
global $post;
|
||||||
|
} else {
|
||||||
|
$post = get_post( $post );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! ( $post instanceof WP_Post ) ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! current_user_can( 'manage_privacy_options' ) ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$policy_page_id = (int) get_option( 'wp_page_for_privacy_policy' );
|
||||||
|
|
||||||
|
if ( ! $policy_page_id || $policy_page_id !== $post->ID ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$message = __( 'Need help putting together your new Privacy Policy page? Check out our guide for recommendations on what content to include, along with policies suggested by your plugins and theme.' );
|
||||||
|
$url = esc_url( admin_url( 'privacy-policy-guide.php' ) );
|
||||||
|
$label = __( 'View Privacy Policy Guide.' );
|
||||||
|
|
||||||
|
if ( get_current_screen()->is_block_editor() ) {
|
||||||
|
wp_enqueue_script( 'wp-notices' );
|
||||||
|
$action = array(
|
||||||
|
'url' => $url,
|
||||||
|
'label' => $label,
|
||||||
|
);
|
||||||
|
wp_add_inline_script(
|
||||||
|
'wp-notices',
|
||||||
|
sprintf(
|
||||||
|
'wp.data.dispatch( "core/notices" ).createWarningNotice( "%s", { actions: [ %s ], isDismissible: false } )',
|
||||||
|
$message,
|
||||||
|
wp_json_encode( $action )
|
||||||
|
),
|
||||||
|
'after'
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
?>
|
||||||
|
<div class="notice notice-warning inline wp-pp-notice">
|
||||||
|
<p>
|
||||||
|
<?php
|
||||||
|
echo $message;
|
||||||
|
printf(
|
||||||
|
' <a href="%s" target="_blank">%s <span class="screen-reader-text">%s</span></a>',
|
||||||
|
$url,
|
||||||
|
$label,
|
||||||
|
/* translators: accessibility text */
|
||||||
|
__( '(opens in a new tab)' )
|
||||||
|
);
|
||||||
|
?>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Output the privacy policy guide together with content from the theme and plugins.
|
||||||
|
*
|
||||||
|
* @since 4.9.6
|
||||||
|
*/
|
||||||
|
public static function privacy_policy_guide() {
|
||||||
|
|
||||||
|
$content_array = self::get_suggested_policy_text();
|
||||||
|
|
||||||
|
$content = '';
|
||||||
|
$toc = array( '<li><a href="#wp-privacy-policy-guide-introduction">' . __( 'Introduction' ) . '</a></li>' );
|
||||||
|
$date_format = __( 'F j, Y' );
|
||||||
|
$copy = __( 'Copy this section to clipboard' );
|
||||||
|
$return_to_top = '<a href="#" class="return-to-top">' . __( '↑ Return to Top' ) . '</a>';
|
||||||
|
|
||||||
|
foreach ( $content_array as $section ) {
|
||||||
|
$class = $meta = $removed = '';
|
||||||
|
|
||||||
|
if ( ! empty( $section['removed'] ) ) {
|
||||||
|
$class = ' text-removed';
|
||||||
|
$date = date_i18n( $date_format, $section['removed'] );
|
||||||
|
$meta = sprintf( __( 'Removed %s.' ), $date );
|
||||||
|
|
||||||
|
$removed = __( 'You deactivated this plugin on %s and may no longer need this policy.' );
|
||||||
|
$removed = '<div class="error inline"><p>' . sprintf( $removed, $date ) . '</p></div>';
|
||||||
|
} elseif ( ! empty( $section['updated'] ) ) {
|
||||||
|
$class = ' text-updated';
|
||||||
|
$date = date_i18n( $date_format, $section['updated'] );
|
||||||
|
$meta = sprintf( __( 'Updated %s.' ), $date );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $meta ) {
|
||||||
|
$meta = '<br><span class="privacy-text-meta">' . $meta . '</span>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$plugin_name = esc_html( $section['plugin_name'] );
|
||||||
|
$toc_id = 'wp-privacy-policy-guide-' . sanitize_title( $plugin_name );
|
||||||
|
$toc[] = sprintf( '<li><a href="#%1$s">%2$s</a>' . $meta . '</li>', $toc_id, $plugin_name );
|
||||||
|
|
||||||
|
$content .= '<div class="privacy-text-section' . $class . '">';
|
||||||
|
$content .= '<a id="' . $toc_id . '"> </a>';
|
||||||
|
/* translators: %s: plugin name */
|
||||||
|
$content .= '<h2>' . sprintf( __( 'Source: %s' ), $plugin_name ) . '</h2>';
|
||||||
|
$content .= $removed;
|
||||||
|
|
||||||
|
$content .= '<div class="policy-text">' . $section['policy_text'] . '</div>';
|
||||||
|
$content .= $return_to_top;
|
||||||
|
|
||||||
|
if ( empty( $section['removed'] ) ) {
|
||||||
|
$content .= '<div class="privacy-text-actions">';
|
||||||
|
$content .= '<button type="button" class="privacy-text-copy button">';
|
||||||
|
$content .= $copy;
|
||||||
|
$content .= '<span class="screen-reader-text">' . sprintf( __( 'Copy suggested policy text from %s.' ), $plugin_name ) . '</span>';
|
||||||
|
$content .= '</button>';
|
||||||
|
$content .= '</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$content .= "</div>\n"; // End of .privacy-text-section.
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( count( $toc ) > 2 ) {
|
||||||
|
?>
|
||||||
|
<div class="privacy-text-box-toc">
|
||||||
|
<p><?php _e( 'Table of Contents' ); ?></p>
|
||||||
|
<ol>
|
||||||
|
<?php echo implode( "\n", $toc ); ?>
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
<div class="privacy-text-box">
|
||||||
|
<div class="privacy-text-box-head">
|
||||||
|
<a id="wp-privacy-policy-guide-introduction"> </a>
|
||||||
|
<h2><?php _e( 'Introduction' ); ?></h2>
|
||||||
|
<p><?php _e( 'Hello,' ); ?></p>
|
||||||
|
<p><?php _e( 'This text template will help you to create your web site’s privacy policy.' ); ?></p>
|
||||||
|
<p><?php _e( 'We have suggested the sections you will need. Under each section heading you will find a short summary of what information you should provide, which will help you to get started. Some sections include suggested policy content, others will have to be completed with information from your theme and plugins.' ); ?></p>
|
||||||
|
<p><?php _e( 'Please edit your privacy policy content, making sure to delete the summaries, and adding any information from your theme and plugins. Once you publish your policy page, remember to add it to your navigation menu.' ); ?></p>
|
||||||
|
<p><?php _e( 'It is your responsibility to write a comprehensive privacy policy, to make sure it reflects all national and international legal requirements on privacy, and to keep your policy current and accurate.' ); ?></p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="privacy-text-box-body">
|
||||||
|
<?php echo $content; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the default suggested privacy policy content.
|
||||||
|
*
|
||||||
|
* @since 4.9.6
|
||||||
|
* @since 5.0.0 Added the `$blocks` parameter.
|
||||||
|
*
|
||||||
|
* @param bool $description Whether to include the descriptions under the section headings. Default false.
|
||||||
|
* @param bool $blocks Whether to format the content for the block editor. Default true.
|
||||||
|
* @return string The default policy content.
|
||||||
|
*/
|
||||||
|
public static function get_default_content( $description = false, $blocks = true ) {
|
||||||
|
$suggested_text = $description ? '<strong class="privacy-policy-tutorial">' . __( 'Suggested text:' ) . ' </strong>' : '';
|
||||||
|
$content = '';
|
||||||
|
$strings = array();
|
||||||
|
|
||||||
|
// Start of the suggested privacy policy text.
|
||||||
|
if ( $description ) {
|
||||||
|
$strings[] = '<div class="wp-suggested-text">';
|
||||||
|
}
|
||||||
|
|
||||||
|
/* translators: default privacy policy heading. */
|
||||||
|
$strings[] = '<h2>' . __( 'Who we are' ) . '</h2>';
|
||||||
|
|
||||||
|
if ( $description ) {
|
||||||
|
/* translators: privacy policy tutorial. */
|
||||||
|
$strings[] = '<p class="privacy-policy-tutorial">' . __( 'In this section you should note your site URL, as well as the name of the company, organization, or individual behind it, and some accurate contact information.' ) . '</p>';
|
||||||
|
/* translators: privacy policy tutorial. */
|
||||||
|
$strings[] = '<p class="privacy-policy-tutorial">' . __( 'The amount of information you may be required to show will vary depending on your local or national business regulations. You may, for example, be required to display a physical address, a registered address, or your company registration number.' ) . '</p>';
|
||||||
|
}
|
||||||
|
|
||||||
|
/* translators: default privacy policy text, %s Site URL. */
|
||||||
|
$strings[] = '<p>' . $suggested_text . sprintf( __( 'Our website address is: %s.' ), get_bloginfo( 'url', 'display' ) ) . '</p>';
|
||||||
|
|
||||||
|
/* translators: default privacy policy heading. */
|
||||||
|
$strings[] = '<h2>' . __( 'What personal data we collect and why we collect it' ) . '</h2>';
|
||||||
|
|
||||||
|
if ( $description ) {
|
||||||
|
/* translators: privacy policy tutorial. */
|
||||||
|
$strings[] = '<p class="privacy-policy-tutorial">' . __( 'In this section you should note what personal data you collect from users and site visitors. This may include personal data, such as name, email address, personal account preferences; transactional data, such as purchase information; and technical data, such as information about cookies.' ) . '</p>';
|
||||||
|
/* translators: privacy policy tutorial. */
|
||||||
|
$strings[] = '<p class="privacy-policy-tutorial">' . __( 'You should also note any collection and retention of sensitive personal data, such as data concerning health.' ) . '</p>';
|
||||||
|
/* translators: privacy policy tutorial. */
|
||||||
|
$strings[] = '<p class="privacy-policy-tutorial">' . __( 'In addition to listing what personal data you collect, you need to note why you collect it. These explanations must note either the legal basis for your data collection and retention or the active consent the user has given.' ) . '</p>';
|
||||||
|
/* translators: privacy policy tutorial. */
|
||||||
|
$strings[] = '<p class="privacy-policy-tutorial">' . __( 'Personal data is not just created by a user’s interactions with your site. Personal data is also generated from technical processes such as contact forms, comments, cookies, analytics, and third party embeds.' ) . '</p>';
|
||||||
|
/* translators: privacy policy tutorial. */
|
||||||
|
$strings[] = '<p class="privacy-policy-tutorial">' . __( 'By default WordPress does not collect any personal data about visitors, and only collects the data shown on the User Profile screen from registered users. However some of your plugins may collect personal data. You should add the relevant information below.' ) . '</p>';
|
||||||
|
}
|
||||||
|
|
||||||
|
/* translators: default privacy policy heading. */
|
||||||
|
$strings[] = '<h3>' . __( 'Comments' ) . '</h3>';
|
||||||
|
|
||||||
|
if ( $description ) {
|
||||||
|
/* translators: privacy policy tutorial. */
|
||||||
|
$strings[] = '<p class="privacy-policy-tutorial">' . __( 'In this subsection you should note what information is captured through comments. We have noted the data which WordPress collects by default.' ) . '</p>';
|
||||||
|
}
|
||||||
|
|
||||||
|
/* translators: default privacy policy text. */
|
||||||
|
$strings[] = '<p>' . $suggested_text . __( 'When visitors leave comments on the site we collect the data shown in the comments form, and also the visitor’s IP address and browser user agent string to help spam detection.' ) . '</p>';
|
||||||
|
/* translators: default privacy policy text. */
|
||||||
|
$strings[] = '<p>' . __( 'An anonymized string created from your email address (also called a hash) may be provided to the Gravatar service to see if you are using it. The Gravatar service privacy policy is available here: https://automattic.com/privacy/. After approval of your comment, your profile picture is visible to the public in the context of your comment.' ) . '</p>';
|
||||||
|
|
||||||
|
/* translators: default privacy policy heading. */
|
||||||
|
$strings[] = '<h3>' . __( 'Media' ) . '</h3>';
|
||||||
|
|
||||||
|
if ( $description ) {
|
||||||
|
/* translators: privacy policy tutorial. */
|
||||||
|
$strings[] = '<p class="privacy-policy-tutorial">' . __( 'In this subsection you should note what information may be disclosed by users who can upload media files. All uploaded files are usually publicly accessible.' ) . '</p>';
|
||||||
|
}
|
||||||
|
|
||||||
|
/* translators: default privacy policy text. */
|
||||||
|
$strings[] = '<p>' . $suggested_text . __( 'If you upload images to the website, you should avoid uploading images with embedded location data (EXIF GPS) included. Visitors to the website can download and extract any location data from images on the website.' ) . '</p>';
|
||||||
|
|
||||||
|
/* translators: default privacy policy heading. */
|
||||||
|
$strings[] = '<h3>' . __( 'Contact forms' ) . '</h3>';
|
||||||
|
|
||||||
|
if ( $description ) {
|
||||||
|
/* translators: privacy policy tutorial. */
|
||||||
|
$strings[] = '<p class="privacy-policy-tutorial">' . __( 'By default, WordPress does not include a contact form. If you use a contact form plugin, use this subsection to note what personal data is captured when someone submits a contact form, and how long you keep it. For example, you may note that you keep contact form submissions for a certain period for customer service purposes, but you do not use the information submitted through them for marketing purposes.' ) . '</p>';
|
||||||
|
}
|
||||||
|
|
||||||
|
/* translators: default privacy policy heading. */
|
||||||
|
$strings[] = '<h3>' . __( 'Cookies' ) . '</h3>';
|
||||||
|
|
||||||
|
if ( $description ) {
|
||||||
|
/* translators: privacy policy tutorial. */
|
||||||
|
$strings[] = '<p class="privacy-policy-tutorial">' . __( 'In this subsection you should list the cookies your web site uses, including those set by your plugins, social media, and analytics. We have provided the cookies which WordPress installs by default.' ) . '</p>';
|
||||||
|
}
|
||||||
|
|
||||||
|
/* translators: default privacy policy text. */
|
||||||
|
$strings[] = '<p>' . $suggested_text . __( 'If you leave a comment on our site you may opt-in to saving your name, email address and website in cookies. These are for your convenience so that you do not have to fill in your details again when you leave another comment. These cookies will last for one year.' ) . '</p>';
|
||||||
|
/* translators: default privacy policy text. */
|
||||||
|
$strings[] = '<p>' . __( 'If you visit our login page, we will set a temporary cookie to determine if your browser accepts cookies. This cookie contains no personal data and is discarded when you close your browser.' ) . '</p>';
|
||||||
|
/* translators: default privacy policy text. */
|
||||||
|
$strings[] = '<p>' . __( 'When you log in, we will also set up several cookies to save your login information and your screen display choices. Login cookies last for two days, and screen options cookies last for a year. If you select "Remember Me", your login will persist for two weeks. If you log out of your account, the login cookies will be removed.' ) . '</p>';
|
||||||
|
/* translators: default privacy policy text. */
|
||||||
|
$strings[] = '<p>' . __( 'If you edit or publish an article, an additional cookie will be saved in your browser. This cookie includes no personal data and simply indicates the post ID of the article you just edited. It expires after 1 day.' ) . '</p>';
|
||||||
|
|
||||||
|
/* translators: default privacy policy heading. */
|
||||||
|
$strings[] = '<h3>' . __( 'Embedded content from other websites' ) . '</h3>';
|
||||||
|
/* translators: default privacy policy text. */
|
||||||
|
$strings[] = '<p>' . $suggested_text . __( 'Articles on this site may include embedded content (e.g. videos, images, articles, etc.). Embedded content from other websites behaves in the exact same way as if the visitor has visited the other website.' ) . '</p>';
|
||||||
|
/* translators: default privacy policy text. */
|
||||||
|
$strings[] = '<p>' . __( 'These websites may collect data about you, use cookies, embed additional third-party tracking, and monitor your interaction with that embedded content, including tracking your interaction with the embedded content if you have an account and are logged in to that website.' ) . '</p>';
|
||||||
|
|
||||||
|
/* translators: default privacy policy heading. */
|
||||||
|
$strings[] = '<h3>' . __( 'Analytics' ) . '</h3>';
|
||||||
|
|
||||||
|
if ( $description ) {
|
||||||
|
/* translators: privacy policy tutorial. */
|
||||||
|
$strings[] = '<p class="privacy-policy-tutorial">' . __( 'In this subsection you should note what analytics package you use, how users can opt out of analytics tracking, and a link to your analytics provider’s privacy policy, if any.' ) . '</p>';
|
||||||
|
/* translators: privacy policy tutorial. */
|
||||||
|
$strings[] = '<p class="privacy-policy-tutorial">' . __( 'By default WordPress does not collect any analytics data. However, many web hosting accounts collect some anonymous analytics data. You may also have installed a WordPress plugin that provides analytics services. In that case, add information from that plugin here.' ) . '</p>';
|
||||||
|
}
|
||||||
|
|
||||||
|
/* translators: default privacy policy heading. */
|
||||||
|
$strings[] = '<h2>' . __( 'Who we share your data with' ) . '</h2>';
|
||||||
|
|
||||||
|
if ( $description ) {
|
||||||
|
/* translators: privacy policy tutorial. */
|
||||||
|
$strings[] = '<p class="privacy-policy-tutorial">' . __( 'In this section you should name and list all third party providers with whom you share site data, including partners, cloud-based services, payment processors, and third party service providers, and note what data you share with them and why. Link to their own privacy policies if possible.' ) . '</p>';
|
||||||
|
/* translators: privacy policy tutorial. */
|
||||||
|
$strings[] = '<p class="privacy-policy-tutorial">' . __( 'By default WordPress does not share any personal data with anyone.' ) . '</p>';
|
||||||
|
}
|
||||||
|
|
||||||
|
/* translators: default privacy policy heading. */
|
||||||
|
$strings[] = '<h2>' . __( 'How long we retain your data' ) . '</h2>';
|
||||||
|
|
||||||
|
if ( $description ) {
|
||||||
|
/* translators: privacy policy tutorial. */
|
||||||
|
$strings[] = '<p class="privacy-policy-tutorial">' . __( 'In this section you should explain how long you retain personal data collected or processed by the web site. While it is your responsibility to come up with the schedule of how long you keep each dataset for and why you keep it, that information does need to be listed here. For example, you may want to say that you keep contact form entries for six months, analytics records for a year, and customer purchase records for ten years.' ) . '</p>';
|
||||||
|
}
|
||||||
|
|
||||||
|
/* translators: default privacy policy text. */
|
||||||
|
$strings[] = '<p>' . $suggested_text . __( 'If you leave a comment, the comment and its metadata are retained indefinitely. This is so we can recognize and approve any follow-up comments automatically instead of holding them in a moderation queue.' ) . '</p>';
|
||||||
|
/* translators: default privacy policy text. */
|
||||||
|
$strings[] = '<p>' . __( 'For users that register on our website (if any), we also store the personal information they provide in their user profile. All users can see, edit, or delete their personal information at any time (except they cannot change their username). Website administrators can also see and edit that information.' ) . '</p>';
|
||||||
|
|
||||||
|
/* translators: default privacy policy heading. */
|
||||||
|
$strings[] = '<h2>' . __( 'What rights you have over your data' ) . '</h2>';
|
||||||
|
|
||||||
|
if ( $description ) {
|
||||||
|
/* translators: privacy policy tutorial. */
|
||||||
|
$strings[] = '<p class="privacy-policy-tutorial">' . __( 'In this section you should explain what rights your users have over their data and how they can invoke those rights.' ) . '</p>';
|
||||||
|
}
|
||||||
|
|
||||||
|
/* translators: default privacy policy text. */
|
||||||
|
$strings[] = '<p>' . $suggested_text . __( 'If you have an account on this site, or have left comments, you can request to receive an exported file of the personal data we hold about you, including any data you have provided to us. You can also request that we erase any personal data we hold about you. This does not include any data we are obliged to keep for administrative, legal, or security purposes.' ) . '</p>';
|
||||||
|
|
||||||
|
/* translators: default privacy policy heading. */
|
||||||
|
$strings[] = '<h2>' . __( 'Where we send your data' ) . '</h2>';
|
||||||
|
|
||||||
|
if ( $description ) {
|
||||||
|
/* translators: privacy policy tutorial. */
|
||||||
|
$strings[] = '<p class="privacy-policy-tutorial">' . __( 'In this section you should list all transfers of your site data outside the European Union and describe the means by which that data is safeguarded to European data protection standards. This could include your web hosting, cloud storage, or other third party services.' ) . '</p>';
|
||||||
|
/* translators: privacy policy tutorial. */
|
||||||
|
$strings[] = '<p class="privacy-policy-tutorial">' . __( 'European data protection law requires data about European residents which is transferred outside the European Union to be safeguarded to the same standards as if the data was in Europe. So in addition to listing where data goes, you should describe how you ensure that these standards are met either by yourself or by your third party providers, whether that is through an agreement such as Privacy Shield, model clauses in your contracts, or binding corporate rules.' ) . '</p>';
|
||||||
|
}
|
||||||
|
|
||||||
|
/* translators: default privacy policy text. */
|
||||||
|
$strings[] = '<p>' . $suggested_text . __( 'Visitor comments may be checked through an automated spam detection service.' ) . '</p>';
|
||||||
|
|
||||||
|
/* translators: default privacy policy heading. */
|
||||||
|
$strings[] = '<h2>' . __( 'Your contact information' ) . '</h2>';
|
||||||
|
|
||||||
|
if ( $description ) {
|
||||||
|
/* translators: privacy policy tutorial. */
|
||||||
|
$strings[] = '<p class="privacy-policy-tutorial">' . __( 'In this section you should provide a contact method for privacy-specific concerns. If you are required to have a Data Protection Officer, list their name and full contact details here as well.' ) . '</p>';
|
||||||
|
}
|
||||||
|
|
||||||
|
/* translators: default privacy policy heading. */
|
||||||
|
$strings[] = '<h2>' . __( 'Additional information' ) . '</h2>';
|
||||||
|
|
||||||
|
if ( $description ) {
|
||||||
|
/* translators: privacy policy tutorial. */
|
||||||
|
$strings[] = '<p class="privacy-policy-tutorial">' . __( 'If you use your site for commercial purposes and you engage in more complex collection or processing of personal data, you should note the following information in your privacy policy in addition to the information we have already discussed.' ) . '</p>';
|
||||||
|
}
|
||||||
|
|
||||||
|
/* translators: default privacy policy heading. */
|
||||||
|
$strings[] = '<h3>' . __( 'How we protect your data' ) . '</h3>';
|
||||||
|
|
||||||
|
if ( $description ) {
|
||||||
|
/* translators: privacy policy tutorial. */
|
||||||
|
$strings[] = '<p class="privacy-policy-tutorial">' . __( 'In this section you should explain what measures you have taken to protect your users’ data. This could include technical measures such as encryption; security measures such as two factor authentication; and measures such as staff training in data protection. If you have carried out a Privacy Impact Assessment, you can mention it here too.' ) . '</p>';
|
||||||
|
}
|
||||||
|
|
||||||
|
/* translators: default privacy policy heading. */
|
||||||
|
$strings[] = '<h3>' . __( 'What data breach procedures we have in place' ) . '</h3>';
|
||||||
|
|
||||||
|
if ( $description ) {
|
||||||
|
/* translators: privacy policy tutorial. */
|
||||||
|
$strings[] = '<p class="privacy-policy-tutorial">' . __( 'In this section you should explain what procedures you have in place to deal with data breaches, either potential or real, such as internal reporting systems, contact mechanisms, or bug bounties.' ) . '</p>';
|
||||||
|
}
|
||||||
|
|
||||||
|
/* translators: default privacy policy heading. */
|
||||||
|
$strings[] = '<h3>' . __( 'What third parties we receive data from' ) . '</h3>';
|
||||||
|
|
||||||
|
if ( $description ) {
|
||||||
|
/* translators: privacy policy tutorial. */
|
||||||
|
$strings[] = '<p class="privacy-policy-tutorial">' . __( 'If your web site receives data about users from third parties, including advertisers, this information must be included within the section of your privacy policy dealing with third party data.' ) . '</p>';
|
||||||
|
}
|
||||||
|
|
||||||
|
/* translators: default privacy policy heading. */
|
||||||
|
$strings[] = '<h3>' . __( 'What automated decision making and/or profiling we do with user data' ) . '</h3>';
|
||||||
|
|
||||||
|
if ( $description ) {
|
||||||
|
/* translators: privacy policy tutorial. */
|
||||||
|
$strings[] = '<p class="privacy-policy-tutorial">' . __( 'If your web site provides a service which includes automated decision making - for example, allowing customers to apply for credit, or aggregating their data into an advertising profile - you must note that this is taking place, and include information about how that information is used, what decisions are made with that aggregated data, and what rights users have over decisions made without human intervention.' ) . '</p>';
|
||||||
|
}
|
||||||
|
|
||||||
|
/* translators: default privacy policy heading. */
|
||||||
|
$strings[] = '<h3>' . __( 'Industry regulatory disclosure requirements' ) . '</h3>';
|
||||||
|
|
||||||
|
if ( $description ) {
|
||||||
|
/* translators: privacy policy tutorial. */
|
||||||
|
$strings[] = '<p class="privacy-policy-tutorial">' . __( 'If you are a member of a regulated industry, or if you are subject to additional privacy laws, you may be required to disclose that information here.' ) . '</p>';
|
||||||
|
$strings[] = '</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $blocks ) {
|
||||||
|
foreach ( $strings as $key => $string ) {
|
||||||
|
if ( 0 === strpos( $string, '<p>' ) ) {
|
||||||
|
$strings[ $key ] = '<!-- wp:paragraph -->' . $string . '<!-- /wp:paragraph -->';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( 0 === strpos( $string, '<h2>' ) ) {
|
||||||
|
$strings[ $key ] = '<!-- wp:heading -->' . $string . '<!-- /wp:heading -->';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( 0 === strpos( $string, '<h3>' ) ) {
|
||||||
|
$strings[ $key ] = '<!-- wp:heading {"level":3} -->' . $string . '<!-- /wp:heading -->';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$content = implode( '', $strings );
|
||||||
|
// End of the suggested privacy policy text.
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filters the default content suggested for inclusion in a privacy policy.
|
||||||
|
*
|
||||||
|
* @since 4.9.6
|
||||||
|
* @since 5.0.0 Added the `$strings`, `$description`, and `$blocks` parameters.
|
||||||
|
*
|
||||||
|
* @param string $content The default policy content.
|
||||||
|
* @param array $strings An array of privacy policy content strings.
|
||||||
|
* @param bool $description Whether policy descriptions should be included.
|
||||||
|
* @param bool $blocks Whether the content should be formatted for the block editor.
|
||||||
|
*/
|
||||||
|
return apply_filters( 'wp_get_default_privacy_policy_content', $content, $strings, $description, $blocks );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add the suggested privacy policy text to the policy postbox.
|
||||||
|
*
|
||||||
|
* @since 4.9.6
|
||||||
|
*/
|
||||||
|
public static function add_suggested_content() {
|
||||||
|
$content = self::get_default_content( true, false );
|
||||||
|
wp_add_privacy_policy_content( __( 'WordPress' ), $content );
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,451 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* List Table API: WP_Privacy_Requests_Table class
|
||||||
|
*
|
||||||
|
* @package WordPress
|
||||||
|
* @subpackage Administration
|
||||||
|
* @since 4.9.6
|
||||||
|
*/
|
||||||
|
|
||||||
|
abstract class WP_Privacy_Requests_Table extends WP_List_Table {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Action name for the requests this table will work with. Classes
|
||||||
|
* which inherit from WP_Privacy_Requests_Table should define this.
|
||||||
|
*
|
||||||
|
* Example: 'export_personal_data'.
|
||||||
|
*
|
||||||
|
* @since 4.9.6
|
||||||
|
*
|
||||||
|
* @var string $request_type Name of action.
|
||||||
|
*/
|
||||||
|
protected $request_type = 'INVALID';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Post type to be used.
|
||||||
|
*
|
||||||
|
* @since 4.9.6
|
||||||
|
*
|
||||||
|
* @var string $post_type The post type.
|
||||||
|
*/
|
||||||
|
protected $post_type = 'INVALID';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get columns to show in the list table.
|
||||||
|
*
|
||||||
|
* @since 4.9.6
|
||||||
|
*
|
||||||
|
* @return array Array of columns.
|
||||||
|
*/
|
||||||
|
public function get_columns() {
|
||||||
|
$columns = array(
|
||||||
|
'cb' => '<input type="checkbox" />',
|
||||||
|
'email' => __( 'Requester' ),
|
||||||
|
'status' => __( 'Status' ),
|
||||||
|
'created_timestamp' => __( 'Requested' ),
|
||||||
|
'next_steps' => __( 'Next Steps' ),
|
||||||
|
);
|
||||||
|
return $columns;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Normalize the admin URL to the current page (by request_type).
|
||||||
|
*
|
||||||
|
* @since 5.3.0
|
||||||
|
*
|
||||||
|
* @return string URL to the current admin page.
|
||||||
|
*/
|
||||||
|
protected function get_admin_url() {
|
||||||
|
$pagenow = str_replace( '_', '-', $this->request_type );
|
||||||
|
|
||||||
|
if ( 'remove-personal-data' === $pagenow ) {
|
||||||
|
$pagenow = 'erase-personal-data';
|
||||||
|
}
|
||||||
|
|
||||||
|
return admin_url( $pagenow . '.php' );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a list of sortable columns.
|
||||||
|
*
|
||||||
|
* @since 4.9.6
|
||||||
|
*
|
||||||
|
* @return array Default sortable columns.
|
||||||
|
*/
|
||||||
|
protected function get_sortable_columns() {
|
||||||
|
// The initial sorting is by 'Requested' (post_date) and descending.
|
||||||
|
// With initial sorting, the first click on 'Requested' should be ascending.
|
||||||
|
// With 'Requester' sorting active, the next click on 'Requested' should be descending.
|
||||||
|
$desc_first = isset( $_GET['orderby'] );
|
||||||
|
|
||||||
|
return array(
|
||||||
|
'email' => 'requester',
|
||||||
|
'created_timestamp' => array( 'requested', $desc_first ),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default primary column.
|
||||||
|
*
|
||||||
|
* @since 4.9.6
|
||||||
|
*
|
||||||
|
* @return string Default primary column name.
|
||||||
|
*/
|
||||||
|
protected function get_default_primary_column_name() {
|
||||||
|
return 'email';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Count number of requests for each status.
|
||||||
|
*
|
||||||
|
* @since 4.9.6
|
||||||
|
*
|
||||||
|
* @return object Number of posts for each status.
|
||||||
|
*/
|
||||||
|
protected function get_request_counts() {
|
||||||
|
global $wpdb;
|
||||||
|
|
||||||
|
$cache_key = $this->post_type . '-' . $this->request_type;
|
||||||
|
$counts = wp_cache_get( $cache_key, 'counts' );
|
||||||
|
|
||||||
|
if ( false !== $counts ) {
|
||||||
|
return $counts;
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = "
|
||||||
|
SELECT post_status, COUNT( * ) AS num_posts
|
||||||
|
FROM {$wpdb->posts}
|
||||||
|
WHERE post_type = %s
|
||||||
|
AND post_name = %s
|
||||||
|
GROUP BY post_status";
|
||||||
|
|
||||||
|
$results = (array) $wpdb->get_results( $wpdb->prepare( $query, $this->post_type, $this->request_type ), ARRAY_A );
|
||||||
|
$counts = array_fill_keys( get_post_stati(), 0 );
|
||||||
|
|
||||||
|
foreach ( $results as $row ) {
|
||||||
|
$counts[ $row['post_status'] ] = $row['num_posts'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$counts = (object) $counts;
|
||||||
|
wp_cache_set( $cache_key, $counts, 'counts' );
|
||||||
|
|
||||||
|
return $counts;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get an associative array ( id => link ) with the list of views available on this table.
|
||||||
|
*
|
||||||
|
* @since 4.9.6
|
||||||
|
*
|
||||||
|
* @return array Associative array of views in the format of $view_name => $view_markup.
|
||||||
|
*/
|
||||||
|
protected function get_views() {
|
||||||
|
$current_status = isset( $_REQUEST['filter-status'] ) ? sanitize_text_field( $_REQUEST['filter-status'] ) : '';
|
||||||
|
$statuses = _wp_privacy_statuses();
|
||||||
|
$views = array();
|
||||||
|
$counts = $this->get_request_counts();
|
||||||
|
$total_requests = absint( array_sum( (array) $counts ) );
|
||||||
|
|
||||||
|
// Normalized admin URL
|
||||||
|
$admin_url = $this->get_admin_url();
|
||||||
|
|
||||||
|
$current_link_attributes = empty( $current_status ) ? ' class="current" aria-current="page"' : '';
|
||||||
|
$status_label = sprintf(
|
||||||
|
/* translators: %s: all requests count */
|
||||||
|
_nx(
|
||||||
|
'All <span class="count">(%s)</span>',
|
||||||
|
'All <span class="count">(%s)</span>',
|
||||||
|
$total_requests,
|
||||||
|
'requests'
|
||||||
|
),
|
||||||
|
number_format_i18n( $total_requests )
|
||||||
|
);
|
||||||
|
|
||||||
|
$views['all'] = sprintf(
|
||||||
|
'<a href="%s"%s>%s</a>',
|
||||||
|
esc_url( $admin_url ),
|
||||||
|
$current_link_attributes,
|
||||||
|
$status_label
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach ( $statuses as $status => $label ) {
|
||||||
|
$post_status = get_post_status_object( $status );
|
||||||
|
if ( ! $post_status ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$current_link_attributes = $status === $current_status ? ' class="current" aria-current="page"' : '';
|
||||||
|
$total_status_requests = absint( $counts->{$status} );
|
||||||
|
|
||||||
|
$status_label = sprintf(
|
||||||
|
translate_nooped_plural( $post_status->label_count, $total_status_requests ),
|
||||||
|
number_format_i18n( $total_status_requests )
|
||||||
|
);
|
||||||
|
|
||||||
|
$status_link = add_query_arg( 'filter-status', $status, $admin_url );
|
||||||
|
|
||||||
|
$views[ $status ] = sprintf(
|
||||||
|
'<a href="%s"%s>%s</a>',
|
||||||
|
esc_url( $status_link ),
|
||||||
|
$current_link_attributes,
|
||||||
|
$status_label
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $views;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get bulk actions.
|
||||||
|
*
|
||||||
|
* @since 4.9.6
|
||||||
|
*
|
||||||
|
* @return array List of bulk actions.
|
||||||
|
*/
|
||||||
|
protected function get_bulk_actions() {
|
||||||
|
return array(
|
||||||
|
'delete' => __( 'Remove' ),
|
||||||
|
'resend' => __( 'Resend email' ),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Process bulk actions.
|
||||||
|
*
|
||||||
|
* @since 4.9.6
|
||||||
|
*/
|
||||||
|
public function process_bulk_action() {
|
||||||
|
$action = $this->current_action();
|
||||||
|
$request_ids = isset( $_REQUEST['request_id'] ) ? wp_parse_id_list( wp_unslash( $_REQUEST['request_id'] ) ) : array();
|
||||||
|
|
||||||
|
$count = 0;
|
||||||
|
|
||||||
|
if ( $request_ids ) {
|
||||||
|
check_admin_referer( 'bulk-privacy_requests' );
|
||||||
|
}
|
||||||
|
|
||||||
|
switch ( $action ) {
|
||||||
|
case 'delete':
|
||||||
|
foreach ( $request_ids as $request_id ) {
|
||||||
|
if ( wp_delete_post( $request_id, true ) ) {
|
||||||
|
$count ++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
add_settings_error(
|
||||||
|
'bulk_action',
|
||||||
|
'bulk_action',
|
||||||
|
/* translators: %d: number of requests */
|
||||||
|
sprintf( _n( 'Deleted %d request', 'Deleted %d requests', $count ), $count ),
|
||||||
|
'updated'
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case 'resend':
|
||||||
|
foreach ( $request_ids as $request_id ) {
|
||||||
|
$resend = _wp_privacy_resend_request( $request_id );
|
||||||
|
|
||||||
|
if ( $resend && ! is_wp_error( $resend ) ) {
|
||||||
|
$count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
add_settings_error(
|
||||||
|
'bulk_action',
|
||||||
|
'bulk_action',
|
||||||
|
/* translators: %d: number of requests */
|
||||||
|
sprintf( _n( 'Re-sent %d request', 'Re-sent %d requests', $count ), $count ),
|
||||||
|
'updated'
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prepare items to output.
|
||||||
|
*
|
||||||
|
* @since 4.9.6
|
||||||
|
* @since 5.1.0 Added support for column sorting.
|
||||||
|
*/
|
||||||
|
public function prepare_items() {
|
||||||
|
global $wpdb;
|
||||||
|
|
||||||
|
$this->items = array();
|
||||||
|
$posts_per_page = $this->get_items_per_page( $this->request_type . '_requests_per_page' );
|
||||||
|
$args = array(
|
||||||
|
'post_type' => $this->post_type,
|
||||||
|
'post_name__in' => array( $this->request_type ),
|
||||||
|
'posts_per_page' => $posts_per_page,
|
||||||
|
'offset' => isset( $_REQUEST['paged'] ) ? max( 0, absint( $_REQUEST['paged'] ) - 1 ) * $posts_per_page : 0,
|
||||||
|
'post_status' => 'any',
|
||||||
|
's' => isset( $_REQUEST['s'] ) ? sanitize_text_field( $_REQUEST['s'] ) : '',
|
||||||
|
);
|
||||||
|
|
||||||
|
$orderby_mapping = array(
|
||||||
|
'requester' => 'post_title',
|
||||||
|
'requested' => 'post_date',
|
||||||
|
);
|
||||||
|
|
||||||
|
if ( isset( $_REQUEST['orderby'] ) && isset( $orderby_mapping[ $_REQUEST['orderby'] ] ) ) {
|
||||||
|
$args['orderby'] = $orderby_mapping[ $_REQUEST['orderby'] ];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( isset( $_REQUEST['order'] ) && in_array( strtoupper( $_REQUEST['order'] ), array( 'ASC', 'DESC' ), true ) ) {
|
||||||
|
$args['order'] = strtoupper( $_REQUEST['order'] );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! empty( $_REQUEST['filter-status'] ) ) {
|
||||||
|
$filter_status = isset( $_REQUEST['filter-status'] ) ? sanitize_text_field( $_REQUEST['filter-status'] ) : '';
|
||||||
|
$args['post_status'] = $filter_status;
|
||||||
|
}
|
||||||
|
|
||||||
|
$requests_query = new WP_Query( $args );
|
||||||
|
$requests = $requests_query->posts;
|
||||||
|
|
||||||
|
foreach ( $requests as $request ) {
|
||||||
|
$this->items[] = wp_get_user_request_data( $request->ID );
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->items = array_filter( $this->items );
|
||||||
|
|
||||||
|
$this->set_pagination_args(
|
||||||
|
array(
|
||||||
|
'total_items' => $requests_query->found_posts,
|
||||||
|
'per_page' => $posts_per_page,
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checkbox column.
|
||||||
|
*
|
||||||
|
* @since 4.9.6
|
||||||
|
*
|
||||||
|
* @param WP_User_Request $item Item being shown.
|
||||||
|
* @return string Checkbox column markup.
|
||||||
|
*/
|
||||||
|
public function column_cb( $item ) {
|
||||||
|
return sprintf( '<input type="checkbox" name="request_id[]" value="%1$s" /><span class="spinner"></span>', esc_attr( $item->ID ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Status column.
|
||||||
|
*
|
||||||
|
* @since 4.9.6
|
||||||
|
*
|
||||||
|
* @param WP_User_Request $item Item being shown.
|
||||||
|
* @return string Status column markup.
|
||||||
|
*/
|
||||||
|
public function column_status( $item ) {
|
||||||
|
$status = get_post_status( $item->ID );
|
||||||
|
$status_object = get_post_status_object( $status );
|
||||||
|
|
||||||
|
if ( ! $status_object || empty( $status_object->label ) ) {
|
||||||
|
return '-';
|
||||||
|
}
|
||||||
|
|
||||||
|
$timestamp = false;
|
||||||
|
|
||||||
|
switch ( $status ) {
|
||||||
|
case 'request-confirmed':
|
||||||
|
$timestamp = $item->confirmed_timestamp;
|
||||||
|
break;
|
||||||
|
case 'request-completed':
|
||||||
|
$timestamp = $item->completed_timestamp;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '<span class="status-label status-' . esc_attr( $status ) . '">';
|
||||||
|
echo esc_html( $status_object->label );
|
||||||
|
|
||||||
|
if ( $timestamp ) {
|
||||||
|
echo ' (' . $this->get_timestamp_as_date( $timestamp ) . ')';
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '</span>';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert timestamp for display.
|
||||||
|
*
|
||||||
|
* @since 4.9.6
|
||||||
|
*
|
||||||
|
* @param int $timestamp Event timestamp.
|
||||||
|
* @return string Human readable date.
|
||||||
|
*/
|
||||||
|
protected function get_timestamp_as_date( $timestamp ) {
|
||||||
|
if ( empty( $timestamp ) ) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
$time_diff = time() - $timestamp;
|
||||||
|
|
||||||
|
if ( $time_diff >= 0 && $time_diff < DAY_IN_SECONDS ) {
|
||||||
|
/* translators: human readable timestamp */
|
||||||
|
return sprintf( __( '%s ago' ), human_time_diff( $timestamp ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
return date_i18n( get_option( 'date_format' ), $timestamp );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default column handler.
|
||||||
|
*
|
||||||
|
* @since 4.9.6
|
||||||
|
*
|
||||||
|
* @param WP_User_Request $item Item being shown.
|
||||||
|
* @param string $column_name Name of column being shown.
|
||||||
|
* @return string Default column output.
|
||||||
|
*/
|
||||||
|
public function column_default( $item, $column_name ) {
|
||||||
|
$cell_value = $item->$column_name;
|
||||||
|
|
||||||
|
if ( in_array( $column_name, array( 'created_timestamp' ), true ) ) {
|
||||||
|
return $this->get_timestamp_as_date( $cell_value );
|
||||||
|
}
|
||||||
|
|
||||||
|
return $cell_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Actions column. Overridden by children.
|
||||||
|
*
|
||||||
|
* @since 4.9.6
|
||||||
|
*
|
||||||
|
* @param WP_User_Request $item Item being shown.
|
||||||
|
* @return string Email column markup.
|
||||||
|
*/
|
||||||
|
public function column_email( $item ) {
|
||||||
|
return sprintf( '<a href="%1$s">%2$s</a> %3$s', esc_url( 'mailto:' . $item->email ), $item->email, $this->row_actions( array() ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Next steps column. Overridden by children.
|
||||||
|
*
|
||||||
|
* @since 4.9.6
|
||||||
|
*
|
||||||
|
* @param WP_User_Request $item Item being shown.
|
||||||
|
*/
|
||||||
|
public function column_next_steps( $item ) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates content for a single row of the table,
|
||||||
|
*
|
||||||
|
* @since 4.9.6
|
||||||
|
*
|
||||||
|
* @param WP_User_Request $item The current item.
|
||||||
|
*/
|
||||||
|
public function single_row( $item ) {
|
||||||
|
$status = $item->status;
|
||||||
|
|
||||||
|
echo '<tr id="request-' . esc_attr( $item->ID ) . '" class="status-' . esc_attr( $status ) . '">';
|
||||||
|
$this->single_row_columns( $item );
|
||||||
|
echo '</tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Embed scripts used to perform actions. Overridden by children.
|
||||||
|
*
|
||||||
|
* @since 4.9.6
|
||||||
|
*/
|
||||||
|
public function embed_scripts() {}
|
||||||
|
}
|
|
@ -1514,3 +1514,50 @@ function options_permalink_add_js() {
|
||||||
</script>
|
</script>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Previous class for list table for privacy data export requests.
|
||||||
|
*
|
||||||
|
* @since 4.9.6
|
||||||
|
* @deprecated 5.3.0
|
||||||
|
*/
|
||||||
|
class WP_Privacy_Data_Export_Requests_Table extends WP_Privacy_Data_Export_Requests_List_Table {
|
||||||
|
function __construct( $args ) {
|
||||||
|
_deprecated_function( __CLASS__, '5.3.0', 'WP_Privacy_Data_Export_Requests_List_Table' );
|
||||||
|
|
||||||
|
if ( ! isset( $args['screen'] ) || $args['screen'] === 'export_personal_data' ) {
|
||||||
|
$args['screen'] = 'export-personal-data';
|
||||||
|
}
|
||||||
|
|
||||||
|
parent::__construct( $args );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Previous class for list table for privacy data erasure requests.
|
||||||
|
*
|
||||||
|
* @since 4.9.6
|
||||||
|
* @deprecated 5.3.0
|
||||||
|
*/
|
||||||
|
class WP_Privacy_Data_Removal_Requests_Table extends WP_Privacy_Data_Removal_Requests_List_Table {
|
||||||
|
function __construct( $args ) {
|
||||||
|
_deprecated_function( __CLASS__, '5.3.0', 'WP_Privacy_Data_Removal_Requests_List_Table' );
|
||||||
|
|
||||||
|
if ( ! isset( $args['screen'] ) || $args['screen'] === 'remove_personal_data' ) {
|
||||||
|
$args['screen'] = 'erase-personal-data';
|
||||||
|
}
|
||||||
|
|
||||||
|
parent::__construct( $args );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Was used to add options for the privacy requests screens before they were separate files.
|
||||||
|
*
|
||||||
|
* @since 4.9.8
|
||||||
|
* @access private
|
||||||
|
* @deprecated 5.3.0
|
||||||
|
*/
|
||||||
|
function _wp_privacy_requests_screen_options() {
|
||||||
|
_deprecated_function( __FUNCTION__, '5.3.0' );
|
||||||
|
}
|
||||||
|
|
|
@ -33,10 +33,15 @@ function _get_list_table( $class, $args = array() ) {
|
||||||
'WP_Themes_List_Table' => 'themes',
|
'WP_Themes_List_Table' => 'themes',
|
||||||
'WP_Theme_Install_List_Table' => array( 'themes', 'theme-install' ),
|
'WP_Theme_Install_List_Table' => array( 'themes', 'theme-install' ),
|
||||||
'WP_Plugins_List_Table' => 'plugins',
|
'WP_Plugins_List_Table' => 'plugins',
|
||||||
|
|
||||||
// Network Admin
|
// Network Admin
|
||||||
'WP_MS_Sites_List_Table' => 'ms-sites',
|
'WP_MS_Sites_List_Table' => 'ms-sites',
|
||||||
'WP_MS_Users_List_Table' => 'ms-users',
|
'WP_MS_Users_List_Table' => 'ms-users',
|
||||||
'WP_MS_Themes_List_Table' => 'ms-themes',
|
'WP_MS_Themes_List_Table' => 'ms-themes',
|
||||||
|
|
||||||
|
// Privacy requests tables
|
||||||
|
'WP_Privacy_Data_Export_Requests_List_Table' => 'privacy-data-export-requests',
|
||||||
|
'WP_Privacy_Data_Removal_Requests_List_Table' => 'privacy-data-removal-requests',
|
||||||
);
|
);
|
||||||
|
|
||||||
if ( isset( $core_classes[ $class ] ) ) {
|
if ( isset( $core_classes[ $class ] ) ) {
|
||||||
|
|
|
@ -1318,720 +1318,6 @@ function _wp_privacy_settings_filter_draft_page_titles( $title, $page ) {
|
||||||
return $title;
|
return $title;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* WP_Privacy_Policy_Content class.
|
|
||||||
* TODO: move this to a new file.
|
|
||||||
*
|
|
||||||
* @since 4.9.6
|
|
||||||
*/
|
|
||||||
final class WP_Privacy_Policy_Content {
|
|
||||||
|
|
||||||
private static $policy_content = array();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor
|
|
||||||
*
|
|
||||||
* @since 4.9.6
|
|
||||||
*/
|
|
||||||
private function __construct() {}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add content to the postbox shown when editing the privacy policy.
|
|
||||||
*
|
|
||||||
* Plugins and themes should suggest text for inclusion in the site's privacy policy.
|
|
||||||
* The suggested text should contain information about any functionality that affects user privacy,
|
|
||||||
* and will be shown in the Suggested Privacy Policy Content postbox.
|
|
||||||
*
|
|
||||||
* Intended for use from `wp_add_privacy_policy_content()`.
|
|
||||||
*
|
|
||||||
* @since 4.9.6
|
|
||||||
*
|
|
||||||
* @param string $plugin_name The name of the plugin or theme that is suggesting content for the site's privacy policy.
|
|
||||||
* @param string $policy_text The suggested content for inclusion in the policy.
|
|
||||||
*/
|
|
||||||
public static function add( $plugin_name, $policy_text ) {
|
|
||||||
if ( empty( $plugin_name ) || empty( $policy_text ) ) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$data = array(
|
|
||||||
'plugin_name' => $plugin_name,
|
|
||||||
'policy_text' => $policy_text,
|
|
||||||
);
|
|
||||||
|
|
||||||
if ( ! in_array( $data, self::$policy_content, true ) ) {
|
|
||||||
self::$policy_content[] = $data;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Quick check if any privacy info has changed.
|
|
||||||
*
|
|
||||||
* @since 4.9.6
|
|
||||||
*/
|
|
||||||
public static function text_change_check() {
|
|
||||||
|
|
||||||
$policy_page_id = (int) get_option( 'wp_page_for_privacy_policy' );
|
|
||||||
|
|
||||||
// The site doesn't have a privacy policy.
|
|
||||||
if ( empty( $policy_page_id ) ) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( ! current_user_can( 'edit_post', $policy_page_id ) ) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$old = (array) get_post_meta( $policy_page_id, '_wp_suggested_privacy_policy_content' );
|
|
||||||
|
|
||||||
// Updates are not relevant if the user has not reviewed any suggestions yet.
|
|
||||||
if ( empty( $old ) ) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$cached = get_option( '_wp_suggested_policy_text_has_changed' );
|
|
||||||
|
|
||||||
/*
|
|
||||||
* When this function is called before `admin_init`, `self::$policy_content`
|
|
||||||
* has not been populated yet, so use the cached result from the last
|
|
||||||
* execution instead.
|
|
||||||
*/
|
|
||||||
if ( ! did_action( 'admin_init' ) ) {
|
|
||||||
return 'changed' === $cached;
|
|
||||||
}
|
|
||||||
|
|
||||||
$new = self::$policy_content;
|
|
||||||
|
|
||||||
// Remove the extra values added to the meta.
|
|
||||||
foreach ( $old as $key => $data ) {
|
|
||||||
if ( ! empty( $data['removed'] ) ) {
|
|
||||||
unset( $old[ $key ] );
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$old[ $key ] = array(
|
|
||||||
'plugin_name' => $data['plugin_name'],
|
|
||||||
'policy_text' => $data['policy_text'],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Normalize the order of texts, to facilitate comparison.
|
|
||||||
sort( $old );
|
|
||||||
sort( $new );
|
|
||||||
|
|
||||||
// The == operator (equal, not identical) was used intentionally.
|
|
||||||
// See http://php.net/manual/en/language.operators.array.php
|
|
||||||
if ( $new != $old ) {
|
|
||||||
// A plugin was activated or deactivated, or some policy text has changed.
|
|
||||||
// Show a notice on the relevant screens to inform the admin.
|
|
||||||
add_action( 'admin_notices', array( 'WP_Privacy_Policy_Content', 'policy_text_changed_notice' ) );
|
|
||||||
$state = 'changed';
|
|
||||||
} else {
|
|
||||||
$state = 'not-changed';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Cache the result for use before `admin_init` (see above).
|
|
||||||
if ( $cached !== $state ) {
|
|
||||||
update_option( '_wp_suggested_policy_text_has_changed', $state );
|
|
||||||
}
|
|
||||||
|
|
||||||
return 'changed' === $state;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Output a warning when some privacy info has changed.
|
|
||||||
*
|
|
||||||
* @since 4.9.6
|
|
||||||
*/
|
|
||||||
public static function policy_text_changed_notice() {
|
|
||||||
global $post;
|
|
||||||
|
|
||||||
$screen = get_current_screen()->id;
|
|
||||||
|
|
||||||
if ( 'privacy' !== $screen ) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
<div class="policy-text-updated notice notice-warning is-dismissible">
|
|
||||||
<p>
|
|
||||||
<?php
|
|
||||||
printf(
|
|
||||||
/* translators: %s: Privacy Policy Guide URL */
|
|
||||||
__( 'The suggested privacy policy text has changed. Please <a href="%s">review the guide</a> and update your privacy policy.' ),
|
|
||||||
esc_url( admin_url( 'tools.php?wp-privacy-policy-guide=1' ) )
|
|
||||||
);
|
|
||||||
?>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Update the cached policy info when the policy page is updated.
|
|
||||||
*
|
|
||||||
* @since 4.9.6
|
|
||||||
* @access private
|
|
||||||
*/
|
|
||||||
public static function _policy_page_updated( $post_id ) {
|
|
||||||
$policy_page_id = (int) get_option( 'wp_page_for_privacy_policy' );
|
|
||||||
|
|
||||||
if ( ! $policy_page_id || $policy_page_id !== (int) $post_id ) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove updated|removed status.
|
|
||||||
$old = (array) get_post_meta( $policy_page_id, '_wp_suggested_privacy_policy_content' );
|
|
||||||
$done = array();
|
|
||||||
$update_cache = false;
|
|
||||||
|
|
||||||
foreach ( $old as $old_key => $old_data ) {
|
|
||||||
if ( ! empty( $old_data['removed'] ) ) {
|
|
||||||
// Remove the old policy text.
|
|
||||||
$update_cache = true;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( ! empty( $old_data['updated'] ) ) {
|
|
||||||
// 'updated' is now 'added'.
|
|
||||||
$done[] = array(
|
|
||||||
'plugin_name' => $old_data['plugin_name'],
|
|
||||||
'policy_text' => $old_data['policy_text'],
|
|
||||||
'added' => $old_data['updated'],
|
|
||||||
);
|
|
||||||
$update_cache = true;
|
|
||||||
} else {
|
|
||||||
$done[] = $old_data;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( $update_cache ) {
|
|
||||||
delete_post_meta( $policy_page_id, '_wp_suggested_privacy_policy_content' );
|
|
||||||
// Update the cache.
|
|
||||||
foreach ( $done as $data ) {
|
|
||||||
add_post_meta( $policy_page_id, '_wp_suggested_privacy_policy_content', $data );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check for updated, added or removed privacy policy information from plugins.
|
|
||||||
*
|
|
||||||
* Caches the current info in post_meta of the policy page.
|
|
||||||
*
|
|
||||||
* @since 4.9.6
|
|
||||||
*
|
|
||||||
* @return array The privacy policy text/informtion added by core and plugins.
|
|
||||||
*/
|
|
||||||
public static function get_suggested_policy_text() {
|
|
||||||
$policy_page_id = (int) get_option( 'wp_page_for_privacy_policy' );
|
|
||||||
$checked = array();
|
|
||||||
$time = time();
|
|
||||||
$update_cache = false;
|
|
||||||
$new = self::$policy_content;
|
|
||||||
$old = array();
|
|
||||||
|
|
||||||
if ( $policy_page_id ) {
|
|
||||||
$old = (array) get_post_meta( $policy_page_id, '_wp_suggested_privacy_policy_content' );
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check for no-changes and updates.
|
|
||||||
foreach ( $new as $new_key => $new_data ) {
|
|
||||||
foreach ( $old as $old_key => $old_data ) {
|
|
||||||
$found = false;
|
|
||||||
|
|
||||||
if ( $new_data['policy_text'] === $old_data['policy_text'] ) {
|
|
||||||
// Use the new plugin name in case it was changed, translated, etc.
|
|
||||||
if ( $old_data['plugin_name'] !== $new_data['plugin_name'] ) {
|
|
||||||
$old_data['plugin_name'] = $new_data['plugin_name'];
|
|
||||||
$update_cache = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// A plugin was re-activated.
|
|
||||||
if ( ! empty( $old_data['removed'] ) ) {
|
|
||||||
unset( $old_data['removed'] );
|
|
||||||
$old_data['added'] = $time;
|
|
||||||
$update_cache = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
$checked[] = $old_data;
|
|
||||||
$found = true;
|
|
||||||
} elseif ( $new_data['plugin_name'] === $old_data['plugin_name'] ) {
|
|
||||||
// The info for the policy was updated.
|
|
||||||
$checked[] = array(
|
|
||||||
'plugin_name' => $new_data['plugin_name'],
|
|
||||||
'policy_text' => $new_data['policy_text'],
|
|
||||||
'updated' => $time,
|
|
||||||
);
|
|
||||||
$found = $update_cache = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( $found ) {
|
|
||||||
unset( $new[ $new_key ], $old[ $old_key ] );
|
|
||||||
continue 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( ! empty( $new ) ) {
|
|
||||||
// A plugin was activated.
|
|
||||||
foreach ( $new as $new_data ) {
|
|
||||||
if ( ! empty( $new_data['plugin_name'] ) && ! empty( $new_data['policy_text'] ) ) {
|
|
||||||
$new_data['added'] = $time;
|
|
||||||
$checked[] = $new_data;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$update_cache = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( ! empty( $old ) ) {
|
|
||||||
// A plugin was deactivated.
|
|
||||||
foreach ( $old as $old_data ) {
|
|
||||||
if ( ! empty( $old_data['plugin_name'] ) && ! empty( $old_data['policy_text'] ) ) {
|
|
||||||
$data = array(
|
|
||||||
'plugin_name' => $old_data['plugin_name'],
|
|
||||||
'policy_text' => $old_data['policy_text'],
|
|
||||||
'removed' => $time,
|
|
||||||
);
|
|
||||||
|
|
||||||
$checked[] = $data;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$update_cache = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( $update_cache && $policy_page_id ) {
|
|
||||||
delete_post_meta( $policy_page_id, '_wp_suggested_privacy_policy_content' );
|
|
||||||
// Update the cache.
|
|
||||||
foreach ( $checked as $data ) {
|
|
||||||
add_post_meta( $policy_page_id, '_wp_suggested_privacy_policy_content', $data );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $checked;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add a notice with a link to the guide when editing the privacy policy page.
|
|
||||||
*
|
|
||||||
* @since 4.9.6
|
|
||||||
* @since 5.0.0 The $post parameter is now optional.
|
|
||||||
*
|
|
||||||
* @param WP_Post|null $post The currently edited post. Default null.
|
|
||||||
*/
|
|
||||||
public static function notice( $post = null ) {
|
|
||||||
if ( is_null( $post ) ) {
|
|
||||||
global $post;
|
|
||||||
} else {
|
|
||||||
$post = get_post( $post );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( ! ( $post instanceof WP_Post ) ) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( ! current_user_can( 'manage_privacy_options' ) ) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$policy_page_id = (int) get_option( 'wp_page_for_privacy_policy' );
|
|
||||||
|
|
||||||
if ( ! $policy_page_id || $policy_page_id !== $post->ID ) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$message = __( 'Need help putting together your new Privacy Policy page? Check out our guide for recommendations on what content to include, along with policies suggested by your plugins and theme.' );
|
|
||||||
$url = esc_url( admin_url( 'tools.php?wp-privacy-policy-guide=1' ) );
|
|
||||||
$label = __( 'View Privacy Policy Guide.' );
|
|
||||||
|
|
||||||
if ( get_current_screen()->is_block_editor() ) {
|
|
||||||
wp_enqueue_script( 'wp-notices' );
|
|
||||||
$action = array(
|
|
||||||
'url' => $url,
|
|
||||||
'label' => $label,
|
|
||||||
);
|
|
||||||
wp_add_inline_script(
|
|
||||||
'wp-notices',
|
|
||||||
sprintf(
|
|
||||||
'wp.data.dispatch( "core/notices" ).createWarningNotice( "%s", { actions: [ %s ], isDismissible: false } )',
|
|
||||||
$message,
|
|
||||||
wp_json_encode( $action )
|
|
||||||
),
|
|
||||||
'after'
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
?>
|
|
||||||
<div class="notice notice-warning inline wp-pp-notice">
|
|
||||||
<p>
|
|
||||||
<?php
|
|
||||||
echo $message;
|
|
||||||
printf(
|
|
||||||
' <a href="%s" target="_blank">%s <span class="screen-reader-text">%s</span></a>',
|
|
||||||
$url,
|
|
||||||
$label,
|
|
||||||
/* translators: accessibility text */
|
|
||||||
__( '(opens in a new tab)' )
|
|
||||||
);
|
|
||||||
?>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Output the privacy policy guide together with content from the theme and plugins.
|
|
||||||
*
|
|
||||||
* @since 4.9.6
|
|
||||||
*/
|
|
||||||
public static function privacy_policy_guide() {
|
|
||||||
|
|
||||||
$content_array = self::get_suggested_policy_text();
|
|
||||||
|
|
||||||
$content = '';
|
|
||||||
$toc = array( '<li><a href="#wp-privacy-policy-guide-introduction">' . __( 'Introduction' ) . '</a></li>' );
|
|
||||||
$date_format = __( 'F j, Y' );
|
|
||||||
$copy = __( 'Copy this section to clipboard' );
|
|
||||||
$return_to_top = '<a href="#" class="return-to-top">' . __( '↑ Return to Top' ) . '</a>';
|
|
||||||
|
|
||||||
foreach ( $content_array as $section ) {
|
|
||||||
$class = $meta = $removed = '';
|
|
||||||
|
|
||||||
if ( ! empty( $section['removed'] ) ) {
|
|
||||||
$class = ' text-removed';
|
|
||||||
$date = date_i18n( $date_format, $section['removed'] );
|
|
||||||
$meta = sprintf( __( 'Removed %s.' ), $date );
|
|
||||||
|
|
||||||
$removed = __( 'You deactivated this plugin on %s and may no longer need this policy.' );
|
|
||||||
$removed = '<div class="error inline"><p>' . sprintf( $removed, $date ) . '</p></div>';
|
|
||||||
} elseif ( ! empty( $section['updated'] ) ) {
|
|
||||||
$class = ' text-updated';
|
|
||||||
$date = date_i18n( $date_format, $section['updated'] );
|
|
||||||
$meta = sprintf( __( 'Updated %s.' ), $date );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( $meta ) {
|
|
||||||
$meta = '<br><span class="privacy-text-meta">' . $meta . '</span>';
|
|
||||||
}
|
|
||||||
|
|
||||||
$plugin_name = esc_html( $section['plugin_name'] );
|
|
||||||
$toc_id = 'wp-privacy-policy-guide-' . sanitize_title( $plugin_name );
|
|
||||||
$toc[] = sprintf( '<li><a href="#%1$s">%2$s</a>' . $meta . '</li>', $toc_id, $plugin_name );
|
|
||||||
|
|
||||||
$content .= '<div class="privacy-text-section' . $class . '">';
|
|
||||||
$content .= '<a id="' . $toc_id . '"> </a>';
|
|
||||||
/* translators: %s: plugin name */
|
|
||||||
$content .= '<h2>' . sprintf( __( 'Source: %s' ), $plugin_name ) . '</h2>';
|
|
||||||
$content .= $removed;
|
|
||||||
|
|
||||||
$content .= '<div class="policy-text">' . $section['policy_text'] . '</div>';
|
|
||||||
$content .= $return_to_top;
|
|
||||||
|
|
||||||
if ( empty( $section['removed'] ) ) {
|
|
||||||
$content .= '<div class="privacy-text-actions">';
|
|
||||||
$content .= '<button type="button" class="privacy-text-copy button">';
|
|
||||||
$content .= $copy;
|
|
||||||
$content .= '<span class="screen-reader-text">' . sprintf( __( 'Copy suggested policy text from %s.' ), $plugin_name ) . '</span>';
|
|
||||||
$content .= '</button>';
|
|
||||||
$content .= '</div>';
|
|
||||||
}
|
|
||||||
|
|
||||||
$content .= "</div>\n"; // End of .privacy-text-section.
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( count( $toc ) > 2 ) {
|
|
||||||
?>
|
|
||||||
<div class="privacy-text-box-toc">
|
|
||||||
<p><?php _e( 'Table of Contents' ); ?></p>
|
|
||||||
<ol>
|
|
||||||
<?php echo implode( "\n", $toc ); ?>
|
|
||||||
</ol>
|
|
||||||
</div>
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
<div class="privacy-text-box">
|
|
||||||
<div class="privacy-text-box-head">
|
|
||||||
<a id="wp-privacy-policy-guide-introduction"> </a>
|
|
||||||
<h2><?php _e( 'Introduction' ); ?></h2>
|
|
||||||
<p><?php _e( 'Hello,' ); ?></p>
|
|
||||||
<p><?php _e( 'This text template will help you to create your web site’s privacy policy.' ); ?></p>
|
|
||||||
<p><?php _e( 'We have suggested the sections you will need. Under each section heading you will find a short summary of what information you should provide, which will help you to get started. Some sections include suggested policy content, others will have to be completed with information from your theme and plugins.' ); ?></p>
|
|
||||||
<p><?php _e( 'Please edit your privacy policy content, making sure to delete the summaries, and adding any information from your theme and plugins. Once you publish your policy page, remember to add it to your navigation menu.' ); ?></p>
|
|
||||||
<p><?php _e( 'It is your responsibility to write a comprehensive privacy policy, to make sure it reflects all national and international legal requirements on privacy, and to keep your policy current and accurate.' ); ?></p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="privacy-text-box-body">
|
|
||||||
<?php echo $content; ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the default suggested privacy policy content.
|
|
||||||
*
|
|
||||||
* @since 4.9.6
|
|
||||||
* @since 5.0.0 Added the `$blocks` parameter.
|
|
||||||
*
|
|
||||||
* @param bool $description Whether to include the descriptions under the section headings. Default false.
|
|
||||||
* @param bool $blocks Whether to format the content for the block editor. Default true.
|
|
||||||
* @return string The default policy content.
|
|
||||||
*/
|
|
||||||
public static function get_default_content( $description = false, $blocks = true ) {
|
|
||||||
$suggested_text = $description ? '<strong class="privacy-policy-tutorial">' . __( 'Suggested text:' ) . ' </strong>' : '';
|
|
||||||
$content = '';
|
|
||||||
$strings = array();
|
|
||||||
|
|
||||||
// Start of the suggested privacy policy text.
|
|
||||||
if ( $description ) {
|
|
||||||
$strings[] = '<div class="wp-suggested-text">';
|
|
||||||
}
|
|
||||||
|
|
||||||
/* translators: default privacy policy heading. */
|
|
||||||
$strings[] = '<h2>' . __( 'Who we are' ) . '</h2>';
|
|
||||||
|
|
||||||
if ( $description ) {
|
|
||||||
/* translators: privacy policy tutorial. */
|
|
||||||
$strings[] = '<p class="privacy-policy-tutorial">' . __( 'In this section you should note your site URL, as well as the name of the company, organization, or individual behind it, and some accurate contact information.' ) . '</p>';
|
|
||||||
/* translators: privacy policy tutorial. */
|
|
||||||
$strings[] = '<p class="privacy-policy-tutorial">' . __( 'The amount of information you may be required to show will vary depending on your local or national business regulations. You may, for example, be required to display a physical address, a registered address, or your company registration number.' ) . '</p>';
|
|
||||||
}
|
|
||||||
|
|
||||||
/* translators: default privacy policy text, %s Site URL. */
|
|
||||||
$strings[] = '<p>' . $suggested_text . sprintf( __( 'Our website address is: %s.' ), get_bloginfo( 'url', 'display' ) ) . '</p>';
|
|
||||||
|
|
||||||
/* translators: default privacy policy heading. */
|
|
||||||
$strings[] = '<h2>' . __( 'What personal data we collect and why we collect it' ) . '</h2>';
|
|
||||||
|
|
||||||
if ( $description ) {
|
|
||||||
/* translators: privacy policy tutorial. */
|
|
||||||
$strings[] = '<p class="privacy-policy-tutorial">' . __( 'In this section you should note what personal data you collect from users and site visitors. This may include personal data, such as name, email address, personal account preferences; transactional data, such as purchase information; and technical data, such as information about cookies.' ) . '</p>';
|
|
||||||
/* translators: privacy policy tutorial. */
|
|
||||||
$strings[] = '<p class="privacy-policy-tutorial">' . __( 'You should also note any collection and retention of sensitive personal data, such as data concerning health.' ) . '</p>';
|
|
||||||
/* translators: privacy policy tutorial. */
|
|
||||||
$strings[] = '<p class="privacy-policy-tutorial">' . __( 'In addition to listing what personal data you collect, you need to note why you collect it. These explanations must note either the legal basis for your data collection and retention or the active consent the user has given.' ) . '</p>';
|
|
||||||
/* translators: privacy policy tutorial. */
|
|
||||||
$strings[] = '<p class="privacy-policy-tutorial">' . __( 'Personal data is not just created by a user’s interactions with your site. Personal data is also generated from technical processes such as contact forms, comments, cookies, analytics, and third party embeds.' ) . '</p>';
|
|
||||||
/* translators: privacy policy tutorial. */
|
|
||||||
$strings[] = '<p class="privacy-policy-tutorial">' . __( 'By default WordPress does not collect any personal data about visitors, and only collects the data shown on the User Profile screen from registered users. However some of your plugins may collect personal data. You should add the relevant information below.' ) . '</p>';
|
|
||||||
}
|
|
||||||
|
|
||||||
/* translators: default privacy policy heading. */
|
|
||||||
$strings[] = '<h3>' . __( 'Comments' ) . '</h3>';
|
|
||||||
|
|
||||||
if ( $description ) {
|
|
||||||
/* translators: privacy policy tutorial. */
|
|
||||||
$strings[] = '<p class="privacy-policy-tutorial">' . __( 'In this subsection you should note what information is captured through comments. We have noted the data which WordPress collects by default.' ) . '</p>';
|
|
||||||
}
|
|
||||||
|
|
||||||
/* translators: default privacy policy text. */
|
|
||||||
$strings[] = '<p>' . $suggested_text . __( 'When visitors leave comments on the site we collect the data shown in the comments form, and also the visitor’s IP address and browser user agent string to help spam detection.' ) . '</p>';
|
|
||||||
/* translators: default privacy policy text. */
|
|
||||||
$strings[] = '<p>' . __( 'An anonymized string created from your email address (also called a hash) may be provided to the Gravatar service to see if you are using it. The Gravatar service privacy policy is available here: https://automattic.com/privacy/. After approval of your comment, your profile picture is visible to the public in the context of your comment.' ) . '</p>';
|
|
||||||
|
|
||||||
/* translators: default privacy policy heading. */
|
|
||||||
$strings[] = '<h3>' . __( 'Media' ) . '</h3>';
|
|
||||||
|
|
||||||
if ( $description ) {
|
|
||||||
/* translators: privacy policy tutorial. */
|
|
||||||
$strings[] = '<p class="privacy-policy-tutorial">' . __( 'In this subsection you should note what information may be disclosed by users who can upload media files. All uploaded files are usually publicly accessible.' ) . '</p>';
|
|
||||||
}
|
|
||||||
|
|
||||||
/* translators: default privacy policy text. */
|
|
||||||
$strings[] = '<p>' . $suggested_text . __( 'If you upload images to the website, you should avoid uploading images with embedded location data (EXIF GPS) included. Visitors to the website can download and extract any location data from images on the website.' ) . '</p>';
|
|
||||||
|
|
||||||
/* translators: default privacy policy heading. */
|
|
||||||
$strings[] = '<h3>' . __( 'Contact forms' ) . '</h3>';
|
|
||||||
|
|
||||||
if ( $description ) {
|
|
||||||
/* translators: privacy policy tutorial. */
|
|
||||||
$strings[] = '<p class="privacy-policy-tutorial">' . __( 'By default, WordPress does not include a contact form. If you use a contact form plugin, use this subsection to note what personal data is captured when someone submits a contact form, and how long you keep it. For example, you may note that you keep contact form submissions for a certain period for customer service purposes, but you do not use the information submitted through them for marketing purposes.' ) . '</p>';
|
|
||||||
}
|
|
||||||
|
|
||||||
/* translators: default privacy policy heading. */
|
|
||||||
$strings[] = '<h3>' . __( 'Cookies' ) . '</h3>';
|
|
||||||
|
|
||||||
if ( $description ) {
|
|
||||||
/* translators: privacy policy tutorial. */
|
|
||||||
$strings[] = '<p class="privacy-policy-tutorial">' . __( 'In this subsection you should list the cookies your web site uses, including those set by your plugins, social media, and analytics. We have provided the cookies which WordPress installs by default.' ) . '</p>';
|
|
||||||
}
|
|
||||||
|
|
||||||
/* translators: default privacy policy text. */
|
|
||||||
$strings[] = '<p>' . $suggested_text . __( 'If you leave a comment on our site you may opt-in to saving your name, email address and website in cookies. These are for your convenience so that you do not have to fill in your details again when you leave another comment. These cookies will last for one year.' ) . '</p>';
|
|
||||||
/* translators: default privacy policy text. */
|
|
||||||
$strings[] = '<p>' . __( 'If you visit our login page, we will set a temporary cookie to determine if your browser accepts cookies. This cookie contains no personal data and is discarded when you close your browser.' ) . '</p>';
|
|
||||||
/* translators: default privacy policy text. */
|
|
||||||
$strings[] = '<p>' . __( 'When you log in, we will also set up several cookies to save your login information and your screen display choices. Login cookies last for two days, and screen options cookies last for a year. If you select "Remember Me", your login will persist for two weeks. If you log out of your account, the login cookies will be removed.' ) . '</p>';
|
|
||||||
/* translators: default privacy policy text. */
|
|
||||||
$strings[] = '<p>' . __( 'If you edit or publish an article, an additional cookie will be saved in your browser. This cookie includes no personal data and simply indicates the post ID of the article you just edited. It expires after 1 day.' ) . '</p>';
|
|
||||||
|
|
||||||
/* translators: default privacy policy heading. */
|
|
||||||
$strings[] = '<h3>' . __( 'Embedded content from other websites' ) . '</h3>';
|
|
||||||
/* translators: default privacy policy text. */
|
|
||||||
$strings[] = '<p>' . $suggested_text . __( 'Articles on this site may include embedded content (e.g. videos, images, articles, etc.). Embedded content from other websites behaves in the exact same way as if the visitor has visited the other website.' ) . '</p>';
|
|
||||||
/* translators: default privacy policy text. */
|
|
||||||
$strings[] = '<p>' . __( 'These websites may collect data about you, use cookies, embed additional third-party tracking, and monitor your interaction with that embedded content, including tracking your interaction with the embedded content if you have an account and are logged in to that website.' ) . '</p>';
|
|
||||||
|
|
||||||
/* translators: default privacy policy heading. */
|
|
||||||
$strings[] = '<h3>' . __( 'Analytics' ) . '</h3>';
|
|
||||||
|
|
||||||
if ( $description ) {
|
|
||||||
/* translators: privacy policy tutorial. */
|
|
||||||
$strings[] = '<p class="privacy-policy-tutorial">' . __( 'In this subsection you should note what analytics package you use, how users can opt out of analytics tracking, and a link to your analytics provider’s privacy policy, if any.' ) . '</p>';
|
|
||||||
/* translators: privacy policy tutorial. */
|
|
||||||
$strings[] = '<p class="privacy-policy-tutorial">' . __( 'By default WordPress does not collect any analytics data. However, many web hosting accounts collect some anonymous analytics data. You may also have installed a WordPress plugin that provides analytics services. In that case, add information from that plugin here.' ) . '</p>';
|
|
||||||
}
|
|
||||||
|
|
||||||
/* translators: default privacy policy heading. */
|
|
||||||
$strings[] = '<h2>' . __( 'Who we share your data with' ) . '</h2>';
|
|
||||||
|
|
||||||
if ( $description ) {
|
|
||||||
/* translators: privacy policy tutorial. */
|
|
||||||
$strings[] = '<p class="privacy-policy-tutorial">' . __( 'In this section you should name and list all third party providers with whom you share site data, including partners, cloud-based services, payment processors, and third party service providers, and note what data you share with them and why. Link to their own privacy policies if possible.' ) . '</p>';
|
|
||||||
/* translators: privacy policy tutorial. */
|
|
||||||
$strings[] = '<p class="privacy-policy-tutorial">' . __( 'By default WordPress does not share any personal data with anyone.' ) . '</p>';
|
|
||||||
}
|
|
||||||
|
|
||||||
/* translators: default privacy policy heading. */
|
|
||||||
$strings[] = '<h2>' . __( 'How long we retain your data' ) . '</h2>';
|
|
||||||
|
|
||||||
if ( $description ) {
|
|
||||||
/* translators: privacy policy tutorial. */
|
|
||||||
$strings[] = '<p class="privacy-policy-tutorial">' . __( 'In this section you should explain how long you retain personal data collected or processed by the web site. While it is your responsibility to come up with the schedule of how long you keep each dataset for and why you keep it, that information does need to be listed here. For example, you may want to say that you keep contact form entries for six months, analytics records for a year, and customer purchase records for ten years.' ) . '</p>';
|
|
||||||
}
|
|
||||||
|
|
||||||
/* translators: default privacy policy text. */
|
|
||||||
$strings[] = '<p>' . $suggested_text . __( 'If you leave a comment, the comment and its metadata are retained indefinitely. This is so we can recognize and approve any follow-up comments automatically instead of holding them in a moderation queue.' ) . '</p>';
|
|
||||||
/* translators: default privacy policy text. */
|
|
||||||
$strings[] = '<p>' . __( 'For users that register on our website (if any), we also store the personal information they provide in their user profile. All users can see, edit, or delete their personal information at any time (except they cannot change their username). Website administrators can also see and edit that information.' ) . '</p>';
|
|
||||||
|
|
||||||
/* translators: default privacy policy heading. */
|
|
||||||
$strings[] = '<h2>' . __( 'What rights you have over your data' ) . '</h2>';
|
|
||||||
|
|
||||||
if ( $description ) {
|
|
||||||
/* translators: privacy policy tutorial. */
|
|
||||||
$strings[] = '<p class="privacy-policy-tutorial">' . __( 'In this section you should explain what rights your users have over their data and how they can invoke those rights.' ) . '</p>';
|
|
||||||
}
|
|
||||||
|
|
||||||
/* translators: default privacy policy text. */
|
|
||||||
$strings[] = '<p>' . $suggested_text . __( 'If you have an account on this site, or have left comments, you can request to receive an exported file of the personal data we hold about you, including any data you have provided to us. You can also request that we erase any personal data we hold about you. This does not include any data we are obliged to keep for administrative, legal, or security purposes.' ) . '</p>';
|
|
||||||
|
|
||||||
/* translators: default privacy policy heading. */
|
|
||||||
$strings[] = '<h2>' . __( 'Where we send your data' ) . '</h2>';
|
|
||||||
|
|
||||||
if ( $description ) {
|
|
||||||
/* translators: privacy policy tutorial. */
|
|
||||||
$strings[] = '<p class="privacy-policy-tutorial">' . __( 'In this section you should list all transfers of your site data outside the European Union and describe the means by which that data is safeguarded to European data protection standards. This could include your web hosting, cloud storage, or other third party services.' ) . '</p>';
|
|
||||||
/* translators: privacy policy tutorial. */
|
|
||||||
$strings[] = '<p class="privacy-policy-tutorial">' . __( 'European data protection law requires data about European residents which is transferred outside the European Union to be safeguarded to the same standards as if the data was in Europe. So in addition to listing where data goes, you should describe how you ensure that these standards are met either by yourself or by your third party providers, whether that is through an agreement such as Privacy Shield, model clauses in your contracts, or binding corporate rules.' ) . '</p>';
|
|
||||||
}
|
|
||||||
|
|
||||||
/* translators: default privacy policy text. */
|
|
||||||
$strings[] = '<p>' . $suggested_text . __( 'Visitor comments may be checked through an automated spam detection service.' ) . '</p>';
|
|
||||||
|
|
||||||
/* translators: default privacy policy heading. */
|
|
||||||
$strings[] = '<h2>' . __( 'Your contact information' ) . '</h2>';
|
|
||||||
|
|
||||||
if ( $description ) {
|
|
||||||
/* translators: privacy policy tutorial. */
|
|
||||||
$strings[] = '<p class="privacy-policy-tutorial">' . __( 'In this section you should provide a contact method for privacy-specific concerns. If you are required to have a Data Protection Officer, list their name and full contact details here as well.' ) . '</p>';
|
|
||||||
}
|
|
||||||
|
|
||||||
/* translators: default privacy policy heading. */
|
|
||||||
$strings[] = '<h2>' . __( 'Additional information' ) . '</h2>';
|
|
||||||
|
|
||||||
if ( $description ) {
|
|
||||||
/* translators: privacy policy tutorial. */
|
|
||||||
$strings[] = '<p class="privacy-policy-tutorial">' . __( 'If you use your site for commercial purposes and you engage in more complex collection or processing of personal data, you should note the following information in your privacy policy in addition to the information we have already discussed.' ) . '</p>';
|
|
||||||
}
|
|
||||||
|
|
||||||
/* translators: default privacy policy heading. */
|
|
||||||
$strings[] = '<h3>' . __( 'How we protect your data' ) . '</h3>';
|
|
||||||
|
|
||||||
if ( $description ) {
|
|
||||||
/* translators: privacy policy tutorial. */
|
|
||||||
$strings[] = '<p class="privacy-policy-tutorial">' . __( 'In this section you should explain what measures you have taken to protect your users’ data. This could include technical measures such as encryption; security measures such as two factor authentication; and measures such as staff training in data protection. If you have carried out a Privacy Impact Assessment, you can mention it here too.' ) . '</p>';
|
|
||||||
}
|
|
||||||
|
|
||||||
/* translators: default privacy policy heading. */
|
|
||||||
$strings[] = '<h3>' . __( 'What data breach procedures we have in place' ) . '</h3>';
|
|
||||||
|
|
||||||
if ( $description ) {
|
|
||||||
/* translators: privacy policy tutorial. */
|
|
||||||
$strings[] = '<p class="privacy-policy-tutorial">' . __( 'In this section you should explain what procedures you have in place to deal with data breaches, either potential or real, such as internal reporting systems, contact mechanisms, or bug bounties.' ) . '</p>';
|
|
||||||
}
|
|
||||||
|
|
||||||
/* translators: default privacy policy heading. */
|
|
||||||
$strings[] = '<h3>' . __( 'What third parties we receive data from' ) . '</h3>';
|
|
||||||
|
|
||||||
if ( $description ) {
|
|
||||||
/* translators: privacy policy tutorial. */
|
|
||||||
$strings[] = '<p class="privacy-policy-tutorial">' . __( 'If your web site receives data about users from third parties, including advertisers, this information must be included within the section of your privacy policy dealing with third party data.' ) . '</p>';
|
|
||||||
}
|
|
||||||
|
|
||||||
/* translators: default privacy policy heading. */
|
|
||||||
$strings[] = '<h3>' . __( 'What automated decision making and/or profiling we do with user data' ) . '</h3>';
|
|
||||||
|
|
||||||
if ( $description ) {
|
|
||||||
/* translators: privacy policy tutorial. */
|
|
||||||
$strings[] = '<p class="privacy-policy-tutorial">' . __( 'If your web site provides a service which includes automated decision making - for example, allowing customers to apply for credit, or aggregating their data into an advertising profile - you must note that this is taking place, and include information about how that information is used, what decisions are made with that aggregated data, and what rights users have over decisions made without human intervention.' ) . '</p>';
|
|
||||||
}
|
|
||||||
|
|
||||||
/* translators: default privacy policy heading. */
|
|
||||||
$strings[] = '<h3>' . __( 'Industry regulatory disclosure requirements' ) . '</h3>';
|
|
||||||
|
|
||||||
if ( $description ) {
|
|
||||||
/* translators: privacy policy tutorial. */
|
|
||||||
$strings[] = '<p class="privacy-policy-tutorial">' . __( 'If you are a member of a regulated industry, or if you are subject to additional privacy laws, you may be required to disclose that information here.' ) . '</p>';
|
|
||||||
$strings[] = '</div>';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( $blocks ) {
|
|
||||||
foreach ( $strings as $key => $string ) {
|
|
||||||
if ( 0 === strpos( $string, '<p>' ) ) {
|
|
||||||
$strings[ $key ] = '<!-- wp:paragraph -->' . $string . '<!-- /wp:paragraph -->';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( 0 === strpos( $string, '<h2>' ) ) {
|
|
||||||
$strings[ $key ] = '<!-- wp:heading -->' . $string . '<!-- /wp:heading -->';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( 0 === strpos( $string, '<h3>' ) ) {
|
|
||||||
$strings[ $key ] = '<!-- wp:heading {"level":3} -->' . $string . '<!-- /wp:heading -->';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$content = implode( '', $strings );
|
|
||||||
// End of the suggested privacy policy text.
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Filters the default content suggested for inclusion in a privacy policy.
|
|
||||||
*
|
|
||||||
* @since 4.9.6
|
|
||||||
* @since 5.0.0 Added the `$strings`, `$description`, and `$blocks` parameters.
|
|
||||||
*
|
|
||||||
* @param string $content The default policy content.
|
|
||||||
* @param array $strings An array of privacy policy content strings.
|
|
||||||
* @param bool $description Whether policy descriptions should be included.
|
|
||||||
* @param bool $blocks Whether the content should be formatted for the block editor.
|
|
||||||
*/
|
|
||||||
return apply_filters( 'wp_get_default_privacy_policy_content', $content, $strings, $description, $blocks );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add the suggested privacy policy text to the policy postbox.
|
|
||||||
*
|
|
||||||
* @since 4.9.6
|
|
||||||
*/
|
|
||||||
public static function add_suggested_content() {
|
|
||||||
$content = self::get_default_content( true, false );
|
|
||||||
wp_add_privacy_policy_content( __( 'WordPress' ), $content );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the user needs to update PHP.
|
* Checks if the user needs to update PHP.
|
||||||
*
|
*
|
||||||
|
|
|
@ -2187,7 +2187,7 @@ function wp_add_privacy_policy_content( $plugin_name, $policy_text ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! class_exists( 'WP_Privacy_Policy_Content' ) ) {
|
if ( ! class_exists( 'WP_Privacy_Policy_Content' ) ) {
|
||||||
require_once( ABSPATH . 'wp-admin/includes/misc.php' );
|
require_once( ABSPATH . 'wp-admin/includes/class-wp-privacy-policy-content.php' );
|
||||||
}
|
}
|
||||||
|
|
||||||
WP_Privacy_Policy_Content::add( $plugin_name, $policy_text );
|
WP_Privacy_Policy_Content::add( $plugin_name, $policy_text );
|
||||||
|
|
|
@ -0,0 +1,289 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* WordPress Administration Privacy Tools API.
|
||||||
|
*
|
||||||
|
* @package WordPress
|
||||||
|
* @subpackage Administration
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resend an existing request and return the result.
|
||||||
|
*
|
||||||
|
* @since 4.9.6
|
||||||
|
* @access private
|
||||||
|
*
|
||||||
|
* @param int $request_id Request ID.
|
||||||
|
* @return bool|WP_Error Returns true/false based on the success of sending the email, or a WP_Error object.
|
||||||
|
*/
|
||||||
|
function _wp_privacy_resend_request( $request_id ) {
|
||||||
|
$request_id = absint( $request_id );
|
||||||
|
$request = get_post( $request_id );
|
||||||
|
|
||||||
|
if ( ! $request || 'user_request' !== $request->post_type ) {
|
||||||
|
return new WP_Error( 'privacy_request_error', __( 'Invalid request.' ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = wp_send_user_request( $request_id );
|
||||||
|
|
||||||
|
if ( is_wp_error( $result ) ) {
|
||||||
|
return $result;
|
||||||
|
} elseif ( ! $result ) {
|
||||||
|
return new WP_Error( 'privacy_request_error', __( 'Unable to initiate confirmation request.' ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Marks a request as completed by the admin and logs the current timestamp.
|
||||||
|
*
|
||||||
|
* @since 4.9.6
|
||||||
|
* @access private
|
||||||
|
*
|
||||||
|
* @param int $request_id Request ID.
|
||||||
|
* @return int|WP_Error $result Request ID on success or WP_Error.
|
||||||
|
*/
|
||||||
|
function _wp_privacy_completed_request( $request_id ) {
|
||||||
|
$request_id = absint( $request_id );
|
||||||
|
$request = wp_get_user_request_data( $request_id );
|
||||||
|
|
||||||
|
if ( ! $request ) {
|
||||||
|
return new WP_Error( 'privacy_request_error', __( 'Invalid request.' ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
update_post_meta( $request_id, '_wp_user_request_completed_timestamp', time() );
|
||||||
|
|
||||||
|
$result = wp_update_post(
|
||||||
|
array(
|
||||||
|
'ID' => $request_id,
|
||||||
|
'post_status' => 'request-completed',
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle list table actions.
|
||||||
|
*
|
||||||
|
* @since 4.9.6
|
||||||
|
* @access private
|
||||||
|
*/
|
||||||
|
function _wp_personal_data_handle_actions() {
|
||||||
|
if ( isset( $_POST['privacy_action_email_retry'] ) ) {
|
||||||
|
check_admin_referer( 'bulk-privacy_requests' );
|
||||||
|
|
||||||
|
$request_id = absint( current( array_keys( (array) wp_unslash( $_POST['privacy_action_email_retry'] ) ) ) );
|
||||||
|
$result = _wp_privacy_resend_request( $request_id );
|
||||||
|
|
||||||
|
if ( is_wp_error( $result ) ) {
|
||||||
|
add_settings_error(
|
||||||
|
'privacy_action_email_retry',
|
||||||
|
'privacy_action_email_retry',
|
||||||
|
$result->get_error_message(),
|
||||||
|
'error'
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
add_settings_error(
|
||||||
|
'privacy_action_email_retry',
|
||||||
|
'privacy_action_email_retry',
|
||||||
|
__( 'Confirmation request sent again successfully.' ),
|
||||||
|
'updated'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} elseif ( isset( $_POST['action'] ) ) {
|
||||||
|
$action = ! empty( $_POST['action'] ) ? sanitize_key( wp_unslash( $_POST['action'] ) ) : '';
|
||||||
|
|
||||||
|
switch ( $action ) {
|
||||||
|
case 'add_export_personal_data_request':
|
||||||
|
case 'add_remove_personal_data_request':
|
||||||
|
check_admin_referer( 'personal-data-request' );
|
||||||
|
|
||||||
|
if ( ! isset( $_POST['type_of_action'], $_POST['username_or_email_for_privacy_request'] ) ) {
|
||||||
|
add_settings_error(
|
||||||
|
'action_type',
|
||||||
|
'action_type',
|
||||||
|
__( 'Invalid action.' ),
|
||||||
|
'error'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
$action_type = sanitize_text_field( wp_unslash( $_POST['type_of_action'] ) );
|
||||||
|
$username_or_email_address = sanitize_text_field( wp_unslash( $_POST['username_or_email_for_privacy_request'] ) );
|
||||||
|
$email_address = '';
|
||||||
|
|
||||||
|
if ( ! in_array( $action_type, _wp_privacy_action_request_types(), true ) ) {
|
||||||
|
add_settings_error(
|
||||||
|
'action_type',
|
||||||
|
'action_type',
|
||||||
|
__( 'Invalid action.' ),
|
||||||
|
'error'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! is_email( $username_or_email_address ) ) {
|
||||||
|
$user = get_user_by( 'login', $username_or_email_address );
|
||||||
|
if ( ! $user instanceof WP_User ) {
|
||||||
|
add_settings_error(
|
||||||
|
'username_or_email_for_privacy_request',
|
||||||
|
'username_or_email_for_privacy_request',
|
||||||
|
__( 'Unable to add this request. A valid email address or username must be supplied.' ),
|
||||||
|
'error'
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$email_address = $user->user_email;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$email_address = $username_or_email_address;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( empty( $email_address ) ) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$request_id = wp_create_user_request( $email_address, $action_type );
|
||||||
|
|
||||||
|
if ( is_wp_error( $request_id ) ) {
|
||||||
|
add_settings_error(
|
||||||
|
'username_or_email_for_privacy_request',
|
||||||
|
'username_or_email_for_privacy_request',
|
||||||
|
$request_id->get_error_message(),
|
||||||
|
'error'
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
} elseif ( ! $request_id ) {
|
||||||
|
add_settings_error(
|
||||||
|
'username_or_email_for_privacy_request',
|
||||||
|
'username_or_email_for_privacy_request',
|
||||||
|
__( 'Unable to initiate confirmation request.' ),
|
||||||
|
'error'
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
wp_send_user_request( $request_id );
|
||||||
|
|
||||||
|
add_settings_error(
|
||||||
|
'username_or_email_for_privacy_request',
|
||||||
|
'username_or_email_for_privacy_request',
|
||||||
|
__( 'Confirmation request initiated successfully.' ),
|
||||||
|
'updated'
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cleans up failed and expired requests before displaying the list table.
|
||||||
|
*
|
||||||
|
* @since 4.9.6
|
||||||
|
* @access private
|
||||||
|
*/
|
||||||
|
function _wp_personal_data_cleanup_requests() {
|
||||||
|
/** This filter is documented in wp-includes/user.php */
|
||||||
|
$expires = (int) apply_filters( 'user_request_key_expiration', DAY_IN_SECONDS );
|
||||||
|
|
||||||
|
$requests_query = new WP_Query(
|
||||||
|
array(
|
||||||
|
'post_type' => 'user_request',
|
||||||
|
'posts_per_page' => -1,
|
||||||
|
'post_status' => 'request-pending',
|
||||||
|
'fields' => 'ids',
|
||||||
|
'date_query' => array(
|
||||||
|
array(
|
||||||
|
'column' => 'post_modified_gmt',
|
||||||
|
'before' => $expires . ' seconds ago',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$request_ids = $requests_query->posts;
|
||||||
|
|
||||||
|
foreach ( $request_ids as $request_id ) {
|
||||||
|
wp_update_post(
|
||||||
|
array(
|
||||||
|
'ID' => $request_id,
|
||||||
|
'post_status' => 'request-failed',
|
||||||
|
'post_password' => '',
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mark erasure requests as completed after processing is finished.
|
||||||
|
*
|
||||||
|
* This intercepts the Ajax responses to personal data eraser page requests, and
|
||||||
|
* monitors the status of a request. Once all of the processing has finished, the
|
||||||
|
* request is marked as completed.
|
||||||
|
*
|
||||||
|
* @since 4.9.6
|
||||||
|
*
|
||||||
|
* @see wp_privacy_personal_data_erasure_page
|
||||||
|
*
|
||||||
|
* @param array $response The response from the personal data eraser for
|
||||||
|
* the given page.
|
||||||
|
* @param int $eraser_index The index of the personal data eraser. Begins
|
||||||
|
* at 1.
|
||||||
|
* @param string $email_address The email address of the user whose personal
|
||||||
|
* data this is.
|
||||||
|
* @param int $page The page of personal data for this eraser.
|
||||||
|
* Begins at 1.
|
||||||
|
* @param int $request_id The request ID for this personal data erasure.
|
||||||
|
* @return array The filtered response.
|
||||||
|
*/
|
||||||
|
function wp_privacy_process_personal_data_erasure_page( $response, $eraser_index, $email_address, $page, $request_id ) {
|
||||||
|
/*
|
||||||
|
* If the eraser response is malformed, don't attempt to consume it; let it
|
||||||
|
* pass through, so that the default Ajax processing will generate a warning
|
||||||
|
* to the user.
|
||||||
|
*/
|
||||||
|
if ( ! is_array( $response ) ) {
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! array_key_exists( 'done', $response ) ) {
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! array_key_exists( 'items_removed', $response ) ) {
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! array_key_exists( 'items_retained', $response ) ) {
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! array_key_exists( 'messages', $response ) ) {
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
$request = wp_get_user_request_data( $request_id );
|
||||||
|
|
||||||
|
if ( ! $request || 'remove_personal_data' !== $request->action_name ) {
|
||||||
|
wp_send_json_error( __( 'Invalid request ID when processing eraser data.' ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
/** This filter is documented in wp-admin/includes/ajax-actions.php */
|
||||||
|
$erasers = apply_filters( 'wp_privacy_personal_data_erasers', array() );
|
||||||
|
$is_last_eraser = count( $erasers ) === $eraser_index;
|
||||||
|
$eraser_done = $response['done'];
|
||||||
|
|
||||||
|
if ( ! $is_last_eraser || ! $eraser_done ) {
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
_wp_privacy_completed_request( $request_id );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fires immediately after a personal data erasure request has been marked completed.
|
||||||
|
*
|
||||||
|
* @since 4.9.6
|
||||||
|
*
|
||||||
|
* @param int $request_id The privacy request post ID associated with this request.
|
||||||
|
*/
|
||||||
|
do_action( 'wp_privacy_personal_data_erased', $request_id );
|
||||||
|
|
||||||
|
return $response;
|
||||||
|
}
|
|
@ -342,7 +342,7 @@ Commenter avatars come from <a href="https://gravatar.com">Gravatar</a>.'
|
||||||
$privacy_policy_content = get_site_option( 'default_privacy_policy_content' );
|
$privacy_policy_content = get_site_option( 'default_privacy_policy_content' );
|
||||||
} else {
|
} else {
|
||||||
if ( ! class_exists( 'WP_Privacy_Policy_Content' ) ) {
|
if ( ! class_exists( 'WP_Privacy_Policy_Content' ) ) {
|
||||||
include_once( ABSPATH . 'wp-admin/includes/misc.php' );
|
include_once( ABSPATH . 'wp-admin/includes/class-wp-privacy-policy-content.php' );
|
||||||
}
|
}
|
||||||
|
|
||||||
$privacy_policy_content = WP_Privacy_Policy_Content::get_default_content();
|
$privacy_policy_content = WP_Privacy_Policy_Content::get_default_content();
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,256 @@
|
||||||
|
/**
|
||||||
|
* Interactions used by the User Privacy tools in WordPress.
|
||||||
|
*
|
||||||
|
* @output wp-admin/js/privacy-tools.js
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Privacy request action handling
|
||||||
|
jQuery( document ).ready( function( $ ) {
|
||||||
|
var strings = window.privacyToolsL10n || {};
|
||||||
|
|
||||||
|
function setActionState( $action, state ) {
|
||||||
|
$action.children().hide();
|
||||||
|
$action.children( '.' + state ).show();
|
||||||
|
}
|
||||||
|
|
||||||
|
function clearResultsAfterRow( $requestRow ) {
|
||||||
|
$requestRow.removeClass( 'has-request-results' );
|
||||||
|
|
||||||
|
if ( $requestRow.next().hasClass( 'request-results' ) ) {
|
||||||
|
$requestRow.next().remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function appendResultsAfterRow( $requestRow, classes, summaryMessage, additionalMessages ) {
|
||||||
|
var itemList = '',
|
||||||
|
resultRowClasses = 'request-results';
|
||||||
|
|
||||||
|
clearResultsAfterRow( $requestRow );
|
||||||
|
|
||||||
|
if ( additionalMessages.length ) {
|
||||||
|
$.each( additionalMessages, function( index, value ) {
|
||||||
|
itemList = itemList + '<li>' + value + '</li>';
|
||||||
|
});
|
||||||
|
itemList = '<ul>' + itemList + '</ul>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$requestRow.addClass( 'has-request-results' );
|
||||||
|
|
||||||
|
if ( $requestRow.hasClass( 'status-request-confirmed' ) ) {
|
||||||
|
resultRowClasses = resultRowClasses + ' status-request-confirmed';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $requestRow.hasClass( 'status-request-failed' ) ) {
|
||||||
|
resultRowClasses = resultRowClasses + ' status-request-failed';
|
||||||
|
}
|
||||||
|
|
||||||
|
$requestRow.after( function() {
|
||||||
|
return '<tr class="' + resultRowClasses + '"><th colspan="5">' +
|
||||||
|
'<div class="notice inline notice-alt ' + classes + '">' +
|
||||||
|
'<p>' + summaryMessage + '</p>' +
|
||||||
|
itemList +
|
||||||
|
'</div>' +
|
||||||
|
'</td>' +
|
||||||
|
'</tr>';
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
$( '.export-personal-data-handle' ).click( function( event ) {
|
||||||
|
var $this = $( this ),
|
||||||
|
$action = $this.parents( '.export-personal-data' ),
|
||||||
|
$requestRow = $this.parents( 'tr' ),
|
||||||
|
requestID = $action.data( 'request-id' ),
|
||||||
|
nonce = $action.data( 'nonce' ),
|
||||||
|
exportersCount = $action.data( 'exporters-count' ),
|
||||||
|
sendAsEmail = $action.data( 'send-as-email' ) ? true : false;
|
||||||
|
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
|
||||||
|
$action.blur();
|
||||||
|
clearResultsAfterRow( $requestRow );
|
||||||
|
|
||||||
|
function onExportDoneSuccess( zipUrl ) {
|
||||||
|
setActionState( $action, 'export-personal-data-success' );
|
||||||
|
if ( 'undefined' !== typeof zipUrl ) {
|
||||||
|
window.location = zipUrl;
|
||||||
|
} else if ( ! sendAsEmail ) {
|
||||||
|
onExportFailure( strings.noExportFile );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function onExportFailure( errorMessage ) {
|
||||||
|
setActionState( $action, 'export-personal-data-failed' );
|
||||||
|
if ( errorMessage ) {
|
||||||
|
appendResultsAfterRow( $requestRow, 'notice-error', strings.exportError, [ errorMessage ] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function doNextExport( exporterIndex, pageIndex ) {
|
||||||
|
$.ajax(
|
||||||
|
{
|
||||||
|
url: window.ajaxurl,
|
||||||
|
data: {
|
||||||
|
action: 'wp-privacy-export-personal-data',
|
||||||
|
exporter: exporterIndex,
|
||||||
|
id: requestID,
|
||||||
|
page: pageIndex,
|
||||||
|
security: nonce,
|
||||||
|
sendAsEmail: sendAsEmail
|
||||||
|
},
|
||||||
|
method: 'post'
|
||||||
|
}
|
||||||
|
).done( function( response ) {
|
||||||
|
var responseData = response.data;
|
||||||
|
|
||||||
|
if ( ! response.success ) {
|
||||||
|
|
||||||
|
// e.g. invalid request ID
|
||||||
|
onExportFailure( response.data );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! responseData.done ) {
|
||||||
|
setTimeout( doNextExport( exporterIndex, pageIndex + 1 ) );
|
||||||
|
} else {
|
||||||
|
if ( exporterIndex < exportersCount ) {
|
||||||
|
setTimeout( doNextExport( exporterIndex + 1, 1 ) );
|
||||||
|
} else {
|
||||||
|
onExportDoneSuccess( responseData.url );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).fail( function( jqxhr, textStatus, error ) {
|
||||||
|
|
||||||
|
// e.g. Nonce failure
|
||||||
|
onExportFailure( error );
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// And now, let's begin
|
||||||
|
setActionState( $action, 'export-personal-data-processing' );
|
||||||
|
doNextExport( 1, 1 );
|
||||||
|
});
|
||||||
|
|
||||||
|
$( '.remove-personal-data-handle' ).click( function( event ) {
|
||||||
|
var $this = $( this ),
|
||||||
|
$action = $this.parents( '.remove-personal-data' ),
|
||||||
|
$requestRow = $this.parents( 'tr' ),
|
||||||
|
requestID = $action.data( 'request-id' ),
|
||||||
|
nonce = $action.data( 'nonce' ),
|
||||||
|
erasersCount = $action.data( 'erasers-count' ),
|
||||||
|
hasRemoved = false,
|
||||||
|
hasRetained = false,
|
||||||
|
messages = [];
|
||||||
|
|
||||||
|
event.stopPropagation();
|
||||||
|
|
||||||
|
$action.blur();
|
||||||
|
clearResultsAfterRow( $requestRow );
|
||||||
|
|
||||||
|
function onErasureDoneSuccess() {
|
||||||
|
var summaryMessage = strings.noDataFound;
|
||||||
|
var classes = 'notice-success';
|
||||||
|
|
||||||
|
setActionState( $action, 'remove-personal-data-idle' );
|
||||||
|
|
||||||
|
if ( false === hasRemoved ) {
|
||||||
|
if ( false === hasRetained ) {
|
||||||
|
summaryMessage = strings.noDataFound;
|
||||||
|
} else {
|
||||||
|
summaryMessage = strings.noneRemoved;
|
||||||
|
classes = 'notice-warning';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ( false === hasRetained ) {
|
||||||
|
summaryMessage = strings.foundAndRemoved;
|
||||||
|
} else {
|
||||||
|
summaryMessage = strings.someNotRemoved;
|
||||||
|
classes = 'notice-warning';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
appendResultsAfterRow( $requestRow, 'notice-success', summaryMessage, messages );
|
||||||
|
}
|
||||||
|
|
||||||
|
function onErasureFailure() {
|
||||||
|
setActionState( $action, 'remove-personal-data-failed' );
|
||||||
|
appendResultsAfterRow( $requestRow, 'notice-error', strings.removalError, [] );
|
||||||
|
}
|
||||||
|
|
||||||
|
function doNextErasure( eraserIndex, pageIndex ) {
|
||||||
|
$.ajax({
|
||||||
|
url: window.ajaxurl,
|
||||||
|
data: {
|
||||||
|
action: 'wp-privacy-erase-personal-data',
|
||||||
|
eraser: eraserIndex,
|
||||||
|
id: requestID,
|
||||||
|
page: pageIndex,
|
||||||
|
security: nonce
|
||||||
|
},
|
||||||
|
method: 'post'
|
||||||
|
}).done( function( response ) {
|
||||||
|
var responseData = response.data;
|
||||||
|
|
||||||
|
if ( ! response.success ) {
|
||||||
|
onErasureFailure();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ( responseData.items_removed ) {
|
||||||
|
hasRemoved = hasRemoved || responseData.items_removed;
|
||||||
|
}
|
||||||
|
if ( responseData.items_retained ) {
|
||||||
|
hasRetained = hasRetained || responseData.items_retained;
|
||||||
|
}
|
||||||
|
if ( responseData.messages ) {
|
||||||
|
messages = messages.concat( responseData.messages );
|
||||||
|
}
|
||||||
|
if ( ! responseData.done ) {
|
||||||
|
setTimeout( doNextErasure( eraserIndex, pageIndex + 1 ) );
|
||||||
|
} else {
|
||||||
|
if ( eraserIndex < erasersCount ) {
|
||||||
|
setTimeout( doNextErasure( eraserIndex + 1, 1 ) );
|
||||||
|
} else {
|
||||||
|
onErasureDoneSuccess();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).fail( function() {
|
||||||
|
onErasureFailure();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// And now, let's begin
|
||||||
|
setActionState( $action, 'remove-personal-data-processing' );
|
||||||
|
|
||||||
|
doNextErasure( 1, 1 );
|
||||||
|
});
|
||||||
|
|
||||||
|
// Privacy policy page, copy button.
|
||||||
|
$( document ).on( 'click', function( event ) {
|
||||||
|
var $target = $( event.target );
|
||||||
|
var $parent, $container, range;
|
||||||
|
|
||||||
|
if ( $target.is( 'button.privacy-text-copy' ) ) {
|
||||||
|
$parent = $target.parent().parent();
|
||||||
|
$container = $parent.find( 'div.wp-suggested-text' );
|
||||||
|
|
||||||
|
if ( ! $container.length ) {
|
||||||
|
$container = $parent.find( 'div.policy-text' );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $container.length ) {
|
||||||
|
try {
|
||||||
|
window.getSelection().removeAllRanges();
|
||||||
|
range = document.createRange();
|
||||||
|
$container.addClass( 'hide-privacy-policy-tutorial' );
|
||||||
|
|
||||||
|
range.selectNodeContents( $container[0] );
|
||||||
|
window.getSelection().addRange( range );
|
||||||
|
document.execCommand( 'copy' );
|
||||||
|
|
||||||
|
$container.removeClass( 'hide-privacy-policy-tutorial' );
|
||||||
|
window.getSelection().removeAllRanges();
|
||||||
|
} catch ( er ) {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
jQuery(document).ready(function(a){function b(a,b){a.children().hide(),a.children("."+b).show()}function c(a){a.removeClass("has-request-results"),a.next().hasClass("request-results")&&a.next().remove()}function d(b,d,e,f){var g="",h="request-results";c(b),f.length&&(a.each(f,function(a,b){g=g+"<li>"+b+"</li>"}),g="<ul>"+g+"</ul>"),b.addClass("has-request-results"),b.hasClass("status-request-confirmed")&&(h+=" status-request-confirmed"),b.hasClass("status-request-failed")&&(h+=" status-request-failed"),b.after(function(){return'<tr class="'+h+'"><th colspan="5"><div class="notice inline notice-alt '+d+'"><p>'+e+"</p>"+g+"</div></td></tr>"})}var e=window.privacyToolsL10n||{};a(".export-personal-data-handle").click(function(f){function g(a){b(k,"export-personal-data-success"),"undefined"!=typeof a?window.location=a:p||h(e.noExportFile)}function h(a){b(k,"export-personal-data-failed"),a&&d(l,"notice-error",e.exportError,[a])}function i(b,c){a.ajax({url:window.ajaxurl,data:{action:"wp-privacy-export-personal-data",exporter:b,id:m,page:c,security:n,sendAsEmail:p},method:"post"}).done(function(a){var d=a.data;return a.success?void(d.done?b<o?setTimeout(i(b+1,1)):g(d.url):setTimeout(i(b,c+1))):void h(a.data)}).fail(function(a,b,c){h(c)})}var j=a(this),k=j.parents(".export-personal-data"),l=j.parents("tr"),m=k.data("request-id"),n=k.data("nonce"),o=k.data("exporters-count"),p=!!k.data("send-as-email");f.preventDefault(),f.stopPropagation(),k.blur(),c(l),b(k,"export-personal-data-processing"),i(1,1)}),a(".remove-personal-data-handle").click(function(f){function g(){var a=e.noDataFound,c="notice-success";b(k,"remove-personal-data-idle"),!1===p?!1===q?a=e.noDataFound:(a=e.noneRemoved,c="notice-warning"):!1===q?a=e.foundAndRemoved:(a=e.someNotRemoved,c="notice-warning"),d(l,"notice-success",a,r)}function h(){b(k,"remove-personal-data-failed"),d(l,"notice-error",e.removalError,[])}function i(b,c){a.ajax({url:window.ajaxurl,data:{action:"wp-privacy-erase-personal-data",eraser:b,id:m,page:c,security:n},method:"post"}).done(function(a){var d=a.data;return a.success?(d.items_removed&&(p=p||d.items_removed),d.items_retained&&(q=q||d.items_retained),d.messages&&(r=r.concat(d.messages)),void(d.done?b<o?setTimeout(i(b+1,1)):g():setTimeout(i(b,c+1)))):void h()}).fail(function(){h()})}var j=a(this),k=j.parents(".remove-personal-data"),l=j.parents("tr"),m=k.data("request-id"),n=k.data("nonce"),o=k.data("erasers-count"),p=!1,q=!1,r=[];f.stopPropagation(),k.blur(),c(l),b(k,"remove-personal-data-processing"),i(1,1)}),a(document).on("click",function(b){var c,d,e,f=a(b.target);if(f.is("button.privacy-text-copy")&&(c=f.parent().parent(),d=c.find("div.wp-suggested-text"),d.length||(d=c.find("div.policy-text")),d.length))try{window.getSelection().removeAllRanges(),e=document.createRange(),d.addClass("hide-privacy-policy-tutorial"),e.selectNodeContents(d[0]),window.getSelection().addRange(e),document.execCommand("copy"),d.removeClass("hide-privacy-policy-tutorial"),window.getSelection().removeAllRanges()}catch(g){}})});
|
|
@ -21,259 +21,3 @@ jQuery( document ).ready(function( $ ) {
|
||||||
$( '#link_rel' ).val( ( isMe ) ? 'me' : inputs.substr( 0,inputs.length - 1 ) );
|
$( '#link_rel' ).val( ( isMe ) ? 'me' : inputs.substr( 0,inputs.length - 1 ) );
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// Privacy request action handling
|
|
||||||
jQuery( document ).ready( function( $ ) {
|
|
||||||
var strings = window.privacyToolsL10n || {};
|
|
||||||
|
|
||||||
function setActionState( $action, state ) {
|
|
||||||
$action.children().hide();
|
|
||||||
$action.children( '.' + state ).show();
|
|
||||||
}
|
|
||||||
|
|
||||||
function clearResultsAfterRow( $requestRow ) {
|
|
||||||
$requestRow.removeClass( 'has-request-results' );
|
|
||||||
|
|
||||||
if ( $requestRow.next().hasClass( 'request-results' ) ) {
|
|
||||||
$requestRow.next().remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function appendResultsAfterRow( $requestRow, classes, summaryMessage, additionalMessages ) {
|
|
||||||
var itemList = '',
|
|
||||||
resultRowClasses = 'request-results';
|
|
||||||
|
|
||||||
clearResultsAfterRow( $requestRow );
|
|
||||||
|
|
||||||
if ( additionalMessages.length ) {
|
|
||||||
$.each( additionalMessages, function( index, value ) {
|
|
||||||
itemList = itemList + '<li>' + value + '</li>';
|
|
||||||
});
|
|
||||||
itemList = '<ul>' + itemList + '</ul>';
|
|
||||||
}
|
|
||||||
|
|
||||||
$requestRow.addClass( 'has-request-results' );
|
|
||||||
|
|
||||||
if ( $requestRow.hasClass( 'status-request-confirmed' ) ) {
|
|
||||||
resultRowClasses = resultRowClasses + ' status-request-confirmed';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( $requestRow.hasClass( 'status-request-failed' ) ) {
|
|
||||||
resultRowClasses = resultRowClasses + ' status-request-failed';
|
|
||||||
}
|
|
||||||
|
|
||||||
$requestRow.after( function() {
|
|
||||||
return '<tr class="' + resultRowClasses + '"><th colspan="5">' +
|
|
||||||
'<div class="notice inline notice-alt ' + classes + '">' +
|
|
||||||
'<p>' + summaryMessage + '</p>' +
|
|
||||||
itemList +
|
|
||||||
'</div>' +
|
|
||||||
'</td>' +
|
|
||||||
'</tr>';
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
$( '.export-personal-data-handle' ).click( function( event ) {
|
|
||||||
|
|
||||||
var $this = $( this ),
|
|
||||||
$action = $this.parents( '.export-personal-data' ),
|
|
||||||
$requestRow = $this.parents( 'tr' ),
|
|
||||||
requestID = $action.data( 'request-id' ),
|
|
||||||
nonce = $action.data( 'nonce' ),
|
|
||||||
exportersCount = $action.data( 'exporters-count' ),
|
|
||||||
sendAsEmail = $action.data( 'send-as-email' ) ? true : false;
|
|
||||||
|
|
||||||
event.preventDefault();
|
|
||||||
event.stopPropagation();
|
|
||||||
|
|
||||||
$action.blur();
|
|
||||||
clearResultsAfterRow( $requestRow );
|
|
||||||
|
|
||||||
function onExportDoneSuccess( zipUrl ) {
|
|
||||||
setActionState( $action, 'export-personal-data-success' );
|
|
||||||
if ( 'undefined' !== typeof zipUrl ) {
|
|
||||||
window.location = zipUrl;
|
|
||||||
} else if ( ! sendAsEmail ) {
|
|
||||||
onExportFailure( strings.noExportFile );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function onExportFailure( errorMessage ) {
|
|
||||||
setActionState( $action, 'export-personal-data-failed' );
|
|
||||||
if ( errorMessage ) {
|
|
||||||
appendResultsAfterRow( $requestRow, 'notice-error', strings.exportError, [ errorMessage ] );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function doNextExport( exporterIndex, pageIndex ) {
|
|
||||||
$.ajax(
|
|
||||||
{
|
|
||||||
url: window.ajaxurl,
|
|
||||||
data: {
|
|
||||||
action: 'wp-privacy-export-personal-data',
|
|
||||||
exporter: exporterIndex,
|
|
||||||
id: requestID,
|
|
||||||
page: pageIndex,
|
|
||||||
security: nonce,
|
|
||||||
sendAsEmail: sendAsEmail
|
|
||||||
},
|
|
||||||
method: 'post'
|
|
||||||
}
|
|
||||||
).done( function( response ) {
|
|
||||||
var responseData = response.data;
|
|
||||||
|
|
||||||
if ( ! response.success ) {
|
|
||||||
|
|
||||||
// e.g. invalid request ID
|
|
||||||
onExportFailure( response.data );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( ! responseData.done ) {
|
|
||||||
setTimeout( doNextExport( exporterIndex, pageIndex + 1 ) );
|
|
||||||
} else {
|
|
||||||
if ( exporterIndex < exportersCount ) {
|
|
||||||
setTimeout( doNextExport( exporterIndex + 1, 1 ) );
|
|
||||||
} else {
|
|
||||||
onExportDoneSuccess( responseData.url );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}).fail( function( jqxhr, textStatus, error ) {
|
|
||||||
|
|
||||||
// e.g. Nonce failure
|
|
||||||
onExportFailure( error );
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// And now, let's begin
|
|
||||||
setActionState( $action, 'export-personal-data-processing' );
|
|
||||||
doNextExport( 1, 1 );
|
|
||||||
});
|
|
||||||
|
|
||||||
$( '.remove-personal-data-handle' ).click( function( event ) {
|
|
||||||
|
|
||||||
var $this = $( this ),
|
|
||||||
$action = $this.parents( '.remove-personal-data' ),
|
|
||||||
$requestRow = $this.parents( 'tr' ),
|
|
||||||
requestID = $action.data( 'request-id' ),
|
|
||||||
nonce = $action.data( 'nonce' ),
|
|
||||||
erasersCount = $action.data( 'erasers-count' ),
|
|
||||||
hasRemoved = false,
|
|
||||||
hasRetained = false,
|
|
||||||
messages = [];
|
|
||||||
|
|
||||||
event.stopPropagation();
|
|
||||||
|
|
||||||
$action.blur();
|
|
||||||
clearResultsAfterRow( $requestRow );
|
|
||||||
|
|
||||||
function onErasureDoneSuccess() {
|
|
||||||
var summaryMessage = strings.noDataFound;
|
|
||||||
var classes = 'notice-success';
|
|
||||||
|
|
||||||
setActionState( $action, 'remove-personal-data-idle' );
|
|
||||||
|
|
||||||
if ( false === hasRemoved ) {
|
|
||||||
if ( false === hasRetained ) {
|
|
||||||
summaryMessage = strings.noDataFound;
|
|
||||||
} else {
|
|
||||||
summaryMessage = strings.noneRemoved;
|
|
||||||
classes = 'notice-warning';
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if ( false === hasRetained ) {
|
|
||||||
summaryMessage = strings.foundAndRemoved;
|
|
||||||
} else {
|
|
||||||
summaryMessage = strings.someNotRemoved;
|
|
||||||
classes = 'notice-warning';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
appendResultsAfterRow( $requestRow, 'notice-success', summaryMessage, messages );
|
|
||||||
}
|
|
||||||
|
|
||||||
function onErasureFailure() {
|
|
||||||
setActionState( $action, 'remove-personal-data-failed' );
|
|
||||||
appendResultsAfterRow( $requestRow, 'notice-error', strings.removalError, [] );
|
|
||||||
}
|
|
||||||
|
|
||||||
function doNextErasure( eraserIndex, pageIndex ) {
|
|
||||||
$.ajax({
|
|
||||||
url: window.ajaxurl,
|
|
||||||
data: {
|
|
||||||
action: 'wp-privacy-erase-personal-data',
|
|
||||||
eraser: eraserIndex,
|
|
||||||
id: requestID,
|
|
||||||
page: pageIndex,
|
|
||||||
security: nonce
|
|
||||||
},
|
|
||||||
method: 'post'
|
|
||||||
}).done( function( response ) {
|
|
||||||
var responseData = response.data;
|
|
||||||
|
|
||||||
if ( ! response.success ) {
|
|
||||||
onErasureFailure();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if ( responseData.items_removed ) {
|
|
||||||
hasRemoved = hasRemoved || responseData.items_removed;
|
|
||||||
}
|
|
||||||
if ( responseData.items_retained ) {
|
|
||||||
hasRetained = hasRetained || responseData.items_retained;
|
|
||||||
}
|
|
||||||
if ( responseData.messages ) {
|
|
||||||
messages = messages.concat( responseData.messages );
|
|
||||||
}
|
|
||||||
if ( ! responseData.done ) {
|
|
||||||
setTimeout( doNextErasure( eraserIndex, pageIndex + 1 ) );
|
|
||||||
} else {
|
|
||||||
if ( eraserIndex < erasersCount ) {
|
|
||||||
setTimeout( doNextErasure( eraserIndex + 1, 1 ) );
|
|
||||||
} else {
|
|
||||||
onErasureDoneSuccess();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}).fail( function() {
|
|
||||||
onErasureFailure();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// And now, let's begin
|
|
||||||
setActionState( $action, 'remove-personal-data-processing' );
|
|
||||||
|
|
||||||
doNextErasure( 1, 1 );
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
( function( $ ) {
|
|
||||||
|
|
||||||
// Privacy policy page, copy button.
|
|
||||||
$( document ).on( 'click', function( event ) {
|
|
||||||
var $target = $( event.target );
|
|
||||||
var $parent, $container, range;
|
|
||||||
|
|
||||||
if ( $target.is( 'button.privacy-text-copy' ) ) {
|
|
||||||
$parent = $target.parent().parent();
|
|
||||||
$container = $parent.find( 'div.wp-suggested-text' );
|
|
||||||
|
|
||||||
if ( ! $container.length ) {
|
|
||||||
$container = $parent.find( 'div.policy-text' );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( $container.length ) {
|
|
||||||
try {
|
|
||||||
window.getSelection().removeAllRanges();
|
|
||||||
range = document.createRange();
|
|
||||||
$container.addClass( 'hide-privacy-policy-tutorial' );
|
|
||||||
|
|
||||||
range.selectNodeContents( $container[0] );
|
|
||||||
window.getSelection().addRange( range );
|
|
||||||
document.execCommand( 'copy' );
|
|
||||||
|
|
||||||
$container.removeClass( 'hide-privacy-policy-tutorial' );
|
|
||||||
window.getSelection().removeAllRanges();
|
|
||||||
} catch ( er ) {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
} ( jQuery ) );
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
jQuery(document).ready(function(a){a("#link_rel").prop("readonly",!0),a("#linkxfndiv input").bind("click keyup",function(){var b=a("#me").is(":checked"),c="";a("input.valinp").each(function(){b?a(this).prop("disabled",!0).parent().addClass("disabled"):(a(this).removeAttr("disabled").parent().removeClass("disabled"),a(this).is(":checked")&&""!==a(this).val()&&(c+=a(this).val()+" "))}),a("#link_rel").val(b?"me":c.substr(0,c.length-1))})}),jQuery(document).ready(function(a){function b(a,b){a.children().hide(),a.children("."+b).show()}function c(a){a.removeClass("has-request-results"),a.next().hasClass("request-results")&&a.next().remove()}function d(b,d,e,f){var g="",h="request-results";c(b),f.length&&(a.each(f,function(a,b){g=g+"<li>"+b+"</li>"}),g="<ul>"+g+"</ul>"),b.addClass("has-request-results"),b.hasClass("status-request-confirmed")&&(h+=" status-request-confirmed"),b.hasClass("status-request-failed")&&(h+=" status-request-failed"),b.after(function(){return'<tr class="'+h+'"><th colspan="5"><div class="notice inline notice-alt '+d+'"><p>'+e+"</p>"+g+"</div></td></tr>"})}var e=window.privacyToolsL10n||{};a(".export-personal-data-handle").click(function(f){function g(a){b(k,"export-personal-data-success"),"undefined"!=typeof a?window.location=a:p||h(e.noExportFile)}function h(a){b(k,"export-personal-data-failed"),a&&d(l,"notice-error",e.exportError,[a])}function i(b,c){a.ajax({url:window.ajaxurl,data:{action:"wp-privacy-export-personal-data",exporter:b,id:m,page:c,security:n,sendAsEmail:p},method:"post"}).done(function(a){var d=a.data;return a.success?void(d.done?b<o?setTimeout(i(b+1,1)):g(d.url):setTimeout(i(b,c+1))):void h(a.data)}).fail(function(a,b,c){h(c)})}var j=a(this),k=j.parents(".export-personal-data"),l=j.parents("tr"),m=k.data("request-id"),n=k.data("nonce"),o=k.data("exporters-count"),p=!!k.data("send-as-email");f.preventDefault(),f.stopPropagation(),k.blur(),c(l),b(k,"export-personal-data-processing"),i(1,1)}),a(".remove-personal-data-handle").click(function(f){function g(){var a=e.noDataFound,c="notice-success";b(k,"remove-personal-data-idle"),!1===p?!1===q?a=e.noDataFound:(a=e.noneRemoved,c="notice-warning"):!1===q?a=e.foundAndRemoved:(a=e.someNotRemoved,c="notice-warning"),d(l,"notice-success",a,r)}function h(){b(k,"remove-personal-data-failed"),d(l,"notice-error",e.removalError,[])}function i(b,c){a.ajax({url:window.ajaxurl,data:{action:"wp-privacy-erase-personal-data",eraser:b,id:m,page:c,security:n},method:"post"}).done(function(a){var d=a.data;return a.success?(d.items_removed&&(p=p||d.items_removed),d.items_retained&&(q=q||d.items_retained),d.messages&&(r=r.concat(d.messages)),void(d.done?b<o?setTimeout(i(b+1,1)):g():setTimeout(i(b,c+1)))):void h()}).fail(function(){h()})}var j=a(this),k=j.parents(".remove-personal-data"),l=j.parents("tr"),m=k.data("request-id"),n=k.data("nonce"),o=k.data("erasers-count"),p=!1,q=!1,r=[];f.stopPropagation(),k.blur(),c(l),b(k,"remove-personal-data-processing"),i(1,1)})}),function(a){a(document).on("click",function(b){var c,d,e,f=a(b.target);if(f.is("button.privacy-text-copy")&&(c=f.parent().parent(),d=c.find("div.wp-suggested-text"),d.length||(d=c.find("div.policy-text")),d.length))try{window.getSelection().removeAllRanges(),e=document.createRange(),d.addClass("hide-privacy-policy-tutorial"),e.selectNodeContents(d[0]),window.getSelection().addRange(e),document.execCommand("copy"),d.removeClass("hide-privacy-policy-tutorial"),window.getSelection().removeAllRanges()}catch(g){}})}(jQuery);
|
jQuery(document).ready(function(a){a("#link_rel").prop("readonly",!0),a("#linkxfndiv input").bind("click keyup",function(){var b=a("#me").is(":checked"),c="";a("input.valinp").each(function(){b?a(this).prop("disabled",!0).parent().addClass("disabled"):(a(this).removeAttr("disabled").parent().removeClass("disabled"),a(this).is(":checked")&&""!==a(this).val()&&(c+=a(this).val()+" "))}),a("#link_rel").val(b?"me":c.substr(0,c.length-1))})});
|
|
@ -264,8 +264,10 @@ $menu[75] = array( __( 'Tools' ), 'edit_posts', 'tools.php',
|
||||||
$submenu['tools.php'][10] = array( __( 'Import' ), 'import', 'import.php' );
|
$submenu['tools.php'][10] = array( __( 'Import' ), 'import', 'import.php' );
|
||||||
$submenu['tools.php'][15] = array( __( 'Export' ), 'export', 'export.php' );
|
$submenu['tools.php'][15] = array( __( 'Export' ), 'export', 'export.php' );
|
||||||
$submenu['tools.php'][20] = array( __( 'Site Health' ), 'install_plugins', 'site-health.php' );
|
$submenu['tools.php'][20] = array( __( 'Site Health' ), 'install_plugins', 'site-health.php' );
|
||||||
|
$submenu['tools.php'][25] = array( __( 'Export Personal Data' ), 'export_others_personal_data', 'export-personal-data.php' );
|
||||||
|
$submenu['tools.php'][30] = array( __( 'Erase Personal Data' ), 'erase_others_personal_data', 'erase-personal-data.php' );
|
||||||
if ( is_multisite() && ! is_main_site() ) {
|
if ( is_multisite() && ! is_main_site() ) {
|
||||||
$submenu['tools.php'][25] = array( __( 'Delete Site' ), 'delete_site', 'ms-delete-site.php' );
|
$submenu['tools.php'][35] = array( __( 'Delete Site' ), 'delete_site', 'ms-delete-site.php' );
|
||||||
}
|
}
|
||||||
if ( ! is_multisite() && defined( 'WP_ALLOW_MULTISITE' ) && WP_ALLOW_MULTISITE ) {
|
if ( ! is_multisite() && defined( 'WP_ALLOW_MULTISITE' ) && WP_ALLOW_MULTISITE ) {
|
||||||
$submenu['tools.php'][50] = array( __( 'Network Setup' ), 'setup_network', 'network.php' );
|
$submenu['tools.php'][50] = array( __( 'Network Setup' ), 'setup_network', 'network.php' );
|
||||||
|
@ -278,7 +280,7 @@ $menu[80] = array( __( 'Settings' ), 'manage_optio
|
||||||
$submenu['options-general.php'][25] = array( __( 'Discussion' ), 'manage_options', 'options-discussion.php' );
|
$submenu['options-general.php'][25] = array( __( 'Discussion' ), 'manage_options', 'options-discussion.php' );
|
||||||
$submenu['options-general.php'][30] = array( __( 'Media' ), 'manage_options', 'options-media.php' );
|
$submenu['options-general.php'][30] = array( __( 'Media' ), 'manage_options', 'options-media.php' );
|
||||||
$submenu['options-general.php'][40] = array( __( 'Permalinks' ), 'manage_options', 'options-permalink.php' );
|
$submenu['options-general.php'][40] = array( __( 'Permalinks' ), 'manage_options', 'options-permalink.php' );
|
||||||
$submenu['options-general.php'][45] = array( __( 'Privacy' ), 'manage_privacy_options', 'privacy.php' );
|
$submenu['options-general.php'][45] = array( __( 'Privacy' ), 'manage_privacy_options', 'options-privacy.php' );
|
||||||
|
|
||||||
$_wp_last_utility_menu = 80; // The index of the last top-level menu in the utility menu group
|
$_wp_last_utility_menu = 80; // The index of the last top-level menu in the utility menu group
|
||||||
|
|
||||||
|
|
|
@ -45,16 +45,11 @@ if ( ! empty( $action ) ) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
add_settings_error(
|
add_settings_error( 'page_for_privacy_policy', 'page_for_privacy_policy', $privacy_page_updated_message, 'updated' );
|
||||||
'page_for_privacy_policy',
|
|
||||||
'page_for_privacy_policy',
|
|
||||||
$privacy_page_updated_message,
|
|
||||||
'updated'
|
|
||||||
);
|
|
||||||
} elseif ( 'create-privacy-page' === $action ) {
|
} elseif ( 'create-privacy-page' === $action ) {
|
||||||
|
|
||||||
if ( ! class_exists( 'WP_Privacy_Policy_Content' ) ) {
|
if ( ! class_exists( 'WP_Privacy_Policy_Content' ) ) {
|
||||||
require_once( ABSPATH . 'wp-admin/includes/misc.php' );
|
require_once( ABSPATH . 'wp-admin/includes/class-wp-privacy-policy-content.php' );
|
||||||
}
|
}
|
||||||
|
|
||||||
$privacy_policy_page_content = WP_Privacy_Policy_Content::get_default_content();
|
$privacy_policy_page_content = WP_Privacy_Policy_Content::get_default_content();
|
||||||
|
@ -182,7 +177,7 @@ require_once( ABSPATH . 'wp-admin/admin-header.php' );
|
||||||
printf(
|
printf(
|
||||||
/* translators: 1: Privacy Policy guide URL, 2: additional link attributes, 3: accessibility text */
|
/* translators: 1: Privacy Policy guide URL, 2: additional link attributes, 3: accessibility text */
|
||||||
__( 'Need help putting together your new Privacy Policy page? <a href="%1$s" %2$s>Check out our guide%3$s</a> for recommendations on what content to include, along with policies suggested by your plugins and theme.' ),
|
__( 'Need help putting together your new Privacy Policy page? <a href="%1$s" %2$s>Check out our guide%3$s</a> for recommendations on what content to include, along with policies suggested by your plugins and theme.' ),
|
||||||
esc_url( admin_url( 'tools.php?wp-privacy-policy-guide=1' ) ),
|
esc_url( admin_url( 'privacy-policy-guide.php' ) ),
|
||||||
'',
|
'',
|
||||||
''
|
''
|
||||||
);
|
);
|
||||||
|
@ -193,17 +188,20 @@ require_once( ABSPATH . 'wp-admin/admin-header.php' );
|
||||||
<hr>
|
<hr>
|
||||||
<table class="form-table tools-privacy-policy-page" role="presentation">
|
<table class="form-table tools-privacy-policy-page" role="presentation">
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row"><label for="page_for_privacy_policy">
|
<th scope="row">
|
||||||
<?php
|
<label for="page_for_privacy_policy">
|
||||||
if ( $privacy_policy_page_exists ) {
|
<?php
|
||||||
_e( 'Change your Privacy Policy page' );
|
if ( $privacy_policy_page_exists ) {
|
||||||
} else {
|
_e( 'Change your Privacy Policy page' );
|
||||||
_e( 'Select a Privacy Policy page' );
|
} else {
|
||||||
}
|
_e( 'Select a Privacy Policy page' );
|
||||||
?>
|
}
|
||||||
</label></th>
|
?>
|
||||||
|
</label>
|
||||||
|
</th>
|
||||||
<td>
|
<td>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$has_pages = (bool) get_posts(
|
$has_pages = (bool) get_posts(
|
||||||
array(
|
array(
|
||||||
'post_type' => 'page',
|
'post_type' => 'page',
|
||||||
|
@ -220,6 +218,7 @@ require_once( ABSPATH . 'wp-admin/admin-header.php' );
|
||||||
<form method="post" action="">
|
<form method="post" action="">
|
||||||
<input type="hidden" name="action" value="set-privacy-page" />
|
<input type="hidden" name="action" value="set-privacy-page" />
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
wp_dropdown_pages(
|
wp_dropdown_pages(
|
||||||
array(
|
array(
|
||||||
'name' => 'page_for_privacy_policy',
|
'name' => 'page_for_privacy_policy',
|
|
@ -0,0 +1,36 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Privacy Policy Guide Screen.
|
||||||
|
*
|
||||||
|
* @package WordPress
|
||||||
|
* @subpackage Administration
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** WordPress Administration Bootstrap */
|
||||||
|
require_once( dirname( __FILE__ ) . '/admin.php' );
|
||||||
|
|
||||||
|
if ( ! current_user_can( 'manage_privacy_options' ) ) {
|
||||||
|
wp_die( __( 'Sorry, you are not allowed to manage privacy on this site.' ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! class_exists( 'WP_Privacy_Policy_Content' ) ) {
|
||||||
|
include_once( ABSPATH . 'wp-admin/includes/class-wp-privacy-policy-content.php' );
|
||||||
|
}
|
||||||
|
|
||||||
|
$title = __( 'Privacy Policy Guide' );
|
||||||
|
|
||||||
|
wp_enqueue_script( 'privacy-tools' );
|
||||||
|
|
||||||
|
require_once( ABSPATH . 'wp-admin/admin-header.php' );
|
||||||
|
|
||||||
|
?>
|
||||||
|
<div class="wrap">
|
||||||
|
<h1><?php echo esc_html( $title ); ?></h1>
|
||||||
|
|
||||||
|
<div class="wp-privacy-policy-guide">
|
||||||
|
<?php WP_Privacy_Policy_Content::privacy_policy_guide(); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
include( ABSPATH . 'wp-admin/admin-footer.php' );
|
|
@ -6,37 +6,53 @@
|
||||||
* @subpackage Administration
|
* @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 */
|
/** WordPress Administration Bootstrap */
|
||||||
require_once( dirname( __FILE__ ) . '/admin.php' );
|
require_once( dirname( __FILE__ ) . '/admin.php' );
|
||||||
|
|
||||||
$is_privacy_guide = ( isset( $_GET['wp-privacy-policy-guide'] ) && current_user_can( 'manage_privacy_options' ) );
|
// 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'] ) ) {
|
||||||
if ( $is_privacy_guide ) {
|
wp_redirect( admin_url( 'privacy-policy-guide.php' ), 301 );
|
||||||
$title = __( 'Privacy Policy Guide' );
|
exit;
|
||||||
|
} elseif ( isset( $_GET['page'] ) ) {
|
||||||
// "Borrow" xfn.js for now so we don't have to create new files.
|
// These were also moved to files in WP 5.3.
|
||||||
wp_enqueue_script( 'xfn' );
|
if ( $_GET['page'] === 'export_personal_data' ) {
|
||||||
|
wp_redirect( admin_url( 'export-personal-data.php' ), 301 );
|
||||||
} else {
|
exit;
|
||||||
|
} elseif ( $_GET['page'] === 'remove_personal_data' ) {
|
||||||
$title = __( 'Tools' );
|
wp_redirect( admin_url( 'erase-personal-data.php' ), 301 );
|
||||||
|
exit;
|
||||||
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 & 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>'
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$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 & 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' );
|
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>
|
<h1><?php echo esc_html( $title ); ?></h1>
|
||||||
<?php
|
<?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' ) ) :
|
if ( current_user_can( 'import' ) ) :
|
||||||
$cats = get_taxonomy( 'category' );
|
$cats = get_taxonomy( 'category' );
|
||||||
$tags = get_taxonomy( 'post_tag' );
|
$tags = get_taxonomy( 'post_tag' );
|
||||||
|
@ -72,8 +79,9 @@ if ( $is_privacy_guide ) {
|
||||||
* @since 2.8.0
|
* @since 2.8.0
|
||||||
*/
|
*/
|
||||||
do_action( 'tool_box' );
|
do_action( 'tool_box' );
|
||||||
}
|
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
include( ABSPATH . 'wp-admin/admin-footer.php' );
|
include( ABSPATH . 'wp-admin/admin-footer.php' );
|
||||||
|
|
|
@ -1542,19 +1542,6 @@ function wp_default_scripts( &$scripts ) {
|
||||||
);
|
);
|
||||||
|
|
||||||
$scripts->add( 'xfn', "/wp-admin/js/xfn$suffix.js", array( 'jquery' ), false, 1 );
|
$scripts->add( 'xfn', "/wp-admin/js/xfn$suffix.js", array( 'jquery' ), false, 1 );
|
||||||
did_action( 'init' ) && $scripts->localize(
|
|
||||||
'xfn',
|
|
||||||
'privacyToolsL10n',
|
|
||||||
array(
|
|
||||||
'noDataFound' => __( 'No personal data was found for this user.' ),
|
|
||||||
'foundAndRemoved' => __( 'All of the personal data found for this user was erased.' ),
|
|
||||||
'noneRemoved' => __( 'Personal data was found for this user but was not erased.' ),
|
|
||||||
'someNotRemoved' => __( 'Personal data was found for this user but some of the personal data found was not erased.' ),
|
|
||||||
'removalError' => __( 'An error occurred while attempting to find and erase personal data.' ),
|
|
||||||
'noExportFile' => __( 'No personal data export file was generated.' ),
|
|
||||||
'exportError' => __( 'An error occurred while attempting to export personal data.' ),
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
$scripts->add( 'postbox', "/wp-admin/js/postbox$suffix.js", array( 'jquery-ui-sortable' ), false, 1 );
|
$scripts->add( 'postbox', "/wp-admin/js/postbox$suffix.js", array( 'jquery-ui-sortable' ), false, 1 );
|
||||||
did_action( 'init' ) && $scripts->localize(
|
did_action( 'init' ) && $scripts->localize(
|
||||||
|
@ -1693,6 +1680,21 @@ function wp_default_scripts( &$scripts ) {
|
||||||
$scripts->add( 'site-health', "/wp-admin/js/site-health$suffix.js", array( 'clipboard', 'jquery', 'wp-util', 'wp-a11y', 'wp-i18n' ), false, 1 );
|
$scripts->add( 'site-health', "/wp-admin/js/site-health$suffix.js", array( 'clipboard', 'jquery', 'wp-util', 'wp-a11y', 'wp-i18n' ), false, 1 );
|
||||||
$scripts->set_translations( 'site-health' );
|
$scripts->set_translations( 'site-health' );
|
||||||
|
|
||||||
|
$scripts->add( 'privacy-tools', "/wp-admin/js/privacy-tools$suffix.js", array( 'jquery' ), false, 1 );
|
||||||
|
did_action( 'init' ) && $scripts->localize(
|
||||||
|
'privacy-tools',
|
||||||
|
'privacyToolsL10n',
|
||||||
|
array(
|
||||||
|
'noDataFound' => __( 'No personal data was found for this user.' ),
|
||||||
|
'foundAndRemoved' => __( 'All of the personal data found for this user was erased.' ),
|
||||||
|
'noneRemoved' => __( 'Personal data was found for this user but was not erased.' ),
|
||||||
|
'someNotRemoved' => __( 'Personal data was found for this user but some of the personal data found was not erased.' ),
|
||||||
|
'removalError' => __( 'An error occurred while attempting to find and erase personal data.' ),
|
||||||
|
'noExportFile' => __( 'No personal data export file was generated.' ),
|
||||||
|
'exportError' => __( 'An error occurred while attempting to export personal data.' ),
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
$scripts->add( 'updates', "/wp-admin/js/updates$suffix.js", array( 'jquery', 'wp-util', 'wp-a11y' ), false, 1 );
|
$scripts->add( 'updates', "/wp-admin/js/updates$suffix.js", array( 'jquery', 'wp-util', 'wp-a11y' ), false, 1 );
|
||||||
did_action( 'init' ) && $scripts->localize(
|
did_action( 'init' ) && $scripts->localize(
|
||||||
'updates',
|
'updates',
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.3-alpha-45447';
|
$wp_version = '5.3-alpha-45448';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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