From: Rob Church Date: Sun, 2 Apr 2006 16:19:29 +0000 (+0000) Subject: (bug 5167) Add SUBPAGENAMEE X-Git-Tag: 1.6.0~62 X-Git-Url: http://git.cyclocoop.org/?a=commitdiff_plain;h=9d1d87dbc0d52df9d232f366f43bcea602fea590;p=lhc%2Fweb%2Fwiklou.git (bug 5167) Add SUBPAGENAMEE --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 79408210da..9e5917f676 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -292,7 +292,7 @@ Parser: * (bug 4783) : Fix for "{{ns:0}} does not render" * Improved support for interwiki transclusion * (bug 1850) Image link to nonexistent file fixed. -* (bug 5167) Add {{SUBPAGENAME}} variable +* (bug 5167) Add {{SUBPAGENAME}} and {{SUBPAGENAMEE}} variables Upload: * (bug 2527) Always set destination filename when new file is selected diff --git a/includes/MagicWord.php b/includes/MagicWord.php index 55edbc8e31..b48b5747c1 100644 --- a/includes/MagicWord.php +++ b/includes/MagicWord.php @@ -71,6 +71,7 @@ $magicWords = array( 'MAG_FULLPAGENAMEE', 'MAG_RAW', 'MAG_SUBPAGENAME', + 'MAG_SUBPAGENAMEE', ); if ( ! defined( 'MEDIAWIKI_INSTALL' ) ) wfRunHooks( 'MagicWordMagicWords', array( &$magicWords ) ); @@ -103,7 +104,8 @@ $wgVariableIDs = array( MAG_CURRENTWEEK, MAG_CURRENTDOW, MAG_REVISIONID, - MAG_SUBPAGENAME + MAG_SUBPAGENAME, + MAG_SUBPAGENAMEE ); if ( ! defined( 'MEDIAWIKI_INSTALL' ) ) wfRunHooks( 'MagicWordwgVariableIDs', array( &$wgVariableIDs ) ); diff --git a/includes/Parser.php b/includes/Parser.php index ac06185a6e..1b8a4622a4 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -2083,6 +2083,8 @@ class Parser return $this->mTitle->getPrefixedURL(); case MAG_SUBPAGENAME: return $this->mTitle->getSubpageText(); + case MAG_SUBPAGENAMEE: + return $this->mTitle->getSubpageUrlForm(); case MAG_REVISIONID: return $this->mRevisionId; case MAG_NAMESPACE: diff --git a/includes/Title.php b/includes/Title.php index de575cb1d3..9001c35891 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -687,6 +687,17 @@ class Title { return( $this->mTextform ); } } + + /** + * Get a URL-encoded form of the subpage text + * @return string URL-encoded subpage name + */ + function getSubpageUrlForm() { + $text = $this->getSubpageText(); + $text = wfUrlencode( str_replace( ' ', '_', $text ) ); + $text = str_replace( '%28', '(', str_replace( '%29', ')', $text ) ); # Clean up the URL; per below, this might not be safe + return( $text ); + } /** * Get a URL-encoded title (not an actual URL) including interwiki diff --git a/languages/Language.php b/languages/Language.php index 3eb8fa2a8f..465de238d8 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -229,7 +229,8 @@ $wgLanguageNamesEn =& $wgLanguageNames; MAG_NAMESPACEE => array( 1, 'NAMESPACEE' ), MAG_FULLPAGENAME => array( 1, 'FULLPAGENAME' ), MAG_FULLPAGENAMEE => array( 1, 'FULLPAGENAMEE' ), - MAG_SUBPAGENAME => array( 0, 'SUBPAGENAME' ), + MAG_SUBPAGENAME => array( 0, 'SUBPAGENAME' ), + MAG_SUBPAGENAMEE => array( 0, 'SUBPAGENAMEE' ), MAG_MSG => array( 0, 'MSG:' ), MAG_SUBST => array( 0, 'SUBST:' ), MAG_MSGNW => array( 0, 'MSGNW:' ),