Revert "Made LCStoreDB try to use a separate DB connection"
[lhc/web/wiklou.git] / skins / Vector / SkinVector.php
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 protected static $bodyClasses = array( 'vector-animateLayout' );
35
36 /**
37 * Initializes output page and sets up skin-specific parameters
38 * @param OutputPage $out Object to initialize
39 */
40 public function initPage( OutputPage $out ) {
41 global $wgLocalStylePath;
42
43 parent::initPage( $out );
44
45 // Append CSS which includes IE only behavior fixes for hover support -
46 // this is better than including this in a CSS file since it doesn't
47 // wait for the CSS file to load before fetching the HTC file.
48 $min = $this->getRequest()->getFuzzyBool( 'debug' ) ? '' : '.min';
49 $out->addHeadItem( 'csshover',
50 '<!--[if lt IE 7]><style type="text/css">body{behavior:url("' .
51 htmlspecialchars( $wgLocalStylePath ) .
52 "/{$this->stylename}/csshover{$min}.htc\")}</style><![endif]-->"
53 );
54
55 $out->addModules( array( 'skins.vector.js' ) );
56 }
57
58 /**
59 * Loads skin and user CSS files.
60 * @param OutputPage $out
61 */
62 function setupSkinUserCss( OutputPage $out ) {
63 parent::setupSkinUserCss( $out );
64
65 $styles = array( 'mediawiki.skinning.interface', 'skins.vector.styles' );
66 wfRunHooks( 'SkinVectorStyleModules', array( $this, &$styles ) );
67 $out->addModuleStyles( $styles );
68 }
69
70 /**
71 * Adds classes to the body element.
72 *
73 * @param OutputPage $out
74 * @param array &$bodyAttrs Array of attributes that will be set on the body element
75 */
76 function addToBodyAttributes( $out, &$bodyAttrs ) {
77 if ( isset( $bodyAttrs['class'] ) && strlen( $bodyAttrs['class'] ) > 0 ) {
78 $bodyAttrs['class'] .= ' ' . implode( ' ', static::$bodyClasses );
79 } else {
80 $bodyAttrs['class'] = implode( ' ', static::$bodyClasses );
81 }
82 }
83 }