Ticket #6457: 6457.02.patch
File 6457.02.patch, 5.0 KB (added by , 10 years ago) |
---|
-
bp-loader.php
30 30 // Load from source if no build exists 31 31 if ( ! file_exists( $bp_loader ) || defined( 'BP_LOAD_SOURCE' ) ) { 32 32 $bp_loader = dirname( __FILE__ ) . '/src/bp-loader.php'; 33 $subdir = 'src'; 34 } else { 35 $subdir = 'build'; 33 34 // We are loading from source 35 if ( ! defined( 'BP_LOAD_SOURCE' ) ) { 36 define( 'BP_LOAD_SOURCE', true ); 37 } 36 38 } 37 39 38 // Set source subdirectory 39 define( 'BP_SOURCE_SUBDIRECTORY', $subdir ); 40 41 // Define overrides - only applicable to those running trunk 40 // Directory & URL Overrides - necessary when developing BuddyPress 42 41 if ( ! defined( 'BP_PLUGIN_DIR' ) ) { 43 42 define( 'BP_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); 44 43 } 45 44 if ( ! defined( 'BP_PLUGIN_URL' ) ) { 46 // Be nice to symlinked directories47 45 define( 'BP_PLUGIN_URL', plugins_url( trailingslashit( basename( constant( 'BP_PLUGIN_DIR' ) ) ) ) ); 48 46 } 49 47 -
src/bp-loader.php
242 242 define( 'BP_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); 243 243 } 244 244 245 // Only applicable to those running trunk246 if ( ! defined( 'BP_SOURCE_SUBDIRECTORY' ) ) {247 define( 'BP_SOURCE_SUBDIRECTORY', '' );248 }249 250 245 // Define on which blog ID BuddyPress should run 251 246 if ( ! defined( 'BP_ROOT_BLOG' ) ) { 252 247 … … 379 374 380 375 /** Paths**************************************************************/ 381 376 377 // Assume BuddyPress is not running in a sub-directory 378 $sub_directory = ''; 379 380 // Are we currently developing BuddyPress 381 if ( defined( 'BP_LOAD_SOURCE' ) ) { 382 if ( true === constant( 'BP_LOAD_SOURCE' ) ) { 383 $sub_directory = 'src'; 384 } else { 385 $sub_directory = 'build'; 386 } 387 } 388 382 389 // BuddyPress root directory 383 390 $this->file = constant( 'BP_PLUGIN_DIR' ) . 'bp-loader.php'; 384 391 $this->basename = basename( constant( 'BP_PLUGIN_DIR' ) ) . '/bp-loader.php'; 385 $this->plugin_dir = trailingslashit( constant( 'BP_PLUGIN_DIR' ) . constant( 'BP_SOURCE_SUBDIRECTORY' ));386 $this->plugin_url = trailingslashit( constant( 'BP_PLUGIN_URL' ) . constant( 'BP_SOURCE_SUBDIRECTORY' ));392 $this->plugin_dir = trailingslashit( constant( 'BP_PLUGIN_DIR' ) . $sub_directory ); 393 $this->plugin_url = trailingslashit( constant( 'BP_PLUGIN_URL' ) . $sub_directory ); 387 394 388 395 // Languages 389 396 $this->lang_dir = $this->plugin_dir . 'bp-languages'; -
src/bp-templates/bp-legacy/buddypress-functions.php
381 381 * asset) 382 382 */ 383 383 private function locate_asset_in_stack( $file, $type = 'css', $script_handle = '' ) { 384 $locations = array();384 $locations = $subdirs = $retval = array(); 385 385 386 // Ensure the assets can be located when running from /src/. 387 if ( defined( 'BP_SOURCE_SUBDIRECTORY' ) && BP_SOURCE_SUBDIRECTORY === 'src' ) { 388 $file = str_replace( '.min', '', $file ); 386 // Assets in /src/ are not minified 387 if ( defined( 'BP_LOAD_SOURCE' ) ) { 388 $raw_file = str_replace( '.min', '', $file ); 389 } else { 390 $raw_file = $file; 389 391 } 390 392 391 393 // No need to check child if template == stylesheet … … 393 395 $locations['bp-child'] = array( 394 396 'dir' => get_stylesheet_directory(), 395 397 'uri' => get_stylesheet_directory_uri(), 396 'file' => $ file,398 'file' => $raw_file 397 399 ); 398 400 } 399 401 400 402 $locations['bp-parent'] = array( 401 403 'dir' => get_template_directory(), 402 404 'uri' => get_template_directory_uri(), 403 'file' => $ file,405 'file' => $raw_file 404 406 ); 405 407 406 408 $locations['bp-legacy'] = array( 407 409 'dir' => bp_get_theme_compat_dir(), 408 410 'uri' => bp_get_theme_compat_url(), 409 'file' => $ file,411 'file' => $raw_file 410 412 ); 411 413 412 // Subdirectories within the top-level $locations directories 413 $subdirs = array( 414 'buddypress/' . $type, 415 'community/' . $type, 416 $type, 417 ); 414 // Look for minified versions 415 if ( $raw_file !== $file ) { 418 416 419 $retval = array(); 417 // Define new locations array 418 $new_locations = array(); 420 419 420 // Loop through existing locations and add minified versions 421 foreach ( $locations as $location_type => $location_data ) { 422 423 // Repopulate current location 424 $new_locations[ $location_type ] = $location_data; 425 426 // Populate minified location 427 $location_key = $location_type . '-min'; 428 $new_locations[ $location_key ] = $location_data; 429 $new_locations[ $location_key ]['file'] = $file; 430 } 431 432 // Set locations to new locations 433 $locations = $new_locations; 434 } 435 436 // Subdirectories within top-level $locations directories 437 $asset_locations = bp_get_template_locations(); 438 foreach ( $asset_locations as $asset_location ) { 439 if ( ! empty( $asset_location ) ) { 440 $subdirs[] = "{$asset_location}/{$type}"; 441 } else { 442 $subdirs[] = $type; 443 } 444 } 445 446 // Look for assets 421 447 foreach ( $locations as $location_type => $location ) { 422 448 foreach ( $subdirs as $subdir ) { 423 449 if ( file_exists( trailingslashit( $location['dir'] ) . trailingslashit( $subdir ) . $location['file'] ) ) {