r7863 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r7862‎ | r7863 | r7864 >
Date:07:25, 25 March 2005
Author:vibber
Status:old
Tags:
Comment:
* remove 'hover' option; always put in the title attribute on links
* convert 'hightlightbroken' to use CSS switching so we don't need a separate parser cache copy of each page depending on this setting
?-mode falls back to normal rendering in IE 6/win
?-mode looks crappy in IE 5.2/mac :(
Modified paths:
  • /trunk/phase3/includes/Linker.php (modified) (history)
  • /trunk/phase3/includes/Parser.php (modified) (history)
  • /trunk/phase3/includes/Skin.php (modified) (history)
  • /trunk/phase3/includes/SkinTemplate.php (modified) (history)
  • /trunk/phase3/includes/User.php (modified) (history)
  • /trunk/phase3/languages/Language.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/User.php
@@ -1117,7 +1117,6 @@
11181118 // it will always be 0 when this function is called by parsercache.
11191119
11201120 $confstr = $this->getOption( 'math' );
1121 - $confstr .= '!' . $this->getOption( 'highlightbroken' );
11221121 $confstr .= '!' . $this->getOption( 'stubthreshold' );
11231122 $confstr .= '!' . $this->getOption( 'editsection' );
11241123 $confstr .= '!' . $this->getOption( 'editsectiononrightclick' );
Index: trunk/phase3/includes/Linker.php
@@ -23,13 +23,6 @@
2424 function Linker() {
2525 global $wgContLang;
2626 $this->linktrail = $wgContLang->linkTrail();
27 -
28 - # Cache option lookups done very frequently
29 - $options = array( 'highlightbroken', 'hover' );
30 - foreach( $options as $opt ) {
31 - global $wgUser;
32 - $this->mOptions[$opt] = $wgUser->getOption( $opt );
33 - }
3427 }
3528
3629 /**
@@ -51,9 +44,7 @@
5245
5346 $r = ($class != '') ? " class='$class'" : " class='external'";
5447
55 - if( !$same && $this->mOptions['hover'] ) {
56 - $r .= " title=\"{$link}\"";
57 - }
 48+ $r .= " title=\"{$link}\"";
5849 return $r;
5950 }
6051
@@ -71,9 +62,7 @@
7263 $r = '';
7364 }
7465
75 - if( $this->mOptions['hover'] ) {
76 - $r .= " title=\"{$link}\"";
77 - }
 66+ $r .= " title=\"{$link}\"";
7867 return $r;
7968 }
8069
@@ -89,9 +78,7 @@
9079 $r = '';
9180 }
9281
93 - if( $this->mOptions['hover'] ) {
94 - $r .= ' title="' . $nt->getEscapedText() . '"';
95 - }
 82+ $r .= ' title="' . $nt->getEscapedText() . '"';
9683 return $r;
9784 }
9885
@@ -333,11 +320,7 @@
334321 $trail = $m[2];
335322 }
336323 }
337 - if ( $this->mOptions['highlightbroken'] ) {
338 - $s = "<a href=\"{$u}\"{$style}>{$prefix}{$text}{$inside}</a>{$trail}";
339 - } else {
340 - $s = "{$prefix}{$text}{$inside}<a href=\"{$u}\"{$style}>?</a>{$trail}";
341 - }
 324+ $s = "<a href=\"{$u}\"{$style}>{$prefix}{$text}{$inside}</a>{$trail}";
342325
343326 wfProfileOut( $fname );
344327 return $s;
@@ -363,11 +346,7 @@
364347 $trail = $m[2];
365348 }
366349 }
367 - if ( $this->mOptions['highlightbroken'] ) {
368 - $s = "<a href=\"{$u}\"{$style}>{$prefix}{$text}{$inside}</a>{$trail}";
369 - } else {
370 - $s = "{$prefix}{$text}{$inside}<a href=\"{$u}\"{$style}>!</a>{$trail}";
371 - }
 350+ $s = "<a href=\"{$u}\"{$style}>{$prefix}{$text}{$inside}</a>{$trail}";
372351 return $s;
373352 }
374353
Index: trunk/phase3/includes/Parser.php
@@ -13,7 +13,7 @@
1414 * changes in an incompatible way, so the parser cache
1515 * can automatically discard old data.
1616 */
17 -define( 'MW_PARSER_VERSION', '1.4.0' );
 17+define( 'MW_PARSER_VERSION', '1.5.0' );
1818
1919 /**
2020 * Variable substitution O(N^2) attack
Index: trunk/phase3/includes/SkinTemplate.php
@@ -879,26 +879,14 @@
880880 * returns css with user-specific options
881881 * @access public
882882 */
 883+
883884 function getUserStylesheet() {
884885 $fname = 'SkinTemplate::getUserStylesheet';
885886 wfProfileIn( $fname );
886887
887888 global $wgUser;
888889 $s = "/* generated user stylesheet */\n";
889 -
890 - if( $wgUser->isLoggedIn() ) {
891 - if ( $wgUser->getOption( "underline" ) ) {
892 - $s .= "a { text-decoration: underline; }\n";
893 - } else {
894 - $s .= "a { text-decoration: none; }\n";
895 - }
896 - }
897 - if ( !$wgUser->getOption( "highlightbroken" ) ) {
898 - $s .= "a.new, #quickbar a.new { color: #CC2200; }\n";
899 - }
900 - if ( $wgUser->getOption( "justify" ) ) {
901 - $s .= "#bodyContent { text-align: justify; }\n";
902 - }
 890+ $s .= $this->reallyDoGetUserStyles();
903891 wfProfileOut( $fname );
904892 return $s;
905893 }
Index: trunk/phase3/includes/Skin.php
@@ -267,17 +267,36 @@
268268 $csspage = $wgContLang->getNsText( NS_MEDIAWIKI ) . ':' . $this->getSkinName() . '.css';
269269 $s = '@import "'.$this->makeUrl($csspage, 'action=raw&ctype=text/css')."\";\n";
270270
271 - if ( 1 == $wgUser->getOption( 'underline' ) ) {
272 - # Don't override browser settings
 271+ return $s . $this->reallyDoGetUserStyles();
 272+ }
 273+
 274+ function reallyDoGetUserStyles() {
 275+ global $wgUser;
 276+ $s = '';
 277+ $underline = $wgUser->getOption( "underline" ) ? 'underline' : 'none';
 278+ $s .= "a { text-decoration: $underline; }\n";
 279+ if( $wgUser->getOption( 'highlightbroken' ) ) {
 280+ $s .= "a.new, #quickbar a.new { color: #CC2200; }\n";
273281 } else {
274 - # CHECK MERGE @@@
275 - # Force no underline
276 - $s .= "a { text-decoration: none; }\n";
 282+ $s .= <<<END
 283+a.new, #quickbar a.new,
 284+a.stub, #quickbar a.stub {
 285+ color: inherit;
 286+ text-decoration: inherit;
 287+}
 288+a.new:after, #quickbar a.new:after {
 289+ content: "?";
 290+ color: #CC2200;
 291+ text-decoration: $underline;
 292+}
 293+a.stub:after, #quickbar a.stub:after {
 294+ content: "!";
 295+ color: #772233;
 296+ text-decoration: $underline;
 297+}
 298+END;
