コード例 #1
0
/**
 * @param Array $tabs
 * @param $namespace
 * @param $userName
 * @return bool
 */
function efUserManagementPanelAddTab(&$tabs, $namespace, $userName)
{
    global $wgTitle, $wgUser;
    if (!$wgUser->isAllowed('usermanagement')) {
        return true;
    }
    $tabs[] = array('link' => Wikia::link(SpecialPage::getTitleFor('UserManagement/' . $userName), wfMsg('usermanagement-tab-label')), 'selected' => $wgTitle->isSpecial('UserManagement'), 'data-id' => 'usermanagment');
    return true;
}
 public function index()
 {
     wfProfileIn(__METHOD__);
     global $wgUser;
     $this->isAnon = $wgUser->isAnon();
     $this->username = $wgUser->getName();
     $this->avatarContainerAdditionalClass = '';
     $this->profileAvatar = '';
     $this->setupPersonalUrls();
     if ($this->isAnon) {
         $this->navItemLinkOpeningTag = $this->renderPersonalUrl('login', true);
         $this->avatarContainerAdditionalClass = ' anon-avatar-placeholder';
         $this->loginDropdown = F::app()->renderView('UserLoginSpecial', 'dropdown', ['template' => 'globalNavigationDropdown', 'registerLink' => $this->renderPersonalUrl('register')]);
     } else {
         $this->navItemLinkOpeningTag = $this->renderPersonalUrl('userpage', true);
         if (AvatarService::isEmptyOrFirstDefault($this->username)) {
             $this->avatarContainerAdditionalClass = ' logged-avatar-placeholder';
         } else {
             $this->avatarContainerAdditionalClass = ' logged-avatar';
             $this->profileAvatar = AvatarService::renderAvatar($this->username, AvatarService::AVATAR_SIZE_SMALL_PLUS - 2);
             //2px css border
         }
         $possibleItems = ['mytalk', 'following', 'preferences'];
         $dropdownItems = [];
         // Allow hooks to modify the dropdown items.
         wfRunHooks('AccountNavigationModuleAfterDropdownItems', [&$possibleItems, &$this->personalUrls]);
         foreach ($possibleItems as $item) {
             if (isset($this->personalUrls[$item])) {
                 $dropdownItems[] = $this->renderPersonalUrl($item);
             }
         }
         // link to Help:Content ('known' -> never render as redlink)
         $helpLang = array_key_exists($this->wg->LanguageCode, $this->wg->AvailableHelpLang) ? $this->wg->LanguageCode : 'en';
         $dropdownItems[] = Wikia::link(Title::newFromText(wfMessage('helppage')->inLanguage($helpLang)->text()), wfMessage('help')->text(), ['data-id' => 'help'], '', ['known']);
         $dropdownItems[] = $this->renderPersonalUrl('logout', false);
         $this->userDropdown = $dropdownItems;
     }
     wfProfileOut(__METHOD__);
 }
コード例 #3
0
 /**
  * Render header for blog post
  */
 public function executeBlogPost()
 {
     wfProfileIn(__METHOD__);
     global $wgTitle, $wgLang, $wgOut;
     // remove User_blog:xxx from title
     $titleParts = explode('/', $wgTitle->getText());
     array_shift($titleParts);
     $this->title = implode('/', $titleParts);
     // get user name to display in header
     $this->userName = self::getUserName($wgTitle, BodyController::getUserPagesNamespaces());
     // render avatar (48x48)
     $this->avatar = AvatarService::renderAvatar($this->userName, 48);
     // link to user page
     $this->userPage = AvatarService::getUrl($this->userName);
     if ($this->wg->EnableBlogArticles) {
         // link to user blog page
         $this->userBlogPage = AvatarService::getUrl($this->userName, NS_BLOG_ARTICLE);
         // user blog page message
         $this->userBlogPageMessage = wfMessage('user-blog-url-link', $this->userName)->inContentLanguage()->parse();
     }
     if (!empty($this->wg->EnableGoogleAuthorInfo) && !empty($this->wg->GoogleAuthorLinks) && array_key_exists($this->userName, $this->wg->GoogleAuthorLinks)) {
         $this->googleAuthorLink = $this->wg->GoogleAuthorLinks[$this->userName] . '?rel=author';
     }
     if ($this->app->wg->Request->getVal('action') == 'history' || $this->app->wg->Request->getCheck('diff')) {
         $this->navLinks = Wikia::link($this->app->wg->title, wfMsg('oasis-page-header-back-to-article'), array(), array(), 'known');
     }
     // user stats (edit points, account creation date)
     $this->stats = $this->getStats($this->userName);
     // commments / likes / date of first edit
     if (!empty($wgTitle) && $wgTitle->exists()) {
         $service = new PageStatsService($wgTitle->getArticleId());
         $this->editTimestamp = $wgLang->date($service->getFirstRevisionTimestamp());
         $this->comments = $service->getCommentsCount();
     }
     $actionMenu = array();
     $dropdownActions = array('move', 'protect', 'unprotect', 'delete', 'undelete', 'history');
     // edit button / dropdown
     if (isset($this->content_actions['ve-edit'])) {
         // new visual editor is enabled
         $actionMenu['action'] = $this->content_actions['ve-edit'];
         // add classic editor link to the possible dropdown options
         array_unshift($dropdownActions, 'edit');
     } else {
         if (isset($this->content_actions['edit'])) {
             $actionMenu['action'] = $this->content_actions['edit'];
         }
     }
     foreach ($dropdownActions as $action) {
         if (isset($this->content_actions[$action])) {
             $actionMenu['dropdown'][$action] = $this->content_actions[$action];
         }
     }
     $this->actionMenu = $actionMenu;
     // load CSS for .WikiaUserPagesHeader (BugId:9212, 10246)
     $wgOut->addStyle(AssetsManager::getInstance()->getSassCommonURL("skins/oasis/css/core/UserPagesHeader.scss"));
     wfProfileOut(__METHOD__);
 }
コード例 #4
0
ファイル: ControllerTest.php プロジェクト: schwarer2006/wikia
	function testWikiaLink() {
		$this->assertTag (
			array("tag" => "a"),
			Wikia::link(Title::newFromText("Test"))
		);
	}
コード例 #5
0
 /**
  * Render edit box header when doing preview / showing changes
  */
 public function executeEditBox()
 {
     global $wgTitle, $wgRequest;
     // detect section edit
     $isSectionEdit = is_numeric($wgRequest->getVal('wpSection'));
     if ($isSectionEdit) {
         $msg = 'oasis-page-header-editing-section';
     } else {
         $msg = 'oasis-page-header-editing';
     }
     // Editing: foo
     $this->displaytitle = true;
     $this->title = wfMsg($msg, htmlspecialchars($wgTitle->getPrefixedText()));
     // back to article link
     $this->subtitle = Wikia::link($wgTitle, wfMsg('oasis-page-header-back-to-article'), array('accesskey' => 'c'), array(), 'known');
 }
コード例 #6
0
	private function getTemplateData($element) {

		if (! isset($element['file'])) return array();

		$file = $element['file'];
		// crop the images correctly using extension:imageservice
		$is = new ImageServing(array(), self::THUMB_SIZE);
		$thumb_url = $is->getThumbnails(array($file));
		$thumb_url = array_pop($thumb_url);
		$thumb_url = $thumb_url['url'];
		$userName = $file->user_text;

		$retval = array (
			"file_url" => $element['url'],
			"image_url" => $file->getUrl(),
			"thumb_url" => $thumb_url,
			"image_filename" => $file->getTitle()->getFullText(),
			"user_href" => Wikia::link(Title::newFromText($userName, NS_USER), $userName),
			"links" => $this->getLinkedFiles($file->name),
			"isVideoThumb"  => WikiaFileHelper::isFileTypeVideo( $file ),
			"date" => wfTimestamp(TS_ISO_8601, $file->timestamp));
		return $retval;
	}
