From: Brion Vibber Date: Wed, 24 Nov 2004 10:27:49 +0000 (+0000) Subject: Have Title::makeTitle() do the space to underscore replacement so it can be used... X-Git-Tag: 1.5.0alpha1~1256 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/password.php?a=commitdiff_plain;h=0f31a1a69526fd09ec355a7f8b1ea2f8c75b2700;p=lhc%2Fweb%2Fwiklou.git Have Title::makeTitle() do the space to underscore replacement so it can be used on user_text fields directly without fuss. --- diff --git a/includes/Title.php b/includes/Title.php index d79aa5cd69..2d7f17c090 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -172,6 +172,9 @@ class Title { * Create a new Title from a namespace index and a DB key. * It's assumed that $ns and $title are *valid*, for instance when * they came directly from the database or a special page name. + * For convenience, spaces are converted to underscores so that + * eg user_text fields can be used directly. + * * @param int $ns the namespace of the article * @param string $title the unprefixed database key form * @return Title the new object @@ -183,9 +186,9 @@ class Title { $t->mInterwiki = ''; $t->mFragment = ''; $t->mNamespace = IntVal( $ns ); - $t->mDbkeyform = $title; + $t->mDbkeyform = str_replace( ' ', '_', $title ); $t->mArticleID = ( $ns >= 0 ) ? -1 : 0; - $t->mUrlform = wfUrlencode( $title ); + $t->mUrlform = wfUrlencode( $t->mDbkeyform ); $t->mTextform = str_replace( '_', ' ', $title ); return $t; }