Changeset 5318 for branches/2.2/wp-includes/widgets.php
- Timestamp:
- 04/26/2007 05:17:11 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2/wp-includes/widgets.php
r5317 r5318 335 335 $options = get_option('widget_archives'); 336 336 $c = $options['count'] ? '1' : '0'; 337 $d = $options['dropdown'] ? '1' : '0'; 337 338 $title = empty($options['title']) ? __('Archives') : $options['title']; 338 ?> 339 <?php echo $before_widget; ?> 340 <?php echo $before_title . $title . $after_title; ?> 341 <ul> 342 <?php wp_get_archives("type=monthly&show_post_count=$c"); ?> 343 </ul> 344 <?php echo $after_widget; ?> 345 <?php 339 340 echo $before_widget; 341 echo $before_title . $title . $after_title; 342 343 if($d) { 344 ?> 345 <select name="archive-dropdown" onChange='document.location.href=this.options[this.selectedIndex].value;'> <?php wp_get_archives('type=monthly&format=option'); ?> </select> 346 <?php 347 } else { 348 ?> 349 <ul> 350 <?php wp_get_archives("type=monthly&show_post_count=$c"); ?> 351 </ul> 352 <?php 353 } 354 355 echo $after_widget; 346 356 } 347 357 … … 350 360 if ( $_POST["archives-submit"] ) { 351 361 $newoptions['count'] = isset($_POST['archives-count']); 362 $newoptions['dropdown'] = isset($_POST['archives-dropdown']); 352 363 $newoptions['title'] = strip_tags(stripslashes($_POST["archives-title"])); 353 364 } … … 357 368 } 358 369 $count = $options['count'] ? 'checked="checked"' : ''; 370 $dropdown = $options['dropdown'] ? 'checked="checked"' : ''; 359 371 $title = htmlspecialchars($options['title'], ENT_QUOTES); 360 372 ?> 361 373 <p><label for="archives-title"><?php _e('Title:'); ?> <input style="width: 250px;" id="archives-title" name="archives-title" type="text" value="<?php echo $title; ?>" /></label></p> 362 374 <p style="text-align:right;margin-right:40px;"><label for="archives-count">Show post counts <input class="checkbox" type="checkbox" <?php echo $count; ?> id="archives-count" name="archives-count" /></label></p> 375 <p style="text-align:right;margin-right:40px;"><label for="archives-dropdown">Use drop down format <input class="checkbox" type="checkbox" <?php echo $dropdown; ?> id="archives-dropdown" name="archives-dropdown" /></label></p> 363 376 <input type="hidden" id="archives-submit" name="archives-submit" value="1" /> 364 377 <?php … … 516 529 $c = $options['count'] ? '1' : '0'; 517 530 $h = $options['hierarchical'] ? '1' : '0'; 531 $d = $options['dropdown'] ? '1' : '0'; 518 532 $title = empty($options['title']) ? __('Categories') : $options['title']; 519 ?> 520 <?php echo $before_widget; ?> 521 <?php echo $before_title . $title . $after_title; ?> 522 <ul> 523 <?php wp_list_cats("sort_column=name&optioncount=$c&hierarchical=$h"); ?> 524 </ul> 525 <?php echo $after_widget; ?> 526 <?php 533 534 echo $before_widget; 535 echo $before_title . $title . $after_title; 536 537 $cat_args = "sort_column=name&optioncount={$c}&hierarchical={$h}"; 538 539 if($d) { 540 wp_dropdown_categories($cat_args); 541 ?> 542 543 <script lang='javascript'><!-- 544 var dropdown = document.getElementById("cat"); 545 function onCatChange() { 546 location.href = "?cat="+dropdown.options[dropdown.selectedIndex].value; 547 } 548 dropdown.onchange = onCatChange; 549 --></script> 550 551 <?php 552 } else { 553 ?> 554 <ul> 555 <?php wp_list_cats($cat_args); ?> 556 </ul> 557 <?php 558 } 559 560 echo $after_widget; 527 561 } 528 562 … … 532 566 $newoptions['count'] = isset($_POST['categories-count']); 533 567 $newoptions['hierarchical'] = isset($_POST['categories-hierarchical']); 568 $newoptions['dropdown'] = isset($_POST['categories-dropdown']); 534 569 $newoptions['title'] = strip_tags(stripslashes($_POST['categories-title'])); 535 570 } … … 540 575 $count = $options['count'] ? 'checked="checked"' : ''; 541 576 $hierarchical = $options['hierarchical'] ? 'checked="checked"' : ''; 577 $dropdown = $options['dropdown'] ? 'checked="checked"' : ''; 542 578 $title = wp_specialchars($options['title']); 543 579 ?> … … 545 581 <p style="text-align:right;margin-right:40px;"><label for="categories-count"><?php _e('Show post counts'); ?> <input class="checkbox" type="checkbox" <?php echo $count; ?> id="categories-count" name="categories-count" /></label></p> 546 582 <p style="text-align:right;margin-right:40px;"><label for="categories-hierarchical" style="text-align:right;"><?php _e('Show hierarchy'); ?> <input class="checkbox" type="checkbox" <?php echo $hierarchical; ?> id="categories-hierarchical" name="categories-hierarchical" /></label></p> 583 <p style="text-align:right;margin-right:40px;"><label for="categories-dropdown" style="text-align:right;"><?php _e('Use drop down format'); ?> <input class="checkbox" type="checkbox" <?php echo $dropdown; ?> id="categories-dropdown" name="categories-dropdown" /></label></p> 547 584 <input type="hidden" id="categories-submit" name="categories-submit" value="1" /> 548 585 <?php
Note: See TracChangeset
for help on using the changeset viewer.