Changeset 48121 for trunk/src/wp-admin/options.php
- Timestamp:
- 06/22/2020 05:24:34 PM (6 years ago)
- File:
-
- 1 edited
-
trunk/src/wp-admin/options.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/options.php
r48115 r48121 81 81 } 82 82 83 $ whitelist_options = array(83 $allowed_options = array( 84 84 'general' => array( 85 85 'blogname', … … 101 101 'comment_moderation', 102 102 'require_name_email', 103 'comment_ whitelist',103 'comment_previously_approved', 104 104 'comment_max_links', 105 105 'moderation_keys', 106 'bl acklist_keys',106 'blocklist_keys', 107 107 'show_avatars', 108 108 'avatar_rating', … … 147 147 ), 148 148 ); 149 $ whitelist_options['misc'] = array();150 $ whitelist_options['options'] = array();151 $ whitelist_options['privacy'] = array();149 $allowed_options['misc'] = array(); 150 $allowed_options['options'] = array(); 151 $allowed_options['privacy'] = array(); 152 152 153 153 $mail_options = array( 'mailserver_url', 'mailserver_port', 'mailserver_login', 'mailserver_pass' ); 154 154 155 155 if ( ! in_array( get_option( 'blog_charset' ), array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ), true ) ) { 156 $ whitelist_options['reading'][] = 'blog_charset';156 $allowed_options['reading'][] = 'blog_charset'; 157 157 } 158 158 159 159 if ( get_site_option( 'initial_db_version' ) < 32453 ) { 160 $ whitelist_options['writing'][] = 'use_smilies';161 $ whitelist_options['writing'][] = 'use_balanceTags';160 $allowed_options['writing'][] = 'use_smilies'; 161 $allowed_options['writing'][] = 'use_balanceTags'; 162 162 } 163 163 164 164 if ( ! is_multisite() ) { 165 165 if ( ! defined( 'WP_SITEURL' ) ) { 166 $ whitelist_options['general'][] = 'siteurl';166 $allowed_options['general'][] = 'siteurl'; 167 167 } 168 168 if ( ! defined( 'WP_HOME' ) ) { 169 $ whitelist_options['general'][] = 'home';170 } 171 172 $ whitelist_options['general'][] = 'users_can_register';173 $ whitelist_options['general'][] = 'default_role';174 175 $ whitelist_options['writing'] = array_merge( $whitelist_options['writing'], $mail_options );176 $ whitelist_options['writing'][] = 'ping_sites';177 178 $ whitelist_options['media'][] = 'uploads_use_yearmonth_folders';169 $allowed_options['general'][] = 'home'; 170 } 171 172 $allowed_options['general'][] = 'users_can_register'; 173 $allowed_options['general'][] = 'default_role'; 174 175 $allowed_options['writing'] = array_merge( $allowed_options['writing'], $mail_options ); 176 $allowed_options['writing'][] = 'ping_sites'; 177 178 $allowed_options['media'][] = 'uploads_use_yearmonth_folders'; 179 179 180 180 /* … … 184 184 */ 185 185 if ( get_option( 'upload_url_path' ) || ( get_option( 'upload_path' ) != 'wp-content/uploads' && get_option( 'upload_path' ) ) ) { 186 $ whitelist_options['media'][] = 'upload_path';187 $ whitelist_options['media'][] = 'upload_url_path';186 $allowed_options['media'][] = 'upload_path'; 187 $allowed_options['media'][] = 'upload_url_path'; 188 188 } 189 189 } else { … … 196 196 */ 197 197 if ( apply_filters( 'enable_post_by_email_configuration', true ) ) { 198 $ whitelist_options['writing'] = array_merge( $whitelist_options['writing'], $mail_options );198 $allowed_options['writing'] = array_merge( $allowed_options['writing'], $mail_options ); 199 199 } 200 200 } 201 201 202 202 /** 203 * Filters the options whitelist.203 * Filters the allowed options list. 204 204 * 205 205 * @since 2.7.0 206 * 207 * @param array $whitelist_options The options whitelist. 206 * @deprecated 5.5.0 Use {@see 'allowed_options'} instead. 207 * 208 * @param array $allowed_options The allowed options list. 208 209 */ 209 $whitelist_options = apply_filters( 'whitelist_options', $whitelist_options ); 210 $allowed_options = apply_filters_deprecated( 'whitelist_options', array( $allowed_options ), '5.5.0', 'apply_filters_deprecated', __( 'Please consider writing more inclusive code.' ) ); 211 212 /** 213 * Filters the allowed options list. 214 * 215 * @since 5.5.0 216 * 217 * @param array $allowed_options The allowed options list. 218 */ 219 $allowed_options = apply_filters( 'allowed_options', $allowed_options ); 210 220 211 221 if ( 'update' === $action ) { // We are saving settings sent from a settings page. … … 218 228 } 219 229 220 if ( ! isset( $ whitelist_options[ $option_page ] ) ) {230 if ( ! isset( $allowed_options[ $option_page ] ) ) { 221 231 wp_die( 222 232 sprintf( 223 233 /* translators: %s: The options page name. */ 224 __( '<strong>Error</strong>: Options page %s not found in the options whitelist.' ),234 __( '<strong>Error</strong>: Options page %s not found in the allowed options list.' ), 225 235 '<code>' . esc_html( $option_page ) . '</code>' 226 236 ) … … 234 244 $options = explode( ',', wp_unslash( $_POST['page_options'] ) ); 235 245 } else { 236 $options = $ whitelist_options[ $option_page ];246 $options = $allowed_options[ $option_page ]; 237 247 } 238 248
Note: See TracChangeset
for help on using the changeset viewer.