MediaWiki  master
CssContentHandler.php
Go to the documentation of this file.
1 <?php
31 
35  public function __construct( $modelId = CONTENT_MODEL_CSS ) {
36  parent::__construct( $modelId, [ CONTENT_FORMAT_CSS ] );
37  }
38 
39  protected function getContentClass() {
40  return CssContent::class;
41  }
42 
43  public function supportsRedirects() {
44  return true;
45  }
46 
54  public function makeRedirectContent( Title $destination, $text = '' ) {
55  // The parameters are passed as a string so the / is not url-encoded by wfArrayToCgi
56  $url = $destination->getFullURL( 'action=raw&ctype=text/css', false, PROTO_RELATIVE );
57  $class = $this->getContentClass();
58  return new $class( '/* #REDIRECT */@import ' . CSSMin::buildUrlValue( $url ) . ';' );
59  }
60 
61 }
Content handler for CSS pages.
makeRedirectContent(Title $destination, $text='')
Create a redirect that is also valid CSS.
__construct( $modelId=CONTENT_MODEL_CSS)
const CONTENT_FORMAT_CSS
Definition: Defines.php:234
Content handler for code content such as CSS, JavaScript, JSON, etc.
static buildUrlValue( $url)
Build a CSS &#39;url()&#39; value for the given URL, quoting parentheses (and other funny characters) and esc...
Definition: CSSMin.php:216
getFullURL( $query='', $query2=false, $proto=PROTO_RELATIVE)
Get a real URL referring to this title, with interwiki link and fragment.
Definition: Title.php:2103
const PROTO_RELATIVE
Definition: Defines.php:201
const CONTENT_MODEL_CSS
Definition: Defines.php:217