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


PHP XenForo_Helper_Cookie类代码示例

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


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

示例1: getVisitor

 public static function getVisitor(XenForo_Visitor &$visitor)
 {
     if (class_exists('Sedo_DetectBrowser_Listener_Visitor') && isset($visitor->getBrowser['isMobile'])) {
         //External Addon
         $isMobile = $visitor->getBrowser['isMobile'];
         $isTablet = $visitor->getBrowser['isTablet'];
     } else {
         //XenForo
         $isMobile = XenForo_Visitor::isBrowsingWith('mobile');
         $isTablet = '';
     }
     if (!empty($isMobile)) {
         $options = XenForo_Application::get('options');
         $mobileStyle = $options->sedoDefaultMobileStyle;
         if (!empty($isTablet)) {
             $mobileStyle = $options->sedoDefaultTabletStyle;
         }
         if (!empty($visitor['user_id'])) {
             //Only for members => guests use the default style option (unless they have choosen to use another style =>cookie: style_id)
             XenForo_Helper_Cookie::deleteCookie('style_id');
             //case: visitor changed the default style, then log
             $getCookie = XenForo_Helper_Cookie::getCookie('mobile_style_id');
             // the mobile_style_id is set here: Sedo_MobileStyleSelector_ControllerPublic_Misc
             if ($getCookie == false) {
                 //No cookie => continue to force mobile style
                 $visitor['style_id'] = $mobileStyle;
             }
         }
         //Force style
         if ($options->sedoForceMobileStyle && $visitor->style_id != $mobileStyle) {
             $visitor['style_id'] = $mobileStyle;
         }
     }
 }
开发者ID:Sywooch,项目名称:forums,代码行数:34,代码来源:Visitor.php

示例2: Diktat

 public static function Diktat(XenForo_Controller $controller, $action)
 {
     $visitor = XenForo_Visitor::getInstance();
     if (class_exists('Sedo_DetectBrowser_Listener_Visitor') && isset($visitor->getBrowser['isMobile'])) {
         //External Addon
         $isMobile = $visitor->getBrowser['isMobile'];
         $isTablet = $visitor->getBrowser['isTablet'];
     } else {
         //XenForo
         $isMobile = XenForo_Visitor::isBrowsingWith('mobile');
         $isTablet = '';
     }
     if (!empty($isMobile)) {
         $options = XenForo_Application::get('options');
         $mobileStyle = $options->sedoDefaultMobileStyle;
         //$visitor->style_id = $mobileStyle;
         if (!empty($isTablet)) {
             $mobileStyle = $options->sedoDefaultTabletStyle;
         }
         $options->defaultStyleId = $mobileStyle;
         if ($options->sedoForceMobileStyle && $visitor->style_id != $mobileStyle) {
             //Should not be needed
             XenForo_Helper_Cookie::setCookie('style_id', $mobileStyle, 86400 * 365);
         }
     }
 }
开发者ID:Sywooch,项目名称:forums,代码行数:26,代码来源:ControllerPreDispatch.php

示例3: actionLanguage

 /**
  * Displays a form to change the visitor's language, or changes it if a language_id is present.
  *
  * @return XenForo_ControllerResponse_Abstract
  */
 public function actionLanguage()
 {
     $visitor = XenForo_Visitor::getInstance();
     if ($this->_input->inRequest('language_id')) {
         $this->_checkCsrfFromToken($this->_input->filterSingle('_xfToken', XenForo_Input::STRING));
         $languageId = $this->_input->filterSingle('language_id', XenForo_Input::UINT);
         if ($languageId) {
             $languages = XenForo_Application::isRegistered('languages') ? XenForo_Application::get('languages') : XenForo_Model::create('XenForo_Model_Language')->getAllLanguagesForCache();
             if (!isset($languages[$languageId])) {
                 $languageId = 0;
             }
         }
         if ($visitor['user_id']) {
             $dw = XenForo_DataWriter::create('XenForo_DataWriter_User');
             $dw->setExistingData($visitor['user_id']);
             $dw->set('language_id', $languageId);
             $dw->save();
             XenForo_Helper_Cookie::deleteCookie('language_id');
         } else {
             XenForo_Helper_Cookie::setCookie('language_id', $languageId, 86400 * 365);
         }
         return $this->responseRedirect(XenForo_ControllerResponse_Redirect::SUCCESS, $this->getDynamicRedirect(false, false));
     } else {
         $languages = XenForo_Application::isRegistered('languages') ? XenForo_Application::get('languages') : XenForo_Model::create('XenForo_Model_Language')->getAllLanguagesForCache();
         $viewParams = array('languages' => $this->getModelFromCache('XenForo_Model_Language')->getAllLanguages(), 'redirect' => $this->getDynamicRedirect(false, false));
         return $this->responseView('XenForo_ViewPublic_Misc_Language', 'language_chooser', $viewParams);
     }
 }
