refactor: try to redirect exportpods to export

This commit is contained in:
Glen Whitney 2021-02-08 13:34:46 -08:00
parent e5b5ecaae6
commit e530e6dbc4
2 changed files with 9 additions and 5 deletions

View File

@ -3,7 +3,7 @@
Plugin Name: TablePress Extension: Pods tables Plugin Name: TablePress Extension: Pods tables
Plugin URI: https://code.studioinfinity.org/glen/tablepress-pods Plugin URI: https://code.studioinfinity.org/glen/tablepress-pods
Description: Custom Extension for TablePress to incorporate Pods information in tables Description: Custom Extension for TablePress to incorporate Pods information in tables
Version: 0.2.10 Version: 0.2.11
Author: Glen Whitney Author: Glen Whitney
Author URI: http://studioinfinity.org/ Author URI: http://studioinfinity.org/
*/ */
@ -189,7 +189,7 @@ function playground_expand_pod( $table, $render_options) {
} }
function playground_handle_exportpods () { function playground_handle_exportpods () {
TablePress::check_nonce( 'export' ); TablePress::check_nonce( 'exportpods' );
if ( ! current_user_can( 'tablepress_export_tables' ) ) { if ( ! current_user_can( 'tablepress_export_tables' ) ) {
wp_die( __( 'Sorry, you are not allowed to access this page.', 'default' ), 403 ); wp_die( __( 'Sorry, you are not allowed to access this page.', 'default' ), 403 );
@ -201,6 +201,9 @@ function playground_handle_exportpods () {
$export = wp_unslash( $_POST['export'] ); $export = wp_unslash( $_POST['export'] );
} }
TablePress::redirect( array( 'action' => 'export', 'export' => $export ), true );
}
/*
$exporter = TablePress::load_class( 'TablePress_Export', 'class-export.php', 'classes' ); $exporter = TablePress::load_class( 'TablePress_Export', 'class-export.php', 'classes' );
if ( empty( $export['tables'] ) ) { if ( empty( $export['tables'] ) ) {
@ -325,3 +328,4 @@ function playground_handle_exportpods () {
echo $download_data; echo $download_data;
exit; exit;
} }
*/

View File

@ -162,9 +162,9 @@ class TablePress_ExportPods_View extends TablePress_View {
<select id="tables-export-pod-name" name="export[pod_name]"> <select id="tables-export-pod-name" name="export[pod_name]">
<?php <?php
foreach ( $data['pods'] as $pod) { foreach ( $data['pods'] as $pod) {
$pod_name = $pod['name]; $pod_name = $pod['name'];
$selected = selected( $pod_name, $data['pod_name'], false ); $selected = selected( $pod_name, $data['pod_name'], false );
echo "<option{$selected} value=\"{$pod_name}\"?{$pod_name}</option>"; echo "<option{$selected} value=\"{$pod_name}\">{$pod_name}</option>";
} }
?> ?>
</select> </select>