Changeset 1490
- Timestamp:
- 09/22/08 11:25:04 (2 months ago)
- Files:
-
- trunk/wp-includes/functions.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/wp-includes/functions.php
r1413 r1490 320 320 * @return mixed Value set for the option. 321 321 */ 322 function get_option( $setting ) {322 function get_option( $setting, $default = false ) { 323 323 global $wpdb, $switched, $current_blog; 324 324 … … 331 331 $value = _get_option_cache( $setting ); 332 332 if ( false === $value ) 333 return false;333 return $default; 334 334 335 335 // If home is not set use siteurl. … … 393 393 */ 394 394 function get_alloptions() { 395 global $wpdb , $wp_queries;395 global $wpdb; 396 396 $show = $wpdb->hide_errors(); 397 397 if ( !$options = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options WHERE autoload = 'yes'" ) ) … … 399 399 $wpdb->show_errors($show); 400 400 401 foreach ( $options as $option ) {401 foreach ( (array) $options as $option ) { 402 402 // "When trying to design a foolproof system, 403 403 // never underestimate the ingenuity of the fools :)" -- Dougal … … 442 442 443 443 $suppress = $wpdb->suppress_errors(); 444 if ( !$alloptions_db = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options WHERE autoload = 'yes'" ) )445 $alloptions_db = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options" );444 // order by option_id asc in case there are duplicate values - this makes the most recent value overwrite the others in the array 445 $alloptions_db = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options FORCE INDEX(PRIMARY) ORDER BY option_id ASC" ); 446 446 $wpdb->suppress_errors($suppress); 447 447 foreach ( (array) $alloptions_db as $o )
