本文整理汇总了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 = '';
//.........这里部分代码省略.........
示例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);
}