Skip to:
Content

bbPress.org

Changeset 6353


Ignore:
Timestamp:
03/03/2017 03:47:24 AM (8 years ago)
Author:
johnjamesjacoby
Message:

Core: General core function clean-up.

Mostly odds & ends, formatting, type-casting, etc...

Location:
trunk/src/includes/core
Files:
2 edited

Legend:

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

    r6337 r6353  
    7979
    8080/**
    81  * Update a posts' forum meta ID
     81 * Update the forum meta ID of a post
    8282 *
    8383 * @since 2.0.0 bbPress (r3181)
     
    8686 * @param int $forum_id The forum
    8787 */
    88 function bbp_update_forum_id( $post_id, $forum_id ) {
     88function bbp_update_forum_id( $post_id = 0, $forum_id = 0 ) {
    8989
    9090    // Allow the forum ID to be updated 'just in time' before save
     
    9898
    9999/**
    100  * Update a posts' topic meta ID
     100 * Update the topic meta ID of a post
    101101 *
    102102 * @since 2.0.0 bbPress (r3181)
     
    105105 * @param int $topic_id The topic
    106106 */
    107 function bbp_update_topic_id( $post_id, $topic_id ) {
     107function bbp_update_topic_id( $post_id = 0, $topic_id = 0 ) {
    108108
    109109    // Allow the topic ID to be updated 'just in time' before save
     
    117117
    118118/**
    119  * Update a posts' reply meta ID
     119 * Update the reply meta ID of a post
    120120 *
    121121 * @since 2.0.0 bbPress (r3181)
     
    124124 * @param int $reply_id The reply
    125125 */
    126 function bbp_update_reply_id( $post_id, $reply_id ) {
     126function bbp_update_reply_id( $post_id = 0, $reply_id = 0 ) {
    127127
    128128    // Allow the reply ID to be updated 'just in time' before save
     
    136136
    137137/**
    138  * Update a posts' reply-to meta ID
     138 * Update the reply-to meta ID of a post
    139139 *
    140140 * @since 2.6.0 bbPress (r5735)
     
    143143 * @param int $reply_id The reply ID
    144144 */
    145 function bbp_update_reply_to_id( $post_id, $reply_id ) {
     145function bbp_update_reply_to_id( $post_id = 0, $reply_id = 0 ) {
    146146
    147147    // Allow the reply ID to be updated 'just in time' before save
     
    238238
    239239/**
    240  * Run the view's query
     240 * Run the query of a topic-view
    241241 *
    242242 * @since 2.0.0 bbPress (r2789)
     
    252252function bbp_view_query( $view = '', $new_args = '' ) {
    253253
     254    // Get view, or bail
    254255    $view = bbp_get_view_id( $view );
    255256    if ( empty( $view ) ) {
     
    268269
    269270/**
    270  * Return the view's query arguments
     271 * Return the query arguments of a topic-view
    271272 *
    272273 * @since 2.0.0 bbPress (r2789)
     
    276277 * @return array Query arguments
    277278 */
    278 function bbp_get_view_query_args( $view ) {
     279function bbp_get_view_query_args( $view = '' ) {
     280    $bbp    = bbpress();
    279281    $view   = bbp_get_view_id( $view );
    280     $retval = ! empty( $view )
    281         ? bbpress()->views[ $view ]['query']
     282    $retval = ! empty( $view ) && ! empty( $bbp->views[ $view ] )
     283        ? $bbp->views[ $view ]['query']
    282284        : false;
    283285
     
    314316 */
    315317function bbp_has_errors() {
    316     $has_errors = bbpress()->errors->get_error_codes() ? true : false;
    317 
    318     return apply_filters( 'bbp_has_errors', $has_errors, bbpress()->errors );
     318    $has_errors = bbpress()->errors->get_error_codes()
     319        ? true
     320        : false;
     321
     322    return (bool) apply_filters( 'bbp_has_errors', $has_errors, bbpress()->errors );
    319323}
    320324
  • trunk/src/includes/core/theme-compat.php

    r6342 r6353  
    10061006
    10071007    // Default return value is what is passed in $open
    1008     $retval = $open;
     1008    $retval = (bool) $open;
    10091009
    10101010    // Only force for bbPress post types
     
    10181018
    10191019    // Allow override of the override
    1020     return apply_filters( 'bbp_force_comment_status', $retval, $open, $post_id, $post_type );
    1021 }
     1020    return (bool) apply_filters( 'bbp_force_comment_status', $retval, $open, $post_id, $post_type );
     1021}
Note: See TracChangeset for help on using the changeset viewer.