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-import-legacy.php +11 -13 2.3.23.0 View file →
@@ -26,25 +26,23 @@
26 26 *
27 27 * @since 1.0.0
28 28 * @var array<string, string>
29 29 */
30 - public $import_formats = array();
30 + public array $import_formats = array();
31 31
32 32 /**
33 33 * Whether HTML import support is available in the PHP installation on the server.
34 34 *
35 35 * @since 1.0.0
36 - * @var bool
37 36 */
38 - public $html_import_support_available = false;
37 + public bool $html_import_support_available = false;
39 38
40 39 /**
41 40 * Data to be imported.
42 41 *
43 42 * @since 1.0.0
44 - * @var string
45 43 */
46 - protected $import_data;
44 + protected string $import_data;
47 45
48 46 /**
49 47 * Imported table.
50 48 *
@@ -126,9 +124,9 @@
126 124 array_walk_recursive(
127 125 $this->imported_table['data'],
128 126 static function ( /* string|int|float|bool|null */ &$cell_content, int $col_idx ): void {
129 127 $cell_content = (string) $cell_content;
130 - }
128 + },
131 129 );
132 130
133 131 return $this->imported_table;
134 132 }
@@ -181,9 +179,9 @@
181 179
182 180 // Check if JSON could be decoded.
183 181 if ( is_null( $json_table ) ) {
184 182 $json_error = json_last_error_msg();
185 - $output = '<strong>' . __( 'The imported file contains errors:', 'tablepress' ) . "</strong><br /><br />JSON error: {$json_error}<br />";
183 + $output = '<strong>' . __( 'The imported file contains errors:', 'tablepress' ) . "</strong><br><br>JSON error: {$json_error}<br>";
186 184 wp_die( $output, 'Import Error', array( 'response' => 200, 'back_link' => true ) );
187 185 }
188 186
189 187 // Specifically cast to an array again.
@@ -261,11 +259,11 @@
261 259 foreach ( $table as &$row ) {
262 260 foreach ( $row as &$cell ) {
263 261 $cell = $cell['val'];
264 262 }
265 - unset( $cell );
263 + unset( $cell ); // Unset use-by-reference parameter of foreach loop.
266 264 }
267 - unset( $row );
265 + unset( $row ); // Unset use-by-reference parameter of foreach loop.
268 266
269 267 $this->imported_table = array( 'data' => $table );
270 268 }
271 269
@@ -278,9 +276,9 @@
278 276 TablePress::load_file( 'simplexlsx.class.php', 'libraries' );
279 277 $xlsx_file = \Shuchkin\SimpleXLSX::parse( $this->import_data, true );
280 278
281 279 if ( ! $xlsx_file ) {
282 - $output = '<strong>' . __( 'The imported file contains errors:', 'tablepress' ) . '</strong><br /><br />' . \Shuchkin\SimpleXLSX::parseError() . '<br />';
280 + $output = '<strong>' . __( 'The imported file contains errors:', 'tablepress' ) . '</strong><br><br>' . \Shuchkin\SimpleXLSX::parseError() . '<br>';
283 281 wp_die( $output, 'Import Error', array( 'response' => 200, 'back_link' => true ) );
284 282 }
285 283
286 284 $this->imported_table = array( 'data' => $xlsx_file->rows() );
@@ -321,9 +319,9 @@
321 319 if ( function_exists( 'mb_detect_encoding' ) ) {
322 320 $current_encoding = mb_detect_encoding( $this->import_data, 'ASCII, UTF-8, ISO-8859-1' );
323 321 if ( 'UTF-8' !== $current_encoding ) {
324 322 // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged
325 - $data = @iconv( $current_encoding, 'UTF-8', $this->import_data ); // @phpstan-ignore-line
323 + $data = @iconv( $current_encoding, 'UTF-8', $this->import_data ); // @phpstan-ignore argument.type
326 324 if ( false !== $data ) {
327 325 $this->import_data = $data;
328 326 return;
329 327 }
@@ -337,9 +335,9 @@
337 335 * This function uses call by reference to save PHP memory on large arrays.
338 336 *
339 337 * @since 2.0.0
340 338 *
341 - * @param string[] $an_array Array in which Windows line breaks should be replaced by Unix line breaks.
339 + * @param array<int, array<int, string>> $an_array Array in which Windows line breaks should be replaced by Unix line breaks.
342 340 */
343 341 protected function normalize_line_endings( array &$an_array ): void {
344 342 array_walk_recursive(
345 343 $an_array,
@@ -344,9 +342,9 @@
344 342 array_walk_recursive(
345 343 $an_array,
346 344 static function ( string &$cell_content, int $col_idx ): void {
347 345 $cell_content = str_replace( "\r\n", "\n", $cell_content );
348 - }
346 + },
349 347 );
350 348 }
351 349
352 350 } // class TablePress_Import_Legacy