3 * JSON Schema Content Handler
7 * @author Ori Livneh <ori@wikimedia.org>
8 * @author Kunal Mehta <legoktm@gmail.com>
14 class JSONContentHandler
extends TextContentHandler
{
17 * The class name of objects that should be created
21 protected $contentClass = 'JSONContent';
23 public function __construct( $modelId = CONTENT_MODEL_JSON
) {
24 parent
::__construct( $modelId, array( CONTENT_FORMAT_JSON
) );
28 * Unserializes a JSONContent object.
30 * @param string $text Serialized form of the content
31 * @param null|string $format The format used for serialization
35 public function unserializeContent( $text, $format = null ) {
36 $this->checkFormat( $format );
37 return new $this->contentClass( $text );
41 * Creates an empty JSONContent object.
45 public function makeEmptyContent() {
46 return new $this->contentClass( '' );
49 /** JSON is English **/
50 public function getPageLanguage( Title
$title, Content
$content = null ) {
51 return wfGetLangObj( 'en' );
54 /** JSON is English **/
55 public function getPageViewLanguage( Title
$title, Content
$content = null ) {
56 return wfGetLangObj( 'en' );