setHeaders(); $this->outputHeader(); $this->getOutput()->allowClickjacking(); $this->getOutput()->addHTML( Html::openElement( 'table', [ 'class' => 'mw-datatable', 'id' => 'mw-trackingcategories-table' ] ) . "\n" . " " . $this->msg( 'trackingcategories-msg' )->escaped() . " " . $this->msg( 'trackingcategories-name' )->escaped() . " " . $this->msg( 'trackingcategories-desc' )->escaped() . " " ); $trackingCategories = new TrackingCategories( $this->getConfig() ); $categoryList = $trackingCategories->getTrackingCategories(); $batch = new LinkBatch(); foreach ( $categoryList as $catMsg => $data ) { $batch->addObj( $data['msg'] ); foreach ( $data['cats'] as $catTitle ) { $batch->addObj( $catTitle ); } } $batch->execute(); Hooks::run( 'SpecialTrackingCategories::preprocess', [ $this, $categoryList ] ); $linkRenderer = $this->getLinkRenderer(); foreach ( $categoryList as $catMsg => $data ) { $allMsgs = []; $catDesc = $catMsg . '-desc'; $catMsgTitleText = $linkRenderer->makeLink( $data['msg'], $catMsg ); foreach ( $data['cats'] as $catTitle ) { $html = $linkRenderer->makeLink( $catTitle, $catTitle->getText() ); Hooks::run( 'SpecialTrackingCategories::generateCatLink', [ $this, $catTitle, &$html ] ); $allMsgs[] = $html; } # Extra message, when no category was found if ( !count( $allMsgs ) ) { $allMsgs[] = $this->msg( 'trackingcategories-disabled' )->parse(); } /* * Show category description if it exists as a system message * as category-name-desc */ $descMsg = $this->msg( $catDesc ); if ( $descMsg->isBlank() ) { $descMsg = $this->msg( 'trackingcategories-nodesc' ); } $this->getOutput()->addHTML( Html::openElement( 'tr' ) . Html::openElement( 'td', [ 'class' => 'mw-trackingcategories-name' ] ) . $this->getLanguage()->commaList( array_unique( $allMsgs ) ) . Html::closeElement( 'td' ) . Html::openElement( 'td', [ 'class' => 'mw-trackingcategories-msg' ] ) . $catMsgTitleText . Html::closeElement( 'td' ) . Html::openElement( 'td', [ 'class' => 'mw-trackingcategories-desc' ] ) . $descMsg->parse() . Html::closeElement( 'td' ) . Html::closeElement( 'tr' ) ); } $this->getOutput()->addHTML( Html::closeElement( 'table' ) ); } protected function getGroupName() { return 'pages'; } }