Skip to:
Content

BuddyPress.org

Changeset 8463


Ignore:
Timestamp:
05/31/2014 11:44:12 PM (11 years ago)
Author:
johnjamesjacoby
Message:

Replace function_exists() checks with is_callable() in template stack functions. Props boonebgorges. See: #5671

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/bp-core-template-loader.php

    r8462 r8463  
    123123 * @since BuddyPress (1.7.0)
    124124 *
    125  * @todo Make 'callable' instead of 'function'.
    126  *
    127125 * @param string $location_callback Callback function that returns the stack location.
    128126 * @param int $priority Optional. The priority parameter as passed to
     
    132130function bp_register_template_stack( $location_callback = '', $priority = 10 ) {
    133131
    134     // Bail if no location, or function does not exist
    135     if ( empty( $location_callback ) ) {
     132    // Bail if no location, or function/method is not callable
     133    if ( empty( $location_callback ) || ! is_callable( $location_callback ) ) {
    136134        return false;
    137     }
    138 
    139     // Bail if callback function does not exist
    140     if ( ! is_array( $location_callback ) ) {
    141         if ( ! function_exists( $location_callback ) ) {
    142             return false;
    143         }
    144135    }
    145136
     
    162153function bp_deregister_template_stack( $location_callback = '', $priority = 10 ) {
    163154
    164     // Bail if no location, or function does not exist
    165     if ( empty( $location_callback ) ) {
     155    // Bail if no location, or function/method is not callable
     156    if ( empty( $location_callback ) || ! is_callable( $location_callback ) ) {
    166157        return false;
    167     }
    168 
    169     // Bail if callback function does not exist
    170     if ( ! is_array( $location_callback ) ) {
    171         if ( ! function_exists( $location_callback ) ) {
    172             return false;
    173         }
    174158    }
    175159
Note: See TracChangeset for help on using the changeset viewer.