diff --git a/ApiCategoryTree.php b/ApiCategoryTree.php index 4a417cfc..3be6dc91 100644 --- a/ApiCategoryTree.php +++ b/ApiCategoryTree.php @@ -3,7 +3,7 @@ class ApiCategoryTree extends ApiBase { public function execute() { $params = $this->extractRequestParams(); - $options = array(); + $options = []; if ( isset( $params['options'] ) ) { $options = FormatJson::decode( $params['options'] ); if ( !is_object( $options ) ) { @@ -46,10 +46,10 @@ class ApiCategoryTree extends ApiBase { $params = $this->extractRequestParams(); $title = CategoryTree::makeTitle( $params['category'] ); return wfGetDB( DB_SLAVE )->selectField( 'page', 'page_touched', - array( + [ 'page_namespace' => NS_CATEGORY, 'page_title' => $title->getDBkey(), - ), + ], __METHOD__ ); } @@ -89,10 +89,10 @@ class ApiCategoryTree extends ApiBase { $wgMemc->set( $mckey, - array( + [ 'timestamp' => wfTimestampNow(), 'value' => $html - ), + ], 86400 ); } @@ -100,15 +100,15 @@ class ApiCategoryTree extends ApiBase { } public function getAllowedParams() { - return array( - 'category' => array( + return [ + 'category' => [ ApiBase::PARAM_TYPE => 'string', ApiBase::PARAM_REQUIRED => true, - ), - 'options' => array( + ], + 'options' => [ ApiBase::PARAM_TYPE => 'string', - ), - ); + ], + ]; } public function isInternal() { diff --git a/CategoryPageSubclass.php b/CategoryPageSubclass.php index a37c6022..f71f2617 100644 --- a/CategoryPageSubclass.php +++ b/CategoryPageSubclass.php @@ -53,7 +53,7 @@ class CategoryTreeCategoryViewer extends CategoryViewer { } function clearCategoryState() { - $this->child_cats = array(); + $this->child_cats = []; parent::clearCategoryState(); } diff --git a/CategoryTree.alias.php b/CategoryTree.alias.php index e92d626f..043be2aa 100644 --- a/CategoryTree.alias.php +++ b/CategoryTree.alias.php @@ -10,494 +10,494 @@ */ // @codingStandardsIgnoreFile -$specialPageAliases = array(); +$specialPageAliases = []; /** English (English) */ -$specialPageAliases['en'] = array( - 'CategoryTree' => array( 'CategoryTree' ), -); +$specialPageAliases['en'] = [ + 'CategoryTree' => [ 'CategoryTree' ], +]; /** Afrikaans (Afrikaans) */ -$specialPageAliases['af'] = array( - 'CategoryTree' => array( 'KategorieBoom' ), -); +$specialPageAliases['af'] = [ + 'CategoryTree' => [ 'KategorieBoom' ], +]; /** Aragonese (aragonés) */ -$specialPageAliases['an'] = array( - 'CategoryTree' => array( 'Árbol_de_categorías' ), -); +$specialPageAliases['an'] = [ + 'CategoryTree' => [ 'Árbol_de_categorías' ], +]; /** Arabic (العربية) */ -$specialPageAliases['ar'] = array( - 'CategoryTree' => array( 'شجرة_تصنيف' ), -); +$specialPageAliases['ar'] = [ + 'CategoryTree' => [ 'شجرة_تصنيف' ], +]; /** Aramaic (ܐܪܡܝܐ) */ -$specialPageAliases['arc'] = array( - 'CategoryTree' => array( 'ܐܝܠܢܐ_ܕܣܕܪܐ' ), -); +$specialPageAliases['arc'] = [ + 'CategoryTree' => [ 'ܐܝܠܢܐ_ܕܣܕܪܐ' ], +]; /** Egyptian Arabic (مصرى) */ -$specialPageAliases['arz'] = array( - 'CategoryTree' => array( 'شجرة_تصنيف' ), -); +$specialPageAliases['arz'] = [ + 'CategoryTree' => [ 'شجرة_تصنيف' ], +]; /** Assamese (অসমীয়া) */ -$specialPageAliases['as'] = array( - 'CategoryTree' => array( 'শ্ৰেণীবৃক্ষ' ), -); +$specialPageAliases['as'] = [ + 'CategoryTree' => [ 'শ্ৰেণীবৃক্ষ' ], +]; /** Avaric (авар) */ -$specialPageAliases['av'] = array( - 'CategoryTree' => array( 'Категориязул_гъветІ' ), -); +$specialPageAliases['av'] = [ + 'CategoryTree' => [ 'Категориязул_гъветІ' ], +]; /** Bashkir (башҡортса) */ -$specialPageAliases['ba'] = array( - 'CategoryTree' => array( 'Категория_ағасы' ), -); +$specialPageAliases['ba'] = [ + 'CategoryTree' => [ 'Категория_ағасы' ], +]; /** Bikol Central (Bikol Central) */ -$specialPageAliases['bcl'] = array( - 'CategoryTree' => array( 'KahoyNinKategorya' ), -); +$specialPageAliases['bcl'] = [ + 'CategoryTree' => [ 'KahoyNinKategorya' ], +]; /** Belarusian (Taraškievica orthography) (беларуская (тарашкевіца)‎) */ -$specialPageAliases['be-tarask'] = array( - 'CategoryTree' => array( 'Дрэва_катэгорыяў' ), -); +$specialPageAliases['be-tarask'] = [ + 'CategoryTree' => [ 'Дрэва_катэгорыяў' ], +]; /** Bulgarian (български) */ -$specialPageAliases['bg'] = array( - 'CategoryTree' => array( 'Дърво_на_категориите' ), -); +$specialPageAliases['bg'] = [ + 'CategoryTree' => [ 'Дърво_на_категориите' ], +]; /** Western Balochi (بلوچی رخشانی) */ -$specialPageAliases['bgn'] = array( - 'CategoryTree' => array( 'تهری_درچّگ_یا_درخت' ), -); +$specialPageAliases['bgn'] = [ + 'CategoryTree' => [ 'تهری_درچّگ_یا_درخت' ], +]; /** Banjar (Bahasa Banjar) */ -$specialPageAliases['bjn'] = array( - 'CategoryTree' => array( 'Puhun_tumbung' ), -); +$specialPageAliases['bjn'] = [ + 'CategoryTree' => [ 'Puhun_tumbung' ], +]; /** Breton (brezhoneg) */ -$specialPageAliases['br'] = array( - 'CategoryTree' => array( 'GwezennadurRummad' ), -); +$specialPageAliases['br'] = [ + 'CategoryTree' => [ 'GwezennadurRummad' ], +]; /** Bosnian (bosanski) */ -$specialPageAliases['bs'] = array( - 'CategoryTree' => array( 'StabloKategorija' ), -); +$specialPageAliases['bs'] = [ + 'CategoryTree' => [ 'StabloKategorija' ], +]; /** Catalan (català) */ -$specialPageAliases['ca'] = array( - 'CategoryTree' => array( 'Categories_en_arbre', 'Arbre_de_categories' ), -); +$specialPageAliases['ca'] = [ + 'CategoryTree' => [ 'Categories_en_arbre', 'Arbre_de_categories' ], +]; /** Min Dong Chinese (Mìng-dĕ̤ng-ngṳ̄) */ -$specialPageAliases['cdo'] = array( - 'CategoryTree' => array( '分類樹' ), -); +$specialPageAliases['cdo'] = [ + 'CategoryTree' => [ '分類樹' ], +]; /** Chechen (нохчийн) */ -$specialPageAliases['ce'] = array( - 'CategoryTree' => array( 'Категорийн_дит' ), -); +$specialPageAliases['ce'] = [ + 'CategoryTree' => [ 'Категорийн_дит' ], +]; /** Czech (čeština) */ -$specialPageAliases['cs'] = array( - 'CategoryTree' => array( 'Strom_kategorií' ), -); +$specialPageAliases['cs'] = [ + 'CategoryTree' => [ 'Strom_kategorií' ], +]; /** Danish (dansk) */ -$specialPageAliases['da'] = array( - 'CategoryTree' => array( 'Kategoritræ' ), -); +$specialPageAliases['da'] = [ + 'CategoryTree' => [ 'Kategoritræ' ], +]; /** German (Deutsch) */ -$specialPageAliases['de'] = array( - 'CategoryTree' => array( 'Kategorienbaum', 'Kategoriebaum' ), -); +$specialPageAliases['de'] = [ + 'CategoryTree' => [ 'Kategorienbaum', 'Kategoriebaum' ], +]; /** Zazaki (Zazaki) */ -$specialPageAliases['diq'] = array( - 'CategoryTree' => array( 'DaraKategoriye' ), -); +$specialPageAliases['diq'] = [ + 'CategoryTree' => [ 'DaraKategoriye' ], +]; /** Lower Sorbian (dolnoserbski) */ -$specialPageAliases['dsb'] = array( - 'CategoryTree' => array( 'Bom_kategorijow' ), -); +$specialPageAliases['dsb'] = [ + 'CategoryTree' => [ 'Bom_kategorijow' ], +]; /** Greek (Ελληνικά) */ -$specialPageAliases['el'] = array( - 'CategoryTree' => array( 'ΔέντροΚατηγορίας' ), -); +$specialPageAliases['el'] = [ + 'CategoryTree' => [ 'ΔέντροΚατηγορίας' ], +]; /** Esperanto (Esperanto) */ -$specialPageAliases['eo'] = array( - 'CategoryTree' => array( 'Arbo_de_kategorioj', 'Kategorio-arbo' ), -); +$specialPageAliases['eo'] = [ + 'CategoryTree' => [ 'Arbo_de_kategorioj', 'Kategorio-arbo' ], +]; /** Spanish (español) */ -$specialPageAliases['es'] = array( - 'CategoryTree' => array( 'ÁrbolDeCategorías', 'Árbol_de_categorías' ), -); +$specialPageAliases['es'] = [ + 'CategoryTree' => [ 'ÁrbolDeCategorías', 'Árbol_de_categorías' ], +]; /** Estonian (eesti) */ -$specialPageAliases['et'] = array( - 'CategoryTree' => array( 'Kategooriapuu' ), -); +$specialPageAliases['et'] = [ + 'CategoryTree' => [ 'Kategooriapuu' ], +]; /** Basque (euskara) */ -$specialPageAliases['eu'] = array( - 'CategoryTree' => array( 'KategoriaZuhaitza' ), -); +$specialPageAliases['eu'] = [ + 'CategoryTree' => [ 'KategoriaZuhaitza' ], +]; /** Persian (فارسی) */ -$specialPageAliases['fa'] = array( - 'CategoryTree' => array( 'درخت_رده' ), -); +$specialPageAliases['fa'] = [ + 'CategoryTree' => [ 'درخت_رده' ], +]; /** Finnish (suomi) */ -$specialPageAliases['fi'] = array( - 'CategoryTree' => array( 'Luokkapuu' ), -); +$specialPageAliases['fi'] = [ + 'CategoryTree' => [ 'Luokkapuu' ], +]; /** French (français) */ -$specialPageAliases['fr'] = array( - 'CategoryTree' => array( 'ArbreCatégorie', 'ArbreCategorie', 'Arbre_catégorie' ), -); +$specialPageAliases['fr'] = [ + 'CategoryTree' => [ 'ArbreCatégorie', 'ArbreCategorie', 'Arbre_catégorie' ], +]; /** Arpitan (arpetan) */ -$specialPageAliases['frp'] = array( - 'CategoryTree' => array( 'Structura_d\'âbro_de_les_catègories', 'StructuraDÂbroDeLesCatègories' ), -); +$specialPageAliases['frp'] = [ + 'CategoryTree' => [ 'Structura_d\'âbro_de_les_catègories', 'StructuraDÂbroDeLesCatègories' ], +]; /** Western Frisian (Frysk) */ -$specialPageAliases['fy'] = array( - 'CategoryTree' => array( 'Kategorybeam' ), -); +$specialPageAliases['fy'] = [ + 'CategoryTree' => [ 'Kategorybeam' ], +]; /** Galician (galego) */ -$specialPageAliases['gl'] = array( - 'CategoryTree' => array( 'Árbore_de_categorías' ), -); +$specialPageAliases['gl'] = [ + 'CategoryTree' => [ 'Árbore_de_categorías' ], +]; /** Swiss German (Alemannisch) */ -$specialPageAliases['gsw'] = array( - 'CategoryTree' => array( 'Kategoriebaum' ), -); +$specialPageAliases['gsw'] = [ + 'CategoryTree' => [ 'Kategoriebaum' ], +]; /** Gujarati (ગુજરાતી) */ -$specialPageAliases['gu'] = array( - 'CategoryTree' => array( 'શ્રેણીવૃક્ષ' ), -); +$specialPageAliases['gu'] = [ + 'CategoryTree' => [ 'શ્રેણીવૃક્ષ' ], +]; /** Hebrew (עברית) */ -$specialPageAliases['he'] = array( - 'CategoryTree' => array( 'עץ_קטגוריות' ), -); +$specialPageAliases['he'] = [ + 'CategoryTree' => [ 'עץ_קטגוריות' ], +]; /** Hindi (हिन्दी) */ -$specialPageAliases['hi'] = array( - 'CategoryTree' => array( 'श्रेणी_वृक्ष', 'श्रेणीवृक्ष' ), -); +$specialPageAliases['hi'] = [ + 'CategoryTree' => [ 'श्रेणी_वृक्ष', 'श्रेणीवृक्ष' ], +]; /** Upper Sorbian (hornjoserbsce) */ -$specialPageAliases['hsb'] = array( - 'CategoryTree' => array( 'Kategorijowy_štom' ), -); +$specialPageAliases['hsb'] = [ + 'CategoryTree' => [ 'Kategorijowy_štom' ], +]; /** Xiang Chinese (湘语) */ -$specialPageAliases['hsn'] = array( - 'CategoryTree' => array( '类别树' ), -); +$specialPageAliases['hsn'] = [ + 'CategoryTree' => [ '类别树' ], +]; /** Haitian (Kreyòl ayisyen) */ -$specialPageAliases['ht'] = array( - 'CategoryTree' => array( 'NivoKategori' ), -); +$specialPageAliases['ht'] = [ + 'CategoryTree' => [ 'NivoKategori' ], +]; /** Hungarian (magyar) */ -$specialPageAliases['hu'] = array( - 'CategoryTree' => array( 'Kategóriafa' ), -); +$specialPageAliases['hu'] = [ + 'CategoryTree' => [ 'Kategóriafa' ], +]; /** Interlingua (interlingua) */ -$specialPageAliases['ia'] = array( - 'CategoryTree' => array( 'Arbore_de_categorias' ), -); +$specialPageAliases['ia'] = [ + 'CategoryTree' => [ 'Arbore_de_categorias' ], +]; /** Indonesian (Bahasa Indonesia) */ -$specialPageAliases['id'] = array( - 'CategoryTree' => array( 'Pohon_kategori', 'PohonKategori' ), -); +$specialPageAliases['id'] = [ + 'CategoryTree' => [ 'Pohon_kategori', 'PohonKategori' ], +]; /** Ido (Ido) */ -$specialPageAliases['io'] = array( - 'CategoryTree' => array( 'KategorioArboro' ), -); +$specialPageAliases['io'] = [ + 'CategoryTree' => [ 'KategorioArboro' ], +]; /** Italian (italiano) */ -$specialPageAliases['it'] = array( - 'CategoryTree' => array( 'AlberoCategorie' ), -); +$specialPageAliases['it'] = [ + 'CategoryTree' => [ 'AlberoCategorie' ], +]; /** Japanese (日本語) */ -$specialPageAliases['ja'] = array( - 'CategoryTree' => array( 'カテゴリツリー' ), -); +$specialPageAliases['ja'] = [ + 'CategoryTree' => [ 'カテゴリツリー' ], +]; /** Georgian (ქართული) */ -$specialPageAliases['ka'] = array( - 'CategoryTree' => array( 'კატეგორიის_ხე' ), -); +$specialPageAliases['ka'] = [ + 'CategoryTree' => [ 'კატეგორიის_ხე' ], +]; /** Khmer (ភាសាខ្មែរ) */ -$specialPageAliases['km'] = array( - 'CategoryTree' => array( 'មែកធាងចំណាត់ថ្នាក់ក្រុម' ), -); +$specialPageAliases['km'] = [ + 'CategoryTree' => [ 'មែកធាងចំណាត់ថ្នាក់ក្រុម' ], +]; /** Korean (한국어) */ -$specialPageAliases['ko'] = array( - 'CategoryTree' => array( '분류트리' ), -); +$specialPageAliases['ko'] = [ + 'CategoryTree' => [ '분류트리' ], +]; /** Colognian (Ripoarisch) */ -$specialPageAliases['ksh'] = array( - 'CategoryTree' => array( 'Saachjruppeboum' ), -); +$specialPageAliases['ksh'] = [ + 'CategoryTree' => [ 'Saachjruppeboum' ], +]; /** Kurdish (Kurdî) */ -$specialPageAliases['ku'] = array( - 'CategoryTree' => array( 'Dara_kategoriyan' ), -); +$specialPageAliases['ku'] = [ + 'CategoryTree' => [ 'Dara_kategoriyan' ], +]; /** Cornish (kernowek) */ -$specialPageAliases['kw'] = array( - 'CategoryTree' => array( 'GwedhenGlassys' ), -); +$specialPageAliases['kw'] = [ + 'CategoryTree' => [ 'GwedhenGlassys' ], +]; /** Latin (Latina) */ -$specialPageAliases['la'] = array( - 'CategoryTree' => array( 'Categoriarum_arbor' ), -); +$specialPageAliases['la'] = [ + 'CategoryTree' => [ 'Categoriarum_arbor' ], +]; /** Ladino (Ladino) */ -$specialPageAliases['lad'] = array( - 'CategoryTree' => array( 'Árvole_de_Kateggorías' ), -); +$specialPageAliases['lad'] = [ + 'CategoryTree' => [ 'Árvole_de_Kateggorías' ], +]; /** Luxembourgish (Lëtzebuergesch) */ -$specialPageAliases['lb'] = array( - 'CategoryTree' => array( 'Struktur_vun_de_Kategorien' ), -); +$specialPageAliases['lb'] = [ + 'CategoryTree' => [ 'Struktur_vun_de_Kategorien' ], +]; /** Northern Luri (لۊری شومالی) */ -$specialPageAliases['lrc'] = array( - 'CategoryTree' => array( 'دار_دأسە' ), -); +$specialPageAliases['lrc'] = [ + 'CategoryTree' => [ 'دار_دأسە' ], +]; /** Malagasy (Malagasy) */ -$specialPageAliases['mg'] = array( - 'CategoryTree' => array( 'Hazon-tsokajy', 'Hazontsokajy' ), -); +$specialPageAliases['mg'] = [ + 'CategoryTree' => [ 'Hazon-tsokajy', 'Hazontsokajy' ], +]; /** Minangkabau (Baso Minangkabau) */ -$specialPageAliases['min'] = array( - 'CategoryTree' => array( 'BatangKategori' ), -); +$specialPageAliases['min'] = [ + 'CategoryTree' => [ 'BatangKategori' ], +]; /** Macedonian (македонски) */ -$specialPageAliases['mk'] = array( - 'CategoryTree' => array( 'ДрвоНаКатегории' ), -); +$specialPageAliases['mk'] = [ + 'CategoryTree' => [ 'ДрвоНаКатегории' ], +]; /** Malayalam (മലയാളം) */ -$specialPageAliases['ml'] = array( - 'CategoryTree' => array( 'വർഗ്ഗവൃക്ഷം' ), -); +$specialPageAliases['ml'] = [ + 'CategoryTree' => [ 'വർഗ്ഗവൃക്ഷം' ], +]; /** Marathi (मराठी) */ -$specialPageAliases['mr'] = array( - 'CategoryTree' => array( 'वर्गवृक्ष' ), -); +$specialPageAliases['mr'] = [ + 'CategoryTree' => [ 'वर्गवृक्ष' ], +]; /** Malay (Bahasa Melayu) */ -$specialPageAliases['ms'] = array( - 'CategoryTree' => array( 'Salasilah_kategori' ), -); +$specialPageAliases['ms'] = [ + 'CategoryTree' => [ 'Salasilah_kategori' ], +]; /** Maltese (Malti) */ -$specialPageAliases['mt'] = array( - 'CategoryTree' => array( 'SiġraKategorija' ), -); +$specialPageAliases['mt'] = [ + 'CategoryTree' => [ 'SiġraKategorija' ], +]; /** Erzya (эрзянь) */ -$specialPageAliases['myv'] = array( - 'CategoryTree' => array( 'КатегорияньЧувто' ), -); +$specialPageAliases['myv'] = [ + 'CategoryTree' => [ 'КатегорияньЧувто' ], +]; /** Norwegian Bokmål (norsk bokmål) */ -$specialPageAliases['nb'] = array( - 'CategoryTree' => array( 'Kategoritre' ), -); +$specialPageAliases['nb'] = [ + 'CategoryTree' => [ 'Kategoritre' ], +]; /** Low German (Plattdüütsch) */ -$specialPageAliases['nds'] = array( - 'CategoryTree' => array( 'Kategorieboom' ), -); +$specialPageAliases['nds'] = [ + 'CategoryTree' => [ 'Kategorieboom' ], +]; /** Low Saxon (Netherlands) (Nedersaksies) */ -$specialPageAliases['nds-nl'] = array( - 'CategoryTree' => array( 'Kategorieboom' ), -); +$specialPageAliases['nds-nl'] = [ + 'CategoryTree' => [ 'Kategorieboom' ], +]; /** Dutch (Nederlands) */ -$specialPageAliases['nl'] = array( - 'CategoryTree' => array( 'Categorieboom' ), -); +$specialPageAliases['nl'] = [ + 'CategoryTree' => [ 'Categorieboom' ], +]; /** Norwegian Nynorsk (norsk nynorsk) */ -$specialPageAliases['nn'] = array( - 'CategoryTree' => array( 'Kategoritre' ), -); +$specialPageAliases['nn'] = [ + 'CategoryTree' => [ 'Kategoritre' ], +]; /** Occitan (occitan) */ -$specialPageAliases['oc'] = array( - 'CategoryTree' => array( 'ArbreCategoria', 'Arbre_categoria' ), -); +$specialPageAliases['oc'] = [ + 'CategoryTree' => [ 'ArbreCategoria', 'Arbre_categoria' ], +]; /** Polish (polski) */ -$specialPageAliases['pl'] = array( - 'CategoryTree' => array( 'Drzewo_kategorii' ), -); +$specialPageAliases['pl'] = [ + 'CategoryTree' => [ 'Drzewo_kategorii' ], +]; /** Pashto (پښتو) */ -$specialPageAliases['ps'] = array( - 'CategoryTree' => array( 'د_وېشنيزو_ونه' ), -); +$specialPageAliases['ps'] = [ + 'CategoryTree' => [ 'د_وېشنيزو_ونه' ], +]; /** Portuguese (português) */ -$specialPageAliases['pt'] = array( - 'CategoryTree' => array( 'Árvore_de_categorias' ), -); +$specialPageAliases['pt'] = [ + 'CategoryTree' => [ 'Árvore_de_categorias' ], +]; /** Brazilian Portuguese (português do Brasil) */ -$specialPageAliases['pt-br'] = array( - 'CategoryTree' => array( 'Árvore_de_categorias', 'Árvore_de_categoria' ), -); +$specialPageAliases['pt-br'] = [ + 'CategoryTree' => [ 'Árvore_de_categorias', 'Árvore_de_categoria' ], +]; /** Romanian (română) */ -$specialPageAliases['ro'] = array( - 'CategoryTree' => array( 'Arborele_categoriilor' ), -); +$specialPageAliases['ro'] = [ + 'CategoryTree' => [ 'Arborele_categoriilor' ], +]; /** Russian (русский) */ -$specialPageAliases['ru'] = array( - 'CategoryTree' => array( 'Дерево_категорий' ), -); +$specialPageAliases['ru'] = [ + 'CategoryTree' => [ 'Дерево_категорий' ], +]; /** Sanskrit (संस्कृतम्) */ -$specialPageAliases['sa'] = array( - 'CategoryTree' => array( 'वर्गवृक्ष:' ), -); +$specialPageAliases['sa'] = [ + 'CategoryTree' => [ 'वर्गवृक्ष:' ], +]; /** Sicilian (sicilianu) */ -$specialPageAliases['scn'] = array( - 'CategoryTree' => array( 'AlberoCategorie' ), -); +$specialPageAliases['scn'] = [ + 'CategoryTree' => [ 'AlberoCategorie' ], +]; /** Sinhala (සිංහල) */ -$specialPageAliases['si'] = array( - 'CategoryTree' => array( 'ප්‍රවර්ගරුක' ), -); +$specialPageAliases['si'] = [ + 'CategoryTree' => [ 'ප්‍රවර්ගරුක' ], +]; /** Slovak (slovenčina) */ -$specialPageAliases['sk'] = array( - 'CategoryTree' => array( 'StromKategórií' ), -); +$specialPageAliases['sk'] = [ + 'CategoryTree' => [ 'StromKategórií' ], +]; /** Swedish (svenska) */ -$specialPageAliases['sv'] = array( - 'CategoryTree' => array( 'Kategoriträd' ), -); +$specialPageAliases['sv'] = [ + 'CategoryTree' => [ 'Kategoriträd' ], +]; /** Swahili (Kiswahili) */ -$specialPageAliases['sw'] = array( - 'CategoryTree' => array( 'SafuyaJamii' ), -); +$specialPageAliases['sw'] = [ + 'CategoryTree' => [ 'SafuyaJamii' ], +]; /** Telugu (తెలుగు) */ -$specialPageAliases['te'] = array( - 'CategoryTree' => array( 'వర్గవృక్షం' ), -); +$specialPageAliases['te'] = [ + 'CategoryTree' => [ 'వర్గవృక్షం' ], +]; /** Thai (ไทย) */ -$specialPageAliases['th'] = array( - 'CategoryTree' => array( 'หมวดหมู่แบบผังต้นไม้' ), -); +$specialPageAliases['th'] = [ + 'CategoryTree' => [ 'หมวดหมู่แบบผังต้นไม้' ], +]; /** Tagalog (Tagalog) */ -$specialPageAliases['tl'] = array( - 'CategoryTree' => array( 'Puno_ng_kaurian' ), -); +$specialPageAliases['tl'] = [ + 'CategoryTree' => [ 'Puno_ng_kaurian' ], +]; /** Talysh (толышә зывон) */ -$specialPageAliases['tly'] = array( - 'CategoryTree' => array( 'Категоријон_до' ), -); +$specialPageAliases['tly'] = [ + 'CategoryTree' => [ 'Категоријон_до' ], +]; /** Turkish (Türkçe) */ -$specialPageAliases['tr'] = array( - 'CategoryTree' => array( 'KategoriAğacı', 'KategoriHiyerarşisi', 'UlamAğacı', 'UlamHiyerarşisi' ), -); +$specialPageAliases['tr'] = [ + 'CategoryTree' => [ 'KategoriAğacı', 'KategoriHiyerarşisi', 'UlamAğacı', 'UlamHiyerarşisi' ], +]; /** Ukrainian (українська) */ -$specialPageAliases['uk'] = array( - 'CategoryTree' => array( 'Дерево_категорій' ), -); +$specialPageAliases['uk'] = [ + 'CategoryTree' => [ 'Дерево_категорій' ], +]; /** Urdu (اردو) */ -$specialPageAliases['ur'] = array( - 'CategoryTree' => array( 'شجرہ_زمرہ' ), -); +$specialPageAliases['ur'] = [ + 'CategoryTree' => [ 'شجرہ_زمرہ' ], +]; /** Venetian (vèneto) */ -$specialPageAliases['vec'] = array( - 'CategoryTree' => array( 'ÀlbaroCategorie' ), -); +$specialPageAliases['vec'] = [ + 'CategoryTree' => [ 'ÀlbaroCategorie' ], +]; /** Veps (vepsän kel’) */ -$specialPageAliases['vep'] = array( - 'CategoryTree' => array( 'KategorijoidenPu' ), -); +$specialPageAliases['vep'] = [ + 'CategoryTree' => [ 'KategorijoidenPu' ], +]; /** Vietnamese (Tiếng Việt) */ -$specialPageAliases['vi'] = array( - 'CategoryTree' => array( 'Cây_thể_loại' ), -); +$specialPageAliases['vi'] = [ + 'CategoryTree' => [ 'Cây_thể_loại' ], +]; /** Yiddish (ייִדיש) */ -$specialPageAliases['yi'] = array( - 'CategoryTree' => array( 'קאטעגאריע_בוים' ), -); +$specialPageAliases['yi'] = [ + 'CategoryTree' => [ 'קאטעגאריע_בוים' ], +]; /** Simplified Chinese (中文(简体)‎) */ -$specialPageAliases['zh-hans'] = array( - 'CategoryTree' => array( '分类树' ), -); +$specialPageAliases['zh-hans'] = [ + 'CategoryTree' => [ '分类树' ], +]; /** Traditional Chinese (中文(繁體)‎) */ -$specialPageAliases['zh-hant'] = array( - 'CategoryTree' => array( '分類樹' ), -); +$specialPageAliases['zh-hant'] = [ + 'CategoryTree' => [ '分類樹' ], +]; /** Chinese (Taiwan) (中文(台灣)‎) */ -$specialPageAliases['zh-tw'] = array( - 'CategoryTree' => array( '分類樹' ), -); \ No newline at end of file +$specialPageAliases['zh-tw'] = [ + 'CategoryTree' => [ '分類樹' ], +]; diff --git a/CategoryTree.hooks.php b/CategoryTree.hooks.php index aa0c0fef..d5c05cee 100644 --- a/CategoryTree.hooks.php +++ b/CategoryTree.hooks.php @@ -90,7 +90,7 @@ class CategoryTreeHooks { $cat = array_shift( $params ); // build associative arguments from flat parameter list - $argv = array(); + $argv = []; foreach ( $params as $p ) { if ( preg_match( '/^\s*(\S.*?)\s*=\s*(.*?)\s*$/', $p, $m ) ) { $k = $m[1]; @@ -105,7 +105,7 @@ class CategoryTreeHooks { // now handle just like a tag $html = self::parserHook( $cat, $argv, $parser ); - return array( $html, 'noparse' => true, 'isHTML' => true ); + return [ $html, 'noparse' => true, 'isHTML' => true ]; } /** diff --git a/CategoryTree.i18n.magic.php b/CategoryTree.i18n.magic.php index 423f3fa7..00bc553c 100644 --- a/CategoryTree.i18n.magic.php +++ b/CategoryTree.i18n.magic.php @@ -9,249 +9,249 @@ * @license GNU General Public Licence 2.0 or later */ -$magicWords = array(); +$magicWords = []; /** English (English) */ -$magicWords['en'] = array( - 'categorytree' => array( 0, 'categorytree' ), -); +$magicWords['en'] = [ + 'categorytree' => [ 0, 'categorytree' ], +]; /** Afrikaans (Afrikaans) */ -$magicWords['af'] = array( - 'categorytree' => array( 0, 'kategorieboom', 'categorytree' ), -); +$magicWords['af'] = [ + 'categorytree' => [ 0, 'kategorieboom', 'categorytree' ], +]; /** Arabic (العربية) */ -$magicWords['ar'] = array( - 'categorytree' => array( 0, 'شجرة_تصنيف' ), -); +$magicWords['ar'] = [ + 'categorytree' => [ 0, 'شجرة_تصنيف' ], +]; /** Egyptian Arabic (مصرى) */ -$magicWords['arz'] = array( - 'categorytree' => array( 0, 'شجرة_تصنيف' ), -); +$magicWords['arz'] = [ + 'categorytree' => [ 0, 'شجرة_تصنيف' ], +]; /** Breton (brezhoneg) */ -$magicWords['br'] = array( - 'categorytree' => array( 0, 'GwezennadurRummad' ), -); +$magicWords['br'] = [ + 'categorytree' => [ 0, 'GwezennadurRummad' ], +]; /** Chechen (нохчийн) */ -$magicWords['ce'] = array( - 'categorytree' => array( 0, 'категоридит', 'деревокатегорий' ), -); +$magicWords['ce'] = [ + 'categorytree' => [ 0, 'категоридит', 'деревокатегорий' ], +]; /** German (Deutsch) */ -$magicWords['de'] = array( - 'categorytree' => array( 0, 'kategorienbaum', 'kategoriebaum' ), -); +$magicWords['de'] = [ + 'categorytree' => [ 0, 'kategorienbaum', 'kategoriebaum' ], +]; /** Zazaki (Zazaki) */ -$magicWords['diq'] = array( - 'categorytree' => array( 0, 'darakategori' ), -); +$magicWords['diq'] = [ + 'categorytree' => [ 0, 'darakategori' ], +]; /** Esperanto (Esperanto) */ -$magicWords['eo'] = array( - 'categorytree' => array( 0, 'kategoriarbo' ), -); +$magicWords['eo'] = [ + 'categorytree' => [ 0, 'kategoriarbo' ], +]; /** Spanish (español) */ -$magicWords['es'] = array( - 'categorytree' => array( 0, 'árboldecategorías', 'arboldecategorias' ), -); +$magicWords['es'] = [ + 'categorytree' => [ 0, 'árboldecategorías', 'arboldecategorias' ], +]; /** Estonian (eesti) */ -$magicWords['et'] = array( - 'categorytree' => array( 0, 'kategooriapuu' ), -); +$magicWords['et'] = [ + 'categorytree' => [ 0, 'kategooriapuu' ], +]; /** Persian (فارسی) */ -$magicWords['fa'] = array( - 'categorytree' => array( 0, 'درخت‌رده', 'درخت_رده' ), -); +$magicWords['fa'] = [ + 'categorytree' => [ 0, 'درخت‌رده', 'درخت_رده' ], +]; /** French (français) */ -$magicWords['fr'] = array( - 'categorytree' => array( 0, 'arbrecatégories', 'arbrecats' ), -); +$magicWords['fr'] = [ + 'categorytree' => [ 0, 'arbrecatégories', 'arbrecats' ], +]; /** Western Frisian (Frysk) */ -$magicWords['fy'] = array( - 'categorytree' => array( 0, 'kategorybeam' ), -); +$magicWords['fy'] = [ + 'categorytree' => [ 0, 'kategorybeam' ], +]; /** Galician (galego) */ -$magicWords['gl'] = array( - 'categorytree' => array( 0, 'árboredecategorías' ), -); +$magicWords['gl'] = [ + 'categorytree' => [ 0, 'árboredecategorías' ], +]; /** Hebrew (עברית) */ -$magicWords['he'] = array( - 'categorytree' => array( 0, 'עץ_קטגוריה' ), -); +$magicWords['he'] = [ + 'categorytree' => [ 0, 'עץ_קטגוריה' ], +]; /** Hindi (हिन्दी) */ -$magicWords['hi'] = array( - 'categorytree' => array( 0, 'श्रेणी_वृक्ष' ), -); +$magicWords['hi'] = [ + 'categorytree' => [ 0, 'श्रेणी_वृक्ष' ], +]; /** Igbo (Igbo) */ -$magicWords['ig'] = array( - 'categorytree' => array( 0, 'óshíshíébéonọr', 'categorytree' ), -); +$magicWords['ig'] = [ + 'categorytree' => [ 0, 'óshíshíébéonọr', 'categorytree' ], +]; /** Italian (italiano) */ -$magicWords['it'] = array( - 'categorytree' => array( 0, 'alberocategorie' ), -); +$magicWords['it'] = [ + 'categorytree' => [ 0, 'alberocategorie' ], +]; /** Japanese (日本語) */ -$magicWords['ja'] = array( - 'categorytree' => array( 0, 'カテゴリツリー' ), -); +$magicWords['ja'] = [ + 'categorytree' => [ 0, 'カテゴリツリー' ], +]; /** Georgian (ქართული) */ -$magicWords['ka'] = array( - 'categorytree' => array( 0, 'კატეგორიის_ხე' ), -); +$magicWords['ka'] = [ + 'categorytree' => [ 0, 'კატეგორიის_ხე' ], +]; /** Korean (한국어) */ -$magicWords['ko'] = array( - 'categorytree' => array( 0, '분류트리' ), -); +$magicWords['ko'] = [ + 'categorytree' => [ 0, '분류트리' ], +]; /** Kurdish (Latin script) (Kurdî (latînî)‎) */ -$magicWords['ku-latn'] = array( - 'categorytree' => array( 0, 'dara_kategoriyan' ), -); +$magicWords['ku-latn'] = [ + 'categorytree' => [ 0, 'dara_kategoriyan' ], +]; /** Cornish (kernowek) */ -$magicWords['kw'] = array( - 'categorytree' => array( 0, 'gwedhenglass' ), -); +$magicWords['kw'] = [ + 'categorytree' => [ 0, 'gwedhenglass' ], +]; /** Ladino (Ladino) */ -$magicWords['lad'] = array( - 'categorytree' => array( 0, 'árvoledekateggorías', 'árboldecategorías', 'arboldecategorias', 'categorytree' ), -); +$magicWords['lad'] = [ + 'categorytree' => [ 0, 'árvoledekateggorías', 'árboldecategorías', 'arboldecategorias', 'categorytree' ], +]; /** Malagasy (Malagasy) */ -$magicWords['mg'] = array( - 'categorytree' => array( 0, 'karazantsokajy', 'categorytree' ), -); +$magicWords['mg'] = [ + 'categorytree' => [ 0, 'karazantsokajy', 'categorytree' ], +]; /** Macedonian (македонски) */ -$magicWords['mk'] = array( - 'categorytree' => array( 0, 'стеблонакатегории' ), -); +$magicWords['mk'] = [ + 'categorytree' => [ 0, 'стеблонакатегории' ], +]; /** Malayalam (മലയാളം) */ -$magicWords['ml'] = array( - 'categorytree' => array( 0, 'വർഗ്ഗവൃക്ഷം' ), -); +$magicWords['ml'] = [ + 'categorytree' => [ 0, 'വർഗ്ഗവൃക്ഷം' ], +]; /** Marathi (मराठी) */ -$magicWords['mr'] = array( - 'categorytree' => array( 0, 'वर्गवृक्ष' ), -); +$magicWords['mr'] = [ + 'categorytree' => [ 0, 'वर्गवृक्ष' ], +]; /** Norwegian Bokmål (norsk bokmål) */ -$magicWords['nb'] = array( - 'categorytree' => array( 0, 'kategoritre' ), -); +$magicWords['nb'] = [ + 'categorytree' => [ 0, 'kategoritre' ], +]; /** Low Saxon (Netherlands) (Nedersaksies) */ -$magicWords['nds-nl'] = array( - 'categorytree' => array( 0, 'kategorieboom', 'categorieboom' ), -); +$magicWords['nds-nl'] = [ + 'categorytree' => [ 0, 'kategorieboom', 'categorieboom' ], +]; /** Dutch (Nederlands) */ -$magicWords['nl'] = array( - 'categorytree' => array( 0, 'categorieboom' ), -); +$magicWords['nl'] = [ + 'categorytree' => [ 0, 'categorieboom' ], +]; /** Norwegian Nynorsk (norsk nynorsk) */ -$magicWords['nn'] = array( - 'categorytree' => array( 0, 'kategoritre' ), -); +$magicWords['nn'] = [ + 'categorytree' => [ 0, 'kategoritre' ], +]; /** Polish (polski) */ -$magicWords['pl'] = array( - 'categorytree' => array( 0, 'drzewokategorii' ), -); +$magicWords['pl'] = [ + 'categorytree' => [ 0, 'drzewokategorii' ], +]; /** Romanian (română) */ -$magicWords['ro'] = array( - 'categorytree' => array( 0, 'arborecategorie' ), -); +$magicWords['ro'] = [ + 'categorytree' => [ 0, 'arborecategorie' ], +]; /** Russian (русский) */ -$magicWords['ru'] = array( - 'categorytree' => array( 0, 'деревокатегорий' ), -); +$magicWords['ru'] = [ + 'categorytree' => [ 0, 'деревокатегорий' ], +]; /** Serbian (Cyrillic script) (српски (ћирилица)‎) */ -$magicWords['sr-ec'] = array( - 'categorytree' => array( 0, 'стаблокатегорије', 'стабло_категорије' ), -); +$magicWords['sr-ec'] = [ + 'categorytree' => [ 0, 'стаблокатегорије', 'стабло_категорије' ], +]; /** Serbian (Latin script) (srpski (latinica)‎) */ -$magicWords['sr-el'] = array( - 'categorytree' => array( 0, 'stablokategorije', 'stablo_kategorije' ), -); +$magicWords['sr-el'] = [ + 'categorytree' => [ 0, 'stablokategorije', 'stablo_kategorije' ], +]; /** Swedish (svenska) */ -$magicWords['sv'] = array( - 'categorytree' => array( 0, 'kategoriträd', 'categorytree' ), -); +$magicWords['sv'] = [ + 'categorytree' => [ 0, 'kategoriträd', 'categorytree' ], +]; /** Turkish (Türkçe) */ -$magicWords['tr'] = array( - 'categorytree' => array( 0, 'kategorihiyerarşisi', 'kategoriağacı', 'ulamhiyerarşisi', 'ulamağacı' ), -); +$magicWords['tr'] = [ + 'categorytree' => [ 0, 'kategorihiyerarşisi', 'kategoriağacı', 'ulamhiyerarşisi', 'ulamağacı' ], +]; /** Tatar (Cyrillic script) (татарча) */ -$magicWords['tt-cyrl'] = array( - 'categorytree' => array( 0, 'төркемнәр_шәҗәрәсе' ), -); +$magicWords['tt-cyrl'] = [ + 'categorytree' => [ 0, 'төркемнәр_шәҗәрәсе' ], +]; /** Tuvinian (тыва дыл) */ -$magicWords['tyv'] = array( - 'categorytree' => array( 0, 'аңгылал_ыяжы' ), -); +$magicWords['tyv'] = [ + 'categorytree' => [ 0, 'аңгылал_ыяжы' ], +]; /** Ukrainian (українська) */ -$magicWords['uk'] = array( - 'categorytree' => array( 0, 'деревокатегорій' ), -); +$magicWords['uk'] = [ + 'categorytree' => [ 0, 'деревокатегорій' ], +]; /** Urdu (اردو) */ -$magicWords['ur'] = array( - 'categorytree' => array( 0, 'شجر_زمرہ' ), -); +$magicWords['ur'] = [ + 'categorytree' => [ 0, 'شجر_زمرہ' ], +]; /** Uzbek (oʻzbekcha/ўзбекча) */ -$magicWords['uz'] = array( - 'categorytree' => array( 0, 'turkumiyerarxiyasi', 'turkumdaraxti' ), -); +$magicWords['uz'] = [ + 'categorytree' => [ 0, 'turkumiyerarxiyasi', 'turkumdaraxti' ], +]; /** Vietnamese (Tiếng Việt) */ -$magicWords['vi'] = array( - 'categorytree' => array( 0, 'cây_thể_loại', 'câythểloại' ), -); +$magicWords['vi'] = [ + 'categorytree' => [ 0, 'cây_thể_loại', 'câythểloại' ], +]; /** Yiddish (ייִדיש) */ -$magicWords['yi'] = array( - 'categorytree' => array( 0, 'קאטעגאריע_בוים' ), -); +$magicWords['yi'] = [ + 'categorytree' => [ 0, 'קאטעגאריע_בוים' ], +]; /** Simplified Chinese (中文(简体)‎) */ -$magicWords['zh-hans'] = array( - 'categorytree' => array( 0, '分类树' ), -); +$magicWords['zh-hans'] = [ + 'categorytree' => [ 0, '分类树' ], +]; /** Traditional Chinese (中文(繁體)‎) */ -$magicWords['zh-hant'] = array( - 'categorytree' => array( 0, '分類樹' ), -); \ No newline at end of file +$magicWords['zh-hant'] = [ + 'categorytree' => [ 0, '分類樹' ], +]; diff --git a/CategoryTree.i18n.php b/CategoryTree.i18n.php index d33f654b..aa51803b 100644 --- a/CategoryTree.i18n.php +++ b/CategoryTree.i18n.php @@ -10,10 +10,10 @@ * * This shim maintains compatibility back to MediaWiki 1.17. */ -$messages = array(); +$messages = []; if ( !function_exists( 'wfJsonI18nShimed9738563f370e2c' ) ) { function wfJsonI18nShimed9738563f370e2c( $cache, $code, &$cachedData ) { - $codeSequence = array_merge( array( $code ), $cachedData['fallbackSequence'] ); + $codeSequence = array_merge( [ $code ], $cachedData['fallbackSequence'] ); foreach ( $codeSequence as $csCode ) { $fileName = dirname( __FILE__ ) . "/i18n/$csCode.json"; if ( is_readable( $fileName ) ) { diff --git a/CategoryTreeFunctions.php b/CategoryTreeFunctions.php index 2f88dcc3..48c64108 100644 --- a/CategoryTreeFunctions.php +++ b/CategoryTreeFunctions.php @@ -11,7 +11,7 @@ */ class CategoryTree { - public $mOptions = array(); + public $mOptions = []; /** * @param $options array @@ -81,7 +81,7 @@ class CategoryTree { $nn = preg_split( '![\s#:|]+!', $nn ); } - $namespaces = array(); + $namespaces = []; foreach ( $nn as $n ) { if ( is_int( $n ) ) { @@ -334,7 +334,7 @@ class CategoryTree { $html .= Html::openElement( 'div', $attr ); if ( !$allowMissing && !$title->getArticleID() ) { - $html .= Html::openElement( 'span', array( 'class' => 'CategoryTreeNotice' ) ); + $html .= Html::openElement( 'span', [ 'class' => 'CategoryTreeNotice' ] ); if ( $parser ) { $html .= $parser->recursiveTagParse( wfMessage( 'categorytree-not-found', $category )->plain() ); } else { @@ -376,19 +376,19 @@ class CategoryTree { $mode = $this->getOption( 'mode' ); $namespaces = $this->getOption( 'namespaces' ); - $tables = array( 'page', 'categorylinks' ); - $fields = array( 'page_id', 'page_namespace', 'page_title', + $tables = [ 'page', 'categorylinks' ]; + $fields = [ 'page_id', 'page_namespace', 'page_title', 'page_is_redirect', 'page_len', 'page_latest', 'cl_to', - 'cl_from' ); - $where = array(); - $joins = array(); - $options = array( 'ORDER BY' => 'cl_type, cl_sortkey', 'LIMIT' => $wgCategoryTreeMaxChildren ); + 'cl_from' ]; + $where = []; + $joins = []; + $options = [ 'ORDER BY' => 'cl_type, cl_sortkey', 'LIMIT' => $wgCategoryTreeMaxChildren ]; if ( $inverse ) { - $joins['categorylinks'] = array( 'RIGHT JOIN', array( 'cl_to = page_title', 'page_namespace' => NS_CATEGORY ) ); + $joins['categorylinks'] = [ 'RIGHT JOIN', [ 'cl_to = page_title', 'page_namespace' => NS_CATEGORY ] ]; $where['cl_from'] = $title->getArticleID(); } else { - $joins['categorylinks'] = array( 'JOIN', 'cl_from = page_id' ); + $joins['categorylinks'] = [ 'JOIN', 'cl_from = page_id' ]; $where['cl_to'] = $title->getDBkey(); $options['USE INDEX']['categorylinks'] = 'cl_sortkey'; @@ -398,7 +398,7 @@ class CategoryTree { $where['page_namespace'] = $namespaces; } elseif ( $mode != CategoryTreeMode::ALL ) { if ( $mode == CategoryTreeMode::PAGES ) { - $where['cl_type'] = array( 'page', 'subcat' ); + $where['cl_type'] = [ 'page', 'subcat' ]; } else { $where['cl_type'] = 'subcat'; } @@ -409,9 +409,9 @@ class CategoryTree { $doCount = !$inverse && $wgCategoryTreeUseCategoryTable; if ( $doCount ) { - $tables = array_merge( $tables, array( 'category' ) ); - $fields = array_merge( $fields, array( 'cat_id', 'cat_title', 'cat_subcats', 'cat_pages', 'cat_files' ) ); - $joins['category'] = array( 'LEFT JOIN', array( 'cat_title = page_title', 'page_namespace' => NS_CATEGORY ) ); + $tables = array_merge( $tables, [ 'category' ] ); + $fields = array_merge( $fields, [ 'cat_id', 'cat_title', 'cat_subcats', 'cat_pages', 'cat_files' ] ); + $joins['category'] = [ 'LEFT JOIN', [ 'cat_title = page_title', 'page_namespace' => NS_CATEGORY ] ]; } $res = $dbr->select( $tables, $fields, $where, __METHOD__, $options, $joins ); @@ -461,16 +461,16 @@ class CategoryTree { $res = $dbr->select( 'categorylinks', - array( + [ 'page_namespace' => NS_CATEGORY, 'page_title' => 'cl_to', - ), - array( 'cl_from' => $title->getArticleID() ), + ], + [ 'cl_from' => $title->getArticleID() ], __METHOD__, - array( + [ 'LIMIT' => $wgCategoryTreeMaxChildren, 'ORDER BY' => 'cl_to' - ) + ] ); $special = SpecialPage::getTitleFor( 'CategoryTree' ); @@ -489,8 +489,8 @@ class CategoryTree { $s .= wfMessage( 'pipe-separator' )->escaped(); } - $s .= Xml::openElement( 'span', array( 'class' => 'CategoryTreeItem' ) ); - $s .= Xml::openElement( 'a', array( 'class' => 'CategoryTreeLabel', 'href' => $wikiLink ) ) + $s .= Xml::openElement( 'span', [ 'class' => 'CategoryTreeItem' ] ); + $s .= Xml::openElement( 'a', [ 'class' => 'CategoryTreeLabel', 'href' => $wikiLink ] ) . $label . Xml::closeElement( 'a' ); $s .= Xml::closeElement( 'span' ); @@ -578,10 +578,10 @@ class CategoryTree { # Specifically, the CategoryTreeChildren div must be the first # sibling with nodeName = DIV of the grandparent of the expland link. - $s .= Xml::openElement( 'div', array( 'class' => 'CategoryTreeSection' ) ); - $s .= Xml::openElement( 'div', array( 'class' => 'CategoryTreeItem' ) ); + $s .= Xml::openElement( 'div', [ 'class' => 'CategoryTreeSection' ] ); + $s .= Xml::openElement( 'div', [ 'class' => 'CategoryTreeItem' ] ); - $attr = array( 'class' => 'CategoryTreeBullet' ); + $attr = [ 'class' => 'CategoryTreeBullet' ]; # Get counts, with conversion to integer so === works # Note: $allCount is the total number of cat members, @@ -605,7 +605,7 @@ class CategoryTree { $bullet = wfMessage( 'categorytree-empty-bullet' )->plain() . ' '; $attr['class'] = 'CategoryTreeEmptyBullet'; } else { - $linkattr = array( ); + $linkattr = []; $linkattr[ 'class' ] = "CategoryTreeToggle"; $linkattr['style'] = 'display: none;'; // Unhidden by JS @@ -630,23 +630,23 @@ class CategoryTree { } $s .= Xml::tags( 'span', $attr, $bullet ) . ' '; - $s .= Xml::openElement( 'a', array( 'class' => $labelClass, 'href' => $wikiLink ) ) + $s .= Xml::openElement( 'a', [ 'class' => $labelClass, 'href' => $wikiLink ] ) . $label . Xml::closeElement( 'a' ); if ( $count !== false && $this->getOption( 'showcount' ) ) { $pages = $allCount - $subcatCount - $fileCount; global $wgContLang, $wgLang; - $attr = array( + $attr = [ 'title' => wfMessage( 'categorytree-member-counts' ) ->numParams( $subcatCount, $pages , $fileCount, $allCount, $count )->text(), 'dir' => $wgLang->getDir() # numbers and commas get messed up in a mixed dir env - ); + ]; $s .= $wgContLang->getDirMark() . ' '; # Create a list of category members with only non-zero member counts - $memberNums = array(); + $memberNums = []; if ( $subcatCount ) { $memberNums[] = wfMessage( 'categorytree-num-categories' ) ->numParams( $subcatCount )->text(); @@ -678,16 +678,16 @@ class CategoryTree { $s .= "\n\t\t"; $s .= Xml::openElement( 'div', - array( + [ 'class' => 'CategoryTreeChildren', 'style' => $children > 0 ? "display:block" : "display:none" - ) + ] ); if ( $ns == NS_CATEGORY && $children > 0 ) { $children = $this->renderChildren( $title, $children ); if ( $children == '' ) { - $s .= Xml::openElement( 'i', array( 'class' => 'CategoryTreeNotice' ) ); + $s .= Xml::openElement( 'i', [ 'class' => 'CategoryTreeNotice' ] ); if ( $mode == CategoryTreeMode::CATEGORIES ) { $s .= wfMessage( 'categorytree-no-subcategories' )->text(); } elseif ( $mode == CategoryTreeMode::PAGES ) { diff --git a/CategoryTreePage.php b/CategoryTreePage.php index a8be4234..c9436b22 100644 --- a/CategoryTreePage.php +++ b/CategoryTreePage.php @@ -58,7 +58,7 @@ class CategoryTreePage extends SpecialPage { $this->target = null; } - $options = array(); + $options = []; # grab all known options from the request. Normalization is done by the CategoryTree class foreach ( $wgCategoryTreeDefaultOptions as $option => $default ) { @@ -84,7 +84,7 @@ class CategoryTreePage extends SpecialPage { $title = CategoryTree::makeTitle( $this->target ); if ( $title && $title->getArticleID() ) { - $output->addHTML( Xml::openElement( 'div', array( 'class' => 'CategoryTreeParents' ) ) ); + $output->addHTML( Xml::openElement( 'div', [ 'class' => 'CategoryTreeParents' ] ) ); $output->addHTML( $this->msg( 'categorytree-parents' )->parse() ); $output->addHTML( $this->msg( 'colon-separator' )->escaped() ); @@ -98,11 +98,11 @@ class CategoryTreePage extends SpecialPage { $output->addHTML( Xml::closeElement( 'div' ) ); - $output->addHTML( Xml::openElement( 'div', array( 'class' => 'CategoryTreeResult' ) ) ); + $output->addHTML( Xml::openElement( 'div', [ 'class' => 'CategoryTreeResult' ] ) ); $output->addHTML( $this->tree->renderNode( $title, 1 ) ); $output->addHTML( Xml::closeElement( 'div' ) ); } else { - $output->addHTML( Xml::openElement( 'div', array( 'class' => 'CategoryTreeNotice' ) ) ); + $output->addHTML( Xml::openElement( 'div', [ 'class' => 'CategoryTreeNotice' ] ) ); $output->addHTML( $this->msg( 'categorytree-not-found', $this->target )->parse() ); $output->addHTML( Xml::closeElement( 'div' ) ); } @@ -178,11 +178,11 @@ class CategoryTreePage extends SpecialPage { } if ( !$title ) { // No prefix suggestion outside of category namespace - return array(); + return []; } // Autocomplete subpage the same as a normal search, but just for categories $prefixSearcher = new TitlePrefixSearch; - $result = $prefixSearcher->search( $title->getPrefixedText(), $limit, array( NS_CATEGORY ), $offset ); + $result = $prefixSearcher->search( $title->getPrefixedText(), $limit, [ NS_CATEGORY ], $offset ); return array_map( function ( Title $t ) { // Remove namespace in search suggestion