50 private $namespaceContentModels;
53 private $contentHandlerFactory;
59 private $titleFactory;
69 array $namespaceContentModels,
75 $this->namespaceContentModels = $namespaceContentModels;
76 $this->contentHandlerFactory = $contentHandlerFactory;
77 $this->hookRunner =
new HookRunner( $hookContainer );
78 $this->titleFactory = $titleFactory;
93 $title = $this->titleFactory->newFromPageIdentity( $page );
94 $handler = $this->contentHandlerFactory->getContentHandler( $model );
96 return $handler->canBeUsedOn( $title );
109 $ns = $page->getNamespace();
110 $model = $this->namespaceContentModels[$ns] ??
null;
114 $title = $this->titleFactory->newFromPageIdentity( $page );
116 $title = $this->titleFactory->newFromLinkTarget( $page );
119 if ( !$this->hookRunner->onContentHandlerDefaultModelFor( $title, $model ) && $model !==
null ) {
124 $isCodePage = $ns ===
NS_MEDIAWIKI && preg_match(
'!\.(css|js|json)$!u', $title->getText(), $m );
130 $isCodeSubpage = $ns ===
NS_USER
132 && preg_match(
"/\\/.*\\.(js|css|json)$/", $title->getText(), $m );
134 if ( $isCodeSubpage ) {
140 $isWikitext = $isWikitext && !$isCodePage && !$isCodeSubpage;
142 if ( !$isWikitext ) {
const CONTENT_MODEL_WIKITEXT
const CONTENT_MODEL_JAVASCRIPT
Exception thrown when an unregistered content model is requested.
A SlotRoleHandler for the main slot.
supportsArticleCount()
Whether this slot should be considered when determining whether a page should be counted as an "artic...
__construct(array $namespaceContentModels, IContentHandlerFactory $contentHandlerFactory, HookContainer $hookContainer, TitleFactory $titleFactory)
isAllowedModel( $model, PageIdentity $page)
Interface for objects (potentially) representing an editable wiki page.
if(!is_readable( $file)) $ext