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


PHP Mage_Core_Model_Session_Abstract类代码示例

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


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

示例1: testSessionSaveMethod

 /**
  * @param string $saveMethod
  * @param string $iniValue
  * @dataProvider sessionSaveMethodDataProvider
  */
 public function testSessionSaveMethod($saveMethod, $iniValue)
 {
     $this->markTestIncomplete('Bug MAGE-5487');
     // depending on configuration some values cannot be set as default save session handlers.
     // in such cases warnings will be generated by php and test will fail
     $origErrorRep = error_reporting(E_ALL ^ E_WARNING);
     $origSessionHandler = ini_set('session.save_handler', $iniValue);
     if ($iniValue && ini_get('session.save_handler') != $iniValue) {
         ini_set('session.save_handler', $origSessionHandler);
         error_reporting($origErrorRep);
         $this->markTestSkipped("Can't  set '{$iniValue}' as session save handler");
     }
     ini_set('session.save_handler', $origSessionHandler);
     Mage::getConfig()->setNode(Mage_Core_Model_Session_Abstract::XML_NODE_SESSION_SAVE, $saveMethod);
     /**
      * @var Mage_Core_Model_Session_Abstract_Varien
      */
     $model = new Mage_Core_Model_Session_Abstract();
     //There is no any possibility to determine whether session already started or not in php before 5.4
     $model->setSkipEmptySessionCheck(true);
     $model->start();
     if ($iniValue) {
         $this->assertEquals(ini_get('session.save_handler'), $iniValue);
     }
     ini_set('session.save_handler', $origSessionHandler);
     error_reporting($origErrorRep);
 }
开发者ID:nemphys,项目名称:magento2,代码行数:32,代码来源:VarienTest.php

示例2: removeVisitorFromWebsiteSegments

 /**
  * Remove visitor-segment relation for specified website
  *
  * @param Mage_Core_Model_Session_Abstract $visitorSession
  * @param int $websiteId
  * @param array $segmentIds
  * @return Enterprise_CustomerSegment_Model_Customer
  */
 public function removeVisitorFromWebsiteSegments($visitorSession, $websiteId, $segmentIds)
 {
     $visitorCustomerSegmentIds = $visitorSession->getCustomerSegmentIds();
     if (!is_array($visitorCustomerSegmentIds)) {
         $visitorCustomerSegmentIds = array();
     }
     if (isset($visitorCustomerSegmentIds[$websiteId]) && is_array($visitorCustomerSegmentIds[$websiteId])) {
         $segmentsIdsForWebsite = $visitorCustomerSegmentIds[$websiteId];
         if (!empty($segmentIds)) {
             $segmentsIdsForWebsite = array_diff($segmentsIdsForWebsite, $segmentIds);
         }
         $visitorCustomerSegmentIds[$websiteId] = $segmentsIdsForWebsite;
     }
     $visitorSession->setCustomerSegmentIds($visitorCustomerSegmentIds);
     return $this;
 }
开发者ID:barneydesmond,项目名称:propitious-octo-tribble,代码行数:24,代码来源:Customer.php

