本文整理汇总了PHP中EBR::encodeSegments方法的典型用法代码示例。如果您正苦于以下问题:PHP EBR::encodeSegments方法的具体用法?PHP EBR::encodeSegments怎么用?PHP EBR::encodeSegments使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EBR
的用法示例。
在下文中一共展示了EBR::encodeSegments方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: EasyBlogParseRoute
//.........这里部分代码省略.........
$indexSegment = 2;
}
// First segment is always the year
if (isset($segments[$indexSegment])) {
$vars['archiveyear'] = $segments[$indexSegment];
}
// Second segment is always the month
if (isset($segments[$indexSegment + 1])) {
$vars['archivemonth'] = $segments[$indexSegment + 1];
}
// Third segment is always the day
if (isset($segments[$indexSegment + 2])) {
$vars['archiveday'] = $segments[$indexSegment + 2];
}
}
}
// Process categories sef links
// index.php?option=com_easyblog&view=categories
if (isset($segments[0]) && $segments[0] == EBR::translate('categories')) {
// Set the view
$vars['view'] = 'categories';
// Get the total number of segments
$count = count($segments);
// Ensure that the first index is not a system layout
$layouts = array('listings', 'simple');
if ($count == 2 && !in_array($segments[1], $layouts)) {
$id = null;
// If unicode alias is enabled, just explode the data
if ($config->get('main_sef_unicode')) {
$tmp = explode(':', $segments[1]);
$id = $tmp[0];
}
// Encode segments
$segments = EBR::encodeSegments($segments);
if (!$id) {
$category = EB::table('Category');
$category->load(array('alias' => $segments[1]));
$id = $category->id;
}
$vars['id'] = $id;
$vars['layout'] = 'listings';
}
// index.php?option=com_easyblog&view=categories&layout=simple
if ($count == 2 && in_array($segments[1], $layouts)) {
$vars['layout'] = $segments[1];
}
}
if (isset($segments[0]) && $segments[0] == EBR::translate('tags')) {
$count = count($segments);
if ($count > 1) {
$tagId = '';
if ($config->get('main_sef_unicode')) {
// perform manual split on the string.
$permalinkSegment = $segments[$count - 1];
$permalinkArr = explode(':', $permalinkSegment);
$tagId = $permalinkArr[0];
}
$segments = EBR::encodeSegments($segments);
if (empty($tagId)) {
$table = EB::table('Tag');
$table->load($segments[$count - 1], true);
$tagId = $table->id;
}
$vars['id'] = $tagId;
$vars['layout'] = 'tag';
}