PluginProbe
WP-Stateless – Google Cloud Storage / 2.2.3
WP-Stateless – Google Cloud Storage v2.2.3
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 2.2.3, at lib/classes/compatibility/learn-dash.php

63 lines 2.0 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 public function module_init($sm){
22 // exclude randomize_filename from LearnDash page
23 add_filter('stateless_skip_cache_busting', array($this, 'skip_cache_busting'), 10, 2);
24 }
25
26 /**
27 * Whether skip cache busting or not.
28 */
29 public function skip_cache_busting($return, $filename){
30 if(strpos($filename, 'sfwd-') === 0 || $this->hook_from_learndash()){
31 return $filename;
32 }
33 return $return;
34 }
35
36 /**
37 * Determine where we hook from
38 * We need to do this only for something specific in LearnDash plugin
39 *
40 * @return bool
41 */
42 private function hook_from_learndash() {
43 $call_stack = debug_backtrace();
44 if(
45 !empty($call_stack[6]['function']) &&
46 $call_stack[6]['function'] == 'sanitize_file_name' &&
47 (
48 strpos( $call_stack[6]['file'], 'class-ld-semper-fi-module.php' ) ||
49 strpos( $call_stack[6]['file'], 'class-ld-cpt-instance.php' )
50 )
51 ){
52 return true;
53 }
54
55 return false;
56 }
57
58 }
59
60 }
61
62 }
63