本文整理汇总了PHP中JCckDevHelper::getRouteParams方法的典型用法代码示例。如果您正苦于以下问题:PHP JCckDevHelper::getRouteParams方法的具体用法?PHP JCckDevHelper::getRouteParams怎么用?PHP JCckDevHelper::getRouteParams使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JCckDevHelper
的用法示例。
在下文中一共展示了JCckDevHelper::getRouteParams方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CckParseRoute
function CckParseRoute($segments)
{
$app = JFactory::getApplication();
$count = count($segments);
$menu = $app->getMenu();
$menuItem = $menu->getActive();
$vars = array();
if ($segments[0] == 'form') {
$menu->setActive($app->input->getInt('Itemid', 0));
$vars['option'] = 'com_cck';
$vars['view'] = 'form';
$vars['layout'] = 'edit';
$vars['type'] = $segments[1];
} else {
$legacy = 0;
// check later
if (!($menuItem->query['option'] == 'com_cck' && $menuItem->query['view'] == 'list')) {
$legacy = 0;
}
if (!$legacy) {
if (isset($menuItem->query['search'])) {
$params = JCckDevHelper::getRouteParams($menuItem->query['search']);
}
if (isset($params['location']) && $params['location'] && is_file(JPATH_SITE . '/plugins/cck_storage_location/' . $params['location'] . '/' . $params['location'] . '.php')) {
require_once JPATH_SITE . '/plugins/cck_storage_location/' . $params['location'] . '/' . $params['location'] . '.php';
JCck::callFunc_Array('plgCCK_Storage_Location' . $params['location'], 'parseRoute', array(&$vars, $segments, $count, $params));
} else {
$legacy = 1;
}
}
if ($legacy) {
if ($count == 2) {
$vars['option'] = 'com_content';
$vars['view'] = 'article';
$vars['catid'] = $segments[0];
$vars['id'] = $segments[1];
} elseif ($count == 1) {
$vars['option'] = 'com_content';
@(list($id, $alias) = explode(':', $segments[0], 2));
$category = JCategories::getInstance('Content')->get($id);
if ($category && $category->id == $id && $category->alias == $alias) {
$vars['view'] = 'categories';
} else {
$vars['view'] = 'article';
}
$vars['id'] = $segments[0];
}
}
}
return $vars;
}
示例2: parse
public function parse(&$segments)
{
$app = JFactory::getApplication();
$count = count($segments);
$menu = $app->getMenu();
$menuItem = $menu->getActive();
$vars = array();
if ($segments[0] == 'form') {
$menu->setActive($app->input->getInt('Itemid', 0));
$vars['option'] = 'com_cck';
$vars['view'] = 'form';
$vars['layout'] = 'edit';
$vars['type'] = @$segments[1];
} else {
$legacy = 0;
// check later
if (!($menuItem->query['option'] == 'com_cck' && $menuItem->query['view'] == 'list')) {
$legacy = 0;
}
if (!$legacy) {
if (isset($menuItem->query['search'])) {
$params = JCckDevHelper::getRouteParams($menuItem->query['search']);
if ($params['doSEF'][0] == '4' || $params['doSEF'][0] == '5') {
if ($count == 1) {
if (isset($params['location']) && $params['location'] && is_file(JPATH_SITE . '/plugins/cck_storage_location/' . $params['location'] . '/' . $params['location'] . '.php')) {
require_once JPATH_SITE . '/plugins/cck_storage_location/' . $params['location'] . '/' . $params['location'] . '.php';
$target = $params['doSEF'][0] == '5' ? 'author_object' : 'parent_object';
$properties = array($target);
$properties = JCck::callFunc('plgCCK_Storage_Location' . $params['location'], 'getStaticProperties', $properties);
if ($properties[$target] != '') {
$params['doSEF'][0] = '2';
$params['location'] = $properties[$target];
}
}
}
}
}
if (isset($params['location']) && $params['location'] && is_file(JPATH_SITE . '/plugins/cck_storage_location/' . $params['location'] . '/' . $params['location'] . '.php')) {
require_once JPATH_SITE . '/plugins/cck_storage_location/' . $params['location'] . '/' . $params['location'] . '.php';
JCck::callFunc_Array('plgCCK_Storage_Location' . $params['location'], 'parseRoute', array(&$vars, $segments, $count, $params));
} else {
$legacy = 1;
}
}
if ($legacy) {
if ($count == 2) {
$vars['option'] = 'com_content';
$vars['view'] = 'article';
$vars['catid'] = $segments[0];
$vars['id'] = $segments[1];
} elseif ($count == 1) {
$vars['option'] = 'com_content';
$idArray = explode(':', $segments[0], 2);
$id = (int) $idArray[0];
$alias = (string) @$idArray[1];
$category = JCategories::getInstance('Content')->get($id);
if ($category && $category->id == $id && $category->alias == $alias) {
$vars['view'] = 'categories';
} else {
$vars['view'] = 'article';
}
$vars['id'] = $segments[0];
}
}
}
return $vars;
}