mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite
synced 2024-11-14 02:32:58 +00:00
18f616b9b8
This code has been developed over three years now in the repo of MediaWiki's integration of VisualEditor. It has grown and developed significantly during that time, but now is pretty stable. A number of hacks inside the MediaWiki- VisualEditor code base have been used to prevent this code from being loaded on wikis where the Cite extension is not deployed, but this state of affairs is and always was meant to be temporary. This code is under the MIT licence which is a tad messy, but not impossible. It's clearly labelled as such. The list of authors has been updated to take into account the influx of new functionality. Bug: T41621 Bug: T104928 Change-Id: I39936ed83d5a60471a0a75da753f498e80aef234
35 lines
1 KiB
PHP
35 lines
1 KiB
PHP
<?php
|
|
/**
|
|
* ResourceLoaderFileModule for adding the content language Cite CSS
|
|
*
|
|
* @file
|
|
* @ingroup Extensions
|
|
* @copyright 2011-2016 Cite VisualEditor Team and others; see AUTHORS.txt
|
|
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
|
|
*/
|
|
|
|
class CiteCSSFileModule extends ResourceLoaderFileModule {
|
|
public function __construct(
|
|
$options = array(),
|
|
$localBasePath = null,
|
|
$remoteBasePath = null
|
|
) {
|
|
global $wgContLang;
|
|
|
|
parent::__construct( $options, $localBasePath, $remoteBasePath );
|
|
|
|
// Get the content language code, and all the fallbacks. The first that
|
|
// has a ext.cite.style.<lang code>.css file present will be used.
|
|
$langCodes = array_merge( array( $wgContLang->getCode() ),
|
|
$wgContLang->getFallbackLanguages() );
|
|
foreach ( $langCodes as $lang ) {
|
|
$langStyleFile = 'ext.cite.style.' . $lang . '.css';
|
|
$localPath = $this->getLocalPath( $langStyleFile );
|
|
if ( file_exists( $localPath ) ) {
|
|
$this->styles[] = $langStyleFile;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|