|
MediaWiki master
|
JSON text content that can be viewed and edit directly by users. More...
Inherits MediaWiki\Content\TextContent.

Public Member Functions | |
| __construct ( $text, $modelId=CONTENT_MODEL_JSON) | |
| beautifyJSON () | |
| Pretty-print JSON. | |
| getData () | |
| Decodes the JSON string. | |
| isValid () | |
| rootValueTable ( $val) | |
| Construct HTML table representation of any JSON value. | |
Public Member Functions inherited from MediaWiki\Content\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) | |
| 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 MediaWiki\Content\AbstractContent | |
| __construct ( $modelId=null) | |
| addSectionHeader ( $header) | |
| equals (?Content $that=null) | |
| getContentHandler () | |
| getDefaultFormat () | |
| getModel () | |
| getRedirectTarget () | |
| Subclasses that implement redirects should override this. | |
| getSection ( $sectionId) | |
| getSupportedFormats () | |
| isEmpty () | |
| isRedirect () | |
| isSupportedFormat ( $format) | |
| matchMagicWord (MagicWord $word) | |
| This default implementation always returns false. | |
| replaceSection ( $sectionId, Content $with, $sectionTitle='') | |
| serialize ( $format=null) | |
| 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. | |
| 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. | |
| valueCell ( $val) | |
| Construct HTML table cell representing any JSON value. | |
Protected Member Functions inherited from MediaWiki\Content\AbstractContent | |
| checkFormat ( $format) | |
| Helper for subclasses. | |
| checkModelID ( $modelId) | |
| Helper for subclasses. | |
| equalsInternal (Content $that) | |
| Helper for AbstractContent::equals. | |
| getContentHandlerFactory () | |
Protected Attributes | |
| Status | $jsonParse |
Protected Attributes inherited from MediaWiki\Content\TextContent | |
| string | $mText |
Protected Attributes inherited from MediaWiki\Content\AbstractContent | |
| string | $model_id |
Additional Inherited Members | |
Static Public Member Functions inherited from MediaWiki\Content\TextContent | |
| static | normalizeLineEndings ( $text) |
| Do a "\\r\\n" -> "\\n" and "\\r" -> "\\n" transformation as well as trim trailing whitespace. | |
Static Public Member Functions inherited from MediaWiki\Content\AbstractContent | |
| static | jsonClassCodec (JsonCodecInterface $codec, ContainerInterface $serviceContainer) |
JSON text content that can be viewed and edit directly by users.
Definition at line 23 of file JsonContent.php.
| MediaWiki\Content\JsonContent::__construct | ( | $text, | |
| $modelId = CONTENT_MODEL_JSON ) |
| string | $text | JSON |
| string | $modelId |
Reimplemented from MediaWiki\Content\TextContent.
Definition at line 36 of file JsonContent.php.
|
protected |
Create HTML table row representing the value in an array.
| mixed | $val |
Definition at line 173 of file JsonContent.php.
References MediaWiki\Content\JsonContent\valueCell().
Referenced by MediaWiki\Content\JsonContent\arrayTable().
|
protected |
Create HTML table representing a JSON array.
| array | $mapping |
Definition at line 147 of file JsonContent.php.
References MediaWiki\Content\JsonContent\arrayRow(), MediaWiki\Html\element(), and wfMessage().
Referenced by MediaWiki\Content\JsonContent\rootValueTable(), and MediaWiki\Content\JsonContent\valueCell().
| MediaWiki\Content\JsonContent::beautifyJSON | ( | ) |
Pretty-print JSON.
If called before validation, it may return JSON "null".
Definition at line 67 of file JsonContent.php.
References MediaWiki\Content\JsonContent\getData().
| MediaWiki\Content\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 48 of file JsonContent.php.
References MediaWiki\Content\JsonContent\$jsonParse, and MediaWiki\Content\TextContent\getText().
Referenced by MediaWiki\Content\JsonContent\beautifyJSON(), and MediaWiki\Content\JsonContent\isValid().
| MediaWiki\Content\JsonContent::isValid | ( | ) |
Reimplemented from MediaWiki\Content\AbstractContent.
Definition at line 56 of file JsonContent.php.
References MediaWiki\Content\JsonContent\getData().
|
protected |
Create HTML table row representing one object property.
| string | $key | |
| mixed | $val |
Definition at line 134 of file JsonContent.php.
References MediaWiki\Html\element(), and MediaWiki\Content\JsonContent\valueCell().
Referenced by MediaWiki\Content\JsonContent\objectTable().
|
protected |
Create HTML table representing a JSON object.
| \\stdClass | $mapping |
Definition at line 107 of file JsonContent.php.
References MediaWiki\Html\element(), MediaWiki\Content\JsonContent\objectRow(), and wfMessage().
Referenced by MediaWiki\Content\JsonContent\rootValueTable(), and MediaWiki\Content\JsonContent\valueCell().
|
protected |
Construct text representing a JSON primitive value.
| mixed | $val |
Definition at line 202 of file JsonContent.php.
Referenced by MediaWiki\Content\JsonContent\rootValueTable(), and MediaWiki\Content\JsonContent\valueCell().
| MediaWiki\Content\JsonContent::rootValueTable | ( | $val | ) |
Construct HTML table representation of any JSON value.
See also valueCell, which is similar.
| mixed | $val |
Definition at line 79 of file JsonContent.php.
References MediaWiki\Content\JsonContent\arrayTable(), MediaWiki\Html\element(), MediaWiki\Content\JsonContent\objectTable(), and MediaWiki\Content\JsonContent\primitiveValue().
|
protected |
Construct HTML table cell representing any JSON value.
| mixed | $val |
Definition at line 184 of file JsonContent.php.
References MediaWiki\Content\JsonContent\arrayTable(), MediaWiki\Html\element(), MediaWiki\Content\JsonContent\objectTable(), and MediaWiki\Content\JsonContent\primitiveValue().
Referenced by MediaWiki\Content\JsonContent\arrayRow(), and MediaWiki\Content\JsonContent\objectRow().
|
protected |
Definition at line 29 of file JsonContent.php.
Referenced by MediaWiki\Content\JsonContent\getData().