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 be transitioned to the new App Builder. Please migrate on time.' => array(null, 'fa-lightbulb'), )); 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...