PluginProbe
WP-Stateless – Google Cloud Storage / 3.0
WP-Stateless – Google Cloud Storage v3.0
4.4.3 2.1.7 2.1.8 2.1.9 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.2.7 2.3.0 2.3.1 2.3.2 3.0 3.0.1 3.0.2 3.0.3 3.0.4 3.1.0 3.1.1 3.2.0 3.2.1 3.2.2 All 62 releases
wp-stateless / lib / classes / compatibility / learn-dash.php

learn-dash.php in WP-Stateless – Google Cloud Storage 3.0, at lib/classes/compatibility/learn-dash.php

70 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Name: WordPress LMS Plugin by LearnDash®
4 * Plugin URI: https://www.learndash.com/
5 *
6 * Compatibility Description: Ensures compatibility with LearnDash®.
7 *
8 */
9
10 namespace wpCloud\StatelessMedia {
11
12 if( !class_exists( 'wpCloud\StatelessMedia\LearnDash' ) ) {
13
14 class LearnDash extends ICompatibility {
15 protected $id = 'sfwd-lms';
16 protected $title = 'LearnDash LMS';
17 protected $constant = 'WP_STATELESS_COMPATIBILITY_LEARNDASH_LMS';
18 protected $description = 'Ensures compatibility with LearnDash.';
19 protected $plugin_file = [ 'sfwd-lms/sfwd_lms.php' ];
20
21 /**
22 * @param $sm
23 */
24 public function module_init( $sm ) {
25 // exclude randomize_filename from LearnDash page
26 add_filter( 'stateless_skip_cache_busting', array( $this, 'skip_cache_busting' ), 10, 2 );
27 }
28
29 /**
30 * Whether skip cache busting or not.
31 *
32 * @param $return
33 * @param $filename
34 * @return mixed
35 */
36 public function skip_cache_busting( $return, $filename ) {
37 if( strpos( $filename, 'sfwd-' ) === 0 || $this->hook_from_learndash() ) {
38 return $filename;
39 }
40 return $return;
41 }
42
43 /**
44 * Determine where we hook from
45 * We need to do this only for something specific in LearnDash plugin
46 *
47 * @return bool
48 */
49 private function hook_from_learndash() {
50 $call_stack = debug_backtrace();
51 if(
52 !empty($call_stack[6]['function']) &&
53 $call_stack[6]['function'] == 'sanitize_file_name' &&
54 (
55 strpos( $call_stack[6]['file'], 'class-ld-semper-fi-module.php' ) ||
56 strpos( $call_stack[6]['file'], 'class-ld-cpt-instance.php' )
57 )
58 ) {
59 return true;
60 }
61
62 return false;
63 }
64
65 }
66
67 }
68
69 }
70