Plugin Directory

Changeset 3404303


Ignore:
Timestamp:
11/27/2025 05:29:06 PM (4 months ago)
Author:
akashmalik
Message:

Improvements and bug fixes

Location:
gratisfaction-all-in-one-loyalty-contests-referral-program-for-woocommerce/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • gratisfaction-all-in-one-loyalty-contests-referral-program-for-woocommerce/trunk/grconnect.php

    r3398568 r3404303  
    33/**
    44 * @package Gratisfaction Connect
    5  * @version 4.5.3
     5 * @version 4.5.4
    66 */
    77/*
     
    99  Plugin URI: http://appsmav.com
    1010  Description: Loyalty + Referral + Rewards + Birthdays and Anniversaries + Giveaways + Sweepstakes.
    11   Version: 4.5.3
     11  Version: 4.5.4
    1212  Author: Appsmav
    1313  Author URI: http://appsmav.com
     
    4747        const REDEEM_COUPON = 'GRPAYPOINTS';
    4848
    49         public static $_plugin_version  = '4.5.3';
     49        public static $_plugin_version  = '4.5.4';
    5050        public static $_callback_url = 'https://gratisfaction.appsmav.com/';
    5151        public static $_api_version  = 'newapi/v2/';
     
    40344034
    40354035        /**
    4036          * Sanitize refund data to handle WC_DateTime objects and other non-serializable data
     4036         * Sanitize refund data to handle WC_DateTime objects and other non-serializable data Works on PHP 5.4+
    40374037         */
    40384038        public static function sanitize_refund_data_for_api($data) {
     
    40404040                foreach ($data as $key => $value) {
    40414041                    if (is_object($value)) {
    4042                         // Handle WC_DateTime objects
    4043                         if (is_a($value, 'WC_DateTime')) {
    4044                             $data[$key] = $value->format('c'); // ISO 8601 format
    4045                         }
    4046                         // Handle other WooCommerce objects
    4047                         elseif (method_exists($value, 'get_data')) {
    4048                             $data[$key] = self::sanitize_refund_data_for_api($value->get_data());
    4049                         }
    4050                         // Handle other objects by converting to string
    4051                         else {
    4052                             $data[$key] = (string) $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 {
     4061                                $data[$key] = '[Object: ' . get_class($value) . ']';
     4062                            }
     4063                        } catch (Exception $e) {
     4064                            // Catches Exception in PHP 5.4+
     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) . ']';
    40534069                        }
    40544070                    }
     
    40584074                }
    40594075            }
     4076
    40604077            return $data;
    40614078        }
     4079
    40624080    }// END class GR_Connect
    40634081} // END if(!class_exists('GR_Connect'))
  • gratisfaction-all-in-one-loyalty-contests-referral-program-for-woocommerce/trunk/readme.txt

    r3398568 r3404303  
    55Requires at least: 3.0.1
    66Tested up to: 6.8
    7 Stable tag: 4.5.3
     7Stable tag: 4.5.4
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    254254
    255255== Changelog ==
     256= 4.5.4 =
     257Improvements and bug fixes
     258
    256259= 4.5.3 =
    257260Improvements and bug fixes
     
    623626
    624627== Upgrade Notice ==
    625 = 4.5.3 =
    626 Improvements and bug fixes
     628= 4.5.4 =
     629Improvements and bug fixes
Note: See TracChangeset for help on using the changeset viewer.