Changeset 6628
- Timestamp:
- 07/19/2017 05:02:30 PM (8 years ago)
- Location:
- trunk/src/includes
- Files:
-
- 2 edited
-
admin/tools/common.php (modified) (4 diffs)
-
forums/template.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/admin/tools/common.php
r6573 r6628 442 442 // Parse args 443 443 $r = bbp_parse_args( $args, array( 444 'before' => '<ul class="subsubsub">', 445 'after' => '</ul>', 446 'link_before' => '<li>', 447 'link_after' => '</li>', 448 'count_before' => ' <span class="count">(', 449 'count_after' => ')</span>', 450 'separator' => ' | ', 444 'before' => '<ul class="subsubsub">', 445 'after' => '</ul>', 446 'link_before' => '<li>', 447 'link_after' => '</li>', 448 'count_before' => ' <span class="count">(', 449 'count_after' => ')</span>', 450 'sep' => ' | ', 451 452 // Retired, use 'sep' instead 453 'separator' => false 451 454 ), 'get_admin_repair_tool_overhead_filters' ); 455 456 /** 457 * Necessary for backwards compatibility 458 * @see https://bbpress.trac.wordpress.org/ticket/2900 459 */ 460 if ( ! empty( $r['separator'] ) ) { 461 $r['sep'] = $r['separator']; 462 } 452 463 453 464 // Get page … … 480 491 // Create the "All" link 481 492 $current = empty( $_GET['overhead'] ) ? 'current' : ''; 482 $links[] = $r['link_before']. '<a href="' . esc_url( $tools_url ) . '" class="' . esc_attr( $current ) . '">' . sprintf( esc_html__( 'All %s', 'bbpress' ), $r['count_before'] . count( $tools ) . $r['count_after'] ) . '</a>' . $r['link_after']; 483 484 // Default ticker 485 $i = 0; 493 $links[] = $r['link_before'] . '<a href="' . esc_url( $tools_url ) . '" class="' . esc_attr( $current ) . '">' . sprintf( esc_html__( 'All %s', 'bbpress' ), $r['count_before'] . count( $tools ) . $r['count_after'] ) . '</a>' . $r['link_after']; 486 494 487 495 // Sort … … 490 498 // Loop through overheads and build filter 491 499 foreach ( $overheads as $overhead => $count ) { 492 493 // Separator count494 $i++;495 500 496 501 // Build the filter URL … … 514 519 515 520 // Surround output with before & after strings 516 $output = $r['before'] . implode( $r['sep arator'], $links ) . $r['after'];521 $output = $r['before'] . implode( $r['sep'], $links ) . $r['after']; 517 522 518 523 // Filter & return -
trunk/src/includes/forums/template.php
r6627 r6628 673 673 function bbp_list_forums( $args = array() ) { 674 674 675 // Define used variables676 $output = '';677 678 675 // Parse arguments against default values 679 676 $r = bbp_parse_args( $args, array( 680 'before' => '<ul class="bbp-forums-list">', 681 'after' => '</ul>', 682 'link_before' => '<li class="bbp-forum">', 683 'link_after' => '</li>', 684 'count_before' => ' (', 685 'count_after' => ')', 686 'count_sep' => ', ', 687 'separator' => ', ', 688 'forum_id' => '', 689 'show_topic_count' => true, 690 'show_reply_count' => true, 677 'before' => '<ul class="bbp-forums-list">', 678 'after' => '</ul>', 679 'link_before' => '<li class="bbp-forum">', 680 'link_after' => '</li>', 681 'count_before' => ' (', 682 'count_after' => ')', 683 'count_sep' => ', ', 684 'sep' => ', ', 685 'forum_id' => '', 686 'show_topic_count' => true, 687 'show_reply_count' => true, 688 689 // Retired, use 'sep' instead 690 'separator' => false 691 691 ), 'list_forums' ); 692 693 /** 694 * Necessary for backwards compatibility 695 * @see https://bbpress.trac.wordpress.org/ticket/2900 696 */ 697 if ( ! empty( $r['separator'] ) ) { 698 $r['sep'] = $r['separator']; 699 } 700 701 // Define links 702 $links = array(); 692 703 693 704 // Loop through forums and create a list 694 705 $sub_forums = bbp_forum_get_subforums( $r['forum_id'] ); 695 if ( ! empty( $sub_forums ) ) { 696 697 // Total count (for separator) 698 $i = 0; 699 $total_subs = count( $sub_forums ); 700 701 foreach ( $sub_forums as $sub_forum ) { 702 $i++; // Separator count 703 704 // Get forum details 705 $count = array(); 706 $permalink = bbp_get_forum_permalink( $sub_forum->ID ); 707 $title = bbp_get_forum_title( $sub_forum->ID ); 708 $show_sep = ( $total_subs > $i ) 709 ? $r['separator'] 710 : ''; 711 712 // Show topic count 713 if ( ! empty( $r['show_topic_count'] ) && ! bbp_is_forum_category( $sub_forum->ID ) ) { 714 $count['topic'] = bbp_get_forum_topic_count( $sub_forum->ID ); 715 } 716 717 // Show reply count 718 if ( ! empty( $r['show_reply_count'] ) && ! bbp_is_forum_category( $sub_forum->ID ) ) { 719 $count['reply'] = bbp_get_forum_reply_count( $sub_forum->ID ); 720 } 721 722 // Counts to show 723 $counts = ! empty( $count ) 724 ? $r['count_before'] . implode( $r['count_sep'], $count ) . $r['count_after'] 725 : ''; 726 727 // Subforum classes 728 $subforum_classes = array( 'bbp-forum-link' ); 729 $subforum_classes = apply_filters( 'bbp_list_forums_subforum_classes', $subforum_classes, $sub_forum->ID ); 730 $subforum_classes_attr = 'class="' . implode( ' ', array_map( 'esc_attr', $subforum_classes ) ) . '"'; 731 732 // Build this sub forums link 733 $output .= $r['link_before'] . '<a href="' . esc_url( $permalink ) . '" ' . $subforum_classes_attr . '>' . $title . $counts . '</a>' . $show_sep . $r['link_after']; 734 } 706 foreach ( $sub_forums as $sub_forum ) { 707 708 // Get forum details 709 $count = array(); 710 $permalink = bbp_get_forum_permalink( $sub_forum->ID ); 711 $title = bbp_get_forum_title( $sub_forum->ID ); 712 713 // Show topic count 714 if ( ! empty( $r['show_topic_count'] ) && ! bbp_is_forum_category( $sub_forum->ID ) ) { 715 $count['topic'] = bbp_get_forum_topic_count( $sub_forum->ID ); 716 } 717 718 // Show reply count 719 if ( ! empty( $r['show_reply_count'] ) && ! bbp_is_forum_category( $sub_forum->ID ) ) { 720 $count['reply'] = bbp_get_forum_reply_count( $sub_forum->ID ); 721 } 722 723 // Counts to show 724 $counts = ! empty( $count ) 725 ? $r['count_before'] . implode( $r['count_sep'], $count ) . $r['count_after'] 726 : ''; 727 728 // Subforum classes 729 $subforum_classes = array( 'bbp-forum-link' ); 730 $subforum_classes = apply_filters( 'bbp_list_forums_subforum_classes', $subforum_classes, $sub_forum->ID ); 731 $subforum_classes_attr = 'class="' . implode( ' ', array_map( 'esc_attr', $subforum_classes ) ) . '"'; 732 733 // Build this sub forums link 734 $links[] = $r['link_before'] . '<a href="' . esc_url( $permalink ) . '" ' . $subforum_classes_attr . '>' . $title . $counts . '</a>' . $r['link_after']; 735 735 } 736 736 737 737 // Maybe wrap output 738 if ( ! empty( $output ) ) {739 $output = $r['before'] . $output . $r['after'];740 }738 $output = ! empty( $links ) 739 ? $r['before'] . implode( $r['sep'], $links ) . $r['after'] 740 : ''; 741 741 742 742 // Filter & output the forums list
Note: See TracChangeset
for help on using the changeset viewer.