Index: trunk/phase3/skins/MonoBook.php |
— | — | @@ -64,7 +64,31 @@ |
65 | 65 | <!--[if IE 7]><style type="text/css">@import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE70Fixes.css?1";</style><![endif]--> |
66 | 66 | <!--[if lt IE 7]><script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('stylepath') ?>/common/IEFixes.js"></script> |
67 | 67 | <meta http-equiv="imagetoolbar" content="no" /><![endif]--> |
68 | | - <script type="<?php $this->text('jsmimetype') ?>">var skin = '<?php $this->text('skinname')?>';var stylepath = '<?php $this->text('stylepath')?>';</script> |
| 68 | + |
| 69 | + <script type="<?php $this->text('jsmimetype') ?>"> |
| 70 | + var skin = "<?php $this->jstext('skinname')?>"; |
| 71 | + var stylepath = "<?php $this->jstext('stylepath')?>"; |
| 72 | + |
| 73 | + var wgArticlePath = "<?php $this->jstext( 'articlepath' ); ?>"; |
| 74 | + var wgScriptPath = "<?php $this->jstext( 'scriptpath' ); ?>"; |
| 75 | + var wgServer = "<?php $this->jstext( 'serverurl' ); ?>"; |
| 76 | + |
| 77 | + var wgCanonicalNamespace = "<?php $this->jstext( 'nscanonical' ); ?>"; |
| 78 | + var wgPageName = "<?php $this->jstext( 'titleprefixeddbkey' ); ?>"; |
| 79 | + var wgTitle = "<?php $this->jstext( 'titletext' ); ?>"; |
| 80 | + var wgArticleId = <?php (int) $this->jstext( 'articleid' ); ?>; |
| 81 | + |
| 82 | +<?php if($this->data['username']) { ?> |
| 83 | + var wgUserName = "<?php $this->jstext( 'username' ); ?>"; |
| 84 | + var wgUserLanguage = "<?php $this->jstext( 'userlang' ); ?>"; |
| 85 | +<?php } else { ?> |
| 86 | + var wgUserName = null; |
| 87 | + var wgUserLanguage = "<?php $this->jstext( 'userlang' ); ?>"; |
| 88 | +<?php } ?> |
| 89 | + var wgContentLanguage = "<?php $this->jstext( 'lang' ); ?>"; |
| 90 | + var wgSkinClass = "<?php $this->jstext( 'skinclass' ); ?>"; |
| 91 | + </script> |
| 92 | + |
69 | 93 | <script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('stylepath' ) ?>/common/wikibits.js?1"><!-- wikibits js --></script> |
70 | 94 | <?php if($this->data['jsvarurl' ]) { ?> |
71 | 95 | <script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('jsvarurl' ) ?>"><!-- site js --></script> |
Index: trunk/phase3/includes/Skin.php |
— | — | @@ -262,7 +262,33 @@ |
263 | 263 | |
264 | 264 | function getHeadScripts() { |
265 | 265 | global $wgStylePath, $wgUser, $wgAllowUserJs, $wgJsMimeType; |
266 | | - $r = "<script type=\"{$wgJsMimeType}\" src=\"{$wgStylePath}/common/wikibits.js\"></script>\n"; |
| 266 | + global $wgArticlePath, $wgScriptPath, $wgServer, $wgContLang, $wgLang; |
| 267 | + global $wgTitle, $wgCanonicalNamespaceNames; |
| 268 | + |
| 269 | + $nsname = @$wgCanonicalNamespaceNames[ $wgTitle->getNamespace() ]; |
| 270 | + if ( $nsname === NULL ) $nsname = $wgTitle->getNsText(); |
| 271 | + |
| 272 | + $r = '<script type= "'.$wgJsMimeType.'"> |
| 273 | + var skin = "' . Xml::escapeJsString( $this->getSkinName() ) . '"; |
| 274 | + var stylepath = "' . Xml::escapeJsString( $wgStylePath ) . '"; |
| 275 | + |
| 276 | + var wgArticlePath = "' . Xml::escapeJsString( $wgArticlePath ) . '"; |
| 277 | + var wgScriptPath = "' . Xml::escapeJsString( $wgScriptPath ) . '"; |
| 278 | + var wgServer = "' . Xml::escapeJsString( $wgServer ) . '"; |
| 279 | + |
| 280 | + var wgCanonicalNamespace = "' . Xml::escapeJsString( $nsname ) . '"; |
| 281 | + var wgPageName = "' . Xml::escapeJsString( $wgTitle->getPrefixedDBKey() ) . '"; |
| 282 | + var wgTitle = "' . Xml::escapeJsString( $wgTitle->getText() ) . '"; |
| 283 | + var wgArticleId = ' . (int)$wgTitle->getArticleId() . '; |
| 284 | + |
| 285 | + var wgUserName = ' . ( $wgUser->isAnon() ? 'null' : ( '"' . Xml::escapeJsString( $wgUser->getName() ) . '"' ) ) . '; |
| 286 | + var wgUserLanguage = "' . Xml::escapeJsString( $wgLang->getCode() ) . '"; |
| 287 | + var wgContentLanguage = "' . Xml::escapeJsString( $wgContLang->getCode() ) . '"; |
| 288 | + var wgSkinClass = "' . Xml::escapeJsString( get_class( $this ) ) . '"; |
| 289 | + </script> |
| 290 | + '; |
| 291 | + |
| 292 | + $r .= "<script type=\"{$wgJsMimeType}\" src=\"{$wgStylePath}/common/wikibits.js\"></script>\n"; |
267 | 293 | if( $wgAllowUserJs && $wgUser->isLoggedIn() ) { |
268 | 294 | $userpage = $wgUser->getUserPage(); |
269 | 295 | $userjs = htmlspecialchars( $this->makeUrl( |
Index: trunk/phase3/includes/Xml.php |
— | — | @@ -228,6 +228,9 @@ |
229 | 229 | # To avoid closing the element or CDATA section
|
230 | 230 | "<" => "\\x3c",
|
231 | 231 | ">" => "\\x3e",
|
| 232 | +
|
| 233 | + # To avoid any complaints about bad entity refs
|
| 234 | + "&" => "\\x26",
|
232 | 235 | );
|
233 | 236 | return strtr( $string, $pairs );
|
234 | 237 | }
|
Index: trunk/phase3/includes/SkinTemplate.php |
— | — | @@ -141,6 +141,7 @@ |
142 | 142 | global $wgPageShowWatchingUsers; |
143 | 143 | global $wgUseTrackbacks; |
144 | 144 | global $wgDBname; |
| 145 | + global $wgArticlePath, $wgScriptPath, $wgServer, $wgLang, $wgCanonicalNamespaceNames; |
145 | 146 | |
146 | 147 | $fname = 'SkinTemplate::outputPage'; |
147 | 148 | wfProfileIn( $fname ); |
— | — | @@ -193,6 +194,14 @@ |
194 | 195 | $tpl->set( 'pagetitle', $wgOut->getHTMLTitle() ); |
195 | 196 | $tpl->set( 'displaytitle', $wgOut->mPageLinkTitle ); |
196 | 197 | |
| 198 | + $nsname = @$wgCanonicalNamespaceNames[ $this->mTitle->getNamespace() ]; |
| 199 | + if ( $nsname === NULL ) $nsname = $this->mTitle->getNsText(); |
| 200 | + |
| 201 | + $tpl->set( 'nscanonical', $nsname ); |
| 202 | + $tpl->set( 'titleprefixeddbkey', $this->mTitle->getPrefixedDBKey() ); |
| 203 | + $tpl->set( 'titletext', $this->mTitle->getText() ); |
| 204 | + $tpl->set( 'articleid', $this->mTitle->getArticleId() ); |
| 205 | + |
197 | 206 | $tpl->setRef( "thispage", $this->thispage ); |
198 | 207 | $subpagestr = $this->subPageSubtitle(); |
199 | 208 | $tpl->set( |
— | — | @@ -230,6 +239,7 @@ |
231 | 240 | $tpl->set('headscripts', $out->getScript() ); |
232 | 241 | $tpl->setRef( 'wgScript', $wgScript ); |
233 | 242 | $tpl->setRef( 'skinname', $this->skinname ); |
| 243 | + $tpl->set( 'skinclass', get_class( $this ) ); |
234 | 244 | $tpl->setRef( 'stylename', $this->stylename ); |
235 | 245 | $tpl->set( 'printable', $wgRequest->getBool( 'printable' ) ); |
236 | 246 | $tpl->setRef( 'loggedin', $this->loggedin ); |
— | — | @@ -245,15 +255,19 @@ |
246 | 256 | $tpl->set( 'searchaction', $this->escapeSearchLink() ); |
247 | 257 | $tpl->set( 'search', trim( $wgRequest->getVal( 'search' ) ) ); |
248 | 258 | $tpl->setRef( 'stylepath', $wgStylePath ); |
| 259 | + $tpl->setRef( 'articlepath', $wgArticlePath ); |
| 260 | + $tpl->setRef( 'scriptpath', $wgScriptPath ); |
| 261 | + $tpl->setRef( 'serverurl', $wgServer ); |
249 | 262 | $tpl->setRef( 'logopath', $wgLogo ); |
250 | 263 | $tpl->setRef( "lang", $wgContLanguageCode ); |
251 | 264 | $tpl->set( 'dir', $wgContLang->isRTL() ? "rtl" : "ltr" ); |
252 | 265 | $tpl->set( 'rtl', $wgContLang->isRTL() ); |
253 | 266 | $tpl->set( 'langname', $wgContLang->getLanguageName( $wgContLanguageCode ) ); |
254 | 267 | $tpl->set( 'showjumplinks', $wgUser->getOption( 'showjumplinks' ) ); |
255 | | - $tpl->setRef( 'username', $this->username ); |
| 268 | + $tpl->set( 'username', $wgUser->isAnon() ? NULL : $this->username ); |
256 | 269 | $tpl->setRef( 'userpage', $this->userpage); |
257 | 270 | $tpl->setRef( 'userpageurl', $this->userpageUrlDetails['href']); |
| 271 | + $tpl->set( 'userlang', $wgLang->getCode() ); |
258 | 272 | $tpl->set( 'pagecss', $this->setupPageCss() ); |
259 | 273 | $tpl->setRef( 'usercss', $this->usercss); |
260 | 274 | $tpl->setRef( 'userjs', $this->userjs); |
— | — | @@ -1060,6 +1074,13 @@ |
1061 | 1075 | /** |
1062 | 1076 | * @private |
1063 | 1077 | */ |
| 1078 | + function jstext( $str ) { |
| 1079 | + echo Xml::escapeJsString( $this->data[$str] ); |
| 1080 | + } |
| 1081 | + |
| 1082 | + /** |
| 1083 | + * @private |
| 1084 | + */ |
1064 | 1085 | function html( $str ) { |
1065 | 1086 | echo $this->data[$str]; |
1066 | 1087 | } |