开发者ID:darkearl,项目名称:projectT122015,代码行数:33,代码来源:Misc.php

示例4: actionIndex

 /**
  * Single-stage logout procedure
  */
 public function actionIndex()
 {
     $csrfToken = $this->_input->filterSingle('_xfToken', XenForo_Input::STRING);
     $redirectResponse = $this->responseRedirect(XenForo_ControllerResponse_Redirect::SUCCESS, $this->getDynamicRedirect(false, false));
     $userId = XenForo_Visitor::getUserId();
     if (!$userId) {
         return $redirectResponse;
     }
     if ($this->_noRedirect() || !$csrfToken) {
         // request is likely from JSON, probably XenForo.OverlayTrigger, so show a confirmation dialog
         return $this->responseView('XenForo_ViewPublic_LogOut', 'log_out');
     } else {
         $this->_checkCsrfFromToken($csrfToken);
         // remove an admin session if we're logged in as the same person
         if (XenForo_Visitor::getInstance()->get('is_admin')) {
             $class = XenForo_Application::resolveDynamicClass('XenForo_Session');
             $adminSession = new $class(array('admin' => true));
             $adminSession->start();
             if ($adminSession->get('user_id') == $userId) {
                 $adminSession->delete();
             }
         }
         $this->getModelFromCache('XenForo_Model_Session')->processLastActivityUpdateForLogOut(XenForo_Visitor::getUserId());
         XenForo_Application::get('session')->delete();
         XenForo_Helper_Cookie::deleteAllCookies($this->_getRetainedCookies(), array('user' => array('httpOnly' => false)));
         XenForo_Visitor::setup(0);
         return $redirectResponse;
     }
 }
开发者ID:darkearl,项目名称:projectT122015,代码行数:32,代码来源:Logout.php

示例5: _preSave

 protected function _preSave()
 {
     parent::_preSave();
     $code = $this->get('affiliate_code');
     if (empty($code)) {
         $this->setAffiliateCode();
     }
     if ($this->isInsert()) {
         $invitationModel = $this->_getInvitationModel();
         $cookieVal = XenForo_Helper_Cookie::getCookie('ref');
         if ($cookieVal) {
             $cookieParts = explode('_', $cookieVal);
             if (isset($cookieParts[1])) {
                 $ref = $cookieParts[1];
                 $invitation = false;
                 if ($cookieParts[0] == 'u') {
                     $invitation = $invitationModel->getUserByCode($ref);
                 } else {
                     if ($cookieParts[0] == 'i') {
                         $invitation = $invitationModel->getInvitationByCode($ref);
                     }
                 }
                 if ($invitation) {
                     if ($cookieParts[0] == 'i') {
                         self::$_invitationId = $invitation['invite_id'];
                     }
                     $this->set('ref_user_id', $invitation['user_id']);
                 }
             }
         }
     }
 }
开发者ID:ThemeHouse-XF,项目名称:Affiliate,代码行数:32,代码来源:User.php

