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


PHP JSFactory::getAliasCategory方法代码示例

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


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

示例1: jshoppingParseRoute

function jshoppingParseRoute($segments)
{
    $vars = array();
    initLoadJoomshoppingLanguageFile();
    $reservedFirstAlias = JSFactory::getReservedFirstAlias();
    $menu = JFactory::getApplication()->getMenu();
    $menuItem = $menu->getActive();
    JPluginHelper::importPlugin('jshoppingrouter');
    $dispatcher = JDispatcher::getInstance();
    $dispatcher->trigger('onBeforeParseRoute', array(&$vars, &$segments));
    $segments[0] = getSeoSegment($segments[0]);
    if (isset($segments[1])) {
        $segments[1] = getSeoSegment($segments[1]);
    } else {
        $segments[1] = "";
    }
    if (!isset($menuItem->query['controller']) && isset($menuItem->query['view'])) {
        $menuItem->query['controller'] = $menuItem->query['view'];
    }
    if (isset($menuItem->query['controller'])) {
        if ($menuItem->query['controller'] == "cart") {
            $vars['controller'] = "cart";
            $vars['task'] = $segments[0];
            $dispatcher->trigger('onAfterParseRoute', array(&$vars, &$segments));
            return $vars;
        }
        if ($menuItem->query['controller'] == "wishlist") {
            $vars['controller'] = "wishlist";
            $vars['task'] = $segments[0];
            $dispatcher->trigger('onAfterParseRoute', array(&$vars, &$segments));
            return $vars;
        }
        if ($menuItem->query['controller'] == "search") {
            $vars['controller'] = "search";
            $vars['task'] = $segments[0];
            $dispatcher->trigger('onAfterParseRoute', array(&$vars, &$segments));
            return $vars;
        }
        if ($menuItem->query['controller'] == "user" && $menuItem->query['task'] == "") {
            $vars['controller'] = "user";
            $vars['task'] = $segments[0];
            $dispatcher->trigger('onAfterParseRoute', array(&$vars, &$segments));
            return $vars;
        }
        if ($menuItem->query['controller'] == "checkout") {
            $vars['controller'] = "checkout";
            $vars['task'] = $segments[0];
            $dispatcher->trigger('onAfterParseRoute', array(&$vars, &$segments));
            return $vars;
        }
        if ($menuItem->query['controller'] == "vendor" && $menuItem->query['task'] == "") {
            $vars['controller'] = "vendor";
            $vars['task'] = $segments[0];
            $dispatcher->trigger('onAfterParseRoute', array(&$vars, &$segments));
            return $vars;
        }
        if ($menuItem->query['controller'] == "content" && $menuItem->query['task'] == "view") {
            $vars['controller'] = "content";
            $vars['page'] = $segments[0];
            $dispatcher->trigger('onAfterParseRoute', array(&$vars, &$segments));
            return $vars;
        }
        if ($menuItem->query['controller'] == "category" && $menuItem->query['category_id'] && $segments[1] == "") {
            $prodalias = JSFactory::getAliasProduct();
            $product_id = array_search($segments[0], $prodalias, true);
            if (!$product_id) {
                JError::raiseError(404, _JSHOP_PAGE_NOT_FOUND);
            }
            $vars['controller'] = "product";
            $vars['task'] = "view";
            $vars['category_id'] = $menuItem->query['category_id'];
            $vars['product_id'] = $product_id;
            $dispatcher->trigger('onAfterParseRoute', array(&$vars, &$segments));
            return $vars;
        }
    }
    if ($segments[0] && !in_array($segments[0], $reservedFirstAlias)) {
        $catalias = JSFactory::getAliasCategory();
        $category_id = array_search($segments[0], $catalias, true);
        if ($category_id && $segments[1] == "") {
            $vars['controller'] = "category";
            $vars['task'] = "view";
            $vars['category_id'] = $category_id;
            $dispatcher->trigger('onAfterParseRoute', array(&$vars, &$segments));
            return $vars;
        }
        if ($category_id && $segments[1] != "") {
            $prodalias = JSFactory::getAliasProduct();
            $product_id = array_search($segments[1], $prodalias, true);
            if (!$product_id) {
                JError::raiseError(404, _JSHOP_PAGE_NOT_FOUND);
            }
            if ($category_id && $product_id) {
                $vars['controller'] = "product";
                $vars['task'] = "view";
                $vars['category_id'] = $category_id;
                $vars['product_id'] = $product_id;
                $dispatcher->trigger('onAfterParseRoute', array(&$vars, &$segments));
                return $vars;
            }
//.........这里部分代码省略.........
开发者ID:panickylemon,项目名称:joomlastayn,代码行数:101,代码来源:router.php


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