From cf4530951f424c2c456f72c1ade120ab929b9413 Mon Sep 17 00:00:00 2001 From: Ngoc Anh Doan Date: Thu, 9 Jan 2014 13:38:28 +0100 Subject: [PATCH 1/2] SUPTRUSTEDSHOPS-145 - Extended code comment of Symmetrics_TrustedRating_Helper_Data class. --- .../Symmetrics/TrustedRating/Helper/Data.php | 50 +++++++------------ 1 file changed, 17 insertions(+), 33 deletions(-) diff --git a/build/app/code/community/Symmetrics/TrustedRating/Helper/Data.php b/build/app/code/community/Symmetrics/TrustedRating/Helper/Data.php index 5cc5f0b..4b33bab 100644 --- a/build/app/code/community/Symmetrics/TrustedRating/Helper/Data.php +++ b/build/app/code/community/Symmetrics/TrustedRating/Helper/Data.php @@ -49,6 +49,9 @@ class Symmetrics_TrustedRating_Helper_Data extends Mage_Core_Helper_Abstract */ const CONFIG_STATUS_PATH = 'trustedrating/status'; + /** + * SUPTRUSTEDSHOPS-122: + */ const XML_PATH_SHOW_WIDGET = 'show_widget'; /** @@ -195,12 +198,13 @@ public function getCustomerEmail($shipmentId) return $email; } - + /** * Get language specific Trusted Shops rating URL - * - * @param null|string $store Store ID or language - * + * + * @param null|string $rateType Rating type, now or laterg + * @param null|int|Mage_Core_Model_Store $store Store ID or language + * * @return type */ public function getRatingUrl($rateType = 'rate_now', $store = null) @@ -261,22 +265,12 @@ public function getRateLaterDaysInterval($store = null) } /** - * Get the trusted rating id from store config - * - * @param mixed $storeId ID of Store. + * Getter for TS' privacy link * - * @return string + * @param int|null $storeId Store ID + * + * @return mixed */ - public function getTsId($storeId = null) - { - if ((null == $storeId) && Mage::app()->getStore()->isAdmin()) { - $excMessage = 'Can\'t determine TS ID in Admin scope without Store ID!'; - Mage::logException(new Exception($excMessage)); - } - - return Mage::getStoreConfig('trustedrating/data/trustedrating_id', $storeId); - } - public function getTsPrivacyUrl($storeId = null) { $xmlPath = Symmetrics_TrustedRating_Model_Trustedrating::XML_PATH_PRIVACY_URL_PREFIX . @@ -350,12 +344,13 @@ public function isTrustedRatingActive($store = null) return $store->getConfig(Symmetrics_TrustedRating_Model_Trustedrating::XML_PATH_TRUSTEDRATING_ACTIVE) && $store->getConfig(Symmetrics_TrustedRating_Model_Trustedrating::XML_PATH_TRUSTEDRATING_ID); } - + /** * Get Base64 URL encoded string. - * - * @param mixed $data - * + * + * @param string $data Data to encode + * @param bool $urlEncode Using urlencode or not + * * @return string * @see urlencode * @see base64_encode @@ -366,15 +361,4 @@ public function tsDataEncode($data, $urlEncode = false) return (!$urlEncode) ? $returnValue : urlencode($returnValue); } - - /** - * Check if Symmetrics_Buyerprotect module is active. - * - * @return bool - */ - public function isBuyerprotectActive() - { - return Mage::helper('core')->isModuleEnabled(self::BUYERPROTECT_MODULE_NAME) && - Mage::helper(self::BUYERPROTECT_MODULE_CONFIG_KEY)->isBuyerprotectActive(); - } } From 28ed673bd8af56d436251eeb0de7b3f248bd3d0f Mon Sep 17 00:00:00 2001 From: Ngoc Anh Doan Date: Thu, 9 Jan 2014 14:01:41 +0100 Subject: [PATCH 2/2] SUPTRUSTEDSHOPS-145 - Re-added Symmetrics_TrustedRating_Helper_Data::getLanguage() as it is missing after all the previous merges. --- .../Symmetrics/TrustedRating/Helper/Data.php | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/build/app/code/community/Symmetrics/TrustedRating/Helper/Data.php b/build/app/code/community/Symmetrics/TrustedRating/Helper/Data.php index 2a90c3f..7a26d63 100644 --- a/build/app/code/community/Symmetrics/TrustedRating/Helper/Data.php +++ b/build/app/code/community/Symmetrics/TrustedRating/Helper/Data.php @@ -133,6 +133,27 @@ public function getConfig($node, $key) return Mage::getStoreConfig($node . '/' . $key, Mage::app()->getStore()); } + /** + * Get configured language of module + * + * @param null|int $storeId Store ID + * + * @return string + */ + public function getLanguage($storeId = null) + { + $language = Mage::getStoreConfig( + Symmetrics_TrustedRating_Model_Trustedrating::XML_PATH_TRUSTEDRATING_LANGUAGE, + $storeId + ); + + if (!$language) { + $language = Symmetrics_TrustedRating_Model_Trustedrating::DEFAULT_LANGUAGE; + } + + return $language; + } + /** * Get module specific config from system configuration *