Commit efc615c5 authored by Kevin Stover's avatar Kevin Stover Committed by GitHub

Merge Develop (#2379)

* Reverting optimisation changes in favor of a traditional loop. Performance increases in 3.0.25 render the optimisations unnecessary. Closes #2366. (#2372)

* Update email setting reference for better error reporting (#2362)

* update email setting reference for error reporting. Closes #2361.

* Reverting optimisation changes in favor of a traditional loop. Performance increases in 3.0.25 render the optimisations unnecessary. Closes #2366. (#2372)

* Adjusting the invalid email error message.

* Adding logic for fancy emails: Kevin Stover <kevin@wpninjas.com>. Closes #2361.

* Ninja Forms implementation of the WP List Table should only appear on Ninja Forms plugin menus. Closes #2376. (#2378)

* Updating to version 3.0.26. See Changelog for details.
parent 86df505b
......@@ -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: 4.5
Tested up to: 4.7.1
Stable tag: 3.0.25
Stable tag: 3.0.26
License: GPLv2 or later
With a simple drag and drop interface you can create contact forms, email subscription forms, order forms, payment forms, and any other type of form for your WordPress site.
......
......@@ -265,7 +265,7 @@ class Ninja_Forms {
// Plugin version
if ( ! defined( 'NF_PLUGIN_VERSION' ) )
define( 'NF_PLUGIN_VERSION', '3.0.25' );
define( 'NF_PLUGIN_VERSION', '3.0.26' );
// Plugin Folder Path
if ( ! defined( 'NF_PLUGIN_DIR' ) )
......
......@@ -94,8 +94,12 @@ final class NF_Actions_Email extends NF_Abstracts_Action
$email_addresses = is_array( $action_settings[ $setting ] ) ? $action_settings[ $setting ] : explode( ',', $action_settings[ $setting ] );
foreach( (array) $email_addresses as $email ){
$email = trim( $email );
if ( false !== strpos( $email, '<' ) && false !== strpos( $email, '>' ) ) {
preg_match('/(?<=<).*?(?=>)/', $email, $email);
$email = $email[ 0 ];
}
if( ! is_email( $email ) ) {
$errors[ 'email_' . $email ] = sprintf( __( 'Your email action "%s" has an invalid value for the "TO" setting. Please check this setting and try again.', 'ninja-forms'), $action_settings[ 'label' ] );
$errors[ 'email_' . $email ] = sprintf( __( 'Your email action "%s" has an invalid value for the "%s" setting. Please check this setting and try again.', 'ninja-forms'), $action_settings[ 'label' ], $setting );
}
}
}
......
......@@ -27,6 +27,13 @@ final class NF_Admin_Menus_Forms extends NF_Abstracts_Menu
public function admin_init()
{
/*
* If we aren't on the Ninja Forms menu page, don't admin_init.
*/
if ( empty( $_GET[ 'page' ] ) || 'ninja-forms' !== $_GET[ 'page' ] ) {
return false;
}
if( isset( $_GET[ 'form_id' ] ) && ! is_numeric( $_GET[ 'form_id' ] ) && 'new' != $_GET[ 'form_id' ] ) {
if( current_user_can( apply_filters( 'ninja_forms_admin_import_template_capabilities', 'manage_options' ) ) ) {
$this->import_from_template();
......
......@@ -313,25 +313,6 @@ final class NF_Database_Models_Submission
$hidden_field_types = apply_filters( 'nf_sub_hidden_field_types', array() );
$fields_order_by = array();
$field_type_filters = array();
$i = 0;
foreach( $fields as $field ){
if( in_array( $field->get_setting( 'type' ), $hidden_field_types ) ) continue;
if ( $field->get_setting( 'admin_label' ) ) {
$field_labels[ $field->get_id() ] = $field->get_setting( 'admin_label' );
} else {
$field_labels[ $field->get_id() ] = $field->get_setting( 'label' );
}
$fields_order_by[] = $field->get_id();
if( has_filter( 'ninja_forms_subs_export_field_value_' . $field->get_setting( 'type' ) ) ){
// $i represents the relative field order for later reference when running filters on a specific value.
$field_type_filters[ $i ] = $field->get_setting( 'type' );
}
$i++;
}
/*
* Submissions
*/
......@@ -343,55 +324,31 @@ final class NF_Database_Models_Submission
$value[ '_seq_num' ] = $sub->get_seq_num();
$value[ '_date_submitted' ] = $sub->get_sub_date( $date_format );
if( has_filter( 'nf_subs_export_pre_value' ) || has_filter( 'ninja_forms_subs_export_pre_value' ) ) {
/*
* DEPRECATED - Individual value filters are inefficient.
*/
foreach ($fields as $field_id => $field) {
foreach ($field_labels as $field_id => $label) {
if (!is_int($field_id)) continue;
if( in_array( $field->get_setting( 'type' ), $hidden_field_types ) ) continue;
if (!is_int($field_id)) continue;
$field_value = $sub->get_field_value($field_id);
$field_value = apply_filters('nf_subs_export_pre_value', $field_value, $field_id);
$field_value = apply_filters('ninja_forms_subs_export_pre_value', $field_value, $field_id, $form_id);
if ( $field->get_setting( 'admin_label' ) ) {
$field_labels[ $field->get_id() ] = $field->get_setting( 'admin_label' );
} else {
$field_labels[ $field->get_id() ] = $field->get_setting( 'label' );
}
if (is_array($field_value)) {
$field_value = implode(' | ', $field_value);
}
$field_value = maybe_unserialize( $sub->get_field_value( $field_id ) );
$value[$field_id] = maybe_unserialize( $field_value );
}
$field_value = apply_filters('nf_subs_export_pre_value', $field_value, $field_id);
$field_value = apply_filters('ninja_forms_subs_export_pre_value', $field_value, $field_id, $form_id);
$field_value = apply_filters( 'ninja_forms_subs_export_field_value_' . $field->get_setting( 'type' ), $field_value );
$value_array[] = $value;
} else {
/*
* OPTIMIZED
*/
global $wpdb;
$field_values = $wpdb->get_col( "
SELECT IFNULL( meta_value, '' )
FROM ". $wpdb->postmeta . " as postmeta
RIGHT JOIN (
SELECT id FROM wp_nf3_fields
WHERE id IN ( " . implode( ',', $fields_order_by ) . " )
ORDER BY FIELD( id, " . implode( ',', $fields_order_by ) . " )
) as fields
ON postmeta.meta_key LIKE CONCAT( '%', fields.id, '%' )
AND postmeta.post_id = " . $sub->get_id()
);
if( is_array( $field_type_filters ) && ! empty( $field_type_filters ) ){
foreach( $field_type_filters as $i => $type ){
$field_values[ $i ] = apply_filters( 'ninja_forms_subs_export_field_value_' . $type, $field_values[ $i ] );
}
if ( is_array($field_value ) ) {
$field_value = implode( ',', $field_value );
}
$value_array[] = array_merge( $value, array_values( $field_values ) );
$value[ $field_id ] = $field_value;
}
$value_array[] = $value;
}
$value_array = WPN_Helper::stripslashes( $value_array );
......
......@@ -26,7 +26,6 @@ class NF_Fields_ListCheckbox extends NF_Abstracts_List
$this->_nicename = __( 'Checkbox List', 'ninja-forms' );
add_filter( 'ninja_forms_merge_tag_calc_value_' . $this->_type, array( $this, 'get_calc_value' ), 10, 2 );
add_filter( 'ninja_forms_subs_export_field_value_' . $this->_type, array( $this, 'export_value' ), 10 );
}
public function admin_form_element( $id, $value )
......@@ -54,8 +53,4 @@ class NF_Fields_ListCheckbox extends NF_Abstracts_List
}
return $value;
}
public function export_value( $value ) {
return implode( ',', maybe_unserialize( $value ) );
}
}
......@@ -24,7 +24,6 @@ class NF_Fields_ListMultiselect extends NF_Abstracts_List
$this->_nicename = __( 'Multi-Select', 'ninja-forms' );
add_filter( 'ninja_forms_merge_tag_calc_value_' . $this->_type, array( $this, 'get_calc_value' ), 10, 2 );
add_filter( 'ninja_forms_subs_export_field_value_' . $this->_type, array( $this, 'export_value' ), 10 );
}
public function admin_form_element( $id, $value )
......@@ -52,8 +51,4 @@ class NF_Fields_ListMultiselect extends NF_Abstracts_List
}
return $value;
}
public function export_value( $value ) {
return implode( ',', maybe_unserialize( $value ) );
}
}
\ No newline at end of file
......@@ -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: 3.0.25
Version: 3.0.26
Author: The WP Ninjas
Author URI: http://ninjaforms.com
Text Domain: ninja-forms
......@@ -51,7 +51,7 @@ if( get_option( 'ninja_forms_load_deprecated', FALSE ) && ! ( isset( $_POST[ 'nf
/**
* @since 3.0
*/
const VERSION = '3.0.25';
const VERSION = '3.0.26';
/**
* @var Ninja_Forms
......
......@@ -3,7 +3,7 @@ Contributors: wpninjasllc, kstover, jameslaws, kbjohnson90, klhall1987, wpnzach,
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: 4.5
Tested up to: 4.7.1
Stable tag: 3.0.25
Stable tag: 3.0.26
License: GPLv2 or later
Drag and drop fields in an intuitive UI to create create contact forms, email subscription forms, order forms, payment forms, send emails and more!
......@@ -102,23 +102,24 @@ For help and video tutorials, please visit our website: [Ninja Forms Documentati
== Upgrade Notice ==
= 3.0.25 (26 January 2017) =
*Changes:*
* Increasing the performance of submissions and form builder loading.
* Improved compatibility with popular caching plugins.
= 3.0.26 (30 January 2017) =
*Bugs:*
* Field tags should now properly populate in calculation merge tags.
* Submission exports should now always order properly.
* Fixed a bug with submissions exporting non-Ninja Forms data.
* Importing forms with non-UTF8 characters should now import properly.
* Fixed a bug with converting froms from 2.9.x to 3.0.
* Field data should populate properly in submission exports.
* Email errors upon form submission should be clearer.
* Fixed a compatibility bug with other plugins that use the WP List Table.
== Changelog ==
= 3.0.26 (30 January 2017) =
*Bugs:*
* Field data should populate properly in submission exports.
* Email errors upon form submission should be clearer.
* Fixed a compatibility bug with other plugins that use the WP List Table.
= 3.0.25 (26 January 2017) =
*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