示例6: getBlocks

 public function getBlocks($getCookies = false, $layout1 = false, $layout2 = false, $layout3 = false)
 {
     if ($layout1) {
         if ($layout1 && ($layout = $this->getModelFromCache('EWRporta_Model_Layouts')->getLayoutById($layout1)) || $layout2 && ($layout = $this->getModelFromCache('EWRporta_Model_Layouts')->getLayoutById($layout2)) || $layout3 && ($layout = $this->getModelFromCache('EWRporta_Model_Layouts')->getLayoutById($layout3))) {
             $layout = unserialize($layout['blocks']);
         } elseif ($layout1 != 'portal') {
             return array();
         }
     }
     $blocks = $this->fetchAllKeyed("\n\t\t\tSELECT *, 'disabled' AS position\n\t\t\t\tFROM EWRporta_blocks\n\t\t\tWHERE active = 1\n\t\t\tORDER BY block_id ASC\n\t\t", 'block_id');
     if (!empty($layout)) {
         $_blocks = array();
         foreach ($layout as $key => $position) {
             if (!empty($blocks[$key])) {
                 $_blocks[$key] = array('position' => $position) + $blocks[$key];
             }
         }
         $blocks = $_blocks + $blocks;
     }
     if ($getCookies && ($cookies = XenForo_Helper_Cookie::getCookie('EWRporta'))) {
         $_blocks = array();
         foreach ($cookies as $key => $cookie) {
             if (!empty($blocks[$key]) && !empty($cookie['position'])) {
                 $position = $blocks[$key]['locked'] ? $blocks[$key]['position'] : $cookie['position'];
                 $_blocks[$key] = array('position' => $position) + $blocks[$key];
             }
         }
         $blocks = $_blocks + $blocks;
     }
     return $blocks;
 }
开发者ID:Sywooch,项目名称:forums,代码行数:31,代码来源:Blocks.php

示例7: save

 protected function save($prefs)
 {
     if ($this->userId > 0) {
         $_db = $_db = XenForo_Application::getDb();
         $_db->query("INSERT INTO geek_listings_prefs ( pref_user_id, pref_type_id, pref_cat, pref_subcat, pref_location, pref_lat, pref_lng, pref_alert_on_new, pref_email_on_new, pref_last_check, pref_last_alert, pref_last_email, pref_city, pref_country)\n                                VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, 0, 0, 0, ?, ?  ) ON DUPLICATE KEY UPDATE\n                                pref_type_id=VALUES(pref_type_id),pref_cat=VALUES(pref_cat), pref_subcat=VALUES(pref_subcat), pref_location=VALUES(pref_location), pref_lat=VALUES(pref_lat), pref_lng=VALUES(pref_lng), pref_alert_on_new=VALUES(pref_alert_on_new), pref_email_on_new=VALUES(pref_email_on_new), pref_city=VALUES(pref_city), pref_country=VALUES(pref_country) ", [$this->userId, $this->typeId, $this->cat, $this->subcat, $this->location, $this->lat, $this->lng, $this->alert_on_new, $this->email_on_new, $this->city, $this->country]);
     }
     XenForo_Helper_Cookie::setCookie('GeekListing_prefs_' . $this->typeId, serialize($prefs));
 }
开发者ID:samuelsweet,项目名称:xf,代码行数:8,代码来源:Prefs.php

示例8: deletePost

 public function deletePost($postID)
 {
     if (!($post = $this->getModelFromCache('XenForo_Model_Post')->getPostById($postID))) {
         return false;
     }
     $this->getModelFromCache('XenForo_Model_Post')->deletePost($post['post_id'], 'hard');
     XenForo_Helper_Cookie::clearIdFromCookie($post['post_id'], 'inlinemod_posts');
     return true;
 }
开发者ID:Sywooch,项目名称:forums,代码行数:9,代码来源:Threads.php

示例9: getStyleIdFromCookie

 /**
  * Fetches $styleId from cookie if it's available, or returns the default style ID.
  *
  * @param int $allowMaster If true, allow the master style to be returned
  *
  * @return integer
  */
 public function getStyleIdFromCookie($allowMaster = true)
 {
     $styleId = XenForo_Helper_Cookie::getCookie('edit_style_id');
     if ($styleId === false) {
         $styleId = XenForo_Application::debugMode() ? 0 : XenForo_Application::get('options')->defaultStyleId;
     }
     if ((!$allowMaster || !XenForo_Application::debugMode()) && !$styleId) {
         $styleId = XenForo_Application::get('options')->defaultStyleId;
     }
     return $styleId;
 }
开发者ID:VoDongMy,项目名称:xenforo-laravel5.1,代码行数:18,代码来源:Style.php

