Make WordPress Core


Ignore:
Timestamp:
05/03/2018 07:37:32 PM (7 years ago)
Author:
azaozz
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.
Merges [43154] to the 4.9 branch.
Fixes #43931.

Location:
branches/4.9
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.9

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

    r43127 r43157  
    31703170 */
    31713171function wp_register_comment_personal_data_exporter( $exporters ) {
    3172     $exporters[] = array(
     3172    $exporters['wordpress-comments'] = array(
    31733173        'exporter_friendly_name' => __( 'WordPress Comments' ),
    31743174        'callback'               => 'wp_comments_personal_data_exporter',
     
    32753275 */
    32763276function wp_register_comment_personal_data_eraser( $erasers ) {
    3277     $erasers[] = array(
     3277    $erasers['wordpress-comments'] = array(
    32783278        'eraser_friendly_name' => __( 'WordPress Comments' ),
    32793279        'callback'             => 'wp_comments_personal_data_eraser',
     
    33833383    );
    33843384}
    3385 
Note: See TracChangeset for help on using the changeset viewer.