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

Merge branch 'develop' into issue#4037

parents 4a5957db 53471145
......@@ -273,17 +273,19 @@ class NF_AJAX_Controllers_Submission extends NF_Abstracts_Controller
$unique_field_value = serialize( $unique_field_value );
}
/*
* Check our db for the value submitted.
*/
global $wpdb;
// @TODO: Rewrite this to use our submissions API.
$sql = $wpdb->prepare( "SELECT COUNT(m.meta_id) FROM `" . $wpdb->prefix . "postmeta` AS m LEFT JOIN `" . $wpdb->prefix . "posts` AS p ON p.id = m.post_id WHERE m.meta_key = '_field_%d' AND m.meta_value = '%s' AND p.post_status = 'publish'", $unique_field_id, $unique_field_value );
$result = $wpdb->get_results( $sql, 'ARRAY_N' );
if ( intval( $result[ 0 ][ 0 ] ) > 0 ) {
$this->_errors['fields'][ $unique_field_id ] = array( 'slug' => 'unique_field', 'message' => $unique_field_error );
$this->_respond();
if ( ! empty($unique_field_value) ) {
/*
* Check our db for the value submitted.
*/
global $wpdb;
// @TODO: Rewrite this to use our submissions API.
$sql = $wpdb->prepare( "SELECT COUNT(m.meta_id) FROM `" . $wpdb->prefix . "postmeta` AS m LEFT JOIN `" . $wpdb->prefix . "posts` AS p ON p.id = m.post_id WHERE m.meta_key = '_field_%d' AND m.meta_value = '%s' AND p.post_status = 'publish'", $unique_field_id, $unique_field_value );
$result = $wpdb->get_results( $sql, 'ARRAY_N' );
if ( intval( $result[ 0 ][ 0 ] ) > 0 ) {
$this->_errors['fields'][ $unique_field_id ] = array( 'slug' => 'unique_field', 'message' => $unique_field_error );
$this->_respond();
}
}
}
......
......@@ -145,7 +145,7 @@ class NF_Admin_Processes_ImportForm extends NF_Abstracts_BatchProcess
public function restart()
{
// 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
* Save our processing option.
* Move on to the next step.
*/
if ( ! isset ( $this->form[ 'ID' ] ) ) {
if ( ! isset( $this->form[ 'ID' ] ) ) {
$this->insert_form();
} else { // We have a form ID set.
$this->insert_fields();
......@@ -239,6 +239,8 @@ class NF_Admin_Processes_ImportForm extends NF_Abstracts_BatchProcess
$insert_columns = array();
$insert_columns_types = array();
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 ];
if ( is_numeric( $this->form[ 'settings' ][ $setting_name ] ) ) {
array_push( $insert_columns_types, '%d' );
......@@ -252,6 +254,11 @@ class NF_Admin_Processes_ImportForm extends NF_Abstracts_BatchProcess
// Update our form ID with the newly inserted row 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_actions();
......
......@@ -50,7 +50,7 @@ final class NF_MergeTags_Fields extends NF_Abstracts_MergeTags
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 $return;
......@@ -90,7 +90,7 @@ final class NF_MergeTags_Fields extends NF_Abstracts_MergeTags
if( is_array( $field[ 'value' ] ) ) $field[ 'value' ] = implode( ', ', $field[ 'value' ] );
// 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 $return;
......@@ -137,7 +137,7 @@ final class NF_MergeTags_Fields extends NF_Abstracts_MergeTags
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 $return;
......@@ -248,6 +248,7 @@ final class NF_MergeTags_Fields extends NF_Abstracts_MergeTags
// Loop over our options...
$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_localize_list_labels', $field[ 'options' ], $field, $this->form_id );
foreach( $field[ 'options' ] as $options ) {
// ...checks to see if our list has multiple values.
if( is_array( $field[ 'value' ] ) ) {
......
......@@ -112,173 +112,15 @@
<!-- Section: apps and Integrations -->
<script id="tmpl-nf-apps" type="text/template">
<?php
$saved = get_option( 'ninja_forms_memberships_feed', false );
if ( ! $saved ) {
?>
<!-- WIDGET CONTAINER -->
<div class="widget widget-memberships">
<div class="pricing-container">
<!-- Personal Membership Section -->
<div class="pricing-block widget">
<div class="pricing-header">
<div class="pricing-title"><?php _e( 'PERSONAL', 'ninja-forms' ); ?></div>
<div class="pricing-price">$99 / <?php _e( 'year', 'ninja-forms' ); ?></div>
<div class="pricing-savings"><?php _e( 'SAVE OVER $280!', 'ninja-forms' ); ?></div>
<div class="pricing-cta"><a target="_blank" href="https://ninjaforms.com/checkout/?edd_action=add_to_cart&download_id=471356&utm_source=Ninja+Forms+Plugin&utm_medium=Apps+and+Integrations&utm_campaign=Dashboard+Memberships&utm_content=Personal+Buy+Now" class="nf-button primary"><?php _e( 'Buy Now', 'ninja-forms' ); ?></a></div>
</div>
<div class="pricing-body">
<div>
<hr>
<span class="pricing-body-title"><?php _e( 'ALL THE ESSENTIALS, PLUS:', 'ninja-forms' ); ?></span>
<hr>
</div>
<div>
<i class="fa fa-user" aria-hidden="true"></i>
<span class="pricing-body-title"><?php _e( 'SINGLE SITE', 'ninja-forms' ); ?></span>
</div>
<div>
<i class="fa fa-life-ring" aria-hidden="true"></i>
<span class="pricing-body-title"><?php _e( 'PRIORITY SUPPORT', 'ninja-forms' ); ?></span>
</div>
<div>
<i class="fa fa-wrench" aria-hidden="true"></i>
<span class="pricing-body-title"><?php _e( 'FORM BUILDING ESSENTIALS', 'ninja-forms' ); ?></span>
<ul>
<li><?php _e( 'Layout & Styles', 'ninja-forms' ); ?></li>
<li><?php _e( 'Conditional Logic', 'ninja-forms' ); ?></li>
<li><?php _e( 'File Uploads', 'ninja-forms' ); ?></li>
<li><?php _e( 'Multi-Part Forms', 'ninja-forms' ); ?></li>
</ul>
</div>
<div>
<i class="fa fa-envelope" aria-hidden="true"></i>
<span class="pricing-body-title"><?php _e( 'EMAIL MARKETING', 'ninja-forms' ); ?></span>
<ul>
<li><?php _e( 'MailChimp', 'ninja-forms' ); ?></li>
<li><?php _e( 'Constant Contact', 'ninja-forms' ); ?></li>
<li><?php _e( 'Campaign Monitor', 'ninja-forms' ); ?></li>
<li><?php _e( 'Emma', 'ninja-forms' ); ?></li>
<li><?php _e( 'ConvertKit', 'ninja-forms' ); ?></li>
<li><?php _e( 'EmailOctopus', 'ninja-forms' ); ?></li>
</ul>
</div>
<div>
<i class="fa fa-cc-paypal" aria-hidden="true"></i>
<span class="pricing-body-title"><?php _e( 'ACCEPT PAYMENTS', 'ninja-forms' ); ?></span>
<ul>
<li><?php _e( 'PayPal Express', 'ninja-forms' ); ?></li>
</ul>
</div>
<div>
<i class="fa fa-percent" aria-hidden="true"></i>
<span class="pricing-body-title"><?php _e( 'Plus ', 'ninja-forms' ); ?> 20% <?php _e( 'off Additional Add-Ons', 'ninja-forms' ); ?></span>
</div>
</div>
</div>
<!-- Professional -->
<div class="pricing-block widget highlight">
<div class="pricing-header">
<div class="pricing-title"><?php _e( 'PROFESSIONAL', 'ninja-forms' ); ?></div>
<div class="pricing-price">$199 / <?php _e( 'year', 'ninja-forms' ); ?></div>
<div class="pricing-savings"><?php _e( 'SAVE OVER', 'ninja-forms' ); ?> $1500!</div>
<div class="pricing-cta"><a target="_blank" href="https://ninjaforms.com/checkout/?edd_action=add_to_cart&download_id=471355&?utm_source=Ninja+Forms+Plugin&utm_medium=Apps+and+Integrations&utm_campaign=Dashboard+Memberships&utm_content=Professional+Buy+Now" class="nf-button primary"><?php _e( 'Buy Now', 'ninja-forms' ); ?></a></div>
</div>
<div class="pricing-body">
<div>
<hr>
<span class="pricing-body-title"><?php _e( 'EVERYTHING IN PERSONAL, PLUS:', 'ninja-forms' ); ?></span>
<hr>
</div>
<div>
<i class="fa fa-users" aria-hidden="true"></i>
<span class="pricing-body-title"><?php _e( '20 SITES', 'ninja-forms' ); ?></span>
</div>
<div>
<i class="fa fa-user-plus" aria-hidden="true"></i>
<span class="pricing-body-title"><?php _e( 'EMPOWER CLIENTS & USERS', 'ninja-forms' ); ?></span>
<ul>
<li><?php _e( 'Login & Registration Forms', 'ninja-forms' ); ?></li>
<li><?php _e( 'Update Profile Forms', 'ninja-forms' ); ?></li>
<li><?php _e( 'Post Creation Forms', 'ninja-forms' ); ?></li>
<li><?php _e( 'Save Form Progress', 'ninja-forms' ); ?></li>
</ul>
</div>
<div>
<i class="fa fa-bolt" aria-hidden="true"></i>
<span class="pricing-body-title"><?php _e( 'INTEGRATE ANYWHERE', 'ninja-forms' ); ?></span>
<ul>
<li><?php _e( 'Zapier', 'ninja-forms' ); ?></li>
<li><?php _e( 'Webhooks', 'ninja-forms' ); ?></li>
</ul>
</div>
<div>
<i class="fa fa-cc-stripe" aria-hidden="true"></i>
<span class="pricing-body-title"><?php _e( 'ACCEPT PAYMENTS', 'ninja-forms' ); ?></span>
<ul>
<li><?php _e( 'Stripe', 'ninja-forms' ); ?></li>
<li><?php _e( 'Recurly', 'ninja-forms' ); ?></li>
</ul>
</div>
<div>
<i class="fa fa-percent" aria-hidden="true"></i>
<span class="pricing-body-title"><?php _e( 'Plus ', 'ninja-forms' ); ?><strong>40% </strong> <?php _e( 'off Additional Add-Ons', 'ninja-forms' ); ?></span>
</div>
</div>
</div>
<!-- AGENCY -->
<div class="pricing-block widget">
<div class="pricing-header">
<div class="pricing-title"><?php _e( 'AGENCY', 'ninja-forms' ); ?></div>
<div class="pricing-price">$499 / year</div>
<div class="pricing-savings"><?php _e( 'SAVE OVER', 'ninja-forms' ); ?> $3100!</div>
<div class="pricing-cta"><a target="_blank" href="https://ninjaforms.com/checkout/?edd_action=add_to_cart&download_id=203757&utm_source=Ninja+Forms+Plugin&utm_medium=Apps+and+Integrations&utm_campaign=Dashboard+Memberships&utm_content=Agency+Buy+Now" class="nf-button primary"><?php _e( 'Buy Now', 'ninja-forms' ); ?></a></div>
</div>
<div class="pricing-body">
<div>
<hr>
<span class="pricing-body-title"><?php _e( 'EVERYTHING IN PROFESSIONAL, PLUS:', 'ninja-forms' ); ?></span>
<hr>
</div>
<div>
<i class="fa fa-users" aria-hidden="true"></i>
<span class="pricing-body-title"><?php _e( 'UNLIMITED SITES', 'ninja-forms' ); ?></span>
</div>
<div>
<i class="fa fa-globe" aria-hidden="true"></i>
<span class="pricing-body-title"><?php _e( 'All Ninja Forms add-ons', 'ninja-forms' ); ?></span>
<ul>
<li><?php _e( 'CRM integrations', 'ninja-forms' ); ?></li>
<li><?php _e( 'SMS and Slack notifications', 'ninja-forms' ); ?></li>
<li><?php _e( 'Advanced Analytics', 'ninja-forms' ); ?></li>
<li><?php _e( 'More email marketing', 'ninja-forms' ); ?></li>
<li><?php _e( 'So much more!', 'ninja-forms' ); ?></li>
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="widget widget-plan-notice">
<p class="widget-title"><?php _e( 'What else comes with Ninja Forms?', 'ninja-forms' ); ?></p>
<a href="https://ninjaforms.com/extensions/?utm_source=Ninja+Forms+Plugin&utm_medium=Apps+and+Integrations&utm_campaign=Dashboard+Features+Link" target="_blank" class="nf-button primary feature-list-link"><?php _e( 'Checkout our full list of features!', 'ninja-forms' ); ?> <i class="fa fa-chevron-circle-right" aria-hidden="true"></i></a>
<p class="widget-title">What else comes with Ninja Forms?</p>
<a class="nf-button primary feature-list-link" href="https://ninjaforms.com/features/?utm_source=Ninja+Forms+Plugin&utm_medium=Apps+and+Integrations&utm_campaign=Dashboard+Features+Link" target="_blank" rel="noopener">We're glad you asked! Checkout our full list of features! <i class="fa fa-chevron-circle-right" aria-hidden="true"></i></a>
<div><em>All plans include a 14 day money back guarantee.</em></div>
<div>Requires a current active license and subject to our <a href="https://ninjaforms.com/terms-conditions/?utm_medium=plugin&utm_source=plugin-dashboard&utm_campaign=Ninja+Forms+Memberships&utm_content=Terms+Conditions" target="_blank" rel="noopener">Terms &amp; Conditions</a>.</div>
</div>
<?php
} else {
echo( $saved );
}
Ninja_Forms()->menus[ 'add-ons']->display();
?>
<?php Ninja_Forms()->menus[ 'add-ons']->display(); ?>
</script>
<!-- Section: Required Updates -->
......
......@@ -1306,14 +1306,6 @@ if( get_option( 'ninja_forms_load_deprecated', FALSE ) && ! ( isset( $_POST[ 'nf
* @since 3.3.17
*/
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.
$data = wp_remote_get( 'http://api.ninjaforms.com/feeds/?fetch=addons' );
// 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