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

Version Description

(8 August 2018) =

Changes:

  • Added the abililty to have no default value for Country and State fields.
  • Added the Indian Rupee to the list of available currencies
  • Removed unnecessary comments from the main field template

Bugs:

  • User Meta Tags will no longer print out the tag when users are not logged in

=

Download this release

Release Info

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

Code changes from version 3.3.12 to 3.3.13

.gitlab-ci.yml ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ sast:
2
+ image: docker:stable
3
+ variables:
4
+ DOCKER_DRIVER: overlay2
5
+ allow_failure: true
6
+ services:
7
+ - docker:stable-dind
8
+ script:
9
+ - export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
10
+ - docker run
11
+ --env SAST_CONFIDENCE_LEVEL="${SAST_CONFIDENCE_LEVEL:-3}"
12
+ --volume "$PWD:/code"
13
+ --volume /var/run/docker.sock:/var/run/docker.sock
14
+ "registry.gitlab.com/gitlab-org/security-products/sast:$SP_VERSION" /app/bin/run /code
15
+ artifacts:
16
+ paths: [gl-sast-report.json]
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.3.12' );
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.3.13' );
269
 
270
  // Plugin Folder Path
271
  if ( ! defined( 'NF_PLUGIN_DIR' ) )
includes/Config/Currency.php CHANGED
@@ -89,4 +89,8 @@ return apply_filters( 'ninja_forms_currency', array(
89
  'label' => __( 'South African Rand', 'ninja-forms' ),
90
  'value' => 'ZAR'
91
  ),
 
 
 
 
92
  ));
89
  'label' => __( 'South African Rand', 'ninja-forms' ),
90
  'value' => 'ZAR'
91
  ),
92
+ 'INR' => array(
93
+ 'label' => __( 'Indian Rupee', 'ninja-forms' ),
94
+ 'value' => 'INR'
95
+ ),
96
  ));
