Changeset 48121 for trunk/src/wp-admin/includes/plugin.php
- Timestamp:
- 06/22/2020 05:24:34 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/plugin.php
r48115 r48121 2137 2137 } 2138 2138 2139 /* Whitelist functions */2140 2141 /** 2142 * Refreshes the value of the options whitelist available via the 'whitelist_options' hook.2143 * 2144 * See the {@see ' whitelist_options'} filter.2139 /* Allowed list functions */ 2140 2141 /** 2142 * Refreshes the value of the allowed options list available via the 'allowed_options' hook. 2143 * 2144 * See the {@see 'allowed_options'} filter. 2145 2145 * 2146 2146 * @since 2.7.0 … … 2155 2155 2156 2156 if ( is_array( $new_whitelist_options ) ) { 2157 $options = add_option_ whitelist( $new_whitelist_options, $options );2157 $options = add_option_allowed_list( $new_whitelist_options, $options ); 2158 2158 } 2159 2159 … … 2162 2162 2163 2163 /** 2164 * Adds an array of options to the options whitelist.2164 * Adds an array of options to the list of allowed options. 2165 2165 * 2166 2166 * @since 2.7.0 2167 2167 * 2168 * @global array $ whitelist_options2168 * @global array $allowed_options 2169 2169 * 2170 2170 * @param array $new_options … … 2172 2172 * @return array 2173 2173 */ 2174 function add_option_ whitelist( $new_options, $options = '' ) {2174 function add_option_allowed_list( $new_options, $options = '' ) { 2175 2175 if ( '' === $options ) { 2176 global $ whitelist_options;2176 global $allowed_options; 2177 2177 } else { 2178 $ whitelist_options = $options;2178 $allowed_options = $options; 2179 2179 } 2180 2180 2181 2181 foreach ( $new_options as $page => $keys ) { 2182 2182 foreach ( $keys as $key ) { 2183 if ( ! isset( $ whitelist_options[ $page ] ) || ! is_array( $whitelist_options[ $page ] ) ) {2184 $ whitelist_options[ $page ] = array();2185 $ whitelist_options[ $page ][] = $key;2183 if ( ! isset( $allowed_options[ $page ] ) || ! is_array( $allowed_options[ $page ] ) ) { 2184 $allowed_options[ $page ] = array(); 2185 $allowed_options[ $page ][] = $key; 2186 2186 } else { 2187 $pos = array_search( $key, $ whitelist_options[ $page ], true );2187 $pos = array_search( $key, $allowed_options[ $page ], true ); 2188 2188 if ( false === $pos ) { 2189 $ whitelist_options[ $page ][] = $key;2189 $allowed_options[ $page ][] = $key; 2190 2190 } 2191 2191 } … … 2193 2193 } 2194 2194 2195 return $ whitelist_options;2196 } 2197 2198 /** 2199 * Removes a list of options from the options whitelist.2200 * 2201 * @since 2.7.02202 * 2203 * @global array $ whitelist_options2195 return $allowed_options; 2196 } 2197 2198 /** 2199 * Removes a list of options from the allowed options list. 2200 * 2201 * @since 5.5.0 2202 * 2203 * @global array $allowed_options 2204 2204 * 2205 2205 * @param array $del_options … … 2207 2207 * @return array 2208 2208 */ 2209 function remove_option_ whitelist( $del_options, $options = '' ) {2209 function remove_option_allowed_list( $del_options, $options = '' ) { 2210 2210 if ( '' === $options ) { 2211 global $ whitelist_options;2211 global $allowed_options; 2212 2212 } else { 2213 $ whitelist_options = $options;2213 $allowed_options = $options; 2214 2214 } 2215 2215 2216 2216 foreach ( $del_options as $page => $keys ) { 2217 2217 foreach ( $keys as $key ) { 2218 if ( isset( $ whitelist_options[ $page ] ) && is_array( $whitelist_options[ $page ] ) ) {2219 $pos = array_search( $key, $ whitelist_options[ $page ], true );2218 if ( isset( $allowed_options[ $page ] ) && is_array( $allowed_options[ $page ] ) ) { 2219 $pos = array_search( $key, $allowed_options[ $page ], true ); 2220 2220 if ( false !== $pos ) { 2221 unset( $ whitelist_options[ $page ][ $pos ] );2221 unset( $allowed_options[ $page ][ $pos ] ); 2222 2222 } 2223 2223 } … … 2225 2225 } 2226 2226 2227 return $ whitelist_options;2227 return $allowed_options; 2228 2228 } 2229 2229
Note: See TracChangeset
for help on using the changeset viewer.