Make WordPress Core


Ignore:
Timestamp:
09/03/2007 11:19:20 PM (17 years ago)
Author:
ryan
Message:

Strip lines that contain only whitespace down to newlines.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/widgets.php

    r5973 r6025  
    607607    extract($args);
    608608    $options = get_option('widget_categories');
    609    
     609
    610610    $c = $options[$number]['count'] ? '1' : '0';
    611611    $h = $options[$number]['hierarchical'] ? '1' : '0';
    612612    $d = $options[$number]['dropdown'] ? '1' : '0';
    613    
     613
    614614    $title = empty($options[$number]['title']) ? __('Categories') : $options[$number]['title'];
    615615
     
    647647function wp_widget_categories_control( $number ) {
    648648    $options = $newoptions = get_option('widget_categories');
    649    
     649
    650650    if ( !is_array( $options ) ) {
    651651        $options = $newoptions = get_option( 'widget_categories' );
    652652    }
    653    
     653
    654654    if ( $_POST['categories-submit-' . $number] ) {
    655655        $newoptions[$number]['count'] = isset($_POST['categories-count-' . $number]);
     
    658658        $newoptions[$number]['title'] = strip_tags(stripslashes($_POST['categories-title-' . $number]));
    659659    }
    660    
     660
    661661    if ( $options != $newoptions ) {
    662662        $options = $newoptions;
    663663        update_option('widget_categories', $options);
    664664    }
    665    
     665
    666666    $title = attribute_escape( $options[$number]['title'] );
    667667?>
     
    669669                <?php _e( 'Title:' ); ?> <input style="width:300px" id="categories-title-<?php echo $number; ?>" name="categories-title-<?php echo $number; ?>" type="text" value="<?php echo $title; ?>" />
    670670            </label></p>
    671            
     671
    672672            <p><label for="categories-dropdown-<?php echo $number; ?>">
    673673                <input type="checkbox" class="checkbox" id="categories-dropdown-<?php echo $number; ?>" name="categories-dropdown-<?php echo $number; ?>"<?php echo $options[$number]['dropdown'] ? ' checked="checked"' : ''; ?> /> <?php _e( 'Show as dropdown' ); ?>
    674674            </label></p>
    675            
     675
    676676            <p><label for="categories-count-<?php echo $number; ?>">
    677677                <input type="checkbox" class="checkbox" id="categories-count-<?php echo $number; ?>" name="categories-count-<?php echo $number; ?>"<?php echo $options[$number]['count'] ? ' checked="checked"' : ''; ?> /> <?php _e( 'Show post counts' ); ?>
    678678            </label></p>
    679            
     679
    680680            <p><label for="categories-hierarchical-<?php echo $number; ?>">
    681681                <input type="checkbox" class="checkbox" id="categories-hierarchical-<?php echo $number; ?>" name="categories-hierarchical-<?php echo $number; ?>"<?php echo $options[$number]['hierarchical'] ? ' checked="checked"' : ''; ?> /> <?php _e( 'Show hierarchy' ); ?>
    682682            </label></p>
    683            
     683
    684684            <input type="hidden" id="categories-submit-<?php echo $number; ?>" name="categories-submit-<?php echo $number; ?>" value="1" />
    685685<?php
     
    688688function wp_widget_categories_setup() {
    689689    $options = $newoptions = get_option( 'widget_categories' );
    690    
     690
    691691    if ( isset( $_POST['categories-number-submit'] ) ) {
    692692        $number = (int) $_POST['categories-number'];
    693        
     693
    694694        if ( $number > 9 ) {
    695695            $number = 9;
     
    697697            $number = 1;
    698698        }
    699        
     699
    700700        $newoptions['number'] = $number;
    701701    }
    702    
     702
    703703    if ( $newoptions != $options ) {
    704704        $options = $newoptions;
     
    771771        $options = wp_widget_categories_upgrade();
    772772    $number = (int) $options['number'];
    773    
     773
    774774    if ( $number > 9 ) {
    775775        $number = 9;
     
    777777        $number = 1;
    778778    }
    779    
     779
    780780    $dims = array( 'width' => 350, 'height' => 170 );
    781781    $class = array( 'classname' => 'widget_catgories' );
    782    
     782
    783783    for ( $i = 1; $i <= 9; $i++ ) {
    784784        $name = sprintf( __( 'Categories %d' ), $i );
    785785        $id = 'categories-' . $i;
    786        
     786
    787787        $widget_callback = ( $i <= $number ) ? 'wp_widget_categories' : '';
    788788        $control_callback = ( $i <= $number ) ? 'wp_widget_categories_control' : '';
    789        
     789
    790790        wp_register_sidebar_widget( $id, $name, $widget_callback, $class, $i );
    791791        wp_register_widget_control( $id, $name, $control_callback, $dims, $i );
    792792    }
    793    
     793
    794794    add_action( 'sidebar_admin_setup', 'wp_widget_categories_setup' );
    795795    add_action( 'sidebar_admin_page', 'wp_widget_categories_page' );
     
    986986        echo '<ul><li>' . __( 'An error has occurred; the feed is probably down. Try again later.' ) . '</li></ul>';
    987987    }
    988    
     988
    989989    echo $after_widget;
    990990}
     
    10801080
    10811081    $GLOBALS['wp_register_widget_defaults'] = true;
    1082    
     1082
    10831083    $dims90 = array( 'height' => 90, 'width' => 300 );
    10841084    $dims100 = array( 'height' => 100, 'width' => 300 );
    10851085    $dims150 = array( 'height' => 150, 'width' => 300 );
    1086    
     1086
    10871087    $class = array('classname' => 'widget_pages');
    10881088    wp_register_sidebar_widget('pages', __('Pages'), 'wp_widget_pages', $class);
    10891089    wp_register_widget_control('pages', __('Pages'), 'wp_widget_pages_control', $dims150);
    1090    
     1090
    10911091    $class['classname'] = 'widget_calendar';
    10921092    wp_register_sidebar_widget('calendar', __('Calendar'), 'wp_widget_calendar', $class);
    10931093    wp_register_widget_control('calendar', __('Calendar'), 'wp_widget_calendar_control', $dims90);
    1094    
     1094
    10951095    $class['classname'] = 'widget_archives';
    10961096    wp_register_sidebar_widget('archives', __('Archives'), 'wp_widget_archives', $class);
    10971097    wp_register_widget_control('archives', __('Archives'), 'wp_widget_archives_control', $dims100);
    1098    
     1098
    10991099    $class['classname'] = 'widget_links';
    11001100    wp_register_sidebar_widget('links', __('Links'), 'wp_widget_links', $class);
    1101    
     1101
    11021102    $class['classname'] = 'widget_meta';
    11031103    wp_register_sidebar_widget('meta', __('Meta'), 'wp_widget_meta', $class);
    11041104    wp_register_widget_control('meta', __('Meta'), 'wp_widget_meta_control', $dims90);
    1105    
     1105
    11061106    $class['classname'] = 'widget_search';
    11071107    wp_register_sidebar_widget('search', __('Search'), 'wp_widget_search', $class);
    1108    
     1108
    11091109    $class['classname'] = 'widget_recent_entries';
    11101110    wp_register_sidebar_widget('recent-posts', __('Recent Posts'), 'wp_widget_recent_entries', $class);
    11111111    wp_register_widget_control('recent-posts', __('Recent Posts'), 'wp_widget_recent_entries_control', $dims90);
    1112    
     1112
    11131113    wp_widget_categories_register();
    11141114    wp_widget_text_register();
Note: See TracChangeset for help on using the changeset viewer.