Commit 37a49d3d authored by Kevin Stover's avatar Kevin Stover

Merge branch 'release/v2.8.7'

parents 7dc0e660 b9e36905
......@@ -4,7 +4,7 @@
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,
Requires at least: 3.8
Tested up to: 4.0
Stable tag: 2.8.6
Stable tag: 2.8.7
License: GPLv2 or later
Forms created with a simple drag and drop interface. Contact forms, Email collection forms, or any other form you want on your WordPress site.
......
......@@ -55,28 +55,28 @@ class NF_Notification_Email extends NF_Notification_Base_Type
<tr>
<th scope="row"><label for="settings-from_name"><?php _e( 'From Name', 'ninja-forms' ); ?></label></th>
<td>
<input name="settings[from_name]" type="text" id="settings-from_name" value="<?php echo $from_name; ?>" class="nf-tokenize" placeholder="Name or fields" data-token-limit="0" data-key="from_name" data-type="all" />
<input name="settings[from_name]" type="text" id="settings-from_name" value="<?php echo $from_name; ?>" class="nf-tokenize" placeholder="<?php _e( 'Name or fields', 'ninja-forms' ); ?>" data-token-limit="0" data-key="from_name" data-type="all" />
<span class="howto"><?php _e( 'Email will appear to be from this name.', 'ninja-forms' ) ?></span>
</td>
</tr>
<tr>
<th scope="row"><label for="settings-from_address"><?php _e( 'From Address', 'ninja-forms' ); ?></label></th>
<td>
<input name="settings[from_address]" type="text" id="settings-from_address" value="<?php echo $from_address; ?>" class="nf-tokenize" placeholder="One email address or field" data-token-limit="1" data-key="from_address" data-type="all" />
<input name="settings[from_address]" type="text" id="settings-from_address" value="<?php echo $from_address; ?>" class="nf-tokenize" placeholder="<?php _e( 'One email address or field', 'ninja-forms' ); ?>" data-token-limit="1" data-key="from_address" data-type="all" />
<span class="howto"><?php _e( 'Email will appear to be from this email address.', 'ninja-forms' ) ?></span>
</td>
</tr>
<tr>
<th scope="row"><label for="settings-to"><?php _e( 'To', 'ninja-forms' ); ?></label></th>
<td>
<input name="settings[to]" type="text" id="settings-to" value="<?php echo $to; ?>" class="nf-tokenize" placeholder="Email addresses or search for a field" data-token-limit="0" data-key="to" data-type="all" />
<input name="settings[to]" type="text" id="settings-to" value="<?php echo $to; ?>" class="nf-tokenize" placeholder="<?php _e( 'Email addresses or search for a field', 'ninja-forms' ); ?>" data-token-limit="0" data-key="to" data-type="all" />
<span class="howto"><?php _e( 'Who should this email be sent to?', 'ninja-forms' ) ?></span>
</td>
</tr>
<tr>
<th scope="row"><label for="settings-email_subject"><?php _e( 'Subject', 'ninja-forms' ); ?></label></th>
<td>
<input name="settings[email_subject]" type="text" id="settings-email_subject" value="<?php echo $email_subject; ?>" class="nf-tokenize" placeholder="Subject Text or search for a field" data-token-limit="0" data-key="email_subject" data-type="all" />
<input name="settings[email_subject]" type="text" id="settings-email_subject" value="<?php echo $email_subject; ?>" class="nf-tokenize" placeholder="<?php _e( 'Subject Text or search for a field', 'ninja-forms' ); ?>" data-token-limit="0" data-key="email_subject" data-type="all" />
<span class="howto"><?php _e( 'This will be the subject of the email.', 'ninja-forms' ) ?></span>
</td>
</tr>
......@@ -98,7 +98,7 @@ class NF_Notification_Email extends NF_Notification_Base_Type
<?php
$attachment_types = apply_filters( 'nf_email_notification_attachment_types',
array(
'attach_csv' => 'Submission CSV',
'attach_csv' => __( 'Submission CSV', 'ninja-forms' ),
)
);
......@@ -286,11 +286,11 @@ class NF_Notification_Email extends NF_Notification_Base_Type
$headers[] = 'charset=utf-8';
if ( ! empty( $cc ) ) {
$headers[] = 'Cc: ' . $address;
$headers[] = 'Cc: ' . $cc;
}
if ( ! empty( $bcc ) ) {
$headers[] = 'Bcc: ' . $address;
$headers[] = 'Bcc: ' . $bcc;
}
$csv_attachment = '';
......@@ -343,7 +343,7 @@ class NF_Notification_Email extends NF_Notification_Base_Type
// Delete our admin CSV if one is present.
if ( file_exists( $csv_attachment ) ) {
unlink ( $csv_attachment );
//unlink ( $csv_attachment );
}
}
......
......@@ -509,7 +509,7 @@ class NF_Notifications
$html .= '<option value="' . $field_id . '">' . $label . ' - ID: ' . $field_id . '</option>';
}
$html .= '</select>';
$html .= ' <a href="#" class="button-secondary nf-insert-field">Insert Field</a> <a href="#" class="button-secondary nf-insert-all-fields">Insert All Fields</a>';
$html .= ' <a href="#" class="button-secondary nf-insert-field">' . __( 'Insert Field', 'ninja-forms' ) . '</a> <a href="#" class="button-secondary nf-insert-all-fields">' . __( 'Insert All Fields', 'ninja-forms' ) . '</a>';
return $html;
}
......
......@@ -67,7 +67,7 @@ function ninja_forms_admin(){
}
if( !isset( $ninja_forms_admin_update_message ) AND isset( $_REQUEST['update_message'] ) ){
$ninja_forms_admin_update_message = $_REQUEST['update_message'];
$ninja_forms_admin_update_message = esc_html( $_REQUEST['update_message'] );
}
$output_form = isset ( $ninja_forms_tabs[$current_page][$current_tab]['output_form'] ) ? $ninja_forms_tabs[$current_page][$current_tab]['output_form'] : true;
......
......@@ -122,6 +122,13 @@ function ninja_forms_delete_form( $form_id = '' ){
$wpdb->query($wpdb->prepare("DELETE FROM ".NINJA_FORMS_TABLE_NAME." WHERE id = %d", $form_id));
$wpdb->query($wpdb->prepare("DELETE FROM ".NINJA_FORMS_FIELDS_TABLE_NAME." WHERE form_id = %d", $form_id));
// Delete any notifications attached to this form.
// Grab notifications.
$notifications = nf_get_notifications_by_form_id( $form_id, false );
foreach ( $notifications as $n_id ) {
nf_delete_object( $n_id );
}
if( $ajax ){
die();
}
......
......@@ -255,6 +255,25 @@ function nf_remove_old_email_send_to( $form_id ) {
if ( empty ( $form_id ) )
return false;
// Remove any "Admin mailto" settings we might have.
$form_row = ninja_forms_get_form_by_id( $form_id );
if ( isset ( $form_row['data']['admin_mailto'] ) ) {
unset ( $form_row['data']['admin_mailto'] );
$args = array(
'update_array' => array(
'data' => serialize( $form_row['data'] ),
),
'where' => array(
'id' => $form_id,
),
);
ninja_forms_update_form( $args );
}
// Update any old email settings we have.
$fields = Ninja_Forms()->form( $form_id )->fields;
......
......@@ -252,7 +252,7 @@ function ninja_forms_display_js( $form_id, $local_vars = '' ) {
wp_enqueue_script( 'ninja-forms-display',
NINJA_FORMS_URL . 'js/' . $src .'/ninja-forms-display' . $suffix . '.js',
array( 'jquery', 'jquery-form' ) );
array( 'jquery', 'jquery-form', 'backbone', 'underscore' ) );
if( !isset( $ninja_forms_display_localize_js ) OR !$ninja_forms_display_localize_js ){
wp_localize_script( 'ninja-forms-display', 'ninja_forms_settings', array('ajax_msg_format' => $msg_format, 'password_mismatch' => $password_mismatch, 'plugin_url' => NINJA_FORMS_URL, 'date_format' => $date_format, 'currency_symbol' => $currency_symbol ) );
......@@ -261,7 +261,7 @@ function ninja_forms_display_js( $form_id, $local_vars = '' ) {
wp_localize_script( 'ninja-forms-display','thousandsSeparator', addslashes( $wp_locale->number_format['thousands_sep'] ) );
wp_localize_script( 'ninja-forms-display','decimalPoint', addslashes( $wp_locale->number_format['decimal_point'] ) );
wp_localize_script( 'ninja-forms-display', 'ninja_forms_form_'.$form_id.'_settings', $ninja_forms_js_form_settings );
wp_localize_script( 'ninja-forms-display', 'ninja_forms_form_'.$form_id.'_settings', apply_filters( 'nf_form_js_settings', $ninja_forms_js_form_settings, $form_id ) );
wp_localize_script( 'ninja-forms-display', 'ninja_forms_form_'.$form_id.'_calc_settings', $calc_settings );
wp_localize_script( 'ninja-forms-display', 'ninja_forms_password_strength', array(
......
......@@ -282,30 +282,30 @@ class eqEOS {
else {
switch ($pf[$i]) {
case '+':
$temp[$hold-2] = $temp[$hold-2] + $temp[$hold-1];
@$temp[$hold-2] = $temp[$hold-2] + $temp[$hold-1];
break;
case '-':
$temp[$hold-2] = $temp[$hold-2] - $temp[$hold-1];
@$temp[$hold-2] = $temp[$hold-2] - $temp[$hold-1];
break;
case '*':
$temp[$hold-2] = $temp[$hold-2] * $temp[$hold-1];
@$temp[$hold-2] = $temp[$hold-2] * $temp[$hold-1];
break;
case '/':
if($temp[$hold-1] == 0) {
throw new Exception("Division by 0 on: '{$temp[$hold-2]} / {$temp[$hold-1]}' in {$this->inFix}", EQEOS_E_DIV_ZERO);
return false;
}
$temp[$hold-2] = $temp[$hold-2] / $temp[$hold-1];
@$temp[$hold-2] = $temp[$hold-2] / $temp[$hold-1];
break;
case '^':
$temp[$hold-2] = pow($temp[$hold-2], $temp[$hold-1]);
@$temp[$hold-2] = pow($temp[$hold-2], $temp[$hold-1]);
break;
case '%':
if($temp[$hold-1] == 0) {
throw new Exception("Division by 0 on: '{$temp[$hold-2]} % {$temp[$hold-1]}' in {$this->inFix}", EQEOS_E_DIV_ZERO);
return false;
}
$temp[$hold-2] = bcmod($temp[$hold-2], $temp[$hold-1]);
@$temp[$hold-2] = bcmod($temp[$hold-2], $temp[$hold-1]);
break;
}
// Decrease the hold var to one above where the last number is
......
......@@ -909,7 +909,7 @@ function ninja_forms_calc_evaluate( $op, $value1, $value2 ) {
* @return calc_value
*/
function ninja_forms_field_calc_value( $field_id, $field_value = '', $calc_method = 'auto' ) {
global $ninja_forms_loading, $ninja_forms_processing;
global $ninja_forms_loading, $ninja_forms_processing, $wp_locale;
if ( isset ( $ninja_forms_loading ) ) {
$field = $ninja_forms_loading->get_field_settings( $field_id );
......@@ -957,7 +957,8 @@ function ninja_forms_field_calc_value( $field_id, $field_value = '', $calc_metho
if ( !$field_value OR $field_value == '' ) {
$field_value = 0;
}
$calc_value = (float) preg_replace('/[^0-9.]*/','',$field_value);
$decimal_point = $wp_locale->number_format['decimal_point'];
$calc_value = (float) preg_replace('/[^0-9' . $decimal_point . '-]*/','',$field_value);
}
if ( is_string( $calc_value ) AND strpos( $calc_value, "%" ) !== false ) {
......
......@@ -568,7 +568,7 @@ function ninja_forms_field_country_display( $field_id, $data ) {
}
if ( isset ( $data['country_use_custom_first'] ) AND $data['country_use_custom_first'] == 1 ) {
$countries = array_merge( array( $country_custom_first => $country_custom_first ), $countries );
$countries = array_merge( array( $country_custom_first => '' ), $countries );
}
$field_class = ninja_forms_get_field_class( $field_id );
......
......@@ -6,19 +6,19 @@ function ninja_forms_register_field_number() {
'edit_function' => 'ninja_forms_field_number_edit',
'edit_options' => array(
array(
'type' => 'number',
'type' => 'text',
'class' => 'medium-text',
'name' => 'number_min',
'label' => __( 'Minimum Value', 'ninja-forms' ),
),
array(
'type' => 'number',
'type' => 'text',
'class' => 'medium-text',
'name' => 'number_max',
'label' => __( 'Maximum Value', 'ninja-forms' ),
),
array(
'type' => 'number',
'type' => 'text',
'class' => 'medium-text',
'name' => 'number_step',
'label' => __( 'Step (amount to increment by)', 'ninja-forms' ),
......
......@@ -261,14 +261,24 @@ function nf_get_object_meta_value( $object_id, $meta_key ) {
* @return array $children
*/
function nf_get_object_children( $object_id, $child_type = '', $full_data = true ) {
function nf_get_object_children( $object_id, $child_type = '', $full_data = true, $include_forms = true ) {
global $wpdb;
if ( $child_type != '' ) {
$children = $wpdb->get_results( $wpdb->prepare( "SELECT child_id FROM " . NF_OBJECT_RELATIONSHIPS_TABLE_NAME . " WHERE child_type = %s AND parent_id = %d", $child_type, $object_id ), ARRAY_A);
if ( $include_forms ) {
if ( $child_type != '' ) {
$children = $wpdb->get_results( $wpdb->prepare( "SELECT child_id FROM " . NF_OBJECT_RELATIONSHIPS_TABLE_NAME . " WHERE child_type = %s AND parent_id = %d", $child_type, $object_id ), ARRAY_A);
} else {
$children = $wpdb->get_results( $wpdb->prepare( "SELECT child_id FROM " . NF_OBJECT_RELATIONSHIPS_TABLE_NAME . " WHERE parent_id = %d", $object_id ), ARRAY_A);
}
} else {
$children = $wpdb->get_results( $wpdb->prepare( "SELECT child_id FROM " . NF_OBJECT_RELATIONSHIPS_TABLE_NAME . " WHERE parent_id = %d", $object_id ), ARRAY_A);
if ( $child_type != '' ) {
$children = $wpdb->get_results( $wpdb->prepare( "SELECT child_id FROM " . NF_OBJECT_RELATIONSHIPS_TABLE_NAME . " WHERE child_type = %s AND parent_id = %d AND parent_type <> 'form'", $child_type, $object_id ), ARRAY_A);
} else {
$children = $wpdb->get_results( $wpdb->prepare( "SELECT child_id FROM " . NF_OBJECT_RELATIONSHIPS_TABLE_NAME . " WHERE parent_id = %d AND parent_type <> 'form'", $object_id ), ARRAY_A);
}
}
$tmp_array = array();
if ( $full_data ) {
foreach( $children as $id ) {
......@@ -379,6 +389,13 @@ function nf_insert_object( $type ) {
function nf_delete_object( $object_id ) {
global $wpdb;
// Check to see if we have any object children.
$children = nf_get_object_children( $object_id, '', false, false );
foreach ( $children as $child_id ) {
nf_delete_object( $child_id );
}
// Delete this object.
$wpdb->query( $wpdb->prepare( 'DELETE FROM ' . NF_OBJECTS_TABLE_NAME .' WHERE id = %d', $object_id ) );
......@@ -391,6 +408,7 @@ function nf_delete_object( $object_id ) {
return true;
}
/**
* Create a relationship between two objects
*
......
......@@ -730,10 +730,13 @@ function ninja_forms_default_before_submit(formData, jqForm, options){
function ninja_forms_default_response(response){
var form_id = response.form_id;
//jQuery("#ninja_forms_form_" + form_id + "_process_msg").hide();
ninja_forms_update_error_msgs(response);
ninja_forms_update_success_msg(response);
if ( response.errors == false && typeof response.form_settings['landing_page'] != 'undefined' && response.form_settings['landing_page'] != '' ) {
window.location = response.form_settings['landing_page'];
}
ninja_forms_update_error_msgs(response)
ninja_forms_update_success_msg(response)
return true;
}
......
This diff is collapsed.
......@@ -3,7 +3,7 @@
Plugin Name: Ninja Forms
Plugin URI: http://ninjaforms.com/
Description: Ninja Forms is a webform builder with unparalleled ease of use and features.
Version: 2.8.6
Version: 2.8.7
Author: The WP Ninjas
Author URI: http://ninjaforms.com
Text Domain: ninja-forms
......@@ -263,7 +263,7 @@ class Ninja_Forms {
// Plugin version
if ( ! defined( 'NF_PLUGIN_VERSION' ) )
define( 'NF_PLUGIN_VERSION', '2.8.6' );
define( 'NF_PLUGIN_VERSION', '2.8.7' );
// Plugin Folder Path
if ( ! defined( 'NF_PLUGIN_DIR' ) )
......
......@@ -3,7 +3,7 @@ Contributors: kstover, jameslaws, wpnzach, daveshine, mordauk, bftrick, helgathe
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,
Requires at least: 3.8
Tested up to: 4.0
Stable tag: 2.8.6
Stable tag: 2.8.7
License: GPLv2 or later
Forms created with a simple drag and drop interface. Contact forms, Email collection forms, or any other form you want on your WordPress site.
......@@ -76,21 +76,21 @@ For help and video tutorials, please visit our website: [Ninja Forms Documentati
== Upgrade Notice ==
= 2.8.6 (27 October 2014 ) =
= 2.8.7 (4 November 2014 ) =
*Changes:*
* Added a new nf_init action that allows developers to run functions when Ninja Forms loads.
* Added hooks and filters to allow notifications to be more easily extended.
* The redirect notification type now works with AJAX enabled.
*Bugs:*
* Fixed a bug with converting notifications from previous versions of Ninja Forms.
* Re-Added the password mismatch label to the label settings tab.
* The [ninja_forms_all_fields] short code should now function properly in plain text emails.
* Submitted forms that are set to clear upon completion should now properly re-populate default values that are based upon logged-in user information.
* Fixed an issue with doubles slashes on Windows servers.
* Importing forms should now work properly in all instances.
* Fixed a security issue within the wp-admin.
* The Custom First Option setting for country fields now works properly with required fields.
* BCC and CC fields should now work properly in all cases.
* Negative numbers should be properly represented in emails when using calculation fields.
* Fixed errors with some internationalization strings.
* Deleting a form should now properly delete notifications attached to that form.
* Changed number field settings to allow non-integer step values.
== Requested Features ==
......@@ -98,6 +98,22 @@ If you have any feature requests, please feel free to visit [ninjaforms.com](htt
== Changelog ==
= 2.8.7 (4 November 2014 ) =
*Changes:*
* The redirect notification type now works with AJAX enabled.
*Bugs:*
* Fixed a security issue within the wp-admin.
* The Custom First Option setting for country fields now works properly with required fields.
* BCC and CC fields should now work properly in all cases.
* Negative numbers should be properly represented in emails when using calculation fields.
* Fixed errors with some internationalization strings.
* Deleting a form should now properly delete notifications attached to that form.
* Changed number field settings to allow non-integer step values.
= 2.8.6 (27 October 2014 ) =
*Changes:*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment