Index: trunk/extensions/LanguageSelector/LanguageSelector.php |
— | — | @@ -32,7 +32,6 @@ |
33 | 33 | define( 'LANGUAGE_SELECTOR_USE_CONTENT_LANG', 0 ); #no detection |
34 | 34 | define( 'LANGUAGE_SELECTOR_PREFER_CONTENT_LANG', 1 ); #use content language if accepted by the client |
35 | 35 | define( 'LANGUAGE_SELECTOR_PREFER_CLIENT_LANG', 2 ); #use language most preferred by the client |
36 | | -define( 'LANGUAGE_SELECTOR_ADJUST_CONTENT', 3 ); |
37 | 36 | |
38 | 37 | /** |
39 | 38 | * Language detection mode for anonymous visitors. |
— | — | @@ -90,32 +89,7 @@ |
91 | 90 | $dir = dirname(__FILE__) . '/'; |
92 | 91 | $wgExtensionMessagesFiles['LanguageSelector'] = $dir . 'LanguageSelector.i18n.php'; |
93 | 92 | $wgJSAutoloadClasses['LanguageSelector'] = 'extensions/LanguageSelector/LanguageSelector.js'; |
94 | | -$wgHooks['BeforeInitialize'][] = 'wfLanguageSelectorAdjustContent'; |
95 | 93 | |
96 | | -function wfLanguageSelectorAdjustContent( &$title, &$article, &$output, &$user, $request, $this ) { |
97 | | - global $wgLanguageSelectorRequestedLanguage, $wgLanguageNames, $wgLanguageSelectorAdjustContent; |
98 | | - if( isset($wgLanguageSelectorRequestedLanguage) && strlen($wgLanguageSelectorRequestedLanguage)>0){ |
99 | | - if( isset($wgLanguageSelectorAdjustContent) && $wgLanguageSelectorAdjustContent=== LANGUAGE_SELECTOR_ADJUST_CONTENT){ |
100 | | - $langstr="/".$wgLanguageSelectorRequestedLanguage; |
101 | | - $searchstr="#/(". implode('|',array_keys($wgLanguageNames)) ."$)#"; |
102 | | - if(preg_match($searchstr,$title->mTextform)){ |
103 | | - $title->mTextform =preg_replace($searchstr,$langstr, $title->mTextform); |
104 | | - $title->mUrlform =preg_replace($searchstr,$langstr, $title->mUrlform); |
105 | | - $title->mDbkeyform =preg_replace($searchstr,$langstr, $title->mDbkeyform); |
106 | | - $title->mUserCaseDBKey =preg_replace($searchstr,$langstr, $title->mUserCaseDBKey); |
107 | | - }else{ |
108 | | - if($_GET['setlang']== $wgLanguageSelectorRequestedLanguage){ |
109 | | - $title->mTextform.=$langstr; |
110 | | - $title->mUrlform.=$langstr; |
111 | | - $title->mDbkeyform.=$langstr; |
112 | | - $title->mUserCaseDBKey.=$langstr; |
113 | | - } |
114 | | - } |
115 | | - } |
116 | | - } |
117 | | - return true; |
118 | | -} |
119 | | - |
120 | 94 | /** |
121 | 95 | * @param $parser Parser |
122 | 96 | * @return bool |