GeoIP/copy_this/modules/d3/d3geoip/components/d3cmp_geoip.php

66 lines
1.9 KiB
PHP
Raw Normal View History

2012-02-15 14:15:28 +01:00
<?php
2013-04-22 11:40:11 +02:00
/**
* This Software is the property of Data Development and is protected
* by copyright law - it is NOT Freeware.
*
* Any unauthorized use of this software without a valid license
* is a violation of the license agreement and will be prosecuted by
* civil and criminal law.
*
* http://www.shopmodule.com
*
2015-12-21 14:28:34 +01:00
* @copyright <EFBFBD> D<EFBFBD> Data Development, Thomas Dartsch
* @author D<EFBFBD> Data Development - Daniel Seifert <ds@shopmodule.com>
2013-04-22 11:40:11 +02:00
* @link http://www.oxidmodule.com
*/
2015-12-21 14:28:34 +01:00
class d3cmp_geoip extends oxView
2012-02-15 14:15:28 +01:00
{
2015-12-21 14:28:34 +01:00
/**
* Marking object as component
*
* @var bool
*/
protected $_blIsComponent = true;
2015-06-23 11:29:07 +02:00
private $_sModId = 'd3_geoip';
2013-04-22 11:25:27 +02:00
2013-04-22 11:40:11 +02:00
/**
* @return null
*/
2012-02-15 14:15:28 +01:00
public function init()
{
2015-06-23 11:29:07 +02:00
if (d3_cfg_mod::get($this->_sModId)->isActive()) {
if (d3_cfg_mod::get($this->_sModId)->hasDebugMode()) {
2013-04-22 11:40:11 +02:00
/** @var $oGeoIp d3geoip */
$oGeoIp = oxNew('d3geoip');
echo $oGeoIp->getIP();
}
2013-04-22 11:25:27 +02:00
2013-04-22 11:40:11 +02:00
/** @var $oLocation d3geoip */
$oLocation = oxNew('d3geoip');
$oLocation->setCountryCurrency();
2015-12-21 14:28:34 +01:00
$oLocation->setCountryLanguage();
if (!isset($oBasket)) {
$oBasket = $this->getSession()->getBasket();
}
// call component again, if curr is registered before we changed it
// reason: own component can added after default components only
if ($oLocation->hasNotSetCurrency($oBasket->getBasketCurrency())) {
/** @var oxUBase $oActView */
$oActView = oxRegistry::getConfig()->getActiveView();
$aComponents = $oActView->getComponents();
/** @var oxcmp_cur $oCurCmp */
$oCurCmp = $aComponents['oxcmp_cur'];
$oCurCmp->init();
}
// language isn't registered, we don't need an additional check
2015-06-23 11:29:07 +02:00
}
2012-02-15 14:15:28 +01:00
parent::init();
2012-02-15 14:15:28 +01:00
}
}