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',
|
|
|
|
'author' => 'Ævar Arnfjörð Bjarmason',
|
2010-04-18 17:05:37 +00:00
|
|
|
'descriptionmsg' => 'cite-desc',
|
2007-12-16 18:45:23 +00:00
|
|
|
'url' => 'http://www.mediawiki.org/wiki/Extension:Cite/Cite.php'
|
2005-12-21 01:08:25 +00:00
|
|
|
);
|
2008-11-30 03:15:22 +00:00
|
|
|
$wgParserTestFiles[] = dirname( __FILE__ ) . "/citeParserTests.txt";
|
2011-05-31 17:49:22 +00:00
|
|
|
$wgParserTestFiles[] = dirname( __FILE__ ) . "/citeCatTreeParserTests.txt";
|
2008-11-30 03:15:22 +00:00
|
|
|
$wgExtensionMessagesFiles['Cite'] = dirname( __FILE__ ) . "/Cite.i18n.php";
|
|
|
|
$wgAutoloadClasses['Cite'] = dirname( __FILE__ ) . "/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;
|
|
|
|
|
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(
|
|
|
|
'localBasePath' => dirname(__FILE__) . '/modules',
|
|
|
|
'remoteExtPath' => 'Cite/modules'
|
|
|
|
);
|
|
|
|
|
|
|
|
$wgResourceModules['ext.cite'] = $citeResourceTemplate + array(
|
|
|
|
'styles' => array(),
|
|
|
|
'scripts' => 'ext.cite/ext.cite.js',
|
|
|
|
'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',
|
|
|
|
);
|
|
|
|
|
2011-11-06 12:25:34 +00:00
|
|
|
function wfCiteBeforePageDisplay( $out, &$sk ) {
|
|
|
|
$out->addModules( 'ext.cite' );
|
|
|
|
|
2011-11-06 08:02:39 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2007-12-16 18:45:23 +00:00
|
|
|
/**#@-*/
|