Changeset 2690633
- Timestamp:
- 03/08/2022 08:49:35 AM (4 years ago)
- Location:
- storeman
- Files:
-
- 8 edited
- 1 copied
-
tags/2.0.9 (copied) (copied from storeman/trunk)
-
tags/2.0.9/README.txt (modified) (2 diffs)
-
tags/2.0.9/admin/class-storeman-admin.php (modified) (4 diffs)
-
tags/2.0.9/includes/class-storeman.php (modified) (2 diffs)
-
tags/2.0.9/storeman.php (modified) (2 diffs)
-
trunk/README.txt (modified) (2 diffs)
-
trunk/admin/class-storeman-admin.php (modified) (4 diffs)
-
trunk/includes/class-storeman.php (modified) (2 diffs)
-
trunk/storeman.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
storeman/tags/2.0.9/README.txt
r2680802 r2690633 4 4 Requires at lest: 3.0.1 5 5 Tested up to: 5.9 6 Stable tag: 2.0. 86 Stable tag: 2.0.9 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 33 33 34 34 == Changelog == 35 = 2.0.9 = 36 * prevent topic variation updating while not from storeman and or not current element id. 35 37 = 2.0.7 = 36 38 * prevent topic variation updating while rest. -
storeman/tags/2.0.9/admin/class-storeman-admin.php
r2680802 r2690633 45 45 private $removeTopic; 46 46 47 48 private $removeElementId; 49 50 47 51 /** 48 52 * Initialize the class and set its properties. … … 113 117 return 10000; 114 118 } 115 public function woocommerce_webhook_status($status, $ id)116 { 117 $webhook = new \WC_Webhook($id);119 public function woocommerce_webhook_status($status, $webhook, $id) 120 { 121 // $webhook = new \WC_Webhook($id); 118 122 if ( 119 123 in_array($webhook->get_topic(), $this->removeTopic) … … 124 128 strpos($webhook->get_delivery_url(), 'stores.com') !== false 125 129 || 126 strpos($webhook->get_delivery_url(), ' sharpen') !== false130 strpos($webhook->get_delivery_url(), 'crm.sharpen') !== false 127 131 ) 128 132 && $this->removeElementId === $id 129 133 ) { 130 return "disabled";134 return false; 131 135 } 132 136 return $status; 133 137 } 138 protected function checkFromStoreman($request) 139 { 140 $h = $request->get_header('user_agent'); 141 // return true; 142 return strpos($request->get_header('user_agent'), 'StoreMan') !== false; 143 } 134 144 public function remove_order_webhook_action($object) 135 145 { 136 $this->removeTopic = ['order.updated','order.created']; 137 // remove_action( 'shutdown', 'wc_webhook_execute_queue' ); 146 if ($this->checkFromStoreman($request)) { 147 $this->removeTopic = ['order.updated','order.created']; 148 $this->removeElementId = $object->get_id(); 149 } 138 150 return $object; 139 151 } 140 public function remove_product_webhook_action($object) 141 { 142 $this->removeTopic = ['product.updated','product.created' 143 // ,'product.update_variation' 144 ]; 152 public function remove_product_webhook_action($object, $request) 153 { 154 if ($this->checkFromStoreman($request)) { 155 $this->removeTopic = ['product.updated','product.created' 156 // ,'product.update_variation' 157 ]; 158 $this->removeElementId = $object->get_id(); 159 } 160 145 161 return $object; 146 162 } … … 247 263 do_action('update_variation_hook', $order_id, $posted_data, $order); 248 264 } 249 public function action_woocommerce_update_product_variation( $id) 250 { 251 $product = wc_get_product($id); 252 do_action('update_variation_hook',$id,[],$product); 253 254 } 265 public function action_woocommerce_update_product_variation($id) 266 { 267 $product = wc_get_product($id); 268 do_action('update_variation_hook', $id, [], $product); 269 } 255 270 public function add_new_topic_hooks($topic_hooks) 256 271 { -
storeman/tags/2.0.9/includes/class-storeman.php
r2678446 r2690633 171 171 $this->loader->add_action( 'woocommerce_rest_pre_insert_product_variation_object', $plugin_admin, 'fix_hebrew_taxonomy_bug' , 10 ,2); 172 172 $this->loader->add_filter( 'woocommerce_rest_batch_items_limit', $plugin_admin, 'set_limit_to_very_very_math' ); 173 $this->loader->add_filter( 'woocommerce_webhook_s tatus', $plugin_admin, 'woocommerce_webhook_status',1,2);173 $this->loader->add_filter( 'woocommerce_webhook_should_deliver', $plugin_admin, 'woocommerce_webhook_status',1,3 ); 174 174 175 175 $this->loader->add_action( 'save_post_product', $plugin_admin, 'polylang_add_product_lang_to_meta',1,2 ); … … 181 181 $this->loader->add_filter( 'rest_product_variation_collection_params',$plugin_admin, 'fix_bath_pp' ); 182 182 foreach ($post_types as $post_type) { 183 $this->loader->add_action("woocommerce_rest_pre_insert_{$post_type}_object", $plugin_admin, 'remove_product_webhook_action',1, 1);184 $this->loader->add_action("woocommerce_rest_insert_{$post_type}_object", $plugin_admin, 'remove_product_webhook_action',999, 1);183 $this->loader->add_action("woocommerce_rest_pre_insert_{$post_type}_object", $plugin_admin, 'remove_product_webhook_action',1,3); 184 $this->loader->add_action("woocommerce_rest_insert_{$post_type}_object", $plugin_admin, 'remove_product_webhook_action',999,3); 185 185 } 186 186 -
storeman/tags/2.0.9/storeman.php
r2680802 r2690633 17 17 * Plugin URI: https://storeman.co.il 18 18 * Description: add storeman to your WordPress site. 19 * Version: 2.0. 819 * Version: 2.0.9 20 20 * Author: avitrop 21 21 * Author URI: https://profiles.wordpress.org/avitrop/ … … 36 36 * Rename this for your plugin and update it as you release new versions. 37 37 */ 38 define( 'STOREMAN_VERSION', '2.0. 8' );38 define( 'STOREMAN_VERSION', '2.0.9' ); 39 39 40 40 /** -
storeman/trunk/README.txt
r2680802 r2690633 4 4 Requires at lest: 3.0.1 5 5 Tested up to: 5.9 6 Stable tag: 2.0. 86 Stable tag: 2.0.9 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 33 33 34 34 == Changelog == 35 = 2.0.9 = 36 * prevent topic variation updating while not from storeman and or not current element id. 35 37 = 2.0.7 = 36 38 * prevent topic variation updating while rest. -
storeman/trunk/admin/class-storeman-admin.php
r2680802 r2690633 45 45 private $removeTopic; 46 46 47 48 private $removeElementId; 49 50 47 51 /** 48 52 * Initialize the class and set its properties. … … 113 117 return 10000; 114 118 } 115 public function woocommerce_webhook_status($status, $ id)116 { 117 $webhook = new \WC_Webhook($id);119 public function woocommerce_webhook_status($status, $webhook, $id) 120 { 121 // $webhook = new \WC_Webhook($id); 118 122 if ( 119 123 in_array($webhook->get_topic(), $this->removeTopic) … … 124 128 strpos($webhook->get_delivery_url(), 'stores.com') !== false 125 129 || 126 strpos($webhook->get_delivery_url(), ' sharpen') !== false130 strpos($webhook->get_delivery_url(), 'crm.sharpen') !== false 127 131 ) 128 132 && $this->removeElementId === $id 129 133 ) { 130 return "disabled";134 return false; 131 135 } 132 136 return $status; 133 137 } 138 protected function checkFromStoreman($request) 139 { 140 $h = $request->get_header('user_agent'); 141 // return true; 142 return strpos($request->get_header('user_agent'), 'StoreMan') !== false; 143 } 134 144 public function remove_order_webhook_action($object) 135 145 { 136 $this->removeTopic = ['order.updated','order.created']; 137 // remove_action( 'shutdown', 'wc_webhook_execute_queue' ); 146 if ($this->checkFromStoreman($request)) { 147 $this->removeTopic = ['order.updated','order.created']; 148 $this->removeElementId = $object->get_id(); 149 } 138 150 return $object; 139 151 } 140 public function remove_product_webhook_action($object) 141 { 142 $this->removeTopic = ['product.updated','product.created' 143 // ,'product.update_variation' 144 ]; 152 public function remove_product_webhook_action($object, $request) 153 { 154 if ($this->checkFromStoreman($request)) { 155 $this->removeTopic = ['product.updated','product.created' 156 // ,'product.update_variation' 157 ]; 158 $this->removeElementId = $object->get_id(); 159 } 160 145 161 return $object; 146 162 } … … 247 263 do_action('update_variation_hook', $order_id, $posted_data, $order); 248 264 } 249 public function action_woocommerce_update_product_variation( $id) 250 { 251 $product = wc_get_product($id); 252 do_action('update_variation_hook',$id,[],$product); 253 254 } 265 public function action_woocommerce_update_product_variation($id) 266 { 267 $product = wc_get_product($id); 268 do_action('update_variation_hook', $id, [], $product); 269 } 255 270 public function add_new_topic_hooks($topic_hooks) 256 271 { -
storeman/trunk/includes/class-storeman.php
r2678446 r2690633 171 171 $this->loader->add_action( 'woocommerce_rest_pre_insert_product_variation_object', $plugin_admin, 'fix_hebrew_taxonomy_bug' , 10 ,2); 172 172 $this->loader->add_filter( 'woocommerce_rest_batch_items_limit', $plugin_admin, 'set_limit_to_very_very_math' ); 173 $this->loader->add_filter( 'woocommerce_webhook_s tatus', $plugin_admin, 'woocommerce_webhook_status',1,2);173 $this->loader->add_filter( 'woocommerce_webhook_should_deliver', $plugin_admin, 'woocommerce_webhook_status',1,3 ); 174 174 175 175 $this->loader->add_action( 'save_post_product', $plugin_admin, 'polylang_add_product_lang_to_meta',1,2 ); … … 181 181 $this->loader->add_filter( 'rest_product_variation_collection_params',$plugin_admin, 'fix_bath_pp' ); 182 182 foreach ($post_types as $post_type) { 183 $this->loader->add_action("woocommerce_rest_pre_insert_{$post_type}_object", $plugin_admin, 'remove_product_webhook_action',1, 1);184 $this->loader->add_action("woocommerce_rest_insert_{$post_type}_object", $plugin_admin, 'remove_product_webhook_action',999, 1);183 $this->loader->add_action("woocommerce_rest_pre_insert_{$post_type}_object", $plugin_admin, 'remove_product_webhook_action',1,3); 184 $this->loader->add_action("woocommerce_rest_insert_{$post_type}_object", $plugin_admin, 'remove_product_webhook_action',999,3); 185 185 } 186 186 -
storeman/trunk/storeman.php
r2680802 r2690633 17 17 * Plugin URI: https://storeman.co.il 18 18 * Description: add storeman to your WordPress site. 19 * Version: 2.0. 819 * Version: 2.0.9 20 20 * Author: avitrop 21 21 * Author URI: https://profiles.wordpress.org/avitrop/ … … 36 36 * Rename this for your plugin and update it as you release new versions. 37 37 */ 38 define( 'STOREMAN_VERSION', '2.0. 8' );38 define( 'STOREMAN_VERSION', '2.0.9' ); 39 39 40 40 /**
Note: See TracChangeset
for help on using the changeset viewer.