PluginProbe
WP Data Access – App Builder for Tables, Forms, Charts, Maps & Dashboards / 5.5.84
WP Data Access – App Builder for Tables, Forms, Charts, Maps & Dashboards v5.5.84
5.5.84 5.5.83 5.5.82 5.5.81 5.5.80 5.5.79 5.5.77 5.5.76 5.5.75 5.5.73 5.5.72 5.5.22 5.5.23 5.5.29 5.5.3 5.5.31 5.5.32 5.5.34 5.5.35 5.5.36 5.5.37 5.5.4 5.5.40 5.5.41 5.5.42 All 160 releases
← All changes | includes/class-wp-data-access-switch.php +48 -2 5.5.45.5.84 View file →
@@ -13,8 +13,9 @@
13 13 use WPDataAccess\Plugin_Table_Models\WPDA_User_Menus_Model;
14 14 use WPDataAccess\Plugin_Table_Models\WPDP_Page_Model;
15 15 use WPDataAccess\Plugin_Table_Models\WPDP_Project_Model;
16 16 use WPDataAccess\Plugin_Table_Models\WPDP_Project_Design_Table_Model;
17 +use WPDataAccess\Premium\WPDAPRO_Dashboard\WPDAPRO_Dashboard;
17 18 use WPDataAccess\Utilities\WPDA_Repository;
18 19 use WPDataAccess\WPDA;
19 20 /**
20 21 * Class WP_Data_Access_Switch
@@ -28,8 +29,9 @@
28 29 *
29 30 * @see WP_Data_Access_Switch::activate()
30 31 * @see WP_Data_Access_Switch::deactivate()
31 32 */
33 +// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound
32 34 class WP_Data_Access_Switch {
33 35 /**
34 36 * Activate plugin WP Data Access
35 37 *
@@ -53,10 +55,11 @@
53 55 // Activate plugin.
54 56 if ( is_multisite() ) {
55 57 global $wpdb;
56 58 // Multisite installation.
59 + // phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
57 60 $blogids = $wpdb->get_col( "select blog_id from {$wpdb->blogs}" );
58 - // db call ok; no-cache ok.
61 + // phpcs:enable WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
59 62 foreach ( $blogids as $blog_id ) {
60 63 // Activate blog.
61 64 switch_to_blog( $blog_id );
62 65 self::activate_blog();
@@ -102,8 +105,9 @@
102 105 if ( wpda_freemius()->is_free_plan() ) {
103 106 update_option( 'wpda_fulltext_support', 'off' );
104 107 }
105 108 self::flush_rewrite_rules();
109 + self::set_legacy_tools();
106 110 }
107 111 }
108 112
109 113 /**
@@ -138,10 +142,11 @@
138 142 // Deactivate plugin.
139 143 if ( is_multisite() ) {
140 144 global $wpdb;
141 145 // Multisite installation.
146 + // phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
142 147 $blogids = $wpdb->get_col( "select blog_id from {$wpdb->blogs}" );
143 - // db call ok; no-cache ok.
148 + // phpcs:enable WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
144 149 foreach ( $blogids as $blog_id ) {
145 150 // Deactivate blog.
146 151 switch_to_blog( $blog_id );
147 152 self::flush_rewrite_rules();
@@ -156,5 +161,46 @@
156 161
157 162 private static function flush_rewrite_rules() {
158 163 }
159 164
165 + private static function set_legacy_tools() {
166 + // Get current legacy tool settings
167 + $stored_legacy_tools = get_option( 'wpda_plugin_legacy_tools' );
168 + if ( false === $stored_legacy_tools ) {
169 + // Use default for fresh installation
170 + // Update if legacy tool is actively used
171 + $option_legacy_tools = \WPDataAccess\Utilities\WPDA_Legacy_Tool_Visibility::get();
172 + $option_updated = false;
173 + if ( 0 < $option_legacy_tools['tables'][1] ) {
174 + $option_legacy_tools['tables'] = array(true, $option_legacy_tools['tables'][1]);
175 + $option_updated = true;
176 + }
177 + if ( 0 < $option_legacy_tools['forms'][1] ) {
178 + $option_legacy_tools['forms'] = array(true, $option_legacy_tools['forms'][1]);
179 + $option_updated = true;
180 + }
181 + if ( 0 < $option_legacy_tools['templates'][1] ) {
182 + $option_legacy_tools['templates'] = array(true, $option_legacy_tools['templates'][1]);
183 + $option_updated = true;
184 + }
185 + if ( 0 < $option_legacy_tools['designer'][1] ) {
186 + $option_legacy_tools['designer'] = array(true, $option_legacy_tools['designer'][1]);
187 + $option_updated = true;
188 + }
189 + if ( 0 < $option_legacy_tools['dashboards'][1] ) {
190 + $option_legacy_tools['dashboards'] = array(true, $option_legacy_tools['dashboards'][1]);
191 + $option_updated = true;
192 + }
193 + if ( 0 < $option_legacy_tools['charts'][1] ) {
194 + $option_legacy_tools['charts'] = array(true, $option_legacy_tools['charts'][1]);
195 + $option_updated = true;
196 + }
197 + if ( $option_updated ) {
198 + // Save legacy tool settings.
199 + WPDA::set_option( WPDA::OPTION_PLUGIN_LEGACY_TOOLS, $option_legacy_tools );
200 + }
201 + }
202 + }
203 +
160 204 }
205 +
206 +// phpcs:enable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound