WordPress.org

Make WordPress Core


Ignore:
Timestamp:
05/03/2018 07:27:14 PM (2 years ago)
Author:
iandunn
Message:

Privacy: Store plugin callbacks in associative array for flexibility.

The personal data export and erasure tools allow plugins to register their own callbacks, in order to add additional data to the export and erasure processes. Previously, these were registered without specifying a constant identifier in the array of callbacks. Using mutable integers makes it difficult for plugins to modify the callbacks of other plugins, though.

Using associative array keys instead provides a covenient and reliable way to identify and interact with another plugin's callbacks.

Props desrosj, allendav, ocean90.
Fixes #43931.

File:
1 edited

Legend:

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

    r43061 r43154  
    32863286 */
    32873287function wp_register_comment_personal_data_exporter( $exporters ) {
    3288     $exporters[] = array(
     3288    $exporters['wordpress-comments'] = array(
    32893289        'exporter_friendly_name' => __( 'WordPress Comments' ),
    32903290        'callback'               => 'wp_comments_personal_data_exporter',
     
    33913391 */
    33923392function wp_register_comment_personal_data_eraser( $erasers ) {
    3393     $erasers[] = array(
     3393    $erasers['wordpress-comments'] = array(
    33943394        'eraser_friendly_name' => __( 'WordPress Comments' ),
    33953395        'callback'             => 'wp_comments_personal_data_eraser',
     
    34993499    );
    35003500}
    3501 
Note: See TracChangeset for help on using the changeset viewer.