ply_filters( 'wpforms_pro_admin_entries_export_options_fields', $this->export_options_fields ); // Error strings. $this->errors = [ 'common' => esc_html__( 'There were problems while preparing your export file. Please recheck export settings and try again.', 'wpforms' ), 'security' => esc_html__( 'You don\'t have enough capabilities to complete this request.', 'wpforms' ), 'unknown_form_id' => esc_html__( 'Incorrect form ID has been specified.', 'wpforms' ), 'unknown_entry_id' => esc_html__( 'Incorrect entry ID has been specified.', 'wpforms' ), 'form_data' => esc_html__( 'Specified form seems to be broken.', 'wpforms' ), 'unknown_request' => esc_html__( 'Unknown request.', 'wpforms' ), 'file_not_readable' => esc_html__( 'Export file cannot be retrieved from a file system.', 'wpforms' ), 'file_empty' => esc_html__( 'Export file is empty.', 'wpforms' ), 'form_empty' => esc_html__( 'The form does not have any fields for export.', 'wpforms' ), 'file_system_not_configured' => esc_html__( 'File system is not configured.', 'wpforms' ), ]; // Strings to localize. $this->i18n = [ 'error_prefix' => $this->errors['common'], 'error_form_empty' => $this->errors['form_empty'], 'label_select_all' => esc_html__( 'Select All', 'wpforms' ), 'prc_1_filtering' => esc_html__( 'Generating a list of entries according to your filters.', 'wpforms' ), 'prc_1_please_wait' => esc_html__( 'This can take a while. Please wait.', 'wpforms' ), 'prc_2_no_entries' => esc_html__( 'No entries found after applying your filters.', 'wpforms' ), 'prc_3_done' => esc_html__( 'The file was generated successfully.', 'wpforms' ), 'prc_3_download' => esc_html__( 'If the download does not start automatically', 'wpforms' ), 'prc_3_click_here' => esc_html__( 'click here', 'wpforms' ), ]; // Keeping default configuration data. $default_configuration = $this->configuration; // Applying deprecated filters. if ( has_filter( 'wpforms_export_fields_allowed' ) ) { // We need this because otherwise files can't be downloaded due to 'filter deprecated' notice. // Notice will be shown only on the WPForms > Tools > Export page. if ( 'wpforms_tools_entries_export_download' === $this->data['get_args']['action'] || 'wpforms_tools_single_entry_export_download' === $this->data['get_args']['action'] ) { ini_set( 'display_errors', 0 ); // phpcs:ignore } require_once WPFORMS_PLUGIN_DIR . 'pro/includes/admin/entries/class-entries-export.php'; $old_export = new \WPForms_Entries_Export(); $all_fields = $old_export->all_fields(); $allowed_fields = $old_export->allowed_fields(); $disallowed_fields = array_diff( $all_fields, $allowed_fields ); $this->configuration['disallowed_fields'] = array_unique( array_merge( $this->configuration['disallowed_fields'], $disallowed_fields ) ); } if ( has_filter( 'wpforms_csv_export_separator' ) ) { if ( 'wpforms_tools_entries_export_download' === $this->data['get_args']['action'] || 'wpforms_tools_single_entry_export_download' === $this->data['get_args']['action'] ) { ini_set( 'display_errors', 0 ); // phpcs:ignore } $this->configuration['csv_export_separator'] = (string) apply_filters_deprecated( 'wpforms_csv_export_separator', [ $this->configuration['csv_export_separator'] ], '1.5.5 of the WPForms plugin', 'wpforms_pro_admin_entries_export_configuration' ); } // Apply filter to config parameters. $this->configuration = (array) apply_filters( 'wpforms_pro_admin_entries_export_configuration', $this->configuration ); $this->configuration['disallowed_fields'] = (array) $this->configuration['disallowed_fields']; $this->configuration = wp_parse_args( $this->configuration, $default_configuration ); } /** * Get localized data. * * @since 1.5.5 */ public function get_localized_data() { return [ 'nonce' => wp_create_nonce( 'wpforms-tools-entries-export-nonce' ), 'lang_code' => sanitize_key( wpforms_get_language_code() ), 'export_page' => esc_url( admin_url( 'admin.php?page=wpforms-tools&view=export' ) ), 'i18n' => $this->i18n, 'form_id' => ! empty( $this->data['form_data'] ) ? $this->data['get_args']['form_id'] : 0, 'dates' => $this->data['get_args']['dates'], ]; } /** * Init hooks. * * @since 1.8.5 */ private function hooks() { add_filter( 'wpforms_pro_admin_entries_export_form_data', [ $this, 'filter_form_data' ] ); add_filter( 'wpforms_admin_tools_views_export_get_sub_views', [ $this, 'register_entries_sub_view' ] ); } /** * Register the Pro entries export sub-view. * * Replaces the Lite Education placeholder with the real functionality. * * @since 1.10.1 * * @param array $views Array of export sub-views. * * @return array */ public function register_entries_sub_view( array $views ): array { $views['entries'] = new Page(); return $views; } /** * Init GET or POST args. * * @since 1.5.5 * * @param string $method GET|POST. */ public function init_args( $method = 'GET' ) { $args = []; $method = $method === 'GET' ? 'GET' : 'POST'; $req = $method === 'GET' ? $_GET : $_POST; // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing // Action. $args['action'] = ''; if ( ! empty( $req['action'] ) ) { $args['action'] = sanitize_text_field( wp_unslash( $req['action'] ) ); } // Nonce. $args['nonce'] = ''; if ( ! empty( $req['nonce'] ) ) { $args['nonce'] = sanitize_text_field( wp_unslash( $req['nonce'] ) ); } // Form ID. $args['form_id'] = 0; if ( ! empty( $req['form'] ) ) { $args['form_id'] = (int) $req['form']; } // Entry ID. $args['entry_id'] = 0; if ( ! empty( $req['entry_id'] ) ) { $args['entry_id'] = (int) $req['entry_id']; } // Fields. $args['fields'] = []; if ( ! empty( $req['fields'] ) ) { $args['fields'] = array_map( 'intval', wp_unslash( $req['fields'] ) ); } // Additional Information. $args['additional_info'] = []; if ( ! empty( $req['additional_info'] ) ) { $args['additional_info'] = array_map( 'sanitize_text_field', wp_unslash( $req['additional_info'] ) ); } // Export Options Information. $args['export_options'] = []; if ( ! empty( $req['export_options'] ) ) { $args['export_options'] = array_map( 'sanitize_text_field', wp_unslash( $req['export_options'] ) ); } // Date range. $args['dates'] = []; if ( ! empty( $req['date'] ) ) { $dates = explode( ' - ', sanitize_text_field( wp_unslash( $req['date'] ) ) ); switch ( count( $dates ) ) { case 1: $args['dates'] = sanitize_text_field( $req['date'] ); break; case 2: $args['dates'] = array_map( 'sanitize_text_field', $dates ); break; } } // Entry statuses. $args['status'] = []; if ( ! empty( $req['statuses'] ) ) { $args['status'] = array_map( static function ( $status ) { $status = sanitize_key( wp_unslash( $status ) ); return $status === 'published' ? '' : $status; // published is empty string in the database. }, $req['statuses'] ); } // Search. $args['search'] = [ 'field' => 'any', 'comparison' => 'contains', 'term' => '', ]; if ( isset( $req['search'] ) ) { if ( isset( $req['search']['field'] ) ) { $args['search']['field'] = sanitize_key( $req['search']['field'] ); } if ( ! empty( $req['search']['comparison'] ) ) { $args['search']['comparison'] = sanitize_key( $req['search']['comparison'] ); } if ( ! empty( $req['search']['term'] ) ) { $args['search']['term'] = sanitize_text_field( $req['search']['term'] ); } } // Request ID. $args['request_id'] = ''; if ( ! empty( $req['request_id'] ) ) { $args['request_id'] = sanitize_text_field( wp_unslash( $req['request_id'] ) ); } $this->data[ strtolower( $method ) . '_args' ] = $args; } /** * Init selected form data. * * @since 1.5.5 */ protected function init_form_data() { $form = wpforms()->obj( 'form' ); $data = $form ? $form->get( $this->data['get_args']['form_id'], [ 'content_only' => true, 'cap' => 'view_entries_form_single', ] ) : []; /** * Filter form data during export. * * @since 1.8.2 * * @param array $form_data Form data. */ $this->data['form_data'] = apply_filters( 'wpforms_pro_admin_entries_export_form_data', $data ); } /** * Filter form data. * * @since 1.8.5 * * @param array $form_data Form data. * * @return array */ public function filter_form_data( $form_data ) { $fields = isset( $form_data['fields'] ) ? $form_data['fields'] : []; if ( empty( $fields ) ) { return $form_data; } $disallowed_fields = $this->configuration['disallowed_fields']; $payment_fields = wpforms_get_payments_fields(); // Remove disallowed fields. $allowed_fields = array_filter( $fields, static function ( $field ) use ( $disallowed_fields ) { return ! in_array( $field['type'], $disallowed_fields, true ); } ); // Retrieve payment fields. $form_payment_fields = array_filter( $allowed_fields, static function ( $field ) use ( $payment_fields ) { return in_array( $field['type'], $payment_fields, true ); } ); // Remove payment fields. $allowed_fields = array_filter( $allowed_fields, static function ( $field ) use ( $payment_fields ) { return ! in_array( $field['type'], $payment_fields, true ); } ); $form_data['fields'] = $allowed_fields; $form_data['payment_fields'] = $form_payment_fields; return $form_data; } /** * Helper function to determine if it is entries export ajax request. * * @since 1.6.1 * * @return bool */ public function is_entries_export_ajax() { if ( ! wp_doing_ajax() ) { return false; } $ref = wp_get_raw_referer(); if ( ! $ref ) { return false; } $query = wp_parse_url( $ref, PHP_URL_QUERY ); wp_parse_str( $query, $query_vars ); if ( empty( $query_vars['page'] ) || $query_vars['page'] !== 'wpforms-tools' ) { return false; } // phpcs:disable WordPress.Security.NonceVerification.Recommended if ( empty( $_REQUEST['action'] ) || empty( $_REQUEST['nonce'] ) || ( empty( $_REQUEST['form'] ) && empty( $_REQUEST['request_id'] ) ) ) { return false; } if ( $_REQUEST['action'] !== 'wpforms_tools_entries_export_form_data' && $_REQUEST['action'] !== 'wpforms_tools_entries_export_step' ) { return false; } // phpcs:enable WordPress.Security.NonceVerification.Recommended return true; } } Web Development, online earning & freelancing Blog - Hassan Gul
Skip to content
hassangul website logo white
  • Blog
  • Services
    • Custom AI Application Development
    • B2B SaaS Dashboard Development
    • Headless CMS Architecture
  • Consulting
  • Contact
  • Tools
    • CSS Generators
    • SEO Auditor
    • Proposal Generator
    • SaaS Boilerplate
  • Toggle website search
