Skip to:
Content

BuddyPress.org

Ticket #5652: 5652.ray.patch

File 5652.ray.patch, 2.8 KB (added by r-a-y, 11 years ago)
  • bp-loader.php

     
    3030// Load from source if no build exists
    3131if ( ! file_exists( $bp_loader ) || defined( 'BP_LOAD_SOURCE' ) ) {
    3232        $bp_loader = __DIR__ . '/src/bp-loader.php';
     33        $mode = 'src';
     34} else {
     35        $mode = 'build';
     36}
     37
     38// Set load mode
     39define( 'BP_LOAD_MODE', $mode );
     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
    3550// Include BuddyPress
  • src/bp-loader.php

     
    227227
    228228                // Path and URL
    229229                if ( ! defined( 'BP_PLUGIN_DIR' ) ) {
    230                         define( 'BP_PLUGIN_DIR', trailingslashit( plugin_dir_path( __FILE__ ) ) );
     230                        define( 'BP_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
    231231                }
    232232
    233233                if ( ! defined( 'BP_PLUGIN_URL' ) ) {
    234                         $plugin_url = plugin_dir_url( __FILE__ );
    235 
    236                         // If we're using https, update the protocol. Workaround for WP13941, WP15928, WP19037.
    237                         if ( is_ssl() )
    238                                 $plugin_url = str_replace( 'http://', 'https://', $plugin_url );
     234                        define( 'BP_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
     235                }
    239236
    240                         define( 'BP_PLUGIN_URL', $plugin_url );
     237                if ( ! defined( 'BP_LOAD_MODE' ) ) {
     238                        define( 'BP_LOAD_MODE', '' );
    241239                }
    242240
    243241                // Define on which blog ID BuddyPress should run
     
    260258                                        $plugins = get_site_option( 'active_sitewide_plugins');
    261259
    262260                                        // basename
    263                                         $basename = plugin_basename( constant( 'BP_PLUGIN_DIR' ) . 'bp-loader.php' );
     261                                        $basename = basename( constant( 'BP_PLUGIN_DIR' ) ) . '/bp-loader.php';
    264262
    265263                                        // plugin is network-activated; use main site ID instead
    266264                                        if ( isset( $plugins[ $basename ] ) ) {
     
    358356                /** Paths******************************************************/
    359357
    360358                // BuddyPress root directory
    361                 $this->file           = __FILE__;
    362                 $this->basename       = str_replace( array( 'build/', 'src/' ), '', plugin_basename( $this->file ) );
    363                 $this->plugin_dir     = BP_PLUGIN_DIR;
    364                 $this->plugin_url     = BP_PLUGIN_URL;
     359                $this->file           = constant( 'BP_PLUGIN_DIR' ) . 'bp-loader.php';
     360                $this->basename       = basename( constant( 'BP_PLUGIN_DIR' ) ) . '/bp-loader.php';
     361                $this->plugin_dir     = trailingslashit( constant( 'BP_PLUGIN_DIR' ) . constant( 'BP_LOAD_MODE' ) );
     362                $this->plugin_url     = trailingslashit( constant( 'BP_PLUGIN_URL' ) . constant( 'BP_LOAD_MODE' ) );
    365363
    366364                // Languages
    367365                $this->lang_dir       = $this->plugin_dir . 'bp-languages';