Server IP : 172.67.158.161 / Your IP : 18.117.183.43 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 /** * @author Olexandr Zanichkovsky <[email protected]> * @author Pavel Kulbakin <[email protected]> * @package General */ require_once dirname(__FILE__) . '/XmlImportConfig.php'; /** * Represents a template */ class XmlImportTemplate { /** * Root element of the record that is being parsed * * @var SimpleXMLElement */ protected $xml; /** * file name of the cached template * * @var string */ protected $cachedTemplate; protected $trimValues = TRUE; /** * Creates new instance * * @param SimpleXmlElement $xml * @param string $cachedTemplate */ public function __construct($xml, $cachedTemplate) { $this->xml = $xml; $this->cachedTemplate = $cachedTemplate; $this->trimValues = apply_filters('wp_all_import_is_trim_parsed_data', $this->trimValues); } /** * Parses a template using {@see $this->xml} * * @return string */ public function parse() { ob_start(); $err_lvl = error_reporting(E_ALL); include $this->cachedTemplate; error_reporting($err_lvl); return ob_get_clean(); } /** * Get the value by XPath expression * * @param SimpleXmlElement $xpath XPath result * @return mixed */ protected function getValue($xpath = array()) { if (is_array($xpath) && count($xpath) > 0) { $result = array(); foreach ($xpath as $xp) { // concatenate multiple elements into 1 string ob_start(); echo $xp; $result[] = $this->trimValues ? trim(ob_get_clean()) : ob_get_clean(); } return implode(XmlImportConfig::getInstance()->getMultiGlue(), $result); } else { // return null if nothing found return null; } } }