Advertisement
kirabook

StrappingSkin

Apr 22nd, 2014
12
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 31.01 KB | None | 0 0
  1. <?php
  2. /**
  3. *
  4. * @todo document
  5. * @file
  6. * @ingroup Skins
  7. */
  8.  
  9. if( !defined( 'MEDIAWIKI' ) ) {
  10. die( -1 );
  11. }
  12.  
  13. /**
  14. * SkinTemplate class for Vector skin
  15. * @ingroup Skins
  16. */
  17. class SkinStrapping extends SkinTemplate {
  18.  
  19. var $skinname = 'strapping', $stylename = 'strapping',
  20. $template = 'StrappingTemplate', $useHeadElement = true;
  21.  
  22. /**
  23. * Initializes output page and sets up skin-specific parameters
  24. * @param $out OutputPage object to initialize
  25. */
  26. public function initPage( OutputPage $out ) {
  27. global $wgLocalStylePath;
  28.  
  29. parent::initPage( $out );
  30.  
  31. // Append CSS which includes IE only behavior fixes for hover support -
  32. // this is better than including this in a CSS fille since it doesn't
  33. // wait for the CSS file to load before fetching the HTC file.
  34. $min = $this->getRequest()->getFuzzyBool( 'debug' ) ? '' : '.min';
  35. $out->addHeadItem( 'csshover',
  36. '<!--[if lt IE 7]><style type="text/css">body{behavior:url("' .
  37. htmlspecialchars( $wgLocalStylePath ) .
  38. "/{$this->stylename}/csshover{$min}.htc\")}</style><![endif]-->"
  39. );
  40.  
  41. $out->addHeadItem('responsive', '<meta name="viewport" content="width=device-width, initial-scale=1.0">');
  42. $out->addModuleScripts( 'skins.strapping' );
  43. }
  44.  
  45. /**
  46. * Load skin and user CSS files in the correct order
  47. * fixes bug 22916
  48. * @param $out OutputPage object
  49. */
  50. function setupSkinUserCss( OutputPage $out ){
  51. global $wgResourceModules;
  52.  
  53. parent::setupSkinUserCss( $out );
  54.  
  55. // FIXME: This is the "proper" way to include CSS
  56. // however, MediaWiki's ResourceLoader messes up media queries
  57. // See: https://bugzilla.wikimedia.org/show_bug.cgi?id=38586
  58. // &: http://stackoverflow.com/questions/11593312/do-media-queries-work-in-mediawiki
  59. //
  60. //$out->addModuleStyles( 'skins.strapping' );
  61.  
  62. // Instead, we're going to manually add each,
  63. // so we can use media queries
  64. foreach ( $wgResourceModules['skins.strapping']['styles'] as $cssfile => $cssvals ) {
  65. if (isset($cssvals)) {
  66. $out->addStyle( $cssfile, $cssvals['media'] );
  67. } else {
  68. $out->addStyle( $cssfile );
  69. }
  70. }
  71.  
  72. }
  73. }
  74.  
  75. /**
  76. * QuickTemplate class for Vector skin
  77. * @ingroup Skins
  78. */
  79. class StrappingTemplate extends BaseTemplate {
  80.  
  81. /* Functions */
  82.  
  83. /**
  84. * Outputs the entire contents of the (X)HTML page
  85. */
  86. public function execute() {
  87. global $wgGroupPermissions;
  88. global $wgVectorUseIconWatch;
  89. global $wgSearchPlacement;
  90. global $wgStrappingSkinLogoLocation;
  91. global $wgStrappingSkinLoginLocation;
  92. global $wgStrappingSkinAnonNavbar;
  93. global $wgStrappingSkinUseStandardLayout;
  94.  
  95. if (!$wgSearchPlacement) {
  96. $wgSearchPlacement['header'] = true;
  97. $wgSearchPlacement['nav'] = false;
  98. $wgSearchPlacement['footer'] = false;
  99. }
  100.  
  101. // Build additional attributes for navigation urls
  102. $nav = $this->data['content_navigation'];
  103.  
  104. if ( $wgVectorUseIconWatch ) {
  105. $mode = $this->getSkin()->getTitle()->userIsWatching() ? 'unwatch' : 'watch';
  106. if ( isset( $nav['actions'][$mode] ) ) {
  107. $nav['views'][$mode] = $nav['actions'][$mode];
  108. $nav['views'][$mode]['class'] = rtrim( 'icon ' . $nav['views'][$mode]['class'], ' ' );
  109. $nav['views'][$mode]['primary'] = true;
  110. unset( $nav['actions'][$mode] );
  111. }
  112. }
  113.  
  114. $xmlID = '';
  115. foreach ( $nav as $section => $links ) {
  116. foreach ( $links as $key => $link ) {
  117. if ( $section == 'views' && !( isset( $link['primary'] ) && $link['primary'] ) ) {
  118. $link['class'] = rtrim( 'collapsible ' . $link['class'], ' ' );
  119. }
  120.  
  121. $xmlID = isset( $link['id'] ) ? $link['id'] : 'ca-' . $xmlID;
  122. $nav[$section][$key]['attributes'] =
  123. ' id="' . Sanitizer::escapeId( $xmlID ) . '"';
  124. if ( $link['class'] ) {
  125. $nav[$section][$key]['attributes'] .=
  126. ' class="' . htmlspecialchars( $link['class'] ) . '"';
  127. unset( $nav[$section][$key]['class'] );
  128. }
  129. if ( isset( $link['tooltiponly'] ) && $link['tooltiponly'] ) {
  130. $nav[$section][$key]['key'] =
  131. Linker::tooltip( $xmlID );
  132. } else {
  133. $nav[$section][$key]['key'] =
  134. Xml::expandAttributes( Linker::tooltipAndAccesskeyAttribs( $xmlID ) );
  135. }
  136. }
  137. }
  138. $this->data['namespace_urls'] = $nav['namespaces'];
  139. $this->data['view_urls'] = $nav['views'];
  140. $this->data['action_urls'] = $nav['actions'];
  141. $this->data['variant_urls'] = $nav['variants'];
  142.  
  143. // Output HTML Page
  144. $this->html( 'headelement' );
  145. ?>
  146.  
  147. <?php if ( $wgGroupPermissions['*']['edit'] || $wgStrappingSkinAnonNavbar || $this->data['loggedin'] ) { ?>
  148. <div id="userbar" class="navbar navbar-static">
  149. <div class="navbar-inner">
  150. <div style="width: auto;" class="container">
  151. <div class="pull-left">
  152. <h2 class="site-title"><a href="<?php echo $this->data['nav_urls']['mainpage']['href']; ?>"><img src="/skins/common/images/sitetitle.png" alt="Crea"> Wiki</a></h2>
  153.  
  154. <ul class="navigation nav nav-pills pull-right searchform-disabled">
  155.  
  156. <?php
  157. $this->renderNavigation( array( 'SIDEBAR' ) );
  158.  
  159. if ($wgSearchPlacement['nav']) {
  160. $this->renderNavigation( array( 'SEARCHNAV' ) );
  161. }
  162.  
  163. if ( !isset( $portals['TOOLBOX'] ) ) {
  164. $this->renderNavigation( array( 'TOOLBOX' ) );
  165. }
  166. ?>
  167.  
  168. </ul>
  169.  
  170. </div>
  171.  
  172. <div class="pull-right">
  173.  
  174. <?php
  175. if ($wgSearchPlacement['header']) {
  176. $this->renderNavigation( array( 'SEARCH' ) );
  177. }
  178.  
  179. # Personal menu (at the right)
  180. $this->renderNavigation( array( 'PERSONAL' ) );
  181.  
  182. if ($wgStrappingSkinLoginLocation == 'header' && !$this->data['loggedin']) {
  183. $personalTemp = $this->getPersonalTools();
  184.  
  185. if (isset($personalTemp['login'])) {
  186. $loginType = 'login';
  187. } else {
  188. $loginType = 'anonlogin';
  189. }
  190.  
  191. ?><li id="pt-login"><a href="<?php echo $personalTemp[$loginType]['links'][0]['href'] ?>"><?php echo $personalTemp[$loginType]['links'][0]['text']; ?></a></li><?php
  192. }
  193. ?>
  194. <span id="share-icons"><a href="http://www.facebook.com/siegegames"><img src="/skins/common/images/icon_facebook.png" alt="facebook"></a>
  195. <a href="http://twitter.com/SiegeGames"><img src="/skins/common/images/icon_twitter.png" alt="twitter"></a>
  196. <a href="http://steamcommunity.com/sharedfiles/filedetails/?id=189066547"><img src="/skins/common/images/icon_steam.png" alt="steam"></a></span>
  197. </div>
  198.  
  199. </div>
  200. </div>
  201. </div>
  202. <?php } ?>
  203.  
  204. <div id="mw-page-base" class="noprint"></div>
  205. <div id="mw-head-base" class="noprint"></div>
  206.  
  207. <!-- Header -->
  208. <div id="page-header" class="container <?php echo $this->data['loggedin'] ? 'signed-in' : 'signed-out'; ?>">
  209. <section class="span12">
  210.  
  211. <?php
  212. if ( $wgStrappingSkinLogoLocation == 'bodycontent' ) {
  213. } ?>
  214. <!--<img src="http://creawiki.net/skins/common/images/wiki.png">-->
  215.  
  216.  
  217. </section>
  218. </div>
  219.  
  220. <?php if ($this->data['loggedin']) {
  221. $userStateClass = "user-loggedin";
  222. } else {
  223. $userStateClass = "user-loggedout";
  224. } ?>
  225.  
  226. <?php if ($wgGroupPermissions['*']['edit'] || $this->data['loggedin']) {
  227. $userStateClass += " editable";
  228. } else {
  229. $userStateClass += " not-editable";
  230. } ?>
  231.  
  232. <!-- content -->
  233. <section id="content" class="mw-body container <?php echo $userStateClass; ?>">
  234. <div id="top"></div>
  235. <div id="mw-js-message" style="display:none;"<?php $this->html( 'userlangattributes' ) ?>></div>
  236. <?php if ( $this->data['sitenotice'] ): ?>
  237. <!-- sitenotice -->
  238. <div id="siteNotice"><?php $this->html( 'sitenotice' ) ?></div>
  239. <!-- /sitenotice -->
  240. <?php endif; ?>
  241. <div class="pagebar">
  242. <div class="pagebar-inner">
  243. <div style="width: auto;" class="container">
  244. <div class="pull-right">
  245. <?php
  246. if ( $wgStrappingSkinLogoLocation == 'pagebar' ) {
  247. $this->renderLogo();
  248. }
  249. # Page header & menu
  250. $this->renderNavigation( array( 'PAGE' ) );
  251.  
  252. # This content in other languages
  253. if ( $this->data['language_urls'] ) {
  254. $this->renderNavigation( array( 'LANGUAGES' ) );
  255. }
  256.  
  257. # Edit button
  258. $this->renderNavigation( array( 'EDIT' ) );
  259.  
  260. # Actions menu
  261. $this->renderNavigation( array( 'ACTIONS' ) );
  262.  
  263. # Sidebar items to display in navbar
  264. $this->renderNavigation( array( 'SIDEBARNAV' ) );
  265.  
  266. ?>
  267. </div>
  268. </div>
  269. </div>
  270. </div>
  271. <!-- bodyContent -->
  272. <div id="bodyContent">
  273.  
  274. <?php if( $this->data['newtalk'] ): ?>
  275. <!-- newtalk -->
  276. <div class="usermessage"><?php $this->html( 'newtalk' ) ?></div>
  277. <!-- /newtalk -->
  278. <?php endif; ?>
  279. <?php if ( $this->data['showjumplinks'] ): ?>
  280. <!-- jumpto -->
  281. <div id="jump-to-nav" class="mw-jump">
  282. <?php $this->msg( 'jumpto' ) ?> <a href="#mw-head"><?php $this->msg( 'jumptonavigation' ) ?></a>,
  283. <a href="#p-search"><?php $this->msg( 'jumptosearch' ) ?></a>
  284. </div>
  285. <!-- /jumpto -->
  286. <?php endif; ?>
  287.  
  288.  
  289. <!-- innerbodycontent -->
  290. <?php # Peek into the body content of articles, to see if a custom layout is used
  291. if ($wgStrappingSkinUseStandardLayout || preg_match("/<div.*class.*row.*>/i", $this->data['bodycontent']) && $this->data['articleid']) {
  292. # If there's a custom layout, the H1 and layout is up to the page ?>
  293. <div id="innerbodycontent" class="layout">
  294. <h1 id="firstHeading" class="firstHeading page-header">
  295. <span dir="auto"><?php $this->html( 'title' ) ?></span>
  296. </h1>
  297. <!-- subtitle -->
  298. <div id="contentSub" <?php $this->html( 'userlangattributes' ) ?>><?php $this->html( 'subtitle' ) ?></div>
  299. <!-- /subtitle -->
  300. <?php if ( $this->data['undelete'] ): ?>
  301. <!-- undelete -->
  302. <div id="contentSub2"><?php $this->html( 'undelete' ) ?></div>
  303. <!-- /undelete -->
  304. <?php endif; ?>
  305. <?php $this->html( 'bodycontent' ); ?>
  306. </div>
  307. <?php } else {
  308. # If there's no custom layout, then we automagically add one ?>
  309. <div id="innerbodycontent" class="row nolayout"><div class="offset1 span10">
  310. <h1 id="firstHeading" class="firstHeading page-header">
  311. <span dir="auto"><?php $this->html( 'title' ) ?></span>
  312. </h1>
  313. <!-- subtitle -->
  314. <div id="contentSub" <?php $this->html( 'userlangattributes' ) ?>><?php $this->html( 'subtitle' ) ?></div>
  315. <!-- /subtitle -->
  316. <?php if ( $this->data['undelete'] ): ?>
  317. <!-- undelete -->
  318. <div id="contentSub2"><?php $this->html( 'undelete' ) ?></div>
  319. <!-- /undelete -->
  320. <?php endif; ?>
  321. <?php $this->html( 'bodycontent' ); ?>
  322.  
  323.  
  324. <?php if ( $this->data['printfooter'] ): ?>
  325. <!-- printfooter -->
  326. <div class="printfooter">
  327. <?php $this->html( 'printfooter' ); ?>
  328. </div>
  329. <!-- /printfooter -->
  330. <?php endif; ?>
  331. <?php if ( $this->data['catlinks'] ): ?>
  332. <!-- catlinks -->
  333. <?php $this->html( 'catlinks' ); ?>
  334. <!-- /catlinks -->
  335. <?php endif; ?>
  336.  
  337. </div></div>
  338. <?php } ?>
  339. <!-- /innerbodycontent -->
  340.  
  341.  
  342.  
  343.  
  344. <?php if ( $this->data['dataAfterContent'] ): ?>
  345. <!-- dataAfterContent -->
  346. <?php $this->html( 'dataAfterContent' ); ?>
  347. <!-- /dataAfterContent -->
  348. <?php endif; ?>
  349. <div class="visualClear"></div>
  350. <!-- debughtml -->
  351. <?php $this->html( 'debughtml' ); ?>
  352. <!-- /debughtml -->
  353.  
  354.  
  355. <!-- footer -->
  356.  
  357. <?php
  358. /* Support a custom footer, or use MediaWiki's default, if footer.php does not exist. */
  359. $footerfile = dirname(__FILE__).'/footer.php';
  360.  
  361. if ( file_exists($footerfile) ):
  362. ?><div id="footer" class="footer container custom-footer"><?php
  363. include( $footerfile );
  364. ?></div><?php
  365. else:
  366. ?>
  367.  
  368. <div id="footer" class="footer container"<?php $this->html( 'userlangattributes' ) ?>>
  369. <div class="row">
  370. <?php
  371. $footerLinks = $this->getFooterLinks();
  372.  
  373. if (is_array($footerLinks)) {
  374. foreach($footerLinks as $category => $links ):
  375. if ($category === 'info') { continue; } ?>
  376.  
  377. <ul id="footer-<?php echo $category ?>">
  378. <?php foreach( $links as $link ): ?>
  379. <li id="footer-<?php echo $category ?>-<?php echo $link ?>"><?php $this->html( $link ) ?></li>
  380. <?php endforeach; ?>
  381. <?php
  382. if ($category === 'places') {
  383.  
  384. # Show sign in link, if not signed in
  385. if ($wgStrappingSkinLoginLocation == 'footer' && !$this->data['loggedin']) {
  386. $personalTemp = $this->getPersonalTools();
  387.  
  388. if (isset($personalTemp['login'])) {
  389. $loginType = 'login';
  390. } else {
  391. $loginType = 'anonlogin';
  392. }
  393.  
  394. ?><li id="pt-login"><a href="<?php echo $personalTemp[$loginType]['links'][0]['href'] ?>"><?php echo $personalTemp[$loginType]['links'][0]['text']; ?></a></li><?php
  395. }
  396.  
  397. # Show the search in footer to all
  398. if ($wgSearchPlacement['footer']) {
  399. echo '<li>';
  400. $this->renderNavigation( array( 'SEARCHFOOTER' ) );
  401. echo '</li>';
  402. }
  403. }
  404. ?>
  405. </ul>
  406. <?php
  407. endforeach;
  408. }
  409. ?>
  410. <?php $footericons = $this->getFooterIcons("icononly");
  411. if ( count( $footericons ) > 0 ): ?>
  412. <ul id="footer-icons" class="noprint">
  413. <?php foreach ( $footericons as $blockName => $footerIcons ): ?>
  414. <li id="footer-<?php echo htmlspecialchars( $blockName ); ?>ico">
  415. <?php foreach ( $footerIcons as $icon ): ?>
  416. <?php echo $this->getSkin()->makeFooterIcon( $icon ); ?>
  417.  
  418. <?php endforeach; ?>
  419. </li>
  420. <?php endforeach; ?>
  421. </ul>
  422. <?php endif; ?>
  423. </div>
  424. </div>
  425. <!-- /footer -->
  426. </div>
  427. <!-- /bodyContent -->
  428. </section>
  429. <!-- /content -->
  430. <?php endif; ?>
  431.  
  432. <?php $this->printTrail(); ?>
  433.  
  434. </body>
  435. </html>
  436. <?php
  437. }
  438.  
  439. /**
  440. * Render logo
  441. */
  442. private function renderLogo() {
  443. $mainPageLink = $this->data['nav_urls']['mainpage']['href'];
  444. $toolTip = Xml::expandAttributes( Linker::tooltipAndAccesskeyAttribs( 'p-logo' ) );
  445. ?>
  446. <ul class="nav logo-container" role="navigation"><li id="p-logo"><a href="<?php echo htmlspecialchars( $this->data['nav_urls']['mainpage']['href'] ) ?>" <?php echo Xml::expandAttributes( Linker::tooltipAndAccesskeyAttribs( 'p-logo' ) ) ?>><img src="<?php $this->text( 'logopath' ); ?>" alt="<?php $this->html('sitename'); ?>"></a></li></ul>
  447. <?php
  448. }
  449.  
  450. /**
  451. * Render one or more navigations elements by name, automatically reveresed
  452. * when UI is in RTL mode
  453. *
  454. * @param $elements array
  455. */
  456. private function renderNavigation( $elements ) {
  457. global $wgVectorUseSimpleSearch;
  458. global $wgStrappingSkinLoginLocation;
  459. global $wgStrappingSkinDisplaySidebarNavigation;
  460. global $wgStrappingSkinSidebarItemsInNavbar;
  461.  
  462. // If only one element was given, wrap it in an array, allowing more
  463. // flexible arguments
  464. if ( !is_array( $elements ) ) {
  465. $elements = array( $elements );
  466. // If there's a series of elements, reverse them when in RTL mode
  467. } elseif ( $this->data['rtl'] ) {
  468. $elements = array_reverse( $elements );
  469. }
  470. // Render elements
  471. foreach ( $elements as $name => $element ) {
  472. echo "\n<!-- {$name} -->\n";
  473. switch ( $element ) {
  474.  
  475. case 'EDIT':
  476. if ( !array_key_exists('edit', $this->data['content_actions']) ) {
  477. break;
  478. }
  479. $navTemp = $this->data['content_actions']['edit'];
  480.  
  481. if ($navTemp) { ?>
  482. <div class="actions pull-left nav">
  483. <a id="b-edit" href="<?php echo $navTemp['href']; ?>" class="btn"><i class="icon-edit"></i> <?php echo $navTemp['text']; ?></a>
  484. </div>
  485. <?php }
  486. break;
  487.  
  488.  
  489. case 'PAGE':
  490. $theMsg = 'namespaces';
  491. $theData = array_merge($this->data['namespace_urls'], $this->data['view_urls']);
  492. ?>
  493. <ul class="nav" role="navigation">
  494. <li class="dropdown" id="p-<?php echo $theMsg; ?>" class="vectorMenu<?php if ( count($theData) == 0 ) echo ' emptyPortlet'; ?>">
  495. <?php
  496. foreach ( $theData as $link ) {
  497. if ( array_key_exists( 'context', $link ) && $link['context'] == 'subject' ) {
  498. ?>
  499. <a data-toggle="dropdown" class="dropdown-toggle brand" role="menu"><?php echo htmlspecialchars( $link['text'] ); ?> <b class="caret"></b></a>
  500. <?php } ?>
  501. <?php } ?>
  502. <ul aria-labelledby="<?php echo $this->msg($theMsg); ?>" role="menu" class="dropdown-menu" <?php $this->html( 'userlangattributes' ) ?>>
  503.  
  504. <?php
  505. foreach ( $theData as $link ) {
  506. # Skip a few redundant links
  507. if (preg_match('/^ca-(view|edit)$/', $link['id'])) { continue; }
  508.  
  509. ?><li<?php echo $link['attributes'] ?>><a href="<?php echo htmlspecialchars( $link['href'] ) ?>" <?php echo $link['key'] ?> tabindex="-1"><?php echo htmlspecialchars( $link['text'] ) ?></a></li><?php
  510. }
  511.  
  512. ?></ul></li></ul><?php
  513.  
  514. break;
  515.  
  516.  
  517. case 'TOOLBOX':
  518.  
  519. $theMsg = 'toolbox';
  520. $theData = array_reverse($this->getToolbox());
  521. ?>
  522.  
  523. <ul class="nav" role="navigation">
  524.  
  525. <li class="dropdown" id="p-<?php echo $theMsg; ?>" class="vectorMenu<?php if ( count($theData) == 0 ) echo ' emptyPortlet'; ?>">
  526.  
  527. <a data-toggle="dropdown" class="dropdown-toggle" role="button"><?php $this->msg($theMsg) ?> <b class="caret"></b></a>
  528.  
  529. <ul aria-labelledby="<?php echo $this->msg($theMsg); ?>" role="menu" class="dropdown-menu" <?php $this->html( 'userlangattributes' ) ?>>
  530.  
  531. <?php
  532. foreach( $theData as $key => $item ) {
  533. if (preg_match('/specialpages|whatlinkshere/', $key)) {
  534. echo '<li class="divider"></li>';
  535. }
  536.  
  537. echo $this->makeListItem( $key, $item );
  538. }
  539. ?>
  540. </ul>
  541.  
  542. </li>
  543.  
  544. </ul>
  545. <?php
  546. break;
  547.  
  548.  
  549. case 'VARIANTS':
  550.  
  551. $theMsg = 'variants';
  552. $theData = $this->data['variant_urls'];
  553. ?>
  554. <?php if (count($theData) > 0) { ?>
  555. <ul class="nav" role="navigation">
  556. <li class="dropdown" id="p-<?php echo $theMsg; ?>" class="vectorMenu<?php if ( count($theData) == 0 ) echo ' emptyPortlet'; ?>">
  557. <a data-toggle="dropdown" class="dropdown-toggle" role="button"><?php $this->msg($theMsg) ?> <b class="caret"></b></a>
  558. <ul aria-labelledby="<?php echo $this->msg($theMsg); ?>" role="menu" class="dropdown-menu" <?php $this->html( 'userlangattributes' ) ?>>
  559. <?php foreach ( $theData as $link ): ?>
  560. <li<?php echo $link['attributes'] ?>><a href="<?php echo htmlspecialchars( $link['href'] ) ?>" <?php echo $link['key'] ?> tabindex="-1"><?php echo htmlspecialchars( $link['text'] ) ?></a></li>
  561. <?php endforeach; ?>
  562. </ul>
  563. </li>
  564. </ul>
  565. <?php }
  566.  
  567. break;
  568.  
  569. case 'VIEWS':
  570. $theMsg = 'views';
  571. $theData = $this->data['view_urls'];
  572. ?>
  573. <?php if (count($theData) > 0) { ?>
  574. <ul class="nav" role="navigation">
  575. <li class="dropdown" id="p-<?php echo $theMsg; ?>" class="vectorMenu<?php if ( count($theData) == 0 ) echo ' emptyPortlet'; ?>">
  576. <a data-toggle="dropdown" class="dropdown-toggle" role="button"><?php $this->msg($theMsg) ?> <b class="caret"></b></a>
  577. <ul aria-labelledby="<?php echo $this->msg($theMsg); ?>" role="menu" class="dropdown-menu" <?php $this->html( 'userlangattributes' ) ?>>
  578. <?php foreach ( $theData as $link ): ?>
  579. <li<?php echo $link['attributes'] ?>><a href="<?php echo htmlspecialchars( $link['href'] ) ?>" <?php echo $link['key'] ?> tabindex="-1"><?php echo htmlspecialchars( $link['text'] ) ?></a></li>
  580. <?php endforeach; ?>
  581. </ul>
  582. </li>
  583. </ul>
  584. <?php }
  585. break;
  586.  
  587.  
  588. case 'ACTIONS':
  589.  
  590. $theMsg = 'actions';
  591. $theData = array_reverse($this->data['action_urls']);
  592.  
  593. if (count($theData) > 0) {
  594. ?><ul class="nav" role="navigation">
  595. <li class="dropdown" id="p-<?php echo $theMsg; ?>" class="vectorMenu<?php if ( count($theData) == 0 ) echo ' emptyPortlet'; ?>">
  596. <a data-toggle="dropdown" class="dropdown-toggle" role="button"><?php echo $this->msg( 'actions' ); ?> <b class="caret"></b></a>
  597. <ul aria-labelledby="<?php echo $this->msg($theMsg); ?>" role="menu" class="dropdown-menu" <?php $this->html( 'userlangattributes' ) ?>>
  598. <?php foreach ( $theData as $link ):
  599.  
  600. if (preg_match('/MovePage/', $link['href'])) {
  601. echo '<li class="divider"></li>';
  602. }
  603.  
  604. ?>
  605.  
  606. <li<?php echo $link['attributes'] ?>><a href="<?php echo htmlspecialchars( $link['href'] ) ?>" <?php echo $link['key'] ?> tabindex="-1"><?php echo htmlspecialchars( $link['text'] ) ?></a></li>
  607. <?php endforeach; ?>
  608. </ul>
  609. </li>
  610. </ul><?php
  611. }
  612.  
  613. break;
  614.  
  615.  
  616. case 'PERSONAL':
  617. $theMsg = 'personaltools';
  618. $theData = $this->getPersonalTools();
  619. $theTitle = $this->data['username'];
  620. $showPersonal = false;
  621. foreach ( $theData as $key => $item ) {
  622. if ( !preg_match('/(notifications|login|createaccount)/', $key) ) {
  623. $showPersonal = true;
  624. }
  625. }
  626.  
  627. ?>
  628. <ul class="nav" role="navigation">
  629. <li class="dropdown" id="p-notifications" class="vectorMenu<?php if ( count($theData) == 0 ) echo ' emptyPortlet'; ?>">
  630. <?php if ( array_key_exists('notifications', $theData) ) {
  631. echo $this->makeListItem( 'notifications', $theData['notifications'] );
  632. } ?>
  633. </li>
  634. <?php if ( $wgStrappingSkinLoginLocation == 'navbar' ): ?>
  635. <li class="dropdown" id="p-createaccount" class="vectorMenu<?php if ( count($theData) == 0 ) echo ' emptyPortlet'; ?>">
  636. <?php if ( array_key_exists('createaccount', $theData) ) {
  637. echo $this->makeListItem( 'createaccount', $theData['createaccount'] );
  638. } ?>
  639. </li>
  640. <li class="dropdown" id="p-login" class="vectorMenu<?php if ( count($theData) == 0 ) echo ' emptyPortlet'; ?>">
  641. <?php if ( array_key_exists('login', $theData) ) {
  642. echo $this->makeListItem( 'login', $theData['login'] );
  643. } ?>
  644. </li>
  645. <?php endif; ?>
  646. <?php
  647. if ( $showPersonal ):
  648. ?>
  649. <li class="dropdown" id="p-<?php echo $theMsg; ?>" class="vectorMenu<?php if ( !$showPersonal ) echo ' emptyPortlet'; ?>">
  650. <a data-toggle="dropdown" class="dropdown-toggle" role="button">
  651. <i class="icon-user"></i>
  652. <?php echo $theTitle; ?> <b class="caret"></b></a>
  653. <ul aria-labelledby="<?php echo $this->msg($theMsg); ?>" role="menu" class="dropdown-menu" <?php $this->html( 'userlangattributes' ) ?>>
  654. <?php foreach( $theData as $key => $item ) {
  655.  
  656. if (preg_match('/preferences|logout/', $key)) {
  657. echo '<li class="divider"></li>';
  658. } else if ( preg_match('/(notifications|login|createaccount)/', $key) ) {
  659. continue;
  660. }
  661.  
  662. echo $this->makeListItem( $key, $item );
  663. } ?>
  664. </ul>
  665. </li>
  666. <?php endif; ?>
  667. </ul>
  668. <?php
  669. break;
  670.  
  671.  
  672. case 'SEARCH':
  673. ?>
  674. <form class="navbar-search" action="<?php $this->text( 'wgScript' ) ?>" id="searchform">
  675. <input id="searchInput" class="search-query" type="search" accesskey="f" title="<?php $this->text('searchtitle'); ?>" placeholder="<?php $this->msg('search'); ?>" name="search" value="<?php echo htmlspecialchars ($this->data['search']); ?>">
  676. <?php echo $this->makeSearchButton( 'fulltext', array( 'id' => 'mw-searchButton', 'class' => 'searchButton btn hidden' ) ); ?>
  677. </form>
  678.  
  679. <?php
  680. break;
  681.  
  682.  
  683. case 'SEARCHNAV':
  684. ?>
  685. <li>
  686. <a id="n-Search" class="search-link"><i class="icon-search"></i>Search</a>
  687. <form class="navbar-search" action="<?php $this->text( 'wgScript' ) ?>" id="nav-searchform">
  688. <input id="nav-searchInput" class="search-query" type="search" accesskey="f" title="<?php $this->text('searchtitle'); ?>" placeholder="<?php $this->msg('search'); ?>" name="search" value="<?php echo htmlspecialchars ($this->data['search']); ?>">
  689. <?php echo $this->makeSearchButton( 'fulltext', array( 'id' => 'mw-searchButton', 'class' => 'searchButton btn hidden' ) ); ?>
  690. </form>
  691. </li>
  692.  
  693. <?php
  694. break;
  695.  
  696.  
  697. case 'SEARCHFOOTER':
  698. ?>
  699. <form class="" action="<?php $this->text( 'wgScript' ) ?>" id="footer-search">
  700. <i class="icon-search"></i><b class="border"></b><input id="footer-searchInput" class="search-query" type="search" accesskey="f" title="<?php $this->text('searchtitle'); ?>" placeholder="<?php $this->msg('search'); ?>" name="search" value="<?php echo htmlspecialchars ($this->data['search']); ?>">
  701. <?php echo $this->makeSearchButton( 'fulltext', array( 'id' => 'mw-searchButton', 'class' => 'searchButton btn hidden' ) ); ?>
  702. </form>
  703.  
  704. <?php
  705. break;
  706.  
  707.  
  708. case 'SIDEBARNAV':
  709. foreach ( $this->data['sidebar'] as $name => $content ) {
  710. if ( !$content ) {
  711. continue;
  712. }
  713. if ( !in_array( $name, $wgStrappingSkinSidebarItemsInNavbar ) ) {
  714. continue;
  715. }
  716. $msgObj = wfMessage( $name );
  717. $name = htmlspecialchars( $msgObj->exists() ? $msgObj->text() : $name ); ?>
  718. <ul class="nav" role="navigation">
  719. <li class="dropdown" id="p-<?php echo $name; ?>" class="vectorMenu">
  720. <a data-toggle="dropdown" class="dropdown-toggle" role="menu"><?php echo htmlspecialchars( $name ); ?> <b class="caret"></b></a>
  721. <ul aria-labelledby="<?php echo htmlspecialchars( $name ); ?>" role="menu" class="dropdown-menu" <?php $this->html( 'userlangattributes' ) ?>><?php
  722. # This is a rather hacky way to name the nav.
  723. # (There are probably bugs here...)
  724. foreach( $content as $key => $val ) {
  725. $navClasses = '';
  726.  
  727. if (array_key_exists('view', $this->data['content_navigation']['views']) && $this->data['content_navigation']['views']['view']['href'] == $val['href']) {
  728. $navClasses = 'active';
  729. }?>
  730.  
  731. <li class="<?php echo $navClasses ?>"><?php echo $this->makeLink($key, $val); ?></li><?php
  732. }
  733. }?>
  734. </li>
  735. </ul></ul><?php
  736. break;
  737.  
  738.  
  739. case 'SIDEBAR':
  740. foreach ( $this->data['sidebar'] as $name => $content ) {
  741. if ( !isset($content) ) {
  742. continue;
  743. }
  744. if ( in_array( $name, $wgStrappingSkinSidebarItemsInNavbar ) ) {
  745. continue;
  746. }
  747. $msgObj = wfMessage( $name );
  748. $name = htmlspecialchars( $msgObj->exists() ? $msgObj->text() : $name );
  749. if ( $wgStrappingSkinDisplaySidebarNavigation ) { ?>
  750. <li class="dropdown">
  751. <a data-toggle="dropdown" class="dropdown-toggle" role="button"><?php echo htmlspecialchars( $name ); ?><b class="caret"></b></a>
  752. <ul aria-labelledby="<?php echo htmlspecialchars( $name ); ?>" role="menu" class="dropdown-menu"><?php
  753. }
  754. # This is a rather hacky way to name the nav.
  755. # (There are probably bugs here...)
  756. foreach( $content as $key => $val ) {
  757. $navClasses = '';
  758.  
  759. if (array_key_exists('view', $this->data['content_navigation']['views']) && $this->data['content_navigation']['views']['view']['href'] == $val['href']) {
  760. $navClasses = 'active';
  761. }?>
  762.  
  763. <li class="<?php echo $navClasses ?>"><?php echo $this->makeLink($key, $val); ?></li><?php
  764. }
  765. if ( $wgStrappingSkinDisplaySidebarNavigation ) {?> </ul> </li><?php
  766. } }
  767. break;
  768.  
  769. case 'LANGUAGES':
  770. $theMsg = 'otherlanguages';
  771. $theData = $this->data['language_urls']; ?>
  772. <ul class="nav" role="navigation">
  773. <li class="dropdown" id="p-<?php echo $theMsg; ?>" class="vectorMenu<?php if ( count($theData) == 0 ) echo ' emptyPortlet'; ?>">
  774. <a data-toggle="dropdown" class="dropdown-toggle brand" role="menu"><?php echo $this->html($theMsg) ?> <b class="caret"></b></a>
  775. <ul aria-labelledby="<?php echo $this->msg($theMsg); ?>" role="menu" class="dropdown-menu" <?php $this->html( 'userlangattributes' ) ?>>
  776.  
  777. <?php foreach( $content as $key => $val ) { ?>
  778. <li class="<?php echo $navClasses ?>"><?php echo $this->makeLink($key, $val, $options); ?></li><?php
  779. }?>
  780.  
  781. </ul> </li>
  782. </ul><?php
  783. break;
  784. }
  785. echo "\n<!-- /{$name} -->\n";
  786. }
  787. }
  788. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement