MediaWiki 1.39.10
|
Format-related REST API helper. More...
Static Public Member Functions | |
static | getContentType (string $format, ?string $contentVersion=null) |
Get the content type appropriate for a given response format. | |
static | parseContentTypeHeader (string $contentTypeHeader, ?string &$format=null) |
Parse a Content-Type header and return the format type and version. | |
static | setContentType (ResponseInterface $response, string $format, ?string $contentVersion=null) |
Set the Content-Type header appropriate for a given response format. | |
Public Attributes | |
const | ERROR_ENCODING |
const | FORMAT_HTML = 'html' |
const | FORMAT_LINT = 'lint' |
const | FORMAT_PAGEBUNDLE = 'pagebundle' |
const | FORMAT_WIKITEXT = 'wikitext' |
const | VALID_PAGE |
const | VALID_TRANSFORM |
Format-related REST API helper.
Probably should be turned into an object encapsulating format and content version at some point.
Definition at line 29 of file ParsoidFormatHelper.php.
|
static |
Get the content type appropriate for a given response format.
string | $format | One of the FORMAT_* constants |
?string | $contentVersion | Output version, only for HTML and pagebundle formats. See Env::getcontentVersion(). |
Definition at line 60 of file ParsoidFormatHelper.php.
|
static |
Parse a Content-Type header and return the format type and version.
Mostly the inverse of getContentType() but also accounts for legacy formats.
string | $contentTypeHeader | The value of the Content-Type header. |
?string | &$format | Format type will be set here (as a FORMAT_* constant). |
Definition at line 110 of file ParsoidFormatHelper.php.
|
static |
Set the Content-Type header appropriate for a given response format.
ResponseInterface | $response | |
string | $format | One of the FORMAT_* constants |
?string | $contentVersion | Output version, only for HTML and pagebundle formats. See Env::getcontentVersion(). |
Definition at line 95 of file ParsoidFormatHelper.php.
const MediaWiki\Rest\Handler\ParsoidFormatHelper::ERROR_ENCODING |
Definition at line 36 of file ParsoidFormatHelper.php.
const MediaWiki\Rest\Handler\ParsoidFormatHelper::FORMAT_HTML = 'html' |
Definition at line 32 of file ParsoidFormatHelper.php.
const MediaWiki\Rest\Handler\ParsoidFormatHelper::FORMAT_LINT = 'lint' |
Definition at line 34 of file ParsoidFormatHelper.php.
const MediaWiki\Rest\Handler\ParsoidFormatHelper::FORMAT_PAGEBUNDLE = 'pagebundle' |
Definition at line 33 of file ParsoidFormatHelper.php.
const MediaWiki\Rest\Handler\ParsoidFormatHelper::FORMAT_WIKITEXT = 'wikitext' |
Definition at line 31 of file ParsoidFormatHelper.php.
const MediaWiki\Rest\Handler\ParsoidFormatHelper::VALID_PAGE |
Definition at line 43 of file ParsoidFormatHelper.php.
const MediaWiki\Rest\Handler\ParsoidFormatHelper::VALID_TRANSFORM |
Definition at line 47 of file ParsoidFormatHelper.php.