class ResponseRenderer (View source)

Singleton class used to manage the rendering of pages in PMA

Properties

protected Header $header

Header instance

$footer

PhpMyAdmin\Footer instance

protected bool $isAjax

Whether we are servicing an ajax request.

protected bool $isDisabled

Whether response object is disabled

protected bool $isSuccess

Whether there were any errors during the processing of the request Only used for ajax responses

static protected array<int,string> $httpStatusMessages
protected Response $response
protected Template $template
protected Config $config

Methods

void
setAjax(bool $isAjax)

Set the ajax flag to indicate whether we are servicing an ajax request

getInstance()

Returns the singleton object

void
setRequestStatus(bool $state)

Set the status of an ajax response, whether it is a success or an error

bool
isAjax()

Returns true or false depending on whether we are servicing an ajax request

void
disable()

Disables the rendering of the header and the footer in responses

getHeader()

Returns a PhpMyAdmin\Header object

void
addHTML(string $content)

Append HTML code to the current output buffer

void
addJSON(string|int|array $json, mixed $value = null)

Add JSON code to the response

response()

No description

void
addHeader(string $name, string $value)

No description

void
setStatusCode(int $code)

No description

bool
loginPage()

Configures response for the login page

void
setMinimalFooter()

No description

string
getSelfUrl()

No description

getFooterScripts()

No description

never
callExit(string $message = '')

No description

void
redirect(string $url, int $statusCode = StatusCodeInterface::STATUS_FOUND)

No description

void
redirectToRoute(string $route, array $params = [])

No description

void
addScriptFiles(array $files)

No description

bool
checkParameters(array $params, bool $request = false)

Function added to avoid path disclosures.

void
render(string $templatePath, array $templateData = [])

No description

Details

void setAjax(bool $isAjax)

Set the ajax flag to indicate whether we are servicing an ajax request

Parameters

bool $isAjax

Whether we are servicing an ajax request

Return Value

void

static ResponseRenderer getInstance()

Returns the singleton object

Return Value

ResponseRenderer

void setRequestStatus(bool $state)

Set the status of an ajax response, whether it is a success or an error

Parameters

bool $state

Whether the request was successfully processed

Return Value

void

bool isAjax()

Returns true or false depending on whether we are servicing an ajax request

Return Value

bool

void disable()

Disables the rendering of the header and the footer in responses

Return Value

void

Header getHeader()

Returns a PhpMyAdmin\Header object

Return Value

Header

void addHTML(string $content)

Append HTML code to the current output buffer

Parameters

string $content

Return Value

void

void addJSON(string|int|array $json, mixed $value = null)

Add JSON code to the response

Parameters

string|int|array $json

Either a key (string) or an array or key-value pairs

mixed $value

Null, if passing an array in $json otherwise it's a string value to the key

Return Value

void

Response response()

No description

Return Value

Response

void addHeader(string $name, string $value)

No description

Parameters

string $name
string $value

Return Value

void

void setStatusCode(int $code)

No description

Parameters

int $code

Return Value

void

bool loginPage()

Configures response for the login page

Return Value

bool

Whether caller should exit

void setMinimalFooter()

No description

Return Value

void

string getSelfUrl()

No description

Return Value

string

Scripts getFooterScripts()

No description

Return Value

Scripts

never callExit(string $message = '')

No description

Parameters

string $message

Return Value

never

void redirect(string $url, int $statusCode = StatusCodeInterface::STATUS_FOUND)

No description

Parameters

string $url
int $statusCode

Return Value

void

void redirectToRoute(string $route, array $params = [])

No description

Parameters

string $route
array $params

Return Value

void

void addScriptFiles(array $files)

No description

Parameters

array $files

Return Value

void

bool checkParameters(array $params, bool $request = false)

Function added to avoid path disclosures.

Called by each script that needs parameters.

Parameters

array $params
bool $request

Check parameters in request

Return Value

bool

void render(string $templatePath, array $templateData = [])

No description

Parameters

string $templatePath
array $templateData

Return Value

void