Make WordPress Core


Ignore:
Timestamp:
05/02/2018 12:11:50 AM (7 years ago)
Author:
SergeyBiryukov
Message:

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.

Location:
branches/4.9
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.9

  • branches/4.9/src/wp-includes/comment.php

    r43076 r43077  
    31483148
    31493149/**
    3150  * Registers the personal data exporter for comments
    3151  *
    3152  * @param array   $exporters   An array of personal data exporters.
    3153  * @return array  An array of personal data exporters.
     3150 * Registers the personal data exporter for comments.
     3151 *
     3152 * @since 4.9.6
     3153 *
     3154 * @param  array $exporters An array of personal data exporters.
     3155 * @return array $exporters An array of personal data exporters.
    31543156 */
    31553157function wp_register_comment_personal_data_exporter( $exporters ) {
     
    31653167 * Finds and exports personal data associated with an email address from the comments table.
    31663168 *
    3167  * @param string  $email_address The comment author email address.
    3168  * @param int     $page          Comment page.
    3169  * @return array  An array of personal data.
     3169 * @since 4.9.6
     3170 *
     3171 * @param  string $email_address The comment author email address.
     3172 * @param  int    $page          Comment page.
     3173 * @return array  $return        An array of personal data.
    31703174 */
    31713175function wp_comments_personal_data_exporter( $email_address, $page = 1 ) {
    31723176
    3173     // Technically, strtolower isn't necessary since get_comments will match email insensitive
    3174     // But it is a good example for plugin developers whose targets might not be as generous
    3175     $email_address = trim( strtolower( $email_address ) );
    3176 
    3177     // Limit us to 500 comments at a time to avoid timing out
     3177    // Limit us to 500 comments at a time to avoid timing out.
    31783178    $number = 500;
    3179     $page = (int) $page;
     3179    $page   = (int) $page;
    31803180
    31813181    $data_to_export = array();
     
    32083208            $value = '';
    32093209
    3210             switch( $key ) {
     3210            switch ( $key ) {
    32113211                case 'comment_author':
    32123212                case 'comment_author_email':
     
    32283228
    32293229            if ( ! empty( $value ) ) {
    3230                 $comment_data_to_export[] = array( 'name' => $name, 'value' => $value );
     3230                $comment_data_to_export[] = array(
     3231                    'name'  => $name,
     3232                    'value' => $value,
     3233                );
    32313234            }
    32323235        }
Note: See TracChangeset for help on using the changeset viewer.