Server IP : 172.67.158.161 / Your IP : 3.15.220.29 Web Server : LiteSpeed System : Linux business53.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : giankuin ( 1871) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/giankuin/sieuthiweb.com.vn/wp-content/plugins/wp-all-import-pro/libraries/ |
Upload File : |
<?php class PMXI_XLSParser{ public $csv_path; public $_filename; public $targetDir; public $xml; public function __construct($path, $targetDir = false){ $this->_filename = $path; $wp_uploads = wp_upload_dir(); $this->targetDir = ( ! $targetDir ) ? wp_all_import_secure_file($wp_uploads['basedir'] . DIRECTORY_SEPARATOR . PMXI_Plugin::UPLOADS_DIRECTORY ) : $targetDir; } public function parse(){ $tmpname = wp_unique_filename($this->targetDir, preg_replace('%\W(xls|xlsx)$%i', ".csv", basename($this->_filename))); $this->csv_path = $this->targetDir . '/' . wp_all_import_url_title($tmpname); return $this->toXML(); } protected function toXML(){ include_once( PMXI_Plugin::ROOT_DIR . '/classes/PHPExcel/IOFactory.php' ); $objPHPExcel = PHPExcel_IOFactory::load($this->_filename); $objPHPExcel = apply_filters('wp_all_import_phpexcel_object', $objPHPExcel, $this->_filename); $PHPExcelDelimiter = ","; $PHPExcelDelimiter = apply_filters('wp_all_import_phpexcel_delimiter', $PHPExcelDelimiter, $this->_filename); $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'CSV')->setDelimiter($PHPExcelDelimiter) ->setEnclosure('"') ->setLineEnding("\r\n") ->setSheetIndex(0) ->save($this->csv_path); include_once(PMXI_Plugin::ROOT_DIR . '/libraries/XmlImportCsvParse.php'); $this->xml = new PMXI_CsvParser( array( 'filename' => $this->csv_path, 'targetDir' => $this->targetDir ) ); @unlink($this->csv_path); return $this->xml->xml_path; } }