2005-12-21 01:08:25 +00:00
|
|
|
<?php
|
|
|
|
if ( ! defined( 'MEDIAWIKI' ) )
|
2006-01-27 10:14:45 +00:00
|
|
|
die();
|
2005-12-21 01:08:25 +00:00
|
|
|
/**#@+
|
2005-12-25 19:39:22 +00:00
|
|
|
* A parser extension that adds two tags, <ref> and <references> for adding
|
|
|
|
* citations to pages
|
|
|
|
*
|
2010-06-06 15:12:22 +00:00
|
|
|
* @file
|
|
|
|
* @ingroup Extensions
|
2005-12-21 01:08:25 +00:00
|
|
|
*
|
2009-07-10 13:51:26 +00:00
|
|
|
* @link http://www.mediawiki.org/wiki/Extension:Cite/Cite.php Documentation
|
2005-12-25 19:39:22 +00:00
|
|
|
*
|
2006-01-12 15:14:46 +00:00
|
|
|
* @bug 4579
|
|
|
|
*
|
2005-12-21 01:08:25 +00:00
|
|
|
* @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
|
|
|
|
*/
|
|
|
|
|
2010-08-05 18:08:03 +00:00
|
|
|
$wgHooks['ParserFirstCallInit'][] = 'wfCite';
|
2011-11-06 08:02:39 +00:00
|
|
|
$wgHooks['BeforePageDisplay'][] = 'wfCiteBeforePageDisplay';
|
|
|
|
|
2008-06-06 20:38:04 +00:00
|
|
|
|
2005-12-21 01:08:25 +00:00
|
|
|
$wgExtensionCredits['parserhook'][] = array(
|
2009-04-27 03:15:19 +00:00
|
|
|
'path' => __FILE__,
|
2005-12-21 01:08:25 +00:00
|
|
|
'name' => 'Cite',
|
2013-08-17 18:21:00 +00:00
|
|
|
'author' => array( 'Ævar Arnfjörð Bjarmason', 'Marius Hoch' ),
|
2010-04-18 17:05:37 +00:00
|
|
|
'descriptionmsg' => 'cite-desc',
|
2011-12-13 23:49:33 +00:00
|
|
|
'url' => 'https://www.mediawiki.org/wiki/Extension:Cite/Cite.php'
|
2005-12-21 01:08:25 +00:00
|
|
|
);
|
2013-08-17 18:21:42 +00:00
|
|
|
$wgParserTestFiles[] = __DIR__ . "/citeParserTests.txt";
|
|
|
|
$wgParserTestFiles[] = __DIR__ . "/citeCatTreeParserTests.txt";
|
|
|
|
$wgExtensionMessagesFiles['Cite'] = __DIR__ . "/Cite.i18n.php";
|
|
|
|
$wgAutoloadClasses['Cite'] = __DIR__ . "/Cite_body.php";
|
2008-07-12 01:15:55 +00:00
|
|
|
$wgSpecialPageGroups['Cite'] = 'pagetools';
|
2006-01-27 10:14:45 +00:00
|
|
|
|
2010-04-17 21:07:37 +00:00
|
|
|
define( 'CITE_DEFAULT_GROUP', '' );
|
2008-03-21 15:25:26 +00:00
|
|
|
/**
|
|
|
|
* The emergency shut-off switch. Override in local settings to disable
|
|
|
|
* groups; or remove all references from this file to enable unconditionally
|
|
|
|
*/
|
2010-04-17 21:07:37 +00:00
|
|
|
$wgAllowCiteGroups = true;
|
2008-03-21 15:25:26 +00:00
|
|
|
|
2009-02-12 18:02:27 +00:00
|
|
|
/**
|
|
|
|
* An emergency optimisation measure for caching cite <references /> output.
|
|
|
|
*/
|
|
|
|
$wgCiteCacheReferences = false;
|
|
|
|
|
2012-02-07 07:04:21 +00:00
|
|
|
/**
|
|
|
|
* Enables experimental popups
|
|
|
|
*/
|
|
|
|
$wgCiteEnablePopups = false;
|
|
|
|
|
2011-02-26 22:39:53 +00:00
|
|
|
/**
|
|
|
|
* Performs the hook registration.
|
2011-11-06 12:25:34 +00:00
|
|
|
* Note that several extensions (and even core!) try to detect if Cite is
|
2011-02-26 22:39:53 +00:00
|
|
|
* installed by looking for wfCite().
|
2011-05-28 20:44:24 +00:00
|
|
|
*
|
|
|
|
* @param $parser Parser
|
|
|
|
*
|
|
|
|
* @return bool
|
2011-02-26 22:39:53 +00:00
|
|
|
*/
|
|
|
|
function wfCite( $parser ) {
|
|
|
|
return Cite::setHooks( $parser );
|
2005-12-21 01:08:25 +00:00
|
|
|
}
|
2007-12-16 18:45:23 +00:00
|
|
|
|
2011-11-06 08:02:39 +00:00
|
|
|
// Resources
|
|
|
|
$citeResourceTemplate = array(
|
2013-08-17 18:21:42 +00:00
|
|
|
'localBasePath' => __DIR__ . '/modules',
|
2011-11-06 08:02:39 +00:00
|
|
|
'remoteExtPath' => 'Cite/modules'
|
|
|
|
);
|
|
|
|
|
2013-08-17 18:21:00 +00:00
|
|
|
$wgResourceModules['ext.cite'] = $citeResourceTemplate + array(
|
|
|
|
'scripts' => 'ext.cite.js',
|
|
|
|
'styles' => 'ext.cite.css',
|
|
|
|
'messages' => array(
|
|
|
|
'cite_references_link_accessibility_label',
|
|
|
|
'cite_references_link_many_accessibility_label',
|
|
|
|
),
|
|
|
|
);
|
|
|
|
|
2013-08-17 18:21:42 +00:00
|
|
|
$wgResourceModules['ext.cite.popups'] = $citeResourceTemplate + array(
|
|
|
|
'scripts' => 'ext.cite.popups.js',
|
2011-11-06 08:02:39 +00:00
|
|
|
'position' => 'bottom',
|
|
|
|
'dependencies' => array(
|
|
|
|
'jquery.tooltip',
|
|
|
|
),
|
|
|
|
);
|
|
|
|
|
|
|
|
$wgResourceModules['jquery.tooltip'] = $citeResourceTemplate + array(
|
|
|
|
'styles' => 'jquery.tooltip/jquery.tooltip.css',
|
|
|
|
'scripts' => 'jquery.tooltip/jquery.tooltip.js',
|
|
|
|
'position' => 'bottom',
|
|
|
|
);
|
|
|
|
|
2013-04-30 20:19:08 +00:00
|
|
|
/* Add RTL fix for the cite <sup> elements */
|
|
|
|
$wgResourceModules['ext.rtlcite'] = $citeResourceTemplate + array(
|
2013-08-17 18:21:42 +00:00
|
|
|
'styles' => 'ext.rtlcite.css',
|
2013-05-06 21:45:22 +00:00
|
|
|
'position' => 'top',
|
2013-04-30 20:19:08 +00:00
|
|
|
);
|
|
|
|
|
2011-12-02 17:00:19 +00:00
|
|
|
/**
|
|
|
|
* @param $out OutputPage
|
|
|
|
* @param $sk Skin
|
|
|
|
* @return bool
|
|
|
|
*/
|
2011-11-06 12:25:34 +00:00
|
|
|
function wfCiteBeforePageDisplay( $out, &$sk ) {
|
2012-02-07 07:04:21 +00:00
|
|
|
global $wgCiteEnablePopups;
|
|
|
|
|
2013-08-17 18:21:00 +00:00
|
|
|
$out->addModules( 'ext.cite' );
|
2012-02-07 07:04:21 +00:00
|
|
|
if ( $wgCiteEnablePopups ) {
|
2013-08-17 18:21:42 +00:00
|
|
|
$out->addModules( 'ext.cite.popups' );
|
2012-02-07 07:04:21 +00:00
|
|
|
}
|
2011-11-06 12:25:34 +00:00
|
|
|
|
2013-04-30 20:19:08 +00:00
|
|
|
/* RTL support quick-fix module */
|
2013-05-06 21:45:22 +00:00
|
|
|
$out->addModuleStyles( 'ext.rtlcite' );
|
2011-11-06 08:02:39 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2007-12-16 18:45:23 +00:00
|
|
|
/**#@-*/
|