2005-11-26 23:22:24 +00:00
|
|
|
<?php
|
|
|
|
if (!defined('MEDIAWIKI')) die();
|
|
|
|
/**
|
|
|
|
* A special page extension that adds a special page that generates citations
|
|
|
|
* for pages.
|
|
|
|
*
|
2007-01-20 15:10:35 +00:00
|
|
|
* @addtogroup Extensions
|
2005-11-26 23:22:24 +00:00
|
|
|
*
|
2008-07-09 15:09:55 +00:00
|
|
|
* @link http://www.mediawiki.org/wiki/Extension:Cite/Special:Cite.php Documentation
|
2005-11-26 23:22:24 +00:00
|
|
|
*
|
2006-08-28 01:08:30 +00:00
|
|
|
* @author Ævar Arnfjörð Bjarmason <avarab@gmail.com>
|
|
|
|
* @copyright Copyright © 2005, Ævar Arnfjörð Bjarmason
|
2005-11-26 23:22:24 +00:00
|
|
|
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
|
|
|
|
*/
|
|
|
|
|
|
|
|
$wgExtensionCredits['specialpage'][] = array(
|
2009-04-27 03:15:19 +00:00
|
|
|
'path' => __FILE__,
|
2005-11-26 23:22:24 +00:00
|
|
|
'name' => 'Cite',
|
2006-08-28 01:08:30 +00:00
|
|
|
'author' => 'Ævar Arnfjörð Bjarmason',
|
2008-01-31 14:38:12 +00:00
|
|
|
'description' => 'adds a [[Special:Cite|citation]] special page & toolbox link', // kept for b/c
|
|
|
|
'descriptionmsg' => 'cite_article_desc',
|
2007-12-16 18:38:50 +00:00
|
|
|
'url' => 'http://www.mediawiki.org/wiki/Extension:Cite/Special:Cite.php'
|
2005-11-26 23:22:24 +00:00
|
|
|
);
|
|
|
|
|
2008-07-09 15:09:55 +00:00
|
|
|
$dir = dirname(__FILE__) . '/';
|
2006-07-15 15:17:32 +00:00
|
|
|
# Internationalisation file
|
2008-07-09 15:09:55 +00:00
|
|
|
$wgExtensionMessagesFiles['SpecialCite'] = $dir . 'SpecialCite.i18n.php';
|
2009-05-24 22:12:11 +00:00
|
|
|
$wgExtensionAliasesFiles['SpecialCite'] = $dir . 'SpecialCite.alias.php';
|
2006-07-03 13:11:35 +00:00
|
|
|
|
2005-11-26 23:22:24 +00:00
|
|
|
$wgHooks['SkinTemplateBuildNavUrlsNav_urlsAfterPermalink'][] = 'wfSpecialCiteNav';
|
2008-10-30 16:12:17 +00:00
|
|
|
$wgHooks['SkinTemplateToolboxEnd'][] = 'wfSpecialCiteToolbox';
|
2005-11-26 23:22:24 +00:00
|
|
|
|
2008-05-01 12:48:22 +00:00
|
|
|
$wgSpecialPages['Cite'] = 'SpecialCite';
|
|
|
|
$wgAutoloadClasses['SpecialCite'] = $dir . 'SpecialCite_body.php';
|
2005-11-26 23:22:24 +00:00
|
|
|
|
2007-05-01 17:40:30 +00:00
|
|
|
function wfSpecialCiteNav( &$skintemplate, &$nav_urls, &$oldid, &$revid ) {
|
2008-01-10 20:27:47 +00:00
|
|
|
wfLoadExtensionMessages( 'SpecialCite' );
|
2007-06-21 23:03:36 +00:00
|
|
|
if ( $skintemplate->mTitle->isContentPage() && $revid !== 0 )
|
2005-11-28 03:05:00 +00:00
|
|
|
$nav_urls['cite'] = array(
|
|
|
|
'text' => wfMsg( 'cite_article_link' ),
|
2007-05-01 17:40:30 +00:00
|
|
|
'href' => $skintemplate->makeSpecialUrl( 'Cite', "page=" . wfUrlencode( "{$skintemplate->thispage}" ) . "&id=$revid" )
|
2005-11-28 03:05:00 +00:00
|
|
|
);
|
2008-01-09 20:52:38 +00:00
|
|
|
|
2005-11-26 23:22:24 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2008-10-30 16:12:17 +00:00
|
|
|
function wfSpecialCiteToolbox( &$skin ) {
|
2008-01-10 20:27:47 +00:00
|
|
|
wfLoadExtensionMessages( 'SpecialCite' );
|
2008-10-30 16:12:17 +00:00
|
|
|
if ( isset( $skin->data['nav_urls']['cite'] ) )
|
|
|
|
if ( $skin->data['nav_urls']['cite']['href'] == '' ) {
|
|
|
|
?><li id="t-iscite"><?php echo $skin->msg( 'cite_article_link' ); ?></li><?php
|
2005-11-26 23:22:24 +00:00
|
|
|
} else {
|
2005-11-28 03:05:00 +00:00
|
|
|
?><li id="t-cite"><?php
|
2008-10-30 16:12:17 +00:00
|
|
|
?><a href="<?php echo htmlspecialchars( $skin->data['nav_urls']['cite']['href'] ) ?>"><?php
|
|
|
|
echo $skin->msg( 'cite_article_link' );
|
2005-11-28 03:05:00 +00:00
|
|
|
?></a><?php
|
|
|
|
?></li><?php
|
2005-11-26 23:22:24 +00:00
|
|
|
}
|
2008-01-09 20:52:38 +00:00
|
|
|
|
2005-11-26 23:22:24 +00:00
|
|
|
return true;
|
|
|
|
}
|