本文整理汇总了PHP中FSS_Helper::GetRouteMenus方法的典型用法代码示例。如果您正苦于以下问题:PHP FSS_Helper::GetRouteMenus方法的具体用法?PHP FSS_Helper::GetRouteMenus怎么用?PHP FSS_Helper::GetRouteMenus使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FSS_Helper
的用法示例。
在下文中一共展示了FSS_Helper::GetRouteMenus方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: NeedBaseBreadcrumb
static function NeedBaseBreadcrumb($pathway, $aparams)
{
global $FSSRoute_menus;
// need to determine if a base pathway item needs adding or not
// get any menu items for fss
FSS_Helper::GetRouteMenus();
$lastpath = $pathway->getPathway();
// no pathway, so must have to add
if (count($lastpath) == 0) {
return true;
}
$lastpath = $lastpath[count($lastpath) - 1];
$link = $lastpath->link;
$parts = FSSRoute::SplitURL($link);
if (!array_key_exists('Itemid', $parts)) {
return true;
}
//print_p($parts);
if (!array_key_exists($parts['Itemid'], $FSSRoute_menus)) {
//echo "Item ID not found<br>";
return true;
}
$ok = true;
/*foreach($FSSRoute_menus[$parts['Itemid']] as $key => $value)
{
if ($value != "")
{
if (!array_key_exists($key,$aparams))
{
$ok = false;
break;
}
if ($aparams[$key] != $value)
{
$ok = false;
break;
}
}
}*/
foreach ($aparams as $key => $value) {
if ($value != "") {
if (!array_key_exists($key, $FSSRoute_menus[$parts['Itemid']])) {
$ok = false;
break;
}
if ($FSSRoute_menus[$parts['Itemid']][$key] != $value) {
$ok = false;
break;
}
}
}
if ($ok) {
return false;
}
/*print_p($aparams);
print_p($FSSRoute_menus[$parts['Itemid']]);*/
return true;
}
示例2: _
static function _($url, $xhtml = false, $ssl = null, $d = false)
{
// skip any external urls
if (strpos($url, "option") !== false && strpos($url, "option=com_fss") === false) {
return JRoute::_($url, $xhtml, $ssl);
}
global $FSSRoute_debug;
global $FSSRoute_menus;
global $FSSRoute_access;
self::$d = $d;
// get any menu items for fss
FSS_Helper::GetRouteMenus();
// Get the router
$router = JFactory::getApplication()->getRouter();
// if the url dont start with index.php, we need to add the exisitng url to what we want
if (substr($url, 0, 9) != "index.php") {
//echo "Making FUll URL: $url<br>";
$url = self::_fullURL($router, $url);
//echo "Resut : $url<br>";
}
$uri = new JURI($url);
// work out is we are in an Itemid already, if so, set it as the best match
if ($uri->hasVar('Itemid')) {
$bestmatch = $uri->getVar('Itemid');
} else {
$bestmatch = '';
}
$bestcount = 0;
$uriquery = $uri->toString(array('query'));
$urivars = FSSRoute::SplitURL($uriquery);
$sourcevars = FSSRoute::SplitURL($url);
// check through the menu item for the current url, and add any items to the new url that are missing
if ($bestmatch && array_key_exists($bestmatch, $FSSRoute_menus)) {
foreach ($FSSRoute_menus[$bestmatch] as $key => $value) {
if (!array_key_exists($key, $urivars) && !array_key_exists($key, $sourcevars)) {
$urivars[$key] = $value;
}
}
}
$current_access = 0;
if (array_key_exists(FSS_Input::getInt('Itemid'), $FSSRoute_access)) {
$current_access = $FSSRoute_access[FSS_Input::getInt('Itemid')];
}
if ($d) {
echo "Incoming Link : {$url}<br>";
echo "Cur Item ID : " . FSS_Input::getInt('Itemid') . "<br>";
//print_p($FSSRoute_menus);
}
foreach ($FSSRoute_menus as $id => $vars) {
if ($d) {
echo "{$id} => <Br>";
print_p($vars);
}
// need to check if the access level is the same
if ($current_access && array_key_exists($id, $FSSRoute_access) && $FSSRoute_access[$id] != $current_access) {
if ($d) {
echo "No Access<br>";
}
continue;
}
$count = FSSRoute::MatchVars($urivars, $vars);
if (FSS_Input::getInt('Itemid') == $id && $count > 0) {
if ($d) {
echo "Current ItemId: increase count<br>";
}
$count++;
}
if ($d) {
echo "Count: {$count}<br>";
}
if ($count > $bestcount) {
if ($d) {
echo "New best match - {$id}<br>";
}
$bestcount = $count;
$bestmatch = $id;
}
}
if ($bestcount == 0 && array_key_exists('view', $sourcevars) && substr($sourcevars['view'], 0, 6) == "admin_") {
foreach ($FSSRoute_menus as $id => $item) {
// need to check if the access level is the same
if ($current_access && array_key_exists($id, $FSSRoute_access) && $FSSRoute_access[$id] != $current_access) {
continue;
}
if ($item['view'] == "admin") {
$bestcount = 1;
$bestmatch = $id;
}
}
}
// no match found, try to fallback on the main support menu id
if ($bestcount == 0) {
foreach ($FSSRoute_menus as $id => $item) {
// need to check if the access level is the same
if ($current_access && array_key_exists($id, $FSSRoute_access) && $FSSRoute_access[$id] != $current_access) {
continue;
}
if ($item['view'] == "main") {
$bestcount = 1;
$bestmatch = $id;
//.........这里部分代码省略.........