r2974 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r2973‎ | r2974 | r2975 >
Date:04:12, 5 April 2004
Author:vibber
Status:old
Tags:
Comment:
(Pull minor hack from head branch, doesn't change behavior unless set.)

Add $wgCapitalLinks option; if set to false, titles won't be forced to
have an initial capital. This isn't recommended in general, as it will
make "[[Asteroid]]s are..." and "... like [[asteroid]]s." point to
different pages.

It is meant mainly for languages which use the latin alphabet but don't
capitalize at sentence start (mainly conlangs) or for special purposes
where this is needed. This can *break links* and should not be changed
on an existing wiki without careful attention.
Modified paths:
  • /branches/REL1_2/phase3/includes/DefaultSettings.php (modified) (history)
  • /branches/REL1_2/phase3/includes/Title.php (modified) (history)

Diff [purge]

Index: branches/REL1_2/phase3/includes/Title.php
@@ -401,7 +401,7 @@
402402 #
403403 /* private */ function secureAndSplit()
404404 {
405 - global $wgLang, $wgLocalInterwiki;
 405+ global $wgLang, $wgLocalInterwiki, $wgCapitalLinks;
406406 $fname = "Title::secureAndSplit";
407407 wfProfileIn( $fname );
408408
@@ -486,7 +486,9 @@
487487 return false;
488488 }
489489
490 - if( $this->mInterwiki == "") $t = $wgLang->ucfirst( $r );
 490+ if( $wgCapitalLinks && $this->mInterwiki == "") {
 491+ $t = $wgLang->ucfirst( $r );
 492+ }
491493 $this->mDbkeyform = $t;
492494 $this->mUrlform = wfUrlencode( $t );
493495 $this->mTextform = str_replace( "_", " ", $t );
Index: branches/REL1_2/phase3/includes/DefaultSettings.php
@@ -281,4 +281,11 @@
282282 $wgProxyScriptPath = "$IP/proxy_check.php";
283283 $wgProxyMemcExpiry = 86400;
284284
 285+# Set this to false to avoid forcing the first letter of links
 286+# to capitals. WARNING: may break links! This makes links
 287+# COMPLETELY case-sensitive. Links appearing with a capital at
 288+# the beginning of a sentence will *not* go to the same place
 289+# as links in the middle of a sentence using a lowercase initial.
 290+$wgCapitalLinks = true;
 291+
285292 ?>

Status & tagging log