summaryrefslogtreecommitdiffstats
path: root/wp-includes
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2008-09-22 11:22:33 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2008-09-22 11:22:33 +0000
commit5b9af382caaefe84e5df766882d6c07a5a55df29 (patch)
tree376fc81b6174eb7cef9dc1535da3ada6ce693ead /wp-includes
parent317e0d6d633a2c668f1a0bb3ed00dfff03b86c56 (diff)
downloadwordpress-mu-5b9af382caaefe84e5df766882d6c07a5a55df29.tar.gz
wordpress-mu-5b9af382caaefe84e5df766882d6c07a5a55df29.tar.xz
wordpress-mu-5b9af382caaefe84e5df766882d6c07a5a55df29.zip
Use default value for get_options()
get *all* options, not just auto load options, thanks Will Norris git-svn-id: http://svn.automattic.com/wordpress-mu/branches/2.6@1489 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-includes')
-rw-r--r--wp-includes/functions.php12
1 files changed, 6 insertions, 6 deletions
diff --git a/wp-includes/functions.php b/wp-includes/functions.php
index 261097e..d66e275 100644
--- a/wp-includes/functions.php
+++ b/wp-includes/functions.php
@@ -319,7 +319,7 @@ function is_serialized_string( $data ) {
* @param string $setting Name of option to retrieve. Should already be SQL-escaped
* @return mixed Value set for the option.
*/
-function get_option( $setting ) {
+function get_option( $setting, $default = false ) {
global $wpdb, $switched, $current_blog;
$wpdb->hide_errors();
@@ -330,7 +330,7 @@ function get_option( $setting ) {
$value = _get_option_cache( $setting );
if ( false === $value )
- return false;
+ return $default;
// If home is not set use siteurl.
if ( 'home' == $setting && '' == $value )
@@ -392,13 +392,13 @@ function form_option( $option ) {
* @return array List of all options.
*/
function get_alloptions() {
- global $wpdb, $wp_queries;
+ global $wpdb;
$show = $wpdb->hide_errors();
if ( !$options = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options WHERE autoload = 'yes'" ) )
$options = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options" );
$wpdb->show_errors($show);
- foreach ( $options as $option ) {
+ foreach ( (array) $options as $option ) {
// "When trying to design a foolproof system,
// never underestimate the ingenuity of the fools :)" -- Dougal
if ( in_array( $option->option_name, array( 'siteurl', 'home', 'category_base', 'tag_base' ) ) )
@@ -441,8 +441,8 @@ function wp_load_alloptions() {
}
$suppress = $wpdb->suppress_errors();
- if ( !$alloptions_db = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options WHERE autoload = 'yes'" ) )
- $alloptions_db = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options" );
+ // order by option_id asc in case there are duplicate values - this makes the most recent value overwrite the others in the array
+ $alloptions_db = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options FORCE INDEX(PRIMARY) ORDER BY option_id ASC" );
$wpdb->suppress_errors($suppress);
foreach ( (array) $alloptions_db as $o )
$_wp_alloptions[$blog_id][$o->option_name] = $o->option_value;