. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
| Server IP : 162.0.212.4 / Your IP :
216.73.216.14 [
Web Server : LiteSpeed System : Linux premium146.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64 User : alshnoli ( 2431) PHP Version : 8.3.28 Disable Function : NONE Domains : 1 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/alshnoli/public_html/wp-content/plugins/tablepress/classes/ |
Upload File : |
<?php
/**
* TablePress Table Import Base Class
*
* @package TablePress
* @subpackage Export/Import
* @author Tobias Bäthge
* @since 2.0.0
*/
// Prohibit direct script loading.
defined( 'ABSPATH' ) || die( 'No direct script access allowed!' );
/**
* TablePress Table Import Base Class
*
* @package TablePress
* @subpackage Export/Import
* @author Tobias Bäthge
* @since 2.0.0
*/
abstract class TablePress_Import_Base {
/**
* Makes sure that a passed table array is rectangular with all rows having the same number of columns (the highest one that is found).
*
* This function uses call by reference to save PHP memory on large arrays.
*
* @since 1.0.0
* @since 2.0.0 The $an_array parameter is handled by reference.
*
* @param array<int, array<int, mixed>> $an_array Two-dimensional array to be padded.
*/
public function pad_array_to_max_cols( array &$an_array ): void {
$max_columns = $this->count_max_columns( $an_array );
// Extend the array to at least one column.
$max_columns = max( 1, $max_columns );
array_walk(
$an_array,
static function ( array &$row, int $col_idx ) use ( $max_columns ): void {
$row = array_pad( $row, $max_columns, '' );
},
);
}
/**
* Get the highest number of columns in the rows.
*
* @since 1.0.0
*
* @param array<int, array<int, mixed>> $an_array Two-dimensional array.
* @return int Highest number of columns in the rows of the array.
*/
protected function count_max_columns( array $an_array ): int {
$max_columns = 0;
foreach ( $an_array as $row_idx => $row ) {
$num_columns = count( $row );
$max_columns = max( $num_columns, $max_columns );
}
return $max_columns;
}
} // class TablePress_Import_Base