X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fcontent%2FCssContentHandler.php;h=9c1103536cac3e1e76ee438336915fe1ae773329;hb=28120473f534966ec5e79b515cb8be21855b6e10;hp=b2a8676b01342ea3a6f3b13ef96c29cd15b42432;hpb=38d59dd21347dc5167fbef94a0558f6bbdcd4195;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/content/CssContentHandler.php b/includes/content/CssContentHandler.php index b2a8676b01..9c1103536c 100644 --- a/includes/content/CssContentHandler.php +++ b/includes/content/CssContentHandler.php @@ -33,10 +33,29 @@ class CssContentHandler extends CodeContentHandler { * @param string $modelId */ public function __construct( $modelId = CONTENT_MODEL_CSS ) { - parent::__construct( $modelId, array( CONTENT_FORMAT_CSS ) ); + parent::__construct( $modelId, [ CONTENT_FORMAT_CSS ] ); } protected function getContentClass() { - return 'CssContent'; + return CssContent::class; } + + public function supportsRedirects() { + return true; + } + + /** + * Create a redirect that is also valid CSS + * + * @param Title $destination + * @param string $text ignored + * @return CssContent + */ + public function makeRedirectContent( Title $destination, $text = '' ) { + // The parameters are passed as a string so the / is not url-encoded by wfArrayToCgi + $url = $destination->getFullURL( 'action=raw&ctype=text/css', false, PROTO_RELATIVE ); + $class = $this->getContentClass(); + return new $class( '/* #REDIRECT */@import ' . CSSMin::buildUrlValue( $url ) . ';' ); + } + }