| Server IP : 162.214.67.83 / Your IP : 216.73.217.31 Web Server : Apache System : Linux dedi-13542965.clustter.com.br 5.14.0-687.20.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Jun 30 06:22:49 EDT 2026 x86_64 User : jforte ( 1063) PHP Version : 8.2.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/jforte/public_html/wp-content/plugins/wp-all-import/libraries/ |
Upload File : |
<?php
// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals
/**
* @author Olexandr Zanichkovsky <olexandr.zanichkovsky@zophiatech.com>
* @author Pavel Kulbakin <p.kulbakin@gmail.com>
* @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();
// phpcs:ignore WordPress.PHP.DevelopmentFunctions.prevent_path_disclosure_error_reporting
$err_lvl = error_reporting(E_ALL);
include $this->cachedTemplate;
// phpcs:ignore WordPress.PHP.DevelopmentFunctions.prevent_path_disclosure_error_reporting
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; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Captured into output buffer for internal concatenation, not sent to response.
$result[] = $this->trimValues ? trim(ob_get_clean()) : ob_get_clean();
}
return implode(XmlImportConfig::getInstance()->getMultiGlue(), $result);
} else {
// return null if nothing found
return null;
}
}
}