MediaWiki r18943 - Code Review

Jump to: navigation, search
Repository:MediaWiki
Revision:r18942‎ | r18943 (on ViewVC)‎ | r18944 >
Date:22:31, 7 January 2007
Author:hashar
Status:old
Tags:
Comment:
Implements #7667 : allow XHTML namespaces customization. Patch by Evan Miller
Modified paths:

Diff [purge]

Index: trunk/phase3/skins/MonoBook.php
@@ -51,7 +51,10 @@
5252 wfSuppressWarnings();
5353
5454 ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
55 -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php $this->text('lang') ?>" lang="<?php $this->text('lang') ?>" dir="<?php $this->text('dir') ?>">
 55+<html xmlns="<?php $this->text('xhtmldefaultnamespace') ?>" <?php
 56+ foreach($this->data['xhtmlnamespaces'] as $tag => $ns) {
 57+ ?>xmlns:<?php echo "{$tag}=\"{$ns}\" ";
 58+ } ?>xml:lang="<?php $this->text('lang') ?>" lang="<?php $this->text('lang') ?>" dir="<?php $this->text('dir') ?>">
5659 <head>
5760 <meta http-equiv="Content-Type" content="<?php $this->text('mimetype') ?>; charset=<?php $this->text('charset') ?>" />
5861 <?php $this->html('headlinks') ?>
Index: trunk/phase3/includes/OutputPage.php
@@ -1043,6 +1043,7 @@
10441044 */
10451045 public function headElement() {
10461046 global $wgDocType, $wgDTD, $wgContLanguageCode, $wgOutputEncoding, $wgMimeType;
 1047+ global $wgXhtmlDefaultNamespace, $wgXhtmlNamespaces;
10471048 global $wgUser, $wgContLang, $wgUseTrackbacks, $wgTitle, $wgStyleVersion;
10481049
10491050 if( $wgMimeType == 'text/xml' || $wgMimeType == 'application/xhtml+xml' || $wgMimeType == 'application/xml' ) {
@@ -1058,7 +1059,11 @@
10591060 }
10601061
10611062 $rtl = $wgContLang->isRTL() ? " dir='RTL'" : '';
1062 - $ret .= "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"$wgContLanguageCode\" lang=\"$wgContLanguageCode\" $rtl>\n";
 1063+ $ret .= "<html xmlns=\"{$wgXhtmlDefaultNamespace}\" ";
 1064+ foreach($wgXhtmlNamespaces as $tag => $ns) {
 1065+ $ret .= "xmlns:{$tag}=\"{$ns}\" ";
 1066+ }
 1067+ $ret .= "xml:lang=\"$wgContLanguageCode\" lang=\"$wgContLanguageCode\" $rtl>\n";
10631068 $ret .= "<head>\n<title>" . htmlspecialchars( $this->getHTMLTitle() ) . "</title>\n";
10641069 array_push( $this->mMetatags, array( "http:Content-type", "$wgMimeType; charset={$wgOutputEncoding}" ) );
10651070
Index: trunk/phase3/includes/SkinTemplate.php
@@ -135,6 +135,7 @@
136136 global $wgTitle, $wgArticle, $wgUser, $wgLang, $wgContLang, $wgOut;
137137 global $wgScript, $wgStylePath, $wgContLanguageCode;
138138 global $wgMimeType, $wgJsMimeType, $wgOutputEncoding, $wgRequest;
 139+ global $wgXhtmlDefaultNamespace, $wgXhtmlNamespaces;
139140 global $wgDisableCounters, $wgLogo, $action, $wgFeedClasses, $wgHideInterlanguageLinks;
140141 global $wgMaxCredits, $wgShowCreditsIfMax;
141142 global $wgPageShowWatchingUsers;
@@ -246,6 +247,8 @@
247248 $tpl->set( 'trackbackhtml', null );
248249 }
249250
 251+ $tpl->setRef( 'xhtmldefaultnamespace', $wgXhtmlDefaultNamespace );
 252+ $tpl->set( 'xhtmlnamespaces', $wgXhtmlNamespaces );
250253 $tpl->setRef( 'mimetype', $wgMimeType );
251254 $tpl->setRef( 'jsmimetype', $wgJsMimeType );
252255 $tpl->setRef( 'charset', $wgOutputEncoding );
Index: trunk/phase3/includes/DefaultSettings.php
@@ -687,7 +687,16 @@
688688 $wgJsMimeType = 'text/javascript';
689689 $wgDocType = '-//W3C//DTD XHTML 1.0 Transitional//EN';
690690 $wgDTD = 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd';
 691+$wgXhtmlDefaultNamespace = 'http://www.w3.org/1999/xhtml';
691692
 693+# Permit other namespaces in addition to the w3.org default.
 694+# Use the prefix for the key and the namespace for the value. For
 695+# example:
 696+# $wgXhtmlNamespaces['svg'] = 'http://www.w3.org/2000/svg';
 697+# Normally we wouldn't have to define this in the root <html>
 698+# element, but IE needs it there in some circumstances.
 699+$wgXhtmlNamespaces = array();
 700+
692701 /** Enable to allow rewriting dates in page text.
693702 * DOES NOT FORMAT CORRECTLY FOR MOST LANGUAGES */
694703 $wgUseDynamicDates = false;
Index: trunk/phase3/RELEASE-NOTES
@@ -478,6 +478,7 @@
479479 * (bug 3706) Allow users to be exempted from IP blocks. The ipblock-exempt permission
480480 key has been added to enable this behaviour, by default assigned to sysops.
481481 * (bug 7948) importDump.php now warn that Recentchanges need to be rebuild.
 482+* (bug 7667) allow XHTML namespaces customization
482483
483484
484485 == Languages updated ==