0byt3m1n1
Path:
/
data
/
applications
/
aps
/
magento
/
1.1.3-2
/
standard
/
htdocs
/
app
/
code
/
core
/
Mage
/
Customer
/
Helper
/
[
Home
]
File: Data.php
<?php /** * Magento * * NOTICE OF LICENSE * * This source file is subject to the Open Software License (OSL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/osl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to license@magentocommerce.com so we can send you a copy immediately. * * @category Mage * @package Mage_Customer * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ /** * Customer data helper * * @author Magento Core Team <core@magentocommerce.com> */ class Mage_Customer_Helper_Data extends Mage_Core_Helper_Abstract { protected $_groups; public function isLoggedIn() { return Mage::getSingleton('customer/session')->isLoggedIn(); } /** * Retrieve logged in customer * * @return Mage_Customer_Model_Customer */ public function getCustomer() { if (empty($this->_customer)) { $this->_customer = Mage::getSingleton('customer/session')->getCustomer(); } return $this->_customer; } public function getGroups() { if (empty($this->_groups)) { $this->_groups = Mage::getModel('customer/group')->getResourceCollection() ->setRealGroupsFilter() ->load(); } return $this->_groups; } public function getCurrentCustomer() { return $this->getCustomer(); } public function getCustomerName() { return $this->getCustomer()->getName(); } public function customerHasAddresses() { return count($this->getCustomer()->getAddresses()); } /************************************************************************** * Customer urls */ /** * Retrieve customer login url * * @return string */ public function getLoginUrl() { return $this->_getUrl('customer/account/login'); } public function getLoginPostUrl() { return $this->_getUrl('customer/account/loginPost'); } /** * Retrieve customer logout url * * @return string */ public function getLogoutUrl() { return $this->_getUrl('customer/account/logout'); } /** * Retrieve customer dashboard url * * @return string */ public function getDashboardUrl() { return $this->_getUrl('customer/account'); } /** * Retrieve customer account page url * * @return string */ public function getAccountUrl() { return $this->_getUrl('customer/account'); } /** * Retrieve customer register form url * * @return string */ public function getRegisterUrl() { return $this->_getUrl('customer/account/create'); } /** * Retrieve customer register form post url * * @return string */ public function getRegisterPostUrl() { return $this->_getUrl('customer/account/createpost'); } /** * Retrieve customer account edit form url * * @return string */ public function getEditUrl() { return $this->_getUrl('customer/account/edit'); } public function getEditPostUrl() { return $this->_getUrl('customer/account/editpost'); } /** * Retrieve url of forgot password page * * @return string */ public function getForgotPasswordUrl() { return $this->_getUrl('customer/account/forgotpassword'); } public function isConfirmationRequired() { return $this->getCustomer()->isConfirmationRequired(); } public function getEmailConfirmationUrl($email = null) { return $this->_getUrl('customer/account/confirmation', array('email' => $email)); } }