本文整理汇总了PHP中SEFTools::RemoveVariables方法的典型用法代码示例。如果您正苦于以下问题:PHP SEFTools::RemoveVariables方法的具体用法?PHP SEFTools::RemoveVariables怎么用?PHP SEFTools::RemoveVariables使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SEFTools
的用法示例。
在下文中一共展示了SEFTools::RemoveVariables方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _storeLocation
//.........这里部分代码省略.........
}
} while (strlen($location) > $maxlen);
}
// remove variables we don't want to be included in non-SEF URL
// and build the non-SEF part of our SEF URL
$nonSefUrl = '';
// load the nonSEF vars from option parameters
$paramNonSef = array();
if (isset($params)) {
$nsef = $params->get('customNonSef', '');
if (!empty($nsef)) {
// Some variables are set, let's explode them
$paramNonSef = explode(';', $nsef);
}
}
// get globally configured nonSEF vars
$configNonSef = array();
if (!empty($sefConfig->customNonSef)) {
$configNonSef = explode(';', $sefConfig->customNonSef);
}
// combine all the nonSEF vars arrays
$nsefvars = array_merge($paramNonSef, $configNonSef);
if (!empty($nsefvars)) {
foreach ($nsefvars as $nsefvar) {
// add each variable, that isn't already set, and that is present in our URL
if (!isset($nonSefVars[$nsefvar]) && !is_null($uri->getVar($nsefvar))) {
$nonSefVars[$nsefvar] = $uri->getVar($nsefvar);
}
}
}
// nonSefVars - variables to exclude only if set to in configuration
if ($sefConfig->appendNonSef && isset($nonSefVars)) {
$vars = array_keys($nonSefVars);
$q = SEFTools::RemoveVariables($uri, $vars);
if ($q != '') {
if ($nonSefUrl == '') {
$nonSefUrl = '?' . $q;
} else {
$nonSefUrl .= '&' . $q;
}
}
// if $nonSefVars mixes with $GLOBALS['JOOMSEF_NONSEFVARS'], exclude the mixed vars
// this is important to prevent duplicating params by adding JOOMSEF_NONSEFVARS to
// $ignoreSefVars
$gNonSef = JoomSEF::get('sef.global.nonsefvars');
if (!empty($gNonSef)) {
foreach (array_keys($gNonSef) as $key) {
if (in_array($key, array_keys($nonSefVars))) {
unset($gNonSef[$key]);
}
}
JoomSEF::set('sef.global.nonsefvars', $gNonSef);
}
}
// if there are global variables to exclude, add them to ignoreSefVars array
$gNonSef = JoomSEF::get('sef.global.nonsefvars');
if (!empty($gNonSef)) {
if (!empty($ignoreSefVars)) {
$ignoreSefVars = array_merge($gNonSef, $ignoreSefVars);
} else {
$ignoreSefVars = $gNonSef;
}
}
// ignoreSefVars - variables to exclude allways
if (isset($ignoreSefVars)) {
$vars = array_keys($ignoreSefVars);
示例2: normalizeURI
function normalizeURI(&$uri)
{
$option = $uri->getVar('option');
if (!is_null($option)) {
$extfile = JPATH_ROOT . '/components/com_sef/sef_ext/' . $option . '.php';
if (file_exists($extfile)) {
require_once $extfile;
$class = 'SefExt_' . $option;
$ext = new $class();
$ext->beforeCreate($uri);
list($nonsef, $ignore) = $ext->getNonSefVars($uri);
if (!empty($ignore)) {
$nonsef = array_merge($nonsef, $ignore);
}
$keys = array_keys($nonsef);
SEFTools::RemoveVariables($uri, $keys);
}
}
}