1
0
mirror of https://github.com/Hutchy68/pivot.git synced 2024-11-21 18:09:03 +01:00

Handles 1.39 deprecations, simplifies skin registration

In 1.36 the skin registration process was modified to support
registration for common skin meta data

This removes warnings in >= 1.39.
This commit is contained in:
Jon Robson 2022-06-10 12:53:18 -07:00
parent 1eb50e8b06
commit f831643f08
2 changed files with 20 additions and 24 deletions

View File

@ -9,8 +9,6 @@
class SkinPivot extends SkinTemplate {
public $skinname = 'pivot', $stylename = 'pivot', $template = 'pivotTemplate', $useHeadElement = true;
public function getDefaultModules() {
global $wgPivotFeatures;
$wgPivotFeaturesDefaults = array(
@ -37,29 +35,16 @@ class SkinPivot extends SkinTemplate {
if ( $wgPivotFeatures['preloadFontAwesome'] ) {
$this->getOutput()->addHeadItem('font', '<link rel="preload" href="'.$wgLocalStylePath.'/pivot/assets/fonts/fontawesome-webfont.woff2?v=4.7.0" as="font" type="font/woff2" crossorigin="anonymous" />');
}
$this->getOutput()->addModuleStyles('skins.pivot.styles');
return parent::getDefaultModules();
return parent::getDefaultModules();
}
public function initPage(OutputPage $out) {
global $wgLocalStylePath;
parent::initPage($out);
$viewport_meta = 'width=device-width, user-scalable=yes, initial-scale=1.0';
$out->addMeta('viewport', $viewport_meta);
$out->addModules('skins.pivot.js');
}
}
class pivotTemplate extends BaseTemplate {
class PivotTemplate extends BaseTemplate {
public function execute() {
global $wgUser;
global $wgPivotFeatures;
Wikimedia\suppressWarnings();
$this->html('headelement');
switch ($wgPivotFeatures['usePivotTabs']) {
case true:
ob_start();
@ -277,15 +262,10 @@ class pivotTemplate extends BaseTemplate {
<div>
<a class="exit-off-canvas"></a>
</div>
<?php $this->printTrail(); ?>
<?php if ($this->data['isarticle'] && $wgPivotFeatures['addThisPUBID'] !== '') { ?>
<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=<?php echo $wgPivotFeatures['addThisPUBID']; ?>" async="async"></script>
<?php } ?>
</body>
</html>
<?php
Wikimedia\restoreWarnings();

View File

@ -10,10 +10,26 @@
"descriptionmsg": "pivot-desc",
"type": "skin",
"ValidSkinNames": {
"pivot": "Pivot"
"pivot": {
"class": "SkinPivot",
"args": [
{
"name": "pivot",
"template": "PivotTemplate",
"bodyOnly": true,
"responsive": true,
"scripts": [
"skins.pivot.js"
],
"styles": [
"skins.pivot.styles"
]
}
]
}
},
"requires": {
"MediaWiki": ">= 1.35.0"
"MediaWiki": ">= 1.39.0"
},
"MessagesDirs": {
"Skinpivot": [