Index: trunk/extensions/CentralNotice/BannerLoader.php |
— | — | @@ -22,14 +22,17 @@ |
23 | 23 | $this->sendHeaders(); |
24 | 24 | |
25 | 25 | // Get user language from the query string |
26 | | - $this->language = $wgRequest->getText( 'language', 'en' ); |
| 26 | + $this->language = $wgRequest->getText( 'userlang', 'en' ); |
27 | 27 | |
28 | 28 | // Get site name from the query string |
29 | | - $this->siteName = $wgRequest->getText( 'site', 'Wikipedia' ); |
| 29 | + $this->siteName = $wgRequest->getText( 'sitename', 'Wikipedia' ); |
30 | 30 | |
| 31 | + // If we're not pulling the banner into another page, we'll need to add some extra HTML |
| 32 | + $standAlone = $wgRequest->getBool( 'standalone' ); |
| 33 | + |
31 | 34 | if ( $wgRequest->getText( 'banner' ) ) { |
32 | 35 | $bannerName = $wgRequest->getText( 'banner' ); |
33 | | - $content = $this->getHtmlNotice( $bannerName ); |
| 36 | + $content = $this->getHtmlNotice( $bannerName, $standAlone ); |
34 | 37 | if ( strlen( $content ) == 0 ) { |
35 | 38 | // Hack for IE/Mac 0-length keepalive problem, see RawPage.php |
36 | 39 | echo "/* Empty */"; |
— | — | @@ -52,15 +55,32 @@ |
53 | 56 | /** |
54 | 57 | * Generate the HTML for the requested banner |
55 | 58 | */ |
56 | | - function getHtmlNotice( $bannerName ) { |
| 59 | + function getHtmlNotice( $bannerName, $standAlone = false ) { |
57 | 60 | // Make sure the banner exists |
58 | 61 | if ( SpecialNoticeTemplate::templateExists( $bannerName ) ) { |
59 | 62 | $this->bannerName = $bannerName; |
60 | | - return preg_replace_callback( |
| 63 | + $bannerHtml = ''; |
| 64 | + if ( $standAlone ) { |
| 65 | + $bannerHtml .= <<<EOT |
| 66 | +<html> |
| 67 | +<head> |
| 68 | + <script type="text/javascript" src="http://bits.wikimedia.org/skins-1.5/common/jquery.min.js"></script> |
| 69 | +</head> |
| 70 | +<body> |
| 71 | +EOT; |
| 72 | + } |
| 73 | + $bannerHtml .= preg_replace_callback( |
61 | 74 | '/{{{(.*?)}}}/', |
62 | 75 | array( $this, 'getNoticeField' ), |
63 | 76 | $this->getNoticeTemplate() |
64 | 77 | ); |
| 78 | + if ( $standAlone ) { |
| 79 | + $bannerHtml .= <<<EOT |
| 80 | +</body> |
| 81 | +</html> |
| 82 | +EOT; |
| 83 | + } |
| 84 | + return $bannerHtml; |
65 | 85 | } |
66 | 86 | } |
67 | 87 | |