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


PHP JFilterOutput::stripImages方法代码示例

本文整理汇总了PHP中JFilterOutput::stripImages方法的典型用法代码示例。如果您正苦于以下问题:PHP JFilterOutput::stripImages方法的具体用法?PHP JFilterOutput::stripImages怎么用?PHP JFilterOutput::stripImages使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JFilterOutput的用法示例。


在下文中一共展示了JFilterOutput::stripImages方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testStripImages

	/**
	 * Tests stripping images.
	 *
	 * @return  void
	 *
	 * @since   11.3
	 */
	public function testStripImages()
	{
		$this->assertEquals(
			'Hello  I am waving at you.',
			$this->object->stripImages('Hello <img src="wave.jpg"> I am waving at you.'),
			'Should remove img tags'
		);
	}
开发者ID:robschley,项目名称:joomla-platform,代码行数:15,代码来源:JFilterOutputTest.php

示例2:

                    ?>
						<h5 class="feed-link"><?php 
                    echo $feed[$i]->title;
                    ?>
</h5>
					<?php 
                }
                ?>

					<?php 
                if ($params->get('rssitemdesc') && !empty($text)) {
                    ?>
						<div class="feed-item-description">
						<?php 
                    // Strip the images.
                    $text = JFilterOutput::stripImages($text);
                    $text = JHtml::_('string.truncate', $text, $params->get('word_count'));
                    echo str_replace('&apos;', "'", $text);
                    ?>
						</div>
					<?php 
                }
                ?>
				</li>
		<?php 
            }
            ?>
		</ul>
	<?php 
        }
        ?>
开发者ID:freaqzilla,项目名称:joomla-site,代码行数:31,代码来源:default.php

示例3: renderFeed


//.........这里部分代码省略.........
											<?php 
                        echo CompojoomHtmlString::truncateComplex($text, 200);
                        ?>
										</div>
									<?php 
                    }
                    ?>
								</li>
							<?php 
                }
                ?>
						</ul>
					</div>
			<?php 
            }
        } else {
            if ($rssDoc != false) {
                ?>
				<div class="feed">
					<?php 
                if (!is_null($feed->title)) {
                    ?>
						<h2>
							<a href="<?php 
                    echo str_replace('&', '&amp;', $url);
                    ?>
" target="_blank">
								<?php 
                    echo $feed->title;
                    ?>
</a>
						</h2>
					<?php 
                }
                ?>

					<?php 
                echo $feed->description;
                ?>


					<ul class="newsfeed">
						<?php 
                for ($i = 0; $i < $rssitems; $i++) {
                    if (!$feed->offsetExists($i)) {
                        break;
                    }
                    ?>
							<?php 
                    $uri = !empty($feed[$i]->uri) || !is_null($feed[$i]->uri) ? $feed[$i]->uri : $feed[$i]->guid;
                    $text = !empty($feed[$i]->content) || !is_null($feed[$i]->content) ? $feed[$i]->content : $feed[$i]->description;
                    ?>
							<li>
								<?php 
                    if (!empty($uri)) {
                        ?>
									<h5 class="feed-link">
										<a href="<?php 
                        echo $uri;
                        ?>
" target="_blank">
											<?php 
                        echo $feed[$i]->title;
                        ?>
</a></h5>
								<?php 
                    } else {
                        ?>
									<h5 class="feed-link"><?php 
                        echo $feed[$i]->title;
                        ?>
</h5>
								<?php 
                    }
                    ?>

								<?php 
                    if ($rssitemdesc && !empty($text)) {
                        ?>
									<div class="feed-item-description">
										<?php 
                        // Strip the images.
                        $text = JFilterOutput::stripImages($text);
                        $text = CompojoomHtmlString::truncateComplex($text, 200);
                        echo str_replace('&apos;', "'", $text);
                        ?>
									</div>
								<?php 
                    }
                    ?>
							</li>
						<?php 
                }
                ?>
					</ul>
				</div>
			<?php 
            }
        }
    }
