Extension:Contribution Credits
From MediaWiki.org
(Redirected from Extension:ContributionCredits)
|
|
This extension stores its code inside a wiki page. Please be aware that MediaWiki developers do not review or keep track of extensions that put their code on the wiki.
|
|
Contribution Credits Release status: stable |
|||
|---|---|---|---|
| Implementation | Page action | ||
| Description | Adds Contribution Credits to the page footer | ||
| Author(s) | Jaime PriluskyTalk | ||
| Last version | 2.0 (2010-04-30) | ||
| MediaWiki | 1.11+ | ||
| Database changes | no | ||
| License | GPL 2.0 or later | ||
| Download | see here | ||
| Example | http://proteopedia.org zulunotes.com | ||
|
|||
|
|||
|
Check usage (experimental) |
|||
The Contribution Credits extension adds an automatically generated list of the page contributors to the end of every page in the wiki.
[edit] Installation
- Download the extension (copy/paste the file from below)
- Create a directory
ContributionCreditsin your$IP/extensionsdirectory. - Add the files to that
$IP/extensions/ContributionCreditsdirectory. - Add to the end of LocalSettings.php (MW 1.17+):
require_once("$IP/extensions/ContributionCredits/ContributionCredits.php");
- Specifiy optionally this variable to set the Section Header for the list of Contributors (default value is shown).
just after that line.$wgContributionCreditsHeader = "==Contributors==/n";
- Installation can now be verified through Special:Version on your wiki
[edit] Code
- ContributionCredits.php
<?php /** * Contribution Credits extension - Adds contribution credits to the footer * @version 2.0 - 2010/04/30 * * @link http://www.mediawiki.org/wiki/Extension:Contribution_Credits Documentation * * @file ContributionCredits.php * @ingroup Extensions * @package MediaWiki * @author Jaime Prilusky * @author Al Maghi * @copyright © 2008 Jaime Prilusky * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later */ if( !defined( 'MEDIAWIKI' ) ) { echo( "This file is an extension to the MediaWiki software and cannot be used standalone.\n" ); die( 1 ); } define ('CONTRIBUTIONCREDITS_VERSION','1.06, 2008-05-19'); $wgHooks['OutputPageBeforeHTML'][] = 'addFooter'; $wgExtensionCredits['other'][] = array( 'name' => 'Contribution Credits', 'version' => CONTRIBUTIONCREDITS_VERSION, 'author' => array( 'Jaime Prilusky', 'Al Maghi' ), 'description' => 'Adds contribution credits to the footer', 'url' => 'https://www.mediawiki.org/wiki/Extension:Contribution_Credits' ); function addFooter (&$articleTitle, &$text) { global $wgTitle,$wgOut,$wgRequest; global $wgContributionCreditsHeader; $NS = $wgTitle->getNamespace(); $action = $wgRequest->getVal('action'); if (($NS==0 or $NS==1) and ($action != 'edit')) { $dbr =& wfGetDB( DB_SLAVE ); $page_id = $wgTitle->getArticleID(); $list= ''; $res = $dbr->select( 'revision', array('distinct rev_user_text'), array("rev_page = $page_id","rev_user >= 1"), __METHOD__, array('ORDER BY' => 'rev_user_text ASC',)); if( $res && $dbr->numRows( $res ) > 0 ) { while( $row = $dbr->fetchObject( $res ) ) { $deletedUser = preg_match("/ZDelete/",$row->rev_user_text); # deleted users are renamed as ZDelete#### if (!$deletedUser) { $list .= "[[User:".$row->rev_user_text."|".$row->rev_user_text."]], "; } } } $dbr->freeResult( $res ); $list = preg_replace('/\,\s*$/','',$list); $contributorsBlock = ''; if (!empty($list)) { if (!$wgContributionCreditsHeader) {$wgContributionCreditsHeader = "==Contributors==\n";} $contributorsBlock = $wgOut->parse("__NOEDITSECTION__\n" . $wgContributionCreditsHeader . $list); } $text = $text."\n<div id=\"ContributionCredits\">$contributorsBlock</div>"; } return true; }
[edit] See also
| Language: | English |
|---|