Plugin Directory

Changeset 3078519


Ignore:
Timestamp:
04/29/2024 08:52:41 AM (22 months ago)
Author:
pinpointe
Message:

Fix error when making ajax calls

Location:
pinpointe-form-integration/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • pinpointe-form-integration/trunk/includes/pinpointe-form.inc.php

    r3070994 r3078519  
    2929    }
    3030}
    31 
    32 ?>
  • pinpointe-form-integration/trunk/includes/pinpointe-plugin-structure.inc.php

    r3070994 r3078519  
    608608    }
    609609}
    610 
    611 ?>
  • pinpointe-form-integration/trunk/includes/pinpointe-prepare-form.inc.php

    r3074988 r3078519  
    250250        // Title
    251251        if ($is_popup) {
    252             $html .= '<header>' . $title . '</header><i id="pinpointe_popup_close" class="icon-append fa-times" style="padding:10px 10px 0 0;cursor:pointer;"></i>';
     252            $html .= '<header>' . $title . '</header><i id="pinpointe_popup_close" class="icon-append fa-regular fa-circle-xmark" style="padding:10px 10px 0 0;cursor:pointer;"></i>';
    253253        }
    254254        else if (!empty($title)) {
     
    551551    }
    552552}
    553 
    554 ?>
  • pinpointe-form-integration/trunk/includes/pinpointe-service.class.php

    r3073079 r3078519  
    127127           
    128128            $response = wp_remote_post($this->apiUrl, $args);
    129            
     129
     130            $responseBody = wp_remote_retrieve_body($response);
     131
    130132            if (is_wp_error($response) || wp_remote_retrieve_response_code($response) !== 200) {
     133             
     134                if (is_array($response)) {
     135
     136                    $error_data = !$is_json ? json_encode($responseBody) : $responseBody;
     137
     138                    $error_message = reset(json_decode($error_data, true)['errormessage']);
     139                } else {
     140                    $error_message = $response->get_error_message();
     141                }
     142
    131143                throw new \Exception(
    132                     sprintf('API call of type %s failed: %s', $type , $response->get_error_message())
     144                    sprintf('API call of type %s failed: %s', $type , $error_message)
    133145                );
    134146            }
    135            
    136             $responseBody = wp_remote_retrieve_body($response);
    137147
    138148            $response = $is_json ? json_decode($responseBody) : simplexml_load_string($responseBody);
    139149
    140             if ($response->status == 'SUCCESS') {
     150            if ($response->status === 'SUCCESS') {
    141151                if (isset($data['id']) && $data['id'] == '-999') {
    142152                    return true;
    143153                }
    144154                return $this->xmlToArray($response->data);
    145             }
    146             else {
    147                 throw new \Exception(sprintf('There was a problem: %s', $responseBody));
    148             }
     155            }
     156
     157            throw new \Exception(sprintf('There was a problem: %s', $responseBody));
    149158        }
    150159
     
    342351         */
    343352        public function lists_subscribe($id, $email, $merge_vars = array(), $email_type = 'html',
    344                                         $add_to_autoresponders = false, $update_existing = false, $tag_ids, $send_confirmation = false, $custom_data = []) {
     353                                        $add_to_autoresponders = false, $update_existing = false, $tag_ids = [], $send_confirmation = false, $custom_data = []) {
    345354            if(!is_string($email)) {
    346355                $email = $email['email'];
  • pinpointe-form-integration/trunk/includes/pinpointe-widget.class.php

    r3065401 r3078519  
    154154    }
    155155}
    156 
    157 ?>
  • pinpointe-form-integration/trunk/pinpointe-signup-form.php

    r3077542 r3078519  
    44 * Plugin URI: https://help.pinpointe.com/support/solutions/articles/5000664320-wordpress-plugin-download
    55 * Description: Add Pinpointe forms to your WordPress site
    6  * Version: 1.6
     6 * Version: 1.7
    77 * Author: Pinpointe
    88 * Author URI: http://www.pinpointe.com/
     
    31313131                    return $results;
    31323132                }
    3133                 else {
    3134                     return true;
    3135                 }
     3133
     3134                return true;
    31363135            }
    31373136            catch (Exception $e) {
     
    46934692
    46944693$GLOBALS['PinpointeSignupForm'] = PinpointeSignupForm::get_instance();
    4695 
    4696 ?>
  • pinpointe-form-integration/trunk/readme.txt

    r3075038 r3078519  
    44Requires at least: 3.5
    55Tested up to: 6.4.2
    6 Stable tag: 1.6
     6Stable tag: 1.7
    77Requires PHP: 5.4
    88License: GPLv3 or later
     
    6060
    6161== Changelog ==
     621.7
     63* Replace deprecated Jquery chosen plugin with Tom Select.
     64* Update Font Awesome 4 to Font Awesome 6
     65* Fixed undefined method get_error_message() on array when making a request using wp_remote_post
     66* Fixed popup modal not showing on frontend pages.
     67* Upgrade dependencies to their latest versions.
     68* Add nonce to all ajax handlers.
     69* Ensure a mailing list is selected on both admin and frontend
     70
    62711.6
    6372* Added ability to display multiple mailing lists on the subscription form
Note: See TracChangeset for help on using the changeset viewer.