本文整理汇总了PHP中SkinTemplate::getOutput方法的典型用法代码示例。如果您正苦于以下问题:PHP SkinTemplate::getOutput方法的具体用法?PHP SkinTemplate::getOutput怎么用?PHP SkinTemplate::getOutput使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkinTemplate
的用法示例。
在下文中一共展示了SkinTemplate::getOutput方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onSkinTemplateOutputPageBeforeExec
/**
* Add variables to SkinTemplate
*/
public static function onSkinTemplateOutputPageBeforeExec(SkinTemplate $skinTemplate, QuickTemplate $tpl)
{
wfProfileIn(__METHOD__);
$out = $skinTemplate->getOutput();
$title = $skinTemplate->getTitle();
# quick hack for rt#15730; if you ever feel temptation to add 'elseif' ***CREATE A PROPER HOOK***
if ($title instanceof Title && NS_CATEGORY == $title->getNamespace()) {
// FIXME
$tpl->set('pagetitle', preg_replace("/^{$title->getNsText()}:/", '', $out->getHTMLTitle()));
}
// Pass parameters to skin, see: Login friction project (Marooned)
$tpl->set('thisurl', $title->getPrefixedURL());
$tpl->set('thisquery', $skinTemplate->thisquery);
wfProfileOut(__METHOD__);
return true;
}
示例2: onPersonalUrls
/**
* Handler for PersonalUrls hook.
* Add a "Notifications" item to the user toolbar ('personal URLs').
* @see http://www.mediawiki.org/wiki/Manual:Hooks/PersonalUrls
* @param &$personal_urls Array of URLs to append to.
* @param &$title Title of page being visited.
* @param SkinTemplate $sk
* @return bool true in all cases
*/
static function onPersonalUrls(&$personal_urls, &$title, $sk)
{
global $wgEchoNewMsgAlert;
$user = $sk->getUser();
if ($user->isAnon() || self::isEchoDisabled($user)) {
return true;
}
// Add a "My notifications" item to personal URLs
if ($user->getOption('echo-notify-show-link')) {
$notificationCount = MWEchoNotifUser::newFromUser($user)->getNotificationCount();
$text = EchoNotificationController::formatNotificationCount($notificationCount);
$url = SpecialPage::getTitleFor('Notifications')->getLocalURL();
if ($notificationCount == 0) {
$linkClasses = array('mw-echo-notifications-badge');
} else {
$linkClasses = array('mw-echo-unread-notifications', 'mw-echo-notifications-badge');
}
$notificationsLink = array('href' => $url, 'text' => $text, 'active' => $url == $title->getLocalUrl(), 'class' => $linkClasses);
$insertUrls = array('notifications' => $notificationsLink);
$personal_urls = wfArrayInsertAfter($personal_urls, $insertUrls, 'userpage');
}
// If the user has new messages, display a talk page alert
if ($wgEchoNewMsgAlert && $user->getOption('echo-show-alert') && $user->getNewtalk()) {
$personal_urls['mytalk']['text'] = $sk->msg('echo-new-messages')->text();
$personal_urls['mytalk']['class'] = array('mw-echo-alert');
$sk->getOutput()->addModuleStyles('ext.echo.alert');
}
return true;
}