本文整理汇总了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);
}
示例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;
}
示例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");
示例4: regenerate
/**
* {@inheritDoc}
*/
public function regenerate($destroy = false)
{
if (self::$sessionIdRegenerated) {
return;
}
$this->session->regenerateSessionId();
self::$sessionIdRegenerated = true;
}
示例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();
}
示例6: setSessionId
public function setSessionId($id = null)
{
if (!empty($this->_sid)) {
$id = $this->_sid;
}
return parent::setSessionId($id);
}
示例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);
}
}
示例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;
}
示例9: addMessage
public function addMessage(Mage_Core_Model_Message_Abstract $message)
{
$message->setIdentifier(uniqid() . '|' . $this->_now);
return parent::addMessage($message);
}
示例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;
}
示例11: testGetSessionSavePath
public function testGetSessionSavePath()
{
$this->assertEquals(Mage::getBaseDir('session'), $this->_model->getSessionSavePath());
}
示例12: __construct
/**
* Class constructor. Initialize Rede ClickPag session namespace
*/
public function __construct()
{
parent::__construct();
$this->init('rede_clickpag');
}
示例13: unsetAll
/**
* Unset all data associated with object
*/
public function unsetAll()
{
parent::unsetAll();
$this->_quote = null;
}
示例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;
}
示例15: renewSession
/**
* Reset core session hosts after reseting session ID
*
* @return Mage_Customer_Model_Session
*/
public function renewSession()
{
parent::renewSession();
$this->_cleanHosts();
return $this;
}