PHP 클래스 sfWebResponse

This class manages web reponses. It supports cookies and headers management.
저자: Fabien Potencier ([email protected])
상속: extends sfResponse
파일 보기 프로젝트 열기: lexpress/symfony1 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$cookies
$headerOnly
$headers
$httpMetas
$javascripts
$metas
$positions
$slots
$statusCode
$statusText
$statusTexts
$stylesheets

공개 메소드들

메소드 설명
addCacheControlHttpHeader ( string $name, string $value = null ) Adds an control cache http header.
addHttpMeta ( string $key, string $value, boolean $replace = true ) Adds a HTTP meta header.
addJavascript ( string $file, string $position = '', string $options = [] ) Adds javascript code to the current web response.
addMeta ( string $key, string $value, boolean $replace = true, boolean $escape = true ) Adds a meta header.
addStylesheet ( string $file, string $position = '', string $options = [] ) Adds a stylesheet to the current web response.
addVaryHttpHeader ( string $header ) Adds vary to a http header.
clearHttpHeaders ( ) Cleans HTTP headers from the current web response.
clearJavascripts ( ) Clear all previously added javascripts
clearStylesheets ( ) Clear all previously added stylesheets
copyProperties ( sfWebResponse $response ) Copies all properties from a given sfWebResponse object to the current one.
getCharset ( ) : string Gets the current charset as defined by the content type.
getContentType ( ) : array Gets response content type.
getCookies ( ) : array Retrieves cookies from the current web response.
getDate ( string $timestamp, string $type = 'rfc1123' ) : string Retrieves a formated date.
getHttpHeader ( string $name, string $default = null ) : string Gets HTTP header current value.
getHttpHeaders ( ) : string Retrieves HTTP headers from the current web response.
getHttpMetas ( ) : string Retrieves meta headers for the current web response.
getJavascripts ( string $position = self::ALL ) : array Retrieves javascript files from the current web response.
getMetas ( ) : array Retrieves all meta headers.
getPositions ( ) : array Returns the available position names for stylesheets and javascripts in order.
getSlots ( ) : string Retrieves slots from the current web response.
getStatusCode ( ) : integer Retrieves status code for the current web response.
getStatusText ( ) : string Retrieves status text for the current web response.
getStylesheets ( string $position = self::ALL ) : array Retrieves stylesheets for the current web response.
getTitle ( ) : string Retrieves title for the current web response.
hasHttpHeader ( string $name ) : boolean Checks if response has given HTTP header.
initialize ( sfEventDispatcher $dispatcher, array $options = [] ) : boolean Initializes this sfWebResponse.
isHeaderOnly ( ) : boolean Returns if the response must only consist of HTTP headers.
merge ( sfWebResponse $response ) Merges all properties from a given sfWebResponse object to the current one.
prependTitle ( string $title, string $separator = ' - ', boolean $escape = true ) Preprend title
removeJavascript ( string $file ) Removes a JavaScript file from the current web response.
removeStylesheet ( string $file ) Removes a stylesheet from the current web response.
send ( ) Sends the HTTP headers and the content.
sendContent ( ) Send content for the current web response.
sendHttpHeaders ( ) Sends HTTP headers and cookies. Only the first invocation of this method will send the headers.
serialize ( )
setContentType ( string $value ) Sets response content type.
setCookie ( string $name, string $value, string $expire = null, string $path = '/', string $domain = '', boolean $secure = false, boolean $httpOnly = false ) Sets a cookie.
setHeaderOnly ( boolean $value = true ) Sets if the response consist of just HTTP headers.
setHttpHeader ( string $name, string $value, boolean $replace = true ) Sets a HTTP header.
setSlot ( string $name, string $content ) Sets a slot content.
setStatusCode ( string $code, string $name = null ) Sets response status code.
setTitle ( string $title, boolean $escape = true ) Sets title for the current web response.
unserialize ( $serialized )

보호된 메소드들

메소드 설명
fixContentType ( string $contentType ) : string Fixes the content type by adding the charset for text content types.
normalizeHeaderName ( string $name ) : string Retrieves a normalized Header.
validatePosition ( string $position ) Validate a position name.

메소드 상세

addCacheControlHttpHeader() 공개 메소드

Adds an control cache http header.
public addCacheControlHttpHeader ( string $name, string $value = null )
$name string HTTP header
$value string Value for the http header

addHttpMeta() 공개 메소드

