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

Version Description

  • Added additional support for WooCommerce display settings.
  • Updated language for legacy migrations.
  • Fixed a multisite activation issue.
Download this release

Release Info

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

Code changes from version 1.1.9 to 1.2.0

OMAPI/Content.php CHANGED
@@ -314,8 +314,36 @@ class OMAPI_Content {
314
  echo $object->get_setting_ui( 'optins', 'mailpoet' );
315
  echo $object->get_setting_ui( 'optins', 'mailpoet_list' );
316
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
317
 
318
- if ( 'sidebar' !== $type ) {
319
  // Advanced Settings
320
  echo $object->get_setting_ui( 'toggle', 'advanced-start' );
321
  echo $object->get_setting_ui( 'optins', 'never' );
@@ -365,50 +393,13 @@ class OMAPI_Content {
365
 
366
  public function migrate() {
367
 
368
- $migration_data = get_option( '_om_migration_data' );
369
  ?>
370
- <p><?php _e( 'You can migrate all of your existing OptinMonster data (optin forms, settings & integrations) to the new hosted platform. Just click the "Migrate" button below.', 'optin-monster-api' ); ?></p>
371
- <p class="submit">
372
- <a class="button button-primary" href="<?php echo wp_nonce_url( esc_url_raw( add_query_arg( array( 'optin_monster_api_view' => $this->view, 'optin_monster_api_action' => 'migrate' ), admin_url( 'admin.php?page=optin-monster-api-settings' ) ) ), 'omapi-action' ); ?>"><?php _e( 'Migrate', 'optin-monster-api' ); ?></a>
373
- </p>
374
 
375
  <?php
376
- if ( $migration_data ) : ?>
377
- <h3><?php _e( 'Migration Results', 'optin-monster-api' ); ?></h3>
378
- <hr />
379
- <?php if ( ! empty( $migration_data['errors'] ) ) : ?>
380
- <h4><?php _e( 'Migration Errors', 'optin-monster-api' ); ?></h4>
381
- <ul>
382
- <?php foreach ( $migration_data['errors'] as $error ) : ?>
383
- <li><span class="dashicons dashicons-no"></span> <?php echo $error; ?></li>
384
- <?php endforeach; ?>
385
- </ul>
386
- <?php endif; ?>
387
- <?php if ( isset( $migration_data['site'] ) ) : ?>
388
- <h4><?php _e( 'Site Information', 'optin-monster-api' ); ?></h4>
389
- <span class="dashicons dashicons-yes"></span> <?php printf( __( '%s has been registered.', 'optin-monster-api' ), $migration_data['site']->name ); ?>
390
- <?php endif; ?>
391
- <h4><?php _e( 'Optin Forms', 'optin-monster-api' ); ?></h4>
392
- <ul>
393
- <?php foreach ( $migration_data['migrated_optins'] as $optin_id ) : $optin = get_post( $optin_id ); ?>
394
- <?php if ( $optin ) : ?>
395
- <li><span class="dashicons dashicons-yes"></span> <?php echo $optin->post_title; ?></li>
396
- <?php endif; ?>
397
- <?php endforeach; ?>
398
- </ul>
399
- <?php if ( isset( $migration_data['integrations'] ) ) : ?>
400
- <h4>Integrations</h4>
401
- <p><span class="dashicons dashicons-yes"></span> <?php echo $migration_data['integrations']; ?></p>
402
- <?php endif; ?>
403
-
404
- <h3><?php _e( 'Reset Migration', 'optin-monster-api' ); ?></h3>
405
- <hr />
406
- <p><?php _e( 'If your optin forms, site information or integrations did not migrate properly you can reset the migration and try again. Please note that this can cause some data duplication in your account.', 'optin-monster-api' ); ?></p>
407
- <p class="submit">
408
- <a class="button button-secondary" href="<?php echo wp_nonce_url( esc_url_raw( add_query_arg( array( 'optin_monster_api_view' => $this->view, 'optin_monster_api_action' => 'migrate-reset' ), admin_url( 'admin.php?page=optin-monster-api-settings' ) ) ), 'omapi-action' ); ?>"><?php _e( 'Reset Migration', 'optin-monster-api' ); ?></a>
409
- </p>
410
-
411
- <?php endif;
412
  }
413
 
414
  }
314
  echo $object->get_setting_ui( 'optins', 'mailpoet' );
315
  echo $object->get_setting_ui( 'optins', 'mailpoet_list' );
316
  }
317
+ if ( 'sidebar' !== $type ) {
318
+
319
+ // Add WooCommerce Toggle
320
+ if ( $this->base->is_woocommerce_active() ) {
321
+ echo $object->get_setting_ui( 'toggle', 'woocommerce-start');
322
+
323
+ echo $object->get_setting_ui( 'optins', 'show_on_woocommerce');
324
+ // Don't show if output can't use the_content filter
325
+ if ( 'post' !== $type ) {
326
+ echo $object->get_setting_ui( 'optins', 'is_wc_shop' );
327
+ }
328
+ echo $object->get_setting_ui( 'optins', 'is_wc_product');
329
+ echo $object->get_setting_ui( 'optins', 'is_wc_cart');
330
+ echo $object->get_setting_ui( 'optins', 'is_wc_checkout');
331
+ echo $object->get_setting_ui( 'optins', 'is_wc_account');
332
+ echo $object->get_setting_ui( 'optins', 'is_wc_endpoint');
333
+ echo $object->get_setting_ui( 'optins', 'is_wc_endpoint_order_pay');
334
+ echo $object->get_setting_ui( 'optins', 'is_wc_endpoint_order_received');
335
+ echo $object->get_setting_ui( 'optins', 'is_wc_endpoint_view_order');
336
+ echo $object->get_setting_ui( 'optins', 'is_wc_endpoint_edit_account');
337
+ echo $object->get_setting_ui( 'optins', 'is_wc_endpoint_edit_address');
338
+ echo $object->get_setting_ui( 'optins', 'is_wc_endpoint_lost_password');
339
+ echo $object->get_setting_ui( 'optins', 'is_wc_endpoint_customer_logout');
340
+ echo $object->get_setting_ui( 'optins', 'is_wc_endpoint_add_payment_method');
341
+ echo $object->get_setting_ui( 'optins', 'is_wc_product_category' );
342
+ echo $object->get_setting_ui( 'optins', 'is_wc_product_tag' );
343
+ echo $object->get_setting_ui( 'toggle', 'woocommerce-end');
344
+ }
345
+
346
 
 
347
  // Advanced Settings
348
  echo $object->get_setting_ui( 'toggle', 'advanced-start' );
349
  echo $object->get_setting_ui( 'optins', 'never' );
393
 
394
  public function migrate() {
395
 
396
+
397
  ?>
398
+ <p><?php _e( 'Your campaigns created within WordPress using the original OptinMonster plugin can be recreated manually in your OptinMonster account.', 'optin-monster-api' ); ?></p>
399
+
400
+ <p><a href="http://optinmonster.com/docs/old-wordpress-customers-migrating-to-the-new-optinmonster-app/"><?php __e( 'Read the full post about the changes.')?></a></p>
 
401
 
402
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
403
  }
404
 
405
  }
OMAPI/Menu.php CHANGED
@@ -265,12 +265,12 @@ class OMAPI_Menu {
265
  foreach ( $optins as $optin ) {
266
  $optin = get_post( $optin->ID );
267
  $slug = $optin->post_name;
268
-
269
  $optin_data[ $slug ] = array(
270
- 'Optin Type' => get_post_meta( $optin->ID, '_omapi_type', true ),
 
271
  'Associated IDs' => get_post_meta( $optin->ID, '_omapi_ids', true ),
272
- 'Current Status' => get_post_meta( $optin->ID, '_omapi_enabled', true ),
273
- 'Automatic Output Status' => get_post_meta( $optin->ID, '_omapi_automatic', true ),
274
  'User Settings' => get_post_meta( $optin->ID, '_omapi_users', true ),
275
  'Pages to Never show on' => get_post_meta( $optin->ID, '_omapi_never', true ),
276
  'Pages to Only show on' => get_post_meta( $optin->ID, '_omapi_only', true ),
@@ -279,6 +279,10 @@ class OMAPI_Menu {
279
  'Template types to Show on' => get_post_meta( $optin->ID, '_omapi_show', true ),
280
  'Shortcodes Synced and Recognized' => get_post_meta( $optin->ID, '_omapi_shortcode', true ) ? htmlspecialchars_decode( get_post_meta( $optin->ID, '_omapi_shortcode_output', true ) ) : 'None recognized',
281
  );
 
 
 
 
282
  }
283
  }
284
  return $optin_data;
@@ -490,6 +494,12 @@ class OMAPI_Menu {
490
  case 'advanced-end' :
491
  $ret = $this->get_toggle_end();
492
  break 2;
 
 
 
 
 
 
493
  }
494
  break;
495
 
@@ -556,7 +566,11 @@ class OMAPI_Menu {
556
  // Possibly load taxonomies setting if they exist.
557
  $taxonomies = get_taxonomies( array( 'public' => true, '_builtin' => false ) );
558
  $taxonomies['post_format'] = 'post_format';
559
- $data = array();
 
 
 
 
560
  if ( $taxonomies ) {
561
  foreach ( $taxonomies as $taxonomy ) {
562
  $terms = get_terms( $taxonomy );
@@ -604,6 +618,111 @@ class OMAPI_Menu {
604
  case 'mailpoet_list' :
605
  $ret = $this->get_dropdown_field( $setting, $value, $id, $this->get_mailpoet_lists(), __( 'Add lead to this MailPoet list:', 'optin-monster-api' ), __( 'All successful leads for the optin will be added to this particular MailPoet list.', 'optin-monster-api' ) );
606
  break 2;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
607
  }
608
  break;
609
  case 'note' :
265
  foreach ( $optins as $optin ) {
266
  $optin = get_post( $optin->ID );
267
  $slug = $optin->post_name;
268
+ $design_type = get_post_meta( $optin->ID, '_omapi_type', true );
269
  $optin_data[ $slug ] = array(
270
+ 'Optin Type' => $design_type,
271
+ 'WordPress ID' => $optin->ID,
272
  'Associated IDs' => get_post_meta( $optin->ID, '_omapi_ids', true ),
273
+ 'Current Status' => get_post_meta( $optin->ID, '_omapi_enabled', true ) ? 'Live' : 'Disabled',
 
274
  'User Settings' => get_post_meta( $optin->ID, '_omapi_users', true ),
275
  'Pages to Never show on' => get_post_meta( $optin->ID, '_omapi_never', true ),
276
  'Pages to Only show on' => get_post_meta( $optin->ID, '_omapi_only', true ),
279
  'Template types to Show on' => get_post_meta( $optin->ID, '_omapi_show', true ),
280
  'Shortcodes Synced and Recognized' => get_post_meta( $optin->ID, '_omapi_shortcode', true ) ? htmlspecialchars_decode( get_post_meta( $optin->ID, '_omapi_shortcode_output', true ) ) : 'None recognized',
281
  );
282
+ if ( 'post' == $design_type ) {
283
+ $optin_data[$slug]['Automatic Output Status'] = get_post_meta( $optin->ID, '_omapi_automatic', true ) ? 'Enabled' : 'Disabled';
284
+ }
285
+
286
  }
287
  }
288
  return $optin_data;
494
  case 'advanced-end' :
495
  $ret = $this->get_toggle_end();
496
  break 2;
497
+ case 'woocommerce-start' :
498
+ $ret = $this->get_toggle_start( $setting, __( 'WooCommerce Settings', 'optin-monster-api'), __('More specific settings available for WooCommerce integration.', 'optin-monster-api') );
499
+ break 2;
500
+ case 'woocommerce-end' :
501
+ $ret = $this->get_toggle_end();
502
+ break 2;
503
  }
504
  break;
505
 
566
  // Possibly load taxonomies setting if they exist.
567
  $taxonomies = get_taxonomies( array( 'public' => true, '_builtin' => false ) );
568
  $taxonomies['post_format'] = 'post_format';
569
+ $data = array();
570
+
571
+ // Allow returned taxonmies to be filtered before creating UI.
572
+ $taxonomies = apply_filters('optin_monster_api_setting_ui_taxonomies', $taxonomies );
573
+
574
  if ( $taxonomies ) {
575
  foreach ( $taxonomies as $taxonomy ) {
576
  $terms = get_terms( $taxonomy );
618
  case 'mailpoet_list' :
619
  $ret = $this->get_dropdown_field( $setting, $value, $id, $this->get_mailpoet_lists(), __( 'Add lead to this MailPoet list:', 'optin-monster-api' ), __( 'All successful leads for the optin will be added to this particular MailPoet list.', 'optin-monster-api' ) );
620
  break 2;
621
+
622
+ // Start WooCommerce settings.
623
+ case 'show_on_woocommerce' :
624
+ $ret = $this->get_checkbox_field( $setting, $value, $id, __( 'Show on all WooCommerce pages', 'optin-monster-api' ), __( 'The optin will show on any page where WooCommerce templates are used.', 'optin-monster-api' ) );
625
+ break 2;
626
+
627
+ case 'is_wc_shop' :
628
+ $ret = $this->get_checkbox_field( $setting, $value, $id, __( 'Show on WooCommerce shop', 'optin-monster-api' ), __( 'The optin will show on the product archive page (shop).', 'optin-monster-api' ) );
629
+ break 2;
630
+
631
+ case 'is_wc_product' :
632
+ $ret = $this->get_checkbox_field( $setting, $value, $id, __( 'Show on WooCommerce products', 'optin-monster-api' ), __( 'The optin will show on any single product.', 'optin-monster-api' ) );
633
+ break 2;
634
+
635
+ case 'is_wc_cart' :
636
+ $ret = $this->get_checkbox_field( $setting, $value, $id, __( 'Show on WooCommerce Cart', 'optin-monster-api' ), __( 'The optin will show on the cart page.', 'optin-monster-api' ) );
637
+ break 2;
638
+
639
+ case 'is_wc_checkout' :
640
+ $ret = $this->get_checkbox_field( $setting, $value, $id, __( 'Show on WooCommerce Checkout', 'optin-monster-api' ), __( 'The optin will show on the checkout page.', 'optin-monster-api' ) );
641
+ break 2;
642
+
643
+ case 'is_wc_account' :
644
+ $ret = $this->get_checkbox_field( $setting, $value, $id, __( 'Show on WooCommerce Customer Account', 'optin-monster-api' ), __( 'The optin will show on the WooCommerce customer account pages.', 'optin-monster-api' ) );
645
+ break 2;
646
+
647
+ case 'is_wc_endpoint' :
648
+ $ret = $this->get_checkbox_field( $setting, $value, $id, __( 'Show on all WooCommerce Endpoints', 'optin-monster-api' ), __( 'The optin will show when on any WooCommerce Endpoint.', 'optin-monster-api' ) );
649
+ break 2;
650
+ case 'is_wc_endpoint_order_pay' :
651
+ $ret = $this->get_checkbox_field( $setting, $value, $id, __( 'Show on WooCommerce Order Pay endpoint', 'optin-monster-api' ), __( 'The optin will show when the endpoint page for order pay is displayed.', 'optin-monster-api' ) );
652
+ break 2;
653
+
654
+ case 'is_wc_endpoint_order_received' :
655
+ $ret = $this->get_checkbox_field( $setting, $value, $id, __( 'Show on WooCommerce Order Received endpoint', 'optin-monster-api' ), __( 'The optin will show when the endpoint page for order received is displayed.', 'optin-monster-api' ) );
656
+ break 2;
657
+
658
+ case 'is_wc_endpoint_view_order' :
659
+ $ret = $this->get_checkbox_field( $setting, $value, $id, __( 'Show on WooCommerce View Order endpoint', 'optin-monster-api' ), __( 'The optin will show when the endpoint page for view order is displayed.', 'optin-monster-api' ) );
660
+ break 2;
661
+
662
+ case 'is_wc_endpoint_edit_account' :
663
+ $ret = $this->get_checkbox_field( $setting, $value, $id, __( 'Show on WooCommerce Edit Account endpoint', 'optin-monster-api' ), __( 'The optin will show when the endpoint page for edit account is displayed.', 'optin-monster-api' ) );
664
+ break 2;
665
+
666
+ case 'is_wc_endpoint_edit_address' :
667
+ $ret = $this->get_checkbox_field( $setting, $value, $id, __( 'Show on WooCommerce Edit Address endpoint', 'optin-monster-api' ), __( 'The optin will show when the endpoint page for edit address is displayed.', 'optin-monster-api' ) );
668
+ break 2;
669
+
670
+ case 'is_wc_endpoint_lost_password' :
671
+ $ret = $this->get_checkbox_field( $setting, $value, $id, __( 'Show on WooCommerce Lost Password endpoint', 'optin-monster-api' ), __( 'The optin will show when the endpoint page for lost password is displayed.', 'optin-monster-api' ) );
672
+ break 2;
673
+
674
+ case 'is_wc_endpoint_customer_logout' :
675
+ $ret = $this->get_checkbox_field( $setting, $value, $id, __( 'Show on WooCommerce Customer Logout endpoint', 'optin-monster-api' ), __( 'The optin will show when the endpoint page for customer logout is displayed.', 'optin-monster-api' ) );
676
+ break 2;
677
+
678
+ case 'is_wc_endpoint_add_payment_method' :
679
+ $ret = $this->get_checkbox_field( $setting, $value, $id, __( 'Show on WooCommerce Add Payment Method endpoint', 'optin-monster-api' ), __( 'The optin will show when the endpoint page for add payment method is displayed.', 'optin-monster-api' ) );
680
+ break 2;
681
+
682
+ case 'is_wc_product_category' :
683
+ $taxonomy = 'product_cat';
684
+ $terms = get_terms( $taxonomy );
685
+ if ( $terms ) {
686
+ ob_start();
687
+ $display = isset( $value ) ? (array) $value : array();
688
+ $args = array(
689
+ 'descendants_and_self' => 0,
690
+ 'selected_cats' => $display,
691
+ 'popular_cats' => false,
692
+ 'walker' => null,
693
+ 'taxonomy' => $taxonomy,
694
+ 'checked_ontop' => true
695
+ );
696
+ wp_terms_checklist( 0, $args );
697
+ $output = ob_get_clean();
698
+ if ( ! empty( $output ) ) {
699
+ $ret = $this->get_custom_field( $setting, $output, __( 'Show on WooCommerce Product Categories:', 'optin-monster-api' ) );
700
+ }
701
+ }
702
+ break 2;
703
+
704
+ case 'is_wc_product_tag' :
705
+ $taxonomy = 'product_tag';
706
+ $terms = get_terms( $taxonomy );
707
+ if ( $terms ) {
708
+ ob_start();
709
+ $display = isset( $value ) ? (array) $value : array();
710
+ $args = array(
711
+ 'descendants_and_self' => 0,
712
+ 'selected_cats' => $display,
713
+ 'popular_cats' => false,
714
+ 'walker' => null,
715
+ 'taxonomy' => $taxonomy,
716
+ 'checked_ontop' => true
717
+ );
718
+ wp_terms_checklist( 0, $args );
719
+ $output = ob_get_clean();
720
+ if ( ! empty( $output ) ) {
721
+ $ret = $this->get_custom_field( $setting, $output, __( 'Show on WooCommerce Product Tags:', 'optin-monster-api' ) );
722
+ }
723
+ }
724
+ break 2;
725
+
726
  }
727
  break;
728
  case 'note' :
OMAPI/Output.php CHANGED
@@ -43,7 +43,38 @@ class OMAPI_Output {
43
  *
44
  * @var array
45
  */
46
- public $fields = array( 'enabled', 'automatic', 'users', 'never', 'only', 'categories', 'taxonomies', 'show', 'type', 'shortcode', 'shortcode_output', 'mailpoet', 'test' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
 
48
  /**
49
  * Flag for determining if localized JS variable is output.
@@ -159,7 +190,7 @@ class OMAPI_Output {
159
  public function filter_api_url( $url ) {
160
 
161
  // If the handle is not ours, do nothing.
162
- if ( false === strpos( $url, 'a.optnmnstr.com/app/js/api.min.js' ) ) {
163
  return $url;
164
  }
165
 
@@ -420,6 +451,150 @@ class OMAPI_Output {
420
  }
421
  }
422
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
423
  // If the optin is set to be automatically displayed, show it.
424
  if ( isset( $fields['automatic'] ) && $fields['automatic'] && is_singular( 'post' ) ) {
425
  $content .= $html;
@@ -659,6 +834,169 @@ class OMAPI_Output {
659
  }
660
  }
661
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
662
  // If we should be loading globally, do it now.
663
  if ( $global ) {
664
  $init[ $optin->post_name ] = $html;
43
  *
44
  * @var array
45
  */
46
+ public $fields = array(
47
+ 'enabled',
48
+ 'automatic',
49
+ 'users',
50
+ 'never',
51
+ 'only',
52
+ 'categories',
53
+ 'taxonomies',
54
+ 'show',
55
+ 'type',
56
+ 'shortcode',
57
+ 'shortcode_output',
58
+ 'mailpoet',
59
+ 'test',
60
+ 'show_on_woocommerce',
61
+ 'is_wc_shop',
62
+ 'is_wc_product',
63
+ 'is_wc_cart',
64
+ 'is_wc_checkout',
65
+ 'is_wc_account',
66
+ 'is_wc_endpoint',
67
+ 'is_wc_endpoint_order_pay',
68
+ 'is_wc_endpoint_order_received',
69
+ 'is_wc_endpoint_view_order',
70
+ 'is_wc_endpoint_edit_account',
71
+ 'is_wc_endpoint_edit_address',
72
+ 'is_wc_endpoint_lost_password',
73
+ 'is_wc_endpoint_customer_logout',
74
+ 'is_wc_endpoint_add_payment_method',
75
+ 'is_wc_product_category',
76
+ 'is_wc_product_tag',
77
+ );
78
 
79
  /**
80
  * Flag for determining if localized JS variable is output.
190
  public function filter_api_url( $url ) {
191
 
192
  // If the handle is not ours, do nothing.
193
+ if ( false === strpos( $url, 'a.optnmstr.com/app/js/api.min.js' ) ) {
194
  return $url;
195
  }
196
 
451
  }
452
  }
453
 
454
+ // If WooCommerce is enabled we can look for WooCommerce specific settings.
455
+ if ( $this->base->is_woocommerce_active() ) {
456
+
457
+ // is_woocommerce anything
458
+ if ( isset( $fields['show_on_woocommerce'] ) && $fields['show_on_woocommerce'] ) {
459
+ if( is_woocommerce() ) {
460
+ $content .= $html;
461
+ $this->set_slug( $optin );
462
+ continue;
463
+ }
464
+ }
465
+ // is_product
466
+ if ( isset( $fields['is_wc_product'] ) && $fields['is_wc_product'] ) {
467
+ $global = false;
468
+ if( is_product() ) {
469
+ $content .= $html;
470
+ $this->set_slug( $optin );
471
+ continue;
472
+ }
473
+ }
474
+
475
+ // is_cart
476
+ if ( isset( $fields['is_wc_cart'] ) && $fields['is_wc_cart'] ) {
477
+ $global = false;
478
+ if( is_cart() ) {
479
+ $content .= $html;
480
+ $this->set_slug( $optin );
481
+ continue;
482
+ }
483
+ }
484
+
485
+ // is_checkout
486
+ if ( isset( $fields['is_wc_checkout'] ) && $fields['is_wc_checkout'] ) {
487
+ $global = false;
488
+ if( is_checkout() ) {
489
+ $content .= $html;
490
+ $this->set_slug( $optin );
491
+ continue;
492
+ }
493
+ }
494
+
495
+ // is_account_page
496
+ if ( isset( $fields['is_wc_account'] ) && $fields['is_wc_account'] ) {
497
+ $global = false;
498
+ if( is_account_page() ) {
499
+ $content .= $html;
500
+ $this->set_slug( $optin );
501
+ continue;
502
+ }
503
+ }
504
+
505
+ // is_wc_endpoint_url
506
+ if ( isset( $fields['is_wc_endpoint'] ) && $fields['is_wc_endpoint'] ) {
507
+ $global = false;
508
+ if( is_wc_endpoint_url() ) {
509
+ $content .= $html;
510
+ $this->set_slug( $optin );
511
+ continue;
512
+ }
513
+ }
514
+
515
+ // is_wc_endpoint_url( 'order-pay' )
516
+ if ( isset( $fields['is_wc_endpoint_order_pay'] ) && $fields['is_wc_endpoint_order_pay'] ) {
517
+ $global = false;
518
+ if( is_wc_endpoint_url( 'order-pay' ) ) {
519
+ $content .= $html;
520
+ $this->set_slug( $optin );
521
+ continue;
522
+ }
523
+ }
524
+
525
+ // is_wc_endpoint_url( 'order-received' )
526
+ if ( isset( $fields['is_wc_endpoint_order_received'] ) && $fields['is_wc_endpoint_order_received'] ) {
527
+ $global = false;
528
+ if( is_wc_endpoint_url( 'order-received' ) ) {
529
+ $content .= $html;
530
+ $this->set_slug( $optin );
531
+ continue;
532
+ }
533
+ }
534
+
535
+ // is_wc_endpoint_url( 'view-order' )
536
+ if ( isset( $fields['is_wc_endpoint_view_order'] ) && $fields['is_wc_endpoint_view_order'] ) {
537
+ $global = false;
538
+ if( is_wc_endpoint_url( 'view-order' ) ) {
539
+ $content .= $html;
540
+ $this->set_slug( $optin );
541
+ continue;
542
+ }
543
+ }
544
+
545
+ // is_wc_endpoint_url( 'edit-account' )
546
+ if ( isset( $fields['is_wc_endpoint_edit_account'] ) && $fields['is_wc_endpoint_edit_account'] ) {
547
+ $global = false;
548
+ if( is_wc_endpoint_url( 'edit-account' ) ) {
549
+ $content .= $html;
550
+ $this->set_slug( $optin );
551
+ continue;
552
+ }
553
+ }
554
+
555
+ // is_wc_endpoint_url( 'edit-address' )
556
+ if ( isset( $fields['is_wc_endpoint_edit_address'] ) && $fields['is_wc_endpoint_edit_address'] ) {
557
+ $global = false;
558
+ if( is_wc_endpoint_url( 'edit-address' ) ) {
559
+ $content .= $html;
560
+ $this->set_slug( $optin );
561
+ continue;
562
+ }
563
+ }
564
+
565
+ // is_wc_endpoint_url( 'lost-password' )
566
+ if ( isset( $fields['is_wc_endpoint_lost_password'] ) && $fields['is_wc_endpoint_lost_password'] ) {
567
+ $global = false;
568
+ if( is_wc_endpoint_url( 'lost-password' ) ) {
569
+ $content .= $html;
570
+ $this->set_slug( $optin );
571
+ continue;
572
+ }
573
+ }
574
+
575
+ // is_wc_endpoint_url( 'customer-logout' )
576
+ if ( isset( $fields['is_wc_endpoint_customer_logout'] ) && $fields['is_wc_endpoint_customer_logout'] ) {
577
+ $global = false;
578
+ if( is_wc_endpoint_url( 'customer-logout' ) ) {
579
+ $content .= $html;
580
+ $this->set_slug( $optin );
581
+ continue;
582
+ }
583
+ }
584
+ // is_wc_endpoint_url( 'add-payment-method' )
585
+ if ( isset( $fields['is_wc_endpoint_add_payment_method'] ) && $fields['is_wc_endpoint_add_payment_method'] ) {
586
+ $global = false;
587
+ if( is_wc_endpoint_url( 'add-payment-method' ) ) {
588
+ $content .= $html;
589
+ $this->set_slug( $optin );
590
+ continue;
591
+ }
592
+ }
593
+
594
+
595
+
596
+ }
597
+
598
  // If the optin is set to be automatically displayed, show it.
599
  if ( isset( $fields['automatic'] ) && $fields['automatic'] && is_singular( 'post' ) ) {
600
  $content .= $html;
834
  }
835
  }
836
 
837
+ // If WooCommerce is enabled we can look for WooCommerce specific settings.
838
+ if ( $this->base->is_woocommerce_active() ) {
839
+
840
+ // Separate never checks for WooCommerce pages that don't ID match
841
+ if ( ! empty( $fields['never'] ) ) {
842
+ // No global check on purpose. Global is still true if only this setting is populated.
843
+ if ( in_array( wc_get_page_id( 'shop' ), (array) $fields['never'] ) && is_shop() ) {
844
+ continue;
845
+ }
846
+ }
847
+
848
+ // is_woocommerce
849
+ if ( isset( $fields['show_on_woocommerce'] ) && $fields['show_on_woocommerce'] ) {
850
+ $global = false;
851
+ if( is_woocommerce() ) {
852
+ $init[ $optin->post_name ] = $html;
853
+ $this->set_slug( $optin );
854
+ continue;
855
+ }
856
+ }
857
+
858
+ // is_shop
859
+ if ( isset( $fields['is_wc_shop'] ) && $fields['is_wc_shop'] ) {
860
+ $global = false;
861
+ if( is_shop() ) {
862
+ $init[ $optin->post_name ] = $html;
863
+ $this->set_slug( $optin );
864
+ continue;
865
+ }
866
+ }
867
+
868
+ // is_product
869
+ if ( isset( $fields['is_wc_product'] ) && $fields['is_wc_product'] ) {
870
+ $global = false;
871
+ if( is_product() ) {
872
+ $init[ $optin->post_name ] = $html;
873
+ $this->set_slug( $optin );
874
+ continue;
875
+ }
876
+ }
877
+
878
+ // is_cart
879
+ if ( isset( $fields['is_wc_cart'] ) && $fields['is_wc_cart'] ) {
880
+ $global = false;
881
+ if( is_cart() ) {
882
+ $init[ $optin->post_name ] = $html;
883
+ $this->set_slug( $optin );
884
+ continue;
885
+ }
886
+ }
887
+
888
+ // is_checkout
889
+ if ( isset( $fields['is_wc_checkout'] ) && $fields['is_wc_checkout'] ) {
890
+ $global = false;
891
+ if( is_checkout() ) {
892
+ $init[ $optin->post_name ] = $html;
893
+ $this->set_slug( $optin );
894
+ continue;
895
+ }
896
+ }
897
+
898
+ // is_account_page
899
+ if ( isset( $fields['is_wc_account'] ) && $fields['is_wc_account'] ) {
900
+ $global = false;
901
+ if( is_account_page() ) {
902
+ $init[ $optin->post_name ] = $html;
903
+ $this->set_slug( $optin );
904
+ continue;
905
+ }
906
+ }
907
+
908
+ // is_wc_endpoint_url
909
+ if ( isset( $fields['is_wc_endpoint'] ) && $fields['is_wc_endpoint'] ) {
910
+ $global = false;
911
+ if( is_wc_endpoint_url() ) {
912
+ $init[ $optin->post_name ] = $html;
913
+ $this->set_slug( $optin );
914
+ continue;
915
+ }
916
+ }
917
+
918
+ // is_wc_endpoint_url( 'order-pay' )
919
+ if ( isset( $fields['is_wc_endpoint_order_pay'] ) && $fields['is_wc_endpoint_order_pay'] ) {
920
+ $global = false;
921
+ if( is_wc_endpoint_url( 'order-pay' ) ) {
922
+ $init[ $optin->post_name ] = $html;
923
+ $this->set_slug( $optin );
924
+ continue;
925
+ }
926
+ }
927
+
928
+ // is_wc_endpoint_url( 'order-received' )
929
+ if ( isset( $fields['is_wc_endpoint_order_received'] ) && $fields['is_wc_endpoint_order_received'] ) {
930
+ $global = false;
931
+ if( is_wc_endpoint_url( 'order-received' ) ) {
932
+ $init[ $optin->post_name ] = $html;
933
+ $this->set_slug( $optin );
934
+ continue;
935
+ }
936
+ }
937
+
938
+ // is_wc_endpoint_url( 'view-order' )
939
+ if ( isset( $fields['is_wc_endpoint_view_order'] ) && $fields['is_wc_endpoint_view_order'] ) {
940
+ $global = false;
941
+ if( is_wc_endpoint_url( 'view-order' ) ) {
942
+ $init[ $optin->post_name ] = $html;
943
+ $this->set_slug( $optin );
944
+ continue;
945
+ }
946
+ }
947
+
948
+ // is_wc_endpoint_url( 'edit-account' )
949
+ if ( isset( $fields['is_wc_endpoint_edit_account'] ) && $fields['is_wc_endpoint_edit_account'] ) {
950
+ $global = false;
951
+ if( is_wc_endpoint_url( 'edit-account' ) ) {
952
+ $init[ $optin->post_name ] = $html;
953
+ $this->set_slug( $optin );
954
+ continue;
955
+ }
956
+ }
957
+
958
+ // is_wc_endpoint_url( 'edit-address' )
959
+ if ( isset( $fields['is_wc_endpoint_edit_address'] ) && $fields['is_wc_endpoint_edit_address'] ) {
960
+ $global = false;
961
+ if( is_wc_endpoint_url( 'edit-address' ) ) {
962
+ $init[ $optin->post_name ] = $html;
963
+ $this->set_slug( $optin );
964
+ continue;
965
+ }
966
+ }
967
+
968
+ // is_wc_endpoint_url( 'lost-password' )
969
+ if ( isset( $fields['is_wc_endpoint_lost_password'] ) && $fields['is_wc_endpoint_lost_password'] ) {
970
+ $global = false;
971
+ if( is_wc_endpoint_url( 'lost-password' ) ) {
972
+ $init[ $optin->post_name ] = $html;
973
+ $this->set_slug( $optin );
974
+ continue;
975
+ }
976
+ }
977
+
978
+ // is_wc_endpoint_url( 'customer-logout' )
979
+ if ( isset( $fields['is_wc_endpoint_customer_logout'] ) && $fields['is_wc_endpoint_customer_logout'] ) {
980
+ $global = false;
981
+ if( is_wc_endpoint_url( 'customer-logout' ) ) {
982
+ $init[ $optin->post_name ] = $html;
983
+ $this->set_slug( $optin );
984
+ continue;
985
+ }
986
+ }
987
+ // is_wc_endpoint_url( 'add-payment-method' )
988
+ if ( isset( $fields['is_wc_endpoint_add_payment_method'] ) && $fields['is_wc_endpoint_add_payment_method'] ) {
989
+ $global = false;
990
+ if( is_wc_endpoint_url( 'add-payment-method' ) ) {
991
+ $init[ $optin->post_name ] = $html;
992
+ $this->set_slug( $optin );
993
+ continue;
994
+ }
995
+ }
996
+
997
+
998
+ }
999
+
1000
  // If we should be loading globally, do it now.
1001
  if ( $global ) {
1002
  $init[ $optin->post_name ] = $html;
OMAPI/Save.php CHANGED
@@ -233,6 +233,28 @@ class OMAPI_Save {
233
  $fields['taxonomies'] = isset( $data['taxonomies'] ) ? $data['taxonomies'] : array();
234
  $fields['show'] = isset( $data['show'] ) ? $data['show'] : array();
235
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
236
  // Convert old test mode data and remove.
237
  $test_mode = get_post_meta( $optin_id, '_omapi_test', true );
238
  if ( isset( $test_mode ) && $test_mode ) {
233
  $fields['taxonomies'] = isset( $data['taxonomies'] ) ? $data['taxonomies'] : array();
234
  $fields['show'] = isset( $data['show'] ) ? $data['show'] : array();
235
 
236
+ // WooCommerce Fields.
237
+ $fields['show_on_woocommerce'] = isset( $data['show_on_woocommerce'] ) ? 1 : 0;
238
+ $fields['is_wc_shop'] = isset( $data['is_wc_shop'] ) ? 1 : 0;
239
+ $fields['is_wc_product'] = isset( $data['is_wc_product'] ) ? 1 : 0;
240
+ $fields['is_wc_cart'] = isset( $data['is_wc_cart'] ) ? 1 : 0;
241
+ $fields['is_wc_checkout'] = isset( $data['is_wc_checkout'] ) ? 1 : 0;
242
+ $fields['is_wc_account'] = isset( $data['is_wc_account'] ) ? 1 : 0;
243
+ $fields['is_wc_endpoint'] = isset( $data['is_wc_endpoint'] ) ? 1 : 0;
244
+ $fields['is_wc_endpoint_order_pay'] = isset( $data['is_wc_endpoint_order_pay'] ) ? 1 : 0;
245
+ $fields['is_wc_endpoint_order_received'] = isset( $data['is_wc_endpoint_order_received'] ) ? 1 : 0;
246
+ $fields['is_wc_endpoint_view_order'] = isset( $data['is_wc_endpoint_view_order'] ) ? 1 : 0;
247
+ $fields['is_wc_endpoint_edit_account'] = isset( $data['is_wc_endpoint_edit_account'] ) ? 1 : 0;
248
+ $fields['is_wc_endpoint_edit_address'] = isset( $data['is_wc_endpoint_edit_address'] ) ? 1 : 0;
249
+ $fields['is_wc_endpoint_lost_password'] = isset( $data['is_wc_endpoint_lost_password'] ) ? 1 : 0;
250
+ $fields['is_wc_endpoint_customer_logout'] = isset( $data['is_wc_endpoint_customer_logout'] ) ? 1 : 0;
251
+ $fields['is_wc_endpoint_add_payment_method'] = isset( $data['is_wc_endpoint_add_payment_method'] ) ? 1 : 0;
252
+
253
+ // Save the data from the regular taxonomies fields into the WC specific tax field.
254
+ $fields['is_wc_product_category'] = isset( $data['taxonomies']['product_cat'] ) ? $data['taxonomies']['product_cat'] : array();
255
+ $fields['is_wc_product_tag'] = isset( $data['taxonomies']['product_tag'] ) ? $data['taxonomies']['product_tag'] : array();
256
+
257
+
258
  // Convert old test mode data and remove.
259
  $test_mode = get_post_meta( $optin_id, '_omapi_test', true );
260
  if ( isset( $test_mode ) && $test_mode ) {
OMAPI/Welcome.php CHANGED
@@ -94,7 +94,7 @@ class OMAPI_Welcome {
94
  // Make sure welcome page is always first page to view.
95
  if ( 'toplevel_page_optin-monster-api-settings' === $screen->id ) {
96
  $welcome = get_option( 'optin_monster_viewed_welcome', false );
97
- if ( ! $welcome && ! $this->base->get_api_credentials() ) {
98
  die( wp_redirect( 'admin.php?page=optin-monster-api-welcome' ) );
99
  }
100
  }
94
  // Make sure welcome page is always first page to view.
95
  if ( 'toplevel_page_optin-monster-api-settings' === $screen->id ) {
96
  $welcome = get_option( 'optin_monster_viewed_welcome', false );
97
+ if ( ! $welcome && ! $this->base->get_api_credentials() && ! is_network_admin() ) {
98
  die( wp_redirect( 'admin.php?page=optin-monster-api-welcome' ) );
99
  }
100
  }
assets/js/settings.js CHANGED
@@ -36,9 +36,10 @@ jQuery(document).ready(function ($) {
36
  */
37
  function omapiSettingsToggle() {
38
 
39
- $('.omapi-ui-toggle-controller').click(function () {
40
- $(this).toggleClass("toggled");
41
- $(this).siblings(".omapi-ui-toggle-content").toggleClass("visible");
 
42
  });
43
 
44
  }
36
  */
37
  function omapiSettingsToggle() {
38
 
39
+ $('.omapi-ui-toggle-controller').click(function (e) {
40
+ var thisToggle = e.currentTarget;
41
+ $(thisToggle).toggleClass("toggled");
42
+ $(thisToggle).next(".omapi-ui-toggle-content").toggleClass("visible");
43
  });
44
 
45
  }
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: OptinMonster Team
7
  * Author URI: https://optinmonster.com
8
- * Version: 1.1.9
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.9';
64
 
65
  /**
66
  * The name of the plugin.
@@ -395,6 +395,20 @@ class OMAPI {
395
  return false;
396
  }
397
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
398
  /**
399
  * Returns possible API key error flag.
400
  *
5
  * Description: OptinMonster API plugin to connect your WordPress site to your OptinMonster forms.
6
  * Author: OptinMonster Team
7
  * Author URI: https://optinmonster.com
8
+ * Version: 1.2.0
9
  * Text Domain: optin-monster-api
10
  * Domain Path: languages
11
  *
60
  *
61
  * @var string
62
  */
63
+ public $version = '1.2.0';
64
 
65
  /**
66
  * The name of the plugin.
395
  return false;
396
  }
397
 
398
+ /**
399
+ * Check if the main WooCommerce class is active.
400
+ *
401
+ * @since 1.1.9
402
+ *
403
+ * @return bool
404
+ */
405
+ public function is_woocommerce_active() {
406
+ if (class_exists( 'WooCommerce' ) ) {
407
+ return true;
408
+ }
409
+ return false;
410
+ }
411
+
412
  /**
413
  * Returns possible API key error flag.
414
  *
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: optinmonster, 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.9
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,11 +160,16 @@ OptinMonster is the <a href="http://optinmonster.com" rel="friend" title="OptinM
160
 
161
  == Changelog ==
162
 
 
 
 
 
 
163
  = 1.1.9 =
164
- * Updated version numbers to prevent possible asset caching errors
165
 
166
  = 1.1.8 =
167
- * Fixed possible undefined errors for API credentials
168
 
169
  = 1.1.7 =
170
  * Updated the API script domain for adblock.
2
  Contributors: optinmonster, 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.8
6
+ Stable tag: 1.2.0
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.2.0 =
164
+ * Added additional support for WooCommerce display settings.
165
+ * Updated language for legacy migrations.
166
+ * Fixed a multisite activation issue.
167
+
168
  = 1.1.9 =
169
+ * Updated version numbers to prevent possible asset caching errors.
170
 
171
  = 1.1.8 =
172
+ * Fixed possible undefined errors for API credentials.
173
 
174
  = 1.1.7 =
175
  * Updated the API script domain for adblock.