Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
condition_server_variable.inc
1 <?php
17 require_once SQ_CORE_PACKAGE_PATH.'/system/conditions/condition/condition.inc';
18 
33 {
34 
35 
42  function __construct($assetid=0)
43  {
44  parent::__construct($assetid);
45 
46  }//end constructor
47 
48 
58  public static function evaluate(Asset $asset, $condition_data)
59  {
60  if (!isset($condition_data['server_variable']) || !isset($condition_data['server_variable_match'])) {
61  return FALSE;
62  }
63  $server_var_index = $condition_data['server_variable'];
64  $server_var_match = $condition_data['server_variable_match'];
65  $matches = preg_match('/'.$server_var_match.'/i', array_get_index($_SERVER, $server_var_index, ''));
66  return ($matches > 0);
67 
68  }//end evaluate()
69 
70 
71 }//end class
72 
73 ?>