Skip to:
Content

BuddyPress.org

Changeset 8572


Ignore:
Timestamp:
07/09/2014 07:41:07 PM (12 years ago)
Author:
johnjamesjacoby
Message:

In BP_Component::includes(), ensure dynamic action fires even when $includes array is empty.

File:
1 edited

Legend:

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

    r8090 r8572  
    293293
    294294                // Bail if no files to include
    295                 if ( empty( $includes ) )
    296                         return;
    297 
    298                 $slashed_path = trailingslashit( $this->path );
    299 
    300                 // Loop through files to be included
    301                 foreach ( (array) $includes as $file ) {
    302 
    303                         $paths = array(
    304 
    305                                 // Passed with no extension
    306                                 'bp-' . $this->id . '/bp-' . $this->id . '-' . $file  . '.php',
    307                                 'bp-' . $this->id . '-' . $file . '.php',
    308                                 'bp-' . $this->id . '/' . $file . '.php',
    309 
    310                                 // Passed with extension
    311                                 $file,
    312                                 'bp-' . $this->id . '-' . $file,
    313                                 'bp-' . $this->id . '/' . $file,
    314                         );
    315 
    316                         foreach ( $paths as $path ) {
    317                                 if ( @is_file( $slashed_path . $path ) ) {
    318                                         require( $slashed_path . $path );
    319                                         break;
     295                if ( ! empty( $includes ) ) {
     296                        $slashed_path = trailingslashit( $this->path );
     297
     298                        // Loop through files to be included
     299                        foreach ( (array) $includes as $file ) {
     300
     301                                $paths = array(
     302
     303                                        // Passed with no extension
     304                                        'bp-' . $this->id . '/bp-' . $this->id . '-' . $file  . '.php',
     305                                        'bp-' . $this->id . '-' . $file . '.php',
     306                                        'bp-' . $this->id . '/' . $file . '.php',
     307
     308                                        // Passed with extension
     309                                        $file,
     310                                        'bp-' . $this->id . '-' . $file,
     311                                        'bp-' . $this->id . '/' . $file,
     312                                );
     313
     314                                foreach ( $paths as $path ) {
     315                                        if ( @is_file( $slashed_path . $path ) ) {
     316                                                require( $slashed_path . $path );
     317                                                break;
     318                                        }
    320319                                }
    321320                        }
    322                 }
     321        }
    323322
    324323                // Call action
     
    427426
    428427                // Bail if this is an ajax request
    429                 if ( defined( 'DOING_AJAX' ) )
     428                if ( defined( 'DOING_AJAX' ) ) {
    430429                        return;
     430                }
    431431
    432432                // Do not proceed if BP_USE_WP_ADMIN_BAR constant is not set or is false
    433                 if ( !bp_use_wp_admin_bar() )
     433                if ( ! bp_use_wp_admin_bar() ) {
    434434                        return;
     435                }
    435436
    436437                // Filter the passed admin nav
Note: See TracChangeset for help on using the changeset viewer.