コード例 #1
0
 public static function executeCronTask()
 {
     $ts_module = new TrustedShops();
     $ts_common = new TSCommon();
     $common_count = 0;
     if (is_array(TSCommon::$available_languages)) {
         $to_remove = array();
         foreach (array_keys(TSCommon::$available_languages) as $iso) {
             $alerts_infos = RatingAlert::getAlertsInformations($iso);
             ///print_r($alerts_infos);
             if ($alerts_infos != false) {
                 $common_count += count($alerts_infos);
                 foreach ($alerts_infos as $infos) {
                     $cert = Configuration::get(TSCommon::PREFIX_TABLE . 'CERTIFICATE_' . Tools::strtoupper($infos['iso']));
                     $certificate = (array) Tools::jsonDecode(Tools::htmlentitiesDecodeUTF8($cert));
                     $subject = $ts_module->l('title_part_1') . ' ' . Configuration::get('PS_SHOP_NAME') . $ts_module->l('title_part_2');
                     $template_vars = array('{ts_id}' => $certificate['tsID'], '{button_url}' => TSCommon::getHttpHost(true, true) . _MODULE_DIR_ . $ts_module->name . '/views/img', '{rating_url}' => $ts_common->getRatingUrlWithBuyerEmail($infos['id_lang'], $infos['id_order'], $infos['email']));
                     $result = Mail::Send((int) $infos['id_lang'], self::MAIL_TEMPLATE, $subject, $template_vars, $infos['email'], null, Configuration::get('PS_SHOP_EMAIL'), Configuration::get('PS_SHOP_NAME'), null, null, dirname(__FILE__) . '/../mails/');
                     if ($result) {
                         $to_remove[] = (int) $infos['id_alert'];
                     }
                 }
             }
         }
         if (count($to_remove) > 0) {
             self::removeAlerts($to_remove);
         }
     }
     return count($to_remove) == $common_count;
 }
コード例 #2
0
ファイル: trustedshops.php プロジェクト: greench/prestashop
 public function __construct()
 {
     global $smarty;
     $this->name = 'trustedshops';
     $this->tab = 'payment_security';
     $this->version = '1.3.3';
     parent::__construct();
     if (empty(self::$objects_list)) {
         TSBuyerProtection::setTranslationObject($this);
         $obj_ts_rating = new TrustedShopsRating();
         $obj_ts_buyerprotection = new TSBuyerProtection();
         $obj_ts_buyerprotection->_setEnvApi(TSBuyerProtection::ENV_PROD);
         self::$objects_list = array($obj_ts_rating, $obj_ts_buyerprotection);
         self::$objects_list[0]->setModuleName($this->name);
         self::$objects_list[0]->setSmarty($smarty);
     }
     if (!extension_loaded('soap')) {
         $this->warnings[] = $this->l('This module requires the SOAP PHP extension to function properly.');
     }
     foreach (self::$objects_list as $object) {
         $this->limited_countries = array_merge($this->limited_countries, $object->limited_countries);
         if (!empty($object->warnings)) {
             $this->warnings = array_merge($this->warnings, $object->warnings);
         }
     }
     if (!empty($this->warnings)) {
         $this->warning = implode(',<br />', $this->warnings) . '.';
     }
     $this->displayName = $this->l('Trusted Shops trust solutions');
     $this->description = $this->l('Build confidence in your online shop with the Trusted Shops quality seal, buyer protection and customer rating.');
     $this->confirmUninstall = $this->l('Are you sure you want to delete all your settings?');
 }
コード例 #3
0
 public static function executeCronTask()
 {
     global $cookie;
     if (!Configuration::get('TS_SEND_SEPERATE_MAIL')) {
         return true;
     }
     $to_remove = array();
     $alerts_infos = RatingAlert::_getAlertsInformations((int) Configuration::get('TS_SEND_SEPERATE_MAIL_DELAY'));
     $ts_module = new TrustedShops();
     foreach ($alerts_infos as $infos) {
         $cookie->id_lang = $infos['id_lang'];
         $subject = $ts_module->getL('title_part_1') . ' ' . Configuration::get('PS_SHOP_NAME') . $ts_module->getL('title_part_2');
         $template_vars = array('{ts_id}' => Configuration::get('TS_ID_' . (int) $infos['id_lang']), '{button_url}' => TrustedShops::getHttpHost(true, true) . _MODULE_DIR_ . $ts_module->name . '/img', '{rating_url}' => $ts_module->getRatingUrlWithBuyerEmail($infos['id_lang'], $infos['id_order'], $infos['email']));
         $result = Mail::Send((int) $infos['id_lang'], self::MAIL_TEMPLATE, $subject, $template_vars, $infos['email'], NULL, Configuration::get('PS_SHOP_EMAIL'), Configuration::get('PS_SHOP_NAME'), NULL, NULL, dirname(__FILE__) . '/mails/');
         if ($result) {
             $to_remove[] = (int) $infos['id_alert'];
         }
     }
     if (sizeof($to_remove) > 0) {
         self::removeAlerts($to_remove);
     }
     return sizeof($to_remove) == sizeof($alerts_infos);
 }
