Foxtrott has submitted this change and it was merged. Change subject: Changes to match lates Bootstrap ext version; enable composer install ......................................................................
Changes to match lates Bootstrap ext version; enable composer install Change-Id: I337e95473e2d6c7df91f84b1a0161c7be5b5268b --- A Chameleon.php D chameleon.php M composer.json A includes/Hooks.php 4 files changed, 161 insertions(+), 115 deletions(-) Approvals: Foxtrott: Verified; Looks good to me, approved diff --git a/Chameleon.php b/Chameleon.php new file mode 100644 index 0000000..549ab4e --- /dev/null +++ b/Chameleon.php @@ -0,0 +1,104 @@ +<?php +/** + * The Chameleon skin. A Mediawiki skin using Twitter Bootstrap. + * + * @see https://www.mediawiki.org/wiki/Skin:Chameleon + * + * @author Stephan Gambke + * @version 1.0-alpha + * + */ +use Bootstrap\BootstrapManager; + +/** + * The main file of the Chameleon skin + * + * @copyright (C) 2013, Stephan Gambke + * @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License, version 3 (or later) + * + * This file is part of the MediaWiki skin Chameleon. + * The Chameleon skin 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 3 of the License, or + * (at your option) any later version. + * + * The Chameleon skin 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, see <http://www.gnu.org/licenses/>. + * + * @file + * @ingroup Skins + */ + +call_user_func( function () { + + if ( !defined( 'MEDIAWIKI' ) ) { + die( 'This file is part of a MediaWiki extension, it is not a valid entry point.' ); + } + + if ( !defined( 'BS_VERSION' ) ) { + die( '<b>Error:</b> The <a href="https://www.mediawiki.org/wiki/Skin:Chameleon">Chameleon</a> skin depends on the Bootstrap extension. You need to install the <a href="https://www.mediawiki.org/wiki/Extension:Bootstrap">Bootstrap</a> extension first.' ); + } + + // define the skin's version + define( 'CHAMELEON_VERSION', '1.0-alpha' ); + + // set extension credits + $GLOBALS[ 'wgExtensionCredits' ][ 'skin' ][ ] = array( + 'path' => __FILE__, + 'name' => 'Chameleon', + 'descriptionmsg' => 'chameleon-desc', + 'author' => '[http://www.mediawiki.org/wiki/User:F.trott Stephan Gambke]', + 'url' => 'https://www.mediawiki.org/wiki/Skin:Chameleon', + 'version' => CHAMELEON_VERSION, + ); + + // register skin + $GLOBALS[ 'wgValidSkinNames' ][ 'chameleon' ] = 'Chameleon'; + + // register message file for i18n + $GLOBALS[ 'wgExtensionMessagesFiles' ][ 'Chameleon' ] = dirname( __FILE__ ) . '/Chameleon.i18n.php'; + + $chameleonComponents = array( + 'Component', + 'Structure', + 'Container', + 'Row', + 'Cell', + 'Grid', + 'NavbarHorizontal', + 'NavMenu', + 'PageTools', + 'NewtalkNotifier', + 'PersonalTools', + 'Logo', + 'SearchBar', + 'SiteNotice', + 'ToolbarHorizontal', + 'FooterInfo', + 'FooterPlaces', + 'FooterIcons', + 'MainContent', + 'Html', + ); + + foreach ( $chameleonComponents as $component ) { + $GLOBALS[ 'wgAutoloadClasses' ][ 'skins\\chameleon\\components\\' . $component ] = __DIR__ . '/includes/components/' . $component . '.php'; + } + + + $GLOBALS[ 'wgAutoloadClasses' ][ 'SkinChameleon' ] = dirname( __FILE__ ) . '/includes/SkinChameleon.php'; // register skin class (must be 'Skin' . SkinName) + $GLOBALS[ 'wgAutoloadClasses' ][ 'skins\chameleon\ChameleonTemplate' ] = dirname( __FILE__ ) . '/includes/ChameleonTemplate.php'; + $GLOBALS[ 'wgAutoloadClasses' ][ 'skins\chameleon\IdRegistry' ] = dirname( __FILE__ ) . '/includes/IdRegistry.php'; + $GLOBALS[ 'wgAutoloadClasses' ][ 'skins\chameleon\Hooks' ] = dirname( __FILE__ ) . '/includes/Hooks.php'; + + $GLOBALS[ 'wgHooks' ][ 'SetupAfterCache' ][ ] = 'skins\chameleon\Hooks::onSetupAfterCache'; + + // set default skin layout + $GLOBALS[ 'egChameleonLayoutFile' ] = dirname( __FILE__ ) . '/layouts/standard.xml'; + +} ); diff --git a/chameleon.php b/chameleon.php deleted file mode 100644 index 56a2299..0000000 --- a/chameleon.php +++ /dev/null @@ -1,100 +0,0 @@ -<?php -/** - * The Chameleon skin. A Mediawiki skin using Twitter Bootstrap. - * - * @see https://www.mediawiki.org/wiki/Skin:Chameleon - * - * @author Stephan Gambke - * @version 0.2 alpha-1 - * - */ - -/** - * The main file of the Chameleon skin - * - * @copyright (C) 2013, Stephan Gambke - * @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License, version 3 (or later) - * - * This file is part of the MediaWiki skin Chameleon. - * The Chameleon skin 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 3 of the License, or - * (at your option) any later version. - * - * The Chameleon skin 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, see <http://www.gnu.org/licenses/>. - * - * @file - * @ingroup Skins - */ - -if ( !defined( 'MEDIAWIKI' ) ) { - die( 'This file is part of a MediaWiki extension, it is not a valid entry point.' ); -} - -if ( !defined( 'BS_VERSION' ) ) { - die( '<b>Error:</b> The <a href="https://www.mediawiki.org/wiki/Skin:Chameleon">Chameleon</a> skin depends on the Bootstrap extension. You need to install the <a href="https://www.mediawiki.org/wiki/Extension:Bootstrap">Bootstrap</a> extension first.' ); -} - -// define the skin's version -define( 'CHAMELEON_VERSION', '0.2 alpha-1' ); - -// set extension credits -$wgExtensionCredits['skin'][] = array( - 'path' => __FILE__, - 'name' => 'Chameleon', - 'descriptionmsg' => 'chameleon-desc', - 'author' => '[http://www.mediawiki.org/wiki/User:F.trott Stephan Gambke]', - 'url' => 'https://www.mediawiki.org/wiki/Skin:Chameleon', - 'version' => CHAMELEON_VERSION, -); - -// register skin -$wgValidSkinNames['chameleon'] = 'Chameleon'; - -// register skin class (must be 'Skin' . SkinName) -$wgAutoloadClasses['SkinChameleon'] = dirname( __FILE__ ) . '/includes/SkinChameleon.php'; -$wgAutoloadClasses['skins\\chameleon\\ChameleonTemplate'] = dirname( __FILE__ ) . '/includes/ChameleonTemplate.php'; -$wgAutoloadClasses['skins\\chameleon\\IdRegistry'] = dirname( __FILE__ ) . '/includes/IdRegistry.php'; - - -$egChameleonLayoutFile= dirname( __FILE__ ) . '/layouts/standard.xml'; - -$chameleonComponents = array( - 'Component', - 'Structure', - 'Container', - 'Row', - 'Cell', - 'Grid', - 'NavbarHorizontal', - 'NavMenu', - 'PageTools', - 'NewtalkNotifier', - 'PersonalTools', - 'Logo', - 'SearchBar', - 'SiteNotice', - 'ToolbarHorizontal', - 'FooterInfo', - 'FooterPlaces', - 'FooterIcons', - 'MainContent', - 'Html', -); - -foreach ( $chameleonComponents as $component ) { - $wgAutoloadClasses['skins\\chameleon\\components\\' . $component] = dirname( __FILE__ ) . '/includes/components/' . $component. '.php'; -} - -// register message file for i18n -$wgExtensionMessagesFiles['Chameleon'] = dirname( __FILE__ ) . '/Chameleon.i18n.php'; - -// register Bootstrap modules (for now, just register everything) -Bootstrap::getBootstrap()->addAllBootstrapModules(); -Bootstrap::getBootstrap()->addExternalModule( __DIR__, '/styles/screen.less' ); diff --git a/composer.json b/composer.json index f188c6f..864558a 100644 --- a/composer.json +++ b/composer.json @@ -18,28 +18,28 @@ "role" : "Developer" } ], - "support": { - "wiki": "https://www.mediawiki.org/wiki/Skin:Chameleon", - "forum": "https://www.mediawiki.org/wiki/Skin_talk:Chameleon", + "support" : { + "wiki" : "https://www.mediawiki.org/wiki/Skin:Chameleon", + "forum" : "https://www.mediawiki.org/wiki/Skin_talk:Chameleon", "source": "https://git.wikimedia.org/tree/mediawiki%2Fskins%2Fchameleon.git", "issues": "https://bugzilla.wikimedia.org/buglist.cgi?component=Chameleon&product=MediaWiki%20extensions", - "irc": "irc://irc.freenode.org/mediawiki" + "irc" : "irc://irc.freenode.org/mediawiki" }, "require" : { - "php" : ">=5.3.0", - "ext-dom": "*", - "ext-filter": "*", - "composer/installers" : ">1.0.12" + "php" : ">=5.3.0", + "ext-dom" : "*", + "ext-filter" : "*", + "composer/installers": ">1.0.12", + "mediawiki/bootstrap": "~1.0" }, "autoload" : { "files": [ - "chameleon.php" + "Chameleon.php" ] }, - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - - } - } + "extra" : { + "branch-alias": { + "dev-master": "1.x-dev" + } + } } diff --git a/includes/Hooks.php b/includes/Hooks.php new file mode 100644 index 0000000..e09e502 --- /dev/null +++ b/includes/Hooks.php @@ -0,0 +1,42 @@ +<?php +/** + * File holding the Hooks class + * + * @copyright (C) 2013, Stephan Gambke + * @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License, version 3 (or later) + * + * This file is part of the MediaWiki skin Chameleon. + * The Chameleon skin 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 3 of the License, or + * (at your option) any later version. + * + * The Chameleon skin 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, see <http://www.gnu.org/licenses/>. + * + * @file + * @ingroup Skins + */ + +namespace skins\chameleon; + +use bootstrap\BootstrapManager; + +/** + * Class Hooks holds the Chameleon skin hook handlers + * + * @package skins\chameleon + */ +class Hooks { + + function onSetupAfterCache() { + // register Bootstrap modules (for now, just register everything) + BootstrapManager::getBootstrapManager()->addAllBootstrapModules(); + BootstrapManager::getBootstrapManager()->addExternalModule( $GLOBALS['wgStyleDirectory'] . '/chameleon/styles/screen.less', $GLOBALS[ 'wgStylePath'] . '/chameleon/styles' ); + } +} -- To view, visit https://gerrit.wikimedia.org/r/124277 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I337e95473e2d6c7df91f84b1a0161c7be5b5268b Gerrit-PatchSet: 4 Gerrit-Project: mediawiki/skins/chameleon Gerrit-Branch: master Gerrit-Owner: Foxtrott <[email protected]> Gerrit-Reviewer: Foxtrott <[email protected]> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
