context_condition_query_string.inc 704 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. /**
  3. * @file context_condition_query_string.inc
  4. *
  5. * Similar to context_condition_path but for entire query string.
  6. */
  7. /**
  8. * Expose query strings as a context condition.
  9. */
  10. class context_condition_query_string extends context_condition_path {
  11. /**
  12. * Execute.
  13. */
  14. function execute() {
  15. if ($this->condition_used()) {
  16. $current_query_string = empty($_SERVER["QUERY_STRING"]) ? '' : $_SERVER["QUERY_STRING"];
  17. foreach ($this->get_contexts() as $context) {
  18. $query_strings = $this->fetch_from_context($context, 'values');
  19. if ($this->match($current_query_string, $query_strings, TRUE)) {
  20. $this->condition_met($context);
  21. }
  22. }
  23. }
  24. }
  25. }