コード例 #4
0
 public static function display_seal()
 {
     if (!TrustedShops::$seal_displayed) {
         Context::getContext()->smarty->assign('ts_module_dir', __PS_BASE_URI__ . 'modules/trustedshops/');
         TrustedShops::$seal_displayed = true;
         return Context::getContext()->smarty->fetch(dirname(__FILE__) . '/seal_of_approval.tpl');
     }
     return '';
 }
コード例 #5
0
 public static function displaySeal()
 {
     if (!TrustedShops::$seal_displayed) {
         Context::getContext()->smarty->assign('ts_module_dir', __PS_BASE_URI__ . 'modules/trustedshops/');
         TrustedShops::$seal_displayed = true;
         return Context::getContext()->smarty->fetch(dirname(__FILE__) . '/views/templates/front/' . TSCommon::getTemplateByVersion('seal_of_approval'));
     }
     return '';
 }
コード例 #6
0
 public function hookRightColumn($params)
 {
     $iso_code = strtoupper(Language::getIsoById($params['cookie']->id_lang));
     if (array_key_exists($iso_code, $this->available_languages) and isset(TSBuyerProtection::$CERTIFICATES[$iso_code]['tsID'])) {
         TSBuyerProtection::$smarty->assign('trusted_shops_id', TSBuyerProtection::$CERTIFICATES[$iso_code]['tsID']);
         TSBuyerProtection::$smarty->assign('onlineshop_name', ConfigurationCore::get('PS_SHOP_NAME'));
         $url = str_replace(array('#shop_id#', '#shop_name#'), array(TSBuyerProtection::$CERTIFICATES[$iso_code]['tsID'], urlencode(str_replace('_', '-', ConfigurationCore::get('PS_SHOP_NAME')))), TSBuyerProtection::$certificate_link[$iso_code]);
         TSBuyerProtection::$smarty->assign('trusted_shops_url', $url);
         if (isset(TSBuyerProtection::$CERTIFICATES[$iso_code])) {
             $certificate = TSBuyerProtection::$CERTIFICATES[$iso_code];
             if (isset($certificate['tsID']) && ($certificate['typeEnum'] == 'CLASSIC' || $certificate['typeEnum'] == 'EXCELLENCE' && $certificate['user'] != '' && $certificate['password'] != '')) {
                 return TrustedShops::display_seal();
             }
         }
     }
     return '';
 }
コード例 #7
0
ファイル: TSCommon.php プロジェクト: alexsimple/trustedshops
 public function hookRightColumn($params)
 {
     $iso_lang = $iso_cert = Tools::strtoupper(Language::getIsoById($params['cookie']->id_lang));
     $tab_id = false;
     if (isset(TSCommon::$certificates[Tools::strtoupper($iso_cert)]['tsID'])) {
         $tab_id = TSCommon::$certificates[Tools::strtoupper($iso_cert)]['tsID'];
     }
     if (!$tab_id) {
         return false;
     }
     if (isset(TSCommon::$certificates[$iso_cert]['tsID'])) {
         TSCommon::$smarty->assign('trusted_shops_id', TSCommon::$certificates[$iso_cert]['tsID']);
         TSCommon::$smarty->assign('variant', isset(TSCommon::$certificates[$iso_cert]['variant']) ? in_array(TSCommon::$certificates[$iso_cert]['variant'], array_keys($this->available_seal_variants)) ? TSCommon::$certificates[$iso_cert]['variant'] : 'default' : 'default');
         TSCommon::$smarty->assign('yoffset', TSCommon::$certificates[$iso_cert]['yoffset']);
         TSCommon::$smarty->assign('jscode', TSCommon::$certificates[$iso_cert]['jscode']);
         TSCommon::$smarty->assign('onlineshop_name', ConfigurationCore::get('PS_SHOP_NAME'));
         $url = str_replace(array('#shop_id#', '#shop_name#'), array(TSCommon::$certificates[$iso_cert]['tsID'], urlencode(str_replace('_', '-', ConfigurationCore::get('PS_SHOP_NAME')))), TSCommon::$certificate_link[$iso_lang]);
         TSCommon::$smarty->assign('trusted_shops_url', $url);
         if (isset(TSCommon::$certificates[$iso_cert])) {
             $certificate = TSCommon::$certificates[$iso_cert];
             if (isset($certificate['tsID']) && ($certificate['typeEnum'] == 'CLASSIC' || $certificate['typeEnum'] == 'UNKNOWN' || $certificate['typeEnum'] == 'EXCELLENCE' && $certificate['user'] != '' && $certificate['password'] != '')) {
                 return TrustedShops::displaySeal();
             }
         }
     }
     return '';
 }