本文整理汇总了PHP中MWNamespace::isTalk方法的典型用法代码示例。如果您正苦于以下问题:PHP MWNamespace::isTalk方法的具体用法?PHP MWNamespace::isTalk怎么用?PHP MWNamespace::isTalk使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MWNamespace
的用法示例。
在下文中一共展示了MWNamespace::isTalk方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getIconType
public static function getIconType($item)
{
wfProfileIn(__METHOD__);
$type = false;
if (MWNamespace::isTalk($item['namespace'])) {
wfProfileOut(__METHOD__);
return self::FEED_TALK_ICON;
}
if (defined('NS_BLOG_ARTICLE_TALK') && $item['namespace'] == NS_BLOG_ARTICLE_TALK) {
wfProfileOut(__METHOD__);
return self::FEED_COMMENT_ICON;
}
//video namespace
if ($item['namespace'] == 400) {
wfProfileOut(__METHOD__);
return self::FEED_FILM_ICON;
}
switch ($item['type']) {
case 'upload':
$type = self::FEED_PHOTO_ICON;
break;
default:
$type = $item['new'] == '1' ? self::FEED_SUN_ICON : self::FEED_PENCIL_ICON;
}
wfProfileOut(__METHOD__);
return $type;
}
示例2: get
public function get($limit = 10, User $user = null)
{
wfProfileIn(__METHOD__);
global $wgUser;
if (!$user instanceof User) {
$user = $wgUser;
}
$result = array();
$params = array();
$params['action'] = 'query';
$params['list'] = 'usercontribs';
$params['ucuser'] = $user->getName();
$params['ucprop'] = 'ids|title|timestamp|flags|comment|wikiamode';
$params['uclimit'] = $limit;
$api = new ApiMain(new FauxRequest($params));
$api->execute();
$res =& $api->GetResultData();
$i = -1;
foreach ($res['query']['usercontribs'] as &$entry) {
$titleObj = Title::newFromText($entry['title']);
$result[++$i] = array('url' => $titleObj->getLocalURL(), 'title' => $titleObj->getText(), 'timestamp' => $entry['timestamp'], 'namespace' => $entry['ns'], 'type' => 'edit', 'new' => $entry['rev_parent_id'] == 0 ? '1' : '0', 'diff' => empty($entry['rev_parent_id']) ? '' : $titleObj->getLocalURL('diff=' . $entry['revid'] . '&oldid=' . $entry['rev_parent_id']));
if (MWNamespace::isTalk($entry['ns']) || in_array($entry['ns'], array(400, NS_USER, NS_TEMPLATE, NS_MEDIAWIKI))) {
$title = $titleObj->getPrefixedText();
if (defined('ARTICLECOMMENT_PREFIX') && strpos($title, '/') !== false && strpos(end(explode('/', $title)), ARTICLECOMMENT_PREFIX) === 0) {
$result[$i]['title'] = end(explode(':', reset(explode('/', $title, 2)), 2));
} else {
$result[$i]['title'] = $title;
}
}
if (defined('NS_BLOG_ARTICLE_TALK') && $entry['ns'] == NS_BLOG_ARTICLE_TALK) {
$result[$i]['title'] = wfMsg('myhome-namespace-blog') . ':' . $result[$i]['title'];
}
if ($entry['ns'] == NS_FILE) {
list(, $title) = explode(':', $entry['title'], 2);
$title = str_replace(' ', '_', $title);
$tsUnix = wfTimestamp(TS_UNIX, $entry['timestamp']);
$tsMin = wfTimestamp(TS_MW, $tsUnix - 5);
$tsMax = wfTimestamp(TS_MW, $tsUnix + 5);
//get type of file operations
$dbr = wfGetDB(DB_SLAVE);
$type = $dbr->selectField(array('logging'), array('log_type'), array('log_type' => 'upload', 'log_namespace' => $entry['ns'], 'log_title' => $title, "log_timestamp BETWEEN {$tsMin} AND {$tsMax}"), __METHOD__);
if ($type !== false) {
$result[$i]['type'] = 'upload';
$result[$i]['diff'] = '';
}
}
}
wfProfileOut(__METHOD__);
return $result;
}
示例3: testIsTalk
/**
* Reverse of testIsMain().
* Please update testIsMain() if you change assertions below
*/
public function testIsTalk()
{
// Special namespaces
$this->assertFalse(MWNamespace::isTalk(NS_MEDIA));
$this->assertFalse(MWNamespace::isTalk(NS_SPECIAL));
// Subject pages
$this->assertFalse(MWNamespace::isTalk(NS_MAIN));
$this->assertFalse(MWNamespace::isTalk(NS_USER));
$this->assertFalse(MWNamespace::isTalk(100));
# user defined
// Talk pages
$this->assertTrue(MWNamespace::isTalk(NS_TALK));
$this->assertTrue(MWNamespace::isTalk(NS_USER_TALK));
$this->assertTrue(MWNamespace::isTalk(101));
# user defined
}
示例4: wfPolyglotInitializeArticleMaybeRedirect
function wfPolyglotInitializeArticleMaybeRedirect(&$title, &$request, &$ignoreRedirect, &$target, &$article)
{
global $wgPolyglotExcemptNamespaces, $wgPolyglotExcemptTalkPages, $wgPolyglotFollowRedirects;
global $wgLang, $wgContLang;
$ns = $title->getNamespace();
if ($ns < 0 || in_array($ns, $wgPolyglotExcemptNamespaces) || $wgPolyglotExcemptTalkPages && MWNamespace::isTalk($ns)) {
return true;
}
$dbkey = $title->getDBkey();
$force = false;
//TODO: when user-defined language links start working (see below),
// we need to look at the langlinks table here.
if (!$title->exists() && strlen($dbkey) > 1) {
$escContLang = preg_quote($wgContLang->getCode(), '!');
if (preg_match('!/$!', $dbkey)) {
$force = true;
$remove = 1;
} elseif (preg_match("!/{$escContLang}\$!", $dbkey)) {
$force = true;
$remove = strlen($wgContLang->getCode()) + 1;
}
}
if ($force) {
$t = Title::makeTitle($ns, substr($dbkey, 0, strlen($dbkey) - $remove));
} else {
$lang = $wgLang->getCode();
$t = Title::makeTitle($ns, $dbkey . '/' . $lang);
}
if (!$t->exists()) {
return true;
}
if ($wgPolyglotFollowRedirects && !$force) {
$page = WikiPage::factory($t);
if ($page->isRedirect()) {
$rt = $page->getRedirectTarget();
if ($rt && $rt->exists()) {
//TODO: make "redirected from" show $source, not $title, if we followed a redirect internally.
// there seems to be no clean way to do that, though.
//$source = $t;
$t = $rt;
}
}
}
$target = $t;
return true;
}
示例5: register
function register()
{
global $wgContLang, $wgNamespaceAliases, $wgNonincludableNamespaces;
$lib = array('loadSiteStats' => array($this, 'loadSiteStats'), 'getNsIndex' => array($this, 'getNsIndex'), 'pagesInCategory' => array($this, 'pagesInCategory'), 'pagesInNamespace' => array($this, 'pagesInNamespace'), 'usersInGroup' => array($this, 'usersInGroup'));
$info = array('siteName' => $GLOBALS['wgSitename'], 'server' => $GLOBALS['wgServer'], 'scriptPath' => $GLOBALS['wgScriptPath'], 'stylePath' => $GLOBALS['wgStylePath'], 'currentVersion' => SpecialVersion::getVersion());
if (!self::$namespacesCache) {
$namespaces = array();
$namespacesByName = array();
foreach ($wgContLang->getFormattedNamespaces() as $ns => $title) {
$canonical = MWNamespace::getCanonicalName($ns);
$namespaces[$ns] = array('id' => $ns, 'name' => $title, 'canonicalName' => strtr($canonical, '_', ' '), 'hasSubpages' => MWNamespace::hasSubpages($ns), 'hasGenderDistinction' => MWNamespace::hasGenderDistinction($ns), 'isCapitalized' => MWNamespace::isCapitalized($ns), 'isContent' => MWNamespace::isContent($ns), 'isIncludable' => !($wgNonincludableNamespaces && in_array($ns, $wgNonincludableNamespaces)), 'isMovable' => MWNamespace::isMovable($ns), 'isSubject' => MWNamespace::isSubject($ns), 'isTalk' => MWNamespace::isTalk($ns), 'aliases' => array());
if ($ns >= NS_MAIN) {
$namespaces[$ns]['subject'] = MWNamespace::getSubject($ns);
$namespaces[$ns]['talk'] = MWNamespace::getTalk($ns);
$namespaces[$ns]['associated'] = MWNamespace::getAssociated($ns);
} else {
$namespaces[$ns]['subject'] = $ns;
}
$namespacesByName[strtr($title, ' ', '_')] = $ns;
if ($canonical) {
$namespacesByName[$canonical] = $ns;
}
}
$aliases = array_merge($wgNamespaceAliases, $wgContLang->getNamespaceAliases());
foreach ($aliases as $title => $ns) {
if (!isset($namespacesByName[$title])) {
$ct = count($namespaces[$ns]['aliases']);
$namespaces[$ns]['aliases'][$ct + 1] = $title;
$namespacesByName[$title] = $ns;
}
}
$namespaces[NS_MAIN]['displayName'] = wfMessage('blanknamespace')->text();
self::$namespacesCache = $namespaces;
}
$info['namespaces'] = self::$namespacesCache;
if (self::$siteStatsLoaded) {
$stats = $this->loadSiteStats();
$info['stats'] = $stats[0];
}
$this->getEngine()->registerInterface('mw.site.lua', $lib, $info);
}
示例6: build
public function build()
{
global $wgSitename, $wgContLanguageCode;
$article = $this->Agent->getArticle();
$model = MwRdf::Model();
$rdf = MwRdf::Vocabulary('rdf');
$dc = MwRdf::Vocabulary('dc');
$dctype = MwRdf::Vocabulary('dctype');
$artres = $this->Agent->titleResource();
$model->addStatement(MwRdf::Statement($artres, $dc->title, MwRdf::LiteralNode($this->Agent->getTitle()->getText())));
$model->addStatement(MwRdf::Statement($artres, $dc->publisher, MwRdf::PageOrString(wfMsg('aboutpage'), $wgSitename)));
$model->addStatement(MwRdf::Statement($artres, $dc->language, MwRdf::Language($wgContLanguageCode)));
$model->addStatement(MwRdf::Statement($artres, $dc->type, $dctype->Text));
$model->addStatement(MwRdf::Statement($artres, $dc->format, MwRdf::MediaType('text/html')));
if ($this->Agent->getTimestampResource()) {
$model->addStatement(MwRdf::Statement($artres, $dc->date, $this->Agent->getTimestampResource()));
}
if (MWNamespace::isTalk($this->Agent->getTitle()->getNamespace())) {
$model->addStatement(MwRdf::Statement($artres, $dc->subject, $this->Agent->subjectResource()));
} else {
$talk = MwRdf::ModelingAgent($this->Agent->getTitle()->getTalkPage());
$model->addStatement(MwRdf::Statement($talk->titleResource(), $dc->subject, $artres));
}
# 'Creator' is responsible for this version
$creator = MwRdf::PersonToResource($article->getUser());
$model->addStatement(MwRdf::Statement($artres, $dc->creator, $creator));
# 'Contributors' are all other version authors
$contributors = $article->getContributors();
foreach ($contributors as $user_parts) {
$contributor = MwRdf::PersonToResource($user_parts[0], $user_parts[1], $user_parts[2]);
$model->addStatement(MwRdf::Statement($artres, $dc->contributor, $contributor));
}
# Rights notification
global $wgRightsPage, $wgRightsUrl, $wgRightsText;
$rights = MwRdf::RightsResource();
if ($rights) {
$model->addStatement(MwRdf::Statement($artres, $dc->rights, $rights));
}
return $model;
}
示例7: register
function register()
{
global $wgContLang, $wgNamespaceAliases, $wgDisableCounters;
$lib = array('getNsIndex' => array($this, 'getNsIndex'), 'pagesInCategory' => array($this, 'pagesInCategory'), 'pagesInNamespace' => array($this, 'pagesInNamespace'), 'usersInGroup' => array($this, 'usersInGroup'), 'interwikiMap' => array($this, 'interwikiMap'));
$info = array('siteName' => $GLOBALS['wgSitename'], 'server' => $GLOBALS['wgServer'], 'scriptPath' => $GLOBALS['wgScriptPath'], 'stylePath' => $GLOBALS['wgStylePath'], 'currentVersion' => SpecialVersion::getVersion());
if (!self::$namespacesCache || self::$namespacesCacheLang !== $wgContLang->getCode()) {
$namespaces = array();
$namespacesByName = array();
foreach ($wgContLang->getFormattedNamespaces() as $ns => $title) {
$canonical = MWNamespace::getCanonicalName($ns);
$namespaces[$ns] = array('id' => $ns, 'name' => $title, 'canonicalName' => strtr($canonical, '_', ' '), 'hasSubpages' => MWNamespace::hasSubpages($ns), 'hasGenderDistinction' => MWNamespace::hasGenderDistinction($ns), 'isCapitalized' => MWNamespace::isCapitalized($ns), 'isContent' => MWNamespace::isContent($ns), 'isIncludable' => !MWNamespace::isNonincludable($ns), 'isMovable' => MWNamespace::isMovable($ns), 'isSubject' => MWNamespace::isSubject($ns), 'isTalk' => MWNamespace::isTalk($ns), 'defaultContentModel' => MWNamespace::getNamespaceContentModel($ns), 'aliases' => array());
if ($ns >= NS_MAIN) {
$namespaces[$ns]['subject'] = MWNamespace::getSubject($ns);
$namespaces[$ns]['talk'] = MWNamespace::getTalk($ns);
$namespaces[$ns]['associated'] = MWNamespace::getAssociated($ns);
} else {
$namespaces[$ns]['subject'] = $ns;
}
$namespacesByName[strtr($title, ' ', '_')] = $ns;
if ($canonical) {
$namespacesByName[$canonical] = $ns;
}
}
$aliases = array_merge($wgNamespaceAliases, $wgContLang->getNamespaceAliases());
foreach ($aliases as $title => $ns) {
if (!isset($namespacesByName[$title]) && isset($namespaces[$ns])) {
$ct = count($namespaces[$ns]['aliases']);
$namespaces[$ns]['aliases'][$ct + 1] = $title;
$namespacesByName[$title] = $ns;
}
}
$namespaces[NS_MAIN]['displayName'] = wfMessage('blanknamespace')->inContentLanguage()->text();
self::$namespacesCache = $namespaces;
self::$namespacesCacheLang = $wgContLang->getCode();
}
$info['namespaces'] = self::$namespacesCache;
$info['stats'] = array('pages' => (int) SiteStats::pages(), 'articles' => (int) SiteStats::articles(), 'files' => (int) SiteStats::images(), 'edits' => (int) SiteStats::edits(), 'views' => $wgDisableCounters ? null : (int) SiteStats::views(), 'users' => (int) SiteStats::users(), 'activeUsers' => (int) SiteStats::activeUsers(), 'admins' => (int) SiteStats::numberingroup('sysop'));
return $this->getEngine()->registerInterface('mw.site.lua', $lib, $info);
}
示例8: getIconType
public static function getIconType($row)
{
if (!isset($row['type'])) {
return false;
}
wfProfileIn(__METHOD__);
$type = false;
switch ($row['type']) {
case 'new':
switch ($row['ns']) {
// blog post
case 500:
$type = self::FEED_SUN_ICON;
break;
// blog comment
// blog comment
case 501:
// wall comment
// wall comment
case 1001:
$type = self::FEED_COMMENT_ICON;
break;
// content NS
// content NS
default:
if (empty($row['articleComment'])) {
$type = MWNamespace::isTalk($row['ns']) ? self::FEED_TALK_ICON : self::FEED_SUN_ICON;
} else {
$type = self::FEED_COMMENT_ICON;
}
}
break;
case 'edit':
// edit done from editor
if (empty($row['viewMode'])) {
// talk pages
if (isset($row['ns']) && MWNamespace::isTalk($row['ns'])) {
if (empty($row['articleComment'])) {
$type = self::FEED_TALK_ICON;
} else {
$type = self::FEED_COMMENT_ICON;
}
} else {
$type = self::FEED_PENCIL_ICON;
}
} else {
// category added
if (!empty($row['CategorySelect'])) {
$type = self::FEED_CATEGORY_ICON;
} elseif (!empty($row['new_categories'])) {
$type = self::FEED_PENCIL_ICON;
} elseif (!empty($row['new_images'])) {
$type = self::FEED_PHOTO_ICON;
} else {
$type = self::FEED_FILM_ICON;
}
}
break;
case 'delete':
$type = self::FEED_DELETE_ICON;
break;
case 'move':
case 'redirect':
$type = self::FEED_MOVE_ICON;
break;
case 'upload':
$type = self::FEED_PHOTO_ICON;
break;
}
wfProfileOut(__METHOD__);
return $type;
}
示例9: findEpisode
protected function findEpisode($seriesName, $episodeName, $lang, $quality = self::DEFAULT_QUALITY)
{
// TODO: this is a workaround to not alter schema of main index too much
// once the next gen search is implemented such workarounds would not be needed hopefully
// this replaces american right apostrophe with normal one
$episodeName = str_replace("’", "'", $episodeName);
$seriesService = $this->getWikiSeriesService();
$seriesService->setLang($lang);
$wikis = $seriesService->query($seriesName);
if (!empty($wikis)) {
$episodeService = $this->getEpisodeService();
$episodeService->setLang($lang)->setSeries($seriesName)->setQuality($quality);
$result = null;
foreach ($wikis as $wiki) {
$episodeService->setWikiId($wiki['id']);
$namespaces = WikiFactory::getVarValueByName(self::WG_CONTENT_NAMESPACES_KEY, $wiki['id']);
$episodeService->setNamespace($namespaces);
$result = $episodeService->query($episodeName);
if ($result === null) {
$result = $this->getTitle($episodeName, $wiki['id']);
}
if ($result === null) {
$namespaceNames = WikiFactory::getVarValueByName(self::WG_EXTRA_LOCAL_NAMESPACES_KEY, $wiki['id']);
if (is_array($namespaces)) {
foreach ($namespaces as $ns) {
if (!MWNamespace::isTalk($ns) && isset($namespaceNames[$ns])) {
$result = $episodeService->query($namespaceNames[$ns] . ":" . $episodeName);
if ($result !== null) {
break;
}
}
}
}
}
if ($result !== null) {
if ($quality == null || $result['quality'] !== null && $result['quality'] >= $quality) {
return $result;
}
}
}
}
return false;
}
示例10: runPreferencePlugin
/**
* Sets parameters for more complex options in preferences
* @param string $sAdapterName Name of the adapter, e.g. MW
* @param BsConfig $oVariable Instance of variable
* @return array Preferences options
*/
public function runPreferencePlugin($sAdapterName, $oVariable)
{
wfProfileIn('BS::' . __METHOD__);
$aPrefs = array();
switch ($oVariable->getName()) {
case 'disableNS':
global $wgContLang;
$aExcludeNmsps = BsConfig::get('MW::VisualEditor::defaultNoContextNS');
foreach ($wgContLang->getNamespaces() as $sNamespace) {
$iNsIndex = $wgContLang->getNsIndex($sNamespace);
if (!MWNamespace::isTalk($iNsIndex)) {
continue;
}
$aExcludeNmsps[] = $iNsIndex;
}
$aPrefs['type'] = 'multiselectex';
$aPrefs['options'] = BsNamespaceHelper::getNamespacesForSelectOptions($aExcludeNmsps);
break;
default:
}
wfProfileOut('BS::' . __METHOD__);
return $aPrefs;
}
示例11: getWatchlistInfo
/**
* Get a list of titles on a user's watchlist, excluding talk pages,
* and return as a two-dimensional array with namespace and title.
*
* @return array
*/
protected function getWatchlistInfo()
{
$titles = [];
$watchedItems = MediaWikiServices::getInstance()->getWatchedItemStore()->getWatchedItemsForUser($this->getUser(), ['sort' => WatchedItemStore::SORT_ASC]);
$lb = new LinkBatch();
foreach ($watchedItems as $watchedItem) {
$namespace = $watchedItem->getLinkTarget()->getNamespace();
$dbKey = $watchedItem->getLinkTarget()->getDBkey();
$lb->add($namespace, $dbKey);
if (!MWNamespace::isTalk($namespace)) {
$titles[$namespace][$dbKey] = 1;
}
}
$lb->execute();
return $titles;
}
示例12: wfPolyglotParserAfterTidy
function wfPolyglotParserAfterTidy(&$parser, &$text)
{
global $wgPolyglotLanguages, $wfPolyglotExcemptNamespaces, $wfPolyglotExcemptTalkPages;
global $wgContLang;
if (!$wgPolyglotLanguages) {
return true;
}
if (!$parser->mOptions->getInterwikiMagic()) {
return true;
}
$n = $parser->mTitle->getDBkey();
$ns = $parser->mTitle->getNamespace();
$contln = $wgContLang->getCode();
$userlinks = $parser->mOutput->getLanguageLinks();
$links = array();
$pagelang = null;
//TODO: if we followed a redirect, analyze the redirect's title too.
// at least if wgPolyglotFollowRedirects is true
if ($ns >= 0 && !in_array($ns, $wfPolyglotExcemptNamespaces) && (!$wfPolyglotExcemptTalkPages || !MWNamespace::isTalk($ns))) {
$ll = wfPolyglotGetLanguages($parser->mTitle);
if ($ll) {
$links = array_merge($links, $ll);
}
if (preg_match('!(.+)/(\\w[-\\w]*\\w)$!', $n, $m)) {
$pagelang = $m[2];
$t = Title::makeTitle($ns, $m[1]);
if (!isset($links[$contln]) && $t->exists()) {
$links[$contln] = $t->getFullText() . '/';
}
$ll = wfPolyglotGetLanguages($t);
if ($ll) {
unset($ll[$pagelang]);
$links = array_merge($links, $ll);
}
}
}
//TODO: would be nice to handle "normal" interwiki-links here.
// but we would have to hack into Title::getInterwikiLink, otherwise
// the links are not recognized.
/*
foreach ($userlinks as $link) {
$m = explode(':', $link, 2);
if (sizeof($m)<2) continue;
$links[$m[0]] = $m[1];
}
*/
if ($pagelang) {
unset($links[$pagelang]);
}
//print_r($links);
$fakelinks = array();
foreach ($links as $lang => $t) {
$fakelinks[] = $lang . ':' . $t;
}
$parser->mOutput->setLanguageLinks($fakelinks);
return true;
}
示例13: pass
/**
* @param object $page
* @return bool
*/
function pass($page)
{
return !MWNamespace::isTalk($page->page_namespace);
}
示例14: execute
//.........这里部分代码省略.........
$pbDateFlag = true;
}
}
}
$heading = '';
if (!$sk->suppressH1Tag()) {
if ($wgTitle->getNamespace() == NS_MAIN && $wgTitle->exists() && $action == "view") {
if (Microdata::showRecipeTags() && Microdata::showhRecipeTags()) {
$itemprop_name1 = " fn'";
$itemprop_name2 = "";
} else {
$itemprop_name1 = "' itemprop='name'";
$itemprop_name2 = " itemprop='url'";
}
$heading = "<h1 class='firstHeading" . $itemprop_name1 . "><a href=\"" . $wgTitle->getFullURL() . "\"" . $itemprop_name2 . ">" . wfMessage('howto', $this->data['title'])->text() . "</a></h1>";
} else {
if ($wgTitle->getNamespace() == NS_USER && UserPagePolicy::isGoodUserPage($wgTitle->getDBKey()) || $wgTitle->getNamespace() == NS_USER_TALK) {
$heading = "<h1 class=\"firstHeading\" >" . $this->data['title'] . "</h1> " . $pbDate;
if ($avatar) {
$heading = $avatar . "<div id='avatarNameWrap'>" . $heading . "</div><div style='clear: both;'> </div>";
}
} else {
if ($this->data['title'] && strtolower(substr($wgTitle->getText(), 0, 9)) != 'userlogin') {
$heading = "<h1 class='firstHeading'>" . $this->data['title'] . "</h1>";
}
}
}
}
// get the breadcrumbs / category links at the top of the page
$catLinksTop = $sk->getCategoryLinks(true);
wfRunHooks('getBreadCrumbs', array(&$catLinksTop));
$mainPageObj = Title::newMainPage();
$isPrintable = false;
if (MWNamespace::isTalk($wgTitle->getNamespace()) && $action == "view") {
$isPrintable = $wgRequest->getVal("printable") == "yes";
}
// QWER links for everyone on all pages
//$helplink = Linker::link(Title::makeTitle(NS_PROJECT_TALK, 'Help-Team'), wfMessage('help')->text());
$logoutlink = Linker::link(Title::makeTitle(NS_SPECIAL, 'Userlogout'), wfMessage('logout')->text());
$rsslink = "<a href='" . $wgServer . "/feed.rss'>" . wfMessage('rss')->text() . "</a>";
$rplink = Linker::link(Title::makeTitle(NS_SPECIAL, "Randompage"), wfMessage('randompage')->text());
if ($wgTitle->getNamespace() == NS_MAIN && !$isMainPage && $wgTitle->userCan('edit')) {
$links[] = array(Title::makeTitle(NS_SPECIAL, "Recentchangeslinked")->getFullURL() . "/" . $wgTitle->getPrefixedURL(), wfMessage('recentchangeslinked')->text());
}
//Editing Tools
$uploadlink = "";
$freephotoslink = "";
$uploadlink = Linker::link(Title::makeTitle(NS_SPECIAL, "Upload"), wfMessage('upload')->text());
$freephotoslink = Linker::link(Title::makeTitle(NS_SPECIAL, "ImportFreeImages"), wfMessage('imageimport')->text());
$relatedchangeslink = "";
if ($isArticlePage) {
$relatedchangeslink = "<li> <a href='" . Title::makeTitle(NS_SPECIAL, "Recentchangeslinked")->getFullURL() . "/" . $wgTitle->getPrefixedURL() . "'>" . wfMessage('recentchangeslinked')->text() . "</a></li>";
}
//search
$searchTitle = Title::makeTitle(NS_SPECIAL, "LSearch");
$otherLanguageLinks = array();
$translationData = array();
if ($this->data['language_urls']) {
foreach ($this->data['language_urls'] as $lang) {
if ($lang['code'] == $wgLanguageCode) {
continue;
}
$otherLanguageLinks[$lang['code']] = $lang['href'];
$langMsg = $sk->getInterWikiCTA($lang['code'], $lang['text'], $lang['href']);
if (!$langMsg) {
continue;
示例15: getDefaultWikitextNS
/**
* Returns the ID of a namespace that defaults to Wikitext.
*
* @throws MWException If there is none.
* @return int The ID of the wikitext Namespace
* @since 1.21
*/
protected function getDefaultWikitextNS()
{
global $wgNamespaceContentModels;
static $wikitextNS = null;
// this is not going to change
if ($wikitextNS !== null) {
return $wikitextNS;
}
// quickly short out on most common case:
if (!isset($wgNamespaceContentModels[NS_MAIN])) {
return NS_MAIN;
}
// NOTE: prefer content namespaces
$namespaces = array_unique(array_merge(MWNamespace::getContentNamespaces(), array(NS_MAIN, NS_HELP, NS_PROJECT), MWNamespace::getValidNamespaces()));
$namespaces = array_diff($namespaces, array(NS_FILE, NS_CATEGORY, NS_MEDIAWIKI, NS_USER));
$talk = array_filter($namespaces, function ($ns) {
return MWNamespace::isTalk($ns);
});
// prefer non-talk pages
$namespaces = array_diff($namespaces, $talk);
$namespaces = array_merge($namespaces, $talk);
// check default content model of each namespace
foreach ($namespaces as $ns) {
if (!isset($wgNamespaceContentModels[$ns]) || $wgNamespaceContentModels[$ns] === CONTENT_MODEL_WIKITEXT) {
$wikitextNS = $ns;
return $wikitextNS;
}
}
// give up
// @todo Inside a test, we could skip the test as incomplete.
// But frequently, this is used in fixture setup.
throw new MWException("No namespace defaults to wikitext!");
}