Changeset 3158764
- Timestamp:
- 09/27/2024 12:24:26 PM (18 months ago)
- Location:
- tabby-checkout
- Files:
-
- 6 edited
- 34 copied
-
tags/5.0.9 (copied) (copied from tabby-checkout/trunk)
-
tags/5.0.9/assets (copied) (copied from tabby-checkout/trunk/assets)
-
tags/5.0.9/assets/blocks/tabby-installments/index.js (copied) (copied from tabby-checkout/trunk/assets/blocks/tabby-installments/index.js)
-
tags/5.0.9/css (copied) (copied from tabby-checkout/trunk/css)
-
tags/5.0.9/css/tabby.css (copied) (copied from tabby-checkout/trunk/css/tabby.css)
-
tags/5.0.9/i18n (copied) (copied from tabby-checkout/trunk/i18n)
-
tags/5.0.9/i18n/languages/tabby-checkout-ar.mo (copied) (copied from tabby-checkout/trunk/i18n/languages/tabby-checkout-ar.mo)
-
tags/5.0.9/i18n/languages/tabby-checkout-ar.po (copied) (copied from tabby-checkout/trunk/i18n/languages/tabby-checkout-ar.po)
-
tags/5.0.9/i18n/languages/tabby-checkout.pot (copied) (copied from tabby-checkout/trunk/i18n/languages/tabby-checkout.pot)
-
tags/5.0.9/images (copied) (copied from tabby-checkout/trunk/images)
-
tags/5.0.9/includes (copied) (copied from tabby-checkout/trunk/includes)
-
tags/5.0.9/includes/class-wc-blocks-tabby-cart-promotion.php (copied) (copied from tabby-checkout/trunk/includes/class-wc-blocks-tabby-cart-promotion.php)
-
tags/5.0.9/includes/class-wc-blocks-tabby-installments.php (copied) (copied from tabby-checkout/trunk/includes/class-wc-blocks-tabby-installments.php)
-
tags/5.0.9/includes/class-wc-gateway-tabby-checkout-base.php (copied) (copied from tabby-checkout/trunk/includes/class-wc-gateway-tabby-checkout-base.php)
-
tags/5.0.9/includes/class-wc-gateway-tabby-credit-card-installments.php (copied) (copied from tabby-checkout/trunk/includes/class-wc-gateway-tabby-credit-card-installments.php)
-
tags/5.0.9/includes/class-wc-gateway-tabby-installments.php (copied) (copied from tabby-checkout/trunk/includes/class-wc-gateway-tabby-installments.php)
-
tags/5.0.9/includes/class-wc-rest-tabby-controller.php (copied) (copied from tabby-checkout/trunk/includes/class-wc-rest-tabby-controller.php)
-
tags/5.0.9/includes/class-wc-settings-tab-tabby.php (copied) (copied from tabby-checkout/trunk/includes/class-wc-settings-tab-tabby.php)
-
tags/5.0.9/includes/class-wc-tabby-ajax.php (copied) (copied from tabby-checkout/trunk/includes/class-wc-tabby-ajax.php)
-
tags/5.0.9/includes/class-wc-tabby-api-feed.php (copied) (copied from tabby-checkout/trunk/includes/class-wc-tabby-api-feed.php) (4 diffs)
-
tags/5.0.9/includes/class-wc-tabby-api.php (copied) (copied from tabby-checkout/trunk/includes/class-wc-tabby-api.php) (1 diff)
-
tags/5.0.9/includes/class-wc-tabby-config.php (copied) (copied from tabby-checkout/trunk/includes/class-wc-tabby-config.php)
-
tags/5.0.9/includes/class-wc-tabby-cron.php (copied) (copied from tabby-checkout/trunk/includes/class-wc-tabby-cron.php)
-
tags/5.0.9/includes/class-wc-tabby-feed-product-exception.php (copied) (copied from tabby-checkout/trunk/includes/class-wc-tabby-feed-product-exception.php)
-
tags/5.0.9/includes/class-wc-tabby-feed-product.php (copied) (copied from tabby-checkout/trunk/includes/class-wc-tabby-feed-product.php) (4 diffs)
-
tags/5.0.9/includes/class-wc-tabby-feed-sharing.php (copied) (copied from tabby-checkout/trunk/includes/class-wc-tabby-feed-sharing.php) (1 diff)
-
tags/5.0.9/includes/class-wc-tabby-promo.php (copied) (copied from tabby-checkout/trunk/includes/class-wc-tabby-promo.php)
-
tags/5.0.9/includes/class-wc-tabby-webhook.php (copied) (copied from tabby-checkout/trunk/includes/class-wc-tabby-webhook.php)
-
tags/5.0.9/includes/class-wc-tabby.php (copied) (copied from tabby-checkout/trunk/includes/class-wc-tabby.php)
-
tags/5.0.9/js (copied) (copied from tabby-checkout/trunk/js)
-
tags/5.0.9/js/tabby.js (copied) (copied from tabby-checkout/trunk/js/tabby.js)
-
tags/5.0.9/log (copied) (copied from tabby-checkout/trunk/log)
-
tags/5.0.9/readme.txt (copied) (copied from tabby-checkout/trunk/readme.txt) (2 diffs)
-
tags/5.0.9/tabby-checkout.php (copied) (copied from tabby-checkout/trunk/tabby-checkout.php) (2 diffs)
-
trunk/includes/class-wc-tabby-api-feed.php (modified) (4 diffs)
-
trunk/includes/class-wc-tabby-api.php (modified) (1 diff)
-
trunk/includes/class-wc-tabby-feed-product.php (modified) (4 diffs)
-
trunk/includes/class-wc-tabby-feed-sharing.php (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/tabby-checkout.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tabby-checkout/tags/5.0.9/includes/class-wc-tabby-api-feed.php
r3157667 r3158764 5 5 const TABBY_CHECKOUT_FEED_TOKEN_OPTION = 'tabby_checkout_feed_token'; 6 6 const TABBY_CHECKOUT_FEED_CRED_OPTION = 'tabby_checkout_feed_cred'; 7 const TABBY_CHECKOUT_FEED_REG_ATTEMPT = 'tabby_checkout_feed_reg_attempt'; 7 8 8 9 public static function isRegistered() { … … 18 19 delete_option(self::TABBY_CHECKOUT_FEED_TOKEN_OPTION); 19 20 delete_option(self::TABBY_CHECKOUT_FEED_CRED_OPTION); 21 delete_option(self::TABBY_CHECKOUT_FEED_REG_ATTEMPT); 20 22 21 23 return true; … … 26 28 27 29 // check if there is previous registration attempt 28 $reg_ tr = "tabby_feed_reg_attempt";29 if ( get_transient($reg_tr) !== false) {30 $reg_attempt_name = self::TABBY_CHECKOUT_FEED_REG_ATTEMPT; 31 if (time() < (int)get_option($reg_attempt_name, 0)) { 30 32 // bypass request 31 33 return false; … … 44 46 } else { 45 47 // registration failed - set transient to 4 hours 46 set_transient($reg_tr, true,4 * HOUR_IN_SECONDS);48 update_option($reg_attempt_name, time() + 4 * HOUR_IN_SECONDS); 47 49 48 50 // log site logo for failed registrations -
tabby-checkout/tags/5.0.9/includes/class-wc-tabby-api.php
r3157667 r3158764 9 9 } 10 10 return true; 11 } 12 13 public static function isSecretKeyProduction() { 14 $secret_key = self::get_api_option('secret_key', ""); 15 return preg_match("#^sk_[\da-f]{8}\-[\da-f]{4}\-[\da-f]{4}\-[\da-f]{4}\-[\da-f]{12}$#", $secret_key); 11 16 } 12 17 -
tabby-checkout/tags/5.0.9/includes/class-wc-tabby-feed-product.php
r3157667 r3158764 41 41 if (is_null($image)) unset($data['images'][$index]); 42 42 } 43 43 // images and price check 44 44 if (empty($data['images']) || empty($data['price'])) { 45 45 throw new \WC_Tabby_Feed_Product_Exception('No images for product'); … … 48 48 if (!empty($data['salePrice'])) { 49 49 $data['salePrice'] = get_woocommerce_currency() . ' ' . $data['salePrice']; 50 } 51 // empty categories array 52 if (empty($data[$tabby_lang]['categories'])) { 53 throw new \WC_Tabby_Feed_Product_Exception('No categories for product'); 54 } 55 // check for empty attributes values 56 foreach ($data[$tabby_lang]['attributes'] as $index => $attribute) { 57 if (empty($attribute['values'])) { 58 throw new \WC_Tabby_Feed_Product_Exception('Empty values array for attribute'); 59 } 50 60 } 51 61 return $data; … … 82 92 public static function getTabbyCategoryPath($product) { 83 93 $categories = []; 84 foreach (get_the_terms($product->get_id(), 'product_cat') as $term) { 85 $categories[] = [ 86 'path' => self::getCategoryPath($term), 87 // Tabby category ID, may be later add categories mapping 88 //'categoryId' => (string)$term->term_id 89 ]; 94 $terms = get_the_terms($product->get_id(), 'product_cat'); 95 if (is_array($terms)) { 96 foreach ($terms as $term) { 97 $categories[] = [ 98 'path' => self::getCategoryPath($term) 99 ]; 100 } 101 } 102 if (empty($categories)) { 103 $categories[] = ['path' => ['Uncategorized']]; 90 104 } 91 105 return $categories; … … 105 119 foreach ($product->get_attributes() as $code => $attribute) { 106 120 if (is_object($attribute)) { 107 $result[] = [ 108 'name' => $attribute->get_name(), 109 'values' => array_map(function ($item) {return (string)$item;}, array_values($attribute->get_options())) 110 ]; 121 $values = array_map(function ($item) {return (string)$item;}, array_values($attribute->get_options())); 122 if (!empty($values)) { 123 $result[] = [ 124 'name' => $attribute->get_name(), 125 'values' => $values 126 ]; 127 } 111 128 } else { 112 129 $result[] = [ -
tabby-checkout/tags/5.0.9/includes/class-wc-tabby-feed-sharing.php
r3157667 r3158764 9 9 10 10 public static function init() { 11 if (!WC_Tabby_Api::isSecretKeyProduction()) return false; 11 12 add_filter( 'cron_schedules', array(__CLASS__, 'add_every_five_minutes') ); 12 13 add_action(self::CRON_JOB_NAME, array(__CLASS__, 'cron_service')); -
tabby-checkout/tags/5.0.9/readme.txt
r3157668 r3158764 4 4 Requires at least: 5.7 5 5 Tested up to: 6.5 6 Stable tag: 5.0. 86 Stable tag: 5.0.9 7 7 Requires PHP: 7.0 8 8 License: GPLv3 … … 29 29 == Changelog == 30 30 31 = 5.0. 8=31 = 5.0.9 = 32 32 33 33 * Minor fixes -
tabby-checkout/tags/5.0.9/tabby-checkout.php
r3157667 r3158764 4 4 * Plugin URI: https://tabby.ai/ 5 5 * Description: Tabby Checkout 6 * Version: 5.0. 86 * Version: 5.0.9 7 7 * Author: Tabby 8 8 * Author URI: https://tabby.ai … … 14 14 defined( 'ABSPATH' ) || exit; 15 15 16 define ('MODULE_TABBY_CHECKOUT_VERSION', '5.0. 8');16 define ('MODULE_TABBY_CHECKOUT_VERSION', '5.0.9'); 17 17 define ('TABBY_CHECKOUT_DOMAIN', 'checkout.tabby.ai'); 18 18 define ('TABBY_CHECKOUT_API_DOMAIN', 'api.tabby.ai'); -
tabby-checkout/trunk/includes/class-wc-tabby-api-feed.php
r3157667 r3158764 5 5 const TABBY_CHECKOUT_FEED_TOKEN_OPTION = 'tabby_checkout_feed_token'; 6 6 const TABBY_CHECKOUT_FEED_CRED_OPTION = 'tabby_checkout_feed_cred'; 7 const TABBY_CHECKOUT_FEED_REG_ATTEMPT = 'tabby_checkout_feed_reg_attempt'; 7 8 8 9 public static function isRegistered() { … … 18 19 delete_option(self::TABBY_CHECKOUT_FEED_TOKEN_OPTION); 19 20 delete_option(self::TABBY_CHECKOUT_FEED_CRED_OPTION); 21 delete_option(self::TABBY_CHECKOUT_FEED_REG_ATTEMPT); 20 22 21 23 return true; … … 26 28 27 29 // check if there is previous registration attempt 28 $reg_ tr = "tabby_feed_reg_attempt";29 if ( get_transient($reg_tr) !== false) {30 $reg_attempt_name = self::TABBY_CHECKOUT_FEED_REG_ATTEMPT; 31 if (time() < (int)get_option($reg_attempt_name, 0)) { 30 32 // bypass request 31 33 return false; … … 44 46 } else { 45 47 // registration failed - set transient to 4 hours 46 set_transient($reg_tr, true,4 * HOUR_IN_SECONDS);48 update_option($reg_attempt_name, time() + 4 * HOUR_IN_SECONDS); 47 49 48 50 // log site logo for failed registrations -
tabby-checkout/trunk/includes/class-wc-tabby-api.php
r3157667 r3158764 9 9 } 10 10 return true; 11 } 12 13 public static function isSecretKeyProduction() { 14 $secret_key = self::get_api_option('secret_key', ""); 15 return preg_match("#^sk_[\da-f]{8}\-[\da-f]{4}\-[\da-f]{4}\-[\da-f]{4}\-[\da-f]{12}$#", $secret_key); 11 16 } 12 17 -
tabby-checkout/trunk/includes/class-wc-tabby-feed-product.php
r3157667 r3158764 41 41 if (is_null($image)) unset($data['images'][$index]); 42 42 } 43 43 // images and price check 44 44 if (empty($data['images']) || empty($data['price'])) { 45 45 throw new \WC_Tabby_Feed_Product_Exception('No images for product'); … … 48 48 if (!empty($data['salePrice'])) { 49 49 $data['salePrice'] = get_woocommerce_currency() . ' ' . $data['salePrice']; 50 } 51 // empty categories array 52 if (empty($data[$tabby_lang]['categories'])) { 53 throw new \WC_Tabby_Feed_Product_Exception('No categories for product'); 54 } 55 // check for empty attributes values 56 foreach ($data[$tabby_lang]['attributes'] as $index => $attribute) { 57 if (empty($attribute['values'])) { 58 throw new \WC_Tabby_Feed_Product_Exception('Empty values array for attribute'); 59 } 50 60 } 51 61 return $data; … … 82 92 public static function getTabbyCategoryPath($product) { 83 93 $categories = []; 84 foreach (get_the_terms($product->get_id(), 'product_cat') as $term) { 85 $categories[] = [ 86 'path' => self::getCategoryPath($term), 87 // Tabby category ID, may be later add categories mapping 88 //'categoryId' => (string)$term->term_id 89 ]; 94 $terms = get_the_terms($product->get_id(), 'product_cat'); 95 if (is_array($terms)) { 96 foreach ($terms as $term) { 97 $categories[] = [ 98 'path' => self::getCategoryPath($term) 99 ]; 100 } 101 } 102 if (empty($categories)) { 103 $categories[] = ['path' => ['Uncategorized']]; 90 104 } 91 105 return $categories; … … 105 119 foreach ($product->get_attributes() as $code => $attribute) { 106 120 if (is_object($attribute)) { 107 $result[] = [ 108 'name' => $attribute->get_name(), 109 'values' => array_map(function ($item) {return (string)$item;}, array_values($attribute->get_options())) 110 ]; 121 $values = array_map(function ($item) {return (string)$item;}, array_values($attribute->get_options())); 122 if (!empty($values)) { 123 $result[] = [ 124 'name' => $attribute->get_name(), 125 'values' => $values 126 ]; 127 } 111 128 } else { 112 129 $result[] = [ -
tabby-checkout/trunk/includes/class-wc-tabby-feed-sharing.php
r3157667 r3158764 9 9 10 10 public static function init() { 11 if (!WC_Tabby_Api::isSecretKeyProduction()) return false; 11 12 add_filter( 'cron_schedules', array(__CLASS__, 'add_every_five_minutes') ); 12 13 add_action(self::CRON_JOB_NAME, array(__CLASS__, 'cron_service')); -
tabby-checkout/trunk/readme.txt
r3157668 r3158764 4 4 Requires at least: 5.7 5 5 Tested up to: 6.5 6 Stable tag: 5.0. 86 Stable tag: 5.0.9 7 7 Requires PHP: 7.0 8 8 License: GPLv3 … … 29 29 == Changelog == 30 30 31 = 5.0. 8=31 = 5.0.9 = 32 32 33 33 * Minor fixes -
tabby-checkout/trunk/tabby-checkout.php
r3157667 r3158764 4 4 * Plugin URI: https://tabby.ai/ 5 5 * Description: Tabby Checkout 6 * Version: 5.0. 86 * Version: 5.0.9 7 7 * Author: Tabby 8 8 * Author URI: https://tabby.ai … … 14 14 defined( 'ABSPATH' ) || exit; 15 15 16 define ('MODULE_TABBY_CHECKOUT_VERSION', '5.0. 8');16 define ('MODULE_TABBY_CHECKOUT_VERSION', '5.0.9'); 17 17 define ('TABBY_CHECKOUT_DOMAIN', 'checkout.tabby.ai'); 18 18 define ('TABBY_CHECKOUT_API_DOMAIN', 'api.tabby.ai');
Note: See TracChangeset
for help on using the changeset viewer.