[ Index ] |
PHP Cross Reference of MediaWiki-1.24.0 |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * Vector - Modern version of MonoBook with fresh look and many usability 4 * improvements. 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or 9 * (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License along 17 * with this program; if not, write to the Free Software Foundation, Inc., 18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 * http://www.gnu.org/copyleft/gpl.html 20 * 21 * @file 22 * @ingroup Skins 23 */ 24 25 /** 26 * SkinTemplate class for Vector skin 27 * @ingroup Skins 28 */ 29 class SkinVector extends SkinTemplate { 30 public $skinname = 'vector'; 31 public $stylename = 'Vector'; 32 public $template = 'VectorTemplate'; 33 /** 34 * @var Config 35 */ 36 private $vectorConfig; 37 38 public function __construct( Config $config ) { 39 $this->vectorConfig = $config; 40 } 41 42 protected static $bodyClasses = array( 'vector-animateLayout' ); 43 44 /** 45 * Initializes output page and sets up skin-specific parameters 46 * @param OutputPage $out Object to initialize 47 */ 48 public function initPage( OutputPage $out ) { 49 parent::initPage( $out ); 50 51 // Append CSS which includes IE only behavior fixes for hover support - 52 // this is better than including this in a CSS file since it doesn't 53 // wait for the CSS file to load before fetching the HTC file. 54 $min = $this->getRequest()->getFuzzyBool( 'debug' ) ? '' : '.min'; 55 $out->addHeadItem( 'csshover', 56 '<!--[if lt IE 7]><style type="text/css">body{behavior:url("' . 57 htmlspecialchars( $this->getConfig()->get( 'LocalStylePath' ) ) . 58 "/{$this->stylename}/csshover{$min}.htc\")}</style><![endif]-->" 59 ); 60 61 $out->addModules( array( 'skins.vector.js' ) ); 62 } 63 64 /** 65 * Loads skin and user CSS files. 66 * @param OutputPage $out 67 */ 68 function setupSkinUserCss( OutputPage $out ) { 69 parent::setupSkinUserCss( $out ); 70 71 $styles = array( 'mediawiki.skinning.interface', 'skins.vector.styles' ); 72 wfRunHooks( 'SkinVectorStyleModules', array( $this, &$styles ) ); 73 $out->addModuleStyles( $styles ); 74 } 75 76 /** 77 * Override to pass our Config instance to it 78 */ 79 public function setupTemplate( $classname, $repository = false, $cache_dir = false ) { 80 return new $classname( $this->vectorConfig ); 81 } 82 83 /** 84 * Adds classes to the body element. 85 * 86 * @param OutputPage $out 87 * @param array &$bodyAttrs Array of attributes that will be set on the body element 88 */ 89 function addToBodyAttributes( $out, &$bodyAttrs ) { 90 if ( isset( $bodyAttrs['class'] ) && strlen( $bodyAttrs['class'] ) > 0 ) { 91 $bodyAttrs['class'] .= ' ' . implode( ' ', static::$bodyClasses ); 92 } else { 93 $bodyAttrs['class'] = implode( ' ', static::$bodyClasses ); 94 } 95 } 96 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 14:03:12 2014 | Cross-referenced by PHPXref 0.7.1 |