Changeset 3404633
- Timestamp:
- 11/28/2025 05:44:56 AM (4 months ago)
- Location:
- gratisfaction-all-in-one-loyalty-contests-referral-program-for-woocommerce
- Files:
-
- 3 edited
-
tags/4.5.4/grconnect.php (modified) (1 diff)
-
trunk/grconnect.php (modified) (7 diffs)
-
trunk/readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
gratisfaction-all-in-one-loyalty-contests-referral-program-for-woocommerce/tags/4.5.4/grconnect.php
r3404303 r3404633 4064 4064 // Catches Exception in PHP 5.4+ 4065 4065 $data[$key] = '[Object: ' . get_class($value) . ']'; 4066 } catch (Error $e) {4067 // Catches Error in PHP 7.0+ (TypeError, etc.)4068 $data[$key] = '[Object: ' . get_class($value) . ']';4069 4066 } 4070 4067 } -
gratisfaction-all-in-one-loyalty-contests-referral-program-for-woocommerce/trunk/grconnect.php
r3404596 r3404633 3 3 /** 4 4 * @package Gratisfaction Connect 5 * @version 4.5. 45 * @version 4.5.5 6 6 */ 7 7 /* … … 9 9 Plugin URI: http://appsmav.com 10 10 Description: Loyalty + Referral + Rewards + Birthdays and Anniversaries + Giveaways + Sweepstakes. 11 Version: 4.5. 411 Version: 4.5.5 12 12 Author: Appsmav 13 13 Author URI: http://appsmav.com … … 47 47 const REDEEM_COUPON = 'GRPAYPOINTS'; 48 48 49 public static $_plugin_version = '4.5. 4';49 public static $_plugin_version = '4.5.5'; 50 50 public static $_callback_url = 'https://gratisfaction.appsmav.com/'; 51 51 public static $_api_version = 'newapi/v2/'; … … 1562 1562 protected static function _curlResp($param,$url) 1563 1563 { 1564 $response = wp_remote_post($url,array('body'=> $param,'timeout' => 10)); 1565 if (is_array($response) && !empty($response['body'])) { 1566 $resp = json_decode($response['body'], true); 1567 } else { 1568 $resp['error'] = 1; 1569 } 1570 1564 $resp = []; 1565 try { 1566 $response = wp_remote_post($url,array('body'=> $param,'timeout' => 10)); 1567 if (is_array($response) && !empty($response['body'])) { 1568 $resp = json_decode($response['body'], true); 1569 } else { 1570 $resp['error'] = 1; 1571 } 1572 } catch(Exception $e) { 1573 $resp['error'] = 1; 1574 } 1571 1575 return $resp; 1572 1576 } … … 3162 3166 public function gr_ajax_create_account() 3163 3167 { 3164 // Verify nonce 3165 $msg = self::_checkNonce(); 3166 if (!empty($msg)) { 3167 die(json_encode(['gr_reg' => 4, 'message' => $msg])); 3168 } 3169 3170 self::callAcctRegister($_POST); 3168 try { 3169 // Verify nonce 3170 $msg = self::_checkNonce(); 3171 if (!empty($msg)) { 3172 die(json_encode(['gr_reg' => 4, 'message' => $msg])); 3173 } 3174 3175 self::callAcctRegister($_POST); 3176 } catch(Exception $e) { 3177 } 3171 3178 } 3172 3179 … … 4037 4044 */ 4038 4045 public static function sanitize_refund_data_for_api($data) { 4039 if (is_array($data)) { 4040 foreach ($data as $key => $value) { 4041 if (is_object($value)) { 4042 try { 4043 // Handle WC_DateTime objects 4044 if ($value instanceof WC_DateTime) { 4045 $data[$key] = $value->format('c'); // ISO 8601 format 4046 } 4047 // Handle stdClass objects 4048 elseif ($value instanceof stdClass) { 4049 $data[$key] = self::sanitize_refund_data_for_api(get_object_vars($value)); 4050 } 4051 // Handle WooCommerce data objects 4052 elseif (method_exists($value, 'get_data')) { 4053 $data[$key] = self::sanitize_refund_data_for_api($value->get_data()); 4054 } 4055 // Handle objects with __toString method 4056 elseif (method_exists($value, '__toString')) { 4057 $data[$key] = (string) $value; 4058 } 4059 // Fallback for any other object 4060 else { 4046 try { 4047 if (is_array($data)) { 4048 foreach ($data as $key => $value) { 4049 if (is_object($value)) { 4050 try { 4051 // Handle WC_DateTime objects 4052 if ($value instanceof WC_DateTime) { 4053 $data[$key] = $value->format('c'); // ISO 8601 format 4054 } 4055 // Handle stdClass objects 4056 elseif ($value instanceof stdClass) { 4057 $data[$key] = self::sanitize_refund_data_for_api(get_object_vars($value)); 4058 } 4059 // Handle WooCommerce data objects 4060 elseif (method_exists($value, 'get_data')) { 4061 $data[$key] = self::sanitize_refund_data_for_api($value->get_data()); 4062 } 4063 // Handle objects with __toString method 4064 elseif (method_exists($value, '__toString')) { 4065 $data[$key] = (string) $value; 4066 } 4067 // Fallback for any other object 4068 else { 4069 $data[$key] = '[Object: ' . get_class($value) . ']'; 4070 } 4071 } catch (Exception $e) { 4072 // Catches Exception in PHP 5.4+ 4061 4073 $data[$key] = '[Object: ' . get_class($value) . ']'; 4062 4074 } 4063 } catch (Exception $e) {4064 // Catches Exception in PHP 5.4+4065 $data[$key] = '[Object: ' . get_class($value) . ']';4066 4075 } 4067 } 4068 elseif (is_array($value)) { 4069 $data[$key] = self::sanitize_refund_data_for_api($value); 4070 } 4071 } 4072 } 4073 4076 elseif (is_array($value)) { 4077 $data[$key] = self::sanitize_refund_data_for_api($value); 4078 } 4079 } 4080 } 4081 } catch(Exception $e) { 4082 } 4083 4074 4084 return $data; 4075 4085 } 4076 4077 4086 }// END class GR_Connect 4078 4087 } // END if(!class_exists('GR_Connect')) … … 4239 4248 */ 4240 4249 function appsmav_get_parent_id($object) { 4241 if (empty($object)) { 4242 return 0; 4243 } 4244 if (method_exists($object, 'get_parent_id')) { 4245 return $object->get_parent_id(); // WC 3.0+ 4246 } 4247 if (isset($object->post->post_parent)) { 4248 return $object->post->post_parent; // WC < 3.0 4249 } 4250 try { 4251 if (empty($object)) { 4252 return 0; 4253 } 4254 if (method_exists($object, 'get_parent_id')) { 4255 return $object->get_parent_id(); // WC 3.0+ 4256 } 4257 if (isset($object->post->post_parent)) { 4258 return $object->post->post_parent; // WC < 3.0 4259 } 4260 } catch(Exception $e) { 4261 } 4262 4250 4263 return 0; 4251 4264 } -
gratisfaction-all-in-one-loyalty-contests-referral-program-for-woocommerce/trunk/readme.txt
r3404303 r3404633 5 5 Requires at least: 3.0.1 6 6 Tested up to: 6.8 7 Stable tag: 4.5. 47 Stable tag: 4.5.5 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 254 254 255 255 == Changelog == 256 = 4.5.5 = 257 Improvements and bug fixes 258 256 259 = 4.5.4 = 257 260 Improvements and bug fixes … … 626 629 627 630 == Upgrade Notice == 628 = 4.5. 4=629 Improvements and bug fixes 631 = 4.5.5 = 632 Improvements and bug fixes
Note: See TracChangeset
for help on using the changeset viewer.