From 81a1e48b914ddd76ee939a73e94d1eda85931bc0 Mon Sep 17 00:00:00 2001 From: Glen Whitney Date: Mon, 8 Feb 2021 09:36:52 -0800 Subject: [PATCH 01/18] feat: Try to modify the TablePress menu --- README.md | 5 ++++- mkplugin.sh | 6 +++++- tablepress-pods.php | 19 ++++++++++++++++--- 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index ad3706e..9d00389 100644 --- a/README.md +++ b/README.md @@ -38,4 +38,7 @@ Note that the {}-expressions allowed in the entries of the table definition incl ##### Building -To produce an installable zip file, change directories into a git clone of this repository, and simply execute the command in mkplugin.sh (for example, via `bash mkplugin.sh`). Note that currently you must update the version number in the mkplugin.sh command. \ No newline at end of file +To produce an installable zip file, assuming you have cloned this repository: +1. Make sure that you have committed your changes with an update to the Version parameter in tablepress-pods.php. +1. Make sure the current git head is on the commit you want to build. +1. From the top-level directory of the repository, execute `bash mkplugin.sh`. diff --git a/mkplugin.sh b/mkplugin.sh index a530d7f..ab4f6e7 100644 --- a/mkplugin.sh +++ b/mkplugin.sh @@ -1 +1,5 @@ -git archive HEAD --prefix=tablepress-pods/ --format=zip -o tablepress-pods-0.2.zip +verline=$(grep Version tablepress-pods.php) +cvline=${verline//[$'\t\r\n']} +destfile="tablepress-pods-${cvline#V*: }.zip" +echo "Writing $destfile..." +git archive HEAD --prefix=tablepress-pods/ --format=zip -o $destfile diff --git a/tablepress-pods.php b/tablepress-pods.php index a96541a..9dca0d4 100644 --- a/tablepress-pods.php +++ b/tablepress-pods.php @@ -3,7 +3,7 @@ Plugin Name: TablePress Extension: Pods tables Plugin URI: https://code.studioinfinity.org/glen/tablepress-pods Description: Custom Extension for TablePress to incorporate Pods information in tables -Version: 0.2 +Version: 0.2.3 Author: Glen Whitney Author URI: http ://studioinfinity.org/ */ @@ -58,12 +58,25 @@ Street, Fifth Floor, Boston, MA 02110-1301 , USA. add_filter( 'tablepress_shortcode_table_default_shortcode_atts', 'playground_add_shortcode_parameter_pods' ); add_filter( 'tablepress_table_raw_render_data', 'playground_expand_pod', 10, 2 ); +add_filter( 'tablepress_admin_view_actions', 'playground_add_export_pod_action') function playground_add_shortcode_parameter_pods( $default_atts ) { - $default_atts['pod_name'] = ''; + $default_atts['pod_name'] = ''; $default_atts['pod_dump'] = ''; $default_atts['pod_where'] = ''; - return $default_atts; + return $default_atts; +} + +function playground_add_export_pod_action( $view_actions ) { + $view_actions['exportpods'] = array( + 'show_entry' => true, + 'page_title' => __( 'Export Pods Table', 'tablepress' ), + 'admin_menu_title' => __( 'Export Pods Table', 'tablepress' ), + 'nav_tab_title' => _x( 'Export Pods', 'navigation bar', 'tablepress' ), + 'required_cap' => 'tablepress_export_tables', + ); + unset($view_actions['import']); + return $view_actions; } function playground_expand_pod( $table, $render_options) { -- 2.34.1 From 7e05603dd189e5dd90a1829759d9cc1b89855d15 Mon Sep 17 00:00:00 2001 From: Glen Whitney Date: Mon, 8 Feb 2021 09:41:41 -0800 Subject: [PATCH 02/18] fix: Maybe do not remove import --- tablepress-pods.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tablepress-pods.php b/tablepress-pods.php index 9dca0d4..93efd82 100644 --- a/tablepress-pods.php +++ b/tablepress-pods.php @@ -3,7 +3,7 @@ Plugin Name: TablePress Extension: Pods tables Plugin URI: https://code.studioinfinity.org/glen/tablepress-pods Description: Custom Extension for TablePress to incorporate Pods information in tables -Version: 0.2.3 +Version: 0.2.4 Author: Glen Whitney Author URI: http ://studioinfinity.org/ */ @@ -75,7 +75,7 @@ function playground_add_export_pod_action( $view_actions ) { 'nav_tab_title' => _x( 'Export Pods', 'navigation bar', 'tablepress' ), 'required_cap' => 'tablepress_export_tables', ); - unset($view_actions['import']); + /* unset($view_actions['import']); */ return $view_actions; } -- 2.34.1 From 0307f2897a0be129cce5a48d89e870058c48447e Mon Sep 17 00:00:00 2001 From: Glen Whitney Date: Mon, 8 Feb 2021 10:34:03 -0800 Subject: [PATCH 03/18] fix: add filter to redirect exportpods view here --- tablepress-pods.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tablepress-pods.php b/tablepress-pods.php index 93efd82..2300d17 100644 --- a/tablepress-pods.php +++ b/tablepress-pods.php @@ -3,7 +3,7 @@ Plugin Name: TablePress Extension: Pods tables Plugin URI: https://code.studioinfinity.org/glen/tablepress-pods Description: Custom Extension for TablePress to incorporate Pods information in tables -Version: 0.2.4 +Version: 0.2.5 Author: Glen Whitney Author URI: http ://studioinfinity.org/ */ @@ -58,7 +58,8 @@ Street, Fifth Floor, Boston, MA 02110-1301 , USA. add_filter( 'tablepress_shortcode_table_default_shortcode_atts', 'playground_add_shortcode_parameter_pods' ); add_filter( 'tablepress_table_raw_render_data', 'playground_expand_pod', 10, 2 ); -add_filter( 'tablepress_admin_view_actions', 'playground_add_export_pod_action') +add_filter( 'tablepress_admin_view_actions', 'playground_add_export_pod_action'); +add_filter( 'tablepress_load_file_full_path', 'playground_exportpods_path'); function playground_add_shortcode_parameter_pods( $default_atts ) { $default_atts['pod_name'] = ''; @@ -75,12 +76,16 @@ function playground_add_export_pod_action( $view_actions ) { 'nav_tab_title' => _x( 'Export Pods', 'navigation bar', 'tablepress' ), 'required_cap' => 'tablepress_export_tables', ); - /* unset($view_actions['import']); */ return $view_actions; } +function playground_exportpods_path( $fullpath, $filename, $directory ) { + if ($filename !== 'view-exportpods.php') return $fullpath; + return plugin_dir_path( __FILE__ ) . $filename; +} + function playground_expand_pod( $table, $render_options) { - if (empty($render_options['pod_name'])) return $table; + if (empty($render_options['pod_name'])) return $table; $pod_params = array('limit'=>-1); if (!empty($render_options['pod_where'])) { $pod_params['where'] = $render_options['pod_where']; -- 2.34.1 From 065b0df0ef2729eced6c9201be676d5431219008 Mon Sep 17 00:00:00 2001 From: Glen Whitney Date: Mon, 8 Feb 2021 10:51:28 -0800 Subject: [PATCH 04/18] feat: add an export pods view just like normal one for now --- tablepress-pods.php | 4 +- view-exportpods.php | 192 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 194 insertions(+), 2 deletions(-) create mode 100644 view-exportpods.php diff --git a/tablepress-pods.php b/tablepress-pods.php index 2300d17..e7f8aa3 100644 --- a/tablepress-pods.php +++ b/tablepress-pods.php @@ -3,7 +3,7 @@ Plugin Name: TablePress Extension: Pods tables Plugin URI: https://code.studioinfinity.org/glen/tablepress-pods Description: Custom Extension for TablePress to incorporate Pods information in tables -Version: 0.2.5 +Version: 0.2.6 Author: Glen Whitney Author URI: http ://studioinfinity.org/ */ @@ -59,7 +59,7 @@ add_filter( 'tablepress_shortcode_table_default_shortcode_atts', 'playground_add_shortcode_parameter_pods' ); add_filter( 'tablepress_table_raw_render_data', 'playground_expand_pod', 10, 2 ); add_filter( 'tablepress_admin_view_actions', 'playground_add_export_pod_action'); -add_filter( 'tablepress_load_file_full_path', 'playground_exportpods_path'); +add_filter( 'tablepress_load_file_full_path', 'playground_exportpods_path', 10, 3); function playground_add_shortcode_parameter_pods( $default_atts ) { $default_atts['pod_name'] = ''; diff --git a/view-exportpods.php b/view-exportpods.php new file mode 100644 index 0000000..76b899a --- /dev/null +++ b/view-exportpods.php @@ -0,0 +1,192 @@ +process_action_messages( array( + 'error_export' => __( 'Error: The export failed.', 'tablepress' ), + 'error_load_table' => __( 'Error: This table could not be loaded!', 'tablepress' ), + 'error_table_corrupted' => __( 'Error: The internal data of this table is corrupted!', 'tablepress' ), + 'error_create_zip_file' => __( 'Error: The ZIP file could not be created.', 'tablepress' ), + ) ); + + $this->add_text_box( 'head', array( $this, 'textbox_head' ), 'normal' ); + if ( 0 === $data['tables_count'] ) { + $this->add_meta_box( 'no-tables', __( 'Export Tables', 'tablepress' ), array( $this, 'postbox_no_tables' ), 'normal' ); + } else { + $this->admin_page->enqueue_script( 'export', array( 'jquery' ) ); + $this->add_meta_box( 'export-form', __( 'Export Pods Tables', 'tablepress' ), array( $this, 'postbox_export_form' ), 'normal' ); + $this->data['submit_button_caption'] = _x( 'Download Pods Export File', 'button', 'tablepress' ); + $this->add_text_box( 'submit', array( $this, 'textbox_submit_button' ), 'submit' ); + } + } + + /** + * Print the screen head text. + * + * @since 1.0.0 + * + * @param array $data Data for this screen. + * @param array $box Information about the text box. + */ + public function textbox_head( array $data, array $box ) { + ?> +

