Make WordPress Core


Ignore:
Timestamp:
04/18/2018 10:54:23 PM (7 years ago)
Author:
azaozz
Message:

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

Props birgire.
See #43440.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/comment.php

    r42888 r42987  
    32773277
    32783278/**
    3279  * Registers the personal data exporter for comments
    3280  *
    3281  * @param array   $exporters   An array of personal data exporters.
    3282  * @return array  An array of personal data exporters.
     3279 * Registers the personal data exporter for comments.
     3280 *
     3281 * @since 4.9.6
     3282 *
     3283 * @param  array $exporters An array of personal data exporters.
     3284 * @return array $exporters An array of personal data exporters.
    32833285 */
    32843286function wp_register_comment_personal_data_exporter( $exporters ) {
     
    32943296 * Finds and exports personal data associated with an email address from the comments table.
    32953297 *
    3296  * @param string  $email_address The comment author email address.
    3297  * @param int     $page          Comment page.
    3298  * @return array  An array of personal data.
     3298 * @since 4.9.6
     3299 *
     3300 * @param  string $email_address The comment author email address.
     3301 * @param  int    $page          Comment page.
     3302 * @return array  $return        An array of personal data.
    32993303 */
    33003304function wp_comments_personal_data_exporter( $email_address, $page = 1 ) {
    33013305
    3302     // Technically, strtolower isn't necessary since get_comments will match email insensitive
    3303     // But it is a good example for plugin developers whose targets might not be as generous
    3304     $email_address = trim( strtolower( $email_address ) );
    3305 
    3306     // Limit us to 500 comments at a time to avoid timing out
     3306    // Limit us to 500 comments at a time to avoid timing out.
    33073307    $number = 500;
    3308     $page = (int) $page;
     3308    $page   = (int) $page;
    33093309
    33103310    $data_to_export = array();
     
    33373337            $value = '';
    33383338
    3339             switch( $key ) {
     3339            switch ( $key ) {
    33403340                case 'comment_author':
    33413341                case 'comment_author_email':
     
    33573357
    33583358            if ( ! empty( $value ) ) {
    3359                 $comment_data_to_export[] = array( 'name' => $name, 'value' => $value );
     3359                $comment_data_to_export[] = array(
     3360                    'name'  => $name,
     3361                    'value' => $value,
     3362                );
    33603363            }
    33613364        }
Note: See TracChangeset for help on using the changeset viewer.