User talk:Hippietrail/personalsidebar.js
Jump to navigation
Jump to search
/* From function buildSidebar in file mediawiki/phase3/includes/Skin.php
*/ $bar = array(); $lines = explode( "\n", wfMsgForContent( 'sidebar' ) ); foreach ($lines as $line) { if (strpos($line, '*') !== 0) continue; if (strpos($line, '**') !== 0) { $line = trim($line, '* '); $heading = $line; } else { if (strpos($line, '|') !== false) { // sanity check $line = explode( '|' , trim($line, '* '), 2 ); $link = wfMsgForContent( $line[0] ); if ($link == '-') continue; if (wfEmptyMsg($line[1], $text = wfMsg($line[1]))) $text = $line[1]; if (wfEmptyMsg($line[0], $link)) $link = $line[0]; if ( preg_match( '/^(?:' . wfUrlProtocols() . ')/', $link ) ) { $href = $link; } else { $title = Title::newFromText( $link ); if ( $title ) { $title = $title->fixSpecialName(); $href = $title->getLocalURL(); } else { $href = 'INVALID-TITLE'; } } $bar[$heading][] = array( 'text' => $text, 'href' => $href, 'id' => 'n-' . strtr($line[1], ' ', '-'), 'active' => false ); } else { continue; } } } /*
- /
Start a discussion about User:Hippietrail/personalsidebar.js
Talk pages are where people discuss how to make content on Wiktionary the best that it can be. You can use this page to start a discussion with others about how to improve User:Hippietrail/personalsidebar.js.