*/ class Wp_Database_Tools_Database_Data_Table extends Wp_Database_Tools_Database_Data { /** * The general data of database. * * @since 1.0.0 * @access protected * @var int $data The general data of database. */ protected $row; /** * Indicates if the table is prefixed or not * * @since 1.0.0 * @access protected * @var boolean $prefix Table has prefix. */ protected $prefix; /** * Table name without prefix * * @since 1.0.0 * @access protected * @var string $name_without_prefix Table name without prefix. */ protected $name_without_prefix; public function __construct($table, $feedback) { parent::__construct(); global $wpdb; // table data $this->row = $table->Rows; // Common data $this->name = $table->Name; $this->id = $this->name; $this->section = 'tables'; $this->size = $this->sum_size($table); $this->format_size = $this->get_file_size_info( $this->size ); $this->format_size = $this->format_size['size'] . '' . $this->format_size['type']; $this->set_feedback($feedback); $this->check_regex(); $this->set_prefix($table->Name, $wpdb->prefix); } public function check_regex(){ $this->set_regex(false); } public function set_multiple($value){ $this->multiple = true; } public function return_object_vars(){ return get_object_vars($this); } public function set_prefix($name, $prefix){ if (str_starts_with($name, $prefix)) { $this->name_without_prefix = substr($name, strlen($prefix)); }else{ $this->name_without_prefix = $name; } $this->prefix = ($prefix . $this->name_without_prefix == $name); } public function get_name() { return ($this->prefix) ? $this->name_without_prefix : $this->name; } public function get_name_without_prefix() { return $this->name_without_prefix; } }