r53257 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r53256‎ | r53257 | r53258 >
Date:20:12, 14 July 2009
Author:tparscal
Status:deferred
Tags:
Comment:
Added initial files for FundraiserPortal extension.
Modified paths:
  • /trunk/extensions/FundraiserPortal/FundraiserPortal.hooks.php (added) (history)
  • /trunk/extensions/FundraiserPortal/FundraiserPortal.i18n.php (added) (history)
  • /trunk/extensions/FundraiserPortal/FundraiserPortal.php (added) (history)

Diff [purge]

Index: trunk/extensions/FundraiserPortal/FundraiserPortal.i18n.php
@@ -0,0 +1,18 @@
 2+<?php
 3+/**
 4+ * Internationalisation for FundraiserPortal extension
 5+ *
 6+ * @file
 7+ * @ingroup Extensions
 8+ */
 9+
 10+$messages = array();
 11+
 12+/** English
 13+ * @author Trevor Parscal
 14+ */
 15+$messages['en'] = array(
 16+ 'fundraiserportal' => 'Fundraiser Portal',
 17+ 'fundraiserportal-desc' => 'Adds a please donate portal to the top of the sidebar.',
 18+ 'fundraiserportal-donate' => 'Support Wikipedia!'
 19+);
Index: trunk/extensions/FundraiserPortal/FundraiserPortal.php
@@ -0,0 +1,46 @@
 2+<?php
 3+/**
 4+ * FundraiserPortal extension
 5+ *
 6+ * @file
 7+ * @ingroup Extensions
 8+ *
 9+ * This file contains the main include file for the FundraiserPortal
 10+ * extension of MediaWiki.
 11+ *
 12+ * Usage: Add the following line to your LocalSettings.php file
 13+ * require_once( "$IP/extensions/FundraiserPortal/FundraiserPortal.php" );
 14+ *
 15+ * @author Trevor Parscal <tparscal@wikimedia.org>
 16+ * Allow "or a later version" here?
 17+ * @license GPL v2
 18+ * @version 0.1.1
 19+ */
 20+
 21+/* Configuration */
 22+
 23+$wgFundraiserPortalShow = true;
 24+$wgFundraiserPortalURL = 'http://wikimediafoundation.org/wiki/Donate/Now/en';
 25+
 26+/* Setup */
 27+
 28+// Sets Credits
 29+$wgExtensionCredits['other'][] = array(
 30+ 'path' => __FILE__,
 31+ 'name' => 'FundraiserPortal',
 32+ 'author' => 'Trevor Parscal',
 33+ 'version' => '0.1.1',
 34+ 'url' => 'http://www.mediawiki.org/wiki/FundraiserPortal',
 35+ 'descriptionmsg' => 'fundraiserportal-desc',
 36+);
 37+
 38+// Adds Autoload Classes
 39+$wgAutoloadClasses['FundraiserPortalHooks'] =
 40+ dirname( __FILE__ ) . "/FundraiserPortal.hooks.php";
 41+
 42+// Adds Internationalized Messages
 43+$wgExtensionMessagesFiles['FundraiserPortal'] =
 44+ dirname( __FILE__ ) . "/FundraiserPortal.i18n.php";
 45+
 46+// Registers Hooks
 47+$wgHooks['SkinBuildSidebar'][] = 'FundraiserPortalHooks::buildSidebar';
\ No newline at end of file
Index: trunk/extensions/FundraiserPortal/FundraiserPortal.hooks.php
@@ -0,0 +1,69 @@
 2+<?php
 3+/**
 4+ * Hooks for FundraiserPortal extension
 5+ *
 6+ * @file
 7+ * @ingroup Extensions
 8+ */
 9+
 10+class FundraiserPortalHooks {
 11+
 12+ /* Static Functions */
 13+
 14+ /**
 15+ * SkinBuildSidebar hook
 16+ * Adds please donate button to sidebar
 17+ */
 18+ public static function buildSidebar( $skin, &$bar ) {
 19+ global $wgFundraiserPortalURL, $wgFundraiserPortalShow;
 20+
 21+ if ( !$wgFundraiserPortalShow ) {
 22+ return true;
 23+ }
 24+
 25+ wfLoadExtensionMessages( 'FundraiserPortal' );
 26+
 27+ $css = <<<CSS
 28+/* Monobook Style */
 29+body.skin-monobook div#p-DONATE h5 {
 30+ display: none;
 31+}
 32+body.skin-monobook div#p-DONATE div.pBody a {
 33+ display: block;
 34+ margin: 0.5em;
 35+ margin-bottom: 0.25em;
 36+}
 37+/* Vector Style */
 38+body.skin-vector div#p-DONATE {
 39+ padding-top: 1em;
 40+}
 41+body.skin-vector div#p-DONATE h5 {
 42+ display: none;
 43+}
 44+body.skin-vector div#p-DONATE div.body {
 45+ background: none;
 46+ padding: 0;
 47+ margin: 0;
 48+ margin-left: 0.5em;
 49+}
 50+body.skin-vector div#p-DONATE div a {
 51+ display: block;
 52+ margin: 0.5em;
 53+ margin-bottom: 0;
 54+}
 55+CSS;
 56+ $portal = Xml::element(
 57+ 'style',
 58+ array( 'type' => 'text/css' ),
 59+ $css
 60+ );
 61+ $portal .= Xml::element(
 62+ 'a',
 63+ array( 'href' => $wgFundraiserPortalURL ),
 64+ wfMsg( 'fundraiserportal-donate' )
 65+ );
 66+ $bar = array_merge( array( 'DONATE' => $portal ), $bar );
 67+
 68+ return true;
 69+ }
 70+}

Status & tagging log