Commit e0e2d7e6 authored by Kevin Stover's avatar Kevin Stover

Merge branch 'develop'

# Conflicts:
#	README.md
#	includes/Database/FieldsController.php
parents 2de9b606 b8a8a34a
......@@ -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.2
Stable tag: 3.0.29
Stable tag: 3.0.30
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.
......
......@@ -725,10 +725,17 @@ All styles used within the drawer
padding: 0 10px; }
.ninja-forms-app .nf-setting-label, .ninja-forms-app label, .ninja-forms-app legend {
position: relative;
color: #424242;
display: block;
font-size: 13px;
text-transform: uppercase; }
.ninja-forms-app .nf-setting-label .open-media-manager, .ninja-forms-app label .open-media-manager, .ninja-forms-app legend .open-media-manager {
position: absolute;
color: #ccc;
right: 15px;
top: 5px;
text-decoration: none; }
.ninja-forms-app input[type=text],
.ninja-forms-app input[type=number],
......@@ -1149,7 +1156,6 @@ input[type=checkbox].nf-toggle {
.ninja-forms-app .nf-select select {
background: transparent;
border: 0;
box-shadow: 0 0 0;
margin-top: 7px;
height: 41px !important;
padding: 0 30px 0 15px;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
/**
*
* @package Ninja Forms builder
* @subpackage Main App
* @copyright (c) 2017 WP Ninjas
* @since 3.0.30
*/
define( [], function() {
var controller = Marionette.Object.extend( {
initialize: function() {
// When the media button is clicked, open the media manager.
this.listenTo( nfRadio.channel( 'setting-type-media' ), 'click:extra', this.clickExtra );
},
clickExtra: function( e, settingModel, dataModel, settingView ) {
var textEl = jQuery( e.target ).parent().find( '.setting' );
if ( jQuery( e.target ).hasClass( 'open-media-manager' ) ) {
// If the frame already exists, re-open it.
if ( this.meta_image_frame ) {
this.meta_image_frame.open();
return;
}
// Sets up the media library frame
this.meta_image_frame = wp.media.frames.meta_image_frame = wp.media({
title: 'Select a file',
button: { text: 'insert' }
});
var that = this;
// Runs when an image is selected.
this.meta_image_frame.on('select', function(){
// Grabs the attachment selection and creates a JSON representation of the model.
var media_attachment = that.meta_image_frame.state().get('selection').first().toJSON();
textEl.val( media_attachment.url ).change();
});
// Opens the media library frame.
this.meta_image_frame.open();
}
},
});
return controller;
} );
\ No newline at end of file
......@@ -136,7 +136,7 @@ define( [], function() {
}
for( var setting in settings ){
if( null === settings[ setting ] || '' === settings[ setting ] ) {
if( null === settings[ setting ] ) {
delete settings[setting];
}
}
......
......@@ -53,6 +53,7 @@ define(
'controllers/app/trackKeyDown',
'controllers/app/perfectScroll',
'controllers/app/getNewSettingGroupCollection',
'controllers/app/settingMedia',
/*
* Fields domain controllers
*/
......@@ -148,6 +149,7 @@ define(
TrackKeyDown,
PerfectScroll,
GetNewSettingGroupCollection,
SettingMedia,
/*
* Fields domain controllers
*/
......@@ -225,6 +227,7 @@ define(
new SettingFieldList();
new SettingHTML();
new SettingColor();
new SettingMedia();
new ChangeMenu();
new AppMobile();
new AppNotices();
......
......@@ -15,6 +15,7 @@ define( ['views/app/drawer/itemSetting'], function( itemSettingView ) {
}
}
}
this.model.on( 'rerender', this.render, this );
},
onBeforeDestroy: function() {
......@@ -28,14 +29,18 @@ define( ['views/app/drawer/itemSetting'], function( itemSettingView ) {
}
},
onRender: function() {
// this.$el = this.$el.children();
// this.$el.unwrap();
// this.setElement( this.$el );
onBeforeRender: function() {
nfRadio.channel( 'app' ).trigger( 'before:renderSetting', this.model, this.dataModel );
nfRadio.channel( 'setting-type-' + this.model.get( 'type' ) ).trigger( 'before:renderSetting', this.model, this.dataModel, this );
nfRadio.channel( 'setting-' + this.model.get( 'name' ) ).trigger( 'before:renderSetting', this.model, this.dataModel, this );
},
// this.$el = this.$el.children();
// this.$el.unwrap();
// this.setElement( this.$el );
onRender: function() {
/*
* Send out a radio message.
*/
nfRadio.channel( 'setting-' + this.model.get( 'name' ) ).trigger( 'render:setting', this.model, this.dataModel, this );
nfRadio.channel( 'setting-type-' + this.model.get( 'type' ) ).trigger( 'render:setting', this.model, this.dataModel, this );
},
templateHelpers: function () {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
......@@ -70,10 +70,18 @@
padding: 0 10px;
}
.nf-setting-label, label, legend {
position: relative;
color: #424242;
display: block;
font-size: 13px;
text-transform: uppercase;
.open-media-manager {
position: absolute;
color: #ccc;
right: 15px;
top: 5px;
text-decoration: none;
}
}
input[type=text],
input[type=number],
......
......@@ -265,7 +265,7 @@ class Ninja_Forms {
// Plugin version
if ( ! defined( 'NF_PLUGIN_VERSION' ) )
define( 'NF_PLUGIN_VERSION', '3.0.29' );
define( 'NF_PLUGIN_VERSION', '3.0.30' );
// Plugin Folder Path
if ( ! defined( 'NF_PLUGIN_DIR' ) )
......
......@@ -35,7 +35,9 @@ abstract class NF_Abstracts_List extends NF_Abstracts_Field
public function admin_form_element( $id, $value )
{
$field = Ninja_Forms()->form()->get_field( $id );
$form_id = get_post_meta( absint( $_GET[ 'post' ] ), '_form_id', true );
$field = Ninja_Forms()->form( $form_id )->get_field( $id );
$options = '<option>--</option>';
if ( is_array( $field->get_setting( 'options' ) ) ) {
......
......@@ -178,12 +178,14 @@ class NF_Admin_CPT_Submission
echo apply_filters( 'nf_sub_table_seq_num', $sub->get_seq_num(), $sub_id, $column );
}
$form_id = absint( $_GET[ 'form_id' ] );
if( is_numeric( $column ) ){
$value = $sub->get_field_value( $column );
static $fields;
if( ! isset( $fields[ $column ] ) ) {
$fields[$column] = Ninja_Forms()->form()->get_field($column);
$fields[$column] = Ninja_Forms()->form( $form_id )->get_field( $column );
}
$field = $fields[$column];
echo apply_filters( 'ninja_forms_custom_columns', $value, $field, $sub_id );
......
......@@ -114,4 +114,12 @@ return apply_filters( 'ninja_forms_available_actions', array(
'plugin_path' => 'ninja-forms-videomail/ninja-forms-videomail.php'
),
'trello' => array(
'name' => "trello",
'nicename' => "Trello",
'image' => "data:image/png;base64,iVBORw0KGgoAAAANS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Xolf0SvRK9IpeE4heiV6JXtEr0SvRK016AkbKn4/DmuepAAAAAElFTkSuQmCC",
'link' => "https://ninjaforms.com/extensions/trello/?utm_medium=plugin&utm_source=plugin&utm_campaign=Ninja+Forms+Actions+Drawer&utm_content=Trello",
'plugin_path' => "ninja-forms-trello/ninja-forms-trello.php"
),
) );
......@@ -53,7 +53,8 @@ final class NF_Database_FieldsController
'label' => $field_data[ 'settings' ][ 'label' ],
'type' => $field_data[ 'settings' ][ 'type' ]
);
if( is_string( $field_id ) ){
if( ! is_numeric( $field_id ) ) {
$this->insert_field( $settings ); // New Field.
} else {
$this->update_field( $field_id, $settings );
......@@ -100,7 +101,7 @@ final class NF_Database_FieldsController
", OBJECT_K);
foreach( $this->fields_data as $i => $field_data ){
$field_key = $field_data[ 'settings' ][ 'key' ];
if( is_string( $field_data[ 'id' ] ) && isset( $field_id_lookup[ $field_key ] ) ){
if( ! is_numeric( $field_data[ 'id' ] ) && isset( $field_id_lookup[ $field_key ] ) ){
$tmp_id = $field_data[ 'id' ];
$this->fields_data[ $i ][ 'id' ] = $this->new_field_ids[ $tmp_id ] = $field_id_lookup[ $field_key ]->id;
}
......@@ -179,6 +180,9 @@ final class NF_Database_FieldsController
$this->db->escape_by_ref( $field_id );
$this->db->escape_by_ref( $key );
$this->db->escape_by_ref( $value );
$value = maybe_serialize( $value );
if( ! $this->insert_field_meta[ $this->insert_field_meta_chunk ] ) $this->insert_field_meta[ $this->insert_field_meta_chunk ] = '';
$this->insert_field_meta[ $this->insert_field_meta_chunk ] .= "('{$field_id}','{$key}','{$value}' ),";
$counter++;
......@@ -203,10 +207,12 @@ final class NF_Database_FieldsController
private function update_field_meta( $field_id, $key, $value )
{
static $counter;
$value = maybe_serialize( $value );
$this->db->escape_by_ref( $key );
$this->db->escape_by_ref( $value );
if( ! $this->update_field_meta[ $this->update_field_meta_chunk ] ) $this->update_field_meta[ $this->update_field_meta_chunk ] = '';
$this->update_field_meta[ $this->update_field_meta_chunk ] .= " WHEN `parent_id` = '{$field_id}' AND 'key' = '{$key}' THEN '{$value}'";
$this->update_field_meta[ $this->update_field_meta_chunk ] .= " WHEN `parent_id` = '{$field_id}' AND `key` = '{$key}' THEN '{$value}'";
$counter++;
if( 0 == $counter % 5000 ) $this->update_field_meta_chunk++;
}
......
......@@ -30,7 +30,9 @@ class NF_Fields_ListCheckbox extends NF_Abstracts_List
public function admin_form_element( $id, $value )
{
$field = Ninja_Forms()->form()->get_field( $id );
$form_id = get_post_meta( absint( $_GET[ 'post' ] ), '_form_id', true );
$field = Ninja_Forms()->form( $form_id )->get_field( $id );
$list = '';
foreach( $field->get_setting( 'options' ) as $option ){
......
......@@ -459,6 +459,13 @@ Label Three, value-three, 3
</label>
</script>
<script id="tmpl-nf-edit-setting-media" type="text/template">
<label for="{{{ data.name }}}" class="{{{ data.renderLabelClasses() }}} has-merge-tags">{{{ data.label }}} {{{ data.renderTooltip() }}}
<input type="text" class="setting" id="{{{ data.name }}}" value="{{{ data.value }}}" {{{ data.renderPlaceholder() }}} />
<span class="extra open-media-manager dashicons dashicons-admin-media merge-tags"></span>
</label>
</script>
<script id="tmpl-nf-edit-setting-datepicker" type="text/template">
<label for="{{{ data.name }}}" class="{{{ data.renderLabelClasses() }}}">{{{ data.label }}} {{{ data.renderTooltip() }}}
<input type="text" class="setting" id="{{{ data.name }}}" value="{{{ data.value }}}" {{{ data.renderPlaceholder() }}} />
......
<?php if ( ! defined( 'ABSPATH' ) ) exit;
/**
* Adds a global exception handler for reporting on form rendering issues.
*
* Note: Exceptions before `document.ready` do not break scripts inside of `document.ready`.
*/
final class NF_ExceptionHandlerJS
{
public function __construct()
{
add_action( 'wp_head', array( $this, 'wp_head' ), 6 );
}
public function wp_head()
{
if( ! current_user_can( 'manage_options' ) ) return;
?>
<script type="text/javascript">
window.addEventListener( 'error', function (e) {
var source = e.filename.match( /plugins\/(...)/gi ) || e.filename;
var message = '<pre>' +
'[ADMIN NOTICE] Form Rendering Error' +
'\r\rSource: ' + source +
'\r\r<span style="color:red;">' + e.error + '</span>' +
'</pre>';
// Replace form loading animation.
var forms = document.getElementsByClassName( 'nf-form-cont' );
for ( var i = 0; i < forms.length; i++ ) {
forms[i].innerHTML = message;
}
});
</script>
<?php
}
} // END CLASS NF_ExceptionHandlerJS
......@@ -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.29
Version: 3.0.30
Author: The WP Ninjas
Author URI: http://ninjaforms.com
Text Domain: ninja-forms
......@@ -15,6 +15,7 @@ Copyright 2016 WP Ninjas.
require_once dirname( __FILE__ ) . '/lib/NF_VersionSwitcher.php';
require_once dirname( __FILE__ ) . '/lib/NF_Tracking.php';
require_once dirname( __FILE__ ) . '/lib/NF_Conversion.php';
require_once dirname( __FILE__ ) . '/lib/NF_ExceptionHandlerJS.php';
require_once dirname( __FILE__ ) . '/lib/Conversion/Calculations.php';
function ninja_forms_three_table_exists(){
......@@ -51,7 +52,7 @@ if( get_option( 'ninja_forms_load_deprecated', FALSE ) && ! ( isset( $_POST[ 'nf
/**
* @since 3.0
*/
const VERSION = '3.0.29';
const VERSION = '3.0.30';
/**
* @var Ninja_Forms
......@@ -291,6 +292,11 @@ if( get_option( 'ninja_forms_load_deprecated', FALSE ) && ! ( isset( $_POST[ 'nf
*/
self::$instance->tracking = new NF_Tracking();
/*
* JS Exception Handler
*/
self::$instance->exception_handler_js = new NF_ExceptionHandlerJS();
/*
* Activation Hook
* TODO: Move to a permanent home.
......
......@@ -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.2
Stable tag: 3.0.29
Stable tag: 3.0.30
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,14 +102,32 @@ For help and video tutorials, please visit our website: [Ninja Forms Documentati
== Upgrade Notice ==
= 3.0.29 (21 February 2017) =
= 3.0.30 (28 February 2017) =
*Bugs:*
* Fixed a bug that could cause previewed forms from submitting properly.
* Publishing a form should now populate the backup database properly in all environments.
* Editing submissions that have selects or other lists should now work properly.
*Changes:*
* Added Trello to the available actions list.
* Added a JS exception catcher to help debug when forms don't display because of JS errors.
== Changelog ==
= 3.0.30 (28 February 2017) =
*Bugs:*
* Publishing a form should now populate the backup database properly in all environments.
* Editing submissions that have selects or other lists should now work properly.
*Changes:*
* Added Trello to the available actions list.
* Added a JS exception catcher to help debug when forms don't display because of JS errors.
= 3.0.29 (21 February 2017) =
*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