$model = MWNamespace::getNamespaceContentModel( $ns );
// Hook can determine default model
- if ( !Hooks::run( 'ContentHandlerDefaultModelFor', array( $title, &$model ) ) ) {
+ if ( !Hooks::run( 'ContentHandlerDefaultModelFor', [ $title, &$model ] ) ) {
if ( !is_null( $model ) ) {
return $model;
}
}
// Hook can force JS/CSS
- Hooks::run( 'TitleIsCssOrJsPage', array( $title, &$isCodePage ), '1.25' );
+ Hooks::run( 'TitleIsCssOrJsPage', [ $title, &$isCodePage ], '1.25' );
// Is this a user subpage containing code?
$isCodeSubpage = NS_USER == $ns
$isWikitext = $isWikitext && !$isCodePage && !$isCodeSubpage;
// Hook can override $isWikitext
- Hooks::run( 'TitleIsWikitextPage', array( $title, &$isWikitext ), '1.25' );
+ Hooks::run( 'TitleIsWikitextPage', [ $title, &$isWikitext ], '1.25' );
if ( !$isWikitext ) {
switch ( $ext ) {
if ( empty( $wgContentHandlers[$modelId] ) ) {
$handler = null;
- Hooks::run( 'ContentHandlerForModelID', array( $modelId, &$handler ) );
+ Hooks::run( 'ContentHandlerForModelID', [ $modelId, &$handler ] );
if ( $handler === null ) {
throw new MWUnknownContentModelException( $modelId );
public static function getAllContentFormats() {
global $wgContentHandlers;
- $formats = array();
+ $formats = [];
foreach ( $wgContentHandlers as $model => $class ) {
$handler = ContentHandler::getForModelID( $model );
* @return array Always an empty array.
*/
public function getActionOverrides() {
- return array();
+ return [];
}
/**
// hook: get difference engine
$differenceEngine = null;
if ( !Hooks::run( 'GetDifferenceEngine',
- array( $context, $old, $new, $refreshCache, $unhide, &$differenceEngine )
+ [ $context, $old, $new, $refreshCache, $unhide, &$differenceEngine ]
) ) {
return $differenceEngine;
}
$pageLang = wfGetLangObj( $lang );
}
- Hooks::run( 'PageContentLanguage', array( $title, &$pageLang, $wgLang ) );
+ Hooks::run( 'PageContentLanguage', [ $title, &$pageLang, $wgLang ] );
return wfGetLangObj( $pageLang );
}
public function canBeUsedOn( Title $title ) {
$ok = true;
- Hooks::run( 'ContentModelCanBeUsedOn', array( $this->getModelID(), $title, &$ok ) );
+ Hooks::run( 'ContentModelCanBeUsedOn', [ $this->getModelID(), $title, &$ok ] );
return $ok;
}
// Find out if there was only one contributor
// Only scan the last 20 revisions
$res = $dbw->select( 'revision', 'rev_user_text',
- array(
+ [
'rev_page' => $title->getArticleID(),
$dbw->bitAnd( 'rev_deleted', Revision::DELETED_USER ) . ' = 0'
- ),
+ ],
__METHOD__,
- array( 'LIMIT' => 20 )
+ [ 'LIMIT' => 20 ]
);
if ( $res === false ) {
return false;
}
+ /**
+ * Returns true if this content model supports categories.
+ * The default implementation returns true.
+ *
+ * @return bool Always true.
+ */
+ public function supportsCategories() {
+ return true;
+ }
+
/**
* Returns true if this content model supports redirects.
* This default implementation returns false.
*
* @see ContentHandler::$enableDeprecationWarnings
*/
- public static function runLegacyHooks( $event, $args = array(),
+ public static function runLegacyHooks( $event, $args = [],
$warn = null
) {
// so we can find and fix them.
$handlers = Hooks::getHandlers( $event );
- $handlerInfo = array();
+ $handlerInfo = [];
MediaWiki\suppressWarnings();
}
// convert Content objects to text
- $contentObjects = array();
- $contentTexts = array();
+ $contentObjects = [];
+ $contentTexts = [];
foreach ( $args as $k => $v ) {
if ( $v instanceof Content ) {