wiki.techinc.nl/includes/content/JavaScriptContentHandler.php
Antoine Musso 42a8daaf5a (bug 26280) all files should have GPL header
MediaWiki is licensed under GPL so we should really add the header to
our PHP code unless reusing code licensed differently.

Tested using:
  ack-grep --php -L 'This program is free software' \
    includes/ maintenance/ mw-config/ resources/ skins/

Output the following files:
 includes/ExternalEdit.php (public domain)

Various other licenses:
 includes/json/Services_JSON.php
 includes/libs/CSSMin.php
 includes/libs/IEContentAnalyzer.php
 includes/libs/JavaScriptMinifier.php
 includes/libs/jsminplus.php
 includes/normal/Utf8Case.php
 includes/objectcache/MemcachedClient.php

File autogenerated from a GPL file and Unicode data:
 includes/ZhConversion.php

A few lines coming from stack overflow:
 maintenance/mwdoc-filter.php

Message files do not have any license :-/

Change-Id: I214a988edfa9e2dfcc762612a0f7d47eee8bcb74
2012-11-18 15:34:00 +01:00

63 lines
1.9 KiB
PHP

<?php
/**
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* http://www.gnu.org/copyleft/gpl.html
*
* @file
*/
# XXX: make ScriptContentHandler base class, do highlighting stuff there?
/**
* @since 1.21
*/
class JavaScriptContentHandler extends TextContentHandler {
public function __construct( $modelId = CONTENT_MODEL_JAVASCRIPT ) {
parent::__construct( $modelId, array( CONTENT_FORMAT_JAVASCRIPT ) );
}
public function unserializeContent( $text, $format = null ) {
$this->checkFormat( $format );
return new JavaScriptContent( $text );
}
public function makeEmptyContent() {
return new JavaScriptContent( '' );
}
/**
* Returns the english language, because JS is english, and should be handled as such.
*
* @return Language wfGetLangObj( 'en' )
*
* @see ContentHandler::getPageLanguage()
*/
public function getPageLanguage( Title $title, Content $content = null ) {
return wfGetLangObj( 'en' );
}
/**
* Returns the english language, because CSS is english, and should be handled as such.
*
* @return Language wfGetLangObj( 'en' )
*
* @see ContentHandler::getPageViewLanguage()
*/
public function getPageViewLanguage( Title $title, Content $content = null ) {
return wfGetLangObj( 'en' );
}
}