예제 #1
0
 function _isHomePage(&$uri, $altered = false)
 {
     static $homeQuery, $homeId;
     if (!isset($homeQuery)) {
         list($homeQuery, $homeId) = SEFTools::getHomeQueries(false);
     }
     // Copy the old uri
     $newuri = clone $uri;
     // Normalize URI
     if (!$altered) {
         SEFTools::normalizeURI($newuri);
     }
     // Check Itemid variable if present
     if (!is_null($newuri->getVar('Itemid'))) {
         if ($newuri->getVar('Itemid') != $homeId) {
             // Itemid does not match
             return false;
         } else {
             // Itemid matches, remove it from query
             $newuri->delVar('Itemid');
         }
     }
     // Remove the lang variable if present
     $newuri->delVar('lang');
     // Convert uri to string
     $link = JoomSEF::_uriToUrl($newuri);
     // Compare links
     if ($link == $homeQuery) {
         return true;
     }
     return false;
 }
예제 #2
0
 function getHomeQueries($includeLang = true)
 {
     $menu =& JApplication::getMenu('site');
     $item =& $menu->getDefault();
     $link = $item->link;
     $uri = new JURI($link);
     // We need to adjust the URL according to the extension
     SEFTools::normalizeURI($uri);
     if ($includeLang) {
         $uri->setVar('lang', '');
     }
     $q = JoomSEF::_uriToUrl($uri);
     return array($q, $item->id);
 }