public function getCheck( $name ) {
# Checkboxes and buttons are only present when clicked
# Presence connotes truth, abscense false
- $val = $this->getVal( $name, null );
- return isset( $val );
+ return $this->getVal( $name, null ) !== null;
}
/**
return $_GET;
}
+ /**
+ * Get the HTTP method used for this request.
+ *
+ * @return String
+ */
+ public function getMethod() {
+ return isset( $_SERVER['REQUEST_METHOD'] ) ? $_SERVER['REQUEST_METHOD'] : 'GET';
+ }
+
/**
* Returns true if the present request was reached by a POST operation,
* false otherwise (GET, HEAD, or command-line).
* @return Boolean
*/
public function wasPosted() {
- return isset( $_SERVER['REQUEST_METHOD'] ) && $_SERVER['REQUEST_METHOD'] == 'POST';
+ return $this->getMethod() == 'POST';
}
/**
}
}
+ public function getMethod() {
+ return $this->wasPosted ? 'POST' : 'GET';
+ }
+
/**
* @return bool
*/