Commit 0c4392c7 authored by KR Moorhouse's avatar KR Moorhouse

Merge branch 'develop' into issue#4037

parents 4a5957db 53471145
...@@ -273,6 +273,7 @@ class NF_AJAX_Controllers_Submission extends NF_Abstracts_Controller ...@@ -273,6 +273,7 @@ class NF_AJAX_Controllers_Submission extends NF_Abstracts_Controller
$unique_field_value = serialize( $unique_field_value ); $unique_field_value = serialize( $unique_field_value );
} }
if ( ! empty($unique_field_value) ) {
/* /*
* Check our db for the value submitted. * Check our db for the value submitted.
*/ */
...@@ -286,6 +287,7 @@ class NF_AJAX_Controllers_Submission extends NF_Abstracts_Controller ...@@ -286,6 +287,7 @@ class NF_AJAX_Controllers_Submission extends NF_Abstracts_Controller
$this->_respond(); $this->_respond();
} }
} }
}
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
......
...@@ -145,7 +145,7 @@ class NF_Admin_Processes_ImportForm extends NF_Abstracts_BatchProcess ...@@ -145,7 +145,7 @@ class NF_Admin_Processes_ImportForm extends NF_Abstracts_BatchProcess
public function restart() public function restart()
{ {
// Get our remaining fields from the database. // Get our remaining fields from the database.
$this->form = get_option( 'nf_import_form', $this->form, array() ); $this->form = get_option( 'nf_import_form', array() );
} }
/** /**
...@@ -169,7 +169,7 @@ class NF_Admin_Processes_ImportForm extends NF_Abstracts_BatchProcess ...@@ -169,7 +169,7 @@ class NF_Admin_Processes_ImportForm extends NF_Abstracts_BatchProcess
* Save our processing option. * Save our processing option.
* Move on to the next step. * Move on to the next step.
*/ */
if ( ! isset ( $this->form[ 'ID' ] ) ) { if ( ! isset( $this->form[ 'ID' ] ) ) {
$this->insert_form(); $this->insert_form();
} else { // We have a form ID set. } else { // We have a form ID set.
$this->insert_fields(); $this->insert_fields();
...@@ -239,6 +239,8 @@ class NF_Admin_Processes_ImportForm extends NF_Abstracts_BatchProcess ...@@ -239,6 +239,8 @@ class NF_Admin_Processes_ImportForm extends NF_Abstracts_BatchProcess
$insert_columns = array(); $insert_columns = array();
$insert_columns_types = array(); $insert_columns_types = array();
foreach ( $this->forms_db_columns as $column_name => $setting_name ) { foreach ( $this->forms_db_columns as $column_name => $setting_name ) {
// Make sure we don't try to set created_at to NULL.
if( 'created_at' === $column_name && is_null( $this->form[ 'settings' ][ $setting_name ] ) ) continue;
$insert_columns[ $column_name ] = $this->form[ 'settings' ][ $setting_name ]; $insert_columns[ $column_name ] = $this->form[ 'settings' ][ $setting_name ];
if ( is_numeric( $this->form[ 'settings' ][ $setting_name ] ) ) { if ( is_numeric( $this->form[ 'settings' ][ $setting_name ] ) ) {
array_push( $insert_columns_types, '%d' ); array_push( $insert_columns_types, '%d' );
...@@ -252,6 +254,11 @@ class NF_Admin_Processes_ImportForm extends NF_Abstracts_BatchProcess ...@@ -252,6 +254,11 @@ class NF_Admin_Processes_ImportForm extends NF_Abstracts_BatchProcess
// Update our form ID with the newly inserted row ID. // Update our form ID with the newly inserted row ID.
$this->form[ 'ID' ] = $this->_db->insert_id; $this->form[ 'ID' ] = $this->_db->insert_id;
if ( 0 === $this->form[ 'ID' ] ) {
$this->add_error( 'insert_failed', __( 'Failed to insert new form.', 'ninja-forms' ), 'fatal' );
$this->batch_complete();
}
$this->insert_form_meta(); $this->insert_form_meta();
$this->insert_actions(); $this->insert_actions();
......
...@@ -50,7 +50,7 @@ final class NF_MergeTags_Fields extends NF_Abstracts_MergeTags ...@@ -50,7 +50,7 @@ final class NF_MergeTags_Fields extends NF_Abstracts_MergeTags
if( is_array( $field[ 'value' ] ) ) $field[ 'value' ] = implode( ', ', $field[ 'value' ] ); if( is_array( $field[ 'value' ] ) ) $field[ 'value' ] = implode( ', ', $field[ 'value' ] );
$return .= '<tr><td>' . apply_filters('ninja_forms_merge_label', $field[ 'label' ]) .':</td><td>' . $field[ 'value' ] . '</td></tr>'; $return .= '<tr><td>' . apply_filters('ninja_forms_merge_label', $field[ 'label' ], $field, $this->form_id) .':</td><td>' . $field[ 'value' ] . '</td></tr>';
} }
$return .= '</table>'; $return .= '</table>';
return $return; return $return;
...@@ -90,7 +90,7 @@ final class NF_MergeTags_Fields extends NF_Abstracts_MergeTags ...@@ -90,7 +90,7 @@ final class NF_MergeTags_Fields extends NF_Abstracts_MergeTags
if( is_array( $field[ 'value' ] ) ) $field[ 'value' ] = implode( ', ', $field[ 'value' ] ); if( is_array( $field[ 'value' ] ) ) $field[ 'value' ] = implode( ', ', $field[ 'value' ] );
// Check to see if the type is a list field and if it is... // Check to see if the type is a list field and if it is...
$return .= '<tr><td valign="top">' . apply_filters('ninja_forms_merge_label', $field[ 'label' ]) .':</td><td>' . $field[ 'value' ] . '</td></tr>'; $return .= '<tr><td valign="top">' . apply_filters('ninja_forms_merge_label', $field[ 'label' ], $field, $this->form_id) .':</td><td>' . $field[ 'value' ] . '</td></tr>';
} }
$return .= '</table>'; $return .= '</table>';
return $return; return $return;
...@@ -137,7 +137,7 @@ final class NF_MergeTags_Fields extends NF_Abstracts_MergeTags ...@@ -137,7 +137,7 @@ final class NF_MergeTags_Fields extends NF_Abstracts_MergeTags
if( is_array( $field[ 'value' ] ) ) $field[ 'value' ] = implode( ', ', $field[ 'value' ] ); if( is_array( $field[ 'value' ] ) ) $field[ 'value' ] = implode( ', ', $field[ 'value' ] );
$return .= '<tr><td valign="top">' . apply_filters('ninja_forms_merge_label', $field[ 'label' ]) .':</td><td>' . $field[ 'value' ] . '</td></tr>'; $return .= '<tr><td valign="top">' . apply_filters('ninja_forms_merge_label', $field[ 'label' ], $field, $this->form_id) .':</td><td>' . $field[ 'value' ] . '</td></tr>';
} }
$return .= '</table>'; $return .= '</table>';
return $return; return $return;
...@@ -248,6 +248,7 @@ final class NF_MergeTags_Fields extends NF_Abstracts_MergeTags ...@@ -248,6 +248,7 @@ final class NF_MergeTags_Fields extends NF_Abstracts_MergeTags
// Loop over our options... // Loop over our options...
$field[ 'options' ] = apply_filters( 'ninja_forms_render_options', $field[ 'options' ], $field ); $field[ 'options' ] = apply_filters( 'ninja_forms_render_options', $field[ 'options' ], $field );
$field[ 'options' ] = apply_filters( 'ninja_forms_render_options_' . $field['type'], $field[ 'options' ], $field ); $field[ 'options' ] = apply_filters( 'ninja_forms_render_options_' . $field['type'], $field[ 'options' ], $field );
$field[ 'options' ] = apply_filters( 'ninja_forms_localize_list_labels', $field[ 'options' ], $field, $this->form_id );
foreach( $field[ 'options' ] as $options ) { foreach( $field[ 'options' ] as $options ) {
// ...checks to see if our list has multiple values. // ...checks to see if our list has multiple values.
if( is_array( $field[ 'value' ] ) ) { if( is_array( $field[ 'value' ] ) ) {
......
...@@ -1306,14 +1306,6 @@ if( get_option( 'ninja_forms_load_deprecated', FALSE ) && ! ( isset( $_POST[ 'nf ...@@ -1306,14 +1306,6 @@ if( get_option( 'ninja_forms_load_deprecated', FALSE ) && ! ( isset( $_POST[ 'nf
* @since 3.3.17 * @since 3.3.17
*/ */
function nf_update_marketing_feed() { function nf_update_marketing_feed() {
// Fetch our membership data.
$data = wp_remote_get( 'http://api.ninjaforms.com/feeds/?fetch=memberships' );
// If we got a valid response...
if ( 200 == $data[ 'response' ][ 'code' ] ) {
// Save the data to our option.
$data = wp_remote_retrieve_body( $data );
update_option( 'ninja_forms_memberships_feed', $data, false );
}
// Fetch our addon data. // Fetch our addon data.
$data = wp_remote_get( 'http://api.ninjaforms.com/feeds/?fetch=addons' ); $data = wp_remote_get( 'http://api.ninjaforms.com/feeds/?fetch=addons' );
// If we got a valid response... // If we got a valid response...
......
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