Strata\Controller\Request

Handles safe access to HTTP request data, whether from POST, GET, files or cookies.

It encodes data accordingly and does basic data integrity validation.

    Synopsis

    class Request {
    }

    Members

    private

    • $_FILES — array
      A cache of the parsed Files values in the current request.
    • $_GET — array
      A cache of the parsed GET values in the current request.
    • $_POST — array
      A cache of the parsed POST values in the current request.

    Methods

    private

    • addFilesList() — Adds uploaded files to the $data array.
    • buildRequestData() — Goes through the PHP request data, sanitizes and strips additional characters added along the way.

    public

    • __construct() — PHP request data is parsed upon each Request instantiation.
    • data() — Returns the POST form parameters created using the FormHelper
    • file() — Returns the file parameter matching $key.
    • generateNonceKey() — Generated a Wordpress nonce value.
    • get() — Returns the GET parameter matching $key.
    • hasCookie() — Informs whether the cookie parameter matching $key has a value.
    • hasFile() — Informs whether the file parameter matching $key has a value.
    • hasFiles() — Returns whether the request contains uploaded files
    • hasGet() — Informs whether the GET parameter matching $key has a value.
    • hasPost() — Informs whether the POST parameter matching $key has a value.
    • honeypotValidates() — Returns whether the honeypots validates. It is expected that the $name input did not send any value when posting.
    • isDelete() — Checks if the current value is of type DELETE.
    • isGet() — Checks if the current value is of type GET.
    • isPatch() — Checks if the current value is of type PATCH.
    • isPost() — Checks if the current value is of type POST.
    • isPut() — Checks if the current value is of type PUT.
    • nonceValidates() — Attempts to confirm the validation of the Wordpress nonce.
    • post() — Returns the POST parameter matching $key.
    • requestValidates() — Returns whether the request can validate it's nonce and it's honeypot.
    • setGet() — Sets a value in Strata's version of the GET array
    • setPost() — Sets a value in Strata's version of the POST array