wfMsgForContentNoTrans() was removed
[mediawiki.git] / includes / resourceloader / ResourceLoaderSkinModule.php
blobe1df6d95740cd667394fc85fb2a7f28b571a4229
1 <?php
2 /**
3 * ResourceLoader module for skin stylesheets.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
20 * @file
21 * @author Timo Tijhof
24 class ResourceLoaderSkinModule extends ResourceLoaderFileModule {
26 /* Methods */
28 /**
29 * @param $context ResourceLoaderContext
30 * @return array
32 public function getStyles( ResourceLoaderContext $context ) {
33 $logo = $this->getConfig()->get( 'Logo' );
34 $logoHD = $this->getConfig()->get( 'LogoHD' );
35 $styles = parent::getStyles( $context );
36 $styles['all'][] = '.mw-wiki-logo { background-image: ' .
37 CSSMin::buildUrlValue( $logo ) .
38 '; }';
39 if ( $logoHD ) {
40 if ( isset( $logoHD['1.5x'] ) ) {
41 $styles[
42 '(-webkit-min-device-pixel-ratio: 1.5), ' .
43 '(min--moz-device-pixel-ratio: 1.5), ' .
44 '(min-resolution: 1.5dppx), ' .
45 '(min-resolution: 144dpi)'
46 ][] = '.mw-wiki-logo { background-image: ' .
47 CSSMin::buildUrlValue( $logoHD['1.5x'] ) . ';' .
48 'background-size: 135px auto; }';
50 if ( isset( $logoHD['2x'] ) ) {
51 $styles[
52 '(-webkit-min-device-pixel-ratio: 2), ' .
53 '(min--moz-device-pixel-ratio: 2),' .
54 '(min-resolution: 2dppx), ' .
55 '(min-resolution: 192dpi)'
56 ][] = '.mw-wiki-logo { background-image: ' .
57 CSSMin::buildUrlValue( $logoHD['2x'] ) . ';' .
58 'background-size: 135px auto; }';
61 return $styles;
64 /**
65 * @param $context ResourceLoaderContext
66 * @return bool
68 public function isKnownEmpty( ResourceLoaderContext $context ) {
69 // Regardless of whether the files are specified, we always
70 // provide mw-wiki-logo styles.
71 return false;
74 /**
75 * @param $context ResourceLoaderContext
76 * @return string: Hash
78 public function getModifiedHash( ResourceLoaderContext $context ) {
79 $logo = $this->getConfig()->get( 'Logo' );
80 $logoHD = $this->getConfig()->get( 'LogoHD' );
81 return md5( parent::getModifiedHash( $context ) . $logo . json_encode( $logoHD ) );