| @@ -1,8 +1,8 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | /** |
| 4 | - * bbPress Topic Functions. | |
| 4 | + * bbPress Topic Functions | |
| 5 | 5 | * |
| 6 | 6 | * @package bbPress |
| 7 | 7 | * @subpackage Functions |
| 8 | 8 | */ |
| @@ -17,12 +17,10 @@ | ||
| 17 | 17 | * for the topic to function properly. |
| 18 | 18 | * |
| 19 | 19 | * @since 2.0.0 bbPress (r3349) |
| 20 | 20 | * |
| 21 | - * @param array $topic_data Forum post data. | |
| 22 | - * @param array $topic_meta Forum meta data. | |
| 23 | - * | |
| 24 | - * @return int|false Topic ID on success, false on failure. | |
| 21 | + * @param array $topic_data Forum post data | |
| 22 | + * @param array $topic_meta Forum meta data | |
| 25 | 23 | */ |
| 26 | 24 | function bbp_insert_topic( $topic_data = array(), $topic_meta = array() ) { |
| 27 | 25 | |
| 28 | 26 | // Parse arguments against default values |
| @@ -98,11 +96,11 @@ | ||
| 98 | 96 | |
| 99 | 97 | /** Post Form Handlers ********************************************************/ |
| 100 | 98 | |
| 101 | 99 | /** |
| 102 | - * Handles the front end topic submission. | |
| 100 | + * Handles the front end topic submission | |
| 103 | 101 | * |
| 104 | - * @param string $action The requested action to compare this function to. | |
| 102 | + * @param string $action The requested action to compare this function to | |
| 105 | 103 | */ |
| 106 | 104 | function bbp_new_topic_handler( $action = '' ) { |
| 107 | 105 | |
| 108 | 106 | // Bail if action is not bbp-new-topic |
| @@ -205,9 +203,9 @@ | ||
| 205 | 203 | |
| 206 | 204 | // Get the forum id |
| 207 | 205 | $posted_forum_id = intval( $_POST['bbp_forum_id'] ); |
| 208 | 206 | |
| 209 | - // Forum id is 0 | |
| 207 | + // Forum id is empty | |
| 210 | 208 | if ( 0 === $posted_forum_id ) { |
| 211 | 209 | bbp_add_error( 'bbp_topic_forum_id', __( '<strong>Error</strong>: Forum ID is missing.', 'bbpress' ) ); |
| 212 | 210 | |
| 213 | 211 | // Forum id is a negative number |
| @@ -234,20 +232,20 @@ | ||
| 234 | 232 | |
| 235 | 233 | // Forum is not a category |
| 236 | 234 | } else { |
| 237 | 235 | |
| 238 | - // Forum not editable by user | |
| 239 | - if ( ! current_user_can( 'edit_forum', $forum_id ) ) { | |
| 236 | + // Forum is closed and user cannot access | |
| 237 | + if ( bbp_is_forum_closed( $forum_id ) && ! current_user_can( 'edit_forum', $forum_id ) ) { | |
| 238 | + bbp_add_error( 'bbp_new_topic_forum_closed', __( '<strong>Error</strong>: This forum has been closed to new topics.', 'bbpress' ) ); | |
| 239 | + } | |
| 240 | 240 | |
| 241 | - // Forum is closed | |
| 242 | - if ( bbp_is_forum_closed( $forum_id ) ) { | |
| 243 | - bbp_add_error( 'bbp_new_topic_forum_closed', __( '<strong>Error</strong>: This forum is closed to new topics.', 'bbpress' ) ); | |
| 244 | - } | |
| 245 | - } | |
| 241 | + // Forum is private and user cannot access | |
| 242 | + if ( bbp_is_forum_private( $forum_id ) && ! current_user_can( 'read_forum', $forum_id ) ) { | |
| 243 | + bbp_add_error( 'bbp_new_topic_forum_private', __( '<strong>Error</strong>: This forum is private and you do not have the capability to read or create new topics in it.', 'bbpress' ) ); | |
| 246 | 244 | |
| 247 | - // Forum not readable by user | |
| 248 | - if ( ! current_user_can( 'read_forum', $forum_id ) ) { | |
| 249 | - bbp_add_error( 'bbp_new_topic_forum_read', __( '<strong>Error</strong>: You do not have the capability to read or create new topics in this forum.', 'bbpress' ) ); | |
| 245 | + // Forum is hidden and user cannot access | |
| 246 | + } elseif ( bbp_is_forum_hidden( $forum_id ) && ! current_user_can( 'read_forum', $forum_id ) ) { | |
| 247 | + bbp_add_error( 'bbp_new_topic_forum_hidden', __( '<strong>Error</strong>: This forum is hidden and you do not have the capability to read or create new topics in it.', 'bbpress' ) ); | |
| 250 | 248 | } |
| 251 | 249 | } |
| 252 | 250 | } |
| 253 | 251 | |
| @@ -434,11 +432,11 @@ | ||
| 434 | 432 | } |
| 435 | 433 | } |
| 436 | 434 | |
| 437 | 435 | /** |
| 438 | - * Handles the front end edit topic submission. | |
| 436 | + * Handles the front end edit topic submission | |
| 439 | 437 | * |
| 440 | - * @param string $action The requested action to compare this function to. | |
| 438 | + * @param string $action The requested action to compare this function to | |
| 441 | 439 | */ |
| 442 | 440 | function bbp_edit_topic_handler( $action = '' ) { |
| 443 | 441 | |
| 444 | 442 | // Bail if action is not bbp-edit-topic |
| @@ -506,48 +504,16 @@ | ||
| 506 | 504 | bbp_add_error( 'bbp_topic_forum_id', __( '<strong>Error</strong>: Forum ID is missing.', 'bbpress' ) ); |
| 507 | 505 | |
| 508 | 506 | // Forum id was passed |
| 509 | 507 | } elseif ( is_numeric( $_POST['bbp_forum_id'] ) ) { |
| 510 | - | |
| 511 | - // Get the forum id | |
| 512 | - $posted_forum_id = intval( $_POST['bbp_forum_id'] ); | |
| 513 | - | |
| 514 | - // Forum id is 0 | |
| 515 | - if ( 0 === $posted_forum_id ) { | |
| 516 | - bbp_add_error( 'bbp_topic_forum_id', __( '<strong>Error</strong>: Forum ID is missing.', 'bbpress' ) ); | |
| 517 | - | |
| 518 | - // Forum id is a negative number | |
| 519 | - } elseif ( 0 > $posted_forum_id ) { | |
| 520 | - bbp_add_error( 'bbp_topic_forum_id', __( '<strong>Error</strong>: Forum ID cannot be a negative number.', 'bbpress' ) ); | |
| 521 | - | |
| 522 | - // Forum does not exist | |
| 523 | - } elseif ( ! bbp_get_forum( $posted_forum_id ) ) { | |
| 524 | - bbp_add_error( 'bbp_topic_forum_id', __( '<strong>Error</strong>: Forum does not exist.', 'bbpress' ) ); | |
| 525 | - | |
| 526 | - // Use the POST'ed forum id | |
| 527 | - } else { | |
| 528 | - $forum_id = $posted_forum_id; | |
| 529 | - } | |
| 508 | + $forum_id = (int) $_POST['bbp_forum_id']; | |
| 530 | 509 | } |
| 531 | 510 | |
| 532 | 511 | // Current forum this topic is in |
| 533 | 512 | $current_forum_id = bbp_get_topic_forum_id( $topic_id ); |
| 534 | 513 | |
| 535 | - // Forum change | |
| 536 | - if ( $forum_id !== $current_forum_id ) { | |
| 537 | - | |
| 538 | - // User cannot edit current forum | |
| 539 | - if ( ! current_user_can( 'edit_forum', $current_forum_id ) ) { | |
| 540 | - bbp_add_error( 'bbp_edit_topic_forum_move_old', __( '<strong>Error</strong>: You do not have the capability to move topics out of this forum.', 'bbpress' ) ); | |
| 541 | - | |
| 542 | - // User cannot read new forum | |
| 543 | - } elseif ( ! current_user_can( 'read_forum', $forum_id ) ) { | |
| 544 | - bbp_add_error( 'bbp_edit_topic_forum_move_new', __( '<strong>Error</strong>: You do not have the capability to move topics into this forum.', 'bbpress' ) ); | |
| 545 | - } | |
| 546 | - } | |
| 547 | - | |
| 548 | 514 | // Forum exists |
| 549 | - if ( ! empty( $forum_id ) ) { | |
| 515 | + if ( ! empty( $forum_id ) && ( $forum_id !== $current_forum_id ) ) { | |
| 550 | 516 | |
| 551 | 517 | // Forum is a category |
| 552 | 518 | if ( bbp_is_forum_category( $forum_id ) ) { |
| 553 | 519 | bbp_add_error( 'bbp_edit_topic_forum_category', __( '<strong>Error</strong>: This forum is a category. No topics can be created in it.', 'bbpress' ) ); |
| @@ -554,20 +520,20 @@ | ||
| 554 | 520 | |
| 555 | 521 | // Forum is not a category |
| 556 | 522 | } else { |
| 557 | 523 | |
| 558 | - // Forum not editable by user | |
| 559 | - if ( ! current_user_can( 'edit_forum', $forum_id ) ) { | |
| 524 | + // Forum is closed and user cannot access | |
| 525 | + if ( bbp_is_forum_closed( $forum_id ) && ! current_user_can( 'edit_forum', $forum_id ) ) { | |
| 526 | + bbp_add_error( 'bbp_edit_topic_forum_closed', __( '<strong>Error</strong>: This forum has been closed to new topics.', 'bbpress' ) ); | |
| 527 | + } | |
| 560 | 528 | |
| 561 | - // Forum is closed | |
| 562 | - if ( bbp_is_forum_closed( $forum_id ) ) { | |
| 563 | - bbp_add_error( 'bbp_edit_topic_forum_closed', __( '<strong>Error</strong>: This forum is closed to new topics.', 'bbpress' ) ); | |
| 564 | - } | |
| 565 | - } | |
| 529 | + // Forum is private and user cannot access | |
| 530 | + if ( bbp_is_forum_private( $forum_id ) && ! current_user_can( 'read_forum', $forum_id ) ) { | |
| 531 | + bbp_add_error( 'bbp_edit_topic_forum_private', __( '<strong>Error</strong>: This forum is private and you do not have the capability to read or create new topics in it.', 'bbpress' ) ); | |
| 566 | 532 | |
| 567 | - // Forum not readable by user | |
| 568 | - if ( ! current_user_can( 'read_forum', $forum_id ) ) { | |
| 569 | - bbp_add_error( 'bbp_edit_topic_forum_read', __( '<strong>Error</strong>: You do not have the capability to read or create new topics in this forum.', 'bbpress' ) ); | |
| 533 | + // Forum is hidden and user cannot access | |
| 534 | + } elseif ( bbp_is_forum_hidden( $forum_id ) && ! current_user_can( 'read_forum', $forum_id ) ) { | |
| 535 | + bbp_add_error( 'bbp_edit_topic_forum_hidden', __( '<strong>Error</strong>: This forum is hidden and you do not have the capability to read or create new topics in it.', 'bbpress' ) ); | |
| 570 | 536 | } |
| 571 | 537 | } |
| 572 | 538 | } |
| 573 | 539 | |
| @@ -696,8 +662,12 @@ | ||
| 696 | 662 | do_action( 'bbp_edit_topic', $topic_id, $forum_id, $anonymous_data, $topic_data['post_author'], true /* Is edit */ ); |
| 697 | 663 | |
| 698 | 664 | /** Revisions *********************************************************/ |
| 699 | 665 | |
| 666 | + // Update locks | |
| 667 | + update_post_meta( $topic_id, '_edit_last', bbp_get_current_user_id() ); | |
| 668 | + delete_post_meta( $topic_id, '_edit_lock' ); | |
| 669 | + | |
| 700 | 670 | // Revision Reason |
| 701 | 671 | if ( ! empty( $_POST['bbp_topic_edit_reason'] ) ) { |
| 702 | 672 | $topic_edit_reason = sanitize_text_field( $_POST['bbp_topic_edit_reason'] ); |
| 703 | 673 | } |
| @@ -757,22 +727,28 @@ | ||
| 757 | 727 | /** Errors ****************************************************************/ |
| 758 | 728 | |
| 759 | 729 | } else { |
| 760 | 730 | $append_error = ( is_wp_error( $topic_id ) && $topic_id->get_error_message() ) ? $topic_id->get_error_message() . ' ' : ''; |
| 761 | - /* translators: %s: Error message(s) */ | |
| 762 | - bbp_add_error( 'bbp_topic_error', sprintf( esc_html_e( '<strong>Error</strong>: The following problem(s) have been found with your topic: %s. Please try again.', 'bbpress' ) ), $append_error ); | |
| 731 | + bbp_add_error( | |
| 732 | + 'bbp_topic_error', | |
| 733 | + sprintf( | |
| 734 | + /* translators: %s: Error message */ | |
| 735 | + __( '<strong>Error</strong>: The following problem(s) have been found with your topic: %sPlease try again.', 'bbpress' ), | |
| 736 | + $append_error | |
| 737 | + ) | |
| 738 | + ); | |
| 763 | 739 | } |
| 764 | 740 | } |
| 765 | 741 | |
| 766 | 742 | /** |
| 767 | - * Handle all the extra meta stuff from posting a new topic. | |
| 743 | + * Handle all the extra meta stuff from posting a new topic | |
| 768 | 744 | * |
| 769 | - * @param int $topic_id Optional. Topic id. | |
| 770 | - * @param int $forum_id Optional. Forum id. | |
| 745 | + * @param int $topic_id Optional. Topic id | |
| 746 | + * @param int $forum_id Optional. Forum id | |
| 771 | 747 | * @param array $anonymous_data Optional - if it's an anonymous post. Do not |
| 772 | 748 | * supply if supplying $author_id. Should be |
| 773 | 749 | * sanitized (see {@link bbp_filter_anonymous_post_data()} |
| 774 | - * @param int $author_id Author id. | |
| 750 | + * @param int $author_id Author id | |
| 775 | 751 | * @param bool $is_edit Optional. Is the post being edited? Defaults to false. |
| 776 | 752 | */ |
| 777 | 753 | function bbp_update_topic( $topic_id = 0, $forum_id = 0, $anonymous_data = array(), $author_id = 0, $is_edit = false ) { |
| 778 | 754 | |
| @@ -779,34 +755,53 @@ | ||
| 779 | 755 | // Validate the ID's passed from 'bbp_new_topic' action |
| 780 | 756 | $topic_id = bbp_get_topic_id( $topic_id ); |
| 781 | 757 | $forum_id = bbp_get_forum_id( $forum_id ); |
| 782 | 758 | |
| 783 | - // Get the current user ID | |
| 784 | - $user_id = bbp_get_current_user_id(); | |
| 785 | - | |
| 786 | 759 | // Bail if there is no topic |
| 787 | 760 | if ( empty( $topic_id ) ) { |
| 788 | 761 | return; |
| 789 | 762 | } |
| 790 | 763 | |
| 791 | - // Check author_id, fallback to current user ID | |
| 764 | + // Check author_id | |
| 792 | 765 | if ( empty( $author_id ) ) { |
| 793 | - $author_id = $user_id; | |
| 766 | + $author_id = bbp_get_current_user_id(); | |
| 794 | 767 | } |
| 795 | 768 | |
| 796 | - // Check forum_id, fallback to post_parent or meta | |
| 797 | - if ( empty( $forum_id ) ) { | |
| 798 | - $forum_id = bbp_get_topic_forum_id( $topic_id ); | |
| 799 | - } | |
| 800 | - | |
| 801 | - // Update locks | |
| 802 | - update_post_meta( $topic_id, '_edit_last', $user_id ); | |
| 803 | - delete_post_meta( $topic_id, '_edit_lock' ); | |
| 804 | - | |
| 805 | 769 | // Forum/Topic meta (early, for use in downstream functions) |
| 806 | 770 | bbp_update_topic_forum_id( $topic_id, $forum_id ); |
| 807 | 771 | bbp_update_topic_topic_id( $topic_id, $topic_id ); |
| 808 | 772 | |
| 773 | + // Get the topic types | |
| 774 | + $topic_types = bbp_get_topic_types( $topic_id ); | |
| 775 | + | |
| 776 | + // Sticky check after 'bbp_new_topic' action so forum ID meta is set | |
| 777 | + if ( ! empty( $_POST['bbp_stick_topic'] ) && in_array( $_POST['bbp_stick_topic'], array_keys( $topic_types ), true ) ) { | |
| 778 | + | |
| 779 | + // What's the caps? | |
| 780 | + if ( current_user_can( 'moderate', $topic_id ) ) { | |
| 781 | + | |
| 782 | + // What's the haps? | |
| 783 | + switch ( $_POST['bbp_stick_topic'] ) { | |
| 784 | + | |
| 785 | + // Sticky in this forum | |
| 786 | + case 'stick' : | |
| 787 | + bbp_stick_topic( $topic_id ); | |
| 788 | + break; | |
| 789 | + | |
| 790 | + // Super sticky in all forums | |
| 791 | + case 'super' : | |
| 792 | + bbp_stick_topic( $topic_id, true ); | |
| 793 | + break; | |
| 794 | + | |
| 795 | + // Unsticky from everywhere | |
| 796 | + case 'unstick' : | |
| 797 | + default : | |
| 798 | + bbp_unstick_topic( $topic_id ); | |
| 799 | + break; | |
| 800 | + } | |
| 801 | + } | |
| 802 | + } | |
| 803 | + | |
| 809 | 804 | // If anonymous post, store name, email, website and ip in post_meta. |
| 810 | 805 | if ( ! empty( $anonymous_data ) ) { |
| 811 | 806 | |
| 812 | 807 | // Update anonymous meta data (not cookies) |
| @@ -838,39 +833,8 @@ | ||
| 838 | 833 | bbp_add_user_subscription( $author_id, $topic_id ); |
| 839 | 834 | } |
| 840 | 835 | } |
| 841 | 836 | |
| 842 | - // Get the topic types | |
| 843 | - $topic_types = bbp_get_topic_types( $topic_id ); | |
| 844 | - | |
| 845 | - // Sticky check after 'bbp_new_topic' action so forum ID meta is set | |
| 846 | - if ( ! empty( $_POST['bbp_stick_topic'] ) && in_array( $_POST['bbp_stick_topic'], array_keys( $topic_types ), true ) ) { | |
| 847 | - | |
| 848 | - // What's the caps? | |
| 849 | - if ( current_user_can( 'moderate', $topic_id ) ) { | |
| 850 | - | |
| 851 | - // What's the haps? | |
| 852 | - switch ( $_POST['bbp_stick_topic'] ) { | |
| 853 | - | |
| 854 | - // Sticky in this forum | |
| 855 | - case 'stick' : | |
| 856 | - bbp_stick_topic( $topic_id ); | |
| 857 | - break; | |
| 858 | - | |
| 859 | - // Super sticky in all forums | |
| 860 | - case 'super' : | |
| 861 | - bbp_stick_topic( $topic_id, true ); | |
| 862 | - break; | |
| 863 | - | |
| 864 | - // Unsticky from everywhere | |
| 865 | - case 'unstick' : | |
| 866 | - default : | |
| 867 | - bbp_unstick_topic( $topic_id ); | |
| 868 | - break; | |
| 869 | - } | |
| 870 | - } | |
| 871 | - } | |
| 872 | - | |
| 873 | 837 | // Update associated topic values if this is a new topic |
| 874 | 838 | if ( empty( $is_edit ) ) { |
| 875 | 839 | |
| 876 | 840 | // Update poster activity time |
| @@ -906,12 +870,12 @@ | ||
| 906 | 870 | * function can be costly to run but is necessary to keep everything accurate. |
| 907 | 871 | * |
| 908 | 872 | * @since 2.0.0 bbPress (r2800) |
| 909 | 873 | * |
| 910 | - * @param int $topic_id Topic id. | |
| 911 | - * @param string $last_active_time Optional. Last active time. | |
| 912 | - * @param int $forum_id Optional. Forum id. | |
| 913 | - * @param int $reply_id Optional. Reply id. | |
| 874 | + * @param int $topic_id Topic id | |
| 875 | + * @param string $last_active_time Optional. Last active time | |
| 876 | + * @param int $forum_id Optional. Forum id | |
| 877 | + * @param int $reply_id Optional. Reply id | |
| 914 | 878 | * @param bool $refresh Reset all the previous parameters? Defaults to true. |
| 915 | 879 | */ |
| 916 | 880 | function bbp_update_topic_walker( $topic_id, $last_active_time = '', $forum_id = 0, $reply_id = 0, $refresh = true ) { |
| 917 | 881 | |
| @@ -1110,15 +1074,15 @@ | ||
| 1110 | 1074 | } |
| 1111 | 1075 | } |
| 1112 | 1076 | |
| 1113 | 1077 | /** |
| 1114 | - * Merge topic handler. | |
| 1078 | + * Merge topic handler | |
| 1115 | 1079 | * |
| 1116 | - * Handles the front end merge topic submission. | |
| 1080 | + * Handles the front end merge topic submission | |
| 1117 | 1081 | * |
| 1118 | 1082 | * @since 2.0.0 bbPress (r2756) |
| 1119 | 1083 | * |
| 1120 | - * @param string $action The requested action to compare this function to. | |
| 1084 | + * @param string $action The requested action to compare this function to | |
| 1121 | 1085 | */ |
| 1122 | 1086 | function bbp_merge_topic_handler( $action = '' ) { |
| 1123 | 1087 | |
| 1124 | 1088 | // Bail if action is not bbp-merge-topic |
| @@ -1396,15 +1360,16 @@ | ||
| 1396 | 1360 | do_action( 'bbp_merge_topic_count', $destination_topic_id, $source_topic_id, $source_topic_forum_id ); |
| 1397 | 1361 | } |
| 1398 | 1362 | |
| 1399 | 1363 | /** |
| 1400 | - * Split topic handler. | |
| 1364 | + * Split topic handler | |
| 1401 | 1365 | * |
| 1402 | - * Handles the front end split topic submission. | |
| 1366 | + * Handles the front end split topic submission | |
| 1403 | 1367 | * |
| 1404 | 1368 | * @since 2.0.0 bbPress (r2756) |
| 1369 | + * @since 2.6.17 Recount both forums and topic engagements. | |
| 1405 | 1370 | * |
| 1406 | - * @param string $action The requested action to compare this function to. | |
| 1371 | + * @param string $action The requested action to compare this function to | |
| 1407 | 1372 | */ |
| 1408 | 1373 | function bbp_split_topic_handler( $action = '' ) { |
| 1409 | 1374 | |
| 1410 | 1375 | // Bail if action is not 'bbp-split-topic' |
| @@ -1733,9 +1698,9 @@ | ||
| 1733 | 1698 | bbp_redirect( bbp_get_topic_permalink( $destination_topic->ID ) ); |
| 1734 | 1699 | } |
| 1735 | 1700 | |
| 1736 | 1701 | /** |
| 1737 | - * Fix counts on topic split. | |
| 1702 | + * Fix counts on topic split | |
| 1738 | 1703 | * |
| 1739 | 1704 | * When a topic is split, update the counts of source and destination topic |
| 1740 | 1705 | * and their forums. |
| 1741 | 1706 | * |
| @@ -1741,11 +1706,11 @@ | ||
| 1741 | 1706 | * |
| 1742 | 1707 | * @since 2.0.0 bbPress (r2756) |
| 1743 | 1708 | * @since 2.6.17 Recount both forums and topic engagements. |
| 1744 | 1709 | * |
| 1745 | - * @param int $from_reply_id From reply id. | |
| 1746 | - * @param int $source_topic_id Source topic id. | |
| 1747 | - * @param int $destination_topic_id Destination topic id. | |
| 1710 | + * @param int $from_reply_id From reply id | |
| 1711 | + * @param int $source_topic_id Source topic id | |
| 1712 | + * @param int $destination_topic_id Destination topic id | |
| 1748 | 1713 | */ |
| 1749 | 1714 | function bbp_split_topic_count( $from_reply_id, $source_topic_id, $destination_topic_id ) { |
| 1750 | 1715 | $source_forum_id = bbp_get_topic_forum_id( $source_topic_id ); |
| 1751 | 1716 | $destination_forum_id = bbp_get_topic_forum_id( $destination_topic_id ); |
| @@ -1786,13 +1751,13 @@ | ||
| 1786 | 1751 | do_action( 'bbp_split_topic_count', $from_reply_id, $source_topic_id, $destination_topic_id ); |
| 1787 | 1752 | } |
| 1788 | 1753 | |
| 1789 | 1754 | /** |
| 1790 | - * Handles the front end tag management (renaming, merging, destroying). | |
| 1755 | + * Handles the front end tag management (renaming, merging, destroying) | |
| 1791 | 1756 | * |
| 1792 | 1757 | * @since 2.0.0 bbPress (r2768) |
| 1793 | 1758 | * |
| 1794 | - * @param string $action The requested action to compare this function to. | |
| 1759 | + * @param string $action The requested action to compare this function to | |
| 1795 | 1760 | */ |
| 1796 | 1761 | function bbp_edit_topic_tag_handler( $action = '' ) { |
| 1797 | 1762 | |
| 1798 | 1763 | // Bail if required POST actions aren't passed |
| @@ -1840,16 +1805,18 @@ | ||
| 1840 | 1805 | bbp_add_error( 'bbp_manage_topic_tag_update_permission', __( '<strong>Error</strong>: You do not have permission to edit the topic tags.', 'bbpress' ) ); |
| 1841 | 1806 | return; |
| 1842 | 1807 | } |
| 1843 | 1808 | |
| 1809 | + // Unsanitized tag name | |
| 1810 | + $name = empty( $_POST['tag-name'] ) ? false : $_POST['tag-name']; | |
| 1811 | + | |
| 1844 | 1812 | // No tag name was provided |
| 1845 | - if ( empty( $_POST['tag-name'] ) || ! is_scalar( $_POST['tag-name'] ) ) { | |
| 1813 | + if ( empty( $_POST['tag-name'] ) || ! $name ) { | |
| 1846 | 1814 | bbp_add_error( 'bbp_manage_topic_tag_update_name', __( '<strong>Error</strong>: You need to enter a tag name.', 'bbpress' ) ); |
| 1847 | 1815 | return; |
| 1848 | 1816 | } |
| 1849 | 1817 | |
| 1850 | 1818 | // Attempt to update the tag |
| 1851 | - $name = $_POST['tag-name']; | |
| 1852 | 1819 | $slug = ! empty( $_POST['tag-slug'] ) ? $_POST['tag-slug'] : ''; |
| 1853 | 1820 | $description = ! empty( $_POST['tag-description'] ) ? $_POST['tag-description'] : ''; |
| 1854 | 1821 | $tag = wp_update_term( |
| 1855 | 1822 | $tag_id, |
| @@ -1890,20 +1857,20 @@ | ||
| 1890 | 1857 | bbp_add_error( 'bbp_manage_topic_tag_merge_permission', __( '<strong>Error</strong>: You do not have permission to edit the topic tags.', 'bbpress' ) ); |
| 1891 | 1858 | return; |
| 1892 | 1859 | } |
| 1893 | 1860 | |
| 1861 | + // Unsanitized name of existing tag | |
| 1862 | + $name = empty( $_POST['tag-existing-name'] ) ? false : $_POST['tag-existing-name']; | |
| 1863 | + | |
| 1894 | 1864 | // No tag name was provided |
| 1895 | - if ( empty( $_POST['tag-existing-name'] ) || ! is_scalar( $_POST['tag-existing-name'] ) ) { | |
| 1865 | + if ( empty( $_POST['tag-existing-name'] ) || ! $name ) { | |
| 1896 | 1866 | bbp_add_error( 'bbp_manage_topic_tag_merge_name', __( '<strong>Error</strong>: You need to enter a tag name.', 'bbpress' ) ); |
| 1897 | 1867 | return; |
| 1898 | 1868 | } |
| 1899 | 1869 | |
| 1900 | - // Unsanitized name of existing tag | |
| 1901 | - $name = $_POST['tag-existing-name']; | |
| 1902 | - | |
| 1903 | 1870 | // If term does not exist, create it |
| 1904 | 1871 | $tag = term_exists( $name, bbp_get_topic_tag_tax_id() ); |
| 1905 | - if ( empty( $tag ) ) { | |
| 1872 | + if ( ! $tag ) { | |
| 1906 | 1873 | $tag = wp_insert_term( $name, bbp_get_topic_tag_tax_id() ); |
| 1907 | 1874 | } |
| 1908 | 1875 | |
| 1909 | 1876 | // Problem inserting the new term |
| @@ -1983,12 +1950,9 @@ | ||
| 1983 | 1950 | |
| 1984 | 1951 | /** Successful Moderation *************************************************/ |
| 1985 | 1952 | |
| 1986 | 1953 | // Redirect back |
| 1987 | - $redirect = ( ! empty( $redirect ) && ! is_wp_error( $redirect ) ) | |
| 1988 | - ? $redirect | |
| 1989 | - : home_url(); | |
| 1990 | - | |
| 1954 | + $redirect = ( ! empty( $redirect ) && ! is_wp_error( $redirect ) ) ? $redirect : home_url(); | |
| 1991 | 1955 | bbp_redirect( $redirect ); |
| 1992 | 1956 | } |
| 1993 | 1957 | |
| 1994 | 1958 | /** Helpers *******************************************************************/ |
| @@ -1993,13 +1957,13 @@ | ||
| 1993 | 1957 | |
| 1994 | 1958 | /** Helpers *******************************************************************/ |
| 1995 | 1959 | |
| 1996 | 1960 | /** |
| 1997 | - * Return an associative array of available topic statuses. | |
| 1961 | + * Return an associative array of available topic statuses | |
| 1998 | 1962 | * |
| 1999 | 1963 | * @since 2.4.0 bbPress (r5059) |
| 2000 | 1964 | * |
| 2001 | - * @param int $topic_id Optional. Topic id. | |
| 1965 | + * @param int $topic_id Optional. Topic id. | |
| 2002 | 1966 | * |
| 2003 | 1967 | * @return array |
| 2004 | 1968 | */ |
| 2005 | 1969 | function bbp_get_topic_statuses( $topic_id = 0 ) { |
| @@ -2018,13 +1982,13 @@ | ||
| 2018 | 1982 | ); |
| 2019 | 1983 | } |
| 2020 | 1984 | |
| 2021 | 1985 | /** |
| 2022 | - * Return an associative array of topic sticky types. | |
| 1986 | + * Return an associative array of topic sticky types | |
| 2023 | 1987 | * |
| 2024 | 1988 | * @since 2.4.0 bbPress (r5059) |
| 2025 | 1989 | * |
| 2026 | - * @param int $topic_id Optional. Topic id. | |
| 1990 | + * @param int $topic_id Optional. Topic id. | |
| 2027 | 1991 | * |
| 2028 | 1992 | * @return array |
| 2029 | 1993 | */ |
| 2030 | 1994 | function bbp_get_topic_types( $topic_id = 0 ) { |
| @@ -2041,13 +2005,13 @@ | ||
| 2041 | 2005 | ); |
| 2042 | 2006 | } |
| 2043 | 2007 | |
| 2044 | 2008 | /** |
| 2045 | - * Return array of available topic toggle actions. | |
| 2009 | + * Return array of available topic toggle actions | |
| 2046 | 2010 | * |
| 2047 | 2011 | * @since 2.6.0 bbPress (r6133) |
| 2048 | 2012 | * |
| 2049 | - * @param int $topic_id Optional. Topic id. | |
| 2013 | + * @param int $topic_id Optional. Topic id. | |
| 2050 | 2014 | * |
| 2051 | 2015 | * @return array |
| 2052 | 2016 | */ |
| 2053 | 2017 | function bbp_get_topic_toggles( $topic_id = 0 ) { |
| @@ -2103,15 +2067,14 @@ | ||
| 2103 | 2067 | |
| 2104 | 2068 | /** Stickies ******************************************************************/ |
| 2105 | 2069 | |
| 2106 | 2070 | /** |
| 2107 | - * Return sticky topics of a forum. | |
| 2071 | + * Return sticky topics of a forum | |
| 2108 | 2072 | * |
| 2109 | 2073 | * @since 2.0.0 bbPress (r2592) |
| 2110 | 2074 | * |
| 2111 | 2075 | * @param int $forum_id Optional. If not passed, super stickies are returned. |
| 2112 | - * | |
| 2113 | - * @return array IDs of sticky topics of a forum or super stickies. | |
| 2076 | + * @return array IDs of sticky topics of a forum or super stickies | |
| 2114 | 2077 | */ |
| 2115 | 2078 | function bbp_get_stickies( $forum_id = 0 ) { |
| 2116 | 2079 | |
| 2117 | 2080 | // Get stickies (maybe super if empty) |
| @@ -2128,13 +2091,13 @@ | ||
| 2128 | 2091 | return (array) apply_filters( 'bbp_get_stickies', $stickies, $forum_id ); |
| 2129 | 2092 | } |
| 2130 | 2093 | |
| 2131 | 2094 | /** |
| 2132 | - * Return topics stuck to front page of the forums. | |
| 2095 | + * Return topics stuck to front page of the forums | |
| 2133 | 2096 | * |
| 2134 | 2097 | * @since 2.0.0 bbPress (r2592) |
| 2135 | 2098 | * |
| 2136 | - * @return array IDs of super sticky topics. | |
| 2099 | + * @return array IDs of super sticky topics | |
| 2137 | 2100 | */ |
| 2138 | 2101 | function bbp_get_super_stickies() { |
| 2139 | 2102 | |
| 2140 | 2103 | // Get super stickies |
| @@ -2152,13 +2115,13 @@ | ||
| 2152 | 2115 | /** Topics Actions ************************************************************/ |
| 2153 | 2116 | |
| 2154 | 2117 | /** |
| 2155 | 2118 | * Handles the front end opening/closing, spamming/unspamming, |
| 2156 | - * sticking/unsticking and trashing/untrashing/deleting of topics. | |
| 2119 | + * sticking/unsticking and trashing/untrashing/deleting of topics | |
| 2157 | 2120 | * |
| 2158 | 2121 | * @since 2.0.0 bbPress (r2727) |
| 2159 | 2122 | * |
| 2160 | - * @param string $action The requested action to compare this function to. | |
| 2123 | + * @param string $action The requested action to compare this function to | |
| 2161 | 2124 | */ |
| 2162 | 2125 | function bbp_toggle_topic_handler( $action = '' ) { |
| 2163 | 2126 | |
| 2164 | 2127 | // Bail if required GET actions aren't passed |
| @@ -2221,9 +2184,9 @@ | ||
| 2221 | 2184 | } |
| 2222 | 2185 | } |
| 2223 | 2186 | |
| 2224 | 2187 | /** |
| 2225 | - * Do the actual topic toggling. | |
| 2188 | + * Do the actual topic toggling | |
| 2226 | 2189 | * |
| 2227 | 2190 | * This function is used by `bbp_toggle_topic_handler()` to do the actual heavy |
| 2228 | 2191 | * lifting when it comes to toggling topic. It only really makes sense to call |
| 2229 | 2192 | * within that context, so if you need to call this function directly, make sure |
| @@ -2385,13 +2348,13 @@ | ||
| 2385 | 2348 | |
| 2386 | 2349 | /** Favorites & Subscriptions *************************************************/ |
| 2387 | 2350 | |
| 2388 | 2351 | /** |
| 2389 | - * Remove a deleted topic from all user favorites. | |
| 2352 | + * Remove a deleted topic from all user favorites | |
| 2390 | 2353 | * |
| 2391 | 2354 | * @since 2.0.0 bbPress (r2652) |
| 2392 | 2355 | * |
| 2393 | - * @param int $topic_id Get the topic id to remove. | |
| 2356 | + * @param int $topic_id Get the topic id to remove | |
| 2394 | 2357 | */ |
| 2395 | 2358 | function bbp_remove_topic_from_all_favorites( $topic_id = 0 ) { |
| 2396 | 2359 | $topic_id = bbp_get_topic_id( $topic_id ); |
| 2397 | 2360 | |
| @@ -2415,13 +2378,13 @@ | ||
| 2415 | 2378 | } |
| 2416 | 2379 | } |
| 2417 | 2380 | |
| 2418 | 2381 | /** |
| 2419 | - * Remove a deleted topic from all user subscriptions. | |
| 2382 | + * Remove a deleted topic from all user subscriptions | |
| 2420 | 2383 | * |
| 2421 | 2384 | * @since 2.0.0 bbPress (r2652) |
| 2422 | 2385 | * |
| 2423 | - * @param int $topic_id Get the topic id to remove. | |
| 2386 | + * @param int $topic_id Get the topic id to remove | |
| 2424 | 2387 | */ |
| 2425 | 2388 | function bbp_remove_topic_from_all_subscriptions( $topic_id = 0 ) { |
| 2426 | 2389 | |
| 2427 | 2390 | // Subscriptions are not active |
| @@ -2441,17 +2404,16 @@ | ||
| 2441 | 2404 | |
| 2442 | 2405 | /** Count Bumpers *************************************************************/ |
| 2443 | 2406 | |
| 2444 | 2407 | /** |
| 2445 | - * Bump the total reply count of a topic. | |
| 2408 | + * Bump the total reply count of a topic | |
| 2446 | 2409 | * |
| 2447 | 2410 | * @since 2.1.0 bbPress (r3825) |
| 2448 | 2411 | * @since 2.6.17 Use atomic metadata writes and non-negative counts. |
| 2449 | 2412 | * |
| 2450 | 2413 | * @param int $topic_id Optional. Topic id. |
| 2451 | - * @param int $difference Optional. Default 1. | |
| 2452 | - * | |
| 2453 | - * @return int Topic reply count. | |
| 2414 | + * @param int $difference Optional. Default 1 | |
| 2415 | + * @return int Topic reply count | |
| 2454 | 2416 | */ |
| 2455 | 2417 | function bbp_bump_topic_reply_count( $topic_id = 0, $difference = 1 ) { |
| 2456 | 2418 | |
| 2457 | 2419 | // Bail if no bump |
| @@ -2477,8 +2439,10 @@ | ||
| 2477 | 2439 | * |
| 2478 | 2440 | * @since 2.6.0 bbPress (r6036) |
| 2479 | 2441 | * |
| 2480 | 2442 | * @param int $topic_id The topic id. |
| 2443 | + * | |
| 2444 | + * @return void | |
| 2481 | 2445 | */ |
| 2482 | 2446 | function bbp_increase_topic_reply_count( $topic_id = 0 ) { |
| 2483 | 2447 | |
| 2484 | 2448 | // Bail early if no id is passed. |
| @@ -2507,8 +2471,10 @@ | ||
| 2507 | 2471 | * |
| 2508 | 2472 | * @since 2.6.0 bbPress (r6036) |
| 2509 | 2473 | * |
| 2510 | 2474 | * @param int $topic_id The topic id. |
| 2475 | + * | |
| 2476 | + * @return void | |
| 2511 | 2477 | */ |
| 2512 | 2478 | function bbp_decrease_topic_reply_count( $topic_id = 0 ) { |
| 2513 | 2479 | |
| 2514 | 2480 | // Bail early if no id is passed. |
| @@ -2532,17 +2498,16 @@ | ||
| 2532 | 2498 | bbp_bump_topic_reply_count( $topic_id, -1 ); |
| 2533 | 2499 | } |
| 2534 | 2500 | |
| 2535 | 2501 | /** |
| 2536 | - * Bump the total hidden reply count of a topic. | |
| 2502 | + * Bump the total hidden reply count of a topic | |
| 2537 | 2503 | * |
| 2538 | 2504 | * @since 2.1.0 bbPress (r3825) |
| 2539 | 2505 | * @since 2.6.17 Use atomic metadata writes and non-negative counts. |
| 2540 | 2506 | * |
| 2541 | 2507 | * @param int $topic_id Optional. Topic id. |
| 2542 | - * @param int $difference Optional. Default 1. | |
| 2543 | - * | |
| 2544 | - * @return int Topic hidden reply count. | |
| 2508 | + * @param int $difference Optional. Default 1 | |
| 2509 | + * @return int Topic hidden reply count | |
| 2545 | 2510 | */ |
| 2546 | 2511 | function bbp_bump_topic_reply_count_hidden( $topic_id = 0, $difference = 1 ) { |
| 2547 | 2512 | |
| 2548 | 2513 | // Bail if no bump |
| @@ -2568,8 +2533,10 @@ | ||
| 2568 | 2533 | * |
| 2569 | 2534 | * @since 2.6.0 bbPress (r6036) |
| 2570 | 2535 | * |
| 2571 | 2536 | * @param int $topic_id The topic id. |
| 2537 | + * | |
| 2538 | + * @return void | |
| 2572 | 2539 | */ |
| 2573 | 2540 | function bbp_increase_topic_reply_count_hidden( $topic_id = 0 ) { |
| 2574 | 2541 | |
| 2575 | 2542 | // Bail early if no id is passed. |
| @@ -2598,8 +2565,10 @@ | ||
| 2598 | 2565 | * |
| 2599 | 2566 | * @since 2.6.0 bbPress (r6036) |
| 2600 | 2567 | * |
| 2601 | 2568 | * @param int $topic_id The topic id. |
| 2569 | + * | |
| 2570 | + * @return void | |
| 2602 | 2571 | */ |
| 2603 | 2572 | function bbp_decrease_topic_reply_count_hidden( $topic_id = 0 ) { |
| 2604 | 2573 | |
| 2605 | 2574 | // Bail early if no id is passed. |
| @@ -2629,8 +2598,10 @@ | ||
| 2629 | 2598 | * @since 2.6.0 bbPress (r6036) |
| 2630 | 2599 | * |
| 2631 | 2600 | * @param int $topic_id The topic id. |
| 2632 | 2601 | * @param int $forum_id The forum id. |
| 2602 | + * | |
| 2603 | + * @return void | |
| 2633 | 2604 | */ |
| 2634 | 2605 | function bbp_insert_topic_update_counts( $topic_id = 0, $forum_id = 0 ) { |
| 2635 | 2606 | |
| 2636 | 2607 | // If the topic is public, update the forum topic counts. |
| @@ -2649,12 +2620,11 @@ | ||
| 2649 | 2620 | * Update the topic's forum id |
| 2650 | 2621 | * |
| 2651 | 2622 | * @since 2.0.0 bbPress (r2855) |
| 2652 | 2623 | * |
| 2653 | - * @param int $topic_id Optional. Topic id to update. | |
| 2624 | + * @param int $topic_id Optional. Topic id to update | |
| 2654 | 2625 | * @param int $forum_id Optional. Forum id |
| 2655 | - * | |
| 2656 | - * @return int Forum id. | |
| 2626 | + * @return int Forum id | |
| 2657 | 2627 | */ |
| 2658 | 2628 | function bbp_update_topic_forum_id( $topic_id = 0, $forum_id = 0 ) { |
| 2659 | 2629 | |
| 2660 | 2630 | // If it's a reply, then get the parent (topic id) |
| @@ -2674,15 +2644,14 @@ | ||
| 2674 | 2644 | return (int) apply_filters( 'bbp_update_topic_forum_id', $forum_id, $topic_id ); |
| 2675 | 2645 | } |
| 2676 | 2646 | |
| 2677 | 2647 | /** |
| 2678 | - * Update the topic's topic id. | |
| 2648 | + * Update the topic's topic id | |
| 2679 | 2649 | * |
| 2680 | 2650 | * @since 2.0.0 bbPress (r2954) |
| 2681 | 2651 | * |
| 2682 | - * @param int $topic_id Optional. Topic id to update. | |
| 2683 | - * | |
| 2684 | - * @return int Topic id. | |
| 2652 | + * @param int $topic_id Optional. Topic id to update | |
| 2653 | + * @return int Topic id | |
| 2685 | 2654 | */ |
| 2686 | 2655 | function bbp_update_topic_topic_id( $topic_id = 0 ) { |
| 2687 | 2656 | $topic_id = bbp_get_topic_id( $topic_id ); |
| 2688 | 2657 | $topic_id = bbp_update_topic_id( $topic_id, $topic_id ); |
| @@ -2691,16 +2660,15 @@ | ||
| 2691 | 2660 | return (int) apply_filters( 'bbp_update_topic_topic_id', $topic_id ); |
| 2692 | 2661 | } |
| 2693 | 2662 | |
| 2694 | 2663 | /** |
| 2695 | - * Adjust the total reply count of a topic. | |
| 2664 | + * Adjust the total reply count of a topic | |
| 2696 | 2665 | * |
| 2697 | 2666 | * @since 2.0.0 bbPress (r2467) |
| 2698 | 2667 | * |
| 2699 | - * @param int $topic_id Optional. Topic id to update. | |
| 2668 | + * @param int $topic_id Optional. Topic id to update | |
| 2700 | 2669 | * @param int $reply_count Optional. Set the reply count manually. |
| 2701 | - * | |
| 2702 | - * @return int Topic reply count. | |
| 2670 | + * @return int Topic reply count | |
| 2703 | 2671 | */ |
| 2704 | 2672 | function bbp_update_topic_reply_count( $topic_id = 0, $reply_count = false ) { |
| 2705 | 2673 | |
| 2706 | 2674 | // If it's a reply, then get the parent (topic id) |
| @@ -2720,16 +2688,15 @@ | ||
| 2720 | 2688 | } |
| 2721 | 2689 | |
| 2722 | 2690 | /** |
| 2723 | 2691 | * Adjust the total hidden reply count of a topic (hidden includes trashed, |
| 2724 | - * spammed and pending replies). | |
| 2692 | + * spammed and pending replies) | |
| 2725 | 2693 | * |
| 2726 | 2694 | * @since 2.0.0 bbPress (r2740) |
| 2727 | 2695 | * |
| 2728 | - * @param int $topic_id Optional. Topic id to update. | |
| 2729 | - * @param int $reply_count Optional. Set the reply count manually. | |
| 2730 | - * | |
| 2731 | - * @return int Topic hidden reply count. | |
| 2696 | + * @param int $topic_id Optional. Topic id to update | |
| 2697 | + * @param int $reply_count Optional. Set the reply count manually | |
| 2698 | + * @return int Topic hidden reply count | |
| 2732 | 2699 | */ |
| 2733 | 2700 | function bbp_update_topic_reply_count_hidden( $topic_id = 0, $reply_count = false ) { |
| 2734 | 2701 | |
| 2735 | 2702 | // If it's a reply, then get the parent (topic id) |
| @@ -2748,16 +2715,15 @@ | ||
| 2748 | 2715 | return (int) apply_filters( 'bbp_update_topic_reply_count_hidden', $reply_count, $topic_id ); |
| 2749 | 2716 | } |
| 2750 | 2717 | |
| 2751 | 2718 | /** |
| 2752 | - * Update the topic with the last active post ID. | |
| 2719 | + * Update the topic with the last active post ID | |
| 2753 | 2720 | * |
| 2754 | 2721 | * @since 2.0.0 bbPress (r2888) |
| 2755 | 2722 | * |
| 2756 | - * @param int $topic_id Optional. Topic id to update. | |
| 2757 | - * @param int $active_id Optional. Active id. | |
| 2758 | - * | |
| 2759 | - * @return int Active id. | |
| 2723 | + * @param int $topic_id Optional. Topic id to update | |
| 2724 | + * @param int $active_id Optional. active id | |
| 2725 | + * @return int Active id | |
| 2760 | 2726 | */ |
| 2761 | 2727 | function bbp_update_topic_last_active_id( $topic_id = 0, $active_id = 0 ) { |
| 2762 | 2728 | |
| 2763 | 2729 | // If it's a reply, then get the parent (topic id) |
| @@ -2784,16 +2750,15 @@ | ||
| 2784 | 2750 | return (int) apply_filters( 'bbp_update_topic_last_active_id', $active_id, $topic_id ); |
| 2785 | 2751 | } |
| 2786 | 2752 | |
| 2787 | 2753 | /** |
| 2788 | - * Update the topics last active date/time (aka freshness). | |
| 2754 | + * Update the topics last active date/time (aka freshness) | |
| 2789 | 2755 | * |
| 2790 | 2756 | * @since 2.0.0 bbPress (r2680) |
| 2791 | 2757 | * |
| 2792 | 2758 | * @param int $topic_id Optional. Topic id. |
| 2793 | 2759 | * @param string $new_time Optional. New time in mysql format. |
| 2794 | - * | |
| 2795 | - * @return string MySQL timestamp of last active reply. | |
| 2760 | + * @return string MySQL timestamp of last active reply | |
| 2796 | 2761 | */ |
| 2797 | 2762 | function bbp_update_topic_last_active_time( $topic_id = 0, $new_time = '' ) { |
| 2798 | 2763 | |
| 2799 | 2764 | // If it's a reply, then get the parent (topic id) |
| @@ -2815,16 +2780,15 @@ | ||
| 2815 | 2780 | return apply_filters( 'bbp_update_topic_last_active_time', $new_time, $topic_id ); |
| 2816 | 2781 | } |
| 2817 | 2782 | |
| 2818 | 2783 | /** |
| 2819 | - * Update the topic with the most recent reply ID. | |
| 2784 | + * Update the topic with the most recent reply ID | |
| 2820 | 2785 | * |
| 2821 | 2786 | * @since 2.0.0 bbPress (r2625) |
| 2822 | 2787 | * |
| 2823 | - * @param int $topic_id Optional. Topic id to update. | |
| 2824 | - * @param int $reply_id Optional. Reply id. | |
| 2825 | - * | |
| 2826 | - * @return int Reply id. | |
| 2788 | + * @param int $topic_id Optional. Topic id to update | |
| 2789 | + * @param int $reply_id Optional. Reply id | |
| 2790 | + * @return int Reply id | |
| 2827 | 2791 | */ |
| 2828 | 2792 | function bbp_update_topic_last_reply_id( $topic_id = 0, $reply_id = 0 ) { |
| 2829 | 2793 | |
| 2830 | 2794 | // If it's a reply, then get the parent (topic id) |
| @@ -2854,16 +2818,15 @@ | ||
| 2854 | 2818 | return (int) apply_filters( 'bbp_update_topic_last_reply_id', $reply_id, $topic_id ); |
| 2855 | 2819 | } |
| 2856 | 2820 | |
| 2857 | 2821 | /** |
| 2858 | - * Adjust the total voice count of a topic. | |
| 2822 | + * Adjust the total voice count of a topic | |
| 2859 | 2823 | * |
| 2860 | 2824 | * @since 2.0.0 bbPress (r2567) |
| 2861 | - * @since 2.6.0 bbPress (r6515) This must be called after any engagement changes. | |
| 2825 | + * @since 2.6.0 bbPress (r6515) This must be called after any engagement changes | |
| 2862 | 2826 | * |
| 2863 | - * @param int $topic_id Optional. Topic id to update. | |
| 2864 | - * | |
| 2865 | - * @return int Voice count. | |
| 2827 | + * @param int $topic_id Optional. Topic id to update | |
| 2828 | + * @return int Voice count | |
| 2866 | 2829 | */ |
| 2867 | 2830 | function bbp_update_topic_voice_count( $topic_id = 0 ) { |
| 2868 | 2831 | |
| 2869 | 2832 | // If it's a reply, then get the parent (topic id) |
| @@ -2886,15 +2849,14 @@ | ||
| 2886 | 2849 | return (int) apply_filters( 'bbp_update_topic_voice_count', $count, $topic_id ); |
| 2887 | 2850 | } |
| 2888 | 2851 | |
| 2889 | 2852 | /** |
| 2890 | - * Adjust the total anonymous reply count of a topic. | |
| 2853 | + * Adjust the total anonymous reply count of a topic | |
| 2891 | 2854 | * |
| 2892 | 2855 | * @since 2.0.0 bbPress (r2567) |
| 2893 | 2856 | * |
| 2894 | - * @param int $topic_id Optional. Topic id to update. | |
| 2895 | - * | |
| 2896 | - * @return int Anonymous reply count. | |
| 2857 | + * @param int $topic_id Optional. Topic id to update | |
| 2858 | + * @return int Anonymous reply count | |
| 2897 | 2859 | */ |
| 2898 | 2860 | function bbp_update_topic_anonymous_reply_count( $topic_id = 0 ) { |
| 2899 | 2861 | |
| 2900 | 2862 | // If it's a reply, then get the parent (topic id) |
| @@ -2913,9 +2875,9 @@ | ||
| 2913 | 2875 | return (int) apply_filters( 'bbp_update_topic_anonymous_reply_count', $replies, $topic_id ); |
| 2914 | 2876 | } |
| 2915 | 2877 | |
| 2916 | 2878 | /** |
| 2917 | - * Update the revision log of the topic. | |
| 2879 | + * Update the revision log of the topic | |
| 2918 | 2880 | * |
| 2919 | 2881 | * @since 2.0.0 bbPress (r2782) |
| 2920 | 2882 | * |
| 2921 | 2883 | * @param array $args Supports these args: |
| @@ -2922,10 +2884,9 @@ | ||
| 2922 | 2884 | * - topic_id: Topic id |
| 2923 | 2885 | * - author_id: Author id |
| 2924 | 2886 | * - reason: Reason for editing |
| 2925 | 2887 | * - revision_id: Revision id |
| 2926 | - * | |
| 2927 | - * @return mixed False on failure, true on success. | |
| 2888 | + * @return mixed False on failure, true on success | |
| 2928 | 2889 | */ |
| 2929 | 2890 | function bbp_update_topic_revision_log( $args = array() ) { |
| 2930 | 2891 | |
| 2931 | 2892 | // Parse arguments against default values |
| @@ -2959,15 +2920,14 @@ | ||
| 2959 | 2920 | |
| 2960 | 2921 | /** Topic Actions *************************************************************/ |
| 2961 | 2922 | |
| 2962 | 2923 | /** |
| 2963 | - * Closes a topic. | |
| 2924 | + * Closes a topic | |
| 2964 | 2925 | * |
| 2965 | 2926 | * @since 2.0.0 bbPress (r2740) |
| 2966 | 2927 | * |
| 2967 | - * @param int $topic_id Topic id. | |
| 2968 | - * | |
| 2969 | - * @return mixed False or {@link WP_Error} on failure, topic id on success. | |
| 2928 | + * @param int $topic_id Topic id | |
| 2929 | + * @return mixed False or {@link WP_Error} on failure, topic id on success | |
| 2970 | 2930 | */ |
| 2971 | 2931 | function bbp_close_topic( $topic_id = 0 ) { |
| 2972 | 2932 | |
| 2973 | 2933 | // Get topic |
| @@ -3019,15 +2979,14 @@ | ||
| 3019 | 2979 | return $topic_id; |
| 3020 | 2980 | } |
| 3021 | 2981 | |
| 3022 | 2982 | /** |
| 3023 | - * Opens a topic. | |
| 2983 | + * Opens a topic | |
| 3024 | 2984 | * |
| 3025 | 2985 | * @since 2.0.0 bbPress (r2740) |
| 3026 | 2986 | * |
| 3027 | - * @param int $topic_id Topic id. | |
| 3028 | - * | |
| 3029 | - * @return mixed False or {@link WP_Error} on failure, topic id on success. | |
| 2987 | + * @param int $topic_id Topic id | |
| 2988 | + * @return mixed False or {@link WP_Error} on failure, topic id on success | |
| 3030 | 2989 | */ |
| 3031 | 2990 | function bbp_open_topic( $topic_id = 0 ) { |
| 3032 | 2991 | |
| 3033 | 2992 | // Get topic |
| @@ -3080,14 +3039,14 @@ | ||
| 3080 | 3039 | return $topic_id; |
| 3081 | 3040 | } |
| 3082 | 3041 | |
| 3083 | 3042 | /** |
| 3084 | - * Marks a topic as spam. | |
| 3043 | + * Marks a topic as spam | |
| 3085 | 3044 | * |
| 3086 | 3045 | * @since 2.0.0 bbPress (r2740) |
| 3087 | 3046 | * |
| 3088 | - * @param int $topic_id Topic id. | |
| 3089 | - * @return mixed False or {@link WP_Error} on failure, topic id on success. | |
| 3047 | + * @param int $topic_id Topic id | |
| 3048 | + * @return mixed False or {@link WP_Error} on failure, topic id on success | |
| 3090 | 3049 | */ |
| 3091 | 3050 | function bbp_spam_topic( $topic_id = 0 ) { |
| 3092 | 3051 | |
| 3093 | 3052 | // Get the topic |
| @@ -3129,15 +3088,15 @@ | ||
| 3129 | 3088 | return $topic_id; |
| 3130 | 3089 | } |
| 3131 | 3090 | |
| 3132 | 3091 | /** |
| 3133 | - * Trash replies to a topic when it's marked as spam. | |
| 3092 | + * Trash replies to a topic when it's marked as spam | |
| 3134 | 3093 | * |
| 3135 | 3094 | * Usually you'll want to do this before the topic itself is marked as spam. |
| 3136 | 3095 | * |
| 3137 | 3096 | * @since 2.6.0 bbPress (r5405) |
| 3138 | 3097 | * |
| 3139 | - * @param int $topic_id Topic id. | |
| 3098 | + * @param int $topic_id | |
| 3140 | 3099 | */ |
| 3141 | 3100 | function bbp_spam_topic_replies( $topic_id = 0 ) { |
| 3142 | 3101 | |
| 3143 | 3102 | // Validation |
| @@ -3190,11 +3149,9 @@ | ||
| 3190 | 3149 | * Usually you'll want to do this before the topic itself is marked as spam. |
| 3191 | 3150 | * |
| 3192 | 3151 | * @since 2.6.0 bbPress (r5405) |
| 3193 | 3152 | * |
| 3194 | - * @param int $topic_id Topic id. | |
| 3195 | - * | |
| 3196 | - * @return array | |
| 3153 | + * @param int $topic_id | |
| 3197 | 3154 | */ |
| 3198 | 3155 | function bbp_spam_topic_tags( $topic_id = 0 ) { |
| 3199 | 3156 | |
| 3200 | 3157 | // Validation |
| @@ -3225,15 +3182,14 @@ | ||
| 3225 | 3182 | return array( bbp_get_topic_tag_tax_id() => '' ); |
| 3226 | 3183 | } |
| 3227 | 3184 | |
| 3228 | 3185 | /** |
| 3229 | - * Unspams a topic. | |
| 3186 | + * Unspams a topic | |
| 3230 | 3187 | * |
| 3231 | 3188 | * @since 2.0.0 bbPress (r2740) |
| 3232 | 3189 | * |
| 3233 | - * @param int $topic_id Topic id. | |
| 3234 | - * | |
| 3235 | - * @return mixed False or {@link WP_Error} on failure, topic id on success. | |
| 3190 | + * @param int $topic_id Topic id | |
| 3191 | + * @return mixed False or {@link WP_Error} on failure, topic id on success | |
| 3236 | 3192 | */ |
| 3237 | 3193 | function bbp_unspam_topic( $topic_id = 0 ) { |
| 3238 | 3194 | |
| 3239 | 3195 | // Get the topic |
| @@ -3284,9 +3240,9 @@ | ||
| 3284 | 3240 | * Usually you'll want to do this after the topic is unspammed. |
| 3285 | 3241 | * |
| 3286 | 3242 | * @since 2.6.0 bbPress (r5405) |
| 3287 | 3243 | * |
| 3288 | - * @param int $topic_id Topic id. | |
| 3244 | + * @param int $topic_id | |
| 3289 | 3245 | */ |
| 3290 | 3246 | function bbp_unspam_topic_replies( $topic_id = 0 ) { |
| 3291 | 3247 | |
| 3292 | 3248 | // Validation |
| @@ -3319,11 +3275,9 @@ | ||
| 3319 | 3275 | * Usually you'll want to do this before the topic itself is unmarked as spam. |
| 3320 | 3276 | * |
| 3321 | 3277 | * @since 2.6.0 bbPress (r5405) |
| 3322 | 3278 | * |
| 3323 | - * @param int $topic_id Topic id. | |
| 3324 | - * | |
| 3325 | - * @return array | |
| 3279 | + * @param int $topic_id | |
| 3326 | 3280 | */ |
| 3327 | 3281 | function bbp_unspam_topic_tags( $topic_id = 0 ) { |
| 3328 | 3282 | |
| 3329 | 3283 | // Validation |
| @@ -3340,15 +3294,14 @@ | ||
| 3340 | 3294 | return array( bbp_get_topic_tag_tax_id() => $terms ); |
| 3341 | 3295 | } |
| 3342 | 3296 | |
| 3343 | 3297 | /** |
| 3344 | - * Sticks a topic to a forum or front. | |
| 3298 | + * Sticks a topic to a forum or front | |
| 3345 | 3299 | * |
| 3346 | 3300 | * @since 2.0.0 bbPress (r2754) |
| 3347 | 3301 | * |
| 3348 | - * @param int $topic_id Optional. Topic id. | |
| 3302 | + * @param int $topic_id Optional. Topic id | |
| 3349 | 3303 | * @param int $super Should we make the topic a super sticky? |
| 3350 | - * | |
| 3351 | 3304 | * @return bool True on success, false on failure |
| 3352 | 3305 | */ |
| 3353 | 3306 | function bbp_stick_topic( $topic_id = 0, $super = false ) { |
| 3354 | 3307 | |
| @@ -3396,15 +3349,14 @@ | ||
| 3396 | 3349 | return (bool) $success; |
| 3397 | 3350 | } |
| 3398 | 3351 | |
| 3399 | 3352 | /** |
| 3400 | - * Approves a pending topic. | |
| 3353 | + * Approves a pending topic | |
| 3401 | 3354 | * |
| 3402 | 3355 | * @since 2.6.0 bbPress (r5503) |
| 3403 | 3356 | * |
| 3404 | - * @param int $topic_id Topic id. | |
| 3405 | - * | |
| 3406 | - * @return mixed False or {@link WP_Error} on failure, topic id on success. | |
| 3357 | + * @param int $topic_id Topic id | |
| 3358 | + * @return mixed False or {@link WP_Error} on failure, topic id on success | |
| 3407 | 3359 | */ |
| 3408 | 3360 | function bbp_approve_topic( $topic_id = 0 ) { |
| 3409 | 3361 | |
| 3410 | 3362 | // Get topic |
| @@ -3443,15 +3395,14 @@ | ||
| 3443 | 3395 | return $topic_id; |
| 3444 | 3396 | } |
| 3445 | 3397 | |
| 3446 | 3398 | /** |
| 3447 | - * Unapproves a topic. | |
| 3399 | + * Unapproves a topic | |
| 3448 | 3400 | * |
| 3449 | 3401 | * @since 2.6.0 bbPress (r5503) |
| 3450 | 3402 | * |
| 3451 | - * @param int $topic_id Topic id. | |
| 3452 | - * | |
| 3453 | - * @return mixed False or {@link WP_Error} on failure, topic id on success. | |
| 3403 | + * @param int $topic_id Topic id | |
| 3404 | + * @return mixed False or {@link WP_Error} on failure, topic id on success | |
| 3454 | 3405 | */ |
| 3455 | 3406 | function bbp_unapprove_topic( $topic_id = 0 ) { |
| 3456 | 3407 | |
| 3457 | 3408 | // Get topic |
| @@ -3487,14 +3438,13 @@ | ||
| 3487 | 3438 | return $topic_id; |
| 3488 | 3439 | } |
| 3489 | 3440 | |
| 3490 | 3441 | /** |
| 3491 | - * Unsticks a topic both from front and it's forum. | |
| 3442 | + * Unsticks a topic both from front and it's forum | |
| 3492 | 3443 | * |
| 3493 | 3444 | * @since 2.0.0 bbPress (r2754) |
| 3494 | 3445 | * |
| 3495 | - * @param int $topic_id Optional. Topic id. | |
| 3496 | - * | |
| 3446 | + * @param int $topic_id Optional. Topic id | |
| 3497 | 3447 | * @return bool Always true. |
| 3498 | 3448 | */ |
| 3499 | 3449 | function bbp_unstick_topic( $topic_id = 0 ) { |
| 3500 | 3450 | |
| @@ -3502,9 +3452,9 @@ | ||
| 3502 | 3452 | $topic_id = bbp_get_topic_id( $topic_id ); |
| 3503 | 3453 | $super = bbp_is_topic_super_sticky( $topic_id ); |
| 3504 | 3454 | $forum_id = empty( $super ) ? bbp_get_topic_forum_id( $topic_id ) : 0; |
| 3505 | 3455 | $stickies = bbp_get_stickies( $forum_id ); |
| 3506 | - $offset = array_search( $topic_id, $stickies, true ); | |
| 3456 | + $offset = array_search( $topic_id, $stickies ); | |
| 3507 | 3457 | |
| 3508 | 3458 | do_action( 'bbp_unstick_topic', $topic_id ); |
| 3509 | 3459 | |
| 3510 | 3460 | // Nothing to unstick |
| @@ -3546,12 +3496,8 @@ | ||
| 3546 | 3496 | * |
| 3547 | 3497 | * This function is supplemental to the actual topic deletion which is |
| 3548 | 3498 | * handled by WordPress core API functions. It is used to clean up after |
| 3549 | 3499 | * a topic that is being deleted. |
| 3550 | - * | |
| 3551 | - * @since 2.0.0 bbPress (r2895) | |
| 3552 | - * | |
| 3553 | - * @param int $topic_id Topic id. | |
| 3554 | 3500 | */ |
| 3555 | 3501 | function bbp_delete_topic( $topic_id = 0 ) { |
| 3556 | 3502 | |
| 3557 | 3503 | // Validate topic ID |
| @@ -3564,15 +3510,15 @@ | ||
| 3564 | 3510 | do_action( 'bbp_delete_topic', $topic_id ); |
| 3565 | 3511 | } |
| 3566 | 3512 | |
| 3567 | 3513 | /** |
| 3568 | - * Delete replies to a topic when it's deleted. | |
| 3514 | + * Delete replies to a topic when it's deleted | |
| 3569 | 3515 | * |
| 3570 | 3516 | * Usually you'll want to do this before the topic itself is deleted. |
| 3571 | 3517 | * |
| 3572 | 3518 | * @since 2.6.0 bbPress (r5405) |
| 3573 | 3519 | * |
| 3574 | - * @param int $topic_id Topic id. | |
| 3520 | + * @param int $topic_id | |
| 3575 | 3521 | */ |
| 3576 | 3522 | function bbp_delete_topic_replies( $topic_id = 0 ) { |
| 3577 | 3523 | |
| 3578 | 3524 | // Validate topic ID |
| @@ -3609,17 +3555,13 @@ | ||
| 3609 | 3555 | } |
| 3610 | 3556 | } |
| 3611 | 3557 | |
| 3612 | 3558 | /** |
| 3613 | - * Called before trashing a topic. | |
| 3559 | + * Called before trashing a topic | |
| 3614 | 3560 | * |
| 3615 | 3561 | * This function is supplemental to the actual topic being trashed which is |
| 3616 | 3562 | * handled by WordPress core API functions. It is used to clean up after |
| 3617 | 3563 | * a topic that is being trashed. |
| 3618 | - * | |
| 3619 | - * @since 2.0.0 bbPress (r2895) | |
| 3620 | - * | |
| 3621 | - * @param int $topic_id Topic id. | |
| 3622 | 3564 | */ |
| 3623 | 3565 | function bbp_trash_topic( $topic_id = 0 ) { |
| 3624 | 3566 | |
| 3625 | 3567 | // Validate topic ID |
| @@ -3638,9 +3580,9 @@ | ||
| 3638 | 3580 | * Usually you'll want to do this before the topic itself is marked as spam. |
| 3639 | 3581 | * |
| 3640 | 3582 | * @since 2.6.0 bbPress (r5405) |
| 3641 | 3583 | * |
| 3642 | - * @param int $topic_id Topic id. | |
| 3584 | + * @param int $topic_id | |
| 3643 | 3585 | */ |
| 3644 | 3586 | function bbp_trash_topic_replies( $topic_id = 0 ) { |
| 3645 | 3587 | |
| 3646 | 3588 | // Validate topic ID |
| @@ -3686,13 +3628,9 @@ | ||
| 3686 | 3628 | } |
| 3687 | 3629 | } |
| 3688 | 3630 | |
| 3689 | 3631 | /** |
| 3690 | - * Called before untrashing a topic. | |
| 3691 | - * | |
| 3692 | - * @since 2.0.0 bbPress (r2895) | |
| 3693 | - * | |
| 3694 | - * @param int $topic_id Topic id. | |
| 3632 | + * Called before untrashing a topic | |
| 3695 | 3633 | */ |
| 3696 | 3634 | function bbp_untrash_topic( $topic_id = 0 ) { |
| 3697 | 3635 | $topic_id = bbp_get_topic_id( $topic_id ); |
| 3698 | 3636 | |
| @@ -3709,9 +3647,9 @@ | ||
| 3709 | 3647 | * Usually you'll want to do this after the topic is unspammed. |
| 3710 | 3648 | * |
| 3711 | 3649 | * @since 2.6.0 bbPress (r5405) |
| 3712 | 3650 | * |
| 3713 | - * @param int $topic_id Topic id. | |
| 3651 | + * @param int $topic_id | |
| 3714 | 3652 | */ |
| 3715 | 3653 | function bbp_untrash_topic_replies( $topic_id = 0 ) { |
| 3716 | 3654 | |
| 3717 | 3655 | // Validation |
| @@ -3740,13 +3678,11 @@ | ||
| 3740 | 3678 | |
| 3741 | 3679 | /** After Delete/Trash/Untrash ************************************************/ |
| 3742 | 3680 | |
| 3743 | 3681 | /** |
| 3744 | - * Called after deleting a topic. | |
| 3682 | + * Called after deleting a topic | |
| 3745 | 3683 | * |
| 3746 | 3684 | * @since 2.0.0 bbPress (r2993) |
| 3747 | - * | |
| 3748 | - * @param int $topic_id Topic id. | |
| 3749 | 3685 | */ |
| 3750 | 3686 | function bbp_deleted_topic( $topic_id = 0 ) { |
| 3751 | 3687 | $topic_id = bbp_get_topic_id( $topic_id ); |
| 3752 | 3688 | |
| @@ -3757,13 +3693,11 @@ | ||
| 3757 | 3693 | do_action( 'bbp_deleted_topic', $topic_id ); |
| 3758 | 3694 | } |
| 3759 | 3695 | |
| 3760 | 3696 | /** |
| 3761 | - * Called after trashing a topic. | |
| 3697 | + * Called after trashing a topic | |
| 3762 | 3698 | * |
| 3763 | 3699 | * @since 2.0.0 bbPress (r2993) |
| 3764 | - * | |
| 3765 | - * @param int $topic_id Topic id. | |
| 3766 | 3700 | */ |
| 3767 | 3701 | function bbp_trashed_topic( $topic_id = 0 ) { |
| 3768 | 3702 | $topic_id = bbp_get_topic_id( $topic_id ); |
| 3769 | 3703 | |
| @@ -3774,13 +3708,11 @@ | ||
| 3774 | 3708 | do_action( 'bbp_trashed_topic', $topic_id ); |
| 3775 | 3709 | } |
| 3776 | 3710 | |
| 3777 | 3711 | /** |
| 3778 | - * Called after untrashing a topic. | |
| 3712 | + * Called after untrashing a topic | |
| 3779 | 3713 | * |
| 3780 | 3714 | * @since 2.0.0 bbPress (r2993) |
| 3781 | - * | |
| 3782 | - * @param int $topic_id Topic id. | |
| 3783 | 3715 | */ |
| 3784 | 3716 | function bbp_untrashed_topic( $topic_id = 0 ) { |
| 3785 | 3717 | $topic_id = bbp_get_topic_id( $topic_id ); |
| 3786 | 3718 | |
| @@ -3793,15 +3725,12 @@ | ||
| 3793 | 3725 | |
| 3794 | 3726 | /** Settings ******************************************************************/ |
| 3795 | 3727 | |
| 3796 | 3728 | /** |
| 3797 | - * Return the topics per page setting. | |
| 3729 | + * Return the topics per page setting | |
| 3798 | 3730 | * |
| 3799 | 3731 | * @since 2.0.0 bbPress (r3540) |
| 3800 | - * | |
| 3801 | - * @param int $default Optional. Number of topics per page if no value exists. | |
| 3802 | - * | |
| 3803 | - * @return int Number of topics per page. | |
| 3732 | + * @return int | |
| 3804 | 3733 | */ |
| 3805 | 3734 | function bbp_get_topics_per_page( $default = 15 ) { |
| 3806 | 3735 | |
| 3807 | 3736 | // Get database option and cast as integer |
| @@ -3816,15 +3745,14 @@ | ||
| 3816 | 3745 | return (int) apply_filters( 'bbp_get_topics_per_page', $retval, $default ); |
| 3817 | 3746 | } |
| 3818 | 3747 | |
| 3819 | 3748 | /** |
| 3820 | - * Return the topics per RSS page setting. | |
| 3749 | + * Return the topics per RSS page setting | |
| 3821 | 3750 | * |
| 3822 | 3751 | * @since 2.0.0 bbPress (r3540) |
| 3823 | 3752 | * |
| 3824 | 3753 | * @param int $default Default replies per page (25) |
| 3825 | - * | |
| 3826 | - * @return int Number of topics per RSS page. | |
| 3754 | + * @return int | |
| 3827 | 3755 | */ |
| 3828 | 3756 | function bbp_get_topics_per_rss_page( $default = 25 ) { |
| 3829 | 3757 | |
| 3830 | 3758 | // Get database option and cast as integer |
| @@ -3841,13 +3769,13 @@ | ||
| 3841 | 3769 | |
| 3842 | 3770 | /** Topic Tags ****************************************************************/ |
| 3843 | 3771 | |
| 3844 | 3772 | /** |
| 3845 | - * Get topic tags for a specific topic ID. | |
| 3773 | + * Get topic tags for a specific topic ID | |
| 3846 | 3774 | * |
| 3847 | 3775 | * @since 2.6.0 bbPress (r5836) |
| 3848 | 3776 | * |
| 3849 | - * @param int $topic_id Topic id. | |
| 3777 | + * @param int $topic_id | |
| 3850 | 3778 | * |
| 3851 | 3779 | * @return string |
| 3852 | 3780 | */ |
| 3853 | 3781 | function bbp_get_topic_tags( $topic_id = 0 ) { |
| @@ -3859,14 +3787,14 @@ | ||
| 3859 | 3787 | return apply_filters( 'bbp_get_topic_tags', $topic_tags, $topic_id ); |
| 3860 | 3788 | } |
| 3861 | 3789 | |
| 3862 | 3790 | /** |
| 3863 | - * Get topic tags for a specific topic ID. | |
| 3791 | + * Get topic tags for a specific topic ID | |
| 3864 | 3792 | * |
| 3865 | 3793 | * @since 2.2.0 bbPress (r4165) |
| 3866 | 3794 | * |
| 3867 | - * @param int $topic_id Topic id. | |
| 3868 | - * @param string $sep Separator string. | |
| 3795 | + * @param int $topic_id | |
| 3796 | + * @param string $sep | |
| 3869 | 3797 | * |
| 3870 | 3798 | * @return string |
| 3871 | 3799 | */ |
| 3872 | 3800 | function bbp_get_topic_tag_names( $topic_id = 0, $sep = ', ' ) { |
| @@ -3986,9 +3914,9 @@ | ||
| 3986 | 3914 | |
| 3987 | 3915 | /** Autoembed *****************************************************************/ |
| 3988 | 3916 | |
| 3989 | 3917 | /** |
| 3990 | - * Check if autoembeds are enabled and hook them in if so. | |
| 3918 | + * Check if autoembeds are enabled and hook them in if so | |
| 3991 | 3919 | * |
| 3992 | 3920 | * @since 2.1.0 bbPress (r3752) |
| 3993 | 3921 | * |
| 3994 | 3922 | * @global WP_Embed $wp_embed |
| @@ -4039,10 +3967,10 @@ | ||
| 4039 | 3967 | |
| 4040 | 3968 | <title><?php echo $title; // Already escaped ?></title> |
| 4041 | 3969 | <atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" /> |
| 4042 | 3970 | <link><?php self_link(); ?></link> |
| 4043 | - <description><?php //?></description><?php // phpcs:ignore ?> | |
| 4044 | - <lastBuildDate><?php echo get_feed_build_date( 'r' ); ?></lastBuildDate> | |
| 3971 | + <description><?php // ?></description> | |
| 3972 | + <lastBuildDate><?php echo date( 'r' ); // phpcs:ignore WordPress.DateTime.RestrictedFunctions.date_date ?></lastBuildDate> | |
| 4045 | 3973 | <generator><?php echo esc_url_raw( 'https://bbpress.org/?v=' . convert_chars( bbp_get_version() ) ); ?></generator> |
| 4046 | 3974 | <language><?php bloginfo_rss( 'language' ); ?></language> |
| 4047 | 3975 | |
| 4048 | 3976 | <?php do_action( 'bbp_feed_head' ); ?> |
| @@ -4063,17 +3991,13 @@ | ||
| 4063 | 3991 | <?php if ( ! post_password_required() ) : ?> |
| 4064 | 3992 | |
| 4065 | 3993 | <description> |
| 4066 | 3994 | <![CDATA[ |
| 4067 | - <p> | |
| 4068 | - <?php | |
| 4069 | - printf( | |
| 3995 | + <p><?php printf( | |
| 4070 | 3996 | /* translators: %s: Number of replies to the topic */ |
| 4071 | - esc_html__( 'Replies: %s', 'bbpress' ), | |
| 4072 | - bbp_get_topic_reply_count() | |
| 4073 | - ); | |
| 4074 | - ?> | |
| 4075 | - </p> | |
| 3997 | + esc_html__( 'Replies: %s', 'bbpress' ), | |
| 3998 | + bbp_get_topic_reply_count() | |
| 3999 | + ); ?></p> | |
| 4076 | 4000 | <?php bbp_topic_content(); ?> |
| 4077 | 4001 | ]]> |
| 4078 | 4002 | </description> |
| 4079 | 4003 | |
| @@ -4099,9 +4023,9 @@ | ||
| 4099 | 4023 | |
| 4100 | 4024 | /** Permissions ***************************************************************/ |
| 4101 | 4025 | |
| 4102 | 4026 | /** |
| 4103 | - * Redirect if unauthorized user is attempting to edit a topic. | |
| 4027 | + * Redirect if unauthorized user is attempting to edit a topic | |
| 4104 | 4028 | * |
| 4105 | 4029 | * @since 2.1.0 bbPress (r3605) |
| 4106 | 4030 | */ |
| 4107 | 4031 | function bbp_check_topic_edit() { |
| @@ -4117,9 +4041,9 @@ | ||
| 4117 | 4041 | } |
| 4118 | 4042 | } |
| 4119 | 4043 | |
| 4120 | 4044 | /** |
| 4121 | - * Redirect if unauthorized user is attempting to edit a topic tag. | |
| 4045 | + * Redirect if unauthorized user is attempting to edit a topic tag | |
| 4122 | 4046 | * |
| 4123 | 4047 | * @since 2.1.0 bbPress (r3605) |
| 4124 | 4048 | */ |
| 4125 | 4049 | function bbp_check_topic_tag_edit() { |