本文整理汇总了PHP中OutputPage::setSubtitle方法的典型用法代码示例。如果您正苦于以下问题:PHP OutputPage::setSubtitle方法的具体用法?PHP OutputPage::setSubtitle怎么用?PHP OutputPage::setSubtitle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OutputPage
的用法示例。
在下文中一共展示了OutputPage::setSubtitle方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setSubtitle
/**
* Set a subtitle like "Manage > FreeCol (open source game) > German"
* based on group and language code. The language part is not shown if
* it is 'en', and all three possible parts of the subtitle are linked.
*
* @param $group MessageGroup
* @param $code \string Language code.
*/
protected function setSubtitle( $group, $code ) {
global $wgLang;
$links[] = $this->skin->link(
$this->getTitle(),
wfMsgHtml( 'translate-manage-subtitle' )
);
$links[] = $this->skin->link(
$this->getTitle(),
htmlspecialchars( $group->getLabel() ),
array(),
array( 'group' => $group->getId() )
);
// Do not show language part for English.
if ( $code !== 'en' ) {
$langname = TranslateUtils::getLanguageName( $code, false, $wgLang->getCode() );
$links[] = $this->skin->link(
$this->getTitle(),
htmlspecialchars( $langname ),
array(),
array( 'group' => $group->getId(), 'language' => $code )
);
}
$this->out->setSubtitle( implode( ' > ', $links ) );
}
示例2: SharedHelpHook
/**
* @param OutputPage $out
* @param $text
* @return bool
*/
function SharedHelpHook(&$out, &$text)
{
global $wgTitle, $wgMemc, $wgSharedDB, $wgCityId, $wgHelpWikiId, $wgContLang, $wgLanguageCode, $wgArticlePath;
/* Insurance that hook will be called only once #BugId: */
static $wasCalled = false;
if ($wasCalled == true) {
return true;
}
$wasCalled = true;
if (empty($wgHelpWikiId) || $wgCityId == $wgHelpWikiId) {
# Do not proceed if we don't have a help wiki or are on it
return true;
}
if (!$out->isArticle()) {
# Do not process for pages other then articles
return true;
}
wfProfileIn(__METHOD__);
# Do not process if explicitly told not to
$mw = MagicWord::get('MAG_NOSHAREDHELP');
if ($mw->match($text) || strpos($text, NOSHAREDHELP_MARKER) !== false) {
wfProfileOut(__METHOD__);
return true;
}
if ($wgTitle->getNamespace() == NS_HELP) {
# Initialize shared and local variables
# Canonical namespace is added here in case we ever want to share other namespaces (e.g. Advice)
$sharedArticleKey = $wgSharedDB . ':sharedArticles:' . $wgHelpWikiId . ':' . MWNamespace::getCanonicalName($wgTitle->getNamespace()) . ':' . $wgTitle->getDBkey() . ':' . SHAREDHELP_CACHE_VERSION;
$sharedArticle = $wgMemc->get($sharedArticleKey);
$sharedServer = WikiFactory::getVarValueByName('wgServer', $wgHelpWikiId);
$sharedScript = WikiFactory::getVarValueByName('wgScript', $wgHelpWikiId);
$sharedArticlePath = WikiFactory::getVarValueByName('wgArticlePath', $wgHelpWikiId);
// get defaults
// in case anybody's curious: no, we can't use $wgScript cause that may be overridden locally :/
// @TODO pull this from somewhere instead of hardcoding
if (empty($sharedArticlePath)) {
$sharedArticlePath = '/wiki/$1';
}
if (empty($sharedScript)) {
$sharedScript = '/index.php';
}
$sharedArticlePathClean = str_replace('$1', '', $sharedArticlePath);
$localArticlePathClean = str_replace('$1', '', $wgArticlePath);
# Try to get content from memcache
if (!empty($sharedArticle['timestamp'])) {
if (wfTimestamp() - (int) $sharedArticle['timestamp'] < 600) {
if (isset($sharedArticle['exists']) && $sharedArticle['exists'] == 0) {
wfProfileOut(__METHOD__);
return true;
} else {
if (!empty($sharedArticle['cachekey'])) {
wfDebug("SharedHelp: trying parser cache {$sharedArticle['cachekey']}\n");
$key1 = str_replace('-1!', '-0!', $sharedArticle['cachekey']);
$key2 = str_replace('-0!', '-1!', $sharedArticle['cachekey']);
$parser = $wgMemc->get($key1);
if (!empty($parser) && is_object($parser)) {
$content = $parser->mText;
} else {
$parser = $wgMemc->get($key2);
if (!empty($parser) && is_object($parser)) {
$content = $parser->mText;
}
}
}
}
}
}
# If getting content from memcache failed (invalidate) then just download it via HTTP
if (empty($content)) {
$urlTemplate = $sharedServer . $sharedScript . "?title=Help:%s&action=render";
$articleUrl = sprintf($urlTemplate, urlencode($wgTitle->getDBkey()));
list($content, $c) = SharedHttp::get($articleUrl);
# if we had redirect, then store it somewhere
if (curl_getinfo($c, CURLINFO_HTTP_CODE) == 301) {
if (preg_match("/^Location: ([^\n]+)/m", $content, $dest_url)) {
$destinationUrl = $dest_url[1];
}
}
global $wgServer, $wgArticlePath, $wgRequest, $wgTitle;
$helpNs = $wgContLang->getNsText(NS_HELP);
$sk = RequestContext::getMain()->getSkin();
if (!empty($_SESSION['SH_redirected'])) {
$from_link = Title::newfromText($helpNs . ":" . $_SESSION['SH_redirected']);
$redir = $sk->makeKnownLinkObj($from_link, '', 'redirect=no', '', '', 'rel="nofollow"');
$s = wfMsg('redirectedfrom', $redir);
$out->setSubtitle($s);
$_SESSION['SH_redirected'] = '';
}
if (isset($destinationUrl)) {
$destinationPageIndex = strpos($destinationUrl, "{$helpNs}:");
# if $helpNs was not found, assume we're on help.wikia.com and try again
if ($destinationPageIndex === false) {
$destinationPageIndex = strpos($destinationUrl, MWNamespace::getCanonicalName(NS_HELP) . ":");
}
$destinationPage = substr($destinationUrl, $destinationPageIndex);
//.........这里部分代码省略.........
示例3: setTopText
function setTopText(OutputPage $out, FormOptions $opts)
{
global $wgUser;
$skin = $wgUser->getSkin();
if (isset($this->mTargetTitle) && is_object($this->mTargetTitle)) {
$out->setSubtitle(wfMsg('recentchangeslinked-backlink', $skin->link($this->mTargetTitle, $this->mTargetTitle->getPrefixedText(), array(), array('redirect' => 'no'))));
}
}
示例4: setPageTitle
/**
* @param \OutputPage $out
*/
public function setPageTitle(\OutputPage $out)
{
$topic = $this->findTopicTitle();
$title = $this->workflow->getOwnerTitle();
$out->setPageTitle($out->msg('flow-topic-first-heading', $title->getPrefixedText()));
if ($this->permissions->isAllowed($topic, 'view')) {
if ($this->action === 'undo-edit-topic-summary') {
$key = 'flow-undo-edit-topic-summary';
} else {
$key = 'flow-topic-html-title';
}
$out->setHtmlTitle($out->msg($key, array(Message::rawParam($topic->getContent('wikitext')), $title->getPrefixedText())));
} else {
$out->setHtmlTitle($title->getPrefixedText());
}
$out->setSubtitle('< ' . \Linker::link($title));
}