includes/Fields/ListCountry.php CHANGED
@@ -86,6 +86,7 @@ class NF_Fields_ListCountry extends NF_Abstracts_List
86
  {
87
  ob_start();
88
  echo "<select name='fields[$id]'>";
 
89
  foreach( Ninja_Forms()->config( 'CountryList' ) as $label => $abbr ){
90
  $selected = ( $value == $abbr ) ? ' selected' : '';
91
  echo "<option value='" . $abbr . "'" . $selected . ">" . $label . "</option>";
@@ -97,6 +98,11 @@ class NF_Fields_ListCountry extends NF_Abstracts_List
97
  private function get_default_value_options()
98
  {
99
  $options = array();
 
 
 
 
 
100
  foreach( Ninja_Forms()->config( 'CountryList' ) as $label => $value ){
101
  $options[] = array(
102
  'label' => $label,
@@ -111,6 +117,15 @@ class NF_Fields_ListCountry extends NF_Abstracts_List
111
  {
112
  $order = 0;
113
  $options = array();
 
 
 
 
 
 
 
 
 
114
  foreach( Ninja_Forms()->config( 'CountryList' ) as $label => $value ){
115
  $options[] = array(
116
  'label' => $label,
86
  {
87
  ob_start();
88
  echo "<select name='fields[$id]'>";
89
+ echo "<option value=''>- " . __( 'Select Country', 'ninja-forms' ) . " -</option>";
90
  foreach( Ninja_Forms()->config( 'CountryList' ) as $label => $abbr ){
91
  $selected = ( $value == $abbr ) ? ' selected' : '';
92
  echo "<option value='" . $abbr . "'" . $selected . ">" . $label . "</option>";
98
  private function get_default_value_options()
99
  {
100
  $options = array();
101
+ // Option to have no default country
102
+ $options[] = array(
103
+ 'label' => '- ' . __( 'Select Country', 'ninja-forms' ) . ' -',
104
+ 'value' => ''
105
+ );
106
  foreach( Ninja_Forms()->config( 'CountryList' ) as $label => $value ){
107
  $options[] = array(
108
  'label' => $label,
117
  {
118
  $order = 0;
119
  $options = array();
120
+ // option to have no default country selected
121
+ $options[] = array(
122
+ 'label' => '- ' . __( 'Select Country', 'ninja-forms' ) . ' -',
123
+ 'value' => '',
124
+ 'calc' => '',
125
+ 'selected' => 0,
126
+ 'order' => $order,
127
+ );
128
+ $order++;
129
  foreach( Ninja_Forms()->config( 'CountryList' ) as $label => $value ){
130
  $options[] = array(
131
  'label' => $label,
includes/Fields/ListState.php CHANGED
@@ -32,6 +32,16 @@ class NF_Fields_ListState extends NF_Abstracts_List
32
  {
33
  $order = 0;
34
  $options = array();
 
 
 
 
 
 
 
 
 
 
35
  foreach( Ninja_Forms()->config( 'StateList' ) as $label => $value ){
36
  $options[] = array(
37
  'label' => $label,
32
  {
33
  $order = 0;
34
  $options = array();
35
+ // Option to have no state selected by default.
36
+ $options[] = array(
37
+ 'label' => '- ' . __( 'Select State', 'ninja-forms' ) . ' -',
38
+ 'value' => '',
39
+ 'calc' => '',
40
+ 'selected' => 0,
41
+ 'order' => $order,
42
+ );
43
+ $order++;
44
+
45
  foreach( Ninja_Forms()->config( 'StateList' ) as $label => $value ){
46
  $options[] = array(
47
  'label' => $label,
includes/MergeTags/WP.php CHANGED
@@ -22,6 +22,7 @@ final class NF_MergeTags_WP extends NF_Abstracts_MergeTags
22
  public function replace( $subject )
23
  {
24
  // Recursively replace merge tags.
 
25
  if( is_array( $subject ) ){
26
  foreach( $subject as $i => $s ){
27
  $subject[ $i ] = $this->replace( $s );
@@ -54,8 +55,10 @@ final class NF_MergeTags_WP extends NF_Abstracts_MergeTags
54
  * Replace Custom User Meta
55
  * {user_meta:foo} --> meta key is 'foo'
56
  */
 
57
  preg_match_all( "/{user_meta:(.*?)}/", $subject, $user_meta_matches );
58
- if( ! empty( $user_meta_matches[0] ) && $user_id = get_current_user_id() ) {
 
59
  /**
60
  * $matches[0][$i] merge tag match {user_meta:foo}
61
  * $matches[1][$i] captured meta key foo
@@ -65,6 +68,9 @@ final class NF_MergeTags_WP extends NF_Abstracts_MergeTags
65
  $meta_value = get_user_meta( $user_id, $meta_key, /* $single */ true );
66
  $subject = str_replace( $search, $meta_value, $subject );
67
  }
 
 
 
68
  }
69
  return parent::replace( $subject );
70
  }
22
  public function replace( $subject )
23
  {
24
  // Recursively replace merge tags.
25
+
26
  if( is_array( $subject ) ){
27
  foreach( $subject as $i => $s ){
28
  $subject[ $i ] = $this->replace( $s );
55
  * Replace Custom User Meta
56
  * {user_meta:foo} --> meta key is 'foo'
57
  */
58
+ $user_id = get_current_user_id();
59
  preg_match_all( "/{user_meta:(.*?)}/", $subject, $user_meta_matches );
60
+ // if user is logged in and we have user_meta merge tags
61
+ if( ! empty( $user_meta_matches[0] ) && $user_id != 0 ) {
62
  /**
63
  * $matches[0][$i] merge tag match {user_meta:foo}
64
  * $matches[1][$i] captured meta key foo
68
  $meta_value = get_user_meta( $user_id, $meta_key, /* $single */ true );
69
  $subject = str_replace( $search, $meta_value, $subject );
70
  }
71
+ // if a user is not logged in, but there are user_meta merge tags
72
+ } elseif ( ! empty( $user_meta_matches[0] ) && $user_id == 0 ) {
73
+ $subject = '';
74
  }
75
  return parent::replace( $subject );
76
  }
includes/Templates/fields-wrap.html CHANGED
@@ -4,26 +4,6 @@
4
  /*
5
  * This is our main field template. It's called for every field type.
6
  * Note that must have ONE top-level, wrapping element. i.e. a div/span/etc that wraps all of the template.
7
- *
8
- * <div>
9
- * <div>
10
- * Cool Stuff
11
- * </div>
12
- * <span>
13
- * Hello World!
14
- * </span>
15
- * </div>
16
- *
17
- * is OK.
18
- *
19
- * <div>
20
- * Cool Stuff
21
- * </div>
22
- * <span>
23
- * Hello World!
24
- * </span>
25
- *
26
- * is NOT ok because each of those items is on the top-level.
27
  */
28
  #>
29
  <#
4
  /*
5
  * This is our main field template. It's called for every field type.
6
  * Note that must have ONE top-level, wrapping element. i.e. a div/span/etc that wraps all of the template.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  */
8
  #>
9
  <#
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.3.12
7
  Author: The WP Ninjas
8
  Author URI: http://ninjaforms.com
9
  Text Domain: ninja-forms
@@ -58,7 +58,7 @@ if( get_option( 'ninja_forms_load_deprecated', FALSE ) && ! ( isset( $_POST[ 'nf
58
  /**
59
  * @since 3.0
60
  */
61
- const VERSION = '3.3.12';
62
 
63
  const WP_MIN_VERSION = '4.7';
64
 
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.3.13
7
  Author: The WP Ninjas
8
  Author URI: http://ninjaforms.com
9
  Text Domain: ninja-forms
58
  /**
59
  * @since 3.0
60
  */
61
+ const VERSION = '3.3.13';
62
 
63
  const WP_MIN_VERSION = '4.7';
64
 
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.7
5
  Tested up to: 4.9
6
- Stable tag: 3.3.12
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,32 @@ For help and video tutorials, please visit our website: [Ninja Forms Documentati
111
 
112
  == Upgrade Notice ==
113
 
114
- = 3.3.12 (31 July 2018) =
 
 
 
 
 
 
115
 
116
  *Bugs:*
117
 
118
- * Resolved an issue that sometimes caused form titles to not display in dropdown menus.
119
 
120
  == Changelog ==
121
 
 
 
 
 
 
 
 
 
 
 
 
 
122
  = 3.3.12 (31 July 2018) =
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.7
5
  Tested up to: 4.9
6
+ Stable tag: 3.3.13
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.3.13 (8 August 2018) =
115
+
116
+ *Changes:*
117
+
118
+ * Added the abililty to have no default value for Country and State fields.
119
+ * Added the Indian Rupee to the list of available currencies
120
+ * Removed unnecessary comments from the main field template
121
 
122
  *Bugs:*
123
 
124
+ * User Meta Tags will no longer print out the tag when users are not logged in
125
 
126
  == Changelog ==
127
 
128
+ = 3.3.13 (8 August 2018) =
129
+
130
+ *Changes:*
131
+
132
+ * Added the abililty to have no default value for Country and State fields.
133
+ * Added the Indian Rupee to the list of available currencies
134
+ * Removed unnecessary comments from the main field template
135
+
136
+ *Bugs:*
137
+
138
+ * User Meta Tags will no longer print out the tag when users are not logged in
139
+
140
  = 3.3.12 (31 July 2018) =
141
 
142
  *Bugs:*