本文整理汇总了PHP中WeblinksHelperRoute类的典型用法代码示例。如果您正苦于以下问题:PHP WeblinksHelperRoute类的具体用法?PHP WeblinksHelperRoute怎么用?PHP WeblinksHelperRoute使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WeblinksHelperRoute类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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();
}
示例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;
}
示例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);
}
}
示例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;
}
示例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);
}
}
示例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;
}
示例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
}
示例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;
示例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);
}
示例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>
示例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;
}
示例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);
}
}
示例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>
示例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;
}