Merge "Language: s/error_log/wfWarn/"
[lhc/web/wiklou.git] / includes / content / JSONContentHandler.php
1 <?php
2 /**
3 * JSON Schema Content Handler
4 *
5 * @file
6 *
7 * @author Ori Livneh <ori@wikimedia.org>
8 * @author Kunal Mehta <legoktm@gmail.com>
9 */
10
11 /**
12 * @since 1.24
13 */
14 class JSONContentHandler extends TextContentHandler {
15
16 /**
17 * The class name of objects that should be created
18 *
19 * @deprecated override getContentClass instead
20 *
21 * @var string
22 */
23 protected $contentClass = 'JSONContent';
24
25 public function __construct( $modelId = CONTENT_MODEL_JSON ) {
26 parent::__construct( $modelId, array( CONTENT_FORMAT_JSON ) );
27 }
28
29 /**
30 * Temporary back-compat until extensions
31 * are updated to override this
32 *
33 * @return string
34 */
35 protected function getContentClass() {
36 return $this->contentClass;
37 }
38
39 /**
40 * Returns the english language, because JSON is english, and should be handled as such.
41 *
42 * @param Title $title
43 * @param Content|null $content
44 *
45 * @return Language Return of wfGetLangObj( 'en' )
46 *
47 * @see ContentHandler::getPageLanguage()
48 */
49 public function getPageLanguage( Title $title, Content $content = null ) {
50 return wfGetLangObj( 'en' );
51 }
52
53 /**
54 * Returns the english language, because JSON is english, and should be handled as such.
55 *
56 * @param Title $title
57 * @param Content|null $content
58 *
59 * @return Language Return of wfGetLangObj( 'en' )
60 *
61 * @see ContentHandler::getPageLanguage()
62 */
63 public function getPageViewLanguage( Title $title, Content $content = null ) {
64 return wfGetLangObj( 'en' );
65 }
66 }