Changeset 6438 for trunk/src/includes/topics/template.php
- Timestamp:
- 05/27/2017 05:04:31 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/topics/template.php
r6433 r6438 33 33 */ 34 34 function bbp_get_topic_post_type() { 35 36 // Filter & return 35 37 return apply_filters( 'bbp_get_topic_post_type', bbpress()->topic_post_type ); 36 38 } … … 44 46 */ 45 47 function bbp_get_topic_post_type_labels() { 46 return apply_filters( 'bbp_get_topic_post_type_labels', array( 48 49 // Filter & return 50 return (array) apply_filters( 'bbp_get_topic_post_type_labels', array( 47 51 'name' => __( 'Topics', 'bbpress' ), 48 52 'menu_name' => __( 'Topics', 'bbpress' ), … … 75 79 */ 76 80 function bbp_get_topic_post_type_rewrite() { 77 return apply_filters( 'bbp_get_topic_post_type_rewrite', array( 81 82 // Filter & return 83 return (array) apply_filters( 'bbp_get_topic_post_type_rewrite', array( 78 84 'slug' => bbp_get_topic_slug(), 79 85 'with_front' => false … … 89 95 */ 90 96 function bbp_get_topic_post_type_supports() { 91 return apply_filters( 'bbp_get_topic_post_type_supports', array( 97 98 // Filter & return 99 return (array) apply_filters( 'bbp_get_topic_post_type_supports', array( 92 100 'title', 93 101 'editor', … … 113 121 } 114 122 123 // Filter & return 115 124 return (bool) apply_filters( 'bbp_show_lead_topic', (bool) $show_lead ); 116 125 } … … 265 274 } 266 275 267 // Return object276 // Filter & return 268 277 return apply_filters( 'bbp_has_topics', $bbp->topic_query->have_posts(), $bbp->topic_query ); 269 278 } … … 502 511 } 503 512 513 // Filter & return 504 514 return (int) apply_filters( 'bbp_get_topic_id', (int) $bbp_topic_id, $topic_id ); 505 515 } … … 549 559 } 550 560 561 // Filter & return 551 562 return apply_filters( 'bbp_get_topic', $topic, $output, $filter ); 552 563 } … … 592 603 } 593 604 605 // Filter & return 594 606 return apply_filters( 'bbp_get_topic_permalink', $topic_permalink, $topic_id ); 595 607 } … … 622 634 $title = get_the_title( $topic_id ); 623 635 636 // Filter & return 624 637 return apply_filters( 'bbp_get_topic_title', $title, $topic_id ); 625 638 } … … 668 681 } 669 682 683 // Filter & return 670 684 return apply_filters( 'bbp_get_topic_archive_title', $title ); 671 685 } … … 706 720 $content = get_post_field( 'post_content', $topic_id ); 707 721 722 // Filter & return 708 723 return apply_filters( 'bbp_get_topic_content', $content, $topic_id ); 709 724 } … … 759 774 } 760 775 776 // Filter & return 761 777 return apply_filters( 'bbp_get_topic_excerpt', $excerpt, $topic_id, $length ); 762 778 } … … 805 821 } 806 822 823 // Filter & return 807 824 return apply_filters( 'bbp_get_topic_post_date', $result, $topic_id, $humanize, $gmt, $date, $time ); 808 825 } … … 901 918 } 902 919 920 // Filter & return 903 921 return apply_filters( 'bbp_get_topic_pagination', $pagination_links, $args ); 904 922 } … … 926 944 $topic_id = bbp_get_topic_id( $topic_id ); 927 945 946 // Filter & return 928 947 return apply_filters( 'bbp_topic_append_revisions', $content . bbp_get_topic_revision_log( $topic_id ), $content, $topic_id ); 929 948 } … … 999 1018 $retval .= "\n" . '</ul>' . "\n\n"; 1000 1019 1020 // Filter & return 1001 1021 return apply_filters( 'bbp_get_topic_revision_log', $retval, $topic_id ); 1002 1022 } … … 1019 1039 $revision_log = empty( $revision_log ) ? array() : $revision_log; 1020 1040 1041 // Filter & return 1021 1042 return apply_filters( 'bbp_get_topic_raw_revision_log', $revision_log, $topic_id ); 1022 1043 } … … 1038 1059 $revisions = wp_get_post_revisions( $topic_id, array( 'order' => 'ASC' ) ); 1039 1060 1061 // Filter & return 1040 1062 return apply_filters( 'bbp_get_topic_revisions', $revisions, $topic_id ); 1041 1063 } … … 1088 1110 } 1089 1111 1112 // Filter & return 1090 1113 return (bool) apply_filters( 'bbp_is_topic_sticky', $retval, $topic_id, $check_super ); 1091 1114 } … … 1104 1127 $topic_id = bbp_get_topic_id( $topic_id ); 1105 1128 $stickies = bbp_get_super_stickies( $topic_id ); 1106 $retval = in_array( $topic_id, $stickies ); 1107 1129 $retval = in_array( $topic_id, $stickies, true ); 1130 1131 // Filter & return 1108 1132 return (bool) apply_filters( 'bbp_is_topic_super_sticky', $retval, $topic_id ); 1109 1133 } … … 1135 1159 $topic_id = bbp_get_topic_id( $topic_id ); 1136 1160 1161 // Filter & return 1137 1162 return apply_filters( 'bbp_get_topic_status', get_post_status( $topic_id ), $topic_id ); 1138 1163 } … … 1149 1174 */ 1150 1175 function bbp_get_public_topic_statuses() { 1151 $statuses = array( bbp_get_public_status_id(), bbp_get_closed_status_id() ); 1152 1176 $statuses = array( 1177 bbp_get_public_status_id(), 1178 bbp_get_closed_status_id() 1179 ); 1180 1181 // Filter & return 1153 1182 return (array) apply_filters( 'bbp_get_public_topic_statuses', $statuses ); 1154 1183 } … … 1168 1197 $topic_id = bbp_get_topic_id( $topic_id ); 1169 1198 $status = bbp_get_closed_status_id(); 1170 $topic_status = bbp_get_topic_status( $topic_id ) === $status; 1171 1172 return (bool) apply_filters( 'bbp_is_topic_closed', (bool) $topic_status, $topic_id ); 1199 $topic_status = ( bbp_get_topic_status( $topic_id ) === $status ); 1200 1201 // Filter & return 1202 return (bool) apply_filters( 'bbp_is_topic_closed', $topic_status, $topic_id ); 1173 1203 } 1174 1204 … … 1205 1235 $is_public = in_array( $status, $public, true ); 1206 1236 1207 return (bool) apply_filters( 'bbp_is_topic_public', (bool) $is_public, $topic_id ); 1237 // Filter & return 1238 return (bool) apply_filters( 'bbp_is_topic_public', $is_public, $topic_id ); 1208 1239 } 1209 1240 … … 1222 1253 $topic_id = bbp_get_topic_id( $topic_id ); 1223 1254 $status = bbp_get_public_status_id(); 1224 $topic_status = bbp_get_topic_status( $topic_id ) === $status; 1225 1226 return (bool) apply_filters( 'bbp_is_topic_published', (bool) $topic_status, $topic_id ); 1255 $topic_status = ( bbp_get_topic_status( $topic_id ) === $status ); 1256 1257 // Filter & return 1258 return (bool) apply_filters( 'bbp_is_topic_published', $topic_status, $topic_id ); 1227 1259 } 1228 1260 … … 1241 1273 $topic_id = bbp_get_topic_id( $topic_id ); 1242 1274 $status = bbp_get_spam_status_id(); 1243 $topic_status = bbp_get_topic_status( $topic_id ) === $status; 1244 1245 return (bool) apply_filters( 'bbp_is_topic_spam', (bool) $topic_status, $topic_id ); 1275 $topic_status = ( bbp_get_topic_status( $topic_id ) === $status ); 1276 1277 // Filter & return 1278 return (bool) apply_filters( 'bbp_is_topic_spam', $topic_status, $topic_id ); 1246 1279 } 1247 1280 … … 1260 1293 $topic_id = bbp_get_topic_id( $topic_id ); 1261 1294 $status = bbp_get_trash_status_id(); 1262 $topic_status = bbp_get_topic_status( $topic_id ) === $status; 1263 1264 return (bool) apply_filters( 'bbp_is_topic_trash', (bool) $topic_status, $topic_id ); 1295 $topic_status = ( bbp_get_topic_status( $topic_id ) === $status ); 1296 1297 // Filter & return 1298 return (bool) apply_filters( 'bbp_is_topic_trash', $topic_status, $topic_id ); 1265 1299 } 1266 1300 … … 1279 1313 $topic_id = bbp_get_topic_id( $topic_id ); 1280 1314 $status = bbp_get_pending_status_id(); 1281 $topic_status = bbp_get_topic_status( $topic_id ) === $status; 1282 1283 return (bool) apply_filters( 'bbp_is_topic_pending', (bool) $topic_status, $topic_id ); 1315 $topic_status = ( bbp_get_topic_status( $topic_id ) === $status ); 1316 1317 // Filter & return 1318 return (bool) apply_filters( 'bbp_is_topic_pending', $topic_status, $topic_id ); 1284 1319 } 1285 1320 … … 1298 1333 $topic_id = bbp_get_topic_id( $topic_id ); 1299 1334 $status = bbp_get_private_status_id(); 1300 $topic_status = bbp_get_topic_status( $topic_id ) === $status; 1301 1302 return (bool) apply_filters( 'bbp_is_topic_private', (bool) $topic_status, $topic_id ); 1335 $topic_status = ( bbp_get_topic_status( $topic_id ) === $status ); 1336 1337 // Filter & return 1338 return (bool) apply_filters( 'bbp_is_topic_private', $topic_status, $topic_id ); 1303 1339 } 1304 1340 … … 1329 1365 } 1330 1366 1331 // The topic is by an anonymous user1367 // Filter & return 1332 1368 return (bool) apply_filters( 'bbp_is_topic_anonymous', $retval, $topic_id ); 1333 1369 } … … 1377 1413 } 1378 1414 1415 // Filter & return 1379 1416 return apply_filters( 'bbp_get_topic_author', $author, $topic_id ); 1380 1417 } … … 1407 1444 $author_id = get_post_field( 'post_author', $topic_id ); 1408 1445 1446 // Filter & return 1409 1447 return (int) apply_filters( 'bbp_get_topic_author_id', (int) $author_id, $topic_id ); 1410 1448 } … … 1470 1508 } 1471 1509 1510 // Filter & return 1472 1511 return apply_filters( 'bbp_get_topic_author_display_name', $author_name, $topic_id ); 1473 1512 } … … 1514 1553 } 1515 1554 1555 // Filter & return 1516 1556 return apply_filters( 'bbp_get_topic_author_avatar', $author_avatar, $topic_id, $size ); 1517 1557 } … … 1627 1667 } 1628 1668 1669 // Filter & return 1629 1670 return apply_filters( 'bbp_get_topic_author_link', $author_link, $args ); 1630 1671 } … … 1674 1715 } 1675 1716 1717 // Filter & return 1676 1718 return apply_filters( 'bbp_get_topic_author_url', $author_url, $topic_id ); 1677 1719 } … … 1727 1769 } 1728 1770 1771 // Filter & return 1729 1772 return apply_filters( 'bbp_get_topic_author_email', $author_email, $topic_id ); 1730 1773 } … … 1777 1820 } 1778 1821 1822 // Filter & return 1779 1823 return apply_filters( 'bbp_get_topic_author_role', $author_role, $r ); 1780 1824 } … … 1808 1852 $forum_id = bbp_get_topic_forum_id( $topic_id ); 1809 1853 1854 // Filter & return 1810 1855 return apply_filters( 'bbp_get_topic_forum', bbp_get_forum_title( $forum_id ), $topic_id, $forum_id ); 1811 1856 } … … 1838 1883 $forum_id = get_post_meta( $topic_id, '_bbp_forum_id', true ); 1839 1884 1885 // Filter & return 1840 1886 return (int) apply_filters( 'bbp_get_topic_forum_id', (int) $forum_id, $topic_id ); 1841 1887 } … … 1868 1914 $active_id = get_post_meta( $topic_id, '_bbp_last_active_id', true ); 1869 1915 1916 // Filter & return 1870 1917 return (int) apply_filters( 'bbp_get_topic_last_active_id', (int) $active_id, $topic_id ); 1871 1918 } … … 1914 1961 $last_active = ! empty( $last_active ) ? bbp_get_time_since( bbp_convert_date( $last_active ) ) : ''; 1915 1962 1916 // Return the time since1963 // Filter & return 1917 1964 return apply_filters( 'bbp_get_topic_last_active', $last_active, $topic_id ); 1918 1965 } … … 1968 2015 $retval = bbp_get_user_subscribe_link( $r ); 1969 2016 2017 // Filter & return 1970 2018 return apply_filters( 'bbp_get_topic_subscribe_link', $retval, $r, $args ); 1971 2019 } … … 2021 2069 $retval = bbp_get_user_favorites_link( $r ); 2022 2070 2071 // Filter & return 2023 2072 return apply_filters( 'bbp_get_topic_favorite_link', $retval, $r, $args ); 2024 2073 } … … 2053 2102 $reply_id = get_post_meta( $topic_id, '_bbp_last_reply_id', true ); 2054 2103 2104 // Filter & return 2055 2105 return (int) apply_filters( 'bbp_get_topic_last_reply_id', (int) $reply_id, $topic_id ); 2056 2106 } … … 2089 2139 $retval = apply_filters( 'bbp_get_topic_last_topic_title', $retval, $topic_id, $reply_id ); 2090 2140 2141 // Filter & return 2091 2142 return apply_filters( 'bbp_get_topic_last_reply_title', $retval, $topic_id, $reply_id ); 2092 2143 } … … 2121 2172 $retval = bbp_get_reply_permalink( $reply_id ); 2122 2173 2174 // Filter & return 2123 2175 return apply_filters( 'bbp_get_topic_last_reply_permalink', $retval, $topic_id, $reply_id ); 2124 2176 } … … 2159 2211 } 2160 2212 2213 // Filter & return 2161 2214 return apply_filters( 'bbp_get_topic_last_reply_url', $reply_url, $topic_id, $reply_id ); 2162 2215 } … … 2201 2254 } 2202 2255 2256 // Filter & return 2203 2257 return apply_filters( 'bbp_get_topic_freshness_link', $anchor, $topic_id, $time_since, $link_url, $title ); 2204 2258 } … … 2258 2312 } 2259 2313 2314 // Filter & return 2260 2315 return apply_filters( 'bbp_get_topic_replies_link', $retval, $topic_id ); 2261 2316 } … … 2595 2650 $retval = $r['before'] . $links . $r['after']; 2596 2651 2652 // Filter & return 2597 2653 return apply_filters( 'bbp_get_topic_admin_links', $retval, $r, $args ); 2598 2654 } … … 2661 2717 $retval = $r['link_before'] . '<a href="' . esc_url( $uri ) . '" class="bbp-topic-edit-link">' . $r['edit_text'] . '</a>' . $r['link_after']; 2662 2718 2719 // Filter & return 2663 2720 return apply_filters( 'bbp_get_topic_edit_link', $retval, $r, $args ); 2664 2721 } … … 2715 2772 $url = bbp_add_view_all( $url ); 2716 2773 2774 // Filter & return 2717 2775 return apply_filters( 'bbp_get_topic_edit_url', $url, $topic_id ); 2718 2776 } … … 2793 2851 $retval = $r['link_before'] . implode( $r['sep'], $actions ) . $r['link_after']; 2794 2852 2853 // Filter & return 2795 2854 return apply_filters( 'bbp_get_topic_trash_link', $retval, $r, $args ); 2796 2855 } … … 2855 2914 $retval = $r['link_before'] . '<a href="' . esc_url( $uri ) . '" class="bbp-topic-close-link">' . $display . '</a>' . $r['link_after']; 2856 2915 2916 // Filter & return 2857 2917 return apply_filters( 'bbp_get_topic_close_link', $retval, $r, $args ); 2858 2918 } … … 2918 2978 $retval = $r['link_before'] . '<a href="' . esc_url( $uri ) . '" class="bbp-topic-approve-link">' . $display . '</a>' . $r['link_after']; 2919 2979 2980 // Filter & return 2920 2981 return apply_filters( 'bbp_get_topic_approve_link', $retval, $r, $args ); 2921 2982 } … … 2997 3058 $retval = $r['link_before'] . $stick_display . $super_display . $r['link_after']; 2998 3059 3060 // Filter & return 2999 3061 return apply_filters( 'bbp_get_topic_stick_link', $retval, $r, $args ); 3000 3062 } … … 3052 3114 $retval = $r['link_before'] . '<a href="' . esc_url( $uri ) . '" class="bbp-topic-merge-link">' . $r['merge_text'] . '</a>' . $r['link_after']; 3053 3115 3116 // Filter & return 3054 3117 return apply_filters( 'bbp_get_topic_merge_link', $retval, $r, $args ); 3055 3118 } … … 3112 3175 $retval = $r['link_before'] . '<a href="' . esc_url( $uri ) . '" class="bbp-topic-spam-link">' . $display . '</a>' . $r['link_after']; 3113 3176 3177 // Filter & return 3114 3178 return apply_filters( 'bbp_get_topic_spam_link', $retval, $r, $args ); 3115 3179 } … … 3162 3226 $retval = $r['link_before'] . '<a role="button" href="' . esc_url( $r['uri'] ) . '" class="bbp-topic-reply-link">' . $r['reply_text'] . '</a>' . $r['link_after']; 3163 3227 3228 // Filter & return 3164 3229 return apply_filters( 'bbp_get_topic_reply_link', $retval, $r, $args ); 3165 3230 } … … 3233 3298 } 3234 3299 3300 // Filter & return 3235 3301 return apply_filters( 'bbp_get_topics_pagination_base', $base ); 3236 3302 } … … 3279 3345 } 3280 3346 3281 // Filter andreturn3347 // Filter & return 3282 3348 return apply_filters( 'bbp_get_forum_pagination_count', $retstr ); 3283 3349 } … … 3308 3374 } 3309 3375 3376 // Filter & return 3310 3377 return apply_filters( 'bbp_get_forum_pagination_links', $bbp->topic_query->pagination_links ); 3311 3378 } … … 3464 3531 <?php 3465 3532 3466 // Return the results3533 // Filter & return 3467 3534 return apply_filters( 'bbp_get_form_topic_type_dropdown', ob_get_clean(), $r, $args ); 3468 3535 } … … 3545 3612 <?php 3546 3613 3547 // Return the results3614 // Filter & return 3548 3615 return apply_filters( 'bbp_get_form_topic_status_dropdown', ob_get_clean(), $r, $args ); 3549 3616 } … … 3630 3697 $retstr = $r['before'] . $retstr . $r['after']; 3631 3698 3632 // Return filtered result3699 // Filter & return 3633 3700 return apply_filters( 'bbp_get_single_topic_description', $retstr, $r, $args ); 3634 3701 } … … 3655 3722 */ 3656 3723 function bbp_get_topic_tag_tax_id() { 3724 3725 // Filter & return 3657 3726 return apply_filters( 'bbp_get_topic_tag_tax_id', bbpress()->topic_tag_tax_id ); 3658 3727 } … … 3666 3735 */ 3667 3736 function bbp_get_topic_tag_tax_labels() { 3668 return apply_filters( 'bbp_get_topic_tag_tax_labels', array( 3737 3738 // Filter & return 3739 return (array) apply_filters( 'bbp_get_topic_tag_tax_labels', array( 3669 3740 'name' => __( 'Topic Tags', 'bbpress' ), 3670 3741 'singular_name' => __( 'Topic Tag', 'bbpress' ), … … 3692 3763 */ 3693 3764 function bbp_get_topic_tag_tax_rewrite() { 3694 return apply_filters( 'bbp_get_topic_tag_tax_rewrite', array( 3765 3766 // Filter & return 3767 return (array) apply_filters( 'bbp_get_topic_tag_tax_rewrite', array( 3695 3768 'slug' => bbp_get_topic_tag_tax_slug(), 3696 3769 'with_front' => false … … 3735 3808 : 0; 3736 3809 3810 // Filter & return 3737 3811 return (int) apply_filters( 'bbp_get_topic_tag_id', (int) $retval, $tag, $term ); 3738 3812 } … … 3775 3849 : ''; 3776 3850 3851 // Filter & return 3777 3852 return apply_filters( 'bbp_get_topic_tag_name', $retval, $tag, $term ); 3778 3853 } … … 3815 3890 : ''; 3816 3891 3892 // Filter & return 3817 3893 return apply_filters( 'bbp_get_topic_tag_slug', $retval, $tag, $term ); 3818 3894 } … … 3855 3931 : ''; 3856 3932 3933 // Filter & return 3857 3934 return apply_filters( 'bbp_get_topic_tag_link', $retval, $tag, $term ); 3858 3935 } … … 3903 3980 } 3904 3981 3982 // Filter & return 3905 3983 return apply_filters( 'bbp_get_topic_tag_edit_link', $retval, $tag, $term ); 3906 3984 } … … 3951 4029 : ''; 3952 4030 4031 // Filter & return 3953 4032 return apply_filters( 'bbp_get_topic_tag_description', $retval, $r, $args, $tag, $term ); 3954 4033 } … … 3990 4069 } 3991 4070 4071 // Filter & return 3992 4072 return apply_filters( 'bbp_get_form_topic_title', $topic_title ); 3993 4073 } … … 4027 4107 } 4028 4108 4109 // Filter & return 4029 4110 return apply_filters( 'bbp_get_form_topic_content', $topic_content ); 4030 4111 } … … 4104 4185 } 4105 4186 4187 // Filter & return 4106 4188 return apply_filters( 'bbp_get_form_topic_tags', $topic_tags ); 4107 4189 } … … 4142 4224 } 4143 4225 4226 // Filter & return 4144 4227 return apply_filters( 'bbp_get_form_topic_forum', $topic_forum ); 4145 4228 } … … 4200 4283 $checked = checked( $topic_subscribed, true, false ); 4201 4284 4285 // Filter & return 4202 4286 return apply_filters( 'bbp_get_form_topic_subscribed', $checked, $topic_subscribed ); 4203 4287 } … … 4236 4320 $checked = checked( $topic_revision, true, false ); 4237 4321 4322 // Filter & return 4238 4323 return apply_filters( 'bbp_get_form_topic_log_edit', $checked, $topic_revision ); 4239 4324 } … … 4269 4354 } 4270 4355 4356 // Filter & return 4271 4357 return apply_filters( 'bbp_get_form_topic_edit_reason', $topic_edit_reason ); 4272 4358 } … … 4337 4423 } 4338 4424 4425 // Filter & return 4339 4426 return (bool) apply_filters( 'bbp_show_topic_lock_alert', $retval, $topic_id ); 4340 4427 } … … 4369 4456 $text = sprintf( esc_html__( '%1$s is currently editing this topic.', 'bbpress' ), $person ); 4370 4457 4458 // Filter & return 4371 4459 return apply_filters( 'bbp_get_topic_lock_description', $text, $user_id, $topic_id ); 4372 4460 }
Note: See TracChangeset
for help on using the changeset viewer.