示例3: in_array

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
require 'app/Mage.php';
Mage::app();
$test = in_array('--test', $argv);
$coreSession = new Mage_Core_Model_Session_Abstract();
$redisSession = new Cm_RedisSession_Model_Session();
$sessionPath = $coreSession->getSessionSavePath();
if (!is_readable($sessionPath) || !($dir = opendir($sessionPath))) {
    die("The session save path is not readable: {$sessionPath}\n");
}
if (!$redisSession->hasConnection()) {
    die("Could not connect to redis server, please check your configuration.\n");
}
$sessionLifetime = max(Mage::getStoreConfig('admin/security/session_cookie_lifetime'), Mage::getStoreConfig('web/cookie/cookie_lifetime'), 3600);
if (!in_array('-y', $argv)) {
    $redisConfig = Mage::getConfig()->getNode('global/redis_session');
    $redisConnection = $redisConfig->descend('host') . ':' . $redisConfig->descend('port') . '/' . $redisConfig->descend('db');
    $input = readline("Migrate sessions from {$sessionPath} to {$redisConnection} with {$sessionLifetime} second lifetime? (y|n) ");
    if ($input != 'y') {
        die("Aborted.\n");
开发者ID:joanhe,项目名称:Cm_RedisSession,代码行数:30,代码来源:migrateSessions.php

示例4: regenerate

 /**
  * {@inheritDoc}
  */
 public function regenerate($destroy = false)
 {
     if (self::$sessionIdRegenerated) {
         return;
     }
     $this->session->regenerateSessionId();
     self::$sessionIdRegenerated = true;
 }
开发者ID:Giant-Peach-Design,项目名称:LiipMagentoBundle,代码行数:11,代码来源:MagentoSessionStorage.php

示例5: getCustomerId

 /**
  * Try to get the id of the customer
  * 
  * @return int|null
  */
 public function getCustomerId()
 {
     if (class_exists('Mage')) {
         return Mage::getSingleton('customer/session')->getCustomer()->getId();
     }
     return parent::getCustomerId();
 }
开发者ID:kirchbergerknorr,项目名称:netresearch_buergel,代码行数:12,代码来源:Session.php

示例6: setSessionId

 public function setSessionId($id = null)
 {
     if (!empty($this->_sid)) {
         $id = $this->_sid;
     }
     return parent::setSessionId($id);
 }
开发者ID:CE-Webmaster,项目名称:CE-Hub,代码行数:7,代码来源:Session.php

示例7: setPostCommentData

 /**
  * Stores a post's comment data in the session in case of error
  *
  * @param Fishpig_Wordpress_Model_Post $post
  * @param string $author
  * @param string $email 
  * @param string $url
  * @param string $comment
  */
 public function setPostCommentData($post, $author, $email, $url, $comment)
 {
     if (is_object($post)) {
         $token = 'post_comment_data_' . $post->getId();
         $data = new Varien_Object(array('author' => $author, 'email' => $email, 'url' => $url, 'comment' => $comment));
         return parent::setData($token, $data);
     }
 }
开发者ID:LiamMcArthur,项目名称:extension-fishpig-wordpress-integration,代码行数:17,代码来源:Session.php

示例8: unsetAll

 /**
  * Unset all data associated with object
  */
 public function unsetAll()
 {
     parent::unsetAll();
     $this->_quoteId = null;
     $this->_response = null;
     $this->_redirectMessage = null;
     $this->_redirectTitle = null;
 }
开发者ID:Man4x,项目名称:Mageho_Atos,代码行数:11,代码来源:Session.php

示例9: addMessage

 public function addMessage(Mage_Core_Model_Message_Abstract $message)
 {
     $message->setIdentifier(uniqid() . '|' . $this->_now);
     return parent::addMessage($message);
 }
开发者ID:buttasg,项目名称:cowgirlk,代码行数:5,代码来源:Session.php

示例10: getEncryptedSessionId

 /**
  * Get ecrypted session identifuer
  * No reason use crypt key for session id encryption
  * we can use session identifier as is
  *
  * @return string
  */
 public function getEncryptedSessionId()
 {
     if (!self::$_encryptedSessionId) {
         //            $helper = Mage::helper('Mage_Core_Helper_Data');
         //            if (!$helper) {
         //                return $this;
         //            }
         //            self::$_encryptedSessionId = $helper->encrypt($this->getSessionId());
         self::$_encryptedSessionId = $this->getSessionId();
     }
     return self::$_encryptedSessionId;
 }
开发者ID:relue,项目名称:magento2,代码行数:19,代码来源:Abstract.php

示例11: testGetSessionSavePath

 public function testGetSessionSavePath()
 {
     $this->assertEquals(Mage::getBaseDir('session'), $this->_model->getSessionSavePath());
 }
开发者ID:nemphys,项目名称:magento2,代码行数:4,代码来源:AbstractTest.php

示例12: __construct

 /**
  * Class constructor. Initialize Rede ClickPag session namespace
  */
 public function __construct()
 {
     parent::__construct();
     $this->init('rede_clickpag');
 }
开发者ID:marcoescudeiro,项目名称:clickpag-magento,代码行数:8,代码来源:Session.php

示例13: unsetAll

 /**
  * Unset all data associated with object
  */
 public function unsetAll()
 {
     parent::unsetAll();
     $this->_quote = null;
 }
开发者ID:vberzsin,项目名称:shop,代码行数:8,代码来源:Session.php

示例14: getEncryptedSessionId

 /**
  * Get encrypted session identifier.
  * No reason use crypt key for session id encryption, we can use session identifier as is.
  *
  * @return string
  */
 public function getEncryptedSessionId()
 {
     if (!self::$_encryptedSessionId) {
         self::$_encryptedSessionId = $this->getSessionId();
     }
     return self::$_encryptedSessionId;
 }
开发者ID:cewolf2002,项目名称:magento,代码行数:13,代码来源:Abstract.php

示例15: renewSession

 /**
  * Reset core session hosts after reseting session ID
  *
  * @return Mage_Customer_Model_Session
  */
 public function renewSession()
 {
     parent::renewSession();
     $this->_cleanHosts();
     return $this;
 }
开发者ID:natxetee,项目名称:magento2,代码行数:11,代码来源:Session.php


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