Overview

Packages

  • currencysymbol
  • MAbout
  • Mage
    • Admin
    • Adminhtml
    • AdminNotification
    • Api
    • Api2
    • Authorizenet
    • Backup
    • Bundle
    • Captcha
    • Catalog
    • CatalogIndex
    • CatalogInventory
    • CatalogRule
    • CatalogSearch
    • Centinel
    • Checkout
    • Cms
    • Compiler
    • Connect
    • Contacts
    • Core
    • Cron
    • CurrencySymbol
    • Customer
    • Dataflow
    • Directory
    • DirtectPost
    • Downloadable
    • Eav
    • GiftMessage
    • GoogleAnalytics
    • GoogleBase
    • GoogleCheckout
    • ImportExport
    • Index
    • Install
    • Log
    • Media
    • Newsletter
    • Oauth
    • Page
    • PageCache
    • Paygate
    • Payment
    • Paypal
    • PaypalUk
    • Persistent
    • Poll
    • ProductAlert
    • Rating
    • Reports
    • Review
    • Rss
    • Rule
    • Sales
    • SalesRule
    • Sedfriend
    • Sendfriend
    • Shipping
    • Sitemap
    • Tag
    • Tax
    • Usa
    • Weee
    • Widget
    • Wishlist
    • XmlConnect
  • None
  • Phoenix
    • Moneybookers
  • PHP
  • Zend
    • Date
    • Mime
    • XmlRpc