+ + +

+

+ + +
+ + +

+ 'add' ) ); + $import_url = TablePress::url( array( 'action' => 'import' ) ); + ?> +

+

add or import a table to get started!', 'tablepress' ), $add_url, $import_url ); ?>

+ + + + + + + + + + + + + + + + + + + + +
+ +
'; + } + ?> +
+ + + + ' . __( 'You can select multiple tables by holding down the “Ctrl” key (Windows) or the “Command” key (Mac).', 'tablepress' ) . ''; + } + ?> +
+ +
+ +
: + + + + +
+ Date: Mon, 8 Feb 2021 12:06:36 -0800 Subject: [PATCH 05/18] fix: add the data needed by the exportpods action --- tablepress-pods.php | 23 ++++++++++++++++++++++- view-exportpods.php | 4 ++-- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/tablepress-pods.php b/tablepress-pods.php index e7f8aa3..c7369d0 100644 --- a/tablepress-pods.php +++ b/tablepress-pods.php @@ -3,7 +3,7 @@ Plugin Name: TablePress Extension: Pods tables Plugin URI: https://code.studioinfinity.org/glen/tablepress-pods Description: Custom Extension for TablePress to incorporate Pods information in tables -Version: 0.2.6 +Version: 0.2.7 Author: Glen Whitney Author URI: http ://studioinfinity.org/ */ @@ -60,6 +60,7 @@ add_filter( 'tablepress_shortcode_table_default_shortcode_atts', add_filter( 'tablepress_table_raw_render_data', 'playground_expand_pod', 10, 2 ); add_filter( 'tablepress_admin_view_actions', 'playground_add_export_pod_action'); add_filter( 'tablepress_load_file_full_path', 'playground_exportpods_path', 10, 3); +add_filter( 'tablepress_view_data', 'playground_exportpods_data', 10, 2); function playground_add_shortcode_parameter_pods( $default_atts ) { $default_atts['pod_name'] = ''; @@ -84,6 +85,26 @@ function playground_exportpods_path( $fullpath, $filename, $directory ) { return plugin_dir_path( __FILE__ ) . $filename; } +function playground_exportpods_data( $data, $act ) { + if ($action !== 'exportpods') return $data; + // Load all table IDs without priming the post meta cache, as table options/visibility are not needed. + $data['table_ids'] = TablePress::$model_table->load_all( false ); + $data['tables_count'] = TablePress::$model_table->count_tables(); + if ( ! empty( $_GET['table_id'] ) ) { + $data['export_ids'] = explode( ',', $_GET['table_id'] ); + } else { + // Just show empty export form. + $data['export_ids'] = array(); + } + $exporter = TablePress::load_class( 'TablePress_Export', 'class-export.php', 'classes' ); + $data['zip_support_available'] = $exporter->zip_support_available; + $data['export_formats'] = $exporter->export_formats; + $data['csv_delimiters'] = $exporter->csv_delimiters; + $data['export_format'] = ( ! empty( $_GET['export_format'] ) ) ? $_GET['export_format'] : false; + $data['csv_delimiter'] = ( ! empty( $_GET['csv_delimiter'] ) ) ? $_GET['csv_delimiter'] : _x( ',', 'Default CSV delimiter in the translated language (";", ",", or "tab")', 'tablepress' ); + return $data; +} + function playground_expand_pod( $table, $render_options) { if (empty($render_options['pod_name'])) return $table; $pod_params = array('limit'=>-1); diff --git a/view-exportpods.php b/view-exportpods.php index 76b899a..0672b6e 100644 --- a/view-exportpods.php +++ b/view-exportpods.php @@ -60,11 +60,11 @@ class TablePress_ExportPods_View extends TablePress_View { public function textbox_head( array $data, array $box ) { ?>

