function create($string) { $_this =& sef_jreviews::getInstance(); $url = ''; $hasMenuId = preg_match('/Itemid=([0-9]{1,})/', $string, $menu_id); $isMenuLink = strpos($string, 'url=menu'); $sefstring = ''; // Process internal "url" parameter $temp = explode('&url=', $string); if (isset($temp[1])) { $url = urldecode($temp[1]); } if (preg_match('/&url=/', $string) && !$isMenuLink) { $query_string = explode('/', $url); // Properly urlencodes the jReviews parameters contained within the url parameter foreach ($query_string as $key => $param) { $query_string[$key] = urlencodeParam($param); } $url = implode('/', $query_string); $sefstring .= $url; } elseif (isset($menu_id[1]) && ($isMenuLink || $hasMenuId)) { $sefstring .= $isMenuLink ? str_replace('menu', $_this->__Menu->getMenuName($menu_id[1]), $url) : $_this->__Menu->getMenuName($menu_id[1]); } else { $sefstring = $string; } return rtrim($sefstring, '/') . '/'; }
function create($string) { $_this =& sef_jreviews::getInstance(); $query_string_new = $query_string = array(); $sefstring = $url = $menu = $trailing_slash = ''; $string = str_replace(array('&', '*@*'), array('&', ':'), $string); // Get external param to include them at the end $p = str_replace('index.php?option=com_jreviews', '', $string); parse_str(str_replace('&', '&', $p), $params); $hasMenuId = isset($params['Itemid']) && $params['Itemid'] > 0; $isMenuLink = preg_match('/^index.php\\?option=com_jreviews&view=[a-z0-9].*&Itemid=[0-9]+|index.php\\?option=com_jreviews&Itemid=[0-9]+$/i', $string, $matches); if (isset($params['url'])) { $query_string = explode('/', urldecode($params['url'])); // Properly urlencodes the jReviews parameters contained within the url parameter foreach ($query_string as $key => $param) { if ($param != 'menu' || $param == 'menu' && !$hasMenuId) { $query_string_new[$key] = urlencodeParam($param); unset($params[$key]); } } } // Get the menu name if ($hasMenuId) { $menu = $_this->__Menu->getMenuAlias($params['Itemid']); $sefstring .= $menu . '/'; } if ($isMenuLink) { $sefstring = $menu; } elseif (!$_this->joomla_style_params && $hasMenuId && !preg_match('/' . implode('|', $this->__controllerActions) . '/', isset($params['url']) ? $params['url'] : '')) { $sefstring = $menu; } elseif (!empty($query_string_new)) { $url = implode('/', $query_string_new); $sefstring .= $url; } elseif (!$_this->joomla_style_params) { $sefstring = $string; $params = array(); } // include external params unset($params['Itemid'], $params['view'], $params['url']); $sefstring = rtrim($sefstring, '/'); if (!empty($params) && $query_string[0] != 'tag') { $sefstring .= '/?' . sef_jreviews::buildUrlParams($params, $_this->joomla_style_params); } elseif (!empty($params) && $query_string[0] == 'tag') { $sefstring .= '?' . sef_jreviews::buildUrlParams($params, $_this->joomla_style_params); } elseif (empty($params) && (empty($query_string) || !empty($query_string) && $query_string[0] != 'tag')) { $trailing_slash = '/'; } return rtrim($sefstring, '/') . $trailing_slash; }
function __construct($app = 'jreviews', $ajax = false, $disable404 = false) { // Set app $this->app = $app; // jreviews by default for backwards compatibility $this->disable404 = $disable404; // Fixes secondary colons added by J1.5 if (isset($_GET['url'])) { $query_string = explode('/', $_GET['url']); foreach ($query_string as $key => $param) { $query_string[$key] = urlencodeParam($param, false); } $_GET['url'] = implode('/', $query_string); } }
function JreviewsBuildRoute(&$query) { $segments = array(); unset($query['view']); if (!function_exists('urlencodeParam')) { return array(); } if (isset($query['url'])) { $query_string = explode('/', $query['url']); // Properly urlencodes the jReviews parameters contained within the url parameter foreach ($query_string as $key => $param) { $query_string[$key] = urlencodeParam($param); } $query['url'] = implode('/', $query_string); $segments[0] = $query['url']; unset($query['url']); } return $segments; }
function JreviewsBuildRoute(&$query) { global $Menu; $segments = array(); if (isset($query['url'])) { $query_string = explode('/', $query['url']); // Properly urlencodes the jReviews parameters contained within the url parameter foreach ($query_string as $key => $param) { $query_string[$key] = urlencodeParam($param); } $query['url'] = implode('/', $query_string); $segments[0] = $query['url']; unset($query['url']); // Forces Joomla to use the menu alias for JReviews menus of type url instead of /component/jreviews if (isset($query['Itemid'])) { App::import('Model', 'menu', 'jreviews'); $MenuModel = RegisterClass::getInstance('MenuModel'); if (isset($MenuModel->menues[$query['Itemid']]) && $MenuModel->menues[$query['Itemid']]->componentid == 0) { $query['option'] = ''; } } } return $segments; }
function __construct($app = 'jreviews', $xajax = false, $disable404 = false) { // Fixed REQUEST_URI for IIS $this->getUri(); // Set app $this->app = $app; // jreviews by default for backwards compatibility $this->xajax_debug = S2_XAJAX_DEBUG; $this->xajax_statusMessage = S2_XAJAX_STATUS_MESSAGE; $this->xajax_waitCursor = S2_XAJAX_WAIT_CURSOR; $this->disable404 = $disable404; if (!$this->isAjax() && $xajax && defined('MVC_FRAMEWORK_ADMIN')) { $this->loadXajax(); $this->xajax = true; } // Fixes secondary colons added by J1.5 if (isset($_GET['url'])) { $query_string = explode('/', $_GET['url']); foreach ($query_string as $key => $param) { $query_string[$key] = urlencodeParam($param, false); } $_GET['url'] = implode('/', $query_string); } }
function constructRoute($passedArgs, $excludeParams = null, $app = 'jreviews') { $segments = ''; $url_param = array(); if (defined('MVC_FRAMEWORK_ADMIN')) { $base_url = 'index.php?option=' . S2Paths::get($app, 'S2_CMSCOMP'); } else { $Itemid = Sanitize::getInt($passedArgs, 'Itemid') > 0 ? Sanitize::getInt($passedArgs, 'Itemid') : ''; $base_url = 'index.php?option=' . S2Paths::get($app, 'S2_CMSCOMP') . '&Itemid=' . $Itemid; } // Get segments without named params if (isset($passedArgs['url'])) { $parts = explode('/', $passedArgs['url']); foreach ($parts as $bit) { if (false === strpos($bit, _PARAM_CHAR)) { $segments[] = $bit; } } } else { $segments[] = 'menu'; } unset($passedArgs['option'], $passedArgs['Itemid'], $passedArgs['url']); if (is_array($excludeParams)) { foreach ($excludeParams as $exclude) { unset($passedArgs[$exclude]); } } foreach ($passedArgs as $paramName => $paramValue) { if (is_string($paramValue)) { $url_param[] = $paramName . _PARAM_CHAR . urlencodeParam($paramValue); } } $new_route = $base_url . '&url=' . implode('/', $segments) . '/' . implode('/', $url_param); return $new_route; }
function constructRoute($passedArgs, $excludeParams = null, $app = 'jreviews') { $segments = $url_param = array(); $defaultExcludeParms = array('format', 'view', 'language', 'lang'); $excludeParams = !empty($excludeParams) ? array_merge($excludeParams, $defaultExcludeParms) : $defaultExcludeParms; if (defined('MVC_FRAMEWORK_ADMIN')) { $base_url = 'index.php?option=' . S2Paths::get($app, 'S2_CMSCOMP'); } else { $Itemid = Sanitize::getInt($passedArgs, 'Itemid') > 0 ? Sanitize::getInt($passedArgs, 'Itemid') : ''; $base_url = 'index.php?option=' . S2Paths::get($app, 'S2_CMSCOMP') . '&Itemid=' . $Itemid; } // Get segments without named params if (isset($passedArgs['url'])) { $parts = explode('/', $passedArgs['url']); foreach ($parts as $bit) { if (false === strpos($bit, _PARAM_CHAR) && $bit != 'index.php') { $segments[] = $bit; } } } unset($passedArgs['option'], $passedArgs['Itemid'], $passedArgs['url']); if (is_array($excludeParams)) { foreach ($excludeParams as $exclude) { unset($passedArgs[$exclude]); } } foreach ($passedArgs as $paramName => $paramValue) { if (is_string($paramValue) && !empty($paramValue)) { $paramValue == 'order' and $paramValue = array_shift(explode('.html', $paramValue)); $url_param[] = $paramName . _PARAM_CHAR . urlencodeParam($paramValue); } } empty($segments) and $segments[] = 'menu'; $new_route = $base_url . (!empty($segments) ? '&url=' . implode('/', $segments) . '/' . implode('/', $url_param) : ''); return $new_route; }