66 $categories = array_merge(
67 self::$coreTrackingCategories,
68 ExtensionRegistry::getInstance()->getAttribute(
'TrackingCategories' ),
69 $this->config->get(
'TrackingCategories' )
73 $enableMagicLinks = $this->config->get(
'EnableMagicLinks' );
74 if ( $enableMagicLinks[
'ISBN'] ) {
75 $categories[] =
'magiclink-tracking-isbn';
77 if ( $enableMagicLinks[
'RFC'] ) {
78 $categories[] =
'magiclink-tracking-rfc';
80 if ( $enableMagicLinks[
'PMID'] ) {
81 $categories[] =
'magiclink-tracking-pmid';
84 $trackingCategories = [];
85 $nsInfo = MediaWikiServices::getInstance()->getNamespaceInfo();
86 foreach ( $categories as $catMsg ) {
92 $msgObj =
wfMessage( $catMsg )->inContentLanguage();
94 $catMsgTitle = Title::makeTitleSafe(
NS_MEDIAWIKI, $catMsg );
95 if ( !$catMsgTitle ) {
101 if ( strpos( $msgObj->plain(),
'{{' ) !==
false ) {
102 $ns = $nsInfo->getValidNamespaces();
103 foreach ( $ns as $namesp ) {
104 $tempTitle = Title::makeTitleSafe( $namesp, $catMsg );
108 $catName = $msgObj->title( $tempTitle )->text();
109 # Allow tracking categories to be disabled by setting them to "-"
110 if ( $catName !==
'-' ) {
111 $catTitle = Title::makeTitleSafe(
NS_CATEGORY, $catName );
113 $allCats[] = $catTitle;
118 $catName = $msgObj->text();
119 # Allow tracking categories to be disabled by setting them to "-"
120 if ( $catName !==
'-' ) {
121 $catTitle = Title::makeTitleSafe(
NS_CATEGORY, $catName );
123 $allCats[] = $catTitle;
127 $trackingCategories[$catMsg] = [
129 'msg' => $catMsgTitle,
133 return $trackingCategories;