コード例 #7
0
 public function executeIndex()
 {
     global $wgOut, $wgTitle, $wgEnableInfoBoxTest, $wgMaximizeArticleAreaArticleIds, $wgEnableAdminDashboardExt, $wgEnableWikiaHomePageExt;
     wfProfileIn(__METHOD__);
     // set up global vars
     if (is_array($wgMaximizeArticleAreaArticleIds) && in_array($wgTitle->getArticleId(), $wgMaximizeArticleAreaArticleIds)) {
         $this->wg->SuppressRail = true;
         $this->wg->SuppressPageHeader = true;
     }
     // Double-click to edit
     $this->body_ondblclick = '';
     // FIXME handling moved to OutputPage::addDefaultModules()
     // InfoBox - Testing
     $this->wg->EnableInfoBoxTest = $wgEnableInfoBoxTest;
     // Replaces ContentDisplayModule->index()
     $this->bodytext = $this->app->getSkinTemplateObj()->data['bodytext'];
     $this->railModuleList = $this->getRailModuleList();
     // this hook allows adding extra HTML just after <body> opening tag
     // append your content to $html variable instead of echoing
     // (taken from Monaco skin)
     $skin = RequestContext::getMain()->getSkin();
     $afterBodyHtml = '';
     wfRunHooks('GetHTMLAfterBody', array($skin, &$afterBodyHtml));
     $this->afterBodyHtml = $afterBodyHtml;
     // this hook is needed for SMW's factbox
     $afterContentHookText = '';
     wfRunHooks('SkinAfterContent', array(&$afterContentHookText));
     $this->afterContentHookText = $afterContentHookText;
     $this->headerModuleAction = 'Index';
     $this->headerModuleParams = array('showSearchBox' => false);
     // show user pages header on this page?
     if (self::showUserPagesHeader()) {
         $this->headerModuleName = 'UserPagesHeader';
         // is this page a blog post?
         if (self::isBlogPost()) {
             $this->headerModuleAction = 'BlogPost';
         } else {
             if (self::isBlogListing()) {
                 $this->headerModuleAction = 'BlogListing';
             }
         }
         // show corporate header on this page?
     } else {
         if (WikiaPageType::isCorporatePage() || WikiaPageType::isWikiaHub()) {
             $this->headerModuleName = 'PageHeader';
             if (self::isEditPage()) {
                 $this->headerModuleAction = 'EditPage';
             } else {
                 $this->headerModuleAction = 'Corporate';
             }
             if (WikiaPageType::isWikiaHubMain()) {
                 $this->headerModuleAction = 'Hubs';
             } elseif (WikiaPageType::isMainPage()) {
                 $this->wg->SuppressFooter = true;
                 $this->wg->SuppressArticleCategories = true;
                 $this->wg->SuppressPageHeader = true;
                 $this->wg->SuppressWikiHeader = true;
                 $this->wg->SuppressSlider = true;
             }
         } else {
             $this->headerModuleName = 'PageHeader';
             if (self::isEditPage()) {
                 $this->headerModuleAction = 'EditPage';
             }
         }
     }
     // Display Control Center Header on certain special pages
     if (!empty($wgEnableAdminDashboardExt) && AdminDashboardLogic::displayAdminDashboard($this->app, $wgTitle)) {
         $this->headerModuleName = null;
         $this->wgSuppressAds = true;
         $this->displayAdminDashboard = true;
         $this->displayAdminDashboardChromedArticle = $wgTitle->getText() != SpecialPage::getTitleFor('AdminDashboard')->getText();
     } else {
         $this->displayAdminDashboard = false;
         $this->displayAdminDashboardChromedArticle = false;
     }
     $this->railModulesExist = true;
     // use one column layout for pages with no right rail modules
     if (count($this->railModuleList) == 0 || !empty($this->wg->SuppressRail)) {
         // Special:AdminDashboard doesn't need this class, but pages chromed with it do
         if (!$this->displayAdminDashboard || $this->displayAdminDashboardChromedArticle) {
             OasisController::addBodyClass('oasis-one-column');
         }
         $this->headerModuleParams = array('showSearchBox' => true);
         $this->railModulesExist = false;
     }
     // determine if WikiaGridLayout needs to be enabled
     $this->isGridLayoutEnabled = self::isGridLayoutEnabled();
     if ($this->isGridLayoutEnabled) {
         OasisController::addBodyClass('wikia-grid');
     }
     if ($this->isOasisBreakpoints()) {
         OasisController::addBodyClass('oasis-breakpoints');
     }
     //@TODO remove this check after deprecating responsive (July 2015)
     if ($this->isResponsiveLayoutEnabled()) {
         OasisController::addBodyClass('oasis-responsive');
     }
     // if we are on a special search page, pull in the css file and don't render a header
     if ($wgTitle && $wgTitle->isSpecial('Search') && !$this->wg->WikiaSearchIsDefault) {
         $wgOut->addStyle(AssetsManager::getInstance()->getSassCommonURL("skins/oasis/css/modules/SpecialSearch.scss"));
         $this->headerModuleName = null;
     }
     // Inter-wiki search
     if ($wgTitle && ($wgTitle->isSpecial('WikiaSearch') || $wgTitle->isSpecial('Search') && $this->wg->WikiaSearchIsDefault)) {
         $this->headerModuleName = null;
     }
     // load CSS for Special:Preferences
     if (!empty($wgTitle) && $wgTitle->isSpecial('Preferences')) {
         $wgOut->addStyle(AssetsManager::getInstance()->getSassCommonURL('skins/oasis/css/modules/SpecialPreferences.scss'));
     }
     // load CSS for Special:Upload
     if (!empty($wgTitle) && $wgTitle->isSpecial('Upload')) {
         $wgOut->addStyle(AssetsManager::getInstance()->getSassCommonURL('skins/oasis/css/modules/SpecialUpload.scss'));
     }
     // load CSS for Special:MultipleUpload
     if (!empty($wgTitle) && $wgTitle->isSpecial('MultipleUpload')) {
         $wgOut->addStyle(AssetsManager::getInstance()->getSassCommonURL('skins/oasis/css/modules/SpecialMultipleUpload.scss'));
     }
     // load CSS for Special:Allpages
     if (!empty($wgTitle) && $wgTitle->isSpecial('Allpages')) {
         $wgOut->addStyle(AssetsManager::getInstance()->getSassCommonURL('skins/oasis/css/modules/SpecialAllpages.scss'));
     }
     // Forum Extension
     if (!empty($this->wg->EnableForumExt) && ForumHelper::isForum()) {
         $this->wg->SuppressPageHeader = true;
     }
     // MonetizationModule Extension
     if (!empty($this->wg->EnableMonetizationModuleExt)) {
         if (empty($this->wg->AdDriverUseMonetizationService)) {
             $this->monetizationModules = $this->sendRequest('MonetizationModule', 'index')->getData()['data'];
             $this->headerModuleParams['monetizationModules'] = $this->monetizationModules;
         } else {
             $this->monetizationModules = [MonetizationModuleHelper::SLOT_TYPE_IN_CONTENT => $this->app->renderView('Ad', 'Index', ['slotName' => 'MON_IN_CONTENT']), MonetizationModuleHelper::SLOT_TYPE_BELOW_CATEGORY => $this->app->renderView('Ad', 'Index', ['slotName' => 'MON_BELOW_CATEGORY'])];
         }
         $this->bodytext = MonetizationModuleHelper::insertIncontentUnit($this->bodytext, $this->monetizationModules);
     }
     $namespace = $wgTitle->getNamespace();
     // extra logic for subpages (RT #74091)
     if (!empty($this->subtitle)) {
         switch ($namespace) {
             // for user subpages add link to theirs talk pages
             case NS_USER:
                 $talkPage = $wgTitle->getTalkPage();
                 // get number of revisions for talk page
                 $service = new PageStatsService($wgTitle->getArticleId());
                 $comments = $service->getCommentsCount();
                 // render comments bubble
                 $bubble = F::app()->renderView('CommentsLikes', 'Index', array('comments' => $comments, 'bubble' => true));
                 $this->subtitle .= ' | ';
                 $this->subtitle .= $bubble;
                 $this->subtitle .= Wikia::link($talkPage);
                 break;
             case NS_USER_TALK:
                 $subjectPage = $wgTitle->getSubjectPage();
                 $this->subtitle .= ' | ';
                 $this->subtitle .= Wikia::link($subjectPage);
                 break;
         }
     }
     // bugid-70243: optionally hide navigation h1s for SEO
     $this->setVal('displayHeader', !$this->wg->HideNavigationHeaders);
     wfProfileOut(__METHOD__);
 }
