Skip to:
Content

BuddyPress.org

Changeset 5472


Ignore:
Timestamp:
12/09/2011 04:49:04 PM (15 years ago)
Author:
johnjamesjacoby
Message:

Add more common paths to BP_Component::includes method. Also add some stripslashing. Fixes #3823.

File:
1 edited

Legend:

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

    r5148 r5472  
    174174                        return;
    175175
     176                $slashed_path = trailingslashit( $this->path );
     177
    176178                // Loop through files to be included
    177179                foreach ( $includes as $file ) {
    178180
    179                         // Check path + file
    180                         if ( @is_file( $this->path . '/' . $file ) )
    181                                 require( $this->path . '/' . $file );
    182 
    183                         // Check path + /bp-component/ + file
    184                         elseif ( @is_file( $this->path . '/bp-' . $this->id . '/' . $file ) )
    185                                 require( $this->path . '/bp-' . $this->id . '/' . $file );
    186 
    187                         // Check buddypress/bp-component/bp-component-$file.php
    188                         elseif ( @is_file( $this->path . '/bp-' . $this->id . '/bp-' . $this->id . '-' . $file  . '.php' ) )
    189                                 require( $this->path . '/bp-' . $this->id . '/bp-' . $this->id . '-' . $file . '.php' );
    190 
     181                        $paths = array(
     182
     183                                // Passed with no extension
     184                                'bp-' . $this->id . '/bp-' . $this->id . '-' . $file  . '.php',
     185                                'bp-' . $this->id . '-' . $file . '.php',
     186                                'bp-' . $this->id . '/' . $file . '.php',
     187
     188                                // Passed with extension
     189                                $file,
     190                                'bp-' . $this->id . '-' . $file,
     191                                'bp-' . $this->id . '/' . $file,
     192                        );
     193
     194                        foreach ( $paths as $path ) {
     195                                if ( @is_file( $slashed_path . $path ) ) {
     196                                        require( $slashed_path . $path );
     197                                        continue;
     198                                }
     199                        }
    191200                }
    192201
Note: See TracChangeset for help on using the changeset viewer.