| @@ -3,9 +3,9 @@ | ||
| 3 | 3 | /** |
| 4 | 4 | * Plugin Name: WP Data Access |
| 5 | 5 | * Plugin URI: https://wpdataaccess.com/ |
| 6 | 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 | |
| 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+ |
| @@ -67,21 +67,67 @@ | ||
| 67 | 67 | wpda_freemius(); |
| 68 | 68 | // Signal that SDK was initiated. |
| 69 | 69 | do_action( 'wpda_freemius_loaded' ); |
| 70 | 70 | /** |
| 71 | - * Change plugin settings info | |
| 72 | - * | |
| 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. | |
| 73 | 90 | * @param mixed $links Links. |
| 74 | 91 | * @param mixed $file File. |
| 92 | + * @param mixed $data Data. | |
| 75 | 93 | * @return mixed |
| 76 | 94 | */ |
| 77 | - function wpda_row_meta( $links, $file ) { | |
| 78 | - if ( strpos( $file, plugin_basename( __FILE__ ) ) !== false ) { | |
| 95 | + function wpda_row_meta( $links, $file, $data ) { | |
| 96 | + if ( plugin_basename( __FILE__ ) == $file ) { | |
| 79 | 97 | // Add settings link. |
| 80 | 98 | $settings_url = admin_url( 'options-general.php' ) . '?page=wpdataaccess'; |
| 81 | - $settings_link = "<a href='{$settings_url}'>Settings</a>"; | |
| 99 | + $settings_link = '<a href="' . esc_url( $settings_url ) . '">Settings</a>'; | |
| 82 | 100 | array_push( $links, $settings_link ); |
| 83 | 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 | + } | |
| 84 | 130 | } |
| 85 | 131 | return $links; |
| 86 | 132 | } |
| 87 | 133 | |
| @@ -88,11 +134,63 @@ | ||
| 88 | 134 | add_filter( |
| 89 | 135 | 'plugin_row_meta', |
| 90 | 136 | 'wpda_row_meta', |
| 91 | 137 | 10, |
| 92 | - 2 | |
| 138 | + 3 | |
| 93 | 139 | ); |
| 94 | 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 | + /** | |
| 95 | 193 | * Activate plugin |
| 96 | 194 | * |
| 97 | 195 | * @author Peter Schulz |
| 98 | 196 | * @since 1.0.0 |
| @@ -180,8 +278,21 @@ | ||
| 180 | 278 | } |
| 181 | 279 | // phpcs:enable WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQLPlaceholders, WordPress.DB.DirectDatabaseQuery.SchemaChange |
| 182 | 280 | } |
| 183 | 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 | + | |
| 184 | 295 | /** |
| 185 | 296 | * Uninstall WP Data Access tables, options and meta keys |
| 186 | 297 | * |
| 187 | 298 | * @return void |
| @@ -203,8 +314,12 @@ | ||
| 203 | 314 | // Uninstall on single site installation. |
| 204 | 315 | wpda_uninstall_blog(); |
| 205 | 316 | } |
| 206 | 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 ); | |
| 207 | 322 | } |
| 208 | 323 | |
| 209 | 324 | wpda_freemius()->add_action( 'after_uninstall', 'wpda_uninstall' ); |
| 210 | 325 | /** |