Version Description
Download this release
Release Info
Developer | Desertsnowman |
Plugin | Caldera Forms – More Than Contact Forms |
Version | 1.4.0 |
Comparing to | |
See all releases |
Code changes from version 1.3.5.3 to 1.4.0
- assets/css/admin.css +318 -6
- assets/css/caldera-form.css +1 -20
- assets/css/caldera-grid.css +2 -4
- assets/css/editor-grid.css +3 -0
- assets/css/fields.min.css +41 -1
- assets/css/modals.css +2 -5
- assets/js/admin.js +14 -0
- assets/js/admin.min.js +1 -1
- assets/js/ajax-core.js +6 -21
- assets/js/ajax-core.min.js +1 -1
- assets/js/conditionals.js +0 -0
- assets/js/conditionals.min.js +0 -0
- assets/js/edit.js +216 -161
- assets/js/edit.min.js +2 -2
- assets/js/fields.js +4833 -0
- assets/js/fields.min.js +4 -4
- assets/js/formobject-new.js +0 -180
- assets/js/formobject.js +1 -3
- assets/js/frontend-script-init.js +62 -27
- assets/js/frontend-script-init.min.js +1 -1
- assets/js/handlebars.baldrick.js +1 -1
- assets/js/jquery.baldrick.js +1 -1
- assets/js/jquery.baldrick.min.js +0 -0
- assets/js/shortcode-insert.js +0 -0
- assets/js/shortcode-insert.min.js +0 -0
- assets/js/support-page.js +1 -1
- assets/js/wp-baldrick-full.js +6 -1
- caldera-core.php +9 -8
- classes/admin.php +443 -372
- classes/autoloader.php +11 -6
- classes/core.php +625 -661
- classes/db/base.php +16 -5
- classes/db/track.php +26 -24
- classes/email/attachment.php +98 -0
- classes/email/callbacks.php +50 -0
- classes/email/client.php +74 -0
- classes/email/interface.php +39 -0
- classes/email/preview.php +95 -0
- classes/email/previews.php +160 -0
- classes/email/sendgrid.php +177 -0
- classes/email/sendgrid/lib/SendGrid.php +43 -0
- classes/email/sendgrid/lib/helpers/mail/Mail.php +1125 -0
- classes/email/sendgrid/lib/helpers/mail/README.md +14 -0
- classes/email/sendgrid/sendgrid-php.php +3 -0
- classes/email/sendgrid/vendor/autoload.php +7 -0
- classes/email/sendgrid/vendor/composer/ClassLoader.php +413 -0
- classes/email/sendgrid/vendor/composer/LICENSE +21 -0
- classes/email/sendgrid/vendor/composer/autoload_classmap.php +9 -0
- classes/email/sendgrid/vendor/composer/autoload_files.php +11 -0
- classes/email/sendgrid/vendor/composer/autoload_namespaces.php +10 -0
- classes/email/sendgrid/vendor/composer/autoload_psr4.php +9 -0
- classes/email/sendgrid/vendor/composer/autoload_real.php +70 -0
- classes/email/sendgrid/vendor/composer/autoload_static.php +31 -0
- classes/email/sendgrid/vendor/composer/installed.json +56 -0
- classes/email/sendgrid/vendor/sendgrid/php-http-client/CHANGELOG.md +28 -0
- classes/email/sendgrid/vendor/sendgrid/php-http-client/CONTRIBUTING.md +192 -0
- classes/email/sendgrid/vendor/sendgrid/php-http-client/LICENSE.txt +22 -0
- classes/email/sendgrid/vendor/sendgrid/php-http-client/README.md +98 -0
- classes/email/sendgrid/vendor/sendgrid/php-http-client/examples/example.php +70 -0
- classes/email/sendgrid/vendor/sendgrid/php-http-client/lib/SendGrid/Client.php +232 -0
- classes/email/settings.php +337 -0
- classes/entry.php +425 -0
- classes/entry/bulk.php +72 -0
- classes/entry/entries.php +223 -0
- classes/entry/entry.php +29 -0
- classes/entry/field.php +71 -0
- classes/entry/meta.php +48 -0
- classes/entry/object.php +21 -0
- classes/entry/ui.php +127 -0
- classes/forms.php +9 -0
- classes/object.php +153 -0
- classes/save.php +300 -173
- classes/widget.php +11 -1
- composer.json +15 -0
- fields/advanced_file/config_template.php +15 -7
- fields/advanced_file/field.php +36 -4
- fields/advanced_file/uploader.js +161 -104
- fields/advanced_file/uploader.min.js +1 -1
- fields/button/field.php +2 -2
- fields/calculation/field.php +6 -4
- fields/calculation/line-templates.php +2 -2
- fields/calculation/preview.php +1 -1
- fields/checkbox/field.php +5 -6
- fields/color_picker/field.php +0 -0
assets/css/admin.css
CHANGED
@@ -286,6 +286,7 @@ select.caldera-type-selector {
|
|
286 |
top: 84px;
|
287 |
}
|
288 |
.caldera-editor-header .button.caldera-header-save-button,
|
|
|
289 |
.caldera-editor-header .button.caldera-header-preview-button {
|
290 |
float: left;
|
291 |
margin: 7px 12px 0 12px;
|
@@ -311,7 +312,7 @@ select.caldera-type-selector {
|
|
311 |
li.caldera-forms-version {
|
312 |
color: #AFAFAF;
|
313 |
font-size: 0.8em;
|
314 |
-
padding: 12px 0;
|
315 |
}
|
316 |
li.caldera-editor-logo {
|
317 |
font-size: 18px;
|
@@ -331,6 +332,12 @@ li.caldera-editor-logo {
|
|
331 |
.caldera-editor-header-nav > li.caldera-forms-toolbar-item {
|
332 |
padding: 6px 6px 6px 12px;
|
333 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
334 |
.caldera-editor-body .users-settings-input {
|
335 |
width: 350px;
|
336 |
}
|
@@ -422,14 +429,35 @@ li.caldera-editor-logo {
|
|
422 |
width: 100%;
|
423 |
}
|
424 |
.layout-form-field .icon-edit {
|
425 |
-
background: none repeat scroll 0 0
|
426 |
border-radius: 4px;
|
427 |
-
|
428 |
padding: 5px;
|
429 |
position: absolute;
|
430 |
right: 12px;
|
431 |
top: 12px;
|
432 |
z-index: 999;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
433 |
}
|
434 |
.layout-form-field.ui-sortable-helper {
|
435 |
border-radius: 3px;
|
@@ -464,6 +492,17 @@ textarea.block-input.field-config {
|
|
464 |
.field-config.field-checkbox {
|
465 |
margin-top: 4px;
|
466 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
467 |
h3.caldera-editor-field-title {
|
468 |
border-bottom: 1px solid #CFCFCF;
|
469 |
font-size: 18px;
|
@@ -707,7 +746,7 @@ a span.error-tag {
|
|
707 |
position: relative;
|
708 |
}
|
709 |
.form-entries-wrap {
|
710 |
-
padding: 0 30px;
|
711 |
}
|
712 |
.form-entries-wrap .caldera-forms-entry-exporter{
|
713 |
margin-top: 1px;
|
@@ -726,6 +765,8 @@ a span.error-tag {
|
|
726 |
min-width: 100%;
|
727 |
max-width: 100%;
|
728 |
width: auto;
|
|
|
|
|
729 |
}
|
730 |
.form-extend-page-wrap .list.form-panel.postbox {
|
731 |
-moz-box-sizing: border-box;
|
@@ -1627,11 +1668,10 @@ tr.form_entry_row.loading {
|
|
1627 |
}
|
1628 |
.tablenav.caldera-table-nav {
|
1629 |
clear: none;
|
1630 |
-
float: right;
|
1631 |
margin: -42px 18px 0 0;
|
1632 |
}
|
1633 |
.caldera-table-nav .tablenav-pages{
|
1634 |
-
|
1635 |
}
|
1636 |
.caldera-table-nav .tablenav-pages .current-page{
|
1637 |
width: 45px;
|
@@ -1676,4 +1716,276 @@ tr.form_entry_row.loading {
|
|
1676 |
/* admin cleanups */
|
1677 |
#import_form_baldrickModalBody{
|
1678 |
overflow: hidden;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1679 |
}
|
286 |
top: 84px;
|
287 |
}
|
288 |
.caldera-editor-header .button.caldera-header-save-button,
|
289 |
+
.caldera-editor-header .caldera-header-email-preview-button,
|
290 |
.caldera-editor-header .button.caldera-header-preview-button {
|
291 |
float: left;
|
292 |
margin: 7px 12px 0 12px;
|
312 |
li.caldera-forms-version {
|
313 |
color: #AFAFAF;
|
314 |
font-size: 0.8em;
|
315 |
+
padding: 12px 0 10px;
|
316 |
}
|
317 |
li.caldera-editor-logo {
|
318 |
font-size: 18px;
|
332 |
.caldera-editor-header-nav > li.caldera-forms-toolbar-item {
|
333 |
padding: 6px 6px 6px 12px;
|
334 |
}
|
335 |
+
.caldera-editor-header-nav > li.caldera-forms-toolbar-item.separator {
|
336 |
+
border-right: 1px solid #efefef;
|
337 |
+
height: 29px;
|
338 |
+
margin-right: 10px;
|
339 |
+
padding: 6px 0 6px 12px;
|
340 |
+
}
|
341 |
.caldera-editor-body .users-settings-input {
|
342 |
width: 350px;
|
343 |
}
|
429 |
width: 100%;
|
430 |
}
|
431 |
.layout-form-field .icon-edit {
|
432 |
+
background: #efefef none repeat scroll 0 0;
|
433 |
border-radius: 4px;
|
434 |
+
border: 1px solid #bfbfbf;
|
435 |
padding: 5px;
|
436 |
position: absolute;
|
437 |
right: 12px;
|
438 |
top: 12px;
|
439 |
z-index: 999;
|
440 |
+
color: #707070;
|
441 |
+
}
|
442 |
+
.layout-form-field .dashicons-admin-page {
|
443 |
+
background: #efefef none repeat scroll 0 0;
|
444 |
+
border: 1px solid #bfbfbf;
|
445 |
+
border-radius: 4px;
|
446 |
+
color: #707070;
|
447 |
+
font-size: 16px;
|
448 |
+
height: 25px;
|
449 |
+
line-height: 25px;
|
450 |
+
padding: 0;
|
451 |
+
position: absolute;
|
452 |
+
right: 40px;
|
453 |
+
top: 12px;
|
454 |
+
width: 25px;
|
455 |
+
z-index: 999;
|
456 |
+
}
|
457 |
+
.layout-form-field .icon-edit:hover,
|
458 |
+
.layout-form-field .dashicons-admin-page:hover{
|
459 |
+
background: #fcfcfc none repeat scroll 0 0;
|
460 |
+
color: #505050;
|
461 |
}
|
462 |
.layout-form-field.ui-sortable-helper {
|
463 |
border-radius: 3px;
|
492 |
.field-config.field-checkbox {
|
493 |
margin-top: 4px;
|
494 |
}
|
495 |
+
#new_form_baldrickModalBody .new-form-name.block-input.field-config {
|
496 |
+
background-color: #fff;
|
497 |
+
border-color: #779233;
|
498 |
+
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4) inset;
|
499 |
+
color: #333;
|
500 |
+
margin-top: 17px;
|
501 |
+
padding: 7px;
|
502 |
+
}
|
503 |
+
#new_form_baldrickModalBody .new-form-name.block-input.field-config.has-error {
|
504 |
+
border-color: #FF0000;
|
505 |
+
}
|
506 |
h3.caldera-editor-field-title {
|
507 |
border-bottom: 1px solid #CFCFCF;
|
508 |
font-size: 18px;
|
746 |
position: relative;
|
747 |
}
|
748 |
.form-entries-wrap {
|
749 |
+
padding: 0 0 0 30px;
|
750 |
}
|
751 |
.form-entries-wrap .caldera-forms-entry-exporter{
|
752 |
margin-top: 1px;
|
765 |
min-width: 100%;
|
766 |
max-width: 100%;
|
767 |
width: auto;
|
768 |
+
overflow: auto;
|
769 |
+
box-sizing: border-box;
|
770 |
}
|
771 |
.form-extend-page-wrap .list.form-panel.postbox {
|
772 |
-moz-box-sizing: border-box;
|
1668 |
}
|
1669 |
.tablenav.caldera-table-nav {
|
1670 |
clear: none;
|
|
|
1671 |
margin: -42px 18px 0 0;
|
1672 |
}
|
1673 |
.caldera-table-nav .tablenav-pages{
|
1674 |
+
text-align: right;
|
1675 |
}
|
1676 |
.caldera-table-nav .tablenav-pages .current-page{
|
1677 |
width: 45px;
|
1716 |
/* admin cleanups */
|
1717 |
#import_form_baldrickModalBody{
|
1718 |
overflow: hidden;
|
1719 |
+
}
|
1720 |
+
/* new templates */
|
1721 |
+
.cf-form-template{
|
1722 |
+
border: 2px dashed #cfcfcf;
|
1723 |
+
float: left;
|
1724 |
+
height: 180px;
|
1725 |
+
margin: 0 5px 10px;
|
1726 |
+
padding: 5px;
|
1727 |
+
width: 162px;
|
1728 |
+
border-radius: 4px;
|
1729 |
+
position: relative;
|
1730 |
+
overflow: hidden;
|
1731 |
+
}
|
1732 |
+
.cf-template-title {
|
1733 |
+
padding: 2px 2px 0 0;
|
1734 |
+
}
|
1735 |
+
.cf-form-create {
|
1736 |
+
background: #a3be5f none repeat scroll 0 0;
|
1737 |
+
border-radius: 4px;
|
1738 |
+
bottom: -2px;
|
1739 |
+
overflow: hidden;
|
1740 |
+
padding: 5px;
|
1741 |
+
position: absolute;
|
1742 |
+
top: -2px;
|
1743 |
+
width: 362px;
|
1744 |
+
z-index: 100;
|
1745 |
+
}
|
1746 |
+
.caldera-grid.cf-form-create button.cf-change-template-button,
|
1747 |
+
.caldera-grid.cf-form-create button.cf-create-form-button {
|
1748 |
+
background-color: #fff;
|
1749 |
+
color: #93ae4f;
|
1750 |
+
border: 1px solid #93ae4f;
|
1751 |
+
border-radius: 3px;
|
1752 |
+
display: inline-block;
|
1753 |
+
margin: 24px 0;
|
1754 |
+
padding: 9px;
|
1755 |
+
width: 174px;
|
1756 |
+
}
|
1757 |
+
.caldera-grid.cf-form-create button.cf-change-template-button:hover,
|
1758 |
+
.caldera-grid.cf-form-create button.cf-create-form-button:hover{
|
1759 |
+
background-color: #efefef;
|
1760 |
+
color: #7e943d;
|
1761 |
+
}
|
1762 |
+
.caldera-grid.cf-form-create button.cf-change-template-button.cf-loading-form {
|
1763 |
+
background: #a3be5f;
|
1764 |
+
color: #fff;
|
1765 |
+
}
|
1766 |
+
.caldera-grid.cf-form-create button.cf-loading-form .dashicons{
|
1767 |
+
display: none;
|
1768 |
+
}
|
1769 |
+
.caldera-grid.cf-form-create button.cf-create-form-button .spinner{
|
1770 |
+
display: none;
|
1771 |
+
margin: -1px 0 -1px 0;
|
1772 |
+
float: none;
|
1773 |
+
}
|
1774 |
+
.caldera-grid.cf-form-create button.cf-loading-form,
|
1775 |
+
.caldera-grid.cf-form-create button.cf-loading-form:hover {
|
1776 |
+
background: #efefef none repeat scroll 0 0;
|
1777 |
+
border-color: #bfbfbf;
|
1778 |
+
color: #7f7f7f;
|
1779 |
+
cursor: default;
|
1780 |
+
}
|
1781 |
+
.caldera-grid.cf-form-create button.cf-loading-form .spinner{
|
1782 |
+
display: inline-block;
|
1783 |
+
visibility: visible;
|
1784 |
+
}
|
1785 |
+
.cf-form-template > input{
|
1786 |
+
display: none;
|
1787 |
+
}
|
1788 |
+
|
1789 |
+
.cf-form-template:hover{
|
1790 |
+
border: 2px dashed #a3be5f;
|
1791 |
+
background-color: #efefef;
|
1792 |
+
}
|
1793 |
+
.cf-form-template.selected{
|
1794 |
+
background-color: #a3be5f;
|
1795 |
+
border: 2px dashed #a3be5f;
|
1796 |
+
color: #fff;
|
1797 |
+
}
|
1798 |
+
|
1799 |
+
.cf-template-column{
|
1800 |
+
|
1801 |
+
|
1802 |
+
overflow: hidden;
|
1803 |
+
}
|
1804 |
+
|
1805 |
+
.cf-templates-wrapper {
|
1806 |
+
overflow: auto;
|
1807 |
+
padding-top: 20px;
|
1808 |
+
}
|
1809 |
+
.cf-form-template small {
|
1810 |
+
display: block;
|
1811 |
+
padding: 0 3px;
|
1812 |
+
}
|
1813 |
+
.cf-form-template small.cf-preview-field {
|
1814 |
+
border-bottom: 1px solid #dfdfdf;
|
1815 |
+
font-size: 55%;
|
1816 |
+
overflow: hidden;
|
1817 |
+
text-overflow: ellipsis;
|
1818 |
+
white-space: nowrap;
|
1819 |
+
}
|
1820 |
+
|
1821 |
+
.cf-preview-field.cf-preview-button {
|
1822 |
+
background: #d1d1d1 none repeat scroll 0 0;
|
1823 |
+
border-radius: 2px;
|
1824 |
+
display: inline-block;
|
1825 |
+
margin: 5px 3px 0;
|
1826 |
+
padding: 0 9px;
|
1827 |
+
color: #333;
|
1828 |
+
}
|
1829 |
+
.cf-form-template.selected .cf-preview-field.cf-preview-button {
|
1830 |
+
background-color: #fff;
|
1831 |
+
}
|
1832 |
+
.cf-form-template small.cf-preview-field.cf-preview-field-html {
|
1833 |
+
background: rgba(0, 0, 0, 0.1) none repeat scroll 0 0;
|
1834 |
+
border: 0 none;
|
1835 |
+
height: 15px;
|
1836 |
+
}
|
1837 |
+
|
1838 |
+
.caldera-settings {
|
1839 |
+
float: left;
|
1840 |
+
width: 270px;
|
1841 |
+
}
|
1842 |
+
.caldera-settings strong{
|
1843 |
+
display: block;
|
1844 |
+
}
|
1845 |
+
.caldera-setting {
|
1846 |
+
display: block;
|
1847 |
+
float: right;
|
1848 |
+
height: 35px;
|
1849 |
+
padding: 14px;
|
1850 |
+
width: 50px;
|
1851 |
+
}
|
1852 |
+
.caldera-settings-group {
|
1853 |
+
border-bottom: 1px solid #efefef;
|
1854 |
+
display: block;
|
1855 |
+
margin-bottom: 10px;
|
1856 |
+
padding-bottom: 10px;
|
1857 |
+
clear: both;
|
1858 |
+
}
|
1859 |
+
|
1860 |
+
.switch {
|
1861 |
+
background: #efefef none repeat scroll 0 0;
|
1862 |
+
border-radius: 50px;
|
1863 |
+
box-shadow: 0 0 3px rgba(0, 0, 0, 0.14) inset;
|
1864 |
+
height: 20px;
|
1865 |
+
overflow: hidden;
|
1866 |
+
width: 42px;
|
1867 |
+
transition: background-color 1s ease 0s;
|
1868 |
+
cursor: pointer;
|
1869 |
+
position: relative;
|
1870 |
+
}
|
1871 |
+
.box-wrapper {
|
1872 |
+
height: 21px;
|
1873 |
+
position: absolute;
|
1874 |
+
width: 100%;
|
1875 |
+
}
|
1876 |
+
.switch.active {
|
1877 |
+
background: #a3be5f none repeat scroll 0 0;
|
1878 |
+
}
|
1879 |
+
.switch .box {
|
1880 |
+
background: #fff none repeat scroll 0 0;
|
1881 |
+
border-radius: 50px;
|
1882 |
+
box-shadow: 0 0 4px rgba(0, 0, 0, 0.26), 0 0 1px #333 inset;
|
1883 |
+
height: 20px;
|
1884 |
+
width: 50%;
|
1885 |
+
transition: margin 0.5s ease 0s;
|
1886 |
+
cursor: pointer;
|
1887 |
+
}
|
1888 |
+
.switch.active .box {
|
1889 |
+
margin-left: 50%;
|
1890 |
+
}
|
1891 |
+
.switch.load .box {
|
1892 |
+
background-color: #a6a6a6;
|
1893 |
+
}
|
1894 |
+
.switch.load .box .spinner {
|
1895 |
+
margin: 0;
|
1896 |
+
opacity: 0.51;
|
1897 |
+
visibility: visible;
|
1898 |
+
}
|
1899 |
+
input.cf-shortcode-preview {
|
1900 |
+
background: #efefef none repeat scroll 0 0;
|
1901 |
+
border: medium none;
|
1902 |
+
box-shadow: none;
|
1903 |
+
display: none;
|
1904 |
+
font-size: 13px;
|
1905 |
+
padding: 2px;
|
1906 |
+
vertical-align: top;
|
1907 |
+
width: 260px;
|
1908 |
+
}
|
1909 |
+
span.cf-form-shortcode-preview {
|
1910 |
+
color: #afafaf;
|
1911 |
+
cursor: pointer;
|
1912 |
+
display: inline-block;
|
1913 |
+
font-size: 9px;
|
1914 |
+
padding: 4px 5px 0 0;
|
1915 |
+
}
|
1916 |
+
@media screen and ( max-width: 782px ) {
|
1917 |
+
/* smaller */
|
1918 |
+
.caldera-editor-header {
|
1919 |
+
height: 47px;
|
1920 |
+
margin: -10px;
|
1921 |
+
overflow: hidden;
|
1922 |
+
padding-top: 0;
|
1923 |
+
top: 57px;
|
1924 |
+
}
|
1925 |
+
li.caldera-forms-version{
|
1926 |
+
display: none;
|
1927 |
+
}
|
1928 |
+
.caldera-entry-exporter{
|
1929 |
+
margin-top: -30px;
|
1930 |
+
}
|
1931 |
+
.caldera-forms-toolbar-item .button.cf-general-settings {
|
1932 |
+
padding: 6px 8px;
|
1933 |
+
}
|
1934 |
+
.caldera-editor-header-nav > li.caldera-forms-toolbar-item.separator {
|
1935 |
+
display: none;
|
1936 |
+
}
|
1937 |
+
#form-entries-viewer {
|
1938 |
+
padding-top: 12px;
|
1939 |
+
}
|
1940 |
+
.cf-tools-row {
|
1941 |
+
white-space: nowrap;
|
1942 |
+
}
|
1943 |
+
}
|
1944 |
+
.caldera-table-nav .tablenav-pages {
|
1945 |
+
float: right;
|
1946 |
+
width: auto;
|
1947 |
+
}
|
1948 |
+
@media screen and ( max-width: 600px ) {
|
1949 |
+
.caldera-editor-logo > span.dashicons-cf-logo {
|
1950 |
+
font-size: 31px;
|
1951 |
+
line-height: 22px;
|
1952 |
+
}
|
1953 |
+
.caldera-forms-name{
|
1954 |
+
display: none;
|
1955 |
+
}
|
1956 |
+
.caldera-editor-header {
|
1957 |
+
position: absolute;
|
1958 |
+
}
|
1959 |
+
.tablenav.caldera-table-nav {
|
1960 |
+
clear: none;
|
1961 |
+
margin: 0;
|
1962 |
+
text-align: center;
|
1963 |
+
}
|
1964 |
+
.caldera-table-nav .tablenav-pages {
|
1965 |
+
text-align: center;
|
1966 |
+
width: 100%;
|
1967 |
+
}
|
1968 |
+
|
1969 |
+
}
|
1970 |
+
@media screen and ( max-width: 570px ) {
|
1971 |
+
.cf-tools-row {
|
1972 |
+
display: block;
|
1973 |
+
width: 100%;
|
1974 |
+
margin-bottom: 10px;
|
1975 |
+
}
|
1976 |
+
.cf-tools-row-second{
|
1977 |
+
margin-left: 50px;
|
1978 |
+
}
|
1979 |
+
|
1980 |
+
}
|
1981 |
+
@media screen and ( max-width: 450px ) {
|
1982 |
+
.form-panel-wrap {
|
1983 |
+
width: 290px;
|
1984 |
+
}
|
1985 |
+
.screen-per-page {
|
1986 |
+
display: block;
|
1987 |
+
margin: 0 auto 10px;
|
1988 |
+
width: 68px;
|
1989 |
+
}
|
1990 |
+
|
1991 |
}
|
assets/css/caldera-form.css
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
.caldera-grid{/*! normalize.css v3.0.2 | MIT License | git.io/normalize *//*! Source: https://github.com/h5bp/html5-boilerplate/blob/master/src/css/main.css */}.caldera-grid html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}.caldera-grid body{margin:0}.caldera-grid article,.caldera-grid aside,.caldera-grid details,.caldera-grid figcaption,.caldera-grid figure,.caldera-grid footer,.caldera-grid header,.caldera-grid hgroup,.caldera-grid main,.caldera-grid menu,.caldera-grid nav,.caldera-grid section,.caldera-grid summary{display:block}.caldera-grid audio,.caldera-grid canvas,.caldera-grid progress,.caldera-grid video{display:inline-block;vertical-align:baseline}.caldera-grid audio:not([controls]){display:none;height:0}.caldera-grid [hidden],.caldera-grid template{display:none}.caldera-grid a{background-color:transparent}.caldera-grid a:active,.caldera-grid a:hover{outline:0}.caldera-grid abbr[title]{border-bottom:1px dotted}.caldera-grid b,.caldera-grid strong{font-weight:700}.caldera-grid dfn{font-style:italic}.caldera-grid h1{font-size:2em;margin:.67em 0}.caldera-grid mark{background:#ff0;color:#000}.caldera-grid small{font-size:80%}.caldera-grid sub,.caldera-grid sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}.caldera-grid sup{top:-.5em}.caldera-grid sub{bottom:-.25em}.caldera-grid img{border:0}.caldera-grid svg:not(:root){overflow:hidden}.caldera-grid figure{margin:1em 40px}.caldera-grid hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0}.caldera-grid pre{overflow:auto}.caldera-grid code,.caldera-grid kbd,.caldera-grid pre,.caldera-grid samp{font-family:monospace,monospace;font-size:1em}.caldera-grid button,.caldera-grid input,.caldera-grid optgroup,.caldera-grid select,.caldera-grid textarea{color:inherit;font:inherit;margin:0}.caldera-grid button{overflow:visible}.caldera-grid button,.caldera-grid select{text-transform:none}.caldera-grid button,.caldera-grid html input[type=button],.caldera-grid input[type=reset],.caldera-grid input[type=submit]{-webkit-appearance:button;cursor:pointer}.caldera-grid button[disabled],.caldera-grid html input[disabled]{cursor:default}.caldera-grid button::-moz-focus-inner,.caldera-grid input::-moz-focus-inner{border:0;padding:0}.caldera-grid input{line-height:normal}.caldera-grid input[type=checkbox],.caldera-grid input[type=radio]{box-sizing:border-box;padding:0}.caldera-grid input[type=number]::-webkit-inner-spin-button,.caldera-grid input[type=number]::-webkit-outer-spin-button{height:auto}.caldera-grid input[type=search]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}.caldera-grid input[type=search]::-webkit-search-cancel-button,.caldera-grid input[type=search]::-webkit-search-decoration{-webkit-appearance:none}.caldera-grid fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}.caldera-grid legend{border:0;padding:0}.caldera-grid textarea{overflow:auto}.caldera-grid optgroup{font-weight:700}.caldera-grid table{border-collapse:collapse;border-spacing:0}.caldera-grid td,.caldera-grid th{padding:0}@media print{.caldera-grid *,.caldera-grid :before,.caldera-grid :after{background:transparent!important;color:#000!important;box-shadow:none!important;text-shadow:none!important}.caldera-grid a,.caldera-grid a:visited{text-decoration:underline}.caldera-grid a[href]:after{content:" (" attr(href) ")"}.caldera-grid abbr[title]:after{content:" (" attr(title) ")"}.caldera-grid a[href^="#"]:after,.caldera-grid a[href^="javascript:"]:after{content:""}.caldera-grid pre,.caldera-grid blockquote{border:1px solid #999;page-break-inside:avoid}.caldera-grid thead{display:table-header-group}.caldera-grid tr,.caldera-grid img{page-break-inside:avoid}.caldera-grid img{max-width:100%!important}.caldera-grid p,.caldera-grid h2,.caldera-grid h3{orphans:3;widows:3}.caldera-grid h2,.caldera-grid h3{page-break-after:avoid}.caldera-grid select{background:#fff!important}.caldera-grid .navbar{display:none}.caldera-grid .btn>.caret,.caldera-grid .dropup>.btn>.caret{border-top-color:#000!important}.caldera-grid .label{border:1px solid #000}.caldera-grid .table{border-collapse:collapse!important}.caldera-grid .table td,.caldera-grid .table th{background-color:#fff!important}.caldera-grid .table-bordered th,.caldera-grid .table-bordered td{border:1px solid #ddd!important}}.caldera-grid fieldset{padding:0;margin:0;border:0;min-width:0}.caldera-grid legend{display:block;width:100%;padding:0;margin-bottom:20px;font-size:21px;line-height:inherit;color:#333;border:0;border-bottom:1px solid #e5e5e5}.caldera-grid label{display:inline-block;max-width:100%;margin-bottom:5px;font-weight:700}.caldera-grid input[type=search]{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.caldera-grid input[type=radio],.caldera-grid input[type=checkbox]{margin:0;line-height:normal}.caldera-grid input[type=file]{display:block}.caldera-grid input[type=range]{display:block;width:100%}.caldera-grid select[multiple],.caldera-grid select[size]{height:auto}.caldera-grid input[type=file]:focus,.caldera-grid input[type=radio]:focus,.caldera-grid input[type=checkbox]:focus{outline:thin dotted;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}.caldera-grid input[type=checkbox]{-webkit-appearance:checkbox}.caldera-grid input[type=radio]{-webkit-appearance:radio}.caldera-grid output{display:block;padding-top:7px;font-size:14px;line-height:1.42857143;color:#555}.caldera-grid .form-control{display:block;width:100%;height:34px;padding:6px 12px;font-size:14px;line-height:1.42857143;color:#555;background-color:#fff;background-image:none;border:1px solid #ccc;border-radius:2px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075);-webkit-transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s;-o-transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s;transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s}.caldera-grid .form-control:focus{border-color:#66afe9;outline:0;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6);box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6)}.caldera-grid .form-control::-moz-placeholder{color:#999;opacity:1}.caldera-grid .form-control:-ms-input-placeholder{color:#999}.caldera-grid .form-control::-webkit-input-placeholder{color:#999}.caldera-grid .form-control[disabled],.caldera-grid .form-control[readonly],fieldset[disabled] .caldera-grid .form-control{background-color:#eee;opacity:1}.caldera-grid .form-control[disabled],fieldset[disabled] .caldera-grid .form-control{cursor:not-allowed}textarea .caldera-grid .form-control{height:auto}@media screen and (-webkit-min-device-pixel-ratio:0){.caldera-grid input[type=date],.caldera-grid input[type=time],.caldera-grid input[type=datetime-local],.caldera-grid input[type=month]{line-height:34px}.caldera-grid input[type=date].input-sm,.caldera-grid input[type=time].input-sm,.caldera-grid input[type=datetime-local].input-sm,.caldera-grid input[type=month].input-sm,.input-group-sm .caldera-grid input[type=date],.input-group-sm .caldera-grid input[type=time],.input-group-sm .caldera-grid input[type=datetime-local],.input-group-sm .caldera-grid input[type=month]{line-height:30px}.caldera-grid input[type=date].input-lg,.caldera-grid input[type=time].input-lg,.caldera-grid input[type=datetime-local].input-lg,.caldera-grid input[type=month].input-lg,.input-group-lg .caldera-grid input[type=date],.input-group-lg .caldera-grid input[type=time],.input-group-lg .caldera-grid input[type=datetime-local],.input-group-lg .caldera-grid input[type=month]{line-height:46px}}.caldera-grid .form-group{margin-bottom:15px}.caldera-grid .radio,.caldera-grid .checkbox{position:relative;display:block;margin-top:10px;margin-bottom:10px}.caldera-grid .radio label,.caldera-grid .checkbox label{min-height:20px;padding-left:20px;margin-bottom:0;font-weight:400;cursor:pointer}.caldera-grid .radio input[type=radio],.caldera-grid .radio-inline input[type=radio],.caldera-grid .checkbox input[type=checkbox],.caldera-grid .checkbox-inline input[type=checkbox]{margin-left:-20px}.caldera-grid .radio+.radio,.caldera-grid .checkbox+.checkbox{margin-top:-5px}.caldera-grid .radio-inline,.caldera-grid .checkbox-inline{position:relative;display:inline-block;padding-left:20px;margin-bottom:0;vertical-align:middle;font-weight:400;cursor:pointer}.caldera-grid .radio-inline+.radio-inline,.caldera-grid .checkbox-inline+.checkbox-inline{margin-top:0;margin-left:10px}.caldera-grid input[type=radio][disabled],.caldera-grid input[type=checkbox][disabled],.caldera-grid input[type=radio].disabled,.caldera-grid input[type=checkbox].disabled,fieldset[disabled] .caldera-grid input[type=radio],fieldset[disabled] .caldera-grid input[type=checkbox]{cursor:not-allowed}.caldera-grid .radio-inline.disabled,.caldera-grid .checkbox-inline.disabled,fieldset[disabled] .caldera-grid .radio-inline,fieldset[disabled] .caldera-grid .checkbox-inline{cursor:not-allowed}.caldera-grid .radio.disabled label,.caldera-grid .checkbox.disabled label,fieldset[disabled] .caldera-grid .radio label,fieldset[disabled] .caldera-grid .checkbox label{cursor:not-allowed}.caldera-grid .form-control-static{padding-top:7px;padding-bottom:7px;margin-bottom:0;min-height:34px}.caldera-grid .form-control-static.input-lg,.caldera-grid .form-control-static.input-sm{padding-left:0;padding-right:0}.caldera-grid .input-sm{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:1px}select.caldera-grid .input-sm{height:30px;line-height:30px}textarea.caldera-grid .input-sm,select[multiple].caldera-grid .input-sm{height:auto}.caldera-grid .form-group-sm .form-control{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:1px}select.caldera-grid .form-group-sm .form-control{height:30px;line-height:30px}textarea.caldera-grid .form-group-sm .form-control,select[multiple].caldera-grid .form-group-sm .form-control{height:auto}.caldera-grid .form-group-sm .form-control-static{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;min-height:32px}.caldera-grid .input-lg{height:46px;padding:10px 16px;font-size:18px;line-height:1.3333333;border-radius:4px}select.caldera-grid .input-lg{height:46px;line-height:46px}textarea.caldera-grid .input-lg,select[multiple].caldera-grid .input-lg{height:auto}.caldera-grid .form-group-lg .form-control{height:46px;padding:10px 16px;font-size:18px;line-height:1.3333333;border-radius:4px}select.caldera-grid .form-group-lg .form-control{height:46px;line-height:46px}textarea.caldera-grid .form-group-lg .form-control,select[multiple].caldera-grid .form-group-lg .form-control{height:auto}.caldera-grid .form-group-lg .form-control-static{height:46px;padding:10px 16px;font-size:18px;line-height:1.3333333;min-height:38px}.caldera-grid .has-feedback{position:relative}.caldera-grid .has-feedback .form-control{padding-right:42.5px}.caldera-grid .form-control-feedback{position:absolute;top:0;right:0;z-index:2;display:block;width:34px;height:34px;line-height:34px;text-align:center;pointer-events:none}.caldera-grid .input-lg+.form-control-feedback{width:46px;height:46px;line-height:46px}.caldera-grid .input-sm+.form-control-feedback{width:30px;height:30px;line-height:30px}.caldera-grid .has-success .help-block,.caldera-grid .has-success .control-label,.caldera-grid .has-success .radio,.caldera-grid .has-success .checkbox,.caldera-grid .has-success .radio-inline,.caldera-grid .has-success .checkbox-inline,.caldera-grid .has-success.radio label,.caldera-grid .has-success.checkbox label,.caldera-grid .has-success.radio-inline label,.caldera-grid .has-success.checkbox-inline label{color:#3c763d}.caldera-grid .has-success .form-control{border-color:#3c763d;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.caldera-grid .has-success .form-control:focus{border-color:#2b542c;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #67b168;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #67b168}.caldera-grid .has-success .input-group-addon{color:#3c763d;border-color:#3c763d;background-color:#dff0d8}.caldera-grid .has-success .form-control-feedback{color:#3c763d}.caldera-grid .has-warning .help-block,.caldera-grid .has-warning .control-label,.caldera-grid .has-warning .radio,.caldera-grid .has-warning .checkbox,.caldera-grid .has-warning .radio-inline,.caldera-grid .has-warning .checkbox-inline,.caldera-grid .has-warning.radio label,.caldera-grid .has-warning.checkbox label,.caldera-grid .has-warning.radio-inline label,.caldera-grid .has-warning.checkbox-inline label{color:#8a6d3b}.caldera-grid .has-warning .form-control{border-color:#8a6d3b;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.caldera-grid .has-warning .form-control:focus{border-color:#66512c;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #c0a16b;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #c0a16b}.caldera-grid .has-warning .input-group-addon{color:#8a6d3b;border-color:#8a6d3b;background-color:#fcf8e3}.caldera-grid .has-warning .form-control-feedback{color:#8a6d3b}.caldera-grid .has-error .help-block,.caldera-grid .has-error .control-label,.caldera-grid .has-error .radio,.caldera-grid .has-error .checkbox,.caldera-grid .has-error .radio-inline,.caldera-grid .has-error .checkbox-inline,.caldera-grid .has-error.radio label,.caldera-grid .has-error.checkbox label,.caldera-grid .has-error.radio-inline label,.caldera-grid .has-error.checkbox-inline label{color:#a94442}.caldera-grid .has-error .form-control{border-color:#a94442;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.caldera-grid .has-error .form-control:focus{border-color:#843534;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #ce8483;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #ce8483}.caldera-grid .has-error .input-group-addon{color:#a94442;border-color:#a94442;background-color:#f2dede}.caldera-grid .has-error .form-control-feedback{color:#a94442}.caldera-grid .has-feedback label~.form-control-feedback{top:25px}.caldera-grid .has-feedback label.sr-only~.form-control-feedback{top:0}.caldera-grid .help-block{display:block;margin-top:5px;margin-bottom:10px;color:#737373}@media (min-width:768px){.caldera-grid .form-inline .form-group{display:inline-block;margin-bottom:0;vertical-align:middle}.caldera-grid .form-inline .form-control{display:inline-block;width:auto;vertical-align:middle}.caldera-grid .form-inline .form-control-static{display:inline-block}.caldera-grid .form-inline .input-group{display:inline-table;vertical-align:middle}.caldera-grid .form-inline .input-group .input-group-addon,.caldera-grid .form-inline .input-group .input-group-btn,.caldera-grid .form-inline .input-group .form-control{width:auto}.caldera-grid .form-inline .input-group>.form-control{width:100%}.caldera-grid .form-inline .control-label{margin-bottom:0;vertical-align:middle}.caldera-grid .form-inline .radio,.caldera-grid .form-inline .checkbox{display:inline-block;margin-top:0;margin-bottom:0;vertical-align:middle}.caldera-grid .form-inline .radio label,.caldera-grid .form-inline .checkbox label{padding-left:0}.caldera-grid .form-inline .radio input[type=radio],.caldera-grid .form-inline .checkbox input[type=checkbox]{position:relative;margin-left:0}.caldera-grid .form-inline .has-feedback .form-control-feedback{top:0}}.caldera-grid .form-horizontal .radio,.caldera-grid .form-horizontal .checkbox,.caldera-grid .form-horizontal .radio-inline,.caldera-grid .form-horizontal .checkbox-inline{margin-top:0;margin-bottom:0;padding-top:7px}.caldera-grid .form-horizontal .radio,.caldera-grid .form-horizontal .checkbox{min-height:27px}.caldera-grid .form-horizontal .form-group{margin-left:-15px;margin-right:-15px}@media (min-width:768px){.caldera-grid .form-horizontal .control-label{text-align:right;margin-bottom:0;padding-top:7px}}.caldera-grid .form-horizontal .has-feedback .form-control-feedback{right:15px}@media (min-width:768px){.caldera-grid .form-horizontal .form-group-lg .control-label{padding-top:14.33px}}@media (min-width:768px){.caldera-grid .form-horizontal .form-group-sm .control-label{padding-top:6px}}.caldera-grid .btn{display:inline-block;margin-bottom:0;font-weight:400;text-align:center;vertical-align:middle;touch-action:manipulation;cursor:pointer;background-image:none;border:1px solid transparent;white-space:nowrap;padding:6px 12px;font-size:14px;line-height:1.42857143;border-radius:2px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.caldera-grid .btn:focus,.caldera-grid .btn:active:focus,.caldera-grid .btn.active:focus,.caldera-grid .btn.focus,.caldera-grid .btn:active.focus,.caldera-grid .btn.active.focus{outline:thin dotted;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}.caldera-grid .btn:hover,.caldera-grid .btn:focus,.caldera-grid .btn.focus{color:#333;text-decoration:none}.caldera-grid .btn:active,.caldera-grid .btn.active{outline:0;background-image:none;-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.caldera-grid .btn.disabled,.caldera-grid .btn[disabled],fieldset[disabled] .caldera-grid .btn{cursor:not-allowed;pointer-events:none;opacity:.65;filter:alpha(opacity=65);-webkit-box-shadow:none;box-shadow:none}.caldera-grid .btn-default{color:#333;background-color:#fff;border-color:#ccc}.caldera-grid .btn-default:hover,.caldera-grid .btn-default:focus,.caldera-grid .btn-default.focus,.caldera-grid .btn-default:active,.caldera-grid .btn-default.active,.open>.dropdown-toggle.caldera-grid .btn-default{color:#333;background-color:#e6e6e6;border-color:#adadad}.caldera-grid .btn-default:active,.caldera-grid .btn-default.active,.open>.dropdown-toggle.caldera-grid .btn-default{background-image:none}.caldera-grid .btn-default.disabled,.caldera-grid .btn-default[disabled],fieldset[disabled] .caldera-grid .btn-default,.caldera-grid .btn-default.disabled:hover,.caldera-grid .btn-default[disabled]:hover,fieldset[disabled] .caldera-grid .btn-default:hover,.caldera-grid .btn-default.disabled:focus,.caldera-grid .btn-default[disabled]:focus,fieldset[disabled] .caldera-grid .btn-default:focus,.caldera-grid .btn-default.disabled.focus,.caldera-grid .btn-default[disabled].focus,fieldset[disabled] .caldera-grid .btn-default.focus,.caldera-grid .btn-default.disabled:active,.caldera-grid .btn-default[disabled]:active,fieldset[disabled] .caldera-grid .btn-default:active,.caldera-grid .btn-default.disabled.active,.caldera-grid .btn-default[disabled].active,fieldset[disabled] .caldera-grid .btn-default.active{background-color:#fff;border-color:#ccc}.caldera-grid .btn-default .badge{color:#fff;background-color:#333}.caldera-grid .btn-primary{color:#fff;background-color:#337ab7;border-color:#2e6da4}.caldera-grid .btn-primary:hover,.caldera-grid .btn-primary:focus,.caldera-grid .btn-primary.focus,.caldera-grid .btn-primary:active,.caldera-grid .btn-primary.active,.open>.dropdown-toggle.caldera-grid .btn-primary{color:#fff;background-color:#286090;border-color:#204d74}.caldera-grid .btn-primary:active,.caldera-grid .btn-primary.active,.open>.dropdown-toggle.caldera-grid .btn-primary{background-image:none}.caldera-grid .btn-primary.disabled,.caldera-grid .btn-primary[disabled],fieldset[disabled] .caldera-grid .btn-primary,.caldera-grid .btn-primary.disabled:hover,.caldera-grid .btn-primary[disabled]:hover,fieldset[disabled] .caldera-grid .btn-primary:hover,.caldera-grid .btn-primary.disabled:focus,.caldera-grid .btn-primary[disabled]:focus,fieldset[disabled] .caldera-grid .btn-primary:focus,.caldera-grid .btn-primary.disabled.focus,.caldera-grid .btn-primary[disabled].focus,fieldset[disabled] .caldera-grid .btn-primary.focus,.caldera-grid .btn-primary.disabled:active,.caldera-grid .btn-primary[disabled]:active,fieldset[disabled] .caldera-grid .btn-primary:active,.caldera-grid .btn-primary.disabled.active,.caldera-grid .btn-primary[disabled].active,fieldset[disabled] .caldera-grid .btn-primary.active{background-color:#337ab7;border-color:#2e6da4}.caldera-grid .btn-primary .badge{color:#337ab7;background-color:#fff}.caldera-grid .btn-success{color:#fff;background-color:#5cb85c;border-color:#4cae4c}.caldera-grid .btn-success:hover,.caldera-grid .btn-success:focus,.caldera-grid .btn-success.focus,.caldera-grid .btn-success:active,.caldera-grid .btn-success.active,.open>.dropdown-toggle.caldera-grid .btn-success{color:#fff;background-color:#449d44;border-color:#398439}.caldera-grid .btn-success:active,.caldera-grid .btn-success.active,.open>.dropdown-toggle.caldera-grid .btn-success{background-image:none}.caldera-grid .btn-success.disabled,.caldera-grid .btn-success[disabled],fieldset[disabled] .caldera-grid .btn-success,.caldera-grid .btn-success.disabled:hover,.caldera-grid .btn-success[disabled]:hover,fieldset[disabled] .caldera-grid .btn-success:hover,.caldera-grid .btn-success.disabled:focus,.caldera-grid .btn-success[disabled]:focus,fieldset[disabled] .caldera-grid .btn-success:focus,.caldera-grid .btn-success.disabled.focus,.caldera-grid .btn-success[disabled].focus,fieldset[disabled] .caldera-grid .btn-success.focus,.caldera-grid .btn-success.disabled:active,.caldera-grid .btn-success[disabled]:active,fieldset[disabled] .caldera-grid .btn-success:active,.caldera-grid .btn-success.disabled.active,.caldera-grid .btn-success[disabled].active,fieldset[disabled] .caldera-grid .btn-success.active{background-color:#5cb85c;border-color:#4cae4c}.caldera-grid .btn-success .badge{color:#5cb85c;background-color:#fff}.caldera-grid .btn-info{color:#fff;background-color:#5bc0de;border-color:#46b8da}.caldera-grid .btn-info:hover,.caldera-grid .btn-info:focus,.caldera-grid .btn-info.focus,.caldera-grid .btn-info:active,.caldera-grid .btn-info.active,.open>.dropdown-toggle.caldera-grid .btn-info{color:#fff;background-color:#31b0d5;border-color:#269abc}.caldera-grid .btn-info:active,.caldera-grid .btn-info.active,.open>.dropdown-toggle.caldera-grid .btn-info{background-image:none}.caldera-grid .btn-info.disabled,.caldera-grid .btn-info[disabled],fieldset[disabled] .caldera-grid .btn-info,.caldera-grid .btn-info.disabled:hover,.caldera-grid .btn-info[disabled]:hover,fieldset[disabled] .caldera-grid .btn-info:hover,.caldera-grid .btn-info.disabled:focus,.caldera-grid .btn-info[disabled]:focus,fieldset[disabled] .caldera-grid .btn-info:focus,.caldera-grid .btn-info.disabled.focus,.caldera-grid .btn-info[disabled].focus,fieldset[disabled] .caldera-grid .btn-info.focus,.caldera-grid .btn-info.disabled:active,.caldera-grid .btn-info[disabled]:active,fieldset[disabled] .caldera-grid .btn-info:active,.caldera-grid .btn-info.disabled.active,.caldera-grid .btn-info[disabled].active,fieldset[disabled] .caldera-grid .btn-info.active{background-color:#5bc0de;border-color:#46b8da}.caldera-grid .btn-info .badge{color:#5bc0de;background-color:#fff}.caldera-grid .btn-warning{color:#fff;background-color:#f0ad4e;border-color:#eea236}.caldera-grid .btn-warning:hover,.caldera-grid .btn-warning:focus,.caldera-grid .btn-warning.focus,.caldera-grid .btn-warning:active,.caldera-grid .btn-warning.active,.open>.dropdown-toggle.caldera-grid .btn-warning{color:#fff;background-color:#ec971f;border-color:#d58512}.caldera-grid .btn-warning:active,.caldera-grid .btn-warning.active,.open>.dropdown-toggle.caldera-grid .btn-warning{background-image:none}.caldera-grid .btn-warning.disabled,.caldera-grid .btn-warning[disabled],fieldset[disabled] .caldera-grid .btn-warning,.caldera-grid .btn-warning.disabled:hover,.caldera-grid .btn-warning[disabled]:hover,fieldset[disabled] .caldera-grid .btn-warning:hover,.caldera-grid .btn-warning.disabled:focus,.caldera-grid .btn-warning[disabled]:focus,fieldset[disabled] .caldera-grid .btn-warning:focus,.caldera-grid .btn-warning.disabled.focus,.caldera-grid .btn-warning[disabled].focus,fieldset[disabled] .caldera-grid .btn-warning.focus,.caldera-grid .btn-warning.disabled:active,.caldera-grid .btn-warning[disabled]:active,fieldset[disabled] .caldera-grid .btn-warning:active,.caldera-grid .btn-warning.disabled.active,.caldera-grid .btn-warning[disabled].active,fieldset[disabled] .caldera-grid .btn-warning.active{background-color:#f0ad4e;border-color:#eea236}.caldera-grid .btn-warning .badge{color:#f0ad4e;background-color:#fff}.caldera-grid .btn-danger{color:#fff;background-color:#d9534f;border-color:#d43f3a}.caldera-grid .btn-danger:hover,.caldera-grid .btn-danger:focus,.caldera-grid .btn-danger.focus,.caldera-grid .btn-danger:active,.caldera-grid .btn-danger.active,.open>.dropdown-toggle.caldera-grid .btn-danger{color:#fff;background-color:#c9302c;border-color:#ac2925}.caldera-grid .btn-danger:active,.caldera-grid .btn-danger.active,.open>.dropdown-toggle.caldera-grid .btn-danger{background-image:none}.caldera-grid .btn-danger.disabled,.caldera-grid .btn-danger[disabled],fieldset[disabled] .caldera-grid .btn-danger,.caldera-grid .btn-danger.disabled:hover,.caldera-grid .btn-danger[disabled]:hover,fieldset[disabled] .caldera-grid .btn-danger:hover,.caldera-grid .btn-danger.disabled:focus,.caldera-grid .btn-danger[disabled]:focus,fieldset[disabled] .caldera-grid .btn-danger:focus,.caldera-grid .btn-danger.disabled.focus,.caldera-grid .btn-danger[disabled].focus,fieldset[disabled] .caldera-grid .btn-danger.focus,.caldera-grid .btn-danger.disabled:active,.caldera-grid .btn-danger[disabled]:active,fieldset[disabled] .caldera-grid .btn-danger:active,.caldera-grid .btn-danger.disabled.active,.caldera-grid .btn-danger[disabled].active,fieldset[disabled] .caldera-grid .btn-danger.active{background-color:#d9534f;border-color:#d43f3a}.caldera-grid .btn-danger .badge{color:#d9534f;background-color:#fff}.caldera-grid .btn-link{color:#337ab7;font-weight:400;border-radius:0}.caldera-grid .btn-link,.caldera-grid .btn-link:active,.caldera-grid .btn-link.active,.caldera-grid .btn-link[disabled],fieldset[disabled] .caldera-grid .btn-link{background-color:transparent;-webkit-box-shadow:none;box-shadow:none}.caldera-grid .btn-link,.caldera-grid .btn-link:hover,.caldera-grid .btn-link:focus,.caldera-grid .btn-link:active{border-color:transparent}.caldera-grid .btn-link:hover,.caldera-grid .btn-link:focus{color:#23527c;text-decoration:underline;background-color:transparent}.caldera-grid .btn-link[disabled]:hover,fieldset[disabled] .caldera-grid .btn-link:hover,.caldera-grid .btn-link[disabled]:focus,fieldset[disabled] .caldera-grid .btn-link:focus{color:#777;text-decoration:none}.caldera-grid .btn-lg{padding:10px 16px;font-size:18px;line-height:1.3333333;border-radius:4px}.caldera-grid .btn-sm{padding:5px 10px;font-size:12px;line-height:1.5;border-radius:1px}.caldera-grid .btn-xs{padding:1px 5px;font-size:12px;line-height:1.5;border-radius:1px}.caldera-grid .btn-block{display:block;width:100%}.caldera-grid .btn-block+.btn-block{margin-top:5px}.caldera-grid input[type=submit].btn-block,.caldera-grid input[type=reset].btn-block,.caldera-grid input[type=button].btn-block{width:100%}.caldera-grid textarea.form-control{padding-right:4px;height:auto}
|
2 |
.caldera-grid .breadcrumb {
|
3 |
padding: 6px 12px;
|
4 |
margin: 0 0 20px;
|
@@ -23,22 +23,3 @@
|
|
23 |
.breadcrumb > li.error > a {
|
24 |
color: #ff0000;
|
25 |
}
|
26 |
-
.caldera-grid .cf-multi-uploader-list > ul > li .file-name {
|
27 |
-
font-weight: bold;
|
28 |
-
}
|
29 |
-
.caldera-grid .cf-multi-uploader-list > ul > li .file-size {
|
30 |
-
float: right;
|
31 |
-
}
|
32 |
-
.caldera-grid .cf-multi-uploader-list > ul > li .file-type {
|
33 |
-
float: left;
|
34 |
-
}
|
35 |
-
.caldera-grid .cf-multi-uploader-list > ul > li .cf-file-remove {
|
36 |
-
color: #cf0000;
|
37 |
-
text-decoration: none;
|
38 |
-
}
|
39 |
-
.caldera-grid .cf-multi-uploader-list > ul > li.has-error .bar {
|
40 |
-
background-color: #cf0000 !important;
|
41 |
-
}
|
42 |
-
.caldera-grid .cf-multi-uploader-list > ul > li.has-error{
|
43 |
-
color: #cf0000;
|
44 |
-
}
|
1 |
+
.caldera-grid html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}.caldera-grid body{margin:0}.caldera-grid article,.caldera-grid aside,.caldera-grid details,.caldera-grid figcaption,.caldera-grid figure,.caldera-grid footer,.caldera-grid header,.caldera-grid hgroup,.caldera-grid main,.caldera-grid menu,.caldera-grid nav,.caldera-grid section,.caldera-grid summary{display:block}.caldera-grid audio,.caldera-grid canvas,.caldera-grid progress,.caldera-grid video{display:inline-block;vertical-align:baseline}.caldera-grid audio:not([controls]){display:none;height:0}.caldera-grid [hidden],.caldera-grid template{display:none}.caldera-grid a{background-color:transparent}.caldera-grid a:active,.caldera-grid a:hover{outline:0}.caldera-grid abbr[title]{border-bottom:1px dotted}.caldera-grid b,.caldera-grid strong{font-weight:700}.caldera-grid dfn{font-style:italic}.caldera-grid h1{font-size:2em;margin:.67em 0}.caldera-grid mark{background:#ff0;color:#000}.caldera-grid small{font-size:80%}.caldera-grid sub,.caldera-grid sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}.caldera-grid sup{top:-.5em}.caldera-grid sub{bottom:-.25em}.caldera-grid img{border:0}.caldera-grid svg:not(:root){overflow:hidden}.caldera-grid figure{margin:1em 40px}.caldera-grid hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0}.caldera-grid pre{overflow:auto}.caldera-grid code,.caldera-grid kbd,.caldera-grid pre,.caldera-grid samp{font-family:monospace,monospace;font-size:1em}.caldera-grid button,.caldera-grid input,.caldera-grid optgroup,.caldera-grid select,.caldera-grid textarea{font:inherit;margin:0}.caldera-grid button{overflow:visible}.caldera-grid button,.caldera-grid select{text-transform:none}.caldera-grid button,.caldera-grid html input[type=button],.caldera-grid input[type=reset],.caldera-grid input[type=submit]{-webkit-appearance:button;cursor:pointer}.caldera-grid button[disabled],.caldera-grid html input[disabled]{cursor:default}.caldera-grid button::-moz-focus-inner,.caldera-grid input::-moz-focus-inner{border:0;padding:0}.caldera-grid input{line-height:normal}.caldera-grid input[type=checkbox],.caldera-grid input[type=radio]{box-sizing:border-box;padding:0}.caldera-grid input[type=number]::-webkit-inner-spin-button,.caldera-grid input[type=number]::-webkit-outer-spin-button{height:auto}.caldera-grid input[type=search]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}.caldera-grid input[type=search]::-webkit-search-cancel-button,.caldera-grid input[type=search]::-webkit-search-decoration{-webkit-appearance:none}.caldera-grid fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}.caldera-grid legend{border:0;padding:0}.caldera-grid textarea{overflow:auto}.caldera-grid optgroup{font-weight:700}.caldera-grid table{border-collapse:collapse;border-spacing:0}.caldera-grid td,.caldera-grid th{padding:0}@media print{.caldera-grid *,.caldera-grid :before,.caldera-grid :after{background:transparent!important;color:#000!important;box-shadow:none!important;text-shadow:none!important}.caldera-grid a,.caldera-grid a:visited{text-decoration:underline}.caldera-grid a[href]:after{content:" (" attr(href) ")"}.caldera-grid abbr[title]:after{content:" (" attr(title) ")"}.caldera-grid a[href^="#"]:after,.caldera-grid a[href^="javascript:"]:after{content:""}.caldera-grid pre,.caldera-grid blockquote{border:1px solid #999;page-break-inside:avoid}.caldera-grid thead{display:table-header-group}.caldera-grid tr,.caldera-grid img{page-break-inside:avoid}.caldera-grid img{max-width:100%!important}.caldera-grid p,.caldera-grid h2,.caldera-grid h3{orphans:3;widows:3}.caldera-grid h2,.caldera-grid h3{page-break-after:avoid}.caldera-grid select{background:#fff!important}.caldera-grid .navbar{display:none}.caldera-grid .btn>.caret,.caldera-grid .dropup>.btn>.caret{border-top-color:#000!important}.caldera-grid .label{border:1px solid #000}.caldera-grid .table{border-collapse:collapse!important}.caldera-grid .table td,.caldera-grid .table th{background-color:#fff!important}.caldera-grid .table-bordered th,.caldera-grid .table-bordered td{border:1px solid #ddd!important}}.caldera-grid fieldset{padding:0;margin:0;border:0;min-width:0}.caldera-grid legend{display:block;width:100%;padding:0;margin-bottom:20px;font-size:21px;line-height:inherit;color:#333;border:0;border-bottom:1px solid #e5e5e5}.caldera-grid label{display:inline-block;max-width:100%;margin-bottom:5px;font-weight:700}.caldera-grid input[type=search]{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.caldera-grid input[type=radio],.caldera-grid input[type=checkbox]{margin:0;line-height:normal}.caldera-grid input[type=file]{display:block}.caldera-grid input[type=range]{display:block;width:100%}.caldera-grid select[multiple],.caldera-grid select[size]{height:auto}.caldera-grid input[type=file]:focus,.caldera-grid input[type=radio]:focus,.caldera-grid input[type=checkbox]:focus{outline:thin dotted;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}.caldera-grid input[type=checkbox]{-webkit-appearance:checkbox}.caldera-grid input[type=radio]{-webkit-appearance:radio}.caldera-grid output{display:block;padding-top:7px;font-size:14px;line-height:1.42857143;color:#555}.caldera-grid .form-control{display:block;width:100%;height:34px;padding:6px 12px;font-size:14px;line-height:1.42857143;color:#555;background-color:#fff;background-image:none;border:1px solid #ccc;border-radius:2px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075);-webkit-transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s;-o-transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s;transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s}.caldera-grid .form-control:focus{border-color:#66afe9;outline:0;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6);box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6)}.caldera-grid .form-control::-moz-placeholder{color:#999;opacity:1}.caldera-grid .form-control:-ms-input-placeholder{color:#999}.caldera-grid .form-control::-webkit-input-placeholder{color:#999}.caldera-grid .form-control[disabled],.caldera-grid .form-control[readonly],fieldset[disabled] .caldera-grid .form-control{background-color:#eee;opacity:1}.caldera-grid .form-control[disabled],fieldset[disabled] .caldera-grid .form-control{cursor:not-allowed}textarea .caldera-grid .form-control{height:auto}@media screen and (-webkit-min-device-pixel-ratio:0){.caldera-grid input[type=date],.caldera-grid input[type=time],.caldera-grid input[type=datetime-local],.caldera-grid input[type=month]{line-height:34px}.caldera-grid input[type=date].input-sm,.caldera-grid input[type=time].input-sm,.caldera-grid input[type=datetime-local].input-sm,.caldera-grid input[type=month].input-sm,.input-group-sm .caldera-grid input[type=date],.input-group-sm .caldera-grid input[type=time],.input-group-sm .caldera-grid input[type=datetime-local],.input-group-sm .caldera-grid input[type=month]{line-height:30px}.caldera-grid input[type=date].input-lg,.caldera-grid input[type=time].input-lg,.caldera-grid input[type=datetime-local].input-lg,.caldera-grid input[type=month].input-lg,.input-group-lg .caldera-grid input[type=date],.input-group-lg .caldera-grid input[type=time],.input-group-lg .caldera-grid input[type=datetime-local],.input-group-lg .caldera-grid input[type=month]{line-height:46px}}.caldera-grid .form-group{margin-bottom:15px}.caldera-grid .radio,.caldera-grid .checkbox{position:relative;display:block;margin-top:10px;margin-bottom:10px}.caldera-grid .radio label,.caldera-grid .checkbox label{min-height:20px;padding-left:20px;margin-bottom:0;font-weight:400;cursor:pointer}.caldera-grid .radio input[type=radio],.caldera-grid .radio-inline input[type=radio],.caldera-grid .checkbox input[type=checkbox],.caldera-grid .checkbox-inline input[type=checkbox]{margin-left:-20px}.caldera-grid .radio+.radio,.caldera-grid .checkbox+.checkbox{margin-top:-5px}.caldera-grid .radio-inline,.caldera-grid .checkbox-inline{position:relative;display:inline-block;padding-left:20px;margin-bottom:0;vertical-align:middle;font-weight:400;cursor:pointer}.caldera-grid .radio-inline+.radio-inline,.caldera-grid .checkbox-inline+.checkbox-inline{margin-top:0;margin-left:10px}.caldera-grid input[type=radio][disabled],.caldera-grid input[type=checkbox][disabled],.caldera-grid input[type=radio].disabled,.caldera-grid input[type=checkbox].disabled,fieldset[disabled] .caldera-grid input[type=radio],fieldset[disabled] .caldera-grid input[type=checkbox]{cursor:not-allowed}.caldera-grid .radio-inline.disabled,.caldera-grid .checkbox-inline.disabled,fieldset[disabled] .caldera-grid .radio-inline,fieldset[disabled] .caldera-grid .checkbox-inline{cursor:not-allowed}.caldera-grid .radio.disabled label,.caldera-grid .checkbox.disabled label,fieldset[disabled] .caldera-grid .radio label,fieldset[disabled] .caldera-grid .checkbox label{cursor:not-allowed}.caldera-grid .form-control-static{padding-top:7px;padding-bottom:7px;margin-bottom:0;min-height:34px}.caldera-grid .form-control-static.input-lg,.caldera-grid .form-control-static.input-sm{padding-left:0;padding-right:0}.caldera-grid .input-sm{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:1px}select.caldera-grid .input-sm{height:30px;line-height:30px}textarea.caldera-grid .input-sm,select[multiple].caldera-grid .input-sm{height:auto}.caldera-grid .form-group-sm .form-control{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:1px}select.caldera-grid .form-group-sm .form-control{height:30px;line-height:30px}textarea.caldera-grid .form-group-sm .form-control,select[multiple].caldera-grid .form-group-sm .form-control{height:auto}.caldera-grid .form-group-sm .form-control-static{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;min-height:32px}.caldera-grid .input-lg{height:46px;padding:10px 16px;font-size:18px;line-height:1.3333333;border-radius:4px}select.caldera-grid .input-lg{height:46px;line-height:46px}textarea.caldera-grid .input-lg,select[multiple].caldera-grid .input-lg{height:auto}.caldera-grid .form-group-lg .form-control{height:46px;padding:10px 16px;font-size:18px;line-height:1.3333333;border-radius:4px}select.caldera-grid .form-group-lg .form-control{height:46px;line-height:46px}textarea.caldera-grid .form-group-lg .form-control,select[multiple].caldera-grid .form-group-lg .form-control{height:auto}.caldera-grid .form-group-lg .form-control-static{height:46px;padding:10px 16px;font-size:18px;line-height:1.3333333;min-height:38px}.caldera-grid .has-feedback{position:relative}.caldera-grid .has-feedback .form-control{padding-right:42.5px}.caldera-grid .form-control-feedback{position:absolute;top:0;right:0;z-index:2;display:block;width:34px;height:34px;line-height:34px;text-align:center;pointer-events:none}.caldera-grid .input-lg+.form-control-feedback{width:46px;height:46px;line-height:46px}.caldera-grid .input-sm+.form-control-feedback{width:30px;height:30px;line-height:30px}.caldera-grid .has-success .help-block,.caldera-grid .has-success .control-label,.caldera-grid .has-success .radio,.caldera-grid .has-success .checkbox,.caldera-grid .has-success .radio-inline,.caldera-grid .has-success .checkbox-inline,.caldera-grid .has-success.radio label,.caldera-grid .has-success.checkbox label,.caldera-grid .has-success.radio-inline label,.caldera-grid .has-success.checkbox-inline label{color:#3c763d}.caldera-grid .has-success .form-control{border-color:#3c763d;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.caldera-grid .has-success .form-control:focus{border-color:#2b542c;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #67b168;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #67b168}.caldera-grid .has-success .input-group-addon{color:#3c763d;border-color:#3c763d;background-color:#dff0d8}.caldera-grid .has-success .form-control-feedback{color:#3c763d}.caldera-grid .has-warning .help-block,.caldera-grid .has-warning .control-label,.caldera-grid .has-warning .radio,.caldera-grid .has-warning .checkbox,.caldera-grid .has-warning .radio-inline,.caldera-grid .has-warning .checkbox-inline,.caldera-grid .has-warning.radio label,.caldera-grid .has-warning.checkbox label,.caldera-grid .has-warning.radio-inline label,.caldera-grid .has-warning.checkbox-inline label{color:#8a6d3b}.caldera-grid .has-warning .form-control{border-color:#8a6d3b;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.caldera-grid .has-warning .form-control:focus{border-color:#66512c;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #c0a16b;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #c0a16b}.caldera-grid .has-warning .input-group-addon{color:#8a6d3b;border-color:#8a6d3b;background-color:#fcf8e3}.caldera-grid .has-warning .form-control-feedback{color:#8a6d3b}.caldera-grid .has-error .help-block,.caldera-grid .has-error .control-label,.caldera-grid .has-error .radio,.caldera-grid .has-error .checkbox,.caldera-grid .has-error .radio-inline,.caldera-grid .has-error .checkbox-inline,.caldera-grid .has-error.radio label,.caldera-grid .has-error.checkbox label,.caldera-grid .has-error.radio-inline label,.caldera-grid .has-error.checkbox-inline label{color:#a94442}.caldera-grid .has-error .form-control{border-color:#a94442;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.caldera-grid .has-error .form-control:focus{border-color:#843534;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #ce8483;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #ce8483}.caldera-grid .has-error .input-group-addon{color:#a94442;border-color:#a94442;background-color:#f2dede}.caldera-grid .has-error .form-control-feedback{color:#a94442}.caldera-grid .has-feedback label~.form-control-feedback{top:25px}.caldera-grid .has-feedback label.sr-only~.form-control-feedback{top:0}.caldera-grid .help-block{display:block;margin-top:5px;margin-bottom:10px;color:#737373}@media (min-width:768px){.caldera-grid .form-inline .form-group{display:inline-block;margin-bottom:0;vertical-align:middle}.caldera-grid .form-inline .form-control{display:inline-block;width:auto;vertical-align:middle}.caldera-grid .form-inline .form-control-static{display:inline-block}.caldera-grid .form-inline .input-group{display:inline-table;vertical-align:middle}.caldera-grid .form-inline .input-group .input-group-addon,.caldera-grid .form-inline .input-group .input-group-btn,.caldera-grid .form-inline .input-group .form-control{width:auto}.caldera-grid .form-inline .input-group>.form-control{width:100%}.caldera-grid .form-inline .control-label{margin-bottom:0;vertical-align:middle}.caldera-grid .form-inline .radio,.caldera-grid .form-inline .checkbox{display:inline-block;margin-top:0;margin-bottom:0;vertical-align:middle}.caldera-grid .form-inline .radio label,.caldera-grid .form-inline .checkbox label{padding-left:0}.caldera-grid .form-inline .radio input[type=radio],.caldera-grid .form-inline .checkbox input[type=checkbox]{position:relative;margin-left:0}.caldera-grid .form-inline .has-feedback .form-control-feedback{top:0}}.caldera-grid .form-horizontal .radio,.caldera-grid .form-horizontal .checkbox,.caldera-grid .form-horizontal .radio-inline,.caldera-grid .form-horizontal .checkbox-inline{margin-top:0;margin-bottom:0;padding-top:7px}.caldera-grid .form-horizontal .radio,.caldera-grid .form-horizontal .checkbox{min-height:27px}.caldera-grid .form-horizontal .form-group{margin-left:-15px;margin-right:-15px}@media (min-width:768px){.caldera-grid .form-horizontal .control-label{text-align:right;margin-bottom:0;padding-top:7px}}.caldera-grid .form-horizontal .has-feedback .form-control-feedback{right:15px}@media (min-width:768px){.caldera-grid .form-horizontal .form-group-lg .control-label{padding-top:14.33px}}@media (min-width:768px){.caldera-grid .form-horizontal .form-group-sm .control-label{padding-top:6px}}.caldera-grid .btn{display:inline-block;margin-bottom:0;font-weight:400;text-align:center;vertical-align:middle;touch-action:manipulation;cursor:pointer;background-image:none;border:1px solid transparent;white-space:nowrap;padding:6px 12px;font-size:14px;line-height:1.42857143;border-radius:2px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.caldera-grid .btn:focus,.caldera-grid .btn:active:focus,.caldera-grid .btn.active:focus,.caldera-grid .btn.focus,.caldera-grid .btn:active.focus,.caldera-grid .btn.active.focus{outline:thin dotted;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}.caldera-grid .btn:hover,.caldera-grid .btn:focus,.caldera-grid .btn.focus{color:#333;text-decoration:none}.caldera-grid .btn:active,.caldera-grid .btn.active{outline:0;background-image:none;-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.caldera-grid .btn.disabled,.caldera-grid .btn[disabled],fieldset[disabled] .caldera-grid .btn{cursor:not-allowed;pointer-events:none;opacity:.65;filter:alpha(opacity=65);-webkit-box-shadow:none;box-shadow:none}.caldera-grid .btn-default{color:#333;background-color:#fff;border-color:#ccc}.caldera-grid .btn-default:hover,.caldera-grid .btn-default:focus,.caldera-grid .btn-default.focus,.caldera-grid .btn-default:active,.caldera-grid .btn-default.active,.open>.dropdown-toggle.caldera-grid .btn-default{color:#333;background-color:#e6e6e6;border-color:#adadad}.caldera-grid .btn-default:active,.caldera-grid .btn-default.active,.open>.dropdown-toggle.caldera-grid .btn-default{background-image:none}.caldera-grid .btn-default.disabled,.caldera-grid .btn-default[disabled],fieldset[disabled] .caldera-grid .btn-default,.caldera-grid .btn-default.disabled:hover,.caldera-grid .btn-default[disabled]:hover,fieldset[disabled] .caldera-grid .btn-default:hover,.caldera-grid .btn-default.disabled:focus,.caldera-grid .btn-default[disabled]:focus,fieldset[disabled] .caldera-grid .btn-default:focus,.caldera-grid .btn-default.disabled.focus,.caldera-grid .btn-default[disabled].focus,fieldset[disabled] .caldera-grid .btn-default.focus,.caldera-grid .btn-default.disabled:active,.caldera-grid .btn-default[disabled]:active,fieldset[disabled] .caldera-grid .btn-default:active,.caldera-grid .btn-default.disabled.active,.caldera-grid .btn-default[disabled].active,fieldset[disabled] .caldera-grid .btn-default.active{background-color:#fff;border-color:#ccc}.caldera-grid .btn-default .badge{color:#fff;background-color:#333}.caldera-grid .btn-primary{color:#fff;background-color:#337ab7;border-color:#2e6da4}.caldera-grid .btn-primary:hover,.caldera-grid .btn-primary:focus,.caldera-grid .btn-primary.focus,.caldera-grid .btn-primary:active,.caldera-grid .btn-primary.active,.open>.dropdown-toggle.caldera-grid .btn-primary{color:#fff;background-color:#286090;border-color:#204d74}.caldera-grid .btn-primary:active,.caldera-grid .btn-primary.active,.open>.dropdown-toggle.caldera-grid .btn-primary{background-image:none}.caldera-grid .btn-primary.disabled,.caldera-grid .btn-primary[disabled],fieldset[disabled] .caldera-grid .btn-primary,.caldera-grid .btn-primary.disabled:hover,.caldera-grid .btn-primary[disabled]:hover,fieldset[disabled] .caldera-grid .btn-primary:hover,.caldera-grid .btn-primary.disabled:focus,.caldera-grid .btn-primary[disabled]:focus,fieldset[disabled] .caldera-grid .btn-primary:focus,.caldera-grid .btn-primary.disabled.focus,.caldera-grid .btn-primary[disabled].focus,fieldset[disabled] .caldera-grid .btn-primary.focus,.caldera-grid .btn-primary.disabled:active,.caldera-grid .btn-primary[disabled]:active,fieldset[disabled] .caldera-grid .btn-primary:active,.caldera-grid .btn-primary.disabled.active,.caldera-grid .btn-primary[disabled].active,fieldset[disabled] .caldera-grid .btn-primary.active{background-color:#337ab7;border-color:#2e6da4}.caldera-grid .btn-primary .badge{color:#337ab7;background-color:#fff}.caldera-grid .btn-success{color:#fff;background-color:#5cb85c;border-color:#4cae4c}.caldera-grid .btn-success:hover,.caldera-grid .btn-success:focus,.caldera-grid .btn-success.focus,.caldera-grid .btn-success:active,.caldera-grid .btn-success.active,.open>.dropdown-toggle.caldera-grid .btn-success{color:#fff;background-color:#449d44;border-color:#398439}.caldera-grid .btn-success:active,.caldera-grid .btn-success.active,.open>.dropdown-toggle.caldera-grid .btn-success{background-image:none}.caldera-grid .btn-success.disabled,.caldera-grid .btn-success[disabled],fieldset[disabled] .caldera-grid .btn-success,.caldera-grid .btn-success.disabled:hover,.caldera-grid .btn-success[disabled]:hover,fieldset[disabled] .caldera-grid .btn-success:hover,.caldera-grid .btn-success.disabled:focus,.caldera-grid .btn-success[disabled]:focus,fieldset[disabled] .caldera-grid .btn-success:focus,.caldera-grid .btn-success.disabled.focus,.caldera-grid .btn-success[disabled].focus,fieldset[disabled] .caldera-grid .btn-success.focus,.caldera-grid .btn-success.disabled:active,.caldera-grid .btn-success[disabled]:active,fieldset[disabled] .caldera-grid .btn-success:active,.caldera-grid .btn-success.disabled.active,.caldera-grid .btn-success[disabled].active,fieldset[disabled] .caldera-grid .btn-success.active{background-color:#5cb85c;border-color:#4cae4c}.caldera-grid .btn-success .badge{color:#5cb85c;background-color:#fff}.caldera-grid .btn-info{color:#fff;background-color:#5bc0de;border-color:#46b8da}.caldera-grid .btn-info:hover,.caldera-grid .btn-info:focus,.caldera-grid .btn-info.focus,.caldera-grid .btn-info:active,.caldera-grid .btn-info.active,.open>.dropdown-toggle.caldera-grid .btn-info{color:#fff;background-color:#31b0d5;border-color:#269abc}.caldera-grid .btn-info:active,.caldera-grid .btn-info.active,.open>.dropdown-toggle.caldera-grid .btn-info{background-image:none}.caldera-grid .btn-info.disabled,.caldera-grid .btn-info[disabled],fieldset[disabled] .caldera-grid .btn-info,.caldera-grid .btn-info.disabled:hover,.caldera-grid .btn-info[disabled]:hover,fieldset[disabled] .caldera-grid .btn-info:hover,.caldera-grid .btn-info.disabled:focus,.caldera-grid .btn-info[disabled]:focus,fieldset[disabled] .caldera-grid .btn-info:focus,.caldera-grid .btn-info.disabled.focus,.caldera-grid .btn-info[disabled].focus,fieldset[disabled] .caldera-grid .btn-info.focus,.caldera-grid .btn-info.disabled:active,.caldera-grid .btn-info[disabled]:active,fieldset[disabled] .caldera-grid .btn-info:active,.caldera-grid .btn-info.disabled.active,.caldera-grid .btn-info[disabled].active,fieldset[disabled] .caldera-grid .btn-info.active{background-color:#5bc0de;border-color:#46b8da}.caldera-grid .btn-info .badge{color:#5bc0de;background-color:#fff}.caldera-grid .btn-warning{color:#fff;background-color:#f0ad4e;border-color:#eea236}.caldera-grid .btn-warning:hover,.caldera-grid .btn-warning:focus,.caldera-grid .btn-warning.focus,.caldera-grid .btn-warning:active,.caldera-grid .btn-warning.active,.open>.dropdown-toggle.caldera-grid .btn-warning{color:#fff;background-color:#ec971f;border-color:#d58512}.caldera-grid .btn-warning:active,.caldera-grid .btn-warning.active,.open>.dropdown-toggle.caldera-grid .btn-warning{background-image:none}.caldera-grid .btn-warning.disabled,.caldera-grid .btn-warning[disabled],fieldset[disabled] .caldera-grid .btn-warning,.caldera-grid .btn-warning.disabled:hover,.caldera-grid .btn-warning[disabled]:hover,fieldset[disabled] .caldera-grid .btn-warning:hover,.caldera-grid .btn-warning.disabled:focus,.caldera-grid .btn-warning[disabled]:focus,fieldset[disabled] .caldera-grid .btn-warning:focus,.caldera-grid .btn-warning.disabled.focus,.caldera-grid .btn-warning[disabled].focus,fieldset[disabled] .caldera-grid .btn-warning.focus,.caldera-grid .btn-warning.disabled:active,.caldera-grid .btn-warning[disabled]:active,fieldset[disabled] .caldera-grid .btn-warning:active,.caldera-grid .btn-warning.disabled.active,.caldera-grid .btn-warning[disabled].active,fieldset[disabled] .caldera-grid .btn-warning.active{background-color:#f0ad4e;border-color:#eea236}.caldera-grid .btn-warning .badge{color:#f0ad4e;background-color:#fff}.caldera-grid .btn-danger{color:#fff;background-color:#d9534f;border-color:#d43f3a}.caldera-grid .btn-danger:hover,.caldera-grid .btn-danger:focus,.caldera-grid .btn-danger.focus,.caldera-grid .btn-danger:active,.caldera-grid .btn-danger.active,.open>.dropdown-toggle.caldera-grid .btn-danger{color:#fff;background-color:#c9302c;border-color:#ac2925}.caldera-grid .btn-danger:active,.caldera-grid .btn-danger.active,.open>.dropdown-toggle.caldera-grid .btn-danger{background-image:none}.caldera-grid .btn-danger.disabled,.caldera-grid .btn-danger[disabled],fieldset[disabled] .caldera-grid .btn-danger,.caldera-grid .btn-danger.disabled:hover,.caldera-grid .btn-danger[disabled]:hover,fieldset[disabled] .caldera-grid .btn-danger:hover,.caldera-grid .btn-danger.disabled:focus,.caldera-grid .btn-danger[disabled]:focus,fieldset[disabled] .caldera-grid .btn-danger:focus,.caldera-grid .btn-danger.disabled.focus,.caldera-grid .btn-danger[disabled].focus,fieldset[disabled] .caldera-grid .btn-danger.focus,.caldera-grid .btn-danger.disabled:active,.caldera-grid .btn-danger[disabled]:active,fieldset[disabled] .caldera-grid .btn-danger:active,.caldera-grid .btn-danger.disabled.active,.caldera-grid .btn-danger[disabled].active,fieldset[disabled] .caldera-grid .btn-danger.active{background-color:#d9534f;border-color:#d43f3a}.caldera-grid .btn-danger .badge{color:#d9534f;background-color:#fff}.caldera-grid .btn-link{color:#337ab7;font-weight:400;border-radius:0}.caldera-grid .btn-link,.caldera-grid .btn-link:active,.caldera-grid .btn-link.active,.caldera-grid .btn-link[disabled],fieldset[disabled] .caldera-grid .btn-link{background-color:transparent;-webkit-box-shadow:none;box-shadow:none}.caldera-grid .btn-link,.caldera-grid .btn-link:hover,.caldera-grid .btn-link:focus,.caldera-grid .btn-link:active{border-color:transparent}.caldera-grid .btn-link:hover,.caldera-grid .btn-link:focus{color:#23527c;text-decoration:underline;background-color:transparent}.caldera-grid .btn-link[disabled]:hover,fieldset[disabled] .caldera-grid .btn-link:hover,.caldera-grid .btn-link[disabled]:focus,fieldset[disabled] .caldera-grid .btn-link:focus{color:#777;text-decoration:none}.caldera-grid .btn-lg{padding:10px 16px;font-size:18px;line-height:1.3333333;border-radius:4px}.caldera-grid .btn-sm{padding:5px 10px;font-size:12px;line-height:1.5;border-radius:1px}.caldera-grid .btn-xs{padding:1px 5px;font-size:12px;line-height:1.5;border-radius:1px}.caldera-grid .btn-block{display:block;width:100%}.caldera-grid .btn-block+.btn-block{margin-top:5px}.caldera-grid input[type=submit].btn-block,.caldera-grid input[type=reset].btn-block,.caldera-grid input[type=button].btn-block{width:100%}.caldera-grid textarea.form-control{padding-right:4px;height:auto}
|
2 |
.caldera-grid .breadcrumb {
|
3 |
padding: 6px 12px;
|
4 |
margin: 0 0 20px;
|
23 |
.breadcrumb > li.error > a {
|
24 |
color: #ff0000;
|
25 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/css/caldera-grid.css
CHANGED
@@ -99,8 +99,7 @@
|
|
99 |
.caldera-grid input,
|
100 |
.caldera-grid optgroup,
|
101 |
.caldera-grid select,
|
102 |
-
.caldera-grid textarea {
|
103 |
-
color: inherit;
|
104 |
font: inherit;
|
105 |
margin: 0;
|
106 |
}
|
@@ -395,8 +394,7 @@
|
|
395 |
.caldera-grid input,
|
396 |
.caldera-grid optgroup,
|
397 |
.caldera-grid select,
|
398 |
-
.caldera-grid textarea {
|
399 |
-
color: inherit;
|
400 |
font: inherit;
|
401 |
margin: 0;
|
402 |
}
|
99 |
.caldera-grid input,
|
100 |
.caldera-grid optgroup,
|
101 |
.caldera-grid select,
|
102 |
+
.caldera-grid textarea {
|
|
|
103 |
font: inherit;
|
104 |
margin: 0;
|
105 |
}
|
394 |
.caldera-grid input,
|
395 |
.caldera-grid optgroup,
|
396 |
.caldera-grid select,
|
397 |
+
.caldera-grid textarea {
|
|
|
398 |
font: inherit;
|
399 |
margin: 0;
|
400 |
}
|
assets/css/editor-grid.css
CHANGED
@@ -265,10 +265,13 @@
|
|
265 |
.layout-grid .row.sizing .layout-form-field:hover {
|
266 |
min-width: 0;
|
267 |
}
|
|
|
|
|
268 |
.layout-grid .layout-form-field:hover .icon-edit {
|
269 |
cursor: pointer;
|
270 |
display: block !important;
|
271 |
}
|
|
|
272 |
.layout-grid .layout-form-field.button-primary .icon-edit {
|
273 |
display: none !important;
|
274 |
}
|
265 |
.layout-grid .row.sizing .layout-form-field:hover {
|
266 |
min-width: 0;
|
267 |
}
|
268 |
+
|
269 |
+
.layout-grid .layout-form-field:hover .dashicons-admin-page,
|
270 |
.layout-grid .layout-form-field:hover .icon-edit {
|
271 |
cursor: pointer;
|
272 |
display: block !important;
|
273 |
}
|
274 |
+
|
275 |
.layout-grid .layout-form-field.button-primary .icon-edit {
|
276 |
display: none !important;
|
277 |
}
|
assets/css/fields.min.css
CHANGED
@@ -1,11 +1,12 @@
|
|
1 |
@font-face{font-family:cf-raty;src:url(fonts/cf-raty.eot?40481674);src:url(fonts/cf-raty.eot?40481674#iefix) format('embedded-opentype'),url(fonts/cf-raty.woff?40481674) format('woff'),url(fonts/cf-raty.ttf?40481674) format('truetype'),url(fonts/cf-raty.svg?40481674#cf-raty) format('svg');font-weight:400;font-style:normal}[class*=" raty-"]:before,[class^=raty-]:before{font-family:cf-raty;font-style:normal;font-weight:400;speak:none;font-size:2em;display:inline-block;text-decoration:inherit;width:1em;text-align:center;font-variant:normal;text-transform:none;line-height:1em}.raty-heart-on:before{content:'\e800'}.raty-heart-off:before{content:'\e801'}.raty-star-on:before{content:'\e802'}.raty-star-off:before{content:'\e803'}.raty-circle-on:before{content:'\e804'}.raty-circle-off:before{content:'\e805'}.raty-dot-off:before{content:'\e806'}.raty-dot-on:before{content:'\e807'}.raty-face-off:before{content:'\e808'}.raty-face-on:before{content:'\e809'}.raty-cancel-off:before{content:'\e80a'}.raty-cancel-on:before{content:'\e80b'}.calculation-group{background:#FFF;box-shadow:0 1px 2px rgba(0,0,0,.05);padding:6px;margin:6px 0}.preview-color-selector{background:#F0F0F0;border:1px solid #E2E2E2;display:inline;margin-left:-1px;padding:3px 12px;box-shadow:0 0 0 2px #fff inset}.miniColors-trigger{border:1px solid #999;-mz-border-radius:0 1px 1px 0;-webkit-border-radius:0 1px 1px 0;display:inline-block;height:24px;margin:0 0 -8px -1px;width:30px}.miniColors-selector{background:#FFF;border:1px solid #999;-moz-box-shadow:0 3px 0 -1px rgba(0,0,0,.05);-webkit-box-shadow:0 3px 0 -1px rgba(0,0,0,.05);box-shadow:0 3px 0 -1px rgba(0,0,0,.05);height:162px;padding:5px;position:absolute;width:187px;z-index:999999;margin-top:-1px}.miniColors-selector.black{background:#000;border-color:#000}.miniColors-colors{position:absolute;top:5px;left:5px;width:150px;height:150px;background:url(minicolor-colors.png) right no-repeat;cursor:crosshair}.miniColors-hues{position:absolute;top:5px;left:160px;width:20px;height:150px;background:url(minicolor-colors.png) left no-repeat;cursor:crosshair}.miniColors-colorPicker{position:absolute;width:9px;height:9px;border:1px solid #fff;-moz-border-radius:11px;-webkit-border-radius:11px;border-radius:11px}.miniColors-colorPicker-inner{position:absolute;top:0;left:0;width:7px;height:7px;border:1px solid #000;-moz-border-radius:9px;-webkit-border-radius:9px;border-radius:9px}.miniColors-huePicker{position:absolute;left:-3px;width:24px;height:1px;border:1px solid #fff;border-radius:2px;background:#000}.cf-color-picker .form-control::-moz-placeholder{color:#999;opacity:1}.cf-color-picker .form-control:-ms-input-placeholder{color:#999}.cf-color-picker .form-control::-webkit-input-placeholder{color:#999}.cf-color-picker .form-control[disabled],.cf-color-picker .form-control[readonly],.cf-color-picker fieldset[disabled] .form-control{cursor:not-allowed;background-color:#eee;opacity:1}.cf-color-picker .form-group{margin-bottom:15px}.cf-color-picker .input-group{position:relative;display:table;border-collapse:separate}.cf-color-picker .input-group[class*=col-]{float:none;padding-left:0;padding-right:0}.cf-color-picker .input-group .form-control{position:relative;z-index:2;float:left;width:100%;margin-bottom:0}.cf-color-picker .input-group-lg>.form-control,.cf-color-picker .input-group-lg>.input-group-addon,.cf-color-picker .input-group-lg>.input-group-btn>.btn{height:46px;padding:10px 16px;font-size:18px;line-height:1.33;border-radius:6px}.cf-color-picker .input-group-sm>.form-control,.cf-color-picker .input-group-sm>.input-group-addon,.cf-color-picker .input-group-sm>.input-group-btn>.btn{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}.cf-color-picker .input-group .form-control,.cf-color-picker .input-group-addon,.cf-color-picker .input-group-btn{display:table-cell}.cf-color-picker .input-group .form-control:not(:first-child):not(:last-child),.cf-color-picker .input-group-addon:not(:first-child):not(:last-child),.cf-color-picker .input-group-btn:not(:first-child):not(:last-child){border-radius:0}.cf-color-picker .input-group-addon,.cf-color-picker .input-group-btn{width:1%;white-space:nowrap;vertical-align:middle}.cf-color-picker .input-group-addon{padding:6px 12px;font-size:14px;font-weight:400;line-height:1;color:#555;text-align:center;background-color:#eee;border:1px solid #ccc;border-radius:4px}.cf-color-picker .input-group-addon.input-sm{padding:5px 10px;font-size:12px;border-radius:3px}.cf-color-picker .input-group-addon.input-lg{padding:10px 16px;font-size:18px;border-radius:6px}.cf-color-picker .input-group .form-control:first-child,.cf-color-picker .input-group-addon:first-child,.cf-color-picker .input-group-btn:first-child>.btn,.cf-color-picker .input-group-btn:first-child>.btn-group>.btn,.cf-color-picker .input-group-btn:first-child>.dropdown-toggle,.cf-color-picker .input-group-btn:last-child>.btn-group:not(:last-child)>.btn,.cf-color-picker .input-group-btn:last-child>.btn:not(:last-child):not(.dropdown-toggle){border-bottom-right-radius:0;border-top-right-radius:0}.cf-color-picker .input-group-addon:first-child{border-right:0}.cf-color-picker .input-group .form-control:last-child,.cf-color-picker .input-group-addon:last-child,.cf-color-picker .input-group-btn:first-child>.btn-group:not(:first-child)>.btn,.cf-color-picker .input-group-btn:first-child>.btn:not(:first-child),.cf-color-picker .input-group-btn:last-child>.btn,.cf-color-picker .input-group-btn:last-child>.btn-group>.btn,.cf-color-picker .input-group-btn:last-child>.dropdown-toggle{border-bottom-left-radius:0;border-top-left-radius:0}.cf-color-picker .input-group-addon:last-child{border-left:0}.cf-color-picker .input-group-btn{position:relative;font-size:0;white-space:nowrap}.cf-color-picker .input-group-btn>.btn{position:relative}.cf-color-picker .input-group-btn>.btn+.btn{margin-left:-1px}.cf-color-picker .input-group-btn>.btn:active,.cf-color-picker .input-group-btn>.btn:focus,.cf-color-picker .input-group-btn>.btn:hover{z-index:2}.cf-color-picker .input-group-btn:first-child>.btn,.cf-color-picker .input-group-btn:first-child>.btn-group{margin-right:-1px}.cf-color-picker .input-group-btn:last-child>.btn,.cf-color-picker .input-group-btn:last-child>.btn-group{margin-left:-1px}.cf-color-picker .clearfix:after,.cf-color-picker .clearfix:before,.cf-color-picker .form-horizontal .form-group:after,.cf-color-picker .form-horizontal .form-group:before{content:" ";display:table}.cf-color-picker .clearfix:after,.cf-color-picker .form-horizontal .form-group:after{clear:both}.cf-color-picker .center-block{display:block;margin-left:auto;margin-right:auto}.cf-color-picker .pull-right{float:right!important}.cf-color-picker .pull-left{float:left!important}.cf-color-picker .hide{display:none!important}.cf-color-picker .show{display:block!important}.cf-color-picker .invisible{visibility:hidden}.cf-color-picker .text-hide{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0}.cf-color-picker .hidden{display:none!important;visibility:hidden!important}.cf-color-picker .affix{position:fixed}@-ms-viewport{width:device-width}.cf-color-picker .visible-lg,.cf-color-picker .visible-md,.cf-color-picker .visible-print,.cf-color-picker .visible-sm,.cf-color-picker .visible-xs{display:none!important}@media (max-width:767px){.cf-color-picker .visible-xs{display:block!important}.cf-color-picker table.visible-xs{display:table}.cf-color-picker tr.visible-xs{display:table-row!important}.cf-color-picker td.visible-xs,.cf-color-picker th.visible-xs{display:table-cell!important}}@media (min-width:768px) and (max-width:991px){.cf-color-picker .visible-sm{display:block!important}.cf-color-picker table.visible-sm{display:table}.cf-color-picker tr.visible-sm{display:table-row!important}.cf-color-picker td.visible-sm,.cf-color-picker th.visible-sm{display:table-cell!important}}@media (min-width:992px) and (max-width:1199px){.cf-color-picker .visible-md{display:block!important}.cf-color-picker table.visible-md{display:table}.cf-color-picker tr.visible-md{display:table-row!important}.cf-color-picker td.visible-md,.cf-color-picker th.visible-md{display:table-cell!important}}@media (min-width:1200px){.cf-color-picker .visible-lg{display:block!important}.cf-color-picker table.visible-lg{display:table}.cf-color-picker tr.visible-lg{display:table-row!important}.cf-color-picker td.visible-lg,.cf-color-picker th.visible-lg{display:table-cell!important}}@media (max-width:767px){.cf-color-picker .hidden-xs{display:none!important}}@media (min-width:768px) and (max-width:991px){.cf-color-picker .hidden-sm{display:none!important}}@media (min-width:992px) and (max-width:1199px){.cf-color-picker .hidden-md{display:none!important}}@media (min-width:1200px){.cf-color-picker .hidden-lg{display:none!important}}@media print{.cf-color-picker .visible-print{display:block!important}.cf-color-picker table.visible-print{display:table}.cf-color-picker tr.visible-print{display:table-row!important}.cf-color-picker td.visible-print,.cf-color-picker th.visible-print{display:table-cell!important}}@media print{.cf-color-picker .hidden-print{display:none!important}}.cf-color-picker .input-group{max-width:120px}
|
2 |
.cfdatepicker{padding:4px;border-radius:4px;direction:ltr}.cfdatepicker-inline{width:220px}.cfdatepicker.cfdatepicker-rtl{direction:rtl}.cfdatepicker.cfdatepicker-rtl table tr td span{float:right}.cfdatepicker-dropdown{top:0;left:0}.cfdatepicker-dropdown:before{content:'';display:inline-block;border-left:7px solid transparent;border-right:7px solid transparent;border-bottom:7px solid #ccc;border-top:0;border-bottom-color:rgba(0,0,0,.2);position:absolute}.cfdatepicker-dropdown:after{content:'';display:inline-block;border-left:6px solid transparent;border-right:6px solid transparent;border-bottom:6px solid #fff;border-top:0;position:absolute}.cfdatepicker-dropdown.cfdatepicker-orient-left:before{left:6px}.cfdatepicker-dropdown.cfdatepicker-orient-left:after{left:7px}.cfdatepicker-dropdown.cfdatepicker-orient-right:before{right:6px}.cfdatepicker-dropdown.cfdatepicker-orient-right:after{right:7px}.cfdatepicker-dropdown.cfdatepicker-orient-top:before{top:-7px}.cfdatepicker-dropdown.cfdatepicker-orient-top:after{top:-6px}.cfdatepicker-dropdown.cfdatepicker-orient-bottom:before{bottom:-7px;border-bottom:0;border-top:7px solid #999}.cfdatepicker-dropdown.cfdatepicker-orient-bottom:after{bottom:-6px;border-bottom:0;border-top:6px solid #fff}.cfdatepicker>div{display:none}.cfdatepicker.days div.cfdatepicker-days,.cfdatepicker.months div.cfdatepicker-months,.cfdatepicker.years div.cfdatepicker-years{display:block}.cfdatepicker table{border: 0 none;width: auto;margin:0;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.cfdatepicker table tr td,.cfdatepicker table tr th{text-align:center;width:10px;height:10px;border-radius:4px;border:none}.table-striped .cfdatepicker table tr td,.table-striped .cfdatepicker table tr th{background-color:transparent}.cfdatepicker table tr td.day.focused,.cfdatepicker table tr td.day:hover{background:#eee;cursor:pointer}.cfdatepicker table tr td.new,.cfdatepicker table tr td.old{color:#999}.cfdatepicker table tr td.disabled,.cfdatepicker table tr td.disabled:hover{background:0 0;color:#999;cursor:default}.cfdatepicker table tr td.today,.cfdatepicker table tr td.today.disabled,.cfdatepicker table tr td.today.disabled:hover,.cfdatepicker table tr td.today:hover{color:#000;background-color:#ffdb99;border-color:#ffb733}.cfdatepicker table tr td.today.active,.cfdatepicker table tr td.today.disabled.active,.cfdatepicker table tr td.today.disabled:active,.cfdatepicker table tr td.today.disabled:focus,.cfdatepicker table tr td.today.disabled:hover,.cfdatepicker table tr td.today.disabled:hover.active,.cfdatepicker table tr td.today.disabled:hover:active,.cfdatepicker table tr td.today.disabled:hover:focus,.cfdatepicker table tr td.today.disabled:hover:hover,.cfdatepicker table tr td.today:active,.cfdatepicker table tr td.today:focus,.cfdatepicker table tr td.today:hover,.cfdatepicker table tr td.today:hover.active,.cfdatepicker table tr td.today:hover:active,.cfdatepicker table tr td.today:hover:focus,.cfdatepicker table tr td.today:hover:hover,.open .dropdown-toggle.cfdatepicker table tr td.today,.open .dropdown-toggle.cfdatepicker table tr td.today.disabled,.open .dropdown-toggle.cfdatepicker table tr td.today.disabled:hover,.open .dropdown-toggle.cfdatepicker table tr td.today:hover{color:#000;background-color:#ffcd70;border-color:#f59e00}.cfdatepicker table tr td.today.active,.cfdatepicker table tr td.today.disabled.active,.cfdatepicker table tr td.today.disabled:active,.cfdatepicker table tr td.today.disabled:hover.active,.cfdatepicker table tr td.today.disabled:hover:active,.cfdatepicker table tr td.today:active,.cfdatepicker table tr td.today:hover.active,.cfdatepicker table tr td.today:hover:active,.open .dropdown-toggle.cfdatepicker table tr td.today,.open .dropdown-toggle.cfdatepicker table tr td.today.disabled,.open .dropdown-toggle.cfdatepicker table tr td.today.disabled:hover,.open .dropdown-toggle.cfdatepicker table tr td.today:hover{background-image:none}.cfdatepicker table tr td.today.disabled,.cfdatepicker table tr td.today.disabled.active,.cfdatepicker table tr td.today.disabled.disabled,.cfdatepicker table tr td.today.disabled.disabled.active,.cfdatepicker table tr td.today.disabled.disabled:active,.cfdatepicker table tr td.today.disabled.disabled:focus,.cfdatepicker table tr td.today.disabled.disabled:hover,.cfdatepicker table tr td.today.disabled:active,.cfdatepicker table tr td.today.disabled:focus,.cfdatepicker table tr td.today.disabled:hover,.cfdatepicker table tr td.today.disabled:hover.disabled,.cfdatepicker table tr td.today.disabled:hover.disabled.active,.cfdatepicker table tr td.today.disabled:hover.disabled:active,.cfdatepicker table tr td.today.disabled:hover.disabled:focus,.cfdatepicker table tr td.today.disabled:hover.disabled:hover,.cfdatepicker table tr td.today.disabled:hover[disabled],.cfdatepicker table tr td.today.disabled:hover[disabled].active,.cfdatepicker table tr td.today.disabled:hover[disabled]:active,.cfdatepicker table tr td.today.disabled:hover[disabled]:focus,.cfdatepicker table tr td.today.disabled:hover[disabled]:hover,.cfdatepicker table tr td.today.disabled[disabled],.cfdatepicker table tr td.today.disabled[disabled].active,.cfdatepicker table tr td.today.disabled[disabled]:active,.cfdatepicker table tr td.today.disabled[disabled]:focus,.cfdatepicker table tr td.today.disabled[disabled]:hover,.cfdatepicker table tr td.today:hover.disabled,.cfdatepicker table tr td.today:hover.disabled.active,.cfdatepicker table tr td.today:hover.disabled:active,.cfdatepicker table tr td.today:hover.disabled:focus,.cfdatepicker table tr td.today:hover.disabled:hover,.cfdatepicker table tr td.today:hover[disabled],.cfdatepicker table tr td.today:hover[disabled].active,.cfdatepicker table tr td.today:hover[disabled]:active,.cfdatepicker table tr td.today:hover[disabled]:focus,.cfdatepicker table tr td.today:hover[disabled]:hover,.cfdatepicker table tr td.today[disabled],.cfdatepicker table tr td.today[disabled].active,.cfdatepicker table tr td.today[disabled]:active,.cfdatepicker table tr td.today[disabled]:focus,.cfdatepicker table tr td.today[disabled]:hover,fieldset[disabled] .cfdatepicker table tr td.today,fieldset[disabled] .cfdatepicker table tr td.today.active,fieldset[disabled] .cfdatepicker table tr td.today.disabled,fieldset[disabled] .cfdatepicker table tr td.today.disabled.active,fieldset[disabled] .cfdatepicker table tr td.today.disabled:active,fieldset[disabled] .cfdatepicker table tr td.today.disabled:focus,fieldset[disabled] .cfdatepicker table tr td.today.disabled:hover,fieldset[disabled] .cfdatepicker table tr td.today.disabled:hover.active,fieldset[disabled] .cfdatepicker table tr td.today.disabled:hover:active,fieldset[disabled] .cfdatepicker table tr td.today.disabled:hover:focus,fieldset[disabled] .cfdatepicker table tr td.today.disabled:hover:hover,fieldset[disabled] .cfdatepicker table tr td.today:active,fieldset[disabled] .cfdatepicker table tr td.today:focus,fieldset[disabled] .cfdatepicker table tr td.today:hover,fieldset[disabled] .cfdatepicker table tr td.today:hover.active,fieldset[disabled] .cfdatepicker table tr td.today:hover:active,fieldset[disabled] .cfdatepicker table tr td.today:hover:focus,fieldset[disabled] .cfdatepicker table tr td.today:hover:hover{background-color:#ffdb99;border-color:#ffb733}.cfdatepicker table tr td.today:hover:hover{color:#000}.cfdatepicker table tr td.today.active:hover{color:#fff}.cfdatepicker table tr td.range,.cfdatepicker table tr td.range.disabled,.cfdatepicker table tr td.range.disabled:hover,.cfdatepicker table tr td.range:hover{background:#eee;border-radius:0}.cfdatepicker table tr td.range.today,.cfdatepicker table tr td.range.today.disabled,.cfdatepicker table tr td.range.today.disabled:hover,.cfdatepicker table tr td.range.today:hover{color:#000;background-color:#f7ca77;border-color:#f1a417;border-radius:0}.cfdatepicker table tr td.range.today.active,.cfdatepicker table tr td.range.today.disabled.active,.cfdatepicker table tr td.range.today.disabled:active,.cfdatepicker table tr td.range.today.disabled:focus,.cfdatepicker table tr td.range.today.disabled:hover,.cfdatepicker table tr td.range.today.disabled:hover.active,.cfdatepicker table tr td.range.today.disabled:hover:active,.cfdatepicker table tr td.range.today.disabled:hover:focus,.cfdatepicker table tr td.range.today.disabled:hover:hover,.cfdatepicker table tr td.range.today:active,.cfdatepicker table tr td.range.today:focus,.cfdatepicker table tr td.range.today:hover,.cfdatepicker table tr td.range.today:hover.active,.cfdatepicker table tr td.range.today:hover:active,.cfdatepicker table tr td.range.today:hover:focus,.cfdatepicker table tr td.range.today:hover:hover,.open .dropdown-toggle.cfdatepicker table tr td.range.today,.open .dropdown-toggle.cfdatepicker table tr td.range.today.disabled,.open .dropdown-toggle.cfdatepicker table tr td.range.today.disabled:hover,.open .dropdown-toggle.cfdatepicker table tr td.range.today:hover{color:#000;background-color:#f4bb51;border-color:#bf800c}.cfdatepicker table tr td.range.today.active,.cfdatepicker table tr td.range.today.disabled.active,.cfdatepicker table tr td.range.today.disabled:active,.cfdatepicker table tr td.range.today.disabled:hover.active,.cfdatepicker table tr td.range.today.disabled:hover:active,.cfdatepicker table tr td.range.today:active,.cfdatepicker table tr td.range.today:hover.active,.cfdatepicker table tr td.range.today:hover:active,.open .dropdown-toggle.cfdatepicker table tr td.range.today,.open .dropdown-toggle.cfdatepicker table tr td.range.today.disabled,.open .dropdown-toggle.cfdatepicker table tr td.range.today.disabled:hover,.open .dropdown-toggle.cfdatepicker table tr td.range.today:hover{background-image:none}.cfdatepicker table tr td.range.today.disabled,.cfdatepicker table tr td.range.today.disabled.active,.cfdatepicker table tr td.range.today.disabled.disabled,.cfdatepicker table tr td.range.today.disabled.disabled.active,.cfdatepicker table tr td.range.today.disabled.disabled:active,.cfdatepicker table tr td.range.today.disabled.disabled:focus,.cfdatepicker table tr td.range.today.disabled.disabled:hover,.cfdatepicker table tr td.range.today.disabled:active,.cfdatepicker table tr td.range.today.disabled:focus,.cfdatepicker table tr td.range.today.disabled:hover,.cfdatepicker table tr td.range.today.disabled:hover.disabled,.cfdatepicker table tr td.range.today.disabled:hover.disabled.active,.cfdatepicker table tr td.range.today.disabled:hover.disabled:active,.cfdatepicker table tr td.range.today.disabled:hover.disabled:focus,.cfdatepicker table tr td.range.today.disabled:hover.disabled:hover,.cfdatepicker table tr td.range.today.disabled:hover[disabled],.cfdatepicker table tr td.range.today.disabled:hover[disabled].active,.cfdatepicker table tr td.range.today.disabled:hover[disabled]:active,.cfdatepicker table tr td.range.today.disabled:hover[disabled]:focus,.cfdatepicker table tr td.range.today.disabled:hover[disabled]:hover,.cfdatepicker table tr td.range.today.disabled[disabled],.cfdatepicker table tr td.range.today.disabled[disabled].active,.cfdatepicker table tr td.range.today.disabled[disabled]:active,.cfdatepicker table tr td.range.today.disabled[disabled]:focus,.cfdatepicker table tr td.range.today.disabled[disabled]:hover,.cfdatepicker table tr td.range.today:hover.disabled,.cfdatepicker table tr td.range.today:hover.disabled.active,.cfdatepicker table tr td.range.today:hover.disabled:active,.cfdatepicker table tr td.range.today:hover.disabled:focus,.cfdatepicker table tr td.range.today:hover.disabled:hover,.cfdatepicker table tr td.range.today:hover[disabled],.cfdatepicker table tr td.range.today:hover[disabled].active,.cfdatepicker table tr td.range.today:hover[disabled]:active,.cfdatepicker table tr td.range.today:hover[disabled]:focus,.cfdatepicker table tr td.range.today:hover[disabled]:hover,.cfdatepicker table tr td.range.today[disabled],.cfdatepicker table tr td.range.today[disabled].active,.cfdatepicker table tr td.range.today[disabled]:active,.cfdatepicker table tr td.range.today[disabled]:focus,.cfdatepicker table tr td.range.today[disabled]:hover,fieldset[disabled] .cfdatepicker table tr td.range.today,fieldset[disabled] .cfdatepicker table tr td.range.today.active,fieldset[disabled] .cfdatepicker table tr td.range.today.disabled,fieldset[disabled] .cfdatepicker table tr td.range.today.disabled.active,fieldset[disabled] .cfdatepicker table tr td.range.today.disabled:active,fieldset[disabled] .cfdatepicker table tr td.range.today.disabled:focus,fieldset[disabled] .cfdatepicker table tr td.range.today.disabled:hover,fieldset[disabled] .cfdatepicker table tr td.range.today.disabled:hover.active,fieldset[disabled] .cfdatepicker table tr td.range.today.disabled:hover:active,fieldset[disabled] .cfdatepicker table tr td.range.today.disabled:hover:focus,fieldset[disabled] .cfdatepicker table tr td.range.today.disabled:hover:hover,fieldset[disabled] .cfdatepicker table tr td.range.today:active,fieldset[disabled] .cfdatepicker table tr td.range.today:focus,fieldset[disabled] .cfdatepicker table tr td.range.today:hover,fieldset[disabled] .cfdatepicker table tr td.range.today:hover.active,fieldset[disabled] .cfdatepicker table tr td.range.today:hover:active,fieldset[disabled] .cfdatepicker table tr td.range.today:hover:focus,fieldset[disabled] .cfdatepicker table tr td.range.today:hover:hover{background-color:#f7ca77;border-color:#f1a417}.cfdatepicker table tr td.selected,.cfdatepicker table tr td.selected.disabled,.cfdatepicker table tr td.selected.disabled:hover,.cfdatepicker table tr td.selected:hover{color:#fff;background-color:#999;border-color:#555;text-shadow:0 -1px 0 rgba(0,0,0,.25)}.cfdatepicker table tr td.selected.active,.cfdatepicker table tr td.selected.disabled.active,.cfdatepicker table tr td.selected.disabled:active,.cfdatepicker table tr td.selected.disabled:focus,.cfdatepicker table tr td.selected.disabled:hover,.cfdatepicker table tr td.selected.disabled:hover.active,.cfdatepicker table tr td.selected.disabled:hover:active,.cfdatepicker table tr td.selected.disabled:hover:focus,.cfdatepicker table tr td.selected.disabled:hover:hover,.cfdatepicker table tr td.selected:active,.cfdatepicker table tr td.selected:focus,.cfdatepicker table tr td.selected:hover,.cfdatepicker table tr td.selected:hover.active,.cfdatepicker table tr td.selected:hover:active,.cfdatepicker table tr td.selected:hover:focus,.cfdatepicker table tr td.selected:hover:hover,.open .dropdown-toggle.cfdatepicker table tr td.selected,.open .dropdown-toggle.cfdatepicker table tr td.selected.disabled,.open .dropdown-toggle.cfdatepicker table tr td.selected.disabled:hover,.open .dropdown-toggle.cfdatepicker table tr td.selected:hover{color:#fff;background-color:#858585;border-color:#373737}.cfdatepicker table tr td.selected.active,.cfdatepicker table tr td.selected.disabled.active,.cfdatepicker table tr td.selected.disabled:active,.cfdatepicker table tr td.selected.disabled:hover.active,.cfdatepicker table tr td.selected.disabled:hover:active,.cfdatepicker table tr td.selected:active,.cfdatepicker table tr td.selected:hover.active,.cfdatepicker table tr td.selected:hover:active,.open .dropdown-toggle.cfdatepicker table tr td.selected,.open .dropdown-toggle.cfdatepicker table tr td.selected.disabled,.open .dropdown-toggle.cfdatepicker table tr td.selected.disabled:hover,.open .dropdown-toggle.cfdatepicker table tr td.selected:hover{background-image:none}.cfdatepicker table tr td.selected.disabled,.cfdatepicker table tr td.selected.disabled.active,.cfdatepicker table tr td.selected.disabled.disabled,.cfdatepicker table tr td.selected.disabled.disabled.active,.cfdatepicker table tr td.selected.disabled.disabled:active,.cfdatepicker table tr td.selected.disabled.disabled:focus,.cfdatepicker table tr td.selected.disabled.disabled:hover,.cfdatepicker table tr td.selected.disabled:active,.cfdatepicker table tr td.selected.disabled:focus,.cfdatepicker table tr td.selected.disabled:hover,.cfdatepicker table tr td.selected.disabled:hover.disabled,.cfdatepicker table tr td.selected.disabled:hover.disabled.active,.cfdatepicker table tr td.selected.disabled:hover.disabled:active,.cfdatepicker table tr td.selected.disabled:hover.disabled:focus,.cfdatepicker table tr td.selected.disabled:hover.disabled:hover,.cfdatepicker table tr td.selected.disabled:hover[disabled],.cfdatepicker table tr td.selected.disabled:hover[disabled].active,.cfdatepicker table tr td.selected.disabled:hover[disabled]:active,.cfdatepicker table tr td.selected.disabled:hover[disabled]:focus,.cfdatepicker table tr td.selected.disabled:hover[disabled]:hover,.cfdatepicker table tr td.selected.disabled[disabled],.cfdatepicker table tr td.selected.disabled[disabled].active,.cfdatepicker table tr td.selected.disabled[disabled]:active,.cfdatepicker table tr td.selected.disabled[disabled]:focus,.cfdatepicker table tr td.selected.disabled[disabled]:hover,.cfdatepicker table tr td.selected:hover.disabled,.cfdatepicker table tr td.selected:hover.disabled.active,.cfdatepicker table tr td.selected:hover.disabled:active,.cfdatepicker table tr td.selected:hover.disabled:focus,.cfdatepicker table tr td.selected:hover.disabled:hover,.cfdatepicker table tr td.selected:hover[disabled],.cfdatepicker table tr td.selected:hover[disabled].active,.cfdatepicker table tr td.selected:hover[disabled]:active,.cfdatepicker table tr td.selected:hover[disabled]:focus,.cfdatepicker table tr td.selected:hover[disabled]:hover,.cfdatepicker table tr td.selected[disabled],.cfdatepicker table tr td.selected[disabled].active,.cfdatepicker table tr td.selected[disabled]:active,.cfdatepicker table tr td.selected[disabled]:focus,.cfdatepicker table tr td.selected[disabled]:hover,fieldset[disabled] .cfdatepicker table tr td.selected,fieldset[disabled] .cfdatepicker table tr td.selected.active,fieldset[disabled] .cfdatepicker table tr td.selected.disabled,fieldset[disabled] .cfdatepicker table tr td.selected.disabled.active,fieldset[disabled] .cfdatepicker table tr td.selected.disabled:active,fieldset[disabled] .cfdatepicker table tr td.selected.disabled:focus,fieldset[disabled] .cfdatepicker table tr td.selected.disabled:hover,fieldset[disabled] .cfdatepicker table tr td.selected.disabled:hover.active,fieldset[disabled] .cfdatepicker table tr td.selected.disabled:hover:active,fieldset[disabled] .cfdatepicker table tr td.selected.disabled:hover:focus,fieldset[disabled] .cfdatepicker table tr td.selected.disabled:hover:hover,fieldset[disabled] .cfdatepicker table tr td.selected:active,fieldset[disabled] .cfdatepicker table tr td.selected:focus,fieldset[disabled] .cfdatepicker table tr td.selected:hover,fieldset[disabled] .cfdatepicker table tr td.selected:hover.active,fieldset[disabled] .cfdatepicker table tr td.selected:hover:active,fieldset[disabled] .cfdatepicker table tr td.selected:hover:focus,fieldset[disabled] .cfdatepicker table tr td.selected:hover:hover{background-color:#999;border-color:#555}.cfdatepicker table tr td.active,.cfdatepicker table tr td.active.disabled,.cfdatepicker table tr td.active.disabled:hover,.cfdatepicker table tr td.active:hover{color:#fff;background-color:#428bca;border-color:#357ebd;text-shadow:0 -1px 0 rgba(0,0,0,.25)}.cfdatepicker table tr td.active.active,.cfdatepicker table tr td.active.disabled.active,.cfdatepicker table tr td.active.disabled:active,.cfdatepicker table tr td.active.disabled:focus,.cfdatepicker table tr td.active.disabled:hover,.cfdatepicker table tr td.active.disabled:hover.active,.cfdatepicker table tr td.active.disabled:hover:active,.cfdatepicker table tr td.active.disabled:hover:focus,.cfdatepicker table tr td.active.disabled:hover:hover,.cfdatepicker table tr td.active:active,.cfdatepicker table tr td.active:focus,.cfdatepicker table tr td.active:hover,.cfdatepicker table tr td.active:hover.active,.cfdatepicker table tr td.active:hover:active,.cfdatepicker table tr td.active:hover:focus,.cfdatepicker table tr td.active:hover:hover,.open .dropdown-toggle.cfdatepicker table tr td.active,.open .dropdown-toggle.cfdatepicker table tr td.active.disabled,.open .dropdown-toggle.cfdatepicker table tr td.active.disabled:hover,.open .dropdown-toggle.cfdatepicker table tr td.active:hover{color:#fff;background-color:#3276b1;border-color:#285e8e}.cfdatepicker table tr td.active.active,.cfdatepicker table tr td.active.disabled.active,.cfdatepicker table tr td.active.disabled:active,.cfdatepicker table tr td.active.disabled:hover.active,.cfdatepicker table tr td.active.disabled:hover:active,.cfdatepicker table tr td.active:active,.cfdatepicker table tr td.active:hover.active,.cfdatepicker table tr td.active:hover:active,.open .dropdown-toggle.cfdatepicker table tr td.active,.open .dropdown-toggle.cfdatepicker table tr td.active.disabled,.open .dropdown-toggle.cfdatepicker table tr td.active.disabled:hover,.open .dropdown-toggle.cfdatepicker table tr td.active:hover{background-image:none}.cfdatepicker table tr td.active.disabled,.cfdatepicker table tr td.active.disabled.active,.cfdatepicker table tr td.active.disabled.disabled,.cfdatepicker table tr td.active.disabled.disabled.active,.cfdatepicker table tr td.active.disabled.disabled:active,.cfdatepicker table tr td.active.disabled.disabled:focus,.cfdatepicker table tr td.active.disabled.disabled:hover,.cfdatepicker table tr td.active.disabled:active,.cfdatepicker table tr td.active.disabled:focus,.cfdatepicker table tr td.active.disabled:hover,.cfdatepicker table tr td.active.disabled:hover.disabled,.cfdatepicker table tr td.active.disabled:hover.disabled.active,.cfdatepicker table tr td.active.disabled:hover.disabled:active,.cfdatepicker table tr td.active.disabled:hover.disabled:focus,.cfdatepicker table tr td.active.disabled:hover.disabled:hover,.cfdatepicker table tr td.active.disabled:hover[disabled],.cfdatepicker table tr td.active.disabled:hover[disabled].active,.cfdatepicker table tr td.active.disabled:hover[disabled]:active,.cfdatepicker table tr td.active.disabled:hover[disabled]:focus,.cfdatepicker table tr td.active.disabled:hover[disabled]:hover,.cfdatepicker table tr td.active.disabled[disabled],.cfdatepicker table tr td.active.disabled[disabled].active,.cfdatepicker table tr td.active.disabled[disabled]:active,.cfdatepicker table tr td.active.disabled[disabled]:focus,.cfdatepicker table tr td.active.disabled[disabled]:hover,.cfdatepicker table tr td.active:hover.disabled,.cfdatepicker table tr td.active:hover.disabled.active,.cfdatepicker table tr td.active:hover.disabled:active,.cfdatepicker table tr td.active:hover.disabled:focus,.cfdatepicker table tr td.active:hover.disabled:hover,.cfdatepicker table tr td.active:hover[disabled],.cfdatepicker table tr td.active:hover[disabled].active,.cfdatepicker table tr td.active:hover[disabled]:active,.cfdatepicker table tr td.active:hover[disabled]:focus,.cfdatepicker table tr td.active:hover[disabled]:hover,.cfdatepicker table tr td.active[disabled],.cfdatepicker table tr td.active[disabled].active,.cfdatepicker table tr td.active[disabled]:active,.cfdatepicker table tr td.active[disabled]:focus,.cfdatepicker table tr td.active[disabled]:hover,fieldset[disabled] .cfdatepicker table tr td.active,fieldset[disabled] .cfdatepicker table tr td.active.active,fieldset[disabled] .cfdatepicker table tr td.active.disabled,fieldset[disabled] .cfdatepicker table tr td.active.disabled.active,fieldset[disabled] .cfdatepicker table tr td.active.disabled:active,fieldset[disabled] .cfdatepicker table tr td.active.disabled:focus,fieldset[disabled] .cfdatepicker table tr td.active.disabled:hover,fieldset[disabled] .cfdatepicker table tr td.active.disabled:hover.active,fieldset[disabled] .cfdatepicker table tr td.active.disabled:hover:active,fieldset[disabled] .cfdatepicker table tr td.active.disabled:hover:focus,fieldset[disabled] .cfdatepicker table tr td.active.disabled:hover:hover,fieldset[disabled] .cfdatepicker table tr td.active:active,fieldset[disabled] .cfdatepicker table tr td.active:focus,fieldset[disabled] .cfdatepicker table tr td.active:hover,fieldset[disabled] .cfdatepicker table tr td.active:hover.active,fieldset[disabled] .cfdatepicker table tr td.active:hover:active,fieldset[disabled] .cfdatepicker table tr td.active:hover:focus,fieldset[disabled] .cfdatepicker table tr td.active:hover:hover{background-color:#428bca;border-color:#357ebd}.cfdatepicker table tr td span{display:block;width:23%;height:54px;line-height:54px;float:left;margin:1%;cursor:pointer;border-radius:4px}.cfdatepicker table tr td span:hover{background:#eee}.cfdatepicker table tr td span.disabled,.cfdatepicker table tr td span.disabled:hover{background:0 0;color:#999;cursor:default}.cfdatepicker table tr td span.active,.cfdatepicker table tr td span.active.disabled,.cfdatepicker table tr td span.active.disabled:hover,.cfdatepicker table tr td span.active:hover{color:#fff;background-color:#428bca;border-color:#357ebd;text-shadow:0 -1px 0 rgba(0,0,0,.25)}.cfdatepicker table tr td span.active.active,.cfdatepicker table tr td span.active.disabled.active,.cfdatepicker table tr td span.active.disabled:active,.cfdatepicker table tr td span.active.disabled:focus,.cfdatepicker table tr td span.active.disabled:hover,.cfdatepicker table tr td span.active.disabled:hover.active,.cfdatepicker table tr td span.active.disabled:hover:active,.cfdatepicker table tr td span.active.disabled:hover:focus,.cfdatepicker table tr td span.active.disabled:hover:hover,.cfdatepicker table tr td span.active:active,.cfdatepicker table tr td span.active:focus,.cfdatepicker table tr td span.active:hover,.cfdatepicker table tr td span.active:hover.active,.cfdatepicker table tr td span.active:hover:active,.cfdatepicker table tr td span.active:hover:focus,.cfdatepicker table tr td span.active:hover:hover,.open .dropdown-toggle.cfdatepicker table tr td span.active,.open .dropdown-toggle.cfdatepicker table tr td span.active.disabled,.open .dropdown-toggle.cfdatepicker table tr td span.active.disabled:hover,.open .dropdown-toggle.cfdatepicker table tr td span.active:hover{color:#fff;background-color:#3276b1;border-color:#285e8e}.cfdatepicker table tr td span.active.active,.cfdatepicker table tr td span.active.disabled.active,.cfdatepicker table tr td span.active.disabled:active,.cfdatepicker table tr td span.active.disabled:hover.active,.cfdatepicker table tr td span.active.disabled:hover:active,.cfdatepicker table tr td span.active:active,.cfdatepicker table tr td span.active:hover.active,.cfdatepicker table tr td span.active:hover:active,.open .dropdown-toggle.cfdatepicker table tr td span.active,.open .dropdown-toggle.cfdatepicker table tr td span.active.disabled,.open .dropdown-toggle.cfdatepicker table tr td span.active.disabled:hover,.open .dropdown-toggle.cfdatepicker table tr td span.active:hover{background-image:none}.cfdatepicker table tr td span.active.disabled,.cfdatepicker table tr td span.active.disabled.active,.cfdatepicker table tr td span.active.disabled.disabled,.cfdatepicker table tr td span.active.disabled.disabled.active,.cfdatepicker table tr td span.active.disabled.disabled:active,.cfdatepicker table tr td span.active.disabled.disabled:focus,.cfdatepicker table tr td span.active.disabled.disabled:hover,.cfdatepicker table tr td span.active.disabled:active,.cfdatepicker table tr td span.active.disabled:focus,.cfdatepicker table tr td span.active.disabled:hover,.cfdatepicker table tr td span.active.disabled:hover.disabled,.cfdatepicker table tr td span.active.disabled:hover.disabled.active,.cfdatepicker table tr td span.active.disabled:hover.disabled:active,.cfdatepicker table tr td span.active.disabled:hover.disabled:focus,.cfdatepicker table tr td span.active.disabled:hover.disabled:hover,.cfdatepicker table tr td span.active.disabled:hover[disabled],.cfdatepicker table tr td span.active.disabled:hover[disabled].active,.cfdatepicker table tr td span.active.disabled:hover[disabled]:active,.cfdatepicker table tr td span.active.disabled:hover[disabled]:focus,.cfdatepicker table tr td span.active.disabled:hover[disabled]:hover,.cfdatepicker table tr td span.active.disabled[disabled],.cfdatepicker table tr td span.active.disabled[disabled].active,.cfdatepicker table tr td span.active.disabled[disabled]:active,.cfdatepicker table tr td span.active.disabled[disabled]:focus,.cfdatepicker table tr td span.active.disabled[disabled]:hover,.cfdatepicker table tr td span.active:hover.disabled,.cfdatepicker table tr td span.active:hover.disabled.active,.cfdatepicker table tr td span.active:hover.disabled:active,.cfdatepicker table tr td span.active:hover.disabled:focus,.cfdatepicker table tr td span.active:hover.disabled:hover,.cfdatepicker table tr td span.active:hover[disabled],.cfdatepicker table tr td span.active:hover[disabled].active,.cfdatepicker table tr td span.active:hover[disabled]:active,.cfdatepicker table tr td span.active:hover[disabled]:focus,.cfdatepicker table tr td span.active:hover[disabled]:hover,.cfdatepicker table tr td span.active[disabled],.cfdatepicker table tr td span.active[disabled].active,.cfdatepicker table tr td span.active[disabled]:active,.cfdatepicker table tr td span.active[disabled]:focus,.cfdatepicker table tr td span.active[disabled]:hover,fieldset[disabled] .cfdatepicker table tr td span.active,fieldset[disabled] .cfdatepicker table tr td span.active.active,fieldset[disabled] .cfdatepicker table tr td span.active.disabled,fieldset[disabled] .cfdatepicker table tr td span.active.disabled.active,fieldset[disabled] .cfdatepicker table tr td span.active.disabled:active,fieldset[disabled] .cfdatepicker table tr td span.active.disabled:focus,fieldset[disabled] .cfdatepicker table tr td span.active.disabled:hover,fieldset[disabled] .cfdatepicker table tr td span.active.disabled:hover.active,fieldset[disabled] .cfdatepicker table tr td span.active.disabled:hover:active,fieldset[disabled] .cfdatepicker table tr td span.active.disabled:hover:focus,fieldset[disabled] .cfdatepicker table tr td span.active.disabled:hover:hover,fieldset[disabled] .cfdatepicker table tr td span.active:active,fieldset[disabled] .cfdatepicker table tr td span.active:focus,fieldset[disabled] .cfdatepicker table tr td span.active:hover,fieldset[disabled] .cfdatepicker table tr td span.active:hover.active,fieldset[disabled] .cfdatepicker table tr td span.active:hover:active,fieldset[disabled] .cfdatepicker table tr td span.active:hover:focus,fieldset[disabled] .cfdatepicker table tr td span.active:hover:hover{background-color:#428bca;border-color:#357ebd}.cfdatepicker table tr td span.new,.cfdatepicker table tr td span.old{color:#999}.cfdatepicker th.cfdatepicker-switch{width:145px}.cfdatepicker tfoot tr th,.cfdatepicker thead tr:first-child th{cursor:pointer}.cfdatepicker tfoot tr th:hover,.cfdatepicker thead tr:first-child th:hover{background:#eee}.cfdatepicker .cw{font-size:10px;width:12px;padding:0 2px 0 5px;vertical-align:middle}.cfdatepicker thead tr:first-child th.cw{cursor:default;background-color:transparent}.input-group.date .input-group-addon i{cursor:pointer;width:16px;height:16px}.input-daterange input{text-align:center}.input-daterange input:first-child{border-radius:3px 0 0 3px}.input-daterange input:last-child{border-radius:0 3px 3px 0}.input-daterange .input-group-addon{width:auto;min-width:16px;padding:4px 5px;font-weight:400;line-height:1.42857143;text-align:center;text-shadow:0 1px 0 #fff;vertical-align:middle;background-color:#eee;border:solid #ccc;border-width:1px 0;margin-left:-5px;margin-right:-5px}.cfdatepicker.dropdown-menu{position:absolute;top:100%;left:0;z-index:1000;float:left;display:none;min-width:160px;list-style:none;background-color:#fff;border:1px solid #ccc;border:1px solid rgba(0,0,0,.2);border-radius:5px;-webkit-box-shadow:0 5px 10px rgba(0,0,0,.2);-moz-box-shadow:0 5px 10px rgba(0,0,0,.2);box-shadow:0 5px 10px rgba(0,0,0,.2);-webkit-background-clip:padding-box;-moz-background-clip:padding;background-clip:padding-box;color:#333;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:13px;line-height:1.42857143}.cfdatepicker.dropdown-menu td,.cfdatepicker.dropdown-menu th{padding:4px 5px}.image-thumb{margin-left:63px;padding:6px 0 6px 6px}.image-picker-content.image-thumb-lrg{margin-bottom:6px}.image-picker-side-bar{float:left;margin-left:-68px;width:62px}.image-thumb-lrg .image-picker-side-bar{background:#F6F6F6;border:1px solid #DFDFDF;float:none;margin:0 0 6px;padding:6px 6px 2px;text-align:center;width:auto}.image-picker-side-bar>img{border:1px solid #DFDFDF;width:62px}.image-thumb-lrg .image-picker-side-bar>img{-moz-box-sizing:border-box;box-sizing:border-box;max-width:100%;text-align:center;width:auto}.image-thumb .image-picker-main-content{margin-right:6px}.button.image-picker-button{margin:7px 0 0;width:110px;display:inline-block}.button.button-primary.image-picker-button{float:right;margin-left:6px;width:80px}.image-picker-main-content select{width:100%}.image-picker-sizer:disabled{opacity:.7;box-shadow:none;color:#A1A1A1}.button-primary.image-picker-button.image-picker-button-solo,.button.image-picker-button.image-picker-button-solo{width:170px;margin-top:0}.button-primary.image-picker-button.image-picker-button-solo{margin-top:7px;margin-left:0;float:none}.image-thumb-lrg .button.image-picker-button.cu-image-picker.image-picker-button-solo{width:120px}.image-thumb-lrg .button.button-primary.image-picker-button.cu-image-remover.image-picker-button-solo{float:right;margin:0 0 0 6px;width:auto}.image-thumb-lrg .button.button-primary.image-picker-button.cu-image-remover{width:45%}.image-picker-side-bar{max-width:100%}input.cu-image-picker-file-select[type=file]{display:none}.rangeslider,.rangeslider__fill{background:#e6e6e6;display:block;height:8px;width:100%;-webkit-border-radius:10px;-moz-border-radius:10px;-ms-border-radius:10px;-o-border-radius:10px;border-radius:10px}.rangeslider{position:relative}.rangeslider--disabled{filter:alpha(Opacity=40);opacity:.4}.rangeslider__fill{background:#0f0;position:absolute;top:0}.rangeslider__handle{background:#fff;border:1px solid #ccc;cursor:pointer;display:inline-block;width:18px;height:18px;position:absolute;top:-5px;-webkit-border-radius:50%;-moz-border-radius:50%;-ms-border-radius:50%;-o-border-radius:50%;border-radius:50%}input[type=range]:focus+.rangeslider .rangeslider__handle{-webkit-box-shadow:0 0 3px rgba(100,100,100,.9);-moz-box-shadow:0 0 3px rgba(100,100,100,.9);box-shadow:0 0 3px rgba(100,100,100,.9)}.recaptchatable #recaptcha_response_field{height:21px!important}.toggle_option_row{margin:4px 0}.toggle_option_row input{display:inline-block}.toggle_option_row .dashicons-sort{cursor:move}.toggle_option_row .toggle_label_field,.toggle_option_row .toggle_value_field{width:136px;line-height:20px}.toggle_option_preview .button{border-radius:0;margin-right:-5px}.toggle_option_preview .button:first-child{border-radius:3px 0 0 3px}.toggle_option_preview .button:last-child{border-radius:0 3px 3px 0}.toggle_option_preview.toggle_vertical .button{width:100%}.toggle_option_preview.toggle_vertical .button:first-child{border-radius:3px 3px 0 0}.toggle_option_preview.toggle_vertical .button:last-child{border-radius:0 0 3px 3px}.cf-toggle-switch html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}.cf-toggle-switch body{margin:0}.cf-toggle-switch article,.cf-toggle-switch aside,.cf-toggle-switch details,.cf-toggle-switch figcaption,.cf-toggle-switch figure,.cf-toggle-switch footer,.cf-toggle-switch header,.cf-toggle-switch hgroup,.cf-toggle-switch main,.cf-toggle-switch nav,.cf-toggle-switch section,.cf-toggle-switch summary{display:block}.cf-toggle-switch audio,.cf-toggle-switch canvas,.cf-toggle-switch progress,.cf-toggle-switch video{display:inline-block;vertical-align:baseline}.cf-toggle-switch audio:not([controls]){display:none;height:0}.cf-toggle-switch [hidden],.cf-toggle-switch template{display:none}.cf-toggle-switch a{background:0 0}.cf-toggle-switch a:active,.cf-toggle-switch a:hover{outline:0}.cf-toggle-switch abbr[title]{border-bottom:1px dotted}.cf-toggle-switch b,.cf-toggle-switch strong{font-weight:700}.cf-toggle-switch dfn{font-style:italic}.cf-toggle-switch h1{font-size:2em;margin:.67em 0}.cf-toggle-switch mark{background:#ff0;color:#000}.cf-toggle-switch small{font-size:80%}.cf-toggle-switch sub,.cf-toggle-switch sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}.cf-toggle-switch sup{top:-.5em}.cf-toggle-switch sub{bottom:-.25em}.cf-toggle-switch img{border:0}.cf-toggle-switch svg:not(:root){overflow:hidden}.cf-toggle-switch figure{margin:1em 40px}.cf-toggle-switch hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0}.cf-toggle-switch pre{overflow:auto}.cf-toggle-switch code,.cf-toggle-switch kbd,.cf-toggle-switch pre,.cf-toggle-switch samp{font-family:monospace,monospace;font-size:1em}.cf-toggle-switch button,.cf-toggle-switch input,.cf-toggle-switch optgroup,.cf-toggle-switch select,.cf-toggle-switch textarea{color:inherit;font:inherit;margin:0}.cf-toggle-switch button{overflow:visible}.cf-toggle-switch button,.cf-toggle-switch select{text-transform:none}.cf-toggle-switch button,.cf-toggle-switch html input[type=button],.cf-toggle-switch input[type=reset],.cf-toggle-switch input[type=submit]{-webkit-appearance:button;cursor:pointer}.cf-toggle-switch button[disabled],.cf-toggle-switch html input[disabled]{cursor:default}.cf-toggle-switch button::-moz-focus-inner,.cf-toggle-switch input::-moz-focus-inner{border:0;padding:0}.cf-toggle-switch input{line-height:normal}.cf-toggle-switch input[type=checkbox],.cf-toggle-switch input[type=radio]{box-sizing:border-box;padding:0}.cf-toggle-switch input[type=number]::-webkit-inner-spin-button,.cf-toggle-switch input[type=number]::-webkit-outer-spin-button{height:auto}.cf-toggle-switch input[type=search]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}.cf-toggle-switch input[type=search]::-webkit-search-cancel-button,.cf-toggle-switch input[type=search]::-webkit-search-decoration{-webkit-appearance:none}.cf-toggle-switch fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}.cf-toggle-switch legend{border:0;padding:0}.cf-toggle-switch textarea{overflow:auto}.cf-toggle-switch optgroup{font-weight:700}.cf-toggle-switch table{border-collapse:collapse;border-spacing:0}.cf-toggle-switch td,.cf-toggle-switch th{padding:0}.cf-toggle-switch .btn{display:inline-block;margin-bottom:0;font-weight:400;text-align:center;vertical-align:middle;cursor:pointer;background-image:none;border:1px solid transparent;white-space:nowrap;padding:6px 12px;font-size:14px;line-height:1.42857143;border-radius:4px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.cf-toggle-switch .btn.active:focus,.cf-toggle-switch .btn:active:focus,.cf-toggle-switch .btn:focus{outline:dotted thin;outline:-webkit-focus-ring-color auto 5px;outline-offset:-2px}.cf-toggle-switch .btn:focus,.cf-toggle-switch .btn:hover{color:#333;text-decoration:none}.cf-toggle-switch .btn.active,.cf-toggle-switch .btn:active{outline:0;background-image:none;-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.cf-toggle-switch .btn.disabled,.cf-toggle-switch .btn[disabled],.cf-toggle-switch fieldset[disabled] .btn{cursor:not-allowed;pointer-events:none;opacity:.65;filter:alpha(opacity=65);-webkit-box-shadow:none;box-shadow:none}.cf-toggle-switch .btn-default{color:#333;background-color:#fff;border-color:#ccc}.cf-toggle-switch .btn-default.active,.cf-toggle-switch .btn-default:active,.cf-toggle-switch .btn-default:focus,.cf-toggle-switch .btn-default:hover,.cf-toggle-switch .open .dropdown-toggle.btn-default{color:#333;background-color:#ebebeb;border-color:#adadad}.cf-toggle-switch .btn-default.active,.cf-toggle-switch .btn-default:active,.cf-toggle-switch .open .dropdown-toggle.btn-default{background-image:none}.cf-toggle-switch .btn-default.disabled,.cf-toggle-switch .btn-default.disabled.active,.cf-toggle-switch .btn-default.disabled:active,.cf-toggle-switch .btn-default.disabled:focus,.cf-toggle-switch .btn-default.disabled:hover,.cf-toggle-switch .btn-default[disabled],.cf-toggle-switch .btn-default[disabled].active,.cf-toggle-switch .btn-default[disabled]:active,.cf-toggle-switch .btn-default[disabled]:focus,.cf-toggle-switch .btn-default[disabled]:hover,.cf-toggle-switch fieldset[disabled] .btn-default,.cf-toggle-switch fieldset[disabled] .btn-default.active,.cf-toggle-switch fieldset[disabled] .btn-default:active,.cf-toggle-switch fieldset[disabled] .btn-default:focus,.cf-toggle-switch fieldset[disabled] .btn-default:hover{background-color:#fff;border-color:#ccc}.cf-toggle-switch .btn-default .badge{color:#fff;background-color:#333}.cf-toggle-switch .btn-primary{color:#fff;background-color:#428bca;border-color:#357ebd}.cf-toggle-switch .btn-primary.active,.cf-toggle-switch .btn-primary:active,.cf-toggle-switch .btn-primary:focus,.cf-toggle-switch .btn-primary:hover,.cf-toggle-switch .open .dropdown-toggle.btn-primary{color:#fff;background-color:#3276b1;border-color:#285e8e}.cf-toggle-switch .btn-primary.active,.cf-toggle-switch .btn-primary:active,.cf-toggle-switch .open .dropdown-toggle.btn-primary{background-image:none}.cf-toggle-switch .btn-primary.disabled,.cf-toggle-switch .btn-primary.disabled.active,.cf-toggle-switch .btn-primary.disabled:active,.cf-toggle-switch .btn-primary.disabled:focus,.cf-toggle-switch .btn-primary.disabled:hover,.cf-toggle-switch .btn-primary[disabled],.cf-toggle-switch .btn-primary[disabled].active,.cf-toggle-switch .btn-primary[disabled]:active,.cf-toggle-switch .btn-primary[disabled]:focus,.cf-toggle-switch .btn-primary[disabled]:hover,.cf-toggle-switch fieldset[disabled] .btn-primary,.cf-toggle-switch fieldset[disabled] .btn-primary.active,.cf-toggle-switch fieldset[disabled] .btn-primary:active,.cf-toggle-switch fieldset[disabled] .btn-primary:focus,.cf-toggle-switch fieldset[disabled] .btn-primary:hover{background-color:#428bca;border-color:#357ebd}.cf-toggle-switch .btn-primary .badge{color:#428bca;background-color:#fff}.cf-toggle-switch .btn-success{color:#fff;background-color:#5cb85c;border-color:#4cae4c}.cf-toggle-switch .btn-success.active,.cf-toggle-switch .btn-success:active,.cf-toggle-switch .btn-success:focus,.cf-toggle-switch .btn-success:hover,.cf-toggle-switch .open .dropdown-toggle.btn-success{color:#fff;background-color:#47a447;border-color:#398439}.cf-toggle-switch .btn-success.active,.cf-toggle-switch .btn-success:active,.cf-toggle-switch .open .dropdown-toggle.btn-success{background-image:none}.cf-toggle-switch .btn-success.disabled,.cf-toggle-switch .btn-success.disabled.active,.cf-toggle-switch .btn-success.disabled:active,.cf-toggle-switch .btn-success.disabled:focus,.cf-toggle-switch .btn-success.disabled:hover,.cf-toggle-switch .btn-success[disabled],.cf-toggle-switch .btn-success[disabled].active,.cf-toggle-switch .btn-success[disabled]:active,.cf-toggle-switch .btn-success[disabled]:focus,.cf-toggle-switch .btn-success[disabled]:hover,.cf-toggle-switch fieldset[disabled] .btn-success,.cf-toggle-switch fieldset[disabled] .btn-success.active,.cf-toggle-switch fieldset[disabled] .btn-success:active,.cf-toggle-switch fieldset[disabled] .btn-success:focus,.cf-toggle-switch fieldset[disabled] .btn-success:hover{background-color:#5cb85c;border-color:#4cae4c}.cf-toggle-switch .btn-success .badge{color:#5cb85c;background-color:#fff}.cf-toggle-switch .btn-info{color:#fff;background-color:#5bc0de;border-color:#46b8da}.cf-toggle-switch .btn-info.active,.cf-toggle-switch .btn-info:active,.cf-toggle-switch .btn-info:focus,.cf-toggle-switch .btn-info:hover,.cf-toggle-switch .open .dropdown-toggle.btn-info{color:#fff;background-color:#39b3d7;border-color:#269abc}.cf-toggle-switch .btn-info.active,.cf-toggle-switch .btn-info:active,.cf-toggle-switch .open .dropdown-toggle.btn-info{background-image:none}.cf-toggle-switch .btn-info.disabled,.cf-toggle-switch .btn-info.disabled.active,.cf-toggle-switch .btn-info.disabled:active,.cf-toggle-switch .btn-info.disabled:focus,.cf-toggle-switch .btn-info.disabled:hover,.cf-toggle-switch .btn-info[disabled],.cf-toggle-switch .btn-info[disabled].active,.cf-toggle-switch .btn-info[disabled]:active,.cf-toggle-switch .btn-info[disabled]:focus,.cf-toggle-switch .btn-info[disabled]:hover,.cf-toggle-switch fieldset[disabled] .btn-info,.cf-toggle-switch fieldset[disabled] .btn-info.active,.cf-toggle-switch fieldset[disabled] .btn-info:active,.cf-toggle-switch fieldset[disabled] .btn-info:focus,.cf-toggle-switch fieldset[disabled] .btn-info:hover{background-color:#5bc0de;border-color:#46b8da}.cf-toggle-switch .btn-info .badge{color:#5bc0de;background-color:#fff}.cf-toggle-switch .btn-warning{color:#fff;background-color:#f0ad4e;border-color:#eea236}.cf-toggle-switch .btn-warning.active,.cf-toggle-switch .btn-warning:active,.cf-toggle-switch .btn-warning:focus,.cf-toggle-switch .btn-warning:hover,.cf-toggle-switch .open .dropdown-toggle.btn-warning{color:#fff;background-color:#ed9c28;border-color:#d58512}.cf-toggle-switch .btn-warning.active,.cf-toggle-switch .btn-warning:active,.cf-toggle-switch .open .dropdown-toggle.btn-warning{background-image:none}.cf-toggle-switch .btn-warning.disabled,.cf-toggle-switch .btn-warning.disabled.active,.cf-toggle-switch .btn-warning.disabled:active,.cf-toggle-switch .btn-warning.disabled:focus,.cf-toggle-switch .btn-warning.disabled:hover,.cf-toggle-switch .btn-warning[disabled],.cf-toggle-switch .btn-warning[disabled].active,.cf-toggle-switch .btn-warning[disabled]:active,.cf-toggle-switch .btn-warning[disabled]:focus,.cf-toggle-switch .btn-warning[disabled]:hover,.cf-toggle-switch fieldset[disabled] .btn-warning,.cf-toggle-switch fieldset[disabled] .btn-warning.active,.cf-toggle-switch fieldset[disabled] .btn-warning:active,.cf-toggle-switch fieldset[disabled] .btn-warning:focus,.cf-toggle-switch fieldset[disabled] .btn-warning:hover{background-color:#f0ad4e;border-color:#eea236}.cf-toggle-switch .btn-warning .badge{color:#f0ad4e;background-color:#fff}.cf-toggle-switch .btn-danger{color:#fff;background-color:#d9534f;border-color:#d43f3a}.cf-toggle-switch .btn-danger.active,.cf-toggle-switch .btn-danger:active,.cf-toggle-switch .btn-danger:focus,.cf-toggle-switch .btn-danger:hover,.cf-toggle-switch .open .dropdown-toggle.btn-danger{color:#fff;background-color:#d2322d;border-color:#ac2925}.cf-toggle-switch .btn-danger.active,.cf-toggle-switch .btn-danger:active,.cf-toggle-switch .open .dropdown-toggle.btn-danger{background-image:none}.cf-toggle-switch .btn-danger.disabled,.cf-toggle-switch .btn-danger.disabled.active,.cf-toggle-switch .btn-danger.disabled:active,.cf-toggle-switch .btn-danger.disabled:focus,.cf-toggle-switch .btn-danger.disabled:hover,.cf-toggle-switch .btn-danger[disabled],.cf-toggle-switch .btn-danger[disabled].active,.cf-toggle-switch .btn-danger[disabled]:active,.cf-toggle-switch .btn-danger[disabled]:focus,.cf-toggle-switch .btn-danger[disabled]:hover,.cf-toggle-switch fieldset[disabled] .btn-danger,.cf-toggle-switch fieldset[disabled] .btn-danger.active,.cf-toggle-switch fieldset[disabled] .btn-danger:active,.cf-toggle-switch fieldset[disabled] .btn-danger:focus,.cf-toggle-switch fieldset[disabled] .btn-danger:hover{background-color:#d9534f;border-color:#d43f3a}.cf-toggle-switch .btn-danger .badge{color:#d9534f;background-color:#fff}.cf-toggle-switch .btn-link{color:#428bca;font-weight:400;cursor:pointer;border-radius:0}.cf-toggle-switch .btn-link,.cf-toggle-switch .btn-link:active,.cf-toggle-switch .btn-link[disabled],.cf-toggle-switch fieldset[disabled] .btn-link{background-color:transparent;-webkit-box-shadow:none;box-shadow:none}.cf-toggle-switch .btn-link,.cf-toggle-switch .btn-link:active,.cf-toggle-switch .btn-link:focus,.cf-toggle-switch .btn-link:hover{border-color:transparent}.cf-toggle-switch .btn-link:focus,.cf-toggle-switch .btn-link:hover{color:#2a6496;text-decoration:underline;background-color:transparent}.cf-toggle-switch .btn-link[disabled]:focus,.cf-toggle-switch .btn-link[disabled]:hover,.cf-toggle-switch fieldset[disabled] .btn-link:focus,.cf-toggle-switch fieldset[disabled] .btn-link:hover{color:#999;text-decoration:none}.cf-toggle-switch .btn-group-lg>.btn,.cf-toggle-switch .btn-lg{padding:10px 16px;font-size:18px;line-height:1.33;border-radius:6px}.cf-toggle-switch .btn-group-sm>.btn,.cf-toggle-switch .btn-sm{padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}.cf-toggle-switch .btn-group-xs>.btn,.cf-toggle-switch .btn-xs{padding:1px 5px;font-size:12px;line-height:1.5;border-radius:3px}.cf-toggle-switch .btn-block{display:block;width:100%;padding-left:0;padding-right:0}.cf-toggle-switch .btn-block+.btn-block{margin-top:5px}.cf-toggle-switch input[type=button].btn-block,.cf-toggle-switch input[type=reset].btn-block,.cf-toggle-switch input[type=submit].btn-block{width:100%}.cf-toggle-switch .btn-group,.cf-toggle-switch .btn-group-vertical{position:relative;display:inline-block;vertical-align:middle}.cf-toggle-switch .btn-group-vertical>.btn,.cf-toggle-switch .btn-group>.btn{position:relative;float:left}.cf-toggle-switch .btn-group-vertical>.btn.active,.cf-toggle-switch .btn-group-vertical>.btn:active,.cf-toggle-switch .btn-group-vertical>.btn:focus,.cf-toggle-switch .btn-group-vertical>.btn:hover,.cf-toggle-switch .btn-group>.btn.active,.cf-toggle-switch .btn-group>.btn:active,.cf-toggle-switch .btn-group>.btn:focus,.cf-toggle-switch .btn-group>.btn:hover{z-index:2}.cf-toggle-switch .btn-group-vertical>.btn:focus,.cf-toggle-switch .btn-group>.btn:focus{outline:0}.cf-toggle-switch .btn-group .btn+.btn,.cf-toggle-switch .btn-group .btn+.btn-group,.cf-toggle-switch .btn-group .btn-group+.btn,.cf-toggle-switch .btn-group .btn-group+.btn-group{margin-left:-1px}.cf-toggle-switch .btn-toolbar{margin-left:-5px}.cf-toggle-switch .btn-toolbar .btn-group,.cf-toggle-switch .btn-toolbar .input-group{float:left}.cf-toggle-switch .btn-toolbar>.btn,.cf-toggle-switch .btn-toolbar>.btn-group,.cf-toggle-switch .btn-toolbar>.input-group{margin-left:5px}.cf-toggle-switch .btn-group>.btn:not(:first-child):not(:last-child):not(.dropdown-toggle){border-radius:0}.cf-toggle-switch .btn-group>.btn:first-child{margin-left:0}.cf-toggle-switch .btn-group>.btn:first-child:not(:last-child):not(.dropdown-toggle){border-bottom-right-radius:0;border-top-right-radius:0}.cf-toggle-switch .btn-group>.btn:last-child:not(:first-child),.cf-toggle-switch .btn-group>.dropdown-toggle:not(:first-child){border-bottom-left-radius:0;border-top-left-radius:0}.cf-toggle-switch .btn-group>.btn-group{float:left}.cf-toggle-switch .btn-group>.btn-group:not(:first-child):not(:last-child)>.btn{border-radius:0}.cf-toggle-switch .btn-group>.btn-group:first-child>.btn:last-child,.cf-toggle-switch .btn-group>.btn-group:first-child>.dropdown-toggle{border-bottom-right-radius:0;border-top-right-radius:0}.cf-toggle-switch .btn-group>.btn-group:last-child>.btn:first-child{border-bottom-left-radius:0;border-top-left-radius:0}.cf-toggle-switch .btn-group .dropdown-toggle:active,.cf-toggle-switch .btn-group.open .dropdown-toggle{outline:0}.cf-toggle-switch .btn-group>.btn+.dropdown-toggle{padding-left:8px;padding-right:8px}.cf-toggle-switch .btn-group>.btn-lg+.dropdown-toggle{padding-left:12px;padding-right:12px}.cf-toggle-switch .btn-group.open .dropdown-toggle{-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.cf-toggle-switch .btn-group.open .dropdown-toggle.btn-link{-webkit-box-shadow:none;box-shadow:none}.cf-toggle-switch .btn .caret{margin-left:0}.cf-toggle-switch .btn-lg .caret{border-width:5px 5px 0}.cf-toggle-switch .dropup .btn-lg .caret{border-width:0 5px 5px}.cf-toggle-switch .btn-group-vertical>.btn,.cf-toggle-switch .btn-group-vertical>.btn-group,.cf-toggle-switch .btn-group-vertical>.btn-group>.btn{display:block;float:none;width:100%;max-width:100%}.cf-toggle-switch .btn-group-vertical>.btn-group>.btn{float:none}.cf-toggle-switch .btn-group-vertical>.btn+.btn,.cf-toggle-switch .btn-group-vertical>.btn+.btn-group,.cf-toggle-switch .btn-group-vertical>.btn-group+.btn,.cf-toggle-switch .btn-group-vertical>.btn-group+.btn-group{margin-top:-1px;margin-left:0}.cf-toggle-switch .btn-group-vertical>.btn:not(:first-child):not(:last-child){border-radius:0}.cf-toggle-switch .btn-group-vertical>.btn:first-child:not(:last-child){border-top-right-radius:4px;border-bottom-right-radius:0;border-bottom-left-radius:0}.cf-toggle-switch .btn-group-vertical>.btn:last-child:not(:first-child){border-bottom-left-radius:4px;border-top-right-radius:0;border-top-left-radius:0}.cf-toggle-switch .btn-group-vertical>.btn-group:not(:first-child):not(:last-child)>.btn{border-radius:0}.cf-toggle-switch .btn-group-vertical>.btn-group:first-child:not(:last-child)>.btn:last-child,.cf-toggle-switch .btn-group-vertical>.btn-group:first-child:not(:last-child)>.dropdown-toggle{border-bottom-right-radius:0;border-bottom-left-radius:0}.cf-toggle-switch .btn-group-vertical>.btn-group:last-child:not(:first-child)>.btn:first-child{border-top-right-radius:0;border-top-left-radius:0}.cf-toggle-switch .btn-group-justified{display:table;width:100%;table-layout:fixed;border-collapse:separate}.cf-toggle-switch .btn-group-justified>.btn,.cf-toggle-switch .btn-group-justified>.btn-group{float:none;display:table-cell;width:1%}.cf-toggle-switch .btn-group-justified>.btn-group .btn{width:100%}.cf-toggle-switch [data-toggle=buttons]>.btn>input[type=checkbox],.cf-toggle-switch [data-toggle=buttons]>.btn>input[type=radio]{display:none}.cf-toggle-switch .btn-group-vertical>.btn-group:after,.cf-toggle-switch .btn-group-vertical>.btn-group:before,.cf-toggle-switch .btn-toolbar:after,.cf-toggle-switch .btn-toolbar:before,.cf-toggle-switch .clearfix:after,.cf-toggle-switch .clearfix:before{content:" ";display:table}.cf-toggle-switch .btn-group-vertical>.btn-group:after,.cf-toggle-switch .btn-toolbar:after,.cf-toggle-switch .clearfix:after{clear:both}.cf-toggle-switch .center-block{display:block;margin-left:auto;margin-right:auto}.cf-toggle-switch .pull-right{float:right!important}.cf-toggle-switch .pull-left{float:left!important}.cf-toggle-switch .hide{display:none!important}.cf-toggle-switch .show{display:block!important}.cf-toggle-switch .invisible{visibility:hidden}.cf-toggle-switch .text-hide{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0}.cf-toggle-switch .hidden{display:none!important;visibility:hidden!important}.cf-toggle-switch .affix{position:fixed}@-ms-viewport{width:device-width}.cf-toggle-switch .visible-lg,.cf-toggle-switch .visible-md,.cf-toggle-switch .visible-print,.cf-toggle-switch .visible-sm,.cf-toggle-switch .visible-xs{display:none!important}@media (max-width:767px){.cf-toggle-switch .visible-xs{display:block!important}.cf-toggle-switch table.visible-xs{display:table}.cf-toggle-switch tr.visible-xs{display:table-row!important}.cf-toggle-switch td.visible-xs,.cf-toggle-switch th.visible-xs{display:table-cell!important}}@media (min-width:768px) and (max-width:991px){.cf-toggle-switch .visible-sm{display:block!important}.cf-toggle-switch table.visible-sm{display:table}.cf-toggle-switch tr.visible-sm{display:table-row!important}.cf-toggle-switch td.visible-sm,.cf-toggle-switch th.visible-sm{display:table-cell!important}}@media (min-width:992px) and (max-width:1199px){.cf-toggle-switch .visible-md{display:block!important}.cf-toggle-switch table.visible-md{display:table}.cf-toggle-switch tr.visible-md{display:table-row!important}.cf-toggle-switch td.visible-md,.cf-toggle-switch th.visible-md{display:table-cell!important}}@media (min-width:1200px){.cf-toggle-switch .visible-lg{display:block!important}.cf-toggle-switch table.visible-lg{display:table}.cf-toggle-switch tr.visible-lg{display:table-row!important}.cf-toggle-switch td.visible-lg,.cf-toggle-switch th.visible-lg{display:table-cell!important}}@media (max-width:767px){.cf-toggle-switch .hidden-xs{display:none!important}}@media (min-width:768px) and (max-width:991px){.cf-toggle-switch .hidden-sm{display:none!important}}@media (min-width:992px) and (max-width:1199px){.cf-toggle-switch .hidden-md{display:none!important}}@media (min-width:1200px){.cf-toggle-switch .hidden-lg{display:none!important}}@media print{.cf-toggle-switch .visible-print{display:block!important}.cf-toggle-switch table.visible-print{display:table}.cf-toggle-switch tr.visible-print{display:table-row!important}.cf-toggle-switch td.visible-print,.cf-toggle-switch th.visible-print{display:table-cell!important}}@media print{.cf-toggle-switch .hidden-print{display:none!important}}.cf-toggle-group-buttons{width:100%;clear:both}
|
3 |
-
input.form-control.parsley-success,select.form-control.parsley-success,textarea.form-control.parsley-success{color:#468847;background-color:#DFF0D8;border
|
4 |
.breadcrumb a.has-error{color:#ff0000;}
|
5 |
.form-group .parsley-errors-list.filled,.form-group .parsley-errors-list.filled .parsley-type {
|
6 |
list-style: outside none none;
|
7 |
list-style-type: none;
|
8 |
}
|
|
|
9 |
.caldera-grid .cf-multi-uploader-list > ul {
|
10 |
list-style: outside none none;
|
11 |
margin: 0 0 12px;
|
@@ -17,3 +18,42 @@ input.form-control.parsley-success,select.form-control.parsley-success,textarea.
|
|
17 |
position: relative;
|
18 |
clear: both;
|
19 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
@font-face{font-family:cf-raty;src:url(fonts/cf-raty.eot?40481674);src:url(fonts/cf-raty.eot?40481674#iefix) format('embedded-opentype'),url(fonts/cf-raty.woff?40481674) format('woff'),url(fonts/cf-raty.ttf?40481674) format('truetype'),url(fonts/cf-raty.svg?40481674#cf-raty) format('svg');font-weight:400;font-style:normal}[class*=" raty-"]:before,[class^=raty-]:before{font-family:cf-raty;font-style:normal;font-weight:400;speak:none;font-size:2em;display:inline-block;text-decoration:inherit;width:1em;text-align:center;font-variant:normal;text-transform:none;line-height:1em}.raty-heart-on:before{content:'\e800'}.raty-heart-off:before{content:'\e801'}.raty-star-on:before{content:'\e802'}.raty-star-off:before{content:'\e803'}.raty-circle-on:before{content:'\e804'}.raty-circle-off:before{content:'\e805'}.raty-dot-off:before{content:'\e806'}.raty-dot-on:before{content:'\e807'}.raty-face-off:before{content:'\e808'}.raty-face-on:before{content:'\e809'}.raty-cancel-off:before{content:'\e80a'}.raty-cancel-on:before{content:'\e80b'}.calculation-group{background:#FFF;box-shadow:0 1px 2px rgba(0,0,0,.05);padding:6px;margin:6px 0}.preview-color-selector{background:#F0F0F0;border:1px solid #E2E2E2;display:inline;margin-left:-1px;padding:3px 12px;box-shadow:0 0 0 2px #fff inset}.miniColors-trigger{border:1px solid #999;-mz-border-radius:0 1px 1px 0;-webkit-border-radius:0 1px 1px 0;display:inline-block;height:24px;margin:0 0 -8px -1px;width:30px}.miniColors-selector{background:#FFF;border:1px solid #999;-moz-box-shadow:0 3px 0 -1px rgba(0,0,0,.05);-webkit-box-shadow:0 3px 0 -1px rgba(0,0,0,.05);box-shadow:0 3px 0 -1px rgba(0,0,0,.05);height:162px;padding:5px;position:absolute;width:187px;z-index:999999;margin-top:-1px}.miniColors-selector.black{background:#000;border-color:#000}.miniColors-colors{position:absolute;top:5px;left:5px;width:150px;height:150px;background:url(minicolor-colors.png) right no-repeat;cursor:crosshair}.miniColors-hues{position:absolute;top:5px;left:160px;width:20px;height:150px;background:url(minicolor-colors.png) left no-repeat;cursor:crosshair}.miniColors-colorPicker{position:absolute;width:9px;height:9px;border:1px solid #fff;-moz-border-radius:11px;-webkit-border-radius:11px;border-radius:11px}.miniColors-colorPicker-inner{position:absolute;top:0;left:0;width:7px;height:7px;border:1px solid #000;-moz-border-radius:9px;-webkit-border-radius:9px;border-radius:9px}.miniColors-huePicker{position:absolute;left:-3px;width:24px;height:1px;border:1px solid #fff;border-radius:2px;background:#000}.cf-color-picker .form-control::-moz-placeholder{color:#999;opacity:1}.cf-color-picker .form-control:-ms-input-placeholder{color:#999}.cf-color-picker .form-control::-webkit-input-placeholder{color:#999}.cf-color-picker .form-control[disabled],.cf-color-picker .form-control[readonly],.cf-color-picker fieldset[disabled] .form-control{cursor:not-allowed;background-color:#eee;opacity:1}.cf-color-picker .form-group{margin-bottom:15px}.cf-color-picker .input-group{position:relative;display:table;border-collapse:separate}.cf-color-picker .input-group[class*=col-]{float:none;padding-left:0;padding-right:0}.cf-color-picker .input-group .form-control{position:relative;z-index:2;float:left;width:100%;margin-bottom:0}.cf-color-picker .input-group-lg>.form-control,.cf-color-picker .input-group-lg>.input-group-addon,.cf-color-picker .input-group-lg>.input-group-btn>.btn{height:46px;padding:10px 16px;font-size:18px;line-height:1.33;border-radius:6px}.cf-color-picker .input-group-sm>.form-control,.cf-color-picker .input-group-sm>.input-group-addon,.cf-color-picker .input-group-sm>.input-group-btn>.btn{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}.cf-color-picker .input-group .form-control,.cf-color-picker .input-group-addon,.cf-color-picker .input-group-btn{display:table-cell}.cf-color-picker .input-group .form-control:not(:first-child):not(:last-child),.cf-color-picker .input-group-addon:not(:first-child):not(:last-child),.cf-color-picker .input-group-btn:not(:first-child):not(:last-child){border-radius:0}.cf-color-picker .input-group-addon,.cf-color-picker .input-group-btn{width:1%;white-space:nowrap;vertical-align:middle}.cf-color-picker .input-group-addon{padding:6px 12px;font-size:14px;font-weight:400;line-height:1;color:#555;text-align:center;background-color:#eee;border:1px solid #ccc;border-radius:4px}.cf-color-picker .input-group-addon.input-sm{padding:5px 10px;font-size:12px;border-radius:3px}.cf-color-picker .input-group-addon.input-lg{padding:10px 16px;font-size:18px;border-radius:6px}.cf-color-picker .input-group .form-control:first-child,.cf-color-picker .input-group-addon:first-child,.cf-color-picker .input-group-btn:first-child>.btn,.cf-color-picker .input-group-btn:first-child>.btn-group>.btn,.cf-color-picker .input-group-btn:first-child>.dropdown-toggle,.cf-color-picker .input-group-btn:last-child>.btn-group:not(:last-child)>.btn,.cf-color-picker .input-group-btn:last-child>.btn:not(:last-child):not(.dropdown-toggle){border-bottom-right-radius:0;border-top-right-radius:0}.cf-color-picker .input-group-addon:first-child{border-right:0}.cf-color-picker .input-group .form-control:last-child,.cf-color-picker .input-group-addon:last-child,.cf-color-picker .input-group-btn:first-child>.btn-group:not(:first-child)>.btn,.cf-color-picker .input-group-btn:first-child>.btn:not(:first-child),.cf-color-picker .input-group-btn:last-child>.btn,.cf-color-picker .input-group-btn:last-child>.btn-group>.btn,.cf-color-picker .input-group-btn:last-child>.dropdown-toggle{border-bottom-left-radius:0;border-top-left-radius:0}.cf-color-picker .input-group-addon:last-child{border-left:0}.cf-color-picker .input-group-btn{position:relative;font-size:0;white-space:nowrap}.cf-color-picker .input-group-btn>.btn{position:relative}.cf-color-picker .input-group-btn>.btn+.btn{margin-left:-1px}.cf-color-picker .input-group-btn>.btn:active,.cf-color-picker .input-group-btn>.btn:focus,.cf-color-picker .input-group-btn>.btn:hover{z-index:2}.cf-color-picker .input-group-btn:first-child>.btn,.cf-color-picker .input-group-btn:first-child>.btn-group{margin-right:-1px}.cf-color-picker .input-group-btn:last-child>.btn,.cf-color-picker .input-group-btn:last-child>.btn-group{margin-left:-1px}.cf-color-picker .clearfix:after,.cf-color-picker .clearfix:before,.cf-color-picker .form-horizontal .form-group:after,.cf-color-picker .form-horizontal .form-group:before{content:" ";display:table}.cf-color-picker .clearfix:after,.cf-color-picker .form-horizontal .form-group:after{clear:both}.cf-color-picker .center-block{display:block;margin-left:auto;margin-right:auto}.cf-color-picker .pull-right{float:right!important}.cf-color-picker .pull-left{float:left!important}.cf-color-picker .hide{display:none!important}.cf-color-picker .show{display:block!important}.cf-color-picker .invisible{visibility:hidden}.cf-color-picker .text-hide{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0}.cf-color-picker .hidden{display:none!important;visibility:hidden!important}.cf-color-picker .affix{position:fixed}@-ms-viewport{width:device-width}.cf-color-picker .visible-lg,.cf-color-picker .visible-md,.cf-color-picker .visible-print,.cf-color-picker .visible-sm,.cf-color-picker .visible-xs{display:none!important}@media (max-width:767px){.cf-color-picker .visible-xs{display:block!important}.cf-color-picker table.visible-xs{display:table}.cf-color-picker tr.visible-xs{display:table-row!important}.cf-color-picker td.visible-xs,.cf-color-picker th.visible-xs{display:table-cell!important}}@media (min-width:768px) and (max-width:991px){.cf-color-picker .visible-sm{display:block!important}.cf-color-picker table.visible-sm{display:table}.cf-color-picker tr.visible-sm{display:table-row!important}.cf-color-picker td.visible-sm,.cf-color-picker th.visible-sm{display:table-cell!important}}@media (min-width:992px) and (max-width:1199px){.cf-color-picker .visible-md{display:block!important}.cf-color-picker table.visible-md{display:table}.cf-color-picker tr.visible-md{display:table-row!important}.cf-color-picker td.visible-md,.cf-color-picker th.visible-md{display:table-cell!important}}@media (min-width:1200px){.cf-color-picker .visible-lg{display:block!important}.cf-color-picker table.visible-lg{display:table}.cf-color-picker tr.visible-lg{display:table-row!important}.cf-color-picker td.visible-lg,.cf-color-picker th.visible-lg{display:table-cell!important}}@media (max-width:767px){.cf-color-picker .hidden-xs{display:none!important}}@media (min-width:768px) and (max-width:991px){.cf-color-picker .hidden-sm{display:none!important}}@media (min-width:992px) and (max-width:1199px){.cf-color-picker .hidden-md{display:none!important}}@media (min-width:1200px){.cf-color-picker .hidden-lg{display:none!important}}@media print{.cf-color-picker .visible-print{display:block!important}.cf-color-picker table.visible-print{display:table}.cf-color-picker tr.visible-print{display:table-row!important}.cf-color-picker td.visible-print,.cf-color-picker th.visible-print{display:table-cell!important}}@media print{.cf-color-picker .hidden-print{display:none!important}}.cf-color-picker .input-group{max-width:120px}
|
2 |
.cfdatepicker{padding:4px;border-radius:4px;direction:ltr}.cfdatepicker-inline{width:220px}.cfdatepicker.cfdatepicker-rtl{direction:rtl}.cfdatepicker.cfdatepicker-rtl table tr td span{float:right}.cfdatepicker-dropdown{top:0;left:0}.cfdatepicker-dropdown:before{content:'';display:inline-block;border-left:7px solid transparent;border-right:7px solid transparent;border-bottom:7px solid #ccc;border-top:0;border-bottom-color:rgba(0,0,0,.2);position:absolute}.cfdatepicker-dropdown:after{content:'';display:inline-block;border-left:6px solid transparent;border-right:6px solid transparent;border-bottom:6px solid #fff;border-top:0;position:absolute}.cfdatepicker-dropdown.cfdatepicker-orient-left:before{left:6px}.cfdatepicker-dropdown.cfdatepicker-orient-left:after{left:7px}.cfdatepicker-dropdown.cfdatepicker-orient-right:before{right:6px}.cfdatepicker-dropdown.cfdatepicker-orient-right:after{right:7px}.cfdatepicker-dropdown.cfdatepicker-orient-top:before{top:-7px}.cfdatepicker-dropdown.cfdatepicker-orient-top:after{top:-6px}.cfdatepicker-dropdown.cfdatepicker-orient-bottom:before{bottom:-7px;border-bottom:0;border-top:7px solid #999}.cfdatepicker-dropdown.cfdatepicker-orient-bottom:after{bottom:-6px;border-bottom:0;border-top:6px solid #fff}.cfdatepicker>div{display:none}.cfdatepicker.days div.cfdatepicker-days,.cfdatepicker.months div.cfdatepicker-months,.cfdatepicker.years div.cfdatepicker-years{display:block}.cfdatepicker table{border: 0 none;width: auto;margin:0;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.cfdatepicker table tr td,.cfdatepicker table tr th{text-align:center;width:10px;height:10px;border-radius:4px;border:none}.table-striped .cfdatepicker table tr td,.table-striped .cfdatepicker table tr th{background-color:transparent}.cfdatepicker table tr td.day.focused,.cfdatepicker table tr td.day:hover{background:#eee;cursor:pointer}.cfdatepicker table tr td.new,.cfdatepicker table tr td.old{color:#999}.cfdatepicker table tr td.disabled,.cfdatepicker table tr td.disabled:hover{background:0 0;color:#999;cursor:default}.cfdatepicker table tr td.today,.cfdatepicker table tr td.today.disabled,.cfdatepicker table tr td.today.disabled:hover,.cfdatepicker table tr td.today:hover{color:#000;background-color:#ffdb99;border-color:#ffb733}.cfdatepicker table tr td.today.active,.cfdatepicker table tr td.today.disabled.active,.cfdatepicker table tr td.today.disabled:active,.cfdatepicker table tr td.today.disabled:focus,.cfdatepicker table tr td.today.disabled:hover,.cfdatepicker table tr td.today.disabled:hover.active,.cfdatepicker table tr td.today.disabled:hover:active,.cfdatepicker table tr td.today.disabled:hover:focus,.cfdatepicker table tr td.today.disabled:hover:hover,.cfdatepicker table tr td.today:active,.cfdatepicker table tr td.today:focus,.cfdatepicker table tr td.today:hover,.cfdatepicker table tr td.today:hover.active,.cfdatepicker table tr td.today:hover:active,.cfdatepicker table tr td.today:hover:focus,.cfdatepicker table tr td.today:hover:hover,.open .dropdown-toggle.cfdatepicker table tr td.today,.open .dropdown-toggle.cfdatepicker table tr td.today.disabled,.open .dropdown-toggle.cfdatepicker table tr td.today.disabled:hover,.open .dropdown-toggle.cfdatepicker table tr td.today:hover{color:#000;background-color:#ffcd70;border-color:#f59e00}.cfdatepicker table tr td.today.active,.cfdatepicker table tr td.today.disabled.active,.cfdatepicker table tr td.today.disabled:active,.cfdatepicker table tr td.today.disabled:hover.active,.cfdatepicker table tr td.today.disabled:hover:active,.cfdatepicker table tr td.today:active,.cfdatepicker table tr td.today:hover.active,.cfdatepicker table tr td.today:hover:active,.open .dropdown-toggle.cfdatepicker table tr td.today,.open .dropdown-toggle.cfdatepicker table tr td.today.disabled,.open .dropdown-toggle.cfdatepicker table tr td.today.disabled:hover,.open .dropdown-toggle.cfdatepicker table tr td.today:hover{background-image:none}.cfdatepicker table tr td.today.disabled,.cfdatepicker table tr td.today.disabled.active,.cfdatepicker table tr td.today.disabled.disabled,.cfdatepicker table tr td.today.disabled.disabled.active,.cfdatepicker table tr td.today.disabled.disabled:active,.cfdatepicker table tr td.today.disabled.disabled:focus,.cfdatepicker table tr td.today.disabled.disabled:hover,.cfdatepicker table tr td.today.disabled:active,.cfdatepicker table tr td.today.disabled:focus,.cfdatepicker table tr td.today.disabled:hover,.cfdatepicker table tr td.today.disabled:hover.disabled,.cfdatepicker table tr td.today.disabled:hover.disabled.active,.cfdatepicker table tr td.today.disabled:hover.disabled:active,.cfdatepicker table tr td.today.disabled:hover.disabled:focus,.cfdatepicker table tr td.today.disabled:hover.disabled:hover,.cfdatepicker table tr td.today.disabled:hover[disabled],.cfdatepicker table tr td.today.disabled:hover[disabled].active,.cfdatepicker table tr td.today.disabled:hover[disabled]:active,.cfdatepicker table tr td.today.disabled:hover[disabled]:focus,.cfdatepicker table tr td.today.disabled:hover[disabled]:hover,.cfdatepicker table tr td.today.disabled[disabled],.cfdatepicker table tr td.today.disabled[disabled].active,.cfdatepicker table tr td.today.disabled[disabled]:active,.cfdatepicker table tr td.today.disabled[disabled]:focus,.cfdatepicker table tr td.today.disabled[disabled]:hover,.cfdatepicker table tr td.today:hover.disabled,.cfdatepicker table tr td.today:hover.disabled.active,.cfdatepicker table tr td.today:hover.disabled:active,.cfdatepicker table tr td.today:hover.disabled:focus,.cfdatepicker table tr td.today:hover.disabled:hover,.cfdatepicker table tr td.today:hover[disabled],.cfdatepicker table tr td.today:hover[disabled].active,.cfdatepicker table tr td.today:hover[disabled]:active,.cfdatepicker table tr td.today:hover[disabled]:focus,.cfdatepicker table tr td.today:hover[disabled]:hover,.cfdatepicker table tr td.today[disabled],.cfdatepicker table tr td.today[disabled].active,.cfdatepicker table tr td.today[disabled]:active,.cfdatepicker table tr td.today[disabled]:focus,.cfdatepicker table tr td.today[disabled]:hover,fieldset[disabled] .cfdatepicker table tr td.today,fieldset[disabled] .cfdatepicker table tr td.today.active,fieldset[disabled] .cfdatepicker table tr td.today.disabled,fieldset[disabled] .cfdatepicker table tr td.today.disabled.active,fieldset[disabled] .cfdatepicker table tr td.today.disabled:active,fieldset[disabled] .cfdatepicker table tr td.today.disabled:focus,fieldset[disabled] .cfdatepicker table tr td.today.disabled:hover,fieldset[disabled] .cfdatepicker table tr td.today.disabled:hover.active,fieldset[disabled] .cfdatepicker table tr td.today.disabled:hover:active,fieldset[disabled] .cfdatepicker table tr td.today.disabled:hover:focus,fieldset[disabled] .cfdatepicker table tr td.today.disabled:hover:hover,fieldset[disabled] .cfdatepicker table tr td.today:active,fieldset[disabled] .cfdatepicker table tr td.today:focus,fieldset[disabled] .cfdatepicker table tr td.today:hover,fieldset[disabled] .cfdatepicker table tr td.today:hover.active,fieldset[disabled] .cfdatepicker table tr td.today:hover:active,fieldset[disabled] .cfdatepicker table tr td.today:hover:focus,fieldset[disabled] .cfdatepicker table tr td.today:hover:hover{background-color:#ffdb99;border-color:#ffb733}.cfdatepicker table tr td.today:hover:hover{color:#000}.cfdatepicker table tr td.today.active:hover{color:#fff}.cfdatepicker table tr td.range,.cfdatepicker table tr td.range.disabled,.cfdatepicker table tr td.range.disabled:hover,.cfdatepicker table tr td.range:hover{background:#eee;border-radius:0}.cfdatepicker table tr td.range.today,.cfdatepicker table tr td.range.today.disabled,.cfdatepicker table tr td.range.today.disabled:hover,.cfdatepicker table tr td.range.today:hover{color:#000;background-color:#f7ca77;border-color:#f1a417;border-radius:0}.cfdatepicker table tr td.range.today.active,.cfdatepicker table tr td.range.today.disabled.active,.cfdatepicker table tr td.range.today.disabled:active,.cfdatepicker table tr td.range.today.disabled:focus,.cfdatepicker table tr td.range.today.disabled:hover,.cfdatepicker table tr td.range.today.disabled:hover.active,.cfdatepicker table tr td.range.today.disabled:hover:active,.cfdatepicker table tr td.range.today.disabled:hover:focus,.cfdatepicker table tr td.range.today.disabled:hover:hover,.cfdatepicker table tr td.range.today:active,.cfdatepicker table tr td.range.today:focus,.cfdatepicker table tr td.range.today:hover,.cfdatepicker table tr td.range.today:hover.active,.cfdatepicker table tr td.range.today:hover:active,.cfdatepicker table tr td.range.today:hover:focus,.cfdatepicker table tr td.range.today:hover:hover,.open .dropdown-toggle.cfdatepicker table tr td.range.today,.open .dropdown-toggle.cfdatepicker table tr td.range.today.disabled,.open .dropdown-toggle.cfdatepicker table tr td.range.today.disabled:hover,.open .dropdown-toggle.cfdatepicker table tr td.range.today:hover{color:#000;background-color:#f4bb51;border-color:#bf800c}.cfdatepicker table tr td.range.today.active,.cfdatepicker table tr td.range.today.disabled.active,.cfdatepicker table tr td.range.today.disabled:active,.cfdatepicker table tr td.range.today.disabled:hover.active,.cfdatepicker table tr td.range.today.disabled:hover:active,.cfdatepicker table tr td.range.today:active,.cfdatepicker table tr td.range.today:hover.active,.cfdatepicker table tr td.range.today:hover:active,.open .dropdown-toggle.cfdatepicker table tr td.range.today,.open .dropdown-toggle.cfdatepicker table tr td.range.today.disabled,.open .dropdown-toggle.cfdatepicker table tr td.range.today.disabled:hover,.open .dropdown-toggle.cfdatepicker table tr td.range.today:hover{background-image:none}.cfdatepicker table tr td.range.today.disabled,.cfdatepicker table tr td.range.today.disabled.active,.cfdatepicker table tr td.range.today.disabled.disabled,.cfdatepicker table tr td.range.today.disabled.disabled.active,.cfdatepicker table tr td.range.today.disabled.disabled:active,.cfdatepicker table tr td.range.today.disabled.disabled:focus,.cfdatepicker table tr td.range.today.disabled.disabled:hover,.cfdatepicker table tr td.range.today.disabled:active,.cfdatepicker table tr td.range.today.disabled:focus,.cfdatepicker table tr td.range.today.disabled:hover,.cfdatepicker table tr td.range.today.disabled:hover.disabled,.cfdatepicker table tr td.range.today.disabled:hover.disabled.active,.cfdatepicker table tr td.range.today.disabled:hover.disabled:active,.cfdatepicker table tr td.range.today.disabled:hover.disabled:focus,.cfdatepicker table tr td.range.today.disabled:hover.disabled:hover,.cfdatepicker table tr td.range.today.disabled:hover[disabled],.cfdatepicker table tr td.range.today.disabled:hover[disabled].active,.cfdatepicker table tr td.range.today.disabled:hover[disabled]:active,.cfdatepicker table tr td.range.today.disabled:hover[disabled]:focus,.cfdatepicker table tr td.range.today.disabled:hover[disabled]:hover,.cfdatepicker table tr td.range.today.disabled[disabled],.cfdatepicker table tr td.range.today.disabled[disabled].active,.cfdatepicker table tr td.range.today.disabled[disabled]:active,.cfdatepicker table tr td.range.today.disabled[disabled]:focus,.cfdatepicker table tr td.range.today.disabled[disabled]:hover,.cfdatepicker table tr td.range.today:hover.disabled,.cfdatepicker table tr td.range.today:hover.disabled.active,.cfdatepicker table tr td.range.today:hover.disabled:active,.cfdatepicker table tr td.range.today:hover.disabled:focus,.cfdatepicker table tr td.range.today:hover.disabled:hover,.cfdatepicker table tr td.range.today:hover[disabled],.cfdatepicker table tr td.range.today:hover[disabled].active,.cfdatepicker table tr td.range.today:hover[disabled]:active,.cfdatepicker table tr td.range.today:hover[disabled]:focus,.cfdatepicker table tr td.range.today:hover[disabled]:hover,.cfdatepicker table tr td.range.today[disabled],.cfdatepicker table tr td.range.today[disabled].active,.cfdatepicker table tr td.range.today[disabled]:active,.cfdatepicker table tr td.range.today[disabled]:focus,.cfdatepicker table tr td.range.today[disabled]:hover,fieldset[disabled] .cfdatepicker table tr td.range.today,fieldset[disabled] .cfdatepicker table tr td.range.today.active,fieldset[disabled] .cfdatepicker table tr td.range.today.disabled,fieldset[disabled] .cfdatepicker table tr td.range.today.disabled.active,fieldset[disabled] .cfdatepicker table tr td.range.today.disabled:active,fieldset[disabled] .cfdatepicker table tr td.range.today.disabled:focus,fieldset[disabled] .cfdatepicker table tr td.range.today.disabled:hover,fieldset[disabled] .cfdatepicker table tr td.range.today.disabled:hover.active,fieldset[disabled] .cfdatepicker table tr td.range.today.disabled:hover:active,fieldset[disabled] .cfdatepicker table tr td.range.today.disabled:hover:focus,fieldset[disabled] .cfdatepicker table tr td.range.today.disabled:hover:hover,fieldset[disabled] .cfdatepicker table tr td.range.today:active,fieldset[disabled] .cfdatepicker table tr td.range.today:focus,fieldset[disabled] .cfdatepicker table tr td.range.today:hover,fieldset[disabled] .cfdatepicker table tr td.range.today:hover.active,fieldset[disabled] .cfdatepicker table tr td.range.today:hover:active,fieldset[disabled] .cfdatepicker table tr td.range.today:hover:focus,fieldset[disabled] .cfdatepicker table tr td.range.today:hover:hover{background-color:#f7ca77;border-color:#f1a417}.cfdatepicker table tr td.selected,.cfdatepicker table tr td.selected.disabled,.cfdatepicker table tr td.selected.disabled:hover,.cfdatepicker table tr td.selected:hover{color:#fff;background-color:#999;border-color:#555;text-shadow:0 -1px 0 rgba(0,0,0,.25)}.cfdatepicker table tr td.selected.active,.cfdatepicker table tr td.selected.disabled.active,.cfdatepicker table tr td.selected.disabled:active,.cfdatepicker table tr td.selected.disabled:focus,.cfdatepicker table tr td.selected.disabled:hover,.cfdatepicker table tr td.selected.disabled:hover.active,.cfdatepicker table tr td.selected.disabled:hover:active,.cfdatepicker table tr td.selected.disabled:hover:focus,.cfdatepicker table tr td.selected.disabled:hover:hover,.cfdatepicker table tr td.selected:active,.cfdatepicker table tr td.selected:focus,.cfdatepicker table tr td.selected:hover,.cfdatepicker table tr td.selected:hover.active,.cfdatepicker table tr td.selected:hover:active,.cfdatepicker table tr td.selected:hover:focus,.cfdatepicker table tr td.selected:hover:hover,.open .dropdown-toggle.cfdatepicker table tr td.selected,.open .dropdown-toggle.cfdatepicker table tr td.selected.disabled,.open .dropdown-toggle.cfdatepicker table tr td.selected.disabled:hover,.open .dropdown-toggle.cfdatepicker table tr td.selected:hover{color:#fff;background-color:#858585;border-color:#373737}.cfdatepicker table tr td.selected.active,.cfdatepicker table tr td.selected.disabled.active,.cfdatepicker table tr td.selected.disabled:active,.cfdatepicker table tr td.selected.disabled:hover.active,.cfdatepicker table tr td.selected.disabled:hover:active,.cfdatepicker table tr td.selected:active,.cfdatepicker table tr td.selected:hover.active,.cfdatepicker table tr td.selected:hover:active,.open .dropdown-toggle.cfdatepicker table tr td.selected,.open .dropdown-toggle.cfdatepicker table tr td.selected.disabled,.open .dropdown-toggle.cfdatepicker table tr td.selected.disabled:hover,.open .dropdown-toggle.cfdatepicker table tr td.selected:hover{background-image:none}.cfdatepicker table tr td.selected.disabled,.cfdatepicker table tr td.selected.disabled.active,.cfdatepicker table tr td.selected.disabled.disabled,.cfdatepicker table tr td.selected.disabled.disabled.active,.cfdatepicker table tr td.selected.disabled.disabled:active,.cfdatepicker table tr td.selected.disabled.disabled:focus,.cfdatepicker table tr td.selected.disabled.disabled:hover,.cfdatepicker table tr td.selected.disabled:active,.cfdatepicker table tr td.selected.disabled:focus,.cfdatepicker table tr td.selected.disabled:hover,.cfdatepicker table tr td.selected.disabled:hover.disabled,.cfdatepicker table tr td.selected.disabled:hover.disabled.active,.cfdatepicker table tr td.selected.disabled:hover.disabled:active,.cfdatepicker table tr td.selected.disabled:hover.disabled:focus,.cfdatepicker table tr td.selected.disabled:hover.disabled:hover,.cfdatepicker table tr td.selected.disabled:hover[disabled],.cfdatepicker table tr td.selected.disabled:hover[disabled].active,.cfdatepicker table tr td.selected.disabled:hover[disabled]:active,.cfdatepicker table tr td.selected.disabled:hover[disabled]:focus,.cfdatepicker table tr td.selected.disabled:hover[disabled]:hover,.cfdatepicker table tr td.selected.disabled[disabled],.cfdatepicker table tr td.selected.disabled[disabled].active,.cfdatepicker table tr td.selected.disabled[disabled]:active,.cfdatepicker table tr td.selected.disabled[disabled]:focus,.cfdatepicker table tr td.selected.disabled[disabled]:hover,.cfdatepicker table tr td.selected:hover.disabled,.cfdatepicker table tr td.selected:hover.disabled.active,.cfdatepicker table tr td.selected:hover.disabled:active,.cfdatepicker table tr td.selected:hover.disabled:focus,.cfdatepicker table tr td.selected:hover.disabled:hover,.cfdatepicker table tr td.selected:hover[disabled],.cfdatepicker table tr td.selected:hover[disabled].active,.cfdatepicker table tr td.selected:hover[disabled]:active,.cfdatepicker table tr td.selected:hover[disabled]:focus,.cfdatepicker table tr td.selected:hover[disabled]:hover,.cfdatepicker table tr td.selected[disabled],.cfdatepicker table tr td.selected[disabled].active,.cfdatepicker table tr td.selected[disabled]:active,.cfdatepicker table tr td.selected[disabled]:focus,.cfdatepicker table tr td.selected[disabled]:hover,fieldset[disabled] .cfdatepicker table tr td.selected,fieldset[disabled] .cfdatepicker table tr td.selected.active,fieldset[disabled] .cfdatepicker table tr td.selected.disabled,fieldset[disabled] .cfdatepicker table tr td.selected.disabled.active,fieldset[disabled] .cfdatepicker table tr td.selected.disabled:active,fieldset[disabled] .cfdatepicker table tr td.selected.disabled:focus,fieldset[disabled] .cfdatepicker table tr td.selected.disabled:hover,fieldset[disabled] .cfdatepicker table tr td.selected.disabled:hover.active,fieldset[disabled] .cfdatepicker table tr td.selected.disabled:hover:active,fieldset[disabled] .cfdatepicker table tr td.selected.disabled:hover:focus,fieldset[disabled] .cfdatepicker table tr td.selected.disabled:hover:hover,fieldset[disabled] .cfdatepicker table tr td.selected:active,fieldset[disabled] .cfdatepicker table tr td.selected:focus,fieldset[disabled] .cfdatepicker table tr td.selected:hover,fieldset[disabled] .cfdatepicker table tr td.selected:hover.active,fieldset[disabled] .cfdatepicker table tr td.selected:hover:active,fieldset[disabled] .cfdatepicker table tr td.selected:hover:focus,fieldset[disabled] .cfdatepicker table tr td.selected:hover:hover{background-color:#999;border-color:#555}.cfdatepicker table tr td.active,.cfdatepicker table tr td.active.disabled,.cfdatepicker table tr td.active.disabled:hover,.cfdatepicker table tr td.active:hover{color:#fff;background-color:#428bca;border-color:#357ebd;text-shadow:0 -1px 0 rgba(0,0,0,.25)}.cfdatepicker table tr td.active.active,.cfdatepicker table tr td.active.disabled.active,.cfdatepicker table tr td.active.disabled:active,.cfdatepicker table tr td.active.disabled:focus,.cfdatepicker table tr td.active.disabled:hover,.cfdatepicker table tr td.active.disabled:hover.active,.cfdatepicker table tr td.active.disabled:hover:active,.cfdatepicker table tr td.active.disabled:hover:focus,.cfdatepicker table tr td.active.disabled:hover:hover,.cfdatepicker table tr td.active:active,.cfdatepicker table tr td.active:focus,.cfdatepicker table tr td.active:hover,.cfdatepicker table tr td.active:hover.active,.cfdatepicker table tr td.active:hover:active,.cfdatepicker table tr td.active:hover:focus,.cfdatepicker table tr td.active:hover:hover,.open .dropdown-toggle.cfdatepicker table tr td.active,.open .dropdown-toggle.cfdatepicker table tr td.active.disabled,.open .dropdown-toggle.cfdatepicker table tr td.active.disabled:hover,.open .dropdown-toggle.cfdatepicker table tr td.active:hover{color:#fff;background-color:#3276b1;border-color:#285e8e}.cfdatepicker table tr td.active.active,.cfdatepicker table tr td.active.disabled.active,.cfdatepicker table tr td.active.disabled:active,.cfdatepicker table tr td.active.disabled:hover.active,.cfdatepicker table tr td.active.disabled:hover:active,.cfdatepicker table tr td.active:active,.cfdatepicker table tr td.active:hover.active,.cfdatepicker table tr td.active:hover:active,.open .dropdown-toggle.cfdatepicker table tr td.active,.open .dropdown-toggle.cfdatepicker table tr td.active.disabled,.open .dropdown-toggle.cfdatepicker table tr td.active.disabled:hover,.open .dropdown-toggle.cfdatepicker table tr td.active:hover{background-image:none}.cfdatepicker table tr td.active.disabled,.cfdatepicker table tr td.active.disabled.active,.cfdatepicker table tr td.active.disabled.disabled,.cfdatepicker table tr td.active.disabled.disabled.active,.cfdatepicker table tr td.active.disabled.disabled:active,.cfdatepicker table tr td.active.disabled.disabled:focus,.cfdatepicker table tr td.active.disabled.disabled:hover,.cfdatepicker table tr td.active.disabled:active,.cfdatepicker table tr td.active.disabled:focus,.cfdatepicker table tr td.active.disabled:hover,.cfdatepicker table tr td.active.disabled:hover.disabled,.cfdatepicker table tr td.active.disabled:hover.disabled.active,.cfdatepicker table tr td.active.disabled:hover.disabled:active,.cfdatepicker table tr td.active.disabled:hover.disabled:focus,.cfdatepicker table tr td.active.disabled:hover.disabled:hover,.cfdatepicker table tr td.active.disabled:hover[disabled],.cfdatepicker table tr td.active.disabled:hover[disabled].active,.cfdatepicker table tr td.active.disabled:hover[disabled]:active,.cfdatepicker table tr td.active.disabled:hover[disabled]:focus,.cfdatepicker table tr td.active.disabled:hover[disabled]:hover,.cfdatepicker table tr td.active.disabled[disabled],.cfdatepicker table tr td.active.disabled[disabled].active,.cfdatepicker table tr td.active.disabled[disabled]:active,.cfdatepicker table tr td.active.disabled[disabled]:focus,.cfdatepicker table tr td.active.disabled[disabled]:hover,.cfdatepicker table tr td.active:hover.disabled,.cfdatepicker table tr td.active:hover.disabled.active,.cfdatepicker table tr td.active:hover.disabled:active,.cfdatepicker table tr td.active:hover.disabled:focus,.cfdatepicker table tr td.active:hover.disabled:hover,.cfdatepicker table tr td.active:hover[disabled],.cfdatepicker table tr td.active:hover[disabled].active,.cfdatepicker table tr td.active:hover[disabled]:active,.cfdatepicker table tr td.active:hover[disabled]:focus,.cfdatepicker table tr td.active:hover[disabled]:hover,.cfdatepicker table tr td.active[disabled],.cfdatepicker table tr td.active[disabled].active,.cfdatepicker table tr td.active[disabled]:active,.cfdatepicker table tr td.active[disabled]:focus,.cfdatepicker table tr td.active[disabled]:hover,fieldset[disabled] .cfdatepicker table tr td.active,fieldset[disabled] .cfdatepicker table tr td.active.active,fieldset[disabled] .cfdatepicker table tr td.active.disabled,fieldset[disabled] .cfdatepicker table tr td.active.disabled.active,fieldset[disabled] .cfdatepicker table tr td.active.disabled:active,fieldset[disabled] .cfdatepicker table tr td.active.disabled:focus,fieldset[disabled] .cfdatepicker table tr td.active.disabled:hover,fieldset[disabled] .cfdatepicker table tr td.active.disabled:hover.active,fieldset[disabled] .cfdatepicker table tr td.active.disabled:hover:active,fieldset[disabled] .cfdatepicker table tr td.active.disabled:hover:focus,fieldset[disabled] .cfdatepicker table tr td.active.disabled:hover:hover,fieldset[disabled] .cfdatepicker table tr td.active:active,fieldset[disabled] .cfdatepicker table tr td.active:focus,fieldset[disabled] .cfdatepicker table tr td.active:hover,fieldset[disabled] .cfdatepicker table tr td.active:hover.active,fieldset[disabled] .cfdatepicker table tr td.active:hover:active,fieldset[disabled] .cfdatepicker table tr td.active:hover:focus,fieldset[disabled] .cfdatepicker table tr td.active:hover:hover{background-color:#428bca;border-color:#357ebd}.cfdatepicker table tr td span{display:block;width:23%;height:54px;line-height:54px;float:left;margin:1%;cursor:pointer;border-radius:4px}.cfdatepicker table tr td span:hover{background:#eee}.cfdatepicker table tr td span.disabled,.cfdatepicker table tr td span.disabled:hover{background:0 0;color:#999;cursor:default}.cfdatepicker table tr td span.active,.cfdatepicker table tr td span.active.disabled,.cfdatepicker table tr td span.active.disabled:hover,.cfdatepicker table tr td span.active:hover{color:#fff;background-color:#428bca;border-color:#357ebd;text-shadow:0 -1px 0 rgba(0,0,0,.25)}.cfdatepicker table tr td span.active.active,.cfdatepicker table tr td span.active.disabled.active,.cfdatepicker table tr td span.active.disabled:active,.cfdatepicker table tr td span.active.disabled:focus,.cfdatepicker table tr td span.active.disabled:hover,.cfdatepicker table tr td span.active.disabled:hover.active,.cfdatepicker table tr td span.active.disabled:hover:active,.cfdatepicker table tr td span.active.disabled:hover:focus,.cfdatepicker table tr td span.active.disabled:hover:hover,.cfdatepicker table tr td span.active:active,.cfdatepicker table tr td span.active:focus,.cfdatepicker table tr td span.active:hover,.cfdatepicker table tr td span.active:hover.active,.cfdatepicker table tr td span.active:hover:active,.cfdatepicker table tr td span.active:hover:focus,.cfdatepicker table tr td span.active:hover:hover,.open .dropdown-toggle.cfdatepicker table tr td span.active,.open .dropdown-toggle.cfdatepicker table tr td span.active.disabled,.open .dropdown-toggle.cfdatepicker table tr td span.active.disabled:hover,.open .dropdown-toggle.cfdatepicker table tr td span.active:hover{color:#fff;background-color:#3276b1;border-color:#285e8e}.cfdatepicker table tr td span.active.active,.cfdatepicker table tr td span.active.disabled.active,.cfdatepicker table tr td span.active.disabled:active,.cfdatepicker table tr td span.active.disabled:hover.active,.cfdatepicker table tr td span.active.disabled:hover:active,.cfdatepicker table tr td span.active:active,.cfdatepicker table tr td span.active:hover.active,.cfdatepicker table tr td span.active:hover:active,.open .dropdown-toggle.cfdatepicker table tr td span.active,.open .dropdown-toggle.cfdatepicker table tr td span.active.disabled,.open .dropdown-toggle.cfdatepicker table tr td span.active.disabled:hover,.open .dropdown-toggle.cfdatepicker table tr td span.active:hover{background-image:none}.cfdatepicker table tr td span.active.disabled,.cfdatepicker table tr td span.active.disabled.active,.cfdatepicker table tr td span.active.disabled.disabled,.cfdatepicker table tr td span.active.disabled.disabled.active,.cfdatepicker table tr td span.active.disabled.disabled:active,.cfdatepicker table tr td span.active.disabled.disabled:focus,.cfdatepicker table tr td span.active.disabled.disabled:hover,.cfdatepicker table tr td span.active.disabled:active,.cfdatepicker table tr td span.active.disabled:focus,.cfdatepicker table tr td span.active.disabled:hover,.cfdatepicker table tr td span.active.disabled:hover.disabled,.cfdatepicker table tr td span.active.disabled:hover.disabled.active,.cfdatepicker table tr td span.active.disabled:hover.disabled:active,.cfdatepicker table tr td span.active.disabled:hover.disabled:focus,.cfdatepicker table tr td span.active.disabled:hover.disabled:hover,.cfdatepicker table tr td span.active.disabled:hover[disabled],.cfdatepicker table tr td span.active.disabled:hover[disabled].active,.cfdatepicker table tr td span.active.disabled:hover[disabled]:active,.cfdatepicker table tr td span.active.disabled:hover[disabled]:focus,.cfdatepicker table tr td span.active.disabled:hover[disabled]:hover,.cfdatepicker table tr td span.active.disabled[disabled],.cfdatepicker table tr td span.active.disabled[disabled].active,.cfdatepicker table tr td span.active.disabled[disabled]:active,.cfdatepicker table tr td span.active.disabled[disabled]:focus,.cfdatepicker table tr td span.active.disabled[disabled]:hover,.cfdatepicker table tr td span.active:hover.disabled,.cfdatepicker table tr td span.active:hover.disabled.active,.cfdatepicker table tr td span.active:hover.disabled:active,.cfdatepicker table tr td span.active:hover.disabled:focus,.cfdatepicker table tr td span.active:hover.disabled:hover,.cfdatepicker table tr td span.active:hover[disabled],.cfdatepicker table tr td span.active:hover[disabled].active,.cfdatepicker table tr td span.active:hover[disabled]:active,.cfdatepicker table tr td span.active:hover[disabled]:focus,.cfdatepicker table tr td span.active:hover[disabled]:hover,.cfdatepicker table tr td span.active[disabled],.cfdatepicker table tr td span.active[disabled].active,.cfdatepicker table tr td span.active[disabled]:active,.cfdatepicker table tr td span.active[disabled]:focus,.cfdatepicker table tr td span.active[disabled]:hover,fieldset[disabled] .cfdatepicker table tr td span.active,fieldset[disabled] .cfdatepicker table tr td span.active.active,fieldset[disabled] .cfdatepicker table tr td span.active.disabled,fieldset[disabled] .cfdatepicker table tr td span.active.disabled.active,fieldset[disabled] .cfdatepicker table tr td span.active.disabled:active,fieldset[disabled] .cfdatepicker table tr td span.active.disabled:focus,fieldset[disabled] .cfdatepicker table tr td span.active.disabled:hover,fieldset[disabled] .cfdatepicker table tr td span.active.disabled:hover.active,fieldset[disabled] .cfdatepicker table tr td span.active.disabled:hover:active,fieldset[disabled] .cfdatepicker table tr td span.active.disabled:hover:focus,fieldset[disabled] .cfdatepicker table tr td span.active.disabled:hover:hover,fieldset[disabled] .cfdatepicker table tr td span.active:active,fieldset[disabled] .cfdatepicker table tr td span.active:focus,fieldset[disabled] .cfdatepicker table tr td span.active:hover,fieldset[disabled] .cfdatepicker table tr td span.active:hover.active,fieldset[disabled] .cfdatepicker table tr td span.active:hover:active,fieldset[disabled] .cfdatepicker table tr td span.active:hover:focus,fieldset[disabled] .cfdatepicker table tr td span.active:hover:hover{background-color:#428bca;border-color:#357ebd}.cfdatepicker table tr td span.new,.cfdatepicker table tr td span.old{color:#999}.cfdatepicker th.cfdatepicker-switch{width:145px}.cfdatepicker tfoot tr th,.cfdatepicker thead tr:first-child th{cursor:pointer}.cfdatepicker tfoot tr th:hover,.cfdatepicker thead tr:first-child th:hover{background:#eee}.cfdatepicker .cw{font-size:10px;width:12px;padding:0 2px 0 5px;vertical-align:middle}.cfdatepicker thead tr:first-child th.cw{cursor:default;background-color:transparent}.input-group.date .input-group-addon i{cursor:pointer;width:16px;height:16px}.input-daterange input{text-align:center}.input-daterange input:first-child{border-radius:3px 0 0 3px}.input-daterange input:last-child{border-radius:0 3px 3px 0}.input-daterange .input-group-addon{width:auto;min-width:16px;padding:4px 5px;font-weight:400;line-height:1.42857143;text-align:center;text-shadow:0 1px 0 #fff;vertical-align:middle;background-color:#eee;border:solid #ccc;border-width:1px 0;margin-left:-5px;margin-right:-5px}.cfdatepicker.dropdown-menu{position:absolute;top:100%;left:0;z-index:1000;float:left;display:none;min-width:160px;list-style:none;background-color:#fff;border:1px solid #ccc;border:1px solid rgba(0,0,0,.2);border-radius:5px;-webkit-box-shadow:0 5px 10px rgba(0,0,0,.2);-moz-box-shadow:0 5px 10px rgba(0,0,0,.2);box-shadow:0 5px 10px rgba(0,0,0,.2);-webkit-background-clip:padding-box;-moz-background-clip:padding;background-clip:padding-box;color:#333;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:13px;line-height:1.42857143}.cfdatepicker.dropdown-menu td,.cfdatepicker.dropdown-menu th{padding:4px 5px}.image-thumb{margin-left:63px;padding:6px 0 6px 6px}.image-picker-content.image-thumb-lrg{margin-bottom:6px}.image-picker-side-bar{float:left;margin-left:-68px;width:62px}.image-thumb-lrg .image-picker-side-bar{background:#F6F6F6;border:1px solid #DFDFDF;float:none;margin:0 0 6px;padding:6px 6px 2px;text-align:center;width:auto}.image-picker-side-bar>img{border:1px solid #DFDFDF;width:62px}.image-thumb-lrg .image-picker-side-bar>img{-moz-box-sizing:border-box;box-sizing:border-box;max-width:100%;text-align:center;width:auto}.image-thumb .image-picker-main-content{margin-right:6px}.button.image-picker-button{margin:7px 0 0;width:110px;display:inline-block}.button.button-primary.image-picker-button{float:right;margin-left:6px;width:80px}.image-picker-main-content select{width:100%}.image-picker-sizer:disabled{opacity:.7;box-shadow:none;color:#A1A1A1}.button-primary.image-picker-button.image-picker-button-solo,.button.image-picker-button.image-picker-button-solo{width:170px;margin-top:0}.button-primary.image-picker-button.image-picker-button-solo{margin-top:7px;margin-left:0;float:none}.image-thumb-lrg .button.image-picker-button.cu-image-picker.image-picker-button-solo{width:120px}.image-thumb-lrg .button.button-primary.image-picker-button.cu-image-remover.image-picker-button-solo{float:right;margin:0 0 0 6px;width:auto}.image-thumb-lrg .button.button-primary.image-picker-button.cu-image-remover{width:45%}.image-picker-side-bar{max-width:100%}input.cu-image-picker-file-select[type=file]{display:none}.rangeslider,.rangeslider__fill{background:#e6e6e6;display:block;height:8px;width:100%;-webkit-border-radius:10px;-moz-border-radius:10px;-ms-border-radius:10px;-o-border-radius:10px;border-radius:10px}.rangeslider{position:relative}.rangeslider--disabled{filter:alpha(Opacity=40);opacity:.4}.rangeslider__fill{background:#0f0;position:absolute;top:0}.rangeslider__handle{background:#fff;border:1px solid #ccc;cursor:pointer;display:inline-block;width:18px;height:18px;position:absolute;top:-5px;-webkit-border-radius:50%;-moz-border-radius:50%;-ms-border-radius:50%;-o-border-radius:50%;border-radius:50%}input[type=range]:focus+.rangeslider .rangeslider__handle{-webkit-box-shadow:0 0 3px rgba(100,100,100,.9);-moz-box-shadow:0 0 3px rgba(100,100,100,.9);box-shadow:0 0 3px rgba(100,100,100,.9)}.recaptchatable #recaptcha_response_field{height:21px!important}.toggle_option_row{margin:4px 0}.toggle_option_row input{display:inline-block}.toggle_option_row .dashicons-sort{cursor:move}.toggle_option_row .toggle_label_field,.toggle_option_row .toggle_value_field{width:136px;line-height:20px}.toggle_option_preview .button{border-radius:0;margin-right:-5px}.toggle_option_preview .button:first-child{border-radius:3px 0 0 3px}.toggle_option_preview .button:last-child{border-radius:0 3px 3px 0}.toggle_option_preview.toggle_vertical .button{width:100%}.toggle_option_preview.toggle_vertical .button:first-child{border-radius:3px 3px 0 0}.toggle_option_preview.toggle_vertical .button:last-child{border-radius:0 0 3px 3px}.cf-toggle-switch html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}.cf-toggle-switch body{margin:0}.cf-toggle-switch article,.cf-toggle-switch aside,.cf-toggle-switch details,.cf-toggle-switch figcaption,.cf-toggle-switch figure,.cf-toggle-switch footer,.cf-toggle-switch header,.cf-toggle-switch hgroup,.cf-toggle-switch main,.cf-toggle-switch nav,.cf-toggle-switch section,.cf-toggle-switch summary{display:block}.cf-toggle-switch audio,.cf-toggle-switch canvas,.cf-toggle-switch progress,.cf-toggle-switch video{display:inline-block;vertical-align:baseline}.cf-toggle-switch audio:not([controls]){display:none;height:0}.cf-toggle-switch [hidden],.cf-toggle-switch template{display:none}.cf-toggle-switch a{background:0 0}.cf-toggle-switch a:active,.cf-toggle-switch a:hover{outline:0}.cf-toggle-switch abbr[title]{border-bottom:1px dotted}.cf-toggle-switch b,.cf-toggle-switch strong{font-weight:700}.cf-toggle-switch dfn{font-style:italic}.cf-toggle-switch h1{font-size:2em;margin:.67em 0}.cf-toggle-switch mark{background:#ff0;color:#000}.cf-toggle-switch small{font-size:80%}.cf-toggle-switch sub,.cf-toggle-switch sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}.cf-toggle-switch sup{top:-.5em}.cf-toggle-switch sub{bottom:-.25em}.cf-toggle-switch img{border:0}.cf-toggle-switch svg:not(:root){overflow:hidden}.cf-toggle-switch figure{margin:1em 40px}.cf-toggle-switch hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0}.cf-toggle-switch pre{overflow:auto}.cf-toggle-switch code,.cf-toggle-switch kbd,.cf-toggle-switch pre,.cf-toggle-switch samp{font-family:monospace,monospace;font-size:1em}.cf-toggle-switch button,.cf-toggle-switch input,.cf-toggle-switch optgroup,.cf-toggle-switch select,.cf-toggle-switch textarea{color:inherit;font:inherit;margin:0}.cf-toggle-switch button{overflow:visible}.cf-toggle-switch button,.cf-toggle-switch select{text-transform:none}.cf-toggle-switch button,.cf-toggle-switch html input[type=button],.cf-toggle-switch input[type=reset],.cf-toggle-switch input[type=submit]{-webkit-appearance:button;cursor:pointer}.cf-toggle-switch button[disabled],.cf-toggle-switch html input[disabled]{cursor:default}.cf-toggle-switch button::-moz-focus-inner,.cf-toggle-switch input::-moz-focus-inner{border:0;padding:0}.cf-toggle-switch input{line-height:normal}.cf-toggle-switch input[type=checkbox],.cf-toggle-switch input[type=radio]{box-sizing:border-box;padding:0}.cf-toggle-switch input[type=number]::-webkit-inner-spin-button,.cf-toggle-switch input[type=number]::-webkit-outer-spin-button{height:auto}.cf-toggle-switch input[type=search]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}.cf-toggle-switch input[type=search]::-webkit-search-cancel-button,.cf-toggle-switch input[type=search]::-webkit-search-decoration{-webkit-appearance:none}.cf-toggle-switch fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}.cf-toggle-switch legend{border:0;padding:0}.cf-toggle-switch textarea{overflow:auto}.cf-toggle-switch optgroup{font-weight:700}.cf-toggle-switch table{border-collapse:collapse;border-spacing:0}.cf-toggle-switch td,.cf-toggle-switch th{padding:0}.cf-toggle-switch .btn{display:inline-block;margin-bottom:0;font-weight:400;text-align:center;vertical-align:middle;cursor:pointer;background-image:none;border:1px solid transparent;white-space:nowrap;padding:6px 12px;font-size:14px;line-height:1.42857143;border-radius:4px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.cf-toggle-switch .btn.active:focus,.cf-toggle-switch .btn:active:focus,.cf-toggle-switch .btn:focus{outline:dotted thin;outline:-webkit-focus-ring-color auto 5px;outline-offset:-2px}.cf-toggle-switch .btn:focus,.cf-toggle-switch .btn:hover{color:#333;text-decoration:none}.cf-toggle-switch .btn.active,.cf-toggle-switch .btn:active{outline:0;background-image:none;-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.cf-toggle-switch .btn.disabled,.cf-toggle-switch .btn[disabled],.cf-toggle-switch fieldset[disabled] .btn{cursor:not-allowed;pointer-events:none;opacity:.65;filter:alpha(opacity=65);-webkit-box-shadow:none;box-shadow:none}.cf-toggle-switch .btn-default{color:#333;background-color:#fff;border-color:#ccc}.cf-toggle-switch .btn-default.active,.cf-toggle-switch .btn-default:active,.cf-toggle-switch .btn-default:focus,.cf-toggle-switch .btn-default:hover,.cf-toggle-switch .open .dropdown-toggle.btn-default{color:#333;background-color:#ebebeb;border-color:#adadad}.cf-toggle-switch .btn-default.active,.cf-toggle-switch .btn-default:active,.cf-toggle-switch .open .dropdown-toggle.btn-default{background-image:none}.cf-toggle-switch .btn-default.disabled,.cf-toggle-switch .btn-default.disabled.active,.cf-toggle-switch .btn-default.disabled:active,.cf-toggle-switch .btn-default.disabled:focus,.cf-toggle-switch .btn-default.disabled:hover,.cf-toggle-switch .btn-default[disabled],.cf-toggle-switch .btn-default[disabled].active,.cf-toggle-switch .btn-default[disabled]:active,.cf-toggle-switch .btn-default[disabled]:focus,.cf-toggle-switch .btn-default[disabled]:hover,.cf-toggle-switch fieldset[disabled] .btn-default,.cf-toggle-switch fieldset[disabled] .btn-default.active,.cf-toggle-switch fieldset[disabled] .btn-default:active,.cf-toggle-switch fieldset[disabled] .btn-default:focus,.cf-toggle-switch fieldset[disabled] .btn-default:hover{background-color:#fff;border-color:#ccc}.cf-toggle-switch .btn-default .badge{color:#fff;background-color:#333}.cf-toggle-switch .btn-primary{color:#fff;background-color:#428bca;border-color:#357ebd}.cf-toggle-switch .btn-primary.active,.cf-toggle-switch .btn-primary:active,.cf-toggle-switch .btn-primary:focus,.cf-toggle-switch .btn-primary:hover,.cf-toggle-switch .open .dropdown-toggle.btn-primary{color:#fff;background-color:#3276b1;border-color:#285e8e}.cf-toggle-switch .btn-primary.active,.cf-toggle-switch .btn-primary:active,.cf-toggle-switch .open .dropdown-toggle.btn-primary{background-image:none}.cf-toggle-switch .btn-primary.disabled,.cf-toggle-switch .btn-primary.disabled.active,.cf-toggle-switch .btn-primary.disabled:active,.cf-toggle-switch .btn-primary.disabled:focus,.cf-toggle-switch .btn-primary.disabled:hover,.cf-toggle-switch .btn-primary[disabled],.cf-toggle-switch .btn-primary[disabled].active,.cf-toggle-switch .btn-primary[disabled]:active,.cf-toggle-switch .btn-primary[disabled]:focus,.cf-toggle-switch .btn-primary[disabled]:hover,.cf-toggle-switch fieldset[disabled] .btn-primary,.cf-toggle-switch fieldset[disabled] .btn-primary.active,.cf-toggle-switch fieldset[disabled] .btn-primary:active,.cf-toggle-switch fieldset[disabled] .btn-primary:focus,.cf-toggle-switch fieldset[disabled] .btn-primary:hover{background-color:#428bca;border-color:#357ebd}.cf-toggle-switch .btn-primary .badge{color:#428bca;background-color:#fff}.cf-toggle-switch .btn-success{color:#fff;background-color:#5cb85c;border-color:#4cae4c}.cf-toggle-switch .btn-success.active,.cf-toggle-switch .btn-success:active,.cf-toggle-switch .btn-success:focus,.cf-toggle-switch .btn-success:hover,.cf-toggle-switch .open .dropdown-toggle.btn-success{color:#fff;background-color:#47a447;border-color:#398439}.cf-toggle-switch .btn-success.active,.cf-toggle-switch .btn-success:active,.cf-toggle-switch .open .dropdown-toggle.btn-success{background-image:none}.cf-toggle-switch .btn-success.disabled,.cf-toggle-switch .btn-success.disabled.active,.cf-toggle-switch .btn-success.disabled:active,.cf-toggle-switch .btn-success.disabled:focus,.cf-toggle-switch .btn-success.disabled:hover,.cf-toggle-switch .btn-success[disabled],.cf-toggle-switch .btn-success[disabled].active,.cf-toggle-switch .btn-success[disabled]:active,.cf-toggle-switch .btn-success[disabled]:focus,.cf-toggle-switch .btn-success[disabled]:hover,.cf-toggle-switch fieldset[disabled] .btn-success,.cf-toggle-switch fieldset[disabled] .btn-success.active,.cf-toggle-switch fieldset[disabled] .btn-success:active,.cf-toggle-switch fieldset[disabled] .btn-success:focus,.cf-toggle-switch fieldset[disabled] .btn-success:hover{background-color:#5cb85c;border-color:#4cae4c}.cf-toggle-switch .btn-success .badge{color:#5cb85c;background-color:#fff}.cf-toggle-switch .btn-info{color:#fff;background-color:#5bc0de;border-color:#46b8da}.cf-toggle-switch .btn-info.active,.cf-toggle-switch .btn-info:active,.cf-toggle-switch .btn-info:focus,.cf-toggle-switch .btn-info:hover,.cf-toggle-switch .open .dropdown-toggle.btn-info{color:#fff;background-color:#39b3d7;border-color:#269abc}.cf-toggle-switch .btn-info.active,.cf-toggle-switch .btn-info:active,.cf-toggle-switch .open .dropdown-toggle.btn-info{background-image:none}.cf-toggle-switch .btn-info.disabled,.cf-toggle-switch .btn-info.disabled.active,.cf-toggle-switch .btn-info.disabled:active,.cf-toggle-switch .btn-info.disabled:focus,.cf-toggle-switch .btn-info.disabled:hover,.cf-toggle-switch .btn-info[disabled],.cf-toggle-switch .btn-info[disabled].active,.cf-toggle-switch .btn-info[disabled]:active,.cf-toggle-switch .btn-info[disabled]:focus,.cf-toggle-switch .btn-info[disabled]:hover,.cf-toggle-switch fieldset[disabled] .btn-info,.cf-toggle-switch fieldset[disabled] .btn-info.active,.cf-toggle-switch fieldset[disabled] .btn-info:active,.cf-toggle-switch fieldset[disabled] .btn-info:focus,.cf-toggle-switch fieldset[disabled] .btn-info:hover{background-color:#5bc0de;border-color:#46b8da}.cf-toggle-switch .btn-info .badge{color:#5bc0de;background-color:#fff}.cf-toggle-switch .btn-warning{color:#fff;background-color:#f0ad4e;border-color:#eea236}.cf-toggle-switch .btn-warning.active,.cf-toggle-switch .btn-warning:active,.cf-toggle-switch .btn-warning:focus,.cf-toggle-switch .btn-warning:hover,.cf-toggle-switch .open .dropdown-toggle.btn-warning{color:#fff;background-color:#ed9c28;border-color:#d58512}.cf-toggle-switch .btn-warning.active,.cf-toggle-switch .btn-warning:active,.cf-toggle-switch .open .dropdown-toggle.btn-warning{background-image:none}.cf-toggle-switch .btn-warning.disabled,.cf-toggle-switch .btn-warning.disabled.active,.cf-toggle-switch .btn-warning.disabled:active,.cf-toggle-switch .btn-warning.disabled:focus,.cf-toggle-switch .btn-warning.disabled:hover,.cf-toggle-switch .btn-warning[disabled],.cf-toggle-switch .btn-warning[disabled].active,.cf-toggle-switch .btn-warning[disabled]:active,.cf-toggle-switch .btn-warning[disabled]:focus,.cf-toggle-switch .btn-warning[disabled]:hover,.cf-toggle-switch fieldset[disabled] .btn-warning,.cf-toggle-switch fieldset[disabled] .btn-warning.active,.cf-toggle-switch fieldset[disabled] .btn-warning:active,.cf-toggle-switch fieldset[disabled] .btn-warning:focus,.cf-toggle-switch fieldset[disabled] .btn-warning:hover{background-color:#f0ad4e;border-color:#eea236}.cf-toggle-switch .btn-warning .badge{color:#f0ad4e;background-color:#fff}.cf-toggle-switch .btn-danger{color:#fff;background-color:#d9534f;border-color:#d43f3a}.cf-toggle-switch .btn-danger.active,.cf-toggle-switch .btn-danger:active,.cf-toggle-switch .btn-danger:focus,.cf-toggle-switch .btn-danger:hover,.cf-toggle-switch .open .dropdown-toggle.btn-danger{color:#fff;background-color:#d2322d;border-color:#ac2925}.cf-toggle-switch .btn-danger.active,.cf-toggle-switch .btn-danger:active,.cf-toggle-switch .open .dropdown-toggle.btn-danger{background-image:none}.cf-toggle-switch .btn-danger.disabled,.cf-toggle-switch .btn-danger.disabled.active,.cf-toggle-switch .btn-danger.disabled:active,.cf-toggle-switch .btn-danger.disabled:focus,.cf-toggle-switch .btn-danger.disabled:hover,.cf-toggle-switch .btn-danger[disabled],.cf-toggle-switch .btn-danger[disabled].active,.cf-toggle-switch .btn-danger[disabled]:active,.cf-toggle-switch .btn-danger[disabled]:focus,.cf-toggle-switch .btn-danger[disabled]:hover,.cf-toggle-switch fieldset[disabled] .btn-danger,.cf-toggle-switch fieldset[disabled] .btn-danger.active,.cf-toggle-switch fieldset[disabled] .btn-danger:active,.cf-toggle-switch fieldset[disabled] .btn-danger:focus,.cf-toggle-switch fieldset[disabled] .btn-danger:hover{background-color:#d9534f;border-color:#d43f3a}.cf-toggle-switch .btn-danger .badge{color:#d9534f;background-color:#fff}.cf-toggle-switch .btn-link{color:#428bca;font-weight:400;cursor:pointer;border-radius:0}.cf-toggle-switch .btn-link,.cf-toggle-switch .btn-link:active,.cf-toggle-switch .btn-link[disabled],.cf-toggle-switch fieldset[disabled] .btn-link{background-color:transparent;-webkit-box-shadow:none;box-shadow:none}.cf-toggle-switch .btn-link,.cf-toggle-switch .btn-link:active,.cf-toggle-switch .btn-link:focus,.cf-toggle-switch .btn-link:hover{border-color:transparent}.cf-toggle-switch .btn-link:focus,.cf-toggle-switch .btn-link:hover{color:#2a6496;text-decoration:underline;background-color:transparent}.cf-toggle-switch .btn-link[disabled]:focus,.cf-toggle-switch .btn-link[disabled]:hover,.cf-toggle-switch fieldset[disabled] .btn-link:focus,.cf-toggle-switch fieldset[disabled] .btn-link:hover{color:#999;text-decoration:none}.cf-toggle-switch .btn-group-lg>.btn,.cf-toggle-switch .btn-lg{padding:10px 16px;font-size:18px;line-height:1.33;border-radius:6px}.cf-toggle-switch .btn-group-sm>.btn,.cf-toggle-switch .btn-sm{padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}.cf-toggle-switch .btn-group-xs>.btn,.cf-toggle-switch .btn-xs{padding:1px 5px;font-size:12px;line-height:1.5;border-radius:3px}.cf-toggle-switch .btn-block{display:block;width:100%;padding-left:0;padding-right:0}.cf-toggle-switch .btn-block+.btn-block{margin-top:5px}.cf-toggle-switch input[type=button].btn-block,.cf-toggle-switch input[type=reset].btn-block,.cf-toggle-switch input[type=submit].btn-block{width:100%}.cf-toggle-switch .btn-group,.cf-toggle-switch .btn-group-vertical{position:relative;display:inline-block;vertical-align:middle}.cf-toggle-switch .btn-group-vertical>.btn,.cf-toggle-switch .btn-group>.btn{position:relative;float:left}.cf-toggle-switch .btn-group-vertical>.btn.active,.cf-toggle-switch .btn-group-vertical>.btn:active,.cf-toggle-switch .btn-group-vertical>.btn:focus,.cf-toggle-switch .btn-group-vertical>.btn:hover,.cf-toggle-switch .btn-group>.btn.active,.cf-toggle-switch .btn-group>.btn:active,.cf-toggle-switch .btn-group>.btn:focus,.cf-toggle-switch .btn-group>.btn:hover{z-index:2}.cf-toggle-switch .btn-group-vertical>.btn:focus,.cf-toggle-switch .btn-group>.btn:focus{outline:0}.cf-toggle-switch .btn-group .btn+.btn,.cf-toggle-switch .btn-group .btn+.btn-group,.cf-toggle-switch .btn-group .btn-group+.btn,.cf-toggle-switch .btn-group .btn-group+.btn-group{margin-left:-1px}.cf-toggle-switch .btn-toolbar{margin-left:-5px}.cf-toggle-switch .btn-toolbar .btn-group,.cf-toggle-switch .btn-toolbar .input-group{float:left}.cf-toggle-switch .btn-toolbar>.btn,.cf-toggle-switch .btn-toolbar>.btn-group,.cf-toggle-switch .btn-toolbar>.input-group{margin-left:5px}.cf-toggle-switch .btn-group>.btn:not(:first-child):not(:last-child):not(.dropdown-toggle){border-radius:0}.cf-toggle-switch .btn-group>.btn:first-child{margin-left:0}.cf-toggle-switch .btn-group>.btn:first-child:not(:last-child):not(.dropdown-toggle){border-bottom-right-radius:0;border-top-right-radius:0}.cf-toggle-switch .btn-group>.btn:last-child:not(:first-child),.cf-toggle-switch .btn-group>.dropdown-toggle:not(:first-child){border-bottom-left-radius:0;border-top-left-radius:0}.cf-toggle-switch .btn-group>.btn-group{float:left}.cf-toggle-switch .btn-group>.btn-group:not(:first-child):not(:last-child)>.btn{border-radius:0}.cf-toggle-switch .btn-group>.btn-group:first-child>.btn:last-child,.cf-toggle-switch .btn-group>.btn-group:first-child>.dropdown-toggle{border-bottom-right-radius:0;border-top-right-radius:0}.cf-toggle-switch .btn-group>.btn-group:last-child>.btn:first-child{border-bottom-left-radius:0;border-top-left-radius:0}.cf-toggle-switch .btn-group .dropdown-toggle:active,.cf-toggle-switch .btn-group.open .dropdown-toggle{outline:0}.cf-toggle-switch .btn-group>.btn+.dropdown-toggle{padding-left:8px;padding-right:8px}.cf-toggle-switch .btn-group>.btn-lg+.dropdown-toggle{padding-left:12px;padding-right:12px}.cf-toggle-switch .btn-group.open .dropdown-toggle{-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.cf-toggle-switch .btn-group.open .dropdown-toggle.btn-link{-webkit-box-shadow:none;box-shadow:none}.cf-toggle-switch .btn .caret{margin-left:0}.cf-toggle-switch .btn-lg .caret{border-width:5px 5px 0}.cf-toggle-switch .dropup .btn-lg .caret{border-width:0 5px 5px}.cf-toggle-switch .btn-group-vertical>.btn,.cf-toggle-switch .btn-group-vertical>.btn-group,.cf-toggle-switch .btn-group-vertical>.btn-group>.btn{display:block;float:none;width:100%;max-width:100%}.cf-toggle-switch .btn-group-vertical>.btn-group>.btn{float:none}.cf-toggle-switch .btn-group-vertical>.btn+.btn,.cf-toggle-switch .btn-group-vertical>.btn+.btn-group,.cf-toggle-switch .btn-group-vertical>.btn-group+.btn,.cf-toggle-switch .btn-group-vertical>.btn-group+.btn-group{margin-top:-1px;margin-left:0}.cf-toggle-switch .btn-group-vertical>.btn:not(:first-child):not(:last-child){border-radius:0}.cf-toggle-switch .btn-group-vertical>.btn:first-child:not(:last-child){border-top-right-radius:4px;border-bottom-right-radius:0;border-bottom-left-radius:0}.cf-toggle-switch .btn-group-vertical>.btn:last-child:not(:first-child){border-bottom-left-radius:4px;border-top-right-radius:0;border-top-left-radius:0}.cf-toggle-switch .btn-group-vertical>.btn-group:not(:first-child):not(:last-child)>.btn{border-radius:0}.cf-toggle-switch .btn-group-vertical>.btn-group:first-child:not(:last-child)>.btn:last-child,.cf-toggle-switch .btn-group-vertical>.btn-group:first-child:not(:last-child)>.dropdown-toggle{border-bottom-right-radius:0;border-bottom-left-radius:0}.cf-toggle-switch .btn-group-vertical>.btn-group:last-child:not(:first-child)>.btn:first-child{border-top-right-radius:0;border-top-left-radius:0}.cf-toggle-switch .btn-group-justified{display:table;width:100%;table-layout:fixed;border-collapse:separate}.cf-toggle-switch .btn-group-justified>.btn,.cf-toggle-switch .btn-group-justified>.btn-group{float:none;display:table-cell;width:1%}.cf-toggle-switch .btn-group-justified>.btn-group .btn{width:100%}.cf-toggle-switch [data-toggle=buttons]>.btn>input[type=checkbox],.cf-toggle-switch [data-toggle=buttons]>.btn>input[type=radio]{display:none}.cf-toggle-switch .btn-group-vertical>.btn-group:after,.cf-toggle-switch .btn-group-vertical>.btn-group:before,.cf-toggle-switch .btn-toolbar:after,.cf-toggle-switch .btn-toolbar:before,.cf-toggle-switch .clearfix:after,.cf-toggle-switch .clearfix:before{content:" ";display:table}.cf-toggle-switch .btn-group-vertical>.btn-group:after,.cf-toggle-switch .btn-toolbar:after,.cf-toggle-switch .clearfix:after{clear:both}.cf-toggle-switch .center-block{display:block;margin-left:auto;margin-right:auto}.cf-toggle-switch .pull-right{float:right!important}.cf-toggle-switch .pull-left{float:left!important}.cf-toggle-switch .hide{display:none!important}.cf-toggle-switch .show{display:block!important}.cf-toggle-switch .invisible{visibility:hidden}.cf-toggle-switch .text-hide{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0}.cf-toggle-switch .hidden{display:none!important;visibility:hidden!important}.cf-toggle-switch .affix{position:fixed}@-ms-viewport{width:device-width}.cf-toggle-switch .visible-lg,.cf-toggle-switch .visible-md,.cf-toggle-switch .visible-print,.cf-toggle-switch .visible-sm,.cf-toggle-switch .visible-xs{display:none!important}@media (max-width:767px){.cf-toggle-switch .visible-xs{display:block!important}.cf-toggle-switch table.visible-xs{display:table}.cf-toggle-switch tr.visible-xs{display:table-row!important}.cf-toggle-switch td.visible-xs,.cf-toggle-switch th.visible-xs{display:table-cell!important}}@media (min-width:768px) and (max-width:991px){.cf-toggle-switch .visible-sm{display:block!important}.cf-toggle-switch table.visible-sm{display:table}.cf-toggle-switch tr.visible-sm{display:table-row!important}.cf-toggle-switch td.visible-sm,.cf-toggle-switch th.visible-sm{display:table-cell!important}}@media (min-width:992px) and (max-width:1199px){.cf-toggle-switch .visible-md{display:block!important}.cf-toggle-switch table.visible-md{display:table}.cf-toggle-switch tr.visible-md{display:table-row!important}.cf-toggle-switch td.visible-md,.cf-toggle-switch th.visible-md{display:table-cell!important}}@media (min-width:1200px){.cf-toggle-switch .visible-lg{display:block!important}.cf-toggle-switch table.visible-lg{display:table}.cf-toggle-switch tr.visible-lg{display:table-row!important}.cf-toggle-switch td.visible-lg,.cf-toggle-switch th.visible-lg{display:table-cell!important}}@media (max-width:767px){.cf-toggle-switch .hidden-xs{display:none!important}}@media (min-width:768px) and (max-width:991px){.cf-toggle-switch .hidden-sm{display:none!important}}@media (min-width:992px) and (max-width:1199px){.cf-toggle-switch .hidden-md{display:none!important}}@media (min-width:1200px){.cf-toggle-switch .hidden-lg{display:none!important}}@media print{.cf-toggle-switch .visible-print{display:block!important}.cf-toggle-switch table.visible-print{display:table}.cf-toggle-switch tr.visible-print{display:table-row!important}.cf-toggle-switch td.visible-print,.cf-toggle-switch th.visible-print{display:table-cell!important}}@media print{.cf-toggle-switch .hidden-print{display:none!important}}.cf-toggle-group-buttons{width:100%;clear:both}
|
3 |
+
input.form-control.parsley-success,select.form-control.parsley-success,textarea.form-control.parsley-success{color:#468847;background-color:#DFF0D8;border-color:#D6E9C6}input.form-control.parsley-error,select.form-control.parsley-error,textarea.form-control.parsley-error{color:#B94A48;background-color:#F2DEDE;border-color: #EED3D7}.form-control.parsley-errors-list{margin:2px 0 3px;padding:0;list-style-type:none;font-size:.9em;line-height:.9em;opacity:0;color:#468847;transition:all .3s ease-in;-o-transition:all .3s ease-in;-moz-transition:all .3s ease-in;-webkit-transition:all .3s ease-in}.form-control.parsley-errors-list.filled{opacity:1}
|
4 |
.breadcrumb a.has-error{color:#ff0000;}
|
5 |
.form-group .parsley-errors-list.filled,.form-group .parsley-errors-list.filled .parsley-type {
|
6 |
list-style: outside none none;
|
7 |
list-style-type: none;
|
8 |
}
|
9 |
+
|
10 |
.caldera-grid .cf-multi-uploader-list > ul {
|
11 |
list-style: outside none none;
|
12 |
margin: 0 0 12px;
|
18 |
position: relative;
|
19 |
clear: both;
|
20 |
}
|
21 |
+
.caldera-grid .cf-multi-uploader-list > ul > li .file-name {
|
22 |
+
display: inline-block;
|
23 |
+
font-weight: bold;
|
24 |
+
left: 16px;
|
25 |
+
right: 0;
|
26 |
+
overflow: hidden;
|
27 |
+
position: absolute;
|
28 |
+
text-overflow: ellipsis;
|
29 |
+
white-space: nowrap;
|
30 |
+
}
|
31 |
+
.caldera-grid .cf-multi-uploader-list > ul > li .file-name.file-uploaded {
|
32 |
+
left: 0;
|
33 |
+
}
|
34 |
+
.caldera-grid .cf-multi-uploader-list > ul > li .file-size {
|
35 |
+
float: right;
|
36 |
+
}
|
37 |
+
.caldera-grid .cf-multi-uploader-list > ul > li .file-type {
|
38 |
+
float: left;
|
39 |
+
}
|
40 |
+
.caldera-grid .cf-multi-uploader-list > ul > li .file-error{
|
41 |
+
clear: both;
|
42 |
+
display: block;
|
43 |
+
}
|
44 |
+
.caldera-grid .cf-multi-uploader-list > ul > li .cf-file-remove {
|
45 |
+
color: #cf0000;
|
46 |
+
text-decoration: none;
|
47 |
+
border: 0;
|
48 |
+
}
|
49 |
+
.caldera-grid .cf-multi-uploader-list > ul > li.has-error .bar {
|
50 |
+
background-color: #cf0000 !important;
|
51 |
+
}
|
52 |
+
.caldera-grid .cf-multi-uploader-list > ul > li.has-error{
|
53 |
+
color: #cf0000;
|
54 |
+
}
|
55 |
+
|
56 |
+
.has-error.cf-toggle-switch .cf-toggle-group-buttons > a {
|
57 |
+
background-color: #f2dede;
|
58 |
+
border-color: #dd4b39;
|
59 |
+
}
|
assets/css/modals.css
CHANGED
@@ -124,12 +124,9 @@
|
|
124 |
}
|
125 |
.tablenav.caldera-table-nav {
|
126 |
clear: none;
|
127 |
-
|
128 |
-
margin: -42px 18px 0 0;
|
129 |
-
}
|
130 |
-
.caldera-table-nav .tablenav-pages{
|
131 |
-
float: left;
|
132 |
}
|
|
|
133 |
.caldera-table-nav .tablenav-pages .current-page{
|
134 |
width: 45px;
|
135 |
}
|
124 |
}
|
125 |
.tablenav.caldera-table-nav {
|
126 |
clear: none;
|
127 |
+
margin: 0;
|
|
|
|
|
|
|
|
|
128 |
}
|
129 |
+
|
130 |
.caldera-table-nav .tablenav-pages .current-page{
|
131 |
width: 45px;
|
132 |
}
|
assets/js/admin.js
CHANGED
@@ -93,6 +93,20 @@ jQuery(document).ready(function($){
|
|
93 |
$('body').on('keyup change', '[data-format="key"]', function(e){
|
94 |
this.value = this.value.replace(/[^a-z0-9]/gi, '-').toLowerCase();
|
95 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
|
98 |
});
|
93 |
$('body').on('keyup change', '[data-format="key"]', function(e){
|
94 |
this.value = this.value.replace(/[^a-z0-9]/gi, '-').toLowerCase();
|
95 |
});
|
96 |
+
$('body').on('keyup change', '[data-format="slug"]', function(e){
|
97 |
+
this.value = this.value.replace(/[^a-z0-9]/gi, '_').toLowerCase();
|
98 |
+
});
|
99 |
+
|
100 |
+
$( window ).on('resize', function(){
|
101 |
+
|
102 |
+
var list_toggle = $('#cf_forms_toggle'),
|
103 |
+
forms_panel = $('.form-panel-wrap');
|
104 |
|
105 |
+
if( window.innerWidth <= 1420 ){
|
106 |
+
if( list_toggle.is(':visible') && forms_panel.is(':visible') ){
|
107 |
+
list_toggle.trigger('click');
|
108 |
+
}
|
109 |
+
}
|
110 |
+
});
|
111 |
|
112 |
});
|
assets/js/admin.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
var baldrickTriggers,loop_loader;jQuery(document).ready(function(e){baldrickTriggers=function(){e(".ajax-trigger").baldrick({request:ajaxurl,method:"POST",before:function(a,t){var r=e(a),
|
1 |
+
var baldrickTriggers,loop_loader;jQuery(document).ready(function(e){baldrickTriggers=function(){e(".ajax-trigger").baldrick({request:ajaxurl,method:"POST",before:function(a,t){var r=e(a),i=e("#cf_toolbar_actions"),o=i.parent().find('[name="_wp_http_referer"]');if(i.length&&o.length&&(r.data("cf_toolbar_actions",i.val()),r.data("_wp_http_referer",o.val())),r.data("trigger")){t.preventDefault();var n=e(r.data("trigger"));return n.trigger(n.data("event")?n.data("event"):"click"),!1}},complete:function(){e(".init_field_type[data-type]").each(function(a,t){var r=e(t);"function"==typeof window[r.data("type")+"_init"]&&window[r.data("type")+"_init"](r.prop("id"),r[0])})}})},loop_loader=function(e,a){var t=Math.round(1e7*Math.random());return{__id__:t}},baldrickTriggers(),e("body").on("click",".modal-side-tab",function(a){a.preventDefault();var t=e(this),r=t.closest(".caldera-modal-body"),i=r.find(".tab-detail-panel"),o=e(t.attr("href"));r.find(".modal-side-tab.active").removeClass("active"),t.addClass("active"),i.hide(),o.show()}),e("body").on("click",".caldera-group-remover",function(a){a.preventDefault();var t=e(this),r=t.closest(".caldera-repeater-group");r.slideUp(200,function(){r.remove()})}),e("body").on("click",".form-delete a.form-control",function(a){var t=e(this);confirm(t.data("confirm"))||a.preventDefault()}),e("body").on("keyup change",'[data-format="key"]',function(e){this.value=this.value.replace(/[^a-z0-9]/gi,"-").toLowerCase()}),e("body").on("keyup change",'[data-format="slug"]',function(e){this.value=this.value.replace(/[^a-z0-9]/gi,"_").toLowerCase()}),e(window).on("resize",function(){var a=e("#cf_forms_toggle"),t=e(".form-panel-wrap");window.innerWidth<=1420&&a.is(":visible")&&t.is(":visible")&&a.trigger("click")})});
|
assets/js/ajax-core.js
CHANGED
@@ -40,9 +40,10 @@ jQuery(function($){
|
|
40 |
if( data.success && data.success === true ){
|
41 |
|
42 |
cf_upload_queue.pop();
|
|
|
|
|
|
|
43 |
|
44 |
-
$('[data-file="' + file_number + '"]').remove();
|
45 |
-
//$('.' + file_number ).slideUp();
|
46 |
cf_uploader_filelist[ file_number ].state = 3;
|
47 |
|
48 |
form.submit();
|
@@ -54,8 +55,7 @@ jQuery(function($){
|
|
54 |
form.find(':submit').prop('disabled',false);
|
55 |
form.find('.cf-uploader-trigger').slideDown();
|
56 |
$('.' + file_number +' .file-error' ).html( data.data );
|
57 |
-
|
58 |
-
console.log( data.data );
|
59 |
return;
|
60 |
}
|
61 |
|
@@ -85,16 +85,6 @@ jQuery(function($){
|
|
85 |
return false;
|
86 |
}
|
87 |
|
88 |
-
var validate = form.parsley({
|
89 |
-
errorsWrapper : '<span class="help-block caldera_ajax_error_block"></span>',
|
90 |
-
errorTemplate : '<span></span>'
|
91 |
-
});
|
92 |
-
|
93 |
-
if( !validate.isValid() ){
|
94 |
-
validate.destroy();
|
95 |
-
return false;
|
96 |
-
}
|
97 |
-
validate.destroy(); //allow to continue;
|
98 |
if( !form.data( 'postDisable' ) ){
|
99 |
buttons.prop('disabled',true);
|
100 |
}
|
@@ -107,8 +97,8 @@ jQuery(function($){
|
|
107 |
var has_files = false;
|
108 |
var count = cf_upload_queue.length;
|
109 |
for( var file in cf_uploader_filelist ){
|
110 |
-
if( cf_uploader_filelist[ file ].state > 1 ){
|
111 |
-
// state 2 and 3 is transferring and complete
|
112 |
continue;
|
113 |
}
|
114 |
|
@@ -208,11 +198,6 @@ jQuery(function($){
|
|
208 |
$( document ).trigger( 'cf.submission', obj );
|
209 |
$( document ).trigger( 'cf.' + obj.data.type );
|
210 |
|
211 |
-
//custom_callback
|
212 |
-
// was modal?
|
213 |
-
//setTimeout(function(){
|
214 |
-
// obj.params.target.closest('.caldera-front-modal-container').hide();
|
215 |
-
//}, 1000);
|
216 |
}
|
217 |
});
|
218 |
};
|
40 |
if( data.success && data.success === true ){
|
41 |
|
42 |
cf_upload_queue.pop();
|
43 |
+
var file_remover = $('[data-file="' + file_number + '"]');
|
44 |
+
file_remover.next().addClass('file-uploaded');
|
45 |
+
file_remover.remove();
|
46 |
|
|
|
|
|
47 |
cf_uploader_filelist[ file_number ].state = 3;
|
48 |
|
49 |
form.submit();
|
55 |
form.find(':submit').prop('disabled',false);
|
56 |
form.find('.cf-uploader-trigger').slideDown();
|
57 |
$('.' + file_number +' .file-error' ).html( data.data );
|
58 |
+
|
|
|
59 |
return;
|
60 |
}
|
61 |
|
85 |
return false;
|
86 |
}
|
87 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
if( !form.data( 'postDisable' ) ){
|
89 |
buttons.prop('disabled',true);
|
90 |
}
|
97 |
var has_files = false;
|
98 |
var count = cf_upload_queue.length;
|
99 |
for( var file in cf_uploader_filelist ){
|
100 |
+
if( cf_uploader_filelist[ file ].state > 1 || cf_uploader_filelist[ file ].state === 0 ){
|
101 |
+
// state 2 and 3 is transferring and complete, state 0 is error and dont upload
|
102 |
continue;
|
103 |
}
|
104 |
|
198 |
$( document ).trigger( 'cf.submission', obj );
|
199 |
$( document ).trigger( 'cf.' + obj.data.type );
|
200 |
|
|
|
|
|
|
|
|
|
|
|
201 |
}
|
202 |
});
|
203 |
};
|
assets/js/ajax-core.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
var resBaldrickTriggers;jQuery(function(a){var r=[],e=function(e,t,s){var i=a("#progress-file-"+t),
|
1 |
+
var resBaldrickTriggers;jQuery(function(a){var r=[],e=function(e,t,s){var i=a("#progress-file-"+t),d=a("."+t+" .file-size");r.push(1),cf_uploader_filelist[t].state=2,a.ajax({xhr:function(){var a=new window.XMLHttpRequest;return a.upload.addEventListener("progress",function(a){if(a.lengthComputable){var r=a.loaded/a.total*100;i.width(r+"%"),d.html(size_format(a.loaded)+" / "+size_format(a.total))}},!1),a.addEventListener("progress",function(a){if(a.lengthComputable){a.loaded/a.total}},!1),a},url:e.data("request")+"/upload/",type:"POST",data:s,processData:!1,contentType:!1,success:function(s,i,d){if(s.success&&s.success===!0){r.pop();var l=a('[data-file="'+t+'"]');l.next().addClass("file-uploaded"),l.remove(),cf_uploader_filelist[t].state=3,e.submit()}else if(s.data&&!s.success)return a("."+t).addClass("has-error"),e.find(":submit").prop("disabled",!1),e.find(".cf-uploader-trigger").slideDown(),void a("."+t+" .file-error").html(s.data)},error:function(a,r,t){e.data("postDisable")||buttons.prop("disabled",!1)}})};(resBaldrickTriggers=function(){a(".cfajax-trigger").baldrick({request:"./",method:"POST",init:function(t,s){s.preventDefault();var i=a(t),d=i.find(":submit");if(i.data("_cf_manual"))return i.find('[name="cfajax"]').remove(),!1;if(i.data("postDisable")||d.prop("disabled",!0),"object"==typeof cf_uploader_filelist){i.find(".cf-uploader-trigger").slideUp();var l=!1,o=r.length;for(var n in cf_uploader_filelist)if(!(cf_uploader_filelist[n].state>1||0===cf_uploader_filelist[n].state)){l=!0;var p=new FormData,c=n,f=a("#"+c.split("_file_")[0]);if(p.append(f.data("field"),cf_uploader_filelist[n].file),p.append("field",f.data("field")),p.append("control",f.data("controlid")),e(i,c,p),o++,1===o)break}if(!0===l||r.length)return!1}},error:function(a){404===a.jqxhr.status&&this.trigger.data("_cf_manual",!0).trigger("submit")},callback:function(r){r.params.trigger.find(":submit").prop("disabled",!1);r.params.trigger.data("instance");if(r.params.trigger.data("customCallback")&&"function"==typeof window[r.params.trigger.data("customCallback")]&&window[r.params.trigger.data("customCallback")](r.data),r.params.trigger.data("inhibitnotice")||(a(".caldera_ajax_error_wrap").removeClass("caldera_ajax_error_wrap").removeClass("has-error"),a(".caldera_ajax_error_block").remove(),"complete"===r.data.status||"success"===r.data.type?(r.data.html&&r.params.target.html(r.data.html),r.params.trigger.data("hiderows")&&r.params.trigger.find("div.row").remove()):"preprocess"===r.data.status?r.params.target.html(r.data.html):"error"===r.data.status&&r.params.target.html(r.data.html)),"complete"!==r.data.status&&"success"!==r.data.type||r.data.entry||r.params.trigger[0].reset(),r.data.url&&(r.params.trigger.hide(),window.location=r.data.url),r.params.trigger.find(".cf-uploader-trigger").slideDown(),r.data.fields)for(var e in r.data.fields){var t=r.params.trigger.find('[data-field="'+e+'"]'),s=t.parent();s.is("label")&&(s=s.parent(),(s.hasClass("checkbox")||s.hasClass("radio"))&&(s=s.parent()));var i=s.find(".help-block").not(".caldera_ajax_error_block");s.addClass("has-error").addClass("caldera_ajax_error_wrap"),i.length&&i.hide(),s.append('<span class="help-block caldera_ajax_error_block">'+r.data.fields[e]+"</span>")}a(document).trigger("cf.submission",r),a(document).trigger("cf."+r.data.type)}})})()});
|
assets/js/conditionals.js
CHANGED
File without changes
|
assets/js/conditionals.min.js
CHANGED
File without changes
|
assets/js/edit.js
CHANGED
@@ -103,7 +103,6 @@ jQuery(document).ready(function($){
|
|
103 |
|
104 |
|
105 |
var select = $(el),
|
106 |
-
//templ = $('#' + select.val() + '_tmpl').length ? $('#' + select.val() + '_tmpl').html() : $('#noconfig_field_templ').html(),
|
107 |
parent = select.closest('.caldera-editor-field-config-wrapper'),
|
108 |
target = parent.find('.caldera-config-field-setup'),
|
109 |
template = ( compiled_templates[select.val() + '_tmpl'] ? compiled_templates[select.val() + '_tmpl'] : compiled_templates.noconfig_field_templ ),//Handlebars.compile(templ),
|
@@ -142,7 +141,6 @@ jQuery(document).ready(function($){
|
|
142 |
window[select.val() + '_init'](select.data('field'), target);
|
143 |
}
|
144 |
|
145 |
-
//build_field_preview(select.data('field'));
|
146 |
// remove not supported stuff
|
147 |
if(fieldtype_defaults[select.val() + '_nosupport']){
|
148 |
|
@@ -241,12 +239,8 @@ jQuery(document).ready(function($){
|
|
241 |
preview_parent.removeClass('button');
|
242 |
|
243 |
$('.preview-field-config').prop('disabled', true);
|
244 |
-
|
245 |
-
//rebuild_field_binding();
|
246 |
}
|
247 |
|
248 |
-
// build sortables
|
249 |
-
|
250 |
// switch active group
|
251 |
function switch_active_group(id){
|
252 |
var fields_panel = $('.caldera-editor-fields-panel'),
|
@@ -423,8 +417,6 @@ jQuery(document).ready(function($){
|
|
423 |
// show field config
|
424 |
field_config.show();
|
425 |
|
426 |
-
//caldera-editor-fields-list
|
427 |
-
|
428 |
});
|
429 |
|
430 |
// bind show group config panel
|
@@ -715,10 +707,7 @@ jQuery(document).ready(function($){
|
|
715 |
// place new field line
|
716 |
field.appendTo( wrap );
|
717 |
// pance new conf template
|
718 |
-
field_conf.append( new_conf_templ( new_field ) );
|
719 |
-
|
720 |
-
// init sorting
|
721 |
-
|
722 |
|
723 |
// load field
|
724 |
field.find('a').trigger('click');
|
@@ -805,8 +794,6 @@ jQuery(document).ready(function($){
|
|
805 |
// update field bind type
|
806 |
current_form_fields[parent.prop('id')].type = this.value;
|
807 |
}
|
808 |
-
|
809 |
-
//console.log(current_form_fields[parent.prop('id')]);
|
810 |
|
811 |
if(parent.length){
|
812 |
build_field_preview(parent.prop('id'));
|
@@ -817,7 +804,7 @@ jQuery(document).ready(function($){
|
|
817 |
$('.caldera-editor-body').on('focus', '.caldera-field-bind', function(e){
|
818 |
var field = $(this),
|
819 |
value = this.value;
|
820 |
-
|
821 |
if(e.type && e.type === 'focusin'){
|
822 |
field.removeClass('bound_field').addClass('reload-binding');
|
823 |
rebind_field_bindings();
|
@@ -831,7 +818,6 @@ jQuery(document).ready(function($){
|
|
831 |
var field = $(this),
|
832 |
field_compare = field.parent().find('.compare-type'),
|
833 |
type = field.data('condition'),
|
834 |
-
//field_type = $( '#' + field.val() + '_type' ),
|
835 |
pid = field.data('id'),
|
836 |
name = "config[" + type + "][" + pid + "][conditions][group][" + field.data('row') + "][" + field.data('line') + "]",
|
837 |
lineid = field.data('line'),
|
@@ -851,7 +837,6 @@ jQuery(document).ready(function($){
|
|
851 |
field.addClass('bound_triggered');
|
852 |
}
|
853 |
// check if a value is present
|
854 |
-
|
855 |
if(curval.length){
|
856 |
if(curval.val().length){
|
857 |
target.data('value', curval.val());
|
@@ -1009,8 +994,7 @@ jQuery(document).ready(function($){
|
|
1009 |
fieldtype = ( wrap.closest('.wrapper-instance-pane').find('.caldera-select-field-type').val() ? wrap.closest('.wrapper-instance-pane').find('.caldera-select-field-type').val() : 'hidden' ),
|
1010 |
tags = wrap.find('.magic-tags-autocomplete'),
|
1011 |
list = tags.find('ul'),
|
1012 |
-
|
1013 |
-
stream = this.value,//.substr(0, this.selectionStart ),
|
1014 |
tag = [],
|
1015 |
type_instances = [],
|
1016 |
current_tag = '',
|
@@ -1046,7 +1030,7 @@ jQuery(document).ready(function($){
|
|
1046 |
break;
|
1047 |
}
|
1048 |
}
|
1049 |
-
|
1050 |
current_tag = stream.substr(start, ( end - start ) );
|
1051 |
}
|
1052 |
//}
|
@@ -1163,7 +1147,6 @@ jQuery(document).ready(function($){
|
|
1163 |
input.val( stream.substr(0, start ) + selected + stream.substr( end ) ).trigger('change').focus();
|
1164 |
input[0].selectionStart = start + selected.length - ( selected.indexOf('*') > 0 ? 2 : 0 );
|
1165 |
input[0].selectionEnd = start + selected.length - ( selected.indexOf('*') > 0 ? 1 : 0 );
|
1166 |
-
//stream = null;
|
1167 |
end = start = input[0].selectionEnd;
|
1168 |
stream += selected;
|
1169 |
input.trigger('init.magic');
|
@@ -1204,7 +1187,6 @@ jQuery(document).ready(function($){
|
|
1204 |
compiled_templates[pretemplates[t].id] = Handlebars.compile( pretemplates[t].innerHTML );
|
1205 |
//compiled_templates
|
1206 |
}
|
1207 |
-
//console.log(compiled_templates);
|
1208 |
//compiled_templates
|
1209 |
|
1210 |
// build configs on load:
|
@@ -1278,15 +1260,6 @@ rebuild_field_binding = function(){
|
|
1278 |
|
1279 |
var fields = jQuery('.caldera-editor-field-config-wrapper');//.not('.bound_field');
|
1280 |
|
1281 |
-
// add binding
|
1282 |
-
//fields.addClass('bound_field');
|
1283 |
-
// clear list
|
1284 |
-
/*if(!fields.length){
|
1285 |
-
console.log('all bound');
|
1286 |
-
rebind_field_bindings();
|
1287 |
-
return;
|
1288 |
-
}*/
|
1289 |
-
|
1290 |
// set object
|
1291 |
system_values.field = {
|
1292 |
tags : {
|
@@ -1296,7 +1269,7 @@ rebuild_field_binding = function(){
|
|
1296 |
wrap : ['%','%']
|
1297 |
};
|
1298 |
|
1299 |
-
//
|
1300 |
for(var f = 0; f < fields.length; f++){
|
1301 |
var field_id = fields[f].id,
|
1302 |
label = jQuery('#' + field_id + '_lable').val(),
|
@@ -1329,10 +1302,6 @@ rebuild_field_binding = function(){
|
|
1329 |
}).removeClass('bound-field');
|
1330 |
};
|
1331 |
|
1332 |
-
//console.log( jQuery('.caldera-field-bind') );
|
1333 |
-
//console.log(current_form_fields);
|
1334 |
-
//rebind_field_bindings();
|
1335 |
-
|
1336 |
};
|
1337 |
|
1338 |
rebind_field_bindings = function(){
|
@@ -1345,8 +1314,6 @@ rebind_field_bindings = function(){
|
|
1345 |
|
1346 |
|
1347 |
if(!bindings.length){
|
1348 |
-
//var bound = jQuery('.caldera-field-bind.bound_field');
|
1349 |
-
//bound.trigger('change');
|
1350 |
return;
|
1351 |
}
|
1352 |
|
@@ -1447,23 +1414,19 @@ rebind_field_bindings = function(){
|
|
1447 |
|
1448 |
var optgroup = jQuery('<optgroup label="' + system_values[type].type + ( type_instances[instance] !== '__system__' ? ' ' + ( jQuery('li.'+type_instances[instance]).find('.processor-line-number').html() ) : '' ) + '"' + valid + '>');
|
1449 |
|
1450 |
-
|
1451 |
-
|
1452 |
-
|
1453 |
-
|
1454 |
-
|
1455 |
-
|
1456 |
-
|
1457 |
-
|
1458 |
-
|
1459 |
-
|
1460 |
-
optgroup.append('<option value="\{' + bind_value + '\}"' + ( current === '{'+bind_value+'}' ? 'selected="selected"' : '' ) + valid + '>' + system_values[type].tags[types[t]][i] + '</option>');
|
1461 |
-
//field.append('<option value="' + bind_value + '"' + ( current === system_values[type].tags[types[t]][i] ? 'selected="selected"' : '' ) + '>' + system_values[type].tags[types[t]][i] + '</option>');
|
1462 |
|
1463 |
-
|
1464 |
-
|
1465 |
|
1466 |
-
//}
|
1467 |
if(optgroup.children().length){
|
1468 |
optgroup.appendTo(field);
|
1469 |
}
|
@@ -1477,7 +1440,7 @@ rebind_field_bindings = function(){
|
|
1477 |
if(count === 0){
|
1478 |
field.empty();
|
1479 |
if(field.data('type')){
|
1480 |
-
field.append('<option value="">No ' + field.data('type').split(',').join(' or ') + ' in form</option>')
|
1481 |
var no_options = true;
|
1482 |
}
|
1483 |
}else{
|
@@ -1488,14 +1451,10 @@ rebind_field_bindings = function(){
|
|
1488 |
field.prepend('<option value=""></option>');
|
1489 |
}
|
1490 |
field.val(current);
|
1491 |
-
}else{
|
1492 |
-
// text types
|
1493 |
-
//console.log(field.val())
|
1494 |
}
|
1495 |
|
1496 |
};
|
1497 |
|
1498 |
-
//check_required_bindings();
|
1499 |
init_magic_tags();
|
1500 |
jQuery(document).trigger('bound.fields');
|
1501 |
jQuery('.caldera-header-save-button').prop("disabled", false);
|
@@ -1522,7 +1481,6 @@ function check_required_bindings(el){
|
|
1522 |
fields = jQuery('.caldera-config-field .required');
|
1523 |
}
|
1524 |
|
1525 |
-
|
1526 |
fields.removeClass('has-error');
|
1527 |
field_elements.removeClass('has-error');
|
1528 |
nav_elements.removeClass('has-error');
|
@@ -1553,7 +1511,6 @@ function check_required_bindings(el){
|
|
1553 |
field.addClass('has-error');
|
1554 |
|
1555 |
all_clear = false;
|
1556 |
-
//tab.append('<span class="error-tag">' + required_errors[panel.prop('id')] + '</span>');
|
1557 |
|
1558 |
}else{
|
1559 |
//unique
|
@@ -1578,6 +1535,33 @@ function check_required_bindings(el){
|
|
1578 |
}
|
1579 |
required_errors[panel.prop('id')] += 1;
|
1580 |
field.addClass('has-error');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1581 |
break;
|
1582 |
}
|
1583 |
};
|
@@ -1586,7 +1570,6 @@ function check_required_bindings(el){
|
|
1586 |
});
|
1587 |
|
1588 |
for(var t in required_errors){
|
1589 |
-
//savebutton.prop("disabled", true);
|
1590 |
jQuery('.caldera-forms-options-form').find('a[href="#' + t + '"]').append('<span class="error-tag">' + required_errors[t] + '</span>');
|
1591 |
}
|
1592 |
|
@@ -1602,7 +1585,6 @@ jQuery(document).ready(function($) {
|
|
1602 |
}
|
1603 |
|
1604 |
add_page_grid = function(obj){
|
1605 |
-
//obj.rawData.page_no
|
1606 |
var btn_count = $('.page-toggle').length + 1,
|
1607 |
button = $('<button type="button" data-name="Page ' + btn_count + '" data-page="' + obj.rawData.page_no + '" class="page-toggle button">' + obj.params.trigger.data('addtitle') + ' ' + btn_count + '</button> '),
|
1608 |
option_tab = $('#page-toggles');
|
@@ -1665,28 +1647,27 @@ jQuery(document).ready(function($) {
|
|
1665 |
});
|
1666 |
}
|
1667 |
|
1668 |
-
function insert_new_field(newfield, target,
|
1669 |
var name = "fld_" + Math.round( Math.random() * 10000000 ),
|
1670 |
new_name = name,
|
1671 |
field_conf = $('#field_config_panels'),
|
1672 |
new_conf_templ,
|
1673 |
-
|
1674 |
|
1675 |
-
|
1676 |
-
|
1677 |
-
|
1678 |
-
|
1679 |
-
|
1680 |
-
|
1681 |
-
}
|
1682 |
-
new_field = {
|
1683 |
"id" : new_name,
|
1684 |
"label" : '',
|
1685 |
"slug" : ''
|
1686 |
-
};
|
1687 |
-
|
|
|
1688 |
// pance new conf template
|
1689 |
-
field_conf.append( new_conf_templ(
|
1690 |
|
1691 |
newfield.
|
1692 |
removeClass('button-small').
|
@@ -1695,7 +1676,7 @@ jQuery(document).ready(function($) {
|
|
1695 |
removeClass('ui-draggable').
|
1696 |
removeClass('layout-new-form-field').
|
1697 |
addClass('layout-form-field').
|
1698 |
-
attr('data-config', name);
|
1699 |
|
1700 |
newfield.find('.layout_field_name').remove();
|
1701 |
newfield.find('.field-location').prop('name', 'config[layout_grid][fields][' + name + ']');
|
@@ -1704,17 +1685,17 @@ jQuery(document).ready(function($) {
|
|
1704 |
buildSortables();
|
1705 |
newfield.find('.icon-edit').trigger('click');
|
1706 |
|
1707 |
-
$('#' + name + '_lable').focus().select();
|
1708 |
-
|
1709 |
-
if(tel){
|
1710 |
-
field_conf.find('.field_config_string').val('');
|
1711 |
-
field_conf.find('.field-label').trigger('change');
|
1712 |
-
}
|
1713 |
|
1714 |
-
|
1715 |
baldrickTriggers();
|
1716 |
-
$('#' + name).trigger('field.drop');
|
1717 |
$(document).trigger('field.added');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1718 |
}
|
1719 |
|
1720 |
function buildSortables(){
|
@@ -1760,8 +1741,7 @@ jQuery(document).ready(function($) {
|
|
1760 |
$('.page-toggle.button').droppable({
|
1761 |
accept: ".layout-form-field",
|
1762 |
over: function(e, ui){
|
1763 |
-
$(this).trigger('click');
|
1764 |
-
//buildSortables();
|
1765 |
$( ".layout-column" ).sortable("refresh");
|
1766 |
}
|
1767 |
});
|
@@ -1787,24 +1767,11 @@ jQuery(document).ready(function($) {
|
|
1787 |
$('#grid-pages-panel').on('click','.column-fieldinsert .dashicons-plus-alt', function(e){
|
1788 |
//newfield-tool
|
1789 |
var target = $(this).closest('.column-container'),
|
1790 |
-
newfield = $('#newfield-tool').clone();
|
1791 |
|
1792 |
insert_new_field(newfield, target);
|
1793 |
|
1794 |
});
|
1795 |
-
$('#grid-pages-panel').on('click','.column-fieldinsert .dashicons-admin-generic', function(e){
|
1796 |
-
|
1797 |
-
});
|
1798 |
-
/*
|
1799 |
-
$('#grid-pages-panel').on('click','.icon-filter', function(e){
|
1800 |
-
//newfield-tool
|
1801 |
-
var target = $(this).closest('.column-container'),
|
1802 |
-
newfield = $('#newfield-tool').clone();
|
1803 |
-
|
1804 |
-
insert_new_field(newfield, target, $(this).data('id'));
|
1805 |
-
|
1806 |
-
});*/
|
1807 |
-
|
1808 |
|
1809 |
$('#grid-pages-panel').on('click','.column-split', function(e){
|
1810 |
var column = $(this).parent().parent(),
|
@@ -1901,7 +1868,7 @@ jQuery(document).ready(function($) {
|
|
1901 |
|
1902 |
|
1903 |
column.find('.layout-column').contents().appendTo(prev.find('.layout-column'));
|
1904 |
-
prev.attr('class', left.join('-'))
|
1905 |
column.remove();
|
1906 |
buildLayoutString();
|
1907 |
jQuery('.column-tools').remove();
|
@@ -1912,7 +1879,6 @@ jQuery(document).ready(function($) {
|
|
1912 |
var setrow = jQuery(this);
|
1913 |
jQuery('.column-tools,.column-merge').remove();
|
1914 |
setrow.children().children().first().append('<div class="column-remove column-tools"><i class="icon-remove"></i></div>');
|
1915 |
-
//setrow.children().children().last().append('<div class="column-sort column-tools"><i class="icon-edit"></i> <i class="dashicons dashicons-menu drag-handle sort-handle"></i> </div>');
|
1916 |
setrow.children().children().last().append('<div class="column-sort column-tools" style="text-align:right;"><i class="dashicons dashicons-menu drag-handle sort-handle"></i></div>');
|
1917 |
|
1918 |
setrow.children().children().not(':first').prepend('<div class="column-merge"><div class="column-join column-tools"><i class="icon-join"></i></div></div>');
|
@@ -1957,10 +1923,9 @@ jQuery(document).ready(function($) {
|
|
1957 |
left[2]--;
|
1958 |
right[2]++;
|
1959 |
if(left[2] > 0 && left[2] < (left[2]+right[2]) ){
|
1960 |
-
prev.attr('class', left.join('-'))
|
1961 |
-
column.attr('class', right.join('-'))
|
1962 |
ui.originalPosition.left = dragged.position().left;
|
1963 |
-
//$(this).css('margin-left', Math.abs(dragged.position().left) - 12 + 'px');
|
1964 |
}else{
|
1965 |
$(this).draggable( "option", "disabled", true );
|
1966 |
}
|
@@ -1968,10 +1933,9 @@ jQuery(document).ready(function($) {
|
|
1968 |
left[2]++;
|
1969 |
right[2]--;
|
1970 |
if(right[2] > 0 && right[2] < (right[2]+right[2]) ){
|
1971 |
-
prev.attr('class', left.join('-'))
|
1972 |
-
column.attr('class', right.join('-'))
|
1973 |
ui.originalPosition.left = dragged.position().left;
|
1974 |
-
//$(this).css('margin-left', '-'+Math.abs(dragged.position().left) - 12 + 'px');
|
1975 |
}else{
|
1976 |
$(this).draggable( "option", "disabled", true );
|
1977 |
}
|
@@ -2003,17 +1967,30 @@ jQuery(document).ready(function($) {
|
|
2003 |
config.slideUp(100, function(){
|
2004 |
$(this).remove();
|
2005 |
});
|
2006 |
-
//if(!wrap.children().length){
|
2007 |
-
//wrap.remove();
|
2008 |
-
|
2009 |
-
//}
|
2010 |
-
|
2011 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012 |
|
2013 |
-
|
2014 |
-
|
2015 |
-
|
|
|
2016 |
|
|
|
|
|
|
|
2017 |
var clicked = $(this),
|
2018 |
panel = clicked.parent(),
|
2019 |
type = $('#' + panel.data('config') +'_type').val();
|
@@ -2030,7 +2007,7 @@ jQuery(document).ready(function($) {
|
|
2030 |
|
2031 |
$(document).trigger('show.' + panel.data('config'));
|
2032 |
$(document).trigger('show.fieldedit');
|
2033 |
-
|
2034 |
if( type === 'radio' || type === 'checkbox' || type === 'dropdown' || type === 'toggle_switch' ){
|
2035 |
$('#' + panel.data('config') + '_auto').trigger('change');
|
2036 |
}
|
@@ -2166,16 +2143,30 @@ jQuery(document).ready(function($) {
|
|
2166 |
|
2167 |
if(clicked.data('options')){
|
2168 |
var batchinput = $(clicked.data('options')),
|
2169 |
-
batch = batchinput.val().split("\n")
|
|
|
2170 |
for( var i = 0; i < batch.length; i ++){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2171 |
config.option["opt" + parseInt( ( Math.random() + i ) * 0x100000 )] = {
|
2172 |
-
value :
|
2173 |
-
label :
|
2174 |
default : false
|
2175 |
}
|
2176 |
}
|
2177 |
$(clicked.data('options')).parent().hide();
|
2178 |
batchinput.val('');
|
|
|
|
|
|
|
|
|
|
|
2179 |
toggle_rows.empty();
|
2180 |
}else{
|
2181 |
// add new option
|
@@ -2185,7 +2176,7 @@ jQuery(document).ready(function($) {
|
|
2185 |
default : false
|
2186 |
};
|
2187 |
}
|
2188 |
-
|
2189 |
// place new row
|
2190 |
toggle_rows.append( template( config ) );
|
2191 |
wrapper.find('.toggle_show_values').trigger('change');
|
@@ -2198,13 +2189,29 @@ jQuery(document).ready(function($) {
|
|
2198 |
toggle_rows.find('.toggle_label_field').last().focus();
|
2199 |
}
|
2200 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2201 |
|
2202 |
-
|
|
|
|
|
|
|
|
|
2203 |
// remove an option row
|
2204 |
$('.caldera-editor-body').on('click', '.toggle-remove-option', function(e){
|
2205 |
var triggerfield = $(this).closest('.caldera-editor-field-config-wrapper').find('.field-config').first();
|
2206 |
$(this).parent().remove();
|
2207 |
triggerfield.trigger('change');
|
|
|
2208 |
});
|
2209 |
|
2210 |
$('.caldera-editor-body').on('click', '.page-toggle', function(e){
|
@@ -2238,43 +2245,83 @@ jQuery(document).ready(function($) {
|
|
2238 |
value.val(label.val());
|
2239 |
});
|
2240 |
|
2241 |
-
// build fild bindings
|
2242 |
-
rebuild_field_binding();
|
2243 |
-
$(document).trigger('load.page');
|
2244 |
-
});
|
2245 |
-
|
2246 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2247 |
|
|
|
|
|
|
|
|
|
|
|
|
|
2248 |
|
2249 |
-
|
2250 |
-
|
2251 |
-
});
|
2252 |
-
/*
|
2253 |
-
<div class="caldera-config-group caldera-config-group-full">
|
2254 |
-
<button class="button block-button add-toggle-option" type="button">Add Option</button>
|
2255 |
-
</div>
|
2256 |
-
<div class="caldera-config-group caldera-config-group-full toggle-options">
|
2257 |
-
{{#each option}}
|
2258 |
-
<div class="toggle_option_row">
|
2259 |
-
<i class="dashicons dashicons-sort" style="padding: 4px 9px;"></i>
|
2260 |
-
{{#if default}}
|
2261 |
-
<input type="checkbox" class="toggle_set_default field-config" name="{{../../_name}}[option][{{@key}}][default]" value="1" checked="checked">
|
2262 |
-
{{else}}
|
2263 |
-
<input type="checkbox" class="toggle_set_default field-config" name="{{../../_name}}[option][{{@key}}][default]" value="1">
|
2264 |
-
{{/if}}
|
2265 |
-
<input type="text" class="toggle_value_field field-config" name="{{../_name}}[option][{{@key}}][value]" value="{{value}}" placeholder="value">
|
2266 |
-
<input type="text" class="toggle_label_field field-config" name="{{../_name}}[option][{{@key}}][label]" value="{{label}}" placeholder="label">
|
2267 |
-
<button class="button button-small toggle-remove-option" type="button"><i class="icn-delete"></i></button>
|
2268 |
-
</div>
|
2269 |
-
{{/each}}
|
2270 |
-
</div>
|
2271 |
-
*/
|
2272 |
-
|
2273 |
-
jQuery(document).ready(function($){
|
2274 |
-
|
2275 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2276 |
|
2277 |
-
|
|
|
2278 |
// set sortable groups
|
2279 |
$( ".caldera-editor-processors-panel ul" ).sortable({
|
2280 |
update: function(){
|
@@ -2322,8 +2369,7 @@ jQuery(document).ready(function($){
|
|
2322 |
$('#form_processor_baldrickModalCloser').trigger('click');
|
2323 |
$('.caldera-processor-nav a').last().trigger('click');
|
2324 |
$('#fp_' + processid + '_type').val(clicked.data('type')).trigger('change');
|
2325 |
-
|
2326 |
-
//rebuild_field_binding();
|
2327 |
|
2328 |
baldrickTriggers();
|
2329 |
});
|
@@ -2344,7 +2390,6 @@ jQuery(document).ready(function($){
|
|
2344 |
|
2345 |
$('.caldera-processor-nav a').first().trigger('click');
|
2346 |
|
2347 |
-
//check_required_bindings();
|
2348 |
rebuild_field_binding();
|
2349 |
|
2350 |
});
|
@@ -2367,10 +2412,22 @@ jQuery(document).ready(function($){
|
|
2367 |
// get config
|
2368 |
build_processor_config(this);
|
2369 |
|
2370 |
-
//check_required_bindings();
|
2371 |
rebuild_field_binding();
|
2372 |
|
2373 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2374 |
|
2375 |
|
2376 |
// build processor type config
|
@@ -2441,7 +2498,6 @@ jQuery(document).ready(function($){
|
|
2441 |
|
2442 |
// build configs on load:
|
2443 |
// allows us to keep changes on reload as not to loose settings on accedental navigation
|
2444 |
-
|
2445 |
rebuild_field_binding();
|
2446 |
|
2447 |
$('.caldera-select-processor-type').each(function(k,v){
|
@@ -2449,7 +2505,7 @@ jQuery(document).ready(function($){
|
|
2449 |
});
|
2450 |
|
2451 |
|
2452 |
-
|
2453 |
});//
|
2454 |
|
2455 |
|
@@ -2474,7 +2530,6 @@ Handlebars.registerHelper('_field', function(args) {
|
|
2474 |
}
|
2475 |
|
2476 |
out = '<select ' + ( args.hash.type ? 'data-type="' + args.hash.type + '"' : '' ) + default_val +' ' + exclude + ' name="' + this._name + '[' + args.hash.slug + ']' + is_array + '" id="' + this._id + '_' + args.hash.slug + '" class="block-input field-config caldera-field-bind' + required + '">';
|
2477 |
-
//out = '<input type="text" ' + ( args.hash.type ? 'data-type="' + args.hash.type + '"' : '' ) + default_val +' ' + exclude + ' name="' + this._name + '[' + args.hash.slug + ']' + is_array + '" id="' + this._id + '_' + args.hash.slug + '" class="block-input field-config magic-tag-enabled caldera-field-bind' + required + '">';
|
2478 |
if(this[args.hash.slug]){
|
2479 |
out += '<option class="bound-field" value="' + this[args.hash.slug] + '" class="bound-field"></option>';
|
2480 |
}else{
|
103 |
|
104 |
|
105 |
var select = $(el),
|
|
|
106 |
parent = select.closest('.caldera-editor-field-config-wrapper'),
|
107 |
target = parent.find('.caldera-config-field-setup'),
|
108 |
template = ( compiled_templates[select.val() + '_tmpl'] ? compiled_templates[select.val() + '_tmpl'] : compiled_templates.noconfig_field_templ ),//Handlebars.compile(templ),
|
141 |
window[select.val() + '_init'](select.data('field'), target);
|
142 |
}
|
143 |
|
|
|
144 |
// remove not supported stuff
|
145 |
if(fieldtype_defaults[select.val() + '_nosupport']){
|
146 |
|
239 |
preview_parent.removeClass('button');
|
240 |
|
241 |
$('.preview-field-config').prop('disabled', true);
|
|
|
|
|
242 |
}
|
243 |
|
|
|
|
|
244 |
// switch active group
|
245 |
function switch_active_group(id){
|
246 |
var fields_panel = $('.caldera-editor-fields-panel'),
|
417 |
// show field config
|
418 |
field_config.show();
|
419 |
|
|
|
|
|
420 |
});
|
421 |
|
422 |
// bind show group config panel
|
707 |
// place new field line
|
708 |
field.appendTo( wrap );
|
709 |
// pance new conf template
|
710 |
+
field_conf.append( new_conf_templ( new_field ) );
|
|
|
|
|
|
|
711 |
|
712 |
// load field
|
713 |
field.find('a').trigger('click');
|
794 |
// update field bind type
|
795 |
current_form_fields[parent.prop('id')].type = this.value;
|
796 |
}
|
|
|
|
|
797 |
|
798 |
if(parent.length){
|
799 |
build_field_preview(parent.prop('id'));
|
804 |
$('.caldera-editor-body').on('focus', '.caldera-field-bind', function(e){
|
805 |
var field = $(this),
|
806 |
value = this.value;
|
807 |
+
|
808 |
if(e.type && e.type === 'focusin'){
|
809 |
field.removeClass('bound_field').addClass('reload-binding');
|
810 |
rebind_field_bindings();
|
818 |
var field = $(this),
|
819 |
field_compare = field.parent().find('.compare-type'),
|
820 |
type = field.data('condition'),
|
|
|
821 |
pid = field.data('id'),
|
822 |
name = "config[" + type + "][" + pid + "][conditions][group][" + field.data('row') + "][" + field.data('line') + "]",
|
823 |
lineid = field.data('line'),
|
837 |
field.addClass('bound_triggered');
|
838 |
}
|
839 |
// check if a value is present
|
|
|
840 |
if(curval.length){
|
841 |
if(curval.val().length){
|
842 |
target.data('value', curval.val());
|
994 |
fieldtype = ( wrap.closest('.wrapper-instance-pane').find('.caldera-select-field-type').val() ? wrap.closest('.wrapper-instance-pane').find('.caldera-select-field-type').val() : 'hidden' ),
|
995 |
tags = wrap.find('.magic-tags-autocomplete'),
|
996 |
list = tags.find('ul'),
|
997 |
+
stream = this.value,
|
|
|
998 |
tag = [],
|
999 |
type_instances = [],
|
1000 |
current_tag = '',
|
1030 |
break;
|
1031 |
}
|
1032 |
}
|
1033 |
+
|
1034 |
current_tag = stream.substr(start, ( end - start ) );
|
1035 |
}
|
1036 |
//}
|
1147 |
input.val( stream.substr(0, start ) + selected + stream.substr( end ) ).trigger('change').focus();
|
1148 |
input[0].selectionStart = start + selected.length - ( selected.indexOf('*') > 0 ? 2 : 0 );
|
1149 |
input[0].selectionEnd = start + selected.length - ( selected.indexOf('*') > 0 ? 1 : 0 );
|
|
|
1150 |
end = start = input[0].selectionEnd;
|
1151 |
stream += selected;
|
1152 |
input.trigger('init.magic');
|
1187 |
compiled_templates[pretemplates[t].id] = Handlebars.compile( pretemplates[t].innerHTML );
|
1188 |
//compiled_templates
|
1189 |
}
|
|
|
1190 |
//compiled_templates
|
1191 |
|
1192 |
// build configs on load:
|
1260 |
|
1261 |
var fields = jQuery('.caldera-editor-field-config-wrapper');//.not('.bound_field');
|
1262 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1263 |
// set object
|
1264 |
system_values.field = {
|
1265 |
tags : {
|
1269 |
wrap : ['%','%']
|
1270 |
};
|
1271 |
|
1272 |
+
// each field
|
1273 |
for(var f = 0; f < fields.length; f++){
|
1274 |
var field_id = fields[f].id,
|
1275 |
label = jQuery('#' + field_id + '_lable').val(),
|
1302 |
}).removeClass('bound-field');
|
1303 |
};
|
1304 |
|
|
|
|
|
|
|
|
|
1305 |
};
|
1306 |
|
1307 |
rebind_field_bindings = function(){
|
1314 |
|
1315 |
|
1316 |
if(!bindings.length){
|
|
|
|
|
1317 |
return;
|
1318 |
}
|
1319 |
|
1414 |
|
1415 |
var optgroup = jQuery('<optgroup label="' + system_values[type].type + ( type_instances[instance] !== '__system__' ? ' ' + ( jQuery('li.'+type_instances[instance]).find('.processor-line-number').html() ) : '' ) + '"' + valid + '>');
|
1416 |
|
1417 |
+
for( var i = 0; i < system_values[type].tags[types[t]].length; i++){
|
1418 |
+
|
1419 |
+
var bind_value = system_values[type].tags[types[t]][i];
|
1420 |
+
// update labels on multiple
|
1421 |
+
if(type_instances[instance] !== '__system__'){
|
1422 |
+
bind_value = bind_value.replace(type ,type_instances[instance]);
|
1423 |
+
}
|
1424 |
+
|
1425 |
+
optgroup.append('<option value="\{' + bind_value + '\}"' + ( current === '{'+bind_value+'}' ? 'selected="selected"' : '' ) + valid + '>' + system_values[type].tags[types[t]][i] + '</option>');
|
|
|
|
|
|
|
1426 |
|
1427 |
+
count += 1;
|
1428 |
+
}
|
1429 |
|
|
|
1430 |
if(optgroup.children().length){
|
1431 |
optgroup.appendTo(field);
|
1432 |
}
|
1440 |
if(count === 0){
|
1441 |
field.empty();
|
1442 |
if(field.data('type')){
|
1443 |
+
field.append('<option value="">No ' + field.data('type').split(',').join(' or ') + ' in form</option>');
|
1444 |
var no_options = true;
|
1445 |
}
|
1446 |
}else{
|
1451 |
field.prepend('<option value=""></option>');
|
1452 |
}
|
1453 |
field.val(current);
|
|
|
|
|
|
|
1454 |
}
|
1455 |
|
1456 |
};
|
1457 |
|
|
|
1458 |
init_magic_tags();
|
1459 |
jQuery(document).trigger('bound.fields');
|
1460 |
jQuery('.caldera-header-save-button').prop("disabled", false);
|
1481 |
fields = jQuery('.caldera-config-field .required');
|
1482 |
}
|
1483 |
|
|
|
1484 |
fields.removeClass('has-error');
|
1485 |
field_elements.removeClass('has-error');
|
1486 |
nav_elements.removeClass('has-error');
|
1511 |
field.addClass('has-error');
|
1512 |
|
1513 |
all_clear = false;
|
|
|
1514 |
|
1515 |
}else{
|
1516 |
//unique
|
1535 |
}
|
1536 |
required_errors[panel.prop('id')] += 1;
|
1537 |
field.addClass('has-error');
|
1538 |
+
all_clear = false;
|
1539 |
+
break;
|
1540 |
+
}
|
1541 |
+
};
|
1542 |
+
}
|
1543 |
+
if( field.hasClass('toggle_value_field') ){
|
1544 |
+
var vals = field.closest('.caldera-config-group').find('.toggle_value_field').not(field);
|
1545 |
+
|
1546 |
+
for(var s = 0; s < vals.length; s++){
|
1547 |
+
if( vals[s].value === v.value ){
|
1548 |
+
var field = jQuery(vals[s]);
|
1549 |
+
|
1550 |
+
if(!required_errors[panel.prop('id')]){
|
1551 |
+
required_errors[panel.prop('id')] = 0;
|
1552 |
+
}
|
1553 |
+
var is_field = field.closest('.caldera-editor-field-config-wrapper'),
|
1554 |
+
is_process = field.closest('.caldera-editor-processor-config-wrapper');
|
1555 |
+
|
1556 |
+
if(is_field.length){
|
1557 |
+
jQuery('.layout-form-field[data-config="'+is_field.prop('id')+'"]').addClass('has-error');
|
1558 |
+
}
|
1559 |
+
if(is_process.length){
|
1560 |
+
jQuery('.'+is_process.prop('id')).addClass('has-error');
|
1561 |
+
}
|
1562 |
+
required_errors[panel.prop('id')] += 1;
|
1563 |
+
field.addClass('has-error');
|
1564 |
+
all_clear = false;
|
1565 |
break;
|
1566 |
}
|
1567 |
};
|
1570 |
});
|
1571 |
|
1572 |
for(var t in required_errors){
|
|
|
1573 |
jQuery('.caldera-forms-options-form').find('a[href="#' + t + '"]').append('<span class="error-tag">' + required_errors[t] + '</span>');
|
1574 |
}
|
1575 |
|
1585 |
}
|
1586 |
|
1587 |
add_page_grid = function(obj){
|
|
|
1588 |
var btn_count = $('.page-toggle').length + 1,
|
1589 |
button = $('<button type="button" data-name="Page ' + btn_count + '" data-page="' + obj.rawData.page_no + '" class="page-toggle button">' + obj.params.trigger.data('addtitle') + ' ' + btn_count + '</button> '),
|
1590 |
option_tab = $('#page-toggles');
|
1647 |
});
|
1648 |
}
|
1649 |
|
1650 |
+
function insert_new_field(newfield, target, field_default){
|
1651 |
var name = "fld_" + Math.round( Math.random() * 10000000 ),
|
1652 |
new_name = name,
|
1653 |
field_conf = $('#field_config_panels'),
|
1654 |
new_conf_templ,
|
1655 |
+
field_set;
|
1656 |
|
1657 |
+
newfield.prop('id', '').prop('title', '');
|
1658 |
+
|
1659 |
+
// field conf template
|
1660 |
+
new_conf_templ = Handlebars.compile( $('#caldera_field_config_wrapper_templ').html() );
|
1661 |
+
|
1662 |
+
field_set = $.extend({},{
|
|
|
|
|
1663 |
"id" : new_name,
|
1664 |
"label" : '',
|
1665 |
"slug" : ''
|
1666 |
+
}, field_default );
|
1667 |
+
// reset slug to blank
|
1668 |
+
field_set.slug = '';
|
1669 |
// pance new conf template
|
1670 |
+
field_conf.append( new_conf_templ( field_set ) );
|
1671 |
|
1672 |
newfield.
|
1673 |
removeClass('button-small').
|
1676 |
removeClass('ui-draggable').
|
1677 |
removeClass('layout-new-form-field').
|
1678 |
addClass('layout-form-field').
|
1679 |
+
attr('data-config', name).css({ 'display' : '', 'opacity' : '' });
|
1680 |
|
1681 |
newfield.find('.layout_field_name').remove();
|
1682 |
newfield.find('.field-location').prop('name', 'config[layout_grid][fields][' + name + ']');
|
1685 |
buildSortables();
|
1686 |
newfield.find('.icon-edit').trigger('click');
|
1687 |
|
|
|
|
|
|
|
|
|
|
|
|
|
1688 |
|
1689 |
+
$('#' + name + '_lable').focus().select();
|
1690 |
baldrickTriggers();
|
|
|
1691 |
$(document).trigger('field.added');
|
1692 |
+
if( field_default ){
|
1693 |
+
$('#' + new_name + '_type' ).data('type', field_set.type ).trigger('change');
|
1694 |
+
}else{
|
1695 |
+
$('#' + name).trigger('field.drop');
|
1696 |
+
}
|
1697 |
+
rebuild_field_binding();
|
1698 |
+
|
1699 |
}
|
1700 |
|
1701 |
function buildSortables(){
|
1741 |
$('.page-toggle.button').droppable({
|
1742 |
accept: ".layout-form-field",
|
1743 |
over: function(e, ui){
|
1744 |
+
$(this).trigger('click');
|
|
|
1745 |
$( ".layout-column" ).sortable("refresh");
|
1746 |
}
|
1747 |
});
|
1767 |
$('#grid-pages-panel').on('click','.column-fieldinsert .dashicons-plus-alt', function(e){
|
1768 |
//newfield-tool
|
1769 |
var target = $(this).closest('.column-container'),
|
1770 |
+
newfield = $('#newfield-tool').clone().css('display', '');
|
1771 |
|
1772 |
insert_new_field(newfield, target);
|
1773 |
|
1774 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1775 |
|
1776 |
$('#grid-pages-panel').on('click','.column-split', function(e){
|
1777 |
var column = $(this).parent().parent(),
|
1868 |
|
1869 |
|
1870 |
column.find('.layout-column').contents().appendTo(prev.find('.layout-column'));
|
1871 |
+
prev.attr('class', left.join('-'));
|
1872 |
column.remove();
|
1873 |
buildLayoutString();
|
1874 |
jQuery('.column-tools').remove();
|
1879 |
var setrow = jQuery(this);
|
1880 |
jQuery('.column-tools,.column-merge').remove();
|
1881 |
setrow.children().children().first().append('<div class="column-remove column-tools"><i class="icon-remove"></i></div>');
|
|
|
1882 |
setrow.children().children().last().append('<div class="column-sort column-tools" style="text-align:right;"><i class="dashicons dashicons-menu drag-handle sort-handle"></i></div>');
|
1883 |
|
1884 |
setrow.children().children().not(':first').prepend('<div class="column-merge"><div class="column-join column-tools"><i class="icon-join"></i></div></div>');
|
1923 |
left[2]--;
|
1924 |
right[2]++;
|
1925 |
if(left[2] > 0 && left[2] < (left[2]+right[2]) ){
|
1926 |
+
prev.attr('class', left.join('-'));
|
1927 |
+
column.attr('class', right.join('-'));
|
1928 |
ui.originalPosition.left = dragged.position().left;
|
|
|
1929 |
}else{
|
1930 |
$(this).draggable( "option", "disabled", true );
|
1931 |
}
|
1933 |
left[2]++;
|
1934 |
right[2]--;
|
1935 |
if(right[2] > 0 && right[2] < (right[2]+right[2]) ){
|
1936 |
+
prev.attr('class', left.join('-'));
|
1937 |
+
column.attr('class', right.join('-'));
|
1938 |
ui.originalPosition.left = dragged.position().left;
|
|
|
1939 |
}else{
|
1940 |
$(this).draggable( "option", "disabled", true );
|
1941 |
}
|
1967 |
config.slideUp(100, function(){
|
1968 |
$(this).remove();
|
1969 |
});
|
|
|
|
|
|
|
|
|
|
|
1970 |
});
|
1971 |
+
$( document ).on('click', '.layout-form-field .dashicons-admin-page', function(){
|
1972 |
+
var clicked = $( this ),
|
1973 |
+
wrap = clicked.parent(),
|
1974 |
+
clone_id = wrap.data('config'),
|
1975 |
+
clone = $('#' + clone_id ).formJSON(),
|
1976 |
+
target = clicked.closest('.column-container'),
|
1977 |
+
newfield = wrap.clone().css('display', ''),
|
1978 |
+
new_params = {};
|
1979 |
+
|
1980 |
+
if( wrap.hasClass('field-edit-open') ){
|
1981 |
+
wrap.removeClass('field-edit-open');
|
1982 |
+
newfield.removeClass('field-edit-open');
|
1983 |
+
$('.caldera-editor-field-config-wrapper').hide();
|
1984 |
+
}
|
1985 |
|
1986 |
+
if( clone.config.fields[ clone_id ] ){
|
1987 |
+
new_params = clone.config.fields[ clone_id ];
|
1988 |
+
delete new_params.ID;
|
1989 |
+
}
|
1990 |
|
1991 |
+
insert_new_field(newfield, target, new_params);
|
1992 |
+
})
|
1993 |
+
$( document ).on('click', '.layout-form-field .icon-edit', function(){
|
1994 |
var clicked = $(this),
|
1995 |
panel = clicked.parent(),
|
1996 |
type = $('#' + panel.data('config') +'_type').val();
|
2007 |
|
2008 |
$(document).trigger('show.' + panel.data('config'));
|
2009 |
$(document).trigger('show.fieldedit');
|
2010 |
+
|
2011 |
if( type === 'radio' || type === 'checkbox' || type === 'dropdown' || type === 'toggle_switch' ){
|
2012 |
$('#' + panel.data('config') + '_auto').trigger('change');
|
2013 |
}
|
2143 |
|
2144 |
if(clicked.data('options')){
|
2145 |
var batchinput = $(clicked.data('options')),
|
2146 |
+
batch = batchinput.val().split("\n"),
|
2147 |
+
has_vals = false;
|
2148 |
for( var i = 0; i < batch.length; i ++){
|
2149 |
+
var label = batch[i],
|
2150 |
+
val = label,
|
2151 |
+
parts = val.split('|');
|
2152 |
+
if( parts.length > 1 ){
|
2153 |
+
val = parts[0];
|
2154 |
+
label = parts[1];
|
2155 |
+
has_vals = true;
|
2156 |
+
}
|
2157 |
config.option["opt" + parseInt( ( Math.random() + i ) * 0x100000 )] = {
|
2158 |
+
value : val,
|
2159 |
+
label : label,
|
2160 |
default : false
|
2161 |
}
|
2162 |
}
|
2163 |
$(clicked.data('options')).parent().hide();
|
2164 |
batchinput.val('');
|
2165 |
+
if( true === has_vals ){
|
2166 |
+
wrapper.find('.toggle_show_values').prop( 'checked', true );
|
2167 |
+
}else{
|
2168 |
+
wrapper.find('.toggle_show_values').prop( 'checked', false );
|
2169 |
+
}
|
2170 |
toggle_rows.empty();
|
2171 |
}else{
|
2172 |
// add new option
|
2176 |
default : false
|
2177 |
};
|
2178 |
}
|
2179 |
+
$('.preset_options').val('');
|
2180 |
// place new row
|
2181 |
toggle_rows.append( template( config ) );
|
2182 |
wrapper.find('.toggle_show_values').trigger('change');
|
2189 |
toggle_rows.find('.toggle_label_field').last().focus();
|
2190 |
}
|
2191 |
});
|
2192 |
+
// presets
|
2193 |
+
$('.caldera-editor-body').on('change', '.preset_options', function(e){
|
2194 |
+
var select = $( this ),
|
2195 |
+
preset = select.val(),
|
2196 |
+
batch = $( select.data('bulk') );
|
2197 |
+
|
2198 |
+
if( preset_options && preset_options[ preset ] && preset_options[ preset ].data ){
|
2199 |
+
if( typeof preset_options[ preset ].data === 'object' ){
|
2200 |
+
if( preset_options[ preset ].data.length ){
|
2201 |
+
preset_options[ preset ].data = preset_options[ preset ].data.join("\n");
|
2202 |
+
}else{
|
2203 |
|
2204 |
+
}
|
2205 |
+
}
|
2206 |
+
batch.val( preset_options[ preset ].data );
|
2207 |
+
}
|
2208 |
+
});
|
2209 |
// remove an option row
|
2210 |
$('.caldera-editor-body').on('click', '.toggle-remove-option', function(e){
|
2211 |
var triggerfield = $(this).closest('.caldera-editor-field-config-wrapper').find('.field-config').first();
|
2212 |
$(this).parent().remove();
|
2213 |
triggerfield.trigger('change');
|
2214 |
+
$(document).trigger('option.remove');
|
2215 |
});
|
2216 |
|
2217 |
$('.caldera-editor-body').on('click', '.page-toggle', function(e){
|
2245 |
value.val(label.val());
|
2246 |
});
|
2247 |
|
|
|
|
|
|
|
|
|
|
|
2248 |
|
2249 |
+
$( document ).on('change focusout', '.toggle_value_field', function(){
|
2250 |
+
$( document ).trigger('show.fieldedit');
|
2251 |
+
});
|
2252 |
+
|
2253 |
+
$( document ).on('show.fieldedit option.remove', function(e){
|
2254 |
+
$('.toggle_value_field.has-error').removeClass('has-error');
|
2255 |
+
var field = $( '#' + $('.layout-form-field.field-edit-open').data('config') ),
|
2256 |
+
options = field.find('.toggle_value_field'),
|
2257 |
+
notice = field.find('.notice'),
|
2258 |
+
count = 0;
|
2259 |
+
|
2260 |
+
for( var i = 0; i < options.length; i++ ){
|
2261 |
+
var option = options[ i ].value,
|
2262 |
+
repeats = 0;
|
2263 |
+
for( var f = 0; f < options.length; f++ ){
|
2264 |
+
if( options[ i ] === options[ f ] ){ continue; }
|
2265 |
+
|
2266 |
+
if( options[ i ].value === options[ f ].value ){
|
2267 |
+
$( options[ f ] ).addClass('has-error');
|
2268 |
+
repeats++;
|
2269 |
+
}
|
2270 |
+
}
|
2271 |
+
if( repeats > 0 ){
|
2272 |
+
$( options[ i ] ).addClass('has-error');
|
2273 |
+
count++;
|
2274 |
+
}
|
2275 |
+
}
|
2276 |
|
2277 |
+
if( count > 0 ){
|
2278 |
+
notice.slideDown();
|
2279 |
+
e.preventDefault();
|
2280 |
+
}else{
|
2281 |
+
notice.slideUp();
|
2282 |
+
}
|
2283 |
|
2284 |
+
})
|
2285 |
+
var is_pulsating = false, pulsing_adders;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2286 |
|
2287 |
+
focus_initial_field = function(e){
|
2288 |
+
var field = $('.layout-grid-panel .icon-edit').first();
|
2289 |
+
if( field.length ){
|
2290 |
+
field.trigger('click');
|
2291 |
+
}else{
|
2292 |
+
$('.layout-column.column-container').first().trigger('mouseover');
|
2293 |
+
is_pulsating = setInterval( pulsate_adders, 500 );
|
2294 |
+
}
|
2295 |
+
$( document ).off('load.page', focus_initial_field );
|
2296 |
+
};
|
2297 |
+
$( document ).on('load.page', focus_initial_field );
|
2298 |
+
function pulsate_adders(){
|
2299 |
+
|
2300 |
+
if( is_pulsating ){
|
2301 |
+
var adders = $('.column-fieldinsert');
|
2302 |
+
if( adders.length ){
|
2303 |
+
adders.stop().fadeToggle(700);
|
2304 |
+
$('.layout-new-form-field').stop().fadeToggle(700);
|
2305 |
+
}else{
|
2306 |
+
cf_clear_puler();
|
2307 |
+
}
|
2308 |
+
}
|
2309 |
+
}
|
2310 |
+
|
2311 |
+
cf_clear_puler = function(){
|
2312 |
+
if( is_pulsating ){
|
2313 |
+
clearTimeout( is_pulsating );
|
2314 |
+
$(document).off('mouseover', '.layout-new-form-field, .column-fieldinsert', cf_clear_puler);
|
2315 |
+
}
|
2316 |
+
$('.layout-new-form-field, .column-fieldinsert').fadeIn();
|
2317 |
+
};
|
2318 |
+
$(document).on('mouseover', '.layout-new-form-field, .column-fieldinsert', cf_clear_puler );
|
2319 |
+
// build fild bindings
|
2320 |
+
rebuild_field_binding();
|
2321 |
+
$(document).trigger('load.page');
|
2322 |
|
2323 |
+
// build processor sortables
|
2324 |
+
function build_processor_sortables(){
|
2325 |
// set sortable groups
|
2326 |
$( ".caldera-editor-processors-panel ul" ).sortable({
|
2327 |
update: function(){
|
2369 |
$('#form_processor_baldrickModalCloser').trigger('click');
|
2370 |
$('.caldera-processor-nav a').last().trigger('click');
|
2371 |
$('#fp_' + processid + '_type').val(clicked.data('type')).trigger('change');
|
2372 |
+
build_processor_sortables();
|
|
|
2373 |
|
2374 |
baldrickTriggers();
|
2375 |
});
|
2390 |
|
2391 |
$('.caldera-processor-nav a').first().trigger('click');
|
2392 |
|
|
|
2393 |
rebuild_field_binding();
|
2394 |
|
2395 |
});
|
2412 |
// get config
|
2413 |
build_processor_config(this);
|
2414 |
|
|
|
2415 |
rebuild_field_binding();
|
2416 |
|
2417 |
});
|
2418 |
+
$( document ).on('click', '#cf-shortcode-preview', function(){
|
2419 |
+
$(this).focus().select();
|
2420 |
+
} );
|
2421 |
+
$( document ).on('change', '.cf-email-preview-toggle', function(){
|
2422 |
+
var clicked = $(this),
|
2423 |
+
preview_button = $('.caldera-header-email-preview-button');
|
2424 |
+
if( clicked.is(':checked') ){
|
2425 |
+
preview_button.show().attr( 'aria-hidden', 'false' ).css( 'visibility', 'visible' );
|
2426 |
+
}else{
|
2427 |
+
preview_button.hide().attr( 'aria-hidden', 'true' ).css( 'visibility', 'hidden' );
|
2428 |
+
}
|
2429 |
+
|
2430 |
+
} );
|
2431 |
|
2432 |
|
2433 |
// build processor type config
|
2498 |
|
2499 |
// build configs on load:
|
2500 |
// allows us to keep changes on reload as not to loose settings on accedental navigation
|
|
|
2501 |
rebuild_field_binding();
|
2502 |
|
2503 |
$('.caldera-select-processor-type').each(function(k,v){
|
2505 |
});
|
2506 |
|
2507 |
|
2508 |
+
build_processor_sortables();
|
2509 |
});//
|
2510 |
|
2511 |
|
2530 |
}
|
2531 |
|
2532 |
out = '<select ' + ( args.hash.type ? 'data-type="' + args.hash.type + '"' : '' ) + default_val +' ' + exclude + ' name="' + this._name + '[' + args.hash.slug + ']' + is_array + '" id="' + this._id + '_' + args.hash.slug + '" class="block-input field-config caldera-field-bind' + required + '">';
|
|
|
2533 |
if(this[args.hash.slug]){
|
2534 |
out += '<option class="bound-field" value="' + this[args.hash.slug] + '" class="bound-field"></option>';
|
2535 |
}else{
|
assets/js/edit.min.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
function new_conditional_group(e){var a=e.trigger.data("id"),i="cl"+Math.round(18746582734*Math.random()),t="rw"+Math.round(98347598345*Math.random()),r=[{id:t,type:e.trigger.data("type"),lines:[{id:i}]}];return{group:r,id:a}}function new_conditional_line(e){var a=e.trigger.data("id"),i=e.trigger.data("group"),t=e.trigger.data("type"),r="cl"+Math.round(18746582734*Math.random()),o={id:a,type:t,lineid:r,rowid:i,name:"config["+t+"]["+a+"][conditions][group]["+i+"]["+r+"]"};return o}function build_conditions_config(e){var a=JSON.parse(e.trigger.val());return a.id=e.trigger.data("id"),a}function setup_field_type(e){return{id:e.trigger.prop("id")}}function check_required_bindings(e){var a,i=(jQuery(".caldera-header-save-button"),jQuery(".layout-form-field")),t=jQuery(".caldera-processor-nav"),r=!0;a=e?jQuery(e):jQuery(".caldera-config-field .required"),a.removeClass("has-error"),i.removeClass("has-error"),t.removeClass("has-error"),jQuery(".error-tag").remove(),required_errors={},a.each(function(e,a){var i=jQuery(a),t=i.closest(".caldera-config-editor-panel");if(a.value.length){if(i.hasClass("field-slug"))for(var o=jQuery(".field-slug").not(i),l=0;l<o.length;l++)if(o[l].value===a.value){var i=jQuery(o[l]);required_errors[t.prop("id")]||(required_errors[t.prop("id")]=0);var n=i.closest(".caldera-editor-field-config-wrapper"),d=i.closest(".caldera-editor-processor-config-wrapper");n.length&&jQuery('.layout-form-field[data-config="'+n.prop("id")+'"]').addClass("has-error"),d.length&&jQuery("."+d.prop("id")).addClass("has-error"),required_errors[t.prop("id")]+=1,i.addClass("has-error");break}}else{required_errors[t.prop("id")]||(required_errors[t.prop("id")]=0);var n=i.closest(".caldera-editor-field-config-wrapper"),d=i.closest(".caldera-editor-processor-config-wrapper");n.length&&jQuery('.layout-form-field[data-config="'+n.prop("id")+'"]').addClass("has-error"),d.length&&jQuery("."+d.prop("id")).addClass("has-error"),required_errors[t.prop("id")]+=1,i.addClass("has-error"),r=!1}});for(var o in required_errors)jQuery(".caldera-forms-options-form").find('a[href="#'+o+'"]').append('<span class="error-tag">'+required_errors[o]+"</span>");return jQuery(".caldera-conditional-field-set").trigger("change"),r}jQuery(document).ready(function(e){function a(a){var t=e(a),r=t.closest(".caldera-editor-field-config-wrapper"),o=r.find(".caldera-config-field-setup"),l=compiled_templates[t.val()+"_tmpl"]?compiled_templates[t.val()+"_tmpl"]:compiled_templates.noconfig_field_templ,n=r.find(".field_config_string").val(),d=t.data("type");if(r.find(".caldera-config-group").show(),t.addClass("field-initialized"),n=n.length&&d===t.val()?JSON.parse(n):fieldtype_defaults[t.val()+"_cfg"],n||(n={}),n._id=t.data("field"),n._name="config[fields]["+t.data("field")+"][config]",l=e("<div>").html(l(n)),o.html(l.html()),"function"==typeof window[t.val()+"_init"]&&window[t.val()+"_init"](t.data("field"),o),fieldtype_defaults[t.val()+"_nosupport"]&&(fieldtype_defaults[t.val()+"_nosupport"].indexOf("hide_label")>=0&&r.find(".hide-label-field").hide().find(".field-config").prop("checked",!1),fieldtype_defaults[t.val()+"_nosupport"].indexOf("caption")>=0&&r.find(".caption-field").hide().find(".field-config").val(""),fieldtype_defaults[t.val()+"_nosupport"].indexOf("required")>=0&&r.find(".required-field").hide().find(".field-config").prop("checked",!1),fieldtype_defaults[t.val()+"_nosupport"].indexOf("custom_class")>=0&&r.find(".customclass-field").hide().find(".field-config").val(""),fieldtype_defaults[t.val()+"_nosupport"].indexOf("entry_list")>=0&&r.find(".entrylist-field").hide().find(".field-config").prop("checked",!1)),r.find(".toggle_show_values").trigger("change"),!e(".caldera-select-field-type").not(".field-initialized").length){if(core_form.hasClass("builder-loaded"))i(t.data("field"));else{for(var s=e(".caldera-select-field-type.field-initialized"),c=0;c<s.length;c++)i(e(s[c]).data("field"));core_form.addClass("builder-loaded")}e(".caldera-header-save-button").prop("disabled",!1),rebuild_field_binding(),baldrickTriggers()}e(".color-field").length&&e(".color-field").wpColorPicker({change:function(a){var i=e(this);i.data("ev")&&clearTimeout(i.data("ev")),i.data("ev",setTimeout(function(){i.trigger("record")},200)),i.data("target")&&(e(i.data("target")).css(i.data("style"),i.val()),e(i.data("target")).val(i.val()))}})}function i(a){var i=e("#"+a),t=i.find(".caldera-select-field-type"),r=e('.layout-form-field[data-config="'+a+'"]'),o=r.find(".field_preview"),l=(e("#preview-"+t.val()+"_tmpl").html(),compiled_templates["preview-"+t.val()+"_tmpl"]),n={id:a},d=i.find(".field-config");d.each(function(i,t){for(var r=e(t),o=r.prop("name").split("["+a+"]")[1].substr(1),l=o.substr(0,o.length-1).split("]["),d=r.is(":checkbox,:radio")?r.filter(":checked").val():r.val(),s={},c=l.length-1;c>=0;c--)if(c===l.length-1)s[l[c]]=d;else{var p=s;s={},s[l[c]]=p}e.extend(!0,n,s)}),o.html(l(n)),r.removeClass("button"),e(".preview-field-config").prop("disabled",!0)}function t(a){var i,t=e(".caldera-editor-fields-panel"),r=(e(".caldera-editor-groups-panel"),e(".caldera-group-nav")),o=e('[data-group="'+a+'"]'),l=o.find(".caldera-config-group-name"),n=o.find(".caldera-config-group-slug"),d=o.find(".caldera-config-group-desc"),s=o.find(".caldera-config-group-admin"),c=e(".active-group-name"),p=e(".active-group-slug"),u=e(".active-group-desc"),f=e(".active-group-admin"),g=e(".caldera-editor-fields-list ul"),v=o.find(".caldera-config-group-repeat"),h=e(".repeat-config-button"),m=(e(".caldera-editor-group-settings"),e(".caldera-config-group-remove"));e(".new-group-input").remove(),e(".new-field-input").remove(),r.removeClass("active"),t.show(),g.hide(),g.removeClass("active").find("li.active").removeClass("active"),g.hide(),o.addClass("active"),i=e(".caldera-editor-fields-list ul.active li"),i.length?m.hide():m.show(),e(".caldera-editor-field-config-wrapper").hide(),o.show(),c.val(l.val()),p.val(n.val()),u.val(d.val()),"1"===s.val()?f.prop("checked",!0):f.prop("checked",!1),"1"===v.val()?h.addClass("field-edit-open"):h.removeClass("field-edit-open")}e(".caldera-header-save-button").baldrick({method:"POST",request:"admin.php?page=caldera-forms",before:function(a,i){if(i.preventDefault(),!check_required_bindings())return!1;e("#save_indicator").addClass("loading"),"undefined"!=typeof tinyMCE&&tinyMCE.triggerSave();var t=e(".caldera-forms-options-form").formJSON();return t.conditions&&(t.config.conditional_groups={conditions:t.conditions}),e(a).data("cf_edit_nonce",t.cf_edit_nonce),e(a).data("_wp_http_referer",t._wp_http_referer),e(a).data("sender","ajax"),e(a).data("config",JSON.stringify(t.config)),!0},callback:function(a){if(!1===a.data){var i=e(".updated_notice_box");i.stop().animate({top:0},200,function(){setTimeout(function(){i.stop().animate({top:-75},200)},2e3)})}},complete:function(a){e(".wrapper-instance-pane .field-config").prop("disabled",!1)}}),e("body").on("click",".toggle_processor_event input",function(a){var i=e(this),t=i.closest(".wrapper-instance-pane"),r=t.find(".caldera-config-processor-setup"),o=t.find(".caldera-config-processor-notice");i.is(":checked")?(i.parent().addClass("activated"),i.parent().find(".is_active").show(),i.parent().find(".not_active").hide()):(i.parent().removeClass("activated"),i.parent().find(".is_active").hide(),i.parent().find(".not_active").show()),t.find(".toggle_processor_event .activated").length?(r.slideDown(100),o.slideUp(100)):(r.slideUp(100),o.slideDown(100))}),e("body").on("click",".toggle_option_tab > a",function(a){a.preventDefault();var i=e(this),t=e(i.attr("href")),r=i.parent().find("a"),o=i.closest(".caldera-editor-config-wrapper").find(".wrapper-instance-pane");r.removeClass("button-primary"),o.hide(),t.show(),i.addClass("button-primary"),e(".caldera-conditionals-usetype").trigger("change")}),e(".caldera-editor-body").on("change",".caldera-select-field-type",function(e){a(this)}),e(".caldera-editor-body").on("click",".caldera-group-nav a",function(a){a.preventDefault(),t(e(this).attr("href").substr(1))}),e(".caldera-editor-body").on("click",".caldera-editor-fields-list a",function(a){a.preventDefault();var i=e(this),t=e(i.attr("href"));e(".new-group-input").remove(),e(".new-field-input").remove(),e(".caldera-editor-fields-list li.active").removeClass("active"),i.parent().addClass("active"),e(".caldera-editor-field-config-wrapper").hide(),t.show()}),e(".caldera-editor-body").on("click",".group-config-button",function(a){var i=e(this),t=e(".caldera-editor-group-settings"),r=i.closest(".caldera-editor-fields-panel"),o=e(".caldera-config-group-remove");r.find(".caldera-field-line").length?o.hide():o.show(),i.hasClass("field-edit-open")?(t.slideUp(100),i.removeClass("field-edit-open")):(t.slideDown(100),i.addClass("field-edit-open"))}),e(".caldera-editor-body").on("keydown",".field-config",function(a){e(this).is("textarea")||13===a.which&&a.preventDefault()}),e(".caldera-editor-body").on("change",".field-label",function(a){var i=e(this).closest(".caldera-editor-field-config-wrapper").prop("id");field_line=e('[data-field="'+i+'"]'),field_title=e("#"+i+" .caldera-editor-field-title, .layout-form-field.field-edit-open .layout_field_name"),slug=e("#"+i+" .field-slug"),field_line.find("a").html('<i class="icn-field"></i> '+this.value),field_title.text(this.value),"change"===a.type&&slug.trigger("change"),rebuild_field_binding()}),e(".caldera-editor-body").on("change",".active-group-name",function(a){a.preventDefault();var i=e(".caldera-group-nav.active"),t=(i.data("group"),i.find(".caldera-config-group-name")),r=i.find("span");"focusout"!==a.type||this.value.length||(this.value="Group "+(parseInt(i.index())+1)),t.val(this.value),r.text(this.value)}),e(".caldera-editor-body").on("change",".active-group-slug",function(a){a.preventDefault();var i=e(".caldera-group-nav.active"),t=(i.data("group"),i.find(".caldera-config-group-name").val()),r=i.find(".caldera-config-group-slug"),o=(i.find("span"),this.value.split(" ").join("_").split("-").join("_").replace(/[^a-z0-9_]/gi,"").toLowerCase());"focusout"!==a.type||this.value.length||(o=t.split(" ").join("_").split("-").join("_").replace(/[^a-z0-9_]/gi,"").toLowerCase()),r.val(o),this.value=o}),e(".caldera-editor-body").on("change",".active-group-desc",function(a){a.preventDefault();var i=e(".caldera-group-nav.active"),t=(i.data("group"),i.find(".caldera-config-group-desc"));t.val(this.value)}),e(".caldera-editor-body").on("change",".active-group-admin",function(a){a.preventDefault();var i=e(".caldera-group-nav.active"),t=(i.data("group"),i.find(".caldera-config-group-name").val(),i.find(".caldera-config-group-admin"));i.find("span"),this.value.split(" ").join("_").split("-").join("_").replace(/[^a-z0-9_]/gi,"").toLowerCase();e(this).prop("checked")?(t.val(1),i.addClass("is-admin")):(t.val(0),i.removeClass("is-admin"))}),e(".caldera-editor-body").on("click",".repeat-config-button",function(a){a.preventDefault();var i=e(".caldera-group-nav.active"),t=(i.data("group"),i.find("a .group-type")),r=i.find(".caldera-config-group-repeat"),o=e(this);o.hasClass("field-edit-open")?(r.val("0"),t.removeClass("icn-repeat").addClass("icn-folder"),o.removeClass("field-edit-open")):(r.val("1"),t.addClass("icn-repeat").removeClass("icn-folder"),o.addClass("field-edit-open"))}),e(".caldera-editor-body").on("click",".delete-field",function(){var a=e(this),i=a.closest(".caldera-editor-field-config-wrapper").prop("id");confirm(a.data("confirm"))&&(e("#"+i).remove(),e('option[value="'+i+'"]').remove(),e('[data-bind="'+i+'"]').remove(),delete current_form_fields[i],e('[data-config="'+i+'"]').slideUp(200,function(){var a=e(this);a.remove(),rebuild_field_binding(),e(document).trigger("field.removed")}))}),e(".caldera-editor-body").on("click",".add-new-group,.add-field",function(){var a=e(this);if(e(".new-group-input").remove(),e(".new-field-input").remove(),a.hasClass("add-field")){var i=e('<input type="text" class="new-field-input block-input">');i.appendTo(e(".caldera-editor-fields-list ul.active")).focus()}else{var t=e('<input type="text" class="new-group-input block-input">');t.appendTo(e(".caldera-editor-groups-panel")).focus()}}),e(".caldera-editor-body").on("change keypress",".new-group-input",function(a){if("keypress"===a.type){if(13!==a.which)return;a.preventDefault()}var i,r,o=this.value,l=e(this),n=e(".caldera-editor-groups-panel ul"),d=e(".caldera-editor-fields-list");if(o.length){i=Handlebars.compile(e("#caldera_group_line_templ").html()),r={id:o.split(" ").join("_").split("-").join("_").replace(/[^a-z0-9_]/gi,"").toLowerCase(),name:o},n.append(i(r));var s=e('<ul data-group="'+r.id+'">').hide();s.appendTo(d),l.remove(),t(r.id)}else l.remove()}),e(".caldera-editor-body").on("change keypress",".new-field-input",function(a){if("keypress"===a.type){if(13!==a.which)return;a.preventDefault()}var i,t,r,o=this.value,l=e(this),n=l.parent(),d=e(".caldera-editor-field-config"),s=e(".caldera-config-group-remove");if(o.length){s.hide(),i=Handlebars.compile(e("#caldera_field_line_templ").html()),t=Handlebars.compile(e("#caldera_field_config_wrapper_templ").html()),r={id:o.split(" ").join("_").split("-").join("_").replace(/[^a-z0-9_]/gi,"").toLowerCase(),label:o,slug:o.split(" ").join("_").split("-").join("_").replace(/[^a-z0-9_]/gi,"").toLowerCase(),group:e(".caldera-group-nav.active").data("group")};var c=e(i(r));c.appendTo(n),d.append(t(r)),c.find("a").trigger("click"),l.remove()}else l.remove()}),e(".caldera-editor-body").on("change",".field-slug",function(a){this.value.length?this.value=this.value.split(" ").join("_").split("-").join("_").replace(/[^a-z0-9_]/gi,"").toLowerCase():"change"===a.type&&(this.value=e(this).closest(".caldera-editor-field-config-wrapper").find(".field-label").val().split(" ").join("_").split("-").join("_").replace(/[^a-z0-9_]/gi,"").toLowerCase())}),e(".caldera-editor-body").on("click",".caldera-add-group",function(a){var i=e(this),t=i.data("group"),r=e("#"+t+"_panel_tmpl").html();i.parent().parent().append(r)}),e(".caldera-editor-body").on("click",".caldera-config-group-remove",function(a){var i=e(".active-group-slug").val();e('[data-group="'+i+'"]').hide(0,function(){e(this).remove();var a=e(".caldera-group-nav");a.length?a.first().find("a").trigger("click"):e(".caldera-editor-fields-panel").hide()})}),e("body").on("click",".set-current-field",function(a){a.preventDefault();var i=e(this);e("#"+i.data("field")+"_type").val(i.data("type")).trigger("change"),e("#"+i.data("field")+"_lable").focus(),e("#field_setup_baldrickModalCloser").trigger("click")}),e(".caldera-editor-body").on("change record",".field-config",function(a){var t=e(this),r=t.closest(".caldera-editor-field-config-wrapper");current_form_fields&&(t.prop("id")===r.prop("id")+"_lable"&&(current_form_fields[r.prop("id")].label=this.value),t.prop("id")===r.prop("id")+"_slug"&&(current_form_fields[r.prop("id")].slug=this.value),t.prop("id")===r.prop("id")+"_type"&&(current_form_fields[r.prop("id")].type=this.value),r.length&&i(r.prop("id")))}),e(".caldera-editor-body").on("focus",".caldera-field-bind",function(a){var i=e(this),t=this.value;return a.type&&"focusin"===a.type?(i.removeClass("bound_field").addClass("reload-binding"),rebind_field_bindings(),void(this.value=t)):void 0}),e(".caldera-editor-body").on("change",".caldera-conditional-field-set",function(a){var i,t,r=e(this),o=r.parent().find(".compare-type"),l=r.data("condition"),n=r.data("id"),d="config["+l+"]["+n+"][conditions][group]["+r.data("row")+"]["+r.data("line")+"]",s=r.data("line"),c=e("#"+s+"_value"),p=c.find(".caldera-conditional-value-field").first(),u=[],f=this.value;if("{"!==f.substr(0,1)&&(i=e("#"+f),t=i.find(".field-button-type"),u=i.find(".caldera-config-group-toggle-options")),r.hasClass(".bind_init")&&r.addClass("bound_triggered"),p.length&&p.val().length&&c.data("value",p.val()),o.show(),u.length){var g=u.find(".toggle_option_row"),v='<select name="'+d+'[value]" class="caldera-processor-value-bind caldera-conditional-value-field" data-field="'+f+'" style="max-width: 220px; width: 220px;">';v+='<option value=""></option>',g.each(function(a,i){var t=e(i).find(".toggle_label_field"),r=t.data("option"),o="";c.data("value")&&(c.data("value").toString()!==r&&c.data("value").toString()!==e(i).find(".toggle_value_field").val()||(o=' selected="selected"')),v+='<option value="'+r+'"'+o+">"+t.val()+"</option>"}),v+="</select>"}else t&&"button"==t.val()?(o.val("is").hide(),v='<select name="'+d+'[value]" class="caldera-processor-value-bind caldera-conditional-value-field" data-field="'+f+'" style="max-width: 220px; width: 220px;">',v+='<option value="click" '+("click"===c.data("value")?'selected="selected"':"")+">Click</option>",v+='<option value="dblclick" '+("dblclick"===c.data("value")?'selected="selected"':"")+">Double Click</option>",v+="</select>"):v='<input name="'+d+'[value]" type="text" class="caldera-conditional-value-field magic-tag-enabled" value="'+(c.data("value")?c.data("value"):"")+'" style="max-width: 205px;">';c.html(v),init_magic_tags()}),e(".caldera-editor-body").on("change",".caldera-conditionals-usetype",function(a){var i=e(this);"show"===this.value||"hide"===this.value||"disable"===this.value||"use"===this.value||"not"===this.value?(e("#"+i.data("id")+"_condition_group_add").show(),e("#"+i.data("id")+"_conditional_wrap").show()):(e("#"+i.data("id")+"_condition_group_add").hide(),e("#"+i.data("id")+"_conditional_wrap").hide())}),e(".caldera-editor-body").on("click",".remove-conditional-line",function(a){a.preventDefault();var i=e(this),t=i.closest(".caldera-condition-line"),r=i.closest(".caldera-condition-group");t.remove(),r.find(".caldera-condition-line").length||r.remove()}),e(".caldera-group-nav").first().find("a").trigger("click"),e(".caldera-editor-body").on("change",".toggle_show_values",function(a){var i=e(this),t=i.closest(".caldera-config-group-toggle-options");values=t.find(".toggle_value_field"),lables=t.find(".toggle_label_field"),field_lables=t.find(".caldera-config-group-option-labels"),i.prop("checked")?(values.show().parent().show(),values.show().parent().parent().show(),lables.css("width",""),field_lables.show()):(values.hide().parent().hide(),lables.css("width",245),field_lables.hide()),lables.trigger("toggle.values"),init_magic_tags()}),e(".caldera-editor-body").on("change",".auto-populate-type",function(){e(this).closest(".wrapper-instance-pane").find(".auto-populate-options").trigger("change")}),e(".caldera-editor-body").on("change",".auto-populate-options",function(){var a=e(this),i=a.closest(".wrapper-instance-pane"),t=i.find(".caldera-config-group-toggle-options"),r=i.find(".caldera-config-group-auto-options"),o=r.find(".auto-populate-type");r.find(".auto-populate-type-panel").hide(),a.prop("checked")?(t.hide(),r.show()):(t.show(),r.hide()),r.find(".caldera-config-group-auto-"+o.val()).show()}),e("body").on("change",".pin-toggle-roles",function(){var a=e(this),i=e("#caldera-pin-rules");"1"===a.val()?i.show():i.hide()}),e("body").on("click",".magic-tag-init",function(a){var i=e(this),t=i.prev();t.focus().trigger("init.magic")}),e("body").on("keyup blur focus select click init.magic",".magic-tag-enabled",function(a){init_magic_tags();var i=e(this),t=i.parent(),r=t.closest(".wrapper-instance-pane").find(".caldera-select-field-type").val()?t.closest(".wrapper-instance-pane").find(".caldera-select-field-type").val():"hidden",o=t.find(".magic-tags-autocomplete"),l=o.find("ul"),n=this.value,d=[],s="",c=this.selectionStart,p=this.selectionEnd;if(o.length&&o.data("focus"))return void a.preventDefault();if(i.data("tag",""),this.selectionEnd>this.selectionStart)s=this.value.substr(this.selectionStart,this.selectionEnd-this.selectionStart);else if(("select"===a.type||"keyup"===a.type)&&40!==a.which&&38!==a.which&&39!==a.which&&37!==a.which){for(c=this.selectionStart;c>0;c--){var u=n.substr(c-1,1);if(" "===u||"\n"===u||("%"===u||"}"===u)&&this.selectionStart===c)break}for(p=this.selectionStart;p<n.length;p++){var u=n.substr(p,1);if(" "===u||"\n"===u||("%"===u||"{"===u)&&this.selectionStart===p)break}s=n.substr(c,p-c)}if("focusout"!==a.type){if("init"!==a.type&&s.length<3)return void(o.length&&o.remove());o.length||(o=e('<div class="magic-tags-autocomplete"></div>'),l=e("<ul></ul>"),l.appendTo(o),o.insertAfter(i),o.on("mouseenter",function(){e(this).data("focus",!0)}),o.on("mouseleave",function(){e(this).data("focus",!1),i.is(":focus")||i.trigger("focusout")})),l.empty();var f="system",g=!1;"hidden"===r||"dropdown"===r||"radio"===r||"toggle_switch"===r||"checkbox"===r?(g=!0,r="text",f="all"):"paragraph"!==r&&"html"!==r||(r="text"),i.data("type")&&(r=i.data("type")),r=r.split(","),r.push("vars");for(var v=0;v<r.length;v++)for(var h in system_values)if("undefined"!=typeof system_values[h].tags[r[v]]){if(d=[h],"system"!==h&&"variable"!==h&&"field"!==h){var m=jQuery(".processor-"+h),_=i.closest(".caldera-editor-processor-config-wrapper"),y=_.prop("id");d=[];for(var b=0;b<m.length;b++)if(_.length||g!==!0){if(y===m[b].id)continue;jQuery("li."+m[b].id).index()<jQuery("li."+y).index()&&d.push(m[b].id)}else d.push(m[b].id)}for(var w=0;w<d.length;w++)if("all"===f||f===h||"variable"===h){var k=e('<li class="header">'+system_values[h].type+(w>0?" ["+(w+1)+"]":"")+"</li>"),C=0;k.appendTo(l);for(var j=0;j<system_values[h].tags[r[v]].length;j++)if(!i.data("parent")||"variable:"+i.data("parent")!==system_values[h].tags[r[v]][j]){var x=system_values[h].wrap[0]+system_values[h].tags[r[v]][j]+system_values[h].wrap[1];if(d[w]!==h&&d.length>1&&(x=system_values[h].wrap[0]+system_values[h].tags[r[v]][j]+":"+d[w]+system_values[h].wrap[1]),x.indexOf(s)>=0||"init"===a.type){C+=1;var Q=x.replace(s,"<strong>"+s+"</strong>"),q=e('<li class="tag" data-tag="'+x+'">'+Q+"</li>");q.on("click",function(){var a=e(this).data("tag");i.val(n.substr(0,c)+a+n.substr(p)).trigger("change").focus(),i[0].selectionStart=c+a.length-(a.indexOf("*")>0?2:0),i[0].selectionEnd=c+a.length-(a.indexOf("*")>0?1:0),p=c=i[0].selectionEnd,n+=a,i.trigger("init.magic")}),q.appendTo(l)}}0===C&&k.remove()}}}l.children().length||o.remove(),"focusout"===a.type&&setTimeout(function(){o.remove()},200)});for(var r=e(".cf-editor-template"),o=0;o<r.length;o++)compiled_templates[r[o].id]=Handlebars.compile(r[o].innerHTML);e(".caldera-select-field-type").not(".field-initialized").each(function(e,i){a(i)})});var rebuild_field_binding,rebind_field_bindings,current_form_fields={},required_errors={},add_new_grid_page,add_page_grid,init_magic_tags,core_form,compiled_templates={};init_magic_tags=function(){var e=jQuery(".magic-tag-enabled");e.each(function(e,a){var i=jQuery(a);if(i.hasClass("magic-tag-init-bound")){var t=i.parent().find(".magic-tag-init");return void(i.is(":visible")?t.show():t.hide())}var r=jQuery('<span class="icn-code magic-tag-init"></span>'),o=jQuery('<span style="position:relative;display:inline-block; width:100%;"></span>');i.is("input")&&r.css("borderBottom","none"),i.hasClass("caldera-conditional-value-field")&&o.width("auto"),i.wrap(o),r.insertAfter(i),i.addClass("magic-tag-init-bound"),i.is(":visible")?r.show():r.hide()})},rebuild_field_binding=function(){if(core_form||(core_form=jQuery(".caldera-forms-options-form")),core_form.hasClass("builder-loaded")){var e=jQuery(".caldera-editor-field-config-wrapper");system_values.field={tags:{text:[]},type:"Fields",wrap:["%","%"]};for(var a=0;a<e.length;a++){var i=e[a].id,t=jQuery("#"+i+"_lable").val(),r=jQuery("#"+i+"_slug").val(),o=jQuery("#"+i+"_type").val();"undefined"==typeof system_values.field.tags[o]&&(system_values.field.tags[o]=[]),system_values.field.tags[o].push(r),"text"!==o&&system_values.field.tags.text.push(r),current_form_fields[i]={label:t,slug:r,type:o},jQuery("option.bound-field").trigger("change").each(function(e,a){var i=jQuery(a);0!==i.prop("value").indexOf("{")?i.text(jQuery("#"+i.prop("value")+"_lable").val()+" ["+jQuery("#"+i.prop("value")+"_lable").val()+"]"):i.text(i.prop("value").replace("{","").replace("}",""))}).removeClass("bound-field")}}},rebind_field_bindings=function(){var e,a,i=jQuery(".caldera-field-bind").not(".bound_field");if(i.length){i.addClass("bound_field");for(var t=0;t<i.length;t++){var r=jQuery(i[t]),o=r.val(),l=r.data("default"),n=r.data("exclude"),d=0,s=r.closest(".caldera-editor-processor-config-wrapper"),c=s.prop("id"),p="";if(l&&!r.hasClass("reload-binding")&&(o=l),r.is("select")){r.empty();var u=jQuery('<optgroup label="Fields">');for(var f in current_form_fields)r.data("type")&&r.data("type").split(",").indexOf(current_form_fields[f].type)<0||(r.data("id")!==f&&u.append('<option value="'+f+'"'+(o===f?'selected="selected"':"")+">"+current_form_fields[f].label+" ["+current_form_fields[f].slug+"]</option>"),d+=1);u.appendTo(r),0===d&&r.empty();for(var g in system_values)if(e=[],!(n&&n.split(",").indexOf(g)>=0)){if("system"!==g&&"variable"!==g)for(var v=jQuery(".processor-"+g),h=0;h<v.length;h++)c!==v[h].id&&(e.push(v[h].id),v.length>1&&(a=jQuery("li."+v[h].id+" .processor-line-number"))&&a.html("["+(h+1)+"]"));else e.push("__system__");var m=[];r.data("type")?(m=r.data("type").split(","),m.push("vars")):m=["text","vars"];for(var _=0;_<m.length;_++)if(system_values[g].tags&&system_values[g].tags[m[_]])for(var y=0;y<e.length;y++){jQuery("li."+e[y]).index()>jQuery("li."+c).index()&&"__system__"!==e[y]?r.closest(".caldera-editor-processors-panel-wrap").length&&(p=' disabled="disabled"'):p="";for(var u=jQuery('<optgroup label="'+system_values[g].type+("__system__"!==e[y]?" "+jQuery("li."+e[y]).find(".processor-line-number").html():"")+'"'+p+">"),b=0;b<system_values[g].tags[m[_]].length;b++){var w=system_values[g].tags[m[_]][b];"__system__"!==e[y]&&(w=w.replace(g,e[y])),u.append('<option value="{'+w+'}"'+(o==="{"+w+"}"?'selected="selected"':"")+p+">"+system_values[g].tags[m[_]][b]+"</option>"),d+=1}u.children().length&&u.appendTo(r)}}if(0===d){if(r.empty(),r.data("type")){r.append('<option value="">No '+r.data("type").split(",").join(" or ")+" in form</option>");var k=!0}}else r.prop("disabled",!1);r.hasClass("required")||"undefined"!=typeof k||r.prepend('<option value=""></option>'),r.val(o)}}init_magic_tags(),jQuery(document).trigger("bound.fields"),jQuery(".caldera-header-save-button").prop("disabled",!1)}},jQuery(document).ready(function(e){function a(){var a=e(".layout-grid-panel"),i=0;a.each(function(a,t){var r=e(t),o=r.find(".layout-structure"),l=r.find(".row"),n=[];l.each(function(a,t){var r=e(t),o=r.children().not(".column-merge"),l=[];i+=1,o.each(function(a,t){span=e(t).attr("class").split("-"),l.push(span[2]);var r=e(t).find(".field-location");r.length&&r.each(function(t,r){var o=e(r);o.val(i+":"+(a+1)).removeAttr("disabled")})}),n.push(l.join(":"))}),o.val(n.join("|"))})}function i(a,i,r){var o,l,n="fld_"+Math.round(1e7*Math.random()),d=n,s=e("#field_config_panels");if(r){var c=e("#"+r).clone().wrap("<div>").parent().html().replace(new RegExp(r,"g"),"{{id}}");o=Handlebars.compile(c)}else o=Handlebars.compile(e("#caldera_field_config_wrapper_templ").html());l={id:d,label:"",slug:""},s.append(o(l)),a.removeClass("button-small").removeClass("button").removeClass("button-primary").removeClass("ui-draggable").removeClass("layout-new-form-field").addClass("layout-form-field").attr("data-config",n),a.find(".layout_field_name").remove(),a.find(".field-location").prop("name","config[layout_grid][fields]["+n+"]"),a.find(".settings-panel").show(),a.appendTo(i),t(),a.find(".icon-edit").trigger("click"),e("#"+n+"_lable").focus().select(),r&&(s.find(".field_config_string").val(""),s.find(".field-label").trigger("change")),rebuild_field_binding(),baldrickTriggers(),e("#"+n).trigger("field.drop"),e(document).trigger("field.added")}function t(){e(".toggle-options").sortable({handle:".dashicons-sort"}),e("#grid-pages-panel").sortable({placeholder:"row-drop-helper",handle:".sort-handle",items:".first-row-level",axis:"y",stop:function(){a()}}),e(".layout-column").sortable({connectWith:".layout-column",appendTo:"#grid-pages-panel",helper:"clone",items:".layout-form-field",handle:".drag-handle",cursor:"move",opacity:.7,cursorAt:{left:100,top:15},start:function(e,a){a.helper.css({width:"200px",height:"35px",paddingTop:"20px"})},stop:function(e,i){i.item.removeAttr("style"),a()}}),e("h3 .layout-new-form-field").draggable({helper:"clone",appendTo:"body"}),e(".page-toggle.button").droppable({accept:".layout-form-field",over:function(a,i){e(this).trigger("click"),e(".layout-column").sortable("refresh")}}),e(".layout-column").droppable({greedy:!0,activeClass:"ui-state-dropper",hoverClass:"ui-state-hoverable",accept:".layout-new-form-field",drop:function(a,t){var r=t.draggable.clone(),o=e(this);i(r,o)}}),a()}add_new_grid_page=function(e){return{page_no:"pg_"+Math.round(1e7*Math.random())}},add_page_grid=function(a){var i=e(".page-toggle").length+1,r=e('<button type="button" data-name="Page '+i+'" data-page="'+a.rawData.page_no+'" class="page-toggle button">'+a.params.trigger.data("addtitle")+" "+i+"</button> "),o=e("#page-toggles");r.appendTo(o),o.show(),t(),r.trigger("click"),1===i&&o.hide(),e(document).trigger("add.page")},e(document).on("remove.page add.page load.page",function(a){var i=e(".page-toggle").length,t=e("#tab_pages");1>=i?t.hide():t.show()}),t(),e("#grid-pages-panel").on("click",".column-fieldinsert .dashicons-plus-alt",function(a){var t=e(this).closest(".column-container"),r=e("#newfield-tool").clone();i(r,t)}),e("#grid-pages-panel").on("click",".column-fieldinsert .dashicons-admin-generic",function(e){}),e("#grid-pages-panel").on("click",".column-split",function(a){var i=e(this).parent().parent(),r=i.attr("class").split("-"),o=e("<div>").insertAfter(i),l=Math.ceil(r[2]/2),n=Math.floor(r[2]/2);r[2]=l,i.attr("class",r.join("-")),r[2]=n,o.addClass(r.join("-")).append('<div class="layout-column column-container">'),e(this).remove(),t(),jQuery(".column-tools").remove(),jQuery(".column-merge").remove()}),e("#grid-pages-panel").on("click",".column-remove",function(i){var t=e(this).closest(".row"),r=t.find(".layout-form-field"),o=t.closest(".layout-grid-panel");if(r.length){if(!confirm(e("#row-remove-fields-message").text()))return;r.each(function(a,i){var t=e(i).data("config");e("#"+t).remove(),e('option[value="'+t+'"]').remove(),e('[data-bind="'+t+'"]').remove(),delete current_form_fields[t]})}t.slideUp(200,function(){if(e(this).remove(),a(),rebuild_field_binding(),!o.find(".row").length){o.remove();var i=e("#page-toggles .button-primary"),t=i.prev(),r=i.next();i.remove(),t.length?t.trigger("click"):r.trigger("click")}e(document).trigger("remove.page")}),jQuery(".column-tools").remove(),jQuery(".column-merge").remove()}),e(".caldera-config-editor-main-panel").on("click",".caldera-add-row",function(i){i.preventDefault();var r=e(".page-active");if(!r.length)return void e(".caldera-add-page").trigger("click");var o=e('<div style="display:none;" class="first-row-level row"><div class="col-xs-12"><div class="layout-column column-container"></div></div></div>');e(".page-active").append(o),o.slideDown(200),t(),a()}),e("#grid-pages-panel").on("click",".column-join",function(i){var t=e(this).parent().parent().parent(),r=t.prev(),o=r.attr("class").split("-"),l=t.attr("class").split("-");o[2]=parseFloat(o[2])+parseFloat(l[2]),t.find(".layout-column").contents().appendTo(r.find(".layout-column")),r.attr("class",o.join("-")),t.remove(),a(),jQuery(".column-tools").remove(),jQuery(".column-merge").remove()}),e("#grid-pages-panel").on("mouseenter",".row",function(i){var t=jQuery(this);jQuery(".column-tools,.column-merge").remove(),t.children().children().first().append('<div class="column-remove column-tools"><i class="icon-remove"></i></div>'),t.children().children().last().append('<div class="column-sort column-tools" style="text-align:right;"><i class="dashicons dashicons-menu drag-handle sort-handle"></i></div>'),t.children().children().not(":first").prepend('<div class="column-merge"><div class="column-join column-tools"><i class="icon-join"></i></div></div>');var r=t.parent().parent().parent().width()/12-1;
|
2 |
-
t.children().children().each(function(a,i){var t=e(i),r=t.width()/2-5;t.prepend('<div class="column-fieldinsert column-tools"><i class="dashicons dashicons-plus-alt"></i></div>'),t.parent().hasClass("col-xs-1")||(t.prepend('<div class="column-split column-tools"><i class="dashicons dashicons-leftright"></i></div>'),t.find(".column-split").css("left",r))}),jQuery(".column-merge").draggable({axis:"x",helper:"clone",appendTo:t,grid:[r,0],drag:function(i,t){e(this).addClass("dragging"),e(".column-tools").remove(),e(".column-split").remove();var r=e(this).parent().parent(),o=t.helper,l=t.originalPosition.left>o.position().left?"left":"right",n=r.prev(),d=Math.round(r.parent().width()/12-10),s=Math.abs(t.originalPosition.left-o.position().left);if(r.parent().addClass("sizing"),s>=d){var c=n.attr("class").split("-"),p=r.attr("class").split("-");c[2]=parseFloat(c[2]),p[2]=parseFloat(p[2]),"left"===l?(c[2]--,p[2]++,c[2]>0&&c[2]<c[2]+p[2]?(n.attr("class",c.join("-")),r.attr("class",p.join("-")),t.originalPosition.left=o.position().left):e(this).draggable("option","disabled",!0)):(c[2]++,p[2]--,p[2]>0&&p[2]<p[2]+p[2]?(n.attr("class",c.join("-")),r.attr("class",p.join("-")),t.originalPosition.left=o.position().left):e(this).draggable("option","disabled",!0)),a()}},stop:function(){e(this).removeClass("dragging").parent().parent().parent().removeClass("sizing")}})}),e("#grid-pages-panel").on("mouseleave",".row",function(e){jQuery(".column-tools").remove(),jQuery(".column-merge").remove()}),e("#grid-pages-panel").on("click",".layout-form-field .icon-remove",function(){var a=e(this),i=a.parent(),t=e("#"+i.data("config"));i.slideUp(100,function(){e(this).remove()}),t.slideUp(100,function(){e(this).remove()})}),e("#grid-pages-panel").on("click",".layout-form-field .icon-edit",function(){var a=e(this),i=a.parent(),t=e("#"+i.data("config")+"_type").val();e(".caldera-editor-field-config-wrapper").hide(),i.hasClass("field-edit-open")?i.removeClass("field-edit-open"):(e(".layout-form-field").removeClass("field-edit-open"),i.addClass("field-edit-open"),e("#"+i.data("config")).show()),e(document).trigger("show."+i.data("config")),e(document).trigger("show.fieldedit"),"radio"!==t&&"checkbox"!==t&&"dropdown"!==t&&"toggle_switch"!==t||e("#"+i.data("config")+"_auto").trigger("change")}),e("body").on("click",".layout-modal-edit-closer,.layout-modal-save-action",function(a){a.preventDefault();var i=e(this),t=e(".layout-form-field.edit-open"),r=i.closest(".layout-modal-container");settings=r.find(".settings-panel").first(),e(".edit-open").removeClass("edit-open"),settings.appendTo(t.find(".settings-wrapper")).hide(),r.hide()}),e(".layout-editor-body").on("change",".layout-core-pod-query",function(){e(this).parent().find(".settings-panel-row").remove(),e(".edit-open").find(".drag-handle .set-pod").html(" - "+e(this).val())}),e(".layout-editor-body").on("click",".remove-where",function(){e(this).closest(".settings-panel-row").remove()}),e(".layout-editor-body").on("click",".use-pod-container",function(){var a=e(this),i=a.prev(),t=i.val();if(t.length){e(".edit-open").find(".drag-handle .set-pod").html(" - "+i.val()),a.parent().parent().find(".spinner").css("display","inline-block");var r={action:"pq_loadpod",pod_reference:{pod:t}};e.post(ajaxurl,r,function(i){a.parent().find(".spinner").css("display","none");var t=e("#where-line-tmpl").html(),r="",o=a.closest(".settings-panel").data("container");for(var l in i)r+='<option value="'+i[l]+'">'+i[l]+"</option>";t=t.replace(/{{fields}}/g,r).replace(/{{container_id}}/g,o),a.parent().append(t)})}}),e(".caldera-editor-header").on("click",".column-sort .icon-edit",function(e){}),e(".layout-editor-body").on("tray_loaded",".layout-template-tray",function(){t()}),e(".caldera-editor-header").on("click",".caldera-editor-header-nav a",function(a){a.preventDefault();var i=e(this);e(".caldera-editor-header-nav li").removeClass("active"),e(".caldera-editor-body").hide(),e(i.attr("href")).show(),i.parent().addClass("active"),rebind_field_bindings()}),e("body").on("change",".required",function(){check_required_bindings(this)}),e("body").on("submit",".caldera-forms-options-form",function(a){var i=e(".required.has-error");i.length&&a.preventDefault()}),e(".caldera-editor-body").on("click",".add-toggle-option",function(a){var i=e(this);if(i.data("bulk"))return e(i.data("bulk")).toggle(),void e(i.data("bulk")).find("textarea").focus();var t=i.closest(".caldera-editor-field-config-wrapper"),r=t.find(".toggle-options"),o=e("#field-option-row-tmpl").html(),l=Handlebars.compile(o),n="opt"+parseInt(1048576*(Math.random()+1)),d={_name:"config[fields]["+t.prop("id")+"][config]",option:{}};if(i.data("options")){for(var s=e(i.data("options")),c=s.val().split("\n"),p=0;p<c.length;p++)d.option["opt"+parseInt(1048576*(Math.random()+p))]={value:c[p],label:c[p],"default":!1};e(i.data("options")).parent().hide(),s.val(""),r.empty()}else d.option[n]={value:"",label:"","default":!1};r.append(l(d)),t.find(".toggle_show_values").trigger("change"),e(".toggle-options").sortable({handle:".dashicons-sort"}),c||r.find(".toggle_label_field").last().focus()}),e(".caldera-editor-body").on("click",".toggle-remove-option",function(a){var i=e(this).closest(".caldera-editor-field-config-wrapper").find(".field-config").first();e(this).parent().remove(),i.trigger("change")}),e(".caldera-editor-body").on("click",".page-toggle",function(a){var i=e(this),t=i.parent(),r=t.find(".button");r.removeClass("button-primary"),e(".layout-grid-panel").hide().removeClass("page-active"),e("#"+i.data("page")).show().addClass("page-active"),i.addClass("button-primary"),r.each(function(a,i){e(i).html(t.data("title")+" "+(a+1))}),1===r.length&&t.hide()}),e(".caldera-editor-body").on("blur toggle.values",".toggle_label_field",function(a){var i=e(this),t=i.prev();t.val().length||t.val(i.val())}),rebuild_field_binding(),e(document).trigger("load.page")}),Handlebars.registerHelper("_options_config",function(){}),jQuery(document).ready(function(e){function a(){e(".caldera-editor-processors-panel ul").sortable({update:function(){rebuild_field_binding()}})}function i(a){var i=e(a),t=e("#"+i.val()+"-tmpl").length?e("#"+i.val()+"-tmpl").html():"",r=i.closest(".caldera-editor-processor-config-wrapper"),o=r.find(".caldera-config-processor-setup"),l=Handlebars.compile(t),n=r.find(".processor_config_string").val(),d=i.data("type");n=n.length&&d===i.val()?JSON.parse(n):processor_defaults[i.val()+"_cfg"],n||(n={}),n._id=r.prop("id"),n._name="config[processors]["+r.prop("id")+"][config]",l=e("<div>").html(l(n)),o.html(l.html()),"function"==typeof window[i.val()+"_init"]&&window[i.val()+"_init"](r.prop("id"),o),r.find(".no-conditions").length&&r.find(".toggle_option_tab").remove(),rebuild_field_binding(),baldrickTriggers(),e(".wp-baldrick").baldrick({request:ajaxurl,method:"POST",before:function(a){var i=e(a);i.data("addNode")&&!i.data("request")&&i.data("request","cf_get_default_setting")}})}e("body").on("click",".caldera-processor-nav a",function(a){a.preventDefault();var i=e(this);e(".caldera-processor-nav").removeClass("active"),e(".caldera-editor-processor-config-wrapper").hide(),e(i.attr("href")).show(),i.parent().addClass("active")}),e("body").on("click",".add-new-processor",function(i){var t=e(this),r=Handlebars.compile(e("#processor-wrapper-tmpl").html());wrap=e(".active-processors-list"),process_conf=e(".caldera-editor-processor-config"),processid=Math.round(1e8*Math.random()),new_templ=Handlebars.compile(e("#processor-line-tmpl").html()),new_proc={id:"fp_"+processid,type:t.data("type")},wrap.append(new_templ(new_proc)),process_conf.append(r(new_proc)),e("#form_processor_baldrickModalCloser").trigger("click"),e(".caldera-processor-nav a").last().trigger("click"),e("#fp_"+processid+"_type").val(t.data("type")).trigger("change"),a(),baldrickTriggers()}),e("body").on("click",".delete-processor",function(a){var i=e(this),t=i.closest(".caldera-editor-processor-config-wrapper");t.data("type");confirm(i.data("confirm"))&&(e("."+t.prop("id")).remove(),t.remove(),e(".caldera-processor-nav a").first().trigger("click"),rebuild_field_binding())}),e("body").on("change",".caldera-select-processor-type",function(a){var t=e(this),r=t.closest(".caldera-editor-processor-config-wrapper"),o=t.find('option[value="'+t.val()+'"]').text(),l=r.find(".caldera-editor-processor-title"),n=e(".caldera-processor-nav.active a");""===o&&(o=l.data("title")),l.html(o),n.html(o+' <span class="processor-line-number"></span>').parent().addClass("processor_type_"+t.val()),i(this),rebuild_field_binding()}),rebuild_field_binding(),e(".caldera-select-processor-type").each(function(e,a){i(a)}),a()}),Handlebars.registerHelper("_field",function(e){var a=this,i="",t="",r="",o=this[e.hash.slug]?' data-default="'+this[e.hash.slug]+'"':"";e.hash.required&&(i=" required"),e.hash.exclude&&(r='data-exclude="'+e.hash.exclude+'"'),e.hash.array&&(t="[]","true"!==e.hash.array&&(o='value="'+e.hash.array+'"')),out="<select "+(e.hash.type?'data-type="'+e.hash.type+'"':"")+o+" "+r+' name="'+this._name+"["+e.hash.slug+"]"+t+'" id="'+this._id+"_"+e.hash.slug+'" class="block-input field-config caldera-field-bind'+i+'">',this[e.hash.slug]?out+='<option class="bound-field" value="'+this[e.hash.slug]+'" class="bound-field"></option>':e.hash.required||(out+='<option value=""></option>');for(var l in current_form_fields){var n="";e.hash.type&¤t_form_fields[l].type!==e.hash.type||(a[e.hash.slug]&&a[e.hash.slug]===l&&(n=' selected="selected"'),out+='<option value="'+l+'"'+n+">"+current_form_fields[l].label+" ["+current_form_fields[l].slug+"]</option>")}return out+="</select>",e.hash.required&&(out+='<input class="field-config" name="'+this._name+'[_required_bounds][]" type="hidden" value="'+e.hash.slug+'">'),out}),Handlebars.registerHelper("console",function(e,a){console.log(this)});
|
1 |
+
function new_conditional_group(e){var a=e.trigger.data("id"),i="cl"+Math.round(18746582734*Math.random()),t="rw"+Math.round(98347598345*Math.random()),o=[{id:t,type:e.trigger.data("type"),lines:[{id:i}]}];return{group:o,id:a}}function new_conditional_line(e){var a=e.trigger.data("id"),i=e.trigger.data("group"),t=e.trigger.data("type"),o="cl"+Math.round(18746582734*Math.random()),r={id:a,type:t,lineid:o,rowid:i,name:"config["+t+"]["+a+"][conditions][group]["+i+"]["+o+"]"};return r}function build_conditions_config(e){var a=JSON.parse(e.trigger.val());return a.id=e.trigger.data("id"),a}function setup_field_type(e){return{id:e.trigger.prop("id")}}function check_required_bindings(e){var a,i=(jQuery(".caldera-header-save-button"),jQuery(".layout-form-field")),t=jQuery(".caldera-processor-nav"),o=!0;a=e?jQuery(e):jQuery(".caldera-config-field .required"),a.removeClass("has-error"),i.removeClass("has-error"),t.removeClass("has-error"),jQuery(".error-tag").remove(),required_errors={},a.each(function(e,a){var i=jQuery(a),t=i.closest(".caldera-config-editor-panel");if(a.value.length){if(i.hasClass("field-slug"))for(var r=jQuery(".field-slug").not(i),l=0;l<r.length;l++)if(r[l].value===a.value){var i=jQuery(r[l]);required_errors[t.prop("id")]||(required_errors[t.prop("id")]=0);var n=i.closest(".caldera-editor-field-config-wrapper"),d=i.closest(".caldera-editor-processor-config-wrapper");n.length&&jQuery('.layout-form-field[data-config="'+n.prop("id")+'"]').addClass("has-error"),d.length&&jQuery("."+d.prop("id")).addClass("has-error"),required_errors[t.prop("id")]+=1,i.addClass("has-error"),o=!1;break}if(i.hasClass("toggle_value_field"))for(var s=i.closest(".caldera-config-group").find(".toggle_value_field").not(i),l=0;l<s.length;l++)if(s[l].value===a.value){var i=jQuery(s[l]);required_errors[t.prop("id")]||(required_errors[t.prop("id")]=0);var n=i.closest(".caldera-editor-field-config-wrapper"),d=i.closest(".caldera-editor-processor-config-wrapper");n.length&&jQuery('.layout-form-field[data-config="'+n.prop("id")+'"]').addClass("has-error"),d.length&&jQuery("."+d.prop("id")).addClass("has-error"),required_errors[t.prop("id")]+=1,i.addClass("has-error"),o=!1;break}}else{required_errors[t.prop("id")]||(required_errors[t.prop("id")]=0);var n=i.closest(".caldera-editor-field-config-wrapper"),d=i.closest(".caldera-editor-processor-config-wrapper");n.length&&jQuery('.layout-form-field[data-config="'+n.prop("id")+'"]').addClass("has-error"),d.length&&jQuery("."+d.prop("id")).addClass("has-error"),required_errors[t.prop("id")]+=1,i.addClass("has-error"),o=!1}});for(var r in required_errors)jQuery(".caldera-forms-options-form").find('a[href="#'+r+'"]').append('<span class="error-tag">'+required_errors[r]+"</span>");return jQuery(".caldera-conditional-field-set").trigger("change"),o}jQuery(document).ready(function(e){function a(a){var t=e(a),o=t.closest(".caldera-editor-field-config-wrapper"),r=o.find(".caldera-config-field-setup"),l=compiled_templates[t.val()+"_tmpl"]?compiled_templates[t.val()+"_tmpl"]:compiled_templates.noconfig_field_templ,n=o.find(".field_config_string").val(),d=t.data("type");if(o.find(".caldera-config-group").show(),t.addClass("field-initialized"),n=n.length&&d===t.val()?JSON.parse(n):fieldtype_defaults[t.val()+"_cfg"],n||(n={}),n._id=t.data("field"),n._name="config[fields]["+t.data("field")+"][config]",l=e("<div>").html(l(n)),r.html(l.html()),"function"==typeof window[t.val()+"_init"]&&window[t.val()+"_init"](t.data("field"),r),fieldtype_defaults[t.val()+"_nosupport"]&&(fieldtype_defaults[t.val()+"_nosupport"].indexOf("hide_label")>=0&&o.find(".hide-label-field").hide().find(".field-config").prop("checked",!1),fieldtype_defaults[t.val()+"_nosupport"].indexOf("caption")>=0&&o.find(".caption-field").hide().find(".field-config").val(""),fieldtype_defaults[t.val()+"_nosupport"].indexOf("required")>=0&&o.find(".required-field").hide().find(".field-config").prop("checked",!1),fieldtype_defaults[t.val()+"_nosupport"].indexOf("custom_class")>=0&&o.find(".customclass-field").hide().find(".field-config").val(""),fieldtype_defaults[t.val()+"_nosupport"].indexOf("entry_list")>=0&&o.find(".entrylist-field").hide().find(".field-config").prop("checked",!1)),o.find(".toggle_show_values").trigger("change"),!e(".caldera-select-field-type").not(".field-initialized").length){if(core_form.hasClass("builder-loaded"))i(t.data("field"));else{for(var s=e(".caldera-select-field-type.field-initialized"),c=0;c<s.length;c++)i(e(s[c]).data("field"));core_form.addClass("builder-loaded")}e(".caldera-header-save-button").prop("disabled",!1),rebuild_field_binding(),baldrickTriggers()}e(".color-field").length&&e(".color-field").wpColorPicker({change:function(a){var i=e(this);i.data("ev")&&clearTimeout(i.data("ev")),i.data("ev",setTimeout(function(){i.trigger("record")},200)),i.data("target")&&(e(i.data("target")).css(i.data("style"),i.val()),e(i.data("target")).val(i.val()))}})}function i(a){var i=e("#"+a),t=i.find(".caldera-select-field-type"),o=e('.layout-form-field[data-config="'+a+'"]'),r=o.find(".field_preview"),l=(e("#preview-"+t.val()+"_tmpl").html(),compiled_templates["preview-"+t.val()+"_tmpl"]),n={id:a},d=i.find(".field-config");d.each(function(i,t){for(var o=e(t),r=o.prop("name").split("["+a+"]")[1].substr(1),l=r.substr(0,r.length-1).split("]["),d=o.is(":checkbox,:radio")?o.filter(":checked").val():o.val(),s={},c=l.length-1;c>=0;c--)if(c===l.length-1)s[l[c]]=d;else{var p=s;s={},s[l[c]]=p}e.extend(!0,n,s)}),r.html(l(n)),o.removeClass("button"),e(".preview-field-config").prop("disabled",!0)}function t(a){var i,t=e(".caldera-editor-fields-panel"),o=(e(".caldera-editor-groups-panel"),e(".caldera-group-nav")),r=e('[data-group="'+a+'"]'),l=r.find(".caldera-config-group-name"),n=r.find(".caldera-config-group-slug"),d=r.find(".caldera-config-group-desc"),s=r.find(".caldera-config-group-admin"),c=e(".active-group-name"),p=e(".active-group-slug"),f=e(".active-group-desc"),u=e(".active-group-admin"),g=e(".caldera-editor-fields-list ul"),v=r.find(".caldera-config-group-repeat"),h=e(".repeat-config-button"),m=(e(".caldera-editor-group-settings"),e(".caldera-config-group-remove"));e(".new-group-input").remove(),e(".new-field-input").remove(),o.removeClass("active"),t.show(),g.hide(),g.removeClass("active").find("li.active").removeClass("active"),g.hide(),r.addClass("active"),i=e(".caldera-editor-fields-list ul.active li"),i.length?m.hide():m.show(),e(".caldera-editor-field-config-wrapper").hide(),r.show(),c.val(l.val()),p.val(n.val()),f.val(d.val()),"1"===s.val()?u.prop("checked",!0):u.prop("checked",!1),"1"===v.val()?h.addClass("field-edit-open"):h.removeClass("field-edit-open")}e(".caldera-header-save-button").baldrick({method:"POST",request:"admin.php?page=caldera-forms",before:function(a,i){if(i.preventDefault(),!check_required_bindings())return!1;e("#save_indicator").addClass("loading"),"undefined"!=typeof tinyMCE&&tinyMCE.triggerSave();var t=e(".caldera-forms-options-form").formJSON();return t.conditions&&(t.config.conditional_groups={conditions:t.conditions}),e(a).data("cf_edit_nonce",t.cf_edit_nonce),e(a).data("_wp_http_referer",t._wp_http_referer),e(a).data("sender","ajax"),e(a).data("config",JSON.stringify(t.config)),!0},callback:function(a){if(!1===a.data){var i=e(".updated_notice_box");i.stop().animate({top:0},200,function(){setTimeout(function(){i.stop().animate({top:-75},200)},2e3)})}},complete:function(a){e(".wrapper-instance-pane .field-config").prop("disabled",!1)}}),e("body").on("click",".toggle_processor_event input",function(a){var i=e(this),t=i.closest(".wrapper-instance-pane"),o=t.find(".caldera-config-processor-setup"),r=t.find(".caldera-config-processor-notice");i.is(":checked")?(i.parent().addClass("activated"),i.parent().find(".is_active").show(),i.parent().find(".not_active").hide()):(i.parent().removeClass("activated"),i.parent().find(".is_active").hide(),i.parent().find(".not_active").show()),t.find(".toggle_processor_event .activated").length?(o.slideDown(100),r.slideUp(100)):(o.slideUp(100),r.slideDown(100))}),e("body").on("click",".toggle_option_tab > a",function(a){a.preventDefault();var i=e(this),t=e(i.attr("href")),o=i.parent().find("a"),r=i.closest(".caldera-editor-config-wrapper").find(".wrapper-instance-pane");o.removeClass("button-primary"),r.hide(),t.show(),i.addClass("button-primary"),e(".caldera-conditionals-usetype").trigger("change")}),e(".caldera-editor-body").on("change",".caldera-select-field-type",function(e){a(this)}),e(".caldera-editor-body").on("click",".caldera-group-nav a",function(a){a.preventDefault(),t(e(this).attr("href").substr(1))}),e(".caldera-editor-body").on("click",".caldera-editor-fields-list a",function(a){a.preventDefault();var i=e(this),t=e(i.attr("href"));e(".new-group-input").remove(),e(".new-field-input").remove(),e(".caldera-editor-fields-list li.active").removeClass("active"),i.parent().addClass("active"),e(".caldera-editor-field-config-wrapper").hide(),t.show()}),e(".caldera-editor-body").on("click",".group-config-button",function(a){var i=e(this),t=e(".caldera-editor-group-settings"),o=i.closest(".caldera-editor-fields-panel"),r=e(".caldera-config-group-remove");o.find(".caldera-field-line").length?r.hide():r.show(),i.hasClass("field-edit-open")?(t.slideUp(100),i.removeClass("field-edit-open")):(t.slideDown(100),i.addClass("field-edit-open"))}),e(".caldera-editor-body").on("keydown",".field-config",function(a){e(this).is("textarea")||13===a.which&&a.preventDefault()}),e(".caldera-editor-body").on("change",".field-label",function(a){var i=e(this).closest(".caldera-editor-field-config-wrapper").prop("id");field_line=e('[data-field="'+i+'"]'),field_title=e("#"+i+" .caldera-editor-field-title, .layout-form-field.field-edit-open .layout_field_name"),slug=e("#"+i+" .field-slug"),field_line.find("a").html('<i class="icn-field"></i> '+this.value),field_title.text(this.value),"change"===a.type&&slug.trigger("change"),rebuild_field_binding()}),e(".caldera-editor-body").on("change",".active-group-name",function(a){a.preventDefault();var i=e(".caldera-group-nav.active"),t=(i.data("group"),i.find(".caldera-config-group-name")),o=i.find("span");"focusout"!==a.type||this.value.length||(this.value="Group "+(parseInt(i.index())+1)),t.val(this.value),o.text(this.value)}),e(".caldera-editor-body").on("change",".active-group-slug",function(a){a.preventDefault();var i=e(".caldera-group-nav.active"),t=(i.data("group"),i.find(".caldera-config-group-name").val()),o=i.find(".caldera-config-group-slug"),r=(i.find("span"),this.value.split(" ").join("_").split("-").join("_").replace(/[^a-z0-9_]/gi,"").toLowerCase());"focusout"!==a.type||this.value.length||(r=t.split(" ").join("_").split("-").join("_").replace(/[^a-z0-9_]/gi,"").toLowerCase()),o.val(r),this.value=r}),e(".caldera-editor-body").on("change",".active-group-desc",function(a){a.preventDefault();var i=e(".caldera-group-nav.active"),t=(i.data("group"),i.find(".caldera-config-group-desc"));t.val(this.value)}),e(".caldera-editor-body").on("change",".active-group-admin",function(a){a.preventDefault();var i=e(".caldera-group-nav.active"),t=(i.data("group"),i.find(".caldera-config-group-name").val(),i.find(".caldera-config-group-admin"));i.find("span"),this.value.split(" ").join("_").split("-").join("_").replace(/[^a-z0-9_]/gi,"").toLowerCase();e(this).prop("checked")?(t.val(1),i.addClass("is-admin")):(t.val(0),i.removeClass("is-admin"))}),e(".caldera-editor-body").on("click",".repeat-config-button",function(a){a.preventDefault();var i=e(".caldera-group-nav.active"),t=(i.data("group"),i.find("a .group-type")),o=i.find(".caldera-config-group-repeat"),r=e(this);r.hasClass("field-edit-open")?(o.val("0"),t.removeClass("icn-repeat").addClass("icn-folder"),r.removeClass("field-edit-open")):(o.val("1"),t.addClass("icn-repeat").removeClass("icn-folder"),r.addClass("field-edit-open"))}),e(".caldera-editor-body").on("click",".delete-field",function(){var a=e(this),i=a.closest(".caldera-editor-field-config-wrapper").prop("id");confirm(a.data("confirm"))&&(e("#"+i).remove(),e('option[value="'+i+'"]').remove(),e('[data-bind="'+i+'"]').remove(),delete current_form_fields[i],e('[data-config="'+i+'"]').slideUp(200,function(){var a=e(this);a.remove(),rebuild_field_binding(),e(document).trigger("field.removed")}))}),e(".caldera-editor-body").on("click",".add-new-group,.add-field",function(){var a=e(this);if(e(".new-group-input").remove(),e(".new-field-input").remove(),a.hasClass("add-field")){var i=e('<input type="text" class="new-field-input block-input">');i.appendTo(e(".caldera-editor-fields-list ul.active")).focus()}else{var t=e('<input type="text" class="new-group-input block-input">');t.appendTo(e(".caldera-editor-groups-panel")).focus()}}),e(".caldera-editor-body").on("change keypress",".new-group-input",function(a){if("keypress"===a.type){if(13!==a.which)return;a.preventDefault()}var i,o,r=this.value,l=e(this),n=e(".caldera-editor-groups-panel ul"),d=e(".caldera-editor-fields-list");if(r.length){i=Handlebars.compile(e("#caldera_group_line_templ").html()),o={id:r.split(" ").join("_").split("-").join("_").replace(/[^a-z0-9_]/gi,"").toLowerCase(),name:r},n.append(i(o));var s=e('<ul data-group="'+o.id+'">').hide();s.appendTo(d),l.remove(),t(o.id)}else l.remove()}),e(".caldera-editor-body").on("change keypress",".new-field-input",function(a){if("keypress"===a.type){if(13!==a.which)return;a.preventDefault()}var i,t,o,r=this.value,l=e(this),n=l.parent(),d=e(".caldera-editor-field-config"),s=e(".caldera-config-group-remove");if(r.length){s.hide(),i=Handlebars.compile(e("#caldera_field_line_templ").html()),t=Handlebars.compile(e("#caldera_field_config_wrapper_templ").html()),o={id:r.split(" ").join("_").split("-").join("_").replace(/[^a-z0-9_]/gi,"").toLowerCase(),label:r,slug:r.split(" ").join("_").split("-").join("_").replace(/[^a-z0-9_]/gi,"").toLowerCase(),group:e(".caldera-group-nav.active").data("group")};var c=e(i(o));c.appendTo(n),d.append(t(o)),c.find("a").trigger("click"),l.remove()}else l.remove()}),e(".caldera-editor-body").on("change",".field-slug",function(a){this.value.length?this.value=this.value.split(" ").join("_").split("-").join("_").replace(/[^a-z0-9_]/gi,"").toLowerCase():"change"===a.type&&(this.value=e(this).closest(".caldera-editor-field-config-wrapper").find(".field-label").val().split(" ").join("_").split("-").join("_").replace(/[^a-z0-9_]/gi,"").toLowerCase())}),e(".caldera-editor-body").on("click",".caldera-add-group",function(a){var i=e(this),t=i.data("group"),o=e("#"+t+"_panel_tmpl").html();i.parent().parent().append(o)}),e(".caldera-editor-body").on("click",".caldera-config-group-remove",function(a){var i=e(".active-group-slug").val();e('[data-group="'+i+'"]').hide(0,function(){e(this).remove();var a=e(".caldera-group-nav");a.length?a.first().find("a").trigger("click"):e(".caldera-editor-fields-panel").hide()})}),e("body").on("click",".set-current-field",function(a){a.preventDefault();var i=e(this);e("#"+i.data("field")+"_type").val(i.data("type")).trigger("change"),e("#"+i.data("field")+"_lable").focus(),e("#field_setup_baldrickModalCloser").trigger("click")}),e(".caldera-editor-body").on("change record",".field-config",function(a){var t=e(this),o=t.closest(".caldera-editor-field-config-wrapper");current_form_fields&&(t.prop("id")===o.prop("id")+"_lable"&&(current_form_fields[o.prop("id")].label=this.value),t.prop("id")===o.prop("id")+"_slug"&&(current_form_fields[o.prop("id")].slug=this.value),t.prop("id")===o.prop("id")+"_type"&&(current_form_fields[o.prop("id")].type=this.value),o.length&&i(o.prop("id")))}),e(".caldera-editor-body").on("focus",".caldera-field-bind",function(a){var i=e(this),t=this.value;return a.type&&"focusin"===a.type?(i.removeClass("bound_field").addClass("reload-binding"),rebind_field_bindings(),void(this.value=t)):void 0}),e(".caldera-editor-body").on("change",".caldera-conditional-field-set",function(a){var i,t,o=e(this),r=o.parent().find(".compare-type"),l=o.data("condition"),n=o.data("id"),d="config["+l+"]["+n+"][conditions][group]["+o.data("row")+"]["+o.data("line")+"]",s=o.data("line"),c=e("#"+s+"_value"),p=c.find(".caldera-conditional-value-field").first(),f=[],u=this.value;if("{"!==u.substr(0,1)&&(i=e("#"+u),t=i.find(".field-button-type"),f=i.find(".caldera-config-group-toggle-options")),o.hasClass(".bind_init")&&o.addClass("bound_triggered"),p.length&&p.val().length&&c.data("value",p.val()),r.show(),f.length){var g=f.find(".toggle_option_row"),v='<select name="'+d+'[value]" class="caldera-processor-value-bind caldera-conditional-value-field" data-field="'+u+'" style="max-width: 220px; width: 220px;">';v+='<option value=""></option>',g.each(function(a,i){var t=e(i).find(".toggle_label_field"),o=t.data("option"),r="";c.data("value")&&(c.data("value").toString()!==o&&c.data("value").toString()!==e(i).find(".toggle_value_field").val()||(r=' selected="selected"')),v+='<option value="'+o+'"'+r+">"+t.val()+"</option>"}),v+="</select>"}else t&&"button"==t.val()?(r.val("is").hide(),v='<select name="'+d+'[value]" class="caldera-processor-value-bind caldera-conditional-value-field" data-field="'+u+'" style="max-width: 220px; width: 220px;">',v+='<option value="click" '+("click"===c.data("value")?'selected="selected"':"")+">Click</option>",v+='<option value="dblclick" '+("dblclick"===c.data("value")?'selected="selected"':"")+">Double Click</option>",v+="</select>"):v='<input name="'+d+'[value]" type="text" class="caldera-conditional-value-field magic-tag-enabled" value="'+(c.data("value")?c.data("value"):"")+'" style="max-width: 205px;">';c.html(v),init_magic_tags()}),e(".caldera-editor-body").on("change",".caldera-conditionals-usetype",function(a){var i=e(this);"show"===this.value||"hide"===this.value||"disable"===this.value||"use"===this.value||"not"===this.value?(e("#"+i.data("id")+"_condition_group_add").show(),e("#"+i.data("id")+"_conditional_wrap").show()):(e("#"+i.data("id")+"_condition_group_add").hide(),e("#"+i.data("id")+"_conditional_wrap").hide())}),e(".caldera-editor-body").on("click",".remove-conditional-line",function(a){a.preventDefault();var i=e(this),t=i.closest(".caldera-condition-line"),o=i.closest(".caldera-condition-group");t.remove(),o.find(".caldera-condition-line").length||o.remove()}),e(".caldera-group-nav").first().find("a").trigger("click"),e(".caldera-editor-body").on("change",".toggle_show_values",function(a){var i=e(this),t=i.closest(".caldera-config-group-toggle-options");values=t.find(".toggle_value_field"),lables=t.find(".toggle_label_field"),field_lables=t.find(".caldera-config-group-option-labels"),i.prop("checked")?(values.show().parent().show(),values.show().parent().parent().show(),lables.css("width",""),field_lables.show()):(values.hide().parent().hide(),lables.css("width",245),field_lables.hide()),lables.trigger("toggle.values"),init_magic_tags()}),e(".caldera-editor-body").on("change",".auto-populate-type",function(){e(this).closest(".wrapper-instance-pane").find(".auto-populate-options").trigger("change")}),e(".caldera-editor-body").on("change",".auto-populate-options",function(){var a=e(this),i=a.closest(".wrapper-instance-pane"),t=i.find(".caldera-config-group-toggle-options"),o=i.find(".caldera-config-group-auto-options"),r=o.find(".auto-populate-type");o.find(".auto-populate-type-panel").hide(),a.prop("checked")?(t.hide(),o.show()):(t.show(),o.hide()),o.find(".caldera-config-group-auto-"+r.val()).show()}),e("body").on("change",".pin-toggle-roles",function(){var a=e(this),i=e("#caldera-pin-rules");"1"===a.val()?i.show():i.hide()}),e("body").on("click",".magic-tag-init",function(a){var i=e(this),t=i.prev();t.focus().trigger("init.magic")}),e("body").on("keyup blur focus select click init.magic",".magic-tag-enabled",function(a){init_magic_tags();var i=e(this),t=i.parent(),o=t.closest(".wrapper-instance-pane").find(".caldera-select-field-type").val()?t.closest(".wrapper-instance-pane").find(".caldera-select-field-type").val():"hidden",r=t.find(".magic-tags-autocomplete"),l=r.find("ul"),n=this.value,d=[],s="",c=this.selectionStart,p=this.selectionEnd;if(r.length&&r.data("focus"))return void a.preventDefault();if(i.data("tag",""),this.selectionEnd>this.selectionStart)s=this.value.substr(this.selectionStart,this.selectionEnd-this.selectionStart);else if(("select"===a.type||"keyup"===a.type)&&40!==a.which&&38!==a.which&&39!==a.which&&37!==a.which){for(c=this.selectionStart;c>0;c--){var f=n.substr(c-1,1);if(" "===f||"\n"===f||("%"===f||"}"===f)&&this.selectionStart===c)break}for(p=this.selectionStart;p<n.length;p++){var f=n.substr(p,1);if(" "===f||"\n"===f||("%"===f||"{"===f)&&this.selectionStart===p)break}s=n.substr(c,p-c)}if("focusout"!==a.type){if("init"!==a.type&&s.length<3)return void(r.length&&r.remove());r.length||(r=e('<div class="magic-tags-autocomplete"></div>'),l=e("<ul></ul>"),l.appendTo(r),r.insertAfter(i),r.on("mouseenter",function(){e(this).data("focus",!0)}),r.on("mouseleave",function(){e(this).data("focus",!1),i.is(":focus")||i.trigger("focusout")})),l.empty();var u="system",g=!1;"hidden"===o||"dropdown"===o||"radio"===o||"toggle_switch"===o||"checkbox"===o?(g=!0,o="text",u="all"):"paragraph"!==o&&"html"!==o||(o="text"),i.data("type")&&(o=i.data("type")),o=o.split(","),o.push("vars");for(var v=0;v<o.length;v++)for(var h in system_values)if("undefined"!=typeof system_values[h].tags[o[v]]){if(d=[h],"system"!==h&&"variable"!==h&&"field"!==h){var m=jQuery(".processor-"+h),_=i.closest(".caldera-editor-processor-config-wrapper"),y=_.prop("id");d=[];for(var b=0;b<m.length;b++)if(_.length||g!==!0){if(y===m[b].id)continue;jQuery("li."+m[b].id).index()<jQuery("li."+y).index()&&d.push(m[b].id)}else d.push(m[b].id)}for(var w=0;w<d.length;w++)if("all"===u||u===h||"variable"===h){var k=e('<li class="header">'+system_values[h].type+(w>0?" ["+(w+1)+"]":"")+"</li>"),C=0;k.appendTo(l);for(var j=0;j<system_values[h].tags[o[v]].length;j++)if(!i.data("parent")||"variable:"+i.data("parent")!==system_values[h].tags[o[v]][j]){var x=system_values[h].wrap[0]+system_values[h].tags[o[v]][j]+system_values[h].wrap[1];if(d[w]!==h&&d.length>1&&(x=system_values[h].wrap[0]+system_values[h].tags[o[v]][j]+":"+d[w]+system_values[h].wrap[1]),x.indexOf(s)>=0||"init"===a.type){C+=1;var Q=x.replace(s,"<strong>"+s+"</strong>"),q=e('<li class="tag" data-tag="'+x+'">'+Q+"</li>");q.on("click",function(){var a=e(this).data("tag");i.val(n.substr(0,c)+a+n.substr(p)).trigger("change").focus(),i[0].selectionStart=c+a.length-(a.indexOf("*")>0?2:0),i[0].selectionEnd=c+a.length-(a.indexOf("*")>0?1:0),p=c=i[0].selectionEnd,n+=a,i.trigger("init.magic")}),q.appendTo(l)}}0===C&&k.remove()}}}l.children().length||r.remove(),"focusout"===a.type&&setTimeout(function(){r.remove()},200)});for(var o=e(".cf-editor-template"),r=0;r<o.length;r++)compiled_templates[o[r].id]=Handlebars.compile(o[r].innerHTML);e(".caldera-select-field-type").not(".field-initialized").each(function(e,i){a(i)})});var rebuild_field_binding,rebind_field_bindings,current_form_fields={},required_errors={},add_new_grid_page,add_page_grid,init_magic_tags,core_form,compiled_templates={};init_magic_tags=function(){var e=jQuery(".magic-tag-enabled");e.each(function(e,a){var i=jQuery(a);if(i.hasClass("magic-tag-init-bound")){var t=i.parent().find(".magic-tag-init");return void(i.is(":visible")?t.show():t.hide())}var o=jQuery('<span class="icn-code magic-tag-init"></span>'),r=jQuery('<span style="position:relative;display:inline-block; width:100%;"></span>');i.is("input")&&o.css("borderBottom","none"),i.hasClass("caldera-conditional-value-field")&&r.width("auto"),i.wrap(r),o.insertAfter(i),i.addClass("magic-tag-init-bound"),i.is(":visible")?o.show():o.hide()})},rebuild_field_binding=function(){if(core_form||(core_form=jQuery(".caldera-forms-options-form")),core_form.hasClass("builder-loaded")){var e=jQuery(".caldera-editor-field-config-wrapper");system_values.field={tags:{text:[]},type:"Fields",wrap:["%","%"]};for(var a=0;a<e.length;a++){var i=e[a].id,t=jQuery("#"+i+"_lable").val(),o=jQuery("#"+i+"_slug").val(),r=jQuery("#"+i+"_type").val();"undefined"==typeof system_values.field.tags[r]&&(system_values.field.tags[r]=[]),system_values.field.tags[r].push(o),"text"!==r&&system_values.field.tags.text.push(o),current_form_fields[i]={label:t,slug:o,type:r},jQuery("option.bound-field").trigger("change").each(function(e,a){var i=jQuery(a);0!==i.prop("value").indexOf("{")?i.text(jQuery("#"+i.prop("value")+"_lable").val()+" ["+jQuery("#"+i.prop("value")+"_lable").val()+"]"):i.text(i.prop("value").replace("{","").replace("}",""))}).removeClass("bound-field")}}},rebind_field_bindings=function(){var e,a,i=jQuery(".caldera-field-bind").not(".bound_field");if(i.length){i.addClass("bound_field");for(var t=0;t<i.length;t++){var o=jQuery(i[t]),r=o.val(),l=o.data("default"),n=o.data("exclude"),d=0,s=o.closest(".caldera-editor-processor-config-wrapper"),c=s.prop("id"),p="";if(l&&!o.hasClass("reload-binding")&&(r=l),o.is("select")){o.empty();var f=jQuery('<optgroup label="Fields">');for(var u in current_form_fields)o.data("type")&&o.data("type").split(",").indexOf(current_form_fields[u].type)<0||(o.data("id")!==u&&f.append('<option value="'+u+'"'+(r===u?'selected="selected"':"")+">"+current_form_fields[u].label+" ["+current_form_fields[u].slug+"]</option>"),d+=1);f.appendTo(o),0===d&&o.empty();for(var g in system_values)if(e=[],!(n&&n.split(",").indexOf(g)>=0)){if("system"!==g&&"variable"!==g)for(var v=jQuery(".processor-"+g),h=0;h<v.length;h++)c!==v[h].id&&(e.push(v[h].id),v.length>1&&(a=jQuery("li."+v[h].id+" .processor-line-number"))&&a.html("["+(h+1)+"]"));else e.push("__system__");var m=[];o.data("type")?(m=o.data("type").split(","),m.push("vars")):m=["text","vars"];for(var _=0;_<m.length;_++)if(system_values[g].tags&&system_values[g].tags[m[_]])for(var y=0;y<e.length;y++){jQuery("li."+e[y]).index()>jQuery("li."+c).index()&&"__system__"!==e[y]?o.closest(".caldera-editor-processors-panel-wrap").length&&(p=' disabled="disabled"'):p="";for(var f=jQuery('<optgroup label="'+system_values[g].type+("__system__"!==e[y]?" "+jQuery("li."+e[y]).find(".processor-line-number").html():"")+'"'+p+">"),b=0;b<system_values[g].tags[m[_]].length;b++){var w=system_values[g].tags[m[_]][b];"__system__"!==e[y]&&(w=w.replace(g,e[y])),f.append('<option value="{'+w+'}"'+(r==="{"+w+"}"?'selected="selected"':"")+p+">"+system_values[g].tags[m[_]][b]+"</option>"),d+=1}f.children().length&&f.appendTo(o)}}if(0===d){if(o.empty(),o.data("type")){o.append('<option value="">No '+o.data("type").split(",").join(" or ")+" in form</option>");var k=!0}}else o.prop("disabled",!1);o.hasClass("required")||"undefined"!=typeof k||o.prepend('<option value=""></option>'),o.val(r)}}init_magic_tags(),jQuery(document).trigger("bound.fields"),jQuery(".caldera-header-save-button").prop("disabled",!1)}},jQuery(document).ready(function(e){function a(){var a=e(".layout-grid-panel"),i=0;a.each(function(a,t){var o=e(t),r=o.find(".layout-structure"),l=o.find(".row"),n=[];l.each(function(a,t){var o=e(t),r=o.children().not(".column-merge"),l=[];i+=1,r.each(function(a,t){span=e(t).attr("class").split("-"),l.push(span[2]);var o=e(t).find(".field-location");o.length&&o.each(function(t,o){var r=e(o);r.val(i+":"+(a+1)).removeAttr("disabled")})}),n.push(l.join(":"))}),r.val(n.join("|"))})}function i(a,i,o){var r,l,n="fld_"+Math.round(1e7*Math.random()),d=n,s=e("#field_config_panels");a.prop("id","").prop("title",""),r=Handlebars.compile(e("#caldera_field_config_wrapper_templ").html()),l=e.extend({},{id:d,label:"",slug:""},o),l.slug="",s.append(r(l)),a.removeClass("button-small").removeClass("button").removeClass("button-primary").removeClass("ui-draggable").removeClass("layout-new-form-field").addClass("layout-form-field").attr("data-config",n).css({display:"",opacity:""}),a.find(".layout_field_name").remove(),a.find(".field-location").prop("name","config[layout_grid][fields]["+n+"]"),a.find(".settings-panel").show(),a.appendTo(i),t(),a.find(".icon-edit").trigger("click"),e("#"+n+"_lable").focus().select(),baldrickTriggers(),e(document).trigger("field.added"),o?e("#"+d+"_type").data("type",l.type).trigger("change"):e("#"+n).trigger("field.drop"),rebuild_field_binding()}function t(){e(".toggle-options").sortable({handle:".dashicons-sort"}),e("#grid-pages-panel").sortable({placeholder:"row-drop-helper",handle:".sort-handle",items:".first-row-level",axis:"y",stop:function(){a()}}),e(".layout-column").sortable({connectWith:".layout-column",appendTo:"#grid-pages-panel",helper:"clone",items:".layout-form-field",handle:".drag-handle",cursor:"move",opacity:.7,cursorAt:{left:100,top:15},start:function(e,a){a.helper.css({width:"200px",height:"35px",paddingTop:"20px"})},stop:function(e,i){i.item.removeAttr("style"),a()}}),e("h3 .layout-new-form-field").draggable({helper:"clone",appendTo:"body"}),e(".page-toggle.button").droppable({accept:".layout-form-field",over:function(a,i){e(this).trigger("click"),e(".layout-column").sortable("refresh")}}),e(".layout-column").droppable({greedy:!0,activeClass:"ui-state-dropper",hoverClass:"ui-state-hoverable",accept:".layout-new-form-field",drop:function(a,t){var o=t.draggable.clone(),r=e(this);i(o,r)}}),a()}function o(){if(n){var a=e(".column-fieldinsert");a.length?(a.stop().fadeToggle(700),e(".layout-new-form-field").stop().fadeToggle(700)):cf_clear_puler()}}function r(){e(".caldera-editor-processors-panel ul").sortable({update:function(){rebuild_field_binding()}})}function l(a){var i=e(a),t=e("#"+i.val()+"-tmpl").length?e("#"+i.val()+"-tmpl").html():"",o=i.closest(".caldera-editor-processor-config-wrapper"),r=o.find(".caldera-config-processor-setup"),l=Handlebars.compile(t),n=o.find(".processor_config_string").val(),d=i.data("type");n=n.length&&d===i.val()?JSON.parse(n):processor_defaults[i.val()+"_cfg"],n||(n={}),n._id=o.prop("id"),n._name="config[processors]["+o.prop("id")+"][config]",l=e("<div>").html(l(n)),r.html(l.html()),"function"==typeof window[i.val()+"_init"]&&window[i.val()+"_init"](o.prop("id"),r),o.find(".no-conditions").length&&o.find(".toggle_option_tab").remove(),rebuild_field_binding(),baldrickTriggers(),e(".wp-baldrick").baldrick({request:ajaxurl,method:"POST",before:function(a){var i=e(a);i.data("addNode")&&!i.data("request")&&i.data("request","cf_get_default_setting")}})}add_new_grid_page=function(e){return{page_no:"pg_"+Math.round(1e7*Math.random())}},add_page_grid=function(a){var i=e(".page-toggle").length+1,o=e('<button type="button" data-name="Page '+i+'" data-page="'+a.rawData.page_no+'" class="page-toggle button">'+a.params.trigger.data("addtitle")+" "+i+"</button> "),r=e("#page-toggles");o.appendTo(r),r.show(),t(),o.trigger("click"),1===i&&r.hide(),e(document).trigger("add.page")},e(document).on("remove.page add.page load.page",function(a){var i=e(".page-toggle").length,t=e("#tab_pages");1>=i?t.hide():t.show()}),t(),e("#grid-pages-panel").on("click",".column-fieldinsert .dashicons-plus-alt",function(a){var t=e(this).closest(".column-container"),o=e("#newfield-tool").clone().css("display","");i(o,t)}),e("#grid-pages-panel").on("click",".column-split",function(a){var i=e(this).parent().parent(),o=i.attr("class").split("-"),r=e("<div>").insertAfter(i),l=Math.ceil(o[2]/2),n=Math.floor(o[2]/2);o[2]=l,i.attr("class",o.join("-")),o[2]=n,r.addClass(o.join("-")).append('<div class="layout-column column-container">'),e(this).remove(),t(),jQuery(".column-tools").remove(),jQuery(".column-merge").remove()}),e("#grid-pages-panel").on("click",".column-remove",function(i){var t=e(this).closest(".row"),o=t.find(".layout-form-field"),r=t.closest(".layout-grid-panel");if(o.length){if(!confirm(e("#row-remove-fields-message").text()))return;o.each(function(a,i){var t=e(i).data("config");e("#"+t).remove(),e('option[value="'+t+'"]').remove(),e('[data-bind="'+t+'"]').remove(),delete current_form_fields[t]})}t.slideUp(200,function(){if(e(this).remove(),a(),rebuild_field_binding(),!r.find(".row").length){r.remove();var i=e("#page-toggles .button-primary"),t=i.prev(),o=i.next();i.remove(),
|
2 |
+
t.length?t.trigger("click"):o.trigger("click")}e(document).trigger("remove.page")}),jQuery(".column-tools").remove(),jQuery(".column-merge").remove()}),e(".caldera-config-editor-main-panel").on("click",".caldera-add-row",function(i){i.preventDefault();var o=e(".page-active");if(!o.length)return void e(".caldera-add-page").trigger("click");var r=e('<div style="display:none;" class="first-row-level row"><div class="col-xs-12"><div class="layout-column column-container"></div></div></div>');e(".page-active").append(r),r.slideDown(200),t(),a()}),e("#grid-pages-panel").on("click",".column-join",function(i){var t=e(this).parent().parent().parent(),o=t.prev(),r=o.attr("class").split("-"),l=t.attr("class").split("-");r[2]=parseFloat(r[2])+parseFloat(l[2]),t.find(".layout-column").contents().appendTo(o.find(".layout-column")),o.attr("class",r.join("-")),t.remove(),a(),jQuery(".column-tools").remove(),jQuery(".column-merge").remove()}),e("#grid-pages-panel").on("mouseenter",".row",function(i){var t=jQuery(this);jQuery(".column-tools,.column-merge").remove(),t.children().children().first().append('<div class="column-remove column-tools"><i class="icon-remove"></i></div>'),t.children().children().last().append('<div class="column-sort column-tools" style="text-align:right;"><i class="dashicons dashicons-menu drag-handle sort-handle"></i></div>'),t.children().children().not(":first").prepend('<div class="column-merge"><div class="column-join column-tools"><i class="icon-join"></i></div></div>');var o=t.parent().parent().parent().width()/12-1;t.children().children().each(function(a,i){var t=e(i),o=t.width()/2-5;t.prepend('<div class="column-fieldinsert column-tools"><i class="dashicons dashicons-plus-alt"></i></div>'),t.parent().hasClass("col-xs-1")||(t.prepend('<div class="column-split column-tools"><i class="dashicons dashicons-leftright"></i></div>'),t.find(".column-split").css("left",o))}),jQuery(".column-merge").draggable({axis:"x",helper:"clone",appendTo:t,grid:[o,0],drag:function(i,t){e(this).addClass("dragging"),e(".column-tools").remove(),e(".column-split").remove();var o=e(this).parent().parent(),r=t.helper,l=t.originalPosition.left>r.position().left?"left":"right",n=o.prev(),d=Math.round(o.parent().width()/12-10),s=Math.abs(t.originalPosition.left-r.position().left);if(o.parent().addClass("sizing"),s>=d){var c=n.attr("class").split("-"),p=o.attr("class").split("-");c[2]=parseFloat(c[2]),p[2]=parseFloat(p[2]),"left"===l?(c[2]--,p[2]++,c[2]>0&&c[2]<c[2]+p[2]?(n.attr("class",c.join("-")),o.attr("class",p.join("-")),t.originalPosition.left=r.position().left):e(this).draggable("option","disabled",!0)):(c[2]++,p[2]--,p[2]>0&&p[2]<p[2]+p[2]?(n.attr("class",c.join("-")),o.attr("class",p.join("-")),t.originalPosition.left=r.position().left):e(this).draggable("option","disabled",!0)),a()}},stop:function(){e(this).removeClass("dragging").parent().parent().parent().removeClass("sizing")}})}),e("#grid-pages-panel").on("mouseleave",".row",function(e){jQuery(".column-tools").remove(),jQuery(".column-merge").remove()}),e("#grid-pages-panel").on("click",".layout-form-field .icon-remove",function(){var a=e(this),i=a.parent(),t=e("#"+i.data("config"));i.slideUp(100,function(){e(this).remove()}),t.slideUp(100,function(){e(this).remove()})}),e(document).on("click",".layout-form-field .dashicons-admin-page",function(){var a=e(this),t=a.parent(),o=t.data("config"),r=e("#"+o).formJSON(),l=a.closest(".column-container"),n=t.clone().css("display",""),d={};t.hasClass("field-edit-open")&&(t.removeClass("field-edit-open"),n.removeClass("field-edit-open"),e(".caldera-editor-field-config-wrapper").hide()),r.config.fields[o]&&(d=r.config.fields[o],delete d.ID),i(n,l,d)}),e(document).on("click",".layout-form-field .icon-edit",function(){var a=e(this),i=a.parent(),t=e("#"+i.data("config")+"_type").val();e(".caldera-editor-field-config-wrapper").hide(),i.hasClass("field-edit-open")?i.removeClass("field-edit-open"):(e(".layout-form-field").removeClass("field-edit-open"),i.addClass("field-edit-open"),e("#"+i.data("config")).show()),e(document).trigger("show."+i.data("config")),e(document).trigger("show.fieldedit"),"radio"!==t&&"checkbox"!==t&&"dropdown"!==t&&"toggle_switch"!==t||e("#"+i.data("config")+"_auto").trigger("change")}),e("body").on("click",".layout-modal-edit-closer,.layout-modal-save-action",function(a){a.preventDefault();var i=e(this),t=e(".layout-form-field.edit-open"),o=i.closest(".layout-modal-container");settings=o.find(".settings-panel").first(),e(".edit-open").removeClass("edit-open"),settings.appendTo(t.find(".settings-wrapper")).hide(),o.hide()}),e(".layout-editor-body").on("change",".layout-core-pod-query",function(){e(this).parent().find(".settings-panel-row").remove(),e(".edit-open").find(".drag-handle .set-pod").html(" - "+e(this).val())}),e(".layout-editor-body").on("click",".remove-where",function(){e(this).closest(".settings-panel-row").remove()}),e(".layout-editor-body").on("click",".use-pod-container",function(){var a=e(this),i=a.prev(),t=i.val();if(t.length){e(".edit-open").find(".drag-handle .set-pod").html(" - "+i.val()),a.parent().parent().find(".spinner").css("display","inline-block");var o={action:"pq_loadpod",pod_reference:{pod:t}};e.post(ajaxurl,o,function(i){a.parent().find(".spinner").css("display","none");var t=e("#where-line-tmpl").html(),o="",r=a.closest(".settings-panel").data("container");for(var l in i)o+='<option value="'+i[l]+'">'+i[l]+"</option>";t=t.replace(/{{fields}}/g,o).replace(/{{container_id}}/g,r),a.parent().append(t)})}}),e(".caldera-editor-header").on("click",".column-sort .icon-edit",function(e){}),e(".layout-editor-body").on("tray_loaded",".layout-template-tray",function(){t()}),e(".caldera-editor-header").on("click",".caldera-editor-header-nav a",function(a){a.preventDefault();var i=e(this);e(".caldera-editor-header-nav li").removeClass("active"),e(".caldera-editor-body").hide(),e(i.attr("href")).show(),i.parent().addClass("active"),rebind_field_bindings()}),e("body").on("change",".required",function(){check_required_bindings(this)}),e("body").on("submit",".caldera-forms-options-form",function(a){var i=e(".required.has-error");i.length&&a.preventDefault()}),e(".caldera-editor-body").on("click",".add-toggle-option",function(a){var i=e(this);if(i.data("bulk"))return e(i.data("bulk")).toggle(),void e(i.data("bulk")).find("textarea").focus();var t=i.closest(".caldera-editor-field-config-wrapper"),o=t.find(".toggle-options"),r=e("#field-option-row-tmpl").html(),l=Handlebars.compile(r),n="opt"+parseInt(1048576*(Math.random()+1)),d={_name:"config[fields]["+t.prop("id")+"][config]",option:{}};if(i.data("options")){for(var s=e(i.data("options")),c=s.val().split("\n"),p=!1,f=0;f<c.length;f++){var u=c[f],g=u,v=g.split("|");v.length>1&&(g=v[0],u=v[1],p=!0),d.option["opt"+parseInt(1048576*(Math.random()+f))]={value:g,label:u,"default":!1}}e(i.data("options")).parent().hide(),s.val(""),!0===p?t.find(".toggle_show_values").prop("checked",!0):t.find(".toggle_show_values").prop("checked",!1),o.empty()}else d.option[n]={value:"",label:"","default":!1};e(".preset_options").val(""),o.append(l(d)),t.find(".toggle_show_values").trigger("change"),e(".toggle-options").sortable({handle:".dashicons-sort"}),c||o.find(".toggle_label_field").last().focus()}),e(".caldera-editor-body").on("change",".preset_options",function(a){var i=e(this),t=i.val(),o=e(i.data("bulk"));preset_options&&preset_options[t]&&preset_options[t].data&&("object"==typeof preset_options[t].data&&preset_options[t].data.length&&(preset_options[t].data=preset_options[t].data.join("\n")),o.val(preset_options[t].data))}),e(".caldera-editor-body").on("click",".toggle-remove-option",function(a){var i=e(this).closest(".caldera-editor-field-config-wrapper").find(".field-config").first();e(this).parent().remove(),i.trigger("change"),e(document).trigger("option.remove")}),e(".caldera-editor-body").on("click",".page-toggle",function(a){var i=e(this),t=i.parent(),o=t.find(".button");o.removeClass("button-primary"),e(".layout-grid-panel").hide().removeClass("page-active"),e("#"+i.data("page")).show().addClass("page-active"),i.addClass("button-primary"),o.each(function(a,i){e(i).html(t.data("title")+" "+(a+1))}),1===o.length&&t.hide()}),e(".caldera-editor-body").on("blur toggle.values",".toggle_label_field",function(a){var i=e(this),t=i.prev();t.val().length||t.val(i.val())}),e(document).on("change focusout",".toggle_value_field",function(){e(document).trigger("show.fieldedit")}),e(document).on("show.fieldedit option.remove",function(a){e(".toggle_value_field.has-error").removeClass("has-error");for(var i=e("#"+e(".layout-form-field.field-edit-open").data("config")),t=i.find(".toggle_value_field"),o=i.find(".notice"),r=0,l=0;l<t.length;l++){for(var n=(t[l].value,0),d=0;d<t.length;d++)t[l]!==t[d]&&t[l].value===t[d].value&&(e(t[d]).addClass("has-error"),n++);n>0&&(e(t[l]).addClass("has-error"),r++)}r>0?(o.slideDown(),a.preventDefault()):o.slideUp()});var n=!1;focus_initial_field=function(a){var i=e(".layout-grid-panel .icon-edit").first();i.length?i.trigger("click"):(e(".layout-column.column-container").first().trigger("mouseover"),n=setInterval(o,500)),e(document).off("load.page",focus_initial_field)},e(document).on("load.page",focus_initial_field),cf_clear_puler=function(){n&&(clearTimeout(n),e(document).off("mouseover",".layout-new-form-field, .column-fieldinsert",cf_clear_puler)),e(".layout-new-form-field, .column-fieldinsert").fadeIn()},e(document).on("mouseover",".layout-new-form-field, .column-fieldinsert",cf_clear_puler),rebuild_field_binding(),e(document).trigger("load.page"),e("body").on("click",".caldera-processor-nav a",function(a){a.preventDefault();var i=e(this);e(".caldera-processor-nav").removeClass("active"),e(".caldera-editor-processor-config-wrapper").hide(),e(i.attr("href")).show(),i.parent().addClass("active")}),e("body").on("click",".add-new-processor",function(a){var i=e(this),t=Handlebars.compile(e("#processor-wrapper-tmpl").html());wrap=e(".active-processors-list"),process_conf=e(".caldera-editor-processor-config"),processid=Math.round(1e8*Math.random()),new_templ=Handlebars.compile(e("#processor-line-tmpl").html()),new_proc={id:"fp_"+processid,type:i.data("type")},wrap.append(new_templ(new_proc)),process_conf.append(t(new_proc)),e("#form_processor_baldrickModalCloser").trigger("click"),e(".caldera-processor-nav a").last().trigger("click"),e("#fp_"+processid+"_type").val(i.data("type")).trigger("change"),r(),baldrickTriggers()}),e("body").on("click",".delete-processor",function(a){var i=e(this),t=i.closest(".caldera-editor-processor-config-wrapper");t.data("type");confirm(i.data("confirm"))&&(e("."+t.prop("id")).remove(),t.remove(),e(".caldera-processor-nav a").first().trigger("click"),rebuild_field_binding())}),e("body").on("change",".caldera-select-processor-type",function(a){var i=e(this),t=i.closest(".caldera-editor-processor-config-wrapper"),o=i.find('option[value="'+i.val()+'"]').text(),r=t.find(".caldera-editor-processor-title"),n=e(".caldera-processor-nav.active a");""===o&&(o=r.data("title")),r.html(o),n.html(o+' <span class="processor-line-number"></span>').parent().addClass("processor_type_"+i.val()),l(this),rebuild_field_binding()}),e(document).on("click","#cf-shortcode-preview",function(){e(this).focus().select()}),e(document).on("change",".cf-email-preview-toggle",function(){var a=e(this),i=e(".caldera-header-email-preview-button");a.is(":checked")?i.show().attr("aria-hidden","false").css("visibility","visible"):i.hide().attr("aria-hidden","true").css("visibility","hidden")}),rebuild_field_binding(),e(".caldera-select-processor-type").each(function(e,a){l(a)}),r()}),Handlebars.registerHelper("_field",function(e){var a=this,i="",t="",o="",r=this[e.hash.slug]?' data-default="'+this[e.hash.slug]+'"':"";e.hash.required&&(i=" required"),e.hash.exclude&&(o='data-exclude="'+e.hash.exclude+'"'),e.hash.array&&(t="[]","true"!==e.hash.array&&(r='value="'+e.hash.array+'"')),out="<select "+(e.hash.type?'data-type="'+e.hash.type+'"':"")+r+" "+o+' name="'+this._name+"["+e.hash.slug+"]"+t+'" id="'+this._id+"_"+e.hash.slug+'" class="block-input field-config caldera-field-bind'+i+'">',this[e.hash.slug]?out+='<option class="bound-field" value="'+this[e.hash.slug]+'" class="bound-field"></option>':e.hash.required||(out+='<option value=""></option>');for(var l in current_form_fields){var n="";e.hash.type&¤t_form_fields[l].type!==e.hash.type||(a[e.hash.slug]&&a[e.hash.slug]===l&&(n=' selected="selected"'),out+='<option value="'+l+'"'+n+">"+current_form_fields[l].label+" ["+current_form_fields[l].slug+"]</option>")}return out+="</select>",e.hash.required&&(out+='<input class="field-config" name="'+this._name+'[_required_bounds][]" type="hidden" value="'+e.hash.slug+'">'),out}),Handlebars.registerHelper("console",function(e,a){console.log(this)});
|
assets/js/fields.js
ADDED
@@ -0,0 +1,4833 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
* jQuery miniColors: A small color selector
|
3 |
+
*
|
4 |
+
* Copyright 2011 Cory LaViska for A Beautiful Site, LLC. (http://abeautifulsite.net/)
|
5 |
+
*
|
6 |
+
* Dual licensed under the MIT or GPL Version 2 licenses
|
7 |
+
*
|
8 |
+
*/
|
9 |
+
if(jQuery)(function($){$.extend($.fn,{miniColors:function(o,data){var create=function(input,o,data){var color=expandHex(input.val());if(!color)color='ffffff';var hsb=hex2hsb(color);var trigger=$('<span class="input-group-addon" style="background-color: #'+color+'" href="#"></span>');trigger.insertAfter(input);input.addClass('miniColors').data('original-maxlength',input.attr('maxlength')||null).data('original-autocomplete',input.attr('autocomplete')||null).data('letterCase',o.letterCase?o.letterCase:'uppercase').data('trigger',trigger).data('hsb',hsb).data('change',o.change?o.change:null).data('close',o.close?o.close:null).data('open',o.open?o.open:null).attr('maxlength',7).attr('autocomplete','off').val('#'+convertCase(color,o.letterCase)).trigger('change');if(o.readonly)input.prop('readonly',true);if(o.disabled)disable(input);trigger.on('click.miniColors',function(event){event.preventDefault();if(input.val()==='')input.val('#').trigger('change');show(input)});input.on('focus.miniColors',function(event){if(input.val()==='')input.val('#').trigger('change');show(input)});input.on('blur.miniColors',function(event){var hex=expandHex(hsb2hex(input.data('hsb')));input.val(hex?'#'+convertCase(hex,input.data('letterCase')):'').trigger('change')});input.on('keydown.miniColors',function(event){if(event.keyCode===9)hide(input)});input.on('keyup.miniColors',function(event){setColorFromInput(input)});input.on('paste.miniColors',function(event){setTimeout(function(){setColorFromInput(input)},5)})};var destroy=function(input){hide();input=$(input);input.data('trigger').remove();input.attr('autocomplete',input.data('original-autocomplete')).attr('maxlength',input.data('original-maxlength')).removeData().removeClass('miniColors').off('.miniColors');$(document).off('.miniColors')};var enable=function(input){input.prop('disabled',false).data('trigger').css('opacity',1)};var disable=function(input){hide(input);input.prop('disabled',true).data('trigger').css('opacity',0.5)};var show=function(input){if(input.prop('disabled'))return false;hide();var selector=$('<div class="miniColors-selector"></div>');selector.append('<div class="miniColors-colors" style="background-color: #FFF;"><div class="miniColors-colorPicker"><div class="miniColors-colorPicker-inner"></div></div>').append('<div class="miniColors-hues"><div class="miniColors-huePicker"></div></div>').css('display','none').addClass(input.attr('class')).removeClass('form-control');var hsb=input.data('hsb');selector.find('.miniColors-colors').css('backgroundColor','#'+hsb2hex({h:hsb.h,s:100,b:100}));var colorPosition=input.data('colorPosition');if(!colorPosition)colorPosition=getColorPositionFromHSB(hsb);selector.find('.miniColors-colorPicker').css('top',colorPosition.y+'px').css('left',colorPosition.x+'px');var huePosition=input.data('huePosition');if(!huePosition)huePosition=getHuePositionFromHSB(hsb);selector.find('.miniColors-huePicker').css('top',huePosition.y+'px');input.data('selector',selector).data('huePicker',selector.find('.miniColors-huePicker')).data('colorPicker',selector.find('.miniColors-colorPicker')).data('mousebutton',0);$('BODY').append(selector);var trigger=input.data('trigger'),hidden=!input.is(':visible'),top=hidden?trigger.offset().top+trigger.outerHeight():input.offset().top+input.outerHeight(),left=hidden?trigger.offset().left:input.offset().left,selectorWidth=selector.outerWidth(),selectorHeight=selector.outerHeight(),triggerWidth=trigger.outerWidth(),triggerHeight=trigger.outerHeight(),windowHeight=$(window).height(),windowWidth=$(window).width(),scrollTop=$(window).scrollTop(),scrollLeft=$(window).scrollLeft();if((top+selectorHeight)>windowHeight+scrollTop)top=top-selectorHeight-triggerHeight;if((left+selectorWidth)>windowWidth+scrollLeft)left=left-selectorWidth+triggerWidth;selector.css({top:top,left:left}).fadeIn(100);selector.on('selectstart',function(){return false});if(!$.browser.msie||($.browser.msie&&$.browser.version>=9)){$(window).on('resize.miniColors',function(event){hide(input)})}$(document).on('mousedown.miniColors touchstart.miniColors',function(event){input.data('mousebutton',1);var testSubject=$(event.target).parents().andSelf();if(testSubject.hasClass('miniColors-colors')){event.preventDefault();input.data('moving','colors');moveColor(input,event)}if(testSubject.hasClass('miniColors-hues')){event.preventDefault();input.data('moving','hues');moveHue(input,event)}if(testSubject.hasClass('miniColors-selector')){event.preventDefault();return}if(testSubject.hasClass('miniColors'))return;hide(input)});$(document).on('mouseup.miniColors touchend.miniColors',function(event){event.preventDefault();input.data('mousebutton',0).removeData('moving')}).on('mousemove.miniColors touchmove.miniColors',function(event){event.preventDefault();if(input.data('mousebutton')===1){if(input.data('moving')==='colors')moveColor(input,event);if(input.data('moving')==='hues')moveHue(input,event)}});if(input.data('open')){input.data('open').call(input.get(0),'#'+hsb2hex(hsb),hsb2rgb(hsb))}};var hide=function(input){if(!input)input=$('.miniColors');input.each(function(){var selector=$(this).data('selector');$(this).removeData('selector');$(selector).fadeOut(100,function(){if(input.data('close')){var hsb=input.data('hsb'),hex=hsb2hex(hsb);input.data('close').call(input.get(0),'#'+hex,hsb2rgb(hsb))}$(this).remove()})});$(document).off('.miniColors')};var moveColor=function(input,event){var colorPicker=input.data('colorPicker');colorPicker.hide();var position={x:event.pageX,y:event.pageY};if(event.originalEvent.changedTouches){position.x=event.originalEvent.changedTouches[0].pageX;position.y=event.originalEvent.changedTouches[0].pageY}position.x=position.x-input.data('selector').find('.miniColors-colors').offset().left-5;position.y=position.y-input.data('selector').find('.miniColors-colors').offset().top-5;if(position.x<=-5)position.x=-5;if(position.x>=144)position.x=144;if(position.y<=-5)position.y=-5;if(position.y>=144)position.y=144;input.data('colorPosition',position);colorPicker.css('left',position.x).css('top',position.y).show();var s=Math.round((position.x+5)*0.67);if(s<0)s=0;if(s>100)s=100;var b=100-Math.round((position.y+5)*0.67);if(b<0)b=0;if(b>100)b=100;var hsb=input.data('hsb');hsb.s=s;hsb.b=b;setColor(input,hsb,true)};var moveHue=function(input,event){var huePicker=input.data('huePicker');huePicker.hide();var position={y:event.pageY};if(event.originalEvent.changedTouches){position.y=event.originalEvent.changedTouches[0].pageY}position.y=position.y-input.data('selector').find('.miniColors-colors').offset().top-1;if(position.y<=-1)position.y=-1;if(position.y>=149)position.y=149;input.data('huePosition',position);huePicker.css('top',position.y).show();var h=Math.round((150-position.y-1)*2.4);if(h<0)h=0;if(h>360)h=360;var hsb=input.data('hsb');hsb.h=h;setColor(input,hsb,true)};var setColor=function(input,hsb,updateInput){input.data('hsb',hsb);var hex=hsb2hex(hsb);if(updateInput)input.val('#'+convertCase(hex,input.data('letterCase'))).trigger('change');input.data('trigger').css('backgroundColor','#'+hex);if(input.data('selector'))input.data('selector').find('.miniColors-colors').css('backgroundColor','#'+hsb2hex({h:hsb.h,s:100,b:100}));if(input.data('change')){if(hex===input.data('lastChange'))return;input.data('change').call(input.get(0),'#'+hex,hsb2rgb(hsb));input.data('lastChange',hex)}};var setColorFromInput=function(input){input.val('#'+cleanHex(input.val())).trigger('change');var hex=expandHex(input.val());if(!hex)return false;var hsb=hex2hsb(hex);var currentHSB=input.data('hsb');if(hsb.h===currentHSB.h&&hsb.s===currentHSB.s&&hsb.b===currentHSB.b)return true;var colorPosition=getColorPositionFromHSB(hsb);var colorPicker=$(input.data('colorPicker'));colorPicker.css('top',colorPosition.y+'px').css('left',colorPosition.x+'px');input.data('colorPosition',colorPosition);var huePosition=getHuePositionFromHSB(hsb);var huePicker=$(input.data('huePicker'));huePicker.css('top',huePosition.y+'px');input.data('huePosition',huePosition);setColor(input,hsb);return true};var convertCase=function(string,letterCase){if(letterCase==='lowercase')return string.toLowerCase();if(letterCase==='uppercase')return string.toUpperCase();return string};var getColorPositionFromHSB=function(hsb){var x=Math.ceil(hsb.s/0.67);if(x<0)x=0;if(x>150)x=150;var y=150-Math.ceil(hsb.b/0.67);if(y<0)y=0;if(y>150)y=150;return{x:x-5,y:y-5}};var getHuePositionFromHSB=function(hsb){var y=150-(hsb.h/2.4);if(y<0)h=0;if(y>150)h=150;return{y:y-1}};var cleanHex=function(hex){return hex.replace(/[^A-F0-9]/ig,'')};var expandHex=function(hex){hex=cleanHex(hex);if(!hex)return null;if(hex.length===3)hex=hex[0]+hex[0]+hex[1]+hex[1]+hex[2]+hex[2];return hex.length===6?hex:null};var hsb2rgb=function(hsb){var rgb={};var h=Math.round(hsb.h);var s=Math.round(hsb.s*255/100);var v=Math.round(hsb.b*255/100);if(s===0){rgb.r=rgb.g=rgb.b=v}else{var t1=v;var t2=(255-s)*v/255;var t3=(t1-t2)*(h%60)/60;if(h===360)h=0;if(h<60){rgb.r=t1;rgb.b=t2;rgb.g=t2+t3}else if(h<120){rgb.g=t1;rgb.b=t2;rgb.r=t1-t3}else if(h<180){rgb.g=t1;rgb.r=t2;rgb.b=t2+t3}else if(h<240){rgb.b=t1;rgb.r=t2;rgb.g=t1-t3}else if(h<300){rgb.b=t1;rgb.g=t2;rgb.r=t2+t3}else if(h<360){rgb.r=t1;rgb.g=t2;rgb.b=t1-t3}else{rgb.r=0;rgb.g=0;rgb.b=0}}return{r:Math.round(rgb.r),g:Math.round(rgb.g),b:Math.round(rgb.b)}};var rgb2hex=function(rgb){var hex=[rgb.r.toString(16),rgb.g.toString(16),rgb.b.toString(16)];$.each(hex,function(nr,val){if(val.length===1)hex[nr]='0'+val});return hex.join('')};var hex2rgb=function(hex){hex=parseInt(((hex.indexOf('#')>-1)?hex.substring(1):hex),16);return{r:hex>>16,g:(hex&0x00FF00)>>8,b:(hex&0x0000FF)}};var rgb2hsb=function(rgb){var hsb={h:0,s:0,b:0};var min=Math.min(rgb.r,rgb.g,rgb.b);var max=Math.max(rgb.r,rgb.g,rgb.b);var delta=max-min;hsb.b=max;hsb.s=max!==0?255*delta/max:0;if(hsb.s!==0){if(rgb.r===max){hsb.h=(rgb.g-rgb.b)/delta}else if(rgb.g===max){hsb.h=2+(rgb.b-rgb.r)/delta}else{hsb.h=4+(rgb.r-rgb.g)/delta}}else{hsb.h=-1}hsb.h*=60;if(hsb.h<0){hsb.h+=360}hsb.s*=100/255;hsb.b*=100/255;return hsb};var hex2hsb=function(hex){var hsb=rgb2hsb(hex2rgb(hex));if(hsb.s===0)hsb.h=360;return hsb};var hsb2hex=function(hsb){return rgb2hex(hsb2rgb(hsb))};switch(o){case'readonly':$(this).each(function(){if(!$(this).hasClass('miniColors'))return;$(this).prop('readonly',data)});return $(this);case'disabled':$(this).each(function(){if(!$(this).hasClass('miniColors'))return;if(data){disable($(this))}else{enable($(this))}});return $(this);case'value':if(data===undefined){if(!$(this).hasClass('miniColors'))return;var input=$(this),hex=expandHex(input.val());return hex?'#'+convertCase(hex,input.data('letterCase')):null}$(this).each(function(){if(!$(this).hasClass('miniColors'))return;$(this).val(data).trigger('change');setColorFromInput($(this))});return $(this);case'destroy':$(this).each(function(){if(!$(this).hasClass('miniColors'))return;destroy($(this))});return $(this);default:if(!o)o={};$(this).each(function(){if($(this)[0].tagName.toLowerCase()!=='input')return;if($(this).data('trigger'))return;create($(this),o,data)});return $(this)}}})})(jQuery);
|
10 |
+
function color_picker_init(){
|
11 |
+
jQuery('.minicolor-picker').miniColors();
|
12 |
+
}
|
13 |
+
|
14 |
+
/* =========================================================
|
15 |
+
* bootstrap-cfdatepicker.js
|
16 |
+
* Repo: https://github.com/eternicode/bootstrap-cfdatepicker/
|
17 |
+
* Demo: http://eternicode.github.io/bootstrap-cfdatepicker/
|
18 |
+
* Docs: http://bootstrap-cfdatepicker.readthedocs.org/
|
19 |
+
* Forked from http://www.eyecon.ro/bootstrap-cfdatepicker
|
20 |
+
* =========================================================
|
21 |
+
* Started by Stefan Petre; improvements by Andrew Rowls + contributors
|
22 |
+
*
|
23 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
24 |
+
* you may not use this file except in compliance with the License.
|
25 |
+
* You may obtain a copy of the License at
|
26 |
+
*
|
27 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
28 |
+
*
|
29 |
+
* Unless required by applicable law or agreed to in writing, software
|
30 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
31 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
32 |
+
* See the License for the specific language governing permissions and
|
33 |
+
* limitations under the License.
|
34 |
+
* ========================================================= */
|
35 |
+
|
36 |
+
(function($, undefined){
|
37 |
+
|
38 |
+
var $window = $(window);
|
39 |
+
|
40 |
+
function UTCDate(){
|
41 |
+
return new Date(Date.UTC.apply(Date, arguments));
|
42 |
+
}
|
43 |
+
function UTCToday(){
|
44 |
+
var today = new Date();
|
45 |
+
return UTCDate(today.getFullYear(), today.getMonth(), today.getDate());
|
46 |
+
}
|
47 |
+
function alias(method){
|
48 |
+
return function(){
|
49 |
+
return this[method].apply(this, arguments);
|
50 |
+
};
|
51 |
+
}
|
52 |
+
|
53 |
+
var DateArray = (function(){
|
54 |
+
var extras = {
|
55 |
+
get: function(i){
|
56 |
+
return this.slice(i)[0];
|
57 |
+
},
|
58 |
+
contains: function(d){
|
59 |
+
// Array.indexOf is not cross-browser;
|
60 |
+
// $.inArray doesn't work with Dates
|
61 |
+
var val = d && d.valueOf();
|
62 |
+
for (var i=0, l=this.length; i < l; i++)
|
63 |
+
if (this[i].valueOf() === val)
|
64 |
+
return i;
|
65 |
+
return -1;
|
66 |
+
},
|
67 |
+
remove: function(i){
|
68 |
+
this.splice(i,1);
|
69 |
+
},
|
70 |
+
replace: function(new_array){
|
71 |
+
if (!new_array)
|
72 |
+
return;
|
73 |
+
if (!$.isArray(new_array))
|
74 |
+
new_array = [new_array];
|
75 |
+
this.clear();
|
76 |
+
this.push.apply(this, new_array);
|
77 |
+
},
|
78 |
+
clear: function(){
|
79 |
+
this.splice(0);
|
80 |
+
},
|
81 |
+
copy: function(){
|
82 |
+
var a = new DateArray();
|
83 |
+
a.replace(this);
|
84 |
+
return a;
|
85 |
+
}
|
86 |
+
};
|
87 |
+
|
88 |
+
return function(){
|
89 |
+
var a = [];
|
90 |
+
a.push.apply(a, arguments);
|
91 |
+
$.extend(a, extras);
|
92 |
+
return a;
|
93 |
+
};
|
94 |
+
})();
|
95 |
+
|
96 |
+
|
97 |
+
// Picker object
|
98 |
+
|
99 |
+
var Datepicker = function(element, options){
|
100 |
+
this.dates = new DateArray();
|
101 |
+
this.viewDate = UTCToday();
|
102 |
+
this.focusDate = null;
|
103 |
+
|
104 |
+
this._process_options(options);
|
105 |
+
|
106 |
+
this.element = $(element);
|
107 |
+
this.isInline = false;
|
108 |
+
this.isInput = this.element.is('input');
|
109 |
+
this.component = this.element.is('.date') ? this.element.find('.add-on, .input-group-addon, .btn') : false;
|
110 |
+
this.hasInput = this.component && this.element.find('input').length;
|
111 |
+
if (this.component && this.component.length === 0)
|
112 |
+
this.component = false;
|
113 |
+
|
114 |
+
this.picker = $(DPGlobal.template);
|
115 |
+
this._buildEvents();
|
116 |
+
this._attachEvents();
|
117 |
+
|
118 |
+
if (this.isInline){
|
119 |
+
this.picker.addClass('cfdatepicker-inline').appendTo(this.element);
|
120 |
+
}
|
121 |
+
else {
|
122 |
+
this.picker.addClass('cfdatepicker-dropdown dropdown-menu');
|
123 |
+
}
|
124 |
+
|
125 |
+
if (this.o.rtl){
|
126 |
+
this.picker.addClass('cfdatepicker-rtl');
|
127 |
+
}
|
128 |
+
|
129 |
+
this.viewMode = this.o.startView;
|
130 |
+
|
131 |
+
if (this.o.calendarWeeks)
|
132 |
+
this.picker.find('tfoot th.today')
|
133 |
+
.attr('colspan', function(i, val){
|
134 |
+
return parseInt(val) + 1;
|
135 |
+
});
|
136 |
+
|
137 |
+
this._allow_update = false;
|
138 |
+
|
139 |
+
this.setStartDate(this._o.startDate);
|
140 |
+
this.setEndDate(this._o.endDate);
|
141 |
+
this.setDaysOfWeekDisabled(this.o.daysOfWeekDisabled);
|
142 |
+
|
143 |
+
this.fillDow();
|
144 |
+
this.fillMonths();
|
145 |
+
|
146 |
+
this._allow_update = true;
|
147 |
+
|
148 |
+
this.update();
|
149 |
+
this.showMode();
|
150 |
+
|
151 |
+
if (this.isInline){
|
152 |
+
this.show();
|
153 |
+
}
|
154 |
+
};
|
155 |
+
|
156 |
+
Datepicker.prototype = {
|
157 |
+
constructor: Datepicker,
|
158 |
+
|
159 |
+
_process_options: function(opts){
|
160 |
+
// Store raw options for reference
|
161 |
+
this._o = $.extend({}, this._o, opts);
|
162 |
+
// Processed options
|
163 |
+
var o = this.o = $.extend({}, this._o);
|
164 |
+
|
165 |
+
// Check if "de-DE" style date is available, if not language should
|
166 |
+
// fallback to 2 letter code eg "de"
|
167 |
+
var lang = o.language;
|
168 |
+
if (!dates[lang]){
|
169 |
+
lang = lang.split('-')[0];
|
170 |
+
if (!dates[lang])
|
171 |
+
lang = defaults.language;
|
172 |
+
}
|
173 |
+
o.language = lang;
|
174 |
+
|
175 |
+
switch (o.startView){
|
176 |
+
case 2:
|
177 |
+
case 'decade':
|
178 |
+
o.startView = 2;
|
179 |
+
break;
|
180 |
+
case 1:
|
181 |
+
case 'year':
|
182 |
+
o.startView = 1;
|
183 |
+
break;
|
184 |
+
default:
|
185 |
+
o.startView = 0;
|
186 |
+
}
|
187 |
+
|
188 |
+
switch (o.minViewMode){
|
189 |
+
case 1:
|
190 |
+
case 'months':
|
191 |
+
o.minViewMode = 1;
|
192 |
+
break;
|
193 |
+
case 2:
|
194 |
+
case 'years':
|
195 |
+
o.minViewMode = 2;
|
196 |
+
break;
|
197 |
+
default:
|
198 |
+
o.minViewMode = 0;
|
199 |
+
}
|
200 |
+
|
201 |
+
o.startView = Math.max(o.startView, o.minViewMode);
|
202 |
+
|
203 |
+
// true, false, or Number > 0
|
204 |
+
if (o.multidate !== true){
|
205 |
+
o.multidate = Number(o.multidate) || false;
|
206 |
+
if (o.multidate !== false)
|
207 |
+
o.multidate = Math.max(0, o.multidate);
|
208 |
+
else
|
209 |
+
o.multidate = 1;
|
210 |
+
}
|
211 |
+
o.multidateSeparator = String(o.multidateSeparator);
|
212 |
+
|
213 |
+
o.weekStart %= 7;
|
214 |
+
o.weekEnd = ((o.weekStart + 6) % 7);
|
215 |
+
|
216 |
+
var format = DPGlobal.parseFormat(o.format);
|
217 |
+
if (o.startDate !== -Infinity){
|
218 |
+
if (!!o.startDate){
|
219 |
+
if (o.startDate instanceof Date)
|
220 |
+
o.startDate = this._local_to_utc(this._zero_time(o.startDate));
|
221 |
+
else
|
222 |
+
o.startDate = DPGlobal.parseDate(o.startDate, format, o.language);
|
223 |
+
}
|
224 |
+
else {
|
225 |
+
o.startDate = -Infinity;
|
226 |
+
}
|
227 |
+
}
|
228 |
+
if (o.endDate !== Infinity){
|
229 |
+
if (!!o.endDate){
|
230 |
+
if (o.endDate instanceof Date)
|
231 |
+
o.endDate = this._local_to_utc(this._zero_time(o.endDate));
|
232 |
+
else
|
233 |
+
o.endDate = DPGlobal.parseDate(o.endDate, format, o.language);
|
234 |
+
}
|
235 |
+
else {
|
236 |
+
o.endDate = Infinity;
|
237 |
+
}
|
238 |
+
}
|
239 |
+
|
240 |
+
o.daysOfWeekDisabled = o.daysOfWeekDisabled||[];
|
241 |
+
if (!$.isArray(o.daysOfWeekDisabled))
|
242 |
+
o.daysOfWeekDisabled = o.daysOfWeekDisabled.split(/[,\s]*/);
|
243 |
+
o.daysOfWeekDisabled = $.map(o.daysOfWeekDisabled, function(d){
|
244 |
+
return parseInt(d, 10);
|
245 |
+
});
|
246 |
+
|
247 |
+
var plc = String(o.orientation).toLowerCase().split(/\s+/g),
|
248 |
+
_plc = o.orientation.toLowerCase();
|
249 |
+
plc = $.grep(plc, function(word){
|
250 |
+
return (/^auto|left|right|top|bottom$/).test(word);
|
251 |
+
});
|
252 |
+
o.orientation = {x: 'auto', y: 'auto'};
|
253 |
+
if (!_plc || _plc === 'auto')
|
254 |
+
; // no action
|
255 |
+
else if (plc.length === 1){
|
256 |
+
switch (plc[0]){
|
257 |
+
case 'top':
|
258 |
+
case 'bottom':
|
259 |
+
o.orientation.y = plc[0];
|
260 |
+
break;
|
261 |
+
case 'left':
|
262 |
+
case 'right':
|
263 |
+
o.orientation.x = plc[0];
|
264 |
+
break;
|
265 |
+
}
|
266 |
+
}
|
267 |
+
else {
|
268 |
+
_plc = $.grep(plc, function(word){
|
269 |
+
return (/^left|right$/).test(word);
|
270 |
+
});
|
271 |
+
o.orientation.x = _plc[0] || 'auto';
|
272 |
+
|
273 |
+
_plc = $.grep(plc, function(word){
|
274 |
+
return (/^top|bottom$/).test(word);
|
275 |
+
});
|
276 |
+
o.orientation.y = _plc[0] || 'auto';
|
277 |
+
}
|
278 |
+
},
|
279 |
+
_events: [],
|
280 |
+
_secondaryEvents: [],
|
281 |
+
_applyEvents: function(evs){
|
282 |
+
for (var i=0, el, ch, ev; i < evs.length; i++){
|
283 |
+
el = evs[i][0];
|
284 |
+
if (evs[i].length === 2){
|
285 |
+
ch = undefined;
|
286 |
+
ev = evs[i][1];
|
287 |
+
}
|
288 |
+
else if (evs[i].length === 3){
|
289 |
+
ch = evs[i][1];
|
290 |
+
ev = evs[i][2];
|
291 |
+
}
|
292 |
+
el.on(ev, ch);
|
293 |
+
}
|
294 |
+
},
|
295 |
+
_unapplyEvents: function(evs){
|
296 |
+
for (var i=0, el, ev, ch; i < evs.length; i++){
|
297 |
+
el = evs[i][0];
|
298 |
+
if (evs[i].length === 2){
|
299 |
+
ch = undefined;
|
300 |
+
ev = evs[i][1];
|
301 |
+
}
|
302 |
+
else if (evs[i].length === 3){
|
303 |
+
ch = evs[i][1];
|
304 |
+
ev = evs[i][2];
|
305 |
+
}
|
306 |
+
el.off(ev, ch);
|
307 |
+
}
|
308 |
+
},
|
309 |
+
_buildEvents: function(){
|
310 |
+
if (this.isInput){ // single input
|
311 |
+
this._events = [
|
312 |
+
[this.element, {
|
313 |
+
focus: $.proxy(this.show, this),
|
314 |
+
keyup: $.proxy(function(e){
|
315 |
+
if ($.inArray(e.keyCode, [27,37,39,38,40,32,13,9]) === -1)
|
316 |
+
this.update();
|
317 |
+
}, this),
|
318 |
+
keydown: $.proxy(this.keydown, this)
|
319 |
+
}]
|
320 |
+
];
|
321 |
+
}
|
322 |
+
else if (this.component && this.hasInput){ // component: input + button
|
323 |
+
this._events = [
|
324 |
+
// For components that are not readonly, allow keyboard nav
|
325 |
+
[this.element.find('input'), {
|
326 |
+
focus: $.proxy(this.show, this),
|
327 |
+
keyup: $.proxy(function(e){
|
328 |
+
if ($.inArray(e.keyCode, [27,37,39,38,40,32,13,9]) === -1)
|
329 |
+
this.update();
|
330 |
+
}, this),
|
331 |
+
keydown: $.proxy(this.keydown, this)
|
332 |
+
}],
|
333 |
+
[this.component, {
|
334 |
+
click: $.proxy(this.show, this)
|
335 |
+
}]
|
336 |
+
];
|
337 |
+
}
|
338 |
+
else if (this.element.is('div')){ // inline cfdatepicker
|
339 |
+
this.isInline = true;
|
340 |
+
}
|
341 |
+
else {
|
342 |
+
this._events = [
|
343 |
+
[this.element, {
|
344 |
+
click: $.proxy(this.show, this)
|
345 |
+
}]
|
346 |
+
];
|
347 |
+
}
|
348 |
+
this._events.push(
|
349 |
+
// Component: listen for blur on element descendants
|
350 |
+
[this.element, '*', {
|
351 |
+
blur: $.proxy(function(e){
|
352 |
+
this._focused_from = e.target;
|
353 |
+
}, this)
|
354 |
+
}],
|
355 |
+
// Input: listen for blur on element
|
356 |
+
[this.element, {
|
357 |
+
blur: $.proxy(function(e){
|
358 |
+
this._focused_from = e.target;
|
359 |
+
}, this)
|
360 |
+
}]
|
361 |
+
);
|
362 |
+
|
363 |
+
this._secondaryEvents = [
|
364 |
+
[this.picker, {
|
365 |
+
click: $.proxy(this.click, this)
|
366 |
+
}],
|
367 |
+
[$(window), {
|
368 |
+
resize: $.proxy(this.place, this)
|
369 |
+
}],
|
370 |
+
[$(document), {
|
371 |
+
'mousedown touchstart': $.proxy(function(e){
|
372 |
+
// Clicked outside the cfdatepicker, hide it
|
373 |
+
if (!(
|
374 |
+
this.element.is(e.target) ||
|
375 |
+
this.element.find(e.target).length ||
|
376 |
+
this.picker.is(e.target) ||
|
377 |
+
this.picker.find(e.target).length
|
378 |
+
)){
|
379 |
+
this.hide();
|
380 |
+
}
|
381 |
+
}, this)
|
382 |
+
}]
|
383 |
+
];
|
384 |
+
},
|
385 |
+
_attachEvents: function(){
|
386 |
+
this._detachEvents();
|
387 |
+
this._applyEvents(this._events);
|
388 |
+
},
|
389 |
+
_detachEvents: function(){
|
390 |
+
this._unapplyEvents(this._events);
|
391 |
+
},
|
392 |
+
_attachSecondaryEvents: function(){
|
393 |
+
this._detachSecondaryEvents();
|
394 |
+
this._applyEvents(this._secondaryEvents);
|
395 |
+
},
|
396 |
+
_detachSecondaryEvents: function(){
|
397 |
+
this._unapplyEvents(this._secondaryEvents);
|
398 |
+
},
|
399 |
+
_trigger: function(event, altdate){
|
400 |
+
var date = altdate || this.dates.get(-1),
|
401 |
+
local_date = this._utc_to_local(date);
|
402 |
+
|
403 |
+
this.element.trigger({
|
404 |
+
type: event,
|
405 |
+
date: local_date,
|
406 |
+
dates: $.map(this.dates, this._utc_to_local),
|
407 |
+
format: $.proxy(function(ix, format){
|
408 |
+
if (arguments.length === 0){
|
409 |
+
ix = this.dates.length - 1;
|
410 |
+
format = this.o.format;
|
411 |
+
}
|
412 |
+
else if (typeof ix === 'string'){
|
413 |
+
format = ix;
|
414 |
+
ix = this.dates.length - 1;
|
415 |
+
}
|
416 |
+
format = format || this.o.format;
|
417 |
+
var date = this.dates.get(ix);
|
418 |
+
return DPGlobal.formatDate(date, format, this.o.language);
|
419 |
+
}, this)
|
420 |
+
});
|
421 |
+
},
|
422 |
+
|
423 |
+
show: function(){
|
424 |
+
if (!this.isInline)
|
425 |
+
this.picker.appendTo('body');
|
426 |
+
this.picker.show();
|
427 |
+
this.place();
|
428 |
+
this._attachSecondaryEvents();
|
429 |
+
this._trigger('show');
|
430 |
+
},
|
431 |
+
|
432 |
+
hide: function(){
|
433 |
+
if (this.isInline)
|
434 |
+
return;
|
435 |
+
if (!this.picker.is(':visible'))
|
436 |
+
return;
|
437 |
+
this.focusDate = null;
|
438 |
+
this.picker.hide().detach();
|
439 |
+
this._detachSecondaryEvents();
|
440 |
+
this.viewMode = this.o.startView;
|
441 |
+
this.showMode();
|
442 |
+
|
443 |
+
if (
|
444 |
+
this.o.forceParse &&
|
445 |
+
(
|
446 |
+
this.isInput && this.element.val() ||
|
447 |
+
this.hasInput && this.element.find('input').val()
|
448 |
+
)
|
449 |
+
)
|
450 |
+
this.setValue();
|
451 |
+
this._trigger('hide');
|
452 |
+
},
|
453 |
+
|
454 |
+
remove: function(){
|
455 |
+
this.hide();
|
456 |
+
this._detachEvents();
|
457 |
+
this._detachSecondaryEvents();
|
458 |
+
this.picker.remove();
|
459 |
+
delete this.element.data().cfdatepicker;
|
460 |
+
if (!this.isInput){
|
461 |
+
delete this.element.data().date;
|
462 |
+
}
|
463 |
+
},
|
464 |
+
|
465 |
+
_utc_to_local: function(utc){
|
466 |
+
return utc && new Date(utc.getTime() + (utc.getTimezoneOffset()*60000));
|
467 |
+
},
|
468 |
+
_local_to_utc: function(local){
|
469 |
+
return local && new Date(local.getTime() - (local.getTimezoneOffset()*60000));
|
470 |
+
},
|
471 |
+
_zero_time: function(local){
|
472 |
+
return local && new Date(local.getFullYear(), local.getMonth(), local.getDate());
|
473 |
+
},
|
474 |
+
_zero_utc_time: function(utc){
|
475 |
+
return utc && new Date(Date.UTC(utc.getUTCFullYear(), utc.getUTCMonth(), utc.getUTCDate()));
|
476 |
+
},
|
477 |
+
|
478 |
+
getDates: function(){
|
479 |
+
return $.map(this.dates, this._utc_to_local);
|
480 |
+
},
|
481 |
+
|
482 |
+
getUTCDates: function(){
|
483 |
+
return $.map(this.dates, function(d){
|
484 |
+
return new Date(d);
|
485 |
+
});
|
486 |
+
},
|
487 |
+
|
488 |
+
getDate: function(){
|
489 |
+
return this._utc_to_local(this.getUTCDate());
|
490 |
+
},
|
491 |
+
|
492 |
+
getUTCDate: function(){
|
493 |
+
return new Date(this.dates.get(-1));
|
494 |
+
},
|
495 |
+
|
496 |
+
setDates: function(){
|
497 |
+
var args = $.isArray(arguments[0]) ? arguments[0] : arguments;
|
498 |
+
this.update.apply(this, args);
|
499 |
+
this._trigger('changeDate');
|
500 |
+
this.setValue();
|
501 |
+
},
|
502 |
+
|
503 |
+
setUTCDates: function(){
|
504 |
+
var args = $.isArray(arguments[0]) ? arguments[0] : arguments;
|
505 |
+
this.update.apply(this, $.map(args, this._utc_to_local));
|
506 |
+
this._trigger('changeDate');
|
507 |
+
this.setValue();
|
508 |
+
},
|
509 |
+
|
510 |
+
setDate: alias('setDates'),
|
511 |
+
setUTCDate: alias('setUTCDates'),
|
512 |
+
|
513 |
+
setValue: function(){
|
514 |
+
var formatted = this.getFormattedDate();
|
515 |
+
if (!this.isInput){
|
516 |
+
if (this.component){
|
517 |
+
this.element.find('input').val(formatted).change();
|
518 |
+
}
|
519 |
+
}
|
520 |
+
else {
|
521 |
+
this.element.val(formatted).change();
|
522 |
+
}
|
523 |
+
},
|
524 |
+
|
525 |
+
getFormattedDate: function(format){
|
526 |
+
if (format === undefined)
|
527 |
+
format = this.o.format;
|
528 |
+
|
529 |
+
var lang = this.o.language;
|
530 |
+
return $.map(this.dates, function(d){
|
531 |
+
return DPGlobal.formatDate(d, format, lang);
|
532 |
+
}).join(this.o.multidateSeparator);
|
533 |
+
},
|
534 |
+
|
535 |
+
setStartDate: function(startDate){
|
536 |
+
this._process_options({startDate: startDate});
|
537 |
+
this.update();
|
538 |
+
this.updateNavArrows();
|
539 |
+
},
|
540 |
+
|
541 |
+
setEndDate: function(endDate){
|
542 |
+
this._process_options({endDate: endDate});
|
543 |
+
this.update();
|
544 |
+
this.updateNavArrows();
|
545 |
+
},
|
546 |
+
|
547 |
+
setDaysOfWeekDisabled: function(daysOfWeekDisabled){
|
548 |
+
this._process_options({daysOfWeekDisabled: daysOfWeekDisabled});
|
549 |
+
this.update();
|
550 |
+
this.updateNavArrows();
|
551 |
+
},
|
552 |
+
|
553 |
+
place: function(){
|
554 |
+
if (this.isInline)
|
555 |
+
return;
|
556 |
+
var calendarWidth = this.picker.outerWidth(),
|
557 |
+
calendarHeight = this.picker.outerHeight(),
|
558 |
+
visualPadding = 10,
|
559 |
+
windowWidth = $window.width(),
|
560 |
+
windowHeight = $window.height(),
|
561 |
+
scrollTop = $window.scrollTop();
|
562 |
+
|
563 |
+
var zIndex = parseInt(this.element.parents().filter(function(){
|
564 |
+
return $(this).css('z-index') !== 'auto';
|
565 |
+
}).first().css('z-index'))+10;
|
566 |
+
var offset = this.component ? this.component.parent().offset() : this.element.offset();
|
567 |
+
var height = this.component ? this.component.outerHeight(true) : this.element.outerHeight(false);
|
568 |
+
var width = this.component ? this.component.outerWidth(true) : this.element.outerWidth(false);
|
569 |
+
var left = offset.left,
|
570 |
+
top = offset.top;
|
571 |
+
|
572 |
+
this.picker.removeClass(
|
573 |
+
'cfdatepicker-orient-top cfdatepicker-orient-bottom '+
|
574 |
+
'cfdatepicker-orient-right cfdatepicker-orient-left'
|
575 |
+
);
|
576 |
+
|
577 |
+
if (this.o.orientation.x !== 'auto'){
|
578 |
+
this.picker.addClass('cfdatepicker-orient-' + this.o.orientation.x);
|
579 |
+
if (this.o.orientation.x === 'right')
|
580 |
+
left -= calendarWidth - width;
|
581 |
+
}
|
582 |
+
// auto x orientation is best-placement: if it crosses a window
|
583 |
+
// edge, fudge it sideways
|
584 |
+
else {
|
585 |
+
// Default to left
|
586 |
+
this.picker.addClass('cfdatepicker-orient-left');
|
587 |
+
if (offset.left < 0)
|
588 |
+
left -= offset.left - visualPadding;
|
589 |
+
else if (offset.left + calendarWidth > windowWidth)
|
590 |
+
left = windowWidth - calendarWidth - visualPadding;
|
591 |
+
}
|
592 |
+
|
593 |
+
// auto y orientation is best-situation: top or bottom, no fudging,
|
594 |
+
// decision based on which shows more of the calendar
|
595 |
+
var yorient = this.o.orientation.y,
|
596 |
+
top_overflow, bottom_overflow;
|
597 |
+
if (yorient === 'auto'){
|
598 |
+
top_overflow = -scrollTop + offset.top - calendarHeight;
|
599 |
+
bottom_overflow = scrollTop + windowHeight - (offset.top + height + calendarHeight);
|
600 |
+
if (Math.max(top_overflow, bottom_overflow) === bottom_overflow)
|
601 |
+
yorient = 'top';
|
602 |
+
else
|
603 |
+
yorient = 'bottom';
|
604 |
+
}
|
605 |
+
this.picker.addClass('cfdatepicker-orient-' + yorient);
|
606 |
+
if (yorient === 'top')
|
607 |
+
top += height;
|
608 |
+
else
|
609 |
+
top -= calendarHeight + parseInt(this.picker.css('padding-top'));
|
610 |
+
|
611 |
+
this.picker.css({
|
612 |
+
top: top,
|
613 |
+
left: left,
|
614 |
+
zIndex: zIndex
|
615 |
+
});
|
616 |
+
},
|
617 |
+
|
618 |
+
_allow_update: true,
|
619 |
+
update: function(){
|
620 |
+
if (!this._allow_update)
|
621 |
+
return;
|
622 |
+
|
623 |
+
var oldDates = this.dates.copy(),
|
624 |
+
dates = [],
|
625 |
+
fromArgs = false;
|
626 |
+
if (arguments.length){
|
627 |
+
$.each(arguments, $.proxy(function(i, date){
|
628 |
+
if (date instanceof Date)
|
629 |
+
date = this._local_to_utc(date);
|
630 |
+
dates.push(date);
|
631 |
+
}, this));
|
632 |
+
fromArgs = true;
|
633 |
+
}
|
634 |
+
else {
|
635 |
+
dates = this.isInput
|
636 |
+
? this.element.val()
|
637 |
+
: this.element.data('date') || this.element.find('input').val();
|
638 |
+
if (dates && this.o.multidate)
|
639 |
+
dates = dates.split(this.o.multidateSeparator);
|
640 |
+
else
|
641 |
+
dates = [dates];
|
642 |
+
delete this.element.data().date;
|
643 |
+
}
|
644 |
+
|
645 |
+
dates = $.map(dates, $.proxy(function(date){
|
646 |
+
return DPGlobal.parseDate(date, this.o.format, this.o.language);
|
647 |
+
}, this));
|
648 |
+
dates = $.grep(dates, $.proxy(function(date){
|
649 |
+
return (
|
650 |
+
date < this.o.startDate ||
|
651 |
+
date > this.o.endDate ||
|
652 |
+
!date
|
653 |
+
);
|
654 |
+
}, this), true);
|
655 |
+
this.dates.replace(dates);
|
656 |
+
|
657 |
+
if (this.dates.length)
|
658 |
+
this.viewDate = new Date(this.dates.get(-1));
|
659 |
+
else if (this.viewDate < this.o.startDate)
|
660 |
+
this.viewDate = new Date(this.o.startDate);
|
661 |
+
else if (this.viewDate > this.o.endDate)
|
662 |
+
this.viewDate = new Date(this.o.endDate);
|
663 |
+
|
664 |
+
if (fromArgs){
|
665 |
+
// setting date by clicking
|
666 |
+
this.setValue();
|
667 |
+
}
|
668 |
+
else if (dates.length){
|
669 |
+
// setting date by typing
|
670 |
+
if (String(oldDates) !== String(this.dates))
|
671 |
+
this._trigger('changeDate');
|
672 |
+
}
|
673 |
+
if (!this.dates.length && oldDates.length)
|
674 |
+
this._trigger('clearDate');
|
675 |
+
|
676 |
+
this.fill();
|
677 |
+
},
|
678 |
+
|
679 |
+
fillDow: function(){
|
680 |
+
var dowCnt = this.o.weekStart,
|
681 |
+
html = '<tr>';
|
682 |
+
if (this.o.calendarWeeks){
|
683 |
+
var cell = '<th class="cw"> </th>';
|
684 |
+
html += cell;
|
685 |
+
this.picker.find('.cfdatepicker-days thead tr:first-child').prepend(cell);
|
686 |
+
}
|
687 |
+
while (dowCnt < this.o.weekStart + 7){
|
688 |
+
html += '<th class="dow">'+dates[this.o.language].daysMin[(dowCnt++)%7]+'</th>';
|
689 |
+
}
|
690 |
+
html += '</tr>';
|
691 |
+
this.picker.find('.cfdatepicker-days thead').append(html);
|
692 |
+
},
|
693 |
+
|
694 |
+
fillMonths: function(){
|
695 |
+
var html = '',
|
696 |
+
i = 0;
|
697 |
+
while (i < 12){
|
698 |
+
html += '<span class="month">'+dates[this.o.language].monthsShort[i++]+'</span>';
|
699 |
+
}
|
700 |
+
this.picker.find('.cfdatepicker-months td').html(html);
|
701 |
+
},
|
702 |
+
|
703 |
+
setRange: function(range){
|
704 |
+
if (!range || !range.length)
|
705 |
+
delete this.range;
|
706 |
+
else
|
707 |
+
this.range = $.map(range, function(d){
|
708 |
+
return d.valueOf();
|
709 |
+
});
|
710 |
+
this.fill();
|
711 |
+
},
|
712 |
+
|
713 |
+
getClassNames: function(date){
|
714 |
+
var cls = [],
|
715 |
+
year = this.viewDate.getUTCFullYear(),
|
716 |
+
month = this.viewDate.getUTCMonth(),
|
717 |
+
today = new Date();
|
718 |
+
if (date.getUTCFullYear() < year || (date.getUTCFullYear() === year && date.getUTCMonth() < month)){
|
719 |
+
cls.push('old');
|
720 |
+
}
|
721 |
+
else if (date.getUTCFullYear() > year || (date.getUTCFullYear() === year && date.getUTCMonth() > month)){
|
722 |
+
cls.push('new');
|
723 |
+
}
|
724 |
+
if (this.focusDate && date.valueOf() === this.focusDate.valueOf())
|
725 |
+
cls.push('focused');
|
726 |
+
// Compare internal UTC date with local today, not UTC today
|
727 |
+
if (this.o.todayHighlight &&
|
728 |
+
date.getUTCFullYear() === today.getFullYear() &&
|
729 |
+
date.getUTCMonth() === today.getMonth() &&
|
730 |
+
date.getUTCDate() === today.getDate()){
|
731 |
+
cls.push('today');
|
732 |
+
}
|
733 |
+
if (this.dates.contains(date) !== -1)
|
734 |
+
cls.push('active');
|
735 |
+
if (date.valueOf() < this.o.startDate || date.valueOf() > this.o.endDate ||
|
736 |
+
$.inArray(date.getUTCDay(), this.o.daysOfWeekDisabled) !== -1){
|
737 |
+
cls.push('disabled');
|
738 |
+
}
|
739 |
+
if (this.range){
|
740 |
+
if (date > this.range[0] && date < this.range[this.range.length-1]){
|
741 |
+
cls.push('range');
|
742 |
+
}
|
743 |
+
if ($.inArray(date.valueOf(), this.range) !== -1){
|
744 |
+
cls.push('selected');
|
745 |
+
}
|
746 |
+
}
|
747 |
+
return cls;
|
748 |
+
},
|
749 |
+
|
750 |
+
fill: function(){
|
751 |
+
var d = new Date(this.viewDate),
|
752 |
+
year = d.getUTCFullYear(),
|
753 |
+
month = d.getUTCMonth(),
|
754 |
+
startYear = this.o.startDate !== -Infinity ? this.o.startDate.getUTCFullYear() : -Infinity,
|
755 |
+
startMonth = this.o.startDate !== -Infinity ? this.o.startDate.getUTCMonth() : -Infinity,
|
756 |
+
endYear = this.o.endDate !== Infinity ? this.o.endDate.getUTCFullYear() : Infinity,
|
757 |
+
endMonth = this.o.endDate !== Infinity ? this.o.endDate.getUTCMonth() : Infinity,
|
758 |
+
todaytxt = dates[this.o.language].today || dates['en'].today || '',
|
759 |
+
cleartxt = dates[this.o.language].clear || dates['en'].clear || '',
|
760 |
+
tooltip;
|
761 |
+
this.picker.find('.cfdatepicker-days thead th.cfdatepicker-switch')
|
762 |
+
.text(dates[this.o.language].months[month]+' '+year);
|
763 |
+
this.picker.find('tfoot th.today')
|
764 |
+
.text(todaytxt)
|
765 |
+
.toggle(this.o.todayBtn !== false);
|
766 |
+
this.picker.find('tfoot th.clear')
|
767 |
+
.text(cleartxt)
|
768 |
+
.toggle(this.o.clearBtn !== false);
|
769 |
+
this.updateNavArrows();
|
770 |
+
this.fillMonths();
|
771 |
+
var prevMonth = UTCDate(year, month-1, 28),
|
772 |
+
day = DPGlobal.getDaysInMonth(prevMonth.getUTCFullYear(), prevMonth.getUTCMonth());
|
773 |
+
prevMonth.setUTCDate(day);
|
774 |
+
prevMonth.setUTCDate(day - (prevMonth.getUTCDay() - this.o.weekStart + 7)%7);
|
775 |
+
var nextMonth = new Date(prevMonth);
|
776 |
+
nextMonth.setUTCDate(nextMonth.getUTCDate() + 42);
|
777 |
+
nextMonth = nextMonth.valueOf();
|
778 |
+
var html = [];
|
779 |
+
var clsName;
|
780 |
+
while (prevMonth.valueOf() < nextMonth){
|
781 |
+
if (prevMonth.getUTCDay() === this.o.weekStart){
|
782 |
+
html.push('<tr>');
|
783 |
+
if (this.o.calendarWeeks){
|
784 |
+
// ISO 8601: First week contains first thursday.
|
785 |
+
// ISO also states week starts on Monday, but we can be more abstract here.
|
786 |
+
var
|
787 |
+
// Start of current week: based on weekstart/current date
|
788 |
+
ws = new Date(+prevMonth + (this.o.weekStart - prevMonth.getUTCDay() - 7) % 7 * 864e5),
|
789 |
+
// Thursday of this week
|
790 |
+
th = new Date(Number(ws) + (7 + 4 - ws.getUTCDay()) % 7 * 864e5),
|
791 |
+
// First Thursday of year, year from thursday
|
792 |
+
yth = new Date(Number(yth = UTCDate(th.getUTCFullYear(), 0, 1)) + (7 + 4 - yth.getUTCDay())%7*864e5),
|
793 |
+
// Calendar week: ms between thursdays, div ms per day, div 7 days
|
794 |
+
calWeek = (th - yth) / 864e5 / 7 + 1;
|
795 |
+
html.push('<td class="cw">'+ calWeek +'</td>');
|
796 |
+
|
797 |
+
}
|
798 |
+
}
|
799 |
+
clsName = this.getClassNames(prevMonth);
|
800 |
+
clsName.push('day');
|
801 |
+
|
802 |
+
if (this.o.beforeShowDay !== $.noop){
|
803 |
+
var before = this.o.beforeShowDay(this._utc_to_local(prevMonth));
|
804 |
+
if (before === undefined)
|
805 |
+
before = {};
|
806 |
+
else if (typeof(before) === 'boolean')
|
807 |
+
before = {enabled: before};
|
808 |
+
else if (typeof(before) === 'string')
|
809 |
+
before = {classes: before};
|
810 |
+
if (before.enabled === false)
|
811 |
+
clsName.push('disabled');
|
812 |
+
if (before.classes)
|
813 |
+
clsName = clsName.concat(before.classes.split(/\s+/));
|
814 |
+
if (before.tooltip)
|
815 |
+
tooltip = before.tooltip;
|
816 |
+
}
|
817 |
+
|
818 |
+
clsName = $.unique(clsName);
|
819 |
+
html.push('<td class="'+clsName.join(' ')+'"' + (tooltip ? ' title="'+tooltip+'"' : '') + '>'+prevMonth.getUTCDate() + '</td>');
|
820 |
+
if (prevMonth.getUTCDay() === this.o.weekEnd){
|
821 |
+
html.push('</tr>');
|
822 |
+
}
|
823 |
+
prevMonth.setUTCDate(prevMonth.getUTCDate()+1);
|
824 |
+
}
|
825 |
+
this.picker.find('.cfdatepicker-days tbody').empty().append(html.join(''));
|
826 |
+
|
827 |
+
var months = this.picker.find('.cfdatepicker-months')
|
828 |
+
.find('th:eq(1)')
|
829 |
+
.text(year)
|
830 |
+
.end()
|
831 |
+
.find('span').removeClass('active');
|
832 |
+
|
833 |
+
$.each(this.dates, function(i, d){
|
834 |
+
if (d.getUTCFullYear() === year)
|
835 |
+
months.eq(d.getUTCMonth()).addClass('active');
|
836 |
+
});
|
837 |
+
|
838 |
+
if (year < startYear || year > endYear){
|
839 |
+
months.addClass('disabled');
|
840 |
+
}
|
841 |
+
if (year === startYear){
|
842 |
+
months.slice(0, startMonth).addClass('disabled');
|
843 |
+
}
|
844 |
+
if (year === endYear){
|
845 |
+
months.slice(endMonth+1).addClass('disabled');
|
846 |
+
}
|
847 |
+
|
848 |
+
html = '';
|
849 |
+
year = parseInt(year/10, 10) * 10;
|
850 |
+
var yearCont = this.picker.find('.cfdatepicker-years')
|
851 |
+
.find('th:eq(1)')
|
852 |
+
.text(year + '-' + (year + 9))
|
853 |
+
.end()
|
854 |
+
.find('td');
|
855 |
+
year -= 1;
|
856 |
+
var years = $.map(this.dates, function(d){
|
857 |
+
return d.getUTCFullYear();
|
858 |
+
}),
|
859 |
+
classes;
|
860 |
+
for (var i = -1; i < 11; i++){
|
861 |
+
classes = ['year'];
|
862 |
+
if (i === -1)
|
863 |
+
classes.push('old');
|
864 |
+
else if (i === 10)
|
865 |
+
classes.push('new');
|
866 |
+
if ($.inArray(year, years) !== -1)
|
867 |
+
classes.push('active');
|
868 |
+
if (year < startYear || year > endYear)
|
869 |
+
classes.push('disabled');
|
870 |
+
html += '<span class="' + classes.join(' ') + '">'+year+'</span>';
|
871 |
+
year += 1;
|
872 |
+
}
|
873 |
+
yearCont.html(html);
|
874 |
+
},
|
875 |
+
|
876 |
+
updateNavArrows: function(){
|
877 |
+
if (!this._allow_update)
|
878 |
+
return;
|
879 |
+
|
880 |
+
var d = new Date(this.viewDate),
|
881 |
+
year = d.getUTCFullYear(),
|
882 |
+
month = d.getUTCMonth();
|
883 |
+
switch (this.viewMode){
|
884 |
+
case 0:
|
885 |
+
if (this.o.startDate !== -Infinity && year <= this.o.startDate.getUTCFullYear() && month <= this.o.startDate.getUTCMonth()){
|
886 |
+
this.picker.find('.prev').css({visibility: 'hidden'});
|
887 |
+
}
|
888 |
+
else {
|
889 |
+
this.picker.find('.prev').css({visibility: 'visible'});
|
890 |
+
}
|
891 |
+
if (this.o.endDate !== Infinity && year >= this.o.endDate.getUTCFullYear() && month >= this.o.endDate.getUTCMonth()){
|
892 |
+
this.picker.find('.next').css({visibility: 'hidden'});
|
893 |
+
}
|
894 |
+
else {
|
895 |
+
this.picker.find('.next').css({visibility: 'visible'});
|
896 |
+
}
|
897 |
+
break;
|
898 |
+
case 1:
|
899 |
+
case 2:
|
900 |
+
if (this.o.startDate !== -Infinity && year <= this.o.startDate.getUTCFullYear()){
|
901 |
+
this.picker.find('.prev').css({visibility: 'hidden'});
|
902 |
+
}
|
903 |
+
else {
|
904 |
+
this.picker.find('.prev').css({visibility: 'visible'});
|
905 |
+
}
|
906 |
+
if (this.o.endDate !== Infinity && year >= this.o.endDate.getUTCFullYear()){
|
907 |
+
this.picker.find('.next').css({visibility: 'hidden'});
|
908 |
+
}
|
909 |
+
else {
|
910 |
+
this.picker.find('.next').css({visibility: 'visible'});
|
911 |
+
}
|
912 |
+
break;
|
913 |
+
}
|
914 |
+
},
|
915 |
+
|
916 |
+
click: function(e){
|
917 |
+
e.preventDefault();
|
918 |
+
var target = $(e.target).closest('span, td, th'),
|
919 |
+
year, month, day;
|
920 |
+
if (target.length === 1){
|
921 |
+
switch (target[0].nodeName.toLowerCase()){
|
922 |
+
case 'th':
|
923 |
+
switch (target[0].className){
|
924 |
+
case 'cfdatepicker-switch':
|
925 |
+
this.showMode(1);
|
926 |
+
break;
|
927 |
+
case 'prev':
|
928 |
+
case 'next':
|
929 |
+
var dir = DPGlobal.modes[this.viewMode].navStep * (target[0].className === 'prev' ? -1 : 1);
|
930 |
+
switch (this.viewMode){
|
931 |
+
case 0:
|
932 |
+
this.viewDate = this.moveMonth(this.viewDate, dir);
|
933 |
+
this._trigger('changeMonth', this.viewDate);
|
934 |
+
break;
|
935 |
+
case 1:
|
936 |
+
case 2:
|
937 |
+
this.viewDate = this.moveYear(this.viewDate, dir);
|
938 |
+
if (this.viewMode === 1)
|
939 |
+
this._trigger('changeYear', this.viewDate);
|
940 |
+
break;
|
941 |
+
}
|
942 |
+
this.fill();
|
943 |
+
break;
|
944 |
+
case 'today':
|
945 |
+
var date = new Date();
|
946 |
+
date = UTCDate(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0);
|
947 |
+
|
948 |
+
this.showMode(-2);
|
949 |
+
var which = this.o.todayBtn === 'linked' ? null : 'view';
|
950 |
+
this._setDate(date, which);
|
951 |
+
break;
|
952 |
+
case 'clear':
|
953 |
+
var element;
|
954 |
+
if (this.isInput)
|
955 |
+
element = this.element;
|
956 |
+
else if (this.component)
|
957 |
+
element = this.element.find('input');
|
958 |
+
if (element)
|
959 |
+
element.val("").change();
|
960 |
+
this.update();
|
961 |
+
this._trigger('changeDate');
|
962 |
+
if (this.o.autoclose)
|
963 |
+
this.hide();
|
964 |
+
break;
|
965 |
+
}
|
966 |
+
break;
|
967 |
+
case 'span':
|
968 |
+
if (!target.is('.disabled')){
|
969 |
+
this.viewDate.setUTCDate(1);
|
970 |
+
if (target.is('.month')){
|
971 |
+
day = 1;
|
972 |
+
month = target.parent().find('span').index(target);
|
973 |
+
year = this.viewDate.getUTCFullYear();
|
974 |
+
this.viewDate.setUTCMonth(month);
|
975 |
+
this._trigger('changeMonth', this.viewDate);
|
976 |
+
if (this.o.minViewMode === 1){
|
977 |
+
this._setDate(UTCDate(year, month, day));
|
978 |
+
}
|
979 |
+
}
|
980 |
+
else {
|
981 |
+
day = 1;
|
982 |
+
month = 0;
|
983 |
+
year = parseInt(target.text(), 10)||0;
|
984 |
+
this.viewDate.setUTCFullYear(year);
|
985 |
+
this._trigger('changeYear', this.viewDate);
|
986 |
+
if (this.o.minViewMode === 2){
|
987 |
+
this._setDate(UTCDate(year, month, day));
|
988 |
+
}
|
989 |
+
}
|
990 |
+
this.showMode(-1);
|
991 |
+
this.fill();
|
992 |
+
}
|
993 |
+
break;
|
994 |
+
case 'td':
|
995 |
+
if (target.is('.day') && !target.is('.disabled')){
|
996 |
+
day = parseInt(target.text(), 10)||1;
|
997 |
+
year = this.viewDate.getUTCFullYear();
|
998 |
+
month = this.viewDate.getUTCMonth();
|
999 |
+
if (target.is('.old')){
|
1000 |
+
if (month === 0){
|
1001 |
+
month = 11;
|
1002 |
+
year -= 1;
|
1003 |
+
}
|
1004 |
+
else {
|
1005 |
+
month -= 1;
|
1006 |
+
}
|
1007 |
+
}
|
1008 |
+
else if (target.is('.new')){
|
1009 |
+
if (month === 11){
|
1010 |
+
month = 0;
|
1011 |
+
year += 1;
|
1012 |
+
}
|
1013 |
+
else {
|
1014 |
+
month += 1;
|
1015 |
+
}
|
1016 |
+
}
|
1017 |
+
this._setDate(UTCDate(year, month, day));
|
1018 |
+
}
|
1019 |
+
break;
|
1020 |
+
}
|
1021 |
+
}
|
1022 |
+
if (this.picker.is(':visible') && this._focused_from){
|
1023 |
+
$(this._focused_from).focus();
|
1024 |
+
}
|
1025 |
+
delete this._focused_from;
|
1026 |
+
},
|
1027 |
+
|
1028 |
+
_toggle_multidate: function(date){
|
1029 |
+
var ix = this.dates.contains(date);
|
1030 |
+
if (!date){
|
1031 |
+
this.dates.clear();
|
1032 |
+
}
|
1033 |
+
else if (ix !== -1){
|
1034 |
+
this.dates.remove(ix);
|
1035 |
+
}
|
1036 |
+
else {
|
1037 |
+
this.dates.push(date);
|
1038 |
+
}
|
1039 |
+
if (typeof this.o.multidate === 'number')
|
1040 |
+
while (this.dates.length > this.o.multidate)
|
1041 |
+
this.dates.remove(0);
|
1042 |
+
},
|
1043 |
+
|
1044 |
+
_setDate: function(date, which){
|
1045 |
+
if (!which || which === 'date')
|
1046 |
+
this._toggle_multidate(date && new Date(date));
|
1047 |
+
if (!which || which === 'view')
|
1048 |
+
this.viewDate = date && new Date(date);
|
1049 |
+
|
1050 |
+
this.fill();
|
1051 |
+
this.setValue();
|
1052 |
+
this._trigger('changeDate');
|
1053 |
+
var element;
|
1054 |
+
if (this.isInput){
|
1055 |
+
element = this.element;
|
1056 |
+
}
|
1057 |
+
else if (this.component){
|
1058 |
+
element = this.element.find('input');
|
1059 |
+
}
|
1060 |
+
if (element){
|
1061 |
+
element.change();
|
1062 |
+
}
|
1063 |
+
if (this.o.autoclose && (!which || which === 'date')){
|
1064 |
+
this.hide();
|
1065 |
+
}
|
1066 |
+
},
|
1067 |
+
|
1068 |
+
moveMonth: function(date, dir){
|
1069 |
+
if (!date)
|
1070 |
+
return undefined;
|
1071 |
+
if (!dir)
|
1072 |
+
return date;
|
1073 |
+
var new_date = new Date(date.valueOf()),
|
1074 |
+
day = new_date.getUTCDate(),
|
1075 |
+
month = new_date.getUTCMonth(),
|
1076 |
+
mag = Math.abs(dir),
|
1077 |
+
new_month, test;
|
1078 |
+
dir = dir > 0 ? 1 : -1;
|
1079 |
+
if (mag === 1){
|
1080 |
+
test = dir === -1
|
1081 |
+
// If going back one month, make sure month is not current month
|
1082 |
+
// (eg, Mar 31 -> Feb 31 == Feb 28, not Mar 02)
|
1083 |
+
? function(){
|
1084 |
+
return new_date.getUTCMonth() === month;
|
1085 |
+
}
|
1086 |
+
// If going forward one month, make sure month is as expected
|
1087 |
+
// (eg, Jan 31 -> Feb 31 == Feb 28, not Mar 02)
|
1088 |
+
: function(){
|
1089 |
+
return new_date.getUTCMonth() !== new_month;
|
1090 |
+
};
|
1091 |
+
new_month = month + dir;
|
1092 |
+
new_date.setUTCMonth(new_month);
|
1093 |
+
// Dec -> Jan (12) or Jan -> Dec (-1) -- limit expected date to 0-11
|
1094 |
+
if (new_month < 0 || new_month > 11)
|
1095 |
+
new_month = (new_month + 12) % 12;
|
1096 |
+
}
|
1097 |
+
else {
|
1098 |
+
// For magnitudes >1, move one month at a time...
|
1099 |
+
for (var i=0; i < mag; i++)
|
1100 |
+
// ...which might decrease the day (eg, Jan 31 to Feb 28, etc)...
|
1101 |
+
new_date = this.moveMonth(new_date, dir);
|
1102 |
+
// ...then reset the day, keeping it in the new month
|
1103 |
+
new_month = new_date.getUTCMonth();
|
1104 |
+
new_date.setUTCDate(day);
|
1105 |
+
test = function(){
|
1106 |
+
return new_month !== new_date.getUTCMonth();
|
1107 |
+
};
|
1108 |
+
}
|
1109 |
+
// Common date-resetting loop -- if date is beyond end of month, make it
|
1110 |
+
// end of month
|
1111 |
+
while (test()){
|
1112 |
+
new_date.setUTCDate(--day);
|
1113 |
+
new_date.setUTCMonth(new_month);
|
1114 |
+
}
|
1115 |
+
return new_date;
|
1116 |
+
},
|
1117 |
+
|
1118 |
+
moveYear: function(date, dir){
|
1119 |
+
return this.moveMonth(date, dir*12);
|
1120 |
+
},
|
1121 |
+
|
1122 |
+
dateWithinRange: function(date){
|
1123 |
+
return date >= this.o.startDate && date <= this.o.endDate;
|
1124 |
+
},
|
1125 |
+
|
1126 |
+
keydown: function(e){
|
1127 |
+
if (this.picker.is(':not(:visible)')){
|
1128 |
+
if (e.keyCode === 27) // allow escape to hide and re-show picker
|
1129 |
+
this.show();
|
1130 |
+
return;
|
1131 |
+
}
|
1132 |
+
var dateChanged = false,
|
1133 |
+
dir, newDate, newViewDate,
|
1134 |
+
focusDate = this.focusDate || this.viewDate;
|
1135 |
+
switch (e.keyCode){
|
1136 |
+
case 27: // escape
|
1137 |
+
if (this.focusDate){
|
1138 |
+
this.focusDate = null;
|
1139 |
+
this.viewDate = this.dates.get(-1) || this.viewDate;
|
1140 |
+
this.fill();
|
1141 |
+
}
|
1142 |
+
else
|
1143 |
+
this.hide();
|
1144 |
+
e.preventDefault();
|
1145 |
+
break;
|
1146 |
+
case 37: // left
|
1147 |
+
case 39: // right
|
1148 |
+
if (!this.o.keyboardNavigation)
|
1149 |
+
break;
|
1150 |
+
dir = e.keyCode === 37 ? -1 : 1;
|
1151 |
+
if (e.ctrlKey){
|
1152 |
+
newDate = this.moveYear(this.dates.get(-1) || UTCToday(), dir);
|
1153 |
+
newViewDate = this.moveYear(focusDate, dir);
|
1154 |
+
this._trigger('changeYear', this.viewDate);
|
1155 |
+
}
|
1156 |
+
else if (e.shiftKey){
|
1157 |
+
newDate = this.moveMonth(this.dates.get(-1) || UTCToday(), dir);
|
1158 |
+
newViewDate = this.moveMonth(focusDate, dir);
|
1159 |
+
this._trigger('changeMonth', this.viewDate);
|
1160 |
+
}
|
1161 |
+
else {
|
1162 |
+
newDate = new Date(this.dates.get(-1) || UTCToday());
|
1163 |
+
newDate.setUTCDate(newDate.getUTCDate() + dir);
|
1164 |
+
newViewDate = new Date(focusDate);
|
1165 |
+
newViewDate.setUTCDate(focusDate.getUTCDate() + dir);
|
1166 |
+
}
|
1167 |
+
if (this.dateWithinRange(newDate)){
|
1168 |
+
this.focusDate = this.viewDate = newViewDate;
|
1169 |
+
this.setValue();
|
1170 |
+
this.fill();
|
1171 |
+
e.preventDefault();
|
1172 |
+
}
|
1173 |
+
break;
|
1174 |
+
case 38: // up
|
1175 |
+
case 40: // down
|
1176 |
+
if (!this.o.keyboardNavigation)
|
1177 |
+
break;
|
1178 |
+
dir = e.keyCode === 38 ? -1 : 1;
|
1179 |
+
if (e.ctrlKey){
|
1180 |
+
newDate = this.moveYear(this.dates.get(-1) || UTCToday(), dir);
|
1181 |
+
newViewDate = this.moveYear(focusDate, dir);
|
1182 |
+
this._trigger('changeYear', this.viewDate);
|
1183 |
+
}
|
1184 |
+
else if (e.shiftKey){
|
1185 |
+
newDate = this.moveMonth(this.dates.get(-1) || UTCToday(), dir);
|
1186 |
+
newViewDate = this.moveMonth(focusDate, dir);
|
1187 |
+
this._trigger('changeMonth', this.viewDate);
|
1188 |
+
}
|
1189 |
+
else {
|
1190 |
+
newDate = new Date(this.dates.get(-1) || UTCToday());
|
1191 |
+
newDate.setUTCDate(newDate.getUTCDate() + dir * 7);
|
1192 |
+
newViewDate = new Date(focusDate);
|
1193 |
+
newViewDate.setUTCDate(focusDate.getUTCDate() + dir * 7);
|
1194 |
+
}
|
1195 |
+
if (this.dateWithinRange(newDate)){
|
1196 |
+
this.focusDate = this.viewDate = newViewDate;
|
1197 |
+
this.setValue();
|
1198 |
+
this.fill();
|
1199 |
+
e.preventDefault();
|
1200 |
+
}
|
1201 |
+
break;
|
1202 |
+
case 32: // spacebar
|
1203 |
+
// Spacebar is used in manually typing dates in some formats.
|
1204 |
+
// As such, its behavior should not be hijacked.
|
1205 |
+
break;
|
1206 |
+
case 13: // enter
|
1207 |
+
focusDate = this.focusDate || this.dates.get(-1) || this.viewDate;
|
1208 |
+
this._toggle_multidate(focusDate);
|
1209 |
+
dateChanged = true;
|
1210 |
+
this.focusDate = null;
|
1211 |
+
this.viewDate = this.dates.get(-1) || this.viewDate;
|
1212 |
+
this.setValue();
|
1213 |
+
this.fill();
|
1214 |
+
if (this.picker.is(':visible')){
|
1215 |
+
e.preventDefault();
|
1216 |
+
if (this.o.autoclose)
|
1217 |
+
this.hide();
|
1218 |
+
}
|
1219 |
+
break;
|
1220 |
+
case 9: // tab
|
1221 |
+
this.focusDate = null;
|
1222 |
+
this.viewDate = this.dates.get(-1) || this.viewDate;
|
1223 |
+
this.fill();
|
1224 |
+
this.hide();
|
1225 |
+
break;
|
1226 |
+
}
|
1227 |
+
if (dateChanged){
|
1228 |
+
if (this.dates.length)
|
1229 |
+
this._trigger('changeDate');
|
1230 |
+
else
|
1231 |
+
this._trigger('clearDate');
|
1232 |
+
var element;
|
1233 |
+
if (this.isInput){
|
1234 |
+
element = this.element;
|
1235 |
+
}
|
1236 |
+
else if (this.component){
|
1237 |
+
element = this.element.find('input');
|
1238 |
+
}
|
1239 |
+
if (element){
|
1240 |
+
element.change();
|
1241 |
+
}
|
1242 |
+
}
|
1243 |
+
},
|
1244 |
+
|
1245 |
+
showMode: function(dir){
|
1246 |
+
if (dir){
|
1247 |
+
this.viewMode = Math.max(this.o.minViewMode, Math.min(2, this.viewMode + dir));
|
1248 |
+
}
|
1249 |
+
this.picker
|
1250 |
+
.find('>div')
|
1251 |
+
.hide()
|
1252 |
+
.filter('.cfdatepicker-'+DPGlobal.modes[this.viewMode].clsName)
|
1253 |
+
.css('display', 'block');
|
1254 |
+
this.updateNavArrows();
|
1255 |
+
}
|
1256 |
+
};
|
1257 |
+
|
1258 |
+
var DateRangePicker = function(element, options){
|
1259 |
+
this.element = $(element);
|
1260 |
+
this.inputs = $.map(options.inputs, function(i){
|
1261 |
+
return i.jquery ? i[0] : i;
|
1262 |
+
});
|
1263 |
+
delete options.inputs;
|
1264 |
+
|
1265 |
+
$(this.inputs)
|
1266 |
+
.cfdatepicker(options)
|
1267 |
+
.bind('changeDate', $.proxy(this.dateUpdated, this));
|
1268 |
+
|
1269 |
+
this.pickers = $.map(this.inputs, function(i){
|
1270 |
+
return $(i).data('cfdatepicker');
|
1271 |
+
});
|
1272 |
+
this.updateDates();
|
1273 |
+
};
|
1274 |
+
DateRangePicker.prototype = {
|
1275 |
+
updateDates: function(){
|
1276 |
+
this.dates = $.map(this.pickers, function(i){
|
1277 |
+
return i.getUTCDate();
|
1278 |
+
});
|
1279 |
+
this.updateRanges();
|
1280 |
+
},
|
1281 |
+
updateRanges: function(){
|
1282 |
+
var range = $.map(this.dates, function(d){
|
1283 |
+
return d.valueOf();
|
1284 |
+
});
|
1285 |
+
$.each(this.pickers, function(i, p){
|
1286 |
+
p.setRange(range);
|
1287 |
+
});
|
1288 |
+
},
|
1289 |
+
dateUpdated: function(e){
|
1290 |
+
// `this.updating` is a workaround for preventing infinite recursion
|
1291 |
+
// between `changeDate` triggering and `setUTCDate` calling. Until
|
1292 |
+
// there is a better mechanism.
|
1293 |
+
if (this.updating)
|
1294 |
+
return;
|
1295 |
+
this.updating = true;
|
1296 |
+
|
1297 |
+
var dp = $(e.target).data('cfdatepicker'),
|
1298 |
+
new_date = dp.getUTCDate(),
|
1299 |
+
i = $.inArray(e.target, this.inputs),
|
1300 |
+
l = this.inputs.length;
|
1301 |
+
if (i === -1)
|
1302 |
+
return;
|
1303 |
+
|
1304 |
+
$.each(this.pickers, function(i, p){
|
1305 |
+
if (!p.getUTCDate())
|
1306 |
+
p.setUTCDate(new_date);
|
1307 |
+
});
|
1308 |
+
|
1309 |
+
if (new_date < this.dates[i]){
|
1310 |
+
// Date being moved earlier/left
|
1311 |
+
while (i >= 0 && new_date < this.dates[i]){
|
1312 |
+
this.pickers[i--].setUTCDate(new_date);
|
1313 |
+
}
|
1314 |
+
}
|
1315 |
+
else if (new_date > this.dates[i]){
|
1316 |
+
// Date being moved later/right
|
1317 |
+
while (i < l && new_date > this.dates[i]){
|
1318 |
+
this.pickers[i++].setUTCDate(new_date);
|
1319 |
+
}
|
1320 |
+
}
|
1321 |
+
this.updateDates();
|
1322 |
+
|
1323 |
+
delete this.updating;
|
1324 |
+
},
|
1325 |
+
remove: function(){
|
1326 |
+
$.map(this.pickers, function(p){ p.remove(); });
|
1327 |
+
delete this.element.data().cfdatepicker;
|
1328 |
+
}
|
1329 |
+
};
|
1330 |
+
|
1331 |
+
function opts_from_el(el, prefix){
|
1332 |
+
// Derive options from element data-attrs
|
1333 |
+
var data = $(el).data(),
|
1334 |
+
out = {}, inkey,
|
1335 |
+
replace = new RegExp('^' + prefix.toLowerCase() + '([A-Z])');
|
1336 |
+
prefix = new RegExp('^' + prefix.toLowerCase());
|
1337 |
+
function re_lower(_,a){
|
1338 |
+
return a.toLowerCase();
|
1339 |
+
}
|
1340 |
+
for (var key in data)
|
1341 |
+
if (prefix.test(key)){
|
1342 |
+
inkey = key.replace(replace, re_lower);
|
1343 |
+
out[inkey] = data[key];
|
1344 |
+
}
|
1345 |
+
return out;
|
1346 |
+
}
|
1347 |
+
|
1348 |
+
function opts_from_locale(lang){
|
1349 |
+
// Derive options from locale plugins
|
1350 |
+
var out = {};
|
1351 |
+
// Check if "de-DE" style date is available, if not language should
|
1352 |
+
// fallback to 2 letter code eg "de"
|
1353 |
+
if (!dates[lang]){
|
1354 |
+
lang = lang.split('-')[0];
|
1355 |
+
if (!dates[lang])
|
1356 |
+
return;
|
1357 |
+
}
|
1358 |
+
var d = dates[lang];
|
1359 |
+
$.each(locale_opts, function(i,k){
|
1360 |
+
if (k in d)
|
1361 |
+
out[k] = d[k];
|
1362 |
+
});
|
1363 |
+
return out;
|
1364 |
+
}
|
1365 |
+
|
1366 |
+
var old = $.fn.cfdatepicker;
|
1367 |
+
$.fn.cfdatepicker = function(option){
|
1368 |
+
var args = Array.apply(null, arguments);
|
1369 |
+
args.shift();
|
1370 |
+
var internal_return;
|
1371 |
+
this.each(function(){
|
1372 |
+
var $this = $(this),
|
1373 |
+
data = $this.data('cfdatepicker'),
|
1374 |
+
options = typeof option === 'object' && option;
|
1375 |
+
if (!data){
|
1376 |
+
var elopts = opts_from_el(this, 'date'),
|
1377 |
+
// Preliminary otions
|
1378 |
+
xopts = $.extend({}, defaults, elopts, options),
|
1379 |
+
locopts = opts_from_locale(xopts.language),
|
1380 |
+
// Options priority: js args, data-attrs, locales, defaults
|
1381 |
+
opts = $.extend({}, defaults, locopts, elopts, options);
|
1382 |
+
if ($this.is('.input-daterange') || opts.inputs){
|
1383 |
+
var ropts = {
|
1384 |
+
inputs: opts.inputs || $this.find('input').toArray()
|
1385 |
+
};
|
1386 |
+
$this.data('cfdatepicker', (data = new DateRangePicker(this, $.extend(opts, ropts))));
|
1387 |
+
}
|
1388 |
+
else {
|
1389 |
+
$this.data('cfdatepicker', (data = new Datepicker(this, opts)));
|
1390 |
+
}
|
1391 |
+
}
|
1392 |
+
if (typeof option === 'string' && typeof data[option] === 'function'){
|
1393 |
+
internal_return = data[option].apply(data, args);
|
1394 |
+
if (internal_return !== undefined)
|
1395 |
+
return false;
|
1396 |
+
}
|
1397 |
+
});
|
1398 |
+
if (internal_return !== undefined)
|
1399 |
+
return internal_return;
|
1400 |
+
else
|
1401 |
+
return this;
|
1402 |
+
};
|
1403 |
+
|
1404 |
+
var defaults = $.fn.cfdatepicker.defaults = {
|
1405 |
+
autoclose: false,
|
1406 |
+
beforeShowDay: $.noop,
|
1407 |
+
calendarWeeks: false,
|
1408 |
+
clearBtn: false,
|
1409 |
+
daysOfWeekDisabled: [],
|
1410 |
+
endDate: Infinity,
|
1411 |
+
forceParse: true,
|
1412 |
+
format: 'mm/dd/yyyy',
|
1413 |
+
keyboardNavigation: true,
|
1414 |
+
language: 'en',
|
1415 |
+
minViewMode: 0,
|
1416 |
+
multidate: false,
|
1417 |
+
multidateSeparator: ',',
|
1418 |
+
orientation: "auto",
|
1419 |
+
rtl: false,
|
1420 |
+
startDate: -Infinity,
|
1421 |
+
startView: 0,
|
1422 |
+
todayBtn: false,
|
1423 |
+
todayHighlight: false,
|
1424 |
+
weekStart: 0
|
1425 |
+
};
|
1426 |
+
var locale_opts = $.fn.cfdatepicker.locale_opts = [
|
1427 |
+
'format',
|
1428 |
+
'rtl',
|
1429 |
+
'weekStart'
|
1430 |
+
];
|
1431 |
+
$.fn.cfdatepicker.Constructor = Datepicker;
|
1432 |
+
var dates = $.fn.cfdatepicker.dates = {
|
1433 |
+
en: {
|
1434 |
+
days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"],
|
1435 |
+
daysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
|
1436 |
+
daysMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"],
|
1437 |
+
months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
|
1438 |
+
monthsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
|
1439 |
+
today: "Today",
|
1440 |
+
clear: "Clear"
|
1441 |
+
}
|
1442 |
+
};
|
1443 |
+
|
1444 |
+
var DPGlobal = {
|
1445 |
+
modes: [
|
1446 |
+
{
|
1447 |
+
clsName: 'days',
|
1448 |
+
navFnc: 'Month',
|
1449 |
+
navStep: 1
|
1450 |
+
},
|
1451 |
+
{
|
1452 |
+
clsName: 'months',
|
1453 |
+
navFnc: 'FullYear',
|
1454 |
+
navStep: 1
|
1455 |
+
},
|
1456 |
+
{
|
1457 |
+
clsName: 'years',
|
1458 |
+
navFnc: 'FullYear',
|
1459 |
+
navStep: 10
|
1460 |
+
}],
|
1461 |
+
isLeapYear: function(year){
|
1462 |
+
return (((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0));
|
1463 |
+
},
|
1464 |
+
getDaysInMonth: function(year, month){
|
1465 |
+
return [31, (DPGlobal.isLeapYear(year) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month];
|
1466 |
+
},
|
1467 |
+
validParts: /dd?|DD?|mm?|MM?|yy(?:yy)?/g,
|
1468 |
+
nonpunctuation: /[^ -\/:-@\[\u3400-\u9fff-`{-~\t\n\r]+/g,
|
1469 |
+
parseFormat: function(format){
|
1470 |
+
// IE treats \0 as a string end in inputs (truncating the value),
|
1471 |
+
// so it's a bad format delimiter, anyway
|
1472 |
+
var separators = format.replace(this.validParts, '\0').split('\0'),
|
1473 |
+
parts = format.match(this.validParts);
|
1474 |
+
if (!separators || !separators.length || !parts || parts.length === 0){
|
1475 |
+
throw new Error("Invalid date format.");
|
1476 |
+
}
|
1477 |
+
return {separators: separators, parts: parts};
|
1478 |
+
},
|
1479 |
+
parseDate: function(date, format, language){
|
1480 |
+
if (!date)
|
1481 |
+
return undefined;
|
1482 |
+
if (date instanceof Date)
|
1483 |
+
return date;
|
1484 |
+
if (typeof format === 'string')
|
1485 |
+
format = DPGlobal.parseFormat(format);
|
1486 |
+
var part_re = /([\-+]\d+)([dmwy])/,
|
1487 |
+
parts = date.match(/([\-+]\d+)([dmwy])/g),
|
1488 |
+
part, dir, i;
|
1489 |
+
if (/^[\-+]\d+[dmwy]([\s,]+[\-+]\d+[dmwy])*$/.test(date)){
|
1490 |
+
date = new Date();
|
1491 |
+
for (i=0; i < parts.length; i++){
|
1492 |
+
part = part_re.exec(parts[i]);
|
1493 |
+
dir = parseInt(part[1]);
|
1494 |
+
switch (part[2]){
|
1495 |
+
case 'd':
|
1496 |
+
date.setUTCDate(date.getUTCDate() + dir);
|
1497 |
+
break;
|
1498 |
+
case 'm':
|
1499 |
+
date = Datepicker.prototype.moveMonth.call(Datepicker.prototype, date, dir);
|
1500 |
+
break;
|
1501 |
+
case 'w':
|
1502 |
+
date.setUTCDate(date.getUTCDate() + dir * 7);
|
1503 |
+
break;
|
1504 |
+
case 'y':
|
1505 |
+
date = Datepicker.prototype.moveYear.call(Datepicker.prototype, date, dir);
|
1506 |
+
break;
|
1507 |
+
}
|
1508 |
+
}
|
1509 |
+
return UTCDate(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), 0, 0, 0);
|
1510 |
+
}
|
1511 |
+
parts = date && date.match(this.nonpunctuation) || [];
|
1512 |
+
date = new Date();
|
1513 |
+
var parsed = {},
|
1514 |
+
setters_order = ['yyyy', 'yy', 'M', 'MM', 'm', 'mm', 'd', 'dd'],
|
1515 |
+
setters_map = {
|
1516 |
+
yyyy: function(d,v){
|
1517 |
+
return d.setUTCFullYear(v);
|
1518 |
+
},
|
1519 |
+
yy: function(d,v){
|
1520 |
+
return d.setUTCFullYear(2000+v);
|
1521 |
+
},
|
1522 |
+
m: function(d,v){
|
1523 |
+
if (isNaN(d))
|
1524 |
+
return d;
|
1525 |
+
v -= 1;
|
1526 |
+
while (v < 0) v += 12;
|
1527 |
+
v %= 12;
|
1528 |
+
d.setUTCMonth(v);
|
1529 |
+
while (d.getUTCMonth() !== v)
|
1530 |
+
d.setUTCDate(d.getUTCDate()-1);
|
1531 |
+
return d;
|
1532 |
+
},
|
1533 |
+
d: function(d,v){
|
1534 |
+
return d.setUTCDate(v);
|
1535 |
+
}
|
1536 |
+
},
|
1537 |
+
val, filtered;
|
1538 |
+
setters_map['M'] = setters_map['MM'] = setters_map['mm'] = setters_map['m'];
|
1539 |
+
setters_map['dd'] = setters_map['d'];
|
1540 |
+
date = UTCDate(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0);
|
1541 |
+
var fparts = format.parts.slice();
|
1542 |
+
// Remove noop parts
|
1543 |
+
if (parts.length !== fparts.length){
|
1544 |
+
fparts = $(fparts).filter(function(i,p){
|
1545 |
+
return $.inArray(p, setters_order) !== -1;
|
1546 |
+
}).toArray();
|
1547 |
+
}
|
1548 |
+
// Process remainder
|
1549 |
+
function match_part(){
|
1550 |
+
var m = this.slice(0, parts[i].length),
|
1551 |
+
p = parts[i].slice(0, m.length);
|
1552 |
+
return m === p;
|
1553 |
+
}
|
1554 |
+
if (parts.length === fparts.length){
|
1555 |
+
var cnt;
|
1556 |
+
for (i=0, cnt = fparts.length; i < cnt; i++){
|
1557 |
+
val = parseInt(parts[i], 10);
|
1558 |
+
part = fparts[i];
|
1559 |
+
if (isNaN(val)){
|
1560 |
+
switch (part){
|
1561 |
+
case 'MM':
|
1562 |
+
filtered = $(dates[language].months).filter(match_part);
|
1563 |
+
val = $.inArray(filtered[0], dates[language].months) + 1;
|
1564 |
+
break;
|
1565 |
+
case 'M':
|
1566 |
+
filtered = $(dates[language].monthsShort).filter(match_part);
|
1567 |
+
val = $.inArray(filtered[0], dates[language].monthsShort) + 1;
|
1568 |
+
break;
|
1569 |
+
}
|
1570 |
+
}
|
1571 |
+
parsed[part] = val;
|
1572 |
+
}
|
1573 |
+
var _date, s;
|
1574 |
+
for (i=0; i < setters_order.length; i++){
|
1575 |
+
s = setters_order[i];
|
1576 |
+
if (s in parsed && !isNaN(parsed[s])){
|
1577 |
+
_date = new Date(date);
|
1578 |
+
setters_map[s](_date, parsed[s]);
|
1579 |
+
if (!isNaN(_date))
|
1580 |
+
date = _date;
|
1581 |
+
}
|
1582 |
+
}
|
1583 |
+
}
|
1584 |
+
return date;
|
1585 |
+
},
|
1586 |
+
formatDate: function(date, format, language){
|
1587 |
+
if (!date)
|
1588 |
+
return '';
|
1589 |
+
if (typeof format === 'string')
|
1590 |
+
format = DPGlobal.parseFormat(format);
|
1591 |
+
var val = {
|
1592 |
+
d: date.getUTCDate(),
|
1593 |
+
D: dates[language].daysShort[date.getUTCDay()],
|
1594 |
+
DD: dates[language].days[date.getUTCDay()],
|
1595 |
+
m: date.getUTCMonth() + 1,
|
1596 |
+
M: dates[language].monthsShort[date.getUTCMonth()],
|
1597 |
+
MM: dates[language].months[date.getUTCMonth()],
|
1598 |
+
yy: date.getUTCFullYear().toString().substring(2),
|
1599 |
+
yyyy: date.getUTCFullYear()
|
1600 |
+
};
|
1601 |
+
val.dd = (val.d < 10 ? '0' : '') + val.d;
|
1602 |
+
val.mm = (val.m < 10 ? '0' : '') + val.m;
|
1603 |
+
date = [];
|
1604 |
+
var seps = $.extend([], format.separators);
|
1605 |
+
for (var i=0, cnt = format.parts.length; i <= cnt; i++){
|
1606 |
+
if (seps.length)
|
1607 |
+
date.push(seps.shift());
|
1608 |
+
date.push(val[format.parts[i]]);
|
1609 |
+
}
|
1610 |
+
return date.join('');
|
1611 |
+
},
|
1612 |
+
headTemplate: '<thead>'+
|
1613 |
+
'<tr>'+
|
1614 |
+
'<th class="prev">«</th>'+
|
1615 |
+
'<th colspan="5" class="cfdatepicker-switch"></th>'+
|
1616 |
+
'<th class="next">»</th>'+
|
1617 |
+
'</tr>'+
|
1618 |
+
'</thead>',
|
1619 |
+
contTemplate: '<tbody><tr><td colspan="7"></td></tr></tbody>',
|
1620 |
+
footTemplate: '<tfoot>'+
|
1621 |
+
'<tr>'+
|
1622 |
+
'<th colspan="7" class="today"></th>'+
|
1623 |
+
'</tr>'+
|
1624 |
+
'<tr>'+
|
1625 |
+
'<th colspan="7" class="clear"></th>'+
|
1626 |
+
'</tr>'+
|
1627 |
+
'</tfoot>'
|
1628 |
+
};
|
1629 |
+
DPGlobal.template = '<div class="cfdatepicker">'+
|
1630 |
+
'<div class="cfdatepicker-days">'+
|
1631 |
+
'<table class=" table-condensed">'+
|
1632 |
+
DPGlobal.headTemplate+
|
1633 |
+
'<tbody></tbody>'+
|
1634 |
+
DPGlobal.footTemplate+
|
1635 |
+
'</table>'+
|
1636 |
+
'</div>'+
|
1637 |
+
'<div class="cfdatepicker-months">'+
|
1638 |
+
'<table class="table-condensed">'+
|
1639 |
+
DPGlobal.headTemplate+
|
1640 |
+
DPGlobal.contTemplate+
|
1641 |
+
DPGlobal.footTemplate+
|
1642 |
+
'</table>'+
|
1643 |
+
'</div>'+
|
1644 |
+
'<div class="cfdatepicker-years">'+
|
1645 |
+
'<table class="table-condensed">'+
|
1646 |
+
DPGlobal.headTemplate+
|
1647 |
+
DPGlobal.contTemplate+
|
1648 |
+
DPGlobal.footTemplate+
|
1649 |
+
'</table>'+
|
1650 |
+
'</div>'+
|
1651 |
+
'</div>';
|
1652 |
+
|
1653 |
+
$.fn.cfdatepicker.DPGlobal = DPGlobal;
|
1654 |
+
|
1655 |
+
|
1656 |
+
/* DATEPICKER NO CONFLICT
|
1657 |
+
* =================== */
|
1658 |
+
|
1659 |
+
$.fn.cfdatepicker.noConflict = function(){
|
1660 |
+
$.fn.cfdatepicker = old;
|
1661 |
+
return this;
|
1662 |
+
};
|
1663 |
+
|
1664 |
+
/* DATEPICKER DATA-API
|
1665 |
+
* ================== */
|
1666 |
+
$(document).on(
|
1667 |
+
'focus.cfdatepicker.data-api click.cfdatepicker.data-api',
|
1668 |
+
'[data-provide="cfdatepicker"]',
|
1669 |
+
function(e){
|
1670 |
+
var $this = $(this);
|
1671 |
+
if ($this.data('cfdatepicker'))
|
1672 |
+
return;
|
1673 |
+
|
1674 |
+
// component click requires us to explicitly show it
|
1675 |
+
e.preventDefault();
|
1676 |
+
$this.cfdatepicker('show')
|
1677 |
+
.on('show', function(){ $(this).trigger('blur'); })
|
1678 |
+
.on('hide', function(){ $(this).attr("disabled", false); })
|
1679 |
+
}
|
1680 |
+
);
|
1681 |
+
|
1682 |
+
}(window.jQuery));
|
1683 |
+
|
1684 |
+
|
1685 |
+
/*
|
1686 |
+
* jquery.inputmask.bundle
|
1687 |
+
* http://github.com/RobinHerbots/jquery.inputmask
|
1688 |
+
* Copyright (c) 2010 - 2014 Robin Herbots
|
1689 |
+
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
|
1690 |
+
* Version: 3.1.27
|
1691 |
+
*/
|
1692 |
+
!function($) {
|
1693 |
+
function isInputEventSupported(eventName) {
|
1694 |
+
var el = document.createElement("input"), evName = "on" + eventName, isSupported = evName in el;
|
1695 |
+
return isSupported || (el.setAttribute(evName, "return;"), isSupported = "function" == typeof el[evName]),
|
1696 |
+
el = null, isSupported;
|
1697 |
+
}
|
1698 |
+
function isInputTypeSupported(inputType) {
|
1699 |
+
var isSupported = "text" == inputType || "tel" == inputType;
|
1700 |
+
if (!isSupported) {
|
1701 |
+
var el = document.createElement("input");
|
1702 |
+
el.setAttribute("type", inputType), isSupported = "text" === el.type, el = null;
|
1703 |
+
}
|
1704 |
+
return isSupported;
|
1705 |
+
}
|
1706 |
+
function resolveAlias(aliasStr, options, opts) {
|
1707 |
+
var aliasDefinition = opts.aliases[aliasStr];
|
1708 |
+
return aliasDefinition ? (aliasDefinition.alias && resolveAlias(aliasDefinition.alias, void 0, opts),
|
1709 |
+
$.extend(!0, opts, aliasDefinition), $.extend(!0, opts, options), !0) : !1;
|
1710 |
+
}
|
1711 |
+
function generateMaskSet(opts, multi) {
|
1712 |
+
function analyseMask(mask) {
|
1713 |
+
function maskToken(isGroup, isOptional, isQuantifier, isAlternator) {
|
1714 |
+
this.matches = [], this.isGroup = isGroup || !1, this.isOptional = isOptional || !1,
|
1715 |
+
this.isQuantifier = isQuantifier || !1, this.isAlternator = isAlternator || !1,
|
1716 |
+
this.quantifier = {
|
1717 |
+
min: 1,
|
1718 |
+
max: 1
|
1719 |
+
};
|
1720 |
+
}
|
1721 |
+
function insertTestDefinition(mtoken, element, position) {
|
1722 |
+
var maskdef = opts.definitions[element], newBlockMarker = 0 == mtoken.matches.length;
|
1723 |
+
if (position = void 0 != position ? position : mtoken.matches.length, maskdef && !escaped) {
|
1724 |
+
for (var precheck = maskdef.prevalidator, precheckL = precheck ? precheck.length : 0, i = 1; i < maskdef.cardinality; i++) {
|
1725 |
+
var prevalidator = precheckL >= i ? precheck[i - 1] : [], validator = prevalidator.validator, cardinality = prevalidator.cardinality;
|
1726 |
+
mtoken.matches.splice(position++, 0, {
|
1727 |
+
fn: validator ? "string" == typeof validator ? new RegExp(validator) : new function() {
|
1728 |
+
this.test = validator;
|
1729 |
+
}() : new RegExp("."),
|
1730 |
+
cardinality: cardinality ? cardinality : 1,
|
1731 |
+
optionality: mtoken.isOptional,
|
1732 |
+
newBlockMarker: newBlockMarker,
|
1733 |
+
casing: maskdef.casing,
|
1734 |
+
def: maskdef.definitionSymbol || element,
|
1735 |
+
placeholder: maskdef.placeholder,
|
1736 |
+
mask: element
|
1737 |
+
});
|
1738 |
+
}
|
1739 |
+
mtoken.matches.splice(position++, 0, {
|
1740 |
+
fn: maskdef.validator ? "string" == typeof maskdef.validator ? new RegExp(maskdef.validator) : new function() {
|
1741 |
+
this.test = maskdef.validator;
|
1742 |
+
}() : new RegExp("."),
|
1743 |
+
cardinality: maskdef.cardinality,
|
1744 |
+
optionality: mtoken.isOptional,
|
1745 |
+
newBlockMarker: newBlockMarker,
|
1746 |
+
casing: maskdef.casing,
|
1747 |
+
def: maskdef.definitionSymbol || element,
|
1748 |
+
placeholder: maskdef.placeholder,
|
1749 |
+
mask: element
|
1750 |
+
});
|
1751 |
+
} else mtoken.matches.splice(position++, 0, {
|
1752 |
+
fn: null,
|
1753 |
+
cardinality: 0,
|
1754 |
+
optionality: mtoken.isOptional,
|
1755 |
+
newBlockMarker: newBlockMarker,
|
1756 |
+
casing: null,
|
1757 |
+
def: element,
|
1758 |
+
placeholder: void 0,
|
1759 |
+
mask: element
|
1760 |
+
}), escaped = !1;
|
1761 |
+
}
|
1762 |
+
for (var match, m, openingToken, currentOpeningToken, alternator, lastMatch, tokenizer = /(?:[?*+]|\{[0-9\+\*]+(?:,[0-9\+\*]*)?\})\??|[^.?*+^${[]()|\\]+|./g, escaped = !1, currentToken = new maskToken(), openenings = [], maskTokens = []; match = tokenizer.exec(mask); ) switch (m = match[0],
|
1763 |
+
m.charAt(0)) {
|
1764 |
+
case opts.optionalmarker.end:
|
1765 |
+
case opts.groupmarker.end:
|
1766 |
+
if (openingToken = openenings.pop(), openenings.length > 0) {
|
1767 |
+
if (currentOpeningToken = openenings[openenings.length - 1], currentOpeningToken.matches.push(openingToken),
|
1768 |
+
currentOpeningToken.isAlternator) {
|
1769 |
+
alternator = openenings.pop();
|
1770 |
+
for (var mndx = 0; mndx < alternator.matches.length; mndx++) alternator.matches[mndx].isGroup = !1;
|
1771 |
+
openenings.length > 0 ? (currentOpeningToken = openenings[openenings.length - 1],
|
1772 |
+
currentOpeningToken.matches.push(alternator)) : currentToken.matches.push(alternator);
|
1773 |
+
}
|
1774 |
+
} else currentToken.matches.push(openingToken);
|
1775 |
+
break;
|
1776 |
+
|
1777 |
+
case opts.optionalmarker.start:
|
1778 |
+
openenings.push(new maskToken(!1, !0));
|
1779 |
+
break;
|
1780 |
+
|
1781 |
+
case opts.groupmarker.start:
|
1782 |
+
openenings.push(new maskToken(!0));
|
1783 |
+
break;
|
1784 |
+
|
1785 |
+
case opts.quantifiermarker.start:
|
1786 |
+
var quantifier = new maskToken(!1, !1, !0);
|
1787 |
+
m = m.replace(/[{}]/g, "");
|
1788 |
+
var mq = m.split(","), mq0 = isNaN(mq[0]) ? mq[0] : parseInt(mq[0]), mq1 = 1 == mq.length ? mq0 : isNaN(mq[1]) ? mq[1] : parseInt(mq[1]);
|
1789 |
+
if (("*" == mq1 || "+" == mq1) && (mq0 = "*" == mq1 ? 0 : 1), quantifier.quantifier = {
|
1790 |
+
min: mq0,
|
1791 |
+
max: mq1
|
1792 |
+
}, openenings.length > 0) {
|
1793 |
+
var matches = openenings[openenings.length - 1].matches;
|
1794 |
+
if (match = matches.pop(), !match.isGroup) {
|
1795 |
+
var groupToken = new maskToken(!0);
|
1796 |
+
groupToken.matches.push(match), match = groupToken;
|
1797 |
+
}
|
1798 |
+
matches.push(match), matches.push(quantifier);
|
1799 |
+
} else {
|
1800 |
+
if (match = currentToken.matches.pop(), !match.isGroup) {
|
1801 |
+
var groupToken = new maskToken(!0);
|
1802 |
+
groupToken.matches.push(match), match = groupToken;
|
1803 |
+
}
|
1804 |
+
currentToken.matches.push(match), currentToken.matches.push(quantifier);
|
1805 |
+
}
|
1806 |
+
break;
|
1807 |
+
|
1808 |
+
case opts.escapeChar:
|
1809 |
+
escaped = !0;
|
1810 |
+
break;
|
1811 |
+
|
1812 |
+
case opts.alternatormarker:
|
1813 |
+
openenings.length > 0 ? (currentOpeningToken = openenings[openenings.length - 1],
|
1814 |
+
lastMatch = currentOpeningToken.matches.pop()) : lastMatch = currentToken.matches.pop(),
|
1815 |
+
lastMatch.isAlternator ? openenings.push(lastMatch) : (alternator = new maskToken(!1, !1, !1, !0),
|
1816 |
+
alternator.matches.push(lastMatch), openenings.push(alternator));
|
1817 |
+
break;
|
1818 |
+
|
1819 |
+
default:
|
1820 |
+
if (openenings.length > 0) {
|
1821 |
+
if (currentOpeningToken = openenings[openenings.length - 1], currentOpeningToken.matches.length > 0 && (lastMatch = currentOpeningToken.matches[currentOpeningToken.matches.length - 1],
|
1822 |
+
lastMatch.isGroup && (lastMatch.isGroup = !1, insertTestDefinition(lastMatch, opts.groupmarker.start, 0),
|
1823 |
+
insertTestDefinition(lastMatch, opts.groupmarker.end))), insertTestDefinition(currentOpeningToken, m),
|
1824 |
+
currentOpeningToken.isAlternator) {
|
1825 |
+
alternator = openenings.pop();
|
1826 |
+
for (var mndx = 0; mndx < alternator.matches.length; mndx++) alternator.matches[mndx].isGroup = !1;
|
1827 |
+
openenings.length > 0 ? (currentOpeningToken = openenings[openenings.length - 1],
|
1828 |
+
currentOpeningToken.matches.push(alternator)) : currentToken.matches.push(alternator);
|
1829 |
+
}
|
1830 |
+
} else currentToken.matches.length > 0 && (lastMatch = currentToken.matches[currentToken.matches.length - 1],
|
1831 |
+
lastMatch.isGroup && (lastMatch.isGroup = !1, insertTestDefinition(lastMatch, opts.groupmarker.start, 0),
|
1832 |
+
insertTestDefinition(lastMatch, opts.groupmarker.end))), insertTestDefinition(currentToken, m);
|
1833 |
+
}
|
1834 |
+
return currentToken.matches.length > 0 && (lastMatch = currentToken.matches[currentToken.matches.length - 1],
|
1835 |
+
lastMatch.isGroup && (lastMatch.isGroup = !1, insertTestDefinition(lastMatch, opts.groupmarker.start, 0),
|
1836 |
+
insertTestDefinition(lastMatch, opts.groupmarker.end)), maskTokens.push(currentToken)),
|
1837 |
+
maskTokens;
|
1838 |
+
}
|
1839 |
+
function generateMask(mask, metadata) {
|
1840 |
+
if (opts.numericInput && opts.multi !== !0) {
|
1841 |
+
mask = mask.split("").reverse();
|
1842 |
+
for (var ndx = 0; ndx < mask.length; ndx++) mask[ndx] == opts.optionalmarker.start ? mask[ndx] = opts.optionalmarker.end : mask[ndx] == opts.optionalmarker.end ? mask[ndx] = opts.optionalmarker.start : mask[ndx] == opts.groupmarker.start ? mask[ndx] = opts.groupmarker.end : mask[ndx] == opts.groupmarker.end && (mask[ndx] = opts.groupmarker.start);
|
1843 |
+
mask = mask.join("");
|
1844 |
+
}
|
1845 |
+
if (void 0 == mask || "" == mask) return void 0;
|
1846 |
+
if (1 == mask.length && 0 == opts.greedy && 0 != opts.repeat && (opts.placeholder = ""),
|
1847 |
+
opts.repeat > 0 || "*" == opts.repeat || "+" == opts.repeat) {
|
1848 |
+
var repeatStart = "*" == opts.repeat ? 0 : "+" == opts.repeat ? 1 : opts.repeat;
|
1849 |
+
mask = opts.groupmarker.start + mask + opts.groupmarker.end + opts.quantifiermarker.start + repeatStart + "," + opts.repeat + opts.quantifiermarker.end;
|
1850 |
+
}
|
1851 |
+
return void 0 == $.inputmask.masksCache[mask] && ($.inputmask.masksCache[mask] = {
|
1852 |
+
mask: mask,
|
1853 |
+
maskToken: analyseMask(mask),
|
1854 |
+
validPositions: {},
|
1855 |
+
_buffer: void 0,
|
1856 |
+
buffer: void 0,
|
1857 |
+
tests: {},
|
1858 |
+
metadata: metadata
|
1859 |
+
}), $.extend(!0, {}, $.inputmask.masksCache[mask]);
|
1860 |
+
}
|
1861 |
+
var ms = void 0;
|
1862 |
+
if ($.isFunction(opts.mask) && (opts.mask = opts.mask.call(this, opts)), $.isArray(opts.mask)) if (multi) ms = [],
|
1863 |
+
$.each(opts.mask, function(ndx, msk) {
|
1864 |
+
ms.push(void 0 == msk.mask || $.isFunction(msk.mask) ? generateMask(msk.toString(), msk) : generateMask(msk.mask.toString(), msk));
|
1865 |
+
}); else {
|
1866 |
+
opts.keepStatic = void 0 == opts.keepStatic ? !0 : opts.keepStatic;
|
1867 |
+
var altMask = "(";
|
1868 |
+
$.each(opts.mask, function(ndx, msk) {
|
1869 |
+
altMask.length > 1 && (altMask += ")|("), altMask += void 0 == msk.mask || $.isFunction(msk.mask) ? msk.toString() : msk.mask.toString();
|
1870 |
+
}), altMask += ")", ms = generateMask(altMask, opts.mask);
|
1871 |
+
} else opts.mask && (ms = void 0 == opts.mask.mask || $.isFunction(opts.mask.mask) ? generateMask(opts.mask.toString(), opts.mask) : generateMask(opts.mask.mask.toString(), opts.mask));
|
1872 |
+
return ms;
|
1873 |
+
}
|
1874 |
+
function maskScope(actionObj, maskset, opts) {
|
1875 |
+
function getMaskTemplate(baseOnInput, minimalPos, includeInput) {
|
1876 |
+
minimalPos = minimalPos || 0;
|
1877 |
+
var ndxIntlzr, test, testPos, maskTemplate = [], pos = 0;
|
1878 |
+
do {
|
1879 |
+
if (baseOnInput === !0 && getMaskSet().validPositions[pos]) {
|
1880 |
+
var validPos = getMaskSet().validPositions[pos];
|
1881 |
+
test = validPos.match, ndxIntlzr = validPos.locator.slice(), maskTemplate.push(includeInput === !0 ? validPos.input : getPlaceholder(pos, test));
|
1882 |
+
} else {
|
1883 |
+
if (minimalPos > pos) {
|
1884 |
+
var testPositions = getTests(pos, ndxIntlzr, pos - 1);
|
1885 |
+
testPos = testPositions[0];
|
1886 |
+
} else testPos = getTestTemplate(pos, ndxIntlzr, pos - 1);
|
1887 |
+
test = testPos.match, ndxIntlzr = testPos.locator.slice(), maskTemplate.push(getPlaceholder(pos, test));
|
1888 |
+
}
|
1889 |
+
pos++;
|
1890 |
+
} while ((void 0 == maxLength || maxLength > pos - 1) && null != test.fn || null == test.fn && "" != test.def || minimalPos >= pos);
|
1891 |
+
return maskTemplate.pop(), maskTemplate;
|
1892 |
+
}
|
1893 |
+
function getMaskSet() {
|
1894 |
+
return maskset;
|
1895 |
+
}
|
1896 |
+
function resetMaskSet(soft) {
|
1897 |
+
var maskset = getMaskSet();
|
1898 |
+
maskset.buffer = void 0, maskset.tests = {}, soft !== !0 && (maskset._buffer = void 0,
|
1899 |
+
maskset.validPositions = {}, maskset.p = 0);
|
1900 |
+
}
|
1901 |
+
function getLastValidPosition(closestTo) {
|
1902 |
+
var maskset = getMaskSet(), lastValidPosition = -1, valids = maskset.validPositions;
|
1903 |
+
void 0 == closestTo && (closestTo = -1);
|
1904 |
+
var before = lastValidPosition, after = lastValidPosition;
|
1905 |
+
for (var posNdx in valids) {
|
1906 |
+
var psNdx = parseInt(posNdx);
|
1907 |
+
(-1 == closestTo || null != valids[psNdx].match.fn) && (closestTo > psNdx && (before = psNdx),
|
1908 |
+
psNdx >= closestTo && (after = psNdx));
|
1909 |
+
}
|
1910 |
+
return lastValidPosition = closestTo - before > 1 || closestTo > after ? before : after;
|
1911 |
+
}
|
1912 |
+
function setValidPosition(pos, validTest, fromSetValid) {
|
1913 |
+
if (opts.insertMode && void 0 != getMaskSet().validPositions[pos] && void 0 == fromSetValid) {
|
1914 |
+
var i, positionsClone = $.extend(!0, {}, getMaskSet().validPositions), lvp = getLastValidPosition();
|
1915 |
+
for (i = pos; lvp >= i; i++) delete getMaskSet().validPositions[i];
|
1916 |
+
getMaskSet().validPositions[pos] = validTest;
|
1917 |
+
var j, valid = !0;
|
1918 |
+
for (i = pos; lvp >= i; i++) {
|
1919 |
+
var t = positionsClone[i];
|
1920 |
+
if (void 0 != t) {
|
1921 |
+
var vps = getMaskSet().validPositions;
|
1922 |
+
j = !opts.keepStatic && (void 0 != vps[i + 1] && getTests(i + 1, vps[i].locator.slice(), i).length > 1 || vps[i] && void 0 != vps[i].alternation) ? i + 1 : seekNext(i),
|
1923 |
+
valid = positionCanMatchDefinition(j, t.match.def) ? valid && isValid(j, t.input, !0, !0) !== !1 : null == t.match.fn;
|
1924 |
+
}
|
1925 |
+
if (!valid) break;
|
1926 |
+
}
|
1927 |
+
if (!valid) return getMaskSet().validPositions = $.extend(!0, {}, positionsClone),
|
1928 |
+
!1;
|
1929 |
+
} else getMaskSet().validPositions[pos] = validTest;
|
1930 |
+
return !0;
|
1931 |
+
}
|
1932 |
+
function stripValidPositions(start, end) {
|
1933 |
+
var i, startPos = start;
|
1934 |
+
for (void 0 != getMaskSet().validPositions[start] && getMaskSet().validPositions[start].input == opts.radixPoint && (end++,
|
1935 |
+
startPos++), i = startPos; end > i; i++) void 0 == getMaskSet().validPositions[i] || getMaskSet().validPositions[i].input == opts.radixPoint && i != getLastValidPosition() || delete getMaskSet().validPositions[i];
|
1936 |
+
for (i = end; i <= getLastValidPosition(); ) {
|
1937 |
+
var t = getMaskSet().validPositions[i], s = getMaskSet().validPositions[startPos];
|
1938 |
+
void 0 != t && void 0 == s ? (positionCanMatchDefinition(startPos, t.match.def) && isValid(startPos, t.input, !0) !== !1 && (delete getMaskSet().validPositions[i],
|
1939 |
+
i++), startPos++) : i++;
|
1940 |
+
}
|
1941 |
+
var lvp = getLastValidPosition();
|
1942 |
+
lvp >= start && void 0 != getMaskSet().validPositions[lvp] && getMaskSet().validPositions[lvp].input == opts.radixPoint && delete getMaskSet().validPositions[lvp],
|
1943 |
+
resetMaskSet(!0);
|
1944 |
+
}
|
1945 |
+
function getTestTemplate(pos, ndxIntlzr, tstPs) {
|
1946 |
+
function checkAlternationMatch(test, altNdx, altArr) {
|
1947 |
+
for (var isMatch = !1, altLocArr = test.locator[altNdx].toString().split(","), alndx = 0; alndx < altLocArr.length; alndx++) if (-1 != $.inArray(altLocArr[alndx], altArr)) {
|
1948 |
+
isMatch = !0;
|
1949 |
+
break;
|
1950 |
+
}
|
1951 |
+
return isMatch;
|
1952 |
+
}
|
1953 |
+
for (var testPos, testPositions = getTests(pos, ndxIntlzr, tstPs), lvp = getLastValidPosition(), lvTest = getMaskSet().validPositions[lvp] || getTests(0)[0], lvTestAltArr = void 0 != lvTest.alternation ? lvTest.locator[lvTest.alternation].split(",") : [], ndx = 0; ndx < testPositions.length && (testPos = testPositions[ndx],
|
1954 |
+
!(opts.greedy || testPos.match && (testPos.match.optionality === !1 || testPos.match.newBlockMarker === !1) && testPos.match.optionalQuantifier !== !0 && (void 0 == lvTest.alternation || void 0 != testPos.locator[lvTest.alternation] && checkAlternationMatch(testPos, lvTest.alternation, lvTestAltArr)))); ndx++) ;
|
1955 |
+
return testPos;
|
1956 |
+
}
|
1957 |
+
function getTest(pos) {
|
1958 |
+
return getMaskSet().validPositions[pos] ? getMaskSet().validPositions[pos].match : getTests(pos)[0].match;
|
1959 |
+
}
|
1960 |
+
function positionCanMatchDefinition(pos, def) {
|
1961 |
+
for (var valid = !1, tests = getTests(pos), tndx = 0; tndx < tests.length; tndx++) if (tests[tndx].match && tests[tndx].match.def == def) {
|
1962 |
+
valid = !0;
|
1963 |
+
break;
|
1964 |
+
}
|
1965 |
+
return valid;
|
1966 |
+
}
|
1967 |
+
function getTests(pos, ndxIntlzr, tstPs) {
|
1968 |
+
function ResolveTestFromToken(maskToken, ndxInitializer, loopNdx, quantifierRecurse) {
|
1969 |
+
function handleMatch(match, loopNdx, quantifierRecurse) {
|
1970 |
+
if (testPos > 1e4) return alert("jquery.inputmask: There is probably an error in your mask definition or in the code. Create an issue on github with an example of the mask you are using. " + getMaskSet().mask),
|
1971 |
+
!0;
|
1972 |
+
if (testPos == pos && void 0 == match.matches) return matches.push({
|
1973 |
+
match: match,
|
1974 |
+
locator: loopNdx.reverse()
|
1975 |
+
}), !0;
|
1976 |
+
if (void 0 != match.matches) {
|
1977 |
+
if (match.isGroup && quantifierRecurse !== !0) {
|
1978 |
+
if (match = handleMatch(maskToken.matches[tndx + 1], loopNdx)) return !0;
|
1979 |
+
} else if (match.isOptional) {
|
1980 |
+
var optionalToken = match;
|
1981 |
+
if (match = ResolveTestFromToken(match, ndxInitializer, loopNdx, quantifierRecurse)) {
|
1982 |
+
var latestMatch = matches[matches.length - 1].match, isFirstMatch = 0 == $.inArray(latestMatch, optionalToken.matches);
|
1983 |
+
isFirstMatch && (insertStop = !0), testPos = pos;
|
1984 |
+
}
|
1985 |
+
} else if (match.isAlternator) {
|
1986 |
+
var maltMatches, alternateToken = match, malternateMatches = [], currentMatches = matches.slice(), loopNdxCnt = loopNdx.length, altIndex = ndxInitializer.length > 0 ? ndxInitializer.shift() : -1;
|
1987 |
+
if (-1 == altIndex || "string" == typeof altIndex) {
|
1988 |
+
var altIndexArr, currentPos = testPos, ndxInitializerClone = ndxInitializer.slice();
|
1989 |
+
"string" == typeof altIndex && (altIndexArr = altIndex.split(","));
|
1990 |
+
for (var amndx = 0; amndx < alternateToken.matches.length; amndx++) {
|
1991 |
+
matches = [], match = handleMatch(alternateToken.matches[amndx], [ amndx ].concat(loopNdx), quantifierRecurse) || match,
|
1992 |
+
maltMatches = matches.slice(), testPos = currentPos, matches = [];
|
1993 |
+
for (var i = 0; i < ndxInitializerClone.length; i++) ndxInitializer[i] = ndxInitializerClone[i];
|
1994 |
+
for (var ndx1 = 0; ndx1 < maltMatches.length; ndx1++) for (var altMatch = maltMatches[ndx1], ndx2 = 0; ndx2 < malternateMatches.length; ndx2++) {
|
1995 |
+
var altMatch2 = malternateMatches[ndx2];
|
1996 |
+
if (altMatch.match.mask == altMatch2.match.mask && ("string" != typeof altIndex || -1 != $.inArray(altMatch.locator[loopNdxCnt].toString(), altIndexArr))) {
|
1997 |
+
maltMatches.splice(ndx1, 1), altMatch2.locator[loopNdxCnt] = altMatch2.locator[loopNdxCnt] + "," + altMatch.locator[loopNdxCnt],
|
1998 |
+
altMatch2.alternation = loopNdxCnt;
|
1999 |
+
break;
|
2000 |
+
}
|
2001 |
+
}
|
2002 |
+
malternateMatches = malternateMatches.concat(maltMatches);
|
2003 |
+
}
|
2004 |
+
"string" == typeof altIndex && (malternateMatches = $.map(malternateMatches, function(lmnt, ndx) {
|
2005 |
+
if (isFinite(ndx)) {
|
2006 |
+
var mamatch, altLocArr = lmnt.locator[loopNdxCnt].toString().split(",");
|
2007 |
+
lmnt.locator[loopNdxCnt] = void 0, lmnt.alternation = void 0;
|
2008 |
+
for (var alndx = 0; alndx < altLocArr.length; alndx++) mamatch = -1 != $.inArray(altLocArr[alndx], altIndexArr),
|
2009 |
+
mamatch && (void 0 != lmnt.locator[loopNdxCnt] ? (lmnt.locator[loopNdxCnt] += ",",
|
2010 |
+
lmnt.alternation = loopNdxCnt, lmnt.locator[loopNdxCnt] += altLocArr[alndx]) : lmnt.locator[loopNdxCnt] = parseInt(altLocArr[alndx]));
|
2011 |
+
if (void 0 != lmnt.locator[loopNdxCnt]) return lmnt;
|
2012 |
+
}
|
2013 |
+
})), matches = currentMatches.concat(malternateMatches), insertStop = !0;
|
2014 |
+
} else match = handleMatch(alternateToken.matches[altIndex], [ altIndex ].concat(loopNdx), quantifierRecurse);
|
2015 |
+
if (match) return !0;
|
2016 |
+
} else if (match.isQuantifier && quantifierRecurse !== !0) {
|
2017 |
+
var qt = match;
|
2018 |
+
opts.greedy = opts.greedy && isFinite(qt.quantifier.max);
|
2019 |
+
for (var qndx = ndxInitializer.length > 0 && quantifierRecurse !== !0 ? ndxInitializer.shift() : 0; qndx < (isNaN(qt.quantifier.max) ? qndx + 1 : qt.quantifier.max) && pos >= testPos; qndx++) {
|
2020 |
+
var tokenGroup = maskToken.matches[$.inArray(qt, maskToken.matches) - 1];
|
2021 |
+
if (match = handleMatch(tokenGroup, [ qndx ].concat(loopNdx), !0)) {
|
2022 |
+
var latestMatch = matches[matches.length - 1].match;
|
2023 |
+
latestMatch.optionalQuantifier = qndx > qt.quantifier.min - 1;
|
2024 |
+
var isFirstMatch = 0 == $.inArray(latestMatch, tokenGroup.matches);
|
2025 |
+
if (isFirstMatch) {
|
2026 |
+
if (qndx > qt.quantifier.min - 1) {
|
2027 |
+
insertStop = !0, testPos = pos;
|
2028 |
+
break;
|
2029 |
+
}
|
2030 |
+
return !0;
|
2031 |
+
}
|
2032 |
+
return !0;
|
2033 |
+
}
|
2034 |
+
}
|
2035 |
+
} else if (match = ResolveTestFromToken(match, ndxInitializer, loopNdx, quantifierRecurse)) return !0;
|
2036 |
+
} else testPos++;
|
2037 |
+
}
|
2038 |
+
for (var tndx = ndxInitializer.length > 0 ? ndxInitializer.shift() : 0; tndx < maskToken.matches.length; tndx++) if (maskToken.matches[tndx].isQuantifier !== !0) {
|
2039 |
+
var match = handleMatch(maskToken.matches[tndx], [ tndx ].concat(loopNdx), quantifierRecurse);
|
2040 |
+
if (match && testPos == pos) return match;
|
2041 |
+
if (testPos > pos) break;
|
2042 |
+
}
|
2043 |
+
}
|
2044 |
+
var maskTokens = getMaskSet().maskToken, testPos = ndxIntlzr ? tstPs : 0, ndxInitializer = ndxIntlzr || [ 0 ], matches = [], insertStop = !1;
|
2045 |
+
if (void 0 == ndxIntlzr) {
|
2046 |
+
for (var test, previousPos = pos - 1; void 0 == (test = getMaskSet().validPositions[previousPos]) && previousPos > -1; ) previousPos--;
|
2047 |
+
if (void 0 != test && previousPos > -1) testPos = previousPos, ndxInitializer = test.locator.slice(); else {
|
2048 |
+
for (previousPos = pos - 1; void 0 == (test = getMaskSet().tests[previousPos]) && previousPos > -1; ) previousPos--;
|
2049 |
+
void 0 != test && previousPos > -1 && (testPos = previousPos, ndxInitializer = test[0].locator.slice());
|
2050 |
+
}
|
2051 |
+
}
|
2052 |
+
for (var mtndx = ndxInitializer.shift(); mtndx < maskTokens.length; mtndx++) {
|
2053 |
+
var match = ResolveTestFromToken(maskTokens[mtndx], ndxInitializer, [ mtndx ]);
|
2054 |
+
if (match && testPos == pos || testPos > pos) break;
|
2055 |
+
}
|
2056 |
+
return (0 == matches.length || insertStop) && matches.push({
|
2057 |
+
match: {
|
2058 |
+
fn: null,
|
2059 |
+
cardinality: 0,
|
2060 |
+
optionality: !0,
|
2061 |
+
casing: null,
|
2062 |
+
def: ""
|
2063 |
+
},
|
2064 |
+
locator: []
|
2065 |
+
}), getMaskSet().tests[pos] = $.extend(!0, [], matches), getMaskSet().tests[pos];
|
2066 |
+
}
|
2067 |
+
function getBufferTemplate() {
|
2068 |
+
return void 0 == getMaskSet()._buffer && (getMaskSet()._buffer = getMaskTemplate(!1, 1)),
|
2069 |
+
getMaskSet()._buffer;
|
2070 |
+
}
|
2071 |
+
function getBuffer() {
|
2072 |
+
return void 0 == getMaskSet().buffer && (getMaskSet().buffer = getMaskTemplate(!0, getLastValidPosition(), !0)),
|
2073 |
+
getMaskSet().buffer;
|
2074 |
+
}
|
2075 |
+
function refreshFromBuffer(start, end) {
|
2076 |
+
var buffer = getBuffer().slice();
|
2077 |
+
if (start === !0) resetMaskSet(), start = 0, end = buffer.length; else for (var i = start; end > i; i++) delete getMaskSet().validPositions[i],
|
2078 |
+
delete getMaskSet().tests[i];
|
2079 |
+
for (var i = start; end > i; i++) buffer[i] != opts.skipOptionalPartCharacter && isValid(i, buffer[i], !0, !0);
|
2080 |
+
}
|
2081 |
+
function casing(elem, test) {
|
2082 |
+
switch (test.casing) {
|
2083 |
+
case "upper":
|
2084 |
+
elem = elem.toUpperCase();
|
2085 |
+
break;
|
2086 |
+
|
2087 |
+
case "lower":
|
2088 |
+
elem = elem.toLowerCase();
|
2089 |
+
}
|
2090 |
+
return elem;
|
2091 |
+
}
|
2092 |
+
function isValid(pos, c, strict, fromSetValid) {
|
2093 |
+
function _isValid(position, c, strict, fromSetValid) {
|
2094 |
+
var rslt = !1;
|
2095 |
+
return $.each(getTests(position), function(ndx, tst) {
|
2096 |
+
for (var test = tst.match, loopend = c ? 1 : 0, chrs = "", i = (getBuffer(), test.cardinality); i > loopend; i--) chrs += getBufferElement(position - (i - 1));
|
2097 |
+
if (c && (chrs += c), rslt = null != test.fn ? test.fn.test(chrs, getMaskSet(), position, strict, opts) : c != test.def && c != opts.skipOptionalPartCharacter || "" == test.def ? !1 : {
|
2098 |
+
c: test.def,
|
2099 |
+
pos: position
|
2100 |
+
}, rslt !== !1) {
|
2101 |
+
var elem = void 0 != rslt.c ? rslt.c : c;
|
2102 |
+
elem = elem == opts.skipOptionalPartCharacter && null === test.fn ? test.def : elem;
|
2103 |
+
var validatedPos = position;
|
2104 |
+
if (void 0 != rslt.remove && stripValidPositions(rslt.remove, rslt.remove + 1),
|
2105 |
+
rslt.refreshFromBuffer) {
|
2106 |
+
var refresh = rslt.refreshFromBuffer;
|
2107 |
+
if (strict = !0, refreshFromBuffer(refresh === !0 ? refresh : refresh.start, refresh.end),
|
2108 |
+
void 0 == rslt.pos && void 0 == rslt.c) return rslt.pos = getLastValidPosition(),
|
2109 |
+
!1;
|
2110 |
+
if (validatedPos = void 0 != rslt.pos ? rslt.pos : position, validatedPos != position) return rslt = $.extend(rslt, isValid(validatedPos, elem, !0)),
|
2111 |
+
!1;
|
2112 |
+
} else if (rslt !== !0 && void 0 != rslt.pos && rslt.pos != position && (validatedPos = rslt.pos,
|
2113 |
+
refreshFromBuffer(position, validatedPos), validatedPos != position)) return rslt = $.extend(rslt, isValid(validatedPos, elem, !0)),
|
2114 |
+
!1;
|
2115 |
+
return 1 != rslt && void 0 == rslt.pos && void 0 == rslt.c ? !1 : (ndx > 0 && resetMaskSet(!0),
|
2116 |
+
setValidPosition(validatedPos, $.extend({}, tst, {
|
2117 |
+
input: casing(elem, test)
|
2118 |
+
}), fromSetValid) || (rslt = !1), !1);
|
2119 |
+
}
|
2120 |
+
}), rslt;
|
2121 |
+
}
|
2122 |
+
function alternate(pos, c, strict, fromSetValid) {
|
2123 |
+
var lastAlt, alternation, validPsClone = $.extend(!0, {}, getMaskSet().validPositions);
|
2124 |
+
for (lastAlt = getLastValidPosition(); lastAlt >= 0; lastAlt--) if (getMaskSet().validPositions[lastAlt] && void 0 != getMaskSet().validPositions[lastAlt].alternation) {
|
2125 |
+
alternation = getMaskSet().validPositions[lastAlt].alternation;
|
2126 |
+
break;
|
2127 |
+
}
|
2128 |
+
if (void 0 != alternation) for (var decisionPos in getMaskSet().validPositions) if (parseInt(decisionPos) > parseInt(lastAlt) && void 0 === getMaskSet().validPositions[decisionPos].alternation) {
|
2129 |
+
for (var altPos = getMaskSet().validPositions[decisionPos], decisionTaker = altPos.locator[alternation], altNdxs = getMaskSet().validPositions[lastAlt].locator[alternation].split(","), mndx = 0; mndx < altNdxs.length; mndx++) if (decisionTaker < altNdxs[mndx]) {
|
2130 |
+
for (var possibilityPos, possibilities, dp = decisionPos - 1; dp >= 0; dp--) if (possibilityPos = getMaskSet().validPositions[dp],
|
2131 |
+
void 0 != possibilityPos) {
|
2132 |
+
possibilities = possibilityPos.locator[alternation], possibilityPos.locator[alternation] = altNdxs[mndx];
|
2133 |
+
break;
|
2134 |
+
}
|
2135 |
+
if (decisionTaker != possibilityPos.locator[alternation]) {
|
2136 |
+
for (var buffer = getBuffer().slice(), i = decisionPos; i < getLastValidPosition() + 1; i++) delete getMaskSet().validPositions[i],
|
2137 |
+
delete getMaskSet().tests[i];
|
2138 |
+
resetMaskSet(!0), opts.keepStatic = !opts.keepStatic;
|
2139 |
+
for (var i = decisionPos; i < buffer.length; i++) buffer[i] != opts.skipOptionalPartCharacter && isValid(getLastValidPosition() + 1, buffer[i], !1, !0);
|
2140 |
+
possibilityPos.locator[alternation] = possibilities;
|
2141 |
+
var isValidRslt = isValid(pos, c, strict, fromSetValid);
|
2142 |
+
if (opts.keepStatic = !opts.keepStatic, isValidRslt) return isValidRslt;
|
2143 |
+
resetMaskSet(), getMaskSet().validPositions = $.extend(!0, {}, validPsClone);
|
2144 |
+
}
|
2145 |
+
}
|
2146 |
+
break;
|
2147 |
+
}
|
2148 |
+
return !1;
|
2149 |
+
}
|
2150 |
+
strict = strict === !0;
|
2151 |
+
for (var buffer = getBuffer(), pndx = pos - 1; pndx > -1 && (!getMaskSet().validPositions[pndx] || null != getMaskSet().validPositions[pndx].match.fn); pndx--) void 0 == getMaskSet().validPositions[pndx] && (!isMask(pndx) || buffer[pndx] != getPlaceholder(pndx)) && getTests(pndx).length > 1 && _isValid(pndx, buffer[pndx], !0);
|
2152 |
+
var maskPos = pos, result = !1;
|
2153 |
+
if (fromSetValid && maskPos >= getMaskLength() && resetMaskSet(!0), maskPos < getMaskLength() && (result = _isValid(maskPos, c, strict, fromSetValid),
|
2154 |
+
!strict && result === !1)) {
|
2155 |
+
var currentPosValid = getMaskSet().validPositions[maskPos];
|
2156 |
+
if (!currentPosValid || null != currentPosValid.match.fn || currentPosValid.match.def != c && c != opts.skipOptionalPartCharacter) {
|
2157 |
+
if ((opts.insertMode || void 0 == getMaskSet().validPositions[seekNext(maskPos)]) && !isMask(maskPos)) for (var nPos = maskPos + 1, snPos = seekNext(maskPos); snPos >= nPos; nPos++) if (result = _isValid(nPos, c, strict, fromSetValid),
|
2158 |
+
result !== !1) {
|
2159 |
+
maskPos = nPos;
|
2160 |
+
break;
|
2161 |
+
}
|
2162 |
+
} else result = {
|
2163 |
+
caret: seekNext(maskPos)
|
2164 |
+
};
|
2165 |
+
}
|
2166 |
+
return result === !1 && opts.keepStatic && isComplete(buffer) && (result = alternate(pos, c, strict, fromSetValid)),
|
2167 |
+
result === !0 && (result = {
|
2168 |
+
pos: maskPos
|
2169 |
+
}), result;
|
2170 |
+
}
|
2171 |
+
function isMask(pos) {
|
2172 |
+
var test = getTest(pos);
|
2173 |
+
return null != test.fn ? test.fn : !1;
|
2174 |
+
}
|
2175 |
+
function getMaskLength() {
|
2176 |
+
var maskLength;
|
2177 |
+
if (maxLength = $el.prop("maxLength"), -1 == maxLength && (maxLength = void 0),
|
2178 |
+
0 == opts.greedy) {
|
2179 |
+
var pos, lvp = getLastValidPosition(), testPos = getMaskSet().validPositions[lvp], ndxIntlzr = void 0 != testPos ? testPos.locator.slice() : void 0;
|
2180 |
+
for (pos = lvp + 1; void 0 == testPos || null != testPos.match.fn || null == testPos.match.fn && "" != testPos.match.def; pos++) testPos = getTestTemplate(pos, ndxIntlzr, pos - 1),
|
2181 |
+
ndxIntlzr = testPos.locator.slice();
|
2182 |
+
maskLength = pos;
|
2183 |
+
} else maskLength = getBuffer().length;
|
2184 |
+
return void 0 == maxLength || maxLength > maskLength ? maskLength : maxLength;
|
2185 |
+
}
|
2186 |
+
function seekNext(pos) {
|
2187 |
+
var maskL = getMaskLength();
|
2188 |
+
if (pos >= maskL) return maskL;
|
2189 |
+
for (var position = pos; ++position < maskL && !isMask(position) && (opts.nojumps !== !0 || opts.nojumpsThreshold > position); ) ;
|
2190 |
+
return position;
|
2191 |
+
}
|
2192 |
+
function seekPrevious(pos) {
|
2193 |
+
var position = pos;
|
2194 |
+
if (0 >= position) return 0;
|
2195 |
+
for (;--position > 0 && !isMask(position); ) ;
|
2196 |
+
return position;
|
2197 |
+
}
|
2198 |
+
function getBufferElement(position) {
|
2199 |
+
return void 0 == getMaskSet().validPositions[position] ? getPlaceholder(position) : getMaskSet().validPositions[position].input;
|
2200 |
+
}
|
2201 |
+
function writeBuffer(input, buffer, caretPos) {
|
2202 |
+
input._valueSet(buffer.join("")), void 0 != caretPos && caret(input, caretPos);
|
2203 |
+
}
|
2204 |
+
function getPlaceholder(pos, test) {
|
2205 |
+
test = test || getTest(pos);
|
2206 |
+
var placeholder = $.isFunction(test.placeholder) ? test.placeholder.call(this, opts) : test.placeholder;
|
2207 |
+
return void 0 != placeholder ? placeholder : null == test.fn ? test.def : opts.placeholder.charAt(pos % opts.placeholder.length);
|
2208 |
+
}
|
2209 |
+
function checkVal(input, writeOut, strict, nptvl, intelliCheck) {
|
2210 |
+
var inputValue = void 0 != nptvl ? nptvl.slice() : truncateInput(input._valueGet()).split("");
|
2211 |
+
if (resetMaskSet(), writeOut && input._valueSet(""), $.each(inputValue, function(ndx, charCode) {
|
2212 |
+
if (intelliCheck === !0) {
|
2213 |
+
var lvp = getLastValidPosition(), pos = -1 == lvp ? ndx : seekNext(lvp);
|
2214 |
+
-1 == $.inArray(charCode, getBufferTemplate().slice(lvp + 1, pos)) && keypressEvent.call(input, void 0, !0, charCode.charCodeAt(0), !1, strict, strict ? ndx : getMaskSet().p);
|
2215 |
+
} else keypressEvent.call(input, void 0, !0, charCode.charCodeAt(0), !1, strict, strict ? ndx : getMaskSet().p),
|
2216 |
+
strict = strict || ndx > 0 && ndx > getMaskSet().p;
|
2217 |
+
}), writeOut) {
|
2218 |
+
var keypressResult = opts.onKeyPress.call(this, void 0, getBuffer(), 0, opts);
|
2219 |
+
handleOnKeyResult(input, keypressResult), writeBuffer(input, getBuffer(), $(input).is(":focus") ? seekNext(getLastValidPosition(0)) : void 0);
|
2220 |
+
}
|
2221 |
+
}
|
2222 |
+
function escapeRegex(str) {
|
2223 |
+
return $.inputmask.escapeRegex.call(this, str);
|
2224 |
+
}
|
2225 |
+
function truncateInput(inputValue) {
|
2226 |
+
return inputValue.replace(new RegExp("(" + escapeRegex(getBufferTemplate().join("")) + ")*$"), "");
|
2227 |
+
}
|
2228 |
+
function unmaskedvalue($input) {
|
2229 |
+
if ($input.data("_inputmask") && !$input.hasClass("hasDatepicker")) {
|
2230 |
+
var umValue = [], vps = getMaskSet().validPositions;
|
2231 |
+
for (var pndx in vps) vps[pndx].match && null != vps[pndx].match.fn && umValue.push(vps[pndx].input);
|
2232 |
+
var unmaskedValue = (isRTL ? umValue.reverse() : umValue).join(""), bufferValue = (isRTL ? getBuffer().slice().reverse() : getBuffer()).join("");
|
2233 |
+
return $.isFunction(opts.onUnMask) && (unmaskedValue = opts.onUnMask.call($input, bufferValue, unmaskedValue, opts) || unmaskedValue),
|
2234 |
+
unmaskedValue;
|
2235 |
+
}
|
2236 |
+
return $input[0]._valueGet();
|
2237 |
+
}
|
2238 |
+
function TranslatePosition(pos) {
|
2239 |
+
if (isRTL && "number" == typeof pos && (!opts.greedy || "" != opts.placeholder)) {
|
2240 |
+
var bffrLght = getBuffer().length;
|
2241 |
+
pos = bffrLght - pos;
|
2242 |
+
}
|
2243 |
+
return pos;
|
2244 |
+
}
|
2245 |
+
function caret(input, begin, end) {
|
2246 |
+
var range, npt = input.jquery && input.length > 0 ? input[0] : input;
|
2247 |
+
if ("number" != typeof begin) {
|
2248 |
+
var data = $(npt).data("_inputmask");
|
2249 |
+
return !$(npt).is(":visible") && data && void 0 != data.caret ? (begin = data.caret.begin,
|
2250 |
+
end = data.caret.end) : npt.setSelectionRange ? (begin = npt.selectionStart, end = npt.selectionEnd) : document.selection && document.selection.createRange && (range = document.selection.createRange(),
|
2251 |
+
begin = 0 - range.duplicate().moveStart("character", -1e5), end = begin + range.text.length),
|
2252 |
+
begin = TranslatePosition(begin), end = TranslatePosition(end), {
|
2253 |
+
begin: begin,
|
2254 |
+
end: end
|
2255 |
+
};
|
2256 |
+
}
|
2257 |
+
begin = TranslatePosition(begin), end = TranslatePosition(end), end = "number" == typeof end ? end : begin;
|
2258 |
+
var data = $(npt).data("_inputmask") || {};
|
2259 |
+
data.caret = {
|
2260 |
+
begin: begin,
|
2261 |
+
end: end
|
2262 |
+
}, $(npt).data("_inputmask", data), $(npt).is(":visible") && (npt.scrollLeft = npt.scrollWidth,
|
2263 |
+
0 == opts.insertMode && begin == end && end++, npt.setSelectionRange ? (npt.selectionStart = begin,
|
2264 |
+
npt.selectionEnd = end) : npt.createTextRange && (range = npt.createTextRange(),
|
2265 |
+
range.collapse(!0), range.moveEnd("character", end), range.moveStart("character", begin),
|
2266 |
+
range.select()));
|
2267 |
+
}
|
2268 |
+
function determineLastRequiredPosition(returnDefinition) {
|
2269 |
+
var pos, testPos, buffer = getBuffer(), bl = buffer.length, lvp = getLastValidPosition(), positions = {}, lvTest = getMaskSet().validPositions[lvp], ndxIntlzr = void 0 != lvTest ? lvTest.locator.slice() : void 0;
|
2270 |
+
for (pos = lvp + 1; pos < buffer.length; pos++) testPos = getTestTemplate(pos, ndxIntlzr, pos - 1),
|
2271 |
+
ndxIntlzr = testPos.locator.slice(), positions[pos] = $.extend(!0, {}, testPos);
|
2272 |
+
var lvTestAltArr = lvTest && void 0 != lvTest.alternation ? lvTest.locator[lvTest.alternation].split(",") : [];
|
2273 |
+
for (pos = bl - 1; pos > lvp && (testPos = positions[pos].match, (testPos.optionality || testPos.optionalQuantifier || lvTest && void 0 != lvTest.alternation && void 0 != positions[pos].locator[lvTest.alternation] && -1 != $.inArray(positions[pos].locator[lvTest.alternation].toString(), lvTestAltArr)) && buffer[pos] == getPlaceholder(pos, testPos)); pos--) bl--;
|
2274 |
+
return returnDefinition ? {
|
2275 |
+
l: bl,
|
2276 |
+
def: positions[bl] ? positions[bl].match : void 0
|
2277 |
+
} : bl;
|
2278 |
+
}
|
2279 |
+
function clearOptionalTail(input) {
|
2280 |
+
for (var buffer = getBuffer(), tmpBuffer = buffer.slice(), rl = determineLastRequiredPosition(), lmib = tmpBuffer.length - 1; lmib > rl && !isMask(lmib); lmib--) ;
|
2281 |
+
tmpBuffer.splice(rl, lmib + 1 - rl), writeBuffer(input, tmpBuffer);
|
2282 |
+
}
|
2283 |
+
function isComplete(buffer) {
|
2284 |
+
if ($.isFunction(opts.isComplete)) return opts.isComplete.call($el, buffer, opts);
|
2285 |
+
if ("*" == opts.repeat) return void 0;
|
2286 |
+
var complete = !1, lrp = determineLastRequiredPosition(!0), aml = seekPrevious(lrp.l), lvp = getLastValidPosition();
|
2287 |
+
if (lvp == aml && (void 0 == lrp.def || lrp.def.newBlockMarker || lrp.def.optionalQuantifier)) {
|
2288 |
+
complete = !0;
|
2289 |
+
for (var i = 0; aml >= i; i++) {
|
2290 |
+
var mask = isMask(i);
|
2291 |
+
if (mask && (void 0 == buffer[i] || buffer[i] == getPlaceholder(i)) || !mask && buffer[i] != getPlaceholder(i)) {
|
2292 |
+
complete = !1;
|
2293 |
+
break;
|
2294 |
+
}
|
2295 |
+
}
|
2296 |
+
}
|
2297 |
+
return complete;
|
2298 |
+
}
|
2299 |
+
function isSelection(begin, end) {
|
2300 |
+
return isRTL ? begin - end > 1 || begin - end == 1 && opts.insertMode : end - begin > 1 || end - begin == 1 && opts.insertMode;
|
2301 |
+
}
|
2302 |
+
function installEventRuler(npt) {
|
2303 |
+
var events = $._data(npt).events;
|
2304 |
+
$.each(events, function(eventType, eventHandlers) {
|
2305 |
+
$.each(eventHandlers, function(ndx, eventHandler) {
|
2306 |
+
if ("inputmask" == eventHandler.namespace && "setvalue" != eventHandler.type) {
|
2307 |
+
var handler = eventHandler.handler;
|
2308 |
+
eventHandler.handler = function(e) {
|
2309 |
+
return this.readOnly || this.disabled ? void e.preventDefault : handler.apply(this, arguments);
|
2310 |
+
};
|
2311 |
+
}
|
2312 |
+
});
|
2313 |
+
});
|
2314 |
+
}
|
2315 |
+
function patchValueProperty(npt) {
|
2316 |
+
function PatchValhook(type) {
|
2317 |
+
if (void 0 == $.valHooks[type] || 1 != $.valHooks[type].inputmaskpatch) {
|
2318 |
+
var valueGet = $.valHooks[type] && $.valHooks[type].get ? $.valHooks[type].get : function(elem) {
|
2319 |
+
return elem.value;
|
2320 |
+
}, valueSet = $.valHooks[type] && $.valHooks[type].set ? $.valHooks[type].set : function(elem, value) {
|
2321 |
+
return elem.value = value, elem;
|
2322 |
+
};
|
2323 |
+
$.valHooks[type] = {
|
2324 |
+
get: function(elem) {
|
2325 |
+
var $elem = $(elem);
|
2326 |
+
if ($elem.data("_inputmask")) {
|
2327 |
+
if ($elem.data("_inputmask").opts.autoUnmask) return $elem.inputmask("unmaskedvalue");
|
2328 |
+
var result = valueGet(elem), inputData = $elem.data("_inputmask"), maskset = inputData.maskset, bufferTemplate = maskset._buffer;
|
2329 |
+
return bufferTemplate = bufferTemplate ? bufferTemplate.join("") : "", result != bufferTemplate ? result : "";
|
2330 |
+
}
|
2331 |
+
return valueGet(elem);
|
2332 |
+
},
|
2333 |
+
set: function(elem, value) {
|
2334 |
+
var result, $elem = $(elem), inputData = $elem.data("_inputmask");
|
2335 |
+
return inputData ? (result = valueSet(elem, $.isFunction(inputData.opts.onBeforeMask) ? inputData.opts.onBeforeMask.call(el, value, inputData.opts) || value : value),
|
2336 |
+
$elem.triggerHandler("setvalue.inputmask")) : result = valueSet(elem, value), result;
|
2337 |
+
},
|
2338 |
+
inputmaskpatch: !0
|
2339 |
+
};
|
2340 |
+
}
|
2341 |
+
}
|
2342 |
+
function getter() {
|
2343 |
+
var $self = $(this), inputData = $(this).data("_inputmask");
|
2344 |
+
return inputData ? inputData.opts.autoUnmask ? $self.inputmask("unmaskedvalue") : valueGet.call(this) != getBufferTemplate().join("") ? valueGet.call(this) : "" : valueGet.call(this);
|
2345 |
+
}
|
2346 |
+
function setter(value) {
|
2347 |
+
var inputData = $(this).data("_inputmask");
|
2348 |
+
inputData ? (valueSet.call(this, $.isFunction(inputData.opts.onBeforeMask) ? inputData.opts.onBeforeMask.call(el, value, inputData.opts) || value : value),
|
2349 |
+
$(this).triggerHandler("setvalue.inputmask")) : valueSet.call(this, value);
|
2350 |
+
}
|
2351 |
+
function InstallNativeValueSetFallback(npt) {
|
2352 |
+
$(npt).bind("mouseenter.inputmask", function() {
|
2353 |
+
var $input = $(this), input = this, value = input._valueGet();
|
2354 |
+
"" != value && value != getBuffer().join("") && $input.trigger("setvalue");
|
2355 |
+
});
|
2356 |
+
var events = $._data(npt).events, handlers = events.mouseover;
|
2357 |
+
if (handlers) {
|
2358 |
+
for (var ourHandler = handlers[handlers.length - 1], i = handlers.length - 1; i > 0; i--) handlers[i] = handlers[i - 1];
|
2359 |
+
handlers[0] = ourHandler;
|
2360 |
+
}
|
2361 |
+
}
|
2362 |
+
var valueGet, valueSet;
|
2363 |
+
if (!npt._valueGet) {
|
2364 |
+
if (Object.getOwnPropertyDescriptor) {
|
2365 |
+
Object.getOwnPropertyDescriptor(npt, "value");
|
2366 |
+
}
|
2367 |
+
document.__lookupGetter__ && npt.__lookupGetter__("value") ? (valueGet = npt.__lookupGetter__("value"),
|
2368 |
+
valueSet = npt.__lookupSetter__("value"), npt.__defineGetter__("value", getter),
|
2369 |
+
npt.__defineSetter__("value", setter)) : (valueGet = function() {
|
2370 |
+
return npt.value;
|
2371 |
+
}, valueSet = function(value) {
|
2372 |
+
npt.value = value;
|
2373 |
+
}, PatchValhook(npt.type), InstallNativeValueSetFallback(npt)), npt._valueGet = function() {
|
2374 |
+
return isRTL ? valueGet.call(this).split("").reverse().join("") : valueGet.call(this);
|
2375 |
+
}, npt._valueSet = function(value) {
|
2376 |
+
valueSet.call(this, isRTL ? value.split("").reverse().join("") : value);
|
2377 |
+
};
|
2378 |
+
}
|
2379 |
+
}
|
2380 |
+
function handleRemove(input, k, pos) {
|
2381 |
+
function generalize() {
|
2382 |
+
if (opts.keepStatic) {
|
2383 |
+
resetMaskSet(!0);
|
2384 |
+
var lastAlt, validInputs = [];
|
2385 |
+
for (lastAlt = getLastValidPosition(); lastAlt >= 0; lastAlt--) if (getMaskSet().validPositions[lastAlt]) {
|
2386 |
+
if (void 0 != getMaskSet().validPositions[lastAlt].alternation) break;
|
2387 |
+
validInputs.push(getMaskSet().validPositions[lastAlt].input), delete getMaskSet().validPositions[lastAlt];
|
2388 |
+
}
|
2389 |
+
if (lastAlt > 0) for (;validInputs.length > 0; ) getMaskSet().p = seekNext(getLastValidPosition()),
|
2390 |
+
keypressEvent.call(input, void 0, !0, validInputs.pop().charCodeAt(0), !1, !1, getMaskSet().p);
|
2391 |
+
}
|
2392 |
+
}
|
2393 |
+
if ((opts.numericInput || isRTL) && (k == $.inputmask.keyCode.BACKSPACE ? k = $.inputmask.keyCode.DELETE : k == $.inputmask.keyCode.DELETE && (k = $.inputmask.keyCode.BACKSPACE),
|
2394 |
+
isRTL)) {
|
2395 |
+
var pend = pos.end;
|
2396 |
+
pos.end = pos.begin, pos.begin = pend;
|
2397 |
+
}
|
2398 |
+
k == $.inputmask.keyCode.BACKSPACE && pos.end - pos.begin <= 1 ? pos.begin = seekPrevious(pos.begin) : k == $.inputmask.keyCode.DELETE && pos.begin == pos.end && pos.end++,
|
2399 |
+
stripValidPositions(pos.begin, pos.end), generalize();
|
2400 |
+
var firstMaskedPos = getLastValidPosition(pos.begin);
|
2401 |
+
firstMaskedPos < pos.begin ? (-1 == firstMaskedPos && resetMaskSet(), getMaskSet().p = seekNext(firstMaskedPos)) : getMaskSet().p = pos.begin;
|
2402 |
+
}
|
2403 |
+
function handleOnKeyResult(input, keyResult, caretPos) {
|
2404 |
+
if (keyResult && keyResult.refreshFromBuffer) {
|
2405 |
+
var refresh = keyResult.refreshFromBuffer;
|
2406 |
+
refreshFromBuffer(refresh === !0 ? refresh : refresh.start, refresh.end), resetMaskSet(!0),
|
2407 |
+
void 0 != caretPos && (writeBuffer(input, getBuffer()), caret(input, keyResult.caret || caretPos.begin, keyResult.caret || caretPos.end));
|
2408 |
+
}
|
2409 |
+
}
|
2410 |
+
function keydownEvent(e) {
|
2411 |
+
skipKeyPressEvent = !1;
|
2412 |
+
var input = this, $input = $(input), k = e.keyCode, pos = caret(input);
|
2413 |
+
k == $.inputmask.keyCode.BACKSPACE || k == $.inputmask.keyCode.DELETE || iphone && 127 == k || e.ctrlKey && 88 == k && !isInputEventSupported("cut") ? (e.preventDefault(),
|
2414 |
+
88 == k && (valueOnFocus = getBuffer().join("")), handleRemove(input, k, pos), writeBuffer(input, getBuffer(), getMaskSet().p),
|
2415 |
+
input._valueGet() == getBufferTemplate().join("") && $input.trigger("cleared"),
|
2416 |
+
opts.showTooltip && $input.prop("title", getMaskSet().mask)) : k == $.inputmask.keyCode.END || k == $.inputmask.keyCode.PAGE_DOWN ? setTimeout(function() {
|
2417 |
+
var caretPos = seekNext(getLastValidPosition());
|
2418 |
+
opts.insertMode || caretPos != getMaskLength() || e.shiftKey || caretPos--, caret(input, e.shiftKey ? pos.begin : caretPos, caretPos);
|
2419 |
+
}, 0) : k == $.inputmask.keyCode.HOME && !e.shiftKey || k == $.inputmask.keyCode.PAGE_UP ? caret(input, 0, e.shiftKey ? pos.begin : 0) : k == $.inputmask.keyCode.ESCAPE || 90 == k && e.ctrlKey ? (checkVal(input, !0, !1, valueOnFocus.split("")),
|
2420 |
+
$input.click()) : k != $.inputmask.keyCode.INSERT || e.shiftKey || e.ctrlKey ? 0 != opts.insertMode || e.shiftKey || (k == $.inputmask.keyCode.RIGHT ? setTimeout(function() {
|
2421 |
+
var caretPos = caret(input);
|
2422 |
+
caret(input, caretPos.begin);
|
2423 |
+
}, 0) : k == $.inputmask.keyCode.LEFT && setTimeout(function() {
|
2424 |
+
var caretPos = caret(input);
|
2425 |
+
caret(input, isRTL ? caretPos.begin + 1 : caretPos.begin - 1);
|
2426 |
+
}, 0)) : (opts.insertMode = !opts.insertMode, caret(input, opts.insertMode || pos.begin != getMaskLength() ? pos.begin : pos.begin - 1));
|
2427 |
+
var currentCaretPos = caret(input), keydownResult = opts.onKeyDown.call(this, e, getBuffer(), currentCaretPos.begin, opts);
|
2428 |
+
handleOnKeyResult(input, keydownResult, currentCaretPos), ignorable = -1 != $.inArray(k, opts.ignorables);
|
2429 |
+
}
|
2430 |
+
function keypressEvent(e, checkval, k, writeOut, strict, ndx) {
|
2431 |
+
if (void 0 == k && skipKeyPressEvent) return !1;
|
2432 |
+
skipKeyPressEvent = !0;
|
2433 |
+
var input = this, $input = $(input);
|
2434 |
+
e = e || window.event;
|
2435 |
+
var k = checkval ? k : e.which || e.charCode || e.keyCode;
|
2436 |
+
if (!(checkval === !0 || e.ctrlKey && e.altKey) && (e.ctrlKey || e.metaKey || ignorable)) return !0;
|
2437 |
+
if (k) {
|
2438 |
+
checkval !== !0 && 46 == k && 0 == e.shiftKey && "," == opts.radixPoint && (k = 44);
|
2439 |
+
var forwardPosition, pos = checkval ? {
|
2440 |
+
begin: ndx,
|
2441 |
+
end: ndx
|
2442 |
+
} : caret(input), c = String.fromCharCode(k), isSlctn = isSelection(pos.begin, pos.end);
|
2443 |
+
isSlctn && (getMaskSet().undoPositions = $.extend(!0, {}, getMaskSet().validPositions),
|
2444 |
+
handleRemove(input, $.inputmask.keyCode.DELETE, pos), opts.insertMode || (opts.insertMode = !opts.insertMode,
|
2445 |
+
setValidPosition(pos.begin, strict), opts.insertMode = !opts.insertMode), isSlctn = !opts.multi),
|
2446 |
+
getMaskSet().writeOutBuffer = !0;
|
2447 |
+
var p = isRTL && !isSlctn ? pos.end : pos.begin, valResult = isValid(p, c, strict);
|
2448 |
+
if (valResult !== !1) {
|
2449 |
+
if (valResult !== !0 && (p = void 0 != valResult.pos ? valResult.pos : p, c = void 0 != valResult.c ? valResult.c : c),
|
2450 |
+
resetMaskSet(!0), void 0 != valResult.caret) forwardPosition = valResult.caret; else {
|
2451 |
+
var vps = getMaskSet().validPositions;
|
2452 |
+
forwardPosition = !opts.keepStatic && (void 0 != vps[p + 1] && getTests(p + 1, vps[p].locator.slice(), p).length > 1 || void 0 != vps[p].alternation) ? p + 1 : seekNext(p);
|
2453 |
+
}
|
2454 |
+
getMaskSet().p = forwardPosition;
|
2455 |
+
}
|
2456 |
+
if (writeOut !== !1) {
|
2457 |
+
var self = this;
|
2458 |
+
if (setTimeout(function() {
|
2459 |
+
opts.onKeyValidation.call(self, valResult, opts);
|
2460 |
+
}, 0), getMaskSet().writeOutBuffer && valResult !== !1) {
|
2461 |
+
var buffer = getBuffer();
|
2462 |
+
writeBuffer(input, buffer, checkval ? void 0 : opts.numericInput ? seekPrevious(forwardPosition) : forwardPosition),
|
2463 |
+
checkval !== !0 && setTimeout(function() {
|
2464 |
+
isComplete(buffer) === !0 && $input.trigger("complete"), skipInputEvent = !0, $input.trigger("input");
|
2465 |
+
}, 0);
|
2466 |
+
} else isSlctn && (getMaskSet().buffer = void 0, getMaskSet().validPositions = getMaskSet().undoPositions);
|
2467 |
+
} else isSlctn && (getMaskSet().buffer = void 0, getMaskSet().validPositions = getMaskSet().undoPositions);
|
2468 |
+
if (opts.showTooltip && $input.prop("title", getMaskSet().mask), e && 1 != checkval) {
|
2469 |
+
e.preventDefault();
|
2470 |
+
var currentCaretPos = caret(input), keypressResult = opts.onKeyPress.call(this, e, getBuffer(), currentCaretPos.begin, opts);
|
2471 |
+
handleOnKeyResult(input, keypressResult, currentCaretPos);
|
2472 |
+
}
|
2473 |
+
}
|
2474 |
+
}
|
2475 |
+
function keyupEvent(e) {
|
2476 |
+
var $input = $(this), input = this, k = e.keyCode, buffer = getBuffer(), currentCaretPos = caret(input), keyupResult = opts.onKeyUp.call(this, e, buffer, currentCaretPos.begin, opts);
|
2477 |
+
handleOnKeyResult(input, keyupResult, currentCaretPos), k == $.inputmask.keyCode.TAB && opts.showMaskOnFocus && ($input.hasClass("focus-inputmask") && 0 == input._valueGet().length ? (resetMaskSet(),
|
2478 |
+
buffer = getBuffer(), writeBuffer(input, buffer), caret(input, 0), valueOnFocus = getBuffer().join("")) : (writeBuffer(input, buffer),
|
2479 |
+
caret(input, TranslatePosition(0), TranslatePosition(getMaskLength()))));
|
2480 |
+
}
|
2481 |
+
function pasteEvent(e) {
|
2482 |
+
if (skipInputEvent === !0 && "input" == e.type) return skipInputEvent = !1, !0;
|
2483 |
+
var input = this, $input = $(input), inputValue = input._valueGet(), caretPos = caret(input);
|
2484 |
+
if ("propertychange" == e.type && input._valueGet().length <= getMaskLength()) return !0;
|
2485 |
+
"paste" == e.type && (window.clipboardData && window.clipboardData.getData ? inputValue = inputValue.substr(0, caretPos.begin) + window.clipboardData.getData("Text") + inputValue.substr(caretPos.end, inputValue.length) : e.originalEvent && e.originalEvent.clipboardData && e.originalEvent.clipboardData.getData && (inputValue = inputValue.substr(0, caretPos.begin) + e.originalEvent.clipboardData.getData("text/plain") + inputValue.substr(caretPos.end, inputValue.length)));
|
2486 |
+
var pasteValue = $.isFunction(opts.onBeforePaste) ? opts.onBeforePaste.call(input, inputValue, opts) || inputValue : inputValue;
|
2487 |
+
return checkVal(input, !0, !1, isRTL ? pasteValue.split("").reverse() : pasteValue.split(""), !0),
|
2488 |
+
$input.click(), isComplete(getBuffer()) === !0 && $input.trigger("complete"), !1;
|
2489 |
+
}
|
2490 |
+
function mobileInputEvent(e) {
|
2491 |
+
if (skipInputEvent === !0 && "input" == e.type) return skipInputEvent = !1, !0;
|
2492 |
+
var input = this, caretPos = caret(input), currentValue = input._valueGet();
|
2493 |
+
currentValue = currentValue.replace(new RegExp("(" + escapeRegex(getBufferTemplate().join("")) + ")*"), ""),
|
2494 |
+
caretPos.begin > currentValue.length && (caret(input, currentValue.length), caretPos = caret(input)),
|
2495 |
+
getBuffer().length - currentValue.length != 1 || currentValue.charAt(caretPos.begin) == getBuffer()[caretPos.begin] || currentValue.charAt(caretPos.begin + 1) == getBuffer()[caretPos.begin] || isMask(caretPos.begin) || (e.keyCode = $.inputmask.keyCode.BACKSPACE,
|
2496 |
+
keydownEvent.call(input, e)), e.preventDefault();
|
2497 |
+
}
|
2498 |
+
function inputFallBackEvent(e) {
|
2499 |
+
if (skipInputEvent === !0 && "input" == e.type) return skipInputEvent = !1, !0;
|
2500 |
+
var input = this, caretPos = caret(input), currentValue = input._valueGet();
|
2501 |
+
caret(input, caretPos.begin - 1);
|
2502 |
+
var keypress = $.Event("keypress");
|
2503 |
+
keypress.which = currentValue.charCodeAt(caretPos.begin - 1), skipKeyPressEvent = !1,
|
2504 |
+
ignorable = !1, keypressEvent.call(input, keypress, void 0, void 0, !1);
|
2505 |
+
var forwardPosition = getMaskSet().p;
|
2506 |
+
writeBuffer(input, getBuffer(), opts.numericInput ? seekPrevious(forwardPosition) : forwardPosition),
|
2507 |
+
e.preventDefault();
|
2508 |
+
}
|
2509 |
+
function compositionupdateEvent(e) {
|
2510 |
+
skipInputEvent = !0;
|
2511 |
+
var input = this;
|
2512 |
+
return setTimeout(function() {
|
2513 |
+
caret(input, caret(input).begin - 1);
|
2514 |
+
var keypress = $.Event("keypress");
|
2515 |
+
keypress.which = e.originalEvent.data.charCodeAt(0), skipKeyPressEvent = !1, ignorable = !1,
|
2516 |
+
keypressEvent.call(input, keypress, void 0, void 0, !1);
|
2517 |
+
var forwardPosition = getMaskSet().p;
|
2518 |
+
writeBuffer(input, getBuffer(), opts.numericInput ? seekPrevious(forwardPosition) : forwardPosition);
|
2519 |
+
}, 0), !1;
|
2520 |
+
}
|
2521 |
+
function mask(el) {
|
2522 |
+
if ($el = $(el), $el.is(":input") && isInputTypeSupported($el.attr("type"))) {
|
2523 |
+
if ($el.data("_inputmask", {
|
2524 |
+
maskset: maskset,
|
2525 |
+
opts: opts,
|
2526 |
+
isRTL: !1
|
2527 |
+
}), opts.showTooltip && $el.prop("title", getMaskSet().mask), ("rtl" == el.dir || opts.rightAlign) && $el.css("text-align", "right"),
|
2528 |
+
"rtl" == el.dir || opts.numericInput) {
|
2529 |
+
el.dir = "ltr", $el.removeAttr("dir");
|
2530 |
+
var inputData = $el.data("_inputmask");
|
2531 |
+
inputData.isRTL = !0, $el.data("_inputmask", inputData), isRTL = !0;
|
2532 |
+
}
|
2533 |
+
$el.unbind(".inputmask"), $el.removeClass("focus-inputmask"), $el.closest("form").bind("submit", function() {
|
2534 |
+
valueOnFocus != getBuffer().join("") && $el.change(), $el[0]._valueGet && $el[0]._valueGet() == getBufferTemplate().join("") && $el[0]._valueSet(""),
|
2535 |
+
opts.autoUnmask && opts.removeMaskOnSubmit && $el.inputmask("remove");
|
2536 |
+
}).bind("reset", function() {
|
2537 |
+
setTimeout(function() {
|
2538 |
+
$el.trigger("setvalue");
|
2539 |
+
}, 0);
|
2540 |
+
}), $el.bind("mouseenter.inputmask", function() {
|
2541 |
+
var $input = $(this), input = this;
|
2542 |
+
!$input.hasClass("focus-inputmask") && opts.showMaskOnHover && input._valueGet() != getBuffer().join("") && writeBuffer(input, getBuffer());
|
2543 |
+
}).bind("blur.inputmask", function() {
|
2544 |
+
var $input = $(this), input = this;
|
2545 |
+
if ($input.data("_inputmask")) {
|
2546 |
+
var nptValue = input._valueGet(), buffer = getBuffer();
|
2547 |
+
$input.removeClass("focus-inputmask"), valueOnFocus != getBuffer().join("") && $input.change(),
|
2548 |
+
opts.clearMaskOnLostFocus && "" != nptValue && (nptValue == getBufferTemplate().join("") ? input._valueSet("") : clearOptionalTail(input)),
|
2549 |
+
isComplete(buffer) === !1 && ($input.trigger("incomplete"), opts.clearIncomplete && (resetMaskSet(),
|
2550 |
+
opts.clearMaskOnLostFocus ? input._valueSet("") : (buffer = getBufferTemplate().slice(),
|
2551 |
+
writeBuffer(input, buffer))));
|
2552 |
+
}
|
2553 |
+
}).bind("focus.inputmask", function() {
|
2554 |
+
var $input = $(this), input = this, nptValue = input._valueGet();
|
2555 |
+
opts.showMaskOnFocus && !$input.hasClass("focus-inputmask") && (!opts.showMaskOnHover || opts.showMaskOnHover && "" == nptValue) && input._valueGet() != getBuffer().join("") && writeBuffer(input, getBuffer(), seekNext(getLastValidPosition())),
|
2556 |
+
$input.addClass("focus-inputmask"), valueOnFocus = getBuffer().join("");
|
2557 |
+
}).bind("mouseleave.inputmask", function() {
|
2558 |
+
var $input = $(this), input = this;
|
2559 |
+
opts.clearMaskOnLostFocus && ($input.hasClass("focus-inputmask") || input._valueGet() == $input.attr("placeholder") || (input._valueGet() == getBufferTemplate().join("") || "" == input._valueGet() ? input._valueSet("") : clearOptionalTail(input)));
|
2560 |
+
}).bind("click.inputmask", function() {
|
2561 |
+
var input = this;
|
2562 |
+
$(input).is(":focus") && setTimeout(function() {
|
2563 |
+
var selectedCaret = caret(input);
|
2564 |
+
if (selectedCaret.begin == selectedCaret.end) if (opts.radixFocus && "" != opts.radixPoint && -1 != $.inArray(opts.radixPoint, getBuffer()) && getBuffer().join("") == getBufferTemplate().join("")) caret(input, $.inArray(opts.radixPoint, getBuffer())); else {
|
2565 |
+
var clickPosition = isRTL ? TranslatePosition(selectedCaret.begin) : selectedCaret.begin, lastPosition = seekNext(getLastValidPosition(clickPosition));
|
2566 |
+
lastPosition > clickPosition ? caret(input, isMask(clickPosition) ? clickPosition : seekNext(clickPosition)) : caret(input, lastPosition);
|
2567 |
+
}
|
2568 |
+
}, 0);
|
2569 |
+
}).bind("dblclick.inputmask", function() {
|
2570 |
+
var input = this;
|
2571 |
+
setTimeout(function() {
|
2572 |
+
caret(input, 0, seekNext(getLastValidPosition()));
|
2573 |
+
}, 0);
|
2574 |
+
}).bind(PasteEventType + ".inputmask dragdrop.inputmask drop.inputmask", pasteEvent).bind("setvalue.inputmask", function() {
|
2575 |
+
var input = this;
|
2576 |
+
checkVal(input, !0, !1, void 0, !0), valueOnFocus = getBuffer().join(""), (opts.clearMaskOnLostFocus || opts.clearIncomplete) && input._valueGet() == getBufferTemplate().join("") && input._valueSet("");
|
2577 |
+
}).bind("cut.inputmask", function(e) {
|
2578 |
+
skipInputEvent = !0;
|
2579 |
+
var input = this, $input = $(input), pos = caret(input);
|
2580 |
+
handleRemove(input, $.inputmask.keyCode.DELETE, pos);
|
2581 |
+
var keypressResult = opts.onKeyPress.call(this, e, getBuffer(), getMaskSet().p, opts);
|
2582 |
+
handleOnKeyResult(input, keypressResult, {
|
2583 |
+
begin: getMaskSet().p,
|
2584 |
+
end: getMaskSet().p
|
2585 |
+
}), input._valueGet() == getBufferTemplate().join("") && $input.trigger("cleared"),
|
2586 |
+
opts.showTooltip && $input.prop("title", getMaskSet().mask);
|
2587 |
+
}).bind("complete.inputmask", opts.oncomplete).bind("incomplete.inputmask", opts.onincomplete).bind("cleared.inputmask", opts.oncleared),
|
2588 |
+
$el.bind("keydown.inputmask", keydownEvent).bind("keypress.inputmask", keypressEvent).bind("keyup.inputmask", keyupEvent).bind("compositionupdate.inputmask", compositionupdateEvent),
|
2589 |
+
"paste" !== PasteEventType || msie1x || $el.bind("input.inputmask", inputFallBackEvent),
|
2590 |
+
msie1x && $el.bind("input.inputmask", pasteEvent), (android || androidfirefox || androidchrome || kindle) && ("input" == PasteEventType && $el.unbind(PasteEventType + ".inputmask"),
|
2591 |
+
$el.bind("input.inputmask", mobileInputEvent)), patchValueProperty(el);
|
2592 |
+
var initialValue = $.isFunction(opts.onBeforeMask) ? opts.onBeforeMask.call(el, el._valueGet(), opts) || el._valueGet() : el._valueGet();
|
2593 |
+
checkVal(el, !0, !1, initialValue.split(""), !0), valueOnFocus = getBuffer().join("");
|
2594 |
+
var activeElement;
|
2595 |
+
try {
|
2596 |
+
activeElement = document.activeElement;
|
2597 |
+
} catch (e) {}
|
2598 |
+
isComplete(getBuffer()) === !1 && opts.clearIncomplete && resetMaskSet(), opts.clearMaskOnLostFocus ? getBuffer().join("") == getBufferTemplate().join("") ? el._valueSet("") : clearOptionalTail(el) : writeBuffer(el, getBuffer()),
|
2599 |
+
activeElement === el && ($el.addClass("focus-inputmask"), caret(el, seekNext(getLastValidPosition()))),
|
2600 |
+
installEventRuler(el);
|
2601 |
+
}
|
2602 |
+
}
|
2603 |
+
var valueOnFocus, $el, maxLength, isRTL = !1, skipKeyPressEvent = !1, skipInputEvent = !1, ignorable = !1;
|
2604 |
+
if (void 0 != actionObj) switch (actionObj.action) {
|
2605 |
+
case "isComplete":
|
2606 |
+
return $el = $(actionObj.el), maskset = $el.data("_inputmask").maskset, opts = $el.data("_inputmask").opts,
|
2607 |
+
isComplete(actionObj.buffer);
|
2608 |
+
|
2609 |
+
case "unmaskedvalue":
|
2610 |
+
return $el = actionObj.$input, maskset = $el.data("_inputmask").maskset, opts = $el.data("_inputmask").opts,
|
2611 |
+
isRTL = actionObj.$input.data("_inputmask").isRTL, unmaskedvalue(actionObj.$input);
|
2612 |
+
|
2613 |
+
case "mask":
|
2614 |
+
valueOnFocus = getBuffer().join(""), mask(actionObj.el);
|
2615 |
+
break;
|
2616 |
+
|
2617 |
+
case "format":
|
2618 |
+
$el = $({}), $el.data("_inputmask", {
|
2619 |
+
maskset: maskset,
|
2620 |
+
opts: opts,
|
2621 |
+
isRTL: opts.numericInput
|
2622 |
+
}), opts.numericInput && (isRTL = !0);
|
2623 |
+
var valueBuffer = ($.isFunction(opts.onBeforeMask) ? opts.onBeforeMask.call($el, actionObj.value, opts) || actionObj.value : actionObj.value).split("");
|
2624 |
+
return checkVal($el, !1, !1, isRTL ? valueBuffer.reverse() : valueBuffer, !0), opts.onKeyPress.call(this, void 0, getBuffer(), 0, opts),
|
2625 |
+
actionObj.metadata ? {
|
2626 |
+
value: isRTL ? getBuffer().slice().reverse().join("") : getBuffer().join(""),
|
2627 |
+
metadata: $el.inputmask("getmetadata")
|
2628 |
+
} : isRTL ? getBuffer().slice().reverse().join("") : getBuffer().join("");
|
2629 |
+
|
2630 |
+
case "isValid":
|
2631 |
+
$el = $({}), $el.data("_inputmask", {
|
2632 |
+
maskset: maskset,
|
2633 |
+
opts: opts,
|
2634 |
+
isRTL: opts.numericInput
|
2635 |
+
}), opts.numericInput && (isRTL = !0);
|
2636 |
+
var valueBuffer = actionObj.value.split("");
|
2637 |
+
checkVal($el, !1, !0, isRTL ? valueBuffer.reverse() : valueBuffer);
|
2638 |
+
for (var buffer = getBuffer(), rl = determineLastRequiredPosition(), lmib = buffer.length - 1; lmib > rl && !isMask(lmib); lmib--) ;
|
2639 |
+
return buffer.splice(rl, lmib + 1 - rl), isComplete(buffer) && actionObj.value == buffer.join("");
|
2640 |
+
|
2641 |
+
case "getemptymask":
|
2642 |
+
return $el = $(actionObj.el), maskset = $el.data("_inputmask").maskset, opts = $el.data("_inputmask").opts,
|
2643 |
+
getBufferTemplate();
|
2644 |
+
|
2645 |
+
case "remove":
|
2646 |
+
var el = actionObj.el;
|
2647 |
+
$el = $(el), maskset = $el.data("_inputmask").maskset, opts = $el.data("_inputmask").opts,
|
2648 |
+
el._valueSet(unmaskedvalue($el)), $el.unbind(".inputmask"), $el.removeClass("focus-inputmask"),
|
2649 |
+
$el.removeData("_inputmask");
|
2650 |
+
var valueProperty;
|
2651 |
+
Object.getOwnPropertyDescriptor && (valueProperty = Object.getOwnPropertyDescriptor(el, "value")),
|
2652 |
+
valueProperty && valueProperty.get ? el._valueGet && Object.defineProperty(el, "value", {
|
2653 |
+
get: el._valueGet,
|
2654 |
+
set: el._valueSet
|
2655 |
+
}) : document.__lookupGetter__ && el.__lookupGetter__("value") && el._valueGet && (el.__defineGetter__("value", el._valueGet),
|
2656 |
+
el.__defineSetter__("value", el._valueSet));
|
2657 |
+
try {
|
2658 |
+
delete el._valueGet, delete el._valueSet;
|
2659 |
+
} catch (e) {
|
2660 |
+
el._valueGet = void 0, el._valueSet = void 0;
|
2661 |
+
}
|
2662 |
+
break;
|
2663 |
+
|
2664 |
+
case "getmetadata":
|
2665 |
+
if ($el = $(actionObj.el), maskset = $el.data("_inputmask").maskset, opts = $el.data("_inputmask").opts,
|
2666 |
+
$.isArray(maskset.metadata)) {
|
2667 |
+
for (var alternation, lvp = getLastValidPosition(), firstAlt = lvp; firstAlt >= 0; firstAlt--) if (getMaskSet().validPositions[firstAlt] && void 0 != getMaskSet().validPositions[firstAlt].alternation) {
|
2668 |
+
alternation = getMaskSet().validPositions[firstAlt].alternation;
|
2669 |
+
break;
|
2670 |
+
}
|
2671 |
+
return void 0 != alternation ? maskset.metadata[getMaskSet().validPositions[lvp].locator[alternation]] : maskset.metadata[0];
|
2672 |
+
}
|
2673 |
+
return maskset.metadata;
|
2674 |
+
}
|
2675 |
+
}
|
2676 |
+
if (void 0 === $.fn.inputmask) {
|
2677 |
+
var msie1x = "function" == typeof ScriptEngineMajorVersion ? ScriptEngineMajorVersion() : new Function("/*@cc_on return @_jscript_version; @*/")() >= 10, ua = navigator.userAgent, iphone = null !== ua.match(new RegExp("iphone", "i")), android = null !== ua.match(new RegExp("android.*safari.*", "i")), androidchrome = null !== ua.match(new RegExp("android.*chrome.*", "i")), androidfirefox = null !== ua.match(new RegExp("android.*firefox.*", "i")), kindle = /Kindle/i.test(ua) || /Silk/i.test(ua) || /KFTT/i.test(ua) || /KFOT/i.test(ua) || /KFJWA/i.test(ua) || /KFJWI/i.test(ua) || /KFSOWI/i.test(ua) || /KFTHWA/i.test(ua) || /KFTHWI/i.test(ua) || /KFAPWA/i.test(ua) || /KFAPWI/i.test(ua), PasteEventType = isInputEventSupported("paste") ? "paste" : isInputEventSupported("input") ? "input" : "propertychange";
|
2678 |
+
$.inputmask = {
|
2679 |
+
defaults: {
|
2680 |
+
placeholder: "_",
|
2681 |
+
optionalmarker: {
|
2682 |
+
start: "[",
|
2683 |
+
end: "]"
|
2684 |
+
},
|
2685 |
+
quantifiermarker: {
|
2686 |
+
start: "{",
|
2687 |
+
end: "}"
|
2688 |
+
},
|
2689 |
+
groupmarker: {
|
2690 |
+
start: "(",
|
2691 |
+
end: ")"
|
2692 |
+
},
|
2693 |
+
alternatormarker: "|",
|
2694 |
+
escapeChar: "\\",
|
2695 |
+
mask: null,
|
2696 |
+
oncomplete: $.noop,
|
2697 |
+
onincomplete: $.noop,
|
2698 |
+
oncleared: $.noop,
|
2699 |
+
repeat: 0,
|
2700 |
+
greedy: !0,
|
2701 |
+
autoUnmask: !1,
|
2702 |
+
removeMaskOnSubmit: !0,
|
2703 |
+
clearMaskOnLostFocus: !0,
|
2704 |
+
insertMode: !0,
|
2705 |
+
clearIncomplete: !1,
|
2706 |
+
aliases: {},
|
2707 |
+
alias: null,
|
2708 |
+
onKeyUp: $.noop,
|
2709 |
+
onKeyPress: $.noop,
|
2710 |
+
onKeyDown: $.noop,
|
2711 |
+
onBeforeMask: void 0,
|
2712 |
+
onBeforePaste: void 0,
|
2713 |
+
onUnMask: void 0,
|
2714 |
+
showMaskOnFocus: !0,
|
2715 |
+
showMaskOnHover: !0,
|
2716 |
+
onKeyValidation: $.noop,
|
2717 |
+
skipOptionalPartCharacter: " ",
|
2718 |
+
showTooltip: !1,
|
2719 |
+
numericInput: !1,
|
2720 |
+
rightAlign: !1,
|
2721 |
+
radixPoint: "",
|
2722 |
+
radixFocus: !1,
|
2723 |
+
nojumps: !1,
|
2724 |
+
nojumpsThreshold: 0,
|
2725 |
+
keepStatic: void 0,
|
2726 |
+
definitions: {
|
2727 |
+
"9": {
|
2728 |
+
validator: "[0-9]",
|
2729 |
+
cardinality: 1,
|
2730 |
+
definitionSymbol: "*"
|
2731 |
+
},
|
2732 |
+
a: {
|
2733 |
+
validator: "[A-Za-zА-яЁёÀ-ÿµ]",
|
2734 |
+
cardinality: 1,
|
2735 |
+
definitionSymbol: "*"
|
2736 |
+
},
|
2737 |
+
"*": {
|
2738 |
+
validator: "[0-9A-Za-zА-яЁёÀ-ÿµ]",
|
2739 |
+
cardinality: 1
|
2740 |
+
}
|
2741 |
+
},
|
2742 |
+
ignorables: [ 8, 9, 13, 19, 27, 33, 34, 35, 36, 37, 38, 39, 40, 45, 46, 93, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123 ],
|
2743 |
+
isComplete: void 0
|
2744 |
+
},
|
2745 |
+
keyCode: {
|
2746 |
+
ALT: 18,
|
2747 |
+
BACKSPACE: 8,
|
2748 |
+
CAPS_LOCK: 20,
|
2749 |
+
COMMA: 188,
|
2750 |
+
COMMAND: 91,
|
2751 |
+
COMMAND_LEFT: 91,
|
2752 |
+
COMMAND_RIGHT: 93,
|
2753 |
+
CONTROL: 17,
|
2754 |
+
DELETE: 46,
|
2755 |
+
DOWN: 40,
|
2756 |
+
END: 35,
|
2757 |
+
ENTER: 13,
|
2758 |
+
ESCAPE: 27,
|
2759 |
+
HOME: 36,
|
2760 |
+
INSERT: 45,
|
2761 |
+
LEFT: 37,
|
2762 |
+
MENU: 93,
|
2763 |
+
NUMPAD_ADD: 107,
|
2764 |
+
NUMPAD_DECIMAL: 110,
|
2765 |
+
NUMPAD_DIVIDE: 111,
|
2766 |
+
NUMPAD_ENTER: 108,
|
2767 |
+
NUMPAD_MULTIPLY: 106,
|
2768 |
+
NUMPAD_SUBTRACT: 109,
|
2769 |
+
PAGE_DOWN: 34,
|
2770 |
+
PAGE_UP: 33,
|
2771 |
+
PERIOD: 190,
|
2772 |
+
RIGHT: 39,
|
2773 |
+
SHIFT: 16,
|
2774 |
+
SPACE: 32,
|
2775 |
+
TAB: 9,
|
2776 |
+
UP: 38,
|
2777 |
+
WINDOWS: 91
|
2778 |
+
},
|
2779 |
+
masksCache: {},
|
2780 |
+
escapeRegex: function(str) {
|
2781 |
+
var specials = [ "/", ".", "*", "+", "?", "|", "(", ")", "[", "]", "{", "}", "\\" ];
|
2782 |
+
return str.replace(new RegExp("(\\" + specials.join("|\\") + ")", "gim"), "\\$1");
|
2783 |
+
},
|
2784 |
+
format: function(value, options, metadata) {
|
2785 |
+
var opts = $.extend(!0, {}, $.inputmask.defaults, options);
|
2786 |
+
return resolveAlias(opts.alias, options, opts), maskScope({
|
2787 |
+
action: "format",
|
2788 |
+
value: value,
|
2789 |
+
metadata: metadata
|
2790 |
+
}, generateMaskSet(opts), opts);
|
2791 |
+
},
|
2792 |
+
isValid: function(value, options) {
|
2793 |
+
var opts = $.extend(!0, {}, $.inputmask.defaults, options);
|
2794 |
+
return resolveAlias(opts.alias, options, opts), maskScope({
|
2795 |
+
action: "isValid",
|
2796 |
+
value: value
|
2797 |
+
}, generateMaskSet(opts), opts);
|
2798 |
+
}
|
2799 |
+
}, $.fn.inputmask = function(fn, options, targetScope, targetData, msk) {
|
2800 |
+
function importAttributeOptions(npt, opts, importedOptionsContainer) {
|
2801 |
+
var $npt = $(npt);
|
2802 |
+
$npt.data("inputmask-alias") && resolveAlias($npt.data("inputmask-alias"), {}, opts);
|
2803 |
+
for (var option in opts) {
|
2804 |
+
var optionData = $npt.data("inputmask-" + option.toLowerCase());
|
2805 |
+
void 0 != optionData && ("mask" == option && 0 == optionData.indexOf("[") ? (opts[option] = optionData.replace(/[\s[\]]/g, "").split("','"),
|
2806 |
+
opts[option][0] = opts[option][0].replace("'", ""), opts[option][opts[option].length - 1] = opts[option][opts[option].length - 1].replace("'", "")) : opts[option] = "boolean" == typeof optionData ? optionData : optionData.toString(),
|
2807 |
+
importedOptionsContainer && (importedOptionsContainer[option] = opts[option]));
|
2808 |
+
}
|
2809 |
+
return opts;
|
2810 |
+
}
|
2811 |
+
targetScope = targetScope || maskScope, targetData = targetData || "_inputmask";
|
2812 |
+
var maskset, opts = $.extend(!0, {}, $.inputmask.defaults, options);
|
2813 |
+
if ("string" == typeof fn) switch (fn) {
|
2814 |
+
case "mask":
|
2815 |
+
return resolveAlias(opts.alias, options, opts), maskset = generateMaskSet(opts, targetScope !== maskScope),
|
2816 |
+
void 0 == maskset ? this : this.each(function() {
|
2817 |
+
targetScope({
|
2818 |
+
action: "mask",
|
2819 |
+
el: this
|
2820 |
+
}, $.extend(!0, {}, maskset), importAttributeOptions(this, opts));
|
2821 |
+
});
|
2822 |
+
|
2823 |
+
case "unmaskedvalue":
|
2824 |
+
var $input = $(this);
|
2825 |
+
return $input.data(targetData) ? targetScope({
|
2826 |
+
action: "unmaskedvalue",
|
2827 |
+
$input: $input
|
2828 |
+
}) : $input.val();
|
2829 |
+
|
2830 |
+
case "remove":
|
2831 |
+
return this.each(function() {
|
2832 |
+
var $input = $(this);
|
2833 |
+
$input.data(targetData) && targetScope({
|
2834 |
+
action: "remove",
|
2835 |
+
el: this
|
2836 |
+
});
|
2837 |
+
});
|
2838 |
+
|
2839 |
+
case "getemptymask":
|
2840 |
+
return this.data(targetData) ? targetScope({
|
2841 |
+
action: "getemptymask",
|
2842 |
+
el: this
|
2843 |
+
}) : "";
|
2844 |
+
|
2845 |
+
case "hasMaskedValue":
|
2846 |
+
return this.data(targetData) ? !this.data(targetData).opts.autoUnmask : !1;
|
2847 |
+
|
2848 |
+
case "isComplete":
|
2849 |
+
return this.data(targetData) ? targetScope({
|
2850 |
+
action: "isComplete",
|
2851 |
+
buffer: this[0]._valueGet().split(""),
|
2852 |
+
el: this
|
2853 |
+
}) : !0;
|
2854 |
+
|
2855 |
+
case "getmetadata":
|
2856 |
+
return this.data(targetData) ? targetScope({
|
2857 |
+
action: "getmetadata",
|
2858 |
+
el: this
|
2859 |
+
}) : void 0;
|
2860 |
+
|
2861 |
+
case "_detectScope":
|
2862 |
+
return resolveAlias(opts.alias, options, opts), void 0 == msk || resolveAlias(msk, options, opts) || -1 != $.inArray(msk, [ "mask", "unmaskedvalue", "remove", "getemptymask", "hasMaskedValue", "isComplete", "getmetadata", "_detectScope" ]) || (opts.mask = msk),
|
2863 |
+
$.isFunction(opts.mask) && (opts.mask = opts.mask.call(this, opts)), $.isArray(opts.mask);
|
2864 |
+
|
2865 |
+
default:
|
2866 |
+
return resolveAlias(opts.alias, options, opts), resolveAlias(fn, options, opts) || (opts.mask = fn),
|
2867 |
+
maskset = generateMaskSet(opts, targetScope !== maskScope), void 0 == maskset ? this : this.each(function() {
|
2868 |
+
targetScope({
|
2869 |
+
action: "mask",
|
2870 |
+
el: this
|
2871 |
+
}, $.extend(!0, {}, maskset), importAttributeOptions(this, opts));
|
2872 |
+
});
|
2873 |
+
} else {
|
2874 |
+
if ("object" == typeof fn) return opts = $.extend(!0, {}, $.inputmask.defaults, fn),
|
2875 |
+
resolveAlias(opts.alias, fn, opts), maskset = generateMaskSet(opts, targetScope !== maskScope),
|
2876 |
+
void 0 == maskset ? this : this.each(function() {
|
2877 |
+
targetScope({
|
2878 |
+
action: "mask",
|
2879 |
+
el: this
|
2880 |
+
}, $.extend(!0, {}, maskset), importAttributeOptions(this, opts));
|
2881 |
+
});
|
2882 |
+
if (void 0 == fn) return this.each(function() {
|
2883 |
+
var attrOptions = $(this).attr("data-inputmask");
|
2884 |
+
if (attrOptions && "" != attrOptions) try {
|
2885 |
+
attrOptions = attrOptions.replace(new RegExp("'", "g"), '"');
|
2886 |
+
var dataoptions = $.parseJSON("{" + attrOptions + "}");
|
2887 |
+
$.extend(!0, dataoptions, options), opts = $.extend(!0, {}, $.inputmask.defaults, dataoptions),
|
2888 |
+
opts = importAttributeOptions(this, opts), resolveAlias(opts.alias, dataoptions, opts),
|
2889 |
+
opts.alias = void 0, $(this).inputmask("mask", opts, targetScope);
|
2890 |
+
} catch (ex) {}
|
2891 |
+
if ($(this).attr("data-inputmask-mask") || $(this).attr("data-inputmask-alias")) {
|
2892 |
+
opts = $.extend(!0, {}, $.inputmask.defaults, {});
|
2893 |
+
var dataOptions = {};
|
2894 |
+
opts = importAttributeOptions(this, opts, dataOptions), resolveAlias(opts.alias, dataOptions, opts),
|
2895 |
+
opts.alias = void 0, $(this).inputmask("mask", opts, targetScope);
|
2896 |
+
}
|
2897 |
+
});
|
2898 |
+
}
|
2899 |
+
};
|
2900 |
+
}
|
2901 |
+
return $.fn.inputmask;
|
2902 |
+
}(jQuery), function($) {
|
2903 |
+
return $.extend($.inputmask.defaults.definitions, {
|
2904 |
+
h: {
|
2905 |
+
validator: "[01][0-9]|2[0-3]",
|
2906 |
+
cardinality: 2,
|
2907 |
+
prevalidator: [ {
|
2908 |
+
validator: "[0-2]",
|
2909 |
+
cardinality: 1
|
2910 |
+
} ]
|
2911 |
+
},
|
2912 |
+
s: {
|
2913 |
+
validator: "[0-5][0-9]",
|
2914 |
+
cardinality: 2,
|
2915 |
+
prevalidator: [ {
|
2916 |
+
validator: "[0-5]",
|
2917 |
+
cardinality: 1
|
2918 |
+
} ]
|
2919 |
+
},
|
2920 |
+
d: {
|
2921 |
+
validator: "0[1-9]|[12][0-9]|3[01]",
|
2922 |
+
cardinality: 2,
|
2923 |
+
prevalidator: [ {
|
2924 |
+
validator: "[0-3]",
|
2925 |
+
cardinality: 1
|
2926 |
+
} ]
|
2927 |
+
},
|
2928 |
+
m: {
|
2929 |
+
validator: "0[1-9]|1[012]",
|
2930 |
+
cardinality: 2,
|
2931 |
+
prevalidator: [ {
|
2932 |
+
validator: "[01]",
|
2933 |
+
cardinality: 1
|
2934 |
+
} ]
|
2935 |
+
},
|
2936 |
+
y: {
|
2937 |
+
validator: "(19|20)\\d{2}",
|
2938 |
+
cardinality: 4,
|
2939 |
+
prevalidator: [ {
|
2940 |
+
validator: "[12]",
|
2941 |
+
cardinality: 1
|
2942 |
+
}, {
|
2943 |
+
validator: "(19|20)",
|
2944 |
+
cardinality: 2
|
2945 |
+
}, {
|
2946 |
+
validator: "(19|20)\\d",
|
2947 |
+
cardinality: 3
|
2948 |
+
} ]
|
2949 |
+
}
|
2950 |
+
}), $.extend($.inputmask.defaults.aliases, {
|
2951 |
+
"dd/mm/yyyy": {
|
2952 |
+
mask: "1/2/y",
|
2953 |
+
placeholder: "dd/mm/yyyy",
|
2954 |
+
regex: {
|
2955 |
+
val1pre: new RegExp("[0-3]"),
|
2956 |
+
val1: new RegExp("0[1-9]|[12][0-9]|3[01]"),
|
2957 |
+
val2pre: function(separator) {
|
2958 |
+
var escapedSeparator = $.inputmask.escapeRegex.call(this, separator);
|
2959 |
+
return new RegExp("((0[1-9]|[12][0-9]|3[01])" + escapedSeparator + "[01])");
|
2960 |
+
},
|
2961 |
+
val2: function(separator) {
|
2962 |
+
var escapedSeparator = $.inputmask.escapeRegex.call(this, separator);
|
2963 |
+
return new RegExp("((0[1-9]|[12][0-9])" + escapedSeparator + "(0[1-9]|1[012]))|(30" + escapedSeparator + "(0[13-9]|1[012]))|(31" + escapedSeparator + "(0[13578]|1[02]))");
|
2964 |
+
}
|
2965 |
+
},
|
2966 |
+
leapday: "29/02/",
|
2967 |
+
separator: "/",
|
2968 |
+
yearrange: {
|
2969 |
+
minyear: 1900,
|
2970 |
+
maxyear: 2099
|
2971 |
+
},
|
2972 |
+
isInYearRange: function(chrs, minyear, maxyear) {
|
2973 |
+
if (isNaN(chrs)) return !1;
|
2974 |
+
var enteredyear = parseInt(chrs.concat(minyear.toString().slice(chrs.length))), enteredyear2 = parseInt(chrs.concat(maxyear.toString().slice(chrs.length)));
|
2975 |
+
return (isNaN(enteredyear) ? !1 : enteredyear >= minyear && maxyear >= enteredyear) || (isNaN(enteredyear2) ? !1 : enteredyear2 >= minyear && maxyear >= enteredyear2);
|
2976 |
+
},
|
2977 |
+
determinebaseyear: function(minyear, maxyear, hint) {
|
2978 |
+
var currentyear = new Date().getFullYear();
|
2979 |
+
if (minyear > currentyear) return minyear;
|
2980 |
+
if (currentyear > maxyear) {
|
2981 |
+
for (var maxYearPrefix = maxyear.toString().slice(0, 2), maxYearPostfix = maxyear.toString().slice(2, 4); maxYearPrefix + hint > maxyear; ) maxYearPrefix--;
|
2982 |
+
var maxxYear = maxYearPrefix + maxYearPostfix;
|
2983 |
+
return minyear > maxxYear ? minyear : maxxYear;
|
2984 |
+
}
|
2985 |
+
return currentyear;
|
2986 |
+
},
|
2987 |
+
onKeyUp: function(e) {
|
2988 |
+
var $input = $(this);
|
2989 |
+
if (e.ctrlKey && e.keyCode == $.inputmask.keyCode.RIGHT) {
|
2990 |
+
var today = new Date();
|
2991 |
+
$input.val(today.getDate().toString() + (today.getMonth() + 1).toString() + today.getFullYear().toString());
|
2992 |
+
}
|
2993 |
+
},
|
2994 |
+
definitions: {
|
2995 |
+
"1": {
|
2996 |
+
validator: function(chrs, maskset, pos, strict, opts) {
|
2997 |
+
var isValid = opts.regex.val1.test(chrs);
|
2998 |
+
return strict || isValid || chrs.charAt(1) != opts.separator && -1 == "-./".indexOf(chrs.charAt(1)) || !(isValid = opts.regex.val1.test("0" + chrs.charAt(0))) ? isValid : (maskset.buffer[pos - 1] = "0",
|
2999 |
+
{
|
3000 |
+
refreshFromBuffer: {
|
3001 |
+
start: pos - 1,
|
3002 |
+
end: pos
|
3003 |
+
},
|
3004 |
+
pos: pos,
|
3005 |
+
c: chrs.charAt(0)
|
3006 |
+
});
|
3007 |
+
},
|
3008 |
+
cardinality: 2,
|
3009 |
+
prevalidator: [ {
|
3010 |
+
validator: function(chrs, maskset, pos, strict, opts) {
|
3011 |
+
isNaN(maskset.buffer[pos + 1]) || (chrs += maskset.buffer[pos + 1]);
|
3012 |
+
var isValid = 1 == chrs.length ? opts.regex.val1pre.test(chrs) : opts.regex.val1.test(chrs);
|
3013 |
+
return strict || isValid || !(isValid = opts.regex.val1.test("0" + chrs)) ? isValid : (maskset.buffer[pos] = "0",
|
3014 |
+
pos++, {
|
3015 |
+
pos: pos
|
3016 |
+
});
|
3017 |
+
},
|
3018 |
+
cardinality: 1
|
3019 |
+
} ]
|
3020 |
+
},
|
3021 |
+
"2": {
|
3022 |
+
validator: function(chrs, maskset, pos, strict, opts) {
|
3023 |
+
var frontValue = opts.mask.indexOf("2") == opts.mask.length - 1 ? maskset.buffer.join("").substr(5, 3) : maskset.buffer.join("").substr(0, 3);
|
3024 |
+
-1 != frontValue.indexOf(opts.placeholder[0]) && (frontValue = "01" + opts.separator);
|
3025 |
+
var isValid = opts.regex.val2(opts.separator).test(frontValue + chrs);
|
3026 |
+
if (!strict && !isValid && (chrs.charAt(1) == opts.separator || -1 != "-./".indexOf(chrs.charAt(1))) && (isValid = opts.regex.val2(opts.separator).test(frontValue + "0" + chrs.charAt(0)))) return maskset.buffer[pos - 1] = "0",
|
3027 |
+
{
|
3028 |
+
refreshFromBuffer: {
|
3029 |
+
start: pos - 1,
|
3030 |
+
end: pos
|
3031 |
+
},
|
3032 |
+
pos: pos,
|
3033 |
+
c: chrs.charAt(0)
|
3034 |
+
};
|
3035 |
+
if (opts.mask.indexOf("2") == opts.mask.length - 1 && isValid) {
|
3036 |
+
var dayMonthValue = maskset.buffer.join("").substr(4, 4) + chrs;
|
3037 |
+
if (dayMonthValue != opts.leapday) return !0;
|
3038 |
+
var year = parseInt(maskset.buffer.join("").substr(0, 4), 10);
|
3039 |
+
return year % 4 === 0 ? year % 100 === 0 ? year % 400 === 0 ? !0 : !1 : !0 : !1;
|
3040 |
+
}
|
3041 |
+
return isValid;
|
3042 |
+
},
|
3043 |
+
cardinality: 2,
|
3044 |
+
prevalidator: [ {
|
3045 |
+
validator: function(chrs, maskset, pos, strict, opts) {
|
3046 |
+
isNaN(maskset.buffer[pos + 1]) || (chrs += maskset.buffer[pos + 1]);
|
3047 |
+
var frontValue = opts.mask.indexOf("2") == opts.mask.length - 1 ? maskset.buffer.join("").substr(5, 3) : maskset.buffer.join("").substr(0, 3);
|
3048 |
+
-1 != frontValue.indexOf(opts.placeholder[0]) && (frontValue = "01" + opts.separator);
|
3049 |
+
var isValid = 1 == chrs.length ? opts.regex.val2pre(opts.separator).test(frontValue + chrs) : opts.regex.val2(opts.separator).test(frontValue + chrs);
|
3050 |
+
return strict || isValid || !(isValid = opts.regex.val2(opts.separator).test(frontValue + "0" + chrs)) ? isValid : (maskset.buffer[pos] = "0",
|
3051 |
+
pos++, {
|
3052 |
+
pos: pos
|
3053 |
+
});
|
3054 |
+
},
|
3055 |
+
cardinality: 1
|
3056 |
+
} ]
|
3057 |
+
},
|
3058 |
+
y: {
|
3059 |
+
validator: function(chrs, maskset, pos, strict, opts) {
|
3060 |
+
if (opts.isInYearRange(chrs, opts.yearrange.minyear, opts.yearrange.maxyear)) {
|
3061 |
+
var dayMonthValue = maskset.buffer.join("").substr(0, 6);
|
3062 |
+
if (dayMonthValue != opts.leapday) return !0;
|
3063 |
+
var year = parseInt(chrs, 10);
|
3064 |
+
return year % 4 === 0 ? year % 100 === 0 ? year % 400 === 0 ? !0 : !1 : !0 : !1;
|
3065 |
+
}
|
3066 |
+
return !1;
|
3067 |
+
},
|
3068 |
+
cardinality: 4,
|
3069 |
+
prevalidator: [ {
|
3070 |
+
validator: function(chrs, maskset, pos, strict, opts) {
|
3071 |
+
var isValid = opts.isInYearRange(chrs, opts.yearrange.minyear, opts.yearrange.maxyear);
|
3072 |
+
if (!strict && !isValid) {
|
3073 |
+
var yearPrefix = opts.determinebaseyear(opts.yearrange.minyear, opts.yearrange.maxyear, chrs + "0").toString().slice(0, 1);
|
3074 |
+
if (isValid = opts.isInYearRange(yearPrefix + chrs, opts.yearrange.minyear, opts.yearrange.maxyear)) return maskset.buffer[pos++] = yearPrefix.charAt(0),
|
3075 |
+
{
|
3076 |
+
pos: pos
|
3077 |
+
};
|
3078 |
+
if (yearPrefix = opts.determinebaseyear(opts.yearrange.minyear, opts.yearrange.maxyear, chrs + "0").toString().slice(0, 2),
|
3079 |
+
isValid = opts.isInYearRange(yearPrefix + chrs, opts.yearrange.minyear, opts.yearrange.maxyear)) return maskset.buffer[pos++] = yearPrefix.charAt(0),
|
3080 |
+
maskset.buffer[pos++] = yearPrefix.charAt(1), {
|
3081 |
+
pos: pos
|
3082 |
+
};
|
3083 |
+
}
|
3084 |
+
return isValid;
|
3085 |
+
},
|
3086 |
+
cardinality: 1
|
3087 |
+
}, {
|
3088 |
+
validator: function(chrs, maskset, pos, strict, opts) {
|
3089 |
+
var isValid = opts.isInYearRange(chrs, opts.yearrange.minyear, opts.yearrange.maxyear);
|
3090 |
+
if (!strict && !isValid) {
|
3091 |
+
var yearPrefix = opts.determinebaseyear(opts.yearrange.minyear, opts.yearrange.maxyear, chrs).toString().slice(0, 2);
|
3092 |
+
if (isValid = opts.isInYearRange(chrs[0] + yearPrefix[1] + chrs[1], opts.yearrange.minyear, opts.yearrange.maxyear)) return maskset.buffer[pos++] = yearPrefix.charAt(1),
|
3093 |
+
{
|
3094 |
+
pos: pos
|
3095 |
+
};
|
3096 |
+
if (yearPrefix = opts.determinebaseyear(opts.yearrange.minyear, opts.yearrange.maxyear, chrs).toString().slice(0, 2),
|
3097 |
+
opts.isInYearRange(yearPrefix + chrs, opts.yearrange.minyear, opts.yearrange.maxyear)) {
|
3098 |
+
var dayMonthValue = maskset.buffer.join("").substr(0, 6);
|
3099 |
+
if (dayMonthValue != opts.leapday) isValid = !0; else {
|
3100 |
+
var year = parseInt(chrs, 10);
|
3101 |
+
isValid = year % 4 === 0 ? year % 100 === 0 ? year % 400 === 0 ? !0 : !1 : !0 : !1;
|
3102 |
+
}
|
3103 |
+
} else isValid = !1;
|
3104 |
+
if (isValid) return maskset.buffer[pos - 1] = yearPrefix.charAt(0), maskset.buffer[pos++] = yearPrefix.charAt(1),
|
3105 |
+
maskset.buffer[pos++] = chrs.charAt(0), {
|
3106 |
+
refreshFromBuffer: {
|
3107 |
+
start: pos - 3,
|
3108 |
+
end: pos
|
3109 |
+
},
|
3110 |
+
pos: pos
|
3111 |
+
};
|
3112 |
+
}
|
3113 |
+
return isValid;
|
3114 |
+
},
|
3115 |
+
cardinality: 2
|
3116 |
+
}, {
|
3117 |
+
validator: function(chrs, maskset, pos, strict, opts) {
|
3118 |
+
return opts.isInYearRange(chrs, opts.yearrange.minyear, opts.yearrange.maxyear);
|
3119 |
+
},
|
3120 |
+
cardinality: 3
|
3121 |
+
} ]
|
3122 |
+
}
|
3123 |
+
},
|
3124 |
+
insertMode: !1,
|
3125 |
+
autoUnmask: !1
|
3126 |
+
},
|
3127 |
+
"mm/dd/yyyy": {
|
3128 |
+
placeholder: "mm/dd/yyyy",
|
3129 |
+
alias: "dd/mm/yyyy",
|
3130 |
+
regex: {
|
3131 |
+
val2pre: function(separator) {
|
3132 |
+
var escapedSeparator = $.inputmask.escapeRegex.call(this, separator);
|
3133 |
+
return new RegExp("((0[13-9]|1[012])" + escapedSeparator + "[0-3])|(02" + escapedSeparator + "[0-2])");
|
3134 |
+
},
|
3135 |
+
val2: function(separator) {
|
3136 |
+
var escapedSeparator = $.inputmask.escapeRegex.call(this, separator);
|
3137 |
+
return new RegExp("((0[1-9]|1[012])" + escapedSeparator + "(0[1-9]|[12][0-9]))|((0[13-9]|1[012])" + escapedSeparator + "30)|((0[13578]|1[02])" + escapedSeparator + "31)");
|
3138 |
+
},
|
3139 |
+
val1pre: new RegExp("[01]"),
|
3140 |
+
val1: new RegExp("0[1-9]|1[012]")
|
3141 |
+
},
|
3142 |
+
leapday: "02/29/",
|
3143 |
+
onKeyUp: function(e) {
|
3144 |
+
var $input = $(this);
|
3145 |
+
if (e.ctrlKey && e.keyCode == $.inputmask.keyCode.RIGHT) {
|
3146 |
+
var today = new Date();
|
3147 |
+
$input.val((today.getMonth() + 1).toString() + today.getDate().toString() + today.getFullYear().toString());
|
3148 |
+
}
|
3149 |
+
}
|
3150 |
+
},
|
3151 |
+
"yyyy/mm/dd": {
|
3152 |
+
mask: "y/1/2",
|
3153 |
+
placeholder: "yyyy/mm/dd",
|
3154 |
+
alias: "mm/dd/yyyy",
|
3155 |
+
leapday: "/02/29",
|
3156 |
+
onKeyUp: function(e) {
|
3157 |
+
var $input = $(this);
|
3158 |
+
if (e.ctrlKey && e.keyCode == $.inputmask.keyCode.RIGHT) {
|
3159 |
+
var today = new Date();
|
3160 |
+
$input.val(today.getFullYear().toString() + (today.getMonth() + 1).toString() + today.getDate().toString());
|
3161 |
+
}
|
3162 |
+
}
|
3163 |
+
},
|
3164 |
+
"dd.mm.yyyy": {
|
3165 |
+
mask: "1.2.y",
|
3166 |
+
placeholder: "dd.mm.yyyy",
|
3167 |
+
leapday: "29.02.",
|
3168 |
+
separator: ".",
|
3169 |
+
alias: "dd/mm/yyyy"
|
3170 |
+
},
|
3171 |
+
"dd-mm-yyyy": {
|
3172 |
+
mask: "1-2-y",
|
3173 |
+
placeholder: "dd-mm-yyyy",
|
3174 |
+
leapday: "29-02-",
|
3175 |
+
separator: "-",
|
3176 |
+
alias: "dd/mm/yyyy"
|
3177 |
+
},
|
3178 |
+
"mm.dd.yyyy": {
|
3179 |
+
mask: "1.2.y",
|
3180 |
+
placeholder: "mm.dd.yyyy",
|
3181 |
+
leapday: "02.29.",
|
3182 |
+
separator: ".",
|
3183 |
+
alias: "mm/dd/yyyy"
|
3184 |
+
},
|
3185 |
+
"mm-dd-yyyy": {
|
3186 |
+
mask: "1-2-y",
|
3187 |
+
placeholder: "mm-dd-yyyy",
|
3188 |
+
leapday: "02-29-",
|
3189 |
+
separator: "-",
|
3190 |
+
alias: "mm/dd/yyyy"
|
3191 |
+
},
|
3192 |
+
"yyyy.mm.dd": {
|
3193 |
+
mask: "y.1.2",
|
3194 |
+
placeholder: "yyyy.mm.dd",
|
3195 |
+
leapday: ".02.29",
|
3196 |
+
separator: ".",
|
3197 |
+
alias: "yyyy/mm/dd"
|
3198 |
+
},
|
3199 |
+
"yyyy-mm-dd": {
|
3200 |
+
mask: "y-1-2",
|
3201 |
+
placeholder: "yyyy-mm-dd",
|
3202 |
+
leapday: "-02-29",
|
3203 |
+
separator: "-",
|
3204 |
+
alias: "yyyy/mm/dd"
|
3205 |
+
},
|
3206 |
+
datetime: {
|
3207 |
+
mask: "1/2/y h:s",
|
3208 |
+
placeholder: "dd/mm/yyyy hh:mm",
|
3209 |
+
alias: "dd/mm/yyyy",
|
3210 |
+
regex: {
|
3211 |
+
hrspre: new RegExp("[012]"),
|
3212 |
+
hrs24: new RegExp("2[0-4]|1[3-9]"),
|
3213 |
+
hrs: new RegExp("[01][0-9]|2[0-4]"),
|
3214 |
+
ampm: new RegExp("^[a|p|A|P][m|M]"),
|
3215 |
+
mspre: new RegExp("[0-5]"),
|
3216 |
+
ms: new RegExp("[0-5][0-9]")
|
3217 |
+
},
|
3218 |
+
timeseparator: ":",
|
3219 |
+
hourFormat: "24",
|
3220 |
+
definitions: {
|
3221 |
+
h: {
|
3222 |
+
validator: function(chrs, maskset, pos, strict, opts) {
|
3223 |
+
if ("24" == opts.hourFormat && 24 == parseInt(chrs, 10)) return maskset.buffer[pos - 1] = "0",
|
3224 |
+
maskset.buffer[pos] = "0", {
|
3225 |
+
refreshFromBuffer: {
|
3226 |
+
start: pos - 1,
|
3227 |
+
end: pos
|
3228 |
+
},
|
3229 |
+
c: "0"
|
3230 |
+
};
|
3231 |
+
var isValid = opts.regex.hrs.test(chrs);
|
3232 |
+
if (!strict && !isValid && (chrs.charAt(1) == opts.timeseparator || -1 != "-.:".indexOf(chrs.charAt(1))) && (isValid = opts.regex.hrs.test("0" + chrs.charAt(0)))) return maskset.buffer[pos - 1] = "0",
|
3233 |
+
maskset.buffer[pos] = chrs.charAt(0), pos++, {
|
3234 |
+
refreshFromBuffer: {
|
3235 |
+
start: pos - 2,
|
3236 |
+
end: pos
|
3237 |
+
},
|
3238 |
+
pos: pos,
|
3239 |
+
c: opts.timeseparator
|
3240 |
+
};
|
3241 |
+
if (isValid && "24" !== opts.hourFormat && opts.regex.hrs24.test(chrs)) {
|
3242 |
+
var tmp = parseInt(chrs, 10);
|
3243 |
+
return 24 == tmp ? (maskset.buffer[pos + 5] = "a", maskset.buffer[pos + 6] = "m") : (maskset.buffer[pos + 5] = "p",
|
3244 |
+
maskset.buffer[pos + 6] = "m"), tmp -= 12, 10 > tmp ? (maskset.buffer[pos] = tmp.toString(),
|
3245 |
+
maskset.buffer[pos - 1] = "0") : (maskset.buffer[pos] = tmp.toString().charAt(1),
|
3246 |
+
maskset.buffer[pos - 1] = tmp.toString().charAt(0)), {
|
3247 |
+
refreshFromBuffer: {
|
3248 |
+
start: pos - 1,
|
3249 |
+
end: pos + 6
|
3250 |
+
},
|
3251 |
+
c: maskset.buffer[pos]
|
3252 |
+
};
|
3253 |
+
}
|
3254 |
+
return isValid;
|
3255 |
+
},
|
3256 |
+
cardinality: 2,
|
3257 |
+
prevalidator: [ {
|
3258 |
+
validator: function(chrs, maskset, pos, strict, opts) {
|
3259 |
+
var isValid = opts.regex.hrspre.test(chrs);
|
3260 |
+
return strict || isValid || !(isValid = opts.regex.hrs.test("0" + chrs)) ? isValid : (maskset.buffer[pos] = "0",
|
3261 |
+
pos++, {
|
3262 |
+
pos: pos
|
3263 |
+
});
|
3264 |
+
},
|
3265 |
+
cardinality: 1
|
3266 |
+
} ]
|
3267 |
+
},
|
3268 |
+
s: {
|
3269 |
+
validator: "[0-5][0-9]",
|
3270 |
+
cardinality: 2,
|
3271 |
+
prevalidator: [ {
|
3272 |
+
validator: function(chrs, maskset, pos, strict, opts) {
|
3273 |
+
var isValid = opts.regex.mspre.test(chrs);
|
3274 |
+
return strict || isValid || !(isValid = opts.regex.ms.test("0" + chrs)) ? isValid : (maskset.buffer[pos] = "0",
|
3275 |
+
pos++, {
|
3276 |
+
pos: pos
|
3277 |
+
});
|
3278 |
+
},
|
3279 |
+
cardinality: 1
|
3280 |
+
} ]
|
3281 |
+
},
|
3282 |
+
t: {
|
3283 |
+
validator: function(chrs, maskset, pos, strict, opts) {
|
3284 |
+
return opts.regex.ampm.test(chrs + "m");
|
3285 |
+
},
|
3286 |
+
casing: "lower",
|
3287 |
+
cardinality: 1
|
3288 |
+
}
|
3289 |
+
},
|
3290 |
+
insertMode: !1,
|
3291 |
+
autoUnmask: !1
|
3292 |
+
},
|
3293 |
+
datetime12: {
|
3294 |
+
mask: "1/2/y h:s t\\m",
|
3295 |
+
placeholder: "dd/mm/yyyy hh:mm xm",
|
3296 |
+
alias: "datetime",
|
3297 |
+
hourFormat: "12"
|
3298 |
+
},
|
3299 |
+
"hh:mm t": {
|
3300 |
+
mask: "h:s t\\m",
|
3301 |
+
placeholder: "hh:mm xm",
|
3302 |
+
alias: "datetime",
|
3303 |
+
hourFormat: "12"
|
3304 |
+
},
|
3305 |
+
"h:s t": {
|
3306 |
+
mask: "h:s t\\m",
|
3307 |
+
placeholder: "hh:mm xm",
|
3308 |
+
alias: "datetime",
|
3309 |
+
hourFormat: "12"
|
3310 |
+
},
|
3311 |
+
"hh:mm:ss": {
|
3312 |
+
mask: "h:s:s",
|
3313 |
+
placeholder: "hh:mm:ss",
|
3314 |
+
alias: "datetime",
|
3315 |
+
autoUnmask: !1
|
3316 |
+
},
|
3317 |
+
"hh:mm": {
|
3318 |
+
mask: "h:s",
|
3319 |
+
placeholder: "hh:mm",
|
3320 |
+
alias: "datetime",
|
3321 |
+
autoUnmask: !1
|
3322 |
+
},
|
3323 |
+
date: {
|
3324 |
+
alias: "dd/mm/yyyy"
|
3325 |
+
},
|
3326 |
+
"mm/yyyy": {
|
3327 |
+
mask: "1/y",
|
3328 |
+
placeholder: "mm/yyyy",
|
3329 |
+
leapday: "donotuse",
|
3330 |
+
separator: "/",
|
3331 |
+
alias: "mm/dd/yyyy"
|
3332 |
+
}
|
3333 |
+
}), $.fn.inputmask;
|
3334 |
+
}(jQuery), function($) {
|
3335 |
+
return $.extend($.inputmask.defaults.definitions, {
|
3336 |
+
A: {
|
3337 |
+
validator: "[A-Za-zА-яЁёÀ-ÿµ]",
|
3338 |
+
cardinality: 1,
|
3339 |
+
casing: "upper"
|
3340 |
+
},
|
3341 |
+
"#": {
|
3342 |
+
validator: "[0-9A-Za-zА-яЁёÀ-ÿµ]",
|
3343 |
+
cardinality: 1,
|
3344 |
+
casing: "upper"
|
3345 |
+
}
|
3346 |
+
}), $.extend($.inputmask.defaults.aliases, {
|
3347 |
+
url: {
|
3348 |
+
mask: "ir",
|
3349 |
+
placeholder: "",
|
3350 |
+
separator: "",
|
3351 |
+
defaultPrefix: "http://",
|
3352 |
+
regex: {
|
3353 |
+
urlpre1: new RegExp("[fh]"),
|
3354 |
+
urlpre2: new RegExp("(ft|ht)"),
|
3355 |
+
urlpre3: new RegExp("(ftp|htt)"),
|
3356 |
+
urlpre4: new RegExp("(ftp:|http|ftps)"),
|
3357 |
+
urlpre5: new RegExp("(ftp:/|ftps:|http:|https)"),
|
3358 |
+
urlpre6: new RegExp("(ftp://|ftps:/|http:/|https:)"),
|
3359 |
+
urlpre7: new RegExp("(ftp://|ftps://|http://|https:/)"),
|
3360 |
+
urlpre8: new RegExp("(ftp://|ftps://|http://|https://)")
|
3361 |
+
},
|
3362 |
+
definitions: {
|
3363 |
+
i: {
|
3364 |
+
validator: function() {
|
3365 |
+
return !0;
|
3366 |
+
},
|
3367 |
+
cardinality: 8,
|
3368 |
+
prevalidator: function() {
|
3369 |
+
for (var result = [], prefixLimit = 8, i = 0; prefixLimit > i; i++) result[i] = function() {
|
3370 |
+
var j = i;
|
3371 |
+
return {
|
3372 |
+
validator: function(chrs, maskset, pos, strict, opts) {
|
3373 |
+
if (opts.regex["urlpre" + (j + 1)]) {
|
3374 |
+
var k, tmp = chrs;
|
3375 |
+
j + 1 - chrs.length > 0 && (tmp = maskset.buffer.join("").substring(0, j + 1 - chrs.length) + "" + tmp);
|
3376 |
+
var isValid = opts.regex["urlpre" + (j + 1)].test(tmp);
|
3377 |
+
if (!strict && !isValid) {
|
3378 |
+
for (pos -= j, k = 0; k < opts.defaultPrefix.length; k++) maskset.buffer[pos] = opts.defaultPrefix[k],
|
3379 |
+
pos++;
|
3380 |
+
for (k = 0; k < tmp.length - 1; k++) maskset.buffer[pos] = tmp[k], pos++;
|
3381 |
+
return {
|
3382 |
+
pos: pos
|
3383 |
+
};
|
3384 |
+
}
|
3385 |
+
return isValid;
|
3386 |
+
}
|
3387 |
+
return !1;
|
3388 |
+
},
|
3389 |
+
cardinality: j
|
3390 |
+
};
|
3391 |
+
}();
|
3392 |
+
return result;
|
3393 |
+
}()
|
3394 |
+
},
|
3395 |
+
r: {
|
3396 |
+
validator: ".",
|
3397 |
+
cardinality: 50
|
3398 |
+
}
|
3399 |
+
},
|
3400 |
+
insertMode: !1,
|
3401 |
+
autoUnmask: !1
|
3402 |
+
},
|
3403 |
+
ip: {
|
3404 |
+
mask: "i[i[i]].i[i[i]].i[i[i]].i[i[i]]",
|
3405 |
+
definitions: {
|
3406 |
+
i: {
|
3407 |
+
validator: function(chrs, maskset, pos) {
|
3408 |
+
return pos - 1 > -1 && "." != maskset.buffer[pos - 1] ? (chrs = maskset.buffer[pos - 1] + chrs,
|
3409 |
+
chrs = pos - 2 > -1 && "." != maskset.buffer[pos - 2] ? maskset.buffer[pos - 2] + chrs : "0" + chrs) : chrs = "00" + chrs,
|
3410 |
+
new RegExp("25[0-5]|2[0-4][0-9]|[01][0-9][0-9]").test(chrs);
|
3411 |
+
},
|
3412 |
+
cardinality: 1
|
3413 |
+
}
|
3414 |
+
}
|
3415 |
+
},
|
3416 |
+
email: {
|
3417 |
+
mask: "*{1,64}[.*{1,64}][.*{1,64}][.*{1,64}]@*{1,64}[.*{2,64}][.*{2,6}][.*{1,2}]",
|
3418 |
+
greedy: !1,
|
3419 |
+
onBeforePaste: function(pastedValue) {
|
3420 |
+
return pastedValue = pastedValue.toLowerCase(), pastedValue.replace("mailto:", "");
|
3421 |
+
},
|
3422 |
+
definitions: {
|
3423 |
+
"*": {
|
3424 |
+
validator: "[0-9A-Za-z!#$%&'*+/=?^_`{|}~-]",
|
3425 |
+
cardinality: 1,
|
3426 |
+
casing: "lower"
|
3427 |
+
}
|
3428 |
+
}
|
3429 |
+
}
|
3430 |
+
}), $.fn.inputmask;
|
3431 |
+
}(jQuery), function($) {
|
3432 |
+
return $.extend($.inputmask.defaults.aliases, {
|
3433 |
+
numeric: {
|
3434 |
+
mask: function(opts) {
|
3435 |
+
if (0 !== opts.repeat && isNaN(opts.integerDigits) && (opts.integerDigits = opts.repeat),
|
3436 |
+
opts.repeat = 0, opts.groupSeparator == opts.radixPoint && (opts.groupSeparator = "." == opts.radixPoint ? "," : "," == opts.radixPoint ? "." : ""),
|
3437 |
+
" " === opts.groupSeparator && (opts.skipOptionalPartCharacter = void 0), opts.autoGroup = opts.autoGroup && "" != opts.groupSeparator,
|
3438 |
+
opts.autoGroup && isFinite(opts.integerDigits)) {
|
3439 |
+
var seps = Math.floor(opts.integerDigits / opts.groupSize), mod = opts.integerDigits % opts.groupSize;
|
3440 |
+
opts.integerDigits += 0 == mod ? seps - 1 : seps;
|
3441 |
+
}
|
3442 |
+
opts.definitions[";"] = opts.definitions["~"];
|
3443 |
+
var mask = opts.prefix;
|
3444 |
+
return mask += "[+]", mask += "~{1," + opts.integerDigits + "}", void 0 != opts.digits && (isNaN(opts.digits) || parseInt(opts.digits) > 0) && (mask += opts.digitsOptional ? "[" + (opts.decimalProtect ? ":" : opts.radixPoint) + ";{" + opts.digits + "}]" : (opts.decimalProtect ? ":" : opts.radixPoint) + ";{" + opts.digits + "}"),
|
3445 |
+
mask += opts.suffix;
|
3446 |
+
},
|
3447 |
+
placeholder: "",
|
3448 |
+
greedy: !1,
|
3449 |
+
digits: "*",
|
3450 |
+
digitsOptional: !0,
|
3451 |
+
groupSeparator: "",
|
3452 |
+
radixPoint: ".",
|
3453 |
+
radixFocus: !0,
|
3454 |
+
groupSize: 3,
|
3455 |
+
autoGroup: !1,
|
3456 |
+
allowPlus: !0,
|
3457 |
+
allowMinus: !0,
|
3458 |
+
integerDigits: "+",
|
3459 |
+
prefix: "",
|
3460 |
+
suffix: "",
|
3461 |
+
rightAlign: !0,
|
3462 |
+
decimalProtect: !0,
|
3463 |
+
postFormat: function(buffer, pos, reformatOnly, opts) {
|
3464 |
+
var needsRefresh = !1, charAtPos = buffer[pos];
|
3465 |
+
if ("" == opts.groupSeparator || -1 != $.inArray(opts.radixPoint, buffer) && pos >= $.inArray(opts.radixPoint, buffer) || new RegExp("[-+]").test(charAtPos)) return {
|
3466 |
+
pos: pos
|
3467 |
+
};
|
3468 |
+
var cbuf = buffer.slice();
|
3469 |
+
charAtPos == opts.groupSeparator && (cbuf.splice(pos--, 1), charAtPos = cbuf[pos]),
|
3470 |
+
reformatOnly ? cbuf[pos] = "?" : cbuf.splice(pos, 0, "?");
|
3471 |
+
var bufVal = cbuf.join("");
|
3472 |
+
if (opts.autoGroup || reformatOnly && -1 != bufVal.indexOf(opts.groupSeparator)) {
|
3473 |
+
var escapedGroupSeparator = $.inputmask.escapeRegex.call(this, opts.groupSeparator);
|
3474 |
+
needsRefresh = 0 == bufVal.indexOf(opts.groupSeparator), bufVal = bufVal.replace(new RegExp(escapedGroupSeparator, "g"), "");
|
3475 |
+
var radixSplit = bufVal.split(opts.radixPoint);
|
3476 |
+
if (bufVal = radixSplit[0], bufVal != opts.prefix + "?0" && bufVal.length >= opts.groupSize + opts.prefix.length) {
|
3477 |
+
needsRefresh = !0;
|
3478 |
+
for (var reg = new RegExp("([-+]?[\\d?]+)([\\d?]{" + opts.groupSize + "})"); reg.test(bufVal); ) bufVal = bufVal.replace(reg, "$1" + opts.groupSeparator + "$2"),
|
3479 |
+
bufVal = bufVal.replace(opts.groupSeparator + opts.groupSeparator, opts.groupSeparator);
|
3480 |
+
}
|
3481 |
+
radixSplit.length > 1 && (bufVal += opts.radixPoint + radixSplit[1]);
|
3482 |
+
}
|
3483 |
+
buffer.length = bufVal.length;
|
3484 |
+
for (var i = 0, l = bufVal.length; l > i; i++) buffer[i] = bufVal.charAt(i);
|
3485 |
+
var newPos = $.inArray("?", buffer);
|
3486 |
+
return reformatOnly ? buffer[newPos] = charAtPos : buffer.splice(newPos, 1), {
|
3487 |
+
pos: newPos,
|
3488 |
+
refreshFromBuffer: needsRefresh
|
3489 |
+
};
|
3490 |
+
},
|
3491 |
+
onKeyDown: function(e, buffer, caretPos, opts) {
|
3492 |
+
if (e.keyCode == $.inputmask.keyCode.TAB && "0" != opts.placeholder.charAt(0)) {
|
3493 |
+
var radixPosition = $.inArray(opts.radixPoint, buffer);
|
3494 |
+
if (-1 != radixPosition && isFinite(opts.digits)) {
|
3495 |
+
for (var i = 1; i <= opts.digits; i++) (void 0 == buffer[radixPosition + i] || buffer[radixPosition + i] == opts.placeholder.charAt(0)) && (buffer[radixPosition + i] = "0");
|
3496 |
+
return {
|
3497 |
+
refreshFromBuffer: {
|
3498 |
+
start: ++radixPosition,
|
3499 |
+
end: radixPosition + opts.digits
|
3500 |
+
}
|
3501 |
+
};
|
3502 |
+
}
|
3503 |
+
} else if (opts.autoGroup && (e.keyCode == $.inputmask.keyCode.DELETE || e.keyCode == $.inputmask.keyCode.BACKSPACE)) {
|
3504 |
+
var rslt = opts.postFormat(buffer, caretPos - 1, !0, opts);
|
3505 |
+
return rslt.caret = rslt.pos + 1, rslt;
|
3506 |
+
}
|
3507 |
+
},
|
3508 |
+
onKeyPress: function(e, buffer, caretPos, opts) {
|
3509 |
+
if (opts.autoGroup) {
|
3510 |
+
var rslt = opts.postFormat(buffer, caretPos - 1, !0, opts);
|
3511 |
+
return rslt.caret = rslt.pos + 1, rslt;
|
3512 |
+
}
|
3513 |
+
},
|
3514 |
+
regex: {
|
3515 |
+
integerPart: function() {
|
3516 |
+
return new RegExp("[-+]?\\d+");
|
3517 |
+
},
|
3518 |
+
integerNPart: function() {
|
3519 |
+
return new RegExp("\\d+");
|
3520 |
+
}
|
3521 |
+
},
|
3522 |
+
signHandler: function(chrs, buffer, pos, strict, opts) {
|
3523 |
+
if (!strict && (opts.allowMinus && "-" === chrs || opts.allowPlus && "+" === chrs)) {
|
3524 |
+
var matchRslt = buffer.join("").match(opts.regex.integerPart(opts));
|
3525 |
+
if (matchRslt && matchRslt.length > 0 && "0" !== matchRslt[matchRslt.index]) return buffer[matchRslt.index] == ("-" === chrs ? "+" : "-") ? {
|
3526 |
+
pos: matchRslt.index,
|
3527 |
+
c: chrs,
|
3528 |
+
remove: matchRslt.index,
|
3529 |
+
caret: pos
|
3530 |
+
} : buffer[matchRslt.index] == ("-" === chrs ? "-" : "+") ? {
|
3531 |
+
remove: matchRslt.index,
|
3532 |
+
caret: pos - 1
|
3533 |
+
} : {
|
3534 |
+
pos: matchRslt.index,
|
3535 |
+
c: chrs,
|
3536 |
+
caret: pos + 1
|
3537 |
+
};
|
3538 |
+
}
|
3539 |
+
return !1;
|
3540 |
+
},
|
3541 |
+
radixHandler: function(chrs, maskset, pos, strict, opts) {
|
3542 |
+
if (!strict && chrs === opts.radixPoint) {
|
3543 |
+
var radixPos = $.inArray(opts.radixPoint, maskset.buffer), integerValue = maskset.buffer.join("").match(opts.regex.integerPart(opts));
|
3544 |
+
if (-1 != radixPos) return maskset.validPositions[radixPos - 1] ? {
|
3545 |
+
caret: radixPos + 1
|
3546 |
+
} : {
|
3547 |
+
pos: integerValue.index,
|
3548 |
+
c: integerValue[0],
|
3549 |
+
caret: radixPos + 1
|
3550 |
+
};
|
3551 |
+
}
|
3552 |
+
return !1;
|
3553 |
+
},
|
3554 |
+
leadingZeroHandler: function(chrs, maskset, pos, strict, opts) {
|
3555 |
+
var matchRslt = maskset.buffer.join("").match(opts.regex.integerNPart(opts)), radixPosition = $.inArray(opts.radixPoint, maskset.buffer);
|
3556 |
+
if (matchRslt && !strict && (-1 == radixPosition || matchRslt.index < radixPosition)) if (0 == matchRslt[0].indexOf("0") && pos >= opts.prefix.length) {
|
3557 |
+
if (-1 == radixPosition || radixPosition >= pos && void 0 == maskset.validPositions[radixPosition]) return maskset.buffer.splice(matchRslt.index, 1),
|
3558 |
+
pos = pos > matchRslt.index ? pos - 1 : matchRslt.index, {
|
3559 |
+
pos: pos,
|
3560 |
+
remove: matchRslt.index
|
3561 |
+
};
|
3562 |
+
if (pos > matchRslt.index && radixPosition >= pos) return maskset.buffer.splice(matchRslt.index, 1),
|
3563 |
+
pos = pos > matchRslt.index ? pos - 1 : matchRslt.index, {
|
3564 |
+
pos: pos,
|
3565 |
+
remove: matchRslt.index
|
3566 |
+
};
|
3567 |
+
} else if ("0" == chrs && pos <= matchRslt.index) return !1;
|
3568 |
+
return !0;
|
3569 |
+
},
|
3570 |
+
definitions: {
|
3571 |
+
"~": {
|
3572 |
+
validator: function(chrs, maskset, pos, strict, opts) {
|
3573 |
+
var isValid = opts.signHandler(chrs, maskset.buffer, pos, strict, opts);
|
3574 |
+
if (!isValid && (isValid = opts.radixHandler(chrs, maskset, pos, strict, opts),
|
3575 |
+
!isValid && (isValid = strict ? new RegExp("[0-9" + $.inputmask.escapeRegex.call(this, opts.groupSeparator) + "]").test(chrs) : new RegExp("[0-9]").test(chrs),
|
3576 |
+
isValid === !0 && (isValid = opts.leadingZeroHandler(chrs, maskset, pos, strict, opts),
|
3577 |
+
isValid === !0)))) {
|
3578 |
+
var radixPosition = $.inArray(opts.radixPoint, maskset.buffer);
|
3579 |
+
opts.digitsOptional === !1 && pos > radixPosition && !strict && (isValid = {
|
3580 |
+
pos: pos,
|
3581 |
+
remove: pos
|
3582 |
+
}), isValid = {
|
3583 |
+
pos: pos
|
3584 |
+
};
|
3585 |
+
}
|
3586 |
+
return isValid;
|
3587 |
+
},
|
3588 |
+
cardinality: 1,
|
3589 |
+
prevalidator: null
|
3590 |
+
},
|
3591 |
+
"+": {
|
3592 |
+
validator: function(chrs, maskset, pos, strict, opts) {
|
3593 |
+
var isValid = opts.signHandler(chrs, maskset.buffer, pos, strict, opts);
|
3594 |
+
return isValid || (isValid = opts.allowMinus && "-" == chrs || opts.allowPlus && "+" == chrs),
|
3595 |
+
isValid;
|
3596 |
+
},
|
3597 |
+
cardinality: 1,
|
3598 |
+
prevalidator: null,
|
3599 |
+
placeholder: ""
|
3600 |
+
},
|
3601 |
+
":": {
|
3602 |
+
validator: function(chrs, maskset, pos, strict, opts) {
|
3603 |
+
var isValid = opts.signHandler(chrs, maskset.buffer, pos, strict, opts);
|
3604 |
+
if (!isValid) {
|
3605 |
+
var radix = "[" + $.inputmask.escapeRegex.call(this, opts.radixPoint) + "]";
|
3606 |
+
isValid = new RegExp(radix).test(chrs), isValid && maskset.validPositions[pos] && maskset.validPositions[pos].match.placeholder == opts.radixPoint && (isValid = {
|
3607 |
+
pos: pos,
|
3608 |
+
remove: pos
|
3609 |
+
});
|
3610 |
+
}
|
3611 |
+
return isValid;
|
3612 |
+
},
|
3613 |
+
cardinality: 1,
|
3614 |
+
prevalidator: null,
|
3615 |
+
placeholder: function(opts) {
|
3616 |
+
return opts.radixPoint;
|
3617 |
+
}
|
3618 |
+
}
|
3619 |
+
},
|
3620 |
+
insertMode: !0,
|
3621 |
+
autoUnmask: !1,
|
3622 |
+
onUnMask: function(maskedValue, unmaskedValue, opts) {
|
3623 |
+
var processValue = maskedValue.replace(opts.prefix, "");
|
3624 |
+
return processValue = processValue.replace(opts.suffix, ""), processValue = processValue.replace(new RegExp($.inputmask.escapeRegex.call(this, opts.groupSeparator), "g"), "");
|
3625 |
+
},
|
3626 |
+
isComplete: function(buffer, opts) {
|
3627 |
+
var maskedValue = buffer.join(""), bufClone = buffer.slice();
|
3628 |
+
if (opts.postFormat(bufClone, 0, !0, opts), bufClone.join("") != maskedValue) return !1;
|
3629 |
+
var processValue = maskedValue.replace(opts.prefix, "");
|
3630 |
+
return processValue = processValue.replace(opts.suffix, ""), processValue = processValue.replace(new RegExp($.inputmask.escapeRegex.call(this, opts.groupSeparator), "g"), ""),
|
3631 |
+
processValue = processValue.replace($.inputmask.escapeRegex.call(this, opts.radixPoint), "."),
|
3632 |
+
isFinite(processValue);
|
3633 |
+
},
|
3634 |
+
onBeforeMask: function(initialValue, opts) {
|
3635 |
+
if (isFinite(initialValue)) return initialValue.toString().replace(".", opts.radixPoint);
|
3636 |
+
var kommaMatches = initialValue.match(/,/g), dotMatches = initialValue.match(/\./g);
|
3637 |
+
return dotMatches && kommaMatches ? dotMatches.length > kommaMatches.length ? (initialValue = initialValue.replace(/\./g, ""),
|
3638 |
+
initialValue = initialValue.replace(",", opts.radixPoint)) : kommaMatches.length > dotMatches.length && (initialValue = initialValue.replace(/,/g, ""),
|
3639 |
+
initialValue = initialValue.replace(".", opts.radixPoint)) : initialValue = initialValue.replace(new RegExp($.inputmask.escapeRegex.call(this, opts.groupSeparator), "g"), ""),
|
3640 |
+
initialValue;
|
3641 |
+
}
|
3642 |
+
},
|
3643 |
+
currency: {
|
3644 |
+
prefix: "$ ",
|
3645 |
+
groupSeparator: ",",
|
3646 |
+
radixPoint: ".",
|
3647 |
+
alias: "numeric",
|
3648 |
+
placeholder: "0",
|
3649 |
+
autoGroup: !0,
|
3650 |
+
digits: 2,
|
3651 |
+
digitsOptional: !1,
|
3652 |
+
clearMaskOnLostFocus: !1,
|
3653 |
+
decimalProtect: !0
|
3654 |
+
},
|
3655 |
+
decimal: {
|
3656 |
+
alias: "numeric"
|
3657 |
+
},
|
3658 |
+
integer: {
|
3659 |
+
alias: "numeric",
|
3660 |
+
digits: "0"
|
3661 |
+
}
|
3662 |
+
}), $.fn.inputmask;
|
3663 |
+
}(jQuery), function($) {
|
3664 |
+
return $.extend($.inputmask.defaults.aliases, {
|
3665 |
+
phone: {
|
3666 |
+
url: "phone-codes/phone-codes.js",
|
3667 |
+
maskInit: "+pp(pp)pppppppp",
|
3668 |
+
mask: function(opts) {
|
3669 |
+
opts.definitions = {
|
3670 |
+
p: {
|
3671 |
+
validator: function() {
|
3672 |
+
return !1;
|
3673 |
+
},
|
3674 |
+
cardinality: 1
|
3675 |
+
},
|
3676 |
+
"#": {
|
3677 |
+
validator: "[0-9]",
|
3678 |
+
cardinality: 1
|
3679 |
+
}
|
3680 |
+
};
|
3681 |
+
var maskList = [];
|
3682 |
+
return $.ajax({
|
3683 |
+
url: opts.url,
|
3684 |
+
async: !1,
|
3685 |
+
dataType: "json",
|
3686 |
+
success: function(response) {
|
3687 |
+
maskList = response;
|
3688 |
+
}
|
3689 |
+
}), maskList = maskList.sort(function(a, b) {
|
3690 |
+
return (a.mask || a) < (b.mask || b) ? -1 : 1;
|
3691 |
+
}), maskList.splice(0, 0, opts.maskInit), maskList;
|
3692 |
+
},
|
3693 |
+
nojumps: !0,
|
3694 |
+
nojumpsThreshold: 1
|
3695 |
+
},
|
3696 |
+
phonebe: {
|
3697 |
+
alias: "phone",
|
3698 |
+
url: "phone-codes/phone-be.js",
|
3699 |
+
maskInit: "+32(pp)pppppppp",
|
3700 |
+
nojumpsThreshold: 4
|
3701 |
+
}
|
3702 |
+
}), $.fn.inputmask;
|
3703 |
+
}(jQuery), function($) {
|
3704 |
+
return $.extend($.inputmask.defaults.aliases, {
|
3705 |
+
Regex: {
|
3706 |
+
mask: "r",
|
3707 |
+
greedy: !1,
|
3708 |
+
repeat: "*",
|
3709 |
+
regex: null,
|
3710 |
+
regexTokens: null,
|
3711 |
+
tokenizer: /\[\^?]?(?:[^\\\]]+|\\[\S\s]?)*]?|\\(?:0(?:[0-3][0-7]{0,2}|[4-7][0-7]?)?|[1-9][0-9]*|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}|c[A-Za-z]|[\S\s]?)|\((?:\?[:=!]?)?|(?:[?*+]|\{[0-9]+(?:,[0-9]*)?\})\??|[^.?*+^${[()|\\]+|./g,
|
3712 |
+
quantifierFilter: /[0-9]+[^,]/,
|
3713 |
+
isComplete: function(buffer, opts) {
|
3714 |
+
return new RegExp(opts.regex).test(buffer.join(""));
|
3715 |
+
},
|
3716 |
+
definitions: {
|
3717 |
+
r: {
|
3718 |
+
validator: function(chrs, maskset, pos, strict, opts) {
|
3719 |
+
function regexToken(isGroup, isQuantifier) {
|
3720 |
+
this.matches = [], this.isGroup = isGroup || !1, this.isQuantifier = isQuantifier || !1,
|
3721 |
+
this.quantifier = {
|
3722 |
+
min: 1,
|
3723 |
+
max: 1
|
3724 |
+
}, this.repeaterPart = void 0;
|
3725 |
+
}
|
3726 |
+
function analyseRegex() {
|
3727 |
+
var match, m, currentToken = new regexToken(), opengroups = [];
|
3728 |
+
for (opts.regexTokens = []; match = opts.tokenizer.exec(opts.regex); ) switch (m = match[0],
|
3729 |
+
m.charAt(0)) {
|
3730 |
+
case "(":
|
3731 |
+
opengroups.push(new regexToken(!0));
|
3732 |
+
break;
|
3733 |
+
|
3734 |
+
case ")":
|
3735 |
+
var groupToken = opengroups.pop();
|
3736 |
+
opengroups.length > 0 ? opengroups[opengroups.length - 1].matches.push(groupToken) : currentToken.matches.push(groupToken);
|
3737 |
+
break;
|
3738 |
+
|
3739 |
+
case "{":
|
3740 |
+
case "+":
|
3741 |
+
case "*":
|
3742 |
+
var quantifierToken = new regexToken(!1, !0);
|
3743 |
+
m = m.replace(/[{}]/g, "");
|
3744 |
+
var mq = m.split(","), mq0 = isNaN(mq[0]) ? mq[0] : parseInt(mq[0]), mq1 = 1 == mq.length ? mq0 : isNaN(mq[1]) ? mq[1] : parseInt(mq[1]);
|
3745 |
+
if (quantifierToken.quantifier = {
|
3746 |
+
min: mq0,
|
3747 |
+
max: mq1
|
3748 |
+
}, opengroups.length > 0) {
|
3749 |
+
var matches = opengroups[opengroups.length - 1].matches;
|
3750 |
+
if (match = matches.pop(), !match.isGroup) {
|
3751 |
+
var groupToken = new regexToken(!0);
|
3752 |
+
groupToken.matches.push(match), match = groupToken;
|
3753 |
+
}
|
3754 |
+
matches.push(match), matches.push(quantifierToken);
|
3755 |
+
} else {
|
3756 |
+
if (match = currentToken.matches.pop(), !match.isGroup) {
|
3757 |
+
var groupToken = new regexToken(!0);
|
3758 |
+
groupToken.matches.push(match), match = groupToken;
|
3759 |
+
}
|
3760 |
+
currentToken.matches.push(match), currentToken.matches.push(quantifierToken);
|
3761 |
+
}
|
3762 |
+
break;
|
3763 |
+
|
3764 |
+
default:
|
3765 |
+
opengroups.length > 0 ? opengroups[opengroups.length - 1].matches.push(m) : currentToken.matches.push(m);
|
3766 |
+
}
|
3767 |
+
currentToken.matches.length > 0 && opts.regexTokens.push(currentToken);
|
3768 |
+
}
|
3769 |
+
function validateRegexToken(token, fromGroup) {
|
3770 |
+
var isvalid = !1;
|
3771 |
+
fromGroup && (regexPart += "(", openGroupCount++);
|
3772 |
+
for (var mndx = 0; mndx < token.matches.length; mndx++) {
|
3773 |
+
var matchToken = token.matches[mndx];
|
3774 |
+
if (1 == matchToken.isGroup) isvalid = validateRegexToken(matchToken, !0); else if (1 == matchToken.isQuantifier) {
|
3775 |
+
var crrntndx = $.inArray(matchToken, token.matches), matchGroup = token.matches[crrntndx - 1], regexPartBak = regexPart;
|
3776 |
+
if (isNaN(matchToken.quantifier.max)) {
|
3777 |
+
for (;matchToken.repeaterPart && matchToken.repeaterPart != regexPart && matchToken.repeaterPart.length > regexPart.length && !(isvalid = validateRegexToken(matchGroup, !0)); ) ;
|
3778 |
+
isvalid = isvalid || validateRegexToken(matchGroup, !0), isvalid && (matchToken.repeaterPart = regexPart),
|
3779 |
+
regexPart = regexPartBak + matchToken.quantifier.max;
|
3780 |
+
} else {
|
3781 |
+
for (var i = 0, qm = matchToken.quantifier.max - 1; qm > i && !(isvalid = validateRegexToken(matchGroup, !0)); i++) ;
|
3782 |
+
regexPart = regexPartBak + "{" + matchToken.quantifier.min + "," + matchToken.quantifier.max + "}";
|
3783 |
+
}
|
3784 |
+
} else if (void 0 != matchToken.matches) for (var k = 0; k < matchToken.length && !(isvalid = validateRegexToken(matchToken[k], fromGroup)); k++) ; else {
|
3785 |
+
var testExp;
|
3786 |
+
if ("[" == matchToken.charAt(0)) {
|
3787 |
+
testExp = regexPart, testExp += matchToken;
|
3788 |
+
for (var j = 0; openGroupCount > j; j++) testExp += ")";
|
3789 |
+
var exp = new RegExp("^(" + testExp + ")$");
|
3790 |
+
isvalid = exp.test(bufferStr);
|
3791 |
+
} else for (var l = 0, tl = matchToken.length; tl > l; l++) if ("\\" != matchToken.charAt(l)) {
|
3792 |
+
testExp = regexPart, testExp += matchToken.substr(0, l + 1), testExp = testExp.replace(/\|$/, "");
|
3793 |
+
for (var j = 0; openGroupCount > j; j++) testExp += ")";
|
3794 |
+
var exp = new RegExp("^(" + testExp + ")$");
|
3795 |
+
if (isvalid = exp.test(bufferStr)) break;
|
3796 |
+
}
|
3797 |
+
regexPart += matchToken;
|
3798 |
+
}
|
3799 |
+
if (isvalid) break;
|
3800 |
+
}
|
3801 |
+
return fromGroup && (regexPart += ")", openGroupCount--), isvalid;
|
3802 |
+
}
|
3803 |
+
null == opts.regexTokens && analyseRegex();
|
3804 |
+
var cbuffer = maskset.buffer.slice(), regexPart = "", isValid = !1, openGroupCount = 0;
|
3805 |
+
cbuffer.splice(pos, 0, chrs);
|
3806 |
+
for (var bufferStr = cbuffer.join(""), i = 0; i < opts.regexTokens.length; i++) {
|
3807 |
+
var regexToken = opts.regexTokens[i];
|
3808 |
+
if (isValid = validateRegexToken(regexToken, regexToken.isGroup)) break;
|
3809 |
+
}
|
3810 |
+
return isValid;
|
3811 |
+
},
|
3812 |
+
cardinality: 1
|
3813 |
+
}
|
3814 |
+
}
|
3815 |
+
}
|
3816 |
+
}), $.fn.inputmask;
|
3817 |
+
}(jQuery);
|
3818 |
+
|
3819 |
+
jQuery(document).ready(function($){
|
3820 |
+
jQuery(document).on('cf.add', function(){
|
3821 |
+
$("[data-inputmask]").inputmask();
|
3822 |
+
});
|
3823 |
+
jQuery(document).trigger('cf.add');
|
3824 |
+
});
|
3825 |
+
|
3826 |
+
|
3827 |
+
/*! rangeslider.js - v0.3.1 | (c) 2014 @andreruffert | MIT license | https://github.com/andreruffert/rangeslider.js */
|
3828 |
+
'use strict';
|
3829 |
+
|
3830 |
+
(function(factory) {
|
3831 |
+
if (typeof define === 'function' && define.amd) {
|
3832 |
+
// AMD. Register as an anonymous module.
|
3833 |
+
define(['jquery'], factory);
|
3834 |
+
}
|
3835 |
+
else if (typeof exports === 'object') {
|
3836 |
+
// CommonJS
|
3837 |
+
factory(require('jquery'));
|
3838 |
+
} else {
|
3839 |
+
// Browser globals
|
3840 |
+
factory(jQuery);
|
3841 |
+
}
|
3842 |
+
}(function($) {
|
3843 |
+
|
3844 |
+
/**
|
3845 |
+
* Range feature detection
|
3846 |
+
* @return {Boolean}
|
3847 |
+
*/
|
3848 |
+
function supportsRange() {
|
3849 |
+
var input = document.createElement('input');
|
3850 |
+
input.setAttribute('type', 'range');
|
3851 |
+
return input.type !== 'text';
|
3852 |
+
}
|
3853 |
+
|
3854 |
+
var pluginName = 'rangeslider',
|
3855 |
+
pluginInstances = [],
|
3856 |
+
inputrange = supportsRange(),
|
3857 |
+
defaults = {
|
3858 |
+
polyfill: true,
|
3859 |
+
rangeClass: 'rangeslider',
|
3860 |
+
disabledClass: 'rangeslider--disabled',
|
3861 |
+
fillClass: 'rangeslider__fill',
|
3862 |
+
handleClass: 'rangeslider__handle',
|
3863 |
+
startEvent: ['mousedown', 'touchstart', 'pointerdown'],
|
3864 |
+
moveEvent: ['mousemove', 'touchmove', 'pointermove'],
|
3865 |
+
endEvent: ['mouseup', 'touchend', 'pointerup']
|
3866 |
+
};
|
3867 |
+
|
3868 |
+
/**
|
3869 |
+
* Delays a function for the given number of milliseconds, and then calls
|
3870 |
+
* it with the arguments supplied.
|
3871 |
+
*
|
3872 |
+
* @param {Function} fn [description]
|
3873 |
+
* @param {Number} wait [description]
|
3874 |
+
* @return {Function}
|
3875 |
+
*/
|
3876 |
+
function delay(fn, wait) {
|
3877 |
+
var args = Array.prototype.slice.call(arguments, 2);
|
3878 |
+
return setTimeout(function(){ return fn.apply(null, args); }, wait);
|
3879 |
+
}
|
3880 |
+
|
3881 |
+
/**
|
3882 |
+
* Returns a debounced function that will make sure the given
|
3883 |
+
* function is not triggered too much.
|
3884 |
+
*
|
3885 |
+
* @param {Function} fn Function to debounce.
|
3886 |
+
* @param {Number} debounceDuration OPTIONAL. The amount of time in milliseconds for which we will debounce the function. (defaults to 100ms)
|
3887 |
+
* @return {Function}
|
3888 |
+
*/
|
3889 |
+
function debounce(fn, debounceDuration) {
|
3890 |
+
debounceDuration = debounceDuration || 100;
|
3891 |
+
return function() {
|
3892 |
+
if (!fn.debouncing) {
|
3893 |
+
var args = Array.prototype.slice.apply(arguments);
|
3894 |
+
fn.lastReturnVal = fn.apply(window, args);
|
3895 |
+
fn.debouncing = true;
|
3896 |
+
}
|
3897 |
+
clearTimeout(fn.debounceTimeout);
|
3898 |
+
fn.debounceTimeout = setTimeout(function(){
|
3899 |
+
fn.debouncing = false;
|
3900 |
+
}, debounceDuration);
|
3901 |
+
return fn.lastReturnVal;
|
3902 |
+
};
|
3903 |
+
}
|
3904 |
+
|
3905 |
+
/**
|
3906 |
+
* Plugin
|
3907 |
+
* @param {String} element
|
3908 |
+
* @param {Object} options
|
3909 |
+
*/
|
3910 |
+
function Plugin(element, options) {
|
3911 |
+
this.$window = $(window);
|
3912 |
+
this.$document = $(document);
|
3913 |
+
this.$element = $(element);
|
3914 |
+
this.options = $.extend( {}, defaults, options );
|
3915 |
+
this._defaults = defaults;
|
3916 |
+
this._name = pluginName;
|
3917 |
+
this.startEvent = this.options.startEvent.join('.' + pluginName + ' ') + '.' + pluginName;
|
3918 |
+
this.moveEvent = this.options.moveEvent.join('.' + pluginName + ' ') + '.' + pluginName;
|
3919 |
+
this.endEvent = this.options.endEvent.join('.' + pluginName + ' ') + '.' + pluginName;
|
3920 |
+
this.polyfill = this.options.polyfill;
|
3921 |
+
this.onInit = this.options.onInit;
|
3922 |
+
this.onSlide = this.options.onSlide;
|
3923 |
+
this.onSlideEnd = this.options.onSlideEnd;
|
3924 |
+
|
3925 |
+
// Plugin should only be used as a polyfill
|
3926 |
+
if (this.polyfill) {
|
3927 |
+
// Input range support?
|
3928 |
+
if (inputrange) { return false; }
|
3929 |
+
}
|
3930 |
+
|
3931 |
+
this.identifier = 'js-' + pluginName + '-' +(+new Date());
|
3932 |
+
this.min = parseFloat(this.$element[0].getAttribute('min') || 0);
|
3933 |
+
this.max = parseFloat(this.$element[0].getAttribute('max') || 100);
|
3934 |
+
this.value = parseFloat(this.$element[0].value || this.min + (this.max-this.min)/2);
|
3935 |
+
this.step = parseFloat(this.$element[0].getAttribute('step') || 1);
|
3936 |
+
this.$fill = $('<div class="' + this.options.fillClass + '" />');
|
3937 |
+
this.$handle = $('<div class="' + this.options.handleClass + '" />');
|
3938 |
+
this.$range = $('<div class="' + this.options.rangeClass + '" id="' + this.identifier + '" />').insertAfter(this.$element).prepend(this.$fill, this.$handle);
|
3939 |
+
|
3940 |
+
// visually hide the input
|
3941 |
+
this.$element.css({
|
3942 |
+
'position': 'absolute',
|
3943 |
+
'width': '1px',
|
3944 |
+
'height': '1px',
|
3945 |
+
'overflow': 'hidden',
|
3946 |
+
'opacity': '0'
|
3947 |
+
});
|
3948 |
+
|
3949 |
+
// Store context
|
3950 |
+
this.handleDown = $.proxy(this.handleDown, this);
|
3951 |
+
this.handleMove = $.proxy(this.handleMove, this);
|
3952 |
+
this.handleEnd = $.proxy(this.handleEnd, this);
|
3953 |
+
|
3954 |
+
this.init();
|
3955 |
+
|
3956 |
+
// Attach Events
|
3957 |
+
var _this = this;
|
3958 |
+
this.$window.on('resize' + '.' + pluginName, debounce(function() {
|
3959 |
+
// Simulate resizeEnd event.
|
3960 |
+
delay(function() { _this.update(); }, 300);
|
3961 |
+
}, 20));
|
3962 |
+
|
3963 |
+
this.$document.on(this.startEvent, '#' + this.identifier + ':not(.' + this.options.disabledClass + ')', this.handleDown);
|
3964 |
+
|
3965 |
+
// Listen to programmatic value changes
|
3966 |
+
this.$element.on('change' + '.' + pluginName, function(e, data) {
|
3967 |
+
if (data && data.origin === pluginName) {
|
3968 |
+
return;
|
3969 |
+
}
|
3970 |
+
|
3971 |
+
var value = e.target.value,
|
3972 |
+
pos = _this.getPositionFromValue(value);
|
3973 |
+
_this.setPosition(pos);
|
3974 |
+
});
|
3975 |
+
}
|
3976 |
+
|
3977 |
+
Plugin.prototype.init = function() {
|
3978 |
+
if (this.onInit && typeof this.onInit === 'function') {
|
3979 |
+
this.onInit();
|
3980 |
+
}
|
3981 |
+
this.update();
|
3982 |
+
};
|
3983 |
+
|
3984 |
+
Plugin.prototype.update = function() {
|
3985 |
+
this.handleWidth = this.$handle[0].offsetWidth;
|
3986 |
+
this.rangeWidth = this.$range[0].offsetWidth;
|
3987 |
+
this.maxHandleX = this.rangeWidth - this.handleWidth;
|
3988 |
+
this.grabX = this.handleWidth / 2;
|
3989 |
+
this.position = this.getPositionFromValue(this.value);
|
3990 |
+
|
3991 |
+
// Consider disabled state
|
3992 |
+
if (this.$element[0].disabled) {
|
3993 |
+
this.$range.addClass(this.options.disabledClass);
|
3994 |
+
} else {
|
3995 |
+
this.$range.removeClass(this.options.disabledClass);
|
3996 |
+
}
|
3997 |
+
|
3998 |
+
this.setPosition(this.position);
|
3999 |
+
};
|
4000 |
+
|
4001 |
+
Plugin.prototype.handleDown = function(e) {
|
4002 |
+
e.preventDefault();
|
4003 |
+
this.$document.on(this.moveEvent, this.handleMove);
|
4004 |
+
this.$document.on(this.endEvent, this.handleEnd);
|
4005 |
+
|
4006 |
+
// If we click on the handle don't set the new position
|
4007 |
+
if ((' ' + e.target.className + ' ').replace(/[\n\t]/g, ' ').indexOf(this.options.handleClass) > -1) {
|
4008 |
+
return;
|
4009 |
+
}
|
4010 |
+
|
4011 |
+
var posX = this.getRelativePosition(this.$range[0], e),
|
4012 |
+
handleX = this.getPositionFromNode(this.$handle[0]) - this.getPositionFromNode(this.$range[0]);
|
4013 |
+
|
4014 |
+
this.setPosition(posX - this.grabX);
|
4015 |
+
|
4016 |
+
if (posX >= handleX && posX < handleX + this.handleWidth) {
|
4017 |
+
this.grabX = posX - handleX;
|
4018 |
+
}
|
4019 |
+
};
|
4020 |
+
|
4021 |
+
Plugin.prototype.handleMove = function(e) {
|
4022 |
+
e.preventDefault();
|
4023 |
+
var posX = this.getRelativePosition(this.$range[0], e);
|
4024 |
+
this.setPosition(posX - this.grabX);
|
4025 |
+
};
|
4026 |
+
|
4027 |
+
Plugin.prototype.handleEnd = function(e) {
|
4028 |
+
e.preventDefault();
|
4029 |
+
this.$document.off(this.moveEvent, this.handleMove);
|
4030 |
+
this.$document.off(this.endEvent, this.handleEnd);
|
4031 |
+
|
4032 |
+
var posX = this.getRelativePosition(this.$range[0], e);
|
4033 |
+
if (this.onSlideEnd && typeof this.onSlideEnd === 'function') {
|
4034 |
+
this.onSlideEnd(posX - this.grabX, this.value);
|
4035 |
+
}
|
4036 |
+
};
|
4037 |
+
|
4038 |
+
Plugin.prototype.cap = function(pos, min, max) {
|
4039 |
+
if (pos < min) { return min; }
|
4040 |
+
if (pos > max) { return max; }
|
4041 |
+
return pos;
|
4042 |
+
};
|
4043 |
+
|
4044 |
+
Plugin.prototype.setPosition = function(pos) {
|
4045 |
+
var value, left;
|
4046 |
+
|
4047 |
+
// Snapping steps
|
4048 |
+
value = (this.getValueFromPosition(this.cap(pos, 0, this.maxHandleX)) / this.step) * this.step;
|
4049 |
+
left = this.getPositionFromValue(value);
|
4050 |
+
|
4051 |
+
// Update ui
|
4052 |
+
this.$fill[0].style.width = (left + this.grabX) + 'px';
|
4053 |
+
this.$handle[0].style.left = left + 'px';
|
4054 |
+
this.setValue(value);
|
4055 |
+
|
4056 |
+
// Update globals
|
4057 |
+
this.position = left;
|
4058 |
+
this.value = value;
|
4059 |
+
|
4060 |
+
if (this.onSlide && typeof this.onSlide === 'function') {
|
4061 |
+
this.onSlide(left, value);
|
4062 |
+
}
|
4063 |
+
};
|
4064 |
+
|
4065 |
+
Plugin.prototype.getPositionFromNode = function(node) {
|
4066 |
+
var i = 0;
|
4067 |
+
while (node !== null) {
|
4068 |
+
i += node.offsetLeft;
|
4069 |
+
node = node.offsetParent;
|
4070 |
+
}
|
4071 |
+
return i;
|
4072 |
+
};
|
4073 |
+
|
4074 |
+
Plugin.prototype.getRelativePosition = function(node, e) {
|
4075 |
+
return (e.pageX || e.originalEvent.clientX || e.originalEvent.touches[0].clientX || e.currentPoint.x) - this.getPositionFromNode(node);
|
4076 |
+
};
|
4077 |
+
|
4078 |
+
Plugin.prototype.getPositionFromValue = function(value) {
|
4079 |
+
var percentage, pos;
|
4080 |
+
percentage = (value - this.min)/(this.max - this.min);
|
4081 |
+
pos = percentage * this.maxHandleX;
|
4082 |
+
return pos;
|
4083 |
+
};
|
4084 |
+
|
4085 |
+
Plugin.prototype.getValueFromPosition = function(pos) {
|
4086 |
+
var percentage, value;
|
4087 |
+
percentage = ((pos) / (this.maxHandleX || 1));
|
4088 |
+
value = this.step * Math.ceil((((percentage) * (this.max - this.min)) + this.min) / this.step);
|
4089 |
+
return Number((value).toFixed(2));
|
4090 |
+
};
|
4091 |
+
|
4092 |
+
Plugin.prototype.setValue = function(value) {
|
4093 |
+
if (value !== this.value) {
|
4094 |
+
this.$element.val(value).trigger('change', {origin: pluginName});
|
4095 |
+
}
|
4096 |
+
};
|
4097 |
+
|
4098 |
+
Plugin.prototype.destroy = function() {
|
4099 |
+
this.$document.off(this.startEvent, '#' + this.identifier, this.handleDown);
|
4100 |
+
this.$element
|
4101 |
+
.off('.' + pluginName)
|
4102 |
+
.removeAttr('style')
|
4103 |
+
.removeData('plugin_' + pluginName);
|
4104 |
+
|
4105 |
+
// Remove the generated markup
|
4106 |
+
if (this.$range && this.$range.length) {
|
4107 |
+
this.$range[0].parentNode.removeChild(this.$range[0]);
|
4108 |
+
}
|
4109 |
+
|
4110 |
+
// Remove global events if there isn't any instance anymore.
|
4111 |
+
pluginInstances.splice(pluginInstances.indexOf(this.$element[0]),1);
|
4112 |
+
if (!pluginInstances.length) {
|
4113 |
+
this.$window.off('.' + pluginName);
|
4114 |
+
}
|
4115 |
+
};
|
4116 |
+
|
4117 |
+
// A really lightweight plugin wrapper around the constructor,
|
4118 |
+
// preventing against multiple instantiations
|
4119 |
+
$.fn[pluginName] = function(options) {
|
4120 |
+
return this.each(function() {
|
4121 |
+
var $this = $(this),
|
4122 |
+
data = $this.data('plugin_' + pluginName);
|
4123 |
+
|
4124 |
+
// Create a new instance.
|
4125 |
+
if (!data) {
|
4126 |
+
$this.data('plugin_' + pluginName, (data = new Plugin(this, options)));
|
4127 |
+
pluginInstances.push(this);
|
4128 |
+
}
|
4129 |
+
|
4130 |
+
// Make it possible to access methods from public.
|
4131 |
+
// e.g `$element.rangeslider('method');`
|
4132 |
+
if (typeof options === 'string') {
|
4133 |
+
data[options]();
|
4134 |
+
}
|
4135 |
+
});
|
4136 |
+
};
|
4137 |
+
|
4138 |
+
}));
|
4139 |
+
|
4140 |
+
/*!
|
4141 |
+
* jQuery Raty - A Star Rating Plugin
|
4142 |
+
*
|
4143 |
+
* The MIT License
|
4144 |
+
*
|
4145 |
+
* @author : Washington Botelho
|
4146 |
+
* @doc : http://wbotelhos.com/raty
|
4147 |
+
* @version : 2.6.0
|
4148 |
+
*
|
4149 |
+
*/
|
4150 |
+
|
4151 |
+
;(function($) {
|
4152 |
+
'use strict';
|
4153 |
+
|
4154 |
+
var methods = {
|
4155 |
+
init: function(options) {
|
4156 |
+
return this.each(function() {
|
4157 |
+
this.self = $(this);
|
4158 |
+
|
4159 |
+
methods.destroy.call(this.self);
|
4160 |
+
|
4161 |
+
this.opt = $.extend(true, {}, $.fn.raty.defaults, options);
|
4162 |
+
|
4163 |
+
methods._adjustCallback.call(this);
|
4164 |
+
|
4165 |
+
methods._adjustNumber.call(this);
|
4166 |
+
|
4167 |
+
if (this.opt.starType !== 'img') {
|
4168 |
+
methods._adjustStarType.call(this);
|
4169 |
+
}
|
4170 |
+
|
4171 |
+
methods._adjustPath.call(this);
|
4172 |
+
methods._createStars.call(this);
|
4173 |
+
|
4174 |
+
if (this.opt.cancel) {
|
4175 |
+
methods._createCancel.call(this);
|
4176 |
+
}
|
4177 |
+
|
4178 |
+
if (this.opt.precision) {
|
4179 |
+
methods._adjustPrecision.call(this);
|
4180 |
+
}
|
4181 |
+
|
4182 |
+
methods._createScore.call(this);
|
4183 |
+
methods._apply.call(this, this.opt.score);
|
4184 |
+
methods._target.call(this, this.opt.score);
|
4185 |
+
|
4186 |
+
if (this.opt.readOnly) {
|
4187 |
+
methods._lock.call(this);
|
4188 |
+
} else {
|
4189 |
+
this.style.cursor = 'pointer';
|
4190 |
+
|
4191 |
+
methods._binds.call(this);
|
4192 |
+
}
|
4193 |
+
|
4194 |
+
this.self.data('options', this.opt);
|
4195 |
+
});
|
4196 |
+
},
|
4197 |
+
|
4198 |
+
_adjustCallback: function() {
|
4199 |
+
var options = ['number', 'readOnly', 'score', 'scoreName'];
|
4200 |
+
|
4201 |
+
for (var i = 0; i < options.length; i++) {
|
4202 |
+
if (typeof this.opt[options[i]] === 'function') {
|
4203 |
+
this.opt[options[i]] = this.opt[options[i]].call(this);
|
4204 |
+
}
|
4205 |
+
}
|
4206 |
+
},
|
4207 |
+
|
4208 |
+
_adjustNumber: function() {
|
4209 |
+
this.opt.number = methods._between(this.opt.number, 1, this.opt.numberMax);
|
4210 |
+
},
|
4211 |
+
|
4212 |
+
_adjustPath: function() {
|
4213 |
+
this.opt.path = this.opt.path || '';
|
4214 |
+
|
4215 |
+
if (this.opt.path && this.opt.path.charAt(this.opt.path.length - 1) !== '/') {
|
4216 |
+
this.opt.path += '/';
|
4217 |
+
}
|
4218 |
+
},
|
4219 |
+
|
4220 |
+
_adjustPrecision: function() {
|
4221 |
+
this.opt.half = true;
|
4222 |
+
this.opt.targetType = 'score';
|
4223 |
+
},
|
4224 |
+
|
4225 |
+
_adjustStarType: function() {
|
4226 |
+
this.opt.path = '';
|
4227 |
+
|
4228 |
+
var replaces = ['cancelOff', 'cancelOn', 'starHalf', 'starOff', 'starOn'];
|
4229 |
+
|
4230 |
+
for (var i = 0; i < replaces.length; i++) {
|
4231 |
+
this.opt[replaces[i]] = this.opt[replaces[i]].replace('.', '-');
|
4232 |
+
}
|
4233 |
+
},
|
4234 |
+
|
4235 |
+
_apply: function(score) {
|
4236 |
+
methods._fill.call(this, score);
|
4237 |
+
|
4238 |
+
if (score) {
|
4239 |
+
if (score > 0) {
|
4240 |
+
this.score.val(methods._between(score, 0, this.opt.number));
|
4241 |
+
}
|
4242 |
+
|
4243 |
+
methods._roundStars.call(this, score);
|
4244 |
+
}
|
4245 |
+
},
|
4246 |
+
|
4247 |
+
_between: function(value, min, max) {
|
4248 |
+
return Math.min(Math.max(parseFloat(value), min), max);
|
4249 |
+
},
|
4250 |
+
|
4251 |
+
_binds: function() {
|
4252 |
+
if (this.cancel) {
|
4253 |
+
methods._bindOverCancel.call(this);
|
4254 |
+
methods._bindClickCancel.call(this);
|
4255 |
+
methods._bindOutCancel.call(this);
|
4256 |
+
}
|
4257 |
+
|
4258 |
+
methods._bindOver.call(this);
|
4259 |
+
methods._bindClick.call(this);
|
4260 |
+
methods._bindOut.call(this);
|
4261 |
+
},
|
4262 |
+
|
4263 |
+
_bindClick: function() {
|
4264 |
+
var that = this;
|
4265 |
+
|
4266 |
+
that.stars.on('click.raty', function(evt) {
|
4267 |
+
var star = $(this);
|
4268 |
+
|
4269 |
+
that.score.val((that.opt.half || that.opt.precision) ? that.self.data('score') : (this.alt || star.data('alt')));
|
4270 |
+
|
4271 |
+
if (that.opt.click) {
|
4272 |
+
that.opt.click.call(that, +that.score.val(), evt);
|
4273 |
+
}
|
4274 |
+
});
|
4275 |
+
},
|
4276 |
+
|
4277 |
+
_bindClickCancel: function() {
|
4278 |
+
var that = this;
|
4279 |
+
|
4280 |
+
that.cancel.on('click.raty', function(evt) {
|
4281 |
+
that.score.removeAttr('value');
|
4282 |
+
|
4283 |
+
if (that.opt.click) {
|
4284 |
+
that.opt.click.call(that, null, evt);
|
4285 |
+
}
|
4286 |
+
});
|
4287 |
+
},
|
4288 |
+
|
4289 |
+
_bindOut: function() {
|
4290 |
+
var that = this;
|
4291 |
+
|
4292 |
+
that.self.on('mouseleave.raty', function(evt) {
|
4293 |
+
var score = +that.score.val() || undefined;
|
4294 |
+
|
4295 |
+
methods._apply.call(that, score);
|
4296 |
+
methods._target.call(that, score, evt);
|
4297 |
+
|
4298 |
+
if (that.opt.mouseout) {
|
4299 |
+
that.opt.mouseout.call(that, score, evt);
|
4300 |
+
}
|
4301 |
+
});
|
4302 |
+
},
|
4303 |
+
|
4304 |
+
_bindOutCancel: function() {
|
4305 |
+
var that = this;
|
4306 |
+
|
4307 |
+
that.cancel.on('mouseleave.raty', function(evt) {
|
4308 |
+
var
|
4309 |
+
cancel = $(this),
|
4310 |
+
cancelOff = that.opt.path + that.opt.cancelOff;
|
4311 |
+
|
4312 |
+
if (that.opt.starType === 'img') {
|
4313 |
+
cancel.attr('src', cancelOff);
|
4314 |
+
} else {
|
4315 |
+
var cancelOn = that.opt.path + that.opt.cancelOn;
|
4316 |
+
|
4317 |
+
cancel.removeClass(cancelOn).addClass(cancelOff);
|
4318 |
+
}
|
4319 |
+
|
4320 |
+
if (that.opt.mouseout) {
|
4321 |
+
var score = +that.score.val() || undefined;
|
4322 |
+
|
4323 |
+
that.opt.mouseout.call(that, score, evt);
|
4324 |
+
}
|
4325 |
+
});
|
4326 |
+
},
|
4327 |
+
|
4328 |
+
_bindOver: function() {
|
4329 |
+
var that = this,
|
4330 |
+
action = that.opt.half ? 'mousemove.raty' : 'mouseover.raty';
|
4331 |
+
|
4332 |
+
that.stars.on(action, function(evt) {
|
4333 |
+
var score = methods._getScoreByPosition.call(that, evt, this);
|
4334 |
+
|
4335 |
+
methods._fill.call(that, score);
|
4336 |
+
|
4337 |
+
if (that.opt.half) {
|
4338 |
+
methods._roundStars.call(that, score);
|
4339 |
+
|
4340 |
+
that.self.data('score', score);
|
4341 |
+
}
|
4342 |
+
|
4343 |
+
methods._target.call(that, score, evt);
|
4344 |
+
|
4345 |
+
if (that.opt.mouseover) {
|
4346 |
+
that.opt.mouseover.call(that, score, evt);
|
4347 |
+
}
|
4348 |
+
});
|
4349 |
+
},
|
4350 |
+
|
4351 |
+
_bindOverCancel: function() {
|
4352 |
+
var that = this;
|
4353 |
+
|
4354 |
+
that.cancel.on('mouseover.raty', function(evt) {
|
4355 |
+
var
|
4356 |
+
cancelOn = that.opt.path + that.opt.cancelOn,
|
4357 |
+
star = $(this),
|
4358 |
+
starOff = that.opt.path + that.opt.starOff;
|
4359 |
+
|
4360 |
+
if (that.opt.starType === 'img') {
|
4361 |
+
star.attr('src', cancelOn);
|
4362 |
+
that.stars.attr('src', starOff);
|
4363 |
+
} else {
|
4364 |
+
that.stars.attr('class', starOff);
|
4365 |
+
|
4366 |
+
var cancelOff = that.opt.path + that.opt.cancelOff;
|
4367 |
+
|
4368 |
+
star.removeClass(cancelOff).addClass(cancelOn).css('color', that.opt.starColor);
|
4369 |
+
}
|
4370 |
+
|
4371 |
+
methods._target.call(that, null, evt);
|
4372 |
+
|
4373 |
+
if (that.opt.mouseover) {
|
4374 |
+
that.opt.mouseover.call(that, null);
|
4375 |
+
}
|
4376 |
+
});
|
4377 |
+
},
|
4378 |
+
|
4379 |
+
_buildScoreField: function() {
|
4380 |
+
return $('<input />', { name: this.opt.scoreName, type: 'hidden' }).appendTo(this);
|
4381 |
+
},
|
4382 |
+
|
4383 |
+
_createCancel: function() {
|
4384 |
+
var icon = this.opt.path + this.opt.cancelOff,
|
4385 |
+
cancel = $('<' + this.opt.starType + ' />', { title: this.opt.cancelHint, 'class': 'raty-cancel' }).css('marginRight', this.opt.space ? this.opt.spaceWidth + 'px' : '0');
|
4386 |
+
|
4387 |
+
if (this.opt.starType === 'img') {
|
4388 |
+
cancel.attr({ src: icon, alt: 'x' });
|
4389 |
+
} else {
|
4390 |
+
// TODO: use $.data
|
4391 |
+
cancel.attr('data-alt', 'x').addClass(icon);
|
4392 |
+
}
|
4393 |
+
|
4394 |
+
if (this.opt.cancelPlace === 'left') {
|
4395 |
+
this.self.prepend(' ').prepend(cancel);
|
4396 |
+
} else {
|
4397 |
+
this.self.append(' ').append(cancel);
|
4398 |
+
}
|
4399 |
+
|
4400 |
+
this.cancel = cancel;
|
4401 |
+
},
|
4402 |
+
|
4403 |
+
_createScore: function() {
|
4404 |
+
var score = $(this.opt.targetScore);
|
4405 |
+
|
4406 |
+
this.score = score.length ? score : methods._buildScoreField.call(this);
|
4407 |
+
},
|
4408 |
+
|
4409 |
+
_createStars: function() {
|
4410 |
+
for (var i = 1; i <= this.opt.number; i++) {
|
4411 |
+
var
|
4412 |
+
attrs ,
|
4413 |
+
icon = (this.opt.score && this.opt.score >= i) ? 'starOn' : 'starOff',
|
4414 |
+
title = methods._getHint.call(this, i);
|
4415 |
+
|
4416 |
+
// TODO: extract as icon: && alt:
|
4417 |
+
icon = this.opt.path + this.opt[icon];
|
4418 |
+
|
4419 |
+
if (this.opt.starType !== 'img') {
|
4420 |
+
// TODO: use $.data.
|
4421 |
+
attrs = { 'data-alt': i, 'class': icon };
|
4422 |
+
} else {
|
4423 |
+
attrs = { src: icon, alt: i };
|
4424 |
+
}
|
4425 |
+
|
4426 |
+
attrs.title = title;
|
4427 |
+
|
4428 |
+
$('<' + this.opt.starType + ' />', attrs).css('marginRight', i < this.opt.number && this.opt.space ? this.opt.spaceWidth + 'px' : '0').appendTo(this);
|
4429 |
+
|
4430 |
+
if (this.opt.space) {
|
4431 |
+
// this.self.append(i < this.opt.number ? ' ' : '');
|
4432 |
+
}
|
4433 |
+
}
|
4434 |
+
|
4435 |
+
this.stars = this.self.children(this.opt.starType);
|
4436 |
+
},
|
4437 |
+
|
4438 |
+
_error: function(message) {
|
4439 |
+
$(this).text(message);
|
4440 |
+
|
4441 |
+
$.error(message);
|
4442 |
+
},
|
4443 |
+
|
4444 |
+
_fill: function(score) {
|
4445 |
+
var hash = 0;
|
4446 |
+
|
4447 |
+
for (var i = 1; i <= this.stars.length; i++) {
|
4448 |
+
var
|
4449 |
+
icon,
|
4450 |
+
star = this.stars.eq(i - 1),
|
4451 |
+
turnOn = methods._turnOn.call(this, i, score);
|
4452 |
+
|
4453 |
+
if (this.opt.iconRange && this.opt.iconRange.length > hash) {
|
4454 |
+
var irange = this.opt.iconRange[hash];
|
4455 |
+
|
4456 |
+
icon = methods._getIconRange.call(this, irange, turnOn);
|
4457 |
+
|
4458 |
+
if (i <= irange.range) {
|
4459 |
+
// TODO: extract.
|
4460 |
+
if (this.opt.starType === 'img') {
|
4461 |
+
star.attr('src', icon);
|
4462 |
+
} else {
|
4463 |
+
star.attr('class', icon);
|
4464 |
+
}
|
4465 |
+
}
|
4466 |
+
|
4467 |
+
if (i === irange.range) {
|
4468 |
+
hash++;
|
4469 |
+
}
|
4470 |
+
} else {
|
4471 |
+
icon = this.opt.path + this.opt[turnOn ? 'starOn' : 'starOff'];
|
4472 |
+
// TODO: extract.
|
4473 |
+
if (this.opt.starType === 'img') {
|
4474 |
+
star.attr('src', icon);
|
4475 |
+
} else {
|
4476 |
+
star.attr('class', icon);
|
4477 |
+
}
|
4478 |
+
// Set Color
|
4479 |
+
if (turnOn) {
|
4480 |
+
star.css('color', this.opt.starColor);
|
4481 |
+
}else{
|
4482 |
+
star.css('color', '');
|
4483 |
+
}
|
4484 |
+
}
|
4485 |
+
}
|
4486 |
+
},
|
4487 |
+
|
4488 |
+
_getIconRange: function(irange, turnOn) {
|
4489 |
+
return this.opt.path + (turnOn ? irange.on || this.opt.starOn : irange.off || this.opt.starOff);
|
4490 |
+
},
|
4491 |
+
|
4492 |
+
_getScoreByPosition: function(evt, icon) {
|
4493 |
+
var
|
4494 |
+
star = $(icon),
|
4495 |
+
score = parseInt(icon.alt || star.data('alt'), 10);
|
4496 |
+
|
4497 |
+
if (this.opt.half) {
|
4498 |
+
var
|
4499 |
+
size = methods._getSize.call(this),
|
4500 |
+
percent = parseFloat((evt.pageX - star.offset().left) / size);
|
4501 |
+
|
4502 |
+
if (this.opt.precision) {
|
4503 |
+
score = score - 1 + percent;
|
4504 |
+
} else {
|
4505 |
+
score = score - 1 + (percent > 0.5 ? 1 : 0.5);
|
4506 |
+
}
|
4507 |
+
}
|
4508 |
+
|
4509 |
+
|
4510 |
+
return score;
|
4511 |
+
},
|
4512 |
+
|
4513 |
+
_getSize: function() {
|
4514 |
+
var size;
|
4515 |
+
|
4516 |
+
if (this.opt.starType === 'img') {
|
4517 |
+
size = this.stars[0].width;
|
4518 |
+
} else {
|
4519 |
+
size = parseFloat(this.stars.eq(0).css('font-size'));
|
4520 |
+
}
|
4521 |
+
|
4522 |
+
if (!size) {
|
4523 |
+
methods._error.call(this, 'Could not be possible get the icon size!');
|
4524 |
+
}
|
4525 |
+
|
4526 |
+
return size;
|
4527 |
+
},
|
4528 |
+
|
4529 |
+
_turnOn: function(i, score) {
|
4530 |
+
return this.opt.single ? (i === score) : (i <= score);
|
4531 |
+
},
|
4532 |
+
|
4533 |
+
_getHint: function(score) {
|
4534 |
+
var hint = this.opt.hints[score - 1];
|
4535 |
+
|
4536 |
+
return hint === '' ? '' : hint || score;
|
4537 |
+
},
|
4538 |
+
|
4539 |
+
_lock: function() {
|
4540 |
+
var score = parseInt(this.score.val(), 10), // TODO: 3.1 >> [['1'], ['2'], ['3', '.1', '.2']]
|
4541 |
+
hint = score ? methods._getHint.call(this, score) : this.opt.noRatedMsg;
|
4542 |
+
|
4543 |
+
this.style.cursor = '';
|
4544 |
+
this.title = hint;
|
4545 |
+
|
4546 |
+
this.score.prop('readonly', true);
|
4547 |
+
this.stars.prop('title', hint);
|
4548 |
+
|
4549 |
+
if (this.cancel) {
|
4550 |
+
this.cancel.hide();
|
4551 |
+
}
|
4552 |
+
|
4553 |
+
this.self.data('readonly', true);
|
4554 |
+
},
|
4555 |
+
|
4556 |
+
_roundStars: function(score) {
|
4557 |
+
var rest = (score % 1).toFixed(2);
|
4558 |
+
|
4559 |
+
if (rest > this.opt.round.down) { // Up: [x.76 .. x.99]
|
4560 |
+
var icon = 'starOn';
|
4561 |
+
|
4562 |
+
if (this.opt.halfShow && rest < this.opt.round.up) { // Half: [x.26 .. x.75]
|
4563 |
+
icon = 'starHalf';
|
4564 |
+
} else if (rest < this.opt.round.full) { // Down: [x.00 .. x.5]
|
4565 |
+
icon = 'starOff';
|
4566 |
+
}
|
4567 |
+
|
4568 |
+
var star = this.stars[Math.ceil(score) - 1];
|
4569 |
+
|
4570 |
+
if (this.opt.starType === 'img') {
|
4571 |
+
star.src = this.opt.path + this.opt[icon];
|
4572 |
+
} else {
|
4573 |
+
star.style.className = this.opt[icon];
|
4574 |
+
}
|
4575 |
+
} // Full down: [x.00 .. x.25]
|
4576 |
+
},
|
4577 |
+
|
4578 |
+
_target: function(score, evt) {
|
4579 |
+
if (this.opt.target) {
|
4580 |
+
var target = $(this.opt.target);
|
4581 |
+
|
4582 |
+
if (!target.length) {
|
4583 |
+
methods._error.call(this, 'Target selector invalid or missing!');
|
4584 |
+
}
|
4585 |
+
|
4586 |
+
var mouseover = evt && evt.type === 'mouseover';
|
4587 |
+
|
4588 |
+
if (score === undefined) {
|
4589 |
+
score = this.opt.targetText;
|
4590 |
+
} else if (score === null) {
|
4591 |
+
score = mouseover ? this.opt.cancelHint : this.opt.targetText;
|
4592 |
+
} else {
|
4593 |
+
if (this.opt.targetType === 'hint') {
|
4594 |
+
score = methods._getHint.call(this, Math.ceil(score));
|
4595 |
+
} else if (this.opt.precision) {
|
4596 |
+
score = parseFloat(score).toFixed(1);
|
4597 |
+
}
|
4598 |
+
|
4599 |
+
var mousemove = evt && evt.type === 'mousemove';
|
4600 |
+
|
4601 |
+
if (!mouseover && !mousemove && !this.opt.targetKeep) {
|
4602 |
+
score = this.opt.targetText;
|
4603 |
+
}
|
4604 |
+
}
|
4605 |
+
|
4606 |
+
if (score) {
|
4607 |
+
score = this.opt.targetFormat.toString().replace('{score}', score);
|
4608 |
+
}
|
4609 |
+
|
4610 |
+
if (target.is(':input')) {
|
4611 |
+
target.val(score);
|
4612 |
+
} else {
|
4613 |
+
target.html(score);
|
4614 |
+
}
|
4615 |
+
}
|
4616 |
+
},
|
4617 |
+
|
4618 |
+
_unlock: function() {
|
4619 |
+
this.style.cursor = 'pointer';
|
4620 |
+
this.removeAttribute('title');
|
4621 |
+
|
4622 |
+
this.score.removeAttr('readonly');
|
4623 |
+
|
4624 |
+
this.self.data('readonly', false);
|
4625 |
+
|
4626 |
+
for (var i = 0; i < this.opt.number; i++) {
|
4627 |
+
this.stars[i].title = methods._getHint.call(this, i + 1);
|
4628 |
+
}
|
4629 |
+
|
4630 |
+
if (this.cancel) {
|
4631 |
+
this.cancel.css('display', '');
|
4632 |
+
}
|
4633 |
+
},
|
4634 |
+
|
4635 |
+
cancel: function(click) {
|
4636 |
+
return this.each(function() {
|
4637 |
+
var el = $(this);
|
4638 |
+
|
4639 |
+
if (el.data('readonly') !== true) {
|
4640 |
+
methods[click ? 'click' : 'score'].call(el, null);
|
4641 |
+
|
4642 |
+
this.score.removeAttr('value');
|
4643 |
+
}
|
4644 |
+
});
|
4645 |
+
},
|
4646 |
+
|
4647 |
+
click: function(score) {
|
4648 |
+
return this.each(function() {
|
4649 |
+
if ($(this).data('readonly') !== true) {
|
4650 |
+
methods._apply.call(this, score);
|
4651 |
+
|
4652 |
+
if (this.opt.click) {
|
4653 |
+
this.opt.click.call(this, score, $.Event('click'));
|
4654 |
+
}
|
4655 |
+
|
4656 |
+
methods._target.call(this, score);
|
4657 |
+
}
|
4658 |
+
});
|
4659 |
+
},
|
4660 |
+
|
4661 |
+
destroy: function() {
|
4662 |
+
return this.each(function() {
|
4663 |
+
var self = $(this),
|
4664 |
+
raw = self.data('raw');
|
4665 |
+
|
4666 |
+
if (raw) {
|
4667 |
+
self.off('.raty').empty().css({ cursor: raw.style.cursor }).removeData('readonly');
|
4668 |
+
} else {
|
4669 |
+
self.data('raw', self.clone()[0]);
|
4670 |
+
}
|
4671 |
+
});
|
4672 |
+
},
|
4673 |
+
|
4674 |
+
getScore: function() {
|
4675 |
+
var score = [],
|
4676 |
+
value ;
|
4677 |
+
|
4678 |
+
this.each(function() {
|
4679 |
+
value = this.score.val();
|
4680 |
+
|
4681 |
+
score.push(value ? +value : undefined);
|
4682 |
+
});
|
4683 |
+
|
4684 |
+
return (score.length > 1) ? score : score[0];
|
4685 |
+
},
|
4686 |
+
|
4687 |
+
move: function(score) {
|
4688 |
+
return this.each(function() {
|
4689 |
+
var
|
4690 |
+
integer = parseInt(score, 10),
|
4691 |
+
opt = $(this).data('options'),
|
4692 |
+
decimal = (+score).toFixed(1).split('.')[1];
|
4693 |
+
|
4694 |
+
if (integer >= opt.number) {
|
4695 |
+
integer = opt.number - 1;
|
4696 |
+
decimal = 10;
|
4697 |
+
}
|
4698 |
+
|
4699 |
+
var
|
4700 |
+
size = methods._getSize.call(this),
|
4701 |
+
point = size / 10,
|
4702 |
+
star = $(this.stars[integer]),
|
4703 |
+
percent = star.offset().left + point * parseInt(decimal, 10),
|
4704 |
+
evt = $.Event('mousemove', { pageX: percent });
|
4705 |
+
|
4706 |
+
star.trigger(evt);
|
4707 |
+
});
|
4708 |
+
},
|
4709 |
+
|
4710 |
+
readOnly: function(readonly) {
|
4711 |
+
return this.each(function() {
|
4712 |
+
var self = $(this);
|
4713 |
+
|
4714 |
+
if (self.data('readonly') !== readonly) {
|
4715 |
+
if (readonly) {
|
4716 |
+
self.off('.raty').children('img').off('.raty');
|
4717 |
+
|
4718 |
+
methods._lock.call(this);
|
4719 |
+
} else {
|
4720 |
+
methods._binds.call(this);
|
4721 |
+
methods._unlock.call(this);
|
4722 |
+
}
|
4723 |
+
|
4724 |
+
self.data('readonly', readonly);
|
4725 |
+
}
|
4726 |
+
});
|
4727 |
+
},
|
4728 |
+
|
4729 |
+
reload: function() {
|
4730 |
+
return methods.set.call(this, {});
|
4731 |
+
},
|
4732 |
+
|
4733 |
+
score: function() {
|
4734 |
+
var self = $(this);
|
4735 |
+
|
4736 |
+
return arguments.length ? methods.setScore.apply(self, arguments) : methods.getScore.call(self);
|
4737 |
+
},
|
4738 |
+
|
4739 |
+
set: function(options) {
|
4740 |
+
return this.each(function() {
|
4741 |
+
var self = $(this),
|
4742 |
+
actual = self.data('options'),
|
4743 |
+
news = $.extend({}, actual, options);
|
4744 |
+
|
4745 |
+
self.raty(news);
|
4746 |
+
});
|
4747 |
+
},
|
4748 |
+
|
4749 |
+
setScore: function(score) {
|
4750 |
+
return this.each(function() {
|
4751 |
+
if ($(this).data('readonly') !== true) {
|
4752 |
+
methods._apply.call(this, score);
|
4753 |
+
methods._target.call(this, score);
|
4754 |
+
}
|
4755 |
+
});
|
4756 |
+
}
|
4757 |
+
};
|
4758 |
+
|
4759 |
+
$.fn.raty = function(method) {
|
4760 |
+
if (methods[method]) {
|
4761 |
+
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
|
4762 |
+
} else if (typeof method === 'object' || !method) {
|
4763 |
+
return methods.init.apply(this, arguments);
|
4764 |
+
} else {
|
4765 |
+
$.error('Method ' + method + ' does not exist!');
|
4766 |
+
}
|
4767 |
+
};
|
4768 |
+
|
4769 |
+
$.fn.raty.defaults = {
|
4770 |
+
cancel : false,
|
4771 |
+
cancelHint : 'Cancel this rating!',
|
4772 |
+
cancelOff : 'raty-cancel-off',
|
4773 |
+
cancelOn : 'raty-cancel-on',
|
4774 |
+
cancelPlace : 'left',
|
4775 |
+
click : undefined,
|
4776 |
+
half : false,
|
4777 |
+
halfShow : true,
|
4778 |
+
hints : ['1'],
|
4779 |
+
iconRange : undefined,
|
4780 |
+
mouseout : undefined,
|
4781 |
+
mouseover : undefined,
|
4782 |
+
noRatedMsg : 'Not rated yet!',
|
4783 |
+
number : 5,
|
4784 |
+
numberMax : 20,
|
4785 |
+
path : undefined,
|
4786 |
+
precision : false,
|
4787 |
+
readOnly : false,
|
4788 |
+
round : { down: 0.25, full: 0.6, up: 0.76 },
|
4789 |
+
score : undefined,
|
4790 |
+
scoreName : 'score',
|
4791 |
+
single : false,
|
4792 |
+
space : true,
|
4793 |
+
spaceWidth : 3,
|
4794 |
+
starColor : '#ff00aa',
|
4795 |
+
starHalf : 'star-half.png',
|
4796 |
+
starOff : 'raty-dot-off',
|
4797 |
+
starOn : 'raty-dot-on',
|
4798 |
+
starType : 'img',
|
4799 |
+
target : undefined,
|
4800 |
+
targetFormat : '{score}',
|
4801 |
+
targetKeep : false,
|
4802 |
+
targetScore : undefined,
|
4803 |
+
targetText : '',
|
4804 |
+
targetType : 'hint'
|
4805 |
+
};
|
4806 |
+
|
4807 |
+
})(jQuery);
|
4808 |
+
|
4809 |
+
|
4810 |
+
jQuery(function($){
|
4811 |
+
$('body').on('click', '.cf-toggle-group-buttons a', function(){
|
4812 |
+
|
4813 |
+
var clicked = $(this),
|
4814 |
+
parent = clicked.closest('.caldera-config-field'),
|
4815 |
+
input = parent.find('[data-ref="'+clicked.attr('id')+'"]');
|
4816 |
+
|
4817 |
+
|
4818 |
+
parent.find('.btn').removeClass(clicked.data('active')).addClass(clicked.data('default'));
|
4819 |
+
clicked.addClass(clicked.data('active')).removeClass(clicked.data('default'));
|
4820 |
+
input.prop('checked', true).trigger('change');
|
4821 |
+
});
|
4822 |
+
});
|
4823 |
+
|
4824 |
+
function toggle_button_init(id, el){
|
4825 |
+
|
4826 |
+
var field = jQuery(el),
|
4827 |
+
checked = field.find('.cf-toggle-group-radio:checked');
|
4828 |
+
|
4829 |
+
if(checked.length){
|
4830 |
+
jQuery('#' + checked.data('ref') ).trigger('click');
|
4831 |
+
}
|
4832 |
+
|
4833 |
+
}
|
assets/js/fields.min.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
function color_picker_init(){jQuery(".minicolor-picker").miniColors()}function toggle_button_init(a,b){var c=jQuery(b),d=c.find(".cf-toggle-group-radio:checked");d.length&&jQuery("#"+d.data("ref")).trigger("click")}jQuery&&function(a){a.extend(a.fn,{miniColors:function(b,c){var d=function(b,c){var e=s(b.val());e||(e="ffffff");var f=x(e),h=a('<span class="input-group-addon" style="background-color: #'+e+'" href="#"></span>');h.insertAfter(b),b.addClass("miniColors").data("original-maxlength",b.attr("maxlength")||null).data("original-autocomplete",b.attr("autocomplete")||null).data("letterCase",c.letterCase?c.letterCase:"uppercase").data("trigger",h).data("hsb",f).data("change",c.change?c.change:null).data("close",c.close?c.close:null).data("open",c.open?c.open:null).attr("maxlength",7).attr("autocomplete","off").val("#"+o(e,c.letterCase)).trigger("change"),c.readonly&&b.prop("readonly",!0),c.disabled&&g(b),h.on("click.miniColors",function(a){a.preventDefault(),""===b.val()&&b.val("#").trigger("change"),i(b)}),b.on("focus.miniColors",function(){""===b.val()&&b.val("#").trigger("change"),i(b)}),b.on("blur.miniColors",function(){var c=s(y(b.data("hsb")));b.val(c?"#"+o(c,b.data("letterCase")):"").trigger("change")}),b.on("keydown.miniColors",function(a){9===a.keyCode&&j(b)}),b.on("keyup.miniColors",function(){n(b)}),b.on("paste.miniColors",function(){setTimeout(function(){n(b)},5)})},e=function(b){j(),b=a(b),b.data("trigger").remove(),b.attr("autocomplete",b.data("original-autocomplete")).attr("maxlength",b.data("original-maxlength")).removeData().removeClass("miniColors").off(".miniColors"),a(document).off(".miniColors")},f=function(a){a.prop("disabled",!1).data("trigger").css("opacity",1)},g=function(a){j(a),a.prop("disabled",!0).data("trigger").css("opacity",.5)},i=function(b){if(b.prop("disabled"))return!1;j();var c=a('<div class="miniColors-selector"></div>');c.append('<div class="miniColors-colors" style="background-color: #FFF;"><div class="miniColors-colorPicker"><div class="miniColors-colorPicker-inner"></div></div>').append('<div class="miniColors-hues"><div class="miniColors-huePicker"></div></div>').css("display","none").addClass(b.attr("class")).removeClass("form-control");var d=b.data("hsb");c.find(".miniColors-colors").css("backgroundColor","#"+y({h:d.h,s:100,b:100}));var e=b.data("colorPosition");e||(e=p(d)),c.find(".miniColors-colorPicker").css("top",e.y+"px").css("left",e.x+"px");var f=b.data("huePosition");f||(f=q(d)),c.find(".miniColors-huePicker").css("top",f.y+"px"),b.data("selector",c).data("huePicker",c.find(".miniColors-huePicker")).data("colorPicker",c.find(".miniColors-colorPicker")).data("mousebutton",0),a("BODY").append(c);var g=b.data("trigger"),h=!b.is(":visible"),i=h?g.offset().top+g.outerHeight():b.offset().top+b.outerHeight(),m=h?g.offset().left:b.offset().left,n=c.outerWidth(),o=c.outerHeight(),r=g.outerWidth(),s=g.outerHeight(),u=a(window).height(),v=a(window).width(),w=a(window).scrollTop(),x=a(window).scrollLeft();i+o>u+w&&(i=i-o-s),m+n>v+x&&(m=m-n+r),c.css({top:i,left:m}).fadeIn(100),c.on("selectstart",function(){return!1}),(!a.browser.msie||a.browser.msie&&a.browser.version>=9)&&a(window).on("resize.miniColors",function(){j(b)}),a(document).on("mousedown.miniColors touchstart.miniColors",function(c){b.data("mousebutton",1);var d=a(c.target).parents().andSelf();return d.hasClass("miniColors-colors")&&(c.preventDefault(),b.data("moving","colors"),k(b,c)),d.hasClass("miniColors-hues")&&(c.preventDefault(),b.data("moving","hues"),l(b,c)),d.hasClass("miniColors-selector")?(c.preventDefault(),void 0):(d.hasClass("miniColors")||j(b),void 0)}),a(document).on("mouseup.miniColors touchend.miniColors",function(a){a.preventDefault(),b.data("mousebutton",0).removeData("moving")}).on("mousemove.miniColors touchmove.miniColors",function(a){a.preventDefault(),1===b.data("mousebutton")&&("colors"===b.data("moving")&&k(b,a),"hues"===b.data("moving")&&l(b,a))}),b.data("open")&&b.data("open").call(b.get(0),"#"+y(d),t(d))},j=function(b){b||(b=a(".miniColors")),b.each(function(){var c=a(this).data("selector");a(this).removeData("selector"),a(c).fadeOut(100,function(){if(b.data("close")){var c=b.data("hsb"),d=y(c);b.data("close").call(b.get(0),"#"+d,t(c))}a(this).remove()})}),a(document).off(".miniColors")},k=function(a,b){var c=a.data("colorPicker");c.hide();var d={x:b.pageX,y:b.pageY};b.originalEvent.changedTouches&&(d.x=b.originalEvent.changedTouches[0].pageX,d.y=b.originalEvent.changedTouches[0].pageY),d.x=d.x-a.data("selector").find(".miniColors-colors").offset().left-5,d.y=d.y-a.data("selector").find(".miniColors-colors").offset().top-5,d.x<=-5&&(d.x=-5),d.x>=144&&(d.x=144),d.y<=-5&&(d.y=-5),d.y>=144&&(d.y=144),a.data("colorPosition",d),c.css("left",d.x).css("top",d.y).show();var e=Math.round(.67*(d.x+5));0>e&&(e=0),e>100&&(e=100);var f=100-Math.round(.67*(d.y+5));0>f&&(f=0),f>100&&(f=100);var g=a.data("hsb");g.s=e,g.b=f,m(a,g,!0)},l=function(a,b){var c=a.data("huePicker");c.hide();var d={y:b.pageY};b.originalEvent.changedTouches&&(d.y=b.originalEvent.changedTouches[0].pageY),d.y=d.y-a.data("selector").find(".miniColors-colors").offset().top-1,d.y<=-1&&(d.y=-1),d.y>=149&&(d.y=149),a.data("huePosition",d),c.css("top",d.y).show();var e=Math.round(2.4*(150-d.y-1));0>e&&(e=0),e>360&&(e=360);var f=a.data("hsb");f.h=e,m(a,f,!0)},m=function(a,b,c){a.data("hsb",b);var d=y(b);if(c&&a.val("#"+o(d,a.data("letterCase"))).trigger("change"),a.data("trigger").css("backgroundColor","#"+d),a.data("selector")&&a.data("selector").find(".miniColors-colors").css("backgroundColor","#"+y({h:b.h,s:100,b:100})),a.data("change")){if(d===a.data("lastChange"))return;a.data("change").call(a.get(0),"#"+d,t(b)),a.data("lastChange",d)}},n=function(b){b.val("#"+r(b.val())).trigger("change");var c=s(b.val());if(!c)return!1;var d=x(c),e=b.data("hsb");if(d.h===e.h&&d.s===e.s&&d.b===e.b)return!0;var f=p(d),g=a(b.data("colorPicker"));g.css("top",f.y+"px").css("left",f.x+"px"),b.data("colorPosition",f);var h=q(d),i=a(b.data("huePicker"));return i.css("top",h.y+"px"),b.data("huePosition",h),m(b,d),!0},o=function(a,b){return"lowercase"===b?a.toLowerCase():"uppercase"===b?a.toUpperCase():a},p=function(a){var b=Math.ceil(a.s/.67);0>b&&(b=0),b>150&&(b=150);var c=150-Math.ceil(a.b/.67);return 0>c&&(c=0),c>150&&(c=150),{x:b-5,y:c-5}},q=function(a){var b=150-a.h/2.4;return 0>b&&(h=0),b>150&&(h=150),{y:b-1}},r=function(a){return a.replace(/[^A-F0-9]/gi,"")},s=function(a){return(a=r(a))?(3===a.length&&(a=a[0]+a[0]+a[1]+a[1]+a[2]+a[2]),6===a.length?a:null):null},t=function(a){var b={},c=Math.round(a.h),d=Math.round(255*a.s/100),e=Math.round(255*a.b/100);if(0===d)b.r=b.g=b.b=e;else{var f=e,g=(255-d)*e/255,h=(f-g)*(c%60)/60;360===c&&(c=0),60>c?(b.r=f,b.b=g,b.g=g+h):120>c?(b.g=f,b.b=g,b.r=f-h):180>c?(b.g=f,b.r=g,b.b=g+h):240>c?(b.b=f,b.r=g,b.g=f-h):300>c?(b.b=f,b.g=g,b.r=g+h):360>c?(b.r=f,b.g=g,b.b=f-h):(b.r=0,b.g=0,b.b=0)}return{r:Math.round(b.r),g:Math.round(b.g),b:Math.round(b.b)}},u=function(b){var c=[b.r.toString(16),b.g.toString(16),b.b.toString(16)];return a.each(c,function(a,b){1===b.length&&(c[a]="0"+b)}),c.join("")},v=function(a){return a=parseInt(a.indexOf("#")>-1?a.substring(1):a,16),{r:a>>16,g:(65280&a)>>8,b:255&a}},w=function(a){var b={h:0,s:0,b:0},c=Math.min(a.r,a.g,a.b),d=Math.max(a.r,a.g,a.b),e=d-c;return b.b=d,b.s=0!==d?255*e/d:0,b.h=0!==b.s?a.r===d?(a.g-a.b)/e:a.g===d?2+(a.b-a.r)/e:4+(a.r-a.g)/e:-1,b.h*=60,b.h<0&&(b.h+=360),b.s*=100/255,b.b*=100/255,b},x=function(a){var b=w(v(a));return 0===b.s&&(b.h=360),b},y=function(a){return u(t(a))};switch(b){case"readonly":return a(this).each(function(){a(this).hasClass("miniColors")&&a(this).prop("readonly",c)}),a(this);case"disabled":return a(this).each(function(){a(this).hasClass("miniColors")&&(c?g(a(this)):f(a(this)))}),a(this);case"value":if(void 0===c){if(!a(this).hasClass("miniColors"))return;var z=a(this),A=s(z.val());return A?"#"+o(A,z.data("letterCase")):null}return a(this).each(function(){a(this).hasClass("miniColors")&&(a(this).val(c).trigger("change"),n(a(this)))}),a(this);case"destroy":return a(this).each(function(){a(this).hasClass("miniColors")&&e(a(this))}),a(this);default:return b||(b={}),a(this).each(function(){"input"===a(this)[0].tagName.toLowerCase()&&(a(this).data("trigger")||d(a(this),b,c))}),a(this)}}})}(jQuery),jQuery(function(a){a("body").on("change",".minicolor-picker.field-config",function(){var b=a(this).closest(".caldera-editor-field-config-wrapper");a('[data-for="'+b.prop("id")+'"]').css("backgroundColor",this.value)})}),function(a,b){function d(){return new Date(Date.UTC.apply(Date,arguments))}function e(){var a=new Date;return d(a.getFullYear(),a.getMonth(),a.getDate())}function f(a){return function(){return this[a].apply(this,arguments)}}function j(b,c){function h(a,b){return b.toLowerCase()}var f,d=a(b).data(),e={},g=new RegExp("^"+c.toLowerCase()+"([A-Z])");c=new RegExp("^"+c.toLowerCase());for(var i in d)c.test(i)&&(f=i.replace(g,h),e[f]=d[i]);return e}function k(b){var c={};if(o[b]||(b=b.split("-")[0],o[b])){var d=o[b];return a.each(n,function(a,b){b in d&&(c[b]=d[b])}),c}}var c=a(window),g=function(){var b={get:function(a){return this.slice(a)[0]},contains:function(a){for(var b=a&&a.valueOf(),c=0,d=this.length;d>c;c++)if(this[c].valueOf()===b)return c;return-1},remove:function(a){this.splice(a,1)},replace:function(b){b&&(a.isArray(b)||(b=[b]),this.clear(),this.push.apply(this,b))},clear:function(){this.splice(0)},copy:function(){var a=new g;return a.replace(this),a}};return function(){var c=[];return c.push.apply(c,arguments),a.extend(c,b),c}}(),h=function(b,c){this.dates=new g,this.viewDate=e(),this.focusDate=null,this._process_options(c),this.element=a(b),this.isInline=!1,this.isInput=this.element.is("input"),this.component=this.element.is(".date")?this.element.find(".add-on, .input-group-addon, .btn"):!1,this.hasInput=this.component&&this.element.find("input").length,this.component&&0===this.component.length&&(this.component=!1),this.picker=a(p.template),this._buildEvents(),this._attachEvents(),this.isInline?this.picker.addClass("cfdatepicker-inline").appendTo(this.element):this.picker.addClass("cfdatepicker-dropdown dropdown-menu"),this.o.rtl&&this.picker.addClass("cfdatepicker-rtl"),this.viewMode=this.o.startView,this.o.calendarWeeks&&this.picker.find("tfoot th.today").attr("colspan",function(a,b){return parseInt(b)+1}),this._allow_update=!1,this.setStartDate(this._o.startDate),this.setEndDate(this._o.endDate),this.setDaysOfWeekDisabled(this.o.daysOfWeekDisabled),this.fillDow(),this.fillMonths(),this._allow_update=!0,this.update(),this.showMode(),this.isInline&&this.show()};h.prototype={constructor:h,_process_options:function(b){this._o=a.extend({},this._o,b);var c=this.o=a.extend({},this._o),d=c.language;switch(o[d]||(d=d.split("-")[0],o[d]||(d=m.language)),c.language=d,c.startView){case 2:case"decade":c.startView=2;break;case 1:case"year":c.startView=1;break;default:c.startView=0}switch(c.minViewMode){case 1:case"months":c.minViewMode=1;break;case 2:case"years":c.minViewMode=2;break;default:c.minViewMode=0}c.startView=Math.max(c.startView,c.minViewMode),c.multidate!==!0&&(c.multidate=Number(c.multidate)||!1,c.multidate=c.multidate!==!1?Math.max(0,c.multidate):1),c.multidateSeparator=String(c.multidateSeparator),c.weekStart%=7,c.weekEnd=(c.weekStart+6)%7;var e=p.parseFormat(c.format);c.startDate!==-1/0&&(c.startDate=c.startDate?c.startDate instanceof Date?this._local_to_utc(this._zero_time(c.startDate)):p.parseDate(c.startDate,e,c.language):-1/0),1/0!==c.endDate&&(c.endDate=c.endDate?c.endDate instanceof Date?this._local_to_utc(this._zero_time(c.endDate)):p.parseDate(c.endDate,e,c.language):1/0),c.daysOfWeekDisabled=c.daysOfWeekDisabled||[],a.isArray(c.daysOfWeekDisabled)||(c.daysOfWeekDisabled=c.daysOfWeekDisabled.split(/[,\s]*/)),c.daysOfWeekDisabled=a.map(c.daysOfWeekDisabled,function(a){return parseInt(a,10)});var f=String(c.orientation).toLowerCase().split(/\s+/g),g=c.orientation.toLowerCase();if(f=a.grep(f,function(a){return/^auto|left|right|top|bottom$/.test(a)}),c.orientation={x:"auto",y:"auto"},g&&"auto"!==g)if(1===f.length)switch(f[0]){case"top":case"bottom":c.orientation.y=f[0];break;case"left":case"right":c.orientation.x=f[0]}else g=a.grep(f,function(a){return/^left|right$/.test(a)}),c.orientation.x=g[0]||"auto",g=a.grep(f,function(a){return/^top|bottom$/.test(a)}),c.orientation.y=g[0]||"auto";else;},_events:[],_secondaryEvents:[],_applyEvents:function(a){for(var d,e,f,c=0;c<a.length;c++)d=a[c][0],2===a[c].length?(e=b,f=a[c][1]):3===a[c].length&&(e=a[c][1],f=a[c][2]),d.on(f,e)},_unapplyEvents:function(a){for(var d,e,f,c=0;c<a.length;c++)d=a[c][0],2===a[c].length?(f=b,e=a[c][1]):3===a[c].length&&(f=a[c][1],e=a[c][2]),d.off(e,f)},_buildEvents:function(){this.isInput?this._events=[[this.element,{focus:a.proxy(this.show,this),keyup:a.proxy(function(b){-1===a.inArray(b.keyCode,[27,37,39,38,40,32,13,9])&&this.update()},this),keydown:a.proxy(this.keydown,this)}]]:this.component&&this.hasInput?this._events=[[this.element.find("input"),{focus:a.proxy(this.show,this),keyup:a.proxy(function(b){-1===a.inArray(b.keyCode,[27,37,39,38,40,32,13,9])&&this.update()},this),keydown:a.proxy(this.keydown,this)}],[this.component,{click:a.proxy(this.show,this)}]]:this.element.is("div")?this.isInline=!0:this._events=[[this.element,{click:a.proxy(this.show,this)}]],this._events.push([this.element,"*",{blur:a.proxy(function(a){this._focused_from=a.target},this)}],[this.element,{blur:a.proxy(function(a){this._focused_from=a.target},this)}]),this._secondaryEvents=[[this.picker,{click:a.proxy(this.click,this)}],[a(window),{resize:a.proxy(this.place,this)}],[a(document),{"mousedown touchstart":a.proxy(function(a){this.element.is(a.target)||this.element.find(a.target).length||this.picker.is(a.target)||this.picker.find(a.target).length||this.hide()},this)}]]},_attachEvents:function(){this._detachEvents(),this._applyEvents(this._events)},_detachEvents:function(){this._unapplyEvents(this._events)},_attachSecondaryEvents:function(){this._detachSecondaryEvents(),this._applyEvents(this._secondaryEvents)},_detachSecondaryEvents:function(){this._unapplyEvents(this._secondaryEvents)},_trigger:function(b,c){var d=c||this.dates.get(-1),e=this._utc_to_local(d);this.element.trigger({type:b,date:e,dates:a.map(this.dates,this._utc_to_local),format:a.proxy(function(a,b){0===arguments.length?(a=this.dates.length-1,b=this.o.format):"string"==typeof a&&(b=a,a=this.dates.length-1),b=b||this.o.format;var c=this.dates.get(a);return p.formatDate(c,b,this.o.language)},this)})},show:function(){this.isInline||this.picker.appendTo("body"),this.picker.show(),this.place(),this._attachSecondaryEvents(),this._trigger("show")},hide:function(){this.isInline||this.picker.is(":visible")&&(this.focusDate=null,this.picker.hide().detach(),this._detachSecondaryEvents(),this.viewMode=this.o.startView,this.showMode(),this.o.forceParse&&(this.isInput&&this.element.val()||this.hasInput&&this.element.find("input").val())&&this.setValue(),this._trigger("hide"))},remove:function(){this.hide(),this._detachEvents(),this._detachSecondaryEvents(),this.picker.remove(),delete this.element.data().cfdatepicker,this.isInput||delete this.element.data().date},_utc_to_local:function(a){return a&&new Date(a.getTime()+6e4*a.getTimezoneOffset())},_local_to_utc:function(a){return a&&new Date(a.getTime()-6e4*a.getTimezoneOffset())},_zero_time:function(a){return a&&new Date(a.getFullYear(),a.getMonth(),a.getDate())},_zero_utc_time:function(a){return a&&new Date(Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate()))},getDates:function(){return a.map(this.dates,this._utc_to_local)},getUTCDates:function(){return a.map(this.dates,function(a){return new Date(a)})},getDate:function(){return this._utc_to_local(this.getUTCDate())},getUTCDate:function(){return new Date(this.dates.get(-1))},setDates:function(){var b=a.isArray(arguments[0])?arguments[0]:arguments;this.update.apply(this,b),this._trigger("changeDate"),this.setValue()},setUTCDates:function(){var b=a.isArray(arguments[0])?arguments[0]:arguments;this.update.apply(this,a.map(b,this._utc_to_local)),this._trigger("changeDate"),this.setValue()},setDate:f("setDates"),setUTCDate:f("setUTCDates"),setValue:function(){var a=this.getFormattedDate();this.isInput?this.element.val(a).change():this.component&&this.element.find("input").val(a).change()},getFormattedDate:function(c){c===b&&(c=this.o.format);var d=this.o.language;return a.map(this.dates,function(a){return p.formatDate(a,c,d)}).join(this.o.multidateSeparator)},setStartDate:function(a){this._process_options({startDate:a}),this.update(),this.updateNavArrows()},setEndDate:function(a){this._process_options({endDate:a}),this.update(),this.updateNavArrows()},setDaysOfWeekDisabled:function(a){this._process_options({daysOfWeekDisabled:a}),this.update(),this.updateNavArrows()},place:function(){if(!this.isInline){var b=this.picker.outerWidth(),d=this.picker.outerHeight(),e=10,f=c.width(),g=c.height(),h=c.scrollTop(),i=parseInt(this.element.parents().filter(function(){return"auto"!==a(this).css("z-index")}).first().css("z-index"))+10,j=this.component?this.component.parent().offset():this.element.offset(),k=this.component?this.component.outerHeight(!0):this.element.outerHeight(!1),l=this.component?this.component.outerWidth(!0):this.element.outerWidth(!1),m=j.left,n=j.top;this.picker.removeClass("cfdatepicker-orient-top cfdatepicker-orient-bottom cfdatepicker-orient-right cfdatepicker-orient-left"),"auto"!==this.o.orientation.x?(this.picker.addClass("cfdatepicker-orient-"+this.o.orientation.x),"right"===this.o.orientation.x&&(m-=b-l)):(this.picker.addClass("cfdatepicker-orient-left"),j.left<0?m-=j.left-e:j.left+b>f&&(m=f-b-e));var p,q,o=this.o.orientation.y;"auto"===o&&(p=-h+j.top-d,q=h+g-(j.top+k+d),o=Math.max(p,q)===q?"top":"bottom"),this.picker.addClass("cfdatepicker-orient-"+o),"top"===o?n+=k:n-=d+parseInt(this.picker.css("padding-top")),this.picker.css({top:n,left:m,zIndex:i})}},_allow_update:!0,update:function(){if(this._allow_update){var b=this.dates.copy(),c=[],d=!1;arguments.length?(a.each(arguments,a.proxy(function(a,b){b instanceof Date&&(b=this._local_to_utc(b)),c.push(b)},this)),d=!0):(c=this.isInput?this.element.val():this.element.data("date")||this.element.find("input").val(),c=c&&this.o.multidate?c.split(this.o.multidateSeparator):[c],delete this.element.data().date),c=a.map(c,a.proxy(function(a){return p.parseDate(a,this.o.format,this.o.language)},this)),c=a.grep(c,a.proxy(function(a){return a<this.o.startDate||a>this.o.endDate||!a},this),!0),this.dates.replace(c),this.dates.length?this.viewDate=new Date(this.dates.get(-1)):this.viewDate<this.o.startDate?this.viewDate=new Date(this.o.startDate):this.viewDate>this.o.endDate&&(this.viewDate=new Date(this.o.endDate)),d?this.setValue():c.length&&String(b)!==String(this.dates)&&this._trigger("changeDate"),!this.dates.length&&b.length&&this._trigger("clearDate"),this.fill()}},fillDow:function(){var a=this.o.weekStart,b="<tr>";if(this.o.calendarWeeks){var c='<th class="cw"> </th>';b+=c,this.picker.find(".cfdatepicker-days thead tr:first-child").prepend(c)}for(;a<this.o.weekStart+7;)b+='<th class="dow">'+o[this.o.language].daysMin[a++%7]+"</th>";b+="</tr>",this.picker.find(".cfdatepicker-days thead").append(b)},fillMonths:function(){for(var a="",b=0;12>b;)a+='<span class="month">'+o[this.o.language].monthsShort[b++]+"</span>";this.picker.find(".cfdatepicker-months td").html(a)},setRange:function(b){b&&b.length?this.range=a.map(b,function(a){return a.valueOf()}):delete this.range,this.fill()},getClassNames:function(b){var c=[],d=this.viewDate.getUTCFullYear(),e=this.viewDate.getUTCMonth(),f=new Date;return b.getUTCFullYear()<d||b.getUTCFullYear()===d&&b.getUTCMonth()<e?c.push("old"):(b.getUTCFullYear()>d||b.getUTCFullYear()===d&&b.getUTCMonth()>e)&&c.push("new"),this.focusDate&&b.valueOf()===this.focusDate.valueOf()&&c.push("focused"),this.o.todayHighlight&&b.getUTCFullYear()===f.getFullYear()&&b.getUTCMonth()===f.getMonth()&&b.getUTCDate()===f.getDate()&&c.push("today"),-1!==this.dates.contains(b)&&c.push("active"),(b.valueOf()<this.o.startDate||b.valueOf()>this.o.endDate||-1!==a.inArray(b.getUTCDay(),this.o.daysOfWeekDisabled))&&c.push("disabled"),this.range&&(b>this.range[0]&&b<this.range[this.range.length-1]&&c.push("range"),-1!==a.inArray(b.valueOf(),this.range)&&c.push("selected")),c},fill:function(){var m,c=new Date(this.viewDate),e=c.getUTCFullYear(),f=c.getUTCMonth(),g=this.o.startDate!==-1/0?this.o.startDate.getUTCFullYear():-1/0,h=this.o.startDate!==-1/0?this.o.startDate.getUTCMonth():-1/0,i=1/0!==this.o.endDate?this.o.endDate.getUTCFullYear():1/0,j=1/0!==this.o.endDate?this.o.endDate.getUTCMonth():1/0,k=o[this.o.language].today||o.en.today||"",l=o[this.o.language].clear||o.en.clear||"";this.picker.find(".cfdatepicker-days thead th.cfdatepicker-switch").text(o[this.o.language].months[f]+" "+e),this.picker.find("tfoot th.today").text(k).toggle(this.o.todayBtn!==!1),this.picker.find("tfoot th.clear").text(l).toggle(this.o.clearBtn!==!1),this.updateNavArrows(),this.fillMonths();var n=d(e,f-1,28),q=p.getDaysInMonth(n.getUTCFullYear(),n.getUTCMonth());n.setUTCDate(q),n.setUTCDate(q-(n.getUTCDay()-this.o.weekStart+7)%7);var r=new Date(n);r.setUTCDate(r.getUTCDate()+42),r=r.valueOf();for(var t,s=[];n.valueOf()<r;){if(n.getUTCDay()===this.o.weekStart&&(s.push("<tr>"),this.o.calendarWeeks)){var u=new Date(+n+864e5*((this.o.weekStart-n.getUTCDay()-7)%7)),v=new Date(Number(u)+864e5*((11-u.getUTCDay())%7)),w=new Date(Number(w=d(v.getUTCFullYear(),0,1))+864e5*((11-w.getUTCDay())%7)),x=(v-w)/864e5/7+1;s.push('<td class="cw">'+x+"</td>")}if(t=this.getClassNames(n),t.push("day"),this.o.beforeShowDay!==a.noop){var y=this.o.beforeShowDay(this._utc_to_local(n));y===b?y={}:"boolean"==typeof y?y={enabled:y}:"string"==typeof y&&(y={classes:y}),y.enabled===!1&&t.push("disabled"),y.classes&&(t=t.concat(y.classes.split(/\s+/))),y.tooltip&&(m=y.tooltip)}t=a.unique(t),s.push('<td class="'+t.join(" ")+'"'+(m?' title="'+m+'"':"")+">"+n.getUTCDate()+"</td>"),n.getUTCDay()===this.o.weekEnd&&s.push("</tr>"),n.setUTCDate(n.getUTCDate()+1)}this.picker.find(".cfdatepicker-days tbody").empty().append(s.join(""));var z=this.picker.find(".cfdatepicker-months").find("th:eq(1)").text(e).end().find("span").removeClass("active");a.each(this.dates,function(a,b){b.getUTCFullYear()===e&&z.eq(b.getUTCMonth()).addClass("active")}),(g>e||e>i)&&z.addClass("disabled"),e===g&&z.slice(0,h).addClass("disabled"),e===i&&z.slice(j+1).addClass("disabled"),s="",e=10*parseInt(e/10,10);var A=this.picker.find(".cfdatepicker-years").find("th:eq(1)").text(e+"-"+(e+9)).end().find("td");e-=1;for(var C,B=a.map(this.dates,function(a){return a.getUTCFullYear()}),D=-1;11>D;D++)C=["year"],-1===D?C.push("old"):10===D&&C.push("new"),-1!==a.inArray(e,B)&&C.push("active"),(g>e||e>i)&&C.push("disabled"),s+='<span class="'+C.join(" ")+'">'+e+"</span>",e+=1;A.html(s)},updateNavArrows:function(){if(this._allow_update){var a=new Date(this.viewDate),b=a.getUTCFullYear(),c=a.getUTCMonth();switch(this.viewMode){case 0:this.o.startDate!==-1/0&&b<=this.o.startDate.getUTCFullYear()&&c<=this.o.startDate.getUTCMonth()?this.picker.find(".prev").css({visibility:"hidden"}):this.picker.find(".prev").css({visibility:"visible"}),1/0!==this.o.endDate&&b>=this.o.endDate.getUTCFullYear()&&c>=this.o.endDate.getUTCMonth()?this.picker.find(".next").css({visibility:"hidden"}):this.picker.find(".next").css({visibility:"visible"});break;case 1:case 2:this.o.startDate!==-1/0&&b<=this.o.startDate.getUTCFullYear()?this.picker.find(".prev").css({visibility:"hidden"}):this.picker.find(".prev").css({visibility:"visible"}),1/0!==this.o.endDate&&b>=this.o.endDate.getUTCFullYear()?this.picker.find(".next").css({visibility:"hidden"}):this.picker.find(".next").css({visibility:"visible"})}}},click:function(b){b.preventDefault();var e,f,g,c=a(b.target).closest("span, td, th");if(1===c.length)switch(c[0].nodeName.toLowerCase()){case"th":switch(c[0].className){case"cfdatepicker-switch":this.showMode(1);break;case"prev":case"next":var h=p.modes[this.viewMode].navStep*("prev"===c[0].className?-1:1);switch(this.viewMode){case 0:this.viewDate=this.moveMonth(this.viewDate,h),this._trigger("changeMonth",this.viewDate);break;case 1:case 2:this.viewDate=this.moveYear(this.viewDate,h),1===this.viewMode&&this._trigger("changeYear",this.viewDate)}this.fill();break;case"today":var i=new Date;i=d(i.getFullYear(),i.getMonth(),i.getDate(),0,0,0),this.showMode(-2);var j="linked"===this.o.todayBtn?null:"view";this._setDate(i,j);break;case"clear":var k;this.isInput?k=this.element:this.component&&(k=this.element.find("input")),k&&k.val("").change(),this.update(),this._trigger("changeDate"),this.o.autoclose&&this.hide()}break;case"span":c.is(".disabled")||(this.viewDate.setUTCDate(1),c.is(".month")?(g=1,f=c.parent().find("span").index(c),e=this.viewDate.getUTCFullYear(),this.viewDate.setUTCMonth(f),this._trigger("changeMonth",this.viewDate),1===this.o.minViewMode&&this._setDate(d(e,f,g))):(g=1,f=0,e=parseInt(c.text(),10)||0,this.viewDate.setUTCFullYear(e),this._trigger("changeYear",this.viewDate),2===this.o.minViewMode&&this._setDate(d(e,f,g))),this.showMode(-1),this.fill());break;case"td":c.is(".day")&&!c.is(".disabled")&&(g=parseInt(c.text(),10)||1,e=this.viewDate.getUTCFullYear(),f=this.viewDate.getUTCMonth(),c.is(".old")?0===f?(f=11,e-=1):f-=1:c.is(".new")&&(11===f?(f=0,e+=1):f+=1),this._setDate(d(e,f,g)))}this.picker.is(":visible")&&this._focused_from&&a(this._focused_from).focus(),delete this._focused_from},_toggle_multidate:function(a){var b=this.dates.contains(a);if(a?-1!==b?this.dates.remove(b):this.dates.push(a):this.dates.clear(),"number"==typeof this.o.multidate)for(;this.dates.length>this.o.multidate;)this.dates.remove(0)},_setDate:function(a,b){b&&"date"!==b||this._toggle_multidate(a&&new Date(a)),b&&"view"!==b||(this.viewDate=a&&new Date(a)),this.fill(),this.setValue(),this._trigger("changeDate");var c;this.isInput?c=this.element:this.component&&(c=this.element.find("input")),c&&c.change(),!this.o.autoclose||b&&"date"!==b||this.hide()},moveMonth:function(a,c){if(!a)return b;if(!c)return a;var h,i,d=new Date(a.valueOf()),e=d.getUTCDate(),f=d.getUTCMonth(),g=Math.abs(c);if(c=c>0?1:-1,1===g)i=-1===c?function(){return d.getUTCMonth()===f}:function(){return d.getUTCMonth()!==h},h=f+c,d.setUTCMonth(h),(0>h||h>11)&&(h=(h+12)%12);else{for(var j=0;g>j;j++)d=this.moveMonth(d,c);h=d.getUTCMonth(),d.setUTCDate(e),i=function(){return h!==d.getUTCMonth()}}for(;i();)d.setUTCDate(--e),d.setUTCMonth(h);return d},moveYear:function(a,b){return this.moveMonth(a,12*b)},dateWithinRange:function(a){return a>=this.o.startDate&&a<=this.o.endDate},keydown:function(a){if(this.picker.is(":not(:visible)"))return 27===a.keyCode&&this.show(),void 0;var c,d,f,b=!1,g=this.focusDate||this.viewDate;switch(a.keyCode){case 27:this.focusDate?(this.focusDate=null,this.viewDate=this.dates.get(-1)||this.viewDate,this.fill()):this.hide(),a.preventDefault();break;case 37:case 39:if(!this.o.keyboardNavigation)break;c=37===a.keyCode?-1:1,a.ctrlKey?(d=this.moveYear(this.dates.get(-1)||e(),c),f=this.moveYear(g,c),this._trigger("changeYear",this.viewDate)):a.shiftKey?(d=this.moveMonth(this.dates.get(-1)||e(),c),f=this.moveMonth(g,c),this._trigger("changeMonth",this.viewDate)):(d=new Date(this.dates.get(-1)||e()),d.setUTCDate(d.getUTCDate()+c),f=new Date(g),f.setUTCDate(g.getUTCDate()+c)),this.dateWithinRange(d)&&(this.focusDate=this.viewDate=f,this.setValue(),this.fill(),a.preventDefault());break;case 38:case 40:if(!this.o.keyboardNavigation)break;c=38===a.keyCode?-1:1,a.ctrlKey?(d=this.moveYear(this.dates.get(-1)||e(),c),f=this.moveYear(g,c),this._trigger("changeYear",this.viewDate)):a.shiftKey?(d=this.moveMonth(this.dates.get(-1)||e(),c),f=this.moveMonth(g,c),this._trigger("changeMonth",this.viewDate)):(d=new Date(this.dates.get(-1)||e()),d.setUTCDate(d.getUTCDate()+7*c),f=new Date(g),f.setUTCDate(g.getUTCDate()+7*c)),this.dateWithinRange(d)&&(this.focusDate=this.viewDate=f,this.setValue(),this.fill(),a.preventDefault());break;case 32:break;case 13:g=this.focusDate||this.dates.get(-1)||this.viewDate,this._toggle_multidate(g),b=!0,this.focusDate=null,this.viewDate=this.dates.get(-1)||this.viewDate,this.setValue(),this.fill(),this.picker.is(":visible")&&(a.preventDefault(),this.o.autoclose&&this.hide());break;case 9:this.focusDate=null,this.viewDate=this.dates.get(-1)||this.viewDate,this.fill(),this.hide()}if(b){this.dates.length?this._trigger("changeDate"):this._trigger("clearDate");var h;this.isInput?h=this.element:this.component&&(h=this.element.find("input")),h&&h.change()}},showMode:function(a){a&&(this.viewMode=Math.max(this.o.minViewMode,Math.min(2,this.viewMode+a))),this.picker.find(">div").hide().filter(".cfdatepicker-"+p.modes[this.viewMode].clsName).css("display","block"),this.updateNavArrows()}};var i=function(b,c){this.element=a(b),this.inputs=a.map(c.inputs,function(a){return a.jquery?a[0]:a}),delete c.inputs,a(this.inputs).cfdatepicker(c).bind("changeDate",a.proxy(this.dateUpdated,this)),this.pickers=a.map(this.inputs,function(b){return a(b).data("cfdatepicker")}),this.updateDates()};i.prototype={updateDates:function(){this.dates=a.map(this.pickers,function(a){return a.getUTCDate()}),this.updateRanges()},updateRanges:function(){var b=a.map(this.dates,function(a){return a.valueOf()});a.each(this.pickers,function(a,c){c.setRange(b)})},dateUpdated:function(b){if(!this.updating){this.updating=!0;var c=a(b.target).data("cfdatepicker"),d=c.getUTCDate(),e=a.inArray(b.target,this.inputs),f=this.inputs.length;if(-1!==e){if(a.each(this.pickers,function(a,b){b.getUTCDate()||b.setUTCDate(d)}),d<this.dates[e])for(;e>=0&&d<this.dates[e];)this.pickers[e--].setUTCDate(d);else if(d>this.dates[e])for(;f>e&&d>this.dates[e];)this.pickers[e++].setUTCDate(d);this.updateDates(),delete this.updating}}},remove:function(){a.map(this.pickers,function(a){a.remove()}),delete this.element.data().cfdatepicker}};var l=a.fn.cfdatepicker;a.fn.cfdatepicker=function(c){var d=Array.apply(null,arguments);d.shift();var e;return this.each(function(){var f=a(this),g=f.data("cfdatepicker"),l="object"==typeof c&&c;if(!g){var n=j(this,"date"),o=a.extend({},m,n,l),p=k(o.language),q=a.extend({},m,p,n,l);if(f.is(".input-daterange")||q.inputs){var r={inputs:q.inputs||f.find("input").toArray()};f.data("cfdatepicker",g=new i(this,a.extend(q,r)))}else f.data("cfdatepicker",g=new h(this,q))}return"string"==typeof c&&"function"==typeof g[c]&&(e=g[c].apply(g,d),e!==b)?!1:void 0}),e!==b?e:this};var m=a.fn.cfdatepicker.defaults={autoclose:!1,beforeShowDay:a.noop,calendarWeeks:!1,clearBtn:!1,daysOfWeekDisabled:[],endDate:1/0,forceParse:!0,format:"mm/dd/yyyy",keyboardNavigation:!0,language:"en",minViewMode:0,multidate:!1,multidateSeparator:",",orientation:"auto",rtl:!1,startDate:-1/0,startView:0,todayBtn:!1,todayHighlight:!1,weekStart:0},n=a.fn.cfdatepicker.locale_opts=["format","rtl","weekStart"];a.fn.cfdatepicker.Constructor=h;var o=a.fn.cfdatepicker.dates={en:{days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],daysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sun"],daysMin:["Su","Mo","Tu","We","Th","Fr","Sa","Su"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],today:"Today",clear:"Clear"}},p={modes:[{clsName:"days",navFnc:"Month",navStep:1},{clsName:"months",navFnc:"FullYear",navStep:1},{clsName:"years",navFnc:"FullYear",navStep:10}],isLeapYear:function(a){return 0===a%4&&0!==a%100||0===a%400},getDaysInMonth:function(a,b){return[31,p.isLeapYear(a)?29:28,31,30,31,30,31,31,30,31,30,31][b]},validParts:/dd?|DD?|mm?|MM?|yy(?:yy)?/g,nonpunctuation:/[^ -\/:-@\[\u3400-\u9fff-`{-~\t\n\r]+/g,parseFormat:function(a){var b=a.replace(this.validParts,"\0").split("\0"),c=a.match(this.validParts);
|
2 |
-
if(!b||!b.length||!c||0===c.length)throw new Error("Invalid date format.");return{separators:b,parts:c}},parseDate:function(c,e,f){function u(){var a=this.slice(0,i[l].length),b=i[l].slice(0,a.length);return a===b}if(!c)return b;if(c instanceof Date)return c;"string"==typeof e&&(e=p.parseFormat(e));var j,k,l,g=/([\-+]\d+)([dmwy])/,i=c.match(/([\-+]\d+)([dmwy])/g);if(/^[\-+]\d+[dmwy]([\s,]+[\-+]\d+[dmwy])*$/.test(c)){for(c=new Date,l=0;l<i.length;l++)switch(j=g.exec(i[l]),k=parseInt(j[1]),j[2]){case"d":c.setUTCDate(c.getUTCDate()+k);break;case"m":c=h.prototype.moveMonth.call(h.prototype,c,k);break;case"w":c.setUTCDate(c.getUTCDate()+7*k);break;case"y":c=h.prototype.moveYear.call(h.prototype,c,k)}return d(c.getUTCFullYear(),c.getUTCMonth(),c.getUTCDate(),0,0,0)}i=c&&c.match(this.nonpunctuation)||[],c=new Date;var r,s,m={},n=["yyyy","yy","M","MM","m","mm","d","dd"],q={yyyy:function(a,b){return a.setUTCFullYear(b)},yy:function(a,b){return a.setUTCFullYear(2e3+b)},m:function(a,b){if(isNaN(a))return a;for(b-=1;0>b;)b+=12;for(b%=12,a.setUTCMonth(b);a.getUTCMonth()!==b;)a.setUTCDate(a.getUTCDate()-1);return a},d:function(a,b){return a.setUTCDate(b)}};q.M=q.MM=q.mm=q.m,q.dd=q.d,c=d(c.getFullYear(),c.getMonth(),c.getDate(),0,0,0);var t=e.parts.slice();if(i.length!==t.length&&(t=a(t).filter(function(b,c){return-1!==a.inArray(c,n)}).toArray()),i.length===t.length){var v;for(l=0,v=t.length;v>l;l++){if(r=parseInt(i[l],10),j=t[l],isNaN(r))switch(j){case"MM":s=a(o[f].months).filter(u),r=a.inArray(s[0],o[f].months)+1;break;case"M":s=a(o[f].monthsShort).filter(u),r=a.inArray(s[0],o[f].monthsShort)+1}m[j]=r}var w,x;for(l=0;l<n.length;l++)x=n[l],x in m&&!isNaN(m[x])&&(w=new Date(c),q[x](w,m[x]),isNaN(w)||(c=w))}return c},formatDate:function(b,c,d){if(!b)return"";"string"==typeof c&&(c=p.parseFormat(c));var e={d:b.getUTCDate(),D:o[d].daysShort[b.getUTCDay()],DD:o[d].days[b.getUTCDay()],m:b.getUTCMonth()+1,M:o[d].monthsShort[b.getUTCMonth()],MM:o[d].months[b.getUTCMonth()],yy:b.getUTCFullYear().toString().substring(2),yyyy:b.getUTCFullYear()};e.dd=(e.d<10?"0":"")+e.d,e.mm=(e.m<10?"0":"")+e.m,b=[];for(var f=a.extend([],c.separators),g=0,h=c.parts.length;h>=g;g++)f.length&&b.push(f.shift()),b.push(e[c.parts[g]]);return b.join("")},headTemplate:'<thead><tr><th class="prev">«</th><th colspan="5" class="cfdatepicker-switch"></th><th class="next">»</th></tr></thead>',contTemplate:'<tbody><tr><td colspan="7"></td></tr></tbody>',footTemplate:'<tfoot><tr><th colspan="7" class="today"></th></tr><tr><th colspan="7" class="clear"></th></tr></tfoot>'};p.template='<div class="cfdatepicker"><div class="cfdatepicker-days"><table class=" table-condensed">'+p.headTemplate+"<tbody></tbody>"+p.footTemplate+"</table>"+"</div>"+'<div class="cfdatepicker-months">'+'<table class="table-condensed">'+p.headTemplate+p.contTemplate+p.footTemplate+"</table>"+"</div>"+'<div class="cfdatepicker-years">'+'<table class="table-condensed">'+p.headTemplate+p.contTemplate+p.footTemplate+"</table>"+"</div>"+"</div>",a.fn.cfdatepicker.DPGlobal=p,a.fn.cfdatepicker.noConflict=function(){return a.fn.cfdatepicker=l,this},a(document).on("focus.cfdatepicker.data-api click.cfdatepicker.data-api",'[data-provide="cfdatepicker"]',function(b){var c=a(this);c.data("cfdatepicker")||(b.preventDefault(),c.cfdatepicker("show"))}),a(function(){a('[data-provide="cfdatepicker-inline"]').cfdatepicker()})}(window.jQuery),jQuery(function(a){a(".caldera-editor-body").on("keyup",".cfdatepicker-set-format",function(){var b=a(this),c=b.closest(".caldera-config-field-setup").find(".is-cfdatepicker");c.data("date-format",b.val()),c.cfdatepicker("remove")})}),!function(a){function b(a){var b=document.createElement("input"),c="on"+a,d=c in b;return d||(b.setAttribute(c,"return;"),d="function"==typeof b[c]),b=null,d}function c(a){var b="text"==a||"tel"==a;if(!b){var c=document.createElement("input");c.setAttribute("type",a),b="text"===c.type,c=null}return b}function d(b,c,e){var f=e.aliases[b];return f?(f.alias&&d(f.alias,void 0,e),a.extend(!0,e,f),a.extend(!0,e,c),!0):!1}function e(b,c){function d(a){function c(a,b,c,d){this.matches=[],this.isGroup=a||!1,this.isOptional=b||!1,this.isQuantifier=c||!1,this.isAlternator=d||!1,this.quantifier={min:1,max:1}}function d(a,c,d){var e=b.definitions[c],f=0==a.matches.length;if(d=void 0!=d?d:a.matches.length,e&&!l){for(var g=e.precheck,h=g?g.length:0,i=1;i<e.cardinality;i++){var j=h>=i?g[i-1]:[],k=j.validator,m=j.cardinality;a.matches.splice(d++,0,{fn:k?"string"==typeof k?new RegExp(k):new function(){this.test=k}:new RegExp("."),cardinality:m?m:1,optionality:a.isOptional,newBlockMarker:f,casing:e.casing,def:e.definitionSymbol||c,placeholder:e.placeholder,mask:c})}a.matches.splice(d++,0,{fn:e.validator?"string"==typeof e.validator?new RegExp(e.validator):new function(){this.test=e.validator}:new RegExp("."),cardinality:e.cardinality,optionality:a.isOptional,newBlockMarker:f,casing:e.casing,def:e.definitionSymbol||c,placeholder:e.placeholder,mask:c})}else a.matches.splice(d++,0,{fn:null,cardinality:0,optionality:a.isOptional,newBlockMarker:f,casing:null,def:c,placeholder:void 0,mask:c}),l=!1}for(var e,f,g,h,i,j,k=/(?:[?*+]|\{[0-9\+\*]+(?:,[0-9\+\*]*)?\})\??|[^.?*+^${[]()|\\]+|./g,l=!1,m=new c,n=[],o=[];e=k.exec(a);)switch(f=e[0],f.charAt(0)){case b.optionalmarker.end:case b.groupmarker.end:if(g=n.pop(),n.length>0){if(h=n[n.length-1],h.matches.push(g),h.isAlternator){i=n.pop();for(var p=0;p<i.matches.length;p++)i.matches[p].isGroup=!1;n.length>0?(h=n[n.length-1],h.matches.push(i)):m.matches.push(i)}}else m.matches.push(g);break;case b.optionalmarker.start:n.push(new c(!1,!0));break;case b.groupmarker.start:n.push(new c(!0));break;case b.quantifiermarker.start:var q=new c(!1,!1,!0);f=f.replace(/[{}]/g,"");var r=f.split(","),s=isNaN(r[0])?r[0]:parseInt(r[0]),t=1==r.length?s:isNaN(r[1])?r[1]:parseInt(r[1]);if(("*"==t||"+"==t)&&(s="*"==t?0:1),q.quantifier={min:s,max:t},n.length>0){var u=n[n.length-1].matches;if(e=u.pop(),!e.isGroup){var v=new c(!0);v.matches.push(e),e=v}u.push(e),u.push(q)}else{if(e=m.matches.pop(),!e.isGroup){var v=new c(!0);v.matches.push(e),e=v}m.matches.push(e),m.matches.push(q)}break;case b.escapeChar:l=!0;break;case b.alternatormarker:n.length>0?(h=n[n.length-1],j=h.matches.pop()):j=m.matches.pop(),j.isAlternator?n.push(j):(i=new c(!1,!1,!1,!0),i.matches.push(j),n.push(i));break;default:if(n.length>0){if(h=n[n.length-1],h.matches.length>0&&(j=h.matches[h.matches.length-1],j.isGroup&&(j.isGroup=!1,d(j,b.groupmarker.start,0),d(j,b.groupmarker.end))),d(h,f),h.isAlternator){i=n.pop();for(var p=0;p<i.matches.length;p++)i.matches[p].isGroup=!1;n.length>0?(h=n[n.length-1],h.matches.push(i)):m.matches.push(i)}}else m.matches.length>0&&(j=m.matches[m.matches.length-1],j.isGroup&&(j.isGroup=!1,d(j,b.groupmarker.start,0),d(j,b.groupmarker.end))),d(m,f)}return m.matches.length>0&&(j=m.matches[m.matches.length-1],j.isGroup&&(j.isGroup=!1,d(j,b.groupmarker.start,0),d(j,b.groupmarker.end)),o.push(m)),o}function e(c,e){if(b.numericInput&&b.multi!==!0){c=c.split("").reverse();for(var f=0;f<c.length;f++)c[f]==b.optionalmarker.start?c[f]=b.optionalmarker.end:c[f]==b.optionalmarker.end?c[f]=b.optionalmarker.start:c[f]==b.groupmarker.start?c[f]=b.groupmarker.end:c[f]==b.groupmarker.end&&(c[f]=b.groupmarker.start);c=c.join("")}if(void 0==c||""==c)return void 0;if(1==c.length&&0==b.greedy&&0!=b.repeat&&(b.placeholder=""),b.repeat>0||"*"==b.repeat||"+"==b.repeat){var g="*"==b.repeat?0:"+"==b.repeat?1:b.repeat;c=b.groupmarker.start+c+b.groupmarker.end+b.quantifiermarker.start+g+","+b.repeat+b.quantifiermarker.end}return void 0==a.inputmask.masksCache[c]&&(a.inputmask.masksCache[c]={mask:c,maskToken:d(c),validPositions:{},_buffer:void 0,buffer:void 0,tests:{},metadata:e}),a.extend(!0,{},a.inputmask.masksCache[c])}var f=void 0;if(a.isFunction(b.mask)&&(b.mask=b.mask.call(this,b)),a.isArray(b.mask))if(c)f=[],a.each(b.mask,function(b,c){f.push(void 0==c.mask||a.isFunction(c.mask)?e(c.toString(),c):e(c.mask.toString(),c))});else{b.keepStatic=void 0==b.keepStatic?!0:b.keepStatic;var g="(";a.each(b.mask,function(b,c){g.length>1&&(g+=")|("),g+=void 0==c.mask||a.isFunction(c.mask)?c.toString():c.mask.toString()}),g+=")",f=e(g,b.mask)}else b.mask&&(f=void 0==b.mask.mask||a.isFunction(b.mask.mask)?e(b.mask.toString(),b.mask):e(b.mask.mask.toString(),b.mask));return f}function f(d,e,f){function h(a,b,c){b=b||0;var d,e,f,g=[],h=0;do{if(a===!0&&o().validPositions[h]){var i=o().validPositions[h];e=i.match,d=i.locator.slice(),g.push(c===!0?i.input:I(h,e))}else{if(b>h){var j=w(h,d,h-1);f=j[0]}else f=t(h,d,h-1);e=f.match,d=f.locator.slice(),g.push(I(h,e))}h++}while((void 0==fb||fb>h-1)&&null!=e.fn||null==e.fn&&""!=e.def||b>=h);return g.pop(),g}function o(){return e}function p(a){var b=o();b.buffer=void 0,b.tests={},a!==!0&&(b._buffer=void 0,b.validPositions={},b.p=0)}function q(a){var b=o(),c=-1,d=b.validPositions;void 0==a&&(a=-1);var e=c,f=c;for(var g in d){var h=parseInt(g);(-1==a||null!=d[h].match.fn)&&(a>h&&(e=h),h>=a&&(f=h))}return c=a-e>1||a>f?e:f}function r(b,c,d){if(f.insertMode&&void 0!=o().validPositions[b]&&void 0==d){var e,g=a.extend(!0,{},o().validPositions),h=q();for(e=b;h>=e;e++)delete o().validPositions[e];o().validPositions[b]=c;var i,j=!0;for(e=b;h>=e;e++){var k=g[e];if(void 0!=k){var l=o().validPositions;i=!f.keepStatic&&(void 0!=l[e+1]&&w(e+1,l[e].locator.slice(),e).length>1||l[e]&&void 0!=l[e].alternation)?e+1:E(e),j=v(i,k.match.def)?j&&B(i,k.input,!0,!0)!==!1:null==k.match.fn}if(!j)break}if(!j)return o().validPositions=a.extend(!0,{},g),!1}else o().validPositions[b]=c;return!0}function s(a,b){var c,d=a;for(void 0!=o().validPositions[a]&&o().validPositions[a].input==f.radixPoint&&(b++,d++),c=d;b>c;c++)void 0==o().validPositions[c]||o().validPositions[c].input==f.radixPoint&&c!=q()||delete o().validPositions[c];for(c=b;c<=q();){var e=o().validPositions[c],g=o().validPositions[d];void 0!=e&&void 0==g?(v(d,e.match.def)&&B(d,e.input,!0)!==!1&&(delete o().validPositions[c],c++),d++):c++}var h=q();h>=a&&void 0!=o().validPositions[h]&&o().validPositions[h].input==f.radixPoint&&delete o().validPositions[h],p(!0)}function t(b,c,d){function e(b,c,d){for(var e=!1,f=b.locator[c].toString().split(","),g=0;g<f.length;g++)if(-1!=a.inArray(f[g],d)){e=!0;break}return e}for(var g,h=w(b,c,d),i=q(),j=o().validPositions[i]||w(0)[0],k=void 0!=j.alternation?j.locator[j.alternation].split(","):[],l=0;l<h.length&&(g=h[l],!(f.greedy||g.match&&(g.match.optionality===!1||g.match.newBlockMarker===!1)&&g.match.optionalQuantifier!==!0&&(void 0==j.alternation||void 0!=g.locator[j.alternation]&&e(g,j.alternation,k))));l++);return g}function u(a){return o().validPositions[a]?o().validPositions[a].match:w(a)[0].match}function v(a,b){for(var c=!1,d=w(a),e=0;e<d.length;e++)if(d[e].match&&d[e].match.def==b){c=!0;break}return c}function w(b,c,d){function e(c,d,g,i){function l(g,i,n){if(h>1e4)return alert("jquery.inputmask: There is probably an error in your mask definition or in the code. Create an issue on github with an example of the mask you are using. "+o().mask),!0;if(h==b&&void 0==g.matches)return j.push({match:g,locator:i.reverse()}),!0;if(void 0!=g.matches){if(g.isGroup&&n!==!0){if(g=l(c.matches[m+1],i))return!0}else if(g.isOptional){var p=g;if(g=e(g,d,i,n)){var q=j[j.length-1].match,r=0==a.inArray(q,p.matches);r&&(k=!0),h=b}}else if(g.isAlternator){var s,t=g,u=[],v=j.slice(),w=i.length,x=d.length>0?d.shift():-1;if(-1==x||"string"==typeof x){var y,z=h,A=d.slice();"string"==typeof x&&(y=x.split(","));for(var B=0;B<t.matches.length;B++){j=[],g=l(t.matches[B],[B].concat(i),n)||g,s=j.slice(),h=z,j=[];for(var C=0;C<A.length;C++)d[C]=A[C];for(var D=0;D<s.length;D++)for(var E=s[D],F=0;F<u.length;F++){var G=u[F];if(E.match.mask==G.match.mask&&("string"!=typeof x||-1!=a.inArray(E.locator[w].toString(),y))){s.splice(D,1),G.locator[w]=G.locator[w]+","+E.locator[w],G.alternation=w;break}}u=u.concat(s)}"string"==typeof x&&(u=a.map(u,function(b,c){if(isFinite(c)){var d,e=b.locator[w].toString().split(",");b.locator[w]=void 0,b.alternation=void 0;for(var f=0;f<e.length;f++)d=-1!=a.inArray(e[f],y),d&&(void 0!=b.locator[w]?(b.locator[w]+=",",b.alternation=w,b.locator[w]+=e[f]):b.locator[w]=parseInt(e[f]));if(void 0!=b.locator[w])return b}})),j=v.concat(u),k=!0}else g=l(t.matches[x],[x].concat(i),n);if(g)return!0}else if(g.isQuantifier&&n!==!0){var H=g;f.greedy=f.greedy&&isFinite(H.quantifier.max);for(var I=d.length>0&&n!==!0?d.shift():0;I<(isNaN(H.quantifier.max)?I+1:H.quantifier.max)&&b>=h;I++){var J=c.matches[a.inArray(H,c.matches)-1];if(g=l(J,[I].concat(i),!0)){var q=j[j.length-1].match;q.optionalQuantifier=I>H.quantifier.min-1;var r=0==a.inArray(q,J.matches);if(r){if(I>H.quantifier.min-1){k=!0,h=b;break}return!0}return!0}}}else if(g=e(g,d,i,n))return!0}else h++}for(var m=d.length>0?d.shift():0;m<c.matches.length;m++)if(c.matches[m].isQuantifier!==!0){var n=l(c.matches[m],[m].concat(g),i);if(n&&h==b)return n;if(h>b)break}}var g=o().maskToken,h=c?d:0,i=c||[0],j=[],k=!1;if(void 0==c){for(var l,m=b-1;void 0==(l=o().validPositions[m])&&m>-1;)m--;if(void 0!=l&&m>-1)h=m,i=l.locator.slice();else{for(m=b-1;void 0==(l=o().tests[m])&&m>-1;)m--;void 0!=l&&m>-1&&(h=m,i=l[0].locator.slice())}}for(var n=i.shift();n<g.length;n++){var p=e(g[n],i,[n]);if(p&&h==b||h>b)break}return(0==j.length||k)&&j.push({match:{fn:null,cardinality:0,optionality:!0,casing:null,def:""},locator:[]}),o().tests[b]=a.extend(!0,[],j),o().tests[b]}function x(){return void 0==o()._buffer&&(o()._buffer=h(!1,1)),o()._buffer}function y(){return void 0==o().buffer&&(o().buffer=h(!0,q(),!0)),o().buffer}function z(a,b){var c=y().slice();if(a===!0)p(),a=0,b=c.length;else for(var d=a;b>d;d++)delete o().validPositions[d],delete o().tests[d];for(var d=a;b>d;d++)c[d]!=f.skipOptionalPartCharacter&&B(d,c[d],!0,!0)}function A(a,b){switch(b.casing){case"upper":a=a.toUpperCase();break;case"lower":a=a.toLowerCase()}return a}function B(b,c,d,e){function g(b,c,d,e){var g=!1;return a.each(w(b),function(h,i){for(var j=i.match,k=c?1:0,l="",m=(y(),j.cardinality);m>k;m--)l+=G(b-(m-1));if(c&&(l+=c),g=null!=j.fn?j.fn.test(l,o(),b,d,f):c!=j.def&&c!=f.skipOptionalPartCharacter||""==j.def?!1:{c:j.def,pos:b},g!==!1){var n=void 0!=g.c?g.c:c;n=n==f.skipOptionalPartCharacter&&null===j.fn?j.def:n;var t=b;if(void 0!=g.remove&&s(g.remove,g.remove+1),g.refreshFromBuffer){var u=g.refreshFromBuffer;if(d=!0,z(u===!0?u:u.start,u.end),void 0==g.pos&&void 0==g.c)return g.pos=q(),!1;if(t=void 0!=g.pos?g.pos:b,t!=b)return g=a.extend(g,B(t,n,!0)),!1}else if(g!==!0&&void 0!=g.pos&&g.pos!=b&&(t=g.pos,z(b,t),t!=b))return g=a.extend(g,B(t,n,!0)),!1;return 1!=g&&void 0==g.pos&&void 0==g.c?!1:(h>0&&p(!0),r(t,a.extend({},i,{input:A(n,j)}),e)||(g=!1),!1)}}),g}function h(b,c,d,e){var g,h,i=a.extend(!0,{},o().validPositions);for(g=q();g>=0;g--)if(o().validPositions[g]&&void 0!=o().validPositions[g].alternation){h=o().validPositions[g].alternation;break}if(void 0!=h)for(var j in o().validPositions)if(parseInt(j)>parseInt(g)&&void 0===o().validPositions[j].alternation){for(var k=o().validPositions[j],l=k.locator[h],m=o().validPositions[g].locator[h].split(","),n=0;n<m.length;n++)if(l<m[n]){for(var r,s,t=j-1;t>=0;t--)if(r=o().validPositions[t],void 0!=r){s=r.locator[h],r.locator[h]=m[n];break}if(l!=r.locator[h]){for(var u=y().slice(),v=j;v<q()+1;v++)delete o().validPositions[v],delete o().tests[v];p(!0),f.keepStatic=!f.keepStatic;for(var v=j;v<u.length;v++)u[v]!=f.skipOptionalPartCharacter&&B(q()+1,u[v],!1,!0);r.locator[h]=s;var w=B(b,c,d,e);if(f.keepStatic=!f.keepStatic,w)return w;p(),o().validPositions=a.extend(!0,{},i)}}break}return!1}d=d===!0;for(var i=y(),j=b-1;j>-1&&(!o().validPositions[j]||null!=o().validPositions[j].match.fn);j--)void 0==o().validPositions[j]&&(!C(j)||i[j]!=I(j))&&w(j).length>1&&g(j,i[j],!0);var k=b,l=!1;if(e&&k>=D()&&p(!0),k<D()&&(l=g(k,c,d,e),!d&&l===!1)){var m=o().validPositions[k];if(!m||null!=m.match.fn||m.match.def!=c&&c!=f.skipOptionalPartCharacter){if((f.insertMode||void 0==o().validPositions[E(k)])&&!C(k))for(var n=k+1,t=E(k);t>=n;n++)if(l=g(n,c,d,e),l!==!1){k=n;break}}else l={caret:E(k)}}return l===!1&&f.keepStatic&&R(i)&&(l=h(b,c,d,e)),l===!0&&(l={pos:k}),l}function C(a){var b=u(a);return null!=b.fn?b.fn:!1}function D(){var a;if(fb=eb.prop("maxLength"),-1==fb&&(fb=void 0),0==f.greedy){var b,c=q(),d=o().validPositions[c],e=void 0!=d?d.locator.slice():void 0;for(b=c+1;void 0==d||null!=d.match.fn||null==d.match.fn&&""!=d.match.def;b++)d=t(b,e,b-1),e=d.locator.slice();a=b}else a=y().length;return void 0==fb||fb>a?a:fb}function E(a){var b=D();if(a>=b)return b;for(var c=a;++c<b&&!C(c)&&(f.nojumps!==!0||f.nojumpsThreshold>c););return c}function F(a){var b=a;if(0>=b)return 0;for(;--b>0&&!C(b););return b}function G(a){return void 0==o().validPositions[a]?I(a):o().validPositions[a].input}function H(a,b,c){a._valueSet(b.join("")),void 0!=c&&O(a,c)}function I(b,c){c=c||u(b);var d=a.isFunction(c.placeholder)?c.placeholder.call(this,f):c.placeholder;return void 0!=d?d:null==c.fn?c.def:f.placeholder.charAt(b%f.placeholder.length)}function J(b,c,d,e,g){var h=void 0!=e?e.slice():L(b._valueGet()).split("");if(p(),c&&b._valueSet(""),a.each(h,function(c,e){if(g===!0){var f=q(),h=-1==f?c:E(f);-1==a.inArray(e,x().slice(f+1,h))&&Y.call(b,void 0,!0,e.charCodeAt(0),!1,d,d?c:o().p)}else Y.call(b,void 0,!0,e.charCodeAt(0),!1,d,d?c:o().p),d=d||c>0&&c>o().p}),c){var i=f.onKeyPress.call(this,void 0,y(),0,f);W(b,i),H(b,y(),a(b).is(":focus")?E(q(0)):void 0)}}function K(b){return a.inputmask.escapeRegex.call(this,b)}function L(a){return a.replace(new RegExp("("+K(x().join(""))+")*$"),"")}function M(b){if(b.data("_inputmask")&&!b.hasClass("hasDatepicker")){var c=[],d=o().validPositions;for(var e in d)d[e].match&&null!=d[e].match.fn&&c.push(d[e].input);var g=(gb?c.reverse():c).join(""),h=(gb?y().slice().reverse():y()).join("");return a.isFunction(f.onUnMask)&&(g=f.onUnMask.call(b,h,g,f)||g),g}return b[0]._valueGet()}function N(a){if(gb&&"number"==typeof a&&(!f.greedy||""!=f.placeholder)){var b=y().length;a=b-a}return a}function O(b,c,d){var e,g=b.jquery&&b.length>0?b[0]:b;if("number"!=typeof c){var h=a(g).data("_inputmask");return!a(g).is(":visible")&&h&&void 0!=h.caret?(c=h.caret.begin,d=h.caret.end):g.setSelectionRange?(c=g.selectionStart,d=g.selectionEnd):document.selection&&document.selection.createRange&&(e=document.selection.createRange(),c=0-e.duplicate().moveStart("character",-1e5),d=c+e.text.length),c=N(c),d=N(d),{begin:c,end:d}}c=N(c),d=N(d),d="number"==typeof d?d:c;var h=a(g).data("_inputmask")||{};h.caret={begin:c,end:d},a(g).data("_inputmask",h),a(g).is(":visible")&&(g.scrollLeft=g.scrollWidth,0==f.insertMode&&c==d&&d++,g.setSelectionRange?(g.selectionStart=c,g.selectionEnd=d):g.createTextRange&&(e=g.createTextRange(),e.collapse(!0),e.moveEnd("character",d),e.moveStart("character",c),e.select()))}function P(b){var c,d,e=y(),f=e.length,g=q(),h={},i=o().validPositions[g],j=void 0!=i?i.locator.slice():void 0;for(c=g+1;c<e.length;c++)d=t(c,j,c-1),j=d.locator.slice(),h[c]=a.extend(!0,{},d);var k=i&&void 0!=i.alternation?i.locator[i.alternation].split(","):[];for(c=f-1;c>g&&(d=h[c].match,(d.optionality||d.optionalQuantifier||i&&void 0!=i.alternation&&void 0!=h[c].locator[i.alternation]&&-1!=a.inArray(h[c].locator[i.alternation].toString(),k))&&e[c]==I(c,d));c--)f--;return b?{l:f,def:h[f]?h[f].match:void 0}:f}function Q(a){for(var b=y(),c=b.slice(),d=P(),e=c.length-1;e>d&&!C(e);e--);c.splice(d,e+1-d),H(a,c)}function R(b){if(a.isFunction(f.isComplete))return f.isComplete.call(eb,b,f);if("*"==f.repeat)return void 0;var c=!1,d=P(!0),e=F(d.l),g=q();if(g==e&&(void 0==d.def||d.def.newBlockMarker||d.def.optionalQuantifier)){c=!0;for(var h=0;e>=h;h++){var i=C(h);if(i&&(void 0==b[h]||b[h]==I(h))||!i&&b[h]!=I(h)){c=!1;break}}}return c}function S(a,b){return gb?a-b>1||1==a-b&&f.insertMode:b-a>1||1==b-a&&f.insertMode}function T(b){var c=a._data(b).events;a.each(c,function(b,c){a.each(c,function(a,b){if("inputmask"==b.namespace&&"setvalue"!=b.type){var c=b.handler;b.handler=function(a){return this.readOnly||this.disabled?void a.preventDefault:c.apply(this,arguments)}}})})}function U(b){function c(b){if(void 0==a.valHooks[b]||1!=a.valHooks[b].inputmaskpatch){var c=a.valHooks[b]&&a.valHooks[b].get?a.valHooks[b].get:function(a){return a.value},d=a.valHooks[b]&&a.valHooks[b].set?a.valHooks[b].set:function(a,b){return a.value=b,a};a.valHooks[b]={get:function(b){var d=a(b);if(d.data("_inputmask")){if(d.data("_inputmask").opts.autoUnmask)return d.inputmask("unmaskedvalue");var e=c(b),f=d.data("_inputmask"),g=f.maskset,h=g._buffer;return h=h?h.join(""):"",e!=h?e:""}return c(b)},set:function(b,c){var e,f=a(b),g=f.data("_inputmask");return g?(e=d(b,a.isFunction(g.opts.onBeforeMask)?g.opts.onBeforeMask.call(ob,c,g.opts)||c:c),f.triggerHandler("setvalue.inputmask")):e=d(b,c),e},inputmaskpatch:!0}}}function d(){var b=a(this),c=a(this).data("_inputmask");return c?c.opts.autoUnmask?b.inputmask("unmaskedvalue"):g.call(this)!=x().join("")?g.call(this):"":g.call(this)}function e(b){var c=a(this).data("_inputmask");c?(h.call(this,a.isFunction(c.opts.onBeforeMask)?c.opts.onBeforeMask.call(ob,b,c.opts)||b:b),a(this).triggerHandler("setvalue.inputmask")):h.call(this,b)}function f(b){a(b).bind("mouseenter.inputmask",function(){var b=a(this),c=this,d=c._valueGet();""!=d&&d!=y().join("")&&b.trigger("setvalue")});var c=a._data(b).events,d=c.mouseover;if(d){for(var e=d[d.length-1],f=d.length-1;f>0;f--)d[f]=d[f-1];d[0]=e}}var g,h;b._valueGet||(Object.getOwnPropertyDescriptor&&Object.getOwnPropertyDescriptor(b,"value"),document.__lookupGetter__&&b.__lookupGetter__("value")?(g=b.__lookupGetter__("value"),h=b.__lookupSetter__("value"),b.__defineGetter__("value",d),b.__defineSetter__("value",e)):(g=function(){return b.value},h=function(a){b.value=a},c(b.type),f(b)),b._valueGet=function(){return gb?g.call(this).split("").reverse().join(""):g.call(this)},b._valueSet=function(a){h.call(this,gb?a.split("").reverse().join(""):a)})}function V(b,c,d){function e(){if(f.keepStatic){p(!0);var a,c=[];for(a=q();a>=0;a--)if(o().validPositions[a]){if(void 0!=o().validPositions[a].alternation)break;c.push(o().validPositions[a].input),delete o().validPositions[a]}if(a>0)for(;c.length>0;)o().p=E(q()),Y.call(b,void 0,!0,c.pop().charCodeAt(0),!1,!1,o().p)}}if((f.numericInput||gb)&&(c==a.inputmask.keyCode.BACKSPACE?c=a.inputmask.keyCode.DELETE:c==a.inputmask.keyCode.DELETE&&(c=a.inputmask.keyCode.BACKSPACE),gb)){var g=d.end;d.end=d.begin,d.begin=g}c==a.inputmask.keyCode.BACKSPACE&&d.end-d.begin<=1?d.begin=F(d.begin):c==a.inputmask.keyCode.DELETE&&d.begin==d.end&&d.end++,s(d.begin,d.end),e();var h=q(d.begin);h<d.begin?(-1==h&&p(),o().p=E(h)):o().p=d.begin}function W(a,b,c){if(b&&b.refreshFromBuffer){var d=b.refreshFromBuffer;z(d===!0?d:d.start,d.end),p(!0),void 0!=c&&(H(a,y()),O(a,b.caret||c.begin,b.caret||c.end))}}function X(c){hb=!1;var d=this,e=a(d),g=c.keyCode,h=O(d);g==a.inputmask.keyCode.BACKSPACE||g==a.inputmask.keyCode.DELETE||i&&127==g||c.ctrlKey&&88==g&&!b("cut")?(c.preventDefault(),88==g&&(db=y().join("")),V(d,g,h),H(d,y(),o().p),d._valueGet()==x().join("")&&e.trigger("cleared"),f.showTooltip&&e.prop("title",o().mask)):g==a.inputmask.keyCode.END||g==a.inputmask.keyCode.PAGE_DOWN?setTimeout(function(){var a=E(q());f.insertMode||a!=D()||c.shiftKey||a--,O(d,c.shiftKey?h.begin:a,a)},0):g==a.inputmask.keyCode.HOME&&!c.shiftKey||g==a.inputmask.keyCode.PAGE_UP?O(d,0,c.shiftKey?h.begin:0):g==a.inputmask.keyCode.ESCAPE||90==g&&c.ctrlKey?(J(d,!0,!1,db.split("")),e.click()):g!=a.inputmask.keyCode.INSERT||c.shiftKey||c.ctrlKey?0!=f.insertMode||c.shiftKey||(g==a.inputmask.keyCode.RIGHT?setTimeout(function(){var a=O(d);O(d,a.begin)},0):g==a.inputmask.keyCode.LEFT&&setTimeout(function(){var a=O(d);O(d,gb?a.begin+1:a.begin-1)},0)):(f.insertMode=!f.insertMode,O(d,f.insertMode||h.begin!=D()?h.begin:h.begin-1));var j=O(d),k=f.onKeyDown.call(this,c,y(),j.begin,f);W(d,k,j),jb=-1!=a.inArray(g,f.ignorables)}function Y(b,c,d,e,g,h){if(void 0==d&&hb)return!1;hb=!0;var i=this,j=a(i);b=b||window.event;var d=c?d:b.which||b.charCode||b.keyCode;if(!(c===!0||b.ctrlKey&&b.altKey)&&(b.ctrlKey||b.metaKey||jb))return!0;if(d){c!==!0&&46==d&&0==b.shiftKey&&","==f.radixPoint&&(d=44);var k,l=c?{begin:h,end:h}:O(i),m=String.fromCharCode(d),n=S(l.begin,l.end);n&&(o().undoPositions=a.extend(!0,{},o().validPositions),V(i,a.inputmask.keyCode.DELETE,l),f.insertMode||(f.insertMode=!f.insertMode,r(l.begin,g),f.insertMode=!f.insertMode),n=!f.multi),o().writeOutBuffer=!0;var q=gb&&!n?l.end:l.begin,s=B(q,m,g);if(s!==!1){if(s!==!0&&(q=void 0!=s.pos?s.pos:q,m=void 0!=s.c?s.c:m),p(!0),void 0!=s.caret)k=s.caret;else{var t=o().validPositions;k=!f.keepStatic&&(void 0!=t[q+1]&&w(q+1,t[q].locator.slice(),q).length>1||void 0!=t[q].alternation)?q+1:E(q)}o().p=k}if(e!==!1){var u=this;if(setTimeout(function(){f.onKeyValidation.call(u,s,f)},0),o().writeOutBuffer&&s!==!1){var v=y();H(i,v,c?void 0:f.numericInput?F(k):k),c!==!0&&setTimeout(function(){R(v)===!0&&j.trigger("complete"),ib=!0,j.trigger("input")},0)}else n&&(o().buffer=void 0,o().validPositions=o().undoPositions)}else n&&(o().buffer=void 0,o().validPositions=o().undoPositions);if(f.showTooltip&&j.prop("title",o().mask),b&&1!=c){b.preventDefault();var x=O(i),z=f.onKeyPress.call(this,b,y(),x.begin,f);W(i,z,x)}}}function Z(b){var c=a(this),d=this,e=b.keyCode,g=y(),h=O(d),i=f.onKeyUp.call(this,b,g,h.begin,f);W(d,i,h),e==a.inputmask.keyCode.TAB&&f.showMaskOnFocus&&(c.hasClass("focus-inputmask")&&0==d._valueGet().length?(p(),g=y(),H(d,g),O(d,0),db=y().join("")):(H(d,g),O(d,N(0),N(D()))))}function $(b){if(ib===!0&&"input"==b.type)return ib=!1,!0;var c=this,d=a(c),e=c._valueGet(),g=O(c);if("propertychange"==b.type&&c._valueGet().length<=D())return!0;"paste"==b.type&&(window.clipboardData&&window.clipboardData.getData?e=e.substr(0,g.begin)+window.clipboardData.getData("Text")+e.substr(g.end,e.length):b.originalEvent&&b.originalEvent.clipboardData&&b.originalEvent.clipboardData.getData&&(e=e.substr(0,g.begin)+b.originalEvent.clipboardData.getData("text/plain")+e.substr(g.end,e.length)));var h=a.isFunction(f.onBeforePaste)?f.onBeforePaste.call(c,e,f)||e:e;return J(c,!0,!1,gb?h.split("").reverse():h.split(""),!0),d.click(),R(y())===!0&&d.trigger("complete"),!1}function _(b){if(ib===!0&&"input"==b.type)return ib=!1,!0;var c=this,d=O(c),e=c._valueGet();e=e.replace(new RegExp("("+K(x().join(""))+")*"),""),d.begin>e.length&&(O(c,e.length),d=O(c)),1!=y().length-e.length||e.charAt(d.begin)==y()[d.begin]||e.charAt(d.begin+1)==y()[d.begin]||C(d.begin)||(b.keyCode=a.inputmask.keyCode.BACKSPACE,X.call(c,b)),b.preventDefault()}function ab(b){if(ib===!0&&"input"==b.type)return ib=!1,!0;var c=this,d=O(c),e=c._valueGet();O(c,d.begin-1);var g=a.Event("keypress");g.which=e.charCodeAt(d.begin-1),hb=!1,jb=!1,Y.call(c,g,void 0,void 0,!1);var h=o().p;H(c,y(),f.numericInput?F(h):h),b.preventDefault()}function bb(b){ib=!0;var c=this;return setTimeout(function(){O(c,O(c).begin-1);var d=a.Event("keypress");d.which=b.originalEvent.data.charCodeAt(0),hb=!1,jb=!1,Y.call(c,d,void 0,void 0,!1);var e=o().p;H(c,y(),f.numericInput?F(e):e)},0),!1}function cb(b){if(eb=a(b),eb.is(":input")&&c(eb.attr("type"))){if(eb.data("_inputmask",{maskset:e,opts:f,isRTL:!1}),f.showTooltip&&eb.prop("title",o().mask),("rtl"==b.dir||f.rightAlign)&&eb.css("text-align","right"),"rtl"==b.dir||f.numericInput){b.dir="ltr",eb.removeAttr("dir");var d=eb.data("_inputmask");d.isRTL=!0,eb.data("_inputmask",d),gb=!0}eb.unbind(".inputmask"),eb.removeClass("focus-inputmask"),eb.closest("form").bind("submit",function(){db!=y().join("")&&eb.change(),eb[0]._valueGet&&eb[0]._valueGet()==x().join("")&&eb[0]._valueSet(""),f.autoUnmask&&f.removeMaskOnSubmit&&eb.inputmask("remove")}).bind("reset",function(){setTimeout(function(){eb.trigger("setvalue")},0)}),eb.bind("mouseenter.inputmask",function(){var b=a(this),c=this;!b.hasClass("focus-inputmask")&&f.showMaskOnHover&&c._valueGet()!=y().join("")&&H(c,y())}).bind("blur.inputmask",function(){var b=a(this),c=this;if(b.data("_inputmask")){var d=c._valueGet(),e=y();b.removeClass("focus-inputmask"),db!=y().join("")&&b.change(),f.clearMaskOnLostFocus&&""!=d&&(d==x().join("")?c._valueSet(""):Q(c)),R(e)===!1&&(b.trigger("incomplete"),f.clearIncomplete&&(p(),f.clearMaskOnLostFocus?c._valueSet(""):(e=x().slice(),H(c,e))))}}).bind("focus.inputmask",function(){var b=a(this),c=this,d=c._valueGet();f.showMaskOnFocus&&!b.hasClass("focus-inputmask")&&(!f.showMaskOnHover||f.showMaskOnHover&&""==d)&&c._valueGet()!=y().join("")&&H(c,y(),E(q())),b.addClass("focus-inputmask"),db=y().join("")}).bind("mouseleave.inputmask",function(){var b=a(this),c=this;f.clearMaskOnLostFocus&&(b.hasClass("focus-inputmask")||c._valueGet()==b.attr("placeholder")||(c._valueGet()==x().join("")||""==c._valueGet()?c._valueSet(""):Q(c)))}).bind("click.inputmask",function(){var b=this;a(b).is(":focus")&&setTimeout(function(){var c=O(b);if(c.begin==c.end)if(f.radixFocus&&""!=f.radixPoint&&-1!=a.inArray(f.radixPoint,y())&&y().join("")==x().join(""))O(b,a.inArray(f.radixPoint,y()));else{var d=gb?N(c.begin):c.begin,e=E(q(d));e>d?O(b,C(d)?d:E(d)):O(b,e)}},0)}).bind("dblclick.inputmask",function(){var a=this;setTimeout(function(){O(a,0,E(q()))},0)}).bind(n+".inputmask dragdrop.inputmask drop.inputmask",$).bind("setvalue.inputmask",function(){var a=this;J(a,!0,!1,void 0,!0),db=y().join(""),(f.clearMaskOnLostFocus||f.clearIncomplete)&&a._valueGet()==x().join("")&&a._valueSet("")}).bind("cut.inputmask",function(b){ib=!0;var c=this,d=a(c),e=O(c);V(c,a.inputmask.keyCode.DELETE,e);var g=f.onKeyPress.call(this,b,y(),o().p,f);W(c,g,{begin:o().p,end:o().p}),c._valueGet()==x().join("")&&d.trigger("cleared"),f.showTooltip&&d.prop("title",o().mask)}).bind("complete.inputmask",f.oncomplete).bind("incomplete.inputmask",f.onincomplete).bind("cleared.inputmask",f.oncleared),eb.bind("keydown.inputmask",X).bind("keypress.inputmask",Y).bind("keyup.inputmask",Z).bind("compositionupdate.inputmask",bb),"paste"!==n||g||eb.bind("input.inputmask",ab),g&&eb.bind("input.inputmask",$),(j||l||k||m)&&("input"==n&&eb.unbind(n+".inputmask"),eb.bind("input.inputmask",_)),U(b);var h=a.isFunction(f.onBeforeMask)?f.onBeforeMask.call(b,b._valueGet(),f)||b._valueGet():b._valueGet();J(b,!0,!1,h.split(""),!0),db=y().join("");var i;try{i=document.activeElement}catch(r){}R(y())===!1&&f.clearIncomplete&&p(),f.clearMaskOnLostFocus?y().join("")==x().join("")?b._valueSet(""):Q(b):H(b,y()),i===b&&(eb.addClass("focus-inputmask"),O(b,E(q()))),T(b)}}var db,eb,fb,gb=!1,hb=!1,ib=!1,jb=!1;if(void 0!=d)switch(d.action){case"isComplete":return eb=a(d.el),e=eb.data("_inputmask").maskset,f=eb.data("_inputmask").opts,R(d.buffer);case"unmaskedvalue":return eb=d.$input,e=eb.data("_inputmask").maskset,f=eb.data("_inputmask").opts,gb=d.$input.data("_inputmask").isRTL,M(d.$input);case"mask":db=y().join(""),cb(d.el);break;case"format":eb=a({}),eb.data("_inputmask",{maskset:e,opts:f,isRTL:f.numericInput}),f.numericInput&&(gb=!0);var kb=(a.isFunction(f.onBeforeMask)?f.onBeforeMask.call(eb,d.value,f)||d.value:d.value).split("");return J(eb,!1,!1,gb?kb.reverse():kb,!0),f.onKeyPress.call(this,void 0,y(),0,f),d.metadata?{value:gb?y().slice().reverse().join(""):y().join(""),metadata:eb.inputmask("getmetadata")}:gb?y().slice().reverse().join(""):y().join("");case"isValid":eb=a({}),eb.data("_inputmask",{maskset:e,opts:f,isRTL:f.numericInput}),f.numericInput&&(gb=!0);var kb=d.value.split("");J(eb,!1,!0,gb?kb.reverse():kb);for(var lb=y(),mb=P(),nb=lb.length-1;nb>mb&&!C(nb);nb--);return lb.splice(mb,nb+1-mb),R(lb)&&d.value==lb.join("");case"getemptymask":return eb=a(d.el),e=eb.data("_inputmask").maskset,f=eb.data("_inputmask").opts,x();case"remove":var ob=d.el;eb=a(ob),e=eb.data("_inputmask").maskset,f=eb.data("_inputmask").opts,ob._valueSet(M(eb)),eb.unbind(".inputmask"),eb.removeClass("focus-inputmask"),eb.removeData("_inputmask");var pb;Object.getOwnPropertyDescriptor&&(pb=Object.getOwnPropertyDescriptor(ob,"value")),pb&&pb.get?ob._valueGet&&Object.defineProperty(ob,"value",{get:ob._valueGet,set:ob._valueSet}):document.__lookupGetter__&&ob.__lookupGetter__("value")&&ob._valueGet&&(ob.__defineGetter__("value",ob._valueGet),ob.__defineSetter__("value",ob._valueSet));
|
3 |
-
try{delete ob._valueGet,delete ob._valueSet}catch(qb){ob._valueGet=void 0,ob._valueSet=void 0}break;case"getmetadata":if(eb=a(d.el),e=eb.data("_inputmask").maskset,f=eb.data("_inputmask").opts,a.isArray(e.metadata)){for(var rb,sb=q(),tb=sb;tb>=0;tb--)if(o().validPositions[tb]&&void 0!=o().validPositions[tb].alternation){rb=o().validPositions[tb].alternation;break}return void 0!=rb?e.metadata[o().validPositions[sb].locator[rb]]:e.metadata[0]}return e.metadata}}if(void 0===a.fn.inputmask){var g="function"==typeof ScriptEngineMajorVersion?ScriptEngineMajorVersion():new Function("/*@cc_on return @_jscript_version; @*/")()>=10,h=navigator.userAgent,i=null!==h.match(new RegExp("iphone","i")),j=null!==h.match(new RegExp("android.*safari.*","i")),k=null!==h.match(new RegExp("android.*chrome.*","i")),l=null!==h.match(new RegExp("android.*firefox.*","i")),m=/Kindle/i.test(h)||/Silk/i.test(h)||/KFTT/i.test(h)||/KFOT/i.test(h)||/KFJWA/i.test(h)||/KFJWI/i.test(h)||/KFSOWI/i.test(h)||/KFTHWA/i.test(h)||/KFTHWI/i.test(h)||/KFAPWA/i.test(h)||/KFAPWI/i.test(h),n=b("paste")?"paste":b("input")?"input":"propertychange";a.inputmask={defaults:{placeholder:"_",optionalmarker:{start:"[",end:"]"},quantifiermarker:{start:"{",end:"}"},groupmarker:{start:"(",end:")"},alternatormarker:"|",escapeChar:"\\",mask:null,oncomplete:a.noop,onincomplete:a.noop,oncleared:a.noop,repeat:0,greedy:!0,autoUnmask:!1,removeMaskOnSubmit:!0,clearMaskOnLostFocus:!0,insertMode:!0,clearIncomplete:!1,aliases:{},alias:null,onKeyUp:a.noop,onKeyPress:a.noop,onKeyDown:a.noop,onBeforeMask:void 0,onBeforePaste:void 0,onUnMask:void 0,showMaskOnFocus:!0,showMaskOnHover:!0,onKeyValidation:a.noop,skipOptionalPartCharacter:" ",showTooltip:!1,numericInput:!1,rightAlign:!1,radixPoint:"",radixFocus:!1,nojumps:!1,nojumpsThreshold:0,keepStatic:void 0,definitions:{9:{validator:"[0-9]",cardinality:1,definitionSymbol:"*"},a:{validator:"[A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5]",cardinality:1,definitionSymbol:"*"},"*":{validator:"[0-9A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5]",cardinality:1}},ignorables:[8,9,13,19,27,33,34,35,36,37,38,39,40,45,46,93,112,113,114,115,116,117,118,119,120,121,122,123],isComplete:void 0},keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91},masksCache:{},escapeRegex:function(a){var b=["/",".","*","+","?","|","(",")","[","]","{","}","\\"];return a.replace(new RegExp("(\\"+b.join("|\\")+")","gim"),"\\$1")},format:function(b,c,g){var h=a.extend(!0,{},a.inputmask.defaults,c);return d(h.alias,c,h),f({action:"format",value:b,metadata:g},e(h),h)},isValid:function(b,c){var g=a.extend(!0,{},a.inputmask.defaults,c);return d(g.alias,c,g),f({action:"isValid",value:b},e(g),g)}},a.fn.inputmask=function(b,c,g,h,i){function j(b,c,e){var f=a(b);f.data("inputmask-alias")&&d(f.data("inputmask-alias"),{},c);for(var g in c){var h=f.data("inputmask-"+g.toLowerCase());void 0!=h&&("mask"==g&&0==h.indexOf("[")?(c[g]=h.replace(/[\s[\]]/g,"").split("','"),c[g][0]=c[g][0].replace("'",""),c[g][c[g].length-1]=c[g][c[g].length-1].replace("'","")):c[g]="boolean"==typeof h?h:h.toString(),e&&(e[g]=c[g]))}return c}g=g||f,h=h||"_inputmask";var k,l=a.extend(!0,{},a.inputmask.defaults,c);if("string"==typeof b)switch(b){case"mask":return d(l.alias,c,l),k=e(l,g!==f),void 0==k?this:this.each(function(){g({action:"mask",el:this},a.extend(!0,{},k),j(this,l))});case"unmaskedvalue":var m=a(this);return m.data(h)?g({action:"unmaskedvalue",$input:m}):m.val();case"remove":return this.each(function(){var b=a(this);b.data(h)&&g({action:"remove",el:this})});case"getemptymask":return this.data(h)?g({action:"getemptymask",el:this}):"";case"hasMaskedValue":return this.data(h)?!this.data(h).opts.autoUnmask:!1;case"isComplete":return this.data(h)?g({action:"isComplete",buffer:this[0]._valueGet().split(""),el:this}):!0;case"getmetadata":return this.data(h)?g({action:"getmetadata",el:this}):void 0;case"_detectScope":return d(l.alias,c,l),void 0==i||d(i,c,l)||-1!=a.inArray(i,["mask","unmaskedvalue","remove","getemptymask","hasMaskedValue","isComplete","getmetadata","_detectScope"])||(l.mask=i),a.isFunction(l.mask)&&(l.mask=l.mask.call(this,l)),a.isArray(l.mask);default:return d(l.alias,c,l),d(b,c,l)||(l.mask=b),k=e(l,g!==f),void 0==k?this:this.each(function(){g({action:"mask",el:this},a.extend(!0,{},k),j(this,l))})}else{if("object"==typeof b)return l=a.extend(!0,{},a.inputmask.defaults,b),d(l.alias,b,l),k=e(l,g!==f),void 0==k?this:this.each(function(){g({action:"mask",el:this},a.extend(!0,{},k),j(this,l))});if(void 0==b)return this.each(function(){var b=a(this).attr("data-inputmask");if(b&&""!=b)try{b=b.replace(new RegExp("'","g"),'"');var e=a.parseJSON("{"+b+"}");a.extend(!0,e,c),l=a.extend(!0,{},a.inputmask.defaults,e),l=j(this,l),d(l.alias,e,l),l.alias=void 0,a(this).inputmask("mask",l,g)}catch(f){}if(a(this).attr("data-inputmask-mask")||a(this).attr("data-inputmask-alias")){l=a.extend(!0,{},a.inputmask.defaults,{});var h={};l=j(this,l,h),d(l.alias,h,l),l.alias=void 0,a(this).inputmask("mask",l,g)}})}}}return a.fn.inputmask}(jQuery),function(a){return a.extend(a.inputmask.defaults.definitions,{h:{validator:"[01][0-9]|2[0-3]",cardinality:2,precheck:[{validator:"[0-2]",cardinality:1}]},s:{validator:"[0-5][0-9]",cardinality:2,precheck:[{validator:"[0-5]",cardinality:1}]},d:{validator:"0[1-9]|[12][0-9]|3[01]",cardinality:2,precheck:[{validator:"[0-3]",cardinality:1}]},m:{validator:"0[1-9]|1[012]",cardinality:2,precheck:[{validator:"[01]",cardinality:1}]},y:{validator:"(19|20)\\d{2}",cardinality:4,precheck:[{validator:"[12]",cardinality:1},{validator:"(19|20)",cardinality:2},{validator:"(19|20)\\d",cardinality:3}]}}),a.extend(a.inputmask.defaults.aliases,{"dd/mm/yyyy":{mask:"1/2/y",placeholder:"dd/mm/yyyy",regex:{val1pre:new RegExp("[0-3]"),val1:new RegExp("0[1-9]|[12][0-9]|3[01]"),val2pre:function(b){var c=a.inputmask.escapeRegex.call(this,b);return new RegExp("((0[1-9]|[12][0-9]|3[01])"+c+"[01])")},val2:function(b){var c=a.inputmask.escapeRegex.call(this,b);return new RegExp("((0[1-9]|[12][0-9])"+c+"(0[1-9]|1[012]))|(30"+c+"(0[13-9]|1[012]))|(31"+c+"(0[13578]|1[02]))")}},leapday:"29/02/",separator:"/",yearrange:{minyear:1900,maxyear:2099},isInYearRange:function(a,b,c){if(isNaN(a))return!1;var d=parseInt(a.concat(b.toString().slice(a.length))),e=parseInt(a.concat(c.toString().slice(a.length)));return(isNaN(d)?!1:d>=b&&c>=d)||(isNaN(e)?!1:e>=b&&c>=e)},determinebaseyear:function(a,b,c){var d=(new Date).getFullYear();if(a>d)return a;if(d>b){for(var e=b.toString().slice(0,2),f=b.toString().slice(2,4);e+c>b;)e--;var g=e+f;return a>g?a:g}return d},onKeyUp:function(b){var c=a(this);if(b.ctrlKey&&b.keyCode==a.inputmask.keyCode.RIGHT){var d=new Date;c.val(d.getDate().toString()+(d.getMonth()+1).toString()+d.getFullYear().toString())}},definitions:{1:{validator:function(a,b,c,d,e){var f=e.regex.val1.test(a);return d||f||a.charAt(1)!=e.separator&&-1=="-./".indexOf(a.charAt(1))||!(f=e.regex.val1.test("0"+a.charAt(0)))?f:(b.buffer[c-1]="0",{refreshFromBuffer:{start:c-1,end:c},pos:c,c:a.charAt(0)})},cardinality:2,precheck:[{validator:function(a,b,c,d,e){isNaN(b.buffer[c+1])||(a+=b.buffer[c+1]);var f=1==a.length?e.regex.val1pre.test(a):e.regex.val1.test(a);return d||f||!(f=e.regex.val1.test("0"+a))?f:(b.buffer[c]="0",c++,{pos:c})},cardinality:1}]},2:{validator:function(a,b,c,d,e){var f=e.mask.indexOf("2")==e.mask.length-1?b.buffer.join("").substr(5,3):b.buffer.join("").substr(0,3);-1!=f.indexOf(e.placeholder[0])&&(f="01"+e.separator);var g=e.regex.val2(e.separator).test(f+a);if(!d&&!g&&(a.charAt(1)==e.separator||-1!="-./".indexOf(a.charAt(1)))&&(g=e.regex.val2(e.separator).test(f+"0"+a.charAt(0))))return b.buffer[c-1]="0",{refreshFromBuffer:{start:c-1,end:c},pos:c,c:a.charAt(0)};if(e.mask.indexOf("2")==e.mask.length-1&&g){var h=b.buffer.join("").substr(4,4)+a;if(h!=e.leapday)return!0;var i=parseInt(b.buffer.join("").substr(0,4),10);return 0===i%4?0===i%100?0===i%400?!0:!1:!0:!1}return g},cardinality:2,precheck:[{validator:function(a,b,c,d,e){isNaN(b.buffer[c+1])||(a+=b.buffer[c+1]);var f=e.mask.indexOf("2")==e.mask.length-1?b.buffer.join("").substr(5,3):b.buffer.join("").substr(0,3);-1!=f.indexOf(e.placeholder[0])&&(f="01"+e.separator);var g=1==a.length?e.regex.val2pre(e.separator).test(f+a):e.regex.val2(e.separator).test(f+a);return d||g||!(g=e.regex.val2(e.separator).test(f+"0"+a))?g:(b.buffer[c]="0",c++,{pos:c})},cardinality:1}]},y:{validator:function(a,b,c,d,e){if(e.isInYearRange(a,e.yearrange.minyear,e.yearrange.maxyear)){var f=b.buffer.join("").substr(0,6);if(f!=e.leapday)return!0;var g=parseInt(a,10);return 0===g%4?0===g%100?0===g%400?!0:!1:!0:!1}return!1},cardinality:4,precheck:[{validator:function(a,b,c,d,e){var f=e.isInYearRange(a,e.yearrange.minyear,e.yearrange.maxyear);if(!d&&!f){var g=e.determinebaseyear(e.yearrange.minyear,e.yearrange.maxyear,a+"0").toString().slice(0,1);if(f=e.isInYearRange(g+a,e.yearrange.minyear,e.yearrange.maxyear))return b.buffer[c++]=g.charAt(0),{pos:c};if(g=e.determinebaseyear(e.yearrange.minyear,e.yearrange.maxyear,a+"0").toString().slice(0,2),f=e.isInYearRange(g+a,e.yearrange.minyear,e.yearrange.maxyear))return b.buffer[c++]=g.charAt(0),b.buffer[c++]=g.charAt(1),{pos:c}}return f},cardinality:1},{validator:function(a,b,c,d,e){var f=e.isInYearRange(a,e.yearrange.minyear,e.yearrange.maxyear);if(!d&&!f){var g=e.determinebaseyear(e.yearrange.minyear,e.yearrange.maxyear,a).toString().slice(0,2);if(f=e.isInYearRange(a[0]+g[1]+a[1],e.yearrange.minyear,e.yearrange.maxyear))return b.buffer[c++]=g.charAt(1),{pos:c};if(g=e.determinebaseyear(e.yearrange.minyear,e.yearrange.maxyear,a).toString().slice(0,2),e.isInYearRange(g+a,e.yearrange.minyear,e.yearrange.maxyear)){var h=b.buffer.join("").substr(0,6);if(h!=e.leapday)f=!0;else{var i=parseInt(a,10);f=0===i%4?0===i%100?0===i%400?!0:!1:!0:!1}}else f=!1;if(f)return b.buffer[c-1]=g.charAt(0),b.buffer[c++]=g.charAt(1),b.buffer[c++]=a.charAt(0),{refreshFromBuffer:{start:c-3,end:c},pos:c}}return f},cardinality:2},{validator:function(a,b,c,d,e){return e.isInYearRange(a,e.yearrange.minyear,e.yearrange.maxyear)},cardinality:3}]}},insertMode:!1,autoUnmask:!1},"mm/dd/yyyy":{placeholder:"mm/dd/yyyy",alias:"dd/mm/yyyy",regex:{val2pre:function(b){var c=a.inputmask.escapeRegex.call(this,b);return new RegExp("((0[13-9]|1[012])"+c+"[0-3])|(02"+c+"[0-2])")},val2:function(b){var c=a.inputmask.escapeRegex.call(this,b);return new RegExp("((0[1-9]|1[012])"+c+"(0[1-9]|[12][0-9]))|((0[13-9]|1[012])"+c+"30)|((0[13578]|1[02])"+c+"31)")},val1pre:new RegExp("[01]"),val1:new RegExp("0[1-9]|1[012]")},leapday:"02/29/",onKeyUp:function(b){var c=a(this);if(b.ctrlKey&&b.keyCode==a.inputmask.keyCode.RIGHT){var d=new Date;c.val((d.getMonth()+1).toString()+d.getDate().toString()+d.getFullYear().toString())}}},"yyyy/mm/dd":{mask:"y/1/2",placeholder:"yyyy/mm/dd",alias:"mm/dd/yyyy",leapday:"/02/29",onKeyUp:function(b){var c=a(this);if(b.ctrlKey&&b.keyCode==a.inputmask.keyCode.RIGHT){var d=new Date;c.val(d.getFullYear().toString()+(d.getMonth()+1).toString()+d.getDate().toString())}}},"dd.mm.yyyy":{mask:"1.2.y",placeholder:"dd.mm.yyyy",leapday:"29.02.",separator:".",alias:"dd/mm/yyyy"},"dd-mm-yyyy":{mask:"1-2-y",placeholder:"dd-mm-yyyy",leapday:"29-02-",separator:"-",alias:"dd/mm/yyyy"},"mm.dd.yyyy":{mask:"1.2.y",placeholder:"mm.dd.yyyy",leapday:"02.29.",separator:".",alias:"mm/dd/yyyy"},"mm-dd-yyyy":{mask:"1-2-y",placeholder:"mm-dd-yyyy",leapday:"02-29-",separator:"-",alias:"mm/dd/yyyy"},"yyyy.mm.dd":{mask:"y.1.2",placeholder:"yyyy.mm.dd",leapday:".02.29",separator:".",alias:"yyyy/mm/dd"},"yyyy-mm-dd":{mask:"y-1-2",placeholder:"yyyy-mm-dd",leapday:"-02-29",separator:"-",alias:"yyyy/mm/dd"},datetime:{mask:"1/2/y h:s",placeholder:"dd/mm/yyyy hh:mm",alias:"dd/mm/yyyy",regex:{hrspre:new RegExp("[012]"),hrs24:new RegExp("2[0-4]|1[3-9]"),hrs:new RegExp("[01][0-9]|2[0-4]"),ampm:new RegExp("^[a|p|A|P][m|M]"),mspre:new RegExp("[0-5]"),ms:new RegExp("[0-5][0-9]")},timeseparator:":",hourFormat:"24",definitions:{h:{validator:function(a,b,c,d,e){if("24"==e.hourFormat&&24==parseInt(a,10))return b.buffer[c-1]="0",b.buffer[c]="0",{refreshFromBuffer:{start:c-1,end:c},c:"0"};var f=e.regex.hrs.test(a);if(!d&&!f&&(a.charAt(1)==e.timeseparator||-1!="-.:".indexOf(a.charAt(1)))&&(f=e.regex.hrs.test("0"+a.charAt(0))))return b.buffer[c-1]="0",b.buffer[c]=a.charAt(0),c++,{refreshFromBuffer:{start:c-2,end:c},pos:c,c:e.timeseparator};if(f&&"24"!==e.hourFormat&&e.regex.hrs24.test(a)){var g=parseInt(a,10);return 24==g?(b.buffer[c+5]="a",b.buffer[c+6]="m"):(b.buffer[c+5]="p",b.buffer[c+6]="m"),g-=12,10>g?(b.buffer[c]=g.toString(),b.buffer[c-1]="0"):(b.buffer[c]=g.toString().charAt(1),b.buffer[c-1]=g.toString().charAt(0)),{refreshFromBuffer:{start:c-1,end:c+6},c:b.buffer[c]}}return f},cardinality:2,precheck:[{validator:function(a,b,c,d,e){var f=e.regex.hrspre.test(a);return d||f||!(f=e.regex.hrs.test("0"+a))?f:(b.buffer[c]="0",c++,{pos:c})},cardinality:1}]},s:{validator:"[0-5][0-9]",cardinality:2,precheck:[{validator:function(a,b,c,d,e){var f=e.regex.mspre.test(a);return d||f||!(f=e.regex.ms.test("0"+a))?f:(b.buffer[c]="0",c++,{pos:c})},cardinality:1}]},t:{validator:function(a,b,c,d,e){return e.regex.ampm.test(a+"m")},casing:"lower",cardinality:1}},insertMode:!1,autoUnmask:!1},datetime12:{mask:"1/2/y h:s t\\m",placeholder:"dd/mm/yyyy hh:mm xm",alias:"datetime",hourFormat:"12"},"hh:mm t":{mask:"h:s t\\m",placeholder:"hh:mm xm",alias:"datetime",hourFormat:"12"},"h:s t":{mask:"h:s t\\m",placeholder:"hh:mm xm",alias:"datetime",hourFormat:"12"},"hh:mm:ss":{mask:"h:s:s",placeholder:"hh:mm:ss",alias:"datetime",autoUnmask:!1},"hh:mm":{mask:"h:s",placeholder:"hh:mm",alias:"datetime",autoUnmask:!1},date:{alias:"dd/mm/yyyy"},"mm/yyyy":{mask:"1/y",placeholder:"mm/yyyy",leapday:"donotuse",separator:"/",alias:"mm/dd/yyyy"}}),a.fn.inputmask}(jQuery),function(a){return a.extend(a.inputmask.defaults.definitions,{A:{validator:"[A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5]",cardinality:1,casing:"upper"},"#":{validator:"[0-9A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5]",cardinality:1,casing:"upper"}}),a.extend(a.inputmask.defaults.aliases,{url:{mask:"ir",placeholder:"",separator:"",defaultPrefix:"http://",regex:{urlpre1:new RegExp("[fh]"),urlpre2:new RegExp("(ft|ht)"),urlpre3:new RegExp("(ftp|htt)"),urlpre4:new RegExp("(ftp:|http|ftps)"),urlpre5:new RegExp("(ftp:/|ftps:|http:|https)"),urlpre6:new RegExp("(ftp://|ftps:/|http:/|https:)"),urlpre7:new RegExp("(ftp://|ftps://|http://|https:/)"),urlpre8:new RegExp("(ftp://|ftps://|http://|https://)")},definitions:{i:{validator:function(){return!0},cardinality:8,precheck:function(){for(var a=[],b=8,c=0;b>c;c++)a[c]=function(){var a=c;return{validator:function(b,c,d,e,f){if(f.regex["urlpre"+(a+1)]){var g,h=b;a+1-b.length>0&&(h=c.buffer.join("").substring(0,a+1-b.length)+""+h);var i=f.regex["urlpre"+(a+1)].test(h);if(!e&&!i){for(d-=a,g=0;g<f.defaultPrefix.length;g++)c.buffer[d]=f.defaultPrefix[g],d++;for(g=0;g<h.length-1;g++)c.buffer[d]=h[g],d++;return{pos:d}}return i}return!1},cardinality:a}}();return a}()},r:{validator:".",cardinality:50}},insertMode:!1,autoUnmask:!1},ip:{mask:"i[i[i]].i[i[i]].i[i[i]].i[i[i]]",definitions:{i:{validator:function(a,b,c){return c-1>-1&&"."!=b.buffer[c-1]?(a=b.buffer[c-1]+a,a=c-2>-1&&"."!=b.buffer[c-2]?b.buffer[c-2]+a:"0"+a):a="00"+a,new RegExp("25[0-5]|2[0-4][0-9]|[01][0-9][0-9]").test(a)},cardinality:1}}},email:{mask:"*{1,64}[.*{1,64}][.*{1,64}][.*{1,64}]@*{1,64}[.*{2,64}][.*{2,6}][.*{1,2}]",greedy:!1,onBeforePaste:function(a){return a=a.toLowerCase(),a.replace("mailto:","")},definitions:{"*":{validator:"[0-9A-Za-z!#$%&'*+/=?^_`{|}~-]",cardinality:1,casing:"lower"}}}}),a.fn.inputmask}(jQuery),function(a){return a.extend(a.inputmask.defaults.aliases,{numeric:{mask:function(a){if(0!==a.repeat&&isNaN(a.integerDigits)&&(a.integerDigits=a.repeat),a.repeat=0,a.groupSeparator==a.radixPoint&&(a.groupSeparator="."==a.radixPoint?",":","==a.radixPoint?".":"")," "===a.groupSeparator&&(a.skipOptionalPartCharacter=void 0),a.autoGroup=a.autoGroup&&""!=a.groupSeparator,a.autoGroup&&isFinite(a.integerDigits)){var b=Math.floor(a.integerDigits/a.groupSize),c=a.integerDigits%a.groupSize;a.integerDigits+=0==c?b-1:b}a.definitions[";"]=a.definitions["~"];var d=a.prefix;return d+="[+]",d+="~{1,"+a.integerDigits+"}",void 0!=a.digits&&(isNaN(a.digits)||parseInt(a.digits)>0)&&(d+=a.digitsOptional?"["+(a.decimalProtect?":":a.radixPoint)+";{"+a.digits+"}]":(a.decimalProtect?":":a.radixPoint)+";{"+a.digits+"}"),d+=a.suffix},placeholder:"",greedy:!1,digits:"*",digitsOptional:!0,groupSeparator:"",radixPoint:".",radixFocus:!0,groupSize:3,autoGroup:!1,allowPlus:!0,allowMinus:!0,integerDigits:"+",prefix:"",suffix:"",rightAlign:!0,decimalProtect:!0,postFormat:function(b,c,d,e){var f=!1,g=b[c];if(""==e.groupSeparator||-1!=a.inArray(e.radixPoint,b)&&c>=a.inArray(e.radixPoint,b)||new RegExp("[-+]").test(g))return{pos:c};var h=b.slice();g==e.groupSeparator&&(h.splice(c--,1),g=h[c]),d?h[c]="?":h.splice(c,0,"?");var i=h.join("");if(e.autoGroup||d&&-1!=i.indexOf(e.groupSeparator)){var j=a.inputmask.escapeRegex.call(this,e.groupSeparator);f=0==i.indexOf(e.groupSeparator),i=i.replace(new RegExp(j,"g"),"");var k=i.split(e.radixPoint);if(i=k[0],i!=e.prefix+"?0"&&i.length>=e.groupSize+e.prefix.length){f=!0;for(var l=new RegExp("([-+]?[\\d?]+)([\\d?]{"+e.groupSize+"})");l.test(i);)i=i.replace(l,"$1"+e.groupSeparator+"$2"),i=i.replace(e.groupSeparator+e.groupSeparator,e.groupSeparator)}k.length>1&&(i+=e.radixPoint+k[1])}b.length=i.length;for(var m=0,n=i.length;n>m;m++)b[m]=i.charAt(m);var o=a.inArray("?",b);return d?b[o]=g:b.splice(o,1),{pos:o,refreshFromBuffer:f}},onKeyDown:function(b,c,d,e){if(b.keyCode==a.inputmask.keyCode.TAB&&"0"!=e.placeholder.charAt(0)){var f=a.inArray(e.radixPoint,c);if(-1!=f&&isFinite(e.digits)){for(var g=1;g<=e.digits;g++)(void 0==c[f+g]||c[f+g]==e.placeholder.charAt(0))&&(c[f+g]="0");return{refreshFromBuffer:{start:++f,end:f+e.digits}}}}else if(e.autoGroup&&(b.keyCode==a.inputmask.keyCode.DELETE||b.keyCode==a.inputmask.keyCode.BACKSPACE)){var h=e.postFormat(c,d-1,!0,e);return h.caret=h.pos+1,h}},onKeyPress:function(a,b,c,d){if(d.autoGroup){var e=d.postFormat(b,c-1,!0,d);return e.caret=e.pos+1,e}},regex:{integerPart:function(){return new RegExp("[-+]?\\d+")},integerNPart:function(){return new RegExp("\\d+")}},signHandler:function(a,b,c,d,e){if(!d&&(e.allowMinus&&"-"===a||e.allowPlus&&"+"===a)){var f=b.join("").match(e.regex.integerPart(e));if(f&&f.length>0&&"0"!==f[f.index])return b[f.index]==("-"===a?"+":"-")?{pos:f.index,c:a,remove:f.index,caret:c}:b[f.index]==("-"===a?"-":"+")?{remove:f.index,caret:c-1}:{pos:f.index,c:a,caret:c+1}}return!1},radixHandler:function(b,c,d,e,f){if(!e&&b===f.radixPoint){var g=a.inArray(f.radixPoint,c.buffer),h=c.buffer.join("").match(f.regex.integerPart(f));if(-1!=g)return c.validPositions[g-1]?{caret:g+1}:{pos:h.index,c:h[0],caret:g+1}}return!1},leadingZeroHandler:function(b,c,d,e,f){var g=c.buffer.join("").match(f.regex.integerNPart(f)),h=a.inArray(f.radixPoint,c.buffer);if(g&&!e&&(-1==h||g.index<h))if(0==g[0].indexOf("0")&&d>=f.prefix.length){if(-1==h||h>=d&&void 0==c.validPositions[h])return c.buffer.splice(g.index,1),d=d>g.index?d-1:g.index,{pos:d,remove:g.index};if(d>g.index&&h>=d)return c.buffer.splice(g.index,1),d=d>g.index?d-1:g.index,{pos:d,remove:g.index}}else if("0"==b&&d<=g.index)return!1;return!0},definitions:{"~":{validator:function(b,c,d,e,f){var g=f.signHandler(b,c.buffer,d,e,f);if(!g&&(g=f.radixHandler(b,c,d,e,f),!g&&(g=e?new RegExp("[0-9"+a.inputmask.escapeRegex.call(this,f.groupSeparator)+"]").test(b):new RegExp("[0-9]").test(b),g===!0&&(g=f.leadingZeroHandler(b,c,d,e,f),g===!0)))){var h=a.inArray(f.radixPoint,c.buffer);f.digitsOptional===!1&&d>h&&!e&&(g={pos:d,remove:d}),g={pos:d}}return g},cardinality:1,precheck:null},"+":{validator:function(a,b,c,d,e){var f=e.signHandler(a,b.buffer,c,d,e);return f||(f=e.allowMinus&&"-"==a||e.allowPlus&&"+"==a),f},cardinality:1,precheck:null,placeholder:""},":":{validator:function(b,c,d,e,f){var g=f.signHandler(b,c.buffer,d,e,f);if(!g){var h="["+a.inputmask.escapeRegex.call(this,f.radixPoint)+"]";g=new RegExp(h).test(b),g&&c.validPositions[d]&&c.validPositions[d].match.placeholder==f.radixPoint&&(g={pos:d,remove:d})}return g},cardinality:1,precheck:null,placeholder:function(a){return a.radixPoint}}},insertMode:!0,autoUnmask:!1,onUnMask:function(b,c,d){var e=b.replace(d.prefix,"");return e=e.replace(d.suffix,""),e=e.replace(new RegExp(a.inputmask.escapeRegex.call(this,d.groupSeparator),"g"),"")},isComplete:function(b,c){var d=b.join(""),e=b.slice();if(c.postFormat(e,0,!0,c),e.join("")!=d)return!1;var f=d.replace(c.prefix,"");return f=f.replace(c.suffix,""),f=f.replace(new RegExp(a.inputmask.escapeRegex.call(this,c.groupSeparator),"g"),""),f=f.replace(a.inputmask.escapeRegex.call(this,c.radixPoint),"."),isFinite(f)},onBeforeMask:function(b,c){if(isFinite(b))return b.toString().replace(".",c.radixPoint);var d=b.match(/,/g),e=b.match(/\./g);return e&&d?e.length>d.length?(b=b.replace(/\./g,""),b=b.replace(",",c.radixPoint)):d.length>e.length&&(b=b.replace(/,/g,""),b=b.replace(".",c.radixPoint)):b=b.replace(new RegExp(a.inputmask.escapeRegex.call(this,c.groupSeparator),"g"),""),b}},currency:{prefix:"$ ",groupSeparator:",",radixPoint:".",alias:"numeric",placeholder:"0",autoGroup:!0,digits:2,digitsOptional:!1,clearMaskOnLostFocus:!1,decimalProtect:!0},decimal:{alias:"numeric"},integer:{alias:"numeric",digits:"0"}}),a.fn.inputmask}(jQuery),function(a){return a.extend(a.inputmask.defaults.aliases,{phone:{url:"phone-codes/phone-codes.js",maskInit:"+pp(pp)pppppppp",mask:function(b){b.definitions={p:{validator:function(){return!1},cardinality:1},"#":{validator:"[0-9]",cardinality:1}};var c=[];return a.ajax({url:b.url,async:!1,dataType:"json",success:function(a){c=a}}),c=c.sort(function(a,b){return(a.mask||a)<(b.mask||b)?-1:1}),c.splice(0,0,b.maskInit),c},nojumps:!0,nojumpsThreshold:1},phonebe:{alias:"phone",url:"phone-codes/phone-be.js",maskInit:"+32(pp)pppppppp",nojumpsThreshold:4}}),a.fn.inputmask}(jQuery),function(a){return a.extend(a.inputmask.defaults.aliases,{Regex:{mask:"r",greedy:!1,repeat:"*",regex:null,regexTokens:null,tokenizer:/\[\^?]?(?:[^\\\]]+|\\[\S\s]?)*]?|\\(?:0(?:[0-3][0-7]{0,2}|[4-7][0-7]?)?|[1-9][0-9]*|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}|c[A-Za-z]|[\S\s]?)|\((?:\?[:=!]?)?|(?:[?*+]|\{[0-9]+(?:,[0-9]*)?\})\??|[^.?*+^${[()|\\]+|./g,quantifierFilter:/[0-9]+[^,]/,isComplete:function(a,b){return new RegExp(b.regex).test(a.join(""))},definitions:{r:{validator:function(b,c,d,e,f){function g(a,b){this.matches=[],this.isGroup=a||!1,this.isQuantifier=b||!1,this.quantifier={min:1,max:1},this.repeaterPart=void 0}function h(){var a,b,c=new g,d=[];for(f.regexTokens=[];a=f.tokenizer.exec(f.regex);)switch(b=a[0],b.charAt(0)){case"(":d.push(new g(!0));break;case")":var e=d.pop();d.length>0?d[d.length-1].matches.push(e):c.matches.push(e);break;case"{":case"+":case"*":var h=new g(!1,!0);b=b.replace(/[{}]/g,"");var i=b.split(","),j=isNaN(i[0])?i[0]:parseInt(i[0]),k=1==i.length?j:isNaN(i[1])?i[1]:parseInt(i[1]);if(h.quantifier={min:j,max:k},d.length>0){var l=d[d.length-1].matches;if(a=l.pop(),!a.isGroup){var e=new g(!0);e.matches.push(a),a=e}l.push(a),l.push(h)}else{if(a=c.matches.pop(),!a.isGroup){var e=new g(!0);e.matches.push(a),a=e}c.matches.push(a),c.matches.push(h)}break;default:d.length>0?d[d.length-1].matches.push(b):c.matches.push(b)}c.matches.length>0&&f.regexTokens.push(c)}function i(b,c){var d=!1;c&&(k+="(",m++);for(var e=0;e<b.matches.length;e++){var f=b.matches[e];if(1==f.isGroup)d=i(f,!0);else if(1==f.isQuantifier){var g=a.inArray(f,b.matches),h=b.matches[g-1],j=k;if(isNaN(f.quantifier.max)){for(;f.repeaterPart&&f.repeaterPart!=k&&f.repeaterPart.length>k.length&&!(d=i(h,!0)););d=d||i(h,!0),d&&(f.repeaterPart=k),k=j+f.quantifier.max}else{for(var l=0,o=f.quantifier.max-1;o>l&&!(d=i(h,!0));l++);k=j+"{"+f.quantifier.min+","+f.quantifier.max+"}"}}else if(void 0!=f.matches)for(var p=0;p<f.length&&!(d=i(f[p],c));p++);else{var q;if("["==f.charAt(0)){q=k,q+=f;for(var r=0;m>r;r++)q+=")";var s=new RegExp("^("+q+")$");d=s.test(n)}else for(var t=0,u=f.length;u>t;t++)if("\\"!=f.charAt(t)){q=k,q+=f.substr(0,t+1),q=q.replace(/\|$/,"");for(var r=0;m>r;r++)q+=")";var s=new RegExp("^("+q+")$");if(d=s.test(n))break}k+=f}if(d)break}return c&&(k+=")",m--),d}null==f.regexTokens&&h();var j=c.buffer.slice(),k="",l=!1,m=0;j.splice(d,0,b);for(var n=j.join(""),o=0;o<f.regexTokens.length;o++){var g=f.regexTokens[o];if(l=i(g,g.isGroup))break}return l},cardinality:1}}}}),a.fn.inputmask}(jQuery),jQuery(document).ready(function(a){jQuery(document).on("cf.add",function(){a("[data-inputmask]").inputmask()}),jQuery(document).trigger("cf.add")}),function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?a(require("jquery")):a(jQuery)}(function(a){function b(){var a=document.createElement("input");return a.setAttribute("type","range"),"text"!==a.type}function g(a,b){var c=Array.prototype.slice.call(arguments,2);return setTimeout(function(){return a.apply(null,c)},b)}function h(a,b){return b=b||100,function(){if(!a.debouncing){var c=Array.prototype.slice.apply(arguments);a.lastReturnVal=a.apply(window,c),a.debouncing=!0}return clearTimeout(a.debounceTimeout),a.debounceTimeout=setTimeout(function(){a.debouncing=!1},b),a.lastReturnVal}}function i(b,d){if(this.$window=a(window),this.$document=a(document),this.$element=a(b),this.options=a.extend({},f,d),this._defaults=f,this._name=c,this.startEvent=this.options.startEvent.join("."+c+" ")+"."+c,this.moveEvent=this.options.moveEvent.join("."+c+" ")+"."+c,this.endEvent=this.options.endEvent.join("."+c+" ")+"."+c,this.polyfill=this.options.polyfill,this.onInit=this.options.onInit,this.onSlide=this.options.onSlide,this.onSlideEnd=this.options.onSlideEnd,this.polyfill&&e)return!1;this.identifier="js-"+c+"-"+ +new Date,this.min=parseFloat(this.$element[0].getAttribute("min")||0),this.max=parseFloat(this.$element[0].getAttribute("max")||100),this.value=parseFloat(this.$element[0].value||this.min+(this.max-this.min)/2),this.step=parseFloat(this.$element[0].getAttribute("step")||1),this.$fill=a('<div class="'+this.options.fillClass+'" />'),this.$handle=a('<div class="'+this.options.handleClass+'" />'),this.$range=a('<div class="'+this.options.rangeClass+'" id="'+this.identifier+'" />').insertAfter(this.$element).prepend(this.$fill,this.$handle),this.$element.css({position:"absolute",width:"1px",height:"1px",overflow:"hidden",opacity:"0"}),this.handleDown=a.proxy(this.handleDown,this),this.handleMove=a.proxy(this.handleMove,this),this.handleEnd=a.proxy(this.handleEnd,this),this.init();var i=this;this.$window.on("resize."+c,h(function(){g(function(){i.update()},300)},20)),this.$document.on(this.startEvent,"#"+this.identifier+":not(."+this.options.disabledClass+")",this.handleDown),this.$element.on("change."+c,function(a,b){if(!b||b.origin!==c){var d=a.target.value,e=i.getPositionFromValue(d);i.setPosition(e)}})}var c="rangeslider",d=[],e=b(),f={polyfill:!0,rangeClass:"rangeslider",disabledClass:"rangeslider--disabled",fillClass:"rangeslider__fill",handleClass:"rangeslider__handle",startEvent:["mousedown","touchstart","pointerdown"],moveEvent:["mousemove","touchmove","pointermove"],endEvent:["mouseup","touchend","pointerup"]};i.prototype.init=function(){this.onInit&&"function"==typeof this.onInit&&this.onInit(),this.update()},i.prototype.update=function(){this.handleWidth=this.$handle[0].offsetWidth,this.rangeWidth=this.$range[0].offsetWidth,this.maxHandleX=this.rangeWidth-this.handleWidth,this.grabX=this.handleWidth/2,this.position=this.getPositionFromValue(this.value),this.$element[0].disabled?this.$range.addClass(this.options.disabledClass):this.$range.removeClass(this.options.disabledClass),this.setPosition(this.position)},i.prototype.handleDown=function(a){if(a.preventDefault(),this.$document.on(this.moveEvent,this.handleMove),this.$document.on(this.endEvent,this.handleEnd),!((" "+a.target.className+" ").replace(/[\n\t]/g," ").indexOf(this.options.handleClass)>-1)){var b=this.getRelativePosition(this.$range[0],a),c=this.getPositionFromNode(this.$handle[0])-this.getPositionFromNode(this.$range[0]);this.setPosition(b-this.grabX),b>=c&&b<c+this.handleWidth&&(this.grabX=b-c)}},i.prototype.handleMove=function(a){a.preventDefault();var b=this.getRelativePosition(this.$range[0],a);this.setPosition(b-this.grabX)},i.prototype.handleEnd=function(a){a.preventDefault(),this.$document.off(this.moveEvent,this.handleMove),this.$document.off(this.endEvent,this.handleEnd);var b=this.getRelativePosition(this.$range[0],a);this.onSlideEnd&&"function"==typeof this.onSlideEnd&&this.onSlideEnd(b-this.grabX,this.value)},i.prototype.cap=function(a,b,c){return b>a?b:a>c?c:a},i.prototype.setPosition=function(a){var b,c;b=this.getValueFromPosition(this.cap(a,0,this.maxHandleX))/this.step*this.step,c=this.getPositionFromValue(b),this.$fill[0].style.width=c+this.grabX+"px",this.$handle[0].style.left=c+"px",this.setValue(b),this.position=c,this.value=b,this.onSlide&&"function"==typeof this.onSlide&&this.onSlide(c,b)},i.prototype.getPositionFromNode=function(a){for(var b=0;null!==a;)b+=a.offsetLeft,a=a.offsetParent;return b},i.prototype.getRelativePosition=function(a,b){return(b.pageX||b.originalEvent.clientX||b.originalEvent.touches[0].clientX||b.currentPoint.x)-this.getPositionFromNode(a)},i.prototype.getPositionFromValue=function(a){var b,c;return b=(a-this.min)/(this.max-this.min),c=b*this.maxHandleX},i.prototype.getValueFromPosition=function(a){var b,c;return b=a/(this.maxHandleX||1),c=this.step*Math.ceil((b*(this.max-this.min)+this.min)/this.step),Number(c.toFixed(2))},i.prototype.setValue=function(a){a!==this.value&&this.$element.val(a).trigger("change",{origin:c})},i.prototype.destroy=function(){this.$document.off(this.startEvent,"#"+this.identifier,this.handleDown),this.$element.off("."+c).removeAttr("style").removeData("plugin_"+c),this.$range&&this.$range.length&&this.$range[0].parentNode.removeChild(this.$range[0]),d.splice(d.indexOf(this.$element[0]),1),d.length||this.$window.off("."+c)},a.fn[c]=function(b){return this.each(function(){var e=a(this),f=e.data("plugin_"+c);f||(e.data("plugin_"+c,f=new i(this,b)),d.push(this)),"string"==typeof b&&f[b]()})}}),function(a){"use strict";var b={init:function(c){return this.each(function(){this.self=a(this),b.destroy.call(this.self),this.opt=a.extend(!0,{},a.fn.raty.defaults,c),b._adjustCallback.call(this),b._adjustNumber.call(this),"img"!==this.opt.starType&&b._adjustStarType.call(this),b._adjustPath.call(this),b._createStars.call(this),this.opt.cancel&&b._createCancel.call(this),this.opt.precision&&b._adjustPrecision.call(this),b._createScore.call(this),b._apply.call(this,this.opt.score),b._target.call(this,this.opt.score),this.opt.readOnly?b._lock.call(this):(this.style.cursor="pointer",b._binds.call(this)),this.self.data("options",this.opt)})},_adjustCallback:function(){for(var a=["number","readOnly","score","scoreName"],b=0;b<a.length;b++)"function"==typeof this.opt[a[b]]&&(this.opt[a[b]]=this.opt[a[b]].call(this))},_adjustNumber:function(){this.opt.number=b._between(this.opt.number,1,this.opt.numberMax)},_adjustPath:function(){this.opt.path=this.opt.path||"",this.opt.path&&"/"!==this.opt.path.charAt(this.opt.path.length-1)&&(this.opt.path+="/")},_adjustPrecision:function(){this.opt.half=!0,this.opt.targetType="score"},_adjustStarType:function(){this.opt.path="";for(var a=["cancelOff","cancelOn","starHalf","starOff","starOn"],b=0;b<a.length;b++)this.opt[a[b]]=this.opt[a[b]].replace(".","-")},_apply:function(a){b._fill.call(this,a),a&&(a>0&&this.score.val(b._between(a,0,this.opt.number)),b._roundStars.call(this,a))
|
4 |
-
|
1 |
+
function color_picker_init(){jQuery(".minicolor-picker").miniColors()}function toggle_button_init(t,e){var a=jQuery(e),i=a.find(".cf-toggle-group-radio:checked");i.length&&jQuery("#"+i.data("ref")).trigger("click")}jQuery&&function(t){t.extend(t.fn,{miniColors:function(e,a){var i=function(e,a,i){var n=y(e.val());n||(n="ffffff");var r=_(n),c=t('<span class="input-group-addon" style="background-color: #'+n+'" href="#"></span>');c.insertAfter(e),e.addClass("miniColors").data("original-maxlength",e.attr("maxlength")||null).data("original-autocomplete",e.attr("autocomplete")||null).data("letterCase",a.letterCase?a.letterCase:"uppercase").data("trigger",c).data("hsb",r).data("change",a.change?a.change:null).data("close",a.close?a.close:null).data("open",a.open?a.open:null).attr("maxlength",7).attr("autocomplete","off").val("#"+f(n,a.letterCase)).trigger("change"),a.readonly&&e.prop("readonly",!0),a.disabled&&s(e),c.on("click.miniColors",function(t){t.preventDefault(),""===e.val()&&e.val("#").trigger("change"),o(e)}),e.on("focus.miniColors",function(t){""===e.val()&&e.val("#").trigger("change"),o(e)}),e.on("blur.miniColors",function(t){var a=y(C(e.data("hsb")));e.val(a?"#"+f(a,e.data("letterCase")):"").trigger("change")}),e.on("keydown.miniColors",function(t){9===t.keyCode&&l(e)}),e.on("keyup.miniColors",function(t){p(e)}),e.on("paste.miniColors",function(t){setTimeout(function(){p(e)},5)})},n=function(e){l(),e=t(e),e.data("trigger").remove(),e.attr("autocomplete",e.data("original-autocomplete")).attr("maxlength",e.data("original-maxlength")).removeData().removeClass("miniColors").off(".miniColors"),t(document).off(".miniColors")},r=function(t){t.prop("disabled",!1).data("trigger").css("opacity",1)},s=function(t){l(t),t.prop("disabled",!0).data("trigger").css("opacity",.5)},o=function(e){if(e.prop("disabled"))return!1;l();var a=t('<div class="miniColors-selector"></div>');a.append('<div class="miniColors-colors" style="background-color: #FFF;"><div class="miniColors-colorPicker"><div class="miniColors-colorPicker-inner"></div></div>').append('<div class="miniColors-hues"><div class="miniColors-huePicker"></div></div>').css("display","none").addClass(e.attr("class")).removeClass("form-control");var i=e.data("hsb");a.find(".miniColors-colors").css("backgroundColor","#"+C({h:i.h,s:100,b:100}));var n=e.data("colorPosition");n||(n=v(i)),a.find(".miniColors-colorPicker").css("top",n.y+"px").css("left",n.x+"px");var r=e.data("huePosition");r||(r=m(i)),a.find(".miniColors-huePicker").css("top",r.y+"px"),e.data("selector",a).data("huePicker",a.find(".miniColors-huePicker")).data("colorPicker",a.find(".miniColors-colorPicker")).data("mousebutton",0),t("BODY").append(a);var s=e.data("trigger"),o=!e.is(":visible"),h=o?s.offset().top+s.outerHeight():e.offset().top+e.outerHeight(),d=o?s.offset().left:e.offset().left,p=a.outerWidth(),f=a.outerHeight(),g=s.outerWidth(),y=s.outerHeight(),b=t(window).height(),x=t(window).width(),w=t(window).scrollTop(),_=t(window).scrollLeft();h+f>b+w&&(h=h-f-y),d+p>x+_&&(d=d-p+g),a.css({top:h,left:d}).fadeIn(100),a.on("selectstart",function(){return!1}),(!t.browser.msie||t.browser.msie&&t.browser.version>=9)&&t(window).on("resize.miniColors",function(t){l(e)}),t(document).on("mousedown.miniColors touchstart.miniColors",function(a){e.data("mousebutton",1);var i=t(a.target).parents().andSelf();return i.hasClass("miniColors-colors")&&(a.preventDefault(),e.data("moving","colors"),c(e,a)),i.hasClass("miniColors-hues")&&(a.preventDefault(),e.data("moving","hues"),u(e,a)),i.hasClass("miniColors-selector")?void a.preventDefault():void(i.hasClass("miniColors")||l(e))}),t(document).on("mouseup.miniColors touchend.miniColors",function(t){t.preventDefault(),e.data("mousebutton",0).removeData("moving")}).on("mousemove.miniColors touchmove.miniColors",function(t){t.preventDefault(),1===e.data("mousebutton")&&("colors"===e.data("moving")&&c(e,t),"hues"===e.data("moving")&&u(e,t))}),e.data("open")&&e.data("open").call(e.get(0),"#"+C(i),k(i))},l=function(e){e||(e=t(".miniColors")),e.each(function(){var a=t(this).data("selector");t(this).removeData("selector"),t(a).fadeOut(100,function(){if(e.data("close")){var a=e.data("hsb"),i=C(a);e.data("close").call(e.get(0),"#"+i,k(a))}t(this).remove()})}),t(document).off(".miniColors")},c=function(t,e){var a=t.data("colorPicker");a.hide();var i={x:e.pageX,y:e.pageY};e.originalEvent.changedTouches&&(i.x=e.originalEvent.changedTouches[0].pageX,i.y=e.originalEvent.changedTouches[0].pageY),i.x=i.x-t.data("selector").find(".miniColors-colors").offset().left-5,i.y=i.y-t.data("selector").find(".miniColors-colors").offset().top-5,i.x<=-5&&(i.x=-5),i.x>=144&&(i.x=144),i.y<=-5&&(i.y=-5),i.y>=144&&(i.y=144),t.data("colorPosition",i),a.css("left",i.x).css("top",i.y).show();var n=Math.round(.67*(i.x+5));0>n&&(n=0),n>100&&(n=100);var r=100-Math.round(.67*(i.y+5));0>r&&(r=0),r>100&&(r=100);var s=t.data("hsb");s.s=n,s.b=r,d(t,s,!0)},u=function(t,e){var a=t.data("huePicker");a.hide();var i={y:e.pageY};e.originalEvent.changedTouches&&(i.y=e.originalEvent.changedTouches[0].pageY),i.y=i.y-t.data("selector").find(".miniColors-colors").offset().top-1,i.y<=-1&&(i.y=-1),i.y>=149&&(i.y=149),t.data("huePosition",i),a.css("top",i.y).show();var n=Math.round(2.4*(150-i.y-1));0>n&&(n=0),n>360&&(n=360);var r=t.data("hsb");r.h=n,d(t,r,!0)},d=function(t,e,a){t.data("hsb",e);var i=C(e);if(a&&t.val("#"+f(i,t.data("letterCase"))).trigger("change"),t.data("trigger").css("backgroundColor","#"+i),t.data("selector")&&t.data("selector").find(".miniColors-colors").css("backgroundColor","#"+C({h:e.h,s:100,b:100})),t.data("change")){if(i===t.data("lastChange"))return;t.data("change").call(t.get(0),"#"+i,k(e)),t.data("lastChange",i)}},p=function(e){e.val("#"+g(e.val())).trigger("change");var a=y(e.val());if(!a)return!1;var i=_(a),n=e.data("hsb");if(i.h===n.h&&i.s===n.s&&i.b===n.b)return!0;var r=v(i),s=t(e.data("colorPicker"));s.css("top",r.y+"px").css("left",r.x+"px"),e.data("colorPosition",r);var o=m(i),l=t(e.data("huePicker"));return l.css("top",o.y+"px"),e.data("huePosition",o),d(e,i),!0},f=function(t,e){return"lowercase"===e?t.toLowerCase():"uppercase"===e?t.toUpperCase():t},v=function(t){var e=Math.ceil(t.s/.67);0>e&&(e=0),e>150&&(e=150);var a=150-Math.ceil(t.b/.67);return 0>a&&(a=0),a>150&&(a=150),{x:e-5,y:a-5}},m=function(t){var e=150-t.h/2.4;return 0>e&&(h=0),e>150&&(h=150),{y:e-1}},g=function(t){return t.replace(/[^A-F0-9]/gi,"")},y=function(t){return(t=g(t))?(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length?t:null):null},k=function(t){var e={},a=Math.round(t.h),i=Math.round(255*t.s/100),n=Math.round(255*t.b/100);if(0===i)e.r=e.g=e.b=n;else{var r=n,s=(255-i)*n/255,o=(r-s)*(a%60)/60;360===a&&(a=0),60>a?(e.r=r,e.b=s,e.g=s+o):120>a?(e.g=r,e.b=s,e.r=r-o):180>a?(e.g=r,e.r=s,e.b=s+o):240>a?(e.b=r,e.r=s,e.g=r-o):300>a?(e.b=r,e.g=s,e.r=s+o):360>a?(e.r=r,e.g=s,e.b=r-o):(e.r=0,e.g=0,e.b=0)}return{r:Math.round(e.r),g:Math.round(e.g),b:Math.round(e.b)}},b=function(e){var a=[e.r.toString(16),e.g.toString(16),e.b.toString(16)];return t.each(a,function(t,e){1===e.length&&(a[t]="0"+e)}),a.join("")},x=function(t){return t=parseInt(t.indexOf("#")>-1?t.substring(1):t,16),{r:t>>16,g:(65280&t)>>8,b:255&t}},w=function(t){var e={h:0,s:0,b:0},a=Math.min(t.r,t.g,t.b),i=Math.max(t.r,t.g,t.b),n=i-a;return e.b=i,e.s=0!==i?255*n/i:0,0!==e.s?t.r===i?e.h=(t.g-t.b)/n:t.g===i?e.h=2+(t.b-t.r)/n:e.h=4+(t.r-t.g)/n:e.h=-1,e.h*=60,e.h<0&&(e.h+=360),e.s*=100/255,e.b*=100/255,e},_=function(t){var e=w(x(t));return 0===e.s&&(e.h=360),e},C=function(t){return b(k(t))};switch(e){case"readonly":return t(this).each(function(){t(this).hasClass("miniColors")&&t(this).prop("readonly",a)}),t(this);case"disabled":return t(this).each(function(){t(this).hasClass("miniColors")&&(a?s(t(this)):r(t(this)))}),t(this);case"value":if(void 0===a){if(!t(this).hasClass("miniColors"))return;var D=t(this),T=y(D.val());return T?"#"+f(T,D.data("letterCase")):null}return t(this).each(function(){t(this).hasClass("miniColors")&&(t(this).val(a).trigger("change"),p(t(this)))}),t(this);case"destroy":return t(this).each(function(){t(this).hasClass("miniColors")&&n(t(this))}),t(this);default:return e||(e={}),t(this).each(function(){"input"===t(this)[0].tagName.toLowerCase()&&(t(this).data("trigger")||i(t(this),e,a))}),t(this)}}})}(jQuery),function(t,e){function a(){return new Date(Date.UTC.apply(Date,arguments))}function i(){var t=new Date;return a(t.getFullYear(),t.getMonth(),t.getDate())}function n(t){return function(){return this[t].apply(this,arguments)}}function r(e,a){function i(t,e){return e.toLowerCase()}var n,r=t(e).data(),s={},o=new RegExp("^"+a.toLowerCase()+"([A-Z])");a=new RegExp("^"+a.toLowerCase());for(var l in r)a.test(l)&&(n=l.replace(o,i),s[n]=r[l]);return s}function s(e){var a={};if(f[e]||(e=e.split("-")[0],f[e])){var i=f[e];return t.each(p,function(t,e){e in i&&(a[e]=i[e])}),a}}var o=t(window),l=function(){var e={get:function(t){return this.slice(t)[0]},contains:function(t){for(var e=t&&t.valueOf(),a=0,i=this.length;i>a;a++)if(this[a].valueOf()===e)return a;return-1},remove:function(t){this.splice(t,1)},replace:function(e){e&&(t.isArray(e)||(e=[e]),this.clear(),this.push.apply(this,e))},clear:function(){this.splice(0)},copy:function(){var t=new l;return t.replace(this),t}};return function(){var a=[];return a.push.apply(a,arguments),t.extend(a,e),a}}(),c=function(e,a){this.dates=new l,this.viewDate=i(),this.focusDate=null,this._process_options(a),this.element=t(e),this.isInline=!1,this.isInput=this.element.is("input"),this.component=this.element.is(".date")?this.element.find(".add-on, .input-group-addon, .btn"):!1,this.hasInput=this.component&&this.element.find("input").length,this.component&&0===this.component.length&&(this.component=!1),this.picker=t(v.template),this._buildEvents(),this._attachEvents(),this.isInline?this.picker.addClass("cfdatepicker-inline").appendTo(this.element):this.picker.addClass("cfdatepicker-dropdown dropdown-menu"),this.o.rtl&&this.picker.addClass("cfdatepicker-rtl"),this.viewMode=this.o.startView,this.o.calendarWeeks&&this.picker.find("tfoot th.today").attr("colspan",function(t,e){return parseInt(e)+1}),this._allow_update=!1,this.setStartDate(this._o.startDate),this.setEndDate(this._o.endDate),this.setDaysOfWeekDisabled(this.o.daysOfWeekDisabled),this.fillDow(),this.fillMonths(),this._allow_update=!0,this.update(),this.showMode(),this.isInline&&this.show()};c.prototype={constructor:c,_process_options:function(e){this._o=t.extend({},this._o,e);var a=this.o=t.extend({},this._o),i=a.language;switch(f[i]||(i=i.split("-")[0],f[i]||(i=d.language)),a.language=i,a.startView){case 2:case"decade":a.startView=2;break;case 1:case"year":a.startView=1;break;default:a.startView=0}switch(a.minViewMode){case 1:case"months":a.minViewMode=1;break;case 2:case"years":a.minViewMode=2;break;default:a.minViewMode=0}a.startView=Math.max(a.startView,a.minViewMode),a.multidate!==!0&&(a.multidate=Number(a.multidate)||!1,a.multidate!==!1?a.multidate=Math.max(0,a.multidate):a.multidate=1),a.multidateSeparator=String(a.multidateSeparator),a.weekStart%=7,a.weekEnd=(a.weekStart+6)%7;var n=v.parseFormat(a.format);a.startDate!==-(1/0)&&(a.startDate?a.startDate instanceof Date?a.startDate=this._local_to_utc(this._zero_time(a.startDate)):a.startDate=v.parseDate(a.startDate,n,a.language):a.startDate=-(1/0)),a.endDate!==1/0&&(a.endDate?a.endDate instanceof Date?a.endDate=this._local_to_utc(this._zero_time(a.endDate)):a.endDate=v.parseDate(a.endDate,n,a.language):a.endDate=1/0),a.daysOfWeekDisabled=a.daysOfWeekDisabled||[],t.isArray(a.daysOfWeekDisabled)||(a.daysOfWeekDisabled=a.daysOfWeekDisabled.split(/[,\s]*/)),a.daysOfWeekDisabled=t.map(a.daysOfWeekDisabled,function(t){return parseInt(t,10)});var r=String(a.orientation).toLowerCase().split(/\s+/g),s=a.orientation.toLowerCase();if(r=t.grep(r,function(t){return/^auto|left|right|top|bottom$/.test(t)}),a.orientation={x:"auto",y:"auto"},s&&"auto"!==s)if(1===r.length)switch(r[0]){case"top":case"bottom":a.orientation.y=r[0];break;case"left":case"right":a.orientation.x=r[0]}else s=t.grep(r,function(t){return/^left|right$/.test(t)}),a.orientation.x=s[0]||"auto",s=t.grep(r,function(t){return/^top|bottom$/.test(t)}),a.orientation.y=s[0]||"auto";else;},_events:[],_secondaryEvents:[],_applyEvents:function(t){for(var a,i,n,r=0;r<t.length;r++)a=t[r][0],2===t[r].length?(i=e,n=t[r][1]):3===t[r].length&&(i=t[r][1],n=t[r][2]),a.on(n,i)},_unapplyEvents:function(t){for(var a,i,n,r=0;r<t.length;r++)a=t[r][0],2===t[r].length?(n=e,i=t[r][1]):3===t[r].length&&(n=t[r][1],i=t[r][2]),a.off(i,n)},_buildEvents:function(){this.isInput?this._events=[[this.element,{focus:t.proxy(this.show,this),keyup:t.proxy(function(e){-1===t.inArray(e.keyCode,[27,37,39,38,40,32,13,9])&&this.update()},this),keydown:t.proxy(this.keydown,this)}]]:this.component&&this.hasInput?this._events=[[this.element.find("input"),{focus:t.proxy(this.show,this),keyup:t.proxy(function(e){-1===t.inArray(e.keyCode,[27,37,39,38,40,32,13,9])&&this.update()},this),keydown:t.proxy(this.keydown,this)}],[this.component,{click:t.proxy(this.show,this)}]]:this.element.is("div")?this.isInline=!0:this._events=[[this.element,{click:t.proxy(this.show,this)}]],this._events.push([this.element,"*",{blur:t.proxy(function(t){this._focused_from=t.target},this)}],[this.element,{blur:t.proxy(function(t){this._focused_from=t.target},this)}]),this._secondaryEvents=[[this.picker,{click:t.proxy(this.click,this)}],[t(window),{resize:t.proxy(this.place,this)}],[t(document),{"mousedown touchstart":t.proxy(function(t){this.element.is(t.target)||this.element.find(t.target).length||this.picker.is(t.target)||this.picker.find(t.target).length||this.hide()},this)}]]},_attachEvents:function(){this._detachEvents(),this._applyEvents(this._events)},_detachEvents:function(){this._unapplyEvents(this._events)},_attachSecondaryEvents:function(){this._detachSecondaryEvents(),this._applyEvents(this._secondaryEvents)},_detachSecondaryEvents:function(){this._unapplyEvents(this._secondaryEvents)},_trigger:function(e,a){var i=a||this.dates.get(-1),n=this._utc_to_local(i);this.element.trigger({type:e,date:n,dates:t.map(this.dates,this._utc_to_local),format:t.proxy(function(t,e){0===arguments.length?(t=this.dates.length-1,e=this.o.format):"string"==typeof t&&(e=t,t=this.dates.length-1),e=e||this.o.format;var a=this.dates.get(t);return v.formatDate(a,e,this.o.language)},this)})},show:function(){this.isInline||this.picker.appendTo("body"),this.picker.show(),this.place(),this._attachSecondaryEvents(),this._trigger("show")},hide:function(){this.isInline||this.picker.is(":visible")&&(this.focusDate=null,this.picker.hide().detach(),this._detachSecondaryEvents(),this.viewMode=this.o.startView,this.showMode(),this.o.forceParse&&(this.isInput&&this.element.val()||this.hasInput&&this.element.find("input").val())&&this.setValue(),this._trigger("hide"))},remove:function(){this.hide(),this._detachEvents(),this._detachSecondaryEvents(),this.picker.remove(),delete this.element.data().cfdatepicker,this.isInput||delete this.element.data().date},_utc_to_local:function(t){return t&&new Date(t.getTime()+6e4*t.getTimezoneOffset())},_local_to_utc:function(t){return t&&new Date(t.getTime()-6e4*t.getTimezoneOffset())},_zero_time:function(t){return t&&new Date(t.getFullYear(),t.getMonth(),t.getDate())},_zero_utc_time:function(t){return t&&new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()))},getDates:function(){return t.map(this.dates,this._utc_to_local)},getUTCDates:function(){return t.map(this.dates,function(t){return new Date(t)})},getDate:function(){return this._utc_to_local(this.getUTCDate())},getUTCDate:function(){return new Date(this.dates.get(-1))},setDates:function(){var e=t.isArray(arguments[0])?arguments[0]:arguments;this.update.apply(this,e),this._trigger("changeDate"),this.setValue()},setUTCDates:function(){var e=t.isArray(arguments[0])?arguments[0]:arguments;this.update.apply(this,t.map(e,this._utc_to_local)),this._trigger("changeDate"),this.setValue()},setDate:n("setDates"),setUTCDate:n("setUTCDates"),setValue:function(){var t=this.getFormattedDate();this.isInput?this.element.val(t).change():this.component&&this.element.find("input").val(t).change()},getFormattedDate:function(a){a===e&&(a=this.o.format);var i=this.o.language;return t.map(this.dates,function(t){return v.formatDate(t,a,i)}).join(this.o.multidateSeparator)},setStartDate:function(t){this._process_options({startDate:t}),this.update(),this.updateNavArrows()},setEndDate:function(t){this._process_options({endDate:t}),this.update(),this.updateNavArrows()},setDaysOfWeekDisabled:function(t){this._process_options({daysOfWeekDisabled:t}),this.update(),this.updateNavArrows()},place:function(){if(!this.isInline){var e=this.picker.outerWidth(),a=this.picker.outerHeight(),i=10,n=o.width(),r=o.height(),s=o.scrollTop(),l=parseInt(this.element.parents().filter(function(){return"auto"!==t(this).css("z-index")}).first().css("z-index"))+10,c=this.component?this.component.parent().offset():this.element.offset(),h=this.component?this.component.outerHeight(!0):this.element.outerHeight(!1),u=this.component?this.component.outerWidth(!0):this.element.outerWidth(!1),d=c.left,p=c.top;this.picker.removeClass("cfdatepicker-orient-top cfdatepicker-orient-bottom cfdatepicker-orient-right cfdatepicker-orient-left"),"auto"!==this.o.orientation.x?(this.picker.addClass("cfdatepicker-orient-"+this.o.orientation.x),"right"===this.o.orientation.x&&(d-=e-u)):(this.picker.addClass("cfdatepicker-orient-left"),c.left<0?d-=c.left-i:c.left+e>n&&(d=n-e-i));var f,v,m=this.o.orientation.y;"auto"===m&&(f=-s+c.top-a,v=s+r-(c.top+h+a),m=Math.max(f,v)===v?"top":"bottom"),this.picker.addClass("cfdatepicker-orient-"+m),"top"===m?p+=h:p-=a+parseInt(this.picker.css("padding-top")),this.picker.css({top:p,left:d,zIndex:l})}},_allow_update:!0,update:function(){if(this._allow_update){var e=this.dates.copy(),a=[],i=!1;arguments.length?(t.each(arguments,t.proxy(function(t,e){e instanceof Date&&(e=this._local_to_utc(e)),a.push(e)},this)),i=!0):(a=this.isInput?this.element.val():this.element.data("date")||this.element.find("input").val(),a=a&&this.o.multidate?a.split(this.o.multidateSeparator):[a],delete this.element.data().date),a=t.map(a,t.proxy(function(t){return v.parseDate(t,this.o.format,this.o.language)},this)),a=t.grep(a,t.proxy(function(t){return t<this.o.startDate||t>this.o.endDate||!t},this),!0),this.dates.replace(a),this.dates.length?this.viewDate=new Date(this.dates.get(-1)):this.viewDate<this.o.startDate?this.viewDate=new Date(this.o.startDate):this.viewDate>this.o.endDate&&(this.viewDate=new Date(this.o.endDate)),i?this.setValue():a.length&&String(e)!==String(this.dates)&&this._trigger("changeDate"),!this.dates.length&&e.length&&this._trigger("clearDate"),this.fill()}},fillDow:function(){var t=this.o.weekStart,e="<tr>";if(this.o.calendarWeeks){var a='<th class="cw"> </th>';e+=a,this.picker.find(".cfdatepicker-days thead tr:first-child").prepend(a)}for(;t<this.o.weekStart+7;)e+='<th class="dow">'+f[this.o.language].daysMin[t++%7]+"</th>";e+="</tr>",this.picker.find(".cfdatepicker-days thead").append(e)},fillMonths:function(){for(var t="",e=0;12>e;)t+='<span class="month">'+f[this.o.language].monthsShort[e++]+"</span>";this.picker.find(".cfdatepicker-months td").html(t)},setRange:function(e){e&&e.length?this.range=t.map(e,function(t){return t.valueOf()}):delete this.range,this.fill()},getClassNames:function(e){var a=[],i=this.viewDate.getUTCFullYear(),n=this.viewDate.getUTCMonth(),r=new Date;return e.getUTCFullYear()<i||e.getUTCFullYear()===i&&e.getUTCMonth()<n?a.push("old"):(e.getUTCFullYear()>i||e.getUTCFullYear()===i&&e.getUTCMonth()>n)&&a.push("new"),this.focusDate&&e.valueOf()===this.focusDate.valueOf()&&a.push("focused"),this.o.todayHighlight&&e.getUTCFullYear()===r.getFullYear()&&e.getUTCMonth()===r.getMonth()&&e.getUTCDate()===r.getDate()&&a.push("today"),-1!==this.dates.contains(e)&&a.push("active"),(e.valueOf()<this.o.startDate||e.valueOf()>this.o.endDate||-1!==t.inArray(e.getUTCDay(),this.o.daysOfWeekDisabled))&&a.push("disabled"),this.range&&(e>this.range[0]&&e<this.range[this.range.length-1]&&a.push("range"),-1!==t.inArray(e.valueOf(),this.range)&&a.push("selected")),a},fill:function(){var i,n=new Date(this.viewDate),r=n.getUTCFullYear(),s=n.getUTCMonth(),o=this.o.startDate!==-(1/0)?this.o.startDate.getUTCFullYear():-(1/0),l=this.o.startDate!==-(1/0)?this.o.startDate.getUTCMonth():-(1/0),c=this.o.endDate!==1/0?this.o.endDate.getUTCFullYear():1/0,h=this.o.endDate!==1/0?this.o.endDate.getUTCMonth():1/0,u=f[this.o.language].today||f.en.today||"",d=f[this.o.language].clear||f.en.clear||"";this.picker.find(".cfdatepicker-days thead th.cfdatepicker-switch").text(f[this.o.language].months[s]+" "+r),this.picker.find("tfoot th.today").text(u).toggle(this.o.todayBtn!==!1),this.picker.find("tfoot th.clear").text(d).toggle(this.o.clearBtn!==!1),this.updateNavArrows(),this.fillMonths();var p=a(r,s-1,28),m=v.getDaysInMonth(p.getUTCFullYear(),p.getUTCMonth());p.setUTCDate(m),p.setUTCDate(m-(p.getUTCDay()-this.o.weekStart+7)%7);var g=new Date(p);g.setUTCDate(g.getUTCDate()+42),g=g.valueOf();for(var y,k=[];p.valueOf()<g;){if(p.getUTCDay()===this.o.weekStart&&(k.push("<tr>"),this.o.calendarWeeks)){var b=new Date(+p+(this.o.weekStart-p.getUTCDay()-7)%7*864e5),x=new Date(Number(b)+(11-b.getUTCDay())%7*864e5),w=new Date(Number(w=a(x.getUTCFullYear(),0,1))+(11-w.getUTCDay())%7*864e5),_=(x-w)/864e5/7+1;k.push('<td class="cw">'+_+"</td>")}if(y=this.getClassNames(p),y.push("day"),this.o.beforeShowDay!==t.noop){var C=this.o.beforeShowDay(this._utc_to_local(p));C===e?C={}:"boolean"==typeof C?C={enabled:C}:"string"==typeof C&&(C={classes:C}),C.enabled===!1&&y.push("disabled"),C.classes&&(y=y.concat(C.classes.split(/\s+/))),C.tooltip&&(i=C.tooltip)}y=t.unique(y),k.push('<td class="'+y.join(" ")+'"'+(i?' title="'+i+'"':"")+">"+p.getUTCDate()+"</td>"),p.getUTCDay()===this.o.weekEnd&&k.push("</tr>"),p.setUTCDate(p.getUTCDate()+1)}this.picker.find(".cfdatepicker-days tbody").empty().append(k.join(""));var D=this.picker.find(".cfdatepicker-months").find("th:eq(1)").text(r).end().find("span").removeClass("active");t.each(this.dates,function(t,e){e.getUTCFullYear()===r&&D.eq(e.getUTCMonth()).addClass("active")}),(o>r||r>c)&&D.addClass("disabled"),r===o&&D.slice(0,l).addClass("disabled"),r===c&&D.slice(h+1).addClass("disabled"),k="",r=10*parseInt(r/10,10);var T=this.picker.find(".cfdatepicker-years").find("th:eq(1)").text(r+"-"+(r+9)).end().find("td");r-=1;for(var P,M=t.map(this.dates,function(t){return t.getUTCFullYear()}),S=-1;11>S;S++)P=["year"],-1===S?P.push("old"):10===S&&P.push("new"),-1!==t.inArray(r,M)&&P.push("active"),(o>r||r>c)&&P.push("disabled"),k+='<span class="'+P.join(" ")+'">'+r+"</span>",r+=1;T.html(k)},updateNavArrows:function(){if(this._allow_update){var t=new Date(this.viewDate),e=t.getUTCFullYear(),a=t.getUTCMonth();switch(this.viewMode){case 0:this.o.startDate!==-(1/0)&&e<=this.o.startDate.getUTCFullYear()&&a<=this.o.startDate.getUTCMonth()?this.picker.find(".prev").css({visibility:"hidden"}):this.picker.find(".prev").css({visibility:"visible"}),this.o.endDate!==1/0&&e>=this.o.endDate.getUTCFullYear()&&a>=this.o.endDate.getUTCMonth()?this.picker.find(".next").css({visibility:"hidden"}):this.picker.find(".next").css({visibility:"visible"});break;case 1:case 2:this.o.startDate!==-(1/0)&&e<=this.o.startDate.getUTCFullYear()?this.picker.find(".prev").css({visibility:"hidden"}):this.picker.find(".prev").css({visibility:"visible"}),this.o.endDate!==1/0&&e>=this.o.endDate.getUTCFullYear()?this.picker.find(".next").css({visibility:"hidden"}):this.picker.find(".next").css({visibility:"visible"})}}},click:function(e){e.preventDefault();var i,n,r,s=t(e.target).closest("span, td, th");if(1===s.length)switch(s[0].nodeName.toLowerCase()){case"th":switch(s[0].className){case"cfdatepicker-switch":this.showMode(1);break;case"prev":case"next":var o=v.modes[this.viewMode].navStep*("prev"===s[0].className?-1:1);switch(this.viewMode){case 0:this.viewDate=this.moveMonth(this.viewDate,o),this._trigger("changeMonth",this.viewDate);break;case 1:case 2:this.viewDate=this.moveYear(this.viewDate,o),1===this.viewMode&&this._trigger("changeYear",this.viewDate)}this.fill();break;case"today":var l=new Date;l=a(l.getFullYear(),l.getMonth(),l.getDate(),0,0,0),this.showMode(-2);var c="linked"===this.o.todayBtn?null:"view";this._setDate(l,c);break;case"clear":var h;this.isInput?h=this.element:this.component&&(h=this.element.find("input")),h&&h.val("").change(),this.update(),this._trigger("changeDate"),this.o.autoclose&&this.hide()}break;case"span":s.is(".disabled")||(this.viewDate.setUTCDate(1),s.is(".month")?(r=1,n=s.parent().find("span").index(s),i=this.viewDate.getUTCFullYear(),this.viewDate.setUTCMonth(n),this._trigger("changeMonth",this.viewDate),1===this.o.minViewMode&&this._setDate(a(i,n,r))):(r=1,n=0,i=parseInt(s.text(),10)||0,this.viewDate.setUTCFullYear(i),this._trigger("changeYear",this.viewDate),2===this.o.minViewMode&&this._setDate(a(i,n,r))),this.showMode(-1),this.fill());break;case"td":s.is(".day")&&!s.is(".disabled")&&(r=parseInt(s.text(),10)||1,i=this.viewDate.getUTCFullYear(),n=this.viewDate.getUTCMonth(),s.is(".old")?0===n?(n=11,i-=1):n-=1:s.is(".new")&&(11===n?(n=0,i+=1):n+=1),this._setDate(a(i,n,r)))}this.picker.is(":visible")&&this._focused_from&&t(this._focused_from).focus(),delete this._focused_from},_toggle_multidate:function(t){var e=this.dates.contains(t);if(t?-1!==e?this.dates.remove(e):this.dates.push(t):this.dates.clear(),"number"==typeof this.o.multidate)for(;this.dates.length>this.o.multidate;)this.dates.remove(0)},_setDate:function(t,e){e&&"date"!==e||this._toggle_multidate(t&&new Date(t)),e&&"view"!==e||(this.viewDate=t&&new Date(t)),this.fill(),this.setValue(),this._trigger("changeDate");var a;this.isInput?a=this.element:this.component&&(a=this.element.find("input")),a&&a.change(),!this.o.autoclose||e&&"date"!==e||this.hide()},moveMonth:function(t,a){if(!t)return e;if(!a)return t;var i,n,r=new Date(t.valueOf()),s=r.getUTCDate(),o=r.getUTCMonth(),l=Math.abs(a);if(a=a>0?1:-1,1===l)n=-1===a?function(){return r.getUTCMonth()===o}:function(){return r.getUTCMonth()!==i},i=o+a,r.setUTCMonth(i),(0>i||i>11)&&(i=(i+12)%12);else{for(var c=0;l>c;c++)r=this.moveMonth(r,a);i=r.getUTCMonth(),r.setUTCDate(s),n=function(){return i!==r.getUTCMonth()}}for(;n();)r.setUTCDate(--s),r.setUTCMonth(i);return r},moveYear:function(t,e){return this.moveMonth(t,12*e)},dateWithinRange:function(t){return t>=this.o.startDate&&t<=this.o.endDate},keydown:function(t){if(this.picker.is(":not(:visible)"))return void(27===t.keyCode&&this.show());var e,a,n,r=!1,s=this.focusDate||this.viewDate;switch(t.keyCode){case 27:this.focusDate?(this.focusDate=null,this.viewDate=this.dates.get(-1)||this.viewDate,this.fill()):this.hide(),t.preventDefault();break;case 37:case 39:if(!this.o.keyboardNavigation)break;e=37===t.keyCode?-1:1,t.ctrlKey?(a=this.moveYear(this.dates.get(-1)||i(),e),n=this.moveYear(s,e),this._trigger("changeYear",this.viewDate)):t.shiftKey?(a=this.moveMonth(this.dates.get(-1)||i(),e),n=this.moveMonth(s,e),this._trigger("changeMonth",this.viewDate)):(a=new Date(this.dates.get(-1)||i()),a.setUTCDate(a.getUTCDate()+e),n=new Date(s),n.setUTCDate(s.getUTCDate()+e)),this.dateWithinRange(a)&&(this.focusDate=this.viewDate=n,this.setValue(),this.fill(),t.preventDefault());break;case 38:case 40:if(!this.o.keyboardNavigation)break;e=38===t.keyCode?-1:1,t.ctrlKey?(a=this.moveYear(this.dates.get(-1)||i(),e),n=this.moveYear(s,e),this._trigger("changeYear",this.viewDate)):t.shiftKey?(a=this.moveMonth(this.dates.get(-1)||i(),e),n=this.moveMonth(s,e),this._trigger("changeMonth",this.viewDate)):(a=new Date(this.dates.get(-1)||i()),a.setUTCDate(a.getUTCDate()+7*e),n=new Date(s),n.setUTCDate(s.getUTCDate()+7*e)),this.dateWithinRange(a)&&(this.focusDate=this.viewDate=n,this.setValue(),this.fill(),t.preventDefault());break;case 32:break;case 13:s=this.focusDate||this.dates.get(-1)||this.viewDate,this._toggle_multidate(s),r=!0,this.focusDate=null,this.viewDate=this.dates.get(-1)||this.viewDate,this.setValue(),this.fill(),this.picker.is(":visible")&&(t.preventDefault(),this.o.autoclose&&this.hide());break;case 9:this.focusDate=null,this.viewDate=this.dates.get(-1)||this.viewDate,this.fill(),this.hide()}if(r){this.dates.length?this._trigger("changeDate"):this._trigger("clearDate");var o;this.isInput?o=this.element:this.component&&(o=this.element.find("input")),o&&o.change()}},showMode:function(t){t&&(this.viewMode=Math.max(this.o.minViewMode,Math.min(2,this.viewMode+t))),this.picker.find(">div").hide().filter(".cfdatepicker-"+v.modes[this.viewMode].clsName).css("display","block"),this.updateNavArrows()}};var h=function(e,a){this.element=t(e),this.inputs=t.map(a.inputs,function(t){return t.jquery?t[0]:t}),delete a.inputs,t(this.inputs).cfdatepicker(a).bind("changeDate",t.proxy(this.dateUpdated,this)),this.pickers=t.map(this.inputs,function(e){return t(e).data("cfdatepicker")}),this.updateDates()};h.prototype={updateDates:function(){this.dates=t.map(this.pickers,function(t){return t.getUTCDate()}),this.updateRanges()},updateRanges:function(){var e=t.map(this.dates,function(t){return t.valueOf()});t.each(this.pickers,function(t,a){a.setRange(e)})},dateUpdated:function(e){if(!this.updating){this.updating=!0;var a=t(e.target).data("cfdatepicker"),i=a.getUTCDate(),n=t.inArray(e.target,this.inputs),r=this.inputs.length;if(-1!==n){if(t.each(this.pickers,function(t,e){e.getUTCDate()||e.setUTCDate(i)}),i<this.dates[n])for(;n>=0&&i<this.dates[n];)this.pickers[n--].setUTCDate(i);else if(i>this.dates[n])for(;r>n&&i>this.dates[n];)this.pickers[n++].setUTCDate(i);this.updateDates(),delete this.updating}}},remove:function(){t.map(this.pickers,function(t){t.remove()}),delete this.element.data().cfdatepicker}};var u=t.fn.cfdatepicker;t.fn.cfdatepicker=function(a){var i=Array.apply(null,arguments);i.shift();var n;return this.each(function(){var o=t(this),l=o.data("cfdatepicker"),u="object"==typeof a&&a;if(!l){var p=r(this,"date"),f=t.extend({},d,p,u),v=s(f.language),m=t.extend({},d,v,p,u);if(o.is(".input-daterange")||m.inputs){var g={inputs:m.inputs||o.find("input").toArray()};o.data("cfdatepicker",l=new h(this,t.extend(m,g)))}else o.data("cfdatepicker",l=new c(this,m))}return"string"==typeof a&&"function"==typeof l[a]&&(n=l[a].apply(l,i),n!==e)?!1:void 0}),n!==e?n:this};var d=t.fn.cfdatepicker.defaults={autoclose:!1,beforeShowDay:t.noop,calendarWeeks:!1,clearBtn:!1,daysOfWeekDisabled:[],endDate:1/0,forceParse:!0,format:"mm/dd/yyyy",keyboardNavigation:!0,language:"en",minViewMode:0,multidate:!1,multidateSeparator:",",orientation:"auto",rtl:!1,startDate:-(1/0),startView:0,todayBtn:!1,todayHighlight:!1,weekStart:0},p=t.fn.cfdatepicker.locale_opts=["format","rtl","weekStart"];t.fn.cfdatepicker.Constructor=c;var f=t.fn.cfdatepicker.dates={en:{days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],daysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sun"],daysMin:["Su","Mo","Tu","We","Th","Fr","Sa","Su"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],today:"Today",clear:"Clear"}},v={modes:[{clsName:"days",navFnc:"Month",navStep:1},{clsName:"months",navFnc:"FullYear",navStep:1},{clsName:"years",navFnc:"FullYear",navStep:10}],isLeapYear:function(t){return t%4===0&&t%100!==0||t%400===0},getDaysInMonth:function(t,e){return[31,v.isLeapYear(t)?29:28,31,30,31,30,31,31,30,31,30,31][e]},validParts:/dd?|DD?|mm?|MM?|yy(?:yy)?/g,nonpunctuation:/[^ -\/:-@\[\u3400-\u9fff-`{-~\t\n\r]+/g,parseFormat:function(t){var e=t.replace(this.validParts,"\x00").split("\x00"),a=t.match(this.validParts);if(!e||!e.length||!a||0===a.length)throw new Error("Invalid date format.");return{separators:e,
|
2 |
+
parts:a}},parseDate:function(i,n,r){function s(){var t=this.slice(0,d[h].length),e=d[h].slice(0,t.length);return t===e}if(!i)return e;if(i instanceof Date)return i;"string"==typeof n&&(n=v.parseFormat(n));var o,l,h,u=/([\-+]\d+)([dmwy])/,d=i.match(/([\-+]\d+)([dmwy])/g);if(/^[\-+]\d+[dmwy]([\s,]+[\-+]\d+[dmwy])*$/.test(i)){for(i=new Date,h=0;h<d.length;h++)switch(o=u.exec(d[h]),l=parseInt(o[1]),o[2]){case"d":i.setUTCDate(i.getUTCDate()+l);break;case"m":i=c.prototype.moveMonth.call(c.prototype,i,l);break;case"w":i.setUTCDate(i.getUTCDate()+7*l);break;case"y":i=c.prototype.moveYear.call(c.prototype,i,l)}return a(i.getUTCFullYear(),i.getUTCMonth(),i.getUTCDate(),0,0,0)}d=i&&i.match(this.nonpunctuation)||[],i=new Date;var p,m,g={},y=["yyyy","yy","M","MM","m","mm","d","dd"],k={yyyy:function(t,e){return t.setUTCFullYear(e)},yy:function(t,e){return t.setUTCFullYear(2e3+e)},m:function(t,e){if(isNaN(t))return t;for(e-=1;0>e;)e+=12;for(e%=12,t.setUTCMonth(e);t.getUTCMonth()!==e;)t.setUTCDate(t.getUTCDate()-1);return t},d:function(t,e){return t.setUTCDate(e)}};k.M=k.MM=k.mm=k.m,k.dd=k.d,i=a(i.getFullYear(),i.getMonth(),i.getDate(),0,0,0);var b=n.parts.slice();if(d.length!==b.length&&(b=t(b).filter(function(e,a){return-1!==t.inArray(a,y)}).toArray()),d.length===b.length){var x;for(h=0,x=b.length;x>h;h++){if(p=parseInt(d[h],10),o=b[h],isNaN(p))switch(o){case"MM":m=t(f[r].months).filter(s),p=t.inArray(m[0],f[r].months)+1;break;case"M":m=t(f[r].monthsShort).filter(s),p=t.inArray(m[0],f[r].monthsShort)+1}g[o]=p}var w,_;for(h=0;h<y.length;h++)_=y[h],_ in g&&!isNaN(g[_])&&(w=new Date(i),k[_](w,g[_]),isNaN(w)||(i=w))}return i},formatDate:function(e,a,i){if(!e)return"";"string"==typeof a&&(a=v.parseFormat(a));var n={d:e.getUTCDate(),D:f[i].daysShort[e.getUTCDay()],DD:f[i].days[e.getUTCDay()],m:e.getUTCMonth()+1,M:f[i].monthsShort[e.getUTCMonth()],MM:f[i].months[e.getUTCMonth()],yy:e.getUTCFullYear().toString().substring(2),yyyy:e.getUTCFullYear()};n.dd=(n.d<10?"0":"")+n.d,n.mm=(n.m<10?"0":"")+n.m,e=[];for(var r=t.extend([],a.separators),s=0,o=a.parts.length;o>=s;s++)r.length&&e.push(r.shift()),e.push(n[a.parts[s]]);return e.join("")},headTemplate:'<thead><tr><th class="prev">«</th><th colspan="5" class="cfdatepicker-switch"></th><th class="next">»</th></tr></thead>',contTemplate:'<tbody><tr><td colspan="7"></td></tr></tbody>',footTemplate:'<tfoot><tr><th colspan="7" class="today"></th></tr><tr><th colspan="7" class="clear"></th></tr></tfoot>'};v.template='<div class="cfdatepicker"><div class="cfdatepicker-days"><table class=" table-condensed">'+v.headTemplate+"<tbody></tbody>"+v.footTemplate+'</table></div><div class="cfdatepicker-months"><table class="table-condensed">'+v.headTemplate+v.contTemplate+v.footTemplate+'</table></div><div class="cfdatepicker-years"><table class="table-condensed">'+v.headTemplate+v.contTemplate+v.footTemplate+"</table></div></div>",t.fn.cfdatepicker.DPGlobal=v,t.fn.cfdatepicker.noConflict=function(){return t.fn.cfdatepicker=u,this},t(document).on("focus.cfdatepicker.data-api click.cfdatepicker.data-api",'[data-provide="cfdatepicker"]',function(e){var a=t(this);a.data("cfdatepicker")||(e.preventDefault(),a.cfdatepicker("show").on("show",function(){t(this).trigger("blur")}).on("hide",function(){t(this).attr("disabled",!1)}))})}(window.jQuery),!function(t){function e(t){var e=document.createElement("input"),a="on"+t,i=a in e;return i||(e.setAttribute(a,"return;"),i="function"==typeof e[a]),e=null,i}function a(t){var e="text"==t||"tel"==t;if(!e){var a=document.createElement("input");a.setAttribute("type",t),e="text"===a.type,a=null}return e}function i(e,a,n){var r=n.aliases[e];return r?(r.alias&&i(r.alias,void 0,n),t.extend(!0,n,r),t.extend(!0,n,a),!0):!1}function n(e,a){function i(t){function a(t,e,a,i){this.matches=[],this.isGroup=t||!1,this.isOptional=e||!1,this.isQuantifier=a||!1,this.isAlternator=i||!1,this.quantifier={min:1,max:1}}function i(t,a,i){var n=e.definitions[a],r=0==t.matches.length;if(i=void 0!=i?i:t.matches.length,n&&!u){for(var s=n.prevalidator,o=s?s.length:0,l=1;l<n.cardinality;l++){var c=o>=l?s[l-1]:[],h=c.validator,d=c.cardinality;t.matches.splice(i++,0,{fn:h?"string"==typeof h?new RegExp(h):new function(){this.test=h}:new RegExp("."),cardinality:d?d:1,optionality:t.isOptional,newBlockMarker:r,casing:n.casing,def:n.definitionSymbol||a,placeholder:n.placeholder,mask:a})}t.matches.splice(i++,0,{fn:n.validator?"string"==typeof n.validator?new RegExp(n.validator):new function(){this.test=n.validator}:new RegExp("."),cardinality:n.cardinality,optionality:t.isOptional,newBlockMarker:r,casing:n.casing,def:n.definitionSymbol||a,placeholder:n.placeholder,mask:a})}else t.matches.splice(i++,0,{fn:null,cardinality:0,optionality:t.isOptional,newBlockMarker:r,casing:null,def:a,placeholder:void 0,mask:a}),u=!1}for(var n,r,s,o,l,c,h=/(?:[?*+]|\{[0-9\+\*]+(?:,[0-9\+\*]*)?\})\??|[^.?*+^${[]()|\\]+|./g,u=!1,d=new a,p=[],f=[];n=h.exec(t);)switch(r=n[0],r.charAt(0)){case e.optionalmarker.end:case e.groupmarker.end:if(s=p.pop(),p.length>0){if(o=p[p.length-1],o.matches.push(s),o.isAlternator){l=p.pop();for(var v=0;v<l.matches.length;v++)l.matches[v].isGroup=!1;p.length>0?(o=p[p.length-1],o.matches.push(l)):d.matches.push(l)}}else d.matches.push(s);break;case e.optionalmarker.start:p.push(new a(!1,!0));break;case e.groupmarker.start:p.push(new a(!0));break;case e.quantifiermarker.start:var m=new a(!1,!1,!0);r=r.replace(/[{}]/g,"");var g=r.split(","),y=isNaN(g[0])?g[0]:parseInt(g[0]),k=1==g.length?y:isNaN(g[1])?g[1]:parseInt(g[1]);if(("*"==k||"+"==k)&&(y="*"==k?0:1),m.quantifier={min:y,max:k},p.length>0){var b=p[p.length-1].matches;if(n=b.pop(),!n.isGroup){var x=new a(!0);x.matches.push(n),n=x}b.push(n),b.push(m)}else{if(n=d.matches.pop(),!n.isGroup){var x=new a(!0);x.matches.push(n),n=x}d.matches.push(n),d.matches.push(m)}break;case e.escapeChar:u=!0;break;case e.alternatormarker:p.length>0?(o=p[p.length-1],c=o.matches.pop()):c=d.matches.pop(),c.isAlternator?p.push(c):(l=new a(!1,!1,!1,!0),l.matches.push(c),p.push(l));break;default:if(p.length>0){if(o=p[p.length-1],o.matches.length>0&&(c=o.matches[o.matches.length-1],c.isGroup&&(c.isGroup=!1,i(c,e.groupmarker.start,0),i(c,e.groupmarker.end))),i(o,r),o.isAlternator){l=p.pop();for(var v=0;v<l.matches.length;v++)l.matches[v].isGroup=!1;p.length>0?(o=p[p.length-1],o.matches.push(l)):d.matches.push(l)}}else d.matches.length>0&&(c=d.matches[d.matches.length-1],c.isGroup&&(c.isGroup=!1,i(c,e.groupmarker.start,0),i(c,e.groupmarker.end))),i(d,r)}return d.matches.length>0&&(c=d.matches[d.matches.length-1],c.isGroup&&(c.isGroup=!1,i(c,e.groupmarker.start,0),i(c,e.groupmarker.end)),f.push(d)),f}function n(a,n){if(e.numericInput&&e.multi!==!0){a=a.split("").reverse();for(var r=0;r<a.length;r++)a[r]==e.optionalmarker.start?a[r]=e.optionalmarker.end:a[r]==e.optionalmarker.end?a[r]=e.optionalmarker.start:a[r]==e.groupmarker.start?a[r]=e.groupmarker.end:a[r]==e.groupmarker.end&&(a[r]=e.groupmarker.start);a=a.join("")}if(void 0!=a&&""!=a){if(1==a.length&&0==e.greedy&&0!=e.repeat&&(e.placeholder=""),e.repeat>0||"*"==e.repeat||"+"==e.repeat){var s="*"==e.repeat?0:"+"==e.repeat?1:e.repeat;a=e.groupmarker.start+a+e.groupmarker.end+e.quantifiermarker.start+s+","+e.repeat+e.quantifiermarker.end}return void 0==t.inputmask.masksCache[a]&&(t.inputmask.masksCache[a]={mask:a,maskToken:i(a),validPositions:{},_buffer:void 0,buffer:void 0,tests:{},metadata:n}),t.extend(!0,{},t.inputmask.masksCache[a])}}var r=void 0;if(t.isFunction(e.mask)&&(e.mask=e.mask.call(this,e)),t.isArray(e.mask))if(a)r=[],t.each(e.mask,function(e,a){r.push(void 0==a.mask||t.isFunction(a.mask)?n(a.toString(),a):n(a.mask.toString(),a))});else{e.keepStatic=void 0==e.keepStatic?!0:e.keepStatic;var s="(";t.each(e.mask,function(e,a){s.length>1&&(s+=")|("),s+=void 0==a.mask||t.isFunction(a.mask)?a.toString():a.mask.toString()}),s+=")",r=n(s,e.mask)}else e.mask&&(r=void 0==e.mask.mask||t.isFunction(e.mask.mask)?n(e.mask.toString(),e.mask):n(e.mask.mask.toString(),e.mask));return r}function r(i,n,r){function o(t,e,a){e=e||0;var i,n,r,s=[],o=0;do{if(t===!0&&f().validPositions[o]){var l=f().validPositions[o];n=l.match,i=l.locator.slice(),s.push(a===!0?l.input:O(o,n))}else{if(e>o){var c=w(o,i,o-1);r=c[0]}else r=k(o,i,o-1);n=r.match,i=r.locator.slice(),s.push(O(o,n))}o++}while((void 0==rt||rt>o-1)&&null!=n.fn||null==n.fn&&""!=n.def||e>=o);return s.pop(),s}function f(){return n}function v(t){var e=f();e.buffer=void 0,e.tests={},t!==!0&&(e._buffer=void 0,e.validPositions={},e.p=0)}function m(t){var e=f(),a=-1,i=e.validPositions;void 0==t&&(t=-1);var n=a,r=a;for(var s in i){var o=parseInt(s);(-1==t||null!=i[o].match.fn)&&(t>o&&(n=o),o>=t&&(r=o))}return a=t-n>1||t>r?n:r}function g(e,a,i){if(r.insertMode&&void 0!=f().validPositions[e]&&void 0==i){var n,s=t.extend(!0,{},f().validPositions),o=m();for(n=e;o>=n;n++)delete f().validPositions[n];f().validPositions[e]=a;var l,c=!0;for(n=e;o>=n;n++){var h=s[n];if(void 0!=h){var u=f().validPositions;l=!r.keepStatic&&(void 0!=u[n+1]&&w(n+1,u[n].locator.slice(),n).length>1||u[n]&&void 0!=u[n].alternation)?n+1:E(n),c=x(l,h.match.def)?c&&P(l,h.input,!0,!0)!==!1:null==h.match.fn}if(!c)break}if(!c)return f().validPositions=t.extend(!0,{},s),!1}else f().validPositions[e]=a;return!0}function y(t,e){var a,i=t;for(void 0!=f().validPositions[t]&&f().validPositions[t].input==r.radixPoint&&(e++,i++),a=i;e>a;a++)void 0==f().validPositions[a]||f().validPositions[a].input==r.radixPoint&&a!=m()||delete f().validPositions[a];for(a=e;a<=m();){var n=f().validPositions[a],s=f().validPositions[i];void 0!=n&&void 0==s?(x(i,n.match.def)&&P(i,n.input,!0)!==!1&&(delete f().validPositions[a],a++),i++):a++}var o=m();o>=t&&void 0!=f().validPositions[o]&&f().validPositions[o].input==r.radixPoint&&delete f().validPositions[o],v(!0)}function k(e,a,i){function n(e,a,i){for(var n=!1,r=e.locator[a].toString().split(","),s=0;s<r.length;s++)if(-1!=t.inArray(r[s],i)){n=!0;break}return n}for(var s,o=w(e,a,i),l=m(),c=f().validPositions[l]||w(0)[0],h=void 0!=c.alternation?c.locator[c.alternation].split(","):[],u=0;u<o.length&&(s=o[u],!(r.greedy||s.match&&(s.match.optionality===!1||s.match.newBlockMarker===!1)&&s.match.optionalQuantifier!==!0&&(void 0==c.alternation||void 0!=s.locator[c.alternation]&&n(s,c.alternation,h))));u++);return s}function b(t){return f().validPositions[t]?f().validPositions[t].match:w(t)[0].match}function x(t,e){for(var a=!1,i=w(t),n=0;n<i.length;n++)if(i[n].match&&i[n].match.def==e){a=!0;break}return a}function w(e,a,i){function n(a,i,s,l){function u(s,l,p){if(o>1e4)return alert("jquery.inputmask: There is probably an error in your mask definition or in the code. Create an issue on github with an example of the mask you are using. "+f().mask),!0;if(o==e&&void 0==s.matches)return c.push({match:s,locator:l.reverse()}),!0;if(void 0!=s.matches){if(s.isGroup&&p!==!0){if(s=u(a.matches[d+1],l))return!0}else if(s.isOptional){var v=s;if(s=n(s,i,l,p)){var m=c[c.length-1].match,g=0==t.inArray(m,v.matches);g&&(h=!0),o=e}}else if(s.isAlternator){var y,k=s,b=[],x=c.slice(),w=l.length,_=i.length>0?i.shift():-1;if(-1==_||"string"==typeof _){var C,D=o,T=i.slice();"string"==typeof _&&(C=_.split(","));for(var P=0;P<k.matches.length;P++){c=[],s=u(k.matches[P],[P].concat(l),p)||s,y=c.slice(),o=D,c=[];for(var M=0;M<T.length;M++)i[M]=T[M];for(var S=0;S<y.length;S++)for(var E=y[S],A=0;A<b.length;A++){var F=b[A];if(E.match.mask==F.match.mask&&("string"!=typeof _||-1!=t.inArray(E.locator[w].toString(),C))){y.splice(S,1),F.locator[w]=F.locator[w]+","+E.locator[w],F.alternation=w;break}}b=b.concat(y)}"string"==typeof _&&(b=t.map(b,function(e,a){if(isFinite(a)){var i,n=e.locator[w].toString().split(",");e.locator[w]=void 0,e.alternation=void 0;for(var r=0;r<n.length;r++)i=-1!=t.inArray(n[r],C),i&&(void 0!=e.locator[w]?(e.locator[w]+=",",e.alternation=w,e.locator[w]+=n[r]):e.locator[w]=parseInt(n[r]));if(void 0!=e.locator[w])return e}})),c=x.concat(b),h=!0}else s=u(k.matches[_],[_].concat(l),p);if(s)return!0}else if(s.isQuantifier&&p!==!0){var U=s;r.greedy=r.greedy&&isFinite(U.quantifier.max);for(var O=i.length>0&&p!==!0?i.shift():0;O<(isNaN(U.quantifier.max)?O+1:U.quantifier.max)&&e>=o;O++){var R=a.matches[t.inArray(U,a.matches)-1];if(s=u(R,[O].concat(l),!0)){var m=c[c.length-1].match;m.optionalQuantifier=O>U.quantifier.min-1;var g=0==t.inArray(m,R.matches);if(g){if(O>U.quantifier.min-1){h=!0,o=e;break}return!0}return!0}}}else if(s=n(s,i,l,p))return!0}else o++}for(var d=i.length>0?i.shift():0;d<a.matches.length;d++)if(a.matches[d].isQuantifier!==!0){var p=u(a.matches[d],[d].concat(s),l);if(p&&o==e)return p;if(o>e)break}}var s=f().maskToken,o=a?i:0,l=a||[0],c=[],h=!1;if(void 0==a){for(var u,d=e-1;void 0==(u=f().validPositions[d])&&d>-1;)d--;if(void 0!=u&&d>-1)o=d,l=u.locator.slice();else{for(d=e-1;void 0==(u=f().tests[d])&&d>-1;)d--;void 0!=u&&d>-1&&(o=d,l=u[0].locator.slice())}}for(var p=l.shift();p<s.length;p++){var v=n(s[p],l,[p]);if(v&&o==e||o>e)break}return(0==c.length||h)&&c.push({match:{fn:null,cardinality:0,optionality:!0,casing:null,def:""},locator:[]}),f().tests[e]=t.extend(!0,[],c),f().tests[e]}function _(){return void 0==f()._buffer&&(f()._buffer=o(!1,1)),f()._buffer}function C(){return void 0==f().buffer&&(f().buffer=o(!0,m(),!0)),f().buffer}function D(t,e){var a=C().slice();if(t===!0)v(),t=0,e=a.length;else for(var i=t;e>i;i++)delete f().validPositions[i],delete f().tests[i];for(var i=t;e>i;i++)a[i]!=r.skipOptionalPartCharacter&&P(i,a[i],!0,!0)}function T(t,e){switch(e.casing){case"upper":t=t.toUpperCase();break;case"lower":t=t.toLowerCase()}return t}function P(e,a,i,n){function s(e,a,i,n){var s=!1;return t.each(w(e),function(o,l){for(var c=l.match,h=a?1:0,u="",d=(C(),c.cardinality);d>h;d--)u+=F(e-(d-1));if(a&&(u+=a),s=null!=c.fn?c.fn.test(u,f(),e,i,r):a!=c.def&&a!=r.skipOptionalPartCharacter||""==c.def?!1:{c:c.def,pos:e},s!==!1){var p=void 0!=s.c?s.c:a;p=p==r.skipOptionalPartCharacter&&null===c.fn?c.def:p;var k=e;if(void 0!=s.remove&&y(s.remove,s.remove+1),s.refreshFromBuffer){var b=s.refreshFromBuffer;if(i=!0,D(b===!0?b:b.start,b.end),void 0==s.pos&&void 0==s.c)return s.pos=m(),!1;if(k=void 0!=s.pos?s.pos:e,k!=e)return s=t.extend(s,P(k,p,!0)),!1}else if(s!==!0&&void 0!=s.pos&&s.pos!=e&&(k=s.pos,D(e,k),k!=e))return s=t.extend(s,P(k,p,!0)),!1;return 1!=s&&void 0==s.pos&&void 0==s.c?!1:(o>0&&v(!0),g(k,t.extend({},l,{input:T(p,c)}),n)||(s=!1),!1)}}),s}function o(e,a,i,n){var s,o,l=t.extend(!0,{},f().validPositions);for(s=m();s>=0;s--)if(f().validPositions[s]&&void 0!=f().validPositions[s].alternation){o=f().validPositions[s].alternation;break}if(void 0!=o)for(var c in f().validPositions)if(parseInt(c)>parseInt(s)&&void 0===f().validPositions[c].alternation){for(var h=f().validPositions[c],u=h.locator[o],d=f().validPositions[s].locator[o].split(","),p=0;p<d.length;p++)if(u<d[p]){for(var g,y,k=c-1;k>=0;k--)if(g=f().validPositions[k],void 0!=g){y=g.locator[o],g.locator[o]=d[p];break}if(u!=g.locator[o]){for(var b=C().slice(),x=c;x<m()+1;x++)delete f().validPositions[x],delete f().tests[x];v(!0),r.keepStatic=!r.keepStatic;for(var x=c;x<b.length;x++)b[x]!=r.skipOptionalPartCharacter&&P(m()+1,b[x],!1,!0);g.locator[o]=y;var w=P(e,a,i,n);if(r.keepStatic=!r.keepStatic,w)return w;v(),f().validPositions=t.extend(!0,{},l)}}break}return!1}i=i===!0;for(var l=C(),c=e-1;c>-1&&(!f().validPositions[c]||null!=f().validPositions[c].match.fn);c--)void 0==f().validPositions[c]&&(!M(c)||l[c]!=O(c))&&w(c).length>1&&s(c,l[c],!0);var h=e,u=!1;if(n&&h>=S()&&v(!0),h<S()&&(u=s(h,a,i,n),!i&&u===!1)){var d=f().validPositions[h];if(!d||null!=d.match.fn||d.match.def!=a&&a!=r.skipOptionalPartCharacter){if((r.insertMode||void 0==f().validPositions[E(h)])&&!M(h))for(var p=h+1,k=E(h);k>=p;p++)if(u=s(p,a,i,n),u!==!1){h=p;break}}else u={caret:E(h)}}return u===!1&&r.keepStatic&&K(l)&&(u=o(e,a,i,n)),u===!0&&(u={pos:h}),u}function M(t){var e=b(t);return null!=e.fn?e.fn:!1}function S(){var t;if(rt=nt.prop("maxLength"),-1==rt&&(rt=void 0),0==r.greedy){var e,a=m(),i=f().validPositions[a],n=void 0!=i?i.locator.slice():void 0;for(e=a+1;void 0==i||null!=i.match.fn||null==i.match.fn&&""!=i.match.def;e++)i=k(e,n,e-1),n=i.locator.slice();t=e}else t=C().length;return void 0==rt||rt>t?t:rt}function E(t){var e=S();if(t>=e)return e;for(var a=t;++a<e&&!M(a)&&(r.nojumps!==!0||r.nojumpsThreshold>a););return a}function A(t){var e=t;if(0>=e)return 0;for(;--e>0&&!M(e););return e}function F(t){return void 0==f().validPositions[t]?O(t):f().validPositions[t].input}function U(t,e,a){t._valueSet(e.join("")),void 0!=a&&Y(t,a)}function O(e,a){a=a||b(e);var i=t.isFunction(a.placeholder)?a.placeholder.call(this,r):a.placeholder;return void 0!=i?i:null==a.fn?a.def:r.placeholder.charAt(e%r.placeholder.length)}function R(e,a,i,n,s){var o=void 0!=n?n.slice():I(e._valueGet()).split("");if(v(),a&&e._valueSet(""),t.each(o,function(a,n){if(s===!0){var r=m(),o=-1==r?a:E(r);-1==t.inArray(n,_().slice(r+1,o))&&Q.call(e,void 0,!0,n.charCodeAt(0),!1,i,i?a:f().p)}else Q.call(e,void 0,!0,n.charCodeAt(0),!1,i,i?a:f().p),i=i||a>0&&a>f().p}),a){var l=r.onKeyPress.call(this,void 0,C(),0,r);q(e,l),U(e,C(),t(e).is(":focus")?E(m(0)):void 0)}}function j(e){return t.inputmask.escapeRegex.call(this,e)}function I(t){return t.replace(new RegExp("("+j(_().join(""))+")*$"),"")}function N(e){if(e.data("_inputmask")&&!e.hasClass("hasDatepicker")){var a=[],i=f().validPositions;for(var n in i)i[n].match&&null!=i[n].match.fn&&a.push(i[n].input);var s=(st?a.reverse():a).join(""),o=(st?C().slice().reverse():C()).join("");return t.isFunction(r.onUnMask)&&(s=r.onUnMask.call(e,o,s,r)||s),s}return e[0]._valueGet()}function G(t){if(st&&"number"==typeof t&&(!r.greedy||""!=r.placeholder)){var e=C().length;t=e-t}return t}function Y(e,a,i){var n,s=e.jquery&&e.length>0?e[0]:e;if("number"!=typeof a){var o=t(s).data("_inputmask");return!t(s).is(":visible")&&o&&void 0!=o.caret?(a=o.caret.begin,i=o.caret.end):s.setSelectionRange?(a=s.selectionStart,i=s.selectionEnd):document.selection&&document.selection.createRange&&(n=document.selection.createRange(),a=0-n.duplicate().moveStart("character",-1e5),i=a+n.text.length),a=G(a),i=G(i),{begin:a,end:i}}a=G(a),i=G(i),i="number"==typeof i?i:a;var o=t(s).data("_inputmask")||{};o.caret={begin:a,end:i},t(s).data("_inputmask",o),t(s).is(":visible")&&(s.scrollLeft=s.scrollWidth,0==r.insertMode&&a==i&&i++,s.setSelectionRange?(s.selectionStart=a,s.selectionEnd=i):s.createTextRange&&(n=s.createTextRange(),n.collapse(!0),n.moveEnd("character",i),n.moveStart("character",a),n.select()))}function $(e){var a,i,n=C(),r=n.length,s=m(),o={},l=f().validPositions[s],c=void 0!=l?l.locator.slice():void 0;for(a=s+1;a<n.length;a++)i=k(a,c,a-1),c=i.locator.slice(),o[a]=t.extend(!0,{},i);var h=l&&void 0!=l.alternation?l.locator[l.alternation].split(","):[];for(a=r-1;a>s&&(i=o[a].match,(i.optionality||i.optionalQuantifier||l&&void 0!=l.alternation&&void 0!=o[a].locator[l.alternation]&&-1!=t.inArray(o[a].locator[l.alternation].toString(),h))&&n[a]==O(a,i));a--)r--;return e?{l:r,def:o[r]?o[r].match:void 0}:r}function H(t){for(var e=C(),a=e.slice(),i=$(),n=a.length-1;n>i&&!M(n);n--);a.splice(i,n+1-i),U(t,a)}function K(e){if(t.isFunction(r.isComplete))return r.isComplete.call(nt,e,r);if("*"!=r.repeat){var a=!1,i=$(!0),n=A(i.l),s=m();if(s==n&&(void 0==i.def||i.def.newBlockMarker||i.def.optionalQuantifier)){a=!0;for(var o=0;n>=o;o++){var l=M(o);if(l&&(void 0==e[o]||e[o]==O(o))||!l&&e[o]!=O(o)){a=!1;break}}}return a}}function B(t,e){return st?t-e>1||t-e==1&&r.insertMode:e-t>1||e-t==1&&r.insertMode}function W(e){var a=t._data(e).events;t.each(a,function(e,a){t.each(a,function(t,e){if("inputmask"==e.namespace&&"setvalue"!=e.type){var a=e.handler;e.handler=function(t){return this.readOnly||this.disabled?void t.preventDefault:a.apply(this,arguments)}}})})}function V(e){function a(e){if(void 0==t.valHooks[e]||1!=t.valHooks[e].inputmaskpatch){var a=t.valHooks[e]&&t.valHooks[e].get?t.valHooks[e].get:function(t){return t.value},i=t.valHooks[e]&&t.valHooks[e].set?t.valHooks[e].set:function(t,e){return t.value=e,t};t.valHooks[e]={get:function(e){var i=t(e);if(i.data("_inputmask")){if(i.data("_inputmask").opts.autoUnmask)return i.inputmask("unmaskedvalue");var n=a(e),r=i.data("_inputmask"),s=r.maskset,o=s._buffer;return o=o?o.join(""):"",n!=o?n:""}return a(e)},set:function(e,a){var n,r=t(e),s=r.data("_inputmask");return s?(n=i(e,t.isFunction(s.opts.onBeforeMask)?s.opts.onBeforeMask.call(ft,a,s.opts)||a:a),r.triggerHandler("setvalue.inputmask")):n=i(e,a),n},inputmaskpatch:!0}}}function i(){var e=t(this),a=t(this).data("_inputmask");return a?a.opts.autoUnmask?e.inputmask("unmaskedvalue"):s.call(this)!=_().join("")?s.call(this):"":s.call(this)}function n(e){var a=t(this).data("_inputmask");a?(o.call(this,t.isFunction(a.opts.onBeforeMask)?a.opts.onBeforeMask.call(ft,e,a.opts)||e:e),t(this).triggerHandler("setvalue.inputmask")):o.call(this,e)}function r(e){t(e).bind("mouseenter.inputmask",function(){var e=t(this),a=this,i=a._valueGet();""!=i&&i!=C().join("")&&e.trigger("setvalue")});var a=t._data(e).events,i=a.mouseover;if(i){for(var n=i[i.length-1],r=i.length-1;r>0;r--)i[r]=i[r-1];i[0]=n}}var s,o;e._valueGet||(Object.getOwnPropertyDescriptor&&Object.getOwnPropertyDescriptor(e,"value"),document.__lookupGetter__&&e.__lookupGetter__("value")?(s=e.__lookupGetter__("value"),o=e.__lookupSetter__("value"),e.__defineGetter__("value",i),e.__defineSetter__("value",n)):(s=function(){return e.value},o=function(t){e.value=t},a(e.type),r(e)),e._valueGet=function(){return st?s.call(this).split("").reverse().join(""):s.call(this)},e._valueSet=function(t){o.call(this,st?t.split("").reverse().join(""):t)})}function L(e,a,i){function n(){if(r.keepStatic){v(!0);var t,a=[];for(t=m();t>=0;t--)if(f().validPositions[t]){if(void 0!=f().validPositions[t].alternation)break;a.push(f().validPositions[t].input),delete f().validPositions[t]}if(t>0)for(;a.length>0;)f().p=E(m()),Q.call(e,void 0,!0,a.pop().charCodeAt(0),!1,!1,f().p)}}if((r.numericInput||st)&&(a==t.inputmask.keyCode.BACKSPACE?a=t.inputmask.keyCode.DELETE:a==t.inputmask.keyCode.DELETE&&(a=t.inputmask.keyCode.BACKSPACE),st)){var s=i.end;i.end=i.begin,i.begin=s}a==t.inputmask.keyCode.BACKSPACE&&i.end-i.begin<=1?i.begin=A(i.begin):a==t.inputmask.keyCode.DELETE&&i.begin==i.end&&i.end++,y(i.begin,i.end),n();var o=m(i.begin);o<i.begin?(-1==o&&v(),f().p=E(o)):f().p=i.begin}function q(t,e,a){if(e&&e.refreshFromBuffer){var i=e.refreshFromBuffer;D(i===!0?i:i.start,i.end),v(!0),void 0!=a&&(U(t,C()),Y(t,e.caret||a.begin,e.caret||a.end))}}function z(a){ot=!1;var i=this,n=t(i),s=a.keyCode,o=Y(i);s==t.inputmask.keyCode.BACKSPACE||s==t.inputmask.keyCode.DELETE||l&&127==s||a.ctrlKey&&88==s&&!e("cut")?(a.preventDefault(),88==s&&(it=C().join("")),L(i,s,o),U(i,C(),f().p),i._valueGet()==_().join("")&&n.trigger("cleared"),r.showTooltip&&n.prop("title",f().mask)):s==t.inputmask.keyCode.END||s==t.inputmask.keyCode.PAGE_DOWN?setTimeout(function(){var t=E(m());r.insertMode||t!=S()||a.shiftKey||t--,Y(i,a.shiftKey?o.begin:t,t)},0):s==t.inputmask.keyCode.HOME&&!a.shiftKey||s==t.inputmask.keyCode.PAGE_UP?Y(i,0,a.shiftKey?o.begin:0):s==t.inputmask.keyCode.ESCAPE||90==s&&a.ctrlKey?(R(i,!0,!1,it.split("")),n.click()):s!=t.inputmask.keyCode.INSERT||a.shiftKey||a.ctrlKey?0!=r.insertMode||a.shiftKey||(s==t.inputmask.keyCode.RIGHT?setTimeout(function(){var t=Y(i);Y(i,t.begin)},0):s==t.inputmask.keyCode.LEFT&&setTimeout(function(){var t=Y(i);Y(i,st?t.begin+1:t.begin-1)},0)):(r.insertMode=!r.insertMode,Y(i,r.insertMode||o.begin!=S()?o.begin:o.begin-1));var c=Y(i),h=r.onKeyDown.call(this,a,C(),c.begin,r);q(i,h,c),ct=-1!=t.inArray(s,r.ignorables)}function Q(e,a,i,n,s,o){if(void 0==i&&ot)return!1;ot=!0;var l=this,c=t(l);e=e||window.event;var i=a?i:e.which||e.charCode||e.keyCode;if(!(a===!0||e.ctrlKey&&e.altKey)&&(e.ctrlKey||e.metaKey||ct))return!0;if(i){a!==!0&&46==i&&0==e.shiftKey&&","==r.radixPoint&&(i=44);var h,u=a?{begin:o,end:o}:Y(l),d=String.fromCharCode(i),p=B(u.begin,u.end);p&&(f().undoPositions=t.extend(!0,{},f().validPositions),L(l,t.inputmask.keyCode.DELETE,u),r.insertMode||(r.insertMode=!r.insertMode,g(u.begin,s),r.insertMode=!r.insertMode),p=!r.multi),f().writeOutBuffer=!0;var m=st&&!p?u.end:u.begin,y=P(m,d,s);if(y!==!1){if(y!==!0&&(m=void 0!=y.pos?y.pos:m,d=void 0!=y.c?y.c:d),v(!0),void 0!=y.caret)h=y.caret;else{var k=f().validPositions;h=!r.keepStatic&&(void 0!=k[m+1]&&w(m+1,k[m].locator.slice(),m).length>1||void 0!=k[m].alternation)?m+1:E(m)}f().p=h}if(n!==!1){var b=this;if(setTimeout(function(){r.onKeyValidation.call(b,y,r)},0),f().writeOutBuffer&&y!==!1){var x=C();U(l,x,a?void 0:r.numericInput?A(h):h),a!==!0&&setTimeout(function(){K(x)===!0&&c.trigger("complete"),lt=!0,c.trigger("input")},0)}else p&&(f().buffer=void 0,f().validPositions=f().undoPositions)}else p&&(f().buffer=void 0,f().validPositions=f().undoPositions);if(r.showTooltip&&c.prop("title",f().mask),e&&1!=a){e.preventDefault();var _=Y(l),D=r.onKeyPress.call(this,e,C(),_.begin,r);q(l,D,_)}}}function X(e){var a=t(this),i=this,n=e.keyCode,s=C(),o=Y(i),l=r.onKeyUp.call(this,e,s,o.begin,r);q(i,l,o),n==t.inputmask.keyCode.TAB&&r.showMaskOnFocus&&(a.hasClass("focus-inputmask")&&0==i._valueGet().length?(v(),s=C(),U(i,s),Y(i,0),it=C().join("")):(U(i,s),Y(i,G(0),G(S()))))}function J(e){if(lt===!0&&"input"==e.type)return lt=!1,!0;var a=this,i=t(a),n=a._valueGet(),s=Y(a);if("propertychange"==e.type&&a._valueGet().length<=S())return!0;"paste"==e.type&&(window.clipboardData&&window.clipboardData.getData?n=n.substr(0,s.begin)+window.clipboardData.getData("Text")+n.substr(s.end,n.length):e.originalEvent&&e.originalEvent.clipboardData&&e.originalEvent.clipboardData.getData&&(n=n.substr(0,s.begin)+e.originalEvent.clipboardData.getData("text/plain")+n.substr(s.end,n.length)));var o=t.isFunction(r.onBeforePaste)?r.onBeforePaste.call(a,n,r)||n:n;return R(a,!0,!1,st?o.split("").reverse():o.split(""),!0),i.click(),K(C())===!0&&i.trigger("complete"),!1}function Z(e){if(lt===!0&&"input"==e.type)return lt=!1,!0;var a=this,i=Y(a),n=a._valueGet();n=n.replace(new RegExp("("+j(_().join(""))+")*"),""),i.begin>n.length&&(Y(a,n.length),i=Y(a)),C().length-n.length!=1||n.charAt(i.begin)==C()[i.begin]||n.charAt(i.begin+1)==C()[i.begin]||M(i.begin)||(e.keyCode=t.inputmask.keyCode.BACKSPACE,z.call(a,e)),e.preventDefault()}function tt(e){if(lt===!0&&"input"==e.type)return lt=!1,!0;var a=this,i=Y(a),n=a._valueGet();Y(a,i.begin-1);var s=t.Event("keypress");s.which=n.charCodeAt(i.begin-1),ot=!1,ct=!1,Q.call(a,s,void 0,void 0,!1);var o=f().p;U(a,C(),r.numericInput?A(o):o),e.preventDefault()}function et(e){lt=!0;var a=this;return setTimeout(function(){Y(a,Y(a).begin-1);var i=t.Event("keypress");i.which=e.originalEvent.data.charCodeAt(0),ot=!1,ct=!1,Q.call(a,i,void 0,void 0,!1);var n=f().p;U(a,C(),r.numericInput?A(n):n)},0),!1}function at(e){if(nt=t(e),nt.is(":input")&&a(nt.attr("type"))){if(nt.data("_inputmask",{maskset:n,opts:r,isRTL:!1}),r.showTooltip&&nt.prop("title",f().mask),("rtl"==e.dir||r.rightAlign)&&nt.css("text-align","right"),"rtl"==e.dir||r.numericInput){e.dir="ltr",nt.removeAttr("dir");var i=nt.data("_inputmask");i.isRTL=!0,nt.data("_inputmask",i),st=!0}nt.unbind(".inputmask"),nt.removeClass("focus-inputmask"),nt.closest("form").bind("submit",function(){it!=C().join("")&&nt.change(),nt[0]._valueGet&&nt[0]._valueGet()==_().join("")&&nt[0]._valueSet(""),r.autoUnmask&&r.removeMaskOnSubmit&&nt.inputmask("remove")}).bind("reset",function(){setTimeout(function(){nt.trigger("setvalue")},0)}),nt.bind("mouseenter.inputmask",function(){var e=t(this),a=this;!e.hasClass("focus-inputmask")&&r.showMaskOnHover&&a._valueGet()!=C().join("")&&U(a,C())}).bind("blur.inputmask",function(){var e=t(this),a=this;if(e.data("_inputmask")){var i=a._valueGet(),n=C();e.removeClass("focus-inputmask"),it!=C().join("")&&e.change(),r.clearMaskOnLostFocus&&""!=i&&(i==_().join("")?a._valueSet(""):H(a)),K(n)===!1&&(e.trigger("incomplete"),r.clearIncomplete&&(v(),r.clearMaskOnLostFocus?a._valueSet(""):(n=_().slice(),U(a,n))))}}).bind("focus.inputmask",function(){var e=t(this),a=this,i=a._valueGet();r.showMaskOnFocus&&!e.hasClass("focus-inputmask")&&(!r.showMaskOnHover||r.showMaskOnHover&&""==i)&&a._valueGet()!=C().join("")&&U(a,C(),E(m())),e.addClass("focus-inputmask"),it=C().join("")}).bind("mouseleave.inputmask",function(){var e=t(this),a=this;r.clearMaskOnLostFocus&&(e.hasClass("focus-inputmask")||a._valueGet()==e.attr("placeholder")||(a._valueGet()==_().join("")||""==a._valueGet()?a._valueSet(""):H(a)))}).bind("click.inputmask",function(){var e=this;t(e).is(":focus")&&setTimeout(function(){var a=Y(e);if(a.begin==a.end)if(r.radixFocus&&""!=r.radixPoint&&-1!=t.inArray(r.radixPoint,C())&&C().join("")==_().join(""))Y(e,t.inArray(r.radixPoint,C()));else{var i=st?G(a.begin):a.begin,n=E(m(i));n>i?Y(e,M(i)?i:E(i)):Y(e,n)}},0)}).bind("dblclick.inputmask",function(){var t=this;setTimeout(function(){Y(t,0,E(m()))},0)}).bind(p+".inputmask dragdrop.inputmask drop.inputmask",J).bind("setvalue.inputmask",function(){var t=this;R(t,!0,!1,void 0,!0),it=C().join(""),(r.clearMaskOnLostFocus||r.clearIncomplete)&&t._valueGet()==_().join("")&&t._valueSet("")}).bind("cut.inputmask",function(e){lt=!0;var a=this,i=t(a),n=Y(a);L(a,t.inputmask.keyCode.DELETE,n);var s=r.onKeyPress.call(this,e,C(),f().p,r);q(a,s,{begin:f().p,end:f().p}),a._valueGet()==_().join("")&&i.trigger("cleared"),r.showTooltip&&i.prop("title",f().mask)}).bind("complete.inputmask",r.oncomplete).bind("incomplete.inputmask",r.onincomplete).bind("cleared.inputmask",r.oncleared),nt.bind("keydown.inputmask",z).bind("keypress.inputmask",Q).bind("keyup.inputmask",X).bind("compositionupdate.inputmask",et),"paste"!==p||s||nt.bind("input.inputmask",tt),s&&nt.bind("input.inputmask",J),(c||u||h||d)&&("input"==p&&nt.unbind(p+".inputmask"),nt.bind("input.inputmask",Z)),V(e);var o=t.isFunction(r.onBeforeMask)?r.onBeforeMask.call(e,e._valueGet(),r)||e._valueGet():e._valueGet();R(e,!0,!1,o.split(""),!0),it=C().join("");var l;try{l=document.activeElement}catch(g){}K(C())===!1&&r.clearIncomplete&&v(),r.clearMaskOnLostFocus?C().join("")==_().join("")?e._valueSet(""):H(e):U(e,C()),l===e&&(nt.addClass("focus-inputmask"),Y(e,E(m()))),W(e)}}var it,nt,rt,st=!1,ot=!1,lt=!1,ct=!1;if(void 0!=i)switch(i.action){case"isComplete":return nt=t(i.el),n=nt.data("_inputmask").maskset,r=nt.data("_inputmask").opts,K(i.buffer);case"unmaskedvalue":return nt=i.$input,n=nt.data("_inputmask").maskset,r=nt.data("_inputmask").opts,st=i.$input.data("_inputmask").isRTL,N(i.$input);case"mask":it=C().join(""),at(i.el);break;case"format":nt=t({}),nt.data("_inputmask",{maskset:n,opts:r,isRTL:r.numericInput}),r.numericInput&&(st=!0);var ht=(t.isFunction(r.onBeforeMask)?r.onBeforeMask.call(nt,i.value,r)||i.value:i.value).split("");return R(nt,!1,!1,st?ht.reverse():ht,!0),r.onKeyPress.call(this,void 0,C(),0,r),i.metadata?{value:st?C().slice().reverse().join(""):C().join(""),metadata:nt.inputmask("getmetadata")}:st?C().slice().reverse().join(""):C().join("");case"isValid":nt=t({}),nt.data("_inputmask",{maskset:n,opts:r,isRTL:r.numericInput}),r.numericInput&&(st=!0);var ht=i.value.split("");R(nt,!1,!0,st?ht.reverse():ht);for(var ut=C(),dt=$(),pt=ut.length-1;pt>dt&&!M(pt);pt--);return ut.splice(dt,pt+1-dt),K(ut)&&i.value==ut.join("");case"getemptymask":return nt=t(i.el),n=nt.data("_inputmask").maskset,r=nt.data("_inputmask").opts,_();case"remove":var ft=i.el;nt=t(ft),n=nt.data("_inputmask").maskset,r=nt.data("_inputmask").opts,ft._valueSet(N(nt)),nt.unbind(".inputmask"),nt.removeClass("focus-inputmask"),nt.removeData("_inputmask");var vt;Object.getOwnPropertyDescriptor&&(vt=Object.getOwnPropertyDescriptor(ft,"value")),vt&&vt.get?ft._valueGet&&Object.defineProperty(ft,"value",{get:ft._valueGet,set:ft._valueSet}):document.__lookupGetter__&&ft.__lookupGetter__("value")&&ft._valueGet&&(ft.__defineGetter__("value",ft._valueGet),ft.__defineSetter__("value",ft._valueSet));try{delete ft._valueGet,delete ft._valueSet}catch(mt){
|
3 |
+
ft._valueGet=void 0,ft._valueSet=void 0}break;case"getmetadata":if(nt=t(i.el),n=nt.data("_inputmask").maskset,r=nt.data("_inputmask").opts,t.isArray(n.metadata)){for(var gt,yt=m(),kt=yt;kt>=0;kt--)if(f().validPositions[kt]&&void 0!=f().validPositions[kt].alternation){gt=f().validPositions[kt].alternation;break}return void 0!=gt?n.metadata[f().validPositions[yt].locator[gt]]:n.metadata[0]}return n.metadata}}if(void 0===t.fn.inputmask){var s="function"==typeof ScriptEngineMajorVersion?ScriptEngineMajorVersion():new Function("/*@cc_on return @_jscript_version; @*/")()>=10,o=navigator.userAgent,l=null!==o.match(new RegExp("iphone","i")),c=null!==o.match(new RegExp("android.*safari.*","i")),h=null!==o.match(new RegExp("android.*chrome.*","i")),u=null!==o.match(new RegExp("android.*firefox.*","i")),d=/Kindle/i.test(o)||/Silk/i.test(o)||/KFTT/i.test(o)||/KFOT/i.test(o)||/KFJWA/i.test(o)||/KFJWI/i.test(o)||/KFSOWI/i.test(o)||/KFTHWA/i.test(o)||/KFTHWI/i.test(o)||/KFAPWA/i.test(o)||/KFAPWI/i.test(o),p=e("paste")?"paste":e("input")?"input":"propertychange";t.inputmask={defaults:{placeholder:"_",optionalmarker:{start:"[",end:"]"},quantifiermarker:{start:"{",end:"}"},groupmarker:{start:"(",end:")"},alternatormarker:"|",escapeChar:"\\",mask:null,oncomplete:t.noop,onincomplete:t.noop,oncleared:t.noop,repeat:0,greedy:!0,autoUnmask:!1,removeMaskOnSubmit:!0,clearMaskOnLostFocus:!0,insertMode:!0,clearIncomplete:!1,aliases:{},alias:null,onKeyUp:t.noop,onKeyPress:t.noop,onKeyDown:t.noop,onBeforeMask:void 0,onBeforePaste:void 0,onUnMask:void 0,showMaskOnFocus:!0,showMaskOnHover:!0,onKeyValidation:t.noop,skipOptionalPartCharacter:" ",showTooltip:!1,numericInput:!1,rightAlign:!1,radixPoint:"",radixFocus:!1,nojumps:!1,nojumpsThreshold:0,keepStatic:void 0,definitions:{9:{validator:"[0-9]",cardinality:1,definitionSymbol:"*"},a:{validator:"[A-Za-zА-яЁёÀ-ÿµ]",cardinality:1,definitionSymbol:"*"},"*":{validator:"[0-9A-Za-zА-яЁёÀ-ÿµ]",cardinality:1}},ignorables:[8,9,13,19,27,33,34,35,36,37,38,39,40,45,46,93,112,113,114,115,116,117,118,119,120,121,122,123],isComplete:void 0},keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91},masksCache:{},escapeRegex:function(t){var e=["/",".","*","+","?","|","(",")","[","]","{","}","\\"];return t.replace(new RegExp("(\\"+e.join("|\\")+")","gim"),"\\$1")},format:function(e,a,s){var o=t.extend(!0,{},t.inputmask.defaults,a);return i(o.alias,a,o),r({action:"format",value:e,metadata:s},n(o),o)},isValid:function(e,a){var s=t.extend(!0,{},t.inputmask.defaults,a);return i(s.alias,a,s),r({action:"isValid",value:e},n(s),s)}},t.fn.inputmask=function(e,a,s,o,l){function c(e,a,n){var r=t(e);r.data("inputmask-alias")&&i(r.data("inputmask-alias"),{},a);for(var s in a){var o=r.data("inputmask-"+s.toLowerCase());void 0!=o&&("mask"==s&&0==o.indexOf("[")?(a[s]=o.replace(/[\s[\]]/g,"").split("','"),a[s][0]=a[s][0].replace("'",""),a[s][a[s].length-1]=a[s][a[s].length-1].replace("'","")):a[s]="boolean"==typeof o?o:o.toString(),n&&(n[s]=a[s]))}return a}s=s||r,o=o||"_inputmask";var h,u=t.extend(!0,{},t.inputmask.defaults,a);if("string"==typeof e)switch(e){case"mask":return i(u.alias,a,u),h=n(u,s!==r),void 0==h?this:this.each(function(){s({action:"mask",el:this},t.extend(!0,{},h),c(this,u))});case"unmaskedvalue":var d=t(this);return d.data(o)?s({action:"unmaskedvalue",$input:d}):d.val();case"remove":return this.each(function(){var e=t(this);e.data(o)&&s({action:"remove",el:this})});case"getemptymask":return this.data(o)?s({action:"getemptymask",el:this}):"";case"hasMaskedValue":return this.data(o)?!this.data(o).opts.autoUnmask:!1;case"isComplete":return this.data(o)?s({action:"isComplete",buffer:this[0]._valueGet().split(""),el:this}):!0;case"getmetadata":return this.data(o)?s({action:"getmetadata",el:this}):void 0;case"_detectScope":return i(u.alias,a,u),void 0==l||i(l,a,u)||-1!=t.inArray(l,["mask","unmaskedvalue","remove","getemptymask","hasMaskedValue","isComplete","getmetadata","_detectScope"])||(u.mask=l),t.isFunction(u.mask)&&(u.mask=u.mask.call(this,u)),t.isArray(u.mask);default:return i(u.alias,a,u),i(e,a,u)||(u.mask=e),h=n(u,s!==r),void 0==h?this:this.each(function(){s({action:"mask",el:this},t.extend(!0,{},h),c(this,u))})}else{if("object"==typeof e)return u=t.extend(!0,{},t.inputmask.defaults,e),i(u.alias,e,u),h=n(u,s!==r),void 0==h?this:this.each(function(){s({action:"mask",el:this},t.extend(!0,{},h),c(this,u))});if(void 0==e)return this.each(function(){var e=t(this).attr("data-inputmask");if(e&&""!=e)try{e=e.replace(new RegExp("'","g"),'"');var n=t.parseJSON("{"+e+"}");t.extend(!0,n,a),u=t.extend(!0,{},t.inputmask.defaults,n),u=c(this,u),i(u.alias,n,u),u.alias=void 0,t(this).inputmask("mask",u,s)}catch(r){}if(t(this).attr("data-inputmask-mask")||t(this).attr("data-inputmask-alias")){u=t.extend(!0,{},t.inputmask.defaults,{});var o={};u=c(this,u,o),i(u.alias,o,u),u.alias=void 0,t(this).inputmask("mask",u,s)}})}}}return t.fn.inputmask}(jQuery),function(t){return t.extend(t.inputmask.defaults.definitions,{h:{validator:"[01][0-9]|2[0-3]",cardinality:2,prevalidator:[{validator:"[0-2]",cardinality:1}]},s:{validator:"[0-5][0-9]",cardinality:2,prevalidator:[{validator:"[0-5]",cardinality:1}]},d:{validator:"0[1-9]|[12][0-9]|3[01]",cardinality:2,prevalidator:[{validator:"[0-3]",cardinality:1}]},m:{validator:"0[1-9]|1[012]",cardinality:2,prevalidator:[{validator:"[01]",cardinality:1}]},y:{validator:"(19|20)\\d{2}",cardinality:4,prevalidator:[{validator:"[12]",cardinality:1},{validator:"(19|20)",cardinality:2},{validator:"(19|20)\\d",cardinality:3}]}}),t.extend(t.inputmask.defaults.aliases,{"dd/mm/yyyy":{mask:"1/2/y",placeholder:"dd/mm/yyyy",regex:{val1pre:new RegExp("[0-3]"),val1:new RegExp("0[1-9]|[12][0-9]|3[01]"),val2pre:function(e){var a=t.inputmask.escapeRegex.call(this,e);return new RegExp("((0[1-9]|[12][0-9]|3[01])"+a+"[01])")},val2:function(e){var a=t.inputmask.escapeRegex.call(this,e);return new RegExp("((0[1-9]|[12][0-9])"+a+"(0[1-9]|1[012]))|(30"+a+"(0[13-9]|1[012]))|(31"+a+"(0[13578]|1[02]))")}},leapday:"29/02/",separator:"/",yearrange:{minyear:1900,maxyear:2099},isInYearRange:function(t,e,a){if(isNaN(t))return!1;var i=parseInt(t.concat(e.toString().slice(t.length))),n=parseInt(t.concat(a.toString().slice(t.length)));return(isNaN(i)?!1:i>=e&&a>=i)||(isNaN(n)?!1:n>=e&&a>=n)},determinebaseyear:function(t,e,a){var i=(new Date).getFullYear();if(t>i)return t;if(i>e){for(var n=e.toString().slice(0,2),r=e.toString().slice(2,4);n+a>e;)n--;var s=n+r;return t>s?t:s}return i},onKeyUp:function(e){var a=t(this);if(e.ctrlKey&&e.keyCode==t.inputmask.keyCode.RIGHT){var i=new Date;a.val(i.getDate().toString()+(i.getMonth()+1).toString()+i.getFullYear().toString())}},definitions:{1:{validator:function(t,e,a,i,n){var r=n.regex.val1.test(t);return i||r||t.charAt(1)!=n.separator&&-1=="-./".indexOf(t.charAt(1))||!(r=n.regex.val1.test("0"+t.charAt(0)))?r:(e.buffer[a-1]="0",{refreshFromBuffer:{start:a-1,end:a},pos:a,c:t.charAt(0)})},cardinality:2,prevalidator:[{validator:function(t,e,a,i,n){isNaN(e.buffer[a+1])||(t+=e.buffer[a+1]);var r=1==t.length?n.regex.val1pre.test(t):n.regex.val1.test(t);return i||r||!(r=n.regex.val1.test("0"+t))?r:(e.buffer[a]="0",a++,{pos:a})},cardinality:1}]},2:{validator:function(t,e,a,i,n){var r=n.mask.indexOf("2")==n.mask.length-1?e.buffer.join("").substr(5,3):e.buffer.join("").substr(0,3);-1!=r.indexOf(n.placeholder[0])&&(r="01"+n.separator);var s=n.regex.val2(n.separator).test(r+t);if(!i&&!s&&(t.charAt(1)==n.separator||-1!="-./".indexOf(t.charAt(1)))&&(s=n.regex.val2(n.separator).test(r+"0"+t.charAt(0))))return e.buffer[a-1]="0",{refreshFromBuffer:{start:a-1,end:a},pos:a,c:t.charAt(0)};if(n.mask.indexOf("2")==n.mask.length-1&&s){var o=e.buffer.join("").substr(4,4)+t;if(o!=n.leapday)return!0;var l=parseInt(e.buffer.join("").substr(0,4),10);return l%4===0?l%100===0?l%400===0:!0:!1}return s},cardinality:2,prevalidator:[{validator:function(t,e,a,i,n){isNaN(e.buffer[a+1])||(t+=e.buffer[a+1]);var r=n.mask.indexOf("2")==n.mask.length-1?e.buffer.join("").substr(5,3):e.buffer.join("").substr(0,3);-1!=r.indexOf(n.placeholder[0])&&(r="01"+n.separator);var s=1==t.length?n.regex.val2pre(n.separator).test(r+t):n.regex.val2(n.separator).test(r+t);return i||s||!(s=n.regex.val2(n.separator).test(r+"0"+t))?s:(e.buffer[a]="0",a++,{pos:a})},cardinality:1}]},y:{validator:function(t,e,a,i,n){if(n.isInYearRange(t,n.yearrange.minyear,n.yearrange.maxyear)){var r=e.buffer.join("").substr(0,6);if(r!=n.leapday)return!0;var s=parseInt(t,10);return s%4===0?s%100===0?s%400===0:!0:!1}return!1},cardinality:4,prevalidator:[{validator:function(t,e,a,i,n){var r=n.isInYearRange(t,n.yearrange.minyear,n.yearrange.maxyear);if(!i&&!r){var s=n.determinebaseyear(n.yearrange.minyear,n.yearrange.maxyear,t+"0").toString().slice(0,1);if(r=n.isInYearRange(s+t,n.yearrange.minyear,n.yearrange.maxyear))return e.buffer[a++]=s.charAt(0),{pos:a};if(s=n.determinebaseyear(n.yearrange.minyear,n.yearrange.maxyear,t+"0").toString().slice(0,2),r=n.isInYearRange(s+t,n.yearrange.minyear,n.yearrange.maxyear))return e.buffer[a++]=s.charAt(0),e.buffer[a++]=s.charAt(1),{pos:a}}return r},cardinality:1},{validator:function(t,e,a,i,n){var r=n.isInYearRange(t,n.yearrange.minyear,n.yearrange.maxyear);if(!i&&!r){var s=n.determinebaseyear(n.yearrange.minyear,n.yearrange.maxyear,t).toString().slice(0,2);if(r=n.isInYearRange(t[0]+s[1]+t[1],n.yearrange.minyear,n.yearrange.maxyear))return e.buffer[a++]=s.charAt(1),{pos:a};if(s=n.determinebaseyear(n.yearrange.minyear,n.yearrange.maxyear,t).toString().slice(0,2),n.isInYearRange(s+t,n.yearrange.minyear,n.yearrange.maxyear)){var o=e.buffer.join("").substr(0,6);if(o!=n.leapday)r=!0;else{var l=parseInt(t,10);r=l%4===0?l%100===0?l%400===0:!0:!1}}else r=!1;if(r)return e.buffer[a-1]=s.charAt(0),e.buffer[a++]=s.charAt(1),e.buffer[a++]=t.charAt(0),{refreshFromBuffer:{start:a-3,end:a},pos:a}}return r},cardinality:2},{validator:function(t,e,a,i,n){return n.isInYearRange(t,n.yearrange.minyear,n.yearrange.maxyear)},cardinality:3}]}},insertMode:!1,autoUnmask:!1},"mm/dd/yyyy":{placeholder:"mm/dd/yyyy",alias:"dd/mm/yyyy",regex:{val2pre:function(e){var a=t.inputmask.escapeRegex.call(this,e);return new RegExp("((0[13-9]|1[012])"+a+"[0-3])|(02"+a+"[0-2])")},val2:function(e){var a=t.inputmask.escapeRegex.call(this,e);return new RegExp("((0[1-9]|1[012])"+a+"(0[1-9]|[12][0-9]))|((0[13-9]|1[012])"+a+"30)|((0[13578]|1[02])"+a+"31)")},val1pre:new RegExp("[01]"),val1:new RegExp("0[1-9]|1[012]")},leapday:"02/29/",onKeyUp:function(e){var a=t(this);if(e.ctrlKey&&e.keyCode==t.inputmask.keyCode.RIGHT){var i=new Date;a.val((i.getMonth()+1).toString()+i.getDate().toString()+i.getFullYear().toString())}}},"yyyy/mm/dd":{mask:"y/1/2",placeholder:"yyyy/mm/dd",alias:"mm/dd/yyyy",leapday:"/02/29",onKeyUp:function(e){var a=t(this);if(e.ctrlKey&&e.keyCode==t.inputmask.keyCode.RIGHT){var i=new Date;a.val(i.getFullYear().toString()+(i.getMonth()+1).toString()+i.getDate().toString())}}},"dd.mm.yyyy":{mask:"1.2.y",placeholder:"dd.mm.yyyy",leapday:"29.02.",separator:".",alias:"dd/mm/yyyy"},"dd-mm-yyyy":{mask:"1-2-y",placeholder:"dd-mm-yyyy",leapday:"29-02-",separator:"-",alias:"dd/mm/yyyy"},"mm.dd.yyyy":{mask:"1.2.y",placeholder:"mm.dd.yyyy",leapday:"02.29.",separator:".",alias:"mm/dd/yyyy"},"mm-dd-yyyy":{mask:"1-2-y",placeholder:"mm-dd-yyyy",leapday:"02-29-",separator:"-",alias:"mm/dd/yyyy"},"yyyy.mm.dd":{mask:"y.1.2",placeholder:"yyyy.mm.dd",leapday:".02.29",separator:".",alias:"yyyy/mm/dd"},"yyyy-mm-dd":{mask:"y-1-2",placeholder:"yyyy-mm-dd",leapday:"-02-29",separator:"-",alias:"yyyy/mm/dd"},datetime:{mask:"1/2/y h:s",placeholder:"dd/mm/yyyy hh:mm",alias:"dd/mm/yyyy",regex:{hrspre:new RegExp("[012]"),hrs24:new RegExp("2[0-4]|1[3-9]"),hrs:new RegExp("[01][0-9]|2[0-4]"),ampm:new RegExp("^[a|p|A|P][m|M]"),mspre:new RegExp("[0-5]"),ms:new RegExp("[0-5][0-9]")},timeseparator:":",hourFormat:"24",definitions:{h:{validator:function(t,e,a,i,n){if("24"==n.hourFormat&&24==parseInt(t,10))return e.buffer[a-1]="0",e.buffer[a]="0",{refreshFromBuffer:{start:a-1,end:a},c:"0"};var r=n.regex.hrs.test(t);if(!i&&!r&&(t.charAt(1)==n.timeseparator||-1!="-.:".indexOf(t.charAt(1)))&&(r=n.regex.hrs.test("0"+t.charAt(0))))return e.buffer[a-1]="0",e.buffer[a]=t.charAt(0),a++,{refreshFromBuffer:{start:a-2,end:a},pos:a,c:n.timeseparator};if(r&&"24"!==n.hourFormat&&n.regex.hrs24.test(t)){var s=parseInt(t,10);return 24==s?(e.buffer[a+5]="a",e.buffer[a+6]="m"):(e.buffer[a+5]="p",e.buffer[a+6]="m"),s-=12,10>s?(e.buffer[a]=s.toString(),e.buffer[a-1]="0"):(e.buffer[a]=s.toString().charAt(1),e.buffer[a-1]=s.toString().charAt(0)),{refreshFromBuffer:{start:a-1,end:a+6},c:e.buffer[a]}}return r},cardinality:2,prevalidator:[{validator:function(t,e,a,i,n){var r=n.regex.hrspre.test(t);return i||r||!(r=n.regex.hrs.test("0"+t))?r:(e.buffer[a]="0",a++,{pos:a})},cardinality:1}]},s:{validator:"[0-5][0-9]",cardinality:2,prevalidator:[{validator:function(t,e,a,i,n){var r=n.regex.mspre.test(t);return i||r||!(r=n.regex.ms.test("0"+t))?r:(e.buffer[a]="0",a++,{pos:a})},cardinality:1}]},t:{validator:function(t,e,a,i,n){return n.regex.ampm.test(t+"m")},casing:"lower",cardinality:1}},insertMode:!1,autoUnmask:!1},datetime12:{mask:"1/2/y h:s t\\m",placeholder:"dd/mm/yyyy hh:mm xm",alias:"datetime",hourFormat:"12"},"hh:mm t":{mask:"h:s t\\m",placeholder:"hh:mm xm",alias:"datetime",hourFormat:"12"},"h:s t":{mask:"h:s t\\m",placeholder:"hh:mm xm",alias:"datetime",hourFormat:"12"},"hh:mm:ss":{mask:"h:s:s",placeholder:"hh:mm:ss",alias:"datetime",autoUnmask:!1},"hh:mm":{mask:"h:s",placeholder:"hh:mm",alias:"datetime",autoUnmask:!1},date:{alias:"dd/mm/yyyy"},"mm/yyyy":{mask:"1/y",placeholder:"mm/yyyy",leapday:"donotuse",separator:"/",alias:"mm/dd/yyyy"}}),t.fn.inputmask}(jQuery),function(t){return t.extend(t.inputmask.defaults.definitions,{A:{validator:"[A-Za-zА-яЁёÀ-ÿµ]",cardinality:1,casing:"upper"},"#":{validator:"[0-9A-Za-zА-яЁёÀ-ÿµ]",cardinality:1,casing:"upper"}}),t.extend(t.inputmask.defaults.aliases,{url:{mask:"ir",placeholder:"",separator:"",defaultPrefix:"http://",regex:{urlpre1:new RegExp("[fh]"),urlpre2:new RegExp("(ft|ht)"),urlpre3:new RegExp("(ftp|htt)"),urlpre4:new RegExp("(ftp:|http|ftps)"),urlpre5:new RegExp("(ftp:/|ftps:|http:|https)"),urlpre6:new RegExp("(ftp://|ftps:/|http:/|https:)"),urlpre7:new RegExp("(ftp://|ftps://|http://|https:/)"),urlpre8:new RegExp("(ftp://|ftps://|http://|https://)")},definitions:{i:{validator:function(){return!0},cardinality:8,prevalidator:function(){for(var t=[],e=8,a=0;e>a;a++)t[a]=function(){var t=a;return{validator:function(e,a,i,n,r){if(r.regex["urlpre"+(t+1)]){var s,o=e;t+1-e.length>0&&(o=a.buffer.join("").substring(0,t+1-e.length)+""+o);var l=r.regex["urlpre"+(t+1)].test(o);if(!n&&!l){for(i-=t,s=0;s<r.defaultPrefix.length;s++)a.buffer[i]=r.defaultPrefix[s],i++;for(s=0;s<o.length-1;s++)a.buffer[i]=o[s],i++;return{pos:i}}return l}return!1},cardinality:t}}();return t}()},r:{validator:".",cardinality:50}},insertMode:!1,autoUnmask:!1},ip:{mask:"i[i[i]].i[i[i]].i[i[i]].i[i[i]]",definitions:{i:{validator:function(t,e,a){return a-1>-1&&"."!=e.buffer[a-1]?(t=e.buffer[a-1]+t,t=a-2>-1&&"."!=e.buffer[a-2]?e.buffer[a-2]+t:"0"+t):t="00"+t,new RegExp("25[0-5]|2[0-4][0-9]|[01][0-9][0-9]").test(t)},cardinality:1}}},email:{mask:"*{1,64}[.*{1,64}][.*{1,64}][.*{1,64}]@*{1,64}[.*{2,64}][.*{2,6}][.*{1,2}]",greedy:!1,onBeforePaste:function(t){return t=t.toLowerCase(),t.replace("mailto:","")},definitions:{"*":{validator:"[0-9A-Za-z!#$%&'*+/=?^_`{|}~-]",cardinality:1,casing:"lower"}}}}),t.fn.inputmask}(jQuery),function(t){return t.extend(t.inputmask.defaults.aliases,{numeric:{mask:function(t){if(0!==t.repeat&&isNaN(t.integerDigits)&&(t.integerDigits=t.repeat),t.repeat=0,t.groupSeparator==t.radixPoint&&(t.groupSeparator="."==t.radixPoint?",":","==t.radixPoint?".":"")," "===t.groupSeparator&&(t.skipOptionalPartCharacter=void 0),t.autoGroup=t.autoGroup&&""!=t.groupSeparator,t.autoGroup&&isFinite(t.integerDigits)){var e=Math.floor(t.integerDigits/t.groupSize),a=t.integerDigits%t.groupSize;t.integerDigits+=0==a?e-1:e}t.definitions[";"]=t.definitions["~"];var i=t.prefix;return i+="[+]",i+="~{1,"+t.integerDigits+"}",void 0!=t.digits&&(isNaN(t.digits)||parseInt(t.digits)>0)&&(i+=t.digitsOptional?"["+(t.decimalProtect?":":t.radixPoint)+";{"+t.digits+"}]":(t.decimalProtect?":":t.radixPoint)+";{"+t.digits+"}"),i+=t.suffix},placeholder:"",greedy:!1,digits:"*",digitsOptional:!0,groupSeparator:"",radixPoint:".",radixFocus:!0,groupSize:3,autoGroup:!1,allowPlus:!0,allowMinus:!0,integerDigits:"+",prefix:"",suffix:"",rightAlign:!0,decimalProtect:!0,postFormat:function(e,a,i,n){var r=!1,s=e[a];if(""==n.groupSeparator||-1!=t.inArray(n.radixPoint,e)&&a>=t.inArray(n.radixPoint,e)||new RegExp("[-+]").test(s))return{pos:a};var o=e.slice();s==n.groupSeparator&&(o.splice(a--,1),s=o[a]),i?o[a]="?":o.splice(a,0,"?");var l=o.join("");if(n.autoGroup||i&&-1!=l.indexOf(n.groupSeparator)){var c=t.inputmask.escapeRegex.call(this,n.groupSeparator);r=0==l.indexOf(n.groupSeparator),l=l.replace(new RegExp(c,"g"),"");var h=l.split(n.radixPoint);if(l=h[0],l!=n.prefix+"?0"&&l.length>=n.groupSize+n.prefix.length){r=!0;for(var u=new RegExp("([-+]?[\\d?]+)([\\d?]{"+n.groupSize+"})");u.test(l);)l=l.replace(u,"$1"+n.groupSeparator+"$2"),l=l.replace(n.groupSeparator+n.groupSeparator,n.groupSeparator)}h.length>1&&(l+=n.radixPoint+h[1])}e.length=l.length;for(var d=0,p=l.length;p>d;d++)e[d]=l.charAt(d);var f=t.inArray("?",e);return i?e[f]=s:e.splice(f,1),{pos:f,refreshFromBuffer:r}},onKeyDown:function(e,a,i,n){if(e.keyCode==t.inputmask.keyCode.TAB&&"0"!=n.placeholder.charAt(0)){var r=t.inArray(n.radixPoint,a);if(-1!=r&&isFinite(n.digits)){for(var s=1;s<=n.digits;s++)(void 0==a[r+s]||a[r+s]==n.placeholder.charAt(0))&&(a[r+s]="0");return{refreshFromBuffer:{start:++r,end:r+n.digits}}}}else if(n.autoGroup&&(e.keyCode==t.inputmask.keyCode.DELETE||e.keyCode==t.inputmask.keyCode.BACKSPACE)){var o=n.postFormat(a,i-1,!0,n);return o.caret=o.pos+1,o}},onKeyPress:function(t,e,a,i){if(i.autoGroup){var n=i.postFormat(e,a-1,!0,i);return n.caret=n.pos+1,n}},regex:{integerPart:function(){return new RegExp("[-+]?\\d+")},integerNPart:function(){return new RegExp("\\d+")}},signHandler:function(t,e,a,i,n){if(!i&&(n.allowMinus&&"-"===t||n.allowPlus&&"+"===t)){var r=e.join("").match(n.regex.integerPart(n));if(r&&r.length>0&&"0"!==r[r.index])return e[r.index]==("-"===t?"+":"-")?{pos:r.index,c:t,remove:r.index,caret:a}:e[r.index]==("-"===t?"-":"+")?{remove:r.index,caret:a-1}:{pos:r.index,c:t,caret:a+1}}return!1},radixHandler:function(e,a,i,n,r){if(!n&&e===r.radixPoint){var s=t.inArray(r.radixPoint,a.buffer),o=a.buffer.join("").match(r.regex.integerPart(r));if(-1!=s)return a.validPositions[s-1]?{caret:s+1}:{pos:o.index,c:o[0],caret:s+1}}return!1},leadingZeroHandler:function(e,a,i,n,r){var s=a.buffer.join("").match(r.regex.integerNPart(r)),o=t.inArray(r.radixPoint,a.buffer);if(s&&!n&&(-1==o||s.index<o))if(0==s[0].indexOf("0")&&i>=r.prefix.length){if(-1==o||o>=i&&void 0==a.validPositions[o])return a.buffer.splice(s.index,1),i=i>s.index?i-1:s.index,{pos:i,remove:s.index};if(i>s.index&&o>=i)return a.buffer.splice(s.index,1),i=i>s.index?i-1:s.index,{pos:i,remove:s.index}}else if("0"==e&&i<=s.index)return!1;return!0},definitions:{"~":{validator:function(e,a,i,n,r){var s=r.signHandler(e,a.buffer,i,n,r);if(!s&&(s=r.radixHandler(e,a,i,n,r),!s&&(s=n?new RegExp("[0-9"+t.inputmask.escapeRegex.call(this,r.groupSeparator)+"]").test(e):new RegExp("[0-9]").test(e),s===!0&&(s=r.leadingZeroHandler(e,a,i,n,r),s===!0)))){var o=t.inArray(r.radixPoint,a.buffer);r.digitsOptional===!1&&i>o&&!n&&(s={pos:i,remove:i}),s={pos:i}}return s},cardinality:1,prevalidator:null},"+":{validator:function(t,e,a,i,n){var r=n.signHandler(t,e.buffer,a,i,n);return r||(r=n.allowMinus&&"-"==t||n.allowPlus&&"+"==t),r},cardinality:1,prevalidator:null,placeholder:""},":":{validator:function(e,a,i,n,r){var s=r.signHandler(e,a.buffer,i,n,r);if(!s){var o="["+t.inputmask.escapeRegex.call(this,r.radixPoint)+"]";s=new RegExp(o).test(e),s&&a.validPositions[i]&&a.validPositions[i].match.placeholder==r.radixPoint&&(s={pos:i,remove:i})}return s},cardinality:1,prevalidator:null,placeholder:function(t){return t.radixPoint}}},insertMode:!0,autoUnmask:!1,onUnMask:function(e,a,i){var n=e.replace(i.prefix,"");return n=n.replace(i.suffix,""),n=n.replace(new RegExp(t.inputmask.escapeRegex.call(this,i.groupSeparator),"g"),"")},isComplete:function(e,a){var i=e.join(""),n=e.slice();if(a.postFormat(n,0,!0,a),n.join("")!=i)return!1;var r=i.replace(a.prefix,"");return r=r.replace(a.suffix,""),r=r.replace(new RegExp(t.inputmask.escapeRegex.call(this,a.groupSeparator),"g"),""),r=r.replace(t.inputmask.escapeRegex.call(this,a.radixPoint),"."),isFinite(r)},onBeforeMask:function(e,a){if(isFinite(e))return e.toString().replace(".",a.radixPoint);var i=e.match(/,/g),n=e.match(/\./g);return n&&i?n.length>i.length?(e=e.replace(/\./g,""),e=e.replace(",",a.radixPoint)):i.length>n.length&&(e=e.replace(/,/g,""),e=e.replace(".",a.radixPoint)):e=e.replace(new RegExp(t.inputmask.escapeRegex.call(this,a.groupSeparator),"g"),""),e}},currency:{prefix:"$ ",groupSeparator:",",radixPoint:".",alias:"numeric",placeholder:"0",autoGroup:!0,digits:2,digitsOptional:!1,clearMaskOnLostFocus:!1,decimalProtect:!0},decimal:{alias:"numeric"},integer:{alias:"numeric",digits:"0"}}),t.fn.inputmask}(jQuery),function(t){return t.extend(t.inputmask.defaults.aliases,{phone:{url:"phone-codes/phone-codes.js",maskInit:"+pp(pp)pppppppp",mask:function(e){e.definitions={p:{validator:function(){return!1},cardinality:1},"#":{validator:"[0-9]",cardinality:1}};var a=[];return t.ajax({url:e.url,async:!1,dataType:"json",success:function(t){a=t}}),a=a.sort(function(t,e){return(t.mask||t)<(e.mask||e)?-1:1}),a.splice(0,0,e.maskInit),a},nojumps:!0,nojumpsThreshold:1},phonebe:{alias:"phone",url:"phone-codes/phone-be.js",maskInit:"+32(pp)pppppppp",nojumpsThreshold:4}}),t.fn.inputmask}(jQuery),function(t){return t.extend(t.inputmask.defaults.aliases,{Regex:{mask:"r",greedy:!1,repeat:"*",regex:null,regexTokens:null,tokenizer:/\[\^?]?(?:[^\\\]]+|\\[\S\s]?)*]?|\\(?:0(?:[0-3][0-7]{0,2}|[4-7][0-7]?)?|[1-9][0-9]*|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}|c[A-Za-z]|[\S\s]?)|\((?:\?[:=!]?)?|(?:[?*+]|\{[0-9]+(?:,[0-9]*)?\})\??|[^.?*+^${[()|\\]+|./g,quantifierFilter:/[0-9]+[^,]/,isComplete:function(t,e){return new RegExp(e.regex).test(t.join(""))},definitions:{r:{validator:function(e,a,i,n,r){function s(t,e){this.matches=[],this.isGroup=t||!1,this.isQuantifier=e||!1,this.quantifier={min:1,max:1},this.repeaterPart=void 0}function o(){var t,e,a=new s,i=[];for(r.regexTokens=[];t=r.tokenizer.exec(r.regex);)switch(e=t[0],e.charAt(0)){case"(":i.push(new s(!0));break;case")":var n=i.pop();i.length>0?i[i.length-1].matches.push(n):a.matches.push(n);break;case"{":case"+":case"*":var o=new s(!1,!0);e=e.replace(/[{}]/g,"");var l=e.split(","),c=isNaN(l[0])?l[0]:parseInt(l[0]),h=1==l.length?c:isNaN(l[1])?l[1]:parseInt(l[1]);if(o.quantifier={min:c,max:h},i.length>0){var u=i[i.length-1].matches;if(t=u.pop(),!t.isGroup){var n=new s(!0);n.matches.push(t),t=n}u.push(t),u.push(o)}else{if(t=a.matches.pop(),!t.isGroup){var n=new s(!0);n.matches.push(t),t=n}a.matches.push(t),a.matches.push(o)}break;default:i.length>0?i[i.length-1].matches.push(e):a.matches.push(e)}a.matches.length>0&&r.regexTokens.push(a)}function l(e,a){var i=!1;a&&(h+="(",d++);for(var n=0;n<e.matches.length;n++){var r=e.matches[n];if(1==r.isGroup)i=l(r,!0);else if(1==r.isQuantifier){var s=t.inArray(r,e.matches),o=e.matches[s-1],c=h;if(isNaN(r.quantifier.max)){for(;r.repeaterPart&&r.repeaterPart!=h&&r.repeaterPart.length>h.length&&!(i=l(o,!0)););i=i||l(o,!0),i&&(r.repeaterPart=h),h=c+r.quantifier.max}else{for(var u=0,f=r.quantifier.max-1;f>u&&!(i=l(o,!0));u++);h=c+"{"+r.quantifier.min+","+r.quantifier.max+"}"}}else if(void 0!=r.matches)for(var v=0;v<r.length&&!(i=l(r[v],a));v++);else{var m;if("["==r.charAt(0)){m=h,m+=r;for(var g=0;d>g;g++)m+=")";var y=new RegExp("^("+m+")$");i=y.test(p)}else for(var k=0,b=r.length;b>k;k++)if("\\"!=r.charAt(k)){m=h,m+=r.substr(0,k+1),m=m.replace(/\|$/,"");for(var g=0;d>g;g++)m+=")";var y=new RegExp("^("+m+")$");if(i=y.test(p))break}h+=r}if(i)break}return a&&(h+=")",d--),i}null==r.regexTokens&&o();var c=a.buffer.slice(),h="",u=!1,d=0;c.splice(i,0,e);for(var p=c.join(""),f=0;f<r.regexTokens.length;f++){var s=r.regexTokens[f];if(u=l(s,s.isGroup))break}return u},cardinality:1}}}}),t.fn.inputmask}(jQuery),jQuery(document).ready(function(t){jQuery(document).on("cf.add",function(){t("[data-inputmask]").inputmask()}),jQuery(document).trigger("cf.add")}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):t("object"==typeof exports?require("jquery"):jQuery)}(function(t){function e(){var t=document.createElement("input");return t.setAttribute("type","range"),"text"!==t.type}function a(t,e){var a=Array.prototype.slice.call(arguments,2);return setTimeout(function(){return t.apply(null,a)},e)}function i(t,e){return e=e||100,function(){if(!t.debouncing){var a=Array.prototype.slice.apply(arguments);t.lastReturnVal=t.apply(window,a),t.debouncing=!0}return clearTimeout(t.debounceTimeout),t.debounceTimeout=setTimeout(function(){t.debouncing=!1},e),t.lastReturnVal}}function n(e,n){if(this.$window=t(window),this.$document=t(document),this.$element=t(e),this.options=t.extend({},l,n),this._defaults=l,this._name=r,this.startEvent=this.options.startEvent.join("."+r+" ")+"."+r,this.moveEvent=this.options.moveEvent.join("."+r+" ")+"."+r,this.endEvent=this.options.endEvent.join("."+r+" ")+"."+r,this.polyfill=this.options.polyfill,this.onInit=this.options.onInit,this.onSlide=this.options.onSlide,this.onSlideEnd=this.options.onSlideEnd,this.polyfill&&o)return!1;this.identifier="js-"+r+"-"+ +new Date,this.min=parseFloat(this.$element[0].getAttribute("min")||0),this.max=parseFloat(this.$element[0].getAttribute("max")||100),this.value=parseFloat(this.$element[0].value||this.min+(this.max-this.min)/2),this.step=parseFloat(this.$element[0].getAttribute("step")||1),this.$fill=t('<div class="'+this.options.fillClass+'" />'),this.$handle=t('<div class="'+this.options.handleClass+'" />'),this.$range=t('<div class="'+this.options.rangeClass+'" id="'+this.identifier+'" />').insertAfter(this.$element).prepend(this.$fill,this.$handle),this.$element.css({position:"absolute",width:"1px",height:"1px",overflow:"hidden",opacity:"0"}),this.handleDown=t.proxy(this.handleDown,this),this.handleMove=t.proxy(this.handleMove,this),this.handleEnd=t.proxy(this.handleEnd,this),this.init();var s=this;this.$window.on("resize."+r,i(function(){a(function(){s.update()},300)},20)),this.$document.on(this.startEvent,"#"+this.identifier+":not(."+this.options.disabledClass+")",this.handleDown),this.$element.on("change."+r,function(t,e){if(!e||e.origin!==r){var a=t.target.value,i=s.getPositionFromValue(a);s.setPosition(i)}})}var r="rangeslider",s=[],o=e(),l={polyfill:!0,rangeClass:"rangeslider",disabledClass:"rangeslider--disabled",fillClass:"rangeslider__fill",handleClass:"rangeslider__handle",startEvent:["mousedown","touchstart","pointerdown"],moveEvent:["mousemove","touchmove","pointermove"],endEvent:["mouseup","touchend","pointerup"]};n.prototype.init=function(){this.onInit&&"function"==typeof this.onInit&&this.onInit(),this.update()},n.prototype.update=function(){this.handleWidth=this.$handle[0].offsetWidth,this.rangeWidth=this.$range[0].offsetWidth,this.maxHandleX=this.rangeWidth-this.handleWidth,this.grabX=this.handleWidth/2,this.position=this.getPositionFromValue(this.value),this.$element[0].disabled?this.$range.addClass(this.options.disabledClass):this.$range.removeClass(this.options.disabledClass),this.setPosition(this.position)},n.prototype.handleDown=function(t){if(t.preventDefault(),this.$document.on(this.moveEvent,this.handleMove),this.$document.on(this.endEvent,this.handleEnd),!((" "+t.target.className+" ").replace(/[\n\t]/g," ").indexOf(this.options.handleClass)>-1)){var e=this.getRelativePosition(this.$range[0],t),a=this.getPositionFromNode(this.$handle[0])-this.getPositionFromNode(this.$range[0]);this.setPosition(e-this.grabX),e>=a&&e<a+this.handleWidth&&(this.grabX=e-a)}},n.prototype.handleMove=function(t){t.preventDefault();var e=this.getRelativePosition(this.$range[0],t);this.setPosition(e-this.grabX)},n.prototype.handleEnd=function(t){t.preventDefault(),this.$document.off(this.moveEvent,this.handleMove),this.$document.off(this.endEvent,this.handleEnd);var e=this.getRelativePosition(this.$range[0],t);this.onSlideEnd&&"function"==typeof this.onSlideEnd&&this.onSlideEnd(e-this.grabX,this.value)},n.prototype.cap=function(t,e,a){return e>t?e:t>a?a:t},n.prototype.setPosition=function(t){var e,a;e=this.getValueFromPosition(this.cap(t,0,this.maxHandleX))/this.step*this.step,a=this.getPositionFromValue(e),this.$fill[0].style.width=a+this.grabX+"px",this.$handle[0].style.left=a+"px",this.setValue(e),this.position=a,this.value=e,this.onSlide&&"function"==typeof this.onSlide&&this.onSlide(a,e)},n.prototype.getPositionFromNode=function(t){for(var e=0;null!==t;)e+=t.offsetLeft,t=t.offsetParent;return e},n.prototype.getRelativePosition=function(t,e){return(e.pageX||e.originalEvent.clientX||e.originalEvent.touches[0].clientX||e.currentPoint.x)-this.getPositionFromNode(t)},n.prototype.getPositionFromValue=function(t){var e,a;return e=(t-this.min)/(this.max-this.min),a=e*this.maxHandleX},n.prototype.getValueFromPosition=function(t){var e,a;return e=t/(this.maxHandleX||1),a=this.step*Math.ceil((e*(this.max-this.min)+this.min)/this.step),Number(a.toFixed(2))},n.prototype.setValue=function(t){t!==this.value&&this.$element.val(t).trigger("change",{origin:r})},n.prototype.destroy=function(){this.$document.off(this.startEvent,"#"+this.identifier,this.handleDown),this.$element.off("."+r).removeAttr("style").removeData("plugin_"+r),this.$range&&this.$range.length&&this.$range[0].parentNode.removeChild(this.$range[0]),s.splice(s.indexOf(this.$element[0]),1),s.length||this.$window.off("."+r)},t.fn[r]=function(e){return this.each(function(){var a=t(this),i=a.data("plugin_"+r);i||(a.data("plugin_"+r,i=new n(this,e)),s.push(this)),"string"==typeof e&&i[e]()})}}),function(t){"use strict";var e={init:function(a){return this.each(function(){this.self=t(this),e.destroy.call(this.self),this.opt=t.extend(!0,{},t.fn.raty.defaults,a),e._adjustCallback.call(this),e._adjustNumber.call(this),"img"!==this.opt.starType&&e._adjustStarType.call(this),e._adjustPath.call(this),e._createStars.call(this),this.opt.cancel&&e._createCancel.call(this),this.opt.precision&&e._adjustPrecision.call(this),e._createScore.call(this),e._apply.call(this,this.opt.score),e._target.call(this,this.opt.score),this.opt.readOnly?e._lock.call(this):(this.style.cursor="pointer",e._binds.call(this)),this.self.data("options",this.opt)})},_adjustCallback:function(){for(var t=["number","readOnly","score","scoreName"],e=0;e<t.length;e++)"function"==typeof this.opt[t[e]]&&(this.opt[t[e]]=this.opt[t[e]].call(this))},_adjustNumber:function(){this.opt.number=e._between(this.opt.number,1,this.opt.numberMax)},_adjustPath:function(){this.opt.path=this.opt.path||"",this.opt.path&&"/"!==this.opt.path.charAt(this.opt.path.length-1)&&(this.opt.path+="/")},_adjustPrecision:function(){this.opt.half=!0,this.opt.targetType="score"},_adjustStarType:function(){this.opt.path="";for(var t=["cancelOff","cancelOn","starHalf","starOff","starOn"],e=0;e<t.length;e++)this.opt[t[e]]=this.opt[t[e]].replace(".","-")},_apply:function(t){e._fill.call(this,t),t&&(t>0&&this.score.val(e._between(t,0,this.opt.number)),e._roundStars.call(this,t))},_between:function(t,e,a){return Math.min(Math.max(parseFloat(t),e),a)},_binds:function(){this.cancel&&(e._bindOverCancel.call(this),
|
4 |
+
e._bindClickCancel.call(this),e._bindOutCancel.call(this)),e._bindOver.call(this),e._bindClick.call(this),e._bindOut.call(this)},_bindClick:function(){var e=this;e.stars.on("click.raty",function(a){var i=t(this);e.score.val(e.opt.half||e.opt.precision?e.self.data("score"):this.alt||i.data("alt")),e.opt.click&&e.opt.click.call(e,+e.score.val(),a)})},_bindClickCancel:function(){var t=this;t.cancel.on("click.raty",function(e){t.score.removeAttr("value"),t.opt.click&&t.opt.click.call(t,null,e)})},_bindOut:function(){var t=this;t.self.on("mouseleave.raty",function(a){var i=+t.score.val()||void 0;e._apply.call(t,i),e._target.call(t,i,a),t.opt.mouseout&&t.opt.mouseout.call(t,i,a)})},_bindOutCancel:function(){var e=this;e.cancel.on("mouseleave.raty",function(a){var i=t(this),n=e.opt.path+e.opt.cancelOff;if("img"===e.opt.starType)i.attr("src",n);else{var r=e.opt.path+e.opt.cancelOn;i.removeClass(r).addClass(n)}if(e.opt.mouseout){var s=+e.score.val()||void 0;e.opt.mouseout.call(e,s,a)}})},_bindOver:function(){var t=this,a=t.opt.half?"mousemove.raty":"mouseover.raty";t.stars.on(a,function(a){var i=e._getScoreByPosition.call(t,a,this);e._fill.call(t,i),t.opt.half&&(e._roundStars.call(t,i),t.self.data("score",i)),e._target.call(t,i,a),t.opt.mouseover&&t.opt.mouseover.call(t,i,a)})},_bindOverCancel:function(){var a=this;a.cancel.on("mouseover.raty",function(i){var n=a.opt.path+a.opt.cancelOn,r=t(this),s=a.opt.path+a.opt.starOff;if("img"===a.opt.starType)r.attr("src",n),a.stars.attr("src",s);else{a.stars.attr("class",s);var o=a.opt.path+a.opt.cancelOff;r.removeClass(o).addClass(n).css("color",a.opt.starColor)}e._target.call(a,null,i),a.opt.mouseover&&a.opt.mouseover.call(a,null)})},_buildScoreField:function(){return t("<input />",{name:this.opt.scoreName,type:"hidden"}).appendTo(this)},_createCancel:function(){var e=this.opt.path+this.opt.cancelOff,a=t("<"+this.opt.starType+" />",{title:this.opt.cancelHint,"class":"raty-cancel"}).css("marginRight",this.opt.space?this.opt.spaceWidth+"px":"0");"img"===this.opt.starType?a.attr({src:e,alt:"x"}):a.attr("data-alt","x").addClass(e),"left"===this.opt.cancelPlace?this.self.prepend(" ").prepend(a):this.self.append(" ").append(a),this.cancel=a},_createScore:function(){var a=t(this.opt.targetScore);this.score=a.length?a:e._buildScoreField.call(this)},_createStars:function(){for(var a=1;a<=this.opt.number;a++){var i,n=this.opt.score&&this.opt.score>=a?"starOn":"starOff",r=e._getHint.call(this,a);n=this.opt.path+this.opt[n],i="img"!==this.opt.starType?{"data-alt":a,"class":n}:{src:n,alt:a},i.title=r,t("<"+this.opt.starType+" />",i).css("marginRight",a<this.opt.number&&this.opt.space?this.opt.spaceWidth+"px":"0").appendTo(this),this.opt.space}this.stars=this.self.children(this.opt.starType)},_error:function(e){t(this).text(e),t.error(e)},_fill:function(t){for(var a=0,i=1;i<=this.stars.length;i++){var n,r=this.stars.eq(i-1),s=e._turnOn.call(this,i,t);if(this.opt.iconRange&&this.opt.iconRange.length>a){var o=this.opt.iconRange[a];n=e._getIconRange.call(this,o,s),i<=o.range&&("img"===this.opt.starType?r.attr("src",n):r.attr("class",n)),i===o.range&&a++}else n=this.opt.path+this.opt[s?"starOn":"starOff"],"img"===this.opt.starType?r.attr("src",n):r.attr("class",n),s?r.css("color",this.opt.starColor):r.css("color","")}},_getIconRange:function(t,e){return this.opt.path+(e?t.on||this.opt.starOn:t.off||this.opt.starOff)},_getScoreByPosition:function(a,i){var n=t(i),r=parseInt(i.alt||n.data("alt"),10);if(this.opt.half){var s=e._getSize.call(this),o=parseFloat((a.pageX-n.offset().left)/s);r=this.opt.precision?r-1+o:r-1+(o>.5?1:.5)}return r},_getSize:function(){var t;return t="img"===this.opt.starType?this.stars[0].width:parseFloat(this.stars.eq(0).css("font-size")),t||e._error.call(this,"Could not be possible get the icon size!"),t},_turnOn:function(t,e){return this.opt.single?t===e:e>=t},_getHint:function(t){var e=this.opt.hints[t-1];return""===e?"":e||t},_lock:function(){var t=parseInt(this.score.val(),10),a=t?e._getHint.call(this,t):this.opt.noRatedMsg;this.style.cursor="",this.title=a,this.score.prop("readonly",!0),this.stars.prop("title",a),this.cancel&&this.cancel.hide(),this.self.data("readonly",!0)},_roundStars:function(t){var e=(t%1).toFixed(2);if(e>this.opt.round.down){var a="starOn";this.opt.halfShow&&e<this.opt.round.up?a="starHalf":e<this.opt.round.full&&(a="starOff");var i=this.stars[Math.ceil(t)-1];"img"===this.opt.starType?i.src=this.opt.path+this.opt[a]:i.style.className=this.opt[a]}},_target:function(a,i){if(this.opt.target){var n=t(this.opt.target);n.length||e._error.call(this,"Target selector invalid or missing!");var r=i&&"mouseover"===i.type;if(void 0===a)a=this.opt.targetText;else if(null===a)a=r?this.opt.cancelHint:this.opt.targetText;else{"hint"===this.opt.targetType?a=e._getHint.call(this,Math.ceil(a)):this.opt.precision&&(a=parseFloat(a).toFixed(1));var s=i&&"mousemove"===i.type;r||s||this.opt.targetKeep||(a=this.opt.targetText)}a&&(a=this.opt.targetFormat.toString().replace("{score}",a)),n.is(":input")?n.val(a):n.html(a)}},_unlock:function(){this.style.cursor="pointer",this.removeAttribute("title"),this.score.removeAttr("readonly"),this.self.data("readonly",!1);for(var t=0;t<this.opt.number;t++)this.stars[t].title=e._getHint.call(this,t+1);this.cancel&&this.cancel.css("display","")},cancel:function(a){return this.each(function(){var i=t(this);i.data("readonly")!==!0&&(e[a?"click":"score"].call(i,null),this.score.removeAttr("value"))})},click:function(a){return this.each(function(){t(this).data("readonly")!==!0&&(e._apply.call(this,a),this.opt.click&&this.opt.click.call(this,a,t.Event("click")),e._target.call(this,a))})},destroy:function(){return this.each(function(){var e=t(this),a=e.data("raw");a?e.off(".raty").empty().css({cursor:a.style.cursor}).removeData("readonly"):e.data("raw",e.clone()[0])})},getScore:function(){var t,e=[];return this.each(function(){t=this.score.val(),e.push(t?+t:void 0)}),e.length>1?e:e[0]},move:function(a){return this.each(function(){var i=parseInt(a,10),n=t(this).data("options"),r=(+a).toFixed(1).split(".")[1];i>=n.number&&(i=n.number-1,r=10);var s=e._getSize.call(this),o=s/10,l=t(this.stars[i]),c=l.offset().left+o*parseInt(r,10),h=t.Event("mousemove",{pageX:c});l.trigger(h)})},readOnly:function(a){return this.each(function(){var i=t(this);i.data("readonly")!==a&&(a?(i.off(".raty").children("img").off(".raty"),e._lock.call(this)):(e._binds.call(this),e._unlock.call(this)),i.data("readonly",a))})},reload:function(){return e.set.call(this,{})},score:function(){var a=t(this);return arguments.length?e.setScore.apply(a,arguments):e.getScore.call(a)},set:function(e){return this.each(function(){var a=t(this),i=a.data("options"),n=t.extend({},i,e);a.raty(n)})},setScore:function(a){return this.each(function(){t(this).data("readonly")!==!0&&(e._apply.call(this,a),e._target.call(this,a))})}};t.fn.raty=function(a){return e[a]?e[a].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof a&&a?void t.error("Method "+a+" does not exist!"):e.init.apply(this,arguments)},t.fn.raty.defaults={cancel:!1,cancelHint:"Cancel this rating!",cancelOff:"raty-cancel-off",cancelOn:"raty-cancel-on",cancelPlace:"left",click:void 0,half:!1,halfShow:!0,hints:["1"],iconRange:void 0,mouseout:void 0,mouseover:void 0,noRatedMsg:"Not rated yet!",number:5,numberMax:20,path:void 0,precision:!1,readOnly:!1,round:{down:.25,full:.6,up:.76},score:void 0,scoreName:"score",single:!1,space:!0,spaceWidth:3,starColor:"#ff00aa",starHalf:"star-half.png",starOff:"raty-dot-off",starOn:"raty-dot-on",starType:"img",target:void 0,targetFormat:"{score}",targetKeep:!1,targetScore:void 0,targetText:"",targetType:"hint"}}(jQuery),jQuery(function(t){t("body").on("click",".cf-toggle-group-buttons a",function(){var e=t(this),a=e.closest(".caldera-config-field"),i=a.find('[data-ref="'+e.attr("id")+'"]');a.find(".btn").removeClass(e.data("active")).addClass(e.data("default")),e.addClass(e.data("active")).removeClass(e.data("default")),i.prop("checked",!0).trigger("change")})});
|
assets/js/formobject-new.js
DELETED
@@ -1,180 +0,0 @@
|
|
1 |
-
/* formjson module */
|
2 |
-
(function($){
|
3 |
-
|
4 |
-
$.fn.formJSON = function(){
|
5 |
-
var form = $(this);
|
6 |
-
|
7 |
-
var fields = form.find('[name]'),
|
8 |
-
json = {},
|
9 |
-
arraynames = {};
|
10 |
-
for( var v = 0; v < fields.length; v++){
|
11 |
-
var field = $( fields[v] ),
|
12 |
-
name = field.prop('name').replace(/\]/gi,'').split('['),
|
13 |
-
value = field.val(),
|
14 |
-
lineconf = {};
|
15 |
-
|
16 |
-
if( field.is(':radio') || field.is(':checkbox') ){
|
17 |
-
if( !field.is(':checked') ){
|
18 |
-
continue;
|
19 |
-
}
|
20 |
-
}
|
21 |
-
|
22 |
-
for(var i = name.length-1; i >= 0; i--){
|
23 |
-
var nestname = name[i];
|
24 |
-
if( typeof nestname === 'undefined' ){
|
25 |
-
nestname = '';
|
26 |
-
}
|
27 |
-
if(nestname.length === 0){
|
28 |
-
lineconf = [];
|
29 |
-
if( typeof arraynames[name[i-1]] === 'undefined'){
|
30 |
-
arraynames[name[i-1]] = 0;
|
31 |
-
}else{
|
32 |
-
arraynames[name[i-1]] += 1;
|
33 |
-
}
|
34 |
-
nestname = arraynames[name[i-1]];
|
35 |
-
}
|
36 |
-
if(i === name.length-1){
|
37 |
-
if( value ){
|
38 |
-
if( value === 'true' ){
|
39 |
-
value = true;
|
40 |
-
}else if( value === 'false' ){
|
41 |
-
value = false;
|
42 |
-
}else if( !isNaN( parseFloat( value ) ) && parseFloat( value ).toString() === value ){
|
43 |
-
value = parseFloat( value );
|
44 |
-
}else if( typeof value === 'string' && ( value.substr(0,1) === '{' || value.substr(0,1) === '[' ) ){
|
45 |
-
try {
|
46 |
-
value = JSON.parse( value );
|
47 |
-
|
48 |
-
} catch (e) {
|
49 |
-
//console.log( e );
|
50 |
-
}
|
51 |
-
}else if( typeof value === 'object' && value.length && field.is('select') ){
|
52 |
-
var new_val = {};
|
53 |
-
for( var i = 0; i < value.length; i++ ){
|
54 |
-
new_val[ 'n' + i ] = value[ i ];
|
55 |
-
}
|
56 |
-
|
57 |
-
value = new_val;
|
58 |
-
}
|
59 |
-
}
|
60 |
-
lineconf[nestname] = value;
|
61 |
-
}else{
|
62 |
-
var newobj = lineconf;
|
63 |
-
lineconf = {};
|
64 |
-
lineconf[nestname] = newobj;
|
65 |
-
}
|
66 |
-
}
|
67 |
-
$.extend(true, json, lineconf);
|
68 |
-
};
|
69 |
-
|
70 |
-
return json;
|
71 |
-
}
|
72 |
-
|
73 |
-
/* new button handler */
|
74 |
-
$('.caldera_forms_form').on('click','.cf-form-trigger', function( ev ){
|
75 |
-
var clicked = $(this);
|
76 |
-
form = clicked.closest('form.caldera_forms_form'),
|
77 |
-
form_id = form.prop('id'),
|
78 |
-
calderaforms = window[ form_id ],
|
79 |
-
data = form.formJSON(),
|
80 |
-
fields = {},
|
81 |
-
target = clicked.data('target');
|
82 |
-
|
83 |
-
for( var field in calderaforms ){
|
84 |
-
fields[ calderaforms[ field ].slug ] = data[ field ];
|
85 |
-
}
|
86 |
-
|
87 |
-
// check target
|
88 |
-
if( typeof window[ target ] === 'function' ){
|
89 |
-
window[ target ]( fields, ev );
|
90 |
-
}else{
|
91 |
-
|
92 |
-
try {
|
93 |
-
var elements = $( target );
|
94 |
-
} catch (err) {}
|
95 |
-
|
96 |
-
if( elements && elements.length ){
|
97 |
-
fields = JSON.stringify( fields ); // make into string
|
98 |
-
var inputTypes = ['textarea','text','hidden'];
|
99 |
-
elements.each( function(k,v){
|
100 |
-
if( this.type && inputTypes.indexOf( this.type ) >= 0 ){
|
101 |
-
// form fields
|
102 |
-
$(this).val( fields ).trigger('change');
|
103 |
-
}else{
|
104 |
-
this.innerHTML = fields;
|
105 |
-
}
|
106 |
-
});
|
107 |
-
}else{
|
108 |
-
// assume a URL
|
109 |
-
$.post( target, fields );
|
110 |
-
}
|
111 |
-
}
|
112 |
-
});
|
113 |
-
|
114 |
-
/* setup modals system */
|
115 |
-
if( cfModals ){
|
116 |
-
|
117 |
-
var head = $('head'),
|
118 |
-
body = $('body');
|
119 |
-
|
120 |
-
for( var style in cfModals.style ){
|
121 |
-
if( ! $('#cf-' + style + '-styles-css').length ){
|
122 |
-
head.append('<link id="cf-' + style + '-styles-css" rel="stylesheet" type="text/css" href="' + cfModals.style[ style ] + '">');
|
123 |
-
}
|
124 |
-
}
|
125 |
-
|
126 |
-
for( var script in cfModals.script ){
|
127 |
-
if( ! $('script[src^="' + cfModals.script[ script ] + '"]').length && null !== cfModals.script[ script ] ){
|
128 |
-
body.append('<script src="' + cfModals.script[ script ] + '" type="text/javascript">');
|
129 |
-
}
|
130 |
-
}
|
131 |
-
|
132 |
-
$( document ).on( 'click', '.caldera-forms-modal', function(){
|
133 |
-
var trigger = $( this );
|
134 |
-
if( !trigger.data('form') ){return;}
|
135 |
-
var backdrop = $('<div class="caldera-grid cf_processing caldera-backdrop" style="background-color:rgba(0, 0, 0, 0.3);"></div>');
|
136 |
-
$(body).append( backdrop );
|
137 |
-
var url = '/cf-api/' + trigger.data('form') + '/';
|
138 |
-
if( trigger.data('entry') ){
|
139 |
-
url += trigger.data('entry') + '/';
|
140 |
-
}
|
141 |
-
$.get( url, function(res){
|
142 |
-
backdrop.remove();
|
143 |
-
var modal = trigger.calderaModal({
|
144 |
-
modal : trigger.data('form'),
|
145 |
-
width: trigger.data('width'),
|
146 |
-
content : res
|
147 |
-
});
|
148 |
-
var modalWrapper = $('#' + trigger.data('form') + '_calderaModalContent');
|
149 |
-
var modalTitle = $('#' + trigger.data('form') + '_calderaModalTitle');
|
150 |
-
var modalFooter = $('#' + trigger.data('form') + '_calderaModalFooter');
|
151 |
-
modal.config.width = trigger.data('width') ? trigger.data('width') : 500;
|
152 |
-
modal.resize();
|
153 |
-
modalWrapper.html( res );
|
154 |
-
modal.resize();
|
155 |
-
resBaldrickTriggers();
|
156 |
-
|
157 |
-
$(document).on('cf.remove cf.add cf.submission cf.pagenav cf.error', function(){
|
158 |
-
if( trigger.data('height') ){
|
159 |
-
modal.config.height = trigger.data('height')
|
160 |
-
}else{
|
161 |
-
modal.config.height = modalWrapper.outerHeight() + modal.config.padding + 12;
|
162 |
-
if( modalTitle.length ){
|
163 |
-
modal.config.height += modalTitle.outerHeight();
|
164 |
-
}
|
165 |
-
if( modalFooter.length ){
|
166 |
-
modal.config.height += modalFooter.outerHeight();
|
167 |
-
}
|
168 |
-
}
|
169 |
-
modal.resize();
|
170 |
-
});
|
171 |
-
$(document).trigger('cf.modal');
|
172 |
-
} );
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
});
|
177 |
-
|
178 |
-
}
|
179 |
-
|
180 |
-
})(jQuery);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/js/formobject.js
CHANGED
@@ -45,9 +45,7 @@ $.fn.formJSON = function(){
|
|
45 |
try {
|
46 |
value = JSON.parse( value );
|
47 |
|
48 |
-
} catch (e) {
|
49 |
-
//console.log( e );
|
50 |
-
}
|
51 |
}else if( typeof value === 'object' && value.length && field.is('select') ){
|
52 |
var new_val = {};
|
53 |
for( var i = 0; i < value.length; i++ ){
|
45 |
try {
|
46 |
value = JSON.parse( value );
|
47 |
|
48 |
+
} catch (e) {}
|
|
|
|
|
49 |
}else if( typeof value === 'object' && value.length && field.is('select') ){
|
50 |
var new_val = {};
|
51 |
for( var i = 0; i < value.length; i++ ){
|
assets/js/frontend-script-init.js
CHANGED
@@ -1,6 +1,21 @@
|
|
1 |
-
var cf_jsfields_init;
|
2 |
(function($){
|
3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
// init sync
|
5 |
$('[data-sync]').each( function(){
|
6 |
var field = $( this ),
|
@@ -61,10 +76,7 @@ var cf_jsfields_init;
|
|
61 |
setTimeout( function(){$(document).trigger('cf.error');}, 15 );
|
62 |
});
|
63 |
if( typeof resBaldrickTriggers === 'undefined' && $('.caldera_forms_form').length ){
|
64 |
-
|
65 |
-
errorsWrapper : '<span class="help-block caldera_ajax_error_block"></span>',
|
66 |
-
errorTemplate : '<span></span>'
|
67 |
-
});
|
68 |
}
|
69 |
|
70 |
};
|
@@ -103,8 +115,10 @@ var cf_jsfields_init;
|
|
103 |
var clicked = $(this),
|
104 |
page_box = clicked.closest('.caldera-form-page'),
|
105 |
form = clicked.closest('form.caldera_forms_form'),
|
|
|
|
|
106 |
page = page_box.data('formpage') ? page_box.data('formpage') : clicked.data('page') ,
|
107 |
-
breadcrumb = $('.breadcrumb[data-form="' +
|
108 |
next,
|
109 |
prev,
|
110 |
fields,
|
@@ -113,12 +127,15 @@ var cf_jsfields_init;
|
|
113 |
if( !form.length ){
|
114 |
return;
|
115 |
}
|
|
|
|
|
|
|
|
|
|
|
116 |
|
117 |
-
fields = form.find('[data-field]');
|
118 |
|
119 |
-
|
120 |
|
121 |
-
if( clicked.data('page') !== 'prev' ){
|
122 |
for(var f = 0; f < fields.length; f++){
|
123 |
var this_field = $(fields[f]);
|
124 |
if( this_field.is(':radio,:checkbox') ){
|
@@ -130,14 +147,14 @@ var cf_jsfields_init;
|
|
130 |
}else{
|
131 |
if( this_field.prop('required') && false === this_field.is(':visible') ){ continue }
|
132 |
if( this_field.prop('required') ){
|
133 |
-
|
134 |
if( true !== this_field.parsley().isValid() ){
|
135 |
// ye nope!
|
136 |
if( this_field.is(":visible") ){
|
137 |
// on this page.
|
138 |
this_field.parsley().validate();
|
139 |
e.preventDefault();
|
140 |
-
return;
|
141 |
}else{
|
142 |
// not on this page
|
143 |
//get page and highlight if lower than this one (aka backwards not forwards)
|
@@ -153,48 +170,53 @@ var cf_jsfields_init;
|
|
153 |
}
|
154 |
}
|
155 |
|
156 |
-
|
157 |
for( var ch in checks ){
|
158 |
if( checks[ch].indexOf(true) < 0){
|
159 |
-
$('[for="' + ch + '"]').parent().addClass('has-error');
|
160 |
-
|
161 |
}else{
|
162 |
-
$('[for="' + ch + '"]').parent().removeClass('has-error');
|
163 |
}
|
164 |
}
|
165 |
|
|
|
|
|
|
|
|
|
166 |
|
167 |
if(clicked.data('page') === 'next'){
|
|
|
168 |
if(breadcrumb){
|
169 |
-
breadcrumb.find('li.active').removeClass('active');
|
170 |
}
|
171 |
next = form.find('.caldera-form-page[data-formpage="'+ ( page + 1 ) +'"]');
|
172 |
if(next.length){
|
173 |
-
page_box.hide();
|
174 |
-
next.show();
|
175 |
if(breadcrumb){
|
176 |
-
breadcrumb.find('a[data-page="'+ ( page + 1 ) +'"]').parent().addClass('active');
|
177 |
}
|
178 |
}
|
179 |
}else if(clicked.data('page') === 'prev'){
|
180 |
if(breadcrumb){
|
181 |
-
breadcrumb.find('li.active').removeClass('active');
|
182 |
}
|
183 |
prev = form.find('.caldera-form-page[data-formpage="'+ ( page - 1 ) +'"]');
|
184 |
if(prev.length){
|
185 |
-
page_box.hide();
|
186 |
-
prev.show();
|
187 |
if(breadcrumb){
|
188 |
-
breadcrumb.find('a[data-page="'+ ( page - 1 ) +'"]').parent().addClass('active');
|
189 |
}
|
190 |
}
|
191 |
}else{
|
192 |
if(clicked.data('pagenav')){
|
193 |
e.preventDefault();
|
194 |
-
clicked.closest('.breadcrumb').find('li.active').removeClass('active');
|
195 |
-
$('#' + clicked.data('pagenav') + ' .caldera-form-page').hide();
|
196 |
-
$('#' + clicked.data('pagenav') + ' .caldera-form-page[data-formpage="'+ ( clicked.data('page') ) +'"]').show();
|
197 |
-
clicked.parent().addClass('active');
|
198 |
}
|
199 |
|
200 |
}
|
@@ -226,6 +248,19 @@ var cf_jsfields_init;
|
|
226 |
});
|
227 |
// trigger last page
|
228 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
229 |
|
230 |
|
231 |
})(jQuery);
|
1 |
+
var cf_jsfields_init, cf_validate_form;
|
2 |
(function($){
|
3 |
|
4 |
+
// validation
|
5 |
+
cf_validate_form = function( form ){
|
6 |
+
return form.parsley({
|
7 |
+
errorsWrapper : '<span class="help-block caldera_ajax_error_block"></span>',
|
8 |
+
errorTemplate : '<span></span>',
|
9 |
+
errorsContainer : function( field ){
|
10 |
+
return field.$element.closest('.form-group');
|
11 |
+
}
|
12 |
+
}).on('field:error', function() {
|
13 |
+
this.$element.closest('.form-group').addClass('has-error');
|
14 |
+
}).on('field:success', function() {
|
15 |
+
this.$element.closest('.form-group').removeClass('has-error');
|
16 |
+
});
|
17 |
+
}
|
18 |
+
|
19 |
// init sync
|
20 |
$('[data-sync]').each( function(){
|
21 |
var field = $( this ),
|
76 |
setTimeout( function(){$(document).trigger('cf.error');}, 15 );
|
77 |
});
|
78 |
if( typeof resBaldrickTriggers === 'undefined' && $('.caldera_forms_form').length ){
|
79 |
+
|
|
|
|
|
|
|
80 |
}
|
81 |
|
82 |
};
|
115 |
var clicked = $(this),
|
116 |
page_box = clicked.closest('.caldera-form-page'),
|
117 |
form = clicked.closest('form.caldera_forms_form'),
|
118 |
+
instance = form.data('instance'),
|
119 |
+
current_page = form.find('.caldera-form-page:visible').data('formpage'),
|
120 |
page = page_box.data('formpage') ? page_box.data('formpage') : clicked.data('page') ,
|
121 |
+
breadcrumb = $('.breadcrumb[data-form="caldera_form_' + instance + '"]'),
|
122 |
next,
|
123 |
prev,
|
124 |
fields,
|
127 |
if( !form.length ){
|
128 |
return;
|
129 |
}
|
130 |
+
|
131 |
+
cf_validate_form( form ).destroy();
|
132 |
+
|
133 |
+
fields = form.find('[data-field]');
|
134 |
+
form.find('.has-error').removeClass('has-error');
|
135 |
|
|
|
136 |
|
137 |
+
if( clicked.data('page') !== 'prev' && page >= current_page ){
|
138 |
|
|
|
139 |
for(var f = 0; f < fields.length; f++){
|
140 |
var this_field = $(fields[f]);
|
141 |
if( this_field.is(':radio,:checkbox') ){
|
147 |
}else{
|
148 |
if( this_field.prop('required') && false === this_field.is(':visible') ){ continue }
|
149 |
if( this_field.prop('required') ){
|
150 |
+
|
151 |
if( true !== this_field.parsley().isValid() ){
|
152 |
// ye nope!
|
153 |
if( this_field.is(":visible") ){
|
154 |
// on this page.
|
155 |
this_field.parsley().validate();
|
156 |
e.preventDefault();
|
157 |
+
//return;
|
158 |
}else{
|
159 |
// not on this page
|
160 |
//get page and highlight if lower than this one (aka backwards not forwards)
|
170 |
}
|
171 |
}
|
172 |
|
173 |
+
|
174 |
for( var ch in checks ){
|
175 |
if( checks[ch].indexOf(true) < 0){
|
176 |
+
$('[for="' + ch + '_' + instance + '"]').parent().addClass('has-error');
|
177 |
+
run = false;
|
178 |
}else{
|
179 |
+
$('[for="' + ch + '_' + instance + '"]').parent().removeClass('has-error');
|
180 |
}
|
181 |
}
|
182 |
|
183 |
+
if( false === run ){
|
184 |
+
cf_validate_form( form ).validate();
|
185 |
+
return false;
|
186 |
+
}
|
187 |
|
188 |
if(clicked.data('page') === 'next'){
|
189 |
+
|
190 |
if(breadcrumb){
|
191 |
+
breadcrumb.find('li.active').removeClass('active').children().attr('aria-expanded', 'false');
|
192 |
}
|
193 |
next = form.find('.caldera-form-page[data-formpage="'+ ( page + 1 ) +'"]');
|
194 |
if(next.length){
|
195 |
+
page_box.hide().attr( 'aria-hidden', 'true' ).css( 'visibility', 'hidden' );
|
196 |
+
next.show().attr( 'aria-hidden', 'false' ).css( 'visibility', 'visible' );
|
197 |
if(breadcrumb){
|
198 |
+
breadcrumb.find('a[data-page="'+ ( page + 1 ) +'"]').attr('aria-expanded', 'true').parent().addClass('active');
|
199 |
}
|
200 |
}
|
201 |
}else if(clicked.data('page') === 'prev'){
|
202 |
if(breadcrumb){
|
203 |
+
breadcrumb.find('li.active').removeClass('active').children().attr('aria-expanded', 'false');
|
204 |
}
|
205 |
prev = form.find('.caldera-form-page[data-formpage="'+ ( page - 1 ) +'"]');
|
206 |
if(prev.length){
|
207 |
+
page_box.hide().attr( 'aria-hidden', 'true' ).css( 'visibility', 'hidden' );
|
208 |
+
prev.show().attr( 'aria-hidden', 'false' ).css( 'visibility', 'visible' );
|
209 |
if(breadcrumb){
|
210 |
+
breadcrumb.find('a[data-page="'+ ( page - 1 ) +'"]').attr('aria-expanded', 'true').parent().addClass('active');
|
211 |
}
|
212 |
}
|
213 |
}else{
|
214 |
if(clicked.data('pagenav')){
|
215 |
e.preventDefault();
|
216 |
+
clicked.closest('.breadcrumb').find('li.active').removeClass('active').children().attr('aria-expanded', 'false');
|
217 |
+
$('#' + clicked.data('pagenav') + ' .caldera-form-page').hide().attr( 'aria-hidden', 'true' ).css( 'visibility', 'hidden' );
|
218 |
+
$('#' + clicked.data('pagenav') + ' .caldera-form-page[data-formpage="'+ ( clicked.data('page') ) +'"]').show().attr( 'aria-hidden', 'false' ).css( 'visibility', 'visible' );
|
219 |
+
clicked.parent().addClass('active').children().attr('aria-expanded', 'true');
|
220 |
}
|
221 |
|
222 |
}
|
248 |
});
|
249 |
// trigger last page
|
250 |
|
251 |
+
// validator
|
252 |
+
$( document ).on('click', 'form.caldera_forms_form [type="submit"]', function( e ){
|
253 |
+
var clicked = $( this ),
|
254 |
+
form = clicked.closest('.caldera_forms_form'),
|
255 |
+
validator = cf_validate_form( form );
|
256 |
+
|
257 |
+
if( !validator.validate() ){
|
258 |
+
e.preventDefault();
|
259 |
+
}else{
|
260 |
+
validator.destroy();
|
261 |
+
}
|
262 |
+
});
|
263 |
+
|
264 |
|
265 |
|
266 |
})(jQuery);
|
assets/js/frontend-script-init.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
var cf_jsfields_init;!function(a){a("[data-sync]").each(function(){for(var e=a(this),r=e.data("binds"),t=e.closest("form"),
|
1 |
+
var cf_jsfields_init,cf_validate_form;!function(a){cf_validate_form=function(a){return a.parsley({errorsWrapper:'<span class="help-block caldera_ajax_error_block"></span>',errorTemplate:"<span></span>",errorsContainer:function(a){return a.$element.closest(".form-group")}}).on("field:error",function(){this.$element.closest(".form-group").addClass("has-error")}).on("field:success",function(){this.$element.closest(".form-group").removeClass("has-error")})},a("[data-sync]").each(function(){for(var e=a(this),r=e.data("binds"),t=e.closest("form"),i=0;i<r.length;i++)a(document).on("keyup change blur mouseover","[data-field='"+r[i]+"']",function(){var r=e.data("sync");if(id=a(this).data("field"),reg=new RegExp("{{([^}]*?)}}","g"),template=r.match(reg),!e.data("unsync")){for(var i=0;i<template.length;i++){for(var d=template[i].replace(/\}/g,"").replace(/\{/g,""),n=new RegExp(template[i],"g"),o=t.find("[data-field='"+d+"']"),s="",l=0;l<o.length;l++){var f=a(o[l]);(!f.is(":radio")&&!f.is(":checkbox")||f.is(":checked"))&&(s+=f.val())}r=r.replace(n,s)}e.val(r)}}),a("[data-field='"+r[i]+"']").trigger("change")}),a(document).on("change keypress","[data-sync]",function(){a(this).data("unsync",!0)}),cf_jsfields_init=function(){a(".init_field_type[data-type]").each(function(e,r){var t=a(r);"function"==typeof window[t.data("type")+"_init"]&&window[t.data("type")+"_init"](t.prop("id"),t[0])}),"undefined"!=typeof cfValidatorLocal&&window.Parsley.setLocale(cfValidatorLocal),"undefined"!=typeof cfModals&&"undefined"!=typeof cfModals.config&&"undefined"!=typeof cfModals.config.validator_lang&&window.Parsley.setLocale(cfModals.config.validator_lang),window.Parsley.on("field:validated",function(){setTimeout(function(){a(document).trigger("cf.error")},15)}),"undefined"==typeof resBaldrickTriggers&&a(".caldera_forms_form").length},a("document").ready(function(){cf_jsfields_init()}),a(".caldera-form-page").length&&a(".caldera-form-page").on("keypress","[data-field]:not(textarea)",function(a){13===a.keyCode&&a.preventDefault()}),a(document).on("click",".cf_modal_button",function(e){e.preventDefault();var r=a(this);a(r.attr("href")).show()}),a(document).on("click",".caldera-front-modal-closer",function(e){e.preventDefault();var r=a(this);r.closest(".caldera-front-modal-container").hide()}),a(document).on("cf.add cf.enable cf.disable cf.pagenav",cf_jsfields_init),a(document).on("click","[data-page]",function(e){var r,t,i,d=a(this),n=d.closest(".caldera-form-page"),o=d.closest("form.caldera_forms_form"),s=o.data("instance"),l=o.find(".caldera-form-page:visible").data("formpage"),f=n.data("formpage")?n.data("formpage"):d.data("page"),c=a('.breadcrumb[data-form="caldera_form_'+s+'"]'),p=!0,g={};if(o.length){if(cf_validate_form(o).destroy(),i=o.find("[data-field]"),o.find(".has-error").removeClass("has-error"),"prev"!==d.data("page")&&f>=l)for(var m=0;m<i.length;m++){var u=a(i[m]);if(u.is(":radio,:checkbox")){if(!u.hasClass("option-required")||!1===u.is(":visible"))continue;g[u.data("field")]||(g[u.data("field")]=[]),g[u.data("field")].push(u.prop("checked"))}else{if(u.prop("required")&&!1===u.is(":visible"))continue;if(u.prop("required")&&!0!==u.parsley().isValid()){if(u.is(":visible"))u.parsley().validate(),e.preventDefault();else{var v=parseFloat(u.closest(".caldera-form-page[data-formpage]").data("formpage"));v<parseFloat(f)&&o.find('[data-page="'+v+'"]').addClass("has-error")}p=!1}}}for(var h in g)g[h].indexOf(!0)<0?(a('[for="'+h+"_"+s+'"]').parent().addClass("has-error"),p=!1):a('[for="'+h+"_"+s+'"]').parent().removeClass("has-error");if(!1===p)return cf_validate_form(o).validate(),!1;"next"===d.data("page")?(c&&c.find("li.active").removeClass("active").children().attr("aria-expanded","false"),r=o.find('.caldera-form-page[data-formpage="'+(f+1)+'"]'),r.length&&(n.hide().attr("aria-hidden","true").css("visibility","hidden"),r.show().attr("aria-hidden","false").css("visibility","visible"),c&&c.find('a[data-page="'+(f+1)+'"]').attr("aria-expanded","true").parent().addClass("active"))):"prev"===d.data("page")?(c&&c.find("li.active").removeClass("active").children().attr("aria-expanded","false"),t=o.find('.caldera-form-page[data-formpage="'+(f-1)+'"]'),t.length&&(n.hide().attr("aria-hidden","true").css("visibility","hidden"),t.show().attr("aria-hidden","false").css("visibility","visible"),c&&c.find('a[data-page="'+(f-1)+'"]').attr("aria-expanded","true").parent().addClass("active"))):d.data("pagenav")&&(e.preventDefault(),d.closest(".breadcrumb").find("li.active").removeClass("active").children().attr("aria-expanded","false"),a("#"+d.data("pagenav")+" .caldera-form-page").hide().attr("aria-hidden","true").css("visibility","hidden"),a("#"+d.data("pagenav")+' .caldera-form-page[data-formpage="'+d.data("page")+'"]').show().attr("aria-hidden","false").css("visibility","visible"),d.parent().addClass("active").children().attr("aria-expanded","true")),a("html, body").animate({scrollTop:o.offset().top-100},200),a(document).trigger("cf.pagenav")}});var e;a(".caldera-grid .breadcrumb").each(function(r,t){a(t).find("a[data-pagenav]").each(function(r,t){var i=a(t),d=i.data("pagenav"),n=a("#"+d+' .caldera-form-page[data-formpage="'+i.data("page")+'"]');n.find(".has-error").length&&(i.parent().addClass("error"),"undefined"==typeof e&&(i.trigger("click"),e=!0))})}),a(document).on("click",'form.caldera_forms_form [type="submit"]',function(e){var r=a(this),t=r.closest(".caldera_forms_form"),i=cf_validate_form(t);i.validate()?i.destroy():e.preventDefault()})}(jQuery);
|
assets/js/handlebars.baldrick.js
CHANGED
@@ -30,7 +30,7 @@
|
|
30 |
if(templates.length){
|
31 |
templates.each(function(){
|
32 |
var trigger = $(this);
|
33 |
-
|
34 |
if(typeof compiledTemplates[trigger.data('templateUrl')] === 'undefined'){
|
35 |
compiledTemplates[trigger.data('templateUrl')] = true;
|
36 |
|
30 |
if(templates.length){
|
31 |
templates.each(function(){
|
32 |
var trigger = $(this);
|
33 |
+
|
34 |
if(typeof compiledTemplates[trigger.data('templateUrl')] === 'undefined'){
|
35 |
compiledTemplates[trigger.data('templateUrl')] = true;
|
36 |
|
assets/js/jquery.baldrick.js
CHANGED
@@ -283,7 +283,7 @@
|
|
283 |
|
284 |
params = do_helper('params', params);
|
285 |
if(params === false){return false;}
|
286 |
-
|
287 |
// check if request is a function
|
288 |
e.preventDefault();
|
289 |
if(typeof window[params.url] === 'function'){
|
283 |
|
284 |
params = do_helper('params', params);
|
285 |
if(params === false){return false;}
|
286 |
+
|
287 |
// check if request is a function
|
288 |
e.preventDefault();
|
289 |
if(typeof window[params.url] === 'function'){
|
assets/js/jquery.baldrick.min.js
CHANGED
File without changes
|
assets/js/shortcode-insert.js
CHANGED
File without changes
|
assets/js/shortcode-insert.min.js
CHANGED
File without changes
|
assets/js/support-page.js
CHANGED
@@ -10,7 +10,7 @@ jQuery( document ).ready( function ( $ ) {
|
|
10 |
};
|
11 |
|
12 |
function updateActive( tab ){
|
13 |
-
$(".caldera-forms-toolbar-
|
14 |
$( '#support-nav-' + tab ).addClass( 'active' );
|
15 |
};
|
16 |
|
10 |
};
|
11 |
|
12 |
function updateActive( tab ){
|
13 |
+
$(".caldera-forms-toolbar-link:not(#support-nav-" + tab + ")" ).removeClass( 'active' );
|
14 |
$( '#support-nav-' + tab ).addClass( 'active' );
|
15 |
};
|
16 |
|
assets/js/wp-baldrick-full.js
CHANGED
@@ -4632,7 +4632,12 @@ var handlebarsVariables = {};
|
|
4632 |
footer = modal.find('.baldrick-modal-footer'),
|
4633 |
title = modal.find('.baldrick-modal-title'),
|
4634 |
current_size = '';
|
4635 |
-
|
|
|
|
|
|
|
|
|
|
|
4636 |
if( modalHeight === 'auto' ){
|
4637 |
body.css( 'position', 'initial' );
|
4638 |
modalHeight = body.outerHeight() + footer.outerHeight() + title.outerHeight();
|
4632 |
footer = modal.find('.baldrick-modal-footer'),
|
4633 |
title = modal.find('.baldrick-modal-title'),
|
4634 |
current_size = '';
|
4635 |
+
if( typeof modalWidth === 'string' && modalWidth.indexOf('%') > -1 ){
|
4636 |
+
modalWidth = parseFloat( modalWidth ) / 100 * windowWidth;
|
4637 |
+
}
|
4638 |
+
if( typeof modalHeight === 'string' && modalHeight.indexOf('%') > -1 ){
|
4639 |
+
modalHeight = parseFloat( modalHeight ) / 100 * windowHeight;
|
4640 |
+
}
|
4641 |
if( modalHeight === 'auto' ){
|
4642 |
body.css( 'position', 'initial' );
|
4643 |
modalHeight = body.outerHeight() + footer.outerHeight() + title.outerHeight();
|
caldera-core.php
CHANGED
@@ -3,11 +3,11 @@
|
|
3 |
Plugin Name: Caldera Forms
|
4 |
Plugin URI: https://calderawp.com/caldera-forms/
|
5 |
Description: Easy to use, grid based responsive form builder for creating simple to complex forms.
|
6 |
-
Author: David Cramer
|
7 |
-
Version: 1.
|
8 |
Author URI: https://calderawp.com
|
9 |
Text Domain: caldera-forms
|
10 |
-
GitHub Plugin URI: https://github.com/
|
11 |
GitHub Branch: current-stable
|
12 |
*/
|
13 |
|
@@ -20,7 +20,7 @@ if ( ! defined( 'WPINC' ) ) {
|
|
20 |
|
21 |
define('CFCORE_PATH', plugin_dir_path(__FILE__));
|
22 |
define('CFCORE_URL', plugin_dir_url(__FILE__));
|
23 |
-
define('CFCORE_VER', '1.
|
24 |
define('CFCORE_EXTEND_URL', 'https://api.calderaforms.com/1.0/');
|
25 |
define('CFCORE_BASENAME', plugin_basename( __FILE__ ));
|
26 |
|
@@ -31,7 +31,7 @@ define('CFCORE_BASENAME', plugin_basename( __FILE__ ));
|
|
31 |
*
|
32 |
* PLEASE keep this an integer
|
33 |
*/
|
34 |
-
define( 'CF_DB',
|
35 |
|
36 |
// init internals of CF
|
37 |
include_once CFCORE_PATH . 'classes/core.php'; // neeeds the core at the very least before plugins loaded
|
@@ -46,6 +46,8 @@ function caldera_forms_load(){
|
|
46 |
include_once CFCORE_PATH . 'classes/autoloader.php';
|
47 |
include_once CFCORE_PATH . 'classes/widget.php';
|
48 |
Caldera_Forms_Autoloader::add_root( 'Caldera_Forms_DB', CFCORE_PATH . 'classes/db' );
|
|
|
|
|
49 |
Caldera_Forms_Autoloader::add_root( 'Caldera_Forms_Processor_Interface', CFCORE_PATH . 'processors/classes/interfaces' );
|
50 |
Caldera_Forms_Autoloader::add_root( 'Caldera_Forms_Processor', CFCORE_PATH . 'processors/classes' );
|
51 |
|
@@ -61,9 +63,9 @@ function caldera_forms_load(){
|
|
61 |
include_once CFCORE_PATH . 'processors/functions.php';
|
62 |
|
63 |
/**
|
64 |
-
* Runs after all of the includes and
|
65 |
*
|
66 |
-
* @since 1.3.
|
67 |
*/
|
68 |
do_action( 'caldera_forms_includes_complete' );
|
69 |
|
@@ -78,4 +80,3 @@ if ( is_admin() || defined( 'DOING_AJAX' ) ) {
|
|
78 |
add_action( 'plugins_loaded', array( 'Caldera_Forms_Admin', 'get_instance' ) );
|
79 |
add_action( 'plugins_loaded', array( 'Caldera_Forms_Support', 'get_instance' ) );
|
80 |
}
|
81 |
-
|
3 |
Plugin Name: Caldera Forms
|
4 |
Plugin URI: https://calderawp.com/caldera-forms/
|
5 |
Description: Easy to use, grid based responsive form builder for creating simple to complex forms.
|
6 |
+
Author: David Cramer for CalderaWP LLC
|
7 |
+
Version: 1.4.0
|
8 |
Author URI: https://calderawp.com
|
9 |
Text Domain: caldera-forms
|
10 |
+
GitHub Plugin URI: https://github.com/CalderaWP/Caldera-Forms/
|
11 |
GitHub Branch: current-stable
|
12 |
*/
|
13 |
|
20 |
|
21 |
define('CFCORE_PATH', plugin_dir_path(__FILE__));
|
22 |
define('CFCORE_URL', plugin_dir_url(__FILE__));
|
23 |
+
define('CFCORE_VER', '1.4.0');
|
24 |
define('CFCORE_EXTEND_URL', 'https://api.calderaforms.com/1.0/');
|
25 |
define('CFCORE_BASENAME', plugin_basename( __FILE__ ));
|
26 |
|
31 |
*
|
32 |
* PLEASE keep this an integer
|
33 |
*/
|
34 |
+
define( 'CF_DB', 4 );
|
35 |
|
36 |
// init internals of CF
|
37 |
include_once CFCORE_PATH . 'classes/core.php'; // neeeds the core at the very least before plugins loaded
|
46 |
include_once CFCORE_PATH . 'classes/autoloader.php';
|
47 |
include_once CFCORE_PATH . 'classes/widget.php';
|
48 |
Caldera_Forms_Autoloader::add_root( 'Caldera_Forms_DB', CFCORE_PATH . 'classes/db' );
|
49 |
+
Caldera_Forms_Autoloader::add_root( 'Caldera_Forms_Entry', CFCORE_PATH . 'classes/entry' );
|
50 |
+
Caldera_Forms_Autoloader::add_root( 'Caldera_Forms_Email', CFCORE_PATH . 'classes/email' );
|
51 |
Caldera_Forms_Autoloader::add_root( 'Caldera_Forms_Processor_Interface', CFCORE_PATH . 'processors/classes/interfaces' );
|
52 |
Caldera_Forms_Autoloader::add_root( 'Caldera_Forms_Processor', CFCORE_PATH . 'processors/classes' );
|
53 |
|
63 |
include_once CFCORE_PATH . 'processors/functions.php';
|
64 |
|
65 |
/**
|
66 |
+
* Runs after all of the includes and autoload setup is done in Caldera Forms core
|
67 |
*
|
68 |
+
* @since 1.3.5.3
|
69 |
*/
|
70 |
do_action( 'caldera_forms_includes_complete' );
|
71 |
|
80 |
add_action( 'plugins_loaded', array( 'Caldera_Forms_Admin', 'get_instance' ) );
|
81 |
add_action( 'plugins_loaded', array( 'Caldera_Forms_Support', 'get_instance' ) );
|
82 |
}
|
|
classes/admin.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* @package Caldera_Forms
|
6 |
* @author David <david@digilab.co.za>
|
7 |
* @license GPL-2.0+
|
8 |
-
* @link
|
9 |
* @copyright 2014 David Cramer
|
10 |
*/
|
11 |
|
@@ -69,15 +69,15 @@ class Caldera_Forms_Admin {
|
|
69 |
|
70 |
// Add Admin menu page
|
71 |
add_action( 'admin_menu', array( $this, 'register_admin_page' ), 9 );
|
72 |
-
|
73 |
// Add admin scritps and styles
|
74 |
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_stylescripts' ) );
|
75 |
-
|
76 |
// add element & fields filters
|
77 |
add_filter('caldera_forms_get_panel_extensions', array( $this, 'get_panel_extensions'), 1);
|
78 |
add_filter('caldera_forms_entry_viewer_buttons', array( $this, 'set_viewer_buttons'),10, 4);
|
79 |
add_filter('caldera_forms_entry_editor_buttons', array( $this, 'set_editor_buttons'),10, 4);
|
80 |
-
|
81 |
// action
|
82 |
add_action('caldera_forms_entry_actions', array( $this, 'get_entry_actions'),1);
|
83 |
add_action('caldera_forms_admin_templates', array( $this, 'get_admin_templates'),1);
|
@@ -87,6 +87,8 @@ class Caldera_Forms_Admin {
|
|
87 |
add_action( 'media_buttons', array($this, 'shortcode_insert_button' ), 11 );
|
88 |
add_filter( 'wp_fullscreen_buttons', array($this, 'shortcode_insert_button_fs' ), 11 );
|
89 |
|
|
|
|
|
90 |
|
91 |
if( current_user_can( Caldera_Forms::get_manage_cap( 'create' ) ) ){
|
92 |
// create forms
|
@@ -95,13 +97,12 @@ class Caldera_Forms_Admin {
|
|
95 |
|
96 |
if( current_user_can( Caldera_Forms::get_manage_cap( 'admin' ) ) ) {
|
97 |
add_action( "wp_ajax_toggle_form_state", array( $this, 'toggle_form_state' ) );
|
98 |
-
add_action( "wp_ajax_browse_entries", array( $this, 'browse_entries' ) );
|
99 |
add_action( "wp_ajax_save_cf_setting", array( $this, 'save_cf_setting' ) );
|
100 |
add_action( "wp_ajax_cf_dismiss_pointer", array( $this, 'update_pointer' ) );
|
101 |
add_action( "wp_ajax_cf_bulk_action", array( $this, 'bulk_action' ) );
|
102 |
}
|
103 |
add_action("wp_ajax_cf_get_form_preview", array( $this, 'get_form_preview') );
|
104 |
-
|
105 |
add_action( 'caldera_forms_admin_footer', array( $this, 'admin_alerts' ) );
|
106 |
add_action( 'admin_footer', array( $this, 'add_shortcode_inserter'));
|
107 |
|
@@ -111,16 +112,22 @@ class Caldera_Forms_Admin {
|
|
111 |
|
112 |
add_action('admin_footer-edit.php', array( $this, 'render_editor_template')); // Fired on the page with the posts table
|
113 |
add_action('admin_footer-post.php', array( $this, 'render_editor_template')); // Fired on post edit page
|
114 |
-
add_action('admin_footer-post-new.php', array( $this, 'render_editor_template')); // Fired on add new post page
|
115 |
|
116 |
add_action( 'caldera_forms_new_form_template_end', array( $this, 'load_new_form_templates') );
|
117 |
|
118 |
add_action( 'admin_init', array( $this, 'watch_tracking' ) );
|
119 |
|
|
|
|
|
|
|
|
|
|
|
|
|
120 |
/**
|
121 |
* Runs after Caldera Forms admin is initialized
|
122 |
*
|
123 |
-
* @since 1.3.
|
124 |
*/
|
125 |
do_action( 'caldera_forms_admin_init' );
|
126 |
|
@@ -129,19 +136,73 @@ class Caldera_Forms_Admin {
|
|
129 |
|
130 |
public function render_editor_template(){
|
131 |
?>
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
|
143 |
}
|
144 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
145 |
/**
|
146 |
* Returns the array of form templates.
|
147 |
*
|
@@ -150,19 +211,19 @@ class Caldera_Forms_Admin {
|
|
150 |
* @return array The form templates
|
151 |
*/
|
152 |
public static function internal_form_templates(){
|
153 |
-
|
154 |
$internal_templates = array(
|
155 |
-
'starter_contact_form'
|
156 |
-
'name'
|
157 |
-
'template'
|
158 |
),
|
159 |
-
'variable_price_example'
|
160 |
-
'name'
|
161 |
-
'template'
|
162 |
),
|
163 |
-
'registration'
|
164 |
-
'name'
|
165 |
-
'template'
|
166 |
),
|
167 |
|
168 |
);
|
@@ -177,37 +238,102 @@ class Caldera_Forms_Admin {
|
|
177 |
return apply_filters( 'caldera_forms_get_form_templates', $internal_templates );
|
178 |
|
179 |
}
|
180 |
-
|
181 |
public function load_new_form_templates(){
|
182 |
|
183 |
$form_templates = self::internal_form_templates();
|
184 |
|
185 |
?>
|
186 |
-
<div class="
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
echo '<
|
196 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
197 |
}
|
|
|
198 |
|
199 |
-
|
200 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
201 |
</div>
|
202 |
</div>
|
203 |
<?php
|
204 |
}
|
205 |
|
206 |
-
/**
|
207 |
-
* Make the form preview in post editor
|
208 |
-
*
|
209 |
-
* @since unknown
|
210 |
-
*/
|
211 |
public function get_form_preview(){
|
212 |
global $post;
|
213 |
add_filter('caldera_forms_render_form_element', array( $this, 'set_preview_form_element') );
|
@@ -217,7 +343,7 @@ class Caldera_Forms_Admin {
|
|
217 |
}elseif( isset($_POST['atts']['named']['name']) ){
|
218 |
$form = $_POST['atts']['named']['name'];
|
219 |
}
|
220 |
-
|
221 |
add_filter('caldera_forms_get_form-' . $form, array( $this, 'set_preview_get_form'),100 );
|
222 |
|
223 |
$atts = $_POST['atts']['named'];
|
@@ -226,12 +352,7 @@ class Caldera_Forms_Admin {
|
|
226 |
if( !empty( $form ) ){
|
227 |
ob_start();
|
228 |
wp_head();
|
229 |
-
$
|
230 |
-
if( !empty( $_POST['content'] ) ){
|
231 |
-
$content = stripslashes_deep( $_POST['content'] );
|
232 |
-
}
|
233 |
-
echo Caldera_Forms::shortcode_handler( $atts, $content, 'caldera_form' );
|
234 |
-
echo '<div class="clear"></div>';
|
235 |
wp_print_footer_scripts();
|
236 |
$html = ob_get_clean();
|
237 |
}
|
@@ -239,10 +360,9 @@ class Caldera_Forms_Admin {
|
|
239 |
if( !empty( $html ) ){
|
240 |
$out['html'] = $html;
|
241 |
}
|
242 |
-
|
243 |
wp_send_json_success( $out );
|
244 |
}
|
245 |
-
|
246 |
public function set_preview_get_form( $form ){
|
247 |
$form['form_ajax'] = false;
|
248 |
$form['settings']['responsive']['break_point'] = 'xs';
|
@@ -263,7 +383,7 @@ class Caldera_Forms_Admin {
|
|
263 |
if( isset( $addon['slug'] ) ){
|
264 |
$plugins[$plugin_slug]['slug'] = $addon['slug'];
|
265 |
}
|
266 |
-
}
|
267 |
}
|
268 |
}
|
269 |
if( isset( $_REQUEST['plugin_status'] ) && $_REQUEST['plugin_status'] === 'caldera_forms' ){
|
@@ -282,7 +402,7 @@ class Caldera_Forms_Admin {
|
|
282 |
if(empty($_POST['do'])){
|
283 |
die;
|
284 |
}
|
285 |
-
|
286 |
$do_action = strtolower( $_POST['do'] );
|
287 |
|
288 |
switch ( $do_action ) {
|
@@ -291,41 +411,39 @@ class Caldera_Forms_Admin {
|
|
291 |
case 'delete':
|
292 |
global $wpdb;
|
293 |
|
294 |
-
|
295 |
$items = array();
|
296 |
$selectors = array();
|
297 |
-
foreach((array) $_POST['items'] as $item_id){
|
298 |
-
$items[]
|
299 |
$selectors[] = '#entry_row_' . (int) $item_id;
|
300 |
}
|
301 |
|
302 |
-
switch ($do_action) {
|
303 |
case 'delete':
|
304 |
if( current_user_can( 'delete_others_posts' ) ){
|
305 |
-
$result =
|
306 |
-
$result = $wpdb->query( "DELETE FROM `" . $wpdb->prefix . "cf_form_entry_values` WHERE `entry_id` IN (".implode(',', $items).");" );
|
307 |
-
$result = $wpdb->query( "DELETE FROM `" . $wpdb->prefix . "cf_form_entry_meta` WHERE `entry_id` IN (".implode(',', $items).");" );
|
308 |
}
|
309 |
$out['status'] = 'reload';
|
310 |
wp_send_json( $out );
|
311 |
break;
|
312 |
-
|
313 |
default:
|
314 |
if( current_user_can( 'edit_others_posts' ) ){
|
315 |
-
$result =
|
316 |
}
|
317 |
break;
|
318 |
}
|
319 |
-
|
320 |
-
if( $result ){
|
321 |
-
|
322 |
-
$out['status'] = $do_action;
|
323 |
-
$out['undo'] = ( $do_action === 'trash' ? 'active' : __('Trash') );
|
324 |
-
$out['undo_text'] = ( $do_action === 'trash' ? __('Restore', 'caldera-forms') : __('Trash') );
|
325 |
|
326 |
-
|
327 |
-
$out['
|
328 |
-
$out['
|
|
|
|
|
|
|
|
|
|
|
|
|
329 |
wp_send_json( $out );
|
330 |
}
|
331 |
exit();
|
@@ -334,7 +452,7 @@ class Caldera_Forms_Admin {
|
|
334 |
case 'export':
|
335 |
|
336 |
$transientid = uniqid('cfe');
|
337 |
-
set_transient( $transientid, $_POST['items'], 180 );
|
338 |
$out['url'] = "admin.php?page=caldera-forms&export=" . $_POST['form'] . "&tid=" . $transientid;
|
339 |
wp_send_json( $out );
|
340 |
exit();
|
@@ -343,14 +461,24 @@ class Caldera_Forms_Admin {
|
|
343 |
# code...
|
344 |
break;
|
345 |
}
|
346 |
-
exit();
|
347 |
}
|
348 |
|
349 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
350 |
public static function update_pointer(){
|
351 |
-
|
352 |
-
|
353 |
-
|
|
|
|
|
|
|
|
|
354 |
}
|
355 |
exit;
|
356 |
}
|
@@ -362,43 +490,48 @@ class Caldera_Forms_Admin {
|
|
362 |
public function load_plugin_textdomain() {
|
363 |
load_plugin_textdomain( $this->plugin_slug, FALSE, basename( CFCORE_PATH ) . '/languages');
|
364 |
}
|
365 |
-
|
366 |
-
|
367 |
|
368 |
public static function add_shortcode_inserter(){
|
369 |
-
|
370 |
$screen = get_current_screen();
|
371 |
|
372 |
if($screen->base === 'post'){
|
373 |
include CFCORE_PATH . 'ui/insert_shortcode.php';
|
374 |
}
|
375 |
-
}
|
376 |
|
377 |
public static function get_admin_templates(){
|
378 |
include CFCORE_PATH . 'ui/news_templates.php';
|
379 |
include CFCORE_PATH . 'ui/admin_templates.php';
|
380 |
}
|
381 |
public static function get_admin_meta_templates(){
|
382 |
-
|
383 |
$processors = $processors = Caldera_Forms_Processor_Load::get_instance()->get_processors();
|
384 |
if(!empty($processors)){
|
385 |
foreach($processors as $processor_type=>$processor_config){
|
386 |
if( isset( $processor_config['meta_template'] ) && file_exists( $processor_config['meta_template'] ) ){
|
387 |
echo "{{#if ".$processor_type."_template}}\r\n";
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
echo "{{/if}}\r\n";
|
397 |
}
|
398 |
}
|
399 |
}
|
400 |
}
|
401 |
|
|
|
|
|
|
|
|
|
|
|
402 |
public static function get_entry_actions(){
|
403 |
|
404 |
$viewer_buttons_array = apply_filters( 'caldera_forms_entry_viewer_buttons', array());
|
@@ -410,7 +543,7 @@ class Caldera_Forms_Admin {
|
|
410 |
if(is_array($button['config'])){
|
411 |
$config = $button['label'].'|'.json_encode($button['config']);
|
412 |
}else{
|
413 |
-
$config = $button['label'].'|'.$button['config'];
|
414 |
}
|
415 |
if( isset( $button['class'] ) ){
|
416 |
$config .= '|' . $button['class'];
|
@@ -429,7 +562,7 @@ class Caldera_Forms_Admin {
|
|
429 |
if(is_array($button['config'])){
|
430 |
$config = $button['label'].'|'.json_encode($button['config']);
|
431 |
}else{
|
432 |
-
$config = $button['label'].'|'.$button['config'];
|
433 |
}
|
434 |
if( isset( $button['class'] ) ){
|
435 |
$config .= '|' . $button['class'];
|
@@ -442,54 +575,67 @@ class Caldera_Forms_Admin {
|
|
442 |
|
443 |
|
444 |
if( current_user_can( 'edit_others_posts' ) ){
|
445 |
-
echo '{{#if ../../is_active}}<button class="hidden button button-small cfajax-trigger edit-entry-btn" id="edit-entry-{{_entry_id}}" data-active-class="current-edit" data-
|
|
|
446 |
}
|
447 |
-
echo '{{#if ../../is_active}}<button class="button button-small ajax-trigger view-entry-btn" id="view-entry-{{_entry_id}}" data-active-class="current-view" data-
|
448 |
if( current_user_can( 'delete_others_posts' ) ){
|
449 |
-
echo '<button type="button" class="button button-small ajax-trigger" data-load-class="active" data-panel="{{#if ../../is_trash}}trash{{/if}}{{#if ../../is_active}}active{{/if}}" data-do="{{#if ../../is_trash}}active{{/if}}{{#if ../../is_active}}trash{{/if}}" data-callback="cf_refresh_view" data-form="{{../../form}}" data-active-class="disabled" data-group="row{{_entry_id}}" data-load-element="#entry_row_{{_entry_id}}" data-action="cf_bulk_action" data-items="{{_entry_id}}">{{#if ../../is_trash}}' . __('Restore', 'caldera-forms') . '{{/if}}{{#if ../../is_active}}' .
|
450 |
}
|
451 |
|
452 |
}
|
453 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
454 |
public static function set_viewer_buttons($buttons){
|
455 |
-
|
456 |
-
$buttons['close_panel'] = array(
|
457 |
-
'label'
|
458 |
-
'config'
|
459 |
-
'class'
|
460 |
);
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
'
|
465 |
-
|
|
|
466 |
),
|
467 |
-
'class'
|
468 |
);
|
469 |
}
|
470 |
|
471 |
return $buttons;
|
472 |
}
|
473 |
|
474 |
-
|
475 |
public static function set_editor_buttons($buttons){
|
476 |
|
477 |
$buttons['submit_form'] = array(
|
478 |
-
'label' =>
|
479 |
'config' => array(
|
480 |
"data-for" => "#view_entry_baldrickModalBody .caldera_forms_form"
|
481 |
),
|
482 |
'class' => 'right button-primary'
|
483 |
);
|
484 |
$buttons['view_entry'] = array(
|
485 |
-
'label' =>
|
486 |
'config' => array(
|
487 |
"data-for" => ".view-entry-btn.current-view"
|
488 |
),
|
489 |
'class' => ''
|
490 |
-
);
|
491 |
-
|
492 |
-
|
493 |
return $buttons;
|
494 |
}
|
495 |
|
@@ -519,15 +665,15 @@ class Caldera_Forms_Admin {
|
|
519 |
function shortcode_insert_button(){
|
520 |
global $post;
|
521 |
if(!empty($post)){
|
522 |
-
echo "<a id=\"caldera-forms-form-insert\" title=\"".
|
523 |
-
echo " <img src=\"". CFCORE_URL . "assets/images/lgo-icon.png\" alt=\"".
|
524 |
echo "</a>\n";
|
525 |
}
|
526 |
}
|
527 |
function shortcode_insert_button_fs($buttons){
|
528 |
-
|
529 |
$buttons['caldera-forms'] = array(
|
530 |
-
"title" => __('Add Form to Page','caldera-forms'),
|
531 |
"both" => true
|
532 |
);
|
533 |
return $buttons;
|
@@ -541,9 +687,9 @@ class Caldera_Forms_Admin {
|
|
541 |
* @since unknown
|
542 |
*/
|
543 |
public static function toggle_form_state(){
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
|
548 |
$forms = Caldera_Forms_Forms::get_forms( true );
|
549 |
$form = sanitize_text_field( $_POST['form'] );
|
@@ -556,11 +702,11 @@ class Caldera_Forms_Admin {
|
|
556 |
|
557 |
Caldera_Forms_Forms::form_state( $form );
|
558 |
$state = 'active-form';
|
559 |
-
$label =
|
560 |
}else{
|
561 |
Caldera_Forms_Forms::form_state( $form , false );
|
562 |
$state = 'draft-form';
|
563 |
-
$label =
|
564 |
}
|
565 |
|
566 |
|
@@ -581,9 +727,12 @@ class Caldera_Forms_Admin {
|
|
581 |
/**
|
582 |
* Show entries in admin
|
583 |
*
|
|
|
|
|
584 |
* @since unknown
|
585 |
*/
|
586 |
public static function browse_entries(){
|
|
|
587 |
self::verify_ajax_action();
|
588 |
if ( isset( $_POST[ 'page' ] ) && 0 < $_POST[ 'page' ] ) {
|
589 |
$page = absint( $_POST[ 'page' ] );
|
@@ -595,7 +744,7 @@ class Caldera_Forms_Admin {
|
|
595 |
$perpage = absint( (int) $_POST[ 'perpage' ] );
|
596 |
if( $entry_perpage != $perpage ){
|
597 |
update_option( '_caldera_forms_entry_perpage', $perpage );
|
598 |
-
}
|
599 |
}else{
|
600 |
$perpage = $entry_perpage;
|
601 |
}
|
@@ -607,7 +756,7 @@ class Caldera_Forms_Admin {
|
|
607 |
}
|
608 |
|
609 |
$form = Caldera_Forms_Forms::get_form( $_POST['form'] );
|
610 |
-
|
611 |
$data = self::get_entries( $form, $page, $perpage, $status );
|
612 |
|
613 |
// set status output
|
@@ -648,148 +797,135 @@ class Caldera_Forms_Admin {
|
|
648 |
$field_labels = array();
|
649 |
$backup_labels = array();
|
650 |
$selects = array();
|
651 |
-
|
652 |
-
// get all fieldtype
|
653 |
-
$field_types = Caldera_Forms::get_field_types();
|
654 |
-
|
655 |
|
656 |
$fields = array();
|
657 |
-
if(!empty($form['fields'])){
|
658 |
-
foreach($form['fields'] as $fid
|
659 |
-
$fields[$field['slug']] = $field;
|
660 |
|
661 |
-
if(!empty($field['entry_list'])){
|
662 |
-
$selects[] = "'"
|
663 |
-
$field_labels[$field['slug']] = $field['label'];
|
664 |
}
|
665 |
$has_vars = array();
|
666 |
-
if( !empty( $form['variables']['types'] ) ){
|
667 |
-
$has_vars = $form['variables']['types'];
|
668 |
}
|
669 |
-
if( ( count($backup_labels) < 4 && !in_array( 'entryitem', $has_vars ) ) && in_array($field['type'], array(
|
|
|
|
|
|
|
|
|
|
|
|
|
670 |
// backup only first 4 fields
|
671 |
-
$backup_labels[$field['slug']] = $field['label'];
|
672 |
}
|
673 |
}
|
674 |
}
|
675 |
-
|
|
|
676 |
$field_labels = $backup_labels;
|
677 |
}
|
678 |
-
|
|
|
679 |
|
680 |
$data = array();
|
681 |
|
682 |
$filter = null;
|
683 |
|
684 |
-
$data['trash']
|
685 |
-
$data['active'] =
|
686 |
|
687 |
// set current total
|
688 |
-
if(!empty( $status ) && isset( $data[ $status ] ) ){
|
689 |
-
$data['total'] = $
|
690 |
-
}else{
|
691 |
-
$data['total'] = $data['active'];
|
692 |
}
|
693 |
|
694 |
|
695 |
-
$data['pages'] = ceil($data['total'] / $perpage );
|
696 |
|
697 |
-
if(!empty( $page )){
|
698 |
$page = abs( $page );
|
699 |
-
if($page > $data['pages']){
|
700 |
-
$page = $data['pages'];
|
701 |
}
|
702 |
}
|
703 |
|
704 |
$data['current_page'] = $page;
|
705 |
-
|
706 |
if($data['total'] > 0){
|
707 |
|
708 |
-
$data['form'] = $form_id;
|
709 |
|
710 |
-
$data['fields'] = $field_labels;
|
711 |
-
$offset = ($page - 1) * $perpage;
|
712 |
-
$limit = $offset . ',' . $perpage;
|
713 |
|
714 |
|
|
|
715 |
|
716 |
-
|
717 |
-
SELECT
|
718 |
-
`id`,
|
719 |
-
`form_id`
|
720 |
-
FROM `" . $wpdb->prefix ."cf_form_entries`
|
721 |
|
722 |
-
|
|
|
723 |
|
724 |
-
if(!empty($rawdata)){
|
725 |
|
726 |
-
$
|
727 |
-
foreach($
|
728 |
-
$ids[] = $
|
729 |
}
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
|
742 |
-
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
|
747 |
-
$data['entries'] = array();
|
748 |
-
|
749 |
-
foreach($rawdata as $row){
|
750 |
-
if(!empty($row->_user_id)){
|
751 |
-
$user = get_userdata( $row->_user_id );
|
752 |
-
if(!empty($user)){
|
753 |
-
$data['entries']['E' . $row->_entryid]['user']['ID'] = $user->ID;
|
754 |
-
$data['entries']['E' . $row->_entryid]['user']['name'] = $user->data->display_name;
|
755 |
-
$data['entries']['E' . $row->_entryid]['user']['email'] = $user->data->user_email;
|
756 |
-
$data['entries']['E' . $row->_entryid]['user']['avatar'] = get_avatar( $user->ID, 64 );
|
757 |
}
|
758 |
-
}
|
759 |
-
$data['entries']['E' . $row->_entryid]['_entry_id'] = $row->_entryid;
|
760 |
|
761 |
-
|
762 |
|
|
|
763 |
|
764 |
|
765 |
-
|
766 |
|
767 |
-
|
768 |
-
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
|
|
|
773 |
}
|
774 |
}
|
775 |
-
}
|
776 |
|
777 |
-
|
778 |
|
779 |
-
|
780 |
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
-
|
786 |
-
|
787 |
|
788 |
-
|
789 |
-
|
790 |
-
|
791 |
-
|
792 |
-
|
793 |
|
794 |
if( is_string( $row->value ) ){
|
795 |
$row->value = esc_html( stripslashes_deep( $row->value ) );
|
@@ -797,31 +933,32 @@ class Caldera_Forms_Admin {
|
|
797 |
$row->value = stripslashes_deep( Caldera_Forms_Sanitize::sanitize( $row->value ) );
|
798 |
}
|
799 |
|
800 |
-
|
801 |
|
802 |
|
803 |
-
|
804 |
-
|
805 |
-
|
806 |
-
|
807 |
-
|
|
|
|
|
|
|
|
|
808 |
}
|
809 |
-
$data['entries']['E' . $row->_entryid]['data'][$row->slug][] = $row->value;
|
810 |
-
}else{
|
811 |
-
$data['entries']['E' . $row->_entryid]['data'][$row->slug] = $row->value;
|
812 |
}
|
813 |
-
}
|
814 |
|
815 |
-
|
816 |
-
|
817 |
-
|
818 |
-
|
819 |
-
|
|
|
820 |
}
|
821 |
}
|
822 |
-
}
|
823 |
|
824 |
|
|
|
825 |
}
|
826 |
}
|
827 |
}
|
@@ -854,26 +991,26 @@ class Caldera_Forms_Admin {
|
|
854 |
*/
|
855 |
public function register_admin_page(){
|
856 |
global $menu, $submenu;
|
857 |
-
|
858 |
$forms = Caldera_Forms_Forms::get_forms( true );
|
859 |
|
860 |
// get current user
|
861 |
if( current_user_can( Caldera_Forms::get_manage_cap() ) ){
|
862 |
-
|
863 |
-
$this->screen_prefix[] = add_menu_page( __('Caldera Forms', 'caldera-forms'), __('Caldera Forms', 'caldera-forms'), Caldera_Forms::get_manage_cap(), $this->plugin_slug, array( $this, 'render_admin' ), 'dashicons-cf-logo', 52.81321 );
|
864 |
-
add_submenu_page( $this->plugin_slug, __('Caldera Forms Admin', 'caldera-forms'), __('Forms', 'caldera-forms'), Caldera_Forms::get_manage_cap(), $this->plugin_slug, array( $this, 'render_admin' ) );
|
865 |
-
|
866 |
if( ! empty( $forms ) ){
|
867 |
foreach($forms as $form_id=>$form){
|
868 |
if(!empty($form['pinned'])){
|
869 |
-
$this->screen_prefix[] = add_submenu_page( $this->plugin_slug, __('Caldera Forms', 'caldera-forms').' - ' . $form['name'], '- '.$form['name'], Caldera_Forms::get_manage_cap(), $this->plugin_slug . '-pin-' . $form_id, array( $this, 'render_admin' ) );
|
870 |
}
|
871 |
}
|
872 |
-
}
|
873 |
|
874 |
|
875 |
-
$this->screen_prefix[] = add_submenu_page( $this->plugin_slug, __('Caldera Forms', 'caldera-forms') .' - '. __('Community', 'caldera-forms'), __('Community', 'caldera-forms'), Caldera_Forms::get_manage_cap(), $this->plugin_slug . '-community', array( $this, 'render_admin' ) );
|
876 |
-
$this->screen_prefix[] = add_submenu_page( $this->plugin_slug, __('Caldera Forms', 'caldera-forms') . ' - ' . __('Extend', 'caldera-forms'), __('Extend', 'caldera-forms'), Caldera_Forms::get_manage_cap(), $this->plugin_slug . '-exend', array( $this, 'render_admin' ) );
|
877 |
}else{
|
878 |
// not an admin - pin for user
|
879 |
if( ! empty( $forms ) ){
|
@@ -917,12 +1054,12 @@ class Caldera_Forms_Admin {
|
|
917 |
if( empty( $this->screen_prefix ) ){
|
918 |
// make top menu
|
919 |
$main_slug = $this->plugin_slug . '-pin-' . $form_id;
|
920 |
-
$this->screen_prefix[] = add_menu_page( __('Caldera Forms', 'caldera-forms'), __('Caldera Forms', 'caldera-forms'), $capability, $main_slug, array( $this, 'render_admin' ), 'dashicons-cf-logo', 52.999 );
|
921 |
-
|
922 |
}
|
923 |
|
924 |
-
$this->screen_prefix[] = add_submenu_page( $main_slug, __('Caldera Forms', 'caldera-forms').' - ' . $form['name'], $form['name'], $capability, $this->plugin_slug . '-pin-' . $form_id, array( $this, 'render_admin' ) );
|
925 |
-
|
926 |
}
|
927 |
}
|
928 |
}
|
@@ -947,7 +1084,7 @@ class Caldera_Forms_Admin {
|
|
947 |
wp_enqueue_style( $this->plugin_slug . '-modal-styles', CFCORE_URL . 'assets/css/modals.css', array(), self::VERSION );
|
948 |
wp_enqueue_script( $this->plugin_slug . '-shortcode-insert', CFCORE_URL . 'assets/js/shortcode-insert.min.js', array( 'jquery' ), self::VERSION );
|
949 |
wp_enqueue_style( 'wp-color-picker' );
|
950 |
-
wp_enqueue_script( 'wp-color-picker' );
|
951 |
}
|
952 |
|
953 |
if ( ! in_array( $screen->base, $this->screen_prefix ) ) {
|
@@ -1124,13 +1261,13 @@ class Caldera_Forms_Admin {
|
|
1124 |
/**
|
1125 |
* Renders the admin pages
|
1126 |
*
|
1127 |
-
|
1128 |
public function render_admin(){
|
1129 |
-
|
1130 |
echo " <div class=\"wrap\">\r\n";
|
1131 |
if(!empty($_GET['edit'])){
|
1132 |
echo "<form method=\"POST\" action=\"admin.php?page=" . $this->plugin_slug . "\" data-load-element=\"#save_indicator\" data-sender=\"ajax\" class=\"caldera-forms-options-form edit-update-trigger\">\r\n";
|
1133 |
-
|
1134 |
echo "</form>\r\n";
|
1135 |
}elseif(!empty($_GET['page']) && $_GET['page'] == 'caldera-forms-exend'){
|
1136 |
include CFCORE_PATH . 'ui/extend.php';
|
@@ -1158,25 +1295,23 @@ class Caldera_Forms_Admin {
|
|
1158 |
return;
|
1159 |
}
|
1160 |
|
1161 |
-
add_filter( 'caldera_forms_manage_cap', array( __CLASS__ , 'save_form_cap_filter' ), 9, 3 );
|
1162 |
-
|
1163 |
/// check for form delete
|
1164 |
if(!empty($_GET['delete']) && !empty($_GET['cal_del']) && current_user_can( Caldera_Forms::get_manage_cap( 'save' ), strip_tags( $_GET[ 'delete' ] ) ) ){
|
1165 |
|
1166 |
if ( ! wp_verify_nonce( $_GET['cal_del'], 'cf_del_frm' ) ) {
|
1167 |
// This nonce is not valid.
|
1168 |
-
wp_die( __('Sorry, please try again', 'caldera-forms'), __('Form Delete Error', 'caldera-forms') );
|
1169 |
}else{
|
1170 |
$deleted = Caldera_Forms_Forms::delete_form( strip_tags( $_GET['delete'] ) );
|
1171 |
if ( $deleted ) {
|
1172 |
wp_redirect( 'admin.php?page=caldera-forms' );
|
1173 |
exit;
|
1174 |
} else {
|
1175 |
-
wp_die( __('Sorry, please try again', 'caldera-forms'), __('Form could not be deleted.', 'caldera-forms') );
|
1176 |
}
|
1177 |
|
1178 |
}
|
1179 |
-
|
1180 |
}
|
1181 |
|
1182 |
/** IMPORT */
|
@@ -1227,7 +1362,7 @@ class Caldera_Forms_Admin {
|
|
1227 |
$form = Caldera_Forms_Forms::get_form( $_GET['export-form'] );
|
1228 |
|
1229 |
if(empty($form)){
|
1230 |
-
wp_die( __('Form does not exist.', 'caldera-forms') );
|
1231 |
}
|
1232 |
|
1233 |
header("Pragma: public");
|
@@ -1251,8 +1386,8 @@ class Caldera_Forms_Admin {
|
|
1251 |
|
1252 |
$structure = "/**\r\n * Filter admin forms to include custom form in admin\r\n *\r\n * @since 1.3.1\r\n *\r\n * @param array \$forms All registered forms\r\n */\r\n";
|
1253 |
$structure .= 'add_filter( "caldera_forms_get_forms", function( $forms ){' . "\r\n";
|
1254 |
-
|
1255 |
-
|
1256 |
$structure .= "} );\r\n\r\n";
|
1257 |
|
1258 |
$structure .= "/**\r\n * Filter form request to include form structure to be rendered\r\n *\r\n * @since 1.3.1\r\n *\r\n * @param \$form array form structure\r\n */\r\n";
|
@@ -1303,7 +1438,7 @@ class Caldera_Forms_Admin {
|
|
1303 |
if(!empty($items)){
|
1304 |
$filter = ' AND `entry`.`id` IN (' . implode(',', $items) . ') ';
|
1305 |
}else{
|
1306 |
-
wp_die( __('Export selection has expired', 'caldera-forms') , __('Export Expired', 'caldera-forms') );
|
1307 |
}
|
1308 |
}
|
1309 |
|
@@ -1372,15 +1507,15 @@ class Caldera_Forms_Admin {
|
|
1372 |
}
|
1373 |
fputcsv($df, $row);
|
1374 |
}
|
1375 |
-
fclose($df);
|
1376 |
-
exit;
|
1377 |
}
|
1378 |
|
1379 |
if( isset($_POST['config']) && isset( $_POST['cf_edit_nonce'] ) && current_user_can( Caldera_Forms::get_manage_cap( 'manage' ) ) ){
|
1380 |
-
|
1381 |
// if this fails, check_admin_referer() will automatically print a "failed" page and die.
|
1382 |
if ( check_admin_referer( 'cf_edit_element', 'cf_edit_nonce' ) ) {
|
1383 |
-
|
1384 |
// strip slashes
|
1385 |
$data = json_decode( stripslashes_deep($_POST['config']) , ARRAY_A );
|
1386 |
self::save_a_form( $data );
|
@@ -1426,17 +1561,15 @@ class Caldera_Forms_Admin {
|
|
1426 |
public function get_panel_extensions($panels){
|
1427 |
|
1428 |
$path = CFCORE_PATH . "ui/panels/";
|
1429 |
-
|
1430 |
$internal_panels = array(
|
1431 |
'form_layout' => array(
|
1432 |
-
"name" => __(
|
1433 |
"setup" => array(
|
1434 |
"scripts" => array(
|
1435 |
'jquery-ui-sortable',
|
1436 |
'jquery-ui-draggable',
|
1437 |
'jquery-ui-droppable',
|
1438 |
-
//CFCORE_URL . "assets/js/processors-edit.js",
|
1439 |
-
//CFCORE_URL . "assets/js/layout-grid.js"
|
1440 |
),
|
1441 |
"styles" => array(
|
1442 |
CFCORE_URL . "assets/css/editor-grid.css",
|
@@ -1445,9 +1578,9 @@ class Caldera_Forms_Admin {
|
|
1445 |
),
|
1446 |
"tabs" => array(
|
1447 |
"layout" => array(
|
1448 |
-
"name" => __(
|
1449 |
"location" => "lower",
|
1450 |
-
"label" => __(
|
1451 |
"active" => true,
|
1452 |
"actions" => array(
|
1453 |
$path . "layout_toolbar.php"
|
@@ -1457,49 +1590,55 @@ class Caldera_Forms_Admin {
|
|
1457 |
"side_panel" => $path . "layout_side.php",
|
1458 |
),
|
1459 |
"pages" => array(
|
1460 |
-
"name" => __(
|
1461 |
"location" => "lower",
|
1462 |
-
"label" => __(
|
1463 |
"canvas" => $path . "pages.php",
|
1464 |
),
|
1465 |
-
"
|
1466 |
-
"name" => __(
|
1467 |
"location" => "lower",
|
1468 |
-
"label" => __(
|
1469 |
-
"canvas" => $path . "
|
1470 |
-
),
|
1471 |
"processors" => array(
|
1472 |
-
"name" => __(
|
1473 |
"location" => "lower",
|
1474 |
-
"label" => __(
|
1475 |
"canvas" => $path . "processors.php",
|
1476 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
1477 |
"variables" => array(
|
1478 |
-
"name" => __(
|
1479 |
"location" => "lower",
|
1480 |
-
"label" => __(
|
1481 |
"canvas" => $path . "variables.php",
|
1482 |
"actions" => array(
|
1483 |
$path . "variable_add.php"
|
1484 |
-
)
|
1485 |
),
|
1486 |
"responsive" => array(
|
1487 |
-
"name" => __(
|
1488 |
"location" => "lower",
|
1489 |
-
"label" => __(
|
1490 |
"repeat" => 0,
|
1491 |
"fields" => array(
|
1492 |
"break_point" => array(
|
1493 |
-
"label" => __(
|
1494 |
"slug" => "break_point",
|
1495 |
-
"caption" => __(
|
1496 |
"type" => "radio",
|
1497 |
"config" => array(
|
1498 |
"default" => "sm",
|
1499 |
"option" => array(
|
1500 |
"xs" => array(
|
1501 |
'value' => 'xs',
|
1502 |
-
'label' => __('Maintain grid always', 'caldera-forms'),
|
1503 |
),
|
1504 |
"sm" => array(
|
1505 |
'value' => 'sm',
|
@@ -1518,84 +1657,12 @@ class Caldera_Forms_Admin {
|
|
1518 |
)
|
1519 |
),
|
1520 |
),
|
1521 |
-
"mailer" => array(
|
1522 |
-
"name" => __("Mailer", 'caldera-forms'),
|
1523 |
-
"location" => "lower",
|
1524 |
-
"label" => __("Email Notification Settings", 'caldera-forms'),
|
1525 |
-
"canvas" => $path . "emailer.php",
|
1526 |
-
),
|
1527 |
-
/*
|
1528 |
-
"styles" => array(
|
1529 |
-
"name" => __("Stylesheets", 'caldera-forms'),
|
1530 |
-
"location" => "lower",
|
1531 |
-
"label" => __("Stylesheet Includes", 'caldera-forms'),
|
1532 |
-
"repeat" => 0,
|
1533 |
-
"fields" => array(
|
1534 |
-
"use_grid" => array(
|
1535 |
-
"label" => __("Grid CSS", 'caldera-forms'),
|
1536 |
-
"slug" => "use_grid",
|
1537 |
-
"caption" => __("Include the built in grid stylesheet (based on Bootstrap 3.0)", 'caldera-forms'),
|
1538 |
-
"type" => "dropdown",
|
1539 |
-
"config" => array(
|
1540 |
-
"default" => "yes",
|
1541 |
-
"option" => array(
|
1542 |
-
"opt1" => array(
|
1543 |
-
'value' => 'yes',
|
1544 |
-
'label' => 'Yes'
|
1545 |
-
),
|
1546 |
-
"opt2" => array(
|
1547 |
-
'value' => 'no',
|
1548 |
-
'label' => 'No'
|
1549 |
-
)
|
1550 |
-
)
|
1551 |
-
),
|
1552 |
-
),
|
1553 |
-
"use_form" => array(
|
1554 |
-
"label" => __("Form CSS", 'caldera-forms'),
|
1555 |
-
"slug" => "use_grid",
|
1556 |
-
"caption" => __("Include the built in form stylesheet (based on Bootstrap 3.0)", 'caldera-forms'),
|
1557 |
-
"type" => "dropdown",
|
1558 |
-
"config" => array(
|
1559 |
-
"default" => "yes",
|
1560 |
-
"option" => array(
|
1561 |
-
"opt1" => array(
|
1562 |
-
'value' => 'yes',
|
1563 |
-
'label' => 'Yes'
|
1564 |
-
),
|
1565 |
-
"opt2" => array(
|
1566 |
-
'value' => 'no',
|
1567 |
-
'label' => 'No'
|
1568 |
-
)
|
1569 |
-
)
|
1570 |
-
),
|
1571 |
-
),
|
1572 |
-
"use_alerts" => array(
|
1573 |
-
"label" => __("Alerts CSS", 'caldera-forms'),
|
1574 |
-
"slug" => "use_alerts",
|
1575 |
-
"caption" => __("Include the built in alerts stylesheet (based on Bootstrap 3.0)", 'caldera-forms'),
|
1576 |
-
"type" => "dropdown",
|
1577 |
-
"config" => array(
|
1578 |
-
"default" => "yes",
|
1579 |
-
"option" => array(
|
1580 |
-
"opt1" => array(
|
1581 |
-
'value' => 'yes',
|
1582 |
-
'label' => 'Yes'
|
1583 |
-
),
|
1584 |
-
"opt2" => array(
|
1585 |
-
'value' => 'no',
|
1586 |
-
'label' => 'No'
|
1587 |
-
)
|
1588 |
-
)
|
1589 |
-
),
|
1590 |
-
),
|
1591 |
-
),
|
1592 |
-
),*/
|
1593 |
),
|
1594 |
),
|
1595 |
);
|
1596 |
-
|
1597 |
return array_merge( $panels, $internal_panels );
|
1598 |
-
|
1599 |
}
|
1600 |
|
1601 |
/**
|
@@ -1667,9 +1734,9 @@ class Caldera_Forms_Admin {
|
|
1667 |
);
|
1668 |
$message = '<p>' . implode( ' ', $message ) . '</p>';
|
1669 |
|
1670 |
-
$message .= sprintf( '<p style="display:inline;float:left;" ><a type="button" class="button button-secondary" href="%s">%s</a></p>', esc_url_raw( $dismiss ), __( 'No Thanks', 'caldera-forms') );
|
1671 |
|
1672 |
-
$message .= sprintf( '<p style="display:inline; float:right;"><a type="button" class="button button-primary" href="%s">%s</a>', esc_url_raw( $allow ), __( 'Help Us & Save', 'caldera-forms') );
|
1673 |
|
1674 |
self::create_admin_notice( __( 'Help us improve Caldera Forms & Get 10% Off At CalderaWP.com', 'caldera-forms' ), $message, false );
|
1675 |
}else{
|
@@ -1716,7 +1783,7 @@ class Caldera_Forms_Admin {
|
|
1716 |
<script type="text/html" id="<?php echo esc_attr( sanitize_key('admin-modal' . $title ) ); ?>">
|
1717 |
<?php echo $content; ?>
|
1718 |
</script>
|
1719 |
-
<?php
|
1720 |
}
|
1721 |
|
1722 |
/**
|
@@ -1806,23 +1873,27 @@ class Caldera_Forms_Admin {
|
|
1806 |
|
1807 |
switch( $context ) {
|
1808 |
case 'export' :
|
1809 |
-
|
|
|
1810 |
if( isset( $form[ 'pin_roles' ][ 'access_role' ] ) && is_array($form[ 'pin_roles' ][ 'access_role' ] ) ){
|
1811 |
-
|
1812 |
-
|
1813 |
-
|
1814 |
-
|
1815 |
}
|
1816 |
}
|
1817 |
}
|
1818 |
}
|
1819 |
|
1820 |
break;
|
|
|
1821 |
}
|
1822 |
|
1823 |
return $cap;
|
1824 |
|
1825 |
}
|
|
|
|
|
1826 |
|
1827 |
}
|
1828 |
|
5 |
* @package Caldera_Forms
|
6 |
* @author David <david@digilab.co.za>
|
7 |
* @license GPL-2.0+
|
8 |
+
* @link
|
9 |
* @copyright 2014 David Cramer
|
10 |
*/
|
11 |
|
69 |
|
70 |
// Add Admin menu page
|
71 |
add_action( 'admin_menu', array( $this, 'register_admin_page' ), 9 );
|
72 |
+
|
73 |
// Add admin scritps and styles
|
74 |
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_stylescripts' ) );
|
75 |
+
|
76 |
// add element & fields filters
|
77 |
add_filter('caldera_forms_get_panel_extensions', array( $this, 'get_panel_extensions'), 1);
|
78 |
add_filter('caldera_forms_entry_viewer_buttons', array( $this, 'set_viewer_buttons'),10, 4);
|
79 |
add_filter('caldera_forms_entry_editor_buttons', array( $this, 'set_editor_buttons'),10, 4);
|
80 |
+
|
81 |
// action
|
82 |
add_action('caldera_forms_entry_actions', array( $this, 'get_entry_actions'),1);
|
83 |
add_action('caldera_forms_admin_templates', array( $this, 'get_admin_templates'),1);
|
87 |
add_action( 'media_buttons', array($this, 'shortcode_insert_button' ), 11 );
|
88 |
add_filter( 'wp_fullscreen_buttons', array($this, 'shortcode_insert_button_fs' ), 11 );
|
89 |
|
90 |
+
// filter for adding presets
|
91 |
+
add_filter( 'caldera_forms_field_option_presets', array($this, 'load_option_presets' ) );
|
92 |
|
93 |
if( current_user_can( Caldera_Forms::get_manage_cap( 'create' ) ) ){
|
94 |
// create forms
|
97 |
|
98 |
if( current_user_can( Caldera_Forms::get_manage_cap( 'admin' ) ) ) {
|
99 |
add_action( "wp_ajax_toggle_form_state", array( $this, 'toggle_form_state' ) );
|
|
|
100 |
add_action( "wp_ajax_save_cf_setting", array( $this, 'save_cf_setting' ) );
|
101 |
add_action( "wp_ajax_cf_dismiss_pointer", array( $this, 'update_pointer' ) );
|
102 |
add_action( "wp_ajax_cf_bulk_action", array( $this, 'bulk_action' ) );
|
103 |
}
|
104 |
add_action("wp_ajax_cf_get_form_preview", array( $this, 'get_form_preview') );
|
105 |
+
|
106 |
add_action( 'caldera_forms_admin_footer', array( $this, 'admin_alerts' ) );
|
107 |
add_action( 'admin_footer', array( $this, 'add_shortcode_inserter'));
|
108 |
|
112 |
|
113 |
add_action('admin_footer-edit.php', array( $this, 'render_editor_template')); // Fired on the page with the posts table
|
114 |
add_action('admin_footer-post.php', array( $this, 'render_editor_template')); // Fired on post edit page
|
115 |
+
add_action('admin_footer-post-new.php', array( $this, 'render_editor_template')); // Fired on add new post page
|
116 |
|
117 |
add_action( 'caldera_forms_new_form_template_end', array( $this, 'load_new_form_templates') );
|
118 |
|
119 |
add_action( 'admin_init', array( $this, 'watch_tracking' ) );
|
120 |
|
121 |
+
/** Admin Entry Viewer */
|
122 |
+
add_action( 'wp_ajax_browse_entries', array( Caldera_Forms_Entry_UI::get_instance(), 'view_entries' ) );
|
123 |
+
add_action( 'wp_ajax_get_entry', array( Caldera_Forms_Entry_UI::get_instance(), 'view_entry' ) );
|
124 |
+
|
125 |
+
add_filter( 'caldera_forms_manage_cap', array( __CLASS__ , 'save_form_cap_filter' ), 9, 3 );
|
126 |
+
|
127 |
/**
|
128 |
* Runs after Caldera Forms admin is initialized
|
129 |
*
|
130 |
+
* @since 1.3.5.3
|
131 |
*/
|
132 |
do_action( 'caldera_forms_admin_init' );
|
133 |
|
136 |
|
137 |
public function render_editor_template(){
|
138 |
?>
|
139 |
+
<script type="text/html" id="tmpl-editor-caldera-forms">
|
140 |
+
<# if ( data.html ) { #>
|
141 |
+
{{{ data.html }}}
|
142 |
+
<# } else { #>
|
143 |
+
<div class="wpview-error">
|
144 |
+
<div class="dashicons dashicons-cf-logo"></div><p style="font-size: 13px;"><?php _e( 'Invalid Form.', 'caldera-forms' ); ?></p>
|
145 |
+
</div>
|
146 |
+
<# } #>
|
147 |
+
</script>
|
148 |
+
<?php
|
149 |
|
150 |
}
|
151 |
|
152 |
+
/**
|
153 |
+
* Returns the array of option presets for option based fields.
|
154 |
+
*
|
155 |
+
* @since 1.4.0
|
156 |
+
* @param array $presets current array of presets
|
157 |
+
*
|
158 |
+
* @return array array of presets
|
159 |
+
*/
|
160 |
+
public function load_option_presets( $presets ){
|
161 |
+
|
162 |
+
$internal = array_merge( $presets, array(
|
163 |
+
'countries_iso_alpha_2' => array(
|
164 |
+
'name' => __( 'Countries (ISO Alpha-2)', 'caldera-forms'),
|
165 |
+
'data' => file_get_contents( CFCORE_PATH . 'includes/presets/countries_iso_alpha_2.txt' ),
|
166 |
+
),
|
167 |
+
'countries_names' => array(
|
168 |
+
'name' => __( 'Countries (Names Only)', 'caldera-forms'),
|
169 |
+
'data' => file_get_contents( CFCORE_PATH . 'includes/presets/countries_names.txt' ),
|
170 |
+
),
|
171 |
+
'continents' => array(
|
172 |
+
'name' => __( 'Continents', 'caldera-forms'),
|
173 |
+
'data' => array(
|
174 |
+
"Africa",
|
175 |
+
"Antarctica",
|
176 |
+
"Asia",
|
177 |
+
"Australia",
|
178 |
+
"Europe",
|
179 |
+
"North America",
|
180 |
+
"South America",
|
181 |
+
),
|
182 |
+
),
|
183 |
+
'canadian_provinces_territories' => array(
|
184 |
+
'name' => __( 'Canadian Provinces & Territories', 'caldera-forms'),
|
185 |
+
'data' => array(
|
186 |
+
"Alberta",
|
187 |
+
"British Columbia",
|
188 |
+
"Manitoba",
|
189 |
+
"New Brunswick",
|
190 |
+
"Newfoundland and Labrador",
|
191 |
+
"Northwest Territories",
|
192 |
+
"Nova Scotia",
|
193 |
+
"Nunavut",
|
194 |
+
"Ontario",
|
195 |
+
"Prince Edward Island",
|
196 |
+
"Quebec",
|
197 |
+
"Saskatchewan",
|
198 |
+
"Yukon",
|
199 |
+
),
|
200 |
+
),
|
201 |
+
));
|
202 |
+
|
203 |
+
return $internal;
|
204 |
+
}
|
205 |
+
|
206 |
/**
|
207 |
* Returns the array of form templates.
|
208 |
*
|
211 |
* @return array The form templates
|
212 |
*/
|
213 |
public static function internal_form_templates(){
|
214 |
+
|
215 |
$internal_templates = array(
|
216 |
+
'starter_contact_form' => array(
|
217 |
+
'name' => esc_html__( 'Starter Contact Form', 'caldera-forms' ),
|
218 |
+
'template' => include CFCORE_PATH . 'includes/templates/starter-contact-form.php'
|
219 |
),
|
220 |
+
'variable_price_example' => array(
|
221 |
+
'name' => esc_html__( 'Variable Pricing Form, with add-on products.', 'caldera-forms' ),
|
222 |
+
'template' => include CFCORE_PATH . 'includes/templates/variable-price-example.php'
|
223 |
),
|
224 |
+
'registration' => array(
|
225 |
+
'name' => esc_html__( 'Registration Form, with optional additional participants.', 'caldera-forms' ),
|
226 |
+
'template' => include CFCORE_PATH . 'includes/templates/registration-form-example.php'
|
227 |
),
|
228 |
|
229 |
);
|
238 |
return apply_filters( 'caldera_forms_get_form_templates', $internal_templates );
|
239 |
|
240 |
}
|
241 |
+
|
242 |
public function load_new_form_templates(){
|
243 |
|
244 |
$form_templates = self::internal_form_templates();
|
245 |
|
246 |
?>
|
247 |
+
<div class="cf-templates-wrapper">
|
248 |
+
<?php
|
249 |
+
$selected_field = '';//' checked="checked"';
|
250 |
+
$selected_template = '';//' selected';
|
251 |
+
|
252 |
+
foreach( $form_templates as $template_slug => $template ){
|
253 |
+
if( !empty( $template['template'] ) && !empty( $template['name'] ) ){
|
254 |
+
|
255 |
+
echo '<label class="caldera-grid cf-form-template' . $selected_template . '">';
|
256 |
+
echo '<small>' . $template['name'] . '</small>';
|
257 |
+
|
258 |
+
echo '<input type="radio" name="template" value="' . $template_slug . '" class="cf-template-select"' . $selected_field . '>';
|
259 |
+
|
260 |
+
|
261 |
+
// check a layout exists
|
262 |
+
if( !empty( $template['preview'] ) ){
|
263 |
+
echo '<img src="' . esc_url( $template['preview'] ) . '"></label>';
|
264 |
+
continue;
|
265 |
+
}
|
266 |
+
if( empty( $template['template']['layout_grid'] ) || empty( $template['template']['layout_grid']['structure'] ) || empty( $template['template']['layout_grid']['fields'] ) ){
|
267 |
+
echo '<p class="description" style="padding: 50px 0px; text-align: center;">' . esc_html__( 'Preview not available', 'caldera-forms' ) . '</p></label>';
|
268 |
+
continue;
|
269 |
+
}
|
270 |
+
|
271 |
+
$struct = explode('|', $template['template']['layout_grid']['structure'] );
|
272 |
+
|
273 |
+
foreach ($struct as $row_num=>$row) {
|
274 |
+
|
275 |
+
$columns = explode( ':', $row );
|
276 |
+
echo '<div class="row" style="margin: 6px 0px;">';
|
277 |
+
foreach ($columns as $column_num=>$column) {
|
278 |
+
//var_dump( $template['template']['layout_grid']['fields'][ ( $row_num+1) . ':' . ( $column_num+1) ] );
|
279 |
+
$fields = array_keys( $template['template']['layout_grid']['fields'], ( $row_num+1) . ':' . ( $column_num+1) );
|
280 |
+
echo '<div class="col-sm-' . $column . '" style="padding: 0px 3px;">';
|
281 |
+
echo '<div class="cf-template-column">';
|
282 |
+
foreach( $fields as $field ){
|
283 |
+
if( isset( $template['template']['fields'][ $field ] ) ){
|
284 |
+
if( $template['template']['fields'][ $field ]['type'] == 'button'){
|
285 |
+
echo '<small class="cf-preview-field cf-preview-button">' . $template['template']['fields'][ $field ]['label'] .'</small>';
|
286 |
+
}elseif( $template['template']['fields'][ $field ]['type'] == 'html'){
|
287 |
+
echo '<small class="cf-preview-field cf-preview-field-html"></small>';
|
288 |
+
}elseif( $template['template']['fields'][ $field ]['type'] == 'paragraph'){
|
289 |
+
echo '<small class="cf-preview-field" style="height:50px;">' . $template['template']['fields'][ $field ]['label'] .'</small>';
|
290 |
+
}elseif( $template['template']['fields'][ $field ]['type'] == 'hidden'){
|
291 |
+
// nope- nothing
|
292 |
+
}else{
|
293 |
+
echo '<small class="cf-preview-field">' . $template['template']['fields'][ $field ]['label'] .'</small>';
|
294 |
+
}
|
295 |
+
}
|
296 |
+
}
|
297 |
+
echo '</div>';
|
298 |
+
echo '</div>';
|
299 |
+
}
|
300 |
+
|
301 |
+
echo '</div>';
|
302 |
+
}
|
303 |
+
|
304 |
+
echo '</label>';
|
305 |
+
// unset selection
|
306 |
+
$selected_field = null;
|
307 |
+
$selected_template = null;
|
308 |
}
|
309 |
+
}
|
310 |
|
311 |
+
?>
|
312 |
+
<label class="caldera-grid cf-form-template">
|
313 |
+
<small><?php echo esc_html__( 'Blank Form', 'caldera-forms' ); ?></small>
|
314 |
+
<input type="radio" name="template" value="" class="cf-template-select">
|
315 |
+
</label>
|
316 |
+
<div class="caldera-grid cf-form-create" style="display:none; visibility: hidden;" aria-hidden="true">
|
317 |
+
<div class="cf-template-title"></div>
|
318 |
+
|
319 |
+
<div class="caldera-config-field">
|
320 |
+
<input type="text" class="new-form-name block-input field-config" name="name" value="" required="required" autofocus="true" autocomplete="off" placeholder="<?php echo esc_html__('Form Name', 'caldera-forms' ); ?>">
|
321 |
+
</div>
|
322 |
+
|
323 |
+
<button type="button" class="cf-change-template-button"><span class="dashicons dashicons-arrow-left-alt"></span> <?php echo esc_html__( 'Change Template', 'caldera-forms' ); ?></button>
|
324 |
+
<button type="button" class="cf-create-form-button ajax-trigger"
|
325 |
+
data-action="create_form"
|
326 |
+
data-active-class="disabled"
|
327 |
+
data-load-class="disabled"
|
328 |
+
data-callback="new_form_redirect"
|
329 |
+
data-before="serialize_modal_form"
|
330 |
+
data-modal-autoclose="new_form"
|
331 |
+
><?php echo esc_html__( 'Create Form', 'caldera-forms' ); ?> <span class="dashicons dashicons-yes"></span><span class="spinner"></span></button>
|
332 |
</div>
|
333 |
</div>
|
334 |
<?php
|
335 |
}
|
336 |
|
|
|
|
|
|
|
|
|
|
|
337 |
public function get_form_preview(){
|
338 |
global $post;
|
339 |
add_filter('caldera_forms_render_form_element', array( $this, 'set_preview_form_element') );
|
343 |
}elseif( isset($_POST['atts']['named']['name']) ){
|
344 |
$form = $_POST['atts']['named']['name'];
|
345 |
}
|
346 |
+
|
347 |
add_filter('caldera_forms_get_form-' . $form, array( $this, 'set_preview_get_form'),100 );
|
348 |
|
349 |
$atts = $_POST['atts']['named'];
|
352 |
if( !empty( $form ) ){
|
353 |
ob_start();
|
354 |
wp_head();
|
355 |
+
echo Caldera_Forms::render_form( $form );
|
|
|
|
|
|
|
|
|
|
|
356 |
wp_print_footer_scripts();
|
357 |
$html = ob_get_clean();
|
358 |
}
|
360 |
if( !empty( $html ) ){
|
361 |
$out['html'] = $html;
|
362 |
}
|
363 |
+
|
364 |
wp_send_json_success( $out );
|
365 |
}
|
|
|
366 |
public function set_preview_get_form( $form ){
|
367 |
$form['form_ajax'] = false;
|
368 |
$form['settings']['responsive']['break_point'] = 'xs';
|
383 |
if( isset( $addon['slug'] ) ){
|
384 |
$plugins[$plugin_slug]['slug'] = $addon['slug'];
|
385 |
}
|
386 |
+
}
|
387 |
}
|
388 |
}
|
389 |
if( isset( $_REQUEST['plugin_status'] ) && $_REQUEST['plugin_status'] === 'caldera_forms' ){
|
402 |
if(empty($_POST['do'])){
|
403 |
die;
|
404 |
}
|
405 |
+
|
406 |
$do_action = strtolower( $_POST['do'] );
|
407 |
|
408 |
switch ( $do_action ) {
|
411 |
case 'delete':
|
412 |
global $wpdb;
|
413 |
|
414 |
+
$result = false;
|
415 |
$items = array();
|
416 |
$selectors = array();
|
417 |
+
foreach ( (array) $_POST[ 'items' ] as $item_id ) {
|
418 |
+
$items[] = (int) $item_id;
|
419 |
$selectors[] = '#entry_row_' . (int) $item_id;
|
420 |
}
|
421 |
|
422 |
+
switch ( $do_action ) {
|
423 |
case 'delete':
|
424 |
if( current_user_can( 'delete_others_posts' ) ){
|
425 |
+
$result = Caldera_Forms_Entry_Bulk::delete_entries( $items );
|
|
|
|
|
426 |
}
|
427 |
$out['status'] = 'reload';
|
428 |
wp_send_json( $out );
|
429 |
break;
|
430 |
+
|
431 |
default:
|
432 |
if( current_user_can( 'edit_others_posts' ) ){
|
433 |
+
$result = Caldera_Forms_Entry_Bulk::change_status( $items, $do_action );
|
434 |
}
|
435 |
break;
|
436 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
437 |
|
438 |
+
if( $result ){
|
439 |
+
$out[ 'status' ] = $do_action;
|
440 |
+
$out[ 'undo' ] = ( $do_action === 'trash' ? 'active' : esc_html__( 'Trash', 'caldera-forms' ) );
|
441 |
+
$out[ 'undo_text' ] = ( $do_action === 'trash' ? esc_html__( 'Restore', 'caldera-forms' ) : esc_html__( 'Trash', 'caldera-forms' ) );
|
442 |
+
|
443 |
+
$form = strip_tags( $_POST[ 'form' ] );
|
444 |
+
$out[ 'entries' ] = implode( ',', $selectors );
|
445 |
+
$out[ 'total' ] = Caldera_Forms_Entry_Bulk::count( $form, false );
|
446 |
+
$out[ 'trash' ] = Caldera_Forms_Entry_Bulk::count( $form, 'trash' );
|
447 |
wp_send_json( $out );
|
448 |
}
|
449 |
exit();
|
452 |
case 'export':
|
453 |
|
454 |
$transientid = uniqid('cfe');
|
455 |
+
set_transient( $transientid, $_POST['items'], 180 );
|
456 |
$out['url'] = "admin.php?page=caldera-forms&export=" . $_POST['form'] . "&tid=" . $transientid;
|
457 |
wp_send_json( $out );
|
458 |
exit();
|
461 |
# code...
|
462 |
break;
|
463 |
}
|
464 |
+
exit();
|
465 |
}
|
466 |
|
467 |
+
/**
|
468 |
+
* Dismiss admin pointer
|
469 |
+
*
|
470 |
+
* @since unknown
|
471 |
+
*
|
472 |
+
* @uses "wp_ajax_cf_dismiss_pointer" action
|
473 |
+
*/
|
474 |
public static function update_pointer(){
|
475 |
+
if( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'cf_dismiss_pointer' ) ){
|
476 |
+
status_header( 500 );
|
477 |
+
exit;
|
478 |
+
}
|
479 |
+
|
480 |
+
if ( ! empty( $_POST[ 'pointer' ] ) ) {
|
481 |
+
add_user_meta( get_current_user_id(), 'cf_pointer_' . $_POST[ 'pointer' ] );
|
482 |
}
|
483 |
exit;
|
484 |
}
|
490 |
public function load_plugin_textdomain() {
|
491 |
load_plugin_textdomain( $this->plugin_slug, FALSE, basename( CFCORE_PATH ) . '/languages');
|
492 |
}
|
493 |
+
|
494 |
+
|
495 |
|
496 |
public static function add_shortcode_inserter(){
|
497 |
+
|
498 |
$screen = get_current_screen();
|
499 |
|
500 |
if($screen->base === 'post'){
|
501 |
include CFCORE_PATH . 'ui/insert_shortcode.php';
|
502 |
}
|
503 |
+
}
|
504 |
|
505 |
public static function get_admin_templates(){
|
506 |
include CFCORE_PATH . 'ui/news_templates.php';
|
507 |
include CFCORE_PATH . 'ui/admin_templates.php';
|
508 |
}
|
509 |
public static function get_admin_meta_templates(){
|
510 |
+
|
511 |
$processors = $processors = Caldera_Forms_Processor_Load::get_instance()->get_processors();
|
512 |
if(!empty($processors)){
|
513 |
foreach($processors as $processor_type=>$processor_config){
|
514 |
if( isset( $processor_config['meta_template'] ) && file_exists( $processor_config['meta_template'] ) ){
|
515 |
echo "{{#if ".$processor_type."_template}}\r\n";
|
516 |
+
echo "{{#each data}}\r\n";
|
517 |
+
echo "{{#if title}}\r\n";
|
518 |
+
echo "<h4>{{title}}</h4>\r\n";
|
519 |
+
echo "{{/if}}\r\n";
|
520 |
+
echo "{{#each entry}}\r\n";
|
521 |
+
include $processor_config['meta_template'];
|
522 |
+
echo "{{/each}}\r\n";
|
523 |
+
echo "{{/each}}\r\n";
|
524 |
echo "{{/if}}\r\n";
|
525 |
}
|
526 |
}
|
527 |
}
|
528 |
}
|
529 |
|
530 |
+
/**
|
531 |
+
* Get the entry editor's buttons
|
532 |
+
*
|
533 |
+
* @since unknow
|
534 |
+
*/
|
535 |
public static function get_entry_actions(){
|
536 |
|
537 |
$viewer_buttons_array = apply_filters( 'caldera_forms_entry_viewer_buttons', array());
|
543 |
if(is_array($button['config'])){
|
544 |
$config = $button['label'].'|'.json_encode($button['config']);
|
545 |
}else{
|
546 |
+
$config = $button['label'].'|'.$button['config'];
|
547 |
}
|
548 |
if( isset( $button['class'] ) ){
|
549 |
$config .= '|' . $button['class'];
|
562 |
if(is_array($button['config'])){
|
563 |
$config = $button['label'].'|'.json_encode($button['config']);
|
564 |
}else{
|
565 |
+
$config = $button['label'].'|'.$button['config'];
|
566 |
}
|
567 |
if( isset( $button['class'] ) ){
|
568 |
$config .= '|' . $button['class'];
|
575 |
|
576 |
|
577 |
if( current_user_can( 'edit_others_posts' ) ){
|
578 |
+
echo '{{#if ../../is_active}}<button class="hidden button button-small cfajax-trigger edit-entry-btn" id="edit-entry-{{_entry_id}}" data-active-class="current-edit" data-static="true" data-load-class="spinner" ' . $editor_buttons . ' data-modal-element="div" data-group="editentry" data-entry="{{_entry_id}}" data-form="{{../../form}}" data-request="' . esc_url( Caldera_Forms::get_submit_url() ) . '{{../../form}}/{{_entry_id}}/" data-method="get" data-modal="view_entry" data-modal-width="700" data-modal-height="auto" data-modal-title="' . esc_attr__( 'Editing Entry ', 'caldera-forms' ) . ' #{{_entry_id}}" type="button">' . esc_html__( 'Edit', 'caldera-forms' ) . '</button> {{/if}}';
|
579 |
+
|
580 |
}
|
581 |
+
echo '{{#if ../../is_active}}<button class="button button-small ajax-trigger view-entry-btn" id="view-entry-{{_entry_id}}" data-active-class="current-view" data-static="true" data-load-class="spinner" ' . $viewer_buttons . ' data-group="viewentry" data-entry="{{_entry_id}}" data-form="{{../../form}}" data-action="get_entry" data-modal="view_entry" data-modal-width="700" data-modal-height="700" data-modal-title="' . esc_attr__('Entry', 'caldera-forms' ) . ' #{{_entry_id}}" data-template="#view-entry-tmpl" type="button" data-nonce="' . wp_create_nonce( 'cf_view_entry' ) . '">' . esc_html__( 'View', 'caldera-forms' ) . '</button> {{/if}}';
|
582 |
if( current_user_can( 'delete_others_posts' ) ){
|
583 |
+
echo '<button type="button" class="button button-small ajax-trigger" data-load-class="active" data-panel="{{#if ../../is_trash}}trash{{/if}}{{#if ../../is_active}}active{{/if}}" data-do="{{#if ../../is_trash}}active{{/if}}{{#if ../../is_active}}trash{{/if}}" data-callback="cf_refresh_view" data-form="{{../../form}}" data-active-class="disabled" data-group="row{{_entry_id}}" data-load-element="#entry_row_{{_entry_id}}" data-action="cf_bulk_action" data-items="{{_entry_id}}">{{#if ../../is_trash}}' . __('Restore', 'caldera-forms' ) . '{{/if}}{{#if ../../is_active}}' . esc_html__( 'Trash', 'caldera-forms' ) . '{{/if}}</button>';
|
584 |
}
|
585 |
|
586 |
}
|
587 |
+
|
588 |
+
/**
|
589 |
+
* Set buttons for entry viewer
|
590 |
+
*
|
591 |
+
* @since 1.4.0
|
592 |
+
*
|
593 |
+
* @uses "caldera_forms_entry_viewer_buttons" filter
|
594 |
+
*
|
595 |
+
* @param array $buttons
|
596 |
+
*
|
597 |
+
* @return array
|
598 |
+
*/
|
599 |
public static function set_viewer_buttons($buttons){
|
600 |
+
|
601 |
+
$buttons[ 'close_panel' ] = array(
|
602 |
+
'label' => esc_html__( 'Close', 'caldera-forms' ),
|
603 |
+
'config' => 'dismiss',
|
604 |
+
'class' => 'right'
|
605 |
);
|
606 |
+
|
607 |
+
if ( current_user_can( 'edit_others_posts' ) ) {
|
608 |
+
$buttons[ 'edit_entry' ] = array(
|
609 |
+
'label' => esc_html__( 'Edit Entry', 'caldera-forms' ),
|
610 |
+
'config' => array(
|
611 |
+
'data-trigger' => '#edit-entry-{{_entry_id}}'
|
612 |
),
|
613 |
+
'class' => 'button-primary'
|
614 |
);
|
615 |
}
|
616 |
|
617 |
return $buttons;
|
618 |
}
|
619 |
|
620 |
+
|
621 |
public static function set_editor_buttons($buttons){
|
622 |
|
623 |
$buttons['submit_form'] = array(
|
624 |
+
'label' => esc_html__( 'Save Changes', 'caldera-forms' ),
|
625 |
'config' => array(
|
626 |
"data-for" => "#view_entry_baldrickModalBody .caldera_forms_form"
|
627 |
),
|
628 |
'class' => 'right button-primary'
|
629 |
);
|
630 |
$buttons['view_entry'] = array(
|
631 |
+
'label' => esc_html__( 'View Entry', 'caldera-forms' ),
|
632 |
'config' => array(
|
633 |
"data-for" => ".view-entry-btn.current-view"
|
634 |
),
|
635 |
'class' => ''
|
636 |
+
);
|
637 |
+
|
638 |
+
|
639 |
return $buttons;
|
640 |
}
|
641 |
|
665 |
function shortcode_insert_button(){
|
666 |
global $post;
|
667 |
if(!empty($post)){
|
668 |
+
echo "<a id=\"caldera-forms-form-insert\" title=\"". esc_attr__( 'Add Form to Page', 'caldera-forms' ) . "\" class=\"button caldera-forms-insert-button\" href=\"#inst\">\n";
|
669 |
+
echo " <img src=\"". CFCORE_URL . "assets/images/lgo-icon.png\" alt=\"". esc_attr__( 'Insert Form Shortcode' , 'caldera-forms') . "\" style=\"padding: 0px 2px 0px 0px; width: 16px; margin: -2px 0px 0px;\" /> ".__('Caldera Form', 'caldera-forms' )."\n";
|
670 |
echo "</a>\n";
|
671 |
}
|
672 |
}
|
673 |
function shortcode_insert_button_fs($buttons){
|
674 |
+
|
675 |
$buttons['caldera-forms'] = array(
|
676 |
+
"title" => __( 'Add Form to Page', 'caldera-forms' ),
|
677 |
"both" => true
|
678 |
);
|
679 |
return $buttons;
|
687 |
* @since unknown
|
688 |
*/
|
689 |
public static function toggle_form_state(){
|
690 |
+
if( ! isset( $_POST[ 'nonce' ] ) || !wp_verify_nonce( $_POST[ 'nonce' ], 'toggle_form_state' ) ){
|
691 |
+
wp_send_json_error( $_POST );
|
692 |
+
}
|
693 |
|
694 |
$forms = Caldera_Forms_Forms::get_forms( true );
|
695 |
$form = sanitize_text_field( $_POST['form'] );
|
702 |
|
703 |
Caldera_Forms_Forms::form_state( $form );
|
704 |
$state = 'active-form';
|
705 |
+
$label = esc_html__( 'Deactivate', 'caldera-forms' );
|
706 |
}else{
|
707 |
Caldera_Forms_Forms::form_state( $form , false );
|
708 |
$state = 'draft-form';
|
709 |
+
$label = esc_html__( 'Activate', 'caldera-forms' );
|
710 |
}
|
711 |
|
712 |
|
727 |
/**
|
728 |
* Show entries in admin
|
729 |
*
|
730 |
+
* @deprecated 1.4.0 Use Caldera_Forms_Entry_UI::view_entries()
|
731 |
+
*
|
732 |
* @since unknown
|
733 |
*/
|
734 |
public static function browse_entries(){
|
735 |
+
_deprecated_function( __FUNCTION__, '1.4.0', 'Caldera_Forms_Entry_UI::view_entries' );
|
736 |
self::verify_ajax_action();
|
737 |
if ( isset( $_POST[ 'page' ] ) && 0 < $_POST[ 'page' ] ) {
|
738 |
$page = absint( $_POST[ 'page' ] );
|
744 |
$perpage = absint( (int) $_POST[ 'perpage' ] );
|
745 |
if( $entry_perpage != $perpage ){
|
746 |
update_option( '_caldera_forms_entry_perpage', $perpage );
|
747 |
+
}
|
748 |
}else{
|
749 |
$perpage = $entry_perpage;
|
750 |
}
|
756 |
}
|
757 |
|
758 |
$form = Caldera_Forms_Forms::get_form( $_POST['form'] );
|
759 |
+
|
760 |
$data = self::get_entries( $form, $page, $perpage, $status );
|
761 |
|
762 |
// set status output
|
797 |
$field_labels = array();
|
798 |
$backup_labels = array();
|
799 |
$selects = array();
|
800 |
+
|
|
|
|
|
|
|
801 |
|
802 |
$fields = array();
|
803 |
+
if ( ! empty( $form[ 'fields' ] ) ) {
|
804 |
+
foreach ( $form[ 'fields' ] as $fid => $field ) {
|
805 |
+
$fields[ $field[ 'slug' ] ] = $field;
|
806 |
|
807 |
+
if ( ! empty( $field[ 'entry_list' ] ) ) {
|
808 |
+
$selects[] = "'" . $field[ 'slug' ] . "'";
|
809 |
+
$field_labels[ $field[ 'slug' ] ] = $field[ 'label' ];
|
810 |
}
|
811 |
$has_vars = array();
|
812 |
+
if ( ! empty( $form[ 'variables' ][ 'types' ] ) ) {
|
813 |
+
$has_vars = $form[ 'variables' ][ 'types' ];
|
814 |
}
|
815 |
+
if ( ( count( $backup_labels ) < 4 && ! in_array( 'entryitem', $has_vars ) ) && in_array( $field[ 'type' ], array(
|
816 |
+
'text',
|
817 |
+
'email',
|
818 |
+
'date',
|
819 |
+
'name'
|
820 |
+
) )
|
821 |
+
) {
|
822 |
// backup only first 4 fields
|
823 |
+
$backup_labels[ $field[ 'slug' ] ] = $field[ 'label' ];
|
824 |
}
|
825 |
}
|
826 |
}
|
827 |
+
|
828 |
+
if ( empty( $field_labels ) ) {
|
829 |
$field_labels = $backup_labels;
|
830 |
}
|
831 |
+
|
832 |
+
$entries = new Caldera_Forms_Entry_Entries( $form, $perpage );
|
833 |
|
834 |
$data = array();
|
835 |
|
836 |
$filter = null;
|
837 |
|
838 |
+
$data[ 'trash' ] = $entries->get_total( 'trash' );
|
839 |
+
$data[ 'active' ] = $entries->get_total( 'active' );
|
840 |
|
841 |
// set current total
|
842 |
+
if ( ! empty( $status ) && isset( $data[ $status ] ) ) {
|
843 |
+
$data[ 'total' ] = $entries->get_total( $status );
|
844 |
+
} else {
|
845 |
+
$data[ 'total' ] = $data[ 'active' ];
|
846 |
}
|
847 |
|
848 |
|
849 |
+
$data[ 'pages' ] = ceil( $data[ 'total' ] / $perpage );
|
850 |
|
851 |
+
if ( ! empty( $page ) ) {
|
852 |
$page = abs( $page );
|
853 |
+
if ( $page > $data[ 'pages' ] ) {
|
854 |
+
$page = $data[ 'pages' ];
|
855 |
}
|
856 |
}
|
857 |
|
858 |
$data['current_page'] = $page;
|
859 |
+
|
860 |
if($data['total'] > 0){
|
861 |
|
862 |
+
$data[ 'form' ] = $form_id;
|
863 |
|
864 |
+
$data[ 'fields' ] = $field_labels;
|
|
|
|
|
865 |
|
866 |
|
867 |
+
$the_entries = $entries->get_page( $page, $status );
|
868 |
|
869 |
+
if ( ! empty( $the_entries ) ) {
|
|
|
|
|
|
|
|
|
870 |
|
871 |
+
$ids = array();
|
872 |
+
$data[ 'entries' ] = array();
|
873 |
|
|
|
874 |
|
875 |
+
/** @var Caldera_Forms_Entry $an_entry */
|
876 |
+
foreach ( $the_entries as $an_entry ) {
|
877 |
+
$ids[] = $an_entry->get_entry_id();
|
878 |
}
|
879 |
+
// init field types to initialize view rendering in entry lists
|
880 |
+
Caldera_Forms::get_field_types();
|
881 |
+
|
882 |
+
foreach ( $ids as $entry_id ) {
|
883 |
+
$rows = $entries->get_rows( $page, (int) $entry_id, $status );
|
884 |
+
foreach ( $rows as $row ) {
|
885 |
+
$e = 'E' . $row->entry_id;
|
886 |
+
if ( ! empty( $row->_user_id ) ) {
|
887 |
+
$user = get_userdata( $row->_user_id );
|
888 |
+
if ( ! empty( $user ) ) {
|
889 |
+
$data[ 'entries' ][ $e ][ 'user' ][ 'ID' ] = $user->ID;
|
890 |
+
$data[ 'entries' ][ $e ][ 'user' ][ 'name' ] = $user->data->display_name;
|
891 |
+
$data[ 'entries' ][ $e ][ 'user' ][ 'email' ] = $user->data->user_email;
|
892 |
+
$data[ 'entries' ][ $e ][ 'user' ][ 'avatar' ] = get_avatar( $user->ID, 64 );
|
893 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
894 |
}
|
|
|
|
|
895 |
|
896 |
+
$data[ 'entries' ][ $e ][ '_entry_id' ] = $row->entry_id;
|
897 |
|
898 |
+
$submitted = $row->_datestamp;
|
899 |
|
900 |
|
901 |
+
$data[ 'entries' ][ $e ][ '_date' ] = Caldera_Forms::localize_time( $submitted );
|
902 |
|
903 |
+
// setup default data array
|
904 |
+
if ( ! isset( $data[ 'entries' ][ $e ][ 'data' ] ) ) {
|
905 |
+
if ( isset( $field_labels ) ) {
|
906 |
+
foreach ( $field_labels as $slug => $label ) {
|
907 |
+
// setup labels ordering
|
908 |
+
$data[ 'entries' ][ $e ][ 'data' ][ $slug ] = null;
|
909 |
+
}
|
910 |
}
|
911 |
}
|
|
|
912 |
|
913 |
+
if ( ! empty( $field_labels[ $row->slug ] ) ) {
|
914 |
|
915 |
+
$label = $field_labels[ $row->slug ];
|
916 |
|
917 |
+
// check view handler
|
918 |
+
$field = $fields[ $row->slug ];
|
919 |
+
// filter the field to get field data
|
920 |
+
$field = apply_filters( 'caldera_forms_render_get_field', $field, $form );
|
921 |
+
$field = apply_filters( 'caldera_forms_render_get_field_type-' . $field[ 'type' ], $field, $form );
|
922 |
+
$field = apply_filters( 'caldera_forms_render_get_field_slug-' . $field[ 'slug' ], $field, $form );
|
923 |
|
924 |
+
// maybe json?
|
925 |
+
$is_json = json_decode( $row->value, ARRAY_A );
|
926 |
+
if ( ! empty( $is_json ) ) {
|
927 |
+
$row->value = $is_json;
|
928 |
+
}
|
929 |
|
930 |
if( is_string( $row->value ) ){
|
931 |
$row->value = esc_html( stripslashes_deep( $row->value ) );
|
933 |
$row->value = stripslashes_deep( Caldera_Forms_Sanitize::sanitize( $row->value ) );
|
934 |
}
|
935 |
|
936 |
+
$row->value = apply_filters( 'caldera_forms_view_field_' . $field[ 'type' ], $row->value, $field, $form );
|
937 |
|
938 |
|
939 |
+
if ( isset( $data[ 'entries' ][ $e ][ 'data' ][ $row->slug ] ) ) {
|
940 |
+
// array based - add another entry
|
941 |
+
if ( ! is_array( $data[ 'entries' ][ $e ][ 'data' ][ $row->slug ] ) ) {
|
942 |
+
$tmp = $data[ 'entries' ][ $e ][ 'data' ][ $row->slug ];
|
943 |
+
$data[ 'entries' ][ $e ][ 'data' ][ $row->slug ] = array( $tmp );
|
944 |
+
}
|
945 |
+
$data[ 'entries' ][ $e ][ 'data' ][ $row->slug ][] = $row->value;
|
946 |
+
} else {
|
947 |
+
$data[ 'entries' ][ $e ][ 'data' ][ $row->slug ] = $row->value;
|
948 |
}
|
|
|
|
|
|
|
949 |
}
|
|
|
950 |
|
951 |
+
if ( ! empty( $form[ 'variables' ][ 'types' ] ) ) {
|
952 |
+
foreach ( $form[ 'variables' ][ 'types' ] as $var_key => $var_type ) {
|
953 |
+
if ( $var_type == 'entryitem' ) {
|
954 |
+
$data[ 'fields' ][ $form[ 'variables' ][ 'keys' ][ $var_key ] ] = ucwords( str_replace( '_', ' ', $form[ 'variables' ][ 'keys' ][ $var_key ] ) );
|
955 |
+
$data[ 'entries' ][ $e ][ 'data' ][ $form[ 'variables' ][ 'keys' ][ $var_key ] ] = Caldera_Forms::do_magic_tags( $form[ 'variables' ][ 'values' ][ $var_key ], $row->_entryid );
|
956 |
+
}
|
957 |
}
|
958 |
}
|
|
|
959 |
|
960 |
|
961 |
+
}
|
962 |
}
|
963 |
}
|
964 |
}
|
991 |
*/
|
992 |
public function register_admin_page(){
|
993 |
global $menu, $submenu;
|
994 |
+
|
995 |
$forms = Caldera_Forms_Forms::get_forms( true );
|
996 |
|
997 |
// get current user
|
998 |
if( current_user_can( Caldera_Forms::get_manage_cap() ) ){
|
999 |
+
|
1000 |
+
$this->screen_prefix[] = add_menu_page( __('Caldera Forms', 'caldera-forms' ), __('Caldera Forms', 'caldera-forms' ), Caldera_Forms::get_manage_cap(), $this->plugin_slug, array( $this, 'render_admin' ), 'dashicons-cf-logo', 52.81321 );
|
1001 |
+
add_submenu_page( $this->plugin_slug, __('Caldera Forms Admin', 'caldera-forms' ), __('Forms', 'caldera-forms' ), Caldera_Forms::get_manage_cap(), $this->plugin_slug, array( $this, 'render_admin' ) );
|
1002 |
+
|
1003 |
if( ! empty( $forms ) ){
|
1004 |
foreach($forms as $form_id=>$form){
|
1005 |
if(!empty($form['pinned'])){
|
1006 |
+
$this->screen_prefix[] = add_submenu_page( $this->plugin_slug, __('Caldera Forms', 'caldera-forms' ).' - ' . $form['name'], '- '.$form['name'], Caldera_Forms::get_manage_cap(), $this->plugin_slug . '-pin-' . $form_id, array( $this, 'render_admin' ) );
|
1007 |
}
|
1008 |
}
|
1009 |
+
}
|
1010 |
|
1011 |
|
1012 |
+
$this->screen_prefix[] = add_submenu_page( $this->plugin_slug, __('Caldera Forms', 'caldera-forms' ) .' - '. __('Community', 'caldera-forms' ), __('Community', 'caldera-forms' ), Caldera_Forms::get_manage_cap(), $this->plugin_slug . '-community', array( $this, 'render_admin' ) );
|
1013 |
+
$this->screen_prefix[] = add_submenu_page( $this->plugin_slug, __('Caldera Forms', 'caldera-forms' ) . ' - ' . __('Extend', 'caldera-forms' ), __('Extend', 'caldera-forms' ), Caldera_Forms::get_manage_cap(), $this->plugin_slug . '-exend', array( $this, 'render_admin' ) );
|
1014 |
}else{
|
1015 |
// not an admin - pin for user
|
1016 |
if( ! empty( $forms ) ){
|
1054 |
if( empty( $this->screen_prefix ) ){
|
1055 |
// make top menu
|
1056 |
$main_slug = $this->plugin_slug . '-pin-' . $form_id;
|
1057 |
+
$this->screen_prefix[] = add_menu_page( __('Caldera Forms', 'caldera-forms' ), __('Caldera Forms', 'caldera-forms' ), $capability, $main_slug, array( $this, 'render_admin' ), 'dashicons-cf-logo', 52.999 );
|
1058 |
+
|
1059 |
}
|
1060 |
|
1061 |
+
$this->screen_prefix[] = add_submenu_page( $main_slug, __('Caldera Forms', 'caldera-forms' ).' - ' . $form['name'], $form['name'], $capability, $this->plugin_slug . '-pin-' . $form_id, array( $this, 'render_admin' ) );
|
1062 |
+
|
1063 |
}
|
1064 |
}
|
1065 |
}
|
1084 |
wp_enqueue_style( $this->plugin_slug . '-modal-styles', CFCORE_URL . 'assets/css/modals.css', array(), self::VERSION );
|
1085 |
wp_enqueue_script( $this->plugin_slug . '-shortcode-insert', CFCORE_URL . 'assets/js/shortcode-insert.min.js', array( 'jquery' ), self::VERSION );
|
1086 |
wp_enqueue_style( 'wp-color-picker' );
|
1087 |
+
wp_enqueue_script( 'wp-color-picker' );
|
1088 |
}
|
1089 |
|
1090 |
if ( ! in_array( $screen->base, $this->screen_prefix ) ) {
|
1261 |
/**
|
1262 |
* Renders the admin pages
|
1263 |
*
|
1264 |
+
*/
|
1265 |
public function render_admin(){
|
1266 |
+
|
1267 |
echo " <div class=\"wrap\">\r\n";
|
1268 |
if(!empty($_GET['edit'])){
|
1269 |
echo "<form method=\"POST\" action=\"admin.php?page=" . $this->plugin_slug . "\" data-load-element=\"#save_indicator\" data-sender=\"ajax\" class=\"caldera-forms-options-form edit-update-trigger\">\r\n";
|
1270 |
+
include CFCORE_PATH . 'ui/edit.php';
|
1271 |
echo "</form>\r\n";
|
1272 |
}elseif(!empty($_GET['page']) && $_GET['page'] == 'caldera-forms-exend'){
|
1273 |
include CFCORE_PATH . 'ui/extend.php';
|
1295 |
return;
|
1296 |
}
|
1297 |
|
|
|
|
|
1298 |
/// check for form delete
|
1299 |
if(!empty($_GET['delete']) && !empty($_GET['cal_del']) && current_user_can( Caldera_Forms::get_manage_cap( 'save' ), strip_tags( $_GET[ 'delete' ] ) ) ){
|
1300 |
|
1301 |
if ( ! wp_verify_nonce( $_GET['cal_del'], 'cf_del_frm' ) ) {
|
1302 |
// This nonce is not valid.
|
1303 |
+
wp_die( __('Sorry, please try again', 'caldera-forms' ), __('Form Delete Error', 'caldera-forms' ) );
|
1304 |
}else{
|
1305 |
$deleted = Caldera_Forms_Forms::delete_form( strip_tags( $_GET['delete'] ) );
|
1306 |
if ( $deleted ) {
|
1307 |
wp_redirect( 'admin.php?page=caldera-forms' );
|
1308 |
exit;
|
1309 |
} else {
|
1310 |
+
wp_die( __('Sorry, please try again', 'caldera-forms' ), __('Form could not be deleted.', 'caldera-forms' ) );
|
1311 |
}
|
1312 |
|
1313 |
}
|
1314 |
+
|
1315 |
}
|
1316 |
|
1317 |
/** IMPORT */
|
1362 |
$form = Caldera_Forms_Forms::get_form( $_GET['export-form'] );
|
1363 |
|
1364 |
if(empty($form)){
|
1365 |
+
wp_die( __('Form does not exist.', 'caldera-forms' ) );
|
1366 |
}
|
1367 |
|
1368 |
header("Pragma: public");
|
1386 |
|
1387 |
$structure = "/**\r\n * Filter admin forms to include custom form in admin\r\n *\r\n * @since 1.3.1\r\n *\r\n * @param array \$forms All registered forms\r\n */\r\n";
|
1388 |
$structure .= 'add_filter( "caldera_forms_get_forms", function( $forms ){' . "\r\n";
|
1389 |
+
$structure .= "\t" . '$forms["' . $form_id . '"] = apply_filters( "caldera_forms_get_form-' . $form_id . '", array() );' . "\r\n";
|
1390 |
+
$structure .= "\t" . 'return $forms;' . "\r\n";
|
1391 |
$structure .= "} );\r\n\r\n";
|
1392 |
|
1393 |
$structure .= "/**\r\n * Filter form request to include form structure to be rendered\r\n *\r\n * @since 1.3.1\r\n *\r\n * @param \$form array form structure\r\n */\r\n";
|
1438 |
if(!empty($items)){
|
1439 |
$filter = ' AND `entry`.`id` IN (' . implode(',', $items) . ') ';
|
1440 |
}else{
|
1441 |
+
wp_die( __('Export selection has expired', 'caldera-forms' ) , __('Export Expired', 'caldera-forms' ) );
|
1442 |
}
|
1443 |
}
|
1444 |
|
1507 |
}
|
1508 |
fputcsv($df, $row);
|
1509 |
}
|
1510 |
+
fclose($df);
|
1511 |
+
exit;
|
1512 |
}
|
1513 |
|
1514 |
if( isset($_POST['config']) && isset( $_POST['cf_edit_nonce'] ) && current_user_can( Caldera_Forms::get_manage_cap( 'manage' ) ) ){
|
1515 |
+
|
1516 |
// if this fails, check_admin_referer() will automatically print a "failed" page and die.
|
1517 |
if ( check_admin_referer( 'cf_edit_element', 'cf_edit_nonce' ) ) {
|
1518 |
+
|
1519 |
// strip slashes
|
1520 |
$data = json_decode( stripslashes_deep($_POST['config']) , ARRAY_A );
|
1521 |
self::save_a_form( $data );
|
1561 |
public function get_panel_extensions($panels){
|
1562 |
|
1563 |
$path = CFCORE_PATH . "ui/panels/";
|
1564 |
+
|
1565 |
$internal_panels = array(
|
1566 |
'form_layout' => array(
|
1567 |
+
"name" => __( 'Layout', 'caldera-forms' ),
|
1568 |
"setup" => array(
|
1569 |
"scripts" => array(
|
1570 |
'jquery-ui-sortable',
|
1571 |
'jquery-ui-draggable',
|
1572 |
'jquery-ui-droppable',
|
|
|
|
|
1573 |
),
|
1574 |
"styles" => array(
|
1575 |
CFCORE_URL . "assets/css/editor-grid.css",
|
1578 |
),
|
1579 |
"tabs" => array(
|
1580 |
"layout" => array(
|
1581 |
+
"name" => __( 'Layout', 'caldera-forms' ),
|
1582 |
"location" => "lower",
|
1583 |
+
"label" => __( 'Layout Builder', 'caldera-forms' ),
|
1584 |
"active" => true,
|
1585 |
"actions" => array(
|
1586 |
$path . "layout_toolbar.php"
|
1590 |
"side_panel" => $path . "layout_side.php",
|
1591 |
),
|
1592 |
"pages" => array(
|
1593 |
+
"name" => __( 'Pages', 'caldera-forms' ),
|
1594 |
"location" => "lower",
|
1595 |
+
"label" => __( 'Form Pages', 'caldera-forms' ),
|
1596 |
"canvas" => $path . "pages.php",
|
1597 |
),
|
1598 |
+
"mailer" => array(
|
1599 |
+
"name" => __( 'Email', 'caldera-forms' ),
|
1600 |
"location" => "lower",
|
1601 |
+
"label" => __( 'Email Notification Settings', 'caldera-forms' ),
|
1602 |
+
"canvas" => $path . "emailer.php",
|
1603 |
+
),
|
1604 |
"processors" => array(
|
1605 |
+
"name" => __( 'Processors', 'caldera-forms' ),
|
1606 |
"location" => "lower",
|
1607 |
+
"label" => __( 'Form Processors', 'caldera-forms' ),
|
1608 |
"canvas" => $path . "processors.php",
|
1609 |
),
|
1610 |
+
"conditions" => array(
|
1611 |
+
"name" => __( 'Conditions', 'caldera-forms' ),
|
1612 |
+
"location" => "lower",
|
1613 |
+
"label" => __( 'Conditions', 'caldera-forms' ),
|
1614 |
+
"canvas" => $path . "conditions.php",
|
1615 |
+
),
|
1616 |
"variables" => array(
|
1617 |
+
"name" => __( 'Variables', 'caldera-forms' ),
|
1618 |
"location" => "lower",
|
1619 |
+
"label" => __( 'Variables', 'caldera-forms' ),
|
1620 |
"canvas" => $path . "variables.php",
|
1621 |
"actions" => array(
|
1622 |
$path . "variable_add.php"
|
1623 |
+
),
|
1624 |
),
|
1625 |
"responsive" => array(
|
1626 |
+
"name" => __( 'Responsive', 'caldera-forms' ),
|
1627 |
"location" => "lower",
|
1628 |
+
"label" => __( 'Responsive Settings', 'caldera-forms' ),
|
1629 |
"repeat" => 0,
|
1630 |
"fields" => array(
|
1631 |
"break_point" => array(
|
1632 |
+
"label" => __( 'Grid Collapse', 'caldera-forms' ),
|
1633 |
"slug" => "break_point",
|
1634 |
+
"caption" => __( 'Set the smallest screen size at which to collapse the grid. (based on Bootstrap 3.0)', 'caldera-forms' ),
|
1635 |
"type" => "radio",
|
1636 |
"config" => array(
|
1637 |
"default" => "sm",
|
1638 |
"option" => array(
|
1639 |
"xs" => array(
|
1640 |
'value' => 'xs',
|
1641 |
+
'label' => __('Maintain grid always', 'caldera-forms' ),
|
1642 |
),
|
1643 |
"sm" => array(
|
1644 |
'value' => 'sm',
|
1657 |
)
|
1658 |
),
|
1659 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1660 |
),
|
1661 |
),
|
1662 |
);
|
1663 |
+
|
1664 |
return array_merge( $panels, $internal_panels );
|
1665 |
+
|
1666 |
}
|
1667 |
|
1668 |
/**
|
1734 |
);
|
1735 |
$message = '<p>' . implode( ' ', $message ) . '</p>';
|
1736 |
|
1737 |
+
$message .= sprintf( '<p style="display:inline;float:left;" ><a type="button" class="button button-secondary" href="%s">%s</a></p>', esc_url_raw( $dismiss ), __( 'No Thanks', 'caldera-forms' ) );
|
1738 |
|
1739 |
+
$message .= sprintf( '<p style="display:inline; float:right;"><a type="button" class="button button-primary" href="%s">%s</a>', esc_url_raw( $allow ), __( 'Help Us & Save', 'caldera-forms' ) );
|
1740 |
|
1741 |
self::create_admin_notice( __( 'Help us improve Caldera Forms & Get 10% Off At CalderaWP.com', 'caldera-forms' ), $message, false );
|
1742 |
}else{
|
1783 |
<script type="text/html" id="<?php echo esc_attr( sanitize_key('admin-modal' . $title ) ); ?>">
|
1784 |
<?php echo $content; ?>
|
1785 |
</script>
|
1786 |
+
<?php
|
1787 |
}
|
1788 |
|
1789 |
/**
|
1873 |
|
1874 |
switch( $context ) {
|
1875 |
case 'export' :
|
1876 |
+
case 'entry-view' :
|
1877 |
+
if( ! empty( $form[ 'pinned' ] ) ){
|
1878 |
if( isset( $form[ 'pin_roles' ][ 'access_role' ] ) && is_array($form[ 'pin_roles' ][ 'access_role' ] ) ){
|
1879 |
+
$user = wp_get_current_user();
|
1880 |
+
foreach( $form[ 'pin_roles' ][ 'access_role' ] as $role => $i ) {
|
1881 |
+
if( in_array( $role, $user->roles ) ){
|
1882 |
+
return $role;
|
1883 |
}
|
1884 |
}
|
1885 |
}
|
1886 |
}
|
1887 |
|
1888 |
break;
|
1889 |
+
|
1890 |
}
|
1891 |
|
1892 |
return $cap;
|
1893 |
|
1894 |
}
|
1895 |
+
|
1896 |
+
|
1897 |
|
1898 |
}
|
1899 |
|
classes/autoloader.php
CHANGED
@@ -19,7 +19,7 @@ class Caldera_Forms_Autoloader {
|
|
19 |
*
|
20 |
* 'prefix' => 'path'
|
21 |
*
|
22 |
-
* @since 1.3.
|
23 |
*
|
24 |
* @var array
|
25 |
*/
|
@@ -28,7 +28,7 @@ class Caldera_Forms_Autoloader {
|
|
28 |
/**
|
29 |
* Add a route path and prefix
|
30 |
*
|
31 |
-
* @since 1.3.
|
32 |
*
|
33 |
* @param string $prefix Class prefix -- Must start with "Caldera_Forms" or "CF_" use "CF_" for add-ons
|
34 |
* @param string $dir Full path to directory
|
@@ -41,7 +41,7 @@ class Caldera_Forms_Autoloader {
|
|
41 |
/**
|
42 |
* Handles autoloading of Caldera Forms and Caldera Forms add-on classes.
|
43 |
*
|
44 |
-
* @since 1.3.
|
45 |
*
|
46 |
* @param string $class
|
47 |
*/
|
@@ -60,6 +60,10 @@ class Caldera_Forms_Autoloader {
|
|
60 |
$file = $dir . 'core.php';
|
61 |
} elseif ( 'Caldera_Form_Grid' == $class ) {
|
62 |
$file = $dir . 'caldera-grid.php';
|
|
|
|
|
|
|
|
|
63 |
} else {
|
64 |
$file = $dir . self::get_base( $class, $root );
|
65 |
}
|
@@ -68,6 +72,7 @@ class Caldera_Forms_Autoloader {
|
|
68 |
if ( is_file( $file ) ) {
|
69 |
require_once $file;
|
70 |
}
|
|
|
71 |
}
|
72 |
|
73 |
}
|
@@ -75,7 +80,7 @@ class Caldera_Forms_Autoloader {
|
|
75 |
/**
|
76 |
* Get the root prefix for a class
|
77 |
*
|
78 |
-
* @since 1.3.
|
79 |
*
|
80 |
* @param string $class Class name
|
81 |
*
|
@@ -94,7 +99,7 @@ class Caldera_Forms_Autoloader {
|
|
94 |
/**
|
95 |
* Get the directory for a prefix
|
96 |
*
|
97 |
-
* @since 1.3.
|
98 |
*
|
99 |
* @param string $root Prefix root
|
100 |
*
|
@@ -121,7 +126,7 @@ class Caldera_Forms_Autoloader {
|
|
121 |
/**
|
122 |
* Registers Caldera_Forms_Autoloader as an SPL autoloader.
|
123 |
*
|
124 |
-
* @since 1.3.
|
125 |
|
126 |
*/
|
127 |
public static function register( ) {
|
19 |
*
|
20 |
* 'prefix' => 'path'
|
21 |
*
|
22 |
+
* @since 1.3.5.3
|
23 |
*
|
24 |
* @var array
|
25 |
*/
|
28 |
/**
|
29 |
* Add a route path and prefix
|
30 |
*
|
31 |
+
* @since 1.3.5.3
|
32 |
*
|
33 |
* @param string $prefix Class prefix -- Must start with "Caldera_Forms" or "CF_" use "CF_" for add-ons
|
34 |
* @param string $dir Full path to directory
|
41 |
/**
|
42 |
* Handles autoloading of Caldera Forms and Caldera Forms add-on classes.
|
43 |
*
|
44 |
+
* @since 1.3.5.3
|
45 |
*
|
46 |
* @param string $class
|
47 |
*/
|
60 |
$file = $dir . 'core.php';
|
61 |
} elseif ( 'Caldera_Form_Grid' == $class ) {
|
62 |
$file = $dir . 'caldera-grid.php';
|
63 |
+
} elseif( 'Caldera_Forms_Entry' == $class ) {
|
64 |
+
$file = CFCORE_PATH . 'classes/entry.php';
|
65 |
+
} elseif ( 'Caldera_Forms_Save_Final' == $class ){
|
66 |
+
$file = CFCORE_PATH . 'classes/save.php';
|
67 |
} else {
|
68 |
$file = $dir . self::get_base( $class, $root );
|
69 |
}
|
72 |
if ( is_file( $file ) ) {
|
73 |
require_once $file;
|
74 |
}
|
75 |
+
|
76 |
}
|
77 |
|
78 |
}
|
80 |
/**
|
81 |
* Get the root prefix for a class
|
82 |
*
|
83 |
+
* @since 1.3.5.3
|
84 |
*
|
85 |
* @param string $class Class name
|
86 |
*
|
99 |
/**
|
100 |
* Get the directory for a prefix
|
101 |
*
|
102 |
+
* @since 1.3.5.3
|
103 |
*
|
104 |
* @param string $root Prefix root
|
105 |
*
|
126 |
/**
|
127 |
* Registers Caldera_Forms_Autoloader as an SPL autoloader.
|
128 |
*
|
129 |
+
* @since 1.3.5.3
|
130 |
|
131 |
*/
|
132 |
public static function register( ) {
|
classes/core.php
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
* @package Caldera_Forms
|
7 |
* @author David <david@digilab.co.za>
|
8 |
* @license GPL-2.0+
|
9 |
-
* @link
|
10 |
* @copyright 2014 David Cramer
|
11 |
*/
|
12 |
|
@@ -77,8 +77,7 @@ class Caldera_Forms {
|
|
77 |
|
78 |
// action
|
79 |
add_action('caldera_forms_submit_complete', array( $this, 'save_final_form'),50);
|
80 |
-
|
81 |
-
add_action("wp_ajax_get_entry", array( $this, 'get_entry') );
|
82 |
// find if profile is loaded
|
83 |
add_action('wp_loaded', array( $this, 'cf_init_system'), 25 );
|
84 |
add_action('wp', array( $this, 'cf_init_preview'));
|
@@ -89,11 +88,34 @@ class Caldera_Forms {
|
|
89 |
add_shortcode( 'caldera_form_modal', array( $this, 'shortcode_handler') );
|
90 |
add_action( 'wp_footer', array( $this, 'render_footer_modals') );
|
91 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
|
93 |
/**
|
94 |
* Runs after Caldera Forms core is initialized
|
95 |
*
|
96 |
-
* @since 1.3.
|
97 |
*/
|
98 |
do_action( 'caldera_forms_core_init' );
|
99 |
|
@@ -161,10 +183,11 @@ class Caldera_Forms {
|
|
161 |
caldera_forms_db_v2_update();
|
162 |
}
|
163 |
|
164 |
-
if( $db_version <
|
165 |
self::activate_caldera_forms( true );
|
166 |
-
caldera_forms_write_db_flag(
|
167 |
}
|
|
|
168 |
}
|
169 |
|
170 |
|
@@ -179,12 +202,12 @@ class Caldera_Forms {
|
|
179 |
public static function activate_caldera_forms( $force = false ){
|
180 |
wp_schedule_event( time(), 'daily', 'caldera_forms_tracking_send_rows' );
|
181 |
global $wpdb;
|
182 |
-
|
183 |
// ensure urls are there
|
184 |
self::init_cf_internal();
|
185 |
|
186 |
$version = get_option('_calderaforms_lastupdate');
|
187 |
-
|
188 |
// ensure rewrites
|
189 |
flush_rewrite_rules();
|
190 |
|
@@ -193,7 +216,7 @@ class Caldera_Forms {
|
|
193 |
return;
|
194 |
}
|
195 |
}
|
196 |
-
|
197 |
update_option('_calderaforms_lastupdate',CFCORE_VER);
|
198 |
|
199 |
$charset_collate = '';
|
@@ -205,6 +228,13 @@ class Caldera_Forms {
|
|
205 |
if ( ! empty( $wpdb->collate ) ) {
|
206 |
$charset_collate .= " COLLATE $wpdb->collate";
|
207 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
208 |
|
209 |
$tables = $wpdb->get_results("SHOW TABLES", ARRAY_A);
|
210 |
foreach($tables as $table){
|
@@ -223,7 +253,7 @@ class Caldera_Forms {
|
|
223 |
`meta_key` varchar(255) DEFAULT NULL,
|
224 |
`meta_value` longtext,
|
225 |
PRIMARY KEY (`meta_id`),
|
226 |
-
KEY `meta_key` (
|
227 |
KEY `entry_id` (`entry_id`)
|
228 |
) " . $charset_collate . ";";
|
229 |
|
@@ -256,49 +286,55 @@ class Caldera_Forms {
|
|
256 |
`meta_key` varchar(255) DEFAULT NULL,
|
257 |
`meta_value` longtext,
|
258 |
PRIMARY KEY (`meta_id`),
|
259 |
-
KEY `meta_key` (`meta_key`),
|
260 |
KEY `event_id` (`event_id`)
|
261 |
) " . $charset_collate . ";";
|
262 |
|
263 |
dbDelta( $meta_table );
|
264 |
|
265 |
-
|
266 |
}
|
267 |
|
268 |
-
|
|
|
269 |
// create tables
|
270 |
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
271 |
|
272 |
-
|
273 |
-
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
274 |
-
`form_id` varchar(18) NOT NULL DEFAULT '',
|
275 |
-
`user_id` int(11) NOT NULL,
|
276 |
-
`datestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
277 |
-
`status` varchar(20) NOT NULL DEFAULT 'active',
|
278 |
-
PRIMARY KEY (`id`),
|
279 |
-
KEY `form_id` (`form_id`),
|
280 |
-
KEY `user_id` (`user_id`),
|
281 |
-
KEY `date_time` (`datestamp`),
|
282 |
-
KEY `status` (`status`)
|
283 |
-
) " . $charset_collate . ";";
|
284 |
-
|
285 |
-
|
286 |
-
dbDelta( $entry_table );
|
287 |
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
299 |
|
300 |
-
dbDelta( $values_table );
|
301 |
-
|
302 |
}else{
|
303 |
if($version >= '1.1.5'){
|
304 |
return; // only if 1.1.4 or lower
|
@@ -342,7 +378,7 @@ class Caldera_Forms {
|
|
342 |
$wpdb->query( "ALTER TABLE `" . $wpdb->prefix . "cf_form_entries` ADD `status` varchar(20) NOT NULL DEFAULT 'active' AFTER `datestamp`;" );
|
343 |
$wpdb->query( "CREATE INDEX `status` ON `" . $wpdb->prefix . "cf_form_entries` (`status`); ");
|
344 |
}
|
345 |
-
|
346 |
}
|
347 |
|
348 |
}
|
@@ -446,7 +482,7 @@ class Caldera_Forms {
|
|
446 |
*/
|
447 |
public static function captcha_check($value, $field, $form){
|
448 |
return true;
|
449 |
-
|
450 |
if( !isset( $_POST['g-recaptcha-response'] ) || empty( $_POST['g-recaptcha-response'] )){
|
451 |
return new WP_Error( 'error' );
|
452 |
}
|
@@ -459,7 +495,7 @@ class Caldera_Forms {
|
|
459 |
$request = wp_remote_get( 'https://www.google.com/recaptcha/api/siteverify?' . build_query($args) );
|
460 |
$result = json_decode( wp_remote_retrieve_body( $request ) );
|
461 |
if( empty( $result->success ) ){
|
462 |
-
return new WP_Error( 'error', __("The wasn't entered correct.", 'caldera-forms') . ' <a href="#" class="reset_' . sanitize_text_field( $_POST[ $field['ID'] ] ) . '">' . __(
|
463 |
}
|
464 |
|
465 |
|
@@ -475,7 +511,7 @@ class Caldera_Forms {
|
|
475 |
*/
|
476 |
public static function update_field_data($field, $entry_id, $form){
|
477 |
global $wpdb, $form;
|
478 |
-
|
479 |
$field_types = self::get_field_types();
|
480 |
// is capture?
|
481 |
if(isset($field_types[$form['fields'][$field['ID']]['type']]['setup']['not_supported'])){
|
@@ -483,10 +519,10 @@ class Caldera_Forms {
|
|
483 |
return;
|
484 |
}
|
485 |
}
|
486 |
-
|
487 |
$new_data = self::get_field_data($field['ID'], $form);
|
488 |
$original_data = self::get_field_data($field['ID'], $form, $entry_id);
|
489 |
-
|
490 |
if($original_data === $new_data){
|
491 |
// no change
|
492 |
return;
|
@@ -499,7 +535,7 @@ class Caldera_Forms {
|
|
499 |
if( has_filter( 'caldera_forms_save_field_' . $field['type'] ) ){
|
500 |
$new_data = apply_filters( 'caldera_forms_update_field_' . $field['type'], $new_data, $field, $form );
|
501 |
}
|
502 |
-
|
503 |
if($original_data !== null){
|
504 |
$wpdb->delete($wpdb->prefix . 'cf_form_entry_values', array('entry_id' => $entry_id, 'field_id' => $field['ID'] ) );
|
505 |
}
|
@@ -557,7 +593,7 @@ class Caldera_Forms {
|
|
557 |
'slug' => $field['slug'],
|
558 |
'value' => self::do_magic_tags( $entry )
|
559 |
);
|
560 |
-
|
561 |
// named key kets .key to slug
|
562 |
if(!is_int($key)){
|
563 |
// Keyed
|
@@ -569,7 +605,7 @@ class Caldera_Forms {
|
|
569 |
}
|
570 |
|
571 |
if(!empty($keyed)){
|
572 |
-
|
573 |
if( has_filter( 'caldera_forms_save_field_combined' . $field['type'] ) ){
|
574 |
$data = apply_filters( 'caldera_forms_save_field_combined' . $field['type'], $entry, $field );
|
575 |
}
|
@@ -614,7 +650,7 @@ class Caldera_Forms {
|
|
614 |
'form_id' => $form['ID']
|
615 |
);
|
616 |
if( sha1( json_encode( $token_array ) ) !== trim( $_POST['_cf_frm_edt_tkn'] ) ){
|
617 |
-
return new WP_Error( 'error', __( "Permission denied.",
|
618 |
}else{
|
619 |
$entryid = (int) $details['id'];
|
620 |
$edit_token = sha1( json_encode( $token_array ) );
|
@@ -628,7 +664,7 @@ class Caldera_Forms {
|
|
628 |
if( current_user_can( 'edit_posts' ) || $details['user_id'] === $user_id ){
|
629 |
$entryid = $_POST['_cf_frm_edt'];
|
630 |
}else{
|
631 |
-
return new WP_Error( 'error', __( "Permission denied.",
|
632 |
}
|
633 |
}
|
634 |
|
@@ -636,14 +672,11 @@ class Caldera_Forms {
|
|
636 |
}
|
637 |
|
638 |
}
|
639 |
-
|
640 |
-
// pull in the class
|
641 |
-
include_once CFCORE_PATH . 'classes/save.php';
|
642 |
-
|
643 |
if(! empty( $form[ 'db_support' ] ) ) {
|
644 |
Caldera_Forms_Save_Final::save_in_db( $form, $entryid );
|
645 |
}
|
646 |
-
|
647 |
if( !empty( $transdata['edit'] ) ){
|
648 |
// update
|
649 |
if( empty($form['mailer']['on_update'] ) ){
|
@@ -655,7 +688,7 @@ class Caldera_Forms {
|
|
655 |
return;
|
656 |
}
|
657 |
}
|
658 |
-
|
659 |
Caldera_Forms_Save_Final::do_mailer( $form, $entryid );
|
660 |
|
661 |
|
@@ -672,14 +705,14 @@ class Caldera_Forms {
|
|
672 |
// this is a hack since there is not filter / action for a failed mail... yet
|
673 |
//$phpmailer->SMTPDebug = 3;
|
674 |
ob_start();
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
$result = ob_get_clean();
|
684 |
|
685 |
$meta_entry = array(
|
@@ -689,7 +722,7 @@ class Caldera_Forms {
|
|
689 |
'meta_value' => $result
|
690 |
);
|
691 |
|
692 |
-
$wpdb->insert($wpdb->prefix . 'cf_form_entry_meta', $meta_entry);
|
693 |
|
694 |
|
695 |
|
@@ -734,7 +767,7 @@ class Caldera_Forms {
|
|
734 |
}
|
735 |
}
|
736 |
}
|
737 |
-
|
738 |
return $notices;
|
739 |
}
|
740 |
|
@@ -794,21 +827,23 @@ class Caldera_Forms {
|
|
794 |
}
|
795 |
|
796 |
/**
|
797 |
-
*
|
|
|
|
|
798 |
*
|
799 |
* @param array $config Processor config
|
800 |
* @param array $form Form config
|
801 |
*/
|
802 |
public static function send_auto_response($config, $form){
|
803 |
global $form;
|
804 |
-
|
805 |
// new filter to alter the config.
|
806 |
-
$config = apply_filters( 'caldera_forms_autoresponse_config', $config, $form);
|
807 |
// remove required bounds.
|
808 |
unset($config['_required_bounds']);
|
809 |
|
810 |
$message = $config['message'];
|
811 |
-
foreach($config as $tag
|
812 |
if($tag !== 'message'){
|
813 |
$message = str_replace('%'.$tag.'%', $value, $message);
|
814 |
$value = self::do_magic_tags( $value );
|
@@ -816,7 +851,7 @@ class Caldera_Forms {
|
|
816 |
}
|
817 |
// set header
|
818 |
$headers[] = 'From: ' . $config['sender_name'] . ' <' . $config['sender_email'] . '>';
|
819 |
-
|
820 |
if( ! isset( $config[ 'html'] ) || true == $config['html'] ){
|
821 |
$headers[] = "Content-type: text/html";
|
822 |
$message = wpautop( self::do_magic_tags( $message ) );
|
@@ -827,7 +862,7 @@ class Caldera_Forms {
|
|
827 |
|
828 |
|
829 |
// setup mailer
|
830 |
-
$subject = $config['subject'];
|
831 |
|
832 |
$email_message = array(
|
833 |
'recipients' => array(
|
@@ -841,6 +876,15 @@ class Caldera_Forms {
|
|
841 |
|
842 |
$email_message = apply_filters( 'caldera_forms_autoresponse_mail', $email_message, $config, $form);
|
843 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
844 |
do_action( 'caldera_forms_do_autoresponse', $config, $form);
|
845 |
|
846 |
// send mail
|
@@ -864,7 +908,7 @@ class Caldera_Forms {
|
|
864 |
*/
|
865 |
do_action( 'caldera_forms_autoresponder_failed', $email_message, $config, $form );
|
866 |
}
|
867 |
-
|
868 |
}
|
869 |
|
870 |
|
@@ -878,23 +922,23 @@ class Caldera_Forms {
|
|
878 |
public function get_form_processors($processors){
|
879 |
$internal_processors = array(
|
880 |
'auto_responder' => array(
|
881 |
-
"name" => __('Auto Responder', 'caldera-forms'),
|
882 |
-
"description" => __(
|
883 |
"post_processor" => array($this, 'send_auto_response'),
|
884 |
"template" => CFCORE_PATH . "processors/auto_responder/config.php",
|
885 |
"default" => array(
|
886 |
-
'subject' => __('Thank you for contacting us', 'caldera-forms')
|
887 |
),
|
888 |
),
|
889 |
'form_redirect' => array(
|
890 |
-
"name" => __('Redirect', 'caldera-forms'),
|
891 |
-
"description" => __(
|
892 |
"template" => CFCORE_PATH . "processors/redirect/config.php",
|
893 |
"single" => false
|
894 |
),
|
895 |
'increment_capture' => array(
|
896 |
-
"name" => __('Increment Value', 'caldera-forms'),
|
897 |
-
"description" => __(
|
898 |
"processor" => array( $this, 'increment_value' ),
|
899 |
"template" => CFCORE_PATH . "processors/increment/config.php",
|
900 |
"single" => true,
|
@@ -908,8 +952,8 @@ class Caldera_Forms {
|
|
908 |
$wp_api_key = get_option( 'wordpress_api_key' );
|
909 |
if(!empty($wp_api_key)){
|
910 |
$internal_processors['akismet'] = array(
|
911 |
-
"name" => __('Akismet', 'caldera-forms'),
|
912 |
-
"description" => __(
|
913 |
"pre_processor" => array( $this, 'akismet_scanner'),
|
914 |
"template" => CFCORE_PATH . "processors/akismet/config.php",
|
915 |
"single" => false,
|
@@ -936,9 +980,9 @@ class Caldera_Forms {
|
|
936 |
|
937 |
// get increment value;
|
938 |
$increment_value = get_option('_increment_' . $config['processor_id'], $config['start'] );
|
939 |
-
|
940 |
update_option( '_increment_' . $config['processor_id'], $increment_value + 1 );
|
941 |
-
|
942 |
if( !empty( $config['field'] ) ){
|
943 |
self::set_field_data( $config['field'], $increment_value, $form );
|
944 |
}
|
@@ -961,7 +1005,7 @@ class Caldera_Forms {
|
|
961 |
|
962 |
$wp_api_key = get_option( 'wordpress_api_key' );
|
963 |
if(empty($wp_api_key)){
|
964 |
-
return array('type' => 'error', 'note' => __('Akismet not setup.'));
|
965 |
}
|
966 |
// set permalink
|
967 |
if($post->ID){
|
@@ -992,7 +1036,7 @@ class Caldera_Forms {
|
|
992 |
$data['comment_author_url'] = self::do_magic_tags($config['url']);
|
993 |
};
|
994 |
if(!empty($config['content'])){
|
995 |
-
$data['comment_content'] = self::do_magic_tags($config['content']);
|
996 |
};
|
997 |
|
998 |
$request = http_build_query($data);
|
@@ -1011,13 +1055,13 @@ class Caldera_Forms {
|
|
1011 |
$http_request .= $request;
|
1012 |
$response = '';
|
1013 |
if( false != ( $fs = @fsockopen( $http_host, $port, $errno, $errstr, 10 ) ) ) {
|
1014 |
-
|
1015 |
fwrite( $fs, $http_request );
|
1016 |
-
|
1017 |
while ( !feof( $fs ) )
|
1018 |
-
|
1019 |
fclose( $fs );
|
1020 |
-
|
1021 |
$response = explode( "\r\n\r\n", $response, 2 );
|
1022 |
|
1023 |
}
|
@@ -1037,7 +1081,7 @@ class Caldera_Forms {
|
|
1037 |
*
|
1038 |
* @return int|string
|
1039 |
*/
|
1040 |
-
static public function run_calculation($value, $field, $form){
|
1041 |
|
1042 |
$formula = $field['config']['formular'];
|
1043 |
|
@@ -1078,7 +1122,7 @@ class Caldera_Forms {
|
|
1078 |
}else{
|
1079 |
$number = floatval( $entry_value );
|
1080 |
}
|
1081 |
-
|
1082 |
$formula = str_replace($fid, $number, $formula);
|
1083 |
}
|
1084 |
}
|
@@ -1092,11 +1136,11 @@ class Caldera_Forms {
|
|
1092 |
|
1093 |
if(isset($field['config']['fixed'])){
|
1094 |
if( function_exists( 'money_format' ) ){
|
1095 |
-
return money_format('%i', $total );
|
1096 |
}else{
|
1097 |
return sprintf('%01.2f', $total );
|
1098 |
}
|
1099 |
-
|
1100 |
}
|
1101 |
return $total;
|
1102 |
}
|
@@ -1113,42 +1157,130 @@ class Caldera_Forms {
|
|
1113 |
/**
|
1114 |
* Load built-in fields
|
1115 |
*
|
|
|
|
|
|
|
|
|
1116 |
* @param array $fields
|
1117 |
*
|
1118 |
* @return array
|
1119 |
*/
|
1120 |
public function get_internal_field_types($fields){
|
1121 |
|
1122 |
-
|
1123 |
$internal_fields = array(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1124 |
'calculation' => array(
|
1125 |
-
"field" => __(
|
1126 |
"file" => CFCORE_PATH . "fields/calculation/field.php",
|
1127 |
"handler" => array($this, "run_calculation"),
|
1128 |
-
"category" => __(
|
1129 |
-
"description" => __('Calculate values',
|
1130 |
"setup" => array(
|
1131 |
"template" => CFCORE_PATH . "fields/calculation/config.php",
|
1132 |
"preview" => CFCORE_PATH . "fields/calculation/preview.php",
|
1133 |
"default" => array(
|
1134 |
'element' => 'h3',
|
1135 |
'classes' => 'total-line',
|
1136 |
-
'before' => __('Total', 'caldera-forms').':',
|
1137 |
'after' => ''
|
1138 |
),
|
1139 |
-
|
1140 |
-
//CFCORE_URL . "fields/calculation/style.css",
|
1141 |
-
)
|
1142 |
),
|
1143 |
-
"scripts" => array(
|
1144 |
-
//'jquery'
|
1145 |
-
)
|
1146 |
),
|
1147 |
'range_slider' => array(
|
1148 |
-
"field" => __(
|
1149 |
"file" => CFCORE_PATH . "fields/range_slider/field.php",
|
1150 |
-
"category" => __(
|
1151 |
-
"description" => __('Range Slider input field','caldera-forms'),
|
1152 |
"setup" => array(
|
1153 |
"template" => CFCORE_PATH . "fields/range_slider/config.php",
|
1154 |
"preview" => CFCORE_PATH . "fields/range_slider/preview.php",
|
@@ -1165,27 +1297,13 @@ class Caldera_Forms {
|
|
1165 |
'handleborder' => '#cccccc',
|
1166 |
'trackcolor' => '#e6e6e6'
|
1167 |
),
|
1168 |
-
"scripts" => array(
|
1169 |
-
//'jquery',
|
1170 |
-
//CFCORE_URL . "fields/range_slider/rangeslider.js",
|
1171 |
-
),
|
1172 |
-
"styles" => array(
|
1173 |
-
//CFCORE_URL . "fields/range_slider/rangeslider.css",
|
1174 |
-
)
|
1175 |
-
),
|
1176 |
-
"scripts" => array(
|
1177 |
-
//'jquery',
|
1178 |
-
//CFCORE_URL . "fields/range_slider/rangeslider.js",
|
1179 |
-
),
|
1180 |
-
"styles" => array(
|
1181 |
-
//CFCORE_URL . "fields/range_slider/rangeslider.css",
|
1182 |
)
|
1183 |
),
|
1184 |
'star_rating' => array(
|
1185 |
-
"field" => __(
|
1186 |
"file" => CFCORE_PATH . "fields/star-rate/field.php",
|
1187 |
-
"category" => __(
|
1188 |
-
"description" => __('Star rating input for feedback','caldera-forms'),
|
1189 |
"viewer" => array($this, 'star_rating_viewer'),
|
1190 |
"setup" => array(
|
1191 |
"template" => CFCORE_PATH . "fields/star-rate/config.php",
|
@@ -1198,77 +1316,27 @@ class Caldera_Forms {
|
|
1198 |
'track_color'=> '#AFAFAF',
|
1199 |
'type'=> 'star',
|
1200 |
),
|
1201 |
-
"scripts" => array(
|
1202 |
-
//'jquery',
|
1203 |
-
//CFCORE_URL . "fields/star-rate/jquery.raty.js",
|
1204 |
-
),
|
1205 |
-
"styles" => array(
|
1206 |
-
//CFCORE_URL . "fields/star-rate/jquery.raty.css",
|
1207 |
-
//CFCORE_URL . "fields/star-rate/cf-raty.css",
|
1208 |
-
)
|
1209 |
-
),
|
1210 |
-
"scripts" => array(
|
1211 |
-
'jquery',
|
1212 |
-
//CFCORE_URL . "fields/star-rate/jquery.raty.js",
|
1213 |
-
),
|
1214 |
-
"styles" => array(
|
1215 |
-
//CFCORE_URL . "fields/star-rate/jquery.raty.css",
|
1216 |
-
//CFCORE_URL . "fields/star-rate/cf-raty.css",
|
1217 |
-
)
|
1218 |
-
),
|
1219 |
-
'phone' => array(
|
1220 |
-
"field" => __('Phone Number', 'caldera-forms'),
|
1221 |
-
"description" => __('Phone number with masking', 'caldera-forms'),
|
1222 |
-
"file" => CFCORE_PATH . "fields/phone/field.php",
|
1223 |
-
"category" => __("Text Fields", "caldera-forms").', '.__("User", "caldera-forms"),
|
1224 |
-
"setup" => array(
|
1225 |
-
"template" => CFCORE_PATH . "fields/phone/config.php",
|
1226 |
-
"preview" => CFCORE_PATH . "fields/phone/preview.php",
|
1227 |
-
"default" => array(
|
1228 |
-
'default' => '',
|
1229 |
-
'type' => 'local',
|
1230 |
-
'custom'=> '(999)999-9999'
|
1231 |
-
),
|
1232 |
-
"scripts" => array(
|
1233 |
-
//CFCORE_URL . "fields/phone/masked-input.js"
|
1234 |
-
)
|
1235 |
-
),
|
1236 |
-
"scripts" => array(
|
1237 |
-
//"jquery",
|
1238 |
-
//CFCORE_URL . "fields/phone/masked-input.js"
|
1239 |
-
)
|
1240 |
-
),
|
1241 |
-
'text' => array(
|
1242 |
-
"field" => __("Single Line Text", "caldera-forms"),
|
1243 |
-
"description" => __('Single Line Text', 'caldera-forms'),
|
1244 |
-
"file" => CFCORE_PATH . "fields/text/field.php",
|
1245 |
-
"category" => __("Text Fields", "caldera-forms").', '.__("Basic", "caldera-forms"),
|
1246 |
-
"setup" => array(
|
1247 |
-
"template" => CFCORE_PATH . "fields/text/config.php",
|
1248 |
-
"preview" => CFCORE_PATH . "fields/text/preview.php"
|
1249 |
-
),
|
1250 |
-
"scripts" => array(
|
1251 |
-
//"jquery",
|
1252 |
-
//CFCORE_URL . "fields/phone/masked-input.js"
|
1253 |
)
|
1254 |
),
|
|
|
|
|
1255 |
'file' => array(
|
1256 |
-
"field" => __(
|
1257 |
-
"description" => __('File Uploader', 'caldera-forms'),
|
1258 |
"file" => CFCORE_PATH . "fields/file/field.php",
|
1259 |
"viewer" => array($this, 'handle_file_view'),
|
1260 |
-
"category" => __(
|
1261 |
"setup" => array(
|
1262 |
"preview" => CFCORE_PATH . "fields/file/preview.php",
|
1263 |
"template" => CFCORE_PATH . "fields/file/config_template.php"
|
1264 |
)
|
1265 |
),
|
1266 |
'advanced_file' => array(
|
1267 |
-
"field" => __(
|
1268 |
-
"description" => __('
|
1269 |
"file" => CFCORE_PATH . "fields/advanced_file/field.php",
|
1270 |
"viewer" => array($this, 'handle_file_view'),
|
1271 |
-
"category" => __(
|
1272 |
"setup" => array(
|
1273 |
"preview" => CFCORE_PATH . "fields/advanced_file/preview.php",
|
1274 |
"template" => CFCORE_PATH . "fields/advanced_file/config_template.php"
|
@@ -1278,36 +1346,13 @@ class Caldera_Forms {
|
|
1278 |
),
|
1279 |
|
1280 |
),
|
1281 |
-
|
1282 |
-
|
1283 |
-
"description" => __('reCAPTCHA anti-spam field', 'caldera-forms'),
|
1284 |
-
"file" => CFCORE_PATH . "fields/recaptcha/field.php",
|
1285 |
-
"category" => __("Special", "caldera-forms"),
|
1286 |
-
"handler" => array($this, 'captcha_check'),
|
1287 |
-
"capture" => false,
|
1288 |
-
"setup" => array(
|
1289 |
-
"template" => CFCORE_PATH . "fields/recaptcha/config.php",
|
1290 |
-
"preview" => CFCORE_PATH . "fields/recaptcha/preview.php",
|
1291 |
-
"not_supported" => array(
|
1292 |
-
'caption',
|
1293 |
-
'required'
|
1294 |
-
),
|
1295 |
-
"scripts" => array(
|
1296 |
-
"https://www.google.com/recaptcha/api.js"
|
1297 |
-
)
|
1298 |
-
),
|
1299 |
-
"scripts" => array(
|
1300 |
-
"https://www.google.com/recaptcha/api.js"
|
1301 |
-
),
|
1302 |
-
"styles" => array(
|
1303 |
-
//CFCORE_URL . "fields/recaptcha/style.css"
|
1304 |
-
),
|
1305 |
-
),
|
1306 |
'html' => array(
|
1307 |
-
"field" => __(
|
1308 |
-
"description" => __('Add text/html content', 'caldera-forms'),
|
1309 |
"file" => CFCORE_PATH . "fields/html/field.php",
|
1310 |
-
"category" => __(
|
1311 |
"icon" => CFCORE_URL . "fields/html/icon.png",
|
1312 |
"capture" => false,
|
1313 |
"setup" => array(
|
@@ -1321,99 +1366,13 @@ class Caldera_Forms {
|
|
1321 |
)
|
1322 |
)
|
1323 |
),
|
1324 |
-
|
1325 |
-
|
1326 |
-
"description" => __('Hidden', 'caldera-forms'),
|
1327 |
-
"file" => CFCORE_PATH . "fields/hidden/field.php",
|
1328 |
-
"category" => __("Text Fields", "caldera-forms").', '.__("Basic", "caldera-forms"),
|
1329 |
-
"static" => true,
|
1330 |
-
"setup" => array(
|
1331 |
-
"preview" => CFCORE_PATH . "fields/hidden/preview.php",
|
1332 |
-
"template" => CFCORE_PATH . "fields/hidden/setup.php",
|
1333 |
-
"not_supported" => array(
|
1334 |
-
'hide_label',
|
1335 |
-
'caption',
|
1336 |
-
'required',
|
1337 |
-
)
|
1338 |
-
)
|
1339 |
-
),
|
1340 |
-
'button' => array(
|
1341 |
-
"field" => __("Button", "caldera-forms"),
|
1342 |
-
"description" => __('Button, Submit and Reset types', 'caldera-forms'),
|
1343 |
-
"file" => CFCORE_PATH . "fields/button/field.php",
|
1344 |
-
"category" => __("Buttons", "caldera-forms").', '.__("Basic", "caldera-forms"),
|
1345 |
-
"capture" => false,
|
1346 |
-
"setup" => array(
|
1347 |
-
"template" => CFCORE_PATH . "fields/button/config_template.php",
|
1348 |
-
"preview" => CFCORE_PATH . "fields/button/preview.php",
|
1349 |
-
"default" => array(
|
1350 |
-
'class' => 'btn btn-default',
|
1351 |
-
'type' => 'submit'
|
1352 |
-
),
|
1353 |
-
"not_supported" => array(
|
1354 |
-
'hide_label',
|
1355 |
-
'caption',
|
1356 |
-
'required',
|
1357 |
-
'entry_list'
|
1358 |
-
)
|
1359 |
-
)
|
1360 |
-
),
|
1361 |
-
'email' => array(
|
1362 |
-
"field" => __("Email Address", "caldera-forms"),
|
1363 |
-
"description" => __('Email Address', 'caldera-forms'),
|
1364 |
-
"file" => CFCORE_PATH . "fields/email/field.php",
|
1365 |
-
"category" => __("Text Fields", "caldera-forms").', '.__("Basic", "caldera-forms"),
|
1366 |
-
"setup" => array(
|
1367 |
-
"preview" => CFCORE_PATH . "fields/email/preview.php",
|
1368 |
-
"template" => CFCORE_PATH . "fields/email/config.php"
|
1369 |
-
)
|
1370 |
-
),
|
1371 |
-
'paragraph' => array(
|
1372 |
-
"field" => __("Paragraph Textarea", "caldera-forms"),
|
1373 |
-
"description" => __('Paragraph Textarea', 'caldera-forms'),
|
1374 |
-
"file" => CFCORE_PATH . "fields/paragraph/field.php",
|
1375 |
-
"category" => __("Text Fields", "caldera-forms").', '.__("Basic", "caldera-forms"),
|
1376 |
-
"setup" => array(
|
1377 |
-
"template" => CFCORE_PATH . "fields/paragraph/config_template.php",
|
1378 |
-
"preview" => CFCORE_PATH . "fields/paragraph/preview.php",
|
1379 |
-
"default" => array(
|
1380 |
-
'rows' => '4'
|
1381 |
-
),
|
1382 |
-
)
|
1383 |
-
),
|
1384 |
-
'toggle_switch' => array(
|
1385 |
-
"field" => __("Toggle Switch", "caldera-forms"),
|
1386 |
-
"description" => __('Toggle Switch', 'caldera-forms'),
|
1387 |
-
"category" => __("Select Options", "caldera-forms").', '.__("Special", "caldera-forms"),
|
1388 |
-
"file" => CFCORE_PATH . "fields/toggle_switch/field.php",
|
1389 |
-
"viewer" => array($this, 'filter_options_calculator'),
|
1390 |
-
"options" => "single",
|
1391 |
-
"static" => true,
|
1392 |
-
"setup" => array(
|
1393 |
-
"template" => CFCORE_PATH . "fields/toggle_switch/config_template.php",
|
1394 |
-
"preview" => CFCORE_PATH . "fields/toggle_switch/preview.php",
|
1395 |
-
"default" => array(
|
1396 |
-
),
|
1397 |
-
"scripts" => array(
|
1398 |
-
//CFCORE_URL . "fields/toggle_switch/js/setup.js"
|
1399 |
-
),
|
1400 |
-
"styles" => array(
|
1401 |
-
//CFCORE_URL . "fields/toggle_switch/css/setup.css"
|
1402 |
-
),
|
1403 |
-
),
|
1404 |
-
"scripts" => array(
|
1405 |
-
"jquery",
|
1406 |
-
//CFCORE_URL . "fields/toggle_switch/js/toggle.js"
|
1407 |
-
),
|
1408 |
-
"styles" => array(
|
1409 |
-
//CFCORE_URL . "fields/toggle_switch/css/toggle.css"
|
1410 |
-
)
|
1411 |
-
),
|
1412 |
'dropdown' => array(
|
1413 |
-
"field" => __(
|
1414 |
-
"description" => __('Dropdown Select', 'caldera-forms'),
|
1415 |
"file" => CFCORE_PATH . "fields/dropdown/field.php",
|
1416 |
-
"category" => __(
|
1417 |
"options" => "single",
|
1418 |
"static" => true,
|
1419 |
"viewer" => array($this, 'filter_options_calculator'),
|
@@ -1423,110 +1382,99 @@ class Caldera_Forms {
|
|
1423 |
"default" => array(
|
1424 |
|
1425 |
),
|
1426 |
-
"scripts" => array(
|
1427 |
-
//CFCORE_URL . "fields/dropdown/js/setup.js"
|
1428 |
-
)
|
1429 |
)
|
1430 |
),
|
1431 |
'checkbox' => array(
|
1432 |
-
"field" => __(
|
1433 |
-
"description" => __('Checkbox', 'caldera-forms'),
|
1434 |
"file" => CFCORE_PATH . "fields/checkbox/field.php",
|
1435 |
-
"category" => __(
|
1436 |
"options" => "multiple",
|
1437 |
"static" => true,
|
1438 |
"viewer" => array($this, 'filter_options_calculator'),
|
1439 |
"setup" => array(
|
1440 |
"preview" => CFCORE_PATH . "fields/checkbox/preview.php",
|
1441 |
"template" => CFCORE_PATH . "fields/checkbox/config_template.php",
|
1442 |
-
"default" => array(
|
1443 |
|
1444 |
-
),
|
1445 |
-
"scripts" => array(
|
1446 |
-
//CFCORE_URL . "fields/checkbox/js/setup.js"
|
1447 |
-
)
|
1448 |
),
|
1449 |
),
|
1450 |
'radio' => array(
|
1451 |
-
"field" => __(
|
1452 |
-
"description" => __('Radio', 'caldera-forms'),
|
1453 |
"file" => CFCORE_PATH . "fields/radio/field.php",
|
1454 |
-
"category" => __(
|
1455 |
"options" => true,
|
1456 |
"static" => true,
|
1457 |
"viewer" => array($this, 'filter_options_calculator'),
|
1458 |
"setup" => array(
|
1459 |
"preview" => CFCORE_PATH . "fields/radio/preview.php",
|
1460 |
"template" => CFCORE_PATH . "fields/radio/config_template.php",
|
1461 |
-
|
1462 |
-
|
1463 |
-
|
1464 |
-
|
1465 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1466 |
)
|
1467 |
),
|
1468 |
'date_picker' => array(
|
1469 |
-
"field" => __(
|
1470 |
-
"description" => __('Date Picker', 'caldera-forms'),
|
1471 |
"file" => CFCORE_PATH . "fields/date_picker/datepicker.php",
|
1472 |
-
"category" => __(
|
1473 |
"setup" => array(
|
1474 |
"preview" => CFCORE_PATH . "fields/date_picker/preview.php",
|
1475 |
"template" => CFCORE_PATH . "fields/date_picker/setup.php",
|
1476 |
"default" => array(
|
1477 |
'format' => 'yyyy-mm-dd'
|
1478 |
),
|
1479 |
-
"scripts" => array(
|
1480 |
-
//CFCORE_URL . "fields/date_picker/js/bootstrap-datepicker.js",
|
1481 |
-
//CFCORE_URL . "fields/date_picker/js/setup.js"
|
1482 |
-
),
|
1483 |
-
"styles" => array(
|
1484 |
-
//CFCORE_URL . "fields/date_picker/css/datepicker.css"
|
1485 |
-
),
|
1486 |
-
),
|
1487 |
-
"scripts" => array(
|
1488 |
-
//"jquery",
|
1489 |
-
//CFCORE_URL . "fields/date_picker/js/bootstrap-datepicker.js"
|
1490 |
-
),
|
1491 |
-
"styles" => array(
|
1492 |
-
//CFCORE_URL . "fields/date_picker/css/datepicker.css"
|
1493 |
)
|
1494 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1495 |
'color_picker' => array(
|
1496 |
-
"field" => __(
|
1497 |
-
"description" => __('Color Picker', 'caldera-forms'),
|
1498 |
-
"category" => __(
|
1499 |
"file" => CFCORE_PATH . "fields/color_picker/field.php",
|
1500 |
"setup" => array(
|
1501 |
"preview" => CFCORE_PATH . "fields/color_picker/preview.php",
|
1502 |
"template" => CFCORE_PATH . "fields/color_picker/setup.php",
|
1503 |
"default" => array(
|
1504 |
-
'default' => '#FFFFFF'
|
1505 |
-
),
|
1506 |
-
"scripts" => array(
|
1507 |
-
//CFCORE_URL . "fields/color_picker/minicolors.js",
|
1508 |
-
//CFCORE_URL . "fields/color_picker/setup.js"
|
1509 |
-
),
|
1510 |
-
"styles" => array(
|
1511 |
-
//CFCORE_URL . "fields/color_picker/minicolors.css"
|
1512 |
),
|
|
|
1513 |
),
|
1514 |
-
"scripts" => array(
|
1515 |
-
//"jquery",
|
1516 |
-
//CFCORE_URL . "fields/color_picker/minicolors.js",
|
1517 |
-
//CFCORE_URL . "fields/color_picker/setup.js"
|
1518 |
-
),
|
1519 |
-
"styles" => array(
|
1520 |
-
//CFCORE_URL . "fields/color_picker/minicolors.css"
|
1521 |
-
)
|
1522 |
),
|
1523 |
'states' => array(
|
1524 |
-
"field" => __(
|
1525 |
-
"description" => __('Dropdown select for US states and Canadian provinces.', 'caldera-forms'),
|
1526 |
"file" => CFCORE_PATH . "fields/states/field.php",
|
1527 |
-
"category" => __(
|
1528 |
"placeholder" => false,
|
1529 |
-
//"viewer" => array($this, 'filter_options_calculator'),
|
1530 |
"setup" => array(
|
1531 |
"template" => CFCORE_PATH . "fields/states/config_template.php",
|
1532 |
"preview" => CFCORE_PATH . "fields/states/preview.php",
|
@@ -1535,28 +1483,30 @@ class Caldera_Forms {
|
|
1535 |
),
|
1536 |
)
|
1537 |
),
|
1538 |
-
|
1539 |
-
|
1540 |
-
|
1541 |
-
|
1542 |
-
"
|
1543 |
-
"
|
1544 |
-
"
|
|
|
|
|
|
|
1545 |
"setup" => array(
|
1546 |
-
"template" => CFCORE_PATH . "fields/
|
1547 |
-
"preview" => CFCORE_PATH . "fields/
|
1548 |
-
|
1549 |
-
|
1550 |
-
|
1551 |
-
|
1552 |
-
"styles" => array(
|
1553 |
-
CFCORE_URL . "fields/select2/css/select2.css",
|
1554 |
)
|
1555 |
-
)
|
|
|
1556 |
);
|
1557 |
-
|
1558 |
return array_merge( $fields, $internal_fields );
|
1559 |
-
|
1560 |
}
|
1561 |
|
1562 |
/**
|
@@ -1595,7 +1545,7 @@ class Caldera_Forms {
|
|
1595 |
}
|
1596 |
if(is_array($value)){
|
1597 |
$value = implode('<br>', $value);
|
1598 |
-
}
|
1599 |
}
|
1600 |
}
|
1601 |
}
|
@@ -1612,7 +1562,7 @@ class Caldera_Forms {
|
|
1612 |
*/
|
1613 |
public function apply_conditional_groups($field, $form){
|
1614 |
|
1615 |
-
if( !empty( $form['conditional_groups']['conditions'][ $field['conditions']['type'] ] ) ){
|
1616 |
$group = $form['conditional_groups']['conditions'][ $field['conditions']['type'] ];
|
1617 |
if( ! isset( $field['conditions']['group'] ) ){
|
1618 |
$field['conditions']['group'] = array();
|
@@ -1637,7 +1587,7 @@ class Caldera_Forms {
|
|
1637 |
* @return array Options for field
|
1638 |
*/
|
1639 |
public function auto_populate_options_field($field, $form){
|
1640 |
-
|
1641 |
if(!empty($field['config']['auto'])){
|
1642 |
$field['config']['option'] = array();
|
1643 |
switch($field['config']['auto_type']){
|
@@ -1711,7 +1661,7 @@ class Caldera_Forms {
|
|
1711 |
);
|
1712 |
}
|
1713 |
|
1714 |
-
|
1715 |
case 'taxonomy':
|
1716 |
if( $field[ 'config' ][ 'value_field' ] === 'id' ){
|
1717 |
$field[ 'config' ][ 'value_field' ] = 'term_id';
|
@@ -1741,7 +1691,7 @@ class Caldera_Forms {
|
|
1741 |
* @param array $form Form config
|
1742 |
*/
|
1743 |
$args = apply_filters( 'caldera_forms_autopopulate_taxonomy_args', $args );
|
1744 |
-
|
1745 |
$terms = get_terms( $field['config']['taxonomy'], $args );
|
1746 |
|
1747 |
/**
|
@@ -1779,14 +1729,14 @@ class Caldera_Forms {
|
|
1779 |
'label' => $term->{$field_for_label}
|
1780 |
);
|
1781 |
}
|
1782 |
-
|
1783 |
|
1784 |
}
|
1785 |
|
1786 |
}else{
|
1787 |
$field = self::format_select_options( $field );
|
1788 |
}
|
1789 |
-
|
1790 |
return $field;
|
1791 |
|
1792 |
}
|
@@ -1839,10 +1789,10 @@ class Caldera_Forms {
|
|
1839 |
|
1840 |
foreach($conditions['group'] as $groupid=>$lines){
|
1841 |
$truelines = array();
|
1842 |
-
|
1843 |
foreach($lines as $lineid=>$line){
|
1844 |
|
1845 |
-
if( isset( $form['fields'][$line['field']]['config']['option'][$line['value']] )){
|
1846 |
$line['value'] = $form['fields'][$line['field']]['config']['option'][$line['value']]['value'];
|
1847 |
}
|
1848 |
|
@@ -1859,7 +1809,7 @@ class Caldera_Forms {
|
|
1859 |
$line['value'] = $isslug;
|
1860 |
}
|
1861 |
}
|
1862 |
-
|
1863 |
|
1864 |
$truelines[$lineid] = false;
|
1865 |
|
@@ -1912,7 +1862,7 @@ class Caldera_Forms {
|
|
1912 |
break;
|
1913 |
case 'startswith':
|
1914 |
if(is_array($value)){
|
1915 |
-
foreach($value as $part){
|
1916 |
if( 0 === strpos($part,$line['value'])){
|
1917 |
$truelines[$lineid] = true;
|
1918 |
}
|
@@ -1948,7 +1898,7 @@ class Caldera_Forms {
|
|
1948 |
}
|
1949 |
break;
|
1950 |
}
|
1951 |
-
|
1952 |
}
|
1953 |
|
1954 |
$trues[$groupid] = in_array(false, $truelines) ? false : true;
|
@@ -1988,7 +1938,7 @@ class Caldera_Forms {
|
|
1988 |
|
1989 |
do_action('caldera_forms_redirect', $type, $url, $form, $processid);
|
1990 |
do_action('caldera_forms_redirect_' . $type, $url, $form, $processid);
|
1991 |
-
|
1992 |
if(!empty($url)){
|
1993 |
cf_redirect( $url, 302 );
|
1994 |
exit;
|
@@ -2043,7 +1993,7 @@ class Caldera_Forms {
|
|
2043 |
);
|
2044 |
|
2045 |
$tags['system'] = array(
|
2046 |
-
'type' => __('System Tags', 'caldera-forms'),
|
2047 |
'tags' => $system_tags,
|
2048 |
'wrap' => array('{','}')
|
2049 |
);
|
@@ -2072,7 +2022,7 @@ class Caldera_Forms {
|
|
2072 |
}
|
2073 |
$tags[$processor_key]['tags'][$tag] = $value_tag;
|
2074 |
}
|
2075 |
-
}else{
|
2076 |
// compatibility text
|
2077 |
$tag = $processor_key.':'.$value_tag;
|
2078 |
if(!in_array($tag, $tags)){
|
@@ -2139,7 +2089,7 @@ class Caldera_Forms {
|
|
2139 |
$magic_tag = $referrer['query'][ $magic[1] ];
|
2140 |
}else{
|
2141 |
$magic_tag = null;
|
2142 |
-
}
|
2143 |
}
|
2144 |
break;
|
2145 |
case 'post':
|
@@ -2175,13 +2125,13 @@ class Caldera_Forms {
|
|
2175 |
break;
|
2176 |
case 'user':
|
2177 |
if(is_user_logged_in()){
|
2178 |
-
$user = get_userdata( get_current_user_id() );
|
2179 |
if(isset( $user->data->{$magic[1]} )){
|
2180 |
$magic_tag = $user->data->{$magic[1]};
|
2181 |
}else{
|
2182 |
if(strtolower($magic[1]) == 'id'){
|
2183 |
$magic_tag = $user->ID;
|
2184 |
-
}else{
|
2185 |
$magic_tag = get_user_meta( $user->ID, $magic[1], true );
|
2186 |
}
|
2187 |
}
|
@@ -2220,7 +2170,7 @@ class Caldera_Forms {
|
|
2220 |
}
|
2221 |
if(empty($post_metavalue)){
|
2222 |
$magic_tag = null;
|
2223 |
-
}else{
|
2224 |
if(empty($magic[3])){
|
2225 |
$magic_tag = implode(', ', $post_metavalue);
|
2226 |
}else{
|
@@ -2229,7 +2179,7 @@ class Caldera_Forms {
|
|
2229 |
foreach( (array) $post_metavalue as $subsubkey=>$subsubval){
|
2230 |
if(isset($subsubval[$subvalue])){
|
2231 |
$outmagic[] = $post_metavalue;
|
2232 |
-
}
|
2233 |
}
|
2234 |
}
|
2235 |
$magic_tag = implode(', ', $outmagic);
|
@@ -2264,19 +2214,27 @@ class Caldera_Forms {
|
|
2264 |
$ip = $_SERVER['HTTP_CLIENT_IP'];
|
2265 |
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
|
2266 |
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
|
2267 |
-
}
|
2268 |
-
|
2269 |
$magic_tag = $ip;
|
2270 |
-
|
2271 |
break;
|
2272 |
case 'ua':
|
2273 |
$magic_tag = $_SERVER['HTTP_USER_AGENT'];
|
2274 |
-
break;
|
2275 |
case 'summary':
|
2276 |
if(!empty($this_form['fields'])){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2277 |
$out = array();
|
2278 |
foreach($this_form['fields'] as $field_id=>$field){
|
2279 |
-
|
2280 |
if( in_array( $field['type'], array('button', 'recaptcha', 'html' ) ) ){
|
2281 |
continue;
|
2282 |
}
|
@@ -2294,27 +2252,34 @@ class Caldera_Forms {
|
|
2294 |
if( isset( $field_value['label'] ) && isset( $field_value['value'] ) ){
|
2295 |
$field_value[$field_key] = $field_value['value'];
|
2296 |
}
|
2297 |
-
|
2298 |
}
|
2299 |
}
|
2300 |
|
2301 |
$field_value = implode(', ', (array) $field_values);
|
2302 |
-
|
2303 |
|
2304 |
-
|
2305 |
-
|
2306 |
-
|
|
|
|
|
|
|
2307 |
}
|
2308 |
}
|
|
|
2309 |
// vars
|
2310 |
if( !empty( $this_form['variables'] ) ){
|
2311 |
foreach( $this_form['variables']['keys'] as $var_key=>$var_label ){
|
2312 |
if( $this_form['variables']['types'][ $var_key ] == 'entryitem' ){
|
2313 |
$label = ucfirst( str_replace('_', ' ', $var_label ) );
|
2314 |
-
|
|
|
|
|
|
|
|
|
2315 |
}
|
2316 |
}
|
2317 |
-
}
|
2318 |
if(!empty($out)){
|
2319 |
$magic_tag = implode("\r\n", $out);
|
2320 |
}else{
|
@@ -2322,18 +2287,18 @@ class Caldera_Forms {
|
|
2322 |
}
|
2323 |
}
|
2324 |
break;
|
2325 |
-
|
2326 |
-
|
2327 |
-
|
2328 |
-
|
2329 |
-
|
2330 |
-
|
2331 |
-
|
2332 |
-
|
2333 |
-
|
2334 |
-
|
2335 |
-
|
2336 |
-
|
2337 |
|
2338 |
|
2339 |
}
|
@@ -2344,27 +2309,27 @@ class Caldera_Forms {
|
|
2344 |
if(!empty($this_form['ID']) ){
|
2345 |
|
2346 |
// split processor
|
2347 |
-
|
2348 |
if(!empty($magic[1])){
|
2349 |
if( false !== strpos( $magic[1], ':' )){
|
2350 |
$magic = array_reverse( explode(':', $magic[1]) );
|
2351 |
}
|
2352 |
-
}
|
2353 |
// check if its a process id or processor slug
|
2354 |
-
|
2355 |
-
|
2356 |
-
|
2357 |
-
|
2358 |
-
|
2359 |
-
|
2360 |
-
|
2361 |
-
|
2362 |
-
|
2363 |
-
|
2364 |
-
|
2365 |
-
|
2366 |
if(!empty($processed_meta[$this_form['ID']][$magic[0]])){
|
2367 |
-
|
2368 |
if(isset( $processed_meta[$this_form['ID']][$magic[0]][$magic[1]] ) ){
|
2369 |
// direct fined
|
2370 |
$filter_value = implode(', ', (array) $processed_meta[$this_form['ID']][$magic[0]][$magic[1]] );
|
@@ -2401,17 +2366,17 @@ class Caldera_Forms {
|
|
2401 |
$entry = self::get_slug_data($tag, $this_form, $entry_id);
|
2402 |
|
2403 |
if($entry !== null){
|
2404 |
-
$field = self::get_field_by_slug( $tag, $this_form );
|
2405 |
}
|
2406 |
|
2407 |
-
|
2408 |
if( !empty( $field ) && !empty( $part_tags[1] ) && $part_tags[1] == 'label' ){
|
2409 |
if( !is_array( $entry ) ){
|
2410 |
$entry = (array) $entry;
|
2411 |
}
|
2412 |
foreach( (array) $entry as $entry_key=>$entry_line ){
|
2413 |
if( !empty( $field['config']['option'] ) ){
|
2414 |
-
foreach( $field['config']['option'] as $option ){
|
2415 |
if( $option['value'] == $entry_line ){
|
2416 |
$entry[$entry_key] = $option['label'];
|
2417 |
}
|
@@ -2447,10 +2412,6 @@ class Caldera_Forms {
|
|
2447 |
* @return array Array of field types.
|
2448 |
*/
|
2449 |
static public function get_field_types(){
|
2450 |
-
//global $field_types;
|
2451 |
-
//if(!empty($field_types)){
|
2452 |
-
// return $field_types;
|
2453 |
-
//}
|
2454 |
|
2455 |
|
2456 |
$field_types = apply_filters( 'caldera_forms_get_field_types', array() );
|
@@ -2519,7 +2480,7 @@ class Caldera_Forms {
|
|
2519 |
if(is_string($form)){
|
2520 |
$form['ID'] = $form;
|
2521 |
}
|
2522 |
-
|
2523 |
// set value
|
2524 |
if(isset($form['ID'])){
|
2525 |
if(isset($processed_meta[$form['ID']][$processor_id][$key])){
|
@@ -2529,7 +2490,7 @@ class Caldera_Forms {
|
|
2529 |
}
|
2530 |
$processed_meta[$form['ID']][$processor_id][$key][] = $value;
|
2531 |
return true;
|
2532 |
-
}
|
2533 |
}
|
2534 |
|
2535 |
/**
|
@@ -2546,7 +2507,7 @@ class Caldera_Forms {
|
|
2546 |
global $processed_data;
|
2547 |
|
2548 |
$current_data = self::get_field_data($field_id, $form, $entry_id);
|
2549 |
-
|
2550 |
if(is_string($form)){
|
2551 |
$form = Caldera_Forms_Forms::get_form( $form );
|
2552 |
}
|
@@ -2742,7 +2703,7 @@ class Caldera_Forms {
|
|
2742 |
}
|
2743 |
|
2744 |
if(isset($processed_data[$indexkey][$field_id])){
|
2745 |
-
return $processed_data[$indexkey][$field_id];
|
2746 |
}
|
2747 |
|
2748 |
|
@@ -2762,7 +2723,7 @@ class Caldera_Forms {
|
|
2762 |
foreach($form['fields'] as $field_id=>$field){
|
2763 |
|
2764 |
if($field['slug'] == $slug){
|
2765 |
-
|
2766 |
return apply_filters( 'caldera_forms_render_get_field', $field, $form );
|
2767 |
|
2768 |
}
|
@@ -2795,7 +2756,7 @@ class Caldera_Forms {
|
|
2795 |
foreach($form['fields'] as $field_id=>$field){
|
2796 |
|
2797 |
if($field['slug'] == $slug){
|
2798 |
-
|
2799 |
return self::get_field_data( $field_id, $form, $entry_id);
|
2800 |
|
2801 |
}
|
@@ -2843,7 +2804,7 @@ class Caldera_Forms {
|
|
2843 |
*/
|
2844 |
static public function get_entry_meta($entry_id, $form, $type = null){
|
2845 |
global $wpdb;
|
2846 |
-
|
2847 |
$entry_meta = array();
|
2848 |
|
2849 |
$entry_meta_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM `" . $wpdb->prefix ."cf_form_entry_meta` WHERE `entry_id` = %d", $entry_id), ARRAY_A);
|
@@ -2866,7 +2827,7 @@ class Caldera_Forms {
|
|
2866 |
if( $meta['process_id'] == '_debug_log' ){
|
2867 |
$meta['meta_value'] = '<pre>' . $meta['meta_value'] . '</pre>';
|
2868 |
$entry_meta['debug'] = array(
|
2869 |
-
'name' => __('Mailer Debug', 'caldera-forms'),
|
2870 |
'data' => array(
|
2871 |
'_debug_log' => array(
|
2872 |
'entry' => array(
|
@@ -2891,7 +2852,7 @@ class Caldera_Forms {
|
|
2891 |
}
|
2892 |
$meta = apply_filters( 'caldera_forms_get_entry_meta_' . $form['processors'][$meta['process_id']]['type'], $meta, $process_config , $form);
|
2893 |
|
2894 |
-
|
2895 |
// allows plugins to remove it.
|
2896 |
if(!empty($meta)){
|
2897 |
if(!isset($entry_meta[$group])){
|
@@ -2900,20 +2861,20 @@ class Caldera_Forms {
|
|
2900 |
$meta_name = $processors[$form['processors'][$meta['process_id']]['type']]['name'];
|
2901 |
}else{
|
2902 |
if( $meta['process_id'] == '_debug_log' ){
|
2903 |
-
$meta_name = __('Mailer Debug', 'caldera-forms');
|
2904 |
}else{
|
2905 |
-
$meta_name = $meta['process_id'];
|
2906 |
}
|
2907 |
-
|
2908 |
}
|
2909 |
$entry_meta[$group] = array(
|
2910 |
'name' => $meta_name,
|
2911 |
'data' => array()
|
2912 |
);
|
2913 |
// custom template
|
2914 |
-
if( isset( $processors[$form['processors'][$meta['process_id']]['type']]['meta_template'] ) && file_exists( $processors[$form['processors'][$meta['process_id']]['type']]['meta_template'] ) ){
|
2915 |
$entry_meta[$group][$group.'_template'] = $entry_meta[$group]['template'] = true;
|
2916 |
-
}
|
2917 |
}
|
2918 |
|
2919 |
//if(!empty($meta['meta_title'])){
|
@@ -2922,7 +2883,7 @@ class Caldera_Forms {
|
|
2922 |
|
2923 |
$entry_meta[$group]['data'][$meta['process_id']]['entry'][$meta['meta_key']] = $meta;
|
2924 |
|
2925 |
-
|
2926 |
/*if(is_array($meta['meta_value'])){
|
2927 |
foreach($meta['meta_value'] as $mkey=>$mval){
|
2928 |
$entry['meta'][$group]['data'][$meta['process_id']]['title'] = $meta['meta_key'];
|
@@ -2935,7 +2896,7 @@ class Caldera_Forms {
|
|
2935 |
$entry['meta'][$group]['data'][$meta['process_id']]['entry'][] = array(
|
2936 |
'meta_key' => $meta['meta_key'],
|
2937 |
'meta_value' => $meta['meta_value']
|
2938 |
-
);
|
2939 |
}*/
|
2940 |
|
2941 |
}
|
@@ -2965,8 +2926,8 @@ class Caldera_Forms {
|
|
2965 |
if(is_string($form)){
|
2966 |
$form_id = $form;
|
2967 |
$form = Caldera_Forms_Forms::get_form( $form );
|
2968 |
-
if(!isset($form['ID']) || $form['ID'] !== $form_id){
|
2969 |
-
return new WP_Error( 'fail', __('Invalid form ID', 'caldera-forms') );
|
2970 |
}
|
2971 |
}
|
2972 |
|
@@ -3009,14 +2970,14 @@ class Caldera_Forms {
|
|
3009 |
global $rawdata;
|
3010 |
global $processed_data;
|
3011 |
global $transdata;
|
3012 |
-
global $wpdb;
|
3013 |
-
global $referrer;
|
3014 |
|
3015 |
// clean out referrer
|
3016 |
if(empty($_POST['_wp_http_referer_true'])){
|
3017 |
$_POST['_wp_http_referer_true'] = $_SERVER['HTTP_REFERER'];
|
3018 |
}
|
3019 |
-
|
3020 |
$referrer = parse_url( $_POST['_wp_http_referer_true'] );
|
3021 |
if(!empty($referrer['query'])){
|
3022 |
parse_str($referrer['query'], $referrer['query']);
|
@@ -3092,14 +3053,14 @@ class Caldera_Forms {
|
|
3092 |
}
|
3093 |
}
|
3094 |
|
3095 |
-
// check source is ajax to overide
|
3096 |
if( !empty($_POST['cfajax']) && $_POST['cfajax'] == $form['ID'] ){
|
3097 |
$form['form_ajax'] = 1;
|
3098 |
}
|
3099 |
-
|
3100 |
// get all fieldtype
|
3101 |
$field_types = self::get_field_types();
|
3102 |
-
|
3103 |
// setup fieldtypes field submissions
|
3104 |
if(!empty($field_types)){
|
3105 |
foreach($field_types as $fieldType=>$fieldConfig){
|
@@ -3177,10 +3138,10 @@ class Caldera_Forms {
|
|
3177 |
|
3178 |
// setup processor bound requieds
|
3179 |
if(!empty($form['processors'])){
|
3180 |
-
$bound_fields = array();
|
3181 |
foreach($form['processors'] as $processor_id=>$processor){
|
3182 |
|
3183 |
-
if(!empty($processor['config']['_required_bounds'])){
|
3184 |
foreach($processor['config'] as $slug=>&$value){
|
3185 |
if($slug == '_required_bounds'){
|
3186 |
continue;
|
@@ -3219,7 +3180,7 @@ class Caldera_Forms {
|
|
3219 |
'form_id' => $form['ID']
|
3220 |
);
|
3221 |
if( sha1( json_encode( $token_array ) ) !== trim( $_POST['_cf_frm_edt_tkn'] ) ){
|
3222 |
-
return new WP_Error( 'error', __( "Permission denied.",
|
3223 |
}else{
|
3224 |
$entry_id = (int) $details['id'];
|
3225 |
$edit_token = sha1( json_encode( $token_array ) );
|
@@ -3229,19 +3190,19 @@ class Caldera_Forms {
|
|
3229 |
|
3230 |
if(empty($user_id)){
|
3231 |
$transdata['error'] = true;
|
3232 |
-
$transdata['note'] = __('Permission denied or entry does not exist.', 'caldera-forms');
|
3233 |
}else{
|
3234 |
|
3235 |
if(empty($details)){
|
3236 |
$transdata['error'] = true;
|
3237 |
-
$transdata['note'] = __('Permission denied or entry does not exist.', 'caldera-forms');
|
3238 |
}else{
|
3239 |
// check user can edit
|
3240 |
if( current_user_can( 'edit_posts' ) || $details['user_id'] === $user_id ){
|
3241 |
// can edit.
|
3242 |
}else{
|
3243 |
$transdata['error'] = true;
|
3244 |
-
$transdata['note'] = __('Permission denied or entry does not exist.', 'caldera-forms');
|
3245 |
}
|
3246 |
}
|
3247 |
|
@@ -3253,7 +3214,7 @@ class Caldera_Forms {
|
|
3253 |
|
3254 |
// start brining in entries
|
3255 |
foreach($form['fields'] as $field_id=>$field){
|
3256 |
-
|
3257 |
$entry = self::get_field_data($field_id, $form);
|
3258 |
|
3259 |
if ( is_wp_error( $entry )){
|
@@ -3281,20 +3242,20 @@ class Caldera_Forms {
|
|
3281 |
if ( is_wp_error( $entry )){
|
3282 |
$transdata['fields'][$field_id] = $entry->get_error_message();
|
3283 |
}elseif($entry === null){
|
3284 |
-
$transdata['fields'][$field_id] = $field['label'] .' ' .__('is required', 'caldera-forms');
|
3285 |
}
|
3286 |
}
|
3287 |
}
|
3288 |
|
3289 |
}
|
3290 |
-
|
3291 |
// check requireds
|
3292 |
if(!empty($transdata['fields']) || !empty($transdata['error'])){
|
3293 |
$transdata['type'] = 'error';
|
3294 |
// set error transient
|
3295 |
$transdata = apply_filters( 'caldera_forms_submit_return_transient', $transdata, $form, $referrer, $process_id);
|
3296 |
$transdata = apply_filters( 'caldera_forms_submit_return_transient_required', $transdata, $form, $referrer, $process_id);
|
3297 |
-
|
3298 |
// back to form
|
3299 |
$query_str = array(
|
3300 |
'cf_er' => $process_id
|
@@ -3317,7 +3278,7 @@ class Caldera_Forms {
|
|
3317 |
if(!isset($form['processors'])){
|
3318 |
$form['processors'] = array();
|
3319 |
}
|
3320 |
-
|
3321 |
// get all form processors
|
3322 |
$form_processors = Caldera_Forms_Processor_Load::get_instance()->get_processors();
|
3323 |
|
@@ -3366,7 +3327,7 @@ class Caldera_Forms {
|
|
3366 |
|
3367 |
// PRE PROCESS
|
3368 |
foreach($form['processors'] as $processor_id=>$processor){
|
3369 |
-
|
3370 |
if(isset($form_processors[$processor['type']])){
|
3371 |
|
3372 |
// Do Conditional
|
@@ -3402,9 +3363,9 @@ class Caldera_Forms {
|
|
3402 |
$process_line_data = $func($config, $form, $process_id);
|
3403 |
}
|
3404 |
}
|
3405 |
-
// pre processors should not return unless a break in action for further
|
3406 |
// Returned something - check it
|
3407 |
-
if(!empty($process_line_data)){
|
3408 |
if(is_array($process_line_data)){
|
3409 |
//type
|
3410 |
if(!empty($process_line_data['type'])){
|
@@ -3412,14 +3373,14 @@ class Caldera_Forms {
|
|
3412 |
// has note?
|
3413 |
if(!empty($process_line_data['note'])){
|
3414 |
$transdata['note'] = $process_line_data['note'];
|
3415 |
-
}
|
3416 |
}
|
3417 |
|
3418 |
// fields involved?
|
3419 |
if(!empty($process_line_data['fields'])){
|
3420 |
$transdata['fields'] = $process_line_data['fields'];
|
3421 |
}
|
3422 |
-
|
3423 |
// set error transient
|
3424 |
$transdata = apply_filters( 'caldera_forms_submit_return_transient', $transdata, $form, $referrer, $process_id);
|
3425 |
$transdata = apply_filters( 'caldera_forms_submit_return_transient_pre_process', $transdata, $form, $referrer, $process_id);
|
@@ -3474,7 +3435,7 @@ class Caldera_Forms {
|
|
3474 |
|
3475 |
$wpdb->insert($wpdb->prefix . 'cf_form_entries', $new_entry);
|
3476 |
$entryid = $wpdb->insert_id;
|
3477 |
-
|
3478 |
/**
|
3479 |
* Runs after an entry is saved
|
3480 |
*
|
@@ -3485,7 +3446,7 @@ class Caldera_Forms {
|
|
3485 |
* @param array $form Form being processed
|
3486 |
*/
|
3487 |
do_action( 'caldera_forms_entry_saved', $entryid, $new_entry, $form );
|
3488 |
-
|
3489 |
// save entry_id
|
3490 |
self::set_field_data('_entry_id', $entryid, $form);
|
3491 |
// set entry token
|
@@ -3525,7 +3486,7 @@ class Caldera_Forms {
|
|
3525 |
continue;
|
3526 |
}
|
3527 |
}
|
3528 |
-
|
3529 |
$process = $form_processors[$processor['type']];
|
3530 |
if(!isset($process['processor'])){
|
3531 |
continue;
|
@@ -3544,7 +3505,7 @@ class Caldera_Forms {
|
|
3544 |
if(is_array($process['processor'])){
|
3545 |
$hasmeta = call_user_func_array($process['processor'],array($config, $form, $process_id));
|
3546 |
}else{
|
3547 |
-
if(function_exists($process['processor'])){
|
3548 |
$func = $process['processor'];
|
3549 |
$hasmeta = $func($config, $form, $process_id);
|
3550 |
}
|
@@ -3558,8 +3519,8 @@ class Caldera_Forms {
|
|
3558 |
}
|
3559 |
self::set_submission_meta($metakey, $metavalue, $form, $processor_id);
|
3560 |
}
|
3561 |
-
} // check for transdata errors
|
3562 |
-
|
3563 |
if(!empty($transdata['error'])){
|
3564 |
// remove pending entry
|
3565 |
if( !empty( $entryid ) && !empty($new_entry) && $new_entry['status'] == 'pending' ){
|
@@ -3628,7 +3589,7 @@ class Caldera_Forms {
|
|
3628 |
$process = $form_processors[$processor['type']];
|
3629 |
if(!isset($process['post_processor'])){
|
3630 |
continue;
|
3631 |
-
}
|
3632 |
// set default config
|
3633 |
$config = array();
|
3634 |
$config['processor_id'] = $processor_id;
|
@@ -3644,7 +3605,7 @@ class Caldera_Forms {
|
|
3644 |
}else{
|
3645 |
if(function_exists($process['post_processor'])){
|
3646 |
$func = $process['post_processor'];
|
3647 |
-
$hasmeta = $func($config, $form, $process_id);
|
3648 |
}
|
3649 |
}
|
3650 |
if($hasmeta !== null){
|
@@ -3688,8 +3649,8 @@ class Caldera_Forms {
|
|
3688 |
if( !empty( $cf_id ) ){
|
3689 |
$referrer['query']['cf_id'] = self::do_magic_tags( '{entry_id}' );
|
3690 |
}
|
3691 |
-
}
|
3692 |
-
|
3693 |
// passback values
|
3694 |
if( !empty( $form['variables']['types'] ) ){
|
3695 |
foreach($form['variables']['types'] as $variable_index=>$behavior_type){
|
@@ -3711,7 +3672,7 @@ class Caldera_Forms {
|
|
3711 |
}
|
3712 |
|
3713 |
|
3714 |
-
|
3715 |
/**
|
3716 |
* Makes Caldera Forms load the preview
|
3717 |
*/
|
@@ -3733,13 +3694,13 @@ class Caldera_Forms {
|
|
3733 |
if(empty($temp_page)){
|
3734 |
// create page
|
3735 |
$post = array(
|
3736 |
-
|
3737 |
-
|
3738 |
-
|
3739 |
-
|
3740 |
-
|
3741 |
-
|
3742 |
-
|
3743 |
);
|
3744 |
$page_id = wp_insert_post( $post );
|
3745 |
wp_redirect( trailingslashit( get_home_url() ) . '?page_id='.$page_id.'&preview=true&cf_preview='.$_GET['cf_preview'] );
|
@@ -3765,17 +3726,19 @@ class Caldera_Forms {
|
|
3765 |
$page_forms = array();
|
3766 |
|
3767 |
// check active widgets
|
3768 |
-
$sidebars
|
3769 |
-
$
|
3770 |
-
|
3771 |
-
|
3772 |
-
|
3773 |
-
|
3774 |
-
|
3775 |
-
|
3776 |
-
|
3777 |
-
|
3778 |
-
|
|
|
|
|
3779 |
}
|
3780 |
}
|
3781 |
}
|
@@ -3783,7 +3746,7 @@ class Caldera_Forms {
|
|
3783 |
}
|
3784 |
|
3785 |
$codes = get_shortcode_regex();
|
3786 |
-
preg_match_all('/' . $codes . '/s', $post->post_content, $found);
|
3787 |
|
3788 |
if(!empty($found[0][0])){
|
3789 |
foreach($found[2] as $index=>$code){
|
@@ -3860,7 +3823,7 @@ class Caldera_Forms {
|
|
3860 |
}
|
3861 |
}
|
3862 |
}
|
3863 |
-
|
3864 |
}
|
3865 |
|
3866 |
}
|
@@ -3884,6 +3847,8 @@ class Caldera_Forms {
|
|
3884 |
if( !empty( $_REQUEST['cf_instance'] ) ){
|
3885 |
$atts['instance'] = $_REQUEST['cf_instance'];
|
3886 |
}
|
|
|
|
|
3887 |
if(!empty($form['ID'])){
|
3888 |
if($form['ID'] === $wp_query->query_vars['cf_api']){
|
3889 |
// got it!
|
@@ -3895,7 +3860,7 @@ class Caldera_Forms {
|
|
3895 |
}
|
3896 |
// is a post?
|
3897 |
if( $_SERVER['REQUEST_METHOD'] === 'POST' ){
|
3898 |
-
|
3899 |
if( !empty( $_POST['control'] ) ){
|
3900 |
$transient_name = sanitize_key( $_POST['control'] );
|
3901 |
$transdata = get_transient( $transient_name );
|
@@ -3905,7 +3870,7 @@ class Caldera_Forms {
|
|
3905 |
if( !empty( $_FILES ) && !empty( $_POST['field'] ) ){
|
3906 |
$form = Caldera_Forms_Forms::get_form( $wp_query->query_vars['cf_api'] );
|
3907 |
$field = $form[ 'fields'][ $_POST['field'] ];
|
3908 |
-
|
3909 |
$data = cf_handle_file_upload( true, $field, $form );
|
3910 |
if( is_wp_error( $data ) ){
|
3911 |
wp_send_json_error( $data->get_error_message() );
|
@@ -3945,7 +3910,7 @@ class Caldera_Forms {
|
|
3945 |
* @param string $form_id form ID
|
3946 |
* @return string Full URL
|
3947 |
*/
|
3948 |
-
static function get_submit_url( $form_id ) {
|
3949 |
|
3950 |
if ( is_multisite() && get_blog_option( null, 'permalink_structure' ) || get_option( 'permalink_structure' ) ) {
|
3951 |
$url = get_home_url( );
|
@@ -3955,22 +3920,20 @@ class Caldera_Forms {
|
|
3955 |
$url = add_query_arg( 'cf_api', $form_id, $url );
|
3956 |
}
|
3957 |
if ( is_ssl() ) {
|
3958 |
-
// If the current host is the same as the REST URL host, force the REST URL scheme to HTTPS.
|
3959 |
if ( $_SERVER['SERVER_NAME'] === parse_url( get_home_url( ), PHP_URL_HOST ) ) {
|
3960 |
$url = set_url_scheme( $url, 'https' );
|
3961 |
}
|
3962 |
}
|
3963 |
/**
|
3964 |
-
* Filter the
|
3965 |
*
|
3966 |
-
*
|
3967 |
-
*
|
3968 |
-
* @since 4.4.0
|
3969 |
*
|
3970 |
* @param string $url URL.
|
3971 |
-
* @param string $
|
3972 |
*/
|
3973 |
return apply_filters( 'caldera_forms_submission_url', $url, $form_id );
|
|
|
3974 |
}
|
3975 |
|
3976 |
/**
|
@@ -3979,8 +3942,8 @@ class Caldera_Forms {
|
|
3979 |
static public function cf_init_system(){
|
3980 |
|
3981 |
global $post, $wp_query, $process_id, $form;
|
3982 |
-
|
3983 |
-
// setup script and style urls
|
3984 |
$style_urls = array(
|
3985 |
'modals' => CFCORE_URL . 'assets/css/remodal.min.css',
|
3986 |
'modals-theme' => CFCORE_URL . 'assets/css/remodal-default-theme.min.css',
|
@@ -3994,14 +3957,14 @@ class Caldera_Forms {
|
|
3994 |
'modals' => CFCORE_URL . 'assets/js/remodal.min.js',
|
3995 |
'baldrick' => CFCORE_URL . 'assets/js/jquery.baldrick.min.js',
|
3996 |
'ajax' => CFCORE_URL . 'assets/js/ajax-core.min.js',
|
3997 |
-
'field' => CFCORE_URL . 'assets/js/fields.min.js',
|
3998 |
'conditionals' => CFCORE_URL . 'assets/js/conditionals.min.js',
|
3999 |
'validator-i18n' => null,
|
4000 |
'validator' => CFCORE_URL . 'assets/js/parsley.min.js',
|
4001 |
//'polyfiller' => CFCORE_URL . 'assets/js/polyfiller.min.js',
|
4002 |
-
'init' => CFCORE_URL . 'assets/js/frontend-script-init.min.js',
|
4003 |
);
|
4004 |
-
|
4005 |
$script_style_urls = array();
|
4006 |
|
4007 |
// check to see language and include the language add on
|
@@ -4034,8 +3997,8 @@ class Caldera_Forms {
|
|
4034 |
*
|
4035 |
* @param array $script_urls array containing all urls to register
|
4036 |
*/
|
4037 |
-
$script_style_urls['script'] = apply_filters( 'caldera_forms_script_urls', $script_urls );
|
4038 |
-
|
4039 |
/**
|
4040 |
* Filter style URLS for Caldera Forms on the frontend, before they are enqueued.
|
4041 |
*
|
@@ -4080,7 +4043,7 @@ class Caldera_Forms {
|
|
4080 |
// hook into submission
|
4081 |
if(isset($_POST['_cf_verify']) && isset( $_POST['_cf_frm_id'] )){
|
4082 |
if(wp_verify_nonce( $_POST['_cf_verify'], 'caldera_forms_front' )){
|
4083 |
-
|
4084 |
self::process_submission();
|
4085 |
exit;
|
4086 |
|
@@ -4117,54 +4080,35 @@ class Caldera_Forms {
|
|
4117 |
/**
|
4118 |
* Load a saved entry.
|
4119 |
*
|
4120 |
-
* @param
|
4121 |
-
* @param
|
4122 |
*
|
4123 |
* @return array
|
4124 |
*/
|
4125 |
-
static public function get_entry($entry_id
|
4126 |
-
|
4127 |
-
|
4128 |
-
|
4129 |
-
|
4130 |
-
|
4131 |
-
$form = Caldera_Forms_Forms::get_form( $_POST['form'] );
|
4132 |
-
if(empty($form['ID']) || $form['ID'] != $_POST['form']){
|
4133 |
-
return;
|
4134 |
-
}
|
4135 |
-
|
4136 |
-
$fields = array();
|
4137 |
-
foreach ($form['fields'] as $field_id => $field) {
|
4138 |
-
$fields[$field['slug']] = $field;
|
4139 |
-
}
|
4140 |
-
}
|
4141 |
-
if(empty($form)){
|
4142 |
-
return array();
|
4143 |
}
|
4144 |
-
|
4145 |
}
|
4146 |
-
|
|
|
4147 |
return;
|
4148 |
}
|
4149 |
-
|
4150 |
-
if(is_string($form)){
|
4151 |
-
$form_id = $form;
|
4152 |
-
$form = Caldera_Forms_Forms::get_form( $form );
|
4153 |
-
if(!isset($form['ID']) || $form['ID'] !== $form_id){
|
4154 |
-
return new WP_Error( 'fail', __('Invalid form ID', 'caldera-forms') );
|
4155 |
-
}
|
4156 |
-
}
|
4157 |
|
4158 |
-
|
|
|
4159 |
$field_types = self::get_field_types();
|
4160 |
-
|
4161 |
$entry = self::get_submission_data($form, $entry_id);
|
4162 |
$data = array(
|
4163 |
'data' => array()
|
4164 |
);
|
4165 |
|
4166 |
foreach($entry as $field_id=>$field_value){
|
4167 |
-
|
4168 |
if(!isset($form['fields'][$field_id]) || !isset($field_types[$form['fields'][$field_id]['type']])){
|
4169 |
continue;
|
4170 |
}
|
@@ -4234,16 +4178,17 @@ class Caldera_Forms {
|
|
4234 |
|
4235 |
}
|
4236 |
|
4237 |
-
$
|
4238 |
-
'
|
4239 |
-
|
4240 |
-
|
4241 |
-
|
4242 |
-
|
4243 |
-
|
|
|
4244 |
}
|
4245 |
}
|
4246 |
-
|
4247 |
}
|
4248 |
|
4249 |
$data['data'][$field_id] = array(
|
@@ -4296,23 +4241,18 @@ class Caldera_Forms {
|
|
4296 |
);
|
4297 |
}
|
4298 |
}
|
4299 |
-
}
|
4300 |
-
|
4301 |
// allow plugins to alter the profile.
|
4302 |
$data['user'] = apply_filters( 'caldera_forms_get_entry_user', $data['user'], $entry_id, $form);
|
4303 |
|
4304 |
// set the entry status
|
4305 |
$data['status'] = $entry_detail['status'];
|
4306 |
-
|
4307 |
// allow plugins to alter the entry
|
4308 |
$data = apply_filters( 'caldera_forms_get_entry', $data, $entry_id, $form);
|
4309 |
|
4310 |
-
|
4311 |
-
if(!empty($_POST['form'])){
|
4312 |
-
header('Content-Type: application/json');
|
4313 |
-
echo json_encode( $data );
|
4314 |
-
exit;
|
4315 |
-
}
|
4316 |
return $data;
|
4317 |
}
|
4318 |
|
@@ -4339,7 +4279,7 @@ class Caldera_Forms {
|
|
4339 |
if(empty($form['ID']) || $form['ID'] != $atts['id']){
|
4340 |
return $content;
|
4341 |
}
|
4342 |
-
|
4343 |
$form_atts = array('id'=>$form['ID'],'ajax'=>true);
|
4344 |
if( !empty( $atts['entry'] ) ){
|
4345 |
$form_atts['entry'] = $atts['entry'];
|
@@ -4372,7 +4312,7 @@ class Caldera_Forms {
|
|
4372 |
if(!empty($atts['width'])){
|
4373 |
$width = ' width: ' . floatval( $atts['width'] ).'px; margin-left: -' . ( floatval( $atts['width'] ) / 2 ) . 'px;';
|
4374 |
}
|
4375 |
-
|
4376 |
|
4377 |
ob_start();
|
4378 |
?>
|
@@ -4384,7 +4324,7 @@ class Caldera_Forms {
|
|
4384 |
<h3 class="modal-label" id="<?php echo $modal_id; ?>_modal_label"><?php echo $form['name']; ?></h3>
|
4385 |
</div>
|
4386 |
<div class="caldera-modal-body caldera-front-modal-body" id="<?php echo $modal_id; ?>_modal_body">
|
4387 |
-
|
4388 |
</div>
|
4389 |
</div>
|
4390 |
</div>
|
@@ -4446,20 +4386,33 @@ class Caldera_Forms {
|
|
4446 |
"field" => $field,
|
4447 |
"id" => $field['ID'],//'fld_' . $field['slug'],
|
4448 |
"name" => $field['ID'],//$field['slug'],
|
4449 |
-
"wrapper_before" => "<div data-field-wrapper=\"" . $field['ID'] . "\" class=\"" . $field_wrapper_class . "\">\r\n",
|
4450 |
"field_before" => "<div class=\"" . $field_input_class ."\">\r\n",
|
4451 |
-
"label_before" => ( empty($field['hide_label']) ? "<label for=\"" . $field['ID'].'_'.$current_form_count . "\" class=\"" . implode(' ', $field_classes['field_label'] ) . "\">" : null ),
|
4452 |
"label" => ( empty($field['hide_label']) ? $field['label'] : null ),
|
4453 |
-
"label_required" => ( empty($field['hide_label']) ? ( !empty($field['required']) ? " <span class=\"" . implode(' ', $field_classes['field_required_tag'] ) . "\" style=\"color:#ff2222;\">*</span>" : "" ) : null ),
|
4454 |
"label_after" => ( empty($field['hide_label']) ? "</label>" : null ),
|
4455 |
"field_placeholder" => ( !empty($field['hide_label']) ? 'placeholder="' . htmlentities( $field['label'] ) .'"' : null),
|
4456 |
"field_required" => ( !empty($field['required']) ? 'required="required"' : null),
|
4457 |
"field_value" => null,
|
4458 |
-
"field_caption" => ( !empty($field['caption']) ? "<span class=\"" . implode(' ', $field_classes['field_caption'] ) . "\">" . $field['caption'] . "</span>\r\n" : ""),
|
4459 |
"field_after" => "</div>\r\n",
|
4460 |
"wrapper_after" => "</div>\r\n",
|
|
|
4461 |
);
|
4462 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4463 |
// add error
|
4464 |
if ( ! empty( $field_errors ) ) {
|
4465 |
if( is_string( $field_errors ) ){
|
@@ -4487,6 +4440,15 @@ class Caldera_Forms {
|
|
4487 |
$field_structure = apply_filters( 'caldera_forms_render_field_structure_type-' . $field['type'], $field_structure, $form);
|
4488 |
$field_structure = apply_filters( 'caldera_forms_render_field_structure_slug-' . $field['slug'], $field_structure, $form);
|
4489 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4490 |
$field_name = $field_structure['name'];
|
4491 |
$field_id = $field_structure['id'] . '_' .$current_form_count;
|
4492 |
$wrapper_before = $field_structure['wrapper_before'];
|
@@ -4504,7 +4466,7 @@ class Caldera_Forms {
|
|
4504 |
|
4505 |
// register strings
|
4506 |
$form_field_strings[ $field_structure['id'] ] = array( 'id' => $field_structure['id'], 'instance' => $current_form_count, 'slug' => $field['slug'], 'label' => $field['label'] );
|
4507 |
-
|
4508 |
$field_types = self::get_field_types();
|
4509 |
|
4510 |
$field_file = $field_types[$field['type']]['file'];
|
@@ -4571,16 +4533,16 @@ class Caldera_Forms {
|
|
4571 |
if( isset( $form['form_draft'] ) ){
|
4572 |
if( !isset( $_GET['cf_preview'] ) || $_GET['cf_preview'] != $form['ID'] ){
|
4573 |
if( isset( $_POST['action'] ) && $_POST['action'] == 'cf_get_form_preview' ){
|
4574 |
-
echo '<p style="color: #cf0000;">' . __('Form is currently not active.', 'caldera-forms') . '</p>';
|
4575 |
}else{
|
4576 |
return;
|
4577 |
}
|
4578 |
-
|
4579 |
}else{
|
4580 |
-
echo '<div class="caldera-grid"><p class="alert alert-error alert-danger">' . __('Form is currently not active.', 'caldera-forms') . '</p></div>';
|
4581 |
}
|
4582 |
}
|
4583 |
-
|
4584 |
if(isset($atts['ajax'])){
|
4585 |
if(!empty($atts['ajax'])){
|
4586 |
$form['form_ajax'] = 1;
|
@@ -4638,7 +4600,7 @@ class Caldera_Forms {
|
|
4638 |
$current_form_count = 0;
|
4639 |
}
|
4640 |
$current_form_count += 1;
|
4641 |
-
|
4642 |
// set instance
|
4643 |
if( !empty( $atts['instance'] ) ){
|
4644 |
$current_form_count = absint( $atts['instance'] );
|
@@ -4699,7 +4661,7 @@ class Caldera_Forms {
|
|
4699 |
"column_before" => '<div %1$s class="col-'.$gridsize.'-%2$d %3$s">',
|
4700 |
"column_after" => '</div>',
|
4701 |
);
|
4702 |
-
|
4703 |
// filter settings
|
4704 |
$grid_settings = apply_filters( 'caldera_forms_render_grid_settings', $grid_settings, $form);
|
4705 |
|
@@ -4744,11 +4706,11 @@ class Caldera_Forms {
|
|
4744 |
'alert-danger'
|
4745 |
)),
|
4746 |
);
|
4747 |
-
|
4748 |
$note_classes = apply_filters( 'caldera_forms_render_note_classes', $note_classes, $form);
|
4749 |
|
4750 |
$field_errors = array();
|
4751 |
-
|
4752 |
// edit entry from url
|
4753 |
if(!empty($_GET['cf_ee'])){
|
4754 |
$entry_id = $_GET['cf_ee'];
|
@@ -4756,9 +4718,9 @@ class Caldera_Forms {
|
|
4756 |
|
4757 |
// attr entry id
|
4758 |
if(!empty($atts['entry'])){
|
4759 |
-
$entry_id = $atts['entry'];
|
4760 |
}
|
4761 |
-
|
4762 |
if(!empty($entry_id)){
|
4763 |
//check user can edit this item.
|
4764 |
$user_id = get_current_user_id();
|
@@ -4772,7 +4734,7 @@ class Caldera_Forms {
|
|
4772 |
'form_id' => $form['ID']
|
4773 |
);
|
4774 |
if( sha1( json_encode( $token_array ) ) !== trim( $_GET['cf_et'] ) ){
|
4775 |
-
$notices['error']['note'] = __('Permission denied or entry does not exist.', 'caldera-forms');
|
4776 |
}else{
|
4777 |
$entry_id = (int) $details['id'];
|
4778 |
$edit_token = sha1( json_encode( $token_array ) );
|
@@ -4788,14 +4750,14 @@ class Caldera_Forms {
|
|
4788 |
// can edit.
|
4789 |
$entry_id = (int) $details['id'];
|
4790 |
}else{
|
4791 |
-
$notices['error']['note'] = __('Permission denied or entry does not exist.', 'caldera-forms');
|
4792 |
}
|
4793 |
}else{
|
4794 |
-
$notices['error']['note'] = __('Permission denied or entry does not exist.', 'caldera-forms');
|
4795 |
}
|
4796 |
|
4797 |
}else{
|
4798 |
-
$notices['error']['note'] = __('Permission denied or entry does not exist.', 'caldera-forms');
|
4799 |
}
|
4800 |
}
|
4801 |
|
@@ -4810,7 +4772,7 @@ class Caldera_Forms {
|
|
4810 |
|
4811 |
// load requested data
|
4812 |
if(!empty($entry_id)){
|
4813 |
-
$prev_entry = self::get_entry($entry_id, $form);
|
4814 |
$prev_data = array();
|
4815 |
self::set_field_data('_entry_id', $entry_id, $form);
|
4816 |
foreach($prev_entry['data'] as $field_id=>$entry_data){
|
@@ -4822,10 +4784,10 @@ class Caldera_Forms {
|
|
4822 |
if(!empty($_GET['cf_er'])){
|
4823 |
$prev_post = get_transient( $_GET['cf_er'] );
|
4824 |
if(!empty($prev_post['transient'])){
|
4825 |
-
|
4826 |
if($prev_post['transient'] === $_GET['cf_er']){
|
4827 |
foreach($prev_post['data'] as $field_id=>$field_entry){
|
4828 |
-
|
4829 |
if(!isset($form['fields'][$field_id])){
|
4830 |
continue; // ignore non field data
|
4831 |
}
|
@@ -4840,8 +4802,8 @@ class Caldera_Forms {
|
|
4840 |
}
|
4841 |
if(!empty($prev_post['error']) && !empty($prev_post['note'])){
|
4842 |
$notices['error']['note'] = $prev_post['note'];
|
4843 |
-
}
|
4844 |
-
if(!empty($prev_post['fields'])){
|
4845 |
$field_errors = array();
|
4846 |
foreach($prev_post['fields'] as $field_id=>$field_error){
|
4847 |
|
@@ -4875,12 +4837,14 @@ class Caldera_Forms {
|
|
4875 |
$currentpage = (int) $prev_post['page'];
|
4876 |
}
|
4877 |
$display = 'none';
|
|
|
4878 |
if( $currentpage === 1){
|
4879 |
$display = 'block';
|
|
|
4880 |
}
|
4881 |
|
4882 |
$total_rows = substr_count($form['layout_grid']['structure'], '|') + 1;
|
4883 |
-
$form['grid_object']->before('<div data-formpage="1" class="caldera-form-page" style="display:'.$display.';">', 1);
|
4884 |
$form['grid_object']->after('</div>', $total_rows);
|
4885 |
//dump($page_breaks);
|
4886 |
foreach($page_breaks as $page=>$break){
|
@@ -4889,11 +4853,13 @@ class Caldera_Forms {
|
|
4889 |
|
4890 |
if($break+1 <= $total_rows ){
|
4891 |
$display = 'none';
|
|
|
4892 |
if($page+2 == $currentpage){
|
4893 |
$display = 'block';
|
|
|
4894 |
}
|
4895 |
|
4896 |
-
$form['grid_object']->before('<div data-formpage="' . ($page+2) . '" class="caldera-form-page" style="display:'.$display.';">', $break+1);
|
4897 |
}
|
4898 |
}
|
4899 |
//dump($page_breaks,0);
|
@@ -4910,7 +4876,7 @@ class Caldera_Forms {
|
|
4910 |
if($slug == '_required_bounds'){
|
4911 |
continue;
|
4912 |
}
|
4913 |
-
if(in_array($slug, $processor['config']['_required_bounds'])){
|
4914 |
$bound_fields = array_merge($bound_fields, self::search_array_fields($value, array_keys( $form['fields'])) );
|
4915 |
}
|
4916 |
}
|
@@ -4927,7 +4893,7 @@ class Caldera_Forms {
|
|
4927 |
$form_field_strings = array();
|
4928 |
|
4929 |
if(!empty($form['fields'])){
|
4930 |
-
// prepare fields
|
4931 |
foreach($form['fields'] as $field_id=>$field){
|
4932 |
$field = apply_filters( 'caldera_forms_render_get_field', $field, $form);
|
4933 |
$field = apply_filters( 'caldera_forms_render_get_field_type-' . $field['type'], $field, $form);
|
@@ -4999,7 +4965,7 @@ class Caldera_Forms {
|
|
4999 |
// dump($field['conditions'],0);
|
5000 |
//}
|
5001 |
$conditions_configs[$field_base_id] = $field['conditions'];
|
5002 |
-
|
5003 |
if( $field['conditions']['type'] !== 'disable' ){
|
5004 |
// wrap it up
|
5005 |
$conditions_templates[$field_base_id] = "<script type=\"text/html\" id=\"conditional-" . $field_base_id . "-tmpl\">\r\n" . $field_html . "</script>\r\n";
|
@@ -5013,17 +4979,17 @@ class Caldera_Forms {
|
|
5013 |
}
|
5014 |
}
|
5015 |
}
|
5016 |
-
|
5017 |
if($field['conditions']['type'] == 'show' || $field['conditions']['type'] == 'wdisable'){
|
5018 |
// show if indicates hidden by default until condition is matched.
|
5019 |
$field_html = null;
|
5020 |
}
|
5021 |
// wrapp it up
|
5022 |
-
$field_html = '<span class="caldera-forms-conditional-field" id="conditional_' . $field_base_id . '">' . $field_html . '</span>';
|
5023 |
}
|
5024 |
|
5025 |
$form['grid_object']->append($field_html, $field['grid_location']);
|
5026 |
-
|
5027 |
}
|
5028 |
}
|
5029 |
}
|
@@ -5062,7 +5028,7 @@ class Caldera_Forms {
|
|
5062 |
|
5063 |
// set debug notice
|
5064 |
if( !empty( $form['mailer']['enable_mailer'] ) && !empty( $form['debug_mailer'] ) ){
|
5065 |
-
$notices['error'] = array( 'note' => __('WARNING: Form is in Mailer Debug mode. Disable before going live.', 'caldera-forms') );
|
5066 |
}
|
5067 |
|
5068 |
$out .= '<div id="caldera_notices_'.$current_form_count.'" data-spinner="'. admin_url( 'images/spinner.gif' ).'">';
|
@@ -5076,15 +5042,15 @@ class Caldera_Forms {
|
|
5076 |
}else{
|
5077 |
$notice_entry_id = null;
|
5078 |
}
|
5079 |
-
|
5080 |
foreach($notices as $note_type => $notice){
|
5081 |
-
if(!empty($notice['note'])){
|
5082 |
$out .= '<div class=" '. implode(' ', $note_classes[$note_type]) . '">' . self::do_magic_tags( $notice['note'], $notice_entry_id ) .'</div>';
|
5083 |
}
|
5084 |
}
|
5085 |
|
5086 |
}
|
5087 |
-
$out .= '</div>';
|
5088 |
if((empty($notices['success']) || empty($form['hide_form'])) && empty($halt_render)){
|
5089 |
|
5090 |
$form_element = 'form';
|
@@ -5093,7 +5059,7 @@ class Caldera_Forms {
|
|
5093 |
$form['ID'],
|
5094 |
'caldera_forms_form',
|
5095 |
);
|
5096 |
-
|
5097 |
$form_attributes = array(
|
5098 |
'method' => 'POST',
|
5099 |
'enctype' => 'multipart/form-data',
|
@@ -5155,7 +5121,7 @@ class Caldera_Forms {
|
|
5155 |
$out .= "<input type=\"hidden\" name=\"_cf_frm_tr\" value=\"" . $prev_post['transient'] . "\">\r\n";
|
5156 |
}
|
5157 |
// is edit?
|
5158 |
-
if(!empty($entry_id)){
|
5159 |
$out .= "<input type=\"hidden\" name=\"_cf_frm_edt\" value=\"" . $entry_id . "\">\r\n";
|
5160 |
}
|
5161 |
|
@@ -5167,28 +5133,29 @@ class Caldera_Forms {
|
|
5167 |
|
5168 |
// auto pagination
|
5169 |
if(!empty($form['auto_progress']) && count($form['page_names']) > 1){
|
5170 |
-
|
5171 |
-
|
5172 |
-
|
5173 |
-
|
5174 |
-
|
5175 |
-
|
5176 |
-
|
5177 |
-
|
5178 |
-
}
|
5179 |
-
foreach($form['page_names'] as $page_key=>$page_name){
|
5180 |
-
$tabclass = null;
|
5181 |
-
|
5182 |
-
if($current_page == $page_key + 1){
|
5183 |
-
$tabclass = ' class="active"';
|
5184 |
}
|
5185 |
-
|
5186 |
-
|
5187 |
-
|
5188 |
-
|
5189 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5190 |
}
|
5191 |
-
|
5192 |
// sticky sticky honey
|
5193 |
if(isset($form['check_honey'])){
|
5194 |
$out .= "<div class=\"hide\" style=\"display:none; overflow:hidden;height:0;width:0;\">\r\n";
|
@@ -5201,8 +5168,8 @@ class Caldera_Forms {
|
|
5201 |
* @param array $words An array of words.
|
5202 |
*/
|
5203 |
$honey_words = apply_filters( 'caldera_forms_get_honey_words', array('web_site', 'url', 'email', 'company', 'name'));
|
5204 |
-
|
5205 |
-
|
5206 |
$out .= "</div>";
|
5207 |
}
|
5208 |
|
@@ -5210,12 +5177,12 @@ class Caldera_Forms {
|
|
5210 |
|
5211 |
$out .= "</" . $form_element . ">\r\n";
|
5212 |
}
|
5213 |
-
|
5214 |
$out .= "</div>\r\n";
|
5215 |
-
|
5216 |
// output javascript conditions.
|
5217 |
if(!empty($conditions_configs)){
|
5218 |
-
// sortout magics
|
5219 |
foreach($conditions_configs as &$condition_field_conf){
|
5220 |
if(!empty($condition_field_conf['group'])){
|
5221 |
foreach($condition_field_conf['group'] as &$condition_group){
|
@@ -5254,7 +5221,7 @@ class Caldera_Forms {
|
|
5254 |
// find %tags%
|
5255 |
preg_match_all("/%(.+?)%/", $conditions_str, $hastags);
|
5256 |
if(!empty($hastags[1])){
|
5257 |
-
|
5258 |
foreach($hastags[1] as $tag_key=>$tag){
|
5259 |
|
5260 |
foreach($form['fields'] as $field_id=>$field){
|
@@ -5331,7 +5298,7 @@ class Caldera_Forms {
|
|
5331 |
* @param array|null $form Form config if it was passed.
|
5332 |
*/
|
5333 |
return apply_filters( 'caldera_forms_manage_cap', 'manage_options', $context, $form );
|
5334 |
-
|
5335 |
}
|
5336 |
|
5337 |
/**
|
@@ -5352,7 +5319,7 @@ class Caldera_Forms {
|
|
5352 |
if( $shortcode === 'caldera_form_modal' ){
|
5353 |
$atts[ 'modal' ] = true;
|
5354 |
}
|
5355 |
-
|
5356 |
if( isset( $atts[ 'modal' ] ) && $atts[ 'modal' ] ) {
|
5357 |
$form = Caldera_Forms_Forms::get_form( $atts[ 'id' ] );
|
5358 |
if( ! is_array( $form ) ) {
|
@@ -5379,7 +5346,7 @@ class Caldera_Forms {
|
|
5379 |
if( !empty( $atts['type'] ) && $atts['type'] == 'button' ){
|
5380 |
$form = sprintf( '<button class="caldera-forms-modal" %1s title="%2s">%3s</button>', $tag_atts, $title, $content );
|
5381 |
}else{
|
5382 |
-
$form = sprintf( '<a href="#" class="caldera-forms-modal" %1s title="%2s">%3s</a>', $tag_atts, $title, $content );
|
5383 |
}
|
5384 |
|
5385 |
wp_enqueue_script( 'cf-dynamic' );
|
@@ -5394,7 +5361,7 @@ class Caldera_Forms {
|
|
5394 |
/**
|
5395 |
* Convert time entry was submitted (as MySQL timestamp in UTC) to local display time
|
5396 |
*
|
5397 |
-
* @since 1.
|
5398 |
*
|
5399 |
* @param string $submitted Timestamp
|
5400 |
*
|
@@ -5406,11 +5373,8 @@ class Caldera_Forms {
|
|
5406 |
|
5407 |
$format = $dateformat.' '.$timeformat;
|
5408 |
$time = get_date_from_gmt( $submitted, $format );
|
5409 |
-
|
5410 |
return $time;
|
5411 |
}
|
5412 |
|
5413 |
-
|
5414 |
-
|
5415 |
-
|
5416 |
}
|
6 |
* @package Caldera_Forms
|
7 |
* @author David <david@digilab.co.za>
|
8 |
* @license GPL-2.0+
|
9 |
+
* @link
|
10 |
* @copyright 2014 David Cramer
|
11 |
*/
|
12 |
|
77 |
|
78 |
// action
|
79 |
add_action('caldera_forms_submit_complete', array( $this, 'save_final_form'),50);
|
80 |
+
|
|
|
81 |
// find if profile is loaded
|
82 |
add_action('wp_loaded', array( $this, 'cf_init_system'), 25 );
|
83 |
add_action('wp', array( $this, 'cf_init_preview'));
|
88 |
add_shortcode( 'caldera_form_modal', array( $this, 'shortcode_handler') );
|
89 |
add_action( 'wp_footer', array( $this, 'render_footer_modals') );
|
90 |
|
91 |
+
//emails
|
92 |
+
add_action( 'caldera_forms_core_init', array( 'Caldera_Forms_Email_Settings', 'maybe_add_hooks' ) );
|
93 |
+
add_action( 'caldera_forms_admin_footer', array( 'Caldera_Forms_Email_Settings', 'ui' ) );
|
94 |
+
add_filter( 'pre_update_option__caldera_forms_email_api_settings', array( 'Caldera_Forms_Email_Settings', 'sanitize_save' ) );
|
95 |
+
if( current_user_can( Caldera_Forms::get_manage_cap( 'admin' ) ) ) {
|
96 |
+
add_action( 'wp_ajax_cf_email_save', array( 'Caldera_Forms_Email_Settings', 'save' ) );
|
97 |
+
}
|
98 |
+
|
99 |
+
|
100 |
+
if( current_user_can( Caldera_Forms::get_manage_cap( 'admin' ) ) ) {
|
101 |
+
$id = null;
|
102 |
+
$view = false;
|
103 |
+
if( isset( $_GET[ 'cf-email-preview' ], $_GET[ 'cf-email-preview-form' ] ) ){
|
104 |
+
if( wp_verify_nonce( $_GET[ 'cf-email-preview' ], $_GET[ 'cf-email-preview-form' ] ) ) {
|
105 |
+
$id = $_GET[ 'cf-email-preview-form' ];
|
106 |
+
$view = true;
|
107 |
+
}
|
108 |
+
}
|
109 |
+
|
110 |
+
new Caldera_Forms_Email_Previews( $id, $view );
|
111 |
+
|
112 |
+
}
|
113 |
+
|
114 |
|
115 |
/**
|
116 |
* Runs after Caldera Forms core is initialized
|
117 |
*
|
118 |
+
* @since 1.3.5.3
|
119 |
*/
|
120 |
do_action( 'caldera_forms_core_init' );
|
121 |
|
183 |
caldera_forms_db_v2_update();
|
184 |
}
|
185 |
|
186 |
+
if( $db_version < 4 || $force_update ){
|
187 |
self::activate_caldera_forms( true );
|
188 |
+
caldera_forms_write_db_flag( 4 );
|
189 |
}
|
190 |
+
|
191 |
}
|
192 |
|
193 |
|
202 |
public static function activate_caldera_forms( $force = false ){
|
203 |
wp_schedule_event( time(), 'daily', 'caldera_forms_tracking_send_rows' );
|
204 |
global $wpdb;
|
205 |
+
|
206 |
// ensure urls are there
|
207 |
self::init_cf_internal();
|
208 |
|
209 |
$version = get_option('_calderaforms_lastupdate');
|
210 |
+
|
211 |
// ensure rewrites
|
212 |
flush_rewrite_rules();
|
213 |
|
216 |
return;
|
217 |
}
|
218 |
}
|
219 |
+
|
220 |
update_option('_calderaforms_lastupdate',CFCORE_VER);
|
221 |
|
222 |
$charset_collate = '';
|
228 |
if ( ! empty( $wpdb->collate ) ) {
|
229 |
$charset_collate .= " COLLATE $wpdb->collate";
|
230 |
}
|
231 |
+
|
232 |
+
/*
|
233 |
+
* Indexes have a maximum size of 767 bytes. Historically, we haven't need to be concerned about that.
|
234 |
+
* As of WordPress 4.2, however, we moved to utf8mb4, which uses 4 bytes per character. This means that an index which
|
235 |
+
* used to have room for floor(767/3) = 255 characters, now only has room for floor(767/4) = 191 characters.
|
236 |
+
*/
|
237 |
+
$max_index_length = 191;
|
238 |
|
239 |
$tables = $wpdb->get_results("SHOW TABLES", ARRAY_A);
|
240 |
foreach($tables as $table){
|
253 |
`meta_key` varchar(255) DEFAULT NULL,
|
254 |
`meta_value` longtext,
|
255 |
PRIMARY KEY (`meta_id`),
|
256 |
+
KEY `meta_key` (meta_key(" . $max_index_length . ")),
|
257 |
KEY `entry_id` (`entry_id`)
|
258 |
) " . $charset_collate . ";";
|
259 |
|
286 |
`meta_key` varchar(255) DEFAULT NULL,
|
287 |
`meta_value` longtext,
|
288 |
PRIMARY KEY (`meta_id`),
|
289 |
+
KEY `meta_key` (`meta_key`(" . $max_index_length . ")),
|
290 |
KEY `event_id` (`event_id`)
|
291 |
) " . $charset_collate . ";";
|
292 |
|
293 |
dbDelta( $meta_table );
|
294 |
|
|
|
295 |
}
|
296 |
|
297 |
+
|
298 |
+
if( !in_array($wpdb->prefix.'cf_form_entries', $alltables) || !in_array($wpdb->prefix.'cf_form_entry_values', $alltables) ){
|
299 |
// create tables
|
300 |
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
301 |
|
302 |
+
if( !in_array($wpdb->prefix.'cf_form_entries', $alltables) ){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
303 |
|
304 |
+
$entry_table = "CREATE TABLE `" . $wpdb->prefix . "cf_form_entries` (
|
305 |
+
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
306 |
+
`form_id` varchar(18) NOT NULL DEFAULT '',
|
307 |
+
`user_id` int(11) NOT NULL,
|
308 |
+
`datestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
309 |
+
`status` varchar(20) NOT NULL DEFAULT 'active',
|
310 |
+
PRIMARY KEY (`id`),
|
311 |
+
KEY `form_id` (`form_id`),
|
312 |
+
KEY `user_id` (`user_id`),
|
313 |
+
KEY `date_time` (`datestamp`),
|
314 |
+
KEY `status` (`status`)
|
315 |
+
) " . $charset_collate . ";";
|
316 |
+
|
317 |
+
|
318 |
+
dbDelta( $entry_table );
|
319 |
+
}
|
320 |
+
|
321 |
+
if( !in_array($wpdb->prefix.'cf_form_entry_values', $alltables) ){
|
322 |
+
|
323 |
+
$values_table = "CREATE TABLE `" . $wpdb->prefix . "cf_form_entry_values` (
|
324 |
+
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
325 |
+
`entry_id` int(11) NOT NULL,
|
326 |
+
`field_id` varchar(20) NOT NULL,
|
327 |
+
`slug` varchar(255) NOT NULL DEFAULT '',
|
328 |
+
`value` longtext NOT NULL,
|
329 |
+
PRIMARY KEY (`id`),
|
330 |
+
KEY `form_id` (`entry_id`),
|
331 |
+
KEY `field_id` (`field_id`),
|
332 |
+
KEY `slug` (`slug`(" . $max_index_length . "))
|
333 |
+
) " . $charset_collate . ";";
|
334 |
+
|
335 |
+
dbDelta( $values_table );
|
336 |
+
}
|
337 |
|
|
|
|
|
338 |
}else{
|
339 |
if($version >= '1.1.5'){
|
340 |
return; // only if 1.1.4 or lower
|
378 |
$wpdb->query( "ALTER TABLE `" . $wpdb->prefix . "cf_form_entries` ADD `status` varchar(20) NOT NULL DEFAULT 'active' AFTER `datestamp`;" );
|
379 |
$wpdb->query( "CREATE INDEX `status` ON `" . $wpdb->prefix . "cf_form_entries` (`status`); ");
|
380 |
}
|
381 |
+
|
382 |
}
|
383 |
|
384 |
}
|
482 |
*/
|
483 |
public static function captcha_check($value, $field, $form){
|
484 |
return true;
|
485 |
+
|
486 |
if( !isset( $_POST['g-recaptcha-response'] ) || empty( $_POST['g-recaptcha-response'] )){
|
487 |
return new WP_Error( 'error' );
|
488 |
}
|
495 |
$request = wp_remote_get( 'https://www.google.com/recaptcha/api/siteverify?' . build_query($args) );
|
496 |
$result = json_decode( wp_remote_retrieve_body( $request ) );
|
497 |
if( empty( $result->success ) ){
|
498 |
+
return new WP_Error( 'error', __( "The wasn't entered correct.", 'caldera-forms' ) . ' <a href="#" class="reset_' . sanitize_text_field( $_POST[ $field['ID'] ] ) . '">' . __( 'Reset', 'caldera-forms' ) . '<a>.' );
|
499 |
}
|
500 |
|
501 |
|
511 |
*/
|
512 |
public static function update_field_data($field, $entry_id, $form){
|
513 |
global $wpdb, $form;
|
514 |
+
|
515 |
$field_types = self::get_field_types();
|
516 |
// is capture?
|
517 |
if(isset($field_types[$form['fields'][$field['ID']]['type']]['setup']['not_supported'])){
|
519 |
return;
|
520 |
}
|
521 |
}
|
522 |
+
|
523 |
$new_data = self::get_field_data($field['ID'], $form);
|
524 |
$original_data = self::get_field_data($field['ID'], $form, $entry_id);
|
525 |
+
|
526 |
if($original_data === $new_data){
|
527 |
// no change
|
528 |
return;
|
535 |
if( has_filter( 'caldera_forms_save_field_' . $field['type'] ) ){
|
536 |
$new_data = apply_filters( 'caldera_forms_update_field_' . $field['type'], $new_data, $field, $form );
|
537 |
}
|
538 |
+
|
539 |
if($original_data !== null){
|
540 |
$wpdb->delete($wpdb->prefix . 'cf_form_entry_values', array('entry_id' => $entry_id, 'field_id' => $field['ID'] ) );
|
541 |
}
|
593 |
'slug' => $field['slug'],
|
594 |
'value' => self::do_magic_tags( $entry )
|
595 |
);
|
596 |
+
|
597 |
// named key kets .key to slug
|
598 |
if(!is_int($key)){
|
599 |
// Keyed
|
605 |
}
|
606 |
|
607 |
if(!empty($keyed)){
|
608 |
+
|
609 |
if( has_filter( 'caldera_forms_save_field_combined' . $field['type'] ) ){
|
610 |
$data = apply_filters( 'caldera_forms_save_field_combined' . $field['type'], $entry, $field );
|
611 |
}
|
650 |
'form_id' => $form['ID']
|
651 |
);
|
652 |
if( sha1( json_encode( $token_array ) ) !== trim( $_POST['_cf_frm_edt_tkn'] ) ){
|
653 |
+
return new WP_Error( 'error', __( "Permission denied.", 'caldera-forms' ) );
|
654 |
}else{
|
655 |
$entryid = (int) $details['id'];
|
656 |
$edit_token = sha1( json_encode( $token_array ) );
|
664 |
if( current_user_can( 'edit_posts' ) || $details['user_id'] === $user_id ){
|
665 |
$entryid = $_POST['_cf_frm_edt'];
|
666 |
}else{
|
667 |
+
return new WP_Error( 'error', __( "Permission denied.", 'caldera-forms' ) );
|
668 |
}
|
669 |
}
|
670 |
|
672 |
}
|
673 |
|
674 |
}
|
675 |
+
|
|
|
|
|
|
|
676 |
if(! empty( $form[ 'db_support' ] ) ) {
|
677 |
Caldera_Forms_Save_Final::save_in_db( $form, $entryid );
|
678 |
}
|
679 |
+
|
680 |
if( !empty( $transdata['edit'] ) ){
|
681 |
// update
|
682 |
if( empty($form['mailer']['on_update'] ) ){
|
688 |
return;
|
689 |
}
|
690 |
}
|
691 |
+
|
692 |
Caldera_Forms_Save_Final::do_mailer( $form, $entryid );
|
693 |
|
694 |
|
705 |
// this is a hack since there is not filter / action for a failed mail... yet
|
706 |
//$phpmailer->SMTPDebug = 3;
|
707 |
ob_start();
|
708 |
+
$phpmailer->SMTPDebug = 3;
|
709 |
+
try {
|
710 |
+
$phpmailer->Send();
|
711 |
+
} catch ( phpmailerException $e ) {
|
712 |
+
print_r( $phpmailer->ErrorInfo );
|
713 |
+
}
|
714 |
+
print_r( $phpmailer );
|
715 |
+
$phpmailer->SMTPDebug = 0;
|
716 |
$result = ob_get_clean();
|
717 |
|
718 |
$meta_entry = array(
|
722 |
'meta_value' => $result
|
723 |
);
|
724 |
|
725 |
+
$wpdb->insert($wpdb->prefix . 'cf_form_entry_meta', $meta_entry);
|
726 |
|
727 |
|
728 |
|
767 |
}
|
768 |
}
|
769 |
}
|
770 |
+
|
771 |
return $notices;
|
772 |
}
|
773 |
|
827 |
}
|
828 |
|
829 |
/**
|
830 |
+
* Process the auto-responder
|
831 |
+
*
|
832 |
+
* @since unknown
|
833 |
*
|
834 |
* @param array $config Processor config
|
835 |
* @param array $form Form config
|
836 |
*/
|
837 |
public static function send_auto_response($config, $form){
|
838 |
global $form;
|
839 |
+
|
840 |
// new filter to alter the config.
|
841 |
+
$config = apply_filters( 'caldera_forms_autoresponse_config', $config, $form);
|
842 |
// remove required bounds.
|
843 |
unset($config['_required_bounds']);
|
844 |
|
845 |
$message = $config['message'];
|
846 |
+
foreach( $config as $tag => &$value ){
|
847 |
if($tag !== 'message'){
|
848 |
$message = str_replace('%'.$tag.'%', $value, $message);
|
849 |
$value = self::do_magic_tags( $value );
|
851 |
}
|
852 |
// set header
|
853 |
$headers[] = 'From: ' . $config['sender_name'] . ' <' . $config['sender_email'] . '>';
|
854 |
+
|
855 |
if( ! isset( $config[ 'html'] ) || true == $config['html'] ){
|
856 |
$headers[] = "Content-type: text/html";
|
857 |
$message = wpautop( self::do_magic_tags( $message ) );
|
862 |
|
863 |
|
864 |
// setup mailer
|
865 |
+
$subject = $config['subject'];
|
866 |
|
867 |
$email_message = array(
|
868 |
'recipients' => array(
|
876 |
|
877 |
$email_message = apply_filters( 'caldera_forms_autoresponse_mail', $email_message, $config, $form);
|
878 |
|
879 |
+
if( 'wp' !== Caldera_Forms_Email_Settings::get_method() ){
|
880 |
+
$email_message[ 'from'] = $email_message[ 'replyto' ] = $config[ 'sender_email' ];
|
881 |
+
$email_message[ 'from_name' ] = $config['sender_name'];
|
882 |
+
$email_message[ 'bcc' ] = $email_message[ 'csv' ] = false;
|
883 |
+
|
884 |
+
Caldera_Forms_Save_Final::do_mailer( $form, null, null, $email_message );
|
885 |
+
return;
|
886 |
+
}
|
887 |
+
|
888 |
do_action( 'caldera_forms_do_autoresponse', $config, $form);
|
889 |
|
890 |
// send mail
|
908 |
*/
|
909 |
do_action( 'caldera_forms_autoresponder_failed', $email_message, $config, $form );
|
910 |
}
|
911 |
+
|
912 |
}
|
913 |
|
914 |
|
922 |
public function get_form_processors($processors){
|
923 |
$internal_processors = array(
|
924 |
'auto_responder' => array(
|
925 |
+
"name" => __( 'Auto Responder', 'caldera-forms' ),
|
926 |
+
"description" => __( 'Sends out an auto response e-mail', 'caldera-forms' ),
|
927 |
"post_processor" => array($this, 'send_auto_response'),
|
928 |
"template" => CFCORE_PATH . "processors/auto_responder/config.php",
|
929 |
"default" => array(
|
930 |
+
'subject' => __( 'Thank you for contacting us', 'caldera-forms' )
|
931 |
),
|
932 |
),
|
933 |
'form_redirect' => array(
|
934 |
+
"name" => __( 'Redirect', 'caldera-forms' ),
|
935 |
+
"description" => __( 'Redirects user to URL on successful submit', 'caldera-forms' ),
|
936 |
"template" => CFCORE_PATH . "processors/redirect/config.php",
|
937 |
"single" => false
|
938 |
),
|
939 |
'increment_capture' => array(
|
940 |
+
"name" => __( 'Increment Value', 'caldera-forms' ),
|
941 |
+
"description" => __( 'Increment a value per entry.', 'caldera-forms' ),
|
942 |
"processor" => array( $this, 'increment_value' ),
|
943 |
"template" => CFCORE_PATH . "processors/increment/config.php",
|
944 |
"single" => true,
|
952 |
$wp_api_key = get_option( 'wordpress_api_key' );
|
953 |
if(!empty($wp_api_key)){
|
954 |
$internal_processors['akismet'] = array(
|
955 |
+
"name" => __( 'Akismet', 'caldera-forms' ),
|
956 |
+
"description" => __( 'Anti-spam filtering', 'caldera-forms' ),
|
957 |
"pre_processor" => array( $this, 'akismet_scanner'),
|
958 |
"template" => CFCORE_PATH . "processors/akismet/config.php",
|
959 |
"single" => false,
|
980 |
|
981 |
// get increment value;
|
982 |
$increment_value = get_option('_increment_' . $config['processor_id'], $config['start'] );
|
983 |
+
|
984 |
update_option( '_increment_' . $config['processor_id'], $increment_value + 1 );
|
985 |
+
|
986 |
if( !empty( $config['field'] ) ){
|
987 |
self::set_field_data( $config['field'], $increment_value, $form );
|
988 |
}
|
1005 |
|
1006 |
$wp_api_key = get_option( 'wordpress_api_key' );
|
1007 |
if(empty($wp_api_key)){
|
1008 |
+
return array('type' => 'error', 'note' => __( 'Akismet not setup.'));
|
1009 |
}
|
1010 |
// set permalink
|
1011 |
if($post->ID){
|
1036 |
$data['comment_author_url'] = self::do_magic_tags($config['url']);
|
1037 |
};
|
1038 |
if(!empty($config['content'])){
|
1039 |
+
$data['comment_content'] = self::do_magic_tags($config['content']);
|
1040 |
};
|
1041 |
|
1042 |
$request = http_build_query($data);
|
1055 |
$http_request .= $request;
|
1056 |
$response = '';
|
1057 |
if( false != ( $fs = @fsockopen( $http_host, $port, $errno, $errstr, 10 ) ) ) {
|
1058 |
+
|
1059 |
fwrite( $fs, $http_request );
|
1060 |
+
|
1061 |
while ( !feof( $fs ) )
|
1062 |
+
$response .= fgets( $fs, 1160 ); // One TCP-IP packet
|
1063 |
fclose( $fs );
|
1064 |
+
|
1065 |
$response = explode( "\r\n\r\n", $response, 2 );
|
1066 |
|
1067 |
}
|
1081 |
*
|
1082 |
* @return int|string
|
1083 |
*/
|
1084 |
+
static public function run_calculation($value, $field, $form){
|
1085 |
|
1086 |
$formula = $field['config']['formular'];
|
1087 |
|
1122 |
}else{
|
1123 |
$number = floatval( $entry_value );
|
1124 |
}
|
1125 |
+
|
1126 |
$formula = str_replace($fid, $number, $formula);
|
1127 |
}
|
1128 |
}
|
1136 |
|
1137 |
if(isset($field['config']['fixed'])){
|
1138 |
if( function_exists( 'money_format' ) ){
|
1139 |
+
return money_format('%i', $total );
|
1140 |
}else{
|
1141 |
return sprintf('%01.2f', $total );
|
1142 |
}
|
1143 |
+
|
1144 |
}
|
1145 |
return $total;
|
1146 |
}
|
1157 |
/**
|
1158 |
* Load built-in fields
|
1159 |
*
|
1160 |
+
* @since unknown
|
1161 |
+
*
|
1162 |
+
* @uses "caldera_forms_get_field_types" filter
|
1163 |
+
*
|
1164 |
* @param array $fields
|
1165 |
*
|
1166 |
* @return array
|
1167 |
*/
|
1168 |
public function get_internal_field_types($fields){
|
1169 |
|
|
|
1170 |
$internal_fields = array(
|
1171 |
+
//basic
|
1172 |
+
'text' => array(
|
1173 |
+
"field" => __( 'Single Line Text', 'caldera-forms' ),
|
1174 |
+
"description" => __( 'Single Line Text', 'caldera-forms' ),
|
1175 |
+
"file" => CFCORE_PATH . "fields/text/field.php",
|
1176 |
+
"category" => __( 'Basic', 'caldera-forms' ),
|
1177 |
+
"setup" => array(
|
1178 |
+
"template" => CFCORE_PATH . "fields/text/config.php",
|
1179 |
+
"preview" => CFCORE_PATH . "fields/text/preview.php"
|
1180 |
+
),
|
1181 |
+
|
1182 |
+
),
|
1183 |
+
'hidden' => array(
|
1184 |
+
"field" => __( 'Hidden', 'caldera-forms' ),
|
1185 |
+
"description" => __( 'Hidden', 'caldera-forms' ),
|
1186 |
+
"file" => CFCORE_PATH . "fields/hidden/field.php",
|
1187 |
+
"category" => __( 'Basic', 'caldera-forms' ),
|
1188 |
+
"static" => true,
|
1189 |
+
"setup" => array(
|
1190 |
+
"preview" => CFCORE_PATH . "fields/hidden/preview.php",
|
1191 |
+
"template" => CFCORE_PATH . "fields/hidden/setup.php",
|
1192 |
+
"not_supported" => array(
|
1193 |
+
'hide_label',
|
1194 |
+
'caption',
|
1195 |
+
'required',
|
1196 |
+
)
|
1197 |
+
)
|
1198 |
+
),
|
1199 |
+
'email' => array(
|
1200 |
+
"field" => __( 'Email Address', 'caldera-forms' ),
|
1201 |
+
"description" => __( 'Email Address', 'caldera-forms' ),
|
1202 |
+
"file" => CFCORE_PATH . "fields/email/field.php",
|
1203 |
+
"category" => __( 'Basic', 'caldera-forms' ),
|
1204 |
+
"setup" => array(
|
1205 |
+
"preview" => CFCORE_PATH . "fields/email/preview.php",
|
1206 |
+
"template" => CFCORE_PATH . "fields/email/config.php"
|
1207 |
+
)
|
1208 |
+
),
|
1209 |
+
'button' => array(
|
1210 |
+
"field" => __( 'Button', 'caldera-forms' ),
|
1211 |
+
"description" => __( 'Button, Submit and Reset types', 'caldera-forms' ),
|
1212 |
+
"file" => CFCORE_PATH . "fields/button/field.php",
|
1213 |
+
"category" => __( 'Basic', 'caldera-forms' ),
|
1214 |
+
"capture" => false,
|
1215 |
+
"setup" => array(
|
1216 |
+
"template" => CFCORE_PATH . "fields/button/config_template.php",
|
1217 |
+
"preview" => CFCORE_PATH . "fields/button/preview.php",
|
1218 |
+
"default" => array(
|
1219 |
+
'class' => 'btn btn-default',
|
1220 |
+
'type' => 'submit'
|
1221 |
+
),
|
1222 |
+
"not_supported" => array(
|
1223 |
+
'hide_label',
|
1224 |
+
'caption',
|
1225 |
+
'required',
|
1226 |
+
'entry_list'
|
1227 |
+
)
|
1228 |
+
)
|
1229 |
+
),
|
1230 |
+
'phone' => array(
|
1231 |
+
"field" => __( 'Phone Number', 'caldera-forms' ),
|
1232 |
+
"description" => __( 'Phone number with masking', 'caldera-forms' ),
|
1233 |
+
"file" => CFCORE_PATH . "fields/phone/field.php",
|
1234 |
+
"category" => __( 'Basic', 'caldera-forms' ),
|
1235 |
+
"setup" => array(
|
1236 |
+
"template" => CFCORE_PATH . "fields/phone/config.php",
|
1237 |
+
"preview" => CFCORE_PATH . "fields/phone/preview.php",
|
1238 |
+
"default" => array(
|
1239 |
+
'default' => '',
|
1240 |
+
'type' => 'local',
|
1241 |
+
'custom'=> '(999)999-9999'
|
1242 |
+
)
|
1243 |
+
)
|
1244 |
+
),
|
1245 |
+
'paragraph' => array(
|
1246 |
+
"field" => __( 'Paragraph Textarea', 'caldera-forms' ),
|
1247 |
+
"description" => __( 'Paragraph Textarea', 'caldera-forms' ),
|
1248 |
+
"file" => CFCORE_PATH . "fields/paragraph/field.php",
|
1249 |
+
"category" => __( 'Basic', 'caldera-forms' ),
|
1250 |
+
"setup" => array(
|
1251 |
+
"template" => CFCORE_PATH . "fields/paragraph/config_template.php",
|
1252 |
+
"preview" => CFCORE_PATH . "fields/paragraph/preview.php",
|
1253 |
+
"default" => array(
|
1254 |
+
'rows' => '4'
|
1255 |
+
),
|
1256 |
+
)
|
1257 |
+
),
|
1258 |
+
|
1259 |
+
|
1260 |
+
//special
|
1261 |
'calculation' => array(
|
1262 |
+
"field" => __( 'Calculation', 'caldera-forms' ),
|
1263 |
"file" => CFCORE_PATH . "fields/calculation/field.php",
|
1264 |
"handler" => array($this, "run_calculation"),
|
1265 |
+
"category" => __( 'Special', 'caldera-forms' ),
|
1266 |
+
"description" => __( 'Calculate values', 'caldera-forms' ),
|
1267 |
"setup" => array(
|
1268 |
"template" => CFCORE_PATH . "fields/calculation/config.php",
|
1269 |
"preview" => CFCORE_PATH . "fields/calculation/preview.php",
|
1270 |
"default" => array(
|
1271 |
'element' => 'h3',
|
1272 |
'classes' => 'total-line',
|
1273 |
+
'before' => __( 'Total', 'caldera-forms' ).':',
|
1274 |
'after' => ''
|
1275 |
),
|
1276 |
+
|
|
|
|
|
1277 |
),
|
|
|
|
|
|
|
1278 |
),
|
1279 |
'range_slider' => array(
|
1280 |
+
"field" => __( 'Range Slider', 'caldera-forms' ),
|
1281 |
"file" => CFCORE_PATH . "fields/range_slider/field.php",
|
1282 |
+
"category" => __( 'Special', 'caldera-forms' ),
|
1283 |
+
"description" => __( 'Range Slider input field','caldera-forms' ),
|
1284 |
"setup" => array(
|
1285 |
"template" => CFCORE_PATH . "fields/range_slider/config.php",
|
1286 |
"preview" => CFCORE_PATH . "fields/range_slider/preview.php",
|
1297 |
'handleborder' => '#cccccc',
|
1298 |
'trackcolor' => '#e6e6e6'
|
1299 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1300 |
)
|
1301 |
),
|
1302 |
'star_rating' => array(
|
1303 |
+
"field" => __( 'Star Rating', 'caldera-forms' ),
|
1304 |
"file" => CFCORE_PATH . "fields/star-rate/field.php",
|
1305 |
+
"category" => __( 'Special', 'caldera-forms' ),
|
1306 |
+
"description" => __( 'Star rating input for feedback','caldera-forms' ),
|
1307 |
"viewer" => array($this, 'star_rating_viewer'),
|
1308 |
"setup" => array(
|
1309 |
"template" => CFCORE_PATH . "fields/star-rate/config.php",
|
1316 |
'track_color'=> '#AFAFAF',
|
1317 |
'type'=> 'star',
|
1318 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1319 |
)
|
1320 |
),
|
1321 |
+
|
1322 |
+
//file
|
1323 |
'file' => array(
|
1324 |
+
"field" => __( 'File', 'caldera-forms' ),
|
1325 |
+
"description" => __( 'File Uploader', 'caldera-forms' ),
|
1326 |
"file" => CFCORE_PATH . "fields/file/field.php",
|
1327 |
"viewer" => array($this, 'handle_file_view'),
|
1328 |
+
"category" => __( 'File', 'caldera-forms' ),
|
1329 |
"setup" => array(
|
1330 |
"preview" => CFCORE_PATH . "fields/file/preview.php",
|
1331 |
"template" => CFCORE_PATH . "fields/file/config_template.php"
|
1332 |
)
|
1333 |
),
|
1334 |
'advanced_file' => array(
|
1335 |
+
"field" => __( 'Advanced File Uploader', 'caldera-forms' ),
|
1336 |
+
"description" => __( 'Inline, multi file uploader', 'caldera-forms' ),
|
1337 |
"file" => CFCORE_PATH . "fields/advanced_file/field.php",
|
1338 |
"viewer" => array($this, 'handle_file_view'),
|
1339 |
+
"category" => __( 'File', 'caldera-forms' ),
|
1340 |
"setup" => array(
|
1341 |
"preview" => CFCORE_PATH . "fields/advanced_file/preview.php",
|
1342 |
"template" => CFCORE_PATH . "fields/advanced_file/config_template.php"
|
1346 |
),
|
1347 |
|
1348 |
),
|
1349 |
+
|
1350 |
+
//content
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1351 |
'html' => array(
|
1352 |
+
"field" => __( 'HTML', 'caldera-forms' ),
|
1353 |
+
"description" => __( 'Add text/html content', 'caldera-forms' ),
|
1354 |
"file" => CFCORE_PATH . "fields/html/field.php",
|
1355 |
+
"category" => __( 'Content', 'caldera-forms' ),
|
1356 |
"icon" => CFCORE_URL . "fields/html/icon.png",
|
1357 |
"capture" => false,
|
1358 |
"setup" => array(
|
1366 |
)
|
1367 |
)
|
1368 |
),
|
1369 |
+
|
1370 |
+
//select
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1371 |
'dropdown' => array(
|
1372 |
+
"field" => __( 'Dropdown Select', 'caldera-forms' ),
|
1373 |
+
"description" => __( 'Dropdown Select', 'caldera-forms' ),
|
1374 |
"file" => CFCORE_PATH . "fields/dropdown/field.php",
|
1375 |
+
"category" => __( 'Select', 'caldera-forms' ),
|
1376 |
"options" => "single",
|
1377 |
"static" => true,
|
1378 |
"viewer" => array($this, 'filter_options_calculator'),
|
1382 |
"default" => array(
|
1383 |
|
1384 |
),
|
|
|
|
|
|
|
1385 |
)
|
1386 |
),
|
1387 |
'checkbox' => array(
|
1388 |
+
"field" => __( 'Checkbox', 'caldera-forms' ),
|
1389 |
+
"description" => __( 'Checkbox', 'caldera-forms' ),
|
1390 |
"file" => CFCORE_PATH . "fields/checkbox/field.php",
|
1391 |
+
"category" => __( 'Select', 'caldera-forms' ),
|
1392 |
"options" => "multiple",
|
1393 |
"static" => true,
|
1394 |
"viewer" => array($this, 'filter_options_calculator'),
|
1395 |
"setup" => array(
|
1396 |
"preview" => CFCORE_PATH . "fields/checkbox/preview.php",
|
1397 |
"template" => CFCORE_PATH . "fields/checkbox/config_template.php",
|
|
|
1398 |
|
|
|
|
|
|
|
|
|
1399 |
),
|
1400 |
),
|
1401 |
'radio' => array(
|
1402 |
+
"field" => __( 'Radio', 'caldera-forms' ),
|
1403 |
+
"description" => __( 'Radio', 'caldera-forms' ),
|
1404 |
"file" => CFCORE_PATH . "fields/radio/field.php",
|
1405 |
+
"category" => __( 'Select', 'caldera-forms' ),
|
1406 |
"options" => true,
|
1407 |
"static" => true,
|
1408 |
"viewer" => array($this, 'filter_options_calculator'),
|
1409 |
"setup" => array(
|
1410 |
"preview" => CFCORE_PATH . "fields/radio/preview.php",
|
1411 |
"template" => CFCORE_PATH . "fields/radio/config_template.php",
|
1412 |
+
)
|
1413 |
+
),
|
1414 |
+
'filtered_select2' => array(
|
1415 |
+
"field" => __( 'Autocomplete', 'caldera-forms' ),
|
1416 |
+
"file" => CFCORE_PATH . "fields/select2/field/field.php",
|
1417 |
+
"category" => __( 'Select', 'caldera-forms' ),
|
1418 |
+
"description" => 'Select2 dropdown',
|
1419 |
+
"options" => "multiple",
|
1420 |
+
"static" => true,
|
1421 |
+
"setup" => array(
|
1422 |
+
"template" => CFCORE_PATH . "fields/select2/field/config.php",
|
1423 |
+
"preview" => CFCORE_PATH . "fields/select2/field/preview.php",
|
1424 |
+
),
|
1425 |
+
"scripts" => array(
|
1426 |
+
CFCORE_URL . "fields/select2/js/select2.min.js",
|
1427 |
+
),
|
1428 |
+
"styles" => array(
|
1429 |
+
CFCORE_URL . "fields/select2/css/select2.css",
|
1430 |
)
|
1431 |
),
|
1432 |
'date_picker' => array(
|
1433 |
+
"field" => __( 'Date Picker', 'caldera-forms' ),
|
1434 |
+
"description" => __( 'Date Picker', 'caldera-forms' ),
|
1435 |
"file" => CFCORE_PATH . "fields/date_picker/datepicker.php",
|
1436 |
+
"category" => __( 'Select', 'caldera-forms' ),
|
1437 |
"setup" => array(
|
1438 |
"preview" => CFCORE_PATH . "fields/date_picker/preview.php",
|
1439 |
"template" => CFCORE_PATH . "fields/date_picker/setup.php",
|
1440 |
"default" => array(
|
1441 |
'format' => 'yyyy-mm-dd'
|
1442 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1443 |
)
|
1444 |
),
|
1445 |
+
'toggle_switch' => array(
|
1446 |
+
"field" => __( 'Toggle Switch', 'caldera-forms' ),
|
1447 |
+
"description" => __( 'Toggle Switch', 'caldera-forms' ),
|
1448 |
+
"category" => __( 'Select', 'caldera-forms' ),
|
1449 |
+
"file" => CFCORE_PATH . "fields/toggle_switch/field.php",
|
1450 |
+
"viewer" => array($this, 'filter_options_calculator'),
|
1451 |
+
"options" => "single",
|
1452 |
+
"static" => true,
|
1453 |
+
"setup" => array(
|
1454 |
+
"template" => CFCORE_PATH . "fields/toggle_switch/config_template.php",
|
1455 |
+
"preview" => CFCORE_PATH . "fields/toggle_switch/preview.php",
|
1456 |
+
),
|
1457 |
+
),
|
1458 |
'color_picker' => array(
|
1459 |
+
"field" => __( 'Color Picker', 'caldera-forms' ),
|
1460 |
+
"description" => __( 'Color Picker', 'caldera-forms' ),
|
1461 |
+
"category" => __( 'Select', 'caldera-forms' ),
|
1462 |
"file" => CFCORE_PATH . "fields/color_picker/field.php",
|
1463 |
"setup" => array(
|
1464 |
"preview" => CFCORE_PATH . "fields/color_picker/preview.php",
|
1465 |
"template" => CFCORE_PATH . "fields/color_picker/setup.php",
|
1466 |
"default" => array(
|
1467 |
+
'default' => '#FFFFFF'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1468 |
),
|
1469 |
+
|
1470 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1471 |
),
|
1472 |
'states' => array(
|
1473 |
+
"field" => __( 'State/ Province Select', 'caldera-forms' ),
|
1474 |
+
"description" => __( 'Dropdown select for US states and Canadian provinces.', 'caldera-forms' ),
|
1475 |
"file" => CFCORE_PATH . "fields/states/field.php",
|
1476 |
+
"category" => __( 'Select', 'caldera-forms' ),
|
1477 |
"placeholder" => false,
|
|
|
1478 |
"setup" => array(
|
1479 |
"template" => CFCORE_PATH . "fields/states/config_template.php",
|
1480 |
"preview" => CFCORE_PATH . "fields/states/preview.php",
|
1483 |
),
|
1484 |
)
|
1485 |
),
|
1486 |
+
|
1487 |
+
|
1488 |
+
//discontinued
|
1489 |
+
'recaptcha' => array(
|
1490 |
+
"field" => __( 'reCAPTCHA', 'caldera-forms' ),
|
1491 |
+
"description" => __( 'reCAPTCHA anti-spam field', 'caldera-forms' ),
|
1492 |
+
"file" => CFCORE_PATH . "fields/recaptcha/field.php",
|
1493 |
+
"category" => __( 'Discontinued', 'caldera-forms' ),
|
1494 |
+
"handler" => array($this, 'captcha_check'),
|
1495 |
+
"capture" => false,
|
1496 |
"setup" => array(
|
1497 |
+
"template" => CFCORE_PATH . "fields/recaptcha/config.php",
|
1498 |
+
"preview" => CFCORE_PATH . "fields/recaptcha/preview.php",
|
1499 |
+
"not_supported" => array(
|
1500 |
+
'caption',
|
1501 |
+
'required'
|
1502 |
+
),
|
|
|
|
|
1503 |
)
|
1504 |
+
),
|
1505 |
+
|
1506 |
);
|
1507 |
+
|
1508 |
return array_merge( $fields, $internal_fields );
|
1509 |
+
|
1510 |
}
|
1511 |
|
1512 |
/**
|
1545 |
}
|
1546 |
if(is_array($value)){
|
1547 |
$value = implode('<br>', $value);
|
1548 |
+
}
|
1549 |
}
|
1550 |
}
|
1551 |
}
|
1562 |
*/
|
1563 |
public function apply_conditional_groups($field, $form){
|
1564 |
|
1565 |
+
if( !empty( $form['conditional_groups']['conditions'][ $field['conditions']['type'] ] ) ){
|
1566 |
$group = $form['conditional_groups']['conditions'][ $field['conditions']['type'] ];
|
1567 |
if( ! isset( $field['conditions']['group'] ) ){
|
1568 |
$field['conditions']['group'] = array();
|
1587 |
* @return array Options for field
|
1588 |
*/
|
1589 |
public function auto_populate_options_field($field, $form){
|
1590 |
+
|
1591 |
if(!empty($field['config']['auto'])){
|
1592 |
$field['config']['option'] = array();
|
1593 |
switch($field['config']['auto_type']){
|
1661 |
);
|
1662 |
}
|
1663 |
|
1664 |
+
break;
|
1665 |
case 'taxonomy':
|
1666 |
if( $field[ 'config' ][ 'value_field' ] === 'id' ){
|
1667 |
$field[ 'config' ][ 'value_field' ] = 'term_id';
|
1691 |
* @param array $form Form config
|
1692 |
*/
|
1693 |
$args = apply_filters( 'caldera_forms_autopopulate_taxonomy_args', $args );
|
1694 |
+
|
1695 |
$terms = get_terms( $field['config']['taxonomy'], $args );
|
1696 |
|
1697 |
/**
|
1729 |
'label' => $term->{$field_for_label}
|
1730 |
);
|
1731 |
}
|
1732 |
+
break;
|
1733 |
|
1734 |
}
|
1735 |
|
1736 |
}else{
|
1737 |
$field = self::format_select_options( $field );
|
1738 |
}
|
1739 |
+
|
1740 |
return $field;
|
1741 |
|
1742 |
}
|
1789 |
|
1790 |
foreach($conditions['group'] as $groupid=>$lines){
|
1791 |
$truelines = array();
|
1792 |
+
|
1793 |
foreach($lines as $lineid=>$line){
|
1794 |
|
1795 |
+
if( isset( $form['fields'][$line['field']]['config']['option'][$line['value']] )){
|
1796 |
$line['value'] = $form['fields'][$line['field']]['config']['option'][$line['value']]['value'];
|
1797 |
}
|
1798 |
|
1809 |
$line['value'] = $isslug;
|
1810 |
}
|
1811 |
}
|
1812 |
+
|
1813 |
|
1814 |
$truelines[$lineid] = false;
|
1815 |
|
1862 |
break;
|
1863 |
case 'startswith':
|
1864 |
if(is_array($value)){
|
1865 |
+
foreach($value as $part){
|
1866 |
if( 0 === strpos($part,$line['value'])){
|
1867 |
$truelines[$lineid] = true;
|
1868 |
}
|
1898 |
}
|
1899 |
break;
|
1900 |
}
|
1901 |
+
|
1902 |
}
|
1903 |
|
1904 |
$trues[$groupid] = in_array(false, $truelines) ? false : true;
|
1938 |
|
1939 |
do_action('caldera_forms_redirect', $type, $url, $form, $processid);
|
1940 |
do_action('caldera_forms_redirect_' . $type, $url, $form, $processid);
|
1941 |
+
|
1942 |
if(!empty($url)){
|
1943 |
cf_redirect( $url, 302 );
|
1944 |
exit;
|
1993 |
);
|
1994 |
|
1995 |
$tags['system'] = array(
|
1996 |
+
'type' => __( 'System Tags', 'caldera-forms' ),
|
1997 |
'tags' => $system_tags,
|
1998 |
'wrap' => array('{','}')
|
1999 |
);
|
2022 |
}
|
2023 |
$tags[$processor_key]['tags'][$tag] = $value_tag;
|
2024 |
}
|
2025 |
+
}else{
|
2026 |
// compatibility text
|
2027 |
$tag = $processor_key.':'.$value_tag;
|
2028 |
if(!in_array($tag, $tags)){
|
2089 |
$magic_tag = $referrer['query'][ $magic[1] ];
|
2090 |
}else{
|
2091 |
$magic_tag = null;
|
2092 |
+
}
|
2093 |
}
|
2094 |
break;
|
2095 |
case 'post':
|
2125 |
break;
|
2126 |
case 'user':
|
2127 |
if(is_user_logged_in()){
|
2128 |
+
$user = get_userdata( get_current_user_id() );
|
2129 |
if(isset( $user->data->{$magic[1]} )){
|
2130 |
$magic_tag = $user->data->{$magic[1]};
|
2131 |
}else{
|
2132 |
if(strtolower($magic[1]) == 'id'){
|
2133 |
$magic_tag = $user->ID;
|
2134 |
+
}else{
|
2135 |
$magic_tag = get_user_meta( $user->ID, $magic[1], true );
|
2136 |
}
|
2137 |
}
|
2170 |
}
|
2171 |
if(empty($post_metavalue)){
|
2172 |
$magic_tag = null;
|
2173 |
+
}else{
|
2174 |
if(empty($magic[3])){
|
2175 |
$magic_tag = implode(', ', $post_metavalue);
|
2176 |
}else{
|
2179 |
foreach( (array) $post_metavalue as $subsubkey=>$subsubval){
|
2180 |
if(isset($subsubval[$subvalue])){
|
2181 |
$outmagic[] = $post_metavalue;
|
2182 |
+
}
|
2183 |
}
|
2184 |
}
|
2185 |
$magic_tag = implode(', ', $outmagic);
|
2214 |
$ip = $_SERVER['HTTP_CLIENT_IP'];
|
2215 |
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
|
2216 |
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
|
2217 |
+
}
|
2218 |
+
|
2219 |
$magic_tag = $ip;
|
2220 |
+
|
2221 |
break;
|
2222 |
case 'ua':
|
2223 |
$magic_tag = $_SERVER['HTTP_USER_AGENT'];
|
2224 |
+
break;
|
2225 |
case 'summary':
|
2226 |
if(!empty($this_form['fields'])){
|
2227 |
+
if ( ! isset( $this_form[ 'mailer' ]['email_type' ] ) || $this_form[ 'mailer' ][ 'email_type' ] == 'html' ) {
|
2228 |
+
$html = true;
|
2229 |
+
$pattern = '<strong>%s</strong><div style="margin-bottom:20px;">%s</div>';
|
2230 |
+
|
2231 |
+
}else{
|
2232 |
+
$html = false;
|
2233 |
+
}
|
2234 |
+
|
2235 |
$out = array();
|
2236 |
foreach($this_form['fields'] as $field_id=>$field){
|
2237 |
+
|
2238 |
if( in_array( $field['type'], array('button', 'recaptcha', 'html' ) ) ){
|
2239 |
continue;
|
2240 |
}
|
2252 |
if( isset( $field_value['label'] ) && isset( $field_value['value'] ) ){
|
2253 |
$field_value[$field_key] = $field_value['value'];
|
2254 |
}
|
2255 |
+
|
2256 |
}
|
2257 |
}
|
2258 |
|
2259 |
$field_value = implode(', ', (array) $field_values);
|
|
|
2260 |
|
2261 |
+
if( $field_value !== null && strlen( $field_value ) > 0){
|
2262 |
+
if ( $html ) {
|
2263 |
+
$out[] = sprintf( $pattern, $field[ 'label' ], $field_value );
|
2264 |
+
} else {
|
2265 |
+
$out[] = $field[ 'label' ] . ': ' . $field_value;
|
2266 |
+
}
|
2267 |
}
|
2268 |
}
|
2269 |
+
|
2270 |
// vars
|
2271 |
if( !empty( $this_form['variables'] ) ){
|
2272 |
foreach( $this_form['variables']['keys'] as $var_key=>$var_label ){
|
2273 |
if( $this_form['variables']['types'][ $var_key ] == 'entryitem' ){
|
2274 |
$label = ucfirst( str_replace('_', ' ', $var_label ) );
|
2275 |
+
if ( $html ) {
|
2276 |
+
$out[] = sprintf( $pattern, $label, $this_form[ 'variables' ][ 'values' ][ $var_key ] );
|
2277 |
+
} else {
|
2278 |
+
$out[] = $label . ': ' . $this_form['variables']['values'][ $var_key ];
|
2279 |
+
}
|
2280 |
}
|
2281 |
}
|
2282 |
+
}
|
2283 |
if(!empty($out)){
|
2284 |
$magic_tag = implode("\r\n", $out);
|
2285 |
}else{
|
2287 |
}
|
2288 |
}
|
2289 |
break;
|
2290 |
+
case 'login_url' :
|
2291 |
+
$magic_tag = wp_login_url();
|
2292 |
+
break;
|
2293 |
+
case 'logout_url' :
|
2294 |
+
$magic_tag = wp_logout_url();
|
2295 |
+
break;
|
2296 |
+
case 'register_url' :
|
2297 |
+
$magic_tag = wp_registration_url();
|
2298 |
+
break;
|
2299 |
+
case 'lostpassword_url' :
|
2300 |
+
$magic_tag = wp_lostpassword_url();
|
2301 |
+
break;
|
2302 |
|
2303 |
|
2304 |
}
|
2309 |
if(!empty($this_form['ID']) ){
|
2310 |
|
2311 |
// split processor
|
2312 |
+
|
2313 |
if(!empty($magic[1])){
|
2314 |
if( false !== strpos( $magic[1], ':' )){
|
2315 |
$magic = array_reverse( explode(':', $magic[1]) );
|
2316 |
}
|
2317 |
+
}
|
2318 |
// check if its a process id or processor slug
|
2319 |
+
if( empty($processed_meta[$this_form['ID']][$magic[0]]) && !empty($this_form['processors']) ){
|
2320 |
+
|
2321 |
+
// if not a direct chec if theres a slug
|
2322 |
+
foreach( $this_form['processors'] as $processid => $processor){
|
2323 |
+
if($processor['type'] === $magic[0]){
|
2324 |
+
if(!empty($processed_meta[$this_form['ID']][$processid])){
|
2325 |
+
$magic[0] = $processid;
|
2326 |
+
break;
|
2327 |
+
}
|
2328 |
+
}
|
2329 |
+
}
|
2330 |
+
}
|
2331 |
if(!empty($processed_meta[$this_form['ID']][$magic[0]])){
|
2332 |
+
|
2333 |
if(isset( $processed_meta[$this_form['ID']][$magic[0]][$magic[1]] ) ){
|
2334 |
// direct fined
|
2335 |
$filter_value = implode(', ', (array) $processed_meta[$this_form['ID']][$magic[0]][$magic[1]] );
|
2366 |
$entry = self::get_slug_data($tag, $this_form, $entry_id);
|
2367 |
|
2368 |
if($entry !== null){
|
2369 |
+
$field = self::get_field_by_slug( $tag, $this_form );
|
2370 |
}
|
2371 |
|
2372 |
+
|
2373 |
if( !empty( $field ) && !empty( $part_tags[1] ) && $part_tags[1] == 'label' ){
|
2374 |
if( !is_array( $entry ) ){
|
2375 |
$entry = (array) $entry;
|
2376 |
}
|
2377 |
foreach( (array) $entry as $entry_key=>$entry_line ){
|
2378 |
if( !empty( $field['config']['option'] ) ){
|
2379 |
+
foreach( $field['config']['option'] as $option ){
|
2380 |
if( $option['value'] == $entry_line ){
|
2381 |
$entry[$entry_key] = $option['label'];
|
2382 |
}
|
2412 |
* @return array Array of field types.
|
2413 |
*/
|
2414 |
static public function get_field_types(){
|
|
|
|
|
|
|
|
|
2415 |
|
2416 |
|
2417 |
$field_types = apply_filters( 'caldera_forms_get_field_types', array() );
|
2480 |
if(is_string($form)){
|
2481 |
$form['ID'] = $form;
|
2482 |
}
|
2483 |
+
|
2484 |
// set value
|
2485 |
if(isset($form['ID'])){
|
2486 |
if(isset($processed_meta[$form['ID']][$processor_id][$key])){
|
2490 |
}
|
2491 |
$processed_meta[$form['ID']][$processor_id][$key][] = $value;
|
2492 |
return true;
|
2493 |
+
}
|
2494 |
}
|
2495 |
|
2496 |
/**
|
2507 |
global $processed_data;
|
2508 |
|
2509 |
$current_data = self::get_field_data($field_id, $form, $entry_id);
|
2510 |
+
|
2511 |
if(is_string($form)){
|
2512 |
$form = Caldera_Forms_Forms::get_form( $form );
|
2513 |
}
|
2703 |
}
|
2704 |
|
2705 |
if(isset($processed_data[$indexkey][$field_id])){
|
2706 |
+
return $processed_data[$indexkey][$field_id];
|
2707 |
}
|
2708 |
|
2709 |
|
2723 |
foreach($form['fields'] as $field_id=>$field){
|
2724 |
|
2725 |
if($field['slug'] == $slug){
|
2726 |
+
|
2727 |
return apply_filters( 'caldera_forms_render_get_field', $field, $form );
|
2728 |
|
2729 |
}
|
2756 |
foreach($form['fields'] as $field_id=>$field){
|
2757 |
|
2758 |
if($field['slug'] == $slug){
|
2759 |
+
|
2760 |
return self::get_field_data( $field_id, $form, $entry_id);
|
2761 |
|
2762 |
}
|
2804 |
*/
|
2805 |
static public function get_entry_meta($entry_id, $form, $type = null){
|
2806 |
global $wpdb;
|
2807 |
+
|
2808 |
$entry_meta = array();
|
2809 |
|
2810 |
$entry_meta_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM `" . $wpdb->prefix ."cf_form_entry_meta` WHERE `entry_id` = %d", $entry_id), ARRAY_A);
|
2827 |
if( $meta['process_id'] == '_debug_log' ){
|
2828 |
$meta['meta_value'] = '<pre>' . $meta['meta_value'] . '</pre>';
|
2829 |
$entry_meta['debug'] = array(
|
2830 |
+
'name' => __( 'Mailer Debug', 'caldera-forms' ),
|
2831 |
'data' => array(
|
2832 |
'_debug_log' => array(
|
2833 |
'entry' => array(
|
2852 |
}
|
2853 |
$meta = apply_filters( 'caldera_forms_get_entry_meta_' . $form['processors'][$meta['process_id']]['type'], $meta, $process_config , $form);
|
2854 |
|
2855 |
+
|
2856 |
// allows plugins to remove it.
|
2857 |
if(!empty($meta)){
|
2858 |
if(!isset($entry_meta[$group])){
|
2861 |
$meta_name = $processors[$form['processors'][$meta['process_id']]['type']]['name'];
|
2862 |
}else{
|
2863 |
if( $meta['process_id'] == '_debug_log' ){
|
2864 |
+
$meta_name = __( 'Mailer Debug', 'caldera-forms' );
|
2865 |
}else{
|
2866 |
+
$meta_name = $meta['process_id'];
|
2867 |
}
|
2868 |
+
|
2869 |
}
|
2870 |
$entry_meta[$group] = array(
|
2871 |
'name' => $meta_name,
|
2872 |
'data' => array()
|
2873 |
);
|
2874 |
// custom template
|
2875 |
+
if( isset( $processors[$form['processors'][$meta['process_id']]['type']]['meta_template'] ) && file_exists( $processors[$form['processors'][$meta['process_id']]['type']]['meta_template'] ) ){
|
2876 |
$entry_meta[$group][$group.'_template'] = $entry_meta[$group]['template'] = true;
|
2877 |
+
}
|
2878 |
}
|
2879 |
|
2880 |
//if(!empty($meta['meta_title'])){
|
2883 |
|
2884 |
$entry_meta[$group]['data'][$meta['process_id']]['entry'][$meta['meta_key']] = $meta;
|
2885 |
|
2886 |
+
|
2887 |
/*if(is_array($meta['meta_value'])){
|
2888 |
foreach($meta['meta_value'] as $mkey=>$mval){
|
2889 |
$entry['meta'][$group]['data'][$meta['process_id']]['title'] = $meta['meta_key'];
|
2896 |
$entry['meta'][$group]['data'][$meta['process_id']]['entry'][] = array(
|
2897 |
'meta_key' => $meta['meta_key'],
|
2898 |
'meta_value' => $meta['meta_value']
|
2899 |
+
);
|
2900 |
}*/
|
2901 |
|
2902 |
}
|
2926 |
if(is_string($form)){
|
2927 |
$form_id = $form;
|
2928 |
$form = Caldera_Forms_Forms::get_form( $form );
|
2929 |
+
if(!isset($form['ID']) || $form['ID'] !== $form_id){
|
2930 |
+
return new WP_Error( 'fail', __( 'Invalid form ID', 'caldera-forms' ) );
|
2931 |
}
|
2932 |
}
|
2933 |
|
2970 |
global $rawdata;
|
2971 |
global $processed_data;
|
2972 |
global $transdata;
|
2973 |
+
global $wpdb;
|
2974 |
+
global $referrer;
|
2975 |
|
2976 |
// clean out referrer
|
2977 |
if(empty($_POST['_wp_http_referer_true'])){
|
2978 |
$_POST['_wp_http_referer_true'] = $_SERVER['HTTP_REFERER'];
|
2979 |
}
|
2980 |
+
|
2981 |
$referrer = parse_url( $_POST['_wp_http_referer_true'] );
|
2982 |
if(!empty($referrer['query'])){
|
2983 |
parse_str($referrer['query'], $referrer['query']);
|
3053 |
}
|
3054 |
}
|
3055 |
|
3056 |
+
// check source is ajax to overide
|
3057 |
if( !empty($_POST['cfajax']) && $_POST['cfajax'] == $form['ID'] ){
|
3058 |
$form['form_ajax'] = 1;
|
3059 |
}
|
3060 |
+
|
3061 |
// get all fieldtype
|
3062 |
$field_types = self::get_field_types();
|
3063 |
+
|
3064 |
// setup fieldtypes field submissions
|
3065 |
if(!empty($field_types)){
|
3066 |
foreach($field_types as $fieldType=>$fieldConfig){
|
3138 |
|
3139 |
// setup processor bound requieds
|
3140 |
if(!empty($form['processors'])){
|
3141 |
+
$bound_fields = array();
|
3142 |
foreach($form['processors'] as $processor_id=>$processor){
|
3143 |
|
3144 |
+
if(!empty($processor['config']['_required_bounds'])){
|
3145 |
foreach($processor['config'] as $slug=>&$value){
|
3146 |
if($slug == '_required_bounds'){
|
3147 |
continue;
|
3180 |
'form_id' => $form['ID']
|
3181 |
);
|
3182 |
if( sha1( json_encode( $token_array ) ) !== trim( $_POST['_cf_frm_edt_tkn'] ) ){
|
3183 |
+
return new WP_Error( 'error', __( "Permission denied.", 'caldera-forms' ) );
|
3184 |
}else{
|
3185 |
$entry_id = (int) $details['id'];
|
3186 |
$edit_token = sha1( json_encode( $token_array ) );
|
3190 |
|
3191 |
if(empty($user_id)){
|
3192 |
$transdata['error'] = true;
|
3193 |
+
$transdata['note'] = __( 'Permission denied or entry does not exist.', 'caldera-forms' );
|
3194 |
}else{
|
3195 |
|
3196 |
if(empty($details)){
|
3197 |
$transdata['error'] = true;
|
3198 |
+
$transdata['note'] = __( 'Permission denied or entry does not exist.', 'caldera-forms' );
|
3199 |
}else{
|
3200 |
// check user can edit
|
3201 |
if( current_user_can( 'edit_posts' ) || $details['user_id'] === $user_id ){
|
3202 |
// can edit.
|
3203 |
}else{
|
3204 |
$transdata['error'] = true;
|
3205 |
+
$transdata['note'] = __( 'Permission denied or entry does not exist.', 'caldera-forms' );
|
3206 |
}
|
3207 |
}
|
3208 |
|
3214 |
|
3215 |
// start brining in entries
|
3216 |
foreach($form['fields'] as $field_id=>$field){
|
3217 |
+
|
3218 |
$entry = self::get_field_data($field_id, $form);
|
3219 |
|
3220 |
if ( is_wp_error( $entry )){
|
3242 |
if ( is_wp_error( $entry )){
|
3243 |
$transdata['fields'][$field_id] = $entry->get_error_message();
|
3244 |
}elseif($entry === null){
|
3245 |
+
$transdata['fields'][$field_id] = $field['label'] .' ' .__( 'is required', 'caldera-forms' );
|
3246 |
}
|
3247 |
}
|
3248 |
}
|
3249 |
|
3250 |
}
|
3251 |
+
|
3252 |
// check requireds
|
3253 |
if(!empty($transdata['fields']) || !empty($transdata['error'])){
|
3254 |
$transdata['type'] = 'error';
|
3255 |
// set error transient
|
3256 |
$transdata = apply_filters( 'caldera_forms_submit_return_transient', $transdata, $form, $referrer, $process_id);
|
3257 |
$transdata = apply_filters( 'caldera_forms_submit_return_transient_required', $transdata, $form, $referrer, $process_id);
|
3258 |
+
|
3259 |
// back to form
|
3260 |
$query_str = array(
|
3261 |
'cf_er' => $process_id
|
3278 |
if(!isset($form['processors'])){
|
3279 |
$form['processors'] = array();
|
3280 |
}
|
3281 |
+
|
3282 |
// get all form processors
|
3283 |
$form_processors = Caldera_Forms_Processor_Load::get_instance()->get_processors();
|
3284 |
|
3327 |
|
3328 |
// PRE PROCESS
|
3329 |
foreach($form['processors'] as $processor_id=>$processor){
|
3330 |
+
|
3331 |
if(isset($form_processors[$processor['type']])){
|
3332 |
|
3333 |
// Do Conditional
|
3363 |
$process_line_data = $func($config, $form, $process_id);
|
3364 |
}
|
3365 |
}
|
3366 |
+
// pre processors should not return unless a break in action for further
|
3367 |
// Returned something - check it
|
3368 |
+
if(!empty($process_line_data)){
|
3369 |
if(is_array($process_line_data)){
|
3370 |
//type
|
3371 |
if(!empty($process_line_data['type'])){
|
3373 |
// has note?
|
3374 |
if(!empty($process_line_data['note'])){
|
3375 |
$transdata['note'] = $process_line_data['note'];
|
3376 |
+
}
|
3377 |
}
|
3378 |
|
3379 |
// fields involved?
|
3380 |
if(!empty($process_line_data['fields'])){
|
3381 |
$transdata['fields'] = $process_line_data['fields'];
|
3382 |
}
|
3383 |
+
|
3384 |
// set error transient
|
3385 |
$transdata = apply_filters( 'caldera_forms_submit_return_transient', $transdata, $form, $referrer, $process_id);
|
3386 |
$transdata = apply_filters( 'caldera_forms_submit_return_transient_pre_process', $transdata, $form, $referrer, $process_id);
|
3435 |
|
3436 |
$wpdb->insert($wpdb->prefix . 'cf_form_entries', $new_entry);
|
3437 |
$entryid = $wpdb->insert_id;
|
3438 |
+
|
3439 |
/**
|
3440 |
* Runs after an entry is saved
|
3441 |
*
|
3446 |
* @param array $form Form being processed
|
3447 |
*/
|
3448 |
do_action( 'caldera_forms_entry_saved', $entryid, $new_entry, $form );
|
3449 |
+
|
3450 |
// save entry_id
|
3451 |
self::set_field_data('_entry_id', $entryid, $form);
|
3452 |
// set entry token
|
3486 |
continue;
|
3487 |
}
|
3488 |
}
|
3489 |
+
|
3490 |
$process = $form_processors[$processor['type']];
|
3491 |
if(!isset($process['processor'])){
|
3492 |
continue;
|
3505 |
if(is_array($process['processor'])){
|
3506 |
$hasmeta = call_user_func_array($process['processor'],array($config, $form, $process_id));
|
3507 |
}else{
|
3508 |
+
if(function_exists($process['processor'])){
|
3509 |
$func = $process['processor'];
|
3510 |
$hasmeta = $func($config, $form, $process_id);
|
3511 |
}
|
3519 |
}
|
3520 |
self::set_submission_meta($metakey, $metavalue, $form, $processor_id);
|
3521 |
}
|
3522 |
+
} // check for transdata errors
|
3523 |
+
|
3524 |
if(!empty($transdata['error'])){
|
3525 |
// remove pending entry
|
3526 |
if( !empty( $entryid ) && !empty($new_entry) && $new_entry['status'] == 'pending' ){
|
3589 |
$process = $form_processors[$processor['type']];
|
3590 |
if(!isset($process['post_processor'])){
|
3591 |
continue;
|
3592 |
+
}
|
3593 |
// set default config
|
3594 |
$config = array();
|
3595 |
$config['processor_id'] = $processor_id;
|
3605 |
}else{
|
3606 |
if(function_exists($process['post_processor'])){
|
3607 |
$func = $process['post_processor'];
|
3608 |
+
$hasmeta = $func($config, $form, $process_id);
|
3609 |
}
|
3610 |
}
|
3611 |
if($hasmeta !== null){
|
3649 |
if( !empty( $cf_id ) ){
|
3650 |
$referrer['query']['cf_id'] = self::do_magic_tags( '{entry_id}' );
|
3651 |
}
|
3652 |
+
}
|
3653 |
+
|
3654 |
// passback values
|
3655 |
if( !empty( $form['variables']['types'] ) ){
|
3656 |
foreach($form['variables']['types'] as $variable_index=>$behavior_type){
|
3672 |
}
|
3673 |
|
3674 |
|
3675 |
+
|
3676 |
/**
|
3677 |
* Makes Caldera Forms load the preview
|
3678 |
*/
|
3694 |
if(empty($temp_page)){
|
3695 |
// create page
|
3696 |
$post = array(
|
3697 |
+
'post_content' => '',
|
3698 |
+
'post_name' => 'caldera_forms_preview',
|
3699 |
+
'post_title' => 'Caldera Forms Preview',
|
3700 |
+
'post_status' => 'draft',
|
3701 |
+
'post_type' => 'page',
|
3702 |
+
'ping_status' => 'closed',
|
3703 |
+
'comment_status' => 'closed'
|
3704 |
);
|
3705 |
$page_id = wp_insert_post( $post );
|
3706 |
wp_redirect( trailingslashit( get_home_url() ) . '?page_id='.$page_id.'&preview=true&cf_preview='.$_GET['cf_preview'] );
|
3726 |
$page_forms = array();
|
3727 |
|
3728 |
// check active widgets
|
3729 |
+
$sidebars = get_option( 'sidebars_widgets' );
|
3730 |
+
if ( is_array( $sidebars ) && ! empty( $sidebars ) ) {
|
3731 |
+
$form_widgets = get_option( 'widget_caldera_forms_widget' );
|
3732 |
+
unset( $sidebars[ 'wp_inactive_widgets' ] );
|
3733 |
+
foreach ( $sidebars as $sidebar => $set ) {
|
3734 |
+
if ( is_active_sidebar( $sidebar ) ) {
|
3735 |
+
foreach ( $set as $setup ) {
|
3736 |
+
if ( false !== strpos( $setup, 'caldera_forms_widget-' ) ) {
|
3737 |
+
$widget_instance = str_replace( 'caldera_forms_widget-', '', $setup );
|
3738 |
+
if ( ! empty( $form_widgets[ $widget_instance ][ 'form' ] ) ) {
|
3739 |
+
$form_id = $form_widgets[ $widget_instance ][ 'form' ];
|
3740 |
+
$page_forms[ $form_id ] = $form_id;
|
3741 |
+
}
|
3742 |
}
|
3743 |
}
|
3744 |
}
|
3746 |
}
|
3747 |
|
3748 |
$codes = get_shortcode_regex();
|
3749 |
+
preg_match_all('/' . $codes . '/s', $post->post_content, $found);
|
3750 |
|
3751 |
if(!empty($found[0][0])){
|
3752 |
foreach($found[2] as $index=>$code){
|
3823 |
}
|
3824 |
}
|
3825 |
}
|
3826 |
+
|
3827 |
}
|
3828 |
|
3829 |
}
|
3847 |
if( !empty( $_REQUEST['cf_instance'] ) ){
|
3848 |
$atts['instance'] = $_REQUEST['cf_instance'];
|
3849 |
}
|
3850 |
+
// push 200 status. in some cases plugins or permalink config may cause a 404 before going out
|
3851 |
+
header("HTTP/1.1 200 OK", true );
|
3852 |
if(!empty($form['ID'])){
|
3853 |
if($form['ID'] === $wp_query->query_vars['cf_api']){
|
3854 |
// got it!
|
3860 |
}
|
3861 |
// is a post?
|
3862 |
if( $_SERVER['REQUEST_METHOD'] === 'POST' ){
|
3863 |
+
|
3864 |
if( !empty( $_POST['control'] ) ){
|
3865 |
$transient_name = sanitize_key( $_POST['control'] );
|
3866 |
$transdata = get_transient( $transient_name );
|
3870 |
if( !empty( $_FILES ) && !empty( $_POST['field'] ) ){
|
3871 |
$form = Caldera_Forms_Forms::get_form( $wp_query->query_vars['cf_api'] );
|
3872 |
$field = $form[ 'fields'][ $_POST['field'] ];
|
3873 |
+
|
3874 |
$data = cf_handle_file_upload( true, $field, $form );
|
3875 |
if( is_wp_error( $data ) ){
|
3876 |
wp_send_json_error( $data->get_error_message() );
|
3910 |
* @param string $form_id form ID
|
3911 |
* @return string Full URL
|
3912 |
*/
|
3913 |
+
static function get_submit_url( $form_id = '' ) {
|
3914 |
|
3915 |
if ( is_multisite() && get_blog_option( null, 'permalink_structure' ) || get_option( 'permalink_structure' ) ) {
|
3916 |
$url = get_home_url( );
|
3920 |
$url = add_query_arg( 'cf_api', $form_id, $url );
|
3921 |
}
|
3922 |
if ( is_ssl() ) {
|
|
|
3923 |
if ( $_SERVER['SERVER_NAME'] === parse_url( get_home_url( ), PHP_URL_HOST ) ) {
|
3924 |
$url = set_url_scheme( $url, 'https' );
|
3925 |
}
|
3926 |
}
|
3927 |
/**
|
3928 |
+
* Filter the Caldera Forms APU url
|
3929 |
*
|
3930 |
+
* @since 1.3.2
|
|
|
|
|
3931 |
*
|
3932 |
* @param string $url URL.
|
3933 |
+
* @param string $form_id ID of form.
|
3934 |
*/
|
3935 |
return apply_filters( 'caldera_forms_submission_url', $url, $form_id );
|
3936 |
+
|
3937 |
}
|
3938 |
|
3939 |
/**
|
3942 |
static public function cf_init_system(){
|
3943 |
|
3944 |
global $post, $wp_query, $process_id, $form;
|
3945 |
+
|
3946 |
+
// setup script and style urls
|
3947 |
$style_urls = array(
|
3948 |
'modals' => CFCORE_URL . 'assets/css/remodal.min.css',
|
3949 |
'modals-theme' => CFCORE_URL . 'assets/css/remodal-default-theme.min.css',
|
3957 |
'modals' => CFCORE_URL . 'assets/js/remodal.min.js',
|
3958 |
'baldrick' => CFCORE_URL . 'assets/js/jquery.baldrick.min.js',
|
3959 |
'ajax' => CFCORE_URL . 'assets/js/ajax-core.min.js',
|
3960 |
+
'field' => CFCORE_URL . 'assets/js/fields.min.js',
|
3961 |
'conditionals' => CFCORE_URL . 'assets/js/conditionals.min.js',
|
3962 |
'validator-i18n' => null,
|
3963 |
'validator' => CFCORE_URL . 'assets/js/parsley.min.js',
|
3964 |
//'polyfiller' => CFCORE_URL . 'assets/js/polyfiller.min.js',
|
3965 |
+
'init' => CFCORE_URL . 'assets/js/frontend-script-init.min.js',
|
3966 |
);
|
3967 |
+
|
3968 |
$script_style_urls = array();
|
3969 |
|
3970 |
// check to see language and include the language add on
|
3997 |
*
|
3998 |
* @param array $script_urls array containing all urls to register
|
3999 |
*/
|
4000 |
+
$script_style_urls['script'] = apply_filters( 'caldera_forms_script_urls', $script_urls );
|
4001 |
+
|
4002 |
/**
|
4003 |
* Filter style URLS for Caldera Forms on the frontend, before they are enqueued.
|
4004 |
*
|
4043 |
// hook into submission
|
4044 |
if(isset($_POST['_cf_verify']) && isset( $_POST['_cf_frm_id'] )){
|
4045 |
if(wp_verify_nonce( $_POST['_cf_verify'], 'caldera_forms_front' )){
|
4046 |
+
|
4047 |
self::process_submission();
|
4048 |
exit;
|
4049 |
|
4080 |
/**
|
4081 |
* Load a saved entry.
|
4082 |
*
|
4083 |
+
* @param int $entry_id Entry ID
|
4084 |
+
* @param string|array $form Optional. Config array, or ID of form.
|
4085 |
*
|
4086 |
* @return array
|
4087 |
*/
|
4088 |
+
static public function get_entry($entry_id, $form){
|
4089 |
+
if ( is_string( $form ) ) {
|
4090 |
+
$form_id = $form;
|
4091 |
+
$form = Caldera_Forms_Forms::get_form( $form );
|
4092 |
+
if ( ! is_array( $form ) || ! isset( $form[ 'ID' ] ) || $form[ 'ID' ] !== $form_id ) {
|
4093 |
+
return new WP_Error( 'fail', esc_html__( 'Invalid form ID', 'caldera-forms' ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4094 |
}
|
|
|
4095 |
}
|
4096 |
+
|
4097 |
+
if ( empty( $form ) ) {
|
4098 |
return;
|
4099 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4100 |
|
4101 |
+
|
4102 |
+
// get fields
|
4103 |
$field_types = self::get_field_types();
|
4104 |
+
|
4105 |
$entry = self::get_submission_data($form, $entry_id);
|
4106 |
$data = array(
|
4107 |
'data' => array()
|
4108 |
);
|
4109 |
|
4110 |
foreach($entry as $field_id=>$field_value){
|
4111 |
+
|
4112 |
if(!isset($form['fields'][$field_id]) || !isset($field_types[$form['fields'][$field_id]['type']])){
|
4113 |
continue;
|
4114 |
}
|
4178 |
|
4179 |
}
|
4180 |
|
4181 |
+
if( empty( $field_types[ $field['type'] ]['options'] ) ){
|
4182 |
+
$data['data'][$field_id . '_' . $i ] = array(
|
4183 |
+
'label' => $field['label'],
|
4184 |
+
'view' => $field_view,
|
4185 |
+
'value' => $field_value
|
4186 |
+
);
|
4187 |
+
$i ++;
|
4188 |
+
}
|
4189 |
}
|
4190 |
}
|
4191 |
+
|
4192 |
}
|
4193 |
|
4194 |
$data['data'][$field_id] = array(
|
4241 |
);
|
4242 |
}
|
4243 |
}
|
4244 |
+
}
|
4245 |
+
|
4246 |
// allow plugins to alter the profile.
|
4247 |
$data['user'] = apply_filters( 'caldera_forms_get_entry_user', $data['user'], $entry_id, $form);
|
4248 |
|
4249 |
// set the entry status
|
4250 |
$data['status'] = $entry_detail['status'];
|
4251 |
+
|
4252 |
// allow plugins to alter the entry
|
4253 |
$data = apply_filters( 'caldera_forms_get_entry', $data, $entry_id, $form);
|
4254 |
|
4255 |
+
|
|
|
|
|
|
|
|
|
|
|
4256 |
return $data;
|
4257 |
}
|
4258 |
|
4279 |
if(empty($form['ID']) || $form['ID'] != $atts['id']){
|
4280 |
return $content;
|
4281 |
}
|
4282 |
+
|
4283 |
$form_atts = array('id'=>$form['ID'],'ajax'=>true);
|
4284 |
if( !empty( $atts['entry'] ) ){
|
4285 |
$form_atts['entry'] = $atts['entry'];
|
4312 |
if(!empty($atts['width'])){
|
4313 |
$width = ' width: ' . floatval( $atts['width'] ).'px; margin-left: -' . ( floatval( $atts['width'] ) / 2 ) . 'px;';
|
4314 |
}
|
4315 |
+
|
4316 |
|
4317 |
ob_start();
|
4318 |
?>
|
4324 |
<h3 class="modal-label" id="<?php echo $modal_id; ?>_modal_label"><?php echo $form['name']; ?></h3>
|
4325 |
</div>
|
4326 |
<div class="caldera-modal-body caldera-front-modal-body" id="<?php echo $modal_id; ?>_modal_body">
|
4327 |
+
<?php echo self::render_form( $form_atts ); ?>
|
4328 |
</div>
|
4329 |
</div>
|
4330 |
</div>
|
4386 |
"field" => $field,
|
4387 |
"id" => $field['ID'],//'fld_' . $field['slug'],
|
4388 |
"name" => $field['ID'],//$field['slug'],
|
4389 |
+
"wrapper_before" => "<div role=\"field\" data-field-wrapper=\"" . $field['ID'] . "\" class=\"" . $field_wrapper_class . "\">\r\n",
|
4390 |
"field_before" => "<div class=\"" . $field_input_class ."\">\r\n",
|
4391 |
+
"label_before" => ( empty($field['hide_label']) ? "<label id=\"" . $field['ID'] ."Label\" for=\"" . $field['ID'].'_'.$current_form_count . "\" class=\"" . implode(' ', $field_classes['field_label'] ) . "\">" : null ),
|
4392 |
"label" => ( empty($field['hide_label']) ? $field['label'] : null ),
|
4393 |
+
"label_required" => ( empty($field['hide_label']) ? ( !empty($field['required']) ? " <span aria-hidden=\"true\" role=\"presentation\" class=\"" . implode(' ', $field_classes['field_required_tag'] ) . "\" style=\"color:#ff2222;\">*</span>" : "" ) : null ),
|
4394 |
"label_after" => ( empty($field['hide_label']) ? "</label>" : null ),
|
4395 |
"field_placeholder" => ( !empty($field['hide_label']) ? 'placeholder="' . htmlentities( $field['label'] ) .'"' : null),
|
4396 |
"field_required" => ( !empty($field['required']) ? 'required="required"' : null),
|
4397 |
"field_value" => null,
|
4398 |
+
"field_caption" => ( !empty($field['caption']) ? "<span id=\"" . $field['ID'] ."Caption\" class=\"" . implode(' ', $field_classes['field_caption'] ) . "\">" . $field['caption'] . "</span>\r\n" : ""),
|
4399 |
"field_after" => "</div>\r\n",
|
4400 |
"wrapper_after" => "</div>\r\n",
|
4401 |
+
"aria" => array()
|
4402 |
);
|
4403 |
+
// if has label
|
4404 |
+
if( empty( $field['hide_label'] ) ){
|
4405 |
+
// visible label, set labelled by
|
4406 |
+
$field_structure['aria']['labelledby'] = $field['ID'] . 'Label';
|
4407 |
+
}else{
|
4408 |
+
// hidden label, aria label instead
|
4409 |
+
$field_structure['aria']['label'] = $field['label'];
|
4410 |
+
}
|
4411 |
+
// if has caption
|
4412 |
+
if( !empty( $field['caption'] ) ){
|
4413 |
+
$field_structure['aria']['describedby'] = $field['ID'] . 'Caption';
|
4414 |
+
}
|
4415 |
+
|
4416 |
// add error
|
4417 |
if ( ! empty( $field_errors ) ) {
|
4418 |
if( is_string( $field_errors ) ){
|
4440 |
$field_structure = apply_filters( 'caldera_forms_render_field_structure_type-' . $field['type'], $field_structure, $form);
|
4441 |
$field_structure = apply_filters( 'caldera_forms_render_field_structure_slug-' . $field['slug'], $field_structure, $form);
|
4442 |
|
4443 |
+
// compile aria tags
|
4444 |
+
if( !empty( $field_structure['aria'] ) ){
|
4445 |
+
$aria_atts = null;
|
4446 |
+
foreach ($field_structure['aria'] as $att => $att_val) {
|
4447 |
+
$aria_atts .= ' aria-' . $att . '="' . esc_attr( $att_val ) . '"';
|
4448 |
+
}
|
4449 |
+
$field_structure['aria'] = $aria_atts;
|
4450 |
+
}
|
4451 |
+
|
4452 |
$field_name = $field_structure['name'];
|
4453 |
$field_id = $field_structure['id'] . '_' .$current_form_count;
|
4454 |
$wrapper_before = $field_structure['wrapper_before'];
|
4466 |
|
4467 |
// register strings
|
4468 |
$form_field_strings[ $field_structure['id'] ] = array( 'id' => $field_structure['id'], 'instance' => $current_form_count, 'slug' => $field['slug'], 'label' => $field['label'] );
|
4469 |
+
|
4470 |
$field_types = self::get_field_types();
|
4471 |
|
4472 |
$field_file = $field_types[$field['type']]['file'];
|
4533 |
if( isset( $form['form_draft'] ) ){
|
4534 |
if( !isset( $_GET['cf_preview'] ) || $_GET['cf_preview'] != $form['ID'] ){
|
4535 |
if( isset( $_POST['action'] ) && $_POST['action'] == 'cf_get_form_preview' ){
|
4536 |
+
echo '<p style="color: #cf0000;">' . __( 'Form is currently not active.', 'caldera-forms' ) . '</p>';
|
4537 |
}else{
|
4538 |
return;
|
4539 |
}
|
4540 |
+
|
4541 |
}else{
|
4542 |
+
echo '<div class="caldera-grid"><p class="alert alert-error alert-danger">' . __( 'Form is currently not active.', 'caldera-forms' ) . '</p></div>';
|
4543 |
}
|
4544 |
}
|
4545 |
+
|
4546 |
if(isset($atts['ajax'])){
|
4547 |
if(!empty($atts['ajax'])){
|
4548 |
$form['form_ajax'] = 1;
|
4600 |
$current_form_count = 0;
|
4601 |
}
|
4602 |
$current_form_count += 1;
|
4603 |
+
|
4604 |
// set instance
|
4605 |
if( !empty( $atts['instance'] ) ){
|
4606 |
$current_form_count = absint( $atts['instance'] );
|
4661 |
"column_before" => '<div %1$s class="col-'.$gridsize.'-%2$d %3$s">',
|
4662 |
"column_after" => '</div>',
|
4663 |
);
|
4664 |
+
|
4665 |
// filter settings
|
4666 |
$grid_settings = apply_filters( 'caldera_forms_render_grid_settings', $grid_settings, $form);
|
4667 |
|
4706 |
'alert-danger'
|
4707 |
)),
|
4708 |
);
|
4709 |
+
|
4710 |
$note_classes = apply_filters( 'caldera_forms_render_note_classes', $note_classes, $form);
|
4711 |
|
4712 |
$field_errors = array();
|
4713 |
+
|
4714 |
// edit entry from url
|
4715 |
if(!empty($_GET['cf_ee'])){
|
4716 |
$entry_id = $_GET['cf_ee'];
|
4718 |
|
4719 |
// attr entry id
|
4720 |
if(!empty($atts['entry'])){
|
4721 |
+
$entry_id = $atts['entry'];
|
4722 |
}
|
4723 |
+
|
4724 |
if(!empty($entry_id)){
|
4725 |
//check user can edit this item.
|
4726 |
$user_id = get_current_user_id();
|
4734 |
'form_id' => $form['ID']
|
4735 |
);
|
4736 |
if( sha1( json_encode( $token_array ) ) !== trim( $_GET['cf_et'] ) ){
|
4737 |
+
$notices['error']['note'] = __( 'Permission denied or entry does not exist.', 'caldera-forms' );
|
4738 |
}else{
|
4739 |
$entry_id = (int) $details['id'];
|
4740 |
$edit_token = sha1( json_encode( $token_array ) );
|
4750 |
// can edit.
|
4751 |
$entry_id = (int) $details['id'];
|
4752 |
}else{
|
4753 |
+
$notices['error']['note'] = __( 'Permission denied or entry does not exist.', 'caldera-forms' );
|
4754 |
}
|
4755 |
}else{
|
4756 |
+
$notices['error']['note'] = __( 'Permission denied or entry does not exist.', 'caldera-forms' );
|
4757 |
}
|
4758 |
|
4759 |
}else{
|
4760 |
+
$notices['error']['note'] = __( 'Permission denied or entry does not exist.', 'caldera-forms' );
|
4761 |
}
|
4762 |
}
|
4763 |
|
4772 |
|
4773 |
// load requested data
|
4774 |
if(!empty($entry_id)){
|
4775 |
+
$prev_entry = self::get_entry($entry_id, $form);
|
4776 |
$prev_data = array();
|
4777 |
self::set_field_data('_entry_id', $entry_id, $form);
|
4778 |
foreach($prev_entry['data'] as $field_id=>$entry_data){
|
4784 |
if(!empty($_GET['cf_er'])){
|
4785 |
$prev_post = get_transient( $_GET['cf_er'] );
|
4786 |
if(!empty($prev_post['transient'])){
|
4787 |
+
|
4788 |
if($prev_post['transient'] === $_GET['cf_er']){
|
4789 |
foreach($prev_post['data'] as $field_id=>$field_entry){
|
4790 |
+
|
4791 |
if(!isset($form['fields'][$field_id])){
|
4792 |
continue; // ignore non field data
|
4793 |
}
|
4802 |
}
|
4803 |
if(!empty($prev_post['error']) && !empty($prev_post['note'])){
|
4804 |
$notices['error']['note'] = $prev_post['note'];
|
4805 |
+
}
|
4806 |
+
if(!empty($prev_post['fields'])){
|
4807 |
$field_errors = array();
|
4808 |
foreach($prev_post['fields'] as $field_id=>$field_error){
|
4809 |
|
4837 |
$currentpage = (int) $prev_post['page'];
|
4838 |
}
|
4839 |
$display = 'none';
|
4840 |
+
$hidden = 'true';
|
4841 |
if( $currentpage === 1){
|
4842 |
$display = 'block';
|
4843 |
+
$hidden = 'false';
|
4844 |
}
|
4845 |
|
4846 |
$total_rows = substr_count($form['layout_grid']['structure'], '|') + 1;
|
4847 |
+
$form['grid_object']->before('<div id="form_page_' . $current_form_count . '_pg_1" data-formpage="1" class="caldera-form-page" style="display:'.$display.';" role="region" aria-labelledby="breadcrumb_' . $current_form_count . '_pg_1" aria-hidden="' . $hidden . '">', 1);
|
4848 |
$form['grid_object']->after('</div>', $total_rows);
|
4849 |
//dump($page_breaks);
|
4850 |
foreach($page_breaks as $page=>$break){
|
4853 |
|
4854 |
if($break+1 <= $total_rows ){
|
4855 |
$display = 'none';
|
4856 |
+
$hidden = 'true';
|
4857 |
if($page+2 == $currentpage){
|
4858 |
$display = 'block';
|
4859 |
+
$hidden = 'false';
|
4860 |
}
|
4861 |
|
4862 |
+
$form['grid_object']->before('<div id="form_page_' . $current_form_count . '_pg_' . ($page+2) . '" data-formpage="' . ($page+2) . '" role="region" aria-labelledby="breadcrumb_' . $current_form_count . '_pg_' . ( $page + 2 ) . '" aria-hidden="' . $hidden . '" class="caldera-form-page" style="display:'.$display.';">', $break+1);
|
4863 |
}
|
4864 |
}
|
4865 |
//dump($page_breaks,0);
|
4876 |
if($slug == '_required_bounds'){
|
4877 |
continue;
|
4878 |
}
|
4879 |
+
if(in_array($slug, $processor['config']['_required_bounds'])){
|
4880 |
$bound_fields = array_merge($bound_fields, self::search_array_fields($value, array_keys( $form['fields'])) );
|
4881 |
}
|
4882 |
}
|
4893 |
$form_field_strings = array();
|
4894 |
|
4895 |
if(!empty($form['fields'])){
|
4896 |
+
// prepare fields
|
4897 |
foreach($form['fields'] as $field_id=>$field){
|
4898 |
$field = apply_filters( 'caldera_forms_render_get_field', $field, $form);
|
4899 |
$field = apply_filters( 'caldera_forms_render_get_field_type-' . $field['type'], $field, $form);
|
4965 |
// dump($field['conditions'],0);
|
4966 |
//}
|
4967 |
$conditions_configs[$field_base_id] = $field['conditions'];
|
4968 |
+
|
4969 |
if( $field['conditions']['type'] !== 'disable' ){
|
4970 |
// wrap it up
|
4971 |
$conditions_templates[$field_base_id] = "<script type=\"text/html\" id=\"conditional-" . $field_base_id . "-tmpl\">\r\n" . $field_html . "</script>\r\n";
|
4979 |
}
|
4980 |
}
|
4981 |
}
|
4982 |
+
|
4983 |
if($field['conditions']['type'] == 'show' || $field['conditions']['type'] == 'wdisable'){
|
4984 |
// show if indicates hidden by default until condition is matched.
|
4985 |
$field_html = null;
|
4986 |
}
|
4987 |
// wrapp it up
|
4988 |
+
$field_html = '<span class="caldera-forms-conditional-field" role="region" aria-live="polite" id="conditional_' . $field_base_id . '">' . $field_html . '</span>';
|
4989 |
}
|
4990 |
|
4991 |
$form['grid_object']->append($field_html, $field['grid_location']);
|
4992 |
+
|
4993 |
}
|
4994 |
}
|
4995 |
}
|
5028 |
|
5029 |
// set debug notice
|
5030 |
if( !empty( $form['mailer']['enable_mailer'] ) && !empty( $form['debug_mailer'] ) ){
|
5031 |
+
$notices['error'] = array( 'note' => __( 'WARNING: Form is in Mailer Debug mode. Disable before going live.', 'caldera-forms' ) );
|
5032 |
}
|
5033 |
|
5034 |
$out .= '<div id="caldera_notices_'.$current_form_count.'" data-spinner="'. admin_url( 'images/spinner.gif' ).'">';
|
5042 |
}else{
|
5043 |
$notice_entry_id = null;
|
5044 |
}
|
5045 |
+
|
5046 |
foreach($notices as $note_type => $notice){
|
5047 |
+
if(!empty($notice['note'])){
|
5048 |
$out .= '<div class=" '. implode(' ', $note_classes[$note_type]) . '">' . self::do_magic_tags( $notice['note'], $notice_entry_id ) .'</div>';
|
5049 |
}
|
5050 |
}
|
5051 |
|
5052 |
}
|
5053 |
+
$out .= '</div>';
|
5054 |
if((empty($notices['success']) || empty($form['hide_form'])) && empty($halt_render)){
|
5055 |
|
5056 |
$form_element = 'form';
|
5059 |
$form['ID'],
|
5060 |
'caldera_forms_form',
|
5061 |
);
|
5062 |
+
|
5063 |
$form_attributes = array(
|
5064 |
'method' => 'POST',
|
5065 |
'enctype' => 'multipart/form-data',
|
5121 |
$out .= "<input type=\"hidden\" name=\"_cf_frm_tr\" value=\"" . $prev_post['transient'] . "\">\r\n";
|
5122 |
}
|
5123 |
// is edit?
|
5124 |
+
if(!empty($entry_id)){
|
5125 |
$out .= "<input type=\"hidden\" name=\"_cf_frm_edt\" value=\"" . $entry_id . "\">\r\n";
|
5126 |
}
|
5127 |
|
5133 |
|
5134 |
// auto pagination
|
5135 |
if(!empty($form['auto_progress']) && count($form['page_names']) > 1){
|
5136 |
+
|
5137 |
+
// retain query string
|
5138 |
+
$qurystr = array();
|
5139 |
+
parse_str( $_SERVER['QUERY_STRING'], $qurystr );
|
5140 |
+
$out .= "<span class=\"caldera-grid\"><ol class=\"breadcrumb\" data-form=\"caldera_form_" . $current_form_count ."\">\r\n";
|
5141 |
+
$current_page = 1;
|
5142 |
+
if(!empty($_GET['cf_pg'])){
|
5143 |
+
$current_page = $_GET['cf_pg'];
|
|
|
|
|
|
|
|
|
|
|
|
|
5144 |
}
|
5145 |
+
foreach($form['page_names'] as $page_key=>$page_name){
|
5146 |
+
$tabclass = null;
|
5147 |
+
$expanded = 'false';
|
5148 |
+
if($current_page == $page_key + 1){
|
5149 |
+
$tabclass = ' class="active"';
|
5150 |
+
$expanded = 'true';
|
5151 |
+
}
|
5152 |
+
|
5153 |
+
$qurystr['cf_pg'] = $page_key + 1;
|
5154 |
+
$out .= "<li" . $tabclass . "><a aria-controls=\"form_page_" . $current_form_count ."_pg_" . ( $page_key + 1 ) . "\" aria-expanded=\"" . $expanded . "\" id=\"breadcrumb_" . $current_form_count ."_pg_" . ( $page_key + 1 ) . "\" href=\"?". http_build_query($qurystr) . "\" data-page=\"" . ( $page_key + 1 ) ."\" data-pagenav=\"caldera_form_" . $current_form_count ."\">". $page_name . "</a></li>\r\n";
|
5155 |
+
}
|
5156 |
+
$out .= "</ol></span>\r\n";
|
5157 |
}
|
5158 |
+
|
5159 |
// sticky sticky honey
|
5160 |
if(isset($form['check_honey'])){
|
5161 |
$out .= "<div class=\"hide\" style=\"display:none; overflow:hidden;height:0;width:0;\">\r\n";
|
5168 |
* @param array $words An array of words.
|
5169 |
*/
|
5170 |
$honey_words = apply_filters( 'caldera_forms_get_honey_words', array('web_site', 'url', 'email', 'company', 'name'));
|
5171 |
+
$word = $honey_words[rand(0, count($honey_words) - 1 )];
|
5172 |
+
$out .= "<label>". ucwords( str_replace('_', ' ', $word) ) ."</label><input type=\"text\" name=\"".$word."\" value=\"\" autocomplete=\"off\">\r\n";
|
5173 |
$out .= "</div>";
|
5174 |
}
|
5175 |
|
5177 |
|
5178 |
$out .= "</" . $form_element . ">\r\n";
|
5179 |
}
|
5180 |
+
|
5181 |
$out .= "</div>\r\n";
|
5182 |
+
|
5183 |
// output javascript conditions.
|
5184 |
if(!empty($conditions_configs)){
|
5185 |
+
// sortout magics
|
5186 |
foreach($conditions_configs as &$condition_field_conf){
|
5187 |
if(!empty($condition_field_conf['group'])){
|
5188 |
foreach($condition_field_conf['group'] as &$condition_group){
|
5221 |
// find %tags%
|
5222 |
preg_match_all("/%(.+?)%/", $conditions_str, $hastags);
|
5223 |
if(!empty($hastags[1])){
|
5224 |
+
|
5225 |
foreach($hastags[1] as $tag_key=>$tag){
|
5226 |
|
5227 |
foreach($form['fields'] as $field_id=>$field){
|
5298 |
* @param array|null $form Form config if it was passed.
|
5299 |
*/
|
5300 |
return apply_filters( 'caldera_forms_manage_cap', 'manage_options', $context, $form );
|
5301 |
+
|
5302 |
}
|
5303 |
|
5304 |
/**
|
5319 |
if( $shortcode === 'caldera_form_modal' ){
|
5320 |
$atts[ 'modal' ] = true;
|
5321 |
}
|
5322 |
+
|
5323 |
if( isset( $atts[ 'modal' ] ) && $atts[ 'modal' ] ) {
|
5324 |
$form = Caldera_Forms_Forms::get_form( $atts[ 'id' ] );
|
5325 |
if( ! is_array( $form ) ) {
|
5346 |
if( !empty( $atts['type'] ) && $atts['type'] == 'button' ){
|
5347 |
$form = sprintf( '<button class="caldera-forms-modal" %1s title="%2s">%3s</button>', $tag_atts, $title, $content );
|
5348 |
}else{
|
5349 |
+
$form = sprintf( '<a href="#" class="caldera-forms-modal" %1s title="%2s">%3s</a>', $tag_atts, $title, $content );
|
5350 |
}
|
5351 |
|
5352 |
wp_enqueue_script( 'cf-dynamic' );
|
5361 |
/**
|
5362 |
* Convert time entry was submitted (as MySQL timestamp in UTC) to local display time
|
5363 |
*
|
5364 |
+
* @since 1.4.0
|
5365 |
*
|
5366 |
* @param string $submitted Timestamp
|
5367 |
*
|
5373 |
|
5374 |
$format = $dateformat.' '.$timeformat;
|
5375 |
$time = get_date_from_gmt( $submitted, $format );
|
5376 |
+
|
5377 |
return $time;
|
5378 |
}
|
5379 |
|
|
|
|
|
|
|
5380 |
}
|
classes/db/base.php
CHANGED
@@ -90,9 +90,20 @@ abstract class Caldera_Forms_DB_Base {
|
|
90 |
* @return array
|
91 |
*/
|
92 |
public function get_fields(){
|
|
|
93 |
$fields[ 'primary' ] = array_keys( $this->primary_fields );
|
|
|
94 |
$fields[ 'meta_keys' ] = array_keys( $this->meta_keys );
|
95 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
return $fields;
|
97 |
}
|
98 |
|
@@ -111,7 +122,7 @@ abstract class Caldera_Forms_DB_Base {
|
|
111 |
'fields' => array(),
|
112 |
'formats' => array()
|
113 |
);
|
114 |
-
|
115 |
foreach( $data as $field => $datum ){
|
116 |
if( is_null( $datum ) || is_array( $datum ) || is_object( $datum ) ){
|
117 |
$datum = '';
|
@@ -130,8 +141,8 @@ abstract class Caldera_Forms_DB_Base {
|
|
130 |
}
|
131 |
|
132 |
$id = $this->save( $_data );
|
133 |
-
if( is_numeric( $id ) ){
|
134 |
-
|
135 |
foreach( $_meta as $meta ){
|
136 |
|
137 |
foreach( $this->meta_keys as $meta_key => $field ) {
|
@@ -285,7 +296,7 @@ abstract class Caldera_Forms_DB_Base {
|
|
285 |
* @since 1.3.5
|
286 |
*
|
287 |
* @param int|array $id ID of entry, or an array of IDs.
|
288 |
-
*
|
289 |
* @return array|null|object
|
290 |
*/
|
291 |
public function get_meta( $id, $key = false ){
|
90 |
* @return array
|
91 |
*/
|
92 |
public function get_fields(){
|
93 |
+
|
94 |
$fields[ 'primary' ] = array_keys( $this->primary_fields );
|
95 |
+
|
96 |
$fields[ 'meta_keys' ] = array_keys( $this->meta_keys );
|
97 |
+
|
98 |
+
/**
|
99 |
+
* Filter the allowed meta keys that can be saved
|
100 |
+
*
|
101 |
+
* @since 1.4.0
|
102 |
+
*
|
103 |
+
* @param array $fields Allowed fields
|
104 |
+
* @param string $table_name Name of table
|
105 |
+
*/
|
106 |
+
$fields[ 'meta_fields' ] = apply_filters( 'caldera_forms_db_meta_fields', array_keys( $this->meta_fields ), $this->get_table_name( true ) );
|
107 |
return $fields;
|
108 |
}
|
109 |
|
122 |
'fields' => array(),
|
123 |
'formats' => array()
|
124 |
);
|
125 |
+
|
126 |
foreach( $data as $field => $datum ){
|
127 |
if( is_null( $datum ) || is_array( $datum ) || is_object( $datum ) ){
|
128 |
$datum = '';
|
141 |
}
|
142 |
|
143 |
$id = $this->save( $_data );
|
144 |
+
if( is_numeric( $id ) && ! empty( $_meta[ 'fields' ] ) ){
|
145 |
+
|
146 |
foreach( $_meta as $meta ){
|
147 |
|
148 |
foreach( $this->meta_keys as $meta_key => $field ) {
|
296 |
* @since 1.3.5
|
297 |
*
|
298 |
* @param int|array $id ID of entry, or an array of IDs.
|
299 |
+
* @param string|bool $key Optional. If false, the default all the metas are returned. Use name of key to get one specific key.
|
300 |
* @return array|null|object
|
301 |
*/
|
302 |
public function get_meta( $id, $key = false ){
|
classes/db/track.php
CHANGED
@@ -114,8 +114,9 @@ class Caldera_Forms_DB_Track extends Caldera_Forms_DB_Base {
|
|
114 |
add_action( 'caldera_forms_submit_complete', array( $this, 'submit_complete' ), 50, 3 );
|
115 |
add_action( 'caldera_forms_submit_complete', array( $this, 'email_tracking' ), 51, 3 );
|
116 |
add_action( 'caldera_forms_mailer_complete', array( $this, 'email_sent'), 50, 3 );
|
117 |
-
add_action( 'caldera_forms_mailer_failed', array( $this, 'email_fail' ), 50,
|
118 |
-
|
|
|
119 |
}
|
120 |
|
121 |
/**
|
@@ -244,8 +245,9 @@ class Caldera_Forms_DB_Track extends Caldera_Forms_DB_Base {
|
|
244 |
* @param array $mail Mailer data
|
245 |
* @param array $data Submission data
|
246 |
* @param array $form Form config
|
|
|
247 |
*/
|
248 |
-
public function email_fail( $mail, $data, $form ){
|
249 |
global $process_id;
|
250 |
if( isset( $form[ 'ID' ] ) ){
|
251 |
$this->create( array(
|
@@ -253,6 +255,7 @@ class Caldera_Forms_DB_Track extends Caldera_Forms_DB_Base {
|
|
253 |
'form_id' => $form[ 'ID' ],
|
254 |
'process_id' => $process_id,
|
255 |
'time' => current_time( 'mysql' ),
|
|
|
256 |
'recipients_set' => self::recipients_set( $mail )
|
257 |
));
|
258 |
|
@@ -260,6 +263,26 @@ class Caldera_Forms_DB_Track extends Caldera_Forms_DB_Base {
|
|
260 |
|
261 |
}
|
262 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
263 |
protected function recipients_set( $mail ){
|
264 |
if( ! is_array( $mail ) || ! isset( $mail[ 'recipients' ] ) || empty( $mail[ 'recipients' ] ) ){
|
265 |
return false;
|
@@ -267,28 +290,7 @@ class Caldera_Forms_DB_Track extends Caldera_Forms_DB_Base {
|
|
267 |
|
268 |
return true;
|
269 |
}
|
270 |
-
/**
|
271 |
-
|
272 |
-
protected function unparse_url( $url ){
|
273 |
-
$keys = array( 'user', 'pass', 'port', 'path', 'query', 'fragment' );
|
274 |
-
foreach ( $keys as $key ) {
|
275 |
-
if ( $flags & (int) constant( 'HTTP_URL_STRIP_' . strtoupper( $key ) ) ) {
|
276 |
-
unset( $parse_url[ $key ] );
|
277 |
-
}
|
278 |
|
279 |
-
if( is_array( $parse_url[ $key ] ) ){
|
280 |
-
$parse_url[ $key ] = http_build_query( $parse_url[ $key ] );
|
281 |
-
}
|
282 |
-
|
283 |
-
}
|
284 |
-
return ( ( isset( $parse_url[ 'scheme' ] ) ) ? $parse_url[ 'scheme' ] . '://' : '' )
|
285 |
-
. ( ( isset( $parse_url[ 'user' ] ) ) ? $parse_url[ 'user' ] . ( ( isset( $parse_url[ 'pass' ] ) ) ? ':' . $parse_url[ 'pass' ] : '' ) . '@' : '' )
|
286 |
-
. ( ( isset( $parse_url[ 'host' ] ) ) ? $parse_url[ 'host' ] : '' )
|
287 |
-
. ( ( isset( $parse_url[ 'port' ] ) ) ? ':' . $parse_url[ 'port' ] : '' )
|
288 |
-
. ( ( isset( $parse_url[ 'path' ] ) ) ? $parse_url[ 'path' ] : '' )
|
289 |
-
. ( ( isset( $parse_url[ 'query' ] ) ) ? '?' . $parse_url[ 'query' ] : '' )
|
290 |
-
. ( ( isset( $parse_url[ 'fragment' ] ) ) ? '#' . $parse_url[ 'fragment' ] : '' );
|
291 |
-
}*/
|
292 |
|
293 |
|
294 |
}
|
114 |
add_action( 'caldera_forms_submit_complete', array( $this, 'submit_complete' ), 50, 3 );
|
115 |
add_action( 'caldera_forms_submit_complete', array( $this, 'email_tracking' ), 51, 3 );
|
116 |
add_action( 'caldera_forms_mailer_complete', array( $this, 'email_sent'), 50, 3 );
|
117 |
+
add_action( 'caldera_forms_mailer_failed', array( $this, 'email_fail' ), 50, 4 );
|
118 |
+
add_action( 'caldera_forms_mailer_invalid', array( $this, 'email_invalid' ), 50 );
|
119 |
+
|
120 |
}
|
121 |
|
122 |
/**
|
245 |
* @param array $mail Mailer data
|
246 |
* @param array $data Submission data
|
247 |
* @param array $form Form config
|
248 |
+
* @param string $method Send method
|
249 |
*/
|
250 |
+
public function email_fail( $mail, $data, $form, $method ){
|
251 |
global $process_id;
|
252 |
if( isset( $form[ 'ID' ] ) ){
|
253 |
$this->create( array(
|
255 |
'form_id' => $form[ 'ID' ],
|
256 |
'process_id' => $process_id,
|
257 |
'time' => current_time( 'mysql' ),
|
258 |
+
'method' => strip_tags( $method ),
|
259 |
'recipients_set' => self::recipients_set( $mail )
|
260 |
));
|
261 |
|
263 |
|
264 |
}
|
265 |
|
266 |
+
/**
|
267 |
+
* Track invalid mailer settings events
|
268 |
+
*
|
269 |
+
* @since 1.4.0
|
270 |
+
*
|
271 |
+
* @param array $form Form config
|
272 |
+
*/
|
273 |
+
public function email_invalid( $form){
|
274 |
+
global $process_id;
|
275 |
+
if( isset( $form[ 'ID' ] ) ){
|
276 |
+
$this->create( array(
|
277 |
+
'event' => 'email_failed',
|
278 |
+
'form_id' => $form[ 'ID' ],
|
279 |
+
'process_id' => $process_id,
|
280 |
+
'time' => current_time( 'mysql' ),
|
281 |
+
));
|
282 |
+
|
283 |
+
}
|
284 |
+
}
|
285 |
+
|
286 |
protected function recipients_set( $mail ){
|
287 |
if( ! is_array( $mail ) || ! isset( $mail[ 'recipients' ] ) || empty( $mail[ 'recipients' ] ) ){
|
288 |
return false;
|
290 |
|
291 |
return true;
|
292 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
293 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
294 |
|
295 |
|
296 |
}
|
classes/email/attachment.php
ADDED
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Attachment object
|
5 |
+
*
|
6 |
+
* @package Caldera_Forms
|
7 |
+
* @author Josh Pollock <Josh@CalderaWP.com>
|
8 |
+
* @license GPL-2.0+
|
9 |
+
* @link
|
10 |
+
* @copyright 2016 CalderaWP LLC
|
11 |
+
*/
|
12 |
+
class Caldera_Forms_Email_Attachment extends Caldera_Forms_Object {
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Content type
|
16 |
+
*
|
17 |
+
* @since 1.4.0
|
18 |
+
*
|
19 |
+
* @var string
|
20 |
+
*/
|
21 |
+
protected $type;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Actual file contents
|
25 |
+
*
|
26 |
+
* @since 1.4.0
|
27 |
+
*
|
28 |
+
* @var string
|
29 |
+
*/
|
30 |
+
protected $content;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* The filename
|
34 |
+
*
|
35 |
+
* @since 1.4.0
|
36 |
+
*
|
37 |
+
* @var string
|
38 |
+
*/
|
39 |
+
protected $filename;
|
40 |
+
|
41 |
+
/**
|
42 |
+
* @inheritdoc
|
43 |
+
*/
|
44 |
+
protected function get_prefix(){
|
45 |
+
return 'attachment';
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Get file contents as a base64 encoded string
|
50 |
+
*
|
51 |
+
* @since 1.4.0
|
52 |
+
*
|
53 |
+
* @return string
|
54 |
+
*/
|
55 |
+
public function get_encoded(){
|
56 |
+
if( false != ( $file = file_get_contents( $this->filename ) ) ){
|
57 |
+
|
58 |
+
return base64_encode( $file );
|
59 |
+
}
|
60 |
+
|
61 |
+
}
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Make calls to $this->filename only return basename
|
65 |
+
*
|
66 |
+
* @since 1.4.0
|
67 |
+
*
|
68 |
+
* @return string
|
69 |
+
*/
|
70 |
+
protected function filename_get(){
|
71 |
+
return basename( $this->filename );
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Called when setting content property, and sets everything if value is a filepath
|
76 |
+
*
|
77 |
+
* @since 1.4.0
|
78 |
+
*
|
79 |
+
* @param $content
|
80 |
+
*/
|
81 |
+
protected function content_set( $content ){
|
82 |
+
if( is_file( $content ) ){
|
83 |
+
$this->content = file_get_contents( $content );
|
84 |
+
$this->filename = $content;
|
85 |
+
$this->type = mime_content_type( $content );
|
86 |
+
$info = pathinfo( $this->filename );
|
87 |
+
if( 'csv' == $info[ 'extension' ] ){
|
88 |
+
$this->type = 'text/csv';
|
89 |
+
}
|
90 |
+
|
91 |
+
}else{
|
92 |
+
$this->content = $content;
|
93 |
+
}
|
94 |
+
|
95 |
+
}
|
96 |
+
|
97 |
+
|
98 |
+
}
|
classes/email/callbacks.php
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Callbacks functions used to hook in and replace default mailer at "caldera_forms_mailer"
|
5 |
+
*
|
6 |
+
* @package Caldera_Forms
|
7 |
+
* @author Josh Pollock <Josh@CalderaWP.com>
|
8 |
+
* @license GPL-2.0+
|
9 |
+
* @link
|
10 |
+
* @copyright 2016 CalderaWP LLC
|
11 |
+
*/
|
12 |
+
class Caldera_Forms_Email_Callbacks {
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Send email via SendGrid API
|
16 |
+
*
|
17 |
+
* @since 1.4.0
|
18 |
+
*
|
19 |
+
* @uses "caldera_forms_mailer"
|
20 |
+
*
|
21 |
+
* @param $mail
|
22 |
+
* @param $data
|
23 |
+
* @param $form
|
24 |
+
*
|
25 |
+
* @return mixed
|
26 |
+
*/
|
27 |
+
public static function sendgrid( $mail, $data, $form ){
|
28 |
+
$client = new Caldera_Forms_Email_SendGrid( $mail );
|
29 |
+
$key = Caldera_Forms_Email_Settings::get_key( 'sendgrid' );
|
30 |
+
if ( ! empty( $key ) ) {
|
31 |
+
$client->set_api( array( $key ) );
|
32 |
+
$response = $client->send();
|
33 |
+
if( in_array( $response, array( 202, 201, 200 ) ) ){
|
34 |
+
Caldera_Forms_Save_Final::after_send_email( $form, $data, true, $mail[ 'csv' ], $mail, 'sendgrid' );
|
35 |
+
//prevent send
|
36 |
+
return null;
|
37 |
+
}else{
|
38 |
+
/**
|
39 |
+
* Action documented in Caldera_Forms_Save_Final::after_send_email()
|
40 |
+
*/
|
41 |
+
do_action( 'caldera_forms_mailer_failed', $mail, $data, $form, 'sendgrid' );
|
42 |
+
//fallback to default
|
43 |
+
return $mail;
|
44 |
+
}
|
45 |
+
|
46 |
+
}
|
47 |
+
|
48 |
+
}
|
49 |
+
|
50 |
+
}
|
classes/email/client.php
ADDED
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Base class for email API clients
|
5 |
+
*
|
6 |
+
* @package Caldera_Forms
|
7 |
+
* @author Josh Pollock <Josh@CalderaWP.com>
|
8 |
+
* @license GPL-2.0+
|
9 |
+
* @link
|
10 |
+
* @copyright 2016 CalderaWP LLC
|
11 |
+
*/
|
12 |
+
abstract class Caldera_Forms_Email_Client implements Caldera_Forms_Email_Interface {
|
13 |
+
|
14 |
+
/**
|
15 |
+
* API object
|
16 |
+
*
|
17 |
+
* @since 1.4.0
|
18 |
+
*
|
19 |
+
* @var object
|
20 |
+
*/
|
21 |
+
protected $api;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Message details
|
25 |
+
*
|
26 |
+
* @since 1.4.0
|
27 |
+
*
|
28 |
+
* @var array
|
29 |
+
*/
|
30 |
+
protected $message;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Message attachments
|
34 |
+
*
|
35 |
+
* @since 1.4.0
|
36 |
+
*
|
37 |
+
* @var array
|
38 |
+
*/
|
39 |
+
protected $attachments;
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Caldera_Forms_Email_Client constructor.
|
43 |
+
*
|
44 |
+
* @since 1.4.0
|
45 |
+
*
|
46 |
+
* @param array $message Message details
|
47 |
+
*/
|
48 |
+
public function __construct( array $message ) {
|
49 |
+
$this->include_sdk();
|
50 |
+
|
51 |
+
$this->message = $message;
|
52 |
+
|
53 |
+
$this->prepare_attachments();
|
54 |
+
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Create Caldera_Forms_Email_Attachment objects
|
59 |
+
*
|
60 |
+
* @since 1.4.0
|
61 |
+
*/
|
62 |
+
public function prepare_attachments(){
|
63 |
+
if( ! empty( $this->message[ 'attachments' ] ) ) {
|
64 |
+
foreach ( $this->message['attachments'] as $attachment ) {
|
65 |
+
$obj = new Caldera_Forms_Email_Attachment( );
|
66 |
+
$obj->content = $attachment;
|
67 |
+
$this->attachments[] = $obj;
|
68 |
+
}
|
69 |
+
|
70 |
+
}
|
71 |
+
|
72 |
+
}
|
73 |
+
|
74 |
+
}
|
classes/email/interface.php
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Interface for email API clients
|
5 |
+
*
|
6 |
+
* @package Caldera_Forms
|
7 |
+
* @author Josh Pollock <Josh@CalderaWP.com>
|
8 |
+
* @license GPL-2.0+
|
9 |
+
* @link
|
10 |
+
* @copyright 2016 CalderaWP LLC
|
11 |
+
*/
|
12 |
+
interface Caldera_Forms_Email_Interface {
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Set API keys
|
16 |
+
*
|
17 |
+
* @since 1.4.0
|
18 |
+
*
|
19 |
+
* @param array $keys
|
20 |
+
*/
|
21 |
+
public function set_api( array $keys );
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Send email
|
25 |
+
*
|
26 |
+
* @since 1.4.0
|
27 |
+
*
|
28 |
+
* @return array|int Array of errors or status code
|
29 |
+
*/
|
30 |
+
public function send();
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Include SDK for API
|
34 |
+
*
|
35 |
+
* @since 1.4.0
|
36 |
+
*/
|
37 |
+
public function include_sdk();
|
38 |
+
|
39 |
+
}
|
classes/email/preview.php
ADDED
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Creates an email preview
|
5 |
+
*
|
6 |
+
* @package Caldera_Forms
|
7 |
+
* @author Josh Pollock <Josh@CalderaWP.com>
|
8 |
+
* @license GPL-2.0+
|
9 |
+
* @link
|
10 |
+
* @copyright 2016 CalderaWP LLC
|
11 |
+
*/
|
12 |
+
class Caldera_Forms_Email_Preview implements JsonSerializable {
|
13 |
+
|
14 |
+
/**
|
15 |
+
* The mail data
|
16 |
+
*
|
17 |
+
* @since 1.4.0
|
18 |
+
*
|
19 |
+
* @var array
|
20 |
+
*/
|
21 |
+
protected $mail;
|
22 |
+
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Caldera_Forms_Email_Preview constructor.
|
26 |
+
*
|
27 |
+
* @since 1.4.0
|
28 |
+
*
|
29 |
+
* @param array $mail Mail data
|
30 |
+
*/
|
31 |
+
public function __construct( $mail ){
|
32 |
+
$this->mail = $mail;
|
33 |
+
|
34 |
+
}
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Get content type
|
38 |
+
*
|
39 |
+
* @since 1.4.0
|
40 |
+
*
|
41 |
+
* @return string
|
42 |
+
*/
|
43 |
+
public function content_type(){
|
44 |
+
if( isset( $this->mail[ 'html' ] ) && $this->mail[ 'html' ] ){
|
45 |
+
return 'text/html';
|
46 |
+
}
|
47 |
+
|
48 |
+
return 'text/plain';
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Get email headers
|
53 |
+
*
|
54 |
+
* @since 1.4.0
|
55 |
+
*
|
56 |
+
* @return array
|
57 |
+
*/
|
58 |
+
public function headers(){
|
59 |
+
$headers = array();
|
60 |
+
$headers[ 'recipients' ] = $this->mail[ 'recipients' ];
|
61 |
+
$headers[ 'subject' ] = $this->mail[ 'subject' ];
|
62 |
+
$headers[ 'all' ] = $this->mail[ 'headers' ];
|
63 |
+
|
64 |
+
return $headers;
|
65 |
+
}
|
66 |
+
|
67 |
+
/**
|
68 |
+
* Get the email message
|
69 |
+
*
|
70 |
+
* @since 1.4.0
|
71 |
+
*
|
72 |
+
* @return string
|
73 |
+
*/
|
74 |
+
public function body(){
|
75 |
+
if( isset( $this->mail[ 'message' ] ) ){
|
76 |
+
return $this->mail[ 'message' ];
|
77 |
+
}
|
78 |
+
|
79 |
+
return '';
|
80 |
+
}
|
81 |
+
|
82 |
+
/**
|
83 |
+
* @inheritdoc
|
84 |
+
*/
|
85 |
+
public function jsonSerialize() {
|
86 |
+
return array(
|
87 |
+
'headers' => $this->headers(),
|
88 |
+
'message' => $this->body(),
|
89 |
+
'content-type' => $this->content_type()
|
90 |
+
|
91 |
+
);
|
92 |
+
|
93 |
+
}
|
94 |
+
|
95 |
+
}
|
classes/email/previews.php
ADDED
@@ -0,0 +1,160 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Manages an email preview
|
5 |
+
*
|
6 |
+
* @package Caldera_Forms
|
7 |
+
* @author Josh Pollock <Josh@CalderaWP.com>
|
8 |
+
* @license GPL-2.0+
|
9 |
+
* @link
|
10 |
+
* @copyright 2016 CalderaWP LLC
|
11 |
+
*/
|
12 |
+
class Caldera_Forms_Email_Previews {
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Form ID
|
16 |
+
*
|
17 |
+
* @since 1.4.0
|
18 |
+
*
|
19 |
+
* @var null|string
|
20 |
+
*/
|
21 |
+
protected $id;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Caldera_Forms_Email_Previews constructor.
|
25 |
+
*
|
26 |
+
* @param null|string $id Optional. Form ID
|
27 |
+
* @param bool $view Optional. Whether to view (true) or record (false) the preview. Default is false.
|
28 |
+
*/
|
29 |
+
public function __construct( $id = null, $view = false ) {
|
30 |
+
if( $view && null != $id ){
|
31 |
+
$this->id = $id;
|
32 |
+
$this->view();
|
33 |
+
}else{
|
34 |
+
add_filter( 'caldera_forms_mailer', array( $this, 'maybe_create_preview' ), 10, 3 );
|
35 |
+
}
|
36 |
+
|
37 |
+
|
38 |
+
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Display email preview
|
43 |
+
*
|
44 |
+
* @since 1.4.0
|
45 |
+
*/
|
46 |
+
public function view(){
|
47 |
+
if ( isset( $this->id ) ) {
|
48 |
+
$preview = $this->get_saved( $this->id );
|
49 |
+
if ( is_object( $preview ) && ! empty( $preview ) ) {
|
50 |
+
$headers = $this->format_headers( $preview->headers );
|
51 |
+
$message = $preview->message;
|
52 |
+
include CFCORE_PATH . 'ui/emails/email-preview.php';
|
53 |
+
exit;
|
54 |
+
}else{
|
55 |
+
wp_die( esc_html__( 'There is no saved email preview. Please submit this form with email previewing on and then try again.', 'caldera-forms' ) );
|
56 |
+
}
|
57 |
+
|
58 |
+
}
|
59 |
+
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Format header view
|
64 |
+
*
|
65 |
+
* Create UL markup from array
|
66 |
+
*
|
67 |
+
* @since 1.4.0
|
68 |
+
*
|
69 |
+
* @param $headers
|
70 |
+
*
|
71 |
+
* @return string
|
72 |
+
*/
|
73 |
+
public function format_headers( $headers ){
|
74 |
+
$view = array();
|
75 |
+
$pattern = '<li><pre>%s</pre>: <span>%s</span></li>';
|
76 |
+
foreach ( $headers as $header => $value ){
|
77 |
+
if ( is_string( $value ) ){
|
78 |
+
$view[ $header ] = sprintf( $pattern, ucwords( $header ), htmlentities( $value ) );
|
79 |
+
}else{
|
80 |
+
$view[ $header ] = sprintf( $pattern, ucwords( $header ), $this->format_headers( $value ) );
|
81 |
+
}
|
82 |
+
|
83 |
+
}
|
84 |
+
|
85 |
+
return sprintf( '<ul>%s</ul>', implode( $view ) );
|
86 |
+
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
* If preview should be recorded, record
|
90 |
+
*
|
91 |
+
* @since 1.4.0
|
92 |
+
*
|
93 |
+
* @uses "caldera_forms_mailer" filter
|
94 |
+
*
|
95 |
+
* @param array $mail
|
96 |
+
* @param array $data
|
97 |
+
* @param array $form
|
98 |
+
*
|
99 |
+
* @return array
|
100 |
+
*/
|
101 |
+
public function maybe_create_preview( $mail, $data, $form ){
|
102 |
+
if( ! empty( $form[ 'mailer' ][ 'preview_email' ] ) ){
|
103 |
+
$this->id = $form[ 'ID' ];
|
104 |
+
$preview = new Caldera_Forms_Email_Preview( $mail );
|
105 |
+
$this->record( $preview );
|
106 |
+
}
|
107 |
+
|
108 |
+
return $mail;
|
109 |
+
}
|
110 |
+
|
111 |
+
/**
|
112 |
+
* Get saved preview as stdClass
|
113 |
+
*
|
114 |
+
* @param null|string $id Optional. Form ID. By default $this->id is used. Pass ID here to reset that property.
|
115 |
+
*
|
116 |
+
* @return bool|object
|
117 |
+
*/
|
118 |
+
public function get_saved( $id = null ){
|
119 |
+
if( is_string( $id ) ){
|
120 |
+
$this->id = $id;
|
121 |
+
}
|
122 |
+
|
123 |
+
$_preview = get_option( $this->key() );
|
124 |
+
if( ! empty( $_preview ) && is_object( $preview = json_decode( $_preview ) ) ){
|
125 |
+
return $preview;
|
126 |
+
}else{
|
127 |
+
return false;
|
128 |
+
}
|
129 |
+
|
130 |
+
}
|
131 |
+
|
132 |
+
/**
|
133 |
+
* Save preview
|
134 |
+
*
|
135 |
+
* @since 1.4.0
|
136 |
+
*
|
137 |
+
* @param Caldera_Forms_Email_Preview $preview Preview object
|
138 |
+
*/
|
139 |
+
protected function record( Caldera_Forms_Email_Preview $preview ){
|
140 |
+
if ( false == get_option( $this->key( ) ) ){
|
141 |
+
add_option( $this->key(), wp_json_encode( $preview ), false );
|
142 |
+
}else{
|
143 |
+
update_option( $this->key(), wp_json_encode( $preview ), false );
|
144 |
+
}
|
145 |
+
|
146 |
+
}
|
147 |
+
|
148 |
+
/**
|
149 |
+
* Option key
|
150 |
+
*
|
151 |
+
* @since 1.4.0
|
152 |
+
*
|
153 |
+
* @return string
|
154 |
+
*/
|
155 |
+
protected function key( ){
|
156 |
+
return '__cf_email_preview_' . $this->id;
|
157 |
+
|
158 |
+
}
|
159 |
+
|
160 |
+
}
|
classes/email/sendgrid.php
ADDED
@@ -0,0 +1,177 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* API Client for sending Caldera Forms emails via SendGrid
|
4 |
+
*
|
5 |
+
* @package Caldera_Forms
|
6 |
+
* @author Josh Pollock <Josh@CalderaWP.com>
|
7 |
+
* @license GPL-2.0+
|
8 |
+
* @link
|
9 |
+
* @copyright 2016 CalderaWP LLC
|
10 |
+
*/
|
11 |
+
|
12 |
+
use \SendGrid\Mail;
|
13 |
+
use \SendGrid\Email;
|
14 |
+
use \SendGrid\Personalization;
|
15 |
+
use \SendGrid\Content;
|
16 |
+
use \SendGrid\Attachment;
|
17 |
+
use \SendGrid\TrackingSettings;
|
18 |
+
use \SendGrid\ClickTracking;
|
19 |
+
use \SendGrid\OpenTracking;
|
20 |
+
use \SendGrid\ReplyTo;
|
21 |
+
|
22 |
+
class Caldera_Forms_Email_SendGrid extends Caldera_Forms_Email_Client{
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Track emails we are sending to
|
26 |
+
*
|
27 |
+
* SendGrid will not let you send to same address twice
|
28 |
+
*
|
29 |
+
* @since 1.4.0
|
30 |
+
*
|
31 |
+
* @var array
|
32 |
+
*/
|
33 |
+
protected $sent_to = array();
|
34 |
+
|
35 |
+
/**
|
36 |
+
* @inheritdoc
|
37 |
+
*/
|
38 |
+
public function include_sdk() {
|
39 |
+
include_once __DIR__ . '/sendgrid/sendgrid-php.php';
|
40 |
+
}
|
41 |
+
|
42 |
+
/**
|
43 |
+
* @inheritdoc
|
44 |
+
*/
|
45 |
+
public function set_api( array $keys ){
|
46 |
+
$options = array(
|
47 |
+
'raise_exceptions' => true
|
48 |
+
);
|
49 |
+
|
50 |
+
if( ! is_ssl() ){
|
51 |
+
$options[ 'turn_off_ssl_verification' ] = true;
|
52 |
+
}
|
53 |
+
|
54 |
+
$options = apply_filters( 'caldera_forms_sendgrid_options', $options );
|
55 |
+
|
56 |
+
$this->api = new \SendGrid( $keys[0], $options );
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* @inheritdoc
|
61 |
+
*/
|
62 |
+
public function send(){
|
63 |
+
$mail = new Mail();
|
64 |
+
|
65 |
+
$email = $this->create_email( $this->message[ 'from' ], $this->message[ 'from_name' ], false );
|
66 |
+
$mail->setFrom( $email );
|
67 |
+
|
68 |
+
$mail->setSubject( $this->message[ 'subject' ] );
|
69 |
+
$personalization = new \SendGrid\Personalization();
|
70 |
+
|
71 |
+
foreach ( $this->message[ 'recipients' ] as $recipient ){
|
72 |
+
|
73 |
+
if( ! is_email( $recipient ) ){
|
74 |
+
$open = strpos( $recipient, '<' );
|
75 |
+
$close = strpos( $recipient, '>' );
|
76 |
+
$length = strlen( $recipient );
|
77 |
+
if( is_numeric( $open ) && $length - 1 == $close ){
|
78 |
+
$recipient = substr( $recipient, $open + 1, $close);
|
79 |
+
$recipient = str_replace( array( '<', '>' ), '', $recipient );
|
80 |
+
}
|
81 |
+
|
82 |
+
}
|
83 |
+
|
84 |
+
if ( is_email( $recipient ) ) {
|
85 |
+
$email = $this->create_email( $recipient );
|
86 |
+
if ( is_object( $email ) ) {
|
87 |
+
$personalization->addTo( $email );
|
88 |
+
}
|
89 |
+
}
|
90 |
+
}
|
91 |
+
|
92 |
+
if( ! empty( $this->message[ 'bcc' ] ) && is_email( $this->message[ 'bcc' ] ) ){
|
93 |
+
$email = $this->create_email( $this->message[ 'bcc' ] );
|
94 |
+
if ( is_object( $email ) ) {
|
95 |
+
$personalization->addTo( $email );
|
96 |
+
}
|
97 |
+
|
98 |
+
}
|
99 |
+
|
100 |
+
$mail->addPersonalization( $personalization );
|
101 |
+
|
102 |
+
$content = new Content("text/html", $this->message[ 'message' ] );
|
103 |
+
|
104 |
+
$mail->addContent( $content );
|
105 |
+
|
106 |
+
if( ! empty( $this->attachments ) ){
|
107 |
+
/* @var Caldera_Forms_Email_Attachment $cf_attachment_obj */
|
108 |
+
foreach ( $this->attachments as $cf_attachment_obj ) {
|
109 |
+
$attachment = new Attachment();
|
110 |
+
$attachment->setContent( $cf_attachment_obj->get_encoded() );
|
111 |
+
$attachment->setType( $cf_attachment_obj->type );
|
112 |
+
$attachment->setFilename( $cf_attachment_obj->filename );
|
113 |
+
$attachment->setDisposition( 'attachment' );
|
114 |
+
$attachment->setContentId( md5( $cf_attachment_obj->filename ) );
|
115 |
+
$mail->addAttachment( $attachment );
|
116 |
+
}
|
117 |
+
|
118 |
+
}
|
119 |
+
|
120 |
+
$tracking_settings = new \SendGrid\TrackingSettings();
|
121 |
+
$click_tracking = new ClickTracking();
|
122 |
+
$click_tracking->setEnable( true );
|
123 |
+
$click_tracking->setEnableText( true );
|
124 |
+
$tracking_settings->setClickTracking( $click_tracking );
|
125 |
+
$open_tracking = new OpenTracking();
|
126 |
+
$open_tracking->setEnable(true);
|
127 |
+
$tracking_settings->setOpenTracking( $open_tracking );
|
128 |
+
$mail->setTrackingSettings( $tracking_settings );
|
129 |
+
|
130 |
+
if( ! empty( $this->message[ 'replyto' ] ) && is_email( $this->message[ 'replyto' ] ) ){
|
131 |
+
$reply_to = new ReplyTo( $this->message[ 'replyto' ] );
|
132 |
+
$mail->setReplyTo ($reply_to );
|
133 |
+
}
|
134 |
+
|
135 |
+
$mail = apply_filters( 'caldera_forms_sendgrid_before', $mail, $this->message );
|
136 |
+
|
137 |
+
//@TODO Caldera Exception
|
138 |
+
try {
|
139 |
+
/** @var \SendGrid\Response $response */
|
140 |
+
$response = $this->api->client->mail()->send()->post( $mail );
|
141 |
+
return $response->statusCode();
|
142 |
+
} catch(\SendGrid\Exception $e) {
|
143 |
+
$errors[] = $e->getCode();
|
144 |
+
foreach($e->getErrors() as $er) {
|
145 |
+
$errors[] = $er;
|
146 |
+
}
|
147 |
+
return $errors;
|
148 |
+
}
|
149 |
+
}
|
150 |
+
|
151 |
+
/**
|
152 |
+
* Creates SendGrid email object
|
153 |
+
*
|
154 |
+
* Main reason for this is to prevent adding duplicated send tos, which will cause API error.
|
155 |
+
*
|
156 |
+
* @since 1.4.0
|
157 |
+
*
|
158 |
+
* @param string $address Email address to send to.
|
159 |
+
* @param string|null $name Optional. Name of who sending to. Default is null.
|
160 |
+
* @param bool $prevent_double Optional. If true, prevent duplicates by returing false. Default is true.
|
161 |
+
*
|
162 |
+
* @return Email
|
163 |
+
*/
|
164 |
+
protected function create_email( $address, $name = null, $prevent_double = true ){
|
165 |
+
if ( is_email( $address ) ) {
|
166 |
+
if ( false == $prevent_double || ! in_array( $address, $this->sent_to ) ) {
|
167 |
+
$this->sent_to[] = $address;
|
168 |
+
return new Email( $name, $address );
|
169 |
+
|
170 |
+
}
|
171 |
+
|
172 |
+
}
|
173 |
+
|
174 |
+
|
175 |
+
}
|
176 |
+
|
177 |
+
}
|
classes/email/sendgrid/lib/SendGrid.php
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This library allows you to quickly and easily send emails through SendGrid using PHP.
|
4 |
+
*
|
5 |
+
* PHP version 5.3
|
6 |
+
*
|
7 |
+
* @author Elmer Thomas <dx@sendgrid.com>
|
8 |
+
* @copyright 2016 SendGrid
|
9 |
+
* @license https://opensource.org/licenses/MIT The MIT License
|
10 |
+
* @version GIT: <git_id>
|
11 |
+
* @link http://packagist.org/packages/sendgrid/sendgrid
|
12 |
+
*/
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Interface to the SendGrid Web API
|
16 |
+
*/
|
17 |
+
class SendGrid
|
18 |
+
{
|
19 |
+
const VERSION = '5.0.1';
|
20 |
+
|
21 |
+
protected
|
22 |
+
$namespace = 'SendGrid';
|
23 |
+
|
24 |
+
public
|
25 |
+
$client,
|
26 |
+
$version = self::VERSION;
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Setup the HTTP Client
|
30 |
+
*
|
31 |
+
* @param string $apiKey your SendGrid API Key.
|
32 |
+
* @param array $options an array of options, currenlty only "host" is implemented.
|
33 |
+
*/
|
34 |
+
public function __construct($apiKey, $options = array())
|
35 |
+
{
|
36 |
+
$headers = array(
|
37 |
+
'Authorization: Bearer '.$apiKey,
|
38 |
+
'User-Agent: sendgrid/' . $this->version . ';php'
|
39 |
+
);
|
40 |
+
$host = isset($options['host']) ? $options['host'] : 'https://api.sendgrid.com';
|
41 |
+
$this->client = new \SendGrid\Client($host, $headers, '/v3', null);
|
42 |
+
}
|
43 |
+
}
|
classes/email/sendgrid/lib/helpers/mail/Mail.php
ADDED
@@ -0,0 +1,1125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This helper builds the request body for a /mail/send API call.
|
4 |
+
*
|
5 |
+
* PHP version 5.3
|
6 |
+
*
|
7 |
+
* @author Elmer Thomas <dx@sendgrid.com>
|
8 |
+
* @copyright 2016 SendGrid
|
9 |
+
* @license https://opensource.org/licenses/MIT The MIT License
|
10 |
+
* @version GIT: <git_id>
|
11 |
+
* @link http://packagist.org/packages/sendgrid/sendgrid
|
12 |
+
*/
|
13 |
+
namespace SendGrid;
|
14 |
+
|
15 |
+
class ReplyTo implements \jsonSerializable
|
16 |
+
{
|
17 |
+
private
|
18 |
+
$email;
|
19 |
+
|
20 |
+
public function __construct($email)
|
21 |
+
{
|
22 |
+
$this->email = $email;
|
23 |
+
}
|
24 |
+
|
25 |
+
public function setEmail($email)
|
26 |
+
{
|
27 |
+
$this->email = $email;
|
28 |
+
}
|
29 |
+
|
30 |
+
public function getEmail()
|
31 |
+
{
|
32 |
+
return $this->email;
|
33 |
+
}
|
34 |
+
|
35 |
+
public function jsonSerialize()
|
36 |
+
{
|
37 |
+
return array_filter(
|
38 |
+
[
|
39 |
+
'email' => $this->getEmail()
|
40 |
+
]
|
41 |
+
);
|
42 |
+
}
|
43 |
+
}
|
44 |
+
|
45 |
+
class ClickTracking implements \jsonSerializable
|
46 |
+
{
|
47 |
+
private
|
48 |
+
$enable,
|
49 |
+
$enable_text;
|
50 |
+
|
51 |
+
public function setEnable($enable)
|
52 |
+
{
|
53 |
+
$this->enable = $enable;
|
54 |
+
}
|
55 |
+
|
56 |
+
public function getEnable()
|
57 |
+
{
|
58 |
+
return $this->enable;
|
59 |
+
}
|
60 |
+
|
61 |
+
public function setEnableText($enable_text)
|
62 |
+
{
|
63 |
+
$this->enable_text = $enable_text;
|
64 |
+
}
|
65 |
+
|
66 |
+
public function getEnableText()
|
67 |
+
{
|
68 |
+
return $this->enable_text;
|
69 |
+
}
|
70 |
+
|
71 |
+
public function jsonSerialize()
|
72 |
+
{
|
73 |
+
return array_filter(
|
74 |
+
[
|
75 |
+
'enable' => $this->getEnable(),
|
76 |
+
'enable_text' => $this->getEnableText()
|
77 |
+
]
|
78 |
+
);
|
79 |
+
}
|
80 |
+
}
|
81 |
+
|
82 |
+
class OpenTracking implements \jsonSerializable
|
83 |
+
{
|
84 |
+
private
|
85 |
+
$enable,
|
86 |
+
$substitution_tag;
|
87 |
+
|
88 |
+
public function setEnable($enable)
|
89 |
+
{
|
90 |
+
$this->enable = $enable;
|
91 |
+
}
|
92 |
+
|
93 |
+
public function getEnable()
|
94 |
+
{
|
95 |
+
return $this->enable;
|
96 |
+
}
|
97 |
+
|
98 |
+
public function setSubstitutionTag($substitution_tag)
|
99 |
+
{
|
100 |
+
$this->substitution_tag = $substitution_tag;
|
101 |
+
}
|
102 |
+
|
103 |
+
public function getSubstitutionTag()
|
104 |
+
{
|
105 |
+
return $this->substitution_tag;
|
106 |
+
}
|
107 |
+
|
108 |
+
public function jsonSerialize()
|
109 |
+
{
|
110 |
+
return array_filter(
|
111 |
+
[
|
112 |
+
'enable' => $this->getEnable(),
|
113 |
+
'substitution_tag' => $this->getSubstitutionTag()
|
114 |
+
]
|
115 |
+
);
|
116 |
+
}
|
117 |
+
}
|
118 |
+
|
119 |
+
class SubscriptionTracking implements \jsonSerializable
|
120 |
+
{
|
121 |
+
private
|
122 |
+
$enable,
|
123 |
+
$text,
|
124 |
+
$html,
|
125 |
+
$substitution_tag;
|
126 |
+
|
127 |
+
public function setEnable($enable)
|
128 |
+
{
|
129 |
+
$this->enable = $enable;
|
130 |
+
}
|
131 |
+
|
132 |
+
public function getEnable()
|
133 |
+
{
|
134 |
+
return $this->enable;
|
135 |
+
}
|
136 |
+
|
137 |
+
public function setText($text)
|
138 |
+
{
|
139 |
+
$this->text = $text;
|
140 |
+
}
|
141 |
+
|
142 |
+
public function getText()
|
143 |
+
{
|
144 |
+
return $this->text;
|
145 |
+
}
|
146 |
+
|
147 |
+
public function setHtml($html)
|
148 |
+
{
|
149 |
+
$this->html = $html;
|
150 |
+
}
|
151 |
+
|
152 |
+
public function getHtml()
|
153 |
+
{
|
154 |
+
return $this->html;
|
155 |
+
}
|
156 |
+
|
157 |
+
public function setSubstitutionTag($substitution_tag)
|
158 |
+
{
|
159 |
+
$this->substitution_tag = $substitution_tag;
|
160 |
+
}
|
161 |
+
|
162 |
+
public function getSubstitutionTag()
|
163 |
+
{
|
164 |
+
return $this->substitution_tag;
|
165 |
+
}
|
166 |
+
|
167 |
+
public function jsonSerialize()
|
168 |
+
{
|
169 |
+
return array_filter(
|
170 |
+
[
|
171 |
+
'enable' => $this->getEnable(),
|
172 |
+
'text' => $this->getText(),
|
173 |
+
'html' => $this->getHtml(),
|
174 |
+
'substitution_tag' => $this->getSubstitutionTag()
|
175 |
+
]
|
176 |
+
);
|
177 |
+
}
|
178 |
+
}
|
179 |
+
|
180 |
+
class Ganalytics implements \jsonSerializable
|
181 |
+
{
|
182 |
+
private
|
183 |
+
$enable,
|
184 |
+
$utm_source,
|
185 |
+
$utm_medium,
|
186 |
+
$utm_term,
|
187 |
+
$utm_content,
|
188 |
+
$utm_campaign;
|
189 |
+
|
190 |
+
public function setEnable($enable)
|
191 |
+
{
|
192 |
+
$this->enable = $enable;
|
193 |
+
}
|
194 |
+
|
195 |
+
public function getEnable()
|
196 |
+
{
|
197 |
+
return $this->enable;
|
198 |
+
}
|
199 |
+
|
200 |
+
public function setCampaignSource($utm_source)
|
201 |
+
{
|
202 |
+
$this->utm_source = $utm_source;
|
203 |
+
}
|
204 |
+
|
205 |
+
public function getCampaignSource()
|
206 |
+
{
|
207 |
+
return $this->utm_source;
|
208 |
+
}
|
209 |
+
|
210 |
+
public function setCampaignMedium($utm_medium)
|
211 |
+
{
|
212 |
+
$this->utm_medium = $utm_medium;
|
213 |
+
}
|
214 |
+
|
215 |
+
public function getCampaignMedium()
|
216 |
+
{
|
217 |
+
return $this->utm_medium;
|
218 |
+
}
|
219 |
+
|
220 |
+
public function setCampaignTerm($utm_term)
|
221 |
+
{
|
222 |
+
$this->utm_term = $utm_term;
|
223 |
+
}
|
224 |
+
|
225 |
+
public function getCampaignTerm()
|
226 |
+
{
|
227 |
+
return $this->utm_term;
|
228 |
+
}
|
229 |
+
|
230 |
+
public function setCampaignContent($utm_content)
|
231 |
+
{
|
232 |
+
$this->utm_content = $utm_content;
|
233 |
+
}
|
234 |
+
|
235 |
+
public function getCampaignContent()
|
236 |
+
{
|
237 |
+
return $this->utm_content;
|
238 |
+
}
|
239 |
+
|
240 |
+
public function setCampaignName($utm_campaign)
|
241 |
+
{
|
242 |
+
$this->utm_campaign = $utm_campaign;
|
243 |
+
}
|
244 |
+
|
245 |
+
public function getCampaignName()
|
246 |
+
{
|
247 |
+
return $this->utm_campaign;
|
248 |
+
}
|
249 |
+
|
250 |
+
public function jsonSerialize()
|
251 |
+
{
|
252 |
+
return array_filter(
|
253 |
+
[
|
254 |
+
'enable' => $this->getEnable(),
|
255 |
+
'utm_source' => $this->getCampaignSource(),
|
256 |
+
'utm_medium' => $this->getCampaignMedium(),
|
257 |
+
'utm_term' => $this->getCampaignTerm(),
|
258 |
+
'utm_content' => $this->getCampaignContent(),
|
259 |
+
'utm_campaign' => $this->getCampaignName()
|
260 |
+
]
|
261 |
+
);
|
262 |
+
}
|
263 |
+
}
|
264 |
+
|
265 |
+
class TrackingSettings implements \jsonSerializable
|
266 |
+
{
|
267 |
+
private
|
268 |
+
$click_tracking,
|
269 |
+
$open_tracking,
|
270 |
+
$subscription_tracking,
|
271 |
+
$ganalytics;
|
272 |
+
|
273 |
+
public function setClickTracking($click_tracking)
|
274 |
+
{
|
275 |
+
$this->click_tracking = $click_tracking;
|
276 |
+
}
|
277 |
+
|
278 |
+
public function getClickTracking()
|
279 |
+
{
|
280 |
+
return $this->click_tracking;
|
281 |
+
}
|
282 |
+
|
283 |
+
public function setOpenTracking($open_tracking)
|
284 |
+
{
|
285 |
+
$this->open_tracking = $open_tracking;
|
286 |
+
}
|
287 |
+
|
288 |
+
public function getOpenTracking()
|
289 |
+
{
|
290 |
+
return $this->open_tracking;
|
291 |
+
}
|
292 |
+
|
293 |
+
public function setSubscriptionTracking($subscription_tracking)
|
294 |
+
{
|
295 |
+
$this->subscription_tracking = $subscription_tracking;
|
296 |
+
}
|
297 |
+
|
298 |
+
public function getSubscriptionTracking()
|
299 |
+
{
|
300 |
+
return $this->subscription_tracking;
|
301 |
+
}
|
302 |
+
|
303 |
+
public function setGanalytics($ganalytics)
|
304 |
+
{
|
305 |
+
$this->ganalytics = $ganalytics;
|
306 |
+
}
|
307 |
+
|
308 |
+
public function getGanalytics()
|
309 |
+
{
|
310 |
+
return $this->ganalytics;
|
311 |
+
}
|
312 |
+
|
313 |
+
public function jsonSerialize()
|
314 |
+
{
|
315 |
+
return array_filter(
|
316 |
+
[
|
317 |
+
'click_tracking' => $this->getClickTracking(),
|
318 |
+
'open_tracking' => $this->getOpenTracking(),
|
319 |
+
'subscription_tracking' => $this->getSubscriptionTracking(),
|
320 |
+
'ganalytics' => $this->getGanalytics()
|
321 |
+
]
|
322 |
+
);
|
323 |
+
}
|
324 |
+
}
|
325 |
+
|
326 |
+
class BccSettings implements \jsonSerializable
|
327 |
+
{
|
328 |
+
private
|
329 |
+
$enable,
|
330 |
+
$email;
|
331 |
+
|
332 |
+
public function setEnable($enable)
|
333 |
+
{
|
334 |
+
$this->enable = $enable;
|
335 |
+
}
|
336 |
+
|
337 |
+
public function getEnable()
|
338 |
+
{
|
339 |
+
return $this->enable;
|
340 |
+
}
|
341 |
+
|
342 |
+
public function setEmail($email)
|
343 |
+
{
|
344 |
+
$this->email = $email;
|
345 |
+
}
|
346 |
+
|
347 |
+
public function getEmail()
|
348 |
+
{
|
349 |
+
return $this->email;
|
350 |
+
}
|
351 |
+
|
352 |
+
public function jsonSerialize()
|
353 |
+
{
|
354 |
+
return array_filter(
|
355 |
+
[
|
356 |
+
'enable' => $this->getEnable(),
|
357 |
+
'email' => $this->getEmail()
|
358 |
+
]
|
359 |
+
);
|
360 |
+
}
|
361 |
+
}
|
362 |
+
|
363 |
+
class BypassListManagement implements \jsonSerializable
|
364 |
+
{
|
365 |
+
private
|
366 |
+
$enable;
|
367 |
+
|
368 |
+
public function setEnable($enable)
|
369 |
+
{
|
370 |
+
$this->enable = $enable;
|
371 |
+
}
|
372 |
+
|
373 |
+
public function getEnable()
|
374 |
+
{
|
375 |
+
return $this->enable;
|
376 |
+
}
|
377 |
+
|
378 |
+
public function jsonSerialize()
|
379 |
+
{
|
380 |
+
return array_filter(
|
381 |
+
[
|
382 |
+
'enable' => $this->getEnable()
|
383 |
+
]
|
384 |
+
);
|
385 |
+
}
|
386 |
+
}
|
387 |
+
|
388 |
+
class Footer implements \jsonSerializable
|
389 |
+
{
|
390 |
+
private
|
391 |
+
$enable,
|
392 |
+
$text,
|
393 |
+
$html;
|
394 |
+
|
395 |
+
public function setEnable($enable)
|
396 |
+
{
|
397 |
+
$this->enable = $enable;
|
398 |
+
}
|
399 |
+
|
400 |
+
public function getEnable()
|
401 |
+
{
|
402 |
+
return $this->enable;
|
403 |
+
}
|
404 |
+
|
405 |
+
public function setText($text)
|
406 |
+
{
|
407 |
+
$this->text = $text;
|
408 |
+
}
|
409 |
+
|
410 |
+
public function getText()
|
411 |
+
{
|
412 |
+
return $this->text;
|
413 |
+
}
|
414 |
+
|
415 |
+
public function setHtml($html)
|
416 |
+
{
|
417 |
+
$this->html = $html;
|
418 |
+
}
|
419 |
+
|
420 |
+
public function getHtml()
|
421 |
+
{
|
422 |
+
return $this->html;
|
423 |
+
}
|
424 |
+
|
425 |
+
public function jsonSerialize()
|
426 |
+
{
|
427 |
+
return array_filter(
|
428 |
+
[
|
429 |
+
'enable' => $this->getEnable(),
|
430 |
+
'text' => $this->getText(),
|
431 |
+
'html' => $this->getHtml()
|
432 |
+
]
|
433 |
+
);
|
434 |
+
}
|
435 |
+
}
|
436 |
+
|
437 |
+
class SandBoxMode implements \jsonSerializable
|
438 |
+
{
|
439 |
+
private
|
440 |
+
$enable;
|
441 |
+
|
442 |
+
public function setEnable($enable)
|
443 |
+
{
|
444 |
+
$this->enable = $enable;
|
445 |
+
}
|
446 |
+
|
447 |
+
public function getEnable()
|
448 |
+
{
|
449 |
+
return $this->enable;
|
450 |
+
}
|
451 |
+
public function jsonSerialize()
|
452 |
+
{
|
453 |
+
return array_filter(
|
454 |
+
[
|
455 |
+
'enable' => $this->getEnable()
|
456 |
+
]
|
457 |
+
);
|
458 |
+
}
|
459 |
+
}
|
460 |
+
|
461 |
+
class SpamCheck implements \jsonSerializable
|
462 |
+
{
|
463 |
+
private
|
464 |
+
$enable,
|
465 |
+
$threshold,
|
466 |
+
$post_to_url;
|
467 |
+
|
468 |
+
public function setEnable($enable)
|
469 |
+
{
|
470 |
+
$this->enable = $enable;
|
471 |
+
}
|
472 |
+
|
473 |
+
public function getEnable()
|
474 |
+
{
|
475 |
+
return $this->enable;
|
476 |
+
}
|
477 |
+
|
478 |
+
public function setThreshold($threshold)
|
479 |
+
{
|
480 |
+
$this->threshold = $threshold;
|
481 |
+
}
|
482 |
+
|
483 |
+
public function getThreshold()
|
484 |
+
{
|
485 |
+
return $this->threshold;
|
486 |
+
}
|
487 |
+
|
488 |
+
public function setPostToUrl($post_to_url)
|
489 |
+
{
|
490 |
+
$this->post_to_url = $post_to_url;
|
491 |
+
}
|
492 |
+
|
493 |
+
public function getPostToUrl()
|
494 |
+
{
|
495 |
+
return $this->post_to_url;
|
496 |
+
}
|
497 |
+
|
498 |
+
public function jsonSerialize()
|
499 |
+
{
|
500 |
+
return array_filter(
|
501 |
+
[
|
502 |
+
'enable' => $this->getEnable(),
|
503 |
+
'threshold' => $this->getThreshold(),
|
504 |
+
'post_to_url' => $this->getPostToUrl()
|
505 |
+
]
|
506 |
+
);
|
507 |
+
}
|
508 |
+
}
|
509 |
+
|
510 |
+
class MailSettings implements \jsonSerializable
|
511 |
+
{
|
512 |
+
private
|
513 |
+
$bcc,
|
514 |
+
$bypass_list_management,
|
515 |
+
$footer,
|
516 |
+
$sandbox_mode,
|
517 |
+
$spam_check;
|
518 |
+
|
519 |
+
public function setBccSettings($bcc)
|
520 |
+
{
|
521 |
+
$this->bcc = $bcc;
|
522 |
+
}
|
523 |
+
|
524 |
+
public function getBccSettings()
|
525 |
+
{
|
526 |
+
return $this->bcc;
|
527 |
+
}
|
528 |
+
|
529 |
+
public function setBypassListManagement($bypass_list_management)
|
530 |
+
{
|
531 |
+
$this->bypass_list_management = $bypass_list_management;
|
532 |
+
}
|
533 |
+
|
534 |
+
public function getBypassListManagement()
|
535 |
+
{
|
536 |
+
return $this->bypass_list_management;
|
537 |
+
}
|
538 |
+
|
539 |
+
public function setFooter($footer)
|
540 |
+
{
|
541 |
+
$this->footer = $footer;
|
542 |
+
}
|
543 |
+
|
544 |
+
public function getFooter()
|
545 |
+
{
|
546 |
+
return $this->footer;
|
547 |
+
}
|
548 |
+
|
549 |
+
public function setSandboxMode($sandbox_mode)
|
550 |
+
{
|
551 |
+
$this->sandbox_mode = $sandbox_mode;
|
552 |
+
}
|
553 |
+
|
554 |
+
public function getSandboxMode()
|
555 |
+
{
|
556 |
+
return $this->sandbox_mode;
|
557 |
+
}
|
558 |
+
|
559 |
+
public function setSpamCheck($spam_check)
|
560 |
+
{
|
561 |
+
$this->spam_check = $spam_check;
|
562 |
+
}
|
563 |
+
|
564 |
+
public function getSpamCheck()
|
565 |
+
{
|
566 |
+
return $this->spam_check;
|
567 |
+
}
|
568 |
+
|
569 |
+
public function jsonSerialize()
|
570 |
+
{
|
571 |
+
return array_filter(
|
572 |
+
[
|
573 |
+
'bcc' => $this->getBccSettings(),
|
574 |
+
'bypass_list_management' => $this->getBypassListManagement(),
|
575 |
+
'footer' => $this->getFooter(),
|
576 |
+
'sandbox_mode' => $this->getSandboxMode(),
|
577 |
+
'spam_check' => $this->getSpamCheck()
|
578 |
+
]
|
579 |
+
);
|
580 |
+
}
|
581 |
+
}
|
582 |
+
|
583 |
+
class ASM implements \jsonSerializable
|
584 |
+
{
|
585 |
+
private
|
586 |
+
$group_id,
|
587 |
+
$groups_to_display;
|
588 |
+
|
589 |
+
public function setGroupId($group_id)
|
590 |
+
{
|
591 |
+
$this->group_id = $group_id;
|
592 |
+
}
|
593 |
+
|
594 |
+
public function getGroupId()
|
595 |
+
{
|
596 |
+
return $this->group_id;
|
597 |
+
}
|
598 |
+
|
599 |
+
public function setGroupsToDisplay($group_ids)
|
600 |
+
{
|
601 |
+
$this->groups_to_display = $group_ids;
|
602 |
+
}
|
603 |
+
|
604 |
+
public function getGroupsToDisplay()
|
605 |
+
{
|
606 |
+
return $this->groups_to_display;
|
607 |
+
}
|
608 |
+
|
609 |
+
public function jsonSerialize()
|
610 |
+
{
|
611 |
+
return array_filter(
|
612 |
+
[
|
613 |
+
'group_id' => $this->getGroupId(),
|
614 |
+
'groups_to_display' => $this->getGroupsToDisplay()
|
615 |
+
]
|
616 |
+
);
|
617 |
+
}
|
618 |
+
}
|
619 |
+
|
620 |
+
class Attachment implements \jsonSerializable
|
621 |
+
{
|
622 |
+
private
|
623 |
+
$content,
|
624 |
+
$type,
|
625 |
+
$filename,
|
626 |
+
$disposition,
|
627 |
+
$content_id;
|
628 |
+
|
629 |
+
public function setContent($content)
|
630 |
+
{
|
631 |
+
$this->content = $content;
|
632 |
+
}
|
633 |
+
|
634 |
+
public function getContent()
|
635 |
+
{
|
636 |
+
return $this->content;
|
637 |
+
}
|
638 |
+
|
639 |
+
public function setType($type)
|
640 |
+
{
|
641 |
+
$this->type = $type;
|
642 |
+
}
|
643 |
+
|
644 |
+
public function getType()
|
645 |
+
{
|
646 |
+
return $this->type;
|
647 |
+
}
|
648 |
+
|
649 |
+
public function setFilename($filename)
|
650 |
+
{
|
651 |
+
$this->filename = $filename;
|
652 |
+
}
|
653 |
+
|
654 |
+
public function getFilename()
|
655 |
+
{
|
656 |
+
return $this->filename;
|
657 |
+
}
|
658 |
+
|
659 |
+
public function setDisposition($disposition)
|
660 |
+
{
|
661 |
+
$this->disposition = $disposition;
|
662 |
+
}
|
663 |
+
|
664 |
+
public function getDisposition()
|
665 |
+
{
|
666 |
+
return $this->disposition;
|
667 |
+
}
|
668 |
+
|
669 |
+
public function setContentID($content_id)
|
670 |
+
{
|
671 |
+
$this->content_id = $content_id;
|
672 |
+
}
|
673 |
+
|
674 |
+
public function getContentID()
|
675 |
+
{
|
676 |
+
return $this->content_id;
|
677 |
+
}
|
678 |
+
|
679 |
+
public function jsonSerialize()
|
680 |
+
{
|
681 |
+
return array_filter(
|
682 |
+
[
|
683 |
+
'content' => $this->getContent(),
|
684 |
+
'type' => $this->getType(),
|
685 |
+
'filename' => $this->getFilename(),
|
686 |
+
'disposition' => $this->getDisposition(),
|
687 |
+
'content_id' => $this->getContentID()
|
688 |
+
]
|
689 |
+
);
|
690 |
+
}
|
691 |
+
}
|
692 |
+
|
693 |
+
class Content implements \jsonSerializable
|
694 |
+
{
|
695 |
+
private
|
696 |
+
$type,
|
697 |
+
$value;
|
698 |
+
|
699 |
+
public function __construct($type, $value)
|
700 |
+
{
|
701 |
+
$this->type = $type;
|
702 |
+
$this->value = $value;
|
703 |
+
}
|
704 |
+
|
705 |
+
public function setType($type)
|
706 |
+
{
|
707 |
+
$this->type = $type;
|
708 |
+
}
|
709 |
+
|
710 |
+
public function getType()
|
711 |
+
{
|
712 |
+
return $this->type;
|
713 |
+
}
|
714 |
+
|
715 |
+
public function setValue($value)
|
716 |
+
{
|
717 |
+
$this->value = $value;
|
718 |
+
}
|
719 |
+
|
720 |
+
public function getValue()
|
721 |
+
{
|
722 |
+
return $this->value;
|
723 |
+
}
|
724 |
+
|
725 |
+
public function jsonSerialize()
|
726 |
+
{
|
727 |
+
return array_filter(
|
728 |
+
[
|
729 |
+
'type' => $this->getType(),
|
730 |
+
'value' => $this->getValue()
|
731 |
+
]
|
732 |
+
);
|
733 |
+
}
|
734 |
+
}
|
735 |
+
|
736 |
+
class Personalization implements \jsonSerializable
|
737 |
+
{
|
738 |
+
private
|
739 |
+
$tos,
|
740 |
+
$ccs,
|
741 |
+
$bccs,
|
742 |
+
$subject,
|
743 |
+
$headers,
|
744 |
+
$substitutions,
|
745 |
+
$custom_args,
|
746 |
+
$send_at;
|
747 |
+
|
748 |
+
public function addTo($email)
|
749 |
+
{
|
750 |
+
$this->tos[] = $email;
|
751 |
+
}
|
752 |
+
|
753 |
+
public function getTos()
|
754 |
+
{
|
755 |
+
return $this->tos;
|
756 |
+
}
|
757 |
+
|
758 |
+
public function addCc($email)
|
759 |
+
{
|
760 |
+
$this->ccs[] = $email;
|
761 |
+
}
|
762 |
+
|
763 |
+
public function getCcs()
|
764 |
+
{
|
765 |
+
return $this->ccs;
|
766 |
+
}
|
767 |
+
|
768 |
+
public function addBcc($email)
|
769 |
+
{
|
770 |
+
$this->bccs[] = $email;
|
771 |
+
}
|
772 |
+
|
773 |
+
public function getBccs()
|
774 |
+
{
|
775 |
+
return $this->bccs;
|
776 |
+
}
|
777 |
+
|
778 |
+
public function setSubject($subject)
|
779 |
+
{
|
780 |
+
$this->subject = $subject;
|
781 |
+
}
|
782 |
+
|
783 |
+
public function getSubject()
|
784 |
+
{
|
785 |
+
return $this->subject;
|
786 |
+
}
|
787 |
+
|
788 |
+
public function addHeader($key, $value)
|
789 |
+
{
|
790 |
+
$this->headers[$key] = $value;
|
791 |
+
}
|
792 |
+
|
793 |
+
public function getHeaders()
|
794 |
+
{
|
795 |
+
return $this->headers;
|
796 |
+
}
|
797 |
+
|
798 |
+
public function addSubstitution($key, $value)
|
799 |
+
{
|
800 |
+
$this->substitutions[$key] = $value;
|
801 |
+
}
|
802 |
+
|
803 |
+
public function getSubstitutions()
|
804 |
+
{
|
805 |
+
return $this->substitutions;
|
806 |
+
}
|
807 |
+
|
808 |
+
public function addCustomArg($key, $value)
|
809 |
+
{
|
810 |
+
$this->custom_args[$key] = $value;
|
811 |
+
}
|
812 |
+
|
813 |
+
public function getCustomArgs()
|
814 |
+
{
|
815 |
+
return $this->custom_args;
|
816 |
+
}
|
817 |
+
|
818 |
+
public function setSendAt($send_at)
|
819 |
+
{
|
820 |
+
$this->send_at = $send_at;
|
821 |
+
}
|
822 |
+
|
823 |
+
public function getSendAt()
|
824 |
+
{
|
825 |
+
return $this->send_at;
|
826 |
+
}
|
827 |
+
|
828 |
+
public function jsonSerialize()
|
829 |
+
{
|
830 |
+
return array_filter(
|
831 |
+
[
|
832 |
+
'to' => $this->getTos(),
|
833 |
+
'cc' => $this->getCcs(),
|
834 |
+
'bcc' => $this->getBccs(),
|
835 |
+
'subject' => $this->subject,
|
836 |
+
'headers' => $this->getHeaders(),
|
837 |
+
'substitutions' => $this->getSubstitutions(),
|
838 |
+
'custom_args' => $this->getCustomArgs(),
|
839 |
+
'send_at' => $this->getSendAt()
|
840 |
+
]
|
841 |
+
);
|
842 |
+
}
|
843 |
+
}
|
844 |
+
|
845 |
+
class Email implements \jsonSerializable
|
846 |
+
{
|
847 |
+
private
|
848 |
+
$name,
|
849 |
+
$email;
|
850 |
+
|
851 |
+
public function __construct($name, $email)
|
852 |
+
{
|
853 |
+
$this->name = $name;
|
854 |
+
$this->email = $email;
|
855 |
+
}
|
856 |
+
|
857 |
+
public function setName($name)
|
858 |
+
{
|
859 |
+
$this->name = $name;
|
860 |
+
}
|
861 |
+
|
862 |
+
public function getName()
|
863 |
+
{
|
864 |
+
return $this->name;
|
865 |
+
}
|
866 |
+
|
867 |
+
public function setEmail($email)
|
868 |
+
{
|
869 |
+
$this->email = $email;
|
870 |
+
}
|
871 |
+
|
872 |
+
public function getEmail()
|
873 |
+
{
|
874 |
+
return $this->email;
|
875 |
+
}
|
876 |
+
|
877 |
+
public function jsonSerialize()
|
878 |
+
{
|
879 |
+
return array_filter(
|
880 |
+
[
|
881 |
+
'name' => $this->getName(),
|
882 |
+
'email' => $this->getEmail()
|
883 |
+
]
|
884 |
+
);
|
885 |
+
}
|
886 |
+
}
|
887 |
+
|
888 |
+
/**
|
889 |
+
* The final request body object
|
890 |
+
*/
|
891 |
+
class Mail implements \jsonSerializable
|
892 |
+
{
|
893 |
+
const VERSION = '1.0.0';
|
894 |
+
|
895 |
+
protected
|
896 |
+
$namespace = 'SendGrid';
|
897 |
+
|
898 |
+
public
|
899 |
+
$from,
|
900 |
+
$personalization,
|
901 |
+
$subject,
|
902 |
+
$contents,
|
903 |
+
$attachments,
|
904 |
+
$template_id,
|
905 |
+
$sections,
|
906 |
+
$headers,
|
907 |
+
$categories,
|
908 |
+
$custom_args,
|
909 |
+
$send_at,
|
910 |
+
$batch_id,
|
911 |
+
$asm,
|
912 |
+
$ip_pool_name,
|
913 |
+
$mail_settings,
|
914 |
+
$tracking_settings,
|
915 |
+
$reply_to;
|
916 |
+
|
917 |
+
public function __construct($from = null, $subject = null, $to = null, $content = null)
|
918 |
+
{
|
919 |
+
if (!empty($from) && !empty($subject) && !empty($to) && !empty($content))
|
920 |
+
{
|
921 |
+
$this->setFrom($from);
|
922 |
+
$personalization = new Personalization();
|
923 |
+
$personalization->addTo($to);
|
924 |
+
$this->addPersonalization($personalization);
|
925 |
+
$this->setSubject($subject);
|
926 |
+
$this->addContent($content);
|
927 |
+
}
|
928 |
+
|
929 |
+
}
|
930 |
+
|
931 |
+
public function setFrom($email)
|
932 |
+
{
|
933 |
+
$this->from = $email;
|
934 |
+
}
|
935 |
+
|
936 |
+
public function getFrom()
|
937 |
+
{
|
938 |
+
return $this->from;
|
939 |
+
}
|
940 |
+
|
941 |
+
public function addPersonalization($personalization)
|
942 |
+
{
|
943 |
+
$this->personalization[] = $personalization;
|
944 |
+
}
|
945 |
+
|
946 |
+
public function getPersonalizations()
|
947 |
+
{
|
948 |
+
return $this->personalization;
|
949 |
+
}
|
950 |
+
|
951 |
+
public function setSubject($subject)
|
952 |
+
{
|
953 |
+
$this->subject = $subject;
|
954 |
+
}
|
955 |
+
|
956 |
+
public function getSubject()
|
957 |
+
{
|
958 |
+
return $this->subject;
|
959 |
+
}
|
960 |
+
|
961 |
+
public function addContent($content)
|
962 |
+
{
|
963 |
+
$this->contents[] = $content;
|
964 |
+
}
|
965 |
+
|
966 |
+
public function getContents()
|
967 |
+
{
|
968 |
+
return $this->contents;
|
969 |
+
}
|
970 |
+
|
971 |
+
public function addAttachment($attachment)
|
972 |
+
{
|
973 |
+
$this->attachments[] = $attachment;
|
974 |
+
}
|
975 |
+
|
976 |
+
public function getAttachments()
|
977 |
+
{
|
978 |
+
return $this->attachments;
|
979 |
+
}
|
980 |
+
|
981 |
+
public function setTemplateId($template_id)
|
982 |
+
{
|
983 |
+
$this->template_id = $template_id;
|
984 |
+
}
|
985 |
+
|
986 |
+
public function getTemplateId()
|
987 |
+
{
|
988 |
+
return $this->template_id;
|
989 |
+
}
|
990 |
+
|
991 |
+
public function addSection($key, $value)
|
992 |
+
{
|
993 |
+
$this->sections[$key] = $value;
|
994 |
+
}
|
995 |
+
|
996 |
+
public function getSections()
|
997 |
+
{
|
998 |
+
return $this->sections;
|
999 |
+
}
|
1000 |
+
|
1001 |
+
public function addHeader($key, $value)
|
1002 |
+
{
|
1003 |
+
$this->headers[$key] = $value;
|
1004 |
+
}
|
1005 |
+
|
1006 |
+
public function getHeaders()
|
1007 |
+
{
|
1008 |
+
return $this->headers;
|
1009 |
+
}
|
1010 |
+
|
1011 |
+
public function addCategory($category)
|
1012 |
+
{
|
1013 |
+
$this->categories[] = $category;
|
1014 |
+
}
|
1015 |
+
|
1016 |
+
public function getCategories()
|
1017 |
+
{
|
1018 |
+
return $this->categories;
|
1019 |
+
}
|
1020 |
+
|
1021 |
+
public function addCustomArg($key, $value)
|
1022 |
+
{
|
1023 |
+
$this->custom_args[$key] = $value;
|
1024 |
+
}
|
1025 |
+
|
1026 |
+
public function getCustomArgs()
|
1027 |
+
{
|
1028 |
+
return $this->custom_args;
|
1029 |
+
}
|
1030 |
+
|
1031 |
+
public function setSendAt($send_at)
|
1032 |
+
{
|
1033 |
+
$this->send_at = $send_at;
|
1034 |
+
}
|
1035 |
+
|
1036 |
+
public function getSendAt()
|
1037 |
+
{
|
1038 |
+
return $this->send_at;
|
1039 |
+
}
|
1040 |
+
|
1041 |
+
public function setBatchId($batch_id)
|
1042 |
+
{
|
1043 |
+
$this->batch_id = $batch_id;
|
1044 |
+
}
|
1045 |
+
|
1046 |
+
public function getBatchId()
|
1047 |
+
{
|
1048 |
+
return $this->batch_id;
|
1049 |
+
}
|
1050 |
+
|
1051 |
+
public function setASM($asm)
|
1052 |
+
{
|
1053 |
+
$this->asm = $asm;
|
1054 |
+
}
|
1055 |
+
|
1056 |
+
public function getASM()
|
1057 |
+
{
|
1058 |
+
return $this->asm;
|
1059 |
+
}
|
1060 |
+
|
1061 |
+
public function setIpPoolName($ip_pool_name)
|
1062 |
+
{
|
1063 |
+
$this->ip_pool_name = $ip_pool_name;
|
1064 |
+
}
|
1065 |
+
|
1066 |
+
public function getIpPoolName()
|
1067 |
+
{
|
1068 |
+
return $this->ip_pool_name;
|
1069 |
+
}
|
1070 |
+
|
1071 |
+
public function setMailSettings($mail_settings)
|
1072 |
+
{
|
1073 |
+
$this->mail_settings = $mail_settings;
|
1074 |
+
}
|
1075 |
+
|
1076 |
+
public function getMailSettings()
|
1077 |
+
{
|
1078 |
+
return $this->mail_settings;
|
1079 |
+
}
|
1080 |
+
|
1081 |
+
public function setTrackingSettings($tracking_settings)
|
1082 |
+
{
|
1083 |
+
$this->tracking_settings = $tracking_settings;
|
1084 |
+
}
|
1085 |
+
|
1086 |
+
public function getTrackingSettings()
|
1087 |
+
{
|
1088 |
+
return $this->tracking_settings;
|
1089 |
+
}
|
1090 |
+
|
1091 |
+
public function setReplyTo($reply_to)
|
1092 |
+
{
|
1093 |
+
$this->reply_to = $reply_to;
|
1094 |
+
}
|
1095 |
+
|
1096 |
+
public function getReplyTo()
|
1097 |
+
{
|
1098 |
+
return $this->reply_to;
|
1099 |
+
}
|
1100 |
+
|
1101 |
+
public function jsonSerialize()
|
1102 |
+
{
|
1103 |
+
return array_filter(
|
1104 |
+
[
|
1105 |
+
'from' => $this->getFrom(),
|
1106 |
+
'personalizations' => $this->getPersonalizations(),
|
1107 |
+
'subject' => $this->getSubject(),
|
1108 |
+
'content' => $this->getContents(),
|
1109 |
+
'attachments' => $this->getAttachments(),
|
1110 |
+
'template_id' => $this->getTemplateId(),
|
1111 |
+
'sections' => $this->getSections(),
|
1112 |
+
'headers' => $this->getHeaders(),
|
1113 |
+
'categories' => $this->getCategories(),
|
1114 |
+
'custom_args' => $this->getCustomArgs(),
|
1115 |
+
'send_at' => $this->getSendAt(),
|
1116 |
+
'batch_id' => $this->getBatchId(),
|
1117 |
+
'asm' => $this->getASM(),
|
1118 |
+
'ip_pool_name' => $this->getIpPoolName(),
|
1119 |
+
'mail_settings' => $this->getMailSettings(),
|
1120 |
+
'tracking_settings' => $this->getTrackingSettings(),
|
1121 |
+
'reply_to' => $this->getReplyTo()
|
1122 |
+
]
|
1123 |
+
);
|
1124 |
+
}
|
1125 |
+
}
|
classes/email/sendgrid/lib/helpers/mail/README.md
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
**This helper allows you to quickly and easily build a Mail object for sending email through SendGrid.**
|
2 |
+
|
3 |
+
# Quick Start
|
4 |
+
|
5 |
+
Run the [example](https://github.com/sendgrid/sendgrid-php/blob/master/examples/helpers/mail/example.php) (make sure you have set your environment variable to include your SENDGRID_API_KEY).
|
6 |
+
|
7 |
+
```bash
|
8 |
+
php examples/helpers/mail/example.php
|
9 |
+
```
|
10 |
+
|
11 |
+
## Usage
|
12 |
+
|
13 |
+
- See this complete working [example](https://github.com/sendgrid/sendgrid-php/blob/master/examples/helpers/mail/example.php).
|
14 |
+
- [Documentation](https://sendgrid.com/docs/API_Reference/Web_API_v3/Mail/overview.html)
|
classes/email/sendgrid/sendgrid-php.php
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require 'vendor/autoload.php';
|
3 |
+
?>
|
classes/email/sendgrid/vendor/autoload.php
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload.php @generated by Composer
|
4 |
+
|
5 |
+
require_once __DIR__ . '/composer' . '/autoload_real.php';
|
6 |
+
|
7 |
+
return ComposerAutoloaderInitaf1c99f306a43d53c0364b3f14c3467f::getLoader();
|
classes/email/sendgrid/vendor/composer/ClassLoader.php
ADDED
@@ -0,0 +1,413 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Composer.
|
5 |
+
*
|
6 |
+
* (c) Nils Adermann <naderman@naderman.de>
|
7 |
+
* Jordi Boggiano <j.boggiano@seld.be>
|
8 |
+
*
|
9 |
+
* For the full copyright and license information, please view the LICENSE
|
10 |
+
* file that was distributed with this source code.
|
11 |
+
*/
|
12 |
+
|
13 |
+
namespace Composer\Autoload;
|
14 |
+
|
15 |
+
/**
|
16 |
+
* ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
|
17 |
+
*
|
18 |
+
* $loader = new \Composer\Autoload\ClassLoader();
|
19 |
+
*
|
20 |
+
* // register classes with namespaces
|
21 |
+
* $loader->add('Symfony\Component', __DIR__.'/component');
|
22 |
+
* $loader->add('Symfony', __DIR__.'/framework');
|
23 |
+
*
|
24 |
+
* // activate the autoloader
|
25 |
+
* $loader->register();
|
26 |
+
*
|
27 |
+
* // to enable searching the include path (eg. for PEAR packages)
|
28 |
+
* $loader->setUseIncludePath(true);
|
29 |
+
*
|
30 |
+
* In this example, if you try to use a class in the Symfony\Component
|
31 |
+
* namespace or one of its children (Symfony\Component\Console for instance),
|
32 |
+
* the autoloader will first look for the class under the component/
|
33 |
+
* directory, and it will then fallback to the framework/ directory if not
|
34 |
+
* found before giving up.
|
35 |
+
*
|
36 |
+
* This class is loosely based on the Symfony UniversalClassLoader.
|
37 |
+
*
|
38 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
39 |
+
* @author Jordi Boggiano <j.boggiano@seld.be>
|
40 |
+
* @see http://www.php-fig.org/psr/psr-0/
|
41 |
+
* @see http://www.php-fig.org/psr/psr-4/
|
42 |
+
*/
|
43 |
+
class ClassLoader
|
44 |
+
{
|
45 |
+
// PSR-4
|
46 |
+
private $prefixLengthsPsr4 = array();
|
47 |
+
private $prefixDirsPsr4 = array();
|
48 |
+
private $fallbackDirsPsr4 = array();
|
49 |
+
|
50 |
+
// PSR-0
|
51 |
+
private $prefixesPsr0 = array();
|
52 |
+
private $fallbackDirsPsr0 = array();
|
53 |
+
|
54 |
+
private $useIncludePath = false;
|
55 |
+
private $classMap = array();
|
56 |
+
|
57 |
+
private $classMapAuthoritative = false;
|
58 |
+
|
59 |
+
public function getPrefixes()
|
60 |
+
{
|
61 |
+
if (!empty($this->prefixesPsr0)) {
|
62 |
+
return call_user_func_array('array_merge', $this->prefixesPsr0);
|
63 |
+
}
|
64 |
+
|
65 |
+
return array();
|
66 |
+
}
|
67 |
+
|
68 |
+
public function getPrefixesPsr4()
|
69 |
+
{
|
70 |
+
return $this->prefixDirsPsr4;
|
71 |
+
}
|
72 |
+
|
73 |
+
public function getFallbackDirs()
|
74 |
+
{
|
75 |
+
return $this->fallbackDirsPsr0;
|
76 |
+
}
|
77 |
+
|
78 |
+
public function getFallbackDirsPsr4()
|
79 |
+
{
|
80 |
+
return $this->fallbackDirsPsr4;
|
81 |
+
}
|
82 |
+
|
83 |
+
public function getClassMap()
|
84 |
+
{
|
85 |
+
return $this->classMap;
|
86 |
+
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
* @param array $classMap Class to filename map
|
90 |
+
*/
|
91 |
+
public function addClassMap(array $classMap)
|
92 |
+
{
|
93 |
+
if ($this->classMap) {
|
94 |
+
$this->classMap = array_merge($this->classMap, $classMap);
|
95 |
+
} else {
|
96 |
+
$this->classMap = $classMap;
|
97 |
+
}
|
98 |
+
}
|
99 |
+
|
100 |
+
/**
|
101 |
+
* Registers a set of PSR-0 directories for a given prefix, either
|
102 |
+
* appending or prepending to the ones previously set for this prefix.
|
103 |
+
*
|
104 |
+
* @param string $prefix The prefix
|
105 |
+
* @param array|string $paths The PSR-0 root directories
|
106 |
+
* @param bool $prepend Whether to prepend the directories
|
107 |
+
*/
|
108 |
+
public function add($prefix, $paths, $prepend = false)
|
109 |
+
{
|
110 |
+
if (!$prefix) {
|
111 |
+
if ($prepend) {
|
112 |
+
$this->fallbackDirsPsr0 = array_merge(
|
113 |
+
(array) $paths,
|
114 |
+
$this->fallbackDirsPsr0
|
115 |
+
);
|
116 |
+
} else {
|
117 |
+
$this->fallbackDirsPsr0 = array_merge(
|
118 |
+
$this->fallbackDirsPsr0,
|
119 |
+
(array) $paths
|
120 |
+
);
|
121 |
+
}
|
122 |
+
|
123 |
+
return;
|
124 |
+
}
|
125 |
+
|
126 |
+
$first = $prefix[0];
|
127 |
+
if (!isset($this->prefixesPsr0[$first][$prefix])) {
|
128 |
+
$this->prefixesPsr0[$first][$prefix] = (array) $paths;
|
129 |
+
|
130 |
+
return;
|
131 |
+
}
|
132 |
+
if ($prepend) {
|
133 |
+
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
134 |
+
(array) $paths,
|
135 |
+
$this->prefixesPsr0[$first][$prefix]
|
136 |
+
);
|
137 |
+
} else {
|
138 |
+
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
139 |
+
$this->prefixesPsr0[$first][$prefix],
|
140 |
+
(array) $paths
|
141 |
+
);
|
142 |
+
}
|
143 |
+
}
|
144 |
+
|
145 |
+
/**
|
146 |
+
* Registers a set of PSR-4 directories for a given namespace, either
|
147 |
+
* appending or prepending to the ones previously set for this namespace.
|
148 |
+
*
|
149 |
+
* @param string $prefix The prefix/namespace, with trailing '\\'
|
150 |
+
* @param array|string $paths The PSR-4 base directories
|
151 |
+
* @param bool $prepend Whether to prepend the directories
|
152 |
+
*
|
153 |
+
* @throws \InvalidArgumentException
|
154 |
+
*/
|
155 |
+
public function addPsr4($prefix, $paths, $prepend = false)
|
156 |
+
{
|
157 |
+
if (!$prefix) {
|
158 |
+
// Register directories for the root namespace.
|
159 |
+
if ($prepend) {
|
160 |
+
$this->fallbackDirsPsr4 = array_merge(
|
161 |
+
(array) $paths,
|
162 |
+
$this->fallbackDirsPsr4
|
163 |
+
);
|
164 |
+
} else {
|
165 |
+
$this->fallbackDirsPsr4 = array_merge(
|
166 |
+
$this->fallbackDirsPsr4,
|
167 |
+
(array) $paths
|
168 |
+
);
|
169 |
+
}
|
170 |
+
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
|
171 |
+
// Register directories for a new namespace.
|
172 |
+
$length = strlen($prefix);
|
173 |
+
if ('\\' !== $prefix[$length - 1]) {
|
174 |
+
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
|
175 |
+
}
|
176 |
+
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
177 |
+
$this->prefixDirsPsr4[$prefix] = (array) $paths;
|
178 |
+
} elseif ($prepend) {
|
179 |
+
// Prepend directories for an already registered namespace.
|
180 |
+
$this->prefixDirsPsr4[$prefix] = array_merge(
|
181 |
+
(array) $paths,
|
182 |
+
$this->prefixDirsPsr4[$prefix]
|
183 |
+
);
|
184 |
+
} else {
|
185 |
+
// Append directories for an already registered namespace.
|
186 |
+
$this->prefixDirsPsr4[$prefix] = array_merge(
|
187 |
+
$this->prefixDirsPsr4[$prefix],
|
188 |
+
(array) $paths
|
189 |
+
);
|
190 |
+
}
|
191 |
+
}
|
192 |
+
|
193 |
+
/**
|
194 |
+
* Registers a set of PSR-0 directories for a given prefix,
|
195 |
+
* replacing any others previously set for this prefix.
|
196 |
+
*
|
197 |
+
* @param string $prefix The prefix
|
198 |
+
* @param array|string $paths The PSR-0 base directories
|
199 |
+
*/
|
200 |
+
public function set($prefix, $paths)
|
201 |
+
{
|
202 |
+
if (!$prefix) {
|
203 |
+
$this->fallbackDirsPsr0 = (array) $paths;
|
204 |
+
} else {
|
205 |
+
$this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
|
206 |
+
}
|
207 |
+
}
|
208 |
+
|
209 |
+
/**
|
210 |
+
* Registers a set of PSR-4 directories for a given namespace,
|
211 |
+
* replacing any others previously set for this namespace.
|
212 |
+
*
|
213 |
+
* @param string $prefix The prefix/namespace, with trailing '\\'
|
214 |
+
* @param array|string $paths The PSR-4 base directories
|
215 |
+
*
|
216 |
+
* @throws \InvalidArgumentException
|
217 |
+
*/
|
218 |
+
public function setPsr4($prefix, $paths)
|
219 |
+
{
|
220 |
+
if (!$prefix) {
|
221 |
+
$this->fallbackDirsPsr4 = (array) $paths;
|
222 |
+
} else {
|
223 |
+
$length = strlen($prefix);
|
224 |
+
if ('\\' !== $prefix[$length - 1]) {
|
225 |
+
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
|
226 |
+
}
|
227 |
+
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
228 |
+
$this->prefixDirsPsr4[$prefix] = (array) $paths;
|
229 |
+
}
|
230 |
+
}
|
231 |
+
|
232 |
+
/**
|
233 |
+
* Turns on searching the include path for class files.
|
234 |
+
*
|
235 |
+
* @param bool $useIncludePath
|
236 |
+
*/
|
237 |
+
public function setUseIncludePath($useIncludePath)
|
238 |
+
{
|
239 |
+
$this->useIncludePath = $useIncludePath;
|
240 |
+
}
|
241 |
+
|
242 |
+
/**
|
243 |
+
* Can be used to check if the autoloader uses the include path to check
|
244 |
+
* for classes.
|
245 |
+
*
|
246 |
+
* @return bool
|
247 |
+
*/
|
248 |
+
public function getUseIncludePath()
|
249 |
+
{
|
250 |
+
return $this->useIncludePath;
|
251 |
+
}
|
252 |
+
|
253 |
+
/**
|
254 |
+
* Turns off searching the prefix and fallback directories for classes
|
255 |
+
* that have not been registered with the class map.
|
256 |
+
*
|
257 |
+
* @param bool $classMapAuthoritative
|
258 |
+
*/
|
259 |
+
public function setClassMapAuthoritative($classMapAuthoritative)
|
260 |
+
{
|
261 |
+
$this->classMapAuthoritative = $classMapAuthoritative;
|
262 |
+
}
|
263 |
+
|
264 |
+
/**
|
265 |
+
* Should class lookup fail if not found in the current class map?
|
266 |
+
*
|
267 |
+
* @return bool
|
268 |
+
*/
|
269 |
+
public function isClassMapAuthoritative()
|
270 |
+
{
|
271 |
+
return $this->classMapAuthoritative;
|
272 |
+
}
|
273 |
+
|
274 |
+
/**
|
275 |
+
* Registers this instance as an autoloader.
|
276 |
+
*
|
277 |
+
* @param bool $prepend Whether to prepend the autoloader or not
|
278 |
+
*/
|
279 |
+
public function register($prepend = false)
|
280 |
+
{
|
281 |
+
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
|
282 |
+
}
|
283 |
+
|
284 |
+
/**
|
285 |
+
* Unregisters this instance as an autoloader.
|
286 |
+
*/
|
287 |
+
public function unregister()
|
288 |
+
{
|
289 |
+
spl_autoload_unregister(array($this, 'loadClass'));
|
290 |
+
}
|
291 |
+
|
292 |
+
/**
|
293 |
+
* Loads the given class or interface.
|
294 |
+
*
|
295 |
+
* @param string $class The name of the class
|
296 |
+
* @return bool|null True if loaded, null otherwise
|
297 |
+
*/
|
298 |
+
public function loadClass($class)
|
299 |
+
{
|
300 |
+
if ($file = $this->findFile($class)) {
|
301 |
+
includeFile($file);
|
302 |
+
|
303 |
+
return true;
|
304 |
+
}
|
305 |
+
}
|
306 |
+
|
307 |
+
/**
|
308 |
+
* Finds the path to the file where the class is defined.
|
309 |
+
*
|
310 |
+
* @param string $class The name of the class
|
311 |
+
*
|
312 |
+
* @return string|false The path if found, false otherwise
|
313 |
+
*/
|
314 |
+
public function findFile($class)
|
315 |
+
{
|
316 |
+
// work around for PHP 5.3.0 - 5.3.2 https://bugs.php.net/50731
|
317 |
+
if ('\\' == $class[0]) {
|
318 |
+
$class = substr($class, 1);
|
319 |
+
}
|
320 |
+
|
321 |
+
// class map lookup
|
322 |
+
if (isset($this->classMap[$class])) {
|
323 |
+
return $this->classMap[$class];
|
324 |
+
}
|
325 |
+
if ($this->classMapAuthoritative) {
|
326 |
+
return false;
|
327 |
+
}
|
328 |
+
|
329 |
+
$file = $this->findFileWithExtension($class, '.php');
|
330 |
+
|
331 |
+
// Search for Hack files if we are running on HHVM
|
332 |
+
if ($file === null && defined('HHVM_VERSION')) {
|
333 |
+
$file = $this->findFileWithExtension($class, '.hh');
|
334 |
+
}
|
335 |
+
|
336 |
+
if ($file === null) {
|
337 |
+
// Remember that this class does not exist.
|
338 |
+
return $this->classMap[$class] = false;
|
339 |
+
}
|
340 |
+
|
341 |
+
return $file;
|
342 |
+
}
|
343 |
+
|
344 |
+
private function findFileWithExtension($class, $ext)
|
345 |
+
{
|
346 |
+
// PSR-4 lookup
|
347 |
+
$logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
|
348 |
+
|
349 |
+
$first = $class[0];
|
350 |
+
if (isset($this->prefixLengthsPsr4[$first])) {
|
351 |
+
foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) {
|
352 |
+
if (0 === strpos($class, $prefix)) {
|
353 |
+
foreach ($this->prefixDirsPsr4[$prefix] as $dir) {
|
354 |
+
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
|
355 |
+
return $file;
|
356 |
+
}
|
357 |
+
}
|
358 |
+
}
|
359 |
+
}
|
360 |
+
}
|
361 |
+
|
362 |
+
// PSR-4 fallback dirs
|
363 |
+
foreach ($this->fallbackDirsPsr4 as $dir) {
|
364 |
+
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
|
365 |
+
return $file;
|
366 |
+
}
|
367 |
+
}
|
368 |
+
|
369 |
+
// PSR-0 lookup
|
370 |
+
if (false !== $pos = strrpos($class, '\\')) {
|
371 |
+
// namespaced class name
|
372 |
+
$logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
|
373 |
+
. strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
|
374 |
+
} else {
|
375 |
+
// PEAR-like class name
|
376 |
+
$logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
|
377 |
+
}
|
378 |
+
|
379 |
+
if (isset($this->prefixesPsr0[$first])) {
|
380 |
+
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
|
381 |
+
if (0 === strpos($class, $prefix)) {
|
382 |
+
foreach ($dirs as $dir) {
|
383 |
+
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
384 |
+
return $file;
|
385 |
+
}
|
386 |
+
}
|
387 |
+
}
|
388 |
+
}
|
389 |
+
}
|
390 |
+
|
391 |
+
// PSR-0 fallback dirs
|
392 |
+
foreach ($this->fallbackDirsPsr0 as $dir) {
|
393 |
+
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
394 |
+
return $file;
|
395 |
+
}
|
396 |
+
}
|
397 |
+
|
398 |
+
// PSR-0 include paths.
|
399 |
+
if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
|
400 |
+
return $file;
|
401 |
+
}
|
402 |
+
}
|
403 |
+
}
|
404 |
+
|
405 |
+
/**
|
406 |
+
* Scope isolated include.
|
407 |
+
*
|
408 |
+
* Prevents access to $this/self from included files.
|
409 |
+
*/
|
410 |
+
function includeFile($file)
|
411 |
+
{
|
412 |
+
include $file;
|
413 |
+
}
|
classes/email/sendgrid/vendor/composer/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
Copyright (c) 2016 Nils Adermann, Jordi Boggiano
|
3 |
+
|
4 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
5 |
+
of this software and associated documentation files (the "Software"), to deal
|
6 |
+
in the Software without restriction, including without limitation the rights
|
7 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8 |
+
copies of the Software, and to permit persons to whom the Software is furnished
|
9 |
+
to do so, subject to the following conditions:
|
10 |
+
|
11 |
+
The above copyright notice and this permission notice shall be included in all
|
12 |
+
copies or substantial portions of the Software.
|
13 |
+
|
14 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
17 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
18 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
19 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
20 |
+
THE SOFTWARE.
|
21 |
+
|
classes/email/sendgrid/vendor/composer/autoload_classmap.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_classmap.php @generated by Composer
|
4 |
+
|
5 |
+
$vendorDir = dirname(dirname(__FILE__));
|
6 |
+
$baseDir = dirname($vendorDir);
|
7 |
+
|
8 |
+
return array(
|
9 |
+
);
|
classes/email/sendgrid/vendor/composer/autoload_files.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_files.php @generated by Composer
|
4 |
+
|
5 |
+
$vendorDir = dirname(dirname(__FILE__));
|
6 |
+
$baseDir = dirname($vendorDir);
|
7 |
+
|
8 |
+
return array(
|
9 |
+
'3f8bdd3b35094c73a26f0106e3c0f8b2' => $baseDir . '/lib/SendGrid.php',
|
10 |
+
'9dda55337a76a24e949fbcc5d905a2c7' => $baseDir . '/lib/helpers/mail/Mail.php',
|
11 |
+
);
|
classes/email/sendgrid/vendor/composer/autoload_namespaces.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_namespaces.php @generated by Composer
|
4 |
+
|
5 |
+
$vendorDir = dirname(dirname(__FILE__));
|
6 |
+
$baseDir = dirname($vendorDir);
|
7 |
+
|
8 |
+
return array(
|
9 |
+
'SendGrid' => array($vendorDir . '/sendgrid/php-http-client/lib'),
|
10 |
+
);
|
classes/email/sendgrid/vendor/composer/autoload_psr4.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_psr4.php @generated by Composer
|
4 |
+
|
5 |
+
$vendorDir = dirname(dirname(__FILE__));
|
6 |
+
$baseDir = dirname($vendorDir);
|
7 |
+
|
8 |
+
return array(
|
9 |
+
);
|
classes/email/sendgrid/vendor/composer/autoload_real.php
ADDED
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_real.php @generated by Composer
|
4 |
+
|
5 |
+
class ComposerAutoloaderInitaf1c99f306a43d53c0364b3f14c3467f
|
6 |
+
{
|
7 |
+
private static $loader;
|
8 |
+
|
9 |
+
public static function loadClassLoader($class)
|
10 |
+
{
|
11 |
+
if ('Composer\Autoload\ClassLoader' === $class) {
|
12 |
+
require __DIR__ . '/ClassLoader.php';
|
13 |
+
}
|
14 |
+
}
|
15 |
+
|
16 |
+
public static function getLoader()
|
17 |
+
{
|
18 |
+
if (null !== self::$loader) {
|
19 |
+
return self::$loader;
|
20 |
+
}
|
21 |
+
|
22 |
+
spl_autoload_register(array('ComposerAutoloaderInitaf1c99f306a43d53c0364b3f14c3467f', 'loadClassLoader'), true, true);
|
23 |
+
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
+
spl_autoload_unregister(array('ComposerAutoloaderInitaf1c99f306a43d53c0364b3f14c3467f', 'loadClassLoader'));
|
25 |
+
|
26 |
+
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION');
|
27 |
+
if ($useStaticLoader) {
|
28 |
+
require_once __DIR__ . '/autoload_static.php';
|
29 |
+
|
30 |
+
call_user_func(\Composer\Autoload\ComposerStaticInitaf1c99f306a43d53c0364b3f14c3467f::getInitializer($loader));
|
31 |
+
} else {
|
32 |
+
$map = require __DIR__ . '/autoload_namespaces.php';
|
33 |
+
foreach ($map as $namespace => $path) {
|
34 |
+
$loader->set($namespace, $path);
|
35 |
+
}
|
36 |
+
|
37 |
+
$map = require __DIR__ . '/autoload_psr4.php';
|
38 |
+
foreach ($map as $namespace => $path) {
|
39 |
+
$loader->setPsr4($namespace, $path);
|
40 |
+
}
|
41 |
+
|
42 |
+
$classMap = require __DIR__ . '/autoload_classmap.php';
|
43 |
+
if ($classMap) {
|
44 |
+
$loader->addClassMap($classMap);
|
45 |
+
}
|
46 |
+
}
|
47 |
+
|
48 |
+
$loader->register(true);
|
49 |
+
|
50 |
+
if ($useStaticLoader) {
|
51 |
+
$includeFiles = Composer\Autoload\ComposerStaticInitaf1c99f306a43d53c0364b3f14c3467f::$files;
|
52 |
+
} else {
|
53 |
+
$includeFiles = require __DIR__ . '/autoload_files.php';
|
54 |
+
}
|
55 |
+
foreach ($includeFiles as $fileIdentifier => $file) {
|
56 |
+
composerRequireaf1c99f306a43d53c0364b3f14c3467f($fileIdentifier, $file);
|
57 |
+
}
|
58 |
+
|
59 |
+
return $loader;
|
60 |
+
}
|
61 |
+
}
|
62 |
+
|
63 |
+
function composerRequireaf1c99f306a43d53c0364b3f14c3467f($fileIdentifier, $file)
|
64 |
+
{
|
65 |
+
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
66 |
+
require $file;
|
67 |
+
|
68 |
+
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
69 |
+
}
|
70 |
+
}
|
classes/email/sendgrid/vendor/composer/autoload_static.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_static.php @generated by Composer
|
4 |
+
|
5 |
+
namespace Composer\Autoload;
|
6 |
+
|
7 |
+
class ComposerStaticInitaf1c99f306a43d53c0364b3f14c3467f
|
8 |
+
{
|
9 |
+
public static $files = array (
|
10 |
+
'3f8bdd3b35094c73a26f0106e3c0f8b2' => __DIR__ . '/../..' . '/lib/SendGrid.php',
|
11 |
+
'9dda55337a76a24e949fbcc5d905a2c7' => __DIR__ . '/../..' . '/lib/helpers/mail/Mail.php',
|
12 |
+
);
|
13 |
+
|
14 |
+
public static $prefixesPsr0 = array (
|
15 |
+
'S' =>
|
16 |
+
array (
|
17 |
+
'SendGrid' =>
|
18 |
+
array (
|
19 |
+
0 => __DIR__ . '/..' . '/sendgrid/php-http-client/lib',
|
20 |
+
),
|
21 |
+
),
|
22 |
+
);
|
23 |
+
|
24 |
+
public static function getInitializer(ClassLoader $loader)
|
25 |
+
{
|
26 |
+
return \Closure::bind(function () use ($loader) {
|
27 |
+
$loader->prefixesPsr0 = ComposerStaticInitaf1c99f306a43d53c0364b3f14c3467f::$prefixesPsr0;
|
28 |
+
|
29 |
+
}, null, ClassLoader::class);
|
30 |
+
}
|
31 |
+
}
|
classes/email/sendgrid/vendor/composer/installed.json
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[
|
2 |
+
{
|
3 |
+
"name": "sendgrid/php-http-client",
|
4 |
+
"version": "3.1.0",
|
5 |
+
"version_normalized": "3.1.0.0",
|
6 |
+
"source": {
|
7 |
+
"type": "git",
|
8 |
+
"url": "https://github.com/sendgrid/php-http-client.git",
|
9 |
+
"reference": "01c3fc4b94df008cfe03ffb467d4c6dbe6dcfb2c"
|
10 |
+
},
|
11 |
+
"dist": {
|
12 |
+
"type": "zip",
|
13 |
+
"url": "https://api.github.com/repos/sendgrid/php-http-client/zipball/01c3fc4b94df008cfe03ffb467d4c6dbe6dcfb2c",
|
14 |
+
"reference": "01c3fc4b94df008cfe03ffb467d4c6dbe6dcfb2c",
|
15 |
+
"shasum": ""
|
16 |
+
},
|
17 |
+
"require": {
|
18 |
+
"php": ">=5.3"
|
19 |
+
},
|
20 |
+
"require-dev": {
|
21 |
+
"phpunit/phpunit": "~4.4",
|
22 |
+
"squizlabs/php_codesniffer": "2.*"
|
23 |
+
},
|
24 |
+
"time": "2016-06-11 00:47:24",
|
25 |
+
"type": "library",
|
26 |
+
"installation-source": "dist",
|
27 |
+
"autoload": {
|
28 |
+
"psr-0": {
|
29 |
+
"SendGrid": "lib/"
|
30 |
+
}
|
31 |
+
},
|
32 |
+
"notification-url": "https://packagist.org/downloads/",
|
33 |
+
"license": [
|
34 |
+
"MIT"
|
35 |
+
],
|
36 |
+
"authors": [
|
37 |
+
{
|
38 |
+
"name": "Matt Bernier",
|
39 |
+
"email": "dx@sendgrid.com"
|
40 |
+
},
|
41 |
+
{
|
42 |
+
"name": "Elmer Thomas",
|
43 |
+
"email": "elmer@thinkingserious.com"
|
44 |
+
}
|
45 |
+
],
|
46 |
+
"description": "HTTP REST client, simplified for PHP",
|
47 |
+
"homepage": "http://github.com/sendgrid/php-http-client",
|
48 |
+
"keywords": [
|
49 |
+
"api",
|
50 |
+
"fluent",
|
51 |
+
"http",
|
52 |
+
"rest",
|
53 |
+
"sendgrid"
|
54 |
+
]
|
55 |
+
}
|
56 |
+
]
|
classes/email/sendgrid/vendor/sendgrid/php-http-client/CHANGELOG.md
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Change Log
|
2 |
+
All notable changes to this project will be documented in this file.
|
3 |
+
|
4 |
+
This project adheres to [Semantic Versioning](http://semver.org/).
|
5 |
+
|
6 |
+
## [3.1.0] - 2016-06-10
|
7 |
+
### Added
|
8 |
+
- Automatically add Content-Type: application/json when there is a request body
|
9 |
+
|
10 |
+
## [3.0.0] - 2016-06-06
|
11 |
+
### Changed
|
12 |
+
- Made the Request and Response variables non-redundant. e.g. request.requestBody becomes request.body
|
13 |
+
|
14 |
+
## [2.0.2] - 2016-02-29
|
15 |
+
### Fixed
|
16 |
+
- Renaming files to conform to PSR-0, git ignored the case in 2.0.1
|
17 |
+
|
18 |
+
## [2.0.1] - 2016-02-29
|
19 |
+
### Fixed
|
20 |
+
- Renaming files to conform to PSR-0
|
21 |
+
|
22 |
+
## [1.0.1] - 2016-02-29
|
23 |
+
### Fixed
|
24 |
+
- Composer/Packagist install issues resolved
|
25 |
+
|
26 |
+
## [1.0.0] - 2016-02-29
|
27 |
+
### Added
|
28 |
+
- We are live!
|
classes/email/sendgrid/vendor/sendgrid/php-http-client/CONTRIBUTING.md
ADDED
@@ -0,0 +1,192 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Hello! Thank you for choosing to help contribute to one of the SendGrid open source projects. There are many ways you can contribute and help is always welcome. We simply ask that you follow the following contribution policies.
|
2 |
+
|
3 |
+
- [CLAs and CCLAs](#cla)
|
4 |
+
- [Roadmap & Milestones](#roadmap)
|
5 |
+
- [Feature Request](#feature_request)
|
6 |
+
- [Submit a Bug Report](#submit_a_bug_report)
|
7 |
+
- [Improvements to the Codebase](#improvements_to_the_codebase)
|
8 |
+
- [Understanding the Code Base](#understanding_the_codebase)
|
9 |
+
- [Testing](#testing)
|
10 |
+
- [Style Guidelines & Naming Conventions](#style_guidelines_and_naming_conventions)
|
11 |
+
- [Creating a Pull Request](#creating_a_pull_request)
|
12 |
+
|
13 |
+
<a name="roadmap"></a>
|
14 |
+
We use [Milestones](https://github.com/sendgrid/php-http-client/milestones) to help define current roadmaps, please feel free to grab an issue from the current milestone. Please indicate that you have begun work on it to avoid collisions. Once a PR is made, community review, comments, suggestions and additional PRs are welcomed and encouraged.
|
15 |
+
|
16 |
+
<a name="cla"></a>
|
17 |
+
## CLAs and CCLAs
|
18 |
+
|
19 |
+
Before you get started, SendGrid requires that a SendGrid Contributor License Agreement (CLA) or a SendGrid Company Contributor Licensing Agreement (CCLA) be filled out by every contributor to a SendGrid open source project.
|
20 |
+
|
21 |
+
Our goal with the CLA and CCLA is to clarify the rights of our contributors and reduce other risks arising from inappropriate contributions. The CLA also clarifies the rights SendGrid holds in each contribution and helps to avoid misunderstandings over what rights each contributor is required to grant to SendGrid when making a contribution. In this way the CLA and CCLA encourage broad participation by our open source community and help us build strong open source projects, free from any individual contributor withholding or revoking rights to any contribution.
|
22 |
+
|
23 |
+
SendGrid does not merge a pull request made against a SendGrid open source project until that pull request is associated with a signed CLA (or CCLA). Copies of the CLA and CCLA are available [here](https://drive.google.com/a/sendgrid.com/file/d/0B0PlcM9qA91LN2VEUTJWU2RIVXc/view).
|
24 |
+
|
25 |
+
You may submit your completed [CLA or CCLA](https://drive.google.com/a/sendgrid.com/file/d/0B0PlcM9qA91LN2VEUTJWU2RIVXc/view) to SendGrid at [dx@sendgrid.com](mailto:dx@sendgrid.com). SendGrid will then confirm you are ready to begin making contributions.
|
26 |
+
|
27 |
+
There are a few ways to contribute, which we'll enumerate below:
|
28 |
+
|
29 |
+
<a name="feature_request"></a>
|
30 |
+
## Feature Request
|
31 |
+
|
32 |
+
If you'd like to make a feature request, please read this section.
|
33 |
+
|
34 |
+
The GitHub issue tracker is the preferred channel for library feature requests, but please respect the following restrictions:
|
35 |
+
|
36 |
+
- Please **search for existing issues** in order to ensure we don't have duplicate bugs/feature requests.
|
37 |
+
- Please be respectful and considerate of others when commenting on issues
|
38 |
+
|
39 |
+
<a name="submit_a_bug_report"></a>
|
40 |
+
## Submit a Bug Report
|
41 |
+
|
42 |
+
Note: DO NOT include your credentials in ANY code examples, descriptions, or media you make public.
|
43 |
+
|
44 |
+
A software bug is a demonstrable issue in the code base. In order for us to diagnose the issue and respond as quickly as possible, please add as much detail as possible into your bug report.
|
45 |
+
|
46 |
+
Before you decide to create a new issue, please try the following:
|
47 |
+
|
48 |
+
1. Check the Github issues tab if the identified issue has already been reported, if so, please add a +1 to the existing post.
|
49 |
+
2. Update to the latest version of this code and check if issue has already been fixed
|
50 |
+
3. Copy and fill in the Bug Report Template we have provided below
|
51 |
+
|
52 |
+
### Please use our Bug Report Template
|
53 |
+
|
54 |
+
In order to make the process easier, we've included a [sample bug report template](https://github.com/sendgrid/php-http-client/.github/ISSUE_TEMPLATE) (borrowed from [Ghost](https://github.com/TryGhost/Ghost/)). The template uses [GitHub flavored markdown](https://help.github.com/articles/github-flavored-markdown/) for formatting.
|
55 |
+
|
56 |
+
<a name="improvements_to_the_codebase"></a>
|
57 |
+
## Improvements to the Codebase
|
58 |
+
|
59 |
+
We welcome direct contributions to the php-http-client code base. Thank you!
|
60 |
+
|
61 |
+
### Development Environment ###
|
62 |
+
|
63 |
+
#### Install and Run Locally ####
|
64 |
+
|
65 |
+
##### Prerequisites #####
|
66 |
+
|
67 |
+
- PHP 5.2 through 5.6
|
68 |
+
- [Composer](https://getcomposer.org/)
|
69 |
+
|
70 |
+
##### Initial setup: #####
|
71 |
+
|
72 |
+
```bash
|
73 |
+
git clone https://github.com/sendgrid/php-http-client.git
|
74 |
+
cd php-http-client
|
75 |
+
```
|
76 |
+
|
77 |
+
## Environment Variables
|
78 |
+
|
79 |
+
First, get your free SendGrid account [here](https://sendgrid.com/free?source=php-http-client).
|
80 |
+
|
81 |
+
Next, update your environment with your [SENDGRID_API_KEY](https://app.sendgrid.com/settings/api_keys).
|
82 |
+
|
83 |
+
```bash
|
84 |
+
echo "export SENDGRID_API_KEY='YOUR_API_KEY'" > sendgrid.env
|
85 |
+
echo "sendgrid.env" >> .gitignore
|
86 |
+
source ./sendgrid.env
|
87 |
+
```
|
88 |
+
|
89 |
+
##### Execute: #####
|
90 |
+
|
91 |
+
See the [examples folder](https://github.com/sendgrid/php-http-client/tree/master/examples
|
92 |
+
<a name="understanding_the_codebase"></a>
|
93 |
+
## Understanding the Code Base
|
94 |
+
|
95 |
+
**/examples**
|
96 |
+
|
97 |
+
Working examples that demonstrate usage.
|
98 |
+
|
99 |
+
**/test/unit**
|
100 |
+
|
101 |
+
Unit tests.
|
102 |
+
|
103 |
+
**/lib/SendGrid/Client.php**
|
104 |
+
|
105 |
+
An HTTP client with a fluent interface using method chaining and reflection. By returning self on [__call](https://github.com/sendgrid/php-http-client/blob/master/lib/client.php#L212) and [_()](https://github.com/sendgrid/php-http-client/blob/master/lib/client.pph#L198), we can dynamically build the URL using method chaining and [__call](https://github.com/sendgrid/php-http-client/blob/master/lib/client.php#L212) allows us to dynamically receive the method calls to achieve reflection.
|
106 |
+
|
107 |
+
This allows for the following mapping from a URL to a method chain:
|
108 |
+
|
109 |
+
`/api_client/{api_key_id}/version` maps to `client->api_client().->_($api_key_id)->version-><method>()` where <method> is a [HTTP verb](https://github.com/sendgrid/php-http-client/blob/master/lib/client.php#L94).
|
110 |
+
|
111 |
+
**/lib/SendGrid/Config.php**
|
112 |
+
|
113 |
+
Loads the environment variables.
|
114 |
+
|
115 |
+
<a name="testing"></a>
|
116 |
+
## Testing
|
117 |
+
|
118 |
+
All PRs require passing tests before the PR will be reviewed.
|
119 |
+
|
120 |
+
All test files are in the [`/test/unit`](https://github.com/sendgrid/php-http-client/tree/master/test/unit) directory.
|
121 |
+
|
122 |
+
For the purposes of contributing to this repo, please update the [`ClientTest.php`](https://github.com/sendgrid/php-http-client/blob/master/test/unit/ClientTest.php) file with unit tests as you modify the code.
|
123 |
+
|
124 |
+
```bash
|
125 |
+
phpunit --bootstrap test/unit/bootstrap.php --filter test* test/unit
|
126 |
+
```
|
127 |
+
|
128 |
+
<a name="style_guidelines_and_naming_conventions"></a>
|
129 |
+
## Style Guidelines & Naming Conventions
|
130 |
+
|
131 |
+
Generally, we follow the style guidelines as suggested by the official language. However, we ask that you conform to the styles that already exist in the library. If you wish to deviate, please explain your reasoning.
|
132 |
+
|
133 |
+
- [pear coding standards](https://pear.php.net/manual/en/standards.php)
|
134 |
+
|
135 |
+
Please run your code through:
|
136 |
+
|
137 |
+
- [PHP Code Sniffer](https://github.com/squizlabs/PHP_CodeSniffer)
|
138 |
+
|
139 |
+
## Creating a Pull Request<a name="creating_a_pull_request"></a>
|
140 |
+
|
141 |
+
1. [Fork](https://help.github.com/fork-a-repo/) the project, clone your fork,
|
142 |
+
and configure the remotes:
|
143 |
+
|
144 |
+
```bash
|
145 |
+
# Clone your fork of the repo into the current directory
|
146 |
+
git clone https://github.com/sendgrid/php-http-client
|
147 |
+
# Navigate to the newly cloned directory
|
148 |
+
cd sendgrid-python
|
149 |
+
# Assign the original repo to a remote called "upstream"
|
150 |
+
git remote add upstream https://github.com/sendgrid/php-http-client
|
151 |
+
```
|
152 |
+
|
153 |
+
2. If you cloned a while ago, get the latest changes from upstream:
|
154 |
+
|
155 |
+
```bash
|
156 |
+
git checkout <dev-branch>
|
157 |
+
git pull upstream <dev-branch>
|
158 |
+
```
|
159 |
+
|
160 |
+
3. Create a new topic branch (off the main project development branch) to
|
161 |
+
contain your feature, change, or fix:
|
162 |
+
|
163 |
+
```bash
|
164 |
+
git checkout -b <topic-branch-name>
|
165 |
+
```
|
166 |
+
|
167 |
+
4. Commit your changes in logical chunks. Please adhere to these [git commit
|
168 |
+
message guidelines](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html)
|
169 |
+
or your code is unlikely be merged into the main project. Use Git's
|
170 |
+
[interactive rebase](https://help.github.com/articles/interactive-rebase)
|
171 |
+
feature to tidy up your commits before making them public.
|
172 |
+
|
173 |
+
4a. Create tests.
|
174 |
+
|
175 |
+
4b. Create or update the example code that demonstrates the functionality of this change to the code.
|
176 |
+
|
177 |
+
5. Locally merge (or rebase) the upstream development branch into your topic branch:
|
178 |
+
|
179 |
+
```bash
|
180 |
+
git pull [--rebase] upstream master
|
181 |
+
```
|
182 |
+
|
183 |
+
6. Push your topic branch up to your fork:
|
184 |
+
|
185 |
+
```bash
|
186 |
+
git push origin <topic-branch-name>
|
187 |
+
```
|
188 |
+
|
189 |
+
7. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/)
|
190 |
+
with a clear title and description against the `master` branch. All tests must be passing before we will review the PR.
|
191 |
+
|
192 |
+
If you have any additional questions, please feel free to [email](mailto:dx@sendgrid.com) us or create an issue in this repo.
|
classes/email/sendgrid/vendor/sendgrid/php-http-client/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
The MIT License (MIT)
|
2 |
+
|
3 |
+
Copyright (c) 2016 SendGrid, Inc.
|
4 |
+
|
5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6 |
+
of this software and associated documentation files (the "Software"), to deal
|
7 |
+
in the Software without restriction, including without limitation the rights
|
8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9 |
+
copies of the Software, and to permit persons to whom the Software is
|
10 |
+
furnished to do so, subject to the following conditions:
|
11 |
+
|
12 |
+
The above copyright notice and this permission notice shall be included in all
|
13 |
+
copies or substantial portions of the Software.
|
14 |
+
|
15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21 |
+
SOFTWARE.
|
22 |
+
|
classes/email/sendgrid/vendor/sendgrid/php-http-client/README.md
ADDED
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[![Travis Badge](https://travis-ci.org/sendgrid/php-http-client.svg?branch=master)](https://travis-ci.org/sendgrid/php-http-client)
|
2 |
+
|
3 |
+
**Quickly and easily access any RESTful or RESTful-like API.**
|
4 |
+
|
5 |
+
If you are looking for the SendGrid API client library, please see [this repo](https://github.com/sendgrid/sendgrid-php).
|
6 |
+
|
7 |
+
# Announcements
|
8 |
+
|
9 |
+
All updates to this library is documented in our [CHANGELOG](https://github.com/sendgrid/php-http-client/blob/master/CHANGELOG.md).
|
10 |
+
|
11 |
+
# Installation
|
12 |
+
|
13 |
+
Add php-http-client to your `composer.json` file. If you are not using [Composer](http://getcomposer.org), you should be. It's an excellent way to manage dependencies in your PHP application.
|
14 |
+
|
15 |
+
```json
|
16 |
+
{
|
17 |
+
"require": {
|
18 |
+
"sendgrid/php-http-client": "3.*"
|
19 |
+
}
|
20 |
+
}
|
21 |
+
```
|
22 |
+
|
23 |
+
Then at the top of your PHP script require the autoloader:
|
24 |
+
|
25 |
+
```php
|
26 |
+
require __DIR__ . '/vendor/autoload.php';
|
27 |
+
```
|
28 |
+
|
29 |
+
Then from the command line:
|
30 |
+
|
31 |
+
```bash
|
32 |
+
composer install
|
33 |
+
```
|
34 |
+
|
35 |
+
# Quick Start
|
36 |
+
|
37 |
+
Here is a quick example:
|
38 |
+
|
39 |
+
`GET /your/api/{param}/call`
|
40 |
+
|
41 |
+
```php
|
42 |
+
require 'vendor/autoload.php';
|
43 |
+
$global_headers = array(Authorization: Basic XXXXXXX);
|
44 |
+
$client = SendGrid\Client('base_url', 'global_headers');
|
45 |
+
$response = $client->your()->api()->_($param)->call()->get();
|
46 |
+
print $response->statusCode();
|
47 |
+
print $response->headers();
|
48 |
+
print $response->body();
|
49 |
+
```
|
50 |
+
|
51 |
+
`POST /your/api/{param}/call` with headers, query parameters and a request body with versioning.
|
52 |
+
|
53 |
+
```php
|
54 |
+
require 'vendor/autoload.php';
|
55 |
+
$global_headers = array(Authorization: Basic XXXXXXX);
|
56 |
+
$client = SendGrid\Client('base_url', 'global_headers');
|
57 |
+
$query_params = array('hello' => 0, 'world' => 1);
|
58 |
+
$request_headers = array('X-Test' => 'test');
|
59 |
+
$data = array('some' => 1, 'awesome' => 2, 'data' => 3);
|
60 |
+
$response = $client->your()->api()->_($param)->call()->post('data',
|
61 |
+
'query_params',
|
62 |
+
'request_headers');
|
63 |
+
print $response->statusCode();
|
64 |
+
print $response->headers();
|
65 |
+
print $response->body();
|
66 |
+
```
|
67 |
+
|
68 |
+
# Usage
|
69 |
+
|
70 |
+
- [Example Code](https://github.com/sendgrid/php-http-client/tree/master/examples)
|
71 |
+
|
72 |
+
## Roadmap
|
73 |
+
|
74 |
+
If you are intersted in the future direction of this project, please take a look at our [milestones](https://github.com/sendgrid/php-http-client/milestones). We would love to hear your feedback.
|
75 |
+
|
76 |
+
## How to Contribute
|
77 |
+
|
78 |
+
We encourage contribution to our libraries, please see our [CONTRIBUTING](https://github.com/sendgrid/php-http-client/blob/master/CONTRIBUTING.md)) guide for details.
|
79 |
+
|
80 |
+
Quick links:
|
81 |
+
|
82 |
+
- [Feature Request](https://github.com/sendgrid/php-http-client/blob/master/CONTRIBUTING.md#feature_request)
|
83 |
+
- [Bug Reports](https://github.com/sendgrid/php-http-client/blob/master/CONTRIBUTING.md#submit_a_bug_report)
|
84 |
+
- [Sign the CLA to Create a Pull Request](https://github.com/sendgrid/php-http-client/blob/master/CONTRIBUTING.md#cla)
|
85 |
+
- [Improvements to the Codebase](https://github.com/sendgrid/php-http-client/blob/master/CONTRIBUTING.md#improvements_to_the_codebase)
|
86 |
+
|
87 |
+
# Thanks
|
88 |
+
|
89 |
+
We were inspired by the work done on [birdy](https://github.com/inueni/birdy) and [universalclient](https://github.com/dgreisen/universalclient).
|
90 |
+
|
91 |
+
# About
|
92 |
+
|
93 |
+
php-http-client is guided and supported by the SendGrid [Developer Experience Team](mailto:dx@sendgrid.com).
|
94 |
+
|
95 |
+
php-http-client is maintained and funded by SendGrid, Inc. The names and logos for php-http-client are trademarks of SendGrid, Inc.
|
96 |
+
|
97 |
+
![SendGrid Logo]
|
98 |
+
(https://uiux.s3.amazonaws.com/2016-logos/email-logo%402x.png)
|
classes/email/sendgrid/vendor/sendgrid/php-http-client/examples/example.php
ADDED
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
// If running this outside of this context, use the following include and
|
3 |
+
// comment out the two includes below
|
4 |
+
// require __DIR__ . '/vendor/autoload.php';
|
5 |
+
include(dirname(__DIR__).'/lib/SendGrid/client.php');
|
6 |
+
// This gets the parent directory, for your current directory use getcwd()
|
7 |
+
$path_to_config = dirname(__DIR__);
|
8 |
+
$api_key = getenv('SENDGRID_API_KEY');
|
9 |
+
$headers = array('Authorization: Bearer '.$api_key);
|
10 |
+
$client = new SendGrid\Client('https://api.sendgrid.com', $headers, '/v3', null);
|
11 |
+
|
12 |
+
// GET Collection
|
13 |
+
$query_params = array('limit' => 100, 'offset' => 0);
|
14 |
+
$request_headers = array('X-Mock: 200');
|
15 |
+
$response = $client->api_keys()->get(null, $query_params, $request_headers);
|
16 |
+
echo $response->statusCode();
|
17 |
+
echo $response->body();
|
18 |
+
echo $response->headers();
|
19 |
+
|
20 |
+
// POST
|
21 |
+
$request_body = array(
|
22 |
+
'name' => 'My PHP API Key',
|
23 |
+
'scopes' => array(
|
24 |
+
'mail.send',
|
25 |
+
'alerts.create',
|
26 |
+
'alerts.read'
|
27 |
+
)
|
28 |
+
);
|
29 |
+
$response = $client->api_keys()->post($request_body);
|
30 |
+
echo $response->statusCode();
|
31 |
+
echo $response->body();
|
32 |
+
echo $response->headers();
|
33 |
+
$response_body = json_decode($response->body());
|
34 |
+
$api_key_id = $response_body->api_key_id;
|
35 |
+
|
36 |
+
// GET Single
|
37 |
+
$response = $client->version('/v3')->api_keys()->_($api_key_id)->get();
|
38 |
+
echo $response->statusCode();
|
39 |
+
echo $response->body();
|
40 |
+
echo $response->headers();
|
41 |
+
|
42 |
+
// PATCH
|
43 |
+
$request_body = array(
|
44 |
+
'name' => 'A New Hope'
|
45 |
+
);
|
46 |
+
$response = $client->api_keys()->_($api_key_id)->patch($request_body);
|
47 |
+
echo $response->statusCode();
|
48 |
+
echo $response->body();
|
49 |
+
echo $response->headers();
|
50 |
+
|
51 |
+
// PUT
|
52 |
+
$request_body = array(
|
53 |
+
'name' => 'A New Hope',
|
54 |
+
'scopes' => array(
|
55 |
+
'user.profile.read',
|
56 |
+
'user.profile.update'
|
57 |
+
)
|
58 |
+
);
|
59 |
+
$response = $client->api_keys()->_($api_key_id)->put($request_body);
|
60 |
+
echo $response->statusCode();
|
61 |
+
echo $response->body();
|
62 |
+
echo $response->headers();
|
63 |
+
|
64 |
+
// DELETE
|
65 |
+
$response = $client->api_keys()->_($api_key_id)->delete();
|
66 |
+
echo $response->statusCode();
|
67 |
+
echo $response->body();
|
68 |
+
echo $response->headers();
|
69 |
+
|
70 |
+
?>
|
classes/email/sendgrid/vendor/sendgrid/php-http-client/lib/SendGrid/Client.php
ADDED
@@ -0,0 +1,232 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* HTTP Client library
|
4 |
+
*
|
5 |
+
* PHP version 5.2
|
6 |
+
*
|
7 |
+
* @author Matt Bernier <dx@sendgrid.com>
|
8 |
+
* @author Elmer Thomas <dx@sendgrid.com>
|
9 |
+
* @copyright 2016 SendGrid
|
10 |
+
* @license https://opensource.org/licenses/MIT The MIT License
|
11 |
+
* @version GIT: <git_id>
|
12 |
+
* @link http://packagist.org/packages/sendgrid/php-http-client
|
13 |
+
*/
|
14 |
+
namespace SendGrid;
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Holds the response from an API call.
|
18 |
+
*/
|
19 |
+
class Response
|
20 |
+
{
|
21 |
+
/**
|
22 |
+
* Setup the response data
|
23 |
+
*
|
24 |
+
* @param int $status_code the status code.
|
25 |
+
* @param array $response_body the response body as an array.
|
26 |
+
* @param array $response_headers an array of response headers.
|
27 |
+
*/
|
28 |
+
function __construct($status_code = null, $response_body = null, $response_headers = null)
|
29 |
+
{
|
30 |
+
$this->_status_code = $status_code;
|
31 |
+
$this->_body = $response_body;
|
32 |
+
$this->_headers = $response_headers;
|
33 |
+
}
|
34 |
+
|
35 |
+
/**
|
36 |
+
* The status code
|
37 |
+
*
|
38 |
+
* @return integer
|
39 |
+
*/
|
40 |
+
public function statusCode()
|
41 |
+
{
|
42 |
+
return $this->_status_code;
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* The response body
|
47 |
+
*
|
48 |
+
* @return array
|
49 |
+
*/
|
50 |
+
public function body()
|
51 |
+
{
|
52 |
+
return $this->_body;
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* The response headers
|
57 |
+
*
|
58 |
+
* @return array
|
59 |
+
*/
|
60 |
+
public function headers()
|
61 |
+
{
|
62 |
+
return $this->_headers;
|
63 |
+
}
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Quickly and easily access any REST or REST-like API.
|
68 |
+
*/
|
69 |
+
class Client
|
70 |
+
{
|
71 |
+
|
72 |
+
public
|
73 |
+
$host,
|
74 |
+
$request_headers,
|
75 |
+
$version,
|
76 |
+
$url_path,
|
77 |
+
$methods;
|
78 |
+
|
79 |
+
/**
|
80 |
+
* Initialize the client
|
81 |
+
*
|
82 |
+
* @param string $host the base url (e.g. https://api.sendgrid.com)
|
83 |
+
* @param array $request_headers global request headers
|
84 |
+
* @param string $version api version (configurable)
|
85 |
+
* @param array $url_path holds the segments of the url path
|
86 |
+
*/
|
87 |
+
function __construct($host, $request_headers = null, $version = null, $url_path = null)
|
88 |
+
{
|
89 |
+
$this->host = $host;
|
90 |
+
$this->request_headers = ($request_headers ? $request_headers : []);
|
91 |
+
$this->version = $version;
|
92 |
+
$this->url_path = ($url_path ? $url_path : []);
|
93 |
+
// These are the supported HTTP verbs
|
94 |
+
$this->methods = ['delete', 'get', 'patch', 'post', 'put'];
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Make a new Client object
|
99 |
+
*
|
100 |
+
* @param string $name name of the url segment
|
101 |
+
*
|
102 |
+
* @return Client object
|
103 |
+
*/
|
104 |
+
private function _buildClient($name = null)
|
105 |
+
{
|
106 |
+
if(isset($name)) {
|
107 |
+
array_push($this->url_path, $name);
|
108 |
+
}
|
109 |
+
$url_path = $this->url_path;
|
110 |
+
$this->url_path = [];
|
111 |
+
return new Client($this->host, $this->request_headers, $this->version, $url_path);
|
112 |
+
}
|
113 |
+
|
114 |
+
/**
|
115 |
+
* Subclass this function for your own needs.
|
116 |
+
* Or just pass the version as part of the URL
|
117 |
+
* (e.g. client._('/v3'))
|
118 |
+
*
|
119 |
+
* @param string $url URI portion of the full URL being requested
|
120 |
+
*
|
121 |
+
* @return string
|
122 |
+
*/
|
123 |
+
private function _buildVersionedUrl($url)
|
124 |
+
{
|
125 |
+
return sprintf("%s%s%s", $this->host, $this->version, $url);
|
126 |
+
}
|
127 |
+
|
128 |
+
/**
|
129 |
+
* Build the final URL to be passed
|
130 |
+
*
|
131 |
+
* @param array $query_params an array of all the query parameters
|
132 |
+
*
|
133 |
+
* @return string
|
134 |
+
*/
|
135 |
+
private function _buildUrl($query_params = null)
|
136 |
+
{
|
137 |
+
$url = '/'.implode('/', $this->url_path);
|
138 |
+
if (isset($query_params)) {
|
139 |
+
$url_values = http_build_query($query_params);
|
140 |
+
$url = sprintf('%s?%s', $url, $url_values);
|
141 |
+
}
|
142 |
+
if (isset($this->version)) {
|
143 |
+
$url = $this->_buildVersionedUrl($url);
|
144 |
+
} else {
|
145 |
+
$url = sprintf('%s%s', $this->host, $url);;
|
146 |
+
}
|
147 |
+
return $url;
|
148 |
+
}
|
149 |
+
|
150 |
+
/**
|
151 |
+
* Make the API call and return the response. This is separated into
|
152 |
+
* it's own function, so we can mock it easily for testing.
|
153 |
+
*
|
154 |
+
* @param array $method the HTTP verb
|
155 |
+
* @param string $url the final url to call
|
156 |
+
* @param array $request_body request body
|
157 |
+
* @param array $request_headers any additional request headers
|
158 |
+
*
|
159 |
+
* @return Response object
|
160 |
+
*/
|
161 |
+
public function makeRequest($method, $url, $request_body = null, $request_headers = null)
|
162 |
+
{
|
163 |
+
$curl = curl_init($url);
|
164 |
+
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
165 |
+
curl_setopt($curl, CURLOPT_HEADER, 1);
|
166 |
+
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, strtoupper($method));
|
167 |
+
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
|
168 |
+
if(isset($request_headers)) {
|
169 |
+
$this->request_headers = array_merge($this->request_headers, $request_headers);
|
170 |
+
}
|
171 |
+
if(isset($request_body)) {
|
172 |
+
$request_body = json_encode($request_body);
|
173 |
+
curl_setopt($curl, CURLOPT_POSTFIELDS, $request_body);
|
174 |
+
$content_length = array('Content-Length: ' . strlen($request_body));
|
175 |
+
$content_type = array('Content-Type: application/json');
|
176 |
+
$this->request_headers = array_merge($this->request_headers, $content_type);
|
177 |
+
}
|
178 |
+
curl_setopt($curl, CURLOPT_HTTPHEADER, $this->request_headers);
|
179 |
+
$curl_response = curl_exec($curl);
|
180 |
+
$header_size = curl_getinfo($curl, CURLINFO_HEADER_SIZE);
|
181 |
+
$status_code = curl_getinfo($curl, CURLINFO_HTTP_CODE);
|
182 |
+
$response_body = substr($curl_response, $header_size);
|
183 |
+
$response_header = substr($curl_response, 0, $header_size);
|
184 |
+
|
185 |
+
curl_close($curl);
|
186 |
+
|
187 |
+
return new Response($status_code, $response_body, $response_header);
|
188 |
+
}
|
189 |
+
|
190 |
+
/**
|
191 |
+
* Add variable values to the url.
|
192 |
+
* (e.g. /your/api/{variable_value}/call)
|
193 |
+
* Another example: if you have a PHP reserved word, such as and,
|
194 |
+
* in your url, you must use this method.
|
195 |
+
*
|
196 |
+
* @param string $name name of the url segment
|
197 |
+
*
|
198 |
+
* @return Client object
|
199 |
+
*/
|
200 |
+
public function _($name = null)
|
201 |
+
{
|
202 |
+
return $this->_buildClient($name);
|
203 |
+
}
|
204 |
+
|
205 |
+
/**
|
206 |
+
* Dynamically add method calls to the url, then call a method.
|
207 |
+
* (e.g. client.name.name.method())
|
208 |
+
*
|
209 |
+
* @param string $name name of the dynamic method call or HTTP verb
|
210 |
+
* @param array $args parameters passed with the method call
|
211 |
+
*
|
212 |
+
* @return Client or Response object
|
213 |
+
*/
|
214 |
+
public function __call($name, $args)
|
215 |
+
{
|
216 |
+
if($name == 'version') {
|
217 |
+
$this->version = $args[0];
|
218 |
+
return $this->_();
|
219 |
+
}
|
220 |
+
|
221 |
+
if (in_array($name, $this->methods)) {
|
222 |
+
$query_params = ((count($args) >= 2) ? $args[1] : null);
|
223 |
+
$url = $this->_buildUrl($query_params);
|
224 |
+
$request_body = ($args ? $args[0] : null);
|
225 |
+
$request_headers = ((count($args) == 3) ? $args[2] : null);
|
226 |
+
return $this->makeRequest($name, $url, $request_body, $request_headers);
|
227 |
+
}
|
228 |
+
|
229 |
+
return $this->_($name);
|
230 |
+
}
|
231 |
+
}
|
232 |
+
?>
|
classes/email/settings.php
ADDED
@@ -0,0 +1,337 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Handles settings for Caldera Forms emails
|
5 |
+
*
|
6 |
+
* @package Caldera_Forms
|
7 |
+
* @author Josh Pollock <Josh@CalderaWP.com>
|
8 |
+
* @license GPL-2.0+
|
9 |
+
* @link
|
10 |
+
* @copyright 2016 CalderaWP LLC
|
11 |
+
*/
|
12 |
+
class Caldera_Forms_Email_Settings {
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Name of options key to store settings
|
16 |
+
*
|
17 |
+
* @since 1.4.0
|
18 |
+
*
|
19 |
+
* @var string
|
20 |
+
*/
|
21 |
+
protected static $option_key = '_caldera_forms_email_api_settings';
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Current settings
|
25 |
+
*
|
26 |
+
* @since 1.4.0
|
27 |
+
*
|
28 |
+
* @var array
|
29 |
+
*/
|
30 |
+
protected static $settings;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Nonce action for settings UI
|
34 |
+
*
|
35 |
+
* @since 1.4.0
|
36 |
+
*
|
37 |
+
* @var string
|
38 |
+
*/
|
39 |
+
protected static $nonce_action = 'cf-emails';
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Default settings
|
43 |
+
*
|
44 |
+
* @since 1.4.0
|
45 |
+
*
|
46 |
+
* @var array
|
47 |
+
*/
|
48 |
+
protected static $defaults = array(
|
49 |
+
'sendgrid' => array(
|
50 |
+
'key' => false
|
51 |
+
),
|
52 |
+
'wp' => array(
|
53 |
+
|
54 |
+
),
|
55 |
+
'method' => 'wp'
|
56 |
+
);
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Get settings
|
60 |
+
*
|
61 |
+
* @since 1.4.0
|
62 |
+
*
|
63 |
+
* @return array
|
64 |
+
*/
|
65 |
+
public static function get_settings() {
|
66 |
+
if ( null == self::$settings ) {
|
67 |
+
self::$settings = get_option( self::$option_key, array() );
|
68 |
+
self::$settings = wp_parse_args( self::$settings, self::$defaults );
|
69 |
+
}
|
70 |
+
|
71 |
+
return self::$settings;
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Get API keys
|
76 |
+
*
|
77 |
+
* @since 1.4.0
|
78 |
+
*
|
79 |
+
* @param string $api Which API to get key for
|
80 |
+
*
|
81 |
+
* @return mixed
|
82 |
+
*/
|
83 |
+
public static function get_key( $api ) {
|
84 |
+
if( self::is_allowed_method( $api ) ){
|
85 |
+
return self::$settings[ $api ]['key'];
|
86 |
+
}
|
87 |
+
|
88 |
+
}
|
89 |
+
|
90 |
+
/**
|
91 |
+
* Save an API key
|
92 |
+
*
|
93 |
+
* @since 1.4.0
|
94 |
+
*
|
95 |
+
* @param string $api API to save key for
|
96 |
+
* @param string $key API Key
|
97 |
+
* @param bool $save Optional. If true, the default, settings will be saved.
|
98 |
+
*/
|
99 |
+
public static function save_key( $api, $key, $save = true ) {
|
100 |
+
if ( self::is_allowed_method( $api ) ) {
|
101 |
+
if( ! is_array( self::$settings[ $api ] ) ){
|
102 |
+
self::$settings[ $api ] = array( 'key' => false );
|
103 |
+
}
|
104 |
+
|
105 |
+
self::$settings[ $api ][ 'key' ] = $key;
|
106 |
+
if ( $save ) {
|
107 |
+
self::update_settings();
|
108 |
+
}
|
109 |
+
|
110 |
+
|
111 |
+
}
|
112 |
+
|
113 |
+
}
|
114 |
+
|
115 |
+
/**
|
116 |
+
* Check if is an allowed API
|
117 |
+
*
|
118 |
+
* @since 1.4.0
|
119 |
+
*
|
120 |
+
* @param string $api Name of API
|
121 |
+
*
|
122 |
+
* @return bool
|
123 |
+
*/
|
124 |
+
public static function is_allowed_method( $api ){
|
125 |
+
return in_array( $api, self::allowed_apis() );
|
126 |
+
|
127 |
+
}
|
128 |
+
|
129 |
+
/**
|
130 |
+
* Save email settings
|
131 |
+
*
|
132 |
+
* @uses "wp_ajax_cf_email_save" action
|
133 |
+
*
|
134 |
+
* @since 1.3.5
|
135 |
+
*/
|
136 |
+
public static function save(){
|
137 |
+
if( ! current_user_can( Caldera_Forms::get_manage_cap( 'admin' ) ) ) {
|
138 |
+
wp_die();
|
139 |
+
}
|
140 |
+
|
141 |
+
if( isset( $_POST[ 'nonce' ] ) && wp_verify_nonce( $_POST[ 'nonce' ], self::$nonce_action ) ){
|
142 |
+
if( isset( $_POST[ 'method' ] ) ){
|
143 |
+
if ( self::is_allowed_method( $_POST[ 'method' ] ) ) {
|
144 |
+
self::$settings[ 'method' ] = $_POST[ 'method' ];
|
145 |
+
}
|
146 |
+
}
|
147 |
+
|
148 |
+
foreach( self::allowed_apis() as $api ){
|
149 |
+
if( isset( $_POST[ $api ] ) && is_string( $_POST[ $api ] ) ){
|
150 |
+
self::save_key( $api, trim( strip_tags( $_POST[ $api ] ) ), false );
|
151 |
+
}
|
152 |
+
}
|
153 |
+
|
154 |
+
self::update_settings();
|
155 |
+
status_header( 200);
|
156 |
+
wp_send_json_success();
|
157 |
+
|
158 |
+
|
159 |
+
}
|
160 |
+
|
161 |
+
wp_send_json_error();
|
162 |
+
|
163 |
+
}
|
164 |
+
|
165 |
+
|
166 |
+
/**
|
167 |
+
* If possible add hook to use set API
|
168 |
+
*
|
169 |
+
* @uses "init" action
|
170 |
+
*
|
171 |
+
* @since 1.4.0
|
172 |
+
*/
|
173 |
+
public static function maybe_add_hooks() {
|
174 |
+
//don't load in PHP 5.2
|
175 |
+
if ( ! version_compare( PHP_VERSION, '5.3.0', '>=' ) ) {
|
176 |
+
return;
|
177 |
+
}
|
178 |
+
|
179 |
+
self::get_settings();
|
180 |
+
|
181 |
+
if( 'wp' !== self::get_method() ){
|
182 |
+
foreach ( self::allowed_apis() as $api ) {
|
183 |
+
if ( self::valid( $api ) ) {
|
184 |
+
add_filter( 'caldera_forms_mailer', array( 'Caldera_Forms_Email_Callbacks', $api ), 26, 3 );
|
185 |
+
break;
|
186 |
+
}
|
187 |
+
|
188 |
+
}
|
189 |
+
|
190 |
+
}
|
191 |
+
|
192 |
+
|
193 |
+
}
|
194 |
+
|
195 |
+
/**
|
196 |
+
* Create nonce field for settings
|
197 |
+
*
|
198 |
+
* @since 1.4.0
|
199 |
+
*
|
200 |
+
* @return string
|
201 |
+
*/
|
202 |
+
public static function nonce_field(){
|
203 |
+
return wp_nonce_field( self::$nonce_action, 'cfemail', false, false );
|
204 |
+
}
|
205 |
+
|
206 |
+
|
207 |
+
/**
|
208 |
+
* Is API valid?
|
209 |
+
*
|
210 |
+
* @since 1.4.0
|
211 |
+
*
|
212 |
+
* @param string $api API name
|
213 |
+
|
214 |
+
* @return bool
|
215 |
+
*/
|
216 |
+
protected static function valid( $api ) {
|
217 |
+
self::get_settings();
|
218 |
+
if ( self::is_allowed_method( $api ) ) {
|
219 |
+
if ( isset( self::$settings[ $api ]['key'] ) && ! empty( self::$settings[ $api ]['key'] ) ) {
|
220 |
+
return true;
|
221 |
+
|
222 |
+
}
|
223 |
+
|
224 |
+
}
|
225 |
+
|
226 |
+
}
|
227 |
+
|
228 |
+
/**
|
229 |
+
* Get an array of valid APIs
|
230 |
+
*
|
231 |
+
* @since 1.4.0
|
232 |
+
*
|
233 |
+
* @return array
|
234 |
+
*/
|
235 |
+
protected static function allowed_apis() {
|
236 |
+
/**
|
237 |
+
* Filter allowed email APIs
|
238 |
+
*
|
239 |
+
* @since 1.4.0
|
240 |
+
*
|
241 |
+
* @param array $apis Array of API names that are valid.
|
242 |
+
*/
|
243 |
+
return apply_filters( 'caldera_forms_allowed_email_apis', array(
|
244 |
+
'wp',
|
245 |
+
'sendgrid',
|
246 |
+
'caldera'
|
247 |
+
) );
|
248 |
+
}
|
249 |
+
|
250 |
+
/**
|
251 |
+
* Create email settings UI
|
252 |
+
*
|
253 |
+
* @uses "caldera_forms_admin_footer" action
|
254 |
+
*
|
255 |
+
* @since 1.4.0
|
256 |
+
*/
|
257 |
+
public static function ui() {
|
258 |
+
if ( ! version_compare( PHP_VERSION, '5.4.0', '>=' ) ) {
|
259 |
+
printf( '<div class="notice notice-error error"><p>%s</p>', esc_html__( 'Switching email services requires PHP 5.4 or later. PHP 5.6 is strongly recommended.', 'caldera-forms' ) );
|
260 |
+
}else{
|
261 |
+
include CFCORE_PATH . '/ui/emails/settings.php';
|
262 |
+
|
263 |
+
}
|
264 |
+
|
265 |
+
|
266 |
+
|
267 |
+
}
|
268 |
+
|
269 |
+
/**
|
270 |
+
* Get current method being used
|
271 |
+
*
|
272 |
+
* @since 1.4.0
|
273 |
+
*
|
274 |
+
* @return string
|
275 |
+
*/
|
276 |
+
public static function get_method(){
|
277 |
+
if( ! isset( self::$settings[ 'method' ] ) ){
|
278 |
+
return 'wp';
|
279 |
+
|
280 |
+
}
|
281 |
+
|
282 |
+
return self::$settings[ 'method' ];
|
283 |
+
}
|
284 |
+
|
285 |
+
/**
|
286 |
+
* Update email settings
|
287 |
+
*
|
288 |
+
* @since 1.4.0
|
289 |
+
*/
|
290 |
+
protected static function update_settings() {
|
291 |
+
update_option( self::$option_key, self::$settings );
|
292 |
+
}
|
293 |
+
|
294 |
+
/**
|
295 |
+
* Sanitize/validate save of this setting
|
296 |
+
*
|
297 |
+
* @since 1.4.0
|
298 |
+
*
|
299 |
+
* @uses "pre_update_option__caldera_forms_email_api_settings"
|
300 |
+
*
|
301 |
+
* @param mixed $values Values to be saved
|
302 |
+
*
|
303 |
+
* @return array
|
304 |
+
*/
|
305 |
+
public static function sanitize_save( $values ){
|
306 |
+
if( ! is_array( $values ) ){
|
307 |
+
return self::$defaults;
|
308 |
+
}
|
309 |
+
|
310 |
+
foreach ( $values as $key => $value ){
|
311 |
+
if( ! array_key_exists( $key, self::$defaults ) ){
|
312 |
+
unset( $values[ $key ] );
|
313 |
+
}elseif( 'method' == $key ){
|
314 |
+
if( ! self::is_allowed_method( $value ) ){
|
315 |
+
$values[ 'method' ] = 'wp';
|
316 |
+
}
|
317 |
+
}else{
|
318 |
+
foreach( $value as $k => $v ){
|
319 |
+
if( ! in_array( $k, array( 'key', 'use' ) ) ){
|
320 |
+
unset( $values[ $key ][ $k ] );
|
321 |
+
}
|
322 |
+
}
|
323 |
+
}
|
324 |
+
}
|
325 |
+
|
326 |
+
foreach ( self::allowed_apis() as $api ){
|
327 |
+
if( ! isset( $values[ $api ] ) ){
|
328 |
+
$values[ $api ] = self::$defaults[ $api ];
|
329 |
+
}
|
330 |
+
}
|
331 |
+
|
332 |
+
|
333 |
+
return $values;
|
334 |
+
|
335 |
+
}
|
336 |
+
|
337 |
+
}
|
classes/entry.php
ADDED
@@ -0,0 +1,425 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* CRUD for Caldera Forms entries
|
5 |
+
*
|
6 |
+
* @package Caldera_Forms
|
7 |
+
* @author Josh Pollock <Josh@CalderaWP.com>
|
8 |
+
* @license GPL-2.0+
|
9 |
+
* @link
|
10 |
+
* @copyright 2016 CalderaWP LLC
|
11 |
+
*/
|
12 |
+
class Caldera_Forms_Entry {
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Form config
|
16 |
+
*
|
17 |
+
* @since 1.4.0
|
18 |
+
*
|
19 |
+
* @var array
|
20 |
+
*/
|
21 |
+
protected $form;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Entry ID
|
25 |
+
*
|
26 |
+
* @since 1.4.0
|
27 |
+
*
|
28 |
+
* @var array
|
29 |
+
*/
|
30 |
+
protected $entry_id;
|
31 |
+
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Field values for entry
|
35 |
+
*
|
36 |
+
* @since 1.4.0
|
37 |
+
*
|
38 |
+
* @var array
|
39 |
+
*/
|
40 |
+
protected $fields;
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Meta values for entry
|
44 |
+
*
|
45 |
+
* @since 1.4.0
|
46 |
+
*
|
47 |
+
* @var array
|
48 |
+
*/
|
49 |
+
protected $meta;
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Entry object
|
53 |
+
*
|
54 |
+
* @since 1.4.0
|
55 |
+
*
|
56 |
+
* @var Caldera_Forms_Entry_Entry
|
57 |
+
*/
|
58 |
+
protected $entry;
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Was an entry queried for and found?
|
62 |
+
*
|
63 |
+
* @since 1.4.0
|
64 |
+
*
|
65 |
+
* @var bool
|
66 |
+
*/
|
67 |
+
protected $found;
|
68 |
+
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Caldera_Forms_Entry constructor.
|
72 |
+
*
|
73 |
+
* @since 1.4.0
|
74 |
+
*
|
75 |
+
* @param array $form For config
|
76 |
+
* @param int|bool $entry_id Optional. Passing ID will load saved entry, leave false, the default when creating new entry.
|
77 |
+
* @param Caldera_Forms_Entry_Entry $entry Optional. Entry object.
|
78 |
+
*/
|
79 |
+
public function __construct( array $form, $entry_id = false, Caldera_Forms_Entry_Entry $entry = null ) {
|
80 |
+
$this->form = $form;
|
81 |
+
if( null !== $entry ){
|
82 |
+
if( null != $entry->id ){
|
83 |
+
$this->entry_id = $entry->id;
|
84 |
+
}
|
85 |
+
|
86 |
+
$this->entry = $entry;
|
87 |
+
}elseif( is_numeric( $entry_id ) ){
|
88 |
+
$this->entry_id = $entry_id;
|
89 |
+
}
|
90 |
+
|
91 |
+
if( is_numeric( $this->entry_id ) ){
|
92 |
+
$this->query();
|
93 |
+
}
|
94 |
+
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Get entry object
|
99 |
+
*
|
100 |
+
* @since 1.4.0
|
101 |
+
*
|
102 |
+
* @param \Caldera_Forms_Entry_Entry $entry
|
103 |
+
*/
|
104 |
+
public function get_entry_object( Caldera_Forms_Entry_Entry $entry ){
|
105 |
+
$this->entry = $entry;
|
106 |
+
}
|
107 |
+
|
108 |
+
/**
|
109 |
+
* Get form ID
|
110 |
+
*
|
111 |
+
* @since 1.4.0
|
112 |
+
*
|
113 |
+
* @return mixed
|
114 |
+
*/
|
115 |
+
public function get_form_id(){
|
116 |
+
return $this->form[ 'id' ];
|
117 |
+
}
|
118 |
+
|
119 |
+
/**
|
120 |
+
* Get entry object
|
121 |
+
*
|
122 |
+
* Has basic info, no fields or values
|
123 |
+
*
|
124 |
+
* @since 1.4.0
|
125 |
+
*
|
126 |
+
* @return \Caldera_Forms_Entry_Entry
|
127 |
+
*/
|
128 |
+
public function get_entry(){
|
129 |
+
return $this->entry;
|
130 |
+
}
|
131 |
+
|
132 |
+
/**
|
133 |
+
* Was a query performed and an entry found?
|
134 |
+
*
|
135 |
+
* @since 1.4.0
|
136 |
+
*
|
137 |
+
* @return bool
|
138 |
+
*/
|
139 |
+
public function found(){
|
140 |
+
return $this->found;
|
141 |
+
}
|
142 |
+
|
143 |
+
/**
|
144 |
+
* Get entry ID
|
145 |
+
*
|
146 |
+
* @since 1.4.0
|
147 |
+
*
|
148 |
+
* @return int
|
149 |
+
*/
|
150 |
+
public function get_entry_id(){
|
151 |
+
if( null == $this->entry_id && is_object( $this->entry ) ){
|
152 |
+
$this->entry_id = $this->entry->id;
|
153 |
+
}
|
154 |
+
return $this->entry_id;
|
155 |
+
}
|
156 |
+
|
157 |
+
/**
|
158 |
+
* Get all field values
|
159 |
+
*
|
160 |
+
* @since 1.4.0
|
161 |
+
*
|
162 |
+
* @return array
|
163 |
+
*/
|
164 |
+
public function get_fields(){
|
165 |
+
if ( ! empty( $this->fields ) ) {
|
166 |
+
/** @var Caldera_Forms_Entry_Field $field */
|
167 |
+
foreach ( $this->fields as $index => $field ) {
|
168 |
+
$field->value = $field->apply_filter( 'value', $field->value );
|
169 |
+
$this->fields[ $index ] = $field;
|
170 |
+
}
|
171 |
+
|
172 |
+
}
|
173 |
+
|
174 |
+
return $this->fields;
|
175 |
+
|
176 |
+
}
|
177 |
+
|
178 |
+
/**
|
179 |
+
* @param $id
|
180 |
+
*
|
181 |
+
* @return Caldera_Forms_Entry_Field
|
182 |
+
*/
|
183 |
+
public function get_field( $id ){
|
184 |
+
if( isset( $this->fields[ $id ] ) ){
|
185 |
+
return $this->fields[ $id ];
|
186 |
+
}
|
187 |
+
}
|
188 |
+
|
189 |
+
/**
|
190 |
+
* Get all meta values
|
191 |
+
*
|
192 |
+
* @since 1.4.0
|
193 |
+
*
|
194 |
+
* @return array
|
195 |
+
*/
|
196 |
+
public function get_meta(){
|
197 |
+
return $this->meta;
|
198 |
+
}
|
199 |
+
|
200 |
+
|
201 |
+
/**
|
202 |
+
* Query DB for saved entry data
|
203 |
+
*
|
204 |
+
* @since 1.4.0
|
205 |
+
*/
|
206 |
+
public function query(){
|
207 |
+
if ( ! is_object( $this->entry ) ) {
|
208 |
+
$this->find_entry();
|
209 |
+
}
|
210 |
+
|
211 |
+
if( is_numeric( $this->entry_id ) ){
|
212 |
+
$this->find_fields();
|
213 |
+
$this->find_metas();
|
214 |
+
}
|
215 |
+
}
|
216 |
+
|
217 |
+
/**
|
218 |
+
* Find the entry in DB and set the entry property of this class
|
219 |
+
*
|
220 |
+
* @since 1.4.0
|
221 |
+
*/
|
222 |
+
protected function find_entry(){
|
223 |
+
global $wpdb;
|
224 |
+
$table = $wpdb->prefix . 'cf_form_entries';
|
225 |
+
$sql = $wpdb->prepare( "SELECT * FROM $table WHERE `id` = %d AND `form_id` = %s", $this->entry_id, $this->form[ 'ID' ] );
|
226 |
+
$results = $wpdb->get_results( $sql );
|
227 |
+
if ( ! empty( $results ) ) {
|
228 |
+
$this->found = true;
|
229 |
+
$this->entry = new Caldera_Forms_Entry_Entry();
|
230 |
+
$this->entry->set_form_object( $results[ 0 ] );
|
231 |
+
}else{
|
232 |
+
$this->found = false;
|
233 |
+
}
|
234 |
+
|
235 |
+
}
|
236 |
+
|
237 |
+
/**
|
238 |
+
* Find field values and set in fields property of this class
|
239 |
+
*
|
240 |
+
* @since 1.4.0
|
241 |
+
*/
|
242 |
+
protected function find_fields(){
|
243 |
+
global $wpdb;
|
244 |
+
$table = $wpdb->prefix . 'cf_form_entry_values';
|
245 |
+
$sql = $wpdb->prepare( "SELECT * FROM $table WHERE `entry_id` = %d", $this->entry_id );
|
246 |
+
$results = $wpdb->get_results( $sql );
|
247 |
+
if( ! empty( $results ) ){
|
248 |
+
foreach( $results as $result ){
|
249 |
+
$_field = new Caldera_Forms_Entry_Field( $result );
|
250 |
+
$this->fields[] = $_field;
|
251 |
+
}
|
252 |
+
}
|
253 |
+
}
|
254 |
+
|
255 |
+
/**
|
256 |
+
* Find metas and set in meta property of this class
|
257 |
+
*
|
258 |
+
* @since 1.4.0
|
259 |
+
*/
|
260 |
+
protected function find_metas(){
|
261 |
+
global $wpdb;
|
262 |
+
$table = $wpdb->prefix . 'cf_form_entry_meta';
|
263 |
+
$sql = $wpdb->prepare( "SELECT * FROM $table WHERE `entry_id` = %d", $this->entry_id );
|
264 |
+
$results = $wpdb->get_results( $sql );
|
265 |
+
if( ! empty( $results ) ){
|
266 |
+
foreach ( $results as $result ){
|
267 |
+
$_meta = new Caldera_Forms_Entry_Meta();
|
268 |
+
$_meta = $_meta->set_form_object( $result );
|
269 |
+
$this->meta[] = $_meta;
|
270 |
+
}
|
271 |
+
}
|
272 |
+
}
|
273 |
+
|
274 |
+
/**
|
275 |
+
* Save entry
|
276 |
+
*
|
277 |
+
* @since 1.4.0
|
278 |
+
*
|
279 |
+
* @return array|int|string
|
280 |
+
*/
|
281 |
+
public function save( ){
|
282 |
+
$this->save_entry();
|
283 |
+
if( is_numeric( $this->entry_id ) ){
|
284 |
+
if ( ! empty( $this->fields ) ) {
|
285 |
+
foreach ( $this->fields as $i => $field ) {
|
286 |
+
$this->fields[ $i ] = $this->save_field( $field );
|
287 |
+
|
288 |
+
}
|
289 |
+
|
290 |
+
}
|
291 |
+
|
292 |
+
if ( ! empty( $this->meta ) ) {
|
293 |
+
foreach ( $this->meta as $i => $meta ) {
|
294 |
+
$this->meta[ $i ] = $this->save_meta( $meta );
|
295 |
+
}
|
296 |
+
|
297 |
+
}
|
298 |
+
}
|
299 |
+
|
300 |
+
return $this->entry_id;
|
301 |
+
}
|
302 |
+
|
303 |
+
/**
|
304 |
+
* Update entry status
|
305 |
+
*
|
306 |
+
* @since 1.4.0
|
307 |
+
*
|
308 |
+
* @param string $status
|
309 |
+
*
|
310 |
+
* @return bool
|
311 |
+
*/
|
312 |
+
public function update_status( $status ){
|
313 |
+
if( ! $this->allowed_status( $status ) ){
|
314 |
+
return false;
|
315 |
+
}
|
316 |
+
|
317 |
+
global $wpdb;
|
318 |
+
$wpdb->update( $wpdb->prefix . 'cf_form_entries', array('status' => $status ), array( 'id' => $this->entry_id ) );
|
319 |
+
}
|
320 |
+
|
321 |
+
/**
|
322 |
+
* Add a field value to this entry
|
323 |
+
*
|
324 |
+
* @since 1.4.0
|
325 |
+
*
|
326 |
+
* @param \Caldera_Forms_Entry_Field $field
|
327 |
+
*/
|
328 |
+
public function add_field( Caldera_Forms_Entry_Field $field ){
|
329 |
+
|
330 |
+
$field->entry_id = $this->entry_id;
|
331 |
+
$this->fields[] = $field;
|
332 |
+
|
333 |
+
}
|
334 |
+
|
335 |
+
/**
|
336 |
+
* Add a meta to this entry
|
337 |
+
*
|
338 |
+
* @since 1.4.0
|
339 |
+
*
|
340 |
+
* @param \Caldera_Forms_Entry_Meta $item
|
341 |
+
*/
|
342 |
+
public function add_meta( Caldera_Forms_Entry_Meta $item ){
|
343 |
+
$this->meta[] = $item;
|
344 |
+
}
|
345 |
+
|
346 |
+
/**
|
347 |
+
* Save entry in DB
|
348 |
+
*
|
349 |
+
* @since 1.4.0
|
350 |
+
*/
|
351 |
+
protected function save_entry() {
|
352 |
+
global $wpdb;
|
353 |
+
if( null == $this->entry ) {
|
354 |
+
//@todo some error or exception or something
|
355 |
+
return;
|
356 |
+
}
|
357 |
+
$wpdb->insert( $wpdb->prefix . 'cf_form_entries', $this->entry->to_array() );
|
358 |
+
$this->entry_id = $this->entry->id = $wpdb->insert_id;
|
359 |
+
}
|
360 |
+
|
361 |
+
/**
|
362 |
+
* Save a field in db
|
363 |
+
*
|
364 |
+
* @since 1.4.0
|
365 |
+
*
|
366 |
+
* @param \Caldera_Forms_Entry_Field $field
|
367 |
+
*/
|
368 |
+
protected function save_field( Caldera_Forms_Entry_Field $field ){
|
369 |
+
$field->entry_id = $this->entry_id;
|
370 |
+
global $wpdb;
|
371 |
+
$data = $field->to_array();
|
372 |
+
unset( $data[ 'id' ] );
|
373 |
+
$wpdb->insert( $wpdb->prefix . 'cf_form_entry_values', $data );
|
374 |
+
$field->id = $wpdb->insert_id;
|
375 |
+
return $field;
|
376 |
+
}
|
377 |
+
|
378 |
+
/**
|
379 |
+
* Save a meta in DB
|
380 |
+
*
|
381 |
+
* @since 1.4.0
|
382 |
+
*
|
383 |
+
* @param \Caldera_Forms_Entry_Meta $meta
|
384 |
+
*/
|
385 |
+
protected function save_meta( Caldera_Forms_Entry_Meta $meta ){
|
386 |
+
$meta->entry_id = $this->entry_id;
|
387 |
+
global $wpdb;
|
388 |
+
$data = $meta->to_array();
|
389 |
+
unset( $data[ 'id' ] );
|
390 |
+
$wpdb->insert( $wpdb->prefix . 'cf_form_entry_meta', $data );
|
391 |
+
$meta->meta_id = $wpdb->insert_id;
|
392 |
+
return $meta;
|
393 |
+
}
|
394 |
+
|
395 |
+
/**
|
396 |
+
* Check if is an allowed status
|
397 |
+
*
|
398 |
+
* @since 1.4.0
|
399 |
+
*
|
400 |
+
* @param string $status Status
|
401 |
+
*
|
402 |
+
* @return bool
|
403 |
+
*/
|
404 |
+
protected function allowed_status( $status ){
|
405 |
+
if( ! in_array( $status, array(
|
406 |
+
'active',
|
407 |
+
'pending',
|
408 |
+
'trash'
|
409 |
+
) ) ){
|
410 |
+
return false;
|
411 |
+
}
|
412 |
+
|
413 |
+
return true;
|
414 |
+
}
|
415 |
+
|
416 |
+
}
|
417 |
+
|
418 |
+
|
419 |
+
|
420 |
+
|
421 |
+
|
422 |
+
|
423 |
+
|
424 |
+
|
425 |
+
|
classes/entry/bulk.php
ADDED
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Bulk actions for entries
|
5 |
+
*
|
6 |
+
* @package Caldera_Forms
|
7 |
+
* @author Josh Pollock <Josh@CalderaWP.com>
|
8 |
+
* @license GPL-2.0+
|
9 |
+
* @link
|
10 |
+
* @copyright 2016 CalderaWP LLC
|
11 |
+
*/
|
12 |
+
class Caldera_Forms_Entry_Bulk {
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Delete all entry data for an array of entries
|
16 |
+
*
|
17 |
+
* @since 1.4.0
|
18 |
+
*
|
19 |
+
* @param array $entry_ids Array of entries to delete
|
20 |
+
*
|
21 |
+
* @return false|int
|
22 |
+
*/
|
23 |
+
public static function delete_entries( $entry_ids ){
|
24 |
+
|
25 |
+
global $wpdb;
|
26 |
+
$result = $wpdb->query( "DELETE FROM `" . $wpdb->prefix . "cf_form_entries` WHERE `id` IN (" . implode( ',', $entry_ids ) . ");" );
|
27 |
+
$result = $wpdb->query( "DELETE FROM `" . $wpdb->prefix . "cf_form_entry_values` WHERE `entry_id` IN (" . implode( ',', $entry_ids ) . ");" );
|
28 |
+
$result = $wpdb->query( "DELETE FROM `" . $wpdb->prefix . "cf_form_entry_meta` WHERE `entry_id` IN (" . implode( ',', $entry_ids ) . ");" );
|
29 |
+
|
30 |
+
return $result;
|
31 |
+
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Update statuses for an array of entries
|
36 |
+
*
|
37 |
+
* @since 1.4.0
|
38 |
+
*
|
39 |
+
* @param array $entry_ids Array of entries to delete
|
40 |
+
* @param string $status New status
|
41 |
+
*
|
42 |
+
* @return false|int
|
43 |
+
*/
|
44 |
+
public static function change_status( $entry_ids, $status ){
|
45 |
+
global $wpdb;
|
46 |
+
$result = $wpdb->query( $wpdb->prepare( "UPDATE `" . $wpdb->prefix . "cf_form_entries` SET `status` = %s WHERE `id` IN (" . implode( ',', $entry_ids ) . ");", $status ) );
|
47 |
+
return $result;
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Get entry count by status
|
52 |
+
*
|
53 |
+
* @since 1.4.0
|
54 |
+
*
|
55 |
+
* @param string $form_id Form ID
|
56 |
+
* @param string $status Status
|
57 |
+
*
|
58 |
+
* @return int
|
59 |
+
*/
|
60 |
+
public static function count( $form_id, $status = 'active' ){
|
61 |
+
global $wpdb;
|
62 |
+
if ( false == $status ) {
|
63 |
+
$sql = $wpdb->prepare( "SELECT COUNT(`id`) AS `total` FROM `" . $wpdb->prefix . "cf_form_entries` WHERE `form_id` = %s", $form_id );
|
64 |
+
}else{
|
65 |
+
$sql = $wpdb->prepare( "SELECT COUNT(`id`) AS `total` FROM `" . $wpdb->prefix . "cf_form_entries` WHERE `form_id` = %s AND `status` = %s;", $form_id, $status );
|
66 |
+
}
|
67 |
+
$total = $wpdb->get_var( $sql );
|
68 |
+
|
69 |
+
return (int) $total;
|
70 |
+
}
|
71 |
+
|
72 |
+
}
|
classes/entry/entries.php
ADDED
@@ -0,0 +1,223 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* A collection of entries for one form
|
4 |
+
*
|
5 |
+
* @package Caldera_Forms
|
6 |
+
* @author Josh Pollock <Josh@CalderaWP.com>
|
7 |
+
* @license GPL-2.0+
|
8 |
+
* @link
|
9 |
+
* @copyright 2016 CalderaWP LLC
|
10 |
+
*/
|
11 |
+
class Caldera_Forms_Entry_Entries {
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Form config
|
15 |
+
*
|
16 |
+
* @since 1.4.0
|
17 |
+
*
|
18 |
+
* @var array
|
19 |
+
*/
|
20 |
+
protected $form;
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Holds all entries, index by status and then page
|
24 |
+
*
|
25 |
+
* @since 1.4.0
|
26 |
+
*
|
27 |
+
* @var array
|
28 |
+
*/
|
29 |
+
protected $entries = array();
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Holds totals by page
|
33 |
+
*
|
34 |
+
* @since 1.4.0
|
35 |
+
*
|
36 |
+
* @var array
|
37 |
+
*/
|
38 |
+
protected $totals = array();
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Allowed statuses
|
42 |
+
*
|
43 |
+
* @todo need to make sure this matches in other places, use filter or something
|
44 |
+
*
|
45 |
+
* @since 1.4.0
|
46 |
+
*
|
47 |
+
* @var array
|
48 |
+
*/
|
49 |
+
protected $statuses = array(
|
50 |
+
'active',
|
51 |
+
'pending',
|
52 |
+
'trash'
|
53 |
+
);
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Total per page
|
57 |
+
*
|
58 |
+
* @since 1.4.0
|
59 |
+
*
|
60 |
+
* @var int
|
61 |
+
*/
|
62 |
+
protected $perpage;
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Caldera_Forms_Entry_Entries constructor.
|
66 |
+
*
|
67 |
+
* @since 1.4.0
|
68 |
+
*
|
69 |
+
* @param array $form Form config
|
70 |
+
* @param int $perpage Number of entries per pags
|
71 |
+
*/
|
72 |
+
public function __construct( array $form, $perpage ) {
|
73 |
+
$this->form = $form;
|
74 |
+
$this->perpage = $perpage;
|
75 |
+
$this->prepare_entries_prop();
|
76 |
+
|
77 |
+
}
|
78 |
+
|
79 |
+
/**
|
80 |
+
* Get one page of results
|
81 |
+
*
|
82 |
+
* @since 1.4.0
|
83 |
+
*
|
84 |
+
* @param int $page
|
85 |
+
* @param string $status
|
86 |
+
*
|
87 |
+
* @return array
|
88 |
+
*/
|
89 |
+
public function get_page( $page = 1, $status = 'active' ) {
|
90 |
+
$page = (int) $page;
|
91 |
+
if ( ! in_array( $status, $this->statuses ) ) {
|
92 |
+
return array();
|
93 |
+
}
|
94 |
+
|
95 |
+
if ( empty( $this->entries[ $status ][ $page ] ) ) {
|
96 |
+
$this->query_page( $page, $status );
|
97 |
+
}
|
98 |
+
|
99 |
+
return $this->entries[ $status ][ $page ];
|
100 |
+
}
|
101 |
+
|
102 |
+
/**
|
103 |
+
* Get an entry row merging entry and field value
|
104 |
+
*
|
105 |
+
* This is for use inside of Caldera_Forms_Admin::get_entries() for backwards compat reasons
|
106 |
+
*
|
107 |
+
* @since 1.4.0
|
108 |
+
*
|
109 |
+
* @param int $page What page of results to get
|
110 |
+
* @param int $entry_id ID of entry
|
111 |
+
* @param string $status Optional. Status, default is 'active'
|
112 |
+
*
|
113 |
+
* @return array
|
114 |
+
*/
|
115 |
+
public function get_rows( $page, $entry_id, $status = 'active' ) {
|
116 |
+
$page = (int) $page;
|
117 |
+
if ( ! in_array( $status, $this->statuses ) ) {
|
118 |
+
return array();
|
119 |
+
}
|
120 |
+
|
121 |
+
if ( ! isset( $this->entries[ $status ][ $page ] ) || empty( $this->entries[ $status ][ $page ] ) ) {
|
122 |
+
$this->query_page( $page, $status );
|
123 |
+
}
|
124 |
+
|
125 |
+
if ( ! isset( $this->entries[ $status ][ $page ] ) || ! isset( $this->entries[ $status ][ $page ][ $entry_id ] ) ) {
|
126 |
+
return array();
|
127 |
+
}
|
128 |
+
|
129 |
+
$data = $_entry = array();
|
130 |
+
/** @var Caldera_Forms_Entry $entry */
|
131 |
+
$entry = $this->entries[ $status ][ $page ][ $entry_id ];
|
132 |
+
|
133 |
+
foreach ( $entry->get_entry()->to_array() as $key => $value ) {
|
134 |
+
$_entry[ '_' . $key ] = $value;
|
135 |
+
}
|
136 |
+
|
137 |
+
/** @var Caldera_Forms_Entry_Field $_field */
|
138 |
+
foreach ( $entry->get_fields() as $_field ) {
|
139 |
+
$field = array_merge( $_field->to_array(), $_entry );
|
140 |
+
$data[] = (object) $field;
|
141 |
+
}
|
142 |
+
|
143 |
+
return $data;
|
144 |
+
|
145 |
+
}
|
146 |
+
|
147 |
+
/**
|
148 |
+
* Get total number of entries with a given status
|
149 |
+
*
|
150 |
+
* @since 1.4.0
|
151 |
+
*
|
152 |
+
* @param string $status Which status
|
153 |
+
*
|
154 |
+
* @return int
|
155 |
+
*/
|
156 |
+
public function get_total( $status ) {
|
157 |
+
if ( ! in_array( $status, $this->statuses ) ) {
|
158 |
+
return 0;
|
159 |
+
}
|
160 |
+
|
161 |
+
return $this->totals[ $status ];
|
162 |
+
}
|
163 |
+
|
164 |
+
/**
|
165 |
+
* Query for a page of results
|
166 |
+
*
|
167 |
+
* @since 1.4.0
|
168 |
+
*
|
169 |
+
* @param int $page What page
|
170 |
+
* @param string $status Which status
|
171 |
+
*/
|
172 |
+
protected function query_page( $page, $status ) {
|
173 |
+
global $wpdb;
|
174 |
+
$table = $wpdb->prefix . "cf_form_entries";
|
175 |
+
$offset = ( $page - 1 ) * $this->perpage;
|
176 |
+
$limit = $offset . ',' . $this->perpage;
|
177 |
+
$sql = $wpdb->prepare( "SELECT * FROM $table WHERE `form_id` = %s AND `status` = %s ORDER BY `datestamp` DESC LIMIT " . $limit . ";", $this->form[ 'ID' ], $status );
|
178 |
+
$_entries = $wpdb->get_results( $sql );
|
179 |
+
if ( ! empty( $_entries ) ) {
|
180 |
+
$this->entries[ $status ][ $page ] = array();
|
181 |
+
foreach ( $_entries as $_entry ) {
|
182 |
+
$entry = new Caldera_Forms_Entry_Entry( $_entry );
|
183 |
+
$this->entries[ $status ][ $page ][ (int) $_entry->id ] = new Caldera_Forms_Entry( $this->form, $entry->id, $entry );
|
184 |
+
}
|
185 |
+
|
186 |
+
}
|
187 |
+
}
|
188 |
+
|
189 |
+
/**
|
190 |
+
* Query for total rows
|
191 |
+
*
|
192 |
+
* @since 1.4.0
|
193 |
+
*
|
194 |
+
* @param string $status Which status
|
195 |
+
*
|
196 |
+
* @return int
|
197 |
+
*/
|
198 |
+
protected function query_total( $status ) {
|
199 |
+
return Caldera_Forms_Entry_Bulk::count( $this->form[ 'ID' ], $status );
|
200 |
+
}
|
201 |
+
|
202 |
+
/**
|
203 |
+
* Populates the entries property of this class with arrays per status and per page as needed.
|
204 |
+
*
|
205 |
+
* @since 1.4.0
|
206 |
+
*/
|
207 |
+
protected function prepare_entries_prop() {
|
208 |
+
foreach ( $this->statuses as $status ) {
|
209 |
+
$total = $this->query_total( $status );
|
210 |
+
$this->totals[ $status ] = $total;
|
211 |
+
$pages = ceil( $total / $this->perpage );
|
212 |
+
$this->entries[ $status ] = array();
|
213 |
+
if ( 1 == $pages ) {
|
214 |
+
$this->entries[ $status ] = array( 1 => array() );
|
215 |
+
} else {
|
216 |
+
$this->entries[ $status ] = array_fill( 1, $pages, array() );
|
217 |
+
}
|
218 |
+
|
219 |
+
}
|
220 |
+
|
221 |
+
}
|
222 |
+
|
223 |
+
}
|
classes/entry/entry.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Object representation of an entry (basic info, no values) - cf_form_entries
|
5 |
+
*
|
6 |
+
* @package Caldera_Forms
|
7 |
+
* @author Josh Pollock <Josh@CalderaWP.com>
|
8 |
+
* @license GPL-2.0+
|
9 |
+
* @link
|
10 |
+
* @copyright 2016 CalderaWP LLC
|
11 |
+
*/
|
12 |
+
class Caldera_Forms_Entry_Entry extends Caldera_Forms_Entry_Object {
|
13 |
+
|
14 |
+
/** @var string */
|
15 |
+
protected $id;
|
16 |
+
|
17 |
+
/** @var string */
|
18 |
+
protected $form_id;
|
19 |
+
|
20 |
+
/** @var string */
|
21 |
+
protected $user_id;
|
22 |
+
|
23 |
+
/** @var string */
|
24 |
+
protected $datestamp;
|
25 |
+
|
26 |
+
/** @var string */
|
27 |
+
protected $status;
|
28 |
+
|
29 |
+
}
|
classes/entry/field.php
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Object representation of an entry field - cf_form_entry_values
|
5 |
+
*
|
6 |
+
* @package Caldera_Forms
|
7 |
+
* @author Josh Pollock <Josh@CalderaWP.com>
|
8 |
+
* @license GPL-2.0+
|
9 |
+
* @link
|
10 |
+
* @copyright 2016 CalderaWP LLC
|
11 |
+
*/
|
12 |
+
class Caldera_Forms_Entry_Field extends Caldera_Forms_Entry_Object {
|
13 |
+
|
14 |
+
/** @var string */
|
15 |
+
protected $id;
|
16 |
+
|
17 |
+
/** @var string */
|
18 |
+
protected $entry_id;
|
19 |
+
|
20 |
+
/** @var string */
|
21 |
+
protected $field_id;
|
22 |
+
|
23 |
+
/** @var string */
|
24 |
+
protected $slug;
|
25 |
+
|
26 |
+
/** @var string\array */
|
27 |
+
protected $value;
|
28 |
+
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Apply deserialization/json_decoding if needed to value column
|
32 |
+
*
|
33 |
+
* @since 1.4.0
|
34 |
+
*
|
35 |
+
* @param string $value Value
|
36 |
+
*/
|
37 |
+
protected function value_set( $value ){
|
38 |
+
if( is_array( $value ) ){
|
39 |
+
$this->value = $value;
|
40 |
+
}elseif( is_serialized( $value ) ){
|
41 |
+
$this->value = unserialize( $value );
|
42 |
+
}elseif( 0 === strpos( $value, '{' ) && is_object( $_value = json_decode( $value ) ) ){
|
43 |
+
$this->value = (array) $_value;
|
44 |
+
}else{
|
45 |
+
$this->value = $value;
|
46 |
+
}
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Get value and ensure is not still serialized
|
51 |
+
*
|
52 |
+
* @since 1.4.0
|
53 |
+
*
|
54 |
+
* @return array|string|int
|
55 |
+
*/
|
56 |
+
protected function value_get(){
|
57 |
+
|
58 |
+
if ( is_serialized( $this->value ) ) {
|
59 |
+
$this->value = unserialize( $this->value );
|
60 |
+
} elseif ( is_string( $this->value ) && 0 === strpos( $this->value, '{' ) && is_object( $_value = json_decode( $this->value ) ) ) {
|
61 |
+
$this->value = (array) $_value;
|
62 |
+
}
|
63 |
+
|
64 |
+
return $this->value;
|
65 |
+
|
66 |
+
}
|
67 |
+
|
68 |
+
|
69 |
+
|
70 |
+
}
|
71 |
+
|
classes/entry/meta.php
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Object representation of an entry meta - cf_entry_meta
|
5 |
+
*
|
6 |
+
* @package Caldera_Forms
|
7 |
+
* @author Josh Pollock <Josh@CalderaWP.com>
|
8 |
+
* @license GPL-2.0+
|
9 |
+
* @link
|
10 |
+
* @copyright 2016 CalderaWP LLC
|
11 |
+
*/
|
12 |
+
class Caldera_Forms_Entry_Meta extends Caldera_Forms_Entry_Object {
|
13 |
+
|
14 |
+
/** @var string */
|
15 |
+
protected $meta_id;
|
16 |
+
|
17 |
+
/** @var string */
|
18 |
+
protected $entry_id;
|
19 |
+
|
20 |
+
/** @var string */
|
21 |
+
protected $process_id;
|
22 |
+
|
23 |
+
/** @var string */
|
24 |
+
protected $meta_key;
|
25 |
+
|
26 |
+
/** @var string|array */
|
27 |
+
protected $meta_value;
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Apply deserialization/json_decoding if needed to meta_value column
|
31 |
+
*
|
32 |
+
* @since 1.4.0
|
33 |
+
*
|
34 |
+
* @param string $value Meta value
|
35 |
+
*/
|
36 |
+
protected function meta_value_set( $value ){
|
37 |
+
if( is_array( $value ) ){
|
38 |
+
$this->meta_value = $value;
|
39 |
+
} elseif( is_serialized( $value ) ){
|
40 |
+
$this->meta_value = unserialize( $value );
|
41 |
+
}elseif( 0 === strpos( $value, '{' ) && is_object( $_value = json_decode( $value ) ) ){
|
42 |
+
$this->meta_value = (array) $_value;
|
43 |
+
}else{
|
44 |
+
$this->meta_value = $value;
|
45 |
+
}
|
46 |
+
|
47 |
+
}
|
48 |
+
}
|
classes/entry/object.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Base class for object representations of database rows
|
4 |
+
*
|
5 |
+
* @package Caldera_Forms
|
6 |
+
* @author Josh Pollock <Josh@CalderaWP.com>
|
7 |
+
* @license GPL-2.0+
|
8 |
+
* @link
|
9 |
+
* @copyright 2016 CalderaWP LLC
|
10 |
+
*/
|
11 |
+
abstract class Caldera_Forms_Entry_Object extends Caldera_Forms_Object {
|
12 |
+
|
13 |
+
|
14 |
+
/**
|
15 |
+
* @inheritdoc
|
16 |
+
*/
|
17 |
+
protected function get_prefix(){
|
18 |
+
return 'entry';
|
19 |
+
}
|
20 |
+
|
21 |
+
}
|
classes/entry/ui.php
ADDED
@@ -0,0 +1,127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* AJAX callbacks for viewing entries
|
5 |
+
*
|
6 |
+
* @package Caldera_Forms
|
7 |
+
* @author Josh Pollock <Josh@CalderaWP.com>
|
8 |
+
* @license GPL-2.0+
|
9 |
+
* @link
|
10 |
+
* @copyright 2016 CalderaWP LLC
|
11 |
+
*/
|
12 |
+
class Caldera_Forms_Entry_UI {
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Class instance
|
16 |
+
*
|
17 |
+
* @since 1.4.0
|
18 |
+
*
|
19 |
+
* @var \Caldera_Forms_Entry_UI
|
20 |
+
*/
|
21 |
+
protected static $instance;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Get class instance
|
25 |
+
*
|
26 |
+
* @since 1.4.0
|
27 |
+
*
|
28 |
+
* @return \Caldera_Forms_Entry_UI
|
29 |
+
*/
|
30 |
+
public static function get_instance(){
|
31 |
+
if( null == self::$instance ){
|
32 |
+
self::$instance = new self();
|
33 |
+
}
|
34 |
+
|
35 |
+
return self::$instance;
|
36 |
+
|
37 |
+
}
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Get a single entry viewer via AJAX
|
41 |
+
*
|
42 |
+
* @since 1.4.0
|
43 |
+
*
|
44 |
+
* @uses "wp_ajax_get_entry" action
|
45 |
+
*/
|
46 |
+
public function view_entry(){
|
47 |
+
if( isset( $_POST, $_POST[ 'nonce' ], $_POST[ 'entry'], $_POST[ 'form' ] ) ){
|
48 |
+
|
49 |
+
$form = Caldera_Forms_Forms::get_form( strip_tags( $_POST[ 'form' ] ) );
|
50 |
+
if( ! current_user_can( Caldera_Forms::get_manage_cap( 'entry-view', $form ) ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'cf_view_entry' ) ){
|
51 |
+
wp_send_json_error( $_POST );
|
52 |
+
}
|
53 |
+
|
54 |
+
$entry_id = absint( $_POST[ 'entry' ] );
|
55 |
+
|
56 |
+
if( 0 < $entry_id && is_array( $form ) ){
|
57 |
+
$entry = Caldera_Forms::get_entry( $entry_id, $form );
|
58 |
+
if( is_wp_error( $entry ) ){
|
59 |
+
wp_send_json_error( $entry );
|
60 |
+
}else{
|
61 |
+
status_header( 200 );
|
62 |
+
wp_send_json( $entry );
|
63 |
+
}
|
64 |
+
}else{
|
65 |
+
wp_send_json_error( $_POST );
|
66 |
+
}
|
67 |
+
|
68 |
+
|
69 |
+
|
70 |
+
}
|
71 |
+
|
72 |
+
wp_send_json_error( $_POST );
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Get entry viewer list via AJAX
|
77 |
+
*
|
78 |
+
* @since 1.4.0
|
79 |
+
*
|
80 |
+
* @uses "wp_ajax_browse_entries" action
|
81 |
+
*/
|
82 |
+
public function view_entries(){
|
83 |
+
if( ! isset( $_POST[ 'page' ], $_POST[ 'form' ], $_POST[ 'nonce' ] ) ){
|
84 |
+
wp_send_json_error( $_POST );
|
85 |
+
}
|
86 |
+
|
87 |
+
$form = Caldera_Forms_Forms::get_form( strip_tags( $_POST[ 'form' ] ) );
|
88 |
+
|
89 |
+
if( ! current_user_can( Caldera_Forms::get_manage_cap( 'entry-view', $form ) ) || ! wp_verify_nonce( $_POST['nonce' ], 'view_entries' ) ){
|
90 |
+
wp_send_json_error( $_POST );
|
91 |
+
}
|
92 |
+
|
93 |
+
|
94 |
+
if ( isset( $_POST[ 'page' ] ) && 0 < $_POST[ 'page' ] ) {
|
95 |
+
$page = absint( $_POST[ 'page' ] );
|
96 |
+
}else{
|
97 |
+
$page = 1;
|
98 |
+
}
|
99 |
+
|
100 |
+
$entry_perpage = get_option( '_caldera_forms_entry_perpage', 20 );
|
101 |
+
if ( isset( $_POST[ 'perpage' ] ) && 0 < $_POST[ 'perpage' ] ) {
|
102 |
+
$perpage = absint( (int) $_POST[ 'perpage' ] );
|
103 |
+
if( $entry_perpage != $perpage ){
|
104 |
+
update_option( '_caldera_forms_entry_perpage', $perpage );
|
105 |
+
}
|
106 |
+
}else{
|
107 |
+
$perpage = $entry_perpage;
|
108 |
+
}
|
109 |
+
|
110 |
+
if ( isset( $_POST[ 'status' ] ) ) {
|
111 |
+
$status = strip_tags( $_POST[ 'status' ] );
|
112 |
+
}else{
|
113 |
+
$status = 'active';
|
114 |
+
}
|
115 |
+
|
116 |
+
$data = Caldera_Forms_Admin::get_entries( $form, $page, $perpage, $status );
|
117 |
+
|
118 |
+
$data['is_' . $status ] = true;
|
119 |
+
|
120 |
+
status_header( 200 );
|
121 |
+
wp_send_json( $data );
|
122 |
+
|
123 |
+
|
124 |
+
}
|
125 |
+
|
126 |
+
|
127 |
+
}
|
classes/forms.php
CHANGED
@@ -392,6 +392,15 @@ class Caldera_Forms_Forms {
|
|
392 |
$data[ '_last_updated' ] = date('r');
|
393 |
$data[ 'version' ] = CFCORE_VER;
|
394 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
395 |
// add form to registry
|
396 |
self::update_registry( $data[ "ID" ] );
|
397 |
|
392 |
$data[ '_last_updated' ] = date('r');
|
393 |
$data[ 'version' ] = CFCORE_VER;
|
394 |
|
395 |
+
/**
|
396 |
+
* Filter form config directly before saving
|
397 |
+
*
|
398 |
+
* @since 1.4.0
|
399 |
+
*
|
400 |
+
* @param array $data Form config
|
401 |
+
*/
|
402 |
+
$data = apply_filters( 'caldera_forms_presave_form', $data );
|
403 |
+
|
404 |
// add form to registry
|
405 |
self::update_registry( $data[ "ID" ] );
|
406 |
|
classes/object.php
ADDED
@@ -0,0 +1,153 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Generic object that is like stdClass but only allows get/set of defiend properties
|
4 |
+
*
|
5 |
+
* @package Caldera_Forms
|
6 |
+
* @author Josh Pollock <Josh@CalderaWP.com>
|
7 |
+
* @license GPL-2.0+
|
8 |
+
* @link
|
9 |
+
* @copyright 2016 CalderaWP LLC
|
10 |
+
*/
|
11 |
+
abstract class Caldera_Forms_Object {
|
12 |
+
|
13 |
+
public function __construct( stdClass $obj = null ) {
|
14 |
+
if( null !== $obj ){
|
15 |
+
$this->set_form_object( $obj );
|
16 |
+
}
|
17 |
+
|
18 |
+
}
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Translate from a stdClass object to this object type
|
22 |
+
*
|
23 |
+
* @since 1.4.0
|
24 |
+
*
|
25 |
+
* @param \stdClass $obj
|
26 |
+
*/
|
27 |
+
public function set_form_object( stdClass $obj ){
|
28 |
+
foreach( $obj as $property => $value ){
|
29 |
+
$this->$property = $value;
|
30 |
+
}
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Set allowed properties
|
35 |
+
*
|
36 |
+
* @since 1.4.0
|
37 |
+
*
|
38 |
+
* @param string $property Name of property
|
39 |
+
* @param mixed $value Property value
|
40 |
+
*
|
41 |
+
* @return bool|mixed
|
42 |
+
*/
|
43 |
+
public function __set( $property, $value ){
|
44 |
+
$setter = $property . '_set';
|
45 |
+
if( method_exists( $this, $setter ) ){
|
46 |
+
return call_user_func( array( $this, $setter ), $value );
|
47 |
+
}elseif ( ( is_string( $value ) || is_numeric( $value ) ) && property_exists( $this, $property ) ){
|
48 |
+
$this->$property = $value;
|
49 |
+
return true;
|
50 |
+
}else{
|
51 |
+
return false;
|
52 |
+
}
|
53 |
+
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Get allowed property value
|
58 |
+
*
|
59 |
+
* @since 1.4.0
|
60 |
+
*
|
61 |
+
* @param string $property Name of property
|
62 |
+
*
|
63 |
+
* @return mixed|null|void
|
64 |
+
*/
|
65 |
+
public function __get( $property ) {
|
66 |
+
$getter = $property . '_get';
|
67 |
+
if( method_exists( $this, $getter ) ){
|
68 |
+
return call_user_func( array( $this, $getter ) );
|
69 |
+
}
|
70 |
+
if ( property_exists( $this, $property ) ) {
|
71 |
+
return $this->apply_filter( $property, $this->$property );
|
72 |
+
} else {
|
73 |
+
return null;
|
74 |
+
}
|
75 |
+
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Convert object to array
|
80 |
+
*
|
81 |
+
* @since 1.4.0
|
82 |
+
*
|
83 |
+
* @param bool $serialize_arrays Optional. To return arrays serialized. If true, arrays are serialized, if false, serialized data is unserialized. Default is true.
|
84 |
+
*
|
85 |
+
* @return array
|
86 |
+
*/
|
87 |
+
public function to_array( $serialize_arrays = true ){
|
88 |
+
$vars = get_object_vars( $this );
|
89 |
+
|
90 |
+
foreach( $vars as $property => $value ){
|
91 |
+
if( is_array( $value ) ){
|
92 |
+
if ( $serialize_arrays ) {
|
93 |
+
$value = serialize( $value );
|
94 |
+
}
|
95 |
+
}
|
96 |
+
|
97 |
+
if( ! $serialize_arrays && is_serialized( $value ) ){
|
98 |
+
$value = unserialize( $value );
|
99 |
+
}
|
100 |
+
|
101 |
+
$vars[ $property ] = $value;
|
102 |
+
}
|
103 |
+
|
104 |
+
return $vars;
|
105 |
+
|
106 |
+
}
|
107 |
+
|
108 |
+
/**
|
109 |
+
* Filter value
|
110 |
+
*
|
111 |
+
* Called whenever property is accessed via __get()
|
112 |
+
*
|
113 |
+
* @since 1.4.0
|
114 |
+
*
|
115 |
+
* @param string $property Property name
|
116 |
+
* @param mixed $value Property value
|
117 |
+
*
|
118 |
+
* @return mixed|void
|
119 |
+
*/
|
120 |
+
public function apply_filter( $property, $value ){
|
121 |
+
$prefix = $this->get_prefix();
|
122 |
+
$filter_name = 'caldera_forms_' . $prefix . '_' . $property;
|
123 |
+
|
124 |
+
/**
|
125 |
+
* Filter value before returning
|
126 |
+
*
|
127 |
+
* @since 1.4.0
|
128 |
+
*
|
129 |
+
* @param mixed $value Property value
|
130 |
+
* @param Caldera_Forms_Object $obj Current class object
|
131 |
+
* @param string $class Name of class
|
132 |
+
*/
|
133 |
+
return apply_filters( $filter_name, $value, $this, get_class( $this ) );
|
134 |
+
|
135 |
+
}
|
136 |
+
|
137 |
+
/**
|
138 |
+
* Get prefix to use in parents.
|
139 |
+
*
|
140 |
+
* Used to form filter for getters. Better to ovveride and hardcode.
|
141 |
+
*
|
142 |
+
* @since 1.4.0
|
143 |
+
*
|
144 |
+
* @return string
|
145 |
+
*/
|
146 |
+
protected function get_prefix(){
|
147 |
+
$class = explode( '_', get_class( $this ) );
|
148 |
+
end( $class );
|
149 |
+
return key( $class );
|
150 |
+
|
151 |
+
}
|
152 |
+
|
153 |
+
}
|
classes/save.php
CHANGED
@@ -132,10 +132,11 @@ class Caldera_Forms_Save_Final {
|
|
132 |
* @since 1.2.3
|
133 |
*
|
134 |
* @param array $form Form config
|
135 |
-
* @param int|null $entryid Optional. ID of entry to send. If not provided, will be
|
136 |
* @param array|null $data Optional. Data to use for sending. If not provided, will be retrieved by form ID.
|
|
|
137 |
*/
|
138 |
-
public static function do_mailer( $form, $entryid = null, $data = null ) {
|
139 |
global $transdata, $processed_data;
|
140 |
|
141 |
if( ! isset( $entryid ) && is_array( $processed_data ) ){
|
@@ -154,177 +155,212 @@ class Caldera_Forms_Save_Final {
|
|
154 |
$transdata['entry_id'] = $entryid;
|
155 |
|
156 |
// do mailer!
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
|
|
|
|
164 |
}
|
165 |
}
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
}
|
176 |
}
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
}
|
182 |
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
|
187 |
-
$mail = array(
|
188 |
-
'recipients' => array(),
|
189 |
-
'subject' => Caldera_Forms::do_magic_tags($form['mailer']['email_subject']),
|
190 |
-
'message' => stripslashes( $form['mailer']['email_message'] ) ."\r\n",
|
191 |
-
'headers' => array(
|
192 |
-
Caldera_Forms::do_magic_tags( 'From: ' . $sendername . ' <' . $sendermail . '>' ),
|
193 |
-
),
|
194 |
-
'attachments' => array()
|
195 |
-
);
|
196 |
-
|
197 |
-
// if added a bcc
|
198 |
-
if ( isset( $form['mailer']['bcc_to'] ) ) {
|
199 |
-
$mail['headers'][] = Caldera_Forms::do_magic_tags( 'Bcc: ' . $form['mailer']['bcc_to'] );
|
200 |
-
}
|
201 |
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
207 |
}
|
208 |
-
}
|
209 |
|
210 |
-
|
211 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
212 |
|
213 |
-
|
214 |
-
$mail['
|
215 |
-
|
216 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
217 |
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
|
|
|
|
225 |
}
|
226 |
-
$mail['message'] = str_replace($hastags[0][$tag_key], $tagval, $mail['message']);
|
227 |
}
|
228 |
-
}
|
229 |
|
230 |
-
//$mail['message']
|
231 |
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
|
|
261 |
}
|
262 |
}
|
263 |
}
|
264 |
-
}
|
265 |
-
|
266 |
-
}
|
267 |
|
|
|
268 |
|
269 |
-
if(!empty($form['mailer']['recipients'])){
|
270 |
-
$mail['recipients'] = explode(',', Caldera_Forms::do_magic_tags( $form['mailer']['recipients']) );
|
271 |
-
}else{
|
272 |
-
$mail['recipients'][] = get_option( 'admin_email' );
|
273 |
-
}
|
274 |
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
}
|
280 |
|
281 |
-
$
|
282 |
-
|
283 |
-
if(!
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
292 |
}
|
293 |
-
$
|
294 |
}
|
295 |
-
|
|
|
296 |
}
|
297 |
-
}else{
|
298 |
-
$row = null;
|
299 |
}
|
300 |
-
|
301 |
-
|
302 |
-
$mail['subject'] = str_replace('%'.$key.'%', $row, $mail['subject']);
|
303 |
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
$
|
|
|
|
|
|
|
|
|
|
|
323 |
}
|
|
|
|
|
|
|
324 |
}
|
325 |
|
326 |
-
if(empty($mail)){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
327 |
return;
|
|
|
328 |
}
|
329 |
|
330 |
/**
|
@@ -350,7 +386,7 @@ class Caldera_Forms_Save_Final {
|
|
350 |
*
|
351 |
* @since 1.2.3 in this location.
|
352 |
* @since unknown in original location (Caldera_Forms::save_final_form)
|
353 |
-
*
|
354 |
* @param array $mail Email data
|
355 |
* @param array $data Form entry data
|
356 |
* @param array $form The form config
|
@@ -369,47 +405,138 @@ class Caldera_Forms_Save_Final {
|
|
369 |
add_action( 'phpmailer_init', array( 'Caldera_Forms', 'debug_mail_send' ), 1000 );
|
370 |
}
|
371 |
|
372 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
373 |
|
374 |
-
|
375 |
-
if(!empty($csvfile['file'])){
|
376 |
-
if(file_exists($csvfile['file'])){
|
377 |
-
unlink($csvfile['file']);
|
378 |
-
}
|
379 |
-
}
|
380 |
-
|
381 |
-
/**
|
382 |
-
* Fires main mailer completes
|
383 |
-
*
|
384 |
-
* @since 1.3.1
|
385 |
-
*
|
386 |
-
* @param array $mail Email data
|
387 |
-
* @param array $data Form entry data
|
388 |
-
* @param array $form The form config
|
389 |
-
*/
|
390 |
-
do_action( 'caldera_forms_mailer_complete', $mail, $data, $form );
|
391 |
-
}else{
|
392 |
-
/**
|
393 |
-
* Fires main mailer fails
|
394 |
-
*
|
395 |
-
* @since 1.2.3
|
396 |
-
*
|
397 |
-
* @param array $mail Email data
|
398 |
-
* @param array $data Form entry data
|
399 |
-
* @param array $form The form config
|
400 |
-
*/
|
401 |
-
do_action( 'caldera_forms_mailer_failed', $mail, $data, $form );
|
402 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
403 |
}
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
408 |
}
|
409 |
}
|
410 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
411 |
}
|
412 |
|
413 |
}
|
414 |
|
|
|
415 |
}
|
132 |
* @since 1.2.3
|
133 |
*
|
134 |
* @param array $form Form config
|
135 |
+
* @param int|null $entryid Optional. ID of entry to send. If not provided, will be determined based on global $transdata
|
136 |
* @param array|null $data Optional. Data to use for sending. If not provided, will be retrieved by form ID.
|
137 |
+
* @param array|null $settings. Optional. If array then this is used for mail settings, not form mailier. Useful for auto-responder.
|
138 |
*/
|
139 |
+
public static function do_mailer( $form, $entryid = null, $data = null, array $settings = null ) {
|
140 |
global $transdata, $processed_data;
|
141 |
|
142 |
if( ! isset( $entryid ) && is_array( $processed_data ) ){
|
155 |
$transdata['entry_id'] = $entryid;
|
156 |
|
157 |
// do mailer!
|
158 |
+
if ( empty( $settings ) ) {
|
159 |
+
$sendername = __( 'Caldera Forms Notification', 'caldera-forms' );
|
160 |
+
if ( ! empty( $form['mailer']['sender_name'] ) ) {
|
161 |
+
$sendername = $form['mailer']['sender_name'];
|
162 |
+
if ( false !== strpos( $sendername, '%' ) ) {
|
163 |
+
$isname = Caldera_Forms::get_slug_data( trim( $sendername, '%' ), $form );
|
164 |
+
if ( ! empty( $isname ) ) {
|
165 |
+
$sendername = $isname;
|
166 |
+
}
|
167 |
}
|
168 |
}
|
169 |
+
if ( empty( $form['mailer']['sender_email'] ) ) {
|
170 |
+
$sendermail = get_option( 'admin_email' );
|
171 |
+
} else {
|
172 |
+
$sendermail = $form['mailer']['sender_email'];
|
173 |
+
if ( false !== strpos( $sendermail, '%' ) ) {
|
174 |
+
$ismail = Caldera_Forms::get_slug_data( trim( $sendermail, '%' ), $form );
|
175 |
+
if ( is_email( $ismail ) ) {
|
176 |
+
$sendermail = $ismail;
|
177 |
+
}
|
178 |
}
|
179 |
}
|
180 |
+
// use summary
|
181 |
+
if ( empty( $form['mailer']['email_message'] ) ) {
|
182 |
+
$form['mailer']['email_message'] = "{summary}";
|
183 |
+
}
|
|
|
184 |
|
185 |
+
if ( ! isset( $form['mailer']['email_subject'] ) ) {
|
186 |
+
$form['mailer']['email_subject'] = $form['name'];
|
187 |
+
}
|
188 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
189 |
|
190 |
+
$mail = array(
|
191 |
+
'recipients' => array(),
|
192 |
+
'subject' => Caldera_Forms::do_magic_tags( $form['mailer']['email_subject'] ),
|
193 |
+
'message' => stripslashes( $form['mailer']['email_message'] ) . "\r\n",
|
194 |
+
'headers' => array(
|
195 |
+
Caldera_Forms::do_magic_tags( 'From: ' . $sendername . ' <' . $sendermail . '>' )
|
196 |
+
),
|
197 |
+
'attachments' => array()
|
198 |
+
);
|
199 |
+
$mail['from'] = $sendermail;
|
200 |
+
$mail['from_name'] = $sendername;
|
201 |
+
|
202 |
+
|
203 |
+
// if added a bcc
|
204 |
+
$mail['bcc'] = false;
|
205 |
+
if ( isset( $form['mailer']['bcc_to'] ) ) {
|
206 |
+
$mail['bcc'] = $form['mailer']['bcc_to'];
|
207 |
+
$mail['headers'][] = Caldera_Forms::do_magic_tags( 'Bcc: ' . $form['mailer']['bcc_to'] );
|
208 |
}
|
|
|
209 |
|
210 |
+
// if added a replyto
|
211 |
+
$mail['replyto'] = false;
|
212 |
+
if ( isset( $form['mailer']['reply_to'] ) ) {
|
213 |
+
$reply_to = trim( $form['mailer']['reply_to'] );
|
214 |
+
if ( ! empty( $reply_to ) ) {
|
215 |
+
$mail['replyto'] = $reply_to;
|
216 |
+
$mail['headers'][] = Caldera_Forms::do_magic_tags( 'Reply-To: <' . $reply_to . '>' );
|
217 |
+
}
|
218 |
+
}
|
219 |
+
if ( ! $mail['replyto'] ) {
|
220 |
+
$mail['replyto'] = $mail['from'];
|
221 |
+
}
|
222 |
|
223 |
+
// Filter Mailer first as not to have user input be filtered
|
224 |
+
$mail['message'] = Caldera_Forms::do_magic_tags( $mail['message'] );
|
225 |
+
|
226 |
+
if ( ! isset( $form['mailer']['email_type'] ) || $form['mailer']['email_type'] == 'html' ) {
|
227 |
+
$mail['headers'][] = "Content-type: text/html";
|
228 |
+
$mail['html'] = true;
|
229 |
+
$mail['message'] = wpautop( $mail['message'] );
|
230 |
+
} else {
|
231 |
+
$mail['html'] = false;
|
232 |
+
}
|
233 |
|
234 |
+
// get tags
|
235 |
+
preg_match_all( "/%(.+?)%/", $mail['message'], $hastags );
|
236 |
+
if ( ! empty( $hastags[1] ) ) {
|
237 |
+
foreach ( $hastags[1] as $tag_key => $tag ) {
|
238 |
+
$tagval = Caldera_Forms::get_slug_data( $tag, $form );
|
239 |
+
if ( is_array( $tagval ) ) {
|
240 |
+
$tagval = implode( ', ', $tagval );
|
241 |
+
}
|
242 |
+
$mail['message'] = str_replace( $hastags[0][ $tag_key ], $tagval, $mail['message'] );
|
243 |
}
|
|
|
244 |
}
|
|
|
245 |
|
|
|
246 |
|
247 |
+
// ifs
|
248 |
+
preg_match_all( "/\[if (.+?)?\](?:(.+?)?\[\/if\])?/", $mail['message'], $hasifs );
|
249 |
+
if ( ! empty( $hasifs[1] ) ) {
|
250 |
+
// process ifs
|
251 |
+
foreach ( $hasifs[0] as $if_key => $if_tag ) {
|
252 |
|
253 |
+
$content = explode( '[else]', $hasifs[2][ $if_key ] );
|
254 |
+
if ( empty( $content[1] ) ) {
|
255 |
+
$content[1] = '';
|
256 |
+
}
|
257 |
+
$vars = shortcode_parse_atts( $hasifs[1][ $if_key ] );
|
258 |
+
foreach ( $vars as $varkey => $varval ) {
|
259 |
+
if ( is_string( $varkey ) ) {
|
260 |
+
$var = Caldera_Forms::get_slug_data( $varkey, $form );
|
261 |
+
if ( in_array( $varval, (array) $var ) ) {
|
262 |
+
// yes show code
|
263 |
+
$mail['message'] = str_replace( $hasifs[0][ $if_key ], $content[0], $mail['message'] );
|
264 |
+
} else {
|
265 |
+
// nope- no code
|
266 |
+
$mail['message'] = str_replace( $hasifs[0][ $if_key ], $content[1], $mail['message'] );
|
267 |
+
}
|
268 |
+
} else {
|
269 |
+
$var = Caldera_Forms::get_slug_data( $varval, $form );
|
270 |
+
if ( ! empty( $var ) ) {
|
271 |
+
// show code
|
272 |
+
$mail['message'] = str_replace( $hasifs[0][ $if_key ], $content[0], $mail['message'] );
|
273 |
+
} else {
|
274 |
+
// no code
|
275 |
+
$mail['message'] = str_replace( $hasifs[0][ $if_key ], $content[1], $mail['message'] );
|
276 |
+
}
|
277 |
}
|
278 |
}
|
279 |
}
|
|
|
|
|
|
|
280 |
|
281 |
+
}
|
282 |
|
|
|
|
|
|
|
|
|
|
|
283 |
|
284 |
+
if ( ! empty( $form['mailer']['recipients'] ) ) {
|
285 |
+
$mail['recipients'] = explode( ',', Caldera_Forms::do_magic_tags( $form['mailer']['recipients'] ) );
|
286 |
+
} else {
|
287 |
+
$mail['recipients'][] = get_option( 'admin_email' );
|
288 |
}
|
289 |
|
290 |
+
$submission = array();
|
291 |
+
foreach ( $data as $field_id => $row ) {
|
292 |
+
if ( $row === null || ! isset( $form['fields'][ $field_id ] ) ) {
|
293 |
+
continue;
|
294 |
+
}
|
295 |
+
|
296 |
+
$key = $form['fields'][ $field_id ]['slug'];
|
297 |
+
if ( is_array( $row ) ) {
|
298 |
+
if ( ! empty( $row ) ) {
|
299 |
+
$keys = array_keys( $row );
|
300 |
+
if ( is_int( $keys[0] ) ) {
|
301 |
+
$row = implode( ', ', $row );
|
302 |
+
} else {
|
303 |
+
$tmp = array();
|
304 |
+
foreach ( $row as $linekey => $item ) {
|
305 |
+
if ( is_array( $item ) ) {
|
306 |
+
$item = '( ' . implode( ', ', $item ) . ' )';
|
307 |
+
}
|
308 |
+
$tmp[] = $linekey . ': ' . $item;
|
309 |
}
|
310 |
+
$row = implode( ', ', $tmp );
|
311 |
}
|
312 |
+
} else {
|
313 |
+
$row = null;
|
314 |
}
|
|
|
|
|
315 |
}
|
316 |
+
$mail['message'] = str_replace( '%' . $key . '%', $row, $mail['message'] );
|
317 |
+
$mail['subject'] = str_replace( '%' . $key . '%', $row, $mail['subject'] );
|
|
|
318 |
|
319 |
+
$submission[] = $row;
|
320 |
+
$labels[] = $form['fields'][ $field_id ]['label'];
|
321 |
+
}
|
322 |
|
323 |
+
// final magic
|
324 |
+
$mail['message'] = Caldera_Forms::do_magic_tags( $mail['message'] );
|
325 |
+
$mail['subject'] = Caldera_Forms::do_magic_tags( $mail['subject'] );
|
326 |
+
|
327 |
+
// CSV
|
328 |
+
$mail['csv'] = $csvfile = false;
|
329 |
+
if ( ! empty( $form['mailer']['csv_data'] ) ) {
|
330 |
+
ob_start();
|
331 |
+
$df = fopen( "php://output", 'w' );
|
332 |
+
fputcsv( $df, $labels );
|
333 |
+
fputcsv( $df, $submission );
|
334 |
+
fclose( $df );
|
335 |
+
$csv = ob_get_clean();
|
336 |
+
$csvfile = wp_upload_bits( uniqid() . '.csv', null, $csv );
|
337 |
+
if ( isset( $csvfile['file'] ) && false == $csvfile['error'] && file_exists( $csvfile['file'] ) ) {
|
338 |
+
$mail['attachments'][] = $csvfile[ 'file' ];
|
339 |
+
$mail[ 'csv' ] = $csvfile[ 'file' ];
|
340 |
+
}else{
|
341 |
+
$mail[ 'csv' ] = false;
|
342 |
+
}
|
343 |
}
|
344 |
+
} else {
|
345 |
+
$mail = $settings;
|
346 |
+
$csvfile = $settings[ 'csv' ];
|
347 |
}
|
348 |
|
349 |
+
if( empty( $mail ) ){
|
350 |
+
/**
|
351 |
+
* Runs if mail was not sent because mail variable is empty.
|
352 |
+
*
|
353 |
+
* If this fires, that is bad.
|
354 |
+
*
|
355 |
+
* @since 1.4.0
|
356 |
+
*
|
357 |
+
* @param array $form Form config
|
358 |
+
* @param int|null $entryid Optional. ID of entry to send. If not provided, will be determined based on global $transdata
|
359 |
+
* @param array|null $data Optional. Data to use for sending. If not provided, will be retrieved by form ID.
|
360 |
+
*/
|
361 |
+
do_action( 'caldera_forms_mailer_invalid', $form, $entryid, $data );
|
362 |
return;
|
363 |
+
|
364 |
}
|
365 |
|
366 |
/**
|
386 |
*
|
387 |
* @since 1.2.3 in this location.
|
388 |
* @since unknown in original location (Caldera_Forms::save_final_form)
|
389 |
+
*
|
390 |
* @param array $mail Email data
|
391 |
* @param array $data Form entry data
|
392 |
* @param array $form The form config
|
405 |
add_action( 'phpmailer_init', array( 'Caldera_Forms', 'debug_mail_send' ), 1000 );
|
406 |
}
|
407 |
|
408 |
+
$sent = wp_mail( (array) $mail['recipients'], $mail['subject'], stripslashes( $mail['message'] ), $headers, $mail['attachments'] );
|
409 |
+
self::after_send_email( $form, $data, $sent, $csvfile, $mail, 'wpmail' );
|
410 |
+
}else{
|
411 |
+
if( $csvfile ){
|
412 |
+
self::unlink_csv( $csvfile );
|
413 |
+
}
|
414 |
+
|
415 |
|
416 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
417 |
|
418 |
+
}
|
419 |
+
|
420 |
+
/**
|
421 |
+
* Runs post email sent/not sent tasks/hooks etc
|
422 |
+
*
|
423 |
+
*
|
424 |
+
* @since 1.4.0
|
425 |
+
*
|
426 |
+
* @param array $form Form config
|
427 |
+
* @param array $data Submission data
|
428 |
+
* @param bool $sent Was email sent
|
429 |
+
* @param array|bool $csvfile Csv file array or false if not created
|
430 |
+
* @param array $mail The email
|
431 |
+
* @param string $method Method for sending email
|
432 |
+
*/
|
433 |
+
public static function after_send_email( $form, $data, $sent, $csvfile, $mail, $method ) {
|
434 |
+
if ( $sent ) {
|
435 |
+
|
436 |
+
if( $csvfile ){
|
437 |
+
self::unlink_csv( $csvfile );
|
438 |
}
|
439 |
+
|
440 |
+
/**
|
441 |
+
* Fires main mailer completes
|
442 |
+
*
|
443 |
+
* @since 1.3.1
|
444 |
+
*
|
445 |
+
* @param array $mail Email data
|
446 |
+
* @param array $data Form entry data
|
447 |
+
* @param array $form The form config
|
448 |
+
* @param string $method Method for sending email
|
449 |
+
*/
|
450 |
+
do_action( 'caldera_forms_mailer_complete', $mail, $data, $form, $method );
|
451 |
+
} else {
|
452 |
+
/**
|
453 |
+
* Fires main mailer fails
|
454 |
+
*
|
455 |
+
* @since 1.2.3
|
456 |
+
*
|
457 |
+
* @param array $mail Email data
|
458 |
+
* @param array $data Form entry data
|
459 |
+
* @param array $form The form config
|
460 |
+
* @param string $method Method for sending email
|
461 |
+
*/
|
462 |
+
do_action( 'caldera_forms_mailer_failed', $mail, $data, $form, $method );
|
463 |
+
|
464 |
+
}
|
465 |
+
}
|
466 |
+
|
467 |
+
/**
|
468 |
+
* Save an entry in the database
|
469 |
+
*
|
470 |
+
* IMPORTANT: Data is assumed to be sanatized, saving is assumed to be authorized. Do not hook directly to an HTTP request.
|
471 |
+
*
|
472 |
+
* @since 1.4.0
|
473 |
+
*
|
474 |
+
* @param array $form Form config
|
475 |
+
* @param array $fields Fields to save, must be in form of field_id => value and field IDs must exist
|
476 |
+
* @param array $args {
|
477 |
+
* An array of arguments. As of 1.4.0 used for ovveriding entry status/user/time
|
478 |
+
*
|
479 |
+
* @type string|int $user_id Optional. User ID. Default is current user ID.
|
480 |
+
* @type string $datestamp Optional. Datestamp to use for entry. Must be mysql time. Default is current time.
|
481 |
+
* @type string $status Optional. Status to use for entry. Must be a valid status. Default is 'active'.
|
482 |
+
* }
|
483 |
+
*
|
484 |
+
* @return array|int|string
|
485 |
+
*/
|
486 |
+
public static function create_entry( array $form, array $fields, array $args = array() ){
|
487 |
+
$args = wp_parse_args( $args, array(
|
488 |
+
'user_id' => get_current_user_id(),
|
489 |
+
'datestamp' => current_time( 'mysql' ),
|
490 |
+
'status' => 'active',
|
491 |
+
|
492 |
+
) );
|
493 |
+
if( isset( $form[ 'fields' ] ) ){
|
494 |
+
$_fields = array();
|
495 |
+
|
496 |
+
foreach( $fields as $field_id => $value ){
|
497 |
+
if( array_key_exists($field_id, $form[ 'fields' ] ) ){
|
498 |
+
$field = new Caldera_Forms_Entry_Field();
|
499 |
+
$field->value = $value;
|
500 |
+
$field->slug = $form[ 'fields' ][ $field_id ][ 'slug' ];
|
501 |
+
$field->field_id = $field_id;
|
502 |
+
$_fields[] = $field;
|
503 |
}
|
504 |
}
|
505 |
|
506 |
+
if( ! empty( $_fields ) ){
|
507 |
+
$_entry = new Caldera_Forms_Entry_Entry;
|
508 |
+
$_entry->status = $args[ 'status' ];
|
509 |
+
$_entry->form_id = $form[ 'ID' ];
|
510 |
+
$_entry->datestamp = $args[ 'datestamp' ];
|
511 |
+
$_entry->user_id = $args[ 'user_id' ];
|
512 |
+
$entry = new Caldera_Forms_Entry( $form, false, $_entry );
|
513 |
+
foreach( $_fields as $field ){
|
514 |
+
$entry->add_field( $field );
|
515 |
+
}
|
516 |
+
|
517 |
+
return $entry->save();
|
518 |
+
}
|
519 |
+
|
520 |
+
}
|
521 |
+
|
522 |
+
}
|
523 |
+
|
524 |
+
/**
|
525 |
+
* After sending email, unlink CSV
|
526 |
+
*
|
527 |
+
* @since 1.4.0
|
528 |
+
*
|
529 |
+
* @param $csvfile
|
530 |
+
*/
|
531 |
+
protected static function unlink_csv( $csvfile ) {
|
532 |
+
if ( is_array( $csvfile ) && ! empty( $csvfile[ 'file' ] ) ) {
|
533 |
+
if ( file_exists( $csvfile[ 'file' ] ) ) {
|
534 |
+
unlink( $csvfile[ 'file' ] );
|
535 |
+
}
|
536 |
+
|
537 |
}
|
538 |
|
539 |
}
|
540 |
|
541 |
+
|
542 |
}
|
classes/widget.php
CHANGED
@@ -11,6 +11,13 @@ class Caldera_Forms_Widget extends WP_Widget {
|
|
11 |
function __construct() {
|
12 |
// Instantiate the parent object
|
13 |
parent::__construct( false, __('Caldera Form', 'caldera-forms' ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
}
|
15 |
|
16 |
/**
|
@@ -95,7 +102,10 @@ class Caldera_Forms_Widget extends WP_Widget {
|
|
95 |
}
|
96 |
|
97 |
function caldera_forms_register_widget() {
|
98 |
-
|
|
|
|
|
|
|
99 |
}
|
100 |
|
101 |
add_action( 'widgets_init', 'caldera_forms_register_widget' );
|
11 |
function __construct() {
|
12 |
// Instantiate the parent object
|
13 |
parent::__construct( false, __('Caldera Form', 'caldera-forms' ) );
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Runs after Caldera Forms widget is initialized
|
17 |
+
*
|
18 |
+
* @since 1.4.0
|
19 |
+
*/
|
20 |
+
do_action( 'caldera_forms_widget_init' );
|
21 |
}
|
22 |
|
23 |
/**
|
102 |
}
|
103 |
|
104 |
function caldera_forms_register_widget() {
|
105 |
+
if( ! did_action( 'caldera_forms_widget_init' ) ){
|
106 |
+
register_widget( 'Caldera_Forms_Widget' );
|
107 |
+
}
|
108 |
+
|
109 |
}
|
110 |
|
111 |
add_action( 'widgets_init', 'caldera_forms_register_widget' );
|
composer.json
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name" : "Desertsnowman/caldera-forms",
|
3 |
+
"description" : "Create complex grid based, responsive forms easily with an easy to use drag and drop layout builder",
|
4 |
+
"type" : "wordpress-plugin",
|
5 |
+
"keywords" : [ "wordpress", "forms", "caldera" ],
|
6 |
+
"license" : "GPL-2.0+",
|
7 |
+
"authors" : [
|
8 |
+
{
|
9 |
+
"name" : "David Cramer",
|
10 |
+
"homepage": "http://cramer.co.za",
|
11 |
+
"role" : "Lead Developer"
|
12 |
+
}
|
13 |
+
],
|
14 |
+
"homepage" : "http://calderaforms.com"
|
15 |
+
}
|
fields/advanced_file/config_template.php
CHANGED
@@ -1,29 +1,37 @@
|
|
1 |
<div class="caldera-config-group">
|
2 |
-
<label
|
3 |
<div class="caldera-config-field">
|
4 |
-
<input id="{{_id}}_attach" type="checkbox" class="field-config" name="{{_name}}[attach]" value="1" {{#if attach}}checked="checked"{{/if}}>
|
5 |
</div>
|
6 |
</div>
|
7 |
|
8 |
<div class="caldera-config-group">
|
9 |
-
<label
|
10 |
<div class="caldera-config-field">
|
11 |
-
<input id="{{_id}}_allow_multiple" type="checkbox" class="field-config" name="{{_name}}[multi_upload]" value="1" {{#if multi_upload}}checked="checked"{{/if}}>
|
12 |
</div>
|
13 |
</div>
|
14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
<div class="caldera-config-group" id="{{_id}}_allow_multiple_text_wrap">
|
16 |
-
<label for="{{_id}}_allow_multiple_text"><?php echo
|
17 |
<div class="caldera-config-field">
|
18 |
<input id="{{_id}}_allow_multiple_text" type="text" class="field-config" name="{{_name}}[multi_upload_text]" value="{{#if multi_upload_text}}{{multi_upload_text}}{{/if}}">
|
19 |
</div>
|
20 |
</div>
|
21 |
|
22 |
<div class="caldera-config-group">
|
23 |
-
<label for="{{_id}}_allowed"><?php echo
|
24 |
<div class="caldera-config-field">
|
25 |
<input id="{{_id}}_allowed" type="text" class="field-config" name="{{_name}}[allowed]" value="{{allowed}}">
|
26 |
-
<p class="description"><?php echo
|
27 |
</div>
|
28 |
</div>
|
29 |
|
1 |
<div class="caldera-config-group">
|
2 |
+
<label role="presentation"></label>
|
3 |
<div class="caldera-config-field">
|
4 |
+
<label for="{{_id}}_attach"><input id="{{_id}}_attach" type="checkbox" class="field-config" name="{{_name}}[attach]" value="1" {{#if attach}}checked="checked"{{/if}}> <?php echo esc_html__('Attach to mailer', 'caldera-forms'); ?></label>
|
5 |
</div>
|
6 |
</div>
|
7 |
|
8 |
<div class="caldera-config-group">
|
9 |
+
<label role="presentation"></label>
|
10 |
<div class="caldera-config-field">
|
11 |
+
<label for="{{_id}}_allow_multiple"><input id="{{_id}}_allow_multiple" type="checkbox" class="field-config" name="{{_name}}[multi_upload]" value="1" {{#if multi_upload}}checked="checked"{{/if}}> <?php echo esc_html__('Allow Multiple', 'caldera-forms'); ?></label>
|
12 |
</div>
|
13 |
</div>
|
14 |
|
15 |
+
<div class="caldera-config-group">
|
16 |
+
<label role="presentation"></label>
|
17 |
+
<div class="caldera-config-field">
|
18 |
+
<label for="{{_id}}_media_library"><input id="{{_id}}_media_library" type="checkbox" class="field-config" name="{{_name}}[media_lib]" value="1" {{#if media_lib}}checked="checked"{{/if}}> <?php echo esc_html__('Add to Media Library', 'caldera-forms'); ?></label>
|
19 |
+
</div>
|
20 |
+
</div>
|
21 |
+
|
22 |
+
|
23 |
<div class="caldera-config-group" id="{{_id}}_allow_multiple_text_wrap">
|
24 |
+
<label for="{{_id}}_allow_multiple_text"><?php echo esc_html__('Button Text', 'caldera-forms'); ?></label>
|
25 |
<div class="caldera-config-field">
|
26 |
<input id="{{_id}}_allow_multiple_text" type="text" class="field-config" name="{{_name}}[multi_upload_text]" value="{{#if multi_upload_text}}{{multi_upload_text}}{{/if}}">
|
27 |
</div>
|
28 |
</div>
|
29 |
|
30 |
<div class="caldera-config-group">
|
31 |
+
<label for="{{_id}}_allowed"><?php echo esc_html__('Allowed Types', 'caldera-forms'); ?></label>
|
32 |
<div class="caldera-config-field">
|
33 |
<input id="{{_id}}_allowed" type="text" class="field-config" name="{{_name}}[allowed]" value="{{allowed}}">
|
34 |
+
<p class="description"><?php echo esc_html__('Comma separated eg. jpg,pdf,txt', 'caldera-forms'); ?></p>
|
35 |
</div>
|
36 |
</div>
|
37 |
|
fields/advanced_file/field.php
CHANGED
@@ -4,9 +4,12 @@
|
|
4 |
$is_multiple .= ' multiple="multiple"';
|
5 |
}
|
6 |
$uniqu_code = uniqid('trupl');
|
|
|
7 |
if( $field_required !== null ){
|
|
|
8 |
$field_required = null;
|
9 |
$is_multiple .= ' data-required="true"';
|
|
|
10 |
}
|
11 |
if( empty( $field['config']['multi_upload_text'] ) ){
|
12 |
$field['config']['multi_upload_text'] = __( 'Add File', 'caldera-forms' );
|
@@ -14,16 +17,45 @@
|
|
14 |
$field['config']['multi_upload_text'] = __( 'Add Files', 'caldera-forms' );
|
15 |
}
|
16 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
|
18 |
?><?php echo $wrapper_before; ?>
|
19 |
<?php echo $field_label; ?>
|
20 |
<?php echo $field_before; ?>
|
21 |
-
<div id="<?php echo $field_id; ?>_file_list" data-
|
22 |
|
23 |
-
<button type="button" class="btn btn-block cf-uploader-trigger" data-parent="<?php echo $field_id; ?>"><?php echo esc_html( $field['config']['multi_upload_text'] ); ?></button>
|
24 |
|
25 |
-
<input style="display:none;" class="cf-multi-uploader" data-controlid="<?php echo $uniqu_code; ?>" <?php echo $field_placeholder; ?> <?php echo $is_multiple; ?> type="file" data-field="<?php echo $field_base_id; ?>" id="<?php echo $field_id; ?>" name="<?php echo $field_name; ?>" <?php echo $field_required; ?>>
|
26 |
-
<input type="
|
|
|
27 |
<?php echo $field_caption; ?>
|
28 |
<?php echo $field_after; ?>
|
29 |
<?php echo $wrapper_after; ?>
|
4 |
$is_multiple .= ' multiple="multiple"';
|
5 |
}
|
6 |
$uniqu_code = uniqid('trupl');
|
7 |
+
$required_check = '';
|
8 |
if( $field_required !== null ){
|
9 |
+
$required_check = 'required="required"';
|
10 |
$field_required = null;
|
11 |
$is_multiple .= ' data-required="true"';
|
12 |
+
|
13 |
}
|
14 |
if( empty( $field['config']['multi_upload_text'] ) ){
|
15 |
$field['config']['multi_upload_text'] = __( 'Add File', 'caldera-forms' );
|
17 |
$field['config']['multi_upload_text'] = __( 'Add Files', 'caldera-forms' );
|
18 |
}
|
19 |
}
|
20 |
+
$accept_tag = array();
|
21 |
+
if( !empty( $field['config']['allowed'] ) ){
|
22 |
+
$allowed = array_map('trim', explode(',', trim( $field['config']['allowed'] ) ) );
|
23 |
+
$field['config']['allowed'] = array();
|
24 |
+
foreach( $allowed as $ext ){
|
25 |
+
$ext = trim( $ext, '.' );
|
26 |
+
$file_type = wp_check_filetype( 'tmp.'. $ext );
|
27 |
+
$field['config']['allowed'][] = $file_type['type'];
|
28 |
+
$accept_tag[] = '.' . $ext;
|
29 |
+
}
|
30 |
+
}else{
|
31 |
+
$allowed = get_allowed_mime_types();
|
32 |
+
$field['config']['allowed'] = array();
|
33 |
+
foreach( $allowed as $ext=>$mime ){
|
34 |
+
$field['config']['allowed'][] = $mime;
|
35 |
+
$accept_tag[] = '.' . str_replace('|', ',.', $ext );
|
36 |
+
}
|
37 |
+
|
38 |
+
}
|
39 |
+
$accept_tag = 'accept="' . esc_attr( implode(',', $accept_tag) ) . '"';
|
40 |
+
|
41 |
+
$field['config']['max_size'] = wp_max_upload_size();
|
42 |
+
|
43 |
+
$field['config']['notices'] = array(
|
44 |
+
'file_exceeds_size_limit' => esc_html__( 'File exceeds the maximum upload size for this site.', 'caldera-forms' ),
|
45 |
+
'zero_byte_file' => esc_html__( 'This file is empty. Please try another.', 'caldera-forms' ),
|
46 |
+
'invalid_filetype' => esc_html__( 'This file type is not allowed. Please try another.', 'caldera-forms' ),
|
47 |
+
);
|
48 |
|
49 |
?><?php echo $wrapper_before; ?>
|
50 |
<?php echo $field_label; ?>
|
51 |
<?php echo $field_before; ?>
|
52 |
+
<div id="<?php echo esc_attr( $field_id ); ?>_file_list" data-id="<?php echo esc_attr( $field_id ); ?>" data-field="<?php echo esc_attr( $field_base_id ); ?>" class="cf-multi-uploader-list"></div>
|
53 |
|
54 |
+
<button id="<?php echo esc_attr( $field_id ); ?>_trigger" type="button" class="btn btn-block cf-uploader-trigger" data-parent="<?php echo esc_attr( $field_id ); ?>"><?php echo esc_html( $field['config']['multi_upload_text'] ); ?></button>
|
55 |
|
56 |
+
<input style="display:none;" <?php echo $accept_tag; ?> class="cf-multi-uploader" data-config="<?php echo esc_attr( json_encode( $field['config'] ) ); ?>" data-controlid="<?php echo esc_attr( $uniqu_code ); ?>" <?php echo $field_placeholder; ?> <?php echo $is_multiple; ?> type="file" data-field="<?php echo esc_attr( $field_base_id ); ?>" id="<?php echo esc_attr( $field_id ); ?>" name="<?php echo esc_attr( $field_name ); ?>" <?php echo $field_required; ?>>
|
57 |
+
<input style="display:none;" type="text" id="<?php echo esc_attr( $field_id ); ?>_validator" data-parsley-file-type="true" <?php echo $required_check; ?>>
|
58 |
+
<input type="hidden" name="<?php echo esc_attr( $field_name ); ?>" value="<?php echo esc_attr( $uniqu_code ); ?>">
|
59 |
<?php echo $field_caption; ?>
|
60 |
<?php echo $field_after; ?>
|
61 |
<?php echo $wrapper_after; ?>
|
fields/advanced_file/uploader.js
CHANGED
@@ -1,120 +1,177 @@
|
|
1 |
var cf_uploader_filelist = {};
|
2 |
function size_format(bytes) {
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
}
|
43 |
|
44 |
-
function handleFileSelect(evt) {
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
}
|
76 |
|
77 |
function handleDragOver(evt) {
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
}
|
82 |
|
83 |
function handleDragOver(event) {
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
}
|
88 |
|
89 |
jQuery( function( $ ){
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
118 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
|
120 |
})
|
1 |
var cf_uploader_filelist = {};
|
2 |
function size_format(bytes) {
|
3 |
+
var converted = false;
|
4 |
+
quant = [
|
5 |
+
{
|
6 |
+
unit: 'TB',
|
7 |
+
mag: 1099511627776
|
8 |
+
},
|
9 |
+
|
10 |
+
{
|
11 |
+
unit: 'GB',
|
12 |
+
mag: 1073741824
|
13 |
+
},
|
14 |
+
|
15 |
+
{
|
16 |
+
unit: 'MB',
|
17 |
+
mag: 1048576
|
18 |
+
},
|
19 |
+
|
20 |
+
{
|
21 |
+
unit: 'kB',
|
22 |
+
mag: 1024
|
23 |
+
},
|
24 |
+
|
25 |
+
{
|
26 |
+
unit: 'B ',
|
27 |
+
mag: 1
|
28 |
+
}
|
29 |
+
];
|
30 |
+
quant.forEach(function(v){
|
31 |
+
if (parseFloat(bytes) >= v.mag && converted == false){
|
32 |
+
converted = bytes/v.mag;
|
33 |
+
if( bytes > 1048576 ){
|
34 |
+
converted = converted.toFixed(2);
|
35 |
+
}else{
|
36 |
+
converted = Math.round( converted );
|
37 |
+
}
|
38 |
+
converted = converted +' '+v.unit;
|
39 |
+
}
|
40 |
+
});
|
41 |
+
return converted;
|
42 |
}
|
43 |
|
44 |
+
function handleFileSelect( evt, config ) {
|
45 |
+
evt.stopPropagation();
|
46 |
+
evt.preventDefault();
|
47 |
+
if(evt.dataTransfer){
|
48 |
+
var files = evt.dataTransfer.files;
|
49 |
+
}else{
|
50 |
+
var files = evt.target.files;
|
51 |
+
}
|
52 |
+
// files is a FileList of File objects. List some properties.
|
53 |
+
var output = [], validator = 'valid';
|
54 |
+
// get length
|
55 |
+
for (var i = 0; i < files.length ; i++) {
|
56 |
+
var id = 'fl' + Math.round(Math.random() * 187465827348977),
|
57 |
+
state = 1,
|
58 |
+
error = '';
|
59 |
+
if( config.allowed.length ){
|
60 |
+
if( config.allowed.indexOf( files[ i ].type ) < 0 ){
|
61 |
+
state = 0;
|
62 |
+
error = config.notices.invalid_filetype;
|
63 |
+
}
|
64 |
+
}
|
65 |
+
if( config.max_size ){
|
66 |
+
if( files[ i ].size > config.max_size ){
|
67 |
+
state = 0;
|
68 |
+
error = config.notices.file_exceeds_size_limit;
|
69 |
+
}
|
70 |
+
}
|
71 |
+
if( ! files[ i ].size ){
|
72 |
+
state = 0;
|
73 |
+
error = config.notices.zero_byte_file;
|
74 |
+
}
|
75 |
+
|
76 |
+
cf_uploader_filelist[ evt.target.id + '_file_' + id ] = {
|
77 |
+
file : files[ i ],
|
78 |
+
state : state,
|
79 |
+
field : config.id,
|
80 |
+
message : error
|
81 |
+
};
|
82 |
+
}
|
83 |
+
// do preview
|
84 |
+
for( var i in cf_uploader_filelist ){
|
85 |
+
if( cf_uploader_filelist[i].field !== config.id ){ continue; }
|
86 |
+
var state_class = '',
|
87 |
+
error_message = '';
|
88 |
+
if( cf_uploader_filelist[ i ].state === 0 ){
|
89 |
+
state_class = 'has-error';
|
90 |
+
}
|
91 |
+
|
92 |
+
output.push('<li class="cf-uploader-queue-item ' + i + ' ' + state_class + '">',
|
93 |
+
'<a href="#remove-file" data-file="' + i + '" class="cf-file-remove">×</a> <span class="file-name">', cf_uploader_filelist[ i ].file.name, '</span> ',
|
94 |
+
'<div class="progress-bar" style="background:#ececec;"><div class="bar" id="progress-file-' + i + '" style="height:2px;width:0%;background:#a3be5f;"></div></div>',
|
95 |
+
'<small class="file-type">', cf_uploader_filelist[ i ].file.type || 'n/a', '</small> ',
|
96 |
+
'<small class="file-size">' + size_format( cf_uploader_filelist[ i ].file.size ) + '</small>',
|
97 |
+
'<small class="file-error">' + cf_uploader_filelist[ i ].message + '</small>',
|
98 |
+
'</li>');
|
99 |
+
if( cf_uploader_filelist[ i ].message.length ){
|
100 |
+
validator = cf_uploader_filelist[ i ].message;
|
101 |
+
}
|
102 |
+
}
|
103 |
+
evt.target.value = null;
|
104 |
+
|
105 |
+
document.getElementById( evt.target.id + '_file_list' ).innerHTML = '<ul class="cf-adv-preview-list">' + output.join('') + '</ul>';
|
106 |
+
|
107 |
+
jQuery( '#' + evt.target.id + '_validator' ).val( validator );
|
108 |
}
|
109 |
|
110 |
function handleDragOver(evt) {
|
111 |
+
evt.stopPropagation();
|
112 |
+
evt.preventDefault();
|
113 |
+
evt.dataTransfer.dropEffect = 'copy'; // Explicitly show this is a copy.
|
114 |
}
|
115 |
|
116 |
function handleDragOver(event) {
|
117 |
+
event.stopPropagation();
|
118 |
+
event.preventDefault();
|
119 |
+
event.dataTransfer.dropEffect = 'copy';
|
120 |
}
|
121 |
|
122 |
jQuery( function( $ ){
|
123 |
+
$( document ).on('click', '.cf-uploader-trigger', function(){
|
124 |
+
var clicked = $(this);
|
125 |
+
$( '#' + clicked.data('parent') ).trigger('click');
|
126 |
+
});
|
127 |
+
$('.cf-multi-uploader').hide();
|
128 |
+
$( document ).on('click', '.cf-file-remove', function( e ){
|
129 |
+
e.preventDefault();
|
130 |
+
var clicked = $( this ),
|
131 |
+
list = clicked.closest('.cf-adv-preview-list'),
|
132 |
+
field = clicked.closest('.cf-multi-uploader-list').data('field'),
|
133 |
+
field_id = clicked.closest('.cf-multi-uploader-list').data('id'),
|
134 |
+
validator = $('#' + field_id + '_validator');
|
135 |
+
|
136 |
+
validator.val('');
|
137 |
+
|
138 |
+
$('[data-parent="' + field + '"]').show();
|
139 |
+
delete cf_uploader_filelist[ clicked.data('file') ];
|
140 |
+
clicked.closest('.cf-multi-uploader-list').parent().find('.cf-uploader-trigger').show();
|
141 |
+
clicked.parent().remove();
|
142 |
+
if( ! list.children().length ){
|
143 |
+
list.remove();
|
144 |
+
}
|
145 |
+
|
146 |
+
for( var fid in cf_uploader_filelist ){
|
147 |
+
if( cf_uploader_filelist[ fid ].field === field_id && cf_uploader_filelist[ fid ].message.length ){
|
148 |
+
validator.val( cf_uploader_filelist[ fid ].message );
|
149 |
+
}
|
150 |
+
}
|
151 |
+
|
152 |
+
});
|
153 |
+
|
154 |
+
$( document ).on('change', '.cf-multi-uploader', function( e ){
|
155 |
+
var field = $(this),
|
156 |
+
config = field.data('config');
|
157 |
+
config.id = field.prop('id');
|
158 |
+
if( !field.prop( 'multiple' ) ){
|
159 |
+
cf_uploader_filelist = {};
|
160 |
+
field.parent().find('.cf-uploader-trigger').hide();
|
161 |
+
}
|
162 |
+
console.log( field );
|
163 |
+
handleFileSelect( e, config );
|
164 |
+
});
|
165 |
|
166 |
+
window.Parsley
|
167 |
+
.addValidator('fileType', {
|
168 |
+
requirementType: 'string',
|
169 |
+
validateString: function( value, requirement ) {
|
170 |
+
if( value === 'valid' ){
|
171 |
+
return true;
|
172 |
+
}
|
173 |
+
return false;
|
174 |
+
}
|
175 |
+
});
|
176 |
|
177 |
})
|
fields/advanced_file/uploader.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
function size_format(e){var
|
1 |
+
function size_format(e){var l=!1;return quant=[{unit:"TB",mag:1099511627776},{unit:"GB",mag:1073741824},{unit:"MB",mag:1048576},{unit:"kB",mag:1024},{unit:"B ",mag:1}],quant.forEach(function(a){parseFloat(e)>=a.mag&&0==l&&(l=e/a.mag,l=e>1048576?l.toFixed(2):Math.round(l),l=l+" "+a.unit)}),l}function handleFileSelect(e,l){if(e.stopPropagation(),e.preventDefault(),e.dataTransfer)var a=e.dataTransfer.files;else var a=e.target.files;for(var i=[],t="valid",r=0;r<a.length;r++){var f="fl"+Math.round(0xaa7fca0bf1f1*Math.random()),s=1,o="";l.allowed.length&&l.allowed.indexOf(a[r].type)<0&&(s=0,o=l.notices.invalid_filetype),l.max_size&&a[r].size>l.max_size&&(s=0,o=l.notices.file_exceeds_size_limit),a[r].size||(s=0,o=l.notices.zero_byte_file),cf_uploader_filelist[e.target.id+"_file_"+f]={file:a[r],state:s,field:l.id,message:o}}for(var r in cf_uploader_filelist)if(cf_uploader_filelist[r].field===l.id){var n="";0===cf_uploader_filelist[r].state&&(n="has-error"),i.push('<li class="cf-uploader-queue-item '+r+" "+n+'">','<a href="#remove-file" data-file="'+r+'" class="cf-file-remove">×</a> <span class="file-name">',cf_uploader_filelist[r].file.name,"</span> ",'<div class="progress-bar" style="background:#ececec;"><div class="bar" id="progress-file-'+r+'" style="height:2px;width:0%;background:#a3be5f;"></div></div>','<small class="file-type">',cf_uploader_filelist[r].file.type||"n/a","</small> ",'<small class="file-size">'+size_format(cf_uploader_filelist[r].file.size)+"</small>",'<small class="file-error">'+cf_uploader_filelist[r].message+"</small>","</li>"),cf_uploader_filelist[r].message.length&&(t=cf_uploader_filelist[r].message)}e.target.value=null,document.getElementById(e.target.id+"_file_list").innerHTML='<ul class="cf-adv-preview-list">'+i.join("")+"</ul>",jQuery("#"+e.target.id+"_validator").val(t)}function handleDragOver(e){e.stopPropagation(),e.preventDefault(),e.dataTransfer.dropEffect="copy"}function handleDragOver(e){e.stopPropagation(),e.preventDefault(),e.dataTransfer.dropEffect="copy"}var cf_uploader_filelist={};jQuery(function(e){e(document).on("click",".cf-uploader-trigger",function(){var l=e(this);e("#"+l.data("parent")).trigger("click")}),e(".cf-multi-uploader").hide(),e(document).on("click",".cf-file-remove",function(l){l.preventDefault();var a=e(this),i=a.closest(".cf-adv-preview-list"),t=a.closest(".cf-multi-uploader-list").data("field"),r=a.closest(".cf-multi-uploader-list").data("id"),f=e("#"+r+"_validator");f.val(""),e('[data-parent="'+t+'"]').show(),delete cf_uploader_filelist[a.data("file")],a.closest(".cf-multi-uploader-list").parent().find(".cf-uploader-trigger").show(),a.parent().remove(),i.children().length||i.remove();for(var s in cf_uploader_filelist)cf_uploader_filelist[s].field===r&&cf_uploader_filelist[s].message.length&&f.val(cf_uploader_filelist[s].message)}),e(document).on("change",".cf-multi-uploader",function(l){var a=e(this),i=a.data("config");i.id=a.prop("id"),a.prop("multiple")||(cf_uploader_filelist={},a.parent().find(".cf-uploader-trigger").hide()),console.log(a),handleFileSelect(l,i)}),window.Parsley.addValidator("fileType",{requirementType:"string",validateString:function(e,l){return"valid"===e}})});
|
fields/button/field.php
CHANGED
@@ -23,10 +23,10 @@ if($field['config']['type'] == 'next' || $field['config']['type'] == 'prev'){
|
|
23 |
<label class="control-label"> </label>
|
24 |
<?php } ?>
|
25 |
<?php echo $field_before; ?>
|
26 |
-
<input data-field="<?php echo $field_base_id; ?>" <?php echo $btn_action; ?> class="<?php echo $field['config']['class']; ?>" type="<?php echo $btnType; ?>" name="<?php echo $field_name; ?>_btn" value="<?php echo esc_attr( $field['label'] ); ?>" id="<?php echo $field_id; ?>"
|
27 |
<?php echo $field_after; ?>
|
28 |
<?php echo $wrapper_after; ?>
|
29 |
-
<input class="button_trigger_<?php echo $current_form_count; ?>" type="hidden" data-field="<?php echo $field_base_id; ?>" id="<?php echo $field_id; ?>_btn" name="<?php echo $field_name; ?>" value="<?php echo esc_attr( $field_value ); ?>">
|
30 |
<?php
|
31 |
ob_start();
|
32 |
?>
|
23 |
<label class="control-label"> </label>
|
24 |
<?php } ?>
|
25 |
<?php echo $field_before; ?>
|
26 |
+
<input data-field="<?php echo esc_attr( $field_base_id ); ?>" <?php echo $btn_action; ?> class="<?php echo esc_attr( $field['config']['class'] ); ?>" type="<?php echo esc_attr( $btnType ); ?>" name="<?php echo esc_attr( $field_name ); ?>_btn" value="<?php echo esc_attr( $field['label'] ); ?>" id="<?php echo esc_attr( $field_id ); ?>" <?php echo $field_structure['aria']; ?>>
|
27 |
<?php echo $field_after; ?>
|
28 |
<?php echo $wrapper_after; ?>
|
29 |
+
<input class="button_trigger_<?php echo $current_form_count; ?>" type="hidden" data-field="<?php echo esc_attr( $field_base_id ); ?>" id="<?php echo esc_attr( $field_id ); ?>_btn" name="<?php echo esc_attr( $field_name ); ?>" value="<?php echo esc_attr( $field_value ); ?>">
|
30 |
<?php
|
31 |
ob_start();
|
32 |
?>
|
fields/calculation/field.php
CHANGED
@@ -22,8 +22,8 @@ $thousand_separator = $field['config']['thousand_separator'];
|
|
22 |
?><?php echo $wrapper_before; ?>
|
23 |
<?php echo $field_label; ?>
|
24 |
<?php echo $field_before; ?>
|
25 |
-
<<?php echo $elementType; ?> class="<?php echo $field['config']['classes']; ?>"><?php echo $field['config']['before']; ?><span id="<?php echo $field_id; ?>"><?php echo $field_value; ?></span><?php echo $field['config']['after']; ?></<?php echo $elementType; ?>>
|
26 |
-
<input type="hidden" name="<?php echo $field_name; ?>" value="0" data-field="<?php echo $field_base_id; ?>" >
|
27 |
<?php echo $field_caption; ?>
|
28 |
<?php echo $field_after; ?>
|
29 |
<?php echo $wrapper_after; ?>
|
@@ -121,9 +121,11 @@ if(!empty($binds)){
|
|
121 |
total = total.toFixed(2);
|
122 |
view_total = addCommas( total );
|
123 |
<?php } ?>
|
124 |
-
|
|
|
|
|
125 |
$('#<?php echo $field_id; ?>').html( view_total );
|
126 |
-
$('[data-field="<?php echo $field_base_id; ?>"]').val( total ).trigger('change');
|
127 |
|
128 |
}
|
129 |
$('body').on('change keyup', '<?php echo implode(',', $bindtriggers); ?>', function(e){
|
22 |
?><?php echo $wrapper_before; ?>
|
23 |
<?php echo $field_label; ?>
|
24 |
<?php echo $field_before; ?>
|
25 |
+
<<?php echo $elementType . $field_structure['aria']; ?> class="<?php echo $field['config']['classes']; ?>"><?php echo $field['config']['before']; ?><span id="<?php echo esc_attr( $field_id ); ?>"><?php echo $field_value; ?></span><?php echo $field['config']['after']; ?></<?php echo $elementType; ?>>
|
26 |
+
<input type="hidden" name="<?php echo esc_attr( $field_name ); ?>" value="0" data-field="<?php echo esc_attr( $field_base_id ); ?>" >
|
27 |
<?php echo $field_caption; ?>
|
28 |
<?php echo $field_after; ?>
|
29 |
<?php echo $wrapper_after; ?>
|
121 |
total = total.toFixed(2);
|
122 |
view_total = addCommas( total );
|
123 |
<?php } ?>
|
124 |
+
if( view_total.toString().length > 18 ){
|
125 |
+
view_total = Math.round( view_total );
|
126 |
+
}
|
127 |
$('#<?php echo $field_id; ?>').html( view_total );
|
128 |
+
$('[data-field="<?php echo esc_attr( $field_base_id ); ?>"]').val( total ).trigger('change');
|
129 |
|
130 |
}
|
131 |
$('body').on('change keyup', '<?php echo implode(',', $bindtriggers); ?>', function(e){
|
fields/calculation/line-templates.php
CHANGED
@@ -24,7 +24,7 @@
|
|
24 |
<option value="*" {{#is operator value="*"}}selected="selected"{{/is}}>×</option>
|
25 |
<option value="/" {{#is operator value="/"}}selected="selected"{{/is}}>÷</option>
|
26 |
</select>
|
27 |
-
<select class="calculation-operator-field caldera-field-bind" data-default="{{field}}" style="max-width:229px;width:229px;"></select>
|
28 |
<button class="button remove-operator-line pull-right" type="button"><i class="icon-join"></i></button>
|
29 |
</div>
|
30 |
{{/each}}
|
@@ -83,7 +83,7 @@ function build_calculations_formular(id, obj){
|
|
83 |
};
|
84 |
|
85 |
groups.each(function(k,v){
|
86 |
-
|
87 |
var lines = jQuery(v).find('.calculation-group-line'),
|
88 |
connector = jQuery(v).find('.calculation-operator'),
|
89 |
group = {};
|
24 |
<option value="*" {{#is operator value="*"}}selected="selected"{{/is}}>×</option>
|
25 |
<option value="/" {{#is operator value="/"}}selected="selected"{{/is}}>÷</option>
|
26 |
</select>
|
27 |
+
<select class="calculation-operator-field caldera-field-bind" data-exclude="system" data-default="{{field}}" style="max-width:229px;width:229px;"></select>
|
28 |
<button class="button remove-operator-line pull-right" type="button"><i class="icon-join"></i></button>
|
29 |
</div>
|
30 |
{{/each}}
|
83 |
};
|
84 |
|
85 |
groups.each(function(k,v){
|
86 |
+
|
87 |
var lines = jQuery(v).find('.calculation-group-line'),
|
88 |
connector = jQuery(v).find('.calculation-operator'),
|
89 |
group = {};
|
fields/calculation/preview.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<div class="preview-caldera-config-group">
|
2 |
{{#unless hide_label}}<lable class="control-label">{{label}}{{#if required}} <span style="color:#ff0000;">*</span>{{/if}}</lable>{{/unless}}
|
3 |
<div class="preview-caldera-config-field">
|
4 |
-
<{{config/element}} class="{{config/classes}}">{{config/before}}0{{#if config/fixed}}.00{{/if}}{{config/after}}</{{config/element}}>
|
5 |
<span class="help-block">{{caption}}</span>
|
6 |
</div>
|
7 |
</div>
|
1 |
<div class="preview-caldera-config-group">
|
2 |
{{#unless hide_label}}<lable class="control-label">{{label}}{{#if required}} <span style="color:#ff0000;">*</span>{{/if}}</lable>{{/unless}}
|
3 |
<div class="preview-caldera-config-field">
|
4 |
+
{{#if config/element}}<{{config/element}} class="{{config/classes}}">{{/if}}{{config/before}}0{{#if config/fixed}}.00{{/if}}{{config/after}}{{#if config/element}}</{{config/element}}>{{/if}}
|
5 |
<span class="help-block">{{caption}}</span>
|
6 |
</div>
|
7 |
</div>
|
fields/checkbox/field.php
CHANGED
@@ -4,23 +4,22 @@
|
|
4 |
<?php
|
5 |
|
6 |
$req_class = '';
|
|
|
7 |
if( !empty( $field['required'] ) ){
|
8 |
$req_class = ' option-required';
|
|
|
9 |
}
|
10 |
|
11 |
if(!empty($field['config']['option'])){
|
12 |
|
13 |
if(isset( $field['config'] ) && isset($field['config']['default']) && isset($field['config']['option'][$field['config']['default']])){
|
14 |
-
|
15 |
if( $field['config']['default'] === $field_value ){
|
16 |
$field_value = (array) $field['config']['option'][$field['config']['default']]['value'];
|
17 |
}
|
18 |
|
19 |
}
|
20 |
-
|
21 |
-
/*<input type="checkbox" id="<?php echo $field_id; ?>" data-field="<?php echo $field_base_id; ?>" class="field-config" name="<?php echo $field_name; ?>" value="1" <?php if(!empty($field_value)){ ?>checked="true"<?php } ?>>
|
22 |
-
*/
|
23 |
-
|
24 |
foreach($field['config']['option'] as $option_key=>$option){
|
25 |
if(!isset($option['value'])){
|
26 |
$option['value'] = $option['label'];
|
@@ -29,7 +28,7 @@
|
|
29 |
<?php if(empty($field['config']['inline'])){ ?>
|
30 |
<div class="checkbox">
|
31 |
<?php } ?>
|
32 |
-
<label<?php if(!empty($field['config']['inline'])){ ?> class="checkbox-inline"<?php } ?> for="<?php echo $field_id . '_' . $option_key; ?>"><input type="checkbox" data-label="<?php echo esc_attr( $option['label'] );?>" data-field="<?php echo $field_base_id; ?>" id="<?php echo $field_id . '_' . $option_key; ?>" class="<?php echo $field_id . $req_class; ?>" name="<?php echo $field_name; ?>[<?php echo $option_key; ?>]" value="<?php echo esc_attr( $option['value'] ); ?>" <?php if( in_array( $option['value'], (array) $field_value) ){ ?>checked="checked"<?php } ?>> <?php echo $option['label']; ?></label>
|
33 |
<?php if(empty($field['config']['inline'])){ ?>
|
34 |
</div>
|
35 |
<?php } ?>
|
4 |
<?php
|
5 |
|
6 |
$req_class = '';
|
7 |
+
$parsley_req = '';
|
8 |
if( !empty( $field['required'] ) ){
|
9 |
$req_class = ' option-required';
|
10 |
+
$parsley_req = 'data-parsley-required="true" data-parsley-group="' . esc_attr( $field_id ) . '" data-parsley-multiple="' . esc_attr( $field_id ). '"';
|
11 |
}
|
12 |
|
13 |
if(!empty($field['config']['option'])){
|
14 |
|
15 |
if(isset( $field['config'] ) && isset($field['config']['default']) && isset($field['config']['option'][$field['config']['default']])){
|
16 |
+
|
17 |
if( $field['config']['default'] === $field_value ){
|
18 |
$field_value = (array) $field['config']['option'][$field['config']['default']]['value'];
|
19 |
}
|
20 |
|
21 |
}
|
22 |
+
|
|
|
|
|
|
|
23 |
foreach($field['config']['option'] as $option_key=>$option){
|
24 |
if(!isset($option['value'])){
|
25 |
$option['value'] = $option['label'];
|
28 |
<?php if(empty($field['config']['inline'])){ ?>
|
29 |
<div class="checkbox">
|
30 |
<?php } ?>
|
31 |
+
<label<?php if(!empty($field['config']['inline'])){ ?> class="checkbox-inline"<?php } ?> for="<?php echo esc_attr( $field_id . '_' . $option_key ); ?>"><input <?php echo $parsley_req; ?> type="checkbox" data-label="<?php echo esc_attr( $option['label'] );?>" data-field="<?php echo esc_attr( $field_base_id ); ?>" id="<?php echo $field_id . '_' . $option_key; ?>" class="<?php echo $field_id . $req_class; ?>" name="<?php echo esc_attr( $field_name ); ?>[<?php echo esc_attr( $option_key ); ?>]" value="<?php echo esc_attr( $option['value'] ); ?>" <?php if( in_array( $option['value'], (array) $field_value) ){ ?>checked="checked"<?php } ?>> <?php echo $option['label']; ?></label>
|
32 |
<?php if(empty($field['config']['inline'])){ ?>
|
33 |
</div>
|
34 |
<?php } ?>
|
fields/color_picker/field.php
CHANGED
@@ -1,7
|