本文整理汇总了PHP中PerchUtil::text_to_html方法的典型用法代码示例。如果您正苦于以下问题:PHP PerchUtil::text_to_html方法的具体用法?PHP PerchUtil::text_to_html怎么用?PHP PerchUtil::text_to_html使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PerchUtil
的用法示例。
在下文中一共展示了PerchUtil::text_to_html方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: import_from_wp
//.........这里部分代码省略.........
break;
}
}
// if it's not of type 'post', skip.
if ($post_type != 'post') {
continue;
}
// At this point, check we don't already have the post (as we know have the postImportID to identify it)
if (isset($post['postImportID'])) {
$Post = $Posts->find_by_importID($post['postImportID']);
if (is_object($Post)) {
$out[] = array('type' => 'success', 'messages' => array('Post ' . $Post->postTitle(), 'Already imported'));
continue;
}
}
foreach ($item->children('dc', true) as $tag) {
$tagName = $tag->getName();
switch ($tagName) {
case 'creator':
$val = (string) $tag;
$Author = $Authors->get_one_by('authorImportRef', $val);
if (is_object($Author)) {
$post['authorID'] = $Author->id();
}
break;
}
}
foreach ($item->children('content', true) as $tag) {
$tagName = $tag->getName();
switch ($tagName) {
case 'encoded':
$raw = (string) $tag;
if ($format == 'textile') {
$html = PerchUtil::text_to_html($raw);
$post['postDescRaw'] = $raw;
$post['postDescHTML'] = $html;
} else {
$post['postDescRaw'] = $raw;
$post['postDescHTML'] = $raw;
}
break;
}
}
foreach ($item->children('excerpt', true) as $tag) {
$tagName = $tag->getName();
switch ($tagName) {
case 'encoded':
$raw = (string) $tag;
$html = PerchUtil::text_to_html($raw);
$fields = array();
$fields['excerpt'] = array();
if ($format == 'textile') {
$fields['excerpt']['raw'] = $raw;
$fields['excerpt']['processed'] = $html;
} else {
$fields['excerpt']['raw'] = $html;
$fields['excerpt']['processed'] = $html;
}
$post['postDynamicFields'] = PerchUtil::json_safe_encode($fields);
break;
}
}
// Callbacks
if ($callback) {
$post = call_user_func($callback, $post, $Template);
}