當前位置: 首頁>>代碼示例>>PHP>>正文


PHP EasyBlogHelper::removeZemantaTags方法代碼示例

本文整理匯總了PHP中EasyBlogHelper::removeZemantaTags方法的典型用法代碼示例。如果您正苦於以下問題:PHP EasyBlogHelper::removeZemantaTags方法的具體用法?PHP EasyBlogHelper::removeZemantaTags怎麽用?PHP EasyBlogHelper::removeZemantaTags使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在EasyBlogHelper的用法示例。


在下文中一共展示了EasyBlogHelper::removeZemantaTags方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: truncateContent

 /**
  * Truncate's blog post with the respective settings.
  *
  * @access	public
  */
 public static function truncateContent(&$row, $loadVideo = false, $frontpage = false, $loadGallery = true)
 {
     $config = EasyBlogHelper::getConfig();
     $truncate = true;
     $maxCharacter = $config->get('layout_maxlengthasintrotext', 150);
     // @task: Maximum characters should not be lesser than 0
     $maxCharacter = $maxCharacter <= 0 ? 150 : $maxCharacter;
     // Check if truncation is really necessary because if introtext is already present, just use it.
     if (!empty($row->intro) && !empty($row->content)) {
         // We do not want the script to truncate anything since we'll just be using the intro part.
         $truncate = false;
     }
     // @task: If truncation is not necessary or the intro text is empty, let's just use the content.
     if (!$config->get('layout_blogasintrotext') || !$truncate) {
         //here we process the video and get the links.
         if ($loadVideo) {
             $row->intro = EasyBlogHelper::getHelper('Videos')->processVideos($row->intro);
             $row->content = EasyBlogHelper::getHelper('Videos')->processVideos($row->content);
         }
         // @rule: Process audio files.
         $row->intro = EasyBlogHelper::getHelper('Audio')->process($row->intro);
         $row->content = EasyBlogHelper::getHelper('Audio')->process($row->content);
         if (($config->get('main_image_gallery_frontpage') && $frontpage || !$frontpage) && $loadGallery) {
             $row->intro = EasyBlogHelper::getHelper('Gallery')->process($row->intro, $row->created_by);
             $row->content = EasyBlogHelper::getHelper('Gallery')->process($row->content, $row->created_by);
             // Process jomsocial albums
             $row->intro = EasyBlogHelper::getHelper('Album')->process($row->intro, $row->created_by);
             $row->content = EasyBlogHelper::getHelper('Album')->process($row->content, $row->created_by);
         }
         // @task: Strip out video tags
         $row->intro = EasyBlogHelper::getHelper('Videos')->strip($row->intro);
         $row->content = EasyBlogHelper::getHelper('Videos')->strip($row->content);
         // @task: Strip out audio tags
         $row->intro = EasyBlogHelper::getHelper('Audio')->strip($row->intro);
         $row->content = EasyBlogHelper::getHelper('Audio')->strip($row->content);
         // @task: Strip out gallery tags
         $row->intro = EasyBlogHelper::getHelper('Gallery')->strip($row->intro);
         $row->content = EasyBlogHelper::getHelper('Gallery')->strip($row->content);
         // @task: Strip out album tags
         $row->intro = EasyBlogHelper::getHelper('Album')->strip($row->intro);
         $row->content = EasyBlogHelper::getHelper('Album')->strip($row->content);
         // @rule: Once the gallery is already processed above, we will need to strip out the gallery contents since it may contain some unwanted codes
         // @2.0: <input class="easyblog-gallery"
         // @3.5: {ebgallery:'name'}
         $row->intro = EasyBlogHelper::removeGallery($row->intro);
         $row->content = EasyBlogHelper::removeGallery($row->content);
         if ($frontpage && $config->get('main_truncate_image_position') == 'hidden') {
             // Need to remove images, and videos.
             $row->intro = self::strip_only($row->intro, '<img>');
             $row->content = self::strip_only($row->content, '<img>');
         }
         $row->text = empty($row->intro) ? $row->content : $row->intro;
         return $row;
     }
     // @rule: If this is a normal blog post, we match them manually
     if (isset($row->source) && (!$row->source || empty($row->source))) {
         // @rule: Try to match all videos from the blog post first.
         $row->videos = EasyBlogHelper::getHelper('Videos')->getHTMLArray($row->intro . $row->content);
         // @rule:
         $row->galleries = EasyBlogHelper::getHelper('Gallery')->getHTMLArray($row->intro . $row->content);
         // @rule:
         $row->audios = EasyBlogHelper::getHelper('Audio')->getHTMLArray($row->intro . $row->content);
         // @rule:
         $row->albums = EasyBlogHelper::getHelper('Album')->getHTMLArray($row->intro . $row->content);
     }
     // @task: Here we need to strip out all items that are embedded since they are now not required because they'll be truncated.
     // @task: Strip out video tags
     $row->intro = EasyBlogHelper::getHelper('Videos')->strip($row->intro);
     $row->content = EasyBlogHelper::getHelper('Videos')->strip($row->content);
     // @task: Strip out audio tags
     $row->intro = EasyBlogHelper::getHelper('Audio')->strip($row->intro);
     $row->content = EasyBlogHelper::getHelper('Audio')->strip($row->content);
     // @task: Strip out gallery tags
     $row->intro = EasyBlogHelper::getHelper('Gallery')->strip($row->intro);
     $row->content = EasyBlogHelper::getHelper('Gallery')->strip($row->content);
     // @task: Strip out album tags
     $row->intro = EasyBlogHelper::getHelper('Album')->strip($row->intro);
     $row->content = EasyBlogHelper::getHelper('Album')->strip($row->content);
     // This is the combined content of the intro and the fulltext
     $content = $row->intro . $row->content;
     switch ($config->get('main_truncate_type')) {
         case 'chars':
             // @task: Remove Zemanta tags
             $content = EasyBlogHelper::removeZemantaTags($content);
             // Remove uneccessary html tags to avoid unclosed html tags
             $content = strip_tags($content);
             // Remove blank spaces since the word calculation should not include new lines or blanks.
             $content = trim($content);
             // @task: Let's truncate the content now.
             $row->text = JString::substr($content, 0, $maxCharacter);
             break;
         case 'words':
             $tag = false;
             $count = 0;
             $output = '';
//.........這裏部分代碼省略.........
開發者ID:Tommar,項目名稱:vino2,代碼行數:101,代碼來源:helper.php

示例2: shuffle

for ($i = 0; $i < count($entries); $i++) {
    $row = EasyBlogHelper::getTable('Blog');
    $row->bind($entries[$i]);
    $row->featuredImage = EasyBlogHelper::getFeaturedImage($row->intro . $row->content);
    // @rule: Process videos
    $row->intro = EasyBlogHelper::getHelper('Videos')->strip($row->intro);
    $row->content = EasyBlogHelper::getHelper('Videos')->strip($row->content);
    // @rule: Remove gallery codes
    $row->intro = EasyBlogHelper::getHelper('Gallery')->strip($row->intro);
    $row->content = EasyBlogHelper::getHelper('Gallery')->strip($row->content);
    // Process jomsocial albums
    $row->intro = EasyBlogHelper::getHelper('Album')->strip($row->intro);
    $row->content = EasyBlogHelper::getHelper('Album')->strip($row->content);
    //remove zemanta tags
    $row->intro = EasyBlogHelper::removeZemantaTags($row->intro);
    $row->content = EasyBlogHelper::removeZemantaTags($row->content);
    // Remove adsense codes
    require_once EBLOG_CLASSES . DIRECTORY_SEPARATOR . 'adsense.php';
    $row->intro = EasyBlogGoogleAdsense::stripAdsenseCode($row->intro);
    $row->content = EasyBlogGoogleAdsense::stripAdsenseCode($row->content);
    JTable::addIncludePath(EBLOG_TABLES);
    $author = EasyBlogHelper::getTable('Profile', 'Table');
    $author->load($row->created_by);
    $row->author = $author;
    $row->date = EasyBlogDateHelper::toFormat(EasyBlogHelper::getDate($row->created), $config->get('layout_dateformat', '%A, %d %B %Y'));
    $items[] = $row;
}
// If needed, shuffle the entries
if ($params->get('autoshuffle')) {
    shuffle($items);
}
開發者ID:alexinteam,項目名稱:joomla3,代碼行數:31,代碼來源:mod_showcase.php


注:本文中的EasyBlogHelper::removeZemantaTags方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。