(bug 5167) Add SUBPAGENAMEE
authorRob Church <robchurch@users.mediawiki.org>
Sun, 2 Apr 2006 16:19:29 +0000 (16:19 +0000)
committerRob Church <robchurch@users.mediawiki.org>
Sun, 2 Apr 2006 16:19:29 +0000 (16:19 +0000)
RELEASE-NOTES
includes/MagicWord.php
includes/Parser.php
includes/Title.php
languages/Language.php

index 7940821..9e5917f 100644 (file)
@@ -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
index 55edbc8..b48b574 100644 (file)
@@ -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 ) );
index ac06185..1b8a462 100644 (file)
@@ -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:
index de575cb..9001c35 100644 (file)
@@ -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
index 3eb8fa2..465de23 100644 (file)
@@ -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:'                 ),