function context_condition_keywords::execute in Context Keywords 6
Same name and namespace in other branches
- 7 context_condition_keywords.inc \context_condition_keywords::execute()
Execute.
File
- ./
context_condition_keywords.inc, line 46
Class
- context_condition_keywords
- Expose keywordss as a context condition.
Code
function execute() {
if ($this
->condition_used()) {
// Include both the keywords alias and normal keywords for matching.
if (!isset($_SESSION['HTTP_REFERER'])) {
$_SESSION['HTTP_REFERER'] = $_SERVER['HTTP_REFERER'];
}
$url = $_SESSION['HTTP_REFERER'];
// Check to see if $_GET["keywords"], if it does, check if it's a URL or individual arguments.
if ($_GET["keywords"] != '') {
if (strpos($_GET["keywords"], '/')) {
$current_keywords[] = context_keywords_provider_parse_url($_GET["keywords"]);
}
else {
$current_keywords[] = str_replace('+', ' ', $_GET["keywords"]);
}
}
else {
$current_keywords[] = context_keywords_provider_parse_url($url);
}
$default = TRUE;
foreach ($this
->get_contexts() as $context) {
$keywords = $this
->fetch_from_context($context, 'values');
if ($this
->match($current_keywords, $keywords, FALSE)) {
$default = FALSE;
$this
->condition_met($context);
}
}
if ($default) {
foreach ($this
->get_contexts() as $context) {
$keywords = $this
->fetch_from_context($context, 'values');
if ($this
->match($current_keywords, $keywords, TRUE)) {
$this
->condition_met($context);
}
}
}
}
}