- +

- +
-- 2.34.1 From 8ccabf59a11d9ac7c549b8ffd670ba16a8d63056 Mon Sep 17 00:00:00 2001 From: Glen Whitney Date: Mon, 8 Feb 2021 12:33:53 -0800 Subject: [PATCH 06/18] fix: add an exportpods handler --- tablepress-pods.php | 145 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 142 insertions(+), 3 deletions(-) diff --git a/tablepress-pods.php b/tablepress-pods.php index c7369d0..6eef9fc 100644 --- a/tablepress-pods.php +++ b/tablepress-pods.php @@ -3,9 +3,9 @@ Plugin Name: TablePress Extension: Pods tables Plugin URI: https://code.studioinfinity.org/glen/tablepress-pods Description: Custom Extension for TablePress to incorporate Pods information in tables -Version: 0.2.7 +Version: 0.2.8 Author: Glen Whitney -Author URI: http ://studioinfinity.org/ +Author URI: http://studioinfinity.org/ */ /* Copyright (C) 2018-2019 Glen Whitney @@ -61,6 +61,7 @@ add_filter( 'tablepress_table_raw_render_data', 'playground_expand_pod', 10, 2 ) add_filter( 'tablepress_admin_view_actions', 'playground_add_export_pod_action'); add_filter( 'tablepress_load_file_full_path', 'playground_exportpods_path', 10, 3); add_filter( 'tablepress_view_data', 'playground_exportpods_data', 10, 2); +add_action( 'admin_post_tablepress_exportpods', 'playground_handle_exportpods'); function playground_add_shortcode_parameter_pods( $default_atts ) { $default_atts['pod_name'] = ''; @@ -86,7 +87,7 @@ function playground_exportpods_path( $fullpath, $filename, $directory ) { } function playground_exportpods_data( $data, $act ) { - if ($action !== 'exportpods') return $data; + if ($act !== 'exportpods') return $data; // Load all table IDs without priming the post meta cache, as table options/visibility are not needed. $data['table_ids'] = TablePress::$model_table->load_all( false ); $data['tables_count'] = TablePress::$model_table->count_tables(); @@ -184,3 +185,141 @@ function playground_expand_pod( $table, $render_options) { $table['visibility']['columns'] = $cvis; return $table; } + +function playground_handle_exportpods () { + TablePress::check_nonce( 'export' ); + + if ( ! current_user_can( 'tablepress_export_tables' ) ) { + wp_die( __( 'Sorry, you are not allowed to access this page.', 'default' ), 403 ); + } + + if ( empty( $_POST['export'] ) || ! is_array( $_POST['export'] ) ) { + TablePress::redirect( array( 'action' => 'export', 'message' => 'error_export' ) ); + } else { + $export = wp_unslash( $_POST['export'] ); + } + + $exporter = TablePress::load_class( 'TablePress_Export', 'class-export.php', 'classes' ); + + if ( empty( $export['tables'] ) ) { + TablePress::redirect( array( 'action' => 'export', 'message' => 'error_export' ) ); + } + if ( empty( $export['format'] ) || ! isset( $exporter->export_formats[ $export['format'] ] ) ) { + TablePress::redirect( array( 'action' => 'export', 'message' => 'error_export' ) ); + } + if ( empty( $export['csv_delimiter'] ) ) { + // Set a value, so that the variable exists. + $export['csv_delimiter'] = ''; + } + if ( 'csv' === $export['format'] && ! isset( $exporter->csv_delimiters[ $export['csv_delimiter'] ] ) ) { + TablePress::redirect( array( 'action' => 'export', 'message' => 'error_export' ) ); + } + + // Use list of tables from concatenated field if available (as that's hopefully not truncated by Suhosin, which is possible for $export['tables']). + $tables = ( ! empty( $export['tables_list'] ) ) ? explode( ',', $export['tables_list'] ) : $export['tables']; + + // Determine if ZIP file support is available. + if ( $exporter->zip_support_available + && ( ( isset( $export['zip_file'] ) && 'true' === $export['zip_file'] ) || count( $tables ) > 1 ) ) { + // Export to ZIP only if ZIP is desired or if more than one table were selected (mandatory then). + $export_to_zip = true; + } else { + $export_to_zip = false; + } + + if ( ! $export_to_zip ) { + // This is only possible for one table, so take the first one. + if ( ! current_user_can( 'tablepress_export_table', $tables[0] ) ) { + wp_die( __( 'Sorry, you are not allowed to access this page.', 'default' ), 403 ); + } + // Load table, with table data, options, and visibility settings. + $table = TablePress::$model_table->load( $tables[0], true, true ); + if ( is_wp_error( $table ) ) { + TablePress::redirect( array( 'action' => 'export', 'message' => 'error_load_table', 'export_format' => $export['format'], 'csv_delimiter' => $export['csv_delimiter'] ) ); + } + if ( isset( $table['is_corrupted'] ) && $table['is_corrupted'] ) { + TablePress::redirect( array( 'action' => 'export', 'message' => 'error_table_corrupted', 'export_format' => $export['format'], 'csv_delimiter' => $export['csv_delimiter'] ) ); + } + $download_filename = sprintf( '%1$s-%2$s-%3$s.%4$s', $table['id'], $table['name'], date( 'Y-m-d' ), $export['format'] ); + $download_filename = sanitize_file_name( $download_filename ); + // Export the table. + $export_data = $exporter->export_table( $table, $export['format'], $export['csv_delimiter'] ); + /** + * Filter the exported table data. + * + * @since 1.6.0 + * + * @param string $export_data The exported table data. + * @param array $table Table to be exported. + * @param string $export_format Format for the export ('csv', 'html', 'json'). + * @param string $csv_delimiter Delimiter for CSV export. + */ + $export_data = apply_filters( 'tablepress_export_data', $export_data, $table, $export['format'], $export['csv_delimiter'] ); + $download_data = $export_data; + } else { + // Zipping can use a lot of memory and execution time, but not this much hopefully. + /** This filter is documented in the WordPress file wp-admin/admin.php */ + @ini_set( 'memory_limit', apply_filters( 'admin_memory_limit', WP_MAX_MEMORY_LIMIT ) ); + @set_time_limit( 300 ); + + $zip_file = new ZipArchive(); + $download_filename = sprintf( 'tablepress-export-%1$s-%2$s.zip', date_i18n( 'Y-m-d-H-i-s' ), $export['format'] ); + $download_filename = sanitize_file_name( $download_filename ); + $full_filename = wp_tempnam( $download_filename ); + if ( true !== $zip_file->open( $full_filename, ZIPARCHIVE::OVERWRITE ) ) { + @unlink( $full_filename ); + TablePress::redirect( array( 'action' => 'export', 'message' => 'error_create_zip_file', 'export_format' => $export['format'], 'csv_delimiter' => $export['csv_delimiter'] ) ); + } + + foreach ( $tables as $table_id ) { + // Don't export tables for which the user doesn't have the necessary export rights. + if ( ! current_user_can( 'tablepress_export_table', $table_id ) ) { + continue; + } + // Load table, with table data, options, and visibility settings. + $table = TablePress::$model_table->load( $table_id, true, true ); + // Don't export if the table could not be loaded. + if ( is_wp_error( $table ) ) { + continue; + } + // Don't export if the table is corrupted. + if ( isset( $table['is_corrupted'] ) && $table['is_corrupted'] ) { + continue; + } + $export_data = $exporter->export_table( $table, $export['format'], $export['csv_delimiter'] ); + /** This filter is documented in controllers/controller-admin.php */ + $export_data = apply_filters( 'tablepress_export_data', $export_data, $table, $export['format'], $export['csv_delimiter'] ); + $export_filename = sprintf( '%1$s-%2$s-%3$s.%4$s', $table['id'], $table['name'], date( 'Y-m-d' ), $export['format'] ); + $export_filename = sanitize_file_name( $export_filename ); + $zip_file->addFromString( $export_filename, $export_data ); + } + + // If something went wrong, or no files were added to the ZIP file, bail out. + if ( ! ZIPARCHIVE::ER_OK === $zip_file->status || 0 === $zip_file->numFiles ) { + $zip_file->close(); + @unlink( $full_filename ); + TablePress::redirect( array( 'action' => 'export', 'message' => 'error_create_zip_file', 'export_format' => $export['format'], 'csv_delimiter' => $export['csv_delimiter'] ) ); + } + $zip_file->close(); + + // Load contents of the ZIP file, to send it as a download. + $download_data = file_get_contents( $full_filename ); + @unlink( $full_filename ); + } + + // Send download headers for export file. + header( 'Content-Description: File Transfer' ); + header( 'Content-Type: application/octet-stream' ); + header( "Content-Disposition: attachment; filename=\"{$download_filename}\"" ); + header( 'Content-Transfer-Encoding: binary' ); + header( 'Expires: 0' ); + header( 'Cache-Control: must-revalidate' ); + header( 'Pragma: public' ); + header( 'Content-Length: ' . strlen( $download_data ) ); + // $filetype = text/csv, text/html, application/json + // header( 'Content-Type: ' . $filetype. '; charset=' . get_option( 'blog_charset' ) ); + @ob_end_clean(); + flush(); + echo $download_data; + exit; +} -- 2.34.1 From 8043cc773974c3fec8096caab2c317f22aefd3a8 Mon Sep 17 00:00:00 2001 From: Glen Whitney Date: Mon, 8 Feb 2021 13:07:30 -0800 Subject: [PATCH 07/18] feat: add a pod_name parameter --- tablepress-pods.php | 8 +++++--- view-exportpods.php | 37 +++++++++++-------------------------- 2 files changed, 16 insertions(+), 29 deletions(-) diff --git a/tablepress-pods.php b/tablepress-pods.php index 6eef9fc..6b3e5ca 100644 --- a/tablepress-pods.php +++ b/tablepress-pods.php @@ -3,7 +3,7 @@ Plugin Name: TablePress Extension: Pods tables Plugin URI: https://code.studioinfinity.org/glen/tablepress-pods Description: Custom Extension for TablePress to incorporate Pods information in tables -Version: 0.2.8 +Version: 0.2.9 Author: Glen Whitney Author URI: http://studioinfinity.org/ */ @@ -98,11 +98,13 @@ function playground_exportpods_data( $data, $act ) { $data['export_ids'] = array(); } $exporter = TablePress::load_class( 'TablePress_Export', 'class-export.php', 'classes' ); - $data['zip_support_available'] = $exporter->zip_support_available; + $data['zip_support_available'] = false; $data['export_formats'] = $exporter->export_formats; - $data['csv_delimiters'] = $exporter->csv_delimiters; $data['export_format'] = ( ! empty( $_GET['export_format'] ) ) ? $_GET['export_format'] : false; + $data['csv_delimiters'] = $exporter->csv_delimiters; $data['csv_delimiter'] = ( ! empty( $_GET['csv_delimiter'] ) ) ? $_GET['csv_delimiter'] : _x( ',', 'Default CSV delimiter in the translated language (";", ",", or "tab")', 'tablepress' ); + $data['pod_names'] = pods_api()->load_pods(); + $data['pod_name'] = ( ! empty( $_GET['pod_name'] ) ) ? $_GET['pod_name'] : false; return $data; } diff --git a/view-exportpods.php b/view-exportpods.php index 0672b6e..bd23164 100644 --- a/view-exportpods.php +++ b/view-exportpods.php @@ -35,7 +35,6 @@ class TablePress_ExportPods_View extends TablePress_View { 'error_export' => __( 'Error: The export failed.', 'tablepress' ), 'error_load_table' => __( 'Error: This table could not be loaded!', 'tablepress' ), 'error_table_corrupted' => __( 'Error: The internal data of this table is corrupted!', 'tablepress' ), - 'error_create_zip_file' => __( 'Error: The ZIP file could not be created.', 'tablepress' ), ) ); $this->add_text_box( 'head', array( $this, 'textbox_head' ), 'normal' ); @@ -64,8 +63,7 @@ class TablePress_ExportPods_View extends TablePress_View {

- - +
@@ -104,12 +102,7 @@ class TablePress_ExportPods_View extends TablePress_View { - -
'; - } - ?> + @@ -117,7 +110,6 @@ class TablePress_ExportPods_View extends TablePress_View { $select_size = $data['tables_count'] + 1; // to show at least one empty row in the select $select_size = max( $select_size, 3 ); $select_size = min( $select_size, 12 ); - $size_multiple = ( $data['zip_support_available'] ) ? " size=\"{$select_size}\" multiple=\"multiple\"" : ''; ?> - ' . __( 'You can select multiple tables by holding down the “Ctrl” key (Windows) or the “Command” key (Mac).', 'tablepress' ) . ''; - } - ?> @@ -170,18 +157,16 @@ class TablePress_ExportPods_View extends TablePress_View { - : + - - - - + -- 2.34.1 From e5b5ecaae646a900ead3011c73dbb2182b519e59 Mon Sep 17 00:00:00 2001 From: Glen Whitney Date: Mon, 8 Feb 2021 13:11:47 -0800 Subject: [PATCH 08/18] fix: extract name from the pods object --- tablepress-pods.php | 4 ++-- view-exportpods.php | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/tablepress-pods.php b/tablepress-pods.php index 6b3e5ca..b15bb6d 100644 --- a/tablepress-pods.php +++ b/tablepress-pods.php @@ -3,7 +3,7 @@ Plugin Name: TablePress Extension: Pods tables Plugin URI: https://code.studioinfinity.org/glen/tablepress-pods Description: Custom Extension for TablePress to incorporate Pods information in tables -Version: 0.2.9 +Version: 0.2.10 Author: Glen Whitney Author URI: http://studioinfinity.org/ */ @@ -103,7 +103,7 @@ function playground_exportpods_data( $data, $act ) { $data['export_format'] = ( ! empty( $_GET['export_format'] ) ) ? $_GET['export_format'] : false; $data['csv_delimiters'] = $exporter->csv_delimiters; $data['csv_delimiter'] = ( ! empty( $_GET['csv_delimiter'] ) ) ? $_GET['csv_delimiter'] : _x( ',', 'Default CSV delimiter in the translated language (";", ",", or "tab")', 'tablepress' ); - $data['pod_names'] = pods_api()->load_pods(); + $data['pods'] = pods_api()->load_pods(); $data['pod_name'] = ( ! empty( $_GET['pod_name'] ) ) ? $_GET['pod_name'] : false; return $data; } diff --git a/view-exportpods.php b/view-exportpods.php index bd23164..5765d2e 100644 --- a/view-exportpods.php +++ b/view-exportpods.php @@ -161,9 +161,10 @@ class TablePress_ExportPods_View extends TablePress_View { -- 2.34.1 From e530e6dbc417dd1c3bc0c3a7f73faa6d3cfd3b44 Mon Sep 17 00:00:00 2001 From: Glen Whitney Date: Mon, 8 Feb 2021 13:34:46 -0800 Subject: [PATCH 09/18] refactor: try to redirect exportpods to export --- tablepress-pods.php | 10 +++++++--- view-exportpods.php | 4 ++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/tablepress-pods.php b/tablepress-pods.php index b15bb6d..74828fc 100644 --- a/tablepress-pods.php +++ b/tablepress-pods.php @@ -3,7 +3,7 @@ Plugin Name: TablePress Extension: Pods tables Plugin URI: https://code.studioinfinity.org/glen/tablepress-pods Description: Custom Extension for TablePress to incorporate Pods information in tables -Version: 0.2.10 +Version: 0.2.11 Author: Glen Whitney Author URI: http://studioinfinity.org/ */ @@ -189,7 +189,7 @@ function playground_expand_pod( $table, $render_options) { } function playground_handle_exportpods () { - TablePress::check_nonce( 'export' ); + TablePress::check_nonce( 'exportpods' ); if ( ! current_user_can( 'tablepress_export_tables' ) ) { 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'] ); } + TablePress::redirect( array( 'action' => 'export', 'export' => $export ), true ); +} +/* $exporter = TablePress::load_class( 'TablePress_Export', 'class-export.php', 'classes' ); if ( empty( $export['tables'] ) ) { @@ -324,4 +327,5 @@ function playground_handle_exportpods () { flush(); echo $download_data; exit; -} + } +*/ diff --git a/view-exportpods.php b/view-exportpods.php index 5765d2e..19dd267 100644 --- a/view-exportpods.php +++ b/view-exportpods.php @@ -162,9 +162,9 @@ class TablePress_ExportPods_View extends TablePress_View { -- 2.34.1 From 83041cdf9b15d387b41d87836c9fc5f751ad546d Mon Sep 17 00:00:00 2001 From: Glen Whitney Date: Mon, 8 Feb 2021 13:54:50 -0800 Subject: [PATCH 10/18] fix: try to redirect to admin-post.php --- tablepress-pods.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tablepress-pods.php b/tablepress-pods.php index 74828fc..d4d2e19 100644 --- a/tablepress-pods.php +++ b/tablepress-pods.php @@ -3,7 +3,7 @@ Plugin Name: TablePress Extension: Pods tables Plugin URI: https://code.studioinfinity.org/glen/tablepress-pods Description: Custom Extension for TablePress to incorporate Pods information in tables -Version: 0.2.11 +Version: 0.2.12 Author: Glen Whitney Author URI: http://studioinfinity.org/ */ @@ -201,9 +201,10 @@ function playground_handle_exportpods () { $export = wp_unslash( $_POST['export'] ); } - TablePress::redirect( array( 'action' => 'export', 'export' => $export ), true ); + $real_export = TablePress::url( array( 'action' => 'export', 'export' = > $export ), true, 'admin-post.php' ); + wp_redirect( $real_export ); } -/* +__halt_compiler(); $exporter = TablePress::load_class( 'TablePress_Export', 'class-export.php', 'classes' ); if ( empty( $export['tables'] ) ) { -- 2.34.1 From f6ebd41f94392d7a7d7d726ef51b80c60c63faa9 Mon Sep 17 00:00:00 2001 From: Glen Whitney Date: Mon, 8 Feb 2021 14:14:13 -0800 Subject: [PATCH 11/18] fix: try another way of adding the nonce --- tablepress-pods.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tablepress-pods.php b/tablepress-pods.php index d4d2e19..af21978 100644 --- a/tablepress-pods.php +++ b/tablepress-pods.php @@ -3,7 +3,7 @@ Plugin Name: TablePress Extension: Pods tables Plugin URI: https://code.studioinfinity.org/glen/tablepress-pods Description: Custom Extension for TablePress to incorporate Pods information in tables -Version: 0.2.12 +Version: 0.2.13 Author: Glen Whitney Author URI: http://studioinfinity.org/ */ @@ -201,8 +201,9 @@ function playground_handle_exportpods () { $export = wp_unslash( $_POST['export'] ); } - $real_export = TablePress::url( array( 'action' => 'export', 'export' = > $export ), true, 'admin-post.php' ); - wp_redirect( $real_export ); + $real_export = TablePress::url( array( 'action' => 'export', 'export' => $export ), false, 'admin-post.php' ); + $nonced_export = add_query_arg( '_wpnonce', wp_create_nonce( TablePress::nonce('export') ), $real_export); + wp_redirect( $nonced_export ); } __halt_compiler(); $exporter = TablePress::load_class( 'TablePress_Export', 'class-export.php', 'classes' ); -- 2.34.1 From 9fd7ece4712c06fcc415ebad266ea1ca937215bc Mon Sep 17 00:00:00 2001 From: Glen Whitney Date: Mon, 8 Feb 2021 15:12:09 -0800 Subject: [PATCH 12/18] feat: Filter the export when produced from Export Pods Table --- tablepress-pods.php | 145 +++----------------------------------------- 1 file changed, 10 insertions(+), 135 deletions(-) diff --git a/tablepress-pods.php b/tablepress-pods.php index af21978..c4d7ae1 100644 --- a/tablepress-pods.php +++ b/tablepress-pods.php @@ -3,7 +3,7 @@ Plugin Name: TablePress Extension: Pods tables Plugin URI: https://code.studioinfinity.org/glen/tablepress-pods Description: Custom Extension for TablePress to incorporate Pods information in tables -Version: 0.2.13 +Version: 0.2.14 Author: Glen Whitney Author URI: http://studioinfinity.org/ */ @@ -194,140 +194,15 @@ function playground_handle_exportpods () { if ( ! current_user_can( 'tablepress_export_tables' ) ) { wp_die( __( 'Sorry, you are not allowed to access this page.', 'default' ), 403 ); } + /* Reset the nonce for forwarding the action */ + $_REQUEST['_wpnonce'] = wp_create_nonce( TablePress::nonce( 'export' ) ); - if ( empty( $_POST['export'] ) || ! is_array( $_POST['export'] ) ) { - TablePress::redirect( array( 'action' => 'export', 'message' => 'error_export' ) ); - } else { - $export = wp_unslash( $_POST['export'] ); - } - - $real_export = TablePress::url( array( 'action' => 'export', 'export' => $export ), false, 'admin-post.php' ); - $nonced_export = add_query_arg( '_wpnonce', wp_create_nonce( TablePress::nonce('export') ), $real_export); - wp_redirect( $nonced_export ); + /* Temporarily set a filter on exporting */ + add_filter( 'tablepress_export_data', 'playground_expand_export_pod', 10, 4); + do_action( 'admin_post_tablepress_export' ); + remove_filter( 'tablepress_export_data', 'playground_expand_export_pod', 10 ); } -__halt_compiler(); - $exporter = TablePress::load_class( 'TablePress_Export', 'class-export.php', 'classes' ); - if ( empty( $export['tables'] ) ) { - TablePress::redirect( array( 'action' => 'export', 'message' => 'error_export' ) ); - } - if ( empty( $export['format'] ) || ! isset( $exporter->export_formats[ $export['format'] ] ) ) { - TablePress::redirect( array( 'action' => 'export', 'message' => 'error_export' ) ); - } - if ( empty( $export['csv_delimiter'] ) ) { - // Set a value, so that the variable exists. - $export['csv_delimiter'] = ''; - } - if ( 'csv' === $export['format'] && ! isset( $exporter->csv_delimiters[ $export['csv_delimiter'] ] ) ) { - TablePress::redirect( array( 'action' => 'export', 'message' => 'error_export' ) ); - } - - // Use list of tables from concatenated field if available (as that's hopefully not truncated by Suhosin, which is possible for $export['tables']). - $tables = ( ! empty( $export['tables_list'] ) ) ? explode( ',', $export['tables_list'] ) : $export['tables']; - - // Determine if ZIP file support is available. - if ( $exporter->zip_support_available - && ( ( isset( $export['zip_file'] ) && 'true' === $export['zip_file'] ) || count( $tables ) > 1 ) ) { - // Export to ZIP only if ZIP is desired or if more than one table were selected (mandatory then). - $export_to_zip = true; - } else { - $export_to_zip = false; - } - - if ( ! $export_to_zip ) { - // This is only possible for one table, so take the first one. - if ( ! current_user_can( 'tablepress_export_table', $tables[0] ) ) { - wp_die( __( 'Sorry, you are not allowed to access this page.', 'default' ), 403 ); - } - // Load table, with table data, options, and visibility settings. - $table = TablePress::$model_table->load( $tables[0], true, true ); - if ( is_wp_error( $table ) ) { - TablePress::redirect( array( 'action' => 'export', 'message' => 'error_load_table', 'export_format' => $export['format'], 'csv_delimiter' => $export['csv_delimiter'] ) ); - } - if ( isset( $table['is_corrupted'] ) && $table['is_corrupted'] ) { - TablePress::redirect( array( 'action' => 'export', 'message' => 'error_table_corrupted', 'export_format' => $export['format'], 'csv_delimiter' => $export['csv_delimiter'] ) ); - } - $download_filename = sprintf( '%1$s-%2$s-%3$s.%4$s', $table['id'], $table['name'], date( 'Y-m-d' ), $export['format'] ); - $download_filename = sanitize_file_name( $download_filename ); - // Export the table. - $export_data = $exporter->export_table( $table, $export['format'], $export['csv_delimiter'] ); - /** - * Filter the exported table data. - * - * @since 1.6.0 - * - * @param string $export_data The exported table data. - * @param array $table Table to be exported. - * @param string $export_format Format for the export ('csv', 'html', 'json'). - * @param string $csv_delimiter Delimiter for CSV export. - */ - $export_data = apply_filters( 'tablepress_export_data', $export_data, $table, $export['format'], $export['csv_delimiter'] ); - $download_data = $export_data; - } else { - // Zipping can use a lot of memory and execution time, but not this much hopefully. - /** This filter is documented in the WordPress file wp-admin/admin.php */ - @ini_set( 'memory_limit', apply_filters( 'admin_memory_limit', WP_MAX_MEMORY_LIMIT ) ); - @set_time_limit( 300 ); - - $zip_file = new ZipArchive(); - $download_filename = sprintf( 'tablepress-export-%1$s-%2$s.zip', date_i18n( 'Y-m-d-H-i-s' ), $export['format'] ); - $download_filename = sanitize_file_name( $download_filename ); - $full_filename = wp_tempnam( $download_filename ); - if ( true !== $zip_file->open( $full_filename, ZIPARCHIVE::OVERWRITE ) ) { - @unlink( $full_filename ); - TablePress::redirect( array( 'action' => 'export', 'message' => 'error_create_zip_file', 'export_format' => $export['format'], 'csv_delimiter' => $export['csv_delimiter'] ) ); - } - - foreach ( $tables as $table_id ) { - // Don't export tables for which the user doesn't have the necessary export rights. - if ( ! current_user_can( 'tablepress_export_table', $table_id ) ) { - continue; - } - // Load table, with table data, options, and visibility settings. - $table = TablePress::$model_table->load( $table_id, true, true ); - // Don't export if the table could not be loaded. - if ( is_wp_error( $table ) ) { - continue; - } - // Don't export if the table is corrupted. - if ( isset( $table['is_corrupted'] ) && $table['is_corrupted'] ) { - continue; - } - $export_data = $exporter->export_table( $table, $export['format'], $export['csv_delimiter'] ); - /** This filter is documented in controllers/controller-admin.php */ - $export_data = apply_filters( 'tablepress_export_data', $export_data, $table, $export['format'], $export['csv_delimiter'] ); - $export_filename = sprintf( '%1$s-%2$s-%3$s.%4$s', $table['id'], $table['name'], date( 'Y-m-d' ), $export['format'] ); - $export_filename = sanitize_file_name( $export_filename ); - $zip_file->addFromString( $export_filename, $export_data ); - } - - // If something went wrong, or no files were added to the ZIP file, bail out. - if ( ! ZIPARCHIVE::ER_OK === $zip_file->status || 0 === $zip_file->numFiles ) { - $zip_file->close(); - @unlink( $full_filename ); - TablePress::redirect( array( 'action' => 'export', 'message' => 'error_create_zip_file', 'export_format' => $export['format'], 'csv_delimiter' => $export['csv_delimiter'] ) ); - } - $zip_file->close(); - - // Load contents of the ZIP file, to send it as a download. - $download_data = file_get_contents( $full_filename ); - @unlink( $full_filename ); - } - - // Send download headers for export file. - header( 'Content-Description: File Transfer' ); - header( 'Content-Type: application/octet-stream' ); - header( "Content-Disposition: attachment; filename=\"{$download_filename}\"" ); - header( 'Content-Transfer-Encoding: binary' ); - header( 'Expires: 0' ); - header( 'Cache-Control: must-revalidate' ); - header( 'Pragma: public' ); - header( 'Content-Length: ' . strlen( $download_data ) ); - // $filetype = text/csv, text/html, application/json - // header( 'Content-Type: ' . $filetype. '; charset=' . get_option( 'blog_charset' ) ); - @ob_end_clean(); - flush(); - echo $download_data; - exit; - } -*/ +function playground_expand_export_pod ( $data, $tab, $fmt, $delim ) { + return $data . "\nKilroy was here\n"; +} -- 2.34.1 From d1ace607bfda3c70be49bf2ed282e4d9dbe993f4 Mon Sep 17 00:00:00 2001 From: Glen Whitney Date: Mon, 8 Feb 2021 15:45:38 -0800 Subject: [PATCH 13/18] refactor: use internal function for filter to access local variables --- tablepress-pods.php | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/tablepress-pods.php b/tablepress-pods.php index c4d7ae1..d463016 100644 --- a/tablepress-pods.php +++ b/tablepress-pods.php @@ -3,7 +3,7 @@ Plugin Name: TablePress Extension: Pods tables Plugin URI: https://code.studioinfinity.org/glen/tablepress-pods Description: Custom Extension for TablePress to incorporate Pods information in tables -Version: 0.2.14 +Version: 0.2.15 Author: Glen Whitney Author URI: http://studioinfinity.org/ */ @@ -194,15 +194,23 @@ function playground_handle_exportpods () { if ( ! current_user_can( 'tablepress_export_tables' ) ) { wp_die( __( 'Sorry, you are not allowed to access this page.', 'default' ), 403 ); } + if ( empty( $_POST['export'] ) || ! is_array( $_POST['export'] ) ) { + TablePress::redirect( array( 'action' => 'export', 'message' => 'error_export' ) ); + } else { + $export = wp_unslash( $_POST['export'] ); + } + /* Reset the nonce for forwarding the action */ $_REQUEST['_wpnonce'] = wp_create_nonce( TablePress::nonce( 'export' ) ); - /* Temporarily set a filter on exporting */ - add_filter( 'tablepress_export_data', 'playground_expand_export_pod', 10, 4); - do_action( 'admin_post_tablepress_export' ); - remove_filter( 'tablepress_export_data', 'playground_expand_export_pod', 10 ); -} + /* Set up the filter using the pod params */ + $pod_name = $export['pod_name'] + $filter = function( $data, $tab, $fmt, $delim ) use ($pod_name) { + return $data . "\nExpanded by " . $pod_name; + } -function playground_expand_export_pod ( $data, $tab, $fmt, $delim ) { - return $data . "\nKilroy was here\n"; + /* Temporarily set a filter on exporting */ + add_filter( 'tablepress_export_data', $filter, 10, 4); + do_action( 'admin_post_tablepress_export' ); + remove_filter( 'tablepress_export_data', $filter, 10 ); } -- 2.34.1 From 0556eee2d5fb306e2c0f706bf71049f0f2f98eba Mon Sep 17 00:00:00 2001 From: Glen Whitney Date: Mon, 8 Feb 2021 16:08:24 -0800 Subject: [PATCH 14/18] feat: actually expand the table by the selected pod --- tablepress-pods.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tablepress-pods.php b/tablepress-pods.php index d463016..aa4c820 100644 --- a/tablepress-pods.php +++ b/tablepress-pods.php @@ -3,7 +3,7 @@ Plugin Name: TablePress Extension: Pods tables Plugin URI: https://code.studioinfinity.org/glen/tablepress-pods Description: Custom Extension for TablePress to incorporate Pods information in tables -Version: 0.2.15 +Version: 0.2.16 Author: Glen Whitney Author URI: http://studioinfinity.org/ */ @@ -204,10 +204,12 @@ function playground_handle_exportpods () { $_REQUEST['_wpnonce'] = wp_create_nonce( TablePress::nonce( 'export' ) ); /* Set up the filter using the pod params */ - $pod_name = $export['pod_name'] - $filter = function( $data, $tab, $fmt, $delim ) use ($pod_name) { - return $data . "\nExpanded by " . $pod_name; - } + $r_opts = array('pod_name' => $export['pod_name']); + $filter = function( $data, $tab, $fmt, $delim ) use ($r_opts) { + $newtab = playground_expand_pod($tab, $r_opts); + $exporter = TablePress::load_class( 'TablePress_Export', 'class-export.php', 'classes' ); + return $exporter->export_table( $newtab, $fmt, $delim ); + }; /* Temporarily set a filter on exporting */ add_filter( 'tablepress_export_data', $filter, 10, 4); -- 2.34.1 From 4a73e0551f603118363946dbdae05a3cf19b8527 Mon Sep 17 00:00:00 2001 From: Glen Whitney Date: Mon, 8 Feb 2021 16:30:57 -0800 Subject: [PATCH 15/18] feat: add pod_where and pod_dump options --- tablepress-pods.php | 9 +++++++-- view-exportpods.php | 14 ++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/tablepress-pods.php b/tablepress-pods.php index aa4c820..77f3190 100644 --- a/tablepress-pods.php +++ b/tablepress-pods.php @@ -3,7 +3,7 @@ Plugin Name: TablePress Extension: Pods tables Plugin URI: https://code.studioinfinity.org/glen/tablepress-pods Description: Custom Extension for TablePress to incorporate Pods information in tables -Version: 0.2.16 +Version: 0.2.17 Author: Glen Whitney Author URI: http://studioinfinity.org/ */ @@ -204,7 +204,12 @@ function playground_handle_exportpods () { $_REQUEST['_wpnonce'] = wp_create_nonce( TablePress::nonce( 'export' ) ); /* Set up the filter using the pod params */ - $r_opts = array('pod_name' => $export['pod_name']); + $r_opts = array('pod_name' => $export['pod_name'], + 'pod_where' => $export['pod_where'] + ); + if ( isset( $export['pod_dump'] ) ) { + $r_opts['pod_dump'] = true; + } $filter = function( $data, $tab, $fmt, $delim ) use ($r_opts) { $newtab = playground_expand_pod($tab, $r_opts); $exporter = TablePress::load_class( 'TablePress_Export', 'class-export.php', 'classes' ); diff --git a/view-exportpods.php b/view-exportpods.php index 19dd267..0282f19 100644 --- a/view-exportpods.php +++ b/view-exportpods.php @@ -170,6 +170,20 @@ class TablePress_ExportPods_View extends TablePress_View { + + + + + + + + + + + + + + Date: Mon, 8 Feb 2021 17:26:42 -0800 Subject: [PATCH 16/18] fix: convert post_date to string, show pod parameter descriptions --- tablepress-pods.php | 4 ++-- view-exportpods.php | 10 +++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/tablepress-pods.php b/tablepress-pods.php index 77f3190..e49f526 100644 --- a/tablepress-pods.php +++ b/tablepress-pods.php @@ -3,7 +3,7 @@ Plugin Name: TablePress Extension: Pods tables Plugin URI: https://code.studioinfinity.org/glen/tablepress-pods Description: Custom Extension for TablePress to incorporate Pods information in tables -Version: 0.2.17 +Version: 0.3.0 Author: Glen Whitney Author URI: http://studioinfinity.org/ */ @@ -170,7 +170,7 @@ function playground_expand_pod( $table, $render_options) { while ($pod->fetch()) { $nrow = array(); $nrow[] = $pod->field('id'); - $nrow[] = $pod->field('post_date'); + $nrow[] = $pod->display('post_date'); $nrow[] = $pod->field('title'); $nrow[] = get_the_author_meta('display_name', $pod->field('author')); $nrow[] = $pod->field('permalink'); diff --git a/view-exportpods.php b/view-exportpods.php index 0282f19..8004e2d 100644 --- a/view-exportpods.php +++ b/view-exportpods.php @@ -174,14 +174,18 @@ class TablePress_ExportPods_View extends TablePress_View { - + + + - + - + + + -- 2.34.1 From 53206a20dde7447d467d9c6e85d8ae5bfa08e96a Mon Sep 17 00:00:00 2001 From: Glen Whitney Date: Mon, 8 Feb 2021 17:32:26 -0800 Subject: [PATCH 17/18] docs: update installation procedure --- README.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9d00389..349a1c8 100644 --- a/README.md +++ b/README.md @@ -12,9 +12,15 @@ This project also assumes that you have installed the Pods plug-in (see https:// The tablepress-pods extension allows you to extract and display in Tablepress tables information from the content in Pods custom post types and taxonomies. If you use Pods and would like to produce tables from the information you've stored in them, this extension is potentially very useful. -##### Installation +##### Installation/Upgrade -Download a release from https://code.studioinfinity.org/glen/tablepress-pods/releases (as a zip file) and install and activate in your WordPress site like any other extension in zip format. (Namely, from your Dashboard, select Plugins, click on add new, and then browse to the downloaded zip file on your disk.) +Download a release from https://code.studioinfinity.org/glen/tablepress-pods/releases (as a zip file) and install and activate in your WordPress site like any other extension in zip format. Namely, from your Dashboard, you can: + +1. Select Plugins from the left-hand menu bar. +1. Click on "Add New" and then "Upload Plugin." +1. Browse to the downloaded zip file on your local disk, and click "Install Now." +1. If this is an upgrade, it will show you the currently installed version and the new version and ask you to + confirm the replacement. ##### Usage -- 2.34.1 From d0463d3b7e90f691eb1bfa93d0edb9dd2e87887a Mon Sep 17 00:00:00 2001 From: Glen Whitney Date: Mon, 8 Feb 2021 17:42:49 -0800 Subject: [PATCH 18/18] chore: fix old since values in comments in view-exportpods --- view-exportpods.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/view-exportpods.php b/view-exportpods.php index 8004e2d..a660a76 100644 --- a/view-exportpods.php +++ b/view-exportpods.php @@ -51,7 +51,7 @@ class TablePress_ExportPods_View extends TablePress_View { /** * Print the screen head text. * - * @since 1.0.0 + * @since 0.2.6 * * @param array $data Data for this screen. * @param array $box Information about the text box. @@ -74,7 +74,7 @@ class TablePress_ExportPods_View extends TablePress_View { /** * Print the content of the "No tables found" post meta box. * - * @since 1.0.0 + * @since 0.2.6 * * @param array $data Data for this screen. * @param array $box Information about the meta box. @@ -91,7 +91,7 @@ class TablePress_ExportPods_View extends TablePress_View { /** * Print the content of the "Export Tables" post meta box. * - * @since 1.0.0 + * @since 0.2.6 * * @param array $data Data for this screen. * @param array $box Information about the meta box. -- 2.34.1