Difference between revisions of "Extension:EmailPage"

From Organic Design wiki
(may as well get this one back in the pipeline too)
 
m
Line 1: Line 1:
 
<?php
 
<?php
# Extension:EmailArticle{{Category:Extensions}}{{#Security:*|dev}}{{#Security:view|*}}{{php}}
+
# 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.organicdesign.co.nz/Extension:SpecialPage',
+
'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;
'EmailArticle',     # name as seen in links etc
+
SpecialPage::SpecialPage('EmailArticle',$wgEmailArticleGroup);
'sysop',      # user rights required
 
true,          # listed in special:specialpages
 
false,        # function called by execute() - defaults to wfSpecial{$name}
 
false,        # file included by execute() - defaults to Special{$name}.php, only used if no function
 
false          # includable
 
);
 
 
}
 
}
+
 
 
# 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

  1. Extension:EmailArticle
Info.svg These are the MediaWiki extensions we're using and/or developing. Please refer to the information on the mediawiki.org wiki for installation and usage details. Extensions here which have no corresponding mediawiki article are either not ready for use or have been superseded. You can also browse our extension code in our local Subversion repository or our GitHub mirror.

Template:Php

  1. - Licenced under LGPL (http://www.gnu.org/copyleft/lesser.html)
  2. - Author: User:NadCategory:Extensions created with Template:SpecialPage
  3. - 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";

  1. 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>' ); }

}

  1. 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()); } ?>