Custom Contact Forms - Version 6.8

Version Description

  • Configurable "from" name field
  • Minor variable stomping bug fix
  • Successful/unsuccessful submission hooks
Download this release

Release Info

Developer tlovett1
Plugin Icon 128x128 Custom Contact Forms
Version 6.8
Comparing to
See all releases

Code changes from version 6.7.3 to 6.8

bin/production-ready.sh DELETED
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- echo "Are you sure you want to do this? Uncommitted work could be lost. [y/n]"
4
- read input_variable
5
-
6
- if [ "$input_variable" == "y" ]; then
7
- DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
8
-
9
- cd "$DIR/../"
10
-
11
- rm bin/install-wp-tests.sh > /dev/null 2>&1
12
-
13
- rm -rf bower_components > /dev/null 2>&1
14
- rm -rf node_modules > /dev/null 2>&1
15
- rm -rf scss > /dev/null 2>&1
16
- rm -rf tests > /dev/null 2>&1
17
- rm -rf .sass-cache > /dev/null 2>&1
18
- rm -rf vendor/wp-api/wp-api/.git > /dev/null 2>&1
19
-
20
- rm .travis.yml > /dev/null 2>&1
21
- rm Gruntfile.js > /dev/null 2>&1
22
- rm Dockunit.json > /dev/null 2>&1
23
- rm phpunit.xml > /dev/null 2>&1
24
- rm .jshintrc > /dev/null 2>&1
25
-
26
- bower install --production > /dev/null 2>&1
27
-
28
- echo "Done! Custom Contact Forms is cleaned up and production ready."
29
- fi
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
build/js/form-manager.js CHANGED
@@ -361,6 +361,9 @@
361
  emailNotificationFromType: 'default',
362
  emailNotificationFromAddress: '',
363
  emailNotificationFromField: '',
 
 
 
364
  pause: false,
365
  pauseMessage: ccfSettings.pauseMessage
366
  };
@@ -1779,7 +1782,8 @@
1779
  'blur input': 'save',
1780
  'change select': 'save',
1781
  'change select.form-send-email-notifications': 'toggleNotificationFields',
1782
- 'change select.form-email-notification-from-type': 'toggleNotificationFields'
 
1783
  },
1784
 
1785
  initialize: function( options ) {
@@ -1793,15 +1797,21 @@
1793
  this.unbind();
1794
  },
1795
 
1796
- updateFromAddressFieldField: function() {
1797
  var emailNotificationFromField = this.el.querySelectorAll( '.form-email-notification-from-field' )[0];
1798
  emailNotificationFromField.innerHTML = '';
1799
  emailNotificationFromField.disabled = false;
1800
 
 
 
 
 
1801
  var fields = this.model.get( 'fields'),
1802
- fieldsAdded = 0;
 
1803
 
1804
- var currentField = this.model.get( 'emailNotificationFromField' );
 
1805
 
1806
  if ( fields.length >= 1 ) {
1807
  fields.each( function( field ) {
@@ -1810,23 +1820,42 @@
1810
  option.innerHTML = field.get( 'slug' );
1811
  option.value = field.get( 'slug' );
1812
 
1813
- if ( field.get( 'slug' ) === currentField ) {
1814
  option.selected = true;
1815
  }
1816
 
1817
  emailNotificationFromField.appendChild( option );
1818
 
1819
- fieldsAdded++;
 
 
 
 
 
 
 
 
 
 
 
 
1820
  }
1821
  });
1822
  }
1823
 
1824
- if ( 0 === fieldsAdded ) {
1825
  var option = document.createElement( 'option' );
1826
  option.innerHTML = ccfSettings.noEmailFields;
1827
  emailNotificationFromField.appendChild( option );
1828
  emailNotificationFromField.disabled = true;
1829
  }
 
 
 
 
 
 
 
1830
  },
1831
 
1832
  toggleNotificationFields: function() {
@@ -1842,6 +1871,12 @@
1842
 
1843
  var emailNotificationFromType = this.el.querySelectorAll( '.form-email-notification-from-type' )[0];
1844
 
 
 
 
 
 
 
1845
  if ( parseInt( sendEmailNotifications ) ) {
1846
  for ( i = 0; i < emailNotificationSettings.length; i++ ) {
1847
  emailNotificationSettings[i].style.display = 'block';
@@ -1855,6 +1890,15 @@
1855
  } else if ( 'field' === emailNotificationFromType.value ) {
1856
  emailNotificationFromField.style.display = 'block';
1857
  }
 
 
 
 
 
 
 
 
 
1858
  } else {
1859
  for ( i = 0; i < emailNotificationSettings.length; i++ ) {
1860
  emailNotificationSettings[i].style.display = 'none';
@@ -1862,6 +1906,9 @@
1862
 
1863
  emailNotificationFromAddress.style.display = 'none';
1864
  emailNotificationFromField.style.display = 'none';
 
 
 
1865
  }
1866
  },
1867
 
@@ -1888,6 +1935,15 @@
1888
  var emailNotificationFromField = this.el.querySelectorAll( '.form-email-notification-from-field' )[0].value;
1889
  this.model.set( 'emailNotificationFromField', emailNotificationFromField );
1890
 
 
 
 
 
 
 
 
 
 
1891
  if ( typeof $promise !== 'undefined' && typeof $promise.promise !== 'undefined' ) {
1892
  $promise.resolve();
1893
  }
@@ -1903,12 +1959,12 @@
1903
  this.el.innerHTML = this.template( context );
1904
 
1905
  this.toggleNotificationFields();
1906
- this.updateFromAddressFieldField();
1907
 
1908
  wp.ccf.dispatcher.on( 'saveFormNotifications', this.save, this );
1909
  wp.ccf.dispatcher.on( 'mainViewChange', this.save, this );
1910
- this.listenTo( fields, 'add', this.updateFromAddressFieldField, this );
1911
- this.listenTo( fields, 'remove', this.updateFromAddressFieldField, this );
1912
 
1913
  return this;
1914
  }
361
  emailNotificationFromType: 'default',
362
  emailNotificationFromAddress: '',
363
  emailNotificationFromField: '',
364
+ emailNotificationFromNameType: 'custom',
365
+ emailNotificationFromName: 'WordPress',
366
+ emailNotificationFromNameField: '',
367
  pause: false,
368
  pauseMessage: ccfSettings.pauseMessage
369
  };
1782
  'blur input': 'save',
1783
  'change select': 'save',
1784
  'change select.form-send-email-notifications': 'toggleNotificationFields',
1785
+ 'change select.form-email-notification-from-type': 'toggleNotificationFields',
1786
+ 'change select.form-email-notification-from-name-type': 'toggleNotificationFields'
1787
  },
1788
 
1789
  initialize: function( options ) {
1797
  this.unbind();
1798
  },
1799
 
1800
+ updateFromFieldField: function() {
1801
  var emailNotificationFromField = this.el.querySelectorAll( '.form-email-notification-from-field' )[0];
1802
  emailNotificationFromField.innerHTML = '';
1803
  emailNotificationFromField.disabled = false;
1804
 
1805
+ var emailNotificationFromNameField = this.el.querySelectorAll( '.form-email-notification-from-name-field' )[0];
1806
+ emailNotificationFromNameField.innerHTML = '';
1807
+ emailNotificationFromNameField.disabled = false;
1808
+
1809
  var fields = this.model.get( 'fields'),
1810
+ addressFieldsAdded = 0,
1811
+ nameFieldsAdded = 0;
1812
 
1813
+ var addressField = this.model.get( 'emailNotificationFromField' );
1814
+ var nameField = this.model.get( 'emailNotificationFromNameField' );
1815
 
1816
  if ( fields.length >= 1 ) {
1817
  fields.each( function( field ) {
1820
  option.innerHTML = field.get( 'slug' );
1821
  option.value = field.get( 'slug' );
1822
 
1823
+ if ( field.get( 'slug' ) === addressField ) {
1824
  option.selected = true;
1825
  }
1826
 
1827
  emailNotificationFromField.appendChild( option );
1828
 
1829
+ addressFieldsAdded++;
1830
+ } else if ( 'name' === field.get( 'type' ) ) {
1831
+ var option = document.createElement( 'option' );
1832
+ option.innerHTML = field.get( 'slug' );
1833
+ option.value = field.get( 'slug' );
1834
+
1835
+ if ( field.get( 'slug' ) === nameField ) {
1836
+ option.selected = true;
1837
+ }
1838
+
1839
+ emailNotificationFromNameField.appendChild( option );
1840
+
1841
+ nameFieldsAdded++;
1842
  }
1843
  });
1844
  }
1845
 
1846
+ if ( 0 === addressFieldsAdded ) {
1847
  var option = document.createElement( 'option' );
1848
  option.innerHTML = ccfSettings.noEmailFields;
1849
  emailNotificationFromField.appendChild( option );
1850
  emailNotificationFromField.disabled = true;
1851
  }
1852
+
1853
+ if ( 0 === nameFieldsAdded ) {
1854
+ var option = document.createElement( 'option' );
1855
+ option.innerHTML = ccfSettings.noNameFields;
1856
+ emailNotificationFromNameField.appendChild( option );
1857
+ emailNotificationFromNameField.disabled = true;
1858
+ }
1859
  },
1860
 
1861
  toggleNotificationFields: function() {
1871
 
1872
  var emailNotificationFromType = this.el.querySelectorAll( '.form-email-notification-from-type' )[0];
1873
 
1874
+ var emailNotificationFromName = this.el.querySelectorAll( '.email-notification-from-name' )[0];
1875
+
1876
+ var emailNotificationFromNameField = this.el.querySelectorAll( '.email-notification-from-name-field' )[0];
1877
+
1878
+ var emailNotificationFromNameType = this.el.querySelectorAll( '.form-email-notification-from-name-type' )[0];
1879
+
1880
  if ( parseInt( sendEmailNotifications ) ) {
1881
  for ( i = 0; i < emailNotificationSettings.length; i++ ) {
1882
  emailNotificationSettings[i].style.display = 'block';
1890
  } else if ( 'field' === emailNotificationFromType.value ) {
1891
  emailNotificationFromField.style.display = 'block';
1892
  }
1893
+
1894
+ emailNotificationFromName.style.display = 'none';
1895
+ emailNotificationFromNameField.style.display = 'none';
1896
+
1897
+ if ( 'custom' === emailNotificationFromNameType.value ) {
1898
+ emailNotificationFromName.style.display = 'block';
1899
+ } else if ( 'field' === emailNotificationFromNameType.value ) {
1900
+ emailNotificationFromNameField.style.display = 'block';
1901
+ }
1902
  } else {
1903
  for ( i = 0; i < emailNotificationSettings.length; i++ ) {
1904
  emailNotificationSettings[i].style.display = 'none';
1906
 
1907
  emailNotificationFromAddress.style.display = 'none';
1908
  emailNotificationFromField.style.display = 'none';
1909
+
1910
+ emailNotificationFromName.style.display = 'none';
1911
+ emailNotificationFromNameField.style.display = 'none';
1912
  }
1913
  },
1914
 
1935
  var emailNotificationFromField = this.el.querySelectorAll( '.form-email-notification-from-field' )[0].value;
1936
  this.model.set( 'emailNotificationFromField', emailNotificationFromField );
1937
 
1938
+ var emailNotificationFromNameType = this.el.querySelectorAll( '.form-email-notification-from-name-type' )[0].value;
1939
+ this.model.set( 'emailNotificationFromNameType', emailNotificationFromNameType );
1940
+
1941
+ var emailNotificationFromName = this.el.querySelectorAll( '.form-email-notification-from-name' )[0].value;
1942
+ this.model.set( 'emailNotificationFromName', emailNotificationFromName );
1943
+
1944
+ var emailNotificationFromNameField = this.el.querySelectorAll( '.form-email-notification-from-name-field' )[0].value;
1945
+ this.model.set( 'emailNotificationFromNameField', emailNotificationFromNameField );
1946
+
1947
  if ( typeof $promise !== 'undefined' && typeof $promise.promise !== 'undefined' ) {
1948
  $promise.resolve();
1949
  }
1959
  this.el.innerHTML = this.template( context );
1960
 
1961
  this.toggleNotificationFields();
1962
+ this.updateFromFieldField();
1963
 
1964
  wp.ccf.dispatcher.on( 'saveFormNotifications', this.save, this );
1965
  wp.ccf.dispatcher.on( 'mainViewChange', this.save, this );
1966
+ this.listenTo( fields, 'add', this.updateFromFieldField, this );
1967
+ this.listenTo( fields, 'remove', this.updateFromFieldField, this );
1968
 
1969
  return this;
1970
  }
