Advertisement
Guest User

Jeff's skin.php file

a guest
Jan 8th, 2013
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.05 KB | None | 0 0
  1. <?php
  2. /**
  3. * MonoBook nouveau
  4. *
  5. * Translated from gwicke's previous TAL template version to remove
  6. * dependency on PHPTAL.
  7. *
  8. * @todo document
  9. * @file
  10. * @ingroup Skins
  11. */
  12.  
  13. if( !defined( 'MEDIAWIKI' ) )
  14. die( -1 );
  15.  
  16. /**
  17. * Inherit main code from SkinTemplate, set the CSS and template filter.
  18. * @todo document
  19. * @ingroup Skins
  20. */
  21. class SkinClaysterWeb extends SkinTemplate {
  22. /** Using monobook. */
  23. function initPage( OutputPage $out ) {
  24. parent::initPage( $out );
  25. $this->skinname = 'claysterweb';
  26. $this->stylename = 'claysterweb';
  27. $this->template = 'ClaysterWebTemplate';
  28.  
  29. }
  30.  
  31. function setupSkinUserCss( OutputPage $out ) {
  32. global $wgHandheldStyle;
  33.  
  34. parent::setupSkinUserCss( $out );
  35.  
  36. // Append to the default screen common & print styles...
  37. $out->addStyle( 'monobook/main.css', 'screen' );
  38. if( $wgHandheldStyle ) {
  39. // Currently in testing... try 'chick/main.css'
  40. $out->addStyle( $wgHandheldStyle, 'handheld' );
  41. }
  42.  
  43. $out->addStyle( 'monobook/IE50Fixes.css', 'screen', 'lt IE 5.5000' );
  44. $out->addStyle( 'monobook/IE55Fixes.css', 'screen', 'IE 5.5000' );
  45. $out->addStyle( 'monobook/IE60Fixes.css', 'screen', 'IE 6' );
  46. $out->addStyle( 'monobook/IE70Fixes.css', 'screen', 'IE 7' );
  47.  
  48. $out->addStyle( 'monobook/rtl.css', 'screen', '', 'rtl' );
  49. }
  50. }
  51.  
  52. /**
  53. * @todo document
  54. * @ingroup Skins
  55. */
  56. class ClaysterWebTemplate extends QuickTemplate {
  57. var $skin;
  58. /**
  59. * Template filter callback for MonoBook skin.
  60. * Takes an associative array of data set from a SkinTemplate-based
  61. * class, and a wrapper for MediaWiki's localization database, and
  62. * outputs a formatted page.
  63. *
  64. * @access private
  65. */
  66. function execute() {
  67. global $wgRequest;
  68. $this->skin = $skin = $this->data['skin'];
  69. $action = $wgRequest->getText( 'action' );
  70.  
  71. // Suppress warnings to prevent notices about missing indexes in $this->data
  72. wfSuppressWarnings();
  73.  
  74. ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  75. <html xmlns="<?php $this->text('xhtmldefaultnamespace') ?>" <?php
  76. foreach($this->data['xhtmlnamespaces'] as $tag => $ns) {
  77. ?>xmlns:<?php echo "{$tag}=\"{$ns}\" ";
  78. } ?>xml:lang="<?php $this->text('lang') ?>" lang="<?php $this->text('lang') ?>" dir="<?php $this->text('dir') ?>">
  79.  
  80. <head>
  81. <link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Mako">
  82. <meta http-equiv="Content-Type" content="<?php $this->text('mimetype') ?>; charset=<?php $this->text('charset') ?>" />
  83. <?php $this->html('headlinks') ?>
  84. <title><?php $this->text('pagetitle') ?></title>
  85. <link rel="stylesheet" type="text/css" media="screen"
  86. href="<?php $this->text('stylepath') ?>/common/shared.css?<?php echo $GLOBALS['wgStyleVersion'] ?>" />
  87. <link rel="stylesheet" type="text/css" media="print"
  88. href="<?php $this->text('stylepath') ?>/common/commonPrint.css?<?php echo $GLOBALS['wgStyleVersion'] ?>" />
  89. <link rel="stylesheet" type="text/css" media="screen"
  90. href="<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/main.css?
  91. <?php echo $GLOBALS['wgStyleVersion'] ?>" />
  92. <!--[if lt IE 5.5000]><link rel="stylesheet" type="text/css" media="screen"
  93. href="/skins/monobookmodified/IE50Fixes.css?<?php echo $GLOBALS['wgStyleVersion'] ?>" /><![endif]-->
  94. <!--[if IE 5.5000]><link rel="stylesheet" type="text/css" media="screen"
  95. href="/skins/monobookmodified/IE55Fixes.css?<?php echo $GLOBALS['wgStyleVersion'] ?>" /><![endif]-->
  96. <!--[if IE 6]><link rel="stylesheet" type="text/css" media="screen"
  97. href="/skins/monobookmodified/IE60Fixes.css?<?php echo $GLOBALS['wgStyleVersion'] ?>" /><![endif]-->
  98. <!--[if IE 7]><link rel="stylesheet" type="text/css" media="screen"
  99. href="/skins/monobookmodified/IE70Fixes.css?<?php echo $GLOBALS['wgStyleVersion'] ?>" /><![endif]-->
  100. <link rel="stylesheet" type="text/css"
  101. href="/index.php?title=MediaWiki:Common.css&amp;usemsgcache=yes&amp;ctype=text%2Fcss&amp;action=raw" />
  102. <link rel="stylesheet" type="text/css" media="print"
  103. href="/index.php?title=MediaWiki:Print.css&amp;usemsgcache=yes&amp;ctype=text%2Fcss&amp;action=raw" />
  104. <link rel="stylesheet" type="text/css"
  105. href="/index.php?title=MediaWiki:Monobookmodified.css&amp;usemsgcache=yes&amp;ctype=text%2Fcss&amp;action=raw"/>
  106. <link rel="stylesheet"
  107. href="/index.php?title=-&amp;action=raw&amp;ts=20090313183030&amp;gen=css" type="text/css"/>
  108.  
  109.  
  110. <!--[if lt IE 7]><script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('stylepath') ?>/common/IEFixes.js?<?php echo $GLOBALS['wgStyleVersion'] ?>"></script>
  111. <meta http-equiv="imagetoolbar" content="no" /><![endif]-->
  112.  
  113. <?php print Skin::makeGlobalVariablesScript( $this->data ); ?>
  114.  
  115. <script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('stylepath' ) ?>/common/wikibits.js?<?php echo $GLOBALS['wgStyleVersion'] ?>"><!-- wikibits js --></script>
  116. <!-- Head Scripts -->
  117. <?php $this->html('headscripts') ?>
  118. <?php if($this->data['jsvarurl']) { ?>
  119. <script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('jsvarurl') ?>"><!-- site js --></script>
  120. <?php } ?>
  121. <?php if($this->data['pagecss']) { ?>
  122. <style type="text/css"><?php $this->html('pagecss') ?></style>
  123. <?php }
  124. if($this->data['usercss']) { ?>
  125. <style type="text/css"><?php $this->html('usercss') ?></style>
  126. <?php }
  127. if($this->data['userjs']) { ?>
  128. <script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('userjs' ) ?>"></script>
  129. <?php }
  130. if($this->data['userjsprev']) { ?>
  131. <script type="<?php $this->text('jsmimetype') ?>"><?php $this->html('userjsprev') ?></script>
  132. <?php }
  133. if($this->data['trackbackhtml']) print $this->data['trackbackhtml']; ?>
  134.  
  135.  
  136. </head>
  137. <body<?php if($this->data['body_ondblclick']) { ?> ondblclick="<?php $this->text('body_ondblclick') ?>"<?php } ?>
  138. <?php if($this->data['body_onload']) { ?> onload="<?php $this->text('body_onload') ?>"<?php } ?>
  139. class="mediawiki <?php $this->text('dir') ?> <?php $this->text('pageclass') ?> <?php $this->text('skinnameclass') ?>">
  140. <div id="globalWrapper">
  141. <div id="column-content">
  142.  
  143. <div id="content">
  144. <a name="top" id="top"></a>
  145. <?php if($this->data['sitenotice']) { ?><div id="siteNotice"><?php $this->html('sitenotice') ?></div><?php } ?>
  146. <h1 id="firstHeading" class="firstHeading"><?php $this->data['displaytitle']!=""?$this->html('title'):$this->text('title') ?></h1>
  147.  
  148. <div id="bodyContent">
  149.  
  150. <h3 id="siteSub"><?php $this->msg('tagline') ?></h3>
  151. <div id="contentSub"><?php $this->html('subtitle') ?></div>
  152.  
  153. <?php if($this->data['undelete']) { ?><div id="contentSub2"><?php $this->html('undelete') ?></div><?php } ?>
  154. <?php if($this->data['newtalk'] ) { ?><div class="usermessage"><?php $this->html('newtalk') ?></div><?php } ?>
  155. <?php if($this->data['showjumplinks']) { ?><div id="jump-to-nav"><?php $this->msg('jumpto') ?> <a href="#column-one"><?php $this->msg('jumptonavigation') ?></a>, <a href="#searchInput"><?php $this->msg('jumptosearch') ?></a></div><?php } ?>
  156. <div id="p-search"> </div>
  157. <!-- start content -->
  158. <?php $this->html('bodytext') ?>
  159. <?php if($this->data['catlinks']) { $this->html('catlinks'); } ?>
  160. <!-- end content -->
  161. <?php if($this->data['dataAfterContent']) { $this->html ('dataAfterContent'); } ?>
  162. <div class="visualClear"></div>
  163. </div>
  164. </div>
  165. </div>
  166. <div id="column-one">
  167. <div id="p-cactions" class="portlet">
  168. <h5><?php $this->msg('views') ?></h5>
  169. <div class="pBody">
  170. <ul>
  171. <?php foreach($this->data['content_actions'] as $key => $tab) {
  172. echo '
  173. <li id="' . Sanitizer::escapeId( "ca-$key" ) . '"';
  174. if( $tab['class'] ) {
  175. echo ' class="'.htmlspecialchars($tab['class']).'"';
  176. }
  177. echo'><a href="'.htmlspecialchars($tab['href']).'"';
  178. # We don't want to give the watch tab an accesskey if the
  179. # page is being edited, because that conflicts with the
  180. # accesskey on the watch checkbox. We also don't want to
  181. # give the edit tab an accesskey, because that's fairly su-
  182. # perfluous and conflicts with an accesskey (Ctrl-E) often
  183. # used for editing in Safari.
  184. if( in_array( $action, array( 'edit', 'submit' ) )
  185. && in_array( $key, array( 'edit', 'watch', 'unwatch' ))) {
  186. echo $skin->tooltip( "ca-$key" );
  187. } else {
  188. echo $skin->tooltipAndAccesskey( "ca-$key" );
  189. }
  190. echo '>'.htmlspecialchars($tab['text']).'</a></li>';
  191. } ?>
  192. </ul>
  193. </div>
  194. </div>
  195. <div class="portlet" id="p-personal">
  196. <h5><?php $this->msg('personaltools') ?></h5>
  197. <div class="pBody">
  198. <ul>
  199. <?php foreach($this->data['personal_urls'] as $key => $item) { ?>
  200. <li id="<?php echo Sanitizer::escapeId( "pt-$key" ) ?>"<?php
  201. if ($item['active']) { ?> class="active"<?php } ?>><a href="<?php
  202. echo htmlspecialchars($item['href']) ?>"<?php echo $skin->tooltipAndAccesskey('pt-'.$key) ?><?php
  203. if(!empty($item['class'])) { ?> class="<?php
  204. echo htmlspecialchars($item['class']) ?>"<?php } ?>><?php
  205. echo htmlspecialchars($item['text']) ?></a></li>
  206. <?php } ?>
  207. </ul>
  208. </div>
  209. </div>
  210. <div class="portlet" id="p-logo">
  211. <a style="background-image: url(<?php $this->text('logopath') ?>);" <?php
  212. ?>href="<?php echo htmlspecialchars($this->data['nav_urls']['mainpage']['href'])?>"<?php
  213. echo $skin->tooltipAndAccesskey('p-logo') ?>></a>
  214. </div>
  215. <script type="<?php $this->text('jsmimetype') ?>"> if (window.isMSIE55) fixalpha(); </script>
  216. <?php
  217. $sidebar = $this->data['sidebar'];
  218. if ( !isset( $sidebar['SEARCH'] ) ) $sidebar['SEARCH'] = true;
  219. if ( !isset( $sidebar['TOOLBOX'] ) ) $sidebar['TOOLBOX'] = true;
  220. if ( !isset( $sidebar['LANGUAGES'] ) ) $sidebar['LANGUAGES'] = true;
  221. foreach ($sidebar as $boxName => $cont) {
  222. if ( $boxName == 'SEARCH' ) {
  223. $this->searchBox();
  224. } elseif ( $boxName == 'TOOLBOX' ) {
  225. $this->toolbox();
  226. } elseif ( $boxName == 'LANGUAGES' ) {
  227. $this->languageBox();
  228. } else {
  229. $this->customBox( $boxName, $cont );
  230. }
  231. }
  232. ?>
  233. </div><!-- end of the left (by default at least) column -->
  234. <div class="visualClear"></div>
  235. <div id="footer">
  236. <?php
  237. if($this->data['poweredbyico']) { ?>
  238. <div id="f-poweredbyico"><?php $this->html('poweredbyico') ?></div>
  239. <?php }
  240. if($this->data['copyrightico']) { ?>
  241. <div id="f-copyrightico"><?php $this->html('copyrightico') ?></div>
  242. <?php }
  243.  
  244. // Generate additional footer links
  245. $footerlinks = array(
  246. 'lastmod', 'viewcount', 'numberofwatchingusers', 'credits', 'copyright',
  247. 'privacy', 'about', 'disclaimer', 'tagline',
  248. );
  249. $validFooterLinks = array();
  250. foreach( $footerlinks as $aLink ) {
  251. if( isset( $this->data[$aLink] ) && $this->data[$aLink] ) {
  252. $validFooterLinks[] = $aLink;
  253. }
  254. }
  255. if ( count( $validFooterLinks ) > 0 ) {
  256. ?> <ul id="f-list">
  257. <?php
  258. foreach( $validFooterLinks as $aLink ) {
  259. if( isset( $this->data[$aLink] ) && $this->data[$aLink] ) {
  260. ?> <li id="<?php echo$aLink?>"><?php $this->html($aLink) ?></li>
  261. <?php }
  262. }
  263. ?>
  264. </ul>
  265. <?php }
  266. ?>
  267. </div>
  268. </div>
  269. <?php $this->html('bottomscripts'); /* JS call to runBodyOnloadHook */ ?>
  270. <?php $this->html('reporttime') ?>
  271. <?php if ( $this->data['debug'] ): ?>
  272. <!-- Debug output:
  273. <?php $this->text( 'debug' ); ?>
  274.  
  275. -->
  276. <?php endif; ?>
  277. </body></html>
  278. <?php
  279. wfRestoreWarnings();
  280. } // end of execute() method
  281.  
  282. /*************************************************************************************************/
  283. function searchBox() {
  284. global $wgUseTwoButtonsSearchForm;
  285. ?>
  286. <div id="p-search" class="portlet">
  287. <h5><label for="searchInput"><?php $this->msg('search') ?></label></h5>
  288. <div id="searchBody" class="pBody">
  289. <form action="<?php $this->text('wgScript') ?>" id="searchform"><div>
  290. <input type='hidden' name="title" value="<?php $this->text('searchtitle') ?>"/>
  291. <input id="searchInput" name="search" type="text"<?php echo $this->skin->tooltipAndAccesskey('search');
  292. if( isset( $this->data['search'] ) ) {
  293. ?> value="<?php $this->text('search') ?>"<?php } ?> />
  294. <input type='submit' name="go" class="searchButton" id="searchGoButton" value="<?php $this->msg('searcharticle') ?>"<?php echo $this->skin->tooltipAndAccesskey( 'search-go' ); ?> /><?php if ($wgUseTwoButtonsSearchForm) { ?>&nbsp;
  295. <input type='submit' name="fulltext" class="searchButton" id="mw-searchButton" value="<?php $this->msg('searchbutton') ?>"<?php echo $this->skin->tooltipAndAccesskey( 'search-fulltext' ); ?> /><?php } else { ?>
  296.  
  297. <div><a href="<?php $this->text('searchaction') ?>" rel="search"><?php $this->msg('powersearch-legend') ?></a></div><?php } ?>
  298.  
  299. </div></form>
  300. </div>
  301. </div>
  302. <?php
  303. }
  304.  
  305. /*************************************************************************************************/
  306. function toolbox() {
  307. ?>
  308. <div class="portlet" id="p-tb">
  309. <h5><?php $this->msg('toolbox') ?></h5>
  310. <div class="pBody">
  311. <ul>
  312. <?php
  313. if($this->data['notspecialpage']) { ?>
  314. <li id="t-whatlinkshere"><a href="<?php
  315. echo htmlspecialchars($this->data['nav_urls']['whatlinkshere']['href'])
  316. ?>"<?php echo $this->skin->tooltipAndAccesskey('t-whatlinkshere') ?>><?php $this->msg('whatlinkshere') ?></a></li>
  317. <?php
  318. if( $this->data['nav_urls']['recentchangeslinked'] ) { ?>
  319. <li id="t-recentchangeslinked"><a href="<?php
  320. echo htmlspecialchars($this->data['nav_urls']['recentchangeslinked']['href'])
  321. ?>"<?php echo $this->skin->tooltipAndAccesskey('t-recentchangeslinked') ?>><?php $this->msg('recentchangeslinked') ?></a></li>
  322. <?php }
  323. }
  324. if(isset($this->data['nav_urls']['trackbacklink'])) { ?>
  325. <li id="t-trackbacklink"><a href="<?php
  326. echo htmlspecialchars($this->data['nav_urls']['trackbacklink']['href'])
  327. ?>"<?php echo $this->skin->tooltipAndAccesskey('t-trackbacklink') ?>><?php $this->msg('trackbacklink') ?></a></li>
  328. <?php }
  329. if($this->data['feeds']) { ?>
  330. <li id="feedlinks"><?php foreach($this->data['feeds'] as $key => $feed) {
  331. ?><a id="<?php echo Sanitizer::escapeId( "feed-$key" ) ?>" href="<?php
  332. echo htmlspecialchars($feed['href']) ?>" rel="alternate" type="application/<?php echo $key ?>+xml" class="feedlink"<?php echo $this->skin->tooltipAndAccesskey('feed-'.$key) ?>><?php echo htmlspecialchars($feed['text'])?></a>&nbsp;
  333. <?php } ?></li><?php
  334. }
  335.  
  336. foreach( array('contributions', 'log', 'blockip', 'emailuser', 'upload', 'specialpages') as $special ) {
  337.  
  338. if($this->data['nav_urls'][$special]) {
  339. ?><li id="t-<?php echo $special ?>"><a href="<?php echo htmlspecialchars($this->data['nav_urls'][$special]['href'])
  340. ?>"<?php echo $this->skin->tooltipAndAccesskey('t-'.$special) ?>><?php $this->msg($special) ?></a></li>
  341. <?php }
  342. }
  343.  
  344. if(!empty($this->data['nav_urls']['print']['href'])) { ?>
  345. <li id="t-print"><a href="<?php echo htmlspecialchars($this->data['nav_urls']['print']['href'])
  346. ?>" rel="alternate"<?php echo $this->skin->tooltipAndAccesskey('t-print') ?>><?php $this->msg('printableversion') ?></a></li><?php
  347. }
  348.  
  349. if(!empty($this->data['nav_urls']['permalink']['href'])) { ?>
  350. <li id="t-permalink"><a href="<?php echo htmlspecialchars($this->data['nav_urls']['permalink']['href'])
  351. ?>"<?php echo $this->skin->tooltipAndAccesskey('t-permalink') ?>><?php $this->msg('permalink') ?></a></li><?php
  352. } elseif ($this->data['nav_urls']['permalink']['href'] === '') { ?>
  353. <li id="t-ispermalink"<?php echo $this->skin->tooltip('t-ispermalink') ?>><?php $this->msg('permalink') ?></li><?php
  354. }
  355.  
  356. wfRunHooks( 'ClaysterWebTemplateToolboxEnd', array( &$this ) );
  357. wfRunHooks( 'SkinTemplateToolboxEnd', array( &$this ) );
  358. ?>
  359. </ul>
  360. </div>
  361. </div>
  362. <?php
  363. }
  364.  
  365. /*************************************************************************************************/
  366. function languageBox() {
  367. if( $this->data['language_urls'] ) {
  368. ?>
  369. <div id="p-lang" class="portlet">
  370. <h5><?php $this->msg('otherlanguages') ?></h5>
  371. <div class="pBody">
  372. <ul>
  373. <?php foreach($this->data['language_urls'] as $langlink) { ?>
  374. <li class="<?php echo htmlspecialchars($langlink['class'])?>"><?php
  375. ?><a href="<?php echo htmlspecialchars($langlink['href']) ?>"><?php echo $langlink['text'] ?></a></li>
  376. <?php } ?>
  377. </ul>
  378. </div>
  379. </div>
  380. <?php
  381. }
  382. }
  383.  
  384. /*************************************************************************************************/
  385. function customBox( $bar, $cont ) {
  386. ?>
  387. <div class='generated-sidebar portlet' id='<?php echo Sanitizer::escapeId( "p-$bar" ) ?>'<?php echo $this->skin->tooltip('p-'.$bar) ?>>
  388. <h5><?php $out = wfMsg( $bar ); if (wfEmptyMsg($bar, $out)) echo $bar; else echo $out; ?></h5>
  389. <div class='pBody'>
  390. <?php if ( is_array( $cont ) ) { ?>
  391. <ul>
  392. <?php foreach($cont as $key => $val) { ?>
  393. <li id="<?php echo Sanitizer::escapeId($val['id']) ?>"<?php
  394. if ( $val['active'] ) { ?> class="active" <?php }
  395. ?>><a href="<?php echo htmlspecialchars($val['href']) ?>"<?php echo $this->skin->tooltipAndAccesskey($val['id']) ?>><?php echo htmlspecialchars($val['text']) ?></a></li>
  396. <?php } ?>
  397. </ul>
  398. <?php } else {
  399. # allow raw HTML block to be defined by extensions
  400. print $cont;
  401. }
  402. ?>
  403. </div>
  404. </div>
  405. <?php
  406. }
  407.  
  408. } // end of class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement