PluginProbe
TablePress – Tables in WordPress made easy / 3.0
TablePress – Tables in WordPress made easy v3.0
3.3.4 3.3.3 3.3.2 3.3.1 trunk 1.12 1.14 1.9.2 2.0.4 2.1.7 2.1.8 2.2 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.3 2.3.1 2.3.2 2.4 2.4.1 2.4.2 2.4.3 2.4.4 All 44 releases
← All changes | classes/class-export.php +9 -11 2.2.53.0 View file →
@@ -26,9 +26,9 @@
26 26 *
27 27 * @since 1.0.0
28 28 * @var array<string, string>
29 29 */
30 - public $export_formats = array();
30 + public array $export_formats = array();
31 31
32 32 /**
33 33 * Delimiters for the CSV export.
34 34 *
@@ -34,17 +34,16 @@
34 34 *
35 35 * @since 1.0.0
36 36 * @var array<string, string>
37 37 */
38 - public $csv_delimiters = array();
38 + public array $csv_delimiters = array();
39 39
40 40 /**
41 41 * Whether ZIP archive support is available in the PHP installation on the server.
42 42 *
43 43 * @since 1.0.0
44 - * @var bool
45 44 */
46 - public $zip_support_available = false;
45 + public bool $zip_support_available = false;
47 46
48 47 /**
49 48 * Initialize the Export class.
50 49 *
@@ -62,10 +61,9 @@
62 61 ',' => __( ', (comma)', 'tablepress' ),
63 62 'tab' => __( '\t (tabulator)', 'tablepress' ),
64 63 );
65 64
66 - /** This filter is documented in the WordPress function unzip_file() in wp-admin/includes/file.php */
67 - if ( class_exists( 'ZipArchive', false ) && apply_filters( 'unzip_file_use_ziparchive', true ) ) {
65 + if ( class_exists( 'ZipArchive', false ) ) {
68 66 $this->zip_support_available = true;
69 67 }
70 68 }
71 69
@@ -102,15 +100,15 @@
102 100 $tfoot = '';
103 101 $tbody = array();
104 102
105 103 foreach ( $table['data'] as $row_idx => $row ) {
106 - // First row, need to check for head (but only if at least two rows).
107 - if ( 0 === $row_idx && $table['options']['table_head'] && $num_rows > 1 ) {
104 + // Table head rows, but only if there's at least one additional row.
105 + if ( $row_idx < $table['options']['table_head'] && $num_rows > $table['options']['table_head'] ) {
108 106 $thead = $this->html_render_row( $row, 'th' );
109 107 continue;
110 108 }
111 - // Last row, need to check for footer (but only if at least two rows).
112 - if ( $last_row_idx === $row_idx && $table['options']['table_foot'] && $num_rows > 1 ) {
109 + // Table foot rows, but only if there's at least one additional row.
110 + if ( $row_idx > $last_row_idx - $table['options']['table_foot'] && $num_rows > $table['options']['table_foot'] ) {
113 111 $tfoot = $this->html_render_row( $row, 'th' );
114 112 continue;
115 113 }
116 114 // Neither first nor last row (with respective head/foot enabled), so render as body row.
@@ -222,9 +220,9 @@
222 220 /*
223 221 * Replace any & with &amp; that is not already an encoded entity (from function htmlentities2 in WP 2.8).
224 222 * A complete htmlentities2() or htmlspecialchars() would encode <HTML> tags, which we don't want.
225 223 */
226 - $cell_content = preg_replace( '/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,4};)/', '&amp;', $cell_content );
224 + $cell_content = (string) preg_replace( '/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,4};)/', '&amp;', $cell_content );
227 225 $cell_content = "\t\t\t<{$html_tag}>{$cell_content}</{$html_tag}>\n";
228 226 }
229 227
230 228 } // class TablePress_Export