Adds a HTTP meta header.
public addHttpMeta ( string $key, string $value, boolean $replace = true )
$key string Key to replace
$value string HTTP meta header value (if null, remove the HTTP meta)
$replace boolean Replace or not

addJavascript() 공개 메소드

Adds javascript code to the current web response.
public addJavascript ( string $file, string $position = '', string $options = [] )
$file string The JavaScript file
$position string Position
$options string Javascript options

addMeta() 공개 메소드

Adds a meta header.
public addMeta ( string $key, string $value, boolean $replace = true, boolean $escape = true )
$key string Name of the header
$value string Meta header value (if null, remove the meta)
$replace boolean true if it's replaceable
$escape boolean true for escaping the header

addStylesheet() 공개 메소드

Adds a stylesheet to the current web response.
public addStylesheet ( string $file, string $position = '', string $options = [] )
$file string The stylesheet file
$position string Position
$options string Stylesheet options

addVaryHttpHeader() 공개 메소드

Adds vary to a http header.
public addVaryHttpHeader ( string $header )
$header string HTTP header

clearHttpHeaders() 공개 메소드

Cleans HTTP headers from the current web response.
public clearHttpHeaders ( )

clearJavascripts() 공개 메소드

Clear all previously added javascripts
public clearJavascripts ( )

clearStylesheets() 공개 메소드

Clear all previously added stylesheets
public clearStylesheets ( )

copyProperties() 공개 메소드

Copies all properties from a given sfWebResponse object to the current one.
public copyProperties ( sfWebResponse $response )
$response sfWebResponse An sfWebResponse instance

fixContentType() 보호된 메소드

Fixes the content type by adding the charset for text content types.
protected fixContentType ( string $contentType ) : string
$contentType string The content type
리턴 string The content type with the charset if needed

getCharset() 공개 메소드

Gets the current charset as defined by the content type.
public getCharset ( ) : string
리턴 string The current charset

getContentType() 공개 메소드

Gets response content type.
public getContentType ( ) : array
리턴 array

getCookies() 공개 메소드

Retrieves cookies from the current web response.
public getCookies ( ) : array
리턴 array Cookies

getDate() 공개 정적인 메소드

Retrieves a formated date.
public static getDate ( string $timestamp, string $type = 'rfc1123' ) : string
$timestamp string Timestamp
$type string Format type
리턴 string Formatted date

getHttpHeader() 공개 메소드

Gets HTTP header current value.
public getHttpHeader ( string $name, string $default = null ) : string
$name string HTTP header name
$default string Default value returned if named HTTP header is not found
리턴 string

getHttpHeaders() 공개 메소드

Retrieves HTTP headers from the current web response.
public getHttpHeaders ( ) : string
리턴 string HTTP headers

getHttpMetas() 공개 메소드

Retrieves meta headers for the current web response.
public getHttpMetas ( ) : string
리턴 string Meta headers

getJavascripts() 공개 메소드

By default, the position is sfWebResponse::ALL, and the method returns all javascripts ordered by position.
public getJavascripts ( string $position = self::ALL ) : array
$position string The position
리턴 array An associative array of javascript files as keys and options as values

getMetas() 공개 메소드

Retrieves all meta headers.
public getMetas ( ) : array
리턴 array List of meta headers

getPositions() 공개 메소드

Returns the available position names for stylesheets and javascripts in order.
public getPositions ( ) : array
리턴 array An array of position names

getSlots() 공개 메소드

Retrieves slots from the current web response.
public getSlots ( ) : string
리턴 string Javascript code

getStatusCode() 공개 메소드

Retrieves status code for the current web response.
public getStatusCode ( ) : integer
리턴 integer Status code

getStatusText() 공개 메소드

Retrieves status text for the current web response.
public getStatusText ( ) : string
리턴 string Status text

getStylesheets() 공개 메소드

By default, the position is sfWebResponse::ALL, and the method returns all stylesheets ordered by position.
public getStylesheets ( string $position = self::ALL ) : array
$position string The position
리턴 array An associative array of stylesheet files as keys and options as values

getTitle() 공개 메소드

Retrieves title for the current web response.
public getTitle ( ) : string
리턴 string Title

hasHttpHeader() 공개 메소드

Checks if response has given HTTP header.
public hasHttpHeader ( string $name ) : boolean
$name string HTTP header name
리턴 boolean

initialize() 공개 메소드