コード例 #8
0
			$title = Title::newFromText($post['title'], $post['namespace']);
		?>
			<li class="WikiaBlogListingPost">
				<?= F::app()->renderView('CommentsLikes', 'Index', array('comments' => $post['comments'], 'bubble' => true, 'title' => $title, 'accesskey' => false)); ?>

				<?= $post['avatar'] ?>
				<div class="author-details">
					<h1><a href="<?= htmlspecialchars($title->getLocalUrl()) ?>"><?= htmlspecialchars(BlogTemplateClass::getSubpageText($title)) ?></a></h1>
					<span><?= wfMsg('blog-by', $post['date'], Xml::element('a', array('href' => htmlspecialchars($post['userpage'])), $post['username'], false)) ?></span>
				</div>

				<blockquote>
					<?php
					// handle proper rendering of "read more"
					$readMoreLink = Xml::openElement('span', array('class' => 'read-more')) .
							Wikia::link($title, wfMsg('blog-readfullpost') . ' &gt;') .
							Xml::closeElement('span');

					// if blog post rendered text ends with </p>
					if (!empty($post['readmore'])) {
						if (substr($post['text'], -4) == '</p>') {
							$post['text'] = substr($post['text'], 0, -4) . '<br>' . $readMoreLink . '</p>';
						} else {
							$post['text'] .=  '' .$readMoreLink;
						}
					} else {
						$post['text'] .= '';
					}

					echo $post['text'];
					?>
コード例 #9
0
    echo htmlspecialchars($title->getLocalUrl());
    ?>
"><?php 
    echo htmlspecialchars(BlogTemplateClass::getSubpageText($title));
    ?>
</a></h2>
					<span><?php 
    echo wfMsg('blog-by', $post['date'], Xml::element('a', array('href' => htmlspecialchars($post['userpage'])), $post['username'], false));
    ?>
</span>
				</div>

				<div class='post-summary'>
					<?php 
    // handle proper rendering of "read more"
    $readMoreLink = Xml::openElement('span', array('class' => 'read-more')) . Wikia::link($title, wfMsg('blog-readfullpost') . ' &gt;') . Xml::closeElement('span');
    // if blog post rendered text ends with </p>
    if (substr($post['text'], -4) == '</p>') {
        $post['text'] = substr($post['text'], 0, -4) . '<br>' . $readMoreLink . '</p>';
    } else {
        $post['text'] .= '' . $readMoreLink;
    }
    echo $post['text'];
    ?>
				</div>
			</li>
<?php 
}
?>
	</ul>
	<?php 
コード例 #10
0
	/**
	 * Get list of links for given username to be shown as tabs
	 */
	private function getTabs($userName) {
		wfProfileIn(__METHOD__);
		global $wgTitle, $wgEnableWikiaFollowedPages;

		$tabs = array();
		$namespace = $wgTitle->getNamespace();

		// profile
		$tabs[] = array(
				'link' => Wikia::link(Title::newFromText($userName, NS_USER), wfMsg('profile')),
				'selected' => ($namespace == NS_USER),
				'data-id' => 'profile',
				);

		// talk
		$tabs[] = array(
				'link' => Wikia::link(Title::newFromText($userName, NS_USER_TALK), wfMsg('talkpage')),
				'selected' => ($namespace == NS_USER_TALK),
				'data-id' => 'talk',
				);

		// blog
		if (defined('NS_BLOG_ARTICLE') && !User::isIP($this->userName)) {
			$tabs[] = array(
					'link' => Wikia::link(Title::newFromText($userName, NS_BLOG_ARTICLE), wfMsg('blog-page'), array(), array(), 'known'),
					'selected' => ($namespace == NS_BLOG_ARTICLE),
					'data-id' => 'blog',
					);
		}

		// contribs
		$tabs[] = array(
				'link' => Wikia::link(SpecialPage::getTitleFor("Contributions/{$userName}"), wfMsg('contris_s')),
				'selected' => ($wgTitle->isSpecial( 'Contributions' )),
				'data-id' => 'contribs',
				);

		if (self::isItMe($userName)) {
			// following (only render when user is viewing his own user pages)
			if (!empty($wgEnableWikiaFollowedPages)) {
				$tabs[] = array(
						'link' => Wikia::link(SpecialPage::getTitleFor('Following'), wfMsg('wikiafollowedpages-following')),
						'selected' => ($wgTitle->isSpecial( 'Following' )),
						'data-id' => 'following',
						);
			}

			// avatar dropdown menu
			$this->avatarMenu = array(
					Wikia::link(SpecialPage::getTitleFor('Preferences'), wfMsg('oasis-user-page-change-avatar'))
					);
		}

		$this->wf->RunHooks( 'UserPagesHeaderModuleAfterGetTabs', array(&$tabs, $namespace, $userName) );

		wfProfileOut(__METHOD__);
		return $tabs;
	}
