当前位置: 首页>>代码示例>>PHP>>正文


PHP Chat::echoCookies方法代码示例

本文整理汇总了PHP中Chat::echoCookies方法的典型用法代码示例。如果您正苦于以下问题:PHP Chat::echoCookies方法的具体用法?PHP Chat::echoCookies怎么用?PHP Chat::echoCookies使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Chat的用法示例。


在下文中一共展示了Chat::echoCookies方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: executeIndex

 public function executeIndex()
 {
     global $wgUser, $wgDevelEnvironment, $wgRequest, $wgCityId, $wgFavicon, $wgOut;
     wfProfileIn(__METHOD__);
     // String replacement logic taken from includes/Skin.php
     $this->wgFavicon = str_replace('images.wikia.com', 'images1.wikia.nocookie.net', $wgFavicon);
     $this->mainPageURL = Title::newMainPage()->getLocalURL();
     // add messages (fetch them using <script> tag)
     F::build('JSMessages')->enqueuePackage('Chat', JSMessages::EXTERNAL);
     // package defined in Chat_setup.php
     $this->jsMessagePackagesUrl = F::build('JSMessages')->getExternalPackagesUrl();
     // Variables for this user
     $this->username = $wgUser->getName();
     $this->avatarUrl = AvatarService::getAvatarUrl($this->username, ChatController::CHAT_AVATAR_DIMENSION);
     // Find the chat for this wiki (or create it, if it isn't there yet).
     $roomName = $roomTopic = "";
     $this->roomId = (int) NodeApiClient::getDefaultRoomId($roomName, $roomTopic);
     $this->roomName = $roomName;
     $this->roomTopic = $roomTopic;
     $this->chatkey = Chat::echoCookies();
     // Set the hostname of the node server that the page will connect to.
     $server = ChatHelper::getServer('Main');
     $this->nodePort = $server['port'];
     $this->nodeHostname = $server['host'];
     // Some building block for URLs that the UI needs.
     $this->pathToProfilePage = Title::makeTitle(!empty($this->wg->EnableWallExt) ? NS_USER_WALL : NS_USER_TALK, '$1')->getFullURL();
     $this->pathToContribsPage = SpecialPage::getTitleFor('Contributions', '$1')->getFullURL();
     $this->bodyClasses = "";
     if ($wgUser->isAllowed('chatmoderator')) {
         $this->isChatMod = 1;
         $this->bodyClasses .= ' chat-mod ';
     } else {
         $this->isChatMod = 0;
     }
     // Adding chatmoderator group for other users. CSS classes added to body tag to hide/show option in menu.
     $userChangeableGroups = $wgUser->changeableGroups();
     if (in_array('chatmoderator', $userChangeableGroups['add'])) {
         $this->bodyClasses .= ' can-give-chat-mod ';
     }
     $this->app->registerHook('MakeGlobalVariablesScript', 'ChatController', 'onMakeGlobalVariablesScript', array(), false, $this);
     $wgOut->getResourceLoader()->getModule('mediawiki');
     $ret = implode("\n", array($wgOut->getHeadLinks(null, true), $wgOut->buildCssLinks(), $wgOut->getHeadScripts(), $wgOut->getHeadItems()));
     $this->globalVariablesScript = $ret;
     //Theme Designer stuff
     $themeSettingObj = new ThemeSettings();
     $themeSettings = $themeSettingObj->getSettings();
     $this->themeSettings = $themeSettings;
     $this->wordmarkThumbnailUrl = '';
     if ($themeSettings['wordmark-type'] == 'graphic') {
         $title = Title::newFromText($themeSettings['wordmark-image-name'], NS_FILE);
         if ($title) {
             $image = wfFindFile($title);
             if ($image) {
                 $this->wordmarkThumbnailUrl = $image->createThumb(self::CHAT_WORDMARK_WIDTH, self::CHAT_WORDMARK_HEIGHT);
             }
         }
         if (empty($this->wordmarkThumbnailUrl)) {
             $this->wordmarkThumbnailUrl = WikiFactory::getLocalEnvURL($themeSettings['wordmark-image-url']);
         }
     }
     wfProfileOut(__METHOD__);
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:62,代码来源:ChatController.class.php

示例2: executeIndex

 public function executeIndex()
 {
     ChatHelper::info(__METHOD__ . ': Method called');
     global $wgUser, $wgFavicon, $wgOut, $wgHooks, $wgSitename;
     wfProfileIn(__METHOD__);
     // String replacement logic taken from includes/Skin.php
     $this->wgFavicon = str_replace('images.wikia.com', 'images1.wikia.nocookie.net', $wgFavicon);
     $this->mainPageURL = Title::newMainPage()->getLocalURL();
     // add messages (fetch them using <script> tag)
     JSMessages::enqueuePackage('Chat', JSMessages::EXTERNAL);
     // package defined in Chat_setup.php
     $this->jsMessagePackagesUrl = JSMessages::getExternalPackagesUrl();
     // Variables for this user
     $this->username = $wgUser->getName();
     $this->avatarUrl = AvatarService::getAvatarUrl($this->username, ChatController::CHAT_AVATAR_DIMENSION);
     // Find the chat for this wiki (or create it, if it isn't there yet).
     $this->roomId = (int) NodeApiClient::getDefaultRoomId();
     // we overwrite here data from redis since it causes a bug DAR-1532
     $this->roomName = $wgSitename;
     $this->roomTopic = wfMsg('chat-default-topic', $wgSitename);
     $this->chatkey = Chat::echoCookies();
     // Set the hostname of the node server that the page will connect to.
     $chathost = ChatHelper::getChatConfig('ChatHost');
     $server = explode(":", $chathost);
     $this->nodeHostname = $server[0];
     $this->nodePort = $server[1];
     $chatmain = ChatHelper::getServer('Main');
     $this->nodeInstance = $chatmain['serverId'];
     // Some building block for URLs that the UI needs.
     $this->pathToProfilePage = Title::makeTitle(!empty($this->wg->EnableWallExt) ? NS_USER_WALL : NS_USER_TALK, '$1')->getFullURL();
     $this->pathToContribsPage = SpecialPage::getTitleFor('Contributions', '$1')->getFullURL();
     $this->bodyClasses = "";
     if ($wgUser->isAllowed('chatmoderator')) {
         $this->isChatMod = 1;
         $this->bodyClasses .= ' chat-mod ';
     } else {
         $this->isChatMod = 0;
     }
     // Adding chatmoderator group for other users. CSS classes added to body tag to hide/show option in menu.
     $userChangeableGroups = $wgUser->changeableGroups();
     if (in_array('chatmoderator', $userChangeableGroups['add'])) {
         $this->bodyClasses .= ' can-give-chat-mod ';
     }
     // set up global js variables just for the chat page
     $wgHooks['MakeGlobalVariablesScript'][] = array($this, 'onMakeGlobalVariablesScript');
     $wgOut->getResourceLoader()->getModule('mediawiki');
     $ret = implode("\n", array($wgOut->getHeadLinks(null, true), $wgOut->buildCssLinks(), $wgOut->getHeadScripts(), $wgOut->getHeadItems()));
     $this->globalVariablesScript = $ret;
     //Theme Designer stuff
     $themeSettingObj = new ThemeSettings();
     $themeSettings = $themeSettingObj->getSettings();
     $this->themeSettings = $themeSettings;
     $this->wordmarkThumbnailUrl = '';
     if ($themeSettings['wordmark-type'] == 'graphic') {
         $title = Title::newFromText($themeSettings['wordmark-image-name'], NS_FILE);
         if ($title) {
             $image = wfFindFile($title);
             if ($image) {
                 $this->wordmarkThumbnailUrl = $image->createThumb(self::CHAT_WORDMARK_WIDTH, self::CHAT_WORDMARK_HEIGHT);
             }
         }
         if (empty($this->wordmarkThumbnailUrl)) {
             $this->wordmarkThumbnailUrl = WikiFactory::getLocalEnvURL($themeSettings['wordmark-image-url']);
         }
     }
     // CONN-436: Invalidate Varnish cache for ChatRail:GetUsers
     ChatRailController::purgeMethod('GetUsers', ['format' => 'json']);
     wfProfileOut(__METHOD__);
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:69,代码来源:ChatController.class.php


注:本文中的Chat::echoCookies方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。