Version Description
- Updated the API script domain for adblock.
- Added new authentication method for the new OptinMonster REST API.
Download this release
Release Info
Developer | channeleaton |
Plugin | Popups by OptinMonster – Best WordPress Lead Generation Plugin |
Version | 1.1.7 |
Comparing to | |
See all releases |
Code changes from version 1.1.6.2 to 1.1.7
- OMAPI/Api.php +12 -6
- OMAPI/Content.php +19 -6
- OMAPI/Menu.php +13 -4
- OMAPI/Refresh.php +8 -1
- OMAPI/Save.php +55 -1
- OMAPI/Validate.php +8 -1
- assets/js/clipboard.min.js +0 -0
- assets/js/jspdf.min.js +0 -0
- optin-monster-wp-api.php +26 -10
- readme.txt +6 -2
OMAPI/Api.php
CHANGED
@@ -99,6 +99,7 @@ class OMAPI_Api {
|
|
99 |
$this->method = $method;
|
100 |
$this->user = $creds['user'];
|
101 |
$this->key = $creds['key'];
|
|
|
102 |
$this->plugin = OMAPI::get_instance()->plugin_slug;
|
103 |
|
104 |
}
|
@@ -132,14 +133,19 @@ class OMAPI_Api {
|
|
132 |
|
133 |
// Build the headers of the request.
|
134 |
$headers = array(
|
135 |
-
'Content-Type'
|
136 |
-
'Cache-Control'
|
137 |
-
'Pragma'
|
138 |
-
'Expires'
|
139 |
-
'OMAPI-Referer'
|
140 |
-
'OMAPI-Sender'
|
141 |
);
|
142 |
|
|
|
|
|
|
|
|
|
|
|
143 |
// Setup data to be sent to the API.
|
144 |
$data = array(
|
145 |
'headers' => $headers,
|
99 |
$this->method = $method;
|
100 |
$this->user = $creds['user'];
|
101 |
$this->key = $creds['key'];
|
102 |
+
$this->apikey = $creds['apikey'];
|
103 |
$this->plugin = OMAPI::get_instance()->plugin_slug;
|
104 |
|
105 |
}
|
133 |
|
134 |
// Build the headers of the request.
|
135 |
$headers = array(
|
136 |
+
'Content-Type' => 'application/x-www-form-urlencoded',
|
137 |
+
'Cache-Control' => 'no-store, no-cache, must-revalidate, max-age=0, post-check=0, pre-check=0',
|
138 |
+
'Pragma' => 'no-cache',
|
139 |
+
'Expires' => 0,
|
140 |
+
'OMAPI-Referer' => site_url(),
|
141 |
+
'OMAPI-Sender' => 'WordPress',
|
142 |
);
|
143 |
|
144 |
+
|
145 |
+
if ( $this->apikey ) {
|
146 |
+
$headers['X-OptinMonster-ApiKey'] = $this->apikey;
|
147 |
+
}
|
148 |
+
|
149 |
// Setup data to be sent to the API.
|
150 |
$data = array(
|
151 |
'headers' => $headers,
|
OMAPI/Content.php
CHANGED
@@ -182,12 +182,25 @@ class OMAPI_Content {
|
|
182 |
|
183 |
$link = $this->base->menu->get_action_link();
|
184 |
$text = $this->base->menu->has_trial_link() ? 'Click here to start your free 30-day trial!' : 'Click here to view OptinMonster plans and pricing.';
|
185 |
-
|
|
|
|
|
|
|
186 |
<p class="omapi-red"><strong><?php _e( 'You must authenticate your OptinMonster account before you can use OptinMonster on this site.', 'optin-monster-api' ); ?></strong></p>
|
187 |
<p><em><?php printf( __( 'Need an OptinMonster account? <a href="%s" title="Click here to view OptinMonster plans and pricing" target="_blank">%s</a>', 'optin-monster-api' ), $link, $text ); ?></em></p>
|
188 |
<?php endif; ?>
|
189 |
-
|
190 |
-
<?php echo $object->get_setting_ui( 'api', '
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
191 |
<?php
|
192 |
|
193 |
}
|
@@ -335,13 +348,13 @@ class OMAPI_Content {
|
|
335 |
*/
|
336 |
public function get_optin_links( $optin_id ) {
|
337 |
|
338 |
-
$
|
339 |
-
$
|
340 |
$status = (bool) get_post_meta( $optin_id, '_omapi_enabled', true );
|
341 |
$status_link = $status ? __( 'Disable', 'optin-monster-api' ) : __( 'Go Live', 'optin-monster-api' );
|
342 |
$status_desc = $status ? esc_attr__( 'Disable this optin', 'optin-monster-api' ) : esc_attr__( 'Go live with this optin', 'optin-monster-api' );
|
343 |
$links = array();
|
344 |
-
$links['editd'] = '<a href="' . esc_url_raw(
|
345 |
$links['edito'] = '<a href="' . esc_url_raw( add_query_arg( array( 'optin_monster_api_view' => $this->view, 'optin_monster_api_action' => 'edit', 'optin_monster_api_id' => $optin_id ), admin_url( 'admin.php?page=optin-monster-api-settings' ) ) ) . '" title="' . esc_attr__( 'Edit the output settings for this optin', 'optin-monster-api' ) . '">Edit Output Settings</a>';
|
346 |
$links['status'] = '<a href="' . wp_nonce_url( esc_url_raw( add_query_arg( array( 'optin_monster_api_view' => $this->view, 'optin_monster_api_action' => 'status', 'optin_monster_api_id' => $optin_id ), admin_url( 'admin.php?page=optin-monster-api-settings' ) ) ), 'omapi-action' ) . '" title="' . $status_desc . '">' . $status_link . '</a>';
|
347 |
|
182 |
|
183 |
$link = $this->base->menu->get_action_link();
|
184 |
$text = $this->base->menu->has_trial_link() ? 'Click here to start your free 30-day trial!' : 'Click here to view OptinMonster plans and pricing.';
|
185 |
+
|
186 |
+
$credentials = $this->base->get_api_credentials();
|
187 |
+
|
188 |
+
if ( ! $credentials ) : ?>
|
189 |
<p class="omapi-red"><strong><?php _e( 'You must authenticate your OptinMonster account before you can use OptinMonster on this site.', 'optin-monster-api' ); ?></strong></p>
|
190 |
<p><em><?php printf( __( 'Need an OptinMonster account? <a href="%s" title="Click here to view OptinMonster plans and pricing" target="_blank">%s</a>', 'optin-monster-api' ), $link, $text ); ?></em></p>
|
191 |
<?php endif; ?>
|
192 |
+
|
193 |
+
<?php echo $object->get_setting_ui( 'api', 'apikey' ); ?>
|
194 |
+
|
195 |
+
<?php // If we have credentials only show the old stuff if it is saved ?>
|
196 |
+
<?php if ( $credentials ) : ?>
|
197 |
+
<?php if ( isset( $credentials['api'] ) && '' != $credentials['api'] || isset( $credentials['key'] ) && '' != $credentials['key'] ) : ?>
|
198 |
+
<p>The Legacy API Username and Key below will be deprecated soon. Please <a href="https://app.optinmonster.com/account/api/" target="_blank">generate a new API key</a> and paste it above to authenticate using our new and improved REST API.</p>
|
199 |
+
<?php echo $object->get_setting_ui( 'api', 'user' ); ?>
|
200 |
+
<?php echo $object->get_setting_ui( 'api', 'key' ); ?>
|
201 |
+
<?php endif; ?>
|
202 |
+
<?php endif; ?>
|
203 |
+
|
204 |
<?php
|
205 |
|
206 |
}
|
348 |
*/
|
349 |
public function get_optin_links( $optin_id ) {
|
350 |
|
351 |
+
$optin = get_post( $optin_id );
|
352 |
+
$slug = $optin->post_name;
|
353 |
$status = (bool) get_post_meta( $optin_id, '_omapi_enabled', true );
|
354 |
$status_link = $status ? __( 'Disable', 'optin-monster-api' ) : __( 'Go Live', 'optin-monster-api' );
|
355 |
$status_desc = $status ? esc_attr__( 'Disable this optin', 'optin-monster-api' ) : esc_attr__( 'Go live with this optin', 'optin-monster-api' );
|
356 |
$links = array();
|
357 |
+
$links['editd'] = '<a href="' . esc_url_raw( 'https://app.optinmonster.com/campaigns/' . $slug . '/edit/' ) . '" title="' . esc_attr__( 'Edit this optin on the OptinMonster App', 'optin-monster-api' ) . '" target="_blank">Edit Design</a>';
|
358 |
$links['edito'] = '<a href="' . esc_url_raw( add_query_arg( array( 'optin_monster_api_view' => $this->view, 'optin_monster_api_action' => 'edit', 'optin_monster_api_id' => $optin_id ), admin_url( 'admin.php?page=optin-monster-api-settings' ) ) ) . '" title="' . esc_attr__( 'Edit the output settings for this optin', 'optin-monster-api' ) . '">Edit Output Settings</a>';
|
359 |
$links['status'] = '<a href="' . wp_nonce_url( esc_url_raw( add_query_arg( array( 'optin_monster_api_view' => $this->view, 'optin_monster_api_action' => 'status', 'optin_monster_api_id' => $optin_id ), admin_url( 'admin.php?page=optin-monster-api-settings' ) ) ), 'omapi-action' ) . '" title="' . $status_desc . '">' . $status_link . '</a>';
|
360 |
|
OMAPI/Menu.php
CHANGED
@@ -371,7 +371,12 @@ class OMAPI_Menu {
|
|
371 |
foreach ( $this->get_panels() as $id => $panel ) :
|
372 |
$active = $id == $this->view ? ' omapi-content-active' : '';
|
373 |
?>
|
374 |
-
<div class="omapi-content omapi-content-<?php echo sanitize_html_class( $id ); ?><?php echo $active; ?>"
|
|
|
|
|
|
|
|
|
|
|
375 |
<?php endforeach; ?>
|
376 |
</div>
|
377 |
</div>
|
@@ -440,12 +445,16 @@ class OMAPI_Menu {
|
|
440 |
case 'api' :
|
441 |
switch ( $setting ) {
|
442 |
case 'user' :
|
443 |
-
$ret = $this->get_password_field( $setting, $value, $id, __( 'API Username', 'optin-monster-api' ), __( 'The API Username found in your OptinMonster
|
444 |
break 2;
|
445 |
|
446 |
case 'key' :
|
447 |
-
$ret = $this->get_password_field( $setting, $value, $id, __( 'API Key', 'optin-monster-api' ), __( 'The API Key found in your OptinMonster
|
448 |
break 2;
|
|
|
|
|
|
|
|
|
449 |
}
|
450 |
break;
|
451 |
|
@@ -1232,7 +1241,7 @@ class OMAPI_Menu {
|
|
1232 |
$html .= '<li><a target="_blank" href="' . esc_url_raw( 'https://optinmonster.com/docs/' ) . '">' . __('Need Help?', 'optin-monster-api') . '</a></li>';
|
1233 |
$html .= '<li><a href="' . esc_url_raw( 'https://optinmonster.com/contact-us/' ) . '" target="_blank">' . __('Send Us Feedback', 'optin-monster-api') . '</a></li>';
|
1234 |
if( $screen->id === 'toplevel_page_optin-monster-api-settings' ) {
|
1235 |
-
$html .= '<li class="omapi-menu-button"><a id="omapi-create-new-optin-button" href="https://app.optinmonster.com/
|
1236 |
}
|
1237 |
$html .= '</ul></div>';
|
1238 |
$html .= '</div>';
|
371 |
foreach ( $this->get_panels() as $id => $panel ) :
|
372 |
$active = $id == $this->view ? ' omapi-content-active' : '';
|
373 |
?>
|
374 |
+
<div class="omapi-content omapi-content-<?php echo sanitize_html_class( $id ); ?><?php echo $active; ?>">
|
375 |
+
<?php
|
376 |
+
do_action( 'optin_monster_api_content_before', $id, $panel, $this );
|
377 |
+
do_action( 'optin_monster_api_content_' . $id, $panel, $this );
|
378 |
+
do_action( 'optin_monster_api_content_after', $id, $panel, $this ); ?>
|
379 |
+
</div>
|
380 |
<?php endforeach; ?>
|
381 |
</div>
|
382 |
</div>
|
445 |
case 'api' :
|
446 |
switch ( $setting ) {
|
447 |
case 'user' :
|
448 |
+
$ret = $this->get_password_field( $setting, $value, $id, __( 'Legacy API Username', 'optin-monster-api' ), __( 'The Legacy API Username found in your OptinMonster Account API area.', 'optin-monster-api' ), __( 'Enter your Legacy API Username here...', 'optin-monster-api' ) );
|
449 |
break 2;
|
450 |
|
451 |
case 'key' :
|
452 |
+
$ret = $this->get_password_field( $setting, $value, $id, __( 'Legacy API Key', 'optin-monster-api' ), __( 'The Legacy API Key found in your OptinMonster Account API area.', 'optin-monster-api' ), __( 'Enter your Legacy API Key here...', 'optin-monster-api' ) );
|
453 |
break 2;
|
454 |
+
|
455 |
+
case 'apikey' :
|
456 |
+
$ret = $this->get_password_field( $setting, $value, $id, __( 'API Key', 'optin-monster-api'), __( 'A single API Key found in your OptinMonster Account API area.', 'optin-monster-api'), __( 'Enter your API Key here...', 'optin-monster-api') );
|
457 |
+
break 2;
|
458 |
}
|
459 |
break;
|
460 |
|
1241 |
$html .= '<li><a target="_blank" href="' . esc_url_raw( 'https://optinmonster.com/docs/' ) . '">' . __('Need Help?', 'optin-monster-api') . '</a></li>';
|
1242 |
$html .= '<li><a href="' . esc_url_raw( 'https://optinmonster.com/contact-us/' ) . '" target="_blank">' . __('Send Us Feedback', 'optin-monster-api') . '</a></li>';
|
1243 |
if( $screen->id === 'toplevel_page_optin-monster-api-settings' ) {
|
1244 |
+
$html .= '<li class="omapi-menu-button"><a id="omapi-create-new-optin-button" href="https://app.optinmonster.com/campaigns/new/" class="button button-secondary omapi-new-optin" title="' . __( 'Create New Optin', 'optin-monster-api' ) . '" target="_blank">' . __( 'Create New Optin', 'optin-monster-api' ) . '</a></li>';
|
1245 |
}
|
1246 |
$html .= '</ul></div>';
|
1247 |
$html .= '</div>';
|
OMAPI/Refresh.php
CHANGED
@@ -95,7 +95,14 @@ class OMAPI_Refresh {
|
|
95 |
public function refresh() {
|
96 |
|
97 |
$creds = $this->base->get_api_credentials();
|
98 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
$ret = $api->request();
|
100 |
if ( is_wp_error( $ret ) ) {
|
101 |
// If no optins available, make sure they get deleted.
|
95 |
public function refresh() {
|
96 |
|
97 |
$creds = $this->base->get_api_credentials();
|
98 |
+
|
99 |
+
// Check if we have the new API and if so only use it
|
100 |
+
if ( $creds['apikey'] ){
|
101 |
+
$api = new OMAPI_Api('optins', array( 'apikey' => $creds['apikey']), 'GET' );
|
102 |
+
} else {
|
103 |
+
$api = new OMAPI_Api( 'optins', array( 'user' => $creds['user'], 'key' => $creds['key'] ), 'GET' );
|
104 |
+
}
|
105 |
+
|
106 |
$ret = $api->request();
|
107 |
if ( is_wp_error( $ret ) ) {
|
108 |
// If no optins available, make sure they get deleted.
|
OMAPI/Save.php
CHANGED
@@ -116,25 +116,79 @@ class OMAPI_Save {
|
|
116 |
case 'api' :
|
117 |
// Create a new API instance to verify API credentials.
|
118 |
$option = $this->base->get_option();
|
|
|
119 |
$user = isset( $data['user'] ) ? $data['user'] : false;
|
120 |
$key = isset( $data['key'] ) ? $data['key'] : false;
|
121 |
$old_user = isset( $option['api']['user'] ) ? $option['api']['user'] : false;
|
122 |
$old_key = isset( $option['api']['key'] ) ? $option['api']['key'] : false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
|
124 |
// If one or both items are missing, fail.
|
125 |
if ( ! $user || ! $key ) {
|
|
|
126 |
// If it had been stored and it is now empty, reset the keys altogether.
|
127 |
if ( ! $user && $old_user || ! $key && $old_key ) {
|
128 |
$option['api']['user'] = '';
|
129 |
$option['api']['key'] = '';
|
130 |
|
|
|
131 |
// Allow option to be filtered before saving.
|
132 |
$option = apply_filters( 'optin_monster_api_save', $option, $data, $this->view );
|
133 |
|
134 |
// Save the option.
|
135 |
update_option( 'optin_monster_api', $option );
|
136 |
} else {
|
137 |
-
$this->errors['error'] = __( 'You must provide a valid API
|
138 |
}
|
139 |
} else {
|
140 |
$api = new OMAPI_Api( 'verify', array( 'user' => $user, 'key' => $key ) );
|
116 |
case 'api' :
|
117 |
// Create a new API instance to verify API credentials.
|
118 |
$option = $this->base->get_option();
|
119 |
+
$apikey = isset( $data['apikey'] ) ? $data['apikey'] : false;
|
120 |
$user = isset( $data['user'] ) ? $data['user'] : false;
|
121 |
$key = isset( $data['key'] ) ? $data['key'] : false;
|
122 |
$old_user = isset( $option['api']['user'] ) ? $option['api']['user'] : false;
|
123 |
$old_key = isset( $option['api']['key'] ) ? $option['api']['key'] : false;
|
124 |
+
$old_apikey = isset( $option['api']['apikey'] ) ? $option['api']['apikey'] : false;
|
125 |
+
|
126 |
+
|
127 |
+
// Check for new single apikey and break early with only that data check
|
128 |
+
if ( $apikey ) {
|
129 |
+
// Verify this new API Key works but posting to the Legacy route
|
130 |
+
$api = new OMAPI_Api( 'verify', array( 'apikey' => $apikey ) );
|
131 |
+
$ret = $api->request();
|
132 |
+
|
133 |
+
if ( is_wp_error( $ret ) ) {
|
134 |
+
$this->errors['error'] = $ret->get_error_message();
|
135 |
+
} else {
|
136 |
+
$option['api']['apikey'] = $apikey;
|
137 |
+
|
138 |
+
// Go ahead and remove the old user and key so we get the 'new' user stuff
|
139 |
+
$option['api']['user'] = '';
|
140 |
+
$option['api']['key'] = '';
|
141 |
+
|
142 |
+
// Remove any error messages.
|
143 |
+
$option['is_invalid'] = false;
|
144 |
+
$option['is_expired'] = false;
|
145 |
+
$option['is_disabled'] = false;
|
146 |
+
|
147 |
+
// Store the optin data.
|
148 |
+
$this->store_optins( $ret );
|
149 |
+
|
150 |
+
// Allow option to be filtered before saving.
|
151 |
+
$option = apply_filters( 'optin_monster_api_save', $option, $data, $this->view );
|
152 |
+
|
153 |
+
// Save the option.
|
154 |
+
update_option( 'optin_monster_api', $option );
|
155 |
+
|
156 |
+
}
|
157 |
+
// End since we are working with the new apikey
|
158 |
+
break;
|
159 |
+
}
|
160 |
+
|
161 |
+
// Catch apikey not set errors
|
162 |
+
if ( ! $apikey ) {
|
163 |
+
|
164 |
+
// Did we used to have one and user is trying to remove it?
|
165 |
+
if ( $old_apikey ) {
|
166 |
+
$option['api']['apikey'] = '';
|
167 |
+
|
168 |
+
// Save the option.
|
169 |
+
update_option( 'optin_monster_api', $option );
|
170 |
+
|
171 |
+
// Explicitly end here so we don't accidentally try grabbing the next round of checks on $user and $key
|
172 |
+
break;
|
173 |
+
}
|
174 |
+
}
|
175 |
|
176 |
// If one or both items are missing, fail.
|
177 |
if ( ! $user || ! $key ) {
|
178 |
+
|
179 |
// If it had been stored and it is now empty, reset the keys altogether.
|
180 |
if ( ! $user && $old_user || ! $key && $old_key ) {
|
181 |
$option['api']['user'] = '';
|
182 |
$option['api']['key'] = '';
|
183 |
|
184 |
+
|
185 |
// Allow option to be filtered before saving.
|
186 |
$option = apply_filters( 'optin_monster_api_save', $option, $data, $this->view );
|
187 |
|
188 |
// Save the option.
|
189 |
update_option( 'optin_monster_api', $option );
|
190 |
} else {
|
191 |
+
$this->errors['error'] = __( 'You must provide a valid API Key to authenticate with OptinMonster.', 'optin-monster-api' );
|
192 |
}
|
193 |
} else {
|
194 |
$api = new OMAPI_Api( 'verify', array( 'user' => $user, 'key' => $key ) );
|
OMAPI/Validate.php
CHANGED
@@ -103,7 +103,14 @@ class OMAPI_Validate {
|
|
103 |
public function validate() {
|
104 |
|
105 |
$creds = $this->base->get_api_credentials();
|
106 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
$ret = $api->request();
|
108 |
if ( is_wp_error( $ret ) ) {
|
109 |
$option = $this->base->get_option();
|
103 |
public function validate() {
|
104 |
|
105 |
$creds = $this->base->get_api_credentials();
|
106 |
+
|
107 |
+
// Check for new apikey and only use the old user/key if we don't have it
|
108 |
+
if ( ! $creds['apikey'] ) {
|
109 |
+
$api = new OMAPI_Api( 'validate', array( 'user' => $creds['user'], 'key' => $creds['key'] ) );
|
110 |
+
} else {
|
111 |
+
$api = new OMAPI_Api( 'verify', array( 'apikey' => $creds['apikey'] ) );
|
112 |
+
}
|
113 |
+
|
114 |
$ret = $api->request();
|
115 |
if ( is_wp_error( $ret ) ) {
|
116 |
$option = $this->base->get_option();
|
assets/js/clipboard.min.js
CHANGED
File without changes
|
assets/js/jspdf.min.js
CHANGED
File without changes
|
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.
|
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.
|
64 |
|
65 |
/**
|
66 |
* The name of the plugin.
|
@@ -142,7 +142,7 @@ class OMAPI {
|
|
142 |
public function init() {
|
143 |
|
144 |
// Define necessary plugin constants.
|
145 |
-
define( 'OPTINMONSTER_API', '//a.
|
146 |
|
147 |
// Load our global option.
|
148 |
$this->load_option();
|
@@ -298,7 +298,7 @@ class OMAPI {
|
|
298 |
*
|
299 |
* @since 1.0.0
|
300 |
*
|
301 |
-
* @return array $creds The user's API creds for OptinMonster.
|
302 |
*/
|
303 |
public function get_api_credentials() {
|
304 |
|
@@ -306,8 +306,19 @@ class OMAPI {
|
|
306 |
$option = $this->get_option();
|
307 |
$key = false;
|
308 |
$user = false;
|
|
|
309 |
|
310 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
311 |
if ( empty( $option['api']['key'] ) ) {
|
312 |
if ( defined( 'OPTINMONSTER_API_LICENSE_KEY' ) ) {
|
313 |
$key = OPTINMONSTER_API_LICENSE_KEY;
|
@@ -324,16 +335,21 @@ class OMAPI {
|
|
324 |
$user = $option['api']['user'];
|
325 |
}
|
326 |
|
327 |
-
//
|
328 |
-
if ( ! $
|
329 |
-
|
330 |
-
|
|
|
|
|
|
|
|
|
331 |
|
332 |
// Return the API credentials.
|
333 |
return apply_filters( 'optin_monster_api_creds',
|
334 |
array(
|
335 |
'key' => $key,
|
336 |
-
'user' => $user
|
|
|
337 |
)
|
338 |
);
|
339 |
|
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.7
|
9 |
* Text Domain: optin-monster-api
|
10 |
* Domain Path: languages
|
11 |
*
|
60 |
*
|
61 |
* @var string
|
62 |
*/
|
63 |
+
public $version = '1.1.7';
|
64 |
|
65 |
/**
|
66 |
* The name of the plugin.
|
142 |
public function init() {
|
143 |
|
144 |
// Define necessary plugin constants.
|
145 |
+
define( 'OPTINMONSTER_API', '//a.optnmstr.com/app/js/api.min.js' );
|
146 |
|
147 |
// Load our global option.
|
148 |
$this->load_option();
|
298 |
*
|
299 |
* @since 1.0.0
|
300 |
*
|
301 |
+
* @return array|bool $creds The user's API creds for OptinMonster.
|
302 |
*/
|
303 |
public function get_api_credentials() {
|
304 |
|
306 |
$option = $this->get_option();
|
307 |
$key = false;
|
308 |
$user = false;
|
309 |
+
$apikey = false;
|
310 |
|
311 |
+
|
312 |
+
// Attempt to grab the new API Key
|
313 |
+
if ( empty( $option['api']['apikey'] ) ) {
|
314 |
+
if ( defined( 'OPTINMONSTER_REST_API_LICENSE_KEY' ) ) {
|
315 |
+
$apikey = OPTINMONSTER_REST_API_LICENSE_KEY;
|
316 |
+
}
|
317 |
+
} else {
|
318 |
+
$apikey = $option['api']['apikey'];
|
319 |
+
}
|
320 |
+
|
321 |
+
// Attempt to grab the Legacy API key and API user.
|
322 |
if ( empty( $option['api']['key'] ) ) {
|
323 |
if ( defined( 'OPTINMONSTER_API_LICENSE_KEY' ) ) {
|
324 |
$key = OPTINMONSTER_API_LICENSE_KEY;
|
335 |
$user = $option['api']['user'];
|
336 |
}
|
337 |
|
338 |
+
// Check if we have any of the authentication data
|
339 |
+
if ( ! $apikey ) {
|
340 |
+
// Do we at least have Legacy API Key and User
|
341 |
+
if ( ! $key || ! $user ) {
|
342 |
+
return false;
|
343 |
+
}
|
344 |
+
}
|
345 |
+
|
346 |
|
347 |
// Return the API credentials.
|
348 |
return apply_filters( 'optin_monster_api_creds',
|
349 |
array(
|
350 |
'key' => $key,
|
351 |
+
'user' => $user,
|
352 |
+
'apikey' => $apikey,
|
353 |
)
|
354 |
);
|
355 |
|
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
Contributors: griffinjt, smub
|
3 |
Tags: wordpress popup, popup, lightbox popup, mailchimp, aweber, campaign monitor, constant contact, exit-intent, madmimi, infusionsoft, getresponse, hubspot, marketo, activecampaign, pardot, totalsend, emma, icontact, mailerlite, mailpoet, google analytics, pop over, optin forms, email list, subscribers, wordpress popup form, lightbox, wordpress popups, popups, lightbox popups, optin form, wordpress optin form, sidebar optin form, sidebar optin, sidebar form, wordpress overlay popup, wordpress popup plugin, popup plugin, wordpress lightbox optin, wordpress lightbox optin form, after post optin form, wordpress after post optin form, after post optin form plugin, lightbox popup plugin, wordpress popup solution, exit intent, exit-intent, optinmonster, optin monster, optin-monster, mobile popup, mobile popups, mobile optin forms, mobile optins, lightbox optins, wordpress mobile popup, wordpress mobile popups, wordpress mobile optin forms, wordpress lightbox optins, lead gen, lead generation, wordpress lead generation, lead generation wordpress, wordpress lead gen, fullscreen, welcome gate, interstitial
|
4 |
Requires at least: 3.5.1
|
5 |
-
Tested up to: 4.7
|
6 |
-
Stable tag:
|
7 |
License: GNU General Public License v2.0 or later
|
8 |
|
9 |
OptinMonster helps you grow your email list by converting visitors into subscribers and customers. Get more email subscribers now!
|
@@ -160,6 +160,10 @@ OptinMonster is the <a href="http://optinmonster.com" rel="friend" title="OptinM
|
|
160 |
|
161 |
== Changelog ==
|
162 |
|
|
|
|
|
|
|
|
|
163 |
= 1.1.6.2 =
|
164 |
* Fixed undefined index errors when API responses returned an error.
|
165 |
|
2 |
Contributors: griffinjt, smub
|
3 |
Tags: wordpress popup, popup, lightbox popup, mailchimp, aweber, campaign monitor, constant contact, exit-intent, madmimi, infusionsoft, getresponse, hubspot, marketo, activecampaign, pardot, totalsend, emma, icontact, mailerlite, mailpoet, google analytics, pop over, optin forms, email list, subscribers, wordpress popup form, lightbox, wordpress popups, popups, lightbox popups, optin form, wordpress optin form, sidebar optin form, sidebar optin, sidebar form, wordpress overlay popup, wordpress popup plugin, popup plugin, wordpress lightbox optin, wordpress lightbox optin form, after post optin form, wordpress after post optin form, after post optin form plugin, lightbox popup plugin, wordpress popup solution, exit intent, exit-intent, optinmonster, optin monster, optin-monster, mobile popup, mobile popups, mobile optin forms, mobile optins, lightbox optins, wordpress mobile popup, wordpress mobile popups, wordpress mobile optin forms, wordpress lightbox optins, lead gen, lead generation, wordpress lead generation, lead generation wordpress, wordpress lead gen, fullscreen, welcome gate, interstitial
|
4 |
Requires at least: 3.5.1
|
5 |
+
Tested up to: 4.7.4
|
6 |
+
Stable tag: 1.1.7
|
7 |
License: GNU General Public License v2.0 or later
|
8 |
|
9 |
OptinMonster helps you grow your email list by converting visitors into subscribers and customers. Get more email subscribers now!
|
160 |
|
161 |
== Changelog ==
|
162 |
|
163 |
+
= 1.1.7 =
|
164 |
+
* Updated the API script domain for adblock.
|
165 |
+
* Added new authentication method for the new OptinMonster REST API.
|
166 |
+
|
167 |
= 1.1.6.2 =
|
168 |
* Fixed undefined index errors when API responses returned an error.
|
169 |
|