PHP Class PMA\libraries\Response

Mostra file Open project: phpmyadmin/phpmyadmin Class Usage Examples

Public Methods

Method Description
addHTML ( string $content ) : void Add HTML code to the response
addJSON ( mixed $json, mixed $value = null ) : void Add JSON code to the response
disable ( ) : void Disables the rendering of the header and the footer in responses
getCWD ( ) : string Returns the path to the current working directory Necessary to work around a PHP bug where the CWD is reset after the initial script exits
getFooter ( ) : Footer Returns a PMA\libraries\Footer object
getHeader ( ) : Header Returns a PMA\libraries\Header object
getInstance ( ) : Response Returns the singleton Response object
header ( string $text ) : void Wrapper around PHP's header() function.
headersSent ( ) : boolean Wrapper around PHP's headers_sent() function.
isAjax ( ) : boolean Returns true or false depending on whether we are servicing an ajax request
response ( ) : void Sends an HTML response to the browser
setRequestStatus ( boolean $state ) : void Set the status of an ajax response, whether it is a success or an error

Private Methods

Method Description
__construct ( ) Creates a new class instance
_ajaxResponse ( ) : void Sends a JSON response to the browser
_getDisplay ( ) : string Renders the HTML response text
_htmlResponse ( ) : void Sends an HTML response to the browser

Method Details

addHTML() public method

Add HTML code to the response
public addHTML ( string $content ) : void
$content string A string to be appended to the current output buffer
return void

addJSON() public method

Add JSON code to the response
public addJSON ( mixed $json, mixed $value = null ) : void
$json mixed Either a key (string) or an array or key-value pairs
$value mixed Null, if passing an array in $json otherwise it's a string value to the key
return void

disable() public method

Disables the rendering of the header and the footer in responses
public disable ( ) : void
return void

getCWD() public method

Returns the path to the current working directory Necessary to work around a PHP bug where the CWD is reset after the initial script exits
public getCWD ( ) : string
return string

getFooter() public method

Returns a PMA\libraries\Footer object
public getFooter ( ) : Footer
return Footer

getHeader() public method

Returns a PMA\libraries\Header object
public getHeader ( ) : Header
return Header

getInstance() public static method

Returns the singleton Response object
public static getInstance ( ) : Response
return Response object

header() public method

Wrapper around PHP's header() function.
public header ( string $text ) : void
$text string header string
return void

headersSent() public method

Wrapper around PHP's headers_sent() function.
public headersSent ( ) : boolean
return boolean

isAjax() public method

Returns true or false depending on whether we are servicing an ajax request
public isAjax ( ) : boolean
return boolean

response() public static method

Sends an HTML response to the browser
public static response ( ) : void
return void

setRequestStatus() public method

Set the status of an ajax response, whether it is a success or an error
public setRequestStatus ( boolean $state ) : void
$state boolean Whether the request was successfully processed
return void