WordPress.org

Make WordPress Core

Changeset 12616


Ignore:
Timestamp:
01/07/10 00:01:52 (4 years ago)
Author:
ryan
Message:

Deprecate argument. Never fallback to options table for user option requests. Props nacin. fixes #11615

Location:
trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/categories.php

    r12546 r12616  
    167167    $pagenum = 1; 
    168168 
    169 $cats_per_page = (int) get_user_option( 'categories_per_page', 0, false ); 
     169$cats_per_page = (int) get_user_option( 'categories_per_page' ); 
    170170if ( empty( $cats_per_page ) || $cats_per_page < 1 ) 
    171171    $cats_per_page = 20; 
  • trunk/wp-admin/edit-comments.php

    r12546 r12616  
    227227 
    228228<?php 
    229 $comments_per_page = (int) get_user_option( 'edit_comments_per_page', 0, false ); 
     229$comments_per_page = (int) get_user_option( 'edit_comments_per_page' ); 
    230230if ( empty( $comments_per_page ) || $comments_per_page < 1 ) 
    231231    $comments_per_page = 20; 
  • trunk/wp-admin/edit-pages.php

    r12546 r12616  
    229229if ( empty($pagenum) ) 
    230230    $pagenum = 1; 
    231 $per_page = (int) get_user_option( 'edit_pages_per_page', 0, false ); 
     231$per_page = (int) get_user_option( 'edit_pages_per_page' ); 
    232232if ( empty( $per_page ) || $per_page < 1 ) 
    233233    $per_page = 20; 
  • trunk/wp-admin/edit-tags.php

    r12597 r12616  
    195195    $pagenum = 1; 
    196196 
    197 $tags_per_page = (int) get_user_option( 'edit_tags_per_page', 0, false ); 
     197$tags_per_page = (int) get_user_option( 'edit_tags_per_page' ); 
    198198if ( empty($tags_per_page) || $tags_per_page < 1 ) 
    199199    $tags_per_page = 20; 
  • trunk/wp-admin/includes/post.php

    r12597 r12616  
    852852 
    853853 
    854     $posts_per_page = (int) get_user_option( 'edit_per_page', 0, false ); 
     854    $posts_per_page = (int) get_user_option( 'edit_per_page' ); 
    855855    if ( empty( $posts_per_page ) || $posts_per_page < 1 ) 
    856856        $posts_per_page = 15; 
     
    910910    $q['post_type'] = 'attachment'; 
    911911    $q['post_status'] = isset( $q['status'] ) && 'trash' == $q['status'] ? 'trash' : 'inherit'; 
    912     $media_per_page = (int) get_user_option( 'upload_per_page', 0, false ); 
     912    $media_per_page = (int) get_user_option( 'upload_per_page' ); 
    913913    if ( empty( $media_per_page ) || $media_per_page < 1 ) 
    914914        $media_per_page = 20; 
     
    940940        return ''; 
    941941    $current_user = wp_get_current_user(); 
    942     if ( $closed = get_user_option('closedpostboxes_'.$page, 0, false ) ) { 
     942    if ( $closed = get_user_option('closedpostboxes_'.$page ) ) { 
    943943        if ( !is_array( $closed ) ) { 
    944944            return ''; 
  • trunk/wp-admin/includes/template.php

    r12597 r12616  
    984984function get_hidden_columns($page) { 
    985985    $page = str_replace('.php', '', $page); 
    986     return (array) get_user_option( 'manage-' . $page . '-columns-hidden', 0, false ); 
     986    return (array) get_user_option( 'manage-' . $page . '-columns-hidden' ); 
    987987} 
    988988 
     
    29882988    do { 
    29892989        // Grab the ones the user has manually sorted. Pull them out of their previous context/priority and into the one the user chose 
    2990         if ( !$already_sorted && $sorted = get_user_option( "meta-box-order_$page", 0, false ) ) { 
     2990        if ( !$already_sorted && $sorted = get_user_option( "meta-box-order_$page" ) ) { 
    29912991            foreach ( $sorted as $box_context => $ids ) 
    29922992                foreach ( explode(',', $ids) as $id ) 
     
    30823082 
    30833083function get_hidden_meta_boxes($page) { 
    3084     $hidden = (array) get_user_option( "meta-box-hidden_$page", 0, false ); 
     3084    $hidden = (array) get_user_option( "meta-box-hidden_$page" ); 
    30853085 
    30863086    // Hide slug boxes by default 
     
    37383738 
    37393739    $option = str_replace( '-', '_', "${screen}_per_page" ); 
    3740     $per_page = (int) get_user_option( $option, 0, false ); 
     3740    $per_page = (int) get_user_option( $option ); 
    37413741    if ( empty( $per_page ) || $per_page < 1 ) { 
    37423742        if ( 'plugins' == $screen ) 
  • trunk/wp-admin/plugins.php

    r12546 r12616  
    355355$total_this_page = "total_{$status}_plugins"; 
    356356$total_this_page = $$total_this_page; 
    357 $plugins_per_page = (int) get_user_option( 'plugins_per_page', 0, false ); 
     357$plugins_per_page = (int) get_user_option( 'plugins_per_page' ); 
    358358if ( empty( $plugins_per_page ) || $plugins_per_page < 1 ) 
    359359    $plugins_per_page = 999; 
  • trunk/wp-admin/upload.php

    r12591 r12616  
    135135if ( isset($_GET['detached']) ) { 
    136136 
    137     $media_per_page = (int) get_user_option( 'upload_per_page', 0, false ); 
     137    $media_per_page = (int) get_user_option( 'upload_per_page' ); 
    138138    if ( empty($media_per_page) || $media_per_page < 1 ) 
    139139        $media_per_page = 20; 
  • trunk/wp-includes/functions.php

    r12615 r12616  
    771771        return; 
    772772 
    773     $settings = get_user_option( 'user-settings', $user->ID, false ); 
     773    $settings = get_user_option( 'user-settings', $user->ID ); 
    774774 
    775775    if ( isset( $_COOKIE['wp-settings-' . $user->ID] ) ) { 
     
    780780                return; 
    781781 
    782             $last_time = (int) get_user_option( 'user-settings-time', $user->ID, false ); 
     782            $last_time = (int) get_user_option( 'user-settings-time', $user->ID ); 
    783783            $saved = isset( $_COOKIE['wp-settings-time-' . $user->ID]) ? preg_replace( '/[^0-9]/', '', $_COOKIE['wp-settings-time-' . $user->ID] ) : 0; 
    784784 
  • trunk/wp-includes/user.php

    r12511 r12616  
    215215 * @param string $option User option name. 
    216216 * @param int $user Optional. User ID. 
    217  * @param bool $check_blog_options Whether to check for an option in the options table if a per-user option does not exist. Default is true. 
     217 * @param bool $deprecated Use get_option() to check for an option in the options table. 
    218218 * @return mixed 
    219219 */ 
    220 function get_user_option( $option, $user = 0, $check_blog_options = true ) { 
    221     global $wpdb; 
     220function get_user_option( $option, $user = 0, $deprecated = '' ) { 
     221    global $wpdb; 
     222 
     223    if ( !empty( $deprecated ) ) 
     224        _deprecated_argument( __FUNCTION__, '3.0' ); 
    222225 
    223226    $option = preg_replace('|[^a-z0-9_]|i', '', $option); 
     
    231234    elseif ( isset( $user->{$option} ) ) // User specific and cross-blog 
    232235        $result = $user->{$option}; 
    233     elseif ( $check_blog_options ) // Blog global 
    234         $result = get_option( $option ); 
    235236    else 
    236237        $result = false; 
Note: See TracChangeset for help on using the changeset viewer.