symfony API

sfWebRequest Class

« Back to API menu

1.0 API OpenSearch

Packages

You are currently browsing the symfony API for the 1.0 version. Switch to:

sfWebRequest class.

Inheritence

sfWebRequest  <  sfRequest

Method Summary

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

Methods inherited from sfRequest

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

Method Details

  • (string) getReferer () Browse code

    Returns referer.

  • setRelativeUrlRoot ($value) Browse code

    $value Value for the url

    Sets the relative root url for the current web request.

  • (string) getMethodName () Browse code

    Returns request method.

  • (Array) pathsToArray ($str) Browse code

    $str A string representing an array

    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

  • (array) getAcceptableContentTypes () Browse code

    Gets a list of content types acceptable by the client browser

    returns Languages ordered in the user browser preferences

  • shutdown () Browse code

    Executes the shutdown procedure.

  • (boolean) isSecure () Browse code

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

  • (boolean) hasFile ($name) Browse code

    $name A file name

    Indicates whether or not a file exists.

    returns true, if the file exists, otherwise false

  • (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

  • (array) getCharsets () Browse code

    Gets a list of charsets acceptable by the client browser.

    returns List of charsets in preferable order

  • (array) convertFileInformation ($taintedFiles) Browse code

    $taintedFiles An array representing uploaded file information

    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

  • (string) getFileExtension ($name) Browse code

    $name A file name

    Retrieves an extension for a given file.

    returns Extension for the file

  • (array) getFiles () Browse code

    Retrieves an array of files.

    returns An associative array of files

  • (string) getFilePath ($name) Browse code

    $name A file name

    Retrieves a file path.

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

  • (boolean) hasFiles () Browse code

    Indicates whether or not any files exist.

    returns true, if any files exist, otherwise false

  • (boolean) initialize ((sfContext) $context, $parameters = array(), $attributes = array()) Browse code

    $context A sfContext instance
    $parameters An associative array of initialization parameters
    $attributes An associative array of initialization attributes

    Initializes this sfRequest.

    returns true, if initialization completes successfully, otherwise false

    throws sfInitializationException If an error occurs while initializing this Request

  • (string) getPathInfo () Browse code

    Retrieves the path info for the current web request.

    returns Path info

  • (string) getFileValue ($name, $key) Browse code

    $name A file name
    $key Value to search in the file

    Retrieves a file value.

    returns File value

  • (int) getFileSize ($name) Browse code

    $name A file name

    Retrieve a file size.

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

  • (int) getFileError ($name) Browse code

    $name A file name

    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)

  • (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

  • (string) getFileType ($name) Browse code

    $name A file name

    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

  • (array) getLanguages () Browse code

    Gets a list of languages acceptable by the client browser

    returns Languages ordered in the user browser preferences

  • (array) getFileValues ($name) Browse code

    $name A file name

    Retrieves all the values from a file.

    returns Associative list of the file values

  • splitHttpAcceptHeader ($header) Browse code

    $header Header to split

    Splits an HTTP header for the current web request.

  • (string) getUriPrefix () Browse code

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

    returns Uniform resource identifier prefix

  • (boolean) moveFile ($name, $file, $fileMode = 0666, $create = true, $dirMode = 0777) Browse code

    $name A file name
    $file An absolute filesystem path to where you would like the file moved. This includes the new filename as well, since uploaded files are stored with random names
    $fileMode The octal mode to use for the new file
    $create Indicates that we should make the directory before moving the file
    $dirMode The octal mode to use when creating the directory

    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

  • (boolean) hasFileErrors () Browse code

    Indicates whether or not any file errors occured.

    returns true, if any file errors occured, otherwise false

  • (string) getHost () Browse code

    Returns current host name.

  • (boolean) hasFileError ($name) Browse code

    $name A file name

    Indicates whether or not a file error exists.

    returns true, if the file error exists, otherwise false

  • (string) getFileName ($name) Browse code

    $name A file nam.

    Retrieves a file name.

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

  • (array) getFile ($name) Browse code

    $name A file name

    Retrieves an array of file information.

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

  • getHttpHeader ($name, $prefix = 'http') Browse code

    $name
    $prefix

  • (array) getFileNames () Browse code

    Retrieves an array of file names.

    returns An indexed array of file names

  • (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) arrayToPaths ((Array) $array = array(), $prefix = '') Browse code

    $array An array
    $prefix

    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

  • (mixed) getCookie ($name, $defaultValue = null) Browse code

    $name
    $defaultValue

    Gets a cookie value.

  • (string) getRelativeUrlRoot () Browse code

    Retrieves relative root url.

    returns URL

  • (boolean) isAbsUri () Browse code

    See if the client is using absolute uri

    returns true, if is absolute uri otherwise false

  • loadParameters () Browse code

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

The Sensio Labs Network

Since 1998, Sensio Labs has been promoting the Open-Source software movement by providing quality web application development, training, consulting, and supporting several large Open-Source projects.