symfony API

sfWebRequest Class

You are currently browsing
the website for symfony 1

Visit the Symfony2 website


« Back to API menu

1.0 API OpenSearch

Packages

You are currently browsing the symfony API for the 1.0 version. Switch to:
This version of symfony is not maintained anymore.
If some of your projects still use this version, consider upgrading as soon as possible.

sfWebRequest class.

Inheritence

sfWebRequest  <  sfRequest

Method Summary

  • string arrayToPaths()
    Converts an array into a string containing the path to each of its values separated by a newline.
  • array convertFileInformation()
    Converts uploaded file array to a format following the $_GET and $POST naming convention.
  • array getAcceptableContentTypes()
    Gets a list of content types acceptable by the client browser
  • array getCharsets()
    Gets a list of charsets acceptable by the client browser.
  • mixed getCookie()
    Gets a cookie value.
  • array getFile()
    Retrieves an array of file information.
  • int getFileError()
    Retrieves a file error.
  • string getFileExtension()
    Retrieves an extension for a given file.
  • string getFileName()
    Retrieves a file name.
  • array getFileNames()
    Retrieves an array of file names.
  • string getFilePath()
    Retrieves a file path.
  • array getFiles()
    Retrieves an array of files.
  • int getFileSize()
    Retrieve a file size.
  • string getFileType()
    Retrieves a file type.
  • string getFileValue(, )
    Retrieves a file value.
  • array getFileValues()
    Retrieves all the values from a file.
  • string getHost()
    Returns current host name.
  • getHttpHeader()
  • array getLanguages()
    Gets a list of languages acceptable by the client browser
  • string getMethodName()
    Returns request method.
  • string getPathInfo()
    Retrieves the path info for the current web request.
  • array getPathInfoArray()
    Returns the array that contains all request information ($_SERVER or $_ENV).
  • string getReferer()
    Returns referer.
  • string getRelativeUrlRoot()
    Retrieves relative root url.
  • string getScriptName()
    Returns current script name.
  • string getUri()
    Retrieves the uniform resource identifier for the current web request.
  • string getUriPrefix()
    Returns Uri prefix, including protocol, hostname and server port.
  • boolean hasFile()
    Indicates whether or not a file exists.
  • boolean hasFileError()
    Indicates whether or not a file error exists.
  • boolean hasFileErrors()
    Indicates whether or not any file errors occured.
  • boolean hasFiles()
    Indicates whether or not any files exist.
  • boolean initialize(, , )
    Initializes this sfRequest.
  • boolean isAbsUri()
    See if the client is using absolute uri
  • boolean isSecure()
    Returns true if the current request is secure (HTTPS protocol).
  • Boolean isXmlHttpRequest()
    Returns true if the request is a XMLHttpRequest.
  • loadParameters()
    Loads GET, PATH_INFO and POST data into the parameter list.
  • boolean moveFile(, , , , )
    Moves an uploaded file.
  • Array pathsToArray()
    Converts a string of paths separated by newlines into an array.
  • setRelativeUrlRoot()
    Sets the relative root url for the current web request.
  • shutdown()
    Executes the shutdown procedure.
  • splitHttpAcceptHeader()
    Splits an HTTP header for the current web request.

Methods inherited from sfRequest

& , getAttribute , getAttributeHolder , getContext , getError , getErrorNames , getErrors , getMethod , getParameter , getParameterHolder , hasAttribute , hasError , hasErrors , hasParameter , initialize , newInstance , setAttribute , setError , setErrors , setMethod , setParameter , shutdown , __call

