X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;ds=sidebyside;f=includes%2FSkin.php;h=177e2b1df63ada6df047d945cca5a593de236b50;hb=f4471830752b5f33750fdd3abdc532e679bbf969;hp=0d165fe04f9633cbbe3b94d4349fdbaa10e9b730;hpb=ecc71fc9e4bac94a879c0734d90ba0b94211d5d3;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Skin.php b/includes/Skin.php index 0d165fe04f..177e2b1df6 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -36,6 +36,12 @@ abstract class Skin extends ContextSource { protected $mRelevantTitle = null; protected $mRelevantUser = null; + /** + * @var string Stylesheets set to use. Subdirectory in skins/ where various stylesheets are + * located. Only needs to be set if you intend to use the getSkinStylePath() method. + */ + public $stylename = null; + /** * Fetch the set of available skins. * @return array Associative array of strings @@ -104,7 +110,6 @@ abstract class Skin extends ContextSource { static function getSkinNameMessages() { $messages = array(); foreach ( self::getSkinNames() as $skinKey => $skinName ) { - // Messages: skinname-vector, skinname-monobook $messages[] = "skinname-$skinKey"; } return $messages; @@ -1092,11 +1097,20 @@ abstract class Skin extends ContextSource { * Return a fully resolved style path url to images or styles stored in the current skins's folder. * This method returns a url resolved using the configured skin style path * and includes the style version inside of the url. + * + * Requires $stylename to be set, otherwise throws MWException. + * * @param string $name The name or path of a skin resource file * @return string The fully resolved style path url including styleversion */ function getSkinStylePath( $name ) { global $wgStylePath, $wgStyleVersion; + + if ( $this->stylename === null ) { + $class = get_class( $this ); + throw new MWException( "$class::\$stylename must be set to use getSkinStylePath()" ); + } + return "$wgStylePath/{$this->stylename}/$name?$wgStyleVersion"; }