本文整理匯總了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);
}
}
}
}
}