Anomie has uploaded a new change for review.
https://gerrit.wikimedia.org/r/160797
Change subject: Add "bare" skin
......................................................................
Add "bare" skin
The API output for help and 'fm' formats will soon have need of
including ResourceLoader modules on an otherwise-bare page. The easiest
way to do this is to use OutputPage, but that requires a skin. So let's
add a skin that outputs a basic page without any navigation elements or
other chrome.
Change-Id: Ifa95fae5acaa3cfbf2ca58a15f8d0c51d84b455a
---
M includes/AutoLoader.php
M includes/Setup.php
A includes/skins/SkinBare.php
A includes/skins/SkinBareTemplate.php
4 files changed, 100 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/97/160797/1
diff --git a/includes/AutoLoader.php b/includes/AutoLoader.php
index d79b2b1..626b76a 100644
--- a/includes/AutoLoader.php
+++ b/includes/AutoLoader.php
@@ -947,6 +947,8 @@
'MediaWikiI18N' => 'includes/skins/SkinTemplate.php',
'QuickTemplate' => 'includes/skins/SkinTemplate.php',
'Skin' => 'includes/skins/Skin.php',
+ 'SkinBare' => 'includes/skins/SkinBare.php',
+ 'SkinBareTemplate' => 'includes/skins/SkinBareTemplate.php',
'SkinException' => 'includes/skins/SkinException.php',
'SkinFactory' => 'includes/skins/SkinFactory.php',
'SkinFallback' => 'includes/skins/SkinFallback.php',
diff --git a/includes/Setup.php b/includes/Setup.php
index 78a41d5..c26cfa3 100644
--- a/includes/Setup.php
+++ b/includes/Setup.php
@@ -286,8 +286,13 @@
$factory->register( 'fallback', 'Fallback', function () {
return new SkinFallback;
} );
+ // Register a hidden skin for bare content output
+ $factory->register( 'bare', 'Bare', function () {
+ return new SkinBare;
+ } );
} );
$wgSkipSkins[] = 'fallback';
+$wgSkipSkins[] = 'bare';
if ( $wgLocalInterwiki ) {
array_unshift( $wgLocalInterwikis, $wgLocalInterwiki );
diff --git a/includes/skins/SkinBare.php b/includes/skins/SkinBare.php
new file mode 100644
index 0000000..56c68db
--- /dev/null
+++ b/includes/skins/SkinBare.php
@@ -0,0 +1,41 @@
+<?php
+/**
+ * Extremely basic "skin" for things that want to output a page without the
+ * usual skin elements but still using CSS, JS, and such via OutputPage and
+ * ResourceLoader.
+ *
+ * Created on Sep 08, 2014
+ *
+ * Copyright © 2014 Brad Jorsch <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ */
+
+/**
+ * SkinTemplate class for the 'bare' skin
+ * @since 1.24
+ */
+class SkinBare extends SkinTemplate {
+ public $skinname = 'bare';
+ public $template = 'SkinBareTemplate';
+
+ public function setupSkinUserCss( OutputPage $out ) {
+ parent::setupSkinUserCss( $out );
+ $out->addModuleStyles( 'mediawiki.skinning.interface' );
+ }
+}
diff --git a/includes/skins/SkinBareTemplate.php
b/includes/skins/SkinBareTemplate.php
new file mode 100644
index 0000000..6a8d58c
--- /dev/null
+++ b/includes/skins/SkinBareTemplate.php
@@ -0,0 +1,52 @@
+<?php
+/**
+ * Extremely basic "skin" for things that want to output a page without the
+ * usual skin elements but still using CSS, JS, and such via OutputPage and
+ * ResourceLoader.
+ *
+ * Created on Sep 08, 2014
+ *
+ * Copyright © 2014 Brad Jorsch <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ */
+
+/**
+ * BaseTemplate class for the 'bare' skin
+ * @since 1.24
+ */
+class SkinBareTemplate extends BaseTemplate {
+
+ public function execute() {
+ $this->html( 'headelement' ) ?>
+
+ <div class="mw-body" role="main">
+ <h1 class="firstHeading">
+ <span dir="auto"><?php $this->html( 'title' )
?></span>
+ </h1>
+ <div class="mw-body-content">
+ <?php $this->html( 'bodytext' ) ?>
+ </div>
+ </div>
+
+ <?php $this->printTrail() ?>
+ </body></html>
+
+ <?php
+ }
+}
--
To view, visit https://gerrit.wikimedia.org/r/160797
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifa95fae5acaa3cfbf2ca58a15f8d0c51d84b455a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Anomie <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits