Skip to:
Content

bbPress.org

Changeset 5355


Ignore:
Timestamp:
05/31/2014 04:23:48 PM (8 years ago)
Author:
johnjamesjacoby
Message:

In template stack functions, wrap function_exists() checks with is_array() check. Allows class methods to be used as template stack locations. See: https://buddypress.trac.wordpress.org/ticket/5671

File:
1 edited

Legend:

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

    r5283 r5355  
    256256 * @since bbPress (r4323)
    257257 *
    258  * @param string $location Callback function that returns the
     258 * @param string $location_callback Callback function that returns the
    259259 * @param int $priority
    260260 */
     
    262262
    263263    // Bail if no location, or function does not exist
    264     if ( empty( $location_callback ) || ! function_exists( $location_callback ) )
     264    if ( empty( $location_callback ) ) {
    265265        return false;
     266    }
     267
     268    // Bail if callback function does not exist
     269    if ( ! is_array( $location_callback ) ) {
     270        if ( ! function_exists( $location_callback ) ) {
     271            return false;
     272        }
     273    }
    266274
    267275    // Add location callback to template stack
     
    274282 * @since bbPress (r4652)
    275283 *
    276  * @param string $location Callback function that returns the
     284 * @param string $location_callback Callback function that returns the
    277285 * @param int $priority
    278286 * @see bbp_register_template_stack()
     
    281289
    282290    // Bail if no location, or function does not exist
    283     if ( empty( $location_callback ) || ! function_exists( $location_callback ) )
     291    if ( empty( $location_callback ) ) {
    284292        return false;
     293    }
     294
     295    // Bail if callback function does not exist
     296    if ( ! is_array( $location_callback ) ) {
     297        if ( ! function_exists( $location_callback ) ) {
     298            return false;
     299        }
     300    }
    285301
    286302    // Remove location callback to template stack
Note: See TracChangeset for help on using the changeset viewer.