Index: trunk/extensions/CentralNotice/SpecialBannerListLoader.php |
— | — | @@ -10,7 +10,6 @@ |
11 | 11 | public $centralNoticeDB; |
12 | 12 | protected $sharedMaxAge = 900; // Cache for 15 minutes on the server side |
13 | 13 | protected $maxAge = 900; // Cache for 15 minutes on the client side |
14 | | - protected $contentType = 'text/javascript'; |
15 | 14 | |
16 | 15 | function __construct() { |
17 | 16 | // Register special page |
— | — | @@ -49,7 +48,8 @@ |
50 | 49 | * Generate the HTTP response headers for the banner file |
51 | 50 | */ |
52 | 51 | function sendHeaders() { |
53 | | - header( "Content-type: $this->contentType; charset=utf-8" ); |
| 52 | + global $wgJsMimeType; |
| 53 | + header( "Content-type: $wgJsMimeType; charset=utf-8" ); |
54 | 54 | header( "Cache-Control: public, s-maxage=$this->sharedMaxAge, max-age=$this->maxAge" ); |
55 | 55 | } |
56 | 56 | |
Index: trunk/extensions/CentralNotice/SpecialBannerLoader.php |
— | — | @@ -8,7 +8,6 @@ |
9 | 9 | public $language = 'en'; // User language |
10 | 10 | protected $sharedMaxAge = 900; // Cache for 15 minutes on the server side |
11 | 11 | protected $maxAge = 0; // No client-side banner caching so we get all impressions |
12 | | - protected $contentType = 'text/js'; |
13 | 12 | |
14 | 13 | function __construct() { |
15 | 14 | // Register special page |
— | — | @@ -47,7 +46,8 @@ |
48 | 47 | * Generate the HTTP response headers for the banner file |
49 | 48 | */ |
50 | 49 | function sendHeaders() { |
51 | | - header( "Content-type: $this->contentType; charset=utf-8" ); |
| 50 | + global $wgJsMimeType; |
| 51 | + header( "Content-type: $wgJsMimeType; charset=utf-8" ); |
52 | 52 | header( "Cache-Control: public, s-maxage=$this->sharedMaxAge, max-age=$this->maxAge" ); |
53 | 53 | } |
54 | 54 | |
Index: trunk/extensions/CentralNotice/SpecialBannerController.php |
— | — | @@ -6,7 +6,6 @@ |
7 | 7 | class SpecialBannerController extends UnlistedSpecialPage { |
8 | 8 | protected $sharedMaxAge = 7200; // Cache for 2 hours on the server side |
9 | 9 | protected $maxAge = 7200; // Cache for 2 hours on the client side |
10 | | - protected $contentType = 'text/javascript'; |
11 | 10 | |
12 | 11 | function __construct() { |
13 | 12 | // Register special page |
— | — | @@ -34,7 +33,8 @@ |
35 | 34 | * Generate the HTTP response headers for the banner controller |
36 | 35 | */ |
37 | 36 | function sendHeaders() { |
38 | | - header( "Content-type: $this->contentType; charset=utf-8" ); |
| 37 | + global $wgJsMimeType; |
| 38 | + header( "Content-type: $wgJsMimeType; charset=utf-8" ); |
39 | 39 | header( "Cache-Control: public, s-maxage=$this->sharedMaxAge, max-age=$this->maxAge" ); |
40 | 40 | } |
41 | 41 | |
— | — | @@ -47,6 +47,7 @@ |
48 | 48 | $js = $this->getScriptFunctions() . $this->getToggleScripts(); |
49 | 49 | $js .= <<<EOT |
50 | 50 | ( function( $ ) { |
| 51 | + $.ajaxSetup({ cache: true }); |
51 | 52 | $.centralNotice = { |
52 | 53 | 'data': { |
53 | 54 | 'getVars': {} |
— | — | @@ -56,7 +57,7 @@ |
57 | 58 | // Get the requested banner |
58 | 59 | var bannerPage = 'Special:BannerLoader?banner='+bannerName+'&userlang='+wgContentLanguage+'&sitename='+wgNoticeProject; |
59 | 60 | EOT; |
60 | | - $js .= "\n\t\t\t\tvar bannerScript = '<script type=\"text/javascript\" src=\"$wgCentralPagePath' + bannerPage + '\"></script>';\n"; |
| 61 | + $js .= "\n\t\t\t\tvar bannerScript = '<script type=\"text/javascript\" src=\"".Xml::escapeJsString( $wgCentralPagePath )."' + bannerPage + '\"></script>';\n"; |
61 | 62 | $js .= <<<EOT |
62 | 63 | $( '#siteNotice' ).prepend( '<div id="centralNotice" class="' + ( wgNoticeToggleState ? 'expanded' : 'collapsed' ) + '">'+bannerScript+'</div>' ); |
63 | 64 | }, |