| @@ -9,11 +9,9 @@ | ||
| 9 | 9 | use WPDataAccess\Cookies\WPDA_Cookies; |
| 10 | 10 | use WPDataAccess\Data_Dictionary\WPDA_Dictionary_Lists; |
| 11 | 11 | use WPDataAccess\Data_Tables\WPDA_Data_Tables; |
| 12 | 12 | use WPDataAccess\Plugin_Table_Models\WPDA_Table_Settings_Model; |
| 13 | -use WPDataAccess\Utilities\WPDA_Table_Actions; | |
| 14 | 13 | use WPDataAccess\Utilities\WPDA_Export; |
| 15 | -use WPDataAccess\Utilities\WPDA_Favourites; | |
| 16 | 14 | use WPDataAccess\WPDA; |
| 17 | 15 | use WPDataProjects\Utilities\WPDP_Export_Project; |
| 18 | 16 | use WPDataAccess\Backup\WPDA_Data_Export; |
| 19 | 17 | use WPDataAccess\Plugin_Table_Models\WPDA_CSV_Uploads_Model; |
| @@ -20,9 +18,8 @@ | ||
| 20 | 18 | use WPDataRoles\WPDA_Roles; |
| 21 | 19 | use WPDataAccess\Utilities\WPDA_Autocomplete; |
| 22 | 20 | use WPDataAccess\Premium\WPDAPRO_Geo_Location\WPDAPRO_Geo_Location_WS; |
| 23 | 21 | use WPDataAccess\Premium\WPDAPRO_Geo_Location\WPDAPRO_Geo_Location; |
| 24 | -use WPDataAccess\Query_Builder\WPDA_Query_Builder; | |
| 25 | 22 | use WPDataAccess\Dashboard\WPDA_Dashboard; |
| 26 | 23 | use WPDataAccess\Dashboard\WPDA_Widget_Code; |
| 27 | 24 | use WPDataAccess\Dashboard\WPDA_Widget_Publication; |
| 28 | 25 | use WPDataAccess\Dashboard\WPDA_Widget_Dbms; |
| @@ -160,17 +157,8 @@ | ||
| 160 | 157 | $this->loader->add_action( 'in_admin_header', $plugin_admin, 'user_admin_notices' ); |
| 161 | 158 | $this->loader->add_action( 'admin_head', $plugin_admin, 'remove_icons' ); |
| 162 | 159 | // Add settings page. |
| 163 | 160 | $this->loader->add_action( 'admin_menu', $this, 'wpdataaccess_register_settings_page' ); |
| 164 | - // Query Builder. | |
| 165 | - $query_builder = new WPDA_Query_Builder(); | |
| 166 | - $this->loader->add_action( 'admin_action_wpda_query_builder_execute_sql', $query_builder, 'execute' ); | |
| 167 | - $this->loader->add_action( 'admin_action_wpda_query_builder_save_sql', $query_builder, 'save' ); | |
| 168 | - $this->loader->add_action( 'admin_action_wpda_query_builder_open_sql', $query_builder, 'open' ); | |
| 169 | - $this->loader->add_action( 'admin_action_wpda_query_builder_delete_sql', $query_builder, 'delete' ); | |
| 170 | - $this->loader->add_action( 'admin_action_wpda_query_builder_get_db_hints', $query_builder, 'get_db_hints' ); | |
| 171 | - $this->loader->add_action( 'admin_action_wpda_query_builder_set_db_hints', $query_builder, 'set_db_hints' ); | |
| 172 | - $this->loader->add_action( 'admin_action_wpda_query_builder_get_vqb', $query_builder, 'get_visual_query_ajax' ); | |
| 173 | 161 | // Run unattended scheduled export |
| 174 | 162 | $this->loader->add_action( \WPDataAccess\Utilities\WPDA_Export_Scheduler::SCHEDULER_HOOK_NAME, \WPDataAccess\Utilities\WPDA_Export_Scheduler::class, 'run_scheduled_export' ); |
| 175 | 163 | // Mail service. |
| 176 | 164 | $wpda_mail_server = \WPDataAccess\Utilities\WPDA_Mail::get_option(); |
| @@ -228,13 +216,8 @@ | ||
| 228 | 216 | $this->loader->add_action( 'wp_ajax_wpda_remove_new_dashboard_message', WPDA_Dashboard::class, 'remove_new_dashboard_message' ); |
| 229 | 217 | $this->loader->add_action( 'wp_ajax_wpda_widget_pub_add', WPDA_Widget_Publication::class, 'ajax_widget' ); |
| 230 | 218 | $this->loader->add_action( 'wp_ajax_wpda_widget_chart_add', WPDA_Widget_Google_Chart::class, 'ajax_widget' ); |
| 231 | 219 | $this->loader->add_action( 'wp_ajax_wpda_widget_chart_refresh', WPDA_Widget_Google_Chart::class, 'ajax_refresh' ); |
| 232 | - // Add/remove favourites. | |
| 233 | - // ??? | |
| 234 | - $plugin_favourites = new WPDA_Favourites(); | |
| 235 | - $this->loader->add_action( 'admin_action_wpda_add_favourite', $plugin_favourites, 'add' ); | |
| 236 | - $this->loader->add_action( 'admin_action_wpda_rem_favourite', $plugin_favourites, 'rem' ); | |
| 237 | 220 | $plugin_dictionary_list = new WPDA_Dictionary_Lists(); |
| 238 | 221 | // Get tables for a specific database. |
| 239 | 222 | $this->loader->add_action( 'admin_action_wpda_get_tables', $plugin_dictionary_list, 'get_tables_ajax' ); |
| 240 | 223 | // Get columns for a specific table. |
| @@ -379,8 +362,78 @@ | ||
| 379 | 362 | }, |
| 380 | 363 | 10, |
| 381 | 364 | 2 |
| 382 | 365 | ); |
| 366 | + // Add WP Data Access dashboard to freemius pages | |
| 367 | + add_action( 'admin_enqueue_scripts', function () { | |
| 368 | + if ( 'wpda_navi-account' === $this->page || 'wpda_navi-pricing' === $this->page || 'wpda_navi-affiliation' === $this->page ) { | |
| 369 | + wp_enqueue_script( 'jquery-ui-sortable' ); | |
| 370 | + wp_enqueue_script( 'jquery-ui-tooltip' ); | |
| 371 | + wp_enqueue_style( | |
| 372 | + 'wpdataaccess_dashboard', | |
| 373 | + plugins_url( '../assets/css/wpda_dashboard.css', __FILE__ ), | |
| 374 | + array(), | |
| 375 | + WPDA::get_option( WPDA::OPTION_WPDA_VERSION ) | |
| 376 | + ); | |
| 377 | + wp_enqueue_script( | |
| 378 | + 'wpdataaccess_dashboard', | |
| 379 | + plugins_url( '../assets/js/wpda_dashboard.js', __FILE__ ), | |
| 380 | + array(), | |
| 381 | + WPDA::get_option( WPDA::OPTION_WPDA_VERSION ), | |
| 382 | + false | |
| 383 | + ); | |
| 384 | + wp_localize_script( 'wpdataaccess_dashboard', 'wpda_dashboard_vars', array( | |
| 385 | + 'wpda_ajaxurl' => admin_url( 'admin-ajax.php' ), | |
| 386 | + ) ); | |
| 387 | + // SAVING SPACE - According to the plugin guidelines it is allowed to include external fonts: | |
| 388 | + // https://developer.wordpress.org/plugins/wordpress-org/detailed-plugin-guidelines/#8-plugins-may-not-send-executable-code-via-third-party-systems . | |
| 389 | + // Load fontawesome icons. | |
| 390 | + // phpcs:disable WordPress.WP.EnqueuedResourceParameters.MissingVersion | |
| 391 | + wp_enqueue_style( | |
| 392 | + 'wpda_fontawesome_icons', | |
| 393 | + WPDA::CDN_FONTAWESOME . 'all.min.css', | |
| 394 | + array(), | |
| 395 | + null, | |
| 396 | + false | |
| 397 | + ); | |
| 398 | + // phpcs:enable WordPress.WP.EnqueuedResourceParameters.MissingVersion | |
| 399 | + // Add dashboards to freemius pages | |
| 400 | + wp_enqueue_style( | |
| 401 | + 'wpda_add_dashboard_freemius', | |
| 402 | + plugins_url( '../assets/css/wpda_freemius.css', __FILE__ ), | |
| 403 | + array(), | |
| 404 | + WPDA::get_option( WPDA::OPTION_WPDA_VERSION ) | |
| 405 | + ); | |
| 406 | + wp_enqueue_script( | |
| 407 | + 'wpda_add_dashboard_freemius', | |
| 408 | + plugins_url( '../assets/js/wpda_freemius.js', __FILE__ ), | |
| 409 | + array(), | |
| 410 | + WPDA::get_option( WPDA::OPTION_WPDA_VERSION ), | |
| 411 | + false | |
| 412 | + ); | |
| 413 | + ob_start(); | |
| 414 | + WPDA_Dashboard::add_dashboard(); | |
| 415 | + $freemius_dashboard = ob_get_clean(); | |
| 416 | + $freemius_title = ''; | |
| 417 | + if ( 'wpda_navi-affiliation' === $this->page ) { | |
| 418 | + $freemius_title = '<h1 class="wp-heading-inline" style="padding-top: 10px">WP Data Access Affiliate Program</h1>'; | |
| 419 | + } else { | |
| 420 | + if ( 'wpda_navi-pricing' === $this->page ) { | |
| 421 | + $freemius_title = '<h1 class="wp-heading-inline" style="padding-top: 10px">WP Data Access Plans and Pricing</h1><h2>Choose your plan and upgrade in minutes!</h2>'; | |
| 422 | + } else { | |
| 423 | + if ( 'wpda_navi-account' === $this->page ) { | |
| 424 | + $freemius_title = '<h1 class="wp-heading-inline" style="padding-top: 10px">WP Data Access Account</h1>'; | |
| 425 | + } | |
| 426 | + } | |
| 427 | + } | |
| 428 | + wp_localize_script( 'wpda_add_dashboard_freemius', 'dashboard', array( | |
| 429 | + 'content' => $freemius_dashboard . $freemius_title, | |
| 430 | + ) ); | |
| 431 | + // Remove notices | |
| 432 | + remove_all_actions( 'admin_notices' ); | |
| 433 | + remove_all_actions( 'all_admin_notices' ); | |
| 434 | + } | |
| 435 | + }, 9 ); | |
| 383 | 436 | } |
| 384 | 437 | |
| 385 | 438 | /** |
| 386 | 439 | * Needed for JDT to support IE |