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

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