本文整理汇总了PHP中CrowdfundingHelperRoute::getProjectAlias方法的典型用法代码示例。如果您正苦于以下问题:PHP CrowdfundingHelperRoute::getProjectAlias方法的具体用法?PHP CrowdfundingHelperRoute::getProjectAlias怎么用?PHP CrowdfundingHelperRoute::getProjectAlias使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CrowdfundingHelperRoute
的用法示例。
在下文中一共展示了CrowdfundingHelperRoute::getProjectAlias方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CrowdfundingBuildRoute
/**
* Method to build Route
*
* @param array $query
*
* @return array
*/
function CrowdfundingBuildRoute(&$query)
{
$segments = array();
// get a menu item based on Itemid or currently active
$app = JFactory::getApplication();
$menu = $app->getMenu();
// we need a menu item. Either the one specified in the query, or the current active one if none specified
if (empty($query['Itemid'])) {
$menuItem = $menu->getActive();
$menuItemGiven = false;
} else {
$menuItem = $menu->getItem($query['Itemid']);
$menuItemGiven = isset($menuItem->query) ? true : false;
}
// Check again
if ($menuItemGiven and isset($menuItem) and strcmp("com_crowdfunding", $menuItem->component) != 0) {
$menuItemGiven = false;
unset($query['Itemid']);
}
$mView = empty($menuItem->query['view']) ? null : $menuItem->query['view'];
$mId = empty($menuItem->query['id']) ? null : $menuItem->query['id'];
// $mOption = (empty($menuItem->query['option'])) ? null : $menuItem->query['option'];
// $mCatid = (empty($menuItem->query['catid'])) ? null : $menuItem->query['catid'];
// If is set view and Itemid missing, we have to put the view to the segments
if (isset($query['view'])) {
$view = $query['view'];
} else {
return $segments;
}
// Are we dealing with a category that is attached to a menu item?
if ($menuItem instanceof stdClass and isset($view) and $mView == $view and isset($query['id']) and $mId == (int) $query['id']) {
unset($query['view']);
if (isset($query['catid'])) {
unset($query['catid']);
}
if (isset($query['layout'])) {
unset($query['layout']);
}
unset($query['id']);
return $segments;
}
// Views
if (isset($view)) {
switch ($view) {
case "category":
if (!$menuItemGiven) {
$segments[] = $view;
}
unset($query['view']);
if (isset($query['id'])) {
$categoryId = $query['id'];
} else {
// We should have id set for this view. If we don't, it is an error.
return $segments;
}
$segments = CrowdfundingHelperRoute::prepareCategoriesSegments($categoryId, $segments, $menuItem, $menuItemGiven);
unset($query['id']);
break;
case "backing":
case "embed":
case "details":
if (!$menuItemGiven) {
$segments[] = $view;
}
unset($query['view']);
// If a project is assigned to a menu item.
if ($menuItemGiven and strcmp("details", $menuItem->query["view"]) == 0 and $menuItem->query["id"] == (int) $query['id']) {
} else {
// If a project is NOT assigned to a menu item.
if (isset($query['id']) and isset($query['catid']) and !empty($query['catid'])) {
$categoryId = (int) $query['catid'];
if (false === strpos($query['id'], ":")) {
$alias = CrowdfundingHelperRoute::getProjectAlias($query['id']);
$query['id'] = $query['id'] . ":" . $alias;
}
} else {
// We should have these two set for this view. If we don't, it is an error.
return $segments;
}
$segments = CrowdfundingHelperRoute::prepareCategoriesSegments($categoryId, $segments, $menuItem, $menuItemGiven);
$segments[] = $query['id'];
}
unset($query['id']);
unset($query['catid']);
if (strcmp("backing", $view) == 0) {
$segments[] = "backing";
}
if (strcmp("embed", $view) == 0) {
$segments[] = "embed";
}
break;
case "report":
if ($menuItemGiven and strcmp("report", $menuItem->query["view"]) == 0 and isset($query['view'])) {
//.........这里部分代码省略.........