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

Version Description

Download this release

Release Info

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

Code changes from version 1.1.4.4 to 1.1.4.5

OMAPI/Review.php ADDED
@@ -0,0 +1,678 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Review class.
4
+ *
5
+ * @since 1.1.4.5
6
+ *
7
+ * @package OMAPI
8
+ * @author Devin Vinson
9
+ */
10
+ class OMAPI_Review {
11
+
12
+ /**
13
+ * Holds the class object.
14
+ *
15
+ * @since 1.1.4.5
16
+ *
17
+ * @var object
18
+ */
19
+ public static $instance;
20
+
21
+ /**
22
+ * Path to the file.
23
+ *
24
+ * @since 1.1.4.5
25
+ *
26
+ * @var string
27
+ */
28
+ public $file = __FILE__;
29
+
30
+ /**
31
+ * Holds the review slug.
32
+ *
33
+ * @since 1.1.4.5
34
+ *
35
+ * @var string
36
+ */
37
+ public $hook;
38
+
39
+ /**
40
+ * Holds the base class object.
41
+ *
42
+ * @since 1.1.4.5
43
+ *
44
+ * @var object
45
+ */
46
+ public $base;
47
+
48
+ /**
49
+ * Current API route.
50
+ *
51
+ * @since 1.1.4.5
52
+ *
53
+ * @var bool|string
54
+ */
55
+ public $route = 'optinmonster.com/wp-json/optinmonster/v1/pluginreview/';
56
+
57
+ /**
58
+ * API Username.
59
+ *
60
+ * @since 1.1.4.5
61
+ *
62
+ * @var bool|string
63
+ */
64
+ public $user = false;
65
+
66
+ /**
67
+ * API Key.
68
+ *
69
+ * @since 1.0.0
70
+ *
71
+ * @var bool|string
72
+ */
73
+ public $key = false;
74
+
75
+ /**
76
+ * Primary class constructor.
77
+ *
78
+ * @since 1.1.4.5
79
+ */
80
+ public function __construct() {
81
+
82
+ // Set default class properties
83
+ $this->protocol = is_ssl() ? 'https://' : 'http://';
84
+ $this->url = $this->protocol . $this->route;
85
+
86
+ // Set our object.
87
+ $this->set();
88
+ // Scripts
89
+ add_action('admin_enqueue_scripts', array($this, 'maybe_enqueue_pointer') );
90
+ add_action('admin_enqueue_scripts', array($this, 'maybe_enqueue_reminder_pointer') );
91
+ // Options
92
+ add_action('wp_ajax_set_omapi_review_reminder', array($this, 'set_user_review_reminder') );
93
+ // Pages
94
+ add_action('admin_menu', array($this, 'register_review_page') );
95
+ // Action
96
+ add_action( 'admin_post_omapi_send_review', array( $this, 'omapi_send_review') );
97
+ // Admin Notices
98
+ add_action('admin_notices', array($this, 'notices') );
99
+
100
+ }
101
+
102
+ /**
103
+ * Sets our object instance and base class instance.
104
+ *
105
+ * @since 1.1.4.5
106
+ */
107
+ public function set() {
108
+
109
+ self::$instance = $this;
110
+ $this->base = OMAPI::get_instance();
111
+
112
+ }
113
+
114
+ /**
115
+ * Loads the OptinMonster admin menu.
116
+ *
117
+ * @since 1.1.4.5
118
+ */
119
+ public function register_review_page() {
120
+
121
+ $this->hook = add_submenu_page(
122
+ __( 'OptinMonster', 'optin-monster-api' ), //parent slug
123
+ __( 'Review OptinMonster', 'optin-monster-api' ), //page title,
124
+ __( 'Thank you for your Review', 'optin-monster-api'),
125
+ apply_filters( 'optin_monster_api_menu_cap', 'manage_options' ), //cap
126
+ 'optin-monster-api-review', //slug
127
+ array($this, 'callback_to_display_page') //callback
128
+ );
129
+
130
+ // Load settings page assets.
131
+ if ( $this->hook ) {
132
+ add_action( 'load-' . $this->hook, array( $this, 'assets' ) );
133
+ }
134
+
135
+ }
136
+
137
+ /**
138
+ * Loads assets for the settings page.
139
+ *
140
+ * @since 1.1.4.2
141
+ */
142
+ public function assets() {
143
+
144
+ add_action( 'admin_enqueue_scripts', array( $this, 'styles' ) );
145
+ add_filter( 'admin_footer_text', array( $this, 'footer' ) );
146
+
147
+ }
148
+
149
+ /**
150
+ * Register and enqueue settings page specific CSS.
151
+ *
152
+ * @since 1.1.4.2
153
+ */
154
+ public function styles() {
155
+
156
+ wp_register_style( $this->base->plugin_slug . '-settings', plugins_url( '/assets/css/settings.css', $this->base->file ), array(), $this->base->version );
157
+ wp_enqueue_style( $this->base->plugin_slug . '-settings' );
158
+
159
+
160
+ }
161
+
162
+
163
+ /**
164
+ * Customizes the footer text on the OptinMonster settings page.
165
+ *
166
+ * @since 1.1.4.5
167
+ *
168
+ * @param string $text The default admin footer text.
169
+ * @return string $text Amended admin footer text.
170
+ */
171
+ public function footer( $text ) {
172
+
173
+ $new_text = sprintf( __( 'Thank you for using <a href="%1$s" target="_blank">OptinMonster</a>!', 'optin-monster-api' ),
174
+ 'http://optinmonster.com'
175
+ );
176
+ return str_replace( '</span>', '', $text ) . ' | ' . $new_text . '</span>';
177
+
178
+ }
179
+
180
+ /**
181
+ * Outputs the Review Page.
182
+ *
183
+ * @since 1.1.4.5
184
+ */
185
+ public function callback_to_display_page() {
186
+
187
+
188
+ // Get any saved meta
189
+ $review_meta = get_user_meta( get_current_user_id(), 'omapi_review_data', true );
190
+
191
+ // Get autofill details
192
+ $current_user = wp_get_current_user();
193
+ $current_usermail = isset ( $review_meta['user-email'] ) ? $review_meta['user-email'] : $current_user->user_email;
194
+ $current_userfullname = isset ( $review_meta['user-name'] ) ? $review_meta['user-name'] : $current_user->user_firstname . ' ' . $current_user->user_lastname;
195
+ $current_credentials = isset ( $review_meta['user-creds'] ) ? $review_meta['user-creds'] : '';
196
+ $current_source = isset ( $review_meta['user-source'] ) ? $review_meta['user-source'] : get_site_url();
197
+ $user_review = isset ( $review_meta['user-review'] ) ? $review_meta['user-review'] : '';
198
+ $review_status = isset ( $review_meta['status'] ) ? $review_meta['status'] : 'unfinished';
199
+
200
+ ?>
201
+ <div class="wrap omapi-page">
202
+ <h2><?php echo esc_html( get_admin_page_title() ); ?> <span><?php printf( __( 'v%s', 'optin-monster-api' ), $this->base->version ); ?></span></h2>
203
+ <div class="omapi-ui">
204
+
205
+ <div id="welcome-panel" class="welcome-panel">
206
+ <?php if ($review_status == 'finished') : ?>
207
+ <p><?php _e('Thank you for sending us your review. Please consider leaving us a review on WordPress.org as well. We do really appreciate your time.', 'optin-monster-api'); ?></p>
208
+ <?php else: ?>
209
+ <p><?php _e('Thank you for taking a minute to send us a review.', 'optin-monster-api'); ?></p>
210
+ <?php endif; ?>
211
+ <div class="omapi-ui">
212
+ <form method="post" action="<?php echo admin_url( 'admin-post.php' ); ?>">
213
+ <input type="hidden" name="action" value="omapi_send_review">
214
+ <?php wp_nonce_field('omapi-submit-review','omapi-review-nonce') ?>
215
+ <div class="omapi-field-box">
216
+ <div class="omapi-field-wrap">
217
+ <label for="user-review"><?php _e('Review (required)', 'optin-monster-api'); ?></label>
218
+ <textarea id="user-review" tabindex="1" rows="5" name="user-review"><?php echo $user_review; ?></textarea>
219
+ <span class="omapi-field-desc"><?php _e('Be as specific as you would like (140 to 1000 characters).', 'optin-monster-api'); ?></span>
220
+ </div>
221
+ </div>
222
+ <div class="omapi-field-box">
223
+ <div class="omapi-field-wrap">
224
+ <label for="user-email"><?php _e('Email (required)', 'optin-monster-api'); ?></label>
225
+ <input type="text" id="user-email" placeholder="<?php _e('Email', 'optin-monster-api')?>" tabindex="1" name="user-email" value="<?php echo $current_usermail ?>">
226
+ </div>
227
+ </div>
228
+ <div class="omapi-field-box">
229
+ <div class="omapi-field-wrap">
230
+ <label><?php _e('Your Name (required)', 'optin-monster-api'); ?></label>
231
+ <input type="text" id="user-name" placeholder="<?php _e('Your Name', 'optin-monster-api')?>" tabindex="1" name="user-name" value="<?php echo $current_userfullname ?>">
232
+ <span class="omapi-field-desc"><?php _e('The name you would like shown if featured.', 'optin-monster-api'); ?></span>
233
+ </div>
234
+ </div>
235
+ <div class="omapi-field-box">
236
+ <div class="omapi-field-wrap">
237
+ <label><?php _e('Title and Company', 'optin-monster-api'); ?></label>
238
+ <input type="text" id="user-credentials" placeholder="<?php _e('Title, Company Name', 'optin-monster-api')?>" tabindex="1" name="user-credentials" value="<?php echo $current_credentials ?>">
239
+ <span class="omapi-field-desc"><?php _e('Professional Title and Company', 'optin-monster-api'); ?></span>
240
+ </div>
241
+ </div>
242
+ <div class="omapi-field-box">
243
+ <div class="omapi-field-wrap">
244
+ <label><?php _e('Where are you using OptinMonster', 'optin-monster-api'); ?></label>
245
+ <input type="text" id="user-source" placeholder="http://" tabindex="1" name="user-source" value="<?php echo $current_source; ?>">
246
+ <span class="omapi-field-desc"><?php _e('May be shown if featured.', 'optin-monster-api'); ?></span>
247
+ </div>
248
+ </div>
249
+ <p class="submit">
250
+ <?php if ($review_status !== 'finished') : ?>
251
+ <button class="button button-primary" type="submit"><?php _e('Send Review', 'optin-monster-api'); ?></button>
252
+ <?php endif; ?>
253
+ </p>
254
+
255
+ </form>
256
+ </div>
257
+ </div>
258
+
259
+ </div>
260
+ <?php
261
+
262
+ }
263
+
264
+ /**
265
+ * Handle review submission
266
+ *
267
+ * This is called via admin_post_{action} when form is submitted.
268
+ *
269
+ * @since 1.1.4.5
270
+ *
271
+ */
272
+ public function omapi_send_review() {
273
+
274
+ // Check our form nonce
275
+ if ( ! wp_verify_nonce( $_POST['omapi-review-nonce'], 'omapi-submit-review' ) ) {
276
+ die( 'Unable to process request');
277
+ }
278
+
279
+ $user_id = get_current_user_id();
280
+
281
+ // Setup empty defaults
282
+ $user_review = '';
283
+ $user_email = '';
284
+ $user_name = '';
285
+ $user_creds = '';
286
+ $user_source = '';
287
+ $user_api = $this->base->get_api_credentials();
288
+
289
+ if ( isset( $_POST['user-review'] ) ) {
290
+ $user_review = sanitize_text_field( $_POST['user-review'] );
291
+ }
292
+ if ( isset( $_POST['user-email'] ) ) {
293
+ $user_email = sanitize_email( $_POST['user-email'] );
294
+ }
295
+ if ( isset( $_POST['user-name'] ) ) {
296
+ $user_name = sanitize_text_field( $_POST['user-name'] );
297
+ }
298
+ if ( isset( $_POST['user-credentials'] ) ) {
299
+ $user_creds = sanitize_text_field( $_POST['user-credentials'] );
300
+ }
301
+ if ( isset( $_POST['user-source'] ) ) {
302
+ $user_source = esc_url( $_POST['user-source'] );
303
+ }
304
+
305
+ // Add data into query
306
+ $data_array = array(
307
+ 'user-review' => $user_review,
308
+ 'user-email' => $user_email,
309
+ 'user-name' => $user_name,
310
+ 'user-creds' => $user_creds,
311
+ 'user-source' => $user_source,
312
+ 'user-key' => $user_api['key'],
313
+ 'user-id' => $user_api['user']
314
+ );
315
+
316
+ // Save everything passed in to user meta as well
317
+ update_user_meta( $user_id, 'omapi_review_data', $data_array );
318
+
319
+
320
+ // Check for Name, Review, Email
321
+ if ( $user_name === '' || $user_review === '' || $user_email === '' ) {
322
+ $message = 'required-fields';
323
+ wp_redirect( add_query_arg( 'action', $message , admin_url( 'admin.php?page=optin-monster-api-review' ) ) );
324
+ exit;
325
+ }
326
+
327
+ // All good, make it pretty for the request
328
+ $request_body = http_build_query( $data_array, '', '&' );
329
+
330
+ // Build the headers of the request.
331
+ $headers = array(
332
+ 'Content-Type' => 'application/x-www-form-urlencoded',
333
+ 'Content-Length' => strlen( $request_body ),
334
+ 'Cache-Control' => 'no-store, no-cache, must-revalidate, max-age=0, post-check=0, pre-check=0',
335
+ 'Pragma' => 'no-cache',
336
+ 'Expires' => 0,
337
+ 'OMAPI-Referer' => site_url(),
338
+ 'OMAPI-Sender' => 'WordPress'
339
+ );
340
+
341
+ // Setup data to be sent to the API.
342
+ $data = array(
343
+ 'headers' => $headers,
344
+ 'body' => $request_body,
345
+ 'timeout' => 3000,
346
+ 'sslverify' => false
347
+ );
348
+
349
+ // Perform the query and retrieve the response.
350
+ $response = wp_remote_post( esc_url_raw( $this->url ), $data );
351
+ $response_body = json_decode( wp_remote_retrieve_body( $response ) );
352
+
353
+ if ( is_wp_error( $response_body ) ) {
354
+ //$action_query = 'error';
355
+ }
356
+
357
+ $message = isset($action_query) ? $action_query : 'success';
358
+
359
+ // Stop the review pointers from showing since they tried submitting a valid form
360
+ $this->dismiss_all_the_pointers();
361
+
362
+ // Update array
363
+ $data_array['status'] = 'finished';
364
+
365
+ // Add status to review meta
366
+ update_user_meta( $user_id, 'omapi_review_data', $data_array );
367
+
368
+ //reload review page and end things
369
+ wp_redirect( add_query_arg( 'action', $message , admin_url( 'admin.php?page=optin-monster-api-review' ) ) );
370
+ exit;
371
+ }
372
+
373
+ /**
374
+ * Maybe add in our pointer
375
+ *
376
+ * @since 1.1.4.5
377
+ * @param $hook_suffix
378
+ */
379
+ public function maybe_enqueue_pointer( $hook_suffix ) {
380
+
381
+ $enqueue_pointer_script_style = false;
382
+
383
+ $current_screen = get_current_screen();
384
+ $show_on = array('dashboard', 'plugins', 'toplevel_page_optin-monster-api-settings' );
385
+
386
+ if( ! in_array( $current_screen->id, $show_on ) ) {
387
+ return;
388
+ }
389
+
390
+ // Get array list of dismissed pointers for current user and convert it to array
391
+ $dismissed_pointers = explode( ',', get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) );
392
+
393
+ // Check if our pointer is not among dismissed ones and that the user should see this
394
+ if( !in_array( 'omapi_review_pointer', $dismissed_pointers ) && current_user_can('activate_plugins') ) {
395
+ $enqueue_pointer_script_style = true;
396
+
397
+ // Add footer scripts using callback function
398
+ add_action( 'admin_print_footer_scripts', array( $this, 'pointer_review_content') );
399
+ }
400
+
401
+ // Enqueue pointer CSS and JS files, if needed
402
+ if( $enqueue_pointer_script_style ) {
403
+ wp_enqueue_style( 'wp-pointer' );
404
+ wp_enqueue_script( 'wp-pointer' );
405
+ }
406
+
407
+ }
408
+
409
+ /**
410
+ * Maybe add in our reminder pointer
411
+ *
412
+ * @since 1.1.4.5
413
+ * @param $hook_suffix
414
+ */
415
+ public function maybe_enqueue_reminder_pointer( $hook_suffix ) {
416
+
417
+ $enqueue_pointer_script_style = false;
418
+
419
+ $current_screen = get_current_screen();
420
+ $show_on = array('dashboard', 'plugins', 'toplevel_page_optin-monster-api-settings' );
421
+
422
+ if( ! in_array( $current_screen->id, $show_on ) ) {
423
+ return;
424
+ }
425
+
426
+ $reminder_time = get_user_meta( get_current_user_id(), 'omapi_reminder', true );
427
+ if ( $reminder_time === '') {
428
+ return;
429
+ }
430
+
431
+ // Get array list of dismissed pointers for current user and convert it to array
432
+ $dismissed_pointers = explode( ',', get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) );
433
+
434
+ // Make sure the initial pointer has been viewed and user still has permissions
435
+ if( in_array( 'omapi_review_pointer', $dismissed_pointers ) && !in_array( 'omapi_reminder_pointer', $dismissed_pointers) && current_user_can('activate_plugins') ) {
436
+
437
+ if ( current_time('timestamp') > $reminder_time ) {
438
+ $enqueue_pointer_script_style = true;
439
+
440
+ // Add footer scripts using callback function
441
+ add_action( 'admin_print_footer_scripts', array( $this, 'pointer_review_content_reminder') );
442
+ }
443
+
444
+ }
445
+
446
+ // Enqueue pointer CSS and JS files, if needed
447
+ if( $enqueue_pointer_script_style ) {
448
+ wp_enqueue_style( 'wp-pointer' );
449
+ wp_enqueue_script( 'wp-pointer' );
450
+ }
451
+
452
+ }
453
+
454
+ /**
455
+ * Ask for OptinMonster review
456
+ *
457
+ * @since 1.1.4.5
458
+ */
459
+ public function pointer_review_content() {
460
+
461
+ $pointer_content = '<h3 class="omapi-pointer_review">' . __( 'Rate OptinMonster', 'optin-monster-api' ) . '</h3>';
462
+ $pointer_content .= '<p><strong>' . __("Thank you for using OptinMonster.","optin-monster-api") . '</strong></p>';
463
+ $pointer_content .= '<p>' . __("Would you mind taking a moment to rate it? It wont take more than two minutes.", "optin-monster-api") . '</p>';
464
+ $pointer_content .= '<p><strong>' . __("Thanks for your support!", "optin-monster-api") . '</strong></p>';
465
+ $pointer_content .= '<p><a class="button button-primary button-hero omapi-pointer_button" href="' . esc_url_raw( admin_url( 'admin.php?page=optin-monster-api-review' ) ) . '">' . __("Rate OptinMonster Now","optin-monster-api") . '</a></p>';
466
+ $pointer_content .= '<p><a id="omapi-pointer_remind-me-later" class="button button-secondary button-hero omapi-pointer_button" href="#" >' . __("Remind me later","optin-monster-api") . '</a></p>';
467
+ $nothanks = __( 'No, thanks', 'optin-monster-api' );
468
+ ?>
469
+
470
+ <script type="text/javascript">
471
+ jQuery(document).ready( function($) {
472
+ var nothanks = '<?php echo $nothanks; ?>';
473
+ $('#toplevel_page_optin-monster-api-settings').pointer({
474
+ content: '<?php echo $pointer_content; ?>',
475
+ position: {
476
+ edge: 'left',
477
+ align: 'middle'
478
+ },
479
+ pointerWidth: 270,
480
+ buttons: function( event, t ) {
481
+ var button = $('<a class="close omapi-pointer_close-override" href="#">' + nothanks + '</a>');
482
+
483
+ return button.bind( 'click.pointer', function(e) {
484
+ e.preventDefault();
485
+ t.element.pointer('close');
486
+ });
487
+ },
488
+ close: function() {
489
+ $.post( ajaxurl, {
490
+ pointer: 'omapi_review_pointer',
491
+ action: 'dismiss-wp-pointer'
492
+ });
493
+ }
494
+ }).pointer('open');
495
+
496
+ $('#omapi-pointer_remind-me-later').click(function( event ) {
497
+ event.preventDefault();
498
+ //Set the pointer to be closed for this user
499
+ $.post( ajaxurl, {
500
+ pointer: 'omapi_review_pointer',
501
+ action: 'dismiss-wp-pointer'
502
+ });
503
+ $.post( ajaxurl, {
504
+ omapi_reminder: 'omapi_review_pointer',
505
+ action: 'set_omapi_review_reminder'
506
+ });
507
+ $('#omapi-pointer_remind-me-later').parents('.wp-pointer').remove();
508
+ });
509
+ });
510
+ </script>
511
+ <style type="text/css">
512
+ .wp-pointer-content h3.omapi-pointer_review {
513
+ background: #0085BA;
514
+ }
515
+ .wp-pointer-content h3.omapi-pointer_review::before {
516
+ content: "\f529";
517
+ color: #fff;
518
+ background: transparent;
519
+ }
520
+ .wp-pointer-content .omapi-pointer_button {
521
+ width: 100%;
522
+ text-align: center;
523
+ }
524
+ .wp-pointer-buttons .close.omapi-pointer_close-override {
525
+ float: left;
526
+ margin-left: 15px;
527
+ }
528
+ </style>
529
+ <?php
530
+ }
531
+
532
+ /**
533
+ * Requested reminder to review OptinMonster
534
+ *
535
+ * @since 1.1.4.5
536
+ */
537
+ public function pointer_review_content_reminder(){
538
+
539
+ $pointer_content = '<h3 class="omapi-pointer_review">' . __( 'Rate OptinMonster', 'optin-monster-api' ) . '</h3>';
540
+ $pointer_content .= '<p><strong>' . __("Thank you for using OptinMonster.","optin-monster-api") . '</strong></p>';
541
+ $pointer_content .= '<p>' . __("You asked to be reminded to review OptinMonster.","optin-monster-api") . '</p>';
542
+ $pointer_content .= '<p><strong>' . __("Thanks for your support!","optin-monster-api") . '</strong></p>';
543
+ $pointer_content .= '<p><a id="omapi-pointer_review-now" class="button button-primary button-hero omapi-pointer_button" href="' . esc_url_raw( admin_url( 'admin.php?page=optin-monster-api-review' ) ) . '">' . __("Rate OptinMonster Now","optin-monster-api") . '</a></p>';
544
+ $pointer_content .= '<p><a id="omapi-pointer_remind-me-later" class="button button-secondary button-hero omapi-pointer_button" href="#" >' . __("Remind me later","optin-monster-api") . '</a></p>';
545
+ $nothanks = __( 'No, thanks', 'optin-monster-api' );
546
+ ?>
547
+
548
+ <script type="text/javascript">
549
+ jQuery(document).ready( function($) {
550
+ var nothanks = '<?php echo $nothanks; ?>';
551
+ $('#toplevel_page_optin-monster-api-settings').pointer({
552
+ content: '<?php echo $pointer_content; ?>',
553
+ position: {
554
+ edge: 'left',
555
+ align: 'middle'
556
+ },
557
+ pointerWidth: 270,
558
+ buttons: function( event, t ) {
559
+ var button = $('<a class="close omapi-pointer_close-override" href="#">' + nothanks + '</a>');
560
+
561
+ return button.bind( 'click.pointer', function(e) {
562
+ e.preventDefault();
563
+ t.element.pointer('close');
564
+ });
565
+ },
566
+ close: function() {
567
+ $.post( ajaxurl, {
568
+ pointer: 'omapi_reminder_pointer',
569
+ action: 'dismiss-wp-pointer'
570
+ });
571
+ }
572
+ }).pointer('open');
573
+
574
+ $('#omapi-pointer_remind-me-later').click(function( event ) {
575
+ event.preventDefault();
576
+ $.post( ajaxurl, {
577
+ omapi_reminder: 'omapi_review_pointer',
578
+ action: 'set_omapi_review_reminder'
579
+ });
580
+ $('#omapi-pointer_remind-me-later').parents('.wp-pointer').remove();
581
+ });
582
+
583
+ $('#omapi-pointer_review-now').click(function( event ) {
584
+ event.preventDefault();
585
+ $.post( ajaxurl, {
586
+ omapi_reminder: 'omapi_review_pointer',
587
+ action: 'set_omapi_review_reminder'
588
+ });
589
+ //Set the pointer to be closed for this user
590
+ $.post( ajaxurl, {
591
+ pointer: 'omapi_review_pointer',
592
+ action: 'dismiss-wp-pointer'
593
+ });
594
+ $('#omapi-pointer_remind-me-later').parents('.wp-pointer').remove();
595
+ });
596
+ });
597
+ </script>
598
+ <style type="text/css">
599
+ .wp-pointer-content h3.omapi-pointer_review {
600
+ background: #0085BA;
601
+ }
602
+ .wp-pointer-content h3.omapi-pointer_review::before {
603
+ content: "\f529";
604
+ color: #fff;
605
+ background: transparent;
606
+ }
607
+ .wp-pointer-content .omapi-pointer_button {
608
+ width: 100%;
609
+ text-align: center;
610
+ }
611
+ .wp-pointer-buttons .close.omapi-pointer_close-override {
612
+ float: left;
613
+ margin-left: 15px;
614
+ }
615
+ </style>
616
+ <?php
617
+
618
+ }
619
+
620
+ /**
621
+ * Set the review reminder user_meta
622
+ *
623
+ * @since 1.1.4.5
624
+ */
625
+ public function set_user_review_reminder() {
626
+
627
+ //set reminder time 1 week from now
628
+ $reminder_time = (int) strtotime("+1 week");
629
+
630
+ //update user_meta with request
631
+ update_user_meta( get_current_user_id(), 'omapi_reminder', $reminder_time);
632
+
633
+ wp_die();
634
+
635
+ }
636
+
637
+ /**
638
+ * Add admin notices as needed for review
639
+ *
640
+ * @since 1.1.4.5
641
+ *
642
+ */
643
+ public function notices() {
644
+
645
+ if ( ! isset ( $_GET['action'] ) ) {
646
+ return;
647
+ }
648
+
649
+ if ( 'success' === $_GET['action'] ) {
650
+ echo '<div class="notice notice-success"><p>' . __( 'Review has been sent.', 'optin-monster-api' );
651
+ echo '<a href="' . esc_url_raw( admin_url( 'admin.php?page=optin-monster-api-settings' ) ) . '" class="button button-primary button-large omapi-new-optin" title="Go to OptinMonster overview" style="margin-left: 15px;">Return to OptinMonster</a></p></div>';
652
+
653
+ }
654
+ if ( 'required-fields' === $_GET['action'] ) {
655
+ echo '<div class="error is-dismissible"><p>' . __( 'Your Name, Review, and Email address are required to submit your review.', 'optin-monster-api' ) . '</p></div>';
656
+ }
657
+
658
+ }
659
+
660
+ /**
661
+ * Add all review pointers as read for current user
662
+ *
663
+ * @since 1.1.4.5
664
+ *
665
+ */
666
+ public function dismiss_all_the_pointers() {
667
+
668
+ $dismissed = array_filter( explode( ',', (string) get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) ) );
669
+ $review_pointers = array('omapi_review_pointer', 'omapi_reminder_pointer');
670
+
671
+ $dismissed = array_merge( $dismissed, $review_pointers);
672
+ $dismissed = implode( ',', $dismissed);
673
+
674
+ update_user_meta( get_current_user_id(), 'dismissed_wp_pointers', $dismissed );
675
+
676
+ }
677
+
678
+ }
OMAPI/Validate.php CHANGED
@@ -150,10 +150,10 @@ class OMAPI_Validate {
150
  }
