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
  • Mage_Adminhtml_Block_Html_Date
  • Mage_Adminhtml_Block_Html_Select
  • Mage_Api_Model_Wsdl_Config_Element
  • Mage_Captcha_Adminhtml_RefreshController
  • Mage_Captcha_RefreshController
  • Mage_Core_AjaxController
  • Mage_Core_Block_Abstract
  • Mage_Core_Block_Flush
  • Mage_Core_Block_Html_Calendar
  • Mage_Core_Block_Html_Date
  • Mage_Core_Block_Html_Link
  • Mage_Core_Block_Html_Select
  • Mage_Core_Block_Messages
  • Mage_Core_Block_Profiler
  • Mage_Core_Block_Store_Switcher
  • Mage_Core_Block_Template
  • Mage_Core_Block_Template_Facade
  • Mage_Core_Block_Template_Smarty
  • Mage_Core_Block_Template_Zend
  • Mage_Core_Block_Text
  • Mage_Core_Block_Text_List
  • Mage_Core_Block_Text_List_Item
  • Mage_Core_Block_Text_List_Link
  • Mage_Core_Block_Text_Tag
  • Mage_Core_Block_Text_Tag_Css
  • Mage_Core_Block_Text_Tag_Css_Admin
  • Mage_Core_Block_Text_Tag_Debug
  • Mage_Core_Block_Text_Tag_Js
  • Mage_Core_Block_Text_Tag_Meta
  • Mage_Core_Controller_Front_Action
  • Mage_Core_Controller_Front_Router
  • Mage_Core_Controller_Request_Http
  • Mage_Core_Controller_Response_Http
  • Mage_Core_Controller_Varien_Action
  • Mage_Core_Controller_Varien_Front
  • Mage_Core_Controller_Varien_Router_Abstract
  • Mage_Core_Controller_Varien_Router_Admin
  • Mage_Core_Controller_Varien_Router_Default
  • Mage_Core_Controller_Varien_Router_Standard
  • Mage_Core_Helper_Abstract
  • Mage_Core_Helper_Cookie
  • Mage_Core_Helper_Data
  • Mage_Core_Helper_File_Storage
  • Mage_Core_Helper_File_Storage_Database
  • Mage_Core_Helper_Hint
  • Mage_Core_Helper_Http
  • Mage_Core_Helper_Js
  • Mage_Core_Helper_String
  • Mage_Core_Helper_Translate
  • Mage_Core_Helper_Url
  • Mage_Core_Helper_Url_Rewrite
  • Mage_Core_IndexController
  • Mage_Core_Model_Abstract
  • Mage_Core_Model_App
  • Mage_Core_Model_App_Area
  • Mage_Core_Model_App_Emulation
  • Mage_Core_Model_Cache
  • Mage_Core_Model_Calculator
  • Mage_Core_Model_Config
  • Mage_Core_Model_Config_Base
  • Mage_Core_Model_Config_Data
  • Mage_Core_Model_Config_Element
  • Mage_Core_Model_Config_Options
  • Mage_Core_Model_Config_System
  • Mage_Core_Model_Cookie
  • Mage_Core_Model_Date
  • Mage_Core_Model_Design
  • Mage_Core_Model_Design_Package
  • Mage_Core_Model_Design_Source_Design
  • Mage_Core_Model_Email
  • Mage_Core_Model_Email_Info
  • Mage_Core_Model_Email_Template
  • Mage_Core_Model_Email_Template_Filter
  • Mage_Core_Model_Email_Template_Mailer
  • Mage_Core_Model_Email_Transport
  • Mage_Core_Model_Encryption
  • Mage_Core_Model_File_Storage
  • Mage_Core_Model_File_Storage_Abstract
  • Mage_Core_Model_File_Storage_Database
  • Mage_Core_Model_File_Storage_Database_Abstract
  • Mage_Core_Model_File_Storage_Directory_Database
  • Mage_Core_Model_File_Storage_File
  • Mage_Core_Model_File_Storage_Flag
  • Mage_Core_Model_File_Uploader
  • Mage_Core_Model_File_Validator_AvailablePath
  • Mage_Core_Model_File_Validator_NotProtectedExtension
  • Mage_Core_Model_Flag
  • Mage_Core_Model_Input_Filter
  • Mage_Core_Model_Input_Filter_MaliciousCode
  • Mage_Core_Model_Language
  • Mage_Core_Model_Layout
  • Mage_Core_Model_Layout_Data
  • Mage_Core_Model_Layout_Element
  • Mage_Core_Model_Layout_Update
  • Mage_Core_Model_Locale
  • Mage_Core_Model_Locale_Config
  • Mage_Core_Model_Log_Adapter
  • Mage_Core_Model_Magento_Api
  • Mage_Core_Model_Magento_Api_V2
  • Mage_Core_Model_Message
  • Mage_Core_Model_Message_Abstract
  • Mage_Core_Model_Message_Collection
  • Mage_Core_Model_Message_Error
  • Mage_Core_Model_Message_Notice
  • Mage_Core_Model_Message_Success
  • Mage_Core_Model_Message_Warning
  • Mage_Core_Model_Mysql4_Abstract
  • Mage_Core_Model_Mysql4_Cache
  • Mage_Core_Model_Mysql4_Collection_Abstract
  • Mage_Core_Model_Mysql4_Config
  • Mage_Core_Model_Mysql4_Config_Data
  • Mage_Core_Model_Mysql4_Config_Data_Collection
  • Mage_Core_Model_Mysql4_Design
  • Mage_Core_Model_Mysql4_Design_Collection
  • Mage_Core_Model_Mysql4_Design_Package_Collection
  • Mage_Core_Model_Mysql4_Design_Theme
  • Mage_Core_Model_Mysql4_Email_Template
  • Mage_Core_Model_Mysql4_Email_Template_Collection
  • Mage_Core_Model_Mysql4_File_Storage_Abstract
  • Mage_Core_Model_Mysql4_File_Storage_Database
  • Mage_Core_Model_Mysql4_File_Storage_Directory_Database
  • Mage_Core_Model_Mysql4_File_Storage_File
  • Mage_Core_Model_Mysql4_Flag
  • Mage_Core_Model_Mysql4_Language
  • Mage_Core_Model_Mysql4_Language_Collection
  • Mage_Core_Model_Mysql4_Layout
  • Mage_Core_Model_Mysql4_Resource
  • Mage_Core_Model_Mysql4_Session
  • Mage_Core_Model_Mysql4_Store
  • Mage_Core_Model_Mysql4_Store_Collection
  • Mage_Core_Model_Mysql4_Store_Group
  • Mage_Core_Model_Mysql4_Store_Group_Collection
  • Mage_Core_Model_Mysql4_Translate
  • Mage_Core_Model_Mysql4_Translate_String
  • Mage_Core_Model_Mysql4_Url_Rewrite
  • Mage_Core_Model_Mysql4_Url_Rewrite_Collection
  • Mage_Core_Model_Mysql4_Variable
  • Mage_Core_Model_Mysql4_Variable_Collection
  • Mage_Core_Model_Mysql4_Website
  • Mage_Core_Model_Mysql4_Website_Collection
  • Mage_Core_Model_Observer
  • Mage_Core_Model_Resource
  • Mage_Core_Model_Resource_Abstract
  • Mage_Core_Model_Resource_Cache
  • Mage_Core_Model_Resource_Config
  • Mage_Core_Model_Resource_Config_Data
  • Mage_Core_Model_Resource_Config_Data_Collection
  • Mage_Core_Model_Resource_Db_Abstract
  • Mage_Core_Model_Resource_Db_Collection_Abstract
  • Mage_Core_Model_Resource_Design
  • Mage_Core_Model_Resource_Design_Collection
  • Mage_Core_Model_Resource_Design_Package_Collection
  • Mage_Core_Model_Resource_Email_Template
  • Mage_Core_Model_Resource_Email_Template_Collection
  • Mage_Core_Model_Resource_Entity_Abstract
  • Mage_Core_Model_Resource_Entity_Table
  • Mage_Core_Model_Resource_File_Storage_Abstract
  • Mage_Core_Model_Resource_File_Storage_Database
  • Mage_Core_Model_Resource_File_Storage_Directory_Database
  • Mage_Core_Model_Resource_File_Storage_File
  • Mage_Core_Model_Resource_Flag
  • Mage_Core_Model_Resource_Helper_Abstract
  • Mage_Core_Model_Resource_Helper_Mysql4
  • Mage_Core_Model_Resource_Iterator
  • Mage_Core_Model_Resource_Language
  • Mage_Core_Model_Resource_Language_Collection
  • Mage_Core_Model_Resource_Layout
  • Mage_Core_Model_Resource_Resource
  • Mage_Core_Model_Resource_Session
  • Mage_Core_Model_Resource_Setup
  • Mage_Core_Model_Resource_Setup_Query_Modifier
  • Mage_Core_Model_Resource_Store
  • Mage_Core_Model_Resource_Store_Collection
  • Mage_Core_Model_Resource_Store_Group
  • Mage_Core_Model_Resource_Store_Group_Collection
  • Mage_Core_Model_Resource_Transaction
  • Mage_Core_Model_Resource_Translate
  • Mage_Core_Model_Resource_Translate_String
  • Mage_Core_Model_Resource_Type_Abstract
  • Mage_Core_Model_Resource_Type_Db
  • Mage_Core_Model_Resource_Type_Db_Mysqli
  • Mage_Core_Model_Resource_Type_Db_Mysqli_Setup
  • Mage_Core_Model_Resource_Type_Db_Pdo_Mysql
  • Mage_Core_Model_Resource_Url_Rewrite
  • Mage_Core_Model_Resource_Url_Rewrite_Collection
  • Mage_Core_Model_Resource_Variable
  • Mage_Core_Model_Resource_Variable_Collection
  • Mage_Core_Model_Resource_Website
  • Mage_Core_Model_Resource_Website_Collection
  • Mage_Core_Model_Session
  • Mage_Core_Model_Session_Abstract
  • Mage_Core_Model_Session_Abstract_Varien
  • Mage_Core_Model_Session_Abstract_Zend
  • Mage_Core_Model_Source_Email_Variables
  • Mage_Core_Model_Store
  • Mage_Core_Model_Store_Api
  • Mage_Core_Model_Store_Api_V2
  • Mage_Core_Model_Store_Group
  • Mage_Core_Model_Template
  • Mage_Core_Model_Translate
  • Mage_Core_Model_Translate_Expr
  • Mage_Core_Model_Translate_Inline
  • Mage_Core_Model_Translate_String
  • Mage_Core_Model_Url
  • Mage_Core_Model_Url_Rewrite
  • Mage_Core_Model_Url_Validator
  • Mage_Core_Model_Variable
  • Mage_Core_Model_Variable_Config
  • Mage_Core_Model_Variable_Observer
  • Mage_Core_Model_Website
  • Mage_Page_Block_Switch
  • Mage_Page_Block_Template_Container
  • Mage_Page_Block_Template_Links
  • Mage_Page_Block_Template_Links_Block
  • Mage_Sales_Model_Quote_Address_Total_Collector

