本文整理汇总了PHP中limit_words函数的典型用法代码示例。如果您正苦于以下问题:PHP limit_words函数的具体用法?PHP limit_words怎么用?PHP limit_words使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了limit_words函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: download_description_function
function download_description_function($atts)
{
$atts = shortcode_atts(array('limit' => -1, 'shortcode' => 'yes', 'limit_words' => -1, 'id' => '', 'striphtml' => 'no', 'addtext' => '...'), $atts, 'download_description');
if ($atts['limit'] > 0) {
$atts['limit_words'] = -1;
}
if ($atts['id'] != '') {
$post = get_post($atts['id']);
$description = $post->post_content;
} else {
$description = get_the_content();
}
if ($atts['shortcode'] == 'trim') {
$description = strip_shortcodes($description);
}
$description = do_shortcode(wpautop($description));
if ($atts['striphtml'] == 'yes') {
$description = strip_tags($description);
}
if ($atts['limit'] > 0) {
$description = substr($description, 0, $atts['limit']);
$description .= $atts['addtext'];
}
if ($atts['limit_words'] > 0) {
$description = limit_words($description, $atts['limit_words']);
$description .= $atts['addtext'];
}
return $description;
}
示例2: download_excerpt_function
function download_excerpt_function($atts)
{
$atts = shortcode_atts(array('limit' => -1, 'shortcode' => 'yes', 'limit_words' => -1, 'id' => '', 'striphtml' => 'no', 'addtext' => '...', 'more' => 'no'), $atts, 'download_excerpt');
if ($atts['limit'] > 0) {
$atts['limit_words'] = -1;
}
global $post;
if ($atts['id'] != '') {
$post = get_post($atts['id']);
}
$description = $post->post_content;
if (has_excerpt(get_the_id())) {
$description = get_the_excerpt();
} else {
if (strstr($description, '<!--more-->') && $atts['more'] == 'yes') {
$description = get_the_excerpt();
$atts['limit'] = -1;
} else {
$description = substr($description, 0, 250);
$description = str_replace('<!--more-->', "", $description);
}
}
if ($atts['shortcode'] == 'trim') {
$description = strip_shortcodes($description);
}
$description = do_shortcode(wpautop($description));
if ($atts['striphtml'] == 'yes') {
$description = strip_tags($description);
}
if ($atts['limit'] > 0) {
$description = substr($description, 0, $atts['limit']);
$description .= $atts['addtext'];
}
if ($atts['limit_words'] > 0) {
$description = limit_words($description, $atts['limit_words']);
$description .= $atts['addtext'];
}
return $description;
}
示例3: alc_workshop6
function alc_workshop6($atts, $content = NULL)
{
extract(shortcode_atts(array("title" => 'Recent Work', "limit" => 6, "featured" => 0, "icon" => ''), $atts));
global $post;
$return = '';
$counter = 1;
$args = array('post_type' => 'workshop-6', 'taxonomy' => '', 'showposts' => $limit, 'posts_per_page' => $limit, 'orderby' => 'date', 'order' => 'DESC');
if ($featured) {
$args['meta_key'] = '_portfolio_featured';
$args['meta_value'] = '1';
}
$query = new WP_Query($args);
$return .= '
<div class="row">
<div class="large-12 columns">
<div class="title-block">
<div class="icon-container"><i class="icon ' . $icon . '"></i></div>
<span class="arrow-right"></span>
<h3>' . $title . '</h3>
<div class="clearfix"></div>
</div>
<div class="work_slide">
<ul id="work_slide_w6">';
while ($query->have_posts()) {
$query->the_post();
$custom = get_post_custom($post->ID);
$thumbnail = get_the_post_thumbnail($post->ID, 'portfolio-4-col');
$return .= '<li>
<div class="view view-two">';
if (!empty($thumbnail)) {
$return .= get_the_post_thumbnail($post->ID, 'portfolio-4-col', array('class' => 'cover'));
} else {
$return .= '<img src="' . get_template_directory_uri() . '/images/picture.jpg" alt="' . __('No preview image', 'Universfolio') . '" />';
}
$return .= '<div class="mask">
<h3>' . get_the_title() . '</h3>
<p>' . limit_words(get_the_excerpt(), 12) . '</p>';
if (isset($custom['_portfolio_link'][0]) && $custom['_portfolio_link'][0] != '') {
$return .= '<a href="' . get_permalink() . '" class="button btn-icon icon-2" title="' . get_the_title() . '">
<i class="icon-external-link icon-large"></i>
</a>';
} else {
$full_image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full', false);
$return .= '<a href="' . get_permalink() . '" class="button btn-icon icon-2" title="' . get_the_title() . '" >
<i class="icon-external-link icon-large"></i>
</a>';
}
$full_image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full', false);
$return .= '<a href="' . $full_image[0] . '" class="button btn-icon" data-rel="prettyPhoto" title="' . get_the_title() . '" >
<i class="icon-zoom-in icon-large"></i>
</a>';
$return .= '</div></div>';
$return .= '</li>';
}
wp_reset_query();
$return .= '</ul>
<div class="clearfix"></div>
<a class="prev" id="slide_prev_w6" href="#"><img src="' . get_template_directory_uri() . '/images/arrow_left.png" alt="' . __('Prev', 'Alcatron') . '"></a>
<a class="next" id="slide_next_w6" href="#"><img src="' . get_template_directory_uri() . '/images/arrow_right.png" alt="' . __('Next', 'Alcatron') . '"></a>
</div></div></div>';
$return .= "\n\t\t<script type=\"text/javascript\">\n\t\t\tjQuery(window).load(function(){\n\t\t\t\tjQuery('#work_slide_w6').carouFredSel({\n\t\t\t\t\tresponsive: true,\n\t\t\t\t\twidth: '100%',\n\t\t\t\t\tauto: false,\n\t\t\t\t\tcircular\t: false,\n\t\t\t\t\tinfinite\t: true,\n scroll: {items:4, pauseOnHover: true},\n\t\t\t\t\tprev : {button: \"#slide_prev_w6\", key\t: \"left\"},\n\t\t\t\t\tnext : {button\t: \"#slide_next_w6\", key : \"right\"},\n\t\t\t\t\tswipe: {onMouse: true, onTouch: true},\n\t\t\t\t\titems: {visible: {min: 1,max: 6}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t});\n\t\t</script>";
return $return;
}
示例4: parse
//.........这里部分代码省略.........
case 'cms:text':
$constant = $tag->tagAttrs['constant'];
$language = key_exists('language', $tag->tagAttrs) ? $tag->tagAttrs['language'] : $language;
$text = "";
// check if constant is module based
if (key_exists('module', $tag->tagAttrs)) {
if (class_exists($tag->tagAttrs['module'])) {
$module = call_user_func(array($tag->tagAttrs['module'], 'getInstance'));
$text = $module->getLanguageConstant($constant, $language);
}
} else {
// use default language handler
$text = MainLanguageHandler::getInstance()->getText($constant, $language);
}
echo $text;
break;
// support for markdown
// support for markdown
case 'cms:markdown':
$char_count = isset($tag->tagAttrs['chars']) ? fix_id($tag->tagAttrs['chars']) : null;
$end_with = isset($tag->tagAttrs['end_with']) ? fix_id($tag->tagAttrs['end_with']) : null;
$name = isset($tag->tagAttrs['param']) ? $tag->tagAttrs['param'] : null;
$multilanguage = isset($tag->tagAttrs['multilanguage']) ? $tag->tagAttrs['multilanguage'] == 'yes' : false;
// get content for parsing
if (is_null($name)) {
$content = $tag->tagData;
}
$content = $multilanguage ? $this->params[$name][$language] : $this->params[$name];
// convert to HTML
$content = Markdown($content);
// limit words if specified
if (!is_null($char_count)) {
if (is_null($end_with)) {
$content = limit_words($content, $char_count);
} else {
$content = limit_words($content, $char_count, $end_with);
}
}
echo $content;
break;
// call section specific data
// call section specific data
case '_section_data':
case 'cms:section_data':
if (!is_null($this->module)) {
$file = $this->module->getSectionFile($section, $action, $language);
$new = new TemplateHandler(basename($file), dirname($file) . '/');
$new->setLocalParams($this->params);
$new->setMappedModule($this->module);
$new->parse();
} else {
// log error
trigger_error('Mapped module is not loaded! File: ' . $this->file, E_USER_WARNING);
}
break;
// print multilanguage data
// print multilanguage data
case '_language_data':
case 'cms:language_data':
$name = isset($tag->tagAttrs['param']) ? $tag->tagAttrs['param'] : null;
if (!isset($this->params[$name]) || !is_array($this->params[$name]) || is_null($name)) {
break;
}
$template = new TemplateHandler('language_data.xml', $system_template_path);
$template->setMappedModule($this->module);
foreach ($this->params[$name] as $lang => $data) {
示例5: geoip_country_name_by_addr
$MemberData[$c]["country"] = geoip_country_name_by_addr($GeoIPDatabase, $row["user_ip"]);
if ($GeoIP == 1 and empty($MemberData[$c]["letter"])) {
$MemberData[$c]["letter"] = "blank";
$MemberData[$c]["country"] = "Reserved";
}
$c++;
}
if (isset($GeoIP) and $GeoIP == 1) {
geoip_close($GeoIPDatabase);
}
//GET USER COMMENTS
$sth = $db->prepare("SELECT c.user_id, c.post_id, c.text, c.`date`, n.news_title\r\n FROM " . OSDB_COMMENTS . " as c \r\n\t LEFT JOIN " . OSDB_NEWS . " as n ON n.news_id = c.post_id\r\n\t WHERE c.user_id = :userID AND n.status >= 1\r\n\t ORDER BY c.`date` DESC\r\n\t LIMIT 50");
$sth->bindValue(':userID', $userID, PDO::PARAM_INT);
$result = $sth->execute();
$c = 0;
$MemberComments = array();
while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
$ShortText = limit_words(convEnt($row["text"]), 30);
$ShortText = str_replace(array("'", '"'), array(" ", " "), $ShortText);
$MemberComments[$c]["short_text"] = $ShortText;
$MemberComments[$c]["text"] = $row["text"];
$MemberComments[$c]["news_title"] = $row["news_title"];
$MemberComments[$c]["post_id"] = $row["post_id"];
$MemberComments[$c]["date"] = date(OS_DATE_FORMAT, $row["date"]);
$MemberComments[$c]["date_int"] = $row["date"];
$c++;
}
} else {
header('location:' . OS_HOME . '?404');
die;
}
示例6: AutoLinkShort
$info = '<span style="float:right;">[read]</span>';
}
if ($status == 0) {
$info = '<span style="float:right;"><b>[unread]</b></span>';
}
$sth2 = $db->prepare("SELECT * FROM " . OSDB_USERS . " WHERE user_id = '{$fromID}' ");
$result = $sth2->execute();
$row2 = $sth2->fetch(PDO::FETCH_ASSOC);
$from = $row2["user_name"];
$MFrom = '<span style="font-size:11px;">from: <a href="' . OS_HOME . '?member=' . $row2["user_id"] . '"><i>' . $from . '</i></a></span>';
if (isset($_GET["pm"]) and !empty($_GET["pm"]) and $_GET["pm"] == $row["field_name"]) {
$text = AutoLinkShort(convEnt($row["field_value"])) . ' <div></div> <a href="' . OS_HOME . 'adm/?bnet_pm&pm' . $page . '">« back</a>';
$style = 'style="border: 4px solid #ccc; padding: 5px;"';
} else {
$style = "style='padding: 5px;'";
$text = '<a href="' . OS_HOME . 'adm/?bnet_pm&pm=' . $row["field_name"] . $page . '#' . $row["field_name"] . '">' . limit_words(convEnt($row["field_value"]), 15) . '</a>';
}
?>
<tr class="row">
<td width="200"><a class="anchor" name="<?php
echo $row["field_name"];
?>
"></a><b>to:</b> <a href="<?php
echo OS_HOME;
?>
?member=<?php
echo $sendID;
?>
"><b><?php
echo $sendTo;
?>
示例7: IN
$document->addScriptDeclaration($sbinit);
}
$db->setQuery('SELECT c.access' . ' FROM #__datsogallery_catg AS c' . ' LEFT JOIN #__datsogallery AS a' . ' ON a.catid = c.cid' . ' WHERE a.id = ' . (int) $id . ' AND a.published = 1' . ' AND a.approved = 1' . ' AND c.approved = 1' . ' AND c.published = 1' . ' AND c.access IN (' . $groups . ')');
$access = $db->loadObject();
if (!$access) {
$app->redirect(JRoute::_("index.php?option=com_datsogallery&view=datsogallery" . $itemid), JText::_('COM_DATSOGALLERY_NOT_ACCESS_THIS_IMAGE'));
}
$db->setQuery('SELECT a.*' . ' FROM #__datsogallery AS a' . ' WHERE a.id = ' . (int) $id);
$obj = $db->loadObject();
if (count($obj) < 1) {
$app->redirect(JRoute::_("index.php?option=com_datsogallery&view=datsogallery" . $itemid, false), JText::_('COM_DATSOGALLERY_PICSLAD'));
}
$document->setTitle($obj->imgtitle);
if ($ad_metagen) {
if ($obj->imgtext) {
$document->setDescription(limit_words($obj->imgtext, 25));
$document->setMetadata('keywords', metaGen($obj->imgtext));
}
}
$obj->id_cache = array();
$db->setQuery('SELECT *' . ' FROM #__datsogallery' . ' WHERE catid = ' . $obj->catid . ' AND published = 1' . ' AND approved = 1' . ' ORDER BY ordering');
$rows = $db->loadObjectList();
if (count($rows)) {
foreach ($rows as $row) {
$obj->id_cache[] = $row->id;
}
}
$act_key = array_search($obj->id, $obj->id_cache);
if ($ad_sortby == "ASC") {
$nid = isset($obj->id_cache[$act_key + 1]) ? $obj->id_cache[$act_key + 1] : 0;
$pid = isset($obj->id_cache[$act_key - 1]) ? $obj->id_cache[$act_key - 1] : 0;
示例8: the_post_thumbnail
?>
" class="fi-content">
<?php
if (has_post_thumbnail()) {
?>
<div class="fi-content-img">
<?php
the_post_thumbnail('feed');
?>
</div>
<?php
}
?>
<div class="fi-content-text">
<h2 class="fi-content-title"><?php
limit_words(get_the_title(), 10);
?>
</h2>
</div>
</a>
<div class="fi-meta">
<a href="<?php
the_permalink();
?>
" class="fi-meta-share">
<span class="fi-icon"><i class="fa fa-line-chart"></i></span>
<span class="fi-count"><?php
echo suffixNumFormat(get_post_meta(get_the_ID(), 'total_shares', true));
?>
</span>
</a>
示例9: view_post
function view_post($dbc, $post_data, $post_type, $post)
{
$thedate = date('Y-m-d H:i:s');
if ($post_data['post_date'] != '0000-00-00 00:00:00' && $post_data['post_date'] <= $thedate) {
$show_event = 1;
}
$body = strip_tags($post_data['body']);
$author = get_user_data($dbc, $post['user_id']);
$zone = data_zone($dbc, $post_data['zone']);
// Post Advertising Zone
$cat = data_cat($post_data['cat']);
// Post Category
// Check to see if the link is local or external:
if ($post_data['url'] != '') {
if (substr_count($post_data['url'], 'shore31.com') == 0) {
$target = ' target="_blank"';
}
$title = '<h1><a href="' . $post_data['url'] . '"' . $target . '>' . $post_data['title'] . '</a></h1>';
} else {
$title = '<h1>' . $post_data['title'] . '</h1>';
}
if ($post_type == 7) {
$title = '<h1><a href="' . H . $zone['slug'] . '/' . $cat . '/' . $post_data['slug'] . '">' . $post_data['title'] . '</a></h1>';
}
if ($post_type == 6) {
$bg = 'loc' . $post['zone'];
}
if ($post_type == 6) {
$bg_clear = 'style="background:none; border:none; box-shadow:none;"';
}
echo '<div id="post_' . $post_data['id'] . '" class="post post_type_' . $post_type . ' ' . $bg . ' ">';
if ($post_type == 8) {
echo '<div class="item event loc' . $post['zone'] . '">';
} else {
echo '<div class="item" ' . $bg_clear . '>';
}
switch ($post_type) {
case 1:
// Standard Post:
if ($post_data['image']) {
echo '<img style="border-radius:8px 8px 0px 0px;" src="' . H . UP . $post_data['image'] . '" style="width:100%; height:100%;">';
}
echo $title;
echo '<p class="article">' . limit_words($body, 20) . ' ...</p>';
echo '<p class="readmore"><a href="#">Read more</a></p>';
if ($post['display_date'] != '') {
echo '<p class="byline">Posted: ' . $post['display_date'] . '</p>';
}
echo '<div class="tag-list">' . $post_data['tag_list'] . '</div>';
break;
case 2:
// Video Post:
echo $title;
$video = str_replace('http://youtu.be/', '', $post_data['url']);
echo '<iframe style="border-radius:8px;" width="236" height="180" src="//www.youtube.com/embed/' . $video . '" frameborder="0" allowfullscreen></iframe>';
if ($post['display_date'] != '') {
echo '<p class="byline">Posted: ' . $post['display_date'] . '</p>';
}
echo '<div class="tag-list">' . $post_data['tag_list'] . '</div>';
break;
case 3:
// Article Post:
echo $title;
echo '<p>' . limit_words($body, 20) . ' ...</p>';
echo '<p class="readmore"><a href="http://alan.shore31.com/test-article.php?id=' . $post_data['slug'] . '">Read more</a></p>';
if ($post['display_date'] != '') {
echo '<p class="byline">Posted: ' . $post['display_date'] . '</p>';
}
echo '<div class="tag-list">' . $post_data['tag_list'] . '</div>';
break;
case 4:
// Poster Post:
echo $title;
if ($post_data['image']) {
echo '<img style="border-radius:0px 0px 0px 0px; margin-bottom:10px;" src="' . H . UP . $post_data['image'] . '" style="width:100%; height:100%;">';
}
echo '<div class="tag-list">' . $post_data['tag_list'] . '</div>';
break;
case 5:
// Ad Box Post:
echo '<p>' . $body . '</p>';
break;
case 6:
// Quote Post:
echo '<p style="box-shadow:1px 1px 5px #999999; margin:0px; border-radius:8px 8px 0px 0px;">' . $body . '</p>';
//echo '<div class="tag-list">'.$post_data['tag_list'].'</div>';
break;
case 7:
// Standard Post:
if ($post_data['image']) {
echo '<img style="border-radius:8px;" src="' . H . UP . $post_data['image'] . '" style="width:100%; height:100%;">';
}
echo $title;
echo '<p>' . limit_words($body, 20) . ' ...</p>';
echo '<p class="readmore"><a href="#">Read more</a></p>';
if ($post['display_date'] != '') {
echo '<p class="byline">Posted: ' . $post['display_date'] . '</p>';
}
echo '<div class="tag-list">' . $post_data['tag_list'] . '</div>';
break;
//.........这里部分代码省略.........
示例10: limit_words
" alt="*" /></a></td>
<td width="220"><a href="<?php
echo $website;
?>
adm/?items&edit=<?php
echo $row["itemid"] . $add;
?>
"><b><?php
echo $row["shortname"];
?>
</b></a>
<div class="font12"><?php
echo $row["type"];
?>
, Price: <?php
echo $row["price"];
?>
</div></td>
<td><?php
echo limit_words(convEnt($row["item_info"]), 14);
?>
</td>
</tr>
<?php
}
?>
</table>
<?php
include 'pagination.php';
?>
</div>
示例11: tglindo
<div style="margin-right: 10px; margin-bottom: 5px" class="imgl"><img src="upload/berita/<?php
echo $row_berita['img_berita'];
?>
" width="160" height="80" alt="" /></div>
<p class="latestnews" style="text-align: justify"><a href="index.php?route=beritabaca&id=<?php
echo $row_berita['id_berita'];
?>
"><strong><?php
echo $row_berita['judul_berita'];
?>
</strong> <small> - <?php
echo tglindo($row_berita['tgl_rekam']);
?>
</small></a></p>
<p class="latestnews" style="text-align: justify"><?php
echo strip_tags(limit_words($row_berita['isi_berita'], 30));
?>
</p>
<p class="readmore"><a href="index.php?route=beritabaca&id=<?php
echo $row_berita['id_berita'];
?>
">Continue Reading »</a></p>
</li>
<?php
$i++;
$count++;
}
?>
</ul>
</div>
<div>
示例12: viewCategory
function viewCategory()
{
$app = JFactory::getApplication('site');
$db = JFactory::getDBO();
$user = JFactory::getUser();
$groups = implode(',', $user->getAuthorisedViewLevels());
$document = JFactory::getDocument();
$filter_order = $app->getUserStateFromRequest('com_datsogallery.filter_order', 'filter_order', 'a.ordering', 'cmd');
$filter_order_Dir = $app->getUserStateFromRequest('com_datsogallery.filter_order_Dir', 'filter_order_Dir', '', 'word');
$catid = JRequest::getVar('catid', 0, '', 'int');
$menu = JSite::getMenu();
$ids = $menu->getItems('link', 'index.php?option=com_datsogallery&view=datsogallery');
$itemid = isset($ids[0]) ? '&Itemid=' . $ids[0]->id : '';
$is_editor = strtolower($user->usertype) == 'editor' || strtolower($user->usertype) == 'administrator' || strtolower($user->usertype) == 'super administrator';
GalleryHeader();
$db->setQuery("select count(*) from #__datsogallery_catg where cid = " . $catid . " AND access IN (" . $groups . ")");
$is_allowed = $db->loadResult();
if (!$is_allowed) {
$app->redirect(JRoute::_('index.php?option=com_datsogallery' . $itemid, false), JText::_('COM_DATSOGALLERY_NOT_ACCESS_THIS_CATEGORY'), 'notice');
}
//echo dgCategories($catid);
require JPATH_COMPONENT_ADMINISTRATOR . DS . 'config.datsogallery.php';
if ($ad_sbcat) {
$ssa = !$ad_slideshow_auto ? ',onOpen:function(currentImage){Shadowbox.play();Shadowbox.pause();}' : '';
$document->addStyleSheet(JURI::base(true) . '/components/com_datsogallery/libraries/shadowbox/shadowbox.css');
$document->addScript(JURI::base(true) . '/components/com_datsogallery/libraries/shadowbox/shadowbox.js');
$sbinit = 'Shadowbox.init({slideshowDelay:' . $ad_slideshow_delay . $ssa . '});';
$document->addScriptDeclaration($sbinit);
}
$db->setQuery("SELECT COUNT(*)" . " FROM #__datsogallery AS a" . " LEFT JOIN #__datsogallery_catg AS c" . " ON c.cid = a.catid" . " WHERE a.published = 1" . " AND a.catid = " . $catid . " AND a.approved = 1" . " AND c.access IN (" . $groups . ")");
$count = $db->loadResult();
if (!in_array($filter_order, array('a.imgcounter', 'a.imgdownloaded', 'a.imgtitle', 'a.imgdate', 'a.ordering'))) {
$filter_order = 'a.ordering';
}
if (!in_array(strtoupper($filter_order_Dir), array('ASC', 'DESC'))) {
$filter_order_Dir = $ad_sortby;
}
$orderby = ' ORDER BY ' . $filter_order . ' ' . $filter_order_Dir;
if ($ad_picincat && $count > 0) {
echo JText::sprintf('COM_DATSOGALLERY_CATEGORY_IMAGES', $count);
}
?>
<form method="post" id="adminForm">
<?php
$query = "SELECT count(*) AS count" . " FROM #__datsogallery" . " WHERE catid = " . $catid . " AND published = 1" . " AND approved = 1";
$db->setQuery($query);
$row = $db->LoadObject();
$total = $row->count;
jimport('joomla.html.pagination');
$limit = JRequest::getVar('limit', $ad_perpage, '', 'int');
$limitstart = JRequest::getVar('limitstart', 0, '', 'int');
$pagination = new JPagination($total, $limitstart, $limit);
if ($count > $ad_perpage) {
$page_nav_links = $pagination->getPagesLinks();
?>
<div class="datso_pgn"><?php
echo $page_nav_links;
?>
</div>
<div style="clear:both"></div>
<?php
}
$db->setQuery("SELECT * FROM #__datsogallery_catg WHERE cid = " . $catid);
$rows = $db->loadObjectList();
$catname = $rows[0]->name;
if ($show_grid) {
echo '<div class="dg_head_background">' . str_replace('Joomla.tableOrdering', 'tableOrdering', JHTML::_('grid.sort', $catname . ' ', 'a.imgtitle', $filter_order_Dir, $filter_order));
echo '<span class="grid_txt"><div class="grid_border">' . str_replace('Joomla.tableOrdering', 'tableOrdering', JHTML::_('grid.sort', JText::_('COM_DATSOGALLERY_ORDER') . ' ', 'a.ordering', $filter_order_Dir, $filter_order)) . '</div>';
echo '<div class="grid_border">' . str_replace('Joomla.tableOrdering', 'tableOrdering', JHTML::_('grid.sort', JText::_('COM_DATSOGALLERY_DATE_ADD') . ' ', 'a.imgdate', $filter_order_Dir, $filter_order)) . '</div>';
echo '<div class="grid_border">' . str_replace('Joomla.tableOrdering', 'tableOrdering', JHTML::_('grid.sort', JText::_('COM_DATSOGALLERY_HITS') . ' ', 'a.imgcounter', $filter_order_Dir, $filter_order)) . '</div>';
echo '<div class="grid_border">' . str_replace('Joomla.tableOrdering', 'tableOrdering', JHTML::_('grid.sort', JText::_('COM_DATSOGALLERY_DOWNLOADS') . ' ', 'a.imgdownloaded', $filter_order_Dir, $filter_order)) . '</div>';
echo '</span></div>';
} else {
echo '<div class="dg_head_background">' . $catname . '</div>';
}
echo "<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\" class=\"dg_body_background\">\n";
if ($count > $ad_perpage) {
$addspace = ' - ';
} else {
$addspace = '';
}
$pages = $pagination->getPagesCounter();
$document->setTitle($catname . $addspace . $pages);
if ($ad_metagen) {
if ($rows[0]->description) {
$document->setTitle($catname . $addspace . $pages);
$document->setDescription(limit_words($rows[0]->description, 25));
$document->setMetadata('keywords', metaGen($rows[0]->description));
}
}
$query = 'SELECT a.*' . ' FROM #__datsogallery AS a' . ' LEFT JOIN #__datsogallery_catg AS c' . ' ON c.cid = a.catid' . ' WHERE a.published = 1' . ' AND a.catid = ' . $catid . ' AND a.approved = 1' . ' AND c.access IN (' . $groups . ')' . $orderby;
$db->setQuery($query, $pagination->limitstart, $pagination->limit);
$rows = $db->loadObjectList();
$rowcounter = 0;
if (count($rows) > 0) {
foreach ($rows as $row1) {
if ($ad_ncsc) {
$cw = 100 / $ad_cp . "%";
}
if ($rowcounter % $ad_cp == 0) {
//.........这里部分代码省略.........
示例13: limit_words
<?php
}
?>
<p style="padding-top: 10px;">
<?php
if (str_word_count($row['long_desc']) < $blogWordLimit) {
echo $row['long_desc'];
} else {
if (str_word_count($row['long_desc']) < $blogWordLimit + 50 && str_word_count($row['long_desc']) - 50 < 50) {
echo $row['long_desc'];
} else {
if (isset($postID)) {
echo $row['long_desc'];
} else {
echo limit_words($row['long_desc'], $blogWordLimit);
?>
<a style="color: #333333" href="post.php?id=<?php
echo $row['ID'];
?>
">
<?php
echo ' [..]</a>';
}
}
}
?>
</p>
<div class="shareButtons">
<table style="width: 100%">
示例14: bloginfo
bloginfo('url');
?>
"><img src="<?php
bloginfo('template_directory');
?>
/img/gob-247.png" /></a>
<div class="bloque-header single-principal">
<p>Sobre esta Categoría</p>
<h1><?php
echo $category->name;
?>
</h1>
</div>
<p><?php
echo limit_words($cat_desc, 30);
?>
</p>
<a href="http://www.iadb.org/es/banco-interamericano-de-desarrollo,2837.html" target="_blank"><img src="<?php
bloginfo('template_directory');
?>
/img/bid.png" /></a>
</div>
</div><!-- principal -->
<div id="search-wrapper" class="infinite-wrapper">
<?php
global $wp_query;
示例15: getSearchResults
/**
* Get search results when asked by search module
*
* @param array $query
* @param integer $threshold
* @return array
*/
public function getSearchResults($query, $threshold)
{
global $language;
$manager = ShopItemManager::getInstance();
$result = array();
$conditions = array('visible' => 1, 'deleted' => 0);
$query = mb_strtolower($query);
$query_words = mb_split("\\s", $query);
// include pre-configured options
if (isset($this->search_params['category'])) {
$membership_manager = ShopItemMembershipManager::getInstance();
$category = $this->search_params['category'];
$item_ids = array();
if (!is_numeric($category)) {
$category_manager = ShopCategoryManager::getInstance();
$raw_category = $category_manager->getSingleItem(array('id'), array('text_id' => $category));
if (is_object($raw_category)) {
$category = $raw_category->id;
} else {
$category = -1;
}
}
// get list of item ids
$membership_list = $membership_manager->getItems(array('item'), array('category' => $category));
if (count($membership_list) > 0) {
foreach ($membership_list as $membership) {
$item_ids[] = $membership->item;
}
$conditions['id'] = $item_ids;
}
}
// get all items and process them
$items = $manager->getItems(array('id', 'name'), $conditions);
// search through items
if (count($items) > 0) {
foreach ($items as $item) {
$title = mb_strtolower($item->name[$language]);
$score = 0;
foreach ($query_words as $query_word) {
if (is_numeric(mb_strpos($title, $query_word))) {
$score += 10;
}
}
// add item to result list
if ($score >= $threshold) {
$result[] = array('score' => $score, 'title' => $title, 'description' => limit_words($item->description[$language], 200), 'id' => $item->id, 'type' => 'item', 'module' => $this->name);
}
}
}
return $result;
}