| 403 | | * Retrieve all autoload options or all options, if no autoloaded ones exist. |
| 404 | | * |
| 405 | | * This is different from wp_load_alloptions() in that this function does not |
| 406 | | * cache its results and will retrieve all options from the database every time |
| 407 | | * |
| 408 | | * it is called. |
| 409 | | * |
| 410 | | * @since 1.0.0 |
| 411 | | * @package WordPress |
| 412 | | * @subpackage Option |
| 413 | | * @uses apply_filters() Calls 'pre_option_$optionname' hook with option value as parameter. |
| 414 | | * @uses apply_filters() Calls 'all_options' on options list. |
| 415 | | * |
| 416 | | * @return array List of all options. |
| 417 | | */ |
| 418 | | function get_alloptions() { |
| 419 | | global $wpdb; |
| 420 | | $show = $wpdb->hide_errors(); |
| 421 | | if ( !$options = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options WHERE autoload = 'yes'" ) ) |
| 422 | | $options = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options" ); |
| 423 | | $wpdb->show_errors($show); |
| 424 | | |
| 425 | | foreach ( (array) $options as $option ) { |
| 426 | | // "When trying to design a foolproof system, |
| 427 | | // never underestimate the ingenuity of the fools :)" -- Dougal |
| 428 | | if ( in_array( $option->option_name, array( 'siteurl', 'home', 'category_base', 'tag_base' ) ) ) |
| 429 | | $option->option_value = untrailingslashit( $option->option_value ); |
| 430 | | $value = maybe_unserialize( $option->option_value ); |
| 431 | | $all_options->{$option->option_name} = apply_filters( 'pre_option_' . $option->option_name, $value ); |
| 432 | | } |
| 433 | | return apply_filters( 'all_options', $all_options ); |
| 434 | | } |
| 435 | | |
| 436 | | /** |