Extension:Contribution Credits
From MediaWiki.org
| This extension stores its source code on a wiki page. Please be aware that this code may be unreviewed or maliciously altered. They may contain security holes, outdated interfaces that are no longer compatible etc. Note: No localisation updates are provided for this extension by translatewiki.net. |
|
Contribution Credits Release status: stable |
|||
|---|---|---|---|
| Implementation | Page action | ||
| Description | Adds Contribution Credits to the page footer | ||
| Author(s) | Jaime Priluskytalk | ||
| Last version | 2.3 (2012/05/09) | ||
| MediaWiki | 1.11+ | ||
| Database changes | No | ||
| License | GPL 2.0 or later | ||
| Download | see here | ||
| Example | http://proteopedia.org | ||
|
|||
|
|||
| Check usage and version matrix; Credits stats | |||
The Contribution Credits extension adds an automatically generated list of the page contributors to the end of every page in the wiki.
Installation[edit]
- 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
Code[edit]
An updated version 2.3 (2012/05/09) is available externally.
- 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','2.0'); $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; }
See also[edit]
| Language: | English • português do Brasil |
|---|