Commit feed6496 authored by Eric Windham's avatar Eric Windham

fixing merge conflicts

parents c9f772d8 8fb60a78
......@@ -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.7
Tested up to: 4.9
Stable tag: 3.2.12
Stable tag: 3.2.13
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.
......
......@@ -10,7 +10,7 @@ define([], function() {
var dateFormat = view.model.get( 'date_format' );
// For "default" date format, convert PHP format to JS compatible format.
if( 'default' == dateFormat ){
if( '' == dateFormat || 'default' == dateFormat ){
dateFormat = this.convertDateFormat( nfi18n.dateFormat );
}
......
......@@ -12,15 +12,22 @@ define([], function() {
initRating: function( view ){
jQuery( view.el ).find( '.starrating' ).rating();
},
renderRatings: function() {
var html = document.createElement( 'span' );
for (var i = 0; i <= this.default - 1; i++) {
// changed from 'default' to 'number_of_stars'
for (var i = 0; i <= this.number_of_stars - 1; i++) {
var template = nfRadio.channel( 'app' ).request( 'get:template', '#tmpl-nf-field-starrating-star' );
var num = i + 1;
var htmlFragment = template( { id: this.id, classes: this.classes, num: num } );
var checked = '';
// Check to see if current 'star' matches the default value
if ( this.value == num ) {
checked = 'checked';
}
var htmlFragment = template( { id: this.id, classes: this.classes, num: num, checked: checked } );
html.appendChild(
document.createRange().createContextualFragment( htmlFragment )
);
......
......@@ -125,7 +125,7 @@ define([], function() {
cache: false,
success: function( data, textStatus, jqXHR ) {
try {
var response = jQuery.parseJSON( data );
var response = data;
nfRadio.channel( 'forms' ).trigger( 'submit:response', response, textStatus, jqXHR, formModel.get( 'id' ) );
nfRadio.channel( 'form-' + formModel.get( 'id' ) ).trigger( 'submit:response', response, textStatus, jqXHR );
jQuery( document ).trigger( 'nfFormSubmitResponse', { response: response, id: formModel.get( 'id' ) } );
......
......@@ -108,7 +108,7 @@ jQuery( document ).ready( function( $ ) {
cache: false,
success: function( data, textStatus, jqXHR ) {
try {
var response = jQuery.parseJSON( data );
var response = data;
nfRadio.channel( 'forms' ).trigger( 'submit:response', response, textStatus, jqXHR, formModel.get( 'id' ) );
nfRadio.channel( 'form-' + formModel.get( 'id' ) ).trigger( 'submit:response', response, textStatus, jqXHR );
} catch( e ) {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
......@@ -265,7 +265,7 @@ class Ninja_Forms {
// Plugin version
if ( ! defined( 'NF_PLUGIN_VERSION' ) )
define( 'NF_PLUGIN_VERSION', '3.2.12' );
define( 'NF_PLUGIN_VERSION', '3.2.13' );
// Plugin Folder Path
if ( ! defined( 'NF_PLUGIN_DIR' ) )
......
......@@ -42,6 +42,13 @@ class NF_AJAX_Controllers_Submission extends NF_Abstracts_Controller
$this->_form_id = $this->_form_data['id'];
// If we don't have a numeric form ID...
if ( ! is_numeric( $this->_form_id ) ) {
// Kick the request out without processing.
$this->_errors[] = __( 'Form does not exist.', 'ninja-forms' );
$this->_respond();
}
if( $this->is_preview() ) {
$this->_form_cache = get_user_option( 'nf_form_preview_' . $this->_form_id );
......@@ -462,4 +469,15 @@ class NF_AJAX_Controllers_Submission extends NF_Abstracts_Controller
if( ! isset( $this->_form_data[ 'settings' ][ 'is_preview' ] ) ) return false;
return $this->_form_data[ 'settings' ][ 'is_preview' ];
}
/*
* Overwrite method for parent class.
*/
protected function _respond( $data = array() )
{
// Set a content type of JSON for the purpose of previnting XSS attacks.
header( 'Content-Type: application/json' );
// Call the parent method.
parent::_respond();
}
}
......@@ -470,7 +470,7 @@ return apply_filters( 'ninja_forms_field_settings', array(
'value' => 'dddd, MMMM D YYYY',
),
),
'value' => '',
'value' => 'default',
),
/*
......
......@@ -53,8 +53,8 @@ class NF_Fields_Checkbox extends NF_Abstracts_Input
*/
public function admin_form_element( $id, $value )
{
// If the checkboxes value is one...
if( 1 == $value ) {
// If the checkboxes value is 1 or on...
if( 'on' == $value || 1 == $value ) {
// ...this variable to checked.
$checked = 'checked';
} else {
......@@ -81,14 +81,14 @@ class NF_Fields_Checkbox extends NF_Abstracts_Input
// If the field type is equal to checkbox...
if( 'checkbox' == $field->get_setting( 'type' ) ) {
// Backwards compatibility check for the new checked value setting.
if( null == $field->get_setting( 'checked_value' ) && 1 == $value ) {
if( null == $field->get_setting( 'checked_value' ) && 1 == $value || 'on' == $value ) {
return __( 'Checked', 'ninja-forms' );
} elseif( null == $field->get_setting( 'unchecked_value' ) && 0 == $value ) {
return __( 'Unchecked', 'ninja-forms');
}
// If the field value is set to 1....
if( 1 == $value ) {
if( 1 == $value || 'on' == $value) {
// Set the value to the checked value setting.
$value = $field->get_setting( 'checked_value' );
} else {
......@@ -151,13 +151,25 @@ class NF_Fields_Checkbox extends NF_Abstracts_Input
// If value is equal to checked or unchecked return the value
if ( __( 'checked', 'ninja-forms' ) == $value ||
__( 'unchecked', 'ninja-forms' ) == $value ) return $value;
// If the value is a boolean...
if ( $value ) {
// ...if true return checked
return $field->get_setting( 'checked_value' );
} else {
// ...else return unchecked.
return $field->get_setting( 'unchecked_value' );
// Creating settings variables for our check.
$checked_setting = $field->get_setting( 'checked_value' );
$unchecked_setting = $field->get_setting( 'unchecked_value' );
// If the the value and check to see if we have checked and unchecked settings...
if ( 1 == $value && ! empty( $checked_setting ) ) {
// ...if we do return checked setting
return $checked_setting;
} elseif ( 0 == $value && ! empty( $unchecked_setting ) ) {
// ...else return unchecked setting.
return $unchecked_setting;
/*
* These checks are for checkbox fields that were created before version 3.2.7.
*/
} elseif ( 1 == $value ) {
return __( 'checked', 'ninja-forms' );
} elseif ( 0 == $value ) {
return __( 'unchecked', 'ninja-forms' );
}
}
}
......@@ -17,21 +17,15 @@ class NF_Fields_StarRating extends NF_Abstracts_Input
protected $_templates = 'starrating';
protected $_settings_only = array( 'label', 'label_pos', 'default', 'required', 'classes', 'key', 'admin_label' );
protected $_settings_only = array( 'label', 'label_pos', 'default',
'number_of_stars', 'required', 'classes', 'key', 'admin_label' );
public function __construct()
{
parent::__construct();
$this->_settings[ 'default' ][ 'group' ] = 'primary';
$this->_settings[ 'default' ][ 'label' ] = __( 'Number of Stars', 'ninja-forms' );
$this->_settings[ 'default' ][ 'width' ] = 'one-half';
$this->_settings[ 'default' ][ 'use_merge_tags' ] = FALSE;
$this->_settings[ 'default' ][ 'value' ] = 5;
// Put this in the primary settings group
$this->_settings['number_of_stars']['group'] = 'primary';
$this->_nicename = __( 'Star Rating', 'ninja-forms' );
}
......
......@@ -5,5 +5,7 @@
</script>
<script id="tmpl-nf-field-starrating-star" type="text/template">
<input type="radio" name="nf-field-{{{ data.id }}}" class="{{{ data.classes }}} nf-element" value="{{{ data.num }}}" />
<input type="radio" name="nf-field-{{{ data.id }}}"
class="{{{ data.classes }}} nf-element" value="{{{ data.num }}}"
{{{ data.checked }}}/>
</script>
<script id="tmpl-nf-form-layout" type="text/template">
<!--<form>-->
<div>
<div class="nf-before-form-content"></div>
<div class="nf-form-content {{{ data.element_class }}}"></div>
<div class="nf-after-form-content"></div>
</div>
<!--</form>-->
</script>
\ 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.2.12
Version: 3.2.13
Author: The WP Ninjas
Author URI: http://ninjaforms.com
Text Domain: ninja-forms
......@@ -53,7 +53,7 @@ if( get_option( 'ninja_forms_load_deprecated', FALSE ) && ! ( isset( $_POST[ 'nf
/**
* @since 3.0
*/
const VERSION = '3.2.12';
const VERSION = '3.2.13';
const WP_MIN_VERSION = '4.7';
......
......@@ -3,7 +3,7 @@ Contributors: wpninjasllc, kstover, jameslaws, kbjohnson90, klhall1987, krmoorho
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.7
Tested up to: 4.9
Stable tag: 3.2.12
Stable tag: 3.2.13
License: GPLv2 or later
Drag and drop fields in an intuitive UI to create contact forms, email subscription forms, order forms, payment forms, send emails and more!
......@@ -111,10 +111,11 @@ For help and video tutorials, please visit our website: [Ninja Forms Documentati
== Upgrade Notice ==
= 3.2.12 (13 February 2018) =
= 3.2.13 (14 February 2018) =
*Bugs:*
* Resolved an issue that caused recently published forms to not display in Internet Explorer.
* Localized several strings for translation that had previously been missed.
* Radio and checkbox lists will now properly save updates made on the edit submission page.
* Resolved an issue that sometimes caused excessive page load times in the WordPress admin.
......@@ -125,6 +126,12 @@ For help and video tutorials, please visit our website: [Ninja Forms Documentati
== Changelog ==
= 3.2.13 (14 February 2018) =
*Bugs:*
* Resolved an issue that caused recently published forms to not display in Internet Explorer.
= 3.2.12 (13 February 2018) =
*Bugs:*
......
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