本文整理汇总了PHP中Notifications::loadNotifications方法的典型用法代码示例。如果您正苦于以下问题:PHP Notifications::loadNotifications方法的具体用法?PHP Notifications::loadNotifications怎么用?PHP Notifications::loadNotifications使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Notifications
的用法示例。
在下文中一共展示了Notifications::loadNotifications方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getHeaderMenu
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;
//.........这里部分代码省略.........
示例2: getHeaderMenu
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;
}