本文整理汇总了PHP中PMXI_Import_Record::cdata方法的典型用法代码示例。如果您正苦于以下问题:PHP PMXI_Import_Record::cdata方法的具体用法?PHP PMXI_Import_Record::cdata怎么用?PHP PMXI_Import_Record::cdata使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PMXI_Import_Record
的用法示例。
在下文中一共展示了PMXI_Import_Record::cdata方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: preprocessXml
/**
* Some pre-processing logic, such as removing control characters from xml to prevent parsing errors
* @param string $xml
*/
public static function preprocessXml(&$xml)
{
if (empty(PMXI_Plugin::$session->is_csv) and empty(PMXI_Plugin::$is_csv)) {
self::$cdata = array();
$xml = preg_replace_callback('/<!\\[CDATA\\[[^\\]\\]>]*\\]\\]>/s', 'wp_all_import_cdata_filter', $xml);
$xml = str_replace("&", "&", str_replace("&", "&", $xml));
if (!empty(self::$cdata)) {
foreach (self::$cdata as $key => $val) {
$xml = str_replace('{{CPLACE_' . ($key + 1) . '}}', $val, $xml);
}
}
}
}
示例2: preprocessXml
/**
* Some pre-processing logic, such as removing control characters from xml to prevent parsing errors
* @param string $xml
*/
public static function preprocessXml(&$xml)
{
if (empty(PMXI_Plugin::$session->is_csv) and empty(PMXI_Plugin::$is_csv)) {
self::$cdata = array();
$is_preprocess_enabled = apply_filters('is_xml_preprocess_enabled', true);
if ($is_preprocess_enabled) {
$xml = preg_replace_callback('/<!\\[CDATA\\[[^\\]\\]]*\\]\\]>/s', 'wp_all_import_cdata_filter', $xml);
//$xml = preg_replace('/&(?![a-z#]+;)/i', '&', $xml);
$xml = preg_replace('/&([^amp;|^gt;|^lt;]+)/i', '&$1', $xml);
if (!empty(self::$cdata)) {
foreach (self::$cdata as $key => $val) {
$xml = str_replace('{{CPLACE_' . ($key + 1) . '}}', $val, $xml);
}
}
}
}
}