PluginProbe
WP Data Access – App Builder for Tables, Forms, Charts, Maps & Dashboards / 5.2
WP Data Access – App Builder for Tables, Forms, Charts, Maps & Dashboards v5.2
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 5.5.43 All 159 releases
← All changes | wp-data-access.php +110 -65 5.5.775.2 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: 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.77
6 + * Description: Local and remote data administration, publication and app development tool available directly from the WordPress dashboard.
7 + * Version: 5.2
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+
@@ -16,9 +16,9 @@
16 16 * @package plugin
17 17 * @author Peter Schulz
18 18 * @since 1.0.0
19 19 */
20 -use WPDataAccess\WPDA;
20 +use WPDataAccess\WPDA ;
21 21 if ( !defined( 'WPINC' ) ) {
22 22 die;
23 23 }
24 24 if ( !defined( 'ABSPATH' ) ) {
@@ -24,9 +24,12 @@
24 24 if ( !defined( 'ABSPATH' ) ) {
25 25 exit;
26 26 }
27 27 // Add freemius to WP Data Access.
28 -if ( !function_exists( 'wpda_freemius' ) ) {
28 +
29 +if ( function_exists( 'wpda_freemius' ) ) {
30 + wpda_freemius()->set_basename( false, __FILE__ );
31 +} else {
29 32 // Load WPDataAccess namespace.
30 33 require_once plugin_dir_path( __FILE__ ) . 'vendor/autoload.php';
31 34 /**
32 35 * Create a helper function for easy SDK access
@@ -32,38 +35,40 @@
32 35 * Create a helper function for easy SDK access
33 36 *
34 37 * @return Freemius
35 38 */
36 - function wpda_freemius() {
37 - global $wpda_freemius;
39 + function wpda_freemius()
40 + {
41 + global $wpda_freemius ;
42 +
38 43 if ( !isset( $wpda_freemius ) ) {
39 - // Create a helper function for easy SDK access.
40 - require_once dirname( __FILE__ ) . '/vendor/freemius/start.php';
44 + // Include Freemius SDK.
45 + require_once dirname( __FILE__ ) . '/freemius/start.php';
41 46 $wpda_freemius = fs_dynamic_init( 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(
51 - 'days' => 14,
52 - 'is_require_payment' => false,
53 - ),
54 - 'menu' => array(
55 - 'slug' => 'wpda_navi',
56 - 'contact' => false,
57 - 'network' => true,
58 - ),
59 - 'is_live' => true,
60 - 'is_org_compliant' => true,
47 + 'id' => '6189',
48 + 'slug' => 'wp-data-access',
49 + 'type' => 'plugin',
50 + 'public_key' => 'pk_fc2d1714ca61c930152f6e326b575',
51 + 'is_premium' => false,
52 + 'premium_suffix' => 'Premium',
53 + 'has_addons' => false,
54 + 'has_paid_plans' => true,
55 + 'trial' => array(
56 + 'days' => 14,
57 + 'is_require_payment' => false,
58 + ),
59 + 'menu' => array(
60 + 'slug' => 'wpda',
61 + 'contact' => false,
62 + 'network' => true,
63 + ),
64 + 'is_live' => true,
61 65 ) );
62 66 }
67 +
63 68 return $wpda_freemius;
64 69 }
65 -
70 +
66 71 // Init Freemius.
67 72 wpda_freemius();
68 73 // Signal that SDK was initiated.
69 74 do_action( 'wpda_freemius_loaded' );
@@ -73,19 +78,21 @@
73 78 * @param mixed $links Links.
74 79 * @param mixed $file File.
75 80 * @return mixed
76 81 */
77 - function wpda_row_meta( $links, $file ) {
82 + function wpda_row_meta( $links, $file )
83 + {
84 +
78 85 if ( strpos( $file, plugin_basename( __FILE__ ) ) !== false ) {
79 86 // Add settings link.
80 87 $settings_url = admin_url( 'options-general.php' ) . '?page=wpdataaccess';
81 88 $settings_link = "<a href='{$settings_url}'>Settings</a>";
82 89 array_push( $links, $settings_link );
83 - // phpcs:ignore -- 8.1 proof
84 90 }
91 +
85 92 return $links;
86 93 }
87 -
94 +
88 95 add_filter(
89 96 'plugin_row_meta',
90 97 'wpda_row_meta',
91 98 10,
@@ -96,15 +103,15 @@
96 103 *
97 104 * @author Peter Schulz
98 105 * @since 1.0.0
99 106 */
100 - function wpda_activate() {
101 - // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound
107 + function activate_wp_data_access()
108 + {
102 109 require_once plugin_dir_path( __FILE__ ) . 'includes/class-wp-data-access-switch.php';
103 110 WP_Data_Access_Switch::activate();
104 111 }
105 -
106 - register_activation_hook( __FILE__, 'wpda_activate' );
112 +
113 + register_activation_hook( __FILE__, 'activate_wp_data_access' );
107 114 /**
108 115 * Deactivate plugin
109 116 *
110 117 * @author Peter Schulz
@@ -109,15 +116,15 @@
109 116 *
110 117 * @author Peter Schulz
111 118 * @since 1.0.0
112 119 */
113 - function wpda_deactivate() {
114 - // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound
120 + function deactivate_wp_data_access()
121 + {
115 122 require_once plugin_dir_path( __FILE__ ) . 'includes/class-wp-data-access-switch.php';
116 123 WP_Data_Access_Switch::deactivate();
117 124 }
118 -
119 - register_deactivation_hook( __FILE__, 'wpda_deactivate' );
125 +
126 + register_deactivation_hook( __FILE__, 'deactivate_wp_data_access' );
120 127 /**
121 128 * Check if database needs to be updated
122 129 *
123 130 * @author Peter Schulz
@@ -122,14 +129,15 @@
122 129 *
123 130 * @author Peter Schulz
124 131 * @since 1.5.2
125 132 */
126 - function wpda_update_db_check() {
133 + function wpda_update_db_check()
134 + {
127 135 if ( get_option( WPDataAccess\WPDA::OPTION_WPDA_VERSION[0] ) !== WPDataAccess\WPDA::OPTION_WPDA_VERSION[1] ) {
128 - wpda_activate();
136 + activate_wp_data_access();
129 137 }
130 138 }
131 -
139 +
132 140 add_action( 'plugins_loaded', 'wpda_update_db_check' );
133 141 /**
134 142 * Uninstall blog
135 143 *
@@ -135,9 +143,8 @@
135 143 *
136 144 * This functions is called when the plugin is uninstalled. The following actions are performed:
137 145 * + Drop plugin tables (unless settings indicate not to)
138 146 * + Delete plugin options from $wpdb->options (unless settings indicate not to)
139 - * + Unscheduled all WP Data Access events
140 147 *
141 148 * Actions are processed on the current blog and are repeated for every blog on a multisite installation. Must be
142 149 * called from the dashboard (WP_UNINSTALL_PLUGIN defined). User must have the proper privileges (activate_plugins).
143 150 *
@@ -143,12 +150,13 @@
143 150 *
144 151 * @author Peter Schulz
145 152 * @since 1.0.0
146 153 */
147 - function wpda_uninstall_blog() {
148 - global $wpdb;
154 + function wpda_uninstall_blog()
155 + {
156 + global $wpdb ;
149 157 $drop_tables = get_option( 'wpda_uninstall_tables' );
150 - // phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQLPlaceholders, WordPress.DB.DirectDatabaseQuery.SchemaChange
158 +
151 159 if ( 'on' === $drop_tables ) {
152 160 // Get all plugin table names (without WP prefix).
153 161 $plugin_tables = WPDataAccess\WPDA::get_wpda_tables();
154 162 foreach ( $plugin_tables as $plugin_table ) {
@@ -153,9 +161,13 @@
153 161 $plugin_tables = WPDataAccess\WPDA::get_wpda_tables();
154 162 foreach ( $plugin_tables as $plugin_table ) {
155 163 // Loop through plugin tables.
156 164 // Drop plugin table.
157 - $wpdb->query( $wpdb->prepare( 'DROP TABLE IF EXISTS `%1s`', WPDataAccess\WPDA::remove_backticks( $plugin_table ) ) );
165 + $wpdb->query( $wpdb->prepare(
166 + 'DROP TABLE IF EXISTS `%1s`',
167 + // phpcs:ignore WordPress.DB.PreparedSQLPlaceholders, WordPress.DB.DirectDatabaseQuery.SchemaChange
168 + WPDataAccess\WPDA::remove_backticks( $plugin_table )
169 + ) );
158 170 // db call ok; no-cache ok.
159 171 // Get plugin backup tables (if applicable).
160 172 $backup_tables = $wpdb->get_results( $wpdb->prepare( '
161 173 select table_name as table_name from information_schema.tables
@@ -160,18 +172,24 @@
160 172 $backup_tables = $wpdb->get_results( $wpdb->prepare( '
161 173 select table_name as table_name from information_schema.tables
162 174 where table_schema = %s
163 175 and table_name like %s
164 - ', array($wpdb->dbname, "{$plugin_table}_BACKUP_%") ), 'ARRAY_A' );
176 + ', array( $wpdb->dbname, "{$plugin_table}_BACKUP_%" ) ), 'ARRAY_A' );
165 177 // db call ok; no-cache ok.
166 178 foreach ( $backup_tables as $backup_table ) {
167 179 // Drop plugin backup table.
168 - $wpdb->query( $wpdb->prepare( 'DROP TABLE IF EXISTS `%1s`', WPDataAccess\WPDA::remove_backticks( $backup_table['table_name'] ) ) );
180 + $wpdb->query( $wpdb->prepare(
181 + 'DROP TABLE IF EXISTS `%1s`',
182 + // phpcs:ignore WordPress.DB.PreparedSQLPlaceholders, WordPress.DB.DirectDatabaseQuery.SchemaChange
183 + WPDataAccess\WPDA::remove_backticks( $backup_table['table_name'] )
184 + ) );
169 185 // db call ok; no-cache ok.
170 186 }
171 187 }
172 188 }
189 +
173 190 $delete_options = get_option( 'wpda_uninstall_options' );
191 +
174 192 if ( 'on' === $delete_options ) {
175 193 // Delete all options from wp_options.
176 194 $wpdb->query( "\n\t\t\t\t\tDELETE FROM {$wpdb->options}\n\t\t\t\t\tWHERE option_name LIKE 'wpda%'\n\t\t\t\t" );
177 195 // db call ok; no-cache ok.
@@ -177,23 +195,24 @@
177 195 // db call ok; no-cache ok.
178 196 $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" );
179 197 // db call ok; no-cache ok.
180 198 }
181 - // phpcs:enable WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQLPlaceholders, WordPress.DB.DirectDatabaseQuery.SchemaChange
199 +
182 200 }
183 -
201 +
184 202 /**
185 203 * Uninstall WP Data Access tables, options and meta keys
186 204 *
187 205 * @return void
188 206 */
189 - function wpda_uninstall() {
207 + function wpda_uninstall()
208 + {
209 +
190 210 if ( is_multisite() ) {
191 - global $wpdb;
192 - // Uninstall plugin for all blogs one by one (will fail silently for blogs having no plugin tables/options).
193 - // phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQLPlaceholders, WordPress.DB.DirectDatabaseQuery.SchemaChange
211 + global $wpdb ;
212 + // Uninstall plugin for alll blogs one by one (will fail silently for blogs having no plugin tables/options).
194 213 $blogids = $wpdb->get_col( "select blog_id from {$wpdb->blogs}" );
195 - // phpcs:enable WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQLPlaceholders, WordPress.DB.DirectDatabaseQuery.SchemaChange
214 + // db call ok; no-cache ok.
196 215 foreach ( $blogids as $blog_id ) {
197 216 // Uninstall blog.
198 217 switch_to_blog( $blog_id );
199 218 wpda_uninstall_blog();
@@ -202,11 +221,12 @@
202 221 } else {
203 222 // Uninstall on single site installation.
204 223 wpda_uninstall_blog();
205 224 }
225 +
206 226 WPDA::wpda_delete_content_folder();
207 227 }
208 -
228 +
209 229 wpda_freemius()->add_action( 'after_uninstall', 'wpda_uninstall' );
210 230 /**
211 231 * Add WP Data Access icon to freemius
212 232 *
@@ -211,24 +231,49 @@
211 231 * Add WP Data Access icon to freemius
212 232 *
213 233 * @return string
214 234 */
215 - function wpda_freemius_icon() {
216 - return dirname( __FILE__ ) . '/vendor/freemius/assets/img/wpda.png';
235 + function wpda_freemius_icon()
236 + {
237 + return dirname( __FILE__ ) . '/freemius/assets/img/wpda.png';
217 238 }
218 -
239 +
219 240 wpda_freemius()->add_filter( 'plugin_icon', 'wpda_freemius_icon' );
220 241 /**
242 + * Handle freemius menu items
243 + *
244 + * @param boolean $is_visible Visibility.
245 + * @param string $submenu_id Sub menu ID.
246 + * @return false|mixed
247 + */
248 + function wpda_freemius_menu_visible( $is_visible, $submenu_id )
249 + {
250 + // Support, account, contact, pricing.
251 + if ( 'dashboard' === WPDA::get_option( WPDA::OPTION_PLUGIN_NAVIGATION ) ) {
252 + if ( 'support' === $submenu_id || 'account' === $submenu_id ) {
253 + $is_visible = false;
254 + }
255 + }
256 + return $is_visible;
257 + }
258 +
259 + wpda_freemius()->add_filter(
260 + 'is_submenu_visible',
261 + 'wpda_freemius_menu_visible',
262 + 10,
263 + 2
264 + );
265 + /**
221 266 * Start plugin
222 267 *
223 268 * @author Peter Schulz
224 269 * @since 1.0.0
225 270 */
226 - function wpda_run() {
227 - // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound
271 + function run_wp_data_access()
272 + {
228 273 require_once plugin_dir_path( __FILE__ ) . 'includes/class-wp-data-access.php';
229 274 $wpdataaccess = new WP_Data_Access();
230 275 $wpdataaccess->run();
231 276 }
232 -
233 - wpda_run();
234 -}
277 +
278 + run_wp_data_access();
279 +}