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

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