public static function FacetapiUrlProcessorSession::clearSession in Facet API Bonus 7
Clear the session.
Parameters
$searcher: The name of the searcher that we want to clear. If NULL we'll clear them all.
$namespace: Leave NULL to get the current namespace, TRUE to clear all or specify a namespace as a string to target a specific one.
File
- modules/
facetapi_bonus_session/ includes/ facetapi/ url_processor_session.inc, line 128 - A facet handler that falls back onto session set variables.
Class
- FacetapiUrlProcessorSession
- Url processor plugin that retrieves facet data from the query string.
Code
public static function clearSession($searcher = NULL, $namespace = NULL) {
if ($namespace == NULL) {
$namespace = self::getNamespace();
}
if ($searcher) {
if ($namespace === TRUE) {
// Entirely clear this searcher.
unset($_SESSION['facetapi']['url_processor_session'][$searcher]);
}
else {
// Clear a specific namespace.
unset($_SESSION['facetapi']['url_processor_session'][$searcher][$namespace]);
}
}
elseif ($namespace === TRUE) {
// Clear everything.
unset($_SESSION['facetapi']['url_processor_session']);
}
elseif ($namespace) {
// Clear a specific namespace in all searchers.
if (isset($_SESSION['facetapi']['url_processor_session'])) {
foreach ($_SESSION['facetapi']['url_processor_session'] as &$searcher) {
unset($searcher[$namespace]);
}
}
}
}