Popups by OptinMonster – Best WordPress Lead Generation Plugin - Version 1.1.6.2

Version Description

  • Fixed undefined index errors when API responses returned an error.
Download this release

Release Info

Developer griffinjt
Plugin Icon 128x128 Popups by OptinMonster – Best WordPress Lead Generation Plugin
Version 1.1.6.2
Comparing to
See all releases

Code changes from version 1.1.6.1 to 1.1.6.2

Files changed (3) hide show
  1. OMAPI/Api.php +3 -1
  2. optin-monster-wp-api.php +2 -2
  3. readme.txt +3 -0
OMAPI/Api.php CHANGED
@@ -161,7 +161,9 @@ class OMAPI_Api {
161
 
162
  // If not a 200 status header, send back error.
163
  if ( 200 != $response_code ) {
164
- return new WP_Error( $response_body->type, sprintf( __( 'The API returned a <strong>%s</strong> response with this message: <strong>%s</strong>', 'optin-monster-api' ), $response_code, stripslashes( $response_body->error ) ) );
 
 
165
  }
166
 
167
  // Return the json decoded content.
161
 
162
  // If not a 200 status header, send back error.
163
  if ( 200 != $response_code ) {
164
+ $type = ! empty( $response_body->type ) ? $response_body->type : 'api-error';
165
+ $error = ! empty( $response_body->error ) ? stripslashes( $response_body->error ) : '';
166
+ return new WP_Error( $type, sprintf( __( 'The API returned a <strong>%s</strong> response with this message: <strong>%s</strong>', 'optin-monster-api' ), $response_code, $error ) );
167
  }
168
 
169
  // Return the json decoded content.
optin-monster-wp-api.php CHANGED
@@ -5,7 +5,7 @@
5
  * Description: OptinMonster API plugin to connect your WordPress site to your OptinMonster forms.
6
  * Author: Thomas Griffin
7
  * Author URI: https://thomasgriffin.io
8
- * Version: 1.1.6.1
9
  * Text Domain: optin-monster-api
10
  * Domain Path: languages
11
  *
@@ -60,7 +60,7 @@ class OMAPI {
60
  *
61
  * @var string
62
  */
63
- public $version = '1.1.6.1';
64
 
65
  /**
66
  * The name of the plugin.
5
  * Description: OptinMonster API plugin to connect your WordPress site to your OptinMonster forms.
6
  * Author: Thomas Griffin
7
  * Author URI: https://thomasgriffin.io
8
+ * Version: 1.1.6.2
9
  * Text Domain: optin-monster-api
10
  * Domain Path: languages
11
  *
60
  *
61
  * @var string
62
  */
63
+ public $version = '1.1.6.2';
64
 
65
  /**
66
  * The name of the plugin.
readme.txt CHANGED
@@ -160,6 +160,9 @@ OptinMonster is the <a href="http://optinmonster.com" rel="friend" title="OptinM
160
 
161
  == Changelog ==
162
 
 
 
 
163
  = 1.1.6.1 =
164
  * General plugin enhancements and bug fixes.
165
 
160
 
161
  == Changelog ==
162
 
163
+ = 1.1.6.2 =
164
+ * Fixed undefined index errors when API responses returned an error.
165
+
166
  = 1.1.6.1 =
167
  * General plugin enhancements and bug fixes.
168