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


PHP SEFTools::isItemidIgnored方法代码示例

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


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

示例1: getSefUrlFromDatabase

 function getSefUrlFromDatabase(&$uri)
 {
     $db =& JFactory::getDBO();
     $sefConfig =& SEFConfig::getConfig();
     // David (284): ignore Itemid if set to
     $where = '';
     // Get the extension's ignoreSource parameter
     $option = $uri->getVar('option');
     if (!is_null($option)) {
         $params = SEFTools::getExtParams($option);
         $extIgnore = $params->get('ignoreSource', 2);
     } else {
         $extIgnore = 2;
     }
     $ignoreSource = $extIgnore == 2 ? $sefConfig->ignoreSource : $extIgnore;
     $Itemid = $uri->getVar('Itemid');
     // If Itemid is set as ignored for the component, set ignoreSource to 1
     if (!is_null($Itemid) && !is_null($option)) {
         if (SEFTools::isItemidIgnored($option, $Itemid)) {
             $ignoreSource = 1;
         }
     }
     if (!$ignoreSource && !is_null($Itemid)) {
         $where = " AND (`Itemid` = '" . $Itemid . "' OR `Itemid` IS NULL)";
     }
     $origurl = $db->Quote(html_entity_decode(urldecode(JoomSEF::_uriToUrl($uri, 'Itemid'))));
     $query = "SELECT * FROM `#__sefurls` WHERE `origurl` = {$origurl}" . $where . " AND (`trashed` = '0') LIMIT 2";
     $db->setQuery($query);
     $sefurls = $db->loadObjectList('Itemid');
     if (!$ignoreSource && !is_null($Itemid)) {
         if (isset($sefurls[$Itemid])) {
             $result = $sefurls[$Itemid];
         } else {
             if (isset($sefurls[''])) {
                 // We've found one of the ignored Itemids, update it with the current and return
                 $result = $sefurls[''];
                 $result->Itemid = $Itemid;
                 $query = "UPDATE `#__sefurls` SET `Itemid` = '{$Itemid}' WHERE `id` = '{$result->id}' LIMIT 1";
                 $db->setQuery($query);
                 $db->query();
             } else {
                 $result = reset($sefurls);
             }
         }
     } else {
         $result = reset($sefurls);
     }
     return is_object($result) ? $result : false;
     /*
     // removed - was causing problems
     $sefurls = $db->loadObjectList('Itemid');
     // test if current Itemid record exists, if YES, use it, if NO, use first found
     if (isset($sefurls[$Itemid])) $active = $sefurls[$Itemid]; 
     elseif ($ignoreSource) $active = reset($sefurls);
     //if (isset($active)) $result = $active->sefurl;
     
     return isset($active) ? $active : false;
     */
 }
开发者ID:lautarodragan,项目名称:ideary,代码行数:59,代码来源:sef.ext.php

