Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
trigger_condition_request_method.inc
1 <?php
17 require_once SQ_CORE_PACKAGE_PATH.'/system/triggers/trigger_condition/trigger_condition.inc';
18 
30 {
31 
32 
49  public static function evaluate($settings, &$state)
50  {
51  $type_list = Array(0 => 'GET', 1 => 'POST', 2 => 'PUT', 3 => 'DELETE');
52 
53  return ($_SERVER['REQUEST_METHOD'] == $type_list[$settings['request_method']]);
54 
55  }//end evaluate()
56 
57 
68  public static function getInterface($settings, $prefix, $write_access=FALSE)
69  {
70  $options = Array(0 => 'GET', 1 => 'POST', 2 => 'PUT', 3 => 'DELETE');
71 
72  $value = array_get_index($settings, 'request_method', 'GET');
73 
74  ob_start();
75  if ($write_access) {
76  combo_box($prefix.'[request_method]', $options, FALSE, $value);
77  } else {
78  echo '<b>'.$options[$value].'</b>';
79  }
80  $var = ob_get_contents();
81  ob_end_clean();
82 
83  return translate('trigger_request_method', $var);
84 
85  }//end getInterface()
86 
87 
97  public static function processInterface(&$settings, $request_data)
98  {
99  if (empty($request_data)) {
100  return translate('trigger_input_data_error');
101  }
102 
103  $settings['request_method'] = $request_data['request_method'];
104  return FALSE;
105 
106  }//end processInterface()
107 
108 
109 }//end class
110 
111 ?>