コード例 #1
0
ファイル: twenga.php プロジェクト: ventsiwad/presta_addons
 public function __construct()
 {
     // Basic vars
     global $currentIndex;
     $this->current_index = $currentIndex;
     $this->token = Tools::getValue('token');
     $this->name = 'twenga';
     $this->tab = 'smart_shopping';
     $this->version = '1.11';
     $this->author = 'PrestaShop';
     parent::__construct();
     $this->displayName = $this->l('Twenga Module');
     $this->description = $this->l('Export your products to Twenga Shopping Search Engine and get new online buyers immediately.');
     $this->ps_versions_compliancy = array('min' => '1.4', 'max' => _PS_VERSION_);
     // For Twenga subscription
     $protocol = 'http://';
     if (isset($_SERVER['https']) && $_SERVER['https'] != 'off') {
         $protocol = 'https://';
     }
     $this->site_url = Tools::htmlentitiesutf8($protocol . $_SERVER['HTTP_HOST'] . __PS_BASE_URI__);
     self::$base_dir = _PS_ROOT_DIR_ . '/modules/twenga/';
     self::$base_path = $this->site_url . '/modules/twenga/';
     $this->feed_url = self::$base_path . 'export.php?twenga_token=' . sha1(Configuration::get('TWENGA_TOKEN') . _COOKIE_KEY_);
     self::$shop_country = Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT'));
     require_once realpath(self::$base_dir . '/lib/PrestashopStats.php');
     require_once realpath(self::$base_dir . '/lib/TwengaObj.php');
     // set the base dir to load files needed for the TwengaObj class
     TwengaObj::$base_dir = self::$base_dir . '/lib';
     TwengaObj::setTranslationObject($this);
     TwengaException::setTranslationObject($this);
     if (!in_array(strtolower(self::$shop_country), $this->limited_countries)) {
         $this->_allowToWork = false;
         $this->warning = $this->l('Twenga module works only in specific countries (iso code list:') . ' ' . implode(', ', $this->limited_countries) . ').';
         return false;
     }
     // instanciate (just once) the TwengaObj and PrestashopStats
     if (self::$obj_twenga === NULL) {
         self::$obj_twenga = new TwengaObj();
     }
     if (self::$obj_ps_stats === NULL) {
         self::$obj_ps_stats = new PrestashopStats($this->site_url);
     }
     $this->_initCurrentIsoCodeCountry();
     if (!extension_loaded('openssl')) {
         $this->warning = $this->l('OpenSSL should be activated on your PHP configuration to use all functionalities of Twenga.');
     }
 }
コード例 #2
0
 public function __construct()
 {
     // Basic vars
     global $currentIndex;
     $this->current_index = $currentIndex;
     $this->token = Tools::getValue('token');
     $this->name = 'twenga';
     $this->tab = 'smart_shopping';
     $this->version = '1.8';
     parent::__construct();
     $this->displayName = $this->l('Twenga API');
     $this->description = $this->l('Module role: export of your products on Twenga and installation of the sales tracking brought by Twenga (requires sign up to Twenga)');
     // For Twenga subscription
     $protocol = 'http://';
     if (isset($_SERVER['https']) && $_SERVER['https'] != 'off') {
         $protocol = 'https://';
     }
     $this->site_url = Tools::htmlentitiesutf8($protocol . $_SERVER['HTTP_HOST'] . __PS_BASE_URI__);
     self::$base_dir = _PS_ROOT_DIR_ . '/modules/twenga/';
     self::$base_path = $this->site_url . '/modules/twenga/';
     $this->feed_url = self::$base_path . 'export.php?twenga_token=' . sha1(Configuration::get('TWENGA_TOKEN') . _COOKIE_KEY_);
     self::$shop_country = Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT'));
     require_once realpath(self::$base_dir . '/lib/PrestashopStats.php');
     require_once realpath(self::$base_dir . '/lib/TwengaObj.php');
     // set the base dir to load files needed for the TwengaObj class
     TwengaObj::$base_dir = self::$base_dir . '/lib';
     TwengaObj::setTranslationObject($this);
     TwengaException::setTranslationObject($this);
     if (!in_array(strtolower(self::$shop_country), $this->limited_countries)) {
         $this->_allowToWork = false;
         $this->warning = $this->l('Twenga module works only in specific countries (iso code list:') . ' ' . implode(', ', $this->limited_countries) . ').';
         return false;
     }
     // instanciate (just once) the TwengaObj and PrestashopStats
     if (self::$obj_twenga === NULL) {
         self::$obj_twenga = new TwengaObj();
     }
     if (self::$obj_ps_stats === NULL) {
         self::$obj_ps_stats = new PrestashopStats($this->site_url);
     }
     $this->_initCurrentIsoCodeCountry();
 }
コード例 #3
0
 public static function setTranslationObject(Module $object)
 {
     self::$translation_object = $object;
 }