本文整理汇总了PHP中DiscussRouter::getItemId方法的典型用法代码示例。如果您正苦于以下问题:PHP DiscussRouter::getItemId方法的具体用法?PHP DiscussRouter::getItemId怎么用?PHP DiscussRouter::getItemId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DiscussRouter
的用法示例。
在下文中一共展示了DiscussRouter::getItemId方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getReturnURL
public static function getReturnURL($params, $isLogged = false)
{
$type = empty($isLogged) ? 'login' : 'logout';
if ($itemid = $params->get($type)) {
$menu = JFactory::getApplication()->getMenu();
$item = $menu->getItem($itemid);
if ($item) {
$url = JRoute::_($item->link . '&Itemid=' . $itemid, false);
} else {
// stay on the same page
$uri = JFactory::getURI();
$url = $uri->toString(array('path', 'query', 'fragment'));
}
} else {
// Proceeed to the front page of EasyDiscuss.
$itemid = DiscussRouter::getItemId();
$url = JRoute::_('index.php?option=com_easydiscuss&Itemid=' . $itemid, false);
}
return base64_encode($url);
}
示例2: EasyDiscussBuildRoute
//.........这里部分代码省略.........
unset($query['view']);
if (isset($query['category_id'])) {
$aliases = DiscussRouter::getCategoryAliases($query['category_id']);
foreach ($aliases as $alias) {
$segments[] = $alias;
}
unset($query['category_id']);
}
break;
case 'ask':
$segments[] = $query['view'];
unset($query['view']);
if (isset($query['category'])) {
$aliases = DiscussRouter::getCategoryAliases($query['category']);
foreach ($aliases as $alias) {
$segments[] = $alias;
}
unset($query['category']);
}
break;
case 'points':
$segments[] = $query['view'];
unset($query['view']);
$segments[] = $query['layout'];
unset($query['layout']);
$segments[] = DiscussRouter::getUserAlias($query['id']);
unset($query['id']);
break;
case 'tags':
$segments[] = $query['view'];
unset($query['view']);
if (isset($query['id'])) {
$segments[] = DiscussRouter::getTagAlias($query['id']);
unset($query['id']);
}
break;
case 'users':
$segments[] = $query['view'];
unset($query['view']);
if (isset($query['sorting'])) {
$segments[] = 'latest';
unset($query['sorting']);
}
break;
case 'badges':
$segments[] = $query['view'];
unset($query['view']);
if (isset($query['id'])) {
$segments[] = DiscussRouter::getAlias('badges', $query['id']);
unset($query['id']);
unset($query['layout']);
}
if (isset($query['layout'])) {
$segments[] = $query['layout'];
unset($query['layout']);
}
break;
case 'favourites':
// We don't want to include the view for the entry links.
$segments[] = $query['view'];
unset($query['view']);
break;
case 'categories':
$segments[] = $query['view'];
unset($query['view']);
if (isset($query['layout'])) {
$segments[] = $query['layout'];
unset($query['layout']);
}
if (isset($query['category_id'])) {
$segments[] = DiscussRouter::getAlias('category', $query['category_id']);
unset($query['category_id']);
}
break;
case 'conversation':
$segments[] = $query['view'];
unset($query['view']);
if (isset($query['layout'])) {
$segments[] = $query['layout'];
unset($query['layout']);
}
break;
default:
$segments[] = $query['view'];
unset($query['view']);
}
}
if (isset($query['filter'])) {
$segments[] = $query['filter'];
unset($query['filter']);
}
if (isset($query['sort'])) {
$segments[] = $query['sort'];
unset($query['sort']);
}
if (!isset($query['Itemid'])) {
$query['Itemid'] = DiscussRouter::getItemId();
}
return $segments;
}
示例3:
<div class=" discuss-searchbar--input">
<form name="discuss-search" method="GET" action="<?php
echo DiscussRouter::_('index.php?option=com_easydiscuss&view=search');
?>
">
<input type="text" class="input-searchbar" placeholder="<?php
echo JText::_('COM_EASYDISCUSS_SEARCH_PLACEHOLDER');
?>
" name="query" value="<?php
echo DiscussHelper::getHelper('String')->escape($query) ? DiscussHelper::getHelper('String')->escape($query) : '';
?>
" />
<input type="hidden" name="option" value="com_easydiscuss" />
<input type="hidden" name="view" value="search" />
<input type="hidden" name="Itemid" value="<?php
echo DiscussRouter::getItemId('search');
?>
" />
<button class="btn btn-searchbar"><?php
echo JText::_('COM_EASYDISCUSS_SEARCH_BUTTON');
?>
</button>
</form>
</div>
</div>
</div>
</div>
<?php
示例4: defined
<?php
/**
* @package EasyDiscuss
* @copyright Copyright (C) 2010 Stack Ideas Private Limited. All rights reserved.
* @license GNU/GPL, see LICENSE.php
*
* EasyDiscuss is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/
// no direct access
defined('_JEXEC') or die('Restricted access');
require_once JPATH_ROOT . '/components/com_easydiscuss/helpers/helper.php';
require_once DISCUSS_HELPERS . '/string.php';
require_once dirname(__FILE__) . '/helper.php';
$lang = JFactory::getLanguage();
$lang->load('mod_easydiscuss_most_voted', JPATH_ROOT);
$posts = modMostVotedHelper::getData($params);
$itemid = DiscussRouter::getItemId('post');
$document = JFactory::getDocument();
DiscussHelper::loadStylesheet("module", "mod_easydiscuss_most_voted");
require JModuleHelper::getLayoutPath('mod_easydiscuss_most_voted');
示例5: _getMenuItemId
public static function _getMenuItemId(&$params)
{
$itemid = DiscussRouter::getItemId('categories');
return $itemid;
}
示例6: shAddToGETVarsList
case 'categories':
$permalink = DiscussRouter::getAlias('category', $id);
break;
case 'post':
$permalink = DiscussRouter::getAlias('posts', $id);
break;
case 'profile':
$permalink = DiscussRouter::getUserAlias($id);
break;
case 'tags':
$permalink = DiscussRouter::getAlias('tags', $id);
break;
}
}
if (empty($Itemid)) {
$Itemid = DiscussRouter::getItemId($view);
shAddToGETVarsList('Itemid', $Itemid);
}
$name = shGetComponentPrefix($option);
$name = empty($name) ? getMenuTitle($option, $task, $Itemid, null, $shLangName) : $name;
$name = empty($name) || $name == '/' ? 'discuss' : $name;
$title[] = $name;
if (isset($view) && !empty($view)) {
// Translate the view
$title[] = JText::_('COM_EASYDISCUSS_SH404_VIEW_' . JString::strtoupper($view));
shRemoveFromGETVarsList('view');
}
if ($view == 'categories' && !empty($category_id)) {
$title[] = DiscussRouter::getAlias('category', $category_id);
shRemoveFromGETVarsList('category_id');
// Remove the view since we don't want to set the view.
示例7: _
public static function _($url, $xhtml = true, $ssl = null)
{
static $eUri = array();
static $loaded = array();
// to test if the Itemid is there or not.
$jURL = $url . $xhtml;
$index = $url . $xhtml;
if (isset($loaded[$index])) {
return $loaded[$index];
}
// convert the string to variable so that we can access it.
parse_str(parse_url($url, PHP_URL_QUERY));
if (!empty($Itemid)) {
$loaded[$index] = JRoute::_($url, $xhtml, $ssl);
return $loaded[$index];
}
$tmpId = '';
$config = DiscussHelper::getConfig();
$routingBehavior = $config->get('main_routing', 'currentactive');
$mainframe = JFactory::getApplication();
$dropSegment = false;
if (empty($view)) {
$view = 'index';
}
if ($routingBehavior == 'currentactive' || $routingBehavior == 'menuitem') {
$routingMenuItem = $config->get('main_routing_itemid', '');
if ($routingBehavior == 'menuitem' && $routingMenuItem != '') {
$tmpId = $routingMenuItem;
}
// @rule: If there is already an item id, try to use the explicitly set one.
if (empty($tmpId)) {
if (!$mainframe->isAdmin()) {
// Retrieve the active menu item.
$menu = JFactory::getApplication()->getMenu();
$item = $menu->getActive();
if (isset($item->id)) {
$tmpId = $item->id;
}
}
}
} else {
// let easydiscuss to determine the best menu itemid.
switch ($view) {
case 'list':
case 'categories':
if (isset($category_id)) {
$tmpId = self::getItemIdByCategories($category_id);
} else {
$tmpId = self::getItemId('categories', '', true);
}
if (!empty($tmpId)) {
$dropSegment = true;
}
break;
case 'users':
$tmpId = self::getItemId('users', '', true);
if (!empty($tmpId)) {
$dropSegment = true;
}
break;
case 'tags':
if (isset($id)) {
$tmpId = self::getItemIdByTags($id);
} else {
$tmpId = self::getItemId('tags', '', true);
}
if (!empty($tmpId)) {
$dropSegment = true;
}
break;
case 'post':
$postId = $id;
if (!empty($postId)) {
$tbl = DiscussHelper::getTable('Post');
$tbl->load($postId);
$tmpId = self::getItemIdByDiscussion($tbl->id);
// we try to get the menu item base on category id
if (empty($tmpId)) {
$tmpId = self::getItemIdByCategories($tbl->category_id);
}
}
break;
}
}
if (empty($tmpId)) {
// make compatible with version 1.1.x where new question will be view=post&layout=submit
if ($view == 'post') {
$tmpId = !empty($layout) ? DiscussRouter::getItemId($view, $layout) : DiscussRouter::getItemId($view);
} else {
$tmpId = DiscussRouter::getItemId($view);
}
}
if (!empty($tmpId)) {
if (self::isSefEnabled() && $dropSegment) {
$url = 'index.php?Itemid=' . $tmpId;
$loaded[$index] = JRoute::_($url, $xhtml, $ssl);
return $loaded[$index];
}
}
//check if there is any anchor in the link or not.
//.........这里部分代码省略.........