Skip to:
Content

bbPress.org


Ignore:
Timestamp:
05/27/2017 05:04:31 PM (7 years ago)
Author:
johnjamesjacoby
Message:

Tools: Add //Filter & return note for future discovery of missing filter documentation.

Also adjust some type-casting on filtered results.

File:
1 edited

Legend:

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

    r6415 r6438  
    8181    do_action( 'bbp_insert_topic', (int) $topic_id, (int) $topic_meta['forum_id'] );
    8282
    83     // Return new topic ID
     83    // Return topic_id
    8484    return $topic_id;
    8585}
     
    20192019 */
    20202020function bbp_get_topic_statuses( $topic_id = 0 ) {
    2021     return apply_filters( 'bbp_get_topic_statuses', array(
     2021
     2022    // Filter & return
     2023    return (array) apply_filters( 'bbp_get_topic_statuses', array(
    20222024        bbp_get_public_status_id()  => _x( 'Open',    'Open the topic',        'bbpress' ),
    20232025        bbp_get_closed_status_id()  => _x( 'Closed',  'Close the topic',       'bbpress' ),
     
    20382040 */
    20392041function bbp_get_topic_types( $topic_id = 0 ) {
    2040     return apply_filters( 'bbp_get_topic_types', array(
     2042
     2043    // Filter & return
     2044    return (array) apply_filters( 'bbp_get_topic_types', array(
    20412045        'unstick' => _x( 'Normal',       'Unstick a topic',         'bbpress' ),
    20422046        'stick'   => _x( 'Sticky',       'Make topic sticky',       'bbpress' ),
     
    20552059 */
    20562060function bbp_get_topic_toggles( $topic_id = 0 ) {
    2057     return apply_filters( 'bbp_get_toggle_topic_actions', array(
     2061
     2062    // Filter & return
     2063    return (array) apply_filters( 'bbp_get_toggle_topic_actions', array(
    20582064        'bbp_toggle_topic_close',
    20592065        'bbp_toggle_topic_stick',
     
    20892095        : wp_parse_id_list( $stickies );
    20902096
    2091     // Filter and return
     2097    // Filter & return
    20922098    return (array) apply_filters( 'bbp_get_stickies', $stickies, $forum_id );
    20932099}
     
    21122118        : wp_parse_id_list( $stickies );
    21132119
    2114     // Filter and return
     2120    // Filter & return
    21152121    return (array) apply_filters( 'bbp_get_super_stickies', $stickies );
    21162122}
     
    24732479    update_post_meta( $topic_id, '_bbp_reply_count', $new_count );
    24742480
     2481    // Filter & return
    24752482    return (int) apply_filters( 'bbp_bump_topic_reply_count', $new_count, $topic_id, $difference );
    24762483}
     
    25722579    update_post_meta( $topic_id, '_bbp_reply_count_hidden', $new_count );
    25732580
     2581    // Filter & return
    25742582    return (int) apply_filters( 'bbp_bump_topic_reply_count_hidden', $new_count, $topic_id, $difference );
    25752583}
     
    26952703    update_post_meta( $topic_id, '_bbp_forum_id', $forum_id );
    26962704
     2705    // Filter & return
    26972706    return (int) apply_filters( 'bbp_update_topic_forum_id', $forum_id, $topic_id );
    26982707}
     
    27142723    update_post_meta( $topic_id, '_bbp_topic_id', $topic_id );
    27152724
     2725    // Filter & return
    27162726    return apply_filters( 'bbp_update_topic_topic_id', $topic_id );
    27172727}
     
    27522762    update_post_meta( $topic_id, '_bbp_reply_count', $reply_count );
    27532763
     2764    // Filter & return
    27542765    return (int) apply_filters( 'bbp_update_topic_reply_count', $reply_count, $topic_id );
    27552766}
     
    27992810    update_post_meta( $topic_id, '_bbp_reply_count_hidden', $reply_count );
    28002811
     2812    // Filter & return
    28012813    return (int) apply_filters( 'bbp_update_topic_reply_count_hidden', $reply_count, $topic_id );
    28022814}
     
    28452857    }
    28462858
     2859    // Filter & return
    28472860    return (int) apply_filters( 'bbp_update_topic_last_active_id', $active_id, $topic_id );
    28482861}
     
    28832896    }
    28842897
     2898    // Filter & return
    28852899    return apply_filters( 'bbp_update_topic_last_active_time', $new_time, $topic_id );
    28862900}
     
    29312945    }
    29322946
     2947    // Filter & return
    29332948    return (int) apply_filters( 'bbp_update_topic_last_reply_id', $reply_id, $topic_id );
    29342949}
     
    29893004    update_post_meta( $topic_id, '_bbp_voice_count', $count );
    29903005
     3006    // Filter & return
    29913007    return (int) apply_filters( 'bbp_update_topic_voice_count', $count, $topic_id );
    29923008}
     
    30293045    update_post_meta( $topic_id, '_bbp_anonymous_reply_count', $replies );
    30303046
     3047    // Filter & return
    30313048    return (int) apply_filters( 'bbp_update_topic_anonymous_reply_count', $replies, $topic_id );
    30323049}
     
    39423959    }
    39433960
    3944     // Filter and return
     3961    // Filter & return
    39453962    return (int) apply_filters( 'bbp_get_topics_per_page', $retval, $default );
    39463963}
     
    39663983    }
    39673984
    3968     // Filter and return
     3985    // Filter & return
    39693986    return (int) apply_filters( 'bbp_get_topics_per_rss_page', $retval, $default );
    39703987}
     
    39864003    $topic_tags = array_filter( $terms );
    39874004
     4005    // Filter & return
    39884006    return apply_filters( 'bbp_get_topic_tags', $topic_tags, $topic_id );
    39894007}
     
    40024020    $topic_tags = bbp_get_topic_tags( $topic_id );
    40034021    $pluck      = wp_list_pluck( $topic_tags, 'name' );
    4004     $terms      = ! empty( $pluck ) ? implode( $sep, $pluck ) : '';
    4005 
     4022    $terms      = ! empty( $pluck )
     4023        ? implode( $sep, $pluck )
     4024        : '';
     4025
     4026    // Filter & return
    40064027    return apply_filters( 'bbp_get_topic_tag_names', $terms, $topic_id, $sep );
    40074028}
Note: See TracChangeset for help on using the changeset viewer.