PluginProbe
WP-Stateless – Google Cloud Storage / 2.3.2
WP-Stateless – Google Cloud Storage v2.3.2
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 / class-compatibility.php

class-compatibility.php in WP-Stateless – Google Cloud Storage 2.3.2, at lib/classes/class-compatibility.php

188 lines 5.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Compatibility with other plugins.
4 *
5 * This class serves as compatibility getway.
6 * Initiate all compatibility modules.
7 *
8 * @class Compatibility
9 */
10
11 namespace wpCloud\StatelessMedia {
12
13 class Module{
14
15 private static $modules = array();
16
17 /**
18 * Object initiated on Bootstrap::__construct
19 * Save module data on admin_init hook.
20 * Initiate all the compatibility modules.
21 */
22 public function __construct(){
23 add_action( 'admin_init', array($this, 'save_modules'), 1 );
24
25 /**
26 * Dynamic Image Support
27 */
28 new DynamicImageSupport();
29
30 /**
31 * ACF image crop addons compatibility.
32 */
33 new CompatibilityAcfImageCrop();
34
35 /**
36 * Support for Easy Digital Downloads download method
37 */
38 new EDDDownloadMethod();
39
40 /**
41 * Support for SiteOrigin widget CSS files
42 */
43 new SOWidgetCSS();
44
45 /**
46 * Support for SiteOrigin CSS files
47 */
48 new SOCSS();
49
50 /**
51 * Support for Gravity Form file upload field
52 */
53 new GravityForm();
54
55 /**
56 * Support for WPBakery Page Builder
57 */
58 new WPBakeryPageBuilder();
59
60 /**
61 * Support for Imagify
62 */
63 new Imagify();
64
65 /**
66 * Support for ShortPixel Image Optimizer
67 */
68 new ShortPixel();
69
70 /**
71 * Support for WPForms
72 */
73 new WPForms();
74
75 /**
76 * Support for WPForms
77 */
78 new WPSmush();
79
80 /**
81 * Support for WPForms
82 */
83 new CompatibilityWooExtraProductOptions();
84
85 /**
86 * Support for Elementor
87 */
88 new Elementor();
89
90 /**
91 * Support for Divi
92 */
93 new Divi();
94
95 /**
96 * Support for LearnDash
97 */
98 new LearnDash();
99
100 /**
101 * Support for BuddyPress
102 */
103 new BuddyPress();
104
105 /**
106 * Support for BuddyBoss
107 */
108 new BuddyBoss();
109
110 /**
111 * LiteSpeed Cache
112 */
113 new LSCacheWP();
114
115 /**
116 * EWWW Image Optimizer
117 */
118 new EWWW();
119
120 /**
121 * WP Retina 2x
122 */
123 new WPRetina2x();
124 }
125
126 /**
127 * Register compatibility modules so that we can ues them in settings page.
128 * Called from ICompatibility::init() method.
129 */
130 public static function register_module($args){
131 if(empty($args['id'])){
132 return;
133 }
134 if (is_bool($args['enabled'])) {
135 $args['enabled'] = $args['enabled'] ? 'true' : 'false';
136 }
137 self::$modules[$args['id']] = wp_parse_args( $args, array(
138 'id' => '',
139 'self' => '',
140 'title' => '',
141 'enabled' => false,
142 'description' => '',
143 'is_constant' => false,
144 'is_network' => false,
145 'is_plugin_active' => false,
146 ));
147 }
148
149 /**
150 * Return all the registered modules.
151 * Used in admin_init in bootstrap class as localize_script.
152 */
153 public static function get_modules(){
154 return self::$modules;
155 }
156
157 /**
158 * Return all the registered modules.
159 * Used in admin_init in bootstrap class as localize_script.
160 */
161 public static function get_module($id){
162 if(!empty(self::$modules[$id])){
163 return self::$modules[$id];
164 }
165 return false;
166 }
167
168 /**
169 * Handles saving module data.
170 * Enable or disable modules from Compatibility tab.
171 */
172 public function save_modules(){
173 if (isset($_POST['action']) && $_POST['action'] == 'stateless_modules' && wp_verify_nonce($_POST['_smnonce'], 'wp-stateless-modules')) {
174 $modules = !empty($_POST['stateless-modules']) ? $_POST['stateless-modules'] : array();
175 $modules = apply_filters('stateless::modules::save', $modules);
176
177 if(is_network_admin()){
178 update_site_option('stateless-modules', $modules);
179 }
180 else{
181 update_option('stateless-modules', $modules, true);
182 }
183 wp_redirect( $_POST['_wp_http_referer'] );
184 }
185 }
186 }
187
188 }