Skip to:
Content

bbPress.org


Ignore:
Timestamp:
12/05/2025 02:27:53 AM (6 months ago)
Author:
johnjamesjacoby
Message:

Tools - Code Improvement: docs & code formatting improvements.

Props johnjamesjacoby, noruzzaman.

Fixes #3659.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/replies/functions.php

    r7379 r7380  
    1919 * @since 2.0.0 bbPress (r3349)
    2020 *
    21  * @param array $reply_data Forum post data
    22  * @param array $reply_meta Forum meta data
     21 * @param array $reply_data Forum post data.
     22 * @param array $reply_meta Forum meta data.
     23 *
     24 * @return int|false Reply ID on success, false on failure.
    2325 */
    2426function bbp_insert_reply( $reply_data = array(), $reply_meta = array() ) {
     
    103105 * @param int $topic_id The topic id.
    104106 * @param int $forum_id The forum id.
    105  *
    106  * @return void
    107107 */
    108108function bbp_insert_reply_update_counts( $reply_id = 0, $topic_id = 0, $forum_id = 0 ) {
     
    123123
    124124/**
    125  * Handles the front end reply submission
     125 * Handles the front end reply submission.
    126126 *
    127127 * @since 2.0.0 bbPress (r2574)
     
    129129 * @param string $action The requested action to compare this function to
    130130 *                    id, anonymous data, reply author, edit (false), and
    131  *                    the reply to id
     131 *                    the reply to id.
    132132 */
    133133function bbp_new_reply_handler( $action = '' ) {
     
    528528
    529529/**
    530  * Handles the front end edit reply submission
     530 * Handles the front end edit reply submission.
    531531 *
    532532 * @param string $action The requested action to compare this function to
    533  *                    id, anonymous data, reply author, bool true (for edit),
    534  *                    and the reply to id
     533 *                       id, anonymous data, reply author, bool true (for edit),
     534 *                       and the reply to id.
    535535 */
    536536function bbp_edit_reply_handler( $action = '' ) {
     
    847847
    848848/**
    849  * Handle all the extra meta stuff from posting a new reply or editing a reply
    850  *
    851  * @param int $reply_id Optional. Reply id
    852  * @param int $topic_id Optional. Topic id
    853  * @param int $forum_id Optional. Forum id
     849 * Handle all the extra meta stuff from posting a new reply or editing a reply.
     850 *
     851 * @param int $reply_id Optional. Reply id.
     852 * @param int $topic_id Optional. Topic id.
     853 * @param int $forum_id Optional. Forum id.
    854854 * @param array $anonymous_data Optional - if it's an anonymous post. Do not
    855855 *                              supply if supplying $author_id. Should be
    856  *                              sanitized (see {@link bbp_filter_anonymous_post_data()}
    857  * @param int $author_id Author id
     856 *                              sanitized (see {@link bbp_filter_anonymous_post_data()}.
     857 * @param int $author_id Author id.
    858858 * @param bool $is_edit Optional. Is the post being edited? Defaults to false.
    859  * @param int $reply_to Optional. Reply to id
     859 * @param int $reply_to Optional. Reply to id.
    860860 */
    861861function bbp_update_reply( $reply_id = 0, $topic_id = 0, $forum_id = 0, $anonymous_data = array(), $author_id = 0, $is_edit = false, $reply_to = 0 ) {
     
    953953
    954954/**
    955  * Walk up the ancestor tree from the current reply, and update all the counts
     955 * Walk up the ancestor tree from the current reply, and update all the counts.
    956956 *
    957957 * @since 2.0.0 bbPress (r2884)
    958958 *
    959  * @param int $reply_id Optional. Reply id
    960  * @param string $last_active_time Optional. Last active time
    961  * @param int $forum_id Optional. Forum id
    962  * @param int $topic_id Optional. Topic id
     959 * @param int $reply_id Optional. Reply id.
     960 * @param string $last_active_time Optional. Last active time.
     961 * @param int $forum_id Optional. Forum id.
     962 * @param int $topic_id Optional. Topic id.
    963963 * @param bool $refresh If set to true, unsets all the previous parameters.
    964  *                       Defaults to true
     964 *                       Defaults to true.
    965965 */
    966966function bbp_update_reply_walker( $reply_id, $last_active_time = '', $forum_id = 0, $topic_id = 0, $refresh = true ) {
     
    10631063
    10641064/**
    1065  * Update the reply with its forum id it is in
     1065 * Update the reply with its forum id it is in.
    10661066 *
    10671067 * @since 2.0.0 bbPress (r2855)
    10681068 *
    1069  * @param int $reply_id Optional. Reply id to update
    1070  * @param int $forum_id Optional. Forum id
    1071  * @return bool The forum id of the reply
     1069 * @param int $reply_id Optional. Reply id to update.
     1070 * @param int $forum_id Optional. Forum id.
     1071 * @return bool The forum id of the reply.
    10721072 */
    10731073function bbp_update_reply_forum_id( $reply_id = 0, $forum_id = 0 ) {
     
    11061106
    11071107/**
    1108  * Update the reply with its topic id it is in
     1108 * Update the reply with its topic id it is in.
    11091109 *
    11101110 * @since 2.0.0 bbPress (r2855)
    11111111 *
    1112  * @param int $reply_id Optional. Reply id to update
    1113  * @param int $topic_id Optional. Topic id
    1114  * @return bool The topic id of the reply
     1112 * @param int $reply_id Optional. Reply id to update.
     1113 * @param int $topic_id Optional. Topic id.
     1114 * @return bool The topic id of the reply.
    11151115 */
    11161116function bbp_update_reply_topic_id( $reply_id = 0, $topic_id = 0 ) {
     
    11491149
    11501150/*
    1151  * Update the meta data with its parent reply-to id, of a reply
     1151 * Update the meta data with its parent reply-to id, of a reply.
    11521152 *
    11531153 * @since 2.4.0 bbPress (r4944)
    11541154 *
    1155  * @param int $reply_id Reply id to update
    1156  * @param int $reply_to Optional. Reply to id
    1157  * @return bool The parent reply id of the reply
     1155 * @param int $reply_id Reply id to update.
     1156 * @param int $reply_to Optional. Reply to id.
     1157 * @return bool The parent reply id of the reply.
    11581158 */
    11591159function bbp_update_reply_to( $reply_id = 0, $reply_to = 0 ) {
     
    11811181
    11821182/**
    1183  * Get all ancestors to a reply
     1183 * Get all ancestors to a reply.
    11841184 *
    11851185 * Because settings can be changed, this function does not care if hierarchical
     
    12321232
    12331233/**
    1234  * Update the revision log of the reply
     1234 * Update the revision log of the reply.
    12351235 *
    12361236 * @since 2.0.0 bbPress (r2782)
     
    12411241 *  - reason: Reason for editing
    12421242 *  - revision_id: Revision id
    1243  * @return mixed False on failure, true on success
     1243 * @return mixed False on failure, true on success.
    12441244 */
    12451245function bbp_update_reply_revision_log( $args = array() ) {
     
    12781278
    12791279/**
    1280  * Move reply handler
    1281  *
    1282  * Handles the front end move reply submission
     1280 * Move reply handler.
     1281 *
     1282 * Handles the front end move reply submission.
    12831283 *
    12841284 * @since 2.3.0 bbPress (r4521)
    12851285 *
    1286  * @param string $action The requested action to compare this function to
     1286 * @param string $action The requested action to compare this function to.
    12871287 */
    12881288function bbp_move_reply_handler( $action = '' ) {
     
    15221522
    15231523/**
    1524  * Fix counts on reply move
     1524 * Fix counts on reply move.
    15251525 *
    15261526 * When a reply is moved, update the counts of source and destination topic
     
    15291529 * @since 2.3.0 bbPress (r4521)
    15301530 *
    1531  * @param int $move_reply_id Move reply id
    1532  * @param int $source_topic_id Source topic id
    1533  * @param int $destination_topic_id Destination topic id
     1531 * @param int $move_reply_id Move reply id.
     1532 * @param int $source_topic_id Source topic id.
     1533 * @param int $destination_topic_id Destination topic id.
    15341534 */
    15351535function bbp_move_reply_count( $move_reply_id, $source_topic_id, $destination_topic_id ) {
     
    15601560/**
    15611561 * Handles the front end spamming/unspamming and trashing/untrashing/deleting of
    1562  * replies
     1562 * replies.
    15631563 *
    15641564 * @since 2.0.0 bbPress (r2740)
    15651565 *
    1566  * @param string $action The requested action to compare this function to
     1566 * @param string $action The requested action to compare this function to.
    15671567 */
    15681568function bbp_toggle_reply_handler( $action = '' ) {
     
    16291629
    16301630/**
    1631  * Do the actual reply toggling
     1631 * Do the actual reply toggling.
    16321632 *
    16331633 * This function is used by `bbp_toggle_reply_handler()` to do the actual heavy
     
    17361736
    17371737/**
    1738  * Return an associative array of available reply statuses
     1738 * Return an associative array of available reply statuses.
    17391739 *
    17401740 * @since 2.6.0 bbPress (r5399)
    17411741 *
    1742  * @param int $reply_id   Optional. Reply id.
     1742 * @param int $reply_id Optional. Reply id.
    17431743 *
    17441744 * @return array
     
    17601760
    17611761/**
    1762  * Return array of available reply toggle actions
     1762 * Return array of available reply toggle actions.
    17631763 *
    17641764 * @since 2.6.0 bbPress (r6133)
    17651765 *
    1766  * @param int $reply_id   Optional. Reply id.
     1766 * @param int $reply_id Optional. Reply id.
    17671767 *
    17681768 * @return array
     
    18191819
    18201820/**
    1821  * Marks a reply as spam
     1821 * Marks a reply as spam.
    18221822 *
    18231823 * @since 2.0.0 bbPress (r2740)
    18241824 *
    1825  * @param int $reply_id Reply id
    1826  * @return mixed False or {@link WP_Error} on failure, reply id on success
     1825 * @param int $reply_id Reply id.
     1826 * @return mixed False or {@link WP_Error} on failure, reply id on success.
    18271827 */
    18281828function bbp_spam_reply( $reply_id = 0 ) {
     
    18621862
    18631863/**
    1864  * Unspams a reply
     1864 * Unspams a reply.
    18651865 *
    18661866 * @since 2.0.0 bbPress (r2740)
    18671867 *
    1868  * @param int $reply_id Reply id
    1869  * @return mixed False or {@link WP_Error} on failure, reply id on success
     1868 * @param int $reply_id Reply id.
     1869 * @return mixed False or {@link WP_Error} on failure, reply id on success.
    18701870 */
    18711871function bbp_unspam_reply( $reply_id = 0 ) {
     
    19101910
    19111911/**
    1912  * Approves a reply
     1912 * Approves a reply.
    19131913 *
    19141914 * @since 2.6.0 bbPress (r5506)
    19151915 *
    1916  * @param int $reply_id Reply id
    1917  * @return mixed False or {@link WP_Error} on failure, reply id on success
     1916 * @param int $reply_id Reply id.
     1917 * @return mixed False or {@link WP_Error} on failure, reply id on success.
    19181918 */
    19191919function bbp_approve_reply( $reply_id = 0 ) {
     
    19561956
    19571957/**
    1958  * Unapproves a reply
     1958 * Unapproves a reply.
    19591959 *
    19601960 * @since 2.6.0 bbPress (r5506)
    19611961 *
    1962  * @param int $reply_id Reply id
    1963  * @return mixed False or {@link WP_Error} on failure, reply id on success
     1962 * @param int $reply_id Reply id.
     1963 * @return mixed False or {@link WP_Error} on failure, reply id on success.
    19641964 */
    19651965function bbp_unapprove_reply( $reply_id = 0 ) {
     
    20012001
    20022002/**
    2003  * Called before deleting a reply
     2003 * Called before deleting a reply.
     2004 *
     2005 * @since 2.0.0 bbPress (r2895)
    20042006 */
    20052007function bbp_delete_reply( $reply_id = 0 ) {
     
    20142016
    20152017/**
    2016  * Called before trashing a reply
     2018 * Called before trashing a reply.
     2019 *
     2020 * @since 2.0.0 bbPress (r2895)
    20172021 */
    20182022function bbp_trash_reply( $reply_id = 0 ) {
     
    20272031
    20282032/**
    2029  * Called before untrashing (restoring) a reply
     2033 * Called before untrashing (restoring) a reply.
     2034 *
     2035 * @since 2.0.0 bbPress (r2895)
    20302036 */
    20312037function bbp_untrash_reply( $reply_id = 0 ) {
     
    20422048
    20432049/**
    2044  * Called after deleting a reply
     2050 * Called after deleting a reply.
    20452051 *
    20462052 * @since 2.0.0 bbPress (r2993)
     
    20572063
    20582064/**
    2059  * Called after trashing a reply
     2065 * Called after trashing a reply.
    20602066 *
    20612067 * @since 2.0.0 bbPress (r2993)
     
    20722078
    20732079/**
    2074  * Called after untrashing (restoring) a reply
     2080 * Called after untrashing (restoring) a reply.
    20752081 *
    20762082 * @since 2.0.0 bbPress (r2993)
     
    20892095
    20902096/**
    2091  * Return the replies per page setting
     2097 * Return the replies per page setting.
    20922098 *
    20932099 * @since 2.0.0 bbPress (r3540)
    20942100 *
    2095  * @param int $default Default replies per page (15)
     2101 * @param int $default Default replies per page (15).
    20962102 * @return int
    20972103 */
     
    21112117
    21122118/**
    2113  * Return the replies per RSS page setting
     2119 * Return the replies per RSS page setting.
    21142120 *
    21152121 * @since 2.0.0 bbPress (r3540)
    21162122 *
    2117  * @param int $default Default replies per page (25)
     2123 * @param int $default Default replies per page (25).
    21182124 * @return int
    21192125 */
     
    21352141
    21362142/**
    2137  * Check if autoembeds are enabled and hook them in if so
     2143 * Check if auto-embeds are enabled and hook them in if so.
    21382144 *
    21392145 * @since 2.1.0 bbPress (r3752)
     
    21522158
    21532159/**
    2154  * Used by bbp_has_replies() to add the lead topic post to the posts loop
     2160 * Used by bbp_has_replies() to add the lead topic post to the posts loop.
    21552161 *
    21562162 * This function filters the 'post_where' of the WP_Query, and changes the query
     
    23552361
    23562362/**
    2357  * Redirect if unauthorized user is attempting to edit a reply
     2363 * Redirect if unauthorized user is attempting to edit a reply.
    23582364 *
    23592365 * @since 2.1.0 bbPress (r3605)
     
    24812487 *
    24822488 * @since 2.4.0 bbPress (r4944)
    2483  * @since 2.6.0 bbPress (r6245) Always false on user profile reply pages
    2484  *
    2485  * @param bool $default Optional. Default value true
     2489 * @since 2.6.0 bbPress (r6245) Always false on user profile reply pages.
     2490 *
     2491 * @param bool $default Optional. Default value true.
    24862492 *
    24872493 * @return bool Are replies threaded?
     
    25042510
    25052511/**
    2506  * List threaded replies
     2512 * List threaded replies.
    25072513 *
    25082514 * @since 2.4.0 bbPress (r4944)
     
    25622568
    25632569/**
    2564  * Validate a `reply_to` field for hierarchical replies
     2570 * Validate a `reply_to` field for hierarchical replies.
    25652571 *
    25662572 * Checks for 2 scenarios:
Note: See TracChangeset for help on using the changeset viewer.