示例2: getSefUrlFromDatabase

 function getSefUrlFromDatabase(&$uri)
 {
     $db =& JFactory::getDBO();
     $sefConfig =& SEFConfig::getConfig();
     // David (284): ignore Itemid if set to
     $where = '';
     // Get the extension's ignoreSource parameter
     $option = $uri->getVar('option');
     if (!is_null($option)) {
         $params = SEFTools::getExtParams($option);
         $extIgnore = $params->get('ignoreSource', 2);
     } else {
         $extIgnore = 2;
     }
     $ignoreSource = $extIgnore == 2 ? $sefConfig->ignoreSource : $extIgnore;
     $Itemid = $uri->getVar('Itemid');
     // If Itemid is set as ignored for the component, set ignoreSource to 1
     if (!is_null($Itemid) && !is_null($option)) {
         if (SEFTools::isItemidIgnored($option, $Itemid)) {
             $ignoreSource = 1;
         }
     }
     if (!$ignoreSource && !is_null($Itemid)) {
         $where = " AND (`Itemid` = '" . $Itemid . "' OR `Itemid` IS NULL)";
     }
     $origurl = addslashes(html_entity_decode(urldecode(JoomSEF::_uriToUrl($uri, 'Itemid'))));
     $query = "SELECT * FROM `#__sefurls` WHERE `origurl` = '" . $origurl . "'" . $where . ' LIMIT 2';
     $this->_db->setQuery($query);
     //echo "<b>".str_replace('#__','jos_',$query)."</b><br><br>";
     $sefurls = $this->_db->loadObjectList('Itemid');
     if (!is_array($sefurls)) {
         return false;
     }
     if (!$ignoreSource && !is_null($Itemid)) {
         if (isset($sefurls[$Itemid])) {
             $result = $sefurls[$Itemid];
         } else {
             if (isset($sefurls[''])) {
                 // We've found one of the ignored Itemids, update it with the current and return
                 $result = $sefurls[''];
                 $result->Itemid = $Itemid;
                 $query = "UPDATE `#__sefurls` SET `Itemid` = '{$Itemid}' WHERE `id` = '{$result->id}' LIMIT 1";
                 $this->_db->setQuery($query);
                 $this->_db->query();
             } else {
                 $result = reset($sefurls);
             }
         }
     } else {
         $result = reset($sefurls);
     }
     return is_object($result) ? $result : false;
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:53,代码来源:sef.ext.php

示例3: _storeLocation


//.........这里部分代码省略.........
                 // Accepted variables
                 if (in_array($name, $acceptVars)) {
                     continue;
                 }
                 // Variable not accepted, add it to non-SEF part of the URL
                 $value = urlencode($value);
                 if (strlen($nonSefUrl) > 0) {
                     $nonSefUrl .= '&amp;' . $name . '=' . $value;
                 } else {
                     $nonSefUrl = '?' . $name . '=' . $value;
                 }
                 $uri->delVar($name);
             }
         }
     }
     // always remove Itemid and store it in a separate column
     if (!is_null($uri->getVar('Itemid'))) {
         $Itemid = $uri->getVar('Itemid');
         $uri->delVar('Itemid');
     }
     // 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.
     // David (284): ignore Itemid if set to
     if (isset($params)) {
         $extIgnore = $params->get('ignoreSource', 2);
     } else {
         $extIgnore = 2;
     }
     $ignoreSource = $extIgnore == 2 ? $sefConfig->ignoreSource : $extIgnore;
     // If Itemid is set as ignored for the component, set ignoreSource to 1
     $itemidIgnored = false;
     if (isset($Itemid) && !is_null($uri->getVar('option'))) {
         $itemidIgnored = SEFTools::isItemidIgnored($uri->getVar('option'), $Itemid);
         if ($itemidIgnored) {
             $ignoreSource = 1;
         }
     }
     $where = '';
     if (!$ignoreSource && isset($Itemid)) {
         $where .= " AND (`Itemid` = '" . $Itemid . "' OR `Itemid` IS NULL)";
     }
     $url = JoomSEF::_uriToUrl($uri);
     // if cache is activated, search in cache first
     $realloc = false;
     if ($sefConfig->useCache) {
         if (!$check) {
             $realloc = $cache->GetSefUrl($url, @$Itemid);
         }
     }
     // search if URL exists, if we do not use cache or URL was not cached
     if (!$sefConfig->useCache || !$realloc) {
         $query = "SELECT * FROM `#__sefurls` WHERE `origurl` = '" . addslashes(html_entity_decode(urldecode($url))) . "'" . $where . ' LIMIT 2';
         $db->setQuery($query);
         $sefurls = $db->loadObjectList('Itemid');
         if (!$ignoreSource && isset($Itemid)) {
             if (isset($sefurls[$Itemid])) {
                 $realloc = $sefurls[$Itemid];
             } else {
                 if (isset($sefurls[''])) {
                     // We've found one of the ignored Itemids, update it with the current and return
                     $realloc = $sefurls[''];
                     $realloc->Itemid = $Itemid;
                     $query = "UPDATE `#__sefurls` SET `Itemid` = '{$Itemid}' WHERE `id` = '{$realloc->id}' LIMIT 1";
                     $db->setQuery($query);
                     $db->query();
开发者ID:01J,项目名称:bealtine,代码行数:67,代码来源:joomsef.php

示例4: getSefUrl

 /**
  * Tries to find a SEF URL corresponding with given nonSEF URL
  *
  * @param string $nonsef
  * @param string $Itemid
  * @return string
  */
 function getSefUrl($nonsef, $Itemid = null)
 {
     $sefConfig =& SEFConfig::getConfig();
     // Load the cache if needed
     if (!$this->cacheLoaded) {
         $this->LoadCache();
     }
     // Check if the cache was loaded successfully
     if (!$this->cacheLoaded) {
         return false;
     }
     // Check if non-sef url doesn't contain Itemid
     $vars = array();
     parse_str(str_replace('index.php?', '', $nonsef), $vars);
     if (is_null($Itemid) && strpos($nonsef, 'Itemid=')) {
         if (isset($vars['Itemid'])) {
             $Itemid = $vars['Itemid'];
         }
         $nonsef = SEFTools::removeVariable($nonsef, 'Itemid');
     }
     // Get the ignoreSource parameter
     if (isset($vars['option'])) {
         $params = SEFTools::getExtParams($vars['option']);
         $extIgnore = $params->get('ignoreSource', 2);
     } else {
         $extIgnore = 2;
     }
     $ignoreSource = $extIgnore == 2 ? $sefConfig->ignoreSource : $extIgnore;
     // If Itemid is set as ignored for the component, set ignoreSource to 1
     if (!is_null($Itemid) && isset($vars['option'])) {
         if (SEFTools::isItemidIgnored($vars['option'], $Itemid)) {
             $ignoreSource = 1;
         }
     }
     // Get all sef urls matching non-sef url
     if (isset($this->cache[$nonsef]) && is_array($this->cache[$nonsef]) && count($this->cache[$nonsef]) > 0) {
         // Search with Itemid if set to and Itemid set
         if (!$ignoreSource && !is_null($Itemid)) {
             $nullId = null;
             for ($i = 0, $n = count($this->cache[$nonsef]); $i < $n; $i++) {
                 $row = $this->cache[$nonsef][$i];
                 if (isset($row->Itemid) && $row->Itemid == $Itemid) {
                     return $row;
                 }
                 if (empty($row->Itemid)) {
                     $nullId = $i;
                 }
             }
             // Not found with correct itemid, try to find without itemid
             if (!is_null($nullId)) {
                 // Update Itemid in cache
                 $this->cache[$nonsef][$i]->Itemid = $Itemid;
                 $row = $this->cache[$nonsef][$i];
                 // Save the cache
                 $this->saveCache();
                 // Return found row
                 return $row;
             }
         } else {
             return $this->cache[$nonsef][0];
         }
     }
     // URL does not exist in the cache
     return false;
 }
开发者ID:andreassetiawanhartanto,项目名称:PDKKI,代码行数:72,代码来源:sef.cache.php


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