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


PHP WeblinksHelperRoute::getWeblinkRoute方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: onContentSearch

 /**
  * 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 onContentSearch($text, $phrase = '', $ordering = '', $areas = null)
 {
     $db = JFactory::getDbo();
     $app = JFactory::getApplication();
     $user = JFactory::getUser();
     $groups = implode(',', $user->getAuthorisedViewLevels());
     $searchText = $text;
     if (is_array($areas)) {
         if (!array_intersect($areas, array_keys($this->onContentSearchAreas()))) {
             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;
     }
     $text = trim($text);
     if ($text == '') {
         return array();
     }
     $section = JText::_('PLG_SEARCH_WEBLINKS');
     $wheres = array();
     switch ($phrase) {
         case 'exact':
             $text = $db->Quote('%' . $db->getEscaped($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->getEscaped($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';
     }
     $return = array();
     if (!empty($state)) {
         $query = $db->getQuery(true);
         $query->select('a.title AS title, a.description AS text, a.created AS created, a.url, ' . 'CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(\':\', a.id, a.alias) ELSE a.id END as slug, ' . 'CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(\':\', c.id, c.alias) ELSE c.id END as catslug, ' . 'CONCAT_WS(" / ", ' . $db->Quote($section) . ', c.title) AS section, "1" AS browsernav');
         $query->from('#__weblinks AS a');
         $query->innerJoin('#__categories AS c ON c.id = a.catid');
         $query->where('(' . $where . ')' . ' AND a.state in (' . implode(',', $state) . ') AND  c.published=1 AND  c.access IN (' . $groups . ')');
         $query->order($order);
         // Filter by language
         if ($app->isSite() && $app->getLanguageFilter()) {
             $tag = JFactory::getLanguage()->getTag();
             $query->where('a.language in (' . $db->Quote($tag) . ',' . $db->Quote('*') . ')');
             $query->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);
//.........这里部分代码省略.........
开发者ID:reechalee,项目名称:joomla1.6,代码行数:101,代码来源:weblinks.php

示例5: 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

示例6: 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

示例7: getLinks

 public function getLinks($args)
 {
     $wf = WFEditorPlugin::getInstance();
     $items = array();
     require_once JPATH_SITE . '/includes/application.php';
     require_once JPATH_SITE . '/components/com_weblinks/helpers/route.php';
     switch ($args->view) {
         // Get all WebLink categories
         default:
         case 'categories':
             $categories = WFLinkBrowser::getCategory('com_weblinks');
             foreach ($categories as $category) {
                 $url = '';
                 $itemid = WFLinkBrowser::getItemId('com_weblinks', array('categories' => null, 'category' => $category->id));
                 if (method_exists('WeblinksHelperRoute', 'getCategoryRoute')) {
                     $id = WeblinksHelperRoute::getCategoryRoute($category->id);
                     if (strpos($id, 'index.php?Itemid=') !== false) {
                         $url = $id;
                         $id = 'index.php?option=com_weblinks&view=category&id=' . $category->id;
                     }
                 } else {
                     $id = 'index.php?option=com_weblinks&view=category&id=' . $category->id . $itemid;
                 }
                 $items[] = array('url' => $url, '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':
             if (defined('JPATH_PLATFORM')) {
                 $categories = WFLinkBrowser::getCategory('com_weblinks', $args->id);
                 if (count($categories)) {
                     foreach ($categories as $category) {
                         $children = WFLinkBrowser::getCategory('com_weblinks', $category->id);
                         $url = '';
                         if ($children) {
                             $id = 'index.php?option=com_weblinks&view=category&id=' . $category->id;
                         } else {
                             $itemid = WFLinkBrowser::getItemId('com_weblinks', array('categories' => null, 'category' => $category->id));
                             if (method_exists('WeblinksHelperRoute', 'getCategoryRoute')) {
                                 $id = WeblinksHelperRoute::getCategoryRoute($category->id);
                                 if (strpos($id, 'index.php?Itemid=') !== false) {
                                     $url = $id;
                                     $id = 'index.php?option=com_weblinks&view=category&id=' . $category->id;
                                 }
                             } else {
                                 $id = 'index.php?option=com_weblinks&view=category&id=' . $category->id . $itemid;
                             }
                         }
                         $items[] = array('url' => $url, 'id' => $id, 'name' => $category->title . ' / ' . $category->alias, 'class' => 'folder weblink');
                     }
                 }
             }
             $weblinks = self::_weblinks($args->id);
             foreach ($weblinks as $weblink) {
                 $id = WeblinksHelperRoute::getWeblinkRoute($weblink->slug, $weblink->catslug);
                 if (defined('JPATH_PLATFORM')) {
                     $id .= '&task=weblink.go';
                 }
                 $items[] = array('id' => $id, 'name' => $weblink->title . ' / ' . $weblink->alias, 'class' => 'file');
             }
             break;
     }
     return $items;
 }
开发者ID:greyhat777,项目名称:vuslinterliga,代码行数:65,代码来源:weblinks.php

示例8: 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

示例9: 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

示例10: 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

示例11: 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

示例12: 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

示例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


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