r73621 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r73620‎ | r73621 | r73622 >
Date:18:34, 23 September 2010
Author:tomasz
Status:deferred
Tags:
Comment:
Syncing to head at r73620
Modified paths:
  • /branches/wmf/1.16wmf4/extensions/VariablePage (modified) (history)
  • /branches/wmf/1.16wmf4/extensions/VariablePage/VariablePage.body.php (modified) (history)
  • /branches/wmf/1.16wmf4/extensions/VariablePage/VariablePage.i18n.php (modified) (history)
  • /branches/wmf/1.16wmf4/extensions/VariablePage/VariablePage.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.16wmf4/extensions/VariablePage/VariablePage.body.php
@@ -13,24 +13,24 @@
1414
1515 public function execute() {
1616 global $wgOut, $wgRequest;
17 - global $wgVariablePagePossibilities, $wgVariablePageUtmMedium;
 17+ global $wgVariablePagePossibilities;
1818
1919 $lang = ( preg_match( '/^[A-Za-z-]+$/', $wgRequest->getVal( 'lang' ) ) ) ? $wgRequest->getVal( 'lang' ) : 'en' ;
2020 $utm_source = $wgRequest->getVal( 'utm_source' );
21 - $utm_medium = ( strlen($wgVariablePageUtmMedium )) ? $wgVariablePageUtmMedium : $wgRequest->getVal( 'utm_medium' );
 21+ $utm_medium = $wgRequest->getVal( 'utm_medium' );
2222 $utm_campaign = $wgRequest->getVal( 'utm_campaign' );
23 - $referrer = $wgRequest->getHeader( 'referrer' );
 23+ $referrer = ( $wgRequest->getVal( 'referrer' )) ? $wgRequest->getVal( 'referrer' ) : $wgRequest->getHeader( 'referer' );
2424
2525 $query = array();
2626 if ( strlen( $lang ) ) $query[ 'language' ] = $lang;
27 - if ( strlen( $utm_source )) $query[ 'utm_source' ] = $utm_source;
28 - if ( strlen( $utm_medium )) $query[ 'utm_medium' ] = $utm_medium;
29 - if ( strlen( $utm_campaign )) $query[ 'utm_campaign' ] = $utm_campaign;
30 - if ( strlen( $referrer )) $query[ 'referrer' ] = $referrer;
 27+ if ( strlen( $utm_source ) ) $query[ 'utm_source' ] = $utm_source;
 28+ if ( strlen( $utm_medium ) ) $query[ 'utm_medium' ] = $utm_medium;
 29+ if ( strlen( $utm_campaign ) ) $query[ 'utm_campaign' ] = $utm_campaign;
 30+ if ( strlen( $referrer ) ) $query[ 'referrer' ] = $referrer;
3131
3232 // determine the URL to which we will redirect the user
3333 $url = $this->determinePage( $wgVariablePagePossibilities );
34 - $wgOut->redirect( wfAppendQuery( $url, $query ));
 34+ $wgOut->redirect( wfAppendQuery( $url, $query ) );
3535 }
3636
3737 /**
@@ -80,10 +80,10 @@
8181 $total_probability += $probability;
8282 }
8383
84 - if ( $total_probability != 100 && !strlen( $wgVariablePageDefault )) {
85 - return FALSE;
 84+ if ( $total_probability != 100 && !strlen( $wgVariablePageDefault ) ) {
 85+ return false;
8686 } else {
87 - return TRUE;
 87+ return true;
8888 }
8989 }
9090 }
Index: branches/wmf/1.16wmf4/extensions/VariablePage/VariablePage.i18n.php
@@ -13,8 +13,9 @@
1414 * @author Arthur Richards
1515 */
1616 $messages['en'] = array(
 17+ 'variablepage' => 'VariablePage',
 18+ 'variablepage-navlink_text' => 'Donate',
1719 'variablepage-desc' => 'Lightweight variable page redirection',
18 - 'variablepage-randomurl' => 'Special:VariablePage',
1920 );
2021
2122 /** Bosnian (Bosanski)
@@ -31,6 +32,13 @@
3233 'variablepage-desc' => 'Ermöglicht ressourcenschonende variable Weiterleitungen von Wikiseiten',
3334 );
3435
 36+/** French (Français)
 37+ * @author Peter17
 38+ */
 39+$messages['fr'] = array(
 40+ 'variablepage-desc' => 'Redirection de page légère et variable',
 41+);
 42+
3543 /** Galician (Galego)
3644 * @author Toliño
3745 */
@@ -38,6 +46,13 @@
3947 'variablepage-desc' => 'Redirección lixeira de páxina variable',
4048 );
4149
 50+/** Swiss German (Alemannisch)
 51+ * @author Als-Holder
 52+ */
 53+$messages['gsw'] = array(
 54+ 'variablepage-desc' => 'Lychti variabli Wyterleitige',
 55+);
 56+
