当前位置: 首页>>代码示例>>PHP>>正文


PHP PerchUtil::text_to_html方法代码示例

本文整理汇总了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);
         }
开发者ID:jimcurran,项目名称:bdmusichub,代码行数:67,代码来源:PerchBlog_Util.class.php


注:本文中的PerchUtil::text_to_html方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。