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

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

183 lines 5.0 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 * LiteSpeed Cache
107 */
108 new LSCacheWP();
109
110 /**
111 * EWWW Image Optimizer
112 */
113 new EWWW();
114
115 /**
116 * WP Retina 2x
117 */
118 new WPRetina2x();
119 }
120
121 /**
122 * Register compatibility modules so that we can ues them in settings page.
123 * Called from ICompatibility::init() method.
124 */
125 public static function register_module($args){
126 if(empty($args['id'])){
127 return;
128 }
129 if (is_bool($args['enabled'])) {
130 $args['enabled'] = $args['enabled'] ? 'true' : 'false';
131 }
132 self::$modules[$args['id']] = wp_parse_args( $args, array(
133 'id' => '',
134 'self' => '',
135 'title' => '',
136 'enabled' => false,
137 'description' => '',
138 'is_constant' => false,
139 'is_network' => false,
140 'is_plugin_active' => false,
141 ));
142 }
143
144 /**
145 * Return all the registered modules.
146 * Used in admin_init in bootstrap class as localize_script.
147 */
148 public static function get_modules(){
149 return self::$modules;
150 }
151
152 /**
153 * Return all the registered modules.
154 * Used in admin_init in bootstrap class as localize_script.
155 */
156 public static function get_module($id){
157 if(!empty(self::$modules[$id])){
158 return self::$modules[$id];
159 }
160 return false;
161 }
162
163 /**
164 * Handles saving module data.
165 * Enable or disable modules from Compatibility tab.
166 */
167 public function save_modules(){
168 if (isset($_POST['action']) && $_POST['action'] == 'stateless_modules' && wp_verify_nonce($_POST['_smnonce'], 'wp-stateless-modules')) {
169 $modules = !empty($_POST['stateless-modules']) ? $_POST['stateless-modules'] : array();
170 $modules = apply_filters('stateless::modules::save', $modules);
171
172 if(is_network_admin()){
173 update_site_option('stateless-modules', $modules);
174 }
175 else{
176 update_option('stateless-modules', $modules, true);
177 }
178 wp_redirect( $_POST['_wp_http_referer'] );
179 }
180 }
181 }
182
183 }