本文整理汇总了PHP中WeblinksHelperRoute类的典型用法代码示例。如果您正苦于以下问题:PHP WeblinksHelperRoute类的具体用法?PHP WeblinksHelperRoute怎么用?PHP WeblinksHelperRoute使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WeblinksHelperRoute类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: edit
static function edit($weblink, $params, $attribs = array())
{
$user = JFactory::getUser();
$uri = JFactory::getURI();
if ($params && $params->get('popup')) {
return;
}
if ($weblink->state < 0) {
return;
}
JHtml::_('behavior.tooltip');
$url = WeblinksHelperRoute::getFormRoute($weblink->id, base64_encode($uri));
$icon = $weblink->state ? 'edit.png' : 'edit_unpublished.png';
$text = JHtml::_('image', 'system/' . $icon, JText::_('JGLOBAL_EDIT'), NULL, true);
if ($weblink->state == 0) {
$overlib = JText::_('JUNPUBLISHED');
} else {
$overlib = JText::_('JPUBLISHED');
}
$date = JHtml::_('date', $weblink->created);
$author = $weblink->created_by_alias ? $weblink->created_by_alias : $weblink->author;
$overlib .= '<br />';
$overlib .= $date;
$overlib .= '<br />';
$overlib .= htmlspecialchars($author, ENT_COMPAT, 'UTF-8');
$button = JHtml::_('link', JRoute::_($url), $text);
$output = '<span class="hasTip" title="' . JText::_('COM_WEBLINKS_EDIT') . ' :: ' . $overlib . '">' . $button . '</span>';
return $output;
}
开发者ID:christianesperar,项目名称:joomla-example,代码行数:29,代码来源:icon.php
示例2: prepareDocument
/**
* Prepares the document
*
* @return void
*/
protected function prepareDocument()
{
$app = JFactory::getApplication();
$menus = $app->getMenu();
$pathway = $app->getPathway();
$title = null;
// Because the application sets a default page title,
// we need to get it from the menu item itself
$menu = $menus->getActive();
if ($menu) {
$this->params->def('page_heading', $this->params->get('page_title', $menu->title));
} else {
$this->params->def('page_heading', JText::_('COM_WEBLINKS_DEFAULT_PAGE_TITLE'));
}
$id = (int) @$menu->query['id'];
if ($menu && ($menu->query['option'] != 'com_weblinks' || $id != $this->category->id)) {
$this->params->set('page_subheading', $this->category->title);
$path = array(array('title' => $this->category->title, 'link' => ''));
$category = $this->category->getParent();
while (($menu->query['option'] != 'com_weblinks' || $id != $category->id) && $category->id > 1) {
$path[] = array('title' => $category->title, 'link' => WeblinksHelperRoute::getCategoryRoute($category->id));
$category = $category->getParent();
}
$path = array_reverse($path);
foreach ($path as $item) {
$pathway->addItem($item['title'], $item['link']);
}
}
parent::addFeed();
}
开发者ID:DanyCan,项目名称:wisten.github.io,代码行数:35,代码来源:view.html.php
示例3: getItems
function getItems($args)
{
$items = array();
switch ($args->view) {
// Get all WebLink categories
default:
case 'categories':
$categories = AdvLink::getCategory('com_weblinks');
foreach ($categories as $category) {
$itemid = AdvLink::getItemId('com_weblinks', array('categories' => null, 'category' => $category->id));
$items[] = array('id' => 'index.php?option=com_weblinks&view=category&id=' . $category->id . $itemid, 'name' => $category->title . ' / ' . $category->alias, 'class' => 'folder weblink');
}
break;
// Get all links in the category
// Get all links in the category
case 'category':
require_once JPATH_SITE . DS . 'includes' . DS . 'application.php';
require_once JPATH_SITE . DS . 'components' . DS . 'com_weblinks' . DS . 'helpers' . DS . 'route.php';
$weblinks = AdvlinkWeblinks::_weblinks($args->id);
foreach ($weblinks as $weblink) {
$items[] = array('id' => WeblinksHelperRoute::getWeblinkRoute($weblink->id, $args->id), 'name' => $weblink->title . ' / ' . $weblink->alias, 'class' => 'file');
}
break;
}
return $items;
}
开发者ID:rubencamargogomez,项目名称:custom_properties,代码行数:26,代码来源:weblinks.php
示例4: display
function display($tpl = null)
{
$app = JFactory::getApplication();
$document = JFactory::getDocument();
$document->link = JRoute::_(WeblinksHelperRoute::getCategoryRoute(JRequest::getVar('id', null, '', 'int')));
JRequest::setVar('limit', $app->getCfg('feed_limit'));
$siteEmail = $app->getCfg('mailfrom');
$fromName = $app->getCfg('fromname');
$document->editor = $fromName;
$document->editorEmail = $siteEmail;
// Get some data from the model
$items = $this->get('Items');
$category = $this->get('Category');
foreach ($items as $item) {
// strip html from feed item title
$title = $this->escape($item->title);
$title = html_entity_decode($title, ENT_COMPAT, 'UTF-8');
// url link to article
$link = JRoute::_(WeblinksHelperRoute::getWeblinkRoute($item->slug, $item->catid));
// strip html from feed item description text
$description = $item->description;
$date = $item->date ? date('r', strtotime($item->date)) : '';
// load individual item creator class
$feeditem = new JFeedItem();
$feeditem->title = $title;
$feeditem->link = $link;
$feeditem->description = $description;
$feeditem->date = $date;
$feeditem->category = 'Weblinks';
// loads item info into rss array
$document->addItem($feeditem);
}
}
开发者ID:exntu,项目名称:joomla-cms,代码行数:33,代码来源:view.feed.php
示例5: getWeblinkRoute
function getWeblinkRoute($id, $catid)
{
$needles = array('category' => (int) $catid, 'categories' => null);
$itemid = WeblinksHelperRoute::_findItem($needles);
$itemid = $itemid ? '&Itemid=' . $itemid : '';
$link = 'index.php?option=com_weblinks&view=weblink&id=' . $id . '&catid=' . $catid . $itemid;
return $link;
}
开发者ID:JSWebdesign,项目名称:intranet-platform,代码行数:8,代码来源:route.php
示例6: display
function display($tpl = null)
{
$app = JFactory::getApplication();
$document = JFactory::getDocument();
$document->link = JRoute::_(WeblinksHelperRoute::getCategoryRoute(JRequest::getVar('id', null, '', 'int')));
JRequest::setVar('limit', $app->getCfg('feed_limit'));
$params = $app->getParams();
$siteEmail = $app->getCfg('mailfrom');
$fromName = $app->getCfg('fromname');
$feedEmail = $app->getCfg('feed_email', 'author');
$document->editor = $fromName;
if ($feedEmail != "none") {
$document->editorEmail = $siteEmail;
}
// Get some data from the model
$items = $this->get('Items');
$category = $this->get('Category');
foreach ($items as $item) {
// strip html from feed item title
$title = $this->escape($item->title);
$title = html_entity_decode($title, ENT_COMPAT, 'UTF-8');
// url link to article
$link = JRoute::_(WeblinksHelperRoute::getWeblinkRoute($item->id, $item->catid));
// strip html from feed item description text
$description = $item->description;
$author = $item->created_by_alias ? $item->created_by_alias : $item->author;
$date = $item->date ? date('r', strtotime($item->date)) : '';
// load individual item creator class
$feeditem = new JFeedItem();
$feeditem->title = $title;
$feeditem->link = $link;
$feeditem->description = $description;
$feeditem->date = $date;
$feeditem->category = $category->title;
$feeditem->author = $author;
// We don't have the author email so we have to use site in both cases.
if ($feedEmail == 'site') {
$feeditem->authorEmail = $siteEmail;
} elseif ($feedEmail === 'author') {
$feeditem->authorEmail = $item->author_email;
}
// loads item info into rss array
$document->addItem($feeditem);
}
}
开发者ID:christianesperar,项目名称:joomla-example,代码行数:45,代码来源:view.feed.php
示例7: getCategoryRoute
public static function getCategoryRoute($catid)
{
jimport('joomla.application.categories');
$categoryTree = JCategories::getInstance('com_weblinks');
$category = $categoryTree->get($catid);
$catids = array();
$catids[] = $category->id;
while ($category->getParent() instanceof JCategoryNode) {
$category = $category->getParent();
$catids[] = $category->id;
}
$catids = array_reverse($catids);
$needles = array('category' => $catids);
$category = $categoryTree->get($catid);
//Create the link
$link = 'index.php?option=com_weblinks&view=category&id=' . $category->slug;
if ($item = WeblinksHelperRoute::_findItem($needles)) {
if (isset($item->query['layout'])) {
$link .= '&layout=' . $item->query['layout'];
}
$link .= '&Itemid=' . $item->id;
}
return $link;
}
开发者ID:joebushi,项目名称:joomla,代码行数:24,代码来源:route.php
示例8: defined
defined('_JEXEC') or die;
?>
<?php
if (count($this->children[$this->category->id]) > 0 && $this->maxLevel != 0) {
?>
<ul>
<?php
foreach ($this->children[$this->category->id] as $id => $child) {
?>
<?php
if ($this->params->get('show_empty_categories') || $child->numitems || count($child->getChildren())) {
?>
<li>
<a href="<?php
echo JRoute::_(WeblinksHelperRoute::getCategoryRoute($child->id));
?>
"><?php
echo $this->escape($child->title);
?>
</a>
<?php
if ($this->params->get('show_cat_items') == 1) {
?>
<small>(<?php
echo $child->numitems;
?>
)</small>
<?php
}
开发者ID:NavaINT1876,项目名称:ccustoms,代码行数:31,代码来源:default_children.php
示例9:
<?php
if ($this->params->get('show_empty_categories_cat') || $item->numitems || count($item->getChildren())) {
if (!isset($this->items[$this->parent->id][$id + 1])) {
$class = ' class="last"';
}
?>
<div <?php
echo $class;
?>
>
<?php
$class = '';
?>
<h3 class="page-header item-title">
<a href="<?php
echo JRoute::_(WeblinksHelperRoute::getCategoryRoute($item->id));
?>
">
<?php
echo $this->escape($item->title);
?>
</a>
<?php
if ($this->params->get('show_cat_num_articles_cat') == 1) {
?>
<span class="badge badge-info tip hasTooltip" title="<?php
echo JHtml::tooltipText('COM_WEBLINKS_NUM_ITEMS');
?>
">
<?php
echo $item->numitems;
开发者ID:shoffmann52,项目名称:install-from-web-server,代码行数:31,代码来源:default_items.php
示例10: getlinks
/**
* @param XmapDisplayerInterface $xmap
* @param stdClass $parent
* @param array $params
* @param int $catid
*/
private static function getlinks($xmap, stdClass $parent, array &$params, $catid)
{
self::getCategoryTree($xmap, $parent, $params, $catid);
if (!$params['include_links']) {
return;
}
$db = JFactory::getDbo();
$now = JFactory::getDate('now', 'UTC')->toSql();
$query = $db->getQuery(true)->select(array('w.id', 'w.alias', 'w.title'))->from('#__weblinks AS w')->where('w.catid = ' . $db->Quote($catid))->where('w.state = 1')->where('(w.publish_up = ' . $db->quote($db->getNullDate()) . ' OR w.publish_up <= ' . $db->quote($now) . ')')->where('(w.publish_down = ' . $db->quote($db->getNullDate()) . ' OR w.publish_down >= ' . $db->quote($now) . ')')->order('w.ordering');
if (!$params['show_unauth']) {
$query->where('w.access IN(' . $params['groups'] . ')');
}
if ($params['language_filter']) {
$query->where('w.language IN(' . $db->quote(JFactory::getLanguage()->getTag()) . ', ' . $db->quote('*') . ')');
}
$db->setQuery($query);
$rows = $db->loadObjectList();
if (empty($rows)) {
return;
}
$xmap->changeLevel(1);
foreach ($rows as $row) {
$node = new stdclass();
$node->id = $parent->id;
$node->name = $row->title;
$node->uid = $parent->uid . '_' . $row->id;
$node->browserNav = $parent->browserNav;
$node->priority = $params['link_priority'];
$node->changefreq = $params['link_changefreq'];
$node->link = WeblinksHelperRoute::getWeblinkRoute($row->id . ':' . $row->alias, $catid);
$xmap->printNode($node);
}
$xmap->changeLevel(-1);
}
开发者ID:b2un0,项目名称:joomla-plugin-xmap-weblinks,代码行数:40,代码来源:com_weblinks.php
示例11: foreach
JHtml::_('bootstrap.tooltip');
if (count($this->items[$this->parent->id]) > 0 && $this->maxLevelcat != 0) :
?>
<?php foreach($this->items[$this->parent->id] as $id => $item) : ?>
<?php
if ($this->params->get('show_empty_categories_cat') || $item->numitems || count($item->getChildren())) :
if (!isset($this->items[$this->parent->id][$id + 1]))
{
$class = ' class="last"';
}
?>
<div <?php echo $class; ?> >
<?php $class = ''; ?>
<h3 class="page-header item-title">
<a href="<?php echo JRoute::_(WeblinksHelperRoute::getCategoryRoute($item->id));?>">
<?php echo $this->escape($item->title); ?></a>
<?php if ($this->params->get('show_cat_num_articles_cat') == 1) :?>
<span class="badge badge-info tip hasTooltip" title="<?php echo JText::_('COM_WEBLINKS_NUM_ITEMS'); ?>">
<?php echo $item->numitems; ?>
</span>
<?php endif; ?>
<?php if (count($item->getChildren()) > 0) : ?>
<a href="#category-<?php echo $item->id;?>" data-toggle="collapse" data-toggle="button" class="btn btn-mini pull-right"><span class="icon-plus"></span></a>
<?php endif;?>
</h3>
<?php if ($this->params->get('show_subcat_desc_cat') == 1) :?>
<?php if ($item->description) : ?>
<div class="category-desc">
<?php echo JHtml::_('content.prepare', $item->description, '', 'com_weblinks.categories'); ?>
</div>
开发者ID:GitIPFire,项目名称:Homeworks,代码行数:31,代码来源:default_items.php
示例12: getLinks
public function getLinks($args)
{
$wf = WFEditorPlugin::getInstance();
$items = array();
switch ($args->view) {
// Get all WebLink categories
default:
case 'categories':
$categories = WFLinkBrowser::getCategory('com_weblinks');
foreach ($categories as $category) {
if (method_exists('WeblinksHelperRoute', 'getCategoryRoute')) {
$id = WeblinksHelperRoute::getCategoryRoute($category->id);
} else {
$itemid = WFLinkBrowser::getItemId('com_weblinks', array('categories' => null, 'category' => $category->id));
$id = 'index.php?option=com_weblinks&view=category&id=' . $category->id . $itemid;
}
$items[] = array('id' => $id, 'name' => $category->title . ' / ' . $category->alias, 'class' => 'folder weblink');
}
break;
// Get all links in the category
// Get all links in the category
case 'category':
require_once JPATH_SITE . DS . 'includes' . DS . 'application.php';
require_once JPATH_SITE . DS . 'components' . DS . 'com_weblinks' . DS . 'helpers' . DS . 'route.php';
if (!WF_JOOMLA15) {
$categories = WFLinkBrowser::getCategory('com_weblinks', $args->id);
if (count($categories)) {
foreach ($categories as $category) {
$children = WFLinkBrowser::getCategory('com_weblinks', $category->id);
if ($children) {
$id = 'index.php?option=com_weblinks&view=category&id=' . $category->id;
} else {
if (method_exists('WeblinksHelperRoute', 'getCategoryRoute')) {
$id = WeblinksHelperRoute::getCategoryRoute($category->id);
} else {
$itemid = WFLinkBrowser::getItemId('com_weblinks', array('categories' => null, 'category' => $category->id));
$id = 'index.php?option=com_weblinks&view=category&id=' . $category->id . $itemid;
}
}
$items[] = array('id' => $id, 'name' => $category->title . ' / ' . $category->alias, 'class' => 'folder weblink');
}
}
}
$weblinks = self::_weblinks($args->id);
foreach ($weblinks as $weblink) {
$items[] = array('id' => WeblinksHelperRoute::getWeblinkRoute($weblink->slug, $weblink->catslug), 'name' => $weblink->title . ' / ' . $weblink->alias, 'class' => 'file');
}
break;
}
return $items;
}
开发者ID:romuland,项目名称:khparts,代码行数:51,代码来源:weblinks.php
示例13: getCategoryTree
static function getCategoryTree($xmap, $parent, &$params, $category)
{
$db = JFactory::getDBO();
$children = $category->getChildren();
$xmap->changeLevel(1);
foreach ($children as $cat) {
$node = new stdclass();
$node->id = $parent->id;
$node->uid = $parent->uid . 'c' . $cat->id;
$node->name = $cat->title;
$node->link = WeblinksHelperRoute::getCategoryRoute($cat);
$node->priority = $params['cat_priority'];
$node->changefreq = $params['cat_changefreq'];
$node->expandible = true;
if ($xmap->printNode($node) !== FALSE) {
xmap_com_weblinks::getCategoryTree($xmap, $parent, $params, $cat);
}
}
$xmap->changeLevel(-1);
if ($params['include_links']) {
//view=category&catid=...
$linksModel = new WeblinksModelCategory();
$linksModel->getState();
// To force the populate state
$linksModel->setState('list.limit', JArrayHelper::getValue($params, 'max_links', NULL));
$linksModel->setState('list.start', 0);
$linksModel->setState('list.ordering', 'ordering');
$linksModel->setState('list.direction', 'ASC');
$linksModel->setState('category.id', $category->id);
$links = $linksModel->getItems();
$xmap->changeLevel(1);
foreach ($links as $link) {
$item_params = new JRegistry();
$item_params->loadString($link->params);
$node = new stdclass();
$node->id = $parent->id;
$node->uid = $parent->uid . 'i' . $link->id;
$node->name = $link->title;
// Find the Itemid
$Itemid = intval(preg_replace('/.*Itemid=([0-9]+).*/', '$1', WeblinksHelperRoute::getWeblinkRoute($link->id, $category->id)));
if ($item_params->get('count_clicks', $params['count_clicks']) == 1) {
$node->link = 'index.php?option=com_weblinks&task=weblink.go&id=' . $link->id . '&Itemid=' . ($Itemid ? $Itemid : $parent->id);
} else {
$node->link = $link->url;
}
$node->priority = $params['link_priority'];
$node->changefreq = $params['link_changefreq'];
$node->expandible = false;
$xmap->printNode($node);
}
$xmap->changeLevel(-1);
}
}
开发者ID:01J,项目名称:topm,代码行数:53,代码来源:com_weblinks.php
示例14: defined
<?php
defined('_JEXEC') or die;
?>
<?php if (count($this->items[$this->parent->id]) > 0 && $this->maxLevelcat != 0) : ?>
<ul>
<?php foreach($this->items[$this->parent->id] as $id => $item) : ?>
<?php if ($this->params->get('show_empty_categories_cat') || $item->numitems || count($item->getChildren())) : ?>
<li>
<a href="<?php echo JRoute::_(WeblinksHelperRoute::getCategoryRoute($item->id));?>"><?php echo $this->escape($item->title); ?></a>
<?php if ($this->params->get('show_cat_items_cat') == 1) : ?>
<small>(<?php echo $item->numitems; ?>)</small>
<?php endif; ?>
<?php if (($this->params->get('show_subcat_desc_cat') == 1) && $item->description) : ?>
<div><?php echo JHtml::_('content.prepare', $item->description, '', 'com_weblinks.categories'); ?></div>
<?php endif; ?>
<?php
if (count($item->getChildren()) > 0) {
$this->items[$item->id] = $item->getChildren();
$this->parent = $item;
$this->maxLevelcat--;
echo $this->loadTemplate('items');
$this->parent = $item->getParent();
$this->maxLevelcat++;
}
?>
</li>
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:31,代码来源:default_items.php
示例15: plgSearchJFWeblinks
/**
* Weblink Search method
*
* The sql must return the following fields that are used in a common display
* routine: href, title, section, created, text, browsernav
* @param string Target search string
* @param string mathcing option, exact|any|all
* @param string ordering option, newest|oldest|popular|alpha|category
* @param mixed An array if the search it to be restricted to areas, null if search all
*/
function plgSearchJFWeblinks($text, $phrase = '', $ordering = '', $areas = null)
{
$db =& JFactory::getDBO();
$user =& JFactory::getUser();
$registry =& JFactory::getConfig();
$lang = $registry->getValue("config.jflang");
require_once JPATH_SITE . DS . 'components' . DS . 'com_weblinks' . DS . 'helpers' . DS . 'route.php';
if (is_array($areas)) {
if (!array_intersect($areas, array_keys(plgSearchWeblinksAreas()))) {
return array();
}
}
// load plugin params info
$plugin =& JPluginHelper::getPlugin('search', 'jfweblinks');
$pluginParams = new JParameter($plugin->params);
$limit = $pluginParams->def('search_limit', 50);
$activeLang = $pluginParams->def('active_language_only', 0);
$text = trim($text);
if ($text == '') {
return array();
}
$section = JText::_('Web Links');
$wheres = array();
switch ($phrase) {
case 'exact':
$text = $db->Quote('%' . $db->getEscaped($text, true) . '%', false);
$where = "LOWER(jfc.value) LIKE " . $text;
break;
case 'all':
case 'any':
default:
$words = explode(' ', $text);
$wheres = array();
foreach ($words as $word) {
$word = $db->Quote('%' . $db->getEscaped($word, true) . '%', false);
$wheres[] = "LOWER(jfc.value) LIKE " . $word;
}
$where = '(' . implode($phrase == 'all' ? ') AND (' : ') OR (', $wheres) . ')';
break;
}
switch ($ordering) {
case 'oldest':
$order = 'a.date ASC';
break;
case 'popular':
$order = 'a.hits DESC';
break;
case 'alpha':
$order = 'a.title ASC';
break;
case 'category':
$order = 'b.title ASC, a.title ASC';
break;
case 'newest':
default:
$order = 'a.date DESC';
}
$query = 'SELECT a.id as wltid, b.id as catid, a.title AS title, a.description AS text, a.date AS created,' . ' CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(\':\', a.id, a.alias) ELSE a.id END as slug, ' . ' CASE WHEN CHAR_LENGTH(b.alias) THEN CONCAT_WS(\':\', b.id, b.alias) ELSE b.id END as catslug, ' . ' b.title as btitle, ' . ' "1" AS browsernav,' . ' jfl.code as jflang, jfl.name as jflname' . ' FROM #__weblinks AS a' . ' INNER JOIN #__categories AS b ON b.id = a.catid' . "\n LEFT JOIN #__jf_content as jfc ON reference_id = a.id" . "\n LEFT JOIN #__languages as jfl ON jfc.language_id = jfl.id" . ' WHERE (' . $where . ')' . ' AND a.published = 1' . ' AND b.published = 1' . ' AND b.access <= ' . (int) $user->get('aid') . "\n AND jfc.reference_table = 'weblinks'" . ($activeLang ? "\n AND jfl.code = '{$lang}'" : '') . ' GROUP BY a.id' . ' ORDER BY ' . $order;
$db->setQuery($query, 0, $limit);
$rows = $db->loadObjectList();
foreach ($rows as $key => $row) {
$rows[$key]->section = $db->Quote($section) . "/" . $row->btitle . " - " . $row->jflname;
$rows[$key]->href = WeblinksHelperRoute::getWeblinkRoute($row->slug, $row->catslug);
}
return $rows;
}
开发者ID:kaantunc,项目名称:MYK-BOR,代码行数:76,代码来源:jfweblinks.php
示例16: index
/**
* Method to index an item. The item must be a FinderIndexerResult object.
*
* @param FinderIndexerResult $item The item to index as an FinderIndexerResult object.
* @param string $format The item format
*
* @return void
*
* @since 2.5
* @throws Exception on database error.
*/
protected function index(FinderIndexerResult $item, $format = 'html')
{
// Check if the extension is enabled
if (JComponentHelper::isEnabled($this->extension) == false) {
return;
}
// Initialize the item parameters.
$registry = new JRegistry();
$registry->loadString($item->params);
$item->params = $registry;
$registry = new JRegistry();
$registry->loadString($item->metadata);
$item->metadata = $registry;
// Build the necessary route and path information.
$item->url = $this->getURL($item->id, $this->extension, $this->layout);
$item->route = WeblinksHelperRoute::getWeblinkRoute($item->slug, $item->catslug);
$item->path = FinderIndexerHelper::getContentPath($item->route);
/*
* Add the meta-data processing instructions based on the newsfeeds
* configuration parameters.
*/
// Add the meta-author.
$item->metaauthor = $item->metadata->get('author');
// Handle the link to the meta-data.
$item->addInstruction(FinderIndexer::META_CONTEXT, 'link');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'metakey');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'metadesc');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'metaauthor');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'author');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'created_by_alias');
// Add the type taxonomy data.
$item->addTaxonomy('Type', 'Web Link');
// Add the category taxonomy data.
$item->addTaxonomy('Category', $item->category, $item->cat_state, $item->cat_access);
// Add the language taxonomy data.
$item->addTaxonomy('Language', $item->language);
// Get content extras.
FinderIndexerHelper::getContentExtras($item);
// Index the item.
FinderIndexer::index($item);
}
开发者ID:vuchannguyen,项目名称:hoctap,代码行数:52,代码来源:weblinks.php
示例17: getCategoryTree
static function getCategoryTree($xmap, $parent, &$params, $category)
{
$db = JFactory::getDBO();
$children = $category->getChildren();
$xmap->changeLevel(1);
foreach ($children as $cat) {
$node = new stdclass();
$node->id = $parent->id;
$node->uid = $parent->uid . 'c' . $cat->id;
$node->name = $cat->title;
$node->link = WeblinksHelperRoute::getCategoryRoute($cat);
$node->priority = $params['cat_priority'];
$node->changefreq = $params['cat_changefreq'];
$node->expandible = true;
if ($xmap->printNode($node) !== FALSE) {
xmap_com_weblinks::getCategoryTree($xmap, $parent, $params, $cat);
}
}
$xmap->changeLevel(-1);
if ($params['include_links']) {
//view=category&catid=...
$linksModel = new WeblinksModelCategory();
$linksModel->getState();
// To force the populate state
$linksModel->setState('list.limit', JArrayHelper::getValue($params, 'max_links', NULL));
$linksModel->setState('list.start', 0);
$linksModel->setState('list.ordering', 'ordering');
$linksModel->setState('list.direction', 'ASC');
$linksModel->setState('category.id', $category->id);
$links = $linksModel->getItems();
$xmap->changeLevel(1);
foreach ($links as $link) {
$node = new stdclass();
$node->id = $parent->id;
$node->uid = $parent->uid . 'i' . $link->id;
$node->name = $link->title;
$node->link = WeblinksHelperRoute::getWeblinkRoute($link->id, $category->id);
$node->priority = $params['link_priority'];
$node->changefreq = $params['link_changefreq'];
$node->expandible = false;
$xmap->printNode($node);
}
$xmap->changeLevel(-1);
}
}
开发者ID:acculitx,项目名称:fleetmatrixsite,代码行数:45,代码来源:com_weblinks.php
示例18: onContentSearch
//.........这里部分代码省略.........
return array();
}
}
$sContent = $this->params->get('search_content', 1);
$sArchived = $this->params->get('search_archived', 1);
$limit = $this->params->def('search_limit', 50);
$state = array();
if ($sContent) {
$state[] = 1;
}
if ($sArchived) {
$state[] = 2;
}
if (empty($state)) {
return array();
}
$text = trim($text);
if ($text == '') {
return array();
}
$searchWeblinks = JText::_('PLG_SEARCH_WEBLINKS');
switch ($phrase) {
case 'exact':
$text = $db->quote('%' . $db->escape($text, true) . '%', false);
$wheres2 = array();
$wheres2[] = 'a.url LIKE ' . $text;
$wheres2[] = 'a.description LIKE ' . $text;
$wheres2[] = 'a.title LIKE ' . $text;
$where = '(' . implode(') OR (', $wheres2) . ')';
break;
case 'all':
case 'any':
default:
$words = explode(' ', $text);
$wheres = array();
foreach ($words as $word) {
$word = $db->quote('%' . $db->escape($word, true) . '%', false);
$wheres2 = array();
$wheres2[] = 'a.url LIKE ' . $word;
$wheres2[] = 'a.description LIKE ' . $word;
$wheres2[] = 'a.title LIKE ' . $word;
$wheres[] = implode(' OR ', $wheres2);
}
$where = '(' . implode($phrase == 'all' ? ') AND (' : ') OR (', $wheres) . ')';
break;
}
switch ($ordering) {
case 'oldest':
$order = 'a.created ASC';
break;
case 'popular':
$order = 'a.hits DESC';
break;
case 'alpha':
$order = 'a.title ASC';
break;
case 'category':
$order = 'c.title ASC, a.title ASC';
break;
case 'newest':
default:
$order = 'a.created DESC';
}
$query = $db->getQuery(true);
// SQLSRV changes.
$case_when = ' CASE WHEN ';
$case_when .= $query->charLength('a.alias', '!=', '0');
$case_when .= ' THEN ';
$a_id = $query->castAsChar('a.id');
$case_when .= $query->concatenate(array($a_id, 'a.alias'), ':');
$case_when .= ' ELSE ';
$case_when .= $a_id . ' END as slug';
$case_when1 = ' CASE WHEN ';
$case_when1 .= $query->charLength('c.alias', '!=', '0');
$case_when1 .= ' THEN ';
$c_id = $query->castAsChar('c.id');
$case_when1 .= $query->concatenate(array($c_id, 'c.alias'), ':');
$case_when1 .= ' ELSE ';
$case_when1 .= $c_id . ' END as catslug';
$query->select('a.title AS title, \'\' AS created, a.url, a.description AS text, ' . $case_when . "," . $case_when1)->select($query->concatenate(array($db->quote($searchWeblinks), 'c.title'), " / ") . ' AS section')->select('\'1\' AS browsernav')->from('#__weblinks AS a')->join('INNER', '#__categories as c ON c.id = a.catid')->where('(' . $where . ') AND a.state IN (' . implode(',', $state) . ') AND c.published = 1 AND c.access IN (' . $groups . ')')->order($order);
// Filter by language.
if ($app->isSite() && JLanguageMultilang::isEnabled()) {
$tag = JFactory::getLanguage()->getTag();
$query->where('a.language in (' . $db->quote($tag) . ',' . $db->quote('*') . ')')->where('c.language in (' . $db->quote($tag) . ',' . $db->quote('*') . ')');
}
$db->setQuery($query, 0, $limit);
$rows = $db->loadObjectList();
$return = array();
if ($rows) {
foreach ($rows as $key => $row) {
$rows[$key]->href = WeblinksHelperRoute::getWeblinkRoute($row->slug, $row->catslug);
}
foreach ($rows as $weblink) {
if (searchHelper::checkNoHTML($weblink, $searchText, array('url', 'text', 'title'))) {
$return[] = $weblink;
}
}
}
return $return;
}
开发者ID:01J,项目名称:topm,代码行数:101,代码来源:weblinks.php
示例19: plgSearchWeblinks
/**
* Weblink Search method
*
* The sql must return the following fields that are used in a common display
* routine: href, title, section, created, text, browsernav
* @param string Target search string
* @param string mathcing option, exact|any|all
* @param string ordering option, newest|oldest|popular|alpha|category
* @param mixed An array if the search it to be restricted to areas, null if search all
*/
function plgSearchWeblinks($text, $phrase = '', $ordering = '', $areas = null)
{
$db =& JFactory::getDBO();
$user =& JFactory::getUser();
require_once JPATH_SITE . DS . 'components' . DS . 'com_weblinks' . DS . 'helpers' . DS . 'route.php';
if (is_array($areas)) {
if (!array_intersect($areas, array_keys(plgSearchWeblinksAreas()))) {
return array();
}
}
// load plugin params info
$plugin =& JPluginHelper::getPlugin('search', 'weblinks');
$pluginParams = new JParameter($plugin->params);
$limit = $pluginParams->def('search_limit', 50);
$text = trim($text);
if ($text == '') {
return array();
}
$section = JText::_('Web Links');
$wheres = array();
switch ($phrase) {
case 'exact':
$text = $db->Quote('%' . $db->getEscaped($text, true) . '%', false);
$wheres2 = array();
$wheres2[] = 'LOWER(a.url) LIKE ' . $text;
$wheres2[] = 'LOWER(a.description) LIKE ' . $text;
$wheres2[] = 'LOWER(a.title) LIKE ' . $text;
$where = '(' . implode(') OR (', $wheres2) . ')';
break;
case 'all':
case 'any':
default:
$words = explode(' ', $text);
$wheres = array();
foreach ($words as $word) {
$word = $db->Quote('%' . $db->getEscaped($word, true) . '%', false);
$wheres2 = array();
$wheres2[] = 'LOWER(a.url) LIKE ' . $word;
$wheres2[] = 'LOWER(a.description) LIKE ' . $word;
$wheres2[] = 'LOWER(a.title) LIKE ' . $word;
$wheres[] = implode(' OR ', $wheres2);
}
$where = '(' . implode($phrase == 'all' ? ') AND (' : ') OR (', $wheres) . ')';
break;
}
switch ($ordering) {
case 'oldest':
$order = 'a.date ASC';
break;
case 'popular':
$order = 'a.hits DESC';
break;
case 'alpha':
$order = 'a.title ASC';
break;
case 'category':
$order = 'b.title ASC, a.title ASC';
break;
case 'newest':
default:
$order = 'a.date DESC';
}
$query = 'SELECT a.title AS title, a.description AS text, a.date AS created,' . ' CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(\':\', a.id, a.alias) ELSE a.id END as slug, ' . ' CASE WHEN CHAR_LENGTH(b.alias) THEN CONCAT_WS(\':\', b.id, b.alias) ELSE b.id END as catslug, ' . ' CONCAT_WS( " / ", ' . $db->Quote($section) . ', b.title ) AS section,' . ' "1" AS browsernav' . ' FROM #__weblinks AS a' . ' INNER JOIN #__categories AS b ON b.id = a.catid' . ' WHERE (' . $where . ')' . ' AND a.published = 1' . ' AND b.published = 1' . ' AND b.access <= ' . (int) $user->get('aid') . ' ORDER BY ' . $order;
$db->setQuery($query, 0, $limit);
$rows = $db->loadObjectList();
foreach ($rows as $key => $row) {
$rows[$key]->href = WeblinksHelperRoute::getWeblinkRoute($row->slug, $row->catslug);
}
return $rows;
}
开发者ID:Fellah,项目名称:govnobaki,代码行数:80,代码来源:weblinks.php
|
请发表评论