Handles the export admin action.
Description
See also
Source
File: src/components/submission-export-handler.php
public function handle_export_action() { if ( ! isset( $_REQUEST['_wpnonce'] ) ) { wp_die( __( 'Missing nonce.', 'torro-forms' ) ); } if ( ! wp_verify_nonce( $_REQUEST['_wpnonce'], $this->nonce_action ) ) { wp_die( __( 'Invalid nonce.', 'torro-forms' ) ); } if ( ! isset( $_REQUEST['form_id'] ) ) { wp_die( __( 'Missing form ID.', 'torro-forms' ) ); } $capabilities = $this->submission_manager->capabilities(); if ( ! $capabilities || ! $capabilities->user_can_read() ) { wp_die( __( 'Insufficient permissions.', 'torro-forms' ) ); } $form = $this->submission_manager->get_parent_manager( 'forms' )->get( (int) $_REQUEST['form_id'] ); if ( ! $form ) { wp_die( __( 'Invalid form ID.', 'torro-forms' ) ); } if ( ! isset( $_REQUEST['mode'] ) ) { wp_die( __( 'Missing submission export handler.', 'torro-forms' ) ); } $args = array(); if ( isset( $_REQUEST['orderby'] ) && isset( $_REQUEST['order'] ) ) { $orderby = in_array( $_REQUEST['orderby'], array( 'id', 'timestamp' ), true ) ? $_REQUEST['orderby'] : 'id'; $order = in_array( $_REQUEST['order'], array( 'ASC', 'DESC' ), true ) ? $_REQUEST['order'] : 'ASC'; $args['orderby'] = array( $orderby => $order ); } else { $args['orderby'] = array( 'id' => 'ASC' ); } $this->export_submissions( wp_unslash( $_REQUEST['mode'] ), $form, $args ); }
Changelog
Version | Description |
---|---|
1.0.0 | Introduced. |