Make WordPress Core

Ticket #50434: 50434.1.patch

File 50434.1.patch, 4.3 KB (added by ayeshrajans, 4 years ago)
  • src/wp-admin/includes/plugin.php

    diff --git a/src/wp-admin/includes/plugin.php b/src/wp-admin/includes/plugin.php
    index 3492b15ee2..9344cbef2b 100644
    a b function user_can_access_admin_page() { 
    21442144 * See the {@see 'allowed_options'} filter.
    21452145 *
    21462146 * @since 2.7.0
     2147 * @since 5.5.0 `$new_whitelist_options` global variable has been renamed to `$new_allowlist_options`.
     2148 *              For compatibility with existing code, the old variable is now a reference to the new one.
     2149 *              Please consider writing more inclusive code.
    21472150 *
    2148  * @global array $new_whitelist_options
     2151 * @global array $new_allowlist_options
    21492152 *
    21502153 * @param array $options
    21512154 * @return array
    21522155 */
    21532156function option_update_filter( $options ) {
    2154         global $new_whitelist_options;
     2157        global $new_allowlist_options;
    21552158
    2156         if ( is_array( $new_whitelist_options ) ) {
    2157                 $options = add_option_allowed_list( $new_whitelist_options, $options );
     2159        if ( is_array( $new_allowlist_options ) ) {
     2160                $options = add_option_allowed_list( $new_allowlist_options, $options );
    21582161        }
    21592162
    21602163        return $options;
  • src/wp-includes/option.php

    diff --git a/src/wp-includes/option.php b/src/wp-includes/option.php
    index b1d553bf7a..e4a9f1250c 100644
    a b function register_initial_settings() { 
    20932093 *
    20942094 * @since 2.7.0
    20952095 * @since 4.7.0 `$args` can be passed to set flags on the setting, similar to `register_meta()`.
     2096 * @since 5.5.0 `$new_whitelist_options` global variable has been renamed to `$new_allowlist_options`.
     2097 *              For compatibility with existing code, the old variable is now a reference to the new one.
     2098 *              Please consider writing more inclusive code.
    20962099 *
    2097  * @global array $new_whitelist_options
     2100 * @global array $new_allowlist_options
    20982101 * @global array $wp_registered_settings
    20992102 *
    21002103 * @param string $option_group A settings group name. Should correspond to an allowed option key name.
    function register_initial_settings() { 
    21152118 * }
    21162119 */
    21172120function register_setting( $option_group, $option_name, $args = array() ) {
    2118         global $new_whitelist_options, $wp_registered_settings;
     2121        global $new_allowlist_options, $wp_registered_settings;
     2122
     2123        /**
     2124         * @deprecated `$new_whitelist_options` is renamed to `$new_allowlist_options. Please use `$new_allowlist_options`.
     2125         */
     2126        $GLOBALS['new_whitelist_options'] = &$new_allowlist_options;
    21192127
    21202128        $defaults = array(
    21212129                'type'              => 'string',
    function register_setting( $option_group, $option_name, $args = array() ) { 
    21802188                $option_group = 'reading';
    21812189        }
    21822190
    2183         $new_whitelist_options[ $option_group ][] = $option_name;
     2191        $new_allowlist_options[ $option_group ][] = $option_name;
    21842192        if ( ! empty( $args['sanitize_callback'] ) ) {
    21852193                add_filter( "sanitize_option_{$option_name}", $args['sanitize_callback'] );
    21862194        }
    function register_setting( $option_group, $option_name, $args = array() ) { 
    21972205 * @since 2.7.0
    21982206 * @since 4.7.0 `$sanitize_callback` was deprecated. The callback from `register_setting()` is now used instead.
    21992207 *
    2200  * @global array $new_whitelist_options
     2208 * @global array $new_allowlist_options
    22012209 * @global array $wp_registered_settings
    22022210 *
    22032211 * @param string   $option_group      The settings group name used during registration.
    function register_setting( $option_group, $option_name, $args = array() ) { 
    22052213 * @param callable $deprecated        Deprecated.
    22062214 */
    22072215function unregister_setting( $option_group, $option_name, $deprecated = '' ) {
    2208         global $new_whitelist_options, $wp_registered_settings;
     2216        global $new_allowlist_options, $wp_registered_settings;
     2217
     2218        /**
     2219         * @deprecated `$new_whitelist_options` is renamed to `$new_allowlist_options.
     2220         */
     2221        $GLOBALS['new_whitelist_options'] = &$new_allowlist_options;
    22092222
    22102223        if ( 'misc' === $option_group ) {
    22112224                _deprecated_argument(
    function unregister_setting( $option_group, $option_name, $deprecated = '' ) { 
    22332246                $option_group = 'reading';
    22342247        }
    22352248
    2236         $pos = array_search( $option_name, (array) $new_whitelist_options[ $option_group ], true );
     2249        $pos = array_search( $option_name, (array) $new_allowlist_options[ $option_group ], true );
    22372250        if ( false !== $pos ) {
    2238                 unset( $new_whitelist_options[ $option_group ][ $pos ] );
     2251                unset( $new_allowlist_options[ $option_group ][ $pos ] );
    22392252        }
    22402253        if ( '' !== $deprecated ) {
    22412254                _deprecated_argument(