BlueSpice MediaWiki master
 All Classes Namespaces Files Functions Variables Groups Pages
JsonContent Class Reference
Inheritance diagram for JsonContent:
Collaboration diagram for JsonContent:

Public Member Functions

 __construct ($text, $modelId=CONTENT_MODEL_JSON)
 
 getJsonData ()
 
 getData ()
 
 isValid ()
 
 beautifyJSON ()
 
 preSaveTransform (Title $title, User $user, ParserOptions $popts)
 
- Public Member Functions inherited from TextContent
 __construct ($text, $model_id=CONTENT_MODEL_TEXT)
 
 copy ()
 
 getTextForSummary ($maxlength=250)
 
 getSize ()
 
 isCountable ($hasLinks=null)
 
 getNativeData ()
 
 getTextForSearchIndex ()
 
 getWikitextForTransclusion ()
 
 preSaveTransform (Title $title, User $user, ParserOptions $popts)
 
 diff (Content $that, Language $lang=null)
 
 convert ($toModel, $lossy= '')
 
- Public Member Functions inherited from AbstractContent
 __construct ($modelId=null)
 
 getModel ()
 
 getContentHandler ()
 
 getDefaultFormat ()
 
 getSupportedFormats ()
 
 isSupportedFormat ($format)
 
 serialize ($format=null)
 
 isEmpty ()
 
 isValid ()
 
 equals (Content $that=null)
 
 getSecondaryDataUpdates (Title $title, Content $old=null, $recursive=true, ParserOutput $parserOutput=null)
 
 getRedirectChain ()
 
 getRedirectTarget ()
 
 getUltimateRedirectTarget ()
 
 isRedirect ()
 
 updateRedirect (Title $target)
 
 getSection ($sectionId)
 
 replaceSection ($sectionId, Content $with, $sectionTitle= '')
 
 preSaveTransform (Title $title, User $user, ParserOptions $popts)
 
 addSectionHeader ($header)
 
 preloadTransform (Title $title, ParserOptions $popts, $params=[])
 
 prepareSave (WikiPage $page, $flags, $parentRevId, User $user)
 
 getDeletionUpdates (WikiPage $page, ParserOutput $parserOutput=null)
 
 matchMagicWord (MagicWord $word)
 
 convert ($toModel, $lossy= '')
 
 getParserOutput (Title $title, $revId=null, ParserOptions $options=null, $generateHtml=true)
 

Protected Member Functions

 fillParserOutput (Title $title, $revId, ParserOptions $options, $generateHtml, ParserOutput &$output)
 
 rootValueTable ($val)
 
 objectTable ($mapping)
 
 objectRow ($key, $val)
 
 arrayTable ($mapping)
 
 arrayRow ($val)
 
 valueCell ($val)
 
 primitiveValue ($val)
 
- Protected Member Functions inherited from TextContent
 fillParserOutput (Title $title, $revId, ParserOptions $options, $generateHtml, ParserOutput &$output)
 
 getHtml ()
 
 getHighlightHtml ()
 
- Protected Member Functions inherited from AbstractContent
 checkModelID ($modelId)
 
 checkFormat ($format)
 
 fillParserOutput (Title $title, $revId, ParserOptions $options, $generateHtml, ParserOutput &$output)
 

Protected Attributes

 $jsonParse
 
- Protected Attributes inherited from TextContent
 $mText
 
- Protected Attributes inherited from AbstractContent
 $model_id
 

Additional Inherited Members

- Static Public Member Functions inherited from TextContent
static normalizeLineEndings ($text)
 

Detailed Description

Represents the content of a JSON content.

Since
1.24

Constructor & Destructor Documentation

JsonContent::__construct (   $text,
  $modelId = CONTENT_MODEL_JSON 
)
Parameters
string$textJSON
string$modelId

Member Function Documentation

JsonContent::arrayRow (   $val)
protected

Create HTML table row representing the value in an array.

Parameters
mixed$val
Returns
string HTML.
JsonContent::arrayTable (   $mapping)
protected

Create HTML table representing a JSON array.

Parameters
array$mapping
Returns
string HTML
JsonContent::beautifyJSON ( )

Pretty-print JSON.

If called before validation, it may return JSON "null".

Returns
string
JsonContent::fillParserOutput ( Title  $title,
  $revId,
ParserOptions  $options,
  $generateHtml,
ParserOutput $output 
)
protected

Set the HTML and add the appropriate styles.

Parameters
Title$title
int$revId
ParserOptions$options
bool$generateHtml
ParserOutput&$output
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.

Returns
Status
JsonContent::getJsonData ( )

Decodes the JSON into a PHP associative array.

Deprecated:
since 1.25 Use getData instead.
Returns
array|null
JsonContent::isValid ( )
Returns
bool Whether content is valid.

Implements Content.

JsonContent::objectRow (   $key,
  $val 
)
protected

Create HTML table row representing one object property.

Parameters
string$key
mixed$val
Returns
string HTML.
JsonContent::objectTable (   $mapping)
protected

Create HTML table representing a JSON object.

Parameters
stdClass$mapping
Returns
string HTML
JsonContent::preSaveTransform ( Title  $title,
User  $user,
ParserOptions  $popts 
)

Beautifies JSON prior to save.

Parameters
Title$title
User$user
ParserOptions$popts
Returns
JsonContent

Implements Content.

JsonContent::primitiveValue (   $val)
protected

Construct text representing a JSON primitive value.

Parameters
mixed$val
Returns
string Text.
JsonContent::rootValueTable (   $val)
protected

Construct HTML table representation of any JSON value.

See also valueCell, which is similar.

Parameters
mixed$val
Returns
string HTML.
JsonContent::valueCell (   $val)
protected

Construct HTML table cell representing any JSON value.

Parameters
mixed$val
Returns
string HTML.

The documentation for this class was generated from the following file: