From 44309e75572b4af76cffb776abb2eafcfa52ecac Mon Sep 17 00:00:00 2001 From: Daniel Friesen Date: Thu, 19 Nov 2009 00:37:00 +0000 Subject: [PATCH] Add a wgCategories variable to the js variables so users don't need to do really ugly dom searching to see if a category is in the categorylinks box. --- includes/OutputPage.php | 7 ++++++- includes/Skin.php | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/includes/OutputPage.php b/includes/OutputPage.php index e32884ee87..7f1639addf 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -12,7 +12,7 @@ class OutputPage { var $mHTMLtitle = '', $mIsarticle = true, $mPrintable = false; var $mSubtitle = '', $mRedirect = '', $mStatusCode; var $mLastModified = '', $mETag = false; - var $mCategoryLinks = array(), $mLanguageLinks = array(); + var $mCategoryLinks = array(), $mCategories = array(), $mLanguageLinks = array(); var $mScriptLoaderClassList = array(); @@ -664,6 +664,10 @@ class OutputPage { return $this->mCategoryLinks; } + public function getCategories() { + return $this->mCategories; + } + /** * Add an array of categories, with names in the keys */ @@ -713,6 +717,7 @@ class OutputPage { if ( array_key_exists( $category, $categories ) ) continue; $text = $wgContLang->convertHtml( $title->getText() ); + $this->mCategories[] = $title->getText(); $this->mCategoryLinks[$type][] = $sk->link( $title, $text ); } } diff --git a/includes/Skin.php b/includes/Skin.php index 2002613715..026fbd127c 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -416,6 +416,7 @@ class Skin extends Linker { 'wgFormattedNamespaces' => $wgContLang->getFormattedNamespaces(), 'wgNamespaceIds' => $wgContLang->getNamespaceIds(), 'wgSiteName' => $wgSitename, + 'wgCategories' => $wgOut->getCategories(), ); if ( $wgContLang->hasVariants() ) { $vars['wgUserVariant'] = $wgContLang->getPreferredVariant(); -- 2.20.1