Make WordPress Core

Changeset 9871


Ignore:
Timestamp:
11/25/2008 06:33:04 PM (15 years ago)
Author:
ryan
Message:

Add option defaults. Add arg to get_user_option() to avoid querying options table if user option is missing. see #8229

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/edit-attachment-rows.php

    r9807 r9871  
    3636
    3737<?php
    38 $posts_columns = wp_manage_media_columns();
    39 $hidden = (array) get_user_option( 'manage-media-columns-hidden' );
     38$posts_columns = get_column_headers('media');
     39$hidden = get_hidden_columns('media');
    4040
    4141foreach ($posts_columns as $column_name => $column_display_name ) {
  • trunk/wp-admin/edit-form-advanced.php

    r9835 r9871  
    436436<p class="hide-if-no-js"><a href="#commentstatusdiv" id="show-comments" onclick="commentsBox.get(<?php echo $total; ?>);return false;"><?php _e('Show comments'); ?></a> <img class="waiting" style="display:none;" src="images/loading.gif" alt="" /></p>
    437437<?php
    438     $hidden = (array) get_user_option( "meta-box-hidden_post" );
     438    $hidden = (array) get_user_option( "meta-box-hidden_post", 0, false );
    439439    if ( ! in_array('commentstatusdiv', $hidden) ) { ?>
    440440        <script type="text/javascript">commentsBox.get(<?php echo $total; ?>, 10);</script>
  • trunk/wp-admin/includes/post.php

    r9847 r9871  
    870870        return '';
    871871    $current_user = wp_get_current_user();
    872     if ( $closed = get_usermeta( $current_user->ID, 'closedpostboxes_'.$page ) ) {
     872    if ( $closed = get_user_option('closedpostboxes_'.$page, 0, false ) ) {
    873873        if ( !is_array( $closed ) ) return '';
    874874        return in_array( $id, $closed )? 'if-js-closed' : '';
  • trunk/wp-admin/includes/schema.php

    r9316 r9871  
    295295    add_option('default_comments_page', 'newest');
    296296    add_option('comment_order', 'asc');
    297 
     297    add_option('use_ssl', 0);
     298    add_option('sticky_posts', array());
     299    add_option('widget_categories', array());
     300    add_option('widget_text', array());
     301    add_option('widget_rss', array());
     302    add_option('update_core', array());
     303    add_option('dismissed_update_core', array());
     304   
    298305    // Delete unused options
    299306    $unusedoptions = array ('blodotgsping_url', 'bodyterminator', 'emailtestonly', 'phoneemail_separator', 'smilies_directory', 'subjectprefix', 'use_bbcode', 'use_blodotgsping', 'use_phoneemail', 'use_quicktags', 'use_weblogsping', 'weblogs_cache_file', 'use_preview', 'use_htmltrans', 'smilies_directory', 'fileupload_allowedusers', 'use_phoneemail', 'default_post_status', 'default_post_category', 'archive_mode', 'time_difference', 'links_minadminlevel', 'links_use_adminlevels', 'links_rating_type', 'links_rating_char', 'links_rating_ignore_zero', 'links_rating_single_image', 'links_rating_image0', 'links_rating_image1', 'links_rating_image2', 'links_rating_image3', 'links_rating_image4', 'links_rating_image5', 'links_rating_image6', 'links_rating_image7', 'links_rating_image8', 'links_rating_image9', 'weblogs_cacheminutes', 'comment_allowed_tags', 'search_engine_friendly_urls', 'default_geourl_lat', 'default_geourl_lon', 'use_default_geourl', 'weblogs_xml_url', 'new_users_can_blog', '_wpnonce', '_wp_http_referer', 'Update', 'action', 'rich_editing', 'autosave_interval', 'deactivated_plugins');
  • trunk/wp-admin/includes/template.php

    r9868 r9871  
    204204    $is_tag = $type == 'tag';
    205205    $columns = $is_tag ? get_column_headers('tag') : get_column_headers('category');
    206     $hidden = array_intersect( array_keys( $columns ), array_filter( (array) get_user_option( "manage-$type-columns-hidden" ) ) );
     206    $hidden = array_intersect( array_keys( $columns ), array_filter( get_hidden_columns($type) ) );
    207207    $col_count = count($columns) - count($hidden);
    208208    ?>
     
    901901function get_hidden_columns($page) {
    902902    $page = str_replace('.php', '', $page);
    903     return (array) get_user_option( 'manage-' . $page . '-columns-hidden' );   
     903    return (array) get_user_option( 'manage-' . $page . '-columns-hidden', 0, false ); 
    904904}
    905905
     
    923923
    924924    $columns = $is_page ? wp_manage_pages_columns() : wp_manage_posts_columns();
    925     $hidden = array_intersect( array_keys( $columns ), array_filter( (array) get_user_option( "manage-$type-columns-hidden" ) ) );
     925    $hidden = array_intersect( array_keys( $columns ), array_filter( get_hidden_columns($type) ) );
    926926    $col_count = count($columns) - count($hidden);
    927927    $m = ( isset($mode) && 'excerpt' == $mode ) ? 'excerpt' : 'list';
     
    26982698    //do_action('do_meta_boxes', $page, $context, $object);
    26992699
    2700     $hidden = (array) get_user_option( "meta-box-hidden_$page" );
     2700    $hidden = (array) get_user_option( "meta-box-hidden_$page", 0, false );
    27012701
    27022702    echo "<div id='$context-sortables' class='meta-box-sortables'>\n";
     
    27052705    do {
    27062706        // Grab the ones the user has manually sorted. Pull them out of their previous context/priority and into the one the user chose
    2707         if ( !$already_sorted && $sorted = get_user_option( "meta-box-order_$page" ) ) {
     2707        if ( !$already_sorted && $sorted = get_user_option( "meta-box-order_$page", 0, false ) ) {
    27082708            foreach ( $sorted as $box_context => $ids )
    27092709                foreach ( explode(',', $ids) as $id )
     
    27782778        return;
    27792779
    2780     $hidden = (array) get_user_option( "meta-box-hidden_$page" );
     2780    $hidden = (array) get_user_option( "meta-box-hidden_$page", 0, false );
    27812781
    27822782    foreach ( array_keys($wp_meta_boxes[$page]) as $context ) {
  • trunk/wp-admin/link-manager.php

    r9779 r9871  
    139139if ( $links ) {
    140140    $link_columns = get_column_headers('link-manager');
    141     $hidden = (array) get_user_option( 'manage-link-manager-columns-hidden' );
     141    $hidden = get_hidden_columns('link-manager');
    142142?>
    143143
  • trunk/wp-includes/user.php

    r9716 r9871  
    169169 * @param string $option User option name.
    170170 * @param int $user Optional. User ID.
     171 * @param bool $check_global Whether to check for a global option if a per-user option does not exist. Default is true.
    171172 * @return mixed
    172173 */
    173 function get_user_option( $option, $user = 0 ) {
     174function get_user_option( $option, $user = 0, $check_global = true ) {
    174175    global $wpdb;
    175176
     
    184185    elseif ( isset( $user->{$option} ) ) // User specific and cross-blog
    185186        $result = $user->{$option};
    186     else // Blog global
     187    elseif ( $check_global ) // Blog global
    187188        $result = get_option( $option );
     189    else
     190        $result = false;
    188191
    189192    return apply_filters("get_user_option_{$option}", $result, $option, $user);
  • trunk/wp-includes/version.php

    r9863 r9871  
    1616 * @global int $wp_db_version
    1717 */
    18 $wp_db_version = 9621;
     18$wp_db_version = 9872;
    1919
    2020?>
Note: See TracChangeset for help on using the changeset viewer.