* Added $wgDisableTitleConversion to disabling the conversion for all pages on the wiki (this one is useful for some wikis that do not need the title conversion for the entire wiki like Wiktionary)

* Added 'noconvertlink' toogle that can be set per user preferences, also added 'convertlink=no|yes' on GET requests whether have the link titles being converted or not
  patches by PhiLiP
This commit is contained in:
Shinjiman 2008-08-07 14:26:34 +00:00
parent 20d6c341ce
commit 8d06ad6ee3
12 changed files with 45 additions and 7 deletions

View file

@ -47,6 +47,11 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
* (bug 14377) Add a date selector to history pages
* (bug 15007) New 'pagetitle-view-mainpage' message allows the HTML <title> of
the main page to be customized
* Added $wgDisableTitleConversion to disabling the conversion for all pages on
the wiki
* Added 'noconvertlink' toogle that can be set per user preferences, also
added 'convertlink=no|yes' on GET requests whether have the link titles
being converted or not
=== Bug fixes in 1.14 ===

View file

@ -861,6 +861,9 @@ $wgCheckSerialized = true;
/** Whether to enable language variant conversion. */
$wgDisableLangConversion = false;
/** Whether to enable language variant conversion for links. */
$wgDisableTitleConversion = false;
/** Default variant code, if false, the default will be the language code */
$wgDefaultLanguageVariant = false;
@ -2226,6 +2229,7 @@ $wgDefaultUserOptions = array(
'watchdefault' => 0,
'watchmoves' => 0,
'watchdeletion' => 0,
'convertlink' => 0,
);
/** Whether or not to allow and use real name fields. Defaults to true. */

View file

@ -88,6 +88,7 @@ class User {
'ccmeonemails',
'diffonly',
'showhiddencats',
'noconvertlink',
);
/**

View file

@ -513,7 +513,7 @@ class PreferencesForm {
function mainPrefsForm( $status , $message = '' ) {
global $wgUser, $wgOut, $wgLang, $wgContLang;
global $wgAllowRealName, $wgImageLimits, $wgThumbLimits;
global $wgDisableLangConversion;
global $wgDisableLangConversion, $wgDisableTitleConversion;
global $wgEnotifWatchlist, $wgEnotifUserTalk,$wgEnotifMinorEdits;
global $wgRCShowWatchingUsers, $wgEnotifRevealEditorAddress;
global $wgEnableEmail, $wgEnableUserEmail, $wgEmailAuthentication;
@ -734,6 +734,16 @@ class PreferencesForm {
)
);
}
if(count($variantArray) > 1 && !$wgDisableLangConversion && !$wgDisableTitleConversion) {
$wgOut->addHtml(
Xml::tags( 'tr', null,
Xml::tags( 'td', array( 'colspan' => '2' ),
$this->getToggle( "noconvertlink" )
)
)
);
}
}
# Password

View file

@ -374,8 +374,10 @@ class LanguageConverter {
* @private
*/
function convertTitle($text){
// check for __NOTC__ tag
if( !$this->mDoTitleConvert ) {
global $wgDisableTitleConversion, $wgUser;
// check for global param and __NOTC__ tag
if( $wgDisableTitleConversion || !$this->mDoTitleConvert || $wgUser->getOption('noconvertlink') == 1 ) {
$this->mTitleDisplay = $text;
return $text;
}
@ -389,7 +391,8 @@ class LanguageConverter {
global $wgRequest;
$isredir = $wgRequest->getText( 'redirect', 'yes' );
$action = $wgRequest->getText( 'action' );
if ( $isredir == 'no' || $action == 'edit' ) {
$linkconvert = $wgRequest->getText( 'linkconvert', 'yes' );
if ( $isredir == 'no' || $action == 'edit' || $linkconvert == 'no' ) {
return $text;
} else {
$this->mTitleDisplay = $this->convert($text);
@ -467,11 +470,20 @@ class LanguageConverter {
* @public
*/
function findVariantLink( &$link, &$nt ) {
global $wgDisableLangConversion;
global $wgDisableLangConversion, $wgDisableTitleConversion, $wgRequest, $wgUser;
$isredir = $wgRequest->getText( 'redirect', 'yes' );
$action = $wgRequest->getText( 'action' );
$linkconvert = $wgRequest->getText( 'linkconvert', 'yes' );
$disableLinkConversion = $wgDisableLangConversion || $wgDisableTitleConversion;
$linkBatch = new LinkBatch();
$ns=NS_MAIN;
if ( $disableLinkConversion || $isredir == 'no' || $action == 'edit'
|| $linkconvert == 'no' || $wgUser->getOption('noconvertlink') == 1 ) {
return;
}
if(is_object($nt))
$ns = $nt->getNamespace();
@ -497,8 +509,7 @@ class LanguageConverter {
foreach( $titles as $varnt ) {
if( $varnt->getArticleID() > 0 ) {
$nt = $varnt;
if( !$wgDisableLangConversion )
$link = $v;
$link = $v;
break;
}
}

View file

@ -532,6 +532,7 @@ XHTML id names.
'tog-ccmeonemails' => 'Send me copies of e-mails I send to other users',
'tog-diffonly' => 'Do not show page content below diffs',
'tog-showhiddencats' => 'Show hidden categories',
'tog-noconvertlink' => 'Disable titles conversion', # only translate this message to other languages if you have to change it
'underline-always' => 'Always',
'underline-never' => 'Never',

View file

@ -180,6 +180,7 @@ $messages = array(
'tog-ccmeonemails' => '當我寄電郵畀其他人嗰陣寄返封副本畀我',
'tog-diffonly' => '響差異下面唔顯示頁面內容',
'tog-showhiddencats' => '顯示隱藏類',
'tog-noconvertlink' => '唔轉連結標題',
'underline-always' => '全部',
'underline-never' => '永不',

View file

@ -109,6 +109,7 @@ $messages = array(
'tog-watchlisthideown' => '不哨己文',
'tog-watchlisthidebots' => '不哨僕文',
'tog-showhiddencats' => '示隱類',
'tog-noconvertlink' => '非轉鍵題',
'underline-always' => '恆',
'underline-never' => '絕',

View file

@ -123,6 +123,7 @@ $messages = array(
'tog-ccmeonemails' => '把我发送给其他用户的邮件同时发送副本给我自己',
'tog-diffonly' => '在比较两个修订版本差异时不显示页面内容',
'tog-showhiddencats' => '显示隐藏分类',
'tog-noconvertlink' => '不转换链接标题',
'underline-always' => '总是使用',
'underline-never' => '从不使用',

View file

@ -105,6 +105,7 @@ $messages = array(
'tog-ccmeonemails' => '當我寄電子郵件給其他用戶時,也寄一份複本到我的信箱。',
'tog-diffonly' => '在比較兩個修訂版本差異時不顯示頁面內容',
'tog-showhiddencats' => '顯示隱藏分類',
'tog-noconvertlink' => '不轉換連結標題',
'underline-always' => '總是使用',
'underline-never' => '從不使用',

View file

@ -163,6 +163,7 @@ $wgOptionalMessages = array(
'unit-pixel',
'userrights-irreversible-marker',
'tog-nolangconversion',
'tog-noconvertlink',
'yourvariant',
'variantname-zh-hans',
'variantname-zh-hant',

View file

@ -52,6 +52,7 @@ $wgMessageStructure = array(
'tog-ccmeonemails',
'tog-diffonly',
'tog-showhiddencats',
'tog-noconvertlink',
),
'underline' => array(
'underline-always',