Extension:ContributionCredits/pt-br
From MediaWiki.org
|
Estado release: stable |
|||
|---|---|---|---|
| Implementação | Page action | ||
| Descrição | Adiciona um cabeçalho no final da página com os principais contribuidores de cada página | ||
| Autor(es) | Jaime Prilusky | ||
| MediaWiki | 1.11+ | ||
| Licença | Nenhuma licença especificada | ||
| Baixar | Ver abaixo | ||
| Exemplo | http://proteopedia.org zulunotes.com | ||
|
|||
Esta extensão adiciona uma lista gerada automaticamente dos contribuidores de página no final de cada página da wiki.
Contents |
Uso [edit]
Por favor, copie e cole o código encontrado abaixo e colocá-lo em $IP/extensions/ContributionCredits/ContributionCredits.php. Nota: $IP representa o diretório raiz da instalação do MediaWiki, o mesmo diretório que armazena LocalSettings.php.
Instalação [edit]
Para instalar esta extensão, adicione o seguinte no seu arquivo LocalSettings.php:
require_once("$IP/extensions/ContributionCredits/ContributionCredits.php"); # opcional: definir esta variável para o cabeçalho da secção onde está a lista de contribuidores. Mostrando o valor padrão. $wgContributionCreditsHeader = "==Contribuidores==";
Código [edit]
<?php 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' => 'Jaime Prilusky', 'description' => 'adds Contribution Credits to Footer', 'url' => 'http://www.mediawiki.org/wiki/Extension:ContributionCredits' ); 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; }
Ver também [edit]
| Língua: | English • português do Brasil |
|---|