Merge "Merge namespace aliases like we merge namespace names"
[lhc/web/wiklou.git] / includes / content / CssContentHandler.php
index 1ab4ee2..ae5f742 100644 (file)
@@ -27,7 +27,7 @@
  * @since 1.21
  * @ingroup Content
  */
-class CssContentHandler extends TextContentHandler {
+class CssContentHandler extends CodeContentHandler {
 
        /**
         * @param string $modelId
@@ -40,32 +40,22 @@ class CssContentHandler extends TextContentHandler {
                return 'CssContent';
        }
 
-       /**
-        * Returns the english language, because CSS is english, and should be handled as such.
-        *
-        * @param Title $title
-        * @param Content $content
-        *
-        * @return Language Return of wfGetLangObj( 'en' )
-        *
-        * @see ContentHandler::getPageLanguage()
-        */
-       public function getPageLanguage( Title $title, Content $content = null ) {
-               return wfGetLangObj( 'en' );
+       public function supportsRedirects() {
+               return true;
        }
 
        /**
-        * Returns the english language, because CSS is english, and should be handled as such.
-        *
-        * @param Title $title
-        * @param Content $content
-        *
-        * @return Language Return of wfGetLangObj( 'en' )
+        * Create a redirect that is also valid CSS
         *
-        * @see ContentHandler::getPageViewLanguage()
+        * @param Title $destination
+        * @param string $text ignored
+        * @return CssContent
         */
-       public function getPageViewLanguage( Title $title, Content $content = null ) {
-               return wfGetLangObj( 'en' );
+       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 ) . ';' );
        }
 
 }