Menu Close
  • Blog
  • Services
    • Custom AI Application Development
    • B2B SaaS Dashboard Development
    • Headless CMS Architecture
  • Consulting
  • Contact
  • Tools
    • CSS Generators
    • SEO Auditor
    • Proposal Generator
    • SaaS Boilerplate
  • Toggle website search

HASSAN GUL BLOG

Blog about web development, web design, website builder, AI builders, hosting reviews, freelancing, and online income
  1. Home>
  2. Blog
Migrating from WooCommerce to a Headless Stack: A Technical Roadmap

Migrating from WooCommerce to a Headless Stack: A Technical Roadmap

Next.js Commerce Architecture: How to Build Sub-Second Load Times for eCommerce

Next.js Commerce Architecture: How to Build Sub-Second Load Times for eCommerce

Headless Shopify vs. Standard Shopify: Is the Performance Boost Worth the Cost in 2026?

Headless Shopify vs. Standard Shopify: Is the Performance Boost Worth the Cost in 2026?

Elementor vs. Gutenberg: Which WordPress Editor Wins in 2026?

Elementor vs. Gutenberg: Which WordPress Editor Wins in 2026?

Domain vs. Hosting: The Ultimate Beginner’s Guide (2026)

Domain vs. Hosting: The Ultimate Beginner’s Guide (2026)

Why Enterprises Are Ditching OpenAI: Deploying Llama 3 Securely

Why Enterprises Are Ditching OpenAI: Deploying Llama 3 Securely

Why Off-the-Shelf AI Isn’t Enough: The Case for Custom RAG Pipelines

Why Off-the-Shelf AI Isn’t Enough: The Case for Custom RAG Pipelines

Will AI Replace Web Developers? The Brutal Truth for 2026

Will AI Replace Web Developers? The Brutal Truth for 2026

How Much Do Web Developers Actually Make in 2026? (Real Numbers)

How Much Do Web Developers Actually Make in 2026? (Real Numbers)

Headless WordPress vs. Webflow: Which Wins for Technical SEO?

Headless WordPress vs. Webflow: Which Wins for Technical SEO?

  • 1
  • 2
  • 3
  • 4
  • 5
  • Go to the next page
  • Blog
  • pricing
  • Training
  • Consulting
  • Tools
  • Contact
Copyright © Hassan Gul. All Rights Reserved 2023.
    About | Contact us | Privacy Policy