本文整理汇总了PHP中EasyBlogHelper::removeGallery方法的典型用法代码示例。如果您正苦于以下问题:PHP EasyBlogHelper::removeGallery方法的具体用法?PHP EasyBlogHelper::removeGallery怎么用?PHP EasyBlogHelper::removeGallery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EasyBlogHelper
的用法示例。
在下文中一共展示了EasyBlogHelper::removeGallery方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 = EB::videos()->processVideos($row->intro);
$row->content = EB::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 = EB::videos()->strip($row->intro);
$row->content = EB::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->posttype) && (!$row->posttype || empty($row->posttype))) {
// @rule: Try to match all videos from the blog post first.
$row->videos = EB::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 = EB::videos()->strip($row->intro);
$row->content = EB::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':
// 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 = '';
// Remove uneccessary html tags to avoid unclosed html tags
$content = strip_tags($content);
//.........这里部分代码省略.........
示例2: addIndexerNewBlog
/**
* Creates a new stream for new comments in EasyBlog
*
* @since 1.0
* @access public
* @param string
* @return
*/
public function addIndexerNewBlog($blog)
{
if (!class_exists('Foundry')) {
return;
}
$config = EasyBlogHelper::getConfig();
$indexer = Foundry::get('Indexer', 'com_easyblog');
$template = $indexer->getTemplate();
// getting the blog content
$content = $blog->intro . $blog->content;
$image = '';
// @rule: Try to get the blog image.
if ($blog->getImage()) {
$image = $blog->getImage()->getSource('small');
}
if (empty($image)) {
// @rule: Match images from blog post
$pattern = '/<\\s*img [^\\>]*src\\s*=\\s*[\\""\']?([^\\""\'\\s>]*)/i';
preg_match($pattern, $content, $matches);
$image = '';
if ($matches) {
$image = isset($matches[1]) ? $matches[1] : '';
if (JString::stristr($matches[1], 'https://') === false && JString::stristr($matches[1], 'http://') === false && !empty($image)) {
$image = rtrim(JURI::root(), '/') . '/' . ltrim($image, '/');
}
}
}
if (!$image) {
$image = rtrim(JURI::root(), '/') . '/components/com_easyblog/assets/images/default_facebook.png';
}
// @task: Strip out video tags
$content = EasyBlogHelper::getHelper('Videos')->strip($content);
// @task: Strip out audio tags
$content = EasyBlogHelper::getHelper('Audio')->strip($content);
// @task: Strip out gallery tags
$content = EasyBlogHelper::getHelper('Gallery')->strip($content);
// @task: Strip out album tags
$content = EasyBlogHelper::getHelper('Album')->strip($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'}
$content = EasyBlogHelper::removeGallery($content);
$content = strip_tags($content);
if (JString::strlen($content) > $config->get('integrations_easysocial_indexer_newpost_length', 250)) {
$content = JString::substr($content, 0, $config->get('integrations_easysocial_indexer_newpost_length', 250));
}
// lets include the title as the search snapshot.
$content = $blog->title . ' ' . $content;
$template->setContent($blog->title, $content);
$url = EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $blog->id);
// Remove /administrator/ from the url.
$url = JString::str_ireplace('administrator/', '', $url);
$template->setSource($blog->id, 'blog', $blog->created_by, $url);
$template->setThumbnail($image);
$template->setLastUpdate($blog->modified);
$state = $indexer->index($template);
return $state;
}
示例3: 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 = EB::videos()->processVideos($row->intro);
$row->content = EB::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 = EB::videos()->strip($row->intro);
$row->content = EB::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->posttype) && (!$row->posttype || empty($row->posttype))) {
// @rule: Try to match all videos from the blog post first.
$row->videos = EB::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 = EB::videos()->strip($row->intro);
$row->content = EB::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;
//var_dump($row );exit;
if ($config->get('main_truncate_ellipses') && isset($row->readmore) && $row->readmore) {
$row->text .= JText::_('COM_EASYBLOG_ELLIPSES');
}
if (isset($row->posttype) && (!$row->posttype || empty($row->posttype))) {
// @task: Determine the position of media items that should be included in the content.
$embedHTML = '';
$embedVideoHTML = '';
$imgHTML = '';
if (!empty($row->galleries)) {
$embedHTML .= implode('', $row->galleries);
}
if (!empty($row->audios)) {
$embedHTML .= implode('', $row->audios);
}
//.........这里部分代码省略.........