MediaWiki REL1_35
|
Represents the content of a JSON content. More...
Public Member Functions | |
__construct ( $text, $modelId=CONTENT_MODEL_JSON) | |
beautifyJSON () | |
Pretty-print JSON. | |
getData () | |
Decodes the JSON string. | |
isValid () | |
preSaveTransform (Title $title, User $user, ParserOptions $popts) | |
Beautifies JSON prior to save. | |
Public Member Functions inherited from TextContent | |
convert ( $toModel, $lossy='') | |
This implementation provides lossless conversion between content models based on TextContent. | |
copy () | |
diff (Content $that, Language $lang=null) | |
Diff this content object with another content object. | |
getNativeData () | |
Returns the text represented by this Content object, as a string. | |
getSize () | |
Returns the text's size in bytes. | |
getText () | |
Returns the text represented by this Content object, as a string. | |
getTextForSearchIndex () | |
Returns the text represented by this Content object, as a string. | |
getTextForSummary ( $maxlength=250) | |
Stable to override. | |
getWikitextForTransclusion () | |
Returns attempts to convert this content object to wikitext, and then returns the text string. | |
isCountable ( $hasLinks=null) | |
Returns true if this content is not a redirect, and $wgArticleCountMethod is "any". | |
Public Member Functions inherited from AbstractContent | |
__construct ( $modelId=null) | |
Stable to call. | |
addSectionHeader ( $header) | |
Stable to override. | |
equals (Content $that=null) | |
Decides whether two Content objects are equal. | |
getContentHandler () | |
getDefaultFormat () | |
getDeletionUpdates (WikiPage $page, ParserOutput $parserOutput=null) | |
Stable to override. | |
getModel () | |
getParserOutput (Title $title, $revId=null, ParserOptions $options=null, $generateHtml=true) | |
Returns a ParserOutput object containing information derived from this content. | |
getRedirectChain () | |
getRedirectTarget () | |
Subclasses that implement redirects should override this. | |
getSecondaryDataUpdates (Title $title, Content $old=null, $recursive=true, ParserOutput $parserOutput=null) | |
Returns a list of DataUpdate objects for recording information about this Content in some secondary data store. | |
getSection ( $sectionId) | |
Stable to override. | |
getSupportedFormats () | |
getUltimateRedirectTarget () | |
isEmpty () | |
Stable to override. | |
isRedirect () | |
isSupportedFormat ( $format) | |
matchMagicWord (MagicWord $word) | |
This default implementation always returns false. | |
preloadTransform (Title $title, ParserOptions $popts, $params=[]) | |
Stable to override. | |
prepareSave (WikiPage $page, $flags, $parentRevId, User $user) | |
Stable to override. | |
replaceSection ( $sectionId, Content $with, $sectionTitle='') | |
Stable to override. | |
serialize ( $format=null) | |
Stable to override. | |
updateRedirect (Title $target) | |
This default implementation always returns $this. | |
Protected Member Functions | |
arrayRow ( $val) | |
Create HTML table row representing the value in an array. | |
arrayTable ( $mapping) | |
Create HTML table representing a JSON array. | |
fillParserOutput (Title $title, $revId, ParserOptions $options, $generateHtml, ParserOutput &$output) | |
Set the HTML and add the appropriate styles. | |
objectRow ( $key, $val) | |
Create HTML table row representing one object property. | |
objectTable ( $mapping) | |
Create HTML table representing a JSON object. | |
primitiveValue ( $val) | |
Construct text representing a JSON primitive value. | |
rootValueTable ( $val) | |
Construct HTML table representation of any JSON value. | |
valueCell ( $val) | |
Construct HTML table cell representing any JSON value. | |
Protected Member Functions inherited from TextContent | |
getHtml () | |
Generates an HTML version of the content, for display. | |
Protected Member Functions inherited from AbstractContent | |
checkFormat ( $format) | |
checkModelID ( $modelId) | |
equalsInternal (Content $that) | |
Checks whether $that is logically equal to this Content object. | |
getContentHandlerFactory () | |
Protected Attributes | |
Status | $jsonParse |
Protected Attributes inherited from TextContent | |
string | $mText |
Protected Attributes inherited from AbstractContent | |
string | $model_id |
Name of the content model this Content object represents. | |
Additional Inherited Members | |
Static Public Member Functions inherited from TextContent | |
static | normalizeLineEndings ( $text) |
Do a "\\r\\n" -> "\\n" and "\\r" -> "\\n" transformation as well as trim trailing whitespace. | |
JsonContent::__construct | ( | $text, | |
$modelId = CONTENT_MODEL_JSON |
|||
) |
string | $text | JSON |
string | $modelId |
Reimplemented from TextContent.
Definition at line 27 of file JsonContent.php.
|
protected |
Create HTML table row representing the value in an array.
mixed | $val |
Definition at line 204 of file JsonContent.php.
References valueCell().
Referenced by arrayTable().
|
protected |
Create HTML table representing a JSON array.
array | $mapping |
Definition at line 178 of file JsonContent.php.
References arrayRow(), and wfMessage().
Referenced by rootValueTable(), and valueCell().
JsonContent::beautifyJSON | ( | ) |
Pretty-print JSON.
If called before validation, it may return JSON "null".
Definition at line 60 of file JsonContent.php.
References getData().
Referenced by preSaveTransform().
|
protected |
Set the HTML and add the appropriate styles.
Title | $title | |
int | $revId | |
ParserOptions | $options | |
bool | $generateHtml | |
ParserOutput | &$output |
Reimplemented from TextContent.
Definition at line 91 of file JsonContent.php.
References ParserOutput\addModuleStyles(), getData(), isValid(), rootValueTable(), and ParserOutput\setText().
JsonContent::getData | ( | ) |
Decodes the JSON string.
Note that this parses it without casting objects to associative arrays. Objects and arrays are kept as distinguishable types in the PHP values.
Definition at line 39 of file JsonContent.php.
References $jsonParse, and TextContent\getText().
Referenced by beautifyJSON(), fillParserOutput(), and isValid().
JsonContent::isValid | ( | ) |
Reimplemented from AbstractContent.
Definition at line 49 of file JsonContent.php.
References getData().
Referenced by fillParserOutput(), and preSaveTransform().
|
protected |
Create HTML table row representing one object property.
string | $key | |
mixed | $val |
Definition at line 165 of file JsonContent.php.
References valueCell().
Referenced by objectTable().
|
protected |
Create HTML table representing a JSON object.
stdClass | $mapping |
Definition at line 138 of file JsonContent.php.
References objectRow(), and wfMessage().
Referenced by rootValueTable(), and valueCell().
JsonContent::preSaveTransform | ( | Title | $title, |
User | $user, | ||
ParserOptions | $popts | ||
) |
Beautifies JSON prior to save.
Title | $title | |
User | $user | |
ParserOptions | $popts |
Reimplemented from TextContent.
Definition at line 72 of file JsonContent.php.
References beautifyJSON(), isValid(), and TextContent\normalizeLineEndings().
|
protected |
Construct text representing a JSON primitive value.
mixed | $val |
Definition at line 233 of file JsonContent.php.
Referenced by rootValueTable(), and valueCell().
|
protected |
Construct HTML table representation of any JSON value.
See also valueCell, which is similar.
mixed | $val |
Definition at line 112 of file JsonContent.php.
References arrayTable(), objectTable(), and primitiveValue().
Referenced by fillParserOutput().
|
protected |
Construct HTML table cell representing any JSON value.
mixed | $val |
Definition at line 215 of file JsonContent.php.
References arrayTable(), objectTable(), and primitiveValue().
Referenced by arrayRow(), and objectRow().
|
protected |