Changeset 8812 for trunk/src/bp-core/bp-core-options.php
- Timestamp:
- 08/12/2014 01:34:45 PM (11 years ago)
- File:
-
- 1 edited
-
trunk/src/bp-core/bp-core-options.php (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-core/bp-core-options.php
r8668 r8812 150 150 151 151 // Add default options 152 foreach ( $options as $key => $value )152 foreach ( array_keys( $options ) as $key ) { 153 153 delete_option( $key ); 154 } 154 155 155 156 // Allow previously activated plugins to append their own options. … … 174 175 175 176 // Add filters to each BuddyPress option 176 foreach ( $options as $key => $value )177 foreach ( array_keys( $options ) as $key ) { 177 178 add_filter( 'pre_option_' . $key, 'bp_pre_get_option' ); 179 } 178 180 179 181 // Allow previously activated plugins to append their own options. … … 188 190 * @since BuddyPress (1.6) 189 191 * 190 * @global BuddyPress $bp191 192 * @param bool $value Optional. Default value false 192 193 * @return mixed false if not overloaded, mixed if set 193 194 */ 194 195 function bp_pre_get_option( $value = false ) { 195 global $bp;196 $bp = buddypress(); 196 197 197 198 // Get the name of the current filter so we can manipulate it … … 202 203 203 204 // Check the options global for preset value 204 if ( !empty( $bp->options[$option] ) ) 205 $value = $bp->options[$option]; 205 if ( ! empty( $bp->options[ $option ] ) ) { 206 $value = $bp->options[ $option ]; 207 } 206 208 207 209 // Always return a value, even if false … … 383 385 // Loop through options 384 386 foreach ( $root_blog_options as $old_meta_key => $old_meta_default ) { 385 // Clear out the value from the last time around386 unset( $old_meta_value );387 387 388 388 if ( isset( $existing_options[$old_meta_key] ) ) { … … 391 391 392 392 // Get old site option 393 if ( is_multisite() ) 393 if ( is_multisite() ) { 394 394 $old_meta_value = get_site_option( $old_meta_key ); 395 } 395 396 396 397 // No site option so look in root blog 397 if ( empty( $old_meta_value ) ) 398 if ( empty( $old_meta_value ) ) { 398 399 $old_meta_value = bp_get_option( $old_meta_key, $old_meta_default ); 400 } 399 401 400 402 // Update the root blog option … … 403 405 // Update the global array 404 406 $root_blog_options_meta[$old_meta_key] = $old_meta_value; 407 408 // Clear out the value for the next time around 409 unset( $old_meta_value ); 405 410 } 406 411 … … 411 416 } else { 412 417 // Loop through our results and make them usable 413 foreach ( $root_blog_options_meta as $root_blog_option ) 418 foreach ( $root_blog_options_meta as $root_blog_option ) { 414 419 $root_blog_options[$root_blog_option->name] = $root_blog_option->value; 420 } 415 421 416 422 // Copy the options no the return val
Note: See TracChangeset
for help on using the changeset viewer.