本文整理汇总了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;
//.........这里部分代码省略.........