wp_nonce_add = wp_create_nonce( WPDA_Widget::WIDGET_ADD . WPDA::get_current_user_login() ); $this->wp_nonce_save = wp_create_nonce( static::DASHBOARD_SAVE . WPDA::get_current_user_login() ); // Load Data Tables resources. \WPDataAccess\Data_Tables\WPDA_Data_Tables::enqueue_styles_and_script(); } $this->current_version = get_user_meta( WPDA::get_current_user_id(), 'wpda_data_explorer', true ); // Start with empty array. if ( $widget_mode ) { update_user_meta( WPDA::get_current_user_id(), self::USER_DASHBOARD, array() ); } $this->option_legacy_tools = WPDA::get_option( WPDA::OPTION_PLUGIN_LEGACY_TOOLS ); } /** * Add dashboard * * @param boolean $widget_mode True = user is allowed to manage dashboards. * * @return void */ public static function add_dashboard( $widget_mode = false ) { $dashboard = new WPDA_Dashboard($widget_mode); $dashboard->dashboard(); } /** * Construct plugin dashboard * * @return void */ public function dashboard() { wp_enqueue_style( 'wpdataaccess_dashboard' ); wp_enqueue_script( 'wpdataaccess_dashboard' ); if ( WPDA::current_user_is_admin() ) { $this->dashboard_default(); $this->dashboard_mobile(); } if ( isset( $_REQUEST['page'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification switch ( $_REQUEST['page'] ) { // phpcs:ignore WordPress.Security.NonceVerification case 'wpda_dashboard': $this->toolbar(); $this->add_forms(); $this->tabs(); $this->columns(); $this->add_panels(); $this->dashboard_js(); break; case WP_Data_Access_Admin::PAGE_MAIN: if ( !isset( $_REQUEST['page_action'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification if ( !isset( $_REQUEST['table_name'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification $this->toolbar_wpda(); } else { if ( !isset( $_REQUEST['action'] ) || 'new' !== $_REQUEST['action'] && 'edit' !== $_REQUEST['action'] ) { $this->toolbar_wpda_table(); } else { $this->toolbar_wpda_row(); } } } elseif ( 'wpda_backup' === $_REQUEST['page_action'] && (!isset( $_REQUEST['action'] ) || 'remove' === $_REQUEST['action'] || 'update' === $_REQUEST['action'] || 'add' === $_REQUEST['action']) ) { // phpcs:ignore WordPress.Security.NonceVerification $this->toolbar_backup(); } elseif ( 'wpda_import_csv' === $_REQUEST['page_action'] ) { // phpcs:ignore WordPress.Security.NonceVerification $this->toolbar_import_csv(); } break; case WP_Data_Access_Admin::PAGE_APPS: $this->toolbar_apps(); break; case WP_Data_Access_Admin::PAGE_QUERY_BUILDER: $this->toolbar_sql(); break; case WP_Data_Access_Admin::PAGE_DESIGNER: if ( !isset( $_REQUEST['action'] ) || 'new' !== $_REQUEST['action'] && 'edit' !== $_REQUEST['action'] ) { $this->toolbar_designer(); } break; case WP_Data_Access_Admin::PAGE_PUBLISHER: if ( (!isset( $_REQUEST['action'] ) || 'new' !== $_REQUEST['action'] && 'edit' !== $_REQUEST['action'] || isset( $_REQUEST['postaction'] ) && 'list' === $_REQUEST['postaction']) && !(isset( $_REQUEST['page_action'] ) && 'wpda_mngstl' === $_REQUEST['page_action']) ) { $this->toolbar_publisher(); } break; case WP_Data_Access_Admin::PAGE_CHARTS: $this->toolbar_charts(); break; case WPDP::PAGE_MAIN: if ( !isset( $_REQUEST['action'] ) || 'new' !== $_REQUEST['action'] && 'edit' !== $_REQUEST['action'] ) { $this->toolbar_projects(); } break; case WPDP::PAGE_TEMPLATES: if ( !isset( $_REQUEST['action'] ) || 'new' !== $_REQUEST['action'] && 'edit' !== $_REQUEST['action'] ) { $this->toolbar_templates(); } break; } } if ( isset( $_GET['page_iaction'] ) ) { // Perform interactive action to auto start user selected feature. ?> cannot_create_dashboard ) { return; } $remove_columns_message = __( 'Remove columns outside of range? Widgets will no longer be available!', 'wp-data-access' ); ?> is_free_plan() ) { ?>
The free version of WP Data Access has limited dashboard support. Data Widgets can be added and moved, but not saved or shared. Update to premium to analyse, report and share your data. UPGRADE TO PREMIUM READ MORE
dashboard_positions[0]); . $last_key = 1; if ( is_array( $this->dashboard_positions ) && count( $this->dashboard_positions ) > 0 ) { //phpcs:ignore - 8.1 proof foreach ( $this->dashboard_positions[0] as $key => $val ) { $last_key = $key; } } $this->number_of_columns = $last_key; for ($i = 1; $i <= $this->number_of_columns; $i++) { ?>
dbname ) { $database_text = "WordPress database ({$database})"; } else { $database_text = $database; } $database_options .= ''; } // Return available databases as option list. return $database_options; } /** * Add javascript functions * * @return void */ public function dashboard_js() { ?> $status, 'msg' => $msg, ); return json_encode( $error ); // phpcs:ignore } private function get_promotions( $tool ) { switch ( $tool ) { case 'publisher': case 'projects': case 'templates': case 'charts': $promotions = array(array( 'This tool will transition to the new App Builder. Please migrate on time.' => array(null, 'fa-lightbulb'), )); break; case 'csv': $promotions = array(array( 'Use the connection wizards for automated CSV synchronization.' => array('https://wpdataaccess.com/docs/remote-data-files/csv-files/', 'fa-lightbulb'), )); break; case 'publisher_OLD': $promotions = array( array( 'Change data table color, spacing, border radius and modal popup behaviour.' => array('https://wpdataaccess.com/data-tables-styling/premium-styling/', 'fa-palette'), ), array( 'Reorder data table elements with drag and drop.' => array('https://wpdataaccess.com/docs/data-tables/extension-manager/', 'fa-star'), ), array( 'Add buttons to support CSV, Excel, PDF and SQL downloads.' => array('https://wpdataaccess.com/docs/data-tables/extension-manager/', 'fa-cloud-download'), ), array( 'Add user friendly Search Panes to simplify searching.' => array('https://wpdataaccess.com/docs/data-tables-interactive-filters/search-panes/', 'fa-magic'), ), array( 'Use the Search Builder to add interactive searching.' => array('https://wpdataaccess.com/docs/data-tables-interactive-filters/search-builder/', 'fa-search'), ), array( 'Synchronize your Google Sheets from the Data Explorer.' => array('https://wpdataaccess.com/docs/remote-data-files/public-url/#google-sheets', 'fa-database'), ) ); break; case 'wpda': $promotions = array( array( 'Access your SQL Server tables from the Data Explorer.' => array('https://wpdataaccess.com/docs/remote-database-connections/sql-server/', 'fa-database'), ), array( 'Access your PostgreSQL tables from the Data Explorer.' => array('https://wpdataaccess.com/docs/remote-database-connections/postgresql/', 'fa-database'), ), array( 'Access your Oracle tables from the Data Explorer.' => array('https://wpdataaccess.com/data-explorer/remote-connection-wizard/remote-database-connections/oracle/', 'fa-database'), ), array( 'Access your remote MariaDB | MySQL tables from the Data Explorer.' => array('https://wpdataaccess.com/docs/remote-database-connections/mariadb-mysql/', 'fa-database'), ), array( 'Access your CSV files directly from the Data Explorer.' => array('https://wpdataaccess.com/docs/remote-data-files/csv-files/', 'fa-lightbulb'), ), array( 'Access your MS Access tables from the Data Explorer.' => array('https://wpdataaccess.com/docs/remote-data-files/ms-access/', 'fa-database'), ), array( 'Synchronize your Google Sheets from the Data Explorer.' => array('https://wpdataaccess.com/docs/remote-data-files/public-url/#google-sheets', 'fa-database'), ) ); break; default: $promotions = array(); } if ( count( $promotions ) > 0 ) { //phpcs:ignore - 8.1 proof $promotion_index = random_int( 0, count( $promotions ) - 1 ); $promotion = $promotions[$promotion_index]; $promotion_text = key( $promotion ); $promotion_url = $promotion[$promotion_text][0]; $promotion_icon = $promotion[$promotion_text][1]; ?>
Read more...