mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/TemplateStyles
synced 2024-12-03 20:37:00 +00:00
687207f0bf
Bug: T338435 Change-Id: I34726d15dad5045f5c1b00ec7796b7b5f1516d12
51 lines
1.2 KiB
PHP
51 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace MediaWiki\Extension\TemplateStyles\Hooks;
|
|
|
|
use MediaWiki\HookContainer\HookContainer;
|
|
use Wikimedia\CSS\Grammar\MatcherFactory;
|
|
use Wikimedia\CSS\Sanitizer\StylePropertySanitizer;
|
|
use Wikimedia\CSS\Sanitizer\StylesheetSanitizer;
|
|
|
|
/**
|
|
* This is a hook runner class, see docs/Hooks.md in core.
|
|
* @internal
|
|
*/
|
|
class HookRunner implements
|
|
TemplateStylesPropertySanitizerHook,
|
|
TemplateStylesStylesheetSanitizerHook
|
|
{
|
|
private HookContainer $hookContainer;
|
|
|
|
public function __construct( HookContainer $hookContainer ) {
|
|
$this->hookContainer = $hookContainer;
|
|
}
|
|
|
|
/**
|
|
* @inheritDoc
|
|
*/
|
|
public function onTemplateStylesPropertySanitizer(
|
|
StylePropertySanitizer &$propertySanitizer,
|
|
MatcherFactory $matcherFactory
|
|
) {
|
|
return $this->hookContainer->run(
|
|
'TemplateStylesPropertySanitizer',
|
|
[ &$propertySanitizer, $matcherFactory ]
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @inheritDoc
|
|
*/
|
|
public function onTemplateStylesStylesheetSanitizer(
|
|
StylesheetSanitizer &$sanitizer,
|
|
StylePropertySanitizer $propertySanitizer,
|
|
MatcherFactory $matcherFactory
|
|
) {
|
|
return $this->hookContainer->run(
|
|
'TemplateStylesStylesheetSanitizer',
|
|
[ &$sanitizer, $propertySanitizer, $matcherFactory ]
|
|
);
|
|
}
|
|
}
|