277299 }
278 - if ( 1 == $this->mOptions['highlightbroken'] ) {
279 - $s .= "a.new, #quickbar a.new { color: #CC2200; }\n";
280 - }
281 - if ( 1 == $wgUser->getOption( 'justify' ) ) {
 300+ if( $wgUser->getOption( 'justify' ) ) {
282301 $s .= "#article { text-align: justify; }\n";
283302 }
284303 return $s;
Index: trunk/phase3/languages/Language.php
@@ -53,7 +53,6 @@
5454 /* private */ $wgDefaultUserOptionsEn = array(
5555 'quickbar' => 1,
5656 'underline' => 1,
57 - 'hover' => 1,
5857 'cols' => 80,
5958 'rows' => 25,
6059 'searchlimit' => 20,
@@ -131,7 +130,6 @@
132131 );
133132
134133 /* private */ $wgUserTogglesEn = array(
135 - 'hover',
136134 'underline',
137135 'highlightbroken',
138136 'justify',
@@ -259,7 +257,6 @@
260258 'special_version_prefix' => '&nbsp;',
261259 'special_version_postfix' => '&nbsp;',
262260 # User preference toggles
263 -'tog-hover' => 'Show hoverbox over wiki links',
264261 'tog-underline' => 'Underline links',
265262 'tog-highlightbroken' => 'Format broken links <a href="" class="new">like this</a> (alternative: like this<a href="" class="internal">?</a>).',
266263 'tog-justify' => 'Justify paragraphs',

Status & tagging log