Plugin Directory

Changeset 3404633


Ignore:
Timestamp:
11/28/2025 05:44:56 AM (4 months ago)
Author:
akashmalik
Message:

Improvements and bug fixes

Location:
gratisfaction-all-in-one-loyalty-contests-referral-program-for-woocommerce
Files:
3 edited

Legend:

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

    r3404303 r3404633  
    40644064                            // Catches Exception in PHP 5.4+
    40654065                            $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) . ']';
    40694066                        }
    40704067                    }
  • gratisfaction-all-in-one-loyalty-contests-referral-program-for-woocommerce/trunk/grconnect.php

    r3404596 r3404633  
    33/**
    44 * @package Gratisfaction Connect
    5  * @version 4.5.4
     5 * @version 4.5.5
    66 */
    77/*
     
    99  Plugin URI: http://appsmav.com
    1010  Description: Loyalty + Referral + Rewards + Birthdays and Anniversaries + Giveaways + Sweepstakes.
    11   Version: 4.5.4
     11  Version: 4.5.5
    1212  Author: Appsmav
    1313  Author URI: http://appsmav.com
     
    4747        const REDEEM_COUPON = 'GRPAYPOINTS';
    4848
    49         public static $_plugin_version  = '4.5.4';
     49        public static $_plugin_version  = '4.5.5';
    5050        public static $_callback_url = 'https://gratisfaction.appsmav.com/';
    5151        public static $_api_version  = 'newapi/v2/';
     
    15621562        protected static function _curlResp($param,$url)
    15631563        {
    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            }
    15711575            return $resp;
    15721576        }
     
    31623166        public function gr_ajax_create_account()
    31633167        {
    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            }
    31713178        }
    31723179
     
    40374044         */
    40384045        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+
    40614073                                $data[$key] = '[Object: ' . get_class($value) . ']';
    40624074                            }
    4063                         } catch (Exception $e) {
    4064                             // Catches Exception in PHP 5.4+
    4065                             $data[$key] = '[Object: ' . get_class($value) . ']';
    40664075                        }
    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           
    40744084            return $data;
    40754085        }
    4076 
    40774086    }// END class GR_Connect
    40784087} // END if(!class_exists('GR_Connect'))
     
    42394248     */
    42404249    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
    42504263        return 0;
    42514264    }
  • gratisfaction-all-in-one-loyalty-contests-referral-program-for-woocommerce/trunk/readme.txt

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