WordPress.org

Make WordPress Core

Ticket #4915: 4915.diff

File 4915.diff, 2.7 KB (added by nacin, 4 years ago)

Deprecate for wp_load_alloptions()

  • wp-includes/functions.php

     
    400400} 
    401401 
    402402/** 
    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 /** 
    437403 * Loads and caches all autoloaded options, if available or all options. 
    438404 * 
    439  * This is different from get_alloptions(), in that this function will cache the 
    440  * options and will return the cached options when called again. 
    441  * 
    442405 * @since 2.2.0 
    443406 * @package WordPress 
    444407 * @subpackage Option 
    445408 * 
    446  * @return array List all options. 
     409 * @return array List of all options. 
    447410 */ 
    448411function wp_load_alloptions() { 
    449412        global $wpdb; 
  • wp-includes/deprecated.php

     
    18991899        _deprecated_function(__FUNCTION__, '2.9', '_nx' ); 
    19001900        return before_last_bar( _n( $single, $plural, $number, $domain ) ); 
    19011901} 
     1902 
     1903/** 
     1904 * Retrieve all autoload options, or all options if no autoloaded ones exist. 
     1905 * 
     1906 * @since 1.0.0 
     1907 * @deprecated 3.0.0 
     1908 * @deprecated Use wp_load_alloptions()) 
     1909 * @see wp_load_alloptions() 
     1910 * 
     1911 * @return array List of all options. 
     1912 */ 
     1913function get_alloptions() { 
     1914        _deprecated_function( __FUNCTION__, '3.0', 'wp_load_alloptions()' ); 
     1915        return wp_load_alloptions(); 
     1916} 
    19021917?>