function ZooParseRoute($segments) { // init vars $vars = array(); $count = count($segments); // fix segments (see JRouter::_decodeSegments) foreach (array_keys($segments) as $key) { $segments[$key] = str_replace(':', '-', $segments[$key]); } // frontpage (with optional pagination) $task = 'frontpage'; if ($count == 1 && $segments[0] == $task) { $vars['task'] = $task; } if ($count == 2 && $segments[0] == $task) { $vars['task'] = $task; $vars['page'] = (int) $segments[1]; } // category (with optional pagination) $task = 'category'; if ($count == 2 && $segments[0] == $task) { $vars['task'] = $task; $vars['category_id'] = (int) CategoryHelper::translateAliasToID($segments[1]); } if ($count == 3 && $segments[0] == $task) { $vars['task'] = $task; $vars['category_id'] = (int) CategoryHelper::translateAliasToID($segments[1]); $vars['page'] = (int) $segments[2]; } // alpha index (with optional pagination) $task = 'alphaindex'; if ($count == 3 && $segments[0] == $task) { $vars['task'] = $task; $vars['app_id'] = (int) ApplicationHelper::translateAliasToID($segments[1]); $vars['alpha_char'] = (string) $segments[2]; } if ($count == 4 && $segments[0] == $task) { $vars['task'] = $task; $vars['app_id'] = (int) ApplicationHelper::translateAliasToID($segments[1]); $vars['alpha_char'] = (string) $segments[2]; $vars['page'] = (int) $segments[3]; } // tag (with optional pagination) $task = 'tag'; if ($count == 3 && $segments[0] == $task) { $vars['task'] = $task; $vars['app_id'] = (int) ApplicationHelper::translateAliasToID($segments[1]); $vars['tag'] = (string) $segments[2]; } if ($count == 4 && $segments[0] == $task) { $vars['task'] = $task; $vars['app_id'] = (int) ApplicationHelper::translateAliasToID($segments[1]); $vars['tag'] = (string) $segments[2]; $vars['page'] = (int) $segments[3]; } // item $task = 'item'; if ($count == 2 && $segments[0] == $task) { $vars['task'] = $task; $vars['item_id'] = (int) ItemHelper::translateAliasToID($segments[1]); } // feed $task = 'feed'; if ($count == 3 && $segments[0] == $task) { $vars['task'] = $task; $vars['type'] = (string) $segments[1]; $vars['app_id'] = (string) $segments[2]; } if ($count == 4 && $segments[0] == $task) { $vars['task'] = $task; $vars['type'] = (string) $segments[1]; $vars['app_id'] = (string) $segments[2]; $vars['category_id'] = (int) CategoryHelper::translateAliasToID($segments[3]); } // submission $task = 'submission'; $layout = 'submission'; if ($count == 2 && $segments[0] == $task && $segments[1] == $layout) { $vars['task'] = $task; $vars['layout'] = (string) $segments[1]; } if ($count == 5 && $segments[0] == $task && $segments[1] == $layout) { $vars['task'] = $task; $vars['layout'] = (string) $segments[1]; $vars['submission_id'] = (int) SubmissionHelper::translateAliasToID($segments[2]); $vars['type_id'] = (string) $segments[3]; $vars['submission_hash'] = (string) $segments[4]; } if ($count == 6 && $segments[0] == $task && $segments[1] == $layout) { $vars['task'] = $task; $vars['layout'] = (string) $segments[1]; $vars['submission_id'] = (int) SubmissionHelper::translateAliasToID($segments[2]); $vars['type_id'] = (string) $segments[3]; $vars['submission_hash'] = (string) $segments[4]; $vars['item_id'] = (int) ItemHelper::translateAliasToID($segments[5]); } // submission mysubmissions $task = 'submission'; $layout = 'mysubmissions'; if ($count == 2 && $segments[0] == $task && $segments[1] == $layout) { $vars['task'] = $task; $vars['layout'] = (string) $segments[1]; } if ($count == 3 && $segments[0] == $task && $segments[1] == $layout) { $vars['task'] = $task; $vars['layout'] = (string) $segments[1]; $vars['submission_id'] = (int) SubmissionHelper::translateAliasToID($segments[2]); } return $vars; }