Changeset 11894
- Timestamp:
- 09/01/2009 08:06:11 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/category-template.php
r11838 r11894 567 567 568 568 /** 569 * Default topic count scaling for tag links 570 * 571 * @param integer $count number of posts with that tag 572 * @return integer scaled count 573 */ 574 function default_topic_count_scale( $count ) { 575 return round(log10($count + 1) * 100); 576 } 577 578 579 /** 569 580 * Generates a tag cloud (heatmap) from provided data. 570 581 * … … 603 614 'format' => 'flat', 'orderby' => 'name', 'order' => 'ASC', 604 615 'topic_count_text_callback' => 'default_topic_count_text', 605 'filter' => 1, 616 'filter' => 1, 'topic_count_scale_callback' => 'default_topic_count_scale' 606 617 ); 607 618 … … 642 653 643 654 $counts = array(); 644 foreach ( (array) $tags as $key => $tag ) 645 $counts[ $key ] = $tag->count; 655 $real_counts = array(); // For the alt tag 656 foreach ( (array) $tags as $key => $tag ) { 657 $real_counts[ $key ] = $tag->count; 658 $counts[ $key ] = $topic_count_scale_callback($tag->count); 659 } 646 660 647 661 $min_count = min( $counts ); … … 660 674 foreach ( $tags as $key => $tag ) { 661 675 $count = $counts[ $key ]; 676 $real_count = $real_counts[ $key ]; 662 677 $tag_link = '#' != $tag->link ? esc_url( $tag->link ) : '#'; 663 678 $tag_id = isset($tags[ $key ]->id) ? $tags[ $key ]->id : $key; 664 679 $tag_name = $tags[ $key ]->name; 665 $a[] = "<a href='$tag_link' class='tag-link-$tag_id' title='" . esc_attr( $topic_count_text_callback( $ count ) ) . "'$rel style='font-size: " .680 $a[] = "<a href='$tag_link' class='tag-link-$tag_id' title='" . esc_attr( $topic_count_text_callback( $real_count ) ) . "'$rel style='font-size: " . 666 681 ( $smallest + ( ( $count - $min_count ) * $font_step ) ) 667 682 . "$unit;'>$tag_name</a>";
Note: See TracChangeset
for help on using the changeset viewer.