Privacy: fix docs, formatting, white space, add tests for the personal data from comments exporter.

Props birgire.
Merges [42987] to the 4.9 branch.
See #43440.
Built from https://develop.svn.wordpress.org/branches/4.9@43077


git-svn-id: http://core.svn.wordpress.org/branches/4.9@42906 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2018-05-02 00:12:25 +00:00
parent 2f6f41170a
commit 6a3018a7c9
2 changed files with 18 additions and 15 deletions

View File

@ -3147,10 +3147,12 @@ function wp_handle_comment_submission( $comment_data ) {
}
/**
* Registers the personal data exporter for comments
* Registers the personal data exporter for comments.
*
* @param array $exporters An array of personal data exporters.
* @return array An array of personal data exporters.
* @since 4.9.6
*
* @param array $exporters An array of personal data exporters.
* @return array $exporters An array of personal data exporters.
*/
function wp_register_comment_personal_data_exporter( $exporters ) {
$exporters[] = array(
@ -3164,19 +3166,17 @@ function wp_register_comment_personal_data_exporter( $exporters ) {
/**
* Finds and exports personal data associated with an email address from the comments table.
*
* @param string $email_address The comment author email address.
* @param int $page Comment page.
* @return array An array of personal data.
* @since 4.9.6
*
* @param string $email_address The comment author email address.
* @param int $page Comment page.
* @return array $return An array of personal data.
*/
function wp_comments_personal_data_exporter( $email_address, $page = 1 ) {
// Technically, strtolower isn't necessary since get_comments will match email insensitive
// But it is a good example for plugin developers whose targets might not be as generous
$email_address = trim( strtolower( $email_address ) );
// Limit us to 500 comments at a time to avoid timing out
// Limit us to 500 comments at a time to avoid timing out.
$number = 500;
$page = (int) $page;
$page = (int) $page;
$data_to_export = array();
@ -3207,7 +3207,7 @@ function wp_comments_personal_data_exporter( $email_address, $page = 1 ) {
foreach ( $comment_prop_to_export as $key => $name ) {
$value = '';
switch( $key ) {
switch ( $key ) {
case 'comment_author':
case 'comment_author_email':
case 'comment_author_url':
@ -3227,7 +3227,10 @@ function wp_comments_personal_data_exporter( $email_address, $page = 1 ) {
}
if ( ! empty( $value ) ) {
$comment_data_to_export[] = array( 'name' => $name, 'value' => $value );
$comment_data_to_export[] = array(
'name' => $name,
'value' => $value,
);
}
}

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.9.6-alpha-43076';
$wp_version = '4.9.6-alpha-43077';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.