2010-10-19 18:25:42 +00:00
|
|
|
<?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
|
|
|
|
|
* @author Trevor Parscal
|
|
|
|
|
* @author Roan Kattouw
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
2019-09-14 04:32:54 +00:00
|
|
|
* Module for site customizations.
|
|
|
|
|
*
|
|
|
|
|
* @ingroup ResourceLoader
|
|
|
|
|
* @internal
|
2010-10-19 18:25:42 +00:00
|
|
|
*/
|
|
|
|
|
class ResourceLoaderSiteModule extends ResourceLoaderWikiModule {
|
2020-01-14 00:04:32 +00:00
|
|
|
/** @var string[] What client platforms the module targets (e.g. desktop, mobile) */
|
|
|
|
|
protected $targets = [ 'desktop', 'mobile' ];
|
2010-10-19 18:25:42 +00:00
|
|
|
|
2010-10-20 00:25:20 +00:00
|
|
|
/**
|
2014-10-21 00:43:26 +00:00
|
|
|
* Get list of pages used by this module
|
2011-05-21 17:45:20 +00:00
|
|
|
*
|
2014-04-20 21:33:05 +00:00
|
|
|
* @param ResourceLoaderContext $context
|
|
|
|
|
* @return array List of pages
|
2010-10-20 00:25:20 +00:00
|
|
|
*/
|
2010-10-19 18:25:42 +00:00
|
|
|
protected function getPages( ResourceLoaderContext $context ) {
|
2016-02-17 09:09:32 +00:00
|
|
|
$pages = [];
|
2014-08-07 10:25:56 +00:00
|
|
|
if ( $this->getConfig()->get( 'UseSiteJs' ) ) {
|
2019-10-31 19:51:16 +00:00
|
|
|
$skin = $context->getSkin();
|
2016-02-17 09:09:32 +00:00
|
|
|
$pages['MediaWiki:Common.js'] = [ 'type' => 'script' ];
|
2019-10-31 19:51:16 +00:00
|
|
|
$pages['MediaWiki:' . ucfirst( $skin ) . '.js'] = [ 'type' => 'script' ];
|
|
|
|
|
Hooks::run( 'ResourceLoaderSiteModulePages', [ $skin, &$pages ] );
|
2013-04-03 20:50:08 +00:00
|
|
|
}
|
2010-10-19 18:25:42 +00:00
|
|
|
return $pages;
|
|
|
|
|
}
|
2016-06-06 18:21:36 +00:00
|
|
|
|
2017-07-01 00:31:56 +00:00
|
|
|
/**
|
2017-09-09 20:47:04 +00:00
|
|
|
* @param ResourceLoaderContext|null $context
|
2016-06-06 18:21:36 +00:00
|
|
|
* @return array
|
|
|
|
|
*/
|
|
|
|
|
public function getDependencies( ResourceLoaderContext $context = null ) {
|
|
|
|
|
return [ 'site.styles' ];
|
|
|
|
|
}
|
2010-10-19 18:25:42 +00:00
|
|
|
}
|