Skip to:
Content

BuddyPress.org

Changeset 8740 for trunk/bp-loader.php


Ignore:
Timestamp:
07/30/2014 08:40:27 PM (11 years ago)
Author:
r-a-y
Message:

Streamline internal path and plugin directory properties.

Due to the introduction of Grunt (#5160), a few issues have popped up with
BP's internal properties (file, basename, plugin_dir, and plugin_url) being
incorrect for those running trunk.

To address this:

In the stub bp-loader.php file:

  • We introduce a new constant - BP_SOURCE_DIRECTORY - to determine what source folder is being run from trunk.
  • BP_PLUGIN_DIR and BP_PLUGIN_URL are defined so these constants take precedence over the ones in the main bp-loader.php file.
  • BP_PLUGIN_URL uses a slightly different algorithm to be nice to symlinked directories as plugin_dir_url() does not work properly in these instances.

In the main `bp-loader.php file:

  • BP_SOURCE_DIRECTORY is set to a blank string.
  • The file and basename are calculated based off the BP_PLUGIN_DIR constant
  • plugin_dir and plugin_url are set to whatever build is running

Fixes #5652.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-loader.php

    r8523 r8740  
    3131if ( ! file_exists( $bp_loader ) || defined( 'BP_LOAD_SOURCE' ) ) {
    3232    $bp_loader = dirname( __FILE__ ) . '/src/bp-loader.php';
     33    $subdir = 'src';
     34} else {
     35    $subdir = 'build';
     36}
     37
     38// Set source subdirectory
     39define( 'BP_SOURCE_SUBDIRECTORY', $subdir );
     40
     41// Define overrides - only applicable to those running trunk
     42if ( ! defined( 'BP_PLUGIN_DIR' ) ) {
     43    define( 'BP_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
     44}
     45if ( ! defined( 'BP_PLUGIN_URL' ) ) {
     46    // Be nice to symlinked directories
     47    define( 'BP_PLUGIN_URL', plugins_url( trailingslashit( basename( constant( 'BP_PLUGIN_DIR' ) ) ) ) );
    3348}
    3449
Note: See TracChangeset for help on using the changeset viewer.