當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CrowdfundingHelperRoute::prepareCategoriesSegments方法代碼示例

本文整理匯總了PHP中CrowdfundingHelperRoute::prepareCategoriesSegments方法的典型用法代碼示例。如果您正苦於以下問題:PHP CrowdfundingHelperRoute::prepareCategoriesSegments方法的具體用法?PHP CrowdfundingHelperRoute::prepareCategoriesSegments怎麽用?PHP CrowdfundingHelperRoute::prepareCategoriesSegments使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CrowdfundingHelperRoute的用法示例。


在下文中一共展示了CrowdfundingHelperRoute::prepareCategoriesSegments方法的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'])) {
//.........這裏部分代碼省略.........
開發者ID:pashakiz,項目名稱:crowdf,代碼行數:101,代碼來源:router.php


注:本文中的CrowdfundingHelperRoute::prepareCategoriesSegments方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。