Exceptions

  • Mage_Core_Controller_Varien_Exception
  • Mage_Core_Exception
  • Mage_Core_Model_Session_Exception
  • Mage_Core_Model_Store_Exception

Functions

  • destruct
  • is_dir_writeable
  • is_empty_date
  • mageCoreErrorHandler
  • mageDebugBacktrace
  • mageDelTree
  • mageFindClassFile
  • mageParseCsv
  • mageSendErrorFooter
  • mageSendErrorHeader
  • mageUndoMagicQuotes
  • now
  • sys_get_temp_dir
  • uc_words
  • 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_Core
 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:  * Core cookie model
 30:  *
 31:  * @category   Mage
 32:  * @package    Mage_Core
 33:  * @author     Magento Core Team <core@magentocommerce.com>
 34:  */
 35: class Mage_Core_Model_Cookie
 36: {
 37:     const XML_PATH_COOKIE_DOMAIN    = 'web/cookie/cookie_domain';
 38:     const XML_PATH_COOKIE_PATH      = 'web/cookie/cookie_path';
 39:     const XML_PATH_COOKIE_LIFETIME  = 'web/cookie/cookie_lifetime';
 40:     const XML_PATH_COOKIE_HTTPONLY  = 'web/cookie/cookie_httponly';
 41: 
 42:     protected $_lifetime;
 43: 
 44:     /**
 45:      * Store object
 46:      *
 47:      * @var Mage_Core_Model_Store
 48:      */
 49:     protected $_store;
 50: 
 51:     /**
 52:      * Set Store object
 53:      *
 54:      * @param mixed $store
 55:      * @return Mage_Core_Model_Cookie
 56:      */
 57:     public function setStore($store)
 58:     {
 59:         $this->_store = Mage::app()->getStore($store);
 60:         return $this;
 61:     }
 62: 
 63:     /**
 64:      * Retrieve Store object
 65:      *
 66:      * @return Mage_Core_Model_Store
 67:      */
 68:     public function getStore()
 69:     {
 70:         if (is_null($this->_store)) {
 71:             $this->_store = Mage::app()->getStore();
 72:         }
 73:         return $this->_store;
 74:     }
 75: 
 76:     /**
 77:      * Retrieve Request object
 78:      *
 79:      * @return Mage_Core_Controller_Request_Http
 80:      */
 81:     protected function _getRequest()
 82:     {
 83:         return Mage::app()->getRequest();
 84:     }
 85: 
 86:     /**
 87:      * Retrieve Response object
 88:      *
 89:      * @return Mage_Core_Controller_Response_Http
 90:      */
 91:     protected function _getResponse()
 92:     {
 93:         return Mage::app()->getResponse();
 94:     }
 95: 
 96:     /**
 97:      * Retrieve Domain for cookie
 98:      *
 99:      * @return string
100:      */
101:     public function getDomain()
102:     {
103:         $domain = $this->getConfigDomain();
104:         if (empty($domain)) {
105:             $domain = $this->_getRequest()->getHttpHost();
106:         }
107:         return $domain;
108:     }
109: 
110:     /**
111:      * Retrieve Config Domain for cookie
112:      *
113:      * @return string
114:      */
115:     public function getConfigDomain()
116:     {
117:         return (string)Mage::getStoreConfig(self::XML_PATH_COOKIE_DOMAIN, $this->getStore());
118:     }
119: 
120:     /**
121:      * Retrieve Path for cookie
122:      *
123:      * @return string
124:      */
125:     public function getPath()
126:     {
127:         $path = Mage::getStoreConfig(self::XML_PATH_COOKIE_PATH, $this->getStore());
128:         if (empty($path)) {
129:             $path = $this->_getRequest()->getBasePath();
130:         }
131:         return $path;
132:     }
133: 
134:     /**
135:      * Retrieve cookie lifetime
136:      *
137:      * @return int
138:      */
139:     public function getLifetime()
140:     {
141:         if (!is_null($this->_lifetime)) {
142:             $lifetime = $this->_lifetime;
143:         } else {
144:             $lifetime = Mage::getStoreConfig(self::XML_PATH_COOKIE_LIFETIME, $this->getStore());
145:         }
146:         if (!is_numeric($lifetime)) {
147:             $lifetime = 3600;
148:         }
149:         return $lifetime;
150:     }
151: 
152:     /**
153:      * Set cookie lifetime
154:      *
155:      * @param int $lifetime
156:      * @return Mage_Core_Model_Cookie
157:      */
158:     public function setLifetime($lifetime)
159:     {
160:         $this->_lifetime = (int)$lifetime;
161:         return $this;
162:     }
163: 
164:     /**
165:      * Retrieve use HTTP only flag
166:      *
167:      * @return bool
168:      */
169:     public function getHttponly()
170:     {
171:         $httponly = Mage::getStoreConfig(self::XML_PATH_COOKIE_HTTPONLY, $this->getStore());
172:         if (is_null($httponly)) {
173:             return null;
174:         }
175:         return (bool)$httponly;
176:     }
177: 
178:     /**
179:      * Is https secure request
180:      * Use secure on adminhtml only
181:      *
182:      * @return bool
183:      */
184:     public function isSecure()
185:     {
186:         if ($this->getStore()->isAdmin()) {
187:             return $this->_getRequest()->isSecure();
188:         }
189:         return false;
190:     }
191: 
192:     /**
193:      * Set cookie
194:      *
195:      * @param string $name The cookie name
196:      * @param string $value The cookie value
197:      * @param int $period Lifetime period
198:      * @param string $path
199:      * @param string $domain
200:      * @param int|bool $secure
201:      * @param bool $httponly
202:      * @return Mage_Core_Model_Cookie
203:      */
204:     public function set($name, $value, $period = null, $path = null, $domain = null, $secure = null, $httponly = null)
205:     {
206:         /**
207:          * Check headers sent
208:          */
209:         if (!$this->_getResponse()->canSendHeaders(false)) {
210:             return $this;
211:         }
212: 
213:         if ($period === true) {
214:             $period = 3600 * 24 * 365;
215:         } elseif (is_null($period)) {
216:             $period = $this->getLifetime();
217:         }
218: 
219:         if ($period == 0) {
220:             $expire = 0;
221:         }
222:         else {
223:             $expire = time() + $period;
224:         }
225:         if (is_null($path)) {
226:             $path = $this->getPath();
227:         }
228:         if (is_null($domain)) {
229:             $domain = $this->getDomain();
230:         }
231:         if (is_null($secure)) {
232:             $secure = $this->isSecure();
233:         }
234:         if (is_null($httponly)) {
235:             $httponly = $this->getHttponly();
236:         }
237: 
238:         setcookie($name, $value, $expire, $path, $domain, $secure, $httponly);
239: 
240:         return $this;
241:     }
242: 
243:     /**
244:      * Postpone cookie expiration time if cookie value defined
245:      *
246:      * @param string $name The cookie name
247:      * @param int $period Lifetime period
248:      * @param string $path
249:      * @param string $domain
250:      * @param int|bool $secure
251:      * @return Mage_Core_Model_Cookie
252:      */
253:     public function renew($name, $period = null, $path = null, $domain = null, $secure = null, $httponly = null)
254:     {
255:         if (($period === null) && !$this->getLifetime()) {
256:             return $this;
257:         }
258:         $value = $this->_getRequest()->getCookie($name, false);
259:         if ($value !== false) {
260:             $this->set($name, $value, $period, $path, $domain, $secure, $httponly);
261:         }
262:         return $this;
263:     }
264: 
265:     /**
266:      * Retrieve cookie or false if not exists
267:      *
268:      * @param string $neme The cookie name
269:      * @return mixed
270:      */
271:     public function get($name = null)
272:     {
273:         return $this->_getRequest()->getCookie($name, false);
274:     }
275: 
276:     /**
277:      * Delete cookie
278:      *
279:      * @param string $name
280:      * @param string $path
281:      * @param string $domain
282:      * @param int|bool $secure
283:      * @param int|bool $httponly
284:      * @return Mage_Core_Model_Cookie
285:      */
286:     public function delete($name, $path = null, $domain = null, $secure = null, $httponly = null)
287:     {
288:         /**
289:          * Check headers sent
290:          */
291:         if (!$this->_getResponse()->canSendHeaders(false)) {
292:             return $this;
293:         }
294: 
295:         if (is_null($path)) {
296:             $path = $this->getPath();
297:         }
298:         if (is_null($domain)) {
299:             $domain = $this->getDomain();
300:         }
301:         if (is_null($secure)) {
302:             $secure = $this->isSecure();
303:         }
304:         if (is_null($httponly)) {
305:             $httponly = $this->getHttponly();
306:         }
307: 
308:         setcookie($name, null, null, $path, $domain, $secure, $httponly);
309:         return $this;
310:     }
311: }
312: 
Magento 1.7.0.2 API documentation generated by ApiGen 2.8.0