當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。