示例10: actionIndex

 public function actionIndex()
 {
     $class = $this->_input->filterSingle('class', XenForo_Input::STRING);
     if ($class) {
         return $this->responseReroute(__CLASS__, 'view');
     }
     $addOns = $this->_getAddOnModel()->getAllAddOns();
     $xenOptions = XenForo_Application::get('options');
     $addOnSelected = '';
     if ($xenOptions->th_dataWriters_enableAddOnChooser) {
         $addOnId = $this->_input->filterSingle('addon_id', XenForo_Input::STRING);
         if (!empty($GLOBALS['ThemeHouse_DataWriters_Route_PrefixAdmin_DataWriters']) && !$addOnId) {
             $addOnId = XenForo_Helper_Cookie::getCookie('edit_addon_id');
         }
         if ($addOnId && !empty($addOns[$addOnId])) {
             XenForo_Helper_Cookie::setCookie('edit_addon_id', $addOnId);
             $addOn = $addOns[$addOnId];
             $addOnSelected = $addOnId;
             $this->canonicalizeRequestUrl(XenForo_Link::buildAdminLink('add-ons/data-writers', $addOn));
         } else {
             $this->canonicalizeRequestUrl(XenForo_Link::buildAdminLink('add-ons/data-writers'));
             XenForo_Helper_Cookie::deleteCookie('edit_addon_id');
         }
     }
     $addOns['XenForo'] = array('addon_id' => 'XenForo', 'active' => true, 'title' => 'XenForo');
     $rootPath = XenForo_Autoloader::getInstance()->getRootDir();
     $dataWriters = array();
     $dataWriterCount = 0;
     $totalDataWriters = 0;
     foreach ($addOns as $addOnId => $addOn) {
         $dataWriterPath = $rootPath . DIRECTORY_SEPARATOR . str_replace('_', DIRECTORY_SEPARATOR, $addOnId) . DIRECTORY_SEPARATOR . 'DataWriter';
         if (!file_exists($dataWriterPath)) {
             continue;
         }
         $directory = new RecursiveDirectoryIterator($dataWriterPath);
         $iterator = new RecursiveIteratorIterator($directory);
         $regex = new RegexIterator($iterator, '/^.+\\.php$/i', RecursiveRegexIterator::GET_MATCH);
         foreach ($regex as $fileinfo) {
             $classPath = str_replace($rootPath, '', $fileinfo[0]);
             $classPath = pathinfo($classPath, PATHINFO_DIRNAME) . DIRECTORY_SEPARATOR . pathinfo($classPath, PATHINFO_FILENAME);
             $dirs = explode(DIRECTORY_SEPARATOR, $classPath);
             $dirs = array_filter($dirs);
             $className = implode('_', $dirs);
             if (!$xenOptions->th_dataWriters_enableAddOnChooser || !$addOnSelected || $addOnId == $addOnSelected) {
                 $dataWriters[$addOnId][$className] = array('class' => $className, 'filename' => pathinfo($classPath, PATHINFO_FILENAME));
                 $dataWriterCount++;
             }
             $totalDataWriters++;
         }
     }
     unset($addOns['XenForo']);
     $viewParams = array('addOns' => $addOns, 'addOnSelected' => $addOnSelected, 'dataWriters' => $dataWriters, 'dataWriterCount' => $dataWriterCount, 'totalDataWriters' => $totalDataWriters);
     return $this->responseView('ThemeHouse_DataWriters_ViewAdmin_DataWriter_List', 'th_datawriter_list_datawriters', $viewParams);
 }
开发者ID:ThemeHouse-XF,项目名称:DataWriters,代码行数:54,代码来源:DataWriter.php

示例11: _deleteContent

 protected function _deleteContent(array $content, $reason, array $viewingUser)
 {
     $dw = XenForo_DataWriter::create('XenForo_DataWriter_DiscussionMessage_ProfilePost', XenForo_DataWriter::ERROR_SILENT);
     if ($dw->setExistingData($content)) {
         $dw->setExtraData(XenForo_DataWriter_DiscussionMessage::DATA_DELETE_REASON, $reason);
         $dw->set('message_state', 'deleted');
         $dw->save();
     }
     XenForo_Model_Log::logModeratorAction('profile_post', $content, 'delete_soft', array('reason' => $reason), $this->_getProfilePostModel()->getProfileUserFromProfilePost($content));
     XenForo_Helper_Cookie::clearIdFromCookie($content['profile_post_id'], 'inlinemod_profilePosts');
 }