コード例 #11
0
	public function executeIndex() {
		global $wgOut, $wgTitle, $wgUser, $wgEnableCorporatePageExt, $wgEnableInfoBoxTest, $wgMaximizeArticleAreaArticleIds, $wgEnableAdminDashboardExt, $wgEnableTopButton, $wgTopButtonPosition, $wgEnableWikiaHomePageExt;

		wfProfileIn(__METHOD__);

		// set up global vars
		if (is_array($wgMaximizeArticleAreaArticleIds)
		&& in_array($wgTitle->getArticleId(), $wgMaximizeArticleAreaArticleIds)) {
			$this->wg->SuppressRail = true;
			$this->wg->SuppressPageHeader = true;
		}

		// Double-click to edit
		$this->body_ondblclick = ''; // FIXME handling moved to OutputPage::addDefaultModules()

		// InfoBox - Testing
		$this->wg->EnableInfoBoxTest = $wgEnableInfoBoxTest;
		$this->isMainPage = WikiaPageType::isMainPage();

		// Replaces ContentDisplayModule->index()
		$this->bodytext = $this->app->getSkinTemplateObj()->data['bodytext'];

		$this->railModuleList = $this->getRailModuleList();
		// this hook allows adding extra HTML just after <body> opening tag
		// append your content to $html variable instead of echoing
		// (taken from Monaco skin)
		$skin = RequestContext::getMain()->getSkin();
		$afterBodyHtml = '';
		wfRunHooks('GetHTMLAfterBody', array($skin, &$afterBodyHtml));
		$this->afterBodyHtml = $afterBodyHtml;

		// this hook is needed for SMW's factbox
		$afterContentHookText = '';
		wfRunHooks('SkinAfterContent', array( &$afterContentHookText ) );
		$this->afterContentHookText = $afterContentHookText;

		$this->headerModuleAction = 'Index';
		$this->headerModuleParams = array ('showSearchBox' => false);

		// show user pages header on this page?
		if (self::showUserPagesHeader()) {
			$this->headerModuleName = 'UserPagesHeader';
			// is this page a blog post?
			if( self::isBlogPost() ) {
				$this->headerModuleAction = 'BlogPost';
			}
			// is this page a blog listing?
			else if (self::isBlogListing()) {
				$this->headerModuleAction = 'BlogListing';
			}
		} else {
			$this->headerModuleName = 'PageHeader';
			if (self::isEditPage()) {
				$this->headerModuleAction = 'EditPage';
			}

			// FIXME: move to separate module
			if ( $wgEnableWikiaHomePageExt && WikiaPageType::isMainPage() ) {
				$this->wg->SuppressFooter = true;
				$this->wg->SuppressArticleCategories = true;
				$this->wg->SuppressPageHeader = true;
				$this->wg->SuppressWikiHeader = true;
				$this->wg->SuppressSlider = true;
			} else if ($wgEnableCorporatePageExt) {
				// RT:71681 AutoHubsPages extension is skipped when follow is clicked

				$wgOut->addStyle(AssetsManager::getInstance()->getSassCommonURL("extensions/wikia/CorporatePage/css/CorporateSite.scss"));

				global $wgExtensionsPath, $wgJsMimeType;
				$wgOut->addScript("<script src=\"{$wgExtensionsPath}/wikia/CorporatePage/js/CorporateSlider.js\" type=\"{$wgJsMimeType}\"></script>");

				// $this->wgSuppressFooter = true;
				$this->wgSuppressArticleCategories = true;
				if (WikiaPageType::isMainPage()) {
					$this->wg->SuppressPageHeader = true;
				} else {
					$this->headerModuleAction = 'Corporate';
				}
			}
		}

		$this->railModulesExist = true;

		// use one column layout for pages with no right rail modules
		if( count($this->railModuleList ) == 0 || !empty($this->wg->SuppressRail) ) {
			OasisController::addBodyClass('oasis-one-column');
			$this->headerModuleParams = array ('showSearchBox' => true);
			$this->railModulesExist = false;
		}

		// determine if WikiaGridLayout needs to be enabled
		$this->isGridLayoutEnabled = self::isGridLayoutEnabled();
		if($this->isGridLayoutEnabled) {
			OasisController::addBodyClass('wikia-grid');
		}

		// if we are on a special search page, pull in the css file and don't render a header
		if($wgTitle && $wgTitle->isSpecial( 'Search' ) && !$this->wg->WikiaSearchIsDefault) {
			$wgOut->addStyle(AssetsManager::getInstance()->getSassCommonURL("skins/oasis/css/modules/SpecialSearch.scss"));
			$this->headerModuleName = null;
			$this->bodytext = F::app()->renderView('Search', "Index'") . $this->bodytext;
		}

		// Inter-wiki search
		if($wgTitle && ($wgTitle->isSpecial( 'WikiaSearch' ) || ($wgTitle->isSpecial( 'Search' ) && $this->wg->WikiaSearchIsDefault ))) {
			$this->headerModuleName = null;
		}

		// load CSS for Special:Preferences
		if (!empty($wgTitle) && $wgTitle->isSpecial('Preferences')) {
			$wgOut->addStyle(AssetsManager::getInstance()->getSassCommonURL('skins/oasis/css/modules/SpecialPreferences.scss'));
		}

		// load CSS for Special:Upload
		if (!empty($wgTitle) && $wgTitle->isSpecial('Upload')) {
			$wgOut->addStyle(AssetsManager::getInstance()->getSassCommonURL('skins/oasis/css/modules/SpecialUpload.scss'));
		}

		// load CSS for Special:Allpages
		if (!empty($wgTitle) && $wgTitle->isSpecial('Allpages')) {
			$wgOut->addStyle(AssetsManager::getInstance()->getSassCommonURL('skins/oasis/css/modules/SpecialAllpages.scss'));
		}

		// Display Control Center Header on certain special pages
		if (!empty($wgEnableAdminDashboardExt) && AdminDashboardLogic::displayAdminDashboard($this->app, $wgTitle)) {
			$this->headerModuleName = null;
			$this->wgSuppressAds = true;
			$this->displayAdminDashboard = true;
			$this->displayAdminDashboardChromedArticle = ($wgTitle->getText() != Title::newFromText("AdminDashboard", NS_SPECIAL)->getText());
		} else {
			$this->displayAdminDashboard = false;
			$this->displayAdminDashboardChromedArticle = false;
		}

		// Forum Extension
		if (!empty($this->wg->EnableForumExt) && !empty($this->wg->IsForum)) {
			$this->wg->SuppressPageHeader = true;
		}

		$namespace = $wgTitle->getNamespace();
		// extra logic for subpages (RT #74091)
		if (!empty($this->subtitle)) {
			switch($namespace) {
				// for user subpages add link to theirs talk pages
				case NS_USER:
					$talkPage = $wgTitle->getTalkPage();

					// get number of revisions for talk page
					$service = new PageStatsService($wgTitle->getArticleId());
					$comments = $service->getCommentsCount();

					// render comments bubble
					$bubble = F::app()->renderView('CommentsLikes', 'Index', array('comments' => $comments, 'bubble' => true));

					$this->subtitle .= ' | ';
					$this->subtitle .= $bubble;
					$this->subtitle .= Wikia::link($talkPage);
					break;

				case NS_USER_TALK:
					$subjectPage = $wgTitle->getSubjectPage();

					$this->subtitle .= ' | ';
					$this->subtitle .= Wikia::link($subjectPage);
					break;
			}
		}

		wfProfileOut(__METHOD__);
	}
