MediaWiki  master
CodeContentHandler.php
Go to the documentation of this file.
1 <?php
25 
33 abstract class CodeContentHandler extends TextContentHandler {
34 
47  public function getPageLanguage( Title $title, Content $content = null ) {
48  return MediaWikiServices::getInstance()->getLanguageFactory()->getLanguage( 'en' );
49  }
50 
63  public function getPageViewLanguage( Title $title, Content $content = null ) {
64  return MediaWikiServices::getInstance()->getLanguageFactory()->getLanguage( 'en' );
65  }
66 
73  protected function getContentClass() {
74  throw new MWException( 'Subclass must override' );
75  }
76 
77 }
MediaWiki\MediaWikiServices
MediaWikiServices is the service locator for the application scope of MediaWiki.
Definition: MediaWikiServices.php:154
CodeContentHandler
Content handler for code content such as CSS, JavaScript, JSON, etc.
Definition: CodeContentHandler.php:33
MWException
MediaWiki exception.
Definition: MWException.php:29
CodeContentHandler\getPageLanguage
getPageLanguage(Title $title, Content $content=null)
Returns the English language, because code is English, and should be handled as such.
Definition: CodeContentHandler.php:47
$title
$title
Definition: testCompression.php:38
$content
$content
Definition: router.php:76
TextContentHandler
Base content handler implementation for flat text contents.
Definition: TextContentHandler.php:31
CodeContentHandler\getPageViewLanguage
getPageViewLanguage(Title $title, Content $content=null)
Returns the English language, because code is English, and should be handled as such.
Definition: CodeContentHandler.php:63
Content
Base interface for content objects.
Definition: Content.php:35
Title
Represents a title within MediaWiki.
Definition: Title.php:42
CodeContentHandler\getContentClass
getContentClass()
Stable to override.
Definition: CodeContentHandler.php:73