PHP Класс PMA\libraries\Response

Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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

Приватные методы

Метод Описание
__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

Описание методов

addHTML() публичный Метод

Add HTML code to the response
public addHTML ( string $content ) : void
$content string A string to be appended to the current output buffer
Результат void

addJSON() публичный Метод

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
Результат void

disable() публичный Метод

Disables the rendering of the header and the footer in responses
public disable ( ) : void
Результат void

getCWD() публичный Метод

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
Результат string

getFooter() публичный Метод

Returns a PMA\libraries\Footer object
public getFooter ( ) : Footer
Результат Footer

getHeader() публичный Метод

Returns a PMA\libraries\Header object
public getHeader ( ) : Header
Результат Header

getInstance() публичный статический Метод

Returns the singleton Response object
public static getInstance ( ) : Response
Результат Response object

header() публичный Метод

Wrapper around PHP's header() function.
public header ( string $text ) : void
$text string header string
Результат void

headersSent() публичный Метод

Wrapper around PHP's headers_sent() function.
public headersSent ( ) : boolean
Результат boolean

isAjax() публичный Метод

Returns true or false depending on whether we are servicing an ajax request
public isAjax ( ) : boolean
Результат boolean

response() публичный статический Метод

Sends an HTML response to the browser
public static response ( ) : void
Результат void

setRequestStatus() публичный Метод

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
Результат void