Ninja Forms – The Easy and Powerful Forms Builder - Version 3.4.5

Version Description

(19 March 2019) =

Changes:

  • Upgrade to THREE for legacy users will no longer immediately trigger additional required updates.
  • Introducing SendWP - A dedicated WordPress email solution!

=

Download this release

Release Info

Developer krmoorhouse
Plugin Icon 128x128 Ninja Forms – The Easy and Powerful Forms Builder
Version 3.4.5
Comparing to
See all releases

Code changes from version 3.4.4 to 3.4.5

assets/img/promotions/dashboard-sendwp.png ADDED
Binary file
assets/js/lib/sendwp.js ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ function ninja_forms_sendwp_remote_install() {
2
+ var data = {
3
+ 'action': 'ninja_forms_sendwp_remote_install',
4
+ };
5
+
6
+ // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
7
+ jQuery.post(ajaxurl, data, function(response) {
8
+ var data = JSON.parse(response);
9
+ ninja_forms_sendwp_register_client(data.register_url, data.client_name, data.client_secret, data.client_redirect, data.partner_id);
10
+ });
11
+ }
12
+
13
+ function ninja_forms_sendwp_register_client(register_url, client_name, client_secret, client_redirect, partner_id) {
14
+
15
+ var form = document.createElement("form");
16
+ form.setAttribute("method", 'POST');
17
+ form.setAttribute("action", register_url);
18
+
19
+ function ninja_forms_sendwp_append_form_input(name, value) {
20
+ var input = document.createElement("input");
21
+ input.setAttribute("type", "hidden");
22
+ input.setAttribute("name", name);
23
+ input.setAttribute("value", value);
24
+ form.appendChild(input);
25
+ }
26
+
27
+ ninja_forms_sendwp_append_form_input('client_name', client_name);
28
+ ninja_forms_sendwp_append_form_input('client_secret', client_secret);
29
+ ninja_forms_sendwp_append_form_input('client_redirect', client_redirect);
30
+ ninja_forms_sendwp_append_form_input('partner_id', partner_id);
31
+
32
+ document.body.appendChild(form);
33
+ form.submit();
34
+ }
deprecated/ninja-forms.php CHANGED
@@ -265,7 +265,7 @@ class Ninja_Forms {
265
 
266
  // Plugin version
267
  if ( ! defined( 'NF_PLUGIN_VERSION' ) )
268
- define( 'NF_PLUGIN_VERSION', '3.4.4' );
269
 
270
  // Plugin Folder Path
271
  if ( ! defined( 'NF_PLUGIN_DIR' ) )
265
 
266
  // Plugin version
267
  if ( ! defined( 'NF_PLUGIN_VERSION' ) )
268
+ define( 'NF_PLUGIN_VERSION', '3.4.5' );
269
 
270
  // Plugin Folder Path
271
  if ( ! defined( 'NF_PLUGIN_DIR' ) )
includes/Admin/Menus/Forms.php CHANGED
@@ -160,6 +160,7 @@ final class NF_Admin_Menus_Forms extends NF_Abstracts_Menu
160
  wp_enqueue_script( 'nf-batch-processor', Ninja_Forms::$url . 'assets/js/lib/batch-processor.js', array( 'nf-ninjamodal' ), $this->ver );
161
  wp_enqueue_script( 'nf-moment', Ninja_Forms::$url . 'assets/js/lib/moment-with-locales.min.js', array( 'jquery', 'nf-dashboard' ) );
162
  wp_enqueue_script( 'nf-dashboard', Ninja_Forms::$url . 'assets/js/min/dashboard.min.js', array( 'backbone-radio', 'backbone-marionette-3' ), $this->ver );
 
163
 
164
  $current_user = wp_get_current_user();
165
  wp_localize_script( 'nf-dashboard', 'nfi18n', Ninja_Forms::config( 'i18nDashboard' ) );
160
  wp_enqueue_script( 'nf-batch-processor', Ninja_Forms::$url . 'assets/js/lib/batch-processor.js', array( 'nf-ninjamodal' ), $this->ver );
161
  wp_enqueue_script( 'nf-moment', Ninja_Forms::$url . 'assets/js/lib/moment-with-locales.min.js', array( 'jquery', 'nf-dashboard' ) );
162
  wp_enqueue_script( 'nf-dashboard', Ninja_Forms::$url . 'assets/js/min/dashboard.min.js', array( 'backbone-radio', 'backbone-marionette-3' ), $this->ver );
163
+ wp_enqueue_script( 'nf-sendwp', Ninja_Forms::$url . 'assets/js/lib/sendwp.js', array(), $this->ver );
164
 
165
  $current_user = wp_get_current_user();
166
  wp_localize_script( 'nf-dashboard', 'nfi18n', Ninja_Forms::config( 'i18nDashboard' ) );
includes/Config/DashboardPromotions.php CHANGED
@@ -9,12 +9,53 @@ return apply_filters( 'ninja-forms-dashboard-promotions', array(
9
  |
10
  */
11
 
12
- 'ninja-mail' => array(
13
- 'id' => 'ninja-mail',
14
- 'content' => '<a href="#services"><span class="dashicons dashicons-email-alt"></span>' . __( 'Hosts are bad at sending emails. Improve the reliability of your submission emails! ', 'ninja-forms' ) . '<br /><span class="cta">' . __( 'Try our new Ninja Mail service!', 'ninja-forms' ) . '</span></a>',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  'script' => "
16
  setTimeout(function(){ /* Wait for services to init. */
17
- Backbone.Radio.channel( 'dashboard' ).request( 'more:service:ninja-mail' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  }, 500);
19
  "
20
  ),
9
  |
10
  */
11
 
12
+ // @TODO: This section is deprecated. Remove at a later date.
13
+ // 'ninja-mail' => array(
14
+ // 'id' => 'ninja-mail',
15
+ // 'content' => '<a href="#services"><span class="dashicons dashicons-email-alt"></span>' . __( 'Hosts are bad at sending emails. Improve the reliability of your submission emails! ', 'ninja-forms' ) . '<br /><span class="cta">' . __( 'Try our new Ninja Mail service!', 'ninja-forms' ) . '</span></a>',
16
+ // 'script' => "
17
+ // setTimeout(function(){ /* Wait for services to init. */
18
+ // Backbone.Radio.channel( 'dashboard' ).request( 'more:service:ninja-mail' );
19
+ // }, 500);
20
+ // "
21
+ // ),
22
+
23
+ /*
24
+ |--------------------------------------------------------------------------
25
+ | SendWP
26
+ |--------------------------------------------------------------------------
27
+ |
28
+ */
29
+
30
+ 'sendwp' => array(
31
+ 'id' => 'sendwp',
32
+ 'content' => '<span aria-label="SendWP. Getting WordPress email into an inbox shouldn\'t be that hard! Never miss another receipt, form submission, or any WordPress email ever again." style="cursor:pointer;width:800px;height:83px;border-radius:4px;-moz-border-radius:4px;-webkit-border-radius:4px;background-image:url(\'' . NF_PLUGIN_URL . 'assets/img/promotions/dashboard-sendwp.png\');display:block;"></span>',
33
  'script' => "
34
  setTimeout(function(){ /* Wait for services to init. */
35
+ var data = {
36
+ width: 450,
37
+ closeOnClick: 'body',
38
+ closeOnEsc: true,
39
+ content: '<p><h2>Frustrated that WordPress email isn’t being received?</h2><p>Form submission notifications not hitting your inbox? Some of your visitors getting form feedback via email, others not? By default, your WordPress site sends emails through your web host, which can be unreliable. Your host has spent lots of time and money optimizing to serve your pages, not send your emails.</p><h3>Sign up for SendWP today, and never deal with WordPress email issues again!</h3><p>SendWP is an email service that removes your web host from the email equation.</p><ul style=&quot;list-style-type:initial;margin-left: 20px;&quot;><li>Sends email through dedicated email service, increasing email deliverability.</li><li>Keeps form submission emails out of spam by using a trusted email provider.</li><li>On a shared web host? Don’t worry about emails being rejected because of blocked IP addresses.</li><li><strong>Only $9/month. Free 14-day trial. Cancel anytime!</strong></li></ul></p><br />',
40
+ btnPrimary: {
41
+ text: 'Sign me up!',
42
+ callback: function() {
43
+ var spinner = document.createElement('span');
44
+ spinner.classList.add('dashicons', 'dashicons-update', 'dashicons-update-spin');
45
+ var w = this.offsetWidth;
46
+ this.innerHTML = spinner.outerHTML;
47
+ this.style.width = w+'px';
48
+ ninja_forms_sendwp_remote_install();
49
+ }
50
+ },
51
+ btnSecondary: {
52
+ text: 'Cancel',
53
+ callback: function() {
54
+ sendwpModal.toggleModal(false);
55
+ }
56
+ }
57
+ }
58
+ var sendwpModal = new NinjaModal(data);
59
  }, 500);
60
  "
61
  ),
includes/Integrations/sendwp.php ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ add_action( 'wp_ajax_ninja_forms_sendwp_remote_install', 'wp_ajax_ninja_forms_sendwp_remote_install_handler' );
4
+
5
+ function wp_ajax_ninja_forms_sendwp_remote_install_handler () {
6
+ $plugin_slug = 'sendwp';
7
+
8
+ include_once ABSPATH . 'wp-admin/includes/plugin-install.php';
9
+ include_once ABSPATH . 'wp-admin/includes/file.php';
10
+ include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
11
+
12
+ /*
13
+ * Use the WordPress Plugins API to get the plugin download link.
14
+ */
15
+ $api = plugins_api( 'plugin_information', array(
16
+ 'slug' => $plugin_slug,
17
+ ) );
18
+ if ( is_wp_error( $api ) ) {
19
+ ob_end_clean();
20
+ echo json_encode( array( 'error' => $api->get_error_message(), 'debug' => $api ) );
21
+ exit;
22
+ }
23
+
24
+ /*
25
+ * Use the AJAX Upgrader skin to quietly install the plugin.
26
+ */
27
+ $upgrader = new Plugin_Upgrader( new WP_Ajax_Upgrader_Skin() );
28
+ $install = $upgrader->install( $api->download_link );
29
+ if ( is_wp_error( $install ) ) {
30
+ ob_end_clean();
31
+ echo json_encode( array( 'error' => $install->get_error_message(), 'debug' => $api ) );
32
+ exit;
33
+ }
34
+
35
+ /*
36
+ * Activate the plugin based on the results of the upgrader.
37
+ * @NOTE Assume this works, if the download works - otherwise there is a false positive if the plugin is already installed.
38
+ */
39
+ $activated = activate_plugin( $upgrader->plugin_info() );
40
+
41
+ /*
42
+ * Final check to see if SendWP is available.
43
+ */
44
+ if( ! function_exists('sendwp_get_server_url') ) {
45
+ ob_end_clean();
46
+ echo json_encode( array(
47
+ 'error' => __( 'Something went wrong. SendWP was not installed correctly.' ),
48
+ 'install' => $install,
49
+ ) );
50
+ exit;
51
+ }
52
+
53
+ echo json_encode( array(
54
+ 'partner_id' => 16,
55
+ 'register_url' => sendwp_get_server_url() . '_/signup',
56
+ 'client_name' => sendwp_get_client_name(),
57
+ 'client_secret' => sendwp_get_client_secret(),
58
+ 'client_redirect' => sendwp_get_client_redirect(),
59
+ ) );
60
+ exit;
61
+ }
62
+
63
+ add_filter( 'ninja-forms-dashboard-promotions', 'ninja_forms_sendwp_remove_promotion' );
64
+
65
+ function ninja_forms_sendwp_remove_promotion( $promotions ){
66
+ if( ninja_forms_sendwp_is_service_connected() || class_exists('\\NinjaMail\\Plugin') ){
67
+ unset( $promotions[ 'sendwp' ] );
68
+ }
69
+ return $promotions;
70
+ }
71
+
72
+ function ninja_forms_sendwp_is_service_connected() {
73
+
74
+ if( ! class_exists('\\SendWP\\Mailer') ) return false;
75
+ return sendwp_client_connected();
76
+
77
+ }
lib/NF_Upgrade.php CHANGED
@@ -12,7 +12,10 @@ function ninja_forms_ajax_migrate_database(){
12
  $nuke_multisite = false;
13
  $migrations->nuke( $sure, $really_sure, $nuke_multisite );
14
  $migrations->migrate();
 
15
  delete_option( 'ninja_forms_required_updates' );
 
 
16
  echo json_encode( array( 'migrate' => 'true' ) );
17
  wp_die();
18
  }
12
  $nuke_multisite = false;
13
  $migrations->nuke( $sure, $really_sure, $nuke_multisite );
14
  $migrations->migrate();
15
+ // Reset our required updates.
16
  delete_option( 'ninja_forms_required_updates' );
17
+ // Prevent recent 2.9x conversions from running required updates within a week.
18
+ set_transient( 'ninja_forms_prevent_updates', 'true', WEEK_IN_SECONDS );
19
  echo json_encode( array( 'migrate' => 'true' ) );
20
  wp_die();
21
  }
ninja-forms.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Ninja Forms
4
  Plugin URI: http://ninjaforms.com/
5
  Description: Ninja Forms is a webform builder with unparalleled ease of use and features.
6
- Version: 3.4.4
7
  Author: The WP Ninjas
8
  Author URI: http://ninjaforms.com
9
  Text Domain: ninja-forms
@@ -17,6 +17,7 @@ require_once dirname( __FILE__ ) . '/lib/NF_Tracking.php';
17
  require_once dirname( __FILE__ ) . '/lib/NF_Conversion.php';
18
  require_once dirname( __FILE__ ) . '/lib/NF_ExceptionHandlerJS.php';
19
  require_once dirname( __FILE__ ) . '/lib/Conversion/Calculations.php';
 
20
 
21
  // Services require PHP v5.6+
22
  if( version_compare( PHP_VERSION, '5.6', '>=' ) ) {
@@ -58,7 +59,7 @@ if( get_option( 'ninja_forms_load_deprecated', FALSE ) && ! ( isset( $_POST[ 'nf
58
  * @since 3.0
59
  */
60
 
61
- const VERSION = '3.4.4';
62
 
63
  /**
64
  * @since 3.4.0
@@ -491,11 +492,14 @@ if( get_option( 'ninja_forms_load_deprecated', FALSE ) && ! ( isset( $_POST[ 'nf
491
  $sql = "SELECT COUNT( `id` ) AS total FROM `{$wpdb->prefix}nf3_forms`;";
492
  $result = $wpdb->get_results( $sql, 'ARRAY_A' );
493
  $threshold = 10; // Threshold percentage for our required updates.
 
 
 
494
  // If we got back a list of updates...
495
  // AND If we have any forms on the site...
496
  // AND If the gate is open...
497
  // To avoid errors on older upgrades, ignore the gatekeeper if the db version is the baseline (1.0)...
498
- if ( ! empty( $required_updates )
499
  && 0 < $result[ 0 ][ 'total' ]
500
  && ( WPN_Helper::gated_release( $threshold )
501
  || '1.0' == self::$db_version ) ) {
3
  Plugin Name: Ninja Forms
4
  Plugin URI: http://ninjaforms.com/
5
  Description: Ninja Forms is a webform builder with unparalleled ease of use and features.
6
+ Version: 3.4.5
7
  Author: The WP Ninjas
8
  Author URI: http://ninjaforms.com
9
  Text Domain: ninja-forms
17
  require_once dirname( __FILE__ ) . '/lib/NF_Conversion.php';
18
  require_once dirname( __FILE__ ) . '/lib/NF_ExceptionHandlerJS.php';
19
  require_once dirname( __FILE__ ) . '/lib/Conversion/Calculations.php';
20
+ require_once dirname( __FILE__ ) . '/includes/Integrations/sendwp.php';
21
 
22
  // Services require PHP v5.6+
23
  if( version_compare( PHP_VERSION, '5.6', '>=' ) ) {
59
  * @since 3.0
60
  */
61
 
62
+ const VERSION = '3.4.5';
63
 
64
  /**
65
  * @since 3.4.0
492
  $sql = "SELECT COUNT( `id` ) AS total FROM `{$wpdb->prefix}nf3_forms`;";
493
  $result = $wpdb->get_results( $sql, 'ARRAY_A' );
494
  $threshold = 10; // Threshold percentage for our required updates.
495
+ if ( get_transient( 'ninja_forms_prevent_updates' ) ) {
496
+ update_option( 'ninja_forms_needs_updates', 0 );
497
+ }
498
  // If we got back a list of updates...
499
  // AND If we have any forms on the site...
500
  // AND If the gate is open...
501
  // To avoid errors on older upgrades, ignore the gatekeeper if the db version is the baseline (1.0)...
502
+ elseif ( ! empty( $required_updates )
503
  && 0 < $result[ 0 ][ 'total' ]
504
  && ( WPN_Helper::gated_release( $threshold )
505
  || '1.0' == self::$db_version ) ) {
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: wpninjasllc, kstover, jameslaws, kbjohnson90, klhall1987, krmoorho
3
  Tags: form, forms, contact form, custom form, form builder, form creator, form manager, form creation, contact forms, custom forms, forms builder, forms creator, forms manager, forms creation, form administration,
4
  Requires at least: 4.8
5
  Tested up to: 5.0
6
- Stable tag: 3.4.4
7
  License: GPLv2 or later
8
 
9
  Drag and drop fields in an intuitive UI to create contact forms, email subscription forms, order forms, payment forms, send emails and more!
@@ -111,14 +111,22 @@ For help and video tutorials, please visit our website: [Ninja Forms Documentati
111
 
112
  == Upgrade Notice ==
113
 
114
- = 3.4.4 (13 February 2019) =
115
 
116
- *Bugs:*
117
 
118
- * Resolved an issue that was sometimes causing the submission sequence to reset.
 
119
 
120
  == Changelog ==
121
 
 
 
 
 
 
 
 
122
  = 3.4.4 (13 February 2019) =
123
 
124
  *Bugs:*
3
  Tags: form, forms, contact form, custom form, form builder, form creator, form manager, form creation, contact forms, custom forms, forms builder, forms creator, forms manager, forms creation, form administration,
4
  Requires at least: 4.8
5
  Tested up to: 5.0
6
+ Stable tag: 3.4.5
7
  License: GPLv2 or later
8
 
9
  Drag and drop fields in an intuitive UI to create contact forms, email subscription forms, order forms, payment forms, send emails and more!
111
 
112
  == Upgrade Notice ==
113
 
114
+ = 3.4.5 (19 March 2019) =
115
 
116
+ *Changes:*
117
 
118
+ * Upgrade to THREE for legacy users will no longer immediately trigger additional required updates.
119
+ * Introducing SendWP - A dedicated WordPress email solution!
120
 
121
  == Changelog ==
122
 
123
+ = 3.4.5 (19 March 2019) =
124
+
125
+ *Changes:*
126
+
127
+ * Upgrade to THREE for legacy users will no longer immediately trigger additional required updates.
128
+ * Introducing SendWP - A dedicated WordPress email solution!
129
+
130
  = 3.4.4 (13 February 2019) =
131
 
132
  *Bugs:*
services/bootstrap.php CHANGED
@@ -38,32 +38,6 @@ add_action( 'wp_ajax_nf_services', function(){
38
  </div>
39
  ',
40
  ],
41
-
42
- 'ninja-mail' => [
43
- 'name' => __( 'Ninja Mail - Transactional Email', 'ninja-mail' ),
44
- 'slug' => 'ninja-mail',
45
- 'installPath' => 'ninja-mail/ninja-mail.php',
46
- 'description' => 'Increase Email Deliverability with a dedicated email service by Ninja Forms for only $5/month/site.',
47
- 'enabled' => null,
48
- 'setupButtonText' => 'Signup',
49
- 'learnMoreTitle' => 'Improve Ninja Forms Email Reliability!',
50
- 'learnMore' => '
51
- <div style="padding:20px;">
52
- <h2>Frustrated that Ninja Forms email isn’t being received?</h2>
53
- <p>Form submission notifications not hitting your inbox? Some of your visitors getting form feedback via email, others not? By default, your WordPress site sends emails through your web host, which can be unreliable. Your host has spent lots of time and money optimizing to serve your pages, not send your emails.</p>
54
- <h3>Sign up for Ninja Mail today, and never deal with form email issues again!</h3>
55
- <p>Ninja Mail is a transactional email service that removes your web host from the email equation.</p>
56
- <ul style="list-style-type:initial;margin-left: 20px;">
57
- <li>Sends email through dedicated email service, increasing email deliverability.</li>
58
- <li>Keeps form submission emails out of spam by using a trusted email provider.</li>
59
- <li>On a shared web host? Don’t worry about emails being rejected because of blocked IP addresses.</li>
60
- <li><strong>Only $5/month. Free 14-day trial. Cancel anytime!</strong></li>
61
- </ul>
62
- <br />
63
- <button style="display:block;width:100%;text-align:center;" class="nf-button primary" onclick="Backbone.Radio.channel( \'dashboard\' ).request( \'install:service\', \'ninja-mail\' );var spinner = document.createElement(\'span\'); spinner.classList.add(\'dashicons\', \'dashicons-update\', \'dashicons-update-spin\'); this.innerHTML = spinner.outerHTML; console.log( spinner )">SIGNUP FOR NINJA MAIL NOW!</button>
64
- </div>
65
- ',
66
- ],
67
  ] );
68
  wp_die( json_encode( [ 'data' => array_values( $services ) ] ) );
69
  });
38
  </div>
39
  ',
40
  ],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  ] );
42
  wp_die( json_encode( [ 'data' => array_values( $services ) ] ) );
43
  });