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


PHP DiscussRouter::getTagAlias方法代碼示例

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


在下文中一共展示了DiscussRouter::getTagAlias方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: EasyDiscussBuildRoute

function EasyDiscussBuildRoute(&$query)
{
    $segments = array();
    $config = DiscussHelper::getConfig();
    if (isset($query['view'])) {
        switch ($query['view']) {
            case 'post':
                // We don't want to include the view for the entry links.
                unset($query['view']);
                if (isset($query['id'])) {
                    $segments[] = DiscussRouter::getPostAlias($query['id']);
                    unset($query['id']);
                }
                if (isset($query['layout'])) {
                    $segments[] = $query['layout'];
                    unset($query['layout']);
                }
                break;
            case 'profile':
                $segments[] = $query['view'];
                unset($query['view']);
                if (isset($query['layout'])) {
                    $segments[] = $query['layout'];
                    unset($query['layout']);
                }
                if (isset($query['id'])) {
                    $segments[] = DiscussRouter::getUserAlias($query['id']);
                    unset($query['id']);
                }
                if (isset($query['category_id'])) {
                    $aliases = DiscussRouter::getCategoryAliases($query['category_id']);
                    foreach ($aliases as $alias) {
                        $segments[] = $alias;
                    }
                    unset($query['category_id']);
                }
                if (isset($query['viewtype'])) {
                    $segments[] = $query['viewtype'];
                    unset($query['viewtype']);
                }
                break;
            case 'index':
                $segments[] = $query['view'];
                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;
//.........這裏部分代碼省略.........
開發者ID:pguilford,項目名稱:vcomcc,代碼行數:101,代碼來源:router.php


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