Changeset 9834
- Timestamp:
- 11/21/2008 06:12:57 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/category-template.php
r9599 r9834 537 537 * be to return the top 45 tags in the tag cloud list. 538 538 * 539 * The 'single_text' and 'multiple_text' arguments are used for the link title 540 * for the tag link. If the tag only has one, it will use the text in the541 * 'single_text' or if it has more than one it will use 'multiple_text' instead.539 * The 'topic_count_text_callback' argument is a function, which, given the count 540 * of the posts with that tag, returns a text for the tooltip of the tag link. 541 * @see default_topic_count_text 542 542 * 543 543 * The 'exclude' and 'include' arguments are used for the {@link get_tags()} … … 586 586 587 587 /** 588 * Default text for tooltip for tag links 589 * 590 * @param integer $count number of posts with that tag 591 * @return string text for the tooltip of a tag link. 592 */ 593 function default_topic_count_text( $count ) { 594 return sprintf( __ngettext('%s topic', '%s topics', $count), number_format_i18n( $count ) ); 595 } 596 597 /** 588 598 * Generates a tag cloud (heatmap) from provided data. 589 599 * … … 602 612 * be to return the entire tag cloud list. 603 613 * 604 * The 'single_text' and 'multiple_text' arguments are used for the link title 605 * for the tag link. If the tag only has one, it will use the text in the 606 * 'single_text' or if it has more than one it will use 'multiple_text' instead. 614 * The 'topic_count_text_callback' argument is a function, which given the count 615 * of the posts with that tag returns a text for the tooltip of the tag link. 616 * @see default_topic_count_text 617 * 607 618 * 608 619 * @todo Complete functionality. … … 618 629 'smallest' => 8, 'largest' => 22, 'unit' => 'pt', 'number' => 0, 619 630 'format' => 'flat', 'orderby' => 'name', 'order' => 'ASC', 620 ' single_text' => '%d topic', 'multiple_text' => '%d topics'631 'topic_count_text_callback' => 'default_topic_count_text', 621 632 ); 633 634 if ( !isset( $args['topic_count_text_callback'] ) && isset( $args['single_text'] ) && isset( $args['multiple_text'] ) ) { 635 $body = 'return sprintf ( 636 __ngettext('.var_export($args['single_text'], true).', '.var_export($args['multiple_text'], true).', $count), 637 number_format_i18n( $count ));'; 638 $args['topic_count_text_callback'] = create_function('$count', $body); 639 } 640 622 641 $args = wp_parse_args( $args, $defaults ); 642 623 643 extract( $args ); 624 644 … … 667 687 $tag_id = isset($tags[ $key ]->id) ? $tags[ $key ]->id : $key; 668 688 $tag_name = $tags[ $key ]->name; 669 $a[] = "<a href='$tag_link' class='tag-link-$tag_id' title='" . attribute_escape( sprintf( __ngettext( $single_text, $multiple_text, $count ),$count ) ) . "'$rel style='font-size: " .689 $a[] = "<a href='$tag_link' class='tag-link-$tag_id' title='" . attribute_escape( $topic_count_text_callback( $count ) ) . "'$rel style='font-size: " . 670 690 ( $smallest + ( ( $count - $min_count ) * $font_step ) ) 671 691 . "$unit;'>$tag_name</a>";
Note: See TracChangeset
for help on using the changeset viewer.