Changeset 6025 for trunk/wp-includes/widgets.php
- Timestamp:
- 09/03/2007 11:19:20 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/widgets.php
r5973 r6025 607 607 extract($args); 608 608 $options = get_option('widget_categories'); 609 609 610 610 $c = $options[$number]['count'] ? '1' : '0'; 611 611 $h = $options[$number]['hierarchical'] ? '1' : '0'; 612 612 $d = $options[$number]['dropdown'] ? '1' : '0'; 613 613 614 614 $title = empty($options[$number]['title']) ? __('Categories') : $options[$number]['title']; 615 615 … … 647 647 function wp_widget_categories_control( $number ) { 648 648 $options = $newoptions = get_option('widget_categories'); 649 649 650 650 if ( !is_array( $options ) ) { 651 651 $options = $newoptions = get_option( 'widget_categories' ); 652 652 } 653 653 654 654 if ( $_POST['categories-submit-' . $number] ) { 655 655 $newoptions[$number]['count'] = isset($_POST['categories-count-' . $number]); … … 658 658 $newoptions[$number]['title'] = strip_tags(stripslashes($_POST['categories-title-' . $number])); 659 659 } 660 660 661 661 if ( $options != $newoptions ) { 662 662 $options = $newoptions; 663 663 update_option('widget_categories', $options); 664 664 } 665 665 666 666 $title = attribute_escape( $options[$number]['title'] ); 667 667 ?> … … 669 669 <?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; ?>" /> 670 670 </label></p> 671 671 672 672 <p><label for="categories-dropdown-<?php echo $number; ?>"> 673 673 <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' ); ?> 674 674 </label></p> 675 675 676 676 <p><label for="categories-count-<?php echo $number; ?>"> 677 677 <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' ); ?> 678 678 </label></p> 679 679 680 680 <p><label for="categories-hierarchical-<?php echo $number; ?>"> 681 681 <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' ); ?> 682 682 </label></p> 683 683 684 684 <input type="hidden" id="categories-submit-<?php echo $number; ?>" name="categories-submit-<?php echo $number; ?>" value="1" /> 685 685 <?php … … 688 688 function wp_widget_categories_setup() { 689 689 $options = $newoptions = get_option( 'widget_categories' ); 690 690 691 691 if ( isset( $_POST['categories-number-submit'] ) ) { 692 692 $number = (int) $_POST['categories-number']; 693 693 694 694 if ( $number > 9 ) { 695 695 $number = 9; … … 697 697 $number = 1; 698 698 } 699 699 700 700 $newoptions['number'] = $number; 701 701 } 702 702 703 703 if ( $newoptions != $options ) { 704 704 $options = $newoptions; … … 771 771 $options = wp_widget_categories_upgrade(); 772 772 $number = (int) $options['number']; 773 773 774 774 if ( $number > 9 ) { 775 775 $number = 9; … … 777 777 $number = 1; 778 778 } 779 779 780 780 $dims = array( 'width' => 350, 'height' => 170 ); 781 781 $class = array( 'classname' => 'widget_catgories' ); 782 782 783 783 for ( $i = 1; $i <= 9; $i++ ) { 784 784 $name = sprintf( __( 'Categories %d' ), $i ); 785 785 $id = 'categories-' . $i; 786 786 787 787 $widget_callback = ( $i <= $number ) ? 'wp_widget_categories' : ''; 788 788 $control_callback = ( $i <= $number ) ? 'wp_widget_categories_control' : ''; 789 789 790 790 wp_register_sidebar_widget( $id, $name, $widget_callback, $class, $i ); 791 791 wp_register_widget_control( $id, $name, $control_callback, $dims, $i ); 792 792 } 793 793 794 794 add_action( 'sidebar_admin_setup', 'wp_widget_categories_setup' ); 795 795 add_action( 'sidebar_admin_page', 'wp_widget_categories_page' ); … … 986 986 echo '<ul><li>' . __( 'An error has occurred; the feed is probably down. Try again later.' ) . '</li></ul>'; 987 987 } 988 988 989 989 echo $after_widget; 990 990 } … … 1080 1080 1081 1081 $GLOBALS['wp_register_widget_defaults'] = true; 1082 1082 1083 1083 $dims90 = array( 'height' => 90, 'width' => 300 ); 1084 1084 $dims100 = array( 'height' => 100, 'width' => 300 ); 1085 1085 $dims150 = array( 'height' => 150, 'width' => 300 ); 1086 1086 1087 1087 $class = array('classname' => 'widget_pages'); 1088 1088 wp_register_sidebar_widget('pages', __('Pages'), 'wp_widget_pages', $class); 1089 1089 wp_register_widget_control('pages', __('Pages'), 'wp_widget_pages_control', $dims150); 1090 1090 1091 1091 $class['classname'] = 'widget_calendar'; 1092 1092 wp_register_sidebar_widget('calendar', __('Calendar'), 'wp_widget_calendar', $class); 1093 1093 wp_register_widget_control('calendar', __('Calendar'), 'wp_widget_calendar_control', $dims90); 1094 1094 1095 1095 $class['classname'] = 'widget_archives'; 1096 1096 wp_register_sidebar_widget('archives', __('Archives'), 'wp_widget_archives', $class); 1097 1097 wp_register_widget_control('archives', __('Archives'), 'wp_widget_archives_control', $dims100); 1098 1098 1099 1099 $class['classname'] = 'widget_links'; 1100 1100 wp_register_sidebar_widget('links', __('Links'), 'wp_widget_links', $class); 1101 1101 1102 1102 $class['classname'] = 'widget_meta'; 1103 1103 wp_register_sidebar_widget('meta', __('Meta'), 'wp_widget_meta', $class); 1104 1104 wp_register_widget_control('meta', __('Meta'), 'wp_widget_meta_control', $dims90); 1105 1105 1106 1106 $class['classname'] = 'widget_search'; 1107 1107 wp_register_sidebar_widget('search', __('Search'), 'wp_widget_search', $class); 1108 1108 1109 1109 $class['classname'] = 'widget_recent_entries'; 1110 1110 wp_register_sidebar_widget('recent-posts', __('Recent Posts'), 'wp_widget_recent_entries', $class); 1111 1111 wp_register_widget_control('recent-posts', __('Recent Posts'), 'wp_widget_recent_entries_control', $dims90); 1112 1112 1113 1113 wp_widget_categories_register(); 1114 1114 wp_widget_text_register();
Note: See TracChangeset
for help on using the changeset viewer.