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 +88 -43 5.5.365.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.36
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,13 +35,15 @@
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 47 'id' => '6189',
43 48 'slug' => 'wp-data-access',
44 49 'type' => 'plugin',
@@ -47,22 +52,23 @@
47 52 'premium_suffix' => 'Premium',
48 53 'has_addons' => false,
49 54 'has_paid_plans' => true,
50 55 'trial' => array(
51 - 'days' => 14,
52 - 'is_require_payment' => false,
53 - ),
56 + 'days' => 14,
57 + 'is_require_payment' => false,
58 + ),
54 59 'menu' => array(
55 - 'slug' => 'wpda_navi',
56 - 'contact' => false,
57 - 'network' => true,
58 - ),
60 + 'slug' => 'wpda',
61 + 'contact' => false,
62 + 'network' => true,
63 + ),
59 64 'is_live' => true,
60 65 ) );
61 66 }
67 +
62 68 return $wpda_freemius;
63 69 }
64 -
70 +
65 71 // Init Freemius.
66 72 wpda_freemius();
67 73 // Signal that SDK was initiated.
68 74 do_action( 'wpda_freemius_loaded' );
@@ -72,19 +78,21 @@
72 78 * @param mixed $links Links.
73 79 * @param mixed $file File.
74 80 * @return mixed
75 81 */
76 - function wpda_row_meta( $links, $file ) {
82 + function wpda_row_meta( $links, $file )
83 + {
84 +
77 85 if ( strpos( $file, plugin_basename( __FILE__ ) ) !== false ) {
78 86 // Add settings link.
79 87 $settings_url = admin_url( 'options-general.php' ) . '?page=wpdataaccess';
80 88 $settings_link = "<a href='{$settings_url}'>Settings</a>";
81 89 array_push( $links, $settings_link );
82 - //phpcs:ignore - 8.1 proof
83 90 }
91 +
84 92 return $links;
85 93 }
86 -
94 +
87 95 add_filter(
88 96 'plugin_row_meta',
89 97 'wpda_row_meta',
90 98 10,
@@ -95,13 +103,14 @@
95 103 *
96 104 * @author Peter Schulz
97 105 * @since 1.0.0
98 106 */
99 - function activate_wp_data_access() {
107 + function activate_wp_data_access()
108 + {
100 109 require_once plugin_dir_path( __FILE__ ) . 'includes/class-wp-data-access-switch.php';
101 110 WP_Data_Access_Switch::activate();
102 111 }
103 -
112 +
104 113 register_activation_hook( __FILE__, 'activate_wp_data_access' );
105 114 /**
106 115 * Deactivate plugin
107 116 *
@@ -107,13 +116,14 @@
107 116 *
108 117 * @author Peter Schulz
109 118 * @since 1.0.0
110 119 */
111 - function deactivate_wp_data_access() {
120 + function deactivate_wp_data_access()
121 + {
112 122 require_once plugin_dir_path( __FILE__ ) . 'includes/class-wp-data-access-switch.php';
113 123 WP_Data_Access_Switch::deactivate();
114 124 }
115 -
125 +
116 126 register_deactivation_hook( __FILE__, 'deactivate_wp_data_access' );
117 127 /**
118 128 * Check if database needs to be updated
119 129 *
@@ -119,14 +129,15 @@
119 129 *
120 130 * @author Peter Schulz
121 131 * @since 1.5.2
122 132 */
123 - function wpda_update_db_check() {
133 + function wpda_update_db_check()
134 + {
124 135 if ( get_option( WPDataAccess\WPDA::OPTION_WPDA_VERSION[0] ) !== WPDataAccess\WPDA::OPTION_WPDA_VERSION[1] ) {
125 136 activate_wp_data_access();
126 137 }
127 138 }
128 -
139 +
129 140 add_action( 'plugins_loaded', 'wpda_update_db_check' );
130 141 /**
131 142 * Uninstall blog
132 143 *
@@ -139,11 +150,13 @@
139 150 *
140 151 * @author Peter Schulz
141 152 * @since 1.0.0
142 153 */
143 - function wpda_uninstall_blog() {
144 - global $wpdb;
154 + function wpda_uninstall_blog()
155 + {
156 + global $wpdb ;
145 157 $drop_tables = get_option( 'wpda_uninstall_tables' );
158 +
146 159 if ( 'on' === $drop_tables ) {
147 160 // Get all plugin table names (without WP prefix).
148 161 $plugin_tables = WPDataAccess\WPDA::get_wpda_tables();
149 162 foreach ( $plugin_tables as $plugin_table ) {
@@ -148,13 +161,13 @@
148 161 $plugin_tables = WPDataAccess\WPDA::get_wpda_tables();
149 162 foreach ( $plugin_tables as $plugin_table ) {
150 163 // Loop through plugin tables.
151 164 // Drop plugin table.
152 - $wpdb->query( $wpdb->prepare(
165 + $wpdb->query( $wpdb->prepare(
153 166 'DROP TABLE IF EXISTS `%1s`',
154 167 // phpcs:ignore WordPress.DB.PreparedSQLPlaceholders, WordPress.DB.DirectDatabaseQuery.SchemaChange
155 168 WPDataAccess\WPDA::remove_backticks( $plugin_table )
156 - ) );
169 + ) );
157 170 // db call ok; no-cache ok.
158 171 // Get plugin backup tables (if applicable).
159 172 $backup_tables = $wpdb->get_results( $wpdb->prepare( '
160 173 select table_name as table_name from information_schema.tables
@@ -159,22 +172,24 @@
159 172 $backup_tables = $wpdb->get_results( $wpdb->prepare( '
160 173 select table_name as table_name from information_schema.tables
161 174 where table_schema = %s
162 175 and table_name like %s
163 - ', array($wpdb->dbname, "{$plugin_table}_BACKUP_%") ), 'ARRAY_A' );
176 + ', array( $wpdb->dbname, "{$plugin_table}_BACKUP_%" ) ), 'ARRAY_A' );
164 177 // db call ok; no-cache ok.
165 178 foreach ( $backup_tables as $backup_table ) {
166 179 // Drop plugin backup table.
167 - $wpdb->query( $wpdb->prepare(
180 + $wpdb->query( $wpdb->prepare(
168 181 'DROP TABLE IF EXISTS `%1s`',
169 182 // phpcs:ignore WordPress.DB.PreparedSQLPlaceholders, WordPress.DB.DirectDatabaseQuery.SchemaChange
170 183 WPDataAccess\WPDA::remove_backticks( $backup_table['table_name'] )
171 - ) );
184 + ) );
172 185 // db call ok; no-cache ok.
173 186 }
174 187 }
175 188 }
189 +
176 190 $delete_options = get_option( 'wpda_uninstall_options' );
191 +
177 192 if ( 'on' === $delete_options ) {
178 193 // Delete all options from wp_options.
179 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" );
180 195 // db call ok; no-cache ok.
@@ -180,19 +195,22 @@
180 195 // db call ok; no-cache ok.
181 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" );
182 197 // db call ok; no-cache ok.
183 198 }
199 +
184 200 }
185 -
201 +
186 202 /**
187 203 * Uninstall WP Data Access tables, options and meta keys
188 204 *
189 205 * @return void
190 206 */
191 - function wpda_uninstall() {
207 + function wpda_uninstall()
208 + {
209 +
192 210 if ( is_multisite() ) {
193 - global $wpdb;
194 - // Uninstall plugin for all blogs one by one (will fail silently for blogs having no plugin tables/options).
211 + global $wpdb ;
212 + // Uninstall plugin for alll blogs one by one (will fail silently for blogs having no plugin tables/options).
195 213 $blogids = $wpdb->get_col( "select blog_id from {$wpdb->blogs}" );
196 214 // db call ok; no-cache ok.
197 215 foreach ( $blogids as $blog_id ) {
198 216 // Uninstall blog.
@@ -203,11 +221,12 @@
203 221 } else {
204 222 // Uninstall on single site installation.
205 223 wpda_uninstall_blog();
206 224 }
225 +
207 226 WPDA::wpda_delete_content_folder();
208 227 }
209 -
228 +
210 229 wpda_freemius()->add_action( 'after_uninstall', 'wpda_uninstall' );
211 230 /**
212 231 * Add WP Data Access icon to freemius
213 232 *
@@ -212,23 +231,49 @@
212 231 * Add WP Data Access icon to freemius
213 232 *
214 233 * @return string
215 234 */
216 - function wpda_freemius_icon() {
217 - return dirname( __FILE__ ) . '/vendor/freemius/assets/img/wpda.png';
235 + function wpda_freemius_icon()
236 + {
237 + return dirname( __FILE__ ) . '/freemius/assets/img/wpda.png';
218 238 }
219 -
239 +
220 240 wpda_freemius()->add_filter( 'plugin_icon', 'wpda_freemius_icon' );
221 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 + /**
222 266 * Start plugin
223 267 *
224 268 * @author Peter Schulz
225 269 * @since 1.0.0
226 270 */
227 - function run_wp_data_access() {
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 -
277 +
233 278 run_wp_data_access();
234 -}
279 +}