mediawiki-extensions-Cite/SpecialCite.php
Tim Starling 8145ded3a9 Converted a lot of extensions to the new autoload scheme. Moved a number of extensions to their own directory, apologies for the break in backwards compatibility.
This was done because they needed to be split from one file to two, for efficiency, and it makes sense to have two files in their own directory. It probably makes sense to have each extension in its own directory anyway. 
Tested both the inefficient backwards compatible interface and the present interface. Still more to be converted...
2006-06-29 08:07:00 +00:00

65 lines
2.1 KiB
PHP

<?php
if (!defined('MEDIAWIKI')) die();
/**
* A special page extension that adds a special page that generates citations
* for pages.
*
* @package MediaWiki
* @subpackage Extensions
*
* @link http://meta.wikimedia.org/wiki/Cite/SpecialCite.php Documentation
*
* @author var Arnfjörð Bjarmason <avarab@gmail.com>
* @copyright Copyright © 2005, var Arnfjörð Bjarmason
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
*/
$wgExtensionFunctions[] = 'wfSpecialCite';
$wgExtensionCredits['specialpage'][] = array(
'name' => 'Cite',
'author' => ' var Arnfjörð Bjarmason',
'description' => 'adds a [[Special:Cite|citation]] special page & toolbox link',
'url' => 'http://meta.wikimedia.org/wiki/Cite/SpecialCite.php'
);
$wgHooks['SkinTemplateBuildNavUrlsNav_urlsAfterPermalink'][] = 'wfSpecialCiteNav';
$wgHooks['MonoBookTemplateToolboxEnd'][] = 'wfSpecialCiteToolbox';
if ( !function_exists( 'extAddSpecialPage' ) ) {
require( dirname(__FILE__) . '/../ExtensionFunctions.php' );
}
extAddSpecialPage( dirname(__FILE__) . '/SpecialCite_body.php', 'Cite', 'SpecialCite' );
function wfSpecialCite() {
global $wgMessageCache;
$wgMessageCache->addMessage( 'cite_article_link', 'Cite this article' );
}
function wfSpecialCiteNav( &$skintemplate, &$nav_urls, &$oldid, &$revid ) {
if ( $skintemplate->mTitle->getNamespace() === NS_MAIN && $revid !== 0 )
$nav_urls['cite'] = array(
'text' => wfMsg( 'cite_article_link' ),
'href' => $skintemplate->makeSpecialUrl( 'Cite', "page=" . wfUrlencode( "{$skintemplate->thispage}" ) . "&id=$revid" )
);
return true;
}
function wfSpecialCiteToolbox( &$monobook ) {
if ( isset( $monobook->data['nav_urls']['cite'] ) )
if ( $monobook->data['nav_urls']['cite']['href'] == '' ) {
?><li id="t-iscite"><?php echo $monobook->msg( 'cite_article_link' ); ?></li><?php
} else {
?><li id="t-cite"><?php
?><a href="<?php echo htmlspecialchars( $monobook->data['nav_urls']['cite']['href'] ) ?>"><?php
echo $monobook->msg( 'cite_article_link' );
?></a><?php
?></li><?php
}
return true;
}
?>