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


PHP EBR::translate方法代码示例

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


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

示例1: EasyBlogParseRoute

function EasyBlogParseRoute(&$segments)
{
    // Load site's language file
    EB::loadLanguages();
    $vars = array();
    $active = JFactory::getApplication()->getMenu()->getActive();
    $config = EB::config();
    // We know that the view=categories&layout=listings&id=xxx because there's only 1 segment
    // and the active menu is view=categories
    if (isset($active) && $active->query['view'] == 'categories' && !isset($active->query['layout']) && count($segments) == 1) {
        $vars['view'] = 'categories';
        $vars['layout'] = 'listings';
        $category = EB::table('Category');
        $category->load(array('alias' => $segments[0]));
        // if still can't get the correct category id try this
        if (!$category->id) {
            $categoryAlias = $segments[0];
            $categoryAlias = str_replace(':', '-', $categoryAlias);
            $category->load(array('alias' => $categoryAlias));
        }
        $vars['id'] = $category->id;
        return $vars;
    }
    // RSD View
    if (isset($segments[0]) && $segments[0] == 'rsd') {
        $vars['view'] = 'rsd';
        return $vars;
    }
    // Feed view
    if (isset($segments[1])) {
        if ($segments[1] == 'rss' || $segments[1] == 'atom') {
            $vars['view'] = $segments[0];
            unset($segments);
            return $vars;
        }
    }
    // If user chooses to use the simple sef setup, we need to add the proper view
    if ($config->get('main_sef') == 'simple' && count($segments) == 1) {
        $files = JFolder::folders(JPATH_ROOT . '/components/com_easyblog/views');
        $views = array();
        foreach ($files as $file) {
            $views[] = EBR::translate($file);
        }
        if (!in_array($segments[0], $views)) {
            array_unshift($segments, EBR::translate('entry'));
        }
    }
    // Composer view
    if (isset($segments[0]) && $segments[0] == EBR::translate('composer')) {
        $vars['view'] = 'composer';
    }
    // Entry view
    if (isset($segments[0]) && $segments[0] == EBR::translate('entry')) {
        $count = count($segments);
        $entryId = '';
        // perform manual split on the string.
        if ($config->get('main_sef_unicode')) {
            $permalinkSegment = $segments[$count - 1];
            $permalinkArr = explode(':', $permalinkSegment);
            $entryId = $permalinkArr[0];
        } else {
            $index = $count - 1;
            $alias = $segments[$index];
            $post = EB::post();
            $post->loadByPermalink($alias);
            if ($post) {
                $entryId = $post->id;
            }
        }
        if ($entryId) {
            $vars['id'] = $entryId;
        }
        $vars['view'] = 'entry';
    }
    // Calendar view
    if (isset($segments[0]) && $segments[0] == EBR::translate('calendar')) {
        $vars['view'] = 'calendar';
        $count = count($segments);
        $totalSegments = $count - 1;
        if ($totalSegments >= 1) {
            // First segment is always the year
            if (isset($segments[1])) {
                $vars['year'] = $segments[1];
            }
            // Second segment is always the month
            if (isset($segments[2])) {
                $vars['month'] = $segments[2];
            }
            // Third segment is always the day
            if (isset($segments[3])) {
                $vars['day'] = $segments[3];
            }
        }
    }
    if (isset($segments[0]) && $segments[0] == EBR::translate('archive')) {
        $vars['view'] = 'archive';
        $count = count($segments);
        $totalSegments = $count - 1;
        if ($totalSegments >= 1) {
            $indexSegment = 1;
//.........这里部分代码省略.........
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:101,代码来源:router.php


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