151
  } elseif ( isset( $option['is_disabled'] ) && $option['is_disabled'] ) {
152
  echo '<div class="error"><p>' . __( 'The subscription to this OptinMonster account has been disabled, likely due to a refund or other administrator action. Please contact OptinMonster support to resolve this issue.', 'optin-monster-api' ) . '</p>';
153
- echo '<p><a href="https://app.optinmonster.com/account/support/" class="button button-primary button-large omapi-new-optin" title="Contact OptinMonster Support" target="_blank">Contact Support</a></p></div>';
154
  } elseif ( isset( $option['is_expired'] ) && $option['is_expired'] ) {
155
  echo '<div class="error"><p>' . __( 'The subscription to this OptinMonster account has expired. Please renew your subscription to use the OptinMonster API.', 'optin-monster-api' ) . '</p>';
156
- echo '<p><a href="https://app.optinmonster.com/account/billing/" class="button button-primary button-large omapi-new-optin" title="Renew Subscription" target="_blank">Renew Subscription</a></p></div>';
157
  }
158
 
159
  }
150
  }
151
  } elseif ( isset( $option['is_disabled'] ) && $option['is_disabled'] ) {
152
  echo '<div class="error"><p>' . __( 'The subscription to this OptinMonster account has been disabled, likely due to a refund or other administrator action. Please contact OptinMonster support to resolve this issue.', 'optin-monster-api' ) . '</p>';
153
+ echo '<p><a href="https://app.optinmonster.com/account/support/?utm_source=orgplugin&utm_medium=link&utm_campaign=wpdashboard" class="button button-primary button-large omapi-new-optin" title="Contact OptinMonster Support" target="_blank">Contact Support</a></p></div>';
154
  } elseif ( isset( $option['is_expired'] ) && $option['is_expired'] ) {
155
  echo '<div class="error"><p>' . __( 'The subscription to this OptinMonster account has expired. Please renew your subscription to use the OptinMonster API.', 'optin-monster-api' ) . '</p>';
156
+ echo '<p><a href="https://app.optinmonster.com/account/billing/?utm_source=orgplugin&utm_medium=link&utm_campaign=wpdashboard" class="button button-primary button-large omapi-new-optin" title="Renew Subscription" target="_blank">Renew Subscription</a></p></div>';
157
  }
