PluginProbe
TablePress – Tables in WordPress made easy / 3.2
TablePress – Tables in WordPress made easy v3.2
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 +12 -10 2.4.23.2 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 *
@@ -101,15 +100,15 @@
101 100 $tfoot = '';
102 101 $tbody = array();
103 102
104 103 foreach ( $table['data'] as $row_idx => $row ) {
105 - // First row, need to check for head (but only if at least two rows).
106 - 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'] ) {
107 106 $thead = $this->html_render_row( $row, 'th' );
108 107 continue;
109 108 }
110 - // Last row, need to check for footer (but only if at least two rows).
111 - 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'] ) {
112 111 $tfoot = $this->html_render_row( $row, 'th' );
113 112 continue;
114 113 }
115 114 // Neither first nor last row (with respective head/foot enabled), so render as body row.
@@ -170,10 +169,13 @@
170 169 'IMAGE(',
171 170 'HYPERLINK(',
172 171 'WEBSERVICE(',
173 172 );
173 +
174 + $fn_stripos = function_exists( 'mb_stripos' ) ? 'mb_stripos' : 'stripos';
175 +
174 176 foreach ( $functions_to_escape as $function ) {
175 - if ( false !== stripos( $cell_content, $function ) ) {
177 + if ( false !== $fn_stripos( $cell_content, $function ) ) {
176 178 $cell_content = "'" . $cell_content; // Prepend a ' to indicate that the cell format is a text string.
177 179 break;
178 180 }
179 181 }
@@ -221,9 +223,9 @@
221 223 /*
222 224 * Replace any & with &amp; that is not already an encoded entity (from function htmlentities2 in WP 2.8).
223 225 * A complete htmlentities2() or htmlspecialchars() would encode <HTML> tags, which we don't want.
224 226 */
225 - $cell_content = preg_replace( '/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,4};)/', '&amp;', $cell_content );
227 + $cell_content = (string) preg_replace( '/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,4};)/', '&amp;', $cell_content );
226 228 $cell_content = "\t\t\t<{$html_tag}>{$cell_content}</{$html_tag}>\n";
227 229 }
228 230
229 231 } // class TablePress_Export