| Index: branches/wmf/1.17wmf1/skins/monobook/main.css |
| — | — | @@ -60,14 +60,7 @@ |
| 61 | 61 | table { |
| 62 | 62 | font-size: 100%; |
| 63 | 63 | color: black; |
| 64 | | - /* we don't want the bottom borders of <h2>s to be visible through |
| 65 | | - floated tables */ |
| 66 | | - background-color: white; |
| 67 | 64 | } |
| 68 | | -fieldset table { |
| 69 | | - /* but keep table layouts in forms clean... */ |
| 70 | | - background: none; |
| 71 | | -} |
| 72 | 65 | a { |
| 73 | 66 | text-decoration: none; |
| 74 | 67 | color: #002bb8; |
| Index: branches/wmf/1.17wmf1/skins/common/preview.js |
| — | — | @@ -1,127 +1,128 @@ |
| 2 | 2 | /** |
| 3 | 3 | * Live preview script for MediaWiki |
| 4 | 4 | */ |
| | 5 | +(function( $ ) { |
| | 6 | + window.doLivePreview = function( e ) { |
| | 7 | + e.preventDefault(); |
| 5 | 8 | |
| 6 | | -window.doLivePreview = function( e ) { |
| 7 | | - e.preventDefault(); |
| | 9 | + $( mw ).trigger( 'LivePreviewPrepare' ); |
| 8 | 10 | |
| 9 | | - $( mw ).trigger( 'LivePreviewPrepare' ); |
| | 11 | + var postData = $('#editform').formToArray(); |
| | 12 | + postData.push( { 'name' : 'wpPreview', 'value' : '1' } ); |
| 10 | 13 | |
| 11 | | - var postData = $('#editform').formToArray(); |
| 12 | | - postData.push( { 'name' : 'wpPreview', 'value' : '1' } ); |
| | 14 | + // Hide active diff, used templates, old preview if shown |
| | 15 | + var copyElements = ['#wikiPreview', '.templatesUsed', '.hiddencats', |
| | 16 | + '#catlinks']; |
| | 17 | + var copySelector = copyElements.join(','); |
| 13 | 18 | |
| 14 | | - // Hide active diff, used templates, old preview if shown |
| 15 | | - var copyElements = ['#wikiPreview', '.templatesUsed', '.hiddencats', |
| 16 | | - '#catlinks']; |
| 17 | | - var copySelector = copyElements.join(','); |
| | 19 | + $.each( copyElements, function(k,v) { $(v).fadeOut('fast'); } ); |
| 18 | 20 | |
| 19 | | - $.each( copyElements, function(k,v) { $(v).fadeOut('fast'); } ); |
| | 21 | + // Display a loading graphic |
| | 22 | + var loadSpinner = $('<div class="mw-ajax-loader"/>'); |
| | 23 | + $('#wikiPreview').before( loadSpinner ); |
| 20 | 24 | |
| 21 | | - // Display a loading graphic |
| 22 | | - var loadSpinner = $('<div class="mw-ajax-loader"/>'); |
| 23 | | - $('#wikiPreview').before( loadSpinner ); |
| | 25 | + var page = $('<div/>'); |
| | 26 | + var target = $('#editform').attr('action'); |
| 24 | 27 | |
| 25 | | - var page = $('<div/>'); |
| 26 | | - var target = $('#editform').attr('action'); |
| | 28 | + if ( !target ) { |
| | 29 | + target = window.location.href; |
| | 30 | + } |
| 27 | 31 | |
| 28 | | - if ( !target ) { |
| 29 | | - target = window.location.href; |
| 30 | | - } |
| | 32 | + page.load( target + ' ' + copySelector, postData, |
| | 33 | + function() { |
| 31 | 34 | |
| 32 | | - page.load( target + ' ' + copySelector, postData, |
| 33 | | - function() { |
| | 35 | + for( var i=0; i<copyElements.length; ++i) { |
| | 36 | + // For all the specified elements, find the elements in the loaded page |
| | 37 | + // and the real page, empty the element in the real page, and fill it |
| | 38 | + // with the content of the loaded page |
| | 39 | + var copyContent = page.find( copyElements[i] ).contents(); |
| | 40 | + $(copyElements[i]).empty().append( copyContent ); |
| | 41 | + var newClasses = page.find( copyElements[i] ).attr('class'); |
| | 42 | + $(copyElements[i]).attr( 'class', newClasses ); |
| | 43 | + } |
| 34 | 44 | |
| 35 | | - for( var i=0; i<copyElements.length; ++i) { |
| 36 | | - // For all the specified elements, find the elements in the loaded page |
| 37 | | - // and the real page, empty the element in the real page, and fill it |
| 38 | | - // with the content of the loaded page |
| 39 | | - var copyContent = page.find( copyElements[i] ).contents(); |
| 40 | | - $(copyElements[i]).empty().append( copyContent ); |
| 41 | | - var newClasses = page.find( copyElements[i] ).attr('class'); |
| 42 | | - $(copyElements[i]).attr( 'class', newClasses ); |
| 43 | | - } |
| | 45 | + $.each( copyElements, function(k,v) { |
| | 46 | + // Don't belligerently show elements that are supposed to be hidden |
| | 47 | + $(v).fadeIn( 'fast', function() { $(this).css('display', ''); } ); |
| | 48 | + } ); |
| 44 | 49 | |
| 45 | | - $.each( copyElements, function(k,v) { |
| 46 | | - // Don't belligerently show elements that are supposed to be hidden |
| 47 | | - $(v).fadeIn( 'fast', function() { $(this).css('display', ''); } ); |
| | 50 | + loadSpinner.remove(); |
| | 51 | + |
| | 52 | + $( mw ).trigger( 'LivePreviewDone', [copyElements] ); |
| 48 | 53 | } ); |
| 49 | | - |
| 50 | | - loadSpinner.remove(); |
| | 54 | + }; |
| 51 | 55 | |
| 52 | | - $( mw ).trigger( 'LivePreviewDone', [copyElements] ); |
| 53 | | - } ); |
| 54 | | -}; |
| | 56 | + // Shamelessly stolen from the jQuery form plugin, which is licensed under the GPL. |
| | 57 | + // http://jquery.malsup.com/form/#download |
| | 58 | + $.fn.formToArray = function() { |
| | 59 | + var a = []; |
| | 60 | + if (this.length == 0) return a; |
| 55 | 61 | |
| 56 | | -// Shamelessly stolen from the jQuery form plugin, which is licensed under the GPL. |
| 57 | | -// http://jquery.malsup.com/form/#download |
| 58 | | -$.fn.formToArray = function() { |
| 59 | | - var a = []; |
| 60 | | - if (this.length == 0) return a; |
| | 62 | + var form = this[0]; |
| | 63 | + var els = form.elements; |
| | 64 | + if (!els) return a; |
| | 65 | + for(var i=0, max=els.length; i < max; i++) { |
| | 66 | + var el = els[i]; |
| | 67 | + var n = el.name; |
| | 68 | + if (!n) continue; |
| 61 | 69 | |
| 62 | | - var form = this[0]; |
| 63 | | - var els = form.elements; |
| 64 | | - if (!els) return a; |
| 65 | | - for(var i=0, max=els.length; i < max; i++) { |
| 66 | | - var el = els[i]; |
| 67 | | - var n = el.name; |
| 68 | | - if (!n) continue; |
| 69 | | - |
| 70 | | - var v = $.fieldValue(el, true); |
| 71 | | - if (v && v.constructor == Array) { |
| 72 | | - for(var j=0, jmax=v.length; j < jmax; j++) |
| 73 | | - a.push({name: n, value: v[j]}); |
| | 70 | + var v = $.fieldValue(el, true); |
| | 71 | + if (v && v.constructor == Array) { |
| | 72 | + for(var j=0, jmax=v.length; j < jmax; j++) |
| | 73 | + a.push({name: n, value: v[j]}); |
| | 74 | + } |
| | 75 | + else if (v !== null && typeof v != 'undefined') |
| | 76 | + a.push({name: n, value: v}); |
| 74 | 77 | } |
| 75 | | - else if (v !== null && typeof v != 'undefined') |
| 76 | | - a.push({name: n, value: v}); |
| 77 | | - } |
| 78 | 78 | |
| 79 | | - if (form.clk) { |
| 80 | | - // input type=='image' are not found in elements array! handle it here |
| 81 | | - var $input = $(form.clk), input = $input[0], n = input.name; |
| 82 | | - if (n && !input.disabled && input.type == 'image') { |
| 83 | | - a.push({name: n, value: $input.val()}); |
| 84 | | - a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y}); |
| | 79 | + if (form.clk) { |
| | 80 | + // input type=='image' are not found in elements array! handle it here |
| | 81 | + var $input = $(form.clk), input = $input[0], n = input.name; |
| | 82 | + if (n && !input.disabled && input.type == 'image') { |
| | 83 | + a.push({name: n, value: $input.val()}); |
| | 84 | + a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y}); |
| | 85 | + } |
| 85 | 86 | } |
| 86 | | - } |
| 87 | | - return a; |
| 88 | | -}; |
| | 87 | + return a; |
| | 88 | + }; |
| 89 | 89 | |
| 90 | | -/** |
| 91 | | - * Returns the value of the field element. |
| 92 | | - */ |
| 93 | | -$.fieldValue = function(el, successful) { |
| 94 | | - var n = el.name, t = el.type, tag = el.tagName.toLowerCase(); |
| 95 | | - if (typeof successful == 'undefined') successful = true; |
| | 90 | + /** |
| | 91 | + * Returns the value of the field element. |
| | 92 | + */ |
| | 93 | + $.fieldValue = function(el, successful) { |
| | 94 | + var n = el.name, t = el.type, tag = el.tagName.toLowerCase(); |
| | 95 | + if (typeof successful == 'undefined') successful = true; |
| 96 | 96 | |
| 97 | | - if (successful && (!n || el.disabled || t == 'reset' || t == 'button' || |
| 98 | | - (t == 'checkbox' || t == 'radio') && !el.checked || |
| 99 | | - (t == 'submit' || t == 'image') && el.form && el.form.clk != el || |
| 100 | | - tag == 'select' && el.selectedIndex == -1)) |
| 101 | | - return null; |
| | 97 | + if (successful && (!n || el.disabled || t == 'reset' || t == 'button' || |
| | 98 | + (t == 'checkbox' || t == 'radio') && !el.checked || |
| | 99 | + (t == 'submit' || t == 'image') && el.form && el.form.clk != el || |
| | 100 | + tag == 'select' && el.selectedIndex == -1)) |
| | 101 | + return null; |
| 102 | 102 | |
| 103 | | - if (tag == 'select') { |
| 104 | | - var index = el.selectedIndex; |
| 105 | | - if (index < 0) return null; |
| 106 | | - var a = [], ops = el.options; |
| 107 | | - var one = (t == 'select-one'); |
| 108 | | - var max = (one ? index+1 : ops.length); |
| 109 | | - for(var i=(one ? index : 0); i < max; i++) { |
| 110 | | - var op = ops[i]; |
| 111 | | - if (op.selected) { |
| 112 | | - var v = op.value; |
| 113 | | - if (!v) // extra pain for IE... |
| 114 | | - v = (op.attributes && op.attributes['value'] && |
| 115 | | - !(op.attributes['value'].specified)) |
| 116 | | - ? op.text : op.value; |
| 117 | | - if (one) return v; |
| 118 | | - a.push(v); |
| | 103 | + if (tag == 'select') { |
| | 104 | + var index = el.selectedIndex; |
| | 105 | + if (index < 0) return null; |
| | 106 | + var a = [], ops = el.options; |
| | 107 | + var one = (t == 'select-one'); |
| | 108 | + var max = (one ? index+1 : ops.length); |
| | 109 | + for(var i=(one ? index : 0); i < max; i++) { |
| | 110 | + var op = ops[i]; |
| | 111 | + if (op.selected) { |
| | 112 | + var v = op.value; |
| | 113 | + if (!v) // extra pain for IE... |
| | 114 | + v = (op.attributes && op.attributes['value'] && |
| | 115 | + !(op.attributes['value'].specified)) |
| | 116 | + ? op.text : op.value; |
| | 117 | + if (one) return v; |
| | 118 | + a.push(v); |
| | 119 | + } |
| 119 | 120 | } |
| | 121 | + return a; |
| 120 | 122 | } |
| 121 | | - return a; |
| 122 | | - } |
| 123 | | - return el.value; |
| 124 | | -}; |
| | 123 | + return el.value; |
| | 124 | + }; |
| 125 | 125 | |
| 126 | | -$(document).ready( function() { |
| 127 | | - $('#wpPreview').click( doLivePreview ); |
| 128 | | -} ); |
| | 126 | + $(document).ready( function() { |
| | 127 | + $('#wpPreview').click( doLivePreview ); |
| | 128 | + } ); |
| | 129 | +}) ( jQuery ); |
| Index: branches/wmf/1.17wmf1/skins/common/shared.css |
| — | — | @@ -9,9 +9,9 @@ |
| 10 | 10 | .mw-plusminus-neg { color: #8b0000; } /* dark red */ |
| 11 | 11 | .mw-plusminus-null { color: #aaa; } /* gray */ |
| 12 | 12 | |
| 13 | | -/* Links to redirects appear italicized on [[Special:AllPages]], |
| 14 | | - and in category listings */ |
| 15 | | -.allpagesredirect, .redirect-in-category { font-style: italic; } |
| | 13 | +/* Links to redirects appear italicized on [[Special:AllPages]], [[Special:PrefixIndex]], |
| | 14 | + [[Special:Watchlist/edit]] and in category listings */ |
| | 15 | +.allpagesredirect, .redirect-in-category, .watchlistredir { font-style: italic; } |
| 16 | 16 | |
| 17 | 17 | /* Comment and username portions of RC entries */ |
| 18 | 18 | span.comment { |
| — | — | @@ -325,11 +325,7 @@ |
| 326 | 326 | font-weight: bold; |
| 327 | 327 | } |
| 328 | 328 | |
| 329 | | -table#mw-search-top-table { |
| 330 | | - background-color: transparent; |
| 331 | | -} |
| 332 | 329 | |
| 333 | | - |
| 334 | 330 | /* |
| 335 | 331 | * Advanced PowerSearch box |
| 336 | 332 | */ |
| — | — | @@ -480,11 +476,7 @@ |
| 481 | 477 | } |
| 482 | 478 | |
| 483 | 479 | /* Special:Allpages styling */ |
| 484 | | -table.allpageslist { |
| 485 | | - background-color: transparent; |
| 486 | | -} |
| 487 | 480 | table.mw-allpages-table-form, table.mw-allpages-table-chunk { |
| 488 | | - background-color: transparent; |
| 489 | 481 | width: 100%; |
| 490 | 482 | } |
| 491 | 483 | td.mw-allpages-alphaindexline { |
| — | — | @@ -503,7 +495,6 @@ |
| 504 | 496 | table#mw-prefixindex-list-table, |
| 505 | 497 | table#mw-prefixindex-nav-table { |
| 506 | 498 | width: 98%; |
| 507 | | - background-color: transparent; |
| 508 | 499 | } |
| 509 | 500 | td#mw-prefixindex-nav-form { |
| 510 | 501 | font-size: smaller; |
| — | — | @@ -797,7 +788,6 @@ |
| 798 | 789 | } |
| 799 | 790 | |
| 800 | 791 | table.mw-enhanced-rc { |
| 801 | | - background: none; |
| 802 | 792 | border:0; |
| 803 | 793 | border-spacing:0; |
| 804 | 794 | } |
| Property changes on: branches/wmf/1.17wmf1/skins/common/shared.css |
| ___________________________________________________________________ |
| Modified: svn:mergeinfo |
| 805 | 795 | Merged /trunk/phase3/skins/common/shared.css:r80495,80765,81177,82000,82155-82156,82191,82200,82203,82218 |
| Index: branches/wmf/1.17wmf1/skins/vector/screen.css |
| — | — | @@ -350,6 +350,9 @@ |
| 351 | 351 | margin-top: 0.4em; |
| 352 | 352 | } |
| 353 | 353 | div#simpleSearch { |
| | 354 | + display: block; |
| | 355 | + width: 14em; |
| | 356 | + height: 1.4em; |
| 354 | 357 | margin-top: 0.65em; |
| 355 | 358 | position: relative; |
| 356 | 359 | min-height: 1px; /* Gotta trigger hasLayout for IE7 */ |
| — | — | @@ -368,9 +371,11 @@ |
| 369 | 372 | */ |
| 370 | 373 | font-size: 13px; |
| 371 | 374 | top: 0.25em; |
| | 375 | + direction: ltr; |
| 372 | 376 | } |
| 373 | 377 | div#simpleSearch input { |
| 374 | 378 | color: black; |
| | 379 | + direction: ltr; |
| 375 | 380 | } |
| 376 | 381 | div#simpleSearch input:focus { |
| 377 | 382 | outline: none; |
| — | — | @@ -382,39 +387,49 @@ |
| 383 | 388 | color: #999999; |
| 384 | 389 | } |
| 385 | 390 | div#simpleSearch input#searchInput { |
| | 391 | + position: absolute; |
| | 392 | + top: 0; |
| | 393 | + left: 0; |
| | 394 | + width: 90%; |
| 386 | 395 | margin: 0; |
| 387 | | - border-width: 0; |
| 388 | | - padding: 3px; |
| 389 | | - vertical-align: top; |
| | 396 | + padding: 0; |
| | 397 | + padding-left: 0.2em; |
| | 398 | + padding-top: 0.2em; |
| | 399 | + padding-bottom: 0.2em; |
| | 400 | + outline: none; |
| | 401 | + border: none; |
| 390 | 402 | /* |
| 391 | 403 | * DON'T PANIC! Browsers that won't scale this properly are the same browsers that have JS issues that prevent |
| 392 | 404 | * this from ever being shown anyways. |
| 393 | 405 | */ |
| 394 | 406 | font-size: 13px; |
| 395 | | - width: 14em; |
| 396 | 407 | background-color: transparent; |
| 397 | 408 | direction: ltr; |
| 398 | 409 | } |
| 399 | 410 | div#simpleSearch button#searchButton { |
| | 411 | + position: absolute; |
| | 412 | + width: 10%; |
| | 413 | + right: 0; |
| | 414 | + top: 0; |
| 400 | 415 | padding: 0; |
| 401 | | - margin: 0 5px; |
| | 416 | + padding-top: 0.2em; |
| | 417 | + padding-bottom: 0.2em; |
| | 418 | + padding-right: 0.4em; |
| | 419 | + margin: 0; |
| 402 | 420 | border: none; |
| 403 | 421 | cursor: pointer; |
| 404 | 422 | background-color: transparent; |
| 405 | | - font-size: x-small; |
| 406 | 423 | } |
| 407 | 424 | /* OVERRIDDEN BY COMPLIANT BROWSERS */ |
| 408 | 425 | div#simpleSearch button#searchButton img { |
| 409 | 426 | border: none; |
| 410 | 427 | margin: 0; |
| | 428 | + margin-top: -3px; |
| 411 | 429 | padding: 0; |
| 412 | | - padding-top: 0.5em; |
| 413 | | - vertical-align: middle; |
| 414 | 430 | } |
| 415 | 431 | /* IGNORED BY IE6 */ |
| 416 | 432 | div#simpleSearch button#searchButton > img { |
| 417 | | - padding-top: 0; |
| 418 | | - margin-top: -1px; |
| | 433 | + margin: 0; |
| 419 | 434 | } |
| 420 | 435 | /* Panel */ |
| 421 | 436 | div#mw-panel { |
| — | — | @@ -811,14 +826,7 @@ |
| 812 | 827 | table { |
| 813 | 828 | font-size: 100%; |
| 814 | 829 | color: black; |
| 815 | | - /* we don't want the bottom borders of <h2>s to be visible through |
| 816 | | - * floated tables */ |
| 817 | | - background-color: white; |
| 818 | 830 | } |
| 819 | | -fieldset table { |
| 820 | | - /* but keep table layouts in forms clean... */ |
| 821 | | - background: none; |
| 822 | | -} |
| 823 | 831 | /* Forms */ |
| 824 | 832 | fieldset { |
| 825 | 833 | border: 1px solid #2f6fab; |
| Property changes on: branches/wmf/1.17wmf1/skins/vector/screen.css |
| ___________________________________________________________________ |
| Modified: svn:mergeinfo |
| 826 | 834 | Merged /trunk/phase3/skins/vector/screen.css:r80495,80765,81177,82000,82155-82156,82191,82200,82203,82218 |
| Index: branches/wmf/1.17wmf1/includes/diff/DifferenceEngine.php |
| — | — | @@ -590,7 +590,8 @@ |
| 591 | 591 | */ |
| 592 | 592 | function showDiffStyle() { |
| 593 | 593 | global $wgOut; |
| 594 | | - $wgOut->addModules( 'mediawiki.legacy.diff' ); |
| | 594 | + $wgOut->addModuleStyles( 'mediawiki.legacy.diff' ); |
| | 595 | + $wgOut->addModuleScripts( 'mediawiki.legacy.diff' ); |
| 595 | 596 | } |
| 596 | 597 | |
| 597 | 598 | /** |
| Index: branches/wmf/1.17wmf1/includes/resourceloader/ResourceLoaderWikiModule.php |
| — | — | @@ -75,6 +75,7 @@ |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | public function getStyles( ResourceLoaderContext $context ) { |
| | 79 | + global $wgScriptPath; |
| 79 | 80 | |
| 80 | 81 | $styles = array(); |
| 81 | 82 | foreach ( $this->getPages( $context ) as $page => $options ) { |
| — | — | @@ -89,6 +90,7 @@ |
| 90 | 91 | if ( $this->getFlip( $context ) ) { |
| 91 | 92 | $style = CSSJanus::transform( $style, true, false ); |
| 92 | 93 | } |
| | 94 | + $style = CSSMin::remap( $style, false, $wgScriptPath, true ); |
| 93 | 95 | if ( !isset( $styles[$media] ) ) { |
| 94 | 96 | $styles[$media] = ''; |
| 95 | 97 | } |
| Index: branches/wmf/1.17wmf1/includes/libs/CSSMin.php |
| — | — | @@ -36,7 +36,7 @@ |
| 37 | 37 | * which when base64 encoded will result in a 1/3 increase in size. |
| 38 | 38 | */ |
| 39 | 39 | const EMBED_SIZE_LIMIT = 24576; |
| 40 | | - const URL_REGEX = 'url\(\s*[\'"]?(?P<file>[^\?\)\:\'"]*)\??[^\)\'"]*[\'"]?\s*\)'; |
| | 40 | + const URL_REGEX = 'url\(\s*[\'"]?(?P<file>[^\?\)\'"]*)(?P<query>\??[^\)\'"]*)[\'"]?\s*\)'; |
| 41 | 41 | |
| 42 | 42 | /* Protected Static Members */ |
| 43 | 43 | |
| — | — | @@ -79,6 +79,32 @@ |
| 80 | 80 | return $files; |
| 81 | 81 | } |
| 82 | 82 | |
| | 83 | + protected static function getMimeType( $file ) { |
| | 84 | + $realpath = realpath( $file ); |
| | 85 | + // Try a couple of different ways to get the mime-type of a file, in order of |
| | 86 | + // preference |
| | 87 | + if ( |
| | 88 | + $realpath |
| | 89 | + && function_exists( 'finfo_file' ) |
| | 90 | + && function_exists( 'finfo_open' ) |
| | 91 | + && defined( 'FILEINFO_MIME_TYPE' ) |
| | 92 | + ) { |
| | 93 | + // As of PHP 5.3, this is how you get the mime-type of a file; it uses the Fileinfo |
| | 94 | + // PECL extension |
| | 95 | + return finfo_file( finfo_open( FILEINFO_MIME_TYPE ), $realpath ); |
| | 96 | + } else if ( function_exists( 'mime_content_type' ) ) { |
| | 97 | + // Before this was deprecated in PHP 5.3, this was how you got the mime-type of a file |
| | 98 | + return mime_content_type( $file ); |
| | 99 | + } else { |
| | 100 | + // Worst-case scenario has happened, use the file extension to infer the mime-type |
| | 101 | + $ext = strtolower( pathinfo( $file, PATHINFO_EXTENSION ) ); |
| | 102 | + if ( isset( self::$mimeTypes[$ext] ) ) { |
| | 103 | + return self::$mimeTypes[$ext]; |
| | 104 | + } |
| | 105 | + } |
| | 106 | + return false; |
| | 107 | + } |
| | 108 | + |
| 83 | 109 | /** |
| 84 | 110 | * Remaps CSS URL paths and automatically embeds data URIs for URL rules |
| 85 | 111 | * preceded by an /* @embed * / comment |
| — | — | @@ -94,63 +120,57 @@ |
| 95 | 121 | self::URL_REGEX . '(?P<post>[^;]*)[\;]?/'; |
| 96 | 122 | $offset = 0; |
| 97 | 123 | while ( preg_match( $pattern, $source, $match, PREG_OFFSET_CAPTURE, $offset ) ) { |
| | 124 | + // Skip absolute URIs and relative URIs with absolute paths |
| | 125 | + if ( preg_match( '/^(\/|https?:\/\/)/', $match['file'][0] ) ) { |
| | 126 | + // Move the offset to the end of the match, leaving it alone |
| | 127 | + $offset = $match[0][1] + strlen( $match[0][0] ); |
| | 128 | + continue; |
| | 129 | + } |
| 98 | 130 | // Shortcuts |
| 99 | 131 | $embed = $match['embed'][0]; |
| 100 | 132 | $pre = $match['pre'][0]; |
| 101 | 133 | $post = $match['post'][0]; |
| | 134 | + $query = $match['query'][0]; |
| | 135 | + $url = "{$remote}/{$match['file'][0]}"; |
| 102 | 136 | $file = "{$local}/{$match['file'][0]}"; |
| 103 | | - $url = "{$remote}/{$match['file'][0]}"; |
| 104 | | - // Only proceed if we can access the file |
| 105 | | - if ( file_exists( $file ) ) { |
| | 137 | + $replacement = false; |
| | 138 | + if ( $local !== false && file_exists( $file ) ) { |
| 106 | 139 | // Add version parameter as a time-stamp in ISO 8601 format, |
| 107 | 140 | // using Z for the timezone, meaning GMT |
| 108 | 141 | $url .= '?' . gmdate( 'Y-m-d\TH:i:s\Z', round( filemtime( $file ), -2 ) ); |
| 109 | | - // If we the mime-type can't be determined, no embedding will take place |
| 110 | | - $type = false; |
| 111 | | - $realpath = realpath( $file ); |
| 112 | | - // Try a couple of different ways to get the mime-type of a file, |
| 113 | | - // in order of preference |
| 114 | | - if ( $realpath |
| 115 | | - && function_exists( 'finfo_file' ) && function_exists( 'finfo_open' ) |
| 116 | | - && defined( 'FILEINFO_MIME_TYPE' ) ) |
| 117 | | - { |
| 118 | | - // As of PHP 5.3, this is how you get the mime-type of a file; |
| 119 | | - // it uses the Fileinfo PECL extension |
| 120 | | - $type = finfo_file( finfo_open( FILEINFO_MIME_TYPE ), $realpath ); |
| 121 | | - } else if ( function_exists( 'mime_content_type' ) ) { |
| 122 | | - // Before this was deprecated in PHP 5.3, |
| 123 | | - // this used to be how you get the mime-type of a file |
| 124 | | - $type = mime_content_type( $file ); |
| 125 | | - } else { |
| 126 | | - // Worst-case scenario has happened, |
| 127 | | - // use the file extension to infer the mime-type |
| 128 | | - $ext = strtolower( pathinfo( $file, PATHINFO_EXTENSION ) ); |
| 129 | | - if ( isset( self::$mimeTypes[$ext] ) ) { |
| 130 | | - $type = self::$mimeTypes[$ext]; |
| | 142 | + // Embedding requires a bit of extra processing, so let's skip that if we can |
| | 143 | + if ( $embed ) { |
| | 144 | + $type = self::getMimeType( $file ); |
| | 145 | + // Detect when URLs were preceeded with embed tags, and also verify file size is |
| | 146 | + // below the limit |
| | 147 | + if ( |
| | 148 | + $type |
| | 149 | + && $match['embed'][1] > 0 |
| | 150 | + && filesize( $file ) < self::EMBED_SIZE_LIMIT |
| | 151 | + ) { |
| | 152 | + // Strip off any trailing = symbols (makes browsers freak out) |
| | 153 | + $data = base64_encode( file_get_contents( $file ) ); |
| | 154 | + // Build 2 CSS properties; one which uses a base64 encoded data URI in place |
| | 155 | + // of the @embed comment to try and retain line-number integrity, and the |
| | 156 | + // other with a remapped an versioned URL and an Internet Explorer hack |
| | 157 | + // making it ignored in all browsers that support data URIs |
| | 158 | + $replacement = "{$pre}url(data:{$type};base64,{$data}){$post};"; |
| | 159 | + $replacement .= "{$pre}url({$url}){$post}!ie;"; |
| 131 | 160 | } |
| 132 | 161 | } |
| 133 | | - // Detect when URLs were preceeded with embed tags, |
| 134 | | - // and also verify file size is below the limit |
| 135 | | - if ( $embed && $type && $match['embed'][1] > 0 |
| 136 | | - && filesize( $file ) < self::EMBED_SIZE_LIMIT ) |
| 137 | | - { |
| 138 | | - // Strip off any trailing = symbols (makes browsers freak out) |
| 139 | | - $data = base64_encode( file_get_contents( $file ) ); |
| 140 | | - // Build 2 CSS properties; one which uses a base64 encoded data URI |
| 141 | | - // in place of the @embed comment to try and retain line-number integrity, |
| 142 | | - // and the other with a remapped an versioned URL and an Internet Explorer |
| 143 | | - // hack making it ignored in all browsers that support data URIs |
| 144 | | - $replacement = "{$pre}url(data:{$type};base64,{$data}){$post};"; |
| 145 | | - $replacement .= "{$pre}url({$url}){$post}!ie;"; |
| 146 | | - } else { |
| 147 | | - // Build a CSS property with a remapped and versioned URL, |
| 148 | | - // preserving comment for debug mode |
| 149 | | - $replacement = "{$embed}{$pre}url({$url}){$post};"; |
| | 162 | + if ( $replacement === false ) { |
| | 163 | + // Assume that all paths are relative to $remote, and make them absolute |
| | 164 | + $replacement = "{$embed}{$pre}url({$url}){$post};"; |
| 150 | 165 | } |
| 151 | | - |
| | 166 | + } else if ( $local === false ) { |
| | 167 | + // Assume that all paths are relative to $remote, and make them absolute |
| | 168 | + $replacement = "{$embed}{$pre}url({$url}{$query}){$post};"; |
| | 169 | + } |
| | 170 | + if ( $replacement !== false ) { |
| 152 | 171 | // Perform replacement on the source |
| 153 | | - $source = substr_replace( $source, |
| 154 | | - $replacement, $match[0][1], strlen( $match[0][0] ) ); |
| | 172 | + $source = substr_replace( |
| | 173 | + $source, $replacement, $match[0][1], strlen( $match[0][0] ) |
| | 174 | + ); |
| 155 | 175 | // Move the offset to the end of the replacement in the source |
| 156 | 176 | $offset = $match[0][1] + strlen( $replacement ); |
| 157 | 177 | continue; |
| — | — | @@ -160,7 +180,7 @@ |
| 161 | 181 | } |
| 162 | 182 | return $source; |
| 163 | 183 | } |
| 164 | | - |
| | 184 | + |
| 165 | 185 | /** |
| 166 | 186 | * Removes whitespace from CSS data |
| 167 | 187 | * |
| Index: branches/wmf/1.17wmf1/RELEASE-NOTES |
| — | — | @@ -488,6 +488,9 @@ |
| 489 | 489 | * (bug 26208) Mark directionality of some interlanguage links |
| 490 | 490 | * (bug 26716) Provide link to instructions for external editor related preferences. |
| 491 | 491 | * (bug 26961) Hide anon edits in watchlist preference now actually works. |
| | 492 | +* (bug 26449) Keep underlines from headings outside of tables and thumbs by |
| | 493 | + adding overflow:hidden to h1,h2,h3,h4,h5,h6 (also fixes editsection bunching). |
| | 494 | +* (bug 26708) Remove background-color:white from tables in Monobook and Vector. |
| 492 | 495 | |
| 493 | 496 | === API changes in 1.17 === |
| 494 | 497 | * BREAKING CHANGE: action=patrol now requires POST |
| Property changes on: branches/wmf/1.17wmf1/RELEASE-NOTES |
| ___________________________________________________________________ |
| Modified: svn:mergeinfo |
| 495 | 498 | Merged /trunk/phase3/RELEASE-NOTES:r80495,80765,81177,82000,82155-82156,82191,82200,82203,82218 |
| Index: branches/wmf/1.17wmf1/resources/Resources.php |
| — | — | @@ -334,6 +334,11 @@ |
| 335 | 335 | 'dependencies' => array( 'jquery.checkboxShiftClick', 'jquery.client', 'jquery.placeholder' ), |
| 336 | 336 | 'debugScripts' => 'resources/mediawiki.util/mediawiki.util.test.js', |
| 337 | 337 | ), |
| | 338 | + 'mediawiki.action.history' => array( |
| | 339 | + 'scripts' => 'resources/mediawiki.action/mediawiki.action.history.js', |
| | 340 | + 'dependencies' => 'mediawiki.legacy.history', |
| | 341 | + 'group' => 'mediawiki.action.history', |
| | 342 | + ), |
| 338 | 343 | 'mediawiki.action.edit' => array( |
| 339 | 344 | 'scripts' => 'resources/mediawiki.action/mediawiki.action.edit.js', |
| 340 | 345 | ), |
| — | — | @@ -348,10 +353,6 @@ |
| 349 | 354 | 'mediawiki.special.search' => array( |
| 350 | 355 | 'scripts' => 'resources/mediawiki.special/mediawiki.special.search.js', |
| 351 | 356 | ), |
| 352 | | - 'mediawiki.action.history' => array( |
| 353 | | - 'scripts' => 'resources/mediawiki.action/mediawiki.action.history.js', |
| 354 | | - 'dependencies' => 'mediawiki.legacy.history', |
| 355 | | - ), |
| 356 | 357 | 'mediawiki.language' => array( |
| 357 | 358 | 'scripts' => 'resources/mediawiki.language/mediawiki.language.js', |
| 358 | 359 | 'languageScripts' => array( |
| — | — | @@ -442,6 +443,7 @@ |
| 443 | 444 | 'mediawiki.legacy.diff' => array( |
| 444 | 445 | 'scripts' => 'common/diff.js', |
| 445 | 446 | 'styles' => 'common/diff.css', |
| | 447 | + 'group' => 'mediawiki.action.history', |
| 446 | 448 | 'remoteBasePath' => $GLOBALS['wgStylePath'], |
| 447 | 449 | 'localBasePath' => "{$GLOBALS['IP']}/skins", |
| 448 | 450 | 'dependencies' => 'mediawiki.legacy.wikibits', |
| — | — | @@ -460,6 +462,7 @@ |
| 461 | 463 | ), |
| 462 | 464 | 'mediawiki.legacy.history' => array( |
| 463 | 465 | 'scripts' => 'common/history.js', |
| | 466 | + 'group' => 'mediawiki.action.history', |
| 464 | 467 | 'remoteBasePath' => $GLOBALS['wgStylePath'], |
| 465 | 468 | 'localBasePath' => "{$GLOBALS['IP']}/skins", |
| 466 | 469 | 'dependencies' => 'mediawiki.legacy.wikibits', |
| Property changes on: branches/wmf/1.17wmf1/resources/Resources.php |
| ___________________________________________________________________ |
| Modified: svn:mergeinfo |
| 467 | 470 | Merged /trunk/phase3/resources/Resources.php:r80495,80765,81177,82000,82155-82156,82191,82200,82203,82218 |