mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/TemplateStyles
synced 2024-12-11 16:16:15 +00:00
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 ]
|
||
|
);
|
||
|
}
|
||
|
}
|