Index: branches/wmf/1.18wmf1/extensions/Babel/Babel.class.php |
— | — | @@ -38,15 +38,15 @@ |
39 | 39 | $template = wfMessage( 'babel-template', $name )->inContentLanguage()->text(); |
40 | 40 | if ( $name === '' ) { |
41 | 41 | continue; |
42 | | - } elseif ( self::mPageExists( $template ) ) { |
43 | | - // Existent template page has precedence |
44 | | - $templateParameters[0] = $template; |
45 | | - $template = implode('|', $templateParameters); |
46 | | - $content .= self::mGenerateNotaBox( $parser->replaceVariables( "{{{$template}}}" ) ); |
47 | 42 | } elseif ( $components !== false ) { |
48 | 43 | // Non-existent page and valid parameter syntax, babel box |
49 | 44 | $content .= self::mGenerateBox( $components['code'], $components['level'] ); |
50 | 45 | $content .= self::mGenerateCategories( $components['code'], $components['level'] ); |
| 46 | + } elseif ( self::mPageExists( $template ) ) { |
| 47 | + // Check for a template |
| 48 | + $templateParameters[0] = $template; |
| 49 | + $template = implode('|', $templateParameters); |
| 50 | + $content .= self::mGenerateNotaBox( $parser->replaceVariables( "{{{$template}}}" ) ); |
51 | 51 | } elseif ( self::mValidTitle( $template ) ) { |
52 | 52 | // Non-existent page and invalid parameter syntax, red link. |
53 | 53 | $content .= self::mGenerateNotaBox( '[['.$template.']]' ); |
— | — | @@ -68,15 +68,10 @@ |
69 | 69 | $top = '! class="mw-babel-header" | ' . $top; |
70 | 70 | } |
71 | 71 | $footer = wfMessage( 'babel-footer', self::$title->getDBkey() )->inContentLanguage(); // TODO: allow user language |
72 | | - if ( $footer->isDisabled() ) { |
73 | | - $footer = ''; |
74 | | - } else { |
75 | | - $footer = $footer->text(); |
76 | | - $url = wfMessage( 'babel-footer-url' )->inContentLanguage(); |
77 | | - if ( ! $url->isDisabled() ) { |
78 | | - $footer = '[['.$url->text().'|'.$footer.']]'; |
79 | | - } |
80 | | - $footer = '! class="mw-babel-footer" | ' . $footer; |
| 72 | + $url = wfMessage( 'babel-footer-url' )->inContentLanguage(); |
| 73 | + $showfooter = ''; |
| 74 | + if ( !$footer->isDisabled() && !$url->isDisabled() ) { |
| 75 | + $showfooter = '! class="mw-babel-footer" | [['.$url->text().'|'.$footer->text().']]'; |
81 | 76 | } |
82 | 77 | $cellspacing = Babel::mHtmlAttrib( 'cellspacing', 'babel-box-cellspacing' ); |
83 | 78 | $cellpadding = Babel::mHtmlAttrib( 'cellpadding', 'babel-box-cellpadding' ); |
— | — | @@ -87,7 +82,7 @@ |
88 | 83 | |- |
89 | 84 | | $content |
90 | 85 | |- |
91 | | -$footer |
| 86 | +$showfooter |
92 | 87 | |} |
93 | 88 | EOT; |
94 | 89 | return $tower; |
— | — | @@ -254,18 +249,18 @@ |
255 | 250 | |
256 | 251 | $text = wfMsgExt( "babel-$level-n", |
257 | 252 | array( 'language' => $language, 'parsemag' ), |
258 | | - $categoryMain, $categoryMain, '', self::$title->getDBkey() |
| 253 | + $categoryLevel, $categoryMain, '', self::$title->getDBkey() |
259 | 254 | ); |
260 | 255 | |
261 | 256 | $fallback = wfMsgExt( "babel-$level-n", |
262 | 257 | array( 'language' => Language::getFallbackfor( $language ), 'parsemag' ), |
263 | | - $categoryMain, $categoryMain, '', self::$title->getDBkey() |
| 258 | + $categoryLevel, $categoryMain, '', self::$title->getDBkey() |
264 | 259 | ); |
265 | 260 | |
266 | 261 | if ( $text == $fallback ) { |
267 | 262 | $text = wfMsgExt( "babel-$level", |
268 | 263 | array( 'language' => $language, 'parsemag' ), |
269 | | - $categoryMain, $categoryMain, $name, self::$title->getDBkey() |
| 264 | + $categoryLevel, $categoryMain, $name, self::$title->getDBkey() |
270 | 265 | ); |
271 | 266 | } |
272 | 267 | |
— | — | @@ -284,12 +279,14 @@ |
285 | 280 | |
286 | 281 | $r = ''; |
287 | 282 | |
288 | | - if ( $wgBabelMainCategory !== false && $wgBabelCategoryNames[$level] !== false ) { |
| 283 | + # Add main category |
| 284 | + if ( $wgBabelMainCategory !== false ) { |
289 | 285 | $category = self::mReplaceCategoryVariables( $wgBabelMainCategory, $code ); |
290 | 286 | $r .= "[[Category:$category|$level]]"; |
291 | 287 | BabelAutoCreate::create( $category, $code ); |
292 | 288 | } |
293 | 289 | |
| 290 | + # Add level category |
294 | 291 | if ( $wgBabelCategoryNames[$level] !== false ) { |
295 | 292 | $category = self::mReplaceCategoryVariables( $wgBabelCategoryNames[$level], $code ); |
296 | 293 | $r .= "[[Category:$category]]"; |