Index: branches/wmf/1.19wmf1/extensions/FundraiserLandingPage/FundraiserLandingPage.i18n.php |
— | — | @@ -0,0 +1,220 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +$messages = array(); |
| 5 | + |
| 6 | +$messages['en'] = array( |
| 7 | + 'fundraiserlandingpage-desc' => 'Takes URL parameters and passes them to the specified template as template variables', |
| 8 | +); |
| 9 | + |
| 10 | +/** Afrikaans (Afrikaans) |
| 11 | + * @author පසිඳු කාවින්ද |
| 12 | + */ |
| 13 | +$messages['af'] = array( |
| 14 | + 'fundraiserlandingpage-desc' => 'Neem URL-parameters en oordra aan die spesifieke sjabloon as sjabloon veranderlikes', |
| 15 | +); |
| 16 | + |
| 17 | +/** Asturian (Asturianu) |
| 18 | + * @author Xuacu |
| 19 | + */ |
| 20 | +$messages['ast'] = array( |
| 21 | + 'fundraiserlandingpage-desc' => 'Toma los parámetros de la URL y los pasa como variables de plantía a la plantía especificada', |
| 22 | +); |
| 23 | + |
| 24 | +/** Belarusian (Taraškievica orthography) (Беларуская (тарашкевіца)) |
| 25 | + * @author EugeneZelenko |
| 26 | + * @author Wizardist |
| 27 | + */ |
| 28 | +$messages['be-tarask'] = array( |
| 29 | + 'fundraiserlandingpage-desc' => 'Выкарыстоўвае парамэтры з URL-адрасу і перадае іх у пазначаны шаблён у якасьці зьменных шаблёну', |
| 30 | +); |
| 31 | + |
| 32 | +/** German (Deutsch) |
| 33 | + * @author Kghbln |
| 34 | + */ |
| 35 | +$messages['de'] = array( |
| 36 | + 'fundraiserlandingpage-desc' => 'Ermögliche die Nutzung von URL-Parametern als Vorlagenvariablen', |
| 37 | +); |
| 38 | + |
| 39 | +/** Lower Sorbian (Dolnoserbski) |
| 40 | + * @author Michawiki |
| 41 | + */ |
| 42 | +$messages['dsb'] = array( |
| 43 | + 'fundraiserlandingpage-desc' => 'Pśepódawa URL-parametry na pódanu pśedłogu ako wariable pśedłogi', |
| 44 | +); |
| 45 | + |
| 46 | +/** Esperanto (Esperanto) |
| 47 | + * @author Blahma |
| 48 | + */ |
| 49 | +$messages['eo'] = array( |
| 50 | + 'fundraiserlandingpage-desc' => 'Akceptas URL-parametrojn kaj transdonas ilin al la respektiva ŝablono kiel ŝablonajn variablojn', |
| 51 | +); |
| 52 | + |
| 53 | +/** Spanish (Español) |
| 54 | + * @author Armando-Martin |
| 55 | + */ |
| 56 | +$messages['es'] = array( |
| 57 | + 'fundraiserlandingpage-desc' => 'Tome los parámetros de URL y páselos a la plantilla especificada como variables de plantilla', |
| 58 | +); |
| 59 | + |
| 60 | +/** Estonian (Eesti) |
| 61 | + * @author Pikne |
| 62 | + */ |
| 63 | +$messages['et'] = array( |
| 64 | + 'fundraiserlandingpage-desc' => 'Võtab aadressiribalt parameetrid ja annab need mallimuutujatena edasi määratud mallile.', |
| 65 | +); |
| 66 | + |
| 67 | +/** Persian (فارسی) |
| 68 | + * @author Huji |
| 69 | + */ |
| 70 | +$messages['fa'] = array( |
| 71 | + 'fundraiserlandingpage-desc' => 'پارامترهای نشانی اینترنتی را میگیرد و به صورت متغیرهای الگو تحویل الگوی مشخصشده میدهد.', |
| 72 | +); |
| 73 | + |
| 74 | +/** Finnish (Suomi) |
| 75 | + * @author Olli |
| 76 | + */ |
| 77 | +$messages['fi'] = array( |
| 78 | + 'fundraiserlandingpage-desc' => 'Ottaa osoitemuuttujat ja lähettää ne tietylle mallineelle muuttujina', |
| 79 | +); |
| 80 | + |
| 81 | +/** French (Français) |
| 82 | + * @author Gomoko |
| 83 | + */ |
| 84 | +$messages['fr'] = array( |
| 85 | + 'fundraiserlandingpage-desc' => "Prends les paramètres de l'URL et les passe au modèle spécifié comme variables de modèle", |
| 86 | +); |
| 87 | + |
| 88 | +/** Galician (Galego) |
| 89 | + * @author Toliño |
| 90 | + */ |
| 91 | +$messages['gl'] = array( |
| 92 | + 'fundraiserlandingpage-desc' => 'Toma parámetros URL e pásaos como variables de modelo a aquel modelo especificado', |
| 93 | +); |
| 94 | + |
| 95 | +/** Hebrew (עברית) |
| 96 | + * @author Amire80 |
| 97 | + */ |
| 98 | +$messages['he'] = array( |
| 99 | + 'fundraiserlandingpage-desc' => 'קבלת פרמטרים מכתובת והעברתן לתבנית שצוינה בתור משתנה תבנית', |
| 100 | +); |
| 101 | + |
| 102 | +/** Upper Sorbian (Hornjoserbsce) |
| 103 | + * @author Michawiki |
| 104 | + */ |
| 105 | +$messages['hsb'] = array( |
| 106 | + 'fundraiserlandingpage-desc' => 'Přepodawa URL-parametry na podatu předłohu jako wariable předłohi', |
| 107 | +); |
| 108 | + |
| 109 | +/** Hungarian (Magyar) |
| 110 | + * @author Dj |
| 111 | + * @author Misibacsi |
| 112 | + */ |
| 113 | +$messages['hu'] = array( |
| 114 | + 'fundraiserlandingpage-desc' => 'Veszi az URL paramétereket és mint sablon változókat átadja a megadott sablonnak', |
| 115 | +); |
| 116 | + |
| 117 | +/** Interlingua (Interlingua) |
| 118 | + * @author McDutchie |
| 119 | + */ |
| 120 | +$messages['ia'] = array( |
| 121 | + 'fundraiserlandingpage-desc' => 'Prende parametros de URL e los passa al patrono specificate como variabiles de patrono', |
| 122 | +); |
| 123 | + |
| 124 | +/** Indonesian (Bahasa Indonesia) |
| 125 | + * @author Kenrick95 |
| 126 | + */ |
| 127 | +$messages['id'] = array( |
| 128 | + 'fundraiserlandingpage-desc' => 'Ambil parameter URL dan melewatkannya ke templat yang telah ditentukan sebagai variabel templat', |
| 129 | +); |
| 130 | + |
| 131 | +/** Italian (Italiano) |
| 132 | + * @author F. Cosoleto |
| 133 | + */ |
| 134 | +$messages['it'] = array( |
| 135 | + 'fundraiserlandingpage-desc' => 'Accetta parametri URL e li passa al template specificato come variabili di template', |
| 136 | +); |
| 137 | + |
| 138 | +/** Japanese (日本語) |
| 139 | + * @author Whym |
| 140 | + */ |
| 141 | +$messages['ja'] = array( |
| 142 | + 'fundraiserlandingpage-desc' => 'URLパラメータを取り、それを指定されたテンプレートにテンプレート変数として渡す', |
| 143 | +); |
| 144 | + |
| 145 | +/** Luxembourgish (Lëtzebuergesch) |
| 146 | + * @author Robby |
| 147 | + */ |
| 148 | +$messages['lb'] = array( |
| 149 | + 'fundraiserlandingpage-desc' => "Hëllt d'Parameter vun der URL a gëtt se un déi spezifizéiert Schabloun als Schabloune-Variabele weider", |
| 150 | +); |
| 151 | + |
| 152 | +/** Macedonian (Македонски) |
| 153 | + * @author Bjankuloski06 |
| 154 | + */ |
| 155 | +$messages['mk'] = array( |
| 156 | + 'fundraiserlandingpage-desc' => 'Зема параметри од URL-адреса и му ги дава на наведениот шаблон како негови променливи', |
| 157 | +); |
| 158 | + |
| 159 | +/** Malay (Bahasa Melayu) |
| 160 | + * @author Anakmalaysia |
| 161 | + */ |
| 162 | +$messages['ms'] = array( |
| 163 | + 'fundraiserlandingpage-desc' => 'Mengambil parameter URL untuk diserahkan kepada templat yang ditentukan dalam bentuk pembolehubah templat', |
| 164 | +); |
| 165 | + |
| 166 | +/** Dutch (Nederlands) |
| 167 | + * @author Siebrand |
| 168 | + */ |
| 169 | +$messages['nl'] = array( |
| 170 | + 'fundraiserlandingpage-desc' => 'Accepteert URL-parameters en geeft deze door aan het opgegeven sjabloon als sjabloonvariabelen', |
| 171 | +); |
| 172 | + |
| 173 | +/** Polish (Polski) |
| 174 | + * @author Olgak85 |
| 175 | + */ |
| 176 | +$messages['pl'] = array( |
| 177 | + 'fundraiserlandingpage-desc' => 'Pobiera parametry adresu URL i przekazuje je do określonego szablonu jako zmienne szablonów', |
| 178 | +); |
| 179 | + |
| 180 | +/** Piedmontese (Piemontèis) |
| 181 | + * @author Dragonòt |
| 182 | + */ |
| 183 | +$messages['pms'] = array( |
| 184 | + 'fundraiserlandingpage-desc' => "A pija ij paràmetr d'anliura e a-j passa a lë stamp spessificà com variàbil dë stamp", |
| 185 | +); |
| 186 | + |
| 187 | +/** Russian (Русский) |
| 188 | + * @author Eugrus |
| 189 | + */ |
| 190 | +$messages['ru'] = array( |
| 191 | + 'fundraiserlandingpage-desc' => 'Использует параметры URL и передает их в указанный шаблон как переменные шаблона.', |
| 192 | +); |
| 193 | + |
| 194 | +/** Slovenian (Slovenščina) |
| 195 | + * @author Dbc334 |
| 196 | + */ |
| 197 | +$messages['sl'] = array( |
| 198 | + 'fundraiserlandingpage-desc' => 'Vzame parametre URL in jih posreduje navedeni predlogi kot spremenljivke predloge', |
| 199 | +); |
| 200 | + |
| 201 | +/** Vietnamese (Tiếng Việt) |
| 202 | + * @author Minh Nguyen |
| 203 | + */ |
| 204 | +$messages['vi'] = array( |
| 205 | + 'fundraiserlandingpage-desc' => 'Đưa các tham số URL vào bản mẫu được chỉ định như các biến bản mẫu', |
| 206 | +); |
| 207 | + |
| 208 | +/** Simplified Chinese (中文(简体)) |
| 209 | + * @author Yanmiao liu |
| 210 | + */ |
| 211 | +$messages['zh-hans'] = array( |
| 212 | + 'fundraiserlandingpage-desc' => '采用URL参数并将其作为模板变量传递给指定的模板', |
| 213 | +); |
| 214 | + |
| 215 | +/** Traditional Chinese (中文(繁體)) |
| 216 | + * @author Anakmalaysia |
| 217 | + */ |
| 218 | +$messages['zh-hant'] = array( |
| 219 | + 'fundraiserlandingpage-desc' => '採用URL參數並將其作為模板變量傳遞給指定的模板', |
| 220 | +); |
| 221 | + |
Property changes on: branches/wmf/1.19wmf1/extensions/FundraiserLandingPage/FundraiserLandingPage.i18n.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 222 | + native |
Index: branches/wmf/1.19wmf1/extensions/FundraiserLandingPage/FundraiserLandingPage.php |
— | — | @@ -0,0 +1,53 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/* |
| 5 | + * Extension:FundraiserLandingPage. This extension takes URL parameters in the |
| 6 | + * QueryString and passes them to the specified template as template variables. |
| 7 | + * |
| 8 | + * @author Peter Gehres <pgehres@wikimedia.org> |
| 9 | + */ |
| 10 | + |
| 11 | +// Alert the user that this is not a valid entry point to MediaWiki if they try to access the special pages file directly. |
| 12 | +if ( !defined( 'MEDIAWIKI' ) ) { |
| 13 | + echo <<<EOT |
| 14 | +To install the FundraiserLandingPage extension, put the following line in LocalSettings.php: |
| 15 | +require_once( "\$IP/extensions/FundraiserLandingPage/FundraiserLandingPage.php" ); |
| 16 | +EOT; |
| 17 | + exit( 1 ); |
| 18 | +} |
| 19 | + |
| 20 | +$wgExtensionCredits[ 'specialpage' ][ ] = array( |
| 21 | + 'path' => __FILE__, |
| 22 | + 'name' => 'FundraiserLandingPage', |
| 23 | + 'author' => array( 'Peter Gehres', 'Ryan Kaldari' ), |
| 24 | + 'url' => 'https://www.mediawiki.org/wiki/Extension:FundraiserLandingPage', |
| 25 | + 'descriptionmsg' => 'fundraiserlandingpage-desc', |
| 26 | + 'version' => '1.0.0', |
| 27 | +); |
| 28 | + |
| 29 | +$dir = dirname( __FILE__ ) . '/'; |
| 30 | + |
| 31 | +$wgAutoloadClasses[ 'FundraiserLandingPage' ] = $dir . 'FundraiserLandingPage.body.php'; |
| 32 | +$wgAutoloadClasses[ 'FundraiserRedirector' ] = $dir . 'FundraiserRedirector.body.php'; |
| 33 | + |
| 34 | +$wgExtensionMessagesFiles[ 'FundraiserLandingPage' ] = $dir . 'FundraiserLandingPage.i18n.php'; |
| 35 | + |
| 36 | +$wgSpecialPages[ 'FundraiserLandingPage' ] = 'FundraiserLandingPage'; |
| 37 | +$wgSpecialPages[ 'FundraiserRedirector' ] = 'FundraiserRedirector'; |
| 38 | + |
| 39 | +/* |
| 40 | + * Defaults for the required fields. These fields will be included whether |
| 41 | + * or not they are passed through the querystring. |
| 42 | + */ |
| 43 | +$wgFundraiserLPDefaults = array( |
| 44 | + 'template' => 'Lp-layout-default', |
| 45 | + 'appeal' => 'Appeal-default', |
| 46 | + 'appeal-template' => 'Appeal-template-default', |
| 47 | + 'form-template' => 'Form-template-default', |
| 48 | + 'form-countryspecific' => 'Form-countryspecific-control', |
| 49 | + 'country' => 'XX' // per Charles Barr |
| 50 | +); |
| 51 | + |
| 52 | +// Adding configurrable variable for caching time |
| 53 | +$wgFundraiserLandingPageMaxAge = 300; //5 minutes |
| 54 | + |
Property changes on: branches/wmf/1.19wmf1/extensions/FundraiserLandingPage/FundraiserLandingPage.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 55 | + native |
Index: branches/wmf/1.19wmf1/extensions/FundraiserLandingPage/FundraiserRedirector.body.php |
— | — | @@ -0,0 +1,47 @@ |
| 2 | +<?php |
| 3 | +/* |
| 4 | + * Provides redirect service for donors coming from external sites (so that they get |
| 5 | + * directed to the proper form for their country). |
| 6 | + * |
| 7 | + * @author Ryan Kaldari <rkaldari@wikimedia.org> |
| 8 | + */ |
| 9 | +class FundraiserRedirector extends UnlistedSpecialPage { |
| 10 | + |
| 11 | + function __construct() { |
| 12 | + parent::__construct( 'FundraiserRedirector' ); |
| 13 | + } |
| 14 | + |
| 15 | + function execute( $par ) { |
| 16 | + global $wgRequest, $wgOut, $wgFundraiserLPDefaults; |
| 17 | + |
| 18 | + // Set the country parameter |
| 19 | + $country = $wgRequest->getVal( 'country' ); |
| 20 | + // If no country was passed do a GeoIP lookup |
| 21 | + if ( !$country ) { |
| 22 | + if ( function_exists( 'geoip_country_code_by_name' ) ) { |
| 23 | + $ip = wfGetIP(); |
| 24 | + if ( IP::isValid( $ip ) ) { |
| 25 | + $country = geoip_country_code_by_name( $ip ); |
| 26 | + } |
| 27 | + } |
| 28 | + } |
| 29 | + // If country still isn't set, set it to the default |
| 30 | + if ( !$country ) { |
| 31 | + $country = $wgFundraiserLPDefaults[ 'country' ]; |
| 32 | + } |
| 33 | + |
| 34 | + $params = array( 'country' => $country ); |
| 35 | + |
| 36 | + // Pass any other params that are set |
| 37 | + $excludeKeys = array( 'country', 'title' ); |
| 38 | + foreach ( $wgRequest->getValues() as $key => $value ) { |
| 39 | + // Skip the required variables |
| 40 | + if ( !in_array( $key, $excludeKeys ) ) { |
| 41 | + $params[$key] = $value; |
| 42 | + } |
| 43 | + } |
| 44 | + |
| 45 | + // Redirect to FundraiserLandingPage |
| 46 | + $wgOut->redirect( $this->getTitleFor( 'FundraiserLandingPage' )->getLocalUrl( $params ) ); |
| 47 | + } |
| 48 | +} |
Property changes on: branches/wmf/1.19wmf1/extensions/FundraiserLandingPage/FundraiserRedirector.body.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 49 | + native |
Index: branches/wmf/1.19wmf1/extensions/FundraiserLandingPage/FundraiserLandingPage.alias.php |
— | — | @@ -0,0 +1,8 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +$specialPageAliases = array(); |
| 5 | + |
| 6 | +/** English */ |
| 7 | +$specialPageAliases[ 'en' ] = array( |
| 8 | + 'FundraiserLandingPage' => array( 'FundraiserLandingPage' ), |
| 9 | +); |
Property changes on: branches/wmf/1.19wmf1/extensions/FundraiserLandingPage/FundraiserLandingPage.alias.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 10 | + native |
Index: branches/wmf/1.19wmf1/extensions/FundraiserLandingPage/FundraiserLandingPage.body.php |
— | — | @@ -0,0 +1,95 @@ |
| 2 | +<?php |
| 3 | +/* |
| 4 | + * SpecialPage definition for FundraiserLandingPage. Extending UnlistedSpecialPage |
| 5 | + * since this page does not need to listed in Special:SpecialPages. |
| 6 | + * |
| 7 | + * @author Peter Gehres <pgehres@wikimedia.org> |
| 8 | + */ |
| 9 | +class FundraiserLandingPage extends UnlistedSpecialPage |
| 10 | +{ |
| 11 | + function __construct() { |
| 12 | + parent::__construct( 'FundraiserLandingPage' ); |
| 13 | + } |
| 14 | + |
| 15 | + function execute( $par ) { |
| 16 | + global $wgFundraiserLPDefaults, $wgRequest, $wgOut, $wgFundraiserLandingPageMaxAge; |
| 17 | + |
| 18 | + #Set squid age |
| 19 | + $wgOut->setSquidMaxage( $wgFundraiserLandingPageMaxAge ); |
| 20 | + $this->setHeaders(); |
| 21 | + |
| 22 | + # set the page title to something useful |
| 23 | + $wgOut->setPagetitle( wfMsg( 'donate_interface-make-your-donation' ) ); |
| 24 | + |
| 25 | + # clear output variable to be safe |
| 26 | + $output = ''; |
| 27 | + |
| 28 | + # begin generating the template call |
| 29 | + $template = $this->makeSafe( $wgRequest->getText( 'template', $wgFundraiserLPDefaults[ 'template' ] ) ); |
| 30 | + $output .= "{{ $template\n"; |
| 31 | + |
| 32 | + # get the required variables (except template and country) to use for the landing page |
| 33 | + $requiredParams = array( |
| 34 | + 'appeal', |
| 35 | + 'appeal-template', |
| 36 | + 'form-template', |
| 37 | + 'form-countryspecific' |
| 38 | + ); |
| 39 | + foreach( $requiredParams as $requiredParam ) { |
| 40 | + $param = $this->makeSafe( |
| 41 | + $wgRequest->getText( $requiredParam, $wgFundraiserLPDefaults[$requiredParam] ) |
| 42 | + ); |
| 43 | + // Add them to the template call |
| 44 | + $output .= "| $requiredParam = $param\n"; |
| 45 | + } |
| 46 | + |
| 47 | + # get the country code |
| 48 | + $country = $wgRequest->getVal( 'country' ); |
| 49 | + # If country still isn't set, set it to the default |
| 50 | + if ( !$country ) { |
| 51 | + $country = $wgFundraiserLPDefaults[ 'country' ]; |
| 52 | + } |
| 53 | + $country = $this->makeSafe( $country ); |
| 54 | + $output .= "| country = $country\n"; |
| 55 | + |
| 56 | + $excludeKeys = $requiredParams + array( 'template', 'country', 'title' ); |
| 57 | + |
| 58 | + # add any other parameters passed in the querystring |
| 59 | + foreach ( $wgRequest->getValues() as $k_unsafe => $v_unsafe ) { |
| 60 | + # skip the required variables |
| 61 | + if ( in_array( $k_unsafe, $excludeKeys ) ) { |
| 62 | + continue; |
| 63 | + } |
| 64 | + # get the variable's name and value |
| 65 | + $key = $this->makeSafe( $k_unsafe ); |
| 66 | + $val = $this->makeSafe( $v_unsafe ); |
| 67 | + # print to the template in wiki-syntax |
| 68 | + $output .= "| $key = $val\n"; |
| 69 | + } |
| 70 | + # close the template call |
| 71 | + $output .= "}}"; |
| 72 | + |
| 73 | + # print the output to the page |
| 74 | + $wgOut->addWikiText( $output ); |
| 75 | + } |
| 76 | + |
| 77 | + |
| 78 | + /** |
| 79 | + * This function limits the possible charactes passed as template keys and |
| 80 | + * values to letters, numbers, hypens and underscores. The function also |
| 81 | + * performs standard escaping of the passed values. |
| 82 | + * |
| 83 | + * @param $string The unsafe string to escape and check for invalid characters |
| 84 | + * @return mixed|String A string matching the regex or an empty string |
| 85 | + */ |
| 86 | + function makeSafe( $string ) { |
| 87 | + $num = preg_match( '([a-zA-Z0-9_-]+)', $string, $matches ); |
| 88 | + |
| 89 | + if ( $num == 1 ){ |
| 90 | + # theoretically this is overkill, but better safe than sorry |
| 91 | + return wfEscapeWikiText( htmlspecialchars( $matches[0] ) ); |
| 92 | + } |
| 93 | + return ''; |
| 94 | + } |
| 95 | +} |
| 96 | + |
Property changes on: branches/wmf/1.19wmf1/extensions/FundraiserLandingPage/FundraiserLandingPage.body.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 97 | + native |
Property changes on: branches/wmf/1.19wmf1/extensions/FundraiserLandingPage |
___________________________________________________________________ |
Added: svn:mergeinfo |
2 | 98 | Merged /trunk/extensions/FundraiserLandingPage:r111199,111218 |