class ResponseRenderer (View source)

Singleton class used to manage the rendering of pages in PMA

Properties

protected bool $isAjax

Whether we are servicing an ajax request.

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

Methods

__construct(Config $config, Template $template, Header $header, Footer $footer, ErrorHandler $errorHandler, DatabaseInterface $dbi, ResponseFactory $responseFactory)

No description

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

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

No description

string
fixRelativeUrlForRedirect(string $url)

Avoid relative path redirect problems in case user entered URL like /phpmyadmin/index.php/ which some web servers happily accept.

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

missingParameterError(string $param)

No description

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

No description

Details

protected __construct(Config $config, Template $template, Header $header, Footer $footer, ErrorHandler $errorHandler, DatabaseInterface $dbi, ResponseFactory $responseFactory)

No description

Parameters

Config $config
Template $template
Header $header
Footer $footer
ErrorHandler $errorHandler
DatabaseInterface $dbi
ResponseFactory $responseFactory

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

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

No description

Return Value

never

string fixRelativeUrlForRedirect(string $url)

Avoid relative path redirect problems in case user entered URL like /phpmyadmin/index.php/ which some web servers happily accept.

Parameters

string $url

Return Value

string

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

Response missingParameterError(string $param)

No description

Parameters

string $param

Return Value

Response

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

No description

Parameters

string $templatePath
array $templateData

Return Value

void