本文整理汇总了PHP中FabrikString::truncate方法的典型用法代码示例。如果您正苦于以下问题:PHP FabrikString::truncate方法的具体用法?PHP FabrikString::truncate怎么用?PHP FabrikString::truncate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FabrikString
的用法示例。
在下文中一共展示了FabrikString::truncate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getRSSFeed
/**
* get fabrikar.com rss feed
* @return string
*/
function getRSSFeed()
{
// get RSS parsed object
$options = array();
$options['rssUrl'] = 'http://feeds.feedburner.com/fabrik';
$options['cache_time'] = 86400;
$rssDoc =& JFactory::getXMLparser('RSS', $options);
if ($rssDoc == false) {
$output = JText::_('Error: Feed not retrieved');
} else {
// channel header and link
$title = $rssDoc->get_title();
$link = $rssDoc->get_link();
$output = '<table class="adminlist">';
$output .= '<tr><th colspan="3"><a href="' . $link . '" target="_blank">' . JText::_($title) . '</th></tr>';
$items = array_slice($rssDoc->get_items(), 0, 3);
$numItems = count($items);
if ($numItems == 0) {
$output .= '<tr><th>' . JText::_('No news items found') . '</th></tr>';
} else {
$k = 0;
for ($j = 0; $j < $numItems; $j++) {
$item = $items[$j];
$output .= '<tr><td class="row' . $k . '">';
$output .= '<a href="' . $item->get_link() . '" target="_blank">' . $item->get_title() . '</a>';
$output .= '<br />' . $item->get_date('Y-m-d');
if ($item->get_description()) {
$description = FabrikString::truncate($item->get_description(), array('wordcount' => 50));
$output .= '<br />' . $description;
}
$output .= '</td></tr>';
}
}
$k = 1 - $k;
$output .= '</table>';
}
return $output;
}
示例2: getRSSFeed
/**
* Get fabrikar.com rss feed
*
* @return string
*/
public function getRSSFeed()
{
// Get RSS parsed object - Turn off error reporting as SimplePie creates strict error notices.
$origError = error_reporting();
error_reporting(0);
$version = new JVersion();
if ($version->RELEASE == 2.5) {
// get RSS parsed object
$options = array();
$options['rssUrl'] = 'http://feeds.feedburner.com/fabrik';
$options['cache_time'] = 86400;
$rssDoc = JFactory::getXMLparser('RSS', $options);
} else {
$rssDoc = JSimplepieFactory::getFeedParser('http://feeds.feedburner.com/fabrik', 86400);
}
if ($rssDoc == false) {
$output = FText::_('Error: Feed not retrieved');
} else {
// Channel header and link
$title = $rssDoc->get_title();
$link = $rssDoc->get_link();
$output = '<table class="adminlist">';
$output .= '<tr><th colspan="3"><a href="' . $link . '" target="_blank">' . FText::_($title) . '</th></tr>';
$items = array_slice($rssDoc->get_items(), 0, 3);
$numItems = count($items);
if ($numItems == 0) {
$output .= '<tr><th>' . FText::_('No news items found') . '</th></tr>';
} else {
$k = 0;
for ($j = 0; $j < $numItems; $j++) {
$item = $items[$j];
$output .= '<tr><td class="row' . $k . '">';
$output .= '<a href="' . $item->get_link() . '" target="_blank">' . $item->get_title() . '</a>';
$output .= '<br />' . $item->get_date('Y-m-d');
if ($item->get_description()) {
$description = FabrikString::truncate($item->get_description(), array('wordcount' => 50));
$output .= '<br />' . $description;
}
$output .= '</td></tr>';
$k = 1 - $k;
}
}
$output .= '</table>';
}
error_reporting($origError);
return $output;
}
示例3: array
</td>
<td><?php
echo $row->title;
?>
</td>
<td><?php
echo $row->user;
?>
</td>
<td style="text-align:center">
<a href="<?php
echo $row->view;
?>
">
<a class="fabrikTip" opts="{position:'right'}" title="<?php
echo FabrikString::truncate($row->content, array('tip' => false, 'wordcount' => 200));
?>
" >
<?php
echo FabrikHelperHTML::icon('icon-search');
?>
</a></td>
<td>
<div class="btn-group">
<a class="dropdown-toggle btn btn-mini" data-toggle="dropdown" href="#">
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li>
<a class="approve" href="<?php
echo $url . 'approve';