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
|
|
|
*
|
2005-12-25 19:40:11 +00:00
|
|
|
* @link http://meta.wikimedia.org/wiki/Cite/SpecialCite.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(
|
|
|
|
'name' => 'Cite',
|
2008-02-27 14:13:10 +00:00
|
|
|
'version' => preg_replace('/^.* (\d\d\d\d-\d\d-\d\d) .*$/', '\1', '$LastChangedDate$'), #just the date of the last change
|
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
|
|
|
);
|
|
|
|
|
2006-07-15 15:17:32 +00:00
|
|
|
# Internationalisation file
|
2008-01-09 20:52:38 +00:00
|
|
|
$wgExtensionMessagesFiles['SpecialCite'] = dirname( __FILE__ ) . "/SpecialCite.i18n.php";
|
2006-07-03 13:11:35 +00:00
|
|
|
|
2005-11-26 23:22:24 +00:00
|
|
|
$wgHooks['SkinTemplateBuildNavUrlsNav_urlsAfterPermalink'][] = 'wfSpecialCiteNav';
|
|
|
|
$wgHooks['MonoBookTemplateToolboxEnd'][] = 'wfSpecialCiteToolbox';
|
|
|
|
|
2008-05-01 12:48:22 +00:00
|
|
|
$dir = dirname(__FILE__) . '/';
|
|
|
|
$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;
|
|
|
|
}
|
|
|
|
|
|
|
|
function wfSpecialCiteToolbox( &$monobook ) {
|
2008-01-10 20:27:47 +00:00
|
|
|
wfLoadExtensionMessages( 'SpecialCite' );
|
2005-11-26 23:22:24 +00:00
|
|
|
if ( isset( $monobook->data['nav_urls']['cite'] ) )
|
|
|
|
if ( $monobook->data['nav_urls']['cite']['href'] == '' ) {
|
2005-11-27 02:55:12 +00:00
|
|
|
?><li id="t-iscite"><?php echo $monobook->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
|
|
|
|
?><a href="<?php echo htmlspecialchars( $monobook->data['nav_urls']['cite']['href'] ) ?>"><?php
|
|
|
|
echo $monobook->msg( 'cite_article_link' );
|
|
|
|
?></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;
|
|
|
|
}
|