PluginProbe
WP-Stateless – Google Cloud Storage / 2.2.7
WP-Stateless – Google Cloud Storage v2.2.7
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.2.7, at lib/classes/class-compatibility.php

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