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 | wp-data-access.php +158 -45 5.5.45.5.84 View file →
@@ -2,10 +2,10 @@
2 2
3 3 /**
4 4 * Plugin Name: WP Data Access
5 5 * Plugin URI: https://wpdataaccess.com/
6 - * Description: The best WordPress table plugin with an intuitive table builder and a highly customizable form builder to support data entry
7 - * Version: 5.5.4
6 + * Description: A powerful data-driven App Builder with an intuitive Table Builder, a highly customizable Form Builder and interactive Chart support in 35 languages
7 + * Version: 5.5.84
8 8 * Author: Passionate Programmers B.V.
9 9 * Author URI: https://wpdataaccess.com/
10 10 * Text Domain: wp-data-access
11 11 * License: GPL-2.0+
@@ -24,11 +24,9 @@
24 24 if ( !defined( 'ABSPATH' ) ) {
25 25 exit;
26 26 }
27 27 // Add freemius to WP Data Access.
28 -if ( function_exists( 'wpda_freemius' ) ) {
29 - wpda_freemius()->set_basename( false, __FILE__ );
30 -} else {
28 +if ( !function_exists( 'wpda_freemius' ) ) {
31 29 // Load WPDataAccess namespace.
32 30 require_once plugin_dir_path( __FILE__ ) . 'vendor/autoload.php';
33 31 /**
34 32 * Create a helper function for easy SDK access
@@ -37,29 +35,30 @@
37 35 */
38 36 function wpda_freemius() {
39 37 global $wpda_freemius;
40 38 if ( !isset( $wpda_freemius ) ) {
41 - // Include Freemius SDK.
42 - require_once dirname( __FILE__ ) . '/freemius/start.php';
39 + // Create a helper function for easy SDK access.
40 + require_once dirname( __FILE__ ) . '/vendor/freemius/start.php';
43 41 $wpda_freemius = fs_dynamic_init( array(
44 - 'id' => '6189',
45 - 'slug' => 'wp-data-access',
46 - 'type' => 'plugin',
47 - 'public_key' => 'pk_fc2d1714ca61c930152f6e326b575',
48 - 'is_premium' => false,
49 - 'premium_suffix' => 'Premium',
50 - 'has_addons' => false,
51 - 'has_paid_plans' => true,
52 - 'trial' => array(
42 + 'id' => '6189',
43 + 'slug' => 'wp-data-access',
44 + 'type' => 'plugin',
45 + 'public_key' => 'pk_fc2d1714ca61c930152f6e326b575',
46 + 'is_premium' => false,
47 + 'premium_suffix' => 'Premium',
48 + 'has_addons' => false,
49 + 'has_paid_plans' => true,
50 + 'trial' => array(
53 51 'days' => 14,
54 52 'is_require_payment' => false,
55 53 ),
56 - 'menu' => array(
57 - 'slug' => 'wpda',
54 + 'menu' => array(
55 + 'slug' => 'wpda_navi',
58 56 'contact' => false,
59 57 'network' => true,
60 58 ),
61 - 'is_live' => true,
59 + 'is_live' => true,
60 + 'is_org_compliant' => true,
62 61 ) );
63 62 }
64 63 return $wpda_freemius;
65 64 }
@@ -68,21 +67,67 @@
68 67 wpda_freemius();
69 68 // Signal that SDK was initiated.
70 69 do_action( 'wpda_freemius_loaded' );
71 70 /**
72 - * Change plugin settings info
73 - *
71 + * Check if legacy tools are currently used on this server.
72 + * @return bool
73 + */
74 + function wpda_has_legacy_tools_inuse() {
75 + $option_legacy_tools = WPDA::get_option( WPDA::OPTION_PLUGIN_LEGACY_TOOLS );
76 + $has_legacy_tools = false;
77 + if ( !empty( $option_legacy_tools ) && is_array( $option_legacy_tools ) ) {
78 + foreach ( $option_legacy_tools as $tool ) {
79 + if ( isset( $tool[0] ) && $tool[0] === true && isset( $tool[1] ) && $tool[1] > 0 ) {
80 + $has_legacy_tools = true;
81 + break;
82 + }
83 + }
84 + }
85 + return $has_legacy_tools;
86 + }
87 +
88 + /**
89 + * Hook into the plugin_row_meta filter.
74 90 * @param mixed $links Links.
75 91 * @param mixed $file File.
92 + * @param mixed $data Data.
76 93 * @return mixed
77 94 */
78 - function wpda_row_meta( $links, $file ) {
79 - if ( strpos( $file, plugin_basename( __FILE__ ) ) !== false ) {
95 + function wpda_row_meta( $links, $file, $data ) {
96 + if ( plugin_basename( __FILE__ ) == $file ) {
80 97 // Add settings link.
81 98 $settings_url = admin_url( 'options-general.php' ) . '?page=wpdataaccess';
82 - $settings_link = "<a href='{$settings_url}'>Settings</a>";
99 + $settings_link = '<a href="' . esc_url( $settings_url ) . '">Settings</a>';
83 100 array_push( $links, $settings_link );
84 - //phpcs:ignore - 8.1 proof
101 + // phpcs:ignore -- 8.1 proof
102 + // Add comment for legacy users only
103 + if ( wpda_has_legacy_tools_inuse() ) {
104 + if ( isset( $data['new_version'] ) ) {
105 + $new_version = $data['new_version'];
106 + if ( version_compare( $new_version, '6.0', '>=' ) ) {
107 + $notice = '
108 + <p style="margin-top: 10px; margin-bottom: 0; padding: 6px 10px; border-radius: 2px;"
109 + class="update-message notice inline notice-warning notice-alt"
110 + >
111 + <span class="dashicons dashicons-warning" style="color: #f0b849;"></span>
112 + <strong>Warning for legacy users:</strong> Version ' . esc_html( $new_version ) . ' (available now) removes legacy tools.
113 + <strong style="color: #cc1818;">Stay on Version 5.x</strong> to keep using them.
114 + <a href="https://docs.legacy.wpdataaccess.com/docs/deprecating/" target="_blank">Read more →</a>
115 + </p>';
116 + } else {
117 + $notice = '
118 + <p style="margin-top: 10px; margin-bottom: 0; padding: 6px 10px; border-radius: 2px;"
119 + class="update-message notice inline notice-info notice-alt"
120 + >
121 + <span class="dashicons dashicons-info" style="color: #3858e9;"></span>
122 + <strong>Info for legacy users:</strong> Version 6 is coming soon and removes legacy tools.
123 + <strong>Stay on Version 5.x</strong> to keep using them.
124 + <a href="https://docs.legacy.wpdataaccess.com/docs/deprecating/" target="_blank">Read more →</a>
125 + </p>';
126 + }
127 + $links[] = $notice;
128 + }
129 + }
85 130 }
86 131 return $links;
87 132 }
88 133
@@ -89,22 +134,75 @@
89 134 add_filter(
90 135 'plugin_row_meta',
91 136 'wpda_row_meta',
92 137 10,
93 - 2
138 + 3
94 139 );
95 140 /**
141 + * Remove last | character from plugin links.
142 + * @return void
143 + */
144 + function wpda_clean_plugin_row_script() {
145 + if ( !wpda_has_legacy_tools_inuse() ) {
146 + return;
147 + }
148 + ?>
149 + <script type="text/javascript">
150 + jQuery(document).ready(function($) {
151 + var $row = $('tr[data-slug="wp-data-access"] .plugin-version-author-uri');
152 + if ($row.length) {
153 + $row.contents().each(function(index) {
154 + if (this.nodeType === 3 && index === 6) {
155 + this.nodeValue = this.nodeValue.replace(/\|/g, '');
156 + }
157 + });
158 + }
159 + });
160 + </script>
161 + <?php
162 + }
163 +
164 + add_action( 'admin_footer-plugins.php', 'wpda_clean_plugin_row_script' );
165 + /**
166 + * Show legacy tools info widget.
167 + * @return void
168 + */
169 + function wpda_legacy_tools_notice_widget() {
170 + // Add widget for legacy users only
171 + if ( wpda_has_legacy_tools_inuse() ) {
172 + wp_add_dashboard_widget( 'wporg_dashboard_widget', 'WP Data Access - Info for legacy tools users', function () {
173 + ?>
174 + <p>
175 + Version 6 is coming soon and removes legacy tools.
176 + </p>
177 + <p>
178 + <strong>To keep using the legacy tools:</strong><br>
179 + ✓ Stay on the latest Version 5.x<br>
180 + ✓ Disable auto-updates<br>
181 + ✓ Do not update manually to Version 6
182 + </p>
183 + <p>
184 + <a href="https://docs.legacy.wpdataaccess.com/docs/deprecating/" target="_blank">Read more →</a>
185 + </p>
186 + <?php
187 + } );
188 + }
189 + }
190 +
191 + add_action( 'wp_dashboard_setup', 'wpda_legacy_tools_notice_widget' );
192 + /**
96 193 * Activate plugin
97 194 *
98 195 * @author Peter Schulz
99 196 * @since 1.0.0
100 197 */
101 - function activate_wp_data_access() {
198 + function wpda_activate() {
199 + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound
102 200 require_once plugin_dir_path( __FILE__ ) . 'includes/class-wp-data-access-switch.php';
103 201 WP_Data_Access_Switch::activate();
104 202 }
105 203
106 - register_activation_hook( __FILE__, 'activate_wp_data_access' );
204 + register_activation_hook( __FILE__, 'wpda_activate' );
107 205 /**
108 206 * Deactivate plugin
109 207 *
110 208 * @author Peter Schulz
@@ -109,14 +207,15 @@
109 207 *
110 208 * @author Peter Schulz
111 209 * @since 1.0.0
112 210 */
113 - function deactivate_wp_data_access() {
211 + function wpda_deactivate() {
212 + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound
114 213 require_once plugin_dir_path( __FILE__ ) . 'includes/class-wp-data-access-switch.php';
115 214 WP_Data_Access_Switch::deactivate();
116 215 }
117 216
118 - register_deactivation_hook( __FILE__, 'deactivate_wp_data_access' );
217 + register_deactivation_hook( __FILE__, 'wpda_deactivate' );
119 218 /**
120 219 * Check if database needs to be updated
121 220 *
122 221 * @author Peter Schulz
@@ -123,9 +222,9 @@
123 222 * @since 1.5.2
124 223 */
125 224 function wpda_update_db_check() {
126 225 if ( get_option( WPDataAccess\WPDA::OPTION_WPDA_VERSION[0] ) !== WPDataAccess\WPDA::OPTION_WPDA_VERSION[1] ) {
127 - activate_wp_data_access();
226 + wpda_activate();
128 227 }
129 228 }
130 229
131 230 add_action( 'plugins_loaded', 'wpda_update_db_check' );
@@ -134,8 +233,9 @@
134 233 *
135 234 * This functions is called when the plugin is uninstalled. The following actions are performed:
136 235 * + Drop plugin tables (unless settings indicate not to)
137 236 * + Delete plugin options from $wpdb->options (unless settings indicate not to)
237 + * + Unscheduled all WP Data Access events
138 238 *
139 239 * Actions are processed on the current blog and are repeated for every blog on a multisite installation. Must be
140 240 * called from the dashboard (WP_UNINSTALL_PLUGIN defined). User must have the proper privileges (activate_plugins).
141 241 *
@@ -144,8 +244,9 @@
144 244 */
145 245 function wpda_uninstall_blog() {
146 246 global $wpdb;
147 247 $drop_tables = get_option( 'wpda_uninstall_tables' );
248 + // phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQLPlaceholders, WordPress.DB.DirectDatabaseQuery.SchemaChange
148 249 if ( 'on' === $drop_tables ) {
149 250 // Get all plugin table names (without WP prefix).
150 251 $plugin_tables = WPDataAccess\WPDA::get_wpda_tables();
151 252 foreach ( $plugin_tables as $plugin_table ) {
@@ -150,13 +251,9 @@
150 251 $plugin_tables = WPDataAccess\WPDA::get_wpda_tables();
151 252 foreach ( $plugin_tables as $plugin_table ) {
152 253 // Loop through plugin tables.
153 254 // Drop plugin table.
154 - $wpdb->query( $wpdb->prepare(
155 - 'DROP TABLE IF EXISTS `%1s`',
156 - // phpcs:ignore WordPress.DB.PreparedSQLPlaceholders, WordPress.DB.DirectDatabaseQuery.SchemaChange
157 - WPDataAccess\WPDA::remove_backticks( $plugin_table )
158 - ) );
255 + $wpdb->query( $wpdb->prepare( 'DROP TABLE IF EXISTS `%1s`', WPDataAccess\WPDA::remove_backticks( $plugin_table ) ) );
159 256 // db call ok; no-cache ok.
160 257 // Get plugin backup tables (if applicable).
161 258 $backup_tables = $wpdb->get_results( $wpdb->prepare( '
162 259 select table_name as table_name from information_schema.tables
@@ -165,13 +262,9 @@
165 262 ', array($wpdb->dbname, "{$plugin_table}_BACKUP_%") ), 'ARRAY_A' );
166 263 // db call ok; no-cache ok.
167 264 foreach ( $backup_tables as $backup_table ) {
168 265 // Drop plugin backup table.
169 - $wpdb->query( $wpdb->prepare(
170 - 'DROP TABLE IF EXISTS `%1s`',
171 - // phpcs:ignore WordPress.DB.PreparedSQLPlaceholders, WordPress.DB.DirectDatabaseQuery.SchemaChange
172 - WPDataAccess\WPDA::remove_backticks( $backup_table['table_name'] )
173 - ) );
266 + $wpdb->query( $wpdb->prepare( 'DROP TABLE IF EXISTS `%1s`', WPDataAccess\WPDA::remove_backticks( $backup_table['table_name'] ) ) );
174 267 // db call ok; no-cache ok.
175 268 }
176 269 }
177 270 }
@@ -182,10 +275,24 @@
182 275 // db call ok; no-cache ok.
183 276 $wpdb->query( "\n\t\t\t\t\tDELETE FROM {$wpdb->usermeta}\n\t\t\t\t\tWHERE meta_key LIKE 'wpda%'\n\t\t\t\t\t OR meta_key LIKE '%wp-data-access%'\n\t\t\t\t" );
184 277 // db call ok; no-cache ok.
185 278 }
279 + // phpcs:enable WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQLPlaceholders, WordPress.DB.DirectDatabaseQuery.SchemaChange
186 280 }
187 281
282 + function wpda_unschedule_event( $hook ) {
283 + $crons = _get_cron_array();
284 + foreach ( $crons as $timestamp => $cron ) {
285 + if ( isset( $cron[$hook] ) ) {
286 + foreach ( $cron[$hook] as $event ) {
287 + if ( isset( $event['args'] ) ) {
288 + wp_unschedule_event( $timestamp, $hook, $event['args'] );
289 + }
290 + }
291 + }
292 + }
293 + }
294 +
188 295 /**
189 296 * Uninstall WP Data Access tables, options and meta keys
190 297 *
191 298 * @return void
@@ -193,10 +300,11 @@
193 300 function wpda_uninstall() {
194 301 if ( is_multisite() ) {
195 302 global $wpdb;
196 303 // Uninstall plugin for all blogs one by one (will fail silently for blogs having no plugin tables/options).
304 + // phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQLPlaceholders, WordPress.DB.DirectDatabaseQuery.SchemaChange
197 305 $blogids = $wpdb->get_col( "select blog_id from {$wpdb->blogs}" );
198 - // db call ok; no-cache ok.
306 + // phpcs:enable WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQLPlaceholders, WordPress.DB.DirectDatabaseQuery.SchemaChange
199 307 foreach ( $blogids as $blog_id ) {
200 308 // Uninstall blog.
201 309 switch_to_blog( $blog_id );
202 310 wpda_uninstall_blog();
@@ -206,8 +314,12 @@
206 314 // Uninstall on single site installation.
207 315 wpda_uninstall_blog();
208 316 }
209 317 WPDA::wpda_delete_content_folder();
318 + // Unscheduled all WP Data Access events
319 + wpda_unschedule_event( 'wpda_data_backup' );
320 + wpda_unschedule_event( \WPDataAccess\Query_Builder\WPDA_Query_Builder_Scheduler::SCHEDULER_HOOK_NAME );
321 + wpda_unschedule_event( \WPDataAccess\Utilities\WPDA_Export_Scheduler::SCHEDULER_HOOK_NAME );
210 322 }
211 323
212 324 wpda_freemius()->add_action( 'after_uninstall', 'wpda_uninstall' );
213 325 /**
@@ -215,9 +327,9 @@
215 327 *
216 328 * @return string
217 329 */
218 330 function wpda_freemius_icon() {
219 - return dirname( __FILE__ ) . '/freemius/assets/img/wpda.png';
331 + return dirname( __FILE__ ) . '/vendor/freemius/assets/img/wpda.png';
220 332 }
221 333
222 334 wpda_freemius()->add_filter( 'plugin_icon', 'wpda_freemius_icon' );
223 335 /**
@@ -225,12 +337,13 @@
225 337 *
226 338 * @author Peter Schulz
227 339 * @since 1.0.0
228 340 */
229 - function run_wp_data_access() {
341 + function wpda_run() {
342 + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound
230 343 require_once plugin_dir_path( __FILE__ ) . 'includes/class-wp-data-access.php';
231 344 $wpdataaccess = new WP_Data_Access();
232 345 $wpdataaccess->run();
233 346 }
234 347
235 - run_wp_data_access();
348 + wpda_run();
236 349 }