You are here

function contextphp_condition_php::execute in Context PHP 6

Same name and namespace in other branches
  1. 7 plugins/contextphp_condition_php.inc \contextphp_condition_php::execute()

File

plugins/contextphp_condition_php.inc, line 38

Class

contextphp_condition_php
PHP code as a Context condition.

Code

function execute() {
  foreach (context_enabled_contexts() as $context) {
    $options = $this
      ->fetch_from_context($context, 'options');
    if (!empty($options['phpcode'])) {
      $code = '<?php ' . $options['phpcode'] . ' ?>';
      $return = drupal_eval($code);
      if ($return == TRUE) {
        $this
          ->condition_met($context, $return);
      }
    }
  }
}