Method Details

  • (string) arrayToPaths () Browse code

    Converts an array into a string containing the path to each of its values separated by a newline.


    Code adapted from http://www.shauninman.com/archive/2006/11/30/fixing_the_files_superglobal

    returns A string representing the array

  • (array) convertFileInformation () Browse code

    Converts uploaded file array to a format following the $_GET and $POST naming convention.


    It's safe to pass an already converted array, in which case this method just returns the original array unmodified.

    returns An array of re-ordered uploaded file information

  • (array) getAcceptableContentTypes () Browse code

    Gets a list of content types acceptable by the client browser

    returns Languages ordered in the user browser preferences

  • (array) getCharsets () Browse code

    Gets a list of charsets acceptable by the client browser.

    returns List of charsets in preferable order

  • (mixed) getCookie () Browse code

    Gets a cookie value.

  • (array) getFile () Browse code

    Retrieves an array of file information.

    returns An associative array of file information, if the file exists, otherwise null

  • (int) getFileError () Browse code

    Retrieves a file error.

    returns One of the following error codes: - UPLOAD_ERR_OK (no error) - UPLOAD_ERR_INI_SIZE (the uploaded file exceeds the upload_max_filesize directive in php.ini) - UPLOAD_ERR_FORM_SIZE (the uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form) - UPLOAD_ERR_PARTIAL (the uploaded file was only partially uploaded) - UPLOAD_ERR_NO_FILE (no file was uploaded)

  • (string) getFileExtension () Browse code

    Retrieves an extension for a given file.

    returns Extension for the file

  • (string) getFileName () Browse code

    Retrieves a file name.

    returns A file name, if the file exists, otherwise null

  • (array) getFileNames () Browse code

    Retrieves an array of file names.

    returns An indexed array of file names

  • (string) getFilePath () Browse code

    Retrieves a file path.

    returns A file path, if the file exists, otherwise null

  • (array) getFiles () Browse code

    Retrieves an array of files.

    returns An associative array of files

  • (int) getFileSize () Browse code

    Retrieve a file size.

    returns A file size, if the file exists, otherwise null

  • (string) getFileType () Browse code

    Retrieves a file type.


    This may not be accurate. This is the mime-type sent by the browser
    during the upload.

    returns A file type, if the file exists, otherwise null

  • (string) getFileValue (, ) Browse code

    Retrieves a file value.

    returns File value

  • (array) getFileValues () Browse code

    Retrieves all the values from a file.

    returns Associative list of the file values

  • (string) getHost () Browse code

    Returns current host name.

  • getHttpHeader () Browse code

  • (array) getLanguages () Browse code

    Gets a list of languages acceptable by the client browser

    returns Languages ordered in the user browser preferences

  • (string) getMethodName () Browse code

    Returns request method.

  • (string) getPathInfo () Browse code

    Retrieves the path info for the current web request.

    returns Path info

  • (array) getPathInfoArray () Browse code

    Returns the array that contains all request information ($_SERVER or $_ENV).


    This information is stored in the [sf_path_info_array] constant.

    returns Path information

  • (string) getReferer () Browse code

    Returns referer.

  • (string) getRelativeUrlRoot () Browse code

    Retrieves relative root url.

    returns URL

  • (string) getScriptName () Browse code

    Returns current script name.

  • (string) getUri () Browse code

    Retrieves the uniform resource identifier for the current web request.

    returns Unified resource identifier

  • (string) getUriPrefix () Browse code

    Returns Uri prefix, including protocol, hostname and server port.

    returns Uniform resource identifier prefix

  • (boolean) hasFile () Browse code

    Indicates whether or not a file exists.

    returns true, if the file exists, otherwise false

  • (boolean) hasFileError () Browse code

    Indicates whether or not a file error exists.

    returns true, if the file error exists, otherwise false

  • (boolean) hasFileErrors () Browse code

    Indicates whether or not any file errors occured.

    returns true, if any file errors occured, otherwise false

  • (boolean) hasFiles () Browse code

    Indicates whether or not any files exist.

    returns true, if any files exist, otherwise false

  • (boolean) initialize (, , ) Browse code

    Initializes this sfRequest.

    returns true, if initialization completes successfully, otherwise false

    throws sfInitializationException If an error occurs while initializing this Request

  • (boolean) isAbsUri () Browse code

    See if the client is using absolute uri

    returns true, if is absolute uri otherwise false

  • (boolean) isSecure () Browse code

    Returns true if the current request is secure (HTTPS protocol).

  • (Boolean) isXmlHttpRequest () Browse code

    Returns true if the request is a XMLHttpRequest.


    It works if your JavaScript library set an X-Requested-With HTTP header.
    Works with Prototype, Mootools, jQuery, and perhaps others.

    returns true if the request is an XMLHttpRequest, false otherwise

  • loadParameters () Browse code

    Loads GET, PATH_INFO and POST data into the parameter list.

  • (boolean) moveFile (, , , , ) Browse code

    Moves an uploaded file.

    returns true, if the file was moved, otherwise false

    throws sfFileException If a major error occurs while attempting to move the file

  • (Array) pathsToArray () Browse code

    Converts a string of paths separated by newlines into an array.


    Code adapted from http://www.shauninman.com/archive/2006/11/30/fixing_the_files_superglobal

    returns An array

  • setRelativeUrlRoot () Browse code

    Sets the relative root url for the current web request.

  • shutdown () Browse code

    Executes the shutdown procedure.

  • splitHttpAcceptHeader () Browse code

    Splits an HTTP header for the current web request.