/usr/share/mediawiki-extensions/base/PageCSS/PageCSS.php is in mediawiki-extensions-base 3.6.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | <?php
if (!defined('MEDIAWIKI')) die();
/**
* A parser hook to add per-page CSS to pages with the <css> tag
*
* @file
* @ingroup Extensions
*
* @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
*/
$wgExtensionCredits['parserhook'][] = array(
'path' => __FILE__,
'name' => 'Page CSS',
'url' => 'https://www.mediawiki.org/wiki/Extension:PageCSS',
'description' => 'Parser hook to add per-page CSS using the <tt><css></tt> tag',
'author' => 'Ævar Arnfjörð Bjarmason'
);
$wgHooks['ParserFirstCallInit'][] = 'CssHook::setup';
class CssHook {
public static function setup( $parser ) {
$parser->setHook( 'css', array( 'CssHook', 'parse' ) );
return true;
}
public static function parse( $content, array $args, Parser $parser ) {
$css = htmlspecialchars( trim( Sanitizer::checkCss( $content ) ) );
$parser->mOutput->addHeadItem( <<<EOT
<style type="text/css">
/*<![CDATA[*/
{$css}
/*]]>*/
</style>
EOT
);
return "";
}
}
|