<?php
/**
- * Resource loader module for site customizations.
+ * ResourceLoader module for site customizations.
*
* 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
*/
class ResourceLoaderSiteModule extends ResourceLoaderWikiModule {
- /* Protected Methods */
-
/**
- * Gets list of pages used by this module
+ * Get list of pages used by this module
*
* @param ResourceLoaderContext $context
- *
* @return array List of pages
*/
protected function getPages( ResourceLoaderContext $context ) {
- $pages = array();
+ $pages = [];
if ( $this->getConfig()->get( 'UseSiteJs' ) ) {
- $pages['MediaWiki:Common.js'] = array( 'type' => 'script' );
- $pages['MediaWiki:' . ucfirst( $context->getSkin() ) . '.js'] = array( 'type' => 'script' );
- }
- if ( $this->getConfig()->get( 'UseSiteCss' ) ) {
- $pages['MediaWiki:Common.css'] = array( 'type' => 'style' );
- $pages['MediaWiki:' . ucfirst( $context->getSkin() ) . '.css'] = array( 'type' => 'style' );
-
+ $pages['MediaWiki:Common.js'] = [ 'type' => 'script' ];
+ $pages['MediaWiki:' . ucfirst( $context->getSkin() ) . '.js'] = [ 'type' => 'script' ];
}
- $pages['MediaWiki:Print.css'] = array( 'type' => 'style', 'media' => 'print' );
return $pages;
}
- /* Methods */
-
- /**
- * @param $context ResourceLoaderContext
+ /*
* @return array
*/
- public function getStyles( ResourceLoaderContext $context ) {
- global $wgLogo;
-
- $styles = parent::getStyles( $context );
- $styles['all'][] = '.mw-wiki-logo { background-image: ' .
- CSSMin::buildUrlValue( $wgLogo ) .
- '; }';
-
- return $styles;
- }
-
- /**
- * @param $context ResourceLoaderContext
- * @return boolean
- */
- public function isKnownEmpty( ResourceLoaderContext $context ) {
- // Regardless of whether the wiki page(s) exist, we always
- // provide mw-wiki-logo styles.
- return false;
- }
-
- /**
- * @param $context ResourceLoaderContext
- * @return int|mixed
- */
- public function getModifiedTime( ResourceLoaderContext $context ) {
- $parentMTime = parent::getModifiedTime( $context );
- return max( $parentMTime, $this->getHashMtime( $context ) );
- }
-
- /**
- * @param $context ResourceLoaderContext
- * @return string: Hash
- */
- public function getModifiedHash( ResourceLoaderContext $context ) {
- global $wgLogo;
- return md5( parent::getModifiedHash( $context ) . $wgLogo );
- }
-
- /**
- * Gets group name
- *
- * @return string Name of group
- */
- public function getGroup() {
- return 'site';
+ public function getDependencies( ResourceLoaderContext $context = null ) {
+ return [ 'site.styles' ];
}
}