开发者ID:compojoom,项目名称:lib_compojoom,代码行数:101,代码来源:feed.php

示例4: getRssFeed

 public function getRssFeed($url, $id)
 {
     $response = new JAXResponse();
     $version = new JVersion();
     $joomla_ver = $version->getHelpVersion();
     $rss = array();
     if ($joomla_ver <= '0.30') {
         $rssData = $this->getRSS($url, $id);
         foreach ($rssData->items as $item) {
             $data = new stdClass();
             preg_match_all('#(<[/]?img.*>)#U', $item->get_content(), $matches);
             $imgSrc = '';
             if (isset($matches[0][0])) {
                 $imgSrc = explode('src="', $matches[0][0]);
                 $imgSrc = explode('" ', $imgSrc[1]);
                 $imgSrc = $imgSrc[0];
             }
             $data->title = $item->get_title();
             $data->url = $item->get_link();
             $data->img = $imgSrc;
             $data->published = strtolower($item->get_date('l , d F Y'));
             $data->content = strip_tags(JFilterOutput::stripImages($item->get_description()));
             $rss[] = $data;
         }
     } else {
         try {
             $feed = new JFeedFactory();
             $rssDoc = $feed->getFeed($url);
         } catch (InvalidArgumentException $e) {
             return JText::_('MOD_FEED_ERR_FEED_NOT_RETRIEVED');
         } catch (RunTimeException $e) {
             return JText::_('MOD_FEED_ERR_FEED_NOT_RETRIEVED');
         } catch (LogicException $e) {
             return JText::_('MOD_FEED_ERR_FEED_NOT_RETRIEVED');
         }
         if (empty($rssDoc)) {
             return JText::_('MOD_FEED_ERR_FEED_NOT_RETRIEVED');
         }
         if ($rssDoc) {
             for ($i = 0; $i < 5; $i++) {
                 $date = $rssDoc[$i]->publishedDate;
                 $data = new stdClass();
                 preg_match_all('#(<[/]?img.*>)#U', $rssDoc[$i]->content, $matches);
                 $imgSrc = '';
                 if (isset($matches[0][0])) {
                     $imgSrc = explode('src="', $matches[0][0]);
                     $imgSrc = explode('" ', $imgSrc[1]);
                     $imgSrc = $imgSrc[0];
                 }
                 $data->title = $rssDoc[$i]->title;
                 $data->url = $rssDoc[$i]->uri;
                 $data->img = $imgSrc;
                 $data->published = strtolower($date->format('l , d F Y'));
                 $data->content = strip_tags(JFilterOutput::stripImages($rssDoc[$i]->content));
                 $rss[] = $data;
             }
         }
     }
     $html = '';
     foreach ($rss as $data) {
         //var_dump($data->img);
         $html .= '<div class="media clearfix">';
         $html .= '<div class="media-body">';
         $html .= '<h4 class="media-heading reset-gap"><a href="' . $data->url . '" target="_blank">' . $data->title . '</a></h4>';
         $html .= '<p class="orange">' . $data->published . '</p>';
         if ($data->img) {
             $html .= '<a class="pull-left thumbnail" href="' . $data->url . '" target="_blank">';
             $html .= '<img class="media-object" src="' . $data->img . '" width="100px"  />';
             $html .= '</a>';
         }
         $html .= JHTML::_('string.truncate', $data->content, 200);
         $html .= '</div>';
         $html .= '</div>';
     }
     $response->addScriptCall('joms.jQuery("#' . $id . '").html', $html);
     return $response->sendResponse();
 }
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:77,代码来源:community.php

示例5: stripImages

 /**
  * Helper wrapper method for stripImages
  *
  * @param   string  $string  Sting to be cleaned.
  *
  * @return string  Cleaned string.
  *
  * @see     JFilterOutput::stripImages()
  * @since   3.4
  */
 public function stripImages($string)
 {
     return JFilterOutput::stripImages($string);
 }
开发者ID:adjaika,项目名称:J3Base,代码行数:14,代码来源:output.php


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