/** * Check whether given page exists and return extra info about page (href and title attribute for link) */ public static function checkInternalLink() { global $wgTitle, $wgEnableWallEngine; wfProfileIn(__METHOD__); $res = array('exists' => false); if (!empty($wgTitle)) { // existing local URL or interwiki link $exists = $wgTitle->exists() || $wgTitle->isSpecialPage() || $wgTitle->isExternal() || !empty($wgEnableWallEngine) && WallHelper::isWallNamespace($wgTitle->getNamespace()); $res = array('exists' => $exists, 'external' => $wgTitle->isExternal(), 'href' => $wgTitle->getLocalUrl(), 'title' => $exists ? $wgTitle->getPrefixedText() : wfMsg('red-link-title', $wgTitle->getPrefixedText())); } wfProfileOut(__METHOD__); return $res; }
public function dropdownNamespaces() { $selected = $this->getVal('selected', array()); $namespaces = wfGetNamespaces(); if (!empty($this->wg->EnableWallEngine)) { $namespaces = WallHelper::clearNamespaceList($namespaces); } $options = array(); foreach ($namespaces as $index => $name) { if ($index < NS_MAIN) { continue; } $options[] = array('value' => $index, 'label' => $index === 0 ? wfMessage('blanknamespace')->escaped() : $name); } if (empty($selected)) { $rcfs = new RecentChangesFiltersStorage($this->wg->User); $selected = $rcfs->get(); } $this->html = $this->app->renderView('WikiaStyleGuideDropdownController', 'multiSelect', array('options' => $options, 'selected' => $selected, 'selectAll' => true)); }
/** * @brief Hooks into GetRailModuleList * * @return boolean true */ public static function onGetRailModuleList(&$modules) { $app = F::App(); wfProfileIn(__METHOD__); $namespace = $app->wg->Title->getNamespace(); $action = $app->wg->Request->getVal('action', null); if ($action !== 'history' && $namespace === NS_USER_WALL && !$app->wg->Title->isSubpage()) { // we want only chat, achivements and following pages $remove = array(1250, 1450, 1300, 1150); foreach ($remove as $rightRailEl) { if (!empty($modules[$rightRailEl])) { unset($modules[$rightRailEl]); } } } if ($action === 'history' && WallHelper::isWallNamespace($namespace)) { $modules = array(); $modules[1440] = array('WallRail', 'index', null); } wfProfileOut(__METHOD__); return true; }
/** * Hook * * @param WikiPage $wikiPage -- instance of Article class * @param User $user -- current user * @param string $reason -- deleting reason * @param integer $id -- article id * * @static * @access public * * @return boolean -- because it's a hook */ public static function articleDeleteComplete(WikiPage &$wikiPage, &$user, $reason, $id) { global $wgOut, $wgRC2UDPEnabled, $wgMaxCommentsToDelete, $wgCityId, $wgUser, $wgEnableMultiDeleteExt; wfProfileIn(__METHOD__); $title = $wikiPage->getTitle(); if (!MWNamespace::isTalk($title->getNamespace()) || !ArticleComment::isTitleComment($title)) { if (empty(self::$mArticlesToDelete)) { wfProfileOut(__METHOD__); return true; } } if (class_exists('WallHelper') && WallHelper::isWallNamespace($title->getNamespace())) { wfProfileOut(__METHOD__); return true; } //watch out for recursion if (self::$mDeletionInProgress) { wfProfileOut(__METHOD__); return true; } self::$mDeletionInProgress = true; //redirect to article/blog after deleting a comment (or whole article/blog) $parts = ArticleComment::explode($title->getText()); $parentTitle = Title::newFromText($parts['title'], MWNamespace::getSubject($title->getNamespace())); $wgOut->redirect($parentTitle->getFullUrl()); //do not use $reason as it contains content of parent article/comment - not current ones that we delete in a loop $deleteReason = wfMsgForContent('article-comments-delete-reason'); //we have comment 1st level - checked in articleDelete() (or 2nd - so do nothing) if (is_array(self::$mArticlesToDelete)) { $mDelete = 'live'; if (isset($wgMaxCommentsToDelete) && count(self::$mArticlesToDelete) > $wgMaxCommentsToDelete) { if (!empty($wgEnableMultiDeleteExt)) { $mDelete = 'task'; } } if ($mDelete == 'live') { $irc_backup = $wgRC2UDPEnabled; //backup $wgRC2UDPEnabled = false; //turn off foreach (self::$mArticlesToDelete as $page_id => $oComment) { $oCommentTitle = $oComment->getTitle(); if ($oCommentTitle instanceof Title) { $oComment = new ArticleComment($oCommentTitle); $oComment->doDeleteComment($deleteReason); } } $wgRC2UDPEnabled = $irc_backup; //restore to whatever it was $listing = ArticleCommentList::newFromTitle($parentTitle); $listing->purge(); } else { $taskParams = array('mode' => 'you', 'wikis' => '', 'range' => 'one', 'reason' => 'delete page', 'lang' => '', 'cat' => '', 'selwikia' => $wgCityId, 'edittoken' => $wgUser->getEditToken(), 'user' => $wgUser->getName(), 'admin' => $wgUser->getName()); foreach (self::$mArticlesToDelete as $oComment) { $oCommentTitle = $oComment->getTitle(); if ($oCommentTitle instanceof Title) { /* @var $oCommentTitle Title */ $data = $taskParams; $data['page'] = $oCommentTitle->getFullText(); $task = new \Wikia\Tasks\Tasks\MultiTask(); $task->call('delete', $data); $submit_id = $task->queue(); Wikia::log(__METHOD__, 'deletecomment', "Added task ({$submit_id}) for {$data['page']} page"); } } } } wfProfileOut(__METHOD__); return true; }
<?php $helper = new WallHelper(); if ($unread) { ?> <li class="unread_notification admin_notification"> <?php } else { ?> <li class="read_notification admin_notification"> <?php } ?> <a href="<?php echo $url; ?> "> <div class="notification"> <div class="msg-title"><?php echo $helper->shortenText($title, WallNotificationsController::NOTIFICATION_TITLE_LIMIT); ?> </div> <?php echo wfMessage('wall-notifications-notifyeveryone', $authors[0])->text(); ?> <div class="timeago" title="<?php echo $iso_timestamp; ?> "></div> </div> </a>
public static function isPosted($talk, $user) { global $wgMemc, $wgEnableWallExt; $key = wfMemcKey("HAWelcome-isPosted", $user->getName()); $isPosted = $wgMemc->get($key, false); if ($isPosted) { return true; } if (!empty($wgEnableWallExt)) { if (WallHelper::haveMsg($user)) { $wgMemc->set($key, true); return true; } } $talkExists = $talk->exists(); $wgMemc->set($key, $talkExists); return $talkExists; }
public function onGetRailModuleSpecialPageList(&$railModuleList) { $app = F::App(); $namespace = $app->wg->Title->getNamespace(); $diff = $app->wg->Request->getVal('diff', false); $isDiff = !empty($diff) && $app->wg->Request->getVal('oldid', false); if ($isDiff && WallHelper::isWallNamespace($namespace)) { //SuppressRail $railModuleList = array(); } return true; }
/** * Fills the $info parameter with a human readable article title and a URL that links directly to * a wall or forum post * * @param $info - Associative array to hold the result * @param $title - The article title of the wall/forum post * @param $ns - The namespace of the wall/forum post * @return bool - The status of the hook */ public static function onFormatForumLinks(&$info, $title, $ns) { // Handle message wall and forum board links if (isset($ns) && in_array($ns, array(NS_USER_WALL_MESSAGE, NS_WIKIA_FORUM_BOARD_THREAD))) { // The method expects a DB result row. Set the data and then pass it as an object $row['page_namespace'] = $ns; $row['page_title'] = $title; $opts = WallHelper::getWallTitleData(null, (object) $row); // Set the human readable title and a link $info['titleText'] = $opts['articleTitleTxt']; $info['url'] = $opts['articleFullUrl']; } return true; }
public function getRailModuleList() { wfProfileIn(__METHOD__); global $wgTitle, $wgUser, $wgEnableAchievementsExt, $wgContentNamespaces, $wgExtraNamespaces, $wgExtraNamespacesLocal, $wgEnableWikiAnswers, $wgEnableHuluVideoPanel, $wgEnableWallEngine, $wgRequest, $wgEnableForumExt; $namespace = $wgTitle->getNamespace(); $subjectNamespace = MWNamespace::getSubject($namespace); $railModuleList = array(); $latestActivityKey = $wgUser->isAnon() ? 1250 : 1300; $huluVideoPanelKey = $wgUser->isAnon() ? 1390 : 1280; // Forum Extension if ($wgEnableForumExt && ForumHelper::isForum()) { $railModuleList = array(1202 => array('Forum', 'forumRelatedThreads', null), 1201 => array('Forum', 'forumActivityModule', null), 1490 => array('Ad', 'Index', ['slotName' => 'TOP_RIGHT_BOXAD'])); // Include additional modules from other extensions (like chat) wfRunHooks('GetRailModuleList', array(&$railModuleList)); wfProfileOut(__METHOD__); return $railModuleList; } if ($namespace == NS_SPECIAL) { if (WikiaPageType::isSearch()) { if (empty($this->wg->EnableWikiaHomePageExt)) { $railModuleList = array($latestActivityKey => array('LatestActivity', 'Index', null)); $railModuleList[1450] = array('PagesOnWiki', 'Index', null); if (empty($wgEnableWikiAnswers)) { if ($wgEnableHuluVideoPanel) { $railModuleList[$huluVideoPanelKey] = array('HuluVideoPanel', 'Index', null); } } } } else { if ($wgTitle->isSpecial('Leaderboard')) { $railModuleList = array($latestActivityKey => array('LatestActivity', 'Index', null), 1290 => array('LatestEarnedBadges', 'Index', null)); } else { if ($wgTitle->isSpecial('WikiActivity')) { $railModuleList = array(1102 => array('HotSpots', 'Index', null), 1101 => array('CommunityCorner', 'Index', null)); $railModuleList[1450] = array('PagesOnWiki', 'Index', null); } else { if ($wgTitle->isSpecial('Following') || $wgTitle->isSpecial('Contributions')) { // intentional nothing here } else { if ($wgTitle->isSpecial('ThemeDesignerPreview')) { $railModuleList = array($latestActivityKey => array('LatestActivity', 'Index', null)); $railModuleList[1450] = array('PagesOnWiki', 'Index', null); if (empty($wgEnableWikiAnswers)) { if ($wgEnableHuluVideoPanel) { $railModuleList[$huluVideoPanelKey] = array('HuluVideoPanel', 'Index', null); } } } else { // don't show any module for MW core special pages $railModuleList = array(); wfRunHooks('GetRailModuleSpecialPageList', array(&$railModuleList)); wfProfileOut(__METHOD__); return $railModuleList; } } } } } } // Content, category and forum namespaces. FB:1280 Added file,video,mw,template if ($wgTitle->isSubpage() && $wgTitle->getNamespace() == NS_USER || in_array($subjectNamespace, array(NS_CATEGORY, NS_CATEGORY_TALK, NS_FORUM, NS_PROJECT, NS_FILE, NS_MEDIAWIKI, NS_TEMPLATE, NS_HELP)) || in_array($subjectNamespace, $wgContentNamespaces) || array_key_exists($subjectNamespace, $wgExtraNamespaces)) { // add any content page related rail modules here $railModuleList[$latestActivityKey] = array('LatestActivity', 'Index', null); $railModuleList[1450] = array('PagesOnWiki', 'Index', null); if (empty($wgEnableWikiAnswers)) { if ($wgEnableHuluVideoPanel) { $railModuleList[$huluVideoPanelKey] = array('HuluVideoPanel', 'Index', null); } } } // User page namespaces if (in_array($wgTitle->getNamespace(), self::getUserPagesNamespaces())) { $page_owner = User::newFromName($wgTitle->getText()); if ($page_owner) { if (!$page_owner->getGlobalPreference('hidefollowedpages')) { $railModuleList[1101] = array('FollowedPages', 'Index', null); } if ($wgEnableAchievementsExt) { $railModuleList[1102] = array('Achievements', 'Index', null); } } } if (self::isBlogPost() || self::isBlogListing()) { $railModuleList[1250] = array('PopularBlogPosts', 'Index', null); } // No rail on main page or edit page for oasis skin // except &action=history of wall if (!empty($wgEnableWallEngine)) { $isEditPage = !WallHelper::isWallNamespace($namespace) && BodyController::isEditPage() || $wgRequest->getVal('diff'); } else { $isEditPage = BodyController::isEditPage(); } if ($isEditPage || WikiaPageType::isMainPage()) { $modules = array(); wfRunHooks('GetEditPageRailModuleList', array(&$modules)); wfProfileOut(__METHOD__); return $modules; } // No modules on Custom namespaces, unless they are in the ContentNamespaces list, those get the content rail if (is_array($wgExtraNamespacesLocal) && array_key_exists($subjectNamespace, $wgExtraNamespacesLocal) && !in_array($subjectNamespace, $wgContentNamespaces)) { wfProfileOut(__METHOD__); return array(); } // If the entire page is non readable due to permissions, don't display the rail either RT#75600 if (!$wgTitle->userCan('read')) { wfProfileOut(__METHOD__); return array(); } $railModuleList[1440] = array('Ad', 'Index', ['slotName' => 'TOP_RIGHT_BOXAD']); $railModuleList[1100] = array('Ad', 'Index', ['slotName' => 'LEFT_SKYSCRAPER_2']); unset($railModuleList[1450]); wfRunHooks('GetRailModuleList', array(&$railModuleList)); wfProfileOut(__METHOD__); return $railModuleList; }
public function getArticlesRelatedMessgesSnippet($pageId, $messageCount, $replyCount) { $messages = $this->getArticlesRelatedMessgesIds($pageId, 'last_update desc', $messageCount); $out = array(); $update = array(0); $helper = new WallHelper(); foreach ($messages as $value) { $wallThread = WallThread::newFromId($value['comment_id']); if (empty($wallThread)) { continue; } $wallMessage = $wallThread->getThreadMainMsg(); if (empty($wallMessage)) { continue; } $wallMessage->load(); $update[] = $wallMessage->getCreateTime(TS_UNIX); $row = array(); $row['metaTitle'] = $wallMessage->getMetaTitle(); $row['threadUrl'] = $wallMessage->getMessagePageUrl(); $row['totalReplies'] = $wallThread->getRepliesCount(); $row['displayName'] = $wallMessage->getUserDisplayName(); $row['userName'] = $wallMessage->getUser()->getName(); $row['userUrl'] = $wallMessage->getUserWallUrl(); $strippedText = $helper->strip_wikitext($wallMessage->getRawText(), $wallMessage->getTitle()); $row['messageBody'] = $helper->shortenText($strippedText); $row['timeStamp'] = $wallMessage->getCreateTime(); $row['replies'] = array(); $replies = array_reverse($wallThread->getRepliesWallMessages(2, "DESC")); foreach ($replies as $reply) { /** @var WallMessage $reply */ $reply->load(); $update[] = $reply->getCreateTime(TS_UNIX); if (!$reply->isRemove() && !$reply->isAdminDelete()) { $strippedText = $helper->strip_wikitext($reply->getRawText(), $reply->getTitle()); $replyRow = array('displayName' => $reply->getUserDisplayName(), 'userName' => $reply->getUser()->getName(), 'userUrl' => $reply->getUserWallUrl(), 'messageBody' => $helper->shortenText($strippedText), 'timeStamp' => $reply->getCreateTime()); $row['replies'][] = $replyRow; } } $out[] = $row; } $out['lastupdate'] = max($update); return $out; }
public static function onFilePageImageUsageSingleLink(&$link, &$element) { if ($element->page_namespace == NS_WIKIA_FORUM_BOARD_THREAD) { $titleData = WallHelper::getWallTitleData(null, $element); $boardText = wfMessage('forum-wiki-activity-msg')->rawParams('<a href="' . $titleData['wallPageFullUrl'] . '">' . wfMessage('forum-wiki-activity-msg-name', $titleData['wallPageName'])->escaped() . '</a>')->escaped(); $link = '<a href="' . $titleData['articleFullUrl'] . '">' . $titleData['articleTitleTxt'] . '</a> ' . $boardText; } return true; }
protected function recipientWallIsEmpty() { return !WallHelper::haveMsg($this->recipientObject); }
/** * add comment to database */ public function addToDatabase() { $this->wf->ProfileIn(__METHOD__); //Just for transition time if (empty($this->wg->EnableWallEngine) || !WallHelper::isWallNamespace($this->namespace)) { return false; } if (!$this->wf->ReadOnly()) { $this->createTableCommentsIndex(); $db = $this->wf->GetDB(DB_MASTER); $timestamp = $db->timestamp(); if (empty($this->createdAt)) { $this->createdAt = $timestamp; } if (empty($this->lastTouched)) { $this->lastTouched = $timestamp; } $db->replace('comments_index', '', array('parent_page_id' => $this->parentPageId, 'comment_id' => $this->commentId, 'parent_comment_id' => $this->parentCommentId, 'last_child_comment_id' => $this->lastChildCommentId == 0 ? $this->commentId : $this->lastChildCommentId, 'archived' => $this->archived, 'deleted' => $this->deleted, 'removed' => $this->removed, 'locked' => $this->locked, 'protected' => $this->protected, 'sticky' => $this->sticky, 'first_rev_id' => $this->firstRevId, 'created_at' => $this->createdAt, 'last_rev_id' => $this->lastRevId, 'last_touched' => $this->lastTouched), __METHOD__); $db->commit(); } $this->wf->ProfileOut(__METHOD__); }
private function filterNew($res, $title) { wfProfileIn(__METHOD__); global $wgContentNamespaces, $wgWallNS; $item = array('type' => 'new'); $hidecategories = !empty($this->parameters['flags']) && in_array('hidecategories', $this->parameters['flags']); if (in_array($res['ns'], $wgContentNamespaces) || $res['ns'] == 110 || $res['ns'] == NS_PROJECT || $res['ns'] == NS_CATEGORY && !$hidecategories || in_array($res['ns'] - 1, $wgContentNamespaces) || $res['ns'] - 1 == 110 || $res['ns'] - 1 == NS_PROJECT || $res['ns'] - 1 == NS_CATEGORY && !$hidecategories) { $item['title'] = $res['title']; $item['url'] = $title->getLocalUrl(); if (class_exists('ArticleComment') && ArticleComment::isTitleComment($title)) { $item['articleComment'] = true; $parts = ArticleComment::explode($res['title']); $item['title'] = $parts['title']; } } elseif ($res['ns'] == NS_USER_TALK) { // BugId:15648 $item['title'] = $res['title']; $item['url'] = $title->getLocalUrl(); } elseif (defined('NS_BLOG_ARTICLE') && $res['ns'] == NS_BLOG_ARTICLE && class_exists('ArticleComment')) { $parts = ArticleComment::explode($res['title']); $item['title'] = $parts['title']; $item['url'] = $title->getLocalUrl(); } elseif (defined('NS_BLOG_ARTICLE_TALK') && $res['ns'] == NS_BLOG_ARTICLE_TALK && class_exists('ArticleComment')) { $subpageTitle = Title::newFromText($title->getBaseText(), NS_BLOG_ARTICLE_TALK); /* * Unfortunately $subpageTitle->getSubpageText() don't grab the blog article title text for for subcomments. * So considering blog structure reasonable way to get it, is to grab second title text part from full title text. */ $articleText = explode("/", $title->getText()); $item['title'] = count($articleText) > 2 ? $articleText[1] : $subpageTitle->getSubpageText(); $item['url'] = $subpageTitle->getLocalUrl(); } elseif (defined('NS_BLOG_LISTING') && $res['ns'] == NS_BLOG_LISTING) { if ($this->proxyType == self::WL) { $item['title'] = $res['title']; $item['url'] = Title::newFromText($title->getBaseText(), NS_BLOG_ARTICLE)->getLocalUrl(); } } elseif (defined('NS_TOPLIST') && $res['ns'] == NS_TOPLIST) { if ($this->proxyType == self::AF && !stripos($res['title'], 'toplist-item')) { $item['title'] = $res['title']; $item['url'] = Title::newFromText($title->getBaseText(), NS_TOPLIST)->getLocalUrl(); $res['comment'] = ''; // suppressing needless details $res['rc_params'] = ''; } } elseif (!empty($wgWallNS) && in_array(MWNamespace::getSubject($res['ns']), $wgWallNS) && $this->proxyType == self::AF) { $wh = new WallHelper(); $item = $wh->wikiActivityFilterMessageWall($title, $res); } if (count($item) > 1) { if (isset($res['rc_params']['intro'])) { $item['intro'] = $res['rc_params']['intro']; } if ($res['comment'] != '') { $item['comment'] = $res['comment']; } $this->add($item, $res); wfProfileOut(__METHOD__); return true; } wfProfileOut(__METHOD__); }
/** * Updates topics list to given message id. It will completely override. * @param string $messageId - numeric id * @param array $relatedTopics - list of topics (article names) * @return string status - success/failure */ public function updateTopics() { $messageId = $this->request->getVal('msgid', ''); $relatedTopics = $this->request->getVal('relatedTopics', array()); // place holder data, replace this with magic $status = 'success'; $topics = array(); if (!is_array($relatedTopics)) { $relatedTopics = array(); } // cut more then 4 $relatedTopics = array_slice($relatedTopics, 0, 4); // save /** * @var $mw WallMessage */ $mw = WallMessage::newFromId($messageId); if (!empty($mw)) { $mw->load(); $mw->setRelatedTopics($this->wg->User, $relatedTopics); } foreach ($relatedTopics as $topic) { $topicTitle = Title::newFromURL($topic); $topics[] = array('topic' => $topic, 'url' => WallHelper::getTopicPageURL($topicTitle)); // I have no idea what the url will be, just a placeholder for now } // end place holder $this->response->setVal('status', $status); $this->response->setVal('topics', $topics); }
/** * Hook into MW transaction that creates new article comments and execute queries that create comments_index entries * @param $dbw database connetion * @param Title $title newly created article * @param Revision $revision revision containig the lastest version of article comment * @param $flags Integer bitfield, the same as in WikiPage::doEdit method */ public static function onArticleDoEdit($dbw, Title $title, Revision $revision, $flags) { global $wgEnableWallEngine; if (!empty($wgEnableWallEngine) && WallHelper::isWallNamespace($title->getNamespace())) { if ($flags & EDIT_NEW) { $titleText = $title->getText(); if (isset(self::$commentInfoData[$titleText])) { $data = array('namespace' => self::$commentInfoData[$titleText]->userPageTitle->getNamespace(), 'parentPageId' => self::$commentInfoData[$titleText]->userPageTitle->getArticleID(), 'commentId' => $title->getArticleID(), 'parentCommentId' => intval(self::$commentInfoData[$titleText]->parentId), 'firstRevId' => $revision->getId(), 'lastRevId' => $revision->getId()); $commentsIndex = new CommentsIndex($data, $dbw); $commentsIndex->addToDatabase(); $commentsIndex->updateParentLastCommentId($data['commentId']); } } else { $commentsIndex = CommentsIndex::newFromId($title->getArticleID(), 0, $dbw); if ($commentsIndex instanceof CommentsIndex) { $commentsIndex->updateLastRevId($revision->getId()); } } } return true; }
public function getRailModuleList() { wfProfileIn(__METHOD__); global $wgTitle, $wgUser, $wgEnableAchievementsExt, $wgContentNamespaces, $wgExtraNamespaces, $wgExtraNamespacesLocal, $wgEnableCorporatePageExt, $wgEnableWikiAnswers, $wgSalesTitles, $wgEnableHuluVideoPanel, $wgEnableGamingCalendarExt, $wgEnableWallEngine, $wgRequest; $namespace = $wgTitle->getNamespace(); $subjectNamespace = MWNamespace::getSubject($namespace); $railModuleList = array(); $latestPhotosKey = $wgUser->isAnon() ? 1300 : 1250; $latestActivityKey = $wgUser->isAnon() ? 1250 : 1300; $huluVideoPanelKey = $wgUser->isAnon() ? 1390 : 1280; // Forum Extension if (WikiaPageType::isForum()) { $railModuleList = array ( 1500 => array('Search', 'Index', null), 1002 => array('Forum', 'forumRelatedThreads', null), 1001 => array('Forum', 'forumActivityModule', null), 1000 => array('Forum', 'forumParticipationModule', null), 1490 => array('Ad', 'Index', array('slotname' => 'TOP_RIGHT_BOXAD')), ); return $railModuleList; } if($namespace == NS_SPECIAL) { if (WikiaPageType::isSearch()) { if (empty($this->wg->EnableWikiaHomePageExt)) { $railModuleList = array( $latestActivityKey => array('LatestActivity', 'Index', null), ); $railModuleList[1450] = array('PagesOnWiki', 'Index', null); if( empty( $wgEnableWikiAnswers ) ) { $railModuleList[$latestPhotosKey] = array('LatestPhotos', 'Index', null); if ($wgEnableHuluVideoPanel) { $railModuleList[$huluVideoPanelKey] = array('HuluVideoPanel', 'Index', null); } } } elseif ($wgEnableCorporatePageExt) { $railModuleList = array( 1490 => array('Ad', 'Index', array('slotname' => 'TOP_RIGHT_BOXAD')) ); wfProfileOut(__METHOD__); return $railModuleList; } } else if ($wgTitle->isSpecial('Leaderboard')) { $railModuleList = array ( 1500 => array('Search', 'Index', null), $latestActivityKey => array('LatestActivity', 'Index', null), 1290 => array('LatestEarnedBadges', 'Index', null) ); } else if ($wgTitle->isSpecial('WikiActivity')) { $railModuleList = array ( 1500 => array('Search', 'Index', null), 1102 => array('HotSpots', 'Index', null), 1101 => array('CommunityCorner', 'Index', null), ); $railModuleList[1450] = array('PagesOnWiki', 'Index', null); } else if ($wgTitle->isSpecial('Following') || $wgTitle->isSpecial('Contributions') ) { // intentional nothing here } else if ($wgTitle->isSpecial('ThemeDesignerPreview') ) { $railModuleList = array ( 1500 => array('Search', 'Index', null), $latestActivityKey => array('LatestActivity', 'Index', null), ); $railModuleList[1450] = array('PagesOnWiki', 'Index', null); if( empty( $wgEnableWikiAnswers ) ) { $railModuleList[$latestPhotosKey] = array('LatestPhotos', 'Index', null); if ($wgEnableHuluVideoPanel) { $railModuleList[$huluVideoPanelKey] = array('HuluVideoPanel', 'Index', null); } } } else if( $wgTitle->isSpecial('PageLayoutBuilderForm') ) { $railModuleList = array ( 1501 => array('Search', 'Index', null), 1500 => array('PageLayoutBuilderForm', 'Index', null) ); } else { // don't show any module for MW core special pages $railModuleList = array(); wfRunHooks( 'GetRailModuleSpecialPageList', array( &$railModuleList ) ); wfProfileOut(__METHOD__); return $railModuleList; } } else if ( !self::showUserPagesHeader() ) { // ProfilePagesV3 renders its own search box. // If this page is not a page with the UserPagesHeader on version 3, show search (majority case) $railModuleList = array ( 1500 => array('Search', 'Index', null), ); } // Content, category and forum namespaces. FB:1280 Added file,video,mw,template if( $wgTitle->isSubpage() && $wgTitle->getNamespace() == NS_USER || in_array($subjectNamespace, array (NS_CATEGORY, NS_CATEGORY_TALK, NS_FORUM, NS_PROJECT, NS_FILE, NS_VIDEO, NS_MEDIAWIKI, NS_TEMPLATE, NS_HELP)) || in_array($subjectNamespace, $wgContentNamespaces) || array_key_exists( $subjectNamespace, $wgExtraNamespaces ) ) { // add any content page related rail modules here $railModuleList[$latestActivityKey] = array('LatestActivity', 'Index', null); $railModuleList[1450] = array('PagesOnWiki', 'Index', null); if( empty( $wgEnableWikiAnswers ) ) { $railModuleList[$latestPhotosKey] = array('LatestPhotos', 'Index', null); if ($wgEnableHuluVideoPanel) { $railModuleList[$huluVideoPanelKey] = array('HuluVideoPanel', 'Index', null); } } } // User page namespaces if( in_array($wgTitle->getNamespace(), self::getUserPagesNamespaces() ) ) { $page_owner = User::newFromName($wgTitle->getText()); if($page_owner) { if( !$page_owner->getOption('hidefollowedpages') ) { $railModuleList[1101] = array('FollowedPages', 'Index', null); } if($wgEnableAchievementsExt && !(($wgUser->getId() == $page_owner->getId()) && $page_owner->getOption('hidepersonalachievements'))){ $railModuleList[1102] = array('Achievements', 'Index', null); } } } if (self::isBlogPost() || self::isBlogListing()) { $railModuleList[1500] = array('Search', 'Index', null); $railModuleList[1250] = array('PopularBlogPosts', 'Index', null); } // A/B testing leftovers, leave for now because we will do another one $useTestBoxad = false; // Special case rail modules for Corporate Skin if ($wgEnableCorporatePageExt) { $railModuleList = array ( 1500 => array('Search', 'Index', null), ); // No rail on main page or edit page for corporate skin if ( BodyController::isEditPage() || WikiaPageType::isMainPage() ) { $railModuleList = array(); } else if (self::isHubPage()) { if ($useTestBoxad) { $railModuleList[1490] = array('Ad', 'Index', array('slotname' => 'TEST_TOP_RIGHT_BOXAD')); } else { $railModuleList[1490] = array('Ad', 'Index', array('slotname' => 'CORP_TOP_RIGHT_BOXAD')); } $railModuleList[1480] = array('CorporateSite', 'HotSpots', null); // $railModuleList[1470] = array('CorporateSite', 'PopularHubPosts', null); // temp disabled - data not updating $railModuleList[1460] = array('CorporateSite', 'TopHubUsers', null); } else if ( is_array( $wgSalesTitles ) && in_array( $wgTitle->getText(), $wgSalesTitles ) ){ $railModuleList[1470] = array('CorporateSite', 'SalesSupport', null); } else { // content pages $railModuleList[1470] = array('CorporateSite', 'PopularStaffPosts', null); } wfProfileOut(__METHOD__); return $railModuleList; } // No rail on main page or edit page for oasis skin // except &action=history of wall if( !empty($wgEnableWallEngine) ) { $isEditPage = !WallHelper::isWallNamespace($namespace) && BodyController::isEditPage() || $wgRequest->getVal('diff'); } else { $isEditPage = BodyController::isEditPage(); } if ( $isEditPage || WikiaPageType::isMainPage() ) { $modules = array(); wfRunHooks( 'GetEditPageRailModuleList', array( &$modules ) ); wfProfileOut(__METHOD__); return $modules; } // No modules on Custom namespaces, unless they are in the ContentNamespaces list, those get the content rail if (is_array($wgExtraNamespacesLocal) && array_key_exists($subjectNamespace, $wgExtraNamespacesLocal) && !in_array($subjectNamespace, $wgContentNamespaces)) { wfProfileOut(__METHOD__); return array(); } // If the entire page is non readable due to permissions, don't display the rail either RT#75600 if (!$wgTitle->userCan( 'read' )) { wfProfileOut(__METHOD__); return array(); } if ($useTestBoxad) { $railModuleList[1440] = array('Ad', 'Index', array('slotname' => 'TEST_TOP_RIGHT_BOXAD')); } else { $railModuleList[1440] = array('Ad', 'Index', array('slotname' => 'TOP_RIGHT_BOXAD')); } $railModuleList[1291] = array('Ad', 'Index', array('slotname' => 'MIDDLE_RIGHT_BOXAD')); $railModuleList[1100] = array('Ad', 'Index', array('slotname' => 'LEFT_SKYSCRAPER_2')); /** * Michał Roszka <*****@*****.**> * * SSW Gaming Calendar * * This is most likely going to be replaced with something similar to: * * $railModuleList[1260] = array( 'Ad', 'Index', array( 'slotname' => 'GAMING_CALENDAR_RAIL' ) ); */ if ( !empty( $wgEnableGamingCalendarExt ) ) { $railModuleList[1430] = array( 'GamingCalendarRail', 'Index', array( ) ); } else { $railModuleList[1430] = array('Ad', 'Index', array('slotname' => 'TOP_RIGHT_BUTTON')); } // WikiNav v2 - begin // TODO: remove once it's enabled sitewide global $wgOasisNavV2; if (!empty($wgOasisNavV2)) { // remove PagesOnWiki module unset($railModuleList[1450]); } // WikiNav v2 - end wfRunHooks( 'GetRailModuleList', array( &$railModuleList ) ); wfProfileOut(__METHOD__); return $railModuleList; }
<h4 class="related-topics-heading"><?php echo wfMsg('wall-topic-heading'); ?> </h4> <ul class="related-topics"> <?php foreach ($relatedTopics as $val) { ?> <li class="related-topic" data-topic="<?php echo $val->getText(); ?> "> <a href="<?php echo WallHelper::getTopicPageURL($val); ?> "> <?php echo $val->getText(); ?> </a> </li> <?php } ?> <script id="RelatedTopicTemplate" type="text/template"> {{#topics}} <li class="related-topic" data-topic="{{topic}}"> <a href="{{url}}"> {{topic}} </a> </li>