Difference between revisions of "Extension:EmailPage"
(may as well get this one back in the pipeline too) |
m |
||
| Line 1: | Line 1: | ||
<?php | <?php | ||
| − | # Extension:EmailArticle{{Category:Extensions | + | # Extension:EmailArticle{{Category:Extensions}}{{php}} |
# - Licenced under LGPL (http://www.gnu.org/copyleft/lesser.html) | # - Licenced under LGPL (http://www.gnu.org/copyleft/lesser.html) | ||
# - Author: [http://www.organicdesign.co.nz/nad User:Nad]{{Category:Extensions created with Template:SpecialPage}} | # - Author: [http://www.organicdesign.co.nz/nad User:Nad]{{Category:Extensions created with Template:SpecialPage}} | ||
| − | + | # - See http://www.mediawiki.org/wiki/Extension:EmailArticle for installation and usage details | |
| + | |||
if (!defined('MEDIAWIKI')) die('Not an entry point.'); | if (!defined('MEDIAWIKI')) die('Not an entry point.'); | ||
| − | + | ||
define('EMAILARTICLE_VERSION','0.0.0, 2007-05-25'); | define('EMAILARTICLE_VERSION','0.0.0, 2007-05-25'); | ||
| − | + | ||
| + | $wgEmailArticleGroup = 'postmaster'; # Users must belong to this group to send emails (empty string means anyone can send) | ||
| + | $wgEmailArticleContactsCat = 'Contacts'; # This specifies the name of a category containing categories of contact articles | ||
| + | |||
$wgExtensionFunctions[] = 'wfSetupEmailArticle'; | $wgExtensionFunctions[] = 'wfSetupEmailArticle'; | ||
| − | + | ||
$wgExtensionCredits['specialpage'][] = array( | $wgExtensionCredits['specialpage'][] = array( | ||
'name' => 'Special:EmailArticle', | 'name' => 'Special:EmailArticle', | ||
'author' => '[http://www.organicdesign.co.nz/nad User:Nad]', | 'author' => '[http://www.organicdesign.co.nz/nad User:Nad]', | ||
'description' => 'Send rendered article to an email address or list of addresses', | 'description' => 'Send rendered article to an email address or list of addresses', | ||
| − | 'url' => 'http://www. | + | 'url' => 'http://www.mediawiki.org/wiki/Extension:EmailArticle', |
'version' => EMAILARTICLE_VERSION | 'version' => EMAILARTICLE_VERSION | ||
); | ); | ||
| − | + | ||
require_once "$IP/includes/SpecialPage.php"; | require_once "$IP/includes/SpecialPage.php"; | ||
| − | + | ||
# Define a new class based on the SpecialPage class | # Define a new class based on the SpecialPage class | ||
class SpecialEmailArticle extends SpecialPage { | class SpecialEmailArticle extends SpecialPage { | ||
| − | + | ||
# Constructor | # Constructor | ||
function SpecialSearchLog() { | function SpecialSearchLog() { | ||
| − | SpecialPage::SpecialPage( | + | global $wgEmailArticleGroup; |
| − | + | SpecialPage::SpecialPage('EmailArticle',$wgEmailArticleGroup); | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
} | } | ||
| − | + | ||
# Override SpecialPage::execute() | # Override SpecialPage::execute() | ||
wfSpecialEmailArticle($param,&$specialpage) { | wfSpecialEmailArticle($param,&$specialpage) { | ||
| Line 47: | Line 45: | ||
); | ); | ||
} | } | ||
| − | + | ||
} | } | ||
| − | + | ||
# Called from $wgExtensionFunctions array when initialising extensions | # Called from $wgExtensionFunctions array when initialising extensions | ||
function wfSetupEmailArticle() { | function wfSetupEmailArticle() { | ||
global $wgLanguageCode,$wgMessageCache; | global $wgLanguageCode,$wgMessageCache; | ||
| − | + | ||
# Add the messages used by the specialpage | # Add the messages used by the specialpage | ||
if ($wgLanguageCode == 'en') { | if ($wgLanguageCode == 'en') { | ||
| Line 61: | Line 59: | ||
)); | )); | ||
} | } | ||
| − | + | ||
# Add the specialpage to the environment | # Add the specialpage to the environment | ||
SpecialPage::addPage(new SpecialEmailArticle()); | SpecialPage::addPage(new SpecialEmailArticle()); | ||
} | } | ||
?> | ?> | ||
Revision as of 00:45, 28 May 2007
<?php
- Extension:EmailArticle
- - Licenced under LGPL (http://www.gnu.org/copyleft/lesser.html)
- - Author: User:NadCategory:Extensions created with Template:SpecialPage
- - See http://www.mediawiki.org/wiki/Extension:EmailArticle for installation and usage details
if (!defined('MEDIAWIKI')) die('Not an entry point.');
define('EMAILARTICLE_VERSION','0.0.0, 2007-05-25');
$wgEmailArticleGroup = 'postmaster'; # Users must belong to this group to send emails (empty string means anyone can send) $wgEmailArticleContactsCat = 'Contacts'; # This specifies the name of a category containing categories of contact articles
$wgExtensionFunctions[] = 'wfSetupEmailArticle';
$wgExtensionCredits['specialpage'][] = array( 'name' => 'Special:EmailArticle', 'author' => 'User:Nad', 'description' => 'Send rendered article to an email address or list of addresses', 'url' => 'http://www.mediawiki.org/wiki/Extension:EmailArticle', 'version' => EMAILARTICLE_VERSION );
require_once "$IP/includes/SpecialPage.php";
- Define a new class based on the SpecialPage class
class SpecialEmailArticle extends SpecialPage {
# Constructor function SpecialSearchLog() { global $wgEmailArticleGroup; SpecialPage::SpecialPage('EmailArticle',$wgEmailArticleGroup); }
# Override SpecialPage::execute() wfSpecialEmailArticle($param,&$specialpage) { global $wgOut; $title = Title::makeTitle(NS_SPECIAL,'EmailArticle'); $wgOut->addWikiText(wfMsg('example-message','exampleParameter')); $wgOut->addHTML( wfElement('form',array('action' => $title->getLocalURL('action=submit'),'method' => 'post'),null) . '<textarea name="target" cols=25 rows=10></textarea>' . wfElement('input',array('type' => 'submit')) . '</form>' ); }
}
- Called from $wgExtensionFunctions array when initialising extensions
function wfSetupEmailArticle() { global $wgLanguageCode,$wgMessageCache;
# Add the messages used by the specialpage if ($wgLanguageCode == 'en') { $wgMessageCache->addMessages(array( 'emailarticle' => 'Example Specialpage', # The friendly page title 'exampleMessage' => "Example message: $1", )); }
# Add the specialpage to the environment SpecialPage::addPage(new SpecialEmailArticle()); } ?>



