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

205 lines 4.4 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 * ACF image crop addons compatibility.
27 */
28 new CompatibilityAcfImageCrop();
29
30 /**
31 * Support for BuddyBoss
32 */
33 new BuddyBoss();
34
35 /**
36 * Support for BuddyPress
37 */
38 new BuddyPress();
39
40 /**
41 * Support for Divi
42 */
43 new Divi();
44
45 /**
46 * Dynamic Image Support
47 */
48 new DynamicImageSupport();
49
50 /**
51 * Support for Easy Digital Downloads download method
52 */
53 new EDDDownloadMethod();
54
55 /**
56 * Support for Elementor
57 */
58 new Elementor();
59
60 /**
61 * EWWW Image Optimizer
62 */
63 new EWWW();
64
65 /**
66 * Google App Engine
67 */
68 new GoogleAppEngine();
69
70 /**
71 * Support for Gravity Form file upload field
72 */
73 new GravityForm();
74
75 /**
76 * Support for Gravity Forms Signature Add-On
77 */
78 new GravityFormSignature();
79
80 /**
81 * Support for Imagify
82 */
83 new Imagify();
84
85 /**
86 * Support for LearnDash
87 */
88 new LearnDash();
89
90 /**
91 * LiteSpeed Cache
92 */
93 new LSCacheWP();
94
95 /**
96 * Polylang Pro
97 */
98 new Polylang();
99
100 /**
101 * Support for ShortPixel Image Optimizer
102 */
103 new ShortPixel();
104
105 /**
106 * Simple Local Avatars
107 */
108 new SimpleLocalAvatars();
109
110 /**
111 * Support for SiteOrigin CSS files
112 */
113 new SOCSS();
114
115 /**
116 * Support for SiteOrigin widget CSS files
117 */
118 new SOWidgetCSS();
119
120 /**
121 * VidoRev
122 */
123 new VidoRev();
124
125 /**
126 * WP Retina 2x
127 */
128 new WPRetina2x();
129
130 /**
131 * Support for WPForms
132 */
133 new WPSmush();
134
135 /**
136 * Support for WPForms
137 */
138 new CompatibilityWooExtraProductOptions();
139
140 /**
141 * Support for WPBakery Page Builder
142 */
143 new WPBakeryPageBuilder();
144
145 /**
146 * Support for WPForms
147 */
148 new WPForms();
149
150 }
151
152 /**
153 * Register compatibility modules so that we can ues them in settings page.
154 * Called from ICompatibility::init() method.
155 */
156 public static function register_module( $args ) {
157 if( empty( $args[ 'id' ] ) ) {
158 return;
159 }
160 if( is_bool( $args[ 'enabled' ] ) ) {
161 $args[ 'enabled' ] = $args[ 'enabled' ] ? 'true' : 'false';
162 }
163 self::$modules[ $args[ 'id' ] ] = wp_parse_args( $args, array( 'id' => '', 'self' => '', 'title' => '', 'enabled' => false, 'description' => '', 'is_constant' => false, 'is_network' => false, 'is_plugin_active' => false, ) );
164 }
165
166 /**
167 * Return all the registered modules.
168 * Used in admin_init in bootstrap class as localize_script.
169 */
170 public static function get_modules() {
171 return self::$modules;
172 }
173
174 /**
175 * Return all the registered modules.
176 * Used in admin_init in bootstrap class as localize_script.
177 */
178 public static function get_module( $id ) {
179 if( !empty( self::$modules[ $id ] ) ) {
180 return self::$modules[ $id ];
181 }
182 return false;
183 }
184
185 /**
186 * Handles saving module data.
187 * Enable or disable modules from Compatibility tab.
188 */
189 public function save_modules() {
190 if( isset( $_POST[ 'action' ] ) && $_POST[ 'action' ] == 'stateless_modules' && wp_verify_nonce( $_POST[ '_smnonce' ], 'wp-stateless-modules' ) ) {
191 $modules = !empty( $_POST[ 'stateless-modules' ] ) ? $_POST[ 'stateless-modules' ] : array();
192 $modules = array_map( 'sanitize_text_field', $modules);
193 $modules = apply_filters( 'stateless::modules::save', $modules );
194
195 if( is_network_admin() ) {
196 update_site_option( 'stateless-modules', $modules );
197 } else {
198 update_option( 'stateless-modules', $modules, true );
199 }
200 wp_redirect( $_POST[ '_wp_http_referer' ] );
201 }
202 }
203 }
204
205 }