开发者ID:Sywooch,项目名称:forums,代码行数:11,代码来源:ProfilePost.php

示例12: _getStyleIdFromCookie

 /**
  * Fetches $styleId from cookie if it's available, or returns the default style ID.
  *
  * @return integer
  */
 protected function _getStyleIdFromCookie()
 {
     $styleId = XenForo_Helper_Cookie::getCookie('edit_style_id');
     if ($styleId === false) {
         $styleId = XenForo_Application::debugMode() ? 0 : XenForo_Application::get('options')->defaultStyleId;
     }
     if (!XenForo_Application::debugMode() && !$styleId) {
         $styleId = XenForo_Application::get('options')->defaultStyleId;
     }
     return $styleId;
 }
开发者ID:hahuunguyen,项目名称:DTUI_201105,代码行数:16,代码来源:StyleAbstract.php

示例13: actionAdsenseAuth

 public function actionAdsenseAuth()
 {
     $this->_assertPostOnly();
     $input = $this->_input->filter(array('username' => XenForo_Input::STRING, 'password' => XenForo_Input::STRING));
     if ($input['password'] == XenForo_Application::getOptions()->dppa_adsense_password && $input['username'] == 'true') {
         XenForo_Helper_Cookie::setCookie('as_username', 'google_adsense', XenForo_Application::$time + 7776000);
         // 90 day cookie
         XenForo_Helper_Cookie::setCookie('as_password', XenForo_Application::getOptions()->dppa_adsense_password, XenForo_Application::$time + 7776000);
         echo 'Authentication successful.';
     } else {
         echo 'Authentication failed.';
     }
     exit;
 }
开发者ID:Sywooch,项目名称:forums,代码行数:14,代码来源:Misc.php

示例14: actionSave

 /**
  *
  * @see XenForo_ControllerAdmin_Phrase::actionSave()
  */
 public function actionSave()
 {
     $response = parent::actionSave();
     if ($response instanceof XenForo_ControllerResponse_Redirect) {
         $addOnId = $this->_input->filterSingle('addon_id', XenForo_Input::STRING);
         if ($addOnId) {
             XenForo_Helper_Cookie::setCookie('edit_addon_id', $addOnId);
         }
         $redirect = $this->_input->filterSingle('redirect', XenForo_Input::STRING);
         if ($redirect) {
             $response->redirectTarget = $redirect;
         }
     }
     return $response;
 }
开发者ID:ThemeHouse-XF,项目名称:Phrases,代码行数:19,代码来源:Phrase.php

示例15: getContentSort

 public static function getContentSort(&$order, &$orderDirection, &$defaultOrder = null, &$defaultOrderDirection = null)
 {
     $xenOptions = XenForo_Application::getOptions();
     $defaultOrder = $xenOptions->sonnbXG_sortPhoto;
     switch ($defaultOrder) {
         case 'content_updated_date':
         case 'content_date':
         case 'comment_count':
         case 'view_count':
         case 'likes':
         case 'recently_liked':
             $defaultOrderDirection = 'desc';
             break;
         case 'position':
         default:
             $defaultOrder = 'position';
             $defaultOrderDirection = 'asc';
             break;
     }
     $orderCookie = XenForo_Helper_Cookie::getCookie('sonnbXG_content_order');
     if (empty($order)) {
         if ($orderCookie === false) {
             $order = $defaultOrder;
             XenForo_Helper_Cookie::setCookie('sonnbXG_content_order', $order);
         } else {
             $order = $orderCookie;
         }
     } elseif ($orderCookie !== $order) {
         XenForo_Helper_Cookie::setCookie('sonnbXG_content_order', $order);
     }
     switch ($order) {
         case 'content_updated_date':
         case 'content_date':
         case 'comment_count':
         case 'view_count':
         case 'likes':
         case 'recently_liked':
             $defaultOrderDirection = 'desc';
             break;
         case 'position':
         default:
             $defaultOrderDirection = 'asc';
             break;
     }
     if (empty($orderDirection)) {
         $orderDirection = $defaultOrderDirection;
     }
 }
开发者ID:Sywooch,项目名称:forums,代码行数:48,代码来源:Helper.php


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