Index: branches/wmf/1.16wmf4/extensions/CategoryTree/CategoryPageSubclass.php |
— | — | @@ -3,6 +3,7 @@ |
4 | 4 | class CategoryTreeCategoryPage extends CategoryPage { |
5 | 5 | function closeShowCategory() { |
6 | 6 | global $wgOut, $wgRequest; |
| 7 | + |
7 | 8 | $from = $wgRequest->getVal( 'from' ); |
8 | 9 | $until = $wgRequest->getVal( 'until' ); |
9 | 10 | |
— | — | @@ -17,7 +18,7 @@ |
18 | 19 | function getCategoryTree() { |
19 | 20 | global $wgOut, $wgCategoryTreeCategoryPageOptions, $wgCategoryTreeForceHeaders; |
20 | 21 | |
21 | | - if ( ! isset($this->categorytree) ) { |
| 22 | + if ( ! isset( $this->categorytree ) ) { |
22 | 23 | if ( !$wgCategoryTreeForceHeaders ) CategoryTree::setHeaders( $wgOut ); |
23 | 24 | |
24 | 25 | $this->categorytree = new CategoryTree( $wgCategoryTreeCategoryPageOptions ); |
— | — | @@ -38,11 +39,6 @@ |
39 | 40 | return parent::addSubcategoryObject( $cat, $sortkey, $pageLength ); |
40 | 41 | } |
41 | 42 | |
42 | | - /*if ( ! $GLOBALS['wgCategoryTreeUnifiedView'] ) { |
43 | | - $this->child_cats[] = $cat; |
44 | | - return parent::addSubcategory( $cat, $sortkey, $pageLength ); |
45 | | - }*/ |
46 | | - |
47 | 43 | $tree = $this->getCategoryTree(); |
48 | 44 | |
49 | 45 | $this->children[] = $tree->renderNodeInfo( $title, $cat ); |
— | — | @@ -56,7 +52,7 @@ |
57 | 53 | } |
58 | 54 | |
59 | 55 | function finaliseCategoryState() { |
60 | | - if( $this->flip ) { |
| 56 | + if ( $this->flip ) { |
61 | 57 | $this->child_cats = array_reverse( $this->child_cats ); |
62 | 58 | } |
63 | 59 | parent::finaliseCategoryState(); |
Index: branches/wmf/1.16wmf4/extensions/CategoryTree/CategoryTree.i18n.magic.php |
— | — | @@ -30,6 +30,10 @@ |
31 | 31 | 'categorytree' => array( '0', 'GwezennadurRummad', 'categorytree' ), |
32 | 32 | ); |
33 | 33 | |
| 34 | +$magicWords['eo'] = array( |
| 35 | + 'categorytree' => array( '0', 'kategoriarbo', 'categorytree' ), |
| 36 | +); |
| 37 | + |
34 | 38 | $magicWords['es'] = array( |
35 | 39 | 'categorytree' => array( '0', 'árboldecategorías', 'arboldecategorias', 'categorytree' ), |
36 | 40 | ); |
— | — | @@ -38,6 +42,10 @@ |
39 | 43 | 'categorytree' => array( '0', 'kategooriapuu', 'categorytree' ), |
40 | 44 | ); |
41 | 45 | |
| 46 | +$magicWords['ja'] = array( |
| 47 | + 'categorytree' => array( '0', 'カテゴリツリー', 'categorytree' ), |
| 48 | +); |
| 49 | + |
42 | 50 | $magicWords['ko'] = array( |
43 | 51 | 'categorytree' => array( '0', '분류트리', 'categorytree' ), |
44 | 52 | ); |
Index: branches/wmf/1.16wmf4/extensions/CategoryTree/CategoryTreePage.php |
— | — | @@ -9,13 +9,12 @@ |
10 | 10 | * @license GNU General Public Licence 2.0 or later |
11 | 11 | */ |
12 | 12 | |
13 | | -if( !defined( 'MEDIAWIKI' ) ) { |
| 13 | +if ( !defined( 'MEDIAWIKI' ) ) { |
14 | 14 | echo( "This file is part of an extension to the MediaWiki software and cannot be used standalone.\n" ); |
15 | 15 | die( 1 ); |
16 | 16 | } |
17 | 17 | |
18 | 18 | class CategoryTreePage extends SpecialPage { |
19 | | - |
20 | 19 | var $target = ''; |
21 | 20 | var $tree = null; |
22 | 21 | |
— | — | @@ -45,11 +44,11 @@ |
46 | 45 | $this->setHeaders(); |
47 | 46 | |
48 | 47 | if ( $par ) $this->target = $par; |
49 | | - else $this->target = $wgRequest->getVal( 'target', wfMsg( 'rootcategory') ); |
| 48 | + else $this->target = $wgRequest->getVal( 'target', wfMsg( 'rootcategory' ) ); |
50 | 49 | |
51 | 50 | $this->target = trim( $this->target ); |
52 | 51 | |
53 | | - #HACK for undefined root category |
| 52 | + # HACK for undefined root category |
54 | 53 | if ( $this->target == '<rootcategory>' || $this->target == '<rootcategory>' ) $this->target = null; |
55 | 54 | |
56 | 55 | $options = array(); |
— | — | @@ -68,7 +67,7 @@ |
69 | 68 | |
70 | 69 | $this->executeInputForm(); |
71 | 70 | |
72 | | - if( $this->target !== '' && $this->target !== null ) { |
| 71 | + if ( $this->target !== '' && $this->target !== null ) { |
73 | 72 | if ( !$wgCategoryTreeForceHeaders ) CategoryTree::setHeaders( $wgOut ); |
74 | 73 | |
75 | 74 | $title = CategoryTree::makeTitle( $this->target ); |
— | — | @@ -98,7 +97,6 @@ |
99 | 98 | $wgOut->addHTML( Xml::closeElement( 'div' ) ); |
100 | 99 | } |
101 | 100 | } |
102 | | - |
103 | 101 | } |
104 | 102 | |
105 | 103 | /** |
— | — | @@ -107,7 +105,7 @@ |
108 | 106 | function executeInputForm() { |
109 | 107 | global $wgScript, $wgOut; |
110 | 108 | $thisTitle = Title::makeTitle( NS_SPECIAL, $this->getName() ); |
111 | | - $mode = $this->getOption('mode'); |
| 109 | + $mode = $this->getOption( 'mode' ); |
112 | 110 | |
113 | 111 | $wgOut->addHTML( Xml::openElement( 'form', array( 'name' => 'categorytree', 'method' => 'get', 'action' => $wgScript, 'id' => 'mw-categorytree-form' ) ) ); |
114 | 112 | $wgOut->addHTML( Xml::openElement( 'fieldset' ) ); |
Index: branches/wmf/1.16wmf4/extensions/CategoryTree/CategoryTree.i18n.php |
— | — | @@ -82,12 +82,12 @@ |
83 | 83 | {{Identical|All pages}}', |
84 | 84 | 'categorytree-collapse' => 'Tooltip for the "collapse" button', |
85 | 85 | 'categorytree-expand' => 'Tooltip for the "expand" button', |
86 | | - 'categorytree-member-counts' => 'Tooltip showing a detailed summary of subcategory member counts. Parameters: |
87 | | -* $1 = number of subcategories, |
88 | | -* $2 = number of pages (without subcategories and files), |
89 | | -* $3 = number of files, |
90 | | -* $4 = total number of members, |
91 | | -* $5 = members to be shown in the tree, depending on mode. |
| 86 | + 'categorytree-member-counts' => 'Tooltip showing a detailed summary of subcategory member counts. Parameters: |
| 87 | +* $1 = number of subcategories, |
| 88 | +* $2 = number of pages (without subcategories and files), |
| 89 | +* $3 = number of files, |
| 90 | +* $4 = total number of members, |
| 91 | +* $5 = members to be shown in the tree, depending on mode. |
92 | 92 | Use with { {PLURAL} }', |
93 | 93 | 'categorytree-load' => '{{Identical|Load}} |
94 | 94 | |
— | — | @@ -143,7 +143,7 @@ |
144 | 144 | 'categorytree' => 'የመደቦች ዛፍ', |
145 | 145 | 'categorytree-portlet' => 'መደቦች', |
146 | 146 | 'categorytree-legend' => 'የመደቦች ዛፍ ለማየት', |
147 | | - 'categorytree-header' => "[+] ተጭነው ንዑሱ-መደብ ይዘረጋል፣ [-] ተጭነው ደግሞ ይመልሳል። |
| 147 | + 'categorytree-header' => "[+] ተጭነው ንዑሱ-መደብ ይዘረጋል፣ [-] ተጭነው ደግሞ ይመልሳል። |
148 | 148 | |
149 | 149 | በግራ በኩል ባለው ሳጥን ውስጥ የመደቡን ስም ዝም ብለው መጻፍ ይችላሉ። (የዚሁ ዊኪ መደብ ስሞች ለመመልከት፣ [[Special:Mostlinkedcategories|እዚህ ይጫኑ]]።) ከዚያ፥ ምን ያሕል ንዑስ-መደቦች እንዳሉበት ለማየት «ዛፉ ይታይ» የሚለውን ይጫኑ። በቀኝ በኩል ካለው ሳጥን 'all pages' ከመረጡ፥ በየመደቡ ውስጥ ያሉት መጣጥፎች በተጨማሪ ይታያሉ። |
150 | 150 | |
— | — | @@ -516,7 +516,7 @@ |
517 | 517 | 'categorytree-portlet' => 'Rummadoù', |
518 | 518 | 'categorytree-legend' => 'Gwelet gwezennadur ar rummad', |
519 | 519 | 'categorytree-desc' => 'Furchal a ra ent dinamek [[Special:CategoryTree|framm ar rummadoù]]', |
520 | | - 'categorytree-header' => "Merkit anv ur rummad evit gwelet petra zo ennañ e stumm ur gwezennadur. |
| 520 | + 'categorytree-header' => "Merkit anv ur rummad evit gwelet petra zo ennañ e stumm ur gwezennadur. |
521 | 521 | Notit e rankit kaout an arc'hwelioù JavaScript araokaet anvet AJAX. |
522 | 522 | M'eo kozh-mat stumm ho merdeer pe m'eo diweredekaet JavaScript ganeoc'h, ne'z aio ket en-dro.", |
523 | 523 | 'categorytree-category' => 'Rummad :', |
— | — | @@ -693,8 +693,8 @@ |
694 | 694 | 'categorytree-portlet' => 'Categorïau', |
695 | 695 | 'categorytree-legend' => 'Dangos y goeden gategori', |
696 | 696 | 'categorytree-desc' => "Teclyn AJAX yn arddangos [[Special:CategoryTree|adeiledd categorïau]]'r wici", |
697 | | - 'categorytree-header' => "Teipiwch enw categori yn y blwch er mwyn gweld ei gynnwys ar lun coeden. |
698 | | -Sylwer bod yn rhaid defnyddio offer uwch Sgript Java o'r enw AJAX er mwyn gwneud hyn. |
| 697 | + 'categorytree-header' => "Teipiwch enw categori yn y blwch er mwyn gweld ei gynnwys ar lun coeden. |
| 698 | +Sylwer bod yn rhaid defnyddio offer uwch Sgript Java o'r enw AJAX er mwyn gwneud hyn. |
699 | 699 | Ni lwydda'r gofyniad os yw'ch porwr yn hen iawn neu os nad yw Sgript Java wedi ei alluogi.", |
700 | 700 | 'categorytree-category' => 'Categori:', |
701 | 701 | 'categorytree-go' => 'Dangos y Goeden', |
— | — | @@ -1034,6 +1034,7 @@ |
1035 | 1035 | ); |
1036 | 1036 | |
1037 | 1037 | /** Persian (فارسی) |
| 1038 | + * @author Ebraminio |
1038 | 1039 | * @author Huji |
1039 | 1040 | */ |
1040 | 1041 | $messages['fa'] = array( |
— | — | @@ -1057,9 +1058,9 @@ |
1058 | 1059 | 'categorytree-no-subcategories' => 'هیچ زیرردهای ندارد.', |
1059 | 1060 | 'categorytree-no-parent-categories' => 'فاقد ردهٔ بالاتر', |
1060 | 1061 | 'categorytree-no-pages' => 'هیچ صفحه یا زیرردهای ندارد.', |
1061 | | - 'categorytree-not-found' => "ردهٔ ''$1'' يافت نشد.", |
| 1062 | + 'categorytree-not-found' => 'ردهٔ <i>$1</i> يافت نشد', |
1062 | 1063 | 'categorytree-error' => 'اشکال در دریافت اطلاعات.', |
1063 | | - 'categorytree-retry' => 'لطفاً چند لحظه صبر کنید و سپس دوباره امتحان کنید.', |
| 1064 | + 'categorytree-retry' => 'لطفاً دمی درنگ کنید و باز امتحان کنید.', |
1064 | 1065 | ); |
1065 | 1066 | |
1066 | 1067 | /** Finnish (Suomi) |
— | — | @@ -1867,6 +1868,7 @@ |
1868 | 1869 | ); |
1869 | 1870 | |
1870 | 1871 | /** Georgian (ქართული) |
| 1872 | + * @author BRUTE |
1871 | 1873 | * @author Malafaya |
1872 | 1874 | */ |
1873 | 1875 | $messages['ka'] = array( |
— | — | @@ -1875,10 +1877,15 @@ |
1876 | 1878 | 'categorytree-legend' => 'კატეგორიების სქემის ჩვენება', |
1877 | 1879 | 'categorytree-category' => 'კატეგორია:', |
1878 | 1880 | 'categorytree-go' => 'სქემის ჩვენება', |
| 1881 | + 'categorytree-parents' => 'მშობლები', |
1879 | 1882 | 'categorytree-mode-categories' => 'მხოლოდ კატეგორიები', |
1880 | 1883 | 'categorytree-mode-pages' => 'გვერდები ფაილების გარდა', |
1881 | 1884 | 'categorytree-mode-all' => 'ყველა გვერდი', |
| 1885 | + 'categorytree-member-counts' => 'შეიცავს {{PLURAL:$1|1 ქვეკატეგორიას|$1 ქვეკატეგორიას}}, {{PLURAL:$2|1 გვერდს|$2 გვერდს}}, და {{PLURAL:$3|1 ფაილს|$3 ფაილს}}', |
| 1886 | + 'categorytree-loading' => 'იტვირთება…', |
| 1887 | + 'categorytree-no-subcategories' => 'ქვეკატეგორიები არ არის', |
1882 | 1888 | 'categorytree-not-found' => 'კატეგორია <i>$1</i> არ არსებობს', |
| 1889 | + 'categorytree-retry' => 'გთხოვთ, დაიცადეთ ცოტა ხნით და კვლავ სცადეთ.', |
1883 | 1890 | ); |
1884 | 1891 | |
1885 | 1892 | /** Kara-Kalpak (Qaraqalpaqsha) |
— | — | @@ -2032,6 +2039,13 @@ |
2033 | 2040 | 'categorytree-retry' => '잠시 후에 다시 시도해주세요.', |
2034 | 2041 | ); |
2035 | 2042 | |
| 2043 | +/** Karachay-Balkar (Къарачай-Малкъар) |
| 2044 | + * @author Iltever |
| 2045 | + */ |
| 2046 | +$messages['krc'] = array( |
| 2047 | + 'categorytree-legend' => 'Категорияланы терегин кёргюз', |
| 2048 | +); |
| 2049 | + |
2036 | 2050 | /** Kinaray-a (Kinaray-a) |
2037 | 2051 | * @author Jose77 |
2038 | 2052 | */ |
— | — | @@ -2039,7 +2053,7 @@ |
2040 | 2054 | 'categorytree-category' => 'Kategorya:', |
2041 | 2055 | ); |
2042 | 2056 | |
2043 | | -/** Ripoarisch (Ripoarisch) |
| 2057 | +/** Colognian (Ripoarisch) |
2044 | 2058 | * @author Purodha |
2045 | 2059 | */ |
2046 | 2060 | $messages['ksh'] = array( |
— | — | @@ -2081,7 +2095,7 @@ |
2082 | 2096 | 'categorytree-not-found' => 'Kategoriya <i>$1</i> nehate dîtin', |
2083 | 2097 | ); |
2084 | 2098 | |
2085 | | -/** Cornish (Kernowek) |
| 2099 | +/** Cornish (Kernewek) |
2086 | 2100 | * @author Kernoweger |
2087 | 2101 | * @author Kw-Moon |
2088 | 2102 | */ |
— | — | @@ -2134,7 +2148,7 @@ |
2135 | 2149 | 'categorytree-legend' => 'Weis Kategoriestruktur', |
2136 | 2150 | 'categorytree-desc' => "Gadget deen op Ajax opgebaut ass fir d'[[Special:CategoryTree|Kategorie-Struktur]] vun enger Wiki duerzestellen", |
2137 | 2151 | 'categorytree-header' => 'Gitt den Numm vun enger Kategorie an, fir hiren Inhalt als Bam-Struktur ze gesinn. |
2138 | | -Bedenkt, datt dës Fonctioun Java Script Funktioune benotzt, déi als AJAX bekannt sinn. |
| 2152 | +Bedenkt, datt dës Fonctioun Java Script Funktioune benotzt, déi als AJAX bekannt sinn. |
2139 | 2153 | Wann Dir ee ganz ale Browser hutt, oder wann Dir JavaScript ausgeschalt hutt, da fonktionnéiert dëst bei Iech net.', |
2140 | 2154 | 'categorytree-category' => 'Kategorie:', |
2141 | 2155 | 'categorytree-go' => 'Struktur weisen', |
— | — | @@ -2281,6 +2295,19 @@ |
2282 | 2296 | 'categorytree-retry' => 'Palaukite šiek tiek, ir bandykite iš naujo.', |
2283 | 2297 | ); |
2284 | 2298 | |
| 2299 | +/** Latgalian (Latgaļu) |
| 2300 | + * @author Dark Eagle |
| 2301 | + */ |
| 2302 | +$messages['ltg'] = array( |
| 2303 | + 'categorytree' => 'Kategoreju kūks', |
| 2304 | + 'categorytree-portlet' => 'Kategorejis', |
| 2305 | + 'categorytree-legend' => 'Paruodeit kategoreju kūku', |
| 2306 | + 'categorytree-category' => 'Kategoreja:', |
| 2307 | + 'categorytree-go' => 'Paruodeit kūku', |
| 2308 | + 'categorytree-mode-categories' => 'kategorejis viņ', |
| 2309 | + 'categorytree-mode-all' => 'vysys puslopys', |
| 2310 | +); |
| 2311 | + |
2285 | 2312 | /** Latvian (Latviešu) |
2286 | 2313 | * @author Xil |
2287 | 2314 | * @author Yyy |
— | — | @@ -2290,8 +2317,8 @@ |
2291 | 2318 | 'categorytree-portlet' => 'Kategorijas', |
2292 | 2319 | 'categorytree-legend' => 'Rādīt kategoriju koku', |
2293 | 2320 | 'categorytree-desc' => "AJAX bāzēts ''gadget'', kuru lieto lai attēlotu wiki [[Special:CategoryTree|kategoriju struktūru]]", |
2294 | | - 'categorytree-header' => 'Ievadi kategorijas nosaukumu lai apskatītos tās saturu kā koka struktūru. |
2295 | | -Tam ir nepieciešama JavaScript (AJAX) funkcionalitāte. |
| 2321 | + 'categorytree-header' => 'Ievadi kategorijas nosaukumu lai apskatītos tās saturu kā koka struktūru. |
| 2322 | +Tam ir nepieciešama JavaScript (AJAX) funkcionalitāte. |
2296 | 2323 | Ja tev ir veca interneta pārlūkprogramma, vai arī JavaScript ir atslēgts, šitas te nedarbosies.', |
2297 | 2324 | 'categorytree-category' => 'Kategorija:', |
2298 | 2325 | 'categorytree-go' => 'Parādīt koku', |
— | — | @@ -2340,7 +2367,7 @@ |
2341 | 2368 | 'categorytree-nothing-found' => 'не е најдено ништо', |
2342 | 2369 | 'categorytree-no-subcategories' => 'нема поткатегории', |
2343 | 2370 | 'categorytree-no-parent-categories' => 'нема родителски категории', |
2344 | | - 'categorytree-no-pages' => 'нема страници или поткатегории', |
| 2371 | + 'categorytree-no-pages' => 'нема страници или подкатегории', |
2345 | 2372 | 'categorytree-not-found' => 'Не е пронајдена категорија <i>$1</i>', |
2346 | 2373 | 'categorytree-error' => 'Проблеми со вчитување на податоците.', |
2347 | 2374 | 'categorytree-retry' => 'Ве молиме почекајте неколку моменти и обидетесе повторно.', |
— | — | @@ -2351,17 +2378,17 @@ |
2352 | 2379 | * @author Shijualex |
2353 | 2380 | */ |
2354 | 2381 | $messages['ml'] = array( |
2355 | | - 'categorytree' => 'വര്ഗ്ഗവൃക്ഷം', |
| 2382 | + 'categorytree' => 'വർഗ്ഗവൃക്ഷം', |
2356 | 2383 | 'categorytree-portlet' => 'വർഗ്ഗങ്ങൾ', |
2357 | | - 'categorytree-legend' => 'വര്ഗ്ഗവൃക്ഷം പ്രദര്ശിപ്പിക്കുക', |
2358 | | - 'categorytree-desc' => 'വിക്കിയിലെ [[Special:CategoryTree|വർഗ്ഗങ്ങളുടെ ഘടന]] പ്രദര്ശിപ്പിക്കുവാനുള്ള AJAX സാങ്കേതികവിദ്യ ഉപയോഗിക്കുന്ന ഗാഡ്ജറ്റ്.', |
2359 | | - 'categorytree-header' => 'വർഗ്ഗങ്ങളുടെ ഘടന വ്യക്ഷരൂപത്തില് കാണുവാന് ഒരു വർഗ്ഗത്തിന്റെ പേരു ചേര്ക്കുക. |
2360 | | -ഇതു പ്രവര്ത്തിക്കണമെങ്കില് AJAX എന്ന ചുരുക്കനാമത്തിലറിയപ്പെടുന്ന അഡ്വാന്സ്ഡ് ജാവാസ്ക്രിപ്റ്റ് സാങ്കേതികവിദ്യ ആവശ്യമാണ്. |
2361 | | -താങ്കളുടെ ബ്രൗസറില് ജാവാസ്ക്രിപ്റ്റ് പ്രവര്ത്തനരഹിതമാക്കിയതാണെങ്കിലോ അല്ലെങ്കില് ബ്രൗസര് കാലഹരണപ്പെട്ടതാണെങ്കിലോ ഇതു പ്രവര്ത്തിക്കില്ല.', |
2362 | | - 'categorytree-category' => 'വര്ഗ്ഗം:', |
2363 | | - 'categorytree-go' => 'വൃക്ഷം പ്രദര്ശിപ്പിക്കുക', |
| 2384 | + 'categorytree-legend' => 'വർഗ്ഗവൃക്ഷം പ്രദർശിപ്പിക്കുക', |
| 2385 | + 'categorytree-desc' => 'വിക്കിയിലെ [[Special:CategoryTree|വർഗ്ഗങ്ങളുടെ ഘടന]] പ്രദർശിപ്പിക്കുവാനുള്ള AJAX സാങ്കേതികവിദ്യ ഉപയോഗിക്കുന്ന ഗാഡ്ജറ്റ്.', |
| 2386 | + 'categorytree-header' => 'വർഗ്ഗങ്ങളുടെ ഘടന വ്യക്ഷരൂപത്തിൽ കാണുവാൻ ഒരു വർഗ്ഗത്തിന്റെ പേരു ചേർക്കുക. |
| 2387 | +ഇതു പ്രവർത്തിക്കണമെങ്കിൽ AJAX എന്ന ചുരുക്കനാമത്തിലറിയപ്പെടുന്ന അഡ്വാൻസ്ഡ് ജാവാസ്ക്രിപ്റ്റ് സാങ്കേതികവിദ്യ ആവശ്യമാണ്. |
| 2388 | +താങ്കളുടെ ബ്രൗസറിൽ ജാവാസ്ക്രിപ്റ്റ് പ്രവർത്തനരഹിതമാക്കിയതാണെങ്കിലോ അല്ലെങ്കിൽ ബ്രൗസർ കാലഹരണപ്പെട്ടതാണെങ്കിലോ ഇതു പ്രവർത്തിക്കില്ല.', |
| 2389 | + 'categorytree-category' => 'വർഗ്ഗം:', |
| 2390 | + 'categorytree-go' => 'വൃക്ഷം പ്രദർശിപ്പിക്കുക', |
2364 | 2391 | 'categorytree-parents' => 'താവഴി', |
2365 | | - 'categorytree-mode-categories' => 'വർഗ്ഗങ്ങള് മാത്രം', |
| 2392 | + 'categorytree-mode-categories' => 'വർഗ്ഗങ്ങൾ മാത്രം', |
2366 | 2393 | 'categorytree-mode-pages' => 'പ്രമാണങ്ങൾ അല്ലാതെയുള്ള താളുകൾ', |
2367 | 2394 | 'categorytree-mode-all' => 'എല്ലാ താളുകളും', |
2368 | 2395 | 'categorytree-collapse' => 'അടയ്ക്കുക', |
— | — | @@ -2373,8 +2400,8 @@ |
2374 | 2401 | 'categorytree-no-subcategories' => 'ഉപവർഗ്ഗങ്ങളില്ല', |
2375 | 2402 | 'categorytree-no-parent-categories' => 'മാതൃവർഗ്ഗങ്ങൾ ഇല്ല', |
2376 | 2403 | 'categorytree-no-pages' => 'താളുകളോ ഉപവർഗ്ഗങ്ങളോ ഇല്ല', |
2377 | | - 'categorytree-not-found' => "''$1'' എന്ന വര്ഗ്ഗം കണ്ടില്ല", |
2378 | | - 'categorytree-error' => 'ഡാറ്റ ലോഡ് ചെയ്യുന്നതില് പിഴവ്.', |
| 2404 | + 'categorytree-not-found' => "''$1'' എന്ന വർഗ്ഗം കണ്ടില്ല", |
| 2405 | + 'categorytree-error' => 'ഡാറ്റ ലോഡ് ചെയ്യുന്നതിൽ പിഴവ്.', |
2379 | 2406 | 'categorytree-retry' => 'കുറച്ചു നേരം കഴിഞ്ഞ് വീണ്ടും പരിശ്രമിക്കുക', |
2380 | 2407 | ); |
2381 | 2408 | |
— | — | @@ -2544,8 +2571,8 @@ |
2545 | 2572 | 'categorytree-portlet' => 'Kattegerieën', |
2546 | 2573 | 'categorytree-legend' => 'Laot kattegerieboom zien', |
2547 | 2574 | 'categorytree-desc' => 'Dynamische navigasie veur de [[Special:CategoryTree|kattegeriestructuur]]', |
2548 | | - 'categorytree-header' => 'Voer een kattegerienaam in um de inhoud in boomstructuur te bekieken. |
2549 | | -NB: Veur disse functie he-j de [[JavaScript]]functionaliteit, AJAX neudig. A-j een hele ouwe webkieker hemmen, of je JavaScript uut-eschakeld hemmen, dan zal disse functie neet warken.', |
| 2575 | + 'categorytree-header' => 'Voer een kattegerienaam in um de inhoud in boomstructuur te bekieken. |
| 2576 | +NB: Veur disse functie he-j de JavaScript-functionaliteit, AJAX neudig. A-j een hele ouwe webkieker hemmen, of je JavaScript uut-eschakeld hemmen, dan zal disse functie neet warken.', |
2550 | 2577 | 'categorytree-category' => 'Kattegerie:', |
2551 | 2578 | 'categorytree-go' => 'Laojen', |
2552 | 2579 | 'categorytree-parents' => 'Ouwerkattegerieën', |
— | — | @@ -2893,7 +2920,7 @@ |
2894 | 2921 | 'categorytree-desc' => "Acessório ''(gadget)'' baseado em AJAX que apresenta a [[Special:CategoryTree|estrutura]] de uma wiki", |
2895 | 2922 | 'categorytree-header' => 'Introduza o nome de uma categoria para ver o seu conteúdo numa estrutura de árvore. |
2896 | 2923 | Note que isto requer uma funcionalidade avançada do JavaScript, conhecida por AJAX. |
2897 | | -Caso o seu navegador seja razoavelmente antigo ou o JavaScript esteja desactivado, não funcionará.', |
| 2924 | +Caso o seu browser seja razoavelmente antigo ou o JavaScript esteja desactivado, não funcionará.', |
2898 | 2925 | 'categorytree-category' => 'Categoria:', |
2899 | 2926 | 'categorytree-go' => 'Mostrar árvore', |
2900 | 2927 | 'categorytree-parents' => 'Categorias superiores', |
— | — | @@ -2985,16 +3012,16 @@ |
2986 | 3013 | 'categorytree-portlet' => 'Categorii', |
2987 | 3014 | 'categorytree-legend' => 'Arată arborele categoriilor', |
2988 | 3015 | 'categorytree-desc' => 'Navighează dinamic în [[Special:CategoryTree|stuctura categoriilor]]', |
2989 | | - 'categorytree-header' => 'Introduceţi numele categoriei pentru vizualizarea conţinutului în structură arborescentă. Notaţi faptul că această operaţie necesită funcţionalităţi JavaScript avansate cunoscute sub numele de AJAX. Dacă aveţi un browser vechi sau nu aveţi activat JavaScript, nu va funcţiona.', |
| 3016 | + 'categorytree-header' => 'Introduceți numele categoriei pentru vizualizarea conținutului în structură arborescentă. Notați faptul că această operație necesită funcționalități JavaScript avansate cunoscute sub numele de AJAX. Dacă aveți un browser vechi sau nu aveți activat JavaScript, nu va funcționa.', |
2990 | 3017 | 'categorytree-category' => 'Categorie:', |
2991 | 3018 | 'categorytree-go' => 'Arată arborele', |
2992 | | - 'categorytree-parents' => 'Părinţi', |
| 3019 | + 'categorytree-parents' => 'Părinți', |
2993 | 3020 | 'categorytree-mode-categories' => 'doar categorii', |
2994 | 3021 | 'categorytree-mode-pages' => 'pagini fără imagini', |
2995 | 3022 | 'categorytree-mode-all' => 'toate paginile', |
2996 | 3023 | 'categorytree-collapse' => 'restrânge', |
2997 | 3024 | 'categorytree-expand' => 'extinde', |
2998 | | - 'categorytree-member-counts' => 'conţine {{PLURAL:$1|1 subcategorie|$1 subcategorii}}, {{PLURAL:$2|1 pagină|$2 pagini}} şi {{PLURAL:$3|1 fişier|$3 fişiere}}', |
| 3025 | + 'categorytree-member-counts' => 'conține {{PLURAL:$1|1 subcategorie|$1 subcategorii}}, {{PLURAL:$2|1 pagină|$2 pagini}} și {{PLURAL:$3|1 fișier|$3 fișiere}}', |
2999 | 3026 | 'categorytree-load' => 'încarcă', |
3000 | 3027 | 'categorytree-loading' => 'încărcare…', |
3001 | 3028 | 'categorytree-nothing-found' => 'fără subcategorii', |
— | — | @@ -3003,7 +3030,7 @@ |
3004 | 3031 | 'categorytree-no-pages' => 'nici o pagină sau subcategorie', |
3005 | 3032 | 'categorytree-not-found' => 'Categoria <i>$1</i> nu a fost găsită', |
3006 | 3033 | 'categorytree-error' => 'Problemă la încărcarea datelor', |
3007 | | - 'categorytree-retry' => 'Vă rugăm să aşteptaţi câteva momente şi să încercaţi din nou.', |
| 3034 | + 'categorytree-retry' => 'Vă rugăm să așteptați câteva momente și să încercați din nou.', |
3008 | 3035 | ); |
3009 | 3036 | |
3010 | 3037 | /** Tarandíne (Tarandíne) |
— | — | @@ -3226,6 +3253,7 @@ |
3227 | 3254 | ); |
3228 | 3255 | |
3229 | 3256 | /** Slovenian (Slovenščina) |
| 3257 | + * @author Dbc334 |
3230 | 3258 | * @author Freakolowsky |
3231 | 3259 | * @author editors of sl.wikipedia |
3232 | 3260 | */ |
— | — | @@ -3234,7 +3262,7 @@ |
3235 | 3263 | 'categorytree-portlet' => 'Kategorije', |
3236 | 3264 | 'categorytree-legend' => 'Prikaži drevo kategorij', |
3237 | 3265 | 'categorytree-desc' => 'Dinamično navigiraj po [[Special:CategoryTree|strukturi kategorij]]', |
3238 | | - 'categorytree-header' => 'Vnesite ime kategorije, katere vsebino želite videti kot drevesno strukturo. Upoštevajte, da je za to potreben AJAX, poseben nacin za delovanje JavaScripta. Ce je vaš brskalnik zelo star oziroma je JavaScript v njem onemogocen, drevo kategorij ne bo prikazano.', |
| 3266 | + 'categorytree-header' => 'Vnesite ime kategorije, katere vsebino želite videti kot drevesno strukturo. Upoštevajte, da je za to potreben Ajax, poseben način za delovanje JavaScripta. Ce je vaš brskalnik zelo star oziroma je JavaScript v njem onemogocen, drevo kategorij ne bo prikazano.', |
3239 | 3267 | 'categorytree-category' => 'Kategorija', |
3240 | 3268 | 'categorytree-go' => 'Pokaži drevo', |
3241 | 3269 | 'categorytree-parents' => 'Starši', |
— | — | @@ -3243,15 +3271,15 @@ |
3244 | 3272 | 'categorytree-mode-all' => 'vse strani', |
3245 | 3273 | 'categorytree-collapse' => 'skrci', |
3246 | 3274 | 'categorytree-expand' => 'razširi', |
3247 | | - 'categorytree-member-counts' => 'vsebuje {{PLURAL:$1|1 podkategorijo|2 podkategoriji|$1 podkategorije|$1 podkategorij}} {{PLURAL:$2|1 stran|2 strani|$2 strani}} in {{PLURAL:$3|1 datoteka|2 datoteki|$3 datoteke|$3 datotek}}', |
| 3275 | + 'categorytree-member-counts' => 'vsebuje $1 {{PLURAL:$1|podkategorijo|podkategoriji|podkategorije|podkategorij}}, $2 {{PLURAL:$2|stran|strani|strani}} in $3 {{PLURAL:$3|datoteko|datoteki|datoteke|datotek}}', |
3248 | 3276 | 'categorytree-load' => 'naloži', |
3249 | 3277 | 'categorytree-loading' => 'nalagam', |
3250 | 3278 | 'categorytree-nothing-found' => 'ni zadetkov', |
3251 | 3279 | 'categorytree-no-subcategories' => 'ni podkategorij', |
3252 | | - 'categorytree-no-parent-categories' => 'ni matičnih kategorij', |
| 3280 | + 'categorytree-no-parent-categories' => 'ni starševskih kategorij', |
3253 | 3281 | 'categorytree-no-pages' => 'ni strani ali podkategorij', |
3254 | | - 'categorytree-not-found' => 'Kategorije <i>$1</i> ni moc najti', |
3255 | | - 'categorytree-error' => 'Problem pri nalaganju podatkov', |
| 3282 | + 'categorytree-not-found' => 'Kategorije <i>$1</i> ni moč najti', |
| 3283 | + 'categorytree-error' => 'Težava pri nalaganju podatkov.', |
3256 | 3284 | 'categorytree-retry' => 'Prosimo, počakajte trenutek in poskusite znova.', |
3257 | 3285 | ); |
3258 | 3286 | |
— | — | @@ -3642,8 +3670,8 @@ |
3643 | 3671 | 'categorytree-portlet' => 'Kategoriýalar', |
3644 | 3672 | 'categorytree-legend' => 'Kategoriýa agajyny görkez', |
3645 | 3673 | 'categorytree-desc' => '[[Special:CategoryTree|Kategoriýa gurluşyny]] dinamik ýagdaýda dolandyr', |
3646 | | - 'categorytree-header' => 'Kategoriýanyň adyny ýazyp, onuň mazmunyny agaç gurluşy hökmünde görüp bilersiňiz. |
3647 | | -Bu aýratynlyk AJAX ady bilen tanalýan ösen JavaScript bilen işleýändir. |
| 3674 | + 'categorytree-header' => 'Kategoriýanyň adyny ýazyp, onuň mazmunyny agaç gurluşy hökmünde görüp bilersiňiz. |
| 3675 | +Bu aýratynlyk AJAX ady bilen tanalýan ösen JavaScript bilen işleýändir. |
3648 | 3676 | Eger brauzeriňiz köne bolsa ýa-da JavaScript ýapyk bolsa, onda ol işlemez.', |
3649 | 3677 | 'categorytree-category' => 'Kategoriýa:', |
3650 | 3678 | 'categorytree-go' => 'Agajy görkez', |
— | — | @@ -3933,8 +3961,8 @@ |
3934 | 3962 | 'categorytree' => 'קאַטעגאריע בוים', |
3935 | 3963 | 'categorytree-portlet' => 'קאַטעגאריעס', |
3936 | 3964 | 'categorytree-legend' => 'ווײַזן קאַטעגאריע בוים', |
3937 | | - 'categorytree-header' => 'לייגט אריין א קאטעגאריע נאמען צו זען איר אינהאלט אלס א בוים סטרוקטור. |
3938 | | -באמערקט אז דאס פארלאנגט פארגעשריטענע JavaScript מעגליכקייטן, באקאנט אלס AJAX. |
| 3965 | + 'categorytree-header' => 'לייגט אריין א קאטעגאריע נאמען צו זען איר אינהאלט אלס א בוים סטרוקטור. |
| 3966 | +באמערקט אז דאס פארלאנגט פארגעשריטענע JavaScript מעגליכקייטן, באקאנט אלס AJAX. |
3939 | 3967 | אויב איר ניצט אן אלטן בלעטערער, אדער איר ערלויבט נישט קיין JavaScript, וועט דאס נישט ווירקן.', |
3940 | 3968 | 'categorytree-category' => 'קאטעגאריע:', |
3941 | 3969 | 'categorytree-go' => 'ווײַזן בוים', |
— | — | @@ -3954,7 +3982,17 @@ |
3955 | 3983 | 'categorytree-retry' => 'ביטע וואַרט אַ רגע און פרובירט נאכאַמאָל', |
3956 | 3984 | ); |
3957 | 3985 | |
3958 | | -/** Yue (粵語) |
| 3986 | +/** Yoruba (Yorùbá) |
| 3987 | + * @author Demmy |
| 3988 | + */ |
| 3989 | +$messages['yo'] = array( |
| 3990 | + 'categorytree-portlet' => 'Àwọn ẹ̀ka', |
| 3991 | + 'categorytree-category' => 'Ẹ̀ka:', |
| 3992 | + 'categorytree-parents' => 'Àwọn òbí', |
| 3993 | + 'categorytree-mode-all' => 'gbogbo àwọn ojúewé', |
| 3994 | +); |
| 3995 | + |
| 3996 | +/** Cantonese (粵語) |
3959 | 3997 | * @author Shinjiman |
3960 | 3998 | */ |
3961 | 3999 | $messages['yue'] = array( |
Index: branches/wmf/1.16wmf4/extensions/CategoryTree/CategoryTree.php |
— | — | @@ -1,5 +1,4 @@ |
2 | 2 | <?php |
3 | | - |
4 | 3 | /** |
5 | 4 | * Setup and Hooks for the CategoryTree extension, an AJAX based gadget |
6 | 5 | * to display the category structure of a wiki |
— | — | @@ -10,7 +9,7 @@ |
11 | 10 | * @license GNU General Public Licence 2.0 or later |
12 | 11 | */ |
13 | 12 | |
14 | | -if( !defined( 'MEDIAWIKI' ) ) { |
| 13 | +if ( !defined( 'MEDIAWIKI' ) ) { |
15 | 14 | echo( "This file is an extension to the MediaWiki software and cannot be used standalone.\n" ); |
16 | 15 | die( 1 ); |
17 | 16 | } |
— | — | @@ -19,24 +18,25 @@ |
20 | 19 | * Constants for use with the mode, |
21 | 20 | * defining what should be shown in the tree |
22 | 21 | */ |
23 | | -define('CT_MODE_CATEGORIES', 0); |
24 | | -define('CT_MODE_PAGES', 10); |
25 | | -define('CT_MODE_ALL', 20); |
26 | | -define('CT_MODE_PARENTS', 100); |
| 22 | +define( 'CT_MODE_CATEGORIES', 0 ); |
| 23 | +define( 'CT_MODE_PAGES', 10 ); |
| 24 | +define( 'CT_MODE_ALL', 20 ); |
| 25 | +define( 'CT_MODE_PARENTS', 100 ); |
27 | 26 | |
28 | 27 | /** |
29 | 28 | * Constants for use with the hideprefix option, |
30 | 29 | * defining when the namespace prefix should be hidden |
31 | 30 | */ |
32 | | -define('CT_HIDEPREFIX_NEVER', 0); |
33 | | -define('CT_HIDEPREFIX_ALWAYS', 10); |
34 | | -define('CT_HIDEPREFIX_CATEGORIES', 20); |
35 | | -define('CT_HIDEPREFIX_AUTO', 30); |
| 31 | +define( 'CT_HIDEPREFIX_NEVER', 0 ); |
| 32 | +define( 'CT_HIDEPREFIX_ALWAYS', 10 ); |
| 33 | +define( 'CT_HIDEPREFIX_CATEGORIES', 20 ); |
| 34 | +define( 'CT_HIDEPREFIX_AUTO', 30 ); |
36 | 35 | |
37 | 36 | /** |
38 | 37 | * Options: |
39 | 38 | * |
40 | 39 | * $wgCategoryTreeMaxChildren - maximum number of children shown in a tree node. Default is 200 |
| 40 | + * $wgCategoryTreeMaxScanRows - maximum number of rows the DBMS may scan while showing a tree node. |
41 | 41 | * $wgCategoryTreeAllowTag - enable <categorytree> tag. Default is true. |
42 | 42 | * $wgCategoryTreeDynamicTag - loads the first level of the tree in a <categorytag> dynamically. |
43 | 43 | * This way, the cache does not need to be disabled. Default is false. |
— | — | @@ -52,57 +52,58 @@ |
53 | 53 | */ |
54 | 54 | |
55 | 55 | $wgCategoryTreeMaxChildren = 200; |
| 56 | +$wgCategoryTreeMaxScanRows = 10000; |
56 | 57 | $wgCategoryTreeAllowTag = true; |
57 | 58 | $wgCategoryTreeDisableCache = true; |
58 | 59 | $wgCategoryTreeDynamicTag = false; |
59 | 60 | $wgCategoryTreeHTTPCache = false; |
60 | | -#$wgCategoryTreeUnifiedView = true; |
61 | | -$wgCategoryTreeMaxDepth = array(CT_MODE_PAGES => 1, CT_MODE_ALL => 1, CT_MODE_CATEGORIES => 2); |
| 61 | +# $wgCategoryTreeUnifiedView = true; |
| 62 | +$wgCategoryTreeMaxDepth = array( CT_MODE_PAGES => 1, CT_MODE_ALL => 1, CT_MODE_CATEGORIES => 2 ); |
62 | 63 | |
63 | | -# Set $wgCategoryTreeForceHeaders to true to force the JS and CSS headers for CategoryTree to be included on every page. |
| 64 | +# Set $wgCategoryTreeForceHeaders to true to force the JS and CSS headers for CategoryTree to be included on every page. |
64 | 65 | # May be usefull for using CategoryTree from within system messages, in the sidebar, or a custom skin. |
65 | | -$wgCategoryTreeForceHeaders = false; |
| 66 | +$wgCategoryTreeForceHeaders = false; |
66 | 67 | $wgCategoryTreeSidebarRoot = null; |
67 | 68 | $wgCategoryTreeHijackPageCategories = false; # EXPERIMENTAL! NOT YET FOR PRODUCTION USE! Main problem is general HTML/CSS layout cruftiness. |
68 | 69 | |
69 | 70 | $wgCategoryTreeExtPath = '/extensions/CategoryTree'; |
70 | | -$wgCategoryTreeVersion = '5'; #NOTE: bump this when you change the CSS or JS files! |
| 71 | +$wgCategoryTreeVersion = '6'; # NOTE: bump this when you change the CSS or JS files! |
71 | 72 | $wgCategoryTreeUseCategoryTable = version_compare( $wgVersion, "1.13", '>=' ); |
72 | 73 | |
73 | 74 | $wgCategoryTreeOmitNamespace = CT_HIDEPREFIX_CATEGORIES; |
74 | 75 | $wgCategoryTreeDefaultMode = CT_MODE_CATEGORIES; |
75 | | -$wgCategoryTreeDefaultOptions = array(); #Default values for most options. ADD NEW OPTIONS HERE! |
| 76 | +$wgCategoryTreeDefaultOptions = array(); # Default values for most options. ADD NEW OPTIONS HERE! |
76 | 77 | $wgCategoryTreeDefaultOptions['mode'] = null; # will be set to $wgCategoryTreeDefaultMode in efCategoryTree(); compatibility quirk |
77 | 78 | $wgCategoryTreeDefaultOptions['hideprefix'] = null; # will be set to $wgCategoryTreeDefaultMode in efCategoryTree(); compatibility quirk |
78 | 79 | $wgCategoryTreeDefaultOptions['showcount'] = false; |
79 | 80 | $wgCategoryTreeDefaultOptions['namespaces'] = false; # false means "no filter" |
80 | 81 | |
81 | 82 | $wgCategoryTreeCategoryPageMode = CT_MODE_CATEGORIES; |
82 | | -$wgCategoryTreeCategoryPageOptions = array(); #Options to be used for category pages |
| 83 | +$wgCategoryTreeCategoryPageOptions = array(); # Options to be used for category pages |
83 | 84 | $wgCategoryTreeCategoryPageOptions['mode'] = NULL; # will be set to $wgCategoryTreeDefaultMode in efCategoryTree(); compatibility quirk |
84 | 85 | $wgCategoryTreeCategoryPageOptions['showcount'] = true; |
85 | 86 | |
86 | | -$wgCategoryTreeSpecialPageOptions = array(); #Options to be used for Special:CategoryTree |
| 87 | +$wgCategoryTreeSpecialPageOptions = array(); # Options to be used for Special:CategoryTree |
87 | 88 | $wgCategoryTreeSpecialPageOptions['showcount'] = true; |
88 | 89 | |
89 | | -$wgCategoryTreeSidebarOptions = array(); #Options to be used in the sidebar (for use with $wgCategoryTreeSidebarRoot) |
| 90 | +$wgCategoryTreeSidebarOptions = array(); # Options to be used in the sidebar (for use with $wgCategoryTreeSidebarRoot) |
90 | 91 | $wgCategoryTreeSidebarOptions['mode'] = CT_MODE_CATEGORIES; |
91 | 92 | $wgCategoryTreeSidebarOptions['hideprefix'] = CT_HIDEPREFIX_CATEGORIES; |
92 | 93 | $wgCategoryTreeSidebarOptions['showcount'] = false; |
93 | 94 | $wgCategoryTreeSidebarOptions['hideroot'] = true; |
94 | | -$wgCategoryTreeSidebarOptions['namespaces'] = false; |
| 95 | +$wgCategoryTreeSidebarOptions['namespaces'] = false; |
95 | 96 | $wgCategoryTreeSidebarOptions['depth'] = 1; |
96 | 97 | |
97 | | -$wgCategoryTreePageCategoryOptions = array(); #Options to be used in the sidebar (for use with $wgCategoryTreePageCategories) |
| 98 | +$wgCategoryTreePageCategoryOptions = array(); # Options to be used in the sidebar (for use with $wgCategoryTreePageCategories) |
98 | 99 | $wgCategoryTreePageCategoryOptions['mode'] = CT_MODE_PARENTS; |
99 | 100 | $wgCategoryTreePageCategoryOptions['hideprefix'] = CT_HIDEPREFIX_CATEGORIES; |
100 | 101 | $wgCategoryTreePageCategoryOptions['showcount'] = false; |
101 | 102 | $wgCategoryTreePageCategoryOptions['hideroot'] = false; |
102 | 103 | $wgCategoryTreePageCategoryOptions['namespaces'] = false; |
103 | 104 | $wgCategoryTreePageCategoryOptions['depth'] = 0; |
104 | | -#$wgCategoryTreePageCategoryOptions['class'] = 'CategoryTreeInlineNode'; |
| 105 | +# $wgCategoryTreePageCategoryOptions['class'] = 'CategoryTreeInlineNode'; |
105 | 106 | |
106 | | -$wgExtensionAliasesFiles['CategoryTree'] = dirname(__FILE__) . '/CategoryTree.alias.php'; |
| 107 | +$wgExtensionAliasesFiles['CategoryTree'] = dirname( __FILE__ ) . '/CategoryTree.alias.php'; |
107 | 108 | |
108 | 109 | /** |
109 | 110 | * Register extension setup hook and credits |
— | — | @@ -113,7 +114,6 @@ |
114 | 115 | 'name' => 'CategoryTree', |
115 | 116 | 'author' => 'Daniel Kinzler', |
116 | 117 | 'url' => 'http://www.mediawiki.org/wiki/Extension:CategoryTree', |
117 | | - 'description' => 'Dynamically navigate the category structure', |
118 | 118 | 'descriptionmsg' => 'categorytree-desc', |
119 | 119 | ); |
120 | 120 | $wgExtensionCredits['parserhook'][] = array( |
— | — | @@ -128,7 +128,7 @@ |
129 | 129 | /** |
130 | 130 | * Register the special page |
131 | 131 | */ |
132 | | -$dir = dirname(__FILE__) . '/'; |
| 132 | +$dir = dirname( __FILE__ ) . '/'; |
133 | 133 | |
134 | 134 | if ( $wgUseAjax && $wgCategoryTreeAllowTag ) { |
135 | 135 | $wgExtensionMessagesFiles['CategoryTreeMagic'] = $dir . 'CategoryTree.i18n.magic.php'; |
— | — | @@ -140,7 +140,7 @@ |
141 | 141 | $wgAutoloadClasses['CategoryTreeCategoryPage'] = $dir . 'CategoryPageSubclass.php'; |
142 | 142 | $wgSpecialPages['CategoryTree'] = 'CategoryTreePage'; |
143 | 143 | $wgSpecialPageGroups['CategoryTree'] = 'pages'; |
144 | | -#$wgHooks['SkinTemplateTabs'][] = 'efCategoryTreeInstallTabs'; |
| 144 | +# $wgHooks['SkinTemplateTabs'][] = 'efCategoryTreeInstallTabs'; |
145 | 145 | $wgHooks['ArticleFromTitle'][] = 'efCategoryTreeArticleFromTitle'; |
146 | 146 | |
147 | 147 | /** |
— | — | @@ -174,7 +174,7 @@ |
175 | 175 | $wgHooks['SkinJoinCategoryLinks'][] = 'efCategoryTreeSkinJoinCategoryLinks'; |
176 | 176 | } |
177 | 177 | |
178 | | - if( $wgCategoryTreeAllowTag ) { |
| 178 | + if ( $wgCategoryTreeAllowTag ) { |
179 | 179 | $wgHooks['ParserFirstCallInit'][] = 'efCategoryTreeSetHooks'; |
180 | 180 | } |
181 | 181 | |
— | — | @@ -221,13 +221,13 @@ |
222 | 222 | $depth = isset( $options['depth'] ) ? (int)$options['depth'] : 1; |
223 | 223 | |
224 | 224 | $ct = new CategoryTree( $options, true ); |
225 | | - $depth = efCategoryTreeCapDepth( $ct->getOption('mode'), $depth ); |
| 225 | + $depth = efCategoryTreeCapDepth( $ct->getOption( 'mode' ), $depth ); |
226 | 226 | $response = $ct->ajax( $category, $depth ); |
227 | 227 | |
228 | 228 | if ( $wgCategoryTreeHTTPCache && $wgSquidMaxage && $wgUseSquid ) { |
229 | 229 | $response->setCacheDuration( $wgSquidMaxage ); |
230 | | - $response->setVary( 'Accept-Encoding, Cookie' ); #cache for anons only |
231 | | - #TODO: purge the squid cache when a category page is invalidated |
| 230 | + $response->setVary( 'Accept-Encoding, Cookie' ); # cache for anons only |
| 231 | + # TODO: purge the squid cache when a category page is invalidated |
232 | 232 | } |
233 | 233 | |
234 | 234 | return $response; |
— | — | @@ -240,20 +240,22 @@ |
241 | 241 | function efCategoryTreeCapDepth( $mode, $depth ) { |
242 | 242 | global $wgCategoryTreeMaxDepth; |
243 | 243 | |
244 | | - if (is_numeric($depth)) |
245 | | - $depth = intval($depth); |
246 | | - else return 1; |
| 244 | + if ( is_numeric( $depth ) ) { |
| 245 | + $depth = intval( $depth ); |
| 246 | + } else { |
| 247 | + return 1; |
| 248 | + } |
247 | 249 | |
248 | | - if (is_array($wgCategoryTreeMaxDepth)) { |
249 | | - $max = isset($wgCategoryTreeMaxDepth[$mode]) ? $wgCategoryTreeMaxDepth[$mode] : 1; |
250 | | - } elseif (is_numeric($wgCategoryTreeMaxDepth)) { |
| 250 | + if ( is_array( $wgCategoryTreeMaxDepth ) ) { |
| 251 | + $max = isset( $wgCategoryTreeMaxDepth[$mode] ) ? $wgCategoryTreeMaxDepth[$mode] : 1; |
| 252 | + } elseif ( is_numeric( $wgCategoryTreeMaxDepth ) ) { |
251 | 253 | $max = $wgCategoryTreeMaxDepth; |
252 | 254 | } else { |
253 | 255 | wfDebug( 'efCategoryTreeCapDepth: $wgCategoryTreeMaxDepth is invalid.' ); |
254 | 256 | $max = 1; |
255 | 257 | } |
256 | 258 | |
257 | | - return min($depth, $max); |
| 259 | + return min( $depth, $max ); |
258 | 260 | } |
259 | 261 | |
260 | 262 | /** |
— | — | @@ -262,28 +264,30 @@ |
263 | 265 | */ |
264 | 266 | function efCategoryTreeParserFunction( &$parser ) { |
265 | 267 | $params = func_get_args(); |
266 | | - array_shift( $params ); //first is &$parser, strip it |
| 268 | + array_shift( $params ); // first is &$parser, strip it |
267 | 269 | |
268 | | - //first user-supplied parameter must be category name |
269 | | - if ( !$params ) return ''; //no category specified, return nothing |
| 270 | + // first user-supplied parameter must be category name |
| 271 | + if ( !$params ) { |
| 272 | + return ''; // no category specified, return nothing |
| 273 | + } |
270 | 274 | $cat = array_shift( $params ); |
271 | 275 | |
272 | | - //build associative arguments from flat parameter list |
| 276 | + // build associative arguments from flat parameter list |
273 | 277 | $argv = array(); |
274 | 278 | foreach ( $params as $p ) { |
275 | | - if ( preg_match('/^\s*(\S.*?)\s*=\s*(.*?)\s*$/', $p, $m) ) { |
| 279 | + if ( preg_match( '/^\s*(\S.*?)\s*=\s*(.*?)\s*$/', $p, $m ) ) { |
276 | 280 | $k = $m[1]; |
277 | | - $v = preg_replace('/^"\s*(.*?)\s*"$/', '$1', $m[2]); //strip any quotes enclusing the value |
| 281 | + $v = preg_replace( '/^"\s*(.*?)\s*"$/', '$1', $m[2] ); // strip any quotes enclusing the value |
278 | 282 | } |
279 | 283 | else { |
280 | | - $k = trim($p); |
| 284 | + $k = trim( $p ); |
281 | 285 | $v = true; |
282 | 286 | } |
283 | 287 | |
284 | 288 | $argv[$k] = $v; |
285 | 289 | } |
286 | 290 | |
287 | | - //now handle just like a <categorytree> tag |
| 291 | + // now handle just like a <categorytree> tag |
288 | 292 | $html = efCategoryTreeParserHook( $cat, $argv, $parser ); |
289 | 293 | return array( $html, 'noparse' => true, 'isHTML' => true ); |
290 | 294 | } |
— | — | @@ -294,14 +298,15 @@ |
295 | 299 | */ |
296 | 300 | function efCategoryTreeSkinTemplateOutputPageBeforeExec( &$skin, &$tpl ) { |
297 | 301 | global $wgCategoryTreeSidebarRoot, $wgCategoryTreeSidebarOptions; |
298 | | - |
| 302 | + |
299 | 303 | $html = efCategoryTreeParserHook( $wgCategoryTreeSidebarRoot, $wgCategoryTreeSidebarOptions ); |
300 | | - if ( $html ) $tpl->data['sidebar']['categorytree-portlet'] = $html; //requires MW 1.13, r36917 |
| 304 | + if ( $html ) { |
| 305 | + $tpl->data['sidebar']['categorytree-portlet'] = $html; // requires MW 1.13, r36917 |
| 306 | + } |
301 | 307 | |
302 | 308 | return true; |
303 | 309 | } |
304 | 310 | |
305 | | - |
306 | 311 | /** |
307 | 312 | * Entry point for the <categorytree> tag parser hook. |
308 | 313 | * This loads CategoryTreeFunctions.php and calls CategoryTree::getTag() |
— | — | @@ -311,8 +316,7 @@ |
312 | 317 | |
313 | 318 | if ( $parser ) { |
314 | 319 | $parser->mOutput->mCategoryTreeTag = true; # flag for use by efCategoryTreeParserOutput |
315 | | - } |
316 | | - else { |
| 320 | + } else { |
317 | 321 | CategoryTree::setHeaders( $wgOut ); |
318 | 322 | } |
319 | 323 | |
— | — | @@ -325,7 +329,9 @@ |
326 | 330 | $depthArg = isset( $argv[ 'depth' ] ) ? (int)$argv[ 'depth' ] : null; |
327 | 331 | |
328 | 332 | $depth = efCategoryTreeCapDepth( $ct->getOption( 'mode' ), $depthArg ); |
329 | | - if ( $onlyroot ) $depth = 0; |
| 333 | + if ( $onlyroot ) { |
| 334 | + $depth = 0; |
| 335 | + } |
330 | 336 | |
331 | 337 | return $ct->getTag( $parser, $cat, $hideroot, $attr, $depth, $allowMissing ); |
332 | 338 | } |
— | — | @@ -366,13 +372,11 @@ |
367 | 373 | return false; |
368 | 374 | } |
369 | 375 | |
370 | | - |
371 | 376 | function efCategoryTreeSkinJoinCategoryLinks( &$skin, &$links, &$result ) { |
372 | 377 | $embed = '<div class="CategoryTreePretendInlineMSIE CategoryTreeCategoryBarItem">'; |
373 | 378 | $pop = '</div>'; |
374 | 379 | $sep = ' '; |
375 | 380 | |
376 | | -# $result = '<div class="CategoryTreeCatBarWrapper" style="border:1px solid blue">' . $embed . implode ( "{$pop} {$sep} {$embed}" , $links ) . $pop . '</div>'; |
377 | 381 | $result = $embed . implode ( "{$pop} {$sep} {$embed}" , $links ) . $pop; |
378 | 382 | |
379 | 383 | return false; |
Index: branches/wmf/1.16wmf4/extensions/CategoryTree/CategoryTree.css |
— | — | @@ -8,7 +8,7 @@ |
9 | 9 | * @copyright © 2006 Daniel Kinzler |
10 | 10 | * @licence GNU General Public Licence 2.0 or later |
11 | 11 | * |
12 | | - * NOTE: if you change this, increment $wgCategoryTreeVersion |
| 12 | + * NOTE: if you change this, increment $wgCategoryTreeVersion |
13 | 13 | * in CategoryTree.php to avoid users getting stale copies from cache. |
14 | 14 | */ |
15 | 15 | |
— | — | @@ -21,6 +21,9 @@ |
22 | 22 | cursor: pointer; |
23 | 23 | cursor: hand; /* hack for MSIE 5.0 and 5.5 */ |
24 | 24 | } |
| 25 | +.CategoryTreeEmptyBullet { |
| 26 | + cursor: default; |
| 27 | +} |
25 | 28 | |
26 | 29 | .CategoryTreeBullet a, |
27 | 30 | .CategoryTreeBullet a:link, |
Index: branches/wmf/1.16wmf4/extensions/CategoryTree/CategoryTree.js |
— | — | @@ -8,155 +8,155 @@ |
9 | 9 | * @copyright © 2006 Daniel Kinzler |
10 | 10 | * @licence GNU General Public Licence 2.0 or later |
11 | 11 | * |
12 | | - * NOTE: if you change this, increment $wgCategoryTreeVersion |
| 12 | + * NOTE: if you change this, increment $wgCategoryTreeVersion |
13 | 13 | * in CategoryTree.php to avoid users getting stale copies from cache. |
14 | | -*/ |
| 14 | + */ |
15 | 15 | |
16 | 16 | // Default messages if new code loaded with old cached page |
17 | 17 | var categoryTreeErrorMsg = "Problem loading data."; |
18 | 18 | var categoryTreeRetryMsg = "Please wait a moment and try again."; |
19 | 19 | |
20 | | - function categoryTreeNextDiv(e) { |
21 | | - var n= e.nextSibling; |
22 | | - while ( n && ( n.nodeType != 1 || n.nodeName != 'DIV') ) { |
23 | | - //alert('nodeType: ' + n.nodeType + '; nodeName: ' + n.nodeName); |
24 | | - n= n.nextSibling; |
25 | | - } |
| 20 | +function categoryTreeNextDiv(e) { |
| 21 | + var n= e.nextSibling; |
| 22 | + while ( n && ( n.nodeType != 1 || n.nodeName != 'DIV') ) { |
| 23 | + //alert('nodeType: ' + n.nodeType + '; nodeName: ' + n.nodeName); |
| 24 | + n= n.nextSibling; |
| 25 | + } |
26 | 26 | |
27 | | - return n; |
28 | | - } |
| 27 | + return n; |
| 28 | +} |
29 | 29 | |
30 | | - function categoryTreeExpandNode(cat, options, lnk) { |
31 | | - var div= categoryTreeNextDiv( lnk.parentNode.parentNode ); |
| 30 | +function categoryTreeExpandNode(cat, options, lnk) { |
| 31 | + var div= categoryTreeNextDiv( lnk.parentNode.parentNode ); |
32 | 32 | |
33 | | - div.style.display= 'block'; |
34 | | - lnk.innerHTML= categoryTreeCollapseBulletMsg; |
35 | | - lnk.title= categoryTreeCollapseMsg; |
36 | | - lnk.onclick= function() { categoryTreeCollapseNode(cat, options, lnk) } |
| 33 | + div.style.display= 'block'; |
| 34 | + lnk.innerHTML= categoryTreeCollapseBulletMsg; |
| 35 | + lnk.title= categoryTreeCollapseMsg; |
| 36 | + lnk.onclick= function() { categoryTreeCollapseNode(cat, options, lnk) } |
37 | 37 | |
38 | | - if (!lnk.className.match(/(^| )CategoryTreeLoaded($| )/)) { |
39 | | - categoryTreeLoadNode(cat, options, lnk, div); |
40 | | - } |
41 | | - } |
| 38 | + if (!lnk.className.match(/(^| )CategoryTreeLoaded($| )/)) { |
| 39 | + categoryTreeLoadNode(cat, options, lnk, div); |
| 40 | + } |
| 41 | +} |
42 | 42 | |
43 | | - function categoryTreeCollapseNode(cat, options, lnk) { |
44 | | - var div= categoryTreeNextDiv( lnk.parentNode.parentNode ); |
| 43 | +function categoryTreeCollapseNode(cat, options, lnk) { |
| 44 | + var div= categoryTreeNextDiv( lnk.parentNode.parentNode ); |
45 | 45 | |
46 | | - div.style.display= 'none'; |
47 | | - lnk.innerHTML= categoryTreeExpandBulletMsg; |
48 | | - lnk.title= categoryTreeExpandMsg; |
49 | | - lnk.onclick= function() { categoryTreeExpandNode(cat, options, lnk) } |
50 | | - } |
| 46 | + div.style.display= 'none'; |
| 47 | + lnk.innerHTML= categoryTreeExpandBulletMsg; |
| 48 | + lnk.title= categoryTreeExpandMsg; |
| 49 | + lnk.onclick= function() { categoryTreeExpandNode(cat, options, lnk) } |
| 50 | +} |
51 | 51 | |
52 | | - function categoryTreeLoadNode(cat, options, lnk, div) { |
53 | | - div.style.display= 'block'; |
54 | | - lnk.className= 'CategoryTreeLoaded'; |
55 | | - lnk.innerHTML= categoryTreeCollapseBulletMsg; |
56 | | - lnk.title= categoryTreeCollapseMsg; |
57 | | - lnk.onclick= function() { categoryTreeCollapseNode(cat, options, lnk) } |
| 52 | +function categoryTreeLoadNode(cat, options, lnk, div) { |
| 53 | + div.style.display= 'block'; |
| 54 | + lnk.className= 'CategoryTreeLoaded'; |
| 55 | + lnk.innerHTML= categoryTreeCollapseBulletMsg; |
| 56 | + lnk.title= categoryTreeCollapseMsg; |
| 57 | + lnk.onclick= function() { categoryTreeCollapseNode(cat, options, lnk) } |
58 | 58 | |
59 | | - categoryTreeLoadChildren(cat, options, div) |
60 | | - } |
| 59 | + categoryTreeLoadChildren(cat, options, div) |
| 60 | +} |
61 | 61 | |
62 | | - // FIXME Why can't this just use uneval()? |
63 | | - function categoryTreeEncodeValue(value) { |
64 | | - switch (typeof value) { |
65 | | - case 'function': |
66 | | - throw new Error("categoryTreeEncodeValue encountered a function"); |
67 | | - break; |
| 62 | +// FIXME Why can't this just use uneval()? |
| 63 | +function categoryTreeEncodeValue(value) { |
| 64 | + switch (typeof value) { |
| 65 | + case 'function': |
| 66 | + throw new Error("categoryTreeEncodeValue encountered a function"); |
| 67 | + break; |
| 68 | + case 'string': |
| 69 | + s = '"' + value.replace(/([\\"'])/g, "\\$1") + '"'; |
| 70 | + break; |
| 71 | + case 'number': |
| 72 | + case 'boolean': |
| 73 | + case 'null': |
| 74 | + s = String(value); |
| 75 | + break; |
| 76 | + case 'object': |
| 77 | + if ( !value ) { |
| 78 | + s = 'null'; |
| 79 | + } else if (typeof value.length === 'number' && !(value.propertyIsEnumerable('length'))) { |
| 80 | + s = ''; |
| 81 | + for (i = 0; i<value.length; i++) { |
| 82 | + v = value[i]; |
| 83 | + if ( s!='' ) s += ', '; |
| 84 | + s += categoryTreeEncodeValue( v ); |
| 85 | + } |
| 86 | + s = '[' + s + ']'; |
| 87 | + } else { |
| 88 | + s = ''; |
| 89 | + for (k in value) { |
| 90 | + v = value[k]; |
| 91 | + if ( s!='' ) s += ', '; |
| 92 | + s += categoryTreeEncodeValue( k ); |
| 93 | + s += ': '; |
| 94 | + s += categoryTreeEncodeValue( v ); |
| 95 | + } |
| 96 | + s = '{' + s + '}'; |
| 97 | + } |
| 98 | + break; |
| 99 | + default: |
| 100 | + throw new Error("categoryTreeEncodeValue encountered strange variable type " + (typeof value)); |
| 101 | + } |
68 | 102 | |
69 | | - case 'string': |
70 | | - s = '"' + value.replace(/([\\"'])/g, "\\$1") + '"'; |
71 | | - break; |
| 103 | + return s; |
| 104 | +} |
72 | 105 | |
73 | | - case 'number': |
74 | | - case 'boolean': |
75 | | - case 'null': |
76 | | - s = String(value); |
77 | | - break; |
| 106 | +function categoryTreeLoadChildren(cat, options, div) { |
| 107 | + div.innerHTML= '<i class="CategoryTreeNotice">' + categoryTreeLoadingMsg + '</i>'; |
78 | 108 | |
79 | | - case 'object': |
80 | | - if ( !value ) { |
81 | | - s = 'null'; |
82 | | - } |
83 | | - else if (typeof value.length === 'number' && !(value.propertyIsEnumerable('length'))) { |
84 | | - s = ''; |
85 | | - for (i = 0; i<value.length; i++) { |
86 | | - v = value[i]; |
87 | | - if ( s!='' ) s += ', '; |
88 | | - s += categoryTreeEncodeValue( v ); |
89 | | - } |
90 | | - s = '[' + s + ']'; |
91 | | - } |
92 | | - else { |
93 | | - s = ''; |
94 | | - for (k in value) { |
95 | | - v = value[k]; |
96 | | - if ( s!='' ) s += ', '; |
97 | | - s += categoryTreeEncodeValue( k ); |
98 | | - s += ': '; |
99 | | - s += categoryTreeEncodeValue( v ); |
100 | | - } |
101 | | - s = '{' + s + '}'; |
102 | | - } |
103 | | - break; |
104 | | - default: |
105 | | - throw new Error("categoryTreeEncodeValue encountered strange variable type " + (typeof value)); |
106 | | - } |
| 109 | + if ( typeof options == "string" ) { //hack for backward compatibility |
| 110 | + options = { mode : options }; |
| 111 | + } |
107 | 112 | |
108 | | - return s; |
109 | | - } |
| 113 | + function f( request ) { |
| 114 | + if (request.status != 200) { |
| 115 | + div.innerHTML = '<i class="CategoryTreeNotice">' + categoryTreeErrorMsg + ' </i>'; |
| 116 | + var retryLink = document.createElement('a'); |
| 117 | + retryLink.innerHTML = categoryTreeRetryMsg; |
| 118 | + retryLink.onclick = function() { |
| 119 | + categoryTreeLoadChildren(cat, options, div, enc); |
| 120 | + } |
| 121 | + div.appendChild(retryLink); |
| 122 | + return; |
| 123 | + } |
110 | 124 | |
111 | | - function categoryTreeLoadChildren(cat, options, div) { |
112 | | - div.innerHTML= '<i class="CategoryTreeNotice">' + categoryTreeLoadingMsg + '</i>'; |
| 125 | + result= request.responseText; |
| 126 | + result= result.replace(/^\s+|\s+$/, ''); |
113 | 127 | |
114 | | - if ( typeof options == "string" ) { //hack for backward compatibility |
115 | | - options = { mode : options }; |
116 | | - } |
| 128 | + if ( result == '' ) { |
| 129 | + result= '<i class="CategoryTreeNotice">'; |
117 | 130 | |
118 | | - function f( request ) { |
119 | | - if (request.status != 200) { |
120 | | - div.innerHTML = '<i class="CategoryTreeNotice">' + categoryTreeErrorMsg + ' </i>'; |
121 | | - var retryLink = document.createElement('a'); |
122 | | - retryLink.innerHTML = categoryTreeRetryMsg; |
123 | | - retryLink.onclick = function() { |
124 | | - categoryTreeLoadChildren(cat, options, div, enc); |
125 | | - } |
126 | | - div.appendChild(retryLink); |
127 | | - return; |
128 | | - } |
| 131 | + if ( options.mode == 0 ) { |
| 132 | + result= categoryTreeNoSubcategoriesMsg; |
| 133 | + } else if ( options.mode == 10 ) { |
| 134 | + result= categoryTreeNoPagesMsg; |
| 135 | + } else if ( options.mode == 100 ) { |
| 136 | + result= categoryTreeNoParentCategoriesMsg; |
| 137 | + } else { |
| 138 | + result= categoryTreeNothingFoundMsg; |
| 139 | + } |
129 | 140 | |
130 | | - result= request.responseText; |
131 | | - result= result.replace(/^\s+|\s+$/, ''); |
| 141 | + result+= '</i>'; |
| 142 | + } |
132 | 143 | |
133 | | - if ( result == '' ) { |
134 | | - result= '<i class="CategoryTreeNotice">'; |
| 144 | + result = result.replace(/##LOAD##/g, categoryTreeExpandMsg); |
| 145 | + div.innerHTML= result; |
135 | 146 | |
136 | | - if ( options.mode == 0 ) result= categoryTreeNoSubcategoriesMsg; |
137 | | - else if ( options.mode == 10 ) result= categoryTreeNoPagesMsg; |
138 | | - else if ( options.mode == 100 ) result= categoryTreeNoParentCategoriesMsg; |
139 | | - else result= categoryTreeNothingFoundMsg; |
| 147 | + categoryTreeShowToggles(); |
| 148 | + } |
140 | 149 | |
141 | | - result+= '</i>'; |
142 | | - } |
| 150 | + var opt = categoryTreeEncodeValue(options); |
| 151 | + sajax_do_call( "efCategoryTreeAjaxWrapper", [cat, opt, 'json'] , f ); |
| 152 | +} |
143 | 153 | |
144 | | - result = result.replace(/##LOAD##/g, categoryTreeExpandMsg); |
145 | | - div.innerHTML= result; |
| 154 | +function categoryTreeShowToggles() { |
| 155 | + var toggles = getElementsByClassName( document, 'span', 'CategoryTreeToggle' ); |
146 | 156 | |
147 | | - categoryTreeShowToggles(); |
148 | | - } |
| 157 | + for( var i = 0; i<toggles.length; ++i ) { |
| 158 | + toggles[i].style.display = 'inline'; |
| 159 | + } |
| 160 | +} |
149 | 161 | |
150 | | - var opt = categoryTreeEncodeValue(options); |
151 | | - sajax_do_call( "efCategoryTreeAjaxWrapper", [cat, opt, 'json'] , f ); |
152 | | - } |
153 | | - |
154 | | - function categoryTreeShowToggles() { |
155 | | - var toggles = getElementsByClassName( document, 'span', 'CategoryTreeToggle' ); |
156 | | - |
157 | | - for( var i = 0; i<toggles.length; ++i ) { |
158 | | - toggles[i].style.display = 'inline'; |
159 | | - } |
160 | | - } |
161 | | - |
162 | | - // Re-show the CategoryTreeToggles |
163 | | - addOnloadHook(categoryTreeShowToggles); |
| 162 | +// Re-show the CategoryTreeToggles |
| 163 | +addOnloadHook(categoryTreeShowToggles); |
Index: branches/wmf/1.16wmf4/extensions/CategoryTree/CategoryTree.alias.php |
— | — | @@ -192,7 +192,7 @@ |
193 | 193 | 'CategoryTree' => array( '분류트리' ), |
194 | 194 | ); |
195 | 195 | |
196 | | -/** Ripoarisch (Ripoarisch) */ |
| 196 | +/** Colognian (Ripoarisch) */ |
197 | 197 | $aliases['ksh'] = array( |
198 | 198 | 'CategoryTree' => array( 'Saachjruppeboum' ), |
199 | 199 | ); |
— | — | @@ -214,7 +214,7 @@ |
215 | 215 | |
216 | 216 | /** Malayalam (മലയാളം) */ |
217 | 217 | $aliases['ml'] = array( |
218 | | - 'CategoryTree' => array( 'വര്ഗ്ഗവൃക്ഷം' ), |
| 218 | + 'CategoryTree' => array( 'വർഗ്ഗവൃക്ഷം' ), |
219 | 219 | ); |
220 | 220 | |
221 | 221 | /** Marathi (मराठी) */ |
Index: branches/wmf/1.16wmf4/extensions/CategoryTree/CategoryTreeFunctions.php |
— | — | @@ -1,5 +1,4 @@ |
2 | 2 | <?php |
3 | | - |
4 | 3 | /** |
5 | 4 | * Core functions for the CategoryTree extension, an AJAX based gadget |
6 | 5 | * to display the category structure of a wiki |
— | — | @@ -10,7 +9,7 @@ |
11 | 10 | * @license GNU General Public Licence 2.0 or later |
12 | 11 | */ |
13 | 12 | |
14 | | -if( !defined( 'MEDIAWIKI' ) ) { |
| 13 | +if ( !defined( 'MEDIAWIKI' ) ) { |
15 | 14 | echo( "This file is part of an extension to the MediaWiki software and cannot be used standalone.\n" ); |
16 | 15 | die( 1 ); |
17 | 16 | } |
— | — | @@ -24,16 +23,19 @@ |
25 | 24 | |
26 | 25 | $this->mIsAjaxRequest = $ajax; |
27 | 26 | |
28 | | - #ensure default values and order of options. Order may become important, it may influence the cache key! |
| 27 | + # ensure default values and order of options. Order may become important, it may influence the cache key! |
29 | 28 | foreach ( $wgCategoryTreeDefaultOptions as $option => $default ) { |
30 | | - if ( isset( $options[$option] ) && !is_null( $options[$option] ) ) $this->mOptions[$option] = $options[$option]; |
31 | | - else $this->mOptions[$option] = $default; |
| 29 | + if ( isset( $options[$option] ) && !is_null( $options[$option] ) ) { |
| 30 | + $this->mOptions[$option] = $options[$option]; |
| 31 | + } else { |
| 32 | + $this->mOptions[$option] = $default; |
| 33 | + } |
32 | 34 | } |
33 | 35 | |
34 | 36 | $this->mOptions['mode'] = self::decodeMode( $this->mOptions['mode'] ); |
35 | 37 | |
36 | 38 | if ( $this->mOptions['mode'] == CT_MODE_PARENTS ) { |
37 | | - $this->mOptions['namespaces'] = false; #namespace filter makes no sense with CT_MODE_PARENTS |
| 39 | + $this->mOptions['namespaces'] = false; # namespace filter makes no sense with CT_MODE_PARENTS |
38 | 40 | } |
39 | 41 | |
40 | 42 | $this->mOptions['hideprefix'] = self::decodeHidePrefix( $this->mOptions['hideprefix'] ); |
— | — | @@ -42,7 +44,7 @@ |
43 | 45 | |
44 | 46 | if ( $this->mOptions['namespaces'] ) { |
45 | 47 | # automatically adjust mode to match namespace filter |
46 | | - if ( sizeof( $this->mOptions['namespaces'] ) === 1 |
| 48 | + if ( sizeof( $this->mOptions['namespaces'] ) === 1 |
47 | 49 | && $this->mOptions['namespaces'][0] == NS_CATEGORY ) { |
48 | 50 | $this->mOptions['mode'] = CT_MODE_CATEGORIES; |
49 | 51 | } else if ( !in_array( NS_IMAGE, $this->mOptions['namespaces'] ) ) { |
— | — | @@ -58,7 +60,7 @@ |
59 | 61 | } |
60 | 62 | |
61 | 63 | function isInverse( ) { |
62 | | - return $this->getOption('mode') == CT_MODE_PARENTS; |
| 64 | + return $this->getOption( 'mode' ) == CT_MODE_PARENTS; |
63 | 65 | } |
64 | 66 | |
65 | 67 | static function decodeNamespaces( $nn ) { |
— | — | @@ -67,7 +69,7 @@ |
68 | 70 | if ( !$nn ) |
69 | 71 | return false; |
70 | 72 | |
71 | | - if ( !is_array($nn) ) |
| 73 | + if ( !is_array( $nn ) ) |
72 | 74 | $nn = preg_split( '![\s#:|]+!', $nn ); |
73 | 75 | |
74 | 76 | $namespaces = array(); |
— | — | @@ -79,10 +81,10 @@ |
80 | 82 | else { |
81 | 83 | $n = trim( $n ); |
82 | 84 | if ( $n === '' ) continue; |
83 | | - |
| 85 | + |
84 | 86 | $lower = strtolower( $n ); |
85 | | - |
86 | | - if ( is_numeric($n) ) $ns = (int)$n; |
| 87 | + |
| 88 | + if ( is_numeric( $n ) ) $ns = (int)$n; |
87 | 89 | elseif ( $n == '-' || $n == '_' || $n == '*' || $lower == 'main' ) $ns = NS_MAIN; |
88 | 90 | else $ns = $wgContLang->getNsIndex( $n ); |
89 | 91 | } |
— | — | @@ -145,7 +147,7 @@ |
146 | 148 | |
147 | 149 | if ( $value == 'yes' || $value == 'y' || $value == 'true' || $value == 't' || $value == 'on' ) return CT_HIDEPREFIX_ALWAYS; |
148 | 150 | else if ( $value == 'no' || $value == 'n' || $value == 'false' || $value == 'f' || $value == 'off' ) return CT_HIDEPREFIX_NEVER; |
149 | | - //else if ( $value == 'null' || $value == 'default' || $value == 'none' || $value == 'x' ) return $wgCategoryTreeDefaultOptions['hideprefix']; |
| 151 | + // else if ( $value == 'null' || $value == 'default' || $value == 'none' || $value == 'x' ) return $wgCategoryTreeDefaultOptions['hideprefix']; |
150 | 152 | else if ( $value == 'always' ) return CT_HIDEPREFIX_ALWAYS; |
151 | 153 | else if ( $value == 'never' ) return CT_HIDEPREFIX_NEVER; |
152 | 154 | else if ( $value == 'auto' ) return CT_HIDEPREFIX_AUTO; |
— | — | @@ -160,7 +162,6 @@ |
161 | 163 | static function setHeaders( &$outputPage ) { |
162 | 164 | global $wgJsMimeType, $wgScriptPath, $wgContLang; |
163 | 165 | global $wgCategoryTreeHijackPageCategories, $wgCategoryTreeExtPath, $wgCategoryTreeVersion; |
164 | | - self::init(); |
165 | 166 | |
166 | 167 | # Register css file for CategoryTree |
167 | 168 | $outputPage->addLink( |
— | — | @@ -180,7 +181,7 @@ |
181 | 182 | } |
182 | 183 | |
183 | 184 | # Register css RTL file for CategoryTree |
184 | | - if( $wgContLang->isRTL() ) { |
| 185 | + if ( $wgContLang->isRTL() ) { |
185 | 186 | $outputPage->addLink( |
186 | 187 | array( |
187 | 188 | 'rel' => 'stylesheet', |
— | — | @@ -199,27 +200,27 @@ |
200 | 201 | # Add messages |
201 | 202 | $outputPage->addScript( |
202 | 203 | " <script type=\"{$wgJsMimeType}\"> |
203 | | - var categoryTreeCollapseMsg = \"".Xml::escapeJsString(wfMsgNoTrans('categorytree-collapse'))."\"; |
204 | | - var categoryTreeExpandMsg = \"".Xml::escapeJsString(wfMsgNoTrans('categorytree-expand'))."\"; |
205 | | - var categoryTreeCollapseBulletMsg = \"".Xml::escapeJsString(wfMsgNoTrans('categorytree-collapse-bullet'))."\"; |
206 | | - var categoryTreeExpandBulletMsg = \"".Xml::escapeJsString(wfMsgNoTrans('categorytree-expand-bullet'))."\"; |
207 | | - var categoryTreeLoadMsg = \"".Xml::escapeJsString(wfMsgNoTrans('categorytree-load'))."\"; |
208 | | - var categoryTreeLoadingMsg = \"".Xml::escapeJsString(wfMsgNoTrans('categorytree-loading'))."\"; |
209 | | - var categoryTreeNothingFoundMsg = \"".Xml::escapeJsString(wfMsgNoTrans('categorytree-nothing-found'))."\"; |
210 | | - var categoryTreeNoSubcategoriesMsg = \"".Xml::escapeJsString(wfMsgNoTrans('categorytree-no-subcategories'))."\"; |
211 | | - var categoryTreeNoParentCategoriesMsg = \"".Xml::escapeJsString(wfMsgNoTrans('categorytree-no-parent-categories'))."\"; |
212 | | - var categoryTreeNoPagesMsg = \"".Xml::escapeJsString(wfMsgNoTrans('categorytree-no-pages'))."\"; |
213 | | - var categoryTreeErrorMsg = \"".Xml::escapeJsString(wfMsgNoTrans('categorytree-error'))."\"; |
214 | | - var categoryTreeRetryMsg = \"".Xml::escapeJsString(wfMsgNoTrans('categorytree-retry'))."\"; |
215 | | - </script>\n" |
| 204 | + var categoryTreeCollapseMsg = \"" . Xml::escapeJsString( wfMsgNoTrans( 'categorytree-collapse' ) ) . "\"; |
| 205 | + var categoryTreeExpandMsg = \"" . Xml::escapeJsString( wfMsgNoTrans( 'categorytree-expand' ) ) . "\"; |
| 206 | + var categoryTreeCollapseBulletMsg = \"" . Xml::escapeJsString( wfMsgNoTrans( 'categorytree-collapse-bullet' ) ) . "\"; |
| 207 | + var categoryTreeExpandBulletMsg = \"" . Xml::escapeJsString( wfMsgNoTrans( 'categorytree-expand-bullet' ) ) . "\"; |
| 208 | + var categoryTreeLoadMsg = \"" . Xml::escapeJsString( wfMsgNoTrans( 'categorytree-load' ) ) . "\"; |
| 209 | + var categoryTreeLoadingMsg = \"" . Xml::escapeJsString( wfMsgNoTrans( 'categorytree-loading' ) ) . "\"; |
| 210 | + var categoryTreeNothingFoundMsg = \"" . Xml::escapeJsString( wfMsgNoTrans( 'categorytree-nothing-found' ) ) . "\"; |
| 211 | + var categoryTreeNoSubcategoriesMsg = \"" . Xml::escapeJsString( wfMsgNoTrans( 'categorytree-no-subcategories' ) ) . "\"; |
| 212 | + var categoryTreeNoParentCategoriesMsg = \"" . Xml::escapeJsString( wfMsgNoTrans( 'categorytree-no-parent-categories' ) ) . "\"; |
| 213 | + var categoryTreeNoPagesMsg = \"" . Xml::escapeJsString( wfMsgNoTrans( 'categorytree-no-pages' ) ) . "\"; |
| 214 | + var categoryTreeErrorMsg = \"" . Xml::escapeJsString( wfMsgNoTrans( 'categorytree-error' ) ) . "\"; |
| 215 | + var categoryTreeRetryMsg = \"" . Xml::escapeJsString( wfMsgNoTrans( 'categorytree-retry' ) ) . "\"; |
| 216 | + </script>\n" |
216 | 217 | ); |
217 | 218 | } |
218 | 219 | |
219 | 220 | static function getJsonCodec() { |
220 | 221 | static $json = null; |
221 | 222 | |
222 | | - if (!$json) { |
223 | | - $json = new Services_JSON(); #recycle API's JSON codec implementation |
| 223 | + if ( !$json ) { |
| 224 | + $json = new Services_JSON(); # recycle API's JSON codec implementation |
224 | 225 | } |
225 | 226 | |
226 | 227 | return $json; |
— | — | @@ -227,9 +228,9 @@ |
228 | 229 | |
229 | 230 | static function encodeOptions( $options, $enc ) { |
230 | 231 | if ( $enc == 'mode' || $enc == '' ) { |
231 | | - $opt =$options['mode']; |
| 232 | + $opt = $options['mode']; |
232 | 233 | } elseif ( $enc == 'json' ) { |
233 | | - $json = self::getJsonCodec(); //XXX: this may be a bit heavy... |
| 234 | + $json = self::getJsonCodec(); // XXX: this may be a bit heavy... |
234 | 235 | $opt = $json->encode( $options ); |
235 | 236 | } else { |
236 | 237 | throw new MWException( 'Unknown encoding for CategoryTree options: ' . $enc ); |
— | — | @@ -242,21 +243,10 @@ |
243 | 244 | if ( $enc == 'mode' || $enc == '' ) { |
244 | 245 | $opt = array( "mode" => $options ); |
245 | 246 | } elseif ( $enc == 'json' ) { |
246 | | - $json = self::getJsonCodec(); //XXX: this may be a bit heavy... |
| 247 | + $json = self::getJsonCodec(); // XXX: this may be a bit heavy... |
247 | 248 | $opt = $json->decode( $options ); |
248 | 249 | $opt = get_object_vars( $opt ); |
249 | | - } /* elseif () { |
250 | | - foreach ( $oo as $o ) { |
251 | | - if ($o === "") continue; |
252 | | - |
253 | | - if ( preg_match( '!^(.*?)=(.*)$!', $o, $m ) { |
254 | | - $n = $m[1]; |
255 | | - $opt[$n] = $m[2]; |
256 | | - } else { |
257 | | - $opt[$o] = true; |
258 | | - } |
259 | | - } |
260 | | - } */ else { |
| 250 | + } else { |
261 | 251 | throw new MWException( 'Unknown encoding for CategoryTree options: ' . $enc ); |
262 | 252 | } |
263 | 253 | |
— | — | @@ -296,7 +286,7 @@ |
297 | 287 | |
298 | 288 | foreach ( $this->mOptions as $k => $v ) { |
299 | 289 | if ( $u != '' ) $u .= '&'; |
300 | | - $u .= $k . '=' . urlencode($v) ; |
| 290 | + $u .= $k . '=' . urlencode( $v ) ; |
301 | 291 | } |
302 | 292 | |
303 | 293 | return $u; |
— | — | @@ -307,11 +297,16 @@ |
308 | 298 | * load CategoryTreeFunctions.php on demand. |
309 | 299 | */ |
310 | 300 | function ajax( $category, $depth = 1 ) { |
311 | | - global $wgDBname; |
| 301 | + global $wgDBname, $wgUser; |
312 | 302 | $title = self::makeTitle( $category ); |
313 | 303 | |
314 | | - if ( ! $title ) return false; #TODO: error message? |
| 304 | + if ( ! $title ) { |
| 305 | + return false; # TODO: error message? |
| 306 | + } |
315 | 307 | |
| 308 | + # configkey needed to take into account variant and secure options. |
| 309 | + $configkey = $wgUser->getPageRenderingHash(); |
| 310 | + |
316 | 311 | # Retrieve page_touched for the category |
317 | 312 | $dbkey = $title->getDBkey(); |
318 | 313 | $dbr = wfGetDB( DB_SLAVE ); |
— | — | @@ -321,7 +316,7 @@ |
322 | 317 | 'page_title' => $dbkey, |
323 | 318 | ), __METHOD__ ); |
324 | 319 | |
325 | | - $mckey = "$wgDBname:categorytree(" . $this->getOptionsAsCacheKey( $depth ) . "):$dbkey"; |
| 320 | + $mckey = "$wgDBname:categorytree(" . $this->getOptionsAsCacheKey( $depth ) . "):$dbkey:$configkey"; |
326 | 321 | |
327 | 322 | $response = new AjaxResponse(); |
328 | 323 | |
— | — | @@ -333,10 +328,13 @@ |
334 | 329 | return $response; |
335 | 330 | } |
336 | 331 | |
337 | | - $html = $this->renderChildren( $title, $depth ); |
| 332 | + $html = $this->renderChildren( $title, $depth ); |
338 | 333 | |
339 | | - if ( $html == '' ) $html = ' '; #HACK: Safari doesn't like empty responses. |
340 | | - #see Bug 7219 and http://bugzilla.opendarwin.org/show_bug.cgi?id=10716 |
| 334 | + if ( $html == '' ) { |
| 335 | + # HACK: Safari doesn't like empty responses. |
| 336 | + # see Bug 7219 and http://bugzilla.opendarwin.org/show_bug.cgi?id=10716 |
| 337 | + $html = ' '; |
| 338 | + } |
341 | 339 | |
342 | 340 | $response->addText( $html ); |
343 | 341 | |
— | — | @@ -349,7 +347,7 @@ |
350 | 348 | * Custom tag implementation. This is called by efCategoryTreeParserHook, which is used to |
351 | 349 | * load CategoryTreeFunctions.php on demand. |
352 | 350 | */ |
353 | | - function getTag( $parser, $category, $hideroot = false, $attr, $depth=1, $allowMissing = false ) { |
| 351 | + function getTag( $parser, $category, $hideroot = false, $attr, $depth = 1, $allowMissing = false ) { |
354 | 352 | global $wgCategoryTreeDisableCache, $wgCategoryTreeDynamicTag; |
355 | 353 | static $uniq = 0; |
356 | 354 | |
— | — | @@ -357,24 +355,29 @@ |
358 | 356 | if ( $category === '' ) { |
359 | 357 | return false; |
360 | 358 | } |
| 359 | + |
361 | 360 | if ( $parser && $wgCategoryTreeDisableCache && !$wgCategoryTreeDynamicTag ) { |
362 | 361 | $parser->disableCache(); |
363 | 362 | } |
| 363 | + |
364 | 364 | $title = self::makeTitle( $category ); |
365 | 365 | |
366 | | - if ( $title === false || $title === null ) return false; |
| 366 | + if ( $title === false || $title === null ) { |
| 367 | + return false; |
| 368 | + } |
367 | 369 | |
368 | | - if ( isset( $attr['class'] ) ) $attr['class'] .= ' CategoryTreeTag'; |
369 | | - else $attr['class'] = ' CategoryTreeTag'; |
| 370 | + if ( isset( $attr['class'] ) ) { |
| 371 | + $attr['class'] .= ' CategoryTreeTag'; |
| 372 | + } else { |
| 373 | + $attr['class'] = ' CategoryTreeTag'; |
| 374 | + } |
370 | 375 | |
371 | | - $this->init(); |
372 | | - |
373 | 376 | $html = ''; |
374 | 377 | $html .= Xml::openElement( 'div', $attr ); |
375 | 378 | |
376 | 379 | if ( !$allowMissing && !$title->getArticleID() ) { |
377 | 380 | $html .= Xml::openElement( 'span', array( 'class' => 'CategoryTreeNotice' ) ); |
378 | | - if( $parser ) { |
| 381 | + if ( $parser ) { |
379 | 382 | $html .= $parser->recursiveTagParse( wfMsgNoTrans( 'categorytree-not-found', $category ) ); |
380 | 383 | } else { |
381 | 384 | $html .= wfMsgExt( 'categorytree-not-found', 'parseinline', htmlspecialchars( $category ) ); |
— | — | @@ -382,9 +385,11 @@ |
383 | 386 | $html .= Xml::closeElement( 'span' ); |
384 | 387 | } |
385 | 388 | else { |
386 | | - if ( !$hideroot ) $html .= CategoryTree::renderNode( $title, $depth, $wgCategoryTreeDynamicTag ); |
387 | | - else if ( !$wgCategoryTreeDynamicTag ) $html .= $this->renderChildren( $title, $depth ); |
388 | | - else { |
| 389 | + if ( !$hideroot ) { |
| 390 | + $html .= CategoryTree::renderNode( $title, $depth, $wgCategoryTreeDynamicTag ); |
| 391 | + } else if ( !$wgCategoryTreeDynamicTag ) { |
| 392 | + $html .= $this->renderChildren( $title, $depth ); |
| 393 | + } else { |
389 | 394 | $uniq += 1; |
390 | 395 | $load = 'ct-' . $uniq . '-' . mt_rand( 1, 100000 ); |
391 | 396 | |
— | — | @@ -404,10 +409,10 @@ |
405 | 410 | * Returns a string with an HTML representation of the children of the given category. |
406 | 411 | * $title must be a Title object |
407 | 412 | */ |
408 | | - function renderChildren( &$title, $depth=1 ) { |
| 413 | + function renderChildren( &$title, $depth = 1 ) { |
409 | 414 | global $wgCategoryTreeMaxChildren, $wgCategoryTreeUseCategoryTable; |
410 | 415 | |
411 | | - if( $title->getNamespace() != NS_CATEGORY ) { |
| 416 | + if ( $title->getNamespace() != NS_CATEGORY ) { |
412 | 417 | // Non-categories can't have children. :) |
413 | 418 | return ''; |
414 | 419 | } |
— | — | @@ -415,8 +420,8 @@ |
416 | 421 | $dbr = wfGetDB( DB_SLAVE ); |
417 | 422 | |
418 | 423 | $inverse = $this->isInverse(); |
419 | | - $mode = $this->getOption('mode'); |
420 | | - $namespaces = $this->getOption('namespaces'); |
| 424 | + $mode = $this->getOption( 'mode' ); |
| 425 | + $namespaces = $this->getOption( 'namespaces' ); |
421 | 426 | |
422 | 427 | if ( $inverse ) { |
423 | 428 | $ctJoinCond = ' ON cl_to = cat.page_title AND cat.page_namespace = ' . NS_CATEGORY; |
— | — | @@ -429,20 +434,27 @@ |
430 | 435 | $ctWhere = ' cl_to = ' . $dbr->addQuotes( $title->getDBkey() ); |
431 | 436 | $ctJoin = ' JOIN '; |
432 | 437 | |
433 | | - #namespace filter. |
| 438 | + # namespace filter. |
434 | 439 | if ( $namespaces ) { |
435 | | - #NOTE: we assume that the $namespaces array contains only integers! decodeNamepsaces makes it so. |
436 | | - if ( sizeof( $namespaces ) === 1 ) $nsmatch = ' AND cat.page_namespace = ' . $namespaces[0] . ' '; |
437 | | - else $nsmatch = ' AND cat.page_namespace IN ( ' . implode( ', ', $namespaces ) . ') '; |
| 440 | + # NOTE: we assume that the $namespaces array contains only integers! decodeNamepsaces makes it so. |
| 441 | + if ( sizeof( $namespaces ) === 1 ) { |
| 442 | + $nsmatch = ' AND cat.page_namespace = ' . $namespaces[0] . ' '; |
| 443 | + } else { |
| 444 | + $nsmatch = ' AND cat.page_namespace IN ( ' . implode( ', ', $namespaces ) . ') '; |
| 445 | + } |
438 | 446 | } |
439 | 447 | else { |
440 | | - if ( $mode == CT_MODE_ALL ) $nsmatch = ''; |
441 | | - else if ( $mode == CT_MODE_PAGES ) $nsmatch = ' AND cat.page_namespace != ' . NS_IMAGE; |
442 | | - else $nsmatch = ' AND cat.page_namespace = ' . NS_CATEGORY; |
| 448 | + if ( $mode == CT_MODE_ALL ) { |
| 449 | + $nsmatch = ''; |
| 450 | + } else if ( $mode == CT_MODE_PAGES ) { |
| 451 | + $nsmatch = ' AND cat.page_namespace != ' . NS_IMAGE; |
| 452 | + } else { |
| 453 | + $nsmatch = ' AND cat.page_namespace = ' . NS_CATEGORY; |
| 454 | + } |
443 | 455 | } |
444 | 456 | } |
445 | 457 | |
446 | | - #additional stuff to be used if "transaltion" by interwiki-links is desired |
| 458 | + # additional stuff to be used if "transaltion" by interwiki-links is desired |
447 | 459 | $transFields = ''; |
448 | 460 | $transJoin = ''; |
449 | 461 | $transWhere = ''; |
— | — | @@ -472,25 +484,24 @@ |
473 | 485 | $countJoin |
474 | 486 | WHERE $ctWhere |
475 | 487 | $nsmatch |
476 | | - "./*AND cat.page_is_redirect = 0*/" |
| 488 | + " . /*AND cat.page_is_redirect = 0*/" |
477 | 489 | $transWhere |
478 | 490 | ORDER BY cl_sortkey"; |
479 | | - $sql = $dbr->limitResult($sql, (int)$wgCategoryTreeMaxChildren); |
480 | | - |
| 491 | + $sql = $dbr->limitResult( $sql, (int)$wgCategoryTreeMaxChildren ); |
| 492 | + |
481 | 493 | $res = $dbr->query( $sql, __METHOD__ ); |
482 | 494 | |
483 | | - #collect categories separately from other pages |
484 | | - $categories= ''; |
485 | | - $other= ''; |
| 495 | + # collect categories separately from other pages |
| 496 | + $categories = ''; |
| 497 | + $other = ''; |
486 | 498 | |
487 | 499 | while ( $row = $dbr->fetchObject( $res ) ) { |
488 | | - #NOTE: in inverse mode, the page record may be null, because we use a right join. |
| 500 | + # NOTE: in inverse mode, the page record may be null, because we use a right join. |
489 | 501 | # happens for categories with no category page (red cat links) |
490 | 502 | if ( $inverse && $row->page_title === null ) { |
491 | 503 | $t = Title::makeTitle( NS_CATEGORY, $row->cl_to ); |
492 | | - } |
493 | | - else { |
494 | | - #TODO: translation support; ideally added to Title object |
| 504 | + } else { |
| 505 | + # TODO: translation support; ideally added to Title object |
495 | 506 | $t = Title::newFromRow( $row ); |
496 | 507 | } |
497 | 508 | |
— | — | @@ -500,11 +511,14 @@ |
501 | 512 | $cat = Category::newFromRow( $row, $t ); |
502 | 513 | } |
503 | 514 | |
504 | | - $s = $this->renderNodeInfo( $t, $cat, $depth-1, false ); |
| 515 | + $s = $this->renderNodeInfo( $t, $cat, $depth -1, false ); |
505 | 516 | $s .= "\n\t\t"; |
506 | 517 | |
507 | | - if ($row->page_namespace == NS_CATEGORY) $categories .= $s; |
508 | | - else $other .= $s; |
| 518 | + if ( $row->page_namespace == NS_CATEGORY ) { |
| 519 | + $categories .= $s; |
| 520 | + } else { |
| 521 | + $other .= $s; |
| 522 | + } |
509 | 523 | } |
510 | 524 | |
511 | 525 | $dbr->freeResult( $res ); |
— | — | @@ -521,7 +535,7 @@ |
522 | 536 | |
523 | 537 | $dbr = wfGetDB( DB_SLAVE ); |
524 | 538 | |
525 | | - #additional stuff to be used if "transaltion" by interwiki-links is desired |
| 539 | + # additional stuff to be used if "transaltion" by interwiki-links is desired |
526 | 540 | $transFields = ''; |
527 | 541 | $transJoin = ''; |
528 | 542 | $transWhere = ''; |
— | — | @@ -534,23 +548,23 @@ |
535 | 549 | WHERE cl_from = " . $title->getArticleID() . " |
536 | 550 | $transWhere |
537 | 551 | ORDER BY cl_to"; |
538 | | - $sql = $dbr->limitResult($sql, (int)$wgCategoryTreeMaxChildren); |
| 552 | + $sql = $dbr->limitResult( $sql, (int)$wgCategoryTreeMaxChildren ); |
539 | 553 | |
540 | 554 | $res = $dbr->query( $sql, __METHOD__ ); |
541 | 555 | |
542 | 556 | $special = Title::makeTitle( NS_SPECIAL, 'CategoryTree' ); |
543 | 557 | |
544 | | - $s= ''; |
| 558 | + $s = ''; |
545 | 559 | |
546 | 560 | while ( $row = $dbr->fetchObject( $res ) ) { |
547 | | - #TODO: translation support; ideally added to Title object |
| 561 | + # TODO: translation support; ideally added to Title object |
548 | 562 | $t = Title::newFromRow( $row ); |
549 | 563 | |
550 | | - #$trans = $title->getLocalizedText(); |
551 | | - $trans = ''; #place holder for when translated titles are available |
| 564 | + # $trans = $title->getLocalizedText(); |
| 565 | + $trans = ''; # place holder for when translated titles are available |
552 | 566 | |
553 | 567 | $label = htmlspecialchars( $t->getText() ); |
554 | | - if ( $trans && $trans!=$label ) $label.= ' ' . Xml::element( 'i', array( 'class' => 'translation'), $trans ); |
| 568 | + if ( $trans && $trans != $label ) $label .= ' ' . Xml::element( 'i', array( 'class' => 'translation' ), $trans ); |
555 | 569 | |
556 | 570 | $wikiLink = $special->getLocalURL( 'target=' . $t->getPartialURL() . '&' . $this->getOptionsAsUrlParameters() ); |
557 | 571 | |
— | — | @@ -577,8 +591,9 @@ |
578 | 592 | |
579 | 593 | if ( $wgCategoryTreeUseCategoryTable && $title->getNamespace() == NS_CATEGORY && !$this->isInverse() ) { |
580 | 594 | $cat = Category::newFromTitle( $title ); |
| 595 | + } else { |
| 596 | + $cat = null; |
581 | 597 | } |
582 | | - else $cat = NULL; |
583 | 598 | |
584 | 599 | return $this->renderNodeInfo( $title, $cat, $children, $loadchildren ); |
585 | 600 | } |
— | — | @@ -588,11 +603,10 @@ |
589 | 604 | * $info must be an associative array, containing at least a Title object under the 'title' key. |
590 | 605 | */ |
591 | 606 | function renderNodeInfo( $title, $cat, $children = 0, $loadchildren = false ) { |
| 607 | + global $wgCategoryTreeMaxScanRows; |
592 | 608 | static $uniq = 0; |
593 | 609 | |
594 | | - $this->init(); # initialize messages |
595 | | - |
596 | | - $mode = $this->getOption('mode'); |
| 610 | + $mode = $this->getOption( 'mode' ); |
597 | 611 | $load = false; |
598 | 612 | |
599 | 613 | if ( $children > 0 && $loadchildren ) { |
— | — | @@ -604,22 +618,32 @@ |
605 | 619 | $ns = $title->getNamespace(); |
606 | 620 | $key = $title->getDBkey(); |
607 | 621 | |
608 | | - #$trans = $title->getLocalizedText(); |
609 | | - $trans = ''; #place holder for when translated titles are available |
| 622 | + # $trans = $title->getLocalizedText(); |
| 623 | + $trans = ''; # place holder for when translated titles are available |
610 | 624 | |
611 | | - $hideprefix = $this->getOption('hideprefix'); |
| 625 | + $hideprefix = $this->getOption( 'hideprefix' ); |
612 | 626 | |
613 | | - if ( $hideprefix == CT_HIDEPREFIX_ALWAYS ) $hideprefix = true; |
614 | | - else if ( $hideprefix == CT_HIDEPREFIX_AUTO ) $hideprefix = ($mode == CT_MODE_CATEGORIES); |
615 | | - else if ( $hideprefix == CT_HIDEPREFIX_CATEGORIES ) $hideprefix = ($ns == NS_CATEGORY); |
616 | | - else $hideprefix = true; |
| 627 | + if ( $hideprefix == CT_HIDEPREFIX_ALWAYS ) { |
| 628 | + $hideprefix = true; |
| 629 | + } else if ( $hideprefix == CT_HIDEPREFIX_AUTO ) { |
| 630 | + $hideprefix = ( $mode == CT_MODE_CATEGORIES ); |
| 631 | + } else if ( $hideprefix == CT_HIDEPREFIX_CATEGORIES ) { |
| 632 | + $hideprefix = ( $ns == NS_CATEGORY ); |
| 633 | + } else { |
| 634 | + $hideprefix = true; |
| 635 | + } |
617 | 636 | |
618 | | - #when showing only categories, omit namespace in label unless we explicitely defined the configuration setting |
619 | | - #patch contributed by Manuel Schneider <manuel.schneider@wikimedia.ch>, Bug 8011 |
620 | | - if ( $hideprefix ) $label = htmlspecialchars( $title->getText() ); |
621 | | - else $label = htmlspecialchars( $title->getPrefixedText() ); |
| 637 | + # when showing only categories, omit namespace in label unless we explicitely defined the configuration setting |
| 638 | + # patch contributed by Manuel Schneider <manuel.schneider@wikimedia.ch>, Bug 8011 |
| 639 | + if ( $hideprefix ) { |
| 640 | + $label = htmlspecialchars( $title->getText() ); |
| 641 | + } else { |
| 642 | + $label = htmlspecialchars( $title->getPrefixedText() ); |
| 643 | + } |
622 | 644 | |
623 | | - if ( $trans && $trans!=$label ) $label.= ' ' . Xml::element( 'i', array( 'class' => 'translation'), $trans ); |
| 645 | + if ( $trans && $trans != $label ) { |
| 646 | + $label .= ' ' . Xml::element( 'i', array( 'class' => 'translation' ), $trans ); |
| 647 | + } |
624 | 648 | |
625 | 649 | $labelClass = 'CategoryTreeLabel ' . ' CategoryTreeLabelNs' . $ns; |
626 | 650 | |
— | — | @@ -636,12 +660,14 @@ |
637 | 661 | $labelClass .= ' CategoryTreeLabelPage'; |
638 | 662 | } |
639 | 663 | |
640 | | - if ( ( $ns % 2 ) > 0 ) $labelClass .= ' CategoryTreeLabelTalk'; |
| 664 | + if ( ( $ns % 2 ) > 0 ) { |
| 665 | + $labelClass .= ' CategoryTreeLabelTalk'; |
| 666 | + } |
641 | 667 | |
642 | 668 | $count = false; |
643 | 669 | $s = ''; |
644 | 670 | |
645 | | - #NOTE: things in CategoryTree.js rely on the exact order of tags! |
| 671 | + # NOTE: things in CategoryTree.js rely on the exact order of tags! |
646 | 672 | # Specifically, the CategoryTreeChildren div must be the first |
647 | 673 | # sibling with nodeName = DIV of the grandparent of the expland link. |
648 | 674 | |
— | — | @@ -649,57 +675,66 @@ |
650 | 676 | $s .= Xml::openElement( 'div', array( 'class' => 'CategoryTreeItem' ) ); |
651 | 677 | |
652 | 678 | $attr = array( 'class' => 'CategoryTreeBullet' ); |
653 | | - $s .= Xml::openElement( 'span', $attr ); |
654 | 679 | |
| 680 | + # Get counts, with conversion to integer so === works |
| 681 | + $pageCount = intval( $cat->getPageCount() ); |
| 682 | + $subcatCount = intval( $cat->getSubcatCount() ); |
| 683 | + $fileCount = intval( $cat->getFileCount() ); |
| 684 | + |
655 | 685 | if ( $ns == NS_CATEGORY ) { |
| 686 | + |
656 | 687 | if ( $cat ) { |
657 | | - if ( $mode == CT_MODE_CATEGORIES ) $count = $cat->getSubcatCount(); |
658 | | - else if ( $mode == CT_MODE_PAGES ) $count = $cat->getPageCount() - $cat->getFileCount(); |
659 | | - else $count = $cat->getPageCount(); |
| 688 | + if ( $mode == CT_MODE_CATEGORIES ) { |
| 689 | + $count = $subcatCount; |
| 690 | + } else if ( $mode == CT_MODE_PAGES ) { |
| 691 | + $count = $pageCount - $fileCount; |
| 692 | + } else { |
| 693 | + $count = $pageCount; |
| 694 | + } |
660 | 695 | } |
661 | | - |
662 | | - $linkattr= array( ); |
663 | | - if ( $load ) $linkattr[ 'id' ] = $load; |
| 696 | + if ( $count === 0 || $pageCount > $wgCategoryTreeMaxScanRows ) { |
| 697 | + $bullet = wfMsgNoTrans( 'categorytree-empty-bullet' ) . ' '; |
| 698 | + $attr['class'] = 'CategoryTreeEmptyBullet'; |
| 699 | + } else { |
| 700 | + $linkattr = array( ); |
| 701 | + if ( $load ) { |
| 702 | + $linkattr[ 'id' ] = $load; |
| 703 | + } |
664 | 704 | |
665 | | - $linkattr[ 'class' ] = "CategoryTreeToggle"; |
666 | | - $linkattr['style'] = 'display: none;'; // Unhidden by JS |
| 705 | + $linkattr[ 'class' ] = "CategoryTreeToggle"; |
| 706 | + $linkattr['style'] = 'display: none;'; // Unhidden by JS |
667 | 707 | |
668 | | - /*if ( $count === 0 ) { |
669 | | - $tag = 'span'; |
670 | | - $txt = wfMsgNoTrans( 'categorytree-empty-bullet' ); |
| 708 | + if ( $children == 0 || $loadchildren ) { |
| 709 | + $tag = 'span'; |
| 710 | + $txt = wfMsgNoTrans( 'categorytree-expand-bullet' ); |
| 711 | + $linkattr[ 'onclick' ] = "if (this.href) this.href='javascript:void(0)'; categoryTreeExpandNode('" . Xml::escapeJsString( $key ) . "'," . $this->getOptionsAsJsStructure() . ",this);"; |
| 712 | + # Don't load this message for ajax requests, so that we don't have to initialise $wgLang |
| 713 | + $linkattr[ 'title' ] = $this->mIsAjaxRequest ? '##LOAD##' : wfMsgNoTrans( 'categorytree-expand' ); |
| 714 | + } else { |
| 715 | + $tag = 'span'; |
| 716 | + $txt = wfMsgNoTrans( 'categorytree-collapse-bullet' ); |
| 717 | + $linkattr[ 'onclick' ] = "if (this.href) this.href='javascript:void(0)'; categoryTreeCollapseNode('" . Xml::escapeJsString( $key ) . "'," . $this->getOptionsAsJsStructure() . ",this);"; |
| 718 | + $linkattr[ 'title' ] = wfMsgNoTrans( 'categorytree-collapse' ); |
| 719 | + $linkattr[ 'class' ] .= ' CategoryTreeLoaded'; |
| 720 | + } |
| 721 | + |
| 722 | + if ( $tag == 'a' ) { |
| 723 | + $linkattr[ 'href' ] = $wikiLink; |
| 724 | + } |
| 725 | + $bullet = Xml::openElement( $tag, $linkattr ) . $txt . Xml::closeElement( $tag ) . ' '; |
671 | 726 | } |
672 | | - else*/ |
673 | | - if ( $children == 0 || $loadchildren ) { |
674 | | - $tag = 'span'; |
675 | | - if ( $count === 0 ) $txt = wfMsgNoTrans( 'categorytree-empty-bullet' ); |
676 | | - else $txt = wfMsgNoTrans( 'categorytree-expand-bullet' ); |
677 | | - $linkattr[ 'onclick' ] = "if (this.href) this.href='javascript:void(0)'; categoryTreeExpandNode('".Xml::escapeJsString($key)."',".$this->getOptionsAsJsStructure().",this);"; |
678 | | - # Don't load this message for ajax requests, so that we don't have to initialise $wgLang |
679 | | - $linkattr[ 'title' ] = $this->mIsAjaxRequest ? '##LOAD##' : wfMsgNoTrans('categorytree-expand'); |
680 | | - } |
681 | | - else { |
682 | | - $tag = 'span'; |
683 | | - $txt = wfMsgNoTrans( 'categorytree-collapse-bullet' ); |
684 | | - $linkattr[ 'onclick' ] = "if (this.href) this.href='javascript:void(0)'; categoryTreeCollapseNode('".Xml::escapeJsString($key)."',".$this->getOptionsAsJsStructure().",this);"; |
685 | | - $linkattr[ 'title' ] = wfMsgNoTrans('categorytree-collapse'); |
686 | | - $linkattr[ 'class' ] .= ' CategoryTreeLoaded'; |
687 | | - } |
688 | | - |
689 | | - if ( $tag == 'a' ) $linkattr[ 'href' ] = $wikiLink; |
690 | | - $s .= Xml::openElement( $tag, $linkattr ) . $txt . Xml::closeElement( $tag ) . ' '; |
691 | 727 | } else { |
692 | | - $s .= wfMsgNoTrans( 'categorytree-page-bullet' ); |
| 728 | + $bullet = wfMsgNoTrans( 'categorytree-page-bullet' ); |
693 | 729 | } |
| 730 | + $s .= Xml::tags( 'span', $attr, $bullet ) . ' '; |
694 | 731 | |
695 | | - $s .= Xml::closeElement( 'span' ); |
696 | | - |
697 | 732 | $s .= Xml::openElement( 'a', array( 'class' => $labelClass, 'href' => $wikiLink ) ) . $label . Xml::closeElement( 'a' ); |
698 | 733 | |
699 | 734 | if ( $count !== false && $this->getOption( 'showcount' ) ) { |
700 | | - $pages = $cat->getPageCount() - $cat->getSubcatCount() - $cat->getFileCount(); |
| 735 | + $pages = $pageCount - $subcatCount - $fileCount; |
701 | 736 | |
702 | 737 | $attr = array( |
703 | | - 'title' => wfMsgExt( 'categorytree-member-counts', 'parsemag', $cat->getSubcatCount(), $pages , $cat->getFileCount(), $cat->getPageCount(), $count ) |
| 738 | + 'title' => wfMsgExt( 'categorytree-member-counts', 'parsemag', $subcatCount, $pages , $fileCount, $pageCount, $count ) |
704 | 739 | ); |
705 | 740 | |
706 | 741 | $s .= ' '; |
— | — | @@ -707,25 +742,30 @@ |
708 | 743 | $s .= Xml::tags( 'span', $attr, |
709 | 744 | wfMsgExt( 'categorytree-member-num', |
710 | 745 | array( 'parsemag', 'escapenoentities' ), |
711 | | - $cat->getSubcatCount(), |
| 746 | + $subcatCount, |
712 | 747 | $pages, |
713 | | - $cat->getFileCount(), |
714 | | - $cat->getPageCount(), |
| 748 | + $fileCount, |
| 749 | + $pageCount, |
715 | 750 | $wgLang->formatNum( $count ) ) ); |
716 | 751 | } |
717 | 752 | |
718 | 753 | $s .= Xml::closeElement( 'div' ); |
719 | 754 | $s .= "\n\t\t"; |
720 | 755 | $s .= Xml::openElement( 'div', array( 'class' => 'CategoryTreeChildren', 'style' => $children > 0 ? "display:block" : "display:none" ) ); |
721 | | - |
722 | | - if ( $ns == NS_CATEGORY && $children > 0 && !$loadchildren) { |
| 756 | + |
| 757 | + if ( $ns == NS_CATEGORY && $children > 0 && !$loadchildren ) { |
723 | 758 | $children = $this->renderChildren( $title, $children ); |
724 | 759 | if ( $children == '' ) { |
725 | 760 | $s .= Xml::openElement( 'i', array( 'class' => 'CategoryTreeNotice' ) ); |
726 | | - if ( $mode == CT_MODE_CATEGORIES ) $s .= wfMsgExt( 'categorytree-no-subcategories', 'parsemag'); |
727 | | - else if ( $mode == CT_MODE_PAGES ) $s .= wfMsgExt( 'categorytree-no-pages', 'parsemag'); |
728 | | - else if ( $mode == CT_MODE_PARENTS ) $s .= wfMsgExt( 'categorytree-no-parent-categories', 'parsemag'); |
729 | | - else $s .= wfMsgExt( 'categorytree-nothing-found', 'parsemag'); |
| 761 | + if ( $mode == CT_MODE_CATEGORIES ) { |
| 762 | + $s .= wfMsgExt( 'categorytree-no-subcategories', 'parsemag' ); |
| 763 | + } else if ( $mode == CT_MODE_PAGES ) { |
| 764 | + $s .= wfMsgExt( 'categorytree-no-pages', 'parsemag' ); |
| 765 | + } else if ( $mode == CT_MODE_PARENTS ) { |
| 766 | + $s .= wfMsgExt( 'categorytree-no-parent-categories', 'parsemag' ); |
| 767 | + } else { |
| 768 | + $s .= wfMsgExt( 'categorytree-nothing-found', 'parsemag' ); |
| 769 | + } |
730 | 770 | $s .= Xml::closeElement( 'i' ); |
731 | 771 | } else { |
732 | 772 | $s .= $children; |
— | — | @@ -738,7 +778,7 @@ |
739 | 779 | if ( $load ) { |
740 | 780 | $s .= "\n\t\t"; |
741 | 781 | $s .= Xml::openElement( 'script', array( 'type' => 'text/javascript' ) ); |
742 | | - $s .= 'categoryTreeExpandNode("'.Xml::escapeJsString($key).'", '.$this->getOptionsAsJsStructure($children).', document.getElementById("'.$load.'"));'; |
| 782 | + $s .= 'categoryTreeExpandNode("' . Xml::escapeJsString( $key ) . '", ' . $this->getOptionsAsJsStructure( $children ) . ', document.getElementById("' . $load . '"));'; |
743 | 783 | $s .= Xml::closeElement( 'script' ); |
744 | 784 | } |
745 | 785 | |
— | — | @@ -753,7 +793,7 @@ |
754 | 794 | static function makeTitle( $title ) { |
755 | 795 | global $wgContLang, $wgCanonicalNamespaceNames; |
756 | 796 | |
757 | | - $title = trim($title); |
| 797 | + $title = trim( $title ); |
758 | 798 | |
759 | 799 | if ( $title === null || $title === '' || $title === false ) { |
760 | 800 | return null; |
— | — | @@ -768,18 +808,4 @@ |
769 | 809 | } |
770 | 810 | return $t; |
771 | 811 | } |
772 | | - |
773 | | - /** |
774 | | - * Initialize. Load messages, if not ajax request. |
775 | | - */ |
776 | | - static function init( ) { |
777 | | - static $initialized = false; |
778 | | - if ( $initialized ) return; |
779 | | - $initialized = true; |
780 | | - |
781 | | - #NOTE: don't load messages for ajax requests. Ajax requests are cachable and language-neutral. |
782 | | - # Messages used in JS are defined by setHeaders |
783 | | - if ( !isset( $this ) || !$this->mIsAjaxRequest ) |
784 | | - wfLoadExtensionMessages( 'CategoryTree' ); |
785 | | - } |
786 | 812 | } |
Index: branches/wmf/1.16wmf4/extensions/CategoryTree/README |
— | — | @@ -16,4 +16,3 @@ |
17 | 17 | |
18 | 18 | Instructions on installing and using this extension are available at |
19 | 19 | <http://www.mediawiki.org/wiki/Extension:CategoryTree> |
20 | | - |
Property changes on: branches/wmf/1.16wmf4/extensions/CategoryTree |
___________________________________________________________________ |
Name: svn:mergeinfo |
21 | 20 | + /branches/wmf-deployment/extensions/CategoryTree:60970 |
/trunk/extensions/CategoryTree:62820-67179 |
/trunk/phase3/extensions/CategoryTree:63545-63546,63549,63643,63764,63897-63901,64113,64509,65387,65391,65555,65590,65650,65816 |