当前位置: 首页>>代码示例>>PHP>>正文


PHP shRouter::shGetMenu方法代码示例

本文整理汇总了PHP中shRouter::shGetMenu方法的典型用法代码示例。如果您正苦于以下问题:PHP shRouter::shGetMenu方法的具体用法?PHP shRouter::shGetMenu怎么用?PHP shRouter::shGetMenu使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在shRouter的用法示例。


在下文中一共展示了shRouter::shGetMenu方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: sefGetLocation

 /**
  * Vul in de array $title de onderdelen waaruit de link moet bestaan
  * Bijvoorbeeld: menuitem, categorie, itemnaam
  * Deze functie last de boel aan elkaar
  *
  * @param  string $url
  * @param  array $title
  * @param  string $task
  * @param  int $limit
  * @param  int $limitstart
  * @return sefurl
  */
 function sefGetLocation($url, &$title, $task = null, $limit = null, $limitstart = null, $langParam = null, $showall = null)
 {
     global $shMosConfig_locale, $option, $shHomeLink;
     $sefConfig =& shRouter::shGetConfig();
     // get DB
     $database =& JFactory::getDBO();
     $lang = empty($langParam) ? $shMosConfig_locale : $langParam;
     // V 1.2.4.k added homepage check : needed in case homepage is not com_frontpage
     if (empty($shHomeLink)) {
         $menu =& shRouter::shGetMenu();
         $shHomePage =& $menu->getDefault();
         if ($shHomePage) {
             if (substr($shHomePage->link, 0, 9) == 'index.php' && !preg_match('/Itemid=[0-9]*/', $shHomePage->link)) {
                 // and it does not have an Itemid
                 $shHomePage->link .= ($shHomePage->link == 'index.php' ? '?' : '&') . 'Itemid=' . $shHomePage->id;
                 // then add itemid
             }
             $shHomeLink = $shHomePage->link;
             //$shHomeLink = 'index.php';
             if (!strpos($shHomeLink, 'lang=')) {
                 $shDefaultIso = shGetIsoCodeFromName(shGetDefaultLang());
                 $shSepString = substr($shHomeLink, -9) == 'index.php' ? '?' : '&';
                 $shHomeLink .= $shSepString . 'lang=' . $shDefaultIso;
             }
             $shHomeLink = shSortUrl($shHomeLink);
             // $homeLink has lang info, whereas $homepage->link may or may not
         }
     }
     // shumisha : try to avoid duplicate content when using Joomfish by always adding &lang=xx to url (stored in DB).
     // warning : must add &lang=xx only if it does not exists already, which happens for the joomfish language selection modules or search results
     if (!strpos($url, 'lang=')) {
         $shSepString = substr($url, -9) == 'index.php' ? '?' : '&';
         $url .= $shSepString . 'lang=' . shGetIsoCodeFromName($lang);
     }
     // shumisha end of fix
     //shorten the url for storage and for consistancy
     $url = str_replace('&', '&', $url);
     // V 1.2.4.q detect multipage homepage
     $shMultiPageHomePageFlag = shIsHomepage($url);
     // get all the titles ready for urls
     $location = array();
     foreach ($title as $titlestring) {
         // V 1.2.4.t removed array_filter as it prevents '0' values in URL
         $location[] = titleToLocation(urldecode($titlestring));
     }
     $location = implode("/", $location);
     // V 1.2.4.t
     // V 1.2.4.t remove duplicate /
     $location = preg_replace('/\\/{2,}/', '/', $location);
     $location = JString::substr($location, 0, sh404SEF_MAX_SEF_URL_LENGTH);
     // trim to max length V 1.2.4.t
     // shumisha protect against querying for empty location
     if (empty($location)) {
         // V 1.2.4.t
         if ((!shIsMultilingual() || shIsMultilingual() && shIsDefaultlang($lang)) && !$sefConfig->addFile && !$shMultiPageHomePageFlag) {
             // V 1.2.4.q : need to go further and add pagination
             return '';
         }
     }
     // if location is empty, and no Joomfish, or Joomfish but this is default language, then there is nothing to add to url before querying DB
     // shumisha end of change
     //check for non-sef url first and avoid repeative lookups
     //we only want to look for title variations when adding new
     //this should also help eliminate duplicates.
     // shumisha 2003-03-13 added URL Caching
     $realloc = '';
     $urlType = Sh404sefHelperCache::getSefUrlFromCache($url, $realloc);
     if ($urlType == sh404SEF_URLTYPE_NONE || $urlType == sh404SEF_URLTYPE_404) {
         // V 1.2.4.t
         // shumisha end of addition
         $realloc = false;
         if ($urlType == sh404SEF_URLTYPE_NONE) {
             $query = "SELECT oldurl from #__redirection WHERE newurl = " . $database->Quote($url);
             $database->setQuery($query);
             //if ($realloc = $database->loadResult()) {
             if ($shTemp = $database->loadObject()) {
                 $realloc = $shTemp->oldurl;
             }
         }
         if ($realloc) {
             // found a match, so we aredone
             //Dat betekent dus, dat de functie create(), slecht gekozen is
             // shumisha : removed this die() that I do not understand!
             //die('regel292 in sef_ext.php');
             // shumisha end of removal
         } else {
             // this is new, so we need to insert the new title.
             //Hier worden eindelijk de nieuwe links gemaakt
//.........这里部分代码省略.........
开发者ID:sangkasi,项目名称:joomla,代码行数:101,代码来源:sef_ext.php

示例2: shGetJoomlaMenuItemPageTitle

/**
 * Reads an return the page title assigned to either
 * current or a specific menu item
 *
 * @param $Itemid itemid of the desired menu item
 */
function shGetJoomlaMenuItemPageTitle($Itemid = 0)
{
    // get the current menu item, or possibly the one asked for
    $menus =& shRouter::shGetMenu();
    $menuItem = empty($Itemid) ? $menus->getActive() : $menus->getItem($Itemid);
    // return value default
    $title = '';
    // now read the page_title, if any was set
    if (is_object($menuItem)) {
        $menuParams = new JParameter($menuItem->params);
        $title = $menuParams->get('page_title');
    }
    // return whatever we found
    return $title;
}
开发者ID:sangkasi,项目名称:joomla,代码行数:21,代码来源:sh404sef.class.php

示例3: shGetURLVar

 function &_createURI($url)
 {
     // prevent double Itemid param
     $itemid = shGetURLVar($url, 'Itemid');
     $i = intval($itemid);
     if (!empty($itemid) && (string) $i != $itemid) {
         $tmp = '?Itemid=' . $i;
         $url = str_replace($tmp . $tmp, $tmp, $url);
     }
     //Create the URI
     $uri =& parent::_createURI($url);
     // Get the itemid form the URI
     $itemid = $uri->getVar('Itemid');
     if (is_null($itemid)) {
         if ($option = $uri->getVar('option')) {
             $menu =& shRouter::shGetMenu();
             $item = $menu->getItem($itemid);
             if (isset($item) && $item->component == $option) {
                 $uri->setVar('Itemid', $item->id);
             }
         } else {
             if ($option = $this->getVar('option')) {
                 $uri->setVar('option', $option);
             }
             if ($itemid = $this->getVar('Itemid')) {
                 $uri->setVar('Itemid', $itemid);
             }
         }
     } else {
         if (!$uri->getVar('option')) {
             $menu =& shRouter::shGetMenu();
             $item = $menu->getItem($itemid);
             $uri->setVar('option', $item->component);
         }
     }
     return $uri;
 }
开发者ID:sangkasi,项目名称:joomla,代码行数:37,代码来源:shsef.php

示例4: shRemoveFromGETVarsList

    if (!$fb_tableNameOnForms) {
        shRemoveFromGETVarsList('tableid');
    }
    $title[] = shBuildFormName($fabrik);
}
// Build record's name
if (isset($rowid)) {
    $title[] = shBuildRowName($rowid, $fabrik, $fb_formatRecords, $params);
}
// Deal with Visualizations
if (isset($controller) && strstr(@$controller, 'visualization')) {
    //$title[] = 'viz';
    if (!isset($Itemid)) {
        $dosef = false;
    }
    $menuViz =& shRouter::shGetMenu();
    $menuItemViz = $menuViz->getItem(@$Itemid);
    if ($menuItemViz) {
        $menuParamsViz =& new JParameter($menuItemViz->params);
        $vizId = $menuParamsViz->get('visualizationid');
        if ($vizId) {
            $title[] = shBuildVizName($vizId, $params);
            shRemoveFromGETVarsList('controller');
        }
    }
}
if (isset($view)) {
    switch ($view) {
        case 'form':
            if (empty($rowid) && empty($tableid) && trim($params->get('fabrik_sef_customtxt_form', 'form') != '*')) {
                $title[] = trim($params->get('fabrik_sef_customtxt_form', 'form'));
开发者ID:nikshade,项目名称:fabrik21,代码行数:31,代码来源:com_fabrik.php

示例5: getHostByAddr

         $logData .= getHostByAddr($_SERVER['REMOTE_ADDR']) . $sep;
         $userAgent = empty($_SERVER['HTTP_USER_AGENT']) ? 'No user agent' : $_SERVER['HTTP_USER_AGENT'];
         $logData .= $userAgent . $sep . $_SERVER['REQUEST_METHOD'] . $sep . $_SERVER['REQUEST_URI'];
         $logData .= empty($_SERVER['HTTP_REFERER']) ? "\n" : $sep . $_SERVER['HTTP_REFERER'] . "\n";
         shLogToSecFile($logData);
     }
 }
 // redirect to the error page
 // You MUST create a static content page with the title 404 for this to work properly
 $mosmsg = ' (' . $GLOBALS['shConfigLiveSite'] . '/' . JString::ltrim($path, '/') . ')';
 // V 1.2.4.t
 $vars['option'] = 'com_content';
 $vars['view'] = 'article';
 // use provided Itemid
 if (empty($sefConfig->shPageNotFoundItemid)) {
     $menu =& shRouter::shGetMenu();
     $shHomePage =& $menu->getDefault();
     $vars['Itemid'] = empty($shHomePage) ? null : $shHomePage->id;
 } else {
     $vars['Itemid'] = $sefConfig->shPageNotFoundItemid;
 }
 if ($sefConfig->page404 == '9999999') {
     // V 1.2.4.t 404 goes to frontpage not allowed anymore. Protect against older
     $sefConfig->page404 == '0';
 }
 // configuration values carried over when upgrading
 if ($sefConfig->page404 == '0') {
     $sql = 'SELECT id  FROM #__content WHERE `title`="__404__"';
     $database->setQuery($sql);
     if ($id = $database->loadResult()) {
     } else {
开发者ID:justinlyon,项目名称:scc,代码行数:31,代码来源:sh404sef.inc.php

示例6: shNormalizeNonSefUri

function shNormalizeNonSefUri(&$uri, $menu = null)
{
    // put back a J!1.5 non-sef url to J! 1.0.x format
    // Get the route
    $route = $uri->getPath();
    //Get the query vars
    $vars = $uri->getQuery(true);
    // fix some problems in incoming URLs
    if (!empty($vars['Itemid'])) {
        // sometimes we get doubles : ?Itemid=xx?Itemid=xx
        $vars['Itemid'] = intval($vars['Itemid']);
        $uri->setQuery($vars);
    }
    // fix urls obtained through a single Itemid, in menus : url is option=com_xxx&Itemid=yy
    if (count($vars) == 2 && $uri->getVar('Itemid')) {
        if (empty($menu)) {
            $menu =& shRouter::shGetMenu();
        }
        $shItem = $menu->getItem($vars['Itemid']);
        if (!empty($shItem)) {
            // we found the menu item
            $url = $shItem->link . '&Itemid=' . $shItem->id;
            $uri = new JURI($url);
            // rebuild $uri based on this new url
            $uri->setPath($route);
            $vars = $uri->getQuery(true);
        }
    }
    $vars = shRemoveSlugs($vars);
    $uri->setQuery($vars);
}
开发者ID:patricmutwiri,项目名称:joomlaclube,代码行数:31,代码来源:sh404sef.class.php


注:本文中的shRouter::shGetMenu方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。