build/js/form-manager.min.js CHANGED
@@ -1,2 +1,2 @@
1
- (function(e,t,i,l){"use strict";window.wp=window.wp||{},wp.ccf=wp.ccf||{},wp.ccf.utils=wp.ccf.utils||{},wp.ccf.utils.cleanDateFields=function(e){delete e.date,delete e.date_gmt,delete e.modified,delete e.modified_gmt,delete e.date_tz,delete e.modified_tz},wp.ccf.utils.template=i.memoize(function(e){var t={evaluate:/<#([\s\S]+?)#>/g,interpolate:/\{\{\{([\s\S]+?)\}\}\}/g,escape:/\{\{([^\}]+?)\}\}(?!\})/g};return i.template(document.getElementById(e).innerHTML,null,t)}),wp.ccf.utils.insertFormShortcode=function(e){var t=wp.ccf.forms.findWhere({ID:e.get("ID")});t||wp.ccf.forms.add(e);var i=tinymce.get(wpActiveEditor),l='[ccf_form id="'+e.get("ID")+'"]';i&&!i.isHidden()?tinymce.activeEditor.execCommand("mceInsertContent",!1,l):document.getElementById(wpActiveEditor).value+=l},wp.ccf.utils.getPrettyPostDate=function(e){return e=moment.utc(e),l.gmtOffset&&(e=e.utcOffset(60*parseInt(l.gmtOffset))),e.format("h:mm a M/D/YYYY")},wp.ccf.utils.wordChop=function(e,t){var i=e.substr(0,t);return i.substr(0,Math.min(i.length,i.lastIndexOf(" "))),i.length<e.length&&(i+="..."),i},wp.ccf.utils.isFieldDate=function(e){return e.date!==void 0||e.hour!==void 0&&e.minute!==void 0&&e["am-pm"]!==void 0?!0:!1},wp.ccf.utils.isFieldName=function(e){return e.name!==void 0||e.last!==void 0?!0:!1},wp.ccf.utils.isFieldEmailConfirm=function(e){return e.email!==void 0||e.confirm!==void 0?!0:!1},wp.ccf.utils.isFieldAddress=function(e){return e.street!==void 0&&e.city!==void 0&&e.zipcode!==void 0&&e.line_two!==void 0?!0:!1},wp.ccf.utils.isFieldFile=function(e){return e.id!==void 0&&e.url!==void 0&&e.file_name!==void 0?!0:!1},wp.ccf.utils.getPrettyFieldEmailConfirm=function(e){return e.email?e.email:e.confirm?e.confirm:"-"},wp.ccf.utils.getPrettyFieldDate=function(e){var t="",i="";if(e.hour&&e.minute&&e["am-pm"]&&(t+=e.hour+":"+e.minute+" "+e["am-pm"]),e.date&&(t+=" "+e.date),!t)return"-";var s=moment.utc(t);return s.isValid()?(e.hour&&e.minute&&e["am-pm"]&&(i+=s.format("h:mm a")),e.date&&(i&&(i+=" "),i+=s.format("M/D/YYYY")),i):l.invalidDate},wp.ccf.utils.getPrettyFieldName=function(e){var t=e.first;return t.length>0&&(t+=" "),e.last&&(t+=e.last),t||(t="-"),t},wp.ccf.utils.getPrettyFieldAddress=function(e){if(!e.street||!e.city)return"-";var t=e.street;return e.line_two&&(t+=" "+e.line_two),t+=", "+e.city,e.state&&(t+=", "+e.state),e.zipcode&&(t+=" "+e.zipcode),e.country&&(t+=" "+e.country),t}})(jQuery,Backbone,_,ccfSettings),function(e,t,i){"use strict";wp.ccf.mixins=wp.ccf.mixins||{},wp.ccf.mixins.subViewable=wp.ccf.mixins.subViewable||{subViews:{},initRenderSubViews:function(e,t,l){this.renderedSubViews||(this.renderedSubViews={});for(var s in this.subViews){var c={el:this.$el.find(".ccf-"+s),parent:this};l&&i.extend(c,l),this.renderedSubViews[s]&&this.renderedSubViews[s].destroy&&this.renderedSubViews[s].destroy(),(t||!this.renderedSubViews[s])&&(this.renderedSubViews[s]=new this.subViews[s](c)),this.renderedSubViews[s].render(),e&&(this.renderedSubViews[s].el.style.display="block")}return this},showView:function(e,t,i){if(this.renderedSubViews!==void 0&&this.renderedSubViews[e]!==void 0){var l=this.renderedSubViews[e];i||l.render(t),l.el.style.display="block",this.currentView=e;for(var s in this.subViews)s!==e&&(this.renderedSubViews[s].el.style.display="none")}}}}(jQuery,Backbone,_,ccfSettings),function(e,t,i,l,s){"use strict";wp.ccf.models=wp.ccf.models||{},wp.ccf.models.Fields=wp.ccf.models.Fields||{};var c=function(e,i,l){return"object"!=typeof i&&""===i&&(i=""),t.Model.prototype.set.call(this,e,i,l)},r=function(e,t,i){return i=i||{},i.emulateHTTP=!0,this.constructor.__super__.sync.call(this,e,t,i)},n=function(e){for(var t in this.attributes)if(-1===i.indexOf(e,t)){var l=this.get(t);"string"==typeof l&&""!==l&&(l=(l+"").replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#8220;/g,"”").replace(/&#8221;/g,"”").replace(/&#8216;/g,"‘").replace(/&#038;/g,"&").replace(/&#039;/g,"'"),this.set(t,l))}return this};wp.ccf.models.FieldChoice=wp.ccf.models.FieldChoice||t.Model.extend({defaults:{label:"",value:"",selected:!1},decode:function(){return n.call(this,[])},set:c}),wp.ccf.models.Form=wp.ccf.models.Form||wp.api.models.Post.extend({urlRoot:s.root+"/ccf/forms",set:c,sync:r,initialize:function(){this.on("sync",this.decode,this)},defaults:function(){var e={fields:new wp.ccf.collections.Fields,type:"ccf_form",status:"publish",description:"",buttonText:"Submit Form",completionActionType:"text",completionRedirectUrl:"",completionMessage:"",sendEmailNotifications:!1,emailNotificationAddresses:l.adminEmail,emailNotificationFromType:"default",emailNotificationFromAddress:"",emailNotificationFromField:"",pause:!1,pauseMessage:l.pauseMessage};return e=i.defaults(e,this.constructor.__super__.defaults),wp.ccf.utils.cleanDateFields(e),e},decode:function(){var e=i.keys(wp.api.models.Post.prototype.defaults);return e=i.without(e,"title"),n.call(this,e)},getFieldSlugs:function(e){var t=wp.ccf.currentForm.get("fields"),i=[];return t.each(function(t){e&&t.isImmutable||i.push(t.get("slug"))}),i},parse:function(e){var t=this;if(e.fields){var l=t.get("fields");if(l&&l.length>0){for(var s=0;e.fields.length>s;s++){var c=e.fields[s],r=l.findWhere({slug:c.slug});if(r){if(c.choices!==void 0){var n=t.get("choices");if(n&&n.length>0)for(var o=0;c.choices>o;o++){var a=n.at(o);a.set(c.choices[o]),a.decode()}delete e.fields[s].choices}r.set(c),r.decode()}}delete e.fields}else{var d=[];i.each(e.fields,function(e){var t=new wp.ccf.models.Fields[e.type](e);t.decode(),d.push(t)}),e.fields=new wp.ccf.collections.Fields(d,{formId:e.ID})}}return this.constructor.__super__.parse.call(this,e)},toJSON:function(){var e=this.constructor.__super__.toJSON.call(this);return e.fields&&(e.fields=e.fields.toJSON()),e.author&&(e.author=e.author.toJSON()),e}}),wp.ccf.models.Submission=wp.api.models.Submission||wp.api.models.Post.extend({idAttribute:"ID",defaults:{ID:null,data:{}},sync:r}),wp.ccf.models.Field=wp.api.models.Field||wp.api.models.Post.extend({idAttribute:"ID",defaults:{ID:null},set:c,required:function(){return["slug"]},decode:function(){return n.call(this,i.keys(wp.api.models.Post.prototype.defaults))},hasRequiredAttributes:function(){var e=this,t=!0;return i.each(this.required(),function(i){(e.get(i)===void 0||""===e.get(i))&&(t=!1)}),t},sync:r}),wp.ccf.models.StandardField=wp.ccf.models.StandardField||wp.ccf.models.Field.extend({idAttribute:"ID",defaults:function(){var e={label:"Field Label",value:"",placeholder:"",slug:"",type:"",required:!1,className:"",description:""};return i.defaults(e,this.constructor.__super__.defaults)}}),wp.ccf.models.Fields["single-line-text"]=wp.ccf.models.Fields["single-line-text"]||wp.ccf.models.StandardField.extend({defaults:function(){var e={type:"single-line-text"};return i.defaults(e,this.constructor.__super__.defaults())}}),wp.ccf.models.Fields.file=wp.ccf.models.Fields.file||wp.ccf.models.StandardField.extend({defaults:function(){var e={type:"file",fileExtensions:"",maxFileSize:l.maxFileSize};return i.defaults(e,this.constructor.__super__.defaults())}}),wp.ccf.models.Fields["paragraph-text"]=wp.ccf.models.Fields["paragraph-text"]||wp.ccf.models.StandardField.extend({defaults:function(){var e={type:"paragraph-text"};return i.defaults(e,this.constructor.__super__.defaults())}}),wp.ccf.models.Fields.hidden=wp.ccf.models.Fields.hidden||wp.ccf.models.StandardField.extend({defaults:function(){var e={type:"hidden"};return i.defaults(e,this.constructor.__super__.defaults())}}),wp.ccf.models.Fields.email=wp.ccf.models.Fields.email||wp.ccf.models.StandardField.extend({defaults:function(){var e={type:"email",emailConfirmation:!1};return i.defaults(e,this.constructor.__super__.defaults())}}),wp.ccf.models.Fields.website=wp.ccf.models.Fields.website||wp.ccf.models.StandardField.extend({defaults:function(){var e={type:"website",placeholder:"http://"};return i.defaults(e,this.constructor.__super__.defaults())}}),wp.ccf.models.Fields.phone=wp.ccf.models.Fields.phone||wp.ccf.models.StandardField.extend({defaults:function(){var e={type:"phone",phoneFormat:"us"};return i.defaults(e,this.constructor.__super__.defaults())}}),wp.ccf.models.Fields.date=wp.ccf.models.Fields.date||wp.ccf.models.StandardField.extend({defaults:function(){var e={type:"date",showDate:!0,showTime:!0};return i.defaults(e,this.constructor.__super__.defaults())}}),wp.ccf.models.Fields.name=wp.ccf.models.Fields.name||wp.ccf.models.StandardField.extend({defaults:function(){var e={type:"name"};return i.defaults(e,this.constructor.__super__.defaults())}}),wp.ccf.models.Fields.recaptcha=wp.ccf.models.Fields.recaptcha||wp.ccf.models.StandardField.extend({defaults:function(){var e={type:"recaptcha",siteKey:"",secretKey:""};return i.defaults(e,this.constructor.__super__.defaults())},required:function(){return["siteKey","secretKey"]},isImmutable:!0}),wp.ccf.models.Fields.address=wp.ccf.models.Fields.address||wp.ccf.models.StandardField.extend({defaults:function(){var e={type:"address",addressType:"us"};return i.defaults(e,this.constructor.__super__.defaults())}}),wp.ccf.models.Fields["section-header"]=wp.ccf.models.Fields["section-header"]||wp.ccf.models.Field.extend({defaults:function(){var e={type:"section-header",slug:"",heading:"",subheading:"",className:""};return i.defaults(e,this.constructor.__super__.defaults)},required:function(){return[]},isImmutable:!0}),wp.ccf.models.Fields.html=wp.ccf.models.Fields.html||wp.ccf.models.Field.extend({defaults:function(){var e={type:"html",slug:"",html:"",className:""};return i.defaults(e,this.constructor.__super__.defaults)},required:function(){return[]},isImmutable:!0}),wp.ccf.models.ChoiceableField=wp.ccf.models.ChoiceableField||wp.ccf.models.StandardField.extend({defaults:function(){var e={choices:new wp.ccf.collections.FieldChoices};return i.defaults(e,this.constructor.__super__.defaults())},initialize:function(e){if("object"==typeof e&&e.choices){var t=[];i.each(e.choices,function(e){var i=new wp.ccf.models.FieldChoice(e);i.decode(),t.push(i)}),this.set("choices",new wp.ccf.collections.FieldChoices(t))}}}),wp.ccf.models.Fields.radio=wp.ccf.models.Fields.radio||wp.ccf.models.ChoiceableField.extend({defaults:function(){var e={type:"radio"};return i.defaults(e,this.constructor.__super__.defaults())},initialize:function(){return this.constructor.__super__.initialize.apply(this,arguments)}}),wp.ccf.models.Fields.checkboxes=wp.ccf.models.Fields.checkboxes||wp.ccf.models.ChoiceableField.extend({defaults:function(){var e={type:"checkboxes"};return i.defaults(e,this.constructor.__super__.defaults())},initialize:function(){return this.constructor.__super__.initialize.apply(this,arguments)}}),wp.ccf.models.Fields.dropdown=wp.ccf.models.Fields.dropdown||wp.ccf.models.ChoiceableField.extend({defaults:function(){var e={type:"dropdown"};return i.defaults(e,this.constructor.__super__.defaults())},initialize:function(){return this.constructor.__super__.initialize.apply(this,arguments)}})}(jQuery,Backbone,_,ccfSettings,WP_API_Settings),function(e,t,i){"use strict";var l=function(e,t,i){return i=i||{},i.emulateHTTP=!0,this.constructor.__super__.sync.call(this,e,t,i)};wp.ccf.collections=wp.ccf.collections||{},wp.ccf.collections.Forms=wp.ccf.collections.Forms||wp.api.collections.Posts.extend({model:wp.ccf.models.Form,url:WP_API_Settings.root+"/ccf/forms",formsFetching:{},initialize:function(){this.constructor.__super__.initialize(),this.formsFetching={}},sync:l,remove:function(e,t){t=t||{};var l=this.constructor.__super__.remove.call(this,e,t);return t.destroy&&(e instanceof Array?i.each(e,function(e){e.destroy()}):e.destroy()),l}}),wp.ccf.collections.Fields=wp.ccf.collections.Fields||wp.api.collections.Posts.extend({model:wp.ccf.models.Field,url:function(){return WP_API_Settings.root+"/ccf/forms/"+this.formId+"/fields"},initialize:function(e,t){t&&t.formId&&(this.formId=t.formId)},sync:l}),wp.ccf.collections.Submissions=wp.ccf.collections.Submissions||wp.api.collections.Posts.extend({model:wp.ccf.models.Submission,url:function(){return WP_API_Settings.root+"/ccf/forms/"+this.formId+"/submissions"},initialize:function(e,t){this.constructor.__super__.initialize.apply(this,arguments),t&&t.formId&&(this.formId=t.formId)},sync:l}),wp.ccf.collections.FieldChoices=wp.ccf.collections.FieldChoices||t.Collection.extend({model:wp.ccf.models.FieldChoice})}(jQuery,Backbone,_,ccfSettings),function(e,t,i,l){"use strict";wp.ccf.views=wp.ccf.views||{},wp.ccf.views.Fields=wp.ccf.views.Fields||{},wp.ccf.views.FieldChoice=t.View.extend({template:wp.ccf.utils.template("ccf-field-choice-template"),className:"choice",events:{"click .add":"triggerAdd","click .delete":"triggerDelete","blur input":"saveChoice",saveChoice:"saveChoice",sorted:"triggerUpdateSort"},initialize:function(e){this.field=e.field},destroy:function(){wp.ccf.dispatcher.off("mainViewChange",this.saveChoice),this.unbind()},triggerUpdateSort:function(e,t){this.field.get("choices").remove(this.model,{silent:!0}),this.field.get("choices").add(this.model,{at:t,silent:!0})},saveChoice:function(){if(""!==this.el.innerHTML){var e=this.el.querySelectorAll(".choice-label")[0].value,t=this.el.querySelectorAll(".choice-value")[0].value;this.model.set("label",e),this.model.set("value",t);var i=this.el.querySelectorAll(".choice-selected")[0],l=i.checked?!0:!1;return this.model.set("selected",l),this}},render:function(){var e={};return this.model&&(e.choice=this.model.toJSON()),this.el.innerHTML=this.template(e),wp.ccf.dispatcher.on("mainViewChange",this.saveChoice,this),this},triggerAdd:function(){this.field.get("choices").add(new wp.ccf.models.FieldChoice)},triggerDelete:function(){var e=this.field.get("choices");if(e.length>1)e.remove(this.model),this.destroy(),this.remove();else{for(var t=this.el.querySelectorAll(".choice-label, .choice-value"),i=this.el.querySelectorAll(".choice-selected"),l=0;t.length>l;l++)t[l].value="";i[0].checked=!1}}}),wp.ccf.views.FieldBase=wp.ccf.views.FieldBase||t.View.extend({events:{"blur input":"saveField","blur input.field-slug":"checkSlug","blur textarea":"saveField","change select":"saveField",'change input[type="checkbox"]':"saveField"},checkSlug:function(){var e=this.el.querySelectorAll(".field-slug");if(e.length>0){var t=e[0],i=!1;t.parentNode.className=t.value&&!t.value.match(/^[a-zA-Z0-9\-_]+$/)?t.parentNode.className.replace(/ field-error/i,"")+" field-error":t.parentNode.className.replace(/ field-error/i,""),this.collection.length>0&&""!==t.value?(this.collection.each(function(e){e!==this.model&&t.value===e.get("slug")&&(i=!0)},this),t.parentNode.className=i?t.parentNode.className.replace(/ field-duplicate-slug/i,"")+" field-duplicate-slug":t.parentNode.className.replace(/ field-duplicate-slug/i,"")):t.parentNode.className=t.parentNode.className.replace(/ field-duplicate-slug/i,"")}},destroy:function(){this.unbind()},render:function(){return this.el.innerHTML=this.template({field:this.model.toJSON()}),this.checkSlug(),this}}),wp.ccf.views.Fields["single-line-text"]=wp.ccf.views.Fields["single-line-text"]||wp.ccf.views.FieldBase.extend({template:wp.ccf.utils.template("ccf-single-line-text-template"),initialize:function(){},saveField:function(){return""!==this.el.innerHTML?(this.model.set("slug",this.el.querySelectorAll(".field-slug")[0].value),this.model.set("label",this.el.querySelectorAll(".field-label")[0].value),this.model.set("description",this.el.querySelectorAll(".field-description")[0].value),this.model.set("value",this.el.querySelectorAll(".field-value")[0].value),this.model.set("placeholder",this.el.querySelectorAll(".field-placeholder")[0].value),this.model.set("className",this.el.querySelectorAll(".field-class-name")[0].value),this.model.set("required",1==this.el.querySelectorAll(".field-required")[0].value?!0:!1),this):void 0}}),wp.ccf.views.Fields.file=wp.ccf.views.Fields.file||wp.ccf.views.FieldBase.extend({template:wp.ccf.utils.template("ccf-file-template"),initialize:function(){},saveField:function(){return""!==this.el.innerHTML?(this.model.set("slug",this.el.querySelectorAll(".field-slug")[0].value),this.model.set("label",this.el.querySelectorAll(".field-label")[0].value),this.model.set("description",this.el.querySelectorAll(".field-description")[0].value),this.model.set("className",this.el.querySelectorAll(".field-class-name")[0].value),this.model.set("required",1==this.el.querySelectorAll(".field-required")[0].value?!0:!1),this.model.set("fileExtensions",this.el.querySelectorAll(".field-file-extensions")[0].value),this.model.set("maxFileSize",this.el.querySelectorAll(".field-max-file-size")[0].value),this):void 0}}),wp.ccf.views.Fields.recaptcha=wp.ccf.views.Fields.recaptcha||wp.ccf.views.FieldBase.extend({template:wp.ccf.utils.template("ccf-recaptcha-template"),initialize:function(){},saveField:function(){return""!==this.el.innerHTML?(this.model.set("label",this.el.querySelectorAll(".field-label")[0].value),this.model.set("description",this.el.querySelectorAll(".field-description")[0].value),this.model.set("siteKey",this.el.querySelectorAll(".field-site-key")[0].value),this.model.set("secretKey",this.el.querySelectorAll(".field-secret-key")[0].value),this.model.set("className",this.el.querySelectorAll(".field-class-name")[0].value),this):void 0}}),wp.ccf.views.Fields["section-header"]=wp.ccf.views.Fields["section-header"]||wp.ccf.views.FieldBase.extend({template:wp.ccf.utils.template("ccf-section-header-template"),initialize:function(){},saveField:function(){return""!==this.el.innerHTML?(this.model.set("heading",this.el.querySelectorAll(".field-heading")[0].value),this.model.set("subheading",this.el.querySelectorAll(".field-subheading")[0].value),this.model.set("className",this.el.querySelectorAll(".field-class-name")[0].value),this):void 0}}),wp.ccf.views.Fields.html=wp.ccf.views.Fields.html||wp.ccf.views.FieldBase.extend({template:wp.ccf.utils.template("ccf-html-template"),initialize:function(){},saveField:function(){return""!==this.el.innerHTML?(this.model.set("html",this.el.querySelectorAll(".field-html")[0].value),this.model.set("className",this.el.querySelectorAll(".field-class-name")[0].value),this):void 0}}),wp.ccf.views.Fields["paragraph-text"]=wp.ccf.views.Fields["paragraph-text"]||wp.ccf.views.FieldBase.extend({template:wp.ccf.utils.template("ccf-paragraph-text-template"),saveField:function(){return""!==this.el.innerHTML?(this.model.set("slug",this.el.querySelectorAll(".field-slug")[0].value),this.model.set("label",this.el.querySelectorAll(".field-label")[0].value),this.model.set("description",this.el.querySelectorAll(".field-description")[0].value),this.model.set("value",this.el.querySelectorAll(".field-value")[0].value),this.model.set("placeholder",this.el.querySelectorAll(".field-placeholder")[0].value),this.model.set("className",this.el.querySelectorAll(".field-class-name")[0].value),this.model.set("required",1==this.el.querySelectorAll(".field-required")[0].value?!0:!1),this):void 0}}),wp.ccf.views.Fields.hidden=wp.ccf.views.Fields.hidden||wp.ccf.views.FieldBase.extend({template:wp.ccf.utils.template("ccf-hidden-template"),saveField:function(){return""!==this.el.innerHTML?(this.model.set("slug",this.el.querySelectorAll(".field-slug")[0].value),this.model.set("value",this.el.querySelectorAll(".field-value")[0].value),this.model.set("className",this.el.querySelectorAll(".field-class-name")[0].value),this):void 0}}),wp.ccf.views.Fields.date=wp.ccf.views.Fields.date||wp.ccf.views.FieldBase.extend({template:wp.ccf.utils.template("ccf-date-template"),saveField:function(){if(""!==this.el.innerHTML){this.model.set("slug",this.el.querySelectorAll(".field-slug")[0].value),this.model.set("label",this.el.querySelectorAll(".field-label")[0].value),this.model.set("description",this.el.querySelectorAll(".field-description")[0].value);var e=this.el.querySelectorAll(".field-value");e.length>0&&this.model.set("value",e[0].value),this.model.set("className",this.el.querySelectorAll(".field-class-name")[0].value),this.model.set("showDate",this.el.querySelectorAll(".field-show-date")[0].checked?!0:!1);var t=this.model.get("showTime"),i=this.el.querySelectorAll(".field-show-time")[0].checked?!0:!1;return this.model.set("showTime",i),this.model.set("required",1==this.el.querySelectorAll(".field-required")[0].value?!0:!1),i!=t&&this.render(),this}}}),wp.ccf.views.Fields.name=wp.ccf.views.Fields.name||wp.ccf.views.FieldBase.extend({template:wp.ccf.utils.template("ccf-name-template"),saveField:function(){return""!==this.el.innerHTML?(this.model.set("slug",this.el.querySelectorAll(".field-slug")[0].value),this.model.set("label",this.el.querySelectorAll(".field-label")[0].value),this.model.set("description",this.el.querySelectorAll(".field-description")[0].value),this.model.set("className",this.el.querySelectorAll(".field-class-name")[0].value),this.model.set("required",1==this.el.querySelectorAll(".field-required")[0].value?!0:!1),this):void 0}}),wp.ccf.views.Fields.website=wp.ccf.views.Fields.website||wp.ccf.views.FieldBase.extend({template:wp.ccf.utils.template("ccf-website-template"),saveField:function(){return""!==this.el.innerHTML?(this.model.set("slug",this.el.querySelectorAll(".field-slug")[0].value),this.model.set("label",this.el.querySelectorAll(".field-label")[0].value),this.model.set("description",this.el.querySelectorAll(".field-description")[0].value),this.model.set("value",this.el.querySelectorAll(".field-value")[0].value),this.model.set("placeholder",this.el.querySelectorAll(".field-placeholder")[0].value),this.model.set("className",this.el.querySelectorAll(".field-class-name")[0].value),this.model.set("required",1==this.el.querySelectorAll(".field-required")[0].value?!0:!1),this):void 0}}),wp.ccf.views.Fields.phone=wp.ccf.views.Fields.phone||wp.ccf.views.FieldBase.extend({template:wp.ccf.utils.template("ccf-phone-template"),saveField:function(){return""!==this.el.innerHTML?(this.model.set("slug",this.el.querySelectorAll(".field-slug")[0].value),this.model.set("label",this.el.querySelectorAll(".field-label")[0].value),this.model.set("description",this.el.querySelectorAll(".field-description")[0].value),this.model.set("value",this.el.querySelectorAll(".field-value")[0].value),this.model.set("placeholder",this.el.querySelectorAll(".field-placeholder")[0].value),this.model.set("phoneFormat",this.el.querySelectorAll(".field-phone-format")[0].value),this.model.set("className",this.el.querySelectorAll(".field-class-name")[0].value),this.model.set("required",1==this.el.querySelectorAll(".field-required")[0].value?!0:!1),this):void 0}}),wp.ccf.views.Fields.address=wp.ccf.views.Fields.address||wp.ccf.views.FieldBase.extend({template:wp.ccf.utils.template("ccf-address-template"),saveField:function(){return""!==this.el.innerHTML?(this.model.set("slug",this.el.querySelectorAll(".field-slug")[0].value),this.model.set("label",this.el.querySelectorAll(".field-label")[0].value),this.model.set("description",this.el.querySelectorAll(".field-description")[0].value),this.model.set("addressType",this.el.querySelectorAll(".field-address-type")[0].value),this.model.set("className",this.el.querySelectorAll(".field-class-name")[0].value),this.model.set("required",1==this.el.querySelectorAll(".field-required")[0].value?!0:!1),this):void 0}}),wp.ccf.views.Fields.email=wp.ccf.views.Fields.email||wp.ccf.views.FieldBase.extend({template:wp.ccf.utils.template("ccf-email-template"),saveField:function(){if(""!==this.el.innerHTML){this.model.set("slug",this.el.querySelectorAll(".field-slug")[0].value),this.model.set("label",this.el.querySelectorAll(".field-label")[0].value),this.model.set("description",this.el.querySelectorAll(".field-description")[0].value);var e=this.el.querySelectorAll(".field-value");e.length&&this.model.set("value",e[0].value);var t=this.el.querySelectorAll(".field-placeholder");t.length&&this.model.set("placeholder",t[0].value),this.model.set("className",this.el.querySelectorAll(".field-class-name")[0].value),this.model.set("required",1==this.el.querySelectorAll(".field-required")[0].value?!0:!1);var i=1==this.el.querySelectorAll(".field-email-confirmation")[0].value?!0:!1,l=this.model.get("emailConfirmation");return this.model.set("emailConfirmation",i),l!=i&&this.render(),this}}}),wp.ccf.views.ChoiceableField=wp.ccf.views.ChoiceableField||wp.ccf.views.FieldBase.extend({template:wp.ccf.utils.template("ccf-dropdown-template"),initialize:function(){var e=this.model.get("choices");this.listenTo(e,"add",this.addChoice)},addChoice:function(e){var t=new wp.ccf.views.FieldChoice({model:e,field:this.model}).render(),i=this.el.querySelectorAll(".repeatable-choices")[0];i.appendChild(t.el)},saveField:function(){if(""!==this.el.innerHTML){this.model.set("slug",this.el.querySelectorAll(".field-slug")[0].value),this.model.set("label",this.el.querySelectorAll(".field-label")[0].value),this.model.set("description",this.el.querySelectorAll(".field-description")[0].value),this.model.set("className",this.el.querySelectorAll(".field-class-name")[0].value),this.model.set("required",1==this.el.querySelectorAll(".field-required")[0].value?!0:!1);var t=this.el.querySelectorAll(".repeatable-choices")[0].querySelectorAll(".choice");return i.each(t,function(t){e(t).trigger("saveChoice")}),this}},render:function(){var t=this;t.el.innerHTML=t.template({field:t.model.toJSON()}),t.checkSlug();var i=t.model.get("choices"),l=this.el.querySelectorAll(".repeatable-choices")[0];if(i.length>=1)i.each(function(e){var i=new wp.ccf.views.FieldChoice({model:e,field:t.model}).render();l.appendChild(i.el)});else{var s=new wp.ccf.models.FieldChoice;i.add(s)}return l=this.el.querySelectorAll(".repeatable-choices")[0],e(l).sortable({handle:".move",axis:"y",stop:function(e,t){t.item.trigger("sorted",t.item.index())}}),t}}),wp.ccf.views.Fields.dropdown=wp.ccf.views.Fields.dropdown||wp.ccf.views.ChoiceableField.extend({template:wp.ccf.utils.template("ccf-dropdown-template"),events:function(){return this.constructor.__super__.events}}),wp.ccf.views.Fields.radio=wp.ccf.views.Fields.radio||wp.ccf.views.ChoiceableField.extend({template:wp.ccf.utils.template("ccf-radio-template"),events:function(){return this.constructor.__super__.events}}),wp.ccf.views.Fields.checkboxes=wp.ccf.views.Fields.checkboxes||wp.ccf.views.ChoiceableField.extend({template:wp.ccf.utils.template("ccf-checkboxes-template"),events:function(){return this.constructor.__super__.events}}),wp.ccf.views.FieldSidebar=wp.ccf.views.FieldSidebar||t.View.extend({initialize:function(e){this.currentFieldView=null,this.form=e.form},save:function(e){this.currentFieldView&&""!==this.currentFieldView.el.innerHTML&&this.currentFieldView.saveField(),e&&e instanceof Object&&e.resolve()},fieldRemoved:function(){this.currentFieldView&&(this.form.get("fields").get(this.currentFieldView.model)||this.render())},destroy:function(){wp.ccf.dispatcher.off("saveField",this.save),wp.ccf.dispatcher.off("mainViewChange",this.save),this.unbind()},render:function(e){var t={};if(e){var i=e.get("type");this.currentFieldView&&(this.currentFieldView.saveField(),this.currentFieldView.destroy&&this.currentFieldView.destroy()),this.currentFieldView=new wp.ccf.views.Fields[i]({model:e,collection:this.form.get("fields")}),this.currentFieldView.render(),this.el.innerHTML="",this.el.appendChild(this.currentFieldView.el);var l=this.form.get("fields");this.listenTo(l,"remove",this.fieldRemoved)}else{var s=wp.ccf.utils.template("ccf-empty-field-template");this.el.innerHTML=s(t)}return wp.ccf.dispatcher.on("saveField",this.save,this),wp.ccf.dispatcher.on("mainViewChange",this.save,this),this}}),wp.ccf.views.FieldRowPlaceholder=wp.ccf.views.FieldRowPlaceholder||t.View.extend({template:wp.ccf.utils.template("ccf-field-row-template"),tagName:"div",className:"field",initialize:function(e){this.type=e.type},render:function(){return this.el.innerHTML=this.template({label:l.allLabels[this.type]}),this.el.setAttribute("data-field-type",this.type),this.el.className+=" "+this.type,this}}),wp.ccf.views.FieldRow=wp.ccf.views.FieldRow||t.View.extend({template:wp.ccf.utils.template("ccf-field-row-template"),tagName:"div",className:"field",events:{"click .delete":"triggerDelete","click h4":"triggerEdit",sorted:"triggerUpdateSort"},initialize:function(e){i.bindAll(this,"triggerDelete"),this.form=e.form,this.listenTo(this.model,"change",this.handleChange,this),this.listenTo(this.model,"requirementsNotMet",this.requirementsNotMet,this),this.listenTo(this.model,"requirementsMet",this.requirementsMet,this),this.listenTo(this.model,"duplicateSlug",this.duplicateSlug,this),this.model.attributes.choices&&this.listenTo(this.model.attributes.choices,"change",this.handleChange,this)},duplicateSlug:function(){this.requirementsMet(),this.el.className+=" field-duplicate-slug"},requirementsNotMet:function(){this.requirementsMet(),this.el.className+=" field-incomplete"},requirementsMet:function(){this.el.className=this.el.className.replace(/(field-incomplete|field-duplicate-slug)/i,"")},triggerUpdateSort:function(e,t){this.form.get("fields").remove(this.model),this.form.get("fields").add(this.model,{at:t})},handleChange:function(){this.render()},triggerDelete:function(e){e.stopPropagation(),this.form.get("fields").remove(this.model),this.undelegateEvents(),this.remove()},triggerEdit:function(){var e=this.el.parentNode.querySelectorAll(".ccf-editing");i.each(e,function(e){e.className=e.className.replace(/ccf-editing/i,"")}),this.el.className=this.el.className.replace(/ccf-editing/i,"")+" ccf-editing",wp.ccf.dispatcher.trigger("openEditField",this.model)},render:function(e){this.el.innerHTML=this.template({label:l.allLabels[this.model.get("type")]}),this.el.setAttribute("data-field-type",this.model.get("type"));var t=RegExp(" "+this.model.get("type"),"i");this.el.className=this.el.className.replace(t,"")+" "+this.model.get("type"),e&&(this.el.className=this.el.className.replace(/ instantiated/i,"")+" instantiated");var i=document.getElementById("ccf-"+this.model.get("type")+"-preview-template");if(i){var s=this.el.querySelectorAll(".preview")[0];s.style.display="block",s.innerHTML=wp.ccf.utils.template("ccf-"+this.model.get("type")+"-preview-template")({field:this.model.toJSON()})}return this}}),wp.ccf.views.FormSettings=wp.ccf.views.FormSettings||t.View.extend({template:wp.ccf.utils.template("ccf-form-settings-template"),events:{"blur input":"save","change select":"save","change select.form-completion-action-type":"toggleCompletionFields","change select.form-pause":"togglePauseFields","change select.form-send-email-notifications":"toggleNotificationFields"},initialize:function(e){this.model=e.form},destroy:function(){wp.ccf.dispatcher.off("saveFormSettings",this.save),wp.ccf.dispatcher.off("mainViewChange",this.save)},toggleCompletionFields:function(){var e=this.el.querySelectorAll(".form-completion-action-type")[0].value,t=this.el.querySelectorAll(".completion-message")[0],i=this.el.querySelectorAll(".completion-redirect-url")[0];"text"===e?(t.style.display="block",i.style.display="none"):(t.style.display="none",i.style.display="block")},togglePauseFields:function(){var e=this.el.querySelectorAll(".form-pause")[0].value,t=this.el.querySelectorAll(".pause-message")[0];t.style.display=parseInt(e)?"block":"none"},save:function(e){if(""!==this.el.innerHTML){var t=this.el.querySelectorAll(".form-title")[0].value;this.model.set("title",t);var i=this.el.querySelectorAll(".form-description")[0].value;this.model.set("description",i);var l=this.el.querySelectorAll(".form-button-text")[0].value;this.model.set("buttonText",l);var s=this.el.querySelectorAll(".form-pause")[0].value;this.model.set("pause",parseInt(s)?!0:!1);var c=this.el.querySelectorAll(".form-pause-message")[0].value;this.model.set("pauseMessage",c);var r=this.el.querySelectorAll(".form-completion-message")[0].value;this.model.set("completionMessage",r);var n=this.el.querySelectorAll(".form-completion-redirect-url")[0].value;this.model.set("completionRedirectUrl",n);var o=this.el.querySelectorAll(".form-completion-action-type")[0].value;
2
- this.model.set("completionActionType",o),e!==void 0&&e.promise!==void 0&&e.resolve()}},render:function(){var e={form:this.model.toJSON()};return this.el.innerHTML=this.template(e),this.toggleCompletionFields(),this.togglePauseFields(),wp.ccf.dispatcher.on("saveFormSettings",this.save,this),wp.ccf.dispatcher.on("mainViewChange",this.save,this),this}}),wp.ccf.views.FormNotifications=wp.ccf.views.FormNotifications||t.View.extend({template:wp.ccf.utils.template("ccf-form-notifications-template"),events:{"blur input":"save","change select":"save","change select.form-send-email-notifications":"toggleNotificationFields","change select.form-email-notification-from-type":"toggleNotificationFields"},initialize:function(e){this.model=e.form},destroy:function(){wp.ccf.dispatcher.off("saveFormNotifications",this.save),wp.ccf.dispatcher.off("mainViewChange",this.save),this.undelegateEvents(),this.unbind()},updateFromAddressFieldField:function(){var e=this.el.querySelectorAll(".form-email-notification-from-field")[0];e.innerHTML="",e.disabled=!1;var t=this.model.get("fields"),i=0,s=this.model.get("emailNotificationFromField");if(t.length>=1&&t.each(function(t){if("email"===t.get("type")){var l=document.createElement("option");l.innerHTML=t.get("slug"),l.value=t.get("slug"),t.get("slug")===s&&(l.selected=!0),e.appendChild(l),i++}}),0===i){var c=document.createElement("option");c.innerHTML=l.noEmailFields,e.appendChild(c),e.disabled=!0}},toggleNotificationFields:function(){var e,t=this.el.querySelectorAll(".form-send-email-notifications")[0].value,i=this.el.querySelectorAll(".email-notification-setting"),l=this.el.querySelectorAll(".email-notification-from-address")[0],s=this.el.querySelectorAll(".email-notification-from-field")[0],c=this.el.querySelectorAll(".form-email-notification-from-type")[0];if(parseInt(t)){for(e=0;i.length>e;e++)i[e].style.display="block";l.style.display="none",s.style.display="none","custom"===c.value?l.style.display="block":"field"===c.value&&(s.style.display="block")}else{for(e=0;i.length>e;e++)i[e].style.display="none";l.style.display="none",s.style.display="none"}},save:function(e){if(""!==this.el.innerHTML){var t=this.el.querySelectorAll(".form-send-email-notifications")[0].value;this.model.set("sendEmailNotifications",parseInt(t)?!0:!1);var i=this.el.querySelectorAll(".form-email-notification-addresses")[0].value;this.model.set("emailNotificationAddresses",i);var l=this.el.querySelectorAll(".form-email-notification-from-type")[0].value;this.model.set("emailNotificationFromType",l);var s=this.el.querySelectorAll(".form-email-notification-from-address")[0].value;this.model.set("emailNotificationFromAddress",s);var c=this.el.querySelectorAll(".form-email-notification-from-field")[0].value;this.model.set("emailNotificationFromField",c),e!==void 0&&e.promise!==void 0&&e.resolve()}},render:function(){var e={form:this.model.toJSON()},t=this.model.get("fields");return this.el.innerHTML=this.template(e),this.toggleNotificationFields(),this.updateFromAddressFieldField(),wp.ccf.dispatcher.on("saveFormNotifications",this.save,this),wp.ccf.dispatcher.on("mainViewChange",this.save,this),this.listenTo(t,"add",this.updateFromAddressFieldField,this),this.listenTo(t,"remove",this.updateFromAddressFieldField,this),this}}),wp.ccf.views.FormPane=wp.ccf.views.FormPane||t.View.extend(i.defaults({template:wp.ccf.utils.template("ccf-form-pane-template"),subViews:{"field-sidebar":wp.ccf.views.FieldSidebar,"form-settings":wp.ccf.views.FormSettings,"form-notifications":wp.ccf.views.FormNotifications},events:{"click .save-button":"sync","click h2":"accordionClick","click .insert-form-button":"insertForm"},initialize:function(){wp.ccf.dispatcher.on("openEditField",this.openEditField,this)},insertForm:function(){wp.ccf.utils.insertFormShortcode(this.model),wp.ccf.toggle()},accordionClick:function(t){var l=e(t.currentTarget).parents(".accordion-container")[0],s=l.querySelectorAll(".accordion-section");t.currentTarget.parentNode.className.match(/expanded/i)?t.currentTarget.parentNode.className=t.currentTarget.parentNode.className.replace(/expanded/i,""):t.currentTarget.parentNode.className+=" expanded",i.each(s,function(e){e!=t.currentTarget.parentNode&&e.className.match(/expanded/i)&&(e.className=e.className.replace(/expanded/i,""))})},openEditField:function(e){this.renderedSubViews["field-sidebar"].render(e).el.style.display="block"},disable:function(){this.el.querySelectorAll(".save-button")[0].setAttribute("disabled","disabled"),this.el.querySelectorAll(".disabled-overlay")[0].style.display="block"},enable:function(){this.el.querySelectorAll(".save-button")[0].removeAttribute("disabled"),this.el.querySelectorAll(".disabled-overlay")[0].style.display="none"},sync:function(){var t=this,i=e(this.el.querySelectorAll(".spinner")[0]);i.fadeIn(),t.disable();var s=e.Deferred(),c=e.Deferred(),r=e.Deferred();wp.ccf.dispatcher.trigger("saveFormSettings",s),wp.ccf.dispatcher.trigger("saveFormNotifications",r),wp.ccf.dispatcher.trigger("saveField",c),e.when(s,c,r).then(function(){var e=t.model.get("fields"),s=!0,c={};e.each(function(e){var t=e.get("slug");e.hasRequiredAttributes()?t&&!t.match(/^[a-zA-Z0-9\-_]+$/)?(s=!1,e.trigger("requirementsNotMet")):c[e.get("slug")]!==void 0?(s=!1,e.trigger("duplicateSlug"),c[e.get("slug")].trigger("duplicateSlug")):e.trigger("requirementsMet"):(s=!1,e.trigger("requirementsNotMet")),e.get("slug")&&(c[e.get("slug")]=e)}),s?t.model.save({},{context:"edit"}).error(function(){var e="sync";wp.ccf.errorModal.render(e).show()}).done(function(){l.single&&!l.postId&&(window.location=l.adminUrl+"post.php?post="+t.model.get("ID")+"&action=edit#ccf-form/"+t.model.get("ID"))}).complete(function(){i.fadeOut(),t.enable(),wp.ccf.dispatcher.trigger("saveFormComplete",t.model)}):(t.enable(),i.fadeOut())})},enableDisableInsert:function(){var e=this.el.querySelectorAll(".insert-form-button")[0];this.model.get("ID")?e.removeAttribute("disabled"):e.setAttribute("disabled","disabled")},getNextFieldOrd:function(){var e=this.model.get("fields"),t=e.length+1;return e.each(function(e){var i=e.get("slug"),l=/\-([0-9]+)$/g,s=l.exec(i);if(s&&s[1]){var c=parseInt(s[1]);c>=t&&(t=c+1)}}),t},render:function(t){var s=this;s.model=t?t:new wp.ccf.models.Form,this.listenTo(s.model,"change",this.enableDisableInsert,this);var c={labels:l.fieldLabels,form:s.model.toJSON()};window.form=s.model,s.el.innerHTML=this.template(c);var r=s.el.querySelectorAll(".fields")[0];i.each(l.fieldLabels,function(e,t){r.appendChild(new wp.ccf.views.FieldRowPlaceholder({type:t}).render().el)});var n=s.el.querySelectorAll(".structure-fields")[0];i.each(l.structureFieldLabels,function(e,t){n.appendChild(new wp.ccf.views.FieldRowPlaceholder({type:t}).render().el)});var o=s.el.querySelectorAll(".special-fields")[0];i.each(l.specialFieldLabels,function(e,t){o.appendChild(new wp.ccf.views.FieldRowPlaceholder({type:t}).render().el)});var a=s.model.get("fields"),d=s.el.querySelectorAll(".form-content")[0],u=e(d);return e(s.el.querySelectorAll(".left-sidebar")[0].querySelectorAll(".field")).draggable({cursor:"move",distance:2,zIndex:160001,scroll:!1,containment:"document",appendTo:".ccf-main-modal",snap:!1,connectToSortable:".form-content",helper:function(t){var i=e(t.currentTarget),l=e('<div class="field" data-field-type="'+i.attr("data-field-type")+'"><h4>'+i.find(".label").html()+"</h4></div>");return l.css({width:u.width(),opacity:".75",height:i.height()})}}),a.length>=1&&(d.innerHTML="",a.each(function(e){var t=new wp.ccf.views.FieldRow({model:e,form:s.model}).render(!0).el;d.appendChild(t)})),e(d).sortable({axis:"y",distance:2,handle:"h4",placeholder:"field-placeholder",stop:function(e,t){if(!t.item.hasClass("instantiated")){var i=t.item.attr("data-field-type"),l={};wp.ccf.models.Fields[i].prototype.defaults().slug!==void 0&&(l.slug=i+"-"+s.getNextFieldOrd());var c=new wp.ccf.models.Fields[i](l),r=s.model.get("fields");r.add(c),new wp.ccf.views.FieldRow({model:c,el:t.item,form:s.model}).render(!0),t.item.attr("style","")}t.item.trigger("sorted",t.item.index())}}),s.initRenderSubViews(!0,!0,{form:s.model}),s.enableDisableInsert(),s}},wp.ccf.mixins.subViewable)),wp.ccf.views.ExistingFormTableRow=wp.ccf.views.ExistingFormTableRow||t.View.extend({tagName:"tr",template:wp.ccf.utils.template("ccf-existing-form-table-row-template"),events:{"click .edit":"triggerMainViewChange","click .delete":"triggerDelete","click .insert-form-button":"insertForm"},initialize:function(e){this.parent=e.parent},insertForm:function(){wp.ccf.utils.insertFormShortcode(this.model),wp.ccf.toggle()},triggerMainViewChange:function(){wp.ccf.switchToForm(this.model)},triggerDelete:function(){var e,t=this,i=t.parent.collection.state.currentPage;t.model.destroy().done(function(){e=i,e===t.parent.collection.state.totalPages&&e-1===(t.parent.collection.state.totalObjects-1)/l.postsPerPage&&e--,t.parent.showPage(e).done(function(){t.parent.renderPagination()})})},render:function(){return this.$el.html(this.template({form:this.model.toJSON(),utils:{getPrettyPostDate:wp.ccf.utils.getPrettyPostDate}})),this}}),wp.ccf.views.EmptyFormTableRow=wp.ccf.views.EmptyFormTableRow||t.View.extend({tagName:"tr",template:wp.ccf.utils.template("ccf-empty-form-table-row-template"),render:function(){return this.$el.html(this.template()),this}}),wp.ccf.views.ExistingFormTable=wp.ccf.views.ExistingFormTable||t.View.extend({template:wp.ccf.utils.template("ccf-existing-form-table-template"),initialize:function(){this.parent=arguments.parent,this.collection=new wp.ccf.collections.Forms,wp.ccf.dispatcher.on("changeFormTablePage",this.showPage,this),wp.ccf.dispatcher.on("saveFormComplete",this.render,this)},showPage:function(e){var t=this,i=this.collection.fetch({data:{page:e}});return i.error(function(){var e="sync";wp.ccf.errorModal.render(e).show()}),i.done(function(){var e=t.el.querySelectorAll(".rows")[0],i=document.createElement("tbody");i.className="rows",t.collection.length>=1?t.collection.each(function(e){var l=new wp.ccf.views.ExistingFormTableRow({model:e,parent:t}).render();i.appendChild(l.el)},t):i.appendChild((new wp.ccf.views.EmptyFormTableRow).render().el),e.parentNode.replaceChild(i,e)}),i},renderPagination:function(){var e=this.el.querySelectorAll(".ccf-pagination")[0];e.innerHTML="",this.collection.state.totalPages>1&&e.appendChild(new wp.ccf.views.Pagination({parent:this}).render(this.collection.state.totalPages,this.collection.state.currentPage).el)},render:function(){var e=this;return this.el.innerHTML=this.template(),this.el.querySelectorAll(".ccf-pagination")[0],this.showPage(1).done(function(){e.renderPagination()}),this}}),wp.ccf.views.ExistingFormPane=wp.ccf.views.ExistingFormPane||t.View.extend(i.defaults({template:wp.ccf.utils.template("ccf-existing-form-pane-template"),subViews:{"existing-form-table":wp.ccf.views.ExistingFormTable},render:function(){return this.rendered?this:(this.rendered=!0,this.el.innerHTML=this.template(),this.initRenderSubViews(!0),this)}},wp.ccf.mixins.subViewable)),wp.ccf.views.MainModal=wp.ccf.views.MainModal||t.View.extend(i.defaults({tagName:"div",className:"ccf-main-modal",template:wp.ccf.utils.template("ccf-main-modal-template"),events:{"click .close-icon":"hide","click .main-menu a":"menuClick"},subViews:{"form-pane":wp.ccf.views.FormPane},initialize:function(){l.single||(this.subViews["existing-form-pane"]=wp.ccf.views.ExistingFormPane),wp.ccf.dispatcher.on("mainViewChange",this.toggleView,this)},toggleView:function(e){this.showView(e,wp.ccf.currentForm);var t=e;"form-pane"===e&&wp.ccf.currentForm&&(t="existing-form-pane");var l=this.el.querySelectorAll(".menu-item");i.each(l,function(e){var i=e.getAttribute("data-view");e.className=i===t?e.className.replace("selected","")+" selected":e.className.replace("selected","")})},menuClick:function(e){var t=e.target.getAttribute("data-view");"form-pane"===t&&(wp.ccf.currentForm=null),wp.ccf.dispatcher.trigger("mainViewChange",t),e.preventDefault()},render:function(e){return e=e||!1,this.overlay(),this.el.innerHTML=this.template({single:e}),this.initRenderSubViews(),this.showView("form-pane",wp.ccf.currentForm,!0),this},overlay:function(){return this.overlayEl===void 0&&(this.overlayEl=document.createElement("div"),this.overlayEl.className="ccf-main-modal-overlay",document.body.appendChild(this.overlayEl)),this.overlayEl},remove:function(){return document.body.removeChild(this.overlay()),this},show:function(){e(this.overlay()).show(),this.$el.show()},hide:function(){e(this.overlay()).hide(),this.$el.hide()}},wp.ccf.mixins.subViewable)),wp.ccf.views.SubmissionRow=wp.ccf.views.SubmissionRow||t.View.extend({tagName:"tr",template:wp.ccf.utils.template("ccf-submission-row-template"),events:{"click .view":"view","click .delete":"delete"},initialize:function(e){this.parent=e.parent},"delete":function(){var e,t=this,i=t.parent.collection.state.currentPage;t.model.destroy().done(function(){e=i,e===t.parent.collection.state.totalPages&&e-1===(t.parent.collection.state.totalObjects-1)/l.postsPerPage&&e--,t.parent.showPage(e).done(function(){t.parent.renderPagination()})})},view:function(e){var t=e.currentTarget.getAttribute("data-submission-id"),i=e.currentTarget.getAttribute("data-submission-date");tb_show(l.thickboxTitle+" - "+wp.ccf.utils.getPrettyPostDate(i),"#TB_inline?height=500&amp;width=700&amp;inlineId=ccf-submission-content-"+parseInt(t),null)},render:function(){return this.$el.html(this.template({submission:this.model.toJSON(),currentColumns:this.parent.columns,columns:wp.ccf.currentForm.getFieldSlugs(!0),utils:{getPrettyPostDate:wp.ccf.utils.getPrettyPostDate,wordChop:wp.ccf.utils.wordChop,isFieldDate:wp.ccf.utils.isFieldDate,isFieldName:wp.ccf.utils.isFieldName,isFieldFile:wp.ccf.utils.isFieldFile,isFieldAddress:wp.ccf.utils.isFieldAddress,isFieldEmailConfirm:wp.ccf.utils.isFieldEmailConfirm,getPrettyFieldDate:wp.ccf.utils.getPrettyFieldDate,getPrettyFieldAddress:wp.ccf.utils.getPrettyFieldAddress,getPrettyFieldName:wp.ccf.utils.getPrettyFieldName,getPrettyFieldEmailConfirm:wp.ccf.utils.getPrettyFieldEmailConfirm}})),this}}),wp.ccf.views.SubmissionsTable=wp.ccf.views.SubmissionsTable||t.View.extend({template:wp.ccf.utils.template("ccf-submission-table-template"),events:{"click .prev:not(.disabled)":"previousPage","click .next:not(.disabled)":"nextPage","click .first:not(.disabled)":"firstPage","click .last:not(.disabled)":"lastPage"},initialize:function(){this.collection=new wp.ccf.collections.Submissions({},{formId:l.postId}),wp.ccf.dispatcher.on("submissionTableRebuild",this.render,this)},showPage:function(e){var t=this,i=this.collection.fetch({data:{page:e}});return i.error(function(){var e="sync";wp.ccf.errorModal.render(e).show()}),i.done(function(){var e=t.el.querySelectorAll(".submission-rows")[0],i=document.createElement("tbody");i.className="submission-rows",t.collection.length>=1?t.collection.each(function(e){var l=new wp.ccf.views.SubmissionRow({model:e,parent:t}).render();i.appendChild(l.el)},t):i.appendChild(new wp.ccf.views.EmptySubmissionTableRow({parent:t}).render(wp.ccf.currentForm.getFieldSlugs(!0).concat("date")).el),e.parentNode.replaceChild(i,e)}),i},renderPagination:function(){var e=this.el.querySelectorAll(".ccf-pagination")[0];e.innerHTML="",this.collection.state.totalPages>1&&e.appendChild(new wp.ccf.views.Pagination({parent:this}).render(this.collection.state.totalPages,this.collection.state.currentPage).el)},render:function(e){var t=this;return t.columns=e?e:wp.ccf.currentForm.getFieldSlugs(!0).slice(0,4).concat("date"),1>t.columns.length?t.el.innerHTML="":(t.el.innerHTML=t.template({columns:t.columns}),t.el.querySelectorAll(".ccf-pagination")[0],t.showPage(1).done(function(){t.renderPagination()})),t}}),wp.ccf.views.ErrorModal=wp.ccf.views.ErrorModal||t.View.extend({template:wp.ccf.utils.template("ccf-error-modal-template"),tagName:"div",className:"ccf-error-modal",events:{"click .close":"hide"},hide:function(){this.el.className=this.el.className.replace(" show","")},show:function(){this.el.className=this.el.className.replace(" show","")+" show"},toggle:function(){this.el.className.match(" show")?this.hide():this.show()},render:function(e){var t={messageType:""};return e&&(t.messageType=e),this.el.innerHTML=this.template(t),this}}),wp.ccf.views.Pagination=wp.ccf.views.Pagination||t.View.extend({template:wp.ccf.utils.template("ccf-pagination-template"),events:{"click .prev:not(.disabled)":"previousPage","click .next:not(.disabled)":"nextPage","click .first:not(.disabled)":"firstPage","click .last:not(.disabled)":"lastPage"},initialize:function(e){this.parent=e.parent},previousPage:function(){var e=this;e.parent.showPage(e.parent.collection.state.currentPage-1).done(function(){e.render()})},nextPage:function(){var e=this;e.parent.showPage(e.parent.collection.state.currentPage+1).done(function(){e.render()})},firstPage:function(){var e=this;e.parent.showPage(1).done(function(){e.render()})},lastPage:function(){var e=this;e.parent.showPage(e.parent.collection.state.totalPages).done(function(){e.render()})},render:function(){return this.el.innerHTML=this.template({totalPages:this.parent.collection.state.totalPages,currentPage:this.parent.collection.state.currentPage,totalObjects:this.parent.collection.state.totalObjects}),this}}),wp.ccf.views.EmptySubmissionTableRow=wp.ccf.views.EmptySubmissionTableRow||t.View.extend({tagName:"tr",template:wp.ccf.utils.template("ccf-no-submissions-row-template"),initialize:function(e){this.parent=e.parent},render:function(){return this.el.innerHTML=this.template({columns:this.parent.columns}),this}}),wp.ccf.views.SubmissionColumnController=wp.ccf.views.SubmissionColumnController||t.View.extend({template:wp.ccf.utils.template("ccf-submissions-controller-template"),events:{"click input[type=checkbox]":"triggerTableRebuild"},render:function(){this.el.innerHTML=this.template({columns:wp.ccf.currentForm.getFieldSlugs(!0).concat("date")})},triggerTableRebuild:function(){var e=[],t=document.querySelectorAll(".submission-column-checkbox");if(t.length>=1)for(var i=0;t.length>i;i++)t[i].checked&&e.push(t[i].value);wp.ccf.dispatcher.trigger("submissionTableRebuild",e)}})}(jQuery,Backbone,_,ccfSettings),function(e,t){"use strict";wp.ccf.router=wp.ccf.router||t.Router.extend({routes:{"ccf-form":"open","ccf-form/:formId":"open"},open:function(e){wp.ccf.show(e)}})}(jQuery,Backbone,_,ccfSettings),function(e,t,i,l){"use strict";wp.ccf=i.defaults(wp.ccf,{forms:new wp.ccf.collections.Forms,currentForm:null,errorModal:null,_currentFormDeferred:null,dispatcher:{},show:function(e){return this.switchToForm(e),this.instance.show(),this.instance},initErrorModal:function(){this.errorModal=(new wp.ccf.views.ErrorModal).render();var e=document.getElementsByTagName("body")[0];e.appendChild(this.errorModal.el)},switchToForm:function(e){var t=this;if(+e===parseInt(e)){var i=parseInt(e);if(e=t.forms.findWhere({ID:parseInt(i)}),!e){var l;return t.forms.formsFetching[i]!==void 0?(l=t.forms.formsFetching[i],e=null):(e=new wp.ccf.models.Form({ID:i}),l=e.fetch(),t.forms.formsFetching[i]=l),l.done(function(){e?(delete t.forms.formsFetching[i],t.forms.add(e)):e=t.forms.findWhere({ID:i}),t.currentForm=e,wp.ccf.dispatcher.trigger("mainViewChange","form-pane")}),l}t.currentForm=e,wp.ccf.dispatcher.trigger("mainViewChange","form-pane")}else t.currentForm=e,wp.ccf.dispatcher.trigger("mainViewChange","form-pane");return!0},hide:function(){return this.instance.hide(),this.instance},toggle:function(e){return this.switchToForm(e),this.instance.$el.is(":visible")?this.instance.hide():this.instance.show(),this.instance},createSubmissionsTable:function(e){var t=document.querySelectorAll(".ccf-submission-column-controller"),i=new wp.ccf.views.SubmissionsTable({el:e});i.render(),t&&new wp.ccf.views.SubmissionColumnController({el:t}).render()},_setupMainModal:function(e){return this.instance=(new wp.ccf.views.MainModal).render(e),document.getElementsByTagName("body")[0].appendChild(this.instance.el),t.history.start(),this.instance},createManager:function(){var s=this,c=document.querySelectorAll(".ccf-open-form-manager")[0];if(!c)return!1;i.extend(this.dispatcher,t.Events),new wp.ccf.router,s.initErrorModal();var r=!1;if(l.single)if(r=!0,l.postId){var n=parseInt(l.postId);if(s.forms.formsFetching[n]===void 0){var o=new wp.ccf.models.Form({ID:n}),a=o.fetch();s.forms.formsFetching[n]=a,s._currentFormDeferred=a,a.done(function(){delete s.forms.formsFetching[n],s.forms.add(o),s.currentForm=o})}else s._currentFormDeferred=s.forms.formsFetching[n],s._currentFormDeferred.done(function(){s.currentForm=s.forms.findWhere({ID:n})});e.when(s._currentFormDeferred).then(function(){s._setupMainModal(!0),c.style.display="inline-block";var e=document.getElementById("ccf-submissions");if(e){var t=e.querySelectorAll(".inside")[0],i=document.createElement("div");i.className="ccf-submission-icon",i.setAttribute("data-icon","");var r=document.createElement("a");r.href="?action=edit&post="+parseInt(l.postId)+"&download_submissions=1&download_submissions_nonce="+l.downloadSubmissionsNonce,r.className="ccf-submission-icon",r.setAttribute("data-icon","");var n=document.getElementById("show-settings-link");i.onclick=function(){n.click()},e.insertBefore(i,e.firstChild.nextSibling.nextSibling),e.insertBefore(r,e.firstChild.nextSibling.nextSibling),wp.ccf.createSubmissionsTable(t)}})}else s._setupMainModal(!0),c.style.display="inline-block";else s._setupMainModal();var d=function(e){e=e||window.event;var t=e.currentTarget?e.currentTarget:e.srcElement,i=t.getAttribute("data-form-id");wp.ccf.toggle(i)};c.addEventListener?c.addEventListener("click",d,!1):c.attachEvent("onclick",d)}}),wp.ccf.createManager()}(jQuery,Backbone,_,ccfSettings);
1
+ (function(e,t,i,l){"use strict";window.wp=window.wp||{},wp.ccf=wp.ccf||{},wp.ccf.utils=wp.ccf.utils||{},wp.ccf.utils.cleanDateFields=function(e){delete e.date,delete e.date_gmt,delete e.modified,delete e.modified_gmt,delete e.date_tz,delete e.modified_tz},wp.ccf.utils.template=i.memoize(function(e){var t={evaluate:/<#([\s\S]+?)#>/g,interpolate:/\{\{\{([\s\S]+?)\}\}\}/g,escape:/\{\{([^\}]+?)\}\}(?!\})/g};return i.template(document.getElementById(e).innerHTML,null,t)}),wp.ccf.utils.insertFormShortcode=function(e){var t=wp.ccf.forms.findWhere({ID:e.get("ID")});t||wp.ccf.forms.add(e);var i=tinymce.get(wpActiveEditor),l='[ccf_form id="'+e.get("ID")+'"]';i&&!i.isHidden()?tinymce.activeEditor.execCommand("mceInsertContent",!1,l):document.getElementById(wpActiveEditor).value+=l},wp.ccf.utils.getPrettyPostDate=function(e){return e=moment.utc(e),l.gmtOffset&&(e=e.utcOffset(60*parseInt(l.gmtOffset))),e.format("h:mm a M/D/YYYY")},wp.ccf.utils.wordChop=function(e,t){var i=e.substr(0,t);return i.substr(0,Math.min(i.length,i.lastIndexOf(" "))),i.length<e.length&&(i+="..."),i},wp.ccf.utils.isFieldDate=function(e){return e.date!==void 0||e.hour!==void 0&&e.minute!==void 0&&e["am-pm"]!==void 0?!0:!1},wp.ccf.utils.isFieldName=function(e){return e.name!==void 0||e.last!==void 0?!0:!1},wp.ccf.utils.isFieldEmailConfirm=function(e){return e.email!==void 0||e.confirm!==void 0?!0:!1},wp.ccf.utils.isFieldAddress=function(e){return e.street!==void 0&&e.city!==void 0&&e.zipcode!==void 0&&e.line_two!==void 0?!0:!1},wp.ccf.utils.isFieldFile=function(e){return e.id!==void 0&&e.url!==void 0&&e.file_name!==void 0?!0:!1},wp.ccf.utils.getPrettyFieldEmailConfirm=function(e){return e.email?e.email:e.confirm?e.confirm:"-"},wp.ccf.utils.getPrettyFieldDate=function(e){var t="",i="";if(e.hour&&e.minute&&e["am-pm"]&&(t+=e.hour+":"+e.minute+" "+e["am-pm"]),e.date&&(t+=" "+e.date),!t)return"-";var s=moment.utc(t);return s.isValid()?(e.hour&&e.minute&&e["am-pm"]&&(i+=s.format("h:mm a")),e.date&&(i&&(i+=" "),i+=s.format("M/D/YYYY")),i):l.invalidDate},wp.ccf.utils.getPrettyFieldName=function(e){var t=e.first;return t.length>0&&(t+=" "),e.last&&(t+=e.last),t||(t="-"),t},wp.ccf.utils.getPrettyFieldAddress=function(e){if(!e.street||!e.city)return"-";var t=e.street;return e.line_two&&(t+=" "+e.line_two),t+=", "+e.city,e.state&&(t+=", "+e.state),e.zipcode&&(t+=" "+e.zipcode),e.country&&(t+=" "+e.country),t}})(jQuery,Backbone,_,ccfSettings),function(e,t,i){"use strict";wp.ccf.mixins=wp.ccf.mixins||{},wp.ccf.mixins.subViewable=wp.ccf.mixins.subViewable||{subViews:{},initRenderSubViews:function(e,t,l){this.renderedSubViews||(this.renderedSubViews={});for(var s in this.subViews){var c={el:this.$el.find(".ccf-"+s),parent:this};l&&i.extend(c,l),this.renderedSubViews[s]&&this.renderedSubViews[s].destroy&&this.renderedSubViews[s].destroy(),(t||!this.renderedSubViews[s])&&(this.renderedSubViews[s]=new this.subViews[s](c)),this.renderedSubViews[s].render(),e&&(this.renderedSubViews[s].el.style.display="block")}return this},showView:function(e,t,i){if(this.renderedSubViews!==void 0&&this.renderedSubViews[e]!==void 0){var l=this.renderedSubViews[e];i||l.render(t),l.el.style.display="block",this.currentView=e;for(var s in this.subViews)s!==e&&(this.renderedSubViews[s].el.style.display="none")}}}}(jQuery,Backbone,_,ccfSettings),function(e,t,i,l,s){"use strict";wp.ccf.models=wp.ccf.models||{},wp.ccf.models.Fields=wp.ccf.models.Fields||{};var c=function(e,i,l){return"object"!=typeof i&&""===i&&(i=""),t.Model.prototype.set.call(this,e,i,l)},r=function(e,t,i){return i=i||{},i.emulateHTTP=!0,this.constructor.__super__.sync.call(this,e,t,i)},o=function(e){for(var t in this.attributes)if(-1===i.indexOf(e,t)){var l=this.get(t);"string"==typeof l&&""!==l&&(l=(l+"").replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#8220;/g,"”").replace(/&#8221;/g,"”").replace(/&#8216;/g,"‘").replace(/&#038;/g,"&").replace(/&#039;/g,"'"),this.set(t,l))}return this};wp.ccf.models.FieldChoice=wp.ccf.models.FieldChoice||t.Model.extend({defaults:{label:"",value:"",selected:!1},decode:function(){return o.call(this,[])},set:c}),wp.ccf.models.Form=wp.ccf.models.Form||wp.api.models.Post.extend({urlRoot:s.root+"/ccf/forms",set:c,sync:r,initialize:function(){this.on("sync",this.decode,this)},defaults:function(){var e={fields:new wp.ccf.collections.Fields,type:"ccf_form",status:"publish",description:"",buttonText:"Submit Form",completionActionType:"text",completionRedirectUrl:"",completionMessage:"",sendEmailNotifications:!1,emailNotificationAddresses:l.adminEmail,emailNotificationFromType:"default",emailNotificationFromAddress:"",emailNotificationFromField:"",emailNotificationFromNameType:"custom",emailNotificationFromName:"WordPress",emailNotificationFromNameField:"",pause:!1,pauseMessage:l.pauseMessage};return e=i.defaults(e,this.constructor.__super__.defaults),wp.ccf.utils.cleanDateFields(e),e},decode:function(){var e=i.keys(wp.api.models.Post.prototype.defaults);return e=i.without(e,"title"),o.call(this,e)},getFieldSlugs:function(e){var t=wp.ccf.currentForm.get("fields"),i=[];return t.each(function(t){e&&t.isImmutable||i.push(t.get("slug"))}),i},parse:function(e){var t=this;if(e.fields){var l=t.get("fields");if(l&&l.length>0){for(var s=0;e.fields.length>s;s++){var c=e.fields[s],r=l.findWhere({slug:c.slug});if(r){if(c.choices!==void 0){var o=t.get("choices");if(o&&o.length>0)for(var n=0;c.choices>n;n++){var a=o.at(n);a.set(c.choices[n]),a.decode()}delete e.fields[s].choices}r.set(c),r.decode()}}delete e.fields}else{var d=[];i.each(e.fields,function(e){var t=new wp.ccf.models.Fields[e.type](e);t.decode(),d.push(t)}),e.fields=new wp.ccf.collections.Fields(d,{formId:e.ID})}}return this.constructor.__super__.parse.call(this,e)},toJSON:function(){var e=this.constructor.__super__.toJSON.call(this);return e.fields&&(e.fields=e.fields.toJSON()),e.author&&(e.author=e.author.toJSON()),e}}),wp.ccf.models.Submission=wp.api.models.Submission||wp.api.models.Post.extend({idAttribute:"ID",defaults:{ID:null,data:{}},sync:r}),wp.ccf.models.Field=wp.api.models.Field||wp.api.models.Post.extend({idAttribute:"ID",defaults:{ID:null},set:c,required:function(){return["slug"]},decode:function(){return o.call(this,i.keys(wp.api.models.Post.prototype.defaults))},hasRequiredAttributes:function(){var e=this,t=!0;return i.each(this.required(),function(i){(e.get(i)===void 0||""===e.get(i))&&(t=!1)}),t},sync:r}),wp.ccf.models.StandardField=wp.ccf.models.StandardField||wp.ccf.models.Field.extend({idAttribute:"ID",defaults:function(){var e={label:"Field Label",value:"",placeholder:"",slug:"",type:"",required:!1,className:"",description:""};return i.defaults(e,this.constructor.__super__.defaults)}}),wp.ccf.models.Fields["single-line-text"]=wp.ccf.models.Fields["single-line-text"]||wp.ccf.models.StandardField.extend({defaults:function(){var e={type:"single-line-text"};return i.defaults(e,this.constructor.__super__.defaults())}}),wp.ccf.models.Fields.file=wp.ccf.models.Fields.file||wp.ccf.models.StandardField.extend({defaults:function(){var e={type:"file",fileExtensions:"",maxFileSize:l.maxFileSize};return i.defaults(e,this.constructor.__super__.defaults())}}),wp.ccf.models.Fields["paragraph-text"]=wp.ccf.models.Fields["paragraph-text"]||wp.ccf.models.StandardField.extend({defaults:function(){var e={type:"paragraph-text"};return i.defaults(e,this.constructor.__super__.defaults())}}),wp.ccf.models.Fields.hidden=wp.ccf.models.Fields.hidden||wp.ccf.models.StandardField.extend({defaults:function(){var e={type:"hidden"};return i.defaults(e,this.constructor.__super__.defaults())}}),wp.ccf.models.Fields.email=wp.ccf.models.Fields.email||wp.ccf.models.StandardField.extend({defaults:function(){var e={type:"email",emailConfirmation:!1};return i.defaults(e,this.constructor.__super__.defaults())}}),wp.ccf.models.Fields.website=wp.ccf.models.Fields.website||wp.ccf.models.StandardField.extend({defaults:function(){var e={type:"website",placeholder:"http://"};return i.defaults(e,this.constructor.__super__.defaults())}}),wp.ccf.models.Fields.phone=wp.ccf.models.Fields.phone||wp.ccf.models.StandardField.extend({defaults:function(){var e={type:"phone",phoneFormat:"us"};return i.defaults(e,this.constructor.__super__.defaults())}}),wp.ccf.models.Fields.date=wp.ccf.models.Fields.date||wp.ccf.models.StandardField.extend({defaults:function(){var e={type:"date",showDate:!0,showTime:!0};return i.defaults(e,this.constructor.__super__.defaults())}}),wp.ccf.models.Fields.name=wp.ccf.models.Fields.name||wp.ccf.models.StandardField.extend({defaults:function(){var e={type:"name"};return i.defaults(e,this.constructor.__super__.defaults())}}),wp.ccf.models.Fields.recaptcha=wp.ccf.models.Fields.recaptcha||wp.ccf.models.StandardField.extend({defaults:function(){var e={type:"recaptcha",siteKey:"",secretKey:""};return i.defaults(e,this.constructor.__super__.defaults())},required:function(){return["siteKey","secretKey"]},isImmutable:!0}),wp.ccf.models.Fields.address=wp.ccf.models.Fields.address||wp.ccf.models.StandardField.extend({defaults:function(){var e={type:"address",addressType:"us"};return i.defaults(e,this.constructor.__super__.defaults())}}),wp.ccf.models.Fields["section-header"]=wp.ccf.models.Fields["section-header"]||wp.ccf.models.Field.extend({defaults:function(){var e={type:"section-header",slug:"",heading:"",subheading:"",className:""};return i.defaults(e,this.constructor.__super__.defaults)},required:function(){return[]},isImmutable:!0}),wp.ccf.models.Fields.html=wp.ccf.models.Fields.html||wp.ccf.models.Field.extend({defaults:function(){var e={type:"html",slug:"",html:"",className:""};return i.defaults(e,this.constructor.__super__.defaults)},required:function(){return[]},isImmutable:!0}),wp.ccf.models.ChoiceableField=wp.ccf.models.ChoiceableField||wp.ccf.models.StandardField.extend({defaults:function(){var e={choices:new wp.ccf.collections.FieldChoices};return i.defaults(e,this.constructor.__super__.defaults())},initialize:function(e){if("object"==typeof e&&e.choices){var t=[];i.each(e.choices,function(e){var i=new wp.ccf.models.FieldChoice(e);i.decode(),t.push(i)}),this.set("choices",new wp.ccf.collections.FieldChoices(t))}}}),wp.ccf.models.Fields.radio=wp.ccf.models.Fields.radio||wp.ccf.models.ChoiceableField.extend({defaults:function(){var e={type:"radio"};return i.defaults(e,this.constructor.__super__.defaults())},initialize:function(){return this.constructor.__super__.initialize.apply(this,arguments)}}),wp.ccf.models.Fields.checkboxes=wp.ccf.models.Fields.checkboxes||wp.ccf.models.ChoiceableField.extend({defaults:function(){var e={type:"checkboxes"};return i.defaults(e,this.constructor.__super__.defaults())},initialize:function(){return this.constructor.__super__.initialize.apply(this,arguments)}}),wp.ccf.models.Fields.dropdown=wp.ccf.models.Fields.dropdown||wp.ccf.models.ChoiceableField.extend({defaults:function(){var e={type:"dropdown"};return i.defaults(e,this.constructor.__super__.defaults())},initialize:function(){return this.constructor.__super__.initialize.apply(this,arguments)}})}(jQuery,Backbone,_,ccfSettings,WP_API_Settings),function(e,t,i){"use strict";var l=function(e,t,i){return i=i||{},i.emulateHTTP=!0,this.constructor.__super__.sync.call(this,e,t,i)};wp.ccf.collections=wp.ccf.collections||{},wp.ccf.collections.Forms=wp.ccf.collections.Forms||wp.api.collections.Posts.extend({model:wp.ccf.models.Form,url:WP_API_Settings.root+"/ccf/forms",formsFetching:{},initialize:function(){this.constructor.__super__.initialize(),this.formsFetching={}},sync:l,remove:function(e,t){t=t||{};var l=this.constructor.__super__.remove.call(this,e,t);return t.destroy&&(e instanceof Array?i.each(e,function(e){e.destroy()}):e.destroy()),l}}),wp.ccf.collections.Fields=wp.ccf.collections.Fields||wp.api.collections.Posts.extend({model:wp.ccf.models.Field,url:function(){return WP_API_Settings.root+"/ccf/forms/"+this.formId+"/fields"},initialize:function(e,t){t&&t.formId&&(this.formId=t.formId)},sync:l}),wp.ccf.collections.Submissions=wp.ccf.collections.Submissions||wp.api.collections.Posts.extend({model:wp.ccf.models.Submission,url:function(){return WP_API_Settings.root+"/ccf/forms/"+this.formId+"/submissions"},initialize:function(e,t){this.constructor.__super__.initialize.apply(this,arguments),t&&t.formId&&(this.formId=t.formId)},sync:l}),wp.ccf.collections.FieldChoices=wp.ccf.collections.FieldChoices||t.Collection.extend({model:wp.ccf.models.FieldChoice})}(jQuery,Backbone,_,ccfSettings),function(e,t,i,l){"use strict";wp.ccf.views=wp.ccf.views||{},wp.ccf.views.Fields=wp.ccf.views.Fields||{},wp.ccf.views.FieldChoice=t.View.extend({template:wp.ccf.utils.template("ccf-field-choice-template"),className:"choice",events:{"click .add":"triggerAdd","click .delete":"triggerDelete","blur input":"saveChoice",saveChoice:"saveChoice",sorted:"triggerUpdateSort"},initialize:function(e){this.field=e.field},destroy:function(){wp.ccf.dispatcher.off("mainViewChange",this.saveChoice),this.unbind()},triggerUpdateSort:function(e,t){this.field.get("choices").remove(this.model,{silent:!0}),this.field.get("choices").add(this.model,{at:t,silent:!0})},saveChoice:function(){if(""!==this.el.innerHTML){var e=this.el.querySelectorAll(".choice-label")[0].value,t=this.el.querySelectorAll(".choice-value")[0].value;this.model.set("label",e),this.model.set("value",t);var i=this.el.querySelectorAll(".choice-selected")[0],l=i.checked?!0:!1;return this.model.set("selected",l),this}},render:function(){var e={};return this.model&&(e.choice=this.model.toJSON()),this.el.innerHTML=this.template(e),wp.ccf.dispatcher.on("mainViewChange",this.saveChoice,this),this},triggerAdd:function(){this.field.get("choices").add(new wp.ccf.models.FieldChoice)},triggerDelete:function(){var e=this.field.get("choices");if(e.length>1)e.remove(this.model),this.destroy(),this.remove();else{for(var t=this.el.querySelectorAll(".choice-label, .choice-value"),i=this.el.querySelectorAll(".choice-selected"),l=0;t.length>l;l++)t[l].value="";i[0].checked=!1}}}),wp.ccf.views.FieldBase=wp.ccf.views.FieldBase||t.View.extend({events:{"blur input":"saveField","blur input.field-slug":"checkSlug","blur textarea":"saveField","change select":"saveField",'change input[type="checkbox"]':"saveField"},checkSlug:function(){var e=this.el.querySelectorAll(".field-slug");if(e.length>0){var t=e[0],i=!1;t.parentNode.className=t.value&&!t.value.match(/^[a-zA-Z0-9\-_]+$/)?t.parentNode.className.replace(/ field-error/i,"")+" field-error":t.parentNode.className.replace(/ field-error/i,""),this.collection.length>0&&""!==t.value?(this.collection.each(function(e){e!==this.model&&t.value===e.get("slug")&&(i=!0)},this),t.parentNode.className=i?t.parentNode.className.replace(/ field-duplicate-slug/i,"")+" field-duplicate-slug":t.parentNode.className.replace(/ field-duplicate-slug/i,"")):t.parentNode.className=t.parentNode.className.replace(/ field-duplicate-slug/i,"")}},destroy:function(){this.unbind()},render:function(){return this.el.innerHTML=this.template({field:this.model.toJSON()}),this.checkSlug(),this}}),wp.ccf.views.Fields["single-line-text"]=wp.ccf.views.Fields["single-line-text"]||wp.ccf.views.FieldBase.extend({template:wp.ccf.utils.template("ccf-single-line-text-template"),initialize:function(){},saveField:function(){return""!==this.el.innerHTML?(this.model.set("slug",this.el.querySelectorAll(".field-slug")[0].value),this.model.set("label",this.el.querySelectorAll(".field-label")[0].value),this.model.set("description",this.el.querySelectorAll(".field-description")[0].value),this.model.set("value",this.el.querySelectorAll(".field-value")[0].value),this.model.set("placeholder",this.el.querySelectorAll(".field-placeholder")[0].value),this.model.set("className",this.el.querySelectorAll(".field-class-name")[0].value),this.model.set("required",1==this.el.querySelectorAll(".field-required")[0].value?!0:!1),this):void 0}}),wp.ccf.views.Fields.file=wp.ccf.views.Fields.file||wp.ccf.views.FieldBase.extend({template:wp.ccf.utils.template("ccf-file-template"),initialize:function(){},saveField:function(){return""!==this.el.innerHTML?(this.model.set("slug",this.el.querySelectorAll(".field-slug")[0].value),this.model.set("label",this.el.querySelectorAll(".field-label")[0].value),this.model.set("description",this.el.querySelectorAll(".field-description")[0].value),this.model.set("className",this.el.querySelectorAll(".field-class-name")[0].value),this.model.set("required",1==this.el.querySelectorAll(".field-required")[0].value?!0:!1),this.model.set("fileExtensions",this.el.querySelectorAll(".field-file-extensions")[0].value),this.model.set("maxFileSize",this.el.querySelectorAll(".field-max-file-size")[0].value),this):void 0}}),wp.ccf.views.Fields.recaptcha=wp.ccf.views.Fields.recaptcha||wp.ccf.views.FieldBase.extend({template:wp.ccf.utils.template("ccf-recaptcha-template"),initialize:function(){},saveField:function(){return""!==this.el.innerHTML?(this.model.set("label",this.el.querySelectorAll(".field-label")[0].value),this.model.set("description",this.el.querySelectorAll(".field-description")[0].value),this.model.set("siteKey",this.el.querySelectorAll(".field-site-key")[0].value),this.model.set("secretKey",this.el.querySelectorAll(".field-secret-key")[0].value),this.model.set("className",this.el.querySelectorAll(".field-class-name")[0].value),this):void 0}}),wp.ccf.views.Fields["section-header"]=wp.ccf.views.Fields["section-header"]||wp.ccf.views.FieldBase.extend({template:wp.ccf.utils.template("ccf-section-header-template"),initialize:function(){},saveField:function(){return""!==this.el.innerHTML?(this.model.set("heading",this.el.querySelectorAll(".field-heading")[0].value),this.model.set("subheading",this.el.querySelectorAll(".field-subheading")[0].value),this.model.set("className",this.el.querySelectorAll(".field-class-name")[0].value),this):void 0}}),wp.ccf.views.Fields.html=wp.ccf.views.Fields.html||wp.ccf.views.FieldBase.extend({template:wp.ccf.utils.template("ccf-html-template"),initialize:function(){},saveField:function(){return""!==this.el.innerHTML?(this.model.set("html",this.el.querySelectorAll(".field-html")[0].value),this.model.set("className",this.el.querySelectorAll(".field-class-name")[0].value),this):void 0}}),wp.ccf.views.Fields["paragraph-text"]=wp.ccf.views.Fields["paragraph-text"]||wp.ccf.views.FieldBase.extend({template:wp.ccf.utils.template("ccf-paragraph-text-template"),saveField:function(){return""!==this.el.innerHTML?(this.model.set("slug",this.el.querySelectorAll(".field-slug")[0].value),this.model.set("label",this.el.querySelectorAll(".field-label")[0].value),this.model.set("description",this.el.querySelectorAll(".field-description")[0].value),this.model.set("value",this.el.querySelectorAll(".field-value")[0].value),this.model.set("placeholder",this.el.querySelectorAll(".field-placeholder")[0].value),this.model.set("className",this.el.querySelectorAll(".field-class-name")[0].value),this.model.set("required",1==this.el.querySelectorAll(".field-required")[0].value?!0:!1),this):void 0}}),wp.ccf.views.Fields.hidden=wp.ccf.views.Fields.hidden||wp.ccf.views.FieldBase.extend({template:wp.ccf.utils.template("ccf-hidden-template"),saveField:function(){return""!==this.el.innerHTML?(this.model.set("slug",this.el.querySelectorAll(".field-slug")[0].value),this.model.set("value",this.el.querySelectorAll(".field-value")[0].value),this.model.set("className",this.el.querySelectorAll(".field-class-name")[0].value),this):void 0}}),wp.ccf.views.Fields.date=wp.ccf.views.Fields.date||wp.ccf.views.FieldBase.extend({template:wp.ccf.utils.template("ccf-date-template"),saveField:function(){if(""!==this.el.innerHTML){this.model.set("slug",this.el.querySelectorAll(".field-slug")[0].value),this.model.set("label",this.el.querySelectorAll(".field-label")[0].value),this.model.set("description",this.el.querySelectorAll(".field-description")[0].value);var e=this.el.querySelectorAll(".field-value");e.length>0&&this.model.set("value",e[0].value),this.model.set("className",this.el.querySelectorAll(".field-class-name")[0].value),this.model.set("showDate",this.el.querySelectorAll(".field-show-date")[0].checked?!0:!1);var t=this.model.get("showTime"),i=this.el.querySelectorAll(".field-show-time")[0].checked?!0:!1;return this.model.set("showTime",i),this.model.set("required",1==this.el.querySelectorAll(".field-required")[0].value?!0:!1),i!=t&&this.render(),this}}}),wp.ccf.views.Fields.name=wp.ccf.views.Fields.name||wp.ccf.views.FieldBase.extend({template:wp.ccf.utils.template("ccf-name-template"),saveField:function(){return""!==this.el.innerHTML?(this.model.set("slug",this.el.querySelectorAll(".field-slug")[0].value),this.model.set("label",this.el.querySelectorAll(".field-label")[0].value),this.model.set("description",this.el.querySelectorAll(".field-description")[0].value),this.model.set("className",this.el.querySelectorAll(".field-class-name")[0].value),this.model.set("required",1==this.el.querySelectorAll(".field-required")[0].value?!0:!1),this):void 0}}),wp.ccf.views.Fields.website=wp.ccf.views.Fields.website||wp.ccf.views.FieldBase.extend({template:wp.ccf.utils.template("ccf-website-template"),saveField:function(){return""!==this.el.innerHTML?(this.model.set("slug",this.el.querySelectorAll(".field-slug")[0].value),this.model.set("label",this.el.querySelectorAll(".field-label")[0].value),this.model.set("description",this.el.querySelectorAll(".field-description")[0].value),this.model.set("value",this.el.querySelectorAll(".field-value")[0].value),this.model.set("placeholder",this.el.querySelectorAll(".field-placeholder")[0].value),this.model.set("className",this.el.querySelectorAll(".field-class-name")[0].value),this.model.set("required",1==this.el.querySelectorAll(".field-required")[0].value?!0:!1),this):void 0}}),wp.ccf.views.Fields.phone=wp.ccf.views.Fields.phone||wp.ccf.views.FieldBase.extend({template:wp.ccf.utils.template("ccf-phone-template"),saveField:function(){return""!==this.el.innerHTML?(this.model.set("slug",this.el.querySelectorAll(".field-slug")[0].value),this.model.set("label",this.el.querySelectorAll(".field-label")[0].value),this.model.set("description",this.el.querySelectorAll(".field-description")[0].value),this.model.set("value",this.el.querySelectorAll(".field-value")[0].value),this.model.set("placeholder",this.el.querySelectorAll(".field-placeholder")[0].value),this.model.set("phoneFormat",this.el.querySelectorAll(".field-phone-format")[0].value),this.model.set("className",this.el.querySelectorAll(".field-class-name")[0].value),this.model.set("required",1==this.el.querySelectorAll(".field-required")[0].value?!0:!1),this):void 0}}),wp.ccf.views.Fields.address=wp.ccf.views.Fields.address||wp.ccf.views.FieldBase.extend({template:wp.ccf.utils.template("ccf-address-template"),saveField:function(){return""!==this.el.innerHTML?(this.model.set("slug",this.el.querySelectorAll(".field-slug")[0].value),this.model.set("label",this.el.querySelectorAll(".field-label")[0].value),this.model.set("description",this.el.querySelectorAll(".field-description")[0].value),this.model.set("addressType",this.el.querySelectorAll(".field-address-type")[0].value),this.model.set("className",this.el.querySelectorAll(".field-class-name")[0].value),this.model.set("required",1==this.el.querySelectorAll(".field-required")[0].value?!0:!1),this):void 0}}),wp.ccf.views.Fields.email=wp.ccf.views.Fields.email||wp.ccf.views.FieldBase.extend({template:wp.ccf.utils.template("ccf-email-template"),saveField:function(){if(""!==this.el.innerHTML){this.model.set("slug",this.el.querySelectorAll(".field-slug")[0].value),this.model.set("label",this.el.querySelectorAll(".field-label")[0].value),this.model.set("description",this.el.querySelectorAll(".field-description")[0].value);var e=this.el.querySelectorAll(".field-value");e.length&&this.model.set("value",e[0].value);var t=this.el.querySelectorAll(".field-placeholder");t.length&&this.model.set("placeholder",t[0].value),this.model.set("className",this.el.querySelectorAll(".field-class-name")[0].value),this.model.set("required",1==this.el.querySelectorAll(".field-required")[0].value?!0:!1);var i=1==this.el.querySelectorAll(".field-email-confirmation")[0].value?!0:!1,l=this.model.get("emailConfirmation");return this.model.set("emailConfirmation",i),l!=i&&this.render(),this}}}),wp.ccf.views.ChoiceableField=wp.ccf.views.ChoiceableField||wp.ccf.views.FieldBase.extend({template:wp.ccf.utils.template("ccf-dropdown-template"),initialize:function(){var e=this.model.get("choices");this.listenTo(e,"add",this.addChoice)},addChoice:function(e){var t=new wp.ccf.views.FieldChoice({model:e,field:this.model}).render(),i=this.el.querySelectorAll(".repeatable-choices")[0];i.appendChild(t.el)},saveField:function(){if(""!==this.el.innerHTML){this.model.set("slug",this.el.querySelectorAll(".field-slug")[0].value),this.model.set("label",this.el.querySelectorAll(".field-label")[0].value),this.model.set("description",this.el.querySelectorAll(".field-description")[0].value),this.model.set("className",this.el.querySelectorAll(".field-class-name")[0].value),this.model.set("required",1==this.el.querySelectorAll(".field-required")[0].value?!0:!1);var t=this.el.querySelectorAll(".repeatable-choices")[0].querySelectorAll(".choice");return i.each(t,function(t){e(t).trigger("saveChoice")}),this}},render:function(){var t=this;t.el.innerHTML=t.template({field:t.model.toJSON()}),t.checkSlug();var i=t.model.get("choices"),l=this.el.querySelectorAll(".repeatable-choices")[0];if(i.length>=1)i.each(function(e){var i=new wp.ccf.views.FieldChoice({model:e,field:t.model}).render();l.appendChild(i.el)});else{var s=new wp.ccf.models.FieldChoice;i.add(s)}return l=this.el.querySelectorAll(".repeatable-choices")[0],e(l).sortable({handle:".move",axis:"y",stop:function(e,t){t.item.trigger("sorted",t.item.index())}}),t}}),wp.ccf.views.Fields.dropdown=wp.ccf.views.Fields.dropdown||wp.ccf.views.ChoiceableField.extend({template:wp.ccf.utils.template("ccf-dropdown-template"),events:function(){return this.constructor.__super__.events}}),wp.ccf.views.Fields.radio=wp.ccf.views.Fields.radio||wp.ccf.views.ChoiceableField.extend({template:wp.ccf.utils.template("ccf-radio-template"),events:function(){return this.constructor.__super__.events}}),wp.ccf.views.Fields.checkboxes=wp.ccf.views.Fields.checkboxes||wp.ccf.views.ChoiceableField.extend({template:wp.ccf.utils.template("ccf-checkboxes-template"),events:function(){return this.constructor.__super__.events}}),wp.ccf.views.FieldSidebar=wp.ccf.views.FieldSidebar||t.View.extend({initialize:function(e){this.currentFieldView=null,this.form=e.form},save:function(e){this.currentFieldView&&""!==this.currentFieldView.el.innerHTML&&this.currentFieldView.saveField(),e&&e instanceof Object&&e.resolve()},fieldRemoved:function(){this.currentFieldView&&(this.form.get("fields").get(this.currentFieldView.model)||this.render())},destroy:function(){wp.ccf.dispatcher.off("saveField",this.save),wp.ccf.dispatcher.off("mainViewChange",this.save),this.unbind()},render:function(e){var t={};if(e){var i=e.get("type");this.currentFieldView&&(this.currentFieldView.saveField(),this.currentFieldView.destroy&&this.currentFieldView.destroy()),this.currentFieldView=new wp.ccf.views.Fields[i]({model:e,collection:this.form.get("fields")}),this.currentFieldView.render(),this.el.innerHTML="",this.el.appendChild(this.currentFieldView.el);var l=this.form.get("fields");this.listenTo(l,"remove",this.fieldRemoved)}else{var s=wp.ccf.utils.template("ccf-empty-field-template");this.el.innerHTML=s(t)}return wp.ccf.dispatcher.on("saveField",this.save,this),wp.ccf.dispatcher.on("mainViewChange",this.save,this),this}}),wp.ccf.views.FieldRowPlaceholder=wp.ccf.views.FieldRowPlaceholder||t.View.extend({template:wp.ccf.utils.template("ccf-field-row-template"),tagName:"div",className:"field",initialize:function(e){this.type=e.type},render:function(){return this.el.innerHTML=this.template({label:l.allLabels[this.type]}),this.el.setAttribute("data-field-type",this.type),this.el.className+=" "+this.type,this}}),wp.ccf.views.FieldRow=wp.ccf.views.FieldRow||t.View.extend({template:wp.ccf.utils.template("ccf-field-row-template"),tagName:"div",className:"field",events:{"click .delete":"triggerDelete","click h4":"triggerEdit",sorted:"triggerUpdateSort"},initialize:function(e){i.bindAll(this,"triggerDelete"),this.form=e.form,this.listenTo(this.model,"change",this.handleChange,this),this.listenTo(this.model,"requirementsNotMet",this.requirementsNotMet,this),this.listenTo(this.model,"requirementsMet",this.requirementsMet,this),this.listenTo(this.model,"duplicateSlug",this.duplicateSlug,this),this.model.attributes.choices&&this.listenTo(this.model.attributes.choices,"change",this.handleChange,this)},duplicateSlug:function(){this.requirementsMet(),this.el.className+=" field-duplicate-slug"},requirementsNotMet:function(){this.requirementsMet(),this.el.className+=" field-incomplete"},requirementsMet:function(){this.el.className=this.el.className.replace(/(field-incomplete|field-duplicate-slug)/i,"")},triggerUpdateSort:function(e,t){this.form.get("fields").remove(this.model),this.form.get("fields").add(this.model,{at:t})},handleChange:function(){this.render()},triggerDelete:function(e){e.stopPropagation(),this.form.get("fields").remove(this.model),this.undelegateEvents(),this.remove()},triggerEdit:function(){var e=this.el.parentNode.querySelectorAll(".ccf-editing");i.each(e,function(e){e.className=e.className.replace(/ccf-editing/i,"")}),this.el.className=this.el.className.replace(/ccf-editing/i,"")+" ccf-editing",wp.ccf.dispatcher.trigger("openEditField",this.model)},render:function(e){this.el.innerHTML=this.template({label:l.allLabels[this.model.get("type")]}),this.el.setAttribute("data-field-type",this.model.get("type"));var t=RegExp(" "+this.model.get("type"),"i");this.el.className=this.el.className.replace(t,"")+" "+this.model.get("type"),e&&(this.el.className=this.el.className.replace(/ instantiated/i,"")+" instantiated");var i=document.getElementById("ccf-"+this.model.get("type")+"-preview-template");if(i){var s=this.el.querySelectorAll(".preview")[0];s.style.display="block",s.innerHTML=wp.ccf.utils.template("ccf-"+this.model.get("type")+"-preview-template")({field:this.model.toJSON()})}return this}}),wp.ccf.views.FormSettings=wp.ccf.views.FormSettings||t.View.extend({template:wp.ccf.utils.template("ccf-form-settings-template"),events:{"blur input":"save","change select":"save","change select.form-completion-action-type":"toggleCompletionFields","change select.form-pause":"togglePauseFields","change select.form-send-email-notifications":"toggleNotificationFields"},initialize:function(e){this.model=e.form},destroy:function(){wp.ccf.dispatcher.off("saveFormSettings",this.save),wp.ccf.dispatcher.off("mainViewChange",this.save)},toggleCompletionFields:function(){var e=this.el.querySelectorAll(".form-completion-action-type")[0].value,t=this.el.querySelectorAll(".completion-message")[0],i=this.el.querySelectorAll(".completion-redirect-url")[0];"text"===e?(t.style.display="block",i.style.display="none"):(t.style.display="none",i.style.display="block")},togglePauseFields:function(){var e=this.el.querySelectorAll(".form-pause")[0].value,t=this.el.querySelectorAll(".pause-message")[0];t.style.display=parseInt(e)?"block":"none"},save:function(e){if(""!==this.el.innerHTML){var t=this.el.querySelectorAll(".form-title")[0].value;this.model.set("title",t);var i=this.el.querySelectorAll(".form-description")[0].value;this.model.set("description",i);var l=this.el.querySelectorAll(".form-button-text")[0].value;this.model.set("buttonText",l);var s=this.el.querySelectorAll(".form-pause")[0].value;this.model.set("pause",parseInt(s)?!0:!1);var c=this.el.querySelectorAll(".form-pause-message")[0].value;this.model.set("pauseMessage",c);var r=this.el.querySelectorAll(".form-completion-message")[0].value;this.model.set("completionMessage",r);var o=this.el.querySelectorAll(".form-completion-redirect-url")[0].value;
2
+ this.model.set("completionRedirectUrl",o);var n=this.el.querySelectorAll(".form-completion-action-type")[0].value;this.model.set("completionActionType",n),e!==void 0&&e.promise!==void 0&&e.resolve()}},render:function(){var e={form:this.model.toJSON()};return this.el.innerHTML=this.template(e),this.toggleCompletionFields(),this.togglePauseFields(),wp.ccf.dispatcher.on("saveFormSettings",this.save,this),wp.ccf.dispatcher.on("mainViewChange",this.save,this),this}}),wp.ccf.views.FormNotifications=wp.ccf.views.FormNotifications||t.View.extend({template:wp.ccf.utils.template("ccf-form-notifications-template"),events:{"blur input":"save","change select":"save","change select.form-send-email-notifications":"toggleNotificationFields","change select.form-email-notification-from-type":"toggleNotificationFields","change select.form-email-notification-from-name-type":"toggleNotificationFields"},initialize:function(e){this.model=e.form},destroy:function(){wp.ccf.dispatcher.off("saveFormNotifications",this.save),wp.ccf.dispatcher.off("mainViewChange",this.save),this.undelegateEvents(),this.unbind()},updateFromFieldField:function(){var e=this.el.querySelectorAll(".form-email-notification-from-field")[0];e.innerHTML="",e.disabled=!1;var t=this.el.querySelectorAll(".form-email-notification-from-name-field")[0];t.innerHTML="",t.disabled=!1;var i=this.model.get("fields"),s=0,c=0,r=this.model.get("emailNotificationFromField"),o=this.model.get("emailNotificationFromNameField");if(i.length>=1&&i.each(function(i){if("email"===i.get("type")){var l=document.createElement("option");l.innerHTML=i.get("slug"),l.value=i.get("slug"),i.get("slug")===r&&(l.selected=!0),e.appendChild(l),s++}else if("name"===i.get("type")){var l=document.createElement("option");l.innerHTML=i.get("slug"),l.value=i.get("slug"),i.get("slug")===o&&(l.selected=!0),t.appendChild(l),c++}}),0===s){var n=document.createElement("option");n.innerHTML=l.noEmailFields,e.appendChild(n),e.disabled=!0}if(0===c){var n=document.createElement("option");n.innerHTML=l.noNameFields,t.appendChild(n),t.disabled=!0}},toggleNotificationFields:function(){var e,t=this.el.querySelectorAll(".form-send-email-notifications")[0].value,i=this.el.querySelectorAll(".email-notification-setting"),l=this.el.querySelectorAll(".email-notification-from-address")[0],s=this.el.querySelectorAll(".email-notification-from-field")[0],c=this.el.querySelectorAll(".form-email-notification-from-type")[0],r=this.el.querySelectorAll(".email-notification-from-name")[0],o=this.el.querySelectorAll(".email-notification-from-name-field")[0],n=this.el.querySelectorAll(".form-email-notification-from-name-type")[0];if(parseInt(t)){for(e=0;i.length>e;e++)i[e].style.display="block";l.style.display="none",s.style.display="none","custom"===c.value?l.style.display="block":"field"===c.value&&(s.style.display="block"),r.style.display="none",o.style.display="none","custom"===n.value?r.style.display="block":"field"===n.value&&(o.style.display="block")}else{for(e=0;i.length>e;e++)i[e].style.display="none";l.style.display="none",s.style.display="none",r.style.display="none",o.style.display="none"}},save:function(e){if(""!==this.el.innerHTML){var t=this.el.querySelectorAll(".form-send-email-notifications")[0].value;this.model.set("sendEmailNotifications",parseInt(t)?!0:!1);var i=this.el.querySelectorAll(".form-email-notification-addresses")[0].value;this.model.set("emailNotificationAddresses",i);var l=this.el.querySelectorAll(".form-email-notification-from-type")[0].value;this.model.set("emailNotificationFromType",l);var s=this.el.querySelectorAll(".form-email-notification-from-address")[0].value;this.model.set("emailNotificationFromAddress",s);var c=this.el.querySelectorAll(".form-email-notification-from-field")[0].value;this.model.set("emailNotificationFromField",c);var r=this.el.querySelectorAll(".form-email-notification-from-name-type")[0].value;this.model.set("emailNotificationFromNameType",r);var o=this.el.querySelectorAll(".form-email-notification-from-name")[0].value;this.model.set("emailNotificationFromName",o);var n=this.el.querySelectorAll(".form-email-notification-from-name-field")[0].value;this.model.set("emailNotificationFromNameField",n),e!==void 0&&e.promise!==void 0&&e.resolve()}},render:function(){var e={form:this.model.toJSON()},t=this.model.get("fields");return this.el.innerHTML=this.template(e),this.toggleNotificationFields(),this.updateFromFieldField(),wp.ccf.dispatcher.on("saveFormNotifications",this.save,this),wp.ccf.dispatcher.on("mainViewChange",this.save,this),this.listenTo(t,"add",this.updateFromFieldField,this),this.listenTo(t,"remove",this.updateFromFieldField,this),this}}),wp.ccf.views.FormPane=wp.ccf.views.FormPane||t.View.extend(i.defaults({template:wp.ccf.utils.template("ccf-form-pane-template"),subViews:{"field-sidebar":wp.ccf.views.FieldSidebar,"form-settings":wp.ccf.views.FormSettings,"form-notifications":wp.ccf.views.FormNotifications},events:{"click .save-button":"sync","click h2":"accordionClick","click .insert-form-button":"insertForm"},initialize:function(){wp.ccf.dispatcher.on("openEditField",this.openEditField,this)},insertForm:function(){wp.ccf.utils.insertFormShortcode(this.model),wp.ccf.toggle()},accordionClick:function(t){var l=e(t.currentTarget).parents(".accordion-container")[0],s=l.querySelectorAll(".accordion-section");t.currentTarget.parentNode.className.match(/expanded/i)?t.currentTarget.parentNode.className=t.currentTarget.parentNode.className.replace(/expanded/i,""):t.currentTarget.parentNode.className+=" expanded",i.each(s,function(e){e!=t.currentTarget.parentNode&&e.className.match(/expanded/i)&&(e.className=e.className.replace(/expanded/i,""))})},openEditField:function(e){this.renderedSubViews["field-sidebar"].render(e).el.style.display="block"},disable:function(){this.el.querySelectorAll(".save-button")[0].setAttribute("disabled","disabled"),this.el.querySelectorAll(".disabled-overlay")[0].style.display="block"},enable:function(){this.el.querySelectorAll(".save-button")[0].removeAttribute("disabled"),this.el.querySelectorAll(".disabled-overlay")[0].style.display="none"},sync:function(){var t=this,i=e(this.el.querySelectorAll(".spinner")[0]);i.fadeIn(),t.disable();var s=e.Deferred(),c=e.Deferred(),r=e.Deferred();wp.ccf.dispatcher.trigger("saveFormSettings",s),wp.ccf.dispatcher.trigger("saveFormNotifications",r),wp.ccf.dispatcher.trigger("saveField",c),e.when(s,c,r).then(function(){var e=t.model.get("fields"),s=!0,c={};e.each(function(e){var t=e.get("slug");e.hasRequiredAttributes()?t&&!t.match(/^[a-zA-Z0-9\-_]+$/)?(s=!1,e.trigger("requirementsNotMet")):c[e.get("slug")]!==void 0?(s=!1,e.trigger("duplicateSlug"),c[e.get("slug")].trigger("duplicateSlug")):e.trigger("requirementsMet"):(s=!1,e.trigger("requirementsNotMet")),e.get("slug")&&(c[e.get("slug")]=e)}),s?t.model.save({},{context:"edit"}).error(function(){var e="sync";wp.ccf.errorModal.render(e).show()}).done(function(){l.single&&!l.postId&&(window.location=l.adminUrl+"post.php?post="+t.model.get("ID")+"&action=edit#ccf-form/"+t.model.get("ID"))}).complete(function(){i.fadeOut(),t.enable(),wp.ccf.dispatcher.trigger("saveFormComplete",t.model)}):(t.enable(),i.fadeOut())})},enableDisableInsert:function(){var e=this.el.querySelectorAll(".insert-form-button")[0];this.model.get("ID")?e.removeAttribute("disabled"):e.setAttribute("disabled","disabled")},getNextFieldOrd:function(){var e=this.model.get("fields"),t=e.length+1;return e.each(function(e){var i=e.get("slug"),l=/\-([0-9]+)$/g,s=l.exec(i);if(s&&s[1]){var c=parseInt(s[1]);c>=t&&(t=c+1)}}),t},render:function(t){var s=this;s.model=t?t:new wp.ccf.models.Form,this.listenTo(s.model,"change",this.enableDisableInsert,this);var c={labels:l.fieldLabels,form:s.model.toJSON()};window.form=s.model,s.el.innerHTML=this.template(c);var r=s.el.querySelectorAll(".fields")[0];i.each(l.fieldLabels,function(e,t){r.appendChild(new wp.ccf.views.FieldRowPlaceholder({type:t}).render().el)});var o=s.el.querySelectorAll(".structure-fields")[0];i.each(l.structureFieldLabels,function(e,t){o.appendChild(new wp.ccf.views.FieldRowPlaceholder({type:t}).render().el)});var n=s.el.querySelectorAll(".special-fields")[0];i.each(l.specialFieldLabels,function(e,t){n.appendChild(new wp.ccf.views.FieldRowPlaceholder({type:t}).render().el)});var a=s.model.get("fields"),d=s.el.querySelectorAll(".form-content")[0],u=e(d);return e(s.el.querySelectorAll(".left-sidebar")[0].querySelectorAll(".field")).draggable({cursor:"move",distance:2,zIndex:160001,scroll:!1,containment:"document",appendTo:".ccf-main-modal",snap:!1,connectToSortable:".form-content",helper:function(t){var i=e(t.currentTarget),l=e('<div class="field" data-field-type="'+i.attr("data-field-type")+'"><h4>'+i.find(".label").html()+"</h4></div>");return l.css({width:u.width(),opacity:".75",height:i.height()})}}),a.length>=1&&(d.innerHTML="",a.each(function(e){var t=new wp.ccf.views.FieldRow({model:e,form:s.model}).render(!0).el;d.appendChild(t)})),e(d).sortable({axis:"y",distance:2,handle:"h4",placeholder:"field-placeholder",stop:function(e,t){if(!t.item.hasClass("instantiated")){var i=t.item.attr("data-field-type"),l={};wp.ccf.models.Fields[i].prototype.defaults().slug!==void 0&&(l.slug=i+"-"+s.getNextFieldOrd());var c=new wp.ccf.models.Fields[i](l),r=s.model.get("fields");r.add(c),new wp.ccf.views.FieldRow({model:c,el:t.item,form:s.model}).render(!0),t.item.attr("style","")}t.item.trigger("sorted",t.item.index())}}),s.initRenderSubViews(!0,!0,{form:s.model}),s.enableDisableInsert(),s}},wp.ccf.mixins.subViewable)),wp.ccf.views.ExistingFormTableRow=wp.ccf.views.ExistingFormTableRow||t.View.extend({tagName:"tr",template:wp.ccf.utils.template("ccf-existing-form-table-row-template"),events:{"click .edit":"triggerMainViewChange","click .delete":"triggerDelete","click .insert-form-button":"insertForm"},initialize:function(e){this.parent=e.parent},insertForm:function(){wp.ccf.utils.insertFormShortcode(this.model),wp.ccf.toggle()},triggerMainViewChange:function(){wp.ccf.switchToForm(this.model)},triggerDelete:function(){var e,t=this,i=t.parent.collection.state.currentPage;t.model.destroy().done(function(){e=i,e===t.parent.collection.state.totalPages&&e-1===(t.parent.collection.state.totalObjects-1)/l.postsPerPage&&e--,t.parent.showPage(e).done(function(){t.parent.renderPagination()})})},render:function(){return this.$el.html(this.template({form:this.model.toJSON(),utils:{getPrettyPostDate:wp.ccf.utils.getPrettyPostDate}})),this}}),wp.ccf.views.EmptyFormTableRow=wp.ccf.views.EmptyFormTableRow||t.View.extend({tagName:"tr",template:wp.ccf.utils.template("ccf-empty-form-table-row-template"),render:function(){return this.$el.html(this.template()),this}}),wp.ccf.views.ExistingFormTable=wp.ccf.views.ExistingFormTable||t.View.extend({template:wp.ccf.utils.template("ccf-existing-form-table-template"),initialize:function(){this.parent=arguments.parent,this.collection=new wp.ccf.collections.Forms,wp.ccf.dispatcher.on("changeFormTablePage",this.showPage,this),wp.ccf.dispatcher.on("saveFormComplete",this.render,this)},showPage:function(e){var t=this,i=this.collection.fetch({data:{page:e}});return i.error(function(){var e="sync";wp.ccf.errorModal.render(e).show()}),i.done(function(){var e=t.el.querySelectorAll(".rows")[0],i=document.createElement("tbody");i.className="rows",t.collection.length>=1?t.collection.each(function(e){var l=new wp.ccf.views.ExistingFormTableRow({model:e,parent:t}).render();i.appendChild(l.el)},t):i.appendChild((new wp.ccf.views.EmptyFormTableRow).render().el),e.parentNode.replaceChild(i,e)}),i},renderPagination:function(){var e=this.el.querySelectorAll(".ccf-pagination")[0];e.innerHTML="",this.collection.state.totalPages>1&&e.appendChild(new wp.ccf.views.Pagination({parent:this}).render(this.collection.state.totalPages,this.collection.state.currentPage).el)},render:function(){var e=this;return this.el.innerHTML=this.template(),this.el.querySelectorAll(".ccf-pagination")[0],this.showPage(1).done(function(){e.renderPagination()}),this}}),wp.ccf.views.ExistingFormPane=wp.ccf.views.ExistingFormPane||t.View.extend(i.defaults({template:wp.ccf.utils.template("ccf-existing-form-pane-template"),subViews:{"existing-form-table":wp.ccf.views.ExistingFormTable},render:function(){return this.rendered?this:(this.rendered=!0,this.el.innerHTML=this.template(),this.initRenderSubViews(!0),this)}},wp.ccf.mixins.subViewable)),wp.ccf.views.MainModal=wp.ccf.views.MainModal||t.View.extend(i.defaults({tagName:"div",className:"ccf-main-modal",template:wp.ccf.utils.template("ccf-main-modal-template"),events:{"click .close-icon":"hide","click .main-menu a":"menuClick"},subViews:{"form-pane":wp.ccf.views.FormPane},initialize:function(){l.single||(this.subViews["existing-form-pane"]=wp.ccf.views.ExistingFormPane),wp.ccf.dispatcher.on("mainViewChange",this.toggleView,this)},toggleView:function(e){this.showView(e,wp.ccf.currentForm);var t=e;"form-pane"===e&&wp.ccf.currentForm&&(t="existing-form-pane");var l=this.el.querySelectorAll(".menu-item");i.each(l,function(e){var i=e.getAttribute("data-view");e.className=i===t?e.className.replace("selected","")+" selected":e.className.replace("selected","")})},menuClick:function(e){var t=e.target.getAttribute("data-view");"form-pane"===t&&(wp.ccf.currentForm=null),wp.ccf.dispatcher.trigger("mainViewChange",t),e.preventDefault()},render:function(e){return e=e||!1,this.overlay(),this.el.innerHTML=this.template({single:e}),this.initRenderSubViews(),this.showView("form-pane",wp.ccf.currentForm,!0),this},overlay:function(){return this.overlayEl===void 0&&(this.overlayEl=document.createElement("div"),this.overlayEl.className="ccf-main-modal-overlay",document.body.appendChild(this.overlayEl)),this.overlayEl},remove:function(){return document.body.removeChild(this.overlay()),this},show:function(){e(this.overlay()).show(),this.$el.show()},hide:function(){e(this.overlay()).hide(),this.$el.hide()}},wp.ccf.mixins.subViewable)),wp.ccf.views.SubmissionRow=wp.ccf.views.SubmissionRow||t.View.extend({tagName:"tr",template:wp.ccf.utils.template("ccf-submission-row-template"),events:{"click .view":"view","click .delete":"delete"},initialize:function(e){this.parent=e.parent},"delete":function(){var e,t=this,i=t.parent.collection.state.currentPage;t.model.destroy().done(function(){e=i,e===t.parent.collection.state.totalPages&&e-1===(t.parent.collection.state.totalObjects-1)/l.postsPerPage&&e--,t.parent.showPage(e).done(function(){t.parent.renderPagination()})})},view:function(e){var t=e.currentTarget.getAttribute("data-submission-id"),i=e.currentTarget.getAttribute("data-submission-date");tb_show(l.thickboxTitle+" - "+wp.ccf.utils.getPrettyPostDate(i),"#TB_inline?height=500&amp;width=700&amp;inlineId=ccf-submission-content-"+parseInt(t),null)},render:function(){return this.$el.html(this.template({submission:this.model.toJSON(),currentColumns:this.parent.columns,columns:wp.ccf.currentForm.getFieldSlugs(!0),utils:{getPrettyPostDate:wp.ccf.utils.getPrettyPostDate,wordChop:wp.ccf.utils.wordChop,isFieldDate:wp.ccf.utils.isFieldDate,isFieldName:wp.ccf.utils.isFieldName,isFieldFile:wp.ccf.utils.isFieldFile,isFieldAddress:wp.ccf.utils.isFieldAddress,isFieldEmailConfirm:wp.ccf.utils.isFieldEmailConfirm,getPrettyFieldDate:wp.ccf.utils.getPrettyFieldDate,getPrettyFieldAddress:wp.ccf.utils.getPrettyFieldAddress,getPrettyFieldName:wp.ccf.utils.getPrettyFieldName,getPrettyFieldEmailConfirm:wp.ccf.utils.getPrettyFieldEmailConfirm}})),this}}),wp.ccf.views.SubmissionsTable=wp.ccf.views.SubmissionsTable||t.View.extend({template:wp.ccf.utils.template("ccf-submission-table-template"),events:{"click .prev:not(.disabled)":"previousPage","click .next:not(.disabled)":"nextPage","click .first:not(.disabled)":"firstPage","click .last:not(.disabled)":"lastPage"},initialize:function(){this.collection=new wp.ccf.collections.Submissions({},{formId:l.postId}),wp.ccf.dispatcher.on("submissionTableRebuild",this.render,this)},showPage:function(e){var t=this,i=this.collection.fetch({data:{page:e}});return i.error(function(){var e="sync";wp.ccf.errorModal.render(e).show()}),i.done(function(){var e=t.el.querySelectorAll(".submission-rows")[0],i=document.createElement("tbody");i.className="submission-rows",t.collection.length>=1?t.collection.each(function(e){var l=new wp.ccf.views.SubmissionRow({model:e,parent:t}).render();i.appendChild(l.el)},t):i.appendChild(new wp.ccf.views.EmptySubmissionTableRow({parent:t}).render(wp.ccf.currentForm.getFieldSlugs(!0).concat("date")).el),e.parentNode.replaceChild(i,e)}),i},renderPagination:function(){var e=this.el.querySelectorAll(".ccf-pagination")[0];e.innerHTML="",this.collection.state.totalPages>1&&e.appendChild(new wp.ccf.views.Pagination({parent:this}).render(this.collection.state.totalPages,this.collection.state.currentPage).el)},render:function(e){var t=this;return t.columns=e?e:wp.ccf.currentForm.getFieldSlugs(!0).slice(0,4).concat("date"),1>t.columns.length?t.el.innerHTML="":(t.el.innerHTML=t.template({columns:t.columns}),t.el.querySelectorAll(".ccf-pagination")[0],t.showPage(1).done(function(){t.renderPagination()})),t}}),wp.ccf.views.ErrorModal=wp.ccf.views.ErrorModal||t.View.extend({template:wp.ccf.utils.template("ccf-error-modal-template"),tagName:"div",className:"ccf-error-modal",events:{"click .close":"hide"},hide:function(){this.el.className=this.el.className.replace(" show","")},show:function(){this.el.className=this.el.className.replace(" show","")+" show"},toggle:function(){this.el.className.match(" show")?this.hide():this.show()},render:function(e){var t={messageType:""};return e&&(t.messageType=e),this.el.innerHTML=this.template(t),this}}),wp.ccf.views.Pagination=wp.ccf.views.Pagination||t.View.extend({template:wp.ccf.utils.template("ccf-pagination-template"),events:{"click .prev:not(.disabled)":"previousPage","click .next:not(.disabled)":"nextPage","click .first:not(.disabled)":"firstPage","click .last:not(.disabled)":"lastPage"},initialize:function(e){this.parent=e.parent},previousPage:function(){var e=this;e.parent.showPage(e.parent.collection.state.currentPage-1).done(function(){e.render()})},nextPage:function(){var e=this;e.parent.showPage(e.parent.collection.state.currentPage+1).done(function(){e.render()})},firstPage:function(){var e=this;e.parent.showPage(1).done(function(){e.render()})},lastPage:function(){var e=this;e.parent.showPage(e.parent.collection.state.totalPages).done(function(){e.render()})},render:function(){return this.el.innerHTML=this.template({totalPages:this.parent.collection.state.totalPages,currentPage:this.parent.collection.state.currentPage,totalObjects:this.parent.collection.state.totalObjects}),this}}),wp.ccf.views.EmptySubmissionTableRow=wp.ccf.views.EmptySubmissionTableRow||t.View.extend({tagName:"tr",template:wp.ccf.utils.template("ccf-no-submissions-row-template"),initialize:function(e){this.parent=e.parent},render:function(){return this.el.innerHTML=this.template({columns:this.parent.columns}),this}}),wp.ccf.views.SubmissionColumnController=wp.ccf.views.SubmissionColumnController||t.View.extend({template:wp.ccf.utils.template("ccf-submissions-controller-template"),events:{"click input[type=checkbox]":"triggerTableRebuild"},render:function(){this.el.innerHTML=this.template({columns:wp.ccf.currentForm.getFieldSlugs(!0).concat("date")})},triggerTableRebuild:function(){var e=[],t=document.querySelectorAll(".submission-column-checkbox");if(t.length>=1)for(var i=0;t.length>i;i++)t[i].checked&&e.push(t[i].value);wp.ccf.dispatcher.trigger("submissionTableRebuild",e)}})}(jQuery,Backbone,_,ccfSettings),function(e,t){"use strict";wp.ccf.router=wp.ccf.router||t.Router.extend({routes:{"ccf-form":"open","ccf-form/:formId":"open"},open:function(e){wp.ccf.show(e)}})}(jQuery,Backbone,_,ccfSettings),function(e,t,i,l){"use strict";wp.ccf=i.defaults(wp.ccf,{forms:new wp.ccf.collections.Forms,currentForm:null,errorModal:null,_currentFormDeferred:null,dispatcher:{},show:function(e){return this.switchToForm(e),this.instance.show(),this.instance},initErrorModal:function(){this.errorModal=(new wp.ccf.views.ErrorModal).render();var e=document.getElementsByTagName("body")[0];e.appendChild(this.errorModal.el)},switchToForm:function(e){var t=this;if(+e===parseInt(e)){var i=parseInt(e);if(e=t.forms.findWhere({ID:parseInt(i)}),!e){var l;return t.forms.formsFetching[i]!==void 0?(l=t.forms.formsFetching[i],e=null):(e=new wp.ccf.models.Form({ID:i}),l=e.fetch(),t.forms.formsFetching[i]=l),l.done(function(){e?(delete t.forms.formsFetching[i],t.forms.add(e)):e=t.forms.findWhere({ID:i}),t.currentForm=e,wp.ccf.dispatcher.trigger("mainViewChange","form-pane")}),l}t.currentForm=e,wp.ccf.dispatcher.trigger("mainViewChange","form-pane")}else t.currentForm=e,wp.ccf.dispatcher.trigger("mainViewChange","form-pane");return!0},hide:function(){return this.instance.hide(),this.instance},toggle:function(e){return this.switchToForm(e),this.instance.$el.is(":visible")?this.instance.hide():this.instance.show(),this.instance},createSubmissionsTable:function(e){var t=document.querySelectorAll(".ccf-submission-column-controller"),i=new wp.ccf.views.SubmissionsTable({el:e});i.render(),t&&new wp.ccf.views.SubmissionColumnController({el:t}).render()},_setupMainModal:function(e){return this.instance=(new wp.ccf.views.MainModal).render(e),document.getElementsByTagName("body")[0].appendChild(this.instance.el),t.history.start(),this.instance},createManager:function(){var s=this,c=document.querySelectorAll(".ccf-open-form-manager")[0];if(!c)return!1;i.extend(this.dispatcher,t.Events),new wp.ccf.router,s.initErrorModal();var r=!1;if(l.single)if(r=!0,l.postId){var o=parseInt(l.postId);if(s.forms.formsFetching[o]===void 0){var n=new wp.ccf.models.Form({ID:o}),a=n.fetch();s.forms.formsFetching[o]=a,s._currentFormDeferred=a,a.done(function(){delete s.forms.formsFetching[o],s.forms.add(n),s.currentForm=n})}else s._currentFormDeferred=s.forms.formsFetching[o],s._currentFormDeferred.done(function(){s.currentForm=s.forms.findWhere({ID:o})});e.when(s._currentFormDeferred).then(function(){s._setupMainModal(!0),c.style.display="inline-block";var e=document.getElementById("ccf-submissions");if(e){var t=e.querySelectorAll(".inside")[0],i=document.createElement("div");i.className="ccf-submission-icon",i.setAttribute("data-icon","");var r=document.createElement("a");r.href="?action=edit&post="+parseInt(l.postId)+"&download_submissions=1&download_submissions_nonce="+l.downloadSubmissionsNonce,r.className="ccf-submission-icon",r.setAttribute("data-icon","");var o=document.getElementById("show-settings-link");i.onclick=function(){o.click()},e.insertBefore(i,e.firstChild.nextSibling.nextSibling),e.insertBefore(r,e.firstChild.nextSibling.nextSibling),wp.ccf.createSubmissionsTable(t)}})}else s._setupMainModal(!0),c.style.display="inline-block";else s._setupMainModal();var d=function(e){e=e||window.event;var t=e.currentTarget?e.currentTarget:e.srcElement,i=t.getAttribute("data-form-id");wp.ccf.toggle(i)};c.addEventListener?c.addEventListener("click",d,!1):c.attachEvent("onclick",d)}}),wp.ccf.createManager()}(jQuery,Backbone,_,ccfSettings);
build/js/form.min.js CHANGED
@@ -1 +1 @@
1
- (function(e,t){"use strict";window.wp=window.wp||{},wp.ccf=wp.ccf||{},wp.ccf.validators=wp.ccf.validators||{};var i={},l={};window.ccfRecaptchaOnload=function(){for(var e=document.querySelectorAll(".ccf-recaptcha-wrapper"),l=function(l){grecaptcha.render(e[s],{sitekey:e[s].getAttribute("data-sitekey"),theme:t.recaptcha_theme,callback:function(){i[l]=!0}})},s=0;e.length>s;s++){var r=e[s].getAttribute("data-form-id");l(r)}};var s=function(e){if(this.wrapper=e,this.errors={},e.className.match(" field-required")){this.inputs=this.wrapper.querySelectorAll(".field-input");var i=this.wrapper.querySelectorAll(".error");i.length&&i[0].parentNode.removeChild(i[0]);var l=!1;if(_.each(this.inputs,function(e){(e.checked&&e.value||e.selected)&&(l=!0)}),!l){this.errors[this.inputs[this.inputs.length-1].getAttribute("name")]={required:!0};var s=document.createElement("div");s.className="error required-error",s.innerHTML=t.required,e.appendChild(s)}}},r=function(e,i){return function(l){this.wrapper=l,this.inputs=this.wrapper.querySelectorAll(".field-input"),this.errors={};for(var s=this.wrapper.querySelectorAll(".error"),r=s.length-1;r>=0;r--)s[r].parentNode.removeChild(s[r]);_.each(this.inputs,function(t){var i=t.getAttribute("name");this.errors[i]={},t.getAttribute("aria-required")&&""===t.value&&(this.errors[i].required=t),e&&e.call(this,t)},this),i&&i.call(this);var c;for(var o in this.errors)if(this.errors.hasOwnProperty(o))for(var n in this.errors[o])c=document.createElement("div"),c.className="error "+n+"-error",c.setAttribute("data-field-name",o),c.innerHTML=t[n],this.errors[o][n].parentNode.insertBefore(c,this.errors[o][n].nextSibling)}};wp.ccf.validators["single-line-text"]=wp.ccf.validators["single-line-text"]||r(),wp.ccf.validators["paragraph-text"]=wp.ccf.validators["paragraph-text"]||r(),wp.ccf.validators.name=wp.ccf.validators.name||r(),wp.ccf.validators.email=wp.ccf.validators.email||r(!1,function(){var e=this.inputs[0].value;if(e){2===this.inputs.length&&e!==this.inputs[1].value&&(this.errors[this.inputs[0].getAttribute("name")].match=this.wrapper.lastChild);var t=/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;t.test(e)||(this.errors[this.inputs[0].getAttribute("name")].email=this.wrapper.lastChild)}}),wp.ccf.validators.recaptcha=wp.ccf.validators.recaptcha||function(e,l){this.wrapper=e,this.inputs=this.wrapper.querySelectorAll(".g-recaptcha-response"),this.errors={};for(var s=this.wrapper.querySelectorAll(".error"),r=s.length-1;r>=0;r--)s[r].parentNode.removeChild(s[r]);i[l]||(this.errors["g-recaptcha-response"]={},this.errors["g-recaptcha-response"].recaptcha=this.wrapper.lastChild);var c;for(var o in this.errors)if(this.errors.hasOwnProperty(o))for(var n in this.errors[o])c=document.createElement("div"),c.className="error "+n+"-error",c.setAttribute("data-field-name",o),c.innerHTML=t[n],this.errors[o][n].parentNode.insertBefore(c,this.errors[o][n].nextSibling)},wp.ccf.validators.phone=wp.ccf.validators.phone||r(!1,function(){var e=this.inputs[0].value;if(e){var t=/^[0-9+.)(\- ]+$/;if(t.test(e)){if("us"===this.wrapper.getAttribute("data-phone-format")){var i=e.replace(/[^0-9]/gi,"");10!==i.length&&(this.errors[this.inputs[0].getAttribute("name")].digits=this.wrapper.lastChild)}}else this.errors[this.inputs[0].getAttribute("name")].phone=this.wrapper.lastChild}}),wp.ccf.validators.date=wp.ccf.validators.date||function(e){this.wrapper=e,this.errors={},this.inputs=this.wrapper.querySelectorAll(".field-input");for(var i=this.wrapper.querySelectorAll(".error"),l=i.length-1;l>=0;l--)i[l].parentNode.removeChild(i[l]);var s;_.each(this.inputs,function(i){var l=i.getAttribute("name");if(this.errors[l]={},i.getAttribute("aria-required")&&""===i.value&&(this.errors[l].required=!0,s=document.createElement("div"),s.className="error required-error",1===this.inputs.length?(s.innerHTML=t.required,s.className+=" right-error",i.parentNode.insertBefore(s,i.nextSibling)):(s.innerHTML=t[l.replace(/.*\[(.*?)\]/i,"$1")+"_required"],e.appendChild(s))),""!==i.value){var r=l.replace(/^.*\[(.*?)\]$/,"$1");"date"===r?i.value.match(/^([0-9]|\/)+$/)||(s=document.createElement("div"),s.className="error date-error",s.innerHTML=t.date,e.appendChild(s)):"hour"===r?i.value.match(/^[0-9]+$/)||(s=document.createElement("div"),s.className="error hour-error",s.innerHTML=t.hour,e.appendChild(s)):"minute"===r&&(i.value.match(/^[0-9]+$/)||(s=document.createElement("div"),s.className="error minute-error",s.innerHTML=t.minute,e.appendChild(s)))}},this)},wp.ccf.validators.address=wp.ccf.validators.address||r(),wp.ccf.validators.file=wp.ccf.validators.file||function(e){this.wrapper=e,this.inputs=this.wrapper.querySelectorAll(".field-input"),this.errors={};for(var i=this.wrapper.querySelectorAll(".error"),l=i.length-1;l>=0;l--)i[l].parentNode.removeChild(i[l]);_.each(this.inputs,function(e){var t=e.getAttribute("name");this.errors[t]={},e.getAttribute("aria-required")&&""===e.value&&(this.errors[t].required=e)},this);var s=this.inputs[0],r=this.wrapper.getAttribute("data-max-file-size"),c=this.wrapper.getAttribute("data-file-extensions");if(s.value){if(r){var o=1e3*1e3*parseInt(r);if(s.files)s.files[0].size>o&&(this.errors[this.inputs[0].getAttribute("name")].fileSize=this.wrapper.lastChild);else if("undefined"!=typeof ActiveXObject)try{var n=new ActiveXObject("Scripting.FileSystemObject"),a=n.getFile(s.value);a.size>o&&(this.errors[this.inputs[0].getAttribute("name")].fileSize=this.wrapper.lastChild)}catch(d){}}if(c){var u=c.replace(";",",").toLowerCase();if(u=u.replace(/\s+/g,""),u=u.split(","),u.length){var f=s.value.replace(/^.*\.(.+)$/g,"$1").toLowerCase();-1===_.indexOf(u,f)&&(this.errors[this.inputs[0].getAttribute("name")].fileExtension=this.wrapper.lastChild)}}}var p;for(var h in this.errors)if(this.errors.hasOwnProperty(h))for(var m in this.errors[h])p=document.createElement("div"),p.className="error "+m+"-error",p.setAttribute("data-field-name",h),p.innerHTML=t[m],"fileExtension"===m&&c?p.innerHTML+=" ("+c+")":"fileSize"===m&&r&&(p.innerHTML+=" "+r+" MB"),this.errors[h][m].parentNode.insertBefore(p,this.errors[h][m].nextSibling)},wp.ccf.validators.website=wp.ccf.validators.website||r(function(e){if(e.value){var t=/^http(s?)\:\/\/(([a-zA-Z0-9\-\._]+(\.[a-zA-Z0-9\-\._]+)+)|localhost)(\/?)([a-zA-Z0-9\-\.\?\,\'\/\\\+&amp;%\$#_]*)?([\d\w\.\/\%\+\-\=\&amp;\?\:\\\&quot;\'\,\|\~\;]*)$/;t.test(e.value)||(this.errors[e.getAttribute("name")].website=e)}}),wp.ccf.validators.checkboxes=wp.ccf.validators.checkboxes||s,wp.ccf.validators.dropdown=wp.ccf.validators.dropdown||r(),wp.ccf.validators.radio=wp.ccf.validators.radio||s,wp.ccf.iframeOnload=function(e){l[e]&&l[e]()},wp.ccf.setupDOM=wp.ccf.setupDOM||function(){for(var s=document.querySelectorAll(".ccf-datepicker"),r=0;s.length>r;r++)e(s[r]).datepicker();var c=document.querySelectorAll(".ccf-form-wrapper");c.length>=1&&_.each(c,function(s){function r(t){var i=s.querySelectorAll(".field"),l=[];if(_.each(i,function(e){if(!e.className.match(/ skip-field/i)){var t=e.getAttribute("data-field-type"),i=e.getAttribute("data-field-slug");h[i]=e;var s=new wp.ccf.validators[t](e,n);if(_.size(s.errors)){var r=0;for(var c in s.errors)s.errors.hasOwnProperty(c)&&_.size(s.errors[c])&&r++;r>0&&l.push(s)}}}),!l.length)return o.trigger("ccfFormSuccess"),s.className=s.className.replace(/ loading/i,"")+" loading",u.animate({opacity:100}),!0;t.returnFalse=!1,t.preventDefault&&t.preventDefault(),o.trigger("ccfFormError",l);var r=e(window).scrollTop(),c=r+e(window).height(),a=e(l[0].wrapper),d=a.offset(),f=d.top,p=f+a.height();return f>=r&&c>=p||e("html, body").animate({scrollTop:a.offset().top},500),!1}var c=s.querySelectorAll(".ccf-form")[0],o=e(c),n=parseInt(s.getAttribute("data-form-id")),a=c.querySelectorAll(".ccf-submit-button")[0],d=document.getElementById("ccf_form_frame_"+n),u=e(c.querySelectorAll(".loading-img")[0]),f=e(d),p=e(a),h={};l[n]=function(){var l,s=f.contents().find("body").text();if(!s)return!1;c.className=c.className.replace(/ loading/i,""),u.animate({opacity:0}),i[n]=!1;try{l=e.parseJSON(s)}catch(r){var o=document.createElement("div");return o.className="error unknown-error",o.innerText=t.unknown,a.parentNode.appendChild(o),!1}var d=a.parentNode.querySelectorAll(".error");d.length&&d[0].parentNode.removeChild(d[0]),l.success?"text"===l.action_type&&l.completion_message?(c.innerHTML=l.completion_message,e("html, body").animate({scrollTop:e(c).offset().top},500)):"redirect"===l.action_type&&l.completion_redirect_url&&(document.location=l.completion_redirect_url):l.field_errors&&_.each(l.field_errors,function(e,t){var i=h[t].querySelectorAll(".field-input");for(var l in e)if(e.hasOwnProperty(l)){var s=document.createElement("div");s.className="error "+l+"-error",s.innerHTML=e[l],1===i.length?i[i.length-1].parentNode.insertBefore(s,i[i.length-1].nextSibling):h[t].appendChild(s)}})},p.on("click",function(e){return e.preventDefault(),c.target="ccf_form_frame_"+n,c.action=t.ajaxurl,o.submit(),!1}),o.on("submit",r)})},e(document).ready(wp.ccf.setupDOM)})(jQuery,ccfSettings);
1
+ (function(e,t){"use strict";window.wp=window.wp||{},wp.ccf=wp.ccf||{},wp.ccf.validators=wp.ccf.validators||{};var i={},l={};window.ccfRecaptchaOnload=function(){for(var e=document.querySelectorAll(".ccf-recaptcha-wrapper"),l=function(l){grecaptcha.render(e[s],{sitekey:e[s].getAttribute("data-sitekey"),theme:t.recaptcha_theme,callback:function(){i[l]=!0}})},s=0;e.length>s;s++){var r=e[s].getAttribute("data-form-id");l(r)}};var s=function(e){if(this.wrapper=e,this.errors={},e.className.match(" field-required")){this.inputs=this.wrapper.querySelectorAll(".field-input");var i=this.wrapper.querySelectorAll(".error");i.length&&i[0].parentNode.removeChild(i[0]);var l=!1;if(_.each(this.inputs,function(e){(e.checked&&e.value||e.selected)&&(l=!0)}),!l){this.errors[this.inputs[this.inputs.length-1].getAttribute("name")]={required:!0};var s=document.createElement("div");s.className="error required-error",s.innerHTML=t.required,e.appendChild(s)}}},r=function(e,i){return function(l){this.wrapper=l,this.inputs=this.wrapper.querySelectorAll(".field-input"),this.errors={};for(var s=this.wrapper.querySelectorAll(".error"),r=s.length-1;r>=0;r--)s[r].parentNode.removeChild(s[r]);_.each(this.inputs,function(t){var i=t.getAttribute("name");this.errors[i]={},t.getAttribute("aria-required")&&""===t.value&&(this.errors[i].required=t),e&&e.call(this,t)},this),i&&i.call(this);var c;for(var o in this.errors)if(this.errors.hasOwnProperty(o))for(var n in this.errors[o])c=document.createElement("div"),c.className="error "+n+"-error",c.setAttribute("data-field-name",o),c.innerHTML=t[n],this.errors[o][n].parentNode.insertBefore(c,this.errors[o][n].nextSibling)}};wp.ccf.validators["single-line-text"]=wp.ccf.validators["single-line-text"]||r(),wp.ccf.validators["paragraph-text"]=wp.ccf.validators["paragraph-text"]||r(),wp.ccf.validators.name=wp.ccf.validators.name||r(),wp.ccf.validators.email=wp.ccf.validators.email||r(!1,function(){var e=this.inputs[0].value;if(e){2===this.inputs.length&&e!==this.inputs[1].value&&(this.errors[this.inputs[0].getAttribute("name")].match=this.wrapper.lastChild);var t=/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;t.test(e)||(this.errors[this.inputs[0].getAttribute("name")].email=this.wrapper.lastChild)}}),wp.ccf.validators.recaptcha=wp.ccf.validators.recaptcha||function(e,l){this.wrapper=e,this.inputs=this.wrapper.querySelectorAll(".g-recaptcha-response"),this.errors={};for(var s=this.wrapper.querySelectorAll(".error"),r=s.length-1;r>=0;r--)s[r].parentNode.removeChild(s[r]);i[l]||(this.errors["g-recaptcha-response"]={},this.errors["g-recaptcha-response"].recaptcha=this.wrapper.lastChild);var c;for(var o in this.errors)if(this.errors.hasOwnProperty(o))for(var n in this.errors[o])c=document.createElement("div"),c.className="error "+n+"-error",c.setAttribute("data-field-name",o),c.innerHTML=t[n],this.errors[o][n].parentNode.insertBefore(c,this.errors[o][n].nextSibling)},wp.ccf.validators.phone=wp.ccf.validators.phone||r(!1,function(){var e=this.inputs[0].value;if(e){var t=/^[0-9+.)(\- ]+$/;if(t.test(e)){if("us"===this.wrapper.getAttribute("data-phone-format")){var i=e.replace(/[^0-9]/gi,"");10!==i.length&&(this.errors[this.inputs[0].getAttribute("name")].digits=this.wrapper.lastChild)}}else this.errors[this.inputs[0].getAttribute("name")].phone=this.wrapper.lastChild}}),wp.ccf.validators.date=wp.ccf.validators.date||function(e){this.wrapper=e,this.errors={},this.inputs=this.wrapper.querySelectorAll(".field-input");for(var i=this.wrapper.querySelectorAll(".error"),l=i.length-1;l>=0;l--)i[l].parentNode.removeChild(i[l]);var s;_.each(this.inputs,function(i){var l=i.getAttribute("name");if(this.errors[l]={},i.getAttribute("aria-required")&&""===i.value&&(this.errors[l].required=!0,s=document.createElement("div"),s.className="error required-error",1===this.inputs.length?(s.innerHTML=t.required,s.className+=" right-error",i.parentNode.insertBefore(s,i.nextSibling)):(s.innerHTML=t[l.replace(/.*\[(.*?)\]/i,"$1")+"_required"],e.appendChild(s))),""!==i.value){var r=l.replace(/^.*\[(.*?)\]$/,"$1");"date"===r?i.value.match(/^([0-9]|\/)+$/)||(s=document.createElement("div"),s.className="error date-error",s.innerHTML=t.date,e.appendChild(s)):"hour"===r?i.value.match(/^[0-9]+$/)||(s=document.createElement("div"),s.className="error hour-error",s.innerHTML=t.hour,e.appendChild(s)):"minute"===r&&(i.value.match(/^[0-9]+$/)||(s=document.createElement("div"),s.className="error minute-error",s.innerHTML=t.minute,e.appendChild(s)))}},this)},wp.ccf.validators.address=wp.ccf.validators.address||r(),wp.ccf.validators.file=wp.ccf.validators.file||function(e){this.wrapper=e,this.inputs=this.wrapper.querySelectorAll(".field-input"),this.errors={};for(var i=this.wrapper.querySelectorAll(".error"),l=i.length-1;l>=0;l--)i[l].parentNode.removeChild(i[l]);_.each(this.inputs,function(e){var t=e.getAttribute("name");this.errors[t]={},e.getAttribute("aria-required")&&""===e.value&&(this.errors[t].required=e)},this);var s=this.inputs[0],r=this.wrapper.getAttribute("data-max-file-size"),c=this.wrapper.getAttribute("data-file-extensions");if(s.value){if(r){var o=1e3*1e3*parseInt(r);if(s.files)s.files[0].size>o&&(this.errors[this.inputs[0].getAttribute("name")].fileSize=this.wrapper.lastChild);else if("undefined"!=typeof ActiveXObject)try{var n=new ActiveXObject("Scripting.FileSystemObject"),a=n.getFile(s.value);a.size>o&&(this.errors[this.inputs[0].getAttribute("name")].fileSize=this.wrapper.lastChild)}catch(d){}}if(c){var f=c.replace(";",",").toLowerCase();if(f=f.replace(/\s+/g,""),f=f.split(","),f.length){var u=s.value.replace(/^.*\.(.+)$/g,"$1").toLowerCase();-1===_.indexOf(f,u)&&(this.errors[this.inputs[0].getAttribute("name")].fileExtension=this.wrapper.lastChild)}}}var p;for(var m in this.errors)if(this.errors.hasOwnProperty(m))for(var h in this.errors[m])p=document.createElement("div"),p.className="error "+h+"-error",p.setAttribute("data-field-name",m),p.innerHTML=t[h],"fileExtension"===h&&c?p.innerHTML+=" ("+c+")":"fileSize"===h&&r&&(p.innerHTML+=" "+r+" MB"),this.errors[m][h].parentNode.insertBefore(p,this.errors[m][h].nextSibling)},wp.ccf.validators.website=wp.ccf.validators.website||r(function(e){if(e.value){var t=/^http(s?)\:\/\/(([a-zA-Z0-9\-\._]+(\.[a-zA-Z0-9\-\._]+)+)|localhost)(\/?)([a-zA-Z0-9\-\.\?\,\'\/\\\+&amp;%\$#_]*)?([\d\w\.\/\%\+\-\=\&amp;\?\:\\\&quot;\'\,\|\~\;]*)$/;t.test(e.value)||(this.errors[e.getAttribute("name")].website=e)}}),wp.ccf.validators.checkboxes=wp.ccf.validators.checkboxes||s,wp.ccf.validators.dropdown=wp.ccf.validators.dropdown||r(),wp.ccf.validators.radio=wp.ccf.validators.radio||s,wp.ccf.iframeOnload=function(e){l[e]&&l[e]()},wp.ccf.setupDOM=wp.ccf.setupDOM||function(){for(var s=document.querySelectorAll(".ccf-datepicker"),r=0;s.length>r;r++)e(s[r]).datepicker();var c=document.querySelectorAll(".ccf-form-wrapper");c.length>=1&&_.each(c,function(s){function r(t){var i=s.querySelectorAll(".field"),l=[];if(_.each(i,function(e){if(!e.className.match(/ skip-field/i)){var t=e.getAttribute("data-field-type"),i=e.getAttribute("data-field-slug");m[i]=e;var s=new wp.ccf.validators[t](e,n);if(_.size(s.errors)){var r=0;for(var c in s.errors)s.errors.hasOwnProperty(c)&&_.size(s.errors[c])&&r++;r>0&&l.push(s)}}}),!l.length)return o.trigger("ccfFormSuccess"),s.className=s.className.replace(/ loading/i,"")+" loading",f.animate({opacity:100}),!0;t.returnFalse=!1,t.preventDefault&&t.preventDefault(),o.trigger("ccfFormError",l);var r=e(window).scrollTop(),c=r+e(window).height(),a=e(l[0].wrapper),d=a.offset(),u=d.top,p=u+a.height();return u>=r&&c>=p||e("html, body").animate({scrollTop:a.offset().top},500),!1}var c=s.querySelectorAll(".ccf-form")[0],o=e(c),n=parseInt(s.getAttribute("data-form-id")),a=c.querySelectorAll(".ccf-submit-button")[0],d=document.getElementById("ccf_form_frame_"+n),f=e(c.querySelectorAll(".loading-img")[0]),u=e(d),p=e(a),m={};l[n]=function(){var l,s=u.contents().find("body").text();if(!s)return!1;c.className=c.className.replace(/ loading/i,""),f.animate({opacity:0}),i[n]=!1;try{l=e.parseJSON(s)}catch(r){var o=document.createElement("div");return o.className="error unknown-error",o.innerText=t.unknown,a.parentNode.appendChild(o),!1}var d=a.parentNode.querySelectorAll(".error");d.length&&d[0].parentNode.removeChild(d[0]),l.success?"text"===l.action_type&&l.completion_message?(c.innerHTML=l.completion_message,e("html, body").animate({scrollTop:e(c).offset().top},500)):"redirect"===l.action_type&&l.completion_redirect_url&&(document.location=l.completion_redirect_url):l.field_errors&&_.each(l.field_errors,function(e,t){var i=m[t].querySelectorAll(".field-input");for(var l in e)if(e.hasOwnProperty(l)){var s=document.createElement("div");s.className="error "+l+"-error",s.innerHTML=e[l],1===i.length?i[i.length-1].parentNode.insertBefore(s,i[i.length-1].nextSibling):m[t].appendChild(s)}})},p.on("click",function(e){return e.preventDefault(),c.target="ccf_form_frame_"+n,c.action=t.ajaxurl,o.submit(),!1}),o.on("submit",r)})},e(document).ready(wp.ccf.setupDOM)})(jQuery,ccfSettings);
classes/class-ccf-api.php CHANGED
@@ -419,6 +419,10 @@ class CCF_API extends WP_JSON_Posts {
419
  $_post['emailNotificationFromAddress'] = esc_html( get_post_meta( $post['ID'], 'ccf_form_email_notification_from_address', true ) );
420
  $_post['emailNotificationFromField'] = esc_html( get_post_meta( $post['ID'], 'ccf_form_email_notification_from_field', true ) );
421
 
 
 
 
 
422
  $submissions = get_children( array( 'post_parent' => $post['ID'], 'numberposts' => array( 'ccf_max_submissions', 5000, $post ) ) );
423
  $_post['submissions'] = esc_html( count( $submissions ) );
424
  } elseif ( 'ccf_submission' === $_post['type'] ) {
@@ -592,6 +596,18 @@ class CCF_API extends WP_JSON_Posts {
592
  update_post_meta( $result, 'ccf_form_email_notification_from_field', sanitize_text_field( $data['emailNotificationFromField'] ) );
593
  }
594
 
 
 
 
 
 
 
 
 
 
 
 
 
595
  $response = json_ensure_response( $this->get_post( $result ) );
596
  $response->set_status( 201 );
597
  $response->header( 'Location', json_url( '/ccf/forms/' . $result ) );
@@ -882,6 +898,18 @@ class CCF_API extends WP_JSON_Posts {
882
  update_post_meta( $result, 'ccf_form_email_notification_from_field', sanitize_text_field( $data['emailNotificationFromField'] ) );
883
  }
884
 
 
 
 
 
 
 
 
 
 
 
 
 
885
  $response = json_ensure_response( $this->get_post( $result ) );
886
 
887
  $response->set_status( 201 );
419
  $_post['emailNotificationFromAddress'] = esc_html( get_post_meta( $post['ID'], 'ccf_form_email_notification_from_address', true ) );
420
  $_post['emailNotificationFromField'] = esc_html( get_post_meta( $post['ID'], 'ccf_form_email_notification_from_field', true ) );
421
 
422
+ $_post['emailNotificationFromNameType'] = esc_html( get_post_meta( $post['ID'], 'ccf_form_email_notification_from_name_type', true ) );
423
+ $_post['emailNotificationFromName'] = esc_html( get_post_meta( $post['ID'], 'ccf_form_email_notification_from_name', true ) );
424
+ $_post['emailNotificationFromNameField'] = esc_html( get_post_meta( $post['ID'], 'ccf_form_email_notification_from_name_field', true ) );
425
+
426
  $submissions = get_children( array( 'post_parent' => $post['ID'], 'numberposts' => array( 'ccf_max_submissions', 5000, $post ) ) );
427
  $_post['submissions'] = esc_html( count( $submissions ) );
428
  } elseif ( 'ccf_submission' === $_post['type'] ) {
596
  update_post_meta( $result, 'ccf_form_email_notification_from_field', sanitize_text_field( $data['emailNotificationFromField'] ) );
597
  }
598
 
599
+ if ( isset( $data['emailNotificationFromNameType'] ) ) {
600
+ update_post_meta( $result, 'ccf_form_email_notification_from_name_type', sanitize_text_field( $data['emailNotificationFromNameType'] ) );
601
+ }
602
+
603
+ if ( isset( $data['emailNotificationFromName'] ) ) {
604
+ update_post_meta( $result, 'ccf_form_email_notification_from_name', sanitize_text_field( $data['emailNotificationFromName'] ) );
605
+ }
606
+
607
+ if ( isset( $data['emailNotificationFromNameField'] ) ) {
608
+ update_post_meta( $result, 'ccf_form_email_notification_from_name_field', sanitize_text_field( $data['emailNotificationFromNameField'] ) );
609
+ }
610
+
611
  $response = json_ensure_response( $this->get_post( $result ) );
612
  $response->set_status( 201 );
613
  $response->header( 'Location', json_url( '/ccf/forms/' . $result ) );
898
  update_post_meta( $result, 'ccf_form_email_notification_from_field', sanitize_text_field( $data['emailNotificationFromField'] ) );
899
  }
900
 
901
+ if ( isset( $data['emailNotificationFromNameType'] ) ) {
902
+ update_post_meta( $result, 'ccf_form_email_notification_from_name_type', sanitize_text_field( $data['emailNotificationFromNameType'] ) );
903
+ }
904
+
905
+ if ( isset( $data['emailNotificationFromName'] ) ) {
906
+ update_post_meta( $result, 'ccf_form_email_notification_from_name', sanitize_text_field( $data['emailNotificationFromName'] ) );
907
+ }
908
+
909
+ if ( isset( $data['emailNotificationFromNameField'] ) ) {
910
+ update_post_meta( $result, 'ccf_form_email_notification_from_name_field', sanitize_text_field( $data['emailNotificationFromNameField'] ) );
911
+ }
912
+
913
  $response = json_ensure_response( $this->get_post( $result ) );
914
 
915
  $response->set_status( 201 );
classes/class-ccf-form-cpt.php CHANGED
@@ -156,15 +156,15 @@ class CCF_Form_CPT {
156
  } elseif ( 'dropdown' === $type || 'radio' === $type || 'checkboxes' === $type ) {
157
  if ( is_array( $field ) ) {
158
  $i = 0;
159
- $output = '';
160
 
161
  foreach ( $field as $value ) {
162
  if ( ! empty( $value ) ) {
163
  if ( $i !== 0 ) {
164
- $output .= ', ';
165
  }
166
 
167
- $output .= stripslashes( $value );
168
 
169
  $i++;
170
  }
@@ -173,7 +173,7 @@ class CCF_Form_CPT {
173
  if ( 0 === $i ) {
174
  $row[] = '';
175
  } else {
176
- $row[] = $output;
177
  }
178
 
179
  } else {
156
  } elseif ( 'dropdown' === $type || 'radio' === $type || 'checkboxes' === $type ) {
157
  if ( is_array( $field ) ) {
158
  $i = 0;
159
+ $outputval = '';
160
 
161
  foreach ( $field as $value ) {
162
  if ( ! empty( $value ) ) {
163
  if ( $i !== 0 ) {
164
+ $outputval .= ', ';
165
  }
166
 
167
+ $outputval .= stripslashes( $value );
168
 
169
  $i++;
170
  }
173
  if ( 0 === $i ) {
174
  $row[] = '';
175
  } else {
176
+ $row[] = $outputval;
177
  }
178
 
179
  } else {
classes/class-ccf-form-handler.php CHANGED
@@ -673,7 +673,11 @@ class CCF_Form_Handler {
673
  'post_parent' => $submission_id,
674
  ) );
675
  }
 
 
676
  } else {
 
 
677
  return array( 'error' => 'could_not_create_submission', 'success' => false, );
678
  }
679
 
@@ -796,27 +800,48 @@ class CCF_Form_Handler {
796
 
797
  $email_notification_from_type = get_post_meta( $form_id, 'ccf_form_email_notification_from_type', true );
798
 
799
- if ( 'custom' === $email_notification_from_type ) {
800
- $custom_email = get_post_meta( $form_id, 'ccf_form_email_notification_from_address', true );
 
 
 
801
 
802
- if ( ! empty( $custom_email ) ) {
803
- $headers[] = 'From: ' . sanitize_email( $custom_email );
804
- $headers[] = 'Reply-To: ' . sanitize_email( $custom_email );
 
 
 
 
 
 
805
  }
 
 
 
 
806
  } elseif ( 'field' === $email_notification_from_type ) {
807
  $email_field = get_post_meta( $form_id, 'ccf_form_email_notification_from_field', true );
808
 
809
  if ( ! empty( $email_field ) && ! empty( $submission[$email_field] ) ) {
810
  if ( is_array( $submission[$email_field] ) && ! empty( $submission[$email_field]['confirm'] ) ) {
811
- $headers[] = 'From: ' . sanitize_email( $submission[$email_field]['confirm'] );
812
- $headers[] = 'Reply-To: ' . sanitize_email( $submission[$email_field]['confirm'] );
813
  } else {
814
- $headers[] = 'From: ' . sanitize_email( $submission[$email_field] );
815
- $headers[] = 'Reply-To: ' . sanitize_email( $submission[$email_field] );
816
  }
817
  }
818
  }
819
 
 
 
 
 
 
 
 
 
 
 
820
  foreach ( $email_addresses as $email ) {
821
  $subject = sprintf( __( '%s: Form Submission', 'custom-contact-forms' ), wp_specialchars_decode( get_bloginfo( 'name' ) ) );
822
  if ( ! empty( $form->post_title ) ) {
673
  'post_parent' => $submission_id,
674
  ) );
675
  }
676
+
677
+ do_action( 'ccf_successful_submission', $submission_id, $form_id );
678
  } else {
679
+ do_action( 'ccf_unsuccessful_submission', $form_id );
680
+
681
  return array( 'error' => 'could_not_create_submission', 'success' => false, );
682
  }
683
 
800
 
801
  $email_notification_from_type = get_post_meta( $form_id, 'ccf_form_email_notification_from_type', true );
802
 
803
+ $email_notification_from_name_type = get_post_meta( $form_id, 'ccf_form_email_notification_from_name_type', true );
804
+ $email_notification_from_name = get_post_meta( $form_id, 'ccf_form_email_notification_from_name', true );
805
+
806
+ $name = null;
807
+ $email = null;
808
 
809
+ if ( 'custom' === $email_notification_from_type ) {
810
+ $name = $email_notification_from_name;
811
+ } else {
812
+ $name_field = get_post_meta( $form_id, 'ccf_form_email_notification_from_name_field', true );
813
+
814
+ if ( ! empty( $name_field ) && is_array( $submission[$name_field] ) ) {
815
+ if ( ! empty( $submission[$name_field]['first'] ) || ! empty( $submission[$name_field]['last'] ) ) {
816
+ $name = $submission[$name_field]['first'] . ' ' . $submission[$name_field]['last'];
817
+ }
818
  }
819
+ }
820
+
821
+ if ( 'custom' === $email_notification_from_type ) {
822
+ $email = get_post_meta( $form_id, 'ccf_form_email_notification_from_address', true );
823
  } elseif ( 'field' === $email_notification_from_type ) {
824
  $email_field = get_post_meta( $form_id, 'ccf_form_email_notification_from_field', true );
825
 
826
  if ( ! empty( $email_field ) && ! empty( $submission[$email_field] ) ) {
827
  if ( is_array( $submission[$email_field] ) && ! empty( $submission[$email_field]['confirm'] ) ) {
828
+ $email = $submission[$email_field]['confirm'];
 
829
  } else {
830
+ $email = $submission[$email_field];
 
831
  }
832
  }
833
  }
834
 
835
+ if ( ! empty( $name ) && ! empty( $email ) ) {
836
+ $headers[] = 'From: ' . sanitize_text_field( $name ) . ' <' . sanitize_email( $email ) . '>';
837
+ $headers[] = 'Reply-To: ' . sanitize_email( $email );
838
+ } elseif ( ! empty( $name ) && empty( $email ) ) {
839
+ $headers[] = 'From: ' . sanitize_text_field( $name );
840
+ } elseif ( empty( $name ) && ! empty( $email ) ) {
841
+ $headers[] = 'From: ' . sanitize_email( $email );
842
+ $headers[] = 'Reply-To: ' . sanitize_email( $email );
843
+ }
844
+
845
  foreach ( $email_addresses as $email ) {
846
  $subject = sprintf( __( '%s: Form Submission', 'custom-contact-forms' ), wp_specialchars_decode( get_bloginfo( 'name' ) ) );
847
  if ( ! empty( $form->post_title ) ) {
classes/class-ccf-form-manager.php CHANGED
@@ -223,6 +223,27 @@ class CCF_Form_Manager {
223
  <select name="email_notification_from_field" class="form-email-notification-from-field" id="ccf_form_email_notification_from_field">
224
  </select>
225
  </p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
226
  </div>
227
  </script>
228
 
@@ -1518,6 +1539,7 @@ class CCF_Form_Manager {
1518
  'specialFieldLabels' => $special_field_labels,
1519
  'maxFileSize' => floor( wp_max_upload_size() / 1000 / 1000 ),
1520
  'noEmailFields' => esc_html__( 'You have no email fields', 'custom-contact-forms' ),
 
1521
  'invalidDate' => esc_html__( 'Invalid date', 'custom-contact-forms' ),
1522
  'allLabels' => array_merge( $field_labels, $structure_field_labels, $special_field_labels ),
1523
  'thickboxTitle' => esc_html__( 'Form Submission', 'custom-contact-forms' ),
223
  <select name="email_notification_from_field" class="form-email-notification-from-field" id="ccf_form_email_notification_from_field">
224
  </select>
225
  </p>
226
+
227
+ <p class="email-notification-setting">
228
+ <label for="ccf_form_email_notification_from_name_type"><?php esc_html_e( '"From" Name Type:', 'custom-contact-forms' ); ?></label>
229
+ <select name="email_notification_from_name_type" class="form-email-notification-from-name-type" id="ccf_form_email_notification_from_name_type">
230
+ <option value="custom"><?php esc_html_e( 'Custom Name', 'custom-contact-forms' ); ?></option>
231
+ <option value="field" <# if ( 'field' === form.emailNotificationFromNameType ) { #>selected<# } #>><?php esc_html_e( 'Form Field', 'custom-contact-forms' ); ?></option>
232
+ </select>
233
+
234
+ <span class="explain"><?php esc_html_e( 'You can set the notification emails from name to be a custom name or pull the name from a field in the form.', 'custom-contact-forms' ); ?></span>
235
+ </p>
236
+
237
+ <p class="email-notification-from-name">
238
+ <label for="ccf_form_email_notification_from_name"><?php esc_html_e( 'Custom "From" Name:', 'custom-contact-forms' ); ?></label>
239
+ <input class="widefat form-email-notification-from-name" id="ccf_form_email_notification_from_name" name="email-notification-from-name" value="{{ form.emailNotificationFromName }}">
240
+ </p>
241
+
242
+ <p class="email-notification-from-name-field">
243
+ <label for="ccf_form_email_notification_from_name_field"><?php esc_html_e( 'Pull "From" Name Dynamically from Field:', 'custom-contact-forms' ); ?></label>
244
+ <select name="email_notification_from_name_field" class="form-email-notification-from-name-field" id="ccf_form_email_notification_from_name_field">
245
+ </select>
246
+ </p>
247
  </div>
248
  </script>
249
 
1539
  'specialFieldLabels' => $special_field_labels,
1540
  'maxFileSize' => floor( wp_max_upload_size() / 1000 / 1000 ),
1541
  'noEmailFields' => esc_html__( 'You have no email fields', 'custom-contact-forms' ),
1542
+ 'noNameFields' => esc_html__( 'You have no name fields', 'custom-contact-forms' ),
1543
  'invalidDate' => esc_html__( 'Invalid date', 'custom-contact-forms' ),
1544
  'allLabels' => array_merge( $field_labels, $structure_field_labels, $special_field_labels ),
1545
  'thickboxTitle' => esc_html__( 'Form Submission', 'custom-contact-forms' ),
custom-contact-forms.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin URI: http://www.taylorlovett.com
5
  * Description: Build beautiful custom forms the WordPress way. View live previews of your forms while you build them.
6
  * Author: Taylor Lovett
7
- * Version: 6.7.3
8
  * Author URI: http://www.taylorlovett.com
9
  */
10
 
4
  * Plugin URI: http://www.taylorlovett.com
5
  * Description: Build beautiful custom forms the WordPress way. View live previews of your forms while you build them.
6
  * Author: Taylor Lovett
7
+ * Version: 6.8
8
  * Author URI: http://www.taylorlovett.com
9
  */
10
 
js/manager/models.js CHANGED
@@ -101,6 +101,9 @@
101
  emailNotificationFromType: 'default',
102
  emailNotificationFromAddress: '',
103
  emailNotificationFromField: '',
 
 
 
104
  pause: false,
105
  pauseMessage: ccfSettings.pauseMessage
106
  };
101
  emailNotificationFromType: 'default',
102
  emailNotificationFromAddress: '',
103
  emailNotificationFromField: '',
104
+ emailNotificationFromNameType: 'custom',
105
+ emailNotificationFromName: 'WordPress',
106
+ emailNotificationFromNameField: '',
107
  pause: false,
108
  pauseMessage: ccfSettings.pauseMessage
109
  };
js/manager/views.js CHANGED
@@ -882,7 +882,8 @@
882
  'blur input': 'save',
883
  'change select': 'save',
884
  'change select.form-send-email-notifications': 'toggleNotificationFields',
885
- 'change select.form-email-notification-from-type': 'toggleNotificationFields'
 
886
  },
887
 
888
  initialize: function( options ) {
@@ -896,15 +897,21 @@
896
  this.unbind();
897
  },
898
 
899
- updateFromAddressFieldField: function() {
900
  var emailNotificationFromField = this.el.querySelectorAll( '.form-email-notification-from-field' )[0];
901
  emailNotificationFromField.innerHTML = '';
902
  emailNotificationFromField.disabled = false;
903
 
 
 
 
 
904
  var fields = this.model.get( 'fields'),
905
- fieldsAdded = 0;
 
906
 
907
- var currentField = this.model.get( 'emailNotificationFromField' );
 
908
 
909
  if ( fields.length >= 1 ) {
910
  fields.each( function( field ) {
@@ -913,23 +920,42 @@
913
  option.innerHTML = field.get( 'slug' );
914
  option.value = field.get( 'slug' );
915
 
916
- if ( field.get( 'slug' ) === currentField ) {
917
  option.selected = true;
918
  }
919
 
920
  emailNotificationFromField.appendChild( option );
921
 
922
- fieldsAdded++;
 
 
 
 
 
 
 
 
 
 
 
 
923
  }
924
  });
925
  }
926
 
927
- if ( 0 === fieldsAdded ) {
928
  var option = document.createElement( 'option' );
929
  option.innerHTML = ccfSettings.noEmailFields;
930
  emailNotificationFromField.appendChild( option );
931
  emailNotificationFromField.disabled = true;
932
  }
 
 
 
 
 
 
 
933
  },
934
 
935
  toggleNotificationFields: function() {
@@ -945,6 +971,12 @@
945
 
946
  var emailNotificationFromType = this.el.querySelectorAll( '.form-email-notification-from-type' )[0];
947
 
 
 
 
 
 
 
948
  if ( parseInt( sendEmailNotifications ) ) {
949
  for ( i = 0; i < emailNotificationSettings.length; i++ ) {
950
  emailNotificationSettings[i].style.display = 'block';
@@ -958,6 +990,15 @@
958
  } else if ( 'field' === emailNotificationFromType.value ) {
959
  emailNotificationFromField.style.display = 'block';
960
  }
 
 
 
 
 
 
 
 
 
961
  } else {
962
  for ( i = 0; i < emailNotificationSettings.length; i++ ) {
963
  emailNotificationSettings[i].style.display = 'none';
@@ -965,6 +1006,9 @@
965
 
966
  emailNotificationFromAddress.style.display = 'none';
967
  emailNotificationFromField.style.display = 'none';
 
 
 
968
  }
969
  },
970
 
@@ -991,6 +1035,15 @@
991
  var emailNotificationFromField = this.el.querySelectorAll( '.form-email-notification-from-field' )[0].value;
992
  this.model.set( 'emailNotificationFromField', emailNotificationFromField );
993
 
 
 
 
 
 
 
 
 
 
994
  if ( typeof $promise !== 'undefined' && typeof $promise.promise !== 'undefined' ) {
995
  $promise.resolve();
996
  }
@@ -1006,12 +1059,12 @@
1006
  this.el.innerHTML = this.template( context );
1007
 
1008
  this.toggleNotificationFields();
1009
- this.updateFromAddressFieldField();
1010
 
1011
  wp.ccf.dispatcher.on( 'saveFormNotifications', this.save, this );
1012
  wp.ccf.dispatcher.on( 'mainViewChange', this.save, this );
1013
- this.listenTo( fields, 'add', this.updateFromAddressFieldField, this );
1014
- this.listenTo( fields, 'remove', this.updateFromAddressFieldField, this );
1015
 
1016
  return this;
1017
  }
882
  'blur input': 'save',
883
  'change select': 'save',
884
  'change select.form-send-email-notifications': 'toggleNotificationFields',
885
+ 'change select.form-email-notification-from-type': 'toggleNotificationFields',
886
+ 'change select.form-email-notification-from-name-type': 'toggleNotificationFields'
887
  },
888
 
889
  initialize: function( options ) {
897
  this.unbind();
898
  },
899
 
900
+ updateFromFieldField: function() {
901
  var emailNotificationFromField = this.el.querySelectorAll( '.form-email-notification-from-field' )[0];
902
  emailNotificationFromField.innerHTML = '';
903
  emailNotificationFromField.disabled = false;
904
 
905
+ var emailNotificationFromNameField = this.el.querySelectorAll( '.form-email-notification-from-name-field' )[0];
906
+ emailNotificationFromNameField.innerHTML = '';
907
+ emailNotificationFromNameField.disabled = false;
908
+
909
  var fields = this.model.get( 'fields'),
910
+ addressFieldsAdded = 0,
911
+ nameFieldsAdded = 0;
912
 
913
+ var addressField = this.model.get( 'emailNotificationFromField' );
914
+ var nameField = this.model.get( 'emailNotificationFromNameField' );
915
 
916
  if ( fields.length >= 1 ) {
917
  fields.each( function( field ) {
920
  option.innerHTML = field.get( 'slug' );
921
  option.value = field.get( 'slug' );
922
 
923
+ if ( field.get( 'slug' ) === addressField ) {
924
  option.selected = true;
925
  }
926
 
927
  emailNotificationFromField.appendChild( option );
928
 
929
+ addressFieldsAdded++;
930
+ } else if ( 'name' === field.get( 'type' ) ) {
931
+ var option = document.createElement( 'option' );
932
+ option.innerHTML = field.get( 'slug' );
933
+ option.value = field.get( 'slug' );
934
+
935
+ if ( field.get( 'slug' ) === nameField ) {
936
+ option.selected = true;
937
+ }
938
+
939
+ emailNotificationFromNameField.appendChild( option );
940
+
941
+ nameFieldsAdded++;
942
  }
943
  });
944
  }
945
 
946
+ if ( 0 === addressFieldsAdded ) {
947
  var option = document.createElement( 'option' );
948
  option.innerHTML = ccfSettings.noEmailFields;
949
  emailNotificationFromField.appendChild( option );
950
  emailNotificationFromField.disabled = true;
951
  }
952
+
953
+ if ( 0 === nameFieldsAdded ) {
954
+ var option = document.createElement( 'option' );
955
+ option.innerHTML = ccfSettings.noNameFields;
956
+ emailNotificationFromNameField.appendChild( option );
957
+ emailNotificationFromNameField.disabled = true;
958
+ }
959
  },
960
 
961
  toggleNotificationFields: function() {
971
 
972
  var emailNotificationFromType = this.el.querySelectorAll( '.form-email-notification-from-type' )[0];
973
 
974
+ var emailNotificationFromName = this.el.querySelectorAll( '.email-notification-from-name' )[0];
975
+
976
+ var emailNotificationFromNameField = this.el.querySelectorAll( '.email-notification-from-name-field' )[0];
977
+
978
+ var emailNotificationFromNameType = this.el.querySelectorAll( '.form-email-notification-from-name-type' )[0];
979
+
980
  if ( parseInt( sendEmailNotifications ) ) {
981
  for ( i = 0; i < emailNotificationSettings.length; i++ ) {
982
  emailNotificationSettings[i].style.display = 'block';
990
  } else if ( 'field' === emailNotificationFromType.value ) {
991
  emailNotificationFromField.style.display = 'block';
992
  }
993
+
994
+ emailNotificationFromName.style.display = 'none';
995
+ emailNotificationFromNameField.style.display = 'none';
996
+
997
+ if ( 'custom' === emailNotificationFromNameType.value ) {
998
+ emailNotificationFromName.style.display = 'block';
999
+ } else if ( 'field' === emailNotificationFromNameType.value ) {
1000
+ emailNotificationFromNameField.style.display = 'block';
1001
+ }
1002
  } else {
1003
  for ( i = 0; i < emailNotificationSettings.length; i++ ) {
1004
  emailNotificationSettings[i].style.display = 'none';
1006
 
1007
  emailNotificationFromAddress.style.display = 'none';
1008
  emailNotificationFromField.style.display = 'none';
1009
+
1010
+ emailNotificationFromName.style.display = 'none';
1011
+ emailNotificationFromNameField.style.display = 'none';
1012
  }
1013
  },
1014
 
1035
  var emailNotificationFromField = this.el.querySelectorAll( '.form-email-notification-from-field' )[0].value;
1036
  this.model.set( 'emailNotificationFromField', emailNotificationFromField );
1037
 
1038
+ var emailNotificationFromNameType = this.el.querySelectorAll( '.form-email-notification-from-name-type' )[0].value;
1039
+ this.model.set( 'emailNotificationFromNameType', emailNotificationFromNameType );
1040
+
1041
+ var emailNotificationFromName = this.el.querySelectorAll( '.form-email-notification-from-name' )[0].value;
1042
+ this.model.set( 'emailNotificationFromName', emailNotificationFromName );
1043
+
1044
+ var emailNotificationFromNameField = this.el.querySelectorAll( '.form-email-notification-from-name-field' )[0].value;
1045
+ this.model.set( 'emailNotificationFromNameField', emailNotificationFromNameField );
1046
+
1047
  if ( typeof $promise !== 'undefined' && typeof $promise.promise !== 'undefined' ) {
1048
  $promise.resolve();
1049
  }
1059
  this.el.innerHTML = this.template( context );
1060
 
1061
  this.toggleNotificationFields();
1062
+ this.updateFromFieldField();
1063
 
1064
  wp.ccf.dispatcher.on( 'saveFormNotifications', this.save, this );
1065
  wp.ccf.dispatcher.on( 'mainViewChange', this.save, this );
1066
+ this.listenTo( fields, 'add', this.updateFromFieldField, this );
1067
+ this.listenTo( fields, 'remove', this.updateFromFieldField, this );
1068
 
1069
  return this;
1070
  }
languages/custom-contact-forms.mo CHANGED
Binary file
languages/custom-contact-forms.po CHANGED
@@ -5,8 +5,8 @@ msgstr ""
5
  "Project-Id-Version: Custom Contact Forms\n"
6
  "Report-Msgid-Bugs-To: https://github.com/tlovett1/custom-contact-forms/"
7
  "issues\n"
8
- "POT-Creation-Date: 2015-04-25 00:38-0500\n"
9
- "PO-Revision-Date: 2015-04-25 00:39-0500\n"
10
  "Last-Translator: Taylor Lovett <tlovett88@gmail.com>\n"
11
  "Language-Team: LANGUAGE <LL@li.org>\n"
12
  "Language: en\n"
@@ -60,34 +60,34 @@ msgstr ""
60
  msgid "The post type \"%s\" is not valid"
61
  msgstr ""
62
 
63
- #: ../classes/class-ccf-api.php:443 ../classes/class-ccf-api.php:746
64
- #: ../classes/class-ccf-api.php:771 ../classes/class-ccf-api.php:800
65
- #: ../classes/class-ccf-api.php:901
66
  msgid "Invalid form ID."
67
  msgstr ""
68
 
69
- #: ../classes/class-ccf-api.php:448 ../classes/class-ccf-api.php:731
70
- #: ../classes/class-ccf-api.php:751
71
  msgid "Sorry, you cannot view forms."
72
  msgstr ""
73
 
74
- #: ../classes/class-ccf-api.php:777 ../classes/class-ccf-api.php:806
75
  msgid "Invalid form."
76
  msgstr ""
77
 
78
- #: ../classes/class-ccf-api.php:781
79
  msgid "Sorry, you cannot view this form."
80
  msgstr ""
81
 
82
- #: ../classes/class-ccf-api.php:912
83
  msgid "The form cannot be deleted."
84
  msgstr ""
85
 
86
- #: ../classes/class-ccf-api.php:916
87
  msgid "Permanently deleted form"
88
  msgstr ""
89
 
90
- #: ../classes/class-ccf-api.php:919
91
  #: ../vendor/wp-api/wp-api/lib/class-wp-json-posts.php:391
92
  msgid "Deleted post"
93
  msgstr ""
@@ -96,14 +96,14 @@ msgstr ""
96
  msgid "Form Field Choices"
97
  msgstr ""
98
 
99
- #: ../classes/class-ccf-custom-contact-forms.php:46
100
  #, php-format
101
  msgid ""
102
  "Custom Contact Forms will not work unless pretty permalinks (not default) "
103
  "are enabled. Please update your <a href=\"%s\">permalinks settings</a>."
104
  msgstr ""
105
 
106
- #: ../classes/class-ccf-custom-contact-forms.php:64
107
  #, php-format
108
  msgid "<a href=\"%s\">Forms and Submissions</a>"
109
  msgstr ""
@@ -131,105 +131,105 @@ msgid "Max file size is %d MB. "
131
  msgstr ""
132
 
133
  #: ../classes/class-ccf-field-renderer.php:556
134
- #: ../classes/class-ccf-form-manager.php:1130
135
- #: ../classes/class-ccf-form-manager.php:1155
136
  msgid "Street Address"
137
  msgstr ""
138
 
139
  #: ../classes/class-ccf-field-renderer.php:560
140
- #: ../classes/class-ccf-form-manager.php:1134
141
- #: ../classes/class-ccf-form-manager.php:1159
142
  msgid "Address Line 2"
143
  msgstr ""
144
 
145
  #: ../classes/class-ccf-field-renderer.php:567
146
- #: ../classes/class-ccf-form-manager.php:1138
147
- #: ../classes/class-ccf-form-manager.php:1163
148
  msgid "City"
149
  msgstr ""
150
 
151
  #: ../classes/class-ccf-field-renderer.php:580
152
- #: ../classes/class-ccf-form-manager.php:1146
153
  msgid "State"
154
  msgstr ""
155
 
156
  #: ../classes/class-ccf-field-renderer.php:588
157
- #: ../classes/class-ccf-form-manager.php:1150
158
  msgid "ZIP Code"
159
  msgstr ""
160
 
161
  #: ../classes/class-ccf-field-renderer.php:598
162
- #: ../classes/class-ccf-form-manager.php:1167
163
  msgid "State / Region / Province"
164
  msgstr ""
165
 
166
  #: ../classes/class-ccf-field-renderer.php:606
167
- #: ../classes/class-ccf-form-manager.php:1171
168
  msgid "ZIP / Postal Code"
169
  msgstr ""
170
 
171
  #: ../classes/class-ccf-field-renderer.php:618
172
- #: ../classes/class-ccf-form-manager.php:1179
173
  msgid "Country"
174
  msgstr ""
175
 
176
  #: ../classes/class-ccf-field-renderer.php:803
177
- #: ../classes/class-ccf-form-manager.php:1194
178
- #: ../classes/class-ccf-form-manager.php:1495
179
  msgid "Email"
180
  msgstr ""
181
 
182
  #: ../classes/class-ccf-field-renderer.php:810
183
- #: ../classes/class-ccf-form-manager.php:1198
184
  msgid "Confirm Email"
185
  msgstr ""
186
 
187
  #: ../classes/class-ccf-field-renderer.php:876
188
- #: ../classes/class-ccf-form-manager.php:1066
189
  msgid "First"
190
  msgstr ""
191
 
192
  #: ../classes/class-ccf-field-renderer.php:883
193
- #: ../classes/class-ccf-form-manager.php:1070
194
  msgid "Last"
195
  msgstr ""
196
 
197
  #: ../classes/class-ccf-field-renderer.php:955
198
  #: ../classes/class-ccf-field-renderer.php:976
199
- #: ../classes/class-ccf-form-manager.php:1085
200
  #: ../classes/class-ccf-form-manager.php:1106
 
201
  msgid "HH"
202
  msgstr ""
203
 
204
  #: ../classes/class-ccf-field-renderer.php:959
205
  #: ../classes/class-ccf-field-renderer.php:980
206
- #: ../classes/class-ccf-form-manager.php:1089
207
  #: ../classes/class-ccf-form-manager.php:1110
 
208
  msgid "MM"
209
  msgstr ""
210
 
211
  #: ../classes/class-ccf-field-renderer.php:963
212
  #: ../classes/class-ccf-field-renderer.php:984
213
- #: ../classes/class-ccf-form-manager.php:1093
214
  #: ../classes/class-ccf-form-manager.php:1114
 
215
  msgid "AM"
216
  msgstr ""
217
 
218
  #: ../classes/class-ccf-field-renderer.php:964
219
  #: ../classes/class-ccf-field-renderer.php:985
220
- #: ../classes/class-ccf-form-manager.php:1094
221
  #: ../classes/class-ccf-form-manager.php:1115
 
222
  msgid "PM"
223
  msgstr ""
224
 
225
  #: ../classes/class-ccf-field-renderer.php:971
226
  #: ../classes/class-ccf-form-cpt.php:510
227
- #: ../classes/class-ccf-form-manager.php:253
228
- #: ../classes/class-ccf-form-manager.php:266
229
- #: ../classes/class-ccf-form-manager.php:1101
230
- #: ../classes/class-ccf-form-manager.php:1284
231
- #: ../classes/class-ccf-form-manager.php:1298
232
- #: ../classes/class-ccf-form-manager.php:1436
233
  msgid "Date"
234
  msgstr ""
235
 
@@ -239,8 +239,8 @@ msgstr ""
239
 
240
  #: ../classes/class-ccf-form-cpt.php:326 ../classes/class-ccf-form-cpt.php:344
241
  #: ../classes/class-ccf-form-cpt.php:508
242
- #: ../classes/class-ccf-form-manager.php:256
243
- #: ../classes/class-ccf-form-manager.php:269
244
  msgid "Submissions"
245
  msgstr ""
246
 
@@ -281,7 +281,7 @@ msgid "Export"
281
  msgstr ""
282
 
283
  #: ../classes/class-ccf-form-cpt.php:446
284
- #: ../classes/class-ccf-form-manager.php:1226
285
  msgid "(No title)"
286
  msgstr ""
287
 
@@ -294,14 +294,14 @@ msgid "Form Title"
294
  msgstr ""
295
 
296
  #: ../classes/class-ccf-form-cpt.php:507
297
- #: ../classes/class-ccf-form-manager.php:254
298
- #: ../classes/class-ccf-form-manager.php:267
299
  msgid "Author"
300
  msgstr ""
301
 
302
  #: ../classes/class-ccf-form-cpt.php:509
303
- #: ../classes/class-ccf-form-manager.php:255
304
- #: ../classes/class-ccf-form-manager.php:268
305
  msgid "Number of Fields"
306
  msgstr ""
307
 
@@ -478,29 +478,29 @@ msgstr ""
478
  msgid "AM/PM is required."
479
  msgstr ""
480
 
481
- #: ../classes/class-ccf-form-handler.php:704
482
  msgid "*Hidden Field*"
483
  msgstr ""
484
 
485
- #: ../classes/class-ccf-form-handler.php:778
486
  msgid "Form submitted from"
487
  msgstr ""
488
 
489
- #: ../classes/class-ccf-form-handler.php:787
490
  msgid "Form submitter IP"
491
  msgstr ""
492
 
493
- #: ../classes/class-ccf-form-handler.php:821
494
  #, php-format
495
  msgid "%s: Form Submission"
496
  msgstr ""
497
 
498
- #: ../classes/class-ccf-form-handler.php:823
499
  #, php-format
500
  msgid " to \"%s\""
501
  msgstr ""
502
 
503
- #: ../classes/class-ccf-form-handler.php:838
504
  #: ../classes/class-ccf-form-renderer.php:134
505
  msgid "Thank you for your submission."
506
  msgstr ""
@@ -543,7 +543,7 @@ msgid "&larr; Drag fields from the left here."
543
  msgstr ""
544
 
545
  #: ../classes/class-ccf-form-manager.php:133
546
- #: ../classes/class-ccf-form-manager.php:1229
547
  msgid "Insert into post"
548
  msgstr ""
549
 
@@ -593,37 +593,37 @@ msgstr ""
593
 
594
  #: ../classes/class-ccf-form-manager.php:177
595
  #: ../classes/class-ccf-form-manager.php:196
596
- #: ../classes/class-ccf-form-manager.php:307
597
- #: ../classes/class-ccf-form-manager.php:357
598
- #: ../classes/class-ccf-form-manager.php:433
599
- #: ../classes/class-ccf-form-manager.php:523
600
- #: ../classes/class-ccf-form-manager.php:588
601
- #: ../classes/class-ccf-form-manager.php:630
602
- #: ../classes/class-ccf-form-manager.php:691
603
- #: ../classes/class-ccf-form-manager.php:738
604
- #: ../classes/class-ccf-form-manager.php:780
605
- #: ../classes/class-ccf-form-manager.php:787
606
- #: ../classes/class-ccf-form-manager.php:838
607
- #: ../classes/class-ccf-form-manager.php:881
608
- #: ../classes/class-ccf-form-manager.php:924
609
  msgid "No"
610
  msgstr ""
611
 
612
  #: ../classes/class-ccf-form-manager.php:178
613
  #: ../classes/class-ccf-form-manager.php:195
614
- #: ../classes/class-ccf-form-manager.php:306
615
- #: ../classes/class-ccf-form-manager.php:356
616
- #: ../classes/class-ccf-form-manager.php:432
617
- #: ../classes/class-ccf-form-manager.php:522
618
- #: ../classes/class-ccf-form-manager.php:587
619
- #: ../classes/class-ccf-form-manager.php:629
620
- #: ../classes/class-ccf-form-manager.php:690
621
- #: ../classes/class-ccf-form-manager.php:737
622
- #: ../classes/class-ccf-form-manager.php:779
623
- #: ../classes/class-ccf-form-manager.php:786
624
- #: ../classes/class-ccf-form-manager.php:837
625
- #: ../classes/class-ccf-form-manager.php:880
626
- #: ../classes/class-ccf-form-manager.php:923
627
  msgid "Yes"
628
  msgstr ""
629
 
@@ -656,6 +656,7 @@ msgid "Custom Email"
656
  msgstr ""
657
 
658
  #: ../classes/class-ccf-form-manager.php:210
 
659
  msgid "Form Field"
660
  msgstr ""
661
 
@@ -673,140 +674,162 @@ msgstr ""
673
  msgid "Pull \"From\" Email Dynamically from Field:"
674
  msgstr ""
675
 
676
- #: ../classes/class-ccf-form-manager.php:236
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
677
  msgid "items"
678
  msgstr ""
679
 
680
- #: ../classes/class-ccf-form-manager.php:251
681
- #: ../classes/class-ccf-form-manager.php:264
682
  msgid "ID"
683
  msgstr ""
684
 
685
- #: ../classes/class-ccf-form-manager.php:252
686
- #: ../classes/class-ccf-form-manager.php:265
687
  msgid "Title"
688
  msgstr ""
689
 
690
- #: ../classes/class-ccf-form-manager.php:279
691
  msgid "<span>&larr;</span> Click on a field to edit it."
692
  msgstr ""
693
 
694
- #: ../classes/class-ccf-form-manager.php:288
695
- #: ../classes/class-ccf-form-manager.php:332
696
- #: ../classes/class-ccf-form-manager.php:414
697
- #: ../classes/class-ccf-form-manager.php:504
698
  msgid "Internal Unique Slug"
699
  msgstr ""
700
 
701
- #: ../classes/class-ccf-form-manager.php:292
702
- #: ../classes/class-ccf-form-manager.php:336
703
- #: ../classes/class-ccf-form-manager.php:379
704
- #: ../classes/class-ccf-form-manager.php:418
705
- #: ../classes/class-ccf-form-manager.php:508
706
- #: ../classes/class-ccf-form-manager.php:577
707
- #: ../classes/class-ccf-form-manager.php:613
708
- #: ../classes/class-ccf-form-manager.php:669
709
- #: ../classes/class-ccf-form-manager.php:720
710
- #: ../classes/class-ccf-form-manager.php:763
711
- #: ../classes/class-ccf-form-manager.php:827
712
- #: ../classes/class-ccf-form-manager.php:870
713
- #: ../classes/class-ccf-form-manager.php:913
714
  msgid "Label:"
715
  msgstr ""
716
 
717
- #: ../classes/class-ccf-form-manager.php:296
718
- #: ../classes/class-ccf-form-manager.php:340
719
- #: ../classes/class-ccf-form-manager.php:383
720
- #: ../classes/class-ccf-form-manager.php:422
721
- #: ../classes/class-ccf-form-manager.php:512
722
- #: ../classes/class-ccf-form-manager.php:581
723
- #: ../classes/class-ccf-form-manager.php:617
724
- #: ../classes/class-ccf-form-manager.php:673
725
- #: ../classes/class-ccf-form-manager.php:724
726
- #: ../classes/class-ccf-form-manager.php:767
727
- #: ../classes/class-ccf-form-manager.php:831
728
- #: ../classes/class-ccf-form-manager.php:874
729
- #: ../classes/class-ccf-form-manager.php:917
730
  msgid "Description:"
731
  msgstr ""
732
 
733
- #: ../classes/class-ccf-form-manager.php:300
734
- #: ../classes/class-ccf-form-manager.php:426
735
- #: ../classes/class-ccf-form-manager.php:516
736
- #: ../classes/class-ccf-form-manager.php:552
737
- #: ../classes/class-ccf-form-manager.php:622
738
- #: ../classes/class-ccf-form-manager.php:677
739
- #: ../classes/class-ccf-form-manager.php:772
740
  msgid "Initial Value:"
741
  msgstr ""
742
 
743
- #: ../classes/class-ccf-form-manager.php:304
744
- #: ../classes/class-ccf-form-manager.php:354
745
- #: ../classes/class-ccf-form-manager.php:430
746
- #: ../classes/class-ccf-form-manager.php:520
747
- #: ../classes/class-ccf-form-manager.php:585
748
- #: ../classes/class-ccf-form-manager.php:627
749
- #: ../classes/class-ccf-form-manager.php:688
750
- #: ../classes/class-ccf-form-manager.php:735
751
- #: ../classes/class-ccf-form-manager.php:777
752
- #: ../classes/class-ccf-form-manager.php:835
753
- #: ../classes/class-ccf-form-manager.php:878
754
- #: ../classes/class-ccf-form-manager.php:921
755
  msgid "Required:"
756
  msgstr ""
757
 
758
- #: ../classes/class-ccf-form-manager.php:313
759
- #: ../classes/class-ccf-form-manager.php:363
760
- #: ../classes/class-ccf-form-manager.php:399
761
- #: ../classes/class-ccf-form-manager.php:439
762
- #: ../classes/class-ccf-form-manager.php:464
763
- #: ../classes/class-ccf-form-manager.php:489
764
- #: ../classes/class-ccf-form-manager.php:529
765
- #: ../classes/class-ccf-form-manager.php:558
766
- #: ../classes/class-ccf-form-manager.php:594
767
- #: ../classes/class-ccf-form-manager.php:644
768
- #: ../classes/class-ccf-form-manager.php:697
769
- #: ../classes/class-ccf-form-manager.php:744
770
- #: ../classes/class-ccf-form-manager.php:793
771
- #: ../classes/class-ccf-form-manager.php:851
772
- #: ../classes/class-ccf-form-manager.php:894
773
- #: ../classes/class-ccf-form-manager.php:937
774
  msgid "Advanced"
775
  msgstr ""
776
 
777
- #: ../classes/class-ccf-form-manager.php:316
778
- #: ../classes/class-ccf-form-manager.php:366
779
- #: ../classes/class-ccf-form-manager.php:402
780
- #: ../classes/class-ccf-form-manager.php:442
781
- #: ../classes/class-ccf-form-manager.php:467
782
- #: ../classes/class-ccf-form-manager.php:492
783
- #: ../classes/class-ccf-form-manager.php:532
784
- #: ../classes/class-ccf-form-manager.php:561
785
- #: ../classes/class-ccf-form-manager.php:597
786
- #: ../classes/class-ccf-form-manager.php:647
787
- #: ../classes/class-ccf-form-manager.php:700
788
- #: ../classes/class-ccf-form-manager.php:747
789
- #: ../classes/class-ccf-form-manager.php:796
790
- #: ../classes/class-ccf-form-manager.php:854
791
- #: ../classes/class-ccf-form-manager.php:897
792
- #: ../classes/class-ccf-form-manager.php:940
793
  msgid "Class Name:"
794
  msgstr ""
795
 
796
- #: ../classes/class-ccf-form-manager.php:320
797
- #: ../classes/class-ccf-form-manager.php:446
798
- #: ../classes/class-ccf-form-manager.php:536
799
- #: ../classes/class-ccf-form-manager.php:652
800
- #: ../classes/class-ccf-form-manager.php:704
801
- #: ../classes/class-ccf-form-manager.php:801
802
  msgid "Placeholder Text:"
803
  msgstr ""
804
 
805
- #: ../classes/class-ccf-form-manager.php:344
806
  msgid "Allowed File Extensions (comma separate):"
807
  msgstr ""
808
 
809
- #: ../classes/class-ccf-form-manager.php:346
810
  msgid ""
811
  "If left blank, will default to all extensions registered by WordPress. If "
812
  "you use a file extension or mime type not <a href=\"http://codex.wordpress."
@@ -814,257 +837,261 @@ msgid ""
814
  "a>, you will need to filter and manually whitelist the new extension."
815
  msgstr ""
816
 
817
- #: ../classes/class-ccf-form-manager.php:349
818
  msgid "Max File Size (in MB):"
819
  msgstr ""
820
 
821
- #: ../classes/class-ccf-form-manager.php:351
822
  #, php-format
823
  msgid ""
824
  "If left blank, will default to %d MB. Maximum allowed by server is %d MB."
825
  msgstr ""
826
 
827
- #: ../classes/class-ccf-form-manager.php:377
828
  msgid ""
829
  "reCAPTCHA is a simple captcha service provided by Google. <a target=\"_blank"
830
  "\" href=\"https://www.google.com/recaptcha/intro/index.html\">Learn more</a>"
831
  msgstr ""
832
 
833
- #: ../classes/class-ccf-form-manager.php:387
834
  msgid "Site Key:"
835
  msgstr ""
836
 
837
- #: ../classes/class-ccf-form-manager.php:389
838
- #: ../classes/class-ccf-form-manager.php:394
839
  msgid "Don't have one?"
840
  msgstr ""
841
 
842
- #: ../classes/class-ccf-form-manager.php:392
843
  msgid "Secret Key:"
844
  msgstr ""
845
 
846
- #: ../classes/class-ccf-form-manager.php:455
847
  #: ../classes/class-ccf-form-manager.php:476
848
- #: ../classes/class-ccf-form-manager.php:501
849
- #: ../classes/class-ccf-form-manager.php:545
850
- #: ../classes/class-ccf-form-manager.php:570
851
- #: ../classes/class-ccf-form-manager.php:606
852
- #: ../classes/class-ccf-form-manager.php:662
853
- #: ../classes/class-ccf-form-manager.php:713
854
- #: ../classes/class-ccf-form-manager.php:756
855
- #: ../classes/class-ccf-form-manager.php:820
856
- #: ../classes/class-ccf-form-manager.php:863
857
- #: ../classes/class-ccf-form-manager.php:906
 
858
  msgid "Basic"
859
  msgstr ""
860
 
861
- #: ../classes/class-ccf-form-manager.php:458
862
  msgid "HTML Content:"
863
  msgstr ""
864
 
865
- #: ../classes/class-ccf-form-manager.php:479
866
  msgid "Heading:"
867
  msgstr ""
868
 
869
- #: ../classes/class-ccf-form-manager.php:483
870
  msgid "Sub Heading:"
871
  msgstr ""
872
 
873
- #: ../classes/class-ccf-form-manager.php:548
874
- #: ../classes/class-ccf-form-manager.php:573
875
- #: ../classes/class-ccf-form-manager.php:609
876
- #: ../classes/class-ccf-form-manager.php:665
877
- #: ../classes/class-ccf-form-manager.php:716
878
- #: ../classes/class-ccf-form-manager.php:759
879
- #: ../classes/class-ccf-form-manager.php:823
880
- #: ../classes/class-ccf-form-manager.php:866
881
- #: ../classes/class-ccf-form-manager.php:909
882
  msgid "Internal Unique Slug (a-z, 0-9, -, _):"
883
  msgstr ""
884
 
885
- #: ../classes/class-ccf-form-manager.php:635
886
  msgid "Enable Date Select"
887
  msgstr ""
888
 
889
- #: ../classes/class-ccf-form-manager.php:639
890
  msgid "Enable Time Select"
891
  msgstr ""
892
 
893
- #: ../classes/class-ccf-form-manager.php:681
894
  msgid "Format:"
895
  msgstr ""
896
 
897
- #: ../classes/class-ccf-form-manager.php:684
898
- #: ../classes/class-ccf-form-manager.php:731
899
  msgid "International"
900
  msgstr ""
901
 
902
- #: ../classes/class-ccf-form-manager.php:728
903
  msgid "Type:"
904
  msgstr ""
905
 
906
- #: ../classes/class-ccf-form-manager.php:730
907
  msgid "United States"
908
  msgstr ""
909
 
910
- #: ../classes/class-ccf-form-manager.php:784
911
  msgid "Require Confirmation:"
912
  msgstr ""
913
 
914
- #: ../classes/class-ccf-form-manager.php:812
915
  msgid "Label"
916
  msgstr ""
917
 
918
- #: ../classes/class-ccf-form-manager.php:813
919
  msgid "Value"
920
  msgstr ""
921
 
922
- #: ../classes/class-ccf-form-manager.php:842
923
- #: ../classes/class-ccf-form-manager.php:885
924
- #: ../classes/class-ccf-form-manager.php:928
925
  msgid "Manage field choices:"
926
  msgstr ""
927
 
928
- #: ../classes/class-ccf-form-manager.php:846
929
- #: ../classes/class-ccf-form-manager.php:889
930
- #: ../classes/class-ccf-form-manager.php:932
931
  msgid ""
932
  "Note: If an option does not have a \"value\", it will not be considered a "
933
  "valid selection if the field is required. The \"value\" is what's read, "
934
  "stored, and displayed in the submission."
935
  msgstr ""
936
 
937
- #: ../classes/class-ccf-form-manager.php:949
938
  msgid "You currently have no forms. Add some!"
939
  msgstr ""
940
 
941
- #: ../classes/class-ccf-form-manager.php:972
942
  msgid "Allowed file extensions are {{ extensions }}. "
943
  msgstr ""
944
 
945
- #: ../classes/class-ccf-form-manager.php:974
946
  msgid "Max file size is {{ file_size }} MB. "
947
  msgstr ""
948
 
949
- #: ../classes/class-ccf-form-manager.php:999
950
- #: ../classes/class-ccf-form-manager.php:1015
951
- #: ../classes/class-ccf-form-manager.php:1033
952
  msgid "An example choice"
953
  msgstr ""
954
 
955
- #: ../classes/class-ccf-form-manager.php:1051
956
  msgid "Arbitrary block of HTML."
957
  msgstr ""
958
 
959
- #: ../classes/class-ccf-form-manager.php:1057
960
  msgid "Section Heading"
961
  msgstr ""
962
 
963
- #: ../classes/class-ccf-form-manager.php:1059
964
  msgid "This is the sub-heading text."
965
  msgstr ""
966
 
967
- #: ../classes/class-ccf-form-manager.php:1190
968
  msgid "email@example.com"
969
  msgstr ""
970
 
971
- #: ../classes/class-ccf-form-manager.php:1228
972
  msgid "Edit"
973
  msgstr ""
974
 
975
- #: ../classes/class-ccf-form-manager.php:1230
976
  msgid "Trash"
977
  msgstr ""
978
 
979
- #: ../classes/class-ccf-form-manager.php:1273
980
  msgid "There is a problem with this form. Is it trashed or deleted?"
981
  msgstr ""
982
 
983
- #: ../classes/class-ccf-form-manager.php:1415
984
  msgid "IP Address"
985
  msgstr ""
986
 
987
- #: ../classes/class-ccf-form-manager.php:1427
988
  msgid "There are no submissions."
989
  msgstr ""
990
 
991
- #: ../classes/class-ccf-form-manager.php:1456
992
  msgid "Add Form"
993
  msgstr ""
994
 
995
- #: ../classes/class-ccf-form-manager.php:1480
996
  msgid "Single Line Text"
997
  msgstr ""
998
 
999
- #: ../classes/class-ccf-form-manager.php:1481
1000
  msgid "Dropdown"
1001
  msgstr ""
1002
 
1003
- #: ../classes/class-ccf-form-manager.php:1482
1004
  msgid "Checkboxes"
1005
  msgstr ""
1006
 
1007
- #: ../classes/class-ccf-form-manager.php:1483
1008
  msgid "Radio Buttons"
1009
  msgstr ""
1010
 
1011
- #: ../classes/class-ccf-form-manager.php:1484
1012
  msgid "Paragraph Text"
1013
  msgstr ""
1014
 
1015
- #: ../classes/class-ccf-form-manager.php:1485
1016
  msgid "Hidden"
1017
  msgstr ""
1018
 
1019
- #: ../classes/class-ccf-form-manager.php:1486
1020
  msgid "File Upload"
1021
  msgstr ""
1022
 
1023
- #: ../classes/class-ccf-form-manager.php:1490
1024
  msgid "HTML"
1025
  msgstr ""
1026
 
1027
- #: ../classes/class-ccf-form-manager.php:1491
1028
  msgid "Section Header"
1029
  msgstr ""
1030
 
1031
- #: ../classes/class-ccf-form-manager.php:1496
1032
  msgid "Name"
1033
  msgstr ""
1034
 
1035
- #: ../classes/class-ccf-form-manager.php:1497
1036
  msgid "Date/Time"
1037
  msgstr ""
1038
 
1039
- #: ../classes/class-ccf-form-manager.php:1498
1040
  msgid "Website"
1041
  msgstr ""
1042
 
1043
- #: ../classes/class-ccf-form-manager.php:1499
1044
  msgid "Address"
1045
  msgstr ""
1046
 
1047
- #: ../classes/class-ccf-form-manager.php:1500
1048
  msgid "Phone"
1049
  msgstr ""
1050
 
1051
- #: ../classes/class-ccf-form-manager.php:1501
1052
  msgid "reCAPTCHA"
1053
  msgstr ""
1054
 
1055
- #: ../classes/class-ccf-form-manager.php:1520
1056
  msgid "You have no email fields"
1057
  msgstr ""
1058
 
1059
- #: ../classes/class-ccf-form-manager.php:1521
 
 
 
 
1060
  msgid "Invalid date"
1061
  msgstr ""
1062
 
1063
- #: ../classes/class-ccf-form-manager.php:1523
1064
  msgid "Form Submission"
1065
  msgstr ""
1066
 
1067
- #: ../classes/class-ccf-form-manager.php:1524
1068
  #: ../classes/class-ccf-form-renderer.php:120
1069
  msgid "This form is paused right now. Check back later!"
1070
  msgstr ""
5
  "Project-Id-Version: Custom Contact Forms\n"
6
  "Report-Msgid-Bugs-To: https://github.com/tlovett1/custom-contact-forms/"
7
  "issues\n"
8
+ "POT-Creation-Date: 2015-06-29 10:27-0500\n"
9
+ "PO-Revision-Date: 2015-06-29 10:27-0500\n"
10
  "Last-Translator: Taylor Lovett <tlovett88@gmail.com>\n"
11
  "Language-Team: LANGUAGE <LL@li.org>\n"
12
  "Language: en\n"
60
  msgid "The post type \"%s\" is not valid"
61
  msgstr ""
62
 
63
+ #: ../classes/class-ccf-api.php:447 ../classes/class-ccf-api.php:762
64
+ #: ../classes/class-ccf-api.php:787 ../classes/class-ccf-api.php:816
65
+ #: ../classes/class-ccf-api.php:933
66
  msgid "Invalid form ID."
67
  msgstr ""
68
 
69
+ #: ../classes/class-ccf-api.php:452 ../classes/class-ccf-api.php:747
70
+ #: ../classes/class-ccf-api.php:767
71
  msgid "Sorry, you cannot view forms."
72
  msgstr ""
73
 
74
+ #: ../classes/class-ccf-api.php:793 ../classes/class-ccf-api.php:822
75
  msgid "Invalid form."
76
  msgstr ""
77
 
78
+ #: ../classes/class-ccf-api.php:797
79
  msgid "Sorry, you cannot view this form."
80
  msgstr ""
81
 
82
+ #: ../classes/class-ccf-api.php:944
83
  msgid "The form cannot be deleted."
84
  msgstr ""
85
 
86
+ #: ../classes/class-ccf-api.php:948
87
  msgid "Permanently deleted form"
88
  msgstr ""
89
 
90
+ #: ../classes/class-ccf-api.php:951
91
  #: ../vendor/wp-api/wp-api/lib/class-wp-json-posts.php:391
92
  msgid "Deleted post"
93
  msgstr ""
96
  msgid "Form Field Choices"
97
  msgstr ""
98
 
99
+ #: ../classes/class-ccf-custom-contact-forms.php:49
100
  #, php-format
101
  msgid ""
102
  "Custom Contact Forms will not work unless pretty permalinks (not default) "
103
  "are enabled. Please update your <a href=\"%s\">permalinks settings</a>."
104
  msgstr ""
105
 
106
+ #: ../classes/class-ccf-custom-contact-forms.php:67
107
  #, php-format
108
  msgid "<a href=\"%s\">Forms and Submissions</a>"
109
  msgstr ""
131
  msgstr ""
132
 
133
  #: ../classes/class-ccf-field-renderer.php:556
134
+ #: ../classes/class-ccf-form-manager.php:1151
135
+ #: ../classes/class-ccf-form-manager.php:1176
136
  msgid "Street Address"
137
  msgstr ""
138
 
139
  #: ../classes/class-ccf-field-renderer.php:560
140
+ #: ../classes/class-ccf-form-manager.php:1155
141
+ #: ../classes/class-ccf-form-manager.php:1180
142
  msgid "Address Line 2"
143
  msgstr ""
144
 
145
  #: ../classes/class-ccf-field-renderer.php:567
146
+ #: ../classes/class-ccf-form-manager.php:1159
147
+ #: ../classes/class-ccf-form-manager.php:1184
148
  msgid "City"
149
  msgstr ""
150
 
151
  #: ../classes/class-ccf-field-renderer.php:580
152
+ #: ../classes/class-ccf-form-manager.php:1167
153
  msgid "State"
154
  msgstr ""
155
 
156
  #: ../classes/class-ccf-field-renderer.php:588
157
+ #: ../classes/class-ccf-form-manager.php:1171
158
  msgid "ZIP Code"
159
  msgstr ""
160
 
161
  #: ../classes/class-ccf-field-renderer.php:598
162
+ #: ../classes/class-ccf-form-manager.php:1188
163
  msgid "State / Region / Province"
164
  msgstr ""
165
 
166
  #: ../classes/class-ccf-field-renderer.php:606
167
+ #: ../classes/class-ccf-form-manager.php:1192
168
  msgid "ZIP / Postal Code"
169
  msgstr ""
170
 
171
  #: ../classes/class-ccf-field-renderer.php:618
172
+ #: ../classes/class-ccf-form-manager.php:1200
173
  msgid "Country"
174
  msgstr ""
175
 
176
  #: ../classes/class-ccf-field-renderer.php:803
177
+ #: ../classes/class-ccf-form-manager.php:1215
178
+ #: ../classes/class-ccf-form-manager.php:1516
179
  msgid "Email"
180
  msgstr ""
181
 
182
  #: ../classes/class-ccf-field-renderer.php:810
183
+ #: ../classes/class-ccf-form-manager.php:1219
184
  msgid "Confirm Email"
185
  msgstr ""
186
 
187
  #: ../classes/class-ccf-field-renderer.php:876
188
+ #: ../classes/class-ccf-form-manager.php:1087
189
  msgid "First"
190
  msgstr ""
191
 
192
  #: ../classes/class-ccf-field-renderer.php:883
193
+ #: ../classes/class-ccf-form-manager.php:1091
194
  msgid "Last"
195
  msgstr ""
196
 
197
  #: ../classes/class-ccf-field-renderer.php:955
198
  #: ../classes/class-ccf-field-renderer.php:976
 
199
  #: ../classes/class-ccf-form-manager.php:1106
200
+ #: ../classes/class-ccf-form-manager.php:1127
201
  msgid "HH"
202
  msgstr ""
203
 
204
  #: ../classes/class-ccf-field-renderer.php:959
205
  #: ../classes/class-ccf-field-renderer.php:980
 
206
  #: ../classes/class-ccf-form-manager.php:1110
207
+ #: ../classes/class-ccf-form-manager.php:1131
208
  msgid "MM"
209
  msgstr ""
210
 
211
  #: ../classes/class-ccf-field-renderer.php:963
212
  #: ../classes/class-ccf-field-renderer.php:984
 
213
  #: ../classes/class-ccf-form-manager.php:1114
214
+ #: ../classes/class-ccf-form-manager.php:1135
215
  msgid "AM"
216
  msgstr ""
217
 
218
  #: ../classes/class-ccf-field-renderer.php:964
219
  #: ../classes/class-ccf-field-renderer.php:985
 
220
  #: ../classes/class-ccf-form-manager.php:1115
221
+ #: ../classes/class-ccf-form-manager.php:1136
222
  msgid "PM"
223
  msgstr ""
224
 
225
  #: ../classes/class-ccf-field-renderer.php:971
226
  #: ../classes/class-ccf-form-cpt.php:510
227
+ #: ../classes/class-ccf-form-manager.php:274
228
+ #: ../classes/class-ccf-form-manager.php:287
229
+ #: ../classes/class-ccf-form-manager.php:1122
230
+ #: ../classes/class-ccf-form-manager.php:1305
231
+ #: ../classes/class-ccf-form-manager.php:1319
232
+ #: ../classes/class-ccf-form-manager.php:1457
233
  msgid "Date"
234
  msgstr ""
235
 
239
 
240
  #: ../classes/class-ccf-form-cpt.php:326 ../classes/class-ccf-form-cpt.php:344
241
  #: ../classes/class-ccf-form-cpt.php:508
242
+ #: ../classes/class-ccf-form-manager.php:277
243
+ #: ../classes/class-ccf-form-manager.php:290
244
  msgid "Submissions"
245
  msgstr ""
246
 
281
  msgstr ""
282
 
283
  #: ../classes/class-ccf-form-cpt.php:446
284
+ #: ../classes/class-ccf-form-manager.php:1247
285
  msgid "(No title)"
286
  msgstr ""
287
 
294
  msgstr ""
295
 
296
  #: ../classes/class-ccf-form-cpt.php:507
297
+ #: ../classes/class-ccf-form-manager.php:275
298
+ #: ../classes/class-ccf-form-manager.php:288
299
  msgid "Author"
300
  msgstr ""
301
 
302
  #: ../classes/class-ccf-form-cpt.php:509
303
+ #: ../classes/class-ccf-form-manager.php:276
304
+ #: ../classes/class-ccf-form-manager.php:289
305
  msgid "Number of Fields"
306
  msgstr ""
307
 
478
  msgid "AM/PM is required."
479
  msgstr ""
480
 
481
+ #: ../classes/class-ccf-form-handler.php:708
482
  msgid "*Hidden Field*"
483
  msgstr ""
484
 
485
+ #: ../classes/class-ccf-form-handler.php:782
486
  msgid "Form submitted from"
487
  msgstr ""
488
 
489
+ #: ../classes/class-ccf-form-handler.php:791
490
  msgid "Form submitter IP"
491
  msgstr ""
492
 
493
+ #: ../classes/class-ccf-form-handler.php:846
494
  #, php-format
495
  msgid "%s: Form Submission"
496
  msgstr ""
497
 
498
+ #: ../classes/class-ccf-form-handler.php:848
499
  #, php-format
500
  msgid " to \"%s\""
501
  msgstr ""
502
 
503
+ #: ../classes/class-ccf-form-handler.php:863
504
  #: ../classes/class-ccf-form-renderer.php:134
505
  msgid "Thank you for your submission."
506
  msgstr ""
543
  msgstr ""
544
 
545
  #: ../classes/class-ccf-form-manager.php:133
546
+ #: ../classes/class-ccf-form-manager.php:1250
547
  msgid "Insert into post"
548
  msgstr ""
549
 
593
 
594
  #: ../classes/class-ccf-form-manager.php:177
595
  #: ../classes/class-ccf-form-manager.php:196
596
+ #: ../classes/class-ccf-form-manager.php:328
597
+ #: ../classes/class-ccf-form-manager.php:378
598
+ #: ../classes/class-ccf-form-manager.php:454
599
+ #: ../classes/class-ccf-form-manager.php:544
600
+ #: ../classes/class-ccf-form-manager.php:609
601
+ #: ../classes/class-ccf-form-manager.php:651
602
+ #: ../classes/class-ccf-form-manager.php:712
603
+ #: ../classes/class-ccf-form-manager.php:759
604
+ #: ../classes/class-ccf-form-manager.php:801
605
+ #: ../classes/class-ccf-form-manager.php:808
606
+ #: ../classes/class-ccf-form-manager.php:859
607
+ #: ../classes/class-ccf-form-manager.php:902
608
+ #: ../classes/class-ccf-form-manager.php:945
609
  msgid "No"
610
  msgstr ""
611
 
612
  #: ../classes/class-ccf-form-manager.php:178
613
  #: ../classes/class-ccf-form-manager.php:195
614
+ #: ../classes/class-ccf-form-manager.php:327
615
+ #: ../classes/class-ccf-form-manager.php:377
616
+ #: ../classes/class-ccf-form-manager.php:453
617
+ #: ../classes/class-ccf-form-manager.php:543
618
+ #: ../classes/class-ccf-form-manager.php:608
619
+ #: ../classes/class-ccf-form-manager.php:650
620
+ #: ../classes/class-ccf-form-manager.php:711
621
+ #: ../classes/class-ccf-form-manager.php:758
622
+ #: ../classes/class-ccf-form-manager.php:800
623
+ #: ../classes/class-ccf-form-manager.php:807
624
+ #: ../classes/class-ccf-form-manager.php:858
625
+ #: ../classes/class-ccf-form-manager.php:901
626
+ #: ../classes/class-ccf-form-manager.php:944
627
  msgid "Yes"
628
  msgstr ""
629
 
656
  msgstr ""
657
 
658
  #: ../classes/class-ccf-form-manager.php:210
659
+ #: ../classes/class-ccf-form-manager.php:231
660
  msgid "Form Field"
661
  msgstr ""
662
 
674
  msgid "Pull \"From\" Email Dynamically from Field:"
675
  msgstr ""
676
 
677
+ #: ../classes/class-ccf-form-manager.php:228
678
+ msgid "\"From\" Name Type:"
679
+ msgstr ""
680
+
681
+ #: ../classes/class-ccf-form-manager.php:230
682
+ msgid "Custom Name"
683
+ msgstr ""
684
+
685
+ #: ../classes/class-ccf-form-manager.php:234
686
+ msgid ""
687
+ "You can set the notification emails from name to be a custom name or pull "
688
+ "the name from a field in the form."
689
+ msgstr ""
690
+
691
+ #: ../classes/class-ccf-form-manager.php:238
692
+ msgid "Custom \"From\" Name:"
693
+ msgstr ""
694
+
695
+ #: ../classes/class-ccf-form-manager.php:243
696
+ msgid "Pull \"From\" Name Dynamically from Field:"
697
+ msgstr ""
698
+
699
+ #: ../classes/class-ccf-form-manager.php:257
700
  msgid "items"
701
  msgstr ""
702
 
703
+ #: ../classes/class-ccf-form-manager.php:272
704
+ #: ../classes/class-ccf-form-manager.php:285
705
  msgid "ID"
706
  msgstr ""
707
 
708
+ #: ../classes/class-ccf-form-manager.php:273
709
+ #: ../classes/class-ccf-form-manager.php:286
710
  msgid "Title"
711
  msgstr ""
712
 
713
+ #: ../classes/class-ccf-form-manager.php:300
714
  msgid "<span>&larr;</span> Click on a field to edit it."
715
  msgstr ""
716
 
717
+ #: ../classes/class-ccf-form-manager.php:309
718
+ #: ../classes/class-ccf-form-manager.php:353
719
+ #: ../classes/class-ccf-form-manager.php:435
720
+ #: ../classes/class-ccf-form-manager.php:525
721
  msgid "Internal Unique Slug"
722
  msgstr ""
723
 
724
+ #: ../classes/class-ccf-form-manager.php:313
725
+ #: ../classes/class-ccf-form-manager.php:357
726
+ #: ../classes/class-ccf-form-manager.php:400
727
+ #: ../classes/class-ccf-form-manager.php:439
728
+ #: ../classes/class-ccf-form-manager.php:529
729
+ #: ../classes/class-ccf-form-manager.php:598
730
+ #: ../classes/class-ccf-form-manager.php:634
731
+ #: ../classes/class-ccf-form-manager.php:690
732
+ #: ../classes/class-ccf-form-manager.php:741
733
+ #: ../classes/class-ccf-form-manager.php:784
734
+ #: ../classes/class-ccf-form-manager.php:848
735
+ #: ../classes/class-ccf-form-manager.php:891
736
+ #: ../classes/class-ccf-form-manager.php:934
737
  msgid "Label:"
738
  msgstr ""
739
 
740
+ #: ../classes/class-ccf-form-manager.php:317
741
+ #: ../classes/class-ccf-form-manager.php:361
742
+ #: ../classes/class-ccf-form-manager.php:404
743
+ #: ../classes/class-ccf-form-manager.php:443
744
+ #: ../classes/class-ccf-form-manager.php:533
745
+ #: ../classes/class-ccf-form-manager.php:602
746
+ #: ../classes/class-ccf-form-manager.php:638
747
+ #: ../classes/class-ccf-form-manager.php:694
748
+ #: ../classes/class-ccf-form-manager.php:745
749
+ #: ../classes/class-ccf-form-manager.php:788
750
+ #: ../classes/class-ccf-form-manager.php:852
751
+ #: ../classes/class-ccf-form-manager.php:895
752
+ #: ../classes/class-ccf-form-manager.php:938
753
  msgid "Description:"
754
  msgstr ""
755
 
756
+ #: ../classes/class-ccf-form-manager.php:321
757
+ #: ../classes/class-ccf-form-manager.php:447
758
+ #: ../classes/class-ccf-form-manager.php:537
759
+ #: ../classes/class-ccf-form-manager.php:573
760
+ #: ../classes/class-ccf-form-manager.php:643
761
+ #: ../classes/class-ccf-form-manager.php:698
762
+ #: ../classes/class-ccf-form-manager.php:793
763
  msgid "Initial Value:"
764
  msgstr ""
765
 
766
+ #: ../classes/class-ccf-form-manager.php:325
767
+ #: ../classes/class-ccf-form-manager.php:375
768
+ #: ../classes/class-ccf-form-manager.php:451
769
+ #: ../classes/class-ccf-form-manager.php:541
770
+ #: ../classes/class-ccf-form-manager.php:606
771
+ #: ../classes/class-ccf-form-manager.php:648
772
+ #: ../classes/class-ccf-form-manager.php:709
773
+ #: ../classes/class-ccf-form-manager.php:756
774
+ #: ../classes/class-ccf-form-manager.php:798
775
+ #: ../classes/class-ccf-form-manager.php:856
776
+ #: ../classes/class-ccf-form-manager.php:899
777
+ #: ../classes/class-ccf-form-manager.php:942
778
  msgid "Required:"
779
  msgstr ""
780
 
781
+ #: ../classes/class-ccf-form-manager.php:334
782
+ #: ../classes/class-ccf-form-manager.php:384
783
+ #: ../classes/class-ccf-form-manager.php:420
784
+ #: ../classes/class-ccf-form-manager.php:460
785
+ #: ../classes/class-ccf-form-manager.php:485
786
+ #: ../classes/class-ccf-form-manager.php:510
787
+ #: ../classes/class-ccf-form-manager.php:550
788
+ #: ../classes/class-ccf-form-manager.php:579
789
+ #: ../classes/class-ccf-form-manager.php:615
790
+ #: ../classes/class-ccf-form-manager.php:665
791
+ #: ../classes/class-ccf-form-manager.php:718
792
+ #: ../classes/class-ccf-form-manager.php:765
793
+ #: ../classes/class-ccf-form-manager.php:814
794
+ #: ../classes/class-ccf-form-manager.php:872
795
+ #: ../classes/class-ccf-form-manager.php:915
796
+ #: ../classes/class-ccf-form-manager.php:958
797
  msgid "Advanced"
798
  msgstr ""
799
 
800
+ #: ../classes/class-ccf-form-manager.php:337
801
+ #: ../classes/class-ccf-form-manager.php:387
802
+ #: ../classes/class-ccf-form-manager.php:423
803
+ #: ../classes/class-ccf-form-manager.php:463
804
+ #: ../classes/class-ccf-form-manager.php:488
805
+ #: ../classes/class-ccf-form-manager.php:513
806
+ #: ../classes/class-ccf-form-manager.php:553
807
+ #: ../classes/class-ccf-form-manager.php:582
808
+ #: ../classes/class-ccf-form-manager.php:618
809
+ #: ../classes/class-ccf-form-manager.php:668
810
+ #: ../classes/class-ccf-form-manager.php:721
811
+ #: ../classes/class-ccf-form-manager.php:768
812
+ #: ../classes/class-ccf-form-manager.php:817
813
+ #: ../classes/class-ccf-form-manager.php:875
814
+ #: ../classes/class-ccf-form-manager.php:918
815
+ #: ../classes/class-ccf-form-manager.php:961
816
  msgid "Class Name:"
817
  msgstr ""
818
 
819
+ #: ../classes/class-ccf-form-manager.php:341
820
+ #: ../classes/class-ccf-form-manager.php:467
821
+ #: ../classes/class-ccf-form-manager.php:557
822
+ #: ../classes/class-ccf-form-manager.php:673
823
+ #: ../classes/class-ccf-form-manager.php:725
824
+ #: ../classes/class-ccf-form-manager.php:822
825
  msgid "Placeholder Text:"
826
  msgstr ""
827
 
828
+ #: ../classes/class-ccf-form-manager.php:365
829
  msgid "Allowed File Extensions (comma separate):"
830
  msgstr ""
831
 
832
+ #: ../classes/class-ccf-form-manager.php:367
833
  msgid ""
834
  "If left blank, will default to all extensions registered by WordPress. If "
835
  "you use a file extension or mime type not <a href=\"http://codex.wordpress."
837
  "a>, you will need to filter and manually whitelist the new extension."
838
  msgstr ""
839
 
840
+ #: ../classes/class-ccf-form-manager.php:370
841
  msgid "Max File Size (in MB):"
842
  msgstr ""
843
 
844
+ #: ../classes/class-ccf-form-manager.php:372
845
  #, php-format
846
  msgid ""
847
  "If left blank, will default to %d MB. Maximum allowed by server is %d MB."
848
  msgstr ""
849
 
850
+ #: ../classes/class-ccf-form-manager.php:398
851
  msgid ""
852
  "reCAPTCHA is a simple captcha service provided by Google. <a target=\"_blank"
853
  "\" href=\"https://www.google.com/recaptcha/intro/index.html\">Learn more</a>"
854
  msgstr ""
855
 
856
+ #: ../classes/class-ccf-form-manager.php:408
857
  msgid "Site Key:"
858
  msgstr ""
859
 
860
+ #: ../classes/class-ccf-form-manager.php:410
861
+ #: ../classes/class-ccf-form-manager.php:415
862
  msgid "Don't have one?"
863
  msgstr ""
864
 
865
+ #: ../classes/class-ccf-form-manager.php:413
866
  msgid "Secret Key:"
867
  msgstr ""
868
 
 
869
  #: ../classes/class-ccf-form-manager.php:476
870
+ #: ../classes/class-ccf-form-manager.php:497
871
+ #: ../classes/class-ccf-form-manager.php:522
872
+ #: ../classes/class-ccf-form-manager.php:566
873
+ #: ../classes/class-ccf-form-manager.php:591
874
+ #: ../classes/class-ccf-form-manager.php:627
875
+ #: ../classes/class-ccf-form-manager.php:683
876
+ #: ../classes/class-ccf-form-manager.php:734
877
+ #: ../classes/class-ccf-form-manager.php:777
878
+ #: ../classes/class-ccf-form-manager.php:841
879
+ #: ../classes/class-ccf-form-manager.php:884
880
+ #: ../classes/class-ccf-form-manager.php:927
881
  msgid "Basic"
882
  msgstr ""
883
 
884
+ #: ../classes/class-ccf-form-manager.php:479
885
  msgid "HTML Content:"
886
  msgstr ""
887
 
888
+ #: ../classes/class-ccf-form-manager.php:500
889
  msgid "Heading:"
890
  msgstr ""
891
 
892
+ #: ../classes/class-ccf-form-manager.php:504
893
  msgid "Sub Heading:"
894
  msgstr ""
895
 
896
+ #: ../classes/class-ccf-form-manager.php:569
897
+ #: ../classes/class-ccf-form-manager.php:594
898
+ #: ../classes/class-ccf-form-manager.php:630
899
+ #: ../classes/class-ccf-form-manager.php:686
900
+ #: ../classes/class-ccf-form-manager.php:737
901
+ #: ../classes/class-ccf-form-manager.php:780
902
+ #: ../classes/class-ccf-form-manager.php:844
903
+ #: ../classes/class-ccf-form-manager.php:887
904
+ #: ../classes/class-ccf-form-manager.php:930
905
  msgid "Internal Unique Slug (a-z, 0-9, -, _):"
906
  msgstr ""
907
 
908
+ #: ../classes/class-ccf-form-manager.php:656
909
  msgid "Enable Date Select"
910
  msgstr ""
911
 
912
+ #: ../classes/class-ccf-form-manager.php:660
913
  msgid "Enable Time Select"
914
  msgstr ""
915
 
916
+ #: ../classes/class-ccf-form-manager.php:702
917
  msgid "Format:"
918
  msgstr ""
919
 
920
+ #: ../classes/class-ccf-form-manager.php:705
921
+ #: ../classes/class-ccf-form-manager.php:752
922
  msgid "International"
923
  msgstr ""
924
 
925
+ #: ../classes/class-ccf-form-manager.php:749
926
  msgid "Type:"
927
  msgstr ""
928
 
929
+ #: ../classes/class-ccf-form-manager.php:751
930
  msgid "United States"
931
  msgstr ""
932
 
933
+ #: ../classes/class-ccf-form-manager.php:805
934
  msgid "Require Confirmation:"
935
  msgstr ""
936
 
937
+ #: ../classes/class-ccf-form-manager.php:833
938
  msgid "Label"
939
  msgstr ""
940
 
941
+ #: ../classes/class-ccf-form-manager.php:834
942
  msgid "Value"
943
  msgstr ""
944
 
945
+ #: ../classes/class-ccf-form-manager.php:863
946
+ #: ../classes/class-ccf-form-manager.php:906
947
+ #: ../classes/class-ccf-form-manager.php:949
948
  msgid "Manage field choices:"
949
  msgstr ""
950
 
951
+ #: ../classes/class-ccf-form-manager.php:867
952
+ #: ../classes/class-ccf-form-manager.php:910
953
+ #: ../classes/class-ccf-form-manager.php:953
954
  msgid ""
955
  "Note: If an option does not have a \"value\", it will not be considered a "
956
  "valid selection if the field is required. The \"value\" is what's read, "
957
  "stored, and displayed in the submission."
958
  msgstr ""
959
 
960
+ #: ../classes/class-ccf-form-manager.php:970
961
  msgid "You currently have no forms. Add some!"
962
  msgstr ""
963
 
964
+ #: ../classes/class-ccf-form-manager.php:993
965
  msgid "Allowed file extensions are {{ extensions }}. "
966
  msgstr ""
967
 
968
+ #: ../classes/class-ccf-form-manager.php:995
969
  msgid "Max file size is {{ file_size }} MB. "
970
  msgstr ""
971
 
972
+ #: ../classes/class-ccf-form-manager.php:1020
973
+ #: ../classes/class-ccf-form-manager.php:1036
974
+ #: ../classes/class-ccf-form-manager.php:1054
975
  msgid "An example choice"
976
  msgstr ""
977
 
978
+ #: ../classes/class-ccf-form-manager.php:1072
979
  msgid "Arbitrary block of HTML."
980
  msgstr ""
981
 
982
+ #: ../classes/class-ccf-form-manager.php:1078
983
  msgid "Section Heading"
984
  msgstr ""
985
 
986
+ #: ../classes/class-ccf-form-manager.php:1080
987
  msgid "This is the sub-heading text."
988
  msgstr ""
989
 
990
+ #: ../classes/class-ccf-form-manager.php:1211
991
  msgid "email@example.com"
992
  msgstr ""
993
 
994
+ #: ../classes/class-ccf-form-manager.php:1249
995
  msgid "Edit"
996
  msgstr ""
997
 
998
+ #: ../classes/class-ccf-form-manager.php:1251
999
  msgid "Trash"
1000
  msgstr ""
1001
 
1002
+ #: ../classes/class-ccf-form-manager.php:1294
1003
  msgid "There is a problem with this form. Is it trashed or deleted?"
1004
  msgstr ""
1005
 
1006
+ #: ../classes/class-ccf-form-manager.php:1436
1007
  msgid "IP Address"
1008
  msgstr ""
1009
 
1010
+ #: ../classes/class-ccf-form-manager.php:1448
1011
  msgid "There are no submissions."
1012
  msgstr ""
1013
 
1014
+ #: ../classes/class-ccf-form-manager.php:1477
1015
  msgid "Add Form"
1016
  msgstr ""
1017
 
1018
+ #: ../classes/class-ccf-form-manager.php:1501
1019
  msgid "Single Line Text"
1020
  msgstr ""
1021
 
1022
+ #: ../classes/class-ccf-form-manager.php:1502
1023
  msgid "Dropdown"
1024
  msgstr ""
1025
 
1026
+ #: ../classes/class-ccf-form-manager.php:1503
1027
  msgid "Checkboxes"
1028
  msgstr ""
1029
 
1030
+ #: ../classes/class-ccf-form-manager.php:1504
1031
  msgid "Radio Buttons"
1032
  msgstr ""
1033
 
1034
+ #: ../classes/class-ccf-form-manager.php:1505
1035
  msgid "Paragraph Text"
1036
  msgstr ""
1037
 
1038
+ #: ../classes/class-ccf-form-manager.php:1506
1039
  msgid "Hidden"
1040
  msgstr ""
1041
 
1042
+ #: ../classes/class-ccf-form-manager.php:1507
1043
  msgid "File Upload"
1044
  msgstr ""
1045
 
1046
+ #: ../classes/class-ccf-form-manager.php:1511
1047
  msgid "HTML"
1048
  msgstr ""
1049
 
1050
+ #: ../classes/class-ccf-form-manager.php:1512
1051
  msgid "Section Header"
1052
  msgstr ""
1053
 
1054
+ #: ../classes/class-ccf-form-manager.php:1517
1055
  msgid "Name"
1056
  msgstr ""
1057
 
1058
+ #: ../classes/class-ccf-form-manager.php:1518
1059
  msgid "Date/Time"
1060
  msgstr ""
1061
 
1062
+ #: ../classes/class-ccf-form-manager.php:1519
1063
  msgid "Website"
1064
  msgstr ""
1065
 
1066
+ #: ../classes/class-ccf-form-manager.php:1520
1067
  msgid "Address"
1068
  msgstr ""
1069
 
1070
+ #: ../classes/class-ccf-form-manager.php:1521
1071
  msgid "Phone"
1072
  msgstr ""
1073
 
1074
+ #: ../classes/class-ccf-form-manager.php:1522
1075
  msgid "reCAPTCHA"
1076
  msgstr ""
1077
 
1078
+ #: ../classes/class-ccf-form-manager.php:1541
1079
  msgid "You have no email fields"
1080
  msgstr ""
1081
 
1082
+ #: ../classes/class-ccf-form-manager.php:1542
1083
+ msgid "You have no name fields"
1084
+ msgstr ""
1085
+
1086
+ #: ../classes/class-ccf-form-manager.php:1543
1087
  msgid "Invalid date"
1088
  msgstr ""
1089
 
1090
+ #: ../classes/class-ccf-form-manager.php:1545
1091
  msgid "Form Submission"
1092
  msgstr ""
1093
 
1094
+ #: ../classes/class-ccf-form-manager.php:1546
1095
  #: ../classes/class-ccf-form-renderer.php:120
1096
  msgid "This form is paused right now. Check back later!"
1097
  msgstr ""
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
4
  Tags: contact form, web form, custom contact form, custom forms, captcha form, contact fields, form mailers, forms
5
  Requires at least: 3.9
6
  Tested up to: 4.3
7
- Stable tag: 6.7.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -35,6 +35,11 @@ For questions, feature requests, and support concerning the Custom Contact Forms
35
 
36
  == Changelog ==
37
 
 
 
 
 
 
38
  = 6.7.3 =
39
  * Fix WP SEO conflict rooted in a rewrites bug
40
 
4
  Tags: contact form, web form, custom contact form, custom forms, captcha form, contact fields, form mailers, forms
5
  Requires at least: 3.9
6
  Tested up to: 4.3
7
+ Stable tag: 6.8
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
35
 
36
  == Changelog ==
37
 
38
+ = 6.8 =
39
+ * Configurable "from" name field
40
+ * Minor variable stomping bug fix
41
+ * Successful/unsuccessful submission hooks
42
+
43
  = 6.7.3 =
44
  * Fix WP SEO conflict rooted in a rewrites bug
45