function getHeaderMenu($menu) { global $wgLanguageCode, $wgTitle, $wgUser, $wgForumLink; $html = ''; $menu_css = 'menu'; $sk = $this->getSkin(); $isLoggedIn = $wgUser->getID() > 0; switch ($menu) { case 'edit': $html = "<a href='" . $wgTitle->getLocalURL($sk->editUrlOptions()) . "'>" . wfMessage('edit-this-article')->text() . "</a>"; if (!$isLoggedIn) { break; } $html .= Linker::link(SpecialPage::getTitleFor('Importvideo', $wgTitle->getText()), wfMessage('importvideo')->text()); if ($wgLanguageCode == 'en') { $html .= Linker::link(Title::makeTitle(NS_SPECIAL, "RelatedArticle"), wfMessage('manage_related_articles')->text(), array(), array("target" => $wgTitle->getPrefixedURL())) . Linker::link(SpecialPage::getTitleFor("Articlestats", $wgTitle->getText()), wfMessage('articlestats')->text()); } $html .= "<a href='" . Title::makeTitle(NS_SPECIAL, "Whatlinkshere")->getLocalUrl() . "/" . $wgTitle->getPrefixedURL() . "'>" . wfMessage('whatlinkshere')->text() . "</a>"; break; case 'profile': if ($isLoggedIn) { $html = Linker::link(Title::makeTitle(NS_SPECIAL, 'Mytalk', 'post'), wfMessage('mytalkpage')->text()) . Linker::link(Title::makeTitle(NS_SPECIAL, 'Mypage'), wfMessage('myauthorpage')->text()) . Linker::link(Title::makeTitle(NS_SPECIAL, 'Notifications'), wfMessage('mynotifications')->text()) . Linker::link(Title::makeTitle(NS_SPECIAL, 'Watchlist'), wfMessage('watchlist')->text()) . Linker::link(Title::makeTitle(NS_SPECIAL, 'Drafts'), wfMessage('mydrafts')->text()) . Linker::link(SpecialPage::getTitleFor('Mypages', 'Contributions'), wfMessage('mycontris')->text()) . Linker::link(SpecialPage::getTitleFor('Mypages', 'Fanmail'), wfMessage('myfanmail')->text()) . Linker::link(Title::makeTitle(NS_SPECIAL, 'Preferences'), wfMessage('mypreferences')->text()) . Linker::link(Title::makeTitle(NS_SPECIAL, 'Userlogout'), wfMessage('logout')->text()); } else { $html = UserLoginBox::getLogin(true); $menu_css = 'menu_login'; } break; case 'explore': $dashboardPage = $wgLanguageCode == 'en' ? Title::makeTitle(NS_SPECIAL, "CommunityDashboard") : Title::makeTitle(NS_PROJECT, wfMessage("community")->text()); $html = Linker::link($dashboardPage, wfMessage('community_dashboard')->text()); if ($isLoggedIn) { $html .= "<a href='{$wgForumLink}'>" . wfMessage('forums')->text() . "</a>"; } $html .= "<a href='/Special:Randomizer'>" . wfMessage('randompage')->text() . "</a>"; if (!$isLoggedIn) { $html .= Linker::link(Title::makeTitle(NS_PROJECT, "About-wikiHow"), wfMessage('navmenu_aboutus')->text()); } $html .= Linker::link(Title::makeTitle(NS_SPECIAL, "Categorylisting"), wfMessage('navmenu_categories')->text()) . Linker::link(Title::makeTitle(NS_SPECIAL, "Recentchanges"), wfMessage('recentchanges')->text()); if ($isLoggedIn) { $html .= Linker::link(Title::makeTitle(NS_SPECIAL, "Specialpages"), wfMessage('specialpages')->text()); $html .= Linker::link(Title::makeTitle(NS_PROJECT_TALK, 'Help-Team'), wfMessage('help')->text()); } break; case 'help': $html = Linker::link(Title::makeTitle(NS_SPECIAL, "CreatePage"), wfMessage('Write-an-article')->text()); if ($wgLanguageCode == 'en') { $html .= Linker::link(Title::makeTitle(NS_SPECIAL, "RequestTopic"), wfMessage('requesttopic')->text()) . Linker::link(Title::makeTitle(NS_SPECIAL, "ListRequestedTopics"), wfMessage('listrequtestedtopics')->text()); } if ($isLoggedIn) { if ($wgLanguageCode == 'en') { $html .= Linker::link(Title::makeTitle(NS_SPECIAL, "TipsPatrol"), wfMessage('navmenu_tipspatrol')->text()); } $html .= Linker::link(Title::makeTitle(NS_SPECIAL, "RCPatrol"), wfMessage('PatrolRC')->text()); if ($wgLanguageCode == 'en') { $html .= Linker::link(Title::makeTitle(NS_SPECIAL, "Categorizer"), wfMessage('categorize_articles')->text()); } } if ($wgLanguageCode == 'en') { $html .= "<a href='/Special:CommunityDashboard'>" . wfMessage('more-ideas')->text() . "</a>"; } else { $html .= Linker::link(Title::makeTitle(NS_SPECIAL, "Uncategorizedpages"), wfMessage('categorize_articles')->text()) . "<a href='/Contribute-to-wikiHow'>" . wfMessage('more-ideas')->text() . "</a>"; } break; case 'messages': if (class_exists('EchoEvent') && $wgUser->hasCookies()) { $maxNotesShown = 5; $notif = ApiEchoNotifications::getNotifications($wgUser, 'html', $maxNotesShown); if ($notif) { //show those notifications foreach ($notif as $note) { $this_note = $note['*']; //unread? if (!isset($note['read'])) { $this_note = str_replace('mw-echo-state', 'mw-echo-state mw-echo-unread', $this_note); } $html .= $this_note; } //get the unread count $notifUser = MWEchoNotifUser::newFromUser($wgUser); $this->notifications_count = $notifUser->getNotificationCount(); if ($this->notifications_count > $maxNotesShown) { $unshown = '<br /><a href="/Special:Notifications">(' . ($this->notifications_count - $maxNotesShown) . ' unread)</a>'; } else { $unshown = ''; } //add view all link $html .= '<div class="menu_message_morelink"><a href="/Special:Notifications">' . wfMessage('more-notifications-link')->text() . '</a>' . $unshown . '</div>'; } else { //no notifications $html .= '<div class="menu_message_morelink">' . wfMessage('no-notifications')->parse() . '</div>'; } } else { //old school $ret = Notifications::loadNotifications(); if (is_array($ret)) { list($html, $this->notifications_count) = $ret; } } $menu_css = 'menu_messages'; break; } if ($html) { $html = '<div class="' . $menu_css . '">' . $html . '</div>'; } return $html; }
public static function showTopImage() { global $wgUser, $wgLanguageCode; $items = array(); $dbr = wfGetDB(DB_SLAVE); $res = $dbr->select(WikihowHomepageAdmin::HP_TABLE, array('*'), array('hp_active' => 1), __METHOD__, array('ORDER BY' => 'hp_order')); $i = 0; foreach ($res as $result) { $item = new stdClass(); $title = Title::newFromID($result->hp_page); $item->url = $title->getLocalURL(); $item->text = $title->getText(); $imageTitle = Title::newFromID($result->hp_image); if ($imageTitle) { $file = wfFindFile($imageTitle->getText()); if ($file) { $item->imagePath = wfGetPad($file->getUrl()); $item->itemNum = ++$i; $items[] = $item; } } } if ($wgLanguageCode == 'en') { //using BOSS here only $searchTitle = Title::makeTitle(NS_SPECIAL, "LSearch"); $search = ' <form id="cse-search-hp" name="search_site" action="/wikiHowTo" method="get"> <input type="text" class="search_box" name="search" /> </form>'; } else { //PUNTING FOR NOW //INTL: International search just uses Google custom search $search = GoogSearch::getSearchBox("cse-search-hp"); } $tmpl = new EasyTemplate(dirname(__FILE__)); $tmpl->set_vars(array('items' => $items, 'imagePath' => wfGetPad('/skins/owl/images/home1.jpg'), 'login' => $wgUser->getID() == 0 ? UserLoginBox::getLogin() : "", 'search' => $search)); $html = $tmpl->execute('top.tmpl.php'); echo $html; return true; }
function getHeaderMenu($menu) { global $wgLanguageCode, $wgTitle, $wgUser, $wgForumLink; $html = ''; $menu_css = 'menu'; $sk = $wgUser->getSkin(); $isLoggedIn = $wgUser->getID() > 0; switch ($menu) { case 'edit': $html = "<a href='" . $wgTitle->escapeLocalURL($sk->editUrlOptions()) . "'>" . wfMsg('edit-this-article') . "</a>"; if (!$isLoggedIn) { break; } $html .= $sk->makeLinkObj(SpecialPage::getTitleFor('Importvideo', $wgTitle->getText()), wfMsg('importvideo')); if ($wgLanguageCode == 'en') { $html .= $sk->makeLinkObj(Title::makeTitle(NS_SPECIAL, "RelatedArticle"), wfMsg('manage_related_articles'), "target=" . $wgTitle->getPrefixedURL()) . $sk->makeLinkObj(SpecialPage::getTitleFor("Articlestats", $wgTitle->getText()), wfMsg('articlestats')); } $html .= "<a href='" . Title::makeTitle(NS_SPECIAL, "Whatlinkshere")->getLocalUrl() . "/" . $wgTitle->getPrefixedURL() . "'>" . wfMsg('whatlinkshere') . "</a>"; break; case 'profile': if ($isLoggedIn) { $html = $sk->makeLinkObj(Title::makeTitle(NS_SPECIAL, 'Mytalk'), wfMsg('mytalkpage'), '#post') . $sk->makeLinkObj(Title::makeTitle(NS_SPECIAL, 'Mypage'), wfMsg('myauthorpage')) . $sk->makeLinkObj(Title::makeTitle(NS_SPECIAL, 'Watchlist'), wfMsg('watchlist')) . $sk->makeLinkObj(Title::makeTitle(NS_SPECIAL, 'Drafts'), wfMsg('mydrafts')) . $sk->makeLinkObj(SpecialPage::getTitleFor('Mypages', 'Contributions'), wfMsg('mycontris')) . $sk->makeLinkObj(SpecialPage::getTitleFor('Mypages', 'Fanmail'), wfMsg('myfanmail')) . $sk->makeLinkObj(Title::makeTitle(NS_SPECIAL, 'Preferences'), wfMsg('mypreferences')) . $sk->makeLinkObj(Title::makeTitle(NS_SPECIAL, 'Userlogout'), wfMsg('logout')); } else { $html = UserLoginBox::getLogin(true); $menu_css = 'menu_login'; } break; case 'explore': $dashboardPage = $wgLanguageCode == 'en' ? Title::makeTitle(NS_SPECIAL, "CommunityDashboard") : Title::makeTitle(NS_PROJECT, wfMsg("community")); $html = $sk->makeLinkObj($dashboardPage, wfMsg('community_dashboard')); if ($isLoggedIn) { $html .= "<a href='{$wgForumLink}'>" . wfMsg('forums') . "</a>"; } $html .= "<a href='/Special:Randomizer'>" . wfMsg('randompage') . "</a>"; if (!$isLoggedIn) { $html .= $sk->makeLinkObj(Title::makeTitle(NS_PROJECT, "About-wikiHow"), wfMsg('navmenu_aboutus')); } $html .= $sk->makeLinkObj(Title::makeTitle(NS_SPECIAL, "Categorylisting"), wfMsg('navmenu_categories')) . $sk->makeLinkObj(Title::makeTitle(NS_SPECIAL, "Recentchanges"), wfMsg('recentchanges')); if ($isLoggedIn) { $html .= $sk->makeLinkObj(Title::makeTitle(NS_SPECIAL, "Specialpages"), wfMsg('specialpages')); $html .= $sk->makeLinkObj(Title::makeTitle(NS_PROJECT_TALK, 'Help-Team'), wfMsg('help')); } break; case 'help': $html = $sk->makeLinkObj(Title::makeTitle(NS_SPECIAL, "CreatePage"), wfMsg('Write-an-article')); if ($wgLanguageCode == 'en') { $html .= $sk->makeLinkObj(Title::makeTitle(NS_SPECIAL, "RequestTopic"), wfMsg('requesttopic')) . $sk->makeLinkObj(Title::makeTitle(NS_SPECIAL, "ListRequestedTopics"), wfMsg('listrequtestedtopics')); } if ($isLoggedIn) { if ($wgLanguageCode == 'en') { $html .= $sk->makeLinkObj(Title::makeTitle(NS_SPECIAL, "TipsPatrol"), wfMsg('navmenu_tipspatrol')); } $html .= $sk->makeLinkObj(Title::makeTitle(NS_SPECIAL, "RCPatrol"), wfMsg('PatrolRC')); if ($wgLanguageCode == 'en') { $html .= $sk->makeLinkObj(Title::makeTitle(NS_SPECIAL, "Categorizer"), wfMsg('categorize_articles')); } } if ($wgLanguageCode == 'en') { $html .= "<a href='/Special:CommunityDashboard'>" . wfMsg('more-ideas') . "</a>"; } else { $html .= $sk->makeLinkObj(Title::makeTitle(NS_SPECIAL, "Uncategorizedpages"), wfMsg('categorize_articles')) . "<a href='/Contribute-to-wikiHow'>" . wfMsg('more-ideas') . "</a>"; } break; case 'messages': list($html, $this->notifications_count) = Notifications::loadNotifications(); $menu_css = 'menu_messages'; break; } if ($html) { $html = '<div class="' . $menu_css . '">' . $html . '</div>'; } return $html; }