Available options: * charset: The charset to use (utf-8 by default) * content_type: The content type (text/html by default) * send_http_headers: Whether to send HTTP headers or not (true by default) * http_protocol: The HTTP protocol to use for the response (HTTP/1.0 by default)
또한 보기: sfResponse
public initialize ( sfEventDispatcher $dispatcher, array $options = [] ) : boolean
$dispatcher sfEventDispatcher An sfEventDispatcher instance
$options array An array of options
리턴 boolean true, if initialization completes successfully, otherwise false

isHeaderOnly() 공개 메소드

Returns if the response must only consist of HTTP headers.
public isHeaderOnly ( ) : boolean
리턴 boolean returns true if, false otherwise

merge() 공개 메소드

Merges all properties from a given sfWebResponse object to the current one.
public merge ( sfWebResponse $response )
$response sfWebResponse An sfWebResponse instance

normalizeHeaderName() 보호된 메소드

Retrieves a normalized Header.
protected normalizeHeaderName ( string $name ) : string
$name string Header name
리턴 string Normalized header

prependTitle() 공개 메소드

Preprend title
public prependTitle ( string $title, string $separator = ' - ', boolean $escape = true )
$title string Title name
$separator string Separator string (default: " - ")
$escape boolean true, for escaping the title

removeJavascript() 공개 메소드

Removes a JavaScript file from the current web response.
public removeJavascript ( string $file )
$file string The Javascript file to remove

removeStylesheet() 공개 메소드

Removes a stylesheet from the current web response.
public removeStylesheet ( string $file )
$file string The stylesheet file to remove

send() 공개 메소드

Sends the HTTP headers and the content.
public send ( )

sendContent() 공개 메소드

Send content for the current web response.
public sendContent ( )

sendHttpHeaders() 공개 메소드

Subsequent invocations will silently do nothing. This allows certain actions to send headers early, while still using the standard controller.
public sendHttpHeaders ( )

serialize() 공개 메소드

또한 보기: sfResponse
public serialize ( )

setContentType() 공개 메소드

Sets response content type.
public setContentType ( string $value )
$value string Content type

setCookie() 공개 메소드

Sets a cookie.
public setCookie ( string $name, string $value, string $expire = null, string $path = '/', string $domain = '', boolean $secure = false, boolean $httpOnly = false )
$name string HTTP header name
$value string Value for the cookie
$expire string Cookie expiration period
$path string Path
$domain string Domain name
$secure boolean If secure
$httpOnly boolean If uses only HTTP

setHeaderOnly() 공개 메소드

Sets if the response consist of just HTTP headers.
public setHeaderOnly ( boolean $value = true )
$value boolean

setHttpHeader() 공개 메소드

Sets a HTTP header.
public setHttpHeader ( string $name, string $value, boolean $replace = true )
$name string HTTP header name
$value string Value (if null, remove the HTTP header)
$replace boolean Replace for the value

setSlot() 공개 메소드

Sets a slot content.
public setSlot ( string $name, string $content )
$name string Slot name
$content string Content

setStatusCode() 공개 메소드

Sets response status code.
public setStatusCode ( string $code, string $name = null )
$code string HTTP status code
$name string HTTP status text

setTitle() 공개 메소드

Sets title for the current web response.
public setTitle ( string $title, boolean $escape = true )
$title string Title name
$escape boolean true, for escaping the title

unserialize() 공개 메소드

또한 보기: sfResponse
public unserialize ( $serialized )

validatePosition() 보호된 메소드

Validate a position name.
protected validatePosition ( string $position )
$position string

프로퍼티 상세

$cookies 보호되어 있는 프로퍼티

protected $cookies

$headerOnly 보호되어 있는 프로퍼티

protected $headerOnly

$headers 보호되어 있는 프로퍼티

protected $headers

$httpMetas 보호되어 있는 프로퍼티

protected $httpMetas

$javascripts 보호되어 있는 프로퍼티

protected $javascripts

$metas 보호되어 있는 프로퍼티

protected $metas

$positions 보호되어 있는 프로퍼티

protected $positions

$slots 보호되어 있는 프로퍼티

protected $slots

$statusCode 보호되어 있는 프로퍼티

protected $statusCode

$statusText 보호되어 있는 프로퍼티

protected $statusText

$statusTexts 보호되어 있는 정적으로 프로퍼티

protected static $statusTexts

$stylesheets 보호되어 있는 프로퍼티

protected $stylesheets