コード例 #12
0
 public function executeIndex()
 {
     wfProfileIn(__METHOD__);
     global $wgUser;
     $this->setupPersonalUrls();
     $this->itemsBefore = array();
     $this->isAnon = $wgUser->isAnon();
     $this->username = $wgUser->getName();
     if ($this->isAnon) {
         // facebook connect
         if (!empty($this->personal_urls['fbconnect']['html'])) {
             $this->itemsBefore = array($this->personal_urls['fbconnect']['html']);
         }
         // render Login and Register links
         $this->loginLink = $this->renderPersonalUrl('login');
         $this->registerLink = $this->renderPersonalUrl('register');
         $this->loginDropdown = '';
         $this->loginDropdown = (string) F::app()->sendRequest('UserLoginSpecial', 'dropdown', array('param' => 'paramvalue'));
     } else {
         // render user avatar and link to his user page
         $this->profileLink = AvatarService::getUrl($this->username);
         $this->profileAvatar = AvatarService::renderAvatar($this->username, 20);
         // dropdown items
         $possibleItems = array('mytalk', 'following', 'preferences');
         $dropdownItems = array();
         // Allow hooks to modify the dropdown items.
         wfRunHooks('AccountNavigationModuleAfterDropdownItems', array(&$possibleItems, &$this->personal_urls));
         foreach ($possibleItems as $item) {
             if (isset($this->personal_urls[$item])) {
                 $dropdownItems[] = $this->renderPersonalUrl($item);
             }
         }
         // link to Help:Content (never render as redlink)
         $helpLang = array_key_exists($this->wg->LanguageCode, $this->wg->AvailableHelpLang) ? $this->wg->LanguageCode : 'en';
         $dropdownItems[] = Wikia::link(Title::newFromText(wfMsgExt('helppage', array('parsemag', 'language' => $helpLang))), wfMsg('help'), array('title' => '', 'data-id' => 'help'), '', array('known'));
         // logout link
         $dropdownItems[] = $this->renderPersonalUrl('logout');
         $this->dropdown = $dropdownItems;
     }
     wfProfileOut(__METHOD__);
 }
コード例 #13
0
 /**
  * History page
  */
 public function history()
 {
     $this->getContext()->getOutput()->setPageTitle(wfMessage('lvs-history-page-title')->text());
     // Get the user preference skin, not the current skin of the page
     $skin = F::app()->wg->User->getGlobalPreference('skin');
     // for monobook users, specify wikia skin in querystring
     $queryArr = [];
     if ($skin == "monobook") {
         $queryArr["useskin"] = "wikia";
     }
     $this->getContext()->getOutput()->setSubtitle(Wikia::link(SpecialPage::getTitleFor("LicensedVideoSwap"), wfMessage('lvs-page-header-back-link')->plain(), array('accesskey' => 'c'), $queryArr, 'known'));
     $this->recentChangesLink = Wikia::link(SpecialPage::getTitleFor("RecentChanges"));
     $helper = new LicensedVideoSwapHelper();
     $this->videos = $helper->getUndoList($this->getContext());
 }