http://www.mediawiki.org/wiki/Special:Code/MediaWiki/99802
Revision: 99802
Author: pgehres
Date: 2011-10-14 20:42:43 +0000 (Fri, 14 Oct 2011)
Log Message:
-----------
Intial commit of Extension:FundraiserLandingPage
Added Paths:
-----------
trunk/extensions/FundraiserLandingPage/
trunk/extensions/FundraiserLandingPage/FundraiserLandingPage.alias.php
trunk/extensions/FundraiserLandingPage/FundraiserLandingPage.body.php
trunk/extensions/FundraiserLandingPage/FundraiserLandingPage.i18n.php
trunk/extensions/FundraiserLandingPage/FundraiserLandingPage.php
Added: trunk/extensions/FundraiserLandingPage/FundraiserLandingPage.alias.php
===================================================================
--- trunk/extensions/FundraiserLandingPage/FundraiserLandingPage.alias.php
(rev 0)
+++ trunk/extensions/FundraiserLandingPage/FundraiserLandingPage.alias.php
2011-10-14 20:42:43 UTC (rev 99802)
@@ -0,0 +1,13 @@
+<?php
+
+$specialPageAliases = array();
+
+/** English */
+$specialPageAliases[ 'en' ] = array(
+ 'FundraiserLandingPage' => array( 'FundraiserLandingPage' ),
+);
+
+/**
+ * For backwards compatibility with MediaWiki 1.15 and earlier.
+ */
+$aliases =& $specialPageAliases;
\ No newline at end of file
Property changes on:
trunk/extensions/FundraiserLandingPage/FundraiserLandingPage.alias.php
___________________________________________________________________
Added: svn:eol-style
+ native
Added: trunk/extensions/FundraiserLandingPage/FundraiserLandingPage.body.php
===================================================================
--- trunk/extensions/FundraiserLandingPage/FundraiserLandingPage.body.php
(rev 0)
+++ trunk/extensions/FundraiserLandingPage/FundraiserLandingPage.body.php
2011-10-14 20:42:43 UTC (rev 99802)
@@ -0,0 +1,53 @@
+<?php
+/*
+ * SpecialPage definition for FundraiserLandingPage. Extending
UnlistedSpecialPage
+ * since this page does not need to listed in Special:SpecialPages.
+ *
+ * @author Peter Gehres <[email protected]>
+ */
+class FundraiserLandingPage extends UnlistedSpecialPage
+{
+ function __construct() {
+ parent::__construct( 'FundraiserLandingPage' );
+ }
+
+ function execute( $par ) {
+ global $wgRequest, $wgOut, $wgFundraiserLPDefaults;
+
+ $this->setHeaders();
+
+ # load the querystring variables
+ $values = $wgRequest->getValues();
+
+ # clear output variable to be safe
+ $output = "";
+
+ # get the required variables to use for the landing page
+ # (escaping with both htmlspecialchars and wfEscapeWikiText
since the
+ # parameters are intending to reference templates)
+ $template = wfEscapeWikiText( htmlspecialchars(
$wgRequest->getText( 'template', $wgFundraiserLPDefaults[ 'template' ] ) ) );
+ $appeal = wfEscapeWikiText( htmlspecialchars(
$wgRequest->getText( 'appeal', $wgFundraiserLPDefaults[ 'appeal' ] ) ) );
+ $form = wfEscapeWikiText( htmlspecialchars(
$wgRequest->getText( 'form', $wgFundraiserLPDefaults[ 'form' ] ) ) );
+
+ # begin generating the template call
+ $output .= "{{ $template\n| appeal = $appeal\n| form = $form\n";
+
+ # add any parameters passed in the querystring
+ foreach ( $values as $k=>$v){
+ # skip the required variables
+ if ( $k == "template" || $k == "appeal" || $k == "form"
){
+ continue;
+ }
+ # get the variables name and value
+ $key = wfEscapeWikiText( htmlspecialchars( $k ) );
+ $val = wfEscapeWikiText( htmlspecialchars( $v ) );
+ # print to the template in wiki-syntax
+ $output .= "| $key = $val\n";
+ }
+ # close the template call
+ $output .= "}}";
+
+ # print the output to the page
+ $wgOut->addWikiText( $output );
+ }
+}
\ No newline at end of file
Property changes on:
trunk/extensions/FundraiserLandingPage/FundraiserLandingPage.body.php
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on:
trunk/extensions/FundraiserLandingPage/FundraiserLandingPage.i18n.php
___________________________________________________________________
Added: svn:eol-style
+ native
Added: trunk/extensions/FundraiserLandingPage/FundraiserLandingPage.php
===================================================================
--- trunk/extensions/FundraiserLandingPage/FundraiserLandingPage.php
(rev 0)
+++ trunk/extensions/FundraiserLandingPage/FundraiserLandingPage.php
2011-10-14 20:42:43 UTC (rev 99802)
@@ -0,0 +1,44 @@
+<?php
+
+/*
+ * Extension:FundraiserLandingPage. This extension takes URL parameters in the
+ * QueryString and passes them to the specified template as template
variables.
+ *
+ * @author Peter Gehres <[email protected]>
+ */
+
+// Alert the user that this is not a valid entry point to MediaWiki if they
try to access the special pages file directly.
+if ( !defined( 'MEDIAWIKI' ) ) {
+ echo <<<EOT
+To install the FundraiserLandingPage extension, put the following line in
LocalSettings.php:
+require_once(
"\$IP/extensions/FundraiserLandingPage/FundraiserLandingPage.php" );
+EOT;
+ exit( 1 );
+}
+
+$wgExtensionCredits[ 'specialpage' ][ ] = array(
+ 'name' => 'FundraiserLandingPage',
+ 'author' => 'Peter Gehres',
+ 'url' => '',
+ 'description' => '',
+ 'descriptionmsg' => '',
+ 'version' => '1.0.0',
+);
+
+$dir = dirname( __FILE__ ) . '/';
+
+$wgAutoloadClasses[ 'FundraiserLandingPage' ] = $dir .
'FundraiserLandingPage.body.php';
+
+$wgExtensionMessagesFiles[ 'FundraiserLandingPage' ] = $dir .
'FundraiserLandingPage.i18n.php';
+
+$wgSpecialPages[ 'FundraiserLandingPage' ] = 'FundraiserLandingPage';
+
+/*
+ * Defaults for the required fields. These fields will be included whether
+ * or not they are passed through the querystring.
+ */
+$wgFundraiserLPDefaults = array(
+ 'template' => 'LandingPage',
+ 'appeal' => 'appeal-brandon-1',
+ 'form' => 'lp-form-US7amounts-extrainfo-noppval'
+);
\ No newline at end of file
Property changes on:
trunk/extensions/FundraiserLandingPage/FundraiserLandingPage.php
___________________________________________________________________
Added: svn:eol-style
+ native
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs