MediaWiki  1.33.1
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 }
CssContentHandler\getContentClass
getContentClass()
Definition: CssContentHandler.php:39
CssContentHandler\makeRedirectContent
makeRedirectContent(Title $destination, $text='')
Create a redirect that is also valid CSS.
Definition: CssContentHandler.php:54
CssContentHandler\__construct
__construct( $modelId=CONTENT_MODEL_CSS)
Definition: CssContentHandler.php:35
CodeContentHandler
Content handler for code content such as CSS, JavaScript, JSON, etc.
Definition: CodeContentHandler.php:29
CONTENT_MODEL_CSS
const CONTENT_MODEL_CSS
Definition: Defines.php:237
CONTENT_FORMAT_CSS
const CONTENT_FORMAT_CSS
Definition: Defines.php:254
php
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition: injection.txt:35
CssContentHandler
Content handler for CSS pages.
Definition: CssContentHandler.php:30
PROTO_RELATIVE
const PROTO_RELATIVE
Definition: Defines.php:221
CssContentHandler\supportsRedirects
supportsRedirects()
Returns true if this content model supports redirects.
Definition: CssContentHandler.php:43
Title\getFullURL
getFullURL( $query='', $query2=false, $proto=PROTO_RELATIVE)
Get a real URL referring to this title, with interwiki link and fragment.
Definition: Title.php:1879
Title
Represents a title within MediaWiki.
Definition: Title.php:40
class
you have access to all of the normal MediaWiki so you can get a DB use the etc For full docs on the Maintenance class
Definition: maintenance.txt:52