158
 
159
  }
OMAPI/Welcome.php CHANGED
@@ -37,7 +37,13 @@ class OMAPI_Welcome {
37
  public $base;
38
 
39
 
40
-
 
 
 
 
 
 
41
  public $hook;
42
 
43
  /**
@@ -127,8 +133,6 @@ class OMAPI_Welcome {
127
  add_action( 'load-' . $this->hook, array( $this, 'assets' ) );
128
  }
129
 
130
-
131
-
132
  }
133
 
134
  /**
@@ -138,9 +142,6 @@ class OMAPI_Welcome {
138
  */
139
  public function callback_to_display_page() {
140
 
141
- //Load options if needed
142
- $options = $this->base->get_option();
143
-
144
  ?>
145
  <div class="wrap omapi-page">
146
 
@@ -149,8 +150,6 @@ class OMAPI_Welcome {
149
  <div class="welcome-panel-content">
150
  <div class="logo"><h2>Welcome to OptinMonster</h2></div>
151
 
152
-
153
-
154
  <div class="welcome-panel-column-container">
155
 
156
  <p class="intro-description"><?php _e('Welcome to OptinMonster - the best plugin for growing your email list and getting more subscribers.','optin-monster-api') ?></p>
@@ -161,10 +160,7 @@ class OMAPI_Welcome {
161
  <p><a class="button button-primary button-hero" href="<?php echo esc_url_raw( admin_url( 'admin.php?page=optin-monster-api-settings' ) ) ?>"><?php _e('Get Connected','optin-monster-api');?></a></p>
162
 
163
  <h4><?php _e('New to OptinMonster?','optin-monster-api') ?></h4>
164
- <p><a class="button button-primary button-hero" href="http://optinmonster.com/pricing/" target="_blank"><?php _e('Create Your Account','optin-monster-api') ?></a> or <a href="http://optinmonster.com/how-it-works/" target="_blank"><?php _e('See How it Works','optin-monster-api') ?></a>.</p>
165
-
166
-
167
-
168
 
169
  </div>
170
  </div>
37
  public $base;
38
 
39
 
40
+ /**
41
+ * Holds the welcome slug.
42
+ *
43
+ * @since 1.1.4.2
44
+ *
45
+ * @var string
46
+ */
47
  public $hook;
48
 
49
  /**
133
  add_action( 'load-' . $this->hook, array( $this, 'assets' ) );
134
  }
135
 
 
 
136
  }
137
 
138
  /**
142
  */
143
  public function callback_to_display_page() {
144
 
 
 
 
145
  ?>
146
  <div class="wrap omapi-page">
147
 
150
  <div class="welcome-panel-content">
151
  <div class="logo"><h2>Welcome to OptinMonster</h2></div>
152
 
 
 
153
  <div class="welcome-panel-column-container">
154
 
155
  <p class="intro-description"><?php _e('Welcome to OptinMonster - the best plugin for growing your email list and getting more subscribers.','optin-monster-api') ?></p>
160
  <p><a class="button button-primary button-hero" href="<?php echo esc_url_raw( admin_url( 'admin.php?page=optin-monster-api-settings' ) ) ?>"><?php _e('Get Connected','optin-monster-api');?></a></p>
161
 
162
  <h4><?php _e('New to OptinMonster?','optin-monster-api') ?></h4>
163
+ <p><a class="button button-primary button-hero" href="http://optinmonster.com/pricing/?utm_source=orgplugin&utm_medium=link&utm_campaign=wpdashboard" target="_blank"><?php _e('Create Your Account','optin-monster-api') ?></a> or <a href="http://optinmonster.com/how-it-works/?utm_source=orgplugin&utm_medium=link&utm_campaign=wpdashboard" target="_blank"><?php _e('See How it Works','optin-monster-api') ?></a>.</p>
 
 
 
164
 
165
  </div>
166
  </div>
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.4.4
9
  * Text Domain: optin-monster-api
10
  * Domain Path: languages
11
  *
@@ -57,7 +57,7 @@ class OMAPI {
57
  *
58
  * @var string
59
  */
60
- public $version = '1.1.4.4';
61
 
62
  /**
63
  * The name of the plugin.
@@ -205,6 +205,7 @@ class OMAPI {
205
  $this->refresh = new OMAPI_Refresh();
206
  $this->validate = new OMAPI_Validate();
207
  $this->welcome = new OMAPI_Welcome();
 
208
 
209
  // Fire a hook to say that the admin classes are loaded.
210
  do_action( 'optin_monster_api_admin_loaded' );
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.4.5
9
  * Text Domain: optin-monster-api
10
  * Domain Path: languages
11
  *
57
  *
58
  * @var string
59
  */
60
+ public $version = '1.1.4.5';
61
 
62
  /**
63
  * The name of the plugin.
205
  $this->refresh = new OMAPI_Refresh();
206
  $this->validate = new OMAPI_Validate();
207
  $this->welcome = new OMAPI_Welcome();
208
+ $this->review = new OMAPI_Review();
209
 
210
  // Fire a hook to say that the admin classes are loaded.
211
  do_action( 'optin_monster_api_admin_loaded' );
readme.txt CHANGED
@@ -2,7 +2,7 @@
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.3.1
6
  Stable tag: trunk
7
  License: GNU General Public License v2.0 or later
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.4.2
6
  Stable tag: trunk
7
  License: GNU General Public License v2.0 or later
8