Version Description
- New feature: Form width style control, allowing to set form width in % or px.
- New feature: Text alignment style control to allow for changing text align in various places in forms.
- New feature: Added support for RTL languages with Text direction control in Style step.
- Improvement: Added filters to control default part values and success/error submission actions.
- Bug fix: array_column wasn't available on PHP versions prior to 5.5 and was causing a fatal error.
Download this release
Release Info
Developer | thethemefoundry |
Plugin | Form builder to get in touch with visitors, grow your email list and collect payments — Happyforms |
Version | 1.4.1 |
Comparing to | |
See all releases |
Code changes from version 1.4 to 1.4.1
- assets/css/customize.css +22 -3
- assets/css/frontend.css +120 -0
- assets/js/customize.js +98 -10
- assets/js/parts/part-scale.js +4 -3
- happyforms.php +2 -2
- inc/classes/class-form-controller.php +1 -1
- inc/classes/class-form-styles.php +92 -0
- inc/classes/class-message-admin.php +7 -5
- inc/classes/class-message-controller.php +73 -19
- inc/classes/parts/class-part-scale.php +9 -0
- inc/helpers/helper-form-templates.php +50 -0
- inc/templates/admin-message-edit.php +3 -10
- inc/templates/customize-form-style.php +23 -10
- inc/templates/parts/frontend-address.php +5 -5
- inc/templates/parts/frontend-checkbox.php +5 -1
- inc/templates/parts/frontend-date.php +11 -18
- inc/templates/parts/frontend-email.php +1 -1
- inc/templates/parts/frontend-multi-line-text.php +1 -1
- inc/templates/parts/frontend-number.php +2 -2
- inc/templates/parts/frontend-phone.php +1 -1
- inc/templates/parts/frontend-radio.php +5 -1
- inc/templates/parts/frontend-rating.php +1 -1
- inc/templates/parts/frontend-scale.php +1 -2
- inc/templates/parts/frontend-select.php +5 -1
- inc/templates/parts/frontend-single-line-text.php +1 -1
- inc/templates/parts/frontend-title.php +1 -1
- inc/templates/parts/frontend-website-url.php +1 -1
- readme.txt +11 -1
assets/css/customize.css
CHANGED
@@ -668,7 +668,7 @@ ul.happyforms-style-controls .customize-control {
|
|
668 |
.happyforms-stack-view.happyforms-style-view {
|
669 |
padding: 0;
|
670 |
overflow: hidden;
|
671 |
-
top:
|
672 |
bottom: 0;
|
673 |
}
|
674 |
|
@@ -696,7 +696,7 @@ ul.happyforms-style-controls .customize-control.happyforms-divider-control.activ
|
|
696 |
ul.happyforms-style-controls .customize-control.happyforms-divider-control h3 {
|
697 |
text-transform: capitalize;
|
698 |
}
|
699 |
-
|
700 |
.happyforms-style-controls-group {
|
701 |
position: absolute;
|
702 |
top: 0;
|
@@ -787,11 +787,30 @@ li.customize-control.happyforms-range-control input {
|
|
787 |
|
788 |
li.customize-control.happyforms-range-control .happyforms-range-slider {
|
789 |
float: left;
|
790 |
-
width:
|
791 |
margin-left: 5%;
|
792 |
margin-top: 9px;
|
793 |
}
|
794 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
795 |
li.customize-control.happyforms-range-control .ui-slider-handle {
|
796 |
position: absolute;
|
797 |
z-index: 2;
|
668 |
.happyforms-stack-view.happyforms-style-view {
|
669 |
padding: 0;
|
670 |
overflow: hidden;
|
671 |
+
top: 1px;
|
672 |
bottom: 0;
|
673 |
}
|
674 |
|
696 |
ul.happyforms-style-controls .customize-control.happyforms-divider-control h3 {
|
697 |
text-transform: capitalize;
|
698 |
}
|
699 |
+
|
700 |
.happyforms-style-controls-group {
|
701 |
position: absolute;
|
702 |
top: 0;
|
787 |
|
788 |
li.customize-control.happyforms-range-control .happyforms-range-slider {
|
789 |
float: left;
|
790 |
+
width: 57%;
|
791 |
margin-left: 5%;
|
792 |
margin-top: 9px;
|
793 |
}
|
794 |
|
795 |
+
li.customize-control.happyforms-range-control select.happyforms-unit-switch {
|
796 |
+
position: relative;
|
797 |
+
top: -1px;
|
798 |
+
float: left;
|
799 |
+
width: 40px;
|
800 |
+
}
|
801 |
+
|
802 |
+
li.customize-control.happyforms-range-control input[type=number] {
|
803 |
+
padding-right: 2px;
|
804 |
+
}
|
805 |
+
|
806 |
+
@media screen and (max-width: 782px) {
|
807 |
+
li.customize-control.happyforms-range-control input[type=number] {
|
808 |
+
height: auto;
|
809 |
+
line-height: 1;
|
810 |
+
font-size: 12px;
|
811 |
+
}
|
812 |
+
}
|
813 |
+
|
814 |
li.customize-control.happyforms-range-control .ui-slider-handle {
|
815 |
position: absolute;
|
816 |
z-index: 2;
|
assets/css/frontend.css
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
:root {
|
|
|
2 |
/* colors */
|
3 |
--happyforms-color-primary: #000;
|
4 |
--happyforms-color-success: #39b54a;
|
@@ -38,6 +39,8 @@
|
|
38 |
|
39 |
.happyforms-form form {
|
40 |
max-width: 100%;
|
|
|
|
|
41 |
border-style: solid;
|
42 |
border-width: 0;
|
43 |
font-weight: normal;
|
@@ -45,6 +48,10 @@
|
|
45 |
background-color: transparent;
|
46 |
}
|
47 |
|
|
|
|
|
|
|
|
|
48 |
h3.happyforms-form__title {
|
49 |
margin: 0;
|
50 |
padding: 0 1%;
|
@@ -59,6 +66,14 @@ h3.happyforms-form__title {
|
|
59 |
display: none;
|
60 |
}
|
61 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
/* parts - general */
|
63 |
|
64 |
.happyforms-form__part {
|
@@ -101,6 +116,14 @@ h3.happyforms-form__title {
|
|
101 |
color: var(--happyforms-color-primary);
|
102 |
}
|
103 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
.happyforms-part input[type=text],
|
105 |
.happyforms-part input[type=email],
|
106 |
.happyforms-part input[type=tel],
|
@@ -129,6 +152,47 @@ h3.happyforms-form__title {
|
|
129 |
transition-timing-function: ease-in;
|
130 |
}
|
131 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
132 |
.happyforms-form--part-border-off .happyforms-part input[type=text],
|
133 |
.happyforms-form--part-border-off .happyforms-part input[type=email],
|
134 |
.happyforms-form--part-border-off .happyforms-part input[type=tel],
|
@@ -359,6 +423,11 @@ h3.happyforms-form__title {
|
|
359 |
padding: 0 10px;
|
360 |
}
|
361 |
|
|
|
|
|
|
|
|
|
|
|
362 |
.happyforms-part-option {
|
363 |
margin-bottom: 20px;
|
364 |
}
|
@@ -399,6 +468,11 @@ h3.happyforms-form__title {
|
|
399 |
pointer-events: none;
|
400 |
}
|
401 |
|
|
|
|
|
|
|
|
|
|
|
402 |
.happyforms-tooltip__trigger {
|
403 |
display: block;
|
404 |
position: absolute;
|
@@ -413,6 +487,16 @@ h3.happyforms-form__title {
|
|
413 |
cursor: pointer;
|
414 |
}
|
415 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
416 |
.happyforms-tooltip__trigger:after {
|
417 |
content: "?";
|
418 |
display: block;
|
@@ -450,6 +534,12 @@ h3.happyforms-form__title {
|
|
450 |
transition: opacity 0.2s;
|
451 |
}
|
452 |
|
|
|
|
|
|
|
|
|
|
|
|
|
453 |
.happyforms-form--part-inner-padding-wide .happyforms-tooltip .happyforms-part__description {
|
454 |
transform: translate(0, -100%);
|
455 |
}
|
@@ -481,6 +571,12 @@ h3.happyforms-form__title {
|
|
481 |
border-top-color: #dbdbdb;
|
482 |
}
|
483 |
|
|
|
|
|
|
|
|
|
|
|
|
|
484 |
.happyforms-tooltip .happyforms-part__description:after {
|
485 |
content: '';
|
486 |
position: absolute;
|
@@ -493,6 +589,12 @@ h3.happyforms-form__title {
|
|
493 |
border-top-color: var(--happyforms-color-part-background);
|
494 |
}
|
495 |
|
|
|
|
|
|
|
|
|
|
|
|
|
496 |
.happyforms-tooltip:hover .happyforms-part__description {
|
497 |
visibility: visible;
|
498 |
opacity: 1;
|
@@ -753,6 +855,16 @@ h3.happyforms-form__title {
|
|
753 |
margin-bottom: 10px;
|
754 |
}
|
755 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
756 |
/* parts - placeholder */
|
757 |
|
758 |
.happyforms-part--placeholder p {
|
@@ -760,6 +872,14 @@ h3.happyforms-form__title {
|
|
760 |
color: #000;
|
761 |
}
|
762 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
763 |
.happyforms-part--placeholder p:first-child {
|
764 |
margin-top: 0;
|
765 |
}
|
1 |
:root {
|
2 |
+
--happyforms-form-width: 100%;
|
3 |
/* colors */
|
4 |
--happyforms-color-primary: #000;
|
5 |
--happyforms-color-success: #39b54a;
|
39 |
|
40 |
.happyforms-form form {
|
41 |
max-width: 100%;
|
42 |
+
max-width: var(--happyforms-form-width);
|
43 |
+
margin: 0 auto;
|
44 |
border-style: solid;
|
45 |
border-width: 0;
|
46 |
font-weight: normal;
|
48 |
background-color: transparent;
|
49 |
}
|
50 |
|
51 |
+
.happyforms-form--direction-rtl {
|
52 |
+
direction: rtl;
|
53 |
+
}
|
54 |
+
|
55 |
h3.happyforms-form__title {
|
56 |
margin: 0;
|
57 |
padding: 0 1%;
|
66 |
display: none;
|
67 |
}
|
68 |
|
69 |
+
.happyforms-form--title-text-align-right h3.happyforms-form__title {
|
70 |
+
text-align: right;
|
71 |
+
}
|
72 |
+
|
73 |
+
.happyforms-form--title-text-align-center h3.happyforms-form__title {
|
74 |
+
text-align: center;
|
75 |
+
}
|
76 |
+
|
77 |
/* parts - general */
|
78 |
|
79 |
.happyforms-form__part {
|
116 |
color: var(--happyforms-color-primary);
|
117 |
}
|
118 |
|
119 |
+
.happyforms-form--part-description-text-align-center .happyforms-part__description {
|
120 |
+
text-align: center;
|
121 |
+
}
|
122 |
+
|
123 |
+
.happyforms-form--part-description-text-align-right .happyforms-part__description {
|
124 |
+
text-align: right;
|
125 |
+
}
|
126 |
+
|
127 |
.happyforms-part input[type=text],
|
128 |
.happyforms-part input[type=email],
|
129 |
.happyforms-part input[type=tel],
|
152 |
transition-timing-function: ease-in;
|
153 |
}
|
154 |
|
155 |
+
.happyforms-form--part-value-text-align-center .happyforms-part input[type=text],
|
156 |
+
.happyforms-form--part-value-text-align-center .happyforms-part input[type=email],
|
157 |
+
.happyforms-form--part-value-text-align-center .happyforms-part input[type=tel],
|
158 |
+
.happyforms-form--part-value-text-align-center .happyforms-part input[type=number],
|
159 |
+
.happyforms-form--part-value-text-align-center .happyforms-part textarea,
|
160 |
+
.happyforms-form--part-value-text-align-center .happyforms-part--checkbox .option-label,
|
161 |
+
.happyforms-form--part-value-text-align-center .happyforms-part--checkbox .happyforms-part__el,
|
162 |
+
.happyforms-form--part-value-text-align-center .happyforms-part--radio .option-label {
|
163 |
+
text-align: center;
|
164 |
+
}
|
165 |
+
|
166 |
+
.happyforms-form--part-value-text-align-center .happyforms-part select {
|
167 |
+
text-align: justify;
|
168 |
+
text-align-last: center;
|
169 |
+
}
|
170 |
+
|
171 |
+
.happyforms-form--part-value-text-align-center .happyforms-part--radio .happyforms-part__el {
|
172 |
+
justify-content: center;
|
173 |
+
}
|
174 |
+
|
175 |
+
.happyforms-form--part-value-text-align-right .happyforms-part input[type=text],
|
176 |
+
.happyforms-form--part-value-text-align-right .happyforms-part input[type=email],
|
177 |
+
.happyforms-form--part-value-text-align-right .happyforms-part input[type=tel],
|
178 |
+
.happyforms-form--part-value-text-align-right .happyforms-part input[type=number],
|
179 |
+
.happyforms-form--part-value-text-align-right .happyforms-part textarea,
|
180 |
+
.happyforms-form--part-value-text-align-right .happyforms-part--checkbox .option-label,
|
181 |
+
.happyforms-form--part-value-text-align-right .happyforms-part--checkbox .happyforms-part__el,
|
182 |
+
.happyforms-form--part-value-text-align-right .happyforms-part--radio .option-label {
|
183 |
+
text-align: right;
|
184 |
+
}
|
185 |
+
|
186 |
+
.happyforms-form--part-value-text-align-right .happyforms-part--radio .happyforms-part__el {
|
187 |
+
justify-content: flex-end;
|
188 |
+
}
|
189 |
+
|
190 |
+
.happyforms-form--part-value-text-align-right .happyforms-part select {
|
191 |
+
padding-right: 45px;
|
192 |
+
text-align: justify;
|
193 |
+
text-align-last: right;
|
194 |
+
}
|
195 |
+
|
196 |
.happyforms-form--part-border-off .happyforms-part input[type=text],
|
197 |
.happyforms-form--part-border-off .happyforms-part input[type=email],
|
198 |
.happyforms-form--part-border-off .happyforms-part input[type=tel],
|
423 |
padding: 0 10px;
|
424 |
}
|
425 |
|
426 |
+
.happyforms-form--direction-rtl .happyforms-part--radio .option-label .label,
|
427 |
+
.happyforms-form--direction-rtl .happyforms-part--checkbox .option-label .label {
|
428 |
+
margin-right: 0;
|
429 |
+
}
|
430 |
+
|
431 |
.happyforms-part-option {
|
432 |
margin-bottom: 20px;
|
433 |
}
|
468 |
pointer-events: none;
|
469 |
}
|
470 |
|
471 |
+
.happyforms-form--direction-rtl .happyforms-tooltip {
|
472 |
+
left: 0;
|
473 |
+
right: auto;
|
474 |
+
}
|
475 |
+
|
476 |
.happyforms-tooltip__trigger {
|
477 |
display: block;
|
478 |
position: absolute;
|
487 |
cursor: pointer;
|
488 |
}
|
489 |
|
490 |
+
.happyforms-form--part-value-text-align-right .happyforms-tooltip__trigger {
|
491 |
+
right: auto;
|
492 |
+
left: 1px;
|
493 |
+
}
|
494 |
+
|
495 |
+
.happyforms-form--direction-rtl .happyforms-tooltip__trigger {
|
496 |
+
left: 1px;
|
497 |
+
right: auto;
|
498 |
+
}
|
499 |
+
|
500 |
.happyforms-tooltip__trigger:after {
|
501 |
content: "?";
|
502 |
display: block;
|
534 |
transition: opacity 0.2s;
|
535 |
}
|
536 |
|
537 |
+
.happyforms-form--part-value-text-align-right .happyforms-tooltip .happyforms-part__description,
|
538 |
+
.happyforms-form--direction-rtl .happyforms-tooltip .happyforms-part__description {
|
539 |
+
right: auto;
|
540 |
+
left: 0;
|
541 |
+
}
|
542 |
+
|
543 |
.happyforms-form--part-inner-padding-wide .happyforms-tooltip .happyforms-part__description {
|
544 |
transform: translate(0, -100%);
|
545 |
}
|
571 |
border-top-color: #dbdbdb;
|
572 |
}
|
573 |
|
574 |
+
.happyforms-form--part-value-text-align-right .happyforms-tooltip .happyforms-part__description:before,
|
575 |
+
.happyforms-form--direction-rtl .happyforms-part__description:before {
|
576 |
+
right: auto;
|
577 |
+
left: 12px;
|
578 |
+
}
|
579 |
+
|
580 |
.happyforms-tooltip .happyforms-part__description:after {
|
581 |
content: '';
|
582 |
position: absolute;
|
589 |
border-top-color: var(--happyforms-color-part-background);
|
590 |
}
|
591 |
|
592 |
+
.happyforms-form--part-value-text-align-right .happyforms-tooltip .happyforms-part__description:after,
|
593 |
+
.happyforms-form--direction-rtl .happyforms-part__description:after {
|
594 |
+
right: auto;
|
595 |
+
left: 13px;
|
596 |
+
}
|
597 |
+
|
598 |
.happyforms-tooltip:hover .happyforms-part__description {
|
599 |
visibility: visible;
|
600 |
opacity: 1;
|
855 |
margin-bottom: 10px;
|
856 |
}
|
857 |
|
858 |
+
.happyforms-form--part-title-text-align-center .happyforms-part__label {
|
859 |
+
width: 100%;
|
860 |
+
text-align: center;
|
861 |
+
}
|
862 |
+
|
863 |
+
.happyforms-form--part-title-text-align-right .happyforms-part__label {
|
864 |
+
width: 100%;
|
865 |
+
text-align: right;
|
866 |
+
}
|
867 |
+
|
868 |
/* parts - placeholder */
|
869 |
|
870 |
.happyforms-part--placeholder p {
|
872 |
color: #000;
|
873 |
}
|
874 |
|
875 |
+
.happyforms-form--part-value-text-align-center .happyforms-part--placeholder p {
|
876 |
+
text-align: center;
|
877 |
+
}
|
878 |
+
|
879 |
+
.happyforms-form--part-value-text-align-right .happyforms-part--placeholder p {
|
880 |
+
text-align: right;
|
881 |
+
}
|
882 |
+
|
883 |
.happyforms-part--placeholder p:first-child {
|
884 |
margin-top: 0;
|
885 |
}
|
assets/js/customize.js
CHANGED
@@ -1114,6 +1114,7 @@
|
|
1114 |
tinymce: {
|
1115 |
toolbar1: 'bold,italic,bullist,numlist,link,hr',
|
1116 |
setup: this.onEditorInit.bind( this ),
|
|
|
1117 |
},
|
1118 |
};
|
1119 |
|
@@ -1257,6 +1258,7 @@
|
|
1257 |
this.initColorPickers();
|
1258 |
this.initUISliders();
|
1259 |
this.initButtonSet();
|
|
|
1260 |
},
|
1261 |
|
1262 |
onFormClassChange: function( e ) {
|
@@ -1297,7 +1299,7 @@
|
|
1297 |
api.previewer.send( 'happyforms-form-class-update', data );
|
1298 |
},
|
1299 |
|
1300 |
-
onButtonSetCssVarChange: function
|
1301 |
e.preventDefault();
|
1302 |
|
1303 |
var $target = $(e.target);
|
@@ -1384,22 +1386,30 @@
|
|
1384 |
|
1385 |
initUISliders: function() {
|
1386 |
var self = this;
|
1387 |
-
var $container = this.$el.find( '.happyforms-range-control' );
|
1388 |
|
1389 |
$container.each(function (el, index) {
|
1390 |
var $this = $(this);
|
1391 |
-
var target = $this.data('target');
|
1392 |
-
|
1393 |
var variable = $this.data('variable');
|
1394 |
-
var unit = $this.data('unit');
|
1395 |
-
|
1396 |
var $slider = $( '.happyforms-range-slider', $this );
|
1397 |
var $sliderInput = $( 'input', $this );
|
1398 |
-
|
1399 |
var min = parseFloat( $sliderInput.attr( 'min' ) );
|
1400 |
var max = parseFloat( $sliderInput.attr( 'max' ) );
|
1401 |
var step = parseFloat( $sliderInput.attr( 'step' ) );
|
1402 |
var value = parseFloat( $sliderInput.val() );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1403 |
|
1404 |
$slider.slider( {
|
1405 |
value: value,
|
@@ -1407,13 +1417,13 @@
|
|
1407 |
max: max,
|
1408 |
step: step,
|
1409 |
|
1410 |
-
stop: function( e, ui ) {
|
1411 |
-
$sliderInput.val(
|
1412 |
self.model.set( $sliderInput.attr( 'data-attribute' ), ui.value );
|
1413 |
|
1414 |
var data = {
|
1415 |
variable: variable,
|
1416 |
-
value: ui.value + '' + unit,
|
1417 |
};
|
1418 |
|
1419 |
api.previewer.send('happyforms-css-variable-update', data);
|
@@ -1422,6 +1432,84 @@
|
|
1422 |
} );
|
1423 |
},
|
1424 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1425 |
onCheckboxChange: function( e ) {
|
1426 |
var $el = $( e.target );
|
1427 |
var value = $el.is( ':checked' ) ? 1 : 0;
|
1114 |
tinymce: {
|
1115 |
toolbar1: 'bold,italic,bullist,numlist,link,hr',
|
1116 |
setup: this.onEditorInit.bind( this ),
|
1117 |
+
content_style: 'body { font-family: sans-serif; }'
|
1118 |
},
|
1119 |
};
|
1120 |
|
1258 |
this.initColorPickers();
|
1259 |
this.initUISliders();
|
1260 |
this.initButtonSet();
|
1261 |
+
this.initFormWidthSlider();
|
1262 |
},
|
1263 |
|
1264 |
onFormClassChange: function( e ) {
|
1299 |
api.previewer.send( 'happyforms-form-class-update', data );
|
1300 |
},
|
1301 |
|
1302 |
+
onButtonSetCssVarChange: function( e ) {
|
1303 |
e.preventDefault();
|
1304 |
|
1305 |
var $target = $(e.target);
|
1386 |
|
1387 |
initUISliders: function() {
|
1388 |
var self = this;
|
1389 |
+
var $container = this.$el.find( '.happyforms-range-control:not(.form-width-control)' );
|
1390 |
|
1391 |
$container.each(function (el, index) {
|
1392 |
var $this = $(this);
|
|
|
|
|
1393 |
var variable = $this.data('variable');
|
|
|
|
|
1394 |
var $slider = $( '.happyforms-range-slider', $this );
|
1395 |
var $sliderInput = $( 'input', $this );
|
|
|
1396 |
var min = parseFloat( $sliderInput.attr( 'min' ) );
|
1397 |
var max = parseFloat( $sliderInput.attr( 'max' ) );
|
1398 |
var step = parseFloat( $sliderInput.attr( 'step' ) );
|
1399 |
var value = parseFloat( $sliderInput.val() );
|
1400 |
+
|
1401 |
+
$sliderInput.on('keyup', function() {
|
1402 |
+
var $this = $(this);
|
1403 |
+
|
1404 |
+
self.model.set( $sliderInput.attr('data-attribute'), $this.val() );
|
1405 |
+
|
1406 |
+
var data = {
|
1407 |
+
variable: variable,
|
1408 |
+
value: $this.val() + '' + $this.parent().attr('data-unit'),
|
1409 |
+
};
|
1410 |
+
|
1411 |
+
api.previewer.send('happyforms-css-variable-update', data);
|
1412 |
+
});
|
1413 |
|
1414 |
$slider.slider( {
|
1415 |
value: value,
|
1417 |
max: max,
|
1418 |
step: step,
|
1419 |
|
1420 |
+
stop: function( e, ui ) {
|
1421 |
+
$sliderInput.val(ui.value);
|
1422 |
self.model.set( $sliderInput.attr( 'data-attribute' ), ui.value );
|
1423 |
|
1424 |
var data = {
|
1425 |
variable: variable,
|
1426 |
+
value: ui.value + '' + $sliderInput.parent().attr('data-unit'),
|
1427 |
};
|
1428 |
|
1429 |
api.previewer.send('happyforms-css-variable-update', data);
|
1432 |
} );
|
1433 |
},
|
1434 |
|
1435 |
+
initFormWidthSlider: function(reInit) {
|
1436 |
+
var self = this;
|
1437 |
+
|
1438 |
+
var $container = this.$el.find('.happyforms-range-control.form-width-control');
|
1439 |
+
var $slider = $('.happyforms-range-slider', $container);
|
1440 |
+
var $sliderInput = $('input', $container);
|
1441 |
+
var $unitSwitch = $('.happyforms-unit-switch', $container);
|
1442 |
+
|
1443 |
+
var value = ($sliderInput.val()) ? parseFloat($sliderInput.val()) : 100;
|
1444 |
+
var currentWidth = this.model.get('form_width').toString();
|
1445 |
+
var variable = $container.data('variable');
|
1446 |
+
var unit = $unitSwitch.val();
|
1447 |
+
|
1448 |
+
if ( typeof reInit === 'undefined' || !reInit ) {
|
1449 |
+
if ( currentWidth.indexOf('%') !== -1 ) {
|
1450 |
+
unit = '%';
|
1451 |
+
} else if ( currentWidth.indexOf('px') !== -1 ) {
|
1452 |
+
unit = 'px';
|
1453 |
+
} else {
|
1454 |
+
unit = '%';
|
1455 |
+
}
|
1456 |
+
|
1457 |
+
$unitSwitch.val(unit);
|
1458 |
+
}
|
1459 |
+
|
1460 |
+
var min = (unit === 'px') ? 360 : 0;
|
1461 |
+
var max = (unit === 'px') ? 1440 : 100;
|
1462 |
+
var step = (unit === 'px') ? 10 : 5;
|
1463 |
+
|
1464 |
+
$sliderInput.attr('min', min);
|
1465 |
+
$sliderInput.attr('max', max);
|
1466 |
+
$sliderInput.attr('step', step);
|
1467 |
+
|
1468 |
+
$unitSwitch.on('change', function () {
|
1469 |
+
self.initFormWidthSlider(true);
|
1470 |
+
});
|
1471 |
+
|
1472 |
+
if (typeof reInit !== 'undefined' && reInit) {
|
1473 |
+
value = (unit === '%') ? 100 : 900;
|
1474 |
+
|
1475 |
+
self.updateFormWidth(value, unit, $slider);
|
1476 |
+
}
|
1477 |
+
|
1478 |
+
$sliderInput.val(value);
|
1479 |
+
|
1480 |
+
$sliderInput.on('keyup, change', function () {
|
1481 |
+
var $this = $(this);
|
1482 |
+
|
1483 |
+
self.updateFormWidth($this.val(), unit, $slider);
|
1484 |
+
});
|
1485 |
+
|
1486 |
+
$slider.slider({
|
1487 |
+
value: value,
|
1488 |
+
min: min,
|
1489 |
+
max: max,
|
1490 |
+
step: step,
|
1491 |
+
|
1492 |
+
stop: function (e, ui) {
|
1493 |
+
$sliderInput.val(ui.value);
|
1494 |
+
|
1495 |
+
self.updateFormWidth(ui.value, unit, $slider);
|
1496 |
+
}
|
1497 |
+
});
|
1498 |
+
},
|
1499 |
+
|
1500 |
+
updateFormWidth: function( value, unit, $slider ) {
|
1501 |
+
$slider.slider('value', value);
|
1502 |
+
|
1503 |
+
this.model.set('form_width', value + unit);
|
1504 |
+
|
1505 |
+
var data = {
|
1506 |
+
variable: '--happyforms-form-width',
|
1507 |
+
value: value + unit,
|
1508 |
+
};
|
1509 |
+
|
1510 |
+
api.previewer.send('happyforms-css-variable-update', data);
|
1511 |
+
},
|
1512 |
+
|
1513 |
onCheckboxChange: function( e ) {
|
1514 |
var $el = $( e.target );
|
1515 |
var value = $el.is( ':checked' ) ? 1 : 0;
|
assets/js/parts/part-scale.js
CHANGED
@@ -42,12 +42,13 @@
|
|
42 |
|
43 |
refreshValues: function() {
|
44 |
var minValue = parseInt( this.model.get( 'min_value' ), 10 );
|
45 |
-
var maxValue = parseInt( this.model.get( 'max_value' ) );
|
|
|
46 |
|
47 |
minValue = isNaN( minValue ) ? 0 : minValue;
|
48 |
maxValue = isNaN( maxValue ) ? 0 : maxValue;
|
49 |
-
|
50 |
-
defaultValue = Math.
|
51 |
|
52 |
this.model.set( 'default_value', defaultValue );
|
53 |
|
42 |
|
43 |
refreshValues: function() {
|
44 |
var minValue = parseInt( this.model.get( 'min_value' ), 10 );
|
45 |
+
var maxValue = parseInt( this.model.get( 'max_value' ), 10 );
|
46 |
+
var defaultValue = parseInt( this.model.get( 'default_value' ), 10 );
|
47 |
|
48 |
minValue = isNaN( minValue ) ? 0 : minValue;
|
49 |
maxValue = isNaN( maxValue ) ? 0 : maxValue;
|
50 |
+
defaultValue = isNaN( defaultValue ) ? 0 : defaultValue;
|
51 |
+
defaultValue = Math.max( Math.min( defaultValue, maxValue ), minValue );
|
52 |
|
53 |
this.model.set( 'default_value', defaultValue );
|
54 |
|
happyforms.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* Plugin URI: https://happyforms.me
|
6 |
* Description: Your friendly drag and drop contact form builder for creating contact forms, lead generation forms, feedback forms, quote forms, survey forms and more!
|
7 |
* Author: The Theme Foundry
|
8 |
-
* Version: 1.4
|
9 |
* Author URI: https://thethemefoundry.com
|
10 |
* Upgrade URI: https://thethemefoundry.com
|
11 |
*/
|
@@ -13,7 +13,7 @@
|
|
13 |
/**
|
14 |
* The current version of the plugin.
|
15 |
*/
|
16 |
-
define( 'HAPPYFORMS_VERSION', '1.4' );
|
17 |
|
18 |
if ( ! function_exists( 'happyforms_plugin_file' ) ):
|
19 |
/**
|
5 |
* Plugin URI: https://happyforms.me
|
6 |
* Description: Your friendly drag and drop contact form builder for creating contact forms, lead generation forms, feedback forms, quote forms, survey forms and more!
|
7 |
* Author: The Theme Foundry
|
8 |
+
* Version: 1.4.1
|
9 |
* Author URI: https://thethemefoundry.com
|
10 |
* Upgrade URI: https://thethemefoundry.com
|
11 |
*/
|
13 |
/**
|
14 |
* The current version of the plugin.
|
15 |
*/
|
16 |
+
define( 'HAPPYFORMS_VERSION', '1.4.1' );
|
17 |
|
18 |
if ( ! function_exists( 'happyforms_plugin_file' ) ):
|
19 |
/**
|
inc/classes/class-form-controller.php
CHANGED
@@ -286,7 +286,7 @@ class HappyForms_Form_Controller {
|
|
286 |
|
287 |
public function get_defaults( $group = '' ) {
|
288 |
$fields = $this->get_fields( $group );
|
289 |
-
$defaults = array_combine( array_keys( $fields ),
|
290 |
|
291 |
return $defaults;
|
292 |
}
|
286 |
|
287 |
public function get_defaults( $group = '' ) {
|
288 |
$fields = $this->get_fields( $group );
|
289 |
+
$defaults = array_combine( array_keys( $fields ), wp_list_pluck( $fields, 'default' ) );
|
290 |
|
291 |
return $defaults;
|
292 |
}
|
inc/classes/class-form-styles.php
CHANGED
@@ -43,6 +43,15 @@ class HappyForms_Form_Styles {
|
|
43 |
|
44 |
public function get_fields() {
|
45 |
$fields = array(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
'hf_style_required_text' => array(
|
47 |
'default' => '*',
|
48 |
'sanitize' => 'sanitize_text_field',
|
@@ -54,6 +63,19 @@ class HappyForms_Form_Styles {
|
|
54 |
'target' => 'form_class',
|
55 |
'value' => 'happyforms-form--disable-until-valid',
|
56 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
'form_font_weight' => array(
|
58 |
'default' => 'normal',
|
59 |
'options' => array(
|
@@ -73,6 +95,16 @@ class HappyForms_Form_Styles {
|
|
73 |
'target' => 'form_class',
|
74 |
'sanitize' => 'sanitize_text_field'
|
75 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
'form_title_font_size' => array(
|
77 |
'default' => 32,
|
78 |
'unit' => 'px',
|
@@ -146,6 +178,16 @@ class HappyForms_Form_Styles {
|
|
146 |
'sanitize' => 'sanitize_text_field',
|
147 |
'target' => 'form_class',
|
148 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
149 |
'part_title_font_size' => array(
|
150 |
'default' => 16,
|
151 |
'unit' => 'px',
|
@@ -165,6 +207,16 @@ class HappyForms_Form_Styles {
|
|
165 |
'target' => 'form_class',
|
166 |
'sanitize' => 'sanitize_text_field'
|
167 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
168 |
'part_description_font_size' => array(
|
169 |
'default' => 14,
|
170 |
'unit' => 'px',
|
@@ -175,6 +227,16 @@ class HappyForms_Form_Styles {
|
|
175 |
'variable' => '--happyforms-part-description-font-size',
|
176 |
'sanitize' => 'sanitize_text_field'
|
177 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
178 |
'part_value_font_size' => array(
|
179 |
'default' => 16,
|
180 |
'unit' => 'px',
|
@@ -379,6 +441,16 @@ class HappyForms_Form_Styles {
|
|
379 |
'type' => 'divider',
|
380 |
'label' => __( 'General', 'happyforms' )
|
381 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
382 |
array(
|
383 |
'type' => 'text',
|
384 |
'label' => __( 'Required text', 'happyforms' ),
|
@@ -422,6 +494,11 @@ class HappyForms_Form_Styles {
|
|
422 |
'label' => __( 'Form title', 'happyforms' ),
|
423 |
'field' => 'form_title',
|
424 |
),
|
|
|
|
|
|
|
|
|
|
|
425 |
array(
|
426 |
'type' => 'range',
|
427 |
'label' => __( 'Font size', 'happyforms' ),
|
@@ -499,6 +576,11 @@ class HappyForms_Form_Styles {
|
|
499 |
'label' => __( 'Toggle placeholder on part focus', 'happyforms' ),
|
500 |
'field' => 'part_toggle_placeholders',
|
501 |
),
|
|
|
|
|
|
|
|
|
|
|
502 |
array(
|
503 |
'type' => 'range',
|
504 |
'label' => __( 'Title font size', 'happyforms' ),
|
@@ -509,11 +591,21 @@ class HappyForms_Form_Styles {
|
|
509 |
'label' => __( 'Title font weight', 'happyforms' ),
|
510 |
'field' => 'part_title_font_weight',
|
511 |
),
|
|
|
|
|
|
|
|
|
|
|
512 |
array(
|
513 |
'type' => 'range',
|
514 |
'label' => __( 'Description font size', 'happyforms' ),
|
515 |
'field' => 'part_description_font_size',
|
516 |
),
|
|
|
|
|
|
|
|
|
|
|
517 |
array(
|
518 |
'type' => 'range',
|
519 |
'label' => __( 'Value font size', 'happyforms' ),
|
43 |
|
44 |
public function get_fields() {
|
45 |
$fields = array(
|
46 |
+
'form_direction' => array(
|
47 |
+
'default' => '',
|
48 |
+
'options' => array(
|
49 |
+
'' => __( 'Left-to-right', 'happyforms' ),
|
50 |
+
'happyforms-form--direction-rtl' => __( 'Right-to-left', 'happyforms' )
|
51 |
+
),
|
52 |
+
'target' => 'form_class',
|
53 |
+
'sanitize' => 'sanitize_text_field'
|
54 |
+
),
|
55 |
'hf_style_required_text' => array(
|
56 |
'default' => '*',
|
57 |
'sanitize' => 'sanitize_text_field',
|
63 |
'target' => 'form_class',
|
64 |
'value' => 'happyforms-form--disable-until-valid',
|
65 |
),
|
66 |
+
'form_width' => array(
|
67 |
+
'default' => 100,
|
68 |
+
'unit' => '',
|
69 |
+
'include_unit_switch' => true,
|
70 |
+
'units' => array( '%', 'px' ),
|
71 |
+
'min' => 0,
|
72 |
+
'max' => 100,
|
73 |
+
'step' => 10,
|
74 |
+
'target' => 'css_var',
|
75 |
+
'variable' => '--happyforms-form-width',
|
76 |
+
'extra_class' => 'form-width-control',
|
77 |
+
'sanitize' => 'sanitize_text_field'
|
78 |
+
),
|
79 |
'form_font_weight' => array(
|
80 |
'default' => 'normal',
|
81 |
'options' => array(
|
95 |
'target' => 'form_class',
|
96 |
'sanitize' => 'sanitize_text_field'
|
97 |
),
|
98 |
+
'form_title_alignment' => array(
|
99 |
+
'default' => '',
|
100 |
+
'options' => array(
|
101 |
+
'' => __( 'Left', 'happyforms' ),
|
102 |
+
'happyforms-form--title-text-align-center' => __( 'Center', 'happyforms' ),
|
103 |
+
'happyforms-form--title-text-align-right' => __( 'Right', 'happyforms' )
|
104 |
+
),
|
105 |
+
'sanitize' => 'sanitize_text_field',
|
106 |
+
'target' => 'form_class'
|
107 |
+
),
|
108 |
'form_title_font_size' => array(
|
109 |
'default' => 32,
|
110 |
'unit' => 'px',
|
178 |
'sanitize' => 'sanitize_text_field',
|
179 |
'target' => 'form_class',
|
180 |
),
|
181 |
+
'part_title_alignment' => array(
|
182 |
+
'default' => '',
|
183 |
+
'options' => array(
|
184 |
+
'' => __( 'Left', 'happyforms' ),
|
185 |
+
'happyforms-form--part-title-text-align-center' => __( 'Center', 'happyforms' ),
|
186 |
+
'happyforms-form--part-title-text-align-right' => __( 'Right', 'happyforms' )
|
187 |
+
),
|
188 |
+
'sanitize' => 'sanitize_text_field',
|
189 |
+
'target' => 'form_class'
|
190 |
+
),
|
191 |
'part_title_font_size' => array(
|
192 |
'default' => 16,
|
193 |
'unit' => 'px',
|
207 |
'target' => 'form_class',
|
208 |
'sanitize' => 'sanitize_text_field'
|
209 |
),
|
210 |
+
'part_description_alignment' => array(
|
211 |
+
'default' => '',
|
212 |
+
'options' => array(
|
213 |
+
'' => __( 'Left', 'happyforms' ),
|
214 |
+
'happyforms-form--part-description-text-align-center' => __( 'Center', 'happyforms' ),
|
215 |
+
'happyforms-form--part-description-text-align-right' => __( 'Right', 'happyforms' )
|
216 |
+
),
|
217 |
+
'sanitize' => 'sanitize_text_field',
|
218 |
+
'target' => 'form_class'
|
219 |
+
),
|
220 |
'part_description_font_size' => array(
|
221 |
'default' => 14,
|
222 |
'unit' => 'px',
|
227 |
'variable' => '--happyforms-part-description-font-size',
|
228 |
'sanitize' => 'sanitize_text_field'
|
229 |
),
|
230 |
+
'part_value_alignment' => array(
|
231 |
+
'default' => '',
|
232 |
+
'options' => array(
|
233 |
+
'' => __( 'Left', 'happyforms' ),
|
234 |
+
'happyforms-form--part-value-text-align-center' => __( 'Center', 'happyforms' ),
|
235 |
+
'happyforms-form--part-value-text-align-right' => __( 'Right', 'happyforms' )
|
236 |
+
),
|
237 |
+
'sanitize' => 'sanitize_text_field',
|
238 |
+
'target' => 'form_class'
|
239 |
+
),
|
240 |
'part_value_font_size' => array(
|
241 |
'default' => 16,
|
242 |
'unit' => 'px',
|
441 |
'type' => 'divider',
|
442 |
'label' => __( 'General', 'happyforms' )
|
443 |
),
|
444 |
+
array(
|
445 |
+
'type' => 'range',
|
446 |
+
'label' => __( 'Form width', 'happyforms' ),
|
447 |
+
'field' => 'form_width'
|
448 |
+
),
|
449 |
+
array(
|
450 |
+
'type' => 'buttonset',
|
451 |
+
'label' => __( 'Direction', 'happyforms' ),
|
452 |
+
'field' => 'form_direction'
|
453 |
+
),
|
454 |
array(
|
455 |
'type' => 'text',
|
456 |
'label' => __( 'Required text', 'happyforms' ),
|
494 |
'label' => __( 'Form title', 'happyforms' ),
|
495 |
'field' => 'form_title',
|
496 |
),
|
497 |
+
array(
|
498 |
+
'type' => 'buttonset',
|
499 |
+
'label' => __( 'Alignment', 'happyforms' ),
|
500 |
+
'field' => 'form_title_alignment'
|
501 |
+
),
|
502 |
array(
|
503 |
'type' => 'range',
|
504 |
'label' => __( 'Font size', 'happyforms' ),
|
576 |
'label' => __( 'Toggle placeholder on part focus', 'happyforms' ),
|
577 |
'field' => 'part_toggle_placeholders',
|
578 |
),
|
579 |
+
array(
|
580 |
+
'type' => 'buttonset',
|
581 |
+
'label' => __( 'Title alignment', 'happyforms' ),
|
582 |
+
'field' => 'part_title_alignment'
|
583 |
+
),
|
584 |
array(
|
585 |
'type' => 'range',
|
586 |
'label' => __( 'Title font size', 'happyforms' ),
|
591 |
'label' => __( 'Title font weight', 'happyforms' ),
|
592 |
'field' => 'part_title_font_weight',
|
593 |
),
|
594 |
+
array(
|
595 |
+
'type' => 'buttonset',
|
596 |
+
'label' => __( 'Description alignment', 'happyforms' ),
|
597 |
+
'field' => 'part_description_alignment'
|
598 |
+
),
|
599 |
array(
|
600 |
'type' => 'range',
|
601 |
'label' => __( 'Description font size', 'happyforms' ),
|
602 |
'field' => 'part_description_font_size',
|
603 |
),
|
604 |
+
array(
|
605 |
+
'type' => 'buttonset',
|
606 |
+
'label' => __( 'Placeholder & Value alignment', 'happyforms' ),
|
607 |
+
'field' => 'part_value_alignment'
|
608 |
+
),
|
609 |
array(
|
610 |
'type' => 'range',
|
611 |
'label' => __( 'Value font size', 'happyforms' ),
|
inc/classes/class-message-admin.php
CHANGED
@@ -370,9 +370,11 @@ class HappyForms_Message_Admin {
|
|
370 |
}
|
371 |
|
372 |
if ( count( $form['parts'] ) > $column_index ) {
|
373 |
-
$
|
374 |
-
|
375 |
-
|
|
|
|
|
376 |
}
|
377 |
}
|
378 |
|
@@ -440,8 +442,8 @@ class HappyForms_Message_Admin {
|
|
440 |
}
|
441 |
|
442 |
$first_form_part = $form['parts'][0];
|
443 |
-
$
|
444 |
-
$title =
|
445 |
|
446 |
return $title;
|
447 |
}
|
370 |
}
|
371 |
|
372 |
if ( count( $form['parts'] ) > $column_index ) {
|
373 |
+
$part_id = $form['parts'][$column_index]['id'];
|
374 |
+
|
375 |
+
if ( isset( $message['parts'][$part_id] ) ) {
|
376 |
+
echo $message['parts'][$part_id]['value'];
|
377 |
+
}
|
378 |
}
|
379 |
}
|
380 |
|
442 |
}
|
443 |
|
444 |
$first_form_part = $form['parts'][0];
|
445 |
+
$part_id = $first_form_part['id'];
|
446 |
+
$title = $message['parts'][$part_id]['label'];
|
447 |
|
448 |
return $title;
|
449 |
}
|
inc/classes/class-message-controller.php
CHANGED
@@ -124,6 +124,10 @@ class HappyForms_Message_Controller {
|
|
124 |
return $fields;
|
125 |
}
|
126 |
|
|
|
|
|
|
|
|
|
127 |
/**
|
128 |
* Action: register the message custom post type.
|
129 |
*
|
@@ -237,6 +241,18 @@ class HappyForms_Message_Controller {
|
|
237 |
|
238 |
// Add a general error notice at the top
|
239 |
$message_notices->add_message( 'form_error', $form_id );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
240 |
} else {
|
241 |
// Add a general success notice at the top
|
242 |
$message_notices->add_message( 'form_success', $form_id );
|
@@ -247,6 +263,18 @@ class HappyForms_Message_Controller {
|
|
247 |
if ( ! empty( $form['redirect_url'] ) ) {
|
248 |
$redirect_url = $form['redirect_url'];
|
249 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
250 |
}
|
251 |
|
252 |
// Write the session cookie
|
@@ -388,15 +416,19 @@ class HappyForms_Message_Controller {
|
|
388 |
$attrs = $defaults['post'] + array( 'meta_input' => $message_meta );
|
389 |
$message_id = wp_insert_post( wp_slash( $attrs ), true );
|
390 |
|
391 |
-
if (
|
392 |
-
|
393 |
-
|
394 |
-
$this->email_user_confirmation( $form, $message );
|
395 |
|
396 |
-
|
397 |
-
|
398 |
-
|
|
|
|
|
|
|
399 |
}
|
|
|
|
|
400 |
}
|
401 |
|
402 |
/**
|
@@ -404,11 +436,12 @@ class HappyForms_Message_Controller {
|
|
404 |
*
|
405 |
* @since 1.0
|
406 |
*
|
407 |
-
* @param string
|
|
|
408 |
*
|
409 |
* @return array
|
410 |
*/
|
411 |
-
public function get( $post_ids = '' ) {
|
412 |
$query_params = array(
|
413 |
'post_type' => $this->post_type,
|
414 |
'post_status' => 'any',
|
@@ -488,10 +521,17 @@ class HappyForms_Message_Controller {
|
|
488 |
$part = happyforms_get_part_library()->get_part( $part_data['type'] );
|
489 |
$part_id = $part_data['id'];
|
490 |
$part_value = isset( $meta_entries[$part_id] ) ? $meta_entries[$part_id][0] : $part->get_default_value();
|
491 |
-
$
|
|
|
|
|
|
|
|
|
|
|
492 |
}
|
493 |
}
|
494 |
|
|
|
|
|
495 |
return $message_array;
|
496 |
}
|
497 |
|
@@ -515,11 +555,9 @@ class HappyForms_Message_Controller {
|
|
515 |
$email_subject = __( 'New submission', 'happyforms' );
|
516 |
$email_content_lines = array();
|
517 |
|
518 |
-
foreach ( $
|
519 |
-
$
|
520 |
-
$
|
521 |
-
$label = happyforms_get_part_label( $part_data );
|
522 |
-
$value = happyforms_get_message_part_value( $message['parts'][$part_id] );
|
523 |
$email_content_lines[] = "$label: $value";
|
524 |
}
|
525 |
|
@@ -529,8 +567,16 @@ class HappyForms_Message_Controller {
|
|
529 |
$email_content
|
530 |
);
|
531 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
532 |
foreach ( $email_recipients as $recipient ) {
|
533 |
-
$result = $this->send_mail( $recipient, $email_subject, $email_content );
|
534 |
}
|
535 |
}
|
536 |
}
|
@@ -553,7 +599,7 @@ class HappyForms_Message_Controller {
|
|
553 |
&& ! empty( $form['confirmation_email_content'] ) ) {
|
554 |
|
555 |
$part_id = $email_part['id'];
|
556 |
-
$email_recipient =
|
557 |
$email_subject = $form['confirmation_email_subject'];
|
558 |
$email_content = sprintf(
|
559 |
'%s',
|
@@ -575,9 +621,17 @@ class HappyForms_Message_Controller {
|
|
575 |
*
|
576 |
* @return boolean
|
577 |
*/
|
578 |
-
private function send_mail( $recipient, $subject, $content ) {
|
579 |
add_filter( 'wp_mail_content_type', array( $this, 'get_mail_content_type' ) );
|
580 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
581 |
remove_filter( 'wp_mail_content_type', array( $this, 'get_mail_content_type' ) );
|
582 |
|
583 |
return $result;
|
124 |
return $fields;
|
125 |
}
|
126 |
|
127 |
+
private function get_public_fields() {
|
128 |
+
return array( 'ID', 'post_date', 'parts', 'form_id', 'read' );
|
129 |
+
}
|
130 |
+
|
131 |
/**
|
132 |
* Action: register the message custom post type.
|
133 |
*
|
241 |
|
242 |
// Add a general error notice at the top
|
243 |
$message_notices->add_message( 'form_error', $form_id );
|
244 |
+
|
245 |
+
/**
|
246 |
+
* This action fires upon an invalid submission.
|
247 |
+
*
|
248 |
+
* @since 1.4
|
249 |
+
*
|
250 |
+
* @param WP_Error $result Error data.
|
251 |
+
* @param array $form Current form data.
|
252 |
+
*
|
253 |
+
* @return void
|
254 |
+
*/
|
255 |
+
do_action( 'happyforms_submission_error', $result, $form );
|
256 |
} else {
|
257 |
// Add a general success notice at the top
|
258 |
$message_notices->add_message( 'form_success', $form_id );
|
263 |
if ( ! empty( $form['redirect_url'] ) ) {
|
264 |
$redirect_url = $form['redirect_url'];
|
265 |
}
|
266 |
+
|
267 |
+
/**
|
268 |
+
* This action fires once a message is succesfully submitted.
|
269 |
+
*
|
270 |
+
* @since 1.4
|
271 |
+
*
|
272 |
+
* @param array $result Submission data.
|
273 |
+
* @param array $form Current form data.
|
274 |
+
*
|
275 |
+
* @return void
|
276 |
+
*/
|
277 |
+
do_action( 'happyforms_submission_success', $result, $form );
|
278 |
}
|
279 |
|
280 |
// Write the session cookie
|
416 |
$attrs = $defaults['post'] + array( 'meta_input' => $message_meta );
|
417 |
$message_id = wp_insert_post( wp_slash( $attrs ), true );
|
418 |
|
419 |
+
if ( is_wp_error( $message_id ) ) {
|
420 |
+
return $message_id;
|
421 |
+
}
|
|
|
422 |
|
423 |
+
$message = $this->get( $message_id );
|
424 |
+
$this->email_owner_confirmation( $form, $message );
|
425 |
+
$this->email_user_confirmation( $form, $message );
|
426 |
+
|
427 |
+
if ( ! $form['save_entries'] ) {
|
428 |
+
wp_delete_post( $message_id, true);
|
429 |
}
|
430 |
+
|
431 |
+
return $message;
|
432 |
}
|
433 |
|
434 |
/**
|
436 |
*
|
437 |
* @since 1.0
|
438 |
*
|
439 |
+
* @param string $post_ids The IDs of the messages to retrieve.
|
440 |
+
* @param boolean $pretty Wether to return data in pretty format or not.
|
441 |
*
|
442 |
* @return array
|
443 |
*/
|
444 |
+
public function get( $post_ids = '', $pretty = false ) {
|
445 |
$query_params = array(
|
446 |
'post_type' => $this->post_type,
|
447 |
'post_status' => 'any',
|
521 |
$part = happyforms_get_part_library()->get_part( $part_data['type'] );
|
522 |
$part_id = $part_data['id'];
|
523 |
$part_value = isset( $meta_entries[$part_id] ) ? $meta_entries[$part_id][0] : $part->get_default_value();
|
524 |
+
$part_info = array(
|
525 |
+
'label' => happyforms_get_part_label( $part_data ),
|
526 |
+
'value' => happyforms_get_message_part_value( $part_value ),
|
527 |
+
);
|
528 |
+
|
529 |
+
$message_array['parts'][$part_id] = $part_info;
|
530 |
}
|
531 |
}
|
532 |
|
533 |
+
$message_array = array_intersect_key( $message_array, array_flip ( $this->get_public_fields() ) );
|
534 |
+
|
535 |
return $message_array;
|
536 |
}
|
537 |
|
555 |
$email_subject = __( 'New submission', 'happyforms' );
|
556 |
$email_content_lines = array();
|
557 |
|
558 |
+
foreach ( $message['parts'] as $part_id => $part_data ) {
|
559 |
+
$label = $part_data['label'];
|
560 |
+
$value = $part_data['value'];
|
|
|
|
|
561 |
$email_content_lines[] = "$label: $value";
|
562 |
}
|
563 |
|
567 |
$email_content
|
568 |
);
|
569 |
|
570 |
+
$from = '';
|
571 |
+
$email_part = happyforms_get_form_controller()->get_first_part_by_type( $form, 'email' );
|
572 |
+
|
573 |
+
if ( false !== $email_part ) {
|
574 |
+
$part_id = $email_part['id'];
|
575 |
+
$from = $message['parts'][$part_id]['value'];
|
576 |
+
}
|
577 |
+
|
578 |
foreach ( $email_recipients as $recipient ) {
|
579 |
+
$result = $this->send_mail( $recipient, $email_subject, $email_content, $from );
|
580 |
}
|
581 |
}
|
582 |
}
|
599 |
&& ! empty( $form['confirmation_email_content'] ) ) {
|
600 |
|
601 |
$part_id = $email_part['id'];
|
602 |
+
$email_recipient = $message['parts'][$part_id]['value'];
|
603 |
$email_subject = $form['confirmation_email_subject'];
|
604 |
$email_content = sprintf(
|
605 |
'%s',
|
621 |
*
|
622 |
* @return boolean
|
623 |
*/
|
624 |
+
private function send_mail( $recipient, $subject, $content, $from = '' ) {
|
625 |
add_filter( 'wp_mail_content_type', array( $this, 'get_mail_content_type' ) );
|
626 |
+
|
627 |
+
$headers = '';
|
628 |
+
|
629 |
+
if ( ! empty( $from ) ) {
|
630 |
+
$headers .= "From: {$from} \r\n";
|
631 |
+
}
|
632 |
+
|
633 |
+
$result = wp_mail( $recipient, $subject, $content, $headers );
|
634 |
+
|
635 |
remove_filter( 'wp_mail_content_type', array( $this, 'get_mail_content_type' ) );
|
636 |
|
637 |
return $result;
|
inc/classes/parts/class-part-scale.php
CHANGED
@@ -9,6 +9,7 @@ class HappyForms_Part_Scale extends HappyForms_Form_Part {
|
|
9 |
$this->description = __( 'For collecting opinions using a horizontal slider.', 'happyforms' );
|
10 |
|
11 |
add_filter( 'happyforms_frontend_dependencies', array( $this, 'script_dependencies' ), 10, 2 );
|
|
|
12 |
}
|
13 |
|
14 |
/**
|
@@ -171,6 +172,14 @@ class HappyForms_Part_Scale extends HappyForms_Form_Part {
|
|
171 |
return $validated_value;
|
172 |
}
|
173 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
174 |
/**
|
175 |
* Enqueue scripts in customizer area.
|
176 |
*
|
9 |
$this->description = __( 'For collecting opinions using a horizontal slider.', 'happyforms' );
|
10 |
|
11 |
add_filter( 'happyforms_frontend_dependencies', array( $this, 'script_dependencies' ), 10, 2 );
|
12 |
+
add_filter( 'happyforms_part_value', array( $this, 'part_value' ), 10, 2 );
|
13 |
}
|
14 |
|
15 |
/**
|
172 |
return $validated_value;
|
173 |
}
|
174 |
|
175 |
+
public function part_value( $value, $part ) {
|
176 |
+
if ( $this->type === $part['type'] ) {
|
177 |
+
$value = $part['default_value'];
|
178 |
+
}
|
179 |
+
|
180 |
+
return $value;
|
181 |
+
}
|
182 |
+
|
183 |
/**
|
184 |
* Enqueue scripts in customizer area.
|
185 |
*
|
inc/helpers/helper-form-templates.php
CHANGED
@@ -258,6 +258,56 @@ function happyforms_the_part_name( $part, $form ) {
|
|
258 |
|
259 |
endif;
|
260 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
261 |
if ( ! function_exists( 'happyforms_get_form_title' ) ):
|
262 |
/**
|
263 |
* Return the form title.
|
258 |
|
259 |
endif;
|
260 |
|
261 |
+
if ( ! function_exists( 'happyforms_get_part_value' ) ):
|
262 |
+
/**
|
263 |
+
* Returns the default submission value for this form part.
|
264 |
+
*
|
265 |
+
* @since 1.4
|
266 |
+
*
|
267 |
+
* @param array $part_id Current part data.
|
268 |
+
* @param array $form_id Current form data.
|
269 |
+
* @param string $component An optional part sub-component.
|
270 |
+
*
|
271 |
+
* @return string
|
272 |
+
*/
|
273 |
+
function happyforms_get_part_value( $part, $form, $component = '' ) {
|
274 |
+
$value = '';
|
275 |
+
|
276 |
+
/**
|
277 |
+
* Filter the default submission value for this form part.
|
278 |
+
*
|
279 |
+
* @since 1.4
|
280 |
+
*
|
281 |
+
* @param string $value The default value.
|
282 |
+
* @param array $part Current part data.
|
283 |
+
* @param array $form Current form data.
|
284 |
+
* @param string $component An optional part sub-component.
|
285 |
+
*
|
286 |
+
* @return string The filtered part name.
|
287 |
+
*/
|
288 |
+
return apply_filters( 'happyforms_part_value', $value, $part, $form, $component );
|
289 |
+
}
|
290 |
+
|
291 |
+
endif;
|
292 |
+
|
293 |
+
if ( ! function_exists( 'happyforms_the_part_value' ) ):
|
294 |
+
/**
|
295 |
+
* Output the default submission value for this form part.
|
296 |
+
*
|
297 |
+
* @since 1.4
|
298 |
+
*
|
299 |
+
* @param array $part Current part data.
|
300 |
+
* @param array $form Current form data.
|
301 |
+
* @param string $component An optional part sub-component.
|
302 |
+
*
|
303 |
+
* @return void
|
304 |
+
*/
|
305 |
+
function happyforms_the_part_value( $part, $form, $component = '' ) {
|
306 |
+
echo esc_attr( happyforms_get_part_value( $part, $form, $component ) );
|
307 |
+
}
|
308 |
+
|
309 |
+
endif;
|
310 |
+
|
311 |
if ( ! function_exists( 'happyforms_get_form_title' ) ):
|
312 |
/**
|
313 |
* Return the form title.
|
inc/templates/admin-message-edit.php
CHANGED
@@ -7,17 +7,10 @@ if ( ! $form ) {
|
|
7 |
?>
|
8 |
<table class="form-table happyforms-message-data-table">
|
9 |
<tbody>
|
10 |
-
<?php
|
11 |
-
$tr = 0;
|
12 |
-
foreach ( $form['parts'] as $part_data ):
|
13 |
-
$part = happyforms_get_part_library()->get_part( $part_data['type'] );
|
14 |
-
$part_id = $part_data['id'];
|
15 |
-
$label = happyforms_get_part_label( $part_data );
|
16 |
-
$value = happyforms_get_message_part_value( $message['parts'][$part_id] );
|
17 |
-
?>
|
18 |
<tr <?php if ($tr % 2 == 0) : ?>class="alternate"<?php endif; ?>>
|
19 |
-
<th scope="row"><?php echo esc_html( $label ); ?></th>
|
20 |
-
<td><?php echo esc_html( $value ); ?></td>
|
21 |
</tr>
|
22 |
<?php $tr ++; endforeach; ?>
|
23 |
</tbody>
|
7 |
?>
|
8 |
<table class="form-table happyforms-message-data-table">
|
9 |
<tbody>
|
10 |
+
<?php $tr = 0; foreach ( $message['parts'] as $part_id => $part_data ): ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
<tr <?php if ($tr % 2 == 0) : ?>class="alternate"<?php endif; ?>>
|
12 |
+
<th scope="row"><?php echo esc_html( $part_data['label'] ); ?></th>
|
13 |
+
<td><?php echo esc_html( $part_data['value'] ); ?></td>
|
14 |
</tr>
|
15 |
<?php $tr ++; endforeach; ?>
|
16 |
</tbody>
|
inc/templates/customize-form-style.php
CHANGED
@@ -14,6 +14,12 @@ $controls = happyforms_get_styles()->get_controls();
|
|
14 |
$class = esc_attr( "happyforms-{$type}-control" );
|
15 |
$name = isset( $control['field'] ) ? $control['field'] : '';
|
16 |
$field = ( '' !== $name ) ? $controller->get_field( $control['field'] ) : '';
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
|
18 |
if ( 'divider' === $type ) : ?>
|
19 |
|
@@ -36,7 +42,7 @@ $controls = happyforms_get_styles()->get_controls();
|
|
36 |
|
37 |
<?php elseif ( 'checkbox' === $type ) : ?>
|
38 |
|
39 |
-
<li class="customize-control <?php echo $class; ?>" data-target="<?php echo esc_attr( $field['target'] ); ?>"
|
40 |
<div class="customize-control-content">
|
41 |
<label>
|
42 |
<input type="checkbox" name="<?php echo $name; ?>" id="<?php echo $name; ?>" value="<?php echo $field['value']; ?>" data-attribute="<?php echo $name; ?>" <% if (<?php echo $name; ?>) { %>checked="checked"<% } %>> <?php echo $label; ?>
|
@@ -46,22 +52,29 @@ $controls = happyforms_get_styles()->get_controls();
|
|
46 |
|
47 |
<?php elseif ( 'range' === $type ) : ?>
|
48 |
|
49 |
-
<li class="customize-control <?php echo $class; ?>" data-target="<?php echo esc_attr( $field['target'] ); ?>" data-variable="<?php echo $field['variable']; ?>" data-unit="<?php echo $field['unit']; ?>"
|
50 |
<label class="customize-control-title" for="<?php echo $name; ?>"><?php echo $label; ?></label>
|
51 |
-
<input type="number" name="<?php echo $name; ?>" id="<?php echo $name; ?>" min="<?php echo $field[ 'min' ]; ?>" max="<?php echo $field[ 'max' ]; ?>" step="<?php echo $field[ 'step' ]; ?>" value="<%= <?php echo $name;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
<div class="customize-control-content">
|
53 |
-
<div class="happyforms-range-slider"></div>
|
54 |
</div>
|
55 |
</li>
|
56 |
|
57 |
<?php elseif ( 'buttonset' === $type ) : ?>
|
58 |
-
|
59 |
-
<li class="customize-control <?php echo $class; ?>" data-target="<?php echo esc_attr( $field['target'] ); ?>" data-variable="<?php echo ( isset( $field['variable'] ) ) ? esc_attr( $field['variable'] ) : ''; ?>">
|
60 |
<div class="customize-control-content">
|
61 |
<label class="customize-control-title" for="<?php echo $name; ?>"><?php echo $label; ?></label>
|
62 |
<div class="happyforms-buttonset-container">
|
63 |
<?php foreach ( $field[ 'options' ] as $option_key => $option ) : ?>
|
64 |
-
<input type="radio" class="happyforms-buttonset" name="<?php echo $name; ?>" id="<?php echo $name; ?>_<?php echo esc_attr( $option_key ); ?>" value="<?php echo esc_attr( $option_key ); ?>" data-attribute="<?php echo $name; ?>"
|
65 |
<label for="<?php echo $name; ?>_<?php echo esc_attr( $option_key ); ?>">
|
66 |
<span class="ui-button-text"></span><?php echo esc_attr( $option ); ?></span>
|
67 |
</label>
|
@@ -72,7 +85,7 @@ $controls = happyforms_get_styles()->get_controls();
|
|
72 |
|
73 |
<?php elseif ( 'color' === $type ) : ?>
|
74 |
|
75 |
-
<li class="customize-control <?php echo $class; ?>" data-target="<?php echo esc_attr( $field['target'] ); ?>" data-variable="<?php echo $field['variable']; ?>"
|
76 |
<label class="customize-control-title" for="<?php echo $name; ?>"><?php echo $label; ?></label>
|
77 |
<div class="customize-control-content">
|
78 |
<input type="text" name="<?php echo $name; ?>" id="<?php echo $name; ?>" class="happyforms-color-input" data-attribute="<?php echo $name; ?>" value="<%= <?php echo $name; ?> %>" data-default="<?php echo $field['default']; ?>">
|
@@ -81,7 +94,7 @@ $controls = happyforms_get_styles()->get_controls();
|
|
81 |
|
82 |
<?php elseif ( 'text' === $type ) : ?>
|
83 |
|
84 |
-
<li class="customize-control <?php echo $class; ?>" data-target="<?php echo esc_attr( $field['target'] ); ?>"
|
85 |
<label class="customize-control-title" for="<?php echo $name; ?>"><?php echo $label; ?></label>
|
86 |
<div class="customize-control-content">
|
87 |
<input type="text" name="<?php echo $name; ?>" id="<?php echo $name; ?>" data-attribute="<?php echo $name; ?>" value="<%= <?php echo $name; ?> %>">
|
@@ -90,7 +103,7 @@ $controls = happyforms_get_styles()->get_controls();
|
|
90 |
|
91 |
<?php elseif ( 'select' === $type ) : ?>
|
92 |
|
93 |
-
<li class="customize-control <?php echo $class; ?>" data-target="<?php echo esc_attr( $field['target'] ); ?>"
|
94 |
<label class="customize-control-title" for="<?php echo $name; ?>"><?php echo $label; ?></label>
|
95 |
<div class="customize-control-content">
|
96 |
<select name="<?php echo $name; ?>" id="<?php echo $name; ?>" data-attribute="<?php echo $name; ?>" class="widefat">
|
14 |
$class = esc_attr( "happyforms-{$type}-control" );
|
15 |
$name = isset( $control['field'] ) ? $control['field'] : '';
|
16 |
$field = ( '' !== $name ) ? $controller->get_field( $control['field'] ) : '';
|
17 |
+
$display_condition = isset( $control['display_condition'] ) ? $control['display_condition'] : false;
|
18 |
+
$display_condition_string = '';
|
19 |
+
|
20 |
+
if ( false !== $display_condition ) {
|
21 |
+
$display_condition_string = ( $display_condition ) ? '<%if ( '. $display_condition .' ) { %> style="display: block" <% } else { %> style="display: none" <% } %>' : '';
|
22 |
+
}
|
23 |
|
24 |
if ( 'divider' === $type ) : ?>
|
25 |
|
42 |
|
43 |
<?php elseif ( 'checkbox' === $type ) : ?>
|
44 |
|
45 |
+
<li class="customize-control <?php echo $class; ?> <?php echo ( isset( $field['extra_class'] ) ) ? $field['extra_class'] : ''; ?>" data-target="<?php echo esc_attr( $field['target'] ); ?>"<?php echo ( !empty( $display_condition_string ) ) ? $display_condition_string : ''; ?>>
|
46 |
<div class="customize-control-content">
|
47 |
<label>
|
48 |
<input type="checkbox" name="<?php echo $name; ?>" id="<?php echo $name; ?>" value="<?php echo $field['value']; ?>" data-attribute="<?php echo $name; ?>" <% if (<?php echo $name; ?>) { %>checked="checked"<% } %>> <?php echo $label; ?>
|
52 |
|
53 |
<?php elseif ( 'range' === $type ) : ?>
|
54 |
|
55 |
+
<li class="customize-control <?php echo $class; ?> <?php echo ( isset( $field['extra_class'] ) ) ? $field['extra_class'] : ''; ?>" data-target="<?php echo esc_attr( $field['target'] ); ?>" data-variable="<?php echo $field['variable']; ?>" data-unit="<?php echo $field['unit']; ?>" <?php echo ( !empty( $display_condition_string ) ) ? $display_condition_string : ''; ?>>
|
56 |
<label class="customize-control-title" for="<?php echo $name; ?>"><?php echo $label; ?></label>
|
57 |
+
<input type="number" name="<?php echo $name; ?>" id="<?php echo $name; ?>" min="<?php echo $field[ 'min' ]; ?>" max="<?php echo $field[ 'max' ]; ?>" step="<?php echo $field[ 'step' ]; ?>" value="<%= (<?php echo $name; ?>.length) ? <?php echo $name; ?>.replace(/%|px/g, '') : '' %>" data-attribute="<?php echo $name; ?>">
|
58 |
+
<?php if ( isset( $field['include_unit_switch'] ) ) : ?>
|
59 |
+
<select name="<?php echo $name; ?>_unit" class="happyforms-unit-switch">
|
60 |
+
<?php if ( is_array( $field['units'] ) ) :
|
61 |
+
foreach ( $field['units'] as $unit ) : ?>
|
62 |
+
<option value="<?php echo $unit; ?>"><?php echo $unit; ?></option>
|
63 |
+
<?php endforeach; endif; ?>
|
64 |
+
</select>
|
65 |
+
<?php endif; ?>
|
66 |
<div class="customize-control-content">
|
67 |
+
<div class="happyforms-range-slider" data-slider-id="<?php echo $name; ?>"></div>
|
68 |
</div>
|
69 |
</li>
|
70 |
|
71 |
<?php elseif ( 'buttonset' === $type ) : ?>
|
72 |
+
<li class="customize-control <?php echo $class; ?> <?php echo ( isset( $field['extra_class'] ) ) ? $field['extra_class'] : ''; ?>" data-target="<?php echo esc_attr( $field['target'] ); ?>" data-variable="<?php echo ( isset( $field['variable'] ) ) ? esc_attr( $field['variable'] ) : ''; ?>" data-control-id="<?php echo $name; ?>"<?php echo ( !empty( $display_condition_string ) ) ? $display_condition_string : ''; ?>>
|
|
|
73 |
<div class="customize-control-content">
|
74 |
<label class="customize-control-title" for="<?php echo $name; ?>"><?php echo $label; ?></label>
|
75 |
<div class="happyforms-buttonset-container">
|
76 |
<?php foreach ( $field[ 'options' ] as $option_key => $option ) : ?>
|
77 |
+
<input type="radio" class="happyforms-buttonset" name="<?php echo $name; ?>" id="<?php echo $name; ?>_<?php echo esc_attr( $option_key ); ?>" value="<?php echo esc_attr( $option_key ); ?>" data-attribute="<?php echo $name; ?>" <?php echo ( isset( $field['target_control_class'] ) ) ? ' data-target-control-class="'. $field['target_control_class'] .'" ' : ''; ?><% if (<?php echo $name; ?> === '<?php echo esc_attr( $option_key ); ?>') { %>checked="checked"<% } %>>
|
78 |
<label for="<?php echo $name; ?>_<?php echo esc_attr( $option_key ); ?>">
|
79 |
<span class="ui-button-text"></span><?php echo esc_attr( $option ); ?></span>
|
80 |
</label>
|
85 |
|
86 |
<?php elseif ( 'color' === $type ) : ?>
|
87 |
|
88 |
+
<li class="customize-control <?php echo $class; ?> <?php echo ( isset( $field['extra_class'] ) ) ? $field['extra_class'] : ''; ?>" data-target="<?php echo esc_attr( $field['target'] ); ?>" data-variable="<?php echo $field['variable']; ?>"<?php echo ( !empty( $display_condition_string ) ) ? $display_condition_string : ''; ?>>
|
89 |
<label class="customize-control-title" for="<?php echo $name; ?>"><?php echo $label; ?></label>
|
90 |
<div class="customize-control-content">
|
91 |
<input type="text" name="<?php echo $name; ?>" id="<?php echo $name; ?>" class="happyforms-color-input" data-attribute="<?php echo $name; ?>" value="<%= <?php echo $name; ?> %>" data-default="<?php echo $field['default']; ?>">
|
94 |
|
95 |
<?php elseif ( 'text' === $type ) : ?>
|
96 |
|
97 |
+
<li class="customize-control <?php echo $class; ?> <?php echo ( isset( $field['extra_class'] ) ) ? $field['extra_class'] : ''; ?>" data-target="<?php echo esc_attr( $field['target'] ); ?>"<?php echo ( !empty( $display_condition_string ) ) ? $display_condition_string : ''; ?>>
|
98 |
<label class="customize-control-title" for="<?php echo $name; ?>"><?php echo $label; ?></label>
|
99 |
<div class="customize-control-content">
|
100 |
<input type="text" name="<?php echo $name; ?>" id="<?php echo $name; ?>" data-attribute="<?php echo $name; ?>" value="<%= <?php echo $name; ?> %>">
|
103 |
|
104 |
<?php elseif ( 'select' === $type ) : ?>
|
105 |
|
106 |
+
<li class="customize-control <?php echo $class; ?> <?php echo ( isset( $field['extra_class'] ) ) ? $field['extra_class'] : ''; ?>" data-target="<?php echo esc_attr( $field['target'] ); ?>"<?php echo ( !empty( $display_condition_string ) ) ? $display_condition_string : ''; ?>>
|
107 |
<label class="customize-control-title" for="<?php echo $name; ?>"><?php echo $label; ?></label>
|
108 |
<div class="customize-control-content">
|
109 |
<select name="<?php echo $name; ?>" id="<?php echo $name; ?>" data-attribute="<?php echo $name; ?>" class="widefat">
|
inc/templates/parts/frontend-address.php
CHANGED
@@ -9,31 +9,31 @@
|
|
9 |
<?php if ( 'simple' === $part['mode'] ) : ?>
|
10 |
<div class="happyforms-part-el-wrap">
|
11 |
<div class="happyforms-part__el">
|
12 |
-
<input name="<?php happyforms_the_part_name( $part, $form ); ?>[full]" class="happyforms-part__el--text-input happyforms-part__el--address" type="text" placeholder="<?php echo esc_attr( $part['placeholder'] ); ?>" <?php if ( 1 === $part['required'] ) : ?>required aria-required="true"<?php endif; ?> />
|
13 |
</div>
|
14 |
</div>
|
15 |
<?php elseif ( 'autocomplete' === $part['mode'] ) : ?>
|
16 |
<div class="happyforms-part-el-wrap">
|
17 |
<div class="happyforms-part__el">
|
18 |
-
<input name="<?php happyforms_the_part_name( $part, $form ); ?>[full]" class="happyforms-part__el--text-input happyforms-part__el--address-autocomplete" type="text" placeholder="<?php echo esc_attr( $part['placeholder'] ); ?>" <?php if ( 1 === $part['required'] ) : ?>required aria-required="true"<?php endif; ?> autocomplete="off" />
|
19 |
<div class="happyforms-part__el--address--results happyforms-part__el--address--results-google"></div>
|
20 |
</div>
|
21 |
</div>
|
22 |
<?php elseif ( 'country' === $part['mode'] ) : ?>
|
23 |
<div class="happyforms-part-el-wrap">
|
24 |
<div class="happyforms-part__el">
|
25 |
-
<input name="<?php happyforms_the_part_name( $part, $form ); ?>[country]" class="happyforms-part__el--text-input happyforms-part__el--address-autocomplete" type="text" placeholder="<?php _e( 'Country', 'happyforms' ); ?>" <?php if ( 1 === $part['required'] ) : ?>required aria-required="true"<?php endif; ?> autocomplete="off" />
|
26 |
<div class="happyforms-part__el--address--results happyforms-part__el--address--results-country"></div>
|
27 |
</div>
|
28 |
</div>
|
29 |
<?php else: ?>
|
30 |
<div class="happyforms-part-el-wrap">
|
31 |
<div class="happyforms-part__el">
|
32 |
-
<input name="<?php happyforms_the_part_name( $part, $form ); ?>[country]" class="happyforms-part__el--text-input happyforms-part__el--address-autocomplete" type="text" placeholder="<?php _e( 'Country', 'happyforms' ); ?>" <?php if ( 1 === $part['required'] ) : ?>required aria-required="true"<?php endif; ?> autocomplete="off" />
|
33 |
<div class="happyforms-part__el--address--results happyforms-part__el--address--results-country"></div>
|
34 |
</div>
|
35 |
<div class="happyforms-part__el">
|
36 |
-
<input name="<?php happyforms_the_part_name( $part, $form ); ?>[city]"class="happyforms-part__el happyforms-part__el--text-input happyforms-part__el--address-city" type="text" placeholder="<?php _e( 'City', 'happyforms' ); ?>" <?php if ( 1 === $part['required'] ) : ?>required aria-required="true"<?php endif; ?> />
|
37 |
</div>
|
38 |
</div>
|
39 |
<?php endif; ?>
|
9 |
<?php if ( 'simple' === $part['mode'] ) : ?>
|
10 |
<div class="happyforms-part-el-wrap">
|
11 |
<div class="happyforms-part__el">
|
12 |
+
<input name="<?php happyforms_the_part_name( $part, $form ); ?>[full]" class="happyforms-part__el--text-input happyforms-part__el--address" type="text" value="<?php happyforms_the_part_value( $part, $form ); ?>" placeholder="<?php echo esc_attr( $part['placeholder'] ); ?>" <?php if ( 1 === $part['required'] ) : ?>required aria-required="true"<?php endif; ?> />
|
13 |
</div>
|
14 |
</div>
|
15 |
<?php elseif ( 'autocomplete' === $part['mode'] ) : ?>
|
16 |
<div class="happyforms-part-el-wrap">
|
17 |
<div class="happyforms-part__el">
|
18 |
+
<input name="<?php happyforms_the_part_name( $part, $form ); ?>[full]" class="happyforms-part__el--text-input happyforms-part__el--address-autocomplete" type="text" value="<?php happyforms_the_part_value( $part, $form ); ?>" placeholder="<?php echo esc_attr( $part['placeholder'] ); ?>" <?php if ( 1 === $part['required'] ) : ?>required aria-required="true"<?php endif; ?> autocomplete="off" />
|
19 |
<div class="happyforms-part__el--address--results happyforms-part__el--address--results-google"></div>
|
20 |
</div>
|
21 |
</div>
|
22 |
<?php elseif ( 'country' === $part['mode'] ) : ?>
|
23 |
<div class="happyforms-part-el-wrap">
|
24 |
<div class="happyforms-part__el">
|
25 |
+
<input name="<?php happyforms_the_part_name( $part, $form ); ?>[country]" class="happyforms-part__el--text-input happyforms-part__el--address-autocomplete" type="text" value="<?php happyforms_the_part_value( $part, $form, 'country' ); ?>" placeholder="<?php _e( 'Country', 'happyforms' ); ?>" <?php if ( 1 === $part['required'] ) : ?>required aria-required="true"<?php endif; ?> autocomplete="off" />
|
26 |
<div class="happyforms-part__el--address--results happyforms-part__el--address--results-country"></div>
|
27 |
</div>
|
28 |
</div>
|
29 |
<?php else: ?>
|
30 |
<div class="happyforms-part-el-wrap">
|
31 |
<div class="happyforms-part__el">
|
32 |
+
<input name="<?php happyforms_the_part_name( $part, $form ); ?>[country]" class="happyforms-part__el--text-input happyforms-part__el--address-autocomplete" type="text" value="<?php happyforms_the_part_value( $part, $form, 'country' ); ?>" placeholder="<?php _e( 'Country', 'happyforms' ); ?>" <?php if ( 1 === $part['required'] ) : ?>required aria-required="true"<?php endif; ?> autocomplete="off" />
|
33 |
<div class="happyforms-part__el--address--results happyforms-part__el--address--results-country"></div>
|
34 |
</div>
|
35 |
<div class="happyforms-part__el">
|
36 |
+
<input name="<?php happyforms_the_part_name( $part, $form ); ?>[city]"class="happyforms-part__el happyforms-part__el--text-input happyforms-part__el--address-city" type="text" value="<?php happyforms_the_part_value( $part, $form, 'city' ); ?>" placeholder="<?php _e( 'City', 'happyforms' ); ?>" <?php if ( 1 === $part['required'] ) : ?>required aria-required="true"<?php endif; ?> />
|
37 |
</div>
|
38 |
</div>
|
39 |
<?php endif; ?>
|
inc/templates/parts/frontend-checkbox.php
CHANGED
@@ -6,8 +6,12 @@
|
|
6 |
<?php endif; ?>
|
7 |
<div class="happyforms-part__el">
|
8 |
<?php foreach( $part['options'] as $option ) : ?>
|
|
|
|
|
|
|
|
|
9 |
<label class="option-label" id="<?php echo esc_attr( $option['id'] ); ?>">
|
10 |
-
<input type="checkbox" class="happyforms-visuallyhidden" name="<?php happyforms_the_part_name( $part, $form ); ?>[]" value="<?php echo esc_attr( $option['label'] ); ?>"<?php
|
11 |
<span class="checkmark"></span>
|
12 |
<span class="label"><?php echo esc_attr( $option['label'] ); ?></span>
|
13 |
</label>
|
6 |
<?php endif; ?>
|
7 |
<div class="happyforms-part__el">
|
8 |
<?php foreach( $part['options'] as $option ) : ?>
|
9 |
+
<?php
|
10 |
+
$checked = checked( $option['is_default'], 1, false );
|
11 |
+
$checked = $checked ? $checked : checked( happyforms_get_part_value( $part, $form, $option['label'] ), $option['label'], false );
|
12 |
+
?>
|
13 |
<label class="option-label" id="<?php echo esc_attr( $option['id'] ); ?>">
|
14 |
+
<input type="checkbox" class="happyforms-visuallyhidden" name="<?php happyforms_the_part_name( $part, $form ); ?>[]" value="<?php echo esc_attr( $option['label'] ); ?>" <?php echo $checked; ?>>
|
15 |
<span class="checkmark"></span>
|
16 |
<span class="label"><?php echo esc_attr( $option['label'] ); ?></span>
|
17 |
</label>
|
inc/templates/parts/frontend-date.php
CHANGED
@@ -12,7 +12,7 @@
|
|
12 |
<select name="<?php happyforms_the_part_name( $part, $form ); ?>[month]"<?php if ( 1 === $part['required'] ) : ?> required aria-required="true"<?php endif; ?>>
|
13 |
<option value=""><?php _e( 'Month', 'happyforms' ); ?></option>
|
14 |
<?php for ( $i = 1; $i <= 12; $i++ ) : ?>
|
15 |
-
<option value="<?php echo $i; ?>"
|
16 |
<?php endfor; ?>
|
17 |
</select>
|
18 |
</div>
|
@@ -20,7 +20,7 @@
|
|
20 |
<select name="<?php happyforms_the_part_name( $part, $form ); ?>[day]"<?php if ( 1 === $part['required'] ) : ?> required aria-required="true"<?php endif; ?>>
|
21 |
<option value=""><?php _e( 'Day', 'happyforms' ); ?></option>
|
22 |
<?php for ( $i = 1; $i <= 31; $i++ ) : ?>
|
23 |
-
<option value="<?php echo $i; ?>"
|
24 |
<?php endfor; ?>
|
25 |
</select>
|
26 |
</div>
|
@@ -31,12 +31,9 @@
|
|
31 |
$year_cutoff = 1910;
|
32 |
$year_current = date('Y');
|
33 |
|
34 |
-
for ( $i = $year_current; $i >= $year_cutoff; $i-- ) :
|
35 |
-
?>
|
36 |
-
|
37 |
-
<?php
|
38 |
-
endfor;
|
39 |
-
?>
|
40 |
</select>
|
41 |
</div>
|
42 |
<?php endif; ?>
|
@@ -54,28 +51,24 @@
|
|
54 |
}
|
55 |
|
56 |
for ( $i = $i_min; $i < $i_max; $i++ ) : ?>
|
57 |
-
<option value="<?php echo $i; ?>"
|
58 |
<?php endfor; ?>
|
59 |
</select>
|
60 |
</div>
|
61 |
<div class="happyforms-part__select-wrap happyforms-part-date__time-input">
|
62 |
<select name="<?php happyforms_the_part_name( $part, $form ); ?>[minute]"<?php if ( 1 === $part['required'] ) : ?> required aria-required="true"<?php endif; ?>>
|
63 |
<option value=""><?php _e( 'Minute', 'happyforms' ); ?></option>
|
64 |
-
<?php
|
65 |
-
|
66 |
-
|
67 |
-
<option value="<?php echo $i; ?>"><?php echo $i; ?></option>
|
68 |
-
<?php
|
69 |
-
endfor;
|
70 |
-
?>
|
71 |
</select>
|
72 |
</div>
|
73 |
<?php if ( 12 == intval( $part['time_format'] ) ) : ?>
|
74 |
<div class="happyforms-part__select-wrap happyforms-part-date__time-input happyforms-part-date__time-input--period">
|
75 |
<select name="<?php happyforms_the_part_name( $part, $form ); ?>[period]"<?php if ( 1 === $part['required'] ) : ?> required aria-required="true"<?php endif; ?>>
|
76 |
<option value=""><?php _e( 'Period', 'happyforms' ); ?></option>
|
77 |
-
<option value="AM"
|
78 |
-
<option value="PM"
|
79 |
</select>
|
80 |
</div>
|
81 |
<?php endif; ?>
|
12 |
<select name="<?php happyforms_the_part_name( $part, $form ); ?>[month]"<?php if ( 1 === $part['required'] ) : ?> required aria-required="true"<?php endif; ?>>
|
13 |
<option value=""><?php _e( 'Month', 'happyforms' ); ?></option>
|
14 |
<?php for ( $i = 1; $i <= 12; $i++ ) : ?>
|
15 |
+
<option value="<?php echo $i; ?>" <?php selected( happyforms_get_part_value( $part, $form, 'month' ), $i ); ?>><?php echo date( 'F', mktime( 0, 0, 0, $i) ); ?></option>
|
16 |
<?php endfor; ?>
|
17 |
</select>
|
18 |
</div>
|
20 |
<select name="<?php happyforms_the_part_name( $part, $form ); ?>[day]"<?php if ( 1 === $part['required'] ) : ?> required aria-required="true"<?php endif; ?>>
|
21 |
<option value=""><?php _e( 'Day', 'happyforms' ); ?></option>
|
22 |
<?php for ( $i = 1; $i <= 31; $i++ ) : ?>
|
23 |
+
<option value="<?php echo $i; ?>" <?php selected( happyforms_get_part_value( $part, $form, 'day' ), $i ); ?>><?php echo $i; ?></option>
|
24 |
<?php endfor; ?>
|
25 |
</select>
|
26 |
</div>
|
31 |
$year_cutoff = 1910;
|
32 |
$year_current = date('Y');
|
33 |
|
34 |
+
for ( $i = $year_current; $i >= $year_cutoff; $i-- ) : ?>
|
35 |
+
<option value="<?php echo $i; ?>" <?php selected( happyforms_get_part_value( $part, $form, 'year' ), $i ); ?>><?php echo $i; ?></option>
|
36 |
+
<?php endfor; ?>
|
|
|
|
|
|
|
37 |
</select>
|
38 |
</div>
|
39 |
<?php endif; ?>
|
51 |
}
|
52 |
|
53 |
for ( $i = $i_min; $i < $i_max; $i++ ) : ?>
|
54 |
+
<option value="<?php echo $i; ?>" <?php selected( happyforms_get_part_value( $part, $form, 'hour' ), $i ); ?>><?php echo $i; ?></option>
|
55 |
<?php endfor; ?>
|
56 |
</select>
|
57 |
</div>
|
58 |
<div class="happyforms-part__select-wrap happyforms-part-date__time-input">
|
59 |
<select name="<?php happyforms_the_part_name( $part, $form ); ?>[minute]"<?php if ( 1 === $part['required'] ) : ?> required aria-required="true"<?php endif; ?>>
|
60 |
<option value=""><?php _e( 'Minute', 'happyforms' ); ?></option>
|
61 |
+
<?php for ( $i = 0; $i < 60; $i++ ) : ?>
|
62 |
+
<option value="<?php echo $i; ?>" <?php selected( happyforms_get_part_value( $part, $form, 'minute' ), $i ); ?>><?php echo $i; ?></option>
|
63 |
+
<?php endfor; ?>
|
|
|
|
|
|
|
|
|
64 |
</select>
|
65 |
</div>
|
66 |
<?php if ( 12 == intval( $part['time_format'] ) ) : ?>
|
67 |
<div class="happyforms-part__select-wrap happyforms-part-date__time-input happyforms-part-date__time-input--period">
|
68 |
<select name="<?php happyforms_the_part_name( $part, $form ); ?>[period]"<?php if ( 1 === $part['required'] ) : ?> required aria-required="true"<?php endif; ?>>
|
69 |
<option value=""><?php _e( 'Period', 'happyforms' ); ?></option>
|
70 |
+
<option value="AM" <?php selected( happyforms_get_part_value( $part, $form, 'period' ), 'AM' ); ?>><?php _e( 'AM', 'happyforms' ); ?></option>
|
71 |
+
<option value="PM" <?php selected( happyforms_get_part_value( $part, $form, 'period' ), 'PM' ); ?>><?php _e( 'PM', 'happyforms' ); ?></option>
|
72 |
</select>
|
73 |
</div>
|
74 |
<?php endif; ?>
|
inc/templates/parts/frontend-email.php
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
<?php if ( 'happyforms-form--part-error-notices-above' === happyforms_get_form_property( $form, 'part_error_notices_location' ) ) : ?>
|
7 |
<?php happyforms_message_notices( $form, happyforms_get_part_name( $part, $form ) ); ?>
|
8 |
<?php endif; ?>
|
9 |
-
<input type="email" id="<?php happyforms_the_part_id( $part, $form ); ?>" name="<?php happyforms_the_part_name( $part, $form ); ?>" placeholder="<?php echo esc_attr( $part['placeholder'] ); ?>" class="happyforms-part__el happyforms-part__el--text-input" <?php if ( 1 === $part['required'] ) : ?> required aria-required="true"<?php endif; ?> />
|
10 |
<?php if ( 'as_placeholder' === $part['label_placement'] ) : ?>
|
11 |
<?php happyforms_the_part_label( $part, $form ); ?>
|
12 |
<?php endif; ?>
|
6 |
<?php if ( 'happyforms-form--part-error-notices-above' === happyforms_get_form_property( $form, 'part_error_notices_location' ) ) : ?>
|
7 |
<?php happyforms_message_notices( $form, happyforms_get_part_name( $part, $form ) ); ?>
|
8 |
<?php endif; ?>
|
9 |
+
<input type="email" id="<?php happyforms_the_part_id( $part, $form ); ?>" name="<?php happyforms_the_part_name( $part, $form ); ?>" value="<?php happyforms_the_part_value( $part, $form ); ?>" placeholder="<?php echo esc_attr( $part['placeholder'] ); ?>" class="happyforms-part__el happyforms-part__el--text-input" <?php if ( 1 === $part['required'] ) : ?> required aria-required="true"<?php endif; ?> />
|
10 |
<?php if ( 'as_placeholder' === $part['label_placement'] ) : ?>
|
11 |
<?php happyforms_the_part_label( $part, $form ); ?>
|
12 |
<?php endif; ?>
|
inc/templates/parts/frontend-multi-line-text.php
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
<?php if ( 'happyforms-form--part-error-notices-above' === happyforms_get_form_property( $form, 'part_error_notices_location' ) ) : ?>
|
7 |
<?php happyforms_message_notices( $form, happyforms_get_part_name( $part, $form ) ); ?>
|
8 |
<?php endif; ?>
|
9 |
-
<textarea id="<?php happyforms_the_part_id( $part, $form ); ?>" class="happyforms-part__el happyforms-part__el--text-input" name="<?php happyforms_the_part_name( $part, $form ); ?>" rows="5" placeholder="<?php echo esc_attr( $part['placeholder'] ); ?>"<?php if ( 1 === $part['required'] ) : ?> required aria-required="true"<?php endif;
|
10 |
<?php if ( 'as_placeholder' === $part['label_placement'] ) : ?>
|
11 |
<?php happyforms_the_part_label( $part, $form ); ?>
|
12 |
<?php endif; ?>
|
6 |
<?php if ( 'happyforms-form--part-error-notices-above' === happyforms_get_form_property( $form, 'part_error_notices_location' ) ) : ?>
|
7 |
<?php happyforms_message_notices( $form, happyforms_get_part_name( $part, $form ) ); ?>
|
8 |
<?php endif; ?>
|
9 |
+
<textarea id="<?php happyforms_the_part_id( $part, $form ); ?>" class="happyforms-part__el happyforms-part__el--text-input" name="<?php happyforms_the_part_name( $part, $form ); ?>" rows="5" placeholder="<?php echo esc_attr( $part['placeholder'] ); ?>"<?php if ( 1 === $part['required'] ) : ?> required aria-required="true"<?php endif; ?>><?php happyforms_the_part_value( $part, $form ); ?></textarea>
|
10 |
<?php if ( 'as_placeholder' === $part['label_placement'] ) : ?>
|
11 |
<?php happyforms_the_part_label( $part, $form ); ?>
|
12 |
<?php endif; ?>
|
inc/templates/parts/frontend-number.php
CHANGED
@@ -7,9 +7,9 @@
|
|
7 |
<?php happyforms_message_notices( $form, happyforms_get_part_name( $part, $form ) ); ?>
|
8 |
<?php endif; ?>
|
9 |
<?php if ( ! $part['masked'] ) : ?>
|
10 |
-
<input id="<?php happyforms_the_part_id( $part, $form ); ?>" class="happyforms-part__el happyforms-part__el--text-input" type="number" name="<?php happyforms_the_part_name( $part, $form ); ?>" placeholder="<?php echo esc_attr( $part['placeholder'] ); ?>" min="<?php echo esc_attr( $part['min_value'] ); ?>" max="<?php echo esc_attr( $part['max_value'] ); ?>" value="<?php echo esc_attr( $part['min_value'] ); ?>" <?php if ( 1 === $part['required'] ) : ?>required aria-required="true"<?php endif; ?> />
|
11 |
<?php else: ?>
|
12 |
-
<input id="<?php happyforms_the_part_id( $part, $form ); ?>" class="happyforms-part__el happyforms-part__el--text-input happyforms-masked-input" type="text" name="<?php happyforms_the_part_name( $part, $form ); ?>" placeholder="<?php echo esc_attr( $part['placeholder'] ); ?>" <?php if ( 1 === $part['required'] ) : ?>required aria-required="true"<?php endif; ?> />
|
13 |
<?php endif; ?>
|
14 |
<?php if ( 'as_placeholder' === $part['label_placement'] ) : ?>
|
15 |
<?php happyforms_the_part_label( $part, $form ); ?>
|
7 |
<?php happyforms_message_notices( $form, happyforms_get_part_name( $part, $form ) ); ?>
|
8 |
<?php endif; ?>
|
9 |
<?php if ( ! $part['masked'] ) : ?>
|
10 |
+
<input id="<?php happyforms_the_part_id( $part, $form ); ?>" class="happyforms-part__el happyforms-part__el--text-input" type="number" value="<?php happyforms_the_part_value( $part, $form ); ?>" name="<?php happyforms_the_part_name( $part, $form ); ?>" placeholder="<?php echo esc_attr( $part['placeholder'] ); ?>" min="<?php echo esc_attr( $part['min_value'] ); ?>" max="<?php echo esc_attr( $part['max_value'] ); ?>" value="<?php echo esc_attr( $part['min_value'] ); ?>" <?php if ( 1 === $part['required'] ) : ?>required aria-required="true"<?php endif; ?> />
|
11 |
<?php else: ?>
|
12 |
+
<input id="<?php happyforms_the_part_id( $part, $form ); ?>" class="happyforms-part__el happyforms-part__el--text-input happyforms-masked-input" type="text" value="<?php happyforms_the_part_value( $part, $form ); ?>" name="<?php happyforms_the_part_name( $part, $form ); ?>" placeholder="<?php echo esc_attr( $part['placeholder'] ); ?>" <?php if ( 1 === $part['required'] ) : ?>required aria-required="true"<?php endif; ?> />
|
13 |
<?php endif; ?>
|
14 |
<?php if ( 'as_placeholder' === $part['label_placement'] ) : ?>
|
15 |
<?php happyforms_the_part_label( $part, $form ); ?>
|
inc/templates/parts/frontend-phone.php
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
<?php if ( 'happyforms-form--part-error-notices-above' === happyforms_get_form_property( $form, 'part_error_notices_location' ) ) : ?>
|
7 |
<?php happyforms_message_notices( $form, happyforms_get_part_name( $part, $form ) ); ?>
|
8 |
<?php endif; ?>
|
9 |
-
<input id="<?php happyforms_the_part_id( $part, $form ); ?>" type="text" name="<?php happyforms_the_part_name( $part, $form ); ?>" placeholder="<?php echo esc_attr( $part['placeholder'] ); ?>" <?php if ( 1 === $part['required'] ) : ?>required aria-required="true"<?php endif; ?> />
|
10 |
<?php if ( 'as_placeholder' === $part['label_placement'] ) : ?>
|
11 |
<?php happyforms_the_part_label( $part, $form ); ?>
|
12 |
<?php endif; ?>
|
6 |
<?php if ( 'happyforms-form--part-error-notices-above' === happyforms_get_form_property( $form, 'part_error_notices_location' ) ) : ?>
|
7 |
<?php happyforms_message_notices( $form, happyforms_get_part_name( $part, $form ) ); ?>
|
8 |
<?php endif; ?>
|
9 |
+
<input id="<?php happyforms_the_part_id( $part, $form ); ?>" type="text" value="<?php happyforms_the_part_value( $part, $form ); ?>" name="<?php happyforms_the_part_name( $part, $form ); ?>" placeholder="<?php echo esc_attr( $part['placeholder'] ); ?>" <?php if ( 1 === $part['required'] ) : ?>required aria-required="true"<?php endif; ?> />
|
10 |
<?php if ( 'as_placeholder' === $part['label_placement'] ) : ?>
|
11 |
<?php happyforms_the_part_label( $part, $form ); ?>
|
12 |
<?php endif; ?>
|
inc/templates/parts/frontend-radio.php
CHANGED
@@ -6,9 +6,13 @@
|
|
6 |
<?php endif; ?>
|
7 |
<div class="happyforms-part__el">
|
8 |
<?php foreach( $part['options'] as $option ) : ?>
|
|
|
|
|
|
|
|
|
9 |
<div class="happyforms-part__option happyforms-part-option" id="<?php echo esc_attr( $option['id'] ); ?>">
|
10 |
<label class="option-label">
|
11 |
-
<input type="radio" class="happyforms-visuallyhidden" name="<?php happyforms_the_part_name( $part, $form ); ?>" value="<?php echo esc_attr( $option['label'] ); ?>"<?php
|
12 |
<span class="checkmark"></span>
|
13 |
<span class="border"></span>
|
14 |
<span class="label"><?php echo esc_attr( $option['label'] ); ?></span>
|
6 |
<?php endif; ?>
|
7 |
<div class="happyforms-part__el">
|
8 |
<?php foreach( $part['options'] as $option ) : ?>
|
9 |
+
<?php
|
10 |
+
$checked = checked( $option['is_default'], 1, false );
|
11 |
+
$checked = $checked ? $checked : checked( happyforms_get_part_value( $part, $form, $option['label'] ), $option['label'], false );
|
12 |
+
?>
|
13 |
<div class="happyforms-part__option happyforms-part-option" id="<?php echo esc_attr( $option['id'] ); ?>">
|
14 |
<label class="option-label">
|
15 |
+
<input type="radio" class="happyforms-visuallyhidden" name="<?php happyforms_the_part_name( $part, $form ); ?>" value="<?php echo esc_attr( $option['label'] ); ?>" <?php echo $checked; ?>>
|
16 |
<span class="checkmark"></span>
|
17 |
<span class="border"></span>
|
18 |
<span class="label"><?php echo esc_attr( $option['label'] ); ?></span>
|
inc/templates/parts/frontend-rating.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
<input class="happyforms-visuallyhidden" type="radio" value="0" id="<?php echo esc_attr( $part['id'] ); ?>_0" name="<?php happyforms_the_part_name( $part, $form ); ?>" checked>
|
6 |
|
7 |
<?php for ( $i = 1; $i <= $part['stars_num']; $i++ ) { ?>
|
8 |
-
<input class="happyforms-visuallyhidden star_<?php echo esc_attr( $i ); ?>" type="radio" value="<?php echo esc_attr( $i ); ?>" id="<?php echo esc_attr( $part['id'] ); ?>_<?php echo esc_attr( $i ); ?>" name="<?php happyforms_the_part_name( $part, $form ); ?>"
|
9 |
<label class="happyforms-star__label" for="<?php echo esc_attr( $part['id'] ); ?>_<?php echo esc_attr( $i ); ?>">
|
10 |
<span class="happyforms-visuallyhidden"><?php echo esc_attr( $i ); ?> <?php _e( 'Stars', 'happyforms' ); ?></span>
|
11 |
<svg class="happyforms-star" viewBox="0 0 512 512" fill=""><path class="happyforms-star__star" d="M512 198.525l-176.89-25.704-79.11-160.291-79.108 160.291-176.892 25.704 128 124.769-30.216 176.176 158.216-83.179 158.216 83.179-30.217-176.176 128.001-124.769z"></path></svg>
|
5 |
<input class="happyforms-visuallyhidden" type="radio" value="0" id="<?php echo esc_attr( $part['id'] ); ?>_0" name="<?php happyforms_the_part_name( $part, $form ); ?>" checked>
|
6 |
|
7 |
<?php for ( $i = 1; $i <= $part['stars_num']; $i++ ) { ?>
|
8 |
+
<input class="happyforms-visuallyhidden star_<?php echo esc_attr( $i ); ?>" type="radio" value="<?php echo esc_attr( $i ); ?>" id="<?php echo esc_attr( $part['id'] ); ?>_<?php echo esc_attr( $i ); ?>" name="<?php happyforms_the_part_name( $part, $form ); ?>" <?php checked( happyforms_get_part_value( $part, $form ), $i ); ?>>
|
9 |
<label class="happyforms-star__label" for="<?php echo esc_attr( $part['id'] ); ?>_<?php echo esc_attr( $i ); ?>">
|
10 |
<span class="happyforms-visuallyhidden"><?php echo esc_attr( $i ); ?> <?php _e( 'Stars', 'happyforms' ); ?></span>
|
11 |
<svg class="happyforms-star" viewBox="0 0 512 512" fill=""><path class="happyforms-star__star" d="M512 198.525l-176.89-25.704-79.11-160.291-79.108 160.291-176.892 25.704 128 124.769-30.216 176.176 158.216-83.179 158.216 83.179-30.217-176.176 128.001-124.769z"></path></svg>
|
inc/templates/parts/frontend-scale.php
CHANGED
@@ -10,8 +10,7 @@
|
|
10 |
</div>
|
11 |
<input id="<?php happyforms_the_part_id( $part, $form ); ?>" type="range" name="<?php happyforms_the_part_name( $part, $form ); ?>" step="<?php echo esc_attr( $part['step'] ); ?>" class="happyforms-part__el happyforms-part__el--text-input"
|
12 |
<?php if ( 1 === $part['required'] ) : ?>required aria-required="true"<?php endif; ?>
|
13 |
-
min="<?php echo esc_attr( $part['min_value'] ); ?>" max="<?php echo esc_attr( $part['max_value'] ); ?>" value="<?php
|
14 |
-
/>
|
15 |
<?php happyforms_print_part_description( $part ); ?>
|
16 |
<output for="<?php happyforms_the_part_id( $part, $form ); ?>"><?php echo $part['default_value']; ?></output>
|
17 |
<?php if ( 'happyforms-form--part-error-notices-below' === happyforms_get_form_property( $form, 'part_error_notices_location' ) || empty( happyforms_get_form_property( $form, 'part_error_notices_location' ) ) ) : ?>
|
10 |
</div>
|
11 |
<input id="<?php happyforms_the_part_id( $part, $form ); ?>" type="range" name="<?php happyforms_the_part_name( $part, $form ); ?>" step="<?php echo esc_attr( $part['step'] ); ?>" class="happyforms-part__el happyforms-part__el--text-input"
|
12 |
<?php if ( 1 === $part['required'] ) : ?>required aria-required="true"<?php endif; ?>
|
13 |
+
min="<?php echo esc_attr( $part['min_value'] ); ?>" max="<?php echo esc_attr( $part['max_value'] ); ?>" value="<?php happyforms_the_part_value( $part, $form ); ?>" />
|
|
|
14 |
<?php happyforms_print_part_description( $part ); ?>
|
15 |
<output for="<?php happyforms_the_part_id( $part, $form ); ?>"><?php echo $part['default_value']; ?></output>
|
16 |
<?php if ( 'happyforms-form--part-error-notices-below' === happyforms_get_form_property( $form, 'part_error_notices_location' ) || empty( happyforms_get_form_property( $form, 'part_error_notices_location' ) ) ) : ?>
|
inc/templates/parts/frontend-select.php
CHANGED
@@ -7,7 +7,11 @@
|
|
7 |
<div class="happyforms-part__select-wrap">
|
8 |
<select id="<?php happyforms_the_part_id( $part, $form ); ?>" name="<?php happyforms_the_part_name( $part, $form ); ?>" class="happyforms-part__el"<?php if ( 1 === $part['required'] ) : ?> required aria-required="true"<?php endif; ?>>
|
9 |
<?php foreach( $part['options'] as $option ) : ?>
|
10 |
-
|
|
|
|
|
|
|
|
|
11 |
<?php endforeach; ?>
|
12 |
</select>
|
13 |
</div>
|
7 |
<div class="happyforms-part__select-wrap">
|
8 |
<select id="<?php happyforms_the_part_id( $part, $form ); ?>" name="<?php happyforms_the_part_name( $part, $form ); ?>" class="happyforms-part__el"<?php if ( 1 === $part['required'] ) : ?> required aria-required="true"<?php endif; ?>>
|
9 |
<?php foreach( $part['options'] as $option ) : ?>
|
10 |
+
<?php
|
11 |
+
$selected = selected( $option['is_default'], 1, false );
|
12 |
+
$selected = $selected ? $selected : selected( happyforms_get_part_value( $part, $form, $option['label'] ), $option['label'], false );
|
13 |
+
?>
|
14 |
+
<option id="<?php echo esc_attr( $option['id'] ); ?>" value="<?php echo esc_attr( $option['label'] ); ?>" <?php echo $selected; ?>><?php echo esc_attr( $option['label'] ); ?></option>
|
15 |
<?php endforeach; ?>
|
16 |
</select>
|
17 |
</div>
|
inc/templates/parts/frontend-single-line-text.php
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
<?php if ( 'happyforms-form--part-error-notices-above' === happyforms_get_form_property( $form, 'part_error_notices_location' ) ) : ?>
|
7 |
<?php happyforms_message_notices( $form, happyforms_get_part_name( $part, $form ) ); ?>
|
8 |
<?php endif; ?>
|
9 |
-
<input id="<?php happyforms_the_part_id( $part, $form ); ?>" type="text" name="<?php happyforms_the_part_name( $part, $form ); ?>" placeholder="<?php echo esc_attr( $part['placeholder'] ); ?>" class="happyforms-part__el happyforms-part__el--text-input" <?php if ( 1 === $part['required'] ) : ?>required aria-required="true"<?php endif; ?> />
|
10 |
<?php if ( 'as_placeholder' === $part['label_placement'] ) : ?>
|
11 |
<?php happyforms_the_part_label( $part, $form ); ?>
|
12 |
<?php endif; ?>
|
6 |
<?php if ( 'happyforms-form--part-error-notices-above' === happyforms_get_form_property( $form, 'part_error_notices_location' ) ) : ?>
|
7 |
<?php happyforms_message_notices( $form, happyforms_get_part_name( $part, $form ) ); ?>
|
8 |
<?php endif; ?>
|
9 |
+
<input id="<?php happyforms_the_part_id( $part, $form ); ?>" type="text" name="<?php happyforms_the_part_name( $part, $form ); ?>" value="<?php happyforms_the_part_value( $part, $form ); ?>" placeholder="<?php echo esc_attr( $part['placeholder'] ); ?>" class="happyforms-part__el happyforms-part__el--text-input" <?php if ( 1 === $part['required'] ) : ?>required aria-required="true"<?php endif; ?> />
|
10 |
<?php if ( 'as_placeholder' === $part['label_placement'] ) : ?>
|
11 |
<?php happyforms_the_part_label( $part, $form ); ?>
|
12 |
<?php endif; ?>
|
inc/templates/parts/frontend-title.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
<select id="<?php happyforms_the_part_id( $part, $form ); ?>" name="<?php happyforms_the_part_name( $part, $form ); ?>" class="happyforms-part__el"<?php if ( 1 === $part['required'] ) : ?> required aria-required="true"<?php endif; ?>>
|
6 |
<option value="">- <?php _e( 'Select', 'happyforms' ); ?> -</option>
|
7 |
<?php $honorifics = $this->get_honorifics(); foreach ( $honorifics as $title ) : ?>
|
8 |
-
<option value="<?php echo $title; ?>"
|
9 |
<?php endforeach; ?>
|
10 |
</select>
|
11 |
</div>
|
5 |
<select id="<?php happyforms_the_part_id( $part, $form ); ?>" name="<?php happyforms_the_part_name( $part, $form ); ?>" class="happyforms-part__el"<?php if ( 1 === $part['required'] ) : ?> required aria-required="true"<?php endif; ?>>
|
6 |
<option value="">- <?php _e( 'Select', 'happyforms' ); ?> -</option>
|
7 |
<?php $honorifics = $this->get_honorifics(); foreach ( $honorifics as $title ) : ?>
|
8 |
+
<option value="<?php echo $title; ?>" <?php selected( happyforms_get_part_value( $part, $form ), $title ); ?>><?php echo $title; ?></option>
|
9 |
<?php endforeach; ?>
|
10 |
</select>
|
11 |
</div>
|
inc/templates/parts/frontend-website-url.php
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
<?php if ( 'happyforms-form--part-error-notices-above' === happyforms_get_form_property( $form, 'part_error_notices_location' ) ) : ?>
|
7 |
<?php happyforms_message_notices( $form, happyforms_get_part_name( $part, $form ) ); ?>
|
8 |
<?php endif; ?>
|
9 |
-
<input id="<?php happyforms_the_part_id( $part, $form ); ?>" type="text" name="<?php happyforms_the_part_name( $part, $form ); ?>" placeholder="<?php echo esc_attr( $part['placeholder'] ); ?>" class="happyforms-part__el happyforms-part__el--text-input" <?php if ( 1 === $part['required'] ) : ?>required aria-required="true"<?php endif; ?> />
|
10 |
<?php if ( 'as_placeholder' === $part['label_placement'] ) : ?>
|
11 |
<?php happyforms_the_part_label( $part, $form ); ?>
|
12 |
<?php endif; ?>
|
6 |
<?php if ( 'happyforms-form--part-error-notices-above' === happyforms_get_form_property( $form, 'part_error_notices_location' ) ) : ?>
|
7 |
<?php happyforms_message_notices( $form, happyforms_get_part_name( $part, $form ) ); ?>
|
8 |
<?php endif; ?>
|
9 |
+
<input id="<?php happyforms_the_part_id( $part, $form ); ?>" type="text" value="<?php happyforms_the_part_value( $part, $form ); ?>" name="<?php happyforms_the_part_name( $part, $form ); ?>" placeholder="<?php echo esc_attr( $part['placeholder'] ); ?>" class="happyforms-part__el happyforms-part__el--text-input" <?php if ( 1 === $part['required'] ) : ?>required aria-required="true"<?php endif; ?> />
|
10 |
<?php if ( 'as_placeholder' === $part['label_placement'] ) : ?>
|
11 |
<?php happyforms_the_part_label( $part, $form ); ?>
|
12 |
<?php endif; ?>
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Tags: contact, contact form, email, feedback form, form, form builder, custom fo
|
|
5 |
Requires at least: 4.8
|
6 |
Tested up to: 4.9.5
|
7 |
Requires PHP: 5.2.4
|
8 |
-
Stable tag: 1.4
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -74,6 +74,13 @@ Absolutely! HappyForms gets out of the way and is designed to work with any them
|
|
74 |
|
75 |
== Changelog ==
|
76 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
= 1.4.0 =
|
78 |
* Bug fix: Powered By HappyForms appearance.
|
79 |
|
@@ -112,6 +119,9 @@ Absolutely! HappyForms gets out of the way and is designed to work with any them
|
|
112 |
|
113 |
== Upgrade Notice ==
|
114 |
|
|
|
|
|
|
|
115 |
= 1.4.0 =
|
116 |
* Fix byline appearance.
|
117 |
|
5 |
Requires at least: 4.8
|
6 |
Tested up to: 4.9.5
|
7 |
Requires PHP: 5.2.4
|
8 |
+
Stable tag: 1.4.1
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
74 |
|
75 |
== Changelog ==
|
76 |
|
77 |
+
= 1.4.1 =
|
78 |
+
* New feature: Form width style control, allowing to set form width in % or px.
|
79 |
+
* New feature: Text alignment style control to allow for changing text align in various places in forms.
|
80 |
+
* New feature: Added support for RTL languages with Text direction control in Style step.
|
81 |
+
* Improvement: Added filters to control default part values and success/error submission actions.
|
82 |
+
* Bug fix: array_column wasn't available on PHP versions prior to 5.5 and was causing a fatal error.
|
83 |
+
|
84 |
= 1.4.0 =
|
85 |
* Bug fix: Powered By HappyForms appearance.
|
86 |
|
119 |
|
120 |
== Upgrade Notice ==
|
121 |
|
122 |
+
= 1.4.1 =
|
123 |
+
* Additional style controls, support for RTL languages, bug fixes.
|
124 |
+
|
125 |
= 1.4.0 =
|
126 |
* Fix byline appearance.
|
127 |
|