4257 /** Interlingua (Interlingua)
4358 * @author McDutchie
4459 */
@@ -45,6 +60,20 @@
4661 'variablepage-desc' => 'Redirection variabile de paginas sin consumption excessive de ressources',
4762 );
4863
 64+/** Japanese (日本語)
 65+ * @author 青子守歌
 66+ */
 67+$messages['ja'] = array(
 68+ 'variablepage-desc' => '軽い可変ページのリダイレクト',
 69+);
 70+
 71+/** Colognian (Ripoarisch)
 72+ * @author Purodha
 73+ */
 74+$messages['ksh'] = array(
 75+ 'variablepage-desc' => 'Ein eijfache Ömleidung op ongerscheidlijje Sigge.',
 76+);
 77+
4978 /** Luxembourgish (Lëtzebuergesch)
5079 * @author Robby
5180 */
@@ -66,6 +95,13 @@
6796 'variablepage-desc' => "Lichtgewicht variabele doorverwijzing voor pagina's",
6897 );
6998
 99+/** Polish (Polski)
 100+ * @author Sp5uhe
 101+ */
 102+$messages['pl'] = array(
 103+ 'variablepage-desc' => 'Prosta strona przekierowująca losowo',
 104+);
 105+
70106 /** Piedmontese (Piemontèis)
71107 * @author Dragonòt
72108 */
@@ -94,3 +130,10 @@
95131 'variablepage-desc' => 'Простое перенаправление на различные страницы',
96132 );
97133
 134+/** Tagalog (Tagalog)
 135+ * @author AnakngAraw
 136+ */
 137+$messages['tl'] = array(
 138+ 'variablepage-desc' => 'Magaang na pabagubaong muling pagiiba ng pupuntahan ng pahina',
 139+);
 140+
Index: branches/wmf/1.16wmf4/extensions/VariablePage/VariablePage.php
@@ -34,29 +34,58 @@
3535 * 'http://foo.com/bar' => 90,
3636 * );
3737 */
38 -$wgVariablePagePossibilities = array(
39 - 'http://wikimediafoundation.org/wiki/Support_Wikipedia' => 100
40 -);
 38+$wgVariablePagePossibilities = array();
4139
4240 /**
43 - * You may set a custom utm_medium to be used for pages reached via VariablePage
44 - *
45 - * This can be set to whatever string you wish to use for utm_medium
46 - */
47 -$wgVariablePageUtmMedium = '';
48 -
49 -/**
5041 * The default URL to send a user to in the event that one of the URLs in
5142 * $wgVariablePagePossibilities not selected.
5243 *
5344 * Either this must be set or the probabilities in $wgVariablePagePossibiliites
5445 * must add up to 100.
5546 */
56 -$wgVariablePageDefault = '';
 47+$wgVariablePageDefault = 'http://wikimediafoundation.org/wiki/Support_Wikipedia';
5748
 49+/**
 50+ * If this is set to TRUE, a sidebar nav link to Special:VariablePage will be displayed
 51+ */
 52+$wgVariablePageShowSidebarLink = false;
 53+
 54+/**
 55+ * If you need to add a query to the sidebar nav link, set them with this.
 56+ *
 57+ * array( $key => $value ) will become ?key=value
 58+ */
 59+$wgVariablePageSidebarLinkQuery = array();
 60+
 61+/**
 62+ * Edit the sidebar navigation
 63+ */
 64+$wgHooks['SkinBuildSidebar'][] = 'efVariablePageSidebarLink';
 65+
5866 $dir = dirname( __FILE__ ) . '/';
5967
6068 $wgAutoloadClasses[ 'SpecialVariablePage' ] = $dir . 'VariablePage.body.php';
6169 $wgExtensionMessagesFiles[ 'VariablePage' ] = $dir . 'VariablePage.i18n.php';
6270 $wgSpecialPages[ 'VariablePage' ] = 'SpecialVariablePage';
6371 $wgSpecialPageGroups[ 'VariablePage' ] = 'contribution';
 72+
 73+/**
 74+ * Place a link to Special:VariablePage in the navigation sidebar
 75+ * @return bool
 76+ */
 77+function efVariablePageSidebarLink( $skin, &$bar ) {
 78+ global $wgVariablePageShowSidebarLink, $wgVariablePageSidebarLinkQuery;
 79+
 80+ // make sure that we should be showing a sidebar link
 81+ if ( $wgVariablePageShowSidebarLink ) {
 82+ $url = Title::makeTitle( NS_SPECIAL, wfMsg( 'variablepage' ) )->getLocalUrl();
 83+ $bar['navigation'][] = array(
 84+ 'text' => wfMsg( 'variablepage-navlink_text' ),
 85+ 'href' => wfAppendQuery( $url, $wgVariablePageSidebarLinkQuery ),
 86+ 'id' => 'n-variablepage',
 87+ 'active' => true,
 88+ );
 89+ }
 90+
 91+ return true;
 92+}
Property changes on: branches/wmf/1.16wmf4/extensions/VariablePage
___________________________________________________________________
Modified: svn:mergeinfo
6493 Merged /trunk/extensions/VariablePage:r73150-73620

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r73620Fixed mispelling of requestawjrichards18:27, 23 September 2010

Status & tagging log