Classes

  • Mage_Persistent_Block_Form_Remember
  • Mage_Persistent_Block_Header_Additional
  • Mage_Persistent_Helper_Data
  • Mage_Persistent_Helper_Session
  • Mage_Persistent_IndexController
  • Mage_Persistent_Model_Observer
  • Mage_Persistent_Model_Observer_Session
  • Mage_Persistent_Model_Persistent_Config
  • Mage_Persistent_Model_Resource_Session
  • Mage_Persistent_Model_Session
  • Overview
  • Package
  • Class
  • Tree
  1: <?php
  2: /**
  3:  * Magento
  4:  *
  5:  * NOTICE OF LICENSE
  6:  *
  7:  * This source file is subject to the Open Software License (OSL 3.0)
  8:  * that is bundled with this package in the file LICENSE.txt.
  9:  * It is also available through the world-wide-web at this URL:
 10:  * http://opensource.org/licenses/osl-3.0.php
 11:  * If you did not receive a copy of the license and are unable to
 12:  * obtain it through the world-wide-web, please send an email
 13:  * to license@magentocommerce.com so we can send you a copy immediately.
 14:  *
 15:  * DISCLAIMER
 16:  *
 17:  * Do not edit or add to this file if you wish to upgrade Magento to newer
 18:  * versions in the future. If you wish to customize Magento for your
 19:  * needs please refer to http://www.magentocommerce.com for more information.
 20:  *
 21:  * @category    Mage
 22:  * @package     Mage_Persistent
 23:  * @copyright   Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
 24:  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 25:  */
 26: 
 27: 
 28: /**
 29:  * Persistent Shopping Cart Data Helper
 30:  *
 31:  * @category   Mage
 32:  * @package    Mage_Persistent
 33:  * @author     Magento Core Team <core@magentocommerce.com>
 34:  */
 35: class Mage_Persistent_Helper_Data extends Mage_Core_Helper_Data
 36: {
 37:     const XML_PATH_ENABLED = 'persistent/options/enabled';
 38:     const XML_PATH_LIFE_TIME = 'persistent/options/lifetime';
 39:     const XML_PATH_LOGOUT_CLEAR = 'persistent/options/logout_clear';
 40:     const XML_PATH_REMEMBER_ME_ENABLED = 'persistent/options/remember_enabled';
 41:     const XML_PATH_REMEMBER_ME_DEFAULT = 'persistent/options/remember_default';
 42:     const XML_PATH_PERSIST_SHOPPING_CART = 'persistent/options/shopping_cart';
 43: 
 44:     const LOGGED_IN_LAYOUT_HANDLE = 'customer_logged_in_psc_handle';
 45:     const LOGGED_OUT_LAYOUT_HANDLE = 'customer_logged_out_psc_handle';
 46: 
 47:     /**
 48:      * Name of config file
 49:      *
 50:      * @var string
 51:      */
 52:     protected $_configFileName = 'persistent.xml';
 53: 
 54:     /**
 55:      * Checks whether Persistence Functionality is enabled
 56:      *
 57:      * @param int|string|Mage_Core_Model_Store $store
 58:      * @return bool
 59:      */
 60:     public function isEnabled($store = null)
 61:     {
 62:         return Mage::getStoreConfigFlag(self::XML_PATH_ENABLED, $store);
 63:     }
 64: 
 65:     /**
 66:      * Checks whether "Remember Me" enabled
 67:      *
 68:      * @param int|string|Mage_Core_Model_Store $store
 69:      * @return bool
 70:      */
 71:     public function isRememberMeEnabled($store = null)
 72:     {
 73:         return Mage::getStoreConfigFlag(self::XML_PATH_REMEMBER_ME_ENABLED, $store);
 74:     }
 75: 
 76:     /**
 77:      * Is "Remember Me" checked by default
 78:      *
 79:      * @param int|string|Mage_Core_Model_Store $store
 80:      * @return bool
 81:      */
 82:     public function isRememberMeCheckedDefault($store = null)
 83:     {
 84:         return Mage::getStoreConfigFlag(self::XML_PATH_REMEMBER_ME_DEFAULT, $store);
 85:     }
 86: 
 87:     /**
 88:      * Is shopping cart persist
 89:      *
 90:      * @param int|string|Mage_Core_Model_Store $store
 91:      * @return bool
 92:      */
 93:     public function isShoppingCartPersist($store = null)
 94:     {
 95:         return Mage::getStoreConfigFlag(self::XML_PATH_PERSIST_SHOPPING_CART, $store);
 96:     }
 97: 
 98:     /**
 99:      * Get Persistence Lifetime
100:      *
101:      * @param int|string|Mage_Core_Model_Store $store
102:      * @return int
103:      */
104:     public function getLifeTime($store = null)
105:     {
106:         $lifeTime = intval(Mage::getStoreConfig(self::XML_PATH_LIFE_TIME, $store));
107:         return ($lifeTime < 0) ? 0 : $lifeTime;
108:     }
109: 
110:     /**
111:      * Check if set `Clear on Logout` in config settings
112:      *
113:      * @return bool
114:      */
115:     public function getClearOnLogout()
116:     {
117:         return Mage::getStoreConfigFlag(self::XML_PATH_LOGOUT_CLEAR);
118:     }
119: 
120:     /**
121:      * Retrieve url for unset long-term cookie
122:      *
123:      * @return string
124:      */
125:     public function getUnsetCookieUrl()
126:     {
127:         return $this->_getUrl('persistent/index/unsetCookie');
128:     }
129: 
130:     /**
131:      * Retrieve name of persistent customer
132:      *
133:      * @return string
134:      */
135:     public function getPersistentName()
136:     {
137:         return $this->__('(Not %s?)', $this->escapeHtml(Mage::helper('persistent/session')->getCustomer()->getName()));
138:     }
139: 
140:     /**
141:      * Retrieve path for config file
142:      *
143:      * @return string
144:      */
145:     public function getPersistentConfigFilePath()
146:     {
147:         return Mage::getConfig()->getModuleDir('etc', $this->_getModuleName()) . DS . $this->_configFileName;
148:     }
149: 
150:     /**
151:      * Check whether specified action should be processed
152:      *
153:      * @param Varien_Event_Observer $observer
154:      * @return bool
155:      */
156:     public function canProcess($observer)
157:     {
158:         $action = $observer->getEvent()->getAction();
159:         $controllerAction = $observer->getEvent()->getControllerAction();
160: 
161:         if ($action instanceof Mage_Core_Controller_Varien_Action) {
162:             return !$action->getFlag('', Mage_Core_Controller_Varien_Action::FLAG_NO_START_SESSION);
163:         }
164:         if ($controllerAction instanceof Mage_Core_Controller_Varien_Action) {
165:             return !$controllerAction->getFlag('', Mage_Core_Controller_Varien_Action::FLAG_NO_START_SESSION);
166:         }
167:         return true;
168:     }
169: 
170:     /**
171:      * Get create account url depends on checkout
172:      *
173:      * @param  $url string
174:      * @return string
175:      */
176:     public function getCreateAccountUrl($url)
177:     {
178:         if (Mage::helper('checkout')->isContextCheckout()) {
179:             $url = Mage::helper('core/url')->addRequestParam($url, array('context' => 'checkout'));
180:         }
181:         return $url;
182:     }
183: 
184: }
185: 
Magento 1.7.0.2 API documentation generated by ApiGen 2.8.0