| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: BuddyBoss |
| 4 |
* Plugin URI: https://www.buddyboss.com/platform/ |
| 5 |
* |
| 6 |
* Compatibility Description: Ensures compatibility with BuddyBoss. |
| 7 |
* |
| 8 |
*/ |
| 9 |
|
| 10 |
namespace wpCloud\StatelessMedia { |
| 11 |
|
| 12 |
if( !class_exists( 'wpCloud\StatelessMedia\BuddyBoss' ) ) { |
| 13 |
|
| 14 |
class BuddyBoss extends ICompatibility { |
| 15 |
protected $id = 'buddyboss'; |
| 16 |
protected $title = 'BuddyBoss'; |
| 17 |
protected $constant = 'WP_STATELESS_COMPATIBILITY_BUDDYBOSS'; |
| 18 |
protected $description = 'Ensures compatibility with BuddyBoss.'; |
| 19 |
protected $plugin_file = [ 'buddyboss-platform/bp-loader.php' ]; |
| 20 |
protected $sm_mode_not_supported = [ 'stateless' ]; |
| 21 |
|
| 22 |
/** |
| 23 |
* @param $sm |
| 24 |
*/ |
| 25 |
public function module_init( $sm ) { |
| 26 |
add_filter( 'stateless_skip_cache_busting', array( $this, 'skip_cache_busting' ), 10, 2 ); |
| 27 |
} |
| 28 |
|
| 29 |
/** |
| 30 |
* skip cache busting for template file name. |
| 31 |
* @param $return |
| 32 |
* @param $filename |
| 33 |
* @return mixed |
| 34 |
*/ |
| 35 |
public function skip_cache_busting( $return, $filename ) { |
| 36 |
$info = pathinfo( $filename ); |
| 37 |
$backtrace = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, 8 ); |
| 38 |
if( empty( $info[ 'extension' ] ) && strpos( $backtrace[ 6 ][ 'file' ], '/buddyboss-platform/' ) !== false ) { |
| 39 |
return $filename; |
| 40 |
} |
| 41 |
return $return; |
| 42 |
} |
| 43 |
|
| 44 |
} |
| 45 |
|
| 46 |
} |
| 47 |
|
| 48 |
} |
| 49 |
|