/home/vianto5/heredit.mx/wp-content/plugins/wpforms/src/Admin/Tools/Export/Views/Forms
Edit: /home/vianto5/heredit.mx/wp-content/plugins/wpforms/src/Admin/Tools/Export/Views/Forms/Page.php (4757B)
hooks();
}
/**
* Register hooks.
*
* @since 1.10.1
*/
private function hooks(): void {
add_action( 'wpforms_tools_init', [ $this, 'process' ] );
}
/**
* Get the Tab label.
*
* @since 1.10.1
*
* @return string
*/
public function get_tab_label(): string {
return __( 'Export Forms', 'wpforms-lite' );
}
/**
* Check if the current user has the capability to view the page.
*
* @since 1.10.1
*
* @return bool
*/
public function current_user_can(): bool {
return wpforms_current_user_can( 'edit_forms' );
}
/**
* Export process.
*
* @since 1.10.1
*/
public function process(): void {
// phpcs:disable WordPress.Security.NonceVerification
if (
empty( $_POST['action'] ) ||
$_POST['action'] !== 'export_form' ||
! isset( $_POST['submit-export'] ) ||
! $this->verify_nonce()
) {
return;
}
if ( empty( $_POST['forms'] ) ) {
return;
}
// phpcs:enable WordPress.Security.NonceVerification
$this->process_export();
}
/**
* Page content.
*
* @since 1.10.1
*/
public function display(): void {
$this->forms = Form::get_all();
if ( empty( $this->forms ) ) {
echo wpforms_render( 'admin/empty-states/no-forms' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
return;
}
?>
Tools::SLUG,
'view' => 'export',
'tab' => $this->slug,
],
admin_url( 'admin.php' )
);
}
/**
* Forms selector HTML.
*
* @since 1.10.1
*/
private function forms_select_html(): void {
?>
'wpforms',
'nopaging' => true,
'post__in' => isset( $_POST['forms'] ) ? array_map( 'intval', $_POST['forms'] ) : [], // phpcs:ignore WordPress.Security.NonceVerification
]
);
foreach ( $forms as $form ) {
$export[] = wpforms_decode( $form->post_content );
}
ignore_user_abort( true );
wpforms_set_time_limit();
nocache_headers();
header( 'Content-Type: application/json; charset=utf-8' );
header( 'Content-Disposition: attachment; filename=wpforms-form-export-' . current_time( 'm-d-Y' ) . '.json' );
header( 'Expires: 0' );
echo wp_json_encode( $export );
exit;
}
}