Version Description
(1 April 2021) =
Changes:
- Final deprecation phase of Ninja Forms 2.9x codebase.
=
Download this release
Release Info
Developer | krmoorhouse |
Plugin | Ninja Forms – The Easy and Powerful Forms Builder |
Version | 3.5.3 |
Comparing to | |
See all releases |
Code changes from version 3.5.2 to 3.5.3
- build/sub-table-block.asset.php +1 -1
- build/sub-table-block.js +1 -1
- deprecated/assets/audio/smw_power_up.wav +0 -0
- deprecated/assets/css/admin-modal.css +0 -432
- deprecated/assets/css/admin-notices.css +0 -55
- deprecated/assets/css/bootstrap-tokenfield.css +0 -209
- deprecated/assets/css/bootstrap-tokenfield.min.css +0 -5
- deprecated/assets/css/combobox.css +0 -58
- deprecated/assets/css/cpt.css +0 -86
- deprecated/assets/css/index.php +0 -2
- deprecated/assets/css/nf-upgrade-handler.css +0 -37
- deprecated/assets/css/notifications.css +0 -39
- deprecated/assets/css/tokenfield-typeahead.css +0 -141
- deprecated/assets/css/tokenfield-typeahead.min.css +0 -5
- deprecated/assets/images/index.php +0 -2
- deprecated/assets/images/nf-badge.png +0 -0
- deprecated/assets/images/nf-logo-vert.png +0 -0
- deprecated/assets/images/pbar-ani.gif +0 -0
- deprecated/assets/images/screenshots/index.php +0 -2
- deprecated/assets/images/screenshots/ss-builder.png +0 -0
- deprecated/assets/images/screenshots/ss-emails-actions.png +0 -0
- deprecated/assets/images/screenshots/ss-field-settings.png +0 -0
- deprecated/assets/images/screenshots/ss-licenses.png +0 -0
- deprecated/assets/images/screenshots/ss-new-form.png +0 -0
- deprecated/assets/images/screenshots/ss-nuke-option.png +0 -0
- deprecated/assets/images/ui-icons_333333_256x240.png +0 -0
- deprecated/assets/images/ui-icons_999999_256x240.png +0 -0
- deprecated/assets/images/ui-icons_cc0000_256x240.png +0 -0
- deprecated/assets/index.php +0 -2
- deprecated/assets/js/dev/admin-modal.js +0 -74
- deprecated/assets/js/dev/bootstrap-tokenfield.js +0 -1031
- deprecated/assets/js/dev/builder.js +0 -519
- deprecated/assets/js/dev/combobox.js +0 -281
- deprecated/assets/js/dev/index.php +0 -2
- deprecated/assets/js/dev/nf-upgrade-handler.js +0 -177
- deprecated/assets/js/dev/notifications.js +0 -116
- deprecated/assets/js/dev/subs-cpt.js +0 -60
- deprecated/assets/js/index.php +0 -2
- deprecated/assets/js/lib/cheet.min.js +0 -1
- deprecated/assets/js/lib/howler.core.min.js +0 -2
- deprecated/assets/js/min/admin-modal.min.js +0 -1
- deprecated/assets/js/min/bootstrap-tokenfield.min.js +0 -7
- deprecated/assets/js/min/builder.min.js +0 -1
- deprecated/assets/js/min/combobox.min.js +0 -1
- deprecated/assets/js/min/index.php +0 -2
- deprecated/assets/js/min/nf-upgrade-handler.min.js +0 -1
- deprecated/assets/js/min/notifications.min.js +0 -1
- deprecated/assets/js/min/step-processing.min.js +0 -1
- deprecated/classes/add-form-modal.php +0 -122
- deprecated/classes/download-all-subs.php +0 -124
- deprecated/classes/form.php +0 -213
- deprecated/classes/forms.php +0 -93
- deprecated/classes/index.php +0 -2
- deprecated/classes/notices-class.php +0 -256
- deprecated/classes/notices-multipart.php +0 -92
- deprecated/classes/notices-save-progress.php +0 -91
- deprecated/classes/notification-base-type.php +0 -94
- deprecated/classes/notification-email.php +0 -413
- deprecated/classes/notification-redirect.php +0 -56
- deprecated/classes/notification-success-message.php +0 -87
- deprecated/classes/notification.php +0 -170
- deprecated/classes/notifications-table.php +0 -427
- deprecated/classes/notifications.php +0 -540
- deprecated/classes/register.php +0 -31
- deprecated/classes/session.php +0 -148
- deprecated/classes/step-processing.php +0 -197
- deprecated/classes/sub.php +0 -405
- deprecated/classes/subs-cpt.php +0 -1232
- deprecated/classes/subs.php +0 -283
- deprecated/css/fonts.css +0 -51
- deprecated/css/index.php +0 -2
- deprecated/css/jquery.rating.css +0 -52
- deprecated/css/ninja-forms-admin.css +0 -962
- deprecated/css/ninja-forms-display.css +0 -323
- deprecated/css/qtip.css +0 -222
- deprecated/css/smoothness/images/index.php +0 -2
- deprecated/css/smoothness/images/pbar-ani-old.gif +0 -0
- deprecated/css/smoothness/images/pbar-ani.gif +0 -0
- deprecated/css/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- deprecated/css/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- deprecated/css/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- deprecated/css/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- deprecated/css/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- deprecated/css/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- deprecated/css/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- deprecated/css/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- deprecated/css/smoothness/images/ui-icons_222222_256x240.png +0 -0
- deprecated/css/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
- deprecated/css/smoothness/images/ui-icons_454545_256x240.png +0 -0
- deprecated/css/smoothness/images/ui-icons_888888_256x240.png +0 -0
- deprecated/css/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
- deprecated/css/smoothness/index.php +0 -2
- deprecated/images/callout.gif +0 -0
- deprecated/images/delete.gif +0 -0
- deprecated/images/empty_star_hover.png +0 -0
- deprecated/images/index.php +0 -2
- deprecated/images/loading.gif +0 -0
- deprecated/images/nf-logo.png +0 -0
- deprecated/images/nfthree-card.png +0 -0
- deprecated/images/ninja-forms-three.png +0 -0
- deprecated/images/ninja-head-ico-small.png +0 -0
- deprecated/images/no.png +0 -0
- deprecated/images/question-ico.gif +0 -0
- deprecated/images/star.gif +0 -0
- deprecated/images/wpninjas-logo.png +0 -0
- deprecated/images/wpnj-ninja-head.png +0 -0
- deprecated/images/xit.gif +0 -0
- deprecated/images/yes.png +0 -0
- deprecated/includes/EDD_SL_Plugin_Updater.php +0 -299
- deprecated/includes/actions.php +0 -43
- deprecated/includes/activation.php +0 -272
- deprecated/includes/admin/admin.php +0 -292
- deprecated/includes/admin/ajax.php +0 -739
- deprecated/includes/admin/display-screen-options.php +0 -121
- deprecated/includes/admin/edit-field/autocomplete-off.php +0 -18
- deprecated/includes/admin/edit-field/calc.php +0 -55
- deprecated/includes/admin/edit-field/custom-class.php +0 -22
- deprecated/includes/admin/edit-field/desc.php +0 -69
- deprecated/includes/admin/edit-field/edit-field.php +0 -161
- deprecated/includes/admin/edit-field/help.php +0 -43
- deprecated/includes/admin/edit-field/hr.php +0 -12
- deprecated/includes/admin/edit-field/index.php +0 -2
- deprecated/includes/admin/edit-field/input-limit.php +0 -45
- deprecated/includes/admin/edit-field/label.php +0 -59
- deprecated/includes/admin/edit-field/li.php +0 -518
- deprecated/includes/admin/edit-field/list-terms.php +0 -72
- deprecated/includes/admin/edit-field/placeholder.php +0 -21
- deprecated/includes/admin/edit-field/post-meta-values.php +0 -96
- deprecated/includes/admin/edit-field/remove-button.php +0 -20
- deprecated/includes/admin/edit-field/req.php +0 -39
- deprecated/includes/admin/edit-field/save-button.php +0 -7
- deprecated/includes/admin/edit-field/sub-settings.php +0 -76
- deprecated/includes/admin/edit-field/user-info-fields.php +0 -56
- deprecated/includes/admin/form-preview.php +0 -46
- deprecated/includes/admin/index.php +0 -2
- deprecated/includes/admin/notices.php +0 -119
- deprecated/includes/admin/output-tab-metabox.php +0 -434
- deprecated/includes/admin/pages/index.php +0 -2
- deprecated/includes/admin/pages/ninja-forms-addons/tabs/addons/addons.php +0 -91
- deprecated/includes/admin/pages/ninja-forms-impexp/index.php +0 -2
- deprecated/includes/admin/pages/ninja-forms-impexp/tabs/impexp-backup/impexp-backup.php +0 -50
- deprecated/includes/admin/pages/ninja-forms-impexp/tabs/impexp-backup/index.php +0 -2
- deprecated/includes/admin/pages/ninja-forms-impexp/tabs/impexp-fields/impexp-fields.php +0 -151
- deprecated/includes/admin/pages/ninja-forms-impexp/tabs/impexp-fields/index.php +0 -2
- deprecated/includes/admin/pages/ninja-forms-impexp/tabs/impexp-forms/impexp-forms.php +0 -298
- deprecated/includes/admin/pages/ninja-forms-impexp/tabs/impexp-forms/index.php +0 -2
- deprecated/includes/admin/pages/ninja-forms-impexp/tabs/impexp-subs/impexp-subs.php +0 -30
- deprecated/includes/admin/pages/ninja-forms-impexp/tabs/impexp-subs/index.php +0 -2
- deprecated/includes/admin/pages/ninja-forms-impexp/tabs/index.php +0 -2
- deprecated/includes/admin/pages/ninja-forms-settings/index.php +0 -2
- deprecated/includes/admin/pages/ninja-forms-settings/tabs/general-settings/general-settings.php +0 -143
- deprecated/includes/admin/pages/ninja-forms-settings/tabs/general-settings/index.php +0 -2
- deprecated/includes/admin/pages/ninja-forms-settings/tabs/index.php +0 -2
- deprecated/includes/admin/pages/ninja-forms-settings/tabs/label-settings/index.php +0 -2
- deprecated/includes/admin/pages/ninja-forms-settings/tabs/label-settings/label-settings.php +0 -104
- deprecated/includes/admin/pages/ninja-forms-settings/tabs/license-settings/index.php +0 -2
- deprecated/includes/admin/pages/ninja-forms-settings/tabs/license-settings/license-settings.php +0 -102
- deprecated/includes/admin/pages/ninja-forms/index.php +0 -2
- deprecated/includes/admin/pages/ninja-forms/tabs/field-settings/edit-field-ul.php +0 -24
- deprecated/includes/admin/pages/ninja-forms/tabs/field-settings/empty-rte.php +0 -15
- deprecated/includes/admin/pages/ninja-forms/tabs/field-settings/field-settings.php +0 -93
- deprecated/includes/admin/pages/ninja-forms/tabs/field-settings/help.php +0 -30
- deprecated/includes/admin/pages/ninja-forms/tabs/field-settings/index.php +0 -2
- deprecated/includes/admin/pages/ninja-forms/tabs/field-settings/sidebars/def-fields.php +0 -34
- deprecated/includes/admin/pages/ninja-forms/tabs/field-settings/sidebars/fav-fields.php +0 -29
- deprecated/includes/admin/pages/ninja-forms/tabs/field-settings/sidebars/index.php +0 -2
- deprecated/includes/admin/pages/ninja-forms/tabs/field-settings/sidebars/layout-fields.php +0 -12
- deprecated/includes/admin/pages/ninja-forms/tabs/field-settings/sidebars/payment-fields.php +0 -49
- deprecated/includes/admin/pages/ninja-forms/tabs/field-settings/sidebars/post-fields.php +0 -48
- deprecated/includes/admin/pages/ninja-forms/tabs/field-settings/sidebars/template-fields.php +0 -12
- deprecated/includes/admin/pages/ninja-forms/tabs/field-settings/sidebars/user-info.php +0 -46
- deprecated/includes/admin/pages/ninja-forms/tabs/form-list/form-list.php +0 -251
- deprecated/includes/admin/pages/ninja-forms/tabs/form-list/index.php +0 -2
- deprecated/includes/admin/pages/ninja-forms/tabs/form-preview/form-preview.php +0 -23
- deprecated/includes/admin/pages/ninja-forms/tabs/form-preview/index.php +0 -2
- deprecated/includes/admin/pages/ninja-forms/tabs/form-settings/form-settings.php +0 -162
- deprecated/includes/admin/pages/ninja-forms/tabs/form-settings/help.php +0 -17
- deprecated/includes/admin/pages/ninja-forms/tabs/form-settings/index.php +0 -2
- deprecated/includes/admin/pages/ninja-forms/tabs/index.php +0 -2
- deprecated/includes/admin/pages/system-status-html.php +0 -304
- deprecated/includes/admin/pages/system-status.php +0 -13
- deprecated/includes/admin/post-metabox.php +0 -90
- deprecated/includes/admin/register-screen-help.php +0 -10
- deprecated/includes/admin/register-screen-options.php +0 -73
- deprecated/includes/admin/save.php +0 -121
- deprecated/includes/admin/scripts.php +0 -161
- deprecated/includes/admin/sidebar-fields.php +0 -20
- deprecated/includes/admin/sidebar.php +0 -194
- deprecated/includes/admin/step-processing.php +0 -160
- deprecated/includes/admin/tabs.php +0 -56
- deprecated/includes/admin/upgrades/class-upgrade-handler.php +0 -162
- deprecated/includes/admin/upgrades/class-upgrade.php +0 -191
- deprecated/includes/admin/upgrades/convert-forms-reset.php +0 -83
- deprecated/includes/admin/upgrades/convert-forms.php +0 -181
- deprecated/includes/admin/upgrades/convert-notifications.php +0 -341
- deprecated/includes/admin/upgrades/convert-subs.php +0 -175
- deprecated/includes/admin/upgrades/database-migrations.php +0 -111
- deprecated/includes/admin/upgrades/index.php +0 -2
- deprecated/includes/admin/upgrades/update-email-settings.php +0 -176
- deprecated/includes/admin/upgrades/upgrade-functions.php +0 -396
- deprecated/includes/admin/upgrades/upgrade-handler-page.html.php +0 -58
- deprecated/includes/admin/upgrades/upgrade-handler-page.php +0 -120
- deprecated/includes/admin/upgrades/upgrades.php +0 -74
- deprecated/includes/admin/welcome.php +0 -548
- deprecated/includes/class-extension-updater.php +0 -298
- deprecated/includes/classes/class-nf-system-status.php +0 -51
- deprecated/includes/classes/index.php +0 -2
- deprecated/includes/database.php +0 -416
- deprecated/includes/deprecated.php +0 -978
- deprecated/includes/display/fields/calc-field-class.php +0 -106
- deprecated/includes/display/fields/clear-complete.php +0 -88
- deprecated/includes/display/fields/default-value-filter.php +0 -36
- deprecated/includes/display/fields/desc.php +0 -61
- deprecated/includes/display/fields/display-fields.php +0 -135
build/sub-table-block.asset.php
CHANGED
@@ -1 +1 @@
|
|
1 |
-
<?php return array('dependencies' => array('react', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-polyfill'), 'version' => '
|
1 |
+
<?php return array('dependencies' => array('react', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-polyfill'), 'version' => '3342af6aae127299a3be88d17d61587e');
|
build/sub-table-block.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=42)}([function(e,t){e.exports=window.wp.element},function(e,t){e.exports=window.React},function(e,t){e.exports=window.wp.components},function(e,t){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},e.exports.default=e.exports,e.exports.__esModule=!0},,function(e,t){e.exports=window.regeneratorRuntime},function(e,t){e.exports=window.wp.data},function(e,t,n){var r=n(15),o=n(16),i=n(13),a=n(17);e.exports=function(e,t){return r(e)||o(e,t)||i(e,t)||a()},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=window.wp.i18n},function(e,t){function n(){return e.exports=n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},e.exports.default=e.exports,e.exports.__esModule=!0,n.apply(this,arguments)}e.exports=n,e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=window.wp.apiFetch},function(e,t){e.exports=window.wp.blockEditor},function(e,t,n){e.exports=n(23)},function(e,t,n){var r=n(14);e.exports=function(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(e){if(Array.isArray(e))return e},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{r||null==s.return||s.return()}finally{if(o)throw i}}return n}},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=window.wp.blocks},function(e,t,n){"use strict";var r=n(3),o=n.n(r),i=n(5),a=n.n(i),s=n(10),u=n.n(s);function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?l(Object(n),!0).forEach((function(t){o()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var d={forms:!1,fields:{},submissions:{}},f={setForms:function(e){return{type:"SET_FORMS",forms:e}},setFields:function(e,t){return{type:"SET_FIELDS",formID:e,fields:t}},setSubmissions:function(e,t,n){return{type:"SET_SUBMISSIONS",formID:e,submissions:t,page:n}},fetchFromAPI:function(e,t){return{type:"FETCH_FROM_API",path:e,data:t}}},p={getForms:function(e){return e.forms},getForm:function(e,t){var n=p.getForms(e);return Object.values(n).find((function(e){return e.formID==t}))},getFormFields:function(e,t){return e.fields[t]},getFormSubmissions:function(e,t){return e.submissions[t]},getFormSubmissionsPage:function(e,t,n){var r=e.submissions;return void 0!==r[t]&&r[t][n]}};t.a={reducer:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:d,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"SET_FORMS":return c(c({},e),{},{forms:t.forms});case"SET_FIELDS":return c(c({},e),{},{fields:c(c({},e.fields),{},o()({},t.formID,t.fields))});case"SET_SUBMISSIONS":return c(c({},e),{},{submissions:c(c({},e.submissions),{},o()({},t.formID,c(c({},e.submissions[t.formID]),{},o()({},t.page,t.submissions))))})}return e},actions:f,selectors:p,controls:{FETCH_FROM_API:function(e){return u()({path:e.path})}},resolvers:{getForms:a.a.mark((function e(){var t;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"/ninja-forms-views/forms",e.next=3,f.fetchFromAPI("/ninja-forms-views/forms");case 3:return t=e.sent,e.abrupt("return",f.setForms(t));case 5:case"end":return e.stop()}}),e)})),getFormFields:a.a.mark((function e(t){var n,r;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="/ninja-forms-views/forms/"+t+"/fields",e.next=3,f.fetchFromAPI(n);case 3:return r=e.sent,e.abrupt("return",f.setFields(t,r));case 5:case"end":return e.stop()}}),e)})),getFormSubmissions:a.a.mark((function e(t){var n,r;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="/ninja-forms-views/forms/"+t+"/submissions?page=1&perPage=10",e.next=3,f.fetchFromAPI(n);case 3:return r=e.sent,e.abrupt("return",f.setSubmissions(t,r,1));case 5:case"end":return e.stop()}}),e)})),getFormSubmissionsPage:a.a.mark((function e(t,n){var r,o;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r="/ninja-forms-views/forms/"+t+"/submissions?page="+n+"&perPage=10",e.next=3,f.fetchFromAPI(r);case 3:return o=e.sent,e.abrupt("return",f.setSubmissions(t,o,n));case 5:case"end":return e.stop()}}),e)}))}}},function(e,t,n){"use strict";n.d(t,"a",(function(){return s}));var r=n(3),o=n.n(r);function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){o()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e){function t(e,n){if(0!==(e.path||"").indexOf("/ninja-forms-views/"))return n(e);var r=e.headers,o=void 0===r?{}:r;for(var i in o)if("x-ninjaformsviews-auth"===i.toLowerCase())return n(e);return n(a(a({},e),{},{headers:a(a({},o),{},{"X-NinjaFormsViews-Auth":t.token})}))}return t.token=e,t}},function(e,t,n){"use strict";var r=n(9),o=n.n(r),i=n(7),a=n.n(i),s=n(0),u=n(1),l=n.n(u),c=n(8),d=n(6),f=n(12);t.a=function(e){var t=e.formID,n=e.selectedFields,r=e.fields,o=e.submissions,i=r.filter((function(e){return-1!==n.indexOf(e.id)})).map((function(e){return{Header:e.label,accessor:e.id.toString()}})),u=l.a.useState(0),c=a()(u,2),f=c[0],g=c[1],m=l.a.useState(!1),h=a()(m,2),v=h[0],y=h[1];o[v]&&(o[v].length&&g(v),y(!1)),o[f+1]||Object(d.select)("ninja-forms-views").getFormSubmissionsPage(t,f+2);var b=o[o.length-1]&&o[o.length-1].length,w=o.flat();return Object(s.createElement)(p,{columns:i,data:w,initialPageIndex:f,loadMore:function(e){y(e),Object(d.select)("ninja-forms-views").getFormSubmissionsPage(t,e+1)},more:b,loading:v})};function p(e){var t=e.columns,n=e.data,r=e.initialPageIndex,i=e.loadMore,a=e.more,u=e.loading,l=Object(f.useTable)({columns:t,data:n,initialState:{pageIndex:r,pageSize:10}},f.usePagination),c=l.state.pageIndex,d=l.getTableProps,p=l.getTableBodyProps,v=l.canNextPage,y=l.canPreviousPage,b=l.page;return Object(s.createElement)(s.Fragment,null,Object(s.createElement)("table",d(),Object(s.createElement)("thead",null,Object(s.createElement)(g,l)),Object(s.createElement)("tbody",p(),Object(s.createElement)(m,o()({},l,{dataset:b})))),Object(s.createElement)(h,o()({},l,{loadMore:function(){return i(c+1)},more:a,loading:u,canNextPage:v,canPreviousPage:y})))}function g(e){var t=e.headerGroups;return t.length<=0?Object(s.createElement)("tr",null,Object(s.createElement)("th",null,Object(c.__)("No columns selected. Please choose fields using the block settings ->","ninja-forms"))):t.map((function(e){return Object(s.createElement)("tr",e.getHeaderGroupProps(),e.headers.map((function(e){return Object(s.createElement)("th",e.getHeaderProps(),e.render("Header"))})))}))}function m(e){var t=e.dataset,n=e.prepareRow;return t.map((function(e,t){return n(e),Object(s.createElement)("tr",e.getRowProps(),e.cells.map((function(e){return Object(s.createElement)("td",o()({},e.getCellProps(),{"data-header":e.column.Header}),e.render("Cell"))})))}))}function h(e){var t,n=e.previousPage,r=e.nextPage,o=e.canPreviousPage,i=e.canNextPage,a=e.loadMore,u=e.more,l=e.loading,c=function(){a(),r()};return i?t=Object(s.createElement)("button",{onClick:c},">"):u&&(t=Object(s.createElement)("button",{onClick:c},l?"...":">")),Object(s.createElement)("div",{style:{display:"flex",justifyContent:"space-between"}},Object(s.createElement)("div",null,o&&Object(s.createElement)("button",{onClick:function(){return n()}},"<")),i&&Object(s.createElement)("div",null,t))}},function(e,t,n){"use strict";e.exports=n(35)},function(e,t,n){!function(e,t){"use strict";function n(e,t,n,r,o,i,a){try{var s=e[i](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,o)}function r(e){return function(){var t=this,r=arguments;return new Promise((function(o,i){var a=e.apply(t,r);function s(e){n(a,o,i,s,u,"next",e)}function u(e){n(a,o,i,s,u,"throw",e)}s(void 0)}))}}function o(){return(o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function i(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}function a(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t);if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==typeof t?t:String(t)}t=t&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t;var s={init:"init"},u=function(e){var t=e.value;return void 0===t?"":t},l=function(){return t.createElement(t.Fragment,null," ")},c={Cell:u,width:150,minWidth:0,maxWidth:Number.MAX_SAFE_INTEGER};function d(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.reduce((function(e,t){var n=t.style,r=t.className;return e=o({},e,{},i(t,["style","className"])),n&&(e.style=e.style?o({},e.style||{},{},n||{}):n),r&&(e.className=e.className?e.className+" "+r:r),""===e.className&&delete e.className,e}),{})}var f=function(e,t){return void 0===t&&(t={}),function(n){return void 0===n&&(n={}),[].concat(e,[n]).reduce((function(e,r){return function e(t,n,r){return"function"==typeof n?e({},n(t,r)):Array.isArray(n)?d.apply(void 0,[t].concat(n)):d(t,n)}(e,r,o({},t,{userProps:n}))}),{})}},p=function(e,t,n,r){return void 0===n&&(n={}),e.reduce((function(e,t){return t(e,n)}),t)},g=function(e,t,n){return void 0===n&&(n={}),e.forEach((function(e){e(t,n)}))};function m(e,t,n,r){e.findIndex((function(e){return e.pluginName===n})),t.forEach((function(t){e.findIndex((function(e){return e.pluginName===t}))}))}function h(e,t){return"function"==typeof e?e(t):e}function v(e){var n=t.useRef();return n.current=e,t.useCallback((function(){return n.current}),[])}var y="undefined"!=typeof document?t.useLayoutEffect:t.useEffect;function b(e,n){var r=t.useRef(!1);y((function(){r.current&&e(),r.current=!0}),n)}function w(e,t,n){return void 0===n&&(n={}),function(r,i){void 0===i&&(i={});var a="string"==typeof r?t[r]:r;if(void 0===a)throw console.info(t),new Error("Renderer Error ☝️");return S(a,o({},e,{column:t},n,{},i))}}function S(e,n){return function(e){return"function"==typeof e&&(t=Object.getPrototypeOf(e)).prototype&&t.prototype.isReactComponent;var t}(r=e)||"function"==typeof r||function(e){return"object"==typeof e&&"symbol"==typeof e.$$typeof&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}(r)?t.createElement(e,n):e;var r}function R(e,t,n){return void 0===n&&(n=0),e.map((function(e){return x(e=o({},e,{parent:t,depth:n})),e.columns&&(e.columns=R(e.columns,e,n+1)),e}))}function C(e){return A(e,"columns")}function x(e){var t=e.id,n=e.accessor,r=e.Header;if("string"==typeof n){t=t||n;var o=n.split(".");n=function(e){return function(e,t,n){if(!t)return e;var r,o="function"==typeof t?t:JSON.stringify(t),i=k.get(o)||function(){var e=function(e){return function e(t,n){if(void 0===n&&(n=[]),Array.isArray(t))for(var r=0;r<t.length;r+=1)e(t[r],n);else n.push(t);return n}(e).map((function(e){return String(e).replace(".","_")})).join(".").replace(M,".").replace(_,"").split(".")}(t);return k.set(o,e),e}();try{r=i.reduce((function(e,t){return e[t]}),e)}catch(e){}return void 0!==r?r:void 0}(e,o)}}if(!t&&"string"==typeof r&&r&&(t=r),!t&&e.columns)throw console.error(e),new Error('A column ID (or unique "Header" value) is required!');if(!t)throw console.error(e),new Error("A column ID (or string accessor) is required!");return Object.assign(e,{id:t,accessor:n}),e}function P(e,t){if(!t)throw new Error;return Object.assign(e,o({Header:l,Footer:l},c,{},t,{},e)),Object.assign(e,{originalWidth:e.width}),e}function O(e,t,n){void 0===n&&(n=function(){return{}});for(var r=[],i=e,a=0,s=function(){return a++},u=function(){var e={headers:[]},a=[],u=i.some((function(e){return e.parent}));i.forEach((function(r){var i,l=[].concat(a).reverse()[0];u&&(i=r.parent?o({},r.parent,{originalId:r.parent.id,id:r.parent.id+"_"+s(),headers:[r]},n(r)):P(o({originalId:r.id+"_placeholder",id:r.id+"_placeholder_"+s(),placeholderOf:r,headers:[r]},n(r)),t),l&&l.originalId===i.originalId?l.headers.push(r):a.push(i)),e.headers.push(r)})),r.push(e),i=a};i.length;)u();return r.reverse()}var k=new Map;function E(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];for(var r=0;r<t.length;r+=1)if(void 0!==t[r])return t[r]}function I(e){if("function"==typeof e)return e}function A(e,t){var n=[];return function e(r){r.forEach((function(r){r[t]?e(r[t]):n.push(r)}))}(e),n}function j(e,t){var n=t.manualExpandedKey,r=t.expanded,o=t.expandSubRows,i=void 0===o||o,a=[];return e.forEach((function(e){return function e(t,o){void 0===o&&(o=!0),t.isExpanded=t.original&&t.original[n]||r[t.id],t.canExpand=t.subRows&&!!t.subRows.length,o&&a.push(t),t.subRows&&t.subRows.length&&t.isExpanded&&t.subRows.forEach((function(t){return e(t,i)}))}(e)})),a}function F(e,t,n){return I(e)||t[e]||n[e]||n.text}function B(e,t,n){return e?e(t,n):void 0===t}function T(){throw new Error("React-Table: You have not called prepareRow(row) one or more rows you are attempting to render.")}var G=null,M=/\[/g,_=/\]/g,z=function(e){return o({role:"table"},e)},H=function(e){return o({role:"rowgroup"},e)},D=function(e,t){var n=t.column;return o({key:"header_"+n.id,colSpan:n.totalVisibleHeaderCount,role:"columnheader"},e)},N=function(e,t){var n=t.column;return o({key:"footer_"+n.id,colSpan:n.totalVisibleHeaderCount},e)},W=function(e,t){return o({key:"headerGroup_"+t.index,role:"row"},e)},L=function(e,t){return o({key:"footerGroup_"+t.index},e)},$=function(e,t){return o({key:"row_"+t.row.id,role:"row"},e)},V=function(e,t){var n=t.cell;return o({key:"cell_"+n.row.id+"_"+n.column.id,role:"cell"},e)};function X(){return{useOptions:[],stateReducers:[],useControlledState:[],columns:[],columnsDeps:[],allColumns:[],allColumnsDeps:[],accessValue:[],materializedColumns:[],materializedColumnsDeps:[],useInstanceAfterData:[],visibleColumns:[],visibleColumnsDeps:[],headerGroups:[],headerGroupsDeps:[],useInstanceBeforeDimensions:[],useInstance:[],prepareRow:[],getTableProps:[z],getTableBodyProps:[H],getHeaderGroupProps:[W],getFooterGroupProps:[L],getHeaderProps:[D],getFooterProps:[N],getRowProps:[$],getCellProps:[V],useFinalInstance:[]}}s.resetHiddenColumns="resetHiddenColumns",s.toggleHideColumn="toggleHideColumn",s.setHiddenColumns="setHiddenColumns",s.toggleHideAllColumns="toggleHideAllColumns";var q=function(e){e.getToggleHiddenProps=[U],e.getToggleHideAllColumnsProps=[Y],e.stateReducers.push(K),e.useInstanceBeforeDimensions.push(Z),e.headerGroupsDeps.push((function(e,t){var n=t.instance;return[].concat(e,[n.state.hiddenColumns])})),e.useInstance.push(J)};q.pluginName="useColumnVisibility";var U=function(e,t){var n=t.column;return[e,{onChange:function(e){n.toggleHidden(!e.target.checked)},style:{cursor:"pointer"},checked:n.isVisible,title:"Toggle Column Visible"}]},Y=function(e,t){var n=t.instance;return[e,{onChange:function(e){n.toggleHideAllColumns(!e.target.checked)},style:{cursor:"pointer"},checked:!n.allColumnsHidden&&!n.state.hiddenColumns.length,title:"Toggle All Columns Hidden",indeterminate:!n.allColumnsHidden&&n.state.hiddenColumns.length}]};function K(e,t,n,r){if(t.type===s.init)return o({hiddenColumns:[]},e);if(t.type===s.resetHiddenColumns)return o({},e,{hiddenColumns:r.initialState.hiddenColumns||[]});if(t.type===s.toggleHideColumn){var i=(void 0!==t.value?t.value:!e.hiddenColumns.includes(t.columnId))?[].concat(e.hiddenColumns,[t.columnId]):e.hiddenColumns.filter((function(e){return e!==t.columnId}));return o({},e,{hiddenColumns:i})}return t.type===s.setHiddenColumns?o({},e,{hiddenColumns:h(t.value,e.hiddenColumns)}):t.type===s.toggleHideAllColumns?o({},e,{hiddenColumns:(void 0!==t.value?t.value:!e.hiddenColumns.length)?r.allColumns.map((function(e){return e.id})):[]}):void 0}function Z(e){var n=e.headers,r=e.state.hiddenColumns;t.useRef(!1).current;var o=0;n.forEach((function(e){return o+=function e(t,n){t.isVisible=n&&!r.includes(t.id);var o=0;return t.headers&&t.headers.length?t.headers.forEach((function(n){return o+=e(n,t.isVisible)})):o=t.isVisible?1:0,t.totalVisibleHeaderCount=o,o}(e,!0)}))}function J(e){var n=e.columns,r=e.flatHeaders,o=e.dispatch,i=e.allColumns,a=e.getHooks,u=e.state.hiddenColumns,l=e.autoResetHiddenColumns,c=void 0===l||l,d=v(e),p=i.length===u.length,g=t.useCallback((function(e,t){return o({type:s.toggleHideColumn,columnId:e,value:t})}),[o]),m=t.useCallback((function(e){return o({type:s.setHiddenColumns,value:e})}),[o]),h=t.useCallback((function(e){return o({type:s.toggleHideAllColumns,value:e})}),[o]),y=f(a().getToggleHideAllColumnsProps,{instance:d()});r.forEach((function(e){e.toggleHidden=function(t){o({type:s.toggleHideColumn,columnId:e.id,value:t})},e.getToggleHiddenProps=f(a().getToggleHiddenProps,{instance:d(),column:e})}));var w=v(c);b((function(){w()&&o({type:s.resetHiddenColumns})}),[o,n]),Object.assign(e,{allColumnsHidden:p,toggleHideColumn:g,setHiddenColumns:m,toggleHideAllColumns:h,getToggleHideAllColumnsProps:y})}var Q={},ee={},te=function(e,t,n){return e},ne=function(e,t){return e.subRows||[]},re=function(e,t,n){return""+(n?[n.id,t].join("."):t)},oe=function(e){return e};function ie(e){var t=e.initialState,n=void 0===t?Q:t,r=e.defaultColumn,a=void 0===r?ee:r,s=e.getSubRows,u=void 0===s?ne:s,l=e.getRowId,c=void 0===l?re:l,d=e.stateReducer,f=void 0===d?te:d,p=e.useControlledState,g=void 0===p?oe:p;return o({},i(e,["initialState","defaultColumn","getSubRows","getRowId","stateReducer","useControlledState"]),{initialState:n,defaultColumn:a,getSubRows:u,getRowId:c,stateReducer:f,useControlledState:g})}function ae(e,t){void 0===t&&(t=0);var n=0,r=0,o=0,i=0;return e.forEach((function(e){var a=e.headers;if(e.totalLeft=t,a&&a.length){var s=ae(a,t),u=s[0],l=s[1],c=s[2],d=s[3];e.totalMinWidth=u,e.totalWidth=l,e.totalMaxWidth=c,e.totalFlexWidth=d}else e.totalMinWidth=e.minWidth,e.totalWidth=Math.min(Math.max(e.minWidth,e.width),e.maxWidth),e.totalMaxWidth=e.maxWidth,e.totalFlexWidth=e.canResize?e.totalWidth:0;e.isVisible&&(t+=e.totalWidth,n+=e.totalMinWidth,r+=e.totalWidth,o+=e.totalMaxWidth,i+=e.totalFlexWidth)})),[n,r,o,i]}function se(e){var t=e.data,n=e.rows,r=e.flatRows,o=e.rowsById,i=e.column,a=e.getRowId,s=e.getSubRows,u=e.accessValueHooks,l=e.getInstance;t.forEach((function(e,c){return function e(n,c,d,f,g){void 0===d&&(d=0);var m=n,h=a(n,c,f),v=o[h];if(v)v.subRows&&v.originalSubRows.forEach((function(t,n){return e(t,n,d+1,v)}));else if((v={id:h,original:m,index:c,depth:d,cells:[{}]}).cells.map=T,v.cells.filter=T,v.cells.forEach=T,v.cells[0].getCellProps=T,v.values={},g.push(v),r.push(v),o[h]=v,v.originalSubRows=s(n,c),v.originalSubRows){var y=[];v.originalSubRows.forEach((function(t,n){return e(t,n,d+1,v,y)})),v.subRows=y}i.accessor&&(v.values[i.id]=i.accessor(n,c,v,g,t)),v.values[i.id]=p(u,v.values[i.id],{row:v,column:i,instance:l()})}(e,c,0,void 0,n)}))}s.resetExpanded="resetExpanded",s.toggleRowExpanded="toggleRowExpanded",s.toggleAllRowsExpanded="toggleAllRowsExpanded";var ue=function(e){e.getToggleAllRowsExpandedProps=[le],e.getToggleRowExpandedProps=[ce],e.stateReducers.push(de),e.useInstance.push(fe),e.prepareRow.push(pe)};ue.pluginName="useExpanded";var le=function(e,t){var n=t.instance;return[e,{onClick:function(e){n.toggleAllRowsExpanded()},style:{cursor:"pointer"},title:"Toggle All Rows Expanded"}]},ce=function(e,t){var n=t.row;return[e,{onClick:function(){n.toggleRowExpanded()},style:{cursor:"pointer"},title:"Toggle Row Expanded"}]};function de(e,t,n,r){if(t.type===s.init)return o({expanded:{}},e);if(t.type===s.resetExpanded)return o({},e,{expanded:r.initialState.expanded||{}});if(t.type===s.toggleAllRowsExpanded){var u=t.value,l=r.isAllRowsExpanded,c=r.rowsById;if(void 0!==u?u:!l){var d={};return Object.keys(c).forEach((function(e){d[e]=!0})),o({},e,{expanded:d})}return o({},e,{expanded:{}})}if(t.type===s.toggleRowExpanded){var f,p=t.id,g=t.value,m=e.expanded[p],h=void 0!==g?g:!m;if(!m&&h)return o({},e,{expanded:o({},e.expanded,(f={},f[p]=!0,f))});if(m&&!h){var v=e.expanded;return v[p],o({},e,{expanded:i(v,[p].map(a))})}return e}}function fe(e){var n=e.data,r=e.rows,o=e.rowsById,i=e.manualExpandedKey,a=void 0===i?"expanded":i,u=e.paginateExpandedRows,l=void 0===u||u,c=e.expandSubRows,d=void 0===c||c,p=e.autoResetExpanded,g=void 0===p||p,h=e.getHooks,y=e.plugins,w=e.state.expanded,S=e.dispatch;m(y,["useSortBy","useGroupBy","usePivotColumns","useGlobalFilter"],"useExpanded");var R=v(g),C=Boolean(Object.keys(o).length&&Object.keys(w).length);C&&Object.keys(o).some((function(e){return!w[e]}))&&(C=!1),b((function(){R()&&S({type:s.resetExpanded})}),[S,n]);var x=t.useCallback((function(e,t){S({type:s.toggleRowExpanded,id:e,value:t})}),[S]),P=t.useCallback((function(e){return S({type:s.toggleAllRowsExpanded,value:e})}),[S]),O=t.useMemo((function(){return l?j(r,{manualExpandedKey:a,expanded:w,expandSubRows:d}):r}),[l,r,a,w,d]),k=t.useMemo((function(){return function(e){var t=0;return Object.keys(e).forEach((function(e){var n=e.split(".");t=Math.max(t,n.length)})),t}(w)}),[w]),E=v(e),I=f(h().getToggleAllRowsExpandedProps,{instance:E()});Object.assign(e,{preExpandedRows:r,expandedRows:O,rows:O,expandedDepth:k,isAllRowsExpanded:C,toggleRowExpanded:x,toggleAllRowsExpanded:P,getToggleAllRowsExpandedProps:I})}function pe(e,t){var n=t.instance.getHooks,r=t.instance;e.toggleRowExpanded=function(t){return r.toggleRowExpanded(e.id,t)},e.getToggleRowExpandedProps=f(n().getToggleRowExpandedProps,{instance:r,row:e})}var ge=function(e,t,n){return e.filter((function(e){return t.some((function(t){var r=e.values[t];return String(r).toLowerCase().includes(String(n).toLowerCase())}))}))};ge.autoRemove=function(e){return!e};var me=function(e,t,n){return e.filter((function(e){return t.some((function(t){var r=e.values[t];return void 0===r||String(r).toLowerCase()===String(n).toLowerCase()}))}))};me.autoRemove=function(e){return!e};var he=function(e,t,n){return e.filter((function(e){return t.some((function(t){var r=e.values[t];return void 0===r||String(r)===String(n)}))}))};he.autoRemove=function(e){return!e};var ve=function(e,t,n){return e.filter((function(e){return t.some((function(t){return e.values[t].includes(n)}))}))};ve.autoRemove=function(e){return!e||!e.length};var ye=function(e,t,n){return e.filter((function(e){return t.some((function(t){var r=e.values[t];return r&&r.length&&n.every((function(e){return r.includes(e)}))}))}))};ye.autoRemove=function(e){return!e||!e.length};var be=function(e,t,n){return e.filter((function(e){return t.some((function(t){var r=e.values[t];return r&&r.length&&n.some((function(e){return r.includes(e)}))}))}))};be.autoRemove=function(e){return!e||!e.length};var we=function(e,t,n){return e.filter((function(e){return t.some((function(t){var r=e.values[t];return n.includes(r)}))}))};we.autoRemove=function(e){return!e||!e.length};var Se=function(e,t,n){return e.filter((function(e){return t.some((function(t){return e.values[t]===n}))}))};Se.autoRemove=function(e){return void 0===e};var Re=function(e,t,n){return e.filter((function(e){return t.some((function(t){return e.values[t]==n}))}))};Re.autoRemove=function(e){return null==e};var Ce=function(e,t,n){var r=n||[],o=r[0],i=r[1];if((o="number"==typeof o?o:-1/0)>(i="number"==typeof i?i:1/0)){var a=o;o=i,i=a}return e.filter((function(e){return t.some((function(t){var n=e.values[t];return n>=o&&n<=i}))}))};Ce.autoRemove=function(e){return!e||"number"!=typeof e[0]&&"number"!=typeof e[1]};var xe=Object.freeze({__proto__:null,text:ge,exactText:me,exactTextCase:he,includes:ve,includesAll:ye,includesSome:be,includesValue:we,exact:Se,equals:Re,between:Ce});s.resetFilters="resetFilters",s.setFilter="setFilter",s.setAllFilters="setAllFilters";var Pe=function(e){e.stateReducers.push(Oe),e.useInstance.push(ke)};function Oe(e,t,n,r){if(t.type===s.init)return o({filters:[]},e);if(t.type===s.resetFilters)return o({},e,{filters:r.initialState.filters||[]});if(t.type===s.setFilter){var i=t.columnId,a=t.filterValue,u=r.allColumns,l=r.filterTypes,c=u.find((function(e){return e.id===i}));if(!c)throw new Error("React-Table: Could not find a column with id: "+i);var d=F(c.filter,l||{},xe),f=e.filters.find((function(e){return e.id===i})),p=h(a,f&&f.value);return B(d.autoRemove,p,c)?o({},e,{filters:e.filters.filter((function(e){return e.id!==i}))}):o({},e,f?{filters:e.filters.map((function(e){return e.id===i?{id:i,value:p}:e}))}:{filters:[].concat(e.filters,[{id:i,value:p}])})}if(t.type===s.setAllFilters){var g=t.filters,m=r.allColumns,v=r.filterTypes;return o({},e,{filters:h(g,e.filters).filter((function(e){var t=m.find((function(t){return t.id===e.id}));return!B(F(t.filter,v||{},xe).autoRemove,e.value,t)}))})}}function ke(e){var n=e.data,r=e.rows,o=e.flatRows,i=e.rowsById,a=e.allColumns,u=e.filterTypes,l=e.manualFilters,c=e.defaultCanFilter,d=void 0!==c&&c,f=e.disableFilters,p=e.state.filters,g=e.dispatch,m=e.autoResetFilters,h=void 0===m||m,y=t.useCallback((function(e,t){g({type:s.setFilter,columnId:e,filterValue:t})}),[g]),w=t.useCallback((function(e){g({type:s.setAllFilters,filters:e})}),[g]);a.forEach((function(e){var t=e.id,n=e.accessor,r=e.defaultCanFilter,o=e.disableFilters;e.canFilter=n?E(!0!==o&&void 0,!0!==f&&void 0,!0):E(r,d,!1),e.setFilter=function(t){return y(e.id,t)};var i=p.find((function(e){return e.id===t}));e.filterValue=i&&i.value}));var S=t.useMemo((function(){if(l||!p.length)return[r,o,i];var e=[],t={};return[function n(r,o){void 0===o&&(o=0);var i=r;return(i=p.reduce((function(e,t){var n=t.id,r=t.value,i=a.find((function(e){return e.id===n}));if(!i)return e;0===o&&(i.preFilteredRows=e);var s=F(i.filter,u||{},xe);return s?(i.filteredRows=s(e,[n],r),i.filteredRows):(console.warn("Could not find a valid 'column.filter' for column with the ID: "+i.id+"."),e)}),r)).forEach((function(r){e.push(r),t[r.id]=r,r.subRows&&(r.subRows=r.subRows&&r.subRows.length>0?n(r.subRows,o+1):r.subRows)})),i}(r),e,t]}),[l,p,r,o,i,a,u]),R=S[0],C=S[1],x=S[2];t.useMemo((function(){a.filter((function(e){return!p.find((function(t){return t.id===e.id}))})).forEach((function(e){e.preFilteredRows=R,e.filteredRows=R}))}),[R,p,a]);var P=v(h);b((function(){P()&&g({type:s.resetFilters})}),[g,l?null:n]),Object.assign(e,{preFilteredRows:r,preFilteredFlatRows:o,preFilteredRowsById:i,filteredRows:R,filteredFlatRows:C,filteredRowsById:x,rows:R,flatRows:C,rowsById:x,setFilter:y,setAllFilters:w})}Pe.pluginName="useFilters",s.resetGlobalFilter="resetGlobalFilter",s.setGlobalFilter="setGlobalFilter";var Ee=function(e){e.stateReducers.push(Ie),e.useInstance.push(Ae)};function Ie(e,t,n,r){if(t.type===s.resetGlobalFilter)return o({},e,{globalFilter:r.initialState.globalFilter||void 0});if(t.type===s.setGlobalFilter){var a=t.filterValue,u=r.userFilterTypes,l=F(r.globalFilter,u||{},xe),c=h(a,e.globalFilter);return B(l.autoRemove,c)?(e.globalFilter,i(e,["globalFilter"])):o({},e,{globalFilter:c})}}function Ae(e){var n=e.data,r=e.rows,o=e.flatRows,i=e.rowsById,a=e.allColumns,u=e.filterTypes,l=e.globalFilter,c=e.manualGlobalFilter,d=e.state.globalFilter,f=e.dispatch,p=e.autoResetGlobalFilter,g=void 0===p||p,m=e.disableGlobalFilter,h=t.useCallback((function(e){f({type:s.setGlobalFilter,filterValue:e})}),[f]),y=t.useMemo((function(){if(c||void 0===d)return[r,o,i];var e=[],t={},n=F(l,u||{},xe);if(!n)return console.warn("Could not find a valid 'globalFilter' option."),r;a.forEach((function(e){var t=e.disableGlobalFilter;e.canFilter=E(!0!==t&&void 0,!0!==m&&void 0,!0)}));var s=a.filter((function(e){return!0===e.canFilter}));return[function r(o){return(o=n(o,s.map((function(e){return e.id})),d)).forEach((function(n){e.push(n),t[n.id]=n,n.subRows=n.subRows&&n.subRows.length?r(n.subRows):n.subRows})),o}(r),e,t]}),[c,d,l,u,a,r,o,i,m]),w=y[0],S=y[1],R=y[2],C=v(g);b((function(){C()&&f({type:s.resetGlobalFilter})}),[f,c?null:n]),Object.assign(e,{preGlobalFilteredRows:r,preGlobalFilteredFlatRows:o,preGlobalFilteredRowsById:i,globalFilteredRows:w,globalFilteredFlatRows:S,globalFilteredRowsById:R,rows:w,flatRows:S,rowsById:R,setGlobalFilter:h,disableGlobalFilter:m})}function je(e,t){return t.reduce((function(e,t){return e+("number"==typeof t?t:0)}),0)}Ee.pluginName="useGlobalFilter";var Fe=Object.freeze({__proto__:null,sum:je,min:function(e){var t=e[0]||0;return e.forEach((function(e){"number"==typeof e&&(t=Math.min(t,e))})),t},max:function(e){var t=e[0]||0;return e.forEach((function(e){"number"==typeof e&&(t=Math.max(t,e))})),t},minMax:function(e){var t=e[0]||0,n=e[0]||0;return e.forEach((function(e){"number"==typeof e&&(t=Math.min(t,e),n=Math.max(n,e))})),t+".."+n},average:function(e){return je(0,e)/e.length},median:function(e){if(!e.length)return null;var t=Math.floor(e.length/2),n=[].concat(e).sort((function(e,t){return e-t}));return e.length%2!=0?n[t]:(n[t-1]+n[t])/2},unique:function(e){return Array.from(new Set(e).values())},uniqueCount:function(e){return new Set(e).size},count:function(e){return e.length}}),Be=[],Te={};s.resetGroupBy="resetGroupBy",s.setGroupBy="setGroupBy",s.toggleGroupBy="toggleGroupBy";var Ge=function(e){e.getGroupByToggleProps=[Me],e.stateReducers.push(_e),e.visibleColumnsDeps.push((function(e,t){var n=t.instance;return[].concat(e,[n.state.groupBy])})),e.visibleColumns.push(ze),e.useInstance.push(De),e.prepareRow.push(Ne)};Ge.pluginName="useGroupBy";var Me=function(e,t){var n=t.header;return[e,{onClick:n.canGroupBy?function(e){e.persist(),n.toggleGroupBy()}:void 0,style:{cursor:n.canGroupBy?"pointer":void 0},title:"Toggle GroupBy"}]};function _e(e,t,n,r){if(t.type===s.init)return o({groupBy:[]},e);if(t.type===s.resetGroupBy)return o({},e,{groupBy:r.initialState.groupBy||[]});if(t.type===s.setGroupBy)return o({},e,{groupBy:t.value});if(t.type===s.toggleGroupBy){var i=t.columnId,a=t.value,u=void 0!==a?a:!e.groupBy.includes(i);return o({},e,u?{groupBy:[].concat(e.groupBy,[i])}:{groupBy:e.groupBy.filter((function(e){return e!==i}))})}}function ze(e,t){var n=t.instance.state.groupBy,r=n.map((function(t){return e.find((function(e){return e.id===t}))})).filter(Boolean),o=e.filter((function(e){return!n.includes(e.id)}));return(e=[].concat(r,o)).forEach((function(e){e.isGrouped=n.includes(e.id),e.groupedIndex=n.indexOf(e.id)})),e}var He={};function De(e){var n=e.data,r=e.rows,o=e.flatRows,i=e.rowsById,a=e.allColumns,u=e.flatHeaders,l=e.groupByFn,c=void 0===l?We:l,d=e.manualGroupBy,p=e.aggregations,g=void 0===p?He:p,h=e.plugins,y=e.state.groupBy,w=e.dispatch,S=e.autoResetGroupBy,R=void 0===S||S,C=e.disableGroupBy,x=e.defaultCanGroupBy,P=e.getHooks;m(h,["useColumnOrder","useFilters"],"useGroupBy");var O=v(e);a.forEach((function(t){var n=t.accessor,r=t.defaultGroupBy,o=t.disableGroupBy;t.canGroupBy=n?E(t.canGroupBy,!0!==o&&void 0,!0!==C&&void 0,!0):E(t.canGroupBy,r,x,!1),t.canGroupBy&&(t.toggleGroupBy=function(){return e.toggleGroupBy(t.id)}),t.Aggregated=t.Aggregated||t.Cell}));var k=t.useCallback((function(e,t){w({type:s.toggleGroupBy,columnId:e,value:t})}),[w]),I=t.useCallback((function(e){w({type:s.setGroupBy,value:e})}),[w]);u.forEach((function(e){e.getGroupByToggleProps=f(P().getGroupByToggleProps,{instance:O(),header:e})}));var j=t.useMemo((function(){if(d||!y.length)return[r,o,i,Be,Te,o,i];var e=y.filter((function(e){return a.find((function(t){return t.id===e}))})),t=[],n={},s=[],u={},l=[],f={},p=function r(o,i,d){if(void 0===i&&(i=0),i===e.length)return o;var p=e[i],m=c(o,p);return Object.entries(m).map((function(o,c){var m=o[0],h=o[1],v=p+":"+m,y=r(h,i+1,v=d?d+">"+v:v),b=i?A(h,"leafRows"):h,w=function(t,n,r){var o={};return a.forEach((function(i){if(e.includes(i.id))o[i.id]=n[0]?n[0].values[i.id]:null;else{var a="function"==typeof i.aggregate?i.aggregate:g[i.aggregate]||Fe[i.aggregate];if(a){var s=n.map((function(e){return e.values[i.id]})),u=t.map((function(e){var t=e.values[i.id];if(!r&&i.aggregateValue){var n="function"==typeof i.aggregateValue?i.aggregateValue:g[i.aggregateValue]||Fe[i.aggregateValue];if(!n)throw console.info({column:i}),new Error("React Table: Invalid column.aggregateValue option for column listed above");t=n(t,e,i)}return t}));o[i.id]=a(u,s)}else{if(i.aggregate)throw console.info({column:i}),new Error("React Table: Invalid column.aggregate option for column listed above");o[i.id]=null}}})),o}(b,h,i),S={id:v,isGrouped:!0,groupByID:p,groupByVal:m,values:w,subRows:y,leafRows:b,depth:i,index:c};return y.forEach((function(e){t.push(e),n[e.id]=e,e.isGrouped?(s.push(e),u[e.id]=e):(l.push(e),f[e.id]=e)})),S}))}(r);return p.forEach((function(e){t.push(e),n[e.id]=e,e.isGrouped?(s.push(e),u[e.id]=e):(l.push(e),f[e.id]=e)})),[p,t,n,s,u,l,f]}),[d,y,r,o,i,a,g,c]),F=j[0],B=j[1],T=j[2],G=j[3],M=j[4],_=j[5],z=j[6],H=v(R);b((function(){H()&&w({type:s.resetGroupBy})}),[w,d?null:n]),Object.assign(e,{preGroupedRows:r,preGroupedFlatRow:o,preGroupedRowsById:i,groupedRows:F,groupedFlatRows:B,groupedRowsById:T,onlyGroupedFlatRows:G,onlyGroupedRowsById:M,nonGroupedFlatRows:_,nonGroupedRowsById:z,rows:F,flatRows:B,rowsById:T,toggleGroupBy:k,setGroupBy:I})}function Ne(e){e.allCells.forEach((function(t){var n;t.isGrouped=t.column.isGrouped&&t.column.id===e.groupByID,t.isPlaceholder=!t.isGrouped&&t.column.isGrouped,t.isAggregated=!t.isGrouped&&!t.isPlaceholder&&(null==(n=e.subRows)?void 0:n.length)}))}function We(e,t){return e.reduce((function(e,n,r){var o=""+n.values[t];return e[o]=Array.isArray(e[o])?e[o]:[],e[o].push(n),e}),{})}var Le=/([0-9]+)/gm;function $e(e,t){return e===t?0:e>t?1:-1}function Ve(e,t){return e.values[t]}function Xe(e){return"number"==typeof e?isNaN(e)||e===1/0||e===-1/0?"":String(e):"string"==typeof e?e:""}var qe=Object.freeze({__proto__:null,alphanumeric:function(e,t,n){var r=Ve(e,n),o=Ve(t,n);for(r=Xe(r),o=Xe(o),r=r.split(Le).filter(Boolean),o=o.split(Le).filter(Boolean);r.length&&o.length;){var i=r.shift(),a=o.shift(),s=parseInt(i,10),u=parseInt(a,10),l=[s,u].sort();if(isNaN(l[0])){if(i>a)return 1;if(a>i)return-1}else{if(isNaN(l[1]))return isNaN(s)?-1:1;if(s>u)return 1;if(u>s)return-1}}return r.length-o.length},datetime:function(e,t,n){var r=Ve(e,n),o=Ve(t,n);return $e(r=r.getTime(),o=o.getTime())},basic:function(e,t,n){return $e(Ve(e,n),Ve(t,n))}});s.resetSortBy="resetSortBy",s.setSortBy="setSortBy",s.toggleSortBy="toggleSortBy",s.clearSortBy="clearSortBy",c.sortType="alphanumeric",c.sortDescFirst=!1;var Ue=function(e){e.getSortByToggleProps=[Ye],e.stateReducers.push(Ke),e.useInstance.push(Ze)};Ue.pluginName="useSortBy";var Ye=function(e,t){var n=t.instance,r=t.column,o=n.isMultiSortEvent,i=void 0===o?function(e){return e.shiftKey}:o;return[e,{onClick:r.canSort?function(e){e.persist(),r.toggleSortBy(void 0,!n.disableMultiSort&&i(e))}:void 0,style:{cursor:r.canSort?"pointer":void 0},title:r.canSort?"Toggle SortBy":void 0}]};function Ke(e,t,n,r){if(t.type===s.init)return o({sortBy:[]},e);if(t.type===s.resetSortBy)return o({},e,{sortBy:r.initialState.sortBy||[]});if(t.type===s.clearSortBy)return o({},e,{sortBy:e.sortBy.filter((function(e){return e.id!==t.columnId}))});if(t.type===s.setSortBy)return o({},e,{sortBy:t.sortBy});if(t.type===s.toggleSortBy){var i,a=t.columnId,u=t.desc,l=t.multi,c=r.allColumns,d=r.disableMultiSort,f=r.disableSortRemove,p=r.disableMultiRemove,g=r.maxMultiSortColCount,m=void 0===g?Number.MAX_SAFE_INTEGER:g,h=e.sortBy,v=c.find((function(e){return e.id===a})).sortDescFirst,y=h.find((function(e){return e.id===a})),b=h.findIndex((function(e){return e.id===a})),w=null!=u,S=[];return"toggle"!=(i=!d&&l?y?"toggle":"add":b!==h.length-1||1!==h.length?"replace":y?"toggle":"replace")||f||w||l&&p||!(y&&y.desc&&!v||!y.desc&&v)||(i="remove"),"replace"===i?S=[{id:a,desc:w?u:v}]:"add"===i?(S=[].concat(h,[{id:a,desc:w?u:v}])).splice(0,S.length-m):"toggle"===i?S=h.map((function(e){return e.id===a?o({},e,{desc:w?u:!y.desc}):e})):"remove"===i&&(S=h.filter((function(e){return e.id!==a}))),o({},e,{sortBy:S})}}function Ze(e){var n=e.data,r=e.rows,o=e.flatRows,i=e.allColumns,a=e.orderByFn,u=void 0===a?Je:a,l=e.sortTypes,c=e.manualSortBy,d=e.defaultCanSort,p=e.disableSortBy,g=e.flatHeaders,h=e.state.sortBy,y=e.dispatch,w=e.plugins,S=e.getHooks,R=e.autoResetSortBy,C=void 0===R||R;m(w,["useFilters","useGlobalFilter","useGroupBy","usePivotColumns"],"useSortBy");var x=t.useCallback((function(e){y({type:s.setSortBy,sortBy:e})}),[y]),P=t.useCallback((function(e,t,n){y({type:s.toggleSortBy,columnId:e,desc:t,multi:n})}),[y]),O=v(e);g.forEach((function(e){var t=e.accessor,n=e.canSort,r=e.disableSortBy,o=e.id,i=t?E(!0!==r&&void 0,!0!==p&&void 0,!0):E(d,n,!1);e.canSort=i,e.canSort&&(e.toggleSortBy=function(t,n){return P(e.id,t,n)},e.clearSortBy=function(){y({type:s.clearSortBy,columnId:e.id})}),e.getSortByToggleProps=f(S().getSortByToggleProps,{instance:O(),column:e});var a=h.find((function(e){return e.id===o}));e.isSorted=!!a,e.sortedIndex=h.findIndex((function(e){return e.id===o})),e.isSortedDesc=e.isSorted?a.desc:void 0}));var k=t.useMemo((function(){if(c||!h.length)return[r,o];var e=[],t=h.filter((function(e){return i.find((function(t){return t.id===e.id}))}));return[function n(r){var o=u(r,t.map((function(e){var t=i.find((function(t){return t.id===e.id}));if(!t)throw new Error("React-Table: Could not find a column with id: "+e.id+" while sorting");var n=t.sortType,r=I(n)||(l||{})[n]||qe[n];if(!r)throw new Error("React-Table: Could not find a valid sortType of '"+n+"' for column '"+e.id+"'.");return function(t,n){return r(t,n,e.id,e.desc)}})),t.map((function(e){var t=i.find((function(t){return t.id===e.id}));return t&&t.sortInverted?e.desc:!e.desc})));return o.forEach((function(t){e.push(t),t.subRows&&0!==t.subRows.length&&(t.subRows=n(t.subRows))})),o}(r),e]}),[c,h,r,o,i,u,l]),A=k[0],j=k[1],F=v(C);b((function(){F()&&y({type:s.resetSortBy})}),[c?null:n]),Object.assign(e,{preSortedRows:r,preSortedFlatRows:o,sortedRows:A,sortedFlatRows:j,rows:A,flatRows:j,setSortBy:x,toggleSortBy:P})}function Je(e,t,n){return[].concat(e).sort((function(e,r){for(var o=0;o<t.length;o+=1){var i=t[o],a=!1===n[o]||"desc"===n[o],s=i(e,r);if(0!==s)return a?-s:s}return n[0]?e.index-r.index:r.index-e.index}))}s.resetPage="resetPage",s.gotoPage="gotoPage",s.setPageSize="setPageSize";var Qe=function(e){e.stateReducers.push(et),e.useInstance.push(tt)};function et(e,t,n,r){if(t.type===s.init)return o({pageSize:10,pageIndex:0},e);if(t.type===s.resetPage)return o({},e,{pageIndex:r.initialState.pageIndex||0});if(t.type===s.gotoPage){var i=r.pageCount,a=r.page,u=h(t.pageIndex,e.pageIndex),l=!1;return u>e.pageIndex?l=-1===i?a.length>=e.pageSize:u<i:u<e.pageIndex&&(l=u>-1),l?o({},e,{pageIndex:u}):e}if(t.type===s.setPageSize){var c=t.pageSize,d=e.pageSize*e.pageIndex;return o({},e,{pageIndex:Math.floor(d/c),pageSize:c})}}function tt(e){var n=e.rows,r=e.autoResetPage,o=void 0===r||r,i=e.manualExpandedKey,a=void 0===i?"expanded":i,u=e.plugins,l=e.pageCount,c=e.paginateExpandedRows,d=void 0===c||c,f=e.expandSubRows,p=void 0===f||f,g=e.state,h=g.pageSize,y=g.pageIndex,w=g.expanded,S=g.globalFilter,R=g.filters,C=g.groupBy,x=g.sortBy,P=e.dispatch,O=e.data,k=e.manualPagination;m(u,["useGlobalFilter","useFilters","useGroupBy","useSortBy","useExpanded"],"usePagination");var E=v(o);b((function(){E()&&P({type:s.resetPage})}),[P,k?null:O,S,R,C,x]);var I=k?l:Math.ceil(n.length/h),A=t.useMemo((function(){return I>0?[].concat(new Array(I)).fill(null).map((function(e,t){return t})):[]}),[I]),F=t.useMemo((function(){var e;if(k)e=n;else{var t=h*y,r=t+h;e=n.slice(t,r)}return d?e:j(e,{manualExpandedKey:a,expanded:w,expandSubRows:p})}),[p,w,a,k,y,h,d,n]),B=y>0,T=-1===I?F.length>=h:y<I-1,G=t.useCallback((function(e){P({type:s.gotoPage,pageIndex:e})}),[P]),M=t.useCallback((function(){return G((function(e){return e-1}))}),[G]),_=t.useCallback((function(){return G((function(e){return e+1}))}),[G]),z=t.useCallback((function(e){P({type:s.setPageSize,pageSize:e})}),[P]);Object.assign(e,{pageOptions:A,pageCount:I,page:F,canPreviousPage:B,canNextPage:T,gotoPage:G,previousPage:M,nextPage:_,setPageSize:z})}Qe.pluginName="usePagination",s.resetPivot="resetPivot",s.togglePivot="togglePivot";var nt=function(e){e.getPivotToggleProps=[ot],e.stateReducers.push(it),e.useInstanceAfterData.push(at),e.allColumns.push(st),e.accessValue.push(ut),e.materializedColumns.push(lt),e.materializedColumnsDeps.push(ct),e.visibleColumns.push(dt),e.visibleColumnsDeps.push(ft),e.useInstance.push(pt),e.prepareRow.push(gt)};nt.pluginName="usePivotColumns";var rt=[],ot=function(e,t){var n=t.header;return[e,{onClick:n.canPivot?function(e){e.persist(),n.togglePivot()}:void 0,style:{cursor:n.canPivot?"pointer":void 0},title:"Toggle Pivot"}]};function it(e,t,n,r){if(t.type===s.init)return o({pivotColumns:rt},e);if(t.type===s.resetPivot)return o({},e,{pivotColumns:r.initialState.pivotColumns||rt});if(t.type===s.togglePivot){var i=t.columnId,a=t.value,u=void 0!==a?a:!e.pivotColumns.includes(i);return o({},e,u?{pivotColumns:[].concat(e.pivotColumns,[i])}:{pivotColumns:e.pivotColumns.filter((function(e){return e!==i}))})}}function at(e){e.allColumns.forEach((function(t){t.isPivotSource=e.state.pivotColumns.includes(t.id)}))}function st(e,t){var n=t.instance;return e.forEach((function(e){e.isPivotSource=n.state.pivotColumns.includes(e.id),e.uniqueValues=new Set})),e}function ut(e,t){var n=t.column;return n.uniqueValues&&void 0!==e&&n.uniqueValues.add(e),e}function lt(e,t){var n=t.instance,r=n.allColumns,i=n.state;if(!i.pivotColumns.length||!i.groupBy||!i.groupBy.length)return e;var a=i.pivotColumns.map((function(e){return r.find((function(t){return t.id===e}))})).filter(Boolean),s=r.filter((function(e){return!e.isPivotSource&&!i.groupBy.includes(e.id)&&!i.pivotColumns.includes(e.id)})),u=C(function e(t,n,r){void 0===t&&(t=0),void 0===r&&(r=[]);var i=a[t];return i?Array.from(i.uniqueValues).sort().map((function(a){var s=o({},i,{Header:i.PivotHeader||"string"==typeof i.header?i.Header+": "+a:a,isPivotGroup:!0,parent:n,depth:t,id:n?n.id+"."+i.id+"."+a:i.id+"."+a,pivotValue:a});return s.columns=e(t+1,s,[].concat(r,[function(e){return e.values[i.id]===a}])),s})):s.map((function(e){return o({},e,{canPivot:!1,isPivoted:!0,parent:n,depth:t,id:""+(n?n.id+"."+e.id:e.id),accessor:function(t,n,o){if(r.every((function(e){return e(o)})))return o.values[e.id]}})}))}());return[].concat(e,u)}function ct(e,t){var n=t.instance.state,r=n.pivotColumns,o=n.groupBy;return[].concat(e,[r,o])}function dt(e,t){var n=t.instance.state;return e=e.filter((function(e){return!e.isPivotSource})),n.pivotColumns.length&&n.groupBy&&n.groupBy.length&&(e=e.filter((function(e){return e.isGrouped||e.isPivoted}))),e}function ft(e,t){var n=t.instance;return[].concat(e,[n.state.pivotColumns,n.state.groupBy])}function pt(e){var t=e.columns,n=e.allColumns,r=e.flatHeaders,o=e.getHooks,i=e.plugins,a=e.dispatch,u=e.autoResetPivot,l=void 0===u||u,c=e.manaulPivot,d=e.disablePivot,p=e.defaultCanPivot;m(i,["useGroupBy"],"usePivotColumns");var g=v(e);n.forEach((function(t){var n=t.accessor,r=t.defaultPivot,o=t.disablePivot;t.canPivot=n?E(t.canPivot,!0!==o&&void 0,!0!==d&&void 0,!0):E(t.canPivot,r,p,!1),t.canPivot&&(t.togglePivot=function(){return e.togglePivot(t.id)}),t.Aggregated=t.Aggregated||t.Cell})),r.forEach((function(e){e.getPivotToggleProps=f(o().getPivotToggleProps,{instance:g(),header:e})}));var h=v(l);b((function(){h()&&a({type:s.resetPivot})}),[a,c?null:t]),Object.assign(e,{togglePivot:function(e,t){a({type:s.togglePivot,columnId:e,value:t})}})}function gt(e){e.allCells.forEach((function(e){e.isPivoted=e.column.isPivoted}))}s.resetSelectedRows="resetSelectedRows",s.toggleAllRowsSelected="toggleAllRowsSelected",s.toggleRowSelected="toggleRowSelected",s.toggleAllPageRowsSelected="toggleAllPageRowsSelected";var mt=function(e){e.getToggleRowSelectedProps=[ht],e.getToggleAllRowsSelectedProps=[vt],e.getToggleAllPageRowsSelectedProps=[yt],e.stateReducers.push(bt),e.useInstance.push(wt),e.prepareRow.push(St)};mt.pluginName="useRowSelect";var ht=function(e,t){var n=t.instance,r=t.row,o=n.manualRowSelectedKey,i=void 0===o?"isSelected":o;return[e,{onChange:function(e){r.toggleRowSelected(e.target.checked)},style:{cursor:"pointer"},checked:!(!r.original||!r.original[i])||r.isSelected,title:"Toggle Row Selected",indeterminate:r.isSomeSelected}]},vt=function(e,t){var n=t.instance;return[e,{onChange:function(e){n.toggleAllRowsSelected(e.target.checked)},style:{cursor:"pointer"},checked:n.isAllRowsSelected,title:"Toggle All Rows Selected",indeterminate:Boolean(!n.isAllRowsSelected&&Object.keys(n.state.selectedRowIds).length)}]},yt=function(e,t){var n=t.instance;return[e,{onChange:function(e){n.toggleAllPageRowsSelected(e.target.checked)},style:{cursor:"pointer"},checked:n.isAllPageRowsSelected,title:"Toggle All Current Page Rows Selected",indeterminate:Boolean(!n.isAllPageRowsSelected&&n.page.some((function(e){var t=e.id;return n.state.selectedRowIds[t]})))}]};function bt(e,t,n,r){if(t.type===s.init)return o({selectedRowIds:{}},e);if(t.type===s.resetSelectedRows)return o({},e,{selectedRowIds:r.initialState.selectedRowIds||{}});if(t.type===s.toggleAllRowsSelected){var i=t.value,a=r.isAllRowsSelected,u=r.rowsById,l=r.nonGroupedRowsById,c=void 0===l?u:l,d=void 0!==i?i:!a,f=Object.assign({},e.selectedRowIds);return d?Object.keys(c).forEach((function(e){f[e]=!0})):Object.keys(c).forEach((function(e){delete f[e]})),o({},e,{selectedRowIds:f})}if(t.type===s.toggleRowSelected){var p=t.id,g=t.value,m=r.rowsById,h=r.selectSubRows,v=void 0===h||h,y=r.getSubRows,b=e.selectedRowIds[p],w=void 0!==g?g:!b;if(b===w)return e;var S=o({},e.selectedRowIds);return function e(t){var n=m[t];if(n.isGrouped||(w?S[t]=!0:delete S[t]),v&&y(n))return y(n).forEach((function(t){return e(t.id)}))}(p),o({},e,{selectedRowIds:S})}if(t.type===s.toggleAllPageRowsSelected){var R=t.value,C=r.page,x=r.rowsById,P=r.selectSubRows,O=void 0===P||P,k=r.isAllPageRowsSelected,E=r.getSubRows,I=void 0!==R?R:!k,A=o({},e.selectedRowIds);return C.forEach((function(e){return function e(t){var n=x[t];if(n.isGrouped||(I?A[t]=!0:delete A[t]),O&&E(n))return E(n).forEach((function(t){return e(t.id)}))}(e.id)})),o({},e,{selectedRowIds:A})}return e}function wt(e){var n=e.data,r=e.rows,o=e.getHooks,i=e.plugins,a=e.rowsById,u=e.nonGroupedRowsById,l=void 0===u?a:u,c=e.autoResetSelectedRows,d=void 0===c||c,p=e.state.selectedRowIds,g=e.selectSubRows,h=void 0===g||g,y=e.dispatch,w=e.page,S=e.getSubRows;m(i,["useFilters","useGroupBy","useSortBy","useExpanded","usePagination"],"useRowSelect");var R=t.useMemo((function(){var e=[];return r.forEach((function(t){var n=h?function e(t,n,r){if(n[t.id])return!0;var o=r(t);if(o&&o.length){var i=!0,a=!1;return o.forEach((function(t){a&&!i||(e(t,n,r)?a=!0:i=!1)})),!!i||!!a&&null}return!1}(t,p,S):!!p[t.id];t.isSelected=!!n,t.isSomeSelected=null===n,n&&e.push(t)})),e}),[r,h,p,S]),C=Boolean(Object.keys(l).length&&Object.keys(p).length),x=C;C&&Object.keys(l).some((function(e){return!p[e]}))&&(C=!1),C||w&&w.length&&w.some((function(e){var t=e.id;return!p[t]}))&&(x=!1);var P=v(d);b((function(){P()&&y({type:s.resetSelectedRows})}),[y,n]);var O=t.useCallback((function(e){return y({type:s.toggleAllRowsSelected,value:e})}),[y]),k=t.useCallback((function(e){return y({type:s.toggleAllPageRowsSelected,value:e})}),[y]),E=t.useCallback((function(e,t){return y({type:s.toggleRowSelected,id:e,value:t})}),[y]),I=v(e),A=f(o().getToggleAllRowsSelectedProps,{instance:I()}),j=f(o().getToggleAllPageRowsSelectedProps,{instance:I()});Object.assign(e,{selectedFlatRows:R,isAllRowsSelected:C,isAllPageRowsSelected:x,toggleRowSelected:E,toggleAllRowsSelected:O,getToggleAllRowsSelectedProps:A,getToggleAllPageRowsSelectedProps:j,toggleAllPageRowsSelected:k})}function St(e,t){var n=t.instance;e.toggleRowSelected=function(t){return n.toggleRowSelected(e.id,t)},e.getToggleRowSelectedProps=f(n.getHooks().getToggleRowSelectedProps,{instance:n,row:e})}var Rt=function(e){return{}},Ct=function(e){return{}};s.setRowState="setRowState",s.setCellState="setCellState",s.resetRowState="resetRowState";var xt=function(e){e.stateReducers.push(Pt),e.useInstance.push(Ot),e.prepareRow.push(kt)};function Pt(e,t,n,r){var i=r.initialRowStateAccessor,a=void 0===i?Rt:i,u=r.initialCellStateAccessor,l=void 0===u?Ct:u,c=r.rowsById;if(t.type===s.init)return o({rowState:{}},e);if(t.type===s.resetRowState)return o({},e,{rowState:r.initialState.rowState||{}});if(t.type===s.setRowState){var d,f=t.rowId,p=t.value,g=void 0!==e.rowState[f]?e.rowState[f]:a(c[f]);return o({},e,{rowState:o({},e.rowState,(d={},d[f]=h(p,g),d))})}if(t.type===s.setCellState){var m,v,y,b,w,S=t.rowId,R=t.columnId,C=t.value,x=void 0!==e.rowState[S]?e.rowState[S]:a(c[S]),P=void 0!==(null==x||null==(m=x.cellState)?void 0:m[R])?x.cellState[R]:l(null==(v=c[S])||null==(y=v.cells)?void 0:y.find((function(e){return e.column.id===R})));return o({},e,{rowState:o({},e.rowState,(w={},w[S]=o({},x,{cellState:o({},x.cellState||{},(b={},b[R]=h(C,P),b))}),w))})}}function Ot(e){var n=e.autoResetRowState,r=void 0===n||n,o=e.data,i=e.dispatch,a=t.useCallback((function(e,t){return i({type:s.setRowState,rowId:e,value:t})}),[i]),u=t.useCallback((function(e,t,n){return i({type:s.setCellState,rowId:e,columnId:t,value:n})}),[i]),l=v(r);b((function(){l()&&i({type:s.resetRowState})}),[o]),Object.assign(e,{setRowState:a,setCellState:u})}function kt(e,t){var n=t.instance,r=n.initialRowStateAccessor,o=void 0===r?Rt:r,i=n.initialCellStateAccessor,a=void 0===i?Ct:i,s=n.state.rowState;e&&(e.state=void 0!==s[e.id]?s[e.id]:o(e),e.setState=function(t){return n.setRowState(e.id,t)},e.cells.forEach((function(t){e.state.cellState||(e.state.cellState={}),t.state=void 0!==e.state.cellState[t.column.id]?e.state.cellState[t.column.id]:a(t),t.setState=function(r){return n.setCellState(e.id,t.column.id,r)}})))}xt.pluginName="useRowState",s.resetColumnOrder="resetColumnOrder",s.setColumnOrder="setColumnOrder";var Et=function(e){e.stateReducers.push(It),e.visibleColumnsDeps.push((function(e,t){var n=t.instance;return[].concat(e,[n.state.columnOrder])})),e.visibleColumns.push(At),e.useInstance.push(jt)};function It(e,t,n,r){return t.type===s.init?o({columnOrder:[]},e):t.type===s.resetColumnOrder?o({},e,{columnOrder:r.initialState.columnOrder||[]}):t.type===s.setColumnOrder?o({},e,{columnOrder:h(t.columnOrder,e.columnOrder)}):void 0}function At(e,t){var n=t.instance.state.columnOrder;if(!n||!n.length)return e;for(var r=[].concat(n),o=[].concat(e),i=[],a=function(){var e=r.shift(),t=o.findIndex((function(t){return t.id===e}));t>-1&&i.push(o.splice(t,1)[0])};o.length&&r.length;)a();return[].concat(i,o)}function jt(e){var n=e.dispatch;e.setColumnOrder=t.useCallback((function(e){return n({type:s.setColumnOrder,columnOrder:e})}),[n])}Et.pluginName="useColumnOrder",c.canResize=!0,s.columnStartResizing="columnStartResizing",s.columnResizing="columnResizing",s.columnDoneResizing="columnDoneResizing",s.resetResize="resetResize";var Ft=function(e){e.getResizerProps=[Bt],e.getHeaderProps.push({style:{position:"relative"}}),e.stateReducers.push(Tt),e.useInstance.push(Mt),e.useInstanceBeforeDimensions.push(Gt)},Bt=function(e,t){var n=t.instance,r=t.header,o=n.dispatch,i=function(e,t){var n=!1;if("touchstart"===e.type){if(e.touches&&e.touches.length>1)return;n=!0}var r=function(e){var t=[];return function e(n){n.columns&&n.columns.length&&n.columns.map(e),t.push(n)}(e),t}(t).map((function(e){return[e.id,e.totalWidth]})),i=n?Math.round(e.touches[0].clientX):e.clientX,a=function(e){o({type:s.columnResizing,clientX:e})},u=function(){return o({type:s.columnDoneResizing})},l={mouse:{moveEvent:"mousemove",moveHandler:function(e){return a(e.clientX)},upEvent:"mouseup",upHandler:function(e){document.removeEventListener("mousemove",l.mouse.moveHandler),document.removeEventListener("mouseup",l.mouse.upHandler),u()}},touch:{moveEvent:"touchmove",moveHandler:function(e){return e.cancelable&&(e.preventDefault(),e.stopPropagation()),a(e.touches[0].clientX),!1},upEvent:"touchend",upHandler:function(e){document.removeEventListener(l.touch.moveEvent,l.touch.moveHandler),document.removeEventListener(l.touch.upEvent,l.touch.moveHandler),u()}}},c=n?l.touch:l.mouse,d=!!function(){if("boolean"==typeof G)return G;var e=!1;try{var t={get passive(){return e=!0,!1}};window.addEventListener("test",null,t),window.removeEventListener("test",null,t)}catch(t){e=!1}return G=e}()&&{passive:!1};document.addEventListener(c.moveEvent,c.moveHandler,d),document.addEventListener(c.upEvent,c.upHandler,d),o({type:s.columnStartResizing,columnId:t.id,columnWidth:t.totalWidth,headerIdWidths:r,clientX:i})};return[e,{onMouseDown:function(e){return e.persist()||i(e,r)},onTouchStart:function(e){return e.persist()||i(e,r)},style:{cursor:"col-resize"},draggable:!1,role:"separator"}]};function Tt(e,t){if(t.type===s.init)return o({columnResizing:{columnWidths:{}}},e);if(t.type===s.resetResize)return o({},e,{columnResizing:{columnWidths:{}}});if(t.type===s.columnStartResizing){var n=t.clientX,r=t.columnId,i=t.columnWidth,a=t.headerIdWidths;return o({},e,{columnResizing:o({},e.columnResizing,{startX:n,headerIdWidths:a,columnWidth:i,isResizingColumn:r})})}if(t.type===s.columnResizing){var u=t.clientX,l=e.columnResizing,c=l.startX,d=l.columnWidth,f=l.headerIdWidths,p=(u-c)/d,g={};return(void 0===f?[]:f).forEach((function(e){var t=e[0],n=e[1];g[t]=Math.max(n+n*p,0)})),o({},e,{columnResizing:o({},e.columnResizing,{columnWidths:o({},e.columnResizing.columnWidths,{},g)})})}return t.type===s.columnDoneResizing?o({},e,{columnResizing:o({},e.columnResizing,{startX:null,isResizingColumn:null})}):void 0}Ft.pluginName="useResizeColumns";var Gt=function(e){var t=e.flatHeaders,n=e.disableResizing,r=e.getHooks,o=e.state.columnResizing,i=v(e);t.forEach((function(e){var t=E(!0!==e.disableResizing&&void 0,!0!==n&&void 0,!0);e.canResize=t,e.width=o.columnWidths[e.id]||e.originalWidth||e.width,e.isResizing=o.isResizingColumn===e.id,t&&(e.getResizerProps=f(r().getResizerProps,{instance:i(),header:e}))}))};function Mt(e){var n=e.plugins,r=e.dispatch,o=e.autoResetResize,i=void 0===o||o,a=e.columns;m(n,["useAbsoluteLayout"],"useResizeColumns");var u=v(i);b((function(){u()&&r({type:s.resetResize})}),[a]);var l=t.useCallback((function(){return r({type:s.resetResize})}),[r]);Object.assign(e,{resetResizing:l})}var _t={position:"absolute",top:0},zt=function(e){e.getTableBodyProps.push(Ht),e.getRowProps.push(Ht),e.getHeaderGroupProps.push(Ht),e.getFooterGroupProps.push(Ht),e.getHeaderProps.push((function(e,t){var n=t.column;return[e,{style:o({},_t,{left:n.totalLeft+"px",width:n.totalWidth+"px"})}]})),e.getCellProps.push((function(e,t){var n=t.cell;return[e,{style:o({},_t,{left:n.column.totalLeft+"px",width:n.column.totalWidth+"px"})}]})),e.getFooterProps.push((function(e,t){var n=t.column;return[e,{style:o({},_t,{left:n.totalLeft+"px",width:n.totalWidth+"px"})}]}))};zt.pluginName="useAbsoluteLayout";var Ht=function(e,t){return[e,{style:{position:"relative",width:t.instance.totalColumnsWidth+"px"}}]},Dt={display:"inline-block",boxSizing:"border-box"},Nt=function(e,t){return[e,{style:{display:"flex",width:t.instance.totalColumnsWidth+"px"}}]},Wt=function(e){e.getRowProps.push(Nt),e.getHeaderGroupProps.push(Nt),e.getFooterGroupProps.push(Nt),e.getHeaderProps.push((function(e,t){var n=t.column;return[e,{style:o({},Dt,{width:n.totalWidth+"px"})}]})),e.getCellProps.push((function(e,t){var n=t.cell;return[e,{style:o({},Dt,{width:n.column.totalWidth+"px"})}]})),e.getFooterProps.push((function(e,t){var n=t.column;return[e,{style:o({},Dt,{width:n.totalWidth+"px"})}]}))};function Lt(e){e.getTableProps.push($t),e.getRowProps.push(Vt),e.getHeaderGroupProps.push(Vt),e.getFooterGroupProps.push(Vt),e.getHeaderProps.push(Xt),e.getCellProps.push(qt),e.getFooterProps.push(Ut)}Wt.pluginName="useBlockLayout",Lt.pluginName="useFlexLayout";var $t=function(e,t){return[e,{style:{minWidth:t.instance.totalColumnsMinWidth+"px"}}]},Vt=function(e,t){return[e,{style:{display:"flex",flex:"1 0 auto",minWidth:t.instance.totalColumnsMinWidth+"px"}}]},Xt=function(e,t){var n=t.column;return[e,{style:{boxSizing:"border-box",flex:n.totalFlexWidth?n.totalFlexWidth+" 0 auto":void 0,minWidth:n.totalMinWidth+"px",width:n.totalWidth+"px"}}]},qt=function(e,t){var n=t.cell;return[e,{style:{boxSizing:"border-box",flex:n.column.totalFlexWidth+" 0 auto",minWidth:n.column.totalMinWidth+"px",width:n.column.totalWidth+"px"}}]},Ut=function(e,t){var n=t.column;return[e,{style:{boxSizing:"border-box",flex:n.totalFlexWidth?n.totalFlexWidth+" 0 auto":void 0,minWidth:n.totalMinWidth+"px",width:n.totalWidth+"px"}}]};function Yt(e){e.stateReducers.push(Jt),e.getTableProps.push(Kt),e.getHeaderProps.push(Zt)}Yt.pluginName="useGridLayout";var Kt=function(e,t){return[e,{style:{display:"grid",gridTemplateColumns:t.instance.state.gridLayout.columnWidths.map((function(e){return e})).join(" ")}}]},Zt=function(e,t){return[e,{id:"header-cell-"+t.column.id,style:{position:"sticky"}}]};function Jt(e,t,n,r){if("init"===t.type)return o({gridLayout:{columnWidths:r.columns.map((function(){return"auto"}))}},e);if("columnStartResizing"===t.type){var i=t.columnId,a=r.visibleColumns.findIndex((function(e){return e.id===i})),s=function(e){var t,n=null==(t=document.getElementById("header-cell-"+e))?void 0:t.offsetWidth;if(void 0!==n)return n}(i);return void 0!==s?o({},e,{gridLayout:o({},e.gridLayout,{columnId:i,columnIndex:a,startingWidth:s})}):e}if("columnResizing"===t.type){var u=e.gridLayout,l=u.columnIndex,c=u.startingWidth,d=u.columnWidths,f=c-(e.columnResizing.startX-t.clientX),p=[].concat(d);return p[l]=f+"px",o({},e,{gridLayout:o({},e.gridLayout,{columnWidths:p})})}}e._UNSTABLE_usePivotColumns=nt,e.actions=s,e.defaultColumn=c,e.defaultGroupByFn=We,e.defaultOrderByFn=Je,e.defaultRenderer=u,e.emptyRenderer=l,e.ensurePluginOrder=m,e.flexRender=S,e.functionalUpdate=h,e.loopHooks=g,e.makePropGetter=f,e.makeRenderer=w,e.reduceHooks=p,e.safeUseLayoutEffect=y,e.useAbsoluteLayout=zt,e.useAsyncDebounce=function(e,n){void 0===n&&(n=0);var o=t.useRef({}),i=v(e),a=v(n);return t.useCallback(function(){var e=r(regeneratorRuntime.mark((function e(){var t,n,s,u=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(t=u.length,n=new Array(t),s=0;s<t;s++)n[s]=u[s];return o.current.promise||(o.current.promise=new Promise((function(e,t){o.current.resolve=e,o.current.reject=t}))),o.current.timeout&&clearTimeout(o.current.timeout),o.current.timeout=setTimeout(r(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return delete o.current.timeout,e.prev=1,e.t0=o.current,e.next=5,i().apply(void 0,n);case 5:e.t1=e.sent,e.t0.resolve.call(e.t0,e.t1),e.next=12;break;case 9:e.prev=9,e.t2=e.catch(1),o.current.reject(e.t2);case 12:return e.prev=12,delete o.current.promise,e.finish(12);case 15:case"end":return e.stop()}}),e,null,[[1,9,12,15]])}))),a()),e.abrupt("return",o.current.promise);case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),[i,a])},e.useBlockLayout=Wt,e.useColumnOrder=Et,e.useExpanded=ue,e.useFilters=Pe,e.useFlexLayout=Lt,e.useGetLatest=v,e.useGlobalFilter=Ee,e.useGridLayout=Yt,e.useGroupBy=Ge,e.useMountedLayoutEffect=b,e.usePagination=Qe,e.useResizeColumns=Ft,e.useRowSelect=mt,e.useRowState=xt,e.useSortBy=Ue,e.useTable=function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];e=ie(e),r=[q].concat(r);var a=t.useRef({}),u=v(a.current);Object.assign(u(),o({},e,{plugins:r,hooks:X()})),r.filter(Boolean).forEach((function(e){e(u().hooks)}));var l=v(u().hooks);u().getHooks=l,delete u().hooks,Object.assign(u(),p(l().useOptions,ie(e)));var c=u(),d=c.data,m=c.columns,h=c.initialState,y=c.defaultColumn,b=c.getSubRows,S=c.getRowId,k=c.stateReducer,E=c.useControlledState,I=v(k),A=t.useCallback((function(e,t){if(!t.type)throw console.info({action:t}),new Error("Unknown Action 👆");return[].concat(l().stateReducers,Array.isArray(I())?I():[I()]).reduce((function(n,r){return r(n,t,e,u())||n}),e)}),[l,I,u]),j=t.useReducer(A,void 0,(function(){return A(h,{type:s.init})})),F=j[0],B=j[1],T=p([].concat(l().useControlledState,[E]),F,{instance:u()});Object.assign(u(),{state:T,dispatch:B});var G=t.useMemo((function(){return R(p(l().columns,m,{instance:u()}))}),[l,u,m].concat(p(l().columnsDeps,[],{instance:u()})));u().columns=G;var M=t.useMemo((function(){return p(l().allColumns,C(G),{instance:u()}).map(x)}),[G,l,u].concat(p(l().allColumnsDeps,[],{instance:u()})));u().allColumns=M;var _=t.useMemo((function(){for(var e=[],t=[],n={},r=[].concat(M);r.length;){var o=r.shift();se({data:d,rows:e,flatRows:t,rowsById:n,column:o,getRowId:S,getSubRows:b,accessValueHooks:l().accessValue,getInstance:u})}return[e,t,n]}),[M,d,S,b,l,u]),z=_[0],H=_[1],D=_[2];Object.assign(u(),{rows:z,initialRows:[].concat(z),flatRows:H,rowsById:D}),g(l().useInstanceAfterData,u());var N=t.useMemo((function(){return p(l().visibleColumns,M,{instance:u()}).map((function(e){return P(e,y)}))}),[l,M,u,y].concat(p(l().visibleColumnsDeps,[],{instance:u()})));M=t.useMemo((function(){var e=[].concat(N);return M.forEach((function(t){e.find((function(e){return e.id===t.id}))||e.push(t)})),e}),[M,N]),u().allColumns=M;var W=t.useMemo((function(){return p(l().headerGroups,O(N,y),u())}),[l,N,y,u].concat(p(l().headerGroupsDeps,[],{instance:u()})));u().headerGroups=W;var L=t.useMemo((function(){return W.length?W[0].headers:[]}),[W]);u().headers=L,u().flatHeaders=W.reduce((function(e,t){return[].concat(e,t.headers)}),[]),g(l().useInstanceBeforeDimensions,u());var $=N.filter((function(e){return e.isVisible})).map((function(e){return e.id})).sort().join("_");N=t.useMemo((function(){return N.filter((function(e){return e.isVisible}))}),[N,$]),u().visibleColumns=N;var V=ae(L),U=V[0],Y=V[1],K=V[2];return u().totalColumnsMinWidth=U,u().totalColumnsWidth=Y,u().totalColumnsMaxWidth=K,g(l().useInstance,u()),[].concat(u().flatHeaders,u().allColumns).forEach((function(e){e.render=w(u(),e),e.getHeaderProps=f(l().getHeaderProps,{instance:u(),column:e}),e.getFooterProps=f(l().getFooterProps,{instance:u(),column:e})})),u().headerGroups=t.useMemo((function(){return W.filter((function(e,t){return e.headers=e.headers.filter((function(e){return e.headers?function e(t){return t.filter((function(t){return t.headers?e(t.headers):t.isVisible})).length}(e.headers):e.isVisible})),!!e.headers.length&&(e.getHeaderGroupProps=f(l().getHeaderGroupProps,{instance:u(),headerGroup:e,index:t}),e.getFooterGroupProps=f(l().getFooterGroupProps,{instance:u(),headerGroup:e,index:t}),!0)}))}),[W,u,l]),u().footerGroups=[].concat(u().headerGroups).reverse(),u().prepareRow=t.useCallback((function(e){e.getRowProps=f(l().getRowProps,{instance:u(),row:e}),e.allCells=M.map((function(t){var n=e.values[t.id],r={column:t,row:e,value:n};return r.getCellProps=f(l().getCellProps,{instance:u(),cell:r}),r.render=w(u(),t,{row:e,cell:r,value:n}),r})),e.cells=N.map((function(t){return e.allCells.find((function(e){return e.column.id===t.id}))})),g(l().prepareRow,e,{instance:u()})}),[l,u,M,N]),u().getTableProps=f(l().getTableProps,{instance:u()}),u().getTableBodyProps=f(l().getTableBodyProps,{instance:u()}),g(l().useFinalInstance,u()),u()},Object.defineProperty(e,"__esModule",{value:!0})}(t,n(1))},function(e,t,n){"use strict";var r=n(22),o={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},i={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},a={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},s={};function u(e){return r.isMemo(e)?a:s[e.$$typeof]||o}s[r.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},s[r.Memo]=a;var l=Object.defineProperty,c=Object.getOwnPropertyNames,d=Object.getOwnPropertySymbols,f=Object.getOwnPropertyDescriptor,p=Object.getPrototypeOf,g=Object.prototype;e.exports=function e(t,n,r){if("string"!=typeof n){if(g){var o=p(n);o&&o!==g&&e(t,o,r)}var a=c(n);d&&(a=a.concat(d(n)));for(var s=u(t),m=u(n),h=0;h<a.length;++h){var v=a[h];if(!(i[v]||r&&r[v]||m&&m[v]||s&&s[v])){var y=f(n,v);try{l(t,v,y)}catch(e){}}}}return t}},function(e,t,n){"use strict";var r=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|inert|itemProp|itemScope|itemType|itemID|itemRef|on|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,o=function(e){var t={};return function(n){return void 0===t[n]&&(t[n]=e(n)),t[n]}}((function(e){return r.test(e)||111===e.charCodeAt(0)&&110===e.charCodeAt(1)&&e.charCodeAt(2)<91}));t.a=o},function(e){e.exports=JSON.parse('{"attributes":{"alignment":{"type":"string","default":"none"},"formID":{"type":"string"},"selectedFields":{"type":"array"}}}')},function(e,t){e.exports=function(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){"use strict";(function(e){var r=n(22),o=n(1),i=n.n(o),a=n(29),s=n.n(a),u=n(30),l=n(31),c=n(25),d=n(24),f=n.n(d);function p(){return(p=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}var g=function(e,t){for(var n=[e[0]],r=0,o=t.length;r<o;r+=1)n.push(t[r],e[r+1]);return n},m=function(e){return null!==e&&"object"==typeof e&&"[object Object]"===(e.toString?e.toString():Object.prototype.toString.call(e))&&!Object(r.typeOf)(e)},h=Object.freeze([]),v=Object.freeze({});function y(e){return"function"==typeof e}function b(e){return e.displayName||e.name||"Component"}function w(e){return e&&"string"==typeof e.styledComponentId}var S=void 0!==e&&(e.env.REACT_APP_SC_ATTR||e.env.SC_ATTR)||"data-styled",R="undefined"!=typeof window&&"HTMLElement"in window,C=Boolean("boolean"==typeof SC_DISABLE_SPEEDY?SC_DISABLE_SPEEDY:void 0!==e&&void 0!==e.env.REACT_APP_SC_DISABLE_SPEEDY&&""!==e.env.REACT_APP_SC_DISABLE_SPEEDY?"false"!==e.env.REACT_APP_SC_DISABLE_SPEEDY&&e.env.REACT_APP_SC_DISABLE_SPEEDY:void 0!==e&&void 0!==e.env.SC_DISABLE_SPEEDY&&""!==e.env.SC_DISABLE_SPEEDY&&("false"!==e.env.SC_DISABLE_SPEEDY&&e.env.SC_DISABLE_SPEEDY));function x(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];throw new Error("An error occurred. See https://git.io/JUIaE#"+e+" for more information."+(n.length>0?" Args: "+n.join(", "):""))}var P=function(){function e(e){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=e}var t=e.prototype;return t.indexOfGroup=function(e){for(var t=0,n=0;n<e;n++)t+=this.groupSizes[n];return t},t.insertRules=function(e,t){if(e>=this.groupSizes.length){for(var n=this.groupSizes,r=n.length,o=r;e>=o;)(o<<=1)<0&&x(16,""+e);this.groupSizes=new Uint32Array(o),this.groupSizes.set(n),this.length=o;for(var i=r;i<o;i++)this.groupSizes[i]=0}for(var a=this.indexOfGroup(e+1),s=0,u=t.length;s<u;s++)this.tag.insertRule(a,t[s])&&(this.groupSizes[e]++,a++)},t.clearGroup=function(e){if(e<this.length){var t=this.groupSizes[e],n=this.indexOfGroup(e),r=n+t;this.groupSizes[e]=0;for(var o=n;o<r;o++)this.tag.deleteRule(n)}},t.getGroup=function(e){var t="";if(e>=this.length||0===this.groupSizes[e])return t;for(var n=this.groupSizes[e],r=this.indexOfGroup(e),o=r+n,i=r;i<o;i++)t+=this.tag.getRule(i)+"/*!sc*/\n";return t},e}(),O=new Map,k=new Map,E=1,I=function(e){if(O.has(e))return O.get(e);for(;k.has(E);)E++;var t=E++;return O.set(e,t),k.set(t,e),t},A=function(e){return k.get(e)},j=function(e,t){O.set(e,t),k.set(t,e)},F="style["+S+'][data-styled-version="5.2.1"]',B=new RegExp("^"+S+'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)'),T=function(e,t,n){for(var r,o=n.split(","),i=0,a=o.length;i<a;i++)(r=o[i])&&e.registerName(t,r)},G=function(e,t){for(var n=t.innerHTML.split("/*!sc*/\n"),r=[],o=0,i=n.length;o<i;o++){var a=n[o].trim();if(a){var s=a.match(B);if(s){var u=0|parseInt(s[1],10),l=s[2];0!==u&&(j(l,u),T(e,l,s[3]),e.getTag().insertRules(u,r)),r.length=0}else r.push(a)}}},M=function(){return n.nc},_=function(e){var t=document.head,n=e||t,r=document.createElement("style"),o=function(e){for(var t=e.childNodes,n=t.length;n>=0;n--){var r=t[n];if(r&&1===r.nodeType&&r.hasAttribute(S))return r}}(n),i=void 0!==o?o.nextSibling:null;r.setAttribute(S,"active"),r.setAttribute("data-styled-version","5.2.1");var a=M();return a&&r.setAttribute("nonce",a),n.insertBefore(r,i),r},z=function(){function e(e){var t=this.element=_(e);t.appendChild(document.createTextNode("")),this.sheet=function(e){if(e.sheet)return e.sheet;for(var t=document.styleSheets,n=0,r=t.length;n<r;n++){var o=t[n];if(o.ownerNode===e)return o}x(17)}(t),this.length=0}var t=e.prototype;return t.insertRule=function(e,t){try{return this.sheet.insertRule(t,e),this.length++,!0}catch(e){return!1}},t.deleteRule=function(e){this.sheet.deleteRule(e),this.length--},t.getRule=function(e){var t=this.sheet.cssRules[e];return void 0!==t&&"string"==typeof t.cssText?t.cssText:""},e}(),H=function(){function e(e){var t=this.element=_(e);this.nodes=t.childNodes,this.length=0}var t=e.prototype;return t.insertRule=function(e,t){if(e<=this.length&&e>=0){var n=document.createTextNode(t),r=this.nodes[e];return this.element.insertBefore(n,r||null),this.length++,!0}return!1},t.deleteRule=function(e){this.element.removeChild(this.nodes[e]),this.length--},t.getRule=function(e){return e<this.length?this.nodes[e].textContent:""},e}(),D=function(){function e(e){this.rules=[],this.length=0}var t=e.prototype;return t.insertRule=function(e,t){return e<=this.length&&(this.rules.splice(e,0,t),this.length++,!0)},t.deleteRule=function(e){this.rules.splice(e,1),this.length--},t.getRule=function(e){return e<this.length?this.rules[e]:""},e}(),N=R,W={isServer:!R,useCSSOMInjection:!C},L=function(){function e(e,t,n){void 0===e&&(e=v),void 0===t&&(t={}),this.options=p({},W,{},e),this.gs=t,this.names=new Map(n),!this.options.isServer&&R&&N&&(N=!1,function(e){for(var t=document.querySelectorAll(F),n=0,r=t.length;n<r;n++){var o=t[n];o&&"active"!==o.getAttribute(S)&&(G(e,o),o.parentNode&&o.parentNode.removeChild(o))}}(this))}e.registerId=function(e){return I(e)};var t=e.prototype;return t.reconstructWithOptions=function(t,n){return void 0===n&&(n=!0),new e(p({},this.options,{},t),this.gs,n&&this.names||void 0)},t.allocateGSInstance=function(e){return this.gs[e]=(this.gs[e]||0)+1},t.getTag=function(){return this.tag||(this.tag=(n=(t=this.options).isServer,r=t.useCSSOMInjection,o=t.target,e=n?new D(o):r?new z(o):new H(o),new P(e)));var e,t,n,r,o},t.hasNameForId=function(e,t){return this.names.has(e)&&this.names.get(e).has(t)},t.registerName=function(e,t){if(I(e),this.names.has(e))this.names.get(e).add(t);else{var n=new Set;n.add(t),this.names.set(e,n)}},t.insertRules=function(e,t,n){this.registerName(e,t),this.getTag().insertRules(I(e),n)},t.clearNames=function(e){this.names.has(e)&&this.names.get(e).clear()},t.clearRules=function(e){this.getTag().clearGroup(I(e)),this.clearNames(e)},t.clearTag=function(){this.tag=void 0},t.toString=function(){return function(e){for(var t=e.getTag(),n=t.length,r="",o=0;o<n;o++){var i=A(o);if(void 0!==i){var a=e.names.get(i),s=t.getGroup(o);if(void 0!==a&&0!==s.length){var u=S+".g"+o+'[id="'+i+'"]',l="";void 0!==a&&a.forEach((function(e){e.length>0&&(l+=e+",")})),r+=""+s+u+'{content:"'+l+'"}/*!sc*/\n'}}}return r}(this)},e}(),$=/(a)(d)/gi,V=function(e){return String.fromCharCode(e+(e>25?39:97))};function X(e){var t,n="";for(t=Math.abs(e);t>52;t=t/52|0)n=V(t%52)+n;return(V(t%52)+n).replace($,"$1-$2")}var q=function(e,t){for(var n=t.length;n;)e=33*e^t.charCodeAt(--n);return e},U=function(e){return q(5381,e)};function Y(e){for(var t=0;t<e.length;t+=1){var n=e[t];if(y(n)&&!w(n))return!1}return!0}var K=U("5.2.1"),Z=function(){function e(e,t,n){this.rules=e,this.staticRulesId="",this.isStatic=(void 0===n||n.isStatic)&&Y(e),this.componentId=t,this.baseHash=q(K,t),this.baseStyle=n,L.registerId(t)}return e.prototype.generateAndInjectStyles=function(e,t,n){var r=this.componentId,o=[];if(this.baseStyle&&o.push(this.baseStyle.generateAndInjectStyles(e,t,n)),this.isStatic&&!n.hash)if(this.staticRulesId&&t.hasNameForId(r,this.staticRulesId))o.push(this.staticRulesId);else{var i=me(this.rules,e,t,n).join(""),a=X(q(this.baseHash,i.length)>>>0);if(!t.hasNameForId(r,a)){var s=n(i,"."+a,void 0,r);t.insertRules(r,a,s)}o.push(a),this.staticRulesId=a}else{for(var u=this.rules.length,l=q(this.baseHash,n.hash),c="",d=0;d<u;d++){var f=this.rules[d];if("string"==typeof f)c+=f;else if(f){var p=me(f,e,t,n),g=Array.isArray(p)?p.join(""):p;l=q(l,g+d),c+=g}}if(c){var m=X(l>>>0);if(!t.hasNameForId(r,m)){var h=n(c,"."+m,void 0,r);t.insertRules(r,m,h)}o.push(m)}}return o.join(" ")},e}(),J=/^\s*\/\/.*$/gm,Q=[":","[",".","#"];function ee(e){var t,n,r,o,i=void 0===e?v:e,a=i.options,s=void 0===a?v:a,l=i.plugins,c=void 0===l?h:l,d=new u.a(s),f=[],p=function(e){function t(t){if(t)try{e(t+"}")}catch(e){}}return function(n,r,o,i,a,s,u,l,c,d){switch(n){case 1:if(0===c&&64===r.charCodeAt(0))return e(r+";"),"";break;case 2:if(0===l)return r+"/*|*/";break;case 3:switch(l){case 102:case 112:return e(o[0]+r),"";default:return r+(0===d?"/*|*/":"")}case-2:r.split("/*|*/}").forEach(t)}}}((function(e){f.push(e)})),g=function(e,r,i){return 0===r&&Q.includes(i[n.length])||i.match(o)?e:"."+t};function m(e,i,a,s){void 0===s&&(s="&");var u=e.replace(J,""),l=i&&a?a+" "+i+" { "+u+" }":u;return t=s,n=i,r=new RegExp("\\"+n+"\\b","g"),o=new RegExp("(\\"+n+"\\b){2,}"),d(a||!i?"":i,l)}return d.use([].concat(c,[function(e,t,o){2===e&&o.length&&o[0].lastIndexOf(n)>0&&(o[0]=o[0].replace(r,g))},p,function(e){if(-2===e){var t=f;return f=[],t}}])),m.hash=c.length?c.reduce((function(e,t){return t.name||x(15),q(e,t.name)}),5381).toString():"",m}var te=i.a.createContext(),ne=(te.Consumer,i.a.createContext()),re=(ne.Consumer,new L),oe=ee();function ie(){return Object(o.useContext)(te)||re}function ae(){return Object(o.useContext)(ne)||oe}function se(e){var t=Object(o.useState)(e.stylisPlugins),n=t[0],r=t[1],a=ie(),u=Object(o.useMemo)((function(){var t=a;return e.sheet?t=e.sheet:e.target&&(t=t.reconstructWithOptions({target:e.target},!1)),e.disableCSSOMInjection&&(t=t.reconstructWithOptions({useCSSOMInjection:!1})),t}),[e.disableCSSOMInjection,e.sheet,e.target]),l=Object(o.useMemo)((function(){return ee({options:{prefix:!e.disableVendorPrefixes},plugins:n})}),[e.disableVendorPrefixes,n]);return Object(o.useEffect)((function(){s()(n,e.stylisPlugins)||r(e.stylisPlugins)}),[e.stylisPlugins]),i.a.createElement(te.Provider,{value:u},i.a.createElement(ne.Provider,{value:l},e.children))}var ue=function(){function e(e,t){var n=this;this.inject=function(e,t){void 0===t&&(t=oe);var r=n.name+t.hash;e.hasNameForId(n.id,r)||e.insertRules(n.id,r,t(n.rules,r,"@keyframes"))},this.toString=function(){return x(12,String(n.name))},this.name=e,this.id="sc-keyframes-"+e,this.rules=t}return e.prototype.getName=function(e){return void 0===e&&(e=oe),this.name+e.hash},e}(),le=/([A-Z])/,ce=/([A-Z])/g,de=/^ms-/,fe=function(e){return"-"+e.toLowerCase()};function pe(e){return le.test(e)?e.replace(ce,fe).replace(de,"-ms-"):e}var ge=function(e){return null==e||!1===e||""===e};function me(e,t,n,r){if(Array.isArray(e)){for(var o,i=[],a=0,s=e.length;a<s;a+=1)""!==(o=me(e[a],t,n,r))&&(Array.isArray(o)?i.push.apply(i,o):i.push(o));return i}return ge(e)?"":w(e)?"."+e.styledComponentId:y(e)?"function"!=typeof(u=e)||u.prototype&&u.prototype.isReactComponent||!t?e:me(e(t),t,n,r):e instanceof ue?n?(e.inject(n,r),e.getName(r)):e:m(e)?function e(t,n){var r,o,i=[];for(var a in t)t.hasOwnProperty(a)&&!ge(t[a])&&(m(t[a])?i.push.apply(i,e(t[a],a)):y(t[a])?i.push(pe(a)+":",t[a],";"):i.push(pe(a)+": "+(r=a,(null==(o=t[a])||"boolean"==typeof o||""===o?"":"number"!=typeof o||0===o||r in l.a?String(o).trim():o+"px")+";")));return n?[n+" {"].concat(i,["}"]):i}(e):e.toString();var u}function he(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return y(e)||m(e)?me(g(h,[e].concat(n))):0===n.length&&1===e.length&&"string"==typeof e[0]?e:me(g(e,n))}new Set;var ve=function(e,t,n){return void 0===n&&(n=v),e.theme!==n.theme&&e.theme||t||n.theme},ye=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,be=/(^-|-$)/g;function we(e){return e.replace(ye,"-").replace(be,"")}var Se=function(e){return X(U(e)>>>0)};function Re(e){return"string"==typeof e&&!0}var Ce=function(e){return"function"==typeof e||"object"==typeof e&&null!==e&&!Array.isArray(e)},xe=function(e){return"__proto__"!==e&&"constructor"!==e&&"prototype"!==e};function Pe(e,t,n){var r=e[n];Ce(t)&&Ce(r)?Oe(r,t):e[n]=t}function Oe(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];for(var o=0,i=n;o<i.length;o++){var a=i[o];if(Ce(a))for(var s in a)xe(s)&&Pe(e,a[s],s)}return e}var ke=i.a.createContext();ke.Consumer;var Ee={};function Ie(e,t,n){var r=w(e),a=!Re(e),s=t.attrs,u=void 0===s?h:s,l=t.componentId,d=void 0===l?function(e,t){var n="string"!=typeof e?"sc":we(e);Ee[n]=(Ee[n]||0)+1;var r=n+"-"+Se("5.2.1"+n+Ee[n]);return t?t+"-"+r:r}(t.displayName,t.parentComponentId):l,g=t.displayName,m=void 0===g?function(e){return Re(e)?"styled."+e:"Styled("+b(e)+")"}(e):g,S=t.displayName&&t.componentId?we(t.displayName)+"-"+t.componentId:t.componentId||d,R=r&&e.attrs?Array.prototype.concat(e.attrs,u).filter(Boolean):u,C=t.shouldForwardProp;r&&e.shouldForwardProp&&(C=t.shouldForwardProp?function(n,r){return e.shouldForwardProp(n,r)&&t.shouldForwardProp(n,r)}:e.shouldForwardProp);var x,P=new Z(n,S,r?e.componentStyle:void 0),O=P.isStatic&&0===u.length,k=function(e,t){return function(e,t,n,r){var i=e.attrs,a=e.componentStyle,s=e.defaultProps,u=e.foldedComponentIds,l=e.shouldForwardProp,d=e.styledComponentId,f=e.target,g=function(e,t,n){void 0===e&&(e=v);var r=p({},t,{theme:e}),o={};return n.forEach((function(e){var t,n,i,a=e;for(t in y(a)&&(a=a(r)),a)r[t]=o[t]="className"===t?(n=o[t],i=a[t],n&&i?n+" "+i:n||i):a[t]})),[r,o]}(ve(t,Object(o.useContext)(ke),s)||v,t,i),m=g[0],h=g[1],b=function(e,t,n,r){var o=ie(),i=ae();return t?e.generateAndInjectStyles(v,o,i):e.generateAndInjectStyles(n,o,i)}(a,r,m),w=n,S=h.$as||t.$as||h.as||t.as||f,R=Re(S),C=h!==t?p({},t,{},h):t,x={};for(var P in C)"$"!==P[0]&&"as"!==P&&("forwardedAs"===P?x.as=C[P]:(l?l(P,c.a):!R||Object(c.a)(P))&&(x[P]=C[P]));return t.style&&h.style!==t.style&&(x.style=p({},t.style,{},h.style)),x.className=Array.prototype.concat(u,d,b!==d?b:null,t.className,h.className).filter(Boolean).join(" "),x.ref=w,Object(o.createElement)(S,x)}(x,e,t,O)};return k.displayName=m,(x=i.a.forwardRef(k)).attrs=R,x.componentStyle=P,x.displayName=m,x.shouldForwardProp=C,x.foldedComponentIds=r?Array.prototype.concat(e.foldedComponentIds,e.styledComponentId):h,x.styledComponentId=S,x.target=r?e.target:e,x.withComponent=function(e){var r=t.componentId,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(t,["componentId"]),i=r&&r+"-"+(Re(e)?e:we(b(e)));return Ie(e,p({},o,{attrs:R,componentId:i}),n)},Object.defineProperty(x,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(t){this._foldedDefaultProps=r?Oe({},e.defaultProps,t):t}}),x.toString=function(){return"."+x.styledComponentId},a&&f()(x,e,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0,withComponent:!0}),x}var Ae=function(e){return function e(t,n,o){if(void 0===o&&(o=v),!Object(r.isValidElementType)(n))return x(1,String(n));var i=function(){return t(n,o,he.apply(void 0,arguments))};return i.withConfig=function(r){return e(t,n,p({},o,{},r))},i.attrs=function(r){return e(t,n,p({},o,{attrs:Array.prototype.concat(o.attrs,r).filter(Boolean)}))},i}(Ie,e)};["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"].forEach((function(e){Ae[e]=Ae(e)}));!function(){function e(e,t){this.rules=e,this.componentId=t,this.isStatic=Y(e),L.registerId(this.componentId+1)}var t=e.prototype;t.createStyles=function(e,t,n,r){var o=r(me(this.rules,t,n,r).join(""),""),i=this.componentId+e;n.insertRules(i,i,o)},t.removeStyles=function(e,t){t.clearRules(this.componentId+e)},t.renderStyles=function(e,t,n,r){e>2&&L.registerId(this.componentId+e),this.removeStyles(e,n),this.createStyles(e,t,n,r)}}();!function(){function e(){var e=this;this._emitSheetCSS=function(){var t=e.instance.toString(),n=M();return"<style "+[n&&'nonce="'+n+'"',S+'="true"','data-styled-version="5.2.1"'].filter(Boolean).join(" ")+">"+t+"</style>"},this.getStyleTags=function(){return e.sealed?x(2):e._emitSheetCSS()},this.getStyleElement=function(){var t;if(e.sealed)return x(2);var n=((t={})[S]="",t["data-styled-version"]="5.2.1",t.dangerouslySetInnerHTML={__html:e.instance.toString()},t),r=M();return r&&(n.nonce=r),[i.a.createElement("style",p({},n,{key:"sc-0-0"}))]},this.seal=function(){e.sealed=!0},this.instance=new L({isServer:!0}),this.sealed=!1}var t=e.prototype;t.collectStyles=function(e){return this.sealed?x(2):i.a.createElement(se,{sheet:this.instance},e)},t.interleaveWithNodeStream=function(e){return x(3)}}();t.a=Ae}).call(this,n(34))},function(e,t){e.exports=function(e,t,n,r){var o=n?n.call(r,e,t):void 0;if(void 0!==o)return!!o;if(e===t)return!0;if("object"!=typeof e||!e||"object"!=typeof t||!t)return!1;var i=Object.keys(e),a=Object.keys(t);if(i.length!==a.length)return!1;for(var s=Object.prototype.hasOwnProperty.bind(t),u=0;u<i.length;u++){var l=i[u];if(!s(l))return!1;var c=e[l],d=t[l];if(!1===(o=n?n.call(r,c,d,l):void 0)||void 0===o&&c!==d)return!1}return!0}},function(e,t,n){"use strict";t.a=function(e){function t(e,t,r){var o=t.trim().split(g);t=o;var i=o.length,a=e.length;switch(a){case 0:case 1:var s=0;for(e=0===a?"":e[0]+" ";s<i;++s)t[s]=n(e,t[s],r).trim();break;default:var u=s=0;for(t=[];s<i;++s)for(var l=0;l<a;++l)t[u++]=n(e[l]+" ",o[s],r).trim()}return t}function n(e,t,n){var r=t.charCodeAt(0);switch(33>r&&(r=(t=t.trim()).charCodeAt(0)),r){case 38:return t.replace(m,"$1"+e.trim());case 58:return e.trim()+t.replace(m,"$1"+e.trim());default:if(0<1*n&&0<t.indexOf("\f"))return t.replace(m,(58===e.charCodeAt(0)?"":"$1")+e.trim())}return e+t}function r(e,t,n,i){var a=e+";",s=2*t+3*n+4*i;if(944===s){e=a.indexOf(":",9)+1;var u=a.substring(e,a.length-1).trim();return u=a.substring(0,e).trim()+u+";",1===I||2===I&&o(u,1)?"-webkit-"+u+u:u}if(0===I||2===I&&!o(a,1))return a;switch(s){case 1015:return 97===a.charCodeAt(10)?"-webkit-"+a+a:a;case 951:return 116===a.charCodeAt(3)?"-webkit-"+a+a:a;case 963:return 110===a.charCodeAt(5)?"-webkit-"+a+a:a;case 1009:if(100!==a.charCodeAt(4))break;case 969:case 942:return"-webkit-"+a+a;case 978:return"-webkit-"+a+"-moz-"+a+a;case 1019:case 983:return"-webkit-"+a+"-moz-"+a+"-ms-"+a+a;case 883:if(45===a.charCodeAt(8))return"-webkit-"+a+a;if(0<a.indexOf("image-set(",11))return a.replace(P,"$1-webkit-$2")+a;break;case 932:if(45===a.charCodeAt(4))switch(a.charCodeAt(5)){case 103:return"-webkit-box-"+a.replace("-grow","")+"-webkit-"+a+"-ms-"+a.replace("grow","positive")+a;case 115:return"-webkit-"+a+"-ms-"+a.replace("shrink","negative")+a;case 98:return"-webkit-"+a+"-ms-"+a.replace("basis","preferred-size")+a}return"-webkit-"+a+"-ms-"+a+a;case 964:return"-webkit-"+a+"-ms-flex-"+a+a;case 1023:if(99!==a.charCodeAt(8))break;return"-webkit-box-pack"+(u=a.substring(a.indexOf(":",15)).replace("flex-","").replace("space-between","justify"))+"-webkit-"+a+"-ms-flex-pack"+u+a;case 1005:return f.test(a)?a.replace(d,":-webkit-")+a.replace(d,":-moz-")+a:a;case 1e3:switch(t=(u=a.substring(13).trim()).indexOf("-")+1,u.charCodeAt(0)+u.charCodeAt(t)){case 226:u=a.replace(b,"tb");break;case 232:u=a.replace(b,"tb-rl");break;case 220:u=a.replace(b,"lr");break;default:return a}return"-webkit-"+a+"-ms-"+u+a;case 1017:if(-1===a.indexOf("sticky",9))break;case 975:switch(t=(a=e).length-10,s=(u=(33===a.charCodeAt(t)?a.substring(0,t):a).substring(e.indexOf(":",7)+1).trim()).charCodeAt(0)+(0|u.charCodeAt(7))){case 203:if(111>u.charCodeAt(8))break;case 115:a=a.replace(u,"-webkit-"+u)+";"+a;break;case 207:case 102:a=a.replace(u,"-webkit-"+(102<s?"inline-":"")+"box")+";"+a.replace(u,"-webkit-"+u)+";"+a.replace(u,"-ms-"+u+"box")+";"+a}return a+";";case 938:if(45===a.charCodeAt(5))switch(a.charCodeAt(6)){case 105:return u=a.replace("-items",""),"-webkit-"+a+"-webkit-box-"+u+"-ms-flex-"+u+a;case 115:return"-webkit-"+a+"-ms-flex-item-"+a.replace(R,"")+a;default:return"-webkit-"+a+"-ms-flex-line-pack"+a.replace("align-content","").replace(R,"")+a}break;case 973:case 989:if(45!==a.charCodeAt(3)||122===a.charCodeAt(4))break;case 931:case 953:if(!0===x.test(e))return 115===(u=e.substring(e.indexOf(":")+1)).charCodeAt(0)?r(e.replace("stretch","fill-available"),t,n,i).replace(":fill-available",":stretch"):a.replace(u,"-webkit-"+u)+a.replace(u,"-moz-"+u.replace("fill-",""))+a;break;case 962:if(a="-webkit-"+a+(102===a.charCodeAt(5)?"-ms-"+a:"")+a,211===n+i&&105===a.charCodeAt(13)&&0<a.indexOf("transform",10))return a.substring(0,a.indexOf(";",27)+1).replace(p,"$1-webkit-$2")+a}return a}function o(e,t){var n=e.indexOf(1===t?":":"{"),r=e.substring(0,3!==t?n:10);return n=e.substring(n+1,e.length-1),B(2!==t?r:r.replace(C,"$1"),n,t)}function i(e,t){var n=r(t,t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2));return n!==t+";"?n.replace(S," or ($1)").substring(4):"("+t+")"}function a(e,t,n,r,o,i,a,s,l,c){for(var d,f=0,p=t;f<F;++f)switch(d=j[f].call(u,e,p,n,r,o,i,a,s,l,c)){case void 0:case!1:case!0:case null:break;default:p=d}if(p!==t)return p}function s(e){return void 0!==(e=e.prefix)&&(B=null,e?"function"!=typeof e?I=1:(I=2,B=e):I=0),s}function u(e,n){var s=e;if(33>s.charCodeAt(0)&&(s=s.trim()),s=[s],0<F){var u=a(-1,n,s,s,k,O,0,0,0,0);void 0!==u&&"string"==typeof u&&(n=u)}var d=function e(n,s,u,d,f){for(var p,g,m,b,S,R=0,C=0,x=0,P=0,j=0,B=0,G=m=p=0,M=0,_=0,z=0,H=0,D=u.length,N=D-1,W="",L="",$="",V="";M<D;){if(g=u.charCodeAt(M),M===N&&0!==C+P+x+R&&(0!==C&&(g=47===C?10:47),P=x=R=0,D++,N++),0===C+P+x+R){if(M===N&&(0<_&&(W=W.replace(c,"")),0<W.trim().length)){switch(g){case 32:case 9:case 59:case 13:case 10:break;default:W+=u.charAt(M)}g=59}switch(g){case 123:for(p=(W=W.trim()).charCodeAt(0),m=1,H=++M;M<D;){switch(g=u.charCodeAt(M)){case 123:m++;break;case 125:m--;break;case 47:switch(g=u.charCodeAt(M+1)){case 42:case 47:e:{for(G=M+1;G<N;++G)switch(u.charCodeAt(G)){case 47:if(42===g&&42===u.charCodeAt(G-1)&&M+2!==G){M=G+1;break e}break;case 10:if(47===g){M=G+1;break e}}M=G}}break;case 91:g++;case 40:g++;case 34:case 39:for(;M++<N&&u.charCodeAt(M)!==g;);}if(0===m)break;M++}switch(m=u.substring(H,M),0===p&&(p=(W=W.replace(l,"").trim()).charCodeAt(0)),p){case 64:switch(0<_&&(W=W.replace(c,"")),g=W.charCodeAt(1)){case 100:case 109:case 115:case 45:_=s;break;default:_=A}if(H=(m=e(s,_,m,g,f+1)).length,0<F&&(S=a(3,m,_=t(A,W,z),s,k,O,H,g,f,d),W=_.join(""),void 0!==S&&0===(H=(m=S.trim()).length)&&(g=0,m="")),0<H)switch(g){case 115:W=W.replace(w,i);case 100:case 109:case 45:m=W+"{"+m+"}";break;case 107:m=(W=W.replace(h,"$1 $2"))+"{"+m+"}",m=1===I||2===I&&o("@"+m,3)?"@-webkit-"+m+"@"+m:"@"+m;break;default:m=W+m,112===d&&(L+=m,m="")}else m="";break;default:m=e(s,t(s,W,z),m,d,f+1)}$+=m,m=z=_=G=p=0,W="",g=u.charCodeAt(++M);break;case 125:case 59:if(1<(H=(W=(0<_?W.replace(c,""):W).trim()).length))switch(0===G&&(p=W.charCodeAt(0),45===p||96<p&&123>p)&&(H=(W=W.replace(" ",":")).length),0<F&&void 0!==(S=a(1,W,s,n,k,O,L.length,d,f,d))&&0===(H=(W=S.trim()).length)&&(W="\0\0"),p=W.charCodeAt(0),g=W.charCodeAt(1),p){case 0:break;case 64:if(105===g||99===g){V+=W+u.charAt(M);break}default:58!==W.charCodeAt(H-1)&&(L+=r(W,p,g,W.charCodeAt(2)))}z=_=G=p=0,W="",g=u.charCodeAt(++M)}}switch(g){case 13:case 10:47===C?C=0:0===1+p&&107!==d&&0<W.length&&(_=1,W+="\0"),0<F*T&&a(0,W,s,n,k,O,L.length,d,f,d),O=1,k++;break;case 59:case 125:if(0===C+P+x+R){O++;break}default:switch(O++,b=u.charAt(M),g){case 9:case 32:if(0===P+R+C)switch(j){case 44:case 58:case 9:case 32:b="";break;default:32!==g&&(b=" ")}break;case 0:b="\\0";break;case 12:b="\\f";break;case 11:b="\\v";break;case 38:0===P+C+R&&(_=z=1,b="\f"+b);break;case 108:if(0===P+C+R+E&&0<G)switch(M-G){case 2:112===j&&58===u.charCodeAt(M-3)&&(E=j);case 8:111===B&&(E=B)}break;case 58:0===P+C+R&&(G=M);break;case 44:0===C+x+P+R&&(_=1,b+="\r");break;case 34:case 39:0===C&&(P=P===g?0:0===P?g:P);break;case 91:0===P+C+x&&R++;break;case 93:0===P+C+x&&R--;break;case 41:0===P+C+R&&x--;break;case 40:if(0===P+C+R){if(0===p)switch(2*j+3*B){case 533:break;default:p=1}x++}break;case 64:0===C+x+P+R+G+m&&(m=1);break;case 42:case 47:if(!(0<P+R+x))switch(C){case 0:switch(2*g+3*u.charCodeAt(M+1)){case 235:C=47;break;case 220:H=M,C=42}break;case 42:47===g&&42===j&&H+2!==M&&(33===u.charCodeAt(H+2)&&(L+=u.substring(H,M+1)),b="",C=0)}}0===C&&(W+=b)}B=j,j=g,M++}if(0<(H=L.length)){if(_=s,0<F&&(void 0!==(S=a(2,L,_,n,k,O,H,d,f,d))&&0===(L=S).length))return V+L+$;if(L=_.join(",")+"{"+L+"}",0!=I*E){switch(2!==I||o(L,2)||(E=0),E){case 111:L=L.replace(y,":-moz-$1")+L;break;case 112:L=L.replace(v,"::-webkit-input-$1")+L.replace(v,"::-moz-$1")+L.replace(v,":-ms-input-$1")+L}E=0}}return V+L+$}(A,s,n,0,0);return 0<F&&(void 0!==(u=a(-2,d,s,s,k,O,d.length,0,0,0))&&(d=u)),"",E=0,O=k=1,d}var l=/^\0+/g,c=/[\0\r\f]/g,d=/: */g,f=/zoo|gra/,p=/([,: ])(transform)/g,g=/,\r+?/g,m=/([\t\r\n ])*\f?&/g,h=/@(k\w+)\s*(\S*)\s*/,v=/::(place)/g,y=/:(read-only)/g,b=/[svh]\w+-[tblr]{2}/,w=/\(\s*(.*)\s*\)/g,S=/([\s\S]*?);/g,R=/-self|flex-/g,C=/[^]*?(:[rp][el]a[\w-]+)[^]*/,x=/stretch|:\s*\w+\-(?:conte|avail)/,P=/([^-])(image-set\()/,O=1,k=1,E=0,I=1,A=[],j=[],F=0,B=null,T=0;return u.use=function e(t){switch(t){case void 0:case null:F=j.length=0;break;default:if("function"==typeof t)j[F++]=t;else if("object"==typeof t)for(var n=0,r=t.length;n<r;++n)e(t[n]);else T=0|!!t}return e},u.set=s,void 0!==e&&s(e),u}},function(e,t,n){"use strict";t.a={animationIterationCount:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1}},,,function(e,t){var n,r,o=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function s(e){if(n===setTimeout)return setTimeout(e,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:i}catch(e){n=i}try{r="function"==typeof clearTimeout?clearTimeout:a}catch(e){r=a}}();var u,l=[],c=!1,d=-1;function f(){c&&u&&(c=!1,u.length?l=u.concat(l):d=-1,l.length&&p())}function p(){if(!c){var e=s(f);c=!0;for(var t=l.length;t;){for(u=l,l=[];++d<t;)u&&u[d].run();d=-1,t=l.length}u=null,c=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===a||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function g(e,t){this.fun=e,this.array=t}function m(){}o.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];l.push(new g(e,t)),1!==l.length||c||s(p)},g.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=m,o.addListener=m,o.once=m,o.off=m,o.removeListener=m,o.removeAllListeners=m,o.emit=m,o.prependListener=m,o.prependOnceListener=m,o.listeners=function(e){return[]},o.binding=function(e){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(e){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(e,t,n){"use strict";
|
2 |
/** @license React v16.13.1
|
3 |
* react-is.production.min.js
|
4 |
*
|
1 |
+
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=42)}([function(e,t){e.exports=window.wp.element},function(e,t){e.exports=window.React},function(e,t){e.exports=window.wp.components},function(e,t){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},e.exports.default=e.exports,e.exports.__esModule=!0},,function(e,t){e.exports=window.regeneratorRuntime},function(e,t){e.exports=window.wp.data},function(e,t,n){var r=n(15),o=n(16),i=n(13),a=n(17);e.exports=function(e,t){return r(e)||o(e,t)||i(e,t)||a()},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=window.wp.i18n},function(e,t){function n(){return e.exports=n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},e.exports.default=e.exports,e.exports.__esModule=!0,n.apply(this,arguments)}e.exports=n,e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=window.wp.apiFetch},function(e,t){e.exports=window.wp.blockEditor},function(e,t,n){e.exports=n(23)},function(e,t,n){var r=n(14);e.exports=function(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(e){if(Array.isArray(e))return e},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{r||null==s.return||s.return()}finally{if(o)throw i}}return n}},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=window.wp.blocks},function(e,t,n){"use strict";var r=n(3),o=n.n(r),i=n(5),a=n.n(i),s=n(10),u=n.n(s);function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?l(Object(n),!0).forEach((function(t){o()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var d={forms:!1,fields:{},submissions:{}},f={setForms:function(e){return{type:"SET_FORMS",forms:e}},setFields:function(e,t){return{type:"SET_FIELDS",formID:e,fields:t}},setSubmissions:function(e,t,n){return{type:"SET_SUBMISSIONS",formID:e,submissions:t,page:n}},fetchFromAPI:function(e,t){return{type:"FETCH_FROM_API",path:e,data:t}}},p={getForms:function(e){return e.forms},getForm:function(e,t){var n=p.getForms(e);return Object.values(n).find((function(e){return e.formID==t}))},getFormFields:function(e,t){return e.fields[t]},getFormSubmissions:function(e,t){return e.submissions[t]},getFormSubmissionsPage:function(e,t,n){var r=e.submissions;return void 0!==r[t]&&r[t][n]}};t.a={reducer:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:d,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"SET_FORMS":return c(c({},e),{},{forms:t.forms});case"SET_FIELDS":return c(c({},e),{},{fields:c(c({},e.fields),{},o()({},t.formID,t.fields))});case"SET_SUBMISSIONS":return c(c({},e),{},{submissions:c(c({},e.submissions),{},o()({},t.formID,c(c({},e.submissions[t.formID]),{},o()({},t.page,t.submissions))))})}return e},actions:f,selectors:p,controls:{FETCH_FROM_API:function(e){return u()({path:e.path})}},resolvers:{getForms:a.a.mark((function e(){var t;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"/ninja-forms-views/forms",e.next=3,f.fetchFromAPI("/ninja-forms-views/forms");case 3:return t=e.sent,e.abrupt("return",f.setForms(t));case 5:case"end":return e.stop()}}),e)})),getFormFields:a.a.mark((function e(t){var n,r;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="/ninja-forms-views/forms/"+t+"/fields",e.next=3,f.fetchFromAPI(n);case 3:return r=e.sent,e.abrupt("return",f.setFields(t,r));case 5:case"end":return e.stop()}}),e)})),getFormSubmissions:a.a.mark((function e(t){var n,r;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="/ninja-forms-views/forms/"+t+"/submissions?page=1&perPage=10",e.next=3,f.fetchFromAPI(n);case 3:return r=e.sent,e.abrupt("return",f.setSubmissions(t,r,1));case 5:case"end":return e.stop()}}),e)})),getFormSubmissionsPage:a.a.mark((function e(t,n){var r,o;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r="/ninja-forms-views/forms/"+t+"/submissions?page="+n+"&perPage=10",e.next=3,f.fetchFromAPI(r);case 3:return o=e.sent,e.abrupt("return",f.setSubmissions(t,o,n));case 5:case"end":return e.stop()}}),e)}))}}},function(e,t,n){"use strict";n.d(t,"a",(function(){return s}));var r=n(3),o=n.n(r);function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){o()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e){function t(e,n){if(0!==(e.path||"").indexOf("/ninja-forms-views/"))return n(e);var r=e.headers,o=void 0===r?{}:r;for(var i in o)if("x-ninjaformsviews-auth"===i.toLowerCase())return n(e);return n(a(a({},e),{},{headers:a(a({},o),{},{"X-NinjaFormsViews-Auth":t.token})}))}return t.token=e,t}},function(e,t,n){"use strict";var r=n(9),o=n.n(r),i=n(7),a=n.n(i),s=n(0),u=n(1),l=n.n(u),c=n(8),d=n(6),f=n(12);t.a=function(e){var t=e.formID,n=e.selectedFields,r=e.fields,o=e.submissions,i=r.filter((function(e){return-1!==n.indexOf(e.id)})).map((function(e){return{Header:e.label,accessor:e.id.toString()}})),u=l.a.useState(0),c=a()(u,2),f=c[0],g=c[1],m=l.a.useState(!1),h=a()(m,2),v=h[0],y=h[1];o[v]&&(o[v].length&&g(v),y(!1)),o[f+1]||Object(d.select)("ninja-forms-views").getFormSubmissionsPage(t,f+2);var b=o[o.length-1]&&o[o.length-1].length,w=o.flat();return Object(s.createElement)(p,{columns:i,data:w,initialPageIndex:f,loadMore:function(e){y(e),Object(d.select)("ninja-forms-views").getFormSubmissionsPage(t,e+1)},more:b,loading:v})};function p(e){var t=e.columns,n=e.data,r=e.initialPageIndex,i=e.loadMore,a=e.more,u=e.loading,l=Object(f.useTable)({columns:t,data:n,initialState:{pageIndex:r,pageSize:10}},f.usePagination),c=l.state.pageIndex,d=l.getTableProps,p=l.getTableBodyProps,v=l.canNextPage,y=l.canPreviousPage,b=l.page;return Object(s.createElement)(s.Fragment,null,Object(s.createElement)("table",d(),Object(s.createElement)("thead",null,Object(s.createElement)(g,l)),Object(s.createElement)("tbody",p(),Object(s.createElement)(m,o()({},l,{dataset:b})))),Object(s.createElement)(h,o()({},l,{loadMore:function(){return i(c+1)},more:a,loading:u,canNextPage:v,canPreviousPage:y})))}function g(e){var t=e.headerGroups;return t.length<=0?Object(s.createElement)("tr",null,Object(s.createElement)("th",null,Object(c.__)("No columns selected. Please choose fields using the block settings ->","ninja-forms"))):t.map((function(e){return Object(s.createElement)("tr",e.getHeaderGroupProps(),e.headers.map((function(e){return Object(s.createElement)("th",e.getHeaderProps(),e.render("Header"))})))}))}function m(e){var t=e.dataset,n=e.prepareRow;return t.map((function(e,t){return n(e),Object(s.createElement)("tr",e.getRowProps(),e.cells.map((function(e){return Object(s.createElement)("td",o()({},e.getCellProps(),{"data-header":e.column.Header}),e.render("Cell"))})))}))}function h(e){var t,n=e.previousPage,r=e.nextPage,o=e.canPreviousPage,i=e.canNextPage,a=e.loadMore,u=e.more,l=e.loading,c=function(){a(),r()};return i?t=Object(s.createElement)("button",{onClick:c},">"):u&&(t=Object(s.createElement)("button",{onClick:c},l?"...":">")),Object(s.createElement)("div",{style:{display:"flex",justifyContent:"space-between"}},Object(s.createElement)("div",null,o&&Object(s.createElement)("button",{onClick:function(){return n()}},"<")),i&&Object(s.createElement)("div",null,t))}},function(e,t,n){"use strict";e.exports=n(35)},function(e,t,n){!function(e,t){"use strict";function n(e,t,n,r,o,i,a){try{var s=e[i](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,o)}function r(e){return function(){var t=this,r=arguments;return new Promise((function(o,i){var a=e.apply(t,r);function s(e){n(a,o,i,s,u,"next",e)}function u(e){n(a,o,i,s,u,"throw",e)}s(void 0)}))}}function o(){return(o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function i(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}function a(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t);if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==typeof t?t:String(t)}t=t&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t;var s={init:"init"},u=function(e){var t=e.value;return void 0===t?"":t},l=function(){return t.createElement(t.Fragment,null," ")},c={Cell:u,width:150,minWidth:0,maxWidth:Number.MAX_SAFE_INTEGER};function d(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.reduce((function(e,t){var n=t.style,r=t.className;return e=o({},e,{},i(t,["style","className"])),n&&(e.style=e.style?o({},e.style||{},{},n||{}):n),r&&(e.className=e.className?e.className+" "+r:r),""===e.className&&delete e.className,e}),{})}var f=function(e,t){return void 0===t&&(t={}),function(n){return void 0===n&&(n={}),[].concat(e,[n]).reduce((function(e,r){return function e(t,n,r){return"function"==typeof n?e({},n(t,r)):Array.isArray(n)?d.apply(void 0,[t].concat(n)):d(t,n)}(e,r,o({},t,{userProps:n}))}),{})}},p=function(e,t,n,r){return void 0===n&&(n={}),e.reduce((function(e,t){return t(e,n)}),t)},g=function(e,t,n){return void 0===n&&(n={}),e.forEach((function(e){e(t,n)}))};function m(e,t,n,r){e.findIndex((function(e){return e.pluginName===n})),t.forEach((function(t){e.findIndex((function(e){return e.pluginName===t}))}))}function h(e,t){return"function"==typeof e?e(t):e}function v(e){var n=t.useRef();return n.current=e,t.useCallback((function(){return n.current}),[])}var y="undefined"!=typeof document?t.useLayoutEffect:t.useEffect;function b(e,n){var r=t.useRef(!1);y((function(){r.current&&e(),r.current=!0}),n)}function w(e,t,n){return void 0===n&&(n={}),function(r,i){void 0===i&&(i={});var a="string"==typeof r?t[r]:r;if(void 0===a)throw console.info(t),new Error("Renderer Error ☝️");return S(a,o({},e,{column:t},n,{},i))}}function S(e,n){return function(e){return"function"==typeof e&&(t=Object.getPrototypeOf(e)).prototype&&t.prototype.isReactComponent;var t}(r=e)||"function"==typeof r||function(e){return"object"==typeof e&&"symbol"==typeof e.$$typeof&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}(r)?t.createElement(e,n):e;var r}function R(e,t,n){return void 0===n&&(n=0),e.map((function(e){return x(e=o({},e,{parent:t,depth:n})),e.columns&&(e.columns=R(e.columns,e,n+1)),e}))}function C(e){return A(e,"columns")}function x(e){var t=e.id,n=e.accessor,r=e.Header;if("string"==typeof n){t=t||n;var o=n.split(".");n=function(e){return function(e,t,n){if(!t)return e;var r,o="function"==typeof t?t:JSON.stringify(t),i=k.get(o)||function(){var e=function(e){return function e(t,n){if(void 0===n&&(n=[]),Array.isArray(t))for(var r=0;r<t.length;r+=1)e(t[r],n);else n.push(t);return n}(e).map((function(e){return String(e).replace(".","_")})).join(".").replace(_,".").replace(M,"").split(".")}(t);return k.set(o,e),e}();try{r=i.reduce((function(e,t){return e[t]}),e)}catch(e){}return void 0!==r?r:void 0}(e,o)}}if(!t&&"string"==typeof r&&r&&(t=r),!t&&e.columns)throw console.error(e),new Error('A column ID (or unique "Header" value) is required!');if(!t)throw console.error(e),new Error("A column ID (or string accessor) is required!");return Object.assign(e,{id:t,accessor:n}),e}function P(e,t){if(!t)throw new Error;return Object.assign(e,o({Header:l,Footer:l},c,{},t,{},e)),Object.assign(e,{originalWidth:e.width}),e}function O(e,t,n){void 0===n&&(n=function(){return{}});for(var r=[],i=e,a=0,s=function(){return a++},u=function(){var e={headers:[]},a=[],u=i.some((function(e){return e.parent}));i.forEach((function(r){var i,l=[].concat(a).reverse()[0];u&&(i=r.parent?o({},r.parent,{originalId:r.parent.id,id:r.parent.id+"_"+s(),headers:[r]},n(r)):P(o({originalId:r.id+"_placeholder",id:r.id+"_placeholder_"+s(),placeholderOf:r,headers:[r]},n(r)),t),l&&l.originalId===i.originalId?l.headers.push(r):a.push(i)),e.headers.push(r)})),r.push(e),i=a};i.length;)u();return r.reverse()}var k=new Map;function E(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];for(var r=0;r<t.length;r+=1)if(void 0!==t[r])return t[r]}function I(e){if("function"==typeof e)return e}function A(e,t){var n=[];return function e(r){r.forEach((function(r){r[t]?e(r[t]):n.push(r)}))}(e),n}function j(e,t){var n=t.manualExpandedKey,r=t.expanded,o=t.expandSubRows,i=void 0===o||o,a=[];return e.forEach((function(e){return function e(t,o){void 0===o&&(o=!0),t.isExpanded=t.original&&t.original[n]||r[t.id],t.canExpand=t.subRows&&!!t.subRows.length,o&&a.push(t),t.subRows&&t.subRows.length&&t.isExpanded&&t.subRows.forEach((function(t){return e(t,i)}))}(e)})),a}function F(e,t,n){return I(e)||t[e]||n[e]||n.text}function B(e,t,n){return e?e(t,n):void 0===t}function T(){throw new Error("React-Table: You have not called prepareRow(row) one or more rows you are attempting to render.")}var G=null,_=/\[/g,M=/\]/g,z=function(e){return o({role:"table"},e)},H=function(e){return o({role:"rowgroup"},e)},D=function(e,t){var n=t.column;return o({key:"header_"+n.id,colSpan:n.totalVisibleHeaderCount,role:"columnheader"},e)},N=function(e,t){var n=t.column;return o({key:"footer_"+n.id,colSpan:n.totalVisibleHeaderCount},e)},W=function(e,t){return o({key:"headerGroup_"+t.index,role:"row"},e)},L=function(e,t){return o({key:"footerGroup_"+t.index},e)},$=function(e,t){return o({key:"row_"+t.row.id,role:"row"},e)},V=function(e,t){var n=t.cell;return o({key:"cell_"+n.row.id+"_"+n.column.id,role:"cell"},e)};function X(){return{useOptions:[],stateReducers:[],useControlledState:[],columns:[],columnsDeps:[],allColumns:[],allColumnsDeps:[],accessValue:[],materializedColumns:[],materializedColumnsDeps:[],useInstanceAfterData:[],visibleColumns:[],visibleColumnsDeps:[],headerGroups:[],headerGroupsDeps:[],useInstanceBeforeDimensions:[],useInstance:[],prepareRow:[],getTableProps:[z],getTableBodyProps:[H],getHeaderGroupProps:[W],getFooterGroupProps:[L],getHeaderProps:[D],getFooterProps:[N],getRowProps:[$],getCellProps:[V],useFinalInstance:[]}}s.resetHiddenColumns="resetHiddenColumns",s.toggleHideColumn="toggleHideColumn",s.setHiddenColumns="setHiddenColumns",s.toggleHideAllColumns="toggleHideAllColumns";var q=function(e){e.getToggleHiddenProps=[U],e.getToggleHideAllColumnsProps=[Y],e.stateReducers.push(K),e.useInstanceBeforeDimensions.push(Z),e.headerGroupsDeps.push((function(e,t){var n=t.instance;return[].concat(e,[n.state.hiddenColumns])})),e.useInstance.push(J)};q.pluginName="useColumnVisibility";var U=function(e,t){var n=t.column;return[e,{onChange:function(e){n.toggleHidden(!e.target.checked)},style:{cursor:"pointer"},checked:n.isVisible,title:"Toggle Column Visible"}]},Y=function(e,t){var n=t.instance;return[e,{onChange:function(e){n.toggleHideAllColumns(!e.target.checked)},style:{cursor:"pointer"},checked:!n.allColumnsHidden&&!n.state.hiddenColumns.length,title:"Toggle All Columns Hidden",indeterminate:!n.allColumnsHidden&&n.state.hiddenColumns.length}]};function K(e,t,n,r){if(t.type===s.init)return o({hiddenColumns:[]},e);if(t.type===s.resetHiddenColumns)return o({},e,{hiddenColumns:r.initialState.hiddenColumns||[]});if(t.type===s.toggleHideColumn){var i=(void 0!==t.value?t.value:!e.hiddenColumns.includes(t.columnId))?[].concat(e.hiddenColumns,[t.columnId]):e.hiddenColumns.filter((function(e){return e!==t.columnId}));return o({},e,{hiddenColumns:i})}return t.type===s.setHiddenColumns?o({},e,{hiddenColumns:h(t.value,e.hiddenColumns)}):t.type===s.toggleHideAllColumns?o({},e,{hiddenColumns:(void 0!==t.value?t.value:!e.hiddenColumns.length)?r.allColumns.map((function(e){return e.id})):[]}):void 0}function Z(e){var n=e.headers,r=e.state.hiddenColumns;t.useRef(!1).current;var o=0;n.forEach((function(e){return o+=function e(t,n){t.isVisible=n&&!r.includes(t.id);var o=0;return t.headers&&t.headers.length?t.headers.forEach((function(n){return o+=e(n,t.isVisible)})):o=t.isVisible?1:0,t.totalVisibleHeaderCount=o,o}(e,!0)}))}function J(e){var n=e.columns,r=e.flatHeaders,o=e.dispatch,i=e.allColumns,a=e.getHooks,u=e.state.hiddenColumns,l=e.autoResetHiddenColumns,c=void 0===l||l,d=v(e),p=i.length===u.length,g=t.useCallback((function(e,t){return o({type:s.toggleHideColumn,columnId:e,value:t})}),[o]),m=t.useCallback((function(e){return o({type:s.setHiddenColumns,value:e})}),[o]),h=t.useCallback((function(e){return o({type:s.toggleHideAllColumns,value:e})}),[o]),y=f(a().getToggleHideAllColumnsProps,{instance:d()});r.forEach((function(e){e.toggleHidden=function(t){o({type:s.toggleHideColumn,columnId:e.id,value:t})},e.getToggleHiddenProps=f(a().getToggleHiddenProps,{instance:d(),column:e})}));var w=v(c);b((function(){w()&&o({type:s.resetHiddenColumns})}),[o,n]),Object.assign(e,{allColumnsHidden:p,toggleHideColumn:g,setHiddenColumns:m,toggleHideAllColumns:h,getToggleHideAllColumnsProps:y})}var Q={},ee={},te=function(e,t,n){return e},ne=function(e,t){return e.subRows||[]},re=function(e,t,n){return""+(n?[n.id,t].join("."):t)},oe=function(e){return e};function ie(e){var t=e.initialState,n=void 0===t?Q:t,r=e.defaultColumn,a=void 0===r?ee:r,s=e.getSubRows,u=void 0===s?ne:s,l=e.getRowId,c=void 0===l?re:l,d=e.stateReducer,f=void 0===d?te:d,p=e.useControlledState,g=void 0===p?oe:p;return o({},i(e,["initialState","defaultColumn","getSubRows","getRowId","stateReducer","useControlledState"]),{initialState:n,defaultColumn:a,getSubRows:u,getRowId:c,stateReducer:f,useControlledState:g})}function ae(e,t){void 0===t&&(t=0);var n=0,r=0,o=0,i=0;return e.forEach((function(e){var a=e.headers;if(e.totalLeft=t,a&&a.length){var s=ae(a,t),u=s[0],l=s[1],c=s[2],d=s[3];e.totalMinWidth=u,e.totalWidth=l,e.totalMaxWidth=c,e.totalFlexWidth=d}else e.totalMinWidth=e.minWidth,e.totalWidth=Math.min(Math.max(e.minWidth,e.width),e.maxWidth),e.totalMaxWidth=e.maxWidth,e.totalFlexWidth=e.canResize?e.totalWidth:0;e.isVisible&&(t+=e.totalWidth,n+=e.totalMinWidth,r+=e.totalWidth,o+=e.totalMaxWidth,i+=e.totalFlexWidth)})),[n,r,o,i]}function se(e){var t=e.data,n=e.rows,r=e.flatRows,o=e.rowsById,i=e.column,a=e.getRowId,s=e.getSubRows,u=e.accessValueHooks,l=e.getInstance;t.forEach((function(e,c){return function e(n,c,d,f,g){void 0===d&&(d=0);var m=n,h=a(n,c,f),v=o[h];if(v)v.subRows&&v.originalSubRows.forEach((function(t,n){return e(t,n,d+1,v)}));else if((v={id:h,original:m,index:c,depth:d,cells:[{}]}).cells.map=T,v.cells.filter=T,v.cells.forEach=T,v.cells[0].getCellProps=T,v.values={},g.push(v),r.push(v),o[h]=v,v.originalSubRows=s(n,c),v.originalSubRows){var y=[];v.originalSubRows.forEach((function(t,n){return e(t,n,d+1,v,y)})),v.subRows=y}i.accessor&&(v.values[i.id]=i.accessor(n,c,v,g,t)),v.values[i.id]=p(u,v.values[i.id],{row:v,column:i,instance:l()})}(e,c,0,void 0,n)}))}s.resetExpanded="resetExpanded",s.toggleRowExpanded="toggleRowExpanded",s.toggleAllRowsExpanded="toggleAllRowsExpanded";var ue=function(e){e.getToggleAllRowsExpandedProps=[le],e.getToggleRowExpandedProps=[ce],e.stateReducers.push(de),e.useInstance.push(fe),e.prepareRow.push(pe)};ue.pluginName="useExpanded";var le=function(e,t){var n=t.instance;return[e,{onClick:function(e){n.toggleAllRowsExpanded()},style:{cursor:"pointer"},title:"Toggle All Rows Expanded"}]},ce=function(e,t){var n=t.row;return[e,{onClick:function(){n.toggleRowExpanded()},style:{cursor:"pointer"},title:"Toggle Row Expanded"}]};function de(e,t,n,r){if(t.type===s.init)return o({expanded:{}},e);if(t.type===s.resetExpanded)return o({},e,{expanded:r.initialState.expanded||{}});if(t.type===s.toggleAllRowsExpanded){var u=t.value,l=r.isAllRowsExpanded,c=r.rowsById;if(void 0!==u?u:!l){var d={};return Object.keys(c).forEach((function(e){d[e]=!0})),o({},e,{expanded:d})}return o({},e,{expanded:{}})}if(t.type===s.toggleRowExpanded){var f,p=t.id,g=t.value,m=e.expanded[p],h=void 0!==g?g:!m;if(!m&&h)return o({},e,{expanded:o({},e.expanded,(f={},f[p]=!0,f))});if(m&&!h){var v=e.expanded;return v[p],o({},e,{expanded:i(v,[p].map(a))})}return e}}function fe(e){var n=e.data,r=e.rows,o=e.rowsById,i=e.manualExpandedKey,a=void 0===i?"expanded":i,u=e.paginateExpandedRows,l=void 0===u||u,c=e.expandSubRows,d=void 0===c||c,p=e.autoResetExpanded,g=void 0===p||p,h=e.getHooks,y=e.plugins,w=e.state.expanded,S=e.dispatch;m(y,["useSortBy","useGroupBy","usePivotColumns","useGlobalFilter"],"useExpanded");var R=v(g),C=Boolean(Object.keys(o).length&&Object.keys(w).length);C&&Object.keys(o).some((function(e){return!w[e]}))&&(C=!1),b((function(){R()&&S({type:s.resetExpanded})}),[S,n]);var x=t.useCallback((function(e,t){S({type:s.toggleRowExpanded,id:e,value:t})}),[S]),P=t.useCallback((function(e){return S({type:s.toggleAllRowsExpanded,value:e})}),[S]),O=t.useMemo((function(){return l?j(r,{manualExpandedKey:a,expanded:w,expandSubRows:d}):r}),[l,r,a,w,d]),k=t.useMemo((function(){return function(e){var t=0;return Object.keys(e).forEach((function(e){var n=e.split(".");t=Math.max(t,n.length)})),t}(w)}),[w]),E=v(e),I=f(h().getToggleAllRowsExpandedProps,{instance:E()});Object.assign(e,{preExpandedRows:r,expandedRows:O,rows:O,expandedDepth:k,isAllRowsExpanded:C,toggleRowExpanded:x,toggleAllRowsExpanded:P,getToggleAllRowsExpandedProps:I})}function pe(e,t){var n=t.instance.getHooks,r=t.instance;e.toggleRowExpanded=function(t){return r.toggleRowExpanded(e.id,t)},e.getToggleRowExpandedProps=f(n().getToggleRowExpandedProps,{instance:r,row:e})}var ge=function(e,t,n){return e.filter((function(e){return t.some((function(t){var r=e.values[t];return String(r).toLowerCase().includes(String(n).toLowerCase())}))}))};ge.autoRemove=function(e){return!e};var me=function(e,t,n){return e.filter((function(e){return t.some((function(t){var r=e.values[t];return void 0===r||String(r).toLowerCase()===String(n).toLowerCase()}))}))};me.autoRemove=function(e){return!e};var he=function(e,t,n){return e.filter((function(e){return t.some((function(t){var r=e.values[t];return void 0===r||String(r)===String(n)}))}))};he.autoRemove=function(e){return!e};var ve=function(e,t,n){return e.filter((function(e){return t.some((function(t){return e.values[t].includes(n)}))}))};ve.autoRemove=function(e){return!e||!e.length};var ye=function(e,t,n){return e.filter((function(e){return t.some((function(t){var r=e.values[t];return r&&r.length&&n.every((function(e){return r.includes(e)}))}))}))};ye.autoRemove=function(e){return!e||!e.length};var be=function(e,t,n){return e.filter((function(e){return t.some((function(t){var r=e.values[t];return r&&r.length&&n.some((function(e){return r.includes(e)}))}))}))};be.autoRemove=function(e){return!e||!e.length};var we=function(e,t,n){return e.filter((function(e){return t.some((function(t){var r=e.values[t];return n.includes(r)}))}))};we.autoRemove=function(e){return!e||!e.length};var Se=function(e,t,n){return e.filter((function(e){return t.some((function(t){return e.values[t]===n}))}))};Se.autoRemove=function(e){return void 0===e};var Re=function(e,t,n){return e.filter((function(e){return t.some((function(t){return e.values[t]==n}))}))};Re.autoRemove=function(e){return null==e};var Ce=function(e,t,n){var r=n||[],o=r[0],i=r[1];if((o="number"==typeof o?o:-1/0)>(i="number"==typeof i?i:1/0)){var a=o;o=i,i=a}return e.filter((function(e){return t.some((function(t){var n=e.values[t];return n>=o&&n<=i}))}))};Ce.autoRemove=function(e){return!e||"number"!=typeof e[0]&&"number"!=typeof e[1]};var xe=Object.freeze({__proto__:null,text:ge,exactText:me,exactTextCase:he,includes:ve,includesAll:ye,includesSome:be,includesValue:we,exact:Se,equals:Re,between:Ce});s.resetFilters="resetFilters",s.setFilter="setFilter",s.setAllFilters="setAllFilters";var Pe=function(e){e.stateReducers.push(Oe),e.useInstance.push(ke)};function Oe(e,t,n,r){if(t.type===s.init)return o({filters:[]},e);if(t.type===s.resetFilters)return o({},e,{filters:r.initialState.filters||[]});if(t.type===s.setFilter){var i=t.columnId,a=t.filterValue,u=r.allColumns,l=r.filterTypes,c=u.find((function(e){return e.id===i}));if(!c)throw new Error("React-Table: Could not find a column with id: "+i);var d=F(c.filter,l||{},xe),f=e.filters.find((function(e){return e.id===i})),p=h(a,f&&f.value);return B(d.autoRemove,p,c)?o({},e,{filters:e.filters.filter((function(e){return e.id!==i}))}):o({},e,f?{filters:e.filters.map((function(e){return e.id===i?{id:i,value:p}:e}))}:{filters:[].concat(e.filters,[{id:i,value:p}])})}if(t.type===s.setAllFilters){var g=t.filters,m=r.allColumns,v=r.filterTypes;return o({},e,{filters:h(g,e.filters).filter((function(e){var t=m.find((function(t){return t.id===e.id}));return!B(F(t.filter,v||{},xe).autoRemove,e.value,t)}))})}}function ke(e){var n=e.data,r=e.rows,o=e.flatRows,i=e.rowsById,a=e.allColumns,u=e.filterTypes,l=e.manualFilters,c=e.defaultCanFilter,d=void 0!==c&&c,f=e.disableFilters,p=e.state.filters,g=e.dispatch,m=e.autoResetFilters,h=void 0===m||m,y=t.useCallback((function(e,t){g({type:s.setFilter,columnId:e,filterValue:t})}),[g]),w=t.useCallback((function(e){g({type:s.setAllFilters,filters:e})}),[g]);a.forEach((function(e){var t=e.id,n=e.accessor,r=e.defaultCanFilter,o=e.disableFilters;e.canFilter=n?E(!0!==o&&void 0,!0!==f&&void 0,!0):E(r,d,!1),e.setFilter=function(t){return y(e.id,t)};var i=p.find((function(e){return e.id===t}));e.filterValue=i&&i.value}));var S=t.useMemo((function(){if(l||!p.length)return[r,o,i];var e=[],t={};return[function n(r,o){void 0===o&&(o=0);var i=r;return(i=p.reduce((function(e,t){var n=t.id,r=t.value,i=a.find((function(e){return e.id===n}));if(!i)return e;0===o&&(i.preFilteredRows=e);var s=F(i.filter,u||{},xe);return s?(i.filteredRows=s(e,[n],r),i.filteredRows):(console.warn("Could not find a valid 'column.filter' for column with the ID: "+i.id+"."),e)}),r)).forEach((function(r){e.push(r),t[r.id]=r,r.subRows&&(r.subRows=r.subRows&&r.subRows.length>0?n(r.subRows,o+1):r.subRows)})),i}(r),e,t]}),[l,p,r,o,i,a,u]),R=S[0],C=S[1],x=S[2];t.useMemo((function(){a.filter((function(e){return!p.find((function(t){return t.id===e.id}))})).forEach((function(e){e.preFilteredRows=R,e.filteredRows=R}))}),[R,p,a]);var P=v(h);b((function(){P()&&g({type:s.resetFilters})}),[g,l?null:n]),Object.assign(e,{preFilteredRows:r,preFilteredFlatRows:o,preFilteredRowsById:i,filteredRows:R,filteredFlatRows:C,filteredRowsById:x,rows:R,flatRows:C,rowsById:x,setFilter:y,setAllFilters:w})}Pe.pluginName="useFilters",s.resetGlobalFilter="resetGlobalFilter",s.setGlobalFilter="setGlobalFilter";var Ee=function(e){e.stateReducers.push(Ie),e.useInstance.push(Ae)};function Ie(e,t,n,r){if(t.type===s.resetGlobalFilter)return o({},e,{globalFilter:r.initialState.globalFilter||void 0});if(t.type===s.setGlobalFilter){var a=t.filterValue,u=r.userFilterTypes,l=F(r.globalFilter,u||{},xe),c=h(a,e.globalFilter);return B(l.autoRemove,c)?(e.globalFilter,i(e,["globalFilter"])):o({},e,{globalFilter:c})}}function Ae(e){var n=e.data,r=e.rows,o=e.flatRows,i=e.rowsById,a=e.allColumns,u=e.filterTypes,l=e.globalFilter,c=e.manualGlobalFilter,d=e.state.globalFilter,f=e.dispatch,p=e.autoResetGlobalFilter,g=void 0===p||p,m=e.disableGlobalFilter,h=t.useCallback((function(e){f({type:s.setGlobalFilter,filterValue:e})}),[f]),y=t.useMemo((function(){if(c||void 0===d)return[r,o,i];var e=[],t={},n=F(l,u||{},xe);if(!n)return console.warn("Could not find a valid 'globalFilter' option."),r;a.forEach((function(e){var t=e.disableGlobalFilter;e.canFilter=E(!0!==t&&void 0,!0!==m&&void 0,!0)}));var s=a.filter((function(e){return!0===e.canFilter}));return[function r(o){return(o=n(o,s.map((function(e){return e.id})),d)).forEach((function(n){e.push(n),t[n.id]=n,n.subRows=n.subRows&&n.subRows.length?r(n.subRows):n.subRows})),o}(r),e,t]}),[c,d,l,u,a,r,o,i,m]),w=y[0],S=y[1],R=y[2],C=v(g);b((function(){C()&&f({type:s.resetGlobalFilter})}),[f,c?null:n]),Object.assign(e,{preGlobalFilteredRows:r,preGlobalFilteredFlatRows:o,preGlobalFilteredRowsById:i,globalFilteredRows:w,globalFilteredFlatRows:S,globalFilteredRowsById:R,rows:w,flatRows:S,rowsById:R,setGlobalFilter:h,disableGlobalFilter:m})}function je(e,t){return t.reduce((function(e,t){return e+("number"==typeof t?t:0)}),0)}Ee.pluginName="useGlobalFilter";var Fe=Object.freeze({__proto__:null,sum:je,min:function(e){var t=e[0]||0;return e.forEach((function(e){"number"==typeof e&&(t=Math.min(t,e))})),t},max:function(e){var t=e[0]||0;return e.forEach((function(e){"number"==typeof e&&(t=Math.max(t,e))})),t},minMax:function(e){var t=e[0]||0,n=e[0]||0;return e.forEach((function(e){"number"==typeof e&&(t=Math.min(t,e),n=Math.max(n,e))})),t+".."+n},average:function(e){return je(0,e)/e.length},median:function(e){if(!e.length)return null;var t=Math.floor(e.length/2),n=[].concat(e).sort((function(e,t){return e-t}));return e.length%2!=0?n[t]:(n[t-1]+n[t])/2},unique:function(e){return Array.from(new Set(e).values())},uniqueCount:function(e){return new Set(e).size},count:function(e){return e.length}}),Be=[],Te={};s.resetGroupBy="resetGroupBy",s.setGroupBy="setGroupBy",s.toggleGroupBy="toggleGroupBy";var Ge=function(e){e.getGroupByToggleProps=[_e],e.stateReducers.push(Me),e.visibleColumnsDeps.push((function(e,t){var n=t.instance;return[].concat(e,[n.state.groupBy])})),e.visibleColumns.push(ze),e.useInstance.push(De),e.prepareRow.push(Ne)};Ge.pluginName="useGroupBy";var _e=function(e,t){var n=t.header;return[e,{onClick:n.canGroupBy?function(e){e.persist(),n.toggleGroupBy()}:void 0,style:{cursor:n.canGroupBy?"pointer":void 0},title:"Toggle GroupBy"}]};function Me(e,t,n,r){if(t.type===s.init)return o({groupBy:[]},e);if(t.type===s.resetGroupBy)return o({},e,{groupBy:r.initialState.groupBy||[]});if(t.type===s.setGroupBy)return o({},e,{groupBy:t.value});if(t.type===s.toggleGroupBy){var i=t.columnId,a=t.value,u=void 0!==a?a:!e.groupBy.includes(i);return o({},e,u?{groupBy:[].concat(e.groupBy,[i])}:{groupBy:e.groupBy.filter((function(e){return e!==i}))})}}function ze(e,t){var n=t.instance.state.groupBy,r=n.map((function(t){return e.find((function(e){return e.id===t}))})).filter(Boolean),o=e.filter((function(e){return!n.includes(e.id)}));return(e=[].concat(r,o)).forEach((function(e){e.isGrouped=n.includes(e.id),e.groupedIndex=n.indexOf(e.id)})),e}var He={};function De(e){var n=e.data,r=e.rows,o=e.flatRows,i=e.rowsById,a=e.allColumns,u=e.flatHeaders,l=e.groupByFn,c=void 0===l?We:l,d=e.manualGroupBy,p=e.aggregations,g=void 0===p?He:p,h=e.plugins,y=e.state.groupBy,w=e.dispatch,S=e.autoResetGroupBy,R=void 0===S||S,C=e.disableGroupBy,x=e.defaultCanGroupBy,P=e.getHooks;m(h,["useColumnOrder","useFilters"],"useGroupBy");var O=v(e);a.forEach((function(t){var n=t.accessor,r=t.defaultGroupBy,o=t.disableGroupBy;t.canGroupBy=n?E(t.canGroupBy,!0!==o&&void 0,!0!==C&&void 0,!0):E(t.canGroupBy,r,x,!1),t.canGroupBy&&(t.toggleGroupBy=function(){return e.toggleGroupBy(t.id)}),t.Aggregated=t.Aggregated||t.Cell}));var k=t.useCallback((function(e,t){w({type:s.toggleGroupBy,columnId:e,value:t})}),[w]),I=t.useCallback((function(e){w({type:s.setGroupBy,value:e})}),[w]);u.forEach((function(e){e.getGroupByToggleProps=f(P().getGroupByToggleProps,{instance:O(),header:e})}));var j=t.useMemo((function(){if(d||!y.length)return[r,o,i,Be,Te,o,i];var e=y.filter((function(e){return a.find((function(t){return t.id===e}))})),t=[],n={},s=[],u={},l=[],f={},p=function r(o,i,d){if(void 0===i&&(i=0),i===e.length)return o;var p=e[i],m=c(o,p);return Object.entries(m).map((function(o,c){var m=o[0],h=o[1],v=p+":"+m,y=r(h,i+1,v=d?d+">"+v:v),b=i?A(h,"leafRows"):h,w=function(t,n,r){var o={};return a.forEach((function(i){if(e.includes(i.id))o[i.id]=n[0]?n[0].values[i.id]:null;else{var a="function"==typeof i.aggregate?i.aggregate:g[i.aggregate]||Fe[i.aggregate];if(a){var s=n.map((function(e){return e.values[i.id]})),u=t.map((function(e){var t=e.values[i.id];if(!r&&i.aggregateValue){var n="function"==typeof i.aggregateValue?i.aggregateValue:g[i.aggregateValue]||Fe[i.aggregateValue];if(!n)throw console.info({column:i}),new Error("React Table: Invalid column.aggregateValue option for column listed above");t=n(t,e,i)}return t}));o[i.id]=a(u,s)}else{if(i.aggregate)throw console.info({column:i}),new Error("React Table: Invalid column.aggregate option for column listed above");o[i.id]=null}}})),o}(b,h,i),S={id:v,isGrouped:!0,groupByID:p,groupByVal:m,values:w,subRows:y,leafRows:b,depth:i,index:c};return y.forEach((function(e){t.push(e),n[e.id]=e,e.isGrouped?(s.push(e),u[e.id]=e):(l.push(e),f[e.id]=e)})),S}))}(r);return p.forEach((function(e){t.push(e),n[e.id]=e,e.isGrouped?(s.push(e),u[e.id]=e):(l.push(e),f[e.id]=e)})),[p,t,n,s,u,l,f]}),[d,y,r,o,i,a,g,c]),F=j[0],B=j[1],T=j[2],G=j[3],_=j[4],M=j[5],z=j[6],H=v(R);b((function(){H()&&w({type:s.resetGroupBy})}),[w,d?null:n]),Object.assign(e,{preGroupedRows:r,preGroupedFlatRow:o,preGroupedRowsById:i,groupedRows:F,groupedFlatRows:B,groupedRowsById:T,onlyGroupedFlatRows:G,onlyGroupedRowsById:_,nonGroupedFlatRows:M,nonGroupedRowsById:z,rows:F,flatRows:B,rowsById:T,toggleGroupBy:k,setGroupBy:I})}function Ne(e){e.allCells.forEach((function(t){var n;t.isGrouped=t.column.isGrouped&&t.column.id===e.groupByID,t.isPlaceholder=!t.isGrouped&&t.column.isGrouped,t.isAggregated=!t.isGrouped&&!t.isPlaceholder&&(null==(n=e.subRows)?void 0:n.length)}))}function We(e,t){return e.reduce((function(e,n,r){var o=""+n.values[t];return e[o]=Array.isArray(e[o])?e[o]:[],e[o].push(n),e}),{})}var Le=/([0-9]+)/gm;function $e(e,t){return e===t?0:e>t?1:-1}function Ve(e,t){return e.values[t]}function Xe(e){return"number"==typeof e?isNaN(e)||e===1/0||e===-1/0?"":String(e):"string"==typeof e?e:""}var qe=Object.freeze({__proto__:null,alphanumeric:function(e,t,n){var r=Ve(e,n),o=Ve(t,n);for(r=Xe(r),o=Xe(o),r=r.split(Le).filter(Boolean),o=o.split(Le).filter(Boolean);r.length&&o.length;){var i=r.shift(),a=o.shift(),s=parseInt(i,10),u=parseInt(a,10),l=[s,u].sort();if(isNaN(l[0])){if(i>a)return 1;if(a>i)return-1}else{if(isNaN(l[1]))return isNaN(s)?-1:1;if(s>u)return 1;if(u>s)return-1}}return r.length-o.length},datetime:function(e,t,n){var r=Ve(e,n),o=Ve(t,n);return $e(r=r.getTime(),o=o.getTime())},basic:function(e,t,n){return $e(Ve(e,n),Ve(t,n))}});s.resetSortBy="resetSortBy",s.setSortBy="setSortBy",s.toggleSortBy="toggleSortBy",s.clearSortBy="clearSortBy",c.sortType="alphanumeric",c.sortDescFirst=!1;var Ue=function(e){e.getSortByToggleProps=[Ye],e.stateReducers.push(Ke),e.useInstance.push(Ze)};Ue.pluginName="useSortBy";var Ye=function(e,t){var n=t.instance,r=t.column,o=n.isMultiSortEvent,i=void 0===o?function(e){return e.shiftKey}:o;return[e,{onClick:r.canSort?function(e){e.persist(),r.toggleSortBy(void 0,!n.disableMultiSort&&i(e))}:void 0,style:{cursor:r.canSort?"pointer":void 0},title:r.canSort?"Toggle SortBy":void 0}]};function Ke(e,t,n,r){if(t.type===s.init)return o({sortBy:[]},e);if(t.type===s.resetSortBy)return o({},e,{sortBy:r.initialState.sortBy||[]});if(t.type===s.clearSortBy)return o({},e,{sortBy:e.sortBy.filter((function(e){return e.id!==t.columnId}))});if(t.type===s.setSortBy)return o({},e,{sortBy:t.sortBy});if(t.type===s.toggleSortBy){var i,a=t.columnId,u=t.desc,l=t.multi,c=r.allColumns,d=r.disableMultiSort,f=r.disableSortRemove,p=r.disableMultiRemove,g=r.maxMultiSortColCount,m=void 0===g?Number.MAX_SAFE_INTEGER:g,h=e.sortBy,v=c.find((function(e){return e.id===a})).sortDescFirst,y=h.find((function(e){return e.id===a})),b=h.findIndex((function(e){return e.id===a})),w=null!=u,S=[];return"toggle"!=(i=!d&&l?y?"toggle":"add":b!==h.length-1||1!==h.length?"replace":y?"toggle":"replace")||f||w||l&&p||!(y&&y.desc&&!v||!y.desc&&v)||(i="remove"),"replace"===i?S=[{id:a,desc:w?u:v}]:"add"===i?(S=[].concat(h,[{id:a,desc:w?u:v}])).splice(0,S.length-m):"toggle"===i?S=h.map((function(e){return e.id===a?o({},e,{desc:w?u:!y.desc}):e})):"remove"===i&&(S=h.filter((function(e){return e.id!==a}))),o({},e,{sortBy:S})}}function Ze(e){var n=e.data,r=e.rows,o=e.flatRows,i=e.allColumns,a=e.orderByFn,u=void 0===a?Je:a,l=e.sortTypes,c=e.manualSortBy,d=e.defaultCanSort,p=e.disableSortBy,g=e.flatHeaders,h=e.state.sortBy,y=e.dispatch,w=e.plugins,S=e.getHooks,R=e.autoResetSortBy,C=void 0===R||R;m(w,["useFilters","useGlobalFilter","useGroupBy","usePivotColumns"],"useSortBy");var x=t.useCallback((function(e){y({type:s.setSortBy,sortBy:e})}),[y]),P=t.useCallback((function(e,t,n){y({type:s.toggleSortBy,columnId:e,desc:t,multi:n})}),[y]),O=v(e);g.forEach((function(e){var t=e.accessor,n=e.canSort,r=e.disableSortBy,o=e.id,i=t?E(!0!==r&&void 0,!0!==p&&void 0,!0):E(d,n,!1);e.canSort=i,e.canSort&&(e.toggleSortBy=function(t,n){return P(e.id,t,n)},e.clearSortBy=function(){y({type:s.clearSortBy,columnId:e.id})}),e.getSortByToggleProps=f(S().getSortByToggleProps,{instance:O(),column:e});var a=h.find((function(e){return e.id===o}));e.isSorted=!!a,e.sortedIndex=h.findIndex((function(e){return e.id===o})),e.isSortedDesc=e.isSorted?a.desc:void 0}));var k=t.useMemo((function(){if(c||!h.length)return[r,o];var e=[],t=h.filter((function(e){return i.find((function(t){return t.id===e.id}))}));return[function n(r){var o=u(r,t.map((function(e){var t=i.find((function(t){return t.id===e.id}));if(!t)throw new Error("React-Table: Could not find a column with id: "+e.id+" while sorting");var n=t.sortType,r=I(n)||(l||{})[n]||qe[n];if(!r)throw new Error("React-Table: Could not find a valid sortType of '"+n+"' for column '"+e.id+"'.");return function(t,n){return r(t,n,e.id,e.desc)}})),t.map((function(e){var t=i.find((function(t){return t.id===e.id}));return t&&t.sortInverted?e.desc:!e.desc})));return o.forEach((function(t){e.push(t),t.subRows&&0!==t.subRows.length&&(t.subRows=n(t.subRows))})),o}(r),e]}),[c,h,r,o,i,u,l]),A=k[0],j=k[1],F=v(C);b((function(){F()&&y({type:s.resetSortBy})}),[c?null:n]),Object.assign(e,{preSortedRows:r,preSortedFlatRows:o,sortedRows:A,sortedFlatRows:j,rows:A,flatRows:j,setSortBy:x,toggleSortBy:P})}function Je(e,t,n){return[].concat(e).sort((function(e,r){for(var o=0;o<t.length;o+=1){var i=t[o],a=!1===n[o]||"desc"===n[o],s=i(e,r);if(0!==s)return a?-s:s}return n[0]?e.index-r.index:r.index-e.index}))}s.resetPage="resetPage",s.gotoPage="gotoPage",s.setPageSize="setPageSize";var Qe=function(e){e.stateReducers.push(et),e.useInstance.push(tt)};function et(e,t,n,r){if(t.type===s.init)return o({pageSize:10,pageIndex:0},e);if(t.type===s.resetPage)return o({},e,{pageIndex:r.initialState.pageIndex||0});if(t.type===s.gotoPage){var i=r.pageCount,a=r.page,u=h(t.pageIndex,e.pageIndex),l=!1;return u>e.pageIndex?l=-1===i?a.length>=e.pageSize:u<i:u<e.pageIndex&&(l=u>-1),l?o({},e,{pageIndex:u}):e}if(t.type===s.setPageSize){var c=t.pageSize,d=e.pageSize*e.pageIndex;return o({},e,{pageIndex:Math.floor(d/c),pageSize:c})}}function tt(e){var n=e.rows,r=e.autoResetPage,o=void 0===r||r,i=e.manualExpandedKey,a=void 0===i?"expanded":i,u=e.plugins,l=e.pageCount,c=e.paginateExpandedRows,d=void 0===c||c,f=e.expandSubRows,p=void 0===f||f,g=e.state,h=g.pageSize,y=g.pageIndex,w=g.expanded,S=g.globalFilter,R=g.filters,C=g.groupBy,x=g.sortBy,P=e.dispatch,O=e.data,k=e.manualPagination;m(u,["useGlobalFilter","useFilters","useGroupBy","useSortBy","useExpanded"],"usePagination");var E=v(o);b((function(){E()&&P({type:s.resetPage})}),[P,k?null:O,S,R,C,x]);var I=k?l:Math.ceil(n.length/h),A=t.useMemo((function(){return I>0?[].concat(new Array(I)).fill(null).map((function(e,t){return t})):[]}),[I]),F=t.useMemo((function(){var e;if(k)e=n;else{var t=h*y,r=t+h;e=n.slice(t,r)}return d?e:j(e,{manualExpandedKey:a,expanded:w,expandSubRows:p})}),[p,w,a,k,y,h,d,n]),B=y>0,T=-1===I?F.length>=h:y<I-1,G=t.useCallback((function(e){P({type:s.gotoPage,pageIndex:e})}),[P]),_=t.useCallback((function(){return G((function(e){return e-1}))}),[G]),M=t.useCallback((function(){return G((function(e){return e+1}))}),[G]),z=t.useCallback((function(e){P({type:s.setPageSize,pageSize:e})}),[P]);Object.assign(e,{pageOptions:A,pageCount:I,page:F,canPreviousPage:B,canNextPage:T,gotoPage:G,previousPage:_,nextPage:M,setPageSize:z})}Qe.pluginName="usePagination",s.resetPivot="resetPivot",s.togglePivot="togglePivot";var nt=function(e){e.getPivotToggleProps=[ot],e.stateReducers.push(it),e.useInstanceAfterData.push(at),e.allColumns.push(st),e.accessValue.push(ut),e.materializedColumns.push(lt),e.materializedColumnsDeps.push(ct),e.visibleColumns.push(dt),e.visibleColumnsDeps.push(ft),e.useInstance.push(pt),e.prepareRow.push(gt)};nt.pluginName="usePivotColumns";var rt=[],ot=function(e,t){var n=t.header;return[e,{onClick:n.canPivot?function(e){e.persist(),n.togglePivot()}:void 0,style:{cursor:n.canPivot?"pointer":void 0},title:"Toggle Pivot"}]};function it(e,t,n,r){if(t.type===s.init)return o({pivotColumns:rt},e);if(t.type===s.resetPivot)return o({},e,{pivotColumns:r.initialState.pivotColumns||rt});if(t.type===s.togglePivot){var i=t.columnId,a=t.value,u=void 0!==a?a:!e.pivotColumns.includes(i);return o({},e,u?{pivotColumns:[].concat(e.pivotColumns,[i])}:{pivotColumns:e.pivotColumns.filter((function(e){return e!==i}))})}}function at(e){e.allColumns.forEach((function(t){t.isPivotSource=e.state.pivotColumns.includes(t.id)}))}function st(e,t){var n=t.instance;return e.forEach((function(e){e.isPivotSource=n.state.pivotColumns.includes(e.id),e.uniqueValues=new Set})),e}function ut(e,t){var n=t.column;return n.uniqueValues&&void 0!==e&&n.uniqueValues.add(e),e}function lt(e,t){var n=t.instance,r=n.allColumns,i=n.state;if(!i.pivotColumns.length||!i.groupBy||!i.groupBy.length)return e;var a=i.pivotColumns.map((function(e){return r.find((function(t){return t.id===e}))})).filter(Boolean),s=r.filter((function(e){return!e.isPivotSource&&!i.groupBy.includes(e.id)&&!i.pivotColumns.includes(e.id)})),u=C(function e(t,n,r){void 0===t&&(t=0),void 0===r&&(r=[]);var i=a[t];return i?Array.from(i.uniqueValues).sort().map((function(a){var s=o({},i,{Header:i.PivotHeader||"string"==typeof i.header?i.Header+": "+a:a,isPivotGroup:!0,parent:n,depth:t,id:n?n.id+"."+i.id+"."+a:i.id+"."+a,pivotValue:a});return s.columns=e(t+1,s,[].concat(r,[function(e){return e.values[i.id]===a}])),s})):s.map((function(e){return o({},e,{canPivot:!1,isPivoted:!0,parent:n,depth:t,id:""+(n?n.id+"."+e.id:e.id),accessor:function(t,n,o){if(r.every((function(e){return e(o)})))return o.values[e.id]}})}))}());return[].concat(e,u)}function ct(e,t){var n=t.instance.state,r=n.pivotColumns,o=n.groupBy;return[].concat(e,[r,o])}function dt(e,t){var n=t.instance.state;return e=e.filter((function(e){return!e.isPivotSource})),n.pivotColumns.length&&n.groupBy&&n.groupBy.length&&(e=e.filter((function(e){return e.isGrouped||e.isPivoted}))),e}function ft(e,t){var n=t.instance;return[].concat(e,[n.state.pivotColumns,n.state.groupBy])}function pt(e){var t=e.columns,n=e.allColumns,r=e.flatHeaders,o=e.getHooks,i=e.plugins,a=e.dispatch,u=e.autoResetPivot,l=void 0===u||u,c=e.manaulPivot,d=e.disablePivot,p=e.defaultCanPivot;m(i,["useGroupBy"],"usePivotColumns");var g=v(e);n.forEach((function(t){var n=t.accessor,r=t.defaultPivot,o=t.disablePivot;t.canPivot=n?E(t.canPivot,!0!==o&&void 0,!0!==d&&void 0,!0):E(t.canPivot,r,p,!1),t.canPivot&&(t.togglePivot=function(){return e.togglePivot(t.id)}),t.Aggregated=t.Aggregated||t.Cell})),r.forEach((function(e){e.getPivotToggleProps=f(o().getPivotToggleProps,{instance:g(),header:e})}));var h=v(l);b((function(){h()&&a({type:s.resetPivot})}),[a,c?null:t]),Object.assign(e,{togglePivot:function(e,t){a({type:s.togglePivot,columnId:e,value:t})}})}function gt(e){e.allCells.forEach((function(e){e.isPivoted=e.column.isPivoted}))}s.resetSelectedRows="resetSelectedRows",s.toggleAllRowsSelected="toggleAllRowsSelected",s.toggleRowSelected="toggleRowSelected",s.toggleAllPageRowsSelected="toggleAllPageRowsSelected";var mt=function(e){e.getToggleRowSelectedProps=[ht],e.getToggleAllRowsSelectedProps=[vt],e.getToggleAllPageRowsSelectedProps=[yt],e.stateReducers.push(bt),e.useInstance.push(wt),e.prepareRow.push(St)};mt.pluginName="useRowSelect";var ht=function(e,t){var n=t.instance,r=t.row,o=n.manualRowSelectedKey,i=void 0===o?"isSelected":o;return[e,{onChange:function(e){r.toggleRowSelected(e.target.checked)},style:{cursor:"pointer"},checked:!(!r.original||!r.original[i])||r.isSelected,title:"Toggle Row Selected",indeterminate:r.isSomeSelected}]},vt=function(e,t){var n=t.instance;return[e,{onChange:function(e){n.toggleAllRowsSelected(e.target.checked)},style:{cursor:"pointer"},checked:n.isAllRowsSelected,title:"Toggle All Rows Selected",indeterminate:Boolean(!n.isAllRowsSelected&&Object.keys(n.state.selectedRowIds).length)}]},yt=function(e,t){var n=t.instance;return[e,{onChange:function(e){n.toggleAllPageRowsSelected(e.target.checked)},style:{cursor:"pointer"},checked:n.isAllPageRowsSelected,title:"Toggle All Current Page Rows Selected",indeterminate:Boolean(!n.isAllPageRowsSelected&&n.page.some((function(e){var t=e.id;return n.state.selectedRowIds[t]})))}]};function bt(e,t,n,r){if(t.type===s.init)return o({selectedRowIds:{}},e);if(t.type===s.resetSelectedRows)return o({},e,{selectedRowIds:r.initialState.selectedRowIds||{}});if(t.type===s.toggleAllRowsSelected){var i=t.value,a=r.isAllRowsSelected,u=r.rowsById,l=r.nonGroupedRowsById,c=void 0===l?u:l,d=void 0!==i?i:!a,f=Object.assign({},e.selectedRowIds);return d?Object.keys(c).forEach((function(e){f[e]=!0})):Object.keys(c).forEach((function(e){delete f[e]})),o({},e,{selectedRowIds:f})}if(t.type===s.toggleRowSelected){var p=t.id,g=t.value,m=r.rowsById,h=r.selectSubRows,v=void 0===h||h,y=r.getSubRows,b=e.selectedRowIds[p],w=void 0!==g?g:!b;if(b===w)return e;var S=o({},e.selectedRowIds);return function e(t){var n=m[t];if(n.isGrouped||(w?S[t]=!0:delete S[t]),v&&y(n))return y(n).forEach((function(t){return e(t.id)}))}(p),o({},e,{selectedRowIds:S})}if(t.type===s.toggleAllPageRowsSelected){var R=t.value,C=r.page,x=r.rowsById,P=r.selectSubRows,O=void 0===P||P,k=r.isAllPageRowsSelected,E=r.getSubRows,I=void 0!==R?R:!k,A=o({},e.selectedRowIds);return C.forEach((function(e){return function e(t){var n=x[t];if(n.isGrouped||(I?A[t]=!0:delete A[t]),O&&E(n))return E(n).forEach((function(t){return e(t.id)}))}(e.id)})),o({},e,{selectedRowIds:A})}return e}function wt(e){var n=e.data,r=e.rows,o=e.getHooks,i=e.plugins,a=e.rowsById,u=e.nonGroupedRowsById,l=void 0===u?a:u,c=e.autoResetSelectedRows,d=void 0===c||c,p=e.state.selectedRowIds,g=e.selectSubRows,h=void 0===g||g,y=e.dispatch,w=e.page,S=e.getSubRows;m(i,["useFilters","useGroupBy","useSortBy","useExpanded","usePagination"],"useRowSelect");var R=t.useMemo((function(){var e=[];return r.forEach((function(t){var n=h?function e(t,n,r){if(n[t.id])return!0;var o=r(t);if(o&&o.length){var i=!0,a=!1;return o.forEach((function(t){a&&!i||(e(t,n,r)?a=!0:i=!1)})),!!i||!!a&&null}return!1}(t,p,S):!!p[t.id];t.isSelected=!!n,t.isSomeSelected=null===n,n&&e.push(t)})),e}),[r,h,p,S]),C=Boolean(Object.keys(l).length&&Object.keys(p).length),x=C;C&&Object.keys(l).some((function(e){return!p[e]}))&&(C=!1),C||w&&w.length&&w.some((function(e){var t=e.id;return!p[t]}))&&(x=!1);var P=v(d);b((function(){P()&&y({type:s.resetSelectedRows})}),[y,n]);var O=t.useCallback((function(e){return y({type:s.toggleAllRowsSelected,value:e})}),[y]),k=t.useCallback((function(e){return y({type:s.toggleAllPageRowsSelected,value:e})}),[y]),E=t.useCallback((function(e,t){return y({type:s.toggleRowSelected,id:e,value:t})}),[y]),I=v(e),A=f(o().getToggleAllRowsSelectedProps,{instance:I()}),j=f(o().getToggleAllPageRowsSelectedProps,{instance:I()});Object.assign(e,{selectedFlatRows:R,isAllRowsSelected:C,isAllPageRowsSelected:x,toggleRowSelected:E,toggleAllRowsSelected:O,getToggleAllRowsSelectedProps:A,getToggleAllPageRowsSelectedProps:j,toggleAllPageRowsSelected:k})}function St(e,t){var n=t.instance;e.toggleRowSelected=function(t){return n.toggleRowSelected(e.id,t)},e.getToggleRowSelectedProps=f(n.getHooks().getToggleRowSelectedProps,{instance:n,row:e})}var Rt=function(e){return{}},Ct=function(e){return{}};s.setRowState="setRowState",s.setCellState="setCellState",s.resetRowState="resetRowState";var xt=function(e){e.stateReducers.push(Pt),e.useInstance.push(Ot),e.prepareRow.push(kt)};function Pt(e,t,n,r){var i=r.initialRowStateAccessor,a=void 0===i?Rt:i,u=r.initialCellStateAccessor,l=void 0===u?Ct:u,c=r.rowsById;if(t.type===s.init)return o({rowState:{}},e);if(t.type===s.resetRowState)return o({},e,{rowState:r.initialState.rowState||{}});if(t.type===s.setRowState){var d,f=t.rowId,p=t.value,g=void 0!==e.rowState[f]?e.rowState[f]:a(c[f]);return o({},e,{rowState:o({},e.rowState,(d={},d[f]=h(p,g),d))})}if(t.type===s.setCellState){var m,v,y,b,w,S=t.rowId,R=t.columnId,C=t.value,x=void 0!==e.rowState[S]?e.rowState[S]:a(c[S]),P=void 0!==(null==x||null==(m=x.cellState)?void 0:m[R])?x.cellState[R]:l(null==(v=c[S])||null==(y=v.cells)?void 0:y.find((function(e){return e.column.id===R})));return o({},e,{rowState:o({},e.rowState,(w={},w[S]=o({},x,{cellState:o({},x.cellState||{},(b={},b[R]=h(C,P),b))}),w))})}}function Ot(e){var n=e.autoResetRowState,r=void 0===n||n,o=e.data,i=e.dispatch,a=t.useCallback((function(e,t){return i({type:s.setRowState,rowId:e,value:t})}),[i]),u=t.useCallback((function(e,t,n){return i({type:s.setCellState,rowId:e,columnId:t,value:n})}),[i]),l=v(r);b((function(){l()&&i({type:s.resetRowState})}),[o]),Object.assign(e,{setRowState:a,setCellState:u})}function kt(e,t){var n=t.instance,r=n.initialRowStateAccessor,o=void 0===r?Rt:r,i=n.initialCellStateAccessor,a=void 0===i?Ct:i,s=n.state.rowState;e&&(e.state=void 0!==s[e.id]?s[e.id]:o(e),e.setState=function(t){return n.setRowState(e.id,t)},e.cells.forEach((function(t){e.state.cellState||(e.state.cellState={}),t.state=void 0!==e.state.cellState[t.column.id]?e.state.cellState[t.column.id]:a(t),t.setState=function(r){return n.setCellState(e.id,t.column.id,r)}})))}xt.pluginName="useRowState",s.resetColumnOrder="resetColumnOrder",s.setColumnOrder="setColumnOrder";var Et=function(e){e.stateReducers.push(It),e.visibleColumnsDeps.push((function(e,t){var n=t.instance;return[].concat(e,[n.state.columnOrder])})),e.visibleColumns.push(At),e.useInstance.push(jt)};function It(e,t,n,r){return t.type===s.init?o({columnOrder:[]},e):t.type===s.resetColumnOrder?o({},e,{columnOrder:r.initialState.columnOrder||[]}):t.type===s.setColumnOrder?o({},e,{columnOrder:h(t.columnOrder,e.columnOrder)}):void 0}function At(e,t){var n=t.instance.state.columnOrder;if(!n||!n.length)return e;for(var r=[].concat(n),o=[].concat(e),i=[],a=function(){var e=r.shift(),t=o.findIndex((function(t){return t.id===e}));t>-1&&i.push(o.splice(t,1)[0])};o.length&&r.length;)a();return[].concat(i,o)}function jt(e){var n=e.dispatch;e.setColumnOrder=t.useCallback((function(e){return n({type:s.setColumnOrder,columnOrder:e})}),[n])}Et.pluginName="useColumnOrder",c.canResize=!0,s.columnStartResizing="columnStartResizing",s.columnResizing="columnResizing",s.columnDoneResizing="columnDoneResizing",s.resetResize="resetResize";var Ft=function(e){e.getResizerProps=[Bt],e.getHeaderProps.push({style:{position:"relative"}}),e.stateReducers.push(Tt),e.useInstance.push(_t),e.useInstanceBeforeDimensions.push(Gt)},Bt=function(e,t){var n=t.instance,r=t.header,o=n.dispatch,i=function(e,t){var n=!1;if("touchstart"===e.type){if(e.touches&&e.touches.length>1)return;n=!0}var r=function(e){var t=[];return function e(n){n.columns&&n.columns.length&&n.columns.map(e),t.push(n)}(e),t}(t).map((function(e){return[e.id,e.totalWidth]})),i=n?Math.round(e.touches[0].clientX):e.clientX,a=function(e){o({type:s.columnResizing,clientX:e})},u=function(){return o({type:s.columnDoneResizing})},l={mouse:{moveEvent:"mousemove",moveHandler:function(e){return a(e.clientX)},upEvent:"mouseup",upHandler:function(e){document.removeEventListener("mousemove",l.mouse.moveHandler),document.removeEventListener("mouseup",l.mouse.upHandler),u()}},touch:{moveEvent:"touchmove",moveHandler:function(e){return e.cancelable&&(e.preventDefault(),e.stopPropagation()),a(e.touches[0].clientX),!1},upEvent:"touchend",upHandler:function(e){document.removeEventListener(l.touch.moveEvent,l.touch.moveHandler),document.removeEventListener(l.touch.upEvent,l.touch.moveHandler),u()}}},c=n?l.touch:l.mouse,d=!!function(){if("boolean"==typeof G)return G;var e=!1;try{var t={get passive(){return e=!0,!1}};window.addEventListener("test",null,t),window.removeEventListener("test",null,t)}catch(t){e=!1}return G=e}()&&{passive:!1};document.addEventListener(c.moveEvent,c.moveHandler,d),document.addEventListener(c.upEvent,c.upHandler,d),o({type:s.columnStartResizing,columnId:t.id,columnWidth:t.totalWidth,headerIdWidths:r,clientX:i})};return[e,{onMouseDown:function(e){return e.persist()||i(e,r)},onTouchStart:function(e){return e.persist()||i(e,r)},style:{cursor:"col-resize"},draggable:!1,role:"separator"}]};function Tt(e,t){if(t.type===s.init)return o({columnResizing:{columnWidths:{}}},e);if(t.type===s.resetResize)return o({},e,{columnResizing:{columnWidths:{}}});if(t.type===s.columnStartResizing){var n=t.clientX,r=t.columnId,i=t.columnWidth,a=t.headerIdWidths;return o({},e,{columnResizing:o({},e.columnResizing,{startX:n,headerIdWidths:a,columnWidth:i,isResizingColumn:r})})}if(t.type===s.columnResizing){var u=t.clientX,l=e.columnResizing,c=l.startX,d=l.columnWidth,f=l.headerIdWidths,p=(u-c)/d,g={};return(void 0===f?[]:f).forEach((function(e){var t=e[0],n=e[1];g[t]=Math.max(n+n*p,0)})),o({},e,{columnResizing:o({},e.columnResizing,{columnWidths:o({},e.columnResizing.columnWidths,{},g)})})}return t.type===s.columnDoneResizing?o({},e,{columnResizing:o({},e.columnResizing,{startX:null,isResizingColumn:null})}):void 0}Ft.pluginName="useResizeColumns";var Gt=function(e){var t=e.flatHeaders,n=e.disableResizing,r=e.getHooks,o=e.state.columnResizing,i=v(e);t.forEach((function(e){var t=E(!0!==e.disableResizing&&void 0,!0!==n&&void 0,!0);e.canResize=t,e.width=o.columnWidths[e.id]||e.originalWidth||e.width,e.isResizing=o.isResizingColumn===e.id,t&&(e.getResizerProps=f(r().getResizerProps,{instance:i(),header:e}))}))};function _t(e){var n=e.plugins,r=e.dispatch,o=e.autoResetResize,i=void 0===o||o,a=e.columns;m(n,["useAbsoluteLayout"],"useResizeColumns");var u=v(i);b((function(){u()&&r({type:s.resetResize})}),[a]);var l=t.useCallback((function(){return r({type:s.resetResize})}),[r]);Object.assign(e,{resetResizing:l})}var Mt={position:"absolute",top:0},zt=function(e){e.getTableBodyProps.push(Ht),e.getRowProps.push(Ht),e.getHeaderGroupProps.push(Ht),e.getFooterGroupProps.push(Ht),e.getHeaderProps.push((function(e,t){var n=t.column;return[e,{style:o({},Mt,{left:n.totalLeft+"px",width:n.totalWidth+"px"})}]})),e.getCellProps.push((function(e,t){var n=t.cell;return[e,{style:o({},Mt,{left:n.column.totalLeft+"px",width:n.column.totalWidth+"px"})}]})),e.getFooterProps.push((function(e,t){var n=t.column;return[e,{style:o({},Mt,{left:n.totalLeft+"px",width:n.totalWidth+"px"})}]}))};zt.pluginName="useAbsoluteLayout";var Ht=function(e,t){return[e,{style:{position:"relative",width:t.instance.totalColumnsWidth+"px"}}]},Dt={display:"inline-block",boxSizing:"border-box"},Nt=function(e,t){return[e,{style:{display:"flex",width:t.instance.totalColumnsWidth+"px"}}]},Wt=function(e){e.getRowProps.push(Nt),e.getHeaderGroupProps.push(Nt),e.getFooterGroupProps.push(Nt),e.getHeaderProps.push((function(e,t){var n=t.column;return[e,{style:o({},Dt,{width:n.totalWidth+"px"})}]})),e.getCellProps.push((function(e,t){var n=t.cell;return[e,{style:o({},Dt,{width:n.column.totalWidth+"px"})}]})),e.getFooterProps.push((function(e,t){var n=t.column;return[e,{style:o({},Dt,{width:n.totalWidth+"px"})}]}))};function Lt(e){e.getTableProps.push($t),e.getRowProps.push(Vt),e.getHeaderGroupProps.push(Vt),e.getFooterGroupProps.push(Vt),e.getHeaderProps.push(Xt),e.getCellProps.push(qt),e.getFooterProps.push(Ut)}Wt.pluginName="useBlockLayout",Lt.pluginName="useFlexLayout";var $t=function(e,t){return[e,{style:{minWidth:t.instance.totalColumnsMinWidth+"px"}}]},Vt=function(e,t){return[e,{style:{display:"flex",flex:"1 0 auto",minWidth:t.instance.totalColumnsMinWidth+"px"}}]},Xt=function(e,t){var n=t.column;return[e,{style:{boxSizing:"border-box",flex:n.totalFlexWidth?n.totalFlexWidth+" 0 auto":void 0,minWidth:n.totalMinWidth+"px",width:n.totalWidth+"px"}}]},qt=function(e,t){var n=t.cell;return[e,{style:{boxSizing:"border-box",flex:n.column.totalFlexWidth+" 0 auto",minWidth:n.column.totalMinWidth+"px",width:n.column.totalWidth+"px"}}]},Ut=function(e,t){var n=t.column;return[e,{style:{boxSizing:"border-box",flex:n.totalFlexWidth?n.totalFlexWidth+" 0 auto":void 0,minWidth:n.totalMinWidth+"px",width:n.totalWidth+"px"}}]};function Yt(e){e.stateReducers.push(Jt),e.getTableProps.push(Kt),e.getHeaderProps.push(Zt)}Yt.pluginName="useGridLayout";var Kt=function(e,t){return[e,{style:{display:"grid",gridTemplateColumns:t.instance.state.gridLayout.columnWidths.map((function(e){return e})).join(" ")}}]},Zt=function(e,t){return[e,{id:"header-cell-"+t.column.id,style:{position:"sticky"}}]};function Jt(e,t,n,r){if("init"===t.type)return o({gridLayout:{columnWidths:r.columns.map((function(){return"auto"}))}},e);if("columnStartResizing"===t.type){var i=t.columnId,a=r.visibleColumns.findIndex((function(e){return e.id===i})),s=function(e){var t,n=null==(t=document.getElementById("header-cell-"+e))?void 0:t.offsetWidth;if(void 0!==n)return n}(i);return void 0!==s?o({},e,{gridLayout:o({},e.gridLayout,{columnId:i,columnIndex:a,startingWidth:s})}):e}if("columnResizing"===t.type){var u=e.gridLayout,l=u.columnIndex,c=u.startingWidth,d=u.columnWidths,f=c-(e.columnResizing.startX-t.clientX),p=[].concat(d);return p[l]=f+"px",o({},e,{gridLayout:o({},e.gridLayout,{columnWidths:p})})}}e._UNSTABLE_usePivotColumns=nt,e.actions=s,e.defaultColumn=c,e.defaultGroupByFn=We,e.defaultOrderByFn=Je,e.defaultRenderer=u,e.emptyRenderer=l,e.ensurePluginOrder=m,e.flexRender=S,e.functionalUpdate=h,e.loopHooks=g,e.makePropGetter=f,e.makeRenderer=w,e.reduceHooks=p,e.safeUseLayoutEffect=y,e.useAbsoluteLayout=zt,e.useAsyncDebounce=function(e,n){void 0===n&&(n=0);var o=t.useRef({}),i=v(e),a=v(n);return t.useCallback(function(){var e=r(regeneratorRuntime.mark((function e(){var t,n,s,u=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(t=u.length,n=new Array(t),s=0;s<t;s++)n[s]=u[s];return o.current.promise||(o.current.promise=new Promise((function(e,t){o.current.resolve=e,o.current.reject=t}))),o.current.timeout&&clearTimeout(o.current.timeout),o.current.timeout=setTimeout(r(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return delete o.current.timeout,e.prev=1,e.t0=o.current,e.next=5,i().apply(void 0,n);case 5:e.t1=e.sent,e.t0.resolve.call(e.t0,e.t1),e.next=12;break;case 9:e.prev=9,e.t2=e.catch(1),o.current.reject(e.t2);case 12:return e.prev=12,delete o.current.promise,e.finish(12);case 15:case"end":return e.stop()}}),e,null,[[1,9,12,15]])}))),a()),e.abrupt("return",o.current.promise);case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),[i,a])},e.useBlockLayout=Wt,e.useColumnOrder=Et,e.useExpanded=ue,e.useFilters=Pe,e.useFlexLayout=Lt,e.useGetLatest=v,e.useGlobalFilter=Ee,e.useGridLayout=Yt,e.useGroupBy=Ge,e.useMountedLayoutEffect=b,e.usePagination=Qe,e.useResizeColumns=Ft,e.useRowSelect=mt,e.useRowState=xt,e.useSortBy=Ue,e.useTable=function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];e=ie(e),r=[q].concat(r);var a=t.useRef({}),u=v(a.current);Object.assign(u(),o({},e,{plugins:r,hooks:X()})),r.filter(Boolean).forEach((function(e){e(u().hooks)}));var l=v(u().hooks);u().getHooks=l,delete u().hooks,Object.assign(u(),p(l().useOptions,ie(e)));var c=u(),d=c.data,m=c.columns,h=c.initialState,y=c.defaultColumn,b=c.getSubRows,S=c.getRowId,k=c.stateReducer,E=c.useControlledState,I=v(k),A=t.useCallback((function(e,t){if(!t.type)throw console.info({action:t}),new Error("Unknown Action 👆");return[].concat(l().stateReducers,Array.isArray(I())?I():[I()]).reduce((function(n,r){return r(n,t,e,u())||n}),e)}),[l,I,u]),j=t.useReducer(A,void 0,(function(){return A(h,{type:s.init})})),F=j[0],B=j[1],T=p([].concat(l().useControlledState,[E]),F,{instance:u()});Object.assign(u(),{state:T,dispatch:B});var G=t.useMemo((function(){return R(p(l().columns,m,{instance:u()}))}),[l,u,m].concat(p(l().columnsDeps,[],{instance:u()})));u().columns=G;var _=t.useMemo((function(){return p(l().allColumns,C(G),{instance:u()}).map(x)}),[G,l,u].concat(p(l().allColumnsDeps,[],{instance:u()})));u().allColumns=_;var M=t.useMemo((function(){for(var e=[],t=[],n={},r=[].concat(_);r.length;){var o=r.shift();se({data:d,rows:e,flatRows:t,rowsById:n,column:o,getRowId:S,getSubRows:b,accessValueHooks:l().accessValue,getInstance:u})}return[e,t,n]}),[_,d,S,b,l,u]),z=M[0],H=M[1],D=M[2];Object.assign(u(),{rows:z,initialRows:[].concat(z),flatRows:H,rowsById:D}),g(l().useInstanceAfterData,u());var N=t.useMemo((function(){return p(l().visibleColumns,_,{instance:u()}).map((function(e){return P(e,y)}))}),[l,_,u,y].concat(p(l().visibleColumnsDeps,[],{instance:u()})));_=t.useMemo((function(){var e=[].concat(N);return _.forEach((function(t){e.find((function(e){return e.id===t.id}))||e.push(t)})),e}),[_,N]),u().allColumns=_;var W=t.useMemo((function(){return p(l().headerGroups,O(N,y),u())}),[l,N,y,u].concat(p(l().headerGroupsDeps,[],{instance:u()})));u().headerGroups=W;var L=t.useMemo((function(){return W.length?W[0].headers:[]}),[W]);u().headers=L,u().flatHeaders=W.reduce((function(e,t){return[].concat(e,t.headers)}),[]),g(l().useInstanceBeforeDimensions,u());var $=N.filter((function(e){return e.isVisible})).map((function(e){return e.id})).sort().join("_");N=t.useMemo((function(){return N.filter((function(e){return e.isVisible}))}),[N,$]),u().visibleColumns=N;var V=ae(L),U=V[0],Y=V[1],K=V[2];return u().totalColumnsMinWidth=U,u().totalColumnsWidth=Y,u().totalColumnsMaxWidth=K,g(l().useInstance,u()),[].concat(u().flatHeaders,u().allColumns).forEach((function(e){e.render=w(u(),e),e.getHeaderProps=f(l().getHeaderProps,{instance:u(),column:e}),e.getFooterProps=f(l().getFooterProps,{instance:u(),column:e})})),u().headerGroups=t.useMemo((function(){return W.filter((function(e,t){return e.headers=e.headers.filter((function(e){return e.headers?function e(t){return t.filter((function(t){return t.headers?e(t.headers):t.isVisible})).length}(e.headers):e.isVisible})),!!e.headers.length&&(e.getHeaderGroupProps=f(l().getHeaderGroupProps,{instance:u(),headerGroup:e,index:t}),e.getFooterGroupProps=f(l().getFooterGroupProps,{instance:u(),headerGroup:e,index:t}),!0)}))}),[W,u,l]),u().footerGroups=[].concat(u().headerGroups).reverse(),u().prepareRow=t.useCallback((function(e){e.getRowProps=f(l().getRowProps,{instance:u(),row:e}),e.allCells=_.map((function(t){var n=e.values[t.id],r={column:t,row:e,value:n};return r.getCellProps=f(l().getCellProps,{instance:u(),cell:r}),r.render=w(u(),t,{row:e,cell:r,value:n}),r})),e.cells=N.map((function(t){return e.allCells.find((function(e){return e.column.id===t.id}))})),g(l().prepareRow,e,{instance:u()})}),[l,u,_,N]),u().getTableProps=f(l().getTableProps,{instance:u()}),u().getTableBodyProps=f(l().getTableBodyProps,{instance:u()}),g(l().useFinalInstance,u()),u()},Object.defineProperty(e,"__esModule",{value:!0})}(t,n(1))},function(e,t,n){"use strict";var r=n(22),o={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},i={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},a={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},s={};function u(e){return r.isMemo(e)?a:s[e.$$typeof]||o}s[r.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},s[r.Memo]=a;var l=Object.defineProperty,c=Object.getOwnPropertyNames,d=Object.getOwnPropertySymbols,f=Object.getOwnPropertyDescriptor,p=Object.getPrototypeOf,g=Object.prototype;e.exports=function e(t,n,r){if("string"!=typeof n){if(g){var o=p(n);o&&o!==g&&e(t,o,r)}var a=c(n);d&&(a=a.concat(d(n)));for(var s=u(t),m=u(n),h=0;h<a.length;++h){var v=a[h];if(!(i[v]||r&&r[v]||m&&m[v]||s&&s[v])){var y=f(n,v);try{l(t,v,y)}catch(e){}}}}return t}},function(e,t,n){"use strict";var r=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|inert|itemProp|itemScope|itemType|itemID|itemRef|on|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,o=function(e){var t={};return function(n){return void 0===t[n]&&(t[n]=e(n)),t[n]}}((function(e){return r.test(e)||111===e.charCodeAt(0)&&110===e.charCodeAt(1)&&e.charCodeAt(2)<91}));t.a=o},function(e){e.exports=JSON.parse('{"attributes":{"alignment":{"type":"string","default":"none"},"formID":{"type":"string"},"selectedFields":{"type":"array"}}}')},function(e,t){e.exports=function(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){"use strict";(function(e){var r=n(22),o=n(1),i=n.n(o),a=n(29),s=n.n(a),u=n(30),l=n(31),c=n(25),d=n(24),f=n.n(d);function p(){return(p=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}var g=function(e,t){for(var n=[e[0]],r=0,o=t.length;r<o;r+=1)n.push(t[r],e[r+1]);return n},m=function(e){return null!==e&&"object"==typeof e&&"[object Object]"===(e.toString?e.toString():Object.prototype.toString.call(e))&&!Object(r.typeOf)(e)},h=Object.freeze([]),v=Object.freeze({});function y(e){return"function"==typeof e}function b(e){return e.displayName||e.name||"Component"}function w(e){return e&&"string"==typeof e.styledComponentId}var S=void 0!==e&&(e.env.REACT_APP_SC_ATTR||e.env.SC_ATTR)||"data-styled",R="undefined"!=typeof window&&"HTMLElement"in window,C=Boolean("boolean"==typeof SC_DISABLE_SPEEDY?SC_DISABLE_SPEEDY:void 0!==e&&void 0!==e.env.REACT_APP_SC_DISABLE_SPEEDY&&""!==e.env.REACT_APP_SC_DISABLE_SPEEDY?"false"!==e.env.REACT_APP_SC_DISABLE_SPEEDY&&e.env.REACT_APP_SC_DISABLE_SPEEDY:void 0!==e&&void 0!==e.env.SC_DISABLE_SPEEDY&&""!==e.env.SC_DISABLE_SPEEDY&&("false"!==e.env.SC_DISABLE_SPEEDY&&e.env.SC_DISABLE_SPEEDY));function x(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];throw new Error("An error occurred. See https://git.io/JUIaE#"+e+" for more information."+(n.length>0?" Args: "+n.join(", "):""))}var P=function(){function e(e){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=e}var t=e.prototype;return t.indexOfGroup=function(e){for(var t=0,n=0;n<e;n++)t+=this.groupSizes[n];return t},t.insertRules=function(e,t){if(e>=this.groupSizes.length){for(var n=this.groupSizes,r=n.length,o=r;e>=o;)(o<<=1)<0&&x(16,""+e);this.groupSizes=new Uint32Array(o),this.groupSizes.set(n),this.length=o;for(var i=r;i<o;i++)this.groupSizes[i]=0}for(var a=this.indexOfGroup(e+1),s=0,u=t.length;s<u;s++)this.tag.insertRule(a,t[s])&&(this.groupSizes[e]++,a++)},t.clearGroup=function(e){if(e<this.length){var t=this.groupSizes[e],n=this.indexOfGroup(e),r=n+t;this.groupSizes[e]=0;for(var o=n;o<r;o++)this.tag.deleteRule(n)}},t.getGroup=function(e){var t="";if(e>=this.length||0===this.groupSizes[e])return t;for(var n=this.groupSizes[e],r=this.indexOfGroup(e),o=r+n,i=r;i<o;i++)t+=this.tag.getRule(i)+"/*!sc*/\n";return t},e}(),O=new Map,k=new Map,E=1,I=function(e){if(O.has(e))return O.get(e);for(;k.has(E);)E++;var t=E++;return O.set(e,t),k.set(t,e),t},A=function(e){return k.get(e)},j=function(e,t){O.set(e,t),k.set(t,e)},F="style["+S+'][data-styled-version="5.2.3"]',B=new RegExp("^"+S+'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)'),T=function(e,t,n){for(var r,o=n.split(","),i=0,a=o.length;i<a;i++)(r=o[i])&&e.registerName(t,r)},G=function(e,t){for(var n=t.innerHTML.split("/*!sc*/\n"),r=[],o=0,i=n.length;o<i;o++){var a=n[o].trim();if(a){var s=a.match(B);if(s){var u=0|parseInt(s[1],10),l=s[2];0!==u&&(j(l,u),T(e,l,s[3]),e.getTag().insertRules(u,r)),r.length=0}else r.push(a)}}},_=function(){return"undefined"!=typeof window&&void 0!==window.__webpack_nonce__?window.__webpack_nonce__:null},M=function(e){var t=document.head,n=e||t,r=document.createElement("style"),o=function(e){for(var t=e.childNodes,n=t.length;n>=0;n--){var r=t[n];if(r&&1===r.nodeType&&r.hasAttribute(S))return r}}(n),i=void 0!==o?o.nextSibling:null;r.setAttribute(S,"active"),r.setAttribute("data-styled-version","5.2.3");var a=_();return a&&r.setAttribute("nonce",a),n.insertBefore(r,i),r},z=function(){function e(e){var t=this.element=M(e);t.appendChild(document.createTextNode("")),this.sheet=function(e){if(e.sheet)return e.sheet;for(var t=document.styleSheets,n=0,r=t.length;n<r;n++){var o=t[n];if(o.ownerNode===e)return o}x(17)}(t),this.length=0}var t=e.prototype;return t.insertRule=function(e,t){try{return this.sheet.insertRule(t,e),this.length++,!0}catch(e){return!1}},t.deleteRule=function(e){this.sheet.deleteRule(e),this.length--},t.getRule=function(e){var t=this.sheet.cssRules[e];return void 0!==t&&"string"==typeof t.cssText?t.cssText:""},e}(),H=function(){function e(e){var t=this.element=M(e);this.nodes=t.childNodes,this.length=0}var t=e.prototype;return t.insertRule=function(e,t){if(e<=this.length&&e>=0){var n=document.createTextNode(t),r=this.nodes[e];return this.element.insertBefore(n,r||null),this.length++,!0}return!1},t.deleteRule=function(e){this.element.removeChild(this.nodes[e]),this.length--},t.getRule=function(e){return e<this.length?this.nodes[e].textContent:""},e}(),D=function(){function e(e){this.rules=[],this.length=0}var t=e.prototype;return t.insertRule=function(e,t){return e<=this.length&&(this.rules.splice(e,0,t),this.length++,!0)},t.deleteRule=function(e){this.rules.splice(e,1),this.length--},t.getRule=function(e){return e<this.length?this.rules[e]:""},e}(),N=R,W={isServer:!R,useCSSOMInjection:!C},L=function(){function e(e,t,n){void 0===e&&(e=v),void 0===t&&(t={}),this.options=p({},W,{},e),this.gs=t,this.names=new Map(n),!this.options.isServer&&R&&N&&(N=!1,function(e){for(var t=document.querySelectorAll(F),n=0,r=t.length;n<r;n++){var o=t[n];o&&"active"!==o.getAttribute(S)&&(G(e,o),o.parentNode&&o.parentNode.removeChild(o))}}(this))}e.registerId=function(e){return I(e)};var t=e.prototype;return t.reconstructWithOptions=function(t,n){return void 0===n&&(n=!0),new e(p({},this.options,{},t),this.gs,n&&this.names||void 0)},t.allocateGSInstance=function(e){return this.gs[e]=(this.gs[e]||0)+1},t.getTag=function(){return this.tag||(this.tag=(n=(t=this.options).isServer,r=t.useCSSOMInjection,o=t.target,e=n?new D(o):r?new z(o):new H(o),new P(e)));var e,t,n,r,o},t.hasNameForId=function(e,t){return this.names.has(e)&&this.names.get(e).has(t)},t.registerName=function(e,t){if(I(e),this.names.has(e))this.names.get(e).add(t);else{var n=new Set;n.add(t),this.names.set(e,n)}},t.insertRules=function(e,t,n){this.registerName(e,t),this.getTag().insertRules(I(e),n)},t.clearNames=function(e){this.names.has(e)&&this.names.get(e).clear()},t.clearRules=function(e){this.getTag().clearGroup(I(e)),this.clearNames(e)},t.clearTag=function(){this.tag=void 0},t.toString=function(){return function(e){for(var t=e.getTag(),n=t.length,r="",o=0;o<n;o++){var i=A(o);if(void 0!==i){var a=e.names.get(i),s=t.getGroup(o);if(void 0!==a&&0!==s.length){var u=S+".g"+o+'[id="'+i+'"]',l="";void 0!==a&&a.forEach((function(e){e.length>0&&(l+=e+",")})),r+=""+s+u+'{content:"'+l+'"}/*!sc*/\n'}}}return r}(this)},e}(),$=/(a)(d)/gi,V=function(e){return String.fromCharCode(e+(e>25?39:97))};function X(e){var t,n="";for(t=Math.abs(e);t>52;t=t/52|0)n=V(t%52)+n;return(V(t%52)+n).replace($,"$1-$2")}var q=function(e,t){for(var n=t.length;n;)e=33*e^t.charCodeAt(--n);return e},U=function(e){return q(5381,e)};function Y(e){for(var t=0;t<e.length;t+=1){var n=e[t];if(y(n)&&!w(n))return!1}return!0}var K=U("5.2.3"),Z=function(){function e(e,t,n){this.rules=e,this.staticRulesId="",this.isStatic=(void 0===n||n.isStatic)&&Y(e),this.componentId=t,this.baseHash=q(K,t),this.baseStyle=n,L.registerId(t)}return e.prototype.generateAndInjectStyles=function(e,t,n){var r=this.componentId,o=[];if(this.baseStyle&&o.push(this.baseStyle.generateAndInjectStyles(e,t,n)),this.isStatic&&!n.hash)if(this.staticRulesId&&t.hasNameForId(r,this.staticRulesId))o.push(this.staticRulesId);else{var i=me(this.rules,e,t,n).join(""),a=X(q(this.baseHash,i.length)>>>0);if(!t.hasNameForId(r,a)){var s=n(i,"."+a,void 0,r);t.insertRules(r,a,s)}o.push(a),this.staticRulesId=a}else{for(var u=this.rules.length,l=q(this.baseHash,n.hash),c="",d=0;d<u;d++){var f=this.rules[d];if("string"==typeof f)c+=f;else if(f){var p=me(f,e,t,n),g=Array.isArray(p)?p.join(""):p;l=q(l,g+d),c+=g}}if(c){var m=X(l>>>0);if(!t.hasNameForId(r,m)){var h=n(c,"."+m,void 0,r);t.insertRules(r,m,h)}o.push(m)}}return o.join(" ")},e}(),J=/^\s*\/\/.*$/gm,Q=[":","[",".","#"];function ee(e){var t,n,r,o,i=void 0===e?v:e,a=i.options,s=void 0===a?v:a,l=i.plugins,c=void 0===l?h:l,d=new u.a(s),f=[],p=function(e){function t(t){if(t)try{e(t+"}")}catch(e){}}return function(n,r,o,i,a,s,u,l,c,d){switch(n){case 1:if(0===c&&64===r.charCodeAt(0))return e(r+";"),"";break;case 2:if(0===l)return r+"/*|*/";break;case 3:switch(l){case 102:case 112:return e(o[0]+r),"";default:return r+(0===d?"/*|*/":"")}case-2:r.split("/*|*/}").forEach(t)}}}((function(e){f.push(e)})),g=function(e,r,i){return 0===r&&-1!==Q.indexOf(i[n.length])||i.match(o)?e:"."+t};function m(e,i,a,s){void 0===s&&(s="&");var u=e.replace(J,""),l=i&&a?a+" "+i+" { "+u+" }":u;return t=s,n=i,r=new RegExp("\\"+n+"\\b","g"),o=new RegExp("(\\"+n+"\\b){2,}"),d(a||!i?"":i,l)}return d.use([].concat(c,[function(e,t,o){2===e&&o.length&&o[0].lastIndexOf(n)>0&&(o[0]=o[0].replace(r,g))},p,function(e){if(-2===e){var t=f;return f=[],t}}])),m.hash=c.length?c.reduce((function(e,t){return t.name||x(15),q(e,t.name)}),5381).toString():"",m}var te=i.a.createContext(),ne=(te.Consumer,i.a.createContext()),re=(ne.Consumer,new L),oe=ee();function ie(){return Object(o.useContext)(te)||re}function ae(){return Object(o.useContext)(ne)||oe}function se(e){var t=Object(o.useState)(e.stylisPlugins),n=t[0],r=t[1],a=ie(),u=Object(o.useMemo)((function(){var t=a;return e.sheet?t=e.sheet:e.target&&(t=t.reconstructWithOptions({target:e.target},!1)),e.disableCSSOMInjection&&(t=t.reconstructWithOptions({useCSSOMInjection:!1})),t}),[e.disableCSSOMInjection,e.sheet,e.target]),l=Object(o.useMemo)((function(){return ee({options:{prefix:!e.disableVendorPrefixes},plugins:n})}),[e.disableVendorPrefixes,n]);return Object(o.useEffect)((function(){s()(n,e.stylisPlugins)||r(e.stylisPlugins)}),[e.stylisPlugins]),i.a.createElement(te.Provider,{value:u},i.a.createElement(ne.Provider,{value:l},e.children))}var ue=function(){function e(e,t){var n=this;this.inject=function(e,t){void 0===t&&(t=oe);var r=n.name+t.hash;e.hasNameForId(n.id,r)||e.insertRules(n.id,r,t(n.rules,r,"@keyframes"))},this.toString=function(){return x(12,String(n.name))},this.name=e,this.id="sc-keyframes-"+e,this.rules=t}return e.prototype.getName=function(e){return void 0===e&&(e=oe),this.name+e.hash},e}(),le=/([A-Z])/,ce=/([A-Z])/g,de=/^ms-/,fe=function(e){return"-"+e.toLowerCase()};function pe(e){return le.test(e)?e.replace(ce,fe).replace(de,"-ms-"):e}var ge=function(e){return null==e||!1===e||""===e};function me(e,t,n,r){if(Array.isArray(e)){for(var o,i=[],a=0,s=e.length;a<s;a+=1)""!==(o=me(e[a],t,n,r))&&(Array.isArray(o)?i.push.apply(i,o):i.push(o));return i}return ge(e)?"":w(e)?"."+e.styledComponentId:y(e)?"function"!=typeof(u=e)||u.prototype&&u.prototype.isReactComponent||!t?e:me(e(t),t,n,r):e instanceof ue?n?(e.inject(n,r),e.getName(r)):e:m(e)?function e(t,n){var r,o,i=[];for(var a in t)t.hasOwnProperty(a)&&!ge(t[a])&&(m(t[a])?i.push.apply(i,e(t[a],a)):y(t[a])?i.push(pe(a)+":",t[a],";"):i.push(pe(a)+": "+(r=a,(null==(o=t[a])||"boolean"==typeof o||""===o?"":"number"!=typeof o||0===o||r in l.a?String(o).trim():o+"px")+";")));return n?[n+" {"].concat(i,["}"]):i}(e):e.toString();var u}function he(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return y(e)||m(e)?me(g(h,[e].concat(n))):0===n.length&&1===e.length&&"string"==typeof e[0]?e:me(g(e,n))}new Set;var ve=function(e,t,n){return void 0===n&&(n=v),e.theme!==n.theme&&e.theme||t||n.theme},ye=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,be=/(^-|-$)/g;function we(e){return e.replace(ye,"-").replace(be,"")}var Se=function(e){return X(U(e)>>>0)};function Re(e){return"string"==typeof e&&!0}var Ce=function(e){return"function"==typeof e||"object"==typeof e&&null!==e&&!Array.isArray(e)},xe=function(e){return"__proto__"!==e&&"constructor"!==e&&"prototype"!==e};function Pe(e,t,n){var r=e[n];Ce(t)&&Ce(r)?Oe(r,t):e[n]=t}function Oe(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];for(var o=0,i=n;o<i.length;o++){var a=i[o];if(Ce(a))for(var s in a)xe(s)&&Pe(e,a[s],s)}return e}var ke=i.a.createContext();ke.Consumer;var Ee={};function Ie(e,t,n){var r=w(e),a=!Re(e),s=t.attrs,u=void 0===s?h:s,l=t.componentId,d=void 0===l?function(e,t){var n="string"!=typeof e?"sc":we(e);Ee[n]=(Ee[n]||0)+1;var r=n+"-"+Se("5.2.3"+n+Ee[n]);return t?t+"-"+r:r}(t.displayName,t.parentComponentId):l,g=t.displayName,m=void 0===g?function(e){return Re(e)?"styled."+e:"Styled("+b(e)+")"}(e):g,S=t.displayName&&t.componentId?we(t.displayName)+"-"+t.componentId:t.componentId||d,R=r&&e.attrs?Array.prototype.concat(e.attrs,u).filter(Boolean):u,C=t.shouldForwardProp;r&&e.shouldForwardProp&&(C=t.shouldForwardProp?function(n,r){return e.shouldForwardProp(n,r)&&t.shouldForwardProp(n,r)}:e.shouldForwardProp);var x,P=new Z(n,S,r?e.componentStyle:void 0),O=P.isStatic&&0===u.length,k=function(e,t){return function(e,t,n,r){var i=e.attrs,a=e.componentStyle,s=e.defaultProps,u=e.foldedComponentIds,l=e.shouldForwardProp,d=e.styledComponentId,f=e.target,g=function(e,t,n){void 0===e&&(e=v);var r=p({},t,{theme:e}),o={};return n.forEach((function(e){var t,n,i,a=e;for(t in y(a)&&(a=a(r)),a)r[t]=o[t]="className"===t?(n=o[t],i=a[t],n&&i?n+" "+i:n||i):a[t]})),[r,o]}(ve(t,Object(o.useContext)(ke),s)||v,t,i),m=g[0],h=g[1],b=function(e,t,n,r){var o=ie(),i=ae();return t?e.generateAndInjectStyles(v,o,i):e.generateAndInjectStyles(n,o,i)}(a,r,m),w=n,S=h.$as||t.$as||h.as||t.as||f,R=Re(S),C=h!==t?p({},t,{},h):t,x={};for(var P in C)"$"!==P[0]&&"as"!==P&&("forwardedAs"===P?x.as=C[P]:(l?l(P,c.a):!R||Object(c.a)(P))&&(x[P]=C[P]));return t.style&&h.style!==t.style&&(x.style=p({},t.style,{},h.style)),x.className=Array.prototype.concat(u,d,b!==d?b:null,t.className,h.className).filter(Boolean).join(" "),x.ref=w,Object(o.createElement)(S,x)}(x,e,t,O)};return k.displayName=m,(x=i.a.forwardRef(k)).attrs=R,x.componentStyle=P,x.displayName=m,x.shouldForwardProp=C,x.foldedComponentIds=r?Array.prototype.concat(e.foldedComponentIds,e.styledComponentId):h,x.styledComponentId=S,x.target=r?e.target:e,x.withComponent=function(e){var r=t.componentId,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(t,["componentId"]),i=r&&r+"-"+(Re(e)?e:we(b(e)));return Ie(e,p({},o,{attrs:R,componentId:i}),n)},Object.defineProperty(x,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(t){this._foldedDefaultProps=r?Oe({},e.defaultProps,t):t}}),x.toString=function(){return"."+x.styledComponentId},a&&f()(x,e,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0,withComponent:!0}),x}var Ae=function(e){return function e(t,n,o){if(void 0===o&&(o=v),!Object(r.isValidElementType)(n))return x(1,String(n));var i=function(){return t(n,o,he.apply(void 0,arguments))};return i.withConfig=function(r){return e(t,n,p({},o,{},r))},i.attrs=function(r){return e(t,n,p({},o,{attrs:Array.prototype.concat(o.attrs,r).filter(Boolean)}))},i}(Ie,e)};["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"].forEach((function(e){Ae[e]=Ae(e)}));!function(){function e(e,t){this.rules=e,this.componentId=t,this.isStatic=Y(e),L.registerId(this.componentId+1)}var t=e.prototype;t.createStyles=function(e,t,n,r){var o=r(me(this.rules,t,n,r).join(""),""),i=this.componentId+e;n.insertRules(i,i,o)},t.removeStyles=function(e,t){t.clearRules(this.componentId+e)},t.renderStyles=function(e,t,n,r){e>2&&L.registerId(this.componentId+e),this.removeStyles(e,n),this.createStyles(e,t,n,r)}}();!function(){function e(){var e=this;this._emitSheetCSS=function(){var t=e.instance.toString(),n=_();return"<style "+[n&&'nonce="'+n+'"',S+'="true"','data-styled-version="5.2.3"'].filter(Boolean).join(" ")+">"+t+"</style>"},this.getStyleTags=function(){return e.sealed?x(2):e._emitSheetCSS()},this.getStyleElement=function(){var t;if(e.sealed)return x(2);var n=((t={})[S]="",t["data-styled-version"]="5.2.3",t.dangerouslySetInnerHTML={__html:e.instance.toString()},t),r=_();return r&&(n.nonce=r),[i.a.createElement("style",p({},n,{key:"sc-0-0"}))]},this.seal=function(){e.sealed=!0},this.instance=new L({isServer:!0}),this.sealed=!1}var t=e.prototype;t.collectStyles=function(e){return this.sealed?x(2):i.a.createElement(se,{sheet:this.instance},e)},t.interleaveWithNodeStream=function(e){return x(3)}}();t.a=Ae}).call(this,n(34))},function(e,t){e.exports=function(e,t,n,r){var o=n?n.call(r,e,t):void 0;if(void 0!==o)return!!o;if(e===t)return!0;if("object"!=typeof e||!e||"object"!=typeof t||!t)return!1;var i=Object.keys(e),a=Object.keys(t);if(i.length!==a.length)return!1;for(var s=Object.prototype.hasOwnProperty.bind(t),u=0;u<i.length;u++){var l=i[u];if(!s(l))return!1;var c=e[l],d=t[l];if(!1===(o=n?n.call(r,c,d,l):void 0)||void 0===o&&c!==d)return!1}return!0}},function(e,t,n){"use strict";t.a=function(e){function t(e,t,r){var o=t.trim().split(g);t=o;var i=o.length,a=e.length;switch(a){case 0:case 1:var s=0;for(e=0===a?"":e[0]+" ";s<i;++s)t[s]=n(e,t[s],r).trim();break;default:var u=s=0;for(t=[];s<i;++s)for(var l=0;l<a;++l)t[u++]=n(e[l]+" ",o[s],r).trim()}return t}function n(e,t,n){var r=t.charCodeAt(0);switch(33>r&&(r=(t=t.trim()).charCodeAt(0)),r){case 38:return t.replace(m,"$1"+e.trim());case 58:return e.trim()+t.replace(m,"$1"+e.trim());default:if(0<1*n&&0<t.indexOf("\f"))return t.replace(m,(58===e.charCodeAt(0)?"":"$1")+e.trim())}return e+t}function r(e,t,n,i){var a=e+";",s=2*t+3*n+4*i;if(944===s){e=a.indexOf(":",9)+1;var u=a.substring(e,a.length-1).trim();return u=a.substring(0,e).trim()+u+";",1===I||2===I&&o(u,1)?"-webkit-"+u+u:u}if(0===I||2===I&&!o(a,1))return a;switch(s){case 1015:return 97===a.charCodeAt(10)?"-webkit-"+a+a:a;case 951:return 116===a.charCodeAt(3)?"-webkit-"+a+a:a;case 963:return 110===a.charCodeAt(5)?"-webkit-"+a+a:a;case 1009:if(100!==a.charCodeAt(4))break;case 969:case 942:return"-webkit-"+a+a;case 978:return"-webkit-"+a+"-moz-"+a+a;case 1019:case 983:return"-webkit-"+a+"-moz-"+a+"-ms-"+a+a;case 883:if(45===a.charCodeAt(8))return"-webkit-"+a+a;if(0<a.indexOf("image-set(",11))return a.replace(P,"$1-webkit-$2")+a;break;case 932:if(45===a.charCodeAt(4))switch(a.charCodeAt(5)){case 103:return"-webkit-box-"+a.replace("-grow","")+"-webkit-"+a+"-ms-"+a.replace("grow","positive")+a;case 115:return"-webkit-"+a+"-ms-"+a.replace("shrink","negative")+a;case 98:return"-webkit-"+a+"-ms-"+a.replace("basis","preferred-size")+a}return"-webkit-"+a+"-ms-"+a+a;case 964:return"-webkit-"+a+"-ms-flex-"+a+a;case 1023:if(99!==a.charCodeAt(8))break;return"-webkit-box-pack"+(u=a.substring(a.indexOf(":",15)).replace("flex-","").replace("space-between","justify"))+"-webkit-"+a+"-ms-flex-pack"+u+a;case 1005:return f.test(a)?a.replace(d,":-webkit-")+a.replace(d,":-moz-")+a:a;case 1e3:switch(t=(u=a.substring(13).trim()).indexOf("-")+1,u.charCodeAt(0)+u.charCodeAt(t)){case 226:u=a.replace(b,"tb");break;case 232:u=a.replace(b,"tb-rl");break;case 220:u=a.replace(b,"lr");break;default:return a}return"-webkit-"+a+"-ms-"+u+a;case 1017:if(-1===a.indexOf("sticky",9))break;case 975:switch(t=(a=e).length-10,s=(u=(33===a.charCodeAt(t)?a.substring(0,t):a).substring(e.indexOf(":",7)+1).trim()).charCodeAt(0)+(0|u.charCodeAt(7))){case 203:if(111>u.charCodeAt(8))break;case 115:a=a.replace(u,"-webkit-"+u)+";"+a;break;case 207:case 102:a=a.replace(u,"-webkit-"+(102<s?"inline-":"")+"box")+";"+a.replace(u,"-webkit-"+u)+";"+a.replace(u,"-ms-"+u+"box")+";"+a}return a+";";case 938:if(45===a.charCodeAt(5))switch(a.charCodeAt(6)){case 105:return u=a.replace("-items",""),"-webkit-"+a+"-webkit-box-"+u+"-ms-flex-"+u+a;case 115:return"-webkit-"+a+"-ms-flex-item-"+a.replace(R,"")+a;default:return"-webkit-"+a+"-ms-flex-line-pack"+a.replace("align-content","").replace(R,"")+a}break;case 973:case 989:if(45!==a.charCodeAt(3)||122===a.charCodeAt(4))break;case 931:case 953:if(!0===x.test(e))return 115===(u=e.substring(e.indexOf(":")+1)).charCodeAt(0)?r(e.replace("stretch","fill-available"),t,n,i).replace(":fill-available",":stretch"):a.replace(u,"-webkit-"+u)+a.replace(u,"-moz-"+u.replace("fill-",""))+a;break;case 962:if(a="-webkit-"+a+(102===a.charCodeAt(5)?"-ms-"+a:"")+a,211===n+i&&105===a.charCodeAt(13)&&0<a.indexOf("transform",10))return a.substring(0,a.indexOf(";",27)+1).replace(p,"$1-webkit-$2")+a}return a}function o(e,t){var n=e.indexOf(1===t?":":"{"),r=e.substring(0,3!==t?n:10);return n=e.substring(n+1,e.length-1),B(2!==t?r:r.replace(C,"$1"),n,t)}function i(e,t){var n=r(t,t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2));return n!==t+";"?n.replace(S," or ($1)").substring(4):"("+t+")"}function a(e,t,n,r,o,i,a,s,l,c){for(var d,f=0,p=t;f<F;++f)switch(d=j[f].call(u,e,p,n,r,o,i,a,s,l,c)){case void 0:case!1:case!0:case null:break;default:p=d}if(p!==t)return p}function s(e){return void 0!==(e=e.prefix)&&(B=null,e?"function"!=typeof e?I=1:(I=2,B=e):I=0),s}function u(e,n){var s=e;if(33>s.charCodeAt(0)&&(s=s.trim()),s=[s],0<F){var u=a(-1,n,s,s,k,O,0,0,0,0);void 0!==u&&"string"==typeof u&&(n=u)}var d=function e(n,s,u,d,f){for(var p,g,m,b,S,R=0,C=0,x=0,P=0,j=0,B=0,G=m=p=0,_=0,M=0,z=0,H=0,D=u.length,N=D-1,W="",L="",$="",V="";_<D;){if(g=u.charCodeAt(_),_===N&&0!==C+P+x+R&&(0!==C&&(g=47===C?10:47),P=x=R=0,D++,N++),0===C+P+x+R){if(_===N&&(0<M&&(W=W.replace(c,"")),0<W.trim().length)){switch(g){case 32:case 9:case 59:case 13:case 10:break;default:W+=u.charAt(_)}g=59}switch(g){case 123:for(p=(W=W.trim()).charCodeAt(0),m=1,H=++_;_<D;){switch(g=u.charCodeAt(_)){case 123:m++;break;case 125:m--;break;case 47:switch(g=u.charCodeAt(_+1)){case 42:case 47:e:{for(G=_+1;G<N;++G)switch(u.charCodeAt(G)){case 47:if(42===g&&42===u.charCodeAt(G-1)&&_+2!==G){_=G+1;break e}break;case 10:if(47===g){_=G+1;break e}}_=G}}break;case 91:g++;case 40:g++;case 34:case 39:for(;_++<N&&u.charCodeAt(_)!==g;);}if(0===m)break;_++}switch(m=u.substring(H,_),0===p&&(p=(W=W.replace(l,"").trim()).charCodeAt(0)),p){case 64:switch(0<M&&(W=W.replace(c,"")),g=W.charCodeAt(1)){case 100:case 109:case 115:case 45:M=s;break;default:M=A}if(H=(m=e(s,M,m,g,f+1)).length,0<F&&(S=a(3,m,M=t(A,W,z),s,k,O,H,g,f,d),W=M.join(""),void 0!==S&&0===(H=(m=S.trim()).length)&&(g=0,m="")),0<H)switch(g){case 115:W=W.replace(w,i);case 100:case 109:case 45:m=W+"{"+m+"}";break;case 107:m=(W=W.replace(h,"$1 $2"))+"{"+m+"}",m=1===I||2===I&&o("@"+m,3)?"@-webkit-"+m+"@"+m:"@"+m;break;default:m=W+m,112===d&&(L+=m,m="")}else m="";break;default:m=e(s,t(s,W,z),m,d,f+1)}$+=m,m=z=M=G=p=0,W="",g=u.charCodeAt(++_);break;case 125:case 59:if(1<(H=(W=(0<M?W.replace(c,""):W).trim()).length))switch(0===G&&(p=W.charCodeAt(0),45===p||96<p&&123>p)&&(H=(W=W.replace(" ",":")).length),0<F&&void 0!==(S=a(1,W,s,n,k,O,L.length,d,f,d))&&0===(H=(W=S.trim()).length)&&(W="\0\0"),p=W.charCodeAt(0),g=W.charCodeAt(1),p){case 0:break;case 64:if(105===g||99===g){V+=W+u.charAt(_);break}default:58!==W.charCodeAt(H-1)&&(L+=r(W,p,g,W.charCodeAt(2)))}z=M=G=p=0,W="",g=u.charCodeAt(++_)}}switch(g){case 13:case 10:47===C?C=0:0===1+p&&107!==d&&0<W.length&&(M=1,W+="\0"),0<F*T&&a(0,W,s,n,k,O,L.length,d,f,d),O=1,k++;break;case 59:case 125:if(0===C+P+x+R){O++;break}default:switch(O++,b=u.charAt(_),g){case 9:case 32:if(0===P+R+C)switch(j){case 44:case 58:case 9:case 32:b="";break;default:32!==g&&(b=" ")}break;case 0:b="\\0";break;case 12:b="\\f";break;case 11:b="\\v";break;case 38:0===P+C+R&&(M=z=1,b="\f"+b);break;case 108:if(0===P+C+R+E&&0<G)switch(_-G){case 2:112===j&&58===u.charCodeAt(_-3)&&(E=j);case 8:111===B&&(E=B)}break;case 58:0===P+C+R&&(G=_);break;case 44:0===C+x+P+R&&(M=1,b+="\r");break;case 34:case 39:0===C&&(P=P===g?0:0===P?g:P);break;case 91:0===P+C+x&&R++;break;case 93:0===P+C+x&&R--;break;case 41:0===P+C+R&&x--;break;case 40:if(0===P+C+R){if(0===p)switch(2*j+3*B){case 533:break;default:p=1}x++}break;case 64:0===C+x+P+R+G+m&&(m=1);break;case 42:case 47:if(!(0<P+R+x))switch(C){case 0:switch(2*g+3*u.charCodeAt(_+1)){case 235:C=47;break;case 220:H=_,C=42}break;case 42:47===g&&42===j&&H+2!==_&&(33===u.charCodeAt(H+2)&&(L+=u.substring(H,_+1)),b="",C=0)}}0===C&&(W+=b)}B=j,j=g,_++}if(0<(H=L.length)){if(M=s,0<F&&(void 0!==(S=a(2,L,M,n,k,O,H,d,f,d))&&0===(L=S).length))return V+L+$;if(L=M.join(",")+"{"+L+"}",0!=I*E){switch(2!==I||o(L,2)||(E=0),E){case 111:L=L.replace(y,":-moz-$1")+L;break;case 112:L=L.replace(v,"::-webkit-input-$1")+L.replace(v,"::-moz-$1")+L.replace(v,":-ms-input-$1")+L}E=0}}return V+L+$}(A,s,n,0,0);return 0<F&&(void 0!==(u=a(-2,d,s,s,k,O,d.length,0,0,0))&&(d=u)),"",E=0,O=k=1,d}var l=/^\0+/g,c=/[\0\r\f]/g,d=/: */g,f=/zoo|gra/,p=/([,: ])(transform)/g,g=/,\r+?/g,m=/([\t\r\n ])*\f?&/g,h=/@(k\w+)\s*(\S*)\s*/,v=/::(place)/g,y=/:(read-only)/g,b=/[svh]\w+-[tblr]{2}/,w=/\(\s*(.*)\s*\)/g,S=/([\s\S]*?);/g,R=/-self|flex-/g,C=/[^]*?(:[rp][el]a[\w-]+)[^]*/,x=/stretch|:\s*\w+\-(?:conte|avail)/,P=/([^-])(image-set\()/,O=1,k=1,E=0,I=1,A=[],j=[],F=0,B=null,T=0;return u.use=function e(t){switch(t){case void 0:case null:F=j.length=0;break;default:if("function"==typeof t)j[F++]=t;else if("object"==typeof t)for(var n=0,r=t.length;n<r;++n)e(t[n]);else T=0|!!t}return e},u.set=s,void 0!==e&&s(e),u}},function(e,t,n){"use strict";t.a={animationIterationCount:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1}},,,function(e,t){var n,r,o=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function s(e){if(n===setTimeout)return setTimeout(e,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:i}catch(e){n=i}try{r="function"==typeof clearTimeout?clearTimeout:a}catch(e){r=a}}();var u,l=[],c=!1,d=-1;function f(){c&&u&&(c=!1,u.length?l=u.concat(l):d=-1,l.length&&p())}function p(){if(!c){var e=s(f);c=!0;for(var t=l.length;t;){for(u=l,l=[];++d<t;)u&&u[d].run();d=-1,t=l.length}u=null,c=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===a||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function g(e,t){this.fun=e,this.array=t}function m(){}o.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];l.push(new g(e,t)),1!==l.length||c||s(p)},g.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=m,o.addListener=m,o.once=m,o.off=m,o.removeListener=m,o.removeAllListeners=m,o.emit=m,o.prependListener=m,o.prependOnceListener=m,o.listeners=function(e){return[]},o.binding=function(e){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(e){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(e,t,n){"use strict";
|
2 |
/** @license React v16.13.1
|
3 |
* react-is.production.min.js
|
4 |
*
|
deprecated/assets/audio/smw_power_up.wav
DELETED
Binary file
|
deprecated/assets/css/admin-modal.css
DELETED
@@ -1,432 +0,0 @@
|
|
1 |
-
|
2 |
-
/*------------------------------------------------------------------------------
|
3 |
-
nf-admin-modal
|
4 |
-
------------------------------------------------------------------------------*/
|
5 |
-
|
6 |
-
#nf-admin-modal-wrap {
|
7 |
-
display: none;
|
8 |
-
background-color: #fff;
|
9 |
-
-webkit-box-shadow: 0 3px 6px rgba( 0, 0, 0, 0.3 );
|
10 |
-
box-shadow: 0 3px 6px rgba( 0, 0, 0, 0.3 );
|
11 |
-
width: 500px;
|
12 |
-
margin-left: -250px;
|
13 |
-
margin-top: -125px;
|
14 |
-
position: fixed;
|
15 |
-
top: 50%;
|
16 |
-
left: 50%;
|
17 |
-
z-index: 100105;
|
18 |
-
-webkit-transition: height 0.2s, margin-top 0.2s;
|
19 |
-
transition: height 0.2s, margin-top 0.2s;
|
20 |
-
}
|
21 |
-
|
22 |
-
#nf-admin-modal-backdrop {
|
23 |
-
display: none;
|
24 |
-
position: fixed;
|
25 |
-
top: 0;
|
26 |
-
left: 0;
|
27 |
-
right: 0;
|
28 |
-
bottom: 0;
|
29 |
-
min-height: 360px;
|
30 |
-
background: #000;
|
31 |
-
opacity: 0.7;
|
32 |
-
filter: alpha(opacity=70);
|
33 |
-
z-index: 100100;
|
34 |
-
}
|
35 |
-
|
36 |
-
#nf-admin-modal {
|
37 |
-
position: relative;
|
38 |
-
height: 100%;
|
39 |
-
}
|
40 |
-
|
41 |
-
#nf-admin-modal-wrap.search-panel-visible {
|
42 |
-
height: 500px;
|
43 |
-
margin-top: -250px;
|
44 |
-
}
|
45 |
-
|
46 |
-
#admin-modal-title {
|
47 |
-
background: #fcfcfc;
|
48 |
-
border-bottom: 1px solid #dfdfdf;
|
49 |
-
height: 36px;
|
50 |
-
font-size: 18px;
|
51 |
-
font-weight: 600;
|
52 |
-
line-height: 36px;
|
53 |
-
padding: 0 36px 0 16px;
|
54 |
-
top: 0;
|
55 |
-
right: 0;
|
56 |
-
left: 0;
|
57 |
-
}
|
58 |
-
|
59 |
-
#nf-admin-modal-close {
|
60 |
-
color: #666;
|
61 |
-
padding: 0;
|
62 |
-
position: absolute;
|
63 |
-
top: 0;
|
64 |
-
right: 0;
|
65 |
-
width: 36px;
|
66 |
-
height: 36px;
|
67 |
-
text-align: center;
|
68 |
-
background: none;
|
69 |
-
border: none;
|
70 |
-
cursor: pointer;
|
71 |
-
}
|
72 |
-
|
73 |
-
#nf-admin-modal-close:before {
|
74 |
-
font: normal 20px/36px 'dashicons';
|
75 |
-
vertical-align: top;
|
76 |
-
speak: none;
|
77 |
-
-webkit-font-smoothing: antialiased;
|
78 |
-
-moz-osx-font-smoothing: grayscale;
|
79 |
-
width: 36px;
|
80 |
-
height: 36px;
|
81 |
-
content: '\f158';
|
82 |
-
}
|
83 |
-
|
84 |
-
#nf-admin-modal-close:hover,
|
85 |
-
#nf-admin-modal-close:focus {
|
86 |
-
color: #2ea2cc;
|
87 |
-
}
|
88 |
-
|
89 |
-
#nf-admin-modal-close:focus {
|
90 |
-
outline: none;
|
91 |
-
-webkit-box-shadow:
|
92 |
-
0 0 0 1px #5b9dd9,
|
93 |
-
0 0 2px 1px rgba(30, 140, 190, .8);
|
94 |
-
box-shadow:
|
95 |
-
0 0 0 1px #5b9dd9,
|
96 |
-
0 0 2px 1px rgba(30, 140, 190, .8);
|
97 |
-
}
|
98 |
-
|
99 |
-
.admin-modal-inside {
|
100 |
-
padding: 0 16px 50px;
|
101 |
-
}
|
102 |
-
|
103 |
-
#nf-admin-modal-wrap.search-panel-visible .admin-modal-inside {
|
104 |
-
padding: 0 16px;
|
105 |
-
position: absolute;
|
106 |
-
top: 36px;
|
107 |
-
left: 0;
|
108 |
-
right: 0;
|
109 |
-
bottom: 44px;
|
110 |
-
}
|
111 |
-
|
112 |
-
#nf-admin-modal ol,
|
113 |
-
#nf-admin-modal ul {
|
114 |
-
list-style: none;
|
115 |
-
margin: 0;
|
116 |
-
padding: 0;
|
117 |
-
}
|
118 |
-
|
119 |
-
#nf-admin-modal-search-toggle:after {
|
120 |
-
display: inline-block;
|
121 |
-
font: normal 20px/1 'dashicons';
|
122 |
-
vertical-align: top;
|
123 |
-
speak: none;
|
124 |
-
-webkit-font-smoothing: antialiased;
|
125 |
-
-moz-osx-font-smoothing: grayscale;
|
126 |
-
content: '\f140';
|
127 |
-
}
|
128 |
-
|
129 |
-
.search-panel-visible #nf-admin-modal-search-toggle:after {
|
130 |
-
content: '\f142';
|
131 |
-
}
|
132 |
-
|
133 |
-
#nf-admin-modal input[type="text"] {
|
134 |
-
-webkit-box-sizing: border-box;
|
135 |
-
-moz-box-sizing: border-box;
|
136 |
-
box-sizing: border-box;
|
137 |
-
}
|
138 |
-
|
139 |
-
#nf-admin-modal #admin-modal-options {
|
140 |
-
padding: 8px 0 12px;
|
141 |
-
}
|
142 |
-
|
143 |
-
#nf-admin-modal p.howto {
|
144 |
-
margin: 3px 0;
|
145 |
-
}
|
146 |
-
|
147 |
-
#nf-admin-modal p.howto a {
|
148 |
-
text-decoration: none;
|
149 |
-
color: inherit;
|
150 |
-
}
|
151 |
-
|
152 |
-
#nf-admin-modal-search-toggle {
|
153 |
-
cursor: pointer;
|
154 |
-
}
|
155 |
-
|
156 |
-
#nf-admin-modal label input[type="text"] {
|
157 |
-
margin-top: 5px;
|
158 |
-
width: 70%;
|
159 |
-
}
|
160 |
-
|
161 |
-
#nf-admin-modal #admin-modal-options label span,
|
162 |
-
#nf-admin-modal #search-panel label span.search-label {
|
163 |
-
display: inline-block;
|
164 |
-
width: 80px;
|
165 |
-
text-align: right;
|
166 |
-
padding-right: 5px;
|
167 |
-
max-width: 24%;
|
168 |
-
}
|
169 |
-
|
170 |
-
#nf-admin-modal .admin-modal-search-field {
|
171 |
-
float: left;
|
172 |
-
width: 250px;
|
173 |
-
max-width: 70%;
|
174 |
-
}
|
175 |
-
|
176 |
-
#nf-admin-modal .admin-modal-search-wrapper {
|
177 |
-
margin: 5px 0 9px;
|
178 |
-
display: block;
|
179 |
-
overflow: hidden;
|
180 |
-
}
|
181 |
-
|
182 |
-
#nf-admin-modal .admin-modal-search-wrapper span {
|
183 |
-
float: left;
|
184 |
-
margin-top: 4px;
|
185 |
-
}
|
186 |
-
|
187 |
-
#nf-admin-modal .admin-modal-search-wrapper .spinner {
|
188 |
-
display: none;
|
189 |
-
vertical-align: text-bottom;
|
190 |
-
}
|
191 |
-
|
192 |
-
#nf-admin-modal .admin-modal-target {
|
193 |
-
padding: 3px 0 0;
|
194 |
-
white-space: nowrap;
|
195 |
-
overflow: hidden;
|
196 |
-
text-overflow: ellipsis;
|
197 |
-
}
|
198 |
-
|
199 |
-
#nf-admin-modal .admin-modal-target label {
|
200 |
-
max-width: 70%;
|
201 |
-
}
|
202 |
-
|
203 |
-
#nf-admin-modal .query-results {
|
204 |
-
border: 1px #dfdfdf solid;
|
205 |
-
margin: 0;
|
206 |
-
background: #fff;
|
207 |
-
overflow: auto;
|
208 |
-
position: absolute;
|
209 |
-
left: 16px;
|
210 |
-
right: 16px;
|
211 |
-
bottom: 16px;
|
212 |
-
top: 205px;
|
213 |
-
}
|
214 |
-
|
215 |
-
#nf-admin-modal li {
|
216 |
-
clear: both;
|
217 |
-
margin-bottom: 0;
|
218 |
-
border-bottom: 1px solid #f1f1f1;
|
219 |
-
color: #333;
|
220 |
-
padding: 4px 6px 4px 10px;
|
221 |
-
cursor: pointer;
|
222 |
-
position: relative;
|
223 |
-
}
|
224 |
-
|
225 |
-
#nf-admin-modal .query-notice {
|
226 |
-
padding: 0;
|
227 |
-
border-bottom: 1px solid #dfdfdf;
|
228 |
-
background-color: #f7fcfe;
|
229 |
-
color: #000;
|
230 |
-
}
|
231 |
-
|
232 |
-
#nf-admin-modal .query-notice .query-notice-default,
|
233 |
-
#nf-admin-modal .query-notice .query-notice-hint {
|
234 |
-
display: block;
|
235 |
-
padding: 6px;
|
236 |
-
border-left: 4px solid #2ea2cc;
|
237 |
-
}
|
238 |
-
|
239 |
-
#nf-admin-modal .unselectable.no-matches-found {
|
240 |
-
padding: 0;
|
241 |
-
border-bottom: 1px solid #dfdfdf;
|
242 |
-
background-color: #fef7f1;
|
243 |
-
}
|
244 |
-
|
245 |
-
#nf-admin-modal .no-matches-found .item-title {
|
246 |
-
display: block;
|
247 |
-
padding: 6px;
|
248 |
-
border-left: 4px solid #d54e21;
|
249 |
-
}
|
250 |
-
|
251 |
-
#nf-admin-modal .query-results em {
|
252 |
-
font-style: normal;
|
253 |
-
}
|
254 |
-
|
255 |
-
#nf-admin-modal li:hover {
|
256 |
-
background: #eaf2fa;
|
257 |
-
color: #151515;
|
258 |
-
}
|
259 |
-
|
260 |
-
#nf-admin-modal li.unselectable {
|
261 |
-
border-bottom: 1px solid #dfdfdf;
|
262 |
-
}
|
263 |
-
|
264 |
-
#nf-admin-modal li.unselectable:hover {
|
265 |
-
background: #fff;
|
266 |
-
cursor: auto;
|
267 |
-
color: #333;
|
268 |
-
}
|
269 |
-
|
270 |
-
#nf-admin-modal li.selected {
|
271 |
-
background: #ddd;
|
272 |
-
color: #333;
|
273 |
-
}
|
274 |
-
|
275 |
-
#nf-admin-modal li.selected .item-title {
|
276 |
-
font-weight: bold;
|
277 |
-
}
|
278 |
-
|
279 |
-
#nf-admin-modal li:last-child {
|
280 |
-
border: none;
|
281 |
-
}
|
282 |
-
|
283 |
-
#nf-admin-modal .item-title {
|
284 |
-
display: inline-block;
|
285 |
-
width: 80%;
|
286 |
-
width: -webkit-calc(100% - 68px);
|
287 |
-
width: calc(100% - 68px);
|
288 |
-
}
|
289 |
-
|
290 |
-
#nf-admin-modal .item-info {
|
291 |
-
text-transform: uppercase;
|
292 |
-
color: #666;
|
293 |
-
font-size: 11px;
|
294 |
-
position: absolute;
|
295 |
-
right: 5px;
|
296 |
-
top: 5px;
|
297 |
-
}
|
298 |
-
|
299 |
-
#nf-admin-modal #search-results,
|
300 |
-
#nf-admin-modal #search-panel {
|
301 |
-
display: none;
|
302 |
-
}
|
303 |
-
|
304 |
-
#nf-admin-modal-wrap.search-panel-visible #search-panel {
|
305 |
-
display: block;
|
306 |
-
}
|
307 |
-
|
308 |
-
#nf-admin-modal .river-waiting {
|
309 |
-
display: none;
|
310 |
-
padding: 10px 0;
|
311 |
-
}
|
312 |
-
|
313 |
-
#nf-admin-modal .river-waiting .spinner {
|
314 |
-
margin: 0 auto;
|
315 |
-
display: block;
|
316 |
-
float: none;
|
317 |
-
}
|
318 |
-
|
319 |
-
#nf-admin-modal .submitbox {
|
320 |
-
padding: 8px 16px;
|
321 |
-
background: #fcfcfc;
|
322 |
-
border-top: 1px solid #dfdfdf;
|
323 |
-
position: absolute;
|
324 |
-
bottom: 0;
|
325 |
-
left: 0;
|
326 |
-
right: 0;
|
327 |
-
}
|
328 |
-
|
329 |
-
#nf-admin-modal-cancel {
|
330 |
-
line-height: 25px;
|
331 |
-
float: left;
|
332 |
-
}
|
333 |
-
|
334 |
-
#nf-admin-modal-update {
|
335 |
-
line-height: 23px;
|
336 |
-
float: right;
|
337 |
-
}
|
338 |
-
|
339 |
-
#nf-admin-modal-submit {
|
340 |
-
float: right;
|
341 |
-
margin-bottom: 0;
|
342 |
-
}
|
343 |
-
|
344 |
-
@media screen and ( max-width: 782px ) {
|
345 |
-
#nf-admin-modal-wrap {
|
346 |
-
margin-top: -140px;
|
347 |
-
}
|
348 |
-
|
349 |
-
#nf-admin-modal-wrap.search-panel-visible .query-results {
|
350 |
-
top: 235px;
|
351 |
-
}
|
352 |
-
|
353 |
-
.admin-modal-inside {
|
354 |
-
padding: 0 16px 60px;
|
355 |
-
}
|
356 |
-
|
357 |
-
#nf-admin-modal-wrap.search-panel-visible .admin-modal-inside {
|
358 |
-
bottom: 52px;
|
359 |
-
}
|
360 |
-
|
361 |
-
#nf-admin-modal-cancel {
|
362 |
-
line-height: 32px;
|
363 |
-
}
|
364 |
-
}
|
365 |
-
|
366 |
-
@media screen and ( max-width: 520px ) {
|
367 |
-
#nf-admin-modal-wrap {
|
368 |
-
width: auto;
|
369 |
-
margin-left: 0;
|
370 |
-
left: 10px;
|
371 |
-
right: 10px;
|
372 |
-
max-width: 500px;
|
373 |
-
}
|
374 |
-
}
|
375 |
-
|
376 |
-
@media screen and ( max-height: 520px ) {
|
377 |
-
#nf-admin-modal-wrap {
|
378 |
-
-webkit-transition: none;
|
379 |
-
transition: none;
|
380 |
-
}
|
381 |
-
|
382 |
-
#nf-admin-modal-wrap.search-panel-visible {
|
383 |
-
height: auto;
|
384 |
-
margin-top: 0;
|
385 |
-
top: 10px;
|
386 |
-
bottom: 10px;
|
387 |
-
}
|
388 |
-
|
389 |
-
.search-panel-visible .admin-modal-inside {
|
390 |
-
overflow: auto;
|
391 |
-
}
|
392 |
-
|
393 |
-
.search-panel-visible #search-panel .query-results {
|
394 |
-
position: static;
|
395 |
-
}
|
396 |
-
}
|
397 |
-
|
398 |
-
@media screen and ( max-height: 290px ) {
|
399 |
-
#nf-admin-modal-wrap {
|
400 |
-
height: auto;
|
401 |
-
margin-top: 0;
|
402 |
-
top: 10px;
|
403 |
-
bottom: 10px;
|
404 |
-
}
|
405 |
-
|
406 |
-
.admin-modal-inside {
|
407 |
-
overflow: auto;
|
408 |
-
height: -webkit-calc(100% - 92px);
|
409 |
-
height: calc(100% - 92px);
|
410 |
-
padding-bottom: 2px;
|
411 |
-
}
|
412 |
-
|
413 |
-
#search-panel .query-results {
|
414 |
-
position: static;
|
415 |
-
}
|
416 |
-
}
|
417 |
-
|
418 |
-
#nf-admin-modal .query-results {
|
419 |
-
border: 1px solid #ddd;
|
420 |
-
-webkit-border-radius: 0;
|
421 |
-
border-radius: 0;
|
422 |
-
-webkit-box-shadow: inset 0 1px 2px rgba(0,0,0,0.07);
|
423 |
-
box-shadow: inset 0 1px 2px rgba(0,0,0,0.07);
|
424 |
-
-webkit-transition: .05s all ease-in-out;
|
425 |
-
transition: .05s all ease-in-out;
|
426 |
-
}
|
427 |
-
|
428 |
-
#nf-admin-modal .query-results:focus {
|
429 |
-
border-color: #5b9dd9;
|
430 |
-
-webkit-box-shadow: 0 0 2px rgba(30,140,190,0.8);
|
431 |
-
box-shadow: 0 0 2px rgba(30,140,190,0.8);
|
432 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/assets/css/admin-notices.css
DELETED
@@ -1,55 +0,0 @@
|
|
1 |
-
.nf-admin-notice {
|
2 |
-
background: #fff;
|
3 |
-
border-color: #ED494D;
|
4 |
-
border-top: 4px;
|
5 |
-
display: block;
|
6 |
-
min-height: 68px;
|
7 |
-
padding: 10px 40px 10px 145px;
|
8 |
-
position: relative;
|
9 |
-
}
|
10 |
-
.nf-admin-notice a {
|
11 |
-
color: #ED494D;
|
12 |
-
}
|
13 |
-
.nf-notice-logo {
|
14 |
-
clear: both;
|
15 |
-
content: "";
|
16 |
-
display: block;
|
17 |
-
background-image: url("../images/nf-logo-vert.png");
|
18 |
-
background-size: 125px 83px;
|
19 |
-
background-repeat: no-repeat;
|
20 |
-
background-position: 0 45%;
|
21 |
-
width: 125px;
|
22 |
-
position: absolute;
|
23 |
-
top: 0;
|
24 |
-
bottom: 0;
|
25 |
-
left: 5px;
|
26 |
-
}
|
27 |
-
.nf-admin-notice > .dashicons {
|
28 |
-
color: #424242;
|
29 |
-
position: absolute;
|
30 |
-
right: 20px;
|
31 |
-
top: 40%;
|
32 |
-
}
|
33 |
-
.nf-notice-title {
|
34 |
-
font-size: 24px;
|
35 |
-
margin: 0;
|
36 |
-
}
|
37 |
-
.nf-notice-body {
|
38 |
-
font-weight: normal;
|
39 |
-
margin: 5px 0;
|
40 |
-
}
|
41 |
-
.nf-notice-body:after {
|
42 |
-
clear: both;
|
43 |
-
content: "";
|
44 |
-
display: block;
|
45 |
-
}
|
46 |
-
.nf-notice-body li {
|
47 |
-
float: left;
|
48 |
-
margin-right: 20px;
|
49 |
-
}
|
50 |
-
.nf-notice-body .dashicons {
|
51 |
-
font-size: 17px;
|
52 |
-
}
|
53 |
-
.nf-red {
|
54 |
-
color: #ED494D;
|
55 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/assets/css/bootstrap-tokenfield.css
DELETED
@@ -1,209 +0,0 @@
|
|
1 |
-
/*!
|
2 |
-
* bootstrap-tokenfield
|
3 |
-
* https://github.com/sliptree/bootstrap-tokenfield
|
4 |
-
* Copyright 2013-2014 Sliptree and other contributors; Licensed MIT
|
5 |
-
*/
|
6 |
-
@-webkit-keyframes 'blink' {
|
7 |
-
0% {
|
8 |
-
border-color: #ededed;
|
9 |
-
}
|
10 |
-
100% {
|
11 |
-
border-color: #b94a48;
|
12 |
-
}
|
13 |
-
}
|
14 |
-
@-moz-keyframes 'blink' {
|
15 |
-
0% {
|
16 |
-
border-color: #ededed;
|
17 |
-
}
|
18 |
-
100% {
|
19 |
-
border-color: #b94a48;
|
20 |
-
}
|
21 |
-
}
|
22 |
-
@keyframes 'blink' {
|
23 |
-
0% {
|
24 |
-
border-color: #ededed;
|
25 |
-
}
|
26 |
-
100% {
|
27 |
-
border-color: #b94a48;
|
28 |
-
}
|
29 |
-
}
|
30 |
-
.tokenfield {
|
31 |
-
height: auto;
|
32 |
-
min-height: 34px;
|
33 |
-
padding-bottom: 0px;
|
34 |
-
}
|
35 |
-
.tokenfield.focus {
|
36 |
-
border-color: #66afe9;
|
37 |
-
outline: 0;
|
38 |
-
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px rgba(102, 175, 233, 0.6);
|
39 |
-
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px rgba(102, 175, 233, 0.6);
|
40 |
-
}
|
41 |
-
.tokenfield .token {
|
42 |
-
-webkit-box-sizing: border-box;
|
43 |
-
-moz-box-sizing: border-box;
|
44 |
-
box-sizing: border-box;
|
45 |
-
-webkit-border-radius: 3px;
|
46 |
-
-moz-border-radius: 3px;
|
47 |
-
border-radius: 3px;
|
48 |
-
display: inline-block;
|
49 |
-
border: 1px solid #d9d9d9;
|
50 |
-
background-color: #ededed;
|
51 |
-
white-space: nowrap;
|
52 |
-
margin: -1px 5px 5px 0;
|
53 |
-
height: 22px;
|
54 |
-
vertical-align: top;
|
55 |
-
cursor: default;
|
56 |
-
}
|
57 |
-
.tokenfield .token:hover {
|
58 |
-
border-color: #b9b9b9;
|
59 |
-
}
|
60 |
-
.tokenfield .token.active {
|
61 |
-
border-color: #52a8ec;
|
62 |
-
border-color: rgba(82, 168, 236, 0.8);
|
63 |
-
}
|
64 |
-
.tokenfield .token.duplicate {
|
65 |
-
border-color: #ebccd1;
|
66 |
-
-webkit-animation-name: blink;
|
67 |
-
animation-name: blink;
|
68 |
-
-webkit-animation-duration: 0.1s;
|
69 |
-
animation-duration: 0.1s;
|
70 |
-
-webkit-animation-direction: normal;
|
71 |
-
animation-direction: normal;
|
72 |
-
-webkit-animation-timing-function: ease;
|
73 |
-
animation-timing-function: ease;
|
74 |
-
-webkit-animation-iteration-count: infinite;
|
75 |
-
animation-iteration-count: infinite;
|
76 |
-
}
|
77 |
-
.tokenfield .token.invalid {
|
78 |
-
background: none;
|
79 |
-
border: 1px solid transparent;
|
80 |
-
-webkit-border-radius: 0;
|
81 |
-
-moz-border-radius: 0;
|
82 |
-
border-radius: 0;
|
83 |
-
border-bottom: 1px dotted #d9534f;
|
84 |
-
}
|
85 |
-
.tokenfield .token.invalid.active {
|
86 |
-
background: #ededed;
|
87 |
-
border: 1px solid #ededed;
|
88 |
-
-webkit-border-radius: 3px;
|
89 |
-
-moz-border-radius: 3px;
|
90 |
-
border-radius: 3px;
|
91 |
-
}
|
92 |
-
.tokenfield .token .token-label {
|
93 |
-
display: inline-block;
|
94 |
-
overflow: hidden;
|
95 |
-
text-overflow: ellipsis;
|
96 |
-
padding-left: 4px;
|
97 |
-
vertical-align: top;
|
98 |
-
}
|
99 |
-
.tokenfield .token .close {
|
100 |
-
font-family: Arial;
|
101 |
-
display: inline-block;
|
102 |
-
line-height: 100%;
|
103 |
-
font-size: 1.1em;
|
104 |
-
line-height: 1.49em;
|
105 |
-
margin-left: 5px;
|
106 |
-
float: none;
|
107 |
-
height: 100%;
|
108 |
-
vertical-align: top;
|
109 |
-
padding-right: 4px;
|
110 |
-
}
|
111 |
-
.tokenfield .token-input {
|
112 |
-
background: none;
|
113 |
-
width: 60px;
|
114 |
-
min-width: 60px;
|
115 |
-
border: 0;
|
116 |
-
height: 20px;
|
117 |
-
padding: 0;
|
118 |
-
margin-bottom: 6px;
|
119 |
-
-webkit-box-shadow: none;
|
120 |
-
box-shadow: none;
|
121 |
-
}
|
122 |
-
.tokenfield .token-input:focus {
|
123 |
-
border-color: transparent;
|
124 |
-
outline: 0;
|
125 |
-
/* IE6-9 */
|
126 |
-
-webkit-box-shadow: none;
|
127 |
-
box-shadow: none;
|
128 |
-
}
|
129 |
-
.tokenfield.disabled {
|
130 |
-
cursor: not-allowed;
|
131 |
-
background-color: #eeeeee;
|
132 |
-
}
|
133 |
-
.tokenfield.disabled .token-input {
|
134 |
-
cursor: not-allowed;
|
135 |
-
}
|
136 |
-
.tokenfield.disabled .token:hover {
|
137 |
-
cursor: not-allowed;
|
138 |
-
border-color: #d9d9d9;
|
139 |
-
}
|
140 |
-
.tokenfield.disabled .token:hover .close {
|
141 |
-
cursor: not-allowed;
|
142 |
-
opacity: 0.2;
|
143 |
-
filter: alpha(opacity=20);
|
144 |
-
}
|
145 |
-
.has-warning .tokenfield.focus {
|
146 |
-
border-color: #66512c;
|
147 |
-
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #c0a16b;
|
148 |
-
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #c0a16b;
|
149 |
-
}
|
150 |
-
.has-error .tokenfield.focus {
|
151 |
-
border-color: #843534;
|
152 |
-
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #ce8483;
|
153 |
-
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #ce8483;
|
154 |
-
}
|
155 |
-
.has-success .tokenfield.focus {
|
156 |
-
border-color: #2b542c;
|
157 |
-
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #67b168;
|
158 |
-
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #67b168;
|
159 |
-
}
|
160 |
-
.tokenfield.input-sm,
|
161 |
-
.input-group-sm .tokenfield {
|
162 |
-
min-height: 30px;
|
163 |
-
padding-bottom: 0px;
|
164 |
-
}
|
165 |
-
.input-group-sm .token,
|
166 |
-
.tokenfield.input-sm .token {
|
167 |
-
height: 20px;
|
168 |
-
margin-bottom: 4px;
|
169 |
-
}
|
170 |
-
.input-group-sm .token-input,
|
171 |
-
.tokenfield.input-sm .token-input {
|
172 |
-
height: 18px;
|
173 |
-
margin-bottom: 5px;
|
174 |
-
}
|
175 |
-
.tokenfield.input-lg,
|
176 |
-
.input-group-lg .tokenfield {
|
177 |
-
min-height: 45px;
|
178 |
-
padding-bottom: 4px;
|
179 |
-
}
|
180 |
-
.input-group-lg .token,
|
181 |
-
.tokenfield.input-lg .token {
|
182 |
-
height: 25px;
|
183 |
-
}
|
184 |
-
.input-group-lg .token-label,
|
185 |
-
.tokenfield.input-lg .token-label {
|
186 |
-
line-height: 23px;
|
187 |
-
}
|
188 |
-
.input-group-lg .token .close,
|
189 |
-
.tokenfield.input-lg .token .close {
|
190 |
-
line-height: 1.3em;
|
191 |
-
}
|
192 |
-
.input-group-lg .token-input,
|
193 |
-
.tokenfield.input-lg .token-input {
|
194 |
-
height: 23px;
|
195 |
-
line-height: 23px;
|
196 |
-
margin-bottom: 6px;
|
197 |
-
vertical-align: top;
|
198 |
-
}
|
199 |
-
.tokenfield.rtl {
|
200 |
-
direction: rtl;
|
201 |
-
text-align: right;
|
202 |
-
}
|
203 |
-
.tokenfield.rtl .token {
|
204 |
-
margin: -1px 0 5px 5px;
|
205 |
-
}
|
206 |
-
.tokenfield.rtl .token .token-label {
|
207 |
-
padding-left: 0px;
|
208 |
-
padding-right: 4px;
|
209 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/assets/css/bootstrap-tokenfield.min.css
DELETED
@@ -1,5 +0,0 @@
|
|
1 |
-
/*!
|
2 |
-
* bootstrap-tokenfield
|
3 |
-
* https://github.com/sliptree/bootstrap-tokenfield
|
4 |
-
* Copyright 2013-2014 Sliptree and other contributors; Licensed MIT
|
5 |
-
*/@-webkit-keyframes 'blink'{0%{border-color:#ededed}100%{border-color:#b94a48}}@-moz-keyframes 'blink'{0%{border-color:#ededed}100%{border-color:#b94a48}}@keyframes 'blink'{0%{border-color:#ededed}100%{border-color:#b94a48}}.tokenfield{height:auto;min-height:34px;padding-bottom:0}.tokenfield.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)}.tokenfield .token{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;display:inline-block;border:1px solid #d9d9d9;background-color:#ededed;white-space:nowrap;margin:-1px 5px 5px 0;height:22px;vertical-align:top;cursor:default}.tokenfield .token:hover{border-color:#b9b9b9}.tokenfield .token.active{border-color:#52a8ec;border-color:rgba(82,168,236,.8)}.tokenfield .token.duplicate{border-color:#ebccd1;-webkit-animation-name:blink;animation-name:blink;-webkit-animation-duration:.1s;animation-duration:.1s;-webkit-animation-direction:normal;animation-direction:normal;-webkit-animation-timing-function:ease;animation-timing-function:ease;-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite}.tokenfield .token.invalid{background:0 0;border:1px solid transparent;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;border-bottom:1px dotted #d9534f}.tokenfield .token.invalid.active{background:#ededed;border:1px solid #ededed;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.tokenfield .token .token-label{display:inline-block;overflow:hidden;text-overflow:ellipsis;padding-left:4px;vertical-align:top}.tokenfield .token .close{font-family:Arial;display:inline-block;line-height:100%;font-size:1.1em;line-height:1.49em;margin-left:5px;float:none;height:100%;vertical-align:top;padding-right:4px}.tokenfield .token-input{background:0 0;width:60px;min-width:60px;border:0;height:20px;padding:0;margin-bottom:6px;-webkit-box-shadow:none;box-shadow:none}.tokenfield .token-input:focus{border-color:transparent;outline:0;-webkit-box-shadow:none;box-shadow:none}.tokenfield.disabled{cursor:not-allowed;background-color:#eee}.tokenfield.disabled .token-input{cursor:not-allowed}.tokenfield.disabled .token:hover{cursor:not-allowed;border-color:#d9d9d9}.tokenfield.disabled .token:hover .close{cursor:not-allowed;opacity:.2;filter:alpha(opacity=20)}.has-warning .tokenfield.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}.has-error .tokenfield.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}.has-success .tokenfield.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}.tokenfield.input-sm,.input-group-sm .tokenfield{min-height:30px;padding-bottom:0}.input-group-sm .token,.tokenfield.input-sm .token{height:20px;margin-bottom:4px}.input-group-sm .token-input,.tokenfield.input-sm .token-input{height:18px;margin-bottom:5px}.tokenfield.input-lg,.input-group-lg .tokenfield{min-height:45px;padding-bottom:4px}.input-group-lg .token,.tokenfield.input-lg .token{height:25px}.input-group-lg .token-label,.tokenfield.input-lg .token-label{line-height:23px}.input-group-lg .token .close,.tokenfield.input-lg .token .close{line-height:1.3em}.input-group-lg .token-input,.tokenfield.input-lg .token-input{height:23px;line-height:23px;margin-bottom:6px;vertical-align:top}.tokenfield.rtl{direction:rtl;text-align:right}.tokenfield.rtl .token{margin:-1px 0 5px 5px}.tokenfield.rtl .token .token-label{padding-left:0;padding-right:4px}
|
|
|
|
|
|
|
|
|
|
deprecated/assets/css/combobox.css
DELETED
@@ -1,58 +0,0 @@
|
|
1 |
-
/*!
|
2 |
-
* Copyright (c) 2013 Ben Olson (https://github.com/bseth99/jquery-ui-extensions)
|
3 |
-
*
|
4 |
-
* Permission is hereby granted, free of charge, to any person
|
5 |
-
* obtaining a copy of this software and associated documentation
|
6 |
-
* files (the "Software"), to deal in the Software without
|
7 |
-
* restriction, including without limitation the rights to use,
|
8 |
-
* copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9 |
-
* copies of the Software, and to permit persons to whom the
|
10 |
-
* Software is furnished to do so, subject to the following
|
11 |
-
* conditions:
|
12 |
-
*
|
13 |
-
* The above copyright notice and this permission notice shall be
|
14 |
-
* included in all copies or substantial portions of the Software.
|
15 |
-
*
|
16 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17 |
-
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
18 |
-
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19 |
-
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
20 |
-
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
21 |
-
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
22 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
23 |
-
* OTHER DEALINGS IN THE SOFTWARE.
|
24 |
-
*
|
25 |
-
* Adapted from Jörn Zaefferer original implementation at
|
26 |
-
* http://www.learningjquery.com/2010/06/a-jquery-ui-combobox-under-the-hood
|
27 |
-
*
|
28 |
-
* And the demo at
|
29 |
-
* http://jqueryui.com/autocomplete/#combobox
|
30 |
-
*/
|
31 |
-
|
32 |
-
.ui-combobox {
|
33 |
-
display: inline-block;
|
34 |
-
margin: 0;
|
35 |
-
margin-right: 1.8em;
|
36 |
-
position: relative;
|
37 |
-
}
|
38 |
-
.ui-combobox-input {
|
39 |
-
padding: 0.2em;
|
40 |
-
margin: 0;
|
41 |
-
width: 300px;
|
42 |
-
}
|
43 |
-
.ui-combobox-button {
|
44 |
-
position: absolute;
|
45 |
-
width: 1.8em !important;
|
46 |
-
margin: 0;
|
47 |
-
margin-left: -1px;
|
48 |
-
top: 0;
|
49 |
-
bottom: 0;
|
50 |
-
}
|
51 |
-
.ui-combobox-button .ui-button-text {
|
52 |
-
padding: 0em;
|
53 |
-
}
|
54 |
-
.ui-combobox .ui-autocomplete {
|
55 |
-
max-height: 30em;
|
56 |
-
overflow-y: auto;
|
57 |
-
overflow-x: hidden;
|
58 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/assets/css/cpt.css
DELETED
@@ -1,86 +0,0 @@
|
|
1 |
-
.wp-list-table .type-nf_sub ul {
|
2 |
-
margin: 0;
|
3 |
-
}
|
4 |
-
|
5 |
-
.download-all {
|
6 |
-
float: right;
|
7 |
-
}
|
8 |
-
#postcustomstuff table td {
|
9 |
-
padding: 0 10px;
|
10 |
-
}
|
11 |
-
#postcustomstuff table input,
|
12 |
-
#postcustomstuff table select,
|
13 |
-
#postcustomstuff table textarea {
|
14 |
-
width: 100%;
|
15 |
-
}
|
16 |
-
|
17 |
-
#postcustomstuff table input[type=checkbox],
|
18 |
-
#postcustomstuff table input[type=radio] {
|
19 |
-
width: auto;
|
20 |
-
}
|
21 |
-
#postcustomstuff table textarea {
|
22 |
-
height: 150px;
|
23 |
-
}
|
24 |
-
.wrap h2 a {
|
25 |
-
font-size: 16px;
|
26 |
-
}
|
27 |
-
::-webkit-input-placeholder {
|
28 |
-
padding: 2px 5px 4px;
|
29 |
-
}
|
30 |
-
:-moz-placeholder {
|
31 |
-
padding: 2px 5px 4px;
|
32 |
-
}
|
33 |
-
::-moz-placeholder {
|
34 |
-
padding: 2px 5px 4px;
|
35 |
-
}
|
36 |
-
:-ms-input-placeholder {
|
37 |
-
padding: 2px 5px 4px;
|
38 |
-
}
|
39 |
-
#nf_fields {
|
40 |
-
/*background: transparent;
|
41 |
-
border: 0;*/
|
42 |
-
}
|
43 |
-
#postcustomstuff table {
|
44 |
-
background: transparent;
|
45 |
-
border: 0;
|
46 |
-
}
|
47 |
-
#postcustomstuff table tr td:first-child {
|
48 |
-
padding-top: 12px;
|
49 |
-
}
|
50 |
-
|
51 |
-
#nf_fields_save #major-publishing-actions {
|
52 |
-
margin: 10px -12px -12px;
|
53 |
-
}
|
54 |
-
|
55 |
-
.misc-pub-section span {
|
56 |
-
font-weight: bold;
|
57 |
-
}
|
58 |
-
|
59 |
-
.nf-sub-edit-value {
|
60 |
-
position: relative;
|
61 |
-
}
|
62 |
-
.nf-sub-edit-upload {
|
63 |
-
position: relative;
|
64 |
-
}
|
65 |
-
.nf-sub-edit-upload input[type=text] {
|
66 |
-
padding-right: 48px;
|
67 |
-
}
|
68 |
-
.nf-sub-edit-upload a {
|
69 |
-
background: #333;
|
70 |
-
color: #fff;
|
71 |
-
height: 27px;
|
72 |
-
line-height: 27px;
|
73 |
-
text-decoration: none;
|
74 |
-
padding: 0 10px;
|
75 |
-
position: absolute;
|
76 |
-
top: 8px;
|
77 |
-
right: -8px;
|
78 |
-
}
|
79 |
-
.nf-sub-edit-upload a:hover {
|
80 |
-
background: #f1f1f1;
|
81 |
-
color: #333;
|
82 |
-
}
|
83 |
-
|
84 |
-
.row-actions:not(.custom-row-actions) {
|
85 |
-
display:none;
|
86 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/assets/css/index.php
DELETED
@@ -1,2 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
// Silence is golden.
|
|
|
|
deprecated/assets/css/nf-upgrade-handler.css
DELETED
@@ -1,37 +0,0 @@
|
|
1 |
-
.nf_upgrade .menu-item-handle {
|
2 |
-
cursor: default;
|
3 |
-
}
|
4 |
-
.nf_upgrade .menu-item-handle,
|
5 |
-
.menu-item-settings.menu-item-settings--nf-upgrade {
|
6 |
-
width: 750px;
|
7 |
-
min-width: 50%;
|
8 |
-
max-width: 95%;
|
9 |
-
}
|
10 |
-
.menu-item-settings.menu-item-settings--nf-upgrade {
|
11 |
-
background-color: #FEFEFE;
|
12 |
-
}
|
13 |
-
.ui-progressbar {
|
14 |
-
position: relative;
|
15 |
-
width: 100%;
|
16 |
-
height: 20px;
|
17 |
-
background-color: #DDD;
|
18 |
-
margin-left: -7px;
|
19 |
-
border: 2px solid #CCC;
|
20 |
-
border-radius: 3px;
|
21 |
-
}
|
22 |
-
.progress-label {
|
23 |
-
font-size: .8em;
|
24 |
-
line-height: 12px;
|
25 |
-
position: absolute;
|
26 |
-
left: 40%;
|
27 |
-
top: 4px;
|
28 |
-
}
|
29 |
-
.ui-progressbar-value {
|
30 |
-
height: 20px;
|
31 |
-
background-color: #CCC;
|
32 |
-
-webkit-transition: width 1s linear;
|
33 |
-
-moz-transition: width 1s linear;
|
34 |
-
-ms-transition: width 1s linear;
|
35 |
-
-o-transition: width 1s linear;
|
36 |
-
transition: width 1s linear;
|
37 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/assets/css/notifications.css
DELETED
@@ -1,39 +0,0 @@
|
|
1 |
-
.nf-notification-inactive {
|
2 |
-
background: #f1f1f1;
|
3 |
-
}
|
4 |
-
.nf-notification-inactive td,
|
5 |
-
.nf-notification-inactive td ul,
|
6 |
-
.nf-notification-inactive td > a {
|
7 |
-
color: #bbb;
|
8 |
-
}
|
9 |
-
|
10 |
-
#ninja_forms_admin .tokenfield {
|
11 |
-
border: 1px solid #ddd;
|
12 |
-
-webkit-box-shadow: inset 0 1px 2px rgba(0,0,0,.07);
|
13 |
-
box-shadow: inset 0 1px 2px rgba(0,0,0,.07);
|
14 |
-
background-color: #fff;
|
15 |
-
color: #333;
|
16 |
-
-webkit-transition: .05s border-color ease-in-out;
|
17 |
-
transition: .05s border-color ease-in-out;
|
18 |
-
margin: 1px;
|
19 |
-
padding: 0 5px !important;
|
20 |
-
width: 25em !important;
|
21 |
-
min-height: 34px;
|
22 |
-
/*height: auto !important;*/
|
23 |
-
}
|
24 |
-
#ninja_forms_admin .tokenfield input[type=text] {
|
25 |
-
/*line-height: 33px;
|
26 |
-
height: 26px;*/
|
27 |
-
margin: 8px 0 0;
|
28 |
-
}
|
29 |
-
#ninja_forms_admin .token {
|
30 |
-
margin: 5px 5px 5px 0;
|
31 |
-
}
|
32 |
-
#ninja_forms_admin .token .close {
|
33 |
-
color: #aaa;
|
34 |
-
text-decoration: none;
|
35 |
-
line-height: 1.29em;
|
36 |
-
}
|
37 |
-
#ninja_forms_admin .token .close:hover {
|
38 |
-
color: #666;
|
39 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/assets/css/tokenfield-typeahead.css
DELETED
@@ -1,141 +0,0 @@
|
|
1 |
-
/*!
|
2 |
-
* bootstrap-tokenfield
|
3 |
-
* https://github.com/sliptree/bootstrap-tokenfield
|
4 |
-
* Copyright 2013-2014 Sliptree and other contributors; Licensed MIT
|
5 |
-
*/
|
6 |
-
/* General Typeahead styling, from http://jsfiddle.net/ragulka/Dy9au/1/ */
|
7 |
-
.twitter-typeahead {
|
8 |
-
width: 100%;
|
9 |
-
position: relative;
|
10 |
-
vertical-align: top;
|
11 |
-
}
|
12 |
-
.twitter-typeahead .tt-input,
|
13 |
-
.twitter-typeahead .tt-hint {
|
14 |
-
margin: 0;
|
15 |
-
width: 100%;
|
16 |
-
vertical-align: middle;
|
17 |
-
background-color: #ffffff;
|
18 |
-
}
|
19 |
-
.twitter-typeahead .tt-hint {
|
20 |
-
color: #999999;
|
21 |
-
z-index: 1;
|
22 |
-
border: 1px solid transparent;
|
23 |
-
}
|
24 |
-
.twitter-typeahead .tt-input {
|
25 |
-
color: #555555;
|
26 |
-
z-index: 2;
|
27 |
-
}
|
28 |
-
.twitter-typeahead .tt-input,
|
29 |
-
.twitter-typeahead .tt-hint {
|
30 |
-
height: 34px;
|
31 |
-
padding: 6px 12px;
|
32 |
-
font-size: 14px;
|
33 |
-
line-height: 1.428571429;
|
34 |
-
}
|
35 |
-
.twitter-typeahead .input-sm.tt-input,
|
36 |
-
.twitter-typeahead .hint-sm.tt-hint {
|
37 |
-
border-radius: 3px;
|
38 |
-
}
|
39 |
-
.twitter-typeahead .input-lg.tt-input,
|
40 |
-
.twitter-typeahead .hint-lg.tt-hint {
|
41 |
-
border-radius: 6px;
|
42 |
-
}
|
43 |
-
.input-group .twitter-typeahead:first-child .tt-input,
|
44 |
-
.input-group .twitter-typeahead:first-child .tt-hint {
|
45 |
-
border-radius: 4px 0 0 4px !important;
|
46 |
-
}
|
47 |
-
.input-group .twitter-typeahead:last-child .tt-input,
|
48 |
-
.input-group .twitter-typeahead:last-child .tt-hint {
|
49 |
-
border-radius: 0 4px 4px 0 !important;
|
50 |
-
}
|
51 |
-
.input-group.input-group-sm .twitter-typeahead:first-child .tt-input,
|
52 |
-
.input-group.input-group-sm .twitter-typeahead:first-child .tt-hint {
|
53 |
-
border-radius: 3px 0 0 3px !important;
|
54 |
-
}
|
55 |
-
.input-group.input-group-sm .twitter-typeahead:last-child .tt-input,
|
56 |
-
.input-group.input-group-sm .twitter-typeahead:last-child .tt-hint {
|
57 |
-
border-radius: 0 3px 3px 0 !important;
|
58 |
-
}
|
59 |
-
.input-sm.tt-input,
|
60 |
-
.hint-sm.tt-hint,
|
61 |
-
.input-group.input-group-sm .tt-input,
|
62 |
-
.input-group.input-group-sm .tt-hint {
|
63 |
-
height: 30px;
|
64 |
-
padding: 5px 10px;
|
65 |
-
font-size: 12px;
|
66 |
-
line-height: 1.5;
|
67 |
-
}
|
68 |
-
.input-group.input-group-lg .twitter-typeahead:first-child .tt-input,
|
69 |
-
.input-group.input-group-lg .twitter-typeahead:first-child .tt-hint {
|
70 |
-
border-radius: 6px 0 0 6px !important;
|
71 |
-
}
|
72 |
-
.input-group.input-group-lg .twitter-typeahead:last-child .tt-input,
|
73 |
-
.input-group.input-group-lg .twitter-typeahead:last-child .tt-hint {
|
74 |
-
border-radius: 0 6px 6px 0 !important;
|
75 |
-
}
|
76 |
-
.input-lg.tt-input,
|
77 |
-
.hint-lg.tt-hint,
|
78 |
-
.input-group.input-group-lg .tt-input,
|
79 |
-
.input-group.input-group-lg .tt-hint {
|
80 |
-
height: 45px;
|
81 |
-
padding: 10px 16px;
|
82 |
-
font-size: 18px;
|
83 |
-
line-height: 1.33;
|
84 |
-
}
|
85 |
-
.tt-dropdown-menu {
|
86 |
-
width: 100%;
|
87 |
-
min-width: 160px;
|
88 |
-
margin-top: 2px;
|
89 |
-
padding: 5px 0;
|
90 |
-
background-color: #ffffff;
|
91 |
-
border: 1px solid #ccc;
|
92 |
-
border: 1px solid rgba(0, 0, 0, 0.15);
|
93 |
-
*border-right-width: 2px;
|
94 |
-
*border-bottom-width: 2px;
|
95 |
-
border-radius: 6px;
|
96 |
-
-webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
|
97 |
-
box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
|
98 |
-
-webkit-background-clip: padding-box;
|
99 |
-
-moz-background-clip: padding;
|
100 |
-
background-clip: padding-box;
|
101 |
-
}
|
102 |
-
.tt-suggestion {
|
103 |
-
display: block;
|
104 |
-
padding: 3px 20px;
|
105 |
-
}
|
106 |
-
.tt-suggestion.tt-cursor {
|
107 |
-
color: #262626;
|
108 |
-
background-image: -webkit-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%);
|
109 |
-
background-image: linear-gradient(to bottom, #f5f5f5 0%, #e8e8e8 100%);
|
110 |
-
background-repeat: repeat-x;
|
111 |
-
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0);
|
112 |
-
}
|
113 |
-
.tt-suggestion.tt-cursor a {
|
114 |
-
color: #ffffff;
|
115 |
-
}
|
116 |
-
.tt-suggestion p {
|
117 |
-
margin: 0;
|
118 |
-
}
|
119 |
-
/* Tokenfield-specific Typeahead styling */
|
120 |
-
.tokenfield .twitter-typeahead {
|
121 |
-
width: auto;
|
122 |
-
}
|
123 |
-
.tokenfield .twitter-typeahead .tt-hint {
|
124 |
-
padding: 0;
|
125 |
-
height: 20px;
|
126 |
-
}
|
127 |
-
.tokenfield.input-sm .twitter-typeahead .tt-input,
|
128 |
-
.tokenfield.input-sm .twitter-typeahead .tt-hint {
|
129 |
-
height: 18px;
|
130 |
-
font-size: 12px;
|
131 |
-
line-height: 1.5;
|
132 |
-
}
|
133 |
-
.tokenfield.input-lg .twitter-typeahead .tt-input,
|
134 |
-
.tokenfield.input-lg .twitter-typeahead .tt-hint {
|
135 |
-
height: 23px;
|
136 |
-
font-size: 18px;
|
137 |
-
line-height: 1.33;
|
138 |
-
}
|
139 |
-
.tokenfield .twitter-typeahead .tt-suggestions {
|
140 |
-
font-size: 14px;
|
141 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/assets/css/tokenfield-typeahead.min.css
DELETED
@@ -1,5 +0,0 @@
|
|
1 |
-
/*!
|
2 |
-
* bootstrap-tokenfield
|
3 |
-
* https://github.com/sliptree/bootstrap-tokenfield
|
4 |
-
* Copyright 2013-2014 Sliptree and other contributors; Licensed MIT
|
5 |
-
*/.twitter-typeahead{width:100%;position:relative;vertical-align:top}.twitter-typeahead .tt-input,.twitter-typeahead .tt-hint{margin:0;width:100%;vertical-align:middle;background-color:#fff}.twitter-typeahead .tt-hint{color:#999;z-index:1;border:1px solid transparent}.twitter-typeahead .tt-input{color:#555;z-index:2}.twitter-typeahead .tt-input,.twitter-typeahead .tt-hint{height:34px;padding:6px 12px;font-size:14px;line-height:1.428571429}.twitter-typeahead .input-sm.tt-input,.twitter-typeahead .hint-sm.tt-hint{border-radius:3px}.twitter-typeahead .input-lg.tt-input,.twitter-typeahead .hint-lg.tt-hint{border-radius:6px}.input-group .twitter-typeahead:first-child .tt-input,.input-group .twitter-typeahead:first-child .tt-hint{border-radius:4px 0 0 4px!important}.input-group .twitter-typeahead:last-child .tt-input,.input-group .twitter-typeahead:last-child .tt-hint{border-radius:0 4px 4px 0!important}.input-group.input-group-sm .twitter-typeahead:first-child .tt-input,.input-group.input-group-sm .twitter-typeahead:first-child .tt-hint{border-radius:3px 0 0 3px!important}.input-group.input-group-sm .twitter-typeahead:last-child .tt-input,.input-group.input-group-sm .twitter-typeahead:last-child .tt-hint{border-radius:0 3px 3px 0!important}.input-sm.tt-input,.hint-sm.tt-hint,.input-group.input-group-sm .tt-input,.input-group.input-group-sm .tt-hint{height:30px;padding:5px 10px;font-size:12px;line-height:1.5}.input-group.input-group-lg .twitter-typeahead:first-child .tt-input,.input-group.input-group-lg .twitter-typeahead:first-child .tt-hint{border-radius:6px 0 0 6px!important}.input-group.input-group-lg .twitter-typeahead:last-child .tt-input,.input-group.input-group-lg .twitter-typeahead:last-child .tt-hint{border-radius:0 6px 6px 0!important}.input-lg.tt-input,.hint-lg.tt-hint,.input-group.input-group-lg .tt-input,.input-group.input-group-lg .tt-hint{height:45px;padding:10px 16px;font-size:18px;line-height:1.33}.tt-dropdown-menu{width:100%;min-width:160px;margin-top:2px;padding:5px 0;background-color:#fff;border:1px solid #ccc;border:1px solid rgba(0,0,0,.15);*border-right-width:2px;*border-bottom-width:2px;border-radius:6px;-webkit-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}.tt-suggestion{display:block;padding:3px 20px}.tt-suggestion.tt-cursor{color:#262626;background-image:-webkit-linear-gradient(top,#f5f5f5 0,#e8e8e8 100%);background-image:linear-gradient(to bottom,#f5f5f5 0,#e8e8e8 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0)}.tt-suggestion.tt-cursor a{color:#fff}.tt-suggestion p{margin:0}.tokenfield .twitter-typeahead{width:auto}.tokenfield .twitter-typeahead .tt-hint{padding:0;height:20px}.tokenfield.input-sm .twitter-typeahead .tt-input,.tokenfield.input-sm .twitter-typeahead .tt-hint{height:18px;font-size:12px;line-height:1.5}.tokenfield.input-lg .twitter-typeahead .tt-input,.tokenfield.input-lg .twitter-typeahead .tt-hint{height:23px;font-size:18px;line-height:1.33}.tokenfield .twitter-typeahead .tt-suggestions{font-size:14px}
|
|
|
|
|
|
|
|
|
|
deprecated/assets/images/index.php
DELETED
@@ -1,2 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
// Silence is golden.
|
|
|
|
deprecated/assets/images/nf-badge.png
DELETED
Binary file
|
deprecated/assets/images/nf-logo-vert.png
DELETED
Binary file
|
deprecated/assets/images/pbar-ani.gif
DELETED
Binary file
|
deprecated/assets/images/screenshots/index.php
DELETED
@@ -1,2 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
// Silence is golden.
|
|
|
|
deprecated/assets/images/screenshots/ss-builder.png
DELETED
Binary file
|
deprecated/assets/images/screenshots/ss-emails-actions.png
DELETED
Binary file
|
deprecated/assets/images/screenshots/ss-field-settings.png
DELETED
Binary file
|
deprecated/assets/images/screenshots/ss-licenses.png
DELETED
Binary file
|
deprecated/assets/images/screenshots/ss-new-form.png
DELETED
Binary file
|
deprecated/assets/images/screenshots/ss-nuke-option.png
DELETED
Binary file
|
deprecated/assets/images/ui-icons_333333_256x240.png
DELETED
Binary file
|
deprecated/assets/images/ui-icons_999999_256x240.png
DELETED
Binary file
|
deprecated/assets/images/ui-icons_cc0000_256x240.png
DELETED
Binary file
|
deprecated/assets/index.php
DELETED
@@ -1,2 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
// Silence is golden.
|
|
|
|
deprecated/assets/js/dev/admin-modal.js
DELETED
@@ -1,74 +0,0 @@
|
|
1 |
-
jQuery.fn.nfAdminModal = function( action, options ) {
|
2 |
-
|
3 |
-
if ( 0 == jQuery( '#nf-admin-modal-backdrop' ).length ) {
|
4 |
-
var modalHtml = '<div id="nf-admin-modal-backdrop" style="display: none;"></div><div id="nf-admin-modal-wrap" class="wp-core-ui" style="display: none;"><div id="nf-admin-modal" tabindex="-1"><div id="admin-modal-title"><span id="nf-modal-title"></span><button type="button" id="nf-admin-modal-close" class="modal-close"><span class="screen-reader-text modal-close">Close</span></button></div><div id="modal-contents-wrapper" style="padding:20px;"><div id="nf-admin-modal-content" class="admin-modal-inside"></div><div class="submitbox" style="display:block;"></div></div></div></div>';
|
5 |
-
jQuery( 'body' ).append( modalHtml );
|
6 |
-
}
|
7 |
-
|
8 |
-
if ( 'object' === typeof action ) {
|
9 |
-
options = action;
|
10 |
-
}
|
11 |
-
|
12 |
-
var defaults = { 'title' : '', 'buttons' : false, 'backgroundClose': false };
|
13 |
-
|
14 |
-
if ( 'undefined' === typeof options ) {
|
15 |
-
options = jQuery( this ).data( 'nfAdminModal' );
|
16 |
-
if ( 'undefined' === typeof options ) {
|
17 |
-
// Merge our default options with the options sent
|
18 |
-
options = jQuery.extend( defaults, options );
|
19 |
-
}
|
20 |
-
} else {
|
21 |
-
// Merge our default options with the options sent
|
22 |
-
options = jQuery.extend( defaults, options );
|
23 |
-
}
|
24 |
-
|
25 |
-
// Set our data with the current options
|
26 |
-
jQuery( this ).data( 'nfAdminModal', options );
|
27 |
-
|
28 |
-
jQuery( this ).hide();
|
29 |
-
jQuery( '#nf-admin-modal-content' ).html( this.html() );
|
30 |
-
|
31 |
-
jQuery( '#nf-modal-title' ).html( options.title );
|
32 |
-
|
33 |
-
if ( options.buttons ) {
|
34 |
-
jQuery( options.buttons ).hide();
|
35 |
-
var buttons = jQuery( options.buttons ).html();
|
36 |
-
jQuery( '#modal-contents-wrapper' ).find( '.submitbox' ).html( buttons );
|
37 |
-
jQuery( '#nf-admin-modal-content' ).addClass( 'admin-modal-inside' );
|
38 |
-
jQuery( '#modal-contents-wrapper' ).find( '.submitbox' ).show();
|
39 |
-
} else {
|
40 |
-
jQuery( '#nf-admin-modal-content' ).removeClass( 'admin-modal-inside' );
|
41 |
-
jQuery( '#modal-contents-wrapper' ).find( '.submitbox' ).hide();
|
42 |
-
}
|
43 |
-
|
44 |
-
jQuery( '#nf-admin-modal-backdrop' ).data( 'backgroundClose', options.backgroundClose );
|
45 |
-
|
46 |
-
if ( 'close' == action ) {
|
47 |
-
jQuery.fn.nfAdminModal.close();
|
48 |
-
} else if ( 'open' == action ) {
|
49 |
-
jQuery.fn.nfAdminModal.open();
|
50 |
-
}
|
51 |
-
};
|
52 |
-
|
53 |
-
jQuery( document ).on( 'click', '#nf-admin-modal-backdrop', function( e ) {
|
54 |
-
if ( jQuery( this ).data( 'backgroundClose' ) == true ) {
|
55 |
-
jQuery.fn.nfAdminModal.close();
|
56 |
-
}
|
57 |
-
} );
|
58 |
-
|
59 |
-
jQuery( document ).on( 'click', '.modal-close', function( e ) {
|
60 |
-
e.preventDefault();
|
61 |
-
jQuery.fn.nfAdminModal.close();
|
62 |
-
} );
|
63 |
-
|
64 |
-
jQuery.fn.nfAdminModal.close = function() {
|
65 |
-
jQuery( '#nf-admin-modal-backdrop' ).hide();
|
66 |
-
jQuery( '#nf-admin-modal-wrap' ).hide();
|
67 |
-
jQuery( document ).triggerHandler( 'nfAdminModalClose' );
|
68 |
-
}
|
69 |
-
|
70 |
-
jQuery.fn.nfAdminModal.open = function() {
|
71 |
-
jQuery( '#nf-admin-modal-backdrop' ).show();
|
72 |
-
jQuery( '#nf-admin-modal-wrap' ).show();
|
73 |
-
jQuery( document ).triggerHandler( 'nfAdminModalOpen' );
|
74 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/assets/js/dev/bootstrap-tokenfield.js
DELETED
@@ -1,1031 +0,0 @@
|
|
1 |
-
/*!
|
2 |
-
* bootstrap-tokenfield
|
3 |
-
* https://github.com/sliptree/bootstrap-tokenfield
|
4 |
-
* Copyright 2013-2014 Sliptree and other contributors; Licensed MIT
|
5 |
-
*/
|
6 |
-
|
7 |
-
(function (factory) {
|
8 |
-
if (typeof define === 'function' && define.amd) {
|
9 |
-
// AMD. Register as an anonymous module.
|
10 |
-
define(['jquery'], factory);
|
11 |
-
} else if (typeof exports === 'object') {
|
12 |
-
// For CommonJS and CommonJS-like environments where a window with jQuery
|
13 |
-
// is present, execute the factory with the jQuery instance from the window object
|
14 |
-
// For environments that do not inherently posses a window with a document
|
15 |
-
// (such as Node.js), expose a Tokenfield-making factory as module.exports
|
16 |
-
// This accentuates the need for the creation of a real window or passing in a jQuery instance
|
17 |
-
// e.g. require("bootstrap-tokenfield")(window); or require("bootstrap-tokenfield")($);
|
18 |
-
module.exports = global.window && global.window.$ ?
|
19 |
-
factory( global.window.$ ) :
|
20 |
-
function( input ) {
|
21 |
-
if ( !input.$ && !input.fn ) {
|
22 |
-
throw new Error( "Tokenfield requires a window object with jQuery or a jQuery instance" );
|
23 |
-
}
|
24 |
-
return factory( input.$ || input );
|
25 |
-
};
|
26 |
-
} else {
|
27 |
-
// Browser globals
|
28 |
-
factory(jQuery, window);
|
29 |
-
}
|
30 |
-
}(function ($, window) {
|
31 |
-
|
32 |
-
"use strict"; // jshint ;_;
|
33 |
-
|
34 |
-
/* TOKENFIELD PUBLIC CLASS DEFINITION
|
35 |
-
* ============================== */
|
36 |
-
|
37 |
-
var Tokenfield = function (element, options) {
|
38 |
-
var _self = this
|
39 |
-
|
40 |
-
this.$element = $(element)
|
41 |
-
this.textDirection = this.$element.css('direction');
|
42 |
-
|
43 |
-
// Extend options
|
44 |
-
this.options = $.extend(true, {}, $.fn.tokenfield.defaults, { tokens: this.$element.val() }, this.$element.data(), options)
|
45 |
-
|
46 |
-
// Setup delimiters and trigger keys
|
47 |
-
this._delimiters = (typeof this.options.delimiter === 'string') ? [this.options.delimiter] : this.options.delimiter
|
48 |
-
this._triggerKeys = $.map(this._delimiters, function (delimiter) {
|
49 |
-
return delimiter.charCodeAt(0);
|
50 |
-
});
|
51 |
-
this._firstDelimiter = this._delimiters[0];
|
52 |
-
|
53 |
-
// Check for whitespace, dash and special characters
|
54 |
-
var whitespace = $.inArray(' ', this._delimiters)
|
55 |
-
, dash = $.inArray('-', this._delimiters)
|
56 |
-
|
57 |
-
if (whitespace >= 0)
|
58 |
-
this._delimiters[whitespace] = '\\s'
|
59 |
-
|
60 |
-
if (dash >= 0) {
|
61 |
-
delete this._delimiters[dash]
|
62 |
-
this._delimiters.unshift('-')
|
63 |
-
}
|
64 |
-
|
65 |
-
var specialCharacters = ['\\', '$', '[', '{', '^', '.', '|', '?', '*', '+', '(', ')']
|
66 |
-
$.each(this._delimiters, function (index, character) {
|
67 |
-
var pos = $.inArray(character, specialCharacters)
|
68 |
-
if (pos >= 0) _self._delimiters[index] = '\\' + character;
|
69 |
-
});
|
70 |
-
|
71 |
-
// Store original input width
|
72 |
-
var elRules = (window && typeof window.getMatchedCSSRules === 'function') ? window.getMatchedCSSRules( element ) : null
|
73 |
-
, elStyleWidth = element.style.width
|
74 |
-
, elCSSWidth
|
75 |
-
, elWidth = this.$element.width()
|
76 |
-
|
77 |
-
if (elRules) {
|
78 |
-
$.each( elRules, function (i, rule) {
|
79 |
-
if (rule.style.width) {
|
80 |
-
elCSSWidth = rule.style.width;
|
81 |
-
}
|
82 |
-
});
|
83 |
-
}
|
84 |
-
|
85 |
-
// Move original input out of the way
|
86 |
-
var hidingPosition = $('body').css('direction') === 'rtl' ? 'right' : 'left',
|
87 |
-
originalStyles = { position: this.$element.css('position') };
|
88 |
-
originalStyles[hidingPosition] = this.$element.css(hidingPosition);
|
89 |
-
|
90 |
-
this.$element
|
91 |
-
.data('original-styles', originalStyles)
|
92 |
-
.data('original-tabindex', this.$element.prop('tabindex'))
|
93 |
-
.css('position', 'absolute')
|
94 |
-
.css(hidingPosition, '-10000px')
|
95 |
-
.prop('tabindex', -1)
|
96 |
-
|
97 |
-
// Create a wrapper
|
98 |
-
this.$wrapper = $('<div class="tokenfield form-control" />')
|
99 |
-
if (this.$element.hasClass('input-lg')) this.$wrapper.addClass('input-lg')
|
100 |
-
if (this.$element.hasClass('input-sm')) this.$wrapper.addClass('input-sm')
|
101 |
-
if (this.textDirection === 'rtl') this.$wrapper.addClass('rtl')
|
102 |
-
|
103 |
-
// Create a new input
|
104 |
-
var id = this.$element.prop('id') || new Date().getTime() + '' + Math.floor((1 + Math.random()) * 100)
|
105 |
-
this.$input = $('<input type="text" class="token-input" autocomplete="off" />')
|
106 |
-
.appendTo( this.$wrapper )
|
107 |
-
.prop( 'placeholder', this.$element.prop('placeholder') )
|
108 |
-
.prop( 'id', id + '-tokenfield' )
|
109 |
-
.prop( 'tabindex', this.$element.data('original-tabindex') )
|
110 |
-
|
111 |
-
// Re-route original input label to new input
|
112 |
-
var $label = $( 'label[for="' + this.$element.prop('id') + '"]' )
|
113 |
-
if ( $label.length ) {
|
114 |
-
$label.prop( 'for', this.$input.prop('id') )
|
115 |
-
}
|
116 |
-
|
117 |
-
// Set up a copy helper to handle copy & paste
|
118 |
-
this.$copyHelper = $('<input type="text" />').css('position', 'absolute').css(hidingPosition, '-10000px').prop('tabindex', -1).prependTo( this.$wrapper )
|
119 |
-
|
120 |
-
// Set wrapper width
|
121 |
-
if (elStyleWidth) {
|
122 |
-
this.$wrapper.css('width', elStyleWidth);
|
123 |
-
}
|
124 |
-
else if (elCSSWidth) {
|
125 |
-
this.$wrapper.css('width', elCSSWidth);
|
126 |
-
}
|
127 |
-
// If input is inside inline-form with no width set, set fixed width
|
128 |
-
else if (this.$element.parents('.form-inline').length) {
|
129 |
-
this.$wrapper.width( elWidth )
|
130 |
-
}
|
131 |
-
|
132 |
-
// Set tokenfield disabled, if original or fieldset input is disabled
|
133 |
-
if (this.$element.prop('disabled') || this.$element.parents('fieldset[disabled]').length) {
|
134 |
-
this.disable();
|
135 |
-
}
|
136 |
-
|
137 |
-
// Set tokenfield readonly, if original input is readonly
|
138 |
-
if (this.$element.prop('readonly')) {
|
139 |
-
this.readonly();
|
140 |
-
}
|
141 |
-
|
142 |
-
// Set up mirror for input auto-sizing
|
143 |
-
this.$mirror = $('<span style="position:absolute; top:-999px; left:0; white-space:pre;"/>');
|
144 |
-
this.$input.css('min-width', this.options.minWidth + 'px')
|
145 |
-
$.each([
|
146 |
-
'fontFamily',
|
147 |
-
'fontSize',
|
148 |
-
'fontWeight',
|
149 |
-
'fontStyle',
|
150 |
-
'letterSpacing',
|
151 |
-
'textTransform',
|
152 |
-
'wordSpacing',
|
153 |
-
'textIndent'
|
154 |
-
], function (i, val) {
|
155 |
-
_self.$mirror[0].style[val] = _self.$input.css(val);
|
156 |
-
});
|
157 |
-
this.$mirror.appendTo( 'body' )
|
158 |
-
|
159 |
-
// Insert tokenfield to HTML
|
160 |
-
this.$wrapper.insertBefore( this.$element )
|
161 |
-
this.$element.prependTo( this.$wrapper )
|
162 |
-
|
163 |
-
// Calculate inner input width
|
164 |
-
this.update()
|
165 |
-
|
166 |
-
// Create initial tokens, if any
|
167 |
-
this.setTokens(this.options.tokens, false, ! this.$element.val() && this.options.tokens )
|
168 |
-
|
169 |
-
// Start listening to events
|
170 |
-
this.listen()
|
171 |
-
|
172 |
-
// Initialize autocomplete, if necessary
|
173 |
-
if ( ! $.isEmptyObject( this.options.autocomplete ) ) {
|
174 |
-
var side = this.textDirection === 'rtl' ? 'right' : 'left'
|
175 |
-
, autocompleteOptions = $.extend({
|
176 |
-
minLength: this.options.showAutocompleteOnFocus ? 0 : null,
|
177 |
-
position: { my: side + " top", at: side + " bottom", of: this.$wrapper }
|
178 |
-
}, this.options.autocomplete )
|
179 |
-
|
180 |
-
this.$input.autocomplete( autocompleteOptions )
|
181 |
-
}
|
182 |
-
|
183 |
-
// Initialize typeahead, if necessary
|
184 |
-
if ( ! $.isEmptyObject( this.options.typeahead ) ) {
|
185 |
-
|
186 |
-
var typeaheadOptions = this.options.typeahead
|
187 |
-
, defaults = {
|
188 |
-
minLength: this.options.showAutocompleteOnFocus ? 0 : null
|
189 |
-
}
|
190 |
-
, args = $.isArray( typeaheadOptions ) ? typeaheadOptions : [typeaheadOptions, typeaheadOptions]
|
191 |
-
|
192 |
-
args[0] = $.extend( {}, defaults, args[0] )
|
193 |
-
|
194 |
-
this.$input.typeahead.apply( this.$input, args )
|
195 |
-
this.typeahead = true
|
196 |
-
}
|
197 |
-
}
|
198 |
-
|
199 |
-
Tokenfield.prototype = {
|
200 |
-
|
201 |
-
constructor: Tokenfield
|
202 |
-
|
203 |
-
, createToken: function (attrs, triggerChange) {
|
204 |
-
var _self = this
|
205 |
-
|
206 |
-
if (typeof attrs === 'string') {
|
207 |
-
attrs = { value: attrs, label: attrs }
|
208 |
-
} else {
|
209 |
-
// Copy objects to prevent contamination of data sources.
|
210 |
-
attrs = $.extend( {}, attrs )
|
211 |
-
}
|
212 |
-
|
213 |
-
if (typeof triggerChange === 'undefined') {
|
214 |
-
triggerChange = true
|
215 |
-
}
|
216 |
-
|
217 |
-
// Normalize label and value
|
218 |
-
attrs.value = $.trim(attrs.value);
|
219 |
-
attrs.label = attrs.label && attrs.label.length ? $.trim(attrs.label) : attrs.value
|
220 |
-
|
221 |
-
// Bail out if has no value or label, or label is too short
|
222 |
-
if (!attrs.value.length || !attrs.label.length || attrs.label.length <= this.options.minLength) return
|
223 |
-
|
224 |
-
// Bail out if maximum number of tokens is reached
|
225 |
-
if (this.options.limit && this.getTokens().length >= this.options.limit) return
|
226 |
-
|
227 |
-
// Allow changing token data before creating it
|
228 |
-
var createEvent = $.Event('tokenfield:createtoken', { attrs: attrs })
|
229 |
-
this.$element.trigger(createEvent)
|
230 |
-
|
231 |
-
// Bail out if there if attributes are empty or event was defaultPrevented
|
232 |
-
if (!createEvent.attrs || createEvent.isDefaultPrevented()) return
|
233 |
-
|
234 |
-
var $token = $('<div class="token" />')
|
235 |
-
.append('<span class="token-label" />')
|
236 |
-
.append('<a href="#" class="close" tabindex="-1">×</a>')
|
237 |
-
.data('attrs', attrs)
|
238 |
-
|
239 |
-
// Insert token into HTML
|
240 |
-
if (this.$input.hasClass('tt-input')) {
|
241 |
-
// If the input has typeahead enabled, insert token before it's parent
|
242 |
-
this.$input.parent().before( $token )
|
243 |
-
} else {
|
244 |
-
this.$input.before( $token )
|
245 |
-
}
|
246 |
-
|
247 |
-
// Temporarily set input width to minimum
|
248 |
-
this.$input.css('width', this.options.minWidth + 'px')
|
249 |
-
|
250 |
-
var $tokenLabel = $token.find('.token-label')
|
251 |
-
, $closeButton = $token.find('.close')
|
252 |
-
|
253 |
-
// Determine maximum possible token label width
|
254 |
-
if (!this.maxTokenWidth) {
|
255 |
-
this.maxTokenWidth =
|
256 |
-
this.$wrapper.width() - $closeButton.outerWidth() -
|
257 |
-
parseInt($closeButton.css('margin-left'), 10) -
|
258 |
-
parseInt($closeButton.css('margin-right'), 10) -
|
259 |
-
parseInt($token.css('border-left-width'), 10) -
|
260 |
-
parseInt($token.css('border-right-width'), 10) -
|
261 |
-
parseInt($token.css('padding-left'), 10) -
|
262 |
-
parseInt($token.css('padding-right'), 10)
|
263 |
-
parseInt($tokenLabel.css('border-left-width'), 10) -
|
264 |
-
parseInt($tokenLabel.css('border-right-width'), 10) -
|
265 |
-
parseInt($tokenLabel.css('padding-left'), 10) -
|
266 |
-
parseInt($tokenLabel.css('padding-right'), 10)
|
267 |
-
parseInt($tokenLabel.css('margin-left'), 10) -
|
268 |
-
parseInt($tokenLabel.css('margin-right'), 10)
|
269 |
-
}
|
270 |
-
|
271 |
-
$tokenLabel
|
272 |
-
.text(attrs.label)
|
273 |
-
.css('max-width', this.maxTokenWidth)
|
274 |
-
|
275 |
-
// Listen to events on token
|
276 |
-
$token
|
277 |
-
.on('mousedown', function (e) {
|
278 |
-
if (_self._disabled || _self._readonly) return false
|
279 |
-
_self.preventDeactivation = true
|
280 |
-
})
|
281 |
-
.on('click', function (e) {
|
282 |
-
if (_self._disabled || _self._readonly) return false
|
283 |
-
_self.preventDeactivation = false
|
284 |
-
|
285 |
-
if (e.ctrlKey || e.metaKey) {
|
286 |
-
e.preventDefault()
|
287 |
-
return _self.toggle( $token )
|
288 |
-
}
|
289 |
-
|
290 |
-
_self.activate( $token, e.shiftKey, e.shiftKey )
|
291 |
-
})
|
292 |
-
.on('dblclick', function (e) {
|
293 |
-
if (_self._disabled || _self._readonly || !_self.options.allowEditing ) return false
|
294 |
-
_self.edit( $token )
|
295 |
-
})
|
296 |
-
|
297 |
-
$closeButton
|
298 |
-
.on('click', $.proxy(this.remove, this))
|
299 |
-
|
300 |
-
// Trigger createdtoken event on the original field
|
301 |
-
// indicating that the token is now in the DOM
|
302 |
-
this.$element.trigger($.Event('tokenfield:createdtoken', {
|
303 |
-
attrs: attrs,
|
304 |
-
relatedTarget: $token.get(0)
|
305 |
-
}))
|
306 |
-
|
307 |
-
// Trigger change event on the original field
|
308 |
-
if (triggerChange) {
|
309 |
-
this.$element.val( this.getTokensList() ).trigger( $.Event('change', { initiator: 'tokenfield' }) )
|
310 |
-
}
|
311 |
-
|
312 |
-
// Update tokenfield dimensions
|
313 |
-
this.update()
|
314 |
-
|
315 |
-
// Return original element
|
316 |
-
return this.$element.get(0)
|
317 |
-
}
|
318 |
-
|
319 |
-
, setTokens: function (tokens, add, triggerChange) {
|
320 |
-
if (!tokens) return
|
321 |
-
|
322 |
-
if (!add) this.$wrapper.find('.token').remove()
|
323 |
-
|
324 |
-
if (typeof triggerChange === 'undefined') {
|
325 |
-
triggerChange = true
|
326 |
-
}
|
327 |
-
|
328 |
-
if (typeof tokens === 'string') {
|
329 |
-
if (this._delimiters.length) {
|
330 |
-
// Split based on delimiters
|
331 |
-
tokens = tokens.split( new RegExp( '[' + this._delimiters.join('') + ']' ) )
|
332 |
-
} else {
|
333 |
-
tokens = [tokens];
|
334 |
-
}
|
335 |
-
}
|
336 |
-
|
337 |
-
var _self = this
|
338 |
-
$.each(tokens, function (i, attrs) {
|
339 |
-
_self.createToken(attrs, triggerChange)
|
340 |
-
})
|
341 |
-
|
342 |
-
return this.$element.get(0)
|
343 |
-
}
|
344 |
-
|
345 |
-
, getTokenData: function($token) {
|
346 |
-
var data = $token.map(function() {
|
347 |
-
var $token = $(this);
|
348 |
-
return $token.data('attrs')
|
349 |
-
}).get();
|
350 |
-
|
351 |
-
if (data.length == 1) {
|
352 |
-
data = data[0];
|
353 |
-
}
|
354 |
-
|
355 |
-
return data;
|
356 |
-
}
|
357 |
-
|
358 |
-
, getTokens: function(active) {
|
359 |
-
var self = this
|
360 |
-
, tokens = []
|
361 |
-
, activeClass = active ? '.active' : '' // get active tokens only
|
362 |
-
this.$wrapper.find( '.token' + activeClass ).each( function() {
|
363 |
-
tokens.push( self.getTokenData( $(this) ) )
|
364 |
-
})
|
365 |
-
return tokens
|
366 |
-
}
|
367 |
-
|
368 |
-
, getTokensList: function(delimiter, beautify, active) {
|
369 |
-
delimiter = delimiter || this._firstDelimiter
|
370 |
-
beautify = ( typeof beautify !== 'undefined' && beautify !== null ) ? beautify : this.options.beautify
|
371 |
-
|
372 |
-
var separator = delimiter + ( beautify && delimiter !== ' ' ? ' ' : '')
|
373 |
-
return $.map( this.getTokens(active), function (token) {
|
374 |
-
return token.value
|
375 |
-
}).join(separator)
|
376 |
-
}
|
377 |
-
|
378 |
-
, getInput: function() {
|
379 |
-
return this.$input.val()
|
380 |
-
}
|
381 |
-
|
382 |
-
, listen: function () {
|
383 |
-
var _self = this
|
384 |
-
|
385 |
-
this.$element
|
386 |
-
.on('change', $.proxy(this.change, this))
|
387 |
-
|
388 |
-
this.$wrapper
|
389 |
-
.on('mousedown',$.proxy(this.focusInput, this))
|
390 |
-
|
391 |
-
this.$input
|
392 |
-
.on('focus', $.proxy(this.focus, this))
|
393 |
-
.on('blur', $.proxy(this.blur, this))
|
394 |
-
.on('paste', $.proxy(this.paste, this))
|
395 |
-
.on('keydown', $.proxy(this.keydown, this))
|
396 |
-
.on('keypress', $.proxy(this.keypress, this))
|
397 |
-
.on('keyup', $.proxy(this.keyup, this))
|
398 |
-
|
399 |
-
this.$copyHelper
|
400 |
-
.on('focus', $.proxy(this.focus, this))
|
401 |
-
.on('blur', $.proxy(this.blur, this))
|
402 |
-
.on('keydown', $.proxy(this.keydown, this))
|
403 |
-
.on('keyup', $.proxy(this.keyup, this))
|
404 |
-
|
405 |
-
// Secondary listeners for input width calculation
|
406 |
-
this.$input
|
407 |
-
.on('keypress', $.proxy(this.update, this))
|
408 |
-
.on('keyup', $.proxy(this.update, this))
|
409 |
-
|
410 |
-
this.$input
|
411 |
-
.on('autocompletecreate', function() {
|
412 |
-
// Set minimum autocomplete menu width
|
413 |
-
var $_menuElement = $(this).data('ui-autocomplete').menu.element
|
414 |
-
|
415 |
-
var minWidth = _self.$wrapper.outerWidth() -
|
416 |
-
parseInt( $_menuElement.css('border-left-width'), 10 ) -
|
417 |
-
parseInt( $_menuElement.css('border-right-width'), 10 )
|
418 |
-
|
419 |
-
$_menuElement.css( 'min-width', minWidth + 'px' )
|
420 |
-
})
|
421 |
-
.on('autocompleteselect', function (e, ui) {
|
422 |
-
if (_self.createToken( ui.item )) {
|
423 |
-
_self.$input.val('')
|
424 |
-
if (_self.$input.data( 'edit' )) {
|
425 |
-
_self.unedit(true)
|
426 |
-
}
|
427 |
-
}
|
428 |
-
return false
|
429 |
-
})
|
430 |
-
.on('typeahead:selected typeahead:autocompleted', function (e, datum, dataset) {
|
431 |
-
// Create token
|
432 |
-
if (_self.createToken( datum )) {
|
433 |
-
_self.$input.typeahead('val', '')
|
434 |
-
if (_self.$input.data( 'edit' )) {
|
435 |
-
_self.unedit(true)
|
436 |
-
}
|
437 |
-
}
|
438 |
-
})
|
439 |
-
|
440 |
-
// Listen to window resize
|
441 |
-
$(window).on('resize', $.proxy(this.update, this ))
|
442 |
-
|
443 |
-
}
|
444 |
-
|
445 |
-
, keydown: function (e) {
|
446 |
-
|
447 |
-
if (!this.focused) return
|
448 |
-
|
449 |
-
var _self = this
|
450 |
-
|
451 |
-
switch(e.keyCode) {
|
452 |
-
case 8: // backspace
|
453 |
-
if (!this.$input.is(document.activeElement)) break
|
454 |
-
this.lastInputValue = this.$input.val()
|
455 |
-
break
|
456 |
-
|
457 |
-
case 37: // left arrow
|
458 |
-
leftRight( this.textDirection === 'rtl' ? 'next': 'prev' )
|
459 |
-
break
|
460 |
-
|
461 |
-
case 38: // up arrow
|
462 |
-
upDown('prev')
|
463 |
-
break
|
464 |
-
|
465 |
-
case 39: // right arrow
|
466 |
-
leftRight( this.textDirection === 'rtl' ? 'prev': 'next' )
|
467 |
-
break
|
468 |
-
|
469 |
-
case 40: // down arrow
|
470 |
-
upDown('next')
|
471 |
-
break
|
472 |
-
|
473 |
-
case 65: // a (to handle ctrl + a)
|
474 |
-
if (this.$input.val().length > 0 || !(e.ctrlKey || e.metaKey)) break
|
475 |
-
this.activateAll()
|
476 |
-
e.preventDefault()
|
477 |
-
break
|
478 |
-
|
479 |
-
case 9: // tab
|
480 |
-
case 13: // enter
|
481 |
-
|
482 |
-
// We will handle creating tokens from autocomplete in autocomplete events
|
483 |
-
if (this.$input.data('ui-autocomplete') && this.$input.data('ui-autocomplete').menu.element.find("li:has(a.ui-state-focus)").length) break
|
484 |
-
|
485 |
-
// We will handle creating tokens from typeahead in typeahead events
|
486 |
-
if (this.$input.hasClass('tt-input') && this.$wrapper.find('.tt-cursor').length ) break
|
487 |
-
if (this.$input.hasClass('tt-input') && this.$wrapper.find('.tt-hint').val().length) break
|
488 |
-
|
489 |
-
// Create token
|
490 |
-
if (this.$input.is(document.activeElement) && this.$input.val().length || this.$input.data('edit')) {
|
491 |
-
return this.createTokensFromInput(e, this.$input.data('edit'));
|
492 |
-
}
|
493 |
-
|
494 |
-
// Edit token
|
495 |
-
if (e.keyCode === 13) {
|
496 |
-
if (!this.$copyHelper.is(document.activeElement) || this.$wrapper.find('.token.active').length !== 1) break
|
497 |
-
if (!_self.options.allowEditing) break
|
498 |
-
this.edit( this.$wrapper.find('.token.active') )
|
499 |
-
}
|
500 |
-
}
|
501 |
-
|
502 |
-
function leftRight(direction) {
|
503 |
-
if (_self.$input.is(document.activeElement)) {
|
504 |
-
if (_self.$input.val().length > 0) return
|
505 |
-
|
506 |
-
direction += 'All'
|
507 |
-
var $token = _self.$input.hasClass('tt-input') ? _self.$input.parent()[direction]('.token:first') : _self.$input[direction]('.token:first')
|
508 |
-
if (!$token.length) return
|
509 |
-
|
510 |
-
_self.preventInputFocus = true
|
511 |
-
_self.preventDeactivation = true
|
512 |
-
|
513 |
-
_self.activate( $token )
|
514 |
-
e.preventDefault()
|
515 |
-
|
516 |
-
} else {
|
517 |
-
_self[direction]( e.shiftKey )
|
518 |
-
e.preventDefault()
|
519 |
-
}
|
520 |
-
}
|
521 |
-
|
522 |
-
function upDown(direction) {
|
523 |
-
if (!e.shiftKey) return
|
524 |
-
|
525 |
-
if (_self.$input.is(document.activeElement)) {
|
526 |
-
if (_self.$input.val().length > 0) return
|
527 |
-
|
528 |
-
var $token = _self.$input.hasClass('tt-input') ? _self.$input.parent()[direction + 'All']('.token:first') : _self.$input[direction + 'All']('.token:first')
|
529 |
-
if (!$token.length) return
|
530 |
-
|
531 |
-
_self.activate( $token )
|
532 |
-
}
|
533 |
-
|
534 |
-
var opposite = direction === 'prev' ? 'next' : 'prev'
|
535 |
-
, position = direction === 'prev' ? 'first' : 'last'
|
536 |
-
|
537 |
-
_self.firstActiveToken[opposite + 'All']('.token').each(function() {
|
538 |
-
_self.deactivate( $(this) )
|
539 |
-
})
|
540 |
-
|
541 |
-
_self.activate( _self.$wrapper.find('.token:' + position), true, true )
|
542 |
-
e.preventDefault()
|
543 |
-
}
|
544 |
-
|
545 |
-
this.lastKeyDown = e.keyCode
|
546 |
-
}
|
547 |
-
|
548 |
-
, keypress: function(e) {
|
549 |
-
this.lastKeyPressCode = e.keyCode
|
550 |
-
this.lastKeyPressCharCode = e.charCode
|
551 |
-
|
552 |
-
// Comma
|
553 |
-
if ($.inArray( e.charCode, this._triggerKeys) !== -1 && this.$input.is(document.activeElement)) {
|
554 |
-
if (this.$input.val()) {
|
555 |
-
this.createTokensFromInput(e)
|
556 |
-
}
|
557 |
-
return false;
|
558 |
-
}
|
559 |
-
}
|
560 |
-
|
561 |
-
, keyup: function (e) {
|
562 |
-
this.preventInputFocus = false
|
563 |
-
|
564 |
-
if (!this.focused) return
|
565 |
-
|
566 |
-
switch(e.keyCode) {
|
567 |
-
case 8: // backspace
|
568 |
-
if (this.$input.is(document.activeElement)) {
|
569 |
-
if (this.$input.val().length || this.lastInputValue.length && this.lastKeyDown === 8) break
|
570 |
-
|
571 |
-
this.preventDeactivation = true
|
572 |
-
var $prevToken = this.$input.hasClass('tt-input') ? this.$input.parent().prevAll('.token:first') : this.$input.prevAll('.token:first')
|
573 |
-
|
574 |
-
if (!$prevToken.length) break
|
575 |
-
|
576 |
-
this.activate( $prevToken )
|
577 |
-
} else {
|
578 |
-
this.remove(e)
|
579 |
-
}
|
580 |
-
break
|
581 |
-
|
582 |
-
case 46: // delete
|
583 |
-
this.remove(e, 'next')
|
584 |
-
break
|
585 |
-
}
|
586 |
-
this.lastKeyUp = e.keyCode
|
587 |
-
}
|
588 |
-
|
589 |
-
, focus: function (e) {
|
590 |
-
this.focused = true
|
591 |
-
this.$wrapper.addClass('focus')
|
592 |
-
|
593 |
-
if (this.$input.is(document.activeElement)) {
|
594 |
-
this.$wrapper.find('.active').removeClass('active')
|
595 |
-
this.$firstActiveToken = null
|
596 |
-
|
597 |
-
if (this.options.showAutocompleteOnFocus) {
|
598 |
-
this.search()
|
599 |
-
}
|
600 |
-
}
|
601 |
-
}
|
602 |
-
|
603 |
-
, blur: function (e) {
|
604 |
-
|
605 |
-
this.focused = false
|
606 |
-
this.$wrapper.removeClass('focus')
|
607 |
-
|
608 |
-
if (!this.preventDeactivation && !this.$element.is(document.activeElement)) {
|
609 |
-
this.$wrapper.find('.active').removeClass('active')
|
610 |
-
this.$firstActiveToken = null
|
611 |
-
}
|
612 |
-
|
613 |
-
if (!this.preventCreateTokens && (this.$input.data('edit') && !this.$input.is(document.activeElement) || this.options.createTokensOnBlur )) {
|
614 |
-
this.createTokensFromInput(e)
|
615 |
-
}
|
616 |
-
|
617 |
-
this.preventDeactivation = false
|
618 |
-
this.preventCreateTokens = false
|
619 |
-
}
|
620 |
-
|
621 |
-
, paste: function (e) {
|
622 |
-
var _self = this
|
623 |
-
|
624 |
-
// Add tokens to existing ones
|
625 |
-
if (_self.options.allowPasting) {
|
626 |
-
setTimeout(function () {
|
627 |
-
_self.createTokensFromInput(e)
|
628 |
-
}, 1)
|
629 |
-
}
|
630 |
-
}
|
631 |
-
|
632 |
-
, change: function (e) {
|
633 |
-
if ( e.initiator === 'tokenfield' ) return // Prevent loops
|
634 |
-
|
635 |
-
this.setTokens( this.$element.val() )
|
636 |
-
}
|
637 |
-
|
638 |
-
, createTokensFromInput: function (e, focus) {
|
639 |
-
if (this.$input.val().length < this.options.minLength)
|
640 |
-
return // No input, simply return
|
641 |
-
|
642 |
-
var tokensBefore = this.getTokensList()
|
643 |
-
this.setTokens( this.$input.val(), true )
|
644 |
-
|
645 |
-
if (tokensBefore == this.getTokensList() && this.$input.val().length)
|
646 |
-
return false // No tokens were added, do nothing (prevent form submit)
|
647 |
-
|
648 |
-
if (this.$input.hasClass('tt-input')) {
|
649 |
-
// Typeahead acts weird when simply setting input value to empty,
|
650 |
-
// so we set the query to empty instead
|
651 |
-
this.$input.typeahead('val', '')
|
652 |
-
} else {
|
653 |
-
this.$input.val('')
|
654 |
-
}
|
655 |
-
|
656 |
-
if (this.$input.data( 'edit' )) {
|
657 |
-
this.unedit(focus)
|
658 |
-
}
|
659 |
-
|
660 |
-
return false // Prevent form being submitted
|
661 |
-
}
|
662 |
-
|
663 |
-
, next: function (add) {
|
664 |
-
if (add) {
|
665 |
-
var $firstActiveToken = this.$wrapper.find('.active:first')
|
666 |
-
, deactivate = $firstActiveToken && this.$firstActiveToken ? $firstActiveToken.index() < this.$firstActiveToken.index() : false
|
667 |
-
|
668 |
-
if (deactivate) return this.deactivate( $firstActiveToken )
|
669 |
-
}
|
670 |
-
|
671 |
-
var $lastActiveToken = this.$wrapper.find('.active:last')
|
672 |
-
, $nextToken = $lastActiveToken.nextAll('.token:first')
|
673 |
-
|
674 |
-
if (!$nextToken.length) {
|
675 |
-
this.$input.focus()
|
676 |
-
return
|
677 |
-
}
|
678 |
-
|
679 |
-
this.activate($nextToken, add)
|
680 |
-
}
|
681 |
-
|
682 |
-
, prev: function (add) {
|
683 |
-
|
684 |
-
if (add) {
|
685 |
-
var $lastActiveToken = this.$wrapper.find('.active:last')
|
686 |
-
, deactivate = $lastActiveToken && this.$firstActiveToken ? $lastActiveToken.index() > this.$firstActiveToken.index() : false
|
687 |
-
|
688 |
-
if (deactivate) return this.deactivate( $lastActiveToken )
|
689 |
-
}
|
690 |
-
|
691 |
-
var $firstActiveToken = this.$wrapper.find('.active:first')
|
692 |
-
, $prevToken = $firstActiveToken.prevAll('.token:first')
|
693 |
-
|
694 |
-
if (!$prevToken.length) {
|
695 |
-
$prevToken = this.$wrapper.find('.token:first')
|
696 |
-
}
|
697 |
-
|
698 |
-
if (!$prevToken.length && !add) {
|
699 |
-
this.$input.focus()
|
700 |
-
return
|
701 |
-
}
|
702 |
-
|
703 |
-
this.activate( $prevToken, add )
|
704 |
-
}
|
705 |
-
|
706 |
-
, activate: function ($token, add, multi, remember) {
|
707 |
-
|
708 |
-
if (!$token) return
|
709 |
-
|
710 |
-
if (typeof remember === 'undefined') var remember = true
|
711 |
-
|
712 |
-
if (multi) var add = true
|
713 |
-
|
714 |
-
this.$copyHelper.focus()
|
715 |
-
|
716 |
-
if (!add) {
|
717 |
-
this.$wrapper.find('.active').removeClass('active')
|
718 |
-
if (remember) {
|
719 |
-
this.$firstActiveToken = $token
|
720 |
-
} else {
|
721 |
-
delete this.$firstActiveToken
|
722 |
-
}
|
723 |
-
}
|
724 |
-
|
725 |
-
if (multi && this.$firstActiveToken) {
|
726 |
-
// Determine first active token and the current tokens indicies
|
727 |
-
// Account for the 1 hidden textarea by subtracting 1 from both
|
728 |
-
var i = this.$firstActiveToken.index() - 2
|
729 |
-
, a = $token.index() - 2
|
730 |
-
, _self = this
|
731 |
-
|
732 |
-
this.$wrapper.find('.token').slice( Math.min(i, a) + 1, Math.max(i, a) ).each( function() {
|
733 |
-
_self.activate( $(this), true )
|
734 |
-
})
|
735 |
-
}
|
736 |
-
|
737 |
-
$token.addClass('active')
|
738 |
-
this.$copyHelper.val( this.getTokensList( null, null, true ) ).select()
|
739 |
-
}
|
740 |
-
|
741 |
-
, activateAll: function() {
|
742 |
-
var _self = this
|
743 |
-
|
744 |
-
this.$wrapper.find('.token').each( function (i) {
|
745 |
-
_self.activate($(this), i !== 0, false, false)
|
746 |
-
})
|
747 |
-
}
|
748 |
-
|
749 |
-
, deactivate: function($token) {
|
750 |
-
if (!$token) return
|
751 |
-
|
752 |
-
$token.removeClass('active')
|
753 |
-
this.$copyHelper.val( this.getTokensList( null, null, true ) ).select()
|
754 |
-
}
|
755 |
-
|
756 |
-
, toggle: function($token) {
|
757 |
-
if (!$token) return
|
758 |
-
|
759 |
-
$token.toggleClass('active')
|
760 |
-
this.$copyHelper.val( this.getTokensList( null, null, true ) ).select()
|
761 |
-
}
|
762 |
-
|
763 |
-
, edit: function ($token) {
|
764 |
-
if (!$token) return
|
765 |
-
|
766 |
-
var attrs = $token.data('attrs')
|
767 |
-
|
768 |
-
// Allow changing input value before editing
|
769 |
-
var options = { attrs: attrs, relatedTarget: $token.get(0) }
|
770 |
-
var editEvent = $.Event('tokenfield:edittoken', options)
|
771 |
-
this.$element.trigger( editEvent )
|
772 |
-
|
773 |
-
// Edit event can be cancelled if default is prevented
|
774 |
-
if (editEvent.isDefaultPrevented()) return
|
775 |
-
|
776 |
-
$token.find('.token-label').text(attrs.value)
|
777 |
-
var tokenWidth = $token.outerWidth()
|
778 |
-
|
779 |
-
var $_input = this.$input.hasClass('tt-input') ? this.$input.parent() : this.$input
|
780 |
-
|
781 |
-
$token.replaceWith( $_input )
|
782 |
-
|
783 |
-
this.preventCreateTokens = true
|
784 |
-
|
785 |
-
this.$input.val( attrs.value )
|
786 |
-
.select()
|
787 |
-
.data( 'edit', true )
|
788 |
-
.width( tokenWidth )
|
789 |
-
|
790 |
-
this.update();
|
791 |
-
|
792 |
-
// Indicate that token is now being edited, and is replaced with an input field in the DOM
|
793 |
-
this.$element.trigger($.Event('tokenfield:editedtoken', options ))
|
794 |
-
}
|
795 |
-
|
796 |
-
, unedit: function (focus) {
|
797 |
-
var $_input = this.$input.hasClass('tt-input') ? this.$input.parent() : this.$input
|
798 |
-
$_input.appendTo( this.$wrapper )
|
799 |
-
|
800 |
-
this.$input.data('edit', false)
|
801 |
-
this.$mirror.text('')
|
802 |
-
|
803 |
-
this.update()
|
804 |
-
|
805 |
-
// Because moving the input element around in DOM
|
806 |
-
// will cause it to lose focus, we provide an option
|
807 |
-
// to re-focus the input after appending it to the wrapper
|
808 |
-
if (focus) {
|
809 |
-
var _self = this
|
810 |
-
setTimeout(function () {
|
811 |
-
_self.$input.focus()
|
812 |
-
}, 1)
|
813 |
-
}
|
814 |
-
}
|
815 |
-
|
816 |
-
, remove: function (e, direction) {
|
817 |
-
if (this.$input.is(document.activeElement) || this._disabled || this._readonly) return
|
818 |
-
|
819 |
-
var $token = (e.type === 'click') ? $(e.target).closest('.token') : this.$wrapper.find('.token.active')
|
820 |
-
|
821 |
-
if (e.type !== 'click') {
|
822 |
-
if (!direction) var direction = 'prev'
|
823 |
-
this[direction]()
|
824 |
-
|
825 |
-
// Was it the first token?
|
826 |
-
if (direction === 'prev') var firstToken = $token.first().prevAll('.token:first').length === 0
|
827 |
-
}
|
828 |
-
|
829 |
-
// Prepare events and their options
|
830 |
-
var options = { attrs: this.getTokenData( $token ), relatedTarget: $token.get(0) }
|
831 |
-
, removeEvent = $.Event('tokenfield:removetoken', options)
|
832 |
-
|
833 |
-
this.$element.trigger(removeEvent);
|
834 |
-
|
835 |
-
// Remove event can be intercepted and cancelled
|
836 |
-
if (removeEvent.isDefaultPrevented()) return
|
837 |
-
|
838 |
-
var removedEvent = $.Event('tokenfield:removedtoken', options)
|
839 |
-
, changeEvent = $.Event('change', { initiator: 'tokenfield' })
|
840 |
-
|
841 |
-
// Remove token from DOM
|
842 |
-
$token.remove()
|
843 |
-
|
844 |
-
// Trigger events
|
845 |
-
this.$element.val( this.getTokensList() ).trigger( removedEvent ).trigger( changeEvent )
|
846 |
-
|
847 |
-
// Focus, when necessary:
|
848 |
-
// When there are no more tokens, or if this was the first token
|
849 |
-
// and it was removed with backspace or it was clicked on
|
850 |
-
if (!this.$wrapper.find('.token').length || e.type === 'click' || firstToken) this.$input.focus()
|
851 |
-
|
852 |
-
// Adjust input width
|
853 |
-
this.$input.css('width', this.options.minWidth + 'px')
|
854 |
-
this.update()
|
855 |
-
|
856 |
-
// Cancel original event handlers
|
857 |
-
e.preventDefault()
|
858 |
-
e.stopPropagation()
|
859 |
-
}
|
860 |
-
|
861 |
-
/**
|
862 |
-
* Update tokenfield dimensions
|
863 |
-
*/
|
864 |
-
, update: function (e) {
|
865 |
-
var value = this.$input.val()
|
866 |
-
, inputPaddingLeft = parseInt(this.$input.css('padding-left'), 10)
|
867 |
-
, inputPaddingRight = parseInt(this.$input.css('padding-right'), 10)
|
868 |
-
, inputPadding = inputPaddingLeft + inputPaddingRight
|
869 |
-
|
870 |
-
if (this.$input.data('edit')) {
|
871 |
-
|
872 |
-
if (!value) {
|
873 |
-
value = this.$input.prop("placeholder")
|
874 |
-
}
|
875 |
-
if (value === this.$mirror.text()) return
|
876 |
-
|
877 |
-
this.$mirror.text(value)
|
878 |
-
|
879 |
-
var mirrorWidth = this.$mirror.width() + 10;
|
880 |
-
if ( mirrorWidth > this.$wrapper.width() ) {
|
881 |
-
return this.$input.width( this.$wrapper.width() )
|
882 |
-
}
|
883 |
-
|
884 |
-
this.$input.width( mirrorWidth )
|
885 |
-
}
|
886 |
-
else {
|
887 |
-
var w = (this.textDirection === 'rtl')
|
888 |
-
? this.$input.offset().left + this.$input.outerWidth() - this.$wrapper.offset().left - parseInt(this.$wrapper.css('padding-left'), 10) - inputPadding - 1
|
889 |
-
: this.$wrapper.offset().left + this.$wrapper.width() + parseInt(this.$wrapper.css('padding-left'), 10) - this.$input.offset().left - inputPadding;
|
890 |
-
//
|
891 |
-
// some usecases pre-render widget before attaching to DOM,
|
892 |
-
// dimensions returned by jquery will be NaN -> we default to 100%
|
893 |
-
// so placeholder won't be cut off.
|
894 |
-
isNaN(w) ? this.$input.width('100%') : this.$input.width(w);
|
895 |
-
}
|
896 |
-
}
|
897 |
-
|
898 |
-
, focusInput: function (e) {
|
899 |
-
if ( $(e.target).closest('.token').length || $(e.target).closest('.token-input').length || $(e.target).closest('.tt-dropdown-menu').length ) return
|
900 |
-
// Focus only after the current call stack has cleared,
|
901 |
-
// otherwise has no effect.
|
902 |
-
// Reason: mousedown is too early - input will lose focus
|
903 |
-
// after mousedown. However, since the input may be moved
|
904 |
-
// in DOM, there may be no click or mouseup event triggered.
|
905 |
-
var _self = this
|
906 |
-
setTimeout(function() {
|
907 |
-
_self.$input.focus()
|
908 |
-
}, 0)
|
909 |
-
}
|
910 |
-
|
911 |
-
, search: function () {
|
912 |
-
if ( this.$input.data('ui-autocomplete') ) {
|
913 |
-
this.$input.autocomplete('search')
|
914 |
-
}
|
915 |
-
}
|
916 |
-
|
917 |
-
, disable: function () {
|
918 |
-
this.setProperty('disabled', true);
|
919 |
-
}
|
920 |
-
|
921 |
-
, enable: function () {
|
922 |
-
this.setProperty('disabled', false);
|
923 |
-
}
|
924 |
-
|
925 |
-
, readonly: function () {
|
926 |
-
this.setProperty('readonly', true);
|
927 |
-
}
|
928 |
-
|
929 |
-
, writeable: function () {
|
930 |
-
this.setProperty('readonly', false);
|
931 |
-
}
|
932 |
-
|
933 |
-
, setProperty: function(property, value) {
|
934 |
-
this['_' + property] = value;
|
935 |
-
this.$input.prop(property, value);
|
936 |
-
this.$element.prop(property, value);
|
937 |
-
this.$wrapper[ value ? 'addClass' : 'removeClass' ](property);
|
938 |
-
}
|
939 |
-
|
940 |
-
, destroy: function() {
|
941 |
-
// Set field value
|
942 |
-
this.$element.val( this.getTokensList() );
|
943 |
-
// Restore styles and properties
|
944 |
-
this.$element.css( this.$element.data('original-styles') );
|
945 |
-
this.$element.prop( 'tabindex', this.$element.data('original-tabindex') );
|
946 |
-
|
947 |
-
// Re-route tokenfield label to original input
|
948 |
-
var $label = $( 'label[for="' + this.$input.prop('id') + '"]' )
|
949 |
-
if ( $label.length ) {
|
950 |
-
$label.prop( 'for', this.$element.prop('id') )
|
951 |
-
}
|
952 |
-
|
953 |
-
// Move original element outside of tokenfield wrapper
|
954 |
-
this.$element.insertBefore( this.$wrapper );
|
955 |
-
|
956 |
-
// Remove tokenfield-related data
|
957 |
-
this.$element.removeData('original-styles')
|
958 |
-
.removeData('original-tabindex')
|
959 |
-
.removeData('bs.tokenfield');
|
960 |
-
|
961 |
-
// Remove tokenfield from DOM
|
962 |
-
this.$wrapper.remove();
|
963 |
-
this.$mirror.remove();
|
964 |
-
|
965 |
-
var $_element = this.$element;
|
966 |
-
delete this;
|
967 |
-
|
968 |
-
return $_element;
|
969 |
-
}
|
970 |
-
|
971 |
-
}
|
972 |
-
|
973 |
-
|
974 |
-
/* TOKENFIELD PLUGIN DEFINITION
|
975 |
-
* ======================== */
|
976 |
-
|
977 |
-
var old = $.fn.tokenfield
|
978 |
-
|
979 |
-
$.fn.tokenfield = function (option, param) {
|
980 |
-
var value
|
981 |
-
, args = []
|
982 |
-
|
983 |
-
Array.prototype.push.apply( args, arguments );
|
984 |
-
|
985 |
-
var elements = this.each(function () {
|
986 |
-
var $this = $(this)
|
987 |
-
, data = $this.data('bs.tokenfield')
|
988 |
-
, options = typeof option == 'object' && option
|
989 |
-
|
990 |
-
if (typeof option === 'string' && data && data[option]) {
|
991 |
-
args.shift()
|
992 |
-
value = data[option].apply(data, args)
|
993 |
-
} else {
|
994 |
-
if (!data && typeof option !== 'string' && !param) {
|
995 |
-
$this.data('bs.tokenfield', (data = new Tokenfield(this, options)))
|
996 |
-
$this.trigger('tokenfield:initialize')
|
997 |
-
}
|
998 |
-
}
|
999 |
-
})
|
1000 |
-
|
1001 |
-
return typeof value !== 'undefined' ? value : elements;
|
1002 |
-
}
|
1003 |
-
|
1004 |
-
$.fn.tokenfield.defaults = {
|
1005 |
-
minWidth: 60,
|
1006 |
-
minLength: 0,
|
1007 |
-
allowEditing: true,
|
1008 |
-
allowPasting: true,
|
1009 |
-
limit: 0,
|
1010 |
-
autocomplete: {},
|
1011 |
-
typeahead: {},
|
1012 |
-
showAutocompleteOnFocus: false,
|
1013 |
-
createTokensOnBlur: false,
|
1014 |
-
delimiter: ',',
|
1015 |
-
beautify: true
|
1016 |
-
}
|
1017 |
-
|
1018 |
-
$.fn.tokenfield.Constructor = Tokenfield
|
1019 |
-
|
1020 |
-
|
1021 |
-
/* TOKENFIELD NO CONFLICT
|
1022 |
-
* ================== */
|
1023 |
-
|
1024 |
-
$.fn.tokenfield.noConflict = function () {
|
1025 |
-
$.fn.tokenfield = old
|
1026 |
-
return this
|
1027 |
-
}
|
1028 |
-
|
1029 |
-
return Tokenfield;
|
1030 |
-
|
1031 |
-
}));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/assets/js/dev/builder.js
DELETED
@@ -1,519 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* JS that handles our fields in the admin.
|
3 |
-
* Uses backbone data models to send only modified field data to the db.
|
4 |
-
*/
|
5 |
-
|
6 |
-
// Model to hold our field settings.
|
7 |
-
var nfField = Backbone.Model.extend( {
|
8 |
-
toggleMetabox: function() {
|
9 |
-
/**
|
10 |
-
* Open and close a field metabox.
|
11 |
-
* When a metabox is closed:
|
12 |
-
* - update the field collection with any values that might have changed.
|
13 |
-
* - remove the HTML
|
14 |
-
* When a metabox is opened:
|
15 |
-
* - send an ajax request to grab the HTML
|
16 |
-
* - populate the field settings HTML
|
17 |
-
*/
|
18 |
-
|
19 |
-
var field_id = this.id;
|
20 |
-
|
21 |
-
// Get our current metabox state.
|
22 |
-
var current_metabox_state = this.get( 'metabox_state' );
|
23 |
-
if ( current_metabox_state == 1 ) { // If our current state is 1, then we are closing the metabox.
|
24 |
-
var new_metabox_state = 0;
|
25 |
-
} else { // If our current state is 0, then we are opening the metabox.
|
26 |
-
var new_metabox_state = 1;
|
27 |
-
}
|
28 |
-
|
29 |
-
// Perform specific tasks based upon the state of the metabox.
|
30 |
-
if ( new_metabox_state == 1 ) { // If we have opened the metabox.
|
31 |
-
// Fetch our HTML.
|
32 |
-
this.updateHTML();
|
33 |
-
} else { // If we have closed the metabox.
|
34 |
-
// Update our model data.
|
35 |
-
this.updateData();
|
36 |
-
// Remove any tinyMCE editors
|
37 |
-
jQuery( '#ninja_forms_field_' + field_id + '_inside' ).find( 'div.rte' ).each( function() {
|
38 |
-
if ( 'undefined' != typeof tinymce ) {
|
39 |
-
try {
|
40 |
-
var editor_id = jQuery( this ).find( 'textarea.wp-editor-area' ).prop( 'id' );
|
41 |
-
tinymce.remove( '#' + editor_id );
|
42 |
-
} catch (e ) {
|
43 |
-
|
44 |
-
}
|
45 |
-
|
46 |
-
}
|
47 |
-
|
48 |
-
} );
|
49 |
-
|
50 |
-
jQuery( '#ninja_forms_field_' + field_id + '_inside' ).slideUp('fast', function( e ) {
|
51 |
-
// Remove the HTML contents of this metabox.
|
52 |
-
jQuery( '#ninja_forms_field_' + field_id + '_inside' ).empty();
|
53 |
-
|
54 |
-
// Add our no-padding class
|
55 |
-
jQuery( '#ninja_forms_field_' + field_id + '_inside' ).addClass( 'no-padding' );
|
56 |
-
});
|
57 |
-
}
|
58 |
-
|
59 |
-
// Save the state of the metabox in our data model.
|
60 |
-
this.set( 'metabox_state', new_metabox_state );
|
61 |
-
},
|
62 |
-
updateHTML: function() {
|
63 |
-
var field_id = this.id;
|
64 |
-
jQuery( '#ninja_forms_metabox_field_' + field_id ).find( '.spinner' ).show();
|
65 |
-
jQuery( '#ninja_forms_metabox_field_' + field_id ).find( '.spinner' ).css( 'visibility', 'visible' );
|
66 |
-
this.updateData();
|
67 |
-
var data = JSON.stringify( this.toJSON() );
|
68 |
-
var that = this;
|
69 |
-
jQuery.post( ajaxurl, { field_id: field_id, data: data, action:'nf_output_field_settings_html', nf_ajax_nonce:ninja_forms_settings.nf_ajax_nonce }, function( response ) {
|
70 |
-
jQuery( '#ninja_forms_metabox_field_' + field_id ).find( '.spinner' ).hide();
|
71 |
-
// Remove our no-padding class.
|
72 |
-
jQuery( '#ninja_forms_field_' + field_id + '_inside' ).removeClass( 'no-padding' );
|
73 |
-
jQuery( '#ninja_forms_field_' + field_id + '_inside' ).append( response );
|
74 |
-
if ( typeof nf_ajax_rte_editors !== 'undefined' && 'undefined' !== typeof tinyMCE ) {
|
75 |
-
for (var x = nf_ajax_rte_editors.length - 1; x >= 0; x--) {
|
76 |
-
try {
|
77 |
-
var editor_id = nf_ajax_rte_editors[x];
|
78 |
-
tinyMCE.init( tinyMCEPreInit.mceInit[ editor_id ] );
|
79 |
-
try { quicktags( tinyMCEPreInit.qtInit[ editor_id ] ); } catch(e){ console.log( 'error' ); }
|
80 |
-
} catch (e) {
|
81 |
-
|
82 |
-
}
|
83 |
-
};
|
84 |
-
}
|
85 |
-
|
86 |
-
that.removeEmptySettings();
|
87 |
-
|
88 |
-
jQuery( '#ninja_forms_field_' + field_id + '_inside' ).slideDown( 'fast' );
|
89 |
-
|
90 |
-
// Re-run makeSortable for new HTML
|
91 |
-
nfFields.listOptionsSortable();
|
92 |
-
|
93 |
-
jQuery( '.nf-field-settings .title' ).disableSelection();
|
94 |
-
} );
|
95 |
-
},
|
96 |
-
updateData: function() {
|
97 |
-
var field_id = this.id;
|
98 |
-
if ( 'undefined' != typeof tinyMCE ) {
|
99 |
-
try {
|
100 |
-
tinyMCE.triggerSave();
|
101 |
-
} catch (e) {
|
102 |
-
|
103 |
-
}
|
104 |
-
}
|
105 |
-
|
106 |
-
var data = jQuery('[name^=ninja_forms_field_' + field_id + ']');
|
107 |
-
var field_data = jQuery(data).serializeFullArray();
|
108 |
-
|
109 |
-
if ( typeof field_data['ninja_forms_field_' + field_id] != 'undefined' ) {
|
110 |
-
var field = field_data['ninja_forms_field_' + field_id];
|
111 |
-
|
112 |
-
for( var prop in field ) {
|
113 |
-
if ( field.hasOwnProperty( prop ) ) {
|
114 |
-
nfFields.get( field_id ).set( prop, field[ prop ] );
|
115 |
-
}
|
116 |
-
}
|
117 |
-
}
|
118 |
-
nfForm.set( 'saved', false );
|
119 |
-
},
|
120 |
-
remove: function() {
|
121 |
-
var field_id = this.id;
|
122 |
-
var answer = confirm( nf_admin.remove_field );
|
123 |
-
if ( answer ) {
|
124 |
-
var form_id = ninja_forms_settings.form_id
|
125 |
-
jQuery.post(ajaxurl, { form_id: form_id, field_id: field_id, action: 'ninja_forms_remove_field', nf_ajax_nonce:ninja_forms_settings.nf_ajax_nonce }, function( response ) {
|
126 |
-
jQuery( '#ninja_forms_field_' + field_id).remove();
|
127 |
-
jQuery( document ).trigger( 'removeField', [ field_id ] );
|
128 |
-
});
|
129 |
-
}
|
130 |
-
},
|
131 |
-
removeEmptySettings: function() {
|
132 |
-
var field_id = this.id;
|
133 |
-
jQuery( '#ninja_forms_field_' + field_id + '_inside' ).find( '.nf-field-settings .inside' ).each( function() {
|
134 |
-
var html = jQuery.trim( jQuery( this ).html() );
|
135 |
-
if ( html == '' ) {
|
136 |
-
jQuery( this ).parent().remove();
|
137 |
-
}
|
138 |
-
} );
|
139 |
-
}
|
140 |
-
|
141 |
-
} );
|
142 |
-
// Collection to hold our fields.
|
143 |
-
var nfFields = Backbone.Collection.extend({
|
144 |
-
model: nfField,
|
145 |
-
setup: function() {
|
146 |
-
// Loop through our field JSON that is already on the page and populate our collection with it.
|
147 |
-
if( 'undefined' !== typeof nf_admin.fields ) {
|
148 |
-
_.each( nf_admin.fields, function( field ) {
|
149 |
-
nfFields.add( { id: field.id, metabox_state: field.metabox_state } );
|
150 |
-
} );
|
151 |
-
}
|
152 |
-
},
|
153 |
-
updateData: function() {
|
154 |
-
// Loop through our fields collection and update any field lis that are open
|
155 |
-
_.each( this.models, function( field ) {
|
156 |
-
if ( field.get( 'metabox_state' ) == 1 ) {
|
157 |
-
field.updateData();
|
158 |
-
}
|
159 |
-
} );
|
160 |
-
},
|
161 |
-
newField: function( button ) {
|
162 |
-
var limit = jQuery( button ).data( 'limit' );
|
163 |
-
var type = jQuery( button ).data( 'type' );
|
164 |
-
var form_id = ninja_forms_settings.form_id
|
165 |
-
|
166 |
-
if ( limit != '' ){
|
167 |
-
var current_count = jQuery( '.' + type + '-li' ).length;
|
168 |
-
}else{
|
169 |
-
var current_count = '';
|
170 |
-
}
|
171 |
-
|
172 |
-
if ( typeof jQuery( button ).data( 'field' ) == 'undefined' ) {
|
173 |
-
var field_id = '';
|
174 |
-
var action = 'ninja_forms_new_field';
|
175 |
-
} else if ( jQuery( button ).data( 'type' ) == 'fav' ) {
|
176 |
-
var field_id = jQuery( button ).data( 'field' );
|
177 |
-
var action = 'ninja_forms_insert_fav';
|
178 |
-
} else {
|
179 |
-
var field_id = jQuery( button ).data( 'field' );
|
180 |
-
var action = 'ninja_forms_insert_def';
|
181 |
-
}
|
182 |
-
|
183 |
-
if ( ( limit != '' && current_count < limit ) || limit == '' || current_count == '' || current_count == 0 ) {
|
184 |
-
jQuery.post( ajaxurl, { type: type, field_id: field_id, form_id: form_id, action: action, nf_ajax_nonce:ninja_forms_settings.nf_ajax_nonce }, this.newFieldResponse );
|
185 |
-
} else {
|
186 |
-
jQuery( button ).addClass( 'disabled' );
|
187 |
-
}
|
188 |
-
nfForm.set( 'saved', false );
|
189 |
-
},
|
190 |
-
newFieldResponse: function( response ) {
|
191 |
-
// Fire our custom jQuery addField event.
|
192 |
-
jQuery( document ).trigger('addField', [ response ]);
|
193 |
-
},
|
194 |
-
addFieldDefault: function( response ) {
|
195 |
-
jQuery( '#ninja_forms_field_list' ).append( response.new_html ).show( 'slow' );
|
196 |
-
|
197 |
-
if ( response.new_type == 'List' ) {
|
198 |
-
this.listOptionsSortable();
|
199 |
-
}
|
200 |
-
if ( typeof nf_ajax_rte_editors !== 'undefined' && 'undefined' !== typeof tinyMCE ) {
|
201 |
-
for (var x = nf_ajax_rte_editors.length - 1; x >= 0; x--) {
|
202 |
-
try {
|
203 |
-
var editor_id = nf_ajax_rte_editors[x];
|
204 |
-
tinyMCE.init( tinyMCEPreInit.mceInit[ editor_id ] );
|
205 |
-
try { quicktags( tinyMCEPreInit.qtInit[ editor_id ] ); } catch(e){}
|
206 |
-
} catch (e) {
|
207 |
-
|
208 |
-
}
|
209 |
-
|
210 |
-
};
|
211 |
-
}
|
212 |
-
|
213 |
-
// Add our field to our backbone data model.
|
214 |
-
this.add( { id: response.new_id, metabox_state: 1 } );
|
215 |
-
|
216 |
-
nfFields.get( response.new_id ).removeEmptySettings();
|
217 |
-
},
|
218 |
-
listOptionsSortable: function ( response ) {
|
219 |
-
//Make List Options sortable
|
220 |
-
jQuery(".ninja-forms-field-list-options").sortable({
|
221 |
-
helper: 'clone',
|
222 |
-
handle: '.ninja-forms-drag',
|
223 |
-
items: 'div',
|
224 |
-
placeholder: 'ui-state-highlight',
|
225 |
-
update: function( event, ui ) {
|
226 |
-
var order = jQuery( this ).sortable( 'toArray' );
|
227 |
-
var x = 0;
|
228 |
-
_.each( order, function( id ) {
|
229 |
-
var field_id = jQuery( '#' + id ).data( 'field' );
|
230 |
-
|
231 |
-
var label_name = 'ninja_forms_field_' + field_id + '[list][options][' + x + '][label]';
|
232 |
-
var value_name = 'ninja_forms_field_' + field_id + '[list][options][' + x + '][value]';
|
233 |
-
var calc_name = 'ninja_forms_field_' + field_id + '[list][options][' + x + '][calc]';
|
234 |
-
var selected_name = 'ninja_forms_field_' + field_id + '[list][options][' + x + '][selected]';
|
235 |
-
|
236 |
-
jQuery( '#' + id ).find( '.ninja-forms-field-list-option-label' ).attr( 'name', label_name );
|
237 |
-
jQuery( '#' + id ).find( '.ninja-forms-field-list-option-value' ).attr( 'name', value_name );
|
238 |
-
jQuery( '#' + id ).find( '.ninja-forms-field-list-option-calc' ).attr( 'name', calc_name );
|
239 |
-
jQuery( '#' + id ).find( '.ninja-forms-field-list-option-selected' ).attr( 'name', selected_name );
|
240 |
-
|
241 |
-
x++;
|
242 |
-
} );
|
243 |
-
}
|
244 |
-
});
|
245 |
-
}
|
246 |
-
});
|
247 |
-
|
248 |
-
var nfForm = Backbone.Model.extend( {
|
249 |
-
defaults: {
|
250 |
-
'id' : ninja_forms_settings.form_id,
|
251 |
-
'status' : nf_admin.form_status,
|
252 |
-
'title' : nf_admin.form_title,
|
253 |
-
'saved' : true
|
254 |
-
},
|
255 |
-
setup: function() {
|
256 |
-
this.changeMenu();
|
257 |
-
},
|
258 |
-
changeMenu: function() {
|
259 |
-
|
260 |
-
if ( 'new' == this.get( 'status' ) ) { // If we're working with a new form, highlight the "Add New" menu item.
|
261 |
-
jQuery( '.wp-submenu li' ).removeClass( 'current' );
|
262 |
-
jQuery( 'a[href="admin.php?page=ninja-forms&tab=builder&form_id=new"]' ).parent().addClass( 'current' );
|
263 |
-
} else {
|
264 |
-
var html = '<li class="current"><a href="#">' + nf_admin.edit_form_text + '</a></li>';
|
265 |
-
if ( jQuery( 'li a:contains("' + nf_admin.edit_form_text + '")' ).length == 0 ) {
|
266 |
-
jQuery( '.wp-submenu li' ).removeClass( 'current' );
|
267 |
-
jQuery( 'a[href="admin.php?page=ninja-forms&tab=builder&form_id=new"]' ).parent().after( html );
|
268 |
-
}
|
269 |
-
}
|
270 |
-
},
|
271 |
-
save: function() {
|
272 |
-
jQuery( '.nf-save-admin-fields' ).hide();
|
273 |
-
jQuery( '.nf-save-spinner' ).show();
|
274 |
-
jQuery( '.nf-save-spinner' ).css( 'visibility', 'visible' );
|
275 |
-
|
276 |
-
// If our form is new, then prompt for a title before we save
|
277 |
-
if ( 'new' == this.get( 'status' ) ) {
|
278 |
-
if ( jQuery( '._submit-li' ).length > 0 ) {
|
279 |
-
jQuery( '#nf-insert-submit-div' ).hide();
|
280 |
-
this.set( 'show_insert_submit', false );
|
281 |
-
} else {
|
282 |
-
jQuery( '#nf-insert-submit-div' ).show();
|
283 |
-
this.set( 'show_insert_submit', true );
|
284 |
-
}
|
285 |
-
// Open our save form modal.
|
286 |
-
jQuery( '#nf-save-title' ).nfAdminModal( 'open' );
|
287 |
-
jQuery( '#modal-contents-wrapper' ).find( '#nf-form-title' ).focus();
|
288 |
-
return false;
|
289 |
-
}
|
290 |
-
|
291 |
-
nfFields.updateData();
|
292 |
-
|
293 |
-
var field_data = JSON.stringify( nfFields.toJSON() );
|
294 |
-
var field_order = {};
|
295 |
-
var current_order = jQuery( '#ninja_forms_field_list' ).sortable( 'toArray' );
|
296 |
-
|
297 |
-
for ( var i = 0; i < current_order.length; i++ ) {
|
298 |
-
field_order[i] = current_order[i];
|
299 |
-
};
|
300 |
-
field_order = JSON.stringify( field_order );
|
301 |
-
var form_id = ninja_forms_settings.form_id;
|
302 |
-
|
303 |
-
jQuery( document ).data( 'field_order', field_order );
|
304 |
-
jQuery( document ).data( 'field_data', field_data );
|
305 |
-
|
306 |
-
jQuery( document ).triggerHandler( 'nfAdminSaveFields' );
|
307 |
-
|
308 |
-
var field_order = jQuery( document ).data( 'field_order' );
|
309 |
-
var data = jQuery( document ).data( 'field_data' );
|
310 |
-
|
311 |
-
jQuery.post( ajaxurl, { form_title: this.get( 'title' ), form_id: form_id, field_data: field_data, field_order: field_order, action: 'nf_admin_save_builder', nf_ajax_nonce:ninja_forms_settings.nf_ajax_nonce }, function( response ) {
|
312 |
-
jQuery( '.nf-save-spinner' ).hide();
|
313 |
-
jQuery( '.nf-save-admin-fields' ).show();
|
314 |
-
var html = '<div id="message" class="updated below-h2" style="display:none;margin-top: 20px;"><p>' + nf_admin.saved_text + '</p></div>';
|
315 |
-
jQuery( '.nav-tab-wrapper:last' ).after( html );
|
316 |
-
jQuery( '#message' ).fadeIn();
|
317 |
-
if ( jQuery( '#nf-display-form-title' ).html() == '' ) {
|
318 |
-
jQuery( '#nf-display-form-title' ).html( nfForm.get( 'title' ) );
|
319 |
-
}
|
320 |
-
nfForm.set( 'saved', true );
|
321 |
-
nfForm.set( 'status', '' );
|
322 |
-
nfForm.changeMenu();
|
323 |
-
} );
|
324 |
-
},
|
325 |
-
saveTitle: function() {
|
326 |
-
var title = jQuery( '#modal-contents-wrapper' ).find( '#nf-form-title' ).val();
|
327 |
-
var show_insert_submit = this.get( 'show_insert_submit' );
|
328 |
-
var insert_submit = jQuery( '#modal-contents-wrapper' ).find( '#nf-insert-submit' ).prop( 'checked' );
|
329 |
-
this.set( 'title', title );
|
330 |
-
this.set( 'status', '' );
|
331 |
-
|
332 |
-
// Insert our submit button if we checked the box.
|
333 |
-
if ( show_insert_submit && insert_submit ) {
|
334 |
-
var that = this;
|
335 |
-
// Add our custom addField behaviour
|
336 |
-
jQuery( document ).on( 'addField.insertSubmit', function( e, response ) {
|
337 |
-
jQuery( '#ninja_forms_field_' + response.new_id + '_toggle' ).click();
|
338 |
-
jQuery( '#nf-save-title' ).nfAdminModal( 'close' );
|
339 |
-
that.save();
|
340 |
-
jQuery( document ).off( 'addField.insertSubmit' );
|
341 |
-
} );
|
342 |
-
jQuery( '#_submit' ).click();
|
343 |
-
} else {
|
344 |
-
jQuery( '#nf-save-title' ).nfAdminModal( 'close' );
|
345 |
-
this.save();
|
346 |
-
}
|
347 |
-
}
|
348 |
-
} );
|
349 |
-
|
350 |
-
// Instantiate our fields collection.
|
351 |
-
var nfFields = new nfFields();
|
352 |
-
|
353 |
-
// Instantiate our form settings.
|
354 |
-
var nfForm = new nfForm();
|
355 |
-
|
356 |
-
(function($){
|
357 |
-
|
358 |
-
$( document ).ready( function( $ ) {
|
359 |
-
|
360 |
-
nfFields.setup();
|
361 |
-
nfForm.setup();
|
362 |
-
|
363 |
-
// Open and close a field metabox.
|
364 |
-
$( document ).on( 'click', '.nf-edit-field', function( e ) {
|
365 |
-
e.preventDefault();
|
366 |
-
|
367 |
-
// Get our field id.
|
368 |
-
var field_id = jQuery( e.target ).data( 'field' );
|
369 |
-
nfFields.get( field_id ).toggleMetabox();
|
370 |
-
|
371 |
-
// Get our current metabox state.
|
372 |
-
var current_metabox_state = nfFields.get( field_id ).get( 'metabox_state' );
|
373 |
-
if ( current_metabox_state == 1 ) {
|
374 |
-
$( this ).addClass( 'open' );
|
375 |
-
} else {
|
376 |
-
$( this ).removeClass( 'open' );
|
377 |
-
}
|
378 |
-
});
|
379 |
-
|
380 |
-
// Remove the saved message when the user clicks anywhere on the page.
|
381 |
-
$( document ).on( 'click', function() {
|
382 |
-
$( '#message' ).fadeOut( 'slow' );
|
383 |
-
} );
|
384 |
-
|
385 |
-
$( document ).on( 'click', '.nf-save-admin-fields', function( e ) {
|
386 |
-
e.preventDefault();
|
387 |
-
nfForm.save();
|
388 |
-
} );
|
389 |
-
|
390 |
-
$( document ).on( 'click', '#nf-save-title-submit', function( e ) {
|
391 |
-
e.preventDefault();
|
392 |
-
nfForm.saveTitle();
|
393 |
-
} );
|
394 |
-
|
395 |
-
// Add New Field
|
396 |
-
$( document ).on( 'click', '.ninja-forms-new-field', function( e ) {
|
397 |
-
e.preventDefault();
|
398 |
-
nfFields.newField( e.target );
|
399 |
-
} );
|
400 |
-
|
401 |
-
// Remove Field
|
402 |
-
$( document ).on( 'click', '.nf-remove-field', function( e ){
|
403 |
-
e.preventDefault();
|
404 |
-
var field_id = jQuery( e.target ).data( 'field' );
|
405 |
-
nfFields.get( field_id ).remove();
|
406 |
-
});
|
407 |
-
|
408 |
-
// Hook into our add field response event
|
409 |
-
$( document ).on( 'addField.default', function( e, response ) {
|
410 |
-
nfFields.addFieldDefault( response );
|
411 |
-
} );
|
412 |
-
|
413 |
-
// Insert a Favorite Field
|
414 |
-
$( document ).on( 'click', '.ninja-forms-insert-fav-field', function( e ){
|
415 |
-
e.preventDefault();
|
416 |
-
nfFields.newField( e.target );
|
417 |
-
});
|
418 |
-
|
419 |
-
// Insert a Defined Field
|
420 |
-
$( document ).on( 'click', '.ninja-forms-insert-def-field', function( e ){
|
421 |
-
e .preventDefault();
|
422 |
-
nfFields.newField( e.target );
|
423 |
-
});
|
424 |
-
|
425 |
-
// Create our save form modal.
|
426 |
-
$( '#nf-save-title' ).nfAdminModal( { title: 'Save Your Form', buttons: '#nf-save-title-buttons' } );
|
427 |
-
|
428 |
-
// Remove spinners when the save title modal is closed
|
429 |
-
$( document ).on( 'nfAdminModalClose.hideSpinners', function( e ) {
|
430 |
-
jQuery( '.nf-save-spinner' ).hide();
|
431 |
-
jQuery( '.nf-save-admin-fields' ).show();
|
432 |
-
} );
|
433 |
-
|
434 |
-
// Enable/disable our save button on the name modal
|
435 |
-
$( document ).on( 'keyup', '#nf-form-title', function( e ) {
|
436 |
-
var value = this.value;
|
437 |
-
if ( this.value.length > 0 ) {
|
438 |
-
$( '#modal-contents-wrapper' ).find( '#nf-save-title-submit' ).prop( 'disabled', false );
|
439 |
-
$( '#modal-contents-wrapper' ).find( '#nf-save-title-submit' ).removeClass( 'button-secondary' );
|
440 |
-
$( '#modal-contents-wrapper' ).find( '#nf-save-title-submit' ).addClass( 'button-primary' );
|
441 |
-
} else {
|
442 |
-
$( '#modal-contents-wrapper' ).find( '#nf-save-title-submit' ).prop( 'disabled', true );
|
443 |
-
$( '#modal-contents-wrapper' ).find( '#nf-save-title-submit' ).removeClass( 'button-primary' );
|
444 |
-
$( '#modal-contents-wrapper' ).find( '#nf-save-title-submit' ).addClass( 'button-secondary' );
|
445 |
-
}
|
446 |
-
|
447 |
-
if( e.keyCode == 13 && this.value.length > 0 ){
|
448 |
-
nfForm.saveTitle();
|
449 |
-
}
|
450 |
-
} );
|
451 |
-
|
452 |
-
// Make the field list sortable
|
453 |
-
$( '.ninja-forms-field-list' ).sortable({
|
454 |
-
handle: '.menu-item-handle',
|
455 |
-
items: 'li:not(.not-sortable)',
|
456 |
-
connectWith: '.ninja-forms-field-list',
|
457 |
-
//cursorAt: {left: -10, top: -1},
|
458 |
-
start: function( e, ui ) {
|
459 |
-
var wp_editor_count = $( ui.item ).find( '.wp-editor-wrap' ).length;
|
460 |
-
if(wp_editor_count > 0){
|
461 |
-
$(ui.item).find('.wp-editor-wrap').each(function(){
|
462 |
-
try {
|
463 |
-
var ed_id = this.id.replace( 'wp- ', '');
|
464 |
-
ed_id = ed_id.replace( '-wrap', '' );
|
465 |
-
tinyMCE.execCommand( 'mceRemoveControl', false, ed_id );
|
466 |
-
} catch (e) {
|
467 |
-
|
468 |
-
}
|
469 |
-
});
|
470 |
-
}
|
471 |
-
},
|
472 |
-
stop: function( e,ui ) {
|
473 |
-
var wp_editor_count = $( ui.item ).find( '.wp-editor-wrap' ).length;
|
474 |
-
if( wp_editor_count > 0 ) {
|
475 |
-
$( ui.item ).find( '.wp-editor-wrap').each(function(){
|
476 |
-
try {
|
477 |
-
var ed_id = this.id.replace( 'wp-', '' );
|
478 |
-
ed_id = ed_id.replace( '-wrap', '' );
|
479 |
-
tinyMCE.execCommand( 'mceAddControl', true, ed_id );
|
480 |
-
} catch (e) {
|
481 |
-
|
482 |
-
}
|
483 |
-
});
|
484 |
-
}
|
485 |
-
$( this ).sortable( 'refresh' );
|
486 |
-
nfForm.set( 'saved', false );
|
487 |
-
}
|
488 |
-
});
|
489 |
-
|
490 |
-
$( document ).on( 'dblclick', '.nf-field-settings .title', function(e) {
|
491 |
-
$( this ).find( '.nf-field-sub-section-toggle' ).click();
|
492 |
-
} );
|
493 |
-
|
494 |
-
$( document ).on( 'click', '.nf-field-sub-section-toggle', function(e) {
|
495 |
-
e.preventDefault();
|
496 |
-
if ( $( this ).hasClass( 'dashicons-arrow-right' ) ) {
|
497 |
-
$( this ).removeClass( 'dashicons-arrow-right' ).addClass( 'dashicons-arrow-up' );
|
498 |
-
} else {
|
499 |
-
$( this ).removeClass( 'dashicons-arrow-up' ).addClass( 'dashicons-arrow-right' );
|
500 |
-
}
|
501 |
-
$( this ).parent().next( '.inside' ).slideToggle();
|
502 |
-
} );
|
503 |
-
|
504 |
-
$( window ).bind( 'beforeunload', function() {
|
505 |
-
if ( 'new' == nfForm.get( 'status' ) ) { // Prompt the user to give a name if they leave the builder before naming their form.
|
506 |
-
$( '#nf-save-title' ).nfAdminModal( 'open' );
|
507 |
-
return 'Please save your form before leaving this page.';
|
508 |
-
} else if ( nfForm.get( 'saved' ) == false ) {
|
509 |
-
return 'You have unsaved changes. Please save before leaving this page.';
|
510 |
-
}
|
511 |
-
} );
|
512 |
-
|
513 |
-
$( document ).on( 'dblclick', '.menu-item-handle', function( e ) {
|
514 |
-
$( this ).find( '.nf-edit-field' ).click();
|
515 |
-
} );
|
516 |
-
|
517 |
-
});
|
518 |
-
|
519 |
-
})(jQuery);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/assets/js/dev/combobox.js
DELETED
@@ -1,281 +0,0 @@
|
|
1 |
-
/*!
|
2 |
-
* Copyright Ben Olson (https://github.com/bseth99/jquery-ui-extensions)
|
3 |
-
* jQuery UI ComboBox @VERSION
|
4 |
-
*
|
5 |
-
* Adapted from Jörn Zaefferer original implementation at
|
6 |
-
* http://www.learningjquery.com/2010/06/a-jquery-ui-combobox-under-the-hood
|
7 |
-
*
|
8 |
-
* And the demo at
|
9 |
-
* http://jqueryui.com/autocomplete/#combobox
|
10 |
-
*
|
11 |
-
* Permission is hereby granted, free of charge, to any person
|
12 |
-
* obtaining a copy of this software and associated documentation
|
13 |
-
* files (the "Software"), to deal in the Software without
|
14 |
-
* restriction, including without limitation the rights to use,
|
15 |
-
* copy, modify, merge, publish, distribute, sublicense, and/or sell
|
16 |
-
* copies of the Software, and to permit persons to whom the
|
17 |
-
* Software is furnished to do so, subject to the following
|
18 |
-
* conditions:
|
19 |
-
*
|
20 |
-
* The above copyright notice and this permission notice shall be
|
21 |
-
* included in all copies or substantial portions of the Software.
|
22 |
-
*
|
23 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
24 |
-
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
25 |
-
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
26 |
-
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
27 |
-
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
28 |
-
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
29 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
30 |
-
* OTHER DEALINGS IN THE SOFTWARE.
|
31 |
-
*
|
32 |
-
*/
|
33 |
-
|
34 |
-
(function( $, undefined ) {
|
35 |
-
|
36 |
-
$.widget( "ui.combobox", {
|
37 |
-
|
38 |
-
version: "@VERSION",
|
39 |
-
|
40 |
-
widgetEventPrefix: "combobox",
|
41 |
-
|
42 |
-
uiCombo: null,
|
43 |
-
uiInput: null,
|
44 |
-
_wasOpen: false,
|
45 |
-
|
46 |
-
_create: function() {
|
47 |
-
|
48 |
-
var self = this,
|
49 |
-
select = this.element.hide(),
|
50 |
-
input, wrapper;
|
51 |
-
|
52 |
-
input = this.uiInput =
|
53 |
-
$( "<input />" )
|
54 |
-
.insertAfter(select)
|
55 |
-
.addClass("ui-widget ui-widget-content ui-corner-left ui-combobox-input")
|
56 |
-
.val( select.children(':selected').text() )
|
57 |
-
.attr('tabindex', select.attr( 'tabindex'));
|
58 |
-
|
59 |
-
wrapper = this.uiCombo =
|
60 |
-
input.wrap( '<span>' )
|
61 |
-
.parent()
|
62 |
-
.addClass( 'ui-combobox' )
|
63 |
-
.insertAfter( select );
|
64 |
-
|
65 |
-
input
|
66 |
-
.autocomplete({
|
67 |
-
|
68 |
-
delay: 0,
|
69 |
-
minLength: 0,
|
70 |
-
|
71 |
-
appendTo: wrapper,
|
72 |
-
source: $.proxy( this, "_linkSelectList" )
|
73 |
-
|
74 |
-
});
|
75 |
-
|
76 |
-
$( "<button>" )
|
77 |
-
.attr( "tabIndex", -1 )
|
78 |
-
.attr( "type", "button" )
|
79 |
-
.insertAfter( input )
|
80 |
-
.button({
|
81 |
-
icons: {
|
82 |
-
primary: "ui-icon-triangle-1-s"
|
83 |
-
},
|
84 |
-
text: false
|
85 |
-
})
|
86 |
-
.removeClass( "ui-corner-all" )
|
87 |
-
.addClass( "ui-corner-right ui-button-icon ui-combobox-button" );
|
88 |
-
|
89 |
-
|
90 |
-
// Our items have HTML tags. The default rendering uses text()
|
91 |
-
// to set the content of the <a> tag. We need html().
|
92 |
-
input.data( "ui-autocomplete" )._renderItem = function( ul, item ) {
|
93 |
-
|
94 |
-
return $( "<li>" )
|
95 |
-
.append( $( "<a>" ).html( item.label ) )
|
96 |
-
.appendTo( ul );
|
97 |
-
|
98 |
-
};
|
99 |
-
|
100 |
-
this._on( this._events );
|
101 |
-
|
102 |
-
},
|
103 |
-
|
104 |
-
|
105 |
-
_linkSelectList: function( request, response ) {
|
106 |
-
|
107 |
-
var matcher = new RegExp( $.ui.autocomplete.escapeRegex(request.term), 'i' );
|
108 |
-
response( this.element.children('option').map(function() {
|
109 |
-
var text = $( this ).text();
|
110 |
-
|
111 |
-
if ( this.value && ( !request.term || matcher.test(text) ) ) {
|
112 |
-
var optionData = {
|
113 |
-
label: text,
|
114 |
-
value: text,
|
115 |
-
option: this
|
116 |
-
};
|
117 |
-
if (request.term) {
|
118 |
-
optionData.label = text.replace(
|
119 |
-
new RegExp(
|
120 |
-
"(?![^&;]+;)(?!<[^<>]*)(" +
|
121 |
-
$.ui.autocomplete.escapeRegex(request.term) +
|
122 |
-
")(?![^<>]*>)(?![^&;]+;)", "gi"),
|
123 |
-
"<strong>$1</strong>");
|
124 |
-
}
|
125 |
-
return optionData;
|
126 |
-
}
|
127 |
-
})
|
128 |
-
);
|
129 |
-
},
|
130 |
-
|
131 |
-
_events: {
|
132 |
-
|
133 |
-
"autocompletechange input" : function(event, ui) {
|
134 |
-
|
135 |
-
var $el = $(event.currentTarget);
|
136 |
-
var changedOption = ui.item ? ui.item.option : null;
|
137 |
-
if ( !ui.item ) {
|
138 |
-
|
139 |
-
var matcher = new RegExp( "^" + $.ui.autocomplete.escapeRegex( $el.val() ) + "$", "i" ),
|
140 |
-
valid = false,
|
141 |
-
matchContains = null,
|
142 |
-
iContains = 0,
|
143 |
-
iSelectCtr = -1,
|
144 |
-
iSelected = -1,
|
145 |
-
optContains = null;
|
146 |
-
if (this.options.autofillsinglematch) {
|
147 |
-
matchContains = new RegExp($.ui.autocomplete.escapeRegex($el.val()), "i");
|
148 |
-
}
|
149 |
-
|
150 |
-
|
151 |
-
this.element.children( "option" ).each(function() {
|
152 |
-
var t = $(this).text();
|
153 |
-
if ( t.match( matcher ) ) {
|
154 |
-
this.selected = valid = true;
|
155 |
-
return false;
|
156 |
-
}
|
157 |
-
if (matchContains) {
|
158 |
-
// look for items containing the value
|
159 |
-
iSelectCtr++;
|
160 |
-
if (t.match(matchContains)) {
|
161 |
-
iContains++;
|
162 |
-
optContains = $(this);
|
163 |
-
iSelected = iSelectCtr;
|
164 |
-
}
|
165 |
-
}
|
166 |
-
});
|
167 |
-
|
168 |
-
if ( !valid ) {
|
169 |
-
// autofill option: if there is just one match, then select the matched option
|
170 |
-
if (iContains == 1) {
|
171 |
-
changedOption = optContains[0];
|
172 |
-
changedOption.selected = true;
|
173 |
-
var t2 = optContains.text();
|
174 |
-
$el.val(t2);
|
175 |
-
$el.data('ui-autocomplete').term = t2;
|
176 |
-
this.element.prop('selectedIndex', iSelected);
|
177 |
-
console.log("Found single match with '" + t2 + "'");
|
178 |
-
} else {
|
179 |
-
|
180 |
-
// remove invalid value, as it didn't match anything
|
181 |
-
$el.val( '' );
|
182 |
-
|
183 |
-
// Internally, term must change before another search is performed
|
184 |
-
// if the same search is performed again, the menu won't be shown
|
185 |
-
// because the value didn't actually change via a keyboard event
|
186 |
-
$el.data( 'ui-autocomplete' ).term = '';
|
187 |
-
|
188 |
-
this.element.prop('selectedIndex', -1);
|
189 |
-
}
|
190 |
-
}
|
191 |
-
}
|
192 |
-
|
193 |
-
this._trigger( "change", event, {
|
194 |
-
item: changedOption
|
195 |
-
});
|
196 |
-
|
197 |
-
},
|
198 |
-
|
199 |
-
"autocompleteselect input": function( event, ui ) {
|
200 |
-
|
201 |
-
ui.item.option.selected = true;
|
202 |
-
this._trigger( "select", event, {
|
203 |
-
item: ui.item.option
|
204 |
-
});
|
205 |
-
|
206 |
-
},
|
207 |
-
|
208 |
-
"autocompleteopen input": function ( event, ui ) {
|
209 |
-
|
210 |
-
this.uiCombo.children('.ui-autocomplete')
|
211 |
-
.outerWidth(this.uiCombo.outerWidth(true));
|
212 |
-
},
|
213 |
-
|
214 |
-
"mousedown .ui-combobox-button" : function ( event ) {
|
215 |
-
this._wasOpen = this.uiInput.autocomplete("widget").is(":visible");
|
216 |
-
},
|
217 |
-
|
218 |
-
"click .ui-combobox-button" : function( event ) {
|
219 |
-
|
220 |
-
this.uiInput.focus();
|
221 |
-
|
222 |
-
// close if already visible
|
223 |
-
if (this._wasOpen)
|
224 |
-
return;
|
225 |
-
|
226 |
-
// pass empty string as value to search for, displaying all results
|
227 |
-
this.uiInput.autocomplete("search", "");
|
228 |
-
|
229 |
-
}
|
230 |
-
|
231 |
-
},
|
232 |
-
|
233 |
-
value: function ( newVal ) {
|
234 |
-
var select = this.element,
|
235 |
-
valid = false,
|
236 |
-
selected;
|
237 |
-
|
238 |
-
if ( !arguments.length ) {
|
239 |
-
selected = select.children( ":selected" );
|
240 |
-
return selected.length > 0 ? selected.val() : null;
|
241 |
-
}
|
242 |
-
|
243 |
-
select.prop('selectedIndex', -1);
|
244 |
-
select.children('option').each(function() {
|
245 |
-
if ( this.value == newVal ) {
|
246 |
-
this.selected = valid = true;
|
247 |
-
return false;
|
248 |
-
}
|
249 |
-
});
|
250 |
-
|
251 |
-
if ( valid ) {
|
252 |
-
this.uiInput.val(select.children(':selected').text());
|
253 |
-
} else {
|
254 |
-
this.uiInput.val( "" );
|
255 |
-
this.element.prop('selectedIndex', -1);
|
256 |
-
}
|
257 |
-
|
258 |
-
},
|
259 |
-
|
260 |
-
_destroy: function () {
|
261 |
-
this.element.show();
|
262 |
-
this.uiCombo.replaceWith( this.element );
|
263 |
-
},
|
264 |
-
|
265 |
-
widget: function () {
|
266 |
-
return this.uiCombo;
|
267 |
-
},
|
268 |
-
|
269 |
-
_getCreateEventData: function() {
|
270 |
-
|
271 |
-
return {
|
272 |
-
select: this.element,
|
273 |
-
combo: this.uiCombo,
|
274 |
-
input: this.uiInput
|
275 |
-
};
|
276 |
-
}
|
277 |
-
|
278 |
-
});
|
279 |
-
|
280 |
-
|
281 |
-
}(jQuery));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/assets/js/dev/index.php
DELETED
@@ -1,2 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
// Silence is golden.
|
|
|
|
deprecated/assets/js/dev/nf-upgrade-handler.js
DELETED
@@ -1,177 +0,0 @@
|
|
1 |
-
jQuery(document).ready(function($) {
|
2 |
-
|
3 |
-
$( '.nf-upgrade-complete' ).nfAdminModal( { title: nfUpgradeHandler.nf_upgrade_complete_title, buttons: '.nf-upgrade-complete-buttons' } );
|
4 |
-
|
5 |
-
function UpgradeHandler( upgrade ) {
|
6 |
-
|
7 |
-
this.upgrade = upgrade;
|
8 |
-
|
9 |
-
this.process = function( step, total_steps, args ) {
|
10 |
-
|
11 |
-
step = typeof step !== 'undefined' ? step : 0;
|
12 |
-
total_step = typeof total_step !== 'undefined' ? total_step : 0;
|
13 |
-
args = typeof args !== 'undefined' ? args : [];
|
14 |
-
|
15 |
-
console.log( 'Upgrade: ' + this.upgrade );
|
16 |
-
|
17 |
-
$.post(
|
18 |
-
ajaxurl,
|
19 |
-
{
|
20 |
-
upgrade: this.upgrade,
|
21 |
-
step: parseInt( step ),
|
22 |
-
total_steps: parseInt( total_steps ),
|
23 |
-
args: args,
|
24 |
-
action: 'nf_upgrade_handler'
|
25 |
-
},
|
26 |
-
function (response) {
|
27 |
-
|
28 |
-
var elem = $( '#nf_upgrade_' + upgradeHandler.upgrade );
|
29 |
-
|
30 |
-
try {
|
31 |
-
response = $.parseJSON(response);
|
32 |
-
} catch( e ) {
|
33 |
-
|
34 |
-
// TODO: move error display to Upgrade object
|
35 |
-
|
36 |
-
elem.find( '.spinner' ).css( 'display', 'none' ).css( 'visibility', 'hidden' );
|
37 |
-
|
38 |
-
elem.find( '.dashicons-no' ).css( 'display', 'block' );
|
39 |
-
|
40 |
-
elem.find( '.nf-upgrade-handler__errors__text').html('Bad Response :\'(<br/>' + e + "<br />" + response );
|
41 |
-
elem.find( '.nf-upgrade-handler__errors').slideDown();
|
42 |
-
|
43 |
-
return;
|
44 |
-
}
|
45 |
-
|
46 |
-
console.log( 'DEBUG: NF_UpgradeHandler step response: ');
|
47 |
-
console.log( response );
|
48 |
-
|
49 |
-
if( undefined == response ) {
|
50 |
-
|
51 |
-
// TODO: move error display to Upgrade object
|
52 |
-
|
53 |
-
elem.find( '.spinner' ).css( 'display', 'none' ).css( 'visibility', 'hidden' );
|
54 |
-
|
55 |
-
elem.find( '.dashicons-no' ).css( 'display', 'block' );
|
56 |
-
|
57 |
-
elem.find( '.nf-upgrade-handler__errors__text').html('Empty Response :\'(');
|
58 |
-
elem.find( '.nf-upgrade-handler__errors').slideDown();
|
59 |
-
|
60 |
-
return;
|
61 |
-
}
|
62 |
-
|
63 |
-
if( response.errors ) {
|
64 |
-
// TODO: move error display to Upgrade object
|
65 |
-
elem.find( '.spinner' ).css( 'display', 'none' ).css( 'visibility', 'hidden' );
|
66 |
-
|
67 |
-
elem.find( '.dashicons-no' ).css( 'display', 'block' );
|
68 |
-
|
69 |
-
var error_text = '';
|
70 |
-
|
71 |
-
$.each( response.errors, function( index, error ) {
|
72 |
-
error_text = error_text + '[' + index + '] ' + error + '<br />';
|
73 |
-
});
|
74 |
-
|
75 |
-
elem.find( '.nf-upgrade-handler__errors__text').html('Processing Error :\'(<br />' + error_text );
|
76 |
-
elem.find( '.nf-upgrade-handler__errors').slideDown();
|
77 |
-
|
78 |
-
$( '#progressbar_' + response.upgrade).slideUp();
|
79 |
-
|
80 |
-
return;
|
81 |
-
}
|
82 |
-
|
83 |
-
var progressbar = $( '#progressbar_' + response.upgrade ).progressbar({
|
84 |
-
value: 100 * ( response.step / response.total_steps )
|
85 |
-
});
|
86 |
-
|
87 |
-
//TODO: move animations to Upgrade object
|
88 |
-
elem.find( '.spinner' ).css( 'display', 'block' ).css( 'visibility', 'visible' );
|
89 |
-
|
90 |
-
elem.find( '.dashicons-no' ).css( 'display', 'none' );
|
91 |
-
|
92 |
-
elem.find( '.inside') .slideDown();
|
93 |
-
|
94 |
-
if ( undefined != response.complete ) {
|
95 |
-
|
96 |
-
//TODO: move animations to Upgrade object
|
97 |
-
elem.find( '.inside' ).slideUp();
|
98 |
-
|
99 |
-
elem.find( '.spinner' ).css( 'display', 'none' ).css( 'visibility', 'hidden' );
|
100 |
-
|
101 |
-
elem.find( '.dashicons-yes').css( 'display', 'block' );
|
102 |
-
|
103 |
-
if ( undefined != response.nextUpgrade ) {
|
104 |
-
upgradeHandler.upgrade = response.nextUpgrade;
|
105 |
-
|
106 |
-
$( '#nf_upgrade_' + upgradeHandler.upgrade ).find( '.spinner' ).css( 'display', 'block' ).css( 'visibility', 'visible' );
|
107 |
-
|
108 |
-
$( '#nf_upgrade_' + upgradeHandler.upgrade ).find( '.inside') .slideDown();
|
109 |
-
|
110 |
-
upgradeHandler.process();
|
111 |
-
return;
|
112 |
-
}
|
113 |
-
|
114 |
-
console.log( 'DEBUG: NF_UpgradeHandler says "It is finished!"' );
|
115 |
-
|
116 |
-
$( '.nf-upgrade-complete' ).nfAdminModal( 'open' );
|
117 |
-
|
118 |
-
return;
|
119 |
-
}
|
120 |
-
|
121 |
-
upgradeHandler.process( response.step, response.total_steps, response.args );
|
122 |
-
}
|
123 |
-
).fail(function() {
|
124 |
-
alert( "error" );
|
125 |
-
});
|
126 |
-
|
127 |
-
};
|
128 |
-
|
129 |
-
}
|
130 |
-
|
131 |
-
function Upgrade( name ) {
|
132 |
-
|
133 |
-
this.name = name;
|
134 |
-
|
135 |
-
this.elem = '#nf_upgrade_' + name;
|
136 |
-
|
137 |
-
this.open = function() {
|
138 |
-
|
139 |
-
jQuery( this.elem).slideDown();
|
140 |
-
|
141 |
-
};
|
142 |
-
|
143 |
-
this.close = function() {
|
144 |
-
|
145 |
-
jQuery( this.elem).slideUp();
|
146 |
-
|
147 |
-
};
|
148 |
-
|
149 |
-
}
|
150 |
-
|
151 |
-
if( "undefined" != typeof nfUpgradeHandler ) {
|
152 |
-
|
153 |
-
console.log('DEBUG: NF_UpgradeHandler first upgrades is ' + nfUpgradeHandler.upgrade);
|
154 |
-
|
155 |
-
var upgradeHandler = new UpgradeHandler(nfUpgradeHandler.upgrade);
|
156 |
-
|
157 |
-
$('.progressbar').progressbar({value: 0});
|
158 |
-
|
159 |
-
var first_upgrade = $('#nf_upgrade_' + upgradeHandler.upgrade);
|
160 |
-
|
161 |
-
//TODO: move animations to Upgrade object
|
162 |
-
first_upgrade.find('.spinner').css('display', 'block').css('visibility', 'visible');
|
163 |
-
|
164 |
-
first_upgrade.find('.dashicons-no').css('display', 'none');
|
165 |
-
|
166 |
-
first_upgrade.find('.inside').slideDown();
|
167 |
-
|
168 |
-
upgradeHandler.process();
|
169 |
-
|
170 |
-
} else {
|
171 |
-
|
172 |
-
// No Upgrades to run, return to All Forms Page
|
173 |
-
document.location.href = "admin.php?page=ninja-forms";
|
174 |
-
|
175 |
-
}
|
176 |
-
|
177 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/assets/js/dev/notifications.js
DELETED
@@ -1,116 +0,0 @@
|
|
1 |
-
jQuery(document).ready(function($) {
|
2 |
-
|
3 |
-
|
4 |
-
$( '#settings-type' ).change( function() {
|
5 |
-
var val = this.value;
|
6 |
-
$( '.notification-type' ).hide();
|
7 |
-
$( '#notification-' + val ).show();
|
8 |
-
});
|
9 |
-
|
10 |
-
$( document ).on( 'click', '.notification-delete', function(e) {
|
11 |
-
e.preventDefault();
|
12 |
-
var answer = confirm( commonL10n.warnDelete );
|
13 |
-
var tr = $( this ).parent().parent().parent().parent();
|
14 |
-
var n_id = $( this ).data( 'n_id' );
|
15 |
-
console.log( n_id );
|
16 |
-
if(answer){
|
17 |
-
$.post( ajaxurl, { n_id: n_id, action: 'nf_delete_notification', nf_ajax_nonce:ninja_forms_settings.nf_ajax_nonce }, function( response ) {
|
18 |
-
$( tr ).css( 'background-color', '#FF0000' ).fadeOut( 'slow', function() {
|
19 |
-
$(this).remove();
|
20 |
-
} );
|
21 |
-
});
|
22 |
-
}
|
23 |
-
});
|
24 |
-
|
25 |
-
$( document ).on( 'click', '.notification-activate', function(e) {
|
26 |
-
e.preventDefault();
|
27 |
-
var tr = $( this ).parent().parent().parent().parent();
|
28 |
-
var activate_action = $( this ).data( 'action' );
|
29 |
-
var n_id = $( this ).data( 'n_id' );
|
30 |
-
var that = this;
|
31 |
-
$.post( ajaxurl, { n_id: n_id, activate_action: activate_action, action: 'nf_' + activate_action + '_notification', nf_ajax_nonce:ninja_forms_settings.nf_ajax_nonce }, function( response ) {
|
32 |
-
$( tr ).removeClass( 'nf-notification-active' );
|
33 |
-
$( tr ).removeClass( 'nf-notification-inactive' );
|
34 |
-
|
35 |
-
if ( activate_action == 'activate' ) {
|
36 |
-
$( tr ).addClass( 'nf-notification-active' );
|
37 |
-
$( that ).html( nf_notifications.deactivate );
|
38 |
-
$( that ).data( 'action', 'deactivate' );
|
39 |
-
} else {
|
40 |
-
$( tr ).addClass( 'nf-notification-inactive' );
|
41 |
-
$( that ).html( nf_notifications.activate );
|
42 |
-
$( that ).data( 'action', 'activate' );
|
43 |
-
}
|
44 |
-
});
|
45 |
-
});
|
46 |
-
|
47 |
-
$( '.nf-tokenize' ).each( function() {
|
48 |
-
var limit = $( this ).data( 'token-limit' );
|
49 |
-
var key = $( this ).data( 'key' );
|
50 |
-
var type = $( this ).data( 'type' );
|
51 |
-
$( this ).tokenfield({
|
52 |
-
autocomplete: {
|
53 |
-
source: nf_notifications.search_fields[ type ],
|
54 |
-
delay: 100,
|
55 |
-
},
|
56 |
-
tokens: nf_notifications.tokens[ key ],
|
57 |
-
delimiter: [ '`' ],
|
58 |
-
showAutocompleteOnFocus: true,
|
59 |
-
beautify: false,
|
60 |
-
limit: limit,
|
61 |
-
createTokensOnBlur: true
|
62 |
-
});
|
63 |
-
});
|
64 |
-
|
65 |
-
$( document ).on( 'click', '.nf-insert-field', function(e) {
|
66 |
-
e.preventDefault();
|
67 |
-
var field_id = $( this ).prev().prev( '.nf-fields-combobox' ).val();
|
68 |
-
if ( field_id != '' && field_id != null ) {
|
69 |
-
var shortcode = '[ninja_forms_field id=' + field_id + ']';
|
70 |
-
window.parent.send_to_editor( shortcode );
|
71 |
-
}
|
72 |
-
});
|
73 |
-
|
74 |
-
$( document ).on( 'click', '.nf-insert-all-fields', function(e) {
|
75 |
-
e.preventDefault();
|
76 |
-
var shortcode = '[ninja_forms_all_fields]';
|
77 |
-
window.parent.send_to_editor( shortcode );
|
78 |
-
});
|
79 |
-
|
80 |
-
$( '.nf-fields-combobox' ).combobox();
|
81 |
-
|
82 |
-
$( '.ui-combobox-input' ).focus( function(e) {
|
83 |
-
var selected = $( this ).parent().prev( '.nf-fields-combobox' ).val();
|
84 |
-
if ( selected == '' || selected == null ) {
|
85 |
-
this.value = '';
|
86 |
-
} else {
|
87 |
-
$( this ).select();
|
88 |
-
}
|
89 |
-
});
|
90 |
-
|
91 |
-
$( '.ui-combobox-input' ).mouseup(function(e){
|
92 |
-
e.preventDefault();
|
93 |
-
});
|
94 |
-
|
95 |
-
$( '.ui-combobox-input' ).blur( function(e) {
|
96 |
-
if ( this.value == '' ) {
|
97 |
-
this.value = $( this ).parent().prev( '.nf-fields-combobox' ).data( 'first-option' );
|
98 |
-
}
|
99 |
-
});
|
100 |
-
|
101 |
-
$( '#filter-type' ).change( function(e) {
|
102 |
-
if ( this.value == '' ) {
|
103 |
-
var url = nf_notifications.filter_type;
|
104 |
-
} else {
|
105 |
-
var url = nf_notifications.filter_type + '&type=' + this.value
|
106 |
-
}
|
107 |
-
$( '.spinner' ).show();
|
108 |
-
document.location.href = url;
|
109 |
-
});
|
110 |
-
|
111 |
-
$( '#toggle_email_advanced' ).click( function(e) {
|
112 |
-
e.preventDefault();
|
113 |
-
$( '#email_advanced' ).toggle();
|
114 |
-
});
|
115 |
-
|
116 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/assets/js/dev/subs-cpt.js
DELETED
@@ -1,60 +0,0 @@
|
|
1 |
-
jQuery(document).ready(function($) {
|
2 |
-
|
3 |
-
var nf_columns = {
|
4 |
-
init: function() {
|
5 |
-
//this.move_row_actions();
|
6 |
-
// Remove our "ID" checkbox.
|
7 |
-
$( '#id-hide' ).parent().remove();
|
8 |
-
var that = this;
|
9 |
-
$( document ).on( 'click', '.hide-column-tog', that.save_hidden_columns );
|
10 |
-
},
|
11 |
-
save_hidden_columns: function() {
|
12 |
-
// Send our hidden columns to our backend for saving.
|
13 |
-
var hidden = columns.hidden();
|
14 |
-
$.post(
|
15 |
-
ajaxurl,
|
16 |
-
{
|
17 |
-
form_id: nf_sub.form_id,
|
18 |
-
hidden: hidden,
|
19 |
-
action:'nf_hide_columns'
|
20 |
-
}
|
21 |
-
);
|
22 |
-
// Move our row-actions
|
23 |
-
//nf_columns.move_row_actions();
|
24 |
-
},
|
25 |
-
move_row_actions: function() {
|
26 |
-
// Move our row-actions class to our first column.
|
27 |
-
$( "#the-list tr" ).each( function( e ) {
|
28 |
-
var first_column = $( this ).find( 'td:visible' ).eq(0);
|
29 |
-
if ( typeof $( first_column ).html() == 'undefined' ) {
|
30 |
-
first_column = $( this ).find( 'td:first' );
|
31 |
-
}
|
32 |
-
$( this ).find( 'td div.row-actions' ).detach().appendTo( first_column );
|
33 |
-
});
|
34 |
-
}
|
35 |
-
}
|
36 |
-
|
37 |
-
nf_columns.init();
|
38 |
-
|
39 |
-
$( '.datepicker' ).datepicker( nf_sub.datepicker_args );
|
40 |
-
|
41 |
-
$( document ).on( 'change', '.nf-form-jump', function( e ) {
|
42 |
-
$( '#posts-filter' ).submit();
|
43 |
-
});
|
44 |
-
|
45 |
-
$( document ).on( 'submit', function( e ) {
|
46 |
-
$( '.spinner' ).show();
|
47 |
-
if ( $( 'select[name="action"]' ).val() == 'export' || $( 'select[name="action2"]' ).val() == 'export' ) {
|
48 |
-
setTimeout(function(){ // Delay for Chrome
|
49 |
-
$( 'input:checkbox' ).attr( 'checked', false );
|
50 |
-
$( '.spinner' ).hide();
|
51 |
-
$( 'select[name="action"]' ).val( '-1' );
|
52 |
-
$( 'select[name="action2"]' ).val( '-1' );
|
53 |
-
}, 2000);
|
54 |
-
}
|
55 |
-
});
|
56 |
-
|
57 |
-
$( '.screen-options' ).prepend( $( '#nf-subs-screen-options' ).html() );
|
58 |
-
$( '#nf-subs-screen-options' ).remove();
|
59 |
-
|
60 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/assets/js/index.php
DELETED
@@ -1,2 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
// Silence is golden.
|
|
|
|
deprecated/assets/js/lib/cheet.min.js
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
!function(global){"use strict";function keydown(e){var id,k=e?e.keyCode:event.keyCode;if(!held[k]){held[k]=!0;for(id in sequences)sequences[id].keydown(k)}}function keyup(e){var k=e?e.keyCode:event.keyCode;held[k]=!1}function resetHeldKeys(){var k;for(k in held)held[k]=!1}function on(obj,type,fn){obj.addEventListener?obj.addEventListener(type,fn,!1):obj.attachEvent&&(obj["e"+type+fn]=fn,obj[type+fn]=function(){obj["e"+type+fn](window.event)},obj.attachEvent("on"+type,obj[type+fn]))}var cheet,Sequence,sequences={},keys={backspace:8,tab:9,enter:13,"return":13,shift:16,"⇧":16,control:17,ctrl:17,"⌃":17,alt:18,option:18,"⌥":18,pause:19,capslock:20,esc:27,space:32,pageup:33,pagedown:34,end:35,home:36,left:37,L:37,"←":37,up:38,U:38,"↑":38,right:39,R:39,"→":39,down:40,D:40,"↓":40,insert:45,"delete":46,0:48,1:49,2:50,3:51,4:52,5:53,6:54,7:55,8:56,9:57,a:65,b:66,c:67,d:68,e:69,f:70,g:71,h:72,i:73,j:74,k:75,l:76,m:77,n:78,o:79,p:80,q:81,r:82,s:83,t:84,u:85,v:86,w:87,x:88,y:89,z:90,"⌘":91,command:91,kp_0:96,kp_1:97,kp_2:98,kp_3:99,kp_4:100,kp_5:101,kp_6:102,kp_7:103,kp_8:104,kp_9:105,kp_multiply:106,kp_plus:107,kp_minus:109,kp_decimal:110,kp_divide:111,f1:112,f2:113,f3:114,f4:115,f5:116,f6:117,f7:118,f8:119,f9:120,f10:121,f11:122,f12:123,equal:187,"=":187,comma:188,",":188,minus:189,"-":189,period:190,".":190},NOOP=function(){},held={};Sequence=function(str,next,fail,done){var i;for(this.str=str,this.next=next?next:NOOP,this.fail=fail?fail:NOOP,this.done=done?done:NOOP,this.seq=str.split(" "),this.keys=[],i=0;i<this.seq.length;++i)this.keys.push(keys[this.seq[i]]);this.idx=0},Sequence.prototype.keydown=function(keyCode){var i=this.idx;return keyCode!==this.keys[i]?void(i>0&&(this.reset(),this.fail(this.str),cheet.__fail(this.str))):(this.next(this.str,this.seq[i],i,this.seq),cheet.__next(this.str,this.seq[i],i,this.seq),void(++this.idx===this.keys.length&&(this.done(this.str),cheet.__done(this.str),this.reset())))},Sequence.prototype.reset=function(){this.idx=0},cheet=function(str,handlers){var next,fail,done;"function"==typeof handlers?done=handlers:null!==handlers&&void 0!==handlers&&(next=handlers.next,fail=handlers.fail,done=handlers.done),sequences[str]=new Sequence(str,next,fail,done)},cheet.disable=function(str){delete sequences[str]},on(window,"keydown",keydown),on(window,"keyup",keyup),on(window,"blur",resetHeldKeys),on(window,"focus",resetHeldKeys),cheet.__next=NOOP,cheet.next=function(fn){cheet.__next=null===fn?NOOP:fn},cheet.__fail=NOOP,cheet.fail=function(fn){cheet.__fail=null===fn?NOOP:fn},cheet.__done=NOOP,cheet.done=function(fn){cheet.__done=null===fn?NOOP:fn},cheet.reset=function(id){var seq=sequences[id];return seq instanceof Sequence?void seq.reset():void console.warn("cheet: Unknown sequence: "+id)},global.cheet=cheet,"function"==typeof define&&define.amd?define([],function(){return cheet}):"undefined"!=typeof module&&null!==module&&(module.exports=cheet)}(this);
|
|
deprecated/assets/js/lib/howler.core.min.js
DELETED
@@ -1,2 +0,0 @@
|
|
1 |
-
/*! howler.js v2.0.0-beta8 | (c) 2013-2016, James Simpson of GoldFire Studios | MIT License | howlerjs.com */
|
2 |
-
!function(){"use strict";function e(){try{"undefined"!=typeof AudioContext?n=new AudioContext:"undefined"!=typeof webkitAudioContext?n=new webkitAudioContext:o=!1}catch(e){o=!1}if(!o)if("undefined"!=typeof Audio)try{var d=new Audio;"undefined"==typeof d.oncanplaythrough&&(u="canplay")}catch(e){t=!0}else t=!0;try{var d=new Audio;d.muted&&(t=!0)}catch(e){}var a=/iP(hone|od|ad)/.test(navigator.platform),i=navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/),_=i?parseInt(i[1],10):null;if(a&&_&&9>_){var s=/safari/.test(window.navigator.userAgent.toLowerCase());(window.navigator.standalone&&!s||!window.navigator.standalone&&!s)&&(o=!1)}o&&(r="undefined"==typeof n.createGain?n.createGainNode():n.createGain(),r.gain.value=1,r.connect(n.destination))}var n=null,o=!0,t=!1,r=null,u="canplaythrough";e();var d=function(){this.init()};d.prototype={init:function(){var e=this||a;return e._codecs={},e._howls=[],e._muted=!1,e._volume=1,e.state=n?n.state||"running":"running",e.autoSuspend=!0,e._autoSuspend(),e.mobileAutoEnable=!0,e.noAudio=t,e.usingWebAudio=o,e.ctx=n,e.masterGain=r,t||e._setupCodecs(),e},volume:function(e){var n=this||a;if(e=parseFloat(e),"undefined"!=typeof e&&e>=0&&1>=e){n._volume=e,o&&(r.gain.value=e);for(var t=0;t<n._howls.length;t++)if(!n._howls[t]._webAudio)for(var u=n._howls[t]._getSoundIds(),d=0;d<u.length;d++){var i=n._howls[t]._soundById(u[d]);i&&i._node&&(i._node.volume=i._volume*e)}return n}return n._volume},mute:function(e){var n=this||a;n._muted=e,o&&(r.gain.value=e?0:n._volume);for(var t=0;t<n._howls.length;t++)if(!n._howls[t]._webAudio)for(var u=n._howls[t]._getSoundIds(),d=0;d<u.length;d++){var i=n._howls[t]._soundById(u[d]);i&&i._node&&(i._node.muted=e?!0:i._muted)}return n},unload:function(){for(var o=this||a,t=o._howls.length-1;t>=0;t--)o._howls[t].unload();return o.usingWebAudio&&"undefined"!=typeof n.close&&(o.ctx=null,n.close(),e(),o.ctx=n),o},codecs:function(e){return(this||a)._codecs[e]},_setupCodecs:function(){var e=this||a,n=new Audio,o=n.canPlayType("audio/mpeg;").replace(/^no$/,""),t=/OPR\//.test(navigator.userAgent);return e._codecs={mp3:!(t||!o&&!n.canPlayType("audio/mp3;").replace(/^no$/,"")),mpeg:!!o,opus:!!n.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/,""),ogg:!!n.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),oga:!!n.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),wav:!!n.canPlayType('audio/wav; codecs="1"').replace(/^no$/,""),aac:!!n.canPlayType("audio/aac;").replace(/^no$/,""),caf:!!n.canPlayType("audio/x-caf;").replace(/^no$/,""),m4a:!!(n.canPlayType("audio/x-m4a;")||n.canPlayType("audio/m4a;")||n.canPlayType("audio/aac;")).replace(/^no$/,""),mp4:!!(n.canPlayType("audio/x-mp4;")||n.canPlayType("audio/mp4;")||n.canPlayType("audio/aac;")).replace(/^no$/,""),weba:!!n.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,""),webm:!!n.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,""),dolby:!!n.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/,"")},e},_enableMobileAudio:function(){var e=this||a,o=/iPhone|iPad|iPod|Android|BlackBerry|BB10|Silk/i.test(navigator.userAgent),t=!!("ontouchend"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0);if(!n||!e._mobileEnabled&&o&&t){e._mobileEnabled=!1;var r=function(){var o=n.createBuffer(1,1,22050),t=n.createBufferSource();t.buffer=o,t.connect(n.destination),"undefined"==typeof t.start?t.noteOn(0):t.start(0),t.onended=function(){t.disconnect(0),e._mobileEnabled=!0,e.mobileAutoEnable=!1,document.removeEventListener("touchend",r,!0)}};return document.addEventListener("touchend",r,!0),e}},_autoSuspend:function(){var e=this;if(e.autoSuspend&&n&&"undefined"!=typeof n.suspend&&o){for(var t=0;t<e._howls.length;t++)if(e._howls[t]._webAudio)for(var r=0;r<e._howls[t]._sounds.length;r++)if(!e._howls[t]._sounds[r]._paused)return e;return e._suspendTimer=setTimeout(function(){e.autoSuspend&&(e._suspendTimer=null,e.state="suspending",n.suspend().then(function(){e.state="suspended",e._resumeAfterSuspend&&(delete e._resumeAfterSuspend,e._autoResume())}))},3e4),e}},_autoResume:function(){var e=this;if(n&&"undefined"!=typeof n.resume&&o)return"running"===e.state&&e._suspendTimer?(clearTimeout(e._suspendTimer),e._suspendTimer=null):"suspended"===e.state?(e.state="resuming",n.resume().then(function(){e.state="running"}),e._suspendTimer&&(clearTimeout(e._suspendTimer),e._suspendTimer=null)):"suspending"===e.state&&(e._resumeAfterSuspend=!0),e}};var a=new d,i=function(e){var n=this;return e.src&&0!==e.src.length?void n.init(e):void console.error("An array of source files must be passed with any new Howl.")};i.prototype={init:function(e){var t=this;return t._autoplay=e.autoplay||!1,t._format="string"!=typeof e.format?e.format:[e.format],t._html5=e.html5||!1,t._muted=e.mute||!1,t._loop=e.loop||!1,t._pool=e.pool||5,t._preload="boolean"==typeof e.preload?e.preload:!0,t._rate=e.rate||1,t._sprite=e.sprite||{},t._src="string"!=typeof e.src?e.src:[e.src],t._volume=void 0!==e.volume?e.volume:1,t._duration=0,t._state="unloaded",t._sounds=[],t._endTimers={},t._queue=[],t._onend=e.onend?[{fn:e.onend}]:[],t._onfade=e.onfade?[{fn:e.onfade}]:[],t._onload=e.onload?[{fn:e.onload}]:[],t._onloaderror=e.onloaderror?[{fn:e.onloaderror}]:[],t._onpause=e.onpause?[{fn:e.onpause}]:[],t._onplay=e.onplay?[{fn:e.onplay}]:[],t._onstop=e.onstop?[{fn:e.onstop}]:[],t._onmute=e.onmute?[{fn:e.onmute}]:[],t._onvolume=e.onvolume?[{fn:e.onvolume}]:[],t._onrate=e.onrate?[{fn:e.onrate}]:[],t._onseek=e.onseek?[{fn:e.onseek}]:[],t._webAudio=o&&!t._html5,"undefined"!=typeof n&&n&&a.mobileAutoEnable&&a._enableMobileAudio(),a._howls.push(t),t._preload&&t.load(),t},load:function(){var e=this,n=null;if(t)return void e._emit("loaderror",null,"No audio support.");"string"==typeof e._src&&(e._src=[e._src]);for(var o=0;o<e._src.length;o++){var r,u;if(e._format&&e._format[o]?r=e._format[o]:(u=e._src[o],r=/^data:audio\/([^;,]+);/i.exec(u),r||(r=/\.([^.]+)$/.exec(u.split("?",1)[0])),r&&(r=r[1].toLowerCase())),a.codecs(r)){n=e._src[o];break}}return n?(e._src=n,e._state="loading","https:"===window.location.protocol&&"http:"===n.slice(0,5)&&(e._html5=!0,e._webAudio=!1),new _(e),e._webAudio&&l(e),e):void e._emit("loaderror",null,"No codec support for selected audio sources.")},play:function(e){var o=this,t=arguments,r=null;if("number"==typeof e)r=e,e=null;else if("undefined"==typeof e){e="__default";for(var d=0,i=0;i<o._sounds.length;i++)o._sounds[i]._paused&&!o._sounds[i]._ended&&(d++,r=o._sounds[i]._id);1===d?e=null:r=null}var _=r?o._soundById(r):o._inactiveSound();if(!_)return null;if(r&&!e&&(e=_._sprite||"__default"),"loaded"!==o._state&&!o._sprite[e])return o._queue.push({event:"play",action:function(){o.play(o._soundById(_._id)?_._id:void 0)}}),_._id;if(r&&!_._paused)return t[1]||setTimeout(function(){o._emit("play",_._id)},0),_._id;o._webAudio&&a._autoResume();var s=_._seek>0?_._seek:o._sprite[e][0]/1e3,l=(o._sprite[e][0]+o._sprite[e][1])/1e3-s,f=1e3*l/Math.abs(_._rate);f!==1/0&&(o._endTimers[_._id]=setTimeout(o._ended.bind(o,_),f)),_._paused=!1,_._ended=!1,_._sprite=e,_._seek=s,_._start=o._sprite[e][0]/1e3,_._stop=(o._sprite[e][0]+o._sprite[e][1])/1e3,_._loop=!(!_._loop&&!o._sprite[e][2]);var c=_._node;if(o._webAudio){var p=function(){o._refreshBuffer(_);var e=_._muted||o._muted?0:_._volume*a.volume();c.gain.setValueAtTime(e,n.currentTime),_._playStart=n.currentTime,"undefined"==typeof c.bufferSource.start?_._loop?c.bufferSource.noteGrainOn(0,s,86400):c.bufferSource.noteGrainOn(0,s,l):_._loop?c.bufferSource.start(0,s,86400):c.bufferSource.start(0,s,l),o._endTimers[_._id]||f===1/0||(o._endTimers[_._id]=setTimeout(o._ended.bind(o,_),f)),t[1]||setTimeout(function(){o._emit("play",_._id)},0)};"loaded"===o._state?p():(o.once("load",p,_._id),o._clearTimer(_._id))}else{var m=function(){c.currentTime=s,c.muted=_._muted||o._muted||a._muted||c.muted,c.volume=_._volume*a.volume(),c.playbackRate=_._rate,setTimeout(function(){c.play(),t[1]||o._emit("play",_._id)},0)};if(4===c.readyState||window&&window.ejecta||!c.readyState&&navigator.isCocoonJS)m();else{var v=function(){f!==1/0&&(o._endTimers[_._id]=setTimeout(o._ended.bind(o,_),f)),m(),c.removeEventListener(u,v,!1)};c.addEventListener(u,v,!1),o._clearTimer(_._id)}}return _._id},pause:function(e){var n=this;if("loaded"!==n._state)return n._queue.push({event:"pause",action:function(){n.pause(e)}}),n;for(var o=n._getSoundIds(e),t=0;t<o.length;t++){n._clearTimer(o[t]);var r=n._soundById(o[t]);if(r&&!r._paused){if(r._seek=n.seek(o[t]),r._paused=!0,n._stopFade(o[t]),r._node)if(n._webAudio){if(!r._node.bufferSource)return n;"undefined"==typeof r._node.bufferSource.stop?r._node.bufferSource.noteOff(0):r._node.bufferSource.stop(0),r._node.bufferSource=null}else isNaN(r._node.duration)&&r._node.duration!==1/0||r._node.pause();arguments[1]||n._emit("pause",r._id)}}return n},stop:function(e){var n=this;if("loaded"!==n._state)return"undefined"!=typeof n._sounds[0]._sprite&&n._queue.push({event:"stop",action:function(){n.stop(e)}}),n;for(var o=n._getSoundIds(e),t=0;t<o.length;t++){n._clearTimer(o[t]);var r=n._soundById(o[t]);if(r&&!r._paused){if(r._seek=r._start||0,r._paused=!0,r._ended=!0,n._stopFade(o[t]),r._node)if(n._webAudio){if(!r._node.bufferSource)return n;"undefined"==typeof r._node.bufferSource.stop?r._node.bufferSource.noteOff(0):r._node.bufferSource.stop(0),r._node.bufferSource=null}else isNaN(r._node.duration)&&r._node.duration!==1/0||(r._node.pause(),r._node.currentTime=r._start||0);n._emit("stop",r._id)}}return n},mute:function(e,o){var t=this;if("loaded"!==t._state)return t._queue.push({event:"mute",action:function(){t.mute(e,o)}}),t;if("undefined"==typeof o){if("boolean"!=typeof e)return t._muted;t._muted=e}for(var r=t._getSoundIds(o),u=0;u<r.length;u++){var d=t._soundById(r[u]);d&&(d._muted=e,t._webAudio&&d._node?d._node.gain.setValueAtTime(e?0:d._volume*a.volume(),n.currentTime):d._node&&(d._node.muted=a._muted?!0:e),t._emit("mute",d._id))}return t},volume:function(){var e,o,t=this,r=arguments;if(0===r.length)return t._volume;if(1===r.length){var u=t._getSoundIds(),d=u.indexOf(r[0]);d>=0?o=parseInt(r[0],10):e=parseFloat(r[0])}else r.length>=2&&(e=parseFloat(r[0]),o=parseInt(r[1],10));var i;if(!("undefined"!=typeof e&&e>=0&&1>=e))return i=o?t._soundById(o):t._sounds[0],i?i._volume:0;if("loaded"!==t._state)return t._queue.push({event:"volume",action:function(){t.volume.apply(t,r)}}),t;"undefined"==typeof o&&(t._volume=e),o=t._getSoundIds(o);for(var _=0;_<o.length;_++)i=t._soundById(o[_]),i&&(i._volume=e,r[2]||t._stopFade(o[_]),t._webAudio&&i._node&&!i._muted?i._node.gain.setValueAtTime(e*a.volume(),n.currentTime):i._node&&!i._muted&&(i._node.volume=e*a.volume()),t._emit("volume",i._id));return t},fade:function(e,o,t,r){var u=this;if("loaded"!==u._state)return u._queue.push({event:"fade",action:function(){u.fade(e,o,t,r)}}),u;u.volume(e,r);for(var d=u._getSoundIds(r),a=0;a<d.length;a++){var i=u._soundById(d[a]);if(i)if(r||u._stopFade(d[a]),u._webAudio&&!i._muted){var _=n.currentTime,s=_+t/1e3;i._volume=e,i._node.gain.setValueAtTime(e,_),i._node.gain.linearRampToValueAtTime(o,s),i._timeout=setTimeout(function(e,t){delete t._timeout,setTimeout(function(){t._volume=o,u._emit("fade",e)},s-n.currentTime>0?Math.ceil(1e3*(s-n.currentTime)):0)}.bind(u,d[a],i),t)}else{var l=Math.abs(e-o),f=e>o?"out":"in",c=l/.01,p=t/c;!function(){var n=e;i._interval=setInterval(function(e,t){n+="in"===f?.01:-.01,n=Math.max(0,n),n=Math.min(1,n),n=Math.round(100*n)/100,u.volume(n,e,!0),n===o&&(clearInterval(t._interval),delete t._interval,u._emit("fade",e))}.bind(u,d[a],i),p)}()}}return u},_stopFade:function(e){var o=this,t=o._soundById(e);return t._interval?(clearInterval(t._interval),delete t._interval,o._emit("fade",e)):t._timeout&&(clearTimeout(t._timeout),delete t._timeout,t._node.gain.cancelScheduledValues(n.currentTime),o._emit("fade",e)),o},loop:function(){var e,n,o,t=this,r=arguments;if(0===r.length)return t._loop;if(1===r.length){if("boolean"!=typeof r[0])return o=t._soundById(parseInt(r[0],10)),o?o._loop:!1;e=r[0],t._loop=e}else 2===r.length&&(e=r[0],n=parseInt(r[1],10));for(var u=t._getSoundIds(n),d=0;d<u.length;d++)o=t._soundById(u[d]),o&&(o._loop=e,t._webAudio&&o._node&&o._node.bufferSource&&(o._node.bufferSource.loop=e));return t},rate:function(){var e,n,o=this,t=arguments;if(0===t.length)n=o._sounds[0]._id;else if(1===t.length){var r=o._getSoundIds(),u=r.indexOf(t[0]);u>=0?n=parseInt(t[0],10):e=parseFloat(t[0])}else 2===t.length&&(e=parseFloat(t[0]),n=parseInt(t[1],10));var d;if("number"!=typeof e)return d=o._soundById(n),d?d._rate:o._rate;if("loaded"!==o._state)return o._queue.push({event:"rate",action:function(){o.rate.apply(o,t)}}),o;"undefined"==typeof n&&(o._rate=e),n=o._getSoundIds(n);for(var a=0;a<n.length;a++)if(d=o._soundById(n[a])){d._rate=e,o._webAudio&&d._node&&d._node.bufferSource?d._node.bufferSource.playbackRate.value=e:d._node&&(d._node.playbackRate=e);var i=o.seek(n[a]),_=(o._sprite[d._sprite][0]+o._sprite[d._sprite][1])/1e3-i,s=1e3*_/Math.abs(d._rate);o._clearTimer(n[a]),o._endTimers[n[a]]=setTimeout(o._ended.bind(o,d),s),o._emit("rate",d._id)}return o},seek:function(){var e,o,t=this,r=arguments;if(0===r.length)o=t._sounds[0]._id;else if(1===r.length){var u=t._getSoundIds(),d=u.indexOf(r[0]);d>=0?o=parseInt(r[0],10):(o=t._sounds[0]._id,e=parseFloat(r[0]))}else 2===r.length&&(e=parseFloat(r[0]),o=parseInt(r[1],10));if("undefined"==typeof o)return t;if("loaded"!==t._state)return t._queue.push({event:"seek",action:function(){t.seek.apply(t,r)}}),t;var a=t._soundById(o);if(a){if(!(e>=0))return t._webAudio?a._seek+(t.playing(o)?n.currentTime-a._playStart:0):a._node.currentTime;var i=t.playing(o);i&&t.pause(o,!0),a._seek=e,t._clearTimer(o),i&&t.play(o,!0),t._emit("seek",o)}return t},playing:function(e){var n=this,o=n._soundById(e)||n._sounds[0];return o?!o._paused:!1},duration:function(e){var n=this,o=n._soundById(e)||n._sounds[0];return n._duration/o._rate},state:function(){return this._state},unload:function(){for(var e=this,n=e._sounds,o=0;o<n.length;o++){n[o]._paused||(e.stop(n[o]._id),e._emit("end",n[o]._id)),e._webAudio||(n[o]._node.src="",n[o]._node.removeEventListener("error",n[o]._errorFn,!1),n[o]._node.removeEventListener(u,n[o]._loadFn,!1)),delete n[o]._node,e._clearTimer(n[o]._id);var t=a._howls.indexOf(e);t>=0&&a._howls.splice(t,1)}return s&&delete s[e._src],e._state="unloaded",e._sounds=[],e=null,null},on:function(e,n,o,t){var r=this,u=r["_on"+e];return"function"==typeof n&&u.push(t?{id:o,fn:n,once:t}:{id:o,fn:n}),r},off:function(e,n,o){var t=this,r=t["_on"+e];if(n){for(var u=0;u<r.length;u++)if(n===r[u].fn&&o===r[u].id){r.splice(u,1);break}}else if(e)t["_on"+e]=[];else for(var d=Object.keys(t),u=0;u<d.length;u++)0===d[u].indexOf("_on")&&Array.isArray(t[d[u]])&&(t[d[u]]=[]);return t},once:function(e,n,o){var t=this;return t.on(e,n,o,1),t},_emit:function(e,n,o){for(var t=this,r=t["_on"+e],u=r.length-1;u>=0;u--)r[u].id&&r[u].id!==n&&"load"!==e||(setTimeout(function(e){e.call(this,n,o)}.bind(t,r[u].fn),0),r[u].once&&t.off(e,r[u].fn,r[u].id));return t},_loadQueue:function(){var e=this;if(e._queue.length>0){var n=e._queue[0];e.once(n.event,function(){e._queue.shift(),e._loadQueue()}),n.action()}return e},_ended:function(e){var o=this,t=e._sprite,r=!(!e._loop&&!o._sprite[t][2]);if(o._emit("end",e._id),!o._webAudio&&r&&o.stop(e._id).play(e._id),o._webAudio&&r){o._emit("play",e._id),e._seek=e._start||0,e._playStart=n.currentTime;var u=1e3*(e._stop-e._start)/Math.abs(e._rate);o._endTimers[e._id]=setTimeout(o._ended.bind(o,e),u)}return o._webAudio&&!r&&(e._paused=!0,e._ended=!0,e._seek=e._start||0,o._clearTimer(e._id),e._node.bufferSource=null,a._autoSuspend()),o._webAudio||r||o.stop(e._id),o},_clearTimer:function(e){var n=this;return n._endTimers[e]&&(clearTimeout(n._endTimers[e]),delete n._endTimers[e]),n},_soundById:function(e){for(var n=this,o=0;o<n._sounds.length;o++)if(e===n._sounds[o]._id)return n._sounds[o];return null},_inactiveSound:function(){var e=this;e._drain();for(var n=0;n<e._sounds.length;n++)if(e._sounds[n]._ended)return e._sounds[n].reset();return new _(e)},_drain:function(){var e=this,n=e._pool,o=0,t=0;if(!(e._sounds.length<n)){for(t=0;t<e._sounds.length;t++)e._sounds[t]._ended&&o++;for(t=e._sounds.length-1;t>=0;t--){if(n>=o)return;e._sounds[t]._ended&&(e._webAudio&&e._sounds[t]._node&&e._sounds[t]._node.disconnect(0),e._sounds.splice(t,1),o--)}}},_getSoundIds:function(e){var n=this;if("undefined"==typeof e){for(var o=[],t=0;t<n._sounds.length;t++)o.push(n._sounds[t]._id);return o}return[e]},_refreshBuffer:function(e){var o=this;return e._node.bufferSource=n.createBufferSource(),e._node.bufferSource.buffer=s[o._src],e._panner?e._node.bufferSource.connect(e._panner):e._node.bufferSource.connect(e._node),e._node.bufferSource.loop=e._loop,e._loop&&(e._node.bufferSource.loopStart=e._start||0,e._node.bufferSource.loopEnd=e._stop),e._node.bufferSource.playbackRate.value=o._rate,o}};var _=function(e){this._parent=e,this.init()};if(_.prototype={init:function(){var e=this,n=e._parent;return e._muted=n._muted,e._loop=n._loop,e._volume=n._volume,e._muted=n._muted,e._rate=n._rate,e._seek=0,e._paused=!0,e._ended=!0,e._sprite="__default",e._id=Math.round(Date.now()*Math.random()),n._sounds.push(e),e.create(),e},create:function(){var e=this,o=e._parent,t=a._muted||e._muted||e._parent._muted?0:e._volume*a.volume();return o._webAudio?(e._node="undefined"==typeof n.createGain?n.createGainNode():n.createGain(),e._node.gain.setValueAtTime(t,n.currentTime),e._node.paused=!0,e._node.connect(r)):(e._node=new Audio,e._errorFn=e._errorListener.bind(e),e._node.addEventListener("error",e._errorFn,!1),e._loadFn=e._loadListener.bind(e),e._node.addEventListener(u,e._loadFn,!1),e._node.src=o._src,e._node.preload="auto",e._node.volume=t,e._node.load()),e},reset:function(){var e=this,n=e._parent;return e._muted=n._muted,e._loop=n._loop,e._volume=n._volume,e._muted=n._muted,e._rate=n._rate,e._seek=0,e._paused=!0,e._ended=!0,e._sprite="__default",e._id=Math.round(Date.now()*Math.random()),e},_errorListener:function(){var e=this;e._node.error&&4===e._node.error.code&&(a.noAudio=!0),e._parent._emit("loaderror",e._id,e._node.error?e._node.error.code:0),e._node.removeEventListener("error",e._errorListener,!1)},_loadListener:function(){var e=this,n=e._parent;n._duration=Math.ceil(10*e._node.duration)/10,0===Object.keys(n._sprite).length&&(n._sprite={__default:[0,1e3*n._duration]}),"loaded"!==n._state&&(n._state="loaded",n._emit("load"),n._loadQueue()),n._autoplay&&n.play(),e._node.removeEventListener(u,e._loadFn,!1)}},o)var s={},l=function(e){var n=e._src;if(s[n])return e._duration=s[n].duration,void p(e);if(/^data:[^;]+;base64,/.test(n)){window.atob=window.atob||function(e){for(var n,o,t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",r=String(e).replace(/=+$/,""),u=0,d=0,a="";o=r.charAt(d++);~o&&(n=u%4?64*n+o:o,u++%4)?a+=String.fromCharCode(255&n>>(-2*u&6)):0)o=t.indexOf(o);return a};for(var o=atob(n.split(",")[1]),t=new Uint8Array(o.length),r=0;r<o.length;++r)t[r]=o.charCodeAt(r);c(t.buffer,e)}else{var u=new XMLHttpRequest;u.open("GET",n,!0),u.responseType="arraybuffer",u.onload=function(){var n=(u.status+"")[0];return"2"!==n&&"3"!==n?void e._emit("loaderror",null,"Failed loading audio file with status: "+u.status+"."):void c(u.response,e)},u.onerror=function(){e._webAudio&&(e._html5=!0,e._webAudio=!1,e._sounds=[],delete s[n],e.load())},f(u)}},f=function(e){try{e.send()}catch(n){e.onerror()}},c=function(e,o){n.decodeAudioData(e,function(e){e&&o._sounds.length>0&&(s[o._src]=e,p(o,e))},function(){o._emit("loaderror",null,"Decoding audio data failed.")})},p=function(e,n){n&&!e._duration&&(e._duration=n.duration),0===Object.keys(e._sprite).length&&(e._sprite={__default:[0,1e3*e._duration]}),"loaded"!==e._state&&(e._state="loaded",e._emit("load"),e._loadQueue()),e._autoplay&&e.play()};"function"==typeof define&&define.amd&&define([],function(){return{Howler:a,Howl:i}}),"undefined"!=typeof exports&&(exports.Howler=a,exports.Howl=i),"undefined"!=typeof window?(window.HowlerGlobal=d,window.Howler=a,window.Howl=i,window.Sound=_):"undefined"!=typeof global&&(global.HowlerGlobal=d,global.Howler=a,global.Howl=i,global.Sound=_)}();
|
|
|
|
deprecated/assets/js/min/admin-modal.min.js
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
jQuery.fn.nfAdminModal=function(n,d){if(0==jQuery("#nf-admin-modal-backdrop").length){var e='<div id="nf-admin-modal-backdrop" style="display: none;"></div><div id="nf-admin-modal-wrap" class="wp-core-ui" style="display: none;"><div id="nf-admin-modal" tabindex="-1"><div id="admin-modal-title"><span id="nf-modal-title"></span><button type="button" id="nf-admin-modal-close" class="modal-close"><span class="screen-reader-text modal-close">Close</span></button></div><div id="modal-contents-wrapper" style="padding:20px;"><div id="nf-admin-modal-content" class="admin-modal-inside"></div><div class="submitbox" style="display:block;"></div></div></div></div>';jQuery("body").append(e)}"object"==typeof n&&(d=n);var o={title:"",buttons:!1,backgroundClose:!1};if("undefined"==typeof d?(d=jQuery(this).data("nfAdminModal"),"undefined"==typeof d&&(d=jQuery.extend(o,d))):d=jQuery.extend(o,d),jQuery(this).data("nfAdminModal",d),jQuery(this).hide(),jQuery("#nf-admin-modal-content").html(this.html()),jQuery("#nf-modal-title").html(d.title),d.buttons){jQuery(d.buttons).hide();var a=jQuery(d.buttons).html();jQuery("#modal-contents-wrapper").find(".submitbox").html(a),jQuery("#nf-admin-modal-content").addClass("admin-modal-inside"),jQuery("#modal-contents-wrapper").find(".submitbox").show()}else jQuery("#nf-admin-modal-content").removeClass("admin-modal-inside"),jQuery("#modal-contents-wrapper").find(".submitbox").hide();jQuery("#nf-admin-modal-backdrop").data("backgroundClose",d.backgroundClose),"close"==n?jQuery.fn.nfAdminModal.close():"open"==n&&jQuery.fn.nfAdminModal.open()},jQuery(document).on("click","#nf-admin-modal-backdrop",function(){1==jQuery(this).data("backgroundClose")&&jQuery.fn.nfAdminModal.close()}),jQuery(document).on("click",".modal-close",function(n){n.preventDefault(),jQuery.fn.nfAdminModal.close()}),jQuery.fn.nfAdminModal.close=function(){jQuery("#nf-admin-modal-backdrop").hide(),jQuery("#nf-admin-modal-wrap").hide(),jQuery(document).triggerHandler("nfAdminModalClose")},jQuery.fn.nfAdminModal.open=function(){jQuery("#nf-admin-modal-backdrop").show(),jQuery("#nf-admin-modal-wrap").show(),jQuery(document).triggerHandler("nfAdminModalOpen")};
|
|
deprecated/assets/js/min/bootstrap-tokenfield.min.js
DELETED
@@ -1,7 +0,0 @@
|
|
1 |
-
/*!
|
2 |
-
* bootstrap-tokenfield 0.12.0
|
3 |
-
* https://github.com/sliptree/bootstrap-tokenfield
|
4 |
-
* Copyright 2013-2014 Sliptree and other contributors; Licensed MIT
|
5 |
-
*/
|
6 |
-
|
7 |
-
!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?module.exports=global.window&&global.window.$?a(global.window.$):function(b){if(!b.$&&!b.fn)throw new Error("Tokenfield requires a window object with jQuery or a jQuery instance");return a(b.$||b)}:a(jQuery)}(function(a,b){"use strict";var c=function(c,d){var e=this;this.$element=a(c),this.textDirection=this.$element.css("direction"),this.options=a.extend(!0,{},a.fn.tokenfield.defaults,{tokens:this.$element.val()},this.$element.data(),d),this._delimiters="string"==typeof this.options.delimiter?[this.options.delimiter]:this.options.delimiter,this._triggerKeys=a.map(this._delimiters,function(a){return a.charCodeAt(0)}),this._firstDelimiter=this._delimiters[0];var f=a.inArray(" ",this._delimiters),g=a.inArray("-",this._delimiters);f>=0&&(this._delimiters[f]="\\s"),g>=0&&(delete this._delimiters[g],this._delimiters.unshift("-"));var h=["\\","$","[","{","^",".","|","?","*","+","(",")"];a.each(this._delimiters,function(b,c){var d=a.inArray(c,h);d>=0&&(e._delimiters[b]="\\"+c)});var i,j=b&&"function"==typeof b.getMatchedCSSRules?b.getMatchedCSSRules(c):null,k=c.style.width,l=this.$element.width();j&&a.each(j,function(a,b){b.style.width&&(i=b.style.width)});var m="rtl"===a("body").css("direction")?"right":"left",n={position:this.$element.css("position")};n[m]=this.$element.css(m),this.$element.data("original-styles",n).data("original-tabindex",this.$element.prop("tabindex")).css("position","absolute").css(m,"-10000px").prop("tabindex",-1),this.$wrapper=a('<div class="tokenfield form-control" />'),this.$element.hasClass("input-lg")&&this.$wrapper.addClass("input-lg"),this.$element.hasClass("input-sm")&&this.$wrapper.addClass("input-sm"),"rtl"===this.textDirection&&this.$wrapper.addClass("rtl");var o=this.$element.prop("id")||(new Date).getTime()+""+Math.floor(100*(1+Math.random()));this.$input=a('<input type="text" class="token-input" autocomplete="off" />').appendTo(this.$wrapper).prop("placeholder",this.$element.prop("placeholder")).prop("id",o+"-tokenfield").prop("tabindex",this.$element.data("original-tabindex"));var p=a('label[for="'+this.$element.prop("id")+'"]');if(p.length&&p.prop("for",this.$input.prop("id")),this.$copyHelper=a('<input type="text" />').css("position","absolute").css(m,"-10000px").prop("tabindex",-1).prependTo(this.$wrapper),k?this.$wrapper.css("width",k):i?this.$wrapper.css("width",i):this.$element.parents(".form-inline").length&&this.$wrapper.width(l),(this.$element.prop("disabled")||this.$element.parents("fieldset[disabled]").length)&&this.disable(),this.$element.prop("readonly")&&this.readonly(),this.$mirror=a('<span style="position:absolute; top:-999px; left:0; white-space:pre;"/>'),this.$input.css("min-width",this.options.minWidth+"px"),a.each(["fontFamily","fontSize","fontWeight","fontStyle","letterSpacing","textTransform","wordSpacing","textIndent"],function(a,b){e.$mirror[0].style[b]=e.$input.css(b)}),this.$mirror.appendTo("body"),this.$wrapper.insertBefore(this.$element),this.$element.prependTo(this.$wrapper),this.update(),this.setTokens(this.options.tokens,!1,!1),this.listen(),!a.isEmptyObject(this.options.autocomplete)){var q="rtl"===this.textDirection?"right":"left",r=a.extend({minLength:this.options.showAutocompleteOnFocus?0:null,position:{my:q+" top",at:q+" bottom",of:this.$wrapper}},this.options.autocomplete);this.$input.autocomplete(r)}if(!a.isEmptyObject(this.options.typeahead)){var s=this.options.typeahead,t={minLength:this.options.showAutocompleteOnFocus?0:null},u=a.isArray(s)?s:[s,s];u[0]=a.extend({},t,u[0]),this.$input.typeahead.apply(this.$input,u),this.typeahead=!0}this.$element.trigger("tokenfield:initialize")};c.prototype={constructor:c,createToken:function(b,c){var d=this;if("string"==typeof b&&(b={value:b,label:b}),"undefined"==typeof c&&(c=!0),b.value=a.trim(b.value),b.label=b.label&&b.label.length?a.trim(b.label):b.value,!(!b.value.length||!b.label.length||b.label.length<=this.options.minLength||this.options.limit&&this.getTokens().length>=this.options.limit)){var e=a.Event("tokenfield:createtoken",{attrs:b});if(this.$element.trigger(e),e.attrs&&!e.isDefaultPrevented()){var f=a('<div class="token" />').attr("data-value",b.value).append('<span class="token-label" />').append('<a href="#" class="close" tabindex="-1">×</a>');this.$input.hasClass("tt-input")?this.$input.parent().before(f):this.$input.before(f),this.$input.css("width",this.options.minWidth+"px");var g=f.find(".token-label"),h=f.find(".close");return this.maxTokenWidth||(this.maxTokenWidth=this.$wrapper.width()-h.outerWidth()-parseInt(h.css("margin-left"),10)-parseInt(h.css("margin-right"),10)-parseInt(f.css("border-left-width"),10)-parseInt(f.css("border-right-width"),10)-parseInt(f.css("padding-left"),10)-parseInt(f.css("padding-right"),10),parseInt(g.css("border-left-width"),10)-parseInt(g.css("border-right-width"),10)-parseInt(g.css("padding-left"),10)-parseInt(g.css("padding-right"),10),parseInt(g.css("margin-left"),10)-parseInt(g.css("margin-right"),10)),g.text(b.label).css("max-width",this.maxTokenWidth),f.on("mousedown",function(){return d._disabled||d._readonly?!1:(d.preventDeactivation=!0,void 0)}).on("click",function(a){return d._disabled||d._readonly?!1:(d.preventDeactivation=!1,a.ctrlKey||a.metaKey?(a.preventDefault(),d.toggle(f)):(d.activate(f,a.shiftKey,a.shiftKey),void 0))}).on("dblclick",function(){return d._disabled||d._readonly||!d.options.allowEditing?!1:(d.edit(f),void 0)}),h.on("click",a.proxy(this.remove,this)),this.$element.trigger(a.Event("tokenfield:createdtoken",{attrs:b,relatedTarget:f.get(0)})),c&&this.$element.val(this.getTokensList()).trigger(a.Event("change",{initiator:"tokenfield"})),this.update(),this.$element.get(0)}}},setTokens:function(b,c,d){if(b){c||this.$wrapper.find(".token").remove(),"undefined"==typeof d&&(d=!0),"string"==typeof b&&(b=this._delimiters.length?b.split(new RegExp("["+this._delimiters.join("")+"]")):[b]);var e=this;return a.each(b,function(a,b){e.createToken(b,d)}),this.$element.get(0)}},getTokenData:function(b){var c=b.map(function(){var b=a(this);return{value:b.attr("data-value"),label:b.find(".token-label").text()}}).get();return 1==c.length&&(c=c[0]),c},getTokens:function(b){var c=this,d=[],e=b?".active":"";return this.$wrapper.find(".token"+e).each(function(){d.push(c.getTokenData(a(this)))}),d},getTokensList:function(b,c,d){b=b||this._firstDelimiter,c="undefined"!=typeof c&&null!==c?c:this.options.beautify;var e=b+(c&&" "!==b?" ":"");return a.map(this.getTokens(d),function(a){return a.value}).join(e)},getInput:function(){return this.$input.val()},listen:function(){var c=this;this.$element.on("change",a.proxy(this.change,this)),this.$wrapper.on("mousedown",a.proxy(this.focusInput,this)),this.$input.on("focus",a.proxy(this.focus,this)).on("blur",a.proxy(this.blur,this)).on("paste",a.proxy(this.paste,this)).on("keydown",a.proxy(this.keydown,this)).on("keypress",a.proxy(this.keypress,this)).on("keyup",a.proxy(this.keyup,this)),this.$copyHelper.on("focus",a.proxy(this.focus,this)).on("blur",a.proxy(this.blur,this)).on("keydown",a.proxy(this.keydown,this)).on("keyup",a.proxy(this.keyup,this)),this.$input.on("keypress",a.proxy(this.update,this)).on("keyup",a.proxy(this.update,this)),this.$input.on("autocompletecreate",function(){var b=a(this).data("ui-autocomplete").menu.element,d=c.$wrapper.outerWidth()-parseInt(b.css("border-left-width"),10)-parseInt(b.css("border-right-width"),10);b.css("min-width",d+"px")}).on("autocompleteselect",function(a,b){return c.createToken(b.item)&&(c.$input.val(""),c.$input.data("edit")&&c.unedit(!0)),!1}).on("typeahead:selected typeahead:autocompleted",function(a,b){c.createToken(b)&&(c.$input.typeahead("val",""),c.$input.data("edit")&&c.unedit(!0))}),a(b).on("resize",a.proxy(this.update,this))},keydown:function(b){function c(a){if(e.$input.is(document.activeElement)){if(e.$input.val().length>0)return;a+="All";var c=e.$input.hasClass("tt-input")?e.$input.parent()[a](".token:first"):e.$input[a](".token:first");if(!c.length)return;e.preventInputFocus=!0,e.preventDeactivation=!0,e.activate(c),b.preventDefault()}else e[a](b.shiftKey),b.preventDefault()}function d(c){if(b.shiftKey){if(e.$input.is(document.activeElement)){if(e.$input.val().length>0)return;var d=e.$input.hasClass("tt-input")?e.$input.parent()[c+"All"](".token:first"):e.$input[c+"All"](".token:first");if(!d.length)return;e.activate(d)}var f="prev"===c?"next":"prev",g="prev"===c?"first":"last";e.firstActiveToken[f+"All"](".token").each(function(){e.deactivate(a(this))}),e.activate(e.$wrapper.find(".token:"+g),!0,!0),b.preventDefault()}}if(this.focused){var e=this;switch(b.keyCode){case 8:if(!this.$input.is(document.activeElement))break;this.lastInputValue=this.$input.val();break;case 37:c("rtl"===this.textDirection?"next":"prev");break;case 38:d("prev");break;case 39:c("rtl"===this.textDirection?"prev":"next");break;case 40:d("next");break;case 65:if(this.$input.val().length>0||!b.ctrlKey&&!b.metaKey)break;this.activateAll(),b.preventDefault();break;case 9:case 13:if(this.$input.data("ui-autocomplete")&&this.$input.data("ui-autocomplete").menu.element.find("li:has(a.ui-state-focus)").length)break;if(this.$input.hasClass("tt-input")&&this.$wrapper.find(".tt-cursor").length)break;if(this.$input.hasClass("tt-input")&&this.$wrapper.find(".tt-hint").val().length)break;if(this.$input.is(document.activeElement)&&this.$input.val().length||this.$input.data("edit"))return this.createTokensFromInput(b,this.$input.data("edit"));if(13===b.keyCode){if(!this.$copyHelper.is(document.activeElement)||1!==this.$wrapper.find(".token.active").length)break;if(!e.options.allowEditing)break;this.edit(this.$wrapper.find(".token.active"))}}this.lastKeyDown=b.keyCode}},keypress:function(b){return this.lastKeyPressCode=b.keyCode,this.lastKeyPressCharCode=b.charCode,-1!==a.inArray(b.charCode,this._triggerKeys)&&this.$input.is(document.activeElement)?(this.$input.val()&&this.createTokensFromInput(b),!1):void 0},keyup:function(a){if(this.preventInputFocus=!1,this.focused){switch(a.keyCode){case 8:if(this.$input.is(document.activeElement)){if(this.$input.val().length||this.lastInputValue.length&&8===this.lastKeyDown)break;this.preventDeactivation=!0;var b=this.$input.hasClass("tt-input")?this.$input.parent().prevAll(".token:first"):this.$input.prevAll(".token:first");if(!b.length)break;this.activate(b)}else this.remove(a);break;case 46:this.remove(a,"next")}this.lastKeyUp=a.keyCode}},focus:function(){this.focused=!0,this.$wrapper.addClass("focus"),this.$input.is(document.activeElement)&&(this.$wrapper.find(".active").removeClass("active"),this.$firstActiveToken=null,this.options.showAutocompleteOnFocus&&this.search())},blur:function(a){this.focused=!1,this.$wrapper.removeClass("focus"),this.preventDeactivation||this.$element.is(document.activeElement)||(this.$wrapper.find(".active").removeClass("active"),this.$firstActiveToken=null),!this.preventCreateTokens&&(this.$input.data("edit")&&!this.$input.is(document.activeElement)||this.options.createTokensOnBlur)&&this.createTokensFromInput(a),this.preventDeactivation=!1,this.preventCreateTokens=!1},paste:function(a){var b=this;setTimeout(function(){b.createTokensFromInput(a)},1)},change:function(a){"tokenfield"!==a.initiator&&this.setTokens(this.$element.val())},createTokensFromInput:function(a,b){if(!(this.$input.val().length<this.options.minLength)){var c=this.getTokensList();return this.setTokens(this.$input.val(),!0),c==this.getTokensList()&&this.$input.val().length?!1:(this.$input.hasClass("tt-input")?this.$input.typeahead("val",""):this.$input.val(""),this.$input.data("edit")&&this.unedit(b),!1)}},next:function(a){if(a){var b=this.$wrapper.find(".active:first"),c=b&&this.$firstActiveToken?b.index()<this.$firstActiveToken.index():!1;if(c)return this.deactivate(b)}var d=this.$wrapper.find(".active:last"),e=d.nextAll(".token:first");return e.length?(this.activate(e,a),void 0):(this.$input.focus(),void 0)},prev:function(a){if(a){var b=this.$wrapper.find(".active:last"),c=b&&this.$firstActiveToken?b.index()>this.$firstActiveToken.index():!1;if(c)return this.deactivate(b)}var d=this.$wrapper.find(".active:first"),e=d.prevAll(".token:first");return e.length||(e=this.$wrapper.find(".token:first")),e.length||a?(this.activate(e,a),void 0):(this.$input.focus(),void 0)},activate:function(b,c,d,e){if(b){if("undefined"==typeof e)var e=!0;if(d)var c=!0;if(this.$copyHelper.focus(),c||(this.$wrapper.find(".active").removeClass("active"),e?this.$firstActiveToken=b:delete this.$firstActiveToken),d&&this.$firstActiveToken){var f=this.$firstActiveToken.index()-2,g=b.index()-2,h=this;this.$wrapper.find(".token").slice(Math.min(f,g)+1,Math.max(f,g)).each(function(){h.activate(a(this),!0)})}b.addClass("active"),this.$copyHelper.val(this.getTokensList(null,null,!0)).select()}},activateAll:function(){var b=this;this.$wrapper.find(".token").each(function(c){b.activate(a(this),0!==c,!1,!1)})},deactivate:function(a){a&&(a.removeClass("active"),this.$copyHelper.val(this.getTokensList(null,null,!0)).select())},toggle:function(a){a&&(a.toggleClass("active"),this.$copyHelper.val(this.getTokensList(null,null,!0)).select())},edit:function(b){if(b){var c={value:b.data("value"),label:b.find(".token-label").text()},d={attrs:c,relatedTarget:b.get(0)},e=a.Event("tokenfield:edittoken",d);if(this.$element.trigger(e),!e.isDefaultPrevented()){b.find(".token-label").text(c.value);var f=b.outerWidth(),g=this.$input.hasClass("tt-input")?this.$input.parent():this.$input;b.replaceWith(g),this.preventCreateTokens=!0,this.$input.val(c.value).select().data("edit",!0).width(f),this.update(),this.$element.trigger(a.Event("tokenfield:editedtoken",d))}}},unedit:function(a){var b=this.$input.hasClass("tt-input")?this.$input.parent():this.$input;if(b.appendTo(this.$wrapper),this.$input.data("edit",!1),this.$mirror.text(""),this.update(),a){var c=this;setTimeout(function(){c.$input.focus()},1)}},remove:function(b,c){if(!(this.$input.is(document.activeElement)||this._disabled||this._readonly)){var d="click"===b.type?a(b.target).closest(".token"):this.$wrapper.find(".token.active");if("click"!==b.type){if(!c)var c="prev";if(this[c](),"prev"===c)var e=0===d.first().prevAll(".token:first").length}var f={attrs:this.getTokenData(d),relatedTarget:d.get(0)},g=a.Event("tokenfield:removetoken",f);if(this.$element.trigger(g),!g.isDefaultPrevented()){var h=a.Event("tokenfield:removedtoken",f),i=a.Event("change",{initiator:"tokenfield"});d.remove(),this.$element.val(this.getTokensList()).trigger(h).trigger(i),(!this.$wrapper.find(".token").length||"click"===b.type||e)&&this.$input.focus(),this.$input.css("width",this.options.minWidth+"px"),this.update(),b.preventDefault(),b.stopPropagation()}}},update:function(){var a=this.$input.val(),b=parseInt(this.$input.css("padding-left"),10),c=parseInt(this.$input.css("padding-right"),10),d=b+c;if(this.$input.data("edit")){if(a||(a=this.$input.prop("placeholder")),a===this.$mirror.text())return;this.$mirror.text(a);var e=this.$mirror.width()+10;if(e>this.$wrapper.width())return this.$input.width(this.$wrapper.width());this.$input.width(e)}else{if(this.$input.css("width",this.options.minWidth+"px"),"rtl"===this.textDirection)return this.$input.width(this.$input.offset().left+this.$input.outerWidth()-this.$wrapper.offset().left-parseInt(this.$wrapper.css("padding-left"),10)-d-1);this.$input.width(this.$wrapper.offset().left+this.$wrapper.width()+parseInt(this.$wrapper.css("padding-left"),10)-this.$input.offset().left-d)}},focusInput:function(b){if(!(a(b.target).closest(".token").length||a(b.target).closest(".token-input").length||a(b.target).closest(".tt-dropdown-menu").length)){var c=this;setTimeout(function(){c.$input.focus()},0)}},search:function(){this.$input.data("ui-autocomplete")&&this.$input.autocomplete("search")},disable:function(){this.setProperty("disabled",!0)},enable:function(){this.setProperty("disabled",!1)},readonly:function(){this.setProperty("readonly",!0)},writeable:function(){this.setProperty("readonly",!1)},setProperty:function(a,b){this["_"+a]=b,this.$input.prop(a,b),this.$element.prop(a,b),this.$wrapper[b?"addClass":"removeClass"](a)},destroy:function(){this.$element.val(this.getTokensList()),this.$element.css(this.$element.data("original-styles")),this.$element.prop("tabindex",this.$element.data("original-tabindex"));var b=a('label[for="'+this.$input.prop("id")+'"]');b.length&&b.prop("for",this.$element.prop("id")),this.$element.insertBefore(this.$wrapper),this.$element.removeData("original-styles").removeData("original-tabindex").removeData("bs.tokenfield"),this.$wrapper.remove();var c=this.$element;return delete this,c}};var d=a.fn.tokenfield;return a.fn.tokenfield=function(b,d){var e,f=[];Array.prototype.push.apply(f,arguments);var g=this.each(function(){var g=a(this),h=g.data("bs.tokenfield"),i="object"==typeof b&&b;"string"==typeof b&&h&&h[b]?(f.shift(),e=h[b].apply(h,f)):h||"string"==typeof b||d||g.data("bs.tokenfield",h=new c(this,i))});return"undefined"!=typeof e?e:g},a.fn.tokenfield.defaults={minWidth:60,minLength:0,allowEditing:!0,limit:0,autocomplete:{},typeahead:{},showAutocompleteOnFocus:!1,createTokensOnBlur:!1,delimiter:",",beautify:!0},a.fn.tokenfield.Constructor=c,a.fn.tokenfield.noConflict=function(){return a.fn.tokenfield=d,this},c});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/assets/js/min/builder.min.js
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
var nfField=Backbone.Model.extend({toggleMetabox:function(){var e=this.id,n=this.get("metabox_state");if(1==n)var t=0;else var t=1;1==t?this.updateHTML():(this.updateData(),jQuery("#ninja_forms_field_"+e+"_inside").find("div.rte").each(function(){if("undefined"!=typeof tinymce)try{var e=jQuery(this).find("textarea.wp-editor-area").prop("id");tinymce.remove("#"+e)}catch(n){}}),jQuery("#ninja_forms_field_"+e+"_inside").slideUp("fast",function(){jQuery("#ninja_forms_field_"+e+"_inside").empty(),jQuery("#ninja_forms_field_"+e+"_inside").addClass("no-padding")})),this.set("metabox_state",t)},updateHTML:function(){var e=this.id;jQuery("#ninja_forms_metabox_field_"+e).find(".spinner").show(),jQuery("#ninja_forms_metabox_field_"+e).find(".spinner").css("visibility","visible"),this.updateData();var n=JSON.stringify(this.toJSON()),t=this;jQuery.post(ajaxurl,{field_id:e,data:n,action:"nf_output_field_settings_html",nf_ajax_nonce:ninja_forms_settings.nf_ajax_nonce},function(n){if(jQuery("#ninja_forms_metabox_field_"+e).find(".spinner").hide(),jQuery("#ninja_forms_field_"+e+"_inside").removeClass("no-padding"),jQuery("#ninja_forms_field_"+e+"_inside").append(n),"undefined"!=typeof nf_ajax_rte_editors&&"undefined"!=typeof tinyMCE)for(var i=nf_ajax_rte_editors.length-1;i>=0;i--)try{var a=nf_ajax_rte_editors[i];tinyMCE.init(tinyMCEPreInit.mceInit[a]);try{quicktags(tinyMCEPreInit.qtInit[a])}catch(s){console.log("error")}}catch(s){}t.removeEmptySettings(),jQuery("#ninja_forms_field_"+e+"_inside").slideDown("fast"),nfFields.listOptionsSortable(),jQuery(".nf-field-settings .title").disableSelection()})},updateData:function(){var e=this.id;if("undefined"!=typeof tinyMCE)try{tinyMCE.triggerSave()}catch(n){}var t=jQuery("[name^=ninja_forms_field_"+e+"]"),i=jQuery(t).serializeFullArray();if("undefined"!=typeof i["ninja_forms_field_"+e]){var a=i["ninja_forms_field_"+e];for(var s in a)a.hasOwnProperty(s)&&nfFields.get(e).set(s,a[s])}nfForm.set("saved",!1)},remove:function(){var e=this.id,n=confirm(nf_admin.remove_field);n&&jQuery.post(ajaxurl,{field_id:e,action:"ninja_forms_remove_field",nf_ajax_nonce:ninja_forms_settings.nf_ajax_nonce},function(){jQuery("#ninja_forms_field_"+e).remove(),jQuery(document).trigger("removeField",[e])})},removeEmptySettings:function(){var e=this.id;jQuery("#ninja_forms_field_"+e+"_inside").find(".nf-field-settings .inside").each(function(){var e=jQuery.trim(jQuery(this).html());""==e&&jQuery(this).parent().remove()})}}),nfFields=Backbone.Collection.extend({model:nfField,setup:function(){"undefined"!=typeof nf_admin.fields&&_.each(nf_admin.fields,function(e){nfFields.add({id:e.id,metabox_state:e.metabox_state})})},updateData:function(){_.each(this.models,function(e){1==e.get("metabox_state")&&e.updateData()})},newField:function(e){var n=jQuery(e).data("limit"),t=jQuery(e).data("type"),i=ninja_forms_settings.form_id;if(""!=n)var a=jQuery("."+t+"-li").length;else var a="";if("undefined"==typeof jQuery(e).data("field"))var s="",r="ninja_forms_new_field";else if("fav"==jQuery(e).data("type"))var s=jQuery(e).data("field"),r="ninja_forms_insert_fav";else var s=jQuery(e).data("field"),r="ninja_forms_insert_def";""!=n&&n>a||""==n||""==a||0==a?jQuery.post(ajaxurl,{type:t,field_id:s,form_id:i,action:r,nf_ajax_nonce:ninja_forms_settings.nf_ajax_nonce},this.newFieldResponse):jQuery(e).addClass("disabled"),nfForm.set("saved",!1)},newFieldResponse:function(e){jQuery(document).trigger("addField",[e])},addFieldDefault:function(e){if(jQuery("#ninja_forms_field_list").append(e.new_html).show("slow"),"List"==e.new_type&&this.listOptionsSortable(),"undefined"!=typeof nf_ajax_rte_editors&&"undefined"!=typeof tinyMCE)for(var n=nf_ajax_rte_editors.length-1;n>=0;n--)try{var t=nf_ajax_rte_editors[n];tinyMCE.init(tinyMCEPreInit.mceInit[t]);try{quicktags(tinyMCEPreInit.qtInit[t])}catch(i){}}catch(i){}this.add({id:e.new_id,metabox_state:1}),nfFields.get(e.new_id).removeEmptySettings()},listOptionsSortable:function(){jQuery(".ninja-forms-field-list-options").sortable({helper:"clone",handle:".ninja-forms-drag",items:"div",placeholder:"ui-state-highlight",update:function(){var e=jQuery(this).sortable("toArray"),n=0;_.each(e,function(e){var t=jQuery("#"+e).data("field"),i="ninja_forms_field_"+t+"[list][options]["+n+"][label]",a="ninja_forms_field_"+t+"[list][options]["+n+"][value]",s="ninja_forms_field_"+t+"[list][options]["+n+"][calc]",r="ninja_forms_field_"+t+"[list][options]["+n+"][selected]";jQuery("#"+e).find(".ninja-forms-field-list-option-label").attr("name",i),jQuery("#"+e).find(".ninja-forms-field-list-option-value").attr("name",a),jQuery("#"+e).find(".ninja-forms-field-list-option-calc").attr("name",s),jQuery("#"+e).find(".ninja-forms-field-list-option-selected").attr("name",r),n++})}})}}),nfForm=Backbone.Model.extend({defaults:{id:ninja_forms_settings.form_id,status:nf_admin.form_status,title:nf_admin.form_title,saved:!0},setup:function(){this.changeMenu()},changeMenu:function(){if("new"==this.get("status"))jQuery(".wp-submenu li").removeClass("current"),jQuery('a[href="admin.php?page=ninja-forms&tab=builder&form_id=new"]').parent().addClass("current");else{var e='<li class="current"><a href="#">'+nf_admin.edit_form_text+"</a></li>";0==jQuery('li a:contains("'+nf_admin.edit_form_text+'")').length&&(jQuery(".wp-submenu li").removeClass("current"),jQuery('a[href="admin.php?page=ninja-forms&tab=builder&form_id=new"]').parent().after(e))}},save:function(){if(jQuery(".nf-save-admin-fields").hide(),jQuery(".nf-save-spinner").show(),jQuery(".nf-save-spinner").css("visibility","visible"),"new"==this.get("status"))return jQuery("._submit-li").length>0?(jQuery("#nf-insert-submit-div").hide(),this.set("show_insert_submit",!1)):(jQuery("#nf-insert-submit-div").show(),this.set("show_insert_submit",!0)),jQuery("#nf-save-title").nfAdminModal("open"),jQuery("#modal-contents-wrapper").find("#nf-form-title").focus(),!1;nfFields.updateData();for(var e=JSON.stringify(nfFields.toJSON()),n={},t=jQuery("#ninja_forms_field_list").sortable("toArray"),i=0;i<t.length;i++)n[i]=t[i];n=JSON.stringify(n);var a=ninja_forms_settings.form_id;jQuery(document).data("field_order",n),jQuery(document).data("field_data",e),jQuery(document).triggerHandler("nfAdminSaveFields");{var n=jQuery(document).data("field_order");jQuery(document).data("field_data")}jQuery.post(ajaxurl,{form_title:this.get("title"),form_id:a,field_data:e,field_order:n,action:"nf_admin_save_builder",nf_ajax_nonce:ninja_forms_settings.nf_ajax_nonce},function(){jQuery(".nf-save-spinner").hide(),jQuery(".nf-save-admin-fields").show();var e='<div id="message" class="updated below-h2" style="display:none;margin-top: 20px;"><p>'+nf_admin.saved_text+"</p></div>";jQuery(".nav-tab-wrapper:last").after(e),jQuery("#message").fadeIn(),""==jQuery("#nf-display-form-title").html()&&jQuery("#nf-display-form-title").html(nfForm.get("title")),nfForm.set("saved",!0),nfForm.set("status",""),nfForm.changeMenu()})},saveTitle:function(){var e=jQuery("#modal-contents-wrapper").find("#nf-form-title").val(),n=this.get("show_insert_submit"),t=jQuery("#modal-contents-wrapper").find("#nf-insert-submit").prop("checked");if(this.set("title",e),this.set("status",""),n&&t){var i=this;jQuery(document).on("addField.insertSubmit",function(e,n){jQuery("#ninja_forms_field_"+n.new_id+"_toggle").click(),jQuery("#nf-save-title").nfAdminModal("close"),i.save(),jQuery(document).off("addField.insertSubmit")}),jQuery("#_submit").click()}else jQuery("#nf-save-title").nfAdminModal("close"),this.save()}}),nfFields=new nfFields,nfForm=new nfForm;!function(e){e(document).ready(function(e){nfFields.setup(),nfForm.setup(),e(document).on("click",".nf-edit-field",function(n){n.preventDefault();var t=jQuery(n.target).data("field");nfFields.get(t).toggleMetabox();var i=nfFields.get(t).get("metabox_state");1==i?e(this).addClass("open"):e(this).removeClass("open")}),e(document).on("click",function(){e("#message").fadeOut("slow")}),e(document).on("click",".nf-save-admin-fields",function(e){e.preventDefault(),nfForm.save()}),e(document).on("click","#nf-save-title-submit",function(e){e.preventDefault(),nfForm.saveTitle()}),e(document).on("click",".ninja-forms-new-field",function(e){e.preventDefault(),nfFields.newField(e.target)}),e(document).on("click",".nf-remove-field",function(e){e.preventDefault();var n=jQuery(e.target).data("field");nfFields.get(n).remove()}),e(document).on("addField.default",function(e,n){nfFields.addFieldDefault(n)}),e(document).on("click",".ninja-forms-insert-fav-field",function(e){e.preventDefault(),nfFields.newField(e.target)}),e(document).on("click",".ninja-forms-insert-def-field",function(e){e.preventDefault(),nfFields.newField(e.target)}),e("#nf-save-title").nfAdminModal({title:"Save Your Form",buttons:"#nf-save-title-buttons"}),e(document).on("nfAdminModalClose.hideSpinners",function(){jQuery(".nf-save-spinner").hide(),jQuery(".nf-save-admin-fields").show()}),e(document).on("keyup","#nf-form-title",function(n){this.value;this.value.length>0?(e("#modal-contents-wrapper").find("#nf-save-title-submit").prop("disabled",!1),e("#modal-contents-wrapper").find("#nf-save-title-submit").removeClass("button-secondary"),e("#modal-contents-wrapper").find("#nf-save-title-submit").addClass("button-primary")):(e("#modal-contents-wrapper").find("#nf-save-title-submit").prop("disabled",!0),e("#modal-contents-wrapper").find("#nf-save-title-submit").removeClass("button-primary"),e("#modal-contents-wrapper").find("#nf-save-title-submit").addClass("button-secondary")),13==n.keyCode&&this.value.length>0&&nfForm.saveTitle()}),e(".ninja-forms-field-list").sortable({handle:".menu-item-handle",items:"li:not(.not-sortable)",connectWith:".ninja-forms-field-list",start:function(n,t){var i=e(t.item).find(".wp-editor-wrap").length;i>0&&e(t.item).find(".wp-editor-wrap").each(function(){try{var e=this.id.replace("wp- ","");e=e.replace("-wrap",""),tinyMCE.execCommand("mceRemoveControl",!1,e)}catch(n){}})},stop:function(n,t){var i=e(t.item).find(".wp-editor-wrap").length;i>0&&e(t.item).find(".wp-editor-wrap").each(function(){try{var e=this.id.replace("wp-","");e=e.replace("-wrap",""),tinyMCE.execCommand("mceAddControl",!0,e)}catch(n){}}),e(this).sortable("refresh"),nfForm.set("saved",!1)}}),e(document).on("dblclick",".nf-field-settings .title",function(){e(this).find(".nf-field-sub-section-toggle").click()}),e(document).on("click",".nf-field-sub-section-toggle",function(n){n.preventDefault(),e(this).hasClass("dashicons-arrow-down")?e(this).removeClass("dashicons-arrow-down").addClass("dashicons-arrow-up"):e(this).removeClass("dashicons-arrow-up").addClass("dashicons-arrow-down"),e(this).parent().next(".inside").slideToggle()}),e(window).bind("beforeunload",function(){return"new"==nfForm.get("status")?(e("#nf-save-title").nfAdminModal("open"),"Please save your form before leaving this page."):0==nfForm.get("saved")?"You have unsaved changes. Please save before leaving this page.":void 0}),e(document).on("dblclick",".menu-item-handle",function(){e(this).find(".nf-edit-field").click()})})}(jQuery);
|
|
deprecated/assets/js/min/combobox.min.js
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
(function(e,t){e.widget("ui.combobox",{version:"@VERSION",widgetEventPrefix:"combobox",uiCombo:null,uiInput:null,_wasOpen:false,_create:function(){var t=this,n=this.element.hide(),r,i;r=this.uiInput=e("<input />").insertAfter(n).addClass("ui-widget ui-widget-content ui-corner-left ui-combobox-input").val(n.children(":selected").text()).attr("tabindex",n.attr("tabindex"));i=this.uiCombo=r.wrap("<span>").parent().addClass("ui-combobox").insertAfter(n);r.autocomplete({delay:0,minLength:0,appendTo:i,source:e.proxy(this,"_linkSelectList")});e("<button>").attr("tabIndex",-1).attr("type","button").insertAfter(r).button({icons:{primary:"ui-icon-triangle-1-s"},text:false}).removeClass("ui-corner-all").addClass("ui-corner-right ui-button-icon ui-combobox-button");r.data("ui-autocomplete")._renderItem=function(t,n){return e("<li>").append(e("<a>").html(n.label)).appendTo(t)};this._on(this._events)},_linkSelectList:function(t,n){var r=new RegExp(e.ui.autocomplete.escapeRegex(t.term),"i");n(this.element.children("option").map(function(){var n=e(this).text();if(this.value&&(!t.term||r.test(n))){var i={label:n,value:n,option:this};if(t.term){i.label=n.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)("+e.ui.autocomplete.escapeRegex(t.term)+")(?![^<>]*>)(?![^&;]+;)","gi"),"<strong>$1</strong>")}return i}}))},_events:{"autocompletechange input":function(t,n){var r=e(t.currentTarget);var i=n.item?n.item.option:null;if(!n.item){var s=new RegExp("^"+e.ui.autocomplete.escapeRegex(r.val())+"$","i"),o=false,u=null,a=0,f=-1,l=-1,c=null;if(this.options.autofillsinglematch){u=new RegExp(e.ui.autocomplete.escapeRegex(r.val()),"i")}this.element.children("option").each(function(){var t=e(this).text();if(t.match(s)){this.selected=o=true;return false}if(u){f++;if(t.match(u)){a++;c=e(this);l=f}}});if(!o){if(a==1){i=c[0];i.selected=true;var h=c.text();r.val(h);r.data("ui-autocomplete").term=h;this.element.prop("selectedIndex",l);console.log("Found single match with '"+h+"'")}else{r.val("");r.data("ui-autocomplete").term="";this.element.prop("selectedIndex",-1)}}}this._trigger("change",t,{item:i})},"autocompleteselect input":function(e,t){t.item.option.selected=true;this._trigger("select",e,{item:t.item.option})},"autocompleteopen input":function(e,t){this.uiCombo.children(".ui-autocomplete").outerWidth(this.uiCombo.outerWidth(true))},"mousedown .ui-combobox-button":function(e){this._wasOpen=this.uiInput.autocomplete("widget").is(":visible")},"click .ui-combobox-button":function(e){this.uiInput.focus();if(this._wasOpen)return;this.uiInput.autocomplete("search","")}},value:function(e){var t=this.element,n=false,r;if(!arguments.length){r=t.children(":selected");return r.length>0?r.val():null}t.prop("selectedIndex",-1);t.children("option").each(function(){if(this.value==e){this.selected=n=true;return false}});if(n){this.uiInput.val(t.children(":selected").text())}else{this.uiInput.val("");this.element.prop("selectedIndex",-1)}},_destroy:function(){this.element.show();this.uiCombo.replaceWith(this.element)},widget:function(){return this.uiCombo},_getCreateEventData:function(){return{select:this.element,combo:this.uiCombo,input:this.uiInput}}})})(jQuery)
|
|
deprecated/assets/js/min/index.php
DELETED
@@ -1,2 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
// Silence is golden.
|
|
|
|
deprecated/assets/js/min/nf-upgrade-handler.min.js
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
jQuery(document).ready(function(e){function s(s){this.upgrade=s,this.process=function(s,i,d){s="undefined"!=typeof s?s:0,total_step="undefined"!=typeof total_step?total_step:0,d="undefined"!=typeof d?d:[],console.log("Upgrade: "+this.upgrade),e.post(ajaxurl,{upgrade:this.upgrade,step:parseInt(s),total_steps:parseInt(i),args:d,action:"nf_upgrade_handler"},function(s){var i=e("#nf_upgrade_"+n.upgrade);try{s=e.parseJSON(s)}catch(d){return i.find(".spinner").css("display","none").css("visibility","hidden"),i.find(".dashicons-no").css("display","block"),i.find(".nf-upgrade-handler__errors__text").html("Bad Response :'(<br/>"+d+"<br />"+s),void i.find(".nf-upgrade-handler__errors").slideDown()}if(console.log("DEBUG: NF_UpgradeHandler step response: "),console.log(s),void 0==s)return i.find(".spinner").css("display","none").css("visibility","hidden"),i.find(".dashicons-no").css("display","block"),i.find(".nf-upgrade-handler__errors__text").html("Empty Response :'("),void i.find(".nf-upgrade-handler__errors").slideDown();if(s.errors){i.find(".spinner").css("display","none").css("visibility","hidden"),i.find(".dashicons-no").css("display","block");var r="";return e.each(s.errors,function(e,s){r=r+"["+e+"] "+s+"<br />"}),i.find(".nf-upgrade-handler__errors__text").html("Processing Error :'(<br />"+r),i.find(".nf-upgrade-handler__errors").slideDown(),void e("#progressbar_"+s.upgrade).slideUp()}e("#progressbar_"+s.upgrade).progressbar({value:100*(s.step/s.total_steps)});return i.find(".spinner").css("display","block").css("visibility","visible"),i.find(".dashicons-no").css("display","none"),i.find(".inside").slideDown(),void 0!=s.complete?(i.find(".inside").slideUp(),i.find(".spinner").css("display","none").css("visibility","hidden"),i.find(".dashicons-yes").css("display","block"),void 0!=s.nextUpgrade?(n.upgrade=s.nextUpgrade,e("#nf_upgrade_"+n.upgrade).find(".spinner").css("display","block").css("visibility","visible"),e("#nf_upgrade_"+n.upgrade).find(".inside").slideDown(),void n.process()):(console.log('DEBUG: NF_UpgradeHandler says "It is finished!"'),void e(".nf-upgrade-complete").nfAdminModal("open"))):void n.process(s.step,s.total_steps,s.args)}).fail(function(){alert("error")})}}if(e(".nf-upgrade-complete").nfAdminModal({title:nfUpgradeHandler.nf_upgrade_complete_title,buttons:".nf-upgrade-complete-buttons"}),"undefined"!=typeof nfUpgradeHandler){console.log("DEBUG: NF_UpgradeHandler first upgrades is "+nfUpgradeHandler.upgrade);var n=new s(nfUpgradeHandler.upgrade);e(".progressbar").progressbar({value:0});var i=e("#nf_upgrade_"+n.upgrade);i.find(".spinner").css("display","block").css("visibility","visible"),i.find(".dashicons-no").css("display","none"),i.find(".inside").slideDown(),n.process()}else document.location.href="admin.php?page=ninja-forms"});
|
|
deprecated/assets/js/min/notifications.min.js
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
jQuery(document).ready(function(e){e("#settings-type").change(function(){var t=this.value;e(".notification-type").hide();e("#notification-"+t).show()});e(document).on("click",".notification-delete",function(t){t.preventDefault();var n=confirm(commonL10n.warnDelete);var r=e(this).parent().parent().parent().parent();var i=e(this).data("n_id");console.log(i);if(n){e.post(ajaxurl,{n_id:i,action:"nf_delete_notification",nf_ajax_nonce:ninja_forms_settings.nf_ajax_nonce},function(t){e(r).css("background-color","#FF0000").fadeOut("slow",function(){e(this).remove()})})}});e(document).on("click",".notification-activate",function(t){t.preventDefault();var n=e(this).parent().parent().parent().parent();var r=e(this).data("action");var i=e(this).data("n_id");var s=this;e.post(ajaxurl,{n_id:i,activate_action:r,action:"nf_"+r+"_notification",nf_ajax_nonce:ninja_forms_settings.nf_ajax_nonce},function(t){e(n).removeClass("nf-notification-active");e(n).removeClass("nf-notification-inactive");if(r=="activate"){e(n).addClass("nf-notification-active");e(s).html(nf_notifications.deactivate);e(s).data("action","deactivate")}else{e(n).addClass("nf-notification-inactive");e(s).html(nf_notifications.activate);e(s).data("action","activate")}})});e(".nf-tokenize").each(function(){var t=e(this).data("token-limit");var n=e(this).data("key");var r=e(this).data("type");e(this).tokenfield({autocomplete:{source:nf_notifications.search_fields[r],delay:100},tokens:nf_notifications.tokens[n],delimiter:["`"],showAutocompleteOnFocus:true,beautify:false,limit:t,createTokensOnBlur:true})});e(document).on("click",".nf-insert-field",function(t){t.preventDefault();var n=e(this).prev().prev(".nf-fields-combobox").val();if(n!=""&&n!=null){var r="[ninja_forms_field id="+n+"]";window.parent.send_to_editor(r)}});e(document).on("click",".nf-insert-all-fields",function(e){e.preventDefault();var t="[ninja_forms_all_fields]";window.parent.send_to_editor(t)});e(".nf-fields-combobox").combobox();e(".ui-combobox-input").focus(function(t){var n=e(this).parent().prev(".nf-fields-combobox").val();if(n==""||n==null){this.value=""}else{e(this).select()}});e(".ui-combobox-input").mouseup(function(e){e.preventDefault()});e(".ui-combobox-input").blur(function(t){if(this.value==""){this.value=e(this).parent().prev(".nf-fields-combobox").data("first-option")}});e("#filter-type").change(function(t){if(this.value==""){var n=nf_notifications.filter_type}else{var n=nf_notifications.filter_type+"&type="+this.value}e(".spinner").show();document.location.href=n});e("#toggle_email_advanced").click(function(t){t.preventDefault();e("#email_advanced").toggle()})})
|
|
deprecated/assets/js/min/step-processing.min.js
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
jQuery(document).ready(function(e){var r=e("#progressbar"),t=e(".progress-label");if(r.progressbar({value:!1,change:function(){var e=parseInt(r.progressbar("value"));90==e?s.currentLabel=1:e%10==0&&s.changeTextLabel();var a=s.getTextLabel();t.text(a+" "+r.progressbar("value")+"%")},complete:function(){t.text("Complete!")}}),"none"!=nfProcessingAction){var s={labels:nf_processing.step_labels,currentLabel:0,getTextLabel:function(){var e=this.labels[this.currentLabel];return e},changeTextLabel:function(){var e=Object.keys(this.labels).length;1==e&&(e=0);var r=Math.floor(Math.random()*(e-2+1))+1;this.currentLabel=r}},a={setup:function(){this.interval=Math.floor(100/parseInt(this.totalSteps))},process:function(){e.post(ajaxurl,{step:this.step,total_steps:a.totalSteps,args:this.args,action:nfProcessingAction},function(t){t=e.parseJSON(t),a.step=t.step,a.totalSteps=t.total_steps,a.args=t.args,a.errors=t.errors,a.errors&&(e("#nf-upgrade-errors").removeClass("hidden"),e.each(a.errors,function(r,t){e(".nf-upgrade-errors-list").append("<li>ERROR: "+t+"</li>")})),1==a.runSetup&&(a.setup(),a.runSetup=0),t.complete?(r.progressbar("value",100),"undefined"!=typeof t.redirect&&""!=t.redirect&&(document.location.href=t.redirect)):(a.progress(),a.process())})},progress:function(){var e=r.progressbar("value")||0;r.progressbar("value",e+this.interval)},step:"loading",totalSteps:0,runSetup:1,interval:0,args:nfProcessingArgs};a.process()}});
|
|
deprecated/classes/add-form-modal.php
DELETED
@@ -1,122 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Add a button to tinyMCE editors when eidting posts/pages.
|
4 |
-
*
|
5 |
-
* @since 2.9.22
|
6 |
-
*/
|
7 |
-
|
8 |
-
class NF_Admin_AddFormModal {
|
9 |
-
|
10 |
-
function __construct() {
|
11 |
-
// Add a tinyMCE button to our post and page editor
|
12 |
-
add_filter( 'media_buttons_context', array( $this, 'insert_form_tinymce_buttons' ) );
|
13 |
-
}
|
14 |
-
|
15 |
-
/**
|
16 |
-
* Output our tinyMCE field buttons
|
17 |
-
*
|
18 |
-
* @access public
|
19 |
-
* @since 2.8
|
20 |
-
* @return void
|
21 |
-
*/
|
22 |
-
public function insert_form_tinymce_buttons( $context ) {
|
23 |
-
global $pagenow;
|
24 |
-
|
25 |
-
if ( 'post.php' != $pagenow ) {
|
26 |
-
return $context;
|
27 |
-
}
|
28 |
-
$html = '<style>
|
29 |
-
span.nf-insert-form {
|
30 |
-
color:#888;
|
31 |
-
font: 400 18px/1 dashicons;
|
32 |
-
-webkit-font-smoothing: antialiased;
|
33 |
-
-moz-osx-font-smoothing: grayscale;
|
34 |
-
display: inline-block;
|
35 |
-
width: 18px;
|
36 |
-
height: 18px;
|
37 |
-
vertical-align: text-top;
|
38 |
-
margin: 0 2px 0 0;
|
39 |
-
}
|
40 |
-
</style>';
|
41 |
-
$html .= '<a href="#" class="button-secondary nf-insert-form"><span class="nf-insert-form dashicons dashicons-feedback"></span> ' . __( 'Add Form', 'ninja-forms' ) . '</a>';
|
42 |
-
|
43 |
-
wp_enqueue_script( 'nf-combobox',
|
44 |
-
NF_PLUGIN_URL . 'assets/js/min/combobox.min.js',
|
45 |
-
array( 'jquery', 'jquery-ui-core', 'jquery-ui-button', 'jquery-ui-autocomplete', 'nf-admin-modal' ) );
|
46 |
-
|
47 |
-
wp_enqueue_style( 'nf-combobox',
|
48 |
-
NF_PLUGIN_URL . 'assets/css/combobox.css' );
|
49 |
-
|
50 |
-
wp_enqueue_style( 'nf-admin-modal',
|
51 |
-
NF_PLUGIN_URL . 'assets/css/admin-modal.css' );
|
52 |
-
|
53 |
-
wp_enqueue_style( 'jquery-smoothness', NINJA_FORMS_URL .'css/smoothness/jquery-smoothness.css' );
|
54 |
-
|
55 |
-
add_action( 'admin_footer', array( $this, 'output_tinymce_button_js' ) );
|
56 |
-
return $context . ' ' . $html;
|
57 |
-
}
|
58 |
-
|
59 |
-
/**
|
60 |
-
* Output our tinyMCE field buttons
|
61 |
-
*
|
62 |
-
* @access public
|
63 |
-
* @since 2.8
|
64 |
-
* @return void
|
65 |
-
*/
|
66 |
-
public function output_tinymce_button_js( $context ) {
|
67 |
-
?>
|
68 |
-
<div id="nf-insert-form-modal" style="height:350px;">
|
69 |
-
<p>
|
70 |
-
<?php
|
71 |
-
$all_forms = Ninja_Forms()->forms()->get_all();
|
72 |
-
$first_option = __( 'Select a form or type to search', 'ninja-forms' );
|
73 |
-
echo '<select class="nf-forms-combobox" id="nf_form_select" data-first-option="' . $first_option . '">';
|
74 |
-
echo '<option value="">' . $first_option .'</option>';
|
75 |
-
foreach( $all_forms as $form_id ) {
|
76 |
-
$label = esc_html( Ninja_Forms()->form( $form_id )->get_setting( 'form_title' ) );
|
77 |
-
if ( strlen( $label ) > 30 )
|
78 |
-
$label = substr( $label, 0, 30 ) . '...';
|
79 |
-
|
80 |
-
echo '<option value="' . $form_id . '">' . $label . ' - ID: ' . $form_id . '</option>';
|
81 |
-
}
|
82 |
-
echo '</select>';
|
83 |
-
?>
|
84 |
-
</p>
|
85 |
-
</div>
|
86 |
-
|
87 |
-
<div id="nf-insert-form-buttons">
|
88 |
-
<div id="nf-admin-modal-cancel">
|
89 |
-
<a class="submitdelete deletion modal-close" href="#"><?php _e( 'Cancel', 'ninja-forms' ); ?></a>
|
90 |
-
</div>
|
91 |
-
<div id="nf-admin-modal-update">
|
92 |
-
<a class="button-primary" id="nf-insert-form" href="#"><?php _e( 'Insert', 'ninja-forms' ); ?></a>
|
93 |
-
</div>
|
94 |
-
</div>
|
95 |
-
|
96 |
-
<script type="text/javascript">
|
97 |
-
jQuery( document ).ready( function( $ ) {
|
98 |
-
|
99 |
-
$( '#nf-insert-form-modal' ).nfAdminModal( { title: '<?php _e( "Add Form", "ninja-forms" ); ?>', buttons: '#nf-insert-form-buttons', backgroundClose: true } );
|
100 |
-
$( document ).on( 'click', '.nf-insert-form', function( e ) {
|
101 |
-
e.preventDefault();
|
102 |
-
$( '#nf-insert-form-modal' ).nfAdminModal( 'open' );
|
103 |
-
$( '.nf-forms-combobox' ).combobox();
|
104 |
-
$( '#nf-admin-modal-content .ui-autocomplete-input' ).focus().select();
|
105 |
-
} );
|
106 |
-
|
107 |
-
$( document ).on( 'click', '#nf-insert-form', function( e ) {
|
108 |
-
e.preventDefault();
|
109 |
-
var form_id = $( this ).parent().parent().parent().find( '#nf_form_select' ).val();
|
110 |
-
var shortcode = '[ninja_form id=' + form_id + ']';
|
111 |
-
window.parent.send_to_editor( shortcode );
|
112 |
-
$.fn.nfAdminModal.close();
|
113 |
-
} );
|
114 |
-
|
115 |
-
$( document ).on( 'nfAdminModalClose.destroyCombo', function( e ) {
|
116 |
-
$( '.nf-forms-combobox' ).combobox( 'destroy' );
|
117 |
-
} );
|
118 |
-
} );
|
119 |
-
</script>
|
120 |
-
<?php
|
121 |
-
}
|
122 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/classes/download-all-subs.php
DELETED
@@ -1,124 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
|
3 |
-
class NF_Download_All_Subs extends NF_Step_Processing {
|
4 |
-
|
5 |
-
function __construct() {
|
6 |
-
$this->action = 'download_all_subs';
|
7 |
-
|
8 |
-
parent::__construct();
|
9 |
-
}
|
10 |
-
|
11 |
-
public function loading() {
|
12 |
-
$form_id = isset( $this->args['form_id'] ) ? absint( $this->args['form_id'] ) : 0;
|
13 |
-
|
14 |
-
if ( empty( $form_id ) ) {
|
15 |
-
|
16 |
-
return array( 'complete' => true );
|
17 |
-
}
|
18 |
-
|
19 |
-
$sub_count = nf_get_sub_count( $form_id );
|
20 |
-
|
21 |
-
if( empty( $this->total_steps ) || $this->total_steps <= 1 ) {
|
22 |
-
$this->total_steps = round( ( $sub_count / 250 ), 0 ) + 2;
|
23 |
-
}
|
24 |
-
|
25 |
-
$args = array(
|
26 |
-
'total_steps' => $this->total_steps,
|
27 |
-
);
|
28 |
-
|
29 |
-
$this->args['filename'] = $this->random_filename( 'all-subs' );
|
30 |
-
update_user_option( get_current_user_id(), 'nf_download_all_subs_filename', $this->args['filename'] );
|
31 |
-
$this->redirect = esc_url_raw( add_query_arg( array( 'download_all' => $this->args['filename'] ), $this->args['redirect'] ) );
|
32 |
-
|
33 |
-
$this->loaded = true;
|
34 |
-
return $args;
|
35 |
-
}
|
36 |
-
|
37 |
-
public function step() {
|
38 |
-
if( ! is_numeric( $this->args[ 'form_id' ] ) ){
|
39 |
-
wp_die( __( 'Invalid form id', 'ninja-forms' ) );
|
40 |
-
}
|
41 |
-
|
42 |
-
$this->args[ 'filename' ] = wp_kses_post( $this->args[ 'filename' ] );
|
43 |
-
|
44 |
-
$exported_subs = get_user_option( get_current_user_id(), 'nf_download_all_subs_ids' );
|
45 |
-
if ( ! is_array( $exported_subs ) ) {
|
46 |
-
$exported_subs = array();
|
47 |
-
}
|
48 |
-
|
49 |
-
$previous_name = get_user_option( get_current_user_id(), 'nf_download_all_subs_filename' );
|
50 |
-
if ( $previous_name ) {
|
51 |
-
$this->args['filename'] = $previous_name;
|
52 |
-
}
|
53 |
-
|
54 |
-
$args = array(
|
55 |
-
'posts_per_page' => 250,
|
56 |
-
'paged' => $this->step,
|
57 |
-
'post_type' => 'nf_sub',
|
58 |
-
'meta_query' => array(
|
59 |
-
array(
|
60 |
-
'key' => '_form_id',
|
61 |
-
'value' => $this->args['form_id'],
|
62 |
-
),
|
63 |
-
),
|
64 |
-
);
|
65 |
-
|
66 |
-
$subs_results = get_posts( $args );
|
67 |
-
|
68 |
-
if ( is_array( $subs_results ) && ! empty( $subs_results ) ) {
|
69 |
-
$upload_dir = wp_upload_dir();
|
70 |
-
$file_path = trailingslashit( $upload_dir['path'] ) . $this->args['filename'] . '.csv';
|
71 |
-
$myfile = fopen( $file_path, 'a' ) or die( 'Unable to open file!' );
|
72 |
-
$x = 0;
|
73 |
-
$export = '';
|
74 |
-
foreach ( $subs_results as $sub ) {
|
75 |
-
$sub_export = Ninja_Forms()->sub( $sub->ID )->export( true );
|
76 |
-
if ( $x > 0 || $this->step > 1 ) {
|
77 |
-
$sub_export = substr( $sub_export, strpos( $sub_export, "\n" ) + 1 );
|
78 |
-
}
|
79 |
-
if ( ! in_array( $sub->ID, $exported_subs ) ) {
|
80 |
-
$export .= $sub_export;
|
81 |
-
$exported_subs[] = $sub->ID;
|
82 |
-
}
|
83 |
-
$x++;
|
84 |
-
}
|
85 |
-
fwrite( $myfile, $export );
|
86 |
-
fclose( $myfile );
|
87 |
-
}
|
88 |
-
|
89 |
-
update_user_option( get_current_user_id(), 'nf_download_all_subs_ids', $exported_subs );
|
90 |
-
}
|
91 |
-
|
92 |
-
public function complete() {
|
93 |
-
delete_user_option( get_current_user_id(), 'nf_download_all_subs_ids' );
|
94 |
-
delete_user_option( get_current_user_id(), 'nf_download_all_subs_filename' );
|
95 |
-
}
|
96 |
-
|
97 |
-
/**
|
98 |
-
* Add an integar to the end of our filename to make sure it is unique
|
99 |
-
*
|
100 |
-
* @access public
|
101 |
-
* @since 2.7.6
|
102 |
-
* @return $filename
|
103 |
-
*/
|
104 |
-
public function random_filename( $filename ) {
|
105 |
-
$upload_dir = wp_upload_dir();
|
106 |
-
$file_path = trailingslashit( $upload_dir['path'] ) . $filename . '.csv';
|
107 |
-
if ( file_exists ( $file_path ) ) {
|
108 |
-
for ($x = 0; $x < 999 ; $x++) {
|
109 |
-
$tmp_name = $filename . '-' . $x;
|
110 |
-
$tmp_path = trailingslashit( $upload_dir['path'] );
|
111 |
-
if ( file_exists( $tmp_path . $tmp_name . '.csv' ) ) {
|
112 |
-
$this->random_filename( $tmp_name );
|
113 |
-
break;
|
114 |
-
} else {
|
115 |
-
$this->filename = $tmp_name;
|
116 |
-
break;
|
117 |
-
}
|
118 |
-
}
|
119 |
-
}
|
120 |
-
|
121 |
-
return $filename;
|
122 |
-
}
|
123 |
-
|
124 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/classes/form.php
DELETED
@@ -1,213 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
/**
|
3 |
-
* Handles the output of our form, as well as interacting with its settings.
|
4 |
-
*
|
5 |
-
* @package Ninja Forms
|
6 |
-
* @subpackage Classes/Form
|
7 |
-
* @copyright Copyright (c) 2014, WPNINJAS
|
8 |
-
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
-
* @since 2.7
|
10 |
-
*/
|
11 |
-
|
12 |
-
class NF_Form {
|
13 |
-
|
14 |
-
/**
|
15 |
-
* @var form_id
|
16 |
-
* @since 2.7
|
17 |
-
*/
|
18 |
-
var $form_id;
|
19 |
-
|
20 |
-
/**
|
21 |
-
* @var settings - Form Settings
|
22 |
-
* @since 2.7
|
23 |
-
*/
|
24 |
-
var $settings = array();
|
25 |
-
|
26 |
-
/**
|
27 |
-
* @var fields - Form Fields
|
28 |
-
* @since 2.7
|
29 |
-
*/
|
30 |
-
var $fields = array();
|
31 |
-
|
32 |
-
/**
|
33 |
-
* @var fields - Fields List
|
34 |
-
* @since 2.7
|
35 |
-
*/
|
36 |
-
var $field_keys = array();
|
37 |
-
|
38 |
-
/**
|
39 |
-
* @var errors - Form errors
|
40 |
-
* @since 2.7
|
41 |
-
*/
|
42 |
-
var $errors = array();
|
43 |
-
|
44 |
-
/**
|
45 |
-
* Get things started
|
46 |
-
*
|
47 |
-
* @access public
|
48 |
-
* @since 2.7
|
49 |
-
* @return void
|
50 |
-
*/
|
51 |
-
public function __construct( $form_id = '' ) {
|
52 |
-
if ( ! empty ( $form_id ) ) { // We've been passed a form id.
|
53 |
-
// Set our current form id.
|
54 |
-
$this->form_id = $form_id;
|
55 |
-
$this->update_fields();
|
56 |
-
$this->settings = nf_get_form_settings( $form_id );
|
57 |
-
}
|
58 |
-
}
|
59 |
-
|
60 |
-
/**
|
61 |
-
* Add a form
|
62 |
-
*
|
63 |
-
* @access public
|
64 |
-
* @since 2.9
|
65 |
-
* @return int $form_id
|
66 |
-
*/
|
67 |
-
public function create( $defaults = array() ) {
|
68 |
-
$form_id = nf_insert_object( 'form' );
|
69 |
-
$date_updated = date( 'Y-m-d', current_time( 'timestamp' ) );
|
70 |
-
nf_update_object_meta( $form_id, 'date_updated', $date_updated );
|
71 |
-
|
72 |
-
foreach( $defaults as $meta_key => $meta_value ) {
|
73 |
-
nf_update_object_meta( $form_id, $meta_key, $meta_value );
|
74 |
-
}
|
75 |
-
|
76 |
-
// Add a single event hook that will check to see if this is an orphaned function.
|
77 |
-
$timestamp = strtotime( '+24 hours', time() );
|
78 |
-
$args = array(
|
79 |
-
'form_id' => $form_id
|
80 |
-
);
|
81 |
-
wp_schedule_single_event( $timestamp, 'nf_maybe_delete_form', $args );
|
82 |
-
return $form_id;
|
83 |
-
}
|
84 |
-
|
85 |
-
/**
|
86 |
-
* Insert a field into our form
|
87 |
-
*
|
88 |
-
* @access public
|
89 |
-
* @since 2.9
|
90 |
-
* @return bool()
|
91 |
-
*/
|
92 |
-
public function insert_field( $field_id ) {
|
93 |
-
return nf_add_relationship( $field_id, 'field', $this->form_id, 'form' );
|
94 |
-
}
|
95 |
-
|
96 |
-
/**
|
97 |
-
* Update our fields
|
98 |
-
*
|
99 |
-
* @access public
|
100 |
-
* @since 2.9
|
101 |
-
* @return void
|
102 |
-
*/
|
103 |
-
public function update_fields() {
|
104 |
-
$this->fields = nf_get_fields_by_form_id( $this->form_id );
|
105 |
-
}
|
106 |
-
|
107 |
-
/**
|
108 |
-
* Get one of our form settings.
|
109 |
-
*
|
110 |
-
* @access public
|
111 |
-
* @since 2.7
|
112 |
-
* @return string $setting
|
113 |
-
*/
|
114 |
-
public function get_setting( $setting, $bypass_cache = false ) {
|
115 |
-
if ( $bypass_cache ) {
|
116 |
-
return nf_get_object_meta_value( $this->form_id, 'last_sub' );
|
117 |
-
}
|
118 |
-
if ( isset ( $this->settings[ $setting ] ) ) {
|
119 |
-
return $this->settings[ $setting ];
|
120 |
-
} else {
|
121 |
-
return false;
|
122 |
-
}
|
123 |
-
}
|
124 |
-
|
125 |
-
/**
|
126 |
-
* Update a form setting (this doesn't update anything in the database)
|
127 |
-
* Changes are only applied to this object.
|
128 |
-
*
|
129 |
-
* @access public
|
130 |
-
* @since 2.8
|
131 |
-
* @param string $setting
|
132 |
-
* @param mixed $value
|
133 |
-
* @return bool
|
134 |
-
*/
|
135 |
-
public function update_setting( $setting, $value ) {
|
136 |
-
$this->settings[ $setting ] = $value;
|
137 |
-
nf_update_object_meta( $this->form_id, $setting, $value );
|
138 |
-
$this->dump_cache();
|
139 |
-
return true;
|
140 |
-
}
|
141 |
-
|
142 |
-
/**
|
143 |
-
* Get all of our settings
|
144 |
-
*
|
145 |
-
* @access public
|
146 |
-
* @since 2.9
|
147 |
-
* @return array $settings
|
148 |
-
*/
|
149 |
-
public function get_all_settings() {
|
150 |
-
return $this->settings;
|
151 |
-
}
|
152 |
-
|
153 |
-
/**
|
154 |
-
* Get all the submissions for this form
|
155 |
-
*
|
156 |
-
* @access public
|
157 |
-
* @since 2.7
|
158 |
-
* @return array $sub_ids
|
159 |
-
*/
|
160 |
-
public function get_subs( $args = array() ) {
|
161 |
-
$args['form_id'] = $this->form_id;
|
162 |
-
return Ninja_Forms()->subs()->get( $args );
|
163 |
-
}
|
164 |
-
|
165 |
-
/**
|
166 |
-
* Return a count of the submissions this form has had
|
167 |
-
*
|
168 |
-
* @access public
|
169 |
-
* @param array $args
|
170 |
-
* @since 2.7
|
171 |
-
* @return int $count
|
172 |
-
*/
|
173 |
-
public function sub_count( $args = array() ) {
|
174 |
-
return count( $this->get_subs( $args ) );
|
175 |
-
}
|
176 |
-
|
177 |
-
/**
|
178 |
-
* Delete this form
|
179 |
-
*
|
180 |
-
* @access public
|
181 |
-
* @since 2.9
|
182 |
-
*/
|
183 |
-
public function delete() {
|
184 |
-
global $wpdb;
|
185 |
-
// Delete this object.
|
186 |
-
nf_delete_object( $this->form_id );
|
187 |
-
// Delete any fields on this form.
|
188 |
-
$wpdb->query($wpdb->prepare( "DELETE FROM ".NINJA_FORMS_FIELDS_TABLE_NAME." WHERE form_id = %d", $this->form_id ) );
|
189 |
-
}
|
190 |
-
|
191 |
-
/**
|
192 |
-
* Delete the cached form object (transient)
|
193 |
-
*
|
194 |
-
* @access public
|
195 |
-
* @since 2.9.17
|
196 |
-
*/
|
197 |
-
public function dump_cache()
|
198 |
-
{
|
199 |
-
delete_transient( 'nf_form_' . $this->form_id );
|
200 |
-
}
|
201 |
-
|
202 |
-
/**
|
203 |
-
* Deprecated wrapper for dump_cache()
|
204 |
-
*
|
205 |
-
* @access public
|
206 |
-
* @since 2.9.12
|
207 |
-
*/
|
208 |
-
public function dumpCache()
|
209 |
-
{
|
210 |
-
$this->dump_cache();
|
211 |
-
}
|
212 |
-
|
213 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/classes/forms.php
DELETED
@@ -1,93 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
/**
|
3 |
-
* Handles adding and removing forms.
|
4 |
-
*
|
5 |
-
* @package Ninja Forms
|
6 |
-
* @subpackage Classes/Form
|
7 |
-
* @copyright Copyright (c) 2014, WPNINJAS
|
8 |
-
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
-
* @since 2.9
|
10 |
-
*/
|
11 |
-
|
12 |
-
class NF_Forms {
|
13 |
-
|
14 |
-
/**
|
15 |
-
* Store our array of form ids
|
16 |
-
*
|
17 |
-
* @since 2.9
|
18 |
-
*/
|
19 |
-
var $forms = array();
|
20 |
-
|
21 |
-
/**
|
22 |
-
* Get things started
|
23 |
-
*
|
24 |
-
* @access public
|
25 |
-
* @since 2.9
|
26 |
-
* @return void
|
27 |
-
*/
|
28 |
-
public function __construct() {
|
29 |
-
add_action( 'nf_maybe_delete_form', array( $this, 'maybe_delete' ) );
|
30 |
-
}
|
31 |
-
|
32 |
-
/**
|
33 |
-
* Get all forms
|
34 |
-
*
|
35 |
-
* @access public
|
36 |
-
* @since 2.9
|
37 |
-
* @return array $forms
|
38 |
-
*/
|
39 |
-
public function get_all( $show_new = false ) {
|
40 |
-
global $wpdb;
|
41 |
-
|
42 |
-
$debug = ! empty ( $_REQUEST['debug'] ) ? true : false;
|
43 |
-
|
44 |
-
if ( empty ( $this->forms ) ) {
|
45 |
-
$forms = nf_get_objects_by_type( 'form' );
|
46 |
-
|
47 |
-
$tmp_array = array();
|
48 |
-
foreach ( $forms as $form ) {
|
49 |
-
$form_id = $form['id'];
|
50 |
-
|
51 |
-
$status = Ninja_Forms()->form( $form_id )->get_setting( 'status' );
|
52 |
-
if ( ( $status == 'new' && $show_new ) || $status != 'new' ) {
|
53 |
-
$title = Ninja_Forms()->form( $form_id )->get_setting( 'form_title' );
|
54 |
-
if ( strpos( $title, '_' ) === 0 ) {
|
55 |
-
if ( $debug )
|
56 |
-
$tmp_array[] = $form_id;
|
57 |
-
} else {
|
58 |
-
$tmp_array[] = $form_id;
|
59 |
-
}
|
60 |
-
}
|
61 |
-
}
|
62 |
-
$this->forms = $tmp_array;
|
63 |
-
}
|
64 |
-
|
65 |
-
return $this->forms;
|
66 |
-
}
|
67 |
-
|
68 |
-
/**
|
69 |
-
* Delete a form if it is created and not saved within 24 hrs.
|
70 |
-
*
|
71 |
-
* @access public
|
72 |
-
* @since 2.9
|
73 |
-
* @return void
|
74 |
-
*/
|
75 |
-
public function maybe_delete( $form_id ) {
|
76 |
-
$status = Ninja_Forms()->form( $form_id )->get_setting( 'status' );
|
77 |
-
if ( 'new' == $status ) {
|
78 |
-
Ninja_Forms()->form( $form_id )->delete();
|
79 |
-
}
|
80 |
-
}
|
81 |
-
|
82 |
-
/**
|
83 |
-
* Update cached forms
|
84 |
-
*
|
85 |
-
* @access public
|
86 |
-
* @since 2.9
|
87 |
-
* @return void
|
88 |
-
*/
|
89 |
-
public function update_cache( $debug = false, $show_new = false ) {
|
90 |
-
$this->forms = array();
|
91 |
-
$this->get_all( $debug, $show_new );
|
92 |
-
}
|
93 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/classes/index.php
DELETED
@@ -1,2 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
// Silence is golden.
|
|
|
|
deprecated/classes/notices-class.php
DELETED
@@ -1,256 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
|
3 |
-
/**
|
4 |
-
* NF_Notices Class
|
5 |
-
*
|
6 |
-
* Can be simply used be adding another line into the nf_admin_notices() function under notices.php
|
7 |
-
*
|
8 |
-
* Can be extended to create more advanced notices to include triggered events
|
9 |
-
*
|
10 |
-
* @since 2.9
|
11 |
-
*/
|
12 |
-
|
13 |
-
class NF_Notices
|
14 |
-
{
|
15 |
-
// Highlander the instance
|
16 |
-
static $instance;
|
17 |
-
|
18 |
-
public static function instance()
|
19 |
-
{
|
20 |
-
if ( ! isset( self::$instance ) ) {
|
21 |
-
self::$instance = new NF_Notices();
|
22 |
-
}
|
23 |
-
|
24 |
-
return self::$instance;
|
25 |
-
}
|
26 |
-
|
27 |
-
public $notice_spam = 0;
|
28 |
-
public $notice_spam_max = 1;
|
29 |
-
|
30 |
-
// Basic actions to run
|
31 |
-
public function __construct(){
|
32 |
-
|
33 |
-
// Runs the admin notice ignore function incase a dismiss button has been clicked
|
34 |
-
add_action( 'admin_init', array( $this, 'admin_notice_ignore' ) );
|
35 |
-
|
36 |
-
// Runs the admin notice temp ignore function incase a temp dismiss link has been clicked
|
37 |
-
add_action( 'admin_init', array( $this, 'admin_notice_temp_ignore' ) );
|
38 |
-
|
39 |
-
}
|
40 |
-
|
41 |
-
// Checks to ensure notices aren't disabled and the user has the correct permissions.
|
42 |
-
public function nf_admin_notice() {
|
43 |
-
|
44 |
-
$nf_settings = get_option( 'ninja_forms_settings' );
|
45 |
-
if ( ! isset( $nf_settings[ 'disable_admin_notices' ] ) || ( isset( $nf_settings[ 'disable_admin_notices' ] ) && $nf_settings[ 'disable_admin_notices' ] == 0 ) ){
|
46 |
-
if ( current_user_can( apply_filters( 'ninja_forms_admin_parent_menu_capabilities', 'manage_options' ) ) ) {
|
47 |
-
return true;
|
48 |
-
}
|
49 |
-
}
|
50 |
-
return false;
|
51 |
-
|
52 |
-
}
|
53 |
-
|
54 |
-
// Primary notice function that can be called from an outside function sending necessary variables
|
55 |
-
public function admin_notice( $admin_notices ) {
|
56 |
-
|
57 |
-
// Check options
|
58 |
-
if ( ! $this->nf_admin_notice() ) {
|
59 |
-
return false;
|
60 |
-
}
|
61 |
-
|
62 |
-
foreach ( $admin_notices as $slug => $admin_notice ) {
|
63 |
-
// Call for spam protection
|
64 |
-
if ( $this->anti_notice_spam() ) {
|
65 |
-
return false;
|
66 |
-
}
|
67 |
-
|
68 |
-
|
69 |
-
// Check for proper page to display on
|
70 |
-
if ( isset( $admin_notices[ $slug ][ 'pages' ] ) && is_array( $admin_notices[ $slug ][ 'pages' ] )
|
71 |
-
|| isset( $admin_notices[ $slug ][ 'blacklist' ] ) && is_array( $admin_notices[ $slug ][ 'blacklist' ] )
|
72 |
-
) {
|
73 |
-
|
74 |
-
if( ( isset( $admin_notices[ $slug ][ 'blacklist' ] ) && $this->admin_notice_pages_blacklist( $admin_notices[ $slug ][ 'blacklist' ] ) )
|
75 |
-
|| ( isset( $admin_notices[ $slug ][ 'pages' ] ) && ! $this->admin_notice_pages( $admin_notices[ $slug ][ 'pages' ] ) )
|
76 |
-
) {
|
77 |
-
return false;
|
78 |
-
}
|
79 |
-
}
|
80 |
-
|
81 |
-
// Check for required fields
|
82 |
-
if ( ! $this->required_fields( $admin_notices[ $slug ] ) ) {
|
83 |
-
|
84 |
-
// Get the current date then set start date to either passed value or current date value and add interval
|
85 |
-
$current_date = current_time( "n/j/Y" );
|
86 |
-
$start = ( isset( $admin_notices[ $slug ][ 'start' ] ) ? $admin_notices[ $slug ][ 'start' ] : $current_date );
|
87 |
-
$start = date( "n/j/Y", strtotime( $start ) );
|
88 |
-
$date_array = explode( '/', $start );
|
89 |
-
$interval = ( isset( $admin_notices[ $slug ][ 'int' ] ) ? $admin_notices[ $slug ][ 'int' ] : 0 );
|
90 |
-
$date_array[1] += $interval;
|
91 |
-
$start = date( "n/j/Y", mktime( 0, 0, 0, $date_array[0], $date_array[1], $date_array[2] ) );
|
92 |
-
|
93 |
-
// This is the main notices storage option
|
94 |
-
$admin_notices_option = get_option( 'nf_admin_notice', array() );
|
95 |
-
// Check if the message is already stored and if so just grab the key otherwise store the message and its associated date information
|
96 |
-
if ( ! array_key_exists( $slug, $admin_notices_option ) ) {
|
97 |
-
$admin_notices_option[ $slug ][ 'start' ] = $start;
|
98 |
-
$admin_notices_option[ $slug ][ 'int' ] = $interval;
|
99 |
-
update_option( 'nf_admin_notice', $admin_notices_option );
|
100 |
-
}
|
101 |
-
|
102 |
-
// Sanity check to ensure we have accurate information
|
103 |
-
// New date information will not overwrite old date information
|
104 |
-
$admin_display_check = ( isset( $admin_notices_option[ $slug ][ 'dismissed' ] ) ? $admin_notices_option[ $slug ][ 'dismissed'] : 0 );
|
105 |
-
$admin_display_start = ( isset( $admin_notices_option[ $slug ][ 'start' ] ) ? $admin_notices_option[ $slug ][ 'start'] : $start );
|
106 |
-
$admin_display_interval = ( isset( $admin_notices_option[ $slug ][ 'int' ] ) ? $admin_notices_option[ $slug ][ 'int'] : $interval );
|
107 |
-
$admin_display_msg = ( isset( $admin_notices[ $slug ][ 'msg' ] ) ? $admin_notices[ $slug ][ 'msg'] : '' );
|
108 |
-
$admin_display_title = ( isset( $admin_notices[ $slug ][ 'title' ] ) ? $admin_notices[ $slug ][ 'title'] : '' );
|
109 |
-
$admin_display_link = ( isset( $admin_notices[ $slug ][ 'link' ] ) ? $admin_notices[ $slug ][ 'link' ] : '' );
|
110 |
-
$output_css = false;
|
111 |
-
|
112 |
-
// Ensure the notice hasn't been hidden and that the current date is after the start date
|
113 |
-
if ( $admin_display_check == 0 && strtotime( $admin_display_start ) <= strtotime( $current_date ) ) {
|
114 |
-
|
115 |
-
// Get remaining query string
|
116 |
-
$query_str = esc_url( add_query_arg( 'nf_admin_notice_ignore', $slug ) );
|
117 |
-
|
118 |
-
// Admin notice display output
|
119 |
-
echo '<div class="update-nag nf-admin-notice">';
|
120 |
-
echo '<div class="nf-notice-logo"></div>';
|
121 |
-
echo ' <p class="nf-notice-title">';
|
122 |
-
echo $admin_display_title;
|
123 |
-
echo ' </p>';
|
124 |
-
echo ' <p class="nf-notice-body">';
|
125 |
-
echo $admin_display_msg;
|
126 |
-
echo ' </p>';
|
127 |
-
echo '<ul class="nf-notice-body nf-red">
|
128 |
-
' . $admin_display_link . '
|
129 |
-
</ul>';
|
130 |
-
echo '<a href="' . $query_str . '" class="dashicons dashicons-dismiss"></a>';
|
131 |
-
echo '</div>';
|
132 |
-
|
133 |
-
$this->notice_spam += 1;
|
134 |
-
$output_css = true;
|
135 |
-
}
|
136 |
-
if ( $output_css ) {
|
137 |
-
wp_enqueue_style( 'nf-admin-notices', NINJA_FORMS_URL .'assets/css/admin-notices.css?nf_ver=' . NF_PLUGIN_VERSION );
|
138 |
-
}
|
139 |
-
}
|
140 |
-
}
|
141 |
-
}
|
142 |
-
|
143 |
-
// Spam protection check
|
144 |
-
public function anti_notice_spam() {
|
145 |
-
|
146 |
-
if ( $this->notice_spam >= $this->notice_spam_max ) {
|
147 |
-
return true;
|
148 |
-
}
|
149 |
-
|
150 |
-
return false;
|
151 |
-
}
|
152 |
-
|
153 |
-
// Ignore function that gets ran at admin init to ensure any messages that were dismissed get marked
|
154 |
-
public function admin_notice_ignore() {
|
155 |
-
|
156 |
-
// If user clicks to ignore the notice, update the option to not show it again
|
157 |
-
if ( isset($_GET['nf_admin_notice_ignore']) && current_user_can( apply_filters( 'ninja_forms_admin_parent_menu_capabilities', 'manage_options' ) ) ) {
|
158 |
-
|
159 |
-
$admin_notices_option = get_option( 'nf_admin_notice', array() );
|
160 |
-
$admin_notices_option[ sanitize_text_field($_GET[ 'nf_admin_notice_ignore' ]) ][ 'dismissed' ] = 1;
|
161 |
-
update_option( 'nf_admin_notice', $admin_notices_option );
|
162 |
-
$query_str = remove_query_arg( 'nf_admin_notice_ignore' );
|
163 |
-
wp_redirect( $query_str );
|
164 |
-
exit;
|
165 |
-
}
|
166 |
-
}
|
167 |
-
|
168 |
-
// Temp Ignore function that gets ran at admin init to ensure any messages that were temp dismissed get their start date changed
|
169 |
-
public function admin_notice_temp_ignore() {
|
170 |
-
|
171 |
-
// If user clicks to temp ignore the notice, update the option to change the start date - default interval of 14 days
|
172 |
-
if ( isset($_GET['nf_admin_notice_temp_ignore']) && current_user_can( apply_filters( 'ninja_forms_admin_parent_menu_capabilities', 'manage_options' ) ) ) {
|
173 |
-
|
174 |
-
$admin_notices_option = get_option( 'nf_admin_notice', array() );
|
175 |
-
|
176 |
-
$current_date = current_time( "n/j/Y" );
|
177 |
-
$date_array = explode( '/', $current_date );
|
178 |
-
$interval = ( isset( $_GET[ 'nf_int' ] ) ? absint($_GET[ 'nf_int' ]) : 14 );
|
179 |
-
$date_array[1] += $interval;
|
180 |
-
$new_start = date( "n/j/Y", mktime( 0, 0, 0, $date_array[0], $date_array[1], $date_array[2] ) );
|
181 |
-
|
182 |
-
$admin_notices_option[ sanitize_text_field($_GET[ 'nf_admin_notice_temp_ignore' ]) ][ 'start' ] = $new_start;
|
183 |
-
$admin_notices_option[ sanitize_text_field($_GET[ 'nf_admin_notice_temp_ignore' ]) ][ 'dismissed' ] = 0;
|
184 |
-
update_option( 'nf_admin_notice', $admin_notices_option );
|
185 |
-
$query_str = remove_query_arg( array( 'nf_admin_notice_temp_ignore', 'nf_int' ) );
|
186 |
-
wp_redirect( $query_str );
|
187 |
-
exit;
|
188 |
-
}
|
189 |
-
}
|
190 |
-
|
191 |
-
public function admin_notice_pages_blacklist( $pages ) {
|
192 |
-
|
193 |
-
foreach( $pages as $key => $page ) {
|
194 |
-
if ( is_array( $page ) ) {
|
195 |
-
if ( isset( $_GET[ 'page' ] ) && $_GET[ 'page'] == $page[0] && isset( $_GET[ 'tab' ] ) && $_GET[ 'tab' ] == $page[1] ) {
|
196 |
-
return true;
|
197 |
-
}
|
198 |
-
} else {
|
199 |
-
if ( get_current_screen()->id === $page ) {
|
200 |
-
return true;
|
201 |
-
}
|
202 |
-
if ( isset( $_GET[ 'page' ] ) && $_GET[ 'page'] == $page ) {
|
203 |
-
return true;
|
204 |
-
}
|
205 |
-
}
|
206 |
-
}
|
207 |
-
return false;
|
208 |
-
}
|
209 |
-
|
210 |
-
// Page check function - This should be called from class extensions if the notice should only show on specific admin pages
|
211 |
-
// Expects an array in the form of IE: array( 'dashboard', 'ninja-forms', array( 'ninja-forms', 'builder' ) )
|
212 |
-
// Function accepts dashboard as a special check and also whatever is passed to page or tab as parameters
|
213 |
-
// The above example will display on dashboard and all of the pages that have page=ninja-forms and any page=ninja-forms&tab=builder which is redundant in the example
|
214 |
-
public function admin_notice_pages( $pages ) {
|
215 |
-
|
216 |
-
foreach( $pages as $key => $page ) {
|
217 |
-
if ( is_array( $page ) ) {
|
218 |
-
if ( isset( $_GET[ 'page' ] ) && $_GET[ 'page'] == $page[0] && isset( $_GET[ 'tab' ] ) && $_GET[ 'tab' ] == $page[1] ) {
|
219 |
-
return true;
|
220 |
-
}
|
221 |
-
} else {
|
222 |
-
if ( $page == 'all' ) {
|
223 |
-
return true;
|
224 |
-
}
|
225 |
-
if ( get_current_screen()->id === $page ) {
|
226 |
-
return true;
|
227 |
-
}
|
228 |
-
if ( isset( $_GET[ 'page' ] ) && $_GET[ 'page'] == $page ) {
|
229 |
-
return true;
|
230 |
-
}
|
231 |
-
}
|
232 |
-
}
|
233 |
-
return false;
|
234 |
-
}
|
235 |
-
|
236 |
-
// Required fields check
|
237 |
-
public function required_fields( $fields ) {
|
238 |
-
|
239 |
-
if ( ! isset( $fields[ 'msg' ] ) || ( isset( $fields[ 'msg' ] ) && empty( $fields[ 'msg' ] ) ) ) {
|
240 |
-
return true;
|
241 |
-
}
|
242 |
-
|
243 |
-
if ( ! isset( $fields[ 'title' ] ) || ( isset( $fields[ 'title' ] ) && empty( $fields[ 'title' ] ) ) ) {
|
244 |
-
return true;
|
245 |
-
}
|
246 |
-
|
247 |
-
return false;
|
248 |
-
}
|
249 |
-
|
250 |
-
// Special parameters function that is to be used in any extension of this class
|
251 |
-
public function special_parameters( $admin_notices ) {
|
252 |
-
// Intentionally left blank
|
253 |
-
}
|
254 |
-
|
255 |
-
}
|
256 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/classes/notices-multipart.php
DELETED
@@ -1,92 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
|
3 |
-
/**
|
4 |
-
* NF_Notices_MP Class
|
5 |
-
*
|
6 |
-
* Extends NF_Notices to check for 20 or more fields in a single form and if multi-part forms is not installed before throwing an admin notice.
|
7 |
-
*
|
8 |
-
* @since 2.9
|
9 |
-
*/
|
10 |
-
|
11 |
-
class NF_Notices_MP extends NF_Notices
|
12 |
-
{
|
13 |
-
// Basic actions to run
|
14 |
-
public function __construct(){
|
15 |
-
|
16 |
-
// Runs the admin notice ignore function incase a dismiss button has been clicked
|
17 |
-
add_action( 'admin_init', array( $this, 'admin_notice_ignore' ) );
|
18 |
-
|
19 |
-
// Runs the visibility checks for admin notices after all needed core files are loaded
|
20 |
-
add_filter( 'nf_admin_notices', array( $this, 'special_parameters' ) );
|
21 |
-
|
22 |
-
}
|
23 |
-
|
24 |
-
// Function to do all the special checks before running the notice
|
25 |
-
public function special_parameters( $admin_notices ){
|
26 |
-
|
27 |
-
// Check if on builder
|
28 |
-
if ( ! $this->admin_notice_pages( array( array( 'ninja-forms', 'builder' ) ) ) ) {
|
29 |
-
return $admin_notices;
|
30 |
-
}
|
31 |
-
|
32 |
-
// Check for 20 fields in one form
|
33 |
-
$field_check = 0;
|
34 |
-
$all_fields = ninja_forms_get_all_fields();
|
35 |
-
|
36 |
-
if ( is_array( $all_fields ) ) {
|
37 |
-
$count = array();
|
38 |
-
|
39 |
-
foreach ( $all_fields as $key => $val ) {
|
40 |
-
$form_id = $all_fields[ $key ][ 'form_id' ];
|
41 |
-
if ( ! isset( $count[ $form_id ] ) ) {
|
42 |
-
$count[ $form_id ] = 1;
|
43 |
-
} else {
|
44 |
-
$count[ $form_id ]++;
|
45 |
-
}
|
46 |
-
}
|
47 |
-
|
48 |
-
foreach ( $count as $form_id => $field_count ) {
|
49 |
-
if ( $field_count >=20 ) {
|
50 |
-
$field_check = 1;
|
51 |
-
}
|
52 |
-
}
|
53 |
-
}
|
54 |
-
|
55 |
-
// Check for multi-part forms installed and if the above passes
|
56 |
-
if ( ! is_plugin_active( 'ninja-forms-multi-part/multi-part.php' ) && $field_check == 1 ) {
|
57 |
-
// Add notice
|
58 |
-
$tags = '?utm_medium=plugin&utm_source=admin-notice&utm_campaign=Ninja+Forms+Upsell&utm_content=Mult-Part+Forms';
|
59 |
-
$multi_part_ignore = add_query_arg( array( 'nf_admin_notice_ignore' => 'multi_part' ) );
|
60 |
-
$multi_part_temp = add_query_arg( array( 'nf_admin_notice_temp_ignore' => 'multi_part', 'int' => 14) );
|
61 |
-
$admin_notices['multi_part'] = array(
|
62 |
-
'title' => __( 'Increase Conversions', 'ninja-forms' ),
|
63 |
-
'msg' => __( 'Did you know that you can increase form conversion by breaking larger forms into smaller, more easily digested parts?<p>The Multi-Part Forms extension for Ninja Forms makes this quick and easy.</p>', 'ninja-forms' ),
|
64 |
-
'link' => '<li> <span class="dashicons dashicons-external"></span><a target="_blank" href="https://ninjaforms.com/extensions/multi-part-forms/' . $tags . '"> ' . __( 'Learn More About Multi-Part Forms', 'ninja-forms' ) . '</a></li>
|
65 |
-
<li><span class="dashicons dashicons-calendar-alt"></span><a href="' . $multi_part_temp . '">' . __( 'Maybe Later' ,'ninja-forms' ) . '</a></li>
|
66 |
-
<li><span class="dashicons dashicons-dismiss"></span><a href="' . $multi_part_ignore . '">' . __( 'Dismiss', 'ninja-forms' ) . '</a></li>',
|
67 |
-
'int' => 0
|
68 |
-
);
|
69 |
-
|
70 |
-
}
|
71 |
-
|
72 |
-
return $admin_notices;
|
73 |
-
|
74 |
-
}
|
75 |
-
|
76 |
-
// Ignore function that gets ran at admin init to ensure any messages that were dismissed get marked
|
77 |
-
public function admin_notice_ignore() {
|
78 |
-
|
79 |
-
$slug = ( isset( $_GET[ 'nf_admin_notice_ignore' ] ) ) ? sanitize_text_field($_GET[ 'nf_admin_notice_ignore' ]) : '';
|
80 |
-
// If user clicks to ignore the notice, run this action
|
81 |
-
if ( $slug == 'multi-part19' && current_user_can( apply_filters( 'ninja_forms_admin_parent_menu_capabilities', 'manage_options' ) ) ) {
|
82 |
-
|
83 |
-
$admin_notices_extra_option = get_option( 'nf_admin_notice_extra', array() );
|
84 |
-
$admin_notices_extra_option[ sanitize_text_field($_GET[ 'nf_admin_notice_ignore' ]) ][ 'test19' ] = 1;
|
85 |
-
update_option( 'nf_admin_notice_extra', $admin_notices_extra_option );
|
86 |
-
|
87 |
-
}
|
88 |
-
}
|
89 |
-
|
90 |
-
}
|
91 |
-
|
92 |
-
return new NF_Notices_MP();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/classes/notices-save-progress.php
DELETED
@@ -1,91 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
|
3 |
-
/**
|
4 |
-
* NF_Notices_SP Class
|
5 |
-
*
|
6 |
-
* Extends NF_Notices to check for 40 or more fields in a single form and if multi-part forms is not installed before throwing an admin notice.
|
7 |
-
*
|
8 |
-
* @since 2.9
|
9 |
-
*/
|
10 |
-
|
11 |
-
class NF_Notices_SP extends NF_Notices
|
12 |
-
{
|
13 |
-
// Basic actions to run
|
14 |
-
public function __construct(){
|
15 |
-
|
16 |
-
// Runs the admin notice ignore function incase a dismiss button has been clicked
|
17 |
-
add_action( 'admin_init', array( $this, 'admin_notice_ignore' ) );
|
18 |
-
|
19 |
-
// Runs the visibility checks for admin notices after all needed core files are loaded
|
20 |
-
add_filter( 'nf_admin_notices', array( $this, 'special_parameters' ) );
|
21 |
-
|
22 |
-
}
|
23 |
-
|
24 |
-
// Function to do all the special checks before running the notice
|
25 |
-
public function special_parameters( $admin_notices ){
|
26 |
-
|
27 |
-
// Check if on builder
|
28 |
-
if ( ! $this->admin_notice_pages( array( array( 'ninja-forms', 'builder' ) ) ) ) {
|
29 |
-
return $admin_notices;
|
30 |
-
}
|
31 |
-
|
32 |
-
// Check for 20 fields in one form
|
33 |
-
$field_check = 0;
|
34 |
-
$all_fields = ninja_forms_get_all_fields();
|
35 |
-
|
36 |
-
if ( is_array( $all_fields ) ) {
|
37 |
-
$count = array();
|
38 |
-
|
39 |
-
foreach ( $all_fields as $key => $val ) {
|
40 |
-
$form_id = $all_fields[ $key ][ 'form_id' ];
|
41 |
-
if ( ! isset( $count[ $form_id ] ) ) {
|
42 |
-
$count[ $form_id ] = 1;
|
43 |
-
} else {
|
44 |
-
$count[ $form_id ]++;
|
45 |
-
}
|
46 |
-
}
|
47 |
-
|
48 |
-
foreach ( $count as $form_id => $field_count ) {
|
49 |
-
if ( $field_count >=40 ) {
|
50 |
-
$field_check = 1;
|
51 |
-
}
|
52 |
-
}
|
53 |
-
}
|
54 |
-
|
55 |
-
// Check for multi-part forms installed and if the above passes
|
56 |
-
if ( ! is_plugin_active( 'ninja-forms-save-progress/save-progress.php' ) && $field_check == 1 ) {
|
57 |
-
// Add notice
|
58 |
-
$tags = '?utm_medium=plugin&utm_source=admin-notice&utm_campaign=Ninja+Forms+Upsell&utm_content=Save+Progress';
|
59 |
-
$save_progress_ignore = add_query_arg( array( 'nf_admin_notice_ignore' => 'save_progress' ) );
|
60 |
-
$save_progress_temp = add_query_arg( array( 'nf_admin_notice_temp_ignore' => 'save_progress', 'int' => 14) );
|
61 |
-
$admin_notices['save_progress'] = array(
|
62 |
-
'title' => __( 'Increase Conversions', 'ninja-forms' ),
|
63 |
-
'msg' => __( 'Users are more likely to complete long forms when they can save and return to complete their submission later.<p>The Save Progress extension for Ninja Forms makes this quick and easy.</p>', 'ninja-forms' ),
|
64 |
-
'link' => '<li> <span class="dashicons dashicons-external"></span><a target="_blank" href="https://ninjaforms.com/extensions/save-user-progress/' . $tags . '"> ' . __( 'Learn More About Save Progress', 'ninja-forms' ) . '</a></li>
|
65 |
-
<li><span class="dashicons dashicons-calendar-alt"></span><a href="' . $save_progress_temp . '">' . __( 'Maybe Later' ,'ninja-forms' ) . '</a></li>
|
66 |
-
<li><span class="dashicons dashicons-dismiss"></span><a href="' . $save_progress_ignore . '">' . __( 'Dismiss', 'ninja-forms' ) . '</a></li>',
|
67 |
-
'int' => 0
|
68 |
-
);
|
69 |
-
|
70 |
-
}
|
71 |
-
|
72 |
-
return $admin_notices;
|
73 |
-
|
74 |
-
}
|
75 |
-
// Ignore function that gets ran at admin init to ensure any messages that were dismissed get marked
|
76 |
-
public function admin_notice_ignore() {
|
77 |
-
|
78 |
-
$slug = ( isset( $_GET[ 'nf_admin_notice_ignore' ] ) ) ? sanitize_text_field($_GET[ 'nf_admin_notice_ignore' ]) : '';
|
79 |
-
// If user clicks to ignore the notice, run this action
|
80 |
-
if ( $slug == 'multi-part19' && current_user_can( apply_filters( 'ninja_forms_admin_parent_menu_capabilities', 'manage_options' ) ) ) {
|
81 |
-
|
82 |
-
$admin_notices_extra_option = get_option( 'nf_admin_notice_extra', array() );
|
83 |
-
$admin_notices_extra_option[ sanitize_text_field($_GET[ 'nf_admin_notice_ignore' ]) ][ 'test19' ] = 1;
|
84 |
-
update_option( 'nf_admin_notice_extra', $admin_notices_extra_option );
|
85 |
-
|
86 |
-
}
|
87 |
-
}
|
88 |
-
|
89 |
-
}
|
90 |
-
|
91 |
-
return new NF_Notices_SP();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/classes/notification-base-type.php
DELETED
@@ -1,94 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
/**
|
3 |
-
* Class for notification types.
|
4 |
-
* This is the parent class. it should be extended by specific notification types
|
5 |
-
*
|
6 |
-
* @package Ninja Forms
|
7 |
-
* @subpackage Classes/Notifications
|
8 |
-
* @copyright Copyright (c) 2014, WPNINJAS
|
9 |
-
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
10 |
-
* @since 2.8
|
11 |
-
*/
|
12 |
-
|
13 |
-
abstract class NF_Notification_Base_Type
|
14 |
-
{
|
15 |
-
|
16 |
-
/**
|
17 |
-
* Get things rolling
|
18 |
-
*
|
19 |
-
* @since 2.8
|
20 |
-
*/
|
21 |
-
function __construct() {
|
22 |
-
|
23 |
-
}
|
24 |
-
|
25 |
-
/**
|
26 |
-
* Processing function
|
27 |
-
*
|
28 |
-
* @access public
|
29 |
-
* @since 2.8
|
30 |
-
* @return false
|
31 |
-
*/
|
32 |
-
public function process( $id ) {
|
33 |
-
// This space left intentionally blank
|
34 |
-
}
|
35 |
-
|
36 |
-
/**
|
37 |
-
* Output admin edit screen
|
38 |
-
*
|
39 |
-
* @access public
|
40 |
-
* @since 2.8
|
41 |
-
* @return false
|
42 |
-
*/
|
43 |
-
public function edit_screen( $id = '' ) {
|
44 |
-
// This space left intentionally blank
|
45 |
-
}
|
46 |
-
|
47 |
-
/**
|
48 |
-
* Save admin edit screen
|
49 |
-
*
|
50 |
-
* @access public
|
51 |
-
* @since 2.8
|
52 |
-
* @return void
|
53 |
-
*/
|
54 |
-
public function save_admin( $id = '', $data ) {
|
55 |
-
// This space left intentionally blank
|
56 |
-
return $data;
|
57 |
-
}
|
58 |
-
|
59 |
-
/**
|
60 |
-
* Explode our settings by ` and extract each value.
|
61 |
-
* Check to see if the setting is a field; if it is, assign the value.
|
62 |
-
* Run shortcodes and return the result.
|
63 |
-
*
|
64 |
-
* @access public
|
65 |
-
* @since 2.8
|
66 |
-
* @return array $setting
|
67 |
-
*/
|
68 |
-
public function process_setting( $id, $setting, $html = 1 ) {
|
69 |
-
global $ninja_forms_processing;
|
70 |
-
|
71 |
-
$setting_name = $setting;
|
72 |
-
|
73 |
-
$setting = explode( '`', Ninja_Forms()->notification( $id )->get_setting( $setting ) );
|
74 |
-
|
75 |
-
for ( $x = 0; $x <= count ( $setting ) - 1; $x++ ) {
|
76 |
-
if ( strpos( $setting[ $x ], 'field_' ) !== false ) {
|
77 |
-
if ( $ninja_forms_processing->get_field_value( str_replace( 'field_', '', $setting[ $x ] ) ) ) {
|
78 |
-
$setting[ $x ] = $ninja_forms_processing->get_field_value( str_replace( 'field_', '', $setting[ $x ] ) );
|
79 |
-
} else {
|
80 |
-
$setting[ $x ] = '';
|
81 |
-
}
|
82 |
-
}
|
83 |
-
|
84 |
-
if ( ! is_array ( $setting[ $x] ) ) {
|
85 |
-
$setting[ $x ] = str_replace( '[ninja_forms_all_fields]', '[ninja_forms_all_fields html=' . $html . ']', $setting[ $x ] );
|
86 |
-
$setting[ $x ] = do_shortcode( $setting[ $x ] );
|
87 |
-
$setting[ $x ] = nf_parse_fields_shortcode( $setting[ $x ] );
|
88 |
-
}
|
89 |
-
|
90 |
-
}
|
91 |
-
|
92 |
-
return apply_filters( 'nf_notification_process_setting', $setting, $setting_name, $id );
|
93 |
-
}
|
94 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/classes/notification-email.php
DELETED
@@ -1,413 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
/**
|
3 |
-
* Class for our email notification type.
|
4 |
-
*
|
5 |
-
* @package Ninja Forms
|
6 |
-
* @subpackage Classes/Notifications
|
7 |
-
* @copyright Copyright (c) 2014, WPNINJAS
|
8 |
-
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
-
* @since 2.8
|
10 |
-
*/
|
11 |
-
|
12 |
-
class NF_Notification_Email extends NF_Notification_Base_Type
|
13 |
-
{
|
14 |
-
|
15 |
-
/**
|
16 |
-
* Get things rolling
|
17 |
-
*/
|
18 |
-
function __construct() {
|
19 |
-
$this->name = __( 'Email', 'ninja-forms' );
|
20 |
-
}
|
21 |
-
|
22 |
-
/**
|
23 |
-
* Output our edit screen
|
24 |
-
*
|
25 |
-
* @access public
|
26 |
-
* @since 2.8
|
27 |
-
* @return void
|
28 |
-
*/
|
29 |
-
public function edit_screen( $id = '' ) {
|
30 |
-
$form_id = ( '' != $id ) ? Ninja_Forms()->notification( $id )->form_id : '';
|
31 |
-
|
32 |
-
if ( $id == '' ) {
|
33 |
-
$email_format = 'html';
|
34 |
-
$from_name = get_bloginfo( 'name' );
|
35 |
-
$from_address = get_bloginfo( 'admin_email' );
|
36 |
-
$reply_to = '';
|
37 |
-
$to = '';
|
38 |
-
$cc = '';
|
39 |
-
$bcc = '';
|
40 |
-
$email_subject = '';
|
41 |
-
$email_message = '';
|
42 |
-
} else {
|
43 |
-
$email_format = Ninja_Forms()->notification( $id )->get_setting( 'email_format' );
|
44 |
-
$from_name = Ninja_Forms()->notification( $id )->get_setting( 'from_name' );
|
45 |
-
$from_address = Ninja_Forms()->notification( $id )->get_setting( 'from_address' );
|
46 |
-
$reply_to = Ninja_Forms()->notification( $id )->get_setting( 'reply_to' );
|
47 |
-
$to = Ninja_Forms()->notification( $id )->get_setting( 'to' );
|
48 |
-
$cc = Ninja_Forms()->notification( $id )->get_setting( 'cc' );
|
49 |
-
$bcc = Ninja_Forms()->notification( $id )->get_setting( 'bcc' );
|
50 |
-
$email_subject = Ninja_Forms()->notification( $id )->get_setting( 'email_subject' );
|
51 |
-
$email_message = Ninja_Forms()->notification( $id )->get_setting( 'email_message' );
|
52 |
-
}
|
53 |
-
|
54 |
-
?>
|
55 |
-
<tr>
|
56 |
-
<th scope="row"><label for="settings-from_name"><?php _e( 'From Name', 'ninja-forms' ); ?></label></th>
|
57 |
-
<td>
|
58 |
-
<input name="settings[from_name]" type="text" id="settings-from_name" value="<?php echo $from_name; ?>" class="nf-tokenize" placeholder="<?php _e( 'Name or fields', 'ninja-forms' ); ?>" data-token-limit="0" data-key="from_name" data-type="all" />
|
59 |
-
<span class="howto"><?php _e( 'Email will appear to be from this name.', 'ninja-forms' ) ?></span>
|
60 |
-
</td>
|
61 |
-
</tr>
|
62 |
-
<tr>
|
63 |
-
<th scope="row"><label for="settings-from_address"><?php _e( 'From Address', 'ninja-forms' ); ?></label></th>
|
64 |
-
<td>
|
65 |
-
<input name="settings[from_address]" type="text" id="settings-from_address" value="<?php echo $from_address; ?>" class="nf-tokenize" placeholder="<?php _e( 'One email address or field', 'ninja-forms' ); ?>" data-token-limit="1" data-key="from_address" data-type="all" />
|
66 |
-
<span class="howto"><?php _e( 'Email will appear to be from this email address.', 'ninja-forms' ) ?></span>
|
67 |
-
</td>
|
68 |
-
</tr>
|
69 |
-
<tr>
|
70 |
-
<th scope="row"><label for="settings-to"><?php _e( 'To', 'ninja-forms' ); ?></label></th>
|
71 |
-
<td>
|
72 |
-
<input name="settings[to]" type="text" id="settings-to" value="<?php echo $to; ?>" class="nf-tokenize" placeholder="<?php _e( 'Email addresses or search for a field', 'ninja-forms' ); ?>" data-token-limit="0" data-key="to" data-type="all" />
|
73 |
-
<span class="howto"><?php _e( 'Who should this email be sent to?', 'ninja-forms' ) ?></span>
|
74 |
-
</td>
|
75 |
-
</tr>
|
76 |
-
<tr>
|
77 |
-
<th scope="row"><label for="settings-email_subject"><?php _e( 'Subject', 'ninja-forms' ); ?></label></th>
|
78 |
-
<td>
|
79 |
-
<input name="settings[email_subject]" type="text" id="settings-email_subject" value="<?php echo $email_subject; ?>" class="nf-tokenize" placeholder="<?php _e( 'Subject Text or search for a field', 'ninja-forms' ); ?>" data-token-limit="0" data-key="email_subject" data-type="all" />
|
80 |
-
<span class="howto"><?php _e( 'This will be the subject of the email.', 'ninja-forms' ) ?></span>
|
81 |
-
</td>
|
82 |
-
</tr>
|
83 |
-
<tr>
|
84 |
-
<th scope="row"><label for="settings-email_message"><?php _e( 'Email Message', 'ninja-forms' ); ?></label></th>
|
85 |
-
<td>
|
86 |
-
<?php
|
87 |
-
$settings = array(
|
88 |
-
'textarea_name' => 'settings[email_message]',
|
89 |
-
);
|
90 |
-
wp_editor( $email_message, 'email_message', $settings );
|
91 |
-
?>
|
92 |
-
</td>
|
93 |
-
</tr>
|
94 |
-
<tr>
|
95 |
-
<th scope="row"><label for="settings-attachments"><?php _e( 'Attachments', 'ninja-forms' ); ?></label></th>
|
96 |
-
<td>
|
97 |
-
<ul>
|
98 |
-
<?php
|
99 |
-
$attachment_types = apply_filters( 'nf_email_notification_attachment_types',
|
100 |
-
array(
|
101 |
-
'attach_csv' => __( 'Submission CSV', 'ninja-forms' ),
|
102 |
-
)
|
103 |
-
);
|
104 |
-
|
105 |
-
foreach ( $attachment_types as $slug => $nicename ) {
|
106 |
-
if ( '' == $id ) {
|
107 |
-
$current_setting = 0;
|
108 |
-
} else {
|
109 |
-
$current_setting = Ninja_Forms()->notification( $id )->get_setting( $slug );
|
110 |
-
}
|
111 |
-
|
112 |
-
?>
|
113 |
-
<li>
|
114 |
-
<input name="settings[<?php echo $slug; ?>]" type="hidden" value="0">
|
115 |
-
<input name="settings[<?php echo $slug; ?>]" type="checkbox" id="settings-<?php echo $slug; ?>" value="1" <?php checked( $current_setting, 1 ); ?>/>
|
116 |
-
<label for="settings-<?php echo $slug; ?>"><?php echo $nicename; ?></label>
|
117 |
-
</li>
|
118 |
-
|
119 |
-
<?php
|
120 |
-
}
|
121 |
-
?>
|
122 |
-
</ul>
|
123 |
-
</td>
|
124 |
-
</tr>
|
125 |
-
<tr>
|
126 |
-
<th scope="row"><a href="#" id="toggle_email_advanced"><?php _e( 'Advanced Settings', 'ninja-forms' ); ?></a></th>
|
127 |
-
</tr>
|
128 |
-
<tbody id="email_advanced" style="display:none;">
|
129 |
-
<tr>
|
130 |
-
<th scope="row"><label for="settings-email_format"><?php _e( 'Format', 'ninja-forms' ); ?></label></th>
|
131 |
-
<td>
|
132 |
-
<select name="settings[email_format]" id="settings-email_format" data-key="email_format"/>
|
133 |
-
<option value="html" <?php selected( $email_format, 'html' ); ?>><?php _e( 'HTML', 'ninja-forms' ); ?></option>
|
134 |
-
<option value="plain" <?php selected( $email_format, 'plain' ); ?>><?php _e( 'Plain Text', 'ninja-forms' ); ?></option>
|
135 |
-
</select>
|
136 |
-
</td>
|
137 |
-
</tr>
|
138 |
-
<tr>
|
139 |
-
<th scope="row"><label for="settings-reply_to"><?php _e( 'Reply To', 'ninja-forms' ); ?></label></th>
|
140 |
-
<td>
|
141 |
-
<input name="settings[reply_to]" type="text" id="settings-reply_to" value="<?php echo $reply_to; ?>" class="nf-tokenize" placeholder="<?php __( 'One email address or field', 'ninja-forms' ); ?>" data-token-limit="1" data-key="reply_to" data-type="all" />
|
142 |
-
</td>
|
143 |
-
</tr>
|
144 |
-
<tr>
|
145 |
-
<th scope="row"><label for="settings-cc"><?php _e( 'Cc', 'ninja-forms' ); ?></label></th>
|
146 |
-
<td>
|
147 |
-
<input name="settings[cc]" type="text" id="settings-cc" value="<?php echo $cc; ?>" class="nf-tokenize" placeholder="<?php __( 'Email addresses or search for a field', 'ninja-forms' ); ?>" data-token-limit="0" data-key="cc" data-type="all" />
|
148 |
-
</td>
|
149 |
-
</tr>
|
150 |
-
<tr>
|
151 |
-
<th scope="row"><label for="settings-bcc"><?php _e( 'Bcc', 'ninja-forms' ); ?></label></th>
|
152 |
-
<td>
|
153 |
-
<input name="settings[bcc]" type="text" id="settings-bcc" value="<?php echo $bcc; ?>" class="nf-tokenize" placeholder="<?php __( 'Email addresses or search for a field', 'ninja-forms' ); ?>" data-token-limit="0" data-key="bcc" data-type="all" />
|
154 |
-
</td>
|
155 |
-
</tr>
|
156 |
-
</tbody>
|
157 |
-
<?php
|
158 |
-
|
159 |
-
do_action( 'nf_email_notification_after_settings', $id );
|
160 |
-
|
161 |
-
if ( '' != $form_id ) {
|
162 |
-
$from_name = $this->get_value( $id, 'from_name', $form_id );
|
163 |
-
$from_address = $this->get_value( $id, 'from_address', $form_id );
|
164 |
-
$reply_to = $this->get_value( $id, 'reply_to', $form_id );
|
165 |
-
$to = $this->get_value( $id, 'to', $form_id );
|
166 |
-
$cc = $this->get_value( $id, 'cc', $form_id );
|
167 |
-
$bcc = $this->get_value( $id, 'bcc', $form_id );
|
168 |
-
$email_subject = $this->get_value( $id, 'email_subject', $form_id );
|
169 |
-
} else {
|
170 |
-
$from_name = get_bloginfo( 'name' );
|
171 |
-
$from_address = get_bloginfo( 'admin_email' );
|
172 |
-
$reply_to = '';
|
173 |
-
$to = '';
|
174 |
-
$cc = '';
|
175 |
-
$bcc = '';
|
176 |
-
$email_subject = '';
|
177 |
-
}
|
178 |
-
|
179 |
-
?>
|
180 |
-
|
181 |
-
<script type="text/javascript">
|
182 |
-
nf_notifications.tokens['from_name'] = <?php echo json_encode( $from_name ); ?>;
|
183 |
-
nf_notifications.tokens['from_address'] = <?php echo json_encode( $from_address ); ?>;
|
184 |
-
nf_notifications.tokens['reply_to'] = <?php echo json_encode( $reply_to ); ?>;
|
185 |
-
nf_notifications.tokens['to'] = <?php echo json_encode( $to ); ?>;
|
186 |
-
nf_notifications.tokens['cc'] = <?php echo json_encode( $cc ); ?>;
|
187 |
-
nf_notifications.tokens['bcc'] = <?php echo json_encode( $bcc ); ?>;
|
188 |
-
nf_notifications.tokens['email_subject'] = <?php echo json_encode( $email_subject ); ?>;
|
189 |
-
</script>
|
190 |
-
|
191 |
-
<?php
|
192 |
-
}
|
193 |
-
|
194 |
-
/**
|
195 |
-
* Get our input value labels
|
196 |
-
*
|
197 |
-
* @access public
|
198 |
-
* @since 2.8
|
199 |
-
* @return string $label
|
200 |
-
*/
|
201 |
-
public function get_value( $id, $meta_key, $form_id ) {
|
202 |
-
$meta_value = nf_get_object_meta_value( $id, $meta_key );
|
203 |
-
$meta_value = explode( '`', $meta_value );
|
204 |
-
|
205 |
-
$return = array();
|
206 |
-
foreach( $meta_value as $val ) {
|
207 |
-
if ( strpos( $val, 'field_' ) !== false ) {
|
208 |
-
$val = str_replace( 'field_', '', $val );
|
209 |
-
$label = nf_get_field_admin_label( $val, $form_id );
|
210 |
-
if ( strlen( $label ) > 30 ) {
|
211 |
-
$label = substr( $label, 0, 30 );
|
212 |
-
}
|
213 |
-
|
214 |
-
$return[] = array( 'value' => 'field_' . $val, 'label' => $label . ' - ID: ' . $val );
|
215 |
-
} else {
|
216 |
-
$return[] = array( 'value' => $val, 'label' => $val );
|
217 |
-
}
|
218 |
-
}
|
219 |
-
|
220 |
-
return $return;
|
221 |
-
}
|
222 |
-
|
223 |
-
/**
|
224 |
-
* Process our Email notification
|
225 |
-
*
|
226 |
-
* @access public
|
227 |
-
* @since 2.8
|
228 |
-
* @return void
|
229 |
-
*/
|
230 |
-
public function process( $id ) {
|
231 |
-
global $ninja_forms_processing;
|
232 |
-
|
233 |
-
$form_id = $ninja_forms_processing->get_form_ID();
|
234 |
-
$form_title = $ninja_forms_processing->get_form_setting( 'form_title' );
|
235 |
-
|
236 |
-
$email_format = Ninja_Forms()->notification( $id )->get_setting( 'email_format' );
|
237 |
-
$attach_csv = Ninja_Forms()->notification( $id )->get_setting( 'attach_csv' );
|
238 |
-
|
239 |
-
$from_name = $this->process_setting( $id, 'from_name' );
|
240 |
-
$from_name = implode( ' ', $from_name );
|
241 |
-
|
242 |
-
$from_address = $this->process_setting( $id, 'from_address' );
|
243 |
-
$from_address = $from_address[0];
|
244 |
-
|
245 |
-
$reply_to = $this->process_setting( $id, 'reply_to' );
|
246 |
-
$reply_to = $reply_to[0];
|
247 |
-
$to = $this->process_setting( $id, 'to' );
|
248 |
-
$cc = $this->process_setting( $id, 'cc' );
|
249 |
-
// $cc = $cc[0];
|
250 |
-
$bcc = $this->process_setting( $id, 'bcc' );
|
251 |
-
// $bcc = $bcc[0];
|
252 |
-
|
253 |
-
if ( empty ( $from_name ) )
|
254 |
-
$from_name = 'WordPress';
|
255 |
-
|
256 |
-
if ( empty ( $from_address ) ) {
|
257 |
-
$admin_email = get_bloginfo( 'admin_email' );
|
258 |
-
$from_address = $admin_email;
|
259 |
-
}
|
260 |
-
|
261 |
-
$email_from = $from_name.' <'.$from_address.'>';
|
262 |
-
|
263 |
-
$subject = $this->process_setting( $id, 'email_subject' );
|
264 |
-
$subject = $this->flatten_array_recursive( ' ', $subject );
|
265 |
-
|
266 |
-
if ( empty( $subject ) ) {
|
267 |
-
$subject = $form_title;
|
268 |
-
} elseif( is_array( $subject ) ){
|
269 |
-
$subject = implode( ',', $subject );
|
270 |
-
}
|
271 |
-
|
272 |
-
$message = $this->process_setting( $id, 'email_message' );
|
273 |
-
if ( is_array ( $message ) )
|
274 |
-
$message = $message[0];
|
275 |
-
|
276 |
-
if ( $email_format != 'plain' )
|
277 |
-
$message = apply_filters( 'ninja_forms_admin_email_message_wpautop', wpautop( $message ) );
|
278 |
-
|
279 |
-
if ( empty ( $message ) )
|
280 |
-
$message = ' ';
|
281 |
-
|
282 |
-
$headers = array();
|
283 |
-
$headers[] = 'From: ' . $email_from;
|
284 |
-
|
285 |
-
if( ! empty( $reply_to ) ) {
|
286 |
-
$headers[] = sprintf('Reply-To: "%s" <%s>', $from_name, $reply_to);
|
287 |
-
}
|
288 |
-
$headers[] = 'Content-Type: text/' . $email_format;
|
289 |
-
$headers[] = 'charset=utf-8';
|
290 |
-
|
291 |
-
if ( ! empty( $cc ) ) {
|
292 |
-
foreach ($cc as $ccemail) {
|
293 |
-
if ( ! empty( $ccemail ) ) {
|
294 |
-
$headers[] = 'Cc: ' . $ccemail;
|
295 |
-
}
|
296 |
-
}
|
297 |
-
}
|
298 |
-
|
299 |
-
if ( ! empty( $bcc ) ) {
|
300 |
-
foreach ($bcc as $bccemail) {
|
301 |
-
if ( ! empty( $bccemail ) ) {
|
302 |
-
$headers[] = 'Bcc: ' . $bccemail;
|
303 |
-
}
|
304 |
-
}
|
305 |
-
}
|
306 |
-
|
307 |
-
$csv_attachment = '';
|
308 |
-
$attachments = apply_filters( 'nf_email_notification_attachments', array(), $id );
|
309 |
-
|
310 |
-
// Check to see if we need to attach a CSV
|
311 |
-
if ( 1 == $attach_csv ) {
|
312 |
-
// Create our attachment
|
313 |
-
|
314 |
-
// Get our submission ID
|
315 |
-
$sub_id = $ninja_forms_processing->get_form_setting( 'sub_id' );
|
316 |
-
|
317 |
-
// create CSV content
|
318 |
-
$csv_content = Ninja_Forms()->sub( $sub_id )->export( true );
|
319 |
-
|
320 |
-
$upload_dir = wp_upload_dir();
|
321 |
-
$path = trailingslashit( $upload_dir['path'] );
|
322 |
-
|
323 |
-
// create temporary file
|
324 |
-
$path = tempnam( $path, 'Sub' );
|
325 |
-
$temp_file = fopen( $path, 'r+' );
|
326 |
-
|
327 |
-
// write to temp file
|
328 |
-
fwrite( $temp_file, $csv_content );
|
329 |
-
fclose( $temp_file );
|
330 |
-
|
331 |
-
// find the directory we will be using for the final file
|
332 |
-
$path = pathinfo( $path );
|
333 |
-
$dir = $path['dirname'];
|
334 |
-
$basename = $path['basename'];
|
335 |
-
|
336 |
-
// create name for file
|
337 |
-
$new_name = apply_filters( 'ninja_forms_submission_csv_name', 'ninja-forms-submission' );
|
338 |
-
|
339 |
-
// remove a file if it already exists
|
340 |
-
if( file_exists( $dir.'/'.$new_name.'.csv' ) ) {
|
341 |
-
unlink( $dir.'/'.$new_name.'.csv' );
|
342 |
-
}
|
343 |
-
|
344 |
-
// move file
|
345 |
-
rename( $dir.'/'.$basename, $dir.'/'.$new_name.'.csv' );
|
346 |
-
$csv_attachment = $dir.'/'.$new_name.'.csv';
|
347 |
-
|
348 |
-
$attachments[] = $csv_attachment;
|
349 |
-
}
|
350 |
-
|
351 |
-
if ( is_array( $to ) AND !empty( $to ) ){
|
352 |
-
|
353 |
-
$to = explode( ",", $this->flatten_array_recursive( ',', $to ) );
|
354 |
-
|
355 |
-
wp_mail( $to, $subject, $message, $headers, $attachments );
|
356 |
-
}
|
357 |
-
|
358 |
-
// Delete our admin CSV if one is present.
|
359 |
-
if ( file_exists( $csv_attachment ) ) {
|
360 |
-
//unlink ( $csv_attachment );
|
361 |
-
}
|
362 |
-
}
|
363 |
-
|
364 |
-
public function flatten_array_recursive( $glue = ',', array $array = array() ) {
|
365 |
-
|
366 |
-
$return = array();
|
367 |
-
|
368 |
-
foreach ( $array as $value ) {
|
369 |
-
|
370 |
-
if ( is_array( $value ) ) {
|
371 |
-
|
372 |
-
$return[] = $this->flatten_array_recursive( $glue, $value );
|
373 |
-
|
374 |
-
} else {
|
375 |
-
|
376 |
-
$return[] = $value;
|
377 |
-
|
378 |
-
}
|
379 |
-
|
380 |
-
}
|
381 |
-
|
382 |
-
return implode( $glue, $return );
|
383 |
-
|
384 |
-
}
|
385 |
-
|
386 |
-
/**
|
387 |
-
* Explode our settings by ` and extract each value.
|
388 |
-
* Check to see if the setting is a field; if it is, assign the value.
|
389 |
-
* Run shortcodes and return the result.
|
390 |
-
*
|
391 |
-
* @access public
|
392 |
-
* @since 2.8
|
393 |
-
* @return array $setting
|
394 |
-
*/
|
395 |
-
public function process_setting( $id, $setting, $html = 0 ) {
|
396 |
-
|
397 |
-
// save the setting name
|
398 |
-
$setting_name = $setting;
|
399 |
-
|
400 |
-
$format = Ninja_Forms()->notification( $id )->get_setting( 'email_format' );
|
401 |
-
if ( 'html' == $format )
|
402 |
-
$html = 1;
|
403 |
-
|
404 |
-
// call parent process setting method
|
405 |
-
$setting = parent::process_setting( $id, $setting, $html );
|
406 |
-
|
407 |
-
// gotta keep the old filter in case anyone was using it.
|
408 |
-
return apply_filters( 'nf_email_notification_process_setting', $setting, $setting_name, $id );
|
409 |
-
}
|
410 |
-
|
411 |
-
}
|
412 |
-
|
413 |
-
return new NF_Notification_Email();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/classes/notification-redirect.php
DELETED
@@ -1,56 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
/**
|
3 |
-
* Class for our redirect notification type.
|
4 |
-
*
|
5 |
-
* @package Ninja Forms
|
6 |
-
* @subpackage Classes/Notifications
|
7 |
-
* @copyright Copyright (c) 2014, WPNINJAS
|
8 |
-
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
-
* @since 2.8
|
10 |
-
*/
|
11 |
-
|
12 |
-
class NF_Notification_Redirect extends NF_Notification_Base_Type
|
13 |
-
{
|
14 |
-
|
15 |
-
/**
|
16 |
-
* Get things rolling
|
17 |
-
*/
|
18 |
-
function __construct() {
|
19 |
-
$this->name = __( 'Redirect', 'ninja-forms' );
|
20 |
-
}
|
21 |
-
|
22 |
-
/**
|
23 |
-
* Output our edit screen
|
24 |
-
*
|
25 |
-
* @access public
|
26 |
-
* @since 2.8
|
27 |
-
* @return void
|
28 |
-
*/
|
29 |
-
public function edit_screen( $id = '' ) {
|
30 |
-
$redirect_url = trim( Ninja_Forms()->notification( $id )->get_setting( 'redirect_url' ) );
|
31 |
-
?>
|
32 |
-
<tr>
|
33 |
-
<th scope="row"><label for="settings-redirect_url"><?php _e( 'Url', 'ninja-forms' ); ?></label></th>
|
34 |
-
<td><input type="text" name="settings[redirect_url]" id="settings-redirect_url" value="<?php echo esc_attr( $redirect_url ); ?>" class="regular-text"/></td>
|
35 |
-
</tr>
|
36 |
-
<?php
|
37 |
-
}
|
38 |
-
|
39 |
-
/**
|
40 |
-
* Process our Redirect notification
|
41 |
-
*
|
42 |
-
* @access public
|
43 |
-
* @since 2.8
|
44 |
-
* @return void
|
45 |
-
*/
|
46 |
-
public function process( $id ) {
|
47 |
-
global $ninja_forms_processing;
|
48 |
-
|
49 |
-
$redirect_url = trim( Ninja_Forms()->notification( $id )->get_setting( 'redirect_url' ) );
|
50 |
-
|
51 |
-
$ninja_forms_processing->update_form_setting( 'landing_page', $redirect_url );
|
52 |
-
}
|
53 |
-
|
54 |
-
}
|
55 |
-
|
56 |
-
return new NF_Notification_Redirect();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/classes/notification-success-message.php
DELETED
@@ -1,87 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
/**
|
3 |
-
* Class for our success message notification type.
|
4 |
-
*
|
5 |
-
* @package Ninja Forms
|
6 |
-
* @subpackage Classes/Notifications
|
7 |
-
* @copyright Copyright (c) 2014, WPNINJAS
|
8 |
-
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
-
* @since 2.8
|
10 |
-
*/
|
11 |
-
|
12 |
-
class NF_Notification_Success_Message extends NF_Notification_Base_Type
|
13 |
-
{
|
14 |
-
|
15 |
-
/**
|
16 |
-
* Get things rolling
|
17 |
-
*/
|
18 |
-
function __construct() {
|
19 |
-
$this->name = __( 'Success Message', 'ninja-forms' );
|
20 |
-
}
|
21 |
-
|
22 |
-
/**
|
23 |
-
* Output our edit screen
|
24 |
-
*
|
25 |
-
* @access public
|
26 |
-
* @since 2.8
|
27 |
-
* @return void
|
28 |
-
*/
|
29 |
-
public function edit_screen( $id = '' ) {
|
30 |
-
$settings = array(
|
31 |
-
'textarea_name' => 'settings[success_msg]',
|
32 |
-
);
|
33 |
-
$loc_opts = apply_filters( 'nf_success_message_locations',
|
34 |
-
array(
|
35 |
-
array( 'action' => 'ninja_forms_display_before_fields', 'name' => __( 'Before Form', 'ninja-forms' ) ),
|
36 |
-
array( 'action' => 'ninja_forms_display_after_fields', 'name' => __( 'After Form', 'ninja-forms' ) ),
|
37 |
-
)
|
38 |
-
);
|
39 |
-
?>
|
40 |
-
<!-- <tr>
|
41 |
-
<th scope="row"><label for="success_message_loc"><?php _e( 'Location', 'ninja-forms' ); ?></label></th>
|
42 |
-
<td>
|
43 |
-
<select name="settings[success_message_loc]">
|
44 |
-
<?php
|
45 |
-
foreach ( $loc_opts as $opt ) {
|
46 |
-
?>
|
47 |
-
<option value="<?php echo $opt['action'];?>" <?php selected( nf_get_object_meta_value( $id, 'success_message_loc' ), $opt['action'] ); ?>><?php echo $opt['name'];?></option>
|
48 |
-
<?php
|
49 |
-
}
|
50 |
-
?>
|
51 |
-
</select>
|
52 |
-
</td>
|
53 |
-
</tr> -->
|
54 |
-
<tr>
|
55 |
-
<th scope="row"><label for="success_msg"><?php _e( 'Message', 'ninja-forms' ); ?></label></th>
|
56 |
-
<td>
|
57 |
-
<?php wp_editor( nf_get_object_meta_value( $id, 'success_msg' ), 'success_msg', $settings ); ?>
|
58 |
-
</td>
|
59 |
-
</tr>
|
60 |
-
|
61 |
-
<?php
|
62 |
-
}
|
63 |
-
|
64 |
-
/**
|
65 |
-
* Process our Success Message notification
|
66 |
-
*
|
67 |
-
* @access public
|
68 |
-
* @since 2.8
|
69 |
-
* @return void
|
70 |
-
*/
|
71 |
-
public function process( $id ) {
|
72 |
-
global $ninja_forms_processing;
|
73 |
-
|
74 |
-
// We need to get our name setting so that we can use it to create a unique success message ID.
|
75 |
-
$name = Ninja_Forms()->notification( $id )->get_setting( 'name' );
|
76 |
-
// If our name is empty, we need to generate a random string.
|
77 |
-
if ( empty ( $name ) ) {
|
78 |
-
$name = ninja_forms_random_string( 4 );
|
79 |
-
}
|
80 |
-
$success_msg = apply_filters( 'nf_success_msg', Ninja_Forms()->notification( $id )->get_setting( 'success_msg' ), $id );
|
81 |
-
$success_msg = do_shortcode( wpautop( $success_msg ) );
|
82 |
-
$success_msg = nf_parse_fields_shortcode( $success_msg );
|
83 |
-
$ninja_forms_processing->add_success_msg( 'success_msg-' . $name, $success_msg );
|
84 |
-
}
|
85 |
-
}
|
86 |
-
|
87 |
-
return new NF_Notification_Success_Message();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/classes/notification.php
DELETED
@@ -1,170 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
/**
|
3 |
-
* Notification
|
4 |
-
*
|
5 |
-
* Single notification object.
|
6 |
-
* This object lets us call it like: Ninja_Forms()->notification( 33 )->methods()
|
7 |
-
*
|
8 |
-
* @package Ninja Forms
|
9 |
-
* @subpackage Classes/Notifications
|
10 |
-
* @copyright Copyright (c) 2014, WPNINJAS
|
11 |
-
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
12 |
-
* @since 2.8
|
13 |
-
*/
|
14 |
-
|
15 |
-
class NF_Notification
|
16 |
-
{
|
17 |
-
|
18 |
-
/**
|
19 |
-
* @var notification id
|
20 |
-
*/
|
21 |
-
var $id = '';
|
22 |
-
|
23 |
-
/**
|
24 |
-
* @var type
|
25 |
-
*/
|
26 |
-
var $type = '';
|
27 |
-
|
28 |
-
/**
|
29 |
-
* @var active
|
30 |
-
* Holds a boolean value.
|
31 |
-
*/
|
32 |
-
var $active = '';
|
33 |
-
|
34 |
-
/**
|
35 |
-
* @var form_id
|
36 |
-
* Holds the id of our form.
|
37 |
-
*/
|
38 |
-
var $form_id = '';
|
39 |
-
|
40 |
-
|
41 |
-
/**
|
42 |
-
* Get things rolling
|
43 |
-
*
|
44 |
-
* @since 2.8
|
45 |
-
* @return void
|
46 |
-
*/
|
47 |
-
function __construct( $id ) {
|
48 |
-
$this->id = $id;
|
49 |
-
$this->type = nf_get_object_meta_value( $id, 'type' );
|
50 |
-
$this->active = ( nf_get_object_meta_value( $id, 'active' ) == 1 ) ? true : false;
|
51 |
-
$this->form_id = nf_get_object_parent( $id );
|
52 |
-
}
|
53 |
-
|
54 |
-
/**
|
55 |
-
* Ouptut our admin screen
|
56 |
-
*
|
57 |
-
* @access public
|
58 |
-
* @since 2.8
|
59 |
-
* @return void
|
60 |
-
*/
|
61 |
-
public function edit_screen() {
|
62 |
-
$type = $this->type;
|
63 |
-
// Call our type edit screen.
|
64 |
-
Ninja_Forms()->notification_types[ $type ]->edit_screen( $this->id );
|
65 |
-
}
|
66 |
-
|
67 |
-
/**
|
68 |
-
* Delete our notification
|
69 |
-
*
|
70 |
-
* @access public
|
71 |
-
* @since 2.8
|
72 |
-
* @return void
|
73 |
-
*/
|
74 |
-
public function delete() {
|
75 |
-
nf_delete_notification( $this->id );
|
76 |
-
}
|
77 |
-
|
78 |
-
/**
|
79 |
-
* Activate our notification
|
80 |
-
*
|
81 |
-
* @access public
|
82 |
-
* @since 2.8
|
83 |
-
* @return void
|
84 |
-
*/
|
85 |
-
public function activate() {
|
86 |
-
nf_update_object_meta( $this->id, 'active', 1 );
|
87 |
-
$this->active = true;
|
88 |
-
}
|
89 |
-
|
90 |
-
/**
|
91 |
-
* Deactivate our notification
|
92 |
-
*
|
93 |
-
* @access public
|
94 |
-
* @since 2.8
|
95 |
-
* @return void
|
96 |
-
*/
|
97 |
-
public function deactivate() {
|
98 |
-
nf_update_object_meta( $this->id, 'active', 0 );
|
99 |
-
$this->active = false;
|
100 |
-
}
|
101 |
-
|
102 |
-
/**
|
103 |
-
* Duplicate our notification
|
104 |
-
*
|
105 |
-
* @access public
|
106 |
-
* @since 2.8
|
107 |
-
* @return int $n_id
|
108 |
-
*/
|
109 |
-
public function duplicate() {
|
110 |
-
$n_id = Ninja_Forms()->notifications->create( $this->form_id );
|
111 |
-
$meta = nf_get_notification_by_id( $this->id );
|
112 |
-
foreach ( $meta as $meta_key => $meta_value ) {
|
113 |
-
nf_update_object_meta( $n_id, $meta_key, $meta_value );
|
114 |
-
}
|
115 |
-
|
116 |
-
$name = nf_get_object_meta_value( $n_id, 'name' ) . ' - ' . __( 'duplicate', 'ninja-forms' );
|
117 |
-
nf_update_object_meta( $n_id, 'name', $name );
|
118 |
-
}
|
119 |
-
|
120 |
-
/**
|
121 |
-
* Run our notification processing function
|
122 |
-
*
|
123 |
-
* @access public
|
124 |
-
* @since 2.8
|
125 |
-
* @return void
|
126 |
-
*/
|
127 |
-
public function process() {
|
128 |
-
$type = $this->type;
|
129 |
-
if ( isset ( Ninja_Forms()->notification_types[ $type ] ) && is_object( Ninja_Forms()->notification_types[ $type ] ) ) {
|
130 |
-
Ninja_Forms()->notification_types[ $type ]->process( $this->id );
|
131 |
-
}
|
132 |
-
}
|
133 |
-
|
134 |
-
/**
|
135 |
-
* Get a notification setting
|
136 |
-
*
|
137 |
-
* @access public
|
138 |
-
* @since 2.8
|
139 |
-
* @return string $meta_value
|
140 |
-
*/
|
141 |
-
public function get_setting( $meta_key ) {
|
142 |
-
return nf_get_object_meta_value( $this->id, $meta_key );
|
143 |
-
}
|
144 |
-
|
145 |
-
/**
|
146 |
-
* Update a notification setting
|
147 |
-
*
|
148 |
-
* @access public
|
149 |
-
* @since 2.8
|
150 |
-
* @return bool
|
151 |
-
*/
|
152 |
-
public function update_setting( $meta_key, $meta_value ) {
|
153 |
-
nf_update_object_meta( $this->id, $meta_key, $meta_value );
|
154 |
-
return true;
|
155 |
-
}
|
156 |
-
|
157 |
-
/**
|
158 |
-
* Get our notification type name
|
159 |
-
*
|
160 |
-
* @access public
|
161 |
-
* @since 2.9
|
162 |
-
* @return string $name
|
163 |
-
*/
|
164 |
-
public function type_name() {
|
165 |
-
$type = $this->type;
|
166 |
-
// Call our type edit screen.
|
167 |
-
return Ninja_Forms()->notification_types[ $type ]->name;
|
168 |
-
}
|
169 |
-
|
170 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/classes/notifications-table.php
DELETED
@@ -1,427 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
|
3 |
-
/*************************** LOAD THE BASE CLASS *******************************
|
4 |
-
*******************************************************************************
|
5 |
-
* The WP_List_Table class isn't automatically available to plugins, so we need
|
6 |
-
* to check if it's available and load it if necessary. In this tutorial, we are
|
7 |
-
* going to use the WP_List_Table class directly from WordPress core.
|
8 |
-
*
|
9 |
-
* IMPORTANT:
|
10 |
-
* Please note that the WP_List_Table class technically isn't an official API,
|
11 |
-
* and it could change at some point in the distant future. Should that happen,
|
12 |
-
* I will update this plugin with the most current techniques for your reference
|
13 |
-
* immediately.
|
14 |
-
*
|
15 |
-
* If you are really worried about future compatibility, you can make a copy of
|
16 |
-
* the WP_List_Table class (file path is shown just below) to use and distribute
|
17 |
-
* with your plugins. If you do that, just remember to change the name of the
|
18 |
-
* class to avoid conflicts with core.
|
19 |
-
*
|
20 |
-
* Since I will be keeping this tutorial up-to-date for the foreseeable future,
|
21 |
-
* I am going to work with the copy of the class provided in WordPress core.
|
22 |
-
*/
|
23 |
-
if( ! class_exists( 'WP_List_Table' ) ) {
|
24 |
-
require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
|
25 |
-
}
|
26 |
-
|
27 |
-
/************************** CREATE A PACKAGE CLASS *****************************
|
28 |
-
*******************************************************************************
|
29 |
-
* Create a new list table package that extends the core WP_List_Table class.
|
30 |
-
* WP_List_Table contains most of the framework for generating the table, but we
|
31 |
-
* need to define and override some methods so that our data can be displayed
|
32 |
-
* exactly the way we need it to be.
|
33 |
-
*
|
34 |
-
* To display this example on a page, you will first need to instantiate the class,
|
35 |
-
* then call $yourInstance->prepare_items() to handle any data manipulation, then
|
36 |
-
* finally call $yourInstance->display() to render the table to the page.
|
37 |
-
*
|
38 |
-
* Our theme for this list table is going to be movies.
|
39 |
-
*/
|
40 |
-
class NF_Notifications_List_Table extends WP_List_Table {
|
41 |
-
|
42 |
-
/**
|
43 |
-
* @var form_id
|
44 |
-
*/
|
45 |
-
var $form_id = '';
|
46 |
-
|
47 |
-
/** ************************************************************************
|
48 |
-
* REQUIRED. Set up a constructor that references the parent constructor. We
|
49 |
-
* use the parent reference to set some default configs.
|
50 |
-
***************************************************************************/
|
51 |
-
function __construct(){
|
52 |
-
global $status, $page;
|
53 |
-
|
54 |
-
//Set parent defaults
|
55 |
-
parent::__construct( array(
|
56 |
-
'singular' => 'notification', //singular name of the listed records
|
57 |
-
'plural' => 'notifications', //plural name of the listed records
|
58 |
-
'ajax' => false //does this table support ajax?
|
59 |
-
) );
|
60 |
-
|
61 |
-
$this->form_id = isset ( $_REQUEST['form_id'] ) ? absint( $_REQUEST['form_id'] ) : '';
|
62 |
-
|
63 |
-
}
|
64 |
-
|
65 |
-
/** ************************************************************************
|
66 |
-
* Recommended. This method is called when the parent class can't find a method
|
67 |
-
* specifically build for a given column. Generally, it's recommended to include
|
68 |
-
* one method for each column you want to render, keeping your package class
|
69 |
-
* neat and organized. For example, if the class needs to process a column
|
70 |
-
* named 'title', it would first see if a method named $this->column_title()
|
71 |
-
* exists - if it does, that method will be used. If it doesn't, this one will
|
72 |
-
* be used. Generally, you should try to use custom column methods as much as
|
73 |
-
* possible.
|
74 |
-
*
|
75 |
-
* Since we have defined a column_title() method later on, this method doesn't
|
76 |
-
* need to concern itself with any column with a name of 'title'. Instead, it
|
77 |
-
* needs to handle everything else.
|
78 |
-
*
|
79 |
-
* For more detailed insight into how columns are handled, take a look at
|
80 |
-
* WP_List_Table::single_row_columns()
|
81 |
-
*
|
82 |
-
* @param array $item A singular item (one full row's worth of data)
|
83 |
-
* @param array $column_name The name/slug of the column to be processed
|
84 |
-
* @return string Text or HTML to be placed inside the column <td>
|
85 |
-
**************************************************************************/
|
86 |
-
public function column_default($item, $column_name){
|
87 |
-
switch($column_name){
|
88 |
-
case 'type':
|
89 |
-
return Ninja_Forms()->notification( $item['id'] )->type_name();
|
90 |
-
case 'date_updated':
|
91 |
-
return $item[$column_name];
|
92 |
-
default:
|
93 |
-
return print_r($item,true); //Show the whole array for troubleshooting purposes
|
94 |
-
}
|
95 |
-
}
|
96 |
-
|
97 |
-
/** ************************************************************************
|
98 |
-
* Recommended. This is a custom column method and is responsible for what
|
99 |
-
* is rendered in any column with a name/slug of 'title'. Every time the class
|
100 |
-
* needs to render a column, it first looks for a method named
|
101 |
-
* column_{$column_title} - if it exists, that method is run. If it doesn't
|
102 |
-
* exist, column_default() is called instead.
|
103 |
-
*
|
104 |
-
* This example also illustrates how to implement rollover actions. Actions
|
105 |
-
* should be an associative array formatted as 'slug'=>'link html' - and you
|
106 |
-
* will need to generate the URLs yourself. You could even ensure the links
|
107 |
-
*
|
108 |
-
*
|
109 |
-
* @see WP_List_Table::::single_row_columns()
|
110 |
-
* @param array $item A singular item (one full row's worth of data)
|
111 |
-
* @return string Text to be placed inside the column <td> (movie title only)
|
112 |
-
**************************************************************************/
|
113 |
-
public function column_name( $item ){
|
114 |
-
|
115 |
-
$base_url = esc_url_raw( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ) ) );
|
116 |
-
|
117 |
-
$activate_text = ( Ninja_Forms()->notification( $item['id'] )->active ) ? __( 'Deactivate', 'ninja-forms' ) : __( 'Activate', 'ninja-forms' );
|
118 |
-
|
119 |
-
$activate_action = ( Ninja_Forms()->notification( $item['id'] )->active ) ? 'deactivate' : 'activate';
|
120 |
-
|
121 |
-
$activate_url = esc_url( add_query_arg( array( 'notification-action' => $activate_action, 'id' => $item['id'] ), $base_url ) );
|
122 |
-
$edit_url = esc_url( add_query_arg( array( 'notification-action' => 'edit', 'id' => $item['id'] ), $base_url ) );
|
123 |
-
$delete_url = esc_url( add_query_arg( array( 'action' => 'delete' ), $base_url ) );
|
124 |
-
$duplicate_url = esc_url( add_query_arg( array( 'notification-action' => 'duplicate', 'id' => $item['id'] ), $base_url ) );
|
125 |
-
|
126 |
-
//Build row actions
|
127 |
-
$actions = array(
|
128 |
-
'active' => '<a href="' . $activate_url . '" class="notification-activate" data-action="' . $activate_action . '" data-n_id="' . $item['id'] . '">' . $activate_text . '</a>',
|
129 |
-
'edit' => '<a href="' . $edit_url . '">' . __( 'Edit', 'ninja-forms' ) . '</a>',
|
130 |
-
'delete' => '<a href="' . $delete_url .'" class="notification-delete" data-n_id="' . $item['id'] . '">' . __( 'Delete', 'ninja-forms' ) . '</a>',
|
131 |
-
'duplicate' => '<a href="' . $duplicate_url .'">' . __( 'Duplicate', 'ninja-forms' ) . '</a>',
|
132 |
-
);
|
133 |
-
|
134 |
-
//Return the title contents
|
135 |
-
return sprintf( '<a href="%1$s">%2$s</a> %3$s',
|
136 |
-
/*$1%s*/ $edit_url,
|
137 |
-
/*$2%s*/ $item['name'],
|
138 |
-
/*$3%s*/ $this->row_actions($actions)
|
139 |
-
);
|
140 |
-
}
|
141 |
-
|
142 |
-
/** ************************************************************************
|
143 |
-
* REQUIRED if displaying checkboxes or using bulk actions! The 'cb' column
|
144 |
-
* is given special treatment when columns are processed. It ALWAYS needs to
|
145 |
-
* have it's own method.
|
146 |
-
*
|
147 |
-
* @see WP_List_Table::::single_row_columns()
|
148 |
-
* @param array $item A singular item (one full row's worth of data)
|
149 |
-
* @return string Text to be placed inside the column <td> (movie title only)
|
150 |
-
**************************************************************************/
|
151 |
-
public function column_cb($item){
|
152 |
-
return sprintf(
|
153 |
-
'<input type="checkbox" name="%1$s[]" value="%2$s" />',
|
154 |
-
/*$1%s*/ $this->_args['singular'], //Let's simply repurpose the table's singular label ("movie")
|
155 |
-
/*$2%s*/ $item['id'] //The value of the checkbox should be the record's id
|
156 |
-
);
|
157 |
-
}
|
158 |
-
|
159 |
-
/** ************************************************************************
|
160 |
-
* REQUIRED! This method dictates the table's columns and titles. This should
|
161 |
-
* return an array where the key is the column slug (and class) and the value
|
162 |
-
* is the column's title text. If you need a checkbox for bulk actions, refer
|
163 |
-
* to the $columns array below.
|
164 |
-
*
|
165 |
-
* The 'cb' column is treated differently than the rest. If including a checkbox
|
166 |
-
* column in your table you must create a column_cb() method. If you don't need
|
167 |
-
* bulk actions or checkboxes, simply leave the 'cb' entry out of your array.
|
168 |
-
*
|
169 |
-
* @see WP_List_Table::::single_row_columns()
|
170 |
-
* @return array An associative array containing column information: 'slugs'=>'Visible Titles'
|
171 |
-
**************************************************************************/
|
172 |
-
public function get_columns(){
|
173 |
-
$columns = array(
|
174 |
-
'cb' => '<input type="checkbox" />', //Render a checkbox instead of text
|
175 |
-
'name' => __( 'Name', 'ninja-forms' ),
|
176 |
-
'type' => __( 'Type', 'ninja-forms' ),
|
177 |
-
'date_updated' => __( 'Date Updated', 'ninja-forms' ),
|
178 |
-
);
|
179 |
-
return $columns;
|
180 |
-
}
|
181 |
-
|
182 |
-
/** ************************************************************************
|
183 |
-
* Optional. If you want one or more columns to be sortable (ASC/DESC toggle),
|
184 |
-
* you will need to register it here. This should return an array where the
|
185 |
-
* key is the column that needs to be sortable, and the value is db column to
|
186 |
-
* sort by. Often, the key and value will be the same, but this is not always
|
187 |
-
* the case (as the value is a column name from the database, not the list table).
|
188 |
-
*
|
189 |
-
* This method merely defines which columns should be sortable and makes them
|
190 |
-
* clickable - it does not handle the actual sorting. You still need to detect
|
191 |
-
* the ORDERBY and ORDER querystring variables within prepare_items() and sort
|
192 |
-
* your data accordingly (usually by modifying your query).
|
193 |
-
*
|
194 |
-
* @return array An associative array containing all the columns that should be sortable: 'slugs'=>array('data_values',bool)
|
195 |
-
**************************************************************************/
|
196 |
-
public function get_sortable_columns() {
|
197 |
-
$sortable_columns = array(
|
198 |
-
'name' => array( 'name',false ), //true means it's already sorted
|
199 |
-
'type' => array( 'type',false ),
|
200 |
-
'date_updated' => array( 'date_updated',false )
|
201 |
-
);
|
202 |
-
return $sortable_columns;
|
203 |
-
}
|
204 |
-
|
205 |
-
/** ************************************************************************
|
206 |
-
* Optional. If you need to include bulk actions in your list table, this is
|
207 |
-
* the place to define them. Bulk actions are an associative array in the format
|
208 |
-
* 'slug'=>'Visible Title'
|
209 |
-
*
|
210 |
-
* If this method returns an empty value, no bulk action will be rendered. If
|
211 |
-
* you specify any bulk actions, the bulk actions box will be rendered with
|
212 |
-
* the table automatically on display().
|
213 |
-
*
|
214 |
-
* Also note that list tables are not automatically wrapped in <form> elements,
|
215 |
-
* so you will need to create those manually in order for bulk actions to function.
|
216 |
-
*
|
217 |
-
* @return array An associative array containing all the bulk actions: 'slugs'=>'Visible Titles'
|
218 |
-
**************************************************************************/
|
219 |
-
public function get_bulk_actions() {
|
220 |
-
$actions = array(
|
221 |
-
'activate' => __( 'Activate', 'ninja-forms' ),
|
222 |
-
'deactivate' => __( 'Deactivate', 'ninja-forms' ),
|
223 |
-
'delete' => __( 'Delete', 'ninja-forms' ),
|
224 |
-
);
|
225 |
-
return $actions;
|
226 |
-
}
|
227 |
-
|
228 |
-
public function extra_tablenav( $which ) {
|
229 |
-
if ( $which == 'bottom' )
|
230 |
-
return false;
|
231 |
-
|
232 |
-
if ( isset ( $_REQUEST['type'] ) ) {
|
233 |
-
$type = esc_html( $_REQUEST['type'] );
|
234 |
-
} else {
|
235 |
-
$type = '';
|
236 |
-
}
|
237 |
-
|
238 |
-
?>
|
239 |
-
<div class="alignleft actions">
|
240 |
-
<select name="type" id="filter-type">
|
241 |
-
<option value="" <?php selected( $type, '' ); ?>><?php _e( '- View All Types', 'ninja-forms' ); ?></option>
|
242 |
-
<?php
|
243 |
-
foreach ( Ninja_Forms()->notifications->get_types() as $slug => $nicename ) {
|
244 |
-
?>
|
245 |
-
<option value="<?php echo $slug; ?>" <?php selected( $type, $slug ); ?>><?php echo $nicename; ?></option>
|
246 |
-
<?php
|
247 |
-
}
|
248 |
-
?>
|
249 |
-
</select>
|
250 |
-
<span class="nf-more-actions"><a href="<?php echo nf_aff_link( 'https://ninjaforms.com/extensions/?display=actions&utm_medium=plugin&utm_source=actions-table&utm_campaign=Ninja+Forms+Upsell&utm_content=Ninja+Forms+Actions' ); ?>" target="_blank"><?php _e( 'Get More Types', 'ninja-forms' ); ?> <span class="dashicons dashicons-external"></span></a></span>
|
251 |
-
<span style="float:left;" class="spinner"></span>
|
252 |
-
</div>
|
253 |
-
<?php
|
254 |
-
}
|
255 |
-
|
256 |
-
/**
|
257 |
-
* Generates content for a single row of the table
|
258 |
-
*
|
259 |
-
* @since 3.1.0
|
260 |
-
* @access protected
|
261 |
-
*
|
262 |
-
* @param object $item The current item
|
263 |
-
*/
|
264 |
-
function single_row( $item ) {
|
265 |
-
static $alternate = '';
|
266 |
-
|
267 |
-
$active = ( Ninja_Forms()->notification( $item['id'] )->active ) ? 'nf-notification-active ' : 'nf-notification-inactive';
|
268 |
-
$alternate = ( $alternate == '' ? 'alternate' : '' );
|
269 |
-
|
270 |
-
echo '<tr class="' . $active . ' ' . $alternate . '" id="' . $item['id'] . '">';
|
271 |
-
$this->single_row_columns( $item );
|
272 |
-
echo '</tr>';
|
273 |
-
}
|
274 |
-
|
275 |
-
/** ************************************************************************
|
276 |
-
* REQUIRED! This is where you prepare your data for display. This method will
|
277 |
-
* usually be used to query the database, sort and filter the data, and generally
|
278 |
-
* get it ready to be displayed. At a minimum, we should set $this->items and
|
279 |
-
* $this->set_pagination_args(), although the following properties and methods
|
280 |
-
* are frequently interacted with here...
|
281 |
-
*
|
282 |
-
* @global WPDB $wpdb
|
283 |
-
* @uses $this->_column_headers
|
284 |
-
* @uses $this->items
|
285 |
-
* @uses $this->get_columns()
|
286 |
-
* @uses $this->get_sortable_columns()
|
287 |
-
* @uses $this->get_pagenum()
|
288 |
-
* @uses $this->set_pagination_args()
|
289 |
-
**************************************************************************/
|
290 |
-
public function prepare_items() {
|
291 |
-
global $wpdb; //This is used only if making any database queries
|
292 |
-
|
293 |
-
/**
|
294 |
-
* First, lets decide how many records per page to show
|
295 |
-
*/
|
296 |
-
$per_page = 99999;
|
297 |
-
|
298 |
-
|
299 |
-
/**
|
300 |
-
* REQUIRED. Now we need to define our column headers. This includes a complete
|
301 |
-
* array of columns to be displayed (slugs & titles), a list of columns
|
302 |
-
* to keep hidden, and a list of columns that are sortable. Each of these
|
303 |
-
* can be defined in another method (as we've done here) before being
|
304 |
-
* used to build the value for our _column_headers property.
|
305 |
-
*/
|
306 |
-
$columns = $this->get_columns();
|
307 |
-
$hidden = array();
|
308 |
-
$sortable = $this->get_sortable_columns();
|
309 |
-
|
310 |
-
|
311 |
-
/**
|
312 |
-
* REQUIRED. Finally, we build an array to be used by the class for column
|
313 |
-
* headers. The $this->_column_headers property takes an array which contains
|
314 |
-
* 3 other arrays. One for all columns, one for hidden columns, and one
|
315 |
-
* for sortable columns.
|
316 |
-
*/
|
317 |
-
$this->_column_headers = array($columns, $hidden, $sortable);
|
318 |
-
|
319 |
-
|
320 |
-
/**
|
321 |
-
* Optional. You can handle your bulk actions however you see fit. In this
|
322 |
-
* case, we'll handle them within our package just to keep things clean.
|
323 |
-
*/
|
324 |
-
//$this->process_bulk_action();
|
325 |
-
|
326 |
-
|
327 |
-
/**
|
328 |
-
* Instead of querying a database, we're going to fetch the example data
|
329 |
-
* property we created for use in this plugin. This makes this example
|
330 |
-
* package slightly different than one you might build on your own. In
|
331 |
-
* this example, we'll be using array manipulation to sort and paginate
|
332 |
-
* our data. In a real-world implementation, you will probably want to
|
333 |
-
* use sort and pagination data to build a custom query instead, as you'll
|
334 |
-
* be able to use your precisely-queried data immediately.
|
335 |
-
*/
|
336 |
-
$notifications = nf_get_notifications_by_form_id( $this->form_id );
|
337 |
-
$data = array();
|
338 |
-
|
339 |
-
if ( is_array( $notifications ) ) {
|
340 |
-
foreach ( $notifications as $id => $n ) {
|
341 |
-
if ( isset ( $_REQUEST['type'] ) && ! empty( $_REQUEST['type'] ) ) {
|
342 |
-
if ( nf_get_object_meta_value( $id, 'type' ) == esc_html( $_REQUEST['type'] ) ) {
|
343 |
-
$n['id'] = $id;
|
344 |
-
$data[] = $n;
|
345 |
-
}
|
346 |
-
} else {
|
347 |
-
$n['id'] = $id;
|
348 |
-
$data[] = $n;
|
349 |
-
}
|
350 |
-
|
351 |
-
}
|
352 |
-
}
|
353 |
-
|
354 |
-
/**
|
355 |
-
* This checks for sorting input and sorts the data in our array accordingly.
|
356 |
-
*
|
357 |
-
* In a real-world situation involving a database, you would probably want
|
358 |
-
* to handle sorting by passing the 'orderby' and 'order' values directly
|
359 |
-
* to a custom query. The returned data will be pre-sorted, and this array
|
360 |
-
* sorting technique would be unnecessary.
|
361 |
-
*/
|
362 |
-
function usort_reorder($a,$b){
|
363 |
-
$orderby = (!empty($_REQUEST['orderby'])) ? esc_html( $_REQUEST['orderby'] ) : 'name'; //If no sort, default to title
|
364 |
-
$order = (!empty($_REQUEST['order'])) ? esc_html( $_REQUEST['order'] ) : 'asc'; //If no order, default to asc
|
365 |
-
$result = strcmp($a[$orderby], $b[$orderby]); //Determine sort order
|
366 |
-
return ($order==='asc') ? $result : -$result; //Send final sort direction to usort
|
367 |
-
}
|
368 |
-
usort($data, 'usort_reorder');
|
369 |
-
|
370 |
-
|
371 |
-
/***********************************************************************
|
372 |
-
* ---------------------------------------------------------------------
|
373 |
-
* vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
|
374 |
-
*
|
375 |
-
* In a real-world situation, this is where you would place your query.
|
376 |
-
*
|
377 |
-
* For information on making queries in WordPress, see this Codex entry:
|
378 |
-
* http://codex.wordpress.org/Class_Reference/wpdb
|
379 |
-
*
|
380 |
-
* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
381 |
-
* ---------------------------------------------------------------------
|
382 |
-
**********************************************************************/
|
383 |
-
|
384 |
-
|
385 |
-
/**
|
386 |
-
* REQUIRED for pagination. Let's figure out what page the user is currently
|
387 |
-
* looking at. We'll need this later, so you should always include it in
|
388 |
-
* your own package classes.
|
389 |
-
*/
|
390 |
-
$current_page = $this->get_pagenum();
|
391 |
-
|
392 |
-
/**
|
393 |
-
* REQUIRED for pagination. Let's check how many items are in our data array.
|
394 |
-
* In real-world use, this would be the total number of items in your database,
|
395 |
-
* without filtering. We'll need this later, so you should always include it
|
396 |
-
* in your own package classes.
|
397 |
-
*/
|
398 |
-
$total_items = count($data);
|
399 |
-
|
400 |
-
|
401 |
-
/**
|
402 |
-
* The WP_List_Table class does not handle pagination for us, so we need
|
403 |
-
* to ensure that the data is trimmed to only the current page. We can use
|
404 |
-
* array_slice() to
|
405 |
-
*/
|
406 |
-
$data = array_slice($data,(($current_page-1)*$per_page),$per_page);
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
/**
|
411 |
-
* REQUIRED. Now we can add our *sorted* data to the items property, where
|
412 |
-
* it can be used by the rest of the class.
|
413 |
-
*/
|
414 |
-
$this->items = $data;
|
415 |
-
|
416 |
-
|
417 |
-
/**
|
418 |
-
* REQUIRED. We also have to register our pagination options & calculations.
|
419 |
-
*/
|
420 |
-
$this->set_pagination_args( array(
|
421 |
-
'total_items' => $total_items, //WE have to calculate the total number of items
|
422 |
-
'per_page' => $per_page, //WE have to determine how many items to show on a page
|
423 |
-
'total_pages' => ceil($total_items/$per_page) //WE have to calculate the total number of pages
|
424 |
-
) );
|
425 |
-
}
|
426 |
-
|
427 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/classes/notifications.php
DELETED
@@ -1,540 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
/**
|
3 |
-
* Main Notifications Class
|
4 |
-
*
|
5 |
-
* Adds our notifications to the form edit page.
|
6 |
-
* Gets notification types
|
7 |
-
* Listens for ajax commands to delete/activate/deactivate notifications
|
8 |
-
* Listens for bulk actions from the notifications admin page
|
9 |
-
* Adds notification types processing to the appropriate action hook
|
10 |
-
*
|
11 |
-
* @package Ninja Forms
|
12 |
-
* @subpackage Classes/Notifications
|
13 |
-
* @copyright Copyright (c) 2014, WPNINJAS
|
14 |
-
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
15 |
-
* @since 2.8
|
16 |
-
*/
|
17 |
-
|
18 |
-
class NF_Notifications
|
19 |
-
{
|
20 |
-
/**
|
21 |
-
* Get things rolling
|
22 |
-
*
|
23 |
-
* @access public
|
24 |
-
*
|
25 |
-
* @since 2.8
|
26 |
-
*/
|
27 |
-
function __construct() {
|
28 |
-
global $pagenow;
|
29 |
-
|
30 |
-
// Register our notification types
|
31 |
-
Ninja_Forms()->notification_types['email'] = require_once( NF_PLUGIN_DIR . 'classes/notification-email.php' );
|
32 |
-
Ninja_Forms()->notification_types['redirect'] = require_once( NF_PLUGIN_DIR . 'classes/notification-redirect.php' );
|
33 |
-
Ninja_Forms()->notification_types['success_message'] = require_once( NF_PLUGIN_DIR . 'classes/notification-success-message.php' );
|
34 |
-
|
35 |
-
Ninja_Forms()->notification_types = apply_filters( 'nf_notification_types', Ninja_Forms()->notification_types );
|
36 |
-
|
37 |
-
// Register our notification tab
|
38 |
-
add_action( 'admin_init', array( $this, 'register_tab' ) );
|
39 |
-
|
40 |
-
// Only add these actions if we are actually on the notification tab.
|
41 |
-
if ( 'admin.php' == $pagenow && isset ( $_REQUEST['page'] ) && $_REQUEST['page'] == 'ninja-forms' && isset ( $_REQUEST['tab'] ) && $_REQUEST['tab'] == 'notifications' ) {
|
42 |
-
add_action( 'admin_init', array( $this, 'add_js' ) );
|
43 |
-
add_action( 'admin_init', array( $this, 'add_css' ) );
|
44 |
-
add_action( 'admin_init', array( $this, 'bulk_actions' ) );
|
45 |
-
add_action( 'admin_init', array( $this, 'duplicate_notification' ) );
|
46 |
-
add_filter( 'media_buttons_context', array( $this, 'tinymce_buttons' ) );
|
47 |
-
}
|
48 |
-
|
49 |
-
add_action( 'wp_ajax_nf_delete_notification', array( $this, 'delete_notification' ) );
|
50 |
-
add_action( 'wp_ajax_nf_activate_notification', array( $this, 'activate_notification' ) );
|
51 |
-
add_action( 'wp_ajax_nf_deactivate_notification', array( $this, 'deactivate_notification' ) );
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
// Add our hook to add notification types processors.
|
56 |
-
add_action( 'ninja_forms_post_process', array( $this, 'notification_processing' ), 999 );
|
57 |
-
}
|
58 |
-
|
59 |
-
/**
|
60 |
-
* Register our setting tab.
|
61 |
-
*
|
62 |
-
* @access public
|
63 |
-
*
|
64 |
-
* @since 2.8
|
65 |
-
* @return void
|
66 |
-
*/
|
67 |
-
public function register_tab() {
|
68 |
-
$form_id = isset ( $_REQUEST['form_id'] ) ? absint( $_REQUEST['form_id'] ) : '';
|
69 |
-
$action = isset ( $_REQUEST['notification-action'] ) ? esc_html( $_REQUEST['notification-action'] ) : '';
|
70 |
-
$output_form = false;
|
71 |
-
$show_save = false;
|
72 |
-
if ( 'edit' == $action || 'new' == $action ) {
|
73 |
-
$output_form = true;
|
74 |
-
$show_save = true;
|
75 |
-
}
|
76 |
-
|
77 |
-
$args = array(
|
78 |
-
'name' => __( 'Email & Actions', 'ninja-forms' ),
|
79 |
-
'page' => 'ninja-forms',
|
80 |
-
'display_function' => array( $this, 'output_admin' ),
|
81 |
-
'save_function' => array( $this, 'save_admin' ),
|
82 |
-
'disable_no_form_id' => true,
|
83 |
-
'show_save' => $show_save,
|
84 |
-
'tab_reload' => true,
|
85 |
-
'output_form' => $output_form,
|
86 |
-
);
|
87 |
-
|
88 |
-
ninja_forms_register_tab( 'notifications', $args );
|
89 |
-
}
|
90 |
-
|
91 |
-
/**
|
92 |
-
* Enqueue JS
|
93 |
-
*
|
94 |
-
* @access public
|
95 |
-
* @since 2.8
|
96 |
-
* @return void
|
97 |
-
*/
|
98 |
-
public function add_js() {
|
99 |
-
global $ninja_forms_fields;
|
100 |
-
|
101 |
-
$form_id = isset ( $_REQUEST['form_id'] ) ? absint( $_REQUEST['form_id'] ) : '';
|
102 |
-
if ( empty ( $form_id ) )
|
103 |
-
return false;
|
104 |
-
|
105 |
-
if ( defined( 'NINJA_FORMS_JS_DEBUG' ) && NINJA_FORMS_JS_DEBUG ) {
|
106 |
-
$suffix = '';
|
107 |
-
$src = 'dev';
|
108 |
-
} else {
|
109 |
-
$suffix = '.min';
|
110 |
-
$src = 'min';
|
111 |
-
}
|
112 |
-
|
113 |
-
wp_enqueue_script( 'nf-notifications',
|
114 |
-
NF_PLUGIN_URL . 'assets/js/' . $src .'/notifications' . $suffix . '.js',
|
115 |
-
array( 'jquery', 'jquery-ui-autocomplete' ) );
|
116 |
-
|
117 |
-
wp_enqueue_script( 'nf-tokenize',
|
118 |
-
NF_PLUGIN_URL . 'assets/js/' . $src .'/bootstrap-tokenfield' . $suffix . '.js',
|
119 |
-
array( 'jquery', 'jquery-ui-autocomplete' ) );
|
120 |
-
|
121 |
-
wp_enqueue_script( 'nf-combobox',
|
122 |
-
NF_PLUGIN_URL . 'assets/js/' . $src .'/combobox' . $suffix . '.js',
|
123 |
-
array( 'jquery', 'jquery-ui-core', 'jquery-ui-button', 'jquery-ui-autocomplete' ) );
|
124 |
-
|
125 |
-
$all_fields = Ninja_Forms()->form( $form_id )->fields;
|
126 |
-
$process_fields = array();
|
127 |
-
$search_fields = array();
|
128 |
-
$search_fields['email'] = array();
|
129 |
-
$search_fields['name'] = array();
|
130 |
-
$fields = array();
|
131 |
-
// Generate our search fields JS var.
|
132 |
-
foreach( $all_fields as $field_id => $field ) {
|
133 |
-
$label = esc_attr( nf_get_field_admin_label( $field_id ) );
|
134 |
-
|
135 |
-
$fields[ $field_id ] = array( 'field_id' => $field_id, 'label' => $label );
|
136 |
-
|
137 |
-
if ( strlen( $label ) > 30 ) {
|
138 |
-
$tmp_label = substr( $label, 0, 30 );
|
139 |
-
} else {
|
140 |
-
$tmp_label = $label;
|
141 |
-
}
|
142 |
-
|
143 |
-
$tmp_array = array( 'value' => 'field_' . $field_id, 'label' => $tmp_label . ' - ID: ' . $field_id );
|
144 |
-
|
145 |
-
$admin_label = $label;
|
146 |
-
|
147 |
-
$label = isset( $field['data']['label'] ) ? $field['data']['label'] : '';
|
148 |
-
|
149 |
-
// Check to see if this field is supposed to be "processed"
|
150 |
-
$type = $field['type'];
|
151 |
-
if ( isset ( $ninja_forms_fields[ $type ]['process_field'] ) && $ninja_forms_fields[ $type ]['process_field'] ) {
|
152 |
-
$process_fields[ $field_id ] = array( 'field_id' => $field_id, 'label' => $label, 'admin_label' => $admin_label );
|
153 |
-
$search_fields['all'][] = $tmp_array;
|
154 |
-
}
|
155 |
-
|
156 |
-
if ( $field['type'] == '_text' && isset ( $field['data']['email'] ) && $field['data']['email'] == 1 ) {
|
157 |
-
$search_fields['email'][] = $tmp_array;
|
158 |
-
} else if ( $field['type'] == '_text' && isset ( $field['data']['first_name'] ) && $field['data']['first_name'] == 1 ) {
|
159 |
-
$search_fields['name'][] = $tmp_array;
|
160 |
-
} else if ( $field['type'] == '_text' && isset ( $field['data']['last_name'] ) && $field['data']['last_name'] == 1 ) {
|
161 |
-
$search_fields['name'][] = $tmp_array;
|
162 |
-
}
|
163 |
-
}
|
164 |
-
|
165 |
-
// Add our "process_fields" to our form global
|
166 |
-
Ninja_Forms()->form( $form_id )->process_fields = $process_fields;
|
167 |
-
|
168 |
-
$js_vars = apply_filters( 'nf_notification_admin_js_vars', array(
|
169 |
-
'activate' => __( 'Activate', 'ninja-forms' ),
|
170 |
-
'deactivate' => __( 'Deactivate', 'ninja-forms' ),
|
171 |
-
'search_fields' => $search_fields,
|
172 |
-
'tokens' => array(),
|
173 |
-
'all_fields' => $fields,
|
174 |
-
'process_fields' => $process_fields,
|
175 |
-
'filter_type' => esc_url_raw( remove_query_arg( array( 'type' ) ) ),
|
176 |
-
) );
|
177 |
-
|
178 |
-
wp_localize_script( 'nf-notifications', 'nf_notifications', $js_vars );
|
179 |
-
|
180 |
-
}
|
181 |
-
|
182 |
-
/**
|
183 |
-
* Enqueue CSS
|
184 |
-
*
|
185 |
-
* @access public
|
186 |
-
* @since 2.8
|
187 |
-
* @return void
|
188 |
-
*/
|
189 |
-
public function add_css() {
|
190 |
-
wp_enqueue_style( 'nf-notifications',
|
191 |
-
NF_PLUGIN_URL . 'assets/css/notifications.css' );
|
192 |
-
|
193 |
-
wp_enqueue_style( 'nf-tokenize',
|
194 |
-
NF_PLUGIN_URL . 'assets/css/bootstrap-tokenfield.css' );
|
195 |
-
|
196 |
-
wp_enqueue_style( 'nf-combobox',
|
197 |
-
NF_PLUGIN_URL . 'assets/css/combobox.css' );
|
198 |
-
|
199 |
-
// wp_enqueue_style( 'nf-bootstrap',
|
200 |
-
// 'http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css' );
|
201 |
-
}
|
202 |
-
|
203 |
-
/**
|
204 |
-
* Output our notifications admin.
|
205 |
-
*
|
206 |
-
* @access public
|
207 |
-
*
|
208 |
-
* @since 2.8
|
209 |
-
* @return void
|
210 |
-
*/
|
211 |
-
public function output_admin() {
|
212 |
-
$action = isset ( $_REQUEST['notification-action'] ) ? esc_html( $_REQUEST['notification-action'] ) : '';
|
213 |
-
|
214 |
-
?>
|
215 |
-
<div class="wrap">
|
216 |
-
<?php
|
217 |
-
if ( '' == $action ) {
|
218 |
-
?>
|
219 |
-
<h2><?php _e( 'Email & Actions', 'ninja-forms' ); ?> <a href="<?php echo esc_url( add_query_arg( array( 'notification-action' => 'new' ) ) ); ?>" class="add-new-h2"><?php _e( 'Add New', 'ninja-forms' );?></a></h2>
|
220 |
-
|
221 |
-
<!-- Forms are NOT created automatically, so you need to wrap the table in one to use features like bulk actions -->
|
222 |
-
<form id="forms-filter" method="get">
|
223 |
-
<!-- For plugins, we also need to ensure that the form posts back to our current page -->
|
224 |
-
<input type="hidden" name="page" value="<?php echo esc_attr( $_REQUEST['page'] ); ?>" />
|
225 |
-
<input type="hidden" name="tab" value="<?php echo esc_attr( $_REQUEST['tab'] ); ?>" />
|
226 |
-
<input type="hidden" name="form_id" value="<?php echo esc_attr( $_REQUEST['form_id'] ); ?>" />
|
227 |
-
<?php
|
228 |
-
//Create an instance of our package class...
|
229 |
-
$nf_all_forms = new NF_Notifications_List_Table();
|
230 |
-
//Fetch, prepare, sort, and filter our data...
|
231 |
-
$nf_all_forms->prepare_items();
|
232 |
-
// Now we can render the completed list table
|
233 |
-
$nf_all_forms->display();
|
234 |
-
?>
|
235 |
-
</form>
|
236 |
-
<?php
|
237 |
-
} else {
|
238 |
-
$id = isset ( $_REQUEST['id'] ) ? absint( $_REQUEST['id'] ) : '';
|
239 |
-
if ( $id == '' ) {
|
240 |
-
$id = 'new';
|
241 |
-
$this_type = 'email';
|
242 |
-
$title = __( 'New Action', 'ninja-forms' );
|
243 |
-
} else {
|
244 |
-
$this_type = Ninja_Forms()->notification( $id )->type;
|
245 |
-
$title = __( 'Edit Action', 'ninja-forms' ) . ' - ID ' . $id;
|
246 |
-
}
|
247 |
-
|
248 |
-
?>
|
249 |
-
<h2><?php echo $title; ?> <a href="<?php echo esc_url( remove_query_arg( array( 'notification-action', 'id', 'update_message' ) ) );?>" class="button-secondary"><?php _e( 'Back To List', 'ninja-forms' );?></a></h2>
|
250 |
-
|
251 |
-
<input type="hidden" id="notification_id" name="notification_id" value="<?php echo $id; ?>" />
|
252 |
-
<table class="form-table">
|
253 |
-
<tbody id="notification-main">
|
254 |
-
<tr>
|
255 |
-
<th scope="row"><label for="setting-name"><?php _e( 'Action Name', 'ninja-forms' ); ?></label></th>
|
256 |
-
<td><input name="settings[name]" type="text" id="settings-name" value="<?php echo nf_get_object_meta_value( $id, 'name' ); ?>" class="regular-text"></td>
|
257 |
-
</tr>
|
258 |
-
<tr>
|
259 |
-
<th scope="row"><label for="type"><?php _e( 'Type', 'ninja-forms' ); ?></label></th>
|
260 |
-
<td>
|
261 |
-
<select name="settings[type]" id="settings-type">
|
262 |
-
<?php
|
263 |
-
foreach ( $this->get_types() as $slug => $nicename ) {
|
264 |
-
?>
|
265 |
-
<option value="<?php echo $slug; ?>" <?php selected ( $this_type, $slug ); ?>><?php echo $nicename; ?></option>
|
266 |
-
<?php
|
267 |
-
}
|
268 |
-
?>
|
269 |
-
</select>
|
270 |
-
<span class="nf-more-actions"><a href="<?php echo nf_aff_link( 'https://ninjaforms.com/extensions/?display=actions&utm_medium=plugin&utm_source=action-single&utm_campaign=Ninja+Forms+Upsell&utm_content=Ninja+Forms+Actions' ); ?>" target="_blank"><?php _e( 'Get More Actions', 'ninja-forms' ); ?> <span class="dashicons dashicons-external"></span></a></span>
|
271 |
-
</td>
|
272 |
-
</tr>
|
273 |
-
</tbody>
|
274 |
-
<?php
|
275 |
-
do_action( 'nf_edit_notification_settings', $id );
|
276 |
-
foreach ( $this->get_types() as $slug => $nicename ) {
|
277 |
-
if ( $this_type == $slug ) {
|
278 |
-
$display = '';
|
279 |
-
} else {
|
280 |
-
$display = 'display:none;';
|
281 |
-
}
|
282 |
-
?>
|
283 |
-
<tbody id="notification-<?php echo $slug; ?>" class="notification-type" style="<?php echo $display;?>">
|
284 |
-
<?php
|
285 |
-
// Call our type edit screen.
|
286 |
-
Ninja_Forms()->notification_types[ $slug ]->edit_screen( $id );
|
287 |
-
?>
|
288 |
-
</tbody>
|
289 |
-
<?php
|
290 |
-
}
|
291 |
-
?>
|
292 |
-
</table>
|
293 |
-
<?php
|
294 |
-
} ?>
|
295 |
-
|
296 |
-
</div>
|
297 |
-
<?php
|
298 |
-
}
|
299 |
-
|
300 |
-
/**
|
301 |
-
* Save our notifications admin.
|
302 |
-
*
|
303 |
-
* @access public
|
304 |
-
*
|
305 |
-
* @since 2.8
|
306 |
-
* @return void
|
307 |
-
*/
|
308 |
-
public function save_admin( $form_id, $data ) {
|
309 |
-
if ( ! isset ( $data['notification_id'] ) || empty ( $data['notification_id'] ) )
|
310 |
-
return false;
|
311 |
-
|
312 |
-
$n_id = $data['notification_id'];
|
313 |
-
$settings = $data['settings'];
|
314 |
-
|
315 |
-
if ( 'new' == $n_id ) {
|
316 |
-
$type = $settings['type'];
|
317 |
-
$n_id = $this->create( $form_id );
|
318 |
-
$new = true;
|
319 |
-
} else {
|
320 |
-
$type = Ninja_Forms()->notification( $n_id )->type;
|
321 |
-
$new = false;
|
322 |
-
}
|
323 |
-
|
324 |
-
$data = Ninja_Forms()->notification_types[ $type ]->save_admin( $n_id, $data );
|
325 |
-
|
326 |
-
foreach ( $settings as $meta_key => $meta_value ) {
|
327 |
-
nf_update_object_meta( $n_id, $meta_key, nf_wp_kses_post_deep( $meta_value ) );
|
328 |
-
}
|
329 |
-
|
330 |
-
do_action( 'nf_save_notification', $n_id, $data, $new );
|
331 |
-
|
332 |
-
if ( $new ) {
|
333 |
-
$redirect = esc_url_raw( remove_query_arg( array( 'notification-action' ) ) );
|
334 |
-
$redirect = esc_url_raw( add_query_arg( array( 'id' => $n_id, 'notification-action' => 'edit', 'update_message' => urlencode( __( 'Action Updated', 'ninja-forms' ) ) ), $redirect ) );
|
335 |
-
wp_redirect( $redirect );
|
336 |
-
die();
|
337 |
-
}
|
338 |
-
|
339 |
-
return __( 'Action Updated', 'ninja-forms' );
|
340 |
-
}
|
341 |
-
|
342 |
-
/**
|
343 |
-
* Get our registered notification types
|
344 |
-
*
|
345 |
-
* @access public
|
346 |
-
* @since 2.8
|
347 |
-
* @return array $types
|
348 |
-
*/
|
349 |
-
public function get_types() {
|
350 |
-
$types = array();
|
351 |
-
foreach ( Ninja_Forms()->notification_types as $slug => $object ) {
|
352 |
-
$types[ $slug ] = $object->name;
|
353 |
-
}
|
354 |
-
return $types;
|
355 |
-
}
|
356 |
-
|
357 |
-
/**
|
358 |
-
* Delete a notification.
|
359 |
-
* Hooked into the ajax action for nf_delete_notification
|
360 |
-
*
|
361 |
-
* @access public
|
362 |
-
* @since 2.8
|
363 |
-
* @return void
|
364 |
-
*/
|
365 |
-
public function delete_notification() {
|
366 |
-
// Bail if our nonce doesn't verify.
|
367 |
-
check_ajax_referer( 'nf_ajax', 'nf_ajax_nonce' );
|
368 |
-
|
369 |
-
$n_id = absint( $_REQUEST['n_id'] );
|
370 |
-
Ninja_Forms()->notification( $n_id )->delete();
|
371 |
-
}
|
372 |
-
|
373 |
-
/**
|
374 |
-
* Activate a notification.
|
375 |
-
* Hooked into the ajax action for nf_activate_notification
|
376 |
-
*
|
377 |
-
* @access public
|
378 |
-
* @since 2.8
|
379 |
-
* @return void
|
380 |
-
*/
|
381 |
-
public function activate_notification() {
|
382 |
-
// Bail if our nonce doesn't verify.
|
383 |
-
check_ajax_referer( 'nf_ajax', 'nf_ajax_nonce' );
|
384 |
-
|
385 |
-
$n_id = absint( $_REQUEST['n_id'] );
|
386 |
-
Ninja_Forms()->notification( $n_id )->activate();
|
387 |
-
}
|
388 |
-
|
389 |
-
/**
|
390 |
-
* Deactivate a notification.
|
391 |
-
* Hooked into the ajax action for nf_deactivate_notification
|
392 |
-
*
|
393 |
-
* @access public
|
394 |
-
* @since 2.8
|
395 |
-
* @return void
|
396 |
-
*/
|
397 |
-
public function deactivate_notification() {
|
398 |
-
// Bail if our nonce doesn't verify.
|
399 |
-
check_ajax_referer( 'nf_ajax', 'nf_ajax_nonce' );
|
400 |
-
|
401 |
-
$n_id = absint( $_REQUEST['n_id'] );
|
402 |
-
Ninja_Forms()->notification( $n_id )->deactivate();
|
403 |
-
}
|
404 |
-
|
405 |
-
/**
|
406 |
-
* Duplicate our notification
|
407 |
-
*
|
408 |
-
* @access public
|
409 |
-
* @since 2.8
|
410 |
-
* @return void
|
411 |
-
*/
|
412 |
-
public function duplicate_notification() {
|
413 |
-
if ( ! isset ( $_REQUEST['notification-action'] ) || $_REQUEST['notification-action'] != 'duplicate' )
|
414 |
-
return false;
|
415 |
-
|
416 |
-
$n_id = isset ( $_REQUEST['id'] ) ? absint( $_REQUEST['id'] ) : '';
|
417 |
-
|
418 |
-
// Bail if we don't have an ID.
|
419 |
-
if ( '' === $n_id )
|
420 |
-
return false;
|
421 |
-
|
422 |
-
Ninja_Forms()->notification( $n_id )->duplicate();
|
423 |
-
|
424 |
-
wp_redirect( esc_url_raw( remove_query_arg( array( 'notification-action' ) ) ) );
|
425 |
-
die();
|
426 |
-
}
|
427 |
-
|
428 |
-
/**
|
429 |
-
* Create a new notification
|
430 |
-
*
|
431 |
-
* @access public
|
432 |
-
* @since 2.8
|
433 |
-
* @return int $n_id
|
434 |
-
*/
|
435 |
-
public function create( $form_id = '' ) {
|
436 |
-
// Bail if we don't have a form_id
|
437 |
-
if ( '' == $form_id )
|
438 |
-
return false;
|
439 |
-
|
440 |
-
$n_id = nf_insert_notification( $form_id );
|
441 |
-
|
442 |
-
// Activate our new notification
|
443 |
-
Ninja_Forms()->notification( $n_id )->activate();
|
444 |
-
|
445 |
-
return $n_id;
|
446 |
-
}
|
447 |
-
|
448 |
-
/**
|
449 |
-
* Handle bulk actions
|
450 |
-
*
|
451 |
-
* @access public
|
452 |
-
* @since 2.8
|
453 |
-
* @return void
|
454 |
-
*/
|
455 |
-
public function bulk_actions() {
|
456 |
-
$action = '';
|
457 |
-
|
458 |
-
if ( isset( $_REQUEST['action2'] ) && -1 != $_REQUEST['action2'] )
|
459 |
-
$action = esc_html( $_REQUEST['action2'] );
|
460 |
-
|
461 |
-
if ( isset( $_REQUEST['action'] ) && -1 != $_REQUEST['action'] )
|
462 |
-
$action = esc_html( $_REQUEST['action'] );
|
463 |
-
|
464 |
-
$n_ids = isset ( $_REQUEST['notification'] ) ? esc_html( $_REQUEST['notification'] ) : '';
|
465 |
-
|
466 |
-
if ( ! is_array( $n_ids ) || empty( $n_ids ) )
|
467 |
-
return false;
|
468 |
-
|
469 |
-
if( 'delete' === $action ) {
|
470 |
-
foreach ( $n_ids as $n_id ) {
|
471 |
-
Ninja_Forms()->notification( $n_id )->delete();
|
472 |
-
}
|
473 |
-
} else if ( 'activate' === $action ) {
|
474 |
-
foreach ( $n_ids as $n_id ) {
|
475 |
-
Ninja_Forms()->notification( $n_id )->activate();
|
476 |
-
}
|
477 |
-
} else if ( 'deactivate' === $action ) {
|
478 |
-
foreach ( $n_ids as $n_id ) {
|
479 |
-
Ninja_Forms()->notification( $n_id )->deactivate();
|
480 |
-
}
|
481 |
-
}
|
482 |
-
|
483 |
-
wp_redirect( esc_url_raw( remove_query_arg( array( 'notification', '_wpnonce', '_wp_http_referer', 'action', 'action2' ) ) ) );
|
484 |
-
die();
|
485 |
-
}
|
486 |
-
|
487 |
-
/**
|
488 |
-
* Output our tinyMCE field buttons
|
489 |
-
*
|
490 |
-
* @access public
|
491 |
-
* @since 2.8
|
492 |
-
* @return void
|
493 |
-
*/
|
494 |
-
public function tinymce_buttons( $context ) {
|
495 |
-
$form_id = isset ( $_REQUEST['form_id'] ) ? absint( $_REQUEST['form_id'] ) : '';
|
496 |
-
if ( empty ( $form_id ) )
|
497 |
-
return $context;
|
498 |
-
|
499 |
-
$all_fields = Ninja_Forms()->form( $form_id )->process_fields;
|
500 |
-
$first_option = __( 'Select a field or type to search', 'ninja-forms' );
|
501 |
-
|
502 |
-
$fields = array();
|
503 |
-
$html = '<select class="nf-fields-combobox" data-first-option="' . $first_option . '">';
|
504 |
-
$html .= '<option value="">' . $first_option .'</option>';
|
505 |
-
foreach( $all_fields as $field_id => $field ) {
|
506 |
-
$label = esc_html( $field['label'] );
|
507 |
-
if ( strlen( $label ) > 30 )
|
508 |
-
$label = substr( $label, 0, 30 ) . '...';
|
509 |
-
|
510 |
-
$html .= '<option value="' . $field_id . '">' . $label . ' - ID: ' . $field_id . '</option>';
|
511 |
-
}
|
512 |
-
$html .= '</select>';
|
513 |
-
$html .= ' <a href="#" class="button-secondary nf-insert-field">' . __( 'Insert Field', 'ninja-forms' ) . '</a> <a href="#" class="button-secondary nf-insert-all-fields">' . __( 'Insert All Fields', 'ninja-forms' ) . '</a>';
|
514 |
-
|
515 |
-
return $html;
|
516 |
-
}
|
517 |
-
|
518 |
-
/**
|
519 |
-
* Loop through our notifications and add their processing functions to the appropriate hook.
|
520 |
-
*
|
521 |
-
* @access public
|
522 |
-
* @since 2.8
|
523 |
-
* @return void
|
524 |
-
*/
|
525 |
-
public function notification_processing() {
|
526 |
-
global $ninja_forms_processing;
|
527 |
-
|
528 |
-
$form_id = $ninja_forms_processing->get_form_ID();
|
529 |
-
$notifications = nf_get_notifications_by_form_id( $form_id, false );
|
530 |
-
if ( is_array( $notifications ) ) {
|
531 |
-
foreach ( $notifications as $id ) {
|
532 |
-
do_action( 'nf_notification_before_process', $id );
|
533 |
-
if ( Ninja_Forms()->notification( $id )->active ) {
|
534 |
-
Ninja_Forms()->notification( $id )->process();
|
535 |
-
}
|
536 |
-
}
|
537 |
-
}
|
538 |
-
}
|
539 |
-
|
540 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/classes/register.php
DELETED
@@ -1,31 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
/**
|
3 |
-
* Registration class. Responsible for handling registration of fields, notifications, and sidebars
|
4 |
-
*
|
5 |
-
* @package Ninja Forms
|
6 |
-
* @subpackage Classes/Register
|
7 |
-
* @copyright Copyright (c) 2014, WPNINJAS
|
8 |
-
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
-
* @since 3.0
|
10 |
-
*/
|
11 |
-
|
12 |
-
class NF_Register
|
13 |
-
{
|
14 |
-
|
15 |
-
/**
|
16 |
-
* Function that registers a notification type
|
17 |
-
*
|
18 |
-
* @access public
|
19 |
-
* @param string $slug - Notification type slug. Must be unique.
|
20 |
-
* @param string $classname - Name of the class that should be used for the notification type.
|
21 |
-
* @since 3.0
|
22 |
-
* @return void
|
23 |
-
*/
|
24 |
-
public function notification_type( $slug, $nicename, $classname ) {
|
25 |
-
if ( ! empty( $slug ) && ! empty( $classname ) && ! isset ( Ninja_Forms()->registered_field_types[ $slug ] ) ) {
|
26 |
-
Ninja_Forms()->registered_notification_types[ $slug ]['nicename'] = $nicename;
|
27 |
-
Ninja_Forms()->registered_notification_types[ $slug ]['classname'] = $classname;
|
28 |
-
}
|
29 |
-
}
|
30 |
-
|
31 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/classes/session.php
DELETED
@@ -1,148 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* NF Session
|
4 |
-
*
|
5 |
-
* This is a wrapper class for WP_Session / PHP $_SESSION and handles the storage of cart items, purchase sessions, etc
|
6 |
-
*
|
7 |
-
* @package Ninja Forms
|
8 |
-
* @subpackage Classes/Session
|
9 |
-
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
10 |
-
* @since 2.9.18
|
11 |
-
*/
|
12 |
-
// Exit if accessed directly
|
13 |
-
if ( ! defined( 'ABSPATH' ) ) exit;
|
14 |
-
/**
|
15 |
-
* NF_Session Class
|
16 |
-
*
|
17 |
-
* @since 1.5
|
18 |
-
*/
|
19 |
-
class NF_Session {
|
20 |
-
/**
|
21 |
-
* Holds our session data
|
22 |
-
*
|
23 |
-
* @var array
|
24 |
-
* @access private
|
25 |
-
* @since 2.9.18
|
26 |
-
*/
|
27 |
-
private $session;
|
28 |
-
/**
|
29 |
-
* Session index prefix
|
30 |
-
*
|
31 |
-
* @var string
|
32 |
-
* @access private
|
33 |
-
* @since 2.9.18
|
34 |
-
*/
|
35 |
-
private $prefix = '';
|
36 |
-
/**
|
37 |
-
* Get things started
|
38 |
-
*
|
39 |
-
* Defines our WP_Session constants, includes the necessary libraries and
|
40 |
-
* retrieves the WP Session instance
|
41 |
-
*
|
42 |
-
* @since 2.9.18
|
43 |
-
*/
|
44 |
-
public function __construct() {
|
45 |
-
// Use WP_Session (default)
|
46 |
-
if ( ! defined( 'WP_SESSION_COOKIE' ) ) {
|
47 |
-
define( 'WP_SESSION_COOKIE', 'nf_wp_session' );
|
48 |
-
}
|
49 |
-
if ( ! class_exists( 'Recursive_ArrayAccess' ) ) {
|
50 |
-
require_once NF_PLUGIN_DIR . 'includes/libraries/class-recursive-arrayaccess.php';
|
51 |
-
}
|
52 |
-
if ( ! class_exists( 'WP_Session' ) ) {
|
53 |
-
require_once NF_PLUGIN_DIR . 'includes/libraries/class-wp-session.php';
|
54 |
-
require_once NF_PLUGIN_DIR . 'includes/libraries/wp-session.php';
|
55 |
-
}
|
56 |
-
|
57 |
-
add_filter( 'wp_session_expiration_variant', array( $this, 'set_expiration_variant_time' ), 99999 );
|
58 |
-
add_filter( 'wp_session_expiration', array( $this, 'set_expiration_time' ), 99999 );
|
59 |
-
|
60 |
-
add_action( 'plugins_loaded', array( $this, 'init' ), -1 );
|
61 |
-
|
62 |
-
}
|
63 |
-
/**
|
64 |
-
* Setup the WP_Session instance
|
65 |
-
*
|
66 |
-
* @access public
|
67 |
-
* @since 2.9.18
|
68 |
-
* @return void
|
69 |
-
*/
|
70 |
-
public function init() {
|
71 |
-
$this->session = WP_Session::get_instance();
|
72 |
-
return $this->session;
|
73 |
-
}
|
74 |
-
/**
|
75 |
-
* Retrieve session ID
|
76 |
-
*
|
77 |
-
* @access public
|
78 |
-
* @since 2.9.18
|
79 |
-
* @return string Session ID
|
80 |
-
*/
|
81 |
-
public function get_id() {
|
82 |
-
return $this->session->session_id;
|
83 |
-
}
|
84 |
-
/**
|
85 |
-
* Retrieve a session variable
|
86 |
-
*
|
87 |
-
* @access public
|
88 |
-
* @since 2.9.18
|
89 |
-
* @param string $key Session key
|
90 |
-
* @return string Session variable
|
91 |
-
*/
|
92 |
-
public function get( $key ) {
|
93 |
-
$key = sanitize_key( $key );
|
94 |
-
return isset( $this->session[ $key ] ) ? maybe_unserialize( $this->session[ $key ] ) : false;
|
95 |
-
}
|
96 |
-
/**
|
97 |
-
* Set a session variable
|
98 |
-
*
|
99 |
-
* @since 2.9.18
|
100 |
-
* @param string $key Session key
|
101 |
-
* @param integer $value Session variable
|
102 |
-
* @return string Session variable
|
103 |
-
*/
|
104 |
-
public function set( $key, $value ) {
|
105 |
-
$key = sanitize_key( $key );
|
106 |
-
if ( is_array( $value ) ) {
|
107 |
-
$this->session[ $key ] = serialize( $value );
|
108 |
-
} else {
|
109 |
-
$this->session[ $key ] = $value;
|
110 |
-
}
|
111 |
-
return $this->session[ $key ];
|
112 |
-
}
|
113 |
-
|
114 |
-
/**
|
115 |
-
* Delete a session variable
|
116 |
-
*
|
117 |
-
* @since 2.9.28
|
118 |
-
* @param string $key
|
119 |
-
* @return void
|
120 |
-
*/
|
121 |
-
public function delete() {
|
122 |
-
delete_option( '_wp_session_' . $this->session->session_id );
|
123 |
-
delete_option( '_wp_session_expires_' . $this->session->session_id );
|
124 |
-
}
|
125 |
-
|
126 |
-
/**
|
127 |
-
* Force the cookie expiration variant time to 23 minutes
|
128 |
-
*
|
129 |
-
* @access public
|
130 |
-
* @since 2.9.18
|
131 |
-
* @param int $exp Default expiration (1 hour)
|
132 |
-
* @return int
|
133 |
-
*/
|
134 |
-
public function set_expiration_variant_time( $exp ) {
|
135 |
-
return 60 * 23;
|
136 |
-
}
|
137 |
-
/**
|
138 |
-
* Force the cookie expiration time to 24 minutes
|
139 |
-
*
|
140 |
-
* @access public
|
141 |
-
* @since 2.9.18
|
142 |
-
* @param int $exp Default expiration (1 hour)
|
143 |
-
* @return int
|
144 |
-
*/
|
145 |
-
public function set_expiration_time( $exp ) {
|
146 |
-
return 60 * 24;
|
147 |
-
}
|
148 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/classes/step-processing.php
DELETED
@@ -1,197 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
|
3 |
-
if( ! function_exists( 'nf_is_func_disabled' ) ) {
|
4 |
-
function nf_is_func_disabled($function)
|
5 |
-
{
|
6 |
-
$disabled = explode(',', ini_get('disable_functions'));
|
7 |
-
|
8 |
-
return in_array($function, $disabled);
|
9 |
-
}
|
10 |
-
}
|
11 |
-
|
12 |
-
/**
|
13 |
-
* Class for performing actions incrementally. Internally used for converting submissions, exporting submissions, etc.
|
14 |
-
* Very useful when interacting with large amounts of data.
|
15 |
-
*
|
16 |
-
* @package Ninja Forms
|
17 |
-
* @subpackage Classes/Step Processing
|
18 |
-
* @copyright Copyright (c) 2014, WPNINJAS
|
19 |
-
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
20 |
-
* @since 2.7.4
|
21 |
-
*/
|
22 |
-
|
23 |
-
class NF_Step_Processing
|
24 |
-
{
|
25 |
-
|
26 |
-
/**
|
27 |
-
* @var action
|
28 |
-
*/
|
29 |
-
var $action = '';
|
30 |
-
|
31 |
-
/**
|
32 |
-
* @var step
|
33 |
-
*/
|
34 |
-
var $step = '';
|
35 |
-
|
36 |
-
/**
|
37 |
-
* @var total_steps
|
38 |
-
*/
|
39 |
-
var $total_steps = '';
|
40 |
-
|
41 |
-
/**
|
42 |
-
* @var redirect
|
43 |
-
*/
|
44 |
-
var $redirect = '';
|
45 |
-
|
46 |
-
/**
|
47 |
-
* @var array
|
48 |
-
*/
|
49 |
-
var $errors = array();
|
50 |
-
|
51 |
-
/**
|
52 |
-
* @var args
|
53 |
-
*/
|
54 |
-
var $args = array();
|
55 |
-
|
56 |
-
/**
|
57 |
-
* Get things rolling
|
58 |
-
*
|
59 |
-
* @since 2.7.4
|
60 |
-
* @return void
|
61 |
-
*/
|
62 |
-
function __construct() {
|
63 |
-
|
64 |
-
//Bail if we aren't in the admin.
|
65 |
-
if ( ! is_admin() )
|
66 |
-
return false;
|
67 |
-
|
68 |
-
if ( function_exists( 'ignore_user_abort' ) && ! nf_is_func_disabled( 'ignore_user_abort' ) ) {
|
69 |
-
ignore_user_abort( true );
|
70 |
-
}
|
71 |
-
|
72 |
-
add_action( 'wp_ajax_nf_' . $this->action, array( $this, 'processing' ) );
|
73 |
-
}
|
74 |
-
|
75 |
-
/**
|
76 |
-
* Process our request.
|
77 |
-
* Call the appropriate loading or step functions.
|
78 |
-
*
|
79 |
-
* @since 2.7.6
|
80 |
-
* @return void
|
81 |
-
*/
|
82 |
-
public function processing() {
|
83 |
-
|
84 |
-
// Get our passed arguments. These come from the querysting of the processing page.
|
85 |
-
if ( isset ( $_REQUEST['args'] ) ) {
|
86 |
-
$this->args = $_REQUEST['args'];
|
87 |
-
if ( isset ( $this->args['redirect'] ) ) {
|
88 |
-
$this->redirect = $this->args['redirect'];
|
89 |
-
}
|
90 |
-
} else {
|
91 |
-
$this->args = array();
|
92 |
-
}
|
93 |
-
|
94 |
-
// Get our current step.
|
95 |
-
$this->step = isset ( $_REQUEST['step'] )? esc_html( $_REQUEST['step'] ) : 'loading';
|
96 |
-
|
97 |
-
// Get our total steps
|
98 |
-
$this->total_steps = isset ( $_REQUEST['total_steps'] )? esc_html( $_REQUEST['total_steps'] ) : 0;
|
99 |
-
|
100 |
-
// If our step is loading, then we need to return how many total steps there are along with the next step, which is 1.
|
101 |
-
if ( 'loading' == $this->step ) {
|
102 |
-
$return = $this->loading();
|
103 |
-
if ( ! isset ( $return['step'] ) ) {
|
104 |
-
$saved_step = get_user_option( 'nf_step_processing_' . $this->action . '_step' );
|
105 |
-
if ( ! empty ( $saved_step ) ) {
|
106 |
-
$this->step = $saved_step;
|
107 |
-
} else {
|
108 |
-
$this->step = 1;
|
109 |
-
}
|
110 |
-
|
111 |
-
$return['step'] = $this->step;
|
112 |
-
}
|
113 |
-
if ( ! isset ( $return['complete'] ) ) {
|
114 |
-
$return['complete'] = false;
|
115 |
-
}
|
116 |
-
} else { // We aren't on the loading step, so do our processing.
|
117 |
-
$return = $this->step();
|
118 |
-
if ( ! isset ( $return['step'] ) ) {
|
119 |
-
$this->step++;
|
120 |
-
$return['step'] = $this->step;
|
121 |
-
}
|
122 |
-
|
123 |
-
if ( ! isset ( $return['complete'] ) ) {
|
124 |
-
if ( $this->step > $this->total_steps ) {
|
125 |
-
$complete = true;
|
126 |
-
} else {
|
127 |
-
$complete = false;
|
128 |
-
}
|
129 |
-
$return['complete'] = $complete;
|
130 |
-
}
|
131 |
-
|
132 |
-
$return['total_steps'] = $this->total_steps;
|
133 |
-
}
|
134 |
-
|
135 |
-
$user_id = get_current_user_id();
|
136 |
-
|
137 |
-
if ( $return['complete'] ) {
|
138 |
-
// Delete our step option
|
139 |
-
delete_user_option( $user_id, 'nf_step_processing_' . $this->action . '_step' );
|
140 |
-
// Set our redirect variable.
|
141 |
-
$return['redirect'] = $this->redirect;
|
142 |
-
// Run our complete function
|
143 |
-
$this->complete();
|
144 |
-
} else {
|
145 |
-
// Save our current step so that we can resume if necessary
|
146 |
-
update_user_option( $user_id, 'nf_step_processing_' . $this->action . '_step', $this->step );
|
147 |
-
}
|
148 |
-
|
149 |
-
if ( isset ( $this->redirect ) && ! empty ( $this->redirect ) ) {
|
150 |
-
$this->args['redirect'] = $this->redirect;
|
151 |
-
}
|
152 |
-
|
153 |
-
$return['errors'] = ( $this->errors ) ? $this->errors : FALSE;
|
154 |
-
|
155 |
-
$return['args'] = $this->args;
|
156 |
-
|
157 |
-
echo json_encode( $return );
|
158 |
-
die();
|
159 |
-
|
160 |
-
}
|
161 |
-
|
162 |
-
/**
|
163 |
-
* Run our loading process.
|
164 |
-
* This function should be overwritten in child classes.
|
165 |
-
*
|
166 |
-
* @since 2.7.4
|
167 |
-
* @return array $args
|
168 |
-
*/
|
169 |
-
public function loading() {
|
170 |
-
// This space left intentionally blank.
|
171 |
-
}
|
172 |
-
|
173 |
-
/**
|
174 |
-
* This function is called for every step.
|
175 |
-
* This function should be overwritten in child classes.
|
176 |
-
*
|
177 |
-
* @since 2.7.4
|
178 |
-
* @return array $args
|
179 |
-
*/
|
180 |
-
public function step() {
|
181 |
-
// This space left intentionally blank.
|
182 |
-
}
|
183 |
-
|
184 |
-
/**
|
185 |
-
* This function is called for every step.
|
186 |
-
* This function should be overwritten in child classes.
|
187 |
-
*
|
188 |
-
* @since 2.7.4
|
189 |
-
* @return array $args
|
190 |
-
*/
|
191 |
-
public function complete() {
|
192 |
-
// This space left intentionally blank.
|
193 |
-
}
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/classes/sub.php
DELETED
@@ -1,405 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
/**
|
3 |
-
* Submission.
|
4 |
-
* This class handles storing, retrieving, editing a submission.
|
5 |
-
*
|
6 |
-
* @package Ninja Forms
|
7 |
-
* @subpackage Classes/Submissions
|
8 |
-
* @copyright Copyright (c) 2014, WPNINJAS
|
9 |
-
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
10 |
-
* @since 2.7
|
11 |
-
*/
|
12 |
-
|
13 |
-
class NF_Sub {
|
14 |
-
|
15 |
-
/**
|
16 |
-
* @var $sub_id store our sub id
|
17 |
-
*/
|
18 |
-
var $sub_id;
|
19 |
-
|
20 |
-
/**
|
21 |
-
* @var $seq_num store our sequential number
|
22 |
-
*/
|
23 |
-
var $seq_num;
|
24 |
-
|
25 |
-
/**
|
26 |
-
* @var $form_id store our form_id
|
27 |
-
*/
|
28 |
-
var $form_id;
|
29 |
-
|
30 |
-
/**
|
31 |
-
* @var $fields store our user values
|
32 |
-
*/
|
33 |
-
var $fields;
|
34 |
-
|
35 |
-
/**
|
36 |
-
* @var $action store the action that created this sub
|
37 |
-
*/
|
38 |
-
var $action;
|
39 |
-
|
40 |
-
/**
|
41 |
-
* @var $user_id store the user ID for this submission
|
42 |
-
*/
|
43 |
-
var $user_id;
|
44 |
-
|
45 |
-
/**
|
46 |
-
* @var $meta store our non-field meta
|
47 |
-
*/
|
48 |
-
var $meta;
|
49 |
-
|
50 |
-
/**
|
51 |
-
* @var $date_submitted store our submitted date
|
52 |
-
*/
|
53 |
-
var $date_submitted;
|
54 |
-
|
55 |
-
/**
|
56 |
-
* @var $date_modified store our modified date
|
57 |
-
*/
|
58 |
-
var $date_modified;
|
59 |
-
|
60 |
-
/**
|
61 |
-
* Get things started
|
62 |
-
*
|
63 |
-
* @access public
|
64 |
-
* @since 2.7
|
65 |
-
* @return void/
|
66 |
-
*/
|
67 |
-
public function __construct( $sub_id ) {
|
68 |
-
global $ninja_forms_fields;
|
69 |
-
|
70 |
-
// Bail if the sub doesn't exist.
|
71 |
-
$sub = get_post( $sub_id );
|
72 |
-
if ( ! is_object( $sub ) )
|
73 |
-
return false;
|
74 |
-
|
75 |
-
// Set our sub id
|
76 |
-
$this->sub_id = $sub_id;
|
77 |
-
|
78 |
-
// Populate our fields
|
79 |
-
$this->fields = array();
|
80 |
-
$this->retrieve_fields();
|
81 |
-
|
82 |
-
// Setup our form id var
|
83 |
-
$this->form_id = $this->get_meta( '_form_id' );
|
84 |
-
// Setup our action var
|
85 |
-
$this->action = $this->get_meta( '_action' );
|
86 |
-
// Setup our sequential id
|
87 |
-
$this->seq_num = $this->get_meta( '_seq_num' );
|
88 |
-
// Setup our user_id var
|
89 |
-
$this->user_id = $sub->post_author;
|
90 |
-
// Setup our date submitted var
|
91 |
-
$this->date_submitted = get_the_time( 'Y-m-d G:i:s', $sub_id );
|
92 |
-
// Setup our date modified var
|
93 |
-
$this->date_modified = get_post_modified_time( 'Y-m-d G:i:s', false, $sub_id );
|
94 |
-
|
95 |
-
}
|
96 |
-
|
97 |
-
private function retrieve_fields() {
|
98 |
-
global $ninja_forms_fields;
|
99 |
-
|
100 |
-
// Setup our fields and meta vars.
|
101 |
-
$post_meta = get_post_custom( $this->sub_id );
|
102 |
-
|
103 |
-
foreach ( $post_meta as $key => $array ) {
|
104 |
-
if ( is_serialized( $array[0] ) ) {
|
105 |
-
$meta_value = unserialize( $array[0] );
|
106 |
-
} else {
|
107 |
-
$meta_value = $array[0];
|
108 |
-
}
|
109 |
-
|
110 |
-
if ( strpos( $key, '_field_' ) !== false ) {
|
111 |
-
$field_id = str_replace( '_field_', '', $key );
|
112 |
-
$field = ninja_forms_get_field_by_id( $field_id );
|
113 |
-
$field_type = $field['type'];
|
114 |
-
|
115 |
-
// Check to see if our field type has been set as a "process_field".
|
116 |
-
if ( isset ( $ninja_forms_fields[ $field_type ] ) ) {
|
117 |
-
$reg_field = $ninja_forms_fields[ $field_type ];
|
118 |
-
$process_field = $reg_field['process_field'];
|
119 |
-
} else {
|
120 |
-
$process_field = false;
|
121 |
-
}
|
122 |
-
|
123 |
-
if ( $process_field ) {
|
124 |
-
$this->fields[ $field_id ] = $meta_value;
|
125 |
-
}
|
126 |
-
|
127 |
-
} else if ( $key != '_form_id' && $key != '_action' ) {
|
128 |
-
$this->meta[ $key ] = $meta_value;
|
129 |
-
}
|
130 |
-
}
|
131 |
-
}
|
132 |
-
|
133 |
-
/**
|
134 |
-
* Update our form id
|
135 |
-
*
|
136 |
-
* @access public
|
137 |
-
* @since 2.7
|
138 |
-
* @return bool
|
139 |
-
*/
|
140 |
-
public function update_form_id( $form_id ) {
|
141 |
-
if ( update_post_meta( $this->sub_id, '_form_id', $form_id ) ) {
|
142 |
-
$this->form_id = $form_id;
|
143 |
-
return true;
|
144 |
-
} else {
|
145 |
-
return false;
|
146 |
-
}
|
147 |
-
}
|
148 |
-
|
149 |
-
/**
|
150 |
-
* Update our action
|
151 |
-
*
|
152 |
-
* @access public
|
153 |
-
* @since 2.7
|
154 |
-
* @return bool
|
155 |
-
*/
|
156 |
-
public function update_action( $action ) {
|
157 |
-
if ( update_post_meta( $this->sub_id, '_action', $action ) ) {
|
158 |
-
$this->action = $action;
|
159 |
-
return true;
|
160 |
-
} else {
|
161 |
-
return false;
|
162 |
-
}
|
163 |
-
}
|
164 |
-
|
165 |
-
/**
|
166 |
-
* Update our sequential id
|
167 |
-
*
|
168 |
-
* @access public
|
169 |
-
* @since 2.7
|
170 |
-
* @return bool
|
171 |
-
*/
|
172 |
-
public function update_seq_num( $seq_num ) {
|
173 |
-
if ( update_post_meta( $this->sub_id, '_seq_num', $seq_num ) ) {
|
174 |
-
$this->seq_num = $seq_num;
|
175 |
-
return true;
|
176 |
-
} else {
|
177 |
-
return false;
|
178 |
-
}
|
179 |
-
}
|
180 |
-
|
181 |
-
/**
|
182 |
-
* Update our user id
|
183 |
-
*
|
184 |
-
* @access public
|
185 |
-
* @since 2.7
|
186 |
-
* @return bool
|
187 |
-
*/
|
188 |
-
public function update_user_id( $user_id ) {
|
189 |
-
$args = array(
|
190 |
-
'ID' => $this->sub_id,
|
191 |
-
'post_author' => $user_id,
|
192 |
-
);
|
193 |
-
|
194 |
-
// Update the post into the database
|
195 |
-
if ( wp_update_post( $args ) ) {
|
196 |
-
$this->user_id = $user_id;
|
197 |
-
return true;
|
198 |
-
} else {
|
199 |
-
return false;
|
200 |
-
}
|
201 |
-
}
|
202 |
-
|
203 |
-
/**
|
204 |
-
* Update our date submitted
|
205 |
-
*
|
206 |
-
* @access public
|
207 |
-
* @since 2.7
|
208 |
-
* @return bool
|
209 |
-
*/
|
210 |
-
public function update_date_submitted( $date ) {
|
211 |
-
$args = array(
|
212 |
-
'ID' => $this->sub_id,
|
213 |
-
'post_date' => $date,
|
214 |
-
'post_date_gmt' => get_gmt_from_date( $date ),
|
215 |
-
);
|
216 |
-
|
217 |
-
// Update the post into the database
|
218 |
-
if ( wp_update_post( $args ) ) {
|
219 |
-
$this->date_submitted = $date;
|
220 |
-
return true;
|
221 |
-
} else {
|
222 |
-
return false;
|
223 |
-
}
|
224 |
-
}
|
225 |
-
|
226 |
-
/**
|
227 |
-
* Update our date modified
|
228 |
-
*
|
229 |
-
* @access public
|
230 |
-
* @since 2.7
|
231 |
-
* @return bool
|
232 |
-
*/
|
233 |
-
public function update_date_modified( $date ) {
|
234 |
-
$args = array(
|
235 |
-
'ID' => $this->sub_id,
|
236 |
-
'post_modified' => $date,
|
237 |
-
'post_modified_gmt' => get_gmt_from_date( $date ),
|
238 |
-
);
|
239 |
-
|
240 |
-
// Update the post into the database
|
241 |
-
if ( wp_update_post( $args ) ) {
|
242 |
-
$this->date_modified = $date;
|
243 |
-
return true;
|
244 |
-
} else {
|
245 |
-
return false;
|
246 |
-
}
|
247 |
-
}
|
248 |
-
|
249 |
-
/**
|
250 |
-
* Add a meta value to our submission.
|
251 |
-
*
|
252 |
-
* @access public
|
253 |
-
* @since 2.7
|
254 |
-
* @return bool
|
255 |
-
*/
|
256 |
-
public function add_meta( $meta_key, $value ) {
|
257 |
-
if ( update_post_meta( $this->sub_id, $meta_key, $value ) ) {
|
258 |
-
$this->meta[ $meta_key ] = $value;
|
259 |
-
return true;
|
260 |
-
} else {
|
261 |
-
return false;
|
262 |
-
}
|
263 |
-
}
|
264 |
-
|
265 |
-
/**
|
266 |
-
* Update a meta value.
|
267 |
-
* Wrapper for add_field().
|
268 |
-
*
|
269 |
-
* @access public
|
270 |
-
* @since 2.7
|
271 |
-
* @return bool
|
272 |
-
*/
|
273 |
-
public function update_meta( $meta_key, $value ) {
|
274 |
-
return $this->add_meta( $meta_key, $value );
|
275 |
-
}
|
276 |
-
|
277 |
-
/**
|
278 |
-
* Delete a meta value.
|
279 |
-
*
|
280 |
-
* @access public
|
281 |
-
* @since 2.9
|
282 |
-
* @return bool
|
283 |
-
*/
|
284 |
-
public function delete_meta( $meta_key, $value = '' ) {
|
285 |
-
if ( empty( $value ) ) {
|
286 |
-
return delete_post_meta( $this->sub_id, $meta_key );
|
287 |
-
} else {
|
288 |
-
return delete_post_meta( $this->sub_id, $meta_key, $value );
|
289 |
-
}
|
290 |
-
|
291 |
-
}
|
292 |
-
|
293 |
-
/**
|
294 |
-
* Add a field value to our submission.
|
295 |
-
*
|
296 |
-
* @access public
|
297 |
-
* @since 2.7
|
298 |
-
* @return bool
|
299 |
-
*/
|
300 |
-
public function add_field( $field_id, $value ) {
|
301 |
-
$meta_key = '_field_' . $field_id;
|
302 |
-
if ( update_post_meta( $this->sub_id, $meta_key, $value ) ) {
|
303 |
-
$this->field[ $field_id ] = $value;
|
304 |
-
return true;
|
305 |
-
} else {
|
306 |
-
return false;
|
307 |
-
}
|
308 |
-
}
|
309 |
-
|
310 |
-
/**
|
311 |
-
* Update a field value
|
312 |
-
*
|
313 |
-
* @access public
|
314 |
-
* @since 2.7
|
315 |
-
* @return bool
|
316 |
-
*/
|
317 |
-
public function update_field( $field_id, $value ) {
|
318 |
-
return $this->add_field( $field_id, $value );
|
319 |
-
}
|
320 |
-
|
321 |
-
/**
|
322 |
-
* Get a meta value from our submission by meta key
|
323 |
-
*
|
324 |
-
* @access public
|
325 |
-
* @since 2.7
|
326 |
-
* @return array|bool
|
327 |
-
*/
|
328 |
-
public function get_meta( $meta_key ) {
|
329 |
-
if ( ! isset ( $this->meta[ $meta_key ] ) ) {
|
330 |
-
$this->meta[ $meta_key ] = get_post_meta( $this->sub_id, $meta_key, true );
|
331 |
-
}
|
332 |
-
|
333 |
-
return $this->meta[ $meta_key ];
|
334 |
-
}
|
335 |
-
|
336 |
-
/**
|
337 |
-
* Get a field value from our submission by field id
|
338 |
-
*
|
339 |
-
* @access public
|
340 |
-
* @since 2.7
|
341 |
-
* @return array|bool
|
342 |
-
*/
|
343 |
-
public function get_field( $field_id ) {
|
344 |
-
if ( isset ( $this->fields[ $field_id ] ) ) {
|
345 |
-
return $this->fields[ $field_id ];
|
346 |
-
} else {
|
347 |
-
return get_post_meta( $this->sub_id, '_field_' . $field_id, true );
|
348 |
-
}
|
349 |
-
}
|
350 |
-
|
351 |
-
/**
|
352 |
-
* Get a submission from the database, returning all the field data.
|
353 |
-
*
|
354 |
-
* @access public
|
355 |
-
* @since 2.7
|
356 |
-
* @return array $sub
|
357 |
-
*/
|
358 |
-
public function get_all_fields() {
|
359 |
-
if ( empty ( $this->fields ) ) {
|
360 |
-
$this->retrieve_fields();
|
361 |
-
}
|
362 |
-
return $this->fields;
|
363 |
-
}
|
364 |
-
|
365 |
-
/**
|
366 |
-
* Get a submission sequential ID by the post ID.
|
367 |
-
* This function puts together the prefix, sequential number, and postfix
|
368 |
-
*
|
369 |
-
* @access public
|
370 |
-
* @since 2.7
|
371 |
-
* @return string $seq_num
|
372 |
-
*/
|
373 |
-
public function get_seq_num() {
|
374 |
-
return apply_filters( 'nf_subs_seq_num', $this->seq_num, $this->sub_id );
|
375 |
-
}
|
376 |
-
|
377 |
-
/**
|
378 |
-
* Export our current submission.
|
379 |
-
*
|
380 |
-
* @access public
|
381 |
-
* @param array $sub_ids
|
382 |
-
* @param bool @return
|
383 |
-
* @since 2.7
|
384 |
-
* @return void
|
385 |
-
*/
|
386 |
-
public function export( $return = false ){
|
387 |
-
if ( $return ) {
|
388 |
-
return Ninja_Forms()->subs()->export( $this->sub_id, $return );
|
389 |
-
} else {
|
390 |
-
Ninja_Forms()->subs()->export( $this->sub_id, $return );
|
391 |
-
}
|
392 |
-
}
|
393 |
-
|
394 |
-
/**
|
395 |
-
* Delete this submission
|
396 |
-
*
|
397 |
-
* @access public
|
398 |
-
* @since 2.7
|
399 |
-
* @return void
|
400 |
-
*/
|
401 |
-
public function delete() {
|
402 |
-
wp_delete_post( $this->sub_id, true );
|
403 |
-
}
|
404 |
-
|
405 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/classes/subs-cpt.php
DELETED
@@ -1,1232 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
/**
|
3 |
-
* Submission CPT.
|
4 |
-
* This class adds our submission CPT and handles displaying submissions in the wp-admin.
|
5 |
-
*
|
6 |
-
* @package Ninja Forms
|
7 |
-
* @subpackage Classes/Submissions
|
8 |
-
* @copyright Copyright (c) 2014, WPNINJAS
|
9 |
-
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
10 |
-
* @since 2.7
|
11 |
-
*/
|
12 |
-
|
13 |
-
class NF_Subs_CPT {
|
14 |
-
|
15 |
-
var $form_id;
|
16 |
-
|
17 |
-
var $screen_options;
|
18 |
-
|
19 |
-
var $filename;
|
20 |
-
|
21 |
-
/**
|
22 |
-
* Get things started
|
23 |
-
*
|
24 |
-
* @access public
|
25 |
-
* @since 2.7
|
26 |
-
* @return void
|
27 |
-
*/
|
28 |
-
function __construct() {
|
29 |
-
|
30 |
-
// Register our submission custom post type.
|
31 |
-
add_action( 'init', array( $this, 'register_cpt' ), 5 );
|
32 |
-
|
33 |
-
// Populate our field settings var
|
34 |
-
add_action( 'current_screen', array( $this, 'setup_fields' ) );
|
35 |
-
|
36 |
-
// Filter our hidden columns by form ID.
|
37 |
-
add_action( 'wp', array( $this, 'filter_hidden_columns' ) );
|
38 |
-
|
39 |
-
// Add our submenu for the submissions page.
|
40 |
-
add_action( 'admin_menu', array( $this, 'add_submenu' ), 10 );
|
41 |
-
|
42 |
-
// Change our submission columns.
|
43 |
-
add_filter( 'manage_nf_sub_posts_columns', array( $this, 'change_columns' ) );
|
44 |
-
|
45 |
-
// Make our columns sortable.
|
46 |
-
add_filter( 'manage_edit-nf_sub_sortable_columns', array( $this, 'sortable_columns' ) );
|
47 |
-
|
48 |
-
// Actually do the sorting
|
49 |
-
add_filter( 'request', array( $this, 'sort_columns' ) );
|
50 |
-
|
51 |
-
// Add the appropriate data for our custom columns.
|
52 |
-
add_action( 'manage_posts_custom_column', array( $this, 'custom_columns' ), 10, 2 );
|
53 |
-
|
54 |
-
// Add our submission filters.
|
55 |
-
add_action( 'restrict_manage_posts', array( $this, 'add_filters' ) );
|
56 |
-
add_filter( 'parse_query', array( $this, 'table_filter' ) );
|
57 |
-
add_filter( 'posts_clauses', array( $this, 'search' ), 20 );
|
58 |
-
|
59 |
-
add_action( 'admin_footer', array( $this, 'jquery_remove_counts' ) );
|
60 |
-
|
61 |
-
// Filter our post counts
|
62 |
-
add_filter( 'wp_count_posts', array( $this, 'count_posts' ), 10, 3 );
|
63 |
-
|
64 |
-
// Filter our bulk actions
|
65 |
-
add_filter( 'bulk_actions-edit-nf_sub', array( $this, 'remove_bulk_edit' ) );
|
66 |
-
add_action( 'admin_footer-edit.php', array( $this, 'bulk_admin_footer' ) );
|
67 |
-
|
68 |
-
// Filter our bulk updated/trashed messages
|
69 |
-
add_filter( 'bulk_post_updated_messages', array( $this, 'updated_messages_filter' ), 10, 2 );
|
70 |
-
|
71 |
-
// Filter singular updated/trashed messages
|
72 |
-
add_filter( 'post_updated_messages', array( $this, 'post_updated_messages' ) );
|
73 |
-
|
74 |
-
// Add our metabox for editing field values
|
75 |
-
add_action( 'add_meta_boxes', array( $this, 'add_metaboxes' ) );
|
76 |
-
|
77 |
-
// Save our metabox values
|
78 |
-
add_action( 'save_post', array( $this, 'save_sub' ), 10, 2 );
|
79 |
-
|
80 |
-
// Save our hidden columns by form id.
|
81 |
-
add_action( 'wp_ajax_nf_hide_columns', array( $this, 'hide_columns' ) );
|
82 |
-
|
83 |
-
// Load any custom screen options
|
84 |
-
add_filter( 'screen_settings', array( $this, 'output_screen_options' ), 10, 2 );
|
85 |
-
|
86 |
-
// Listen for our exports button.
|
87 |
-
add_action( 'load-edit.php', array( $this, 'export_listen' ) );
|
88 |
-
|
89 |
-
// Filter our submission capabilities
|
90 |
-
add_filter( 'user_has_cap', array( $this, 'cap_filter' ), 10, 3 );
|
91 |
-
|
92 |
-
}
|
93 |
-
|
94 |
-
/**
|
95 |
-
* Register our submission CPT
|
96 |
-
*
|
97 |
-
* @access public
|
98 |
-
* @since 2.7
|
99 |
-
* @return void
|
100 |
-
*/
|
101 |
-
public function register_cpt() {
|
102 |
-
if ( ! isset ( $_REQUEST['form_id'] ) || empty( $_REQUEST['form_id'] ) ) {
|
103 |
-
$not_found = __( 'Please select a form to view submissions', 'ninja-forms' );
|
104 |
-
} else {
|
105 |
-
$not_found = __( 'No Submissions Found', 'ninja-forms' );
|
106 |
-
}
|
107 |
-
|
108 |
-
$name = _x( 'Submissions', 'post type general name', 'ninja-forms' );
|
109 |
-
|
110 |
-
if ( ! empty ( $_REQUEST['form_id'] ) ) {
|
111 |
-
$form_title = Ninja_Forms()->form( absint( $_REQUEST['form_id'] ) )->get_setting( 'form_title' );
|
112 |
-
$name =$name . ' - ' . $form_title;
|
113 |
-
}
|
114 |
-
|
115 |
-
$labels = array(
|
116 |
-
'name' => $name,
|
117 |
-
'singular_name' => _x( 'Submission', 'post type singular name', 'ninja-forms' ),
|
118 |
-
'add_new' => _x( 'Add New', 'nf_sub' ),
|
119 |
-
'add_new_item' => __( 'Add New Submission', 'ninja-forms' ),
|
120 |
-
'edit_item' => __( 'Edit Submission', 'ninja-forms' ),
|
121 |
-
'new_item' => __( 'New Submission', 'ninja-forms' ),
|
122 |
-
'view_item' => __( 'View Submission', 'ninja-forms' ),
|
123 |
-
'search_items' => __( 'Search Submissions', 'ninja-forms' ),
|
124 |
-
'not_found' => $not_found,
|
125 |
-
'not_found_in_trash' => __( 'No Submissions Found In The Trash', 'ninja-forms' ),
|
126 |
-
'parent_item_colon' => ''
|
127 |
-
);
|
128 |
-
|
129 |
-
$args = array(
|
130 |
-
'labels' => $labels,
|
131 |
-
'public' => false,
|
132 |
-
'publicly_queryable' => false,
|
133 |
-
'show_ui' => true,
|
134 |
-
'_builtin' => false, // It's a custom post type, not built in!
|
135 |
-
'query_var' => true,
|
136 |
-
'has_archive' => false,
|
137 |
-
'show_in_menu' => false,
|
138 |
-
'hierarchical' => false,
|
139 |
-
'menu_events' => null,
|
140 |
-
'rewrite' => array( 'slug' => 'nf_sub' ), // Permalinks format
|
141 |
-
'supports' => array( 'custom-fields' ),
|
142 |
-
'capability_type' => 'nf_sub',
|
143 |
-
'capabilities' => array(
|
144 |
-
'publish_posts' => 'nf_sub',
|
145 |
-
'edit_posts' => 'nf_sub',
|
146 |
-
'edit_others_posts' => 'nf_sub',
|
147 |
-
'delete_posts' => 'nf_sub',
|
148 |
-
'delete_others_posts' => 'nf_sub',
|
149 |
-
'read_private_posts' => 'nf_sub',
|
150 |
-
'edit_post' => 'nf_sub',
|
151 |
-
'delete_post' => 'nf_sub',
|
152 |
-
'read_post' => 'nf_sub',
|
153 |
-
),
|
154 |
-
);
|
155 |
-
|
156 |
-
register_post_type( 'nf_sub',$args );
|
157 |
-
|
158 |
-
}
|
159 |
-
|
160 |
-
/**
|
161 |
-
* Populate our fields var with all the fields. This keeps us from needing to ping the database later.
|
162 |
-
*
|
163 |
-
* @access public
|
164 |
-
* @since 2.7
|
165 |
-
*/
|
166 |
-
public function setup_fields() {
|
167 |
-
global $pagenow, $typenow;
|
168 |
-
|
169 |
-
// Bail if we aren't on the edit.php page, we aren't editing our custom post type, or we don't have a form_id set.
|
170 |
-
if ( ( $pagenow != 'edit.php' && $pagenow != 'post.php' ) || $typenow != 'nf_sub' )
|
171 |
-
return false;
|
172 |
-
|
173 |
-
if ( isset ( $_REQUEST['form_id'] ) ) {
|
174 |
-
$form_id = absint( $_REQUEST['form_id'] );
|
175 |
-
} else if ( isset ( $_REQUEST['post'] ) ) {
|
176 |
-
$form_id = Ninja_Forms()->sub( absint( $_REQUEST['post'] ) )->form_id;
|
177 |
-
} else {
|
178 |
-
$form_id = '';
|
179 |
-
}
|
180 |
-
|
181 |
-
$this->form_id = $form_id;
|
182 |
-
|
183 |
-
Ninja_Forms()->form( $form_id );
|
184 |
-
}
|
185 |
-
|
186 |
-
/**
|
187 |
-
* Add our submissions submenu
|
188 |
-
*
|
189 |
-
* @access public
|
190 |
-
* @since 2.7
|
191 |
-
* @return void
|
192 |
-
*/
|
193 |
-
public function add_submenu() {
|
194 |
-
// Add our submissions submenu
|
195 |
-
$sub_page = add_submenu_page( 'ninja-forms', __( 'Submissions', 'ninja-forms' ), __( 'Submissions', 'ninja-forms' ), apply_filters( 'ninja_forms_admin_submissions_capabilities', 'manage_options' ), 'edit.php?post_type=nf_sub' );
|
196 |
-
// Enqueue our JS on the edit page.
|
197 |
-
//add_action( 'load-' . $sub_page, array( $this, 'load_js' ) );
|
198 |
-
add_action( 'admin_print_styles', array( $this, 'load_js' ) );
|
199 |
-
add_action( 'admin_print_styles', array( $this, 'load_css' ) );
|
200 |
-
// Remove the publish box from the submission editing page.
|
201 |
-
remove_meta_box( 'submitdiv', 'nf_sub', 'side' );
|
202 |
-
|
203 |
-
}
|
204 |
-
|
205 |
-
/**
|
206 |
-
* Enqueue our submissions JS file.
|
207 |
-
*
|
208 |
-
* @access public
|
209 |
-
* @since 2.7
|
210 |
-
* @return void
|
211 |
-
*/
|
212 |
-
public function load_js() {
|
213 |
-
global $pagenow, $typenow;
|
214 |
-
// Bail if we aren't on the edit.php page or we aren't editing our custom post type.
|
215 |
-
if ( ( $pagenow != 'edit.php' && $pagenow != 'post.php' ) || $typenow != 'nf_sub' )
|
216 |
-
return false;
|
217 |
-
|
218 |
-
$form_id = isset ( $_REQUEST['form_id'] ) ? absint( $_REQUEST['form_id'] ) : '';
|
219 |
-
|
220 |
-
if ( defined( 'NINJA_FORMS_JS_DEBUG' ) && NINJA_FORMS_JS_DEBUG ) {
|
221 |
-
$suffix = '';
|
222 |
-
$src = 'dev';
|
223 |
-
} else {
|
224 |
-
$suffix = '.min';
|
225 |
-
$src = 'min';
|
226 |
-
}
|
227 |
-
|
228 |
-
$suffix = '';
|
229 |
-
$src = 'dev';
|
230 |
-
|
231 |
-
$plugin_settings = nf_get_settings();
|
232 |
-
$date_format = ninja_forms_date_to_datepicker( $plugin_settings['date_format'] );
|
233 |
-
|
234 |
-
$datepicker_args = array();
|
235 |
-
if ( !empty( $date_format ) ) {
|
236 |
-
$datepicker_args['dateFormat'] = $date_format;
|
237 |
-
}
|
238 |
-
|
239 |
-
wp_enqueue_script( 'subs-cpt',
|
240 |
-
NF_PLUGIN_URL . 'assets/js/' . $src .'/subs-cpt' . $suffix . '.js',
|
241 |
-
array('jquery', 'jquery-ui-datepicker') );
|
242 |
-
|
243 |
-
wp_localize_script( 'subs-cpt', 'nf_sub', array( 'form_id' => $form_id, 'datepicker_args' => apply_filters( 'ninja_forms_admin_submissions_datepicker_args', $datepicker_args ) ) );
|
244 |
-
|
245 |
-
}
|
246 |
-
|
247 |
-
/**
|
248 |
-
* Enqueue our submissions CSS file.
|
249 |
-
*
|
250 |
-
* @access public
|
251 |
-
* @since 2.7
|
252 |
-
* @return void
|
253 |
-
*/
|
254 |
-
public function load_css() {
|
255 |
-
global $pagenow, $typenow;
|
256 |
-
|
257 |
-
// Bail if we aren't on the edit.php page or the post.php page.
|
258 |
-
if ( ( $pagenow != 'edit.php' && $pagenow != 'post.php' ) || $typenow != 'nf_sub' )
|
259 |
-
return false;
|
260 |
-
|
261 |
-
wp_enqueue_style( 'nf-sub', NF_PLUGIN_URL .'assets/css/cpt.css' );
|
262 |
-
wp_enqueue_style( 'nf-jquery-ui-freshness', NF_PLUGIN_URL .'assets/css/jquery-ui-fresh.min.css' );
|
263 |
-
}
|
264 |
-
|
265 |
-
/**
|
266 |
-
* Modify the columns of our submissions table.
|
267 |
-
*
|
268 |
-
* @access public
|
269 |
-
* @since 2.7
|
270 |
-
* @return array $cols
|
271 |
-
*/
|
272 |
-
public function change_columns( $cols ) {
|
273 |
-
// Compatibility with old field registration system. Can be removed when the new one is in place.
|
274 |
-
global $ninja_forms_fields;
|
275 |
-
// End Compatibility
|
276 |
-
|
277 |
-
$cols = array(
|
278 |
-
'cb' => '<input type="checkbox" />',
|
279 |
-
'id' => __( '#', 'ninja-forms' ),
|
280 |
-
);
|
281 |
-
|
282 |
-
// Compatibility with old field registration system. Can be removed when the new one is in place.
|
283 |
-
if ( isset ( $_GET['form_id'] ) && $_GET['form_id'] != '' ) {
|
284 |
-
$form_id = absint( $_GET['form_id'] );
|
285 |
-
if ( is_object( Ninja_Forms()->form( $this->form_id ) ) && is_array ( Ninja_Forms()->form( $this->form_id )->fields ) ) {
|
286 |
-
foreach ( Ninja_Forms()->form( $this->form_id )->fields as $field ) {
|
287 |
-
$field_id = $field['id'];
|
288 |
-
$field_type = $field['type'];
|
289 |
-
if ( isset ( $ninja_forms_fields[ $field_type ] ) ) {
|
290 |
-
$reg_field = $ninja_forms_fields[ $field_type ];
|
291 |
-
$process_field = $reg_field['process_field'];
|
292 |
-
} else {
|
293 |
-
$process_field = false;
|
294 |
-
}
|
295 |
-
if ( isset ( $field['data']['admin_label'] ) && ! empty ( $field['data']['admin_label'] ) ) {
|
296 |
-
$label = $field['data']['admin_label'];
|
297 |
-
} else if ( isset ( $field['data']['label'] ) ) {
|
298 |
-
$label = $field['data']['label'];
|
299 |
-
} else {
|
300 |
-
$label = '';
|
301 |
-
}
|
302 |
-
|
303 |
-
if ( strlen( $label ) > 140 )
|
304 |
-
$label = substr( $label, 0, 140 );
|
305 |
-
|
306 |
-
if ( isset ( $field['data']['label'] ) && $process_field )
|
307 |
-
$cols[ 'form_' . $form_id . '_field_' . $field_id ] = $label;
|
308 |
-
}
|
309 |
-
}
|
310 |
-
} else {
|
311 |
-
$form_id = '';
|
312 |
-
}
|
313 |
-
// End Compatibility
|
314 |
-
// Add our date column
|
315 |
-
$cols['sub_date'] = __( 'Date', 'ninja-forms' );
|
316 |
-
|
317 |
-
return apply_filters( 'nf_sub_table_columns', $cols, $form_id );
|
318 |
-
}
|
319 |
-
|
320 |
-
/**
|
321 |
-
* Make our columns sortable
|
322 |
-
*
|
323 |
-
* @access public
|
324 |
-
* @since 2.7
|
325 |
-
* @return array
|
326 |
-
*/
|
327 |
-
public function sortable_columns() {
|
328 |
-
// Get a list of all of our fields.
|
329 |
-
$columns = get_column_headers( 'edit-nf_sub' );
|
330 |
-
$tmp_array = array();
|
331 |
-
foreach ( $columns as $slug => $c ) {
|
332 |
-
if ( $slug != 'cb' ) {
|
333 |
-
$tmp_array[ $slug ] = $slug;
|
334 |
-
}
|
335 |
-
}
|
336 |
-
return $tmp_array;
|
337 |
-
}
|
338 |
-
|
339 |
-
/**
|
340 |
-
* Actually sort our columns
|
341 |
-
*
|
342 |
-
* @access public
|
343 |
-
* @since 2.7
|
344 |
-
* @return array $vars
|
345 |
-
*/
|
346 |
-
public function sort_columns( $vars ) {
|
347 |
-
global $pagenow, $typenow;
|
348 |
-
if( array_key_exists( 'orderby', $vars ) ) {
|
349 |
-
if( strpos( $vars['orderby'], 'form_' ) !== false ) {
|
350 |
-
$args = explode( '_', $vars['orderby'] );
|
351 |
-
$field_id = $args[3];
|
352 |
-
|
353 |
-
if ( isset ( Ninja_Forms()->form( $this->form_id )->fields[ $field_id ]['data']['num_sort'] ) && Ninja_Forms()->form( $this->form_id )->fields[ $field_id ]['data']['num_sort'] == 1 ) {
|
354 |
-
$orderby = 'meta_value_num';
|
355 |
-
} else {
|
356 |
-
$orderby = 'meta_value';
|
357 |
-
}
|
358 |
-
|
359 |
-
$vars['orderby'] = $orderby;
|
360 |
-
$vars['meta_key'] = '_field_' . $field_id;
|
361 |
-
} else if ( $vars['orderby'] == 'id' ) {
|
362 |
-
$vars['orderby'] = 'meta_value_num';
|
363 |
-
$vars['meta_key'] = '_seq_num';
|
364 |
-
}
|
365 |
-
} else if( is_admin() && $typenow == 'nf_sub' && $pagenow == 'edit.php' ) {
|
366 |
-
$vars['orderby'] = 'meta_value_num';
|
367 |
-
$vars['meta_key'] = '_seq_num';
|
368 |
-
$vars['order'] = 'DESC';
|
369 |
-
}
|
370 |
-
return $vars;
|
371 |
-
}
|
372 |
-
|
373 |
-
/**
|
374 |
-
* Add our custom column data
|
375 |
-
*
|
376 |
-
* @access public
|
377 |
-
* @since 2.7
|
378 |
-
* @return void
|
379 |
-
*/
|
380 |
-
public function custom_columns( $column, $sub_id ) {
|
381 |
-
if ( isset ( $_GET['form_id'] ) ) {
|
382 |
-
$form_id = absint($_GET['form_id']);
|
383 |
-
if ( $column == 'id' ) {
|
384 |
-
echo apply_filters( 'nf_sub_table_seq_num', Ninja_Forms()->sub( $sub_id )->get_seq_num(), $sub_id, $column );
|
385 |
-
echo '<div class="locked-info"><span class="locked-avatar"></span> <span class="locked-text"></span></div>';
|
386 |
-
if ( !isset ( $_GET['post_status'] ) || $_GET['post_status'] == 'all' ) {
|
387 |
-
echo '<div class="row-actions custom-row-actions">';
|
388 |
-
do_action( 'nf_sub_table_before_row_actions', $sub_id, $column );
|
389 |
-
echo '<span class="edit"><a href="post.php?post=' . $sub_id . '&action=edit&ref=' . urlencode( esc_url( add_query_arg( array() ) ) ) . '" title="' . __( 'Edit this item', 'ninja-forms' ) . '">' . __( 'Edit', 'ninja-forms' ) . '</a> | </span>
|
390 |
-
<span class="edit"><a href="' . esc_url( add_query_arg( array( 'export_single' => $sub_id ) ) ) . '" title="' . __( 'Export this item', 'ninja-forms' ) . '">' . __( 'Export', 'ninja-forms' ) . '</a> | </span>';
|
391 |
-
$row_actions = apply_filters( 'nf_sub_table_row_actions', array(), $sub_id, $form_id );
|
392 |
-
if ( ! empty( $row_actions ) ) {
|
393 |
-
echo implode(" | ", $row_actions);
|
394 |
-
echo '| ';
|
395 |
-
}
|
396 |
-
echo '<span class="trash"><a class="submitdelete" title="' . __( 'Move this item to the Trash', 'ninja-forms' ) . '" href="' . get_delete_post_link( $sub_id ) . '">' . __( 'Trash', 'ninja-forms' ) . '</a> </span>';
|
397 |
-
do_action( 'nf_sub_table_after_row_actions', $sub_id, $column );
|
398 |
-
echo '</div>';
|
399 |
-
} else {
|
400 |
-
echo '<div class="row-actions custom-row-actions">';
|
401 |
-
do_action( 'nf_sub_table_before_row_actions_trash', $sub_id, $column );
|
402 |
-
echo '<span class="untrash"><a title="' . esc_attr( __( 'Restore this item from the Trash', 'ninja-forms' ) ) . '" href="' . wp_nonce_url( sprintf( get_edit_post_link( $sub_id ) . '&action=untrash', $sub_id ) , 'untrash-post_' . $sub_id ) . '">' . __( 'Restore', 'ninja-forms' ) . '</a> | </span>
|
403 |
-
<span class="delete"><a class="submitdelete" title="' . esc_attr( __( 'Delete this item permanently', 'ninja-forms' ) ) . '" href="' . get_delete_post_link( $sub_id, '', true ) . '">' . __( 'Delete Permanently', 'ninja-forms' ) . '</a></span>';
|
404 |
-
do_action( 'nf_sub_table_after_row_actions_trash', $sub_id, $column );
|
405 |
-
echo '</div>';
|
406 |
-
}
|
407 |
-
} else if ( $column == 'sub_date' ) {
|
408 |
-
$post = get_post( $sub_id );
|
409 |
-
if ( '0000-00-00 00:00:00' == $post->post_date ) {
|
410 |
-
$t_time = $h_time = __( 'Unpublished', 'ninja-forms' );
|
411 |
-
$time_diff = 0;
|
412 |
-
} else {
|
413 |
-
$t_time = get_the_time( 'Y/m/d g:i:s A' );
|
414 |
-
$m_time = $post->post_date;
|
415 |
-
$time = get_post_time( 'G', true, $post );
|
416 |
-
|
417 |
-
$time_diff = time() - $time;
|
418 |
-
|
419 |
-
if ( $time_diff > 0 && $time_diff < DAY_IN_SECONDS )
|
420 |
-
$h_time = sprintf( __( '%s ago', 'ninja-forms' ), human_time_diff( $time ) );
|
421 |
-
else
|
422 |
-
$h_time = mysql2date( 'Y/m/d', $m_time );
|
423 |
-
}
|
424 |
-
|
425 |
-
$t_time = apply_filters( 'nf_sub_title_time', $t_time );
|
426 |
-
$h_time = apply_filters( 'nf_sub_human_time', $h_time );
|
427 |
-
|
428 |
-
/** This filter is documented in wp-admin/includes/class-wp-posts-list-table.php */
|
429 |
-
echo '<abbr title="' . $t_time . '">' . $h_time . '</abbr>';
|
430 |
-
|
431 |
-
echo '<br />';
|
432 |
-
echo apply_filters( 'nf_sub_table_status', __( 'Submitted', 'ninja-forms' ), $sub_id );
|
433 |
-
|
434 |
-
} else if ( strpos( $column, '_field_' ) !== false ) {
|
435 |
-
global $ninja_forms_fields;
|
436 |
-
|
437 |
-
$field_id = str_replace( 'form_' . $form_id . '_field_', '', $column );
|
438 |
-
//if ( apply_filters( 'nf_add_sub_value', Ninja_Forms()->field( $field_id )->type->add_to_sub, $field_id ) ) {
|
439 |
-
$field = Ninja_Forms()->form( $form_id )->fields[ $field_id ];
|
440 |
-
$field_type = $field['type'];
|
441 |
-
if ( isset ( $ninja_forms_fields[ $field_type ] ) ) {
|
442 |
-
$reg_field = $ninja_forms_fields[ $field_type ];
|
443 |
-
} else {
|
444 |
-
$reg_field = array();
|
445 |
-
}
|
446 |
-
|
447 |
-
if ( isset ( $reg_field['sub_table_value'] ) ) {
|
448 |
-
$edit_value_function = $reg_field['sub_table_value'];
|
449 |
-
} else {
|
450 |
-
$edit_value_function = 'nf_field_text_sub_table_value';
|
451 |
-
}
|
452 |
-
|
453 |
-
$user_value = Ninja_Forms()->sub( $sub_id )->get_field( $field_id );
|
454 |
-
|
455 |
-
$args['field_id'] = $field_id;
|
456 |
-
$args['user_value'] = ninja_forms_esc_html_deep( $user_value );
|
457 |
-
$args['field'] = $field;
|
458 |
-
|
459 |
-
call_user_func_array( $edit_value_function, $args );
|
460 |
-
//}
|
461 |
-
}
|
462 |
-
}
|
463 |
-
}
|
464 |
-
|
465 |
-
/**
|
466 |
-
* Add our submission filters
|
467 |
-
*
|
468 |
-
* @access public
|
469 |
-
* @since 2.7
|
470 |
-
* @return void
|
471 |
-
*/
|
472 |
-
public function add_filters() {
|
473 |
-
global $typenow;
|
474 |
-
|
475 |
-
// Bail if we aren't in our submission custom post type.
|
476 |
-
if ( $typenow != 'nf_sub' )
|
477 |
-
return false;
|
478 |
-
|
479 |
-
// Add our Form selection dropdown.
|
480 |
-
// Get our list of forms
|
481 |
-
$forms = Ninja_Forms()->forms()->get_all();
|
482 |
-
|
483 |
-
$form_id = isset( $_GET['form_id'] ) ? absint($_GET['form_id']) : '';
|
484 |
-
|
485 |
-
$begin_date = isset ( $_GET['begin_date'] ) ? sanitize_text_field($_GET['begin_date']) : '';
|
486 |
-
$end_date = isset ( $_GET['end_date'] ) ? sanitize_text_field($_GET['end_date']) : '';
|
487 |
-
|
488 |
-
// Add begin date and end date filter fields.
|
489 |
-
$html = '<div style="float:left;">';
|
490 |
-
$html .= '<span style="float:left;" class="spinner"></span>';
|
491 |
-
$html .= '<select name="form_id" id="form_id" class="nf-form-jump">';
|
492 |
-
$html .= '<option value="">- ' . __( 'Select a form', 'ninja-forms' ) . '</option>';
|
493 |
-
if ( is_array( $forms ) ) {
|
494 |
-
foreach ( $forms as $f_id ) {
|
495 |
-
$form_title = Ninja_Forms()->form( $f_id )->get_setting( 'form_title' );
|
496 |
-
$html .= '<option value="' . $f_id . '" ' . selected( $form_id, $f_id, false ) . '>' . $form_title . '</option>';
|
497 |
-
}
|
498 |
-
}
|
499 |
-
$html .= '</select>';
|
500 |
-
|
501 |
-
$html .= '<input name="begin_date" type="text" class="datepicker" placeholder="' . __( 'Begin Date', 'ninja-forms' ) . '" value="' . $begin_date . '" /> ';
|
502 |
-
$html .= '<input name="end_date" type="text" class="datepicker" placeholder="' . __( 'End Date', 'ninja-forms' ) . '" value="' . $end_date . '" />';
|
503 |
-
$html .= '</div>';
|
504 |
-
|
505 |
-
echo $html;
|
506 |
-
|
507 |
-
}
|
508 |
-
|
509 |
-
/**
|
510 |
-
* Filter our submission list by form_id
|
511 |
-
*
|
512 |
-
* @access public
|
513 |
-
* @since 2.7
|
514 |
-
* @return void
|
515 |
-
*/
|
516 |
-
public function table_filter( $query ) {
|
517 |
-
global $pagenow;
|
518 |
-
|
519 |
-
if( $pagenow == 'edit.php' && is_admin() && ( isset ( $query->query['post_type'] ) && $query->query['post_type'] == 'nf_sub' ) && is_main_query() ) {
|
520 |
-
|
521 |
-
$qv = &$query->query_vars;
|
522 |
-
|
523 |
-
if( !empty( $_GET['form_id'] ) ) {
|
524 |
-
$form_id = absint($_GET['form_id']);
|
525 |
-
} else {
|
526 |
-
$form_id = 0;
|
527 |
-
}
|
528 |
-
|
529 |
-
$plugin_settings = nf_get_settings();
|
530 |
-
$date_format = $plugin_settings['date_format'];
|
531 |
-
|
532 |
-
if ( !empty ( $_GET['begin_date'] ) ) {
|
533 |
-
$begin_date = nf_get_begin_date( sanitize_text_field($_GET['begin_date']) )->format("Y-m-d G:i:s");
|
534 |
-
} else {
|
535 |
-
$begin_date = '';
|
536 |
-
}
|
537 |
-
|
538 |
-
if ( !empty ( $_GET['end_date'] ) ) {
|
539 |
-
$end_date = nf_get_end_date( sanitize_text_field($_GET['end_date']) )->format("Y-m-d G:i:s");
|
540 |
-
} else {
|
541 |
-
$end_date = '';
|
542 |
-
}
|
543 |
-
|
544 |
-
if ( $begin_date > $end_date ) {
|
545 |
-
$begin_date = new DateTime( $begin_date );
|
546 |
-
$end_date = new DateTime( $end_date );
|
547 |
-
$end_date_temp = $begin_date;
|
548 |
-
$begin_date_temp = $end_date;
|
549 |
-
$begin_date = $begin_date_temp;
|
550 |
-
$end_date = $end_date_temp;
|
551 |
-
$_GET['begin_date'] = $begin_date->format('m/d/Y');
|
552 |
-
$_GET['end_date'] = $end_date->format('m/d/Y');
|
553 |
-
$begin_date = $begin_date->format("Y-m-d G:i:s");
|
554 |
-
$end_date = $end_date->format("Y-m-d G:i:s");
|
555 |
-
}
|
556 |
-
|
557 |
-
if ( ! isset ( $qv['date_query'] ) ) {
|
558 |
-
$qv['date_query'] = array(
|
559 |
-
'after' => $begin_date,
|
560 |
-
'before' => $end_date,
|
561 |
-
);
|
562 |
-
}
|
563 |
-
|
564 |
-
if ( ! isset ( $qv['meta_query'] ) ) {
|
565 |
-
$qv['meta_query'] = array(
|
566 |
-
array(
|
567 |
-
'key' => '_form_id',
|
568 |
-
'value' => $form_id,
|
569 |
-
'compare' => '=',
|
570 |
-
),
|
571 |
-
);
|
572 |
-
}
|
573 |
-
|
574 |
-
$qv = apply_filters( 'nf_subs_table_qv', $qv, $form_id );
|
575 |
-
}
|
576 |
-
}
|
577 |
-
|
578 |
-
/**
|
579 |
-
* Filter our search
|
580 |
-
*
|
581 |
-
* @access public
|
582 |
-
* @since 2.7
|
583 |
-
* @return void
|
584 |
-
*/
|
585 |
-
public function search( $pieces ) {
|
586 |
-
global $typenow;
|
587 |
-
// filter to select search query
|
588 |
-
if ( is_search() && is_admin() && $typenow == 'nf_sub' && isset ( $_GET['s'] ) ) {
|
589 |
-
global $wpdb;
|
590 |
-
|
591 |
-
$keywords = explode(' ', get_query_var('s'));
|
592 |
-
$query = "";
|
593 |
-
|
594 |
-
foreach ($keywords as $word) {
|
595 |
-
|
596 |
-
$wpdb->escape_by_ref( $word );
|
597 |
-
$query .= " (mypm1.meta_value LIKE '%{$word}%') OR ";
|
598 |
-
}
|
599 |
-
|
600 |
-
if (!empty($query)) {
|
601 |
-
// add to where clause
|
602 |
-
// Escape place holders for the where clause.
|
603 |
-
$pieces[ 'where' ] = $wpdb->remove_placeholder_escape( $pieces[ 'where' ] );
|
604 |
-
|
605 |
-
$pieces[ 'where' ] = str_replace("((({$wpdb->posts}.post_title LIKE '%", "({$query}(({$wpdb->posts}.post_title LIKE '%", $pieces[ 'where' ]);
|
606 |
-
|
607 |
-
$pieces[ 'join' ] = $pieces[ 'join' ] . " INNER JOIN {$wpdb->postmeta} AS mypm1 ON ({$wpdb->posts}.ID = mypm1.post_id)";
|
608 |
-
|
609 |
-
}
|
610 |
-
}
|
611 |
-
return ( $pieces );
|
612 |
-
}
|
613 |
-
|
614 |
-
/**
|
615 |
-
* Filter our bulk updated/trashed messages so that it uses "submission" rather than "post"
|
616 |
-
*
|
617 |
-
* @access public
|
618 |
-
* @since 2.7
|
619 |
-
* @return array $bulk_messages
|
620 |
-
*/
|
621 |
-
public function updated_messages_filter( $bulk_messages, $bulk_counts ) {
|
622 |
-
$bulk_messages['nf_sub'] = array(
|
623 |
-
'updated' => _n( '%s submission updated.', '%s submissions updated.', $bulk_counts['updated'], 'ninja-forms' ),
|
624 |
-
'locked' => _n( '%s submission not updated, somebody is editing it.', '%s submissions not updated, somebody is editing them.', $bulk_counts['locked'], 'ninja-forms' ),
|
625 |
-
'deleted' => _n( '%s submission permanently deleted.', '%s submissions permanently deleted.', $bulk_counts['deleted'], 'ninja-forms' ),
|
626 |
-
'trashed' => _n( '%s submission moved to the Trash.', '%s submissions moved to the Trash.', $bulk_counts['trashed'], 'ninja-forms' ),
|
627 |
-
'untrashed' => _n( '%s submission restored from the Trash.', '%s submissions restored from the Trash.', $bulk_counts['untrashed'], 'ninja-forms' ),
|
628 |
-
);
|
629 |
-
|
630 |
-
return $bulk_messages;
|
631 |
-
}
|
632 |
-
|
633 |
-
/**
|
634 |
-
* Filter our updated/trashed post messages
|
635 |
-
*
|
636 |
-
* @access public
|
637 |
-
* @since 2.7
|
638 |
-
* @return array $messages
|
639 |
-
*/
|
640 |
-
function post_updated_messages( $messages ) {
|
641 |
-
|
642 |
-
global $post, $post_ID;
|
643 |
-
$post_type = 'nf_sub';
|
644 |
-
|
645 |
-
$obj = get_post_type_object( $post_type );
|
646 |
-
$singular = $obj->labels->singular_name;
|
647 |
-
|
648 |
-
$messages[$post_type] = array(
|
649 |
-
0 => '', // Unused. Messages start at index 1.
|
650 |
-
1 => sprintf( __( '%s updated.', 'ninja-forms' ), $singular ),
|
651 |
-
2 => __( 'Custom field updated.', 'ninja-forms' ),
|
652 |
-
3 => __( 'Custom field deleted.', 'ninja-forms' ),
|
653 |
-
4 => sprintf( __( '%s updated.', 'ninja-forms' ), $singular ),
|
654 |
-
/* translators: %s: date and time of the revision */
|
655 |
-
5 => isset($_GET['revision']) ? sprintf( __( '%1$s restored to revision from %2$s.', 'ninja-forms' ), $singular, wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
|
656 |
-
6 => sprintf( __( '%s published.', 'ninja-forms' ), $singular ),
|
657 |
-
7 => sprintf( __( '%s saved.', 'ninja-forms' ), $singular ),
|
658 |
-
8 => sprintf( __( '%1$s submitted. <a href="%2$s" target="_blank">Preview %3$s</a>', 'ninja-forms' ), $singular, esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ), $singular ),
|
659 |
-
9 => sprintf( __( '%1$s scheduled for: <strong>%2$s</strong>. <a href="%3$s" target="_blank">Preview %4$s</a>', 'ninja-forms' ), $singular, date_i18n( get_option( 'data_format' ) . ' ' . get_option( 'time_format' ), strtotime( $post->post_date ) ), esc_url( get_permalink($post_ID ) ), $singular ),
|
660 |
-
10 => sprintf( __( '%1$s draft updated. <a href="%2$s" target="_blank">Preview %3$s</a>', 'ninja-forms' ), $singular, esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ), $singular ),
|
661 |
-
);
|
662 |
-
|
663 |
-
return $messages;
|
664 |
-
}
|
665 |
-
|
666 |
-
/**
|
667 |
-
* Remove the 'edit' bulk action
|
668 |
-
*
|
669 |
-
* @access public
|
670 |
-
* @since 2.7
|
671 |
-
* @return array $actions
|
672 |
-
*/
|
673 |
-
public function remove_bulk_edit( $actions ) {
|
674 |
-
unset( $actions['edit'] );
|
675 |
-
return $actions;
|
676 |
-
}
|
677 |
-
|
678 |
-
/**
|
679 |
-
* Add our "export" bulk action
|
680 |
-
*
|
681 |
-
* @access public
|
682 |
-
* @since 2.7
|
683 |
-
* @return void
|
684 |
-
*/
|
685 |
-
public function bulk_admin_footer() {
|
686 |
-
global $post_type;
|
687 |
-
|
688 |
-
if ( ! is_admin() )
|
689 |
-
return false;
|
690 |
-
|
691 |
-
if( $post_type == 'nf_sub' && isset ( $_REQUEST['post_status'] ) && $_REQUEST['post_status'] == 'all' ) {
|
692 |
-
?>
|
693 |
-
<script type="text/javascript">
|
694 |
-
jQuery(document).ready(function() {
|
695 |
-
jQuery('<option>').val('export').text('<?php _e('Export', 'ninja-forms')?>').appendTo("select[name='action']");
|
696 |
-
jQuery('<option>').val('export').text('<?php _e('Export', 'ninja-forms')?>').appendTo("select[name='action2']");
|
697 |
-
<?php
|
698 |
-
if ( ( isset ( $_POST['action'] ) && $_POST['action'] == 'export' ) || ( isset ( $_POST['action2'] ) && $_POST['action2'] == 'export' ) ) {
|
699 |
-
?>
|
700 |
-
setInterval(function(){
|
701 |
-
jQuery( "select[name='action'" ).val( '-1' );
|
702 |
-
jQuery( "select[name='action2'" ).val( '-1' );
|
703 |
-
jQuery( '#posts-filter' ).submit();
|
704 |
-
},5000);
|
705 |
-
<?php
|
706 |
-
}
|
707 |
-
|
708 |
-
if ( isset ( $_REQUEST['form_id'] ) && ! empty ( $_REQUEST['form_id'] ) ) {
|
709 |
-
$redirect = urlencode( remove_query_arg( array( 'download_all', 'download_file' ) ) );
|
710 |
-
$url = admin_url( 'admin.php?page=nf-processing&action=download_all_subs&form_id=' . absint( $_REQUEST['form_id'] ) . '&redirect=' . $redirect );
|
711 |
-
$url = esc_url( $url );
|
712 |
-
?>
|
713 |
-
var button = '<a href="<?php echo $url; ?>" class="button-secondary nf-download-all"><?php echo __( 'Download All Submissions', 'ninja-forms' ); ?></a>';
|
714 |
-
jQuery( '#doaction2' ).after( button );
|
715 |
-
<?php
|
716 |
-
}
|
717 |
-
|
718 |
-
if ( isset ( $_REQUEST['download_all'] ) && $_REQUEST['download_all'] != '' ) {
|
719 |
-
$redirect = esc_url_raw( add_query_arg( array( 'download_file' => esc_html( $_REQUEST['download_all'] ) ) ) );
|
720 |
-
$redirect = remove_query_arg( array( 'download_all' ), $redirect );
|
721 |
-
?>
|
722 |
-
document.location.href = "<?php echo $redirect; ?>";
|
723 |
-
<?php
|
724 |
-
}
|
725 |
-
|
726 |
-
?>
|
727 |
-
});
|
728 |
-
</script>
|
729 |
-
<?php
|
730 |
-
}
|
731 |
-
}
|
732 |
-
|
733 |
-
/**
|
734 |
-
* jQuery that hides some of our post-related page items.
|
735 |
-
* Also adds the active class to All and Trash links, and changes those
|
736 |
-
* links to match the current filter.
|
737 |
-
*
|
738 |
-
* @access public
|
739 |
-
* @since 2.7
|
740 |
-
* @return void
|
741 |
-
*/
|
742 |
-
public function jquery_remove_counts() {
|
743 |
-
global $typenow, $pagenow;
|
744 |
-
if ( $typenow == 'nf_sub' && $pagenow == 'edit.php' ) {
|
745 |
-
// Remove our transient
|
746 |
-
delete_transient( 'nf_sub_edit_ref' );
|
747 |
-
|
748 |
-
if ( ! isset ( $_GET['post_status'] ) || $_GET['post_status'] == 'all' ) {
|
749 |
-
$active = 'all';
|
750 |
-
} else if ( $_GET['post_status'] == 'trash' ) {
|
751 |
-
$active = 'trash';
|
752 |
-
}
|
753 |
-
|
754 |
-
$all_url = esc_url_raw( add_query_arg( array( 'post_status' => 'all' ) ) );
|
755 |
-
$all_url = remove_query_arg( 's', $all_url );
|
756 |
-
$trash_url = esc_url_raw( add_query_arg( array( 'post_status' => 'trash' ) ) );
|
757 |
-
$trash_url = remove_query_arg( 's', $trash_url );
|
758 |
-
if ( isset ( $_GET['form_id'] ) ) {
|
759 |
-
$trashed_sub_count = nf_get_sub_count( absint($_GET['form_id']), 'trash' );
|
760 |
-
} else {
|
761 |
-
$trashed_sub_count = 0;
|
762 |
-
}
|
763 |
-
|
764 |
-
?>
|
765 |
-
<script type="text/javascript">
|
766 |
-
jQuery(function(){
|
767 |
-
jQuery( "li.all" ).find( "a" ).attr( "href", "<?php echo $all_url; ?>" );
|
768 |
-
jQuery( "li.<?php echo $active; ?>" ).addClass( "current" );
|
769 |
-
jQuery( "li.<?php echo $active; ?>" ).find( "a" ).addClass( "current" );
|
770 |
-
jQuery( "li.trash" ).find( "a" ).attr( "href", "<?php echo $trash_url; ?>" );
|
771 |
-
jQuery( ".view-switch" ).remove();
|
772 |
-
<?php
|
773 |
-
if ( $trashed_sub_count == 0 ) {
|
774 |
-
?>
|
775 |
-
var text = jQuery( "li.all" ).prop( "innerHTML" );
|
776 |
-
text = text.replace( " |", "" );
|
777 |
-
jQuery( "li.all" ).prop( "innerHTML", text );
|
778 |
-
<?php
|
779 |
-
}
|
780 |
-
?>
|
781 |
-
});
|
782 |
-
</script>
|
783 |
-
|
784 |
-
<style>
|
785 |
-
.add-new-h2 {
|
786 |
-
display:none;
|
787 |
-
}
|
788 |
-
li.publish {
|
789 |
-
display:none;
|
790 |
-
}
|
791 |
-
select[name=m] {
|
792 |
-
display:none;
|
793 |
-
}
|
794 |
-
</style>
|
795 |
-
<?php
|
796 |
-
} else if ( $typenow == 'nf_sub' && $pagenow == 'post.php' ) {
|
797 |
-
if ( isset ( $_REQUEST['ref'] ) ) {
|
798 |
-
$back_url = esc_url_raw( $_REQUEST['ref'] );
|
799 |
-
} else {
|
800 |
-
$back_url = get_transient( 'nf_sub_edit_ref' );
|
801 |
-
}
|
802 |
-
|
803 |
-
if ( $back_url ) {
|
804 |
-
$back_url = urldecode( $back_url );
|
805 |
-
} else {
|
806 |
-
$back_url = '';
|
807 |
-
}
|
808 |
-
?>
|
809 |
-
<script type="text/javascript">
|
810 |
-
jQuery(function(){
|
811 |
-
var html = '<a href="<?php echo $back_url; ?>" class="back button-secondary"><?php _e( 'Back to list', 'ninja-forms' ); ?></a>';
|
812 |
-
jQuery( 'div.wrap' ).children( 'h2:first' ).append( html );
|
813 |
-
jQuery( 'li#toplevel_page_ninja-forms' ).children( 'a' ).removeClass( 'wp-not-current-submenu' );
|
814 |
-
jQuery( 'li#toplevel_page_ninja-forms' ).removeClass( 'wp-not-current-submenu' );
|
815 |
-
jQuery( 'li#toplevel_page_ninja-forms' ).addClass( 'wp-menu-open wp-has-current-submenu' );
|
816 |
-
jQuery( 'li#toplevel_page_ninja-forms' ).children( 'a' ).addClass( 'wp-menu-open wp-has-current-submenu' );
|
817 |
-
|
818 |
-
});
|
819 |
-
</script>
|
820 |
-
<style>
|
821 |
-
.add-new-h2 {
|
822 |
-
display:none;
|
823 |
-
}
|
824 |
-
</style>
|
825 |
-
|
826 |
-
<?php
|
827 |
-
}
|
828 |
-
}
|
829 |
-
|
830 |
-
/**
|
831 |
-
* Filter our post counts for the submission listing page
|
832 |
-
*
|
833 |
-
* @access public
|
834 |
-
* @since 2.7
|
835 |
-
* @return int $count
|
836 |
-
*/
|
837 |
-
public function count_posts( $count, $post_type, $perm ) {
|
838 |
-
|
839 |
-
// Bail if we aren't working with our custom post type.
|
840 |
-
if ( $post_type != 'nf_sub' )
|
841 |
-
return $count;
|
842 |
-
|
843 |
-
if ( isset ( $_GET['form_id'] ) ) {
|
844 |
-
$sub_count = nf_get_sub_count( absint($_GET['form_id']) );
|
845 |
-
$trashed_sub_count = nf_get_sub_count( absint($_GET['form_id']), 'trash' );
|
846 |
-
$count->publish = $sub_count;
|
847 |
-
$count->trash = $trashed_sub_count;
|
848 |
-
} else {
|
849 |
-
$count->publish = 0;
|
850 |
-
$count->trash = 0;
|
851 |
-
}
|
852 |
-
|
853 |
-
return $count;
|
854 |
-
}
|
855 |
-
|
856 |
-
/**
|
857 |
-
* Add our field editing metabox to the CPT editing page.
|
858 |
-
*
|
859 |
-
* @access public
|
860 |
-
* @since 2.7
|
861 |
-
* @return void
|
862 |
-
*/
|
863 |
-
public function add_metaboxes() {
|
864 |
-
// Remove the 'custom fields' metabox from our CPT edit page
|
865 |
-
remove_meta_box( 'postcustom', 'nf_sub', 'normal' );
|
866 |
-
// Remove the 'slug' metabox from our CPT edit page.
|
867 |
-
remove_meta_box( 'slugdiv', 'nf_sub', 'normal' );
|
868 |
-
// Add our field editing metabox.
|
869 |
-
add_meta_box( 'nf_fields', __( 'User Submitted Values', 'ninja-forms' ), array( $this, 'edit_sub_metabox' ), 'nf_sub', 'normal', 'default');
|
870 |
-
// Add our save field values metabox
|
871 |
-
add_meta_box( 'nf_fields_save', __( 'Submission Stats', 'ninja-forms' ), array( $this, 'save_sub_metabox' ), 'nf_sub', 'side', 'default');
|
872 |
-
|
873 |
-
}
|
874 |
-
|
875 |
-
/**
|
876 |
-
* Output our field editing metabox to the CPT editing page.
|
877 |
-
*
|
878 |
-
* @access public
|
879 |
-
* @since 2.7
|
880 |
-
* @return void
|
881 |
-
*/
|
882 |
-
public function edit_sub_metabox( $post ) {
|
883 |
-
global $ninja_forms_fields;
|
884 |
-
// Get all the post meta
|
885 |
-
$form_id = Ninja_Forms()->sub( $post->ID )->form_id;
|
886 |
-
$fields = Ninja_Forms()->form( $this->form_id )->fields;
|
887 |
-
|
888 |
-
if ( isset ( $_REQUEST['ref'] ) ) {
|
889 |
-
$ref = esc_url_raw( $_REQUEST['ref'] );
|
890 |
-
} else if ( get_transient( 'nf_sub_edit_ref' ) ) {
|
891 |
-
$ref = get_transient( 'nf_sub_edit_ref' );
|
892 |
-
} else {
|
893 |
-
$ref = '';
|
894 |
-
}
|
895 |
-
?>
|
896 |
-
<input type="hidden" name="ref" value="<?php echo $ref; ?>" />
|
897 |
-
<div id="postcustomstuff">
|
898 |
-
<table id="list-table">
|
899 |
-
<thead>
|
900 |
-
<tr>
|
901 |
-
<th class="left"><?php _e( 'Field', 'ninja-forms' ); ?></th>
|
902 |
-
<th><?php _e( 'Value', 'ninja-forms' ); ?></th>
|
903 |
-
</tr>
|
904 |
-
</thead>
|
905 |
-
<tbody id="the-list">
|
906 |
-
<?php
|
907 |
-
// Loop through our post meta and keep our field values
|
908 |
-
foreach ( $fields as $field_id => $field ) {
|
909 |
-
$user_value = Ninja_Forms()->sub( $post->ID )->get_field( $field_id );
|
910 |
-
$field_type = $field['type'];
|
911 |
-
|
912 |
-
if ( isset ( $field['data']['admin_label'] ) && $field['data']['admin_label'] != '' ) {
|
913 |
-
$label = $field['data']['admin_label'];
|
914 |
-
} else if ( isset ( $field['data']['label'] ) ) {
|
915 |
-
$label = $field['data']['label'];
|
916 |
-
} else {
|
917 |
-
$label = '';
|
918 |
-
}
|
919 |
-
|
920 |
-
if ( isset ( $ninja_forms_fields[ $field_type ] ) ) {
|
921 |
-
$reg_field = $ninja_forms_fields[ $field_type ];
|
922 |
-
$process_field = $reg_field['process_field'];
|
923 |
-
} else {
|
924 |
-
$process_field = false;
|
925 |
-
}
|
926 |
-
|
927 |
-
if ( isset ( Ninja_Forms()->form( $this->form_id )->fields[ $field_id ] ) && $process_field ) {
|
928 |
-
?>
|
929 |
-
<tr>
|
930 |
-
<td class="left"><?php echo $label; ?></td>
|
931 |
-
<td>
|
932 |
-
<div class="nf-sub-edit-value type-<?php echo $field_type; ?>">
|
933 |
-
<?php
|
934 |
-
if ( isset ( $reg_field['edit_sub_value'] ) ) {
|
935 |
-
$edit_value_function = $reg_field['edit_sub_value'];
|
936 |
-
} else {
|
937 |
-
$edit_value_function = 'nf_field_text_edit_sub_value';
|
938 |
-
}
|
939 |
-
$args['field_id'] = $field_id;
|
940 |
-
$args['user_value'] = nf_wp_kses_post_deep( $user_value );
|
941 |
-
$args['field'] = $field;
|
942 |
-
$args['sub_id'] = $post->ID;
|
943 |
-
|
944 |
-
call_user_func_array( $edit_value_function, $args );
|
945 |
-
|
946 |
-
?>
|
947 |
-
</div>
|
948 |
-
</td>
|
949 |
-
</tr>
|
950 |
-
<?php
|
951 |
-
}
|
952 |
-
|
953 |
-
}
|
954 |
-
?>
|
955 |
-
</tbody>
|
956 |
-
</table>
|
957 |
-
</div>
|
958 |
-
<?php
|
959 |
-
}
|
960 |
-
|
961 |
-
/**
|
962 |
-
* Output our field editing metabox to the CPT editing page.
|
963 |
-
*
|
964 |
-
* @access public
|
965 |
-
* @since 2.7
|
966 |
-
* @return void
|
967 |
-
*/
|
968 |
-
public function save_sub_metabox( $post ) {
|
969 |
-
$date_submitted = apply_filters( 'nf_edit_sub_date_submitted', date( 'M j, Y @ h:i', strtotime( $post->post_date ) ), $post->ID );
|
970 |
-
$date_modified = apply_filters( 'nf_edit_sub_date_modified', date( 'M j, Y @ h:i', strtotime( $post->post_modified ) ), $post->ID );
|
971 |
-
|
972 |
-
if ( $post->post_author != 0 ) {
|
973 |
-
$user_data = get_userdata( $post->post_author );
|
974 |
-
|
975 |
-
$first_name = $user_data->first_name;
|
976 |
-
$last_name = $user_data->last_name;
|
977 |
-
|
978 |
-
if ( $first_name != '' && $last_name != '' ) {
|
979 |
-
$name = $first_name . ' ' . $last_name;
|
980 |
-
} else if ( $user_data->display_name != '' ) {
|
981 |
-
$name = $user_data->display_name;
|
982 |
-
} else {
|
983 |
-
$name = $user_data->user_login;
|
984 |
-
}
|
985 |
-
|
986 |
-
$name = apply_filters( 'nf_edit_sub_username', $name, $post->post_author );
|
987 |
-
}
|
988 |
-
|
989 |
-
$form_id = Ninja_Forms()->sub( $post->ID )->form_id;
|
990 |
-
$form_title = Ninja_Forms()->form( $form_id )->get_setting( 'form_title' );
|
991 |
-
?>
|
992 |
-
<input type="hidden" name="nf_edit_sub" value="1">
|
993 |
-
<div class="submitbox" id="submitpost">
|
994 |
-
<div id="minor-publishing">
|
995 |
-
<div id="misc-publishing-actions">
|
996 |
-
<div class="misc-pub-section misc-pub-post-status">
|
997 |
-
<label for="post_status"><?php _e( '#', 'ninja-forms' ); ?>:</label>
|
998 |
-
<span id="sub-seq-num-display"><?php echo Ninja_Forms()->sub( $post->ID )->get_seq_num(); ?></span>
|
999 |
-
</div>
|
1000 |
-
<div class="misc-pub-section misc-pub-post-status">
|
1001 |
-
<label for="post_status"><?php _e( 'Status', 'ninja-forms' ); ?>:</label>
|
1002 |
-
<span id="sub-status-display"><?php echo apply_filters( 'nf_sub_edit_status', __( 'Submitted', 'ninja-forms' ), $post->ID ); ?></span>
|
1003 |
-
<?php do_action( 'nf_sub_edit_after_status', $post ); ?>
|
1004 |
-
</div>
|
1005 |
-
<div class="misc-pub-section misc-pub-post-status">
|
1006 |
-
<label for="post_status"><?php _e( 'Form', 'ninja-forms' ); ?>:</label>
|
1007 |
-
<span id="sub-form-title-display"><?php echo $form_title; ?></span>
|
1008 |
-
</div>
|
1009 |
-
<div class="misc-pub-section curtime misc-pub-curtime">
|
1010 |
-
<span id="timestamp">
|
1011 |
-
<?php _e( 'Submitted on', 'ninja-forms' ); ?>: <b><?php echo $date_submitted; ?></b>
|
1012 |
-
</span>
|
1013 |
-
<?php do_action( 'nf_sub_edit_date_submitted', $post ); ?>
|
1014 |
-
</div>
|
1015 |
-
<div class="misc-pub-section curtime misc-pub-curtime">
|
1016 |
-
<span id="timestamp">
|
1017 |
-
<?php _e( 'Modified on', 'ninja-forms', $post ); ?>: <b><?php echo $date_modified; ?></b>
|
1018 |
-
</span>
|
1019 |
-
<?php do_action( 'nf_sub_edit_date_modified', $post ); ?>
|
1020 |
-
</div>
|
1021 |
-
<?php
|
1022 |
-
if ( $post->post_author != 0 ) {
|
1023 |
-
?>
|
1024 |
-
<div class="misc-pub-section misc-pub-visibility" id="visibility">
|
1025 |
-
<?php _e( 'Submitted By', 'ninja-forms' ); ?>: <span id="post-visibility-display"><?php echo $name; ?></span>
|
1026 |
-
</div>
|
1027 |
-
<?php
|
1028 |
-
}
|
1029 |
-
?>
|
1030 |
-
</div>
|
1031 |
-
</div>
|
1032 |
-
<div id="major-publishing-actions">
|
1033 |
-
<div id="delete-action">
|
1034 |
-
|
1035 |
-
<!-- <a class="submitdelete deletion" href="<?php echo get_delete_post_link( $post->ID ); ?>">Move to Trash</a>--></div>
|
1036 |
-
|
1037 |
-
<div id="publishing-action">
|
1038 |
-
<span class="spinner"></span>
|
1039 |
-
<input name="original_publish" type="hidden" id="original_publish" value="<?php _e( 'Update', 'ninja-forms' ); ?>">
|
1040 |
-
<input name="save" type="submit" class="button button-primary button-large" id="publish" accesskey="p" value="<?php _e( 'Update', 'ninja-forms' ); ?>">
|
1041 |
-
</div>
|
1042 |
-
<div class="clear"></div>
|
1043 |
-
</div>
|
1044 |
-
</div>
|
1045 |
-
<?php
|
1046 |
-
}
|
1047 |
-
|
1048 |
-
/**
|
1049 |
-
* Save our submission user values
|
1050 |
-
*
|
1051 |
-
* @access public
|
1052 |
-
* @since 2.7
|
1053 |
-
* @return void
|
1054 |
-
*/
|
1055 |
-
public function save_sub( $sub_id, $post ) {
|
1056 |
-
global $pagenow;
|
1057 |
-
|
1058 |
-
if ( ! isset ( $_POST['nf_edit_sub'] ) || $_POST['nf_edit_sub'] != 1 )
|
1059 |
-
return $sub_id;
|
1060 |
-
|
1061 |
-
// verify if this is an auto save routine.
|
1062 |
-
// If it is our form has not been submitted, so we dont want to do anything
|
1063 |
-
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
|
1064 |
-
return $sub_id;
|
1065 |
-
|
1066 |
-
if ( $pagenow != 'post.php' )
|
1067 |
-
return $sub_id;
|
1068 |
-
|
1069 |
-
if ( $post->post_type != 'nf_sub' )
|
1070 |
-
return $sub_id;
|
1071 |
-
|
1072 |
-
/* Get the post type object. */
|
1073 |
-
$post_type = get_post_type_object( $post->post_type );
|
1074 |
-
|
1075 |
-
/* Check if the current user has permission to edit the post. */
|
1076 |
-
if ( !current_user_can( $post_type->cap->edit_post, $sub_id ) )
|
1077 |
-
return $sub_id;
|
1078 |
-
|
1079 |
-
foreach ( $_POST['fields'] as $field_id => $user_value ) {
|
1080 |
-
$user_value = nf_wp_kses_post_deep( apply_filters( 'nf_edit_sub_user_value', $user_value, $field_id, $sub_id ) );
|
1081 |
-
Ninja_Forms()->sub( $sub_id )->update_field( $field_id, $user_value );
|
1082 |
-
}
|
1083 |
-
|
1084 |
-
set_transient( 'nf_sub_edit_ref', esc_url_raw( $_REQUEST['ref'] ) );
|
1085 |
-
}
|
1086 |
-
|
1087 |
-
/**
|
1088 |
-
* Filter our hidden columns so that they are handled on a per-form basis.
|
1089 |
-
*
|
1090 |
-
* @access public
|
1091 |
-
* @since 2.7
|
1092 |
-
* @return void
|
1093 |
-
*/
|
1094 |
-
public function filter_hidden_columns() {
|
1095 |
-
global $pagenow;
|
1096 |
-
// Bail if we aren't on the edit.php page, we aren't editing our custom post type, or we don't have a form_id set.
|
1097 |
-
if ( $pagenow != 'edit.php' || ! isset ( $_REQUEST['post_type'] ) || $_REQUEST['post_type'] != 'nf_sub' || ! isset ( $_REQUEST['form_id'] ) )
|
1098 |
-
return false;
|
1099 |
-
|
1100 |
-
// Grab our current user.
|
1101 |
-
$user = wp_get_current_user();
|
1102 |
-
// Grab our form id.
|
1103 |
-
$form_id = absint( $_REQUEST['form_id'] );
|
1104 |
-
// Get the columns that should be hidden for this form ID.
|
1105 |
-
$hidden_columns = get_user_option( 'manageedit-nf_subcolumnshidden-form-' . $form_id );
|
1106 |
-
|
1107 |
-
if ( $hidden_columns === false ) {
|
1108 |
-
// If we don't have custom hidden columns set up for this form, then only show the first five columns.
|
1109 |
-
// Get our column headers
|
1110 |
-
$columns = get_column_headers( 'edit-nf_sub' );
|
1111 |
-
$hidden_columns = array();
|
1112 |
-
$x = 0;
|
1113 |
-
foreach ( $columns as $slug => $name ) {
|
1114 |
-
if ( $x > 5 ) {
|
1115 |
-
if ( $slug != 'sub_date' )
|
1116 |
-
$hidden_columns[] = $slug;
|
1117 |
-
}
|
1118 |
-
$x++;
|
1119 |
-
}
|
1120 |
-
}
|
1121 |
-
update_user_option( $user->ID, 'manageedit-nf_subcolumnshidden', $hidden_columns, true );
|
1122 |
-
}
|
1123 |
-
|
1124 |
-
/**
|
1125 |
-
* Save our hidden columns per form id.
|
1126 |
-
*
|
1127 |
-
* @access public
|
1128 |
-
* @since 2.7
|
1129 |
-
* @return void
|
1130 |
-
*/
|
1131 |
-
public function hide_columns() {
|
1132 |
-
// Grab our current user.
|
1133 |
-
$user = wp_get_current_user();
|
1134 |
-
// Grab our form id.
|
1135 |
-
$form_id = absint( $_REQUEST['form_id'] );
|
1136 |
-
$hidden = isset( $_POST['hidden'] ) ? explode( ',', esc_html( $_POST['hidden'] ) ) : array();
|
1137 |
-
$hidden = array_filter( $hidden );
|
1138 |
-
update_user_option( $user->ID, 'manageedit-nf_subcolumnshidden-form-' . $form_id, $hidden, true );
|
1139 |
-
die();
|
1140 |
-
}
|
1141 |
-
|
1142 |
-
/**
|
1143 |
-
* Add custom screen options
|
1144 |
-
*
|
1145 |
-
* @access public
|
1146 |
-
* @since 2.7
|
1147 |
-
* @return void
|
1148 |
-
*/
|
1149 |
-
public function output_screen_options( $status, $args ) {
|
1150 |
-
if ( $args->base == 'edit' && $args->post_type == 'nf_sub' ) {
|
1151 |
-
$status .= '<span id="nf-subs-screen-options">' . $this->screen_options . '</span>';
|
1152 |
-
}
|
1153 |
-
return $status;
|
1154 |
-
}
|
1155 |
-
|
1156 |
-
/**
|
1157 |
-
* Listen for exporting subs
|
1158 |
-
*
|
1159 |
-
* @access public
|
1160 |
-
* @since 2.7.3
|
1161 |
-
* @return void
|
1162 |
-
*/
|
1163 |
-
public function export_listen() {
|
1164 |
-
// Bail if we aren't in the admin
|
1165 |
-
if ( ! is_admin() )
|
1166 |
-
return false;
|
1167 |
-
|
1168 |
-
if ( ! isset ( $_REQUEST['form_id'] ) || empty ( $_REQUEST['form_id'] ) )
|
1169 |
-
return false;
|
1170 |
-
|
1171 |
-
if ( isset ( $_REQUEST['export_single'] ) && ! empty( $_REQUEST['export_single'] ) )
|
1172 |
-
Ninja_Forms()->sub( esc_html( $_REQUEST['export_single'] ) )->export();
|
1173 |
-
|
1174 |
-
if ( ( isset ( $_REQUEST['action'] ) && $_REQUEST['action'] == 'export' ) || ( isset ( $_REQUEST['action2'] ) && $_REQUEST['action2'] == 'export' ) ) {
|
1175 |
-
Ninja_Forms()->subs()->export( ninja_forms_esc_html_deep( $_REQUEST['post'] ) );
|
1176 |
-
}
|
1177 |
-
|
1178 |
-
if ( isset ( $_REQUEST['download_file'] ) && ! empty( $_REQUEST['download_file'] ) ) {
|
1179 |
-
// Open our download all file
|
1180 |
-
$filename = esc_html( $_REQUEST['download_file'] );
|
1181 |
-
|
1182 |
-
$upload_dir = wp_upload_dir();
|
1183 |
-
|
1184 |
-
$file_path = trailingslashit( $upload_dir['path'] ) . $filename . '.csv';
|
1185 |
-
|
1186 |
-
if ( file_exists( $file_path ) ) {
|
1187 |
-
$myfile = file_get_contents ( $file_path );
|
1188 |
-
} else {
|
1189 |
-
$redirect = esc_url_raw( remove_query_arg( array( 'download_file', 'download_all' ) ) );
|
1190 |
-
wp_redirect( $redirect );
|
1191 |
-
die();
|
1192 |
-
}
|
1193 |
-
|
1194 |
-
unlink( $file_path );
|
1195 |
-
|
1196 |
-
$form_name = Ninja_Forms()->form( absint( $_REQUEST['form_id'] ) )->get_setting( 'form_title' );
|
1197 |
-
$form_name = sanitize_title( $form_name );
|
1198 |
-
|
1199 |
-
$today = date( 'Y-m-d', current_time( 'timestamp' ) );
|
1200 |
-
|
1201 |
-
$filename = apply_filters( 'nf_download_all_filename', $form_name . '-all-subs-' . $today );
|
1202 |
-
|
1203 |
-
header( 'Content-type: application/csv');
|
1204 |
-
header( 'Content-Disposition: attachment; filename="'.$filename .'.csv"' );
|
1205 |
-
header( 'Pragma: no-cache');
|
1206 |
-
header( 'Expires: 0' );
|
1207 |
-
|
1208 |
-
echo $myfile;
|
1209 |
-
|
1210 |
-
die();
|
1211 |
-
}
|
1212 |
-
}
|
1213 |
-
|
1214 |
-
/**
|
1215 |
-
* Filter user capabilities
|
1216 |
-
*
|
1217 |
-
* @access public
|
1218 |
-
* @since 2.7.7
|
1219 |
-
* @return void
|
1220 |
-
*/
|
1221 |
-
public function cap_filter( $allcaps, $cap, $args ) {
|
1222 |
-
|
1223 |
-
$sub_cap = apply_filters( 'ninja_forms_admin_submissions_capabilities', 'manage_options' );
|
1224 |
-
|
1225 |
-
if ( ! empty( $allcaps[ $sub_cap ] ) ) {
|
1226 |
-
$allcaps['nf_sub'] = true;
|
1227 |
-
}
|
1228 |
-
|
1229 |
-
return $allcaps;
|
1230 |
-
}
|
1231 |
-
|
1232 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/classes/subs.php
DELETED
@@ -1,283 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
/**
|
3 |
-
* Submissions.
|
4 |
-
* This class handles creating and exporting submissions.
|
5 |
-
*
|
6 |
-
* @package Ninja Forms
|
7 |
-
* @subpackage Classes/Submissions
|
8 |
-
* @copyright Copyright (c) 2014, WPNINJAS
|
9 |
-
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
10 |
-
* @since 2.7
|
11 |
-
*/
|
12 |
-
|
13 |
-
class NF_Subs {
|
14 |
-
|
15 |
-
/**
|
16 |
-
* Get things started
|
17 |
-
*
|
18 |
-
* @access public
|
19 |
-
* @since 2.7
|
20 |
-
* @return void/
|
21 |
-
*/
|
22 |
-
public function __construct() {
|
23 |
-
|
24 |
-
}
|
25 |
-
|
26 |
-
/**
|
27 |
-
* Create a submission.
|
28 |
-
*
|
29 |
-
* @access public
|
30 |
-
* @since 2.7
|
31 |
-
* @return int $sub_id
|
32 |
-
*/
|
33 |
-
public function create( $form_id = '' ) {
|
34 |
-
// Create Submission
|
35 |
-
$post = array(
|
36 |
-
'post_status' => 'publish',
|
37 |
-
'post_type' => 'nf_sub'
|
38 |
-
);
|
39 |
-
$sub_id = wp_insert_post( $post );
|
40 |
-
|
41 |
-
// Add our form ID to the submission
|
42 |
-
Ninja_Forms()->sub( $sub_id )->update_form_id( $form_id );
|
43 |
-
|
44 |
-
// Get the current sequential ID
|
45 |
-
$last_sub = Ninja_Forms()->form( $form_id )->get_setting( 'last_sub', true );
|
46 |
-
$seq_num = ! empty ( $last_sub ) ? $last_sub + 1 : 1;
|
47 |
-
|
48 |
-
$seq_num = apply_filters( 'nf_sub_seq_num', $seq_num, $form_id );
|
49 |
-
|
50 |
-
// Add the sequential ID to the post meta
|
51 |
-
Ninja_Forms()->sub( $sub_id )->update_seq_num( $seq_num );
|
52 |
-
|
53 |
-
// Update our form data with the new "last seq id."
|
54 |
-
Ninja_Forms()->form( $form_id )->update_setting( 'last_sub', $seq_num );
|
55 |
-
|
56 |
-
// Update our sub count
|
57 |
-
Ninja_Forms()->form( $form_id )->sub_count = $seq_num - 1;
|
58 |
-
|
59 |
-
return $sub_id;
|
60 |
-
}
|
61 |
-
|
62 |
-
/**
|
63 |
-
* Get submissions based on specific critera.
|
64 |
-
*
|
65 |
-
* @since 2.7
|
66 |
-
* @param array $args
|
67 |
-
* @return array $sub_ids
|
68 |
-
*/
|
69 |
-
public function get( $args = array() ) {
|
70 |
-
|
71 |
-
$query_args = array(
|
72 |
-
'post_type' => 'nf_sub',
|
73 |
-
'posts_per_page' => -1,
|
74 |
-
'date_query' => array(
|
75 |
-
'inclusive' => true,
|
76 |
-
),
|
77 |
-
);
|
78 |
-
|
79 |
-
if( isset( $args['form_id'] ) ) {
|
80 |
-
$query_args['meta_query'][] = array(
|
81 |
-
'key' => '_form_id',
|
82 |
-
'value' => $args['form_id'],
|
83 |
-
);
|
84 |
-
}
|
85 |
-
|
86 |
-
if( isset( $args['seq_num'] ) ) {
|
87 |
-
$query_args['meta_query'][] = array(
|
88 |
-
'key' => '_seq_num',
|
89 |
-
'value' => $args['seq_num'],
|
90 |
-
);
|
91 |
-
}
|
92 |
-
|
93 |
-
if( isset( $args['user_id'] ) ) {
|
94 |
-
$query_args['author'] = $args['user_id'];
|
95 |
-
}
|
96 |
-
|
97 |
-
if( isset( $args['action'])){
|
98 |
-
$query_args['meta_query'][] = array(
|
99 |
-
'key' => '_action',
|
100 |
-
'value' => $args['action'],
|
101 |
-
);
|
102 |
-
}
|
103 |
-
|
104 |
-
if ( isset ( $args['meta'] ) ) {
|
105 |
-
foreach ( $args['meta'] as $key => $value ) {
|
106 |
-
$query_args['meta_query'][] = array(
|
107 |
-
'key' => $key,
|
108 |
-
'value' => $value,
|
109 |
-
);
|
110 |
-
}
|
111 |
-
}
|
112 |
-
|
113 |
-
if ( isset ( $args['fields'] ) ) {
|
114 |
-
foreach ( $args['fields'] as $field_id => $value ) {
|
115 |
-
$query_args['meta_query'][] = array(
|
116 |
-
'key' => '_field_' . $field_id,
|
117 |
-
'value' => $value,
|
118 |
-
);
|
119 |
-
}
|
120 |
-
}
|
121 |
-
|
122 |
-
if( isset( $args['begin_date'] ) AND $args['begin_date'] != '') {
|
123 |
-
$query_args['date_query']['after'] = nf_get_begin_date( $args['begin_date'] )->format("Y-m-d G:i:s");
|
124 |
-
}
|
125 |
-
|
126 |
-
if( isset( $args['end_date'] ) AND $args['end_date'] != '' ) {
|
127 |
-
$query_args['date_query']['before'] = nf_get_end_date( $args['end_date'] )->format("Y-m-d G:i:s");
|
128 |
-
}
|
129 |
-
|
130 |
-
$subs = new WP_Query( $query_args );;
|
131 |
-
|
132 |
-
$sub_objects = array();
|
133 |
-
|
134 |
-
if ( is_array( $subs->posts ) && ! empty( $subs->posts ) ) {
|
135 |
-
foreach ( $subs->posts as $sub ) {
|
136 |
-
$sub_objects[] = Ninja_Forms()->sub( $sub->ID );
|
137 |
-
}
|
138 |
-
}
|
139 |
-
|
140 |
-
wp_reset_postdata();
|
141 |
-
return $sub_objects;
|
142 |
-
}
|
143 |
-
|
144 |
-
/**
|
145 |
-
* Export submissions.
|
146 |
-
*
|
147 |
-
* @access public
|
148 |
-
* @param array $sub_ids
|
149 |
-
* @param bool @return
|
150 |
-
* @since 2.7
|
151 |
-
* @return void
|
152 |
-
*/
|
153 |
-
public function export( $sub_ids = '', $return = false ){
|
154 |
-
global $ninja_forms_fields;
|
155 |
-
|
156 |
-
// Bail if we haven't been sent any IDs.
|
157 |
-
if ( empty( $sub_ids ) )
|
158 |
-
return false;
|
159 |
-
|
160 |
-
if ( ! is_array( $sub_ids ) )
|
161 |
-
$sub_ids = array( $sub_ids );
|
162 |
-
|
163 |
-
$plugin_settings = nf_get_settings();
|
164 |
-
$date_format = $plugin_settings['date_format'];
|
165 |
-
|
166 |
-
$label_array = array();
|
167 |
-
// Get our Form ID.
|
168 |
-
$form_id = Ninja_Forms()->sub( $sub_ids[0] )->form_id;
|
169 |
-
|
170 |
-
// Get our list of fields.
|
171 |
-
$fields = Ninja_Forms()->form( $form_id )->fields;
|
172 |
-
|
173 |
-
// Add our sequential number.
|
174 |
-
$label_array[0]['_seq_num'] = __( '#', 'ninja-forms' );
|
175 |
-
|
176 |
-
// Add our "Date" label.
|
177 |
-
$label_array[0]['_date_submitted'] = __( 'Date Submitted', 'ninja-forms' );
|
178 |
-
|
179 |
-
$label_array = apply_filters( 'nf_subs_csv_label_array_before_fields', $label_array, $sub_ids );
|
180 |
-
|
181 |
-
foreach ( $fields as $field_id => $field ) {
|
182 |
-
// Get our field type
|
183 |
-
$field_type = $field['type'];
|
184 |
-
// Check to see if our field type has been set as a "process_field".
|
185 |
-
if ( isset ( $ninja_forms_fields[ $field_type ] ) ) {
|
186 |
-
$reg_field = $ninja_forms_fields[ $field_type ];
|
187 |
-
$process_field = $reg_field['process_field'];
|
188 |
-
} else {
|
189 |
-
$process_field = false;
|
190 |
-
}
|
191 |
-
|
192 |
-
// If this field's "process_field" is set to true, then add its label to the array.
|
193 |
-
if ( $process_field ) {
|
194 |
-
if ( isset ( $field['data']['admin_label'] ) && $field['data']['admin_label'] != '' ) {
|
195 |
-
$label = $field['data']['admin_label'];
|
196 |
-
} else if( isset ( $field['data']['label'] ) ) {
|
197 |
-
$label = $field['data']['label'];
|
198 |
-
}else{
|
199 |
-
$label = '';
|
200 |
-
}
|
201 |
-
|
202 |
-
$label_array[0][ $field_id ] = apply_filters( 'nf_subs_csv_field_label', $label, $field_id );
|
203 |
-
}
|
204 |
-
}
|
205 |
-
|
206 |
-
$label_array = ninja_forms_stripslashes_deep( $label_array );
|
207 |
-
$label_array = apply_filters( 'nf_subs_csv_label_array', $label_array, $sub_ids );
|
208 |
-
|
209 |
-
$value_array = array();
|
210 |
-
$x = 0;
|
211 |
-
// Loop through our submissions and create a new row for each one.
|
212 |
-
foreach ( $sub_ids as $sub_id ) {
|
213 |
-
foreach ( $label_array[0] as $field_id => $label ) {
|
214 |
-
// Make sure we aren't working with our date field, which will always have a field id of 0.
|
215 |
-
if ( $field_id !== 0 ) {
|
216 |
-
// Check to see if our field_id is numeric. If it isn't, then we're working with meta, not a field.
|
217 |
-
if ( is_numeric( $field_id ) ) {
|
218 |
-
// We're working with a field, grab the value.
|
219 |
-
$user_value = Ninja_Forms()->sub( $sub_id )->get_field( $field_id );
|
220 |
-
} else if ( '_date_submitted' == $field_id ) {
|
221 |
-
// Get the date of our submission.
|
222 |
-
$date = strtotime( Ninja_Forms()->sub( $sub_id )->date_submitted );
|
223 |
-
// The first item is our date field.
|
224 |
-
$user_value = date( $date_format, $date );
|
225 |
-
} else if ( '_seq_num' == $field_id ) {
|
226 |
-
$user_value = Ninja_Forms()->sub( $sub_id )->get_seq_num();
|
227 |
-
} else {
|
228 |
-
// We're working with a piece of meta, grabe the value.
|
229 |
-
$user_value = Ninja_Forms()->sub( $sub_id )->get_meta( $field_id );
|
230 |
-
}
|
231 |
-
|
232 |
-
// Run our value through the appropriate filters before we flatten any arrays.
|
233 |
-
$user_value = apply_filters( 'nf_subs_export_pre_value', $user_value, $field_id );
|
234 |
-
|
235 |
-
// Implode any arrays we might have.
|
236 |
-
if ( is_array( $user_value ) ) {
|
237 |
-
$user_value = implode( ',', $user_value );
|
238 |
-
}
|
239 |
-
|
240 |
-
// Add an ' to the beginning = sign to prevent any CSV/Excel security issues.
|
241 |
-
if ( strpos( $user_value, '=' ) === 0 ) {
|
242 |
-
$user_value = "'" . $user_value;
|
243 |
-
}
|
244 |
-
|
245 |
-
// Run our final value through the appropriate filters and assign it to the array.
|
246 |
-
$value_array[ $x ][ $field_id ] = htmlspecialchars_decode( apply_filters( 'nf_subs_csv_field_value', $user_value, $field_id ), ENT_QUOTES );
|
247 |
-
}
|
248 |
-
}
|
249 |
-
$x++;
|
250 |
-
}
|
251 |
-
|
252 |
-
$value_array = ninja_forms_stripslashes_deep( $value_array );
|
253 |
-
$value_array = apply_filters( 'nf_subs_csv_value_array', $value_array, $sub_ids );
|
254 |
-
|
255 |
-
$array = array( $label_array, $value_array );
|
256 |
-
$today = date( $date_format, current_time( 'timestamp' ) );
|
257 |
-
$filename = apply_filters( 'nf_subs_csv_filename', 'nf_subs_' . $today );
|
258 |
-
$filename = $filename . ".csv";
|
259 |
-
|
260 |
-
if( $return ){
|
261 |
-
return str_putcsv( $array,
|
262 |
-
apply_filters( 'nf_sub_csv_delimiter', ',' ),
|
263 |
-
apply_filters( 'nf_sub_csv_enclosure', '"' ),
|
264 |
-
apply_filters( 'nf_sub_csv_terminator', "\n" )
|
265 |
-
);
|
266 |
-
}else{
|
267 |
-
header( 'Content-type: application/csv');
|
268 |
-
header( 'Content-Disposition: attachment; filename="'.$filename .'"' );
|
269 |
-
header( 'Pragma: no-cache');
|
270 |
-
header( 'Expires: 0' );
|
271 |
-
echo apply_filters( 'nf_sub_csv_bom',"\xEF\xBB\xBF" ) ; // Byte Order Mark
|
272 |
-
echo str_putcsv( $array,
|
273 |
-
apply_filters( 'nf_sub_csv_delimiter', ',' ),
|
274 |
-
apply_filters( 'nf_sub_csv_enclosure', '"' ),
|
275 |
-
apply_filters( 'nf_sub_csv_terminator', "\n" )
|
276 |
-
);
|
277 |
-
|
278 |
-
die();
|
279 |
-
}
|
280 |
-
|
281 |
-
}
|
282 |
-
|
283 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/css/fonts.css
DELETED
@@ -1,51 +0,0 @@
|
|
1 |
-
@font-face {
|
2 |
-
font-family: 'ninjaforms';
|
3 |
-
src: url('../fonts/ninjaforms.eot');
|
4 |
-
src: local('☺'), url('../fonts/ninjaforms.woff') format('woff'), url('../fonts/ninjaforms.ttf') format('truetype'), url('../fonts/ninjaforms.svg') format('svg');
|
5 |
-
font-weight: normal;
|
6 |
-
font-style: normal;
|
7 |
-
}
|
8 |
-
|
9 |
-
/* dashboard icon */
|
10 |
-
#toplevel_page_ninja-forms .wp-menu-image img {
|
11 |
-
display: none;
|
12 |
-
}
|
13 |
-
#toplevel_page_ninja-forms .wp-menu-image:before {
|
14 |
-
font-family: 'ninjaforms'!important; /* this assumes you've loaded Genericons in your admin */
|
15 |
-
content: 'a'; /* replace this with your icon */
|
16 |
-
font-size: 20px;
|
17 |
-
position: relative;
|
18 |
-
left: 5px; /* positions the icon */
|
19 |
-
top: 4px; /* positions the icon */
|
20 |
-
color: #aaa;
|
21 |
-
}
|
22 |
-
.branch-3-8 #toplevel_page_ninja-forms .wp-menu-image:before,
|
23 |
-
.branch-3-9 #toplevel_page_ninja-forms .wp-menu-image:before {
|
24 |
-
left: 0; /* positions the icon */
|
25 |
-
top: 0; /* positions the icon */
|
26 |
-
}
|
27 |
-
#toplevel_page_ninja-forms:hover .wp-menu-image:before, .wp-has-current-submenu#toplevel_page_ninja-forms .wp-menu-image:before {
|
28 |
-
color: #21759b;
|
29 |
-
}
|
30 |
-
div#icon-edit.icon32-posts-book-review {
|
31 |
-
background-image: none;
|
32 |
-
}
|
33 |
-
div#icon-edit.icon32-posts-book-review:after {
|
34 |
-
font-family: 'ninjaforms'!important;
|
35 |
-
content: 'a'; /* replace this with your icon */
|
36 |
-
color: #555;
|
37 |
-
font-size: 32px;
|
38 |
-
position: relative;
|
39 |
-
top: -5px; /* positions the icon */
|
40 |
-
left: 5px; /* positions the icon */
|
41 |
-
}
|
42 |
-
|
43 |
-
/* this adds support for MP6 & future WP (3.7/8, whichever gets the dashboard css update) */
|
44 |
-
/* this is largely thanks to: https://github.com/Gizburdt/Wordpress-Cuztom-Helper/issues/152#issuecomment-17490472 */
|
45 |
-
.mp6 #adminmenu #toplevel_page_ninja-forms div.wp-menu-image:before {
|
46 |
-
font-family: 'ninjaforms'!important;
|
47 |
-
content: 'a'; /* replace this with your icon */
|
48 |
-
left: 0; /* resets the positioning for MP6/future WP */
|
49 |
-
top: 0; /* resets the positioning for MP6/future WP */
|
50 |
-
text-shadow: none;
|
51 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/css/index.php
DELETED
@@ -1,2 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
// Silence is golden.
|
|
|
|
deprecated/css/jquery.rating.css
DELETED
@@ -1,52 +0,0 @@
|
|
1 |
-
/* jQuery.Rating Plugin CSS - http://www.fyneworks.com/jquery/star-rating/ */
|
2 |
-
.rating-cancel,
|
3 |
-
.ninja-forms-star-rating {
|
4 |
-
float: left;
|
5 |
-
text-indent: -999em;
|
6 |
-
}
|
7 |
-
.rating-cancel,
|
8 |
-
.rating-cancel a {
|
9 |
-
background: url(../images/delete.gif) no-repeat 0 -16px
|
10 |
-
}
|
11 |
-
.ninja-forms-star-rating a {
|
12 |
-
background: url(../images/star.gif) no-repeat 0 0px
|
13 |
-
}
|
14 |
-
.rating-cancel a,
|
15 |
-
.ninja-forms-star-rating a {
|
16 |
-
background-position: 0 0px;
|
17 |
-
border: 0;
|
18 |
-
cursor: pointer;
|
19 |
-
display: block;
|
20 |
-
margin-right: 2px;
|
21 |
-
width: 17px;
|
22 |
-
height: 15px;
|
23 |
-
overflow: hidden
|
24 |
-
}
|
25 |
-
.ninja-forms-star-rating-on a {
|
26 |
-
background-position: 0 -16px;
|
27 |
-
}
|
28 |
-
.ninja-forms-star-rating-hover a {
|
29 |
-
background-position: 0 -32px
|
30 |
-
}
|
31 |
-
.rating-cancel a:hover {
|
32 |
-
background-position: 0 -32px
|
33 |
-
}
|
34 |
-
/* Read Only CSS */
|
35 |
-
.ninja-forms-star-rating-readonly a {
|
36 |
-
cursor: default !important;
|
37 |
-
}
|
38 |
-
/* Partial Star CSS */
|
39 |
-
.ninja-forms-star-rating {
|
40 |
-
background: transparent !important;
|
41 |
-
overflow: hidden!important
|
42 |
-
}
|
43 |
-
/* END jQuery.Rating Plugin CSS */
|
44 |
-
|
45 |
-
.ninja-forms-star-rating-control {
|
46 |
-
display: inline-block;
|
47 |
-
}
|
48 |
-
.ninja-forms-star-rating-control:after {
|
49 |
-
clear: both;
|
50 |
-
content: "";
|
51 |
-
display: block;
|
52 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/css/ninja-forms-admin.css
DELETED
@@ -1,962 +0,0 @@
|
|
1 |
-
/* ---------------------------------
|
2 |
-
/ Generic styles & classes
|
3 |
-
----------------------------------*/
|
4 |
-
.nf-box {
|
5 |
-
background: #fff;
|
6 |
-
border: 1px solid #ccc;
|
7 |
-
border-radius: 4px;
|
8 |
-
padding: 10px;
|
9 |
-
}
|
10 |
-
|
11 |
-
|
12 |
-
/* ---------------------------------
|
13 |
-
/ Styles for specific admin pages
|
14 |
-
----------------------------------*/
|
15 |
-
|
16 |
-
.no-padding {
|
17 |
-
padding: 0 !important;
|
18 |
-
}
|
19 |
-
|
20 |
-
div.field-wrap.list-wrap {
|
21 |
-
display: block;
|
22 |
-
}
|
23 |
-
#wpwrap:after {
|
24 |
-
content: "";
|
25 |
-
clear: both;
|
26 |
-
display: table;
|
27 |
-
}
|
28 |
-
.ninja-forms-save-data {
|
29 |
-
clear: both;
|
30 |
-
float: none;
|
31 |
-
}
|
32 |
-
#nav-menus-frame .ninja-forms-new-field,
|
33 |
-
#nav-menus-frame .ninja-forms-insert-def-field,
|
34 |
-
#nav-menus-frame .ninja-forms-insert-fav-field {
|
35 |
-
display: block;
|
36 |
-
text-align: center;
|
37 |
-
}
|
38 |
-
|
39 |
-
a.ninja-forms-field-add-fav {
|
40 |
-
display: block;
|
41 |
-
text-decoration: none;
|
42 |
-
color: #444;
|
43 |
-
}
|
44 |
-
|
45 |
-
a.ninja-forms-field-add-fav:hover span:before {
|
46 |
-
content: "\f155";
|
47 |
-
}
|
48 |
-
|
49 |
-
a.ninja-forms-field-add-fav span:before {
|
50 |
-
content: "\f154";
|
51 |
-
}
|
52 |
-
|
53 |
-
a.ninja-forms-field-remove-fav {
|
54 |
-
display: block;
|
55 |
-
text-decoration: none;
|
56 |
-
color: #444;
|
57 |
-
}
|
58 |
-
|
59 |
-
a.ninja-forms-field-remove-fav:hover span:before {
|
60 |
-
content: "\f154";
|
61 |
-
}
|
62 |
-
|
63 |
-
a.ninja-forms-field-remove-fav span:before {
|
64 |
-
content: "\f155";
|
65 |
-
}
|
66 |
-
|
67 |
-
#editor-toolbar #edButtonHTML, #ed_toolbar, #edButtonPreview {
|
68 |
-
display: none;
|
69 |
-
}
|
70 |
-
#menu-management-liquid #menu-management .menu-edit,
|
71 |
-
#menu-management-liquid #menu-management #nav-menu-header,
|
72 |
-
#menu-management-liquid #menu-management #nav-menu-footer,
|
73 |
-
#menu-management-liquid #menu-management .menu-item-settings {
|
74 |
-
border-color: #DFDFDF;
|
75 |
-
margin: 0;
|
76 |
-
}
|
77 |
-
.nav-menus-php #post-body-content {
|
78 |
-
float: left;
|
79 |
-
}
|
80 |
-
#post-body-content .description{
|
81 |
-
margin-top: 10px;
|
82 |
-
margin-bottom: 10px;
|
83 |
-
}
|
84 |
-
|
85 |
-
#post-body-content .description-wide{
|
86 |
-
width: 500px;
|
87 |
-
}
|
88 |
-
#post-body-content .description-thin{
|
89 |
-
width: 240px;
|
90 |
-
}
|
91 |
-
#post-body-content .menu-item-handle{
|
92 |
-
width: 510px;
|
93 |
-
}
|
94 |
-
#post-body-content .menu-item-settings{
|
95 |
-
width: 500px;
|
96 |
-
padding: 10px;
|
97 |
-
}
|
98 |
-
#post-body-content .checkbox {
|
99 |
-
background: none;
|
100 |
-
}
|
101 |
-
.postbox {
|
102 |
-
margin: 5px 0;
|
103 |
-
}
|
104 |
-
.postbox .inside, .stuffbox .inside {
|
105 |
-
padding: 5px 10px 10px;
|
106 |
-
}
|
107 |
-
.postbox .inside::after, .stuffbox .inside::after {
|
108 |
-
clear: both;
|
109 |
-
content: "";
|
110 |
-
display: block;
|
111 |
-
}
|
112 |
-
#menu-settings-column .button-controls {
|
113 |
-
clear: none;
|
114 |
-
float: left;
|
115 |
-
width: 46%;
|
116 |
-
margin: 0 2% 3px 2% !important;
|
117 |
-
padding: 0;
|
118 |
-
}
|
119 |
-
|
120 |
-
#menu-settings-column .button-controls a.button {
|
121 |
-
/*border: 1px solid #999;
|
122 |
-
display: block;
|
123 |
-
margin: 0;
|
124 |
-
padding: 0;*/
|
125 |
-
text-align: center;
|
126 |
-
width: 96%;
|
127 |
-
}
|
128 |
-
|
129 |
-
#menu-settings-column .field-controls {
|
130 |
-
margin: 0;
|
131 |
-
padding: 0;
|
132 |
-
}
|
133 |
-
|
134 |
-
.ninja-forms-field-list-options {
|
135 |
-
margin-bottom: 10px;
|
136 |
-
}
|
137 |
-
|
138 |
-
.list-options {
|
139 |
-
background: #fcfcfc;
|
140 |
-
border-bottom: 1px solid #ddd;
|
141 |
-
padding: 2px 10px;
|
142 |
-
width: 100%;
|
143 |
-
}
|
144 |
-
|
145 |
-
#field-info {
|
146 |
-
padding-top:10px;
|
147 |
-
width: 100%;
|
148 |
-
}
|
149 |
-
.nf-preview {
|
150 |
-
margin-left: 10px !important;
|
151 |
-
}
|
152 |
-
.nav-menus-php .item-edit {
|
153 |
-
border-bottom-color: transparent;
|
154 |
-
}
|
155 |
-
#side-sortables .item-edit {
|
156 |
-
color: #fff;
|
157 |
-
top: -4px;
|
158 |
-
}
|
159 |
-
#side-sortables .item-edit::before {
|
160 |
-
color: #ccc !important;
|
161 |
-
}
|
162 |
-
#ninja_forms_admin_metaboxes .item-edit {
|
163 |
-
top: -4px;
|
164 |
-
text-indent: -9999px;
|
165 |
-
}
|
166 |
-
#ninja_forms_admin_metaboxes .item-edit::before {
|
167 |
-
position: absolute;
|
168 |
-
top: 6px;
|
169 |
-
right: 10px;
|
170 |
-
}
|
171 |
-
#ninja_forms_admin_metaboxes textarea {
|
172 |
-
min-height: 100px;
|
173 |
-
padding: 5px;
|
174 |
-
width: 100%;
|
175 |
-
}
|
176 |
-
|
177 |
-
.menu-item-settings.list li {
|
178 |
-
display:block;
|
179 |
-
}
|
180 |
-
.ninja_error {
|
181 |
-
border: 1px solid red;
|
182 |
-
}
|
183 |
-
.widefat {
|
184 |
-
padding: 5px;
|
185 |
-
}
|
186 |
-
|
187 |
-
.wrap-left {
|
188 |
-
float: left;
|
189 |
-
width: 60%;
|
190 |
-
}
|
191 |
-
.wrap-right {
|
192 |
-
background: #464646;
|
193 |
-
color: #fff;
|
194 |
-
float: right;
|
195 |
-
margin: 0 auto;
|
196 |
-
padding: 10px;
|
197 |
-
width: 263px;
|
198 |
-
}
|
199 |
-
.wrap-right img {
|
200 |
-
margin: 0 auto;
|
201 |
-
}
|
202 |
-
.wrap-right h2 {
|
203 |
-
color: #fff;
|
204 |
-
text-shadow: black 0 1px 0;
|
205 |
-
}
|
206 |
-
.wrap-right ul {
|
207 |
-
background: #fff;
|
208 |
-
color: #333;
|
209 |
-
list-style: disc;
|
210 |
-
list-style-position: inside;
|
211 |
-
padding: 20px;
|
212 |
-
}
|
213 |
-
|
214 |
-
.form-section {
|
215 |
-
background: #F4F4F4;
|
216 |
-
border: 1px solid #DFDFDF;
|
217 |
-
margin-bottom: 10px;
|
218 |
-
padding: 20px;
|
219 |
-
}
|
220 |
-
#plugin_settings_upload_size {
|
221 |
-
text-align:right;
|
222 |
-
}
|
223 |
-
#icon-ninja-custom-forms {
|
224 |
-
background-image: url('../images/wpnj-ninja-head.png') !important;
|
225 |
-
}
|
226 |
-
|
227 |
-
#poststuff {
|
228 |
-
padding: 10px;
|
229 |
-
}
|
230 |
-
|
231 |
-
#poststuff .ninja-forms-field-list .inside {
|
232 |
-
margin: 0;
|
233 |
-
}
|
234 |
-
|
235 |
-
#poststuff #post-body {
|
236 |
-
border: 0;
|
237 |
-
}
|
238 |
-
#poststuff h2 {
|
239 |
-
margin-top: 0;
|
240 |
-
}
|
241 |
-
.forms_page_ninja-forms-subs #poststuff {
|
242 |
-
float: left;
|
243 |
-
}
|
244 |
-
.menu {
|
245 |
-
padding-top: 0;
|
246 |
-
}
|
247 |
-
|
248 |
-
#poststuff h3.section-title {
|
249 |
-
background: #F4F4F4;
|
250 |
-
border-style: solid;
|
251 |
-
border-color: #DFDFDF #DFDFDF white;
|
252 |
-
border-width: 1px 1px 0;
|
253 |
-
color: #AAA;
|
254 |
-
text-shadow: rgba(255, 255, 255, 1) 0 1px 0;
|
255 |
-
font-size: 12px;
|
256 |
-
line-height: 16px;
|
257 |
-
display: inline-block;
|
258 |
-
padding: 4px 14px 6px;
|
259 |
-
text-decoration: none;
|
260 |
-
margin: 0 6px -1px 0;
|
261 |
-
-moz-border-radius: 3px 3px 0 0;
|
262 |
-
-webkit-border-top-left-radius: 3px;
|
263 |
-
-webkit-border-top-right-radius: 3px;
|
264 |
-
-khtml-border-top-left-radius: 3px;
|
265 |
-
-khtml-border-top-right-radius: 3px;
|
266 |
-
border-top-left-radius: 3px;
|
267 |
-
border-top-right-radius: 3px;
|
268 |
-
}
|
269 |
-
|
270 |
-
#layout-elements {
|
271 |
-
background-color: whiteSmoke;
|
272 |
-
border-color: #444;
|
273 |
-
-moz-box-shadow: inset 0 1px 0 #666666;
|
274 |
-
-webkit-box-shadow: inset 0 1px 0 #666666;
|
275 |
-
box-shadow: inset 0 1px 0 #666666;
|
276 |
-
-moz-border-radius: 3px;
|
277 |
-
-khtml-border-radius: 3px;
|
278 |
-
-webkit-border-radius: 3px;
|
279 |
-
border-radius: 3px;
|
280 |
-
}
|
281 |
-
#layout-elements h3 {
|
282 |
-
background-color: #777777;
|
283 |
-
background-image: -ms-linear-gradient(bottom,#666666,#777777);
|
284 |
-
background-image: -moz-linear-gradient(bottom,#666666,#777777);
|
285 |
-
background-image: -o-linear-gradient(bottom,#666666,#777777);
|
286 |
-
background-image: -webkit-gradient(linear,left bottom,left top,from(#666666),to(#777777));
|
287 |
-
background-image: -webkit-linear-gradient(bottom,#666666,#777777);
|
288 |
-
background-image: linear-gradient(bottom,#666666,#777777);
|
289 |
-
border-bottom-color: #444;
|
290 |
-
-moz-box-shadow: inset 0 1px 0 #777777;
|
291 |
-
-webkit-box-shadow: inset 0 1px 0 #777777;
|
292 |
-
box-shadow: inset 0 1px 0 #777777;
|
293 |
-
color: #fff;
|
294 |
-
text-shadow: 0 1px 0 #000;
|
295 |
-
}
|
296 |
-
|
297 |
-
.menu-item-handle.heading,
|
298 |
-
.menu-item-handle.desc,
|
299 |
-
.menu-item-handle.hr {
|
300 |
-
background-color: #777777;
|
301 |
-
background-image: -ms-linear-gradient(bottom,#666666,#777777);
|
302 |
-
background-image: -moz-linear-gradient(bottom,#666666,#777777);
|
303 |
-
background-image: -o-linear-gradient(bottom,#666666,#777777);
|
304 |
-
background-image: -webkit-gradient(linear,left bottom,left top,from(#666666),to(#777777));
|
305 |
-
background-image: -webkit-linear-gradient(bottom,#666666,#777777);
|
306 |
-
background-image: linear-gradient(bottom,#666666,#777777);
|
307 |
-
border: 1px solid #444;
|
308 |
-
-moz-box-shadow: inset 0 1px 0 #999;
|
309 |
-
-webkit-box-shadow: inset 0 1px 0 #999;
|
310 |
-
box-shadow: inset 0 1px 0 #999;
|
311 |
-
}
|
312 |
-
.menu-item-handle.heading .item-title,
|
313 |
-
.menu-item-handle.desc .item-title,
|
314 |
-
.menu-item-handle.hr .item-title {
|
315 |
-
color: #fff;
|
316 |
-
font-size: 12px;
|
317 |
-
font-weight: bold;
|
318 |
-
padding: 7px 0;
|
319 |
-
line-height: 20px;
|
320 |
-
display: block;
|
321 |
-
margin-right: 13em;
|
322 |
-
text-shadow: 0 1px 0 #000;
|
323 |
-
}
|
324 |
-
.menu-item-handle.heading .item-controls,
|
325 |
-
.menu-item-handle.desc .item-controls,
|
326 |
-
.menu-item-handle.hr .item-controls {
|
327 |
-
color: #eee;
|
328 |
-
font-size: 12px;
|
329 |
-
position: absolute;
|
330 |
-
right: 20px;
|
331 |
-
top: -1px;
|
332 |
-
text-shadow: 0 1px 0 #000;
|
333 |
-
}
|
334 |
-
.menu-item-handle.heading .item-type,
|
335 |
-
.menu-item-handle.desc .item-type,
|
336 |
-
.menu-item-handle.hr .item-type {
|
337 |
-
color: #eee;
|
338 |
-
text-shadow: 0 1px 0 #000;
|
339 |
-
}
|
340 |
-
.menu-item-settings.heading,
|
341 |
-
.menu-item-settings.desc,
|
342 |
-
.menu-item-settings.hr {
|
343 |
-
background-color: whiteSmoke;
|
344 |
-
border: 1px solid #444;
|
345 |
-
}
|
346 |
-
|
347 |
-
#multi-part {
|
348 |
-
background-color: whiteSmoke;
|
349 |
-
border-color: #a23511;
|
350 |
-
-moz-box-shadow: inset 0 1px 0 #b94119;
|
351 |
-
-webkit-box-shadow: inset 0 1px 0 #b94119;
|
352 |
-
box-shadow: inset 0 1px 0 #b94119;
|
353 |
-
-moz-border-radius: 3px;
|
354 |
-
-khtml-border-radius: 3px;
|
355 |
-
-webkit-border-radius: 3px;
|
356 |
-
border-radius: 3px;
|
357 |
-
}
|
358 |
-
#multi-part h3 {
|
359 |
-
background-color: #d54e21;
|
360 |
-
background-image: -ms-linear-gradient(bottom,#b94119,#d54e21);
|
361 |
-
background-image: -moz-linear-gradient(bottom,#b94119,#d54e21);
|
362 |
-
background-image: -o-linear-gradient(bottom,#b94119,#d54e21);
|
363 |
-
background-image: -webkit-gradient(linear,left bottom,left top,from(#b94119),to(#d54e21));
|
364 |
-
background-image: -webkit-linear-gradient(bottom,#b94119,#d54e21);
|
365 |
-
background-image: linear-gradient(bottom,#b94119,#d54e21);
|
366 |
-
border-bottom-color: #a23511;
|
367 |
-
-moz-box-shadow: inset 0 1px 0 #d54e21;
|
368 |
-
-webkit-box-shadow: inset 0 1px 0 #d54e21;
|
369 |
-
box-shadow: inset 0 1px 0 #d54e21;
|
370 |
-
color: #fff;
|
371 |
-
text-shadow: 0 1px 0 #000;
|
372 |
-
}
|
373 |
-
#multi-part .howto, #multi-part label, #multi-part .button-controls {
|
374 |
-
color: #666;
|
375 |
-
}
|
376 |
-
|
377 |
-
.menu-item-handle.steps,
|
378 |
-
.menu-item-handle.progressbar,
|
379 |
-
.menu-item-handle.divider {
|
380 |
-
background-color: #d54e21;
|
381 |
-
background-image: -ms-linear-gradient(bottom,#b94119,#d54e21);
|
382 |
-
background-image: -moz-linear-gradient(bottom,#b94119,#d54e21);
|
383 |
-
background-image: -o-linear-gradient(bottom,#b94119,#d54e21);
|
384 |
-
background-image: -webkit-gradient(linear,left bottom,left top,from(#b94119),to(#d54e21));
|
385 |
-
background-image: -webkit-linear-gradient(bottom,#b94119,#d54e21);
|
386 |
-
background-image: linear-gradient(bottom,#b94119,#d54e21);
|
387 |
-
border: 1px solid #a23511;
|
388 |
-
-moz-box-shadow: inset 0 1px 0 #eb5e2f;
|
389 |
-
-webkit-box-shadow: inset 0 1px 0 #eb5e2f;
|
390 |
-
box-shadow: inset 0 1px 0 #eb5e2f;
|
391 |
-
}
|
392 |
-
.menu-item-handle.steps .item-title,
|
393 |
-
.menu-item-handle.progressbar .item-title,
|
394 |
-
.menu-item-handle.divider .item-title {
|
395 |
-
color: #fff;
|
396 |
-
font-size: 12px;
|
397 |
-
font-weight: bold;
|
398 |
-
padding: 7px 0;
|
399 |
-
line-height: 20px;
|
400 |
-
display: block;
|
401 |
-
margin-right: 13em;
|
402 |
-
text-shadow: 0 1px 0 #000;
|
403 |
-
}
|
404 |
-
.menu-item-handle.steps .item-controls,
|
405 |
-
.menu-item-handle.progressbar .item-controls,
|
406 |
-
.menu-item-handle.divider .item-controls {
|
407 |
-
color: #eee;
|
408 |
-
font-size: 12px;
|
409 |
-
position: absolute;
|
410 |
-
right: 20px;
|
411 |
-
top: -1px;
|
412 |
-
text-shadow: 0 1px 0 #000;
|
413 |
-
}
|
414 |
-
.menu-item-handle.steps .item-type,
|
415 |
-
.menu-item-handle.progressbar .item-type,
|
416 |
-
.menu-item-handle.divider .item-type {
|
417 |
-
color: #eee;
|
418 |
-
text-shadow: 0 1px 0 #000;
|
419 |
-
}
|
420 |
-
.menu-item-settings.steps,
|
421 |
-
.menu-item-settings.progressbar,
|
422 |
-
.menu-item-settings.divider {
|
423 |
-
background-color: whiteSmoke;
|
424 |
-
border: 1px solid #a23511;
|
425 |
-
}
|
426 |
-
|
427 |
-
#defined-fields {
|
428 |
-
background-color: whiteSmoke;
|
429 |
-
border-color: #12516e;
|
430 |
-
-moz-box-shadow: inset 0 1px 0 #1a6485;
|
431 |
-
-webkit-box-shadow: inset 0 1px 0 #1a6485;
|
432 |
-
box-shadow: inset 0 1px 0 #1a6485;
|
433 |
-
-moz-border-radius: 3px;
|
434 |
-
-khtml-border-radius: 3px;
|
435 |
-
-webkit-border-radius: 3px;
|
436 |
-
border-radius: 3px;
|
437 |
-
}
|
438 |
-
#defined-fields h3 {
|
439 |
-
background-color: #21759b;
|
440 |
-
background-image: -ms-linear-gradient(bottom,#1a6485,#21759b);
|
441 |
-
background-image: -moz-linear-gradient(bottom,#1a6485,#21759b);
|
442 |
-
background-image: -o-linear-gradient(bottom,#1a6485,#d54e21);
|
443 |
-
background-image: -webkit-gradient(linear,left bottom,left top,from(#1a6485),to(#21759b));
|
444 |
-
background-image: -webkit-linear-gradient(bottom,#1a6485,#21759b);
|
445 |
-
background-image: linear-gradient(bottom,#1a6485,#21759b);
|
446 |
-
border-bottom-color: #12516e;
|
447 |
-
-moz-box-shadow: inset 0 1px 0 #21759b;
|
448 |
-
-webkit-box-shadow: inset 0 1px 0 #21759b;
|
449 |
-
box-shadow: inset 0 1px 0 #21759b;
|
450 |
-
color: #fff;
|
451 |
-
text-shadow: 0 1px 0 #000;
|
452 |
-
}
|
453 |
-
#defined-fields .howto, #defined-fields label, #defined-fields .button-controls {
|
454 |
-
color: #666;
|
455 |
-
}
|
456 |
-
|
457 |
-
.menu-item-handle.spam,
|
458 |
-
.menu-item-handle.submitbutton {
|
459 |
-
background-color: #21759b;
|
460 |
-
background-image: -ms-linear-gradient(bottom,#1a6485,#21759b);
|
461 |
-
background-image: -moz-linear-gradient(bottom,#1a6485,#21759b);
|
462 |
-
background-image: -o-linear-gradient(bottom,#1a6485,#d54e21);
|
463 |
-
background-image: -webkit-gradient(linear,left bottom,left top,from(#1a6485),to(#21759b));
|
464 |
-
background-image: -webkit-linear-gradient(bottom,#1a6485,#21759b);
|
465 |
-
background-image: linear-gradient(bottom,#1a6485,#21759b);
|
466 |
-
border: 1px solid #12516e;
|
467 |
-
-moz-box-shadow: inset 0 1px 0 #3593bd;
|
468 |
-
-webkit-box-shadow: inset 0 1px 0 #3593bd;
|
469 |
-
box-shadow: inset 0 1px 0 #3593bd;
|
470 |
-
}
|
471 |
-
.menu-item-handle.spam .item-title,
|
472 |
-
.menu-item-handle.submitbutton .item-title {
|
473 |
-
color: #fff;
|
474 |
-
font-size: 12px;
|
475 |
-
font-weight: bold;
|
476 |
-
padding: 7px 0;
|
477 |
-
line-height: 20px;
|
478 |
-
display: block;
|
479 |
-
margin-right: 13em;
|
480 |
-
text-shadow: 0 1px 0 #000;
|
481 |
-
}
|
482 |
-
.menu-item-handle.spam .item-controls,
|
483 |
-
.menu-item-handle.submitbutton .item-controls {
|
484 |
-
color: #eee;
|
485 |
-
font-size: 12px;
|
486 |
-
position: absolute;
|
487 |
-
right: 20px;
|
488 |
-
top: -1px;
|
489 |
-
text-shadow: 0 1px 0 #000;
|
490 |
-
}
|
491 |
-
.menu-item-handle.spam .item-type,
|
492 |
-
.menu-item-handle.submitbutton .item-type {
|
493 |
-
color: #eee;
|
494 |
-
text-shadow: 0 1px 0 #000;
|
495 |
-
}
|
496 |
-
.menu-item-settings.spam,
|
497 |
-
.menu-item-settings.submitbutton {
|
498 |
-
background-color: whiteSmoke;
|
499 |
-
border: 1px solid #12516e;
|
500 |
-
}
|
501 |
-
|
502 |
-
#post-elements {
|
503 |
-
background-color: whiteSmoke;
|
504 |
-
border-color: #83acd0;
|
505 |
-
-moz-box-shadow: inset 0 1px 0 #e6f3fe;
|
506 |
-
-webkit-box-shadow: inset 0 1px 0 #e6f3fe;
|
507 |
-
box-shadow: inset 0 1px 0 #e6f3fe;
|
508 |
-
-moz-border-radius: 3px;
|
509 |
-
-khtml-border-radius: 3px;
|
510 |
-
-webkit-border-radius: 3px;
|
511 |
-
border-radius: 3px;
|
512 |
-
}
|
513 |
-
#post-elements h3 {
|
514 |
-
background-color: #D3E7F8;
|
515 |
-
background-image: -ms-linear-gradient(top,#e6f3fe,#D3E7F8);
|
516 |
-
background-image: -moz-linear-gradient(top,#e6f3fe,#D3E7F8);
|
517 |
-
background-image: -o-linear-gradient(top,#e6f3fe,#d54e21);
|
518 |
-
background-image: -webkit-gradient(linear,left top,left bottom,from(#e6f3fe),to(#D3E7F8));
|
519 |
-
background-image: -webkit-linear-gradient(top,#e6f3fe,#D3E7F8);
|
520 |
-
background-image: linear-gradient(top,#e6f3fe,#D3E7F8);
|
521 |
-
border-bottom-color: #a1caec;
|
522 |
-
color: #464646;
|
523 |
-
text-shadow: 0 1px 0 #fff;
|
524 |
-
}
|
525 |
-
#post-elements .howto, #post-elements label, #post-elements .button-controls {
|
526 |
-
color: #666;
|
527 |
-
}
|
528 |
-
|
529 |
-
.menu-item-handle.posttitle,
|
530 |
-
.menu-item-handle.postcontent,
|
531 |
-
.menu-item-handle.postexcerpt,
|
532 |
-
.menu-item-handle.postcat,
|
533 |
-
.menu-item-handle.posttags {
|
534 |
-
background-color: #D3E7F8;
|
535 |
-
background-image: -ms-linear-gradient(top,#e6f3fe,#D3E7F8);
|
536 |
-
background-image: -moz-linear-gradient(top,#e6f3fe,#D3E7F8);
|
537 |
-
background-image: -o-linear-gradient(top,#e6f3fe,#D3E7F8);
|
538 |
-
background-image: -webkit-gradient(linear,left top,left bottom,from(#e6f3fe),to(#D3E7F8));
|
539 |
-
background-image: -webkit-linear-gradient(top,#e6f3fe,#D3E7F8);
|
540 |
-
background-image: linear-gradient(top,#e6f3fe,#D3E7F8);
|
541 |
-
border: 1px solid #8ab5d9;
|
542 |
-
}
|
543 |
-
.menu-item-handle.posttitle .item-title,
|
544 |
-
.menu-item-handle.postcontent .item-title,
|
545 |
-
.menu-item-handle.postexcerpt .item-title,
|
546 |
-
.menu-item-handle.postcategory .item-title,
|
547 |
-
.menu-item-handle.posttags .item-title {
|
548 |
-
color: #464646;
|
549 |
-
font-size: 12px;
|
550 |
-
font-weight: bold;
|
551 |
-
padding: 7px 0;
|
552 |
-
line-height: 20px;
|
553 |
-
display: block;
|
554 |
-
margin-right: 13em;
|
555 |
-
text-shadow: 0 1px 0 #fff;
|
556 |
-
}
|
557 |
-
.menu-item-handle.posttitle .item-controls,
|
558 |
-
.menu-item-handle.postcontent .item-controls,
|
559 |
-
.menu-item-handle.postexcerpt .item-controls,
|
560 |
-
.menu-item-handle.postcategory .item-controls,
|
561 |
-
.menu-item-handle.posttags .item-controls {
|
562 |
-
color: #999;
|
563 |
-
font-size: 12px;
|
564 |
-
position: absolute;
|
565 |
-
right: 20px;
|
566 |
-
top: -1px;
|
567 |
-
}
|
568 |
-
.menu-item-handle.posttitle .item-type,
|
569 |
-
.menu-item-handle.postcontent .item-type,
|
570 |
-
.menu-item-handle.postexcerpt .item-type,
|
571 |
-
.menu-item-handle.postcategory .item-type,
|
572 |
-
.menu-item-handle.posttags .item-type {
|
573 |
-
color: #999;
|
574 |
-
}
|
575 |
-
.menu-item-settings.posttitle,
|
576 |
-
.menu-item-settings.postcontent,
|
577 |
-
.menu-item-settings.postexcerpt,
|
578 |
-
.menu-item-settings.postcategory,
|
579 |
-
.menu-item-settings.posttags {
|
580 |
-
background-color: whiteSmoke;
|
581 |
-
border: 1px solid #83acd0;
|
582 |
-
}
|
583 |
-
|
584 |
-
.form-list-inactive {
|
585 |
-
background-color: red;
|
586 |
-
}
|
587 |
-
|
588 |
-
.ninja-forms-drag {
|
589 |
-
cursor: move;
|
590 |
-
}
|
591 |
-
|
592 |
-
ul.ninja-forms-field-list, ul.ninja-forms-field-list ul {
|
593 |
-
margin: 0 0 0 25px;
|
594 |
-
padding: 0;
|
595 |
-
list-style-type: none;
|
596 |
-
}
|
597 |
-
|
598 |
-
ul.ninja-forms-field-list {
|
599 |
-
margin: 1em 0;
|
600 |
-
}
|
601 |
-
li.test {
|
602 |
-
display: inline;
|
603 |
-
}
|
604 |
-
|
605 |
-
a.tooltip {outline:none; }
|
606 |
-
a.tooltip strong {line-height:30px;}
|
607 |
-
a.tooltip:hover {text-decoration:none;}
|
608 |
-
a.tooltip span {
|
609 |
-
z-index:10;display:none; padding:14px 20px;
|
610 |
-
margin-top:-30px; margin-left:28px;
|
611 |
-
width:240px; line-height:16px;
|
612 |
-
}
|
613 |
-
a.tooltip:hover span{
|
614 |
-
display:inline; position:absolute; color:#111;
|
615 |
-
border:1px solid #DCA; background:#fffAF0;}
|
616 |
-
.callout {z-index:20;position:absolute;top:30px;border:0;left:-12px;}
|
617 |
-
|
618 |
-
/*CSS3 extras*/
|
619 |
-
a.tooltip span
|
620 |
-
{
|
621 |
-
border-radius:4px;
|
622 |
-
-moz-border-radius: 4px;
|
623 |
-
-webkit-border-radius: 4px;
|
624 |
-
|
625 |
-
-moz-box-shadow: 5px 5px 8px #CCC;
|
626 |
-
-webkit-box-shadow: 5px 5px 8px #CCC;
|
627 |
-
box-shadow: 5px 5px 8px #CCC;
|
628 |
-
}
|
629 |
-
|
630 |
-
.nf-brand-header {
|
631 |
-
background: #EF4748;
|
632 |
-
border-left: 4px solid #424242;
|
633 |
-
}
|
634 |
-
.nf-brand-header:after {
|
635 |
-
clear: both;
|
636 |
-
content: "";
|
637 |
-
display: block;
|
638 |
-
|
639 |
-
}
|
640 |
-
.nf-brand-header .nf-logo {
|
641 |
-
background-image: url("https://ninjaforms.com/wp-content/themes/ninja-brand/images/ninja-forms-logo-header.png");
|
642 |
-
background-size: 410px 600px;
|
643 |
-
background-position: 40px 80px;
|
644 |
-
float: left;
|
645 |
-
height: 80px;
|
646 |
-
width: 410px;
|
647 |
-
}
|
648 |
-
.nf-brand-header .wpn-logo {
|
649 |
-
background: #fff;
|
650 |
-
background-image: url("../images/wpninjas-logo.png");
|
651 |
-
background-size: 83px 70px;
|
652 |
-
background-position: 0 10px;
|
653 |
-
background-repeat: no-repeat;
|
654 |
-
float: right;
|
655 |
-
font-size: 8px;
|
656 |
-
height: 80px;
|
657 |
-
width: 83px;
|
658 |
-
text-align: center;
|
659 |
-
}
|
660 |
-
|
661 |
-
|
662 |
-
.nf-extend {
|
663 |
-
float: left;
|
664 |
-
margin: 0 20px 20px 0;
|
665 |
-
width: 300px;
|
666 |
-
position: relative;
|
667 |
-
}
|
668 |
-
.nf-extend img {
|
669 |
-
margin-bottom: 10px;
|
670 |
-
max-width: 100%;
|
671 |
-
height: auto;
|
672 |
-
}
|
673 |
-
|
674 |
-
.nf-extend-content p {
|
675 |
-
min-height: 60px;
|
676 |
-
}
|
677 |
-
|
678 |
-
.nf-extend .nf-button {
|
679 |
-
float: right;
|
680 |
-
}
|
681 |
-
|
682 |
-
.nf-extend .nf-doc-button {
|
683 |
-
float: left;
|
684 |
-
}
|
685 |
-
|
686 |
-
.mp6 .nf-extend {
|
687 |
-
background: #fff;
|
688 |
-
border: 1px solid #ccc;
|
689 |
-
border-radius: 4px;
|
690 |
-
float: left;
|
691 |
-
margin: 0 20px 20px 0;
|
692 |
-
padding: 10px;
|
693 |
-
position: relative;
|
694 |
-
width: 300px;
|
695 |
-
height: 350px;
|
696 |
-
}
|
697 |
-
.branch-3-8 .nf-extend {
|
698 |
-
background: #fff;
|
699 |
-
}
|
700 |
-
.forms_page_ninja-forms-style h2 .nav-tab {
|
701 |
-
font-size: 16px;
|
702 |
-
}
|
703 |
-
#TB_window {
|
704 |
-
overflow: auto !important;
|
705 |
-
}
|
706 |
-
.list-import-textarea {
|
707 |
-
width: 100%;
|
708 |
-
height: 200px;
|
709 |
-
}
|
710 |
-
|
711 |
-
.ninja-forms-list-option-label-td input {
|
712 |
-
width: 170px;
|
713 |
-
}
|
714 |
-
.ninja-forms-list-option-value-td input {
|
715 |
-
width: 100px;
|
716 |
-
}
|
717 |
-
.ninja-forms-list-option-calc-td input {
|
718 |
-
width: 50px;
|
719 |
-
}
|
720 |
-
|
721 |
-
.ninja-forms-calculations .label {
|
722 |
-
border-radius: 4px;
|
723 |
-
padding: 5px;
|
724 |
-
overflow: hidden;
|
725 |
-
}
|
726 |
-
|
727 |
-
.ninja-forms-calculations {
|
728 |
-
border: 1px solid #ccc;
|
729 |
-
border-radius: 5px;
|
730 |
-
clear: both;
|
731 |
-
float: none;
|
732 |
-
overflow: hidden;
|
733 |
-
}
|
734 |
-
|
735 |
-
.ninja-forms-calculations .label {
|
736 |
-
background: #ccc;
|
737 |
-
display: block;
|
738 |
-
}
|
739 |
-
|
740 |
-
.ninja-forms-calc-row {
|
741 |
-
background: #ddd;
|
742 |
-
margin: 10px;
|
743 |
-
padding: 10px;
|
744 |
-
}
|
745 |
-
|
746 |
-
.ninja-forms-calc-row input{
|
747 |
-
width: 50px;
|
748 |
-
}
|
749 |
-
|
750 |
-
#wpfooter {
|
751 |
-
/*display: none;*/
|
752 |
-
}
|
753 |
-
|
754 |
-
|
755 |
-
/* ---------------------------------
|
756 |
-
/ System Status Page
|
757 |
-
----------------------------------*/
|
758 |
-
#debug-report {
|
759 |
-
display: none;
|
760 |
-
}
|
761 |
-
#debug-report textarea {
|
762 |
-
height: 200px;
|
763 |
-
width: 300px;
|
764 |
-
}
|
765 |
-
p.debug-report {
|
766 |
-
display: inline-block;
|
767 |
-
padding: .5em 0;
|
768 |
-
}
|
769 |
-
.nf-status-table {
|
770 |
-
background: #f1f1f1;
|
771 |
-
border-radius: 4px 4px 0 0;
|
772 |
-
width: 100%;
|
773 |
-
}
|
774 |
-
.nf-status-table th {
|
775 |
-
border-color: #ccc;
|
776 |
-
border-style: solid;
|
777 |
-
border-width: 1px 1px 0 1px;
|
778 |
-
border-radius: 4px 4px 0 0;
|
779 |
-
font-size: 1.4em;
|
780 |
-
font-weight: normal;
|
781 |
-
padding: .5em 0;
|
782 |
-
width: 100%;
|
783 |
-
}
|
784 |
-
.nf-status-table thead:first-child th {
|
785 |
-
border-radius: 4px 4px 0 0;
|
786 |
-
}
|
787 |
-
.nf-status-table td {
|
788 |
-
border-color: #ccc;
|
789 |
-
border-style: solid;
|
790 |
-
border-width: 1px 1px 0px 1px;
|
791 |
-
padding: .5em;
|
792 |
-
}
|
793 |
-
.nf-status-table td:first-child {
|
794 |
-
border-left: 1px solid #ccc;
|
795 |
-
border-right-width: 0;
|
796 |
-
}
|
797 |
-
.nf-status-table tbody:last-child td {
|
798 |
-
border-bottom-width: 1px;
|
799 |
-
}
|
800 |
-
|
801 |
-
/* ---------------------------------
|
802 |
-
/ WP 3.8 styles
|
803 |
-
----------------------------------*/
|
804 |
-
|
805 |
-
.branch-3-8 #post-body .menu-item-handle,
|
806 |
-
.branch-3-9 #post-body .menu-item-handle,
|
807 |
-
.branch-4 #post-body .menu-item-handle,
|
808 |
-
.branch-4-1 #post-body .menu-item-handle,
|
809 |
-
.branch-4-2 #post-body .menu-item-handle,
|
810 |
-
.branch-4-3 #post-body .menu-item-handle,
|
811 |
-
.branch-4-4 #post-body .menu-item-handle,
|
812 |
-
.branch-4-5 #post-body .menu-item-handle,
|
813 |
-
.branch-4-6 #post-body .menu-item-handle,
|
814 |
-
.branch-4-7 #post-body .menu-item-handle {
|
815 |
-
background: #fff;
|
816 |
-
padding: 10px 5px 10px 10px;
|
817 |
-
}
|
818 |
-
.branch-3-8 #post-body .menu-item-settings,
|
819 |
-
.branch-3-9 #post-body .menu-item-settings,
|
820 |
-
.branch-4 #post-body .menu-item-settings,
|
821 |
-
.branch-4-1 #post-body .menu-item-settings,
|
822 |
-
.branch-4-2 #post-body .menu-item-settings,
|
823 |
-
.branch-4-3 #post-body .menu-item-settings,
|
824 |
-
.branch-4-4 #post-body .menu-item-settings,
|
825 |
-
.branch-4-5 #post-body .menu-item-settings,
|
826 |
-
.branch-4-6 #post-body .menu-item-settings,
|
827 |
-
.branch-4-7 #post-body .menu-item-settings {
|
828 |
-
background: #fff;
|
829 |
-
padding: 12px;
|
830 |
-
}
|
831 |
-
.branch-3-8 #post-body #post-body-content h3,
|
832 |
-
.branch-3-9 #post-body #post-body-content h3,
|
833 |
-
.branch-4 #post-body #post-body-content h3,
|
834 |
-
.branch-4-1 #post-body #post-body-content h3,
|
835 |
-
.branch-4-2 #post-body #post-body-content h3,
|
836 |
-
.branch-4-3 #post-body #post-body-content h3,
|
837 |
-
.branch-4-4 #post-body #post-body-content h3,
|
838 |
-
.branch-4-5 #post-body #post-body-content h3,
|
839 |
-
.branch-4-6 #post-body #post-body-content h3,
|
840 |
-
.branch-4-7 #post-body #post-body-content h3 {
|
841 |
-
margin-top: 0;
|
842 |
-
}
|
843 |
-
/*.branch-3-8 .item-controls {
|
844 |
-
top: 5px;
|
845 |
-
}*/
|
846 |
-
.branch-3-8 #TB_window .item-controls,
|
847 |
-
.branch-3-9 #TB_window .item-controls,
|
848 |
-
.branch-4 #TB_window .item-controls,
|
849 |
-
.branch-4-1 #TB_window .item-controls,
|
850 |
-
.branch-4-2 #TB_window .item-controls,
|
851 |
-
.branch-4-3 #TB_window .item-controls,
|
852 |
-
.branch-4-4 #TB_window .item-controls,
|
853 |
-
.branch-4-5 #TB_window .item-controls,
|
854 |
-
.branch-4-6 #TB_window .item-controls,
|
855 |
-
.branch-4-7 #TB_window .item-controls {
|
856 |
-
top: -5px;
|
857 |
-
}
|
858 |
-
|
859 |
-
.branch-4-5 .inside::after,
|
860 |
-
.branch-4-6 .inside::after,
|
861 |
-
.branch-4-7 .inside::after {
|
862 |
-
clear: both;
|
863 |
-
content: "";
|
864 |
-
display: block;
|
865 |
-
}
|
866 |
-
.branch-4-5.nav-menus-php .item-edit,
|
867 |
-
.branch-4-6.nav-menus-php .item-edit,
|
868 |
-
.branch-4-7.nav-menus-php .item-edit {
|
869 |
-
visibility: hidden;
|
870 |
-
}
|
871 |
-
.branch-4-5.nav-menus-php .item-edit::before,
|
872 |
-
.branch-4-6.nav-menus-php .item-edit::before,
|
873 |
-
.branch-4-7.nav-menus-php .item-edit::before {
|
874 |
-
visibility: visible;
|
875 |
-
}
|
876 |
-
|
877 |
-
.nf-more-actions {
|
878 |
-
display: inline-block;
|
879 |
-
padding-top: 6px;
|
880 |
-
}
|
881 |
-
|
882 |
-
.nf-more-actions a span {
|
883 |
-
font-size: 14px;
|
884 |
-
text-decoration: none;
|
885 |
-
padding-top: 2px;
|
886 |
-
}
|
887 |
-
|
888 |
-
.nf-preview,
|
889 |
-
.nf-subs {
|
890 |
-
text-decoration: none;
|
891 |
-
}
|
892 |
-
.nf-preview span,
|
893 |
-
.nf-subs span {
|
894 |
-
font-size: 20px;
|
895 |
-
width: 30px;
|
896 |
-
height: 28px;
|
897 |
-
padding-top: 3px;
|
898 |
-
margin-left: -5px;
|
899 |
-
}
|
900 |
-
.nf-subs-svg {
|
901 |
-
height: 27px;
|
902 |
-
}
|
903 |
-
|
904 |
-
.nf-remove-list-option {
|
905 |
-
color: #444;
|
906 |
-
text-decoration:none;
|
907 |
-
}
|
908 |
-
|
909 |
-
.nf-remove-list-option:hover {
|
910 |
-
color:gray;
|
911 |
-
}
|
912 |
-
|
913 |
-
.nf-field-settings {
|
914 |
-
overflow: auto;
|
915 |
-
margin-top: 5px !important;
|
916 |
-
margin-bottom: 5px !important;
|
917 |
-
}
|
918 |
-
|
919 |
-
.nf-field-settings .title {
|
920 |
-
background: #f1f1f1;
|
921 |
-
padding: 5px 10px;
|
922 |
-
cursor: pointer;
|
923 |
-
}
|
924 |
-
|
925 |
-
.nf-field-settings .dashicons {
|
926 |
-
float: right;
|
927 |
-
cursor: pointer;
|
928 |
-
}
|
929 |
-
|
930 |
-
.item-edit.open:before {
|
931 |
-
content: '\f142' ! important;
|
932 |
-
}
|
933 |
-
|
934 |
-
/*.nf-field-settings .inside {
|
935 |
-
background: #f1f1f1;
|
936 |
-
padding: 5px;
|
937 |
-
}
|
938 |
-
|
939 |
-
.nf-field-settings .inside:after {
|
940 |
-
clear: both;
|
941 |
-
content: '';
|
942 |
-
display: block;
|
943 |
-
}*/
|
944 |
-
|
945 |
-
.nf-nuke-warning {
|
946 |
-
font-weight: bold;
|
947 |
-
text-decoration: underline;
|
948 |
-
}
|
949 |
-
|
950 |
-
.about-overview {
|
951 |
-
padding: 20px;
|
952 |
-
}
|
953 |
-
.about-overview iframe {
|
954 |
-
display: block;
|
955 |
-
margin: 0 auto;
|
956 |
-
}
|
957 |
-
.querystring-error {
|
958 |
-
color: red;
|
959 |
-
}
|
960 |
-
input[type=text].error {
|
961 |
-
border: solid red;
|
962 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/css/ninja-forms-display.css
DELETED
@@ -1,323 +0,0 @@
|
|
1 |
-
.ninja-forms-form-wrap *,
|
2 |
-
.ninja-forms-form-wrap *:after,
|
3 |
-
.ninja-forms-form-wrap *:before {
|
4 |
-
-webkit-box-sizing: border-box;
|
5 |
-
-moz-box-sizing: border-box;
|
6 |
-
-ms-box-sizing: border-box;
|
7 |
-
box-sizing: border-box;
|
8 |
-
}
|
9 |
-
|
10 |
-
a.tooltip {outline:none; text-decoration: none; }
|
11 |
-
a.tooltip strong {line-height:30px;}
|
12 |
-
a.tooltip:hover {text-decoration:none;}
|
13 |
-
a.tooltip span {
|
14 |
-
z-index:10;display:none; padding:14px 20px;
|
15 |
-
margin-top:-10px; margin-left:28px;
|
16 |
-
width:240px; line-height:16px;
|
17 |
-
z-index: 1;
|
18 |
-
position: relative;
|
19 |
-
}
|
20 |
-
a.tooltip span:before {
|
21 |
-
border-top: 10px solid transparent;
|
22 |
-
border-right: 15px solid #ccc;
|
23 |
-
border-bottom: 10px solid transparent;
|
24 |
-
content: "";
|
25 |
-
position: absolute;
|
26 |
-
left: -15px;
|
27 |
-
|
28 |
-
}
|
29 |
-
a.tooltip:hover span{
|
30 |
-
display:inline; position:absolute; color:#333;
|
31 |
-
border:1px solid #ccc; background:#f1f1f1;}
|
32 |
-
|
33 |
-
/*CSS3 extras*/
|
34 |
-
a.tooltip span
|
35 |
-
{
|
36 |
-
border-radius:4px;
|
37 |
-
-moz-border-radius: 4px;
|
38 |
-
-webkit-border-radius: 4px;
|
39 |
-
|
40 |
-
-moz-box-shadow: 5px 5px 8px #CCC;
|
41 |
-
-webkit-box-shadow: 5px 5px 8px #CCC;
|
42 |
-
box-shadow: 5px 5px 8px #CCC;
|
43 |
-
}
|
44 |
-
#ui-datepicker-div {
|
45 |
-
background: #f1f1f1;
|
46 |
-
border-radius: 3px;
|
47 |
-
}
|
48 |
-
#ui-datepicker-div a {
|
49 |
-
text-decoration: none;
|
50 |
-
cursor: pointer;
|
51 |
-
}
|
52 |
-
#ui-datepicker-div .ui-datepicker-header,
|
53 |
-
#ui-datepicker-div .ui-datepicker-calendar th,
|
54 |
-
#ui-datepicker-div .ui-datepicker-calendar td {
|
55 |
-
padding: 5px;
|
56 |
-
text-align: center;
|
57 |
-
}
|
58 |
-
|
59 |
-
#ui-datepicker-div .ui-icon {
|
60 |
-
text-indent: 0px;
|
61 |
-
}
|
62 |
-
.ui-datepicker-prev {
|
63 |
-
float: left;
|
64 |
-
}
|
65 |
-
.ui-datepicker-next {
|
66 |
-
float: right;
|
67 |
-
}
|
68 |
-
.ninja-forms-no-display {
|
69 |
-
display: none;
|
70 |
-
}
|
71 |
-
.ninja-forms-form .wp-switch-editor {
|
72 |
-
height: auto;
|
73 |
-
}
|
74 |
-
.ninja-forms-form .mceIframeContainer {
|
75 |
-
background: #fff;
|
76 |
-
}
|
77 |
-
.ninja-forms-req-symbol {
|
78 |
-
color: #ff0000;
|
79 |
-
}
|
80 |
-
.ninja-forms-form .label-above label,
|
81 |
-
.ninja-forms-form .label-below label {
|
82 |
-
display: block;
|
83 |
-
}
|
84 |
-
|
85 |
-
.field-wrap,
|
86 |
-
#ninja_forms_required_items {
|
87 |
-
margin-bottom: 20px;
|
88 |
-
}
|
89 |
-
|
90 |
-
#pass-strength-result {
|
91 |
-
background-color: #eee;
|
92 |
-
border-color: #ddd !important;
|
93 |
-
border-style: solid;
|
94 |
-
border-width: 1px;
|
95 |
-
margin: 13px 5px 5px 1px;
|
96 |
-
padding: 3px 5px;
|
97 |
-
text-align: center;
|
98 |
-
width: 200px;
|
99 |
-
}
|
100 |
-
|
101 |
-
#pass-strength-result.bad {
|
102 |
-
background-color: #ffb78c;
|
103 |
-
border-color: #ff853c !important;
|
104 |
-
}
|
105 |
-
|
106 |
-
#pass-strength-result.good {
|
107 |
-
background-color: #ffec8b;
|
108 |
-
border-color: #fc0 !important;
|
109 |
-
}
|
110 |
-
|
111 |
-
#pass-strength-result.short {
|
112 |
-
background-color: #ffa0a0;
|
113 |
-
border-color: #f04040 !important;
|
114 |
-
}
|
115 |
-
|
116 |
-
#pass-strength-result.strong {
|
117 |
-
background-color: #c3ff88;
|
118 |
-
border-color: #8dff1c !important;
|
119 |
-
}
|
120 |
-
.ninja-forms-cont {
|
121 |
-
position: relative;
|
122 |
-
}
|
123 |
-
.ninja-forms-cont:after {
|
124 |
-
clear: both;
|
125 |
-
content: "";
|
126 |
-
display: block;
|
127 |
-
}
|
128 |
-
|
129 |
-
.ninja-forms-field-error {
|
130 |
-
color: red;
|
131 |
-
}
|
132 |
-
|
133 |
-
.ninja-forms-form-wrap input,
|
134 |
-
.ninja-forms-form-wrap select ,
|
135 |
-
.ninja-forms-form-wrap textarea {
|
136 |
-
width: auto;
|
137 |
-
height: auto;
|
138 |
-
vertical-align: inherit;
|
139 |
-
}
|
140 |
-
|
141 |
-
.ninja-forms-form-wrap label {
|
142 |
-
font-weight: bold;
|
143 |
-
}
|
144 |
-
.ninja-forms-form-wrap .list-checkbox-wrap ul label,
|
145 |
-
.ninja-forms-form-wrap .list-radio-wrap ul label {
|
146 |
-
font-weight: normal;
|
147 |
-
}
|
148 |
-
|
149 |
-
.field-wrap:after {
|
150 |
-
clear: both;
|
151 |
-
content: "";
|
152 |
-
display: block;
|
153 |
-
}
|
154 |
-
|
155 |
-
.field-wrap.label-left .ninja-forms-field,
|
156 |
-
.field-wrap.label-left .ninja-forms-star-rating-control {
|
157 |
-
margin-left: 8px;
|
158 |
-
}
|
159 |
-
.field-wrap.label-right .ninja-forms-field,
|
160 |
-
.field-wrap.label-right .ninja-forms-star-rating-control {
|
161 |
-
margin-right: 8px;
|
162 |
-
}
|
163 |
-
.field-wrap.label-right label,
|
164 |
-
.field-wrap.label-left label {
|
165 |
-
display: inline;
|
166 |
-
}
|
167 |
-
|
168 |
-
.label-above label {
|
169 |
-
margin-bottom: 5px;
|
170 |
-
}
|
171 |
-
|
172 |
-
.MultiFile-wrap {
|
173 |
-
display: inline-block;
|
174 |
-
}
|
175 |
-
|
176 |
-
/* ---------------------------------
|
177 |
-
TEXT FIELDS & TEXTAREAS
|
178 |
-
----------------------------------*/
|
179 |
-
|
180 |
-
.text-wrap.label-left input,
|
181 |
-
.profile_pass-wrap.label-left input,
|
182 |
-
.textarea-wrap.label-left textarea {
|
183 |
-
margin-left: 10px;
|
184 |
-
}
|
185 |
-
.text-wrap.label-right input,
|
186 |
-
.profile_pass-wrap.label-right input,
|
187 |
-
.textarea-wrap.label-right textarea {
|
188 |
-
margin-right: 10px;
|
189 |
-
}
|
190 |
-
|
191 |
-
.text-wrap.label-above label,
|
192 |
-
.textarea-wrap.label-above label {
|
193 |
-
display: block;
|
194 |
-
width: 100%;
|
195 |
-
}
|
196 |
-
|
197 |
-
.profile_pass-wrap input,
|
198 |
-
.text-wrap.label-above input,
|
199 |
-
.text-wrap.label-below input,
|
200 |
-
.text-wrap.label-inside input,
|
201 |
-
.textarea-wrap.label-above textarea,
|
202 |
-
.textarea-wrap.label-below textarea,
|
203 |
-
.textarea-wrap.label-inside textarea,
|
204 |
-
.list-dropdown-wrap.label-above select,
|
205 |
-
.list-dropdown-wrap.label-below select {
|
206 |
-
width: 100%;
|
207 |
-
}
|
208 |
-
|
209 |
-
.textarea-wrap textarea {
|
210 |
-
height: 200px;
|
211 |
-
}
|
212 |
-
|
213 |
-
.profile_pass-wrap input {
|
214 |
-
margin-bottom: 10px;
|
215 |
-
}
|
216 |
-
|
217 |
-
/* ---------------------------------
|
218 |
-
RADIO & CHECKBOX LISTS
|
219 |
-
----------------------------------*/
|
220 |
-
|
221 |
-
.list-radio-wrap span ul li input,
|
222 |
-
.list-checkbox-wrap span ul li input {
|
223 |
-
margin-right: 5px;
|
224 |
-
}
|
225 |
-
|
226 |
-
.list-radio-wrap span ul,
|
227 |
-
.list-checkbox-wrap span ul {
|
228 |
-
list-style: none;
|
229 |
-
margin: 0;
|
230 |
-
padding: 0;
|
231 |
-
}
|
232 |
-
|
233 |
-
.list-radio-wrap span ul li,
|
234 |
-
.list-checkbox-wrap span ul li {
|
235 |
-
list-style: none;
|
236 |
-
}
|
237 |
-
|
238 |
-
.list-radio-wrap span ul li,
|
239 |
-
.list-checkbox-wrap span ul li {
|
240 |
-
margin: 0;
|
241 |
-
padding: 0;
|
242 |
-
}
|
243 |
-
|
244 |
-
.list-radio-wrap.label-left label,
|
245 |
-
.list-radio-wrap.label-left ul,
|
246 |
-
.list-radio-wrap.label-left ul li,
|
247 |
-
.list-radio-wrap.label-right label,
|
248 |
-
.list-radio-wrap.label-right ul,
|
249 |
-
.list-radio-wrap.label-right ul li,
|
250 |
-
.list-checkbox-wrap.label-left label,
|
251 |
-
.list-checkbox-wrap.label-left ul,
|
252 |
-
.list-checkbox-wrap.label-left ul li,
|
253 |
-
.list-checkbox-wrap.label-right label,
|
254 |
-
.list-checkbox-wrap.label-right ul,
|
255 |
-
.list-checkbox-wrap.label-right ul li {
|
256 |
-
float: left;
|
257 |
-
}
|
258 |
-
.rtl .list-radio-wrap.label-left label,
|
259 |
-
.rtl .list-radio-wrap.label-left ul,
|
260 |
-
.rtl .list-radio-wrap.label-left ul li,
|
261 |
-
.rtl .list-radio-wrap.label-right label,
|
262 |
-
.rtl .list-radio-wrap.label-right ul,
|
263 |
-
.rtl .list-radio-wrap.label-right ul li,
|
264 |
-
.rtl .list-checkbox-wrap.label-left label,
|
265 |
-
.rtl .list-checkbox-wrap.label-left ul,
|
266 |
-
.rtl .list-checkbox-wrap.label-left ul li,
|
267 |
-
.rtl .list-checkbox-wrap.label-right label,
|
268 |
-
.rtl .list-checkbox-wrap.label-right ul,
|
269 |
-
.rtl .list-checkbox-wrap.label-right ul li {
|
270 |
-
float: right;
|
271 |
-
}
|
272 |
-
.list-radio-wrap.label-left ul li,
|
273 |
-
.list-radio-wrap.label-right ul li,
|
274 |
-
.list-checkbox-wrap.label-left ul li,
|
275 |
-
.list-checkbox-wrap.label-right ul li {
|
276 |
-
padding: 0 8px;
|
277 |
-
}
|
278 |
-
|
279 |
-
.list-radio-wrap.label-above ul li,
|
280 |
-
.list-radio-wrap.label-below ul li,
|
281 |
-
.list-checkbox-wrap.label-above ul li,
|
282 |
-
.list-checkbox-wrap.label-below ul li {
|
283 |
-
padding: 0 0 0 10px;
|
284 |
-
}
|
285 |
-
|
286 |
-
/* ---------------------------------
|
287 |
-
MULTI FIELD
|
288 |
-
----------------------------------*/
|
289 |
-
|
290 |
-
.list-multi-wrap.label-left label {
|
291 |
-
float:left;
|
292 |
-
}
|
293 |
-
.list-multi-wrap.label-right select {
|
294 |
-
float:left;
|
295 |
-
}
|
296 |
-
|
297 |
-
/* ---------------------------------
|
298 |
-
CREDIT CARD BLOCK
|
299 |
-
----------------------------------*/
|
300 |
-
|
301 |
-
.credit_card-wrap div label,
|
302 |
-
.credit_card-wrap div input {
|
303 |
-
display: block;
|
304 |
-
width: 100%;
|
305 |
-
}
|
306 |
-
.credit_card-wrap div {
|
307 |
-
margin-bottom: 10px;
|
308 |
-
}
|
309 |
-
.credit_card-wrap div span {
|
310 |
-
font-size: 0.8em;
|
311 |
-
}
|
312 |
-
|
313 |
-
/* ---------------------------------
|
314 |
-
HONEYPOT
|
315 |
-
----------------------------------*/
|
316 |
-
|
317 |
-
.hp-wrap {
|
318 |
-
display: none;
|
319 |
-
}
|
320 |
-
|
321 |
-
.honeypot-wrap {
|
322 |
-
display: none;
|
323 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/css/qtip.css
DELETED
@@ -1,222 +0,0 @@
|
|
1 |
-
/*! qTip2 - Pretty powerful tooltips - v2.0.0 - 2012-12-21
|
2 |
-
* http://craigsworks.com/projects/qtip2/
|
3 |
-
* Copyright (c) 2012 Craig Michael Thompson; Licensed MIT, GPL */
|
4 |
-
|
5 |
-
/* Core qTip styles */
|
6 |
-
.qtip, .qtip{
|
7 |
-
position: absolute;
|
8 |
-
left: -28000px;
|
9 |
-
top: -28000px;
|
10 |
-
display: none;
|
11 |
-
|
12 |
-
max-width: 280px;
|
13 |
-
min-width: 50px;
|
14 |
-
|
15 |
-
font-size: 10.5px;
|
16 |
-
line-height: 12px;
|
17 |
-
|
18 |
-
direction: ltr;
|
19 |
-
}
|
20 |
-
|
21 |
-
.qtip-content{
|
22 |
-
position: relative;
|
23 |
-
padding: 5px 9px;
|
24 |
-
overflow: hidden;
|
25 |
-
|
26 |
-
text-align: left;
|
27 |
-
word-wrap: break-word;
|
28 |
-
}
|
29 |
-
|
30 |
-
.qtip-titlebar{
|
31 |
-
position: relative;
|
32 |
-
padding: 5px 35px 5px 10px;
|
33 |
-
overflow: hidden;
|
34 |
-
|
35 |
-
border-width: 0 0 1px;
|
36 |
-
font-weight: bold;
|
37 |
-
}
|
38 |
-
|
39 |
-
.qtip-titlebar + .qtip-content{ border-top-width: 0 !important; }
|
40 |
-
|
41 |
-
/* Default close button class */
|
42 |
-
.qtip-close{
|
43 |
-
position: absolute;
|
44 |
-
right: -9px; top: -9px;
|
45 |
-
|
46 |
-
cursor: pointer;
|
47 |
-
outline: medium none;
|
48 |
-
|
49 |
-
border-width: 1px;
|
50 |
-
border-style: solid;
|
51 |
-
border-color: transparent;
|
52 |
-
}
|
53 |
-
|
54 |
-
.qtip-titlebar .qtip-close{
|
55 |
-
right: 4px; top: 50%;
|
56 |
-
margin-top: -9px;
|
57 |
-
}
|
58 |
-
|
59 |
-
* html .qtip-titlebar .qtip-close{ top: 16px; } /* IE fix */
|
60 |
-
|
61 |
-
.qtip-titlebar .ui-icon,
|
62 |
-
.qtip-icon .ui-icon{
|
63 |
-
display: block;
|
64 |
-
text-indent: -1000em;
|
65 |
-
direction: ltr;
|
66 |
-
vertical-align: middle;
|
67 |
-
}
|
68 |
-
|
69 |
-
.qtip-icon, .qtip-icon .ui-icon{
|
70 |
-
-moz-border-radius: 3px;
|
71 |
-
-webkit-border-radius: 3px;
|
72 |
-
border-radius: 3px;
|
73 |
-
text-decoration: none;
|
74 |
-
}
|
75 |
-
|
76 |
-
.qtip-icon .ui-icon{
|
77 |
-
width: 18px;
|
78 |
-
height: 14px;
|
79 |
-
|
80 |
-
text-align: center;
|
81 |
-
text-indent: 0;
|
82 |
-
font: normal bold 10px/13px Tahoma,sans-serif;
|
83 |
-
|
84 |
-
color: inherit;
|
85 |
-
background: transparent none no-repeat -100em -100em;
|
86 |
-
}
|
87 |
-
|
88 |
-
|
89 |
-
/* Applied to 'focused' tooltips e.g. most recently displayed/interacted with */
|
90 |
-
.qtip-focus{}
|
91 |
-
|
92 |
-
/* Applied on hover of tooltips i.e. added/removed on mouseenter/mouseleave respectively */
|
93 |
-
.qtip-hover{}
|
94 |
-
|
95 |
-
/* Default tooltip style */
|
96 |
-
.qtip-default{
|
97 |
-
border-width: 1px;
|
98 |
-
border-style: solid;
|
99 |
-
border-color: #F1D031;
|
100 |
-
|
101 |
-
background-color: #FFFFA3;
|
102 |
-
color: #555;
|
103 |
-
}
|
104 |
-
|
105 |
-
.qtip-default .qtip-titlebar{
|
106 |
-
background-color: #FFEF93;
|
107 |
-
}
|
108 |
-
|
109 |
-
.qtip-default .qtip-icon{
|
110 |
-
border-color: #CCC;
|
111 |
-
background: #F1F1F1;
|
112 |
-
color: #777;
|
113 |
-
}
|
114 |
-
|
115 |
-
.qtip-default .qtip-titlebar .qtip-close{
|
116 |
-
border-color: #AAA;
|
117 |
-
color: #111;
|
118 |
-
}
|
119 |
-
|
120 |
-
|
121 |
-
/*! Light tooltip style */
|
122 |
-
.qtip-light{
|
123 |
-
background-color: white;
|
124 |
-
border-color: #E2E2E2;
|
125 |
-
color: #454545;
|
126 |
-
}
|
127 |
-
|
128 |
-
.qtip-light .qtip-titlebar{
|
129 |
-
background-color: #f1f1f1;
|
130 |
-
}
|
131 |
-
|
132 |
-
|
133 |
-
/*! Dark tooltip style */
|
134 |
-
.qtip-dark{
|
135 |
-
background-color: #505050;
|
136 |
-
border-color: #303030;
|
137 |
-
color: #f3f3f3;
|
138 |
-
}
|
139 |
-
|
140 |
-
.qtip-dark .qtip-titlebar{
|
141 |
-
background-color: #404040;
|
142 |
-
}
|
143 |
-
|
144 |
-
.qtip-dark .qtip-icon{
|
145 |
-
border-color: #444;
|
146 |
-
}
|
147 |
-
|
148 |
-
.qtip-dark .qtip-titlebar .ui-state-hover{
|
149 |
-
border-color: #303030;
|
150 |
-
}
|
151 |
-
|
152 |
-
|
153 |
-
/*! Cream tooltip style */
|
154 |
-
.qtip-cream{
|
155 |
-
background-color: #FBF7AA;
|
156 |
-
border-color: #F9E98E;
|
157 |
-
color: #A27D35;
|
158 |
-
}
|
159 |
-
|
160 |
-
.qtip-cream .qtip-titlebar{
|
161 |
-
background-color: #F0DE7D;
|
162 |
-
}
|
163 |
-
|
164 |
-
.qtip-cream .qtip-close .qtip-icon{
|
165 |
-
background-position: -82px 0;
|
166 |
-
}
|
167 |
-
|
168 |
-
|
169 |
-
/*! Red tooltip style */
|
170 |
-
.qtip-red{
|
171 |
-
background-color: #F78B83;
|
172 |
-
border-color: #D95252;
|
173 |
-
color: #912323;
|
174 |
-
}
|
175 |
-
|
176 |
-
.qtip-red .qtip-titlebar{
|
177 |
-
background-color: #F06D65;
|
178 |
-
}
|
179 |
-
|
180 |
-
.qtip-red .qtip-close .qtip-icon{
|
181 |
-
background-position: -102px 0;
|
182 |
-
}
|
183 |
-
|
184 |
-
.qtip-red .qtip-icon{
|
185 |
-
border-color: #D95252;
|
186 |
-
}
|
187 |
-
|
188 |
-
.qtip-red .qtip-titlebar .ui-state-hover{
|
189 |
-
border-color: #D95252;
|
190 |
-
}
|
191 |
-
|
192 |
-
|
193 |
-
/*! Green tooltip style */
|
194 |
-
.qtip-green{
|
195 |
-
background-color: #CAED9E;
|
196 |
-
border-color: #90D93F;
|
197 |
-
color: #3F6219;
|
198 |
-
}
|
199 |
-
|
200 |
-
.qtip-green .qtip-titlebar{
|
201 |
-
background-color: #B0DE78;
|
202 |
-
}
|
203 |
-
|
204 |
-
.qtip-green .qtip-close .qtip-icon{
|
205 |
-
background-position: -42px 0;
|
206 |
-
}
|
207 |
-
|
208 |
-
|
209 |
-
/*! Blue tooltip style */
|
210 |
-
.qtip-blue{
|
211 |
-
background-color: #E5F6FE;
|
212 |
-
border-color: #ADD9ED;
|
213 |
-
color: #5E99BD;
|
214 |
-
}
|
215 |
-
|
216 |
-
.qtip-blue .qtip-titlebar{
|
217 |
-
background-color: #D0E9F5;
|
218 |
-
}
|
219 |
-
|
220 |
-
.qtip-blue .qtip-close .qtip-icon{
|
221 |
-
background-position: -2px 0;
|
222 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/css/smoothness/images/index.php
DELETED
@@ -1,2 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
// Silence is golden.
|
|
|
|
deprecated/css/smoothness/images/pbar-ani-old.gif
DELETED
Binary file
|
deprecated/css/smoothness/images/pbar-ani.gif
DELETED
Binary file
|
deprecated/css/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png
DELETED
Binary file
|
deprecated/css/smoothness/images/ui-bg_flat_75_ffffff_40x100.png
DELETED
Binary file
|
deprecated/css/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png
DELETED
Binary file
|
deprecated/css/smoothness/images/ui-bg_glass_65_ffffff_1x400.png
DELETED
Binary file
|
deprecated/css/smoothness/images/ui-bg_glass_75_dadada_1x400.png
DELETED
Binary file
|
deprecated/css/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png
DELETED
Binary file
|
deprecated/css/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png
DELETED
Binary file
|
deprecated/css/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png
DELETED
Binary file
|
deprecated/css/smoothness/images/ui-icons_222222_256x240.png
DELETED
Binary file
|
deprecated/css/smoothness/images/ui-icons_2e83ff_256x240.png
DELETED
Binary file
|
deprecated/css/smoothness/images/ui-icons_454545_256x240.png
DELETED
Binary file
|
deprecated/css/smoothness/images/ui-icons_888888_256x240.png
DELETED
Binary file
|
deprecated/css/smoothness/images/ui-icons_cd0a0a_256x240.png
DELETED
Binary file
|
deprecated/css/smoothness/index.php
DELETED
@@ -1,2 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
// Silence is golden.
|
|
|
|
deprecated/images/callout.gif
DELETED
Binary file
|
deprecated/images/delete.gif
DELETED
Binary file
|
deprecated/images/empty_star_hover.png
DELETED
Binary file
|
deprecated/images/index.php
DELETED
@@ -1,2 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
// Silence is golden.
|
|
|
|
deprecated/images/loading.gif
DELETED
Binary file
|
deprecated/images/nf-logo.png
DELETED
Binary file
|
deprecated/images/nfthree-card.png
DELETED
Binary file
|
deprecated/images/ninja-forms-three.png
DELETED
Binary file
|
deprecated/images/ninja-head-ico-small.png
DELETED
Binary file
|
deprecated/images/no.png
DELETED
Binary file
|
deprecated/images/question-ico.gif
DELETED
Binary file
|
deprecated/images/star.gif
DELETED
Binary file
|
deprecated/images/wpninjas-logo.png
DELETED
Binary file
|
deprecated/images/wpnj-ninja-head.png
DELETED
Binary file
|
deprecated/images/xit.gif
DELETED
Binary file
|
deprecated/images/yes.png
DELETED
Binary file
|
deprecated/includes/EDD_SL_Plugin_Updater.php
DELETED
@@ -1,299 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
// uncomment this line for testing
|
3 |
-
//set_site_transient( 'update_plugins', null );
|
4 |
-
// Exit if accessed directly
|
5 |
-
if ( ! defined( 'ABSPATH' ) ) exit;
|
6 |
-
/**
|
7 |
-
* Allows plugins to use their own update API.
|
8 |
-
*
|
9 |
-
* @author Pippin Williamson
|
10 |
-
* @version 1.6.5
|
11 |
-
*/
|
12 |
-
class EDD_SL_Plugin_Updater {
|
13 |
-
private $api_url = '';
|
14 |
-
private $api_data = array();
|
15 |
-
private $name = '';
|
16 |
-
private $slug = '';
|
17 |
-
private $version = '';
|
18 |
-
private $wp_override = false;
|
19 |
-
/**
|
20 |
-
* Class constructor.
|
21 |
-
*
|
22 |
-
* @uses plugin_basename()
|
23 |
-
* @uses hook()
|
24 |
-
*
|
25 |
-
* @param string $_api_url The URL pointing to the custom API endpoint.
|
26 |
-
* @param string $_plugin_file Path to the plugin file.
|
27 |
-
* @param array $_api_data Optional data to send with API calls.
|
28 |
-
*/
|
29 |
-
public function __construct( $_api_url, $_plugin_file, $_api_data = null ) {
|
30 |
-
global $edd_plugin_data;
|
31 |
-
$this->api_url = trailingslashit( $_api_url );
|
32 |
-
$this->api_data = $_api_data;
|
33 |
-
$this->name = plugin_basename( $_plugin_file );
|
34 |
-
$this->slug = basename( $_plugin_file, '.php' );
|
35 |
-
$this->version = $_api_data['version'];
|
36 |
-
$this->wp_override = isset( $_api_data['wp_override'] ) ? (bool) $_api_data['wp_override'] : false;
|
37 |
-
$edd_plugin_data[ $this->slug ] = $this->api_data;
|
38 |
-
// Set up hooks.
|
39 |
-
$this->init();
|
40 |
-
}
|
41 |
-
/**
|
42 |
-
* Set up WordPress filters to hook into WP's update process.
|
43 |
-
*
|
44 |
-
* @uses add_filter()
|
45 |
-
*
|
46 |
-
* @return void
|
47 |
-
*/
|
48 |
-
public function init() {
|
49 |
-
add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
|
50 |
-
add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 );
|
51 |
-
remove_action( 'after_plugin_row_' . $this->name, 'wp_plugin_update_row', 10 );
|
52 |
-
add_action( 'after_plugin_row_' . $this->name, array( $this, 'show_update_notification' ), 10, 2 );
|
53 |
-
add_action( 'admin_init', array( $this, 'show_changelog' ) );
|
54 |
-
}
|
55 |
-
/**
|
56 |
-
* Check for Updates at the defined API endpoint and modify the update array.
|
57 |
-
*
|
58 |
-
* This function dives into the update API just when WordPress creates its update array,
|
59 |
-
* then adds a custom API call and injects the custom plugin data retrieved from the API.
|
60 |
-
* It is reassembled from parts of the native WordPress plugin update code.
|
61 |
-
* See wp-includes/update.php line 121 for the original wp_update_plugins() function.
|
62 |
-
*
|
63 |
-
* @uses api_request()
|
64 |
-
*
|
65 |
-
* @param array $_transient_data Update array build by WordPress.
|
66 |
-
* @return array Modified update array with custom plugin data.
|
67 |
-
*/
|
68 |
-
public function check_update( $_transient_data ) {
|
69 |
-
global $pagenow;
|
70 |
-
if ( ! is_object( $_transient_data ) ) {
|
71 |
-
$_transient_data = new stdClass;
|
72 |
-
}
|
73 |
-
if ( 'plugins.php' == $pagenow && is_multisite() ) {
|
74 |
-
return $_transient_data;
|
75 |
-
}
|
76 |
-
if ( ! empty( $_transient_data->response ) && ! empty( $_transient_data->response[ $this->name ] ) && false === $this->wp_override ) {
|
77 |
-
return $_transient_data;
|
78 |
-
}
|
79 |
-
$version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) );
|
80 |
-
if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) {
|
81 |
-
if ( version_compare( $this->version, $version_info->new_version, '<' ) ) {
|
82 |
-
$_transient_data->response[ $this->name ] = $version_info;
|
83 |
-
}
|
84 |
-
$_transient_data->last_checked = current_time( 'timestamp' );
|
85 |
-
$_transient_data->checked[ $this->name ] = $this->version;
|
86 |
-
}
|
87 |
-
return $_transient_data;
|
88 |
-
}
|
89 |
-
/**
|
90 |
-
* show update nofication row -- needed for multisite subsites, because WP won't tell you otherwise!
|
91 |
-
*
|
92 |
-
* @param string $file
|
93 |
-
* @param array $plugin
|
94 |
-
*/
|
95 |
-
public function show_update_notification( $file, $plugin ) {
|
96 |
-
if ( is_network_admin() ) {
|
97 |
-
return;
|
98 |
-
}
|
99 |
-
if( ! current_user_can( 'update_plugins' ) ) {
|
100 |
-
return;
|
101 |
-
}
|
102 |
-
if( ! is_multisite() ) {
|
103 |
-
return;
|
104 |
-
}
|
105 |
-
if ( $this->name != $file ) {
|
106 |
-
return;
|
107 |
-
}
|
108 |
-
// Remove our filter on the site transient
|
109 |
-
remove_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ), 10 );
|
110 |
-
$update_cache = get_site_transient( 'update_plugins' );
|
111 |
-
$update_cache = is_object( $update_cache ) ? $update_cache : new stdClass();
|
112 |
-
if ( empty( $update_cache->response ) || empty( $update_cache->response[ $this->name ] ) ) {
|
113 |
-
$cache_key = md5( 'edd_plugin_' . sanitize_key( $this->name ) . '_version_info' );
|
114 |
-
$version_info = get_transient( $cache_key );
|
115 |
-
if( false === $version_info ) {
|
116 |
-
$version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) );
|
117 |
-
set_transient( $cache_key, $version_info, 3600 );
|
118 |
-
}
|
119 |
-
if( ! is_object( $version_info ) ) {
|
120 |
-
return;
|
121 |
-
}
|
122 |
-
if( version_compare( $this->version, $version_info->new_version, '<' ) ) {
|
123 |
-
$update_cache->response[ $this->name ] = $version_info;
|
124 |
-
}
|
125 |
-
$update_cache->last_checked = current_time( 'timestamp' );
|
126 |
-
$update_cache->checked[ $this->name ] = $this->version;
|
127 |
-
set_site_transient( 'update_plugins', $update_cache );
|
128 |
-
} else {
|
129 |
-
$version_info = $update_cache->response[ $this->name ];
|
130 |
-
}
|
131 |
-
// Restore our filter
|
132 |
-
add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
|
133 |
-
if ( ! empty( $update_cache->response[ $this->name ] ) && version_compare( $this->version, $version_info->new_version, '<' ) ) {
|
134 |
-
// build a plugin list row, with update notification
|
135 |
-
$wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
|
136 |
-
# <tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange">
|
137 |
-
echo '<tr class="plugin-update-tr" id="' . $this->slug . '-update" data-slug="' . $this->slug . '" data-plugin="' . $this->slug . '/' . $file . '">';
|
138 |
-
echo '<td colspan="3" class="plugin-update colspanchange">';
|
139 |
-
echo '<div class="update-message notice inline notice-warning notice-alt">';
|
140 |
-
$changelog_link = self_admin_url( 'index.php?edd_sl_action=view_plugin_changelog&plugin=' . $this->name . '&slug=' . $this->slug . '&TB_iframe=true&width=772&height=911' );
|
141 |
-
if ( empty( $version_info->download_link ) ) {
|
142 |
-
printf(
|
143 |
-
__( 'There is a new version of %1$s available. %2$sView version %3$s details%4$s.', 'easy-digital-downloads' ),
|
144 |
-
esc_html( $version_info->name ),
|
145 |
-
'<a target="_blank" class="thickbox" href="' . esc_url( $changelog_link ) . '">',
|
146 |
-
esc_html( $version_info->new_version ),
|
147 |
-
'</a>'
|
148 |
-
);
|
149 |
-
} else {
|
150 |
-
printf(
|
151 |
-
__( 'There is a new version of %1$s available. %2$sView version %3$s details%4$s or %5$supdate now%6$s.', 'easy-digital-downloads' ),
|
152 |
-
esc_html( $version_info->name ),
|
153 |
-
'<a target="_blank" class="thickbox" href="' . esc_url( $changelog_link ) . '">',
|
154 |
-
esc_html( $version_info->new_version ),
|
155 |
-
'</a>',
|
156 |
-
'<a href="' . esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $this->name, 'upgrade-plugin_' . $this->name ) ) .'">',
|
157 |
-
'</a>'
|
158 |
-
);
|
159 |
-
}
|
160 |
-
do_action( "in_plugin_update_message-{$file}", $plugin, $version_info );
|
161 |
-
echo '</div></td></tr>';
|
162 |
-
}
|
163 |
-
}
|
164 |
-
/**
|
165 |
-
* Updates information on the "View version x.x details" page with custom data.
|
166 |
-
*
|
167 |
-
* @uses api_request()
|
168 |
-
*
|
169 |
-
* @param mixed $_data
|
170 |
-
* @param string $_action
|
171 |
-
* @param object $_args
|
172 |
-
* @return object $_data
|
173 |
-
*/
|
174 |
-
public function plugins_api_filter( $_data, $_action = '', $_args = null ) {
|
175 |
-
if ( $_action != 'plugin_information' ) {
|
176 |
-
return $_data;
|
177 |
-
}
|
178 |
-
if ( ! isset( $_args->slug ) || ( $_args->slug != $this->slug ) ) {
|
179 |
-
return $_data;
|
180 |
-
}
|
181 |
-
$to_send = array(
|
182 |
-
'slug' => $this->slug,
|
183 |
-
'is_ssl' => is_ssl(),
|
184 |
-
'fields' => array(
|
185 |
-
'banners' => false, // These will be supported soon hopefully
|
186 |
-
'reviews' => false
|
187 |
-
)
|
188 |
-
);
|
189 |
-
$cache_key = 'edd_api_request_' . substr( md5( serialize( $this->slug ) ), 0, 15 );
|
190 |
-
//Get the transient where we store the api request for this plugin for 24 hours
|
191 |
-
$edd_api_request_transient = get_site_transient( $cache_key );
|
192 |
-
//If we have no transient-saved value, run the API, set a fresh transient with the API value, and return that value too right now.
|
193 |
-
if ( empty( $edd_api_request_transient ) ){
|
194 |
-
$api_response = $this->api_request( 'plugin_information', $to_send );
|
195 |
-
//Expires in 1 day
|
196 |
-
set_site_transient( $cache_key, $api_response, DAY_IN_SECONDS );
|
197 |
-
if ( false !== $api_response ) {
|
198 |
-
$_data = $api_response;
|
199 |
-
}
|
200 |
-
}
|
201 |
-
return $_data;
|
202 |
-
}
|
203 |
-
/**
|
204 |
-
* Disable SSL verification in order to prevent download update failures
|
205 |
-
*
|
206 |
-
* @param array $args
|
207 |
-
* @param string $url
|
208 |
-
* @return object $array
|
209 |
-
*/
|
210 |
-
public function http_request_args( $args, $url ) {
|
211 |
-
// If it is an https request and we are performing a package download, disable ssl verification
|
212 |
-
if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) {
|
213 |
-
$args['sslverify'] = false;
|
214 |
-
}
|
215 |
-
return $args;
|
216 |
-
}
|
217 |
-
/**
|
218 |
-
* Calls the API and, if successfull, returns the object delivered by the API.
|
219 |
-
*
|
220 |
-
* @uses get_bloginfo()
|
221 |
-
* @uses wp_remote_post()
|
222 |
-
* @uses is_wp_error()
|
223 |
-
*
|
224 |
-
* @param string $_action The requested action.
|
225 |
-
* @param array $_data Parameters for the API action.
|
226 |
-
* @return false|object
|
227 |
-
*/
|
228 |
-
private function api_request( $_action, $_data ) {
|
229 |
-
global $wp_version;
|
230 |
-
$data = array_merge( $this->api_data, $_data );
|
231 |
-
if ( $data['slug'] != $this->slug ) {
|
232 |
-
return;
|
233 |
-
}
|
234 |
-
if( $this->api_url == trailingslashit (home_url() ) ) {
|
235 |
-
return false; // Don't allow a plugin to ping itself
|
236 |
-
}
|
237 |
-
$api_params = array(
|
238 |
-
'edd_action' => 'get_version',
|
239 |
-
'license' => ! empty( $data['license'] ) ? $data['license'] : '',
|
240 |
-
'item_name' => isset( $data['item_name'] ) ? $data['item_name'] : false,
|
241 |
-
'item_id' => isset( $data['item_id'] ) ? $data['item_id'] : false,
|
242 |
-
'slug' => $data['slug'],
|
243 |
-
'author' => $data['author'],
|
244 |
-
'url' => home_url()
|
245 |
-
);
|
246 |
-
$request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) );
|
247 |
-
if ( ! is_wp_error( $request ) ) {
|
248 |
-
$request = json_decode( wp_remote_retrieve_body( $request ) );
|
249 |
-
}
|
250 |
-
if ( $request && isset( $request->sections ) ) {
|
251 |
-
$request->sections = maybe_unserialize( $request->sections );
|
252 |
-
} else {
|
253 |
-
$request = false;
|
254 |
-
}
|
255 |
-
return $request;
|
256 |
-
}
|
257 |
-
public function show_changelog() {
|
258 |
-
global $edd_plugin_data;
|
259 |
-
if( empty( $_REQUEST['edd_sl_action'] ) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action'] ) {
|
260 |
-
return;
|
261 |
-
}
|
262 |
-
if( empty( $_REQUEST['plugin'] ) ) {
|
263 |
-
return;
|
264 |
-
}
|
265 |
-
if( empty( $_REQUEST['slug'] ) ) {
|
266 |
-
return;
|
267 |
-
}
|
268 |
-
if( ! current_user_can( 'update_plugins' ) ) {
|
269 |
-
wp_die( __( 'You do not have permission to install plugin updates', 'easy-digital-downloads' ), __( 'Error', 'easy-digital-downloads' ), array( 'response' => 403 ) );
|
270 |
-
}
|
271 |
-
$data = $edd_plugin_data[ $_REQUEST['slug'] ];
|
272 |
-
$cache_key = md5( 'edd_plugin_' . sanitize_key( $_REQUEST['plugin'] ) . '_version_info' );
|
273 |
-
$version_info = get_transient( $cache_key );
|
274 |
-
if( false === $version_info ) {
|
275 |
-
$api_params = array(
|
276 |
-
'edd_action' => 'get_version',
|
277 |
-
'item_name' => isset( $data['item_name'] ) ? $data['item_name'] : false,
|
278 |
-
'item_id' => isset( $data['item_id'] ) ? $data['item_id'] : false,
|
279 |
-
'slug' => $_REQUEST['slug'],
|
280 |
-
'author' => $data['author'],
|
281 |
-
'url' => home_url()
|
282 |
-
);
|
283 |
-
$request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) );
|
284 |
-
if ( ! is_wp_error( $request ) ) {
|
285 |
-
$version_info = json_decode( wp_remote_retrieve_body( $request ) );
|
286 |
-
}
|
287 |
-
if ( ! empty( $version_info ) && isset( $version_info->sections ) ) {
|
288 |
-
$version_info->sections = maybe_unserialize( $version_info->sections );
|
289 |
-
} else {
|
290 |
-
$version_info = false;
|
291 |
-
}
|
292 |
-
set_transient( $cache_key, $version_info, 3600 );
|
293 |
-
}
|
294 |
-
if( ! empty( $version_info ) && isset( $version_info->sections['changelog'] ) ) {
|
295 |
-
echo '<div style="background:#fff;padding:10px;">' . $version_info->sections['changelog'] . '</div>';
|
296 |
-
}
|
297 |
-
exit;
|
298 |
-
}
|
299 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/actions.php
DELETED
@@ -1,43 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
/**
|
3 |
-
* Front-end Actions
|
4 |
-
*
|
5 |
-
* @package Ninja Forms
|
6 |
-
* @subpackage Functions
|
7 |
-
* @copyright Copyright (c) 2014, WP Ninjas
|
8 |
-
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
-
* @since 2.7
|
10 |
-
*/
|
11 |
-
|
12 |
-
// Exit if accessed directly
|
13 |
-
if ( ! defined( 'ABSPATH' ) ) exit;
|
14 |
-
|
15 |
-
/**
|
16 |
-
* Hooks NF actions, when present in the $_GET superglobal. Every nf_action
|
17 |
-
* present in $_GET is called using WordPress's do_action function. These
|
18 |
-
* functions are called on init.
|
19 |
-
*
|
20 |
-
* @since 2.7
|
21 |
-
* @return void
|
22 |
-
*/
|
23 |
-
function nf_get_actions() {
|
24 |
-
if ( isset( $_GET['nf_action'] ) ) {
|
25 |
-
do_action( 'nf_' . sanitize_text_field($_GET['nf_action']), $_GET );
|
26 |
-
}
|
27 |
-
}
|
28 |
-
add_action( 'init', 'nf_get_actions', 999 );
|
29 |
-
|
30 |
-
/**
|
31 |
-
* Hooks NF actions, when present in the $_POST superglobal. Every nf_action
|
32 |
-
* present in $_POST is called using WordPress's do_action function. These
|
33 |
-
* functions are called on init.
|
34 |
-
*
|
35 |
-
* @since 2.7
|
36 |
-
* @return void
|
37 |
-
*/
|
38 |
-
function nf_post_actions() {
|
39 |
-
if ( isset( $_POST['nf_action'] ) ) {
|
40 |
-
do_action( 'nf_' . sanitize_text_field($_POST['nf_action']), $_POST );
|
41 |
-
}
|
42 |
-
}
|
43 |
-
add_action( 'init', 'nf_post_actions', 999 );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/activation.php
DELETED
@@ -1,272 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
|
3 |
-
/*
|
4 |
-
*
|
5 |
-
* Function that checks to see if the new defined files from version 2.2.30 are present. If they aren't, add them.
|
6 |
-
*
|
7 |
-
* @since 2.2.30
|
8 |
-
* @returns void
|
9 |
-
*/
|
10 |
-
|
11 |
-
function ninja_forms_defined_fields_check(){
|
12 |
-
$screen = get_current_screen();
|
13 |
-
if ( $screen->base == 'toplevel_page_ninja-forms' ) {
|
14 |
-
global $wpdb;
|
15 |
-
// Run our update.
|
16 |
-
// Make sure that our defined fields don't already exist.
|
17 |
-
$tax = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM ".NINJA_FORMS_FAV_FIELDS_TABLE_NAME." WHERE name = %s AND row_type = 0", 'Tax' ), ARRAY_A );
|
18 |
-
if( !isset($tax['id']) ){
|
19 |
-
$sql = 'INSERT INTO `'.NINJA_FORMS_FAV_FIELDS_TABLE_NAME.'` (`id`, `row_type`, `type`, `order`, `data`, `name`) VALUES
|
20 |
-
(NULL, 0, \'_tax\', 0, \'a:11:{s:5:"label";s:3:"Tax";s:9:"label_pos";s:5:"above";s:13:"default_value";s:0:"";s:19:"payment_field_group";s:1:"1";s:11:"payment_tax";s:1:"1";s:5:"class";s:0:"";s:9:"show_help";s:1:"0";s:9:"help_text";s:0:"";s:11:"conditional";s:0:"";s:11:"calc_option";s:1:"0";s:4:"calc";s:0:"";}\', \'Tax\'),
|
21 |
-
(NULL, 0, \'_text\', 0, \'a:19:{s:5:"label";s:10:"First Name";s:9:"label_pos";s:5:"above";s:13:"default_value";s:0:"";s:4:"mask";s:0:"";s:10:"datepicker";s:1:"0";s:5:"email";s:1:"0";s:10:"send_email";s:1:"0";s:10:"from_email";s:1:"0";s:10:"first_name";s:1:"1";s:9:"last_name";s:1:"0";s:9:"from_name";s:1:"0";s:21:"user_info_field_group";s:1:"1";s:3:"req";s:1:"0";s:5:"class";s:0:"";s:9:"show_help";s:1:"0";s:9:"help_text";s:0:"";s:17:"calc_auto_include";s:1:"0";s:11:"calc_option";s:1:"0";s:11:"conditional";s:0:"";}\', \'First Name\'),
|
22 |
-
(NULL, 0, \'_text\', 0, \'a:19:{s:5:"label";s:9:"Last Name";s:9:"label_pos";s:5:"above";s:13:"default_value";s:0:"";s:4:"mask";s:0:"";s:10:"datepicker";s:1:"0";s:5:"email";s:1:"0";s:10:"send_email";s:1:"0";s:10:"from_email";s:1:"0";s:10:"first_name";s:1:"0";s:9:"last_name";s:1:"1";s:9:"from_name";s:1:"0";s:21:"user_info_field_group";s:1:"1";s:3:"req";s:1:"0";s:5:"class";s:0:"";s:9:"show_help";s:1:"0";s:9:"help_text";s:0:"";s:17:"calc_auto_include";s:1:"0";s:11:"calc_option";s:1:"0";s:11:"conditional";s:0:"";}\', \'Last Name\'),
|
23 |
-
(NULL, 0, \'_text\', 0, \'a:23:{s:5:"label";s:9:"Address 1";s:9:"label_pos";s:5:"above";s:13:"default_value";s:0:"";s:4:"mask";s:0:"";s:10:"datepicker";s:1:"0";s:5:"email";s:1:"0";s:10:"send_email";s:1:"0";s:10:"from_email";s:1:"0";s:10:"first_name";s:1:"0";s:9:"last_name";s:1:"0";s:9:"from_name";s:1:"0";s:14:"user_address_1";s:1:"1";s:14:"user_address_2";s:1:"0";s:9:"user_city";s:1:"0";s:8:"user_zip";s:1:"0";s:21:"user_info_field_group";s:1:"1";s:3:"req";s:1:"0";s:5:"class";s:0:"";s:9:"show_help";s:1:"0";s:9:"help_text";s:0:"";s:17:"calc_auto_include";s:1:"0";s:11:"calc_option";s:1:"0";s:11:"conditional";s:0:"";}\', \'Address 1\'),
|
24 |
-
(NULL, 0, \'_text\', 0, \'a:23:{s:5:"label";s:9:"Address 2";s:9:"label_pos";s:5:"above";s:13:"default_value";s:0:"";s:4:"mask";s:0:"";s:10:"datepicker";s:1:"0";s:5:"email";s:1:"0";s:10:"send_email";s:1:"0";s:10:"from_email";s:1:"0";s:10:"first_name";s:1:"0";s:9:"last_name";s:1:"0";s:9:"from_name";s:1:"0";s:14:"user_address_1";s:1:"0";s:14:"user_address_2";s:1:"1";s:9:"user_city";s:1:"0";s:8:"user_zip";s:1:"0";s:21:"user_info_field_group";s:1:"1";s:3:"req";s:1:"0";s:5:"class";s:0:"";s:9:"show_help";s:1:"0";s:9:"help_text";s:0:"";s:17:"calc_auto_include";s:1:"0";s:11:"calc_option";s:1:"0";s:11:"conditional";s:0:"";}\', \'Address 2\'),
|
25 |
-
(NULL, 0, \'_text\', 0, \'a:23:{s:5:"label";s:4:"City";s:9:"label_pos";s:5:"above";s:13:"default_value";s:0:"";s:4:"mask";s:0:"";s:10:"datepicker";s:1:"0";s:5:"email";s:1:"0";s:10:"send_email";s:1:"0";s:10:"from_email";s:1:"0";s:10:"first_name";s:1:"0";s:9:"last_name";s:1:"0";s:9:"from_name";s:1:"0";s:14:"user_address_1";s:1:"0";s:14:"user_address_2";s:1:"0";s:9:"user_city";s:1:"1";s:8:"user_zip";s:1:"0";s:21:"user_info_field_group";s:1:"1";s:3:"req";s:1:"0";s:5:"class";s:0:"";s:9:"show_help";s:1:"0";s:9:"help_text";s:0:"";s:17:"calc_auto_include";s:1:"0";s:11:"calc_option";s:1:"0";s:11:"conditional";s:0:"";}\', \'City\'),
|
26 |
-
(NULL, 0, \'_list\', 0, \'a:16:{s:5:"label";s:5:"State";s:9:"label_pos";s:5:"above";s:10:"multi_size";s:1:"5";s:15:"list_show_value";s:1:"1";s:4:"list";a:1:{s:7:"options";a:51:{i:0;a:4:{s:5:"label";s:7:"Alabama";s:5:"value";s:2:"AL";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:1;a:4:{s:5:"label";s:6:"Alaska";s:5:"value";s:2:"AK";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:2;a:4:{s:5:"label";s:7:"Arizona";s:5:"value";s:2:"AZ";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:3;a:4:{s:5:"label";s:8:"Arkansas";s:5:"value";s:2:"AR";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:4;a:4:{s:5:"label";s:10:"California";s:5:"value";s:2:"CA";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:5;a:4:{s:5:"label";s:8:"Colorado";s:5:"value";s:2:"CO";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:6;a:4:{s:5:"label";s:11:"Connecticut";s:5:"value";s:2:"CT";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:7;a:4:{s:5:"label";s:8:"Delaware";s:5:"value";s:2:"DE";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:8;a:4:{s:5:"label";s:20:"District of Columbia";s:5:"value";s:2:"DC";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:9;a:4:{s:5:"label";s:7:"Florida";s:5:"value";s:2:"FL";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:10;a:4:{s:5:"label";s:7:"Georgia";s:5:"value";s:2:"GA";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:11;a:4:{s:5:"label";s:6:"Hawaii";s:5:"value";s:2:"HI";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:12;a:4:{s:5:"label";s:5:"Idaho";s:5:"value";s:2:"ID";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:13;a:4:{s:5:"label";s:8:"Illinois";s:5:"value";s:2:"IL";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:14;a:4:{s:5:"label";s:7:"Indiana";s:5:"value";s:2:"IN";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:15;a:4:{s:5:"label";s:4:"Iowa";s:5:"value";s:2:"IA";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:16;a:4:{s:5:"label";s:6:"Kansas";s:5:"value";s:2:"KS";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:17;a:4:{s:5:"label";s:8:"Kentucky";s:5:"value";s:2:"KY";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:18;a:4:{s:5:"label";s:9:"Louisiana";s:5:"value";s:2:"LA";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:19;a:4:{s:5:"label";s:5:"Maine";s:5:"value";s:2:"ME";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:20;a:4:{s:5:"label";s:8:"Maryland";s:5:"value";s:2:"MD";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:21;a:4:{s:5:"label";s:13:"Massachusetts";s:5:"value";s:2:"MA";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:22;a:4:{s:5:"label";s:8:"Michigan";s:5:"value";s:2:"MI";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:23;a:4:{s:5:"label";s:9:"Minnesota";s:5:"value";s:2:"MN";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:24;a:4:{s:5:"label";s:11:"Mississippi";s:5:"value";s:2:"MS";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:25;a:4:{s:5:"label";s:8:"Missouri";s:5:"value";s:2:"MO";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:26;a:4:{s:5:"label";s:7:"Montana";s:5:"value";s:2:"MT";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:27;a:4:{s:5:"label";s:8:"Nebraska";s:5:"value";s:2:"NE";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:28;a:4:{s:5:"label";s:6:"Nevada";s:5:"value";s:2:"NV";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:29;a:4:{s:5:"label";s:13:"New Hampshire";s:5:"value";s:2:"NH";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:30;a:4:{s:5:"label";s:10:"New Jersey";s:5:"value";s:2:"NJ";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:31;a:4:{s:5:"label";s:10:"New Mexico";s:5:"value";s:2:"NM";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:32;a:4:{s:5:"label";s:8:"New York";s:5:"value";s:2:"NY";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:33;a:4:{s:5:"label";s:14:"North Carolina";s:5:"value";s:2:"NC";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:34;a:4:{s:5:"label";s:12:"North Dakota";s:5:"value";s:2:"ND";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:35;a:4:{s:5:"label";s:4:"Ohio";s:5:"value";s:2:"OH";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:36;a:4:{s:5:"label";s:8:"Oklahoma";s:5:"value";s:2:"OK";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:37;a:4:{s:5:"label";s:6:"Oregon";s:5:"value";s:2:"OR";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:38;a:4:{s:5:"label";s:12:"Pennsylvania";s:5:"value";s:2:"PA";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:39;a:4:{s:5:"label";s:12:"Rhode Island";s:5:"value";s:2:"RI";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:40;a:4:{s:5:"label";s:14:"South Carolina";s:5:"value";s:2:"SC";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:41;a:4:{s:5:"label";s:12:"South Dakota";s:5:"value";s:2:"SD";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:42;a:4:{s:5:"label";s:9:"Tennessee";s:5:"value";s:2:"TN";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:43;a:4:{s:5:"label";s:5:"Texas";s:5:"value";s:2:"TX";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:44;a:4:{s:5:"label";s:4:"Utah";s:5:"value";s:2:"UT";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:45;a:4:{s:5:"label";s:7:"Vermont";s:5:"value";s:2:"VT";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:46;a:4:{s:5:"label";s:8:"Virginia";s:5:"value";s:2:"VA";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:47;a:4:{s:5:"label";s:10:"Washington";s:5:"value";s:2:"WA";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:48;a:4:{s:5:"label";s:13:"West Virginia";s:5:"value";s:2:"WV";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:49;a:4:{s:5:"label";s:9:"Wisconsin";s:5:"value";s:2:"WI";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}i:50;a:4:{s:5:"label";s:7:"Wyoming";s:5:"value";s:2:"WY";s:4:"calc";s:0:"";s:8:"selected";s:1:"0";}}}s:9:"list_type";s:8:"dropdown";s:10:"user_state";s:1:"1";s:21:"user_info_field_group";s:1:"1";s:13:"populate_term";s:0:"";s:3:"req";s:1:"0";s:5:"class";s:0:"";s:9:"show_help";s:1:"0";s:9:"help_text";s:0:"";s:17:"calc_auto_include";s:1:"0";s:11:"calc_option";s:1:"0";s:11:"conditional";s:0:"";}\', \'State\'),
|
27 |
-
(NULL, 0, \'_text\', 0, \'a:23:{s:5:"label";s:15:"Zip / Post Code";s:9:"label_pos";s:5:"above";s:13:"default_value";s:0:"";s:4:"mask";s:0:"";s:10:"datepicker";s:1:"0";s:5:"email";s:1:"0";s:10:"send_email";s:1:"0";s:10:"from_email";s:1:"0";s:10:"first_name";s:1:"0";s:9:"last_name";s:1:"0";s:9:"from_name";s:1:"0";s:14:"user_address_1";s:1:"0";s:14:"user_address_2";s:1:"0";s:9:"user_city";s:1:"0";s:8:"user_zip";s:1:"1";s:21:"user_info_field_group";s:1:"1";s:3:"req";s:1:"0";s:5:"class";s:0:"";s:9:"show_help";s:1:"0";s:9:"help_text";s:0:"";s:17:"calc_auto_include";s:1:"0";s:11:"calc_option";s:1:"0";s:11:"conditional";s:0:"";}\', \'Zip / Post Code\'),
|
28 |
-
(NULL, 0, \'_country\', 0, \'a:10:{s:5:"label";s:7:"Country";s:9:"label_pos";s:5:"above";s:13:"default_value";s:2:"US";s:21:"user_info_field_group";s:1:"1";s:5:"class";s:0:"";s:9:"show_help";s:1:"0";s:9:"help_text";s:0:"";s:17:"calc_auto_include";s:1:"0";s:11:"calc_option";s:1:"0";s:11:"conditional";s:0:"";}\', \'Country\'),
|
29 |
-
(NULL, 0, \'_text\', 0, \'a:25:{s:5:"label";s:5:"Email";s:9:"label_pos";s:5:"above";s:13:"default_value";s:0:"";s:4:"mask";s:0:"";s:10:"datepicker";s:1:"0";s:5:"email";s:1:"1";s:10:"send_email";s:1:"0";s:10:"from_email";s:1:"0";s:10:"first_name";s:1:"0";s:9:"last_name";s:1:"0";s:9:"from_name";s:1:"0";s:14:"user_address_1";s:1:"0";s:14:"user_address_2";s:1:"0";s:9:"user_city";s:1:"0";s:8:"user_zip";s:1:"0";s:10:"user_phone";s:1:"0";s:10:"user_email";s:1:"1";s:21:"user_info_field_group";s:1:"1";s:3:"req";s:1:"0";s:5:"class";s:0:"";s:9:"show_help";s:1:"0";s:9:"help_text";s:0:"";s:17:"calc_auto_include";s:1:"0";s:11:"calc_option";s:1:"0";s:11:"conditional";s:0:"";}\', \'Email\'),
|
30 |
-
(NULL, 0, \'_text\', 0, \'a:25:{s:5:"label";s:5:"Phone";s:9:"label_pos";s:5:"above";s:13:"default_value";s:0:"";s:4:"mask";s:14:"(999) 999-9999";s:10:"datepicker";s:1:"0";s:5:"email";s:1:"0";s:10:"send_email";s:1:"0";s:10:"from_email";s:1:"0";s:10:"first_name";s:1:"0";s:9:"last_name";s:1:"0";s:9:"from_name";s:1:"0";s:14:"user_address_1";s:1:"0";s:14:"user_address_2";s:1:"0";s:9:"user_city";s:1:"0";s:8:"user_zip";s:1:"0";s:10:"user_phone";s:1:"1";s:10:"user_email";s:1:"0";s:21:"user_info_field_group";s:1:"1";s:3:"req";s:1:"0";s:5:"class";s:0:"";s:9:"show_help";s:1:"0";s:9:"help_text";s:0:"";s:17:"calc_auto_include";s:1:"0";s:11:"calc_option";s:1:"0";s:11:"conditional";s:0:"";}\', \'Phone\'),
|
31 |
-
(NULL, 0, \'_calc\', 0, \'a:20:{s:9:"calc_name";s:9:"sub_total";s:13:"default_value";s:0:"";s:17:"calc_display_type";s:4:"text";s:5:"label";s:9:"Sub Total";s:9:"label_pos";s:5:"above";s:26:"calc_display_text_disabled";s:1:"1";s:17:"calc_display_html";s:26:"<p>[ninja_forms_calc]</p>\n";s:5:"class";s:0:"";s:9:"show_help";s:1:"0";s:9:"help_text";s:0:"";s:11:"calc_method";s:4:"auto";s:4:"calc";s:0:"";s:7:"calc_eq";s:0:"";s:19:"payment_field_group";s:1:"1";s:13:"payment_total";s:1:"0";s:17:"payment_sub_total";s:1:"1";s:11:"calc_places";s:1:"2";s:17:"calc_auto_include";s:1:"0";s:11:"calc_option";s:1:"0";s:11:"conditional";s:0:"";}\', \'Sub Total\'),
|
32 |
-
(NULL, 0, \'_calc\', 0, \'a:20:{s:9:"calc_name";s:5:"total";s:13:"default_value";s:0:"";s:17:"calc_display_type";s:4:"text";s:5:"label";s:5:"Total";s:9:"label_pos";s:5:"above";s:26:"calc_display_text_disabled";s:1:"1";s:17:"calc_display_html";s:26:"<p>[ninja_forms_calc]</p>\n";s:5:"class";s:0:"";s:9:"show_help";s:1:"0";s:9:"help_text";s:0:"";s:11:"calc_method";s:4:"auto";s:4:"calc";a:5:{i:0;a:2:{s:2:"op";s:3:"add";s:5:"field";s:2:"70";}i:1;a:2:{s:2:"op";s:3:"add";s:5:"field";s:2:"69";}i:2;a:2:{s:2:"op";s:3:"add";s:5:"field";s:2:"15";}i:3;a:2:{s:2:"op";s:3:"add";s:5:"field";s:2:"61";}i:4;a:2:{s:2:"op";s:3:"add";s:5:"field";s:2:"70";}}s:7:"calc_eq";s:5:"5 + 5";s:19:"payment_field_group";s:1:"1";s:13:"payment_total";s:1:"1";s:17:"payment_sub_total";s:1:"0";s:11:"calc_places";s:1:"2";s:17:"calc_auto_include";s:1:"0";s:11:"calc_option";s:1:"0";s:11:"conditional";s:0:"";}\', \'Total\');';
|
33 |
-
$wpdb->query($sql);
|
34 |
-
}
|
35 |
-
$credit_card = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM ".NINJA_FORMS_FAV_FIELDS_TABLE_NAME." WHERE name = %s AND row_type = 0", 'Credit Card' ), ARRAY_A );
|
36 |
-
if( !isset( $credit_card['id'] ) ){
|
37 |
-
$sql = 'INSERT INTO `'.NINJA_FORMS_FAV_FIELDS_TABLE_NAME.'` (`id`, `row_type`, `type`, `order`, `data`, `name`) VALUES (92, 0, \'_credit_card\', 0, \'a:6:{s:5:"label";s:11:"Credit Card";s:19:"payment_field_group";s:1:"1";s:3:"req";s:1:"0";s:9:"show_help";s:1:"0";s:9:"help_text";s:0:"";s:11:"conditional";s:0:"";}\', \'Credit Card\');';
|
38 |
-
$wpdb->query($sql);
|
39 |
-
}
|
40 |
-
}
|
41 |
-
}
|
42 |
-
|
43 |
-
add_action( 'current_screen', 'ninja_forms_defined_fields_check' );
|
44 |
-
|
45 |
-
|
46 |
-
function ninja_forms_activation( $network_wide ){
|
47 |
-
global $wpdb;
|
48 |
-
|
49 |
-
if ( ! $network_wide ) { // This is a single-site activation.
|
50 |
-
|
51 |
-
wp_schedule_event( time(), 'daily', 'ninja_forms_daily_action' );
|
52 |
-
|
53 |
-
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
|
54 |
-
|
55 |
-
$plugin_settings = nf_get_settings();
|
56 |
-
|
57 |
-
$current_version = isset ( $plugin_settings['version'] ) ? $plugin_settings['version'] : '';
|
58 |
-
|
59 |
-
if ( $current_version != '' ) {
|
60 |
-
update_option( 'nf_version_upgraded_from', $current_version );
|
61 |
-
}
|
62 |
-
|
63 |
-
$forms = '';
|
64 |
-
|
65 |
-
$opt = $plugin_settings;
|
66 |
-
|
67 |
-
$sql = "CREATE TABLE IF NOT EXISTS ".NINJA_FORMS_FAV_FIELDS_TABLE_NAME." (
|
68 |
-
`id` int(11) NOT NULL AUTO_INCREMENT,
|
69 |
-
`row_type` int(11) NOT NULL,
|
70 |
-
`type` varchar(255) CHARACTER SET utf8 NOT NULL,
|
71 |
-
`order` int(11) NOT NULL,
|
72 |
-
`data` longtext CHARACTER SET utf8 NOT NULL,
|
73 |
-
`name` varchar(255) CHARACTER SET utf8 NOT NULL,
|
74 |
-
PRIMARY KEY (`id`)
|
75 |
-
) DEFAULT CHARSET=utf8;";
|
76 |
-
|
77 |
-
dbDelta($sql);
|
78 |
-
|
79 |
-
if (!function_exists('nf_change_email_fav')){
|
80 |
-
require_once dirname(__FILE__).'/admin/upgrades/upgrade-functions.php';
|
81 |
-
}
|
82 |
-
// Remove old email settings.
|
83 |
-
nf_change_email_fav();
|
84 |
-
|
85 |
-
$state_dropdown = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM ".NINJA_FORMS_FAV_FIELDS_TABLE_NAME." WHERE name = %s AND row_type = 0", 'State Dropdown' ), ARRAY_A );
|
86 |
-
if( !isset($state_dropdown['id']) ){
|
87 |
-
$sql = 'INSERT INTO `'.NINJA_FORMS_FAV_FIELDS_TABLE_NAME.'` (`id`, `row_type`, `type`, `order`, `data`, `name`) VALUES
|
88 |
-
(2, 0, \'_list\', 0, \'a:10:{s:5:\"label\";s:14:\"State Dropdown\";s:9:\"label_pos\";s:4:\"left\";s:9:\"list_type\";s:8:\"dropdown\";s:10:\"multi_size\";s:1:\"5\";s:15:\"list_show_value\";s:1:\"1\";s:4:\"list\";a:1:{s:7:\"options\";a:51:{i:0;a:3:{s:5:\"label\";s:7:\"Alabama\";s:5:\"value\";s:2:\"AL\";s:8:\"selected\";s:1:\"0\";}i:1;a:3:{s:5:\"label\";s:6:\"Alaska\";s:5:\"value\";s:2:\"AK\";s:8:\"selected\";s:1:\"0\";}i:2;a:3:{s:5:\"label\";s:7:\"Arizona\";s:5:\"value\";s:2:\"AZ\";s:8:\"selected\";s:1:\"0\";}i:3;a:3:{s:5:\"label\";s:8:\"Arkansas\";s:5:\"value\";s:2:\"AR\";s:8:\"selected\";s:1:\"0\";}i:4;a:3:{s:5:\"label\";s:10:\"California\";s:5:\"value\";s:2:\"CA\";s:8:\"selected\";s:1:\"0\";}i:5;a:3:{s:5:\"label\";s:8:\"Colorado\";s:5:\"value\";s:2:\"CO\";s:8:\"selected\";s:1:\"0\";}i:6;a:3:{s:5:\"label\";s:11:\"Connecticut\";s:5:\"value\";s:2:\"CT\";s:8:\"selected\";s:1:\"0\";}i:7;a:3:{s:5:\"label\";s:8:\"Delaware\";s:5:\"value\";s:2:\"DE\";s:8:\"selected\";s:1:\"0\";}i:8;a:3:{s:5:\"label\";s:20:\"District of Columbia\";s:5:\"value\";s:2:\"DC\";s:8:\"selected\";s:1:\"0\";}i:9;a:3:{s:5:\"label\";s:7:\"Florida\";s:5:\"value\";s:2:\"FL\";s:8:\"selected\";s:1:\"0\";}i:10;a:3:{s:5:\"label\";s:7:\"Georgia\";s:5:\"value\";s:2:\"GA\";s:8:\"selected\";s:1:\"0\";}i:11;a:3:{s:5:\"label\";s:6:\"Hawaii\";s:5:\"value\";s:2:\"HI\";s:8:\"selected\";s:1:\"0\";}i:12;a:3:{s:5:\"label\";s:5:\"Idaho\";s:5:\"value\";s:2:\"ID\";s:8:\"selected\";s:1:\"0\";}i:13;a:3:{s:5:\"label\";s:8:\"Illinois\";s:5:\"value\";s:2:\"IL\";s:8:\"selected\";s:1:\"0\";}i:14;a:3:{s:5:\"label\";s:7:\"Indiana\";s:5:\"value\";s:2:\"IN\";s:8:\"selected\";s:1:\"0\";}i:15;a:3:{s:5:\"label\";s:4:\"Iowa\";s:5:\"value\";s:2:\"IA\";s:8:\"selected\";s:1:\"0\";}i:16;a:3:{s:5:\"label\";s:6:\"Kansas\";s:5:\"value\";s:2:\"KS\";s:8:\"selected\";s:1:\"0\";}i:17;a:3:{s:5:\"label\";s:8:\"Kentucky\";s:5:\"value\";s:2:\"KY\";s:8:\"selected\";s:1:\"0\";}i:18;a:3:{s:5:\"label\";s:9:\"Louisiana\";s:5:\"value\";s:2:\"LA\";s:8:\"selected\";s:1:\"0\";}i:19;a:3:{s:5:\"label\";s:5:\"Maine\";s:5:\"value\";s:2:\"ME\";s:8:\"selected\";s:1:\"0\";}i:20;a:3:{s:5:\"label\";s:8:\"Maryland\";s:5:\"value\";s:2:\"MD\";s:8:\"selected\";s:1:\"0\";}i:21;a:3:{s:5:\"label\";s:13:\"Massachusetts\";s:5:\"value\";s:2:\"MA\";s:8:\"selected\";s:1:\"0\";}i:22;a:3:{s:5:\"label\";s:8:\"Michigan\";s:5:\"value\";s:2:\"MI\";s:8:\"selected\";s:1:\"0\";}i:23;a:3:{s:5:\"label\";s:9:\"Minnesota\";s:5:\"value\";s:2:\"MN\";s:8:\"selected\";s:1:\"0\";}i:24;a:3:{s:5:\"label\";s:11:\"Mississippi\";s:5:\"value\";s:2:\"MS\";s:8:\"selected\";s:1:\"0\";}i:25;a:3:{s:5:\"label\";s:8:\"Missouri\";s:5:\"value\";s:2:\"MO\";s:8:\"selected\";s:1:\"0\";}i:26;a:3:{s:5:\"label\";s:7:\"Montana\";s:5:\"value\";s:2:\"MT\";s:8:\"selected\";s:1:\"0\";}i:27;a:3:{s:5:\"label\";s:8:\"Nebraska\";s:5:\"value\";s:2:\"NE\";s:8:\"selected\";s:1:\"0\";}i:28;a:3:{s:5:\"label\";s:6:\"Nevada\";s:5:\"value\";s:2:\"NV\";s:8:\"selected\";s:1:\"0\";}i:29;a:3:{s:5:\"label\";s:13:\"New Hampshire\";s:5:\"value\";s:2:\"NH\";s:8:\"selected\";s:1:\"0\";}i:30;a:3:{s:5:\"label\";s:10:\"New Jersey\";s:5:\"value\";s:2:\"NJ\";s:8:\"selected\";s:1:\"0\";}i:31;a:3:{s:5:\"label\";s:10:\"New Mexico\";s:5:\"value\";s:2:\"NM\";s:8:\"selected\";s:1:\"0\";}i:32;a:3:{s:5:\"label\";s:8:\"New York\";s:5:\"value\";s:2:\"NY\";s:8:\"selected\";s:1:\"0\";}i:33;a:3:{s:5:\"label\";s:14:\"North Carolina\";s:5:\"value\";s:2:\"NC\";s:8:\"selected\";s:1:\"0\";}i:34;a:3:{s:5:\"label\";s:12:\"North Dakota\";s:5:\"value\";s:2:\"ND\";s:8:\"selected\";s:1:\"0\";}i:35;a:3:{s:5:\"label\";s:4:\"Ohio\";s:5:\"value\";s:2:\"OH\";s:8:\"selected\";s:1:\"0\";}i:36;a:3:{s:5:\"label\";s:8:\"Oklahoma\";s:5:\"value\";s:2:\"OK\";s:8:\"selected\";s:1:\"0\";}i:37;a:3:{s:5:\"label\";s:6:\"Oregon\";s:5:\"value\";s:2:\"OR\";s:8:\"selected\";s:1:\"0\";}i:38;a:3:{s:5:\"label\";s:12:\"Pennsylvania\";s:5:\"value\";s:2:\"PA\";s:8:\"selected\";s:1:\"0\";}i:39;a:3:{s:5:\"label\";s:12:\"Rhode Island\";s:5:\"value\";s:2:\"RI\";s:8:\"selected\";s:1:\"0\";}i:40;a:3:{s:5:\"label\";s:14:\"South Carolina\";s:5:\"value\";s:2:\"SC\";s:8:\"selected\";s:1:\"0\";}i:41;a:3:{s:5:\"label\";s:12:\"South Dakota\";s:5:\"value\";s:2:\"SD\";s:8:\"selected\";s:1:\"0\";}i:42;a:3:{s:5:\"label\";s:9:\"Tennessee\";s:5:\"value\";s:2:\"TN\";s:8:\"selected\";s:1:\"0\";}i:43;a:3:{s:5:\"label\";s:5:\"Texas\";s:5:\"value\";s:2:\"TX\";s:8:\"selected\";s:1:\"0\";}i:44;a:3:{s:5:\"label\";s:4:\"Utah\";s:5:\"value\";s:2:\"UT\";s:8:\"selected\";s:1:\"0\";}i:45;a:3:{s:5:\"label\";s:7:\"Vermont\";s:5:\"value\";s:2:\"VT\";s:8:\"selected\";s:1:\"0\";}i:46;a:3:{s:5:\"label\";s:8:\"Virginia\";s:5:\"value\";s:2:\"VA\";s:8:\"selected\";s:1:\"0\";}i:47;a:3:{s:5:\"label\";s:10:\"Washington\";s:5:\"value\";s:2:\"WA\";s:8:\"selected\";s:1:\"0\";}i:48;a:3:{s:5:\"label\";s:13:\"West Virginia\";s:5:\"value\";s:2:\"WV\";s:8:\"selected\";s:1:\"0\";}i:49;a:3:{s:5:\"label\";s:9:\"Wisconsin\";s:5:\"value\";s:2:\"WI\";s:8:\"selected\";s:1:\"0\";}i:50;a:3:{s:5:\"label\";s:7:\"Wyoming\";s:5:\"value\";s:2:\"WY\";s:8:\"selected\";s:1:\"0\";}}}s:3:\"req\";s:1:\"0\";s:5:\"class\";s:0:\"\";s:9:\"show_help\";s:1:\"0\";s:9:\"help_text\";s:0:\"\";}\', \'State Dropdown\')';
|
89 |
-
$wpdb->query($sql);
|
90 |
-
}
|
91 |
-
|
92 |
-
$anti_spam = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM ".NINJA_FORMS_FAV_FIELDS_TABLE_NAME." WHERE name = %s AND row_type = 0", 'Anti-Spam' ), ARRAY_A );
|
93 |
-
if( !isset($anti_spam['id']) ){
|
94 |
-
$sql = 'INSERT INTO `'.NINJA_FORMS_FAV_FIELDS_TABLE_NAME.'` (`id`, `row_type`, `type`, `order`, `data`, `name`) VALUES
|
95 |
-
(3, 0, \'_spam\', 0, \'a:6:{s:9:"label_pos";s:4:"left";s:5:"label";s:18:"Anti-Spam Question";s:6:"answer";s:16:"Anti-Spam Answer";s:5:"class";s:0:"";s:9:"show_help";s:1:"0";s:9:"help_text";s:0:"";}\', \'Anti-Spam\')';
|
96 |
-
$wpdb->query($sql);
|
97 |
-
}
|
98 |
-
|
99 |
-
$submit = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM ".NINJA_FORMS_FAV_FIELDS_TABLE_NAME." WHERE name = %s AND row_type = 0", 'Submit' ), ARRAY_A );
|
100 |
-
if( !isset($submit['id']) ){
|
101 |
-
$sql = 'INSERT INTO `'.NINJA_FORMS_FAV_FIELDS_TABLE_NAME.'` (`id`, `row_type`, `type`, `order`, `data`, `name`) VALUES
|
102 |
-
(4, 0, \'_submit\', 0, \'a:4:{s:5:\"label\";s:6:\"Submit\";s:5:\"class\";s:0:\"\";s:9:\"show_help\";s:1:\"0\";s:9:\"help_text\";s:0:\"\";}\', \'Submit\');';
|
103 |
-
$wpdb->query($sql);
|
104 |
-
}
|
105 |
-
|
106 |
-
$sql = "CREATE TABLE IF NOT EXISTS ".NINJA_FORMS_FIELDS_TABLE_NAME." (
|
107 |
-
`id` int(11) NOT NULL AUTO_INCREMENT,
|
108 |
-
`form_id` int(11) NOT NULL,
|
109 |
-
`type` varchar(255) CHARACTER SET utf8 NOT NULL,
|
110 |
-
`order` int(11) NOT NULL,
|
111 |
-
`data` longtext CHARACTER SET utf8 NOT NULL,
|
112 |
-
`fav_id` int(11) DEFAULT NULL,
|
113 |
-
`def_id` int(11) DEFAULT NULL,
|
114 |
-
PRIMARY KEY (`id`)
|
115 |
-
) DEFAULT CHARSET=utf8 ;";
|
116 |
-
|
117 |
-
dbDelta($sql);
|
118 |
-
|
119 |
-
/**
|
120 |
-
* Add our table structure for version 2.8.
|
121 |
-
*/
|
122 |
-
|
123 |
-
// Create our object meta table
|
124 |
-
$sql = "CREATE TABLE IF NOT EXISTS ". NF_OBJECT_META_TABLE_NAME . " (
|
125 |
-
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
126 |
-
`object_id` bigint(20) NOT NULL,
|
127 |
-
`meta_key` varchar(255) NOT NULL,
|
128 |
-
`meta_value` longtext NOT NULL,
|
129 |
-
PRIMARY KEY (`id`)
|
130 |
-
) DEFAULT CHARSET=utf8;";
|
131 |
-
|
132 |
-
dbDelta( $sql );
|
133 |
-
|
134 |
-
// Create our object table
|
135 |
-
$sql = "CREATE TABLE IF NOT EXISTS " . NF_OBJECTS_TABLE_NAME . " (
|
136 |
-
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
137 |
-
`type` varchar(255) NOT NULL,
|
138 |
-
PRIMARY KEY (`id`)
|
139 |
-
) DEFAULT CHARSET=utf8;";
|
140 |
-
|
141 |
-
dbDelta( $sql );
|
142 |
-
|
143 |
-
// Create our object relationships table
|
144 |
-
|
145 |
-
$sql = "CREATE TABLE IF NOT EXISTS " . NF_OBJECT_RELATIONSHIPS_TABLE_NAME . " (
|
146 |
-
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
147 |
-
`child_id` bigint(20) NOT NULL,
|
148 |
-
`parent_id` bigint(20) NOT NULL,
|
149 |
-
`child_type` varchar(255) NOT NULL,
|
150 |
-
`parent_type` varchar(255) NOT NULL,
|
151 |
-
PRIMARY KEY (`id`)
|
152 |
-
) DEFAULT CHARSET=utf8;";
|
153 |
-
|
154 |
-
dbDelta( $sql );
|
155 |
-
|
156 |
-
$title = ninja_forms_get_preview_page_title();
|
157 |
-
$preview_page = get_page_by_title( $title );
|
158 |
-
if( !$preview_page ) {
|
159 |
-
// Create preview page object
|
160 |
-
$preview_post = array(
|
161 |
-
'post_title' => $title,
|
162 |
-
'post_content' => 'This is a preview of how this form will appear on your website',
|
163 |
-
'post_status' => 'draft',
|
164 |
-
'post_type' => 'page'
|
165 |
-
);
|
166 |
-
|
167 |
-
// Insert the page into the database
|
168 |
-
$page_id = wp_insert_post( $preview_post );
|
169 |
-
}else{
|
170 |
-
$page_id = $preview_page->ID;
|
171 |
-
}
|
172 |
-
|
173 |
-
$opt['preview_id'] = $page_id;
|
174 |
-
|
175 |
-
$opt['version'] = NF_PLUGIN_VERSION;
|
176 |
-
|
177 |
-
$current_settings = get_option( 'ninja_forms_settings', false );
|
178 |
-
|
179 |
-
if ( ! $current_settings ) {
|
180 |
-
update_option( 'nf_convert_notifications_complete', true );
|
181 |
-
update_option( 'nf_convert_subs_step', 'complete' );
|
182 |
-
update_option( 'nf_upgrade_notice', 'closed' );
|
183 |
-
update_option( 'nf_update_email_settings_complete', true );
|
184 |
-
update_option( 'nf_email_fav_updated', true );
|
185 |
-
update_option( 'nf_convert_forms_complete', true );
|
186 |
-
update_option( 'nf_database_migrations', true );
|
187 |
-
}
|
188 |
-
|
189 |
-
update_option( "ninja_forms_settings", $opt );
|
190 |
-
update_option( 'ninja_forms_version', NF_PLUGIN_VERSION );
|
191 |
-
|
192 |
-
// check for an existing form
|
193 |
-
$starter_form_exists = ninja_forms_starter_form_exists();
|
194 |
-
|
195 |
-
if ( ! $starter_form_exists ) {
|
196 |
-
// if a starter form doesn't exist them create it
|
197 |
-
ninja_forms_add_starter_form();
|
198 |
-
}
|
199 |
-
|
200 |
-
// Add the transient to redirect
|
201 |
-
// set_transient( '_nf_activation_redirect', true, 30 );
|
202 |
-
|
203 |
-
} else { // We're network activating.
|
204 |
-
header( 'Location: ' . network_admin_url( 'plugins.php?deactivate=true&nf_action=network_activation_error' ) );
|
205 |
-
exit;
|
206 |
-
}
|
207 |
-
}
|
208 |
-
|
209 |
-
/**
|
210 |
-
* Outputs a notice if the user attempts a network activation of the plugin.
|
211 |
-
*
|
212 |
-
* @since 2.7
|
213 |
-
* @return void
|
214 |
-
*/
|
215 |
-
function nf_network_activation_error() {
|
216 |
-
echo '<div class="error"><p>' . __( 'Ninja Forms cannot be network activated. Please visit each site\'s dashboard to activate the plugin.', 'ninja-forms' ) . '</p></div>';
|
217 |
-
deactivate_plugins( plugin_basename( __FILE__ ), TRUE, TRUE );
|
218 |
-
}
|
219 |
-
|
220 |
-
/**
|
221 |
-
* Add our network activation error to the admin_notice hook.
|
222 |
-
*
|
223 |
-
* @since 2.7
|
224 |
-
* @return void
|
225 |
-
*/
|
226 |
-
function nf_add_network_activation_error() {
|
227 |
-
add_action( 'network_admin_notices', 'nf_network_activation_error' );
|
228 |
-
}
|
229 |
-
|
230 |
-
add_action( 'nf_network_activation_error', 'nf_add_network_activation_error' );
|
231 |
-
|
232 |
-
|
233 |
-
/*
|
234 |
-
* Check to see if a form exists.
|
235 |
-
*
|
236 |
-
* @since 2.3.3
|
237 |
-
* @return bool
|
238 |
-
*/
|
239 |
-
function ninja_forms_starter_form_exists() {
|
240 |
-
$forms = ninja_forms_get_all_forms();
|
241 |
-
if( empty( $forms ) ) {
|
242 |
-
return false;
|
243 |
-
}
|
244 |
-
return true;
|
245 |
-
}
|
246 |
-
|
247 |
-
|
248 |
-
/*
|
249 |
-
* Add a starter form. Return the ID.
|
250 |
-
*
|
251 |
-
* @since 2.3.3
|
252 |
-
* @returns int
|
253 |
-
*/
|
254 |
-
function ninja_forms_add_starter_form() {
|
255 |
-
// load starter form
|
256 |
-
$file = file_get_contents( NINJA_FORMS_DIR . "/includes/forms/starter-form.nff" );
|
257 |
-
$file = apply_filters( 'ninja_forms_starter_form_contents', $file );
|
258 |
-
|
259 |
-
// create new form
|
260 |
-
ninja_forms_import_form( $file );
|
261 |
-
}
|
262 |
-
|
263 |
-
|
264 |
-
/*
|
265 |
-
* Get the preview page title
|
266 |
-
*
|
267 |
-
* @since 2.5.2
|
268 |
-
* @returns string
|
269 |
-
*/
|
270 |
-
function ninja_forms_get_preview_page_title() {
|
271 |
-
return apply_filters( 'ninja_forms_preview_page_title', 'ninja_forms_preview_page' );
|
272 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/admin/admin.php
DELETED
@@ -1,292 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
|
3 |
-
function ninja_forms_add_menu(){
|
4 |
-
$page = add_menu_page("Ninja Forms" , __( 'Forms', 'ninja-forms' ), apply_filters( 'ninja_forms_admin_parent_menu_capabilities', 'manage_options' ), "ninja-forms", "ninja_forms_admin", "dashicons-feedback", "35.1337" );
|
5 |
-
$all_forms = add_submenu_page("ninja-forms", __( 'Forms', 'ninja-forms' ), __( 'All Forms', 'ninja-forms' ), apply_filters( 'ninja_forms_admin_all_forms_capabilities', 'manage_options' ), "ninja-forms", "ninja_forms_admin");
|
6 |
-
$new_form = add_submenu_page("ninja-forms", __( 'Add New', 'ninja-forms' ), __( 'Add New', 'ninja-forms' ), apply_filters( 'ninja_forms_admin_add_new_capabilities', 'manage_options' ), "ninja-forms&tab=builder&form_id=new", "ninja_forms_admin");
|
7 |
-
|
8 |
-
$upgrade = add_submenu_page( null, __( 'Ninja Forms Upgrades', 'ninja-forms' ), __( 'Upgrades', 'ninja-forms' ), 'install_plugins', 'nf-upgrades', 'nf_upgrades_screen' );
|
9 |
-
|
10 |
-
add_action('admin_print_styles-' . $page, 'ninja_forms_admin_css');
|
11 |
-
add_action('admin_print_styles-' . $page, 'ninja_forms_admin_js');
|
12 |
-
|
13 |
-
add_action('admin_print_styles-' . $new_form, 'ninja_forms_admin_css');
|
14 |
-
add_action('admin_print_styles-' . $new_form, 'ninja_forms_admin_js');
|
15 |
-
|
16 |
-
add_action( 'load-' . $page, 'ninja_forms_load_screen_options_tab' );
|
17 |
-
add_action( 'load-' . $all_forms, 'ninja_forms_load_screen_options_tab' );
|
18 |
-
}
|
19 |
-
|
20 |
-
add_action( 'admin_menu', 'ninja_forms_add_menu' );
|
21 |
-
|
22 |
-
/**
|
23 |
-
* Add our submenu pages
|
24 |
-
*
|
25 |
-
* @since 2.7
|
26 |
-
* @return void
|
27 |
-
*/
|
28 |
-
function nf_add_submenus() {
|
29 |
-
$import = add_submenu_page("ninja-forms", __( 'Import/Export', 'ninja-forms' ), __( 'Import / Export', 'ninja-forms' ), apply_filters( 'ninja_forms_admin_import_export_capabilities', 'manage_options' ), "ninja-forms-impexp", "ninja_forms_admin");
|
30 |
-
$settings = add_submenu_page("ninja-forms", __( 'Ninja Form Settings', 'ninja-forms' ), __( 'Settings', 'ninja-forms' ), apply_filters( 'ninja_forms_admin_settings_capabilities', 'manage_options' ), "ninja-forms-settings", "ninja_forms_admin");
|
31 |
-
$system_status = add_submenu_page("ninja-forms", __( 'System Status', 'ninja-forms' ), __( 'System Status', 'ninja-forms' ), apply_filters( 'ninja_forms_admin_status_capabilities', 'manage_options' ), "ninja-forms-system-status", "ninja_forms_admin");
|
32 |
-
$extend = add_submenu_page("ninja-forms", __( 'Add-Ons', 'ninja-forms' ), __( 'Add-Ons', 'ninja-forms' ), apply_filters( 'ninja_forms_admin_extend_capabilities', 'manage_options' ), "ninja-forms-extend", "ninja_forms_admin");
|
33 |
-
|
34 |
-
add_action('admin_print_styles-' . $settings, 'ninja_forms_admin_js');
|
35 |
-
add_action('admin_print_styles-' . $settings, 'ninja_forms_admin_css');
|
36 |
-
|
37 |
-
add_action('admin_print_styles-' . $import, 'ninja_forms_admin_js');
|
38 |
-
add_action('admin_print_styles-' . $import, 'ninja_forms_admin_css');
|
39 |
-
|
40 |
-
add_action('admin_print_styles-' . $system_status, 'ninja_forms_admin_js');
|
41 |
-
add_action('admin_print_styles-' . $system_status, 'ninja_forms_admin_css');
|
42 |
-
|
43 |
-
add_action('admin_print_styles-' . $extend, 'ninja_forms_admin_js');
|
44 |
-
add_action('admin_print_styles-' . $extend, 'ninja_forms_admin_css');
|
45 |
-
|
46 |
-
add_action( 'load-' . $settings, 'ninja_forms_load_screen_options_tab' );
|
47 |
-
add_action( 'load-' . $import, 'ninja_forms_load_screen_options_tab' );
|
48 |
-
add_action( 'load-' . $system_status, 'ninja_forms_load_screen_options_tab' );
|
49 |
-
add_action( 'load-' . $extend, 'ninja_forms_load_screen_options_tab' );
|
50 |
-
}
|
51 |
-
|
52 |
-
add_action( 'admin_menu', 'nf_add_submenus', 15 );
|
53 |
-
|
54 |
-
function ninja_forms_admin(){
|
55 |
-
global $wpdb, $ninja_forms_tabs, $ninja_forms_sidebars, $current_tab, $ninja_forms_tabs_metaboxes, $ninja_forms_admin_update_message;
|
56 |
-
|
57 |
-
$current_tab = ninja_forms_get_current_tab();
|
58 |
-
$current_page = esc_html( $_REQUEST['page'] );
|
59 |
-
|
60 |
-
if( isset ( $_REQUEST['form_id'] ) ) {
|
61 |
-
$form_id = absint( $_REQUEST['form_id'] );
|
62 |
-
$data = Ninja_Forms()->form( $form_id )->get_all_settings();
|
63 |
-
$form_title = isset ( $data['form_title'] ) ? $data['form_title'] : '';
|
64 |
-
}else{
|
65 |
-
$form_id = '';
|
66 |
-
$data = '';
|
67 |
-
$form_title = '';
|
68 |
-
}
|
69 |
-
|
70 |
-
if( !isset( $ninja_forms_admin_update_message ) AND isset( $_REQUEST['update_message'] ) ){
|
71 |
-
$ninja_forms_admin_update_message = esc_html( $_REQUEST['update_message'] );
|
72 |
-
}
|
73 |
-
|
74 |
-
$output_form = isset ( $ninja_forms_tabs[$current_page][$current_tab]['output_form'] ) ? $ninja_forms_tabs[$current_page][$current_tab]['output_form'] : true;
|
75 |
-
|
76 |
-
$form_method = isset ( $ninja_forms_tabs[$current_page][$current_tab]['form_method'] ) ? $ninja_forms_tabs[$current_page][$current_tab]['form_method'] : 'post';
|
77 |
-
|
78 |
-
$hidden_fields = isset ( $ninja_forms_tabs[$current_page][$current_tab]['hidden_fields'] ) ? $ninja_forms_tabs[$current_page][$current_tab]['hidden_fields'] : true;
|
79 |
-
|
80 |
-
if ( $output_form ) {
|
81 |
-
?>
|
82 |
-
<form id="ninja_forms_admin" enctype="multipart/form-data" method="<?php echo $form_method; ?>">
|
83 |
-
<input type="hidden" name="_page" id="_page" value="<?php echo $current_page;?>">
|
84 |
-
<input type="hidden" name="_tab" id="_tab" value="<?php echo $current_tab;?>">
|
85 |
-
<input type="hidden" name="_form_id" id="_form_id" value="<?php echo $form_id;?>">
|
86 |
-
<input type="hidden" name="_fields_order" id="_fields_order" value="same">
|
87 |
-
<?php
|
88 |
-
wp_nonce_field('_ninja_forms_save','_ninja_forms_admin_submit');
|
89 |
-
}
|
90 |
-
?>
|
91 |
-
<div class="wrap">
|
92 |
-
<?php
|
93 |
-
screen_icon( 'ninja-custom-forms' );
|
94 |
-
if(isset($ninja_forms_tabs[$current_page][$current_tab]['title'])){
|
95 |
-
echo $ninja_forms_tabs[$current_page][$current_tab]['title'];
|
96 |
-
}
|
97 |
-
|
98 |
-
if ( 'form_list' == $current_tab ) {
|
99 |
-
$builder_url = esc_url( add_query_arg( array( 'form_id' => 'new', 'tab' => 'builder' ) ) );
|
100 |
-
?>
|
101 |
-
<h2><?php _e( 'Forms', 'ninja-forms' ); ?> <a href="<?php echo $builder_url; ?>" class="add-new-h2"><?php _e( 'Add New', 'ninja-forms'); ?></a></h2>
|
102 |
-
<?php
|
103 |
-
} else {
|
104 |
-
|
105 |
-
?>
|
106 |
-
<h2 id="nf-display-form-title"><?php echo $form_title; ?></h2>
|
107 |
-
<?php
|
108 |
-
}
|
109 |
-
|
110 |
-
if($ninja_forms_tabs[$current_page][$current_tab]['show_tab_links']){
|
111 |
-
?>
|
112 |
-
<h2 class="nav-tab-wrapper">
|
113 |
-
<?php
|
114 |
-
ninja_forms_display_tabs();
|
115 |
-
if ( ! empty ( $form_id ) ) {
|
116 |
-
$preview_link = ninja_forms_preview_link( $form_id, false );
|
117 |
-
$subs_link = admin_url( 'edit.php?post_status=all&post_type=nf_sub&action=-1&m=0&form_id=' . $form_id . '&begin_date&end_date&paged=1&mode=list&action2=-1' );
|
118 |
-
?>
|
119 |
-
<a href="<?php echo $preview_link; ?>" target="_blank" class="nf-preview button-secondary"><span class="dashicons dashicons-welcome-view-site"></span><?php _e( 'Preview', 'ninja-forms' ); ?></a>
|
120 |
-
<a href="<?php echo $subs_link; ?>" target="_blank" class="nf-subs button-secondary"><span class="dashicons dashicons-email-alt"></span><?php _e( 'Submissions', 'ninja-forms' ); ?></a>
|
121 |
-
<?php } ?>
|
122 |
-
</h2>
|
123 |
-
<?php
|
124 |
-
}
|
125 |
-
|
126 |
-
if( isset( $ninja_forms_admin_update_message ) AND $ninja_forms_admin_update_message != '' ){
|
127 |
-
?>
|
128 |
-
<div id="message" class="updated below-h2">
|
129 |
-
<p>
|
130 |
-
<?php echo $ninja_forms_admin_update_message;?>
|
131 |
-
</p>
|
132 |
-
</div>
|
133 |
-
<?php
|
134 |
-
}
|
135 |
-
|
136 |
-
if(isset($ninja_forms_sidebars[$current_page][$current_tab]) AND is_array($ninja_forms_sidebars[$current_page][$current_tab])){
|
137 |
-
|
138 |
-
?>
|
139 |
-
<div id="nav-menus-frame">
|
140 |
-
<?php ninja_forms_display_sidebars($data); ?>
|
141 |
-
|
142 |
-
</div><!-- /#menu-settings-column -->
|
143 |
-
<?php
|
144 |
-
|
145 |
-
}
|
146 |
-
?>
|
147 |
-
|
148 |
-
<div id="poststuff">
|
149 |
-
<div id="post-body">
|
150 |
-
<div id="post-body-content">
|
151 |
-
<?php
|
152 |
-
|
153 |
-
//Check to see if the registered tab has an metaboxes registered to it.
|
154 |
-
if(isset($ninja_forms_tabs_metaboxes[$current_page][$current_tab]) AND !empty($ninja_forms_tabs_metaboxes[$current_page][$current_tab])){
|
155 |
-
?>
|
156 |
-
<div id="ninja_forms_admin_metaboxes">
|
157 |
-
<?php
|
158 |
-
foreach($ninja_forms_tabs_metaboxes[$current_page][$current_tab] as $slug => $metabox){
|
159 |
-
ninja_forms_output_tab_metabox($form_id, $slug, $metabox);
|
160 |
-
}
|
161 |
-
?>
|
162 |
-
</div>
|
163 |
-
<?php
|
164 |
-
}
|
165 |
-
|
166 |
-
//Check to see if the registered tab has a display function registered.
|
167 |
-
if(isset($ninja_forms_tabs[$current_page][$current_tab]['display_function']) AND $ninja_forms_tabs[$current_page][$current_tab]['display_function'] != ''){
|
168 |
-
$tab_callback = $ninja_forms_tabs[$current_page][$current_tab]['display_function'];
|
169 |
-
$arguments = func_get_args();
|
170 |
-
array_shift($arguments); // We need to remove the first arg ($function_name)
|
171 |
-
$arguments['form_id'] = $form_id;
|
172 |
-
$arguments['data'] = $data;
|
173 |
-
call_user_func_array($tab_callback, $arguments);
|
174 |
-
}
|
175 |
-
|
176 |
-
if(isset($ninja_forms_tabs[$current_page][$current_tab]['show_save']) AND $ninja_forms_tabs[$current_page][$current_tab]['show_save'] === true){ ?>
|
177 |
-
<br />
|
178 |
-
<input class="button-primary menu-save ninja-forms-save-data" id="ninja_forms_save_data_top" type="submit" value="<?php _e( 'Save', 'ninja-forms' ); ?>" />
|
179 |
-
<?php
|
180 |
-
}
|
181 |
-
?>
|
182 |
-
|
183 |
-
</div><!-- /#post-body-content -->
|
184 |
-
</div><!-- /#post-body -->
|
185 |
-
</div>
|
186 |
-
</div>
|
187 |
-
<!-- </div>/.wrap-->
|
188 |
-
<?php
|
189 |
-
if ( $output_form ) {
|
190 |
-
?>
|
191 |
-
</form>
|
192 |
-
<?php
|
193 |
-
}
|
194 |
-
?>
|
195 |
-
|
196 |
-
|
197 |
-
<?php
|
198 |
-
} //End ninja_edit_forms function
|
199 |
-
|
200 |
-
if(is_admin()){
|
201 |
-
require_once(ABSPATH . 'wp-admin/includes/post.php');
|
202 |
-
}
|
203 |
-
|
204 |
-
function ninja_forms_get_current_tab(){
|
205 |
-
global $ninja_forms_tabs;
|
206 |
-
if(isset($_REQUEST['page'])){
|
207 |
-
$current_page = esc_html( $_REQUEST['page'] );
|
208 |
-
|
209 |
-
|
210 |
-
if(isset($_REQUEST['tab'])){
|
211 |
-
$current_tab = esc_html( $_REQUEST['tab'] );
|
212 |
-
}else{
|
213 |
-
if(isset($ninja_forms_tabs[$current_page]) AND is_array($ninja_forms_tabs[$current_page])){
|
214 |
-
$first_tab = array_slice($ninja_forms_tabs[$current_page], 0, 1);
|
215 |
-
foreach($first_tab as $key => $val){
|
216 |
-
$current_tab = $key;
|
217 |
-
}
|
218 |
-
}else{
|
219 |
-
$current_tab = '';
|
220 |
-
}
|
221 |
-
}
|
222 |
-
return $current_tab;
|
223 |
-
}else{
|
224 |
-
return false;
|
225 |
-
}
|
226 |
-
}
|
227 |
-
|
228 |
-
function ninja_forms_date_to_datepicker($date){
|
229 |
-
$pattern = array(
|
230 |
-
|
231 |
-
//day
|
232 |
-
'd', //day of the month
|
233 |
-
'j', //3 letter name of the day
|
234 |
-
'l', //full name of the day
|
235 |
-
'z', //day of the year
|
236 |
-
|
237 |
-
//month
|
238 |
-
'F', //Month name full
|
239 |
-
'M', //Month name short
|
240 |
-
'n', //numeric month no leading zeros
|
241 |
-
'm', //numeric month leading zeros
|
242 |
-
|
243 |
-
//year
|
244 |
-
'Y', //full numeric year
|
245 |
-
'y' //numeric year: 2 digit
|
246 |
-
);
|
247 |
-
$replace = array(
|
248 |
-
'dd','d','DD','o',
|
249 |
-
'MM','M','m','mm',
|
250 |
-
'yy','y'
|
251 |
-
);
|
252 |
-
foreach($pattern as &$p) {
|
253 |
-
$p = '/'.$p.'/';
|
254 |
-
}
|
255 |
-
return preg_replace($pattern,$replace,$date);
|
256 |
-
}
|
257 |
-
|
258 |
-
function str_putcsv( $array, $delimiter = ',', $enclosure = '"', $terminator = "\n" ) {
|
259 |
-
// First convert associative array to numeric indexed array
|
260 |
-
$workArray = array();
|
261 |
-
foreach ($array as $key => $value) {
|
262 |
-
$workArray[] = $value;
|
263 |
-
}
|
264 |
-
|
265 |
-
$returnString = ''; # Initialize return string
|
266 |
-
$arraySize = count( $workArray ); # Get size of array
|
267 |
-
|
268 |
-
for ( $i=0; $i<$arraySize; $i++ ) {
|
269 |
-
// Nested array, process nest item
|
270 |
-
if ( is_array( $workArray[$i] ) ) {
|
271 |
-
$returnString .= str_putcsv( $workArray[$i], $delimiter, $enclosure, $terminator );
|
272 |
-
} else {
|
273 |
-
switch ( gettype( $workArray[$i] ) ) {
|
274 |
-
// Manually set some strings
|
275 |
-
case "NULL": $_spFormat = ''; break;
|
276 |
-
case "boolean": $_spFormat = ($workArray[$i] == true) ? 'true': 'false'; break;
|
277 |
-
// Make sure sprintf has a good datatype to work with
|
278 |
-
case "integer": $_spFormat = '%i'; break;
|
279 |
-
case "double": $_spFormat = '%0.2f'; break;
|
280 |
-
case "string": $_spFormat = '%s'; $workArray[$i] = str_replace("$enclosure", "$enclosure$enclosure", $workArray[$i]); break;
|
281 |
-
// Unknown or invalid items for a csv - note: the datatype of array is already handled above, assuming the data is nested
|
282 |
-
case "object":
|
283 |
-
case "resource":
|
284 |
-
default: $_spFormat = ''; break;
|
285 |
-
}
|
286 |
-
$returnString .= sprintf('%2$s'.$_spFormat.'%2$s', $workArray[$i], $enclosure);
|
287 |
-
$returnString .= ($i < ($arraySize-1)) ? $delimiter : $terminator;
|
288 |
-
}
|
289 |
-
}
|
290 |
-
// Done the workload, return the output information
|
291 |
-
return $returnString;
|
292 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/admin/ajax.php
DELETED
@@ -1,739 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
|
3 |
-
add_action( 'wp_ajax_ninja_forms_save_metabox_state', 'ninja_forms_save_metabox_state' );
|
4 |
-
function ninja_forms_save_metabox_state(){
|
5 |
-
// Bail if we aren't in the admin
|
6 |
-
if ( ! is_admin() )
|
7 |
-
return false;
|
8 |
-
|
9 |
-
check_ajax_referer( 'nf_ajax', 'nf_ajax_nonce' );
|
10 |
-
|
11 |
-
$plugin_settings = nf_get_settings();
|
12 |
-
$page = esc_html( $_REQUEST['page'] );
|
13 |
-
$tab = esc_html( $_REQUEST['tab'] );
|
14 |
-
$slug = esc_html( $_REQUEST['slug'] );
|
15 |
-
$metabox_state = esc_html( $_REQUEST['metabox_state'] );
|
16 |
-
$plugin_settings['metabox_state'][$page][$tab][$slug] = $metabox_state;
|
17 |
-
update_option( 'ninja_forms_settings', $plugin_settings );
|
18 |
-
|
19 |
-
die();
|
20 |
-
}
|
21 |
-
|
22 |
-
/**
|
23 |
-
* When a field settings metabox is expanded, return a JSON element containing the field settings HTML
|
24 |
-
*
|
25 |
-
* @since 2.9
|
26 |
-
* @return false;
|
27 |
-
*/
|
28 |
-
|
29 |
-
function nf_output_field_settings_html() {
|
30 |
-
global $nf_rte_editors;
|
31 |
-
|
32 |
-
// Bail if we aren't in the admin
|
33 |
-
if ( ! is_admin() )
|
34 |
-
return false;
|
35 |
-
|
36 |
-
// Bail if we don't have proper permissions
|
37 |
-
if ( ! current_user_can( apply_filters( 'nf_new_field_capabilities', 'manage_options' ) ) )
|
38 |
-
return false;
|
39 |
-
|
40 |
-
check_ajax_referer( 'nf_ajax', 'nf_ajax_nonce' );
|
41 |
-
|
42 |
-
$field_id = esc_html( $_REQUEST['field_id'] );
|
43 |
-
$data = isset ( $_REQUEST['data'] ) ? json_decode( stripslashes( $_REQUEST['data'] ), true ) : array();
|
44 |
-
|
45 |
-
$field = ninja_forms_get_field_by_id( $field_id );
|
46 |
-
$field_data = $field['data'];
|
47 |
-
$data = wp_parse_args( $data, $field_data );
|
48 |
-
|
49 |
-
nf_output_registered_field_settings( $field_id, $data );
|
50 |
-
|
51 |
-
die();
|
52 |
-
}
|
53 |
-
|
54 |
-
add_action( 'wp_ajax_nf_output_field_settings_html', 'nf_output_field_settings_html' );
|
55 |
-
|
56 |
-
/**
|
57 |
-
* Save our admin fields page.
|
58 |
-
*
|
59 |
-
* @since 2.9
|
60 |
-
* @return false;
|
61 |
-
*/
|
62 |
-
|
63 |
-
function nf_admin_save_builder() {
|
64 |
-
global $ninja_forms_fields, $wpdb;
|
65 |
-
|
66 |
-
// Bail if we aren't in the admin
|
67 |
-
if ( ! is_admin() )
|
68 |
-
return false;
|
69 |
-
|
70 |
-
// Bail if we don't have proper permissions
|
71 |
-
if ( ! current_user_can( apply_filters( 'nf_new_field_capabilities', 'manage_options' ) ) )
|
72 |
-
return false;
|
73 |
-
|
74 |
-
check_ajax_referer( 'nf_ajax', 'nf_ajax_nonce' );
|
75 |
-
|
76 |
-
$field_data = json_decode( stripslashes( $_REQUEST['field_data'] ), true );
|
77 |
-
$form_id = esc_html( $_REQUEST['form_id'] );
|
78 |
-
$form_title = stripslashes( $_REQUEST['form_title'] );
|
79 |
-
$field_order = json_decode( strip_tags( stripslashes( $_REQUEST['field_order'] ) ), true );
|
80 |
-
|
81 |
-
if ( is_array ( $field_order ) ) {
|
82 |
-
$order_array = array();
|
83 |
-
$x = 0;
|
84 |
-
foreach ( $field_order as $id ) {
|
85 |
-
$id = str_replace( 'ninja_forms_field_', '', $id );
|
86 |
-
$order_array[ $id ] = $x;
|
87 |
-
$x++;
|
88 |
-
}
|
89 |
-
}
|
90 |
-
|
91 |
-
$tmp_array = array();
|
92 |
-
foreach ( $field_data as $field ) {
|
93 |
-
$field_id = $field['id'];
|
94 |
-
unset( $field['id'] );
|
95 |
-
unset( $field['metabox_state'] );
|
96 |
-
$tmp_array[ $field_id ] = $field;
|
97 |
-
}
|
98 |
-
|
99 |
-
$field_data = $tmp_array;
|
100 |
-
|
101 |
-
if ( isset ( $ninja_forms_fields ) && is_array( $ninja_forms_fields ) ) {
|
102 |
-
foreach ( $ninja_forms_fields as $slug => $field ){
|
103 |
-
if ( $field['save_function'] != '') {
|
104 |
-
$save_function = $field['save_function'];
|
105 |
-
$arguments['form_id'] = $form_id;
|
106 |
-
$arguments['data'] = $field_data;
|
107 |
-
$field_data = call_user_func_array( $save_function, $arguments );
|
108 |
-
}
|
109 |
-
}
|
110 |
-
}
|
111 |
-
|
112 |
-
if( $form_id != '' && $form_id != 0 && $form_id != 'new' ){
|
113 |
-
foreach ( $field_data as $field_id => $vals ) {
|
114 |
-
$field_order = isset( $order_array[$field_id] ) ? $order_array[$field_id] : '';
|
115 |
-
$field_row = ninja_forms_get_field_by_id( $field_id );
|
116 |
-
$data = $field_row['data'];
|
117 |
-
foreach( $vals as $k => $v ){
|
118 |
-
$data[$k] = $v;
|
119 |
-
}
|
120 |
-
$data_array = array('data' => serialize( $data ), 'order' => $field_order);
|
121 |
-
$wpdb->update( NINJA_FORMS_FIELDS_TABLE_NAME, $data_array, array( 'id' => $field_id ));
|
122 |
-
}
|
123 |
-
|
124 |
-
$date_updated = date( 'Y-m-d H:i:s', strtotime ( 'now' ) );
|
125 |
-
Ninja_Forms()->form( $form_id )->update_setting( 'form_title', $form_title );
|
126 |
-
Ninja_Forms()->form( $form_id )->update_setting( 'date_updated', $date_updated );
|
127 |
-
Ninja_Forms()->form( $form_id )->update_setting( 'status', '' );
|
128 |
-
}
|
129 |
-
|
130 |
-
// Dump our current form transient.
|
131 |
-
delete_transient( 'nf_form_' . $form_id );
|
132 |
-
|
133 |
-
die();
|
134 |
-
}
|
135 |
-
|
136 |
-
add_action( 'wp_ajax_nf_admin_save_builder', 'nf_admin_save_builder' );
|
137 |
-
|
138 |
-
|
139 |
-
add_action('wp_ajax_ninja_forms_new_field', 'ninja_forms_new_field');
|
140 |
-
function ninja_forms_new_field(){
|
141 |
-
global $wpdb, $ninja_forms_fields;
|
142 |
-
|
143 |
-
// Bail if we aren't in the admin
|
144 |
-
if ( ! is_admin() )
|
145 |
-
return false;
|
146 |
-
|
147 |
-
// Bail if we don't have proper permissions
|
148 |
-
if ( ! current_user_can( apply_filters( 'nf_new_field_capabilities', 'manage_options' ) ) )
|
149 |
-
return false;
|
150 |
-
|
151 |
-
check_ajax_referer( 'nf_ajax', 'nf_ajax_nonce' );
|
152 |
-
|
153 |
-
$type = esc_html( $_REQUEST['type'] );
|
154 |
-
$form_id = absint( $_REQUEST['form_id'] );
|
155 |
-
|
156 |
-
if( isset( $ninja_forms_fields[$type]['name'] ) ){
|
157 |
-
$type_name = $ninja_forms_fields[$type]['name'];
|
158 |
-
}else{
|
159 |
-
$type_name = '';
|
160 |
-
}
|
161 |
-
|
162 |
-
if( isset( $ninja_forms_fields[$type]['default_label'] ) ){
|
163 |
-
$default_label = $ninja_forms_fields[$type]['default_label'];
|
164 |
-
}else{
|
165 |
-
$default_label = '';
|
166 |
-
}
|
167 |
-
|
168 |
-
if( isset( $ninja_forms_fields[$type]['edit_options'] ) ){
|
169 |
-
$edit_options = $ninja_forms_fields[$type]['edit_options'];
|
170 |
-
}else{
|
171 |
-
$edit_options = '';
|
172 |
-
}
|
173 |
-
|
174 |
-
if ( $default_label != '' ) {
|
175 |
-
$label = $default_label;
|
176 |
-
} else {
|
177 |
-
$label = $type_name;
|
178 |
-
}
|
179 |
-
|
180 |
-
$input_limit_msg = __( 'character(s) left', 'ninja-forms' );
|
181 |
-
|
182 |
-
$data = serialize( array( 'label' => $label, 'input_limit_msg' => $input_limit_msg ) );
|
183 |
-
|
184 |
-
$order = 999;
|
185 |
-
|
186 |
-
if($form_id != 0 && $form_id != ''){
|
187 |
-
$args = array(
|
188 |
-
'type' => $type,
|
189 |
-
'data' => $data,
|
190 |
-
);
|
191 |
-
|
192 |
-
$new_id = ninja_forms_insert_field( $form_id, $args );
|
193 |
-
$new_html = ninja_forms_return_echo('ninja_forms_edit_field', $new_id, true );
|
194 |
-
header("Content-type: application/json");
|
195 |
-
$array = array ('new_id' => $new_id, 'new_type' => $type_name, 'new_html' => $new_html, 'edit_options' => $edit_options, 'new_type_slug' => $type );
|
196 |
-
echo json_encode($array);
|
197 |
-
die();
|
198 |
-
}
|
199 |
-
}
|
200 |
-
|
201 |
-
add_action('wp_ajax_ninja_forms_remove_field', 'ninja_forms_remove_field');
|
202 |
-
function ninja_forms_remove_field(){
|
203 |
-
global $wpdb;
|
204 |
-
|
205 |
-
// Bail if we aren't in the admin
|
206 |
-
if ( ! is_admin() )
|
207 |
-
return false;
|
208 |
-
|
209 |
-
// Bail if we don't have proper permissions
|
210 |
-
if ( ! current_user_can( apply_filters( 'nf_delete_field_capabilities', 'manage_options' ) ) )
|
211 |
-
return false;
|
212 |
-
|
213 |
-
check_ajax_referer( 'nf_ajax', 'nf_ajax_nonce' );
|
214 |
-
|
215 |
-
$field_id = absint( $_REQUEST['field_id'] );
|
216 |
-
$form_id = absint( $_REQUEST['form_id'] );
|
217 |
-
$wpdb->query($wpdb->prepare("DELETE FROM ".NINJA_FORMS_FIELDS_TABLE_NAME." WHERE id = %d", $field_id));
|
218 |
-
Ninja_Forms()->form( $form_id )->dump_cache();
|
219 |
-
die();
|
220 |
-
}
|
221 |
-
|
222 |
-
add_action('wp_ajax_ninja_forms_add_list_option', 'ninja_forms_add_list_options');
|
223 |
-
function ninja_forms_add_list_options(){
|
224 |
-
global $wpdb;
|
225 |
-
|
226 |
-
// Bail if we aren't in the admin
|
227 |
-
if ( ! is_admin() )
|
228 |
-
return false;
|
229 |
-
|
230 |
-
// Bail if we don't have proper permissions
|
231 |
-
if ( ! current_user_can( apply_filters( 'nf_new_field_capabilities', 'manage_options' ) ) )
|
232 |
-
return false;
|
233 |
-
|
234 |
-
check_ajax_referer( 'nf_ajax', 'nf_ajax_nonce' );
|
235 |
-
|
236 |
-
$field_id = absint( $_REQUEST['field_id'] );
|
237 |
-
$x = absint( $_REQUEST['x'] );
|
238 |
-
$hidden_value = esc_html( $_REQUEST['hidden_value'] );
|
239 |
-
ninja_forms_field_list_option_output($field_id, $x, '', $hidden_value);
|
240 |
-
die();
|
241 |
-
}
|
242 |
-
|
243 |
-
function ninja_forms_insert_fav(){
|
244 |
-
global $wpdb, $ninja_forms_fields;
|
245 |
-
// Bail if we aren't in the admin
|
246 |
-
if ( ! is_admin() )
|
247 |
-
return false;
|
248 |
-
|
249 |
-
check_ajax_referer( 'nf_ajax', 'nf_ajax_nonce' );
|
250 |
-
|
251 |
-
$fav_id = absint( $_REQUEST['field_id'] );
|
252 |
-
$form_id = absint( $_REQUEST['form_id'] );
|
253 |
-
|
254 |
-
$fav_row = ninja_forms_get_fav_by_id($fav_id);
|
255 |
-
|
256 |
-
$data = serialize($fav_row['data']);
|
257 |
-
$type = $fav_row['type'];
|
258 |
-
$type_name = $ninja_forms_fields[$type]['name'];
|
259 |
-
|
260 |
-
if($form_id != 0 && $form_id != ''){
|
261 |
-
$args = array(
|
262 |
-
'type' => $type,
|
263 |
-
'data' => $data,
|
264 |
-
'fav_id' => $fav_id,
|
265 |
-
);
|
266 |
-
$new_id = ninja_forms_insert_field( $form_id, $args );
|
267 |
-
$new_html = ninja_forms_return_echo('ninja_forms_edit_field', $new_id, true );
|
268 |
-
header("Content-type: application/json");
|
269 |
-
$array = array ('new_id' => $new_id, 'new_type' => $type_name, 'new_html' => $new_html);
|
270 |
-
echo json_encode($array);
|
271 |
-
}
|
272 |
-
die();
|
273 |
-
}
|
274 |
-
|
275 |
-
|
276 |
-
add_action('wp_ajax_ninja_forms_insert_fav', 'ninja_forms_insert_fav');
|
277 |
-
|
278 |
-
function ninja_forms_insert_def(){
|
279 |
-
global $wpdb, $ninja_forms_fields;
|
280 |
-
|
281 |
-
// Bail if we aren't in the admin
|
282 |
-
if ( ! is_admin() )
|
283 |
-
return false;
|
284 |
-
|
285 |
-
check_ajax_referer( 'nf_ajax', 'nf_ajax_nonce' );
|
286 |
-
|
287 |
-
$def_id = absint( $_REQUEST['field_id'] );
|
288 |
-
$form_id = absint( $_REQUEST['form_id'] );
|
289 |
-
|
290 |
-
$def_row = ninja_forms_get_def_by_id($def_id);
|
291 |
-
|
292 |
-
$data = serialize($def_row['data']);
|
293 |
-
$type = $def_row['type'];
|
294 |
-
$type_name = $ninja_forms_fields[$type]['name'];
|
295 |
-
|
296 |
-
if($form_id != 0 && $form_id != ''){
|
297 |
-
$args = array(
|
298 |
-
'type' => $type,
|
299 |
-
'data' => $data,
|
300 |
-
'def_id' => $def_id,
|
301 |
-
);
|
302 |
-
$new_id = ninja_forms_insert_field( $form_id, $args );
|
303 |
-
$new_html = ninja_forms_return_echo('ninja_forms_edit_field', $new_id, true );
|
304 |
-
header("Content-type: application/json");
|
305 |
-
$array = array ('new_id' => $new_id, 'new_type' => $type_name, 'new_html' => $new_html);
|
306 |
-
echo json_encode($array);
|
307 |
-
}
|
308 |
-
die();
|
309 |
-
}
|
310 |
-
|
311 |
-
add_action('wp_ajax_ninja_forms_insert_def', 'ninja_forms_insert_def');
|
312 |
-
|
313 |
-
add_action('wp_ajax_ninja_forms_add_fav', 'ninja_forms_add_fav');
|
314 |
-
function ninja_forms_add_fav(){
|
315 |
-
global $wpdb;
|
316 |
-
|
317 |
-
// Bail if we aren't in the admin
|
318 |
-
if ( ! is_admin() )
|
319 |
-
return false;
|
320 |
-
|
321 |
-
check_ajax_referer( 'nf_ajax', 'nf_ajax_nonce' );
|
322 |
-
|
323 |
-
$field_data = $_REQUEST['field_data'];
|
324 |
-
$field_id = absint( $_REQUEST['field_id'] );
|
325 |
-
|
326 |
-
$field_row = ninja_forms_get_field_by_id($field_id);
|
327 |
-
|
328 |
-
$field_type = $field_row['type'];
|
329 |
-
$form_id = 1;
|
330 |
-
|
331 |
-
$data = array();
|
332 |
-
|
333 |
-
foreach($field_data as $key => $val){
|
334 |
-
$key = stripslashes( $key );
|
335 |
-
$key = str_replace('"', '', $key);
|
336 |
-
if(strpos($key, '[')){
|
337 |
-
$key = str_replace(']', '', $key);
|
338 |
-
$key = explode('[', $key);
|
339 |
-
$multi = array();
|
340 |
-
$temp =& $multi;
|
341 |
-
$x = 0;
|
342 |
-
$count = count($key) - 1;
|
343 |
-
foreach ($key as $item){
|
344 |
-
$temp[$item] = array();
|
345 |
-
if($x < $count){
|
346 |
-
$temp =& $temp[$item];
|
347 |
-
}else{
|
348 |
-
$temp[$item] = $val;
|
349 |
-
}
|
350 |
-
$x++;
|
351 |
-
}
|
352 |
-
$data = ninja_forms_array_merge_recursive($data, $multi);
|
353 |
-
}else{
|
354 |
-
$data[$key] = $val;
|
355 |
-
}
|
356 |
-
}
|
357 |
-
|
358 |
-
$name = stripslashes( esc_html( $_REQUEST['fav_name'] ) );
|
359 |
-
if ( !isset ( $data['label'] ) or empty ( $data['label'] ) ) {
|
360 |
-
$data['label'] = $name;
|
361 |
-
}
|
362 |
-
|
363 |
-
$data = ninja_forms_stripslashes_deep( $data );
|
364 |
-
|
365 |
-
$data = serialize($data);
|
366 |
-
$wpdb->insert(NINJA_FORMS_FAV_FIELDS_TABLE_NAME, array('row_type' => 1, 'type' => $field_type, 'order' => 0, 'data' => $data, 'name' => $name));
|
367 |
-
$fav_id = $wpdb->insert_id;
|
368 |
-
$update_array = array('fav_id' => $fav_id);
|
369 |
-
$wpdb->update( NINJA_FORMS_FIELDS_TABLE_NAME, $update_array, array( 'id' => $field_id ));
|
370 |
-
|
371 |
-
$new_html = '<p class="button-controls" id="ninja_forms_insert_fav_field_'.$fav_id.'_p">
|
372 |
-
<a class="button add-new-h2 ninja-forms-insert-fav-field" id="ninja_forms_insert_fav_field_'.$fav_id.'" data-field="' . $fav_id . '" data-type="fav" href="#">'.__($name, 'ninja-forms').'</a>
|
373 |
-
</p>';
|
374 |
-
|
375 |
-
header("Content-type: application/json");
|
376 |
-
$array = array ('fav_id' => $fav_id, 'fav_name' => $name, 'link_html' => $new_html);
|
377 |
-
echo json_encode($array);
|
378 |
-
|
379 |
-
die();
|
380 |
-
}
|
381 |
-
|
382 |
-
add_action('wp_ajax_ninja_forms_add_def', 'ninja_forms_add_def');
|
383 |
-
function ninja_forms_add_def(){
|
384 |
-
global $wpdb;
|
385 |
-
|
386 |
-
// Bail if we aren't in the admin
|
387 |
-
if ( ! is_admin() )
|
388 |
-
return false;
|
389 |
-
|
390 |
-
check_ajax_referer( 'nf_ajax', 'nf_ajax_nonce' );
|
391 |
-
|
392 |
-
$field_data = $_REQUEST['field_data'];
|
393 |
-
$field_id = absint( $_REQUEST['field_id'] );
|
394 |
-
|
395 |
-
$field_row = ninja_forms_get_field_by_id($field_id);
|
396 |
-
|
397 |
-
$field_type = $field_row['type'];
|
398 |
-
$row_type = 0;
|
399 |
-
|
400 |
-
$data = array();
|
401 |
-
|
402 |
-
foreach($field_data as $key => $val){
|
403 |
-
$key = str_replace('"', '', $key);
|
404 |
-
if(strpos($key, '[')){
|
405 |
-
$key = str_replace(']', '', $key);
|
406 |
-
$key = explode('[', $key);
|
407 |
-
$multi = array();
|
408 |
-
$temp =& $multi;
|
409 |
-
$x = 0;
|
410 |
-
$count = count($key) - 1;
|
411 |
-
foreach ($key as $item){
|
412 |
-
$temp[$item] = array();
|
413 |
-
if($x < $count){
|
414 |
-
$temp =& $temp[$item];
|
415 |
-
}else{
|
416 |
-
$temp[$item] = $val;
|
417 |
-
}
|
418 |
-
$x++;
|
419 |
-
}
|
420 |
-
$data = ninja_forms_array_merge_recursive($data, $multi);
|
421 |
-
}else{
|
422 |
-
$data[$key] = $val;
|
423 |
-
}
|
424 |
-
}
|
425 |
-
|
426 |
-
$name = stripslashes( esc_html( $_REQUEST['def_name'] ) );
|
427 |
-
$data['label'] = $name;
|
428 |
-
$data = serialize($data);
|
429 |
-
$wpdb->insert(NINJA_FORMS_FAV_FIELDS_TABLE_NAME, array('row_type' => $row_type, 'type' => $field_type, 'data' => $data, 'name' => $name));
|
430 |
-
$def_id = $wpdb->insert_id;
|
431 |
-
$update_array = array('def_id' => $def_id);
|
432 |
-
$wpdb->update( NINJA_FORMS_FIELDS_TABLE_NAME, $update_array, array( 'id' => $field_id ));
|
433 |
-
|
434 |
-
$new_html = '<p class="button-controls" id="ninja_forms_insert_def_field_'.$def_id.'_p">
|
435 |
-
<a class="button add-new-h2 ninja-forms-insert-def-field" id="ninja_forms_insert_def_field_'.$def_id.'" name="" href="#">'.__($name, 'ninja-forms').'</a>
|
436 |
-
</p>';
|
437 |
-
header("Content-type: application/json");
|
438 |
-
$array = array ('def_id' => $def_id, 'def_name' => $name, 'link_html' => $new_html);
|
439 |
-
echo json_encode($array);
|
440 |
-
|
441 |
-
die();
|
442 |
-
}
|
443 |
-
|
444 |
-
add_action('wp_ajax_ninja_forms_remove_fav', 'ninja_forms_remove_fav');
|
445 |
-
function ninja_forms_remove_fav(){
|
446 |
-
global $wpdb, $ninja_forms_fields;
|
447 |
-
|
448 |
-
// Bail if we aren't in the admin
|
449 |
-
if ( ! is_admin() )
|
450 |
-
return false;
|
451 |
-
|
452 |
-
check_ajax_referer( 'nf_ajax', 'nf_ajax_nonce' );
|
453 |
-
|
454 |
-
$field_id = absint( $_REQUEST['field_id'] );
|
455 |
-
$field_row = ninja_forms_get_field_by_id($field_id);
|
456 |
-
$field_type = $field_row['type'];
|
457 |
-
$fav_id = $field_row['fav_id'];
|
458 |
-
$wpdb->query($wpdb->prepare("DELETE FROM ".NINJA_FORMS_FAV_FIELDS_TABLE_NAME." WHERE id = %d", $fav_id));
|
459 |
-
$wpdb->update(NINJA_FORMS_FIELDS_TABLE_NAME, array('fav_id' => '' ), array('fav_id' => $fav_id));
|
460 |
-
$type_name = $ninja_forms_fields[$field_type]['name'];
|
461 |
-
header("Content-type: application/json");
|
462 |
-
$array = array ('fav_id' => $fav_id, 'type_name' => $type_name);
|
463 |
-
echo json_encode($array);
|
464 |
-
|
465 |
-
die();
|
466 |
-
}
|
467 |
-
|
468 |
-
add_action('wp_ajax_ninja_forms_remove_def', 'ninja_forms_remove_def');
|
469 |
-
function ninja_forms_remove_def(){
|
470 |
-
global $wpdb, $ninja_forms_fields;
|
471 |
-
|
472 |
-
// Bail if we aren't in the admin
|
473 |
-
if ( ! is_admin() )
|
474 |
-
return false;
|
475 |
-
|
476 |
-
check_ajax_referer( 'nf_ajax', 'nf_ajax_nonce' );
|
477 |
-
|
478 |
-
$field_id = absint( $_REQUEST['field_id'] );
|
479 |
-
$field_row = ninja_forms_get_field_by_id($field_id);
|
480 |
-
$field_type = $field_row['type'];
|
481 |
-
$def_id = $field_row['def_id'];
|
482 |
-
$wpdb->query($wpdb->prepare("DELETE FROM ".NINJA_FORMS_FAV_FIELDS_TABLE_NAME." WHERE id = %d", $def_id));
|
483 |
-
$wpdb->update(NINJA_FORMS_FIELDS_TABLE_NAME, array('def_id' => '' ), array('def_id' => $def_id));
|
484 |
-
$type_name = $ninja_forms_fields[$field_type]['name'];
|
485 |
-
header("Content-type: application/json");
|
486 |
-
$array = array ('def_id' => $def_id, 'type_name' => $type_name);
|
487 |
-
echo json_encode($array);
|
488 |
-
|
489 |
-
die();
|
490 |
-
}
|
491 |
-
|
492 |
-
add_action( 'wp_ajax_ninja_forms_side_sortable', 'ninja_forms_side_sortable' );
|
493 |
-
function ninja_forms_side_sortable(){
|
494 |
-
|
495 |
-
// Bail if we aren't in the admin
|
496 |
-
if ( ! is_admin() )
|
497 |
-
return false;
|
498 |
-
|
499 |
-
check_ajax_referer( 'nf_ajax', 'nf_ajax_nonce' );
|
500 |
-
|
501 |
-
$plugin_settings = nf_get_settings();
|
502 |
-
$page = esc_html( $_REQUEST['page'] );
|
503 |
-
$tab = esc_html( $_REQUEST['tab'] );
|
504 |
-
$order = ninja_forms_esc_html_deep( $_REQUEST['order'] );
|
505 |
-
|
506 |
-
$plugin_settings['sidebars'][$page][$tab] = $order;
|
507 |
-
update_option( 'ninja_forms_settings', $plugin_settings );
|
508 |
-
|
509 |
-
die();
|
510 |
-
}
|
511 |
-
|
512 |
-
add_action('wp_ajax_ninja_forms_delete_sub', 'ninja_forms_delete_sub');
|
513 |
-
function ninja_forms_delete_sub($sub_id = ''){
|
514 |
-
global $wpdb;
|
515 |
-
|
516 |
-
// Bail if we aren't in the admin
|
517 |
-
if ( ! is_admin() )
|
518 |
-
return false;
|
519 |
-
|
520 |
-
check_ajax_referer( 'nf_ajax', 'nf_ajax_nonce' );
|
521 |
-
|
522 |
-
if($sub_id == ''){
|
523 |
-
$ajax = true;
|
524 |
-
$sub_id = absint( $_REQUEST['sub_id'] );
|
525 |
-
}else{
|
526 |
-
$ajax = false;
|
527 |
-
}
|
528 |
-
|
529 |
-
$wpdb->query($wpdb->prepare("DELETE FROM ".NINJA_FORMS_SUBS_TABLE_NAME." WHERE id = %d", $sub_id));
|
530 |
-
if( $ajax ){
|
531 |
-
die();
|
532 |
-
}
|
533 |
-
}
|
534 |
-
|
535 |
-
function ninja_forms_array_merge_recursive() {
|
536 |
-
$arrays = func_get_args();
|
537 |
-
$base = array_shift($arrays);
|
538 |
-
|
539 |
-
foreach ($arrays as $array) {
|
540 |
-
reset($base); //important
|
541 |
-
while (list($key, $value) = @each($array)) {
|
542 |
-
if (is_array($value) && @is_array($base[$key])) {
|
543 |
-
$base[$key] = ninja_forms_array_merge_recursive($base[$key], $value);
|
544 |
-
} else {
|
545 |
-
$base[$key] = $value;
|
546 |
-
}
|
547 |
-
}
|
548 |
-
}
|
549 |
-
|
550 |
-
return $base;
|
551 |
-
}
|
552 |
-
|
553 |
-
function ninja_forms_import_list_options(){
|
554 |
-
// Bail if we aren't in the admin
|
555 |
-
if ( ! is_admin() )
|
556 |
-
return false;
|
557 |
-
|
558 |
-
check_ajax_referer( 'nf_ajax', 'nf_ajax_nonce' );
|
559 |
-
|
560 |
-
$options = $_REQUEST['options'];
|
561 |
-
$field_id = absint( $_REQUEST['field_id'] );
|
562 |
-
$options = str_replace('\,', '-comma-replace-placeholder-', $options );
|
563 |
-
$options = ninja_forms_csv_explode( $options );
|
564 |
-
|
565 |
-
if( is_array( $options ) ){
|
566 |
-
$tmp_array = array();
|
567 |
-
$x = 0;
|
568 |
-
foreach( $options as $option ){
|
569 |
-
$label = stripslashes( $option[0] );
|
570 |
-
$value = stripslashes( $option[1] );
|
571 |
-
$calc = stripslashes( $option[2] );
|
572 |
-
$label = str_replace( "''", "", $label );
|
573 |
-
$label = str_replace( "-comma-replace-placeholder-", ",", $label );
|
574 |
-
$value = str_replace( "''", "", $value );
|
575 |
-
$value = str_replace( "-comma-replace-placeholder-", ",", $value );
|
576 |
-
$calc = str_replace( "''", "", $calc );
|
577 |
-
$calc = str_replace( "-comma-replace-placeholder-", ",", $calc );
|
578 |
-
$tmp_array[$x]['label'] = $label;
|
579 |
-
$tmp_array[$x]['value'] = $value;
|
580 |
-
$tmp_array[$x]['calc'] = $calc;
|
581 |
-
$x++;
|
582 |
-
}
|
583 |
-
$x = 0;
|
584 |
-
foreach( $tmp_array as $option ){
|
585 |
-
$hidden = 0;
|
586 |
-
ninja_forms_field_list_option_output($field_id, $x, $option, $hidden);
|
587 |
-
$x++;
|
588 |
-
}
|
589 |
-
}
|
590 |
-
|
591 |
-
die();
|
592 |
-
}
|
593 |
-
|
594 |
-
add_action( 'wp_ajax_ninja_forms_import_list_options', 'ninja_forms_import_list_options' );
|
595 |
-
|
596 |
-
/*
|
597 |
-
*
|
598 |
-
* Function that outputs a list of terms so that the user can exclude terms from a list selector.
|
599 |
-
*
|
600 |
-
* @since 2.2.51
|
601 |
-
* @return void
|
602 |
-
*/
|
603 |
-
|
604 |
-
function ninja_forms_list_terms_checkboxes( $field_id = '', $tax_name = '' ){
|
605 |
-
|
606 |
-
// Bail if we aren't in the admin
|
607 |
-
if ( ! is_admin() )
|
608 |
-
return false;
|
609 |
-
|
610 |
-
check_ajax_referer( 'nf_ajax', 'nf_ajax_nonce' );
|
611 |
-
|
612 |
-
if ( $field_id == '' && isset ( $_POST['field_id'] ) ) {
|
613 |
-
$field_id = absint( $_POST['field_id'] );
|
614 |
-
}
|
615 |
-
|
616 |
-
if ( $tax_name == '' && isset ( $_POST['tax_name'] ) ) {
|
617 |
-
$tax_name = esc_html( $_POST['tax_name'] );
|
618 |
-
}
|
619 |
-
|
620 |
-
if ( $field_id != '' && $tax_name != '' ) {
|
621 |
-
$field = ninja_forms_get_field_by_id( $field_id );
|
622 |
-
if ( isset ( $field['data']['exclude_terms'] ) ) {
|
623 |
-
$exclude_terms = $field['data']['exclude_terms'];
|
624 |
-
} else {
|
625 |
-
$exclude_terms = '';
|
626 |
-
}
|
627 |
-
|
628 |
-
$terms = get_terms( $tax_name, array( 'hide_empty' => false ) );
|
629 |
-
if ( is_array ( $terms ) && !empty ( $terms ) ) {
|
630 |
-
?>
|
631 |
-
<h4><?php _e( 'Do not show these terms', 'ninja-forms' );?>:</h4>
|
632 |
-
<input type="hidden" name="ninja_forms_field_<?php echo $field_id;?>[exclude_terms]" value="">
|
633 |
-
<?php
|
634 |
-
foreach ( $terms as $term ) {
|
635 |
-
?>
|
636 |
-
<div>
|
637 |
-
<label>
|
638 |
-
<input type="checkbox" <?php checked( in_array ( $term->term_id, $exclude_terms ), true );?> name="ninja_forms_field_<?php echo $field_id;?>[exclude_terms][]" value="<?php echo $term->term_id;?>">
|
639 |
-
<?php echo $term->name;?>
|
640 |
-
</label>
|
641 |
-
</div>
|
642 |
-
<?php
|
643 |
-
}
|
644 |
-
}
|
645 |
-
}
|
646 |
-
|
647 |
-
if ( isset ( $_POST['from_ajax'] ) && absint( $_POST['from_ajax'] ) == 1 ) {
|
648 |
-
die();
|
649 |
-
}
|
650 |
-
}
|
651 |
-
|
652 |
-
add_action( 'wp_ajax_ninja_forms_list_terms_checkboxes', 'ninja_forms_list_terms_checkboxes' );
|
653 |
-
|
654 |
-
/*
|
655 |
-
*
|
656 |
-
* Function that outputs a calculation row
|
657 |
-
*
|
658 |
-
* @since 2.2.28
|
659 |
-
* @returns void
|
660 |
-
*/
|
661 |
-
|
662 |
-
function ninja_forms_add_calc_row(){
|
663 |
-
// Bail if we aren't in the admin
|
664 |
-
if ( ! is_admin() )
|
665 |
-
return false;
|
666 |
-
|
667 |
-
check_ajax_referer( 'nf_ajax', 'nf_ajax_nonce' );
|
668 |
-
|
669 |
-
$field_id = absint( $_REQUEST['field_id'] );
|
670 |
-
$c = array( 'calc' => '', 'operator' => 'add', 'value' => '', 'when' => '' );
|
671 |
-
$x = absint( $_REQUEST['x'] );
|
672 |
-
|
673 |
-
ninja_forms_output_field_calc_row( $field_id, $c, $x );
|
674 |
-
die();
|
675 |
-
}
|
676 |
-
|
677 |
-
add_action( 'wp_ajax_ninja_forms_add_calc_row', 'ninja_forms_add_calc_row' );
|
678 |
-
|
679 |
-
/**
|
680 |
-
*
|
681 |
-
* Covert a multi-line CSV string into a 2d array. Follows RFC 4180, allows
|
682 |
-
* "cells with ""escaped delimiters""" && multi-line enclosed cells
|
683 |
-
* It assumes the CSV file is properly formatted, and doesn't check for errors
|
684 |
-
* in CSV format.
|
685 |
-
* @param string $str The CSV string
|
686 |
-
* @param string $d The delimiter between values
|
687 |
-
* @param string $e The enclosing character
|
688 |
-
* @param bool $crlf Set to true if your CSV file should return carriage return
|
689 |
-
* and line feed (CRLF should be returned according to RFC 4180
|
690 |
-
* @return array
|
691 |
-
*/
|
692 |
-
function ninja_forms_csv_explode( $str, $d=',', $e='"', $crlf=TRUE ) {
|
693 |
-
// Convert CRLF to LF, easier to work with in regex
|
694 |
-
if( $crlf ) $str = str_replace("\r\n","\n",$str);
|
695 |
-
// Get rid of trailing linebreaks that RFC4180 allows
|
696 |
-
$str = trim($str);
|
697 |
-
// Do the dirty work
|
698 |
-
if ( preg_match_all(
|
699 |
-
'/(?:
|
700 |
-
'.$e.'((?:[^'.$e.']|'.$e.$e.')*+)'.$e.'(?:'.$d.'|\n|$)
|
701 |
-
# match enclose, then match either non-enclose or double-enclose
|
702 |
-
# zero to infinity times (possesive), then match another enclose,
|
703 |
-
# followed by a comma, linebreak, or string end
|
704 |
-
| ####### OR #######
|
705 |
-
([^'.$d.'\n]*+)(?:['.$d.'\n]|$)
|
706 |
-
# match anything thats not a comma or linebreak zero to infinity
|
707 |
-
# times (possesive), then match either a comma or a linebreak or
|
708 |
-
# string end
|
709 |
-
)/x',
|
710 |
-
$str, $ms, PREG_SET_ORDER
|
711 |
-
) === FALSE ) return FALSE;
|
712 |
-
// Initialize vars, $r will hold our return data, $i will track which line we're on
|
713 |
-
$r = array(); $i = 0;
|
714 |
-
// Loop through results
|
715 |
-
foreach( $ms as $m ) {
|
716 |
-
// If the first group of matches is empty, the cell has no quotes
|
717 |
-
if( empty($m[1]) )
|
718 |
-
// Put the CRLF back in if needed
|
719 |
-
$r[$i][] = ($crlf == TRUE) ? str_replace("\n","\r\n",$m[2]) : $m[2];
|
720 |
-
else {
|
721 |
-
// The cell was quoted, so we want to convert any "" back to " and
|
722 |
-
// any LF back to CRLF, if needed
|
723 |
-
$r[$i][] = ($crlf == TRUE) ?
|
724 |
-
str_replace(
|
725 |
-
array("\n",$e.$e),
|
726 |
-
array("\r\n",$e),
|
727 |
-
$m[1]) :
|
728 |
-
str_replace($e.$e, $e, $m[1]);
|
729 |
-
}
|
730 |
-
// If the raw match doesn't have a delimiter, it must be the last in the
|
731 |
-
// row, so we increment our line count.
|
732 |
-
if( substr($m[0],-1) != $d )
|
733 |
-
$i++;
|
734 |
-
}
|
735 |
-
// An empty array will exist due to $ being a zero-length match, so remove it
|
736 |
-
array_pop( $r );
|
737 |
-
return $r;
|
738 |
-
|
739 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/admin/display-screen-options.php
DELETED
@@ -1,121 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
|
3 |
-
function ninja_forms_load_screen_options_tab() {
|
4 |
-
global $ninja_forms_help_screen_tabs, $ninja_forms_screen_options;
|
5 |
-
$current_tab = ninja_forms_get_current_tab();
|
6 |
-
$current_page = esc_html( $_REQUEST['page'] );
|
7 |
-
$screen = get_current_screen();
|
8 |
-
|
9 |
-
if(isset($ninja_forms_help_screen_tabs['_universal_'])){
|
10 |
-
foreach($ninja_forms_help_screen_tabs['_universal_'] as $key => $tab){
|
11 |
-
$screen->add_help_tab( array(
|
12 |
-
'id' => $key, // This should be unique for the screen.
|
13 |
-
'title' => $tab['title'],
|
14 |
-
'callback' => $tab['content'],
|
15 |
-
// Use 'callback' instead of 'content' for a function callback that renders the tab content.
|
16 |
-
) );
|
17 |
-
}
|
18 |
-
}
|
19 |
-
|
20 |
-
if(isset($ninja_forms_help_screen_tabs[$current_page]['_universal_'])){
|
21 |
-
foreach($ninja_forms_help_screen_tabs[$current_page]['_universal_'] as $key => $tab){
|
22 |
-
$screen->add_help_tab( array(
|
23 |
-
'id' => $key, // This should be unique for the screen.
|
24 |
-
'title' => $tab['title'],
|
25 |
-
'callback' => $tab['content'],
|
26 |
-
// Use 'callback' instead of 'content' for a function callback that renders the tab content.
|
27 |
-
) );
|
28 |
-
}
|
29 |
-
}
|
30 |
-
|
31 |
-
if(isset($ninja_forms_help_screen_tabs[$current_page][$current_tab])){
|
32 |
-
foreach($ninja_forms_help_screen_tabs[$current_page][$current_tab] as $key => $tab){
|
33 |
-
$screen->add_help_tab( array(
|
34 |
-
'id' => $key, // This should be unique for the screen.
|
35 |
-
'title' => $tab['title'],
|
36 |
-
'callback' => $tab['content'],
|
37 |
-
// Use 'callback' instead of 'content' for a function callback that renders the tab content.
|
38 |
-
) );
|
39 |
-
}
|
40 |
-
}
|
41 |
-
|
42 |
-
if(isset($ninja_forms_screen_options['_universal_']) OR isset($ninja_forms_screen_options[$current_page]['_universal_']) OR isset($ninja_forms_screen_options[$current_page][$current_tab]) ){
|
43 |
-
add_filter('screen_layout_columns', 'ninja_forms_display_screen_options');
|
44 |
-
$screen->add_option('ninja_forms', '');
|
45 |
-
}
|
46 |
-
}
|
47 |
-
|
48 |
-
function ninja_forms_display_screen_options($content){
|
49 |
-
global $ninja_forms_help_screen_tabs, $ninja_forms_screen_options;
|
50 |
-
$current_page = esc_html( $_REQUEST['page'] );
|
51 |
-
$current_tab = ninja_forms_get_current_tab();
|
52 |
-
ninja_forms_update_screen_options();
|
53 |
-
|
54 |
-
if(isset($ninja_forms_screen_options['_universal_']) OR isset($ninja_forms_screen_options[$current_page]['_universal_']) OR isset($ninja_forms_screen_options[$current_page][$current_tab])){
|
55 |
-
|
56 |
-
if(isset($ninja_forms_screen_options['_universal_'])){
|
57 |
-
foreach($ninja_forms_screen_options['_universal_'] as $option){
|
58 |
-
$display_function = $option['display_function'];
|
59 |
-
$arguments = func_get_args();
|
60 |
-
array_shift($arguments); // We need to remove the first arg ($function_name)
|
61 |
-
call_user_func_array($display_function, $arguments);
|
62 |
-
}
|
63 |
-
}
|
64 |
-
|
65 |
-
if(isset($ninja_forms_screen_options[$current_page]['_universal_'])){
|
66 |
-
foreach($ninja_forms_screen_options[$current_page]['_universal_'] as $option){
|
67 |
-
$display_function = $option['display_function'];
|
68 |
-
$arguments = func_get_args();
|
69 |
-
array_shift($arguments); // We need to remove the first arg ($function_name)
|
70 |
-
call_user_func_array($display_function, $arguments);
|
71 |
-
}
|
72 |
-
}
|
73 |
-
|
74 |
-
if(isset($ninja_forms_screen_options[$current_page][$current_tab])){
|
75 |
-
foreach($ninja_forms_screen_options[$current_page][$current_tab] as $option){
|
76 |
-
$display_function = $option['display_function'];
|
77 |
-
$arguments = func_get_args();
|
78 |
-
array_shift($arguments); // We need to remove the first arg ($function_name)
|
79 |
-
call_user_func_array($display_function, $arguments);
|
80 |
-
}
|
81 |
-
}
|
82 |
-
|
83 |
-
?>
|
84 |
-
<br class="clear">
|
85 |
-
<input type="hidden" name="ninja_forms_save_screen_options" value="1">
|
86 |
-
<?php wp_nonce_field('ninja_forms_update_options'); ?>
|
87 |
-
<input name="Submit" type="submit" class="button-primary" value="<?php _e( 'Save Options', 'ninja-forms' ); ?>">
|
88 |
-
<?php
|
89 |
-
}
|
90 |
-
}
|
91 |
-
|
92 |
-
function ninja_forms_update_screen_options(){
|
93 |
-
global $ninja_forms_screen_options;
|
94 |
-
$current_tab = ninja_forms_get_current_tab();
|
95 |
-
if(isset($_POST['_wpnonce'])){
|
96 |
-
$nonce = $_POST['_wpnonce'];
|
97 |
-
}else{
|
98 |
-
$nonce = '';
|
99 |
-
}
|
100 |
-
if(!empty($_POST) AND $_POST['ninja_forms_save_screen_options'] == 1 AND wp_verify_nonce($nonce, 'ninja_forms_update_options') AND check_admin_referer( 'ninja_forms_update_options', '_wpnonce' )){
|
101 |
-
if(!empty($ninja_forms_screen_options) AND is_array($ninja_forms_screen_options)){
|
102 |
-
//print_r($ninja_forms_screen_options);
|
103 |
-
if(isset($ninja_forms_screen_options['_universal_']) AND is_array($ninja_forms_screen_options['_universal_'])){
|
104 |
-
foreach($ninja_forms_screen_options['_universal_'] as $slug => $option){
|
105 |
-
$save_function = $option['save_function'];
|
106 |
-
$arguments = func_get_args();
|
107 |
-
array_shift($arguments); // We need to remove the first arg ($function_name)
|
108 |
-
call_user_func_array($save_function, $arguments);
|
109 |
-
}
|
110 |
-
}
|
111 |
-
if(isset($ninja_forms_screen_options[$current_tab]) AND is_array($ninja_forms_screen_options[$current_tab])){
|
112 |
-
foreach($ninja_forms_screen_options[$current_tab] as $slug => $option){
|
113 |
-
$save_function = $option['save_function'];
|
114 |
-
$arguments = func_get_args();
|
115 |
-
array_shift($arguments); // We need to remove the first arg ($function_name)
|
116 |
-
call_user_func_array($save_function, $arguments);
|
117 |
-
}
|
118 |
-
}
|
119 |
-
}
|
120 |
-
}
|
121 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/admin/edit-field/autocomplete-off.php
DELETED
@@ -1,18 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
add_action('init', 'nf_register_edit_autocomplete_off');
|
3 |
-
function nf_register_edit_autocomplete_off(){
|
4 |
-
add_action('nf_edit_field_advanced', 'nf_field_autocomplete_off', 8, 2 );
|
5 |
-
}
|
6 |
-
|
7 |
-
function nf_field_autocomplete_off( $field_id, $field_data ) {
|
8 |
-
global $ninja_forms_fields;
|
9 |
-
|
10 |
-
$field_row = ninja_forms_get_field_by_id( $field_id );
|
11 |
-
$field_type = $field_row['type'];
|
12 |
-
$reg_field = $ninja_forms_fields[$field_type];
|
13 |
-
$edit_autocomplete_off = $reg_field['edit_autocomplete_off'];
|
14 |
-
if( $edit_autocomplete_off ) {
|
15 |
-
$autocomplete_off = isset ( $field_data['autocomplete_off'] ) ? $field_data['autocomplete_off'] : 0;
|
16 |
-
ninja_forms_edit_field_el_output($field_id, 'checkbox', __( 'Disable Browser Autocomplete', 'ninja-forms' ), 'autocomplete_off', $autocomplete_off, 'wide' );
|
17 |
-
}
|
18 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/admin/edit-field/calc.php
DELETED
@@ -1,55 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
|
3 |
-
/*
|
4 |
-
*
|
5 |
-
* Function used to output calcluation options on each field editing section on the back-end.
|
6 |
-
*
|
7 |
-
* @since 2.2.28
|
8 |
-
* @returns void
|
9 |
-
*/
|
10 |
-
|
11 |
-
function ninja_forms_edit_field_calc( $field_id, $field_data ) {
|
12 |
-
global $ninja_forms_fields;
|
13 |
-
|
14 |
-
$field_row = ninja_forms_get_field_by_id( $field_id );
|
15 |
-
$field_type = $field_row['type'];
|
16 |
-
if ( $ninja_forms_fields[$field_type]['process_field'] ) {
|
17 |
-
if ( isset ( $field_data['calc_option'] ) ) {
|
18 |
-
$calc_option = $field_data['calc_option'];
|
19 |
-
} else {
|
20 |
-
$calc_option = 0;
|
21 |
-
}
|
22 |
-
|
23 |
-
if ( isset ( $field_data['calc_auto_include'] ) ) {
|
24 |
-
$calc_auto_include = $field_data['calc_auto_include'];
|
25 |
-
} else {
|
26 |
-
$calc_auto_include = 0;
|
27 |
-
}
|
28 |
-
|
29 |
-
if ( isset ( $field_data['calc_value'] ) ) {
|
30 |
-
$calc_value = $field_data['calc_value'];
|
31 |
-
} else {
|
32 |
-
$calc_value = 0;
|
33 |
-
}
|
34 |
-
|
35 |
-
?>
|
36 |
-
<div class="description description-wide">
|
37 |
-
<?php
|
38 |
-
if ( $field_type == '_checkbox' ) {
|
39 |
-
if ( !isset ( $calc_value['unchecked'] ) ) {
|
40 |
-
$calc_value = array();
|
41 |
-
$calc_value['unchecked'] = 0;
|
42 |
-
$calc_value['checked'] = 0;
|
43 |
-
}
|
44 |
-
ninja_forms_edit_field_el_output($field_id, 'text', sprintf( __( '%sChecked%s Calculation Value', 'ninja-forms' ), '<strong>', '</strong>' ), 'calc_value[checked]', $calc_value['checked'], 'wide', '', '', sprintf( __( 'This is the value that will be used if %sChecked%s.', 'ninja-forms' ), '<strong>', '</strong>' ) );
|
45 |
-
ninja_forms_edit_field_el_output($field_id, 'text', sprintf( __( '%sUnchecked%s Calculation Value', 'ninja-forms' ), '<strong>', '</strong>' ), 'calc_value[unchecked]', $calc_value['unchecked'], 'wide', '', '', sprintf( __( 'This is the value that will be used if %sUnchecked%s.', 'ninja-forms' ), '<strong>', '</strong>' ) );
|
46 |
-
}
|
47 |
-
|
48 |
-
ninja_forms_edit_field_el_output($field_id, 'checkbox', __( 'Include in the auto-total? (If enabled)', 'ninja-forms' ), 'calc_auto_include', $calc_auto_include, 'wide', '', 'ninja-forms-field-auto-total-include');
|
49 |
-
?>
|
50 |
-
</div>
|
51 |
-
<?php
|
52 |
-
}
|
53 |
-
}
|
54 |
-
|
55 |
-
add_action( 'nf_edit_field_calculations', 'ninja_forms_edit_field_calc', 10, 2 );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/admin/edit-field/custom-class.php
DELETED
@@ -1,22 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
add_action('init', 'ninja_forms_register_edit_field_custom_class');
|
3 |
-
function ninja_forms_register_edit_field_custom_class(){
|
4 |
-
add_action('ninja_forms_edit_field_after_registered', 'ninja_forms_edit_field_custom_class', 10, 2 );
|
5 |
-
}
|
6 |
-
|
7 |
-
function ninja_forms_edit_field_custom_class( $field_id, $field_data ) {
|
8 |
-
global $ninja_forms_fields;
|
9 |
-
$field_row = ninja_forms_get_field_by_id($field_id);
|
10 |
-
$field_type = $field_row['type'];
|
11 |
-
$reg_field = $ninja_forms_fields[$field_type];
|
12 |
-
$edit_custom_class = $reg_field['edit_custom_class'];
|
13 |
-
if($edit_custom_class){
|
14 |
-
if(isset($field_data['class'])){
|
15 |
-
$class = $field_data['class'];
|
16 |
-
}else{
|
17 |
-
$class = '';
|
18 |
-
}
|
19 |
-
|
20 |
-
ninja_forms_edit_field_el_output($field_id, 'text', __( 'Custom CSS Classes', 'ninja-forms' ), 'class', $class, 'wide', '', 'widefat');
|
21 |
-
}
|
22 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/admin/edit-field/desc.php
DELETED
@@ -1,69 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
add_action( 'init', 'ninja_forms_register_edit_field_desc' );
|
3 |
-
function ninja_forms_register_edit_field_desc() {
|
4 |
-
add_action( 'ninja_forms_edit_field_after_registered', 'ninja_forms_edit_field_desc', 10 , 2);
|
5 |
-
}
|
6 |
-
|
7 |
-
function ninja_forms_edit_field_desc( $field_id, $field_data ) {
|
8 |
-
global $ninja_forms_fields;
|
9 |
-
$field_row = ninja_forms_get_field_by_id( $field_id );
|
10 |
-
$field_type = $field_row['type'];
|
11 |
-
$reg_field = $ninja_forms_fields[$field_type];
|
12 |
-
if ( isset ( $reg_field['edit_desc'] ) ) {
|
13 |
-
$edit_desc = $reg_field['edit_desc'];
|
14 |
-
} else {
|
15 |
-
$edit_desc = true;
|
16 |
-
}
|
17 |
-
|
18 |
-
if ( $edit_desc ) {
|
19 |
-
if ( isset( $field_data['desc_text'] ) ) {
|
20 |
-
$desc_text = $field_data['desc_text'];
|
21 |
-
} else {
|
22 |
-
$desc_text = '';
|
23 |
-
}
|
24 |
-
|
25 |
-
if ( isset( $field_data['show_desc'] ) ) {
|
26 |
-
$show_desc = $field_data['show_desc'];
|
27 |
-
} else {
|
28 |
-
$show_desc = '';
|
29 |
-
}
|
30 |
-
|
31 |
-
if ( $show_desc == 1 ) {
|
32 |
-
$display_span = '';
|
33 |
-
} else {
|
34 |
-
$display_span = ' style="display:none;"';
|
35 |
-
}
|
36 |
-
|
37 |
-
if ( !isset ( $desc_pos_options ) or $desc_pos_options == '' ) {
|
38 |
-
|
39 |
-
$options = array();
|
40 |
-
$options[] = array( 'name' => __( 'None', 'ninja-forms' ), 'value' => 'none' );
|
41 |
-
$options[] = array( 'name' => __( 'Before Everything', 'ninja-forms' ), 'value' => 'before_everything' );
|
42 |
-
if ( '_submit' != $field_type ) {
|
43 |
-
$options[] = array( 'name' => __( 'Before Label', 'ninja-forms' ), 'value' => 'before_label' );
|
44 |
-
$options[] = array( 'name' => __( 'After Label', 'ninja-forms' ), 'value' => 'after_label' );
|
45 |
-
}
|
46 |
-
$options[] = array( 'name' => __( 'After Everything', 'ninja-forms' ), 'value' => 'after_everything' );
|
47 |
-
|
48 |
-
} else {
|
49 |
-
$options = $desc_pos_options;
|
50 |
-
}
|
51 |
-
|
52 |
-
$desc_desc = sprintf( __( 'If "desc text" is enabled, there will be a question mark %s placed next to the input field. Hovering over this question mark will show the desc text.', 'ninja-forms' ), '<img src="'.NINJA_FORMS_URL.'images/question-ico.gif">' );
|
53 |
-
ninja_forms_edit_field_el_output( $field_id, 'checkbox', __( 'Add Description', 'ninja-forms' ), 'show_desc', $show_desc, 'wide', '', 'ninja-forms-show-desc' );
|
54 |
-
?>
|
55 |
-
<span id="ninja_forms_field_<?php echo $field_id;?>_desc_span" <?php echo $display_span;?>>
|
56 |
-
<?php
|
57 |
-
if ( isset( $field_data['desc_pos'] ) ) {
|
58 |
-
$desc_pos = $field_data['desc_pos'];
|
59 |
-
} else {
|
60 |
-
$desc_pos = '';
|
61 |
-
}
|
62 |
-
ninja_forms_edit_field_el_output( $field_id, 'select', __( 'Description Position', 'ninja-forms' ), 'desc_pos', $desc_pos, 'wide', $options, 'wide' );
|
63 |
-
ninja_forms_edit_field_el_output( $field_id, 'rte', __( 'Description Content', 'ninja-forms' ), 'desc_text', $desc_text, 'wide', '', 'widefat' );
|
64 |
-
|
65 |
-
?>
|
66 |
-
</span>
|
67 |
-
<?php
|
68 |
-
}
|
69 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/admin/edit-field/edit-field.php
DELETED
@@ -1,161 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
function ninja_forms_edit_field( $field_id, $new = false ){
|
3 |
-
global $wpdb, $ninja_forms_fields;
|
4 |
-
|
5 |
-
do_action( 'ninja_forms_edit_field_before_li', $field_id, $new );
|
6 |
-
do_action( 'ninja_forms_edit_field_li', $field_id, $new );
|
7 |
-
do_action( 'ninja_forms_edit_field_after_li', $field_id, $new );
|
8 |
-
|
9 |
-
}
|
10 |
-
|
11 |
-
function ninja_forms_edit_field_el_output($field_id, $type, $label = '', $name = '', $value = '', $width = 'wide', $options = '', $class = '', $desc = '', $label_class = '' ){
|
12 |
-
global $ninja_forms_fields, $nf_rte_editors;
|
13 |
-
|
14 |
-
$field_row = ninja_forms_get_field_by_id($field_id);
|
15 |
-
$field_type = $field_row['type'];
|
16 |
-
$reg_field = $ninja_forms_fields[$field_type];
|
17 |
-
|
18 |
-
$class = 'code ninja-forms-'.$field_type.'-'.$name.' '.$class;
|
19 |
-
$id = 'ninja_forms_field_'.$field_id.'_'.$name;
|
20 |
-
if ( strpos( $name, '[' ) !== false ) {
|
21 |
-
str_replace( ']', '', $name );
|
22 |
-
$name = explode( '[', $name );
|
23 |
-
if ( is_array ( $name ) ) {
|
24 |
-
$tmp_name = 'ninja_forms_field_'.$field_id;
|
25 |
-
foreach ( $name as $n ) {
|
26 |
-
$tmp_name .= '['.$n.']';
|
27 |
-
}
|
28 |
-
$name = $tmp_name;
|
29 |
-
} else {
|
30 |
-
$name = 'ninja_forms_field_'.$field_id.'['.$name.']';
|
31 |
-
}
|
32 |
-
} else {
|
33 |
-
$name = 'ninja_forms_field_'.$field_id.'['.$name.']';
|
34 |
-
}
|
35 |
-
|
36 |
-
?>
|
37 |
-
<div class="description description-<?php echo $width;?> <?php echo $type;?>" id="<?php echo $name;?>_p">
|
38 |
-
<?php
|
39 |
-
if($type != 'rte'){
|
40 |
-
$value = ninja_forms_esc_html_deep( $value );
|
41 |
-
?>
|
42 |
-
<span class="field-option">
|
43 |
-
<?php
|
44 |
-
}
|
45 |
-
if($type != 'checkbox' AND $type != 'desc'){
|
46 |
-
?>
|
47 |
-
<label for="<?php echo $id;?>" id="<?php echo $id;?>_label" class="<?php echo $label_class;?>">
|
48 |
-
<?php _e( $label , 'ninja-forms'); ?></label><br/>
|
49 |
-
<?php
|
50 |
-
}
|
51 |
-
switch($type){
|
52 |
-
case 'text':
|
53 |
-
?>
|
54 |
-
<input type="text" class="<?php echo $class;?>" name="<?php echo $name;?>" id="<?php echo $id;?>" value="<?php echo $value;?>" />
|
55 |
-
<?php
|
56 |
-
break;
|
57 |
-
case 'number':
|
58 |
-
?>
|
59 |
-
<input type="number" class="<?php echo $class;?>" name="<?php echo $name;?>" id="<?php echo $id;?>" value="<?php echo $value;?>" />
|
60 |
-
<?php
|
61 |
-
break;
|
62 |
-
case 'checkbox':
|
63 |
-
?>
|
64 |
-
<label for="<?php echo $id;?>" id="<?php echo $id;?>_label">
|
65 |
-
<input type="hidden" value="0" name="<?php echo $name;?>">
|
66 |
-
<input type="checkbox" value="1" name="<?php echo $name;?>" id="<?php echo $id;?>" class="<?php echo $class;?>" <?php checked($value, 1);?>>
|
67 |
-
<?php _e( $label , 'ninja-forms'); ?>
|
68 |
-
</label>
|
69 |
-
<?php
|
70 |
-
break;
|
71 |
-
case 'select':
|
72 |
-
?>
|
73 |
-
<select id="<?php echo $id;?>" name="<?php echo $name;?>" class="<?php echo $class;?>">
|
74 |
-
<?php
|
75 |
-
if(is_array($options) AND !empty($options)){
|
76 |
-
foreach($options as $opt){
|
77 |
-
?>
|
78 |
-
<option value="<?php echo $opt['value'];?>" <?php selected($opt['value'], $value); ?> ><?php _e( $opt['name'], 'ninja-forms'); ?></option>
|
79 |
-
<?php
|
80 |
-
}
|
81 |
-
}
|
82 |
-
?>
|
83 |
-
</select>
|
84 |
-
<?php
|
85 |
-
break;
|
86 |
-
case 'multi':
|
87 |
-
?>
|
88 |
-
<select multiple="multiple" id="<?php echo $id;?>" name="<?php echo $name;?>" class="<?php echo $class;?>">
|
89 |
-
<?php
|
90 |
-
if(is_array($options) AND !empty($options)){
|
91 |
-
foreach($options as $opt){
|
92 |
-
?>
|
93 |
-
<option value="<?php echo $opt['value'];?>" <?php selected($opt['value'], $value); ?> ><?php _e( $opt['name'], 'ninja-forms'); ?></option>
|
94 |
-
<?php
|
95 |
-
}
|
96 |
-
}
|
97 |
-
?>
|
98 |
-
</select>
|
99 |
-
<?php
|
100 |
-
break;
|
101 |
-
case 'textarea':
|
102 |
-
?>
|
103 |
-
<textarea id="<?php echo $id;?>" name="<?php echo $name;?>" class="<?php echo $class;?>" rows="3" cols="20" ><?php echo $value;?></textarea>
|
104 |
-
<?php
|
105 |
-
break;
|
106 |
-
case 'hidden':
|
107 |
-
?>
|
108 |
-
<input type="hidden" name="<?php echo $name;?>" value="<?php echo $value;?>">
|
109 |
-
<?php
|
110 |
-
break;
|
111 |
-
case 'desc':
|
112 |
-
?>
|
113 |
-
<span class="desc"><label for="<?php echo $id;?>" id="<?php echo $id;?>_label"><?php _e($label, 'ninja-forms'); ?></label></span>
|
114 |
-
<?php
|
115 |
-
break;
|
116 |
-
case 'rte':
|
117 |
-
// Check if our current user has the RTE disabled.
|
118 |
-
$user_id = get_current_user_id();
|
119 |
-
$rich_editing = get_user_meta( $user_id, 'rich_editing', true );
|
120 |
-
if ( 'true' == $rich_editing ) {
|
121 |
-
$editor_id = str_replace( '[', '_', $name );
|
122 |
-
$editor_id = str_replace( ']', '', $editor_id );
|
123 |
-
|
124 |
-
$plugin_settings = nf_get_settings();
|
125 |
-
if ( !isset( $plugin_settings['version_2_2_25_rte_fix'] ) OR $plugin_settings['version_2_2_25_rte_fix'] == '' ) {
|
126 |
-
$value = html_entity_decode( $value );
|
127 |
-
$plugin_settings['version_2_2_25_rte_fix'] = 1;
|
128 |
-
update_option( 'ninja_forms_settings', $plugin_settings );
|
129 |
-
}
|
130 |
-
|
131 |
-
$args = apply_filters( 'ninja_forms_edit_field_rte', array( 'textarea_name' => $name ) );
|
132 |
-
wp_editor( $value, $editor_id, $args );
|
133 |
-
|
134 |
-
// If we're using ajax, add this editor ID to our global var so that we can instantiate it on the front-end.
|
135 |
-
if ( isset ( $_POST['action'] ) && ( $_POST['action'] == 'ninja_forms_new_field' || $_POST['action'] == 'nf_output_field_settings_html' ) )
|
136 |
-
$nf_rte_editors[] = $editor_id;
|
137 |
-
} else {
|
138 |
-
?>
|
139 |
-
<textarea id="<?php echo $id;?>" name="<?php echo $name;?>" class="<?php echo $class;?>" rows="3" cols="20" ><?php echo $value;?></textarea>
|
140 |
-
<?php
|
141 |
-
}
|
142 |
-
|
143 |
-
break;
|
144 |
-
}
|
145 |
-
|
146 |
-
if($desc != ''){
|
147 |
-
?>
|
148 |
-
<span class="description">
|
149 |
-
<?php _e($desc, 'ninja-forms'); ?>
|
150 |
-
</span>
|
151 |
-
<?php
|
152 |
-
}
|
153 |
-
if($type != 'rte'){
|
154 |
-
?>
|
155 |
-
</span>
|
156 |
-
<?php
|
157 |
-
}
|
158 |
-
?>
|
159 |
-
</div>
|
160 |
-
<?php
|
161 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/admin/edit-field/help.php
DELETED
@@ -1,43 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
add_action('init', 'ninja_forms_register_edit_field_help');
|
3 |
-
function ninja_forms_register_edit_field_help(){
|
4 |
-
add_action('ninja_forms_edit_field_after_registered', 'ninja_forms_edit_field_help', 10, 2 );
|
5 |
-
}
|
6 |
-
|
7 |
-
function ninja_forms_edit_field_help( $field_id, $field_data ) {
|
8 |
-
global $ninja_forms_fields;
|
9 |
-
$field_row = ninja_forms_get_field_by_id($field_id);
|
10 |
-
$field_type = $field_row['type'];
|
11 |
-
$reg_field = $ninja_forms_fields[$field_type];
|
12 |
-
$edit_help = $reg_field['edit_help'];
|
13 |
-
if($edit_help){
|
14 |
-
if(isset($field_data['help_text'])){
|
15 |
-
$help_text = $field_data['help_text'];
|
16 |
-
}else{
|
17 |
-
$help_text = '';
|
18 |
-
}
|
19 |
-
|
20 |
-
if(isset($field_data['show_help'])){
|
21 |
-
$show_help = $field_data['show_help'];
|
22 |
-
}else{
|
23 |
-
$show_help = '';
|
24 |
-
}
|
25 |
-
|
26 |
-
if( $show_help == 1 ){
|
27 |
-
$display_span = '';
|
28 |
-
}else{
|
29 |
-
$display_span = 'display:none;';
|
30 |
-
}
|
31 |
-
|
32 |
-
$help_desc = sprintf( __( 'If "help text" is enabled, there will be a question mark %s placed next to the input field. Hovering over this question mark will show the help text.', 'ninja-forms' ), '<img src="'.NINJA_FORMS_URL.'images/question-ico.gif">') ;
|
33 |
-
ninja_forms_edit_field_el_output($field_id, 'checkbox', __( 'Show Help Text', 'ninja-forms' ), 'show_help', $show_help, 'wide', '', 'ninja-forms-show-help');
|
34 |
-
?>
|
35 |
-
<span id="ninja_forms_field_<?php echo $field_id;?>_help_span" style="<?php echo $display_span;?>">
|
36 |
-
<?php
|
37 |
-
ninja_forms_edit_field_el_output($field_id, 'textarea', __( 'Help Text', 'ninja-forms' ), 'help_text', $help_text, 'wide', '', 'widefat');
|
38 |
-
ninja_forms_edit_field_el_output($field_id, 'desc', $help_desc, 'help_desc');
|
39 |
-
?>
|
40 |
-
</span>
|
41 |
-
<?php
|
42 |
-
}
|
43 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/admin/edit-field/hr.php
DELETED
@@ -1,12 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
//add_action('ninja_forms_edit_field_after_registered', 'ninja_forms_edit_field_hr', 10);
|
3 |
-
function ninja_forms_edit_field_hr($field_id){
|
4 |
-
$field_row = ninja_forms_get_field_by_id($field_id);
|
5 |
-
$field_type = $field_row['type'];
|
6 |
-
$field_data = $field_row['data'];
|
7 |
-
?>
|
8 |
-
<p class="description-wide">
|
9 |
-
<hr>
|
10 |
-
</p>
|
11 |
-
<?php
|
12 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/admin/edit-field/index.php
DELETED
@@ -1,2 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
// Silence is golden.
|
|
|
|
deprecated/includes/admin/edit-field/input-limit.php
DELETED
@@ -1,45 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Function that adds a character and word limit option to textboxes and textareas.
|
5 |
-
*
|
6 |
-
* @since 2.4.3
|
7 |
-
* @return void
|
8 |
-
*/
|
9 |
-
|
10 |
-
function ninja_forms_edit_field_input_limit( $field_id, $field_data ) {
|
11 |
-
|
12 |
-
$field_row = ninja_forms_get_field_by_id($field_id);
|
13 |
-
$field_type = $field_row['type'];
|
14 |
-
|
15 |
-
$allowed_types = apply_filters( 'nf_input_limit_types', array( '_text', '_textarea' ) );
|
16 |
-
|
17 |
-
if ( ! in_array( $field_type, $allowed_types ) )
|
18 |
-
return false;
|
19 |
-
|
20 |
-
if ( isset ( $field_data['input_limit'] ) ) {
|
21 |
-
$input_limit = $field_data['input_limit'];
|
22 |
-
} else {
|
23 |
-
$input_limit = '';
|
24 |
-
}
|
25 |
-
|
26 |
-
if ( isset ( $field_data['input_limit_type'] ) ) {
|
27 |
-
$input_limit_type = $field_data['input_limit_type'];
|
28 |
-
} else {
|
29 |
-
$input_limit_type = '';
|
30 |
-
}
|
31 |
-
|
32 |
-
if ( isset ( $field_data['input_limit_msg'] ) ) {
|
33 |
-
$input_limit_msg = $field_data['input_limit_msg'];
|
34 |
-
} else {
|
35 |
-
$input_limit_msg = '';
|
36 |
-
}
|
37 |
-
|
38 |
-
$desc = '<em>'.__( 'If you leave the box empty, no limit will be used', 'ninja-forms' ).'</em>';
|
39 |
-
ninja_forms_edit_field_el_output( $field_id, 'text', __( 'Limit input to this number', 'ninja-forms' ), 'input_limit', $input_limit, 'thin', '', 'widefat', $desc );
|
40 |
-
ninja_forms_edit_field_el_output( $field_id, 'select', __( 'of', 'ninja-forms' ), 'input_limit_type', $input_limit_type, 'thin', array( array( 'name' => __( 'Characters', 'ninja-forms' ), 'value' => 'char') , array( 'name' => __( 'Words', 'ninja-forms' ), 'value' => 'word' ) ), 'widefat' );
|
41 |
-
echo '<p class="description description-wide"> </p>';
|
42 |
-
ninja_forms_edit_field_el_output( $field_id, 'text', __( 'Text to appear after character/word counter', 'ninja-forms' ), 'input_limit_msg', $input_limit_msg, 'wide', '', 'widefat' );
|
43 |
-
}
|
44 |
-
|
45 |
-
add_action( 'nf_edit_field_restrictions', 'ninja_forms_edit_field_input_limit', 15, 2 );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/admin/edit-field/label.php
DELETED
@@ -1,59 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
add_action('init', 'ninja_forms_register_edit_field_label');
|
3 |
-
function ninja_forms_register_edit_field_label(){
|
4 |
-
add_action('ninja_forms_edit_field_before_registered', 'ninja_forms_edit_field_label', 10, 2);
|
5 |
-
}
|
6 |
-
|
7 |
-
function ninja_forms_edit_field_label( $field_id, $field_data ) {
|
8 |
-
global $ninja_forms_fields;
|
9 |
-
$field_row = ninja_forms_get_field_by_id($field_id);
|
10 |
-
$field_type = $field_row['type'];
|
11 |
-
$reg_field = $ninja_forms_fields[$field_type];
|
12 |
-
$edit_label = $reg_field['edit_label'];
|
13 |
-
if($edit_label){
|
14 |
-
if(isset($field_data['label'])){
|
15 |
-
$label = stripslashes($field_data['label']);
|
16 |
-
}else{
|
17 |
-
$label = '';
|
18 |
-
}
|
19 |
-
|
20 |
-
ninja_forms_edit_field_el_output($field_id, 'text', 'Label', 'label', $label, 'wide', '', 'widefat ninja-forms-field-label');
|
21 |
-
}
|
22 |
-
}
|
23 |
-
|
24 |
-
add_action('init', 'ninja_forms_register_edit_field_label_pos');
|
25 |
-
function ninja_forms_register_edit_field_label_pos(){
|
26 |
-
add_action('ninja_forms_edit_field_before_registered', 'ninja_forms_edit_field_label_pos', 10, 2 );
|
27 |
-
}
|
28 |
-
|
29 |
-
function ninja_forms_edit_field_label_pos( $field_id, $field_data ){
|
30 |
-
global $ninja_forms_fields;
|
31 |
-
$field_row = ninja_forms_get_field_by_id($field_id);
|
32 |
-
$field_type = $field_row['type'];
|
33 |
-
$reg_field = $ninja_forms_fields[$field_type];
|
34 |
-
$edit_label_pos = $reg_field['edit_label_pos'];
|
35 |
-
$label_pos_options = $reg_field['label_pos_options'];
|
36 |
-
|
37 |
-
if( !$label_pos_options OR $label_pos_options == '' ){
|
38 |
-
$options = array(
|
39 |
-
array('name' => __( 'Left of Element', 'ninja-forms' ), 'value' => 'left'),
|
40 |
-
array('name' => __( 'Above Element', 'ninja-forms' ), 'value' => 'above'),
|
41 |
-
array('name' => __( 'Below Element', 'ninja-forms' ), 'value' => 'below'),
|
42 |
-
array('name' => __( 'Right of Element', 'ninja-forms' ), 'value' => 'right'),
|
43 |
-
array('name' => __( 'Inside Element', 'ninja-forms' ), 'value' => 'inside'),
|
44 |
-
);
|
45 |
-
}else{
|
46 |
-
$options = $label_pos_options;
|
47 |
-
}
|
48 |
-
|
49 |
-
if($edit_label_pos){
|
50 |
-
if(isset($field_data['label_pos'])){
|
51 |
-
$label_pos = $field_data['label_pos'];
|
52 |
-
}else{
|
53 |
-
$label_pos = 'above';
|
54 |
-
}
|
55 |
-
|
56 |
-
ninja_forms_edit_field_el_output($field_id, 'select', __( 'Label Position', 'ninja-forms' ), 'label_pos', $label_pos, 'wide', $options, 'widefat');
|
57 |
-
}
|
58 |
-
|
59 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/admin/edit-field/li.php
DELETED
@@ -1,518 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
|
3 |
-
function ninja_forms_edit_field_output_li( $field_id, $new = false ) {
|
4 |
-
global $wpdb, $ninja_forms_fields, $nf_rte_editors;
|
5 |
-
$field_row = ninja_forms_get_field_by_id( $field_id );
|
6 |
-
$current_tab = ninja_forms_get_current_tab();
|
7 |
-
if ( isset ( $_REQUEST['page'] ) ) {
|
8 |
-
$current_page = esc_html( $_REQUEST['page'] );
|
9 |
-
} else {
|
10 |
-
$current_page = '';
|
11 |
-
}
|
12 |
-
|
13 |
-
$field_type = $field_row['type'];
|
14 |
-
$field_data = $field_row['data'];
|
15 |
-
$plugin_settings = nf_get_settings();
|
16 |
-
|
17 |
-
if ( isset( $ninja_forms_fields[$field_type]['use_li'] ) && $ninja_forms_fields[$field_type]['use_li'] ) {
|
18 |
-
|
19 |
-
if ( isset( $field_row['fav_id'] ) && $field_row['fav_id'] != 0 ) {
|
20 |
-
$fav_id = $field_row['fav_id'];
|
21 |
-
$fav_row = ninja_forms_get_fav_by_id( $fav_id );
|
22 |
-
if ( empty( $fav_row['name'] ) ) {
|
23 |
-
$args = array(
|
24 |
-
'update_array' => array(
|
25 |
-
'fav_id' => '',
|
26 |
-
),
|
27 |
-
'where' => array(
|
28 |
-
'id' => $field_id,
|
29 |
-
),
|
30 |
-
);
|
31 |
-
|
32 |
-
ninja_forms_update_field( $args );
|
33 |
-
$fav_id = '';
|
34 |
-
}
|
35 |
-
} else {
|
36 |
-
$fav_id = '';
|
37 |
-
}
|
38 |
-
|
39 |
-
if ( isset( $field_row['def_id'] ) && $field_row['def_id'] != 0 ) {
|
40 |
-
$def_id = $field_row['def_id'];
|
41 |
-
} else {
|
42 |
-
$def_id = '';
|
43 |
-
}
|
44 |
-
|
45 |
-
$form_id = $field_row['form_id'];
|
46 |
-
|
47 |
-
if ( isset( $ninja_forms_fields[$field_type] ) ) {
|
48 |
-
$reg_field = $ninja_forms_fields[$field_type];
|
49 |
-
$type_name = $reg_field['name'];
|
50 |
-
$edit_function = $reg_field['edit_function'];
|
51 |
-
$edit_options = $reg_field['edit_options'];
|
52 |
-
$li_class = $reg_field['li_class'];
|
53 |
-
|
54 |
-
if ( $reg_field['nesting'] ) {
|
55 |
-
$nesting_class = 'ninja-forms-nest';
|
56 |
-
} else {
|
57 |
-
$nesting_class = 'ninja-forms-no-nest';
|
58 |
-
}
|
59 |
-
$conditional = $reg_field['conditional'];
|
60 |
-
|
61 |
-
$type_class = $field_type.'-li';
|
62 |
-
|
63 |
-
if ( $def_id != 0 && $def_id != '' ) {
|
64 |
-
$def_row = ninja_forms_get_def_by_id( $def_id );
|
65 |
-
if ( !empty( $def_row['name'] ) ) {
|
66 |
-
$type_name = $def_row['name'];
|
67 |
-
}
|
68 |
-
}
|
69 |
-
|
70 |
-
if ( $fav_id != 0 && $fav_id != '' ) {
|
71 |
-
$fav_row = ninja_forms_get_fav_by_id( $fav_id );
|
72 |
-
if ( !empty( $fav_row['name'] ) ) {
|
73 |
-
$fav_class = 'ninja-forms-field-remove-fav';
|
74 |
-
$type_name = $fav_row['name'];
|
75 |
-
}
|
76 |
-
} else {
|
77 |
-
$fav_class = 'ninja-forms-field-add-fav';
|
78 |
-
}
|
79 |
-
|
80 |
-
if ( isset( $field_data['label'] ) && $field_data['label'] != '' ) {
|
81 |
-
$li_label = $field_data['label'];
|
82 |
-
} else {
|
83 |
-
$li_label = $type_name;
|
84 |
-
}
|
85 |
-
|
86 |
-
$li_label = apply_filters( 'ninja_forms_edit_field_li_label', $li_label, $field_id );
|
87 |
-
|
88 |
-
$li_label = stripslashes( $li_label );
|
89 |
-
$li_label = ninja_forms_esc_html_deep( $li_label );
|
90 |
-
|
91 |
-
if (
|
92 |
-
isset( $reg_field ) &&
|
93 |
-
isset( $reg_field['conditional'] ) &&
|
94 |
-
isset( $reg_field['conditional']['value'] ) &&
|
95 |
-
isset( $reg_field['conditional']['value']['type'] ) ) {
|
96 |
-
$conditional_value_type = $reg_field['conditional']['value']['type'];
|
97 |
-
} else {
|
98 |
-
$conditional_value_type = '';
|
99 |
-
}
|
100 |
-
?>
|
101 |
-
<li id="ninja_forms_field_<?php echo $field_id;?>" class="<?php echo $li_class; ?> <?php echo $nesting_class;?> <?php echo $type_class;?>">
|
102 |
-
<input type="hidden" id="ninja_forms_field_<?php echo $field_id;?>_conditional_value_type" value="<?php echo $conditional_value_type;?>">
|
103 |
-
<input type="hidden" id="ninja_forms_field_<?php echo $field_id;?>_fav_id" name="" class="ninja-forms-field-fav-id" value="<?php echo $fav_id;?>">
|
104 |
-
<dl class="menu-item-bar">
|
105 |
-
<dt class="menu-item-handle" id="ninja_forms_metabox_field_<?php echo $field_id;?>" >
|
106 |
-
<span class="item-title ninja-forms-field-title" id="ninja_forms_field_<?php echo $field_id;?>_title"><?php echo $li_label;?></span>
|
107 |
-
<span class="item-controls">
|
108 |
-
<span class="item-type"><span class="spinner" style="margin-top:-2px;float:left;"></span><span class="item-type-name"><?php echo $type_name;?></span></span>
|
109 |
-
<a class="item-edit nf-edit-field" id="ninja_forms_field_<?php echo $field_id;?>_toggle" title="<?php _e( 'Edit Menu Item', 'ninja-forms' ); ?>" href="#" data-field="<?php echo $field_id; ?>"><?php _e( 'Edit Menu Item' , 'ninja-forms' ); ?></a>
|
110 |
-
</span>
|
111 |
-
</dt>
|
112 |
-
</dl>
|
113 |
-
<?php
|
114 |
-
if ( $new ) {
|
115 |
-
$padding = '';
|
116 |
-
} else {
|
117 |
-
$padding = 'no-padding';
|
118 |
-
}
|
119 |
-
?>
|
120 |
-
<div class="menu-item-settings type-class inside <?php echo $padding?>" id="ninja_forms_field_<?php echo $field_id;?>_inside" >
|
121 |
-
<?php
|
122 |
-
if ( $new ) {
|
123 |
-
nf_output_registered_field_settings( $field_id );
|
124 |
-
}
|
125 |
-
}
|
126 |
-
} else {
|
127 |
-
if ( isset( $ninja_forms_fields[$field_type] ) ) {
|
128 |
-
$reg_field = $ninja_forms_fields[$field_type];
|
129 |
-
$edit_function = $reg_field['edit_function'];
|
130 |
-
$arguments = array();
|
131 |
-
$arguments['field_id'] = $field_id;
|
132 |
-
$arguments['data'] = $field_data;
|
133 |
-
|
134 |
-
if ( $edit_function != '' ) {
|
135 |
-
call_user_func_array( $edit_function, $arguments );
|
136 |
-
}
|
137 |
-
}
|
138 |
-
}
|
139 |
-
}
|
140 |
-
|
141 |
-
add_action( 'ninja_forms_edit_field_li', 'ninja_forms_edit_field_output_li', 10, 2 );
|
142 |
-
|
143 |
-
function ninja_forms_edit_field_close_li( $field_id ) {
|
144 |
-
global $ninja_forms_fields;
|
145 |
-
$field_row = ninja_forms_get_field_by_id( $field_id );
|
146 |
-
$field_type = $field_row['type'];
|
147 |
-
|
148 |
-
if ( isset( $ninja_forms_fields[$field_type]['use_li'] ) and $ninja_forms_fields[$field_type]['use_li'] ) {
|
149 |
-
|
150 |
-
do_action( 'ninja_forms_edit_field_before_closing_li', $field_id );
|
151 |
-
?>
|
152 |
-
</div><!-- .menu-item-settings-->
|
153 |
-
</li>
|
154 |
-
<?php
|
155 |
-
}
|
156 |
-
}
|
157 |
-
add_action( 'ninja_forms_edit_field_after_li', 'ninja_forms_edit_field_close_li' );
|
158 |
-
|
159 |
-
/**
|
160 |
-
* Test fixes for adding dynamic tinyMCE editors
|
161 |
-
*
|
162 |
-
*/
|
163 |
-
|
164 |
-
// used to capture javascript settings generated by the editor
|
165 |
-
add_filter( 'tiny_mce_before_init', 'NF_WP_Editor_Ajax::tiny_mce_before_init', 10, 2 );
|
166 |
-
add_filter( 'quicktags_settings', 'NF_WP_Editor_Ajax::quicktags_settings', 10, 2 );
|
167 |
-
|
168 |
-
class NF_WP_Editor_Ajax {
|
169 |
-
|
170 |
-
/*
|
171 |
-
* AJAX Call Used to Generate the WP Editor
|
172 |
-
*/
|
173 |
-
|
174 |
-
public static function output_js( $field_id = '', $editors = array() ) {
|
175 |
-
|
176 |
-
if ( empty( $field_id ) or empty( $editors ) )
|
177 |
-
return false;
|
178 |
-
|
179 |
-
$mce_init = '';
|
180 |
-
$qt_init = '';
|
181 |
-
|
182 |
-
foreach ( $editors as $id ) {
|
183 |
-
$mce_init .= self::get_mce_init($id);
|
184 |
-
$qt_init .= self::get_qt_init($id);
|
185 |
-
}
|
186 |
-
|
187 |
-
$mce_init = '{' . trim( $mce_init, ',' ) . '}';
|
188 |
-
$qt_init = '{' . trim( $qt_init, ',' ) . '}';
|
189 |
-
|
190 |
-
?>
|
191 |
-
<script type="text/javascript">
|
192 |
-
tinyMCEPreInit.mceInit = jQuery.extend( tinyMCEPreInit.mceInit, <?php echo $mce_init ?>);
|
193 |
-
tinyMCEPreInit.qtInit = jQuery.extend( tinyMCEPreInit.qtInit, <?php echo $qt_init ?>);
|
194 |
-
nf_ajax_rte_editors = <?php echo json_encode( $editors ); ?>;
|
195 |
-
</script>
|
196 |
-
<?php
|
197 |
-
}
|
198 |
-
|
199 |
-
/*
|
200 |
-
* Used to retrieve the javascript settings that the editor generates
|
201 |
-
*/
|
202 |
-
|
203 |
-
private static $mce_settings = array();
|
204 |
-
private static $qt_settings = array();
|
205 |
-
|
206 |
-
public static function quicktags_settings( $qtInit, $editor_id ) {
|
207 |
-
self::$qt_settings[ $editor_id ] = $qtInit;
|
208 |
-
return $qtInit;
|
209 |
-
}
|
210 |
-
|
211 |
-
public static function tiny_mce_before_init( $mceInit, $editor_id ) {
|
212 |
-
self::$mce_settings[ $editor_id ] = $mceInit;
|
213 |
-
return $mceInit;
|
214 |
-
}
|
215 |
-
|
216 |
-
/*
|
217 |
-
* Code copied from _WP_Editors class (modified a little)
|
218 |
-
*/
|
219 |
-
private static function get_qt_init($editor_id) {
|
220 |
-
if ( ! empty( self::$qt_settings[ $editor_id ] ) ) {
|
221 |
-
$options = self::_parse_init( self::$qt_settings[ $editor_id ] );
|
222 |
-
$qtInit = "'$editor_id':{$options},";
|
223 |
-
} else {
|
224 |
-
$qtInit = '{}';
|
225 |
-
}
|
226 |
-
return $qtInit;
|
227 |
-
}
|
228 |
-
|
229 |
-
private static function get_mce_init($editor_id) {
|
230 |
-
if ( !empty(self::$mce_settings[ $editor_id ]) ) {
|
231 |
-
$options = self::_parse_init( self::$mce_settings[ $editor_id ] );
|
232 |
-
$mceInit = "'$editor_id':{$options},";
|
233 |
-
} else {
|
234 |
-
$mceInit = '{}';
|
235 |
-
}
|
236 |
-
return $mceInit;
|
237 |
-
}
|
238 |
-
|
239 |
-
private static function _parse_init($init) {
|
240 |
-
$options = '';
|
241 |
-
|
242 |
-
foreach ( $init as $k => $v ) {
|
243 |
-
if ( is_bool($v) ) {
|
244 |
-
$val = $v ? 'true' : 'false';
|
245 |
-
$options .= $k . ':' . $val . ',';
|
246 |
-
continue;
|
247 |
-
} elseif ( !empty($v) && is_string($v) && ( ('{' == $v{0} && '}' == $v{strlen($v) - 1}) || ('[' == $v{0} && ']' == $v{strlen($v) - 1}) || preg_match('/^\(?function ?\(/', $v) ) ) {
|
248 |
-
$options .= $k . ':' . $v . ',';
|
249 |
-
continue;
|
250 |
-
}
|
251 |
-
$options .= $k . ':"' . $v . '",';
|
252 |
-
}
|
253 |
-
|
254 |
-
return '{' . trim( $options, ' ,' ) . '}';
|
255 |
-
}
|
256 |
-
}
|
257 |
-
|
258 |
-
function nf_output_registered_field_settings( $field_id, $data = array() ) {
|
259 |
-
global $ninja_forms_fields, $nf_rte_editors;
|
260 |
-
|
261 |
-
$field_row = ninja_forms_get_field_by_id( $field_id );
|
262 |
-
$field_type = $field_row['type'];
|
263 |
-
|
264 |
-
$field_data = empty ( $data ) ? $field_row['data'] : $data;
|
265 |
-
|
266 |
-
$current_tab = ninja_forms_get_current_tab();
|
267 |
-
if ( isset ( $_REQUEST['page'] ) ) {
|
268 |
-
$current_page = esc_html( $_REQUEST['page'] );
|
269 |
-
} else {
|
270 |
-
$current_page = '';
|
271 |
-
}
|
272 |
-
|
273 |
-
$reg_field = $ninja_forms_fields[$field_type];
|
274 |
-
$type_name = $reg_field['name'];
|
275 |
-
$edit_function = $reg_field['edit_function'];
|
276 |
-
$edit_options = $reg_field['edit_options'];
|
277 |
-
$edit_settings = $reg_field['edit_settings'];
|
278 |
-
|
279 |
-
if ( $reg_field['nesting'] ) {
|
280 |
-
$nesting_class = 'ninja-forms-nest';
|
281 |
-
} else {
|
282 |
-
$nesting_class = 'ninja-forms-no-nest';
|
283 |
-
}
|
284 |
-
$conditional = $reg_field['conditional'];
|
285 |
-
|
286 |
-
|
287 |
-
if ( isset( $field_row['fav_id'] ) && $field_row['fav_id'] != 0 ) {
|
288 |
-
$fav_id = $field_row['fav_id'];
|
289 |
-
$fav_row = ninja_forms_get_fav_by_id( $fav_id );
|
290 |
-
if ( empty( $fav_row['name'] ) ) {
|
291 |
-
$args = array(
|
292 |
-
'update_array' => array(
|
293 |
-
'fav_id' => '',
|
294 |
-
),
|
295 |
-
'where' => array(
|
296 |
-
'id' => $field_id,
|
297 |
-
),
|
298 |
-
);
|
299 |
-
|
300 |
-
ninja_forms_update_field( $args );
|
301 |
-
$fav_id = '';
|
302 |
-
}
|
303 |
-
} else {
|
304 |
-
$fav_id = '';
|
305 |
-
}
|
306 |
-
|
307 |
-
if ( isset( $field_row['def_id'] ) && $field_row['def_id'] != 0 ) {
|
308 |
-
$def_id = $field_row['def_id'];
|
309 |
-
} else {
|
310 |
-
$def_id = '';
|
311 |
-
}
|
312 |
-
|
313 |
-
if ( $fav_id != 0 && $fav_id != '' ) {
|
314 |
-
$fav_row = ninja_forms_get_fav_by_id( $fav_id );
|
315 |
-
if ( !empty( $fav_row['name'] ) ) {
|
316 |
-
$fav_class = 'ninja-forms-field-remove-fav';
|
317 |
-
$type_name = $fav_row['name'];
|
318 |
-
$icon_class = 'filled';
|
319 |
-
}
|
320 |
-
} else {
|
321 |
-
$fav_class = 'ninja-forms-field-add-fav';
|
322 |
-
$icon_class = 'empty';
|
323 |
-
}
|
324 |
-
|
325 |
-
if ( $reg_field['show_field_id'] || $reg_field['show_fav'] ) {
|
326 |
-
?>
|
327 |
-
<table id="field-info">
|
328 |
-
<tr>
|
329 |
-
<?php
|
330 |
-
if ( $reg_field['show_field_id'] ) {
|
331 |
-
?>
|
332 |
-
<td width="65%"><?php _e( 'Field ID', 'ninja-forms' ); ?>: <strong><?php echo $field_id;?></strong></td>
|
333 |
-
<?php
|
334 |
-
}
|
335 |
-
?>
|
336 |
-
<!-- <td width="15%"><a href="#" class="ninja-forms-field-add-def" id="ninja_forms_field_<?php echo $field_id;?>_def" class="ninja-forms-field-add-def">Add Defined</a></td><td width="15%"><a href="#" class="ninja-forms-field-remove-def" id="ninja_forms_field_<?php echo $field_id;?>_def">Remove Defined</a></td> -->
|
337 |
-
<?php
|
338 |
-
if ( $reg_field['show_fav'] ) {
|
339 |
-
?>
|
340 |
-
<td width="5%"><a href="#" class="<?php echo $fav_class;?>" id="ninja_forms_field_<?php echo $field_id;?>_fav"><span class="dashicons dashicons-star-<?php echo $icon_class; ?>"></span></a></td>
|
341 |
-
<?php
|
342 |
-
}
|
343 |
-
?>
|
344 |
-
</tr>
|
345 |
-
</table>
|
346 |
-
<?php
|
347 |
-
}
|
348 |
-
do_action( 'ninja_forms_edit_field_before_registered', $field_id, $field_data );
|
349 |
-
|
350 |
-
$arguments = array( 'field_id' => $field_id, 'data' => $field_data );
|
351 |
-
|
352 |
-
if ( $edit_function != '' ) {
|
353 |
-
call_user_func_array( $edit_function, $arguments );
|
354 |
-
}
|
355 |
-
|
356 |
-
/**
|
357 |
-
* We need to get a list of all of our RTEs.
|
358 |
-
* If we're submitting via ajax, we'll need to use this list.
|
359 |
-
*/
|
360 |
-
if ( ! isset ( $nf_rte_editors ) )
|
361 |
-
$nf_rte_editors = array();
|
362 |
-
|
363 |
-
$editors = new NF_WP_Editor_Ajax();
|
364 |
-
|
365 |
-
if ( is_array( $edit_options ) and !empty( $edit_options ) ) {
|
366 |
-
foreach ( $edit_options as $opt ) {
|
367 |
-
$type = $opt['type'];
|
368 |
-
|
369 |
-
$label_class = '';
|
370 |
-
|
371 |
-
if ( isset( $opt['label'] ) ) {
|
372 |
-
$label = $opt['label'];
|
373 |
-
} else {
|
374 |
-
$label = '';
|
375 |
-
}
|
376 |
-
|
377 |
-
if ( isset( $opt['name'] ) ) {
|
378 |
-
$name = $opt['name'];
|
379 |
-
} else {
|
380 |
-
$name = '';
|
381 |
-
}
|
382 |
-
|
383 |
-
if ( isset( $opt['width'] ) ) {
|
384 |
-
$width = $opt['width'];
|
385 |
-
} else {
|
386 |
-
$width = '';
|
387 |
-
}
|
388 |
-
|
389 |
-
if ( isset( $opt['options'] ) ) {
|
390 |
-
$options = $opt['options'];
|
391 |
-
} else {
|
392 |
-
$options = '';
|
393 |
-
}
|
394 |
-
|
395 |
-
if ( isset( $opt['class'] ) ) {
|
396 |
-
$class = $opt['class'];
|
397 |
-
} else {
|
398 |
-
$class = '';
|
399 |
-
}
|
400 |
-
|
401 |
-
if ( isset( $opt['default'] ) ) {
|
402 |
-
$default = $opt['default'];
|
403 |
-
} else {
|
404 |
-
$default = '';
|
405 |
-
}
|
406 |
-
|
407 |
-
if ( isset( $opt['desc'] ) ) {
|
408 |
-
$desc = $opt['desc'];
|
409 |
-
} else {
|
410 |
-
$desc = '';
|
411 |
-
}
|
412 |
-
|
413 |
-
if ( isset( $field_data[$name] ) ) {
|
414 |
-
$value = $field_data[$name];
|
415 |
-
} else {
|
416 |
-
$value = $default;
|
417 |
-
}
|
418 |
-
|
419 |
-
ninja_forms_edit_field_el_output( $field_id, $type, $label, $name, $value, $width, $options, $class, $desc, $label_class );
|
420 |
-
}
|
421 |
-
}
|
422 |
-
|
423 |
-
add_action( 'nf_edit_field_advanced', 'nf_test', 10, 2 );
|
424 |
-
|
425 |
-
$settings_sections = apply_filters( 'nf_edit_field_settings_sections', array(
|
426 |
-
'restrictions' => __( 'Restriction Settings', 'ninja-forms' ),
|
427 |
-
'calculations' => __( 'Calculation Settings', 'ninja-forms' ),
|
428 |
-
'advanced' => __( 'Advanced Settings', 'ninja-forms' ),
|
429 |
-
) );
|
430 |
-
|
431 |
-
foreach ( $settings_sections as $key => $name ) {
|
432 |
-
?>
|
433 |
-
<div class="nf-field-settings description-wide description">
|
434 |
-
<div class="title">
|
435 |
-
<?php echo $name; ?><span class="dashicons dashicons-arrow-down nf-field-sub-section-toggle"></span>
|
436 |
-
</div>
|
437 |
-
<div class="inside" style="display:none;">
|
438 |
-
<?php
|
439 |
-
if ( ! empty ( $edit_settings[ $key ] ) ) {
|
440 |
-
foreach ( $edit_settings[ $key ] as $opt ) {
|
441 |
-
$type = $opt['type'];
|
442 |
-
|
443 |
-
$label_class = '';
|
444 |
-
|
445 |
-
if ( isset( $opt['label'] ) ) {
|
446 |
-
$label = $opt['label'];
|
447 |
-
} else {
|
448 |
-
$label = '';
|
449 |
-
}
|
450 |
-
|
451 |
-
if ( isset( $opt['name'] ) ) {
|
452 |
-
$name = $opt['name'];
|
453 |
-
} else {
|
454 |
-
$name = '';
|
455 |
-
}
|
456 |
-
|
457 |
-
if ( isset( $opt['width'] ) ) {
|
458 |
-
$width = $opt['width'];
|
459 |
-
} else {
|
460 |
-
$width = '';
|
461 |
-
}
|
462 |
-
|
463 |
-
if ( isset( $opt['options'] ) ) {
|
464 |
-
$options = $opt['options'];
|
465 |
-
} else {
|
466 |
-
$options = '';
|
467 |
-
}
|
468 |
-
|
469 |
-
if ( isset( $opt['class'] ) ) {
|
470 |
-
$class = $opt['class'];
|
471 |
-
} else {
|
472 |
-
$class = '';
|
473 |
-
}
|
474 |
-
|
475 |
-
if ( isset( $opt['default'] ) ) {
|
476 |
-
$default = $opt['default'];
|
477 |
-
} else {
|
478 |
-
$default = '';
|
479 |
-
}
|
480 |
-
|
481 |
-
if ( isset( $opt['desc'] ) ) {
|
482 |
-
$desc = $opt['desc'];
|
483 |
-
} else {
|
484 |
-
$desc = '';
|
485 |
-
}
|
486 |
-
|
487 |
-
if ( isset( $field_data[$name] ) ) {
|
488 |
-
$value = $field_data[$name];
|
489 |
-
} else {
|
490 |
-
$value = $default;
|
491 |
-
}
|
492 |
-
|
493 |
-
ninja_forms_edit_field_el_output( $field_id, $type, $label, $name, $value, $width, $options, $class, $desc, $label_class );
|
494 |
-
}
|
495 |
-
}
|
496 |
-
|
497 |
-
do_action( 'nf_edit_field_' . $key, $field_id, $field_data );
|
498 |
-
?>
|
499 |
-
</div>
|
500 |
-
</div>
|
501 |
-
<?php
|
502 |
-
}
|
503 |
-
|
504 |
-
?>
|
505 |
-
<div class="menu-item-actions description-wide submitbox">
|
506 |
-
<a class="submitdelete deletion nf-remove-field" id="ninja_forms_field_<?php echo $field_id;?>_remove" data-field="<?php echo $field_id; ?>" href="#"><?php _e('Remove', 'ninja-forms'); ?></a>
|
507 |
-
</div>
|
508 |
-
<?php
|
509 |
-
|
510 |
-
if ( ! empty ( $nf_rte_editors ) && isset ( $editors ) && is_object( $editors ) ) {
|
511 |
-
$editors->output_js( $field_id, $nf_rte_editors );
|
512 |
-
}
|
513 |
-
|
514 |
-
}
|
515 |
-
|
516 |
-
function nf_test( $field_id, $field_data ) {
|
517 |
-
do_action( 'ninja_forms_edit_field_after_registered', $field_id, $field_data );
|
518 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/admin/edit-field/list-terms.php
DELETED
@@ -1,72 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
/*
|
3 |
-
*
|
4 |
-
* Function to add a dropdown of terms to the list field.
|
5 |
-
*
|
6 |
-
* @since 2.2.51
|
7 |
-
* @returns void
|
8 |
-
*/
|
9 |
-
|
10 |
-
// Make sure that this function isn't already defined.
|
11 |
-
if ( !function_exists ( 'ninja_forms_edit_field_list_term' ) ) {
|
12 |
-
function ninja_forms_edit_field_list_term( $field_id, $field_data ){
|
13 |
-
$add_field = apply_filters( 'ninja_forms_use_post_fields', false );
|
14 |
-
if ( !$add_field )
|
15 |
-
return false;
|
16 |
-
|
17 |
-
$field_row = ninja_forms_get_field_by_id( $field_id );
|
18 |
-
$field_type = $field_row['type'];
|
19 |
-
|
20 |
-
if( isset( $field_data['populate_term'] ) ){
|
21 |
-
$populate_term = $field_data['populate_term'];
|
22 |
-
}else{
|
23 |
-
$populate_term = '';
|
24 |
-
}
|
25 |
-
|
26 |
-
if ( $populate_term != '' ) {
|
27 |
-
$display = '';
|
28 |
-
} else {
|
29 |
-
$display = 'style="display:none;"';
|
30 |
-
}
|
31 |
-
|
32 |
-
$form_row = ninja_forms_get_form_by_field_id( $field_id );
|
33 |
-
|
34 |
-
if( isset( $form_row['data']['post_type'] ) ){
|
35 |
-
$post_type = $form_row['data']['post_type'];
|
36 |
-
}else{
|
37 |
-
$post_type = '';
|
38 |
-
}
|
39 |
-
|
40 |
-
if( $field_type == '_list' AND $post_type != '' ){
|
41 |
-
?>
|
42 |
-
<div>
|
43 |
-
<hr>
|
44 |
-
<label>
|
45 |
-
<?php _e( 'Populate this with the taxonomy', 'ninja-forms' );?>:
|
46 |
-
</label>
|
47 |
-
<select name="ninja_forms_field_<?php echo $field_id;?>[populate_term]" class="ninja-forms-list-populate-term" rel="<?php echo $field_id;?>">
|
48 |
-
<option value=""><?php _e( '- None', 'ninja-forms' );?></option>
|
49 |
-
<?php
|
50 |
-
// Get a list of terms registered to the post type set above and loop through them.
|
51 |
-
foreach ( get_object_taxonomies( $post_type ) as $tax_name ) {
|
52 |
-
if( $tax_name != 'post_tag' AND $tax_name != 'post_status' AND $tax_name != 'post_format' ){
|
53 |
-
$tax = get_taxonomy( $tax_name );
|
54 |
-
?>
|
55 |
-
<option value="<?php echo $tax_name;?>" <?php selected( $populate_term, $tax_name );?>><?php echo $tax->labels->name;?></option>
|
56 |
-
<?php
|
57 |
-
}
|
58 |
-
}
|
59 |
-
?>
|
60 |
-
</select>
|
61 |
-
<div id="ninja_forms_field_<?php echo $field_id;?>_exclude_terms" <?php echo $display;?>>
|
62 |
-
<?php ninja_forms_list_terms_checkboxes( $field_id, $populate_term ); ?>
|
63 |
-
</div>
|
64 |
-
<br />
|
65 |
-
<hr>
|
66 |
-
</div>
|
67 |
-
<?php
|
68 |
-
}
|
69 |
-
}
|
70 |
-
|
71 |
-
add_action( 'ninja_forms_edit_field_after_registered', 'ninja_forms_edit_field_list_term', 9, 2 );
|
72 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/admin/edit-field/placeholder.php
DELETED
@@ -1,21 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
add_action('init', 'ninja_forms_register_edit_field_placeholder');
|
3 |
-
function ninja_forms_register_edit_field_placeholder(){
|
4 |
-
add_action('ninja_forms_edit_field_before_registered', 'ninja_forms_edit_field_placeholder', 10);
|
5 |
-
}
|
6 |
-
function ninja_forms_edit_field_placeholder($field_id){
|
7 |
-
global $ninja_forms_fields;
|
8 |
-
$field_row = ninja_forms_get_field_by_id($field_id);
|
9 |
-
$field_type = $field_row['type'];
|
10 |
-
$field_data = $field_row['data'];
|
11 |
-
$reg_field = $ninja_forms_fields[$field_type];
|
12 |
-
$edit_placeholder = $reg_field['edit_placeholder'];
|
13 |
-
if($edit_placeholder){
|
14 |
-
if(isset($field_data['placeholder'])){
|
15 |
-
$placeholder = stripslashes($field_data['placeholder']);
|
16 |
-
}else{
|
17 |
-
$placeholder = '';
|
18 |
-
}
|
19 |
-
ninja_forms_edit_field_el_output($field_id, 'text', __( 'Placeholder', 'ninja-forms' ), 'placeholder', $placeholder, 'wide', '', 'widefat ninja-forms-field-label');
|
20 |
-
}
|
21 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/admin/edit-field/post-meta-values.php
DELETED
@@ -1,96 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
/*
|
3 |
-
function ninja_forms_post_meta_value_box( $field_id ){
|
4 |
-
global $wpdb, $ninja_forms_fields;
|
5 |
-
|
6 |
-
$add_field = apply_filters( 'ninja_forms_use_post_fields', false );
|
7 |
-
if ( !$add_field )
|
8 |
-
return false;
|
9 |
-
|
10 |
-
|
11 |
-
$field_row = ninja_forms_get_field_by_id($field_id);
|
12 |
-
$field_type = $field_row['type'];
|
13 |
-
$field_data = $field_row['data'];
|
14 |
-
$reg_field = $ninja_forms_fields[$field_type];
|
15 |
-
$field_process = $reg_field['process_field'];
|
16 |
-
|
17 |
-
$form_row = ninja_forms_get_form_by_field_id( $field_id );
|
18 |
-
if ( isset ( $form_row['data']['create_post'] ) AND $form_row['data']['create_post'] == 1 ) {
|
19 |
-
if( isset( $field_data['post_meta_value'] ) ){
|
20 |
-
$post_meta_value = $field_data['post_meta_value'];
|
21 |
-
}else{
|
22 |
-
$post_meta_value = '';
|
23 |
-
}
|
24 |
-
|
25 |
-
if( $field_process ){
|
26 |
-
$meta_keys = $wpdb->get_results( "SELECT meta_key FROM $wpdb->postmeta", ARRAY_A );
|
27 |
-
$meta_array = array();
|
28 |
-
foreach( $meta_keys as $key ){
|
29 |
-
$first_char = substr( $key['meta_key'], 0, 1 );
|
30 |
-
if( $first_char != '_' ){
|
31 |
-
array_push( $meta_array, $key['meta_key'] );
|
32 |
-
}
|
33 |
-
}
|
34 |
-
$meta_array = array_unique( $meta_array );
|
35 |
-
|
36 |
-
?>
|
37 |
-
<div class=" description description-wide" id="ninja_forms_post_meta_values">
|
38 |
-
<label class="label">
|
39 |
-
<?php _e( 'Attach this value to custom post meta', 'ninja-forms' );?>:
|
40 |
-
</label><br />
|
41 |
-
<?php
|
42 |
-
if( is_array( $meta_array ) AND !empty( $meta_array ) ){
|
43 |
-
$custom = true;
|
44 |
-
if( $post_meta_value != '' ){
|
45 |
-
foreach( $meta_array as $meta ){
|
46 |
-
if( $post_meta_value == $meta ){
|
47 |
-
$custom = false;
|
48 |
-
}
|
49 |
-
}
|
50 |
-
}
|
51 |
-
if( $post_meta_value == '' ){
|
52 |
-
$custom = false;
|
53 |
-
}
|
54 |
-
}
|
55 |
-
?>
|
56 |
-
<select name="" id="ninja_forms_field_<?php echo $field_id;?>_post_meta_value" class="ninja-forms-post-meta-value">
|
57 |
-
<option value="">- None</option>
|
58 |
-
<option value="custom" <?php selected($custom, true);?>>- Custom -></option>
|
59 |
-
<?php
|
60 |
-
if( is_array( $meta_array ) AND !empty( $meta_array ) ){
|
61 |
-
$custom = true;
|
62 |
-
if( $post_meta_value != '' ){
|
63 |
-
foreach( $meta_array as $meta ){
|
64 |
-
if( $post_meta_value == $meta ){
|
65 |
-
$custom = false;
|
66 |
-
}
|
67 |
-
}
|
68 |
-
}
|
69 |
-
if( $post_meta_value == '' ){
|
70 |
-
$custom = false;
|
71 |
-
}
|
72 |
-
|
73 |
-
foreach( $meta_array as $meta ){
|
74 |
-
?>
|
75 |
-
<option value="<?php echo $meta;?>" <?php selected( $post_meta_value, $meta );?>><?php echo $meta;?></option>
|
76 |
-
<?php
|
77 |
-
}
|
78 |
-
}
|
79 |
-
?>
|
80 |
-
</select>
|
81 |
-
<?php
|
82 |
-
if( $custom ){
|
83 |
-
$display_input = '';
|
84 |
-
}else{
|
85 |
-
$display_input = 'display:none;';
|
86 |
-
}
|
87 |
-
?>
|
88 |
-
<input type="text" name="ninja_forms_field_<?php echo $field_id;?>[post_meta_value]" id="ninja_forms_field_<?php echo $field_id;?>_custom_post_meta_value" value="<?php echo $post_meta_value;?>" style="<?php echo $display_input;?> width:350px">
|
89 |
-
</div>
|
90 |
-
<?php
|
91 |
-
}
|
92 |
-
}
|
93 |
-
}
|
94 |
-
|
95 |
-
add_action( 'ninja_forms_edit_field_after_registered', 'ninja_forms_post_meta_value_box' );
|
96 |
-
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/admin/edit-field/remove-button.php
DELETED
@@ -1,20 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
function ninja_forms_edit_field_remove_button( $field_id ){
|
3 |
-
global $ninja_forms_fields;
|
4 |
-
|
5 |
-
$field_row = ninja_forms_get_field_by_id($field_id);
|
6 |
-
$field_type = $field_row['type'];
|
7 |
-
$reg_field = $ninja_forms_fields[$field_type];
|
8 |
-
$show_remove = $reg_field['show_remove'];
|
9 |
-
|
10 |
-
if ( $show_remove ) {
|
11 |
-
?>
|
12 |
-
<div class="menu-item-actions description-wide submitbox">
|
13 |
-
<a class="submitdelete deletion nf-remove-field" id="ninja_forms_field_<?php echo $field_id;?>_remove" data-field="<?php echo $field_id; ?>" href="#"><?php _e('Remove', 'ninja-forms'); ?></a>
|
14 |
-
</div>
|
15 |
-
<?php
|
16 |
-
}
|
17 |
-
|
18 |
-
}
|
19 |
-
|
20 |
-
// add_action( 'ninja_forms_edit_field_after_registered', 'ninja_forms_edit_field_remove_button', 99999 );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/admin/edit-field/req.php
DELETED
@@ -1,39 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
add_action('init', 'ninja_forms_register_edit_field_required');
|
3 |
-
function ninja_forms_register_edit_field_required(){
|
4 |
-
add_action('nf_edit_field_restrictions', 'ninja_forms_field_required', 9, 2 );
|
5 |
-
}
|
6 |
-
|
7 |
-
function ninja_forms_field_required( $field_id, $field_data ) {
|
8 |
-
global $ninja_forms_fields;
|
9 |
-
$field_row = ninja_forms_get_field_by_id($field_id);
|
10 |
-
$field_type = $field_row['type'];
|
11 |
-
$reg_field = $ninja_forms_fields[$field_type];
|
12 |
-
$edit_req = $reg_field['edit_req'];
|
13 |
-
|
14 |
-
if($edit_req){
|
15 |
-
if(isset($field_data['req'])){
|
16 |
-
$req = $field_data['req'];
|
17 |
-
}else{
|
18 |
-
$req = '';
|
19 |
-
}
|
20 |
-
|
21 |
-
ninja_forms_edit_field_el_output($field_id, 'checkbox', __( 'Required', 'ninja-forms' ), 'req', $req, 'wide' );
|
22 |
-
}
|
23 |
-
|
24 |
-
}
|
25 |
-
|
26 |
-
function nf_edit_field_req( $field_id, $field_data ) {
|
27 |
-
global $ninja_forms_fields;
|
28 |
-
|
29 |
-
$field_row = ninja_forms_get_field_by_id($field_id);
|
30 |
-
$field_type = $field_row['type'];
|
31 |
-
$reg_field = $ninja_forms_fields[$field_type];
|
32 |
-
$field_req = $reg_field['req'];
|
33 |
-
|
34 |
-
if ( $field_req ) {
|
35 |
-
ninja_forms_edit_field_el_output($field_id, 'hidden', '', 'req', 1);
|
36 |
-
}
|
37 |
-
}
|
38 |
-
|
39 |
-
add_action( 'ninja_forms_edit_field_before_registered', 'nf_edit_field_req', 10, 2 );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/admin/edit-field/save-button.php
DELETED
@@ -1,7 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
//add_action( 'ninja_forms_edit_field_before_ul', 'ninja_forms_edit_field_save_button' );
|
3 |
-
function ninja_forms_edit_field_save_button( $form_id ){
|
4 |
-
?>
|
5 |
-
<input class="button-primary menu-save ninja-forms-save-data" id="ninja_forms_save_data_top" type="submit" value="<?php _e('Save Field Settings', 'ninja-forms'); ?>" />
|
6 |
-
<?php
|
7 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/admin/edit-field/sub-settings.php
DELETED
@@ -1,76 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
|
3 |
-
/*
|
4 |
-
*
|
5 |
-
* Function used to output the submission sorting option on the backend.
|
6 |
-
*
|
7 |
-
* @since 2.9
|
8 |
-
* @returns void
|
9 |
-
*/
|
10 |
-
|
11 |
-
function nf_edit_field_sort_numeric( $field_id, $field_data ) {
|
12 |
-
global $ninja_forms_fields;
|
13 |
-
|
14 |
-
$field_row = ninja_forms_get_field_by_id( $field_id );
|
15 |
-
$field_type = $field_row['type'];
|
16 |
-
|
17 |
-
if ( $ninja_forms_fields[$field_type]['process_field'] && $field_type != '_calc' ) {
|
18 |
-
if ( isset ( $field_data['admin_label'] ) ) {
|
19 |
-
$admin_label = $field_data['admin_label'];
|
20 |
-
} else {
|
21 |
-
$admin_label = '';
|
22 |
-
}
|
23 |
-
if ( isset ( $field_data['num_sort'] ) ) {
|
24 |
-
$num_sort = $field_data['num_sort'];
|
25 |
-
} else {
|
26 |
-
$num_sort = '';
|
27 |
-
}
|
28 |
-
?>
|
29 |
-
<div class="description description-wide">
|
30 |
-
<?php
|
31 |
-
ninja_forms_edit_field_el_output( $field_id, 'checkbox', __( 'Sort as numeric', 'ninja-forms' ), 'num_sort', $num_sort, 'wide', '', '', __( 'If this box is checked, this column in the submissions table will sort by number.', 'ninja-forms' ) );
|
32 |
-
?>
|
33 |
-
</div>
|
34 |
-
<?php
|
35 |
-
}
|
36 |
-
}
|
37 |
-
|
38 |
-
add_action( 'nf_edit_field_advanced', 'nf_edit_field_sort_numeric', 9, 2 );
|
39 |
-
|
40 |
-
/*
|
41 |
-
*
|
42 |
-
* Function used to output our admin label option on the backend.
|
43 |
-
*
|
44 |
-
* @since 2.9
|
45 |
-
* @returns void
|
46 |
-
*/
|
47 |
-
|
48 |
-
function nf_edit_field_admin_label( $field_id, $field_data ) {
|
49 |
-
global $ninja_forms_fields;
|
50 |
-
|
51 |
-
$field_row = ninja_forms_get_field_by_id( $field_id );
|
52 |
-
$field_type = $field_row['type'];
|
53 |
-
|
54 |
-
if ( $ninja_forms_fields[$field_type]['process_field'] ) {
|
55 |
-
if ( isset ( $field_data['admin_label'] ) ) {
|
56 |
-
$admin_label = $field_data['admin_label'];
|
57 |
-
} else {
|
58 |
-
$admin_label = '';
|
59 |
-
}
|
60 |
-
if ( isset ( $field_data['num_sort'] ) ) {
|
61 |
-
$num_sort = $field_data['num_sort'];
|
62 |
-
} else {
|
63 |
-
$num_sort = '';
|
64 |
-
}
|
65 |
-
?>
|
66 |
-
<div class="description description-wide">
|
67 |
-
<?php
|
68 |
-
ninja_forms_edit_field_el_output( $field_id, 'text', __( 'Admin Label', 'ninja-forms' ), 'admin_label', $admin_label, 'wide', '', 'widefat code', __( 'This is the label used when viewing/editing/exporting submissions.', 'ninja-forms' ) );
|
69 |
-
?>
|
70 |
-
</div>
|
71 |
-
<?php
|
72 |
-
}
|
73 |
-
}
|
74 |
-
|
75 |
-
add_action( 'nf_edit_field_advanced', 'nf_edit_field_admin_label', 10, 2 );
|
76 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/admin/edit-field/user-info-fields.php
DELETED
@@ -1,56 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
|
3 |
-
/*
|
4 |
-
*
|
5 |
-
* Function that adds the address group dropdown to the user information field items.
|
6 |
-
*
|
7 |
-
* @since 2.2.37
|
8 |
-
* @returns void
|
9 |
-
*/
|
10 |
-
|
11 |
-
function ninja_forms_user_info_fields_groups( $field_id, $field_data ){
|
12 |
-
global $ninja_forms_fields;
|
13 |
-
$field = ninja_forms_get_field_by_id( $field_id );
|
14 |
-
$field_type = $field['type'];
|
15 |
-
$default_user_info = 0;
|
16 |
-
if ( isset ( $ninja_forms_fields[$field_type]['edit_options'] ) and is_array( $ninja_forms_fields[$field_type]['edit_options'] ) ) {
|
17 |
-
foreach ( $ninja_forms_fields[$field_type]['edit_options'] as $option ) {
|
18 |
-
if ( isset ( $option['name'] ) and $option['name'] == 'user_info_field_group' and isset ( $option['default'] ) ) {
|
19 |
-
$default_user_info = $option['default'];
|
20 |
-
break;
|
21 |
-
}
|
22 |
-
}
|
23 |
-
}
|
24 |
-
|
25 |
-
if ( ( isset ( $field_data['user_info_field_group'] ) AND $field_data['user_info_field_group'] == 1 ) or ( ( !isset ( $field_data['user_info_field_group'] ) or $field_data['user_info_field_group'] !== 0 ) and $default_user_info == 1 ) ) {
|
26 |
-
$options = array(
|
27 |
-
array( 'name' => '- '.__( 'None', 'ninja-forms' ), 'value' => '' ),
|
28 |
-
array( 'name' => __( 'Billing', 'ninja-forms' ), 'value' => 'billing' ),
|
29 |
-
array( 'name' => __( 'Shipping', 'ninja-forms' ), 'value' => 'shipping' ),
|
30 |
-
array( 'name' => __( 'Custom', 'ninja-forms' ).' ->', 'value' => 'custom' ),
|
31 |
-
);
|
32 |
-
|
33 |
-
if ( isset ( $field_data['user_info_field_group_name'] ) ) {
|
34 |
-
$group_name = $field_data['user_info_field_group_name'];
|
35 |
-
} else {
|
36 |
-
$group_name = '';
|
37 |
-
}
|
38 |
-
|
39 |
-
if ( isset ( $field_data['user_info_field_group_custom'] ) ) {
|
40 |
-
$group_custom = $field_data['user_info_field_group_custom'];
|
41 |
-
} else {
|
42 |
-
$group_custom = '';
|
43 |
-
}
|
44 |
-
|
45 |
-
if ( $group_name == 'custom' ) {
|
46 |
-
$custom_class = '';
|
47 |
-
} else {
|
48 |
-
$custom_class = 'hidden';
|
49 |
-
}
|
50 |
-
|
51 |
-
ninja_forms_edit_field_el_output( $field_id, 'select', __( 'User Info Field Group', 'ninja-forms' ), 'user_info_field_group_name', $group_name, 'thin', $options, 'user-info-group-name widefat' );
|
52 |
-
ninja_forms_edit_field_el_output( $field_id, 'text', __( 'Custom Field Group', 'ninja-forms' ), 'user_info_field_group_custom', $group_custom, 'thin', '', 'user-info-custom-group widefat '.$custom_class, '', $custom_class );
|
53 |
-
}
|
54 |
-
}
|
55 |
-
|
56 |
-
add_action( 'ninja_forms_edit_field_after_registered', 'ninja_forms_user_info_fields_groups', 10, 2 );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/admin/form-preview.php
DELETED
@@ -1,46 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
|
3 |
-
add_action( 'init', 'ninja_forms_preview_form' );
|
4 |
-
function ninja_forms_preview_form() {
|
5 |
-
global $ninja_forms_append_page_form_id;
|
6 |
-
if( ! empty ( $_REQUEST['form_id'] ) AND ! empty ( $_REQUEST['preview'] ) ) { //I
|
7 |
-
$form_id = absint( $_REQUEST['form_id'] );
|
8 |
-
$ninja_forms_append_page_form_id = array($form_id);
|
9 |
-
add_filter( 'the_content', 'ninja_forms_append_to_page', 9999 );
|
10 |
-
}
|
11 |
-
}
|
12 |
-
|
13 |
-
function ninja_forms_preview_link( $form_id = '', $echo = true ) {
|
14 |
-
if( $form_id == '' ){
|
15 |
-
if( isset( $_REQUEST['form_id'] ) ){
|
16 |
-
$form_id = absint( $_REQUEST['form_id'] );
|
17 |
-
}else{
|
18 |
-
$form_id = '';
|
19 |
-
}
|
20 |
-
}
|
21 |
-
$base = home_url();
|
22 |
-
|
23 |
-
$form_data = ninja_forms_get_form_by_id( $form_id );
|
24 |
-
|
25 |
-
$append_page = Ninja_Forms()->form( $form_id )->get_setting( 'append_page' );
|
26 |
-
|
27 |
-
if ( empty( $append_page ) ) {
|
28 |
-
$opt = nf_get_settings();
|
29 |
-
if ( isset ( $opt['preview_id'] ) ) {
|
30 |
-
$page_id = $opt['preview_id'];
|
31 |
-
} else {
|
32 |
-
$page_id = '';
|
33 |
-
}
|
34 |
-
} else {
|
35 |
-
$page_id = $append_page;
|
36 |
-
}
|
37 |
-
|
38 |
-
if( $echo ){
|
39 |
-
$preview_link = '<a target="_blank" href="' . $base . '/?page_id=' . $page_id . '&preview=true&form_id=' . $form_id . '">' . __( 'Preview Form', 'ninja-forms' ) . '</a>';
|
40 |
-
}else{
|
41 |
-
$preview_link = $base . '/?page_id=' . $page_id . '&preview=true&form_id=' . $form_id;
|
42 |
-
}
|
43 |
-
|
44 |
-
return $preview_link;
|
45 |
-
|
46 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/admin/index.php
DELETED
@@ -1,2 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
// Silence is golden.
|
|
|
|
deprecated/includes/admin/notices.php
DELETED
@@ -1,119 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Notices page to house all of the admin notices for Core
|
5 |
-
*
|
6 |
-
* Can be simply used be adding another line into the nf_admin_notices() function
|
7 |
-
*
|
8 |
-
* The class NF_Notices in notices-class.php can be extended to create more advanced notices to include triggered events
|
9 |
-
*
|
10 |
-
* @since 2.9
|
11 |
-
*/
|
12 |
-
|
13 |
-
function nf_admin_notices( $notices ) {
|
14 |
-
|
15 |
-
if( ! ninja_forms_three_addons_check() || ( ninja_forms_three_addons_version_check() && ninja_forms_three_addons_check() ) ){
|
16 |
-
|
17 |
-
|
18 |
-
/*
|
19 |
-
* Upgrade Now
|
20 |
-
*/
|
21 |
-
$upgrade_link = admin_url( 'admin.php?page=ninja-forms-three' );
|
22 |
-
$notice = array(
|
23 |
-
'title' => __( 'Upgrade to Ninja Forms THREE', 'ninja-forms' ),
|
24 |
-
'link' => '',
|
25 |
-
'int' => 0,
|
26 |
-
'blacklist' => array( 'ninja-forms', 'ninja-forms-three' ),
|
27 |
-
);
|
28 |
-
if ( ! get_option( 'ninja_forms_has_invalid_addons' ) ) {
|
29 |
-
$notice[ 'msg' ] = sprintf( __( 'You are eligible to upgrade to Ninja Forms THREE! %sUpgrade Now%s', 'ninja-forms' ), '<a target="_blank" href="' . $upgrade_link . '">', '</a>' );
|
30 |
-
} else {
|
31 |
-
if ( ! function_exists( 'get_plugins' ) ) {
|
32 |
-
// Require the core file.
|
33 |
-
require_once ABSPATH . 'wp-admin/includes/plugin.php';
|
34 |
-
}
|
35 |
-
// Get a list of plugins.
|
36 |
-
$plugins = get_plugins();
|
37 |
-
$not_ours = array();
|
38 |
-
// For each plugin...
|
39 |
-
foreach( $plugins as $plugin => $data ){
|
40 |
-
// If this isn't Ninja Forms Core...
|
41 |
-
// AND If it includes a ninja-forms prefix...
|
42 |
-
if ( 'ninja-forms/ninja-forms.php' != $plugin && 0 === strncmp( $plugin, 'ninja-forms-', 12 ) ){
|
43 |
-
// Get the plugin slug.
|
44 |
-
$slug = explode( '/', $plugin );
|
45 |
-
// If the plugin is not active...
|
46 |
-
// Exit early.
|
47 |
-
if ( ! is_plugin_active( $plugin ) ) continue;
|
48 |
-
// If the plugin is not in our list...
|
49 |
-
if ( ! ninja_forms_valid_slug( $slug[ 0 ] ) ) {
|
50 |
-
// Add it onto our array of data
|
51 |
-
$not_ours[ $plugin ] = $data;
|
52 |
-
}
|
53 |
-
}
|
54 |
-
}
|
55 |
-
$display = sprintf( __( 'You are eligible to upgrade to Ninja Forms THREE! However, the following plugins are not compatible with Ninja Forms THREE and could lead to issues with the upgrade process.%sPlease deactivate and remove the following before attempting to upgrade:%s', 'ninja-forms' ), '<br />', '<br />' );
|
56 |
-
foreach( $not_ours as $plugin ) {
|
57 |
-
$display .= __( $plugin[ 'Name' ], $plugin[ 'TextDomain' ] ) . ', ';
|
58 |
-
}
|
59 |
-
$display = substr( $display, 0, strlen( $display ) - 2 );
|
60 |
-
$notice[ 'msg' ] = $display;
|
61 |
-
$notice[ 'blacklist' ] = array( 'ninja-forms-three' );
|
62 |
-
}
|
63 |
-
$notices['three_upgrade'] = $notice;
|
64 |
-
} else {
|
65 |
-
|
66 |
-
/*
|
67 |
-
* THREE is Coming!
|
68 |
-
*/
|
69 |
-
$three_info = add_query_arg( array( 'nf_admin_notice_ignore' => 'three_info' ) );
|
70 |
-
$three_link = nf_aff_link( 'https://ninjaforms.com/three/?utm_source=Ninja+Forms+Plugin+Deprecated&utm_medium=Dashboard+Banner+Ad+Deprecated' );
|
71 |
-
$notices['three_info'] = array(
|
72 |
-
'title' => __( 'THREE is coming!', 'ninja-forms' ),
|
73 |
-
'msg' => sprintf( __( 'A major update is coming to Ninja Forms. %sLearn more about new features, backwards compatibility, and more Frequently Asked Questions.%s', 'ninja-forms' ), '<a target="_blank" href="' . $three_link . '">', '</a>' ),
|
74 |
-
'link' => '',
|
75 |
-
'int' => 0,
|
76 |
-
'blacklist' => array( 'ninja-forms', 'ninja-forms-three' ),
|
77 |
-
);
|
78 |
-
|
79 |
-
}
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
$one_week_support = add_query_arg( array( 'nf_admin_notice_ignore' => 'one_week_support' ) );
|
84 |
-
$support_link = nf_aff_link( 'https://ninjaforms.com/contact/?utm_source=Ninja+Forms+Plugin+Deprecated&utm_medium=System+Status+Banner+Ad+Deprecated' );
|
85 |
-
$support_docs_link = nf_aff_link( 'http://docs.ninjaforms.com/?utm_source=Ninja+Forms+Plugin+Deprecated&utm_medium=System+Status+Banner+Ad+Deprecated' );
|
86 |
-
$notices['one_week_support'] = array(
|
87 |
-
'title' => __( 'How\'s It Going?', 'ninja-forms' ),
|
88 |
-
'msg' => __( 'Thank you for using Ninja Forms! We hope that you\'ve found everything you need, but if you have any questions:', 'ninja-forms' ),
|
89 |
-
'link' => '<li><span class="dashicons dashicons-media-text"></span><a target="_blank" href="' . $support_docs_link . '">' . __( 'Check out our documentation', 'ninja-forms' ) . '</a></li>
|
90 |
-
<li><span class="dashicons dashicons-sos"></span><a target="_blank" href="' . $support_link . '">' . __( 'Get Some Help' ,'ninja-forms' ) . '</a></li>
|
91 |
-
<li><span class="dashicons dashicons-dismiss"></span><a href="' . $one_week_support . '">' . __( 'Dismiss' ,'ninja-forms' ) . '</a></li>',
|
92 |
-
'int' => 7,
|
93 |
-
'blacklist' => array( 'ninja-forms-three' ),
|
94 |
-
);
|
95 |
-
|
96 |
-
// $two_week_review_ignore = add_query_arg( array( 'nf_admin_notice_ignore' => 'two_week_review' ) );
|
97 |
-
// $two_week_review_temp = add_query_arg( array( 'nf_admin_notice_temp_ignore' => 'two_week_review', 'int' => 14 ) );
|
98 |
-
// $notices['two_week_review'] = array(
|
99 |
-
// 'title' => __( 'Leave A Review?', 'ninja-forms' ),
|
100 |
-
// 'msg' => __( 'We hope you\'ve enjoyed using Ninja Forms! Would you consider leaving us a review on WordPress.org?', 'ninja-forms' ),
|
101 |
-
// 'link' => '<li> <span class="dashicons dashicons-smiley"></span><a href="' . $two_week_review_ignore . '"> ' . __( 'I\'ve already left a review', 'ninja-forms' ) . '</a></li>
|
102 |
-
// <li><span class="dashicons dashicons-calendar-alt"></span><a href="' . $two_week_review_temp . '">' . __( 'Maybe Later' ,'ninja-forms' ) . '</a></li>
|
103 |
-
// <li><span class="dashicons dashicons-external"></span><a href="http://wordpress.org/support/view/plugin-reviews/ninja-forms?filter=5" target="_blank">' . __( 'Sure! I\'d love to!', 'ninja-forms' ) . '</a></li>',
|
104 |
-
// 'int' => 14
|
105 |
-
// );
|
106 |
-
|
107 |
-
|
108 |
-
return $notices;
|
109 |
-
}
|
110 |
-
// This function is used to hold all of the basic notices
|
111 |
-
// Date format accepts most formats but can get confused so preferred methods are m/d/Y or d-m-Y
|
112 |
-
|
113 |
-
add_filter( 'nf_admin_notices', 'nf_admin_notices' );
|
114 |
-
|
115 |
-
// Require any files that contain class extensions for NF_Notices
|
116 |
-
require_once( NF_PLUGIN_DIR . 'classes/notices-multipart.php' );
|
117 |
-
|
118 |
-
// Require any files that contain class extensions for NF_Notices
|
119 |
-
require_once( NF_PLUGIN_DIR . 'classes/notices-save-progress.php' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/admin/output-tab-metabox.php
DELETED
@@ -1,434 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
function ninja_forms_output_tab_metabox($form_id = '', $slug, $metabox){
|
3 |
-
$plugin_settings = nf_get_settings();
|
4 |
-
if($form_id != ''){
|
5 |
-
$current_settings = Ninja_Forms()->form($form_id)->get_all_settings();
|
6 |
-
}else{
|
7 |
-
$form_id = '';
|
8 |
-
$current_settings = nf_get_settings();
|
9 |
-
}
|
10 |
-
|
11 |
-
$page = $metabox['page'];
|
12 |
-
$tab = $metabox['tab'];
|
13 |
-
|
14 |
-
$title = $metabox['title'];
|
15 |
-
if(isset($metabox['settings'])){
|
16 |
-
$settings = $metabox['settings'];
|
17 |
-
}else{
|
18 |
-
$settings = '';
|
19 |
-
}
|
20 |
-
|
21 |
-
if(isset($metabox['display_function'])){
|
22 |
-
$display_function = $metabox['display_function'];
|
23 |
-
}else{
|
24 |
-
$display_function = '';
|
25 |
-
}
|
26 |
-
|
27 |
-
if($metabox['state'] == 'closed'){
|
28 |
-
$state = 'display:none;';
|
29 |
-
}else{
|
30 |
-
$state = '';
|
31 |
-
}
|
32 |
-
|
33 |
-
if( isset( $plugin_settings['metabox_state'][$page][$tab][$slug] ) ){
|
34 |
-
$state = $plugin_settings['metabox_state'][$page][$tab][$slug];
|
35 |
-
}
|
36 |
-
|
37 |
-
if( isset( $metabox['display_container'] ) ){
|
38 |
-
$display_container = $metabox['display_container'];
|
39 |
-
}else{
|
40 |
-
$display_container = true;
|
41 |
-
}
|
42 |
-
|
43 |
-
if( $display_container ){
|
44 |
-
?>
|
45 |
-
<div id="ninja_forms_metabox_<?php echo $slug;?>" class="postbox ">
|
46 |
-
<span class="item-controls">
|
47 |
-
<a class="item-edit metabox-item-edit" id="edit_id" title="<?php _e( 'Edit Menu Item', 'ninja-forms' ); ?>" href="#"><?php _e( 'Edit Menu Item', 'ninja-forms' ); ?></a>
|
48 |
-
</span>
|
49 |
-
<h3 class="hndle"><span><?php _e($title, 'ninja-forms');?></span></h3>
|
50 |
-
<div class="inside" style="<?php echo $state;?>">
|
51 |
-
<table class="form-table">
|
52 |
-
<tbody>
|
53 |
-
<?php
|
54 |
-
}
|
55 |
-
|
56 |
-
if( is_array( $settings ) AND !empty( $settings ) ){
|
57 |
-
foreach( $settings as $s ){
|
58 |
-
|
59 |
-
$value = '';
|
60 |
-
if(isset($s['name'])){
|
61 |
-
$name = $s['name'];
|
62 |
-
}else{
|
63 |
-
$name = '';
|
64 |
-
}
|
65 |
-
$name_array = '';
|
66 |
-
if( strpos( $name, '[') !== false ){
|
67 |
-
$name_array = str_replace( ']', '', $name );
|
68 |
-
$name_array = explode( '[', $name_array );
|
69 |
-
}
|
70 |
-
if(isset($s['type'])){
|
71 |
-
$type = $s['type'];
|
72 |
-
}else{
|
73 |
-
$type = '';
|
74 |
-
}
|
75 |
-
if(isset($s['desc'])){
|
76 |
-
$desc = $s['desc'];
|
77 |
-
}else{
|
78 |
-
$desc = '';
|
79 |
-
}
|
80 |
-
if(isset($s['help_text'])){
|
81 |
-
$help_text = $s['help_text'];
|
82 |
-
}else{
|
83 |
-
$help_text = '';
|
84 |
-
}
|
85 |
-
if(isset($s['label'])){
|
86 |
-
$label = $s['label'];
|
87 |
-
}else{
|
88 |
-
$label = '';
|
89 |
-
}
|
90 |
-
if(isset($s['value'])){
|
91 |
-
$button_text = $s['value'];
|
92 |
-
}else{
|
93 |
-
$button_text = $label;
|
94 |
-
}
|
95 |
-
if(isset($s['class'])){
|
96 |
-
$class = $s['class'];
|
97 |
-
}else{
|
98 |
-
$class = 'widefat';
|
99 |
-
}
|
100 |
-
if(isset($s['tr_class'])){
|
101 |
-
$tr_class = $s['tr_class'];
|
102 |
-
}else{
|
103 |
-
$tr_class = '';
|
104 |
-
}
|
105 |
-
if(isset($s['max_file_size'])){
|
106 |
-
$max_file_size = $s['max_file_size'];
|
107 |
-
}else{
|
108 |
-
$max_file_size = '';
|
109 |
-
}
|
110 |
-
if(isset($s['select_all'])){
|
111 |
-
$select_all = $s['select_all'];
|
112 |
-
}else{
|
113 |
-
$select_all = false;
|
114 |
-
}
|
115 |
-
if(isset($s['default_value'])){
|
116 |
-
$default_value = $s['default_value'];
|
117 |
-
}else{
|
118 |
-
$default_value = '';
|
119 |
-
}
|
120 |
-
if( isset( $s['style'] ) ){
|
121 |
-
$style = $s['style'];
|
122 |
-
}else{
|
123 |
-
$style = '';
|
124 |
-
}
|
125 |
-
if(isset($s['size'])){
|
126 |
-
$size = $s['size'];
|
127 |
-
}else{
|
128 |
-
$size = '';
|
129 |
-
}
|
130 |
-
if(isset($s['min'])){
|
131 |
-
$min = $s['min'];
|
132 |
-
}else{
|
133 |
-
$min = 0;
|
134 |
-
}
|
135 |
-
if(isset($s['max'])){
|
136 |
-
$max = $s['max'];
|
137 |
-
}else{
|
138 |
-
$max = '';
|
139 |
-
}
|
140 |
-
|
141 |
-
if( is_array( $name_array ) ){
|
142 |
-
$tmp = '';
|
143 |
-
foreach( $name_array as $n ){
|
144 |
-
if( $tmp == '' ){
|
145 |
-
if( isset( $current_settings[$n] ) ){
|
146 |
-
$tmp = $current_settings[$n];
|
147 |
-
}
|
148 |
-
}else{
|
149 |
-
if( isset( $tmp[$n] ) ){
|
150 |
-
$tmp = $tmp[$n];
|
151 |
-
}
|
152 |
-
}
|
153 |
-
}
|
154 |
-
$value = (!is_array ($tmp) && !is_object ($tmp)) ? $tmp : '';
|
155 |
-
}else{
|
156 |
-
if(isset($current_settings[$name])){
|
157 |
-
if(is_array($current_settings[$name])){
|
158 |
-
$value = ninja_forms_stripslashes_deep($current_settings[$name]);
|
159 |
-
}else{
|
160 |
-
$value = stripslashes($current_settings[$name]);
|
161 |
-
}
|
162 |
-
}else{
|
163 |
-
$value = '';
|
164 |
-
}
|
165 |
-
}
|
166 |
-
|
167 |
-
if( $value == '' ){
|
168 |
-
$value = $default_value;
|
169 |
-
}
|
170 |
-
?>
|
171 |
-
|
172 |
-
<tr id="row_<?php echo $name;?>" <?php if( $tr_class != '' ){ ?>class="<?php echo $tr_class;?>"<?php } ?> <?php if( $style != '' ){ ?> style="<?php echo $style;?>"<?php }?>>
|
173 |
-
<?php if ( $s['type'] == 'desc' AND ! $label ) { ?>
|
174 |
-
<td colspan="2">
|
175 |
-
<?php } else { ?>
|
176 |
-
<th scope="row">
|
177 |
-
<label for="<?php echo $name;?>"><?php echo $label;?></label>
|
178 |
-
</th>
|
179 |
-
<td>
|
180 |
-
<?php } ?>
|
181 |
-
<?php
|
182 |
-
switch( $s['type'] ){
|
183 |
-
case 'text':
|
184 |
-
$value = ninja_forms_esc_html_deep( $value );
|
185 |
-
?>
|
186 |
-
|
187 |
-
<input type="text" class="code <?php echo $class;?>" name="<?php echo $name;?>" id="<?php echo $name;?>" value="<?php echo $value;?>" />
|
188 |
-
<?php if( $help_text != ''){ ?>
|
189 |
-
<a href="#" class="tooltip">
|
190 |
-
<img id="" class='ninja-forms-help-text' src="<?php echo NINJA_FORMS_URL;?>images/question-ico.gif" title="">
|
191 |
-
<span>
|
192 |
-
<img class="callout" src="<?php echo NINJA_FORMS_URL;?>/images/callout.gif" />
|
193 |
-
<?php echo $help_text;?>
|
194 |
-
</span>
|
195 |
-
</a>
|
196 |
-
<?php }
|
197 |
-
break;
|
198 |
-
case 'number':
|
199 |
-
$value = ninja_forms_esc_html_deep( $value );
|
200 |
-
?>
|
201 |
-
|
202 |
-
<input type="number" class="code <?php echo $class;?>" name="<?php echo $name;?>" id="<?php echo $name;?>" value="<?php echo $value;?>" min="<?php echo $min; ?>" max="<?php echo $max; ?>" />
|
203 |
-
<?php if( $help_text != ''){ ?>
|
204 |
-
<a href="#" class="tooltip">
|
205 |
-
<img id="" class='ninja-forms-help-text' src="<?php echo NINJA_FORMS_URL;?>images/question-ico.gif" title="">
|
206 |
-
<span>
|
207 |
-
<img class="callout" src="<?php echo NINJA_FORMS_URL;?>/images/callout.gif" />
|
208 |
-
<?php echo $help_text;?>
|
209 |
-
</span>
|
210 |
-
</a>
|
211 |
-
<?php }
|
212 |
-
break;
|
213 |
-
case 'select':
|
214 |
-
?>
|
215 |
-
<select name="<?php echo $name;?>" id="<?php echo $name;?>" class="<?php echo $class;?>">
|
216 |
-
<?php
|
217 |
-
if( is_array( $s['options']) AND !empty( $s['options'] ) ){
|
218 |
-
foreach( $s['options'] as $option ){
|
219 |
-
?>
|
220 |
-
<option value="<?php echo $option['value'];?>" <?php selected($value, $option['value']); ?>><?php echo $option['name'];?></option>
|
221 |
-
<?php
|
222 |
-
}
|
223 |
-
} ?>
|
224 |
-
</select>
|
225 |
-
<?php if( $help_text != ''){ ?>
|
226 |
-
<a href="#" class="tooltip">
|
227 |
-
<img id="" class='ninja-forms-help-text' src="<?php echo NINJA_FORMS_URL;?>images/question-ico.gif" title="">
|
228 |
-
<span>
|
229 |
-
<img class="callout" src="<?php echo NINJA_FORMS_URL;?>images/callout.gif" />
|
230 |
-
<?php echo $help_text;?>
|
231 |
-
</span>
|
232 |
-
</a>
|
233 |
-
<?php }
|
234 |
-
break;
|
235 |
-
case 'multi_select':
|
236 |
-
if( $value == '' ){
|
237 |
-
$value = array();
|
238 |
-
}
|
239 |
-
?>
|
240 |
-
|
241 |
-
<input type="hidden" name="<?php echo $name;?>" value="">
|
242 |
-
<select name="<?php echo $name;?>[]" id="<?php echo $name;?>" class="<?php echo $class;?>" multiple="multiple" size="<?php echo $size;?>">
|
243 |
-
<?php
|
244 |
-
if( is_array( $s['options']) AND !empty( $s['options'] ) ){
|
245 |
-
foreach( $s['options'] as $option ){
|
246 |
-
?>
|
247 |
-
<option value="<?php echo $option['value'];?>" <?php selected( in_array( $option['value'], $value ) ); ?>><?php echo $option['name'];?></option>
|
248 |
-
<?php
|
249 |
-
}
|
250 |
-
} ?>
|
251 |
-
</select>
|
252 |
-
<?php if( $help_text != ''){ ?>
|
253 |
-
<a href="#" class="tooltip">
|
254 |
-
<img id="" class='ninja-forms-help-text' src="<?php echo NINJA_FORMS_URL;?>images/question-ico.gif" title="">
|
255 |
-
<span>
|
256 |
-
<img class="callout" src="<?php echo NINJA_FORMS_URL;?>/images/callout.gif" />
|
257 |
-
<?php echo $help_text;?>
|
258 |
-
</span>
|
259 |
-
</a>
|
260 |
-
<?php }
|
261 |
-
break;
|
262 |
-
case 'checkbox':
|
263 |
-
?>
|
264 |
-
<input type="hidden" name="<?php echo $name;?>" value="0">
|
265 |
-
<input type="checkbox" name="<?php echo $name;?>" value="1" <?php checked($value, 1);?> id="<?php echo $name;?>" class="<?php echo $class;?>">
|
266 |
-
<?php if( $help_text != ''){ ?>
|
267 |
-
<a href="#" class="tooltip">
|
268 |
-
<img id="" class='ninja-forms-help-text' src="<?php echo NINJA_FORMS_URL;?>images/question-ico.gif" title="">
|
269 |
-
<span>
|
270 |
-
<img class="callout" src="<?php echo NINJA_FORMS_URL;?>images/callout.gif" />
|
271 |
-
<?php echo $help_text;?>
|
272 |
-
</span>
|
273 |
-
</a>
|
274 |
-
<?php }
|
275 |
-
break;
|
276 |
-
case 'checkbox_list':
|
277 |
-
if( $value == '' ){
|
278 |
-
$value = array();
|
279 |
-
}
|
280 |
-
|
281 |
-
?>
|
282 |
-
<input type="hidden" name="<?php echo $name;?>" value="">
|
283 |
-
|
284 |
-
<?php
|
285 |
-
if( $select_all ){
|
286 |
-
?>
|
287 |
-
|
288 |
-
<label>
|
289 |
-
<input type="checkbox" name="" value="" id="<?php echo $name;?>_select_all" class="ninja-forms-select-all" title="ninja-forms-<?php echo $name;?>">
|
290 |
-
- <?php _e( 'Select All', 'ninja-forms' );?>
|
291 |
-
</label>
|
292 |
-
|
293 |
-
<?php
|
294 |
-
}else{
|
295 |
-
if( is_array( $s['options'] ) AND isset( $s['options'][0] ) ){
|
296 |
-
|
297 |
-
$option_name = $s['options'][0]['name'];
|
298 |
-
$option_value = $s['options'][0]['value'];
|
299 |
-
|
300 |
-
?>
|
301 |
-
|
302 |
-
<label>
|
303 |
-
<input type="checkbox" class="ninja-forms-<?php echo $name;?> <?php echo $class;?>" name="<?php echo $name;?>[]" value="<?php echo $option_value;?>" <?php checked( in_array( $option_value, $value ) );?> id="<?php echo $option_name;?>">
|
304 |
-
<?php echo $option_name;?>
|
305 |
-
</label>
|
306 |
-
|
307 |
-
<?php
|
308 |
-
}
|
309 |
-
}
|
310 |
-
?>
|
311 |
-
|
312 |
-
<?php
|
313 |
-
if( is_array( $s['options'] ) AND !empty( $s['options'] ) ){
|
314 |
-
$x = 0;
|
315 |
-
foreach( $s['options'] as $option ){
|
316 |
-
if( ( !$select_all AND $x > 0 ) OR $select_all ){
|
317 |
-
$option_name = $option['name'];
|
318 |
-
$option_value = $option['value'];
|
319 |
-
?>
|
320 |
-
<label>
|
321 |
-
<input type="checkbox" class="ninja-forms-<?php echo $name;?> <?php echo $class;?>" name="<?php echo $name;?>[]" value="<?php echo $option_value;?>" <?php checked( in_array( $option_value, $value ) );?> id="<?php echo $option_name;?>">
|
322 |
-
<?php echo $option_name;?>
|
323 |
-
</label>
|
324 |
-
<?php
|
325 |
-
}
|
326 |
-
$x++;
|
327 |
-
}
|
328 |
-
}
|
329 |
-
break;
|
330 |
-
case 'radio':
|
331 |
-
if( is_array( $s['options'] ) AND !empty( $s['options'] ) ){
|
332 |
-
$x = 0; ?>
|
333 |
-
<?php foreach($s['options'] as $option){ ?>
|
334 |
-
<input type="radio" name="<?php echo $name;?>" value="<?php echo $option['value'];?>" id="<?php echo $name."_".$x;?>" <?php checked($value, $option['value']);?> class="<?php echo $class;?>"> <label for="<?php echo $name."_".$x;?>"><?php echo $option['name'];?></label>
|
335 |
-
<?php
|
336 |
-
$radio_help_text = isset($option['help_text']) ? $option['help_text'] : $help_text;
|
337 |
-
|
338 |
-
if( $radio_help_text != ''){ ?>
|
339 |
-
<a href="#" class="tooltip">
|
340 |
-
<img id="" class='ninja-forms-help-text' src="<?php echo NINJA_FORMS_URL;?>images/question-ico.gif" title="">
|
341 |
-
<span>
|
342 |
-
<img class="callout" src="<?php echo NINJA_FORMS_URL;?>images/callout.gif" />
|
343 |
-
<?php echo $radio_help_text;?>
|
344 |
-
</span>
|
345 |
-
</a>
|
346 |
-
<?php } ?>
|
347 |
-
<br />
|
348 |
-
|
349 |
-
<?php
|
350 |
-
$x++;
|
351 |
-
}
|
352 |
-
}
|
353 |
-
break;
|
354 |
-
case 'textarea':
|
355 |
-
$value = ninja_forms_esc_html_deep( $value );
|
356 |
-
?>
|
357 |
-
<textarea name="<?php echo $name;?>" id="<?php echo $name;?>" class="<?php echo $class;?>"><?php echo $value;?></textarea>
|
358 |
-
<?php
|
359 |
-
break;
|
360 |
-
case 'rte':
|
361 |
-
$args = apply_filters( 'ninja_forms_admin_metabox_rte', array() );
|
362 |
-
wp_editor( $value, $name, $args );
|
363 |
-
break;
|
364 |
-
case 'file':
|
365 |
-
?>
|
366 |
-
<input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $max_file_size;?>" />
|
367 |
-
<input type="file" name="<?php echo $name;?>" id="<?php echo $name;?>" class="<?php echo $class;?>">
|
368 |
-
<?php
|
369 |
-
break;
|
370 |
-
case 'desc':
|
371 |
-
echo $desc;
|
372 |
-
break;
|
373 |
-
case 'hidden':
|
374 |
-
?>
|
375 |
-
<input type="hidden" name="<?php echo $name;?>" id="<?php echo $name;?>" value="<?php echo $value;?>">
|
376 |
-
<?php
|
377 |
-
break;
|
378 |
-
case 'submit':
|
379 |
-
?>
|
380 |
-
<input type="submit" name="<?php echo $name;?>" class="<?php echo $class; ?>" value="<?php echo $button_text;?>">
|
381 |
-
<?php
|
382 |
-
break;
|
383 |
-
case 'button':
|
384 |
-
// set a default value for $class to maintain the standard WordPress UI
|
385 |
-
if( isset( $class ) && empty( $class ) ) {
|
386 |
-
$class = "button-secondary";
|
387 |
-
}
|
388 |
-
?>
|
389 |
-
<input type="button" name="<?php echo $name;?>" id="<?php echo $name;?>" class="<?php echo $class; ?>" value="<?php echo $button_text;?>">
|
390 |
-
<?php
|
391 |
-
break;
|
392 |
-
|
393 |
-
default:
|
394 |
-
if( isset( $s['display_function'] ) ){
|
395 |
-
$s_display_function = $s['display_function'];
|
396 |
-
if( $s_display_function != '' ){
|
397 |
-
$arguments['form_id'] = $form_id;
|
398 |
-
$arguments['data'] = $current_settings;
|
399 |
-
$arguments['field'] = $s;
|
400 |
-
call_user_func_array( $s_display_function, $arguments );
|
401 |
-
}
|
402 |
-
}
|
403 |
-
break;
|
404 |
-
}
|
405 |
-
|
406 |
-
if( $desc != '' AND $s['type'] != 'desc' ){
|
407 |
-
?>
|
408 |
-
<p class="description">
|
409 |
-
<?php echo $desc;?>
|
410 |
-
</p>
|
411 |
-
<?php
|
412 |
-
}
|
413 |
-
echo '</td></tr>';
|
414 |
-
}
|
415 |
-
|
416 |
-
}
|
417 |
-
|
418 |
-
if( $display_function != '' ){
|
419 |
-
if( $form_id != '' ){
|
420 |
-
$arguments['form_id'] = $form_id;
|
421 |
-
}
|
422 |
-
$arguments['metabox'] = $metabox;
|
423 |
-
call_user_func_array( $display_function, $arguments );
|
424 |
-
}
|
425 |
-
|
426 |
-
if( $display_container ){
|
427 |
-
?>
|
428 |
-
</tbody>
|
429 |
-
</table>
|
430 |
-
</div>
|
431 |
-
</div>
|
432 |
-
<?php
|
433 |
-
}
|
434 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/admin/pages/index.php
DELETED
@@ -1,2 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
// Silence is golden.
|
|
|
|
deprecated/includes/admin/pages/ninja-forms-addons/tabs/addons/addons.php
DELETED
@@ -1,91 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
add_action('init', 'ninja_forms_register_tab_addons');
|
3 |
-
|
4 |
-
function ninja_forms_register_tab_addons(){
|
5 |
-
$args = array(
|
6 |
-
'name' => __( 'Extend Ninja Forms', 'ninja-forms' ),
|
7 |
-
'page' => 'ninja-forms-extend',
|
8 |
-
'display_function' => 'ninja_forms_tab_addons',
|
9 |
-
'save_function' => '',
|
10 |
-
'show_save' => false,
|
11 |
-
'title' => '<div class="nf-brand-header"><div class="nf-logo"></div><div class="wpn-logo">brought by</div></div>',
|
12 |
-
);
|
13 |
-
ninja_forms_register_tab('extend', $args);
|
14 |
-
}
|
15 |
-
|
16 |
-
function ninja_forms_tab_addons(){
|
17 |
-
// $uri = 'https://ninjaforms.com/downloads/category/ninja-forms/feed/';
|
18 |
-
//include_once(ABSPATH . WPINC . '/feed.php');
|
19 |
-
// $feed = fetch_feed( $uri );
|
20 |
-
|
21 |
-
// if (!is_wp_error( $feed ) ) :
|
22 |
-
// $items = $feed->get_items(0, 0);
|
23 |
-
// endif;
|
24 |
-
|
25 |
-
$items = wp_remote_get( 'https://ninjaforms.com/?extend_feed=jlhrbgf89734go7387o4g3h' );
|
26 |
-
|
27 |
-
$items = wp_remote_retrieve_body( $items );
|
28 |
-
|
29 |
-
$items = json_decode( $items, true );
|
30 |
-
|
31 |
-
//shuffle( $items );
|
32 |
-
foreach ($items as $item) {
|
33 |
-
$plugin_data = array();
|
34 |
-
if( !empty( $item['plugin'] ) && file_exists( WP_PLUGIN_DIR.'/'.$item['plugin'] ) ){
|
35 |
-
$plugin_data = get_plugin_data( WP_PLUGIN_DIR.'/'.$item['plugin'], false, true );
|
36 |
-
}
|
37 |
-
$version = isset ( $plugin_data['Version'] ) ? $plugin_data['Version'] : '';
|
38 |
-
if ( ! empty ( $version ) && $version < $item['version'] ) {
|
39 |
-
echo '<div class="error"><p>';
|
40 |
-
echo '<strong>' . $item['title'] . '</strong> requires an update. You have version <strong>' . $version . '</strong> installed. The current version is <strong>' . $item['version'] . '</strong>.';
|
41 |
-
echo '</p></div>';
|
42 |
-
}
|
43 |
-
}
|
44 |
-
|
45 |
-
$u_id = get_option( 'nf_aff', false );
|
46 |
-
if ( !$u_id ) $u_id = apply_filters( 'ninja_forms_affiliate_id', false );
|
47 |
-
|
48 |
-
foreach ($items as $item) {
|
49 |
-
|
50 |
-
$link = $item[ 'link' ];
|
51 |
-
if ( $u_id ) {
|
52 |
-
$last_slash = strripos( $link, '/' );
|
53 |
-
$link = substr( $link, 0, $last_slash );
|
54 |
-
$link = urlencode( $link );
|
55 |
-
$link = 'http://www.shareasale.com/r.cfm?u=' . $u_id . '&b=812237&m=63061&afftrack=&urllink=' . $link;
|
56 |
-
}
|
57 |
-
|
58 |
-
echo '<div class="nf-extend nf-box">';
|
59 |
-
echo '<img src="' . $item['image'] . '" />';
|
60 |
-
echo '<h2>' . $item['title'] . '</h2>';
|
61 |
-
echo '<div class="nf-extend-content">';
|
62 |
-
echo '<p>' . $item['content'] . '</p>';
|
63 |
-
echo '<div class="nf-extend-buttons">';
|
64 |
-
if( !empty( $item['docs'] ) ) {
|
65 |
-
echo '<a href="' . $item['docs'] . '" class="button-secondary nf-doc-button">' . __( 'Documentation', 'ninja-forms' ) . '</a>';
|
66 |
-
} else {
|
67 |
-
echo '<p>' . __( 'Documentation coming soon.', 'ninja-forms' ) . '</a>.</p>';
|
68 |
-
}
|
69 |
-
|
70 |
-
if( !empty( $item['plugin'] ) && file_exists( WP_PLUGIN_DIR.'/'.$item['plugin'] ) ){
|
71 |
-
if( is_plugin_active( $item['plugin'] ) ) {
|
72 |
-
echo '<span class="button-secondary nf-button">' . __( 'Active', 'ninja-forms' ) . '</span>';
|
73 |
-
} elseif( is_plugin_inactive( $item['plugin'] ) ) {
|
74 |
-
echo '<span class="button-secondary nf-button">' . __( 'Installed', 'ninja-forms' ) . '</span>';
|
75 |
-
} else {
|
76 |
-
echo '<a href="' . $link . '" title="' . $item['title'] . '" class="button-primary nf-button">' . __( 'Learn More', 'ninja-forms' ) . '</a>';
|
77 |
-
}
|
78 |
-
}else{
|
79 |
-
echo '<a href="' . $link . '" title="' . $item['title'] . '" class="button-primary nf-button">' . __( 'Learn More', 'ninja-forms' ) . '</a>';
|
80 |
-
}
|
81 |
-
echo '</div>';
|
82 |
-
|
83 |
-
echo '</div>';
|
84 |
-
|
85 |
-
echo '</div>';
|
86 |
-
}
|
87 |
-
}
|
88 |
-
|
89 |
-
function ninja_forms_save_addons($data){
|
90 |
-
global $wpdb;
|
91 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/admin/pages/ninja-forms-impexp/index.php
DELETED
@@ -1,2 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
// Silence is golden.
|
|
|
|
deprecated/includes/admin/pages/ninja-forms-impexp/tabs/impexp-backup/impexp-backup.php
DELETED
@@ -1,50 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
//add_action('init', 'ninja_forms_register_tab_impexp_backup');
|
3 |
-
|
4 |
-
function ninja_forms_register_tab_impexp_backup(){
|
5 |
-
$args = array(
|
6 |
-
'name' => __( 'Backup / Restore', 'ninja-forms' ),
|
7 |
-
'page' => 'ninja-forms-impexp',
|
8 |
-
'display_function' => 'ninja_forms_tab_impexp_backup',
|
9 |
-
'save_function' => 'ninja_forms_save_impexp_backup',
|
10 |
-
'show_save' => false,
|
11 |
-
);
|
12 |
-
ninja_forms_register_tab('impexp_backup', $args);
|
13 |
-
|
14 |
-
}
|
15 |
-
|
16 |
-
|
17 |
-
function ninja_forms_tab_impexp_backup(){
|
18 |
-
global $wpdb;
|
19 |
-
?>
|
20 |
-
<h2><?php _e( 'Backup / Restore', 'ninja-forms' );?></h2>
|
21 |
-
<p class="description description-wide">
|
22 |
-
<h3 class="section-title"><?php _e( 'Backup Ninja Forms', 'ninja-forms' );?>:</h3>
|
23 |
-
<div class="form-section">
|
24 |
-
<input type="submit" name="submit" id="" class="button-primary" value="<?php _e( 'Backup Ninja Forms', 'ninja-forms' ); ?>">
|
25 |
-
</div>
|
26 |
-
</p>
|
27 |
-
<p class="description description-wide">
|
28 |
-
<h3 class="section-title"><?php _e( 'Restore Ninja Forms', 'ninja-forms' );?>:</h3>
|
29 |
-
<div class="form-section">
|
30 |
-
<input type="hidden" name="MAX_FILE_SIZE" value="30000" />
|
31 |
-
<input type="file" name="userfile" id="">
|
32 |
-
<input type="submit" name="submit" id="" class="button-primary" value="<?php _e( 'Restore Ninja Forms', 'ninja-forms' ); ?>">
|
33 |
-
<?php
|
34 |
-
if(isset($_POST['submit']) AND isset($_POST['ninja_forms_restore'])){
|
35 |
-
?>
|
36 |
-
<div id="message" class="updated below-h2">
|
37 |
-
<p><?php _e( 'Data restored successfully!', 'ninja-forms' ); ?></p>
|
38 |
-
</div>
|
39 |
-
<?php
|
40 |
-
}
|
41 |
-
?>
|
42 |
-
</div>
|
43 |
-
</p>
|
44 |
-
<?php
|
45 |
-
}
|
46 |
-
|
47 |
-
function ninja_forms_save_impexp_backup($data){
|
48 |
-
global $wpdb;
|
49 |
-
|
50 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/admin/pages/ninja-forms-impexp/tabs/impexp-backup/index.php
DELETED
@@ -1,2 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
// Silence is golden.
|
|
|
|
deprecated/includes/admin/pages/ninja-forms-impexp/tabs/impexp-fields/impexp-fields.php
DELETED
@@ -1,151 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
|
3 |
-
add_action('init', 'ninja_forms_register_tab_impexp_fields');
|
4 |
-
|
5 |
-
function ninja_forms_register_tab_impexp_fields(){
|
6 |
-
$args = array(
|
7 |
-
'name' => __( 'Favorite Fields', 'ninja-forms' ),
|
8 |
-
'page' => 'ninja-forms-impexp',
|
9 |
-
'display_function' => '',
|
10 |
-
'save_function' => 'ninja_forms_save_impexp_fields',
|
11 |
-
'show_save' => false,
|
12 |
-
);
|
13 |
-
ninja_forms_register_tab('impexp_fields', $args);
|
14 |
-
|
15 |
-
}
|
16 |
-
|
17 |
-
add_action( 'init', 'ninja_forms_register_imp_fav_fields_metabox' );
|
18 |
-
function ninja_forms_register_imp_fav_fields_metabox(){
|
19 |
-
$args = array(
|
20 |
-
'page' => 'ninja-forms-impexp',
|
21 |
-
'tab' => 'impexp_fields',
|
22 |
-
'slug' => 'imp_fields',
|
23 |
-
'title' => __( 'Import Favorite Fields', 'ninja-forms' ),
|
24 |
-
'settings' => array(
|
25 |
-
array(
|
26 |
-
'name' => 'userfile',
|
27 |
-
'type' => 'file',
|
28 |
-
'label' => __( 'Select a file', 'ninja-forms' ),
|
29 |
-
'desc' => '',
|
30 |
-
'max_file_size' => 30000,
|
31 |
-
'help_text' => '',
|
32 |
-
),
|
33 |
-
array(
|
34 |
-
'name' => 'submit',
|
35 |
-
'type' => 'submit',
|
36 |
-
'label' => __( 'Import Favorites', 'ninja-forms' ),
|
37 |
-
'class' => 'button-secondary',
|
38 |
-
),
|
39 |
-
),
|
40 |
-
);
|
41 |
-
ninja_forms_register_tab_metabox($args);
|
42 |
-
}
|
43 |
-
|
44 |
-
add_action( 'admin_init', 'ninja_forms_register_exp_fav_fields_metabox' );
|
45 |
-
function ninja_forms_register_exp_fav_fields_metabox(){
|
46 |
-
$fav_results = ninja_forms_get_all_favs();
|
47 |
-
$fav_options = array();
|
48 |
-
|
49 |
-
if ( is_array( $fav_results ) AND !empty( $fav_results ) ) {
|
50 |
-
foreach ( $fav_results as $fav ) {
|
51 |
-
$data = $fav['data'];
|
52 |
-
$label = $data['label'];
|
53 |
-
array_push($fav_options, array('name' => $label, 'value' => $fav['id']));
|
54 |
-
}
|
55 |
-
$empty = '';
|
56 |
-
} else {
|
57 |
-
$empty = __( 'No Favorite Fields Found', 'ninja-forms' );
|
58 |
-
}
|
59 |
-
$args = array(
|
60 |
-
'page' => 'ninja-forms-impexp',
|
61 |
-
'tab' => 'impexp_fields',
|
62 |
-
'slug' => 'exp_fields',
|
63 |
-
'title' => __( 'Export Favorite Fields', 'ninja-forms' ),
|
64 |
-
'settings' => array(
|
65 |
-
array(
|
66 |
-
'name' => 'ninja_forms_fav',
|
67 |
-
'type' => 'checkbox_list',
|
68 |
-
'label' => '',
|
69 |
-
'desc' => '',
|
70 |
-
'options' => $fav_options,
|
71 |
-
'help_text' => '',
|
72 |
-
),
|
73 |
-
array(
|
74 |
-
'name' => '',
|
75 |
-
'type' => 'desc',
|
76 |
-
'label' => $empty,
|
77 |
-
),
|
78 |
-
array(
|
79 |
-
'name' => 'submit',
|
80 |
-
'type' => 'submit',
|
81 |
-
'label' => __( 'Export Fields', 'ninja-forms' ),
|
82 |
-
'class' => 'button-secondary',
|
83 |
-
),
|
84 |
-
),
|
85 |
-
);
|
86 |
-
ninja_forms_register_tab_metabox($args);
|
87 |
-
}
|
88 |
-
|
89 |
-
function ninja_forms_save_impexp_fields( $data ){
|
90 |
-
global $wpdb, $ninja_forms_admin_update_message;
|
91 |
-
$plugin_settings = nf_get_settings();
|
92 |
-
$update_message = '';
|
93 |
-
if($_POST['submit'] == __( 'Export Fields', 'ninja-forms' ) ){
|
94 |
-
if(isset($_POST['ninja_forms_fav']) AND !empty($_POST['ninja_forms_fav'])){
|
95 |
-
$fav_ids = ninja_forms_esc_html_deep( $_POST['ninja_forms_fav'] );
|
96 |
-
|
97 |
-
if(isset($plugin_settings['date_format'])){
|
98 |
-
$date_format = $plugin_settings['date_format'];
|
99 |
-
}else{
|
100 |
-
$date_format = 'm/d/Y';
|
101 |
-
}
|
102 |
-
|
103 |
-
//$today = date($date_format);
|
104 |
-
$current_time = current_time( 'timestamp' );
|
105 |
-
$today = date( $date_format, $current_time );
|
106 |
-
|
107 |
-
$favorites = array();
|
108 |
-
|
109 |
-
|
110 |
-
if( is_array( $fav_ids ) AND !empty( $fav_ids ) ){
|
111 |
-
$x = 0;
|
112 |
-
foreach( $fav_ids as $fav_id ){
|
113 |
-
$fav_row = ninja_forms_get_fav_by_id( $fav_id );
|
114 |
-
$fav_row['id'] = NULL;
|
115 |
-
$favorites[$x] = $fav_row;
|
116 |
-
$x++;
|
117 |
-
}
|
118 |
-
}
|
119 |
-
|
120 |
-
$favorites = serialize($favorites);
|
121 |
-
|
122 |
-
header("Content-type: application/csv");
|
123 |
-
header("Content-Disposition: attachment; filename=favorites-".$today.".nff");
|
124 |
-
header("Pragma: no-cache");
|
125 |
-
header("Expires: 0");
|
126 |
-
|
127 |
-
echo $favorites;
|
128 |
-
die();
|
129 |
-
}else{
|
130 |
-
$update_message = __( 'Please select favorite fields to export.', 'ninja-forms' );
|
131 |
-
}
|
132 |
-
}elseif( $_POST['submit'] == __( 'Import Favorites', 'ninja-forms' ) ){
|
133 |
-
|
134 |
-
if( $_FILES['userfile']['error'] == UPLOAD_ERR_OK AND is_uploaded_file( $_FILES['userfile']['tmp_name'] ) ){
|
135 |
-
|
136 |
-
$file = file_get_contents($_FILES['userfile']['tmp_name']);
|
137 |
-
$favorites = unserialize($file);
|
138 |
-
if(is_array($favorites)){
|
139 |
-
foreach($favorites as $fav){
|
140 |
-
$fav['data'] = serialize( $fav['data'] );
|
141 |
-
$wpdb->insert(NINJA_FORMS_FAV_FIELDS_TABLE_NAME, $fav);
|
142 |
-
}
|
143 |
-
}
|
144 |
-
$update_message = __( 'Favorites imported successfully.', 'ninja-forms' );
|
145 |
-
}else{
|
146 |
-
$update_message = __( 'Please select a valid favorite fields file.', 'ninja-forms' );
|
147 |
-
}
|
148 |
-
}
|
149 |
-
|
150 |
-
return $update_message;
|
151 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/admin/pages/ninja-forms-impexp/tabs/impexp-fields/index.php
DELETED
@@ -1,2 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
// Silence is golden.
|
|
|
|
deprecated/includes/admin/pages/ninja-forms-impexp/tabs/impexp-forms/impexp-forms.php
DELETED
@@ -1,298 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
add_action('init', 'ninja_forms_register_tab_impexp_forms');
|
3 |
-
|
4 |
-
function ninja_forms_register_tab_impexp_forms(){
|
5 |
-
$args = array(
|
6 |
-
'name' => __( 'Forms', 'ninja-forms' ),
|
7 |
-
'page' => 'ninja-forms-impexp',
|
8 |
-
'display_function' => '',
|
9 |
-
'save_function' => 'ninja_forms_save_impexp_forms',
|
10 |
-
'show_save' => false,
|
11 |
-
);
|
12 |
-
ninja_forms_register_tab('impexp_forms', $args);
|
13 |
-
|
14 |
-
}
|
15 |
-
|
16 |
-
add_action('init', 'ninja_forms_register_imp_forms_metabox');
|
17 |
-
function ninja_forms_register_imp_forms_metabox(){
|
18 |
-
$args = array(
|
19 |
-
'page' => 'ninja-forms-impexp',
|
20 |
-
'tab' => 'impexp_forms',
|
21 |
-
'slug' => 'imp_form',
|
22 |
-
'title' => __( 'Import a form', 'ninja-forms' ),
|
23 |
-
'settings' => array(
|
24 |
-
array(
|
25 |
-
'name' => 'userfile',
|
26 |
-
'type' => 'file',
|
27 |
-
'label' => __( 'Select a file', 'ninja-forms' ),
|
28 |
-
'desc' => '',
|
29 |
-
'max_file_size' => 5000000,
|
30 |
-
'help_text' => '',
|
31 |
-
),
|
32 |
-
array(
|
33 |
-
'name' => 'submit',
|
34 |
-
'type' => 'submit',
|
35 |
-
'label' => __( 'Import Form', 'ninja-forms' ),
|
36 |
-
'class' => 'button-secondary',
|
37 |
-
),
|
38 |
-
),
|
39 |
-
);
|
40 |
-
ninja_forms_register_tab_metabox($args);
|
41 |
-
}
|
42 |
-
|
43 |
-
function ninja_forms_register_exp_forms_metabox(){
|
44 |
-
if ( ! isset ( $_REQUEST['page'] ) || 'ninja-forms-impexp' != $_REQUEST['page'] )
|
45 |
-
return false;
|
46 |
-
|
47 |
-
$form_results = ninja_forms_get_all_forms();
|
48 |
-
$form_select = array();
|
49 |
-
if(is_array($form_results) AND !empty($form_results)){
|
50 |
-
foreach($form_results as $form){
|
51 |
-
if( isset( $form['data'] ) ){
|
52 |
-
$data = $form['data'];
|
53 |
-
$form_title = $data['form_title'];
|
54 |
-
array_push($form_select, array('name' => $form_title, 'value' => $form['id']));
|
55 |
-
}
|
56 |
-
}
|
57 |
-
}
|
58 |
-
$args = array(
|
59 |
-
'page' => 'ninja-forms-impexp',
|
60 |
-
'tab' => 'impexp_forms',
|
61 |
-
'slug' => 'exp_form',
|
62 |
-
'title' => __('Export a form', 'ninja-forms'),
|
63 |
-
'settings' => array(
|
64 |
-
array(
|
65 |
-
'name' => 'form_id',
|
66 |
-
'type' => 'select',
|
67 |
-
'label' => __('Select a form', 'ninja-forms'),
|
68 |
-
'desc' => '',
|
69 |
-
'options' => $form_select,
|
70 |
-
'help_text' => '',
|
71 |
-
),
|
72 |
-
array(
|
73 |
-
'name' => 'submit',
|
74 |
-
'type' => 'submit',
|
75 |
-
'label' => __('Export Form', 'ninja-forms'),
|
76 |
-
'class' => 'button-secondary',
|
77 |
-
),
|
78 |
-
),
|
79 |
-
);
|
80 |
-
ninja_forms_register_tab_metabox($args);
|
81 |
-
}
|
82 |
-
|
83 |
-
add_action('admin_init', 'ninja_forms_register_exp_forms_metabox');
|
84 |
-
|
85 |
-
/*
|
86 |
-
*
|
87 |
-
* Function that returns a serialized string containing the form for export.
|
88 |
-
*
|
89 |
-
* @since 2.2.42
|
90 |
-
* @returns $form_row string
|
91 |
-
*/
|
92 |
-
|
93 |
-
function ninja_forms_serialize_form( $form_id ){
|
94 |
-
if ( $form_id == '' )
|
95 |
-
return;
|
96 |
-
|
97 |
-
$plugin_settings = nf_get_settings();
|
98 |
-
$form_row = array();
|
99 |
-
$form_row['data'] = Ninja_Forms()->form( $form_id )->get_all_settings();
|
100 |
-
$field_results = ninja_forms_get_fields_by_form_id( $form_id );
|
101 |
-
$form_row['id'] = NULL;
|
102 |
-
if ( is_array ( $form_row ) AND ! empty ( $form_row ) ) {
|
103 |
-
if ( is_array( $field_results ) AND ! empty( $field_results ) ) {
|
104 |
-
$x = 0;
|
105 |
-
foreach( $field_results as $field ) {
|
106 |
-
$form_row['field'][$x] = $field;
|
107 |
-
$x++;
|
108 |
-
}
|
109 |
-
}
|
110 |
-
}
|
111 |
-
|
112 |
-
// Get all of our notifications for this form
|
113 |
-
$notifications = nf_get_notifications_by_form_id( $form_id );
|
114 |
-
$form_row['notifications'] = $notifications;
|
115 |
-
|
116 |
-
$form_row = apply_filters( 'nf_export_form_row', $form_row );
|
117 |
-
|
118 |
-
$form_row = serialize($form_row);
|
119 |
-
|
120 |
-
return $form_row;
|
121 |
-
}
|
122 |
-
|
123 |
-
|
124 |
-
function ninja_forms_export_form( $form_id ){
|
125 |
-
if($form_id == '')
|
126 |
-
return;
|
127 |
-
$plugin_settings = nf_get_settings();
|
128 |
-
$form_title = Ninja_Forms()->form( $form_id )->get_setting( 'form_title' );
|
129 |
-
$form_row = ninja_forms_serialize_form( $form_id );
|
130 |
-
$form_title = preg_replace('/[^a-zA-Z0-9-]/', '', $form_title);
|
131 |
-
$form_title = str_replace (" ", "-", $form_title);
|
132 |
-
|
133 |
-
if(isset($plugin_settings['date_format'])){
|
134 |
-
$date_format = $plugin_settings['date_format'];
|
135 |
-
}else{
|
136 |
-
$date_format = 'm/d/Y';
|
137 |
-
}
|
138 |
-
|
139 |
-
//$today = date($date_format);
|
140 |
-
$current_time = current_time('timestamp');
|
141 |
-
$today = date($date_format, $current_time);
|
142 |
-
|
143 |
-
header("Content-type: application/csv");
|
144 |
-
header('Content-Disposition: attachment; filename="'.$form_title.'"-"'.$today.'".nff"');
|
145 |
-
header("Pragma: no-cache");
|
146 |
-
header("Expires: 0");
|
147 |
-
echo $form_row;
|
148 |
-
die();
|
149 |
-
}
|
150 |
-
|
151 |
-
function ninja_forms_save_impexp_forms($data){
|
152 |
-
global $wpdb, $ninja_forms_admin_update_message;
|
153 |
-
$plugin_settings = nf_get_settings();
|
154 |
-
$form_id = isset( $_REQUEST['form_id'] ) ? absint( $_REQUEST['form_id'] ) : '';
|
155 |
-
$update_msg = '';
|
156 |
-
if( $_REQUEST['submit'] == __('Export Form', 'ninja-forms') OR ( isset( $_REQUEST['export_form'] ) AND absint( $_REQUEST['export_form'] ) == 1 ) ){
|
157 |
-
if($form_id != ''){
|
158 |
-
ninja_forms_export_form( $form_id );
|
159 |
-
}else{
|
160 |
-
$ninja_forms_admin_update_message = __( 'Please select a form.', 'ninja-forms' );
|
161 |
-
}
|
162 |
-
}elseif($_REQUEST['submit'] == __('Import Form', 'ninja-forms')){
|
163 |
-
if ($_FILES['userfile']['error'] == UPLOAD_ERR_OK AND is_uploaded_file($_FILES['userfile']['tmp_name'])){
|
164 |
-
$file = file_get_contents($_FILES['userfile']['tmp_name']);
|
165 |
-
ninja_forms_import_form( $file );
|
166 |
-
$update_msg = __( 'Form Imported Successfully.', 'ninja-forms' );
|
167 |
-
}else{
|
168 |
-
//echo $_FILES['userfile']['error'];
|
169 |
-
$update_msg = __( 'Please select a valid exported form file.', 'ninja-forms' );
|
170 |
-
}
|
171 |
-
}
|
172 |
-
return $update_msg;
|
173 |
-
}
|
174 |
-
|
175 |
-
|
176 |
-
/*
|
177 |
-
*
|
178 |
-
* Function that fixes calculation fields and their references to newly created fields.
|
179 |
-
*
|
180 |
-
* @since 2.2.40
|
181 |
-
* @returns void
|
182 |
-
*/
|
183 |
-
|
184 |
-
add_action( 'ninja_forms_after_import_form', 'ninja_forms_calc_after_import_form' );
|
185 |
-
|
186 |
-
function ninja_forms_calc_after_import_form( $form ){
|
187 |
-
global $wpdb;
|
188 |
-
|
189 |
-
if( is_array( $form['field'] ) AND !empty( $form['field'] ) ){
|
190 |
-
$field_rows = ninja_forms_get_fields_by_form_id( $form['id'] );
|
191 |
-
if( is_array( $field_rows ) AND !empty( $field_rows ) ){
|
192 |
-
for ($y=0; $y < count( $field_rows ); $y++) {
|
193 |
-
if ( isset ( $field_rows[$y]['data']['calc'] ) AND is_array( $field_rows[$y]['data']['calc'] ) ) {
|
194 |
-
for ( $i=0; $i < count( $field_rows[$y]['data']['calc']); $i++ ) {
|
195 |
-
foreach( $form['field'] as $inserted_field ){
|
196 |
-
if ( isset ( $field_rows[$y]['data']['calc'][$i]['field'] ) AND $inserted_field['old_id'] == $field_rows[$y]['data']['calc'][$i]['field'] ) {
|
197 |
-
$field_rows[$y]['data']['calc'][$i]['field'] = $inserted_field['id'];
|
198 |
-
}
|
199 |
-
}
|
200 |
-
}
|
201 |
-
}
|
202 |
-
|
203 |
-
if ( isset ( $field_rows[$y]['data']['calc_eq'] ) AND $field_rows[$y]['data']['calc_eq'] != '' ) {
|
204 |
-
$calc_eq = $field_rows[$y]['data']['calc_eq'];
|
205 |
-
foreach( $form['field'] as $inserted_field ){
|
206 |
-
$calc_eq = str_replace( 'field_'.$inserted_field['old_id'], 'field_'.$inserted_field['id'], $calc_eq );
|
207 |
-
}
|
208 |
-
$field_rows[$y]['data']['calc_eq'] = $calc_eq;
|
209 |
-
}
|
210 |
-
|
211 |
-
$field_rows[$y]['data'] = serialize( $field_rows[$y]['data'] );
|
212 |
-
$args = array(
|
213 |
-
'update_array' => array(
|
214 |
-
'data' => $field_rows[$y]['data'],
|
215 |
-
),
|
216 |
-
'where' => array(
|
217 |
-
'id' => $field_rows[$y]['id'],
|
218 |
-
),
|
219 |
-
);
|
220 |
-
ninja_forms_update_field($args);
|
221 |
-
}
|
222 |
-
|
223 |
-
if ( isset ( $form['data']['success_msg'] ) AND $form['data']['success_msg'] != '' ) {
|
224 |
-
$success_msg = $form['data']['success_msg'];
|
225 |
-
foreach( $form['field'] as $inserted_field ){
|
226 |
-
$success_msg = str_replace( '[ninja_forms_field id='.$inserted_field['old_id'].']', '[ninja_forms_field id='.$inserted_field['id'].']', $success_msg );
|
227 |
-
}
|
228 |
-
$form['data']['success_msg'] = $success_msg;
|
229 |
-
}
|
230 |
-
|
231 |
-
if ( isset ( $form['data']['user_subject'] ) AND $form['data']['user_subject'] != '' ) {
|
232 |
-
$user_subject = $form['data']['user_subject'];
|
233 |
-
foreach( $form['field'] as $inserted_field ){
|
234 |
-
$user_subject = str_replace( '[ninja_forms_field id='.$inserted_field['old_id'].']', '[ninja_forms_field id='.$inserted_field['id'].']', $user_subject );
|
235 |
-
}
|
236 |
-
$form['data']['user_subject'] = $user_subject;
|
237 |
-
}
|
238 |
-
|
239 |
-
if ( isset ( $form['data']['user_email_msg'] ) AND $form['data']['user_email_msg'] != '' ) {
|
240 |
-
$user_email_msg = $form['data']['user_email_msg'];
|
241 |
-
foreach( $form['field'] as $inserted_field ){
|
242 |
-
$user_email_msg = str_replace( '[ninja_forms_field id='.$inserted_field['old_id'].']', '[ninja_forms_field id='.$inserted_field['id'].']', $user_email_msg );
|
243 |
-
}
|
244 |
-
$form['data']['user_email_msg'] = $user_email_msg;
|
245 |
-
}
|
246 |
-
|
247 |
-
if ( isset ( $form['data']['admin_subject'] ) AND $form['data']['admin_subject'] != '' ) {
|
248 |
-
$admin_subject = $form['data']['admin_subject'];
|
249 |
-
foreach( $form['field'] as $inserted_field ){
|
250 |
-
$admin_subject = str_replace( '[ninja_forms_field id='.$inserted_field['old_id'].']', '[ninja_forms_field id='.$inserted_field['id'].']', $admin_subject );
|
251 |
-
}
|
252 |
-
$form['data']['admin_subject'] = $admin_subject;
|
253 |
-
}
|
254 |
-
|
255 |
-
if ( isset ( $form['data']['admin_email_msg'] ) AND $form['data']['admin_email_msg'] != '' ) {
|
256 |
-
$admin_email_msg = $form['data']['admin_email_msg'];
|
257 |
-
foreach( $form['field'] as $inserted_field ){
|
258 |
-
$admin_email_msg = str_replace( '[ninja_forms_field id='.$inserted_field['old_id'].']', '[ninja_forms_field id='.$inserted_field['id'].']', $admin_email_msg );
|
259 |
-
}
|
260 |
-
$form['data']['admin_email_msg'] = $admin_email_msg;
|
261 |
-
}
|
262 |
-
|
263 |
-
if ( isset ( $form['data']['mp_confirm_msg'] ) AND $form['data']['mp_confirm_msg'] != '' ) {
|
264 |
-
$mp_confirm_msg = $form['data']['mp_confirm_msg'];
|
265 |
-
foreach( $form['field'] as $inserted_field ){
|
266 |
-
$mp_confirm_msg = str_replace( '[ninja_forms_field id='.$inserted_field['old_id'].']', '[ninja_forms_field id='.$inserted_field['id'].']', $mp_confirm_msg );
|
267 |
-
}
|
268 |
-
$form['data']['mp_confirm_msg'] = $mp_confirm_msg;
|
269 |
-
}
|
270 |
-
|
271 |
-
if ( isset ( $form['data']['save_msg'] ) AND $form['data']['save_msg'] != '' ) {
|
272 |
-
$save_msg = $form['data']['save_msg'];
|
273 |
-
foreach( $form['field'] as $inserted_field ){
|
274 |
-
$save_msg = str_replace( '[ninja_forms_field id='.$inserted_field['old_id'].']', '[ninja_forms_field id='.$inserted_field['id'].']', $save_msg );
|
275 |
-
}
|
276 |
-
$form['data']['save_msg'] = $save_msg;
|
277 |
-
}
|
278 |
-
|
279 |
-
if ( isset ( $form['data']['save_email_msg'] ) AND $form['data']['save_email_msg'] != '' ) {
|
280 |
-
$save_email_msg = $form['data']['save_email_msg'];
|
281 |
-
foreach( $form['field'] as $inserted_field ){
|
282 |
-
$save_email_msg = str_replace( '[ninja_forms_field id='.$inserted_field['old_id'].']', '[ninja_forms_field id='.$inserted_field['id'].']', $save_email_msg );
|
283 |
-
}
|
284 |
-
$form['data']['save_email_msg'] = $save_email_msg;
|
285 |
-
}
|
286 |
-
|
287 |
-
$args = array(
|
288 |
-
'update_array' => array(
|
289 |
-
'data' => serialize( $form['data'] ),
|
290 |
-
),
|
291 |
-
'where' => array(
|
292 |
-
'id' => $form['id'],
|
293 |
-
),
|
294 |
-
);
|
295 |
-
ninja_forms_update_form($args);
|
296 |
-
}
|
297 |
-
}
|
298 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/admin/pages/ninja-forms-impexp/tabs/impexp-forms/index.php
DELETED
@@ -1,2 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
// Silence is golden.
|
|
|
|
deprecated/includes/admin/pages/ninja-forms-impexp/tabs/impexp-subs/impexp-subs.php
DELETED
@@ -1,30 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
//add_action('init', 'ninja_forms_register_tab_impexp_subs');
|
3 |
-
|
4 |
-
function ninja_forms_register_tab_impexp_subs(){
|
5 |
-
$args = array(
|
6 |
-
'name' => __( 'Submissions', 'ninja-forms' ),
|
7 |
-
'page' => 'ninja-forms-impexp',
|
8 |
-
'display_function' => 'ninja_forms_tab_impexp_subs',
|
9 |
-
'save_function' => 'ninja_forms_save_impexp_subs',
|
10 |
-
'show_save' => false,
|
11 |
-
);
|
12 |
-
ninja_forms_register_tab('impexp_subs', $args);
|
13 |
-
|
14 |
-
}
|
15 |
-
|
16 |
-
function ninja_forms_tab_impexp_subs(){
|
17 |
-
?>
|
18 |
-
<h2><?php _e('Import / Export Submissions', 'ninja-forms');?></h2>
|
19 |
-
<p class="description description-wide">
|
20 |
-
<h3 class="section-title"><?php _e( 'Date Settings', 'ninja-forms' );?>:</h3>
|
21 |
-
<div class="form-section">
|
22 |
-
<label for="">
|
23 |
-
<input type="text" class="code" name="form_title" id="" value="" />
|
24 |
-
<img id="" class='ninja-forms-help-text' src="<?php echo NINJA_FORMS_URL;?>images/question-ico.gif" title="">
|
25 |
-
<br />
|
26 |
-
</label>
|
27 |
-
</div>
|
28 |
-
</p>
|
29 |
-
<?php
|
30 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/admin/pages/ninja-forms-impexp/tabs/impexp-subs/index.php
DELETED
@@ -1,2 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
// Silence is golden.
|
|
|
|
deprecated/includes/admin/pages/ninja-forms-impexp/tabs/index.php
DELETED
@@ -1,2 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
// Silence is golden.
|
|
|
|
deprecated/includes/admin/pages/ninja-forms-settings/index.php
DELETED
@@ -1,2 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
// Silence is golden.
|
|
|
|
deprecated/includes/admin/pages/ninja-forms-settings/tabs/general-settings/general-settings.php
DELETED
@@ -1,143 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
add_action( 'init', 'ninja_forms_register_tab_general_settings', 9 );
|
3 |
-
|
4 |
-
function ninja_forms_register_tab_general_settings(){
|
5 |
-
$args = array(
|
6 |
-
'name' => __( 'General', 'ninja-forms' ),
|
7 |
-
'page' => 'ninja-forms-settings',
|
8 |
-
'display_function' => '',
|
9 |
-
'save_function' => 'ninja_forms_save_general_settings',
|
10 |
-
);
|
11 |
-
ninja_forms_register_tab( 'general_settings', $args );
|
12 |
-
}
|
13 |
-
|
14 |
-
add_action('init', 'ninja_forms_register_general_settings_metabox');
|
15 |
-
|
16 |
-
function ninja_forms_register_general_settings_metabox(){
|
17 |
-
|
18 |
-
$plugin_settings = nf_get_settings();
|
19 |
-
if ( isset ( $plugin_settings['version'] ) ) {
|
20 |
-
$current_version = $plugin_settings['version'];
|
21 |
-
} else {
|
22 |
-
$current_version = NF_PLUGIN_VERSION;
|
23 |
-
}
|
24 |
-
|
25 |
-
$args = array(
|
26 |
-
'page' => 'ninja-forms-settings',
|
27 |
-
'tab' => 'general_settings',
|
28 |
-
'slug' => 'general_settings',
|
29 |
-
'title' => __( 'General Settings', 'ninja-forms' ),
|
30 |
-
'settings' => array(
|
31 |
-
array(
|
32 |
-
'name' => 'version',
|
33 |
-
'type' => 'desc',
|
34 |
-
'label' => __( 'Version', 'ninja-forms' ),
|
35 |
-
'desc' => $current_version,
|
36 |
-
),
|
37 |
-
array(
|
38 |
-
'name' => 'date_format',
|
39 |
-
'type' => 'text',
|
40 |
-
'label' => __( 'Date Format', 'ninja-forms' ),
|
41 |
-
'desc' => 'e.g. m/d/Y, d/m/Y - ' . sprintf( __( 'Tries to follow the %sPHP date() function%s specifications, but not every format is supported.', 'ninja-forms' ), '<a href="http://www.php.net/manual/en/function.date.php" target="_blank">', '</a>' ),
|
42 |
-
),
|
43 |
-
array(
|
44 |
-
'name' => 'currency_symbol',
|
45 |
-
'type' => 'text',
|
46 |
-
'label' => __( 'Currency Symbol', 'ninja-forms' ),
|
47 |
-
'desc' => 'e.g. $, £, €',
|
48 |
-
),
|
49 |
-
),
|
50 |
-
);
|
51 |
-
ninja_forms_register_tab_metabox( $args );
|
52 |
-
|
53 |
-
$args = array(
|
54 |
-
'page' => 'ninja-forms-settings',
|
55 |
-
'tab' => 'general_settings',
|
56 |
-
'slug' => 'recaptcha_settings',
|
57 |
-
'title' => __( 'reCAPTCHA Settings', 'ninja-forms' ),
|
58 |
-
'settings' => array(
|
59 |
-
array(
|
60 |
-
'name' => 'recaptcha_site_key',
|
61 |
-
'type' => 'text',
|
62 |
-
'label' => __( 'reCAPTCHA Site Key', 'ninja-forms' ),
|
63 |
-
'desc' => sprintf( __( 'Get a site key for your domain by registering %shere%s', 'ninja-forms' ), '<a href="https://www.google.com/recaptcha/intro/index.html" target="_blank">', '</a>' )
|
64 |
-
),
|
65 |
-
array(
|
66 |
-
'name' => 'recaptcha_secret_key',
|
67 |
-
'type' => 'text',
|
68 |
-
'label' => __( 'reCAPTCHA Secret Key', 'ninja-forms' ),
|
69 |
-
'desc' => '',
|
70 |
-
),
|
71 |
-
array(
|
72 |
-
'name' => 'recaptcha_lang',
|
73 |
-
'type' => 'text',
|
74 |
-
'label' => __( 'reCAPTCHA Language', 'ninja-forms' ),
|
75 |
-
'desc' => 'e.g. en, da - ' . sprintf( __( 'Language used by reCAPTCHA. To get the code for your language click %shere%s', 'ninja-forms' ), '<a href="https://developers.google.com/recaptcha/docs/language" target="_blank">', '</a>' )
|
76 |
-
),
|
77 |
-
),
|
78 |
-
'state' => 'closed',
|
79 |
-
);
|
80 |
-
$args['settings'] = apply_filters( 'nf_general_settings_recaptcha', $args['settings'] );
|
81 |
-
|
82 |
-
ninja_forms_register_tab_metabox( $args );
|
83 |
-
|
84 |
-
$args = array(
|
85 |
-
'page' => 'ninja-forms-settings',
|
86 |
-
'tab' => 'general_settings',
|
87 |
-
'slug' => 'advanced_settings',
|
88 |
-
'title' => __( 'Advanced Settings', 'ninja-forms' ),
|
89 |
-
'settings' => array(
|
90 |
-
array(
|
91 |
-
'name' => 'delete_on_uninstall',
|
92 |
-
'type' => 'checkbox',
|
93 |
-
'label' => __( 'Remove ALL Ninja Forms data upon uninstall?', 'ninja-forms' ),
|
94 |
-
'desc' => sprintf( __( 'If this box is checked, ALL Ninja Forms data will be removed from the database upon deletion. %sAll form and submission data will be unrecoverable.%s', 'ninja-forms' ), '<span class="nf-nuke-warning">', '</span>' ),
|
95 |
-
),
|
96 |
-
array(
|
97 |
-
'name' => 'delete_prompt',
|
98 |
-
'type' => '',
|
99 |
-
'display_function' => 'nf_delete_on_uninstall_prompt',
|
100 |
-
),
|
101 |
-
array(
|
102 |
-
'name' => 'disable_admin_notices',
|
103 |
-
'type' => 'checkbox',
|
104 |
-
'label' => __( 'Disable Admin Notices', 'ninja-forms' ),
|
105 |
-
'desc' => __( 'Never see an admin notice on the dashboard from Ninja Forms. Uncheck to see them again.', 'ninja-forms' ),
|
106 |
-
),
|
107 |
-
),
|
108 |
-
'state' => 'closed',
|
109 |
-
);
|
110 |
-
$args['settings'] = apply_filters( 'nf_general_settings_advanced', $args['settings'] );
|
111 |
-
|
112 |
-
ninja_forms_register_tab_metabox( $args );
|
113 |
-
|
114 |
-
}
|
115 |
-
|
116 |
-
function nf_delete_on_uninstall_prompt() {
|
117 |
-
?>
|
118 |
-
<div class="nf-delete-on-uninstall-prompt">
|
119 |
-
<?php _e( 'This setting will COMPLETELY remove anything Ninja Forms related upon plugin deletion. This includes SUBMISSIONS and FORMS. It cannot be undone.', 'ninja-forms' ); ?>
|
120 |
-
</div>
|
121 |
-
<div class="nf-delete-on-uninstall-prompt-buttons">
|
122 |
-
<div id="nf-admin-modal-cancel">
|
123 |
-
<a class="submitdelete deletion modal-close nf-delete-on-uninstall-cancel" href="#"><?php _e( 'Cancel', 'ninja-forms' ); ?></a>
|
124 |
-
</div>
|
125 |
-
<div id="nf-admin-modal-update">
|
126 |
-
<a class="button-primary nf-delete-on-uninstall-yes" href="#"><?php _e( 'Continue', 'ninja-forms' ); ?></a>
|
127 |
-
</div>
|
128 |
-
</div>
|
129 |
-
|
130 |
-
<?php
|
131 |
-
}
|
132 |
-
|
133 |
-
function ninja_forms_save_general_settings( $data ){
|
134 |
-
$plugin_settings = nf_get_settings();
|
135 |
-
|
136 |
-
foreach( $data as $key => $val ){
|
137 |
-
$plugin_settings[$key] = $val;
|
138 |
-
}
|
139 |
-
|
140 |
-
update_option( 'ninja_forms_settings', $plugin_settings );
|
141 |
-
$update_msg = __( 'Settings Saved', 'ninja-forms' );
|
142 |
-
return $update_msg;
|
143 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/admin/pages/ninja-forms-settings/tabs/general-settings/index.php
DELETED
@@ -1,2 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
// Silence is golden.
|
|
|
|
deprecated/includes/admin/pages/ninja-forms-settings/tabs/index.php
DELETED
@@ -1,2 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
// Silence is golden.
|
|
|
|
deprecated/includes/admin/pages/ninja-forms-settings/tabs/label-settings/index.php
DELETED
@@ -1,2 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
// Silence is golden.
|
|
|
|
deprecated/includes/admin/pages/ninja-forms-settings/tabs/label-settings/label-settings.php
DELETED
@@ -1,104 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
add_action( 'init', 'ninja_forms_register_tab_label_settings' );
|
3 |
-
|
4 |
-
function ninja_forms_register_tab_label_settings(){
|
5 |
-
$args = array(
|
6 |
-
'name' => __( 'Labels', 'ninja-forms' ),
|
7 |
-
'page' => 'ninja-forms-settings',
|
8 |
-
'display_function' => '',
|
9 |
-
'save_function' => 'ninja_forms_save_label_settings',
|
10 |
-
);
|
11 |
-
ninja_forms_register_tab( 'label_settings', $args );
|
12 |
-
|
13 |
-
}
|
14 |
-
|
15 |
-
add_action( 'init', 'ninja_forms_register_label_settings_metabox' );
|
16 |
-
|
17 |
-
function ninja_forms_register_label_settings_metabox(){
|
18 |
-
|
19 |
-
$args = array(
|
20 |
-
'page' => 'ninja-forms-settings',
|
21 |
-
'tab' => 'label_settings',
|
22 |
-
'slug' => 'label_labels',
|
23 |
-
'title' => __( 'Message Labels', 'ninja-forms' ),
|
24 |
-
'settings' => array(
|
25 |
-
array(
|
26 |
-
'name' => 'req_div_label',
|
27 |
-
'type' => 'text',
|
28 |
-
'label' => __( 'Required Field Label', 'ninja-forms' ),
|
29 |
-
'desc' => '',
|
30 |
-
'help_text' => '',
|
31 |
-
),
|
32 |
-
array(
|
33 |
-
'name' => 'req_field_symbol',
|
34 |
-
'type' => 'text',
|
35 |
-
'label' => __( 'Required field symbol', 'ninja-forms' ),
|
36 |
-
),
|
37 |
-
array(
|
38 |
-
'name' => 'req_error_label',
|
39 |
-
'type' => 'text',
|
40 |
-
'label' => __( 'Error message given if all required fields are not completed', 'ninja-forms' ),
|
41 |
-
),
|
42 |
-
array(
|
43 |
-
'name' => 'req_field_error',
|
44 |
-
'type' => 'text',
|
45 |
-
'label' => __( 'Required Field Error', 'ninja-forms' ),
|
46 |
-
'desc' => '',
|
47 |
-
),
|
48 |
-
array(
|
49 |
-
'name' => 'spam_error',
|
50 |
-
'type' => 'text',
|
51 |
-
'label' => __( 'Anti-spam error message', 'ninja-forms' ),
|
52 |
-
'desc' => '',
|
53 |
-
),
|
54 |
-
array(
|
55 |
-
'name' => 'honeypot_error',
|
56 |
-
'type' => 'text',
|
57 |
-
'label' => __( 'Honeypot error message', 'ninja-forms' ),
|
58 |
-
'desc' => '',
|
59 |
-
),
|
60 |
-
array(
|
61 |
-
'name' => 'timed_submit_error',
|
62 |
-
'type' => 'text',
|
63 |
-
'label' => __( 'Timer error message', 'ninja-forms' ),
|
64 |
-
'desc' => '',
|
65 |
-
),
|
66 |
-
array(
|
67 |
-
'name' => 'javascript_error',
|
68 |
-
'type' => 'text',
|
69 |
-
'label' => __( 'JavaScript disabled error message', 'ninja-forms' ),
|
70 |
-
'desc' => '',
|
71 |
-
),
|
72 |
-
array(
|
73 |
-
'name' => 'invalid_email',
|
74 |
-
'type' => 'text',
|
75 |
-
'label' => __( 'Please enter a valid email address', 'ninja-forms' ),
|
76 |
-
'desc' => '',
|
77 |
-
),
|
78 |
-
array(
|
79 |
-
'name' => 'process_label',
|
80 |
-
'type' => 'text',
|
81 |
-
'label' => __( 'Processing Submission Label', 'ninja-forms' ),
|
82 |
-
'desc' => __( 'This message is shown inside the submit button whenever a user clicks "submit" to let them know it is processing.', 'ninja-forms' ),
|
83 |
-
),
|
84 |
-
array(
|
85 |
-
'name' => 'password_mismatch',
|
86 |
-
'type' => 'text',
|
87 |
-
'label' => __( 'Password Mismatch Label', 'ninja-forms' ),
|
88 |
-
'desc' => __( 'This message is shown to a user when non-matching values are placed in the password field.', 'ninja-forms' ),
|
89 |
-
),
|
90 |
-
),
|
91 |
-
);
|
92 |
-
ninja_forms_register_tab_metabox( $args );
|
93 |
-
|
94 |
-
}
|
95 |
-
|
96 |
-
function ninja_forms_save_label_settings( $data ){
|
97 |
-
$plugin_settings = nf_get_settings();
|
98 |
-
foreach( $data as $key => $val ){
|
99 |
-
$plugin_settings[$key] = $val;
|
100 |
-
}
|
101 |
-
update_option( "ninja_forms_settings", $plugin_settings );
|
102 |
-
$update_msg = __( 'Settings Saved', 'ninja-forms' );
|
103 |
-
return $update_msg;
|
104 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/admin/pages/ninja-forms-settings/tabs/license-settings/index.php
DELETED
@@ -1,2 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
// Silence is golden.
|
|
|
|
deprecated/includes/admin/pages/ninja-forms-settings/tabs/license-settings/license-settings.php
DELETED
@@ -1,102 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
function ninja_forms_register_tab_license_settings(){
|
3 |
-
$args = array(
|
4 |
-
'name' => __( 'Licenses', 'ninja-forms' ),
|
5 |
-
'page' => 'ninja-forms-settings',
|
6 |
-
'display_function' => 'nf_license_settings_save_button',
|
7 |
-
'save_function' => 'ninja_forms_save_license_settings',
|
8 |
-
'tab_reload' => true,
|
9 |
-
'show_save' => false,
|
10 |
-
);
|
11 |
-
ninja_forms_register_tab( 'license_settings', $args );
|
12 |
-
}
|
13 |
-
|
14 |
-
add_action( 'init', 'ninja_forms_register_tab_license_settings' );
|
15 |
-
|
16 |
-
function ninja_forms_register_license_settings_metabox(){
|
17 |
-
$args = array(
|
18 |
-
'page' => 'ninja-forms-settings',
|
19 |
-
'tab' => 'license_settings',
|
20 |
-
'slug' => 'license_settings',
|
21 |
-
'title' => __( 'Licenses', 'ninja-forms' ),
|
22 |
-
'display_function' => 'nf_license_settings_no_licenses_notice',
|
23 |
-
);
|
24 |
-
ninja_forms_register_tab_metabox( $args );
|
25 |
-
}
|
26 |
-
|
27 |
-
add_action( 'init', 'ninja_forms_register_license_settings_metabox' );
|
28 |
-
|
29 |
-
/**
|
30 |
-
* Output a save button so that we can call it: "Save & Activate"
|
31 |
-
*
|
32 |
-
* @since 2.9
|
33 |
-
* @return void
|
34 |
-
*/
|
35 |
-
function nf_license_settings_save_button() {
|
36 |
-
global $ninja_forms_tabs_metaboxes;
|
37 |
-
|
38 |
-
if ( ! isset ( $ninja_forms_tabs_metaboxes['ninja-forms-settings']['license_settings']['license_settings']['settings'] ) )
|
39 |
-
return false;
|
40 |
-
|
41 |
-
$show_save = false;
|
42 |
-
$show_deactivate = false;
|
43 |
-
|
44 |
-
// Loop through each of our licenses to set which buttons should be shown.
|
45 |
-
// We only want to show the "Save & Activate" button if there are no active licenses.
|
46 |
-
// We only want to show the "Deactivate All" button if there is at least one active license.
|
47 |
-
foreach ( $ninja_forms_tabs_metaboxes['ninja-forms-settings']['license_settings']['license_settings']['settings'] as $setting ) {
|
48 |
-
// Check to see if this license is valid.
|
49 |
-
$valid = $setting['save_function'][0]->is_valid();
|
50 |
-
// If we get a valid license, show deactivate all.
|
51 |
-
if ( $valid ) {
|
52 |
-
$show_deactivate = true;
|
53 |
-
} else { // If we get an invalid license, show the save button.
|
54 |
-
$show_save = true;
|
55 |
-
}
|
56 |
-
}
|
57 |
-
|
58 |
-
if ( $show_save ) {
|
59 |
-
?>
|
60 |
-
<input class="button-primary menu-save ninja-forms-save-data" id="ninja_forms_save_data_top" type="submit" value="<?php _e( 'Save & Activate', 'ninja-forms' ); ?>" />
|
61 |
-
<?php
|
62 |
-
}
|
63 |
-
|
64 |
-
if ( $show_deactivate ) {
|
65 |
-
?>
|
66 |
-
<input type="submit" class="button-secondary" id="nf_deactivate_all_licenses" name="deactivate_all" value="<?php _e( 'Deactivate All Licenses', 'ninja-forms' ); ?>">
|
67 |
-
<?php
|
68 |
-
}
|
69 |
-
}
|
70 |
-
|
71 |
-
/**
|
72 |
-
* Output a message letting the user know that they don't have any extensions with licenses activated.
|
73 |
-
*
|
74 |
-
* @since 2.9
|
75 |
-
* @return void
|
76 |
-
*/
|
77 |
-
function nf_license_settings_no_licenses_notice() {
|
78 |
-
global $ninja_forms_tabs_metaboxes;
|
79 |
-
|
80 |
-
if ( isset ( $ninja_forms_tabs_metaboxes['ninja-forms-settings']['license_settings']['license_settings']['settings'] ) ) {
|
81 |
-
return false;
|
82 |
-
}
|
83 |
-
|
84 |
-
$desc = sprintf( __( 'To activate licenses for Ninja Forms extensions you must first %sinstall and activate%s the chosen extension. License settings will then appear below.', 'ninja-forms' ), '<a target="_blank" href="https://ninjaforms.com/docs/installation/">', '</a>' );
|
85 |
-
?>
|
86 |
-
<tr id="row_license_key">
|
87 |
-
<td colspan="2"><?php echo $desc; ?></td>
|
88 |
-
</tr>
|
89 |
-
<?php
|
90 |
-
}
|
91 |
-
|
92 |
-
function ninja_forms_save_license_settings( $data ){
|
93 |
-
$plugin_settings = nf_get_settings();
|
94 |
-
|
95 |
-
foreach( $data as $key => $val ){
|
96 |
-
$plugin_settings[$key] = $val;
|
97 |
-
}
|
98 |
-
|
99 |
-
update_option( 'ninja_forms_settings', $plugin_settings );
|
100 |
-
|
101 |
-
return false;
|
102 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/admin/pages/ninja-forms/index.php
DELETED
@@ -1,2 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
// Silence is golden.
|
|
|
|
deprecated/includes/admin/pages/ninja-forms/tabs/field-settings/edit-field-ul.php
DELETED
@@ -1,24 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
add_action( 'ninja_forms_edit_field_ul', 'ninja_forms_edit_field_output_ul' );
|
3 |
-
function ninja_forms_edit_field_output_ul( $form_id ){
|
4 |
-
$fields = ninja_forms_get_fields_by_form_id( $form_id );
|
5 |
-
?>
|
6 |
-
<div id="ninja-forms-viewport">
|
7 |
-
<input class="button-primary menu-save nf-save-admin-fields" id="ninja_forms_save_data_top" type="button" value="<?php _e('Save', 'ninja-forms'); ?>" />
|
8 |
-
<a href="#" class="button-secondary nf-save-spinner" style="display:none;" disabled><span class="spinner nf-save-spinner" style="float:left;"></span></a>
|
9 |
-
<ul class="menu ninja-forms-field-list" id="ninja_forms_field_list">
|
10 |
-
<?php
|
11 |
-
if( is_array( $fields ) AND !empty( $fields ) ){
|
12 |
-
foreach( $fields as $field ){
|
13 |
-
ninja_forms_edit_field( $field['id'] );
|
14 |
-
}
|
15 |
-
}
|
16 |
-
?>
|
17 |
-
</ul>
|
18 |
-
|
19 |
-
<input class="button-primary menu-save nf-save-admin-fields" id="ninja_forms_save_data_bot" type="button" value="<?php _e('Save', 'ninja-forms'); ?>" />
|
20 |
-
<a href="#" class="button-secondary nf-save-spinner" style="display:none;" disabled><span class="spinner nf-save-spinner" style="float:left;"></span></a>
|
21 |
-
</div>
|
22 |
-
<?php
|
23 |
-
|
24 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/admin/pages/ninja-forms/tabs/field-settings/empty-rte.php
DELETED
@@ -1,15 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
add_action('admin_init', 'ninja_forms_register_empty_rte');
|
3 |
-
function ninja_forms_register_empty_rte(){
|
4 |
-
add_action('ninja_forms_edit_field_after_ul', 'ninja_forms_empty_rte');
|
5 |
-
}
|
6 |
-
|
7 |
-
function ninja_forms_empty_rte(){
|
8 |
-
?>
|
9 |
-
<div style="display:none;">
|
10 |
-
<?php
|
11 |
-
wp_editor('', '_empty_rte');
|
12 |
-
?>
|
13 |
-
</div>
|
14 |
-
<?php
|
15 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/admin/pages/ninja-forms/tabs/field-settings/field-settings.php
DELETED
@@ -1,93 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
|
3 |
-
function ninja_forms_register_tab_field_settings(){
|
4 |
-
if(isset($_REQUEST['form_id'])){
|
5 |
-
$form_id = absint( $_REQUEST['form_id'] );
|
6 |
-
}else{
|
7 |
-
$form_id = '';
|
8 |
-
}
|
9 |
-
|
10 |
-
$args = array(
|
11 |
-
'name' => __( 'Build Your Form', 'ninja-forms' ),
|
12 |
-
'page' => 'ninja-forms',
|
13 |
-
'display_function' => 'ninja_forms_tab_field_settings',
|
14 |
-
'disable_no_form_id' => true,
|
15 |
-
'show_save' => false,
|
16 |
-
'tab_reload' => false,
|
17 |
-
);
|
18 |
-
ninja_forms_register_tab( 'builder', $args );
|
19 |
-
}
|
20 |
-
|
21 |
-
add_action('admin_init', 'ninja_forms_register_tab_field_settings');
|
22 |
-
|
23 |
-
function ninja_forms_tab_field_settings(){
|
24 |
-
global $wpdb;
|
25 |
-
|
26 |
-
if ( isset ( $_REQUEST['form_id'] ) ) {
|
27 |
-
$form_id = absint( $_REQUEST['form_id'] );
|
28 |
-
} else {
|
29 |
-
$form_id = '';
|
30 |
-
}
|
31 |
-
|
32 |
-
if ( ! empty ( $form_id ) && 'new' != $form_id ) {
|
33 |
-
do_action( 'ninja_forms_edit_field_before_ul', $form_id );
|
34 |
-
do_action( 'ninja_forms_edit_field_ul', $form_id );
|
35 |
-
do_action( 'ninja_forms_edit_field_after_ul', $form_id );
|
36 |
-
}
|
37 |
-
|
38 |
-
?>
|
39 |
-
<div style="display:none;">
|
40 |
-
<div id="nf-save-title">
|
41 |
-
<div id="admin-modal-selector">
|
42 |
-
<div id="admin-modal-options">
|
43 |
-
<div>
|
44 |
-
<label><input id="nf-form-title" class="widefat" style="width:100%;" type="text" name="admin-modaltitle" placeholder="<?php _e( 'Give your form a title. This is how you\'ll find the form later.', 'ninja-forms' ); ?>"></label>
|
45 |
-
</div>
|
46 |
-
</div>
|
47 |
-
<div id="nf-insert-submit-div">
|
48 |
-
<div class="admin-modal-target">
|
49 |
-
<p class="howto"><?php _e( 'You have not added a submit button to your form.', 'ninja-forms' ); ?></p>
|
50 |
-
<label><span> </span><input type="checkbox" id="nf-insert-submit" value="1" checked> Insert Submit Button</label>
|
51 |
-
</div>
|
52 |
-
</div>
|
53 |
-
</div>
|
54 |
-
</div>
|
55 |
-
|
56 |
-
<div id="nf-save-title-buttons">
|
57 |
-
<div id="nf-admin-modal-cancel">
|
58 |
-
<a class="submitdelete deletion modal-close" href="#">Cancel</a>
|
59 |
-
</div>
|
60 |
-
<div id="nf-admin-modal-update">
|
61 |
-
<input type="submit" value="Save" class="button button-secondary" id="nf-save-title-submit" disabled>
|
62 |
-
</div>
|
63 |
-
</div>
|
64 |
-
</div>
|
65 |
-
<?php
|
66 |
-
}
|
67 |
-
|
68 |
-
/**
|
69 |
-
* Listen for a new form action and create one if necessary.
|
70 |
-
*
|
71 |
-
* @since 2.9
|
72 |
-
* @return void
|
73 |
-
*/
|
74 |
-
function nf_create_form_listen() {
|
75 |
-
$page = isset ( $_REQUEST['page'] ) ? $_REQUEST['page'] : '';
|
76 |
-
$tab = isset ( $_REQUEST['tab'] ) ? $_REQUEST['tab'] : '';
|
77 |
-
$form_id = isset ( $_REQUEST['form_id'] ) ? $_REQUEST['form_id'] : '';
|
78 |
-
|
79 |
-
if ( 'ninja-forms' == $page && 'builder' == $tab && 'new' == $form_id ) {
|
80 |
-
$defaults = apply_filters( 'nf_new_form_defaults', array(
|
81 |
-
'clear_complete' => 1,
|
82 |
-
'hide_complete' => 1,
|
83 |
-
'show_title' => 0,
|
84 |
-
'status' => 'new',
|
85 |
-
) );
|
86 |
-
$form_id = Ninja_Forms()->form()->create( $defaults );
|
87 |
-
$redirect = esc_url_raw( add_query_arg( array( 'form_id' => $form_id ) ) );
|
88 |
-
wp_redirect( $redirect );
|
89 |
-
die();
|
90 |
-
}
|
91 |
-
}
|
92 |
-
|
93 |
-
add_action( 'admin_init', 'nf_create_form_listen', 5 );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/admin/pages/ninja-forms/tabs/field-settings/help.php
DELETED
@@ -1,30 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
add_action( 'init', 'ninja_forms_register_field_settings_help', 9 );
|
3 |
-
function ninja_forms_register_field_settings_help(){
|
4 |
-
$args = array(
|
5 |
-
'page' => 'ninja-forms',
|
6 |
-
'tab' => 'builder',
|
7 |
-
'title' => __( 'Input Mask', 'ninja-forms' ),
|
8 |
-
'display_function' => 'ninja_forms_help_field_settings',
|
9 |
-
);
|
10 |
-
ninja_forms_register_help_screen_tab('mask_help', $args);
|
11 |
-
}
|
12 |
-
|
13 |
-
function ninja_forms_help_field_settings(){
|
14 |
-
?>
|
15 |
-
<p><?php _e('Any character you place in the "custom mask" box that is not in the list below will be automatically entered for the user as they type and will not be removeable', 'ninja-forms');?>.</p>
|
16 |
-
</p><?php _e('These are the predefined masking characters', 'ninja-forms');?>:
|
17 |
-
<ul>
|
18 |
-
<li><?php _e('a - Represents an alpha character (A-Z,a-z) - Only allows letters to be entered', 'ninja-forms');?>.</li>
|
19 |
-
<li><?php _e('9 - Represents a numeric character (0-9) - Only allows numbers to be entered', 'ninja-forms');?>.</li>
|
20 |
-
<li><?php _e('* - Represents an alphanumeric character (A-Z,a-z,0-9) - This allows both numbers and letters to be entered', 'ninja-forms');?>.</li>
|
21 |
-
</ul>
|
22 |
-
</p>
|
23 |
-
<p>
|
24 |
-
<?php _e('So, if you wanted to create a mask for an American Social Security Number, you would type 999-99-9999 into the box', 'ninja-forms');?>. <?php _e('The 9s would represent any number, and the -s would be automatically added', 'ninja-forms');?>. <?php _e('This would prevent the user from putting in anything other than numbers', 'ninja-forms');?>.
|
25 |
-
</p>
|
26 |
-
<p>
|
27 |
-
<?php _e('You can also combine these for specific applications', 'ninja-forms');?>. <?php _e('For instance, if you had a product key that was in the form of A4B51.989.B.43C, you could mask it with: a9a99.999.a.99a, which would force all the a\'s to be letters and the 9s to be numbers', 'ninja-forms');?>.
|
28 |
-
</p>
|
29 |
-
<?php
|
30 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/admin/pages/ninja-forms/tabs/field-settings/index.php
DELETED
@@ -1,2 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
// Silence is golden.
|
|
|
|
deprecated/includes/admin/pages/ninja-forms/tabs/field-settings/sidebars/def-fields.php
DELETED
@@ -1,34 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
//add_action('admin_init', 'ninja_forms_register_sidebar_def_fields');
|
3 |
-
|
4 |
-
function ninja_forms_register_sidebar_def_fields(){
|
5 |
-
$args = array(
|
6 |
-
'name' => __( 'Defined Fields', 'ninja-forms' ),
|
7 |
-
'page' => 'ninja-forms',
|
8 |
-
'tab' => 'builder',
|
9 |
-
'display_function' => 'ninja_forms_sidebar_def_fields'
|
10 |
-
);
|
11 |
-
ninja_forms_register_sidebar('def_fields', $args);
|
12 |
-
}
|
13 |
-
|
14 |
-
function ninja_forms_sidebar_def_fields(){
|
15 |
-
global $wpdb, $ninja_forms_fields;
|
16 |
-
$field_results = ninja_forms_get_all_defs();
|
17 |
-
|
18 |
-
if(is_array($field_results)){
|
19 |
-
foreach($field_results as $field){
|
20 |
-
$data = $field['data'];
|
21 |
-
$name = $field['name'];
|
22 |
-
$field_id = $field['id'];
|
23 |
-
$type = $field['type'];
|
24 |
-
$reg_field = $ninja_forms_fields[$type];
|
25 |
-
$limit = $reg_field['limit'];
|
26 |
-
|
27 |
-
?>
|
28 |
-
<p class="button-controls" id="ninja_forms_insert_def_field_<?php echo $field_id;?>_p">
|
29 |
-
<a class="button-secondary ninja-forms-insert-def-field" id="ninja_forms_insert_def_field_<?php echo $field_id;?>" data-limit="<?php echo $limit; ?>" data-field="<?php echo $field_id; ?>" data-type="<?php echo $type; ?>" href="#" ><?php _e( $name, 'ninja-forms' ); ?></a>
|
30 |
-
</p>
|
31 |
-
<?php
|
32 |
-
}
|
33 |
-
}
|
34 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/admin/pages/ninja-forms/tabs/field-settings/sidebars/fav-fields.php
DELETED
@@ -1,29 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
add_action('admin_init', 'ninja_forms_register_sidebar_fav_fields');
|
3 |
-
|
4 |
-
function ninja_forms_register_sidebar_fav_fields(){
|
5 |
-
$args = array(
|
6 |
-
'name' => __( 'Favorite Fields', 'ninja-forms' ),
|
7 |
-
'page' => 'ninja-forms',
|
8 |
-
'tab' => 'builder',
|
9 |
-
'display_function' => 'ninja_forms_sidebar_fav_fields'
|
10 |
-
);
|
11 |
-
ninja_forms_register_sidebar('fav_fields', $args);
|
12 |
-
}
|
13 |
-
|
14 |
-
function ninja_forms_sidebar_fav_fields(){
|
15 |
-
$field_results = ninja_forms_get_all_favs();
|
16 |
-
|
17 |
-
if(is_array($field_results)){
|
18 |
-
foreach($field_results as $field){
|
19 |
-
$data = $field['data'];
|
20 |
-
$name = $field['name'];
|
21 |
-
$field_id = $field['id'];
|
22 |
-
?>
|
23 |
-
<p class="button-controls" id="ninja_forms_insert_fav_field_<?php echo $field_id;?>_p">
|
24 |
-
<a class="button-secondary ninja-forms-insert-fav-field" id="ninja_forms_insert_fav_field_<?php echo $field_id;?>" data-field="<?php echo $field_id; ?>" data-type="fav" href="#"><?php _e($name, 'ninja-forms');?></a>
|
25 |
-
</p>
|
26 |
-
<?php
|
27 |
-
}
|
28 |
-
}
|
29 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/admin/pages/ninja-forms/tabs/field-settings/sidebars/index.php
DELETED
@@ -1,2 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
// Silence is golden.
|
|
|
|
deprecated/includes/admin/pages/ninja-forms/tabs/field-settings/sidebars/layout-fields.php
DELETED
@@ -1,12 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
add_action('admin_init', 'ninja_forms_register_sidebar_layout_fields');
|
3 |
-
|
4 |
-
function ninja_forms_register_sidebar_layout_fields(){
|
5 |
-
$args = array(
|
6 |
-
'name' => __( 'Layout Elements', 'ninja-forms' ),
|
7 |
-
'page' => 'ninja-forms',
|
8 |
-
'tab' => 'builder',
|
9 |
-
'display_function' => 'ninja_forms_sidebar_display_fields'
|
10 |
-
);
|
11 |
-
ninja_forms_register_sidebar('layout_fields', $args);
|
12 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/admin/pages/ninja-forms/tabs/field-settings/sidebars/payment-fields.php
DELETED
@@ -1,49 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
/*
|
3 |
-
*
|
4 |
-
* Function that adds our payment sidebar.
|
5 |
-
*
|
6 |
-
* @since 2.2.30
|
7 |
-
* @returns void
|
8 |
-
*/
|
9 |
-
|
10 |
-
function ninja_forms_register_sidebar_payment_fields(){
|
11 |
-
$args = array(
|
12 |
-
'name' => __( 'Payment Fields', 'ninja-forms' ),
|
13 |
-
'page' => 'ninja-forms',
|
14 |
-
'tab' => 'builder',
|
15 |
-
'display_function' => 'ninja_forms_sidebar_payment_fields'
|
16 |
-
);
|
17 |
-
ninja_forms_register_sidebar('payment_fields', $args);
|
18 |
-
}
|
19 |
-
|
20 |
-
function ninja_forms_sidebar_payment_fields(){
|
21 |
-
global $wpdb, $ninja_forms_fields;
|
22 |
-
$field_results = ninja_forms_get_all_defs();
|
23 |
-
|
24 |
-
if(is_array($field_results)){
|
25 |
-
foreach($field_results as $field){
|
26 |
-
$data = $field['data'];
|
27 |
-
if ( isset ( $data['payment_field_group'] ) AND $data['payment_field_group'] == 1 ) {
|
28 |
-
$name = $field['name'];
|
29 |
-
$field_id = $field['id'];
|
30 |
-
$type = $field['type'];
|
31 |
-
if ( isset ( $ninja_forms_fields[$type] ) ) {
|
32 |
-
$reg_field = $ninja_forms_fields[$type];
|
33 |
-
|
34 |
-
$limit = '';
|
35 |
-
|
36 |
-
?>
|
37 |
-
<p class="button-controls" id="ninja_forms_insert_def_field_<?php echo $field_id;?>_p">
|
38 |
-
<a class="button-secondary ninja-forms-insert-def-field" id="ninja_forms_insert_def_field_<?php echo $field_id;?>" data-limit="<?php echo $limit; ?>" data-field="<?php echo $field_id; ?>" data-type="<?php echo $type; ?>" href="#" rel="<?php echo $type;?>"><?php _e( $name, 'ninja-forms' ); ?></a>
|
39 |
-
</p>
|
40 |
-
<?php
|
41 |
-
}
|
42 |
-
}
|
43 |
-
}
|
44 |
-
}
|
45 |
-
|
46 |
-
|
47 |
-
}
|
48 |
-
|
49 |
-
add_action('admin_init', 'ninja_forms_register_sidebar_payment_fields');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/admin/pages/ninja-forms/tabs/field-settings/sidebars/post-fields.php
DELETED
@@ -1,48 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
|
3 |
-
// For backwards compatibilty, make sure that this function doesn't already exist.
|
4 |
-
if ( !function_exists ( 'ninja_forms_register_field_post_tags' ) ) {
|
5 |
-
function ninja_forms_register_sidebar_post_fields(){
|
6 |
-
$add_field = apply_filters( 'ninja_forms_use_post_fields', false );
|
7 |
-
if ( !$add_field )
|
8 |
-
return false;
|
9 |
-
|
10 |
-
if(isset($_REQUEST['form_id'])){
|
11 |
-
$form_id = absint( $_REQUEST['form_id'] );
|
12 |
-
}else{
|
13 |
-
$form_id = '';
|
14 |
-
}
|
15 |
-
if( function_exists( 'ninja_forms_get_current_tab' ) ){
|
16 |
-
$current_tab = ninja_forms_get_current_tab();
|
17 |
-
}
|
18 |
-
if($form_id != '' AND $current_tab == 'fields'){
|
19 |
-
$form_row = ninja_forms_get_form_by_id($form_id);
|
20 |
-
if(is_array($form_row) AND !empty($form_row)){
|
21 |
-
$form_data = $form_row['data'];
|
22 |
-
if( isset( $form_data['create_post'] ) ){
|
23 |
-
$create_post = $form_data['create_post'];
|
24 |
-
}else{
|
25 |
-
$create_post = '';
|
26 |
-
}
|
27 |
-
|
28 |
-
}else{
|
29 |
-
$create_post = '';
|
30 |
-
}
|
31 |
-
}else{
|
32 |
-
$create_post = '';
|
33 |
-
}
|
34 |
-
$args = array(
|
35 |
-
'name' => 'Post Creation Fields',
|
36 |
-
'page' => 'ninja-forms',
|
37 |
-
'tab' => 'builder',
|
38 |
-
'display_function' => 'ninja_forms_sidebar_display_fields'
|
39 |
-
);
|
40 |
-
if($create_post == 1){
|
41 |
-
if( function_exists( 'ninja_forms_register_sidebar' ) ){
|
42 |
-
ninja_forms_register_sidebar('post_fields', $args);
|
43 |
-
}
|
44 |
-
}
|
45 |
-
}
|
46 |
-
|
47 |
-
add_action( 'admin_init', 'ninja_forms_register_sidebar_post_fields' );
|
48 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/admin/pages/ninja-forms/tabs/field-settings/sidebars/template-fields.php
DELETED
@@ -1,12 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
add_action('admin_init', 'ninja_forms_register_sidebar_template_fields');
|
3 |
-
|
4 |
-
function ninja_forms_register_sidebar_template_fields(){
|
5 |
-
$args = array(
|
6 |
-
'name' => __( 'Template Fields', 'ninja-forms' ),
|
7 |
-
'page' => 'ninja-forms',
|
8 |
-
'tab' => 'builder',
|
9 |
-
'display_function' => 'ninja_forms_sidebar_display_fields'
|
10 |
-
);
|
11 |
-
ninja_forms_register_sidebar('template_fields', $args);
|
12 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/admin/pages/ninja-forms/tabs/field-settings/sidebars/user-info.php
DELETED
@@ -1,46 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
/*
|
3 |
-
*
|
4 |
-
* Function that adds our user info sidebar.
|
5 |
-
*
|
6 |
-
* @since 2.2.30
|
7 |
-
* @returns void
|
8 |
-
*/
|
9 |
-
|
10 |
-
function ninja_forms_register_sidebar_user_info_fields(){
|
11 |
-
$args = array(
|
12 |
-
'name' => __( 'User Information', 'ninja-forms' ),
|
13 |
-
'page' => 'ninja-forms',
|
14 |
-
'tab' => 'builder',
|
15 |
-
'display_function' => 'ninja_forms_sidebar_user_info_fields'
|
16 |
-
);
|
17 |
-
ninja_forms_register_sidebar('user_info', $args);
|
18 |
-
}
|
19 |
-
|
20 |
-
function ninja_forms_sidebar_user_info_fields(){
|
21 |
-
global $wpdb, $ninja_forms_fields;
|
22 |
-
$field_results = ninja_forms_get_all_defs();
|
23 |
-
|
24 |
-
if(is_array($field_results)){
|
25 |
-
foreach($field_results as $field){
|
26 |
-
$data = $field['data'];
|
27 |
-
if ( isset ( $data['user_info_field_group'] ) AND $data['user_info_field_group'] == 1 ) {
|
28 |
-
$name = $field['name'];
|
29 |
-
$field_id = $field['id'];
|
30 |
-
$type = $field['type'];
|
31 |
-
$reg_field = $ninja_forms_fields[$type];
|
32 |
-
$limit = '';
|
33 |
-
|
34 |
-
?>
|
35 |
-
<p class="button-controls" id="ninja_forms_insert_def_field_<?php echo $field_id;?>_p">
|
36 |
-
<a class="button-secondary ninja-forms-insert-def-field" id="ninja_forms_insert_def_field_<?php echo $field_id;?>" data-limit="<?php echo $limit; ?>" data-field="<?php echo $field_id; ?>" data-type="<?php echo $type; ?>" href="#"><?php _e($name, 'ninja-forms');?></a>
|
37 |
-
</p>
|
38 |
-
<?php
|
39 |
-
}
|
40 |
-
}
|
41 |
-
}
|
42 |
-
|
43 |
-
|
44 |
-
}
|
45 |
-
|
46 |
-
add_action('admin_init', 'ninja_forms_register_sidebar_user_info_fields');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/admin/pages/ninja-forms/tabs/form-list/form-list.php
DELETED
@@ -1,251 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
|
3 |
-
|
4 |
-
function ninja_forms_register_form_export(){
|
5 |
-
if( isset( $_REQUEST['export_form'] ) AND $_REQUEST['export_form'] == 1 ){
|
6 |
-
$form_id = absint( $_REQUEST['form_id'] );
|
7 |
-
ninja_forms_export_form( $form_id );
|
8 |
-
}
|
9 |
-
}
|
10 |
-
|
11 |
-
add_action( 'admin_init', 'ninja_forms_register_form_export' );
|
12 |
-
|
13 |
-
function ninja_forms_register_form_duplicate(){
|
14 |
-
if ( isset ( $_REQUEST['duplicate_form'] ) AND $_REQUEST['duplicate_form'] == 1 ) {
|
15 |
-
$form_id = absint( $_REQUEST['form_id'] );
|
16 |
-
$form_row = ninja_forms_serialize_form( $form_id );
|
17 |
-
ninja_forms_import_form( $form_row );
|
18 |
-
$url = esc_url_raw( remove_query_arg( array( 'duplicate_form', 'form_id' ) ) );
|
19 |
-
wp_redirect( $url );
|
20 |
-
}
|
21 |
-
}
|
22 |
-
|
23 |
-
add_action( 'admin_init', 'ninja_forms_register_form_duplicate' );
|
24 |
-
|
25 |
-
function ninja_forms_register_tab_form_list(){
|
26 |
-
$new_link = esc_url( add_query_arg( array('form_id' => 'new', 'tab' => 'form_settings') ) );
|
27 |
-
$args = array(
|
28 |
-
'name' => __( 'All Forms', 'ninja-forms' ),
|
29 |
-
'page' => 'ninja-forms',
|
30 |
-
'display_function' => 'ninja_forms_tab_form_list',
|
31 |
-
'save_function' => 'ninja_forms_save_form_list',
|
32 |
-
'show_save' => false,
|
33 |
-
'active_class' => 'form-list-active',
|
34 |
-
'inactive_class' => 'form-list-inactive',
|
35 |
-
'show_tab_links' => false,
|
36 |
-
'show_this_tab_link' => false,
|
37 |
-
// 'title' => '<h2>Forms <a href="'.$new_link.'" class="add-new-h2">'.__( 'Add New Form', 'ninja-forms' ).'</a></h2>',
|
38 |
-
);
|
39 |
-
ninja_forms_register_tab('form_list', $args);
|
40 |
-
}
|
41 |
-
|
42 |
-
add_action('admin_init', 'ninja_forms_register_tab_form_list');
|
43 |
-
|
44 |
-
function ninja_forms_tab_form_list(){
|
45 |
-
|
46 |
-
do_action( 'nf_admin_before_form_list' );
|
47 |
-
|
48 |
-
$all_forms = apply_filters( 'ninja_forms_form_list_forms', Ninja_Forms()->forms()->get_all() );
|
49 |
-
|
50 |
-
$form_count = count($all_forms);
|
51 |
-
|
52 |
-
if( isset( $_REQUEST['limit'] ) ){
|
53 |
-
$saved_limit = absint( $_REQUEST['limit'] );
|
54 |
-
$limit = absint( $_REQUEST['limit'] );
|
55 |
-
}else{
|
56 |
-
$saved_limit = 20;
|
57 |
-
$limit = 20;
|
58 |
-
}
|
59 |
-
|
60 |
-
if( $form_count < $limit ){
|
61 |
-
$limit = $form_count;
|
62 |
-
}
|
63 |
-
|
64 |
-
if( isset( $_REQUEST['paged']) AND !empty( $_REQUEST['paged'] ) ){
|
65 |
-
$current_page = absint( $_REQUEST['paged'] );
|
66 |
-
}else{
|
67 |
-
$current_page = 1;
|
68 |
-
}
|
69 |
-
|
70 |
-
if( $form_count > $limit ){
|
71 |
-
$page_count = ceil( $form_count / $limit );
|
72 |
-
}else{
|
73 |
-
$page_count = 1;
|
74 |
-
}
|
75 |
-
|
76 |
-
if( $current_page > 1 ){
|
77 |
-
$start = ( ( $current_page - 1 ) * $limit );
|
78 |
-
if( $form_count < $limit ){
|
79 |
-
$end = $form_count;
|
80 |
-
}else{
|
81 |
-
$end = $current_page * $limit;
|
82 |
-
// $end = $end - 1;
|
83 |
-
}
|
84 |
-
|
85 |
-
if( $end > $form_count ){
|
86 |
-
$end = $form_count;
|
87 |
-
}
|
88 |
-
}else{
|
89 |
-
$start = 0;
|
90 |
-
$end = $limit;
|
91 |
-
}
|
92 |
-
|
93 |
-
?>
|
94 |
-
|
95 |
-
<ul class="subsubsub">
|
96 |
-
<li class="all"><a href="" class="current"><?php _e( 'All', 'ninja-forms' ); ?> <span class="count">(<?php echo $form_count;?>)</span></a>
|
97 |
-
</ul>
|
98 |
-
<div id="" class="tablenav top">
|
99 |
-
<div class="alignleft actions">
|
100 |
-
<select id="" class="" name="bulk_action">
|
101 |
-
<option value=""><?php _e( 'Bulk Actions', 'ninja-forms' );?></option>
|
102 |
-
<option value="delete"><?php _e( 'Delete', 'ninja-forms' );?></option>
|
103 |
-
</select>
|
104 |
-
<input type="submit" name="submit" value="<?php _e( 'Apply', 'ninja-forms' ); ?>" class="button-secondary">
|
105 |
-
</div>
|
106 |
-
<div class="alignleft actions">
|
107 |
-
<select id="" name="limit">
|
108 |
-
<option value="20" <?php selected($saved_limit, 20);?>>20</option>
|
109 |
-
<option value="50" <?php selected($saved_limit, 50);?>>50</option>
|
110 |
-
<option value="100" <?php selected($saved_limit, 100);?>>100</option>
|
111 |
-
</select>
|
112 |
-
<?php _e( 'Forms Per Page', 'ninja-forms' ); ?>
|
113 |
-
<input type="submit" name="submit" value="<?php _e( 'Go', 'ninja-forms' ); ?>" class="button-secondary">
|
114 |
-
</div>
|
115 |
-
<div id="" class="alignright navtable-pages">
|
116 |
-
<?php
|
117 |
-
if($form_count != 0 AND $current_page <= $page_count){
|
118 |
-
?>
|
119 |
-
<span class="displaying-num"><?php if($start == 0){ echo 1; }else{ echo $start; }?> - <?php echo $end;?> <?php _e( 'of', 'ninja-forms' ); ?> <?php echo $form_count;?> <?php if($form_count == 1){ _e( 'Form', 'ninja-forms' ); }else{ _e( 'Forms', 'ninja-forms' ); }?></span>
|
120 |
-
<?php
|
121 |
-
}
|
122 |
-
if($page_count > 1){
|
123 |
-
|
124 |
-
$first_page = esc_url( remove_query_arg( 'paged' ) );
|
125 |
-
$last_page = esc_url( add_query_arg( array( 'paged' => $page_count ) ) );
|
126 |
-
|
127 |
-
if($current_page > 1){
|
128 |
-
$prev_page = $current_page - 1;
|
129 |
-
$prev_page = esc_url( add_query_arg( array('paged' => $prev_page ) ) );
|
130 |
-
}else{
|
131 |
-
$prev_page = $first_page;
|
132 |
-
}
|
133 |
-
if($current_page != $page_count){
|
134 |
-
$next_page = $current_page + 1;
|
135 |
-
$next_page = esc_url( add_query_arg( array('paged' => $next_page ) ) );
|
136 |
-
}else{
|
137 |
-
$next_page = $last_page;
|
138 |
-
}
|
139 |
-
|
140 |
-
?>
|
141 |
-
<span class="pagination-links">
|
142 |
-
<a class="first-page disabled" title="<?php _e( 'Go to the first page', 'ninja-forms' ); ?>" href="<?php echo $first_page;?>">«</a>
|
143 |
-
<a class="prev-page disabled" title="<?php _e( 'Go to the previous page', 'ninja-forms' ); ?>" href="<?php echo $prev_page;?>">‹</a>
|
144 |
-
<span class="paging-input"><input class="current-page" title="<?php _e( 'Current page', 'ninja-forms' ); ?>" type="text" name="paged" value="<?php echo $current_page;?>" size="2"> <?php _e( 'of', 'ninja-forms' ); ?> <span class="total-pages"><?php echo $page_count;?></span></span>
|
145 |
-
<a class="next-page" title="<?php _e( 'Go to the next page', 'ninja-forms' ); ?>" href="<?php echo $next_page;?>">›</a>
|
146 |
-
<a class="last-page" title="<?php _e( 'Go to the last page', 'ninja-forms' ); ?>" href="<?php echo $last_page;?>">»</a>
|
147 |
-
</span>
|
148 |
-
<?php
|
149 |
-
}
|
150 |
-
?>
|
151 |
-
</div>
|
152 |
-
</div>
|
153 |
-
<table class="wp-list-table widefat fixed posts">
|
154 |
-
<thead>
|
155 |
-
<tr>
|
156 |
-
<th class="check-column"><input type="checkbox" id="" class="ninja-forms-select-all" title="ninja-forms-bulk-action"></th>
|
157 |
-
<th><?php _e( 'Form Title', 'ninja-forms' );?></th>
|
158 |
-
<th><?php _e( 'Shortcode', 'ninja-forms' );?></th>
|
159 |
-
<th><?php _e( 'Template Function', 'ninja-forms' );?></th>
|
160 |
-
<th><?php _e( 'Date Updated', 'ninja-forms' );?></th>
|
161 |
-
</tr>
|
162 |
-
</thead>
|
163 |
-
<tbody>
|
164 |
-
<?php
|
165 |
-
if(is_array($all_forms) AND !empty($all_forms) AND $current_page <= $page_count){
|
166 |
-
for ($i = $start; $i < $end; $i++) {
|
167 |
-
$form_id = $all_forms[$i];
|
168 |
-
$data = Ninja_Forms()->form( $form_id )->get_all_settings();
|
169 |
-
$date_updated = $data['date_updated'];
|
170 |
-
$date_updated = strtotime( $date_updated );
|
171 |
-
$date_updated = date_i18n( 'F d, Y', $date_updated );
|
172 |
-
$link = esc_url( remove_query_arg( array( 'paged' ) ) );
|
173 |
-
$edit_link = esc_url( add_query_arg( array( 'tab' => 'builder', 'form_id' => $form_id ), $link ) );
|
174 |
-
$subs_link = admin_url( 'edit.php?post_status=all&post_type=nf_sub&action=-1&m=0&form_id=' . $form_id . '&paged=1&mode=list&action2=-1' );
|
175 |
-
$duplicate_link = esc_url( add_query_arg( array( 'duplicate_form' => 1, 'form_id' => $form_id ), $link ) );
|
176 |
-
$shortcode = apply_filters ( "ninja_forms_form_list_shortcode", "[ninja_forms id=" . $form_id . "]", $form_id );
|
177 |
-
$template_function = apply_filters ( "ninja_forms_form_list_template_function", "<pre>if( function_exists( 'ninja_forms_display_form' ) ){ ninja_forms_display_form( " . "$form_id" . " ); }</pre>", $form_id );
|
178 |
-
?>
|
179 |
-
<tr id="ninja_forms_form_<?php echo $form_id;?>_tr">
|
180 |
-
<th scope="row" class="check-column">
|
181 |
-
<input type="checkbox" id="" name="form_ids[]" value="<?php echo $form_id;?>" class="ninja-forms-bulk-action">
|
182 |
-
</th>
|
183 |
-
<td class="post-title page-title column-title">
|
184 |
-
<strong>
|
185 |
-
<a href="<?php echo $edit_link;?>"><?php echo stripslashes( $data['form_title'] );?></a>
|
186 |
-
</strong>
|
187 |
-
<div class="row-actions">
|
188 |
-
<span class="edit"><a href="<?php echo $edit_link;?>"><?php _e( 'Edit', 'ninja-forms' ); ?></a> | </span>
|
189 |
-
<span class="trash"><a class="ninja-forms-delete-form" title="<?php _e( 'Delete this form', 'ninja-forms' ); ?>" href="#" id="ninja_forms_delete_form_<?php echo $form_id;?>"><?php _e( 'Delete', 'ninja-forms' ); ?></a> | </span>
|
190 |
-
<span class="duplicate"><a href="<?php echo $duplicate_link;?>" title="<?php _e( 'Duplicate Form', 'ninja-forms' ); ?>"><?php _e( 'Duplicate', 'ninja-forms' ); ?></a> | </span>
|
191 |
-
<span class="bleep"><?php echo ninja_forms_preview_link( $form_id ); ?> | </span>
|
192 |
-
<span class="subs"><a href="<?php echo $subs_link;?>" class="" title="<?php _e( 'View Submissions', 'ninja-forms' ); ?>"><?php _e( 'View Submissions', 'ninja-forms' ); ?></a></span>
|
193 |
-
</div>
|
194 |
-
</td>
|
195 |
-
<td>
|
196 |
-
<?php echo $shortcode; ?>
|
197 |
-
</td>
|
198 |
-
<td>
|
199 |
-
<?php echo $template_function; ?>
|
200 |
-
</td>
|
201 |
-
<td>
|
202 |
-
<?php echo $date_updated;?>
|
203 |
-
</td>
|
204 |
-
</tr>
|
205 |
-
|
206 |
-
<?php
|
207 |
-
}
|
208 |
-
}else{
|
209 |
-
|
210 |
-
|
211 |
-
} //End $all_forms if statement
|
212 |
-
?>
|
213 |
-
</tbody>
|
214 |
-
<tfoot>
|
215 |
-
<tr>
|
216 |
-
<th class="check-column"><input type="checkbox" id="" class="ninja-forms-select-all" title="ninja-forms-bulk-action"></th>
|
217 |
-
<th><?php _e( 'Form Title', 'ninja-forms' );?></th>
|
218 |
-
<th><?php _e( 'Shortcode', 'ninja-forms' );?></th>
|
219 |
-
<th><?php _e( 'Template Function', 'ninja-forms' );?></th>
|
220 |
-
<th><?php _e( 'Date Updated', 'ninja-forms' );?></th>
|
221 |
-
</tr>
|
222 |
-
</tfoot>
|
223 |
-
</table>
|
224 |
-
<?php
|
225 |
-
}
|
226 |
-
|
227 |
-
function ninja_forms_save_form_list( $data ){
|
228 |
-
if( isset( $data['bulk_action'] ) AND $data['bulk_action'] != '' ){
|
229 |
-
if( isset( $data['form_ids'] ) AND is_array( $data['form_ids'] ) AND !empty( $data['form_ids'] ) ){
|
230 |
-
foreach( $data['form_ids'] as $form_id ){
|
231 |
-
switch( $data['bulk_action'] ){
|
232 |
-
case 'delete':
|
233 |
-
Ninja_Forms()->form( $form_id )->delete();
|
234 |
-
$ninja_forms_admin_update_message = count( $data['form_ids'] ).' ';
|
235 |
-
if( count( $data['form_ids'] ) > 1 ){
|
236 |
-
$update_message = __( 'Forms Deleted', 'ninja-forms' );
|
237 |
-
}else{
|
238 |
-
$update_message = __( 'Form Deleted', 'ninja-forms' );
|
239 |
-
}
|
240 |
-
break;
|
241 |
-
case 'export':
|
242 |
-
ninja_forms_export_form( $form_id );
|
243 |
-
break;
|
244 |
-
}
|
245 |
-
}
|
246 |
-
}
|
247 |
-
$debug = ! empty ( $_REQUEST['debug'] ) ? true : false;
|
248 |
-
Ninja_Forms()->forms()->update_cache( $debug );
|
249 |
-
return $update_message;
|
250 |
-
}
|
251 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/admin/pages/ninja-forms/tabs/form-list/index.php
DELETED
@@ -1,2 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
// Silence is golden.
|
|
|
|
deprecated/includes/admin/pages/ninja-forms/tabs/form-preview/form-preview.php
DELETED
@@ -1,23 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
|
3 |
-
function ninja_forms_register_tab_form_preview(){
|
4 |
-
if(isset($_REQUEST['form_id'])){
|
5 |
-
$form_id = absint( $_REQUEST['form_id'] );
|
6 |
-
}else{
|
7 |
-
$form_id = '';
|
8 |
-
}
|
9 |
-
|
10 |
-
$args = array(
|
11 |
-
'name' => __( 'Form Preview', 'ninja-forms' ),
|
12 |
-
'page' => 'ninja-forms',
|
13 |
-
'display_function' => '',
|
14 |
-
'save_function' => '',
|
15 |
-
'disable_no_form_id' => true,
|
16 |
-
'show_save' => false,
|
17 |
-
'url' => ninja_forms_preview_link( $form_id, false ),
|
18 |
-
'target' => '_blank',
|
19 |
-
);
|
20 |
-
ninja_forms_register_tab( 'form_preview', $args );
|
21 |
-
}
|
22 |
-
|
23 |
-
// add_action('admin_init', 'ninja_forms_register_tab_form_preview', 1001);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/admin/pages/ninja-forms/tabs/form-preview/index.php
DELETED
@@ -1,2 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
// Silence is golden.
|
|
|
|
deprecated/includes/admin/pages/ninja-forms/tabs/form-settings/form-settings.php
DELETED
@@ -1,162 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
|
3 |
-
|
4 |
-
function ninja_forms_register_tab_form_settings(){
|
5 |
-
$all_forms_link = esc_url( remove_query_arg( array( 'form_id', 'tab' ) ) );
|
6 |
-
$args = array(
|
7 |
-
'name' => __( 'Settings', 'ninja-forms' ),
|
8 |
-
'page' => 'ninja-forms',
|
9 |
-
'save_function' => 'ninja_forms_save_form_settings',
|
10 |
-
'tab_reload' => false,
|
11 |
-
// 'title' => '<h2>Forms <a href="'.$all_forms_link.'" class="add-new-h2">'.__('View All Forms', 'ninja-forms').'</a></h2>',
|
12 |
-
);
|
13 |
-
ninja_forms_register_tab('form_settings', $args);
|
14 |
-
}
|
15 |
-
|
16 |
-
add_action( 'admin_init', 'ninja_forms_register_tab_form_settings', 11 );
|
17 |
-
|
18 |
-
function ninja_forms_register_form_settings_basic_metabox(){
|
19 |
-
|
20 |
-
if( isset( $_REQUEST['form_id'] ) ){
|
21 |
-
$form_id = absint( $_REQUEST['form_id'] );
|
22 |
-
$form_data = Ninja_Forms()->form( $form_id )->get_all_settings();
|
23 |
-
}else{
|
24 |
-
$form_id = '';
|
25 |
-
$form_row = '';
|
26 |
-
$form_data = '';
|
27 |
-
}
|
28 |
-
|
29 |
-
$pages = get_pages();
|
30 |
-
$pages_array = array();
|
31 |
-
$append_array = array();
|
32 |
-
array_push($pages_array, array('name' => __( '- None', 'ninja-forms' ), 'value' => ''));
|
33 |
-
array_push($append_array, array('name' => __( '- None', 'ninja-forms' ), 'value' => ''));
|
34 |
-
foreach ($pages as $pagg) {
|
35 |
-
array_push($pages_array, array('name' => $pagg->post_title, 'value' => get_page_link($pagg->ID)));
|
36 |
-
array_push($append_array, array('name' => $pagg->post_title, 'value' => $pagg->ID));
|
37 |
-
}
|
38 |
-
|
39 |
-
if( isset( $form_data['ajax'] ) ){
|
40 |
-
$ajax = $form_data['ajax'];
|
41 |
-
}else{
|
42 |
-
$ajax = 0;
|
43 |
-
}
|
44 |
-
|
45 |
-
$args = apply_filters( 'ninja_forms_form_settings_basic', array(
|
46 |
-
'page' => 'ninja-forms',
|
47 |
-
'tab' => 'form_settings',
|
48 |
-
'slug' => 'basic_settings',
|
49 |
-
'title' => __( 'Display', 'ninja-forms' ),
|
50 |
-
'state' => 'closed',
|
51 |
-
'settings' => array(
|
52 |
-
array(
|
53 |
-
'name' => 'form_title',
|
54 |
-
'type' => 'text',
|
55 |
-
'label' => __( 'Form Title', 'ninja-forms' ),
|
56 |
-
),
|
57 |
-
array(
|
58 |
-
'name' => 'show_title',
|
59 |
-
'type' => 'checkbox',
|
60 |
-
'label' => __( 'Display Form Title', 'ninja-forms' ),
|
61 |
-
),
|
62 |
-
array(
|
63 |
-
'name' => 'append_page',
|
64 |
-
'type' => 'select',
|
65 |
-
'desc' => '',
|
66 |
-
'label' => __( 'Add form to this page', 'ninja-forms' ),
|
67 |
-
'display_function' => '',
|
68 |
-
'help' => '',
|
69 |
-
'options' => $append_array,
|
70 |
-
),
|
71 |
-
array(
|
72 |
-
'name' => 'ajax',
|
73 |
-
'type' => 'checkbox',
|
74 |
-
'desc' => '',
|
75 |
-
'label' => __( 'Submit via AJAX (without page reload)?', 'ninja-forms' ),
|
76 |
-
'display_function' => '',
|
77 |
-
'help' => '',
|
78 |
-
),
|
79 |
-
array(
|
80 |
-
'name' => 'clear_complete',
|
81 |
-
'type' => 'checkbox',
|
82 |
-
'desc' => '',
|
83 |
-
'label' => __( 'Clear successfully completed form?', 'ninja-forms' ),
|
84 |
-
'display_function' => '',
|
85 |
-
'desc' => __( 'If this box is checked, Ninja Forms will clear the form values after it has been successfully submitted.', 'ninja-forms' ),
|
86 |
-
'default_value' => 1,
|
87 |
-
),
|
88 |
-
array(
|
89 |
-
'name' => 'hide_complete',
|
90 |
-
'type' => 'checkbox',
|
91 |
-
'desc' => '',
|
92 |
-
'label' => __( 'Hide successfully completed form?', 'ninja-forms' ),
|
93 |
-
'display_function' => '',
|
94 |
-
'desc' => __( 'If this box is checked, Ninja Forms will hide the form after it has been successfully submitted.', 'ninja-forms' ),
|
95 |
-
'default_value' => 1,
|
96 |
-
),
|
97 |
-
),
|
98 |
-
));
|
99 |
-
ninja_forms_register_tab_metabox($args);
|
100 |
-
|
101 |
-
$args = apply_filters( 'ninja_forms_form_settings_restrictions', array(
|
102 |
-
'page' => 'ninja-forms',
|
103 |
-
'tab' => 'form_settings',
|
104 |
-
'slug' => 'restrictions',
|
105 |
-
'title' => __( 'Restrictions', 'ninja-forms' ),
|
106 |
-
'state' => 'closed',
|
107 |
-
'settings' => array(
|
108 |
-
array(
|
109 |
-
'name' => 'logged_in',
|
110 |
-
'type' => 'checkbox',
|
111 |
-
'desc' => '',
|
112 |
-
'label' => __( 'Require user to be logged in to view form?', 'ninja-forms' ),
|
113 |
-
'display_function' => '',
|
114 |
-
'help' => '',
|
115 |
-
),
|
116 |
-
array(
|
117 |
-
'name' => 'not_logged_in_msg',
|
118 |
-
'type' => 'rte',
|
119 |
-
'label' => __( 'Not Logged-In Message', 'ninja-forms' ),
|
120 |
-
'desc' => __( 'Message shown to users if the "logged in" checkbox above is checked and they are not logged-in.', 'ninja-forms' ),
|
121 |
-
'tr_class' => '',
|
122 |
-
),
|
123 |
-
array(
|
124 |
-
'name' => 'sub_limit_number',
|
125 |
-
'type' => 'number',
|
126 |
-
'desc' => '',
|
127 |
-
'label' => __( 'Limit Submissions', 'ninja-forms' ),
|
128 |
-
'display_function' => '',
|
129 |
-
'desc' => __( 'Select the number of submissions that this form will accept. Leave empty for no limit.', 'ninja-forms' ),
|
130 |
-
'default_value' => '',
|
131 |
-
'tr_class' => '',
|
132 |
-
'min' => 0,
|
133 |
-
),
|
134 |
-
array(
|
135 |
-
'name' => 'sub_limit_msg',
|
136 |
-
'type' => 'rte',
|
137 |
-
'label' => __( 'Limit Reached Message', 'ninja-forms' ),
|
138 |
-
'desc' => __( 'Please enter a message that you want displayed when this form has reached its submission limit and will not accept new submissions.', 'ninja-forms' ),
|
139 |
-
'tr_class' => '',
|
140 |
-
),
|
141 |
-
),
|
142 |
-
));
|
143 |
-
ninja_forms_register_tab_metabox($args);
|
144 |
-
|
145 |
-
|
146 |
-
}
|
147 |
-
|
148 |
-
add_action( 'admin_init', 'ninja_forms_register_form_settings_basic_metabox' );
|
149 |
-
|
150 |
-
function ninja_forms_save_form_settings( $form_id, $data ){
|
151 |
-
global $wpdb, $ninja_forms_admin_update_message;
|
152 |
-
|
153 |
-
foreach ( $data as $key => $val ){
|
154 |
-
if ( 'form_title' == $key ) {
|
155 |
-
$val = esc_html( $val );
|
156 |
-
}
|
157 |
-
Ninja_Forms()->form( $form_id )->update_setting( $key, $val );
|
158 |
-
}
|
159 |
-
|
160 |
-
$update_msg = __( 'Form Settings Saved', 'ninja-forms' );
|
161 |
-
return $update_msg;
|
162 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/admin/pages/ninja-forms/tabs/form-settings/help.php
DELETED
@@ -1,17 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
// add_action( 'init', 'ninja_forms_register_form_settings_help' );
|
3 |
-
function ninja_forms_register_form_settings_help(){
|
4 |
-
$args = array(
|
5 |
-
'page' => 'ninja-forms',
|
6 |
-
'tab' => 'form_settings',
|
7 |
-
'title' => __( 'Basic Settings', 'ninja-forms' ),
|
8 |
-
'display_function' => 'ninja_forms_help_form_settings',
|
9 |
-
);
|
10 |
-
ninja_forms_register_help_screen_tab('basic_settings', $args);
|
11 |
-
}
|
12 |
-
|
13 |
-
function ninja_forms_help_form_settings(){
|
14 |
-
echo '<p>';
|
15 |
-
_e( 'Ninja Forms basic help goes here.', 'ninja-forms' );
|
16 |
-
echo '</p>';
|
17 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/admin/pages/ninja-forms/tabs/form-settings/index.php
DELETED
@@ -1,2 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
// Silence is golden.
|
|
|
|
deprecated/includes/admin/pages/ninja-forms/tabs/index.php
DELETED
@@ -1,2 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
// Silence is golden.
|
|
|
|
deprecated/includes/admin/pages/system-status-html.php
DELETED
@@ -1,304 +0,0 @@
|
|
1 |
-
<div class="nf-box">
|
2 |
-
<div>
|
3 |
-
<h4><?php _e( 'Please include this information when requesting support:', 'ninja-forms' ); ?> </h4>
|
4 |
-
<p class="submit debug-report"><a href="#" class="button-primary"><?php _e( 'Get System Report', 'ninja-forms' ); ?></a></p>
|
5 |
-
</div>
|
6 |
-
<div id="debug-report"><textarea readonly="readonly"></textarea></div>
|
7 |
-
</div>
|
8 |
-
<br/>
|
9 |
-
<table class="nf-status-table" cellspacing="0">
|
10 |
-
<thead>
|
11 |
-
<tr>
|
12 |
-
<th colspan="2"><?php _e( 'Environment', 'ninja-forms' ); ?></th>
|
13 |
-
</tr>
|
14 |
-
</thead>
|
15 |
-
<tbody>
|
16 |
-
<tr>
|
17 |
-
<td><?php _e( 'Home URL','ninja-forms' ); ?>:</td>
|
18 |
-
<td><?php echo home_url(); ?></td>
|
19 |
-
</tr>
|
20 |
-
<tr>
|
21 |
-
<td><?php _e( 'Site URL','ninja-forms' ); ?>:</td>
|
22 |
-
<td><?php echo site_url(); ?></td>
|
23 |
-
</tr>
|
24 |
-
<tr>
|
25 |
-
<td><?php _e( 'Ninja Forms Version','ninja-forms' ); ?>:</td>
|
26 |
-
<td><?php echo esc_html( NF_PLUGIN_VERSION ); ?></td>
|
27 |
-
</tr>
|
28 |
-
<tr>
|
29 |
-
<td><?php _e( 'Ninja Forms Codebase','ninja-forms' ); ?>:</td>
|
30 |
-
<td>v2.9.x DEPRECATED</td>
|
31 |
-
</tr>
|
32 |
-
<tr>
|
33 |
-
<td><?php _e( 'WP Version','ninja-forms' ); ?>:</td>
|
34 |
-
<td><?php bloginfo('version'); ?></td>
|
35 |
-
</tr>
|
36 |
-
<tr>
|
37 |
-
<td><?php _e( 'WP Multisite Enabled','ninja-forms' ); ?>:</td>
|
38 |
-
<td><?php if ( is_multisite() ) echo __( 'Yes', 'ninja-forms' ); else echo __( 'No', 'ninja-forms' ); ?></td>
|
39 |
-
</tr>
|
40 |
-
<tr>
|
41 |
-
<td><?php _e( 'Web Server Info','ninja-forms' ); ?>:</td>
|
42 |
-
<td><?php echo esc_html( $_SERVER['SERVER_SOFTWARE'] ); ?></td>
|
43 |
-
</tr>
|
44 |
-
<tr>
|
45 |
-
<td><?php _e( 'PHP Version','ninja-forms' ); ?>:</td>
|
46 |
-
<td><?php if ( function_exists( 'phpversion' ) ) echo esc_html( phpversion() ); ?></td>
|
47 |
-
</tr>
|
48 |
-
<tr>
|
49 |
-
<td><?php _e( 'MySQL Version','ninja-forms' ); ?>:</td>
|
50 |
-
<td>
|
51 |
-
<?php
|
52 |
-
/** @global wpdb $wpdb */
|
53 |
-
global $wpdb;
|
54 |
-
echo $wpdb->db_version();
|
55 |
-
?>
|
56 |
-
</td>
|
57 |
-
</tr>
|
58 |
-
<tr>
|
59 |
-
<td><?php _e( 'PHP Locale','ninja-forms' ); ?>:</td>
|
60 |
-
<td><?php
|
61 |
-
$locale = localeconv();
|
62 |
-
foreach ( $locale as $key => $val )
|
63 |
-
if ( is_string( $val ) )
|
64 |
-
echo $key . ': ' . $val . '</br>';
|
65 |
-
?></td>
|
66 |
-
</tr>
|
67 |
-
<tr>
|
68 |
-
<td><?php _e( 'WP Memory Limit','ninja-forms' ); ?>:</td>
|
69 |
-
<td><?php
|
70 |
-
$memory = ninja_forms_letters_to_numbers( WP_MEMORY_LIMIT );
|
71 |
-
echo size_format( $memory );
|
72 |
-
?>
|
73 |
-
</td>
|
74 |
-
</tr>
|
75 |
-
<tr>
|
76 |
-
<td><?php _e( 'WP Debug Mode', 'ninja-forms' ); ?>:</td>
|
77 |
-
<td><?php if ( defined('WP_DEBUG') && WP_DEBUG ) echo __( 'Yes', 'ninja-forms' ); else echo __( 'No', 'ninja-forms' ); ?></td>
|
78 |
-
</tr>
|
79 |
-
<tr>
|
80 |
-
<td><?php _e( 'WP Language', 'ninja-forms' ); ?>:</td>
|
81 |
-
<td><?php if ( defined( 'WPLANG' ) && WPLANG ) echo WPLANG; else _e( 'Default', 'ninja-forms' ); ?></td>
|
82 |
-
</tr>
|
83 |
-
<tr>
|
84 |
-
<td><?php _e( 'WP Max Upload Size','ninja-forms' ); ?>:</td>
|
85 |
-
<td><?php echo size_format( wp_max_upload_size() ); ?></td>
|
86 |
-
</tr>
|
87 |
-
<?php if ( function_exists( 'ini_get' ) ) : ?>
|
88 |
-
<tr>
|
89 |
-
<td><?php _e('PHP Post Max Size','ninja-forms' ); ?>:</td>
|
90 |
-
<td><?php echo size_format( ninja_forms_letters_to_numbers( ini_get('post_max_size') ) ); ?></td>
|
91 |
-
</tr>
|
92 |
-
<tr>
|
93 |
-
<td><?php _e( 'Max Input Nesting Level','ninja-forms' ); ?>:</td>
|
94 |
-
<td><?php if ( version_compare( PHP_VERSION, '5.2.2', '>' ) ) {
|
95 |
-
echo ini_get( 'max_input_nesting_level' );
|
96 |
-
} else {
|
97 |
-
_e( 'Unknown', 'ninja-forms' );
|
98 |
-
} ?></td>
|
99 |
-
</tr>
|
100 |
-
<tr>
|
101 |
-
<td><?php _e('PHP Time Limit','ninja-forms' ); ?>:</td>
|
102 |
-
<td><?php echo ini_get('max_execution_time'); ?></td>
|
103 |
-
</tr>
|
104 |
-
<tr>
|
105 |
-
<td><?php _e( 'PHP Max Input Vars','ninja-forms' ); ?>:</td>
|
106 |
-
<td><?php if ( version_compare( PHP_VERSION, '5.3.8', '>' ) ) {
|
107 |
-
echo ini_get( 'max_input_vars' );
|
108 |
-
} else {
|
109 |
-
_e( 'Unknown', 'ninja-forms' );
|
110 |
-
} ?></td>
|
111 |
-
</tr>
|
112 |
-
<tr>
|
113 |
-
<td><?php _e( 'SUHOSIN Installed','ninja-forms' ); ?>:</td>
|
114 |
-
<td><?php echo extension_loaded( 'suhosin' ) ? __( 'Yes', 'ninja-forms' ) : __( 'No', 'ninja-forms' ); ?></td>
|
115 |
-
</tr>
|
116 |
-
<tr>
|
117 |
-
<td><?php _e( 'SMTP','ninja-forms' ); ?>:</td>
|
118 |
-
<td><?php echo ini_get('SMTP'); ?></td>
|
119 |
-
</tr>
|
120 |
-
<tr>
|
121 |
-
<td>smtp_port:</td>
|
122 |
-
<td><?php echo ini_get('smtp_port'); ?></td>
|
123 |
-
</tr>
|
124 |
-
<?php endif; ?>
|
125 |
-
<tr>
|
126 |
-
<td><?php _e( 'Default Timezone','ninja-forms' ); ?>:</td>
|
127 |
-
<td><?php
|
128 |
-
$default_timezone = date_default_timezone_get();
|
129 |
-
if ( 'UTC' !== $default_timezone ) {
|
130 |
-
echo sprintf( __( 'Default timezone is %s - it should be UTC', 'ninja-forms' ), $default_timezone );
|
131 |
-
} else {
|
132 |
-
echo sprintf( __( 'Default timezone is %s', 'ninja-forms' ), $default_timezone );
|
133 |
-
} ?>
|
134 |
-
</td>
|
135 |
-
</tr>
|
136 |
-
<?php
|
137 |
-
$posting = array();
|
138 |
-
|
139 |
-
// fsockopen/cURL
|
140 |
-
$posting['fsockopen_curl']['name'] = 'fsockopen/cURL';
|
141 |
-
if ( function_exists( 'fsockopen' ) || function_exists( 'curl_init' ) ) {
|
142 |
-
if ( function_exists( 'fsockopen' ) && function_exists( 'curl_init' )) {
|
143 |
-
$posting['fsockopen_curl']['note'] = __('Your server has fsockopen and cURL enabled.', 'ninja-forms' );
|
144 |
-
} elseif ( function_exists( 'fsockopen' )) {
|
145 |
-
$posting['fsockopen_curl']['note'] = __( 'Your server has fsockopen enabled, cURL is disabled.', 'ninja-forms' );
|
146 |
-
} else {
|
147 |
-
$posting['fsockopen_curl']['note'] = __( 'Your server has cURL enabled, fsockopen is disabled.', 'ninja-forms' );
|
148 |
-
}
|
149 |
-
$posting['fsockopen_curl']['success'] = true;
|
150 |
-
} else {
|
151 |
-
$posting['fsockopen_curl']['note'] = __( 'Your server does not have fsockopen or cURL enabled - PayPal IPN and other scripts which communicate with other servers will not work. Contact your hosting provider.', 'ninja-forms' );
|
152 |
-
$posting['fsockopen_curl']['success'] = false;
|
153 |
-
}
|
154 |
-
|
155 |
-
// SOAP
|
156 |
-
$posting['soap_client']['name'] = __( 'SOAP Client','ninja-forms' );
|
157 |
-
if ( class_exists( 'SoapClient' ) ) {
|
158 |
-
$posting['soap_client']['note'] = __('Your server has the SOAP Client class enabled.', 'ninja-forms' );
|
159 |
-
$posting['soap_client']['success'] = true;
|
160 |
-
} else {
|
161 |
-
$posting['soap_client']['note'] = sprintf( __( 'Your server does not have the %sSOAP Client%s class enabled - some gateway plugins which use SOAP may not work as expected.', 'ninja-forms' ), '<a href="http://php.net/manual/en/class.soapclient.php">', '</a>' );
|
162 |
-
$posting['soap_client']['success'] = false;
|
163 |
-
}
|
164 |
-
|
165 |
-
// WP Remote Post Check
|
166 |
-
$posting['wp_remote_post']['name'] = __( 'WP Remote Post','ninja-forms');
|
167 |
-
$request['cmd'] = '_notify-validate';
|
168 |
-
$params = array(
|
169 |
-
'sslverify' => false,
|
170 |
-
'timeout' => 60,
|
171 |
-
'user-agent' => 'Ninja Forms/' . NF_PLUGIN_VERSION,
|
172 |
-
'body' => $request
|
173 |
-
);
|
174 |
-
$response = wp_remote_post( 'https://www.paypal.com/cgi-bin/webscr', $params );
|
175 |
-
|
176 |
-
if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) {
|
177 |
-
$posting['wp_remote_post']['note'] = __('wp_remote_post() was successful - PayPal IPN is working.', 'ninja-forms' );
|
178 |
-
$posting['wp_remote_post']['success'] = true;
|
179 |
-
} elseif ( is_wp_error( $response ) ) {
|
180 |
-
$posting['wp_remote_post']['note'] = __( 'wp_remote_post() failed. PayPal IPN won\'t work with your server. Contact your hosting provider. Error:', 'ninja-forms' ) . ' ' . $response->get_error_message();
|
181 |
-
$posting['wp_remote_post']['success'] = false;
|
182 |
-
} else {
|
183 |
-
$posting['wp_remote_post']['note'] = __( 'wp_remote_post() failed. PayPal IPN may not work with your server.', 'ninja-forms' );
|
184 |
-
$posting['wp_remote_post']['success'] = false;
|
185 |
-
}
|
186 |
-
?>
|
187 |
-
</tbody>
|
188 |
-
<thead>
|
189 |
-
<tr>
|
190 |
-
<th colspan="2"><?php _e( 'Plugins', 'ninja-forms' ); ?></th>
|
191 |
-
</tr>
|
192 |
-
</thead>
|
193 |
-
<tbody>
|
194 |
-
<tr>
|
195 |
-
<td><?php _e( 'Installed Plugins','ninja-forms' ); ?>:</td>
|
196 |
-
<td><?php
|
197 |
-
$active_plugins = (array) get_option( 'active_plugins', array() );
|
198 |
-
|
199 |
-
if ( is_multisite() )
|
200 |
-
$active_plugins = array_merge( $active_plugins, get_site_option( 'active_sitewide_plugins', array() ) );
|
201 |
-
|
202 |
-
$all_plugins = array();
|
203 |
-
|
204 |
-
foreach ( $active_plugins as $plugin ) {
|
205 |
-
|
206 |
-
$plugin_data = @get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin );
|
207 |
-
$dirname = dirname( $plugin );
|
208 |
-
$version_string = '';
|
209 |
-
|
210 |
-
if ( ! empty( $plugin_data['Name'] ) ) {
|
211 |
-
|
212 |
-
// link the plugin name to the plugin url if available
|
213 |
-
$plugin_name = $plugin_data['Name'];
|
214 |
-
if ( ! empty( $plugin_data['PluginURI'] ) ) {
|
215 |
-
$plugin_name = '<a href="' . $plugin_data['PluginURI'] . '" title="' . __( 'Visit plugin homepage' , 'ninja-forms' ) . '">' . $plugin_name . '</a>';
|
216 |
-
}
|
217 |
-
|
218 |
-
$all_plugins[] = $plugin_name . ' ' . __( 'by', 'ninja-forms' ) . ' ' . $plugin_data['Author'] . ' ' . __( 'version', 'ninja-forms' ) . ' ' . $plugin_data['Version'] . $version_string;
|
219 |
-
|
220 |
-
}
|
221 |
-
}
|
222 |
-
|
223 |
-
if ( sizeof( $all_plugins ) == 0 )
|
224 |
-
echo '-';
|
225 |
-
else
|
226 |
-
echo implode( ', <br/>', $all_plugins );
|
227 |
-
|
228 |
-
?></td>
|
229 |
-
</tr>
|
230 |
-
</tbody>
|
231 |
-
|
232 |
-
</table>
|
233 |
-
|
234 |
-
<script type="text/javascript">
|
235 |
-
/*
|
236 |
-
@var i string default
|
237 |
-
@var l how many repeat s
|
238 |
-
@var s string to repeat
|
239 |
-
@var w where s should indent
|
240 |
-
*/
|
241 |
-
jQuery.wc_strPad = function(i,l,s,w) {
|
242 |
-
var o = i.toString();
|
243 |
-
if (!s) { s = '0'; }
|
244 |
-
while (o.length < l) {
|
245 |
-
// empty
|
246 |
-
if(w == 'undefined'){
|
247 |
-
o = s + o;
|
248 |
-
}else{
|
249 |
-
o = o + s;
|
250 |
-
}
|
251 |
-
}
|
252 |
-
return o;
|
253 |
-
};
|
254 |
-
|
255 |
-
|
256 |
-
jQuery('.debug-report a').click(function(){
|
257 |
-
|
258 |
-
var paragraphContainer = jQuery( this ).parent();
|
259 |
-
var report = "";
|
260 |
-
|
261 |
-
jQuery('.nf-status-table thead, .nf-status-table tbody').each(function(){
|
262 |
-
|
263 |
-
if ( jQuery( this ).is('thead') ) {
|
264 |
-
|
265 |
-
report = report + "\n### " + jQuery.trim( jQuery( this ).text() ) + " ###\n\n";
|
266 |
-
|
267 |
-
} else {
|
268 |
-
|
269 |
-
jQuery('tr', jQuery( this )).each(function(){
|
270 |
-
|
271 |
-
var the_name = jQuery.wc_strPad( jQuery.trim( jQuery( this ).find('td:eq(0)').text() ), 25, ' ' );
|
272 |
-
var the_value = jQuery.trim( jQuery( this ).find('td:eq(1)').text() );
|
273 |
-
var value_array = the_value.split( ', ' );
|
274 |
-
|
275 |
-
if ( value_array.length > 1 ){
|
276 |
-
|
277 |
-
// if value have a list of plugins ','
|
278 |
-
// split to add new line
|
279 |
-
var output = '';
|
280 |
-
var temp_line ='';
|
281 |
-
jQuery.each( value_array, function(key, line){
|
282 |
-
var tab = ( key == 0 )?0:25;
|
283 |
-
temp_line = temp_line + jQuery.wc_strPad( '', tab, ' ', 'f' ) + line +'\n';
|
284 |
-
});
|
285 |
-
|
286 |
-
the_value = temp_line;
|
287 |
-
}
|
288 |
-
|
289 |
-
report = report +''+ the_name + the_value + "\n";
|
290 |
-
});
|
291 |
-
|
292 |
-
}
|
293 |
-
} );
|
294 |
-
|
295 |
-
try {
|
296 |
-
jQuery("#debug-report").slideDown();
|
297 |
-
jQuery("#debug-report textarea").val( report ).focus().select();
|
298 |
-
paragraphContainer.slideUp();
|
299 |
-
return false;
|
300 |
-
} catch(e){ console.log( e ); }
|
301 |
-
|
302 |
-
return false;
|
303 |
-
});
|
304 |
-
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/admin/pages/system-status.php
DELETED
@@ -1,13 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
/**
|
3 |
-
* Display the Debug/Status page
|
4 |
-
*
|
5 |
-
* @author Patrick Rauland
|
6 |
-
* @category Admin
|
7 |
-
* @since 2.2.50
|
8 |
-
*/
|
9 |
-
|
10 |
-
function ninja_forms_tab_system_status(){
|
11 |
-
// Display the system status!
|
12 |
-
include("system-status-html.php");
|
13 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/admin/post-metabox.php
DELETED
@@ -1,90 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
|
3 |
-
add_action('add_meta_boxes', 'ninja_forms_add_custom_box');
|
4 |
-
|
5 |
-
/* Do something with the data entered */
|
6 |
-
add_action('save_post', 'ninja_forms_save_postdata');
|
7 |
-
|
8 |
-
/* Adds a box to the main column on the Post and Page edit screens */
|
9 |
-
function ninja_forms_add_custom_box() {
|
10 |
-
add_meta_box(
|
11 |
-
'ninja_forms_selector',
|
12 |
-
__( 'Append A Ninja Form', 'ninja-forms'),
|
13 |
-
'ninja_forms_inner_custom_box',
|
14 |
-
'post',
|
15 |
-
'side',
|
16 |
-
'low'
|
17 |
-
);
|
18 |
-
add_meta_box(
|
19 |
-
'ninja_forms_selector',
|
20 |
-
__( 'Append A Ninja Form', 'ninja-forms'),
|
21 |
-
'ninja_forms_inner_custom_box',
|
22 |
-
'page',
|
23 |
-
'side',
|
24 |
-
'low'
|
25 |
-
);
|
26 |
-
}
|
27 |
-
|
28 |
-
/* Prints the box content */
|
29 |
-
function ninja_forms_inner_custom_box() {
|
30 |
-
|
31 |
-
$post_id = ! empty( $_REQUEST['post'] ) ? absint( $_REQUEST['post'] ) : 0;
|
32 |
-
|
33 |
-
// Use nonce for verification
|
34 |
-
wp_nonce_field( 'ninja_forms_append_form', 'nf_append_form' );
|
35 |
-
|
36 |
-
// The actual fields for data entry
|
37 |
-
?>
|
38 |
-
<select id="ninja_form_select" name="ninja_form_select">
|
39 |
-
<option value="0">-- <?php _e('None', 'ninja-forms');?></option>
|
40 |
-
<?php
|
41 |
-
$all_forms = ninja_forms_get_all_forms();
|
42 |
-
$form_id = get_post_meta( $post_id, 'ninja_forms_form', true );
|
43 |
-
foreach( $all_forms as $form ){
|
44 |
-
$title = $form['data']['form_title'];
|
45 |
-
$id = $form['id'];
|
46 |
-
?>
|
47 |
-
<option value="<?php echo esc_attr( $id );?>"<?php selected( $id, $form_id );?>>
|
48 |
-
<?php echo $title;?>
|
49 |
-
</option>
|
50 |
-
<?php
|
51 |
-
}
|
52 |
-
?>
|
53 |
-
</select>
|
54 |
-
<?php
|
55 |
-
}
|
56 |
-
|
57 |
-
/* When the post is saved, saves our custom data */
|
58 |
-
function ninja_forms_save_postdata( $post_id ) {
|
59 |
-
global $wpdb;
|
60 |
-
if(isset($_POST['nf_append_form'])){
|
61 |
-
// verify if this is an auto save routine.
|
62 |
-
// If it is our form has not been submitted, so we dont want to do anything
|
63 |
-
if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE )
|
64 |
-
return $post_id;
|
65 |
-
|
66 |
-
// verify this came from the our screen and with proper authorization,
|
67 |
-
// because save_post can be triggered at other times
|
68 |
-
|
69 |
-
if ( !wp_verify_nonce( $_POST['nf_append_form'], 'ninja_forms_append_form' ) )
|
70 |
-
return $post_id;
|
71 |
-
|
72 |
-
// Check permissions
|
73 |
-
if ( 'page' == $_POST['post_type'] ) {
|
74 |
-
if ( !current_user_can( 'edit_page', $post_id ) )
|
75 |
-
return $post_id;
|
76 |
-
} else {
|
77 |
-
if ( !current_user_can( 'edit_post', $post_id ) )
|
78 |
-
return $post_id;
|
79 |
-
}
|
80 |
-
|
81 |
-
// OK, we're authenticated: we need to find and save the data
|
82 |
-
$post_id = absint( $_POST['post_ID'] );
|
83 |
-
$form_id = absint( $_POST['ninja_form_select'] );
|
84 |
-
if ( empty ( $form_id ) ) {
|
85 |
-
delete_post_meta( $post_id, 'ninja_forms_form' );
|
86 |
-
} else {
|
87 |
-
update_post_meta( $post_id, 'ninja_forms_form', $form_id );
|
88 |
-
}
|
89 |
-
}
|
90 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/admin/register-screen-help.php
DELETED
@@ -1,10 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
$args = array(
|
3 |
-
'title' => 'Test Help',
|
4 |
-
'display_function' => 'ninja_forms_help_screen_test',
|
5 |
-
);
|
6 |
-
//ninja_forms_register_help_screen_tab('test-help', $args);
|
7 |
-
|
8 |
-
function ninja_forms_help_screen_test(){
|
9 |
-
echo '<p>Help Test!</p>';
|
10 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/admin/register-screen-options.php
DELETED
@@ -1,73 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
$args = array(
|
3 |
-
'display_function' => 'ninja_forms_screen_option_tabs',
|
4 |
-
'save_function' => 'ninja_forms_save_screen_option_tabs',
|
5 |
-
'page' => 'ninja-forms'
|
6 |
-
);
|
7 |
-
//ninja_forms_register_screen_option('tabs', $args);
|
8 |
-
|
9 |
-
function ninja_forms_screen_option_tabs(){
|
10 |
-
global $ninja_forms_tabs, $ninja_forms_sidebars;
|
11 |
-
$current_tab = ninja_forms_get_current_tab();
|
12 |
-
$current_page = $_REQUEST['page'];
|
13 |
-
$opt = nf_get_settings();
|
14 |
-
if(isset($ninja_forms_tabs[$current_page]) AND is_array($ninja_forms_tabs[$current_page])){
|
15 |
-
?>
|
16 |
-
<div class="tabs-prefs">
|
17 |
-
<h5>Show These Tabs</h5>
|
18 |
-
<?php
|
19 |
-
foreach($ninja_forms_tabs[$current_page] as $slug => $tab){
|
20 |
-
if(!isset($opt['screen_options']['tab'][$slug]['visible']) OR $opt['screen_options']['tab'][$slug]['visible'] == 1){
|
21 |
-
$checked = 'checked = "checked"';
|
22 |
-
}else{
|
23 |
-
$checked = '';
|
24 |
-
}
|
25 |
-
?>
|
26 |
-
<input type="hidden" name="ninja-forms-tab[<?php echo $slug;?>]" value="0">
|
27 |
-
<label for="ninja-forms-tab-<?php echo $slug;?>"><input class="hide-tab-tog" name="ninja-forms-tab[<?php echo $slug;?>]" type="checkbox" id="ninja-forms-tab-<?php echo $slug;?>" value="1" <?php echo $checked;?> ><?php echo $tab['name'];?></label>
|
28 |
-
<?php
|
29 |
-
}
|
30 |
-
?>
|
31 |
-
<br class="clear">
|
32 |
-
</div>
|
33 |
-
<?php if(isset($ninja_forms_sidebars[$current_page][$current_tab]) AND is_array($ninja_forms_sidebars[$current_page][$current_tab])){?>
|
34 |
-
<div class="sidebar-prefs">
|
35 |
-
<h5>Show These Sidebars</h5>
|
36 |
-
<?php
|
37 |
-
foreach($ninja_forms_sidebars[$current_page][$current_tab] as $slug => $sidebar){
|
38 |
-
if(!isset($opt['screen_options']['tab'][$current_tab]['sidebars'][$slug]['visible']) OR $opt['screen_options']['tab'][$current_tab]['sidebars'][$slug]['visible'] == 1){
|
39 |
-
$checked = 'checked = "checked"';
|
40 |
-
}else{
|
41 |
-
$checked = '';
|
42 |
-
}
|
43 |
-
?>
|
44 |
-
<input type="hidden" name="ninja-forms-sidebar[<?php echo $slug;?>]" value="0">
|
45 |
-
<label for="ninja-forms-sidebar-<?php echo $slug;?>"><input class="hide-sidebar-tog" name="ninja-forms-sidebar[<?php echo $slug;?>]" type="checkbox" id="ninja-forms-sidebar-<?php echo $slug;?>" value="1" <?php echo $checked;?> ><?php echo $sidebar['name'];?></label>
|
46 |
-
<?php
|
47 |
-
}
|
48 |
-
?>
|
49 |
-
<br class="clear">
|
50 |
-
</div>
|
51 |
-
<?php
|
52 |
-
}
|
53 |
-
}
|
54 |
-
}
|
55 |
-
|
56 |
-
function ninja_forms_save_screen_option_tabs(){
|
57 |
-
$current_tab = ninja_forms_get_current_tab();
|
58 |
-
$current_page = $_REQUEST['page'];
|
59 |
-
$opt = nf_get_settings();
|
60 |
-
if(is_array($_POST['ninja-forms-tab'])){
|
61 |
-
$tabs = sanitize_text_field($_POST['ninja-forms-tab']);
|
62 |
-
foreach($tabs as $slug => $val){
|
63 |
-
$opt['screen_options']['tab'][$slug]['visible'] = $val;
|
64 |
-
}
|
65 |
-
}
|
66 |
-
if(is_array($_POST['ninja-forms-sidebar'])){
|
67 |
-
$sidebars = sanitize_text_field($_POST['ninja-forms-sidebar']);
|
68 |
-
foreach($sidebars as $slug => $val){
|
69 |
-
$opt['screen_options']['tab'][$current_tab]['sidebars'][$slug]['visible'] = $val;
|
70 |
-
}
|
71 |
-
}
|
72 |
-
update_option('ninja_forms_settings', $opt);
|
73 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/admin/save.php
DELETED
@@ -1,121 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
|
3 |
-
function ninja_forms_admin_save(){
|
4 |
-
global $ninja_forms_tabs, $ninja_forms_sidebars, $ninja_forms_tabs_metaboxes, $ninja_forms_admin_update_message;
|
5 |
-
if(!empty($_POST) AND !empty($_POST['_ninja_forms_admin_submit']) AND $_POST['_ninja_forms_admin_submit'] != ''){
|
6 |
-
if(wp_verify_nonce($_POST['_ninja_forms_admin_submit'],'_ninja_forms_save') AND check_admin_referer('_ninja_forms_save','_ninja_forms_admin_submit')){
|
7 |
-
$current_page = esc_html( $_REQUEST['page'] );
|
8 |
-
$current_tab = ninja_forms_get_current_tab();
|
9 |
-
|
10 |
-
$data_array = array();
|
11 |
-
if ( isset( $_REQUEST['form_id'] ) and $_REQUEST['form_id'] != 'new' ) {
|
12 |
-
$form_id = absint( $_REQUEST['form_id'] );
|
13 |
-
|
14 |
-
// Dump our current form transient.
|
15 |
-
delete_transient( 'nf_form_' . $form_id );
|
16 |
-
} else if ( isset ( $_REQUEST['form_id'] ) and $_REQUEST['form_id'] == 'new' ) {
|
17 |
-
$form_id = 'new';
|
18 |
-
} else {
|
19 |
-
$form_id = '';
|
20 |
-
}
|
21 |
-
|
22 |
-
foreach ( $_POST as $key => $val ) {
|
23 |
-
if ( substr($key, 0, 1) != '_') {
|
24 |
-
$data_array[$key] = esc_html($val);
|
25 |
-
}
|
26 |
-
}
|
27 |
-
|
28 |
-
$data_array = ninja_forms_stripslashes_deep( $data_array );
|
29 |
-
//$data_array = ninja_forms_esc_html_deep( $data_array );
|
30 |
-
|
31 |
-
//Call any save functions registered to metaboxes
|
32 |
-
if( isset( $ninja_forms_tabs_metaboxes[$current_page][$current_tab] ) AND is_array( $ninja_forms_tabs_metaboxes[$current_page][$current_tab] ) AND !empty( $ninja_forms_tabs_metaboxes[$current_page][$current_tab] ) ){
|
33 |
-
foreach( $ninja_forms_tabs_metaboxes[$current_page][$current_tab] as $slug => $opts ){
|
34 |
-
|
35 |
-
// Get the save function of our options, if set, and call them, passing the data that has been posted.
|
36 |
-
if( isset( $opts['settings'] ) AND !empty( $opts['settings'] ) ){
|
37 |
-
foreach( $opts['settings'] as $setting ){
|
38 |
-
if( isset( $setting['save_function'] ) ){
|
39 |
-
if( isset( $form_id ) and $form_id != '' ){
|
40 |
-
$arguments['form_id'] = $form_id;
|
41 |
-
}
|
42 |
-
$arguments['data'] = $data_array;
|
43 |
-
if( $setting['save_function'] != '' ){
|
44 |
-
if( $ninja_forms_admin_update_message != '' ){
|
45 |
-
$ninja_forms_admin_update_message .= ' ';
|
46 |
-
}
|
47 |
-
$ninja_forms_admin_update_message .= call_user_func_array($setting['save_function'], $arguments);
|
48 |
-
do_action( 'ninja_forms_save_admin_metabox_option', $setting, $form_id, $data_array );
|
49 |
-
}
|
50 |
-
}
|
51 |
-
}
|
52 |
-
}
|
53 |
-
|
54 |
-
if( isset( $opts['save_function'] ) ){
|
55 |
-
$save_function = $opts['save_function'];
|
56 |
-
$arguments = func_get_args();
|
57 |
-
array_shift($arguments); // We need to remove the first arg ($function_name)
|
58 |
-
if ( isset( $form_id ) and $form_id != '' ) {
|
59 |
-
$arguments['form_id'] = $form_id;
|
60 |
-
}
|
61 |
-
$arguments['data'] = $data_array;
|
62 |
-
if($save_function != ''){
|
63 |
-
if( $ninja_forms_admin_update_message != '' ){
|
64 |
-
$ninja_forms_admin_update_message .= ' ';
|
65 |
-
}
|
66 |
-
$ninja_forms_admin_update_message .= call_user_func_array($save_function, $arguments);
|
67 |
-
do_action( 'ninja_forms_save_admin_metabox', $slug, $form_id, $data_array );
|
68 |
-
}
|
69 |
-
}
|
70 |
-
|
71 |
-
|
72 |
-
}
|
73 |
-
}
|
74 |
-
|
75 |
-
// Get the save function of our current sidebars, if present, and call them, passing the data that has been posted.
|
76 |
-
if(isset($ninja_forms_sidebars[$current_page][$current_tab]) AND is_array($ninja_forms_sidebars[$current_page][$current_tab])){
|
77 |
-
foreach($ninja_forms_sidebars[$current_page][$current_tab] as $slug => $sidebar){
|
78 |
-
if($sidebar['save_function'] != ''){
|
79 |
-
$save_function = $sidebar['save_function'];
|
80 |
-
$arguments = func_get_args();
|
81 |
-
array_shift($arguments); // We need to remove the first arg ($function_name)
|
82 |
-
if ( isset( $form_id ) and $form_id != '' ){
|
83 |
-
$arguments['form_id'] = $form_id;
|
84 |
-
}
|
85 |
-
$arguments['data'] = $data_array;
|
86 |
-
if($save_function != ''){
|
87 |
-
if( $ninja_forms_admin_update_message != '' ){
|
88 |
-
$ninja_forms_admin_update_message .= ' ';
|
89 |
-
}
|
90 |
-
$ninja_forms_admin_update_message .= call_user_func_array($save_function, $arguments);
|
91 |
-
do_action( 'ninja_forms_save_admin_sidebar', $slug, $form_id, $data_array );
|
92 |
-
}
|
93 |
-
}
|
94 |
-
}
|
95 |
-
}
|
96 |
-
|
97 |
-
// Get the save function of our current tab and call it, passing the data that has been posted.
|
98 |
-
$save_function = $ninja_forms_tabs[$current_page][$current_tab]['save_function'];
|
99 |
-
$tab_reload = $ninja_forms_tabs[$current_page][$current_tab]['tab_reload'];
|
100 |
-
$arguments = func_get_args();
|
101 |
-
array_shift($arguments); // We need to remove the first arg ($function_name)
|
102 |
-
if ( isset( $form_id ) and $form_id != '' ) {
|
103 |
-
$arguments['form_id'] = $form_id;
|
104 |
-
}
|
105 |
-
$arguments['data'] = $data_array;
|
106 |
-
|
107 |
-
if($save_function != ''){
|
108 |
-
|
109 |
-
$ninja_forms_admin_update_message = call_user_func_array($save_function, $arguments);
|
110 |
-
do_action( 'ninja_forms_save_admin_tab', $current_tab, $form_id, $data_array );
|
111 |
-
}
|
112 |
-
if ( $tab_reload ) {
|
113 |
-
$redirect_array = array( 'update_message' => urlencode( $ninja_forms_admin_update_message ) );
|
114 |
-
$url = esc_url_raw( add_query_arg( $redirect_array ) );
|
115 |
-
wp_redirect( $url );
|
116 |
-
}
|
117 |
-
}
|
118 |
-
}
|
119 |
-
}
|
120 |
-
|
121 |
-
add_action( 'admin_init', 'ninja_forms_admin_save', 999 );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/admin/scripts.php
DELETED
@@ -1,161 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
//Load up our WP Ninja Custom Form JS files.
|
3 |
-
function ninja_forms_admin_css(){
|
4 |
-
$plugin_settings = nf_get_settings();
|
5 |
-
|
6 |
-
wp_enqueue_style( 'jquery-smoothness', NINJA_FORMS_URL .'css/smoothness/jquery-smoothness.css' );
|
7 |
-
wp_enqueue_style( 'ninja-forms-admin', NINJA_FORMS_URL .'css/ninja-forms-admin.css?nf_ver=' . NF_PLUGIN_VERSION );
|
8 |
-
wp_enqueue_style( 'nf-admin-modal', NINJA_FORMS_URL .'assets/css/admin-modal.css?nf_ver=' . NF_PLUGIN_VERSION );
|
9 |
-
|
10 |
-
add_filter('admin_body_class', 'ninja_forms_add_class');
|
11 |
-
|
12 |
-
}
|
13 |
-
|
14 |
-
function ninja_forms_add_class($classes) {
|
15 |
-
// add 'class-name' to the $classes array
|
16 |
-
$classes .= ' nav-menus-php';
|
17 |
-
// return the $classes array
|
18 |
-
return $classes;
|
19 |
-
}
|
20 |
-
|
21 |
-
function ninja_forms_admin_js(){
|
22 |
-
global $version_compare, $public_query_vars;
|
23 |
-
|
24 |
-
$form_id = isset ( $_REQUEST['form_id'] ) ? absint( $_REQUEST['form_id'] ) : '';
|
25 |
-
|
26 |
-
if ( defined( 'NINJA_FORMS_JS_DEBUG' ) && NINJA_FORMS_JS_DEBUG ) {
|
27 |
-
$suffix = '';
|
28 |
-
$src = 'dev';
|
29 |
-
} else {
|
30 |
-
$suffix = '.min';
|
31 |
-
$src = 'min';
|
32 |
-
}
|
33 |
-
|
34 |
-
$plugin_settings = nf_get_settings();
|
35 |
-
if(isset($plugin_settings['date_format'])){
|
36 |
-
$date_format = $plugin_settings['date_format'];
|
37 |
-
}else{
|
38 |
-
$date_format = 'm/d/Y';
|
39 |
-
}
|
40 |
-
|
41 |
-
$date_format = ninja_forms_date_to_datepicker($date_format);
|
42 |
-
|
43 |
-
$datepicker_args = array();
|
44 |
-
if ( !empty( $date_format ) ) {
|
45 |
-
$datepicker_args['dateFormat'] = $date_format;
|
46 |
-
}
|
47 |
-
|
48 |
-
wp_enqueue_script('ninja-forms-admin',
|
49 |
-
NINJA_FORMS_URL . 'js/' . $src .'/ninja-forms-admin' . $suffix . '.js?nf_ver=' . NF_PLUGIN_VERSION,
|
50 |
-
array('jquery', 'jquery-ui-core', 'jquery-ui-sortable', 'jquery-ui-datepicker', 'jquery-ui-draggable', 'jquery-ui-droppable', 'nf-admin-modal' ) );
|
51 |
-
|
52 |
-
wp_localize_script( 'ninja-forms-admin', 'ninja_forms_settings', array( 'nf_ajax_nonce' => wp_create_nonce( 'nf_ajax'), 'form_id' => $form_id, 'datepicker_args' => apply_filters( 'ninja_forms_admin_forms_datepicker_args', $datepicker_args ), 'add_fav_prompt' => __( 'What would you like to name this favorite?', 'ninja-forms' ), 'add_fav_error' => __( 'You must supply a name for this favorite.', 'ninja-forms' ), 'deactivate_all_licenses_confirm' => __( 'Really deactivate all licenses?', 'ninja-forms' ) ) );
|
53 |
-
wp_localize_script( 'ninja-forms-admin', 'nf_conversion_title', __( 'Reset the form conversion process for v2.9+', 'ninja-forms' ) );
|
54 |
-
wp_localize_script( 'ninja-forms-admin', 'nf_nuke_title', __( 'Remove ALL Ninja Forms data upon uninstall?', 'ninja-forms' ) );
|
55 |
-
|
56 |
-
|
57 |
-
if ( isset ( $_REQUEST['page'] ) && $_REQUEST['page'] == 'ninja-forms' && isset ( $_REQUEST['tab'] ) ) {
|
58 |
-
wp_enqueue_script( 'nf-builder',
|
59 |
-
NINJA_FORMS_URL . 'assets/js/' . $src .'/builder' . $suffix . '.js?nf_ver=' . NF_PLUGIN_VERSION,
|
60 |
-
array( 'backbone' ) );
|
61 |
-
|
62 |
-
if ( '' != $form_id ) {
|
63 |
-
$fields = Ninja_Forms()->form( $form_id )->fields;
|
64 |
-
|
65 |
-
$current_tab = ninja_forms_get_current_tab();
|
66 |
-
$current_page = isset ( $_REQUEST['page'] ) ? esc_html( $_REQUEST['page'] ) : '';
|
67 |
-
|
68 |
-
foreach ( $fields as $field_id => $field ) {
|
69 |
-
$fields[ $field_id ]['metabox_state'] = 0;
|
70 |
-
}
|
71 |
-
|
72 |
-
$form_status = Ninja_Forms()->form( $form_id )->get_setting( 'status' );
|
73 |
-
$form_title = Ninja_Forms()->form( $form_id )->get_setting( 'form_title' );
|
74 |
-
|
75 |
-
wp_localize_script( 'nf-builder', 'nf_admin', array( 'edit_form_text' => __( 'Edit Form', 'ninja-forms' ), 'form_title' => $form_title, 'form_status' => $form_status, 'fields' => $fields, 'saved_text' => __( 'Saved', 'ninja-forms' ), 'save_text' => __( 'Save', 'ninja-forms' ), 'saving_text' => __( 'Saving...', 'ninja-forms' ), 'remove_field' => __( 'Remove this field? It will be removed even if you do not save.', 'ninja-forms' ) ) );
|
76 |
-
|
77 |
-
$reserved_terms = array(
|
78 |
-
'attachment',
|
79 |
-
'attachment_id',
|
80 |
-
'author',
|
81 |
-
'author_name',
|
82 |
-
'calendar',
|
83 |
-
'cat',
|
84 |
-
'category',
|
85 |
-
'category__and',
|
86 |
-
'category__in',
|
87 |
-
'category__not_in',
|
88 |
-
'category_name',
|
89 |
-
'comments_per_page',
|
90 |
-
'comments_popup',
|
91 |
-
'customize_messenger_channel',
|
92 |
-
'customized',
|
93 |
-
'cpage',
|
94 |
-
'day',
|
95 |
-
'debug',
|
96 |
-
'error',
|
97 |
-
'exact',
|
98 |
-
'feed',
|
99 |
-
'hour',
|
100 |
-
'link_category',
|
101 |
-
'm',
|
102 |
-
'minute',
|
103 |
-
'monthnum',
|
104 |
-
'more',
|
105 |
-
'name',
|
106 |
-
'nav_menu',
|
107 |
-
'nonce',
|
108 |
-
'nopaging',
|
109 |
-
'offset',
|
110 |
-
'order',
|
111 |
-
'orderby',
|
112 |
-
'p',
|
113 |
-
'page',
|
114 |
-
'page_id',
|
115 |
-
'paged',
|
116 |
-
'pagename',
|
117 |
-
'pb',
|
118 |
-
'perm',
|
119 |
-
'post',
|
120 |
-
'post__in',
|
121 |
-
'post__not_in',
|
122 |
-
'post_format',
|
123 |
-
'post_mime_type',
|
124 |
-
'post_status',
|
125 |
-
'post_tag',
|
126 |
-
'post_type',
|
127 |
-
'posts',
|
128 |
-
'posts_per_archive_page',
|
129 |
-
'posts_per_page',
|
130 |
-
'preview',
|
131 |
-
'robots',
|
132 |
-
's',
|
133 |
-
'search',
|
134 |
-
'second',
|
135 |
-
'sentence',
|
136 |
-
'showposts',
|
137 |
-
'static',
|
138 |
-
'subpost',
|
139 |
-
'subpost_id',
|
140 |
-
'tag',
|
141 |
-
'tag__and',
|
142 |
-
'tag__in',
|
143 |
-
'tag__not_in',
|
144 |
-
'tag_id',
|
145 |
-
'tag_slug__and',
|
146 |
-
'tag_slug__in',
|
147 |
-
'taxonomy',
|
148 |
-
'tb',
|
149 |
-
'term',
|
150 |
-
'theme',
|
151 |
-
'type',
|
152 |
-
'w',
|
153 |
-
'withcomments',
|
154 |
-
'withoutcomments',
|
155 |
-
'year',
|
156 |
-
);
|
157 |
-
|
158 |
-
wp_localize_script( 'nf-builder', 'wp_reserved_terms', $reserved_terms );
|
159 |
-
}
|
160 |
-
}
|
161 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/admin/sidebar-fields.php
DELETED
@@ -1,20 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
function ninja_forms_sidebar_display_fields($slug){
|
3 |
-
global $ninja_forms_fields, $current_tab;
|
4 |
-
if(is_array($ninja_forms_fields) AND isset($_REQUEST['form_id'])){
|
5 |
-
foreach($ninja_forms_fields as $field_slug => $field){
|
6 |
-
if($field['sidebar'] == $slug){
|
7 |
-
if(isset($field['limit'])){
|
8 |
-
$limit = $field['limit'];
|
9 |
-
}else{
|
10 |
-
$limit = '';
|
11 |
-
}
|
12 |
-
?>
|
13 |
-
<p class="button-controls">
|
14 |
-
<a class="button-secondary ninja-forms-new-field" id="<?php _e($field_slug, 'ninja-forms');?>" data-limit="<?php echo $limit; ?>" data-type="<?php echo $field_slug; ?>" href="#"><?php _e($field['name'], 'ninja-forms');?></a>
|
15 |
-
</p>
|
16 |
-
<?php
|
17 |
-
}
|
18 |
-
}
|
19 |
-
}
|
20 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/admin/sidebar.php
DELETED
@@ -1,194 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
|
3 |
-
function ninja_forms_sidebar_sorter($array, $sequence){
|
4 |
-
$tmp = array();
|
5 |
-
foreach($sequence as $s){
|
6 |
-
foreach($array as $key => $a){
|
7 |
-
$s = str_replace( 'ninja_forms_metabox_', '', $s );
|
8 |
-
if($key == $s){
|
9 |
-
$tmp[$key] = $a;
|
10 |
-
unset( $array[$key] );
|
11 |
-
break;
|
12 |
-
}
|
13 |
-
}
|
14 |
-
}
|
15 |
-
if( is_array( $array ) AND !empty( $array ) ){
|
16 |
-
foreach( $array as $key => $a ){
|
17 |
-
$tmp[$key] = $a;
|
18 |
-
}
|
19 |
-
}
|
20 |
-
|
21 |
-
return $tmp;
|
22 |
-
}
|
23 |
-
|
24 |
-
function ninja_forms_display_sidebars($data){
|
25 |
-
global $ninja_forms_sidebars;
|
26 |
-
$current_tab = ninja_forms_get_current_tab();
|
27 |
-
$current_page = esc_html( $_REQUEST['page'] );
|
28 |
-
$opt = nf_get_settings();
|
29 |
-
if( isset( $opt['sidebars'][$current_page][$current_tab] ) ){
|
30 |
-
$order = $opt['sidebars'][$current_page][$current_tab];
|
31 |
-
if ( !is_array ( $order ) ) {
|
32 |
-
$order = array();
|
33 |
-
}
|
34 |
-
$ninja_forms_sidebars[$current_page][$current_tab] = ninja_forms_sidebar_sorter( $ninja_forms_sidebars[$current_page][$current_tab], $order );
|
35 |
-
}
|
36 |
-
$plugin_settings = nf_get_settings();
|
37 |
-
?>
|
38 |
-
<div id="menu-settings-column" class="metabox-holder">
|
39 |
-
<div id="side-sortables" class="meta-box-sortables ui-sortable">
|
40 |
-
<?php
|
41 |
-
if(isset($ninja_forms_sidebars[$current_page][$current_tab]) AND is_array($ninja_forms_sidebars[$current_page][$current_tab])){
|
42 |
-
foreach($ninja_forms_sidebars[$current_page][$current_tab] as $slug => $sidebar){
|
43 |
-
|
44 |
-
if((isset($opt['screen_options']['tab'][$current_tab]['sidebars'][$slug]['visible']) AND $opt['screen_options']['tab'][$current_tab]['sidebars'][$slug]['visible'] == 1) OR !isset($opt['screen_options']['tab'][$current_tab]['sidebars'][$slug]['visible'])){
|
45 |
-
|
46 |
-
if ( isset ( $plugin_settings['metabox_state'][$current_page][$current_tab][$slug] ) ) {
|
47 |
-
$state = $plugin_settings['metabox_state'][$current_page][$current_tab][$slug];
|
48 |
-
} else {
|
49 |
-
$state = '';
|
50 |
-
}
|
51 |
-
?>
|
52 |
-
<div id="ninja_forms_metabox_<?php echo $slug;?>" class="postbox">
|
53 |
-
<h3 class="hndl">
|
54 |
-
<span><?php _e($sidebar['name'], 'ninja-forms');?></span>
|
55 |
-
</h3>
|
56 |
-
<span class="item-controls">
|
57 |
-
<a class="item-edit metabox-item-edit" id="edit_id" title="<?php _e('Edit Menu Item', 'ninja-forms'); ?>" href="#"><?php _e( 'Edit Menu Item' , 'ninja-forms'); ?></a>
|
58 |
-
</span>
|
59 |
-
<div class="inside" id="ninja_forms_sidebar_<?php echo $slug;?>" style="<?php echo $state;?>">
|
60 |
-
<?php
|
61 |
-
if(isset($sidebar['display_function']) AND !empty($sidebar['display_function'])){
|
62 |
-
$sidebar_callback = $sidebar['display_function'];
|
63 |
-
$arguments = func_get_args();
|
64 |
-
array_shift($arguments); // We need to remove the first arg ($function_name)
|
65 |
-
$arguments['slug'] = $slug;
|
66 |
-
$arguments['data'] = $data;
|
67 |
-
call_user_func_array($sidebar_callback, $arguments);
|
68 |
-
}
|
69 |
-
|
70 |
-
if(isset($sidebar['settings']) AND !empty($sidebar['settings'])){
|
71 |
-
foreach($sidebar['settings'] as $option){
|
72 |
-
if( isset( $option['p_class'] ) ){
|
73 |
-
$p_class = $option['p_class'];
|
74 |
-
}else{
|
75 |
-
$p_class = '';
|
76 |
-
}
|
77 |
-
?>
|
78 |
-
<p class="field-controls <?php echo $p_class;?>">
|
79 |
-
<?php
|
80 |
-
if(isset($option['display_function']) AND !empty($option['display_function'])){
|
81 |
-
call_user_func_array($option['display_function'], $arguments);
|
82 |
-
}else{
|
83 |
-
|
84 |
-
$name = $option['name'];
|
85 |
-
|
86 |
-
if( isset( $option['default_value'] ) ){
|
87 |
-
$value = $option['default_value'];
|
88 |
-
}else{
|
89 |
-
$value = '';
|
90 |
-
}
|
91 |
-
|
92 |
-
if( isset( $data[$name] ) ){
|
93 |
-
$value = $data[$name];
|
94 |
-
}
|
95 |
-
|
96 |
-
if( isset( $option['class'] ) ){
|
97 |
-
$class = $option['class'];
|
98 |
-
}else{
|
99 |
-
$class = '';
|
100 |
-
}
|
101 |
-
|
102 |
-
switch($option['type']){
|
103 |
-
case 'checkbox':
|
104 |
-
?>
|
105 |
-
<input type="hidden" name="<?php echo $name;?>" value="0">
|
106 |
-
<input type="checkbox" name="<?php echo $name;?>" id="<?php echo $name;?>" value="1" <?php checked(1, $value);?>>
|
107 |
-
<label for="<?php echo $name;?>"><?php _e($option['label'], 'ninja-forms');?></label>
|
108 |
-
<?php
|
109 |
-
break;
|
110 |
-
case 'radio':
|
111 |
-
?>
|
112 |
-
<label for="<?php echo $name;?>"><?php _e($option['label'], 'ninja-forms');?></label>
|
113 |
-
<?php
|
114 |
-
if(isset($option['options'])){
|
115 |
-
$x = 0;
|
116 |
-
foreach($option['options'] as $option){
|
117 |
-
?>
|
118 |
-
<input type="radio" id="<?php echo $name.'_'.$x;?>" value="<?php echo $option['value'];?>" <?php checked($option['value'], $value);?> name="<?php echo $name;?>">
|
119 |
-
<label for="<?php echo $name.'_'.$x;?>"><?php echo $option['name'];?></label>
|
120 |
-
<?php
|
121 |
-
$x++;
|
122 |
-
}
|
123 |
-
}
|
124 |
-
break;
|
125 |
-
case 'select':
|
126 |
-
?>
|
127 |
-
<label for="<?php echo $name;?>"><?php _e($option['label'], 'ninja-forms');?></label>
|
128 |
-
<select name="<?php echo $name;?>" id="<?php echo $name;?>">
|
129 |
-
<?php
|
130 |
-
if(isset($option['options'])){
|
131 |
-
foreach($option['options'] as $option){
|
132 |
-
?>
|
133 |
-
<option value="<?php echo $option['value'];?>" <?php selected($option['value'], $value);?>><?php echo $option['name'];?></option>
|
134 |
-
<?php
|
135 |
-
}
|
136 |
-
}
|
137 |
-
?>
|
138 |
-
</select>
|
139 |
-
<?php
|
140 |
-
break;
|
141 |
-
case 'text':
|
142 |
-
?>
|
143 |
-
<label for="<?php echo $name;?>"><?php _e($option['label'], 'ninja-forms');?></label>
|
144 |
-
<input type="text" name="<?php echo $name;?>" id="<?php echo $name;?>" value="<?php echo $value;?>">
|
145 |
-
<?php
|
146 |
-
break;
|
147 |
-
case 'textarea':
|
148 |
-
?>
|
149 |
-
<label for="<?php echo $name;?>"><?php _e($option['label'], 'ninja-forms');?></label>
|
150 |
-
<textarea name="<?php echo $name;?>" id="<?php echo $name;?>"><?php echo $value;?></textarea>
|
151 |
-
<?php
|
152 |
-
break;
|
153 |
-
case 'submit':
|
154 |
-
?>
|
155 |
-
<input type="submit" name="submit" id="" class="<?php echo $class;?>" value="<?php _e( 'View Submissions', 'ninja-forms' );?>">
|
156 |
-
<?php
|
157 |
-
break;
|
158 |
-
}
|
159 |
-
if(isset($option['help']) AND !empty($option['help'])){
|
160 |
-
?>
|
161 |
-
<a href="#" class="tooltip">
|
162 |
-
<img id="" class='ninja-forms-help-text' src="<?php echo NINJA_FORMS_URL;?>images/question-ico.gif" title="">
|
163 |
-
<span>
|
164 |
-
<img class="callout" src="<?php echo NINJA_FORMS_URL;?>/images/callout.gif" />
|
165 |
-
<?php _e($option['help'], 'ninja-forms');?>
|
166 |
-
</span>
|
167 |
-
</a>
|
168 |
-
|
169 |
-
<?php
|
170 |
-
}
|
171 |
-
if(isset($option['desc']) AND !empty($option['desc'])){
|
172 |
-
?>
|
173 |
-
<span class="howto"><?php echo $option['desc'];?></span>
|
174 |
-
<?php
|
175 |
-
}
|
176 |
-
}
|
177 |
-
?>
|
178 |
-
</p>
|
179 |
-
<?php
|
180 |
-
}
|
181 |
-
}
|
182 |
-
?>
|
183 |
-
</div>
|
184 |
-
|
185 |
-
</div>
|
186 |
-
<?php
|
187 |
-
}
|
188 |
-
}
|
189 |
-
}
|
190 |
-
?>
|
191 |
-
</div>
|
192 |
-
<?php
|
193 |
-
}
|
194 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/admin/step-processing.php
DELETED
@@ -1,160 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Register our step processing admin page.
|
5 |
-
*
|
6 |
-
* @since 2.7.6
|
7 |
-
* @return void
|
8 |
-
*/
|
9 |
-
function nf_register_step_processing_page() {
|
10 |
-
// Register our admin page
|
11 |
-
$admin_page = add_submenu_page( NULL, __( 'Ninja Forms Processing', 'ninja-forms' ), __( 'Processing', 'ninja-forms' ), apply_filters( 'ninja_forms_admin_menu_capabilities', 'manage_options' ), 'nf-processing', 'nf_output_step_processing_page' );
|
12 |
-
|
13 |
-
add_action( 'admin_print_styles-' . $admin_page, 'nf_step_processing_css' );
|
14 |
-
add_action( 'admin_print_styles-' . $admin_page, 'nf_step_processing_js' );
|
15 |
-
}
|
16 |
-
|
17 |
-
add_action( 'admin_menu', 'nf_register_step_processing_page' );
|
18 |
-
|
19 |
-
/**
|
20 |
-
* Enqueue our step processing CSS.
|
21 |
-
*
|
22 |
-
* @since 2.7.6
|
23 |
-
* @return void
|
24 |
-
*/
|
25 |
-
function nf_step_processing_css() {
|
26 |
-
wp_enqueue_style( 'jquery-smoothness', NF_PLUGIN_URL .'css/smoothness/jquery-smoothness.css');
|
27 |
-
}
|
28 |
-
|
29 |
-
/**
|
30 |
-
* Enqueue our step processing JS.
|
31 |
-
*
|
32 |
-
* @since 2.7.6
|
33 |
-
* @return void
|
34 |
-
*/
|
35 |
-
function nf_step_processing_js() {
|
36 |
-
if ( defined( 'NINJA_FORMS_JS_DEBUG' ) && NINJA_FORMS_JS_DEBUG ) {
|
37 |
-
$suffix = '';
|
38 |
-
$src = 'dev';
|
39 |
-
} else {
|
40 |
-
$suffix = '.min';
|
41 |
-
$src = 'min';
|
42 |
-
}
|
43 |
-
wp_enqueue_script( 'nf-processing',
|
44 |
-
NF_PLUGIN_URL . 'assets/js/' . $src . '/step-processing' . $suffix . '.js',
|
45 |
-
array( 'jquery', 'jquery-ui-core', 'jquery-ui-sortable', 'jquery-ui-datepicker', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-progressbar' ) );
|
46 |
-
$step_labels = apply_filters( 'nf_step_processing_labels', array(
|
47 |
-
'Lacing Our Tabis',
|
48 |
-
'Cleaning The Dojo',
|
49 |
-
'Doing Splits',
|
50 |
-
'Buffing Bo Staff',
|
51 |
-
'Intimidating Gaze',
|
52 |
-
'Sparring',
|
53 |
-
'Packing Smoke Bombs',
|
54 |
-
'Polishing Shuriken',
|
55 |
-
'Throwing Sais',
|
56 |
-
'Calling Our Mom',
|
57 |
-
'Practicing Katas',
|
58 |
-
'Swinging Nunchucks',
|
59 |
-
'Sharpening Swords',
|
60 |
-
'Ironing Ninja Gi',
|
61 |
-
'Eating Breakfast',
|
62 |
-
'Cutting Stuff',
|
63 |
-
'Doing Dishes',
|
64 |
-
'Climbing Walls'
|
65 |
-
) );
|
66 |
-
|
67 |
-
|
68 |
-
wp_localize_script( 'nf-processing', 'nf_processing', array( 'step_labels' => $step_labels ) );
|
69 |
-
}
|
70 |
-
|
71 |
-
/**
|
72 |
-
* Output our step processing admin page.
|
73 |
-
*
|
74 |
-
* @since 2.7.6
|
75 |
-
* @return void
|
76 |
-
*/
|
77 |
-
function nf_output_step_processing_page() {
|
78 |
-
$page_title = isset ( $_REQUEST['title'] ) ? urldecode( esc_html ( $_REQUEST['title'] ) ) : __( 'Ninja Forms - Processing', 'ninja-forms' );
|
79 |
-
?>
|
80 |
-
<style>
|
81 |
-
.ui-progressbar {
|
82 |
-
position: relative;
|
83 |
-
width: 800px;
|
84 |
-
max-width: 100%;
|
85 |
-
height: 20px;
|
86 |
-
|
87 |
-
}
|
88 |
-
|
89 |
-
.progress-label {
|
90 |
-
line-height: 12px;
|
91 |
-
position: absolute;
|
92 |
-
left: 40%;
|
93 |
-
top: 4px;
|
94 |
-
font-weight: bold;
|
95 |
-
text-shadow: 1px 1px 0 #fff;
|
96 |
-
|
97 |
-
}
|
98 |
-
|
99 |
-
.ui-progressbar-value {
|
100 |
-
/*background-size: 100% auto;*/
|
101 |
-
background-color: #FFF;
|
102 |
-
background-repeat: repeat;
|
103 |
-
background-image: url(<?php echo NF_PLUGIN_URL . 'assets/images/pbar-ani.gif'; ?>);
|
104 |
-
}
|
105 |
-
|
106 |
-
</style>
|
107 |
-
<script type="text/javascript">
|
108 |
-
|
109 |
-
<?php
|
110 |
-
if ( isset ( $_REQUEST['action'] ) && ! empty ( $_REQUEST['action'] ) ) {
|
111 |
-
$action = __( 'Loading...', 'ninja-forms' );
|
112 |
-
?>
|
113 |
-
var nfProcessingAction = 'nf_<?php echo esc_html( $_REQUEST['action'] ); ?>';
|
114 |
-
<?php
|
115 |
-
} else {
|
116 |
-
$action = __( 'No Action Specified...', 'ninja-forms' );
|
117 |
-
?>
|
118 |
-
var nfProcessingAction = 'none';
|
119 |
-
<?php
|
120 |
-
}
|
121 |
-
|
122 |
-
$tmp_array = array();
|
123 |
-
$url_params = parse_url( esc_url_raw( add_query_arg( array() ) ) );
|
124 |
-
$query = $url_params['query'];
|
125 |
-
$query = parse_str( $query, $tmp_array );
|
126 |
-
unset ( $tmp_array['action'] );
|
127 |
-
unset ( $tmp_array['page'] );
|
128 |
-
?>
|
129 |
-
|
130 |
-
var nfProcessingArgs = <?php echo json_encode( $tmp_array ); ?>
|
131 |
-
|
132 |
-
</script>
|
133 |
-
|
134 |
-
<?php
|
135 |
-
|
136 |
-
?>
|
137 |
-
|
138 |
-
<div class="wrap">
|
139 |
-
<h2><?php echo $page_title ?></h2>
|
140 |
-
<div id="nf-upgrade-status">
|
141 |
-
<p><?php _e( 'The process has started, please be patient. This could take several minutes. You will be automatically redirected when the process is finished.', 'ninja-forms' ); ?></p>
|
142 |
-
<div id="progressbar">
|
143 |
-
<div class="progress-label">
|
144 |
-
<?php echo $action; ?>
|
145 |
-
</div>
|
146 |
-
</div>
|
147 |
-
</div>
|
148 |
-
</div>
|
149 |
-
|
150 |
-
<!-- DISPLAY ERRORS -->
|
151 |
-
<div id="nf-upgrade-errors" class="hidden nf-upgrade-errors">
|
152 |
-
|
153 |
-
<h3 class="nf-upgrade-errors-header">Error Log</h3>
|
154 |
-
|
155 |
-
<ul class="nf-upgrade-errors-list"></ul>
|
156 |
-
|
157 |
-
</div>
|
158 |
-
|
159 |
-
<?php
|
160 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/admin/tabs.php
DELETED
@@ -1,56 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
function ninja_forms_display_tabs(){
|
3 |
-
global $ninja_forms_tabs;
|
4 |
-
$current_tab = ninja_forms_get_current_tab();
|
5 |
-
$current_page = esc_html( $_REQUEST['page'] );
|
6 |
-
$opt = nf_get_settings();
|
7 |
-
if(isset($_REQUEST['form_id'])){
|
8 |
-
$form_id = absint( $_REQUEST['form_id'] );
|
9 |
-
}else{
|
10 |
-
$form_id = '';
|
11 |
-
}
|
12 |
-
if(isset($ninja_forms_tabs[$current_page]) AND is_array($ninja_forms_tabs[$current_page])){
|
13 |
-
foreach($ninja_forms_tabs[$current_page] as $slug => $tab){
|
14 |
-
if((isset($opt['screen_options']['tab'][$slug]['visible']) AND $opt['screen_options']['tab'][$slug]['visible'] == 1) OR !isset($opt['screen_options']['tab'][$slug]['visible'])){
|
15 |
-
if($tab['add_form_id'] == 1){
|
16 |
-
$link = remove_query_arg( array( 'update_message','notification-action' ) );
|
17 |
-
if($form_id != ''){
|
18 |
-
$link = esc_url( add_query_arg( array( 'tab' => $slug, 'form_id' => $form_id ), $link ) );
|
19 |
-
}else{
|
20 |
-
$link = esc_url( add_query_arg( array( 'tab' => $slug ), $link ) );
|
21 |
-
}
|
22 |
-
}else{
|
23 |
-
$link = esc_url( remove_query_arg( array( 'form_id', 'tab', 'update_message' ) ) );
|
24 |
-
$link = esc_url( add_query_arg( array( 'tab' => $slug ), $link ) );
|
25 |
-
}
|
26 |
-
|
27 |
-
if($tab['disable_no_form_id'] AND ($form_id == '' OR $form_id == 'new')){
|
28 |
-
$link = '';
|
29 |
-
}
|
30 |
-
|
31 |
-
if( isset( $tab['url'] ) ){
|
32 |
-
$link = $tab['url'];
|
33 |
-
}
|
34 |
-
|
35 |
-
if( isset( $tab['target'] ) ){
|
36 |
-
$target = $tab['target'];
|
37 |
-
}else{
|
38 |
-
$target = '';
|
39 |
-
}
|
40 |
-
|
41 |
-
if($tab['show_this_tab_link']){
|
42 |
-
if($current_tab == $slug){
|
43 |
-
?>
|
44 |
-
<span class="nav-tab nav-tab-active <?php echo $tab['active_class'];?>"><?php echo $tab['name'];?></span>
|
45 |
-
<?php
|
46 |
-
}else{
|
47 |
-
?>
|
48 |
-
<a href="<?php echo $link;?>" target="<?php echo $target;?>" class="nav-tab <?php echo $tab['inactive_class'];?>"><?php echo $tab['name'];?></a>
|
49 |
-
<?php
|
50 |
-
}
|
51 |
-
}
|
52 |
-
}
|
53 |
-
}
|
54 |
-
}
|
55 |
-
}
|
56 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/admin/upgrades/class-upgrade-handler.php
DELETED
@@ -1,162 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
|
3 |
-
if( ! function_exists( 'nf_is_func_disabled' ) ) {
|
4 |
-
function nf_is_func_disabled($function)
|
5 |
-
{
|
6 |
-
$disabled = explode(',', ini_get('disable_functions'));
|
7 |
-
|
8 |
-
return in_array($function, $disabled);
|
9 |
-
}
|
10 |
-
}
|
11 |
-
|
12 |
-
require_once( NF_PLUGIN_DIR . 'includes/admin/upgrades/database-migrations.php' );
|
13 |
-
require_once( NF_PLUGIN_DIR . 'includes/admin/upgrades/convert-forms.php' );
|
14 |
-
require_once( NF_PLUGIN_DIR . 'includes/admin/upgrades/convert-notifications.php' );
|
15 |
-
require_once( NF_PLUGIN_DIR . 'includes/admin/upgrades/convert-subs.php' );
|
16 |
-
require_once( NF_PLUGIN_DIR . 'includes/admin/upgrades/update-email-settings.php' );
|
17 |
-
|
18 |
-
/**
|
19 |
-
* Class NF_Upgrade_Handler
|
20 |
-
*/
|
21 |
-
class NF_UpgradeHandler
|
22 |
-
{
|
23 |
-
static $instance;
|
24 |
-
|
25 |
-
public $upgrades;
|
26 |
-
|
27 |
-
private $page;
|
28 |
-
|
29 |
-
public static function instance()
|
30 |
-
{
|
31 |
-
if ( ! isset( self::$instance ) ) {
|
32 |
-
self::$instance = new NF_UpgradeHandler();
|
33 |
-
}
|
34 |
-
|
35 |
-
return self::$instance;
|
36 |
-
}
|
37 |
-
|
38 |
-
public function __construct()
|
39 |
-
{
|
40 |
-
|
41 |
-
if ( function_exists( 'ignore_user_abort' ) && ! nf_is_func_disabled( 'ignore_user_abort' ) ) {
|
42 |
-
ignore_user_abort( true );
|
43 |
-
}
|
44 |
-
|
45 |
-
$this->register_upgrades();
|
46 |
-
|
47 |
-
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
|
48 |
-
add_action( 'wp_ajax_nf_upgrade_handler', array( $this, 'ajax_response' ) );
|
49 |
-
return;
|
50 |
-
} else {
|
51 |
-
$this->page = new NF_UpgradeHandlerPage();
|
52 |
-
}
|
53 |
-
|
54 |
-
}
|
55 |
-
|
56 |
-
public function register_upgrades()
|
57 |
-
{
|
58 |
-
$this->upgrades[] = new NF_Upgrade_Database_Migrations();
|
59 |
-
$this->upgrades[] = new NF_Upgrade_Forms();
|
60 |
-
$this->upgrades[] = new NF_Upgrade_Notifications();
|
61 |
-
$this->upgrades[] = new NF_Upgrade_Submissions();
|
62 |
-
$this->upgrades[] = new NF_Upgrade_Email_Settings();
|
63 |
-
|
64 |
-
$this->upgrades = apply_filters( 'nf_upgrade_handler_register', $this->upgrades );
|
65 |
-
|
66 |
-
usort( $this->upgrades, array( $this, 'compare_upgrade_priority' ) ) ;
|
67 |
-
}
|
68 |
-
|
69 |
-
private function compare_upgrade_priority( $a, $b )
|
70 |
-
{
|
71 |
-
return version_compare( $a->priority, $b->priority );
|
72 |
-
}
|
73 |
-
|
74 |
-
public function ajax_response()
|
75 |
-
{
|
76 |
-
$current_step = ( isset( $_REQUEST['step'] ) ) ? $_REQUEST['step'] : 0;
|
77 |
-
|
78 |
-
$current_upgrade = $this->getUpgradeByName( $_REQUEST['upgrade'] );
|
79 |
-
|
80 |
-
$current_upgrade->total_steps = $_REQUEST['total_steps'];
|
81 |
-
|
82 |
-
if( isset( $_REQUEST['args'] ) ) {
|
83 |
-
$current_upgrade->args = $_REQUEST['args'];
|
84 |
-
}
|
85 |
-
|
86 |
-
if( 0 == $current_step ) {
|
87 |
-
$current_upgrade->loading();
|
88 |
-
}
|
89 |
-
|
90 |
-
$response = array(
|
91 |
-
'upgrade' => $current_upgrade->name,
|
92 |
-
'total_steps' => (int) $current_upgrade->total_steps,
|
93 |
-
'args' => $current_upgrade->args,
|
94 |
-
);
|
95 |
-
|
96 |
-
if( 0 != $current_step ) {
|
97 |
-
|
98 |
-
if (is_array($current_upgrade->errors) AND $current_upgrade->errors) {
|
99 |
-
$response['errors'] = $current_upgrade->errors;
|
100 |
-
}
|
101 |
-
|
102 |
-
if ($current_upgrade->total_steps < $current_step ) {
|
103 |
-
|
104 |
-
$current_upgrade->complete();
|
105 |
-
$response['complete'] = TRUE;
|
106 |
-
$next_upgrade = $this->getNextUpgrade($current_upgrade);
|
107 |
-
|
108 |
-
if ($next_upgrade) {
|
109 |
-
if( ! $next_upgrade->isComplete() ) {
|
110 |
-
$response['nextUpgrade'] = $next_upgrade->name;
|
111 |
-
}
|
112 |
-
}
|
113 |
-
} else {
|
114 |
-
|
115 |
-
$current_upgrade->_step($current_step);
|
116 |
-
|
117 |
-
}
|
118 |
-
|
119 |
-
}
|
120 |
-
|
121 |
-
$response['step'] = $current_step + 1;
|
122 |
-
|
123 |
-
echo json_encode( $response );
|
124 |
-
die();
|
125 |
-
}
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
/*
|
130 |
-
* UTILITY METHODS
|
131 |
-
*/
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
public function getUpgradeByName( $name )
|
136 |
-
{
|
137 |
-
foreach ( $this->upgrades as $index => $upgrade ) {
|
138 |
-
if ( $name == $upgrade->name ) {
|
139 |
-
return $upgrade;
|
140 |
-
}
|
141 |
-
}
|
142 |
-
}
|
143 |
-
|
144 |
-
public function getNextUpgrade( $current_upgrade )
|
145 |
-
{
|
146 |
-
foreach ( $this->upgrades as $index => $upgrade ) {
|
147 |
-
if ( $current_upgrade->name == $upgrade->name ) {
|
148 |
-
|
149 |
-
if( isset( $this->upgrades[ $index + 1 ] ) ) {
|
150 |
-
return $this->upgrades[ $index + 1 ];
|
151 |
-
}
|
152 |
-
}
|
153 |
-
}
|
154 |
-
|
155 |
-
return FALSE;
|
156 |
-
}
|
157 |
-
}
|
158 |
-
|
159 |
-
function NF_UpgradeHandler() {
|
160 |
-
return NF_UpgradeHandler::instance();
|
161 |
-
}
|
162 |
-
NF_UpgradeHandler();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/admin/upgrades/class-upgrade.php
DELETED
@@ -1,191 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Class NF_Upgrade
|
5 |
-
*
|
6 |
-
* The Upgrade class should be extended by all upgrades to be used by the Upgrade Handler.
|
7 |
-
*/
|
8 |
-
abstract class NF_Upgrade
|
9 |
-
{
|
10 |
-
/**
|
11 |
-
* @var name
|
12 |
-
*
|
13 |
-
* The name is the unique identifier for the upgrade.
|
14 |
-
*/
|
15 |
-
public $name;
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
/**
|
20 |
-
* @var priority
|
21 |
-
*
|
22 |
-
* The priority determines the oder in which the upgrades are run.
|
23 |
-
* Priorities are compared as version numbers that corresponds to when they were introduced.
|
24 |
-
*/
|
25 |
-
public $priority;
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
/**
|
30 |
-
* @var decription
|
31 |
-
*
|
32 |
-
* The description will be displayed for the user in the Upgrade Handler admin screen.
|
33 |
-
*/
|
34 |
-
public $description;
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
/**
|
39 |
-
* @var total_steps
|
40 |
-
*
|
41 |
-
* The total number of steps that need to be processed.
|
42 |
-
*/
|
43 |
-
public $total_steps;
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
/**
|
48 |
-
* @var args
|
49 |
-
*
|
50 |
-
* The args variable is passes between calls.
|
51 |
-
*/
|
52 |
-
public $args = array();
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
/**
|
57 |
-
* @var errors
|
58 |
-
*
|
59 |
-
* The errors property is used to store errors for the Upgrade Handler to reference.
|
60 |
-
*/
|
61 |
-
public $errors = array();
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
/**
|
66 |
-
* Constructor
|
67 |
-
*/
|
68 |
-
public function __construct()
|
69 |
-
{
|
70 |
-
$this->nice_name = ucwords( str_replace( '_', ' ', $this->name) );
|
71 |
-
$this->description = __( $this->description, 'ninja-forms' );
|
72 |
-
}
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
/**
|
77 |
-
* Loading
|
78 |
-
*
|
79 |
-
* The loading method is used to setup the upgrade and is called by the Upgrade Handler.
|
80 |
-
*/
|
81 |
-
abstract function loading();
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
/**
|
86 |
-
* Step
|
87 |
-
*
|
88 |
-
* @param $step
|
89 |
-
*
|
90 |
-
* The step method will be called by the parent _step method.
|
91 |
-
*/
|
92 |
-
abstract public function step( $step );
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
/**
|
97 |
-
* Complete
|
98 |
-
*
|
99 |
-
* The complete method will be called by the Upgrade Handler when all steps are complete.
|
100 |
-
*/
|
101 |
-
abstract public function complete();
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
/**
|
106 |
-
* Is Complete
|
107 |
-
*
|
108 |
-
* The isComplete method checks to see if the upgrade has already been completed.
|
109 |
-
*/
|
110 |
-
abstract public function isComplete();
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
/**
|
115 |
-
* _Step
|
116 |
-
*
|
117 |
-
* @param $step
|
118 |
-
*
|
119 |
-
* The _step method is called by the Upgrade Handler and is a middleman for step.
|
120 |
-
*/
|
121 |
-
public function _step( $step )
|
122 |
-
{
|
123 |
-
$last_step = $this->getLastStep();
|
124 |
-
|
125 |
-
if( $step < $last_step ) {
|
126 |
-
$step = $last_step;
|
127 |
-
}
|
128 |
-
|
129 |
-
$this->_beforeStep( $step );
|
130 |
-
$this->step( $step );
|
131 |
-
$this->_afterStep( $step );
|
132 |
-
$this->setLastStep( $step );
|
133 |
-
}
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
/**
|
138 |
-
* Before Step
|
139 |
-
*
|
140 |
-
* @param $step
|
141 |
-
*
|
142 |
-
* The _beforeStep method is called by the _step method before calling the extended step method.
|
143 |
-
*/
|
144 |
-
public function _beforeStep( $step )
|
145 |
-
{
|
146 |
-
// This method is optionally extended and is intentionally left blank.
|
147 |
-
}
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
/**
|
152 |
-
* After Step
|
153 |
-
*
|
154 |
-
* @param $step
|
155 |
-
*
|
156 |
-
* The _afterStep method is called by the _step method after calling the extended step method.
|
157 |
-
*/
|
158 |
-
public function _afterStep( $step )
|
159 |
-
{
|
160 |
-
// This method is optionally extended and is intentionally left blank.
|
161 |
-
}
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
/**
|
166 |
-
* Get Last Step
|
167 |
-
*
|
168 |
-
* Gets the last step processed from the wp_options table.
|
169 |
-
*
|
170 |
-
* @return mixed
|
171 |
-
*/
|
172 |
-
public function getLastStep()
|
173 |
-
{
|
174 |
-
return get_option( 'nf_upgrade_' . $this->name . '_last_step', 0 );
|
175 |
-
}
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
/**
|
180 |
-
* Set Last Step
|
181 |
-
*
|
182 |
-
* Updates the value in the wp_options table with the last step processed.
|
183 |
-
*
|
184 |
-
* @param $step
|
185 |
-
*/
|
186 |
-
public function setLastStep( $step )
|
187 |
-
{
|
188 |
-
update_option( 'nf_upgrade_' . $this->name . '_last_step', $step );
|
189 |
-
}
|
190 |
-
|
191 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/admin/upgrades/convert-forms-reset.php
DELETED
@@ -1,83 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
|
3 |
-
class NF_Convert_Forms_Reset
|
4 |
-
{
|
5 |
-
public function __construct()
|
6 |
-
{
|
7 |
-
add_action('admin_menu', array( $this, 'register_submenu'), 9001);
|
8 |
-
add_filter( 'nf_general_settings_advanced', array( $this, 'register_advanced_settings' ) );
|
9 |
-
}
|
10 |
-
|
11 |
-
public function register_submenu()
|
12 |
-
{
|
13 |
-
add_submenu_page(
|
14 |
-
NULL, // Parent Slug
|
15 |
-
'Ninja Forms Conversion Reset', // Page Title
|
16 |
-
'Ninja Forms Conversion Reset', // Menu Title
|
17 |
-
'manage_options', // Capability
|
18 |
-
'ninja-forms-conversion-reset', // Menu Slug
|
19 |
-
array( $this, 'display') // Function
|
20 |
-
);
|
21 |
-
}
|
22 |
-
|
23 |
-
public function display() {
|
24 |
-
echo "<h1>" . __( 'Reset Forms Conversion', 'ninja-forms' ) . "</h1>";
|
25 |
-
|
26 |
-
$this->process();
|
27 |
-
|
28 |
-
echo '<script>window.location.replace("' . site_url('wp-admin/index.php?page=nf-processing&action=convert_forms&title=Updating+Form+Database') . '");</script>';
|
29 |
-
}
|
30 |
-
|
31 |
-
public function process()
|
32 |
-
{
|
33 |
-
// Remove our "converted" flags from the options table
|
34 |
-
delete_option( 'nf_convert_forms_complete' );
|
35 |
-
delete_option( 'nf_converted_forms' );
|
36 |
-
|
37 |
-
// Add flag for conversion being reset
|
38 |
-
update_option( 'nf_converted_form_reset', true );
|
39 |
-
}
|
40 |
-
|
41 |
-
public function register_advanced_settings( $advanced_settings ) {
|
42 |
-
|
43 |
-
$new_advanced_setting = array(
|
44 |
-
'name' => 'reset-conversion',
|
45 |
-
'type' => '',
|
46 |
-
'label' => __( 'Reset Form Conversion', 'ninja-forms' ),
|
47 |
-
'display_function' => array( $this, 'display_advanced_settings' )
|
48 |
-
);
|
49 |
-
|
50 |
-
$advanced_settings[] = $new_advanced_setting;
|
51 |
-
|
52 |
-
return $advanced_settings;
|
53 |
-
}
|
54 |
-
|
55 |
-
public function display_advanced_settings() {
|
56 |
-
//TODO move this to a view
|
57 |
-
?>
|
58 |
-
<a href="#" class="button-primary nf-reset-form-conversion"><?php _e( 'Reset Form Conversion', 'ninja-forms' ); ?></a>
|
59 |
-
<p class="description">
|
60 |
-
<?php _e( 'If your forms are "missing" after updating to 2.9, this button will attempt to reconvert your old forms to show them in 2.9. All current forms will remain in the "All Forms" table.', 'ninja-forms' ); ?>
|
61 |
-
</p>
|
62 |
-
|
63 |
-
<div id="nf-conversion-reset">
|
64 |
-
<p>
|
65 |
-
<?php _e( 'All current forms will remain in the "All Forms" table. In some cases some forms may be duplicated during this process.', 'ninja-forms' ); ?>
|
66 |
-
</p>
|
67 |
-
</div>
|
68 |
-
|
69 |
-
<div id="nf-conversion-reset-buttons">
|
70 |
-
<div id="nf-admin-modal-cancel">
|
71 |
-
<a class="submitdelete deletion modal-close" href="#"><?php _e( 'Cancel', 'ninja-forms' ); ?></a>
|
72 |
-
</div>
|
73 |
-
<div id="nf-admin-modal-update">
|
74 |
-
<a class="button-primary" href="<?php echo site_url('wp-admin/index.php?page=ninja-forms-conversion-reset'); ?>"><?php _e( 'Continue', 'ninja-forms' ); ?></a>
|
75 |
-
</div>
|
76 |
-
</div>
|
77 |
-
<?php
|
78 |
-
}
|
79 |
-
|
80 |
-
} // End Ninja_Forms_View_Admin Class
|
81 |
-
|
82 |
-
// Self-Instantiate
|
83 |
-
new NF_Convert_Forms_Reset();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/admin/upgrades/convert-forms.php
DELETED
@@ -1,181 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
|
3 |
-
final class NF_Upgrade_Forms extends NF_Upgrade
|
4 |
-
{
|
5 |
-
public $name = 'forms';
|
6 |
-
|
7 |
-
public $priority = '2.9.0';
|
8 |
-
|
9 |
-
public $description = 'Form settings and information needs to be transferred to a new forms database. This new storage method will make it much easier effecient to interact with forms.';
|
10 |
-
|
11 |
-
public $completed_forms = array();
|
12 |
-
|
13 |
-
public $args = array();
|
14 |
-
|
15 |
-
public $errors = array();
|
16 |
-
|
17 |
-
public function loading()
|
18 |
-
{
|
19 |
-
global $wpdb;
|
20 |
-
|
21 |
-
// Check that the table exists
|
22 |
-
if( 0 == $wpdb->query( "SHOW TABLES LIKE '" . NINJA_FORMS_TABLE_NAME . "'" ) ) {
|
23 |
-
//TODO Maybe change error to debug message instead
|
24 |
-
$this->errors[] = NINJA_FORMS_TABLE_NAME . ' is not in the database';
|
25 |
-
return;
|
26 |
-
}
|
27 |
-
|
28 |
-
// Get all our forms
|
29 |
-
$forms = $wpdb->get_results( 'SELECT id FROM ' . NINJA_FORMS_TABLE_NAME, ARRAY_A );
|
30 |
-
|
31 |
-
$x = 1;
|
32 |
-
if ( is_array( $forms ) ) {
|
33 |
-
foreach ( $forms as $form ) {
|
34 |
-
$this->args['forms'][$x] = $form['id'];
|
35 |
-
$x++;
|
36 |
-
}
|
37 |
-
}
|
38 |
-
|
39 |
-
$this->total_steps = count( $this->args['forms'] );
|
40 |
-
|
41 |
-
if( empty( $this->total_steps ) || $this->total_steps <= 1 ) {
|
42 |
-
$this->total_steps = 1;
|
43 |
-
}
|
44 |
-
|
45 |
-
}
|
46 |
-
|
47 |
-
public function _beforeStep( $step )
|
48 |
-
{
|
49 |
-
// Get a list of forms that we've already converted.
|
50 |
-
$this->completed_forms = get_option( 'nf_converted_forms', array() );
|
51 |
-
|
52 |
-
if ( ! is_array( $this->completed_forms ) ) {
|
53 |
-
$this->completed_forms = array();
|
54 |
-
}
|
55 |
-
|
56 |
-
$this->form_id = $this->args['forms'][ $step ];
|
57 |
-
|
58 |
-
Ninja_Forms()->form( $this->form_id )->dumpCache();
|
59 |
-
|
60 |
-
// Bail if we've already converted the db for this form.
|
61 |
-
if ( in_array( $this->form_id, $this->completed_forms ) ) {
|
62 |
-
return false;
|
63 |
-
}
|
64 |
-
}
|
65 |
-
|
66 |
-
public function step( $step )
|
67 |
-
{
|
68 |
-
$this->update_form_settings( $this->form_id );
|
69 |
-
}
|
70 |
-
|
71 |
-
public function _afterStep( $step )
|
72 |
-
{
|
73 |
-
$this->completed_forms[] = $this->form_id;
|
74 |
-
update_option( 'nf_converted_forms', $this->completed_forms );
|
75 |
-
|
76 |
-
Ninja_Forms()->form( $this->form_id )->dumpCache();
|
77 |
-
}
|
78 |
-
|
79 |
-
public function complete()
|
80 |
-
{
|
81 |
-
update_option( 'nf_convert_forms_complete', true );
|
82 |
-
update_option( 'nf_converted_form_reset', false );
|
83 |
-
}
|
84 |
-
|
85 |
-
public function isComplete()
|
86 |
-
{
|
87 |
-
return get_option( 'nf_convert_forms_complete', false );
|
88 |
-
}
|
89 |
-
|
90 |
-
/*
|
91 |
-
* CONVERSION METHODS
|
92 |
-
*/
|
93 |
-
|
94 |
-
public function update_form_settings( $form_id )
|
95 |
-
{
|
96 |
-
global $wpdb;
|
97 |
-
|
98 |
-
// Check to see if the conversion has been reset.
|
99 |
-
$is_reset = get_option( 'nf_converted_form_reset', 0 );
|
100 |
-
|
101 |
-
// Check to see if an object exists with our form id.
|
102 |
-
$type = nf_get_object_type($form_id);
|
103 |
-
|
104 |
-
if ( $type ) {
|
105 |
-
// We have an object with our form id.
|
106 |
-
|
107 |
-
if ( $is_reset AND 'form' == $type ) {
|
108 |
-
// Give precedence to the most recent form.
|
109 |
-
|
110 |
-
// Set a new ID for the form being converted.
|
111 |
-
$f_id = nf_insert_object('form');
|
112 |
-
|
113 |
-
$fields = $wpdb->get_results("SELECT * FROM " . NINJA_FORMS_FIELDS_TABLE_NAME . " WHERE form_id = " . $form_id, ARRAY_A);
|
114 |
-
|
115 |
-
foreach ($fields as $field) {
|
116 |
-
|
117 |
-
unset($field['id']);
|
118 |
-
|
119 |
-
$field['form_id'] = $f_id;
|
120 |
-
|
121 |
-
// Copy the Fields to the new ID.
|
122 |
-
$wpdb->insert(NINJA_FORMS_FIELDS_TABLE_NAME, $field);
|
123 |
-
|
124 |
-
}
|
125 |
-
|
126 |
-
$relationships = $wpdb->get_results("SELECT * FROM " . NF_OBJECT_RELATIONSHIPS_TABLE_NAME . " WHERE parent_id = " . $form_id, ARRAY_A);
|
127 |
-
|
128 |
-
foreach ($relationships as $relationship) {
|
129 |
-
|
130 |
-
unset($relationship['id']);
|
131 |
-
|
132 |
-
// Copy the object related to the form.
|
133 |
-
$object = $wpdb->get_results("SELECT * FROM " . NF_OBJECTS_TABLE_NAME . " WHERE id = " . $relationship['child_id'], ARRAY_A);
|
134 |
-
|
135 |
-
unset($object['id']);
|
136 |
-
|
137 |
-
$wpdb->insert(NF_OBJECTS_TABLE_NAME, $object);
|
138 |
-
|
139 |
-
$relationship['child_id'] = $wpdb->insert_id;
|
140 |
-
|
141 |
-
$relationship['parent_id'] = $f_id;
|
142 |
-
|
143 |
-
// Copy the Relationships to the new ID.
|
144 |
-
$wpdb->insert(NF_OBJECT_RELATIONSHIPS_TABLE_NAME, $relationship);
|
145 |
-
|
146 |
-
}
|
147 |
-
|
148 |
-
} else {
|
149 |
-
// Give precedence to the converting form.
|
150 |
-
|
151 |
-
// Insert a new object.
|
152 |
-
$next_id = nf_insert_object($type);
|
153 |
-
|
154 |
-
// Replace all instances of the conflicting object ID with our new one.
|
155 |
-
$wpdb->update(NF_OBJECT_META_TABLE_NAME, array('object_id' => $next_id), array('object_id' => $form_id));
|
156 |
-
$wpdb->update(NF_OBJECT_RELATIONSHIPS_TABLE_NAME, array('parent_id' => $next_id), array('parent_type' => $type, 'parent_id' => $form_id));
|
157 |
-
$wpdb->update(NF_OBJECT_RELATIONSHIPS_TABLE_NAME, array('child_id' => $next_id), array('child_type' => $type, 'child_id' => $form_id));
|
158 |
-
|
159 |
-
// Delete the original (conflicting) object
|
160 |
-
$wpdb->query('DELETE FROM ' . NF_OBJECTS_TABLE_NAME . ' WHERE id = ' . $form_id);
|
161 |
-
|
162 |
-
}
|
163 |
-
|
164 |
-
}
|
165 |
-
|
166 |
-
// Get the form from the old table.
|
167 |
-
$form = $wpdb->get_row( 'SELECT * FROM ' . NINJA_FORMS_TABLE_NAME . ' WHERE id = ' . $form_id, ARRAY_A );
|
168 |
-
|
169 |
-
// Set the insert form ID, if not already set.
|
170 |
-
$f_id = isset ( $f_id ) ? $f_id : nf_insert_object( 'form', $form['id'] );
|
171 |
-
|
172 |
-
// Unpack the converted form's settings
|
173 |
-
$settings = maybe_unserialize( $form['data'] );
|
174 |
-
$settings['date_updated'] = $form['date_updated'];
|
175 |
-
|
176 |
-
foreach ( $settings as $meta_key => $value ) {
|
177 |
-
nf_update_object_meta( $f_id, $meta_key, $value );
|
178 |
-
}
|
179 |
-
nf_update_object_meta( $f_id, 'status', '' );
|
180 |
-
}
|
181 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/admin/upgrades/convert-notifications.php
DELETED
@@ -1,341 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
|
3 |
-
final class NF_Upgrade_Notifications extends NF_Upgrade
|
4 |
-
{
|
5 |
-
public $name = 'notifications';
|
6 |
-
|
7 |
-
public $priority = '2.9.2';
|
8 |
-
|
9 |
-
public $description = 'An update is necessary for the new Emails & Actions tab to function properly. This new section gives the user much more control over what happens when a form is submitted.';
|
10 |
-
|
11 |
-
public $completed_forms = array();
|
12 |
-
|
13 |
-
public $args = array();
|
14 |
-
|
15 |
-
public $errors = array();
|
16 |
-
|
17 |
-
public function loading()
|
18 |
-
{
|
19 |
-
global $wpdb;
|
20 |
-
|
21 |
-
$this->removeOldEmailSettings();
|
22 |
-
|
23 |
-
$form_count = $this->getFormCount();
|
24 |
-
|
25 |
-
$forms = $this->getAllForms();
|
26 |
-
|
27 |
-
$x = 1;
|
28 |
-
if ( is_array( $forms ) ) {
|
29 |
-
foreach ( $forms as $form ) {
|
30 |
-
$this->args['forms'][$x] = $form['id'];
|
31 |
-
$x++;
|
32 |
-
}
|
33 |
-
}
|
34 |
-
|
35 |
-
if( empty( $this->total_steps ) || $this->total_steps <= 1 ) {
|
36 |
-
$this->total_steps = $form_count;
|
37 |
-
}
|
38 |
-
}
|
39 |
-
|
40 |
-
public function _beforeStep( $step )
|
41 |
-
{
|
42 |
-
// Get a list of forms that we've already converted.
|
43 |
-
$this->completed_forms = get_option( 'nf_convert_notifications_forms', array() );
|
44 |
-
|
45 |
-
if ( ! is_array( $this->completed_forms ) ) {
|
46 |
-
$this->completed_forms = array();
|
47 |
-
}
|
48 |
-
}
|
49 |
-
|
50 |
-
public function step( $step )
|
51 |
-
{
|
52 |
-
global $ninja_forms_fields;
|
53 |
-
|
54 |
-
// Get our form ID
|
55 |
-
$form_id = $this->args['forms'][ $step ];
|
56 |
-
|
57 |
-
// Bail if we've already converted the notifications for this form.
|
58 |
-
if ( in_array( $form_id, $this->completed_forms ) )
|
59 |
-
return false;
|
60 |
-
|
61 |
-
// Grab our form from the database
|
62 |
-
$form_settings = Ninja_Forms()->form( $form_id )->settings;
|
63 |
-
|
64 |
-
$fields = Ninja_Forms()->form( $form_id )->fields;
|
65 |
-
|
66 |
-
$process_fields = array();
|
67 |
-
foreach( $fields as $field_id => $field ) {
|
68 |
-
$label = strip_tags( nf_get_field_admin_label( $field_id ) );
|
69 |
-
|
70 |
-
if ( strlen( $label ) > 30 ) {
|
71 |
-
$tmp_label = substr( $label, 0, 30 );
|
72 |
-
} else {
|
73 |
-
$tmp_label = $label;
|
74 |
-
}
|
75 |
-
|
76 |
-
$tmp_array = array( 'value' => $field_id, 'label' => $tmp_label . ' - ID: ' . $field_id );
|
77 |
-
|
78 |
-
$admin_label = $label;
|
79 |
-
|
80 |
-
$label = isset( $field['data']['label'] ) ? $field['data']['label'] : '';
|
81 |
-
|
82 |
-
// Check to see if this field is supposed to be "processed"
|
83 |
-
$type = $field['type'];
|
84 |
-
if ( isset ( $ninja_forms_fields[ $type ]['process_field'] ) && $ninja_forms_fields[ $type ]['process_field'] ) {
|
85 |
-
$process_fields[ $field_id ] = array( 'field_id' => $field_id, 'label' => $label, 'admin_label' => $admin_label );
|
86 |
-
}
|
87 |
-
}
|
88 |
-
|
89 |
-
// Create a notification for our admin email
|
90 |
-
if ( ( isset ( $form_settings['admin_email_msg'] ) && ! empty ( $form_settings['admin_email_msg'] ) ) || ( isset ( $form_settings['admin_email_fields'] ) && 1 == $form_settings['admin_email_fields'] ) ) {
|
91 |
-
|
92 |
-
// Create a notification
|
93 |
-
$n_id = nf_insert_notification( $form_id );
|
94 |
-
|
95 |
-
// Update our notification type
|
96 |
-
nf_update_object_meta( $n_id, 'type', 'email' );
|
97 |
-
|
98 |
-
// Activate our notification
|
99 |
-
Ninja_Forms()->notification( $n_id )->activate();
|
100 |
-
|
101 |
-
// Update our notification name
|
102 |
-
Ninja_Forms()->notification( $n_id )->update_setting( 'name', __( 'Admin Email', 'ninja-forms' ) );
|
103 |
-
|
104 |
-
$admin_mailto = isset ( $form_settings['admin_mailto'] ) ? $form_settings['admin_mailto'] : array();
|
105 |
-
|
106 |
-
// Implode our admin email addresses
|
107 |
-
$to = implode('`', $admin_mailto );
|
108 |
-
// Update our to setting
|
109 |
-
Ninja_Forms()->notification( $n_id )->update_setting( 'to', $to );
|
110 |
-
|
111 |
-
// Update our Format Setting
|
112 |
-
Ninja_Forms()->notification( $n_id )->update_setting( 'email_format', $form_settings['email_type'] );
|
113 |
-
|
114 |
-
// Update our attach csv option
|
115 |
-
Ninja_Forms()->notification( $n_id )->update_setting( 'attach_csv', $form_settings['admin_attach_csv'] );
|
116 |
-
|
117 |
-
// Update our subject
|
118 |
-
$subject = $this->replace_shortcodes( $form_settings['admin_subject'] );
|
119 |
-
|
120 |
-
Ninja_Forms()->notification( $n_id )->update_setting( 'email_subject', $subject );
|
121 |
-
|
122 |
-
// Update our From Name
|
123 |
-
if ( isset ( $form_settings['email_from_name'] ) ) {
|
124 |
-
Ninja_Forms()->notification( $n_id )->update_setting( 'from_name', $form_settings['email_from_name'] );
|
125 |
-
}
|
126 |
-
|
127 |
-
foreach ( $fields as $field ) {
|
128 |
-
if ( isset ( $field['data']['from_name'] ) && $field['data']['from_name'] == 1 ) {
|
129 |
-
// Update our From Name
|
130 |
-
Ninja_Forms()->notification( $n_id )->update_setting( 'from_name', 'field_' . $field['id'] );
|
131 |
-
break;
|
132 |
-
}
|
133 |
-
}
|
134 |
-
|
135 |
-
// Update our From Address
|
136 |
-
Ninja_Forms()->notification( $n_id )->update_setting( 'from_address', $form_settings['email_from'] );
|
137 |
-
|
138 |
-
// Get our reply-to address
|
139 |
-
foreach ( $fields as $field ) {
|
140 |
-
if ( isset ( $field['data']['replyto_email'] ) && $field['data']['replyto_email'] == 1 ) {
|
141 |
-
Ninja_Forms()->notification( $n_id )->update_setting( 'reply_to', 'field_' . $field['id'] );
|
142 |
-
break;
|
143 |
-
}
|
144 |
-
}
|
145 |
-
|
146 |
-
$email_message = $form_settings['admin_email_msg'];
|
147 |
-
|
148 |
-
// Check to see if the "include list of fields" checkbox was checked.
|
149 |
-
if ( isset ( $form_settings['admin_email_fields'] ) && $form_settings['admin_email_fields'] == 1 ) {
|
150 |
-
$email_message .= '<br />[ninja_forms_all_fields]';
|
151 |
-
}
|
152 |
-
|
153 |
-
// Update our email message
|
154 |
-
Ninja_Forms()->notification( $n_id )->update_setting( 'email_message', $email_message );
|
155 |
-
|
156 |
-
Ninja_Forms()->notification( $n_id )->update_setting( 'admin_email', true );
|
157 |
-
}
|
158 |
-
|
159 |
-
// Create a notification for our user email
|
160 |
-
if ( ! empty ( $fields ) ) {
|
161 |
-
$addresses = array();
|
162 |
-
foreach ( $fields as $field_id => $field ) {
|
163 |
-
if ( isset ( $field['data']['send_email'] ) && $field['data']['send_email'] == 1 ) {
|
164 |
-
// Add this field to our $addresses variable.
|
165 |
-
$addresses[] = 'field_' . $field_id;
|
166 |
-
unset( $field['data']['send_email'] );
|
167 |
-
unset( $field['data']['replyto_email'] );
|
168 |
-
unset( $field['data']['from_name'] );
|
169 |
-
|
170 |
-
$args = array(
|
171 |
-
'update_array' => array(
|
172 |
-
'data' => serialize( $field['data'] ),
|
173 |
-
),
|
174 |
-
'where' => array(
|
175 |
-
'id' => $field_id,
|
176 |
-
),
|
177 |
-
);
|
178 |
-
|
179 |
-
ninja_forms_update_field( $args );
|
180 |
-
}
|
181 |
-
}
|
182 |
-
|
183 |
-
if ( ! empty ( $addresses ) ) {
|
184 |
-
// We have a user email, so create a notification
|
185 |
-
$n_id = nf_insert_notification( $form_id );
|
186 |
-
|
187 |
-
// Update our notification type
|
188 |
-
nf_update_object_meta( $n_id, 'type', 'email' );
|
189 |
-
|
190 |
-
// Activate our notification
|
191 |
-
Ninja_Forms()->notification( $n_id )->activate();
|
192 |
-
|
193 |
-
// Update our notification name
|
194 |
-
Ninja_Forms()->notification( $n_id )->update_setting( 'name', __( 'User Email', 'ninja-forms' ) );
|
195 |
-
|
196 |
-
// Implode our admin email addresses
|
197 |
-
$n_var = count ( $addresses ) > 1 ? 'bcc' : 'to';
|
198 |
-
$addresses = implode( '`', $addresses );
|
199 |
-
Ninja_Forms()->notification( $n_id )->update_setting( $n_var, $addresses );
|
200 |
-
|
201 |
-
// Update our Format Setting
|
202 |
-
Ninja_Forms()->notification( $n_id )->update_setting( 'email_format', $form_settings['email_type'] );
|
203 |
-
|
204 |
-
// Update our subject
|
205 |
-
$subject = $this->replace_shortcodes( $form_settings['user_subject'] );
|
206 |
-
|
207 |
-
Ninja_Forms()->notification( $n_id )->update_setting( 'email_subject', $subject );
|
208 |
-
|
209 |
-
// Update our From Name
|
210 |
-
if ( isset ( $form_settings['email_from_name'] ) ) {
|
211 |
-
Ninja_Forms()->notification( $n_id )->update_setting( 'from_name', $form_settings['email_from_name'] );
|
212 |
-
}
|
213 |
-
|
214 |
-
// Update our From Address
|
215 |
-
Ninja_Forms()->notification( $n_id )->update_setting( 'from_address', $form_settings['email_from'] );
|
216 |
-
|
217 |
-
$email_message = $form_settings['user_email_msg'];
|
218 |
-
|
219 |
-
// Check to see if the "include list of fields" checkbox was checked. If so, add our table to the end of the email message.
|
220 |
-
if ( isset ( $form_settings['user_email_fields'] ) && $form_settings['user_email_fields'] == 1 ) {
|
221 |
-
$email_message .= '<br />[ninja_forms_all_fields]';
|
222 |
-
}
|
223 |
-
|
224 |
-
// Update our email message
|
225 |
-
Ninja_Forms()->notification( $n_id )->update_setting( 'email_message', $email_message );
|
226 |
-
|
227 |
-
Ninja_Forms()->notification( $n_id )->update_setting( 'user_email', true );
|
228 |
-
}
|
229 |
-
}
|
230 |
-
|
231 |
-
if ( isset ( $form_settings['success_msg'] ) && ! empty( $form_settings['success_msg'] ) ) {
|
232 |
-
// Create a notification for our success message
|
233 |
-
$n_id = nf_insert_notification( $form_id );
|
234 |
-
nf_update_object_meta( $n_id, 'name', __( 'Success Message', 'ninja-forms' ) );
|
235 |
-
nf_update_object_meta( $n_id, 'type', 'success_message' );
|
236 |
-
nf_update_object_meta( $n_id, 'active', 1 );
|
237 |
-
nf_update_object_meta( $n_id, 'success_msg', $form_settings['success_msg'] );
|
238 |
-
}
|
239 |
-
|
240 |
-
if ( isset ( $form_settings['landing_page'] ) && ! empty( $form_settings['landing_page'] ) ) {
|
241 |
-
// Create a notification for our redirect
|
242 |
-
$n_id = nf_insert_notification( $form_id );
|
243 |
-
nf_update_object_meta( $n_id, 'name', __( 'Redirect', 'ninja-forms' ) );
|
244 |
-
nf_update_object_meta( $n_id, 'type', 'redirect' );
|
245 |
-
nf_update_object_meta( $n_id, 'active', 1 );
|
246 |
-
nf_update_object_meta( $n_id, 'redirect_url', $form_settings['landing_page'] );
|
247 |
-
}
|
248 |
-
|
249 |
-
$completed_forms = get_option( 'nf_convert_notifications_forms' );
|
250 |
-
if ( ! is_array( $completed_forms ) || empty ( $completed_forms ) ) {
|
251 |
-
$completed_forms = array( $form_id );
|
252 |
-
} else {
|
253 |
-
$completed_forms[] = $form_id;
|
254 |
-
}
|
255 |
-
update_option( 'nf_convert_notifications_forms', $completed_forms );
|
256 |
-
|
257 |
-
// Unset our admin email settings and save the form.
|
258 |
-
if ( isset ( $form_settings['admin_mailto'] ) ) {
|
259 |
-
unset( $form_settings['admin_mailto'] );
|
260 |
-
unset( $form_settings['admin_attach_csv'] );
|
261 |
-
unset( $form_settings['admin_subject'] );
|
262 |
-
unset( $form_settings['admin_email_msg'] );
|
263 |
-
unset( $form_settings['admin_email_fields'] );
|
264 |
-
unset( $form_settings['success_msg'] );
|
265 |
-
unset( $form_settings['user_email_msg'] );
|
266 |
-
unset( $form_settings['user_subject'] );
|
267 |
-
unset( $form_settings['landing_page'] );
|
268 |
-
|
269 |
-
$args = array(
|
270 |
-
'update_array' => array(
|
271 |
-
'data' => serialize( $form_settings ),
|
272 |
-
),
|
273 |
-
'where' => array(
|
274 |
-
'id' => $form_id,
|
275 |
-
),
|
276 |
-
);
|
277 |
-
|
278 |
-
ninja_forms_update_form( $args );
|
279 |
-
}
|
280 |
-
}
|
281 |
-
|
282 |
-
public function complete()
|
283 |
-
{
|
284 |
-
update_option( 'nf_convert_notifications_complete', true );
|
285 |
-
}
|
286 |
-
|
287 |
-
public function isComplete()
|
288 |
-
{
|
289 |
-
return get_option( 'nf_convert_notifications_complete', false );
|
290 |
-
}
|
291 |
-
|
292 |
-
/*
|
293 |
-
* PRIVATE METHODS
|
294 |
-
*/
|
295 |
-
|
296 |
-
private function removeOldEmailSettings()
|
297 |
-
{
|
298 |
-
nf_change_email_fav();
|
299 |
-
nf_remove_old_email_settings();
|
300 |
-
}
|
301 |
-
|
302 |
-
private function getFormCount()
|
303 |
-
{
|
304 |
-
$forms = Ninja_Forms()->forms()->get_all();
|
305 |
-
return count( $forms );
|
306 |
-
}
|
307 |
-
|
308 |
-
private function getAllForms()
|
309 |
-
{
|
310 |
-
$forms = Ninja_Forms()->forms()->get_all();
|
311 |
-
|
312 |
-
$tmp_array = array();
|
313 |
-
$x = 0;
|
314 |
-
foreach ( $forms as $form_id ) {
|
315 |
-
$tmp_array[ $x ]['id'] = $form_id;
|
316 |
-
$tmp_array[ $x ]['data'] = Ninja_Forms()->form( $form_id )->get_all_settings();
|
317 |
-
$tmp_array[ $x ]['name'] = Ninja_Forms()->form( $form_id )->get_setting( 'form_title' );
|
318 |
-
$x++;
|
319 |
-
}
|
320 |
-
|
321 |
-
return $tmp_array;
|
322 |
-
}
|
323 |
-
|
324 |
-
private function replace_shortcodes( $text ) {
|
325 |
-
$matches = array();
|
326 |
-
$pattern = get_shortcode_regex();
|
327 |
-
preg_match_all('/'.$pattern.'/s', $text, $matches);
|
328 |
-
if ( is_array( $matches ) && ! empty( $matches[2] ) ) {
|
329 |
-
foreach ( $matches[2] as $key => $shortcode ) {
|
330 |
-
if ( $shortcode == 'ninja_forms_field' ) {
|
331 |
-
if ( isset ( $matches[3][ $key ] ) ) {
|
332 |
-
$atts = shortcode_parse_atts( $matches[3][ $key ] );
|
333 |
-
$id = $atts['id'];
|
334 |
-
$text = str_replace( $matches[0][ $key ], '`field_' . $id . '`', $text );
|
335 |
-
}
|
336 |
-
}
|
337 |
-
}
|
338 |
-
}
|
339 |
-
return $text;
|
340 |
-
}
|
341 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/admin/upgrades/convert-subs.php
DELETED
@@ -1,175 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
|
3 |
-
final class NF_Upgrade_Submissions extends NF_Upgrade
|
4 |
-
{
|
5 |
-
public $name = 'submissions';
|
6 |
-
|
7 |
-
public $priority = '2.7';
|
8 |
-
|
9 |
-
public $description = 'The new submission database allows submissions to be stored and retrieved more efficiently. It also allows for much better submission searching.';
|
10 |
-
|
11 |
-
public $args = array();
|
12 |
-
|
13 |
-
public $errors = array();
|
14 |
-
|
15 |
-
public function loading()
|
16 |
-
{
|
17 |
-
$old_sub_count = $this->countOldSubs();
|
18 |
-
|
19 |
-
$this->total_steps = round( ( $old_sub_count / 100 ), 0 );
|
20 |
-
|
21 |
-
if ( ! $this->total_steps || 1 > $this->total_steps ) {
|
22 |
-
$this->total_steps = 1;
|
23 |
-
}
|
24 |
-
}
|
25 |
-
|
26 |
-
public function _beforeStep( $step )
|
27 |
-
{
|
28 |
-
if ( get_option( 'nf_convert_subs_num' ) ) {
|
29 |
-
$this->args['number'] = get_option( 'nf_convert_subs_num' );
|
30 |
-
}
|
31 |
-
|
32 |
-
$this->args['form_id'] = isset( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : 0;
|
33 |
-
|
34 |
-
update_option( 'nf_convert_subs_step', $step );
|
35 |
-
}
|
36 |
-
|
37 |
-
public function step( $step )
|
38 |
-
{
|
39 |
-
$begin = ( $step - 1 ) * 100;
|
40 |
-
|
41 |
-
$subs_results = $this->getOldSubs( $begin, 100 );
|
42 |
-
|
43 |
-
if ( is_array( $subs_results ) && ! empty( $subs_results ) ) {
|
44 |
-
|
45 |
-
foreach ( $subs_results as $sub ) {
|
46 |
-
if ( $this->args['form_id'] != $sub['form_id'] ) {
|
47 |
-
$this->args['form_id'] = $sub['form_id'];
|
48 |
-
$number = 1;
|
49 |
-
}
|
50 |
-
$converted = get_option( 'nf_converted_subs' );
|
51 |
-
if ( empty( $converted ) )
|
52 |
-
$converted = array();
|
53 |
-
|
54 |
-
if ( ! in_array( $sub['id'], $converted ) ) {
|
55 |
-
$this->convert( $sub, $number );
|
56 |
-
|
57 |
-
$converted[] = $sub['id'];
|
58 |
-
update_option( 'nf_converted_subs', $converted );
|
59 |
-
$number++;
|
60 |
-
update_option( 'nf_convert_subs_num', $number );
|
61 |
-
}
|
62 |
-
}
|
63 |
-
}
|
64 |
-
}
|
65 |
-
|
66 |
-
public function _afterStep( $step )
|
67 |
-
{
|
68 |
-
|
69 |
-
}
|
70 |
-
|
71 |
-
public function complete()
|
72 |
-
{
|
73 |
-
update_option( 'nf_convert_subs_step', 'complete' );
|
74 |
-
delete_option( 'nf_convert_subs_num' );
|
75 |
-
}
|
76 |
-
|
77 |
-
public function isComplete()
|
78 |
-
{
|
79 |
-
return get_option( 'nf_convert_subs_step', false );
|
80 |
-
}
|
81 |
-
|
82 |
-
/*
|
83 |
-
* PRIVATE METHODS
|
84 |
-
*/
|
85 |
-
|
86 |
-
private function getOldSubs( $begin = '', $count = '' ) {
|
87 |
-
global $wpdb;
|
88 |
-
|
89 |
-
if ( $begin == '' && $count == '' ) {
|
90 |
-
$limit = '';
|
91 |
-
} else {
|
92 |
-
$limit = ' LIMIT ' . $begin . ',' . $count;
|
93 |
-
}
|
94 |
-
$subs_results = $wpdb->get_results( 'SELECT * FROM ' . NINJA_FORMS_SUBS_TABLE_NAME . ' WHERE `action` != "mp_save" ORDER BY `form_id` ASC, `id` ASC ' . $limit, ARRAY_A );
|
95 |
-
//Now that we have our sub results, let's loop through them and remove any that don't match our args array.
|
96 |
-
if( is_array( $subs_results ) AND ! empty( $subs_results ) ) {
|
97 |
-
foreach( $subs_results as $key => $val ) { //Initiate a loop that will run for all of our submissions.
|
98 |
-
//Set our $data variable. This variable contains an array that looks like: array('field_id' => 13, 'user_value' => 'Hello World!').
|
99 |
-
if( is_serialized( $subs_results[$key]['data'] ) ) {
|
100 |
-
$subs_results[ $key ]['data'] = unserialize( $subs_results[ $key ]['data'] );
|
101 |
-
}
|
102 |
-
}
|
103 |
-
}
|
104 |
-
return $subs_results;
|
105 |
-
}
|
106 |
-
|
107 |
-
private function countOldSubs() {
|
108 |
-
global $wpdb;
|
109 |
-
$count = $wpdb->get_results( 'SELECT COUNT(*) FROM '. NINJA_FORMS_SUBS_TABLE_NAME . ' WHERE `action` != "mp_save"', ARRAY_A );
|
110 |
-
if ( is_array ( $count ) && ! empty ( $count ) ) {
|
111 |
-
return $count[0]['COUNT(*)'];
|
112 |
-
} else {
|
113 |
-
return false;
|
114 |
-
}
|
115 |
-
}
|
116 |
-
|
117 |
-
public function convert( $sub, $num ) {
|
118 |
-
|
119 |
-
if ( isset ( $sub['id'] ) ) {
|
120 |
-
$old_id = $sub['id'];
|
121 |
-
unset( $sub['id'] );
|
122 |
-
}
|
123 |
-
|
124 |
-
if ( isset ( $sub['form_id'] ) ) {
|
125 |
-
$form_id = $sub['form_id'];
|
126 |
-
unset ( $sub['form_id'] );
|
127 |
-
}
|
128 |
-
|
129 |
-
if ( isset ( $sub['action'] ) ) {
|
130 |
-
$action = $sub['action'];
|
131 |
-
unset ( $sub['action'] );
|
132 |
-
}
|
133 |
-
|
134 |
-
if ( isset ( $sub['user_id'] ) ) {
|
135 |
-
$user_id = $sub['user_id'];
|
136 |
-
unset ( $sub['user_id'] );
|
137 |
-
}
|
138 |
-
|
139 |
-
if ( isset ( $sub['date_updated'] ) ) {
|
140 |
-
$date_updated = $sub['date_updated'];
|
141 |
-
unset ( $sub['date_updated'] );
|
142 |
-
}
|
143 |
-
|
144 |
-
if ( isset ( $sub['status'] ) )
|
145 |
-
unset ( $sub['status'] );
|
146 |
-
|
147 |
-
if ( isset ( $sub['saved'] ) )
|
148 |
-
unset ( $sub['saved'] );
|
149 |
-
|
150 |
-
$sub_id = Ninja_Forms()->subs()->create( $form_id );
|
151 |
-
Ninja_Forms()->sub( $sub_id )->update_action( $action );
|
152 |
-
Ninja_Forms()->sub( $sub_id )->update_user_id( $user_id );
|
153 |
-
Ninja_Forms()->sub( $sub_id )->update_seq_num( $num );
|
154 |
-
Ninja_Forms()->sub( $sub_id )->update_date_submitted( $date_updated );
|
155 |
-
Ninja_Forms()->sub( $sub_id )->update_date_modified( $date_updated );
|
156 |
-
Ninja_Forms()->sub( $sub_id )->add_meta( '_old_id', $old_id );
|
157 |
-
|
158 |
-
if ( isset ( $sub['data'] ) ) {
|
159 |
-
foreach ( $sub['data'] as $data ) {
|
160 |
-
$field_id = $data['field_id'];
|
161 |
-
$value = $data['user_value'];
|
162 |
-
Ninja_Forms()->sub( $sub_id )->add_field( $field_id, $value );
|
163 |
-
}
|
164 |
-
unset ( $sub['data'] );
|
165 |
-
}
|
166 |
-
|
167 |
-
if ( ! empty ( $sub ) ) {
|
168 |
-
foreach ( $sub as $key => $value ) {
|
169 |
-
if ( $value !== '' ) {
|
170 |
-
Ninja_Forms()->sub( $sub_id )->add_meta( '_' . $key, $value );
|
171 |
-
}
|
172 |
-
}
|
173 |
-
}
|
174 |
-
}
|
175 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/admin/upgrades/database-migrations.php
DELETED
@@ -1,111 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
|
3 |
-
final class NF_Upgrade_Database_Migrations extends NF_Upgrade
|
4 |
-
{
|
5 |
-
public $name = 'database_migrations';
|
6 |
-
|
7 |
-
public $priority = "0.0.1";
|
8 |
-
|
9 |
-
public $description = 'The database needs to be updated to support the new version.';
|
10 |
-
|
11 |
-
public $args = array();
|
12 |
-
|
13 |
-
public $errors = array();
|
14 |
-
|
15 |
-
public function loading()
|
16 |
-
{
|
17 |
-
$already_run = $this->isComplete();
|
18 |
-
|
19 |
-
$this->total_steps = ( $already_run ) ? 0 : 1;
|
20 |
-
}
|
21 |
-
|
22 |
-
public function step( $step )
|
23 |
-
{
|
24 |
-
$this->createObjectTable();
|
25 |
-
$this->createObjectMetaTable();
|
26 |
-
$this->createObjectRelationshipsTable();
|
27 |
-
}
|
28 |
-
|
29 |
-
public function complete()
|
30 |
-
{
|
31 |
-
update_option( 'nf_database_migrations', true);
|
32 |
-
}
|
33 |
-
|
34 |
-
public function isComplete()
|
35 |
-
{
|
36 |
-
if( $this->existsObjectTable() ||
|
37 |
-
$this->existsObjectMetaTable() ||
|
38 |
-
$this->existsObjectRelationshipsTable()
|
39 |
-
) {
|
40 |
-
return true;
|
41 |
-
}
|
42 |
-
return get_option( 'nf_database_migrations', false );
|
43 |
-
}
|
44 |
-
|
45 |
-
/*
|
46 |
-
* PRIVATE METHODS
|
47 |
-
*/
|
48 |
-
|
49 |
-
private function createObjectTable()
|
50 |
-
{
|
51 |
-
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
52 |
-
|
53 |
-
$sql = "CREATE TABLE IF NOT EXISTS " . NF_OBJECTS_TABLE_NAME . " (
|
54 |
-
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
55 |
-
`type` varchar(255) NOT NULL,
|
56 |
-
PRIMARY KEY (`id`)
|
57 |
-
) DEFAULT CHARSET=utf8;";
|
58 |
-
|
59 |
-
dbDelta( $sql );
|
60 |
-
}
|
61 |
-
|
62 |
-
private function existsObjectTable()
|
63 |
-
{
|
64 |
-
global $wpdb;
|
65 |
-
return $wpdb->query( "SHOW TABLES LIKE '" . NF_OBJECTS_TABLE_NAME . "'" );
|
66 |
-
}
|
67 |
-
|
68 |
-
|
69 |
-
private function createObjectMetaTable()
|
70 |
-
{
|
71 |
-
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
72 |
-
|
73 |
-
$sql = "CREATE TABLE IF NOT EXISTS ". NF_OBJECT_META_TABLE_NAME . " (
|
74 |
-
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
75 |
-
`object_id` bigint(20) NOT NULL,
|
76 |
-
`meta_key` varchar(255) NOT NULL,
|
77 |
-
`meta_value` longtext NOT NULL,
|
78 |
-
PRIMARY KEY (`id`)
|
79 |
-
) DEFAULT CHARSET=utf8;";
|
80 |
-
|
81 |
-
dbDelta( $sql );
|
82 |
-
}
|
83 |
-
|
84 |
-
private function existsObjectMetaTable()
|
85 |
-
{
|
86 |
-
global $wpdb;
|
87 |
-
return $wpdb->query( "SHOW TABLES LIKE '" . NF_OBJECT_META_TABLE_NAME . "'" );
|
88 |
-
}
|
89 |
-
|
90 |
-
private function createObjectRelationshipsTable()
|
91 |
-
{
|
92 |
-
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
93 |
-
|
94 |
-
$sql = "CREATE TABLE IF NOT EXISTS " . NF_OBJECT_RELATIONSHIPS_TABLE_NAME . " (
|
95 |
-
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
96 |
-
`child_id` bigint(20) NOT NULL,
|
97 |
-
`parent_id` bigint(20) NOT NULL,
|
98 |
-
`child_type` varchar(255) NOT NULL,
|
99 |
-
`parent_type` varchar(255) NOT NULL,
|
100 |
-
PRIMARY KEY (`id`)
|
101 |
-
) DEFAULT CHARSET=utf8;";
|
102 |
-
|
103 |
-
dbDelta( $sql );
|
104 |
-
}
|
105 |
-
|
106 |
-
private function existsObjectRelationshipsTable()
|
107 |
-
{
|
108 |
-
global $wpdb;
|
109 |
-
return $wpdb->query( "SHOW TABLES LIKE '" . NF_OBJECT_RELATIONSHIPS_TABLE_NAME . "'" );
|
110 |
-
}
|
111 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/admin/upgrades/index.php
DELETED
@@ -1,2 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
// Silence is golden.
|
|
|
|
deprecated/includes/admin/upgrades/update-email-settings.php
DELETED
@@ -1,176 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
|
3 |
-
final class NF_Upgrade_Email_Settings extends NF_Upgrade
|
4 |
-
{
|
5 |
-
public $name = 'email_settings';
|
6 |
-
|
7 |
-
public $priority = '2.9.3';
|
8 |
-
|
9 |
-
public $description = 'Email settings need to be transferred to a new storage method.';
|
10 |
-
|
11 |
-
public $args = array();
|
12 |
-
|
13 |
-
public $errors = array();
|
14 |
-
|
15 |
-
public function loading()
|
16 |
-
{
|
17 |
-
// Remove old email settings.
|
18 |
-
$this->changeEmailFav();
|
19 |
-
|
20 |
-
// Get our total number of forms.
|
21 |
-
$form_count = $this->getFormCount();
|
22 |
-
|
23 |
-
// Get all our forms
|
24 |
-
$forms = $this->getAllForms();
|
25 |
-
|
26 |
-
$x = 1;
|
27 |
-
if ( is_array( $forms ) ) {
|
28 |
-
foreach ( $forms as $form ) {
|
29 |
-
$this->args['forms'][$x] = $form['id'];
|
30 |
-
$x++;
|
31 |
-
}
|
32 |
-
}
|
33 |
-
|
34 |
-
if( empty( $this->total_steps ) || $this->total_steps <= 1 ) {
|
35 |
-
$this->total_steps = $form_count;
|
36 |
-
}
|
37 |
-
|
38 |
-
$args = array(
|
39 |
-
'total_steps' => $this->total_steps,
|
40 |
-
'step' => 1,
|
41 |
-
);
|
42 |
-
|
43 |
-
$this->redirect = admin_url( 'admin.php?page=ninja-forms' );
|
44 |
-
|
45 |
-
return $args;
|
46 |
-
}
|
47 |
-
|
48 |
-
public function step( $step )
|
49 |
-
{
|
50 |
-
// Get our form ID
|
51 |
-
$form_id = $this->args['forms'][ $step ];
|
52 |
-
$this->removeOldEmailSettings( $form_id );
|
53 |
-
}
|
54 |
-
|
55 |
-
public function complete()
|
56 |
-
{
|
57 |
-
update_option( 'nf_update_email_settings_complete', true );
|
58 |
-
}
|
59 |
-
|
60 |
-
public function isComplete()
|
61 |
-
{
|
62 |
-
return get_option( 'nf_update_email_settings_complete', false );
|
63 |
-
}
|
64 |
-
|
65 |
-
/*
|
66 |
-
* PRIVATE METHODS
|
67 |
-
*/
|
68 |
-
|
69 |
-
private function changeEmailFav() {
|
70 |
-
global $wpdb;
|
71 |
-
|
72 |
-
$email_address = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM ".NINJA_FORMS_FAV_FIELDS_TABLE_NAME." WHERE name = %s AND row_type = 0", 'Email' ), ARRAY_A );
|
73 |
-
|
74 |
-
$sql = 'DELETE FROM `' . NINJA_FORMS_FAV_FIELDS_TABLE_NAME . '` WHERE name = "Email Address"';
|
75 |
-
|
76 |
-
$wpdb->query( $sql );
|
77 |
-
|
78 |
-
$sql = 'DELETE FROM `' . NINJA_FORMS_FAV_FIELDS_TABLE_NAME . '` WHERE name = "Email"';
|
79 |
-
|
80 |
-
$wpdb->query( $sql );
|
81 |
-
|
82 |
-
if ( isset ( $email_address['id'] ) && ! empty ( $email_address['id'] ) ) {
|
83 |
-
$sql = 'INSERT INTO `'.NINJA_FORMS_FAV_FIELDS_TABLE_NAME.'` (`id`, `row_type`, `type`, `order`, `data`, `name`) VALUES
|
84 |
-
(' . $email_address['id'] . ', 0, \'_text\', 0, \'a:25:{s:5:"label";s:5:"Email";s:9:"label_pos";s:5:"above";s:13:"default_value";s:0:"";s:4:"mask";s:0:"";s:10:"datepicker";s:1:"0";s:5:"email";s:1:"1";s:10:"send_email";s:1:"0";s:10:"from_email";s:1:"0";s:10:"first_name";s:1:"0";s:9:"last_name";s:1:"0";s:9:"from_name";s:1:"0";s:14:"user_address_1";s:1:"0";s:14:"user_address_2";s:1:"0";s:9:"user_city";s:1:"0";s:8:"user_zip";s:1:"0";s:10:"user_phone";s:1:"0";s:10:"user_email";s:1:"1";s:21:"user_info_field_group";s:1:"1";s:3:"req";s:1:"0";s:5:"class";s:0:"";s:9:"show_help";s:1:"0";s:9:"help_text";s:0:"";s:17:"calc_auto_include";s:1:"0";s:11:"calc_option";s:1:"0";s:11:"conditional";s:0:"";}\', \'Email\')';
|
85 |
-
$wpdb->query($sql);
|
86 |
-
}
|
87 |
-
|
88 |
-
}
|
89 |
-
|
90 |
-
private function getFormCount() {
|
91 |
-
global $wpdb;
|
92 |
-
|
93 |
-
$forms = Ninja_Forms()->forms()->get_all();
|
94 |
-
return count( $forms );
|
95 |
-
}
|
96 |
-
|
97 |
-
private function getAllForms(){
|
98 |
-
$forms = Ninja_Forms()->forms()->get_all();
|
99 |
-
|
100 |
-
$tmp_array = array();
|
101 |
-
$x = 0;
|
102 |
-
foreach ( $forms as $form_id ) {
|
103 |
-
$tmp_array[ $x ]['id'] = $form_id;
|
104 |
-
$tmp_array[ $x ]['data'] = Ninja_Forms()->form( $form_id )->get_all_settings();
|
105 |
-
$tmp_array[ $x ]['name'] = Ninja_Forms()->form( $form_id )->get_setting( 'form_title' );
|
106 |
-
$x++;
|
107 |
-
}
|
108 |
-
|
109 |
-
return $tmp_array;
|
110 |
-
}
|
111 |
-
|
112 |
-
private function removeOldEmailSettings( $form_id = '' ) {
|
113 |
-
|
114 |
-
if ( '' == $form_id ) {
|
115 |
-
$forms = $this->getAllForms();
|
116 |
-
|
117 |
-
if ( is_array( $forms ) ) {
|
118 |
-
foreach ( $forms as $form ) {
|
119 |
-
$this->removeOldEmailSendTo( $form['id'] );
|
120 |
-
}
|
121 |
-
}
|
122 |
-
} else {
|
123 |
-
$this->removeOldEmailSendTo( $form_id );
|
124 |
-
}
|
125 |
-
}
|
126 |
-
|
127 |
-
function removeOldEmailSendTo( $form_id ) {
|
128 |
-
if ( empty ( $form_id ) )
|
129 |
-
return false;
|
130 |
-
|
131 |
-
// Remove any "Admin mailto" settings we might have.
|
132 |
-
$form_row = ninja_forms_get_form_by_id( $form_id );
|
133 |
-
|
134 |
-
if ( isset ( $form_row['data']['admin_mailto'] ) ) {
|
135 |
-
unset ( $form_row['data']['admin_mailto'] );
|
136 |
-
|
137 |
-
$args = array(
|
138 |
-
'update_array' => array(
|
139 |
-
'data' => serialize( $form_row['data'] ),
|
140 |
-
),
|
141 |
-
'where' => array(
|
142 |
-
'id' => $form_id,
|
143 |
-
),
|
144 |
-
);
|
145 |
-
|
146 |
-
ninja_forms_update_form( $args );
|
147 |
-
|
148 |
-
}
|
149 |
-
|
150 |
-
// Update any old email settings we have.
|
151 |
-
$fields = Ninja_Forms()->form( $form_id )->fields;
|
152 |
-
|
153 |
-
// Create a notification for our user email
|
154 |
-
if ( ! empty ( $fields ) ) {
|
155 |
-
foreach ( $fields as $field_id => $field ) {
|
156 |
-
if ( isset ( $field['data']['send_email'] ) && $field['data']['send_email'] == 1 ) {
|
157 |
-
// Add this field to our $addresses variable.
|
158 |
-
unset( $field['data']['send_email'] );
|
159 |
-
unset( $field['data']['replyto_email'] );
|
160 |
-
unset( $field['data']['from_name'] );
|
161 |
-
|
162 |
-
$args = array(
|
163 |
-
'update_array' => array(
|
164 |
-
'data' => serialize( $field['data'] ),
|
165 |
-
),
|
166 |
-
'where' => array(
|
167 |
-
'id' => $field_id,
|
168 |
-
),
|
169 |
-
);
|
170 |
-
|
171 |
-
ninja_forms_update_field( $args );
|
172 |
-
}
|
173 |
-
}
|
174 |
-
}
|
175 |
-
}
|
176 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/admin/upgrades/upgrade-functions.php
DELETED
@@ -1,396 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
|
3 |
-
if( ! function_exists( 'nf_is_func_disabled' ) ) {
|
4 |
-
function nf_is_func_disabled($function)
|
5 |
-
{
|
6 |
-
$disabled = explode(',', ini_get('disable_functions'));
|
7 |
-
|
8 |
-
return in_array($function, $disabled);
|
9 |
-
}
|
10 |
-
}
|
11 |
-
|
12 |
-
/**
|
13 |
-
* Upgrade Functions
|
14 |
-
*
|
15 |
-
* @package Ninja Forms
|
16 |
-
* @subpackage Admin/Upgrades
|
17 |
-
* @copyright Copyright (c) 2014, WP Ninjas
|
18 |
-
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
19 |
-
* @since 2.7
|
20 |
-
*/
|
21 |
-
|
22 |
-
// Exit if accessed directly
|
23 |
-
if ( ! defined( 'ABSPATH' ) ) exit;
|
24 |
-
|
25 |
-
/**
|
26 |
-
* DEPRECATED - Display Upgrade Notices
|
27 |
-
*
|
28 |
-
* @since 2.7
|
29 |
-
* @return void
|
30 |
-
*/
|
31 |
-
function nf_show_upgrade_notices() {
|
32 |
-
|
33 |
-
// Convert notifications
|
34 |
-
if ( isset ( $_GET['page'] ) && $_GET['page'] == 'nf-processing' )
|
35 |
-
return; // Don't show notices on the processing page.
|
36 |
-
|
37 |
-
$n_conversion_complete = get_option( 'nf_convert_notifications_complete', false );
|
38 |
-
|
39 |
-
if ( ! $n_conversion_complete ) {
|
40 |
-
printf(
|
41 |
-
'<div class="update-nag"><p>' . __( 'Ninja Forms needs to upgrade your form notifications, click %shere%s to start the upgrade.', 'ninja-forms' ) . '</p></div>',
|
42 |
-
'<a href="' . admin_url( 'index.php?page=nf-processing&action=convert_notifications' ) . '">', '</a>'
|
43 |
-
);
|
44 |
-
}
|
45 |
-
|
46 |
-
$update_email_settings_complete = get_option( 'nf_update_email_settings_complete', false );
|
47 |
-
|
48 |
-
if ( $n_conversion_complete && ! $update_email_settings_complete ) {
|
49 |
-
printf(
|
50 |
-
'<div class="update-nag"><p>' . __( 'Ninja Forms needs to update your email settings, click %shere%s to start the upgrade.', 'ninja-forms' ) . '</p></div>',
|
51 |
-
'<a href="' . admin_url( 'index.php?page=nf-processing&action=update_email_settings' ) . '">', '</a>'
|
52 |
-
);
|
53 |
-
}
|
54 |
-
|
55 |
-
if ( isset( $_GET['page'] ) && $_GET['page'] == 'nf-upgrades' )
|
56 |
-
return; // Don't show notices on the upgrades page
|
57 |
-
|
58 |
-
$step = get_option( 'nf_convert_subs_step' );
|
59 |
-
|
60 |
-
if ( $step != 'complete' ) {
|
61 |
-
if ( empty( $step ) ) {
|
62 |
-
$step = 1;
|
63 |
-
}
|
64 |
-
printf(
|
65 |
-
'<div class="update-nag"><p>' . __( 'Ninja Forms needs to upgrade the submissions table, click %shere%s to start the upgrade.', 'ninja-forms' ) . '</p></div>',
|
66 |
-
'<a href="' . admin_url( 'index.php?page=nf-upgrades&nf-upgrade=upgrade_subs_to_cpt&step=' . $step ) . '">', '</a>'
|
67 |
-
);
|
68 |
-
}
|
69 |
-
|
70 |
-
$upgrade_notice = get_option( 'nf_upgrade_notice' );
|
71 |
-
|
72 |
-
if ( $upgrade_notice != 'closed' ) {
|
73 |
-
printf(
|
74 |
-
'<div class="update-nag"><p>' . __( 'Thank you for updating to version 2.7 of Ninja Forms. Please update any Ninja Forms extensions from ', 'ninja-forms' ) . '<a href="http://ninjaforms.com/your-account/purchases/"</a>ninjaforms.com</a>. <a href="%s">Dismiss this notice</a></p></div>',
|
75 |
-
esc_url( add_query_arg( array( 'nf_action' => 'dismiss_upgrade_notice' ) ) )
|
76 |
-
);
|
77 |
-
}
|
78 |
-
|
79 |
-
if ( defined( 'NINJA_FORMS_UPLOADS_VERSION' ) && version_compare( NINJA_FORMS_UPLOADS_VERSION, '1.3.5' ) == -1 ) {
|
80 |
-
echo '<div class="error"><p>' . __( 'Your version of the Ninja Forms File Upload extension isn\'t compatible with version 2.7 of Ninja Forms. It needs to be at least version 1.3.5. Please update this extension at ', 'ninja-forms' ) . '<a href="http://ninjaforms.com/your-account/purchases/"</a>ninjaforms.com</a></p></div>';
|
81 |
-
}
|
82 |
-
|
83 |
-
if ( defined( 'NINJA_FORMS_SAVE_PROGRESS_VERSION' ) && version_compare( NINJA_FORMS_SAVE_PROGRESS_VERSION, '1.1.3' ) == -1 ) {
|
84 |
-
echo '<div class="error"><p>' . __( 'Your version of the Ninja Forms Save Progress extension isn\'t compatible with version 2.7 of Ninja Forms. It needs to be at least version 1.1.3. Please update this extension at ', 'ninja-forms' ) . '<a href="http://ninjaforms.com/your-account/purchases/"</a>ninjaforms.com</a></p></div>';
|
85 |
-
}
|
86 |
-
|
87 |
-
$forms_conversion_complete = get_option( 'nf_convert_forms_complete', false );
|
88 |
-
|
89 |
-
if ( ! $forms_conversion_complete ) {
|
90 |
-
$title = urlencode( __( 'Updating Form Database', 'ninja-forms' ) );
|
91 |
-
printf(
|
92 |
-
'<div class="update-nag">' . __( 'Ninja Forms needs to upgrade your form settings, click %shere%s to start the upgrade.', 'ninja-forms' ) . '</div>',
|
93 |
-
'<a href="' . admin_url( 'index.php?page=nf-processing&action=convert_forms&title=' . $title ) . '">', '</a>'
|
94 |
-
);
|
95 |
-
}
|
96 |
-
|
97 |
-
}
|
98 |
-
//add_action( 'admin_notices', 'nf_show_upgrade_notices' );
|
99 |
-
|
100 |
-
/**
|
101 |
-
* Triggers all upgrade functions
|
102 |
-
*
|
103 |
-
* This function is usually triggered via AJAX
|
104 |
-
*
|
105 |
-
* @since 2.7
|
106 |
-
* @return void
|
107 |
-
*/
|
108 |
-
function nf_trigger_upgrades() {
|
109 |
-
if ( DOING_AJAX )
|
110 |
-
die( 'complete' ); // Let AJAX know that the upgrade is complete
|
111 |
-
}
|
112 |
-
add_action( 'wp_ajax_edd_trigger_upgrades', 'nf_trigger_upgrades' );
|
113 |
-
|
114 |
-
/**
|
115 |
-
* Upgrades for Ninja Forms v2.7 and Submission Custom Post Type.
|
116 |
-
*
|
117 |
-
* @since 2.7
|
118 |
-
* @return void
|
119 |
-
*/
|
120 |
-
function nf_v27_upgrade_subs_to_cpt() {
|
121 |
-
//Bail if we aren't in the admin.
|
122 |
-
if ( ! is_admin() )
|
123 |
-
return false;
|
124 |
-
|
125 |
-
// Bail if we don't have the appropriate permissions.
|
126 |
-
if ( is_multisite() ) {
|
127 |
-
if ( ! is_super_admin() )
|
128 |
-
return false;
|
129 |
-
} else {
|
130 |
-
if ( ! current_user_can( 'install_plugins' ) )
|
131 |
-
return false;
|
132 |
-
}
|
133 |
-
|
134 |
-
if ( function_exists( 'ignore_user_abort' ) && ! nf_is_func_disabled( 'ignore_user_abort' ) ) {
|
135 |
-
ignore_user_abort( true );
|
136 |
-
}
|
137 |
-
|
138 |
-
$step = isset( $_GET['step'] ) ? absint( $_GET['step'] ) : 1;
|
139 |
-
$total = isset( $_GET['total'] ) ? absint( $_GET['total'] ) : false;
|
140 |
-
$number = isset( $_GET['custom'] ) ? absint( $_GET['custom'] ) : 1;
|
141 |
-
|
142 |
-
if ( get_option( 'nf_convert_subs_num' ) ) {
|
143 |
-
$number = get_option( 'nf_convert_subs_num' );
|
144 |
-
}
|
145 |
-
|
146 |
-
$form_id = isset( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : 0;
|
147 |
-
|
148 |
-
update_option( 'nf_convert_subs_step', $step );
|
149 |
-
|
150 |
-
$convert_subs = new NF_Convert_Subs();
|
151 |
-
$old_sub_count = $convert_subs->count_old_subs();
|
152 |
-
|
153 |
-
if( empty( $total ) || $total <= 1 ) {
|
154 |
-
$total = round( ( $old_sub_count / 100 ), 0 ) + 2;
|
155 |
-
}
|
156 |
-
|
157 |
-
if ( $step <= $total ) {
|
158 |
-
if ( $step == 1 ) {
|
159 |
-
$begin = 0;
|
160 |
-
} else {
|
161 |
-
$begin = ( $step - 1 ) * 100;
|
162 |
-
}
|
163 |
-
|
164 |
-
$subs_results = $convert_subs->get_old_subs( $begin, 100 );
|
165 |
-
|
166 |
-
if ( is_array( $subs_results ) && ! empty( $subs_results ) ) {
|
167 |
-
|
168 |
-
foreach ( $subs_results as $sub ) {
|
169 |
-
if ( $form_id != $sub['form_id'] ) {
|
170 |
-
$form_id = $sub['form_id'];
|
171 |
-
$number = 1;
|
172 |
-
}
|
173 |
-
$converted = get_option( 'nf_converted_subs' );
|
174 |
-
if ( empty( $converted ) )
|
175 |
-
$converted = array();
|
176 |
-
|
177 |
-
if ( ! in_array( $sub['id'], $converted ) ) {
|
178 |
-
$convert_subs->convert( $sub, $number );
|
179 |
-
|
180 |
-
$converted[] = $sub['id'];
|
181 |
-
update_option( 'nf_converted_subs', $converted );
|
182 |
-
$number++;
|
183 |
-
update_option( 'nf_convert_subs_num', $number );
|
184 |
-
}
|
185 |
-
}
|
186 |
-
}
|
187 |
-
|
188 |
-
$step++;
|
189 |
-
|
190 |
-
$redirect = add_query_arg( array(
|
191 |
-
'page' => 'nf-upgrades',
|
192 |
-
'nf-upgrade' => 'upgrade_subs_to_cpt',
|
193 |
-
'step' => $step,
|
194 |
-
'custom' => $number,
|
195 |
-
'total' => $total,
|
196 |
-
'form_id' => $form_id
|
197 |
-
), admin_url( 'index.php' ) );
|
198 |
-
wp_redirect( $redirect ); exit;
|
199 |
-
|
200 |
-
} else {
|
201 |
-
update_option( 'nf_convert_subs_step', 'complete' );
|
202 |
-
delete_option( 'nf_convert_subs_num' );
|
203 |
-
wp_redirect( admin_url( 'index.php?page=nf-about' ) ); exit;
|
204 |
-
}
|
205 |
-
}
|
206 |
-
add_action( 'nf_upgrade_subs_to_cpt', 'nf_v27_upgrade_subs_to_cpt' );
|
207 |
-
|
208 |
-
/**
|
209 |
-
* Keep our upgrade notice closed.
|
210 |
-
*
|
211 |
-
* @since 2.7
|
212 |
-
* @return void
|
213 |
-
*/
|
214 |
-
function nf_dismiss_upgrade_notice() {
|
215 |
-
update_option( 'nf_upgrade_notice', 'closed' );
|
216 |
-
wp_redirect( esc_url_raw( remove_query_arg( 'nf_action' ) ) );
|
217 |
-
exit;
|
218 |
-
}
|
219 |
-
|
220 |
-
add_action( 'nf_dismiss_upgrade_notice', 'nf_dismiss_upgrade_notice' );
|
221 |
-
|
222 |
-
|
223 |
-
/**
|
224 |
-
* Clearing out the old email favourite field and replacing it with the new version.
|
225 |
-
*
|
226 |
-
* @since 2.8.4
|
227 |
-
* @return void
|
228 |
-
*/
|
229 |
-
function nf_clear_old_favs() {
|
230 |
-
global $wpdb;
|
231 |
-
|
232 |
-
$email_fav_updated = get_option( 'nf_email_fav_updated', false );
|
233 |
-
|
234 |
-
if ( $email_fav_updated )
|
235 |
-
return false;
|
236 |
-
|
237 |
-
nf_change_email_fav();
|
238 |
-
nf_remove_old_email_settings();
|
239 |
-
nf_change_state_dropdown_fav();
|
240 |
-
|
241 |
-
update_option( 'nf_email_fav_updated', true );
|
242 |
-
}
|
243 |
-
|
244 |
-
add_action( 'admin_init', 'nf_clear_old_favs' );
|
245 |
-
|
246 |
-
/**
|
247 |
-
* Remove old email "send to" settings from form fiels.
|
248 |
-
*
|
249 |
-
* @since 2.8.4
|
250 |
-
* @return void
|
251 |
-
*/
|
252 |
-
function nf_remove_old_email_settings( $form_id = '' ) {
|
253 |
-
|
254 |
-
if ( '' == $form_id ) {
|
255 |
-
$forms = ninja_forms_get_all_forms( true );
|
256 |
-
|
257 |
-
if ( is_array( $forms ) ) {
|
258 |
-
foreach ( $forms as $form ) {
|
259 |
-
nf_remove_old_email_send_to( $form['id'] );
|
260 |
-
}
|
261 |
-
}
|
262 |
-
} else {
|
263 |
-
nf_remove_old_email_send_to( $form_id );
|
264 |
-
}
|
265 |
-
}
|
266 |
-
|
267 |
-
/**
|
268 |
-
* Removes old email settings form a single form.
|
269 |
-
*
|
270 |
-
* @since 2.8.4
|
271 |
-
* @return void
|
272 |
-
*/
|
273 |
-
function nf_remove_old_email_send_to( $form_id ) {
|
274 |
-
if ( empty ( $form_id ) )
|
275 |
-
return false;
|
276 |
-
|
277 |
-
// Remove any "Admin mailto" settings we might have.
|
278 |
-
$form_row = ninja_forms_get_form_by_id( $form_id );
|
279 |
-
|
280 |
-
if ( isset ( $form_row['data']['admin_mailto'] ) ) {
|
281 |
-
unset ( $form_row['data']['admin_mailto'] );
|
282 |
-
|
283 |
-
$args = array(
|
284 |
-
'update_array' => array(
|
285 |
-
'data' => serialize( $form_row['data'] ),
|
286 |
-
),
|
287 |
-
'where' => array(
|
288 |
-
'id' => $form_id,
|
289 |
-
),
|
290 |
-
);
|
291 |
-
|
292 |
-
ninja_forms_update_form( $args );
|
293 |
-
|
294 |
-
}
|
295 |
-
|
296 |
-
// Update any old email settings we have.
|
297 |
-
$fields = Ninja_Forms()->form( $form_id )->fields;
|
298 |
-
|
299 |
-
// Create a notification for our user email
|
300 |
-
if ( ! empty ( $fields ) ) {
|
301 |
-
foreach ( $fields as $field_id => $field ) {
|
302 |
-
if ( isset ( $field['data']['send_email'] ) && $field['data']['send_email'] == 1 ) {
|
303 |
-
// Add this field to our $addresses variable.
|
304 |
-
unset( $field['data']['send_email'] );
|
305 |
-
unset( $field['data']['replyto_email'] );
|
306 |
-
unset( $field['data']['from_name'] );
|
307 |
-
|
308 |
-
$args = array(
|
309 |
-
'update_array' => array(
|
310 |
-
'data' => serialize( $field['data'] ),
|
311 |
-
),
|
312 |
-
'where' => array(
|
313 |
-
'id' => $field_id,
|
314 |
-
),
|
315 |
-
);
|
316 |
-
|
317 |
-
ninja_forms_update_field( $args );
|
318 |
-
}
|
319 |
-
}
|
320 |
-
}
|
321 |
-
}
|
322 |
-
|
323 |
-
/**
|
324 |
-
* Remove the old copy of our email defined field and replace it.
|
325 |
-
*
|
326 |
-
* @since 2.8.4
|
327 |
-
* @return void
|
328 |
-
*/
|
329 |
-
function nf_change_email_fav() {
|
330 |
-
global $wpdb;
|
331 |
-
|
332 |
-
$email_address = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM ".NINJA_FORMS_FAV_FIELDS_TABLE_NAME." WHERE name = %s AND row_type = 0", 'Email' ), ARRAY_A );
|
333 |
-
|
334 |
-
$sql = 'DELETE FROM `' . NINJA_FORMS_FAV_FIELDS_TABLE_NAME . '` WHERE name = "Email Address"';
|
335 |
-
|
336 |
-
$wpdb->query( $sql );
|
337 |
-
|
338 |
-
$sql = 'DELETE FROM `' . NINJA_FORMS_FAV_FIELDS_TABLE_NAME . '` WHERE name = "Email"';
|
339 |
-
|
340 |
-
$wpdb->query( $sql );
|
341 |
-
|
342 |
-
if ( isset ( $email_address['id'] ) && ! empty ( $email_address['id'] ) ) {
|
343 |
-
$sql = 'INSERT INTO `'.NINJA_FORMS_FAV_FIELDS_TABLE_NAME.'` (`id`, `row_type`, `type`, `order`, `data`, `name`) VALUES
|
344 |
-
(' . $email_address['id'] . ', 0, \'_text\', 0, \'a:25:{s:5:"label";s:5:"Email";s:9:"label_pos";s:5:"above";s:13:"default_value";s:0:"";s:4:"mask";s:0:"";s:10:"datepicker";s:1:"0";s:5:"email";s:1:"1";s:10:"send_email";s:1:"0";s:10:"from_email";s:1:"0";s:10:"first_name";s:1:"0";s:9:"last_name";s:1:"0";s:9:"from_name";s:1:"0";s:14:"user_address_1";s:1:"0";s:14:"user_address_2";s:1:"0";s:9:"user_city";s:1:"0";s:8:"user_zip";s:1:"0";s:10:"user_phone";s:1:"0";s:10:"user_email";s:1:"1";s:21:"user_info_field_group";s:1:"1";s:3:"req";s:1:"0";s:5:"class";s:0:"";s:9:"show_help";s:1:"0";s:9:"help_text";s:0:"";s:17:"calc_auto_include";s:1:"0";s:11:"calc_option";s:1:"0";s:11:"conditional";s:0:"";}\', \'Email\')';
|
345 |
-
$wpdb->query($sql);
|
346 |
-
}
|
347 |
-
|
348 |
-
}
|
349 |
-
|
350 |
-
/**
|
351 |
-
* Fix a serialized array error with the state dropdown favourite field
|
352 |
-
*
|
353 |
-
* @since 2.8.4
|
354 |
-
* @return void
|
355 |
-
*/
|
356 |
-
function nf_change_state_dropdown_fav() {
|
357 |
-
global $wpdb;
|
358 |
-
|
359 |
-
$state_dropdown = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM ".NINJA_FORMS_FAV_FIELDS_TABLE_NAME." WHERE name = %s AND row_type = 0", 'State Dropdown' ), ARRAY_A );
|
360 |
-
|
361 |
-
$sql = 'DELETE FROM `' . NINJA_FORMS_FAV_FIELDS_TABLE_NAME . '` WHERE name = "State Dropdown"';
|
362 |
-
|
363 |
-
$wpdb->query( $sql );
|
364 |
-
|
365 |
-
$sql = 'INSERT INTO `'.NINJA_FORMS_FAV_FIELDS_TABLE_NAME.'` (`id`, `row_type`, `type`, `order`, `data`, `name`) VALUES
|
366 |
-
(' . $state_dropdown['id'] . ', 0, \'_list\', 0, \'a:10:{s:5:\"label\";s:14:\"State Dropdown\";s:9:\"label_pos\";s:4:\"left\";s:9:\"list_type\";s:8:\"dropdown\";s:10:\"multi_size\";s:1:\"5\";s:15:\"list_show_value\";s:1:\"1\";s:4:\"list\";a:1:{s:7:\"options\";a:51:{i:0;a:3:{s:5:\"label\";s:7:\"Alabama\";s:5:\"value\";s:2:\"AL\";s:8:\"selected\";s:1:\"0\";}i:1;a:3:{s:5:\"label\";s:6:\"Alaska\";s:5:\"value\";s:2:\"AK\";s:8:\"selected\";s:1:\"0\";}i:2;a:3:{s:5:\"label\";s:7:\"Arizona\";s:5:\"value\";s:2:\"AZ\";s:8:\"selected\";s:1:\"0\";}i:3;a:3:{s:5:\"label\";s:8:\"Arkansas\";s:5:\"value\";s:2:\"AR\";s:8:\"selected\";s:1:\"0\";}i:4;a:3:{s:5:\"label\";s:10:\"California\";s:5:\"value\";s:2:\"CA\";s:8:\"selected\";s:1:\"0\";}i:5;a:3:{s:5:\"label\";s:8:\"Colorado\";s:5:\"value\";s:2:\"CO\";s:8:\"selected\";s:1:\"0\";}i:6;a:3:{s:5:\"label\";s:11:\"Connecticut\";s:5:\"value\";s:2:\"CT\";s:8:\"selected\";s:1:\"0\";}i:7;a:3:{s:5:\"label\";s:8:\"Delaware\";s:5:\"value\";s:2:\"DE\";s:8:\"selected\";s:1:\"0\";}i:8;a:3:{s:5:\"label\";s:20:\"District of Columbia\";s:5:\"value\";s:2:\"DC\";s:8:\"selected\";s:1:\"0\";}i:9;a:3:{s:5:\"label\";s:7:\"Florida\";s:5:\"value\";s:2:\"FL\";s:8:\"selected\";s:1:\"0\";}i:10;a:3:{s:5:\"label\";s:7:\"Georgia\";s:5:\"value\";s:2:\"GA\";s:8:\"selected\";s:1:\"0\";}i:11;a:3:{s:5:\"label\";s:6:\"Hawaii\";s:5:\"value\";s:2:\"HI\";s:8:\"selected\";s:1:\"0\";}i:12;a:3:{s:5:\"label\";s:5:\"Idaho\";s:5:\"value\";s:2:\"ID\";s:8:\"selected\";s:1:\"0\";}i:13;a:3:{s:5:\"label\";s:8:\"Illinois\";s:5:\"value\";s:2:\"IL\";s:8:\"selected\";s:1:\"0\";}i:14;a:3:{s:5:\"label\";s:7:\"Indiana\";s:5:\"value\";s:2:\"IN\";s:8:\"selected\";s:1:\"0\";}i:15;a:3:{s:5:\"label\";s:4:\"Iowa\";s:5:\"value\";s:2:\"IA\";s:8:\"selected\";s:1:\"0\";}i:16;a:3:{s:5:\"label\";s:6:\"Kansas\";s:5:\"value\";s:2:\"KS\";s:8:\"selected\";s:1:\"0\";}i:17;a:3:{s:5:\"label\";s:8:\"Kentucky\";s:5:\"value\";s:2:\"KY\";s:8:\"selected\";s:1:\"0\";}i:18;a:3:{s:5:\"label\";s:9:\"Louisiana\";s:5:\"value\";s:2:\"LA\";s:8:\"selected\";s:1:\"0\";}i:19;a:3:{s:5:\"label\";s:5:\"Maine\";s:5:\"value\";s:2:\"ME\";s:8:\"selected\";s:1:\"0\";}i:20;a:3:{s:5:\"label\";s:8:\"Maryland\";s:5:\"value\";s:2:\"MD\";s:8:\"selected\";s:1:\"0\";}i:21;a:3:{s:5:\"label\";s:13:\"Massachusetts\";s:5:\"value\";s:2:\"MA\";s:8:\"selected\";s:1:\"0\";}i:22;a:3:{s:5:\"label\";s:8:\"Michigan\";s:5:\"value\";s:2:\"MI\";s:8:\"selected\";s:1:\"0\";}i:23;a:3:{s:5:\"label\";s:9:\"Minnesota\";s:5:\"value\";s:2:\"MN\";s:8:\"selected\";s:1:\"0\";}i:24;a:3:{s:5:\"label\";s:11:\"Mississippi\";s:5:\"value\";s:2:\"MS\";s:8:\"selected\";s:1:\"0\";}i:25;a:3:{s:5:\"label\";s:8:\"Missouri\";s:5:\"value\";s:2:\"MO\";s:8:\"selected\";s:1:\"0\";}i:26;a:3:{s:5:\"label\";s:7:\"Montana\";s:5:\"value\";s:2:\"MT\";s:8:\"selected\";s:1:\"0\";}i:27;a:3:{s:5:\"label\";s:8:\"Nebraska\";s:5:\"value\";s:2:\"NE\";s:8:\"selected\";s:1:\"0\";}i:28;a:3:{s:5:\"label\";s:6:\"Nevada\";s:5:\"value\";s:2:\"NV\";s:8:\"selected\";s:1:\"0\";}i:29;a:3:{s:5:\"label\"3s:13:\"New Hampshire\";s:5:\"value\";s:2:\"NH\";s:8:\"selected\";s:1:\"0\";}i:30;a:3:{s:5:\"label\";s:10:\"New Jersey\";s:5:\"value\";s:2:\"NJ\";s:8:\"selected\";s:1:\"0\";}i:31;a:3:{s:5:\"label\";s:10:\"New Mexico\";s:5:\"value\";s:2:\"NM\";s:8:\"selected\";s:1:\"0\";}i:32;a:3:{s:5:\"label\";s:8:\"New York\";s:5:\"value\";s:2:\"NY\";s:8:\"selected\";s:1:\"0\";}i:33;a:3:{s:5:\"label\";s:14:\"North Carolina\";s:5:\"value\";s:2:\"NC\";s:8:\"selected\";s:1:\"0\";}i:34;a:3:{s:5:\"label\";s:12:\"North Dakota\";s:5:\"value\";s:2:\"ND\";s:8:\"selected\";s:1:\"0\";}i:35;a:3:{s:5:\"label\";s:4:\"Ohio\";s:5:\"value\";s:2:\"OH\";s:8:\"selected\";s:1:\"0\";}i:36;a:3:{s:5:\"label\";s:8:\"Oklahoma\";s:5:\"value\";s:2:\"OK\";s:8:\"selected\";s:1:\"0\";}i:37;a:3:{s:5:\"label\";s:6:\"Oregon\";s:5:\"value\";s:2:\"OR\";s:8:\"selected\";s:1:\"0\";}i:38;a:3:{s:5:\"label\";s:12:\"Pennsylvania\";s:5:\"value\";s:2:\"PA\";s:8:\"selected\";s:1:\"0\";}i:39;a:3:{s:5:\"label\";s:12:\"Rhode Island\";s:5:\"value\";s:2:\"RI\";s:8:\"selected\";s:1:\"0\";}i:40;a:3:{s:5:\"label\";s:14:\"South Carolina\";s:5:\"value\";s:2:\"SC\";s:8:\"selected\";s:1:\"0\";}i:41;a:3:{s:5:\"label\";s:12:\"South Dakota\";s:5:\"value\";s:2:\"SD\";s:8:\"selected\";s:1:\"0\";}i:42;a:3:{s:5:\"label\";s:9:\"Tennessee\";s:5:\"value\";s:2:\"TN\";s:8:\"selected\";s:1:\"0\";}i:43;a:3:{s:5:\"label\";s:5:\"Texas\";s:5:\"value\";s:2:\"TX\";s:8:\"selected\";s:1:\"0\";}i:44;a:3:{s:5:\"label\";s:4:\"Utah\";s:5:\"value\";s:2:\"UT\";s:8:\"selected\";s:1:\"0\";}i:45;a:3:{s:5:\"label\";s:7:\"Vermont\";s:5:\"value\";s:2:\"VT\";s:8:\"selected\";s:1:\"0\";}i:46;a:3:{s:5:\"label\";s:8:\"Virginia\";s:5:\"value\";s:2:\"VA\";s:8:\"selected\";s:1:\"0\";}i:47;a:3:{s:5:\"label\";s:10:\"Washington\";s:5:\"value\";s:2:\"WA\";s:8:\"selected\";s:1:\"0\";}i:48;a:3:{s:5:\"label\";s:13:\"West Virginia\";s:5:\"value\";s:2:\"WV\";s:8:\"selected\";s:1:\"0\";}i:49;a:3:{s:5:\"label\";s:9:\"Wisconsin\";s:5:\"value\";s:2:\"WI\";s:8:\"selected\";s:1:\"0\";}i:50;a:3:{s:5:\"label\";s:7:\"Wyoming\";s:5:\"value\";s:2:\"WY\";s:8:\"selected\";s:1:\"0\";}}}s:3:\"req\";s:1:\"0\";s:5:\"class\";s:0:\"\";s:9:\"show_help\";s:1:\"0\";s:9:\"help_text\";s:0:\"\";}\', \'State Dropdown\')';
|
367 |
-
|
368 |
-
$wpdb->query( $sql );
|
369 |
-
}
|
370 |
-
|
371 |
-
/**
|
372 |
-
* Check our option to see if we've updated all of our forms.
|
373 |
-
* If we haven't, loop through all of our forms and see if any need to be updated.
|
374 |
-
*
|
375 |
-
* @since 2.9
|
376 |
-
* @return void
|
377 |
-
*/
|
378 |
-
function nf_29_update_all_form_settings_check() {
|
379 |
-
|
380 |
-
$forms_conversion_complete = get_option( 'nf_convert_forms_complete', false );
|
381 |
-
|
382 |
-
if ( $forms_conversion_complete )
|
383 |
-
return false;
|
384 |
-
|
385 |
-
$url = admin_url( 'index.php?page=nf-upgrade-handler' );
|
386 |
-
|
387 |
-
?>
|
388 |
-
<script type="text/javascript">
|
389 |
-
jQuery(document).ready(function() {
|
390 |
-
window.location.href = "<?php echo $url; ?>";
|
391 |
-
} );
|
392 |
-
</script>
|
393 |
-
<?php
|
394 |
-
}
|
395 |
-
|
396 |
-
add_action( 'nf_admin_before_form_list', 'nf_29_update_all_form_settings_check' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/admin/upgrades/upgrade-handler-page.html.php
DELETED
@@ -1,58 +0,0 @@
|
|
1 |
-
<div class="wrap">
|
2 |
-
|
3 |
-
<h2><?php _e( 'Ninja Forms Upgrade Processing', 'ninja-forms' ); ?></h2>
|
4 |
-
|
5 |
-
<?php foreach ( NF_UpgradeHandler()->upgrades as $upgrade ): ?>
|
6 |
-
<?php if( ! $upgrade->isComplete() ) : ?>
|
7 |
-
<div id="nf_upgrade_<?php echo $upgrade->name ?>">
|
8 |
-
<dl class="menu-item-bar nf_upgrade">
|
9 |
-
<dt class="menu-item-handle">
|
10 |
-
<span class="item-title ninja-forms-field-title nf_upgrade__name"><?php echo $upgrade->nice_name; ?></span>
|
11 |
-
<span class="item-controls">
|
12 |
-
<span class="item-type">
|
13 |
-
<span class="item-type-name nf_upgrade__status">
|
14 |
-
<!-- TODO: Move inline styles to Stylesheet. -->
|
15 |
-
<!-- Status: INCOMPLETE -->
|
16 |
-
<span class="dashicons dashicons-no" style="color: red; display: none;"></span>
|
17 |
-
<!-- Status: PROCESSING -->
|
18 |
-
<span class="spinner" style="display: none;margin-top: -1.5px;margin-right: -2px;"></span>
|
19 |
-
<!-- Status: COMPLETE -->
|
20 |
-
<span class="dashicons dashicons-yes" style="color: green; display: none;"></span>
|
21 |
-
</span>
|
22 |
-
</span>
|
23 |
-
</span>
|
24 |
-
</dt>
|
25 |
-
</dl>
|
26 |
-
<div class="menu-item-settings menu-item-settings--nf-upgrade type-class inside" style="display: none;">
|
27 |
-
<div id="progressbar_<?php echo $upgrade->name; ?>" class="progressbar">
|
28 |
-
<div class="progress-label">
|
29 |
-
<?php _e( 'Processing', 'ninja-forms' ); ?>
|
30 |
-
</div>
|
31 |
-
</div>
|
32 |
-
<p><?php echo $upgrade->description; ?></p>
|
33 |
-
<div class="nf-upgrade-handler__errors" style="display: none; box-sizing: border-box; border: 1px solid #DEDEDE; padding-left: 5px; margin-right: 10px; border-radius: 3px; background-color: #EDEDED;">
|
34 |
-
<h3 class="nf-upgrade-handler__errors__title">
|
35 |
-
<?php _e( 'Error', 'ninja-forms' ); ?>
|
36 |
-
</h3>
|
37 |
-
<pre class="nf-upgrade-handler__errors__text" style="padding-left: 10px;">
|
38 |
-
|
39 |
-
</pre>
|
40 |
-
<p>
|
41 |
-
<?php echo sprintf( __('Please %scontact support%s with the error seen above.', 'ninja-forms' ) , '<a href="https://ninjaforms.com/contact/">', '</a>' ); ?>
|
42 |
-
</p>
|
43 |
-
</div>
|
44 |
-
</div>
|
45 |
-
</div>
|
46 |
-
<?php endif; ?>
|
47 |
-
<?php endforeach; ?>
|
48 |
-
|
49 |
-
</div> <!-- /.wrap -->
|
50 |
-
|
51 |
-
<div class="nf-upgrade-complete" style="display: none;">
|
52 |
-
<?php _e( 'Ninja Forms has completed all available upgrades!', 'ninja-forms' ); ?>
|
53 |
-
</div><!-- /.nf-upgrade-complete -->
|
54 |
-
<div class="nf-upgrade-complete-buttons" style="display: none;">
|
55 |
-
<div id="nf-admin-modal-update">
|
56 |
-
<a class="button-primary" href="<?php echo admin_url( 'admin.php?page=ninja-forms' );?>"><?php _e( 'Go to Forms', 'ninja-forms' ); ?></a>
|
57 |
-
</div>
|
58 |
-
</div><!-- /.nf-upgrade-complete-buttons -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/admin/upgrades/upgrade-handler-page.php
DELETED
@@ -1,120 +0,0 @@
|
|
1 |
-
<?php //if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
|
3 |
-
class NF_UpgradeHandlerPage
|
4 |
-
{
|
5 |
-
public $slug = 'nf-upgrade-handler';
|
6 |
-
|
7 |
-
public function __construct()
|
8 |
-
{
|
9 |
-
add_action( 'admin_menu', array( $this, 'register' ) );
|
10 |
-
add_action( 'admin_notices', array( $this, 'show_upgrade_notices' ) );
|
11 |
-
}
|
12 |
-
|
13 |
-
public function register()
|
14 |
-
{
|
15 |
-
$page = add_submenu_page(
|
16 |
-
/* Parent Slug */ NULL,
|
17 |
-
/* Page Title */ __( 'Ninja Forms Upgrade', 'ninja-forms' ),
|
18 |
-
/* Menu Title */ __( 'Upgrade', 'ninja-forms' ),
|
19 |
-
/* Capabilities */ apply_filters( 'ninja_forms_admin_menu_capabilities', 'manage_options' ),
|
20 |
-
/* Menu Slug */ $this->slug,
|
21 |
-
/* Function */ array( $this, 'display' )
|
22 |
-
);
|
23 |
-
|
24 |
-
add_action( 'admin_print_styles-' . $page, array( $this, 'scripts' ) );
|
25 |
-
add_action( 'admin_print_styles-' . $page, array( $this, 'styles' ) );
|
26 |
-
add_action( 'admin_print_styles-' . $page, 'ninja_forms_admin_js');
|
27 |
-
}
|
28 |
-
|
29 |
-
public function display()
|
30 |
-
{
|
31 |
-
include 'upgrade-handler-page.html.php';
|
32 |
-
}
|
33 |
-
|
34 |
-
public function scripts()
|
35 |
-
{
|
36 |
-
if (defined('NINJA_FORMS_JS_DEBUG') && NINJA_FORMS_JS_DEBUG) {
|
37 |
-
$suffix = '';
|
38 |
-
$src = 'dev';
|
39 |
-
} else {
|
40 |
-
$suffix = '.min';
|
41 |
-
$src = 'min';
|
42 |
-
}
|
43 |
-
|
44 |
-
wp_enqueue_script(
|
45 |
-
/* Handle */ $this->slug,
|
46 |
-
/* Source */ NF_PLUGIN_URL . 'assets/js/' . $src . '/nf-upgrade-handler' . $suffix . '.js',
|
47 |
-
/* Dependencies */ array( 'jquery', 'jquery-ui-core', 'jquery-ui-progressbar' ),
|
48 |
-
/* Version */ '0.0.1',
|
49 |
-
/* In Footer */ TRUE
|
50 |
-
);
|
51 |
-
|
52 |
-
$upgrades = NF_UpgradeHandler()->upgrades;
|
53 |
-
$first_upgrade = null;
|
54 |
-
foreach( $upgrades as $upgrade ) {
|
55 |
-
|
56 |
-
if ( ! $upgrade->isComplete() ) {
|
57 |
-
$first_upgrade = $upgrade->name;
|
58 |
-
break;
|
59 |
-
}
|
60 |
-
|
61 |
-
}
|
62 |
-
|
63 |
-
wp_localize_script(
|
64 |
-
$this->slug,
|
65 |
-
'nfUpgradeHandler',
|
66 |
-
array(
|
67 |
-
'upgrade' => $first_upgrade,
|
68 |
-
'nf_upgrade_complete_title' => __( 'Upgrades Complete', 'ninja-forms' ),
|
69 |
-
)
|
70 |
-
);
|
71 |
-
|
72 |
-
}
|
73 |
-
|
74 |
-
public function styles()
|
75 |
-
{
|
76 |
-
wp_enqueue_style(
|
77 |
-
/* Handle */ $this->slug,
|
78 |
-
/* Source */ NF_PLUGIN_URL . 'assets/css/nf-upgrade-handler.css'
|
79 |
-
);
|
80 |
-
|
81 |
-
wp_enqueue_style(
|
82 |
-
/* Handle */ 'ninja-forms-admin',
|
83 |
-
/* Source */ NF_PLUGIN_URL . 'css/ninja-forms-admin.css'
|
84 |
-
);
|
85 |
-
|
86 |
-
wp_enqueue_style(
|
87 |
-
/* Handle */ 'ninja-forms-admin',
|
88 |
-
/* Source */ NF_PLUGIN_URL . 'assets/css/admin-modal.css'
|
89 |
-
);
|
90 |
-
}
|
91 |
-
|
92 |
-
public function show_upgrade_notices()
|
93 |
-
{
|
94 |
-
// Don't show notices on the upgrade handler page.
|
95 |
-
if ( isset ( $_GET['page'] ) && $this->slug == $_GET['page'] ) {
|
96 |
-
return;
|
97 |
-
}
|
98 |
-
|
99 |
-
$upgrades = NF_UpgradeHandler()->upgrades;
|
100 |
-
|
101 |
-
$upgrade_count = 0;
|
102 |
-
|
103 |
-
foreach( $upgrades as $upgrade ) {
|
104 |
-
|
105 |
-
if( ! $upgrade->isComplete() ) {
|
106 |
-
$upgrade_count++;
|
107 |
-
}
|
108 |
-
|
109 |
-
}
|
110 |
-
|
111 |
-
if( 0 < $upgrade_count ) {
|
112 |
-
printf(
|
113 |
-
'<div class="update-nag"><p>' . __('Ninja Forms needs to process %s upgrade(s). This may take a few minutes to complete. %sStart Upgrade%s', 'ninja-forms') . '</p></div>',
|
114 |
-
$upgrade_count,
|
115 |
-
'<a class="button button-primary" href="' . admin_url('admin.php?page=nf-upgrade-handler') . '">',
|
116 |
-
'</a>'
|
117 |
-
);
|
118 |
-
}
|
119 |
-
}
|
120 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/admin/upgrades/upgrades.php
DELETED
@@ -1,74 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
/**
|
3 |
-
* Upgrade Screen
|
4 |
-
*
|
5 |
-
* @package Ninja Forms
|
6 |
-
* @subpackage Admin/Upgrades
|
7 |
-
* @copyright Copyright (c) 2014, WP Ninjas
|
8 |
-
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
-
* @since 2.7
|
10 |
-
*/
|
11 |
-
|
12 |
-
// Exit if accessed directly
|
13 |
-
if ( !defined( 'ABSPATH' ) ) exit;
|
14 |
-
|
15 |
-
/**
|
16 |
-
* Render Upgrades Screen
|
17 |
-
*
|
18 |
-
* @since 2.7
|
19 |
-
* @return void
|
20 |
-
*/
|
21 |
-
function nf_upgrades_screen() {
|
22 |
-
$action = isset( $_GET['nf-upgrade'] ) ? sanitize_text_field( $_GET['nf-upgrade'] ) : '';
|
23 |
-
$step = isset( $_GET['step'] ) ? absint( $_GET['step'] ) : 1;
|
24 |
-
$total = isset( $_GET['total'] ) ? absint( $_GET['total'] ) : false;
|
25 |
-
$custom = isset( $_GET['custom'] ) ? $_GET['custom'] : 0;
|
26 |
-
$form_id = isset( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : 0;
|
27 |
-
|
28 |
-
if ( is_string( $custom ) ) {
|
29 |
-
$custom = urlencode( $custom );
|
30 |
-
}
|
31 |
-
|
32 |
-
?>
|
33 |
-
<div class="wrap">
|
34 |
-
<h2><?php _e( 'Ninja Forms - Processing', 'ninja-forms' ); ?></h2>
|
35 |
-
|
36 |
-
<?php if( ! empty( $action ) ) : ?>
|
37 |
-
|
38 |
-
<div id="nf-upgrade-status">
|
39 |
-
<p><?php _e( 'The process has started, please be patient. This could take several minutes. You will be automatically redirected when the process is finished.', 'ninja-forms' ); ?></p>
|
40 |
-
<?php if( ! empty( $total ) ) : ?>
|
41 |
-
<p><strong><?php printf( __( 'Step %d of approximately %d running', 'ninja-forms' ), $step, $total + 1 ); ?></strong>
|
42 |
-
<span class="spinner" id="nf-upgrade-loader"/></span></p>
|
43 |
-
<?php endif; ?>
|
44 |
-
</div>
|
45 |
-
<script type="text/javascript">
|
46 |
-
document.location.href = "index.php?nf_action=<?php echo $action; ?>&step=<?php echo $step; ?>&total=<?php echo $total; ?>&custom=<?php echo $custom; ?>&form_id=<?php echo $form_id; ?>";
|
47 |
-
</script>
|
48 |
-
|
49 |
-
<?php else : ?>
|
50 |
-
|
51 |
-
<div id="nf-upgrade-status">
|
52 |
-
<p>
|
53 |
-
<?php _e( 'The process has started, please be patient. This could take several minutes. You will be automatically redirected when the process is finished.', 'edd' ); ?>
|
54 |
-
<span class="spinner" id="nf-upgrade-loader"/></span>
|
55 |
-
</p>
|
56 |
-
</div>
|
57 |
-
<script type="text/javascript">
|
58 |
-
jQuery( document ).ready( function() {
|
59 |
-
// Trigger upgrades on page load
|
60 |
-
var data = { action: 'edd_trigger_upgrades' };
|
61 |
-
jQuery.post( ajaxurl, data, function (response) {
|
62 |
-
if( response == 'complete' ) {
|
63 |
-
jQuery('#nf-upgrade-loader').hide();
|
64 |
-
//document.location.href = 'index.php?page=edd-about'; // Redirect to the welcome page
|
65 |
-
}
|
66 |
-
});
|
67 |
-
});
|
68 |
-
</script>
|
69 |
-
|
70 |
-
<?php endif; ?>
|
71 |
-
|
72 |
-
</div>
|
73 |
-
<?php
|
74 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/admin/welcome.php
DELETED
@@ -1,548 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
/**
|
3 |
-
* About Page Class
|
4 |
-
*
|
5 |
-
* @package NF
|
6 |
-
* @subpackage Admin/Welcome
|
7 |
-
* @copyright Copyright (c) 2014, WP Ninjas
|
8 |
-
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
-
* @since 2.7
|
10 |
-
*/
|
11 |
-
|
12 |
-
// Exit if accessed directly
|
13 |
-
if ( ! defined( 'ABSPATH' ) ) exit;
|
14 |
-
|
15 |
-
/**
|
16 |
-
* NF_Welcome Class
|
17 |
-
*
|
18 |
-
* A general class for About and Credits page.
|
19 |
-
*
|
20 |
-
* @since 1.4
|
21 |
-
*/
|
22 |
-
class NF_Welcome {
|
23 |
-
|
24 |
-
/**
|
25 |
-
* @var string The capability users should have to view the page
|
26 |
-
*/
|
27 |
-
public $minimum_capability = 'manage_options';
|
28 |
-
public $display_version = NF_PLUGIN_VERSION;
|
29 |
-
public $header_text;
|
30 |
-
public $header_desc;
|
31 |
-
|
32 |
-
/**
|
33 |
-
* Get things started
|
34 |
-
*
|
35 |
-
* @since 1.4
|
36 |
-
*/
|
37 |
-
public function __construct() {
|
38 |
-
add_action( 'admin_menu', array( $this, 'admin_menus') );
|
39 |
-
add_action( 'admin_head', array( $this, 'admin_head' ) );
|
40 |
-
add_action( 'admin_init', array( $this, 'welcome' ) );
|
41 |
-
|
42 |
-
$this->header_text = sprintf( __( 'Welcome to Ninja Forms %s', 'ninja-forms' ), $this->display_version );
|
43 |
-
$this->header_desc = sprintf( __( 'Thank you for updating! Ninja Forms %s makes form building easier than ever before!', 'ninja-forms' ), $this->display_version );
|
44 |
-
}
|
45 |
-
|
46 |
-
/**
|
47 |
-
* Register the Dashboard Pages which are later hidden but these pages
|
48 |
-
* are used to render the Welcome and Credits pages.
|
49 |
-
*
|
50 |
-
* @access public
|
51 |
-
* @since 1.4
|
52 |
-
* @return void
|
53 |
-
*/
|
54 |
-
public function admin_menus() {
|
55 |
-
// About Page
|
56 |
-
add_dashboard_page(
|
57 |
-
__( 'Welcome to Ninja Forms', 'ninja-forms' ),
|
58 |
-
__( 'Welcome to Ninja Forms', 'ninja-forms' ),
|
59 |
-
$this->minimum_capability,
|
60 |
-
'nf-about',
|
61 |
-
array( $this, 'about_screen' )
|
62 |
-
);
|
63 |
-
|
64 |
-
// Changelog Page
|
65 |
-
add_dashboard_page(
|
66 |
-
__( 'Ninja Forms Changelog', 'ninja-forms' ),
|
67 |
-
__( 'Ninja Forms Changelog', 'ninja-forms' ),
|
68 |
-
$this->minimum_capability,
|
69 |
-
'nf-changelog',
|
70 |
-
array( $this, 'changelog_screen' )
|
71 |
-
);
|
72 |
-
|
73 |
-
// Getting Started Page
|
74 |
-
add_dashboard_page(
|
75 |
-
__( 'Getting started with Ninja Forms', 'ninja-forms' ),
|
76 |
-
__( 'Getting started with Ninja Forms', 'ninja-forms' ),
|
77 |
-
$this->minimum_capability,
|
78 |
-
'nf-getting-started',
|
79 |
-
array( $this, 'getting_started_screen' )
|
80 |
-
);
|
81 |
-
|
82 |
-
// Credits Page
|
83 |
-
add_dashboard_page(
|
84 |
-
__( 'The people who build Ninja Forms', 'ninja-forms' ),
|
85 |
-
__( 'The people who build Ninja Forms', 'ninja-forms' ),
|
86 |
-
$this->minimum_capability,
|
87 |
-
'nf-credits',
|
88 |
-
array( $this, 'credits_screen' )
|
89 |
-
);
|
90 |
-
}
|
91 |
-
|
92 |
-
/**
|
93 |
-
* Hide Individual Dashboard Pages
|
94 |
-
*
|
95 |
-
* @access public
|
96 |
-
* @since 1.4
|
97 |
-
* @return void
|
98 |
-
*/
|
99 |
-
public function admin_head() {
|
100 |
-
remove_submenu_page( 'index.php', 'nf-about' );
|
101 |
-
remove_submenu_page( 'index.php', 'nf-changelog' );
|
102 |
-
remove_submenu_page( 'index.php', 'nf-getting-started' );
|
103 |
-
remove_submenu_page( 'index.php', 'nf-credits' );
|
104 |
-
|
105 |
-
// Ensures style is only on welcome page
|
106 |
-
if ((isset($_GET['page'])) && ($_GET['page']=='nf-about' || $_GET['page']=='nf-getting-started' || $_GET['page']=='nf-credits' || $_GET['page']=='nf-changelog')){
|
107 |
-
|
108 |
-
// Badge for welcome page
|
109 |
-
$badge_url = NF_PLUGIN_URL . 'assets/images/nf-badge.png';
|
110 |
-
?>
|
111 |
-
<style type="text/css" media="screen">
|
112 |
-
/*<![CDATA[*/
|
113 |
-
.nf-badge {
|
114 |
-
padding-top: 125px;
|
115 |
-
height: 52px;
|
116 |
-
width: 185px;
|
117 |
-
color: #fff;
|
118 |
-
font-weight: bold;
|
119 |
-
font-size: 14px;
|
120 |
-
text-align: center;
|
121 |
-
margin: 0 -5px;
|
122 |
-
background: url('<?php echo $badge_url; ?>') no-repeat;
|
123 |
-
}
|
124 |
-
|
125 |
-
.about-wrap .nf-badge {
|
126 |
-
position: absolute;
|
127 |
-
top: 0;
|
128 |
-
right: 0;
|
129 |
-
}
|
130 |
-
|
131 |
-
.nf-welcome-screenshots {
|
132 |
-
float: right;
|
133 |
-
margin-left: 10px!important;
|
134 |
-
}
|
135 |
-
|
136 |
-
.about-wrap .feature-section {
|
137 |
-
margin-top: 20px;
|
138 |
-
}
|
139 |
-
.about-overview {
|
140 |
-
padding: 20px;
|
141 |
-
}
|
142 |
-
.about-overview iframe {
|
143 |
-
display: block;
|
144 |
-
margin: 0 auto;
|
145 |
-
}
|
146 |
-
|
147 |
-
/*]]>*/
|
148 |
-
</style>
|
149 |
-
<?php
|
150 |
-
}
|
151 |
-
}
|
152 |
-
|
153 |
-
/**
|
154 |
-
* Navigation tabs
|
155 |
-
*
|
156 |
-
* @access public
|
157 |
-
* @since 1.9
|
158 |
-
* @return void
|
159 |
-
*/
|
160 |
-
public function tabs() {
|
161 |
-
$selected = isset( $_GET['page'] ) ? $_GET['page'] : 'nf-about';
|
162 |
-
?>
|
163 |
-
<h2 class="nav-tab-wrapper">
|
164 |
-
<a class="nav-tab <?php echo $selected == 'nf-about' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'nf-about' ), 'index.php' ) ) ); ?>">
|
165 |
-
<?php _e( "What's New", 'ninja-forms' ); ?>
|
166 |
-
</a>
|
167 |
-
<a class="nav-tab <?php echo $selected == 'nf-getting-started' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'nf-getting-started' ), 'index.php' ) ) ); ?>">
|
168 |
-
<?php _e( 'Getting Started', 'ninja-forms' ); ?>
|
169 |
-
</a>
|
170 |
-
<a class="nav-tab <?php echo $selected == 'nf-credits' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'nf-credits' ), 'index.php' ) ) ); ?>">
|
171 |
-
<?php _e( 'Credits', 'ninja-forms' ); ?>
|
172 |
-
</a>
|
173 |
-
</h2>
|
174 |
-
<?php
|
175 |
-
}
|
176 |
-
|
177 |
-
/**
|
178 |
-
* Render About Screen
|
179 |
-
*
|
180 |
-
* @access public
|
181 |
-
* @since 1.4
|
182 |
-
* @return void
|
183 |
-
*/
|
184 |
-
public function about_screen() {
|
185 |
-
?>
|
186 |
-
<div class="wrap about-wrap">
|
187 |
-
<h1><?php echo $this->header_text; ?></h1>
|
188 |
-
<div class="about-text"><?php echo $this->header_desc; ?></div>
|
189 |
-
<div class="nf-badge"><?php printf( __( 'Version %s', 'ninja-forms' ), $this->display_version ); ?></div>
|
190 |
-
|
191 |
-
<?php $this->tabs(); ?>
|
192 |
-
|
193 |
-
<div class="changelog">
|
194 |
-
|
195 |
-
<div class="about-overview">
|
196 |
-
<iframe width="640" height="360" src="//www.youtube.com/embed/todRiV7Cel0" frameborder="0" allowfullscreen></iframe>
|
197 |
-
</div>
|
198 |
-
<h2 class="about-headline-callout"><?php _e( 'A simplified and more powerful form building experience.', 'ninja-forms' );?></h2>
|
199 |
-
|
200 |
-
<div class="feature-section col two-col">
|
201 |
-
|
202 |
-
<div class="col-1">
|
203 |
-
<img src="<?php echo NF_PLUGIN_URL . 'assets/images/screenshots/ss-builder.png'; ?>">
|
204 |
-
<h4><?php _e( 'New Builder Tab', 'ninja-forms' );?></h4>
|
205 |
-
<p><?php _e( 'When creating and editing forms, go directly to the section that matters most.', 'ninja-forms' ); ?></p>
|
206 |
-
</div>
|
207 |
-
|
208 |
-
<div class="col-2 last-feature">
|
209 |
-
<img src="<?php echo NF_PLUGIN_URL . 'assets/images/screenshots/ss-field-settings.png'; ?>">
|
210 |
-
<h4><?php _e( 'Better Organized Field Settings', 'ninja-forms' );?></h4>
|
211 |
-
<p><?php printf( __( 'The most common settings are shown immediately, while other, non-essential, settings are tucked away inside expandable sections.', 'ninja-forms' ), admin_url( 'edit.php?post_type=download&page=nf-settings&tab=misc' ) ); ?></p>
|
212 |
-
</div>
|
213 |
-
|
214 |
-
</div>
|
215 |
-
|
216 |
-
<hr />
|
217 |
-
|
218 |
-
<div class="feature-section col three-col">
|
219 |
-
|
220 |
-
<div class="col-1">
|
221 |
-
<img src="<?php echo NF_PLUGIN_URL . 'assets/images/screenshots/ss-emails-actions.png'; ?>">
|
222 |
-
<h4><?php _e( 'Improved clarity', 'ninja-forms' );?></h4>
|
223 |
-
<p><?php _e( 'Along with the "Build Your Form" tab, we\'ve removed "Notifications" in favor of "Emails & Actions." This is a much clearer indication of what can be done on this tab.', 'ninja-forms' ); ?></p>
|
224 |
-
</div>
|
225 |
-
|
226 |
-
<div class="col-2">
|
227 |
-
<img src="<?php echo NF_PLUGIN_URL . 'assets/images/screenshots/ss-nuke-option.png'; ?>">
|
228 |
-
<h4><?php _e( 'Remove all Ninja Forms data', 'ninja-forms' );?></h4>
|
229 |
-
<p><?php _e( 'We\'ve added the option to remove all Ninja Forms data (submissions, forms, fields, options) when you delete the plugin. We call it the nuclear option.', 'ninja-forms' ); ?></p>
|
230 |
-
</div>
|
231 |
-
|
232 |
-
<div class="col-3 last-feature">
|
233 |
-
<img src="<?php echo NF_PLUGIN_URL . 'assets/images/screenshots/ss-licenses.png'; ?>">
|
234 |
-
<h4><?php _e( 'Better license management', 'ninja-forms' );?></h4>
|
235 |
-
<p><?php _e( 'Deactivate Ninja Forms extension licenses individually or as a group from the settings tab.', 'ninja-forms' ); ?></p>
|
236 |
-
</div>
|
237 |
-
|
238 |
-
</div>
|
239 |
-
|
240 |
-
<hr />
|
241 |
-
|
242 |
-
<div class="feature-section col two-col">
|
243 |
-
|
244 |
-
<div class="col-1">
|
245 |
-
<h4><?php _e( 'More to come', 'ninja-forms' ); ?></h4>
|
246 |
-
<p><?php _e( 'The interface updates in this version lay the groundwork for some great improvements in the future. Version 3.0 will build on these changes to make Ninja Forms an even more stable, powerful, and user-friendly form builder.', 'ninja-forms' ); ?></p>
|
247 |
-
</div>
|
248 |
-
|
249 |
-
<div class="col-2 last-feature">
|
250 |
-
<h4><?php _e( 'Documentation', 'ninja-forms' );?></h4>
|
251 |
-
<p><?php _e( 'Take a look at our in-depth Ninja Forms documentation below.', 'ninja-forms' ); ?></p>
|
252 |
-
<p>
|
253 |
-
<a href="<?php echo esc_url( 'http://docs.ninjaforms.com/?utm_medium=plugin&utm_source=welcome-screen&utm_campaign=Ninja+Forms+Welcome&utm_content=Ninja+Forms+Docs' ); ?>"><?php _e( 'Ninja Forms Documentation', 'ninja-forms' ); ?></a> ·
|
254 |
-
<a href="<?php echo esc_url( 'https://ninjaforms.com/contact/?utm_medium=plugin&utm_source=welcome-screen&utm_campaign=Ninja+Forms+Welcome&utm_content=Ninja+Forms+Support' ); ?>"><?php _e( 'Get Support', 'ninja-forms' ); ?></a>
|
255 |
-
</p>
|
256 |
-
</div>
|
257 |
-
|
258 |
-
</div>
|
259 |
-
|
260 |
-
</div>
|
261 |
-
|
262 |
-
<div class="return-to-dashboard">
|
263 |
-
<a href="<?php echo esc_url( admin_url( 'index.php?page=ninja-forms' ) ); ?>"><?php _e( 'Return to Ninja Forms', 'ninja-forms' ); ?></a> ·
|
264 |
-
<a href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'nf-changelog' ), 'index.php' ) ) ); ?>"><?php _e( 'View the Full Changelog', 'ninja-forms' ); ?></a>
|
265 |
-
</div>
|
266 |
-
</div>
|
267 |
-
<?php
|
268 |
-
}
|
269 |
-
|
270 |
-
/**
|
271 |
-
* Render Changelog Screen
|
272 |
-
*
|
273 |
-
* @access public
|
274 |
-
* @since 2.0.3
|
275 |
-
* @return void
|
276 |
-
*/
|
277 |
-
public function changelog_screen() {
|
278 |
-
list( $display_version ) = explode( '-', NF_PLUGIN_VERSION );
|
279 |
-
?>
|
280 |
-
<div class="wrap about-wrap">
|
281 |
-
<h1><?php echo $this->header_text; ?></h1>
|
282 |
-
<div class="about-text"><?php echo $this->header_desc; ?></div>
|
283 |
-
<div class="nf-badge"><?php printf( __( 'Version %s', 'ninja-forms' ), $this->display_version ); ?></div>
|
284 |
-
|
285 |
-
<?php $this->tabs(); ?>
|
286 |
-
|
287 |
-
<div class="changelog">
|
288 |
-
<h3><?php _e( 'Full Changelog', 'ninja-forms' );?></h3>
|
289 |
-
|
290 |
-
<div class="feature-section">
|
291 |
-
<?php echo $this->parse_readme(); ?>
|
292 |
-
</div>
|
293 |
-
</div>
|
294 |
-
|
295 |
-
<div class="return-to-dashboard">
|
296 |
-
<a href="<?php echo esc_url( admin_url( 'index.php?page=ninja-forms' ) ); ?>"><?php _e( 'Go to Ninja Forms', 'ninja-forms' ); ?></a>
|
297 |
-
</div>
|
298 |
-
</div>
|
299 |
-
<?php
|
300 |
-
}
|
301 |
-
|
302 |
-
/**
|
303 |
-
* Render Getting Started Screen
|
304 |
-
*
|
305 |
-
* @access public
|
306 |
-
* @since 1.9
|
307 |
-
* @return void
|
308 |
-
*/
|
309 |
-
public function getting_started_screen() {
|
310 |
-
list( $display_version ) = explode( '-', NF_PLUGIN_VERSION );
|
311 |
-
?>
|
312 |
-
<div class="wrap about-wrap">
|
313 |
-
<h1><?php echo $this->header_text; ?></h1>
|
314 |
-
<div class="about-text"><?php echo $this->header_desc; ?></div>
|
315 |
-
<div class="nf-badge"><?php printf( __( 'Version %s', 'ninja-forms' ), $this->display_version ); ?></div>
|
316 |
-
|
317 |
-
<?php $this->tabs(); ?>
|
318 |
-
|
319 |
-
<p class="about-description"><?php _e( 'Use the tips below to get started using Ninja Forms. You will be up and running in no time!', 'ninja-forms' ); ?></p>
|
320 |
-
|
321 |
-
<div class="changelog">
|
322 |
-
|
323 |
-
<div class="feature-section">
|
324 |
-
<h4><?php _e( 'All About Forms', 'ninja-forms' );?></h4>
|
325 |
-
<img style="width: 500px; height: 292px;" src="<?php echo NF_PLUGIN_URL . 'assets/images/screenshots/ss-new-form.png'; ?>" class="nf-welcome-screenshots">
|
326 |
-
|
327 |
-
<p><?php printf( __( 'The Forms menu is your access point for all things Ninja Forms. We\'ve already created your first %scontact form%s so that you have an example. You can also create your own by clicking %sAdd New%s.', 'ninja-forms' ), '<a href="admin.php?page=ninja-forms&tab=builder&form_id=1">', '</a>', '<a href="admin.php?page=ninja-forms&tab=builder&form_id=new">', '</a>' ); ?></p>
|
328 |
-
|
329 |
-
<h4><?php _e( 'Build Your Form', 'ninja-forms' );?></h4>
|
330 |
-
<p><?php _e( 'This is where you\'ll build your form by adding fields and dragging them into the order you want them to appear. Each field will have an assortment of options such as label, label position, and placeholder.', 'ninja-forms' );?></p>
|
331 |
-
|
332 |
-
<h4><?php _e( 'Emails & Actions', 'ninja-forms' );?></h4>
|
333 |
-
<p><?php _e( 'If you would like for your form to notify you via email when a user clicks submit, you can set those up on this tab. You can create an unlimited number of emails, including emails sent to the user who filled out the form.', 'ninja-forms' );?></p>
|
334 |
-
|
335 |
-
<h4><?php _e( 'Settings', 'ninja-forms' );?></h4>
|
336 |
-
<p><?php _e( 'This tab hold general form settings, such as title and submission method, as well as display settings like hiding a form when it is successfully completed.', 'ninja-forms' );?></p>
|
337 |
-
|
338 |
-
</div>
|
339 |
-
|
340 |
-
</div>
|
341 |
-
|
342 |
-
<hr />
|
343 |
-
|
344 |
-
<div class="changelog">
|
345 |
-
<h3><?php _e( 'Displaying Your Form', 'ninja-forms' );?></h3>
|
346 |
-
|
347 |
-
<div class="feature-section col two-col">
|
348 |
-
|
349 |
-
<div class="col-1">
|
350 |
-
<h4><?php _e( 'Append to Page', 'ninja-forms' );?></h4>
|
351 |
-
<p><?php _e( 'Under Basic Form Behavior in the Form Settings you can easily select a page that you would like the form automatically appended to the end of that page\'s content. A similiar option is avaiable in every content edit screen in its sidebar.', 'ninja-forms' ); ?></p>
|
352 |
-
</div>
|
353 |
-
|
354 |
-
<div class="col-2 last-feature">
|
355 |
-
<h4><?php _e( 'Shortcode', 'ninja-forms' );?></h4>
|
356 |
-
<p><?php printf( __( 'Place %s in any area that accepts shortcodes to display your form anywhere you like. Even in the middle of your page or posts content.', 'ninja-forms' ), '[ninja_form id=1]' ); ?></p>
|
357 |
-
</div>
|
358 |
-
|
359 |
-
</div>
|
360 |
-
|
361 |
-
<div class="feature-section col two-col">
|
362 |
-
|
363 |
-
<div class="col-1">
|
364 |
-
<h4><?php _e( 'Ninja Forms Widget', 'ninja-forms' );?></h4>
|
365 |
-
<p><?php printf( __( 'Ninja Forms provides a widget that you can place in any widgetized area of your site and select exactly which form you would like displayed in that space.', 'ninja-forms' ), admin_url( 'edit.php?post_type=download&page=nf-settings&tab=misc' ) ); ?></p>
|
366 |
-
</div>
|
367 |
-
|
368 |
-
<div class="col-2 last-feature">
|
369 |
-
<h4><?php _e( 'Template Function', 'ninja-forms' );?></h4>
|
370 |
-
<p><?php printf( __( 'Ninja Forms also comes with a simple template function that can be placed directly into a php template file. %s', 'ninja-forms' ), '<code>if( function_exists( \'ninja_forms_display_form\' ) ){ ninja_forms_display_form( 1 ); }</code>' ); ?></p>
|
371 |
-
</div>
|
372 |
-
|
373 |
-
</div>
|
374 |
-
|
375 |
-
</div>
|
376 |
-
|
377 |
-
<hr />
|
378 |
-
|
379 |
-
<div class="changelog">
|
380 |
-
<h3><?php _e( 'Need Help?', 'ninja-forms' );?></h3>
|
381 |
-
|
382 |
-
<div class="feature-section col two-col">
|
383 |
-
|
384 |
-
<div class="col-1">
|
385 |
-
<h4><?php _e( 'Growing Documentation', 'ninja-forms' );?></h4>
|
386 |
-
<p><?php printf( __( 'Documentation is available covering everything from %sTroubleshooting%s to our %sDeveloper API%s. New Documents are always being added.', 'ninja-forms' ), '<a href="http://docs.ninjaforms.com/customer/portal/articles/2045713-troubleshooting-ninja-forms/?utm_medium=plugin&utm_source=welcome-screen&utm_campaign=Ninja+Forms+Welcome&utm_content=Ninja+Forms+Docs">', '</a>', '<a href="http://docs.ninjaforms.com/customer/portal/topics/798123-developer-api/articles/?utm_medium=plugin&utm_source=welcome-screen&utm_campaign=Ninja+Forms+Welcome&utm_content=Ninja+Forms+Docs">', '</a>' ); ?></p>
|
387 |
-
</div>
|
388 |
-
|
389 |
-
<div class="col-2 last-feature">
|
390 |
-
<h4><?php _e( 'Best Support in the Business', 'ninja-forms' );?></h4>
|
391 |
-
<p><?php printf( __( 'We do all we can to provide every Ninja Forms user with the best support possible. If you encounter a problem or have a question, %splease contact us%s.', 'ninja-forms' ), '<a href="https://ninjaforms.com/contact/?utm_medium=plugin&utm_source=welcome-screen&utm_campaign=Ninja+Forms+Welcome&utm_content=Ninja+Forms+Support">', '</a>' ); ?></p>
|
392 |
-
</div>
|
393 |
-
|
394 |
-
</div>
|
395 |
-
|
396 |
-
</div>
|
397 |
-
</div>
|
398 |
-
<?php
|
399 |
-
}
|
400 |
-
|
401 |
-
/**
|
402 |
-
* Render Credits Screen
|
403 |
-
*
|
404 |
-
* @access public
|
405 |
-
* @since 1.4
|
406 |
-
* @return void
|
407 |
-
*/
|
408 |
-
public function credits_screen() {
|
409 |
-
list( $display_version ) = explode( '-', NF_PLUGIN_VERSION );
|
410 |
-
?>
|
411 |
-
<div class="wrap about-wrap">
|
412 |
-
<h1><?php printf( __( 'Welcome to Ninja Forms %s', 'ninja-forms' ), $display_version ); ?></h1>
|
413 |
-
<div class="about-text"><?php printf( __( 'Thank you for updating to the latest version! Ninja Forms %s is primed to make your experience managing submissions an enjoyable one!', 'ninja-forms' ), $display_version ); ?></div>
|
414 |
-
<div class="nf-badge"><?php printf( __( 'Version %s', 'ninja-forms' ), $display_version ); ?></div>
|
415 |
-
|
416 |
-
<?php $this->tabs(); ?>
|
417 |
-
|
418 |
-
<p class="about-description"><?php _e( 'Ninja Forms is created by a worldwide team of developers who aim to provide the #1 WordPress community form creation plugin.', 'ninja-forms' ); ?></p>
|
419 |
-
|
420 |
-
<?php echo $this->contributors(); ?>
|
421 |
-
</div>
|
422 |
-
<?php
|
423 |
-
}
|
424 |
-
|
425 |
-
|
426 |
-
/**
|
427 |
-
* Parse the NF readme.txt file
|
428 |
-
*
|
429 |
-
* @since 2.0.3
|
430 |
-
* @return string $readme HTML formatted readme file
|
431 |
-
*/
|
432 |
-
public function parse_readme() {
|
433 |
-
$file = file_exists( NF_PLUGIN_DIR . 'readme.txt' ) ? NF_PLUGIN_DIR . 'readme.txt' : null;
|
434 |
-
|
435 |
-
if ( ! $file ) {
|
436 |
-
$readme = '<p>' . __( 'No valid changelog was found.', 'ninja-forms' ) . '</p>';
|
437 |
-
} else {
|
438 |
-
$readme = file_get_contents( $file );
|
439 |
-
$readme = nl2br( esc_html( $readme ) );
|
440 |
-
|
441 |
-
$readme = explode( '== Changelog ==', $readme );
|
442 |
-
$readme = end( $readme );
|
443 |
-
|
444 |
-
$readme = preg_replace( '/`(.*?)`/', '<code>\\1</code>', $readme );
|
445 |
-
$readme = preg_replace( '/[\040]\*\*(.*?)\*\*/', ' <strong>\\1</strong>', $readme );
|
446 |
-
$readme = preg_replace( '/[\040]\*(.*?)\*/', ' <em>\\1</em>', $readme );
|
447 |
-
$readme = preg_replace( '/= (.*?) =/', '<h4>\\1</h4>', $readme );
|
448 |
-
$readme = preg_replace( '/\[(.*?)\]\((.*?)\)/', '<a href="\\2">\\1</a>', $readme );
|
449 |
-
}
|
450 |
-
|
451 |
-
return $readme;
|
452 |
-
}
|
453 |
-
|
454 |
-
|
455 |
-
/**
|
456 |
-
* Render Contributors List
|
457 |
-
*
|
458 |
-
* @since 1.4
|
459 |
-
* @uses NF_Welcome::get_contributors()
|
460 |
-
* @return string $contributor_list HTML formatted list of all the contributors for NF
|
461 |
-
*/
|
462 |
-
public function contributors() {
|
463 |
-
$contributors = $this->get_contributors();
|
464 |
-
|
465 |
-
if ( empty( $contributors ) )
|
466 |
-
return '';
|
467 |
-
|
468 |
-
$contributor_list = '<ul class="wp-people-group">';
|
469 |
-
|
470 |
-
foreach ( $contributors as $contributor ) {
|
471 |
-
$contributor_list .= '<li class="wp-person">';
|
472 |
-
$contributor_list .= sprintf( '<a href="%s" title="%s">',
|
473 |
-
esc_url( 'https://github.com/' . $contributor->login ),
|
474 |
-
esc_html( sprintf( __( 'View %s', 'ninja-forms' ), $contributor->login ) )
|
475 |
-
);
|
476 |
-
$contributor_list .= sprintf( '<img src="%s" width="64" height="64" class="gravatar" alt="%s" />', esc_url( $contributor->avatar_url ), esc_html( $contributor->login ) );
|
477 |
-
$contributor_list .= '</a>';
|
478 |
-
$contributor_list .= sprintf( '<a class="web" href="%s">%s</a>', esc_url( 'https://github.com/' . $contributor->login ), esc_html( $contributor->login ) );
|
479 |
-
$contributor_list .= '</a>';
|
480 |
-
$contributor_list .= '</li>';
|
481 |
-
}
|
482 |
-
|
483 |
-
$contributor_list .= '</ul>';
|
484 |
-
|
485 |
-
return $contributor_list;
|
486 |
-
}
|
487 |
-
|
488 |
-
/**
|
489 |
-
* Retreive list of contributors from GitHub.
|
490 |
-
*
|
491 |
-
* @access public
|
492 |
-
* @since 1.4
|
493 |
-
* @return array $contributors List of contributors
|
494 |
-
*/
|
495 |
-
public function get_contributors() {
|
496 |
-
$contributors = get_transient( 'nf_contributors' );
|
497 |
-
|
498 |
-
if ( false !== $contributors )
|
499 |
-
return $contributors;
|
500 |
-
|
501 |
-
$response = wp_remote_get( 'https://api.github.com/repos/wpninjas/ninja-forms/contributors?&per_page=100', array( 'sslverify' => false ) );
|
502 |
-
|
503 |
-
if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) )
|
504 |
-
return array();
|
505 |
-
|
506 |
-
$contributors = json_decode( wp_remote_retrieve_body( $response ) );
|
507 |
-
|
508 |
-
if ( ! is_array( $contributors ) )
|
509 |
-
return array();
|
510 |
-
|
511 |
-
set_transient( 'nf_contributors', $contributors, 3600 );
|
512 |
-
|
513 |
-
return $contributors;
|
514 |
-
}
|
515 |
-
|
516 |
-
/**
|
517 |
-
* Sends user to the Welcome page on first activation of NF as well as each
|
518 |
-
* time NF is upgraded to a new version
|
519 |
-
*
|
520 |
-
* @access public
|
521 |
-
* @since 1.4
|
522 |
-
* @global $nf_options Array of all the NF Options
|
523 |
-
* @return void
|
524 |
-
*/
|
525 |
-
public function welcome() {
|
526 |
-
global $nf_options;
|
527 |
-
|
528 |
-
// Bail if no activation redirect
|
529 |
-
if ( ! get_transient( '_nf_activation_redirect' ) )
|
530 |
-
return;
|
531 |
-
|
532 |
-
// Delete the redirect transient
|
533 |
-
delete_transient( '_nf_activation_redirect' );
|
534 |
-
|
535 |
-
// Bail if activating from network, or bulk
|
536 |
-
if ( is_network_admin() || isset( $_GET['activate-multi'] ) )
|
537 |
-
return;
|
538 |
-
|
539 |
-
$upgrade = get_option( 'nf_version_upgraded_from' );
|
540 |
-
|
541 |
-
if( ! $upgrade ) { // First time install
|
542 |
-
wp_safe_redirect( admin_url( 'index.php?page=nf-getting-started' ) ); exit;
|
543 |
-
} else { // Update
|
544 |
-
wp_safe_redirect( admin_url( 'index.php?page=nf-about' ) ); exit;
|
545 |
-
}
|
546 |
-
}
|
547 |
-
}
|
548 |
-
new NF_Welcome();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/class-extension-updater.php
DELETED
@@ -1,298 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
/*
|
3 |
-
*
|
4 |
-
* This class handles all the update-related stuff for extensions, including adding a license section to the license tab.
|
5 |
-
* It accepts two args: Product Name and Version.
|
6 |
-
*
|
7 |
-
* @param $product_name string
|
8 |
-
* @param $version string
|
9 |
-
* @since 2.2.47
|
10 |
-
* @return void
|
11 |
-
*/
|
12 |
-
|
13 |
-
class NF_Extension_Updater
|
14 |
-
{
|
15 |
-
|
16 |
-
/*
|
17 |
-
*
|
18 |
-
* Define our class variables
|
19 |
-
*/
|
20 |
-
public $product_nice_name = '';
|
21 |
-
public $product_name = '';
|
22 |
-
public $version = '';
|
23 |
-
public $store_url = 'https://ninjaforms.com/update-check/';
|
24 |
-
public $file = '';
|
25 |
-
public $author = '';
|
26 |
-
public $error = '';
|
27 |
-
|
28 |
-
/*
|
29 |
-
*
|
30 |
-
* Constructor function
|
31 |
-
*
|
32 |
-
* @since 2.2.47
|
33 |
-
* @return void
|
34 |
-
*/
|
35 |
-
|
36 |
-
function __construct( $product_name, $version, $author, $file, $slug = '' ) {
|
37 |
-
$this->product_nice_name = $product_name;
|
38 |
-
if ( $slug == '' ) {
|
39 |
-
$this->product_name = strtolower( $product_name );
|
40 |
-
$this->product_name = preg_replace( "/[^a-zA-Z]+/", "", $this->product_name );
|
41 |
-
} else {
|
42 |
-
$this->product_name = $slug;
|
43 |
-
}
|
44 |
-
|
45 |
-
$this->version = $version;
|
46 |
-
$this->file = str_replace( '/deprecated', '', $file );
|
47 |
-
$this->author = $author;
|
48 |
-
|
49 |
-
$this->add_license_fields();
|
50 |
-
$this->auto_update();
|
51 |
-
|
52 |
-
} // function constructor
|
53 |
-
|
54 |
-
/*
|
55 |
-
*
|
56 |
-
* Function that adds the license entry fields to the license tab.
|
57 |
-
*
|
58 |
-
* @since 2.2.47
|
59 |
-
* @return void
|
60 |
-
*/
|
61 |
-
|
62 |
-
function add_license_fields() {
|
63 |
-
$valid = $this->is_valid();
|
64 |
-
$error = $this->get_error();
|
65 |
-
$note = $valid ? '' : __( 'You will find this included with your purchase email.', 'ninja-forms' );
|
66 |
-
$desc = $error ? $error : $note;
|
67 |
-
$args = array(
|
68 |
-
'page' => 'ninja-forms-settings',
|
69 |
-
'tab' => 'license_settings',
|
70 |
-
'slug' => 'license_settings',
|
71 |
-
'settings' => array(
|
72 |
-
array(
|
73 |
-
'name' => $this->product_name.'_license',
|
74 |
-
'type' => 'custom',
|
75 |
-
'label' => $this->product_nice_name.' '.__( 'Key', 'ninja-forms' ),
|
76 |
-
'desc' => $desc,
|
77 |
-
'save_function' => array( $this, 'check_license' ),
|
78 |
-
'class' => 'test',
|
79 |
-
'display_function' => array( $this, 'output_field' ),
|
80 |
-
),
|
81 |
-
),
|
82 |
-
);
|
83 |
-
if( function_exists( 'ninja_forms_register_tab_metabox_options' ) ){
|
84 |
-
ninja_forms_register_tab_metabox_options( $args );
|
85 |
-
}
|
86 |
-
} // function add_license_fields
|
87 |
-
|
88 |
-
/*
|
89 |
-
*
|
90 |
-
* Function that activates the license for this product
|
91 |
-
*
|
92 |
-
* @since 2.2.47
|
93 |
-
* @return void
|
94 |
-
*/
|
95 |
-
|
96 |
-
function check_license( $data ) {
|
97 |
-
// Check to see if we've clicked the deactivate all button.
|
98 |
-
if ( isset ( $data['deactivate_all'] ) ) {
|
99 |
-
$this->deactivate_license();
|
100 |
-
} else if ( isset ( $data[ 'deactivate_license_' . $this->product_name ] ) ) { // Check to see if we've clicked a deactivation button.
|
101 |
-
$this->deactivate_license();
|
102 |
-
return false;
|
103 |
-
} else if ( isset ( $data[ $this->product_name . '_license' ] ) ) {
|
104 |
-
$this->activate_license( $data );
|
105 |
-
}
|
106 |
-
|
107 |
-
} // function check_license
|
108 |
-
|
109 |
-
/*
|
110 |
-
*
|
111 |
-
* Function that activates our license
|
112 |
-
*
|
113 |
-
* @since 2.2.47
|
114 |
-
* @return void
|
115 |
-
*/
|
116 |
-
|
117 |
-
function activate_license( $data ) {
|
118 |
-
|
119 |
-
$plugin_settings = nf_get_settings();
|
120 |
-
// retrieve the license from the database
|
121 |
-
$license = $data[ $this->product_name.'_license' ];
|
122 |
-
|
123 |
-
// data to send in our API request
|
124 |
-
$api_params = array(
|
125 |
-
'edd_action'=> 'activate_license',
|
126 |
-
'license' => $license,
|
127 |
-
'item_name' => urlencode( $this->product_nice_name ) // the name of our product in EDD
|
128 |
-
);
|
129 |
-
|
130 |
-
// Call the custom API.
|
131 |
-
$response = wp_remote_post( esc_url_raw( add_query_arg( $api_params, $this->store_url ) ) );
|
132 |
-
|
133 |
-
if ( isset ( $_GET['debug'] ) && 'true' == $_GET['debug'] ) {
|
134 |
-
echo '<pre>';
|
135 |
-
var_dump( $response );
|
136 |
-
echo '</pre>';
|
137 |
-
die();
|
138 |
-
}
|
139 |
-
|
140 |
-
// make sure the response came back okay
|
141 |
-
if ( is_wp_error( $response ) )
|
142 |
-
return false;
|
143 |
-
|
144 |
-
// decode the license data
|
145 |
-
$license_data = json_decode( wp_remote_retrieve_body( $response ) );
|
146 |
-
|
147 |
-
// $license_data->license will be either "valid" or "invalid"
|
148 |
-
$plugin_settings[ $this->product_name . '_license' ] = $license;
|
149 |
-
$plugin_settings[ $this->product_name . '_license_status' ] = $license_data->license;
|
150 |
-
|
151 |
-
if ( 'invalid' == $license_data->license ) {
|
152 |
-
$error = '<span style="color: red;">' . __( 'Could not activate license. Please verify your license key', 'ninja-forms' ) . '</span>';
|
153 |
-
} else {
|
154 |
-
$error = '';
|
155 |
-
}
|
156 |
-
|
157 |
-
$plugin_settings[ $this->product_name . '_license_error' ] = $error;
|
158 |
-
|
159 |
-
update_option( 'ninja_forms_settings', $plugin_settings );
|
160 |
-
}
|
161 |
-
|
162 |
-
/*
|
163 |
-
*
|
164 |
-
* Function that deactivates our license if the user clicks the "Deactivate License" button.
|
165 |
-
*
|
166 |
-
* @since 2.2.47
|
167 |
-
* @return void
|
168 |
-
*/
|
169 |
-
|
170 |
-
function deactivate_license() {
|
171 |
-
$plugin_settings = nf_get_settings();
|
172 |
-
|
173 |
-
if( isset( $plugin_settings[ $this->product_name.'_license_status' ] ) ){
|
174 |
-
$status = $plugin_settings[ $this->product_name.'_license_status' ];
|
175 |
-
}else{
|
176 |
-
$status = 'invalid';
|
177 |
-
}
|
178 |
-
|
179 |
-
if( isset( $plugin_settings[ $this->product_name.'_license' ] ) ){
|
180 |
-
$license = $plugin_settings[ $this->product_name.'_license'];
|
181 |
-
}else{
|
182 |
-
$license = '';
|
183 |
-
}
|
184 |
-
|
185 |
-
// data to send in our API request
|
186 |
-
$api_params = array(
|
187 |
-
'edd_action'=> 'deactivate_license',
|
188 |
-
'license' => $license,
|
189 |
-
'item_name' => urlencode( $this->product_nice_name ) // the name of our product in EDD
|
190 |
-
);
|
191 |
-
|
192 |
-
// Call the custom API.
|
193 |
-
$response = wp_remote_post( esc_url_raw( add_query_arg( $api_params, $this->store_url ) ), array( 'timeout' => 15, 'sslverify' => false ) );
|
194 |
-
|
195 |
-
if ( isset ( $_GET['debug'] ) && 'true' == $_GET['debug'] ) {
|
196 |
-
echo '<pre>';
|
197 |
-
var_dump( $response );
|
198 |
-
echo '</pre>';
|
199 |
-
die();
|
200 |
-
}
|
201 |
-
|
202 |
-
// make sure the response came back okay
|
203 |
-
if ( is_wp_error( $response ) )
|
204 |
-
return false;
|
205 |
-
|
206 |
-
// decode the license data
|
207 |
-
$license_data = json_decode( wp_remote_retrieve_body( $response ) );
|
208 |
-
|
209 |
-
$plugin_settings[ $this->product_name.'_license_error' ] = '';
|
210 |
-
// $license_data->license will be either "deactivated" or "failed"
|
211 |
-
// if( 'deactivated' == $license_data->license ) {
|
212 |
-
// $license_data->license will be either "valid" or "invalid"
|
213 |
-
$plugin_settings[ $this->product_name.'_license_status' ] = 'invalid';
|
214 |
-
$plugin_settings[ $this->product_name.'_license' ] = '';
|
215 |
-
// }
|
216 |
-
update_option( 'ninja_forms_settings', $plugin_settings );
|
217 |
-
}
|
218 |
-
|
219 |
-
/*
|
220 |
-
*
|
221 |
-
* Function that runs all of our auto-update functionality
|
222 |
-
*
|
223 |
-
* @since 2.2.47
|
224 |
-
* @return void
|
225 |
-
*/
|
226 |
-
|
227 |
-
function auto_update() {
|
228 |
-
$plugin_settings = nf_get_settings();
|
229 |
-
|
230 |
-
// retrieve our license key from the DB
|
231 |
-
if( isset( $plugin_settings[ $this->product_name.'_license' ] ) ){
|
232 |
-
$license = $plugin_settings[ $this->product_name.'_license' ];
|
233 |
-
}else{
|
234 |
-
$license = '';
|
235 |
-
}
|
236 |
-
|
237 |
-
// setup the updater
|
238 |
-
$edd_updater = new EDD_SL_Plugin_Updater( $this->store_url, $this->file, array(
|
239 |
-
'version' => $this->version, // current version number
|
240 |
-
'license' => $license, // license key (used get_option above to retrieve from DB)
|
241 |
-
'item_name' => $this->product_nice_name, // name of this plugin
|
242 |
-
'author' => $this->author, // author of this plugin
|
243 |
-
)
|
244 |
-
);
|
245 |
-
} // function auto_update
|
246 |
-
|
247 |
-
/**
|
248 |
-
* Return whether or not this license is valid.
|
249 |
-
*
|
250 |
-
* @access public
|
251 |
-
* @since 2.9
|
252 |
-
* @return bool
|
253 |
-
*/
|
254 |
-
public function is_valid() {
|
255 |
-
$plugin_settings = nf_get_settings();
|
256 |
-
if( isset( $plugin_settings[ $this->product_name.'_license_status' ] ) && $plugin_settings[ $this->product_name.'_license_status' ] == 'valid' ){
|
257 |
-
return true;
|
258 |
-
}else{
|
259 |
-
return false;
|
260 |
-
}
|
261 |
-
}
|
262 |
-
|
263 |
-
/**
|
264 |
-
* Output our field for entering and deactivating a license.
|
265 |
-
*
|
266 |
-
* @access public
|
267 |
-
* @since 2.9
|
268 |
-
* @return void
|
269 |
-
*/
|
270 |
-
public function output_field( $form_id, $data, $field ) {
|
271 |
-
$valid = $this->is_valid();
|
272 |
-
if ( $valid ) {
|
273 |
-
$license = isset ( $data[ $this->product_name . '_license' ] ) ? $data[ $this->product_name . '_license' ] : '';
|
274 |
-
?>
|
275 |
-
<span class="nf-license"><?php echo $license; ?></span>
|
276 |
-
<input type="submit" class="button-secondary" name="deactivate_license_<?php echo $this->product_name; ?>" value="<?php _e( 'Deactivate License', 'ninja-forms' ); ?>">
|
277 |
-
<?php
|
278 |
-
} else {
|
279 |
-
?>
|
280 |
-
<input type="text" style="width:55%" class="code" name="<?php echo $this->product_name . '_license'; ?>" id="" value="" />
|
281 |
-
<?php
|
282 |
-
}
|
283 |
-
}
|
284 |
-
|
285 |
-
/**
|
286 |
-
* Get any error messages for this license field.
|
287 |
-
*
|
288 |
-
* @access public
|
289 |
-
* @since 2.9
|
290 |
-
* @return string $error
|
291 |
-
*/
|
292 |
-
public function get_error() {
|
293 |
-
$plugin_settings = nf_get_settings();
|
294 |
-
$error = ! empty( $plugin_settings[ $this->product_name . '_license_error' ] ) ? $plugin_settings[ $this->product_name . '_license_error' ] : false;
|
295 |
-
return $error;
|
296 |
-
}
|
297 |
-
|
298 |
-
} // class
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/classes/class-nf-system-status.php
DELETED
@@ -1,51 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
/**
|
3 |
-
* Debug/Status page
|
4 |
-
*
|
5 |
-
* @author Patrick Rauland
|
6 |
-
* @category Admin
|
7 |
-
* @since 2.2.50
|
8 |
-
*/
|
9 |
-
|
10 |
-
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
11 |
-
|
12 |
-
if ( ! class_exists( 'NF_System_Status' ) ) :
|
13 |
-
|
14 |
-
/**
|
15 |
-
* NF_System_Status Class
|
16 |
-
*/
|
17 |
-
class NF_System_Status {
|
18 |
-
|
19 |
-
/**
|
20 |
-
* Initializes the class
|
21 |
-
*/
|
22 |
-
public function __construct(){
|
23 |
-
// register the system status page
|
24 |
-
add_action('admin_init', array($this, 'ninja_forms_register_tab_system_status'));
|
25 |
-
}
|
26 |
-
|
27 |
-
/**
|
28 |
-
* Handles output of the reports page in admin.
|
29 |
-
*/
|
30 |
-
public function ninja_forms_register_tab_system_status(){
|
31 |
-
// include the file
|
32 |
-
require_once( NINJA_FORMS_DIR . "/includes/admin/pages/system-status.php" );
|
33 |
-
|
34 |
-
// add the arugements
|
35 |
-
$args = array(
|
36 |
-
'name' => __( 'Ninja Forms System Status', 'ninja-forms' ),
|
37 |
-
'page' => 'ninja-forms-system-status',
|
38 |
-
'display_function' => 'ninja_forms_tab_system_status',
|
39 |
-
'save_function' => '',
|
40 |
-
'show_save' => false,
|
41 |
-
);
|
42 |
-
|
43 |
-
// register the tab
|
44 |
-
ninja_forms_register_tab('system_status', $args);
|
45 |
-
}
|
46 |
-
|
47 |
-
}
|
48 |
-
|
49 |
-
endif;
|
50 |
-
|
51 |
-
return new NF_System_Status();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/classes/index.php
DELETED
@@ -1,2 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
// Silence is golden.
|
|
|
|
deprecated/includes/database.php
DELETED
@@ -1,416 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
|
3 |
-
// Begin Form Interaction Functions
|
4 |
-
|
5 |
-
function ninja_forms_insert_field( $form_id, $args = array() ){
|
6 |
-
global $wpdb;
|
7 |
-
$insert_array = array();
|
8 |
-
|
9 |
-
$insert_array['type'] = $args['type'];
|
10 |
-
$insert_array['form_id'] = $form_id;
|
11 |
-
|
12 |
-
if( isset( $args['data'] ) ){
|
13 |
-
$insert_array['data'] = $args['data'];
|
14 |
-
}else{
|
15 |
-
$insert_array['data'] = '';
|
16 |
-
}
|
17 |
-
|
18 |
-
if( isset( $args['order'] ) ){
|
19 |
-
$insert_array['order'] = $args['order'];
|
20 |
-
}else{
|
21 |
-
$insert_array['order'] = 999;
|
22 |
-
}
|
23 |
-
|
24 |
-
if( isset( $args['fav_id'] ) ){
|
25 |
-
$insert_array['fav_id'] = $args['fav_id'];
|
26 |
-
}
|
27 |
-
|
28 |
-
if( isset( $args['def_id'] ) ){
|
29 |
-
$insert_array['def_id'] = $args['def_id'];
|
30 |
-
}
|
31 |
-
|
32 |
-
$new_field = $wpdb->insert( NINJA_FORMS_FIELDS_TABLE_NAME, $insert_array );
|
33 |
-
$new_id = $wpdb->insert_id;
|
34 |
-
return $new_id;
|
35 |
-
}
|
36 |
-
|
37 |
-
function ninja_forms_get_form_ids_by_post_id( $post_id ){
|
38 |
-
global $wpdb;
|
39 |
-
$form_ids = array();
|
40 |
-
if( is_page( $post_id ) ){
|
41 |
-
$form_results = ninja_forms_get_all_forms();
|
42 |
-
if(is_array($form_results) AND !empty($form_results)){
|
43 |
-
foreach($form_results as $form){
|
44 |
-
$form_data = $form['data'];
|
45 |
-
if(isset($form_data['append_page']) AND !empty($form_data['append_page'])){
|
46 |
-
if($form_data['append_page'] == $post_id){
|
47 |
-
$form_ids[] = $form['id'];
|
48 |
-
}
|
49 |
-
}
|
50 |
-
}
|
51 |
-
}
|
52 |
-
$form_id = get_post_meta( $post_id, 'ninja_forms_form', true );
|
53 |
-
if( !empty( $form_id ) ){
|
54 |
-
$form_ids[] = $form_id;
|
55 |
-
}
|
56 |
-
}else if( is_single( $post_id ) ){
|
57 |
-
$form_id = get_post_meta( $post_id, 'ninja_forms_form', true );
|
58 |
-
if( !empty( $form_id ) ){
|
59 |
-
$form_ids[] = $form_id;
|
60 |
-
}
|
61 |
-
}
|
62 |
-
|
63 |
-
return $form_ids;
|
64 |
-
}
|
65 |
-
|
66 |
-
function ninja_forms_get_form_by_sub_id( $sub_id ){
|
67 |
-
global $wpdb;
|
68 |
-
$form_id = Ninja_Forms()->sub( $sub_id )->form_id;
|
69 |
-
$form_row = ninja_forms_get_form_by_id( $form_id );
|
70 |
-
return $form_row;
|
71 |
-
}
|
72 |
-
|
73 |
-
// The ninja_forms_delete_form( $form_id ) function is in includes/deprecated.php
|
74 |
-
|
75 |
-
// Begin Field Interaction Functions
|
76 |
-
|
77 |
-
function ninja_forms_get_field_by_id($field_id){
|
78 |
-
global $wpdb;
|
79 |
-
$field_row = $wpdb->get_row($wpdb->prepare("SELECT * FROM ".NINJA_FORMS_FIELDS_TABLE_NAME." WHERE id = %d", $field_id), ARRAY_A);
|
80 |
-
if( $field_row != null ){
|
81 |
-
$field_row['data'] = unserialize($field_row['data']);
|
82 |
-
return $field_row;
|
83 |
-
}else{
|
84 |
-
return false;
|
85 |
-
}
|
86 |
-
}
|
87 |
-
|
88 |
-
function ninja_forms_get_fields_by_form_id($form_id, $orderby = 'ORDER BY `order` ASC'){
|
89 |
-
global $wpdb;
|
90 |
-
|
91 |
-
$field_results = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".NINJA_FORMS_FIELDS_TABLE_NAME." WHERE form_id = %d ".$orderby, $form_id), ARRAY_A);
|
92 |
-
if(is_array($field_results) AND !empty($field_results)){
|
93 |
-
$x = 0;
|
94 |
-
$count = count($field_results) - 1;
|
95 |
-
while($x <= $count){
|
96 |
-
$field_results[$x]['data'] = unserialize($field_results[$x]['data']);
|
97 |
-
$x++;
|
98 |
-
}
|
99 |
-
}
|
100 |
-
|
101 |
-
return $field_results;
|
102 |
-
}
|
103 |
-
|
104 |
-
function ninja_forms_get_all_fields(){
|
105 |
-
global $wpdb;
|
106 |
-
$field_results = $wpdb->get_results("SELECT * FROM ".NINJA_FORMS_FIELDS_TABLE_NAME, ARRAY_A);
|
107 |
-
if(is_array($field_results) AND !empty($field_results)){
|
108 |
-
$x = 0;
|
109 |
-
$count = count($field_results) - 1;
|
110 |
-
while($x <= $count){
|
111 |
-
$field_results[$x]['data'] = unserialize($field_results[$x]['data']);
|
112 |
-
$x++;
|
113 |
-
}
|
114 |
-
}
|
115 |
-
return $field_results;
|
116 |
-
}
|
117 |
-
|
118 |
-
function ninja_forms_update_field($args){
|
119 |
-
global $wpdb;
|
120 |
-
$update_array = $args['update_array'];
|
121 |
-
$where = $args['where'];
|
122 |
-
$wpdb->update(NINJA_FORMS_FIELDS_TABLE_NAME, $update_array, $where);
|
123 |
-
}
|
124 |
-
|
125 |
-
function ninja_forms_delete_field( $field_id ){
|
126 |
-
global $wpdb;
|
127 |
-
$wpdb->query($wpdb->prepare("DELETE FROM ".NINJA_FORMS_FIELDS_TABLE_NAME." WHERE id = %d", $field_id), ARRAY_A);
|
128 |
-
}
|
129 |
-
|
130 |
-
// Begin Favorite Fields Interaction Functions
|
131 |
-
|
132 |
-
function ninja_forms_get_fav_by_id($fav_id){
|
133 |
-
global $wpdb;
|
134 |
-
$fav_row = $wpdb->get_row($wpdb->prepare("SELECT * FROM ".NINJA_FORMS_FAV_FIELDS_TABLE_NAME." WHERE id = %d", $fav_id), ARRAY_A);
|
135 |
-
$fav_row['data'] = unserialize($fav_row['data']);
|
136 |
-
|
137 |
-
return $fav_row;
|
138 |
-
}
|
139 |
-
|
140 |
-
function ninja_forms_delete_fav_by_id($fav_id){
|
141 |
-
global $wpdb;
|
142 |
-
$wpdb->query($wpdb->prepare("DELETE FROM ".NINJA_FORMS_FAV_FIELDS_TABLE_NAME." WHERE id = %d", $fav_id), ARRAY_A);
|
143 |
-
}
|
144 |
-
|
145 |
-
function ninja_forms_get_all_favs(){
|
146 |
-
global $wpdb;
|
147 |
-
$fav_results = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".NINJA_FORMS_FAV_FIELDS_TABLE_NAME." WHERE row_type = %d ORDER BY name ASC", 1), ARRAY_A);
|
148 |
-
if(is_array($fav_results) AND !empty($fav_results)){
|
149 |
-
$x = 0;
|
150 |
-
$count = count($fav_results) - 1;
|
151 |
-
while($x <= $count){
|
152 |
-
$fav_results[$x]['data'] = unserialize($fav_results[$x]['data']);
|
153 |
-
$x++;
|
154 |
-
}
|
155 |
-
}
|
156 |
-
return $fav_results;
|
157 |
-
}
|
158 |
-
|
159 |
-
// Begin Defined Fields Functions
|
160 |
-
|
161 |
-
function ninja_forms_get_def_by_id($def_id){
|
162 |
-
global $wpdb;
|
163 |
-
$def_row = $wpdb->get_row($wpdb->prepare("SELECT * FROM ".NINJA_FORMS_FAV_FIELDS_TABLE_NAME." WHERE id = %d", $def_id), ARRAY_A);
|
164 |
-
$def_row['data'] = unserialize($def_row['data']);
|
165 |
-
return $def_row;
|
166 |
-
}
|
167 |
-
|
168 |
-
function ninja_forms_get_all_defs(){
|
169 |
-
global $wpdb;
|
170 |
-
$def_results = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".NINJA_FORMS_FAV_FIELDS_TABLE_NAME." WHERE row_type = %d", 0), ARRAY_A);
|
171 |
-
if(is_array($def_results) AND !empty($def_results)){
|
172 |
-
$x = 0;
|
173 |
-
$count = count($def_results) - 1;
|
174 |
-
while($x <= $count){
|
175 |
-
$def_results[$x]['data'] = unserialize($def_results[$x]['data']);
|
176 |
-
$x++;
|
177 |
-
}
|
178 |
-
}
|
179 |
-
return $def_results;
|
180 |
-
}
|
181 |
-
|
182 |
-
function ninja_forms_addslashes_deep( $value ){
|
183 |
-
$value = is_array($value) ?
|
184 |
-
array_map('ninja_forms_addslashes_deep', $value) :
|
185 |
-
addslashes($value);
|
186 |
-
return $value;
|
187 |
-
}
|
188 |
-
|
189 |
-
function utf8_encode_recursive( $input ){
|
190 |
-
if ( is_array( $input ) ) {
|
191 |
-
return array_map( __FUNCTION__, $input );
|
192 |
-
}else{
|
193 |
-
return utf8_encode( $input );
|
194 |
-
}
|
195 |
-
}
|
196 |
-
|
197 |
-
function ninja_forms_str_replace_deep($search, $replace, $subject){
|
198 |
-
if( is_array( $subject ) ){
|
199 |
-
foreach( $subject as &$oneSubject )
|
200 |
-
$oneSubject = ninja_forms_str_replace_deep($search, $replace, $oneSubject);
|
201 |
-
unset($oneSubject);
|
202 |
-
return $subject;
|
203 |
-
} else {
|
204 |
-
return str_replace($search, $replace, $subject);
|
205 |
-
}
|
206 |
-
}
|
207 |
-
|
208 |
-
function ninja_forms_html_entity_decode_deep( $value, $flag = ENT_COMPAT ){
|
209 |
-
$value = is_array($value) ?
|
210 |
-
array_map('ninja_forms_html_entity_decode_deep', $value) :
|
211 |
-
html_entity_decode( $value, $flag );
|
212 |
-
return $value;
|
213 |
-
}
|
214 |
-
|
215 |
-
function ninja_forms_htmlspecialchars_deep( $value ){
|
216 |
-
$value = is_array($value) ?
|
217 |
-
array_map('ninja_forms_htmlspecialchars_deep', $value) :
|
218 |
-
htmlspecialchars( $value );
|
219 |
-
return $value;
|
220 |
-
}
|
221 |
-
|
222 |
-
function ninja_forms_stripslashes_deep( $value ){
|
223 |
-
$value = is_array($value) ?
|
224 |
-
array_map('ninja_forms_stripslashes_deep', $value) :
|
225 |
-
stripslashes($value);
|
226 |
-
return $value;
|
227 |
-
}
|
228 |
-
|
229 |
-
function ninja_forms_esc_html_deep( $value ){
|
230 |
-
$value = is_array($value) ?
|
231 |
-
array_map('ninja_forms_esc_html_deep', $value) :
|
232 |
-
esc_html($value);
|
233 |
-
return $value;
|
234 |
-
}
|
235 |
-
|
236 |
-
function nf_wp_kses_post_deep( $value ){
|
237 |
-
$value = is_array( $value ) ?
|
238 |
-
array_map( 'nf_wp_kses_post_deep', $value ) :
|
239 |
-
wp_kses_post($value);
|
240 |
-
|
241 |
-
return $value;
|
242 |
-
}
|
243 |
-
|
244 |
-
function ninja_forms_strip_tags_deep($value ){
|
245 |
-
$value = is_array($value) ?
|
246 |
-
array_map('ninja_forms_strip_tags_deep', $value) :
|
247 |
-
strip_tags($value);
|
248 |
-
return $value;
|
249 |
-
}
|
250 |
-
|
251 |
-
function ninja_forms_json_response(){
|
252 |
-
global $ninja_forms_processing;
|
253 |
-
|
254 |
-
$form_id = $ninja_forms_processing->get_form_ID();
|
255 |
-
|
256 |
-
$errors = $ninja_forms_processing->get_all_errors();
|
257 |
-
$success = $ninja_forms_processing->get_all_success_msgs();
|
258 |
-
$fields = $ninja_forms_processing->get_all_fields();
|
259 |
-
$form_settings = $ninja_forms_processing->get_all_form_settings();
|
260 |
-
$extras = $ninja_forms_processing->get_all_extras();
|
261 |
-
|
262 |
-
// Success will default to false if there is not success message.
|
263 |
-
if ( ! $success && ! $errors ) $success = true;
|
264 |
-
|
265 |
-
if( version_compare( phpversion(), '5.3', '>=' ) ){
|
266 |
-
$json = json_encode( array( 'form_id' => $form_id, 'errors' => $errors, 'success' => $success, 'fields' => $fields, 'form_settings' => $form_settings, 'extras' => $extras ), JSON_HEX_QUOT | JSON_HEX_TAG );
|
267 |
-
}else{
|
268 |
-
|
269 |
-
|
270 |
-
$errors = ninja_forms_html_entity_decode_deep( $errors );
|
271 |
-
$success = ninja_forms_html_entity_decode_deep( $success );
|
272 |
-
$fields = ninja_forms_html_entity_decode_deep( $fields );
|
273 |
-
$form_settings = ninja_forms_html_entity_decode_deep( $form_settings );
|
274 |
-
$extras = ninja_forms_html_entity_decode_deep( $extras );
|
275 |
-
|
276 |
-
$errors = utf8_encode_recursive( $errors );
|
277 |
-
$success = utf8_encode_recursive( $success );
|
278 |
-
$fields = utf8_encode_recursive( $fields );
|
279 |
-
$form_settings = utf8_encode_recursive( $form_settings );
|
280 |
-
$extras = utf8_encode_recursive( $extras );
|
281 |
-
|
282 |
-
$errors = ninja_forms_str_replace_deep( '"', "\u0022", $errors );
|
283 |
-
$errors = ninja_forms_str_replace_deep( "'", "\u0027", $errors );
|
284 |
-
$errors = ninja_forms_str_replace_deep( '<', "\u003C", $errors );
|
285 |
-
$errors = ninja_forms_str_replace_deep( '>', "\u003E", $errors );
|
286 |
-
|
287 |
-
$success = ninja_forms_str_replace_deep( '"', "\u0022", $success );
|
288 |
-
$success = ninja_forms_str_replace_deep( "'", "\u0027", $success );
|
289 |
-
$success = ninja_forms_str_replace_deep( '<', "\u003C", $success );
|
290 |
-
$success = ninja_forms_str_replace_deep( '>', "\u003E", $success );
|
291 |
-
|
292 |
-
$fields = ninja_forms_str_replace_deep( '"', "\u0022", $fields );
|
293 |
-
$fields = ninja_forms_str_replace_deep( "'", "\u0027", $fields );
|
294 |
-
$fields = ninja_forms_str_replace_deep( '<', "\u003C", $fields );
|
295 |
-
$fields = ninja_forms_str_replace_deep( '>', "\u003E", $fields );
|
296 |
-
|
297 |
-
$form_settings = ninja_forms_str_replace_deep( '"', "\u0022", $form_settings );
|
298 |
-
$form_settings = ninja_forms_str_replace_deep( "'", "\u0027", $form_settings );
|
299 |
-
$form_settings = ninja_forms_str_replace_deep( '<', "\u003C", $form_settings );
|
300 |
-
$form_settings = ninja_forms_str_replace_deep( '>', "\u003E", $form_settings );
|
301 |
-
|
302 |
-
$extras = ninja_forms_str_replace_deep( '"', "\u0022", $extras );
|
303 |
-
$extras = ninja_forms_str_replace_deep( "'", "\u0027", $extras );
|
304 |
-
$extras = ninja_forms_str_replace_deep( '<', "\u003C", $extras );
|
305 |
-
$extras = ninja_forms_str_replace_deep( '>', "\u003E", $extras );
|
306 |
-
|
307 |
-
$json = json_encode( array( 'form_id' => $form_id, 'errors' => $errors, 'success' => $success, 'fields' => $fields, 'form_settings' => $form_settings, 'extras' => $extras ) );
|
308 |
-
$json = str_replace( "\\\u0022", "\\u0022", $json );
|
309 |
-
$json = str_replace( "\\\u0027", "\\u0027", $json );
|
310 |
-
$json = str_replace( "\\\u003C", "\\u003C", $json );
|
311 |
-
$json = str_replace( "\\\u003E", "\\u003E", $json );
|
312 |
-
}
|
313 |
-
|
314 |
-
return $json;
|
315 |
-
}
|
316 |
-
|
317 |
-
/*
|
318 |
-
*
|
319 |
-
* Function that sets up our transient variable.
|
320 |
-
*
|
321 |
-
* @since 2.2.45
|
322 |
-
* @return void
|
323 |
-
*/
|
324 |
-
|
325 |
-
function ninja_forms_set_transient(){
|
326 |
-
global $ninja_forms_processing;
|
327 |
-
|
328 |
-
$form_id = $ninja_forms_processing->get_form_ID();
|
329 |
-
|
330 |
-
// Setup our transient variable.
|
331 |
-
$cache = array();
|
332 |
-
$cache['form_id'] = $form_id;
|
333 |
-
$cache['field_values'] = $ninja_forms_processing->get_all_fields();
|
334 |
-
$cache['form_settings'] = $ninja_forms_processing->get_all_form_settings();
|
335 |
-
$cache['extra_values'] = $ninja_forms_processing->get_all_extras();
|
336 |
-
$all_fields_settings = array();
|
337 |
-
if ( $ninja_forms_processing->get_all_fields() ) {
|
338 |
-
foreach ( $ninja_forms_processing->get_all_fields() as $field_id => $user_value ) {
|
339 |
-
$field_settings = $ninja_forms_processing->get_field_settings( $field_id );
|
340 |
-
$all_fields_settings[$field_id] = $field_settings;
|
341 |
-
}
|
342 |
-
}
|
343 |
-
|
344 |
-
$cache['field_settings'] = $all_fields_settings;
|
345 |
-
|
346 |
-
// Set errors and success messages as Ninja_Forms()->session variables.
|
347 |
-
$success = $ninja_forms_processing->get_all_success_msgs();
|
348 |
-
$errors = $ninja_forms_processing->get_all_errors();
|
349 |
-
|
350 |
-
$cache['success_msgs'] = $success;
|
351 |
-
$cache['error_msgs'] = $errors;
|
352 |
-
|
353 |
-
Ninja_Forms()->session->set( 'nf_cache', $cache );
|
354 |
-
}
|
355 |
-
|
356 |
-
/*
|
357 |
-
*
|
358 |
-
* Function that deletes our cache variable
|
359 |
-
*
|
360 |
-
* @since 2.2.45
|
361 |
-
* @return void
|
362 |
-
*/
|
363 |
-
|
364 |
-
function ninja_forms_delete_transient(){
|
365 |
-
Ninja_Forms()->session->delete();
|
366 |
-
}
|
367 |
-
|
368 |
-
/**
|
369 |
-
* Get a count of submissions for a form
|
370 |
-
*
|
371 |
-
* @since 2.7
|
372 |
-
* @param int $post_id
|
373 |
-
* @return int $count
|
374 |
-
*/
|
375 |
-
function nf_get_sub_count( $form_id, $post_status = 'publish' ) {
|
376 |
-
global $wpdb;
|
377 |
-
|
378 |
-
$meta_key = '_form_id';
|
379 |
-
$meta_value = $form_id;
|
380 |
-
|
381 |
-
$sql = "SELECT count(DISTINCT pm.post_id)
|
382 |
-
FROM $wpdb->postmeta pm
|
383 |
-
JOIN $wpdb->posts p ON (p.ID = pm.post_id)
|
384 |
-
WHERE pm.meta_key = %s
|
385 |
-
AND pm.meta_value = %s
|
386 |
-
AND p.post_type = 'nf_sub'
|
387 |
-
AND p.post_status = %s";
|
388 |
-
|
389 |
-
$count = $wpdb->get_var( $wpdb->prepare( $sql, $meta_key, $meta_value, $post_status ) );
|
390 |
-
|
391 |
-
return $count;
|
392 |
-
}
|
393 |
-
|
394 |
-
/**
|
395 |
-
* Get an array of our fields by form ID.
|
396 |
-
* The returned array has the field_ID as the key.
|
397 |
-
*
|
398 |
-
* @since 2.7
|
399 |
-
* @param int $form_id
|
400 |
-
* @return array $tmp_array
|
401 |
-
*/
|
402 |
-
function nf_get_fields_by_form_id( $form_id, $orderby = 'ORDER BY `order` ASC' ){
|
403 |
-
global $wpdb;
|
404 |
-
|
405 |
-
$tmp_array = array();
|
406 |
-
$field_results = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".NINJA_FORMS_FIELDS_TABLE_NAME." WHERE form_id = %d ".$orderby, $form_id), ARRAY_A);
|
407 |
-
if ( is_array( $field_results ) && ! empty( $field_results ) ) {
|
408 |
-
foreach ( $field_results as $field ) {
|
409 |
-
$field_id = $field['id'];
|
410 |
-
$field['data'] = unserialize( $field['data'] );
|
411 |
-
$tmp_array[ $field_id ] = $field;
|
412 |
-
}
|
413 |
-
}
|
414 |
-
|
415 |
-
return $tmp_array;
|
416 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/deprecated.php
DELETED
@@ -1,978 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Deprecated as of version 2.7.
|
5 |
-
*/
|
6 |
-
|
7 |
-
// Hook into our new save sub filter to add any deprecated filters
|
8 |
-
function nf_old_save_sub_filter( $user_value, $field_id ) {
|
9 |
-
return apply_filters( 'ninja_forms_save_sub', $user_value, $field_id );
|
10 |
-
}
|
11 |
-
|
12 |
-
add_filter( 'nf_save_sub_user_value', 'nf_old_save_sub_filter', 10, 2 );
|
13 |
-
|
14 |
-
// Hook into our new nf_save_sub action and add any actions hooked into our old action hooks.
|
15 |
-
function nf_old_save_sub_action( $sub_id ) {
|
16 |
-
do_action( 'ninja_forms_insert_sub', $sub_id );
|
17 |
-
}
|
18 |
-
|
19 |
-
add_action( 'nf_save_sub', 'nf_old_save_sub_action' );
|
20 |
-
|
21 |
-
// Hook into our new submissions CSV filename filter.
|
22 |
-
function nf_old_subs_csv_filename( $filename ) {
|
23 |
-
return apply_filters( 'ninja_forms_export_subs_csv_file_name', $filename );
|
24 |
-
}
|
25 |
-
|
26 |
-
add_filter( 'nf_subs_csv_filename', 'nf_old_subs_csv_filename' );
|
27 |
-
|
28 |
-
// Hook into our new submissions CSV label filter.
|
29 |
-
function nf_old_subs_csv_label( $label, $field_id ) {
|
30 |
-
return apply_filters( 'ninja_forms_export_sub_label', $label, $field_id );
|
31 |
-
}
|
32 |
-
|
33 |
-
add_filter( 'nf_subs_csv_field_label', 'nf_old_subs_csv_label', 10, 2 );
|
34 |
-
|
35 |
-
// Hook into our new submissions CSV label array filter.
|
36 |
-
function nf_old_subs_csv_label_array( $label_array, $sub_ids ) {
|
37 |
-
return apply_filters( 'ninja_forms_export_subs_label_array', $label_array, $sub_ids );
|
38 |
-
}
|
39 |
-
|
40 |
-
add_filter( 'nf_subs_csv_label_array', 'nf_old_subs_csv_label_array', 10, 2 );
|
41 |
-
|
42 |
-
// Hook into our new submissions CSV pre_value filter.
|
43 |
-
function nf_old_subs_csv_pre_value( $user_value, $field_id ) {
|
44 |
-
return apply_filters( 'ninja_forms_export_sub_pre_value', $user_value, $field_id );
|
45 |
-
}
|
46 |
-
|
47 |
-
add_filter( 'nf_subs_export_pre_value', 'nf_old_subs_csv_pre_value', 10, 2 );
|
48 |
-
|
49 |
-
// Hook into our new submissions CSV value filter.
|
50 |
-
function nf_old_subs_csv_value( $user_value, $field_id ) {
|
51 |
-
return apply_filters( 'ninja_forms_export_sub_value', $user_value, $field_id );
|
52 |
-
}
|
53 |
-
|
54 |
-
add_filter( 'nf_subs_csv_field_value', 'nf_old_subs_csv_value', 10, 2 );
|
55 |
-
|
56 |
-
// Hook into our new submissions CSV value array filter.
|
57 |
-
function nf_old_subs_csv_value_array( $values_array, $sub_ids ) {
|
58 |
-
return apply_filters( 'ninja_forms_export_subs_value_array', $values_array, $sub_ids );
|
59 |
-
}
|
60 |
-
|
61 |
-
add_filter( 'nf_subs_csv_value_array', 'nf_old_subs_csv_value_array', 10, 2 );
|
62 |
-
|
63 |
-
// Hook into our new CSV BOM filter
|
64 |
-
function nf_old_subs_csv_bom( $bom ) {
|
65 |
-
return apply_filters( 'ninja_forms_csv_bom', $bom );
|
66 |
-
}
|
67 |
-
|
68 |
-
add_filter( 'nf_sub_csv_bom', 'nf_old_subs_csv_bom' );
|
69 |
-
|
70 |
-
// Hook into our new CSV delimiter filter
|
71 |
-
function nf_old_subs_csv_delimiter( $delimiter ) {
|
72 |
-
return apply_filters( 'ninja_forms_csv_delimiter', $delimiter );
|
73 |
-
}
|
74 |
-
|
75 |
-
add_filter( 'nf_sub_csv_delimiter', 'nf_old_subs_csv_delimiter' );
|
76 |
-
|
77 |
-
// Hook into our new CSV enclosure filter
|
78 |
-
function nf_old_subs_csv_enclosure( $enclosure ) {
|
79 |
-
return apply_filters( 'ninja_forms_csv_enclosure', $enclosure );
|
80 |
-
}
|
81 |
-
|
82 |
-
add_filter( 'nf_sub_csv_enclosure', 'nf_old_subs_csv_enclosure' );
|
83 |
-
|
84 |
-
// Hook into our new CSV terminator filter
|
85 |
-
function nf_old_subs_csv_terminator( $terminator ) {
|
86 |
-
return apply_filters( 'ninja_forms_csv_terminator', $terminator );
|
87 |
-
}
|
88 |
-
|
89 |
-
add_filter( 'nf_sub_csv_terminator', 'nf_old_subs_csv_terminator' );
|
90 |
-
|
91 |
-
// Hook into our new Submissions table row-actions filter
|
92 |
-
function nf_old_subs_table_row_actions_filter( $actions, $sub_id, $form_id ) {
|
93 |
-
return apply_filters( 'ninja_forms_sub_table_row_actions', array(), false, $sub_id, $form_id );
|
94 |
-
}
|
95 |
-
|
96 |
-
add_filter( 'nf_sub_table_row_actions', 'nf_old_subs_table_row_actions_filter', 10, 3 );
|
97 |
-
|
98 |
-
/**
|
99 |
-
* ninja_forms_get_subs() has been deprecated in favour of Ninja_Forms()->subs()->get( $args ) or Ninja_Forms()->form( 23 )->get_subs( $args )
|
100 |
-
* You can also use WordPress queries ,since this is a custom post type.
|
101 |
-
*
|
102 |
-
* @since 2.7
|
103 |
-
*/
|
104 |
-
|
105 |
-
function ninja_forms_get_subs( $args = array() ) {
|
106 |
-
|
107 |
-
$plugin_settings = nf_get_settings();
|
108 |
-
|
109 |
-
if ( isset ( $plugin_settings['date_format'] ) ) {
|
110 |
-
$date_format = $plugin_settings['date_format'];
|
111 |
-
} else {
|
112 |
-
$date_format = 'm/d/Y';
|
113 |
-
}
|
114 |
-
|
115 |
-
if( is_array( $args ) AND ! empty( $args ) ) {
|
116 |
-
|
117 |
-
$subs_results = array();
|
118 |
-
$meta_query = array();
|
119 |
-
$date_query = array();
|
120 |
-
|
121 |
-
if( isset( $args['form_id'] ) ) {
|
122 |
-
$meta_query[] = array(
|
123 |
-
'key' => '_form_id',
|
124 |
-
'value' => $args['form_id'],
|
125 |
-
);
|
126 |
-
}
|
127 |
-
|
128 |
-
if( isset( $args['action'])){
|
129 |
-
$meta_query[] = array(
|
130 |
-
'key' => '_action',
|
131 |
-
'value' => $args['action'],
|
132 |
-
);
|
133 |
-
}
|
134 |
-
|
135 |
-
$query_args = array(
|
136 |
-
'post_type' => 'nf_sub',
|
137 |
-
'date_query' => $date_query,
|
138 |
-
'meta_query' => $meta_query,
|
139 |
-
'posts_per_page' => -1,
|
140 |
-
);
|
141 |
-
|
142 |
-
if( isset( $args['user_id'] ) ) {
|
143 |
-
$query_args['author'] = $args['user_id'];
|
144 |
-
}
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
if( isset( $args['begin_date'] ) AND $args['begin_date'] != '') {
|
149 |
-
$query_args['date_query']['after'] = nf_get_begin_date( $args['begin_date'] )->format("Y-m-d G:i:s");
|
150 |
-
}
|
151 |
-
|
152 |
-
if( isset( $args['end_date'] ) AND $args['end_date'] != '' ) {
|
153 |
-
$query_args['date_query']['before'] = nf_get_end_date( $args['end_date'] )->format("Y-m-d G:i:s");
|
154 |
-
}
|
155 |
-
|
156 |
-
$subs = get_posts( $query_args );
|
157 |
-
|
158 |
-
if ( is_array( $subs ) && ! empty( $subs ) ) {
|
159 |
-
$x = 0;
|
160 |
-
foreach ( $subs as $sub ) {
|
161 |
-
$data = array();
|
162 |
-
$subs_results[$x]['id'] = $sub->ID;
|
163 |
-
$subs_results[$x]['user_id'] = $sub->post_author;
|
164 |
-
$subs_results[$x]['form_id'] = get_post_meta( $sub->ID, '_form_id' );
|
165 |
-
$subs_results[$x]['action'] = get_post_meta( $sub->ID, '_action' );
|
166 |
-
|
167 |
-
$meta = get_post_custom( $sub->ID );
|
168 |
-
|
169 |
-
foreach ( $meta as $key => $array ) {
|
170 |
-
if ( strpos( $key, '_field_' ) !== false ) {
|
171 |
-
$field_id = str_replace( '_field_', '', $key );
|
172 |
-
$user_value = $array[0];
|
173 |
-
$data[] = array( 'field_id' => $field_id, 'user_value' => $user_value );
|
174 |
-
}
|
175 |
-
}
|
176 |
-
|
177 |
-
$subs_results[$x]['data'] = $data;
|
178 |
-
$subs_results[$x]['date_updated'] = $sub->post_modified;
|
179 |
-
|
180 |
-
$x++;
|
181 |
-
}
|
182 |
-
}
|
183 |
-
|
184 |
-
return $subs_results;
|
185 |
-
}
|
186 |
-
}
|
187 |
-
|
188 |
-
/**
|
189 |
-
* ninja_forms_get_sub_count() has been deprecated in favour of Ninja_Forms()->form( 23 )->sub_count or nf_get_sub_count()
|
190 |
-
* Function that returns a count of the number of submissions.
|
191 |
-
*
|
192 |
-
* @since 2.7
|
193 |
-
*/
|
194 |
-
|
195 |
-
function ninja_forms_get_sub_count( $args = array() ) {
|
196 |
-
return count( ninja_forms_get_subs( $args ) );
|
197 |
-
}
|
198 |
-
|
199 |
-
/**
|
200 |
-
* ninja_forms_get_sub_by_id( $sub_id ) has been deprecated in favour of Ninja_Forms()->sub( 23 );
|
201 |
-
*
|
202 |
-
* @since 2.7
|
203 |
-
*/
|
204 |
-
|
205 |
-
function ninja_forms_get_sub_by_id( $sub_id ) {
|
206 |
-
$sub = Ninja_Forms()->sub( $sub_id );
|
207 |
-
if ( $sub ) {
|
208 |
-
$sub_row = array();
|
209 |
-
$data = array();
|
210 |
-
$sub_row['id'] = $sub_id;
|
211 |
-
$sub_row['user_id'] = $sub->user_id;
|
212 |
-
$sub_row['form_id'] = $sub->form_id;
|
213 |
-
$sub_row['action'] = $sub->action;
|
214 |
-
|
215 |
-
if ( $sub->action == 'submit' ) {
|
216 |
-
$sub_row['status'] = 1;
|
217 |
-
} else {
|
218 |
-
$sub_row['status'] = 0;
|
219 |
-
}
|
220 |
-
|
221 |
-
$meta = get_post_custom( $sub_id );
|
222 |
-
|
223 |
-
foreach ( $meta as $key => $array ) {
|
224 |
-
if ( strpos( $key, '_field_' ) !== false ) {
|
225 |
-
$field_id = str_replace( '_field_', '', $key );
|
226 |
-
$user_value = is_serialized( $array[0] ) ? unserialize( $array[0] ) : $array[0];
|
227 |
-
$data[] = array( 'field_id' => $field_id, 'user_value' => $user_value );
|
228 |
-
}
|
229 |
-
}
|
230 |
-
|
231 |
-
$sub_row['data'] = $data;
|
232 |
-
$sub_row['date_updated'] = $sub->date_submitted;
|
233 |
-
|
234 |
-
return $sub_row;
|
235 |
-
} else {
|
236 |
-
return false;
|
237 |
-
}
|
238 |
-
}
|
239 |
-
|
240 |
-
/**
|
241 |
-
* ninja_forms_get_all_subs() has been deprecated in favour of Ninja_Forms()->subs()->get();
|
242 |
-
*
|
243 |
-
* @since 2.7
|
244 |
-
*/
|
245 |
-
|
246 |
-
function ninja_forms_get_all_subs( $form_id = '' ){
|
247 |
-
if ( $form_id == '' )
|
248 |
-
return false;
|
249 |
-
|
250 |
-
$args = array( 'form_id' => $form_id );
|
251 |
-
return ninja_forms_get_subs( $args );
|
252 |
-
}
|
253 |
-
|
254 |
-
/**
|
255 |
-
* ninja_forms_insert_sub() has been deprecated in favour of Ninja_Forms()->subs()->create( $form_id );
|
256 |
-
* Because submissions are now a CPT, this function will only return false.
|
257 |
-
* Please replace any instances of this function with the replacement.
|
258 |
-
*
|
259 |
-
* @since 2.7
|
260 |
-
*/
|
261 |
-
|
262 |
-
function ninja_forms_insert_sub( $args ) {
|
263 |
-
|
264 |
-
if ( ! isset ( $args['form_id'] ) )
|
265 |
-
return false;
|
266 |
-
|
267 |
-
$form_id = $args['form_id'];
|
268 |
-
|
269 |
-
$sub_id = Ninja_Forms()->subs()->create( $form_id );
|
270 |
-
$args['sub_id'] = $sub_id;
|
271 |
-
|
272 |
-
ninja_forms_update_sub( $args );
|
273 |
-
|
274 |
-
return $sub_id;
|
275 |
-
}
|
276 |
-
|
277 |
-
/**
|
278 |
-
* ninja_forms_update_sub() has been deprecated in favour of Ninja_Forms()->sub( 23 )->update_field( id, value );
|
279 |
-
* Because submissions are now a CPT, this function will only return false.
|
280 |
-
* Please replace any instances of this function with the replacement.
|
281 |
-
*
|
282 |
-
* @since 2.7
|
283 |
-
*/
|
284 |
-
|
285 |
-
function ninja_forms_update_sub( $args ){
|
286 |
-
if ( ! isset ( $args['sub_id'] ) )
|
287 |
-
return false;
|
288 |
-
|
289 |
-
$sub_id = $args['sub_id'];
|
290 |
-
$sub = Ninja_Forms()->sub( $sub_id );
|
291 |
-
|
292 |
-
if ( isset ( $args['data'] ) ) {
|
293 |
-
$data = $args['data'];
|
294 |
-
unset ( $args['data'] );
|
295 |
-
|
296 |
-
if ( is_serialized( $data ) ) {
|
297 |
-
$data = unserialize( $data );
|
298 |
-
|
299 |
-
foreach ( $data as $d ) {
|
300 |
-
$field_id = $d['field_id'];
|
301 |
-
$user_value = $d['user_value'];
|
302 |
-
$sub->add_field( $field_id, $user_value );
|
303 |
-
}
|
304 |
-
}
|
305 |
-
}
|
306 |
-
|
307 |
-
foreach ( $args as $key => $value ) {
|
308 |
-
$sub->update_meta( '_' . $key, $value );
|
309 |
-
}
|
310 |
-
|
311 |
-
}
|
312 |
-
|
313 |
-
/**
|
314 |
-
* ninja_forms_export_subs_to_csv() has been deprecated in favour of Ninja_Forms()->subs()->export( sub_ids, return );
|
315 |
-
* or Ninja_Forms()->sub( 23 )->export( return );
|
316 |
-
* Please replace any instances of this function with the replacement.
|
317 |
-
*
|
318 |
-
* @since 2.7
|
319 |
-
*/
|
320 |
-
|
321 |
-
function ninja_forms_export_subs_to_csv( $sub_ids = '', $return = false ){
|
322 |
-
Ninja_Forms()->subs()->export( $sub_ids, $return );
|
323 |
-
}
|
324 |
-
|
325 |
-
function ninja_forms_implode_r($glue, $pieces){
|
326 |
-
$out = '';
|
327 |
-
foreach ( $pieces as $piece ) {
|
328 |
-
if ( is_array ( $piece ) ) {
|
329 |
-
if ( $out == '' ) {
|
330 |
-
$out = ninja_forms_implode_r($glue, $piece);
|
331 |
-
} else {
|
332 |
-
$out .= ninja_forms_implode_r($glue, $piece); // recurse
|
333 |
-
}
|
334 |
-
} else {
|
335 |
-
if ( $out == '' ) {
|
336 |
-
$out .= $piece;
|
337 |
-
} else {
|
338 |
-
$out .= $glue.$piece;
|
339 |
-
}
|
340 |
-
}
|
341 |
-
}
|
342 |
-
return $out;
|
343 |
-
}
|
344 |
-
|
345 |
-
|
346 |
-
/**
|
347 |
-
* Get the csv delimiter
|
348 |
-
*
|
349 |
-
* @return string
|
350 |
-
*/
|
351 |
-
function ninja_forms_get_csv_delimiter() {
|
352 |
-
return apply_filters( 'ninja_forms_csv_delimiter', ',' );
|
353 |
-
}
|
354 |
-
|
355 |
-
/**
|
356 |
-
* Get the csv enclosure
|
357 |
-
*
|
358 |
-
* @return string
|
359 |
-
*/
|
360 |
-
function ninja_forms_get_csv_enclosure() {
|
361 |
-
return apply_filters( 'ninja_forms_csv_enclosure', '"' );
|
362 |
-
}
|
363 |
-
|
364 |
-
/**
|
365 |
-
* Get the csv delimiter
|
366 |
-
*
|
367 |
-
* @return string
|
368 |
-
*/
|
369 |
-
function ninja_forms_get_csv_terminator() {
|
370 |
-
return apply_filters( 'ninja_forms_csv_terminator', "\n" );
|
371 |
-
}
|
372 |
-
|
373 |
-
/**
|
374 |
-
* Wrapper for nf_save_sub()
|
375 |
-
*/
|
376 |
-
function ninja_forms_save_sub() {
|
377 |
-
nf_save_sub();
|
378 |
-
}
|
379 |
-
|
380 |
-
function nf_change_all_forms_filter( $cap ) {
|
381 |
-
return apply_filters( 'ninja_forms_admin_menu_capabilities', $cap );
|
382 |
-
}
|
383 |
-
|
384 |
-
add_filter( 'ninja_forms_admin_all_forms_capabilities', 'nf_change_all_forms_filter' );
|
385 |
-
|
386 |
-
function nf_change_admin_menu_filter( $cap ) {
|
387 |
-
return apply_filters( 'ninja_forms_admin_menu_capabilities', $cap );
|
388 |
-
}
|
389 |
-
|
390 |
-
add_filter( 'ninja_forms_admin_parent_menu_capabilities', 'nf_change_admin_menu_filter' );
|
391 |
-
|
392 |
-
/**
|
393 |
-
* Deprecated as of version 2.8
|
394 |
-
*/
|
395 |
-
|
396 |
-
// The admin_mailto setting has been deprecated. Because users may have used this setting to modify who receives the admin email,
|
397 |
-
// we need to make sure that it is backwards compatible.
|
398 |
-
function nf_clear_admin_mailto() {
|
399 |
-
global $ninja_forms_processing;
|
400 |
-
|
401 |
-
$ninja_forms_processing->update_form_setting( 'admin_mailto', array() );
|
402 |
-
}
|
403 |
-
|
404 |
-
add_action( 'ninja_forms_before_pre_process', 'nf_clear_admin_mailto' );
|
405 |
-
|
406 |
-
function nf_modify_admin_mailto( $setting, $setting_name, $id ) {
|
407 |
-
global $ninja_forms_processing;
|
408 |
-
|
409 |
-
// Bail if this isn't our admin notification
|
410 |
-
if ( ! nf_get_object_meta_value( $id, 'admin_email' ) )
|
411 |
-
return $setting;
|
412 |
-
|
413 |
-
// Bail if this isn't the "to" setting.
|
414 |
-
if ( $setting_name != 'to' )
|
415 |
-
return $setting;
|
416 |
-
|
417 |
-
$admin_mailto = $ninja_forms_processing->get_form_setting( 'admin_mailto' );
|
418 |
-
$ninja_forms_processing->update_form_setting( 'admin_mailto', '' );
|
419 |
-
|
420 |
-
if ( is_array( $admin_mailto ) && ! empty ( $admin_mailto ) ) {
|
421 |
-
$setting = array_merge( $setting, $admin_mailto );
|
422 |
-
}
|
423 |
-
|
424 |
-
return $setting;
|
425 |
-
}
|
426 |
-
|
427 |
-
add_filter( 'nf_email_notification_process_setting','nf_modify_admin_mailto', 10, 3 );
|
428 |
-
|
429 |
-
add_action('init', 'ninja_forms_register_filter_email_add_fields', 15 );
|
430 |
-
function ninja_forms_register_filter_email_add_fields(){
|
431 |
-
global $ninja_forms_processing;
|
432 |
-
|
433 |
-
if( is_object( $ninja_forms_processing ) ){
|
434 |
-
if( $ninja_forms_processing->get_form_setting( 'user_email_fields' ) == 1 ){
|
435 |
-
add_filter( 'ninja_forms_user_email', 'ninja_forms_filter_email_add_fields' );
|
436 |
-
}
|
437 |
-
}
|
438 |
-
|
439 |
-
if( is_object( $ninja_forms_processing ) ){
|
440 |
-
if( $ninja_forms_processing->get_form_setting( 'admin_email_fields' ) == 1 ){
|
441 |
-
add_filter( 'ninja_forms_admin_email', 'ninja_forms_filter_email_add_fields' );
|
442 |
-
}
|
443 |
-
}
|
444 |
-
}
|
445 |
-
|
446 |
-
function ninja_forms_filter_email_add_fields( $message ){
|
447 |
-
global $ninja_forms_processing, $ninja_forms_fields;
|
448 |
-
|
449 |
-
$form_id = $ninja_forms_processing->get_form_ID();
|
450 |
-
$all_fields = ninja_forms_get_fields_by_form_id( $form_id );
|
451 |
-
//$all_fields = $ninja_forms_processing->get_all_fields();
|
452 |
-
$tmp_array = array();
|
453 |
-
if( is_array( $all_fields ) ){
|
454 |
-
foreach( $all_fields as $field ){
|
455 |
-
if( $ninja_forms_processing->get_field_value( $field['id'] ) ){
|
456 |
-
$tmp_array[$field['id']] = $ninja_forms_processing->get_field_value( $field['id'] );
|
457 |
-
}
|
458 |
-
}
|
459 |
-
}
|
460 |
-
$all_fields = apply_filters( 'ninja_forms_email_all_fields_array', $tmp_array, $form_id );
|
461 |
-
|
462 |
-
$email_type = $ninja_forms_processing->get_form_setting( 'email_type' );
|
463 |
-
if(is_array($all_fields) AND !empty($all_fields)){
|
464 |
-
if($email_type == 'html'){
|
465 |
-
$message .= "<br><br>";
|
466 |
-
$message .= apply_filters( 'nf_email_user_values_title', __( 'User Submitted Values:', 'ninja-forms' ) );
|
467 |
-
$message .= "<table>";
|
468 |
-
}else{
|
469 |
-
$message = str_replace("<p>", "\r\n", $message);
|
470 |
-
$message = str_replace("</p>", "", $message);
|
471 |
-
$message = str_replace("<br>", "\r\n", $message);
|
472 |
-
$message = str_replace("<br />", "\r\n", $message);
|
473 |
-
$message = strip_tags($message);
|
474 |
-
$message .= "\r\n \r\n";
|
475 |
-
$message .= apply_filters( 'nf_email_user_values_title', __( 'User Submitted Values:', 'ninja-forms' ) );
|
476 |
-
$message .= "\r\n";
|
477 |
-
}
|
478 |
-
foreach( $all_fields as $field_id => $user_value ){
|
479 |
-
|
480 |
-
$field_row = $ninja_forms_processing->get_field_settings( $field_id );
|
481 |
-
$field_label = $field_row['data']['label'];
|
482 |
-
$field_label = apply_filters( 'ninja_forms_email_field_label', $field_label, $field_id );
|
483 |
-
$user_value = apply_filters( 'ninja_forms_email_user_value', $user_value, $field_id );
|
484 |
-
$field_type = $field_row['type'];
|
485 |
-
|
486 |
-
if( $ninja_forms_fields[$field_type]['process_field'] ){
|
487 |
-
if( is_array( $user_value ) AND !empty( $user_value ) ){
|
488 |
-
$x = 0;
|
489 |
-
foreach($user_value as $val){
|
490 |
-
if(!is_array($val)){
|
491 |
-
if($x > 0){
|
492 |
-
$field_label = '----';
|
493 |
-
$field_label = apply_filters( 'ninja_forms_email_field_label', $field_label, $field_id );
|
494 |
-
}
|
495 |
-
if($email_type == 'html'){
|
496 |
-
$message .= "<tr><td width='50%'>".$field_label.":</td><td width='50%'>".$val."</td></tr>";
|
497 |
-
}else{
|
498 |
-
$message .= $field_label." - ".$val."\r\n";
|
499 |
-
}
|
500 |
-
}else{
|
501 |
-
foreach($val as $v){
|
502 |
-
if(!is_array($v)){
|
503 |
-
if($x > 0){
|
504 |
-
$field_label = '----';
|
505 |
-
$field_label = apply_filters( 'ninja_forms_email_field_label', $field_label, $field_id );
|
506 |
-
}
|
507 |
-
if($email_type == 'html'){
|
508 |
-
$message .= "<tr><td width='50%'>".$field_label.":</td><td width='50%'>".$v."</td></tr>";
|
509 |
-
}else{
|
510 |
-
$message .= $field_label." - ".$v."\r\n";
|
511 |
-
}
|
512 |
-
}else{
|
513 |
-
foreach($v as $a){
|
514 |
-
if($x > 0){
|
515 |
-
$field_label = '----';
|
516 |
-
$field_label = apply_filters( 'ninja_forms_email_field_label', $field_label, $field_id );
|
517 |
-
}
|
518 |
-
if($email_type == 'html'){
|
519 |
-
$message .= "<tr><td width='50%'>".$field_label.":</td><td width='50%'>".$a."</td></tr>";
|
520 |
-
}else{
|
521 |
-
$message .= $field_label." - ".$a."\r\n";
|
522 |
-
}
|
523 |
-
}
|
524 |
-
}
|
525 |
-
}
|
526 |
-
}
|
527 |
-
$x++;
|
528 |
-
}
|
529 |
-
}else{
|
530 |
-
if($email_type == 'html'){
|
531 |
-
$message .= "<tr><td width='50%'>".$field_label.":</td><td width='50%'>".$user_value."</td></tr>";
|
532 |
-
}else{
|
533 |
-
$message .= $field_label." - ".$user_value."\r\n";
|
534 |
-
}
|
535 |
-
}
|
536 |
-
|
537 |
-
}
|
538 |
-
}
|
539 |
-
if($email_type == 'html'){
|
540 |
-
$message .= "</table>";
|
541 |
-
}
|
542 |
-
}
|
543 |
-
$message = apply_filters( 'ninja_forms_email_field_list', $message, $form_id );
|
544 |
-
|
545 |
-
return $message;
|
546 |
-
}
|
547 |
-
|
548 |
-
add_action( 'init', 'ninja_forms_register_email_admin' );
|
549 |
-
function ninja_forms_register_email_admin() {
|
550 |
-
add_action( 'ninja_forms_post_process', 'ninja_forms_email_admin', 1000 );
|
551 |
-
}
|
552 |
-
|
553 |
-
function ninja_forms_email_admin() {
|
554 |
-
global $ninja_forms_processing;
|
555 |
-
|
556 |
-
do_action( 'ninja_forms_email_admin' );
|
557 |
-
|
558 |
-
$form_ID = $ninja_forms_processing->get_form_ID();
|
559 |
-
$form_title = $ninja_forms_processing->get_form_setting( 'form_title' );
|
560 |
-
$admin_mailto = $ninja_forms_processing->get_form_setting( 'admin_mailto' );
|
561 |
-
$email_from_name = $ninja_forms_processing->get_form_setting( 'email_from_name' );
|
562 |
-
$email_from = $ninja_forms_processing->get_form_setting( 'email_from' );
|
563 |
-
$email_type = $ninja_forms_processing->get_form_setting( 'email_type' );
|
564 |
-
$subject = $ninja_forms_processing->get_form_setting( 'admin_subject' );
|
565 |
-
$message = $ninja_forms_processing->get_form_setting( 'admin_email_msg' );
|
566 |
-
$email_reply = $ninja_forms_processing->get_form_setting( 'admin_email_replyto' );
|
567 |
-
|
568 |
-
if ( $ninja_forms_processing->get_form_setting( 'admin_email_name' ) ){
|
569 |
-
$email_from_name = $ninja_forms_processing->get_form_setting( 'admin_email_name' );
|
570 |
-
}
|
571 |
-
|
572 |
-
if ( $email_from_name AND $email_reply ) {
|
573 |
-
$email_reply = $email_from_name . ' <' . $email_reply . '>';
|
574 |
-
}
|
575 |
-
|
576 |
-
if ( !$subject ){
|
577 |
-
$subject = $form_title;
|
578 |
-
}
|
579 |
-
if ( !$message ){
|
580 |
-
$message = '';
|
581 |
-
}
|
582 |
-
if ( !$email_type ){
|
583 |
-
$email_type = '';
|
584 |
-
}
|
585 |
-
|
586 |
-
if ( $email_type !== 'plain' ){
|
587 |
-
$message = apply_filters( 'ninja_forms_admin_email_message_wpautop', wpautop( $message ) );
|
588 |
-
}
|
589 |
-
|
590 |
-
$email_from = $email_from_name.' <'.$email_from.'>';
|
591 |
-
|
592 |
-
$email_from = apply_filters( 'ninja_forms_admin_email_from', $email_from, $email_reply, $form_ID );
|
593 |
-
|
594 |
-
$headers = array();
|
595 |
-
$headers[] = 'From: ' . $email_from;
|
596 |
-
if( $email_reply ) {
|
597 |
-
$headers[] = 'Reply-To: ' . $email_reply;
|
598 |
-
}
|
599 |
-
$headers[] = 'Content-Type: text/' . $email_type;
|
600 |
-
$headers[] = 'charset=utf-8';
|
601 |
-
|
602 |
-
$attachments = false;
|
603 |
-
if ($ninja_forms_processing->get_form_setting( 'admin_attachments' ) ) {
|
604 |
-
$attachments = $ninja_forms_processing->get_form_setting( 'admin_attachments' );
|
605 |
-
}
|
606 |
-
|
607 |
-
if ( is_array( $admin_mailto ) AND !empty( $admin_mailto ) ){
|
608 |
-
foreach( $admin_mailto as $to ) {
|
609 |
-
if ( $attachments ) {
|
610 |
-
wp_mail( $to, $subject, $message, $headers, $attachments );
|
611 |
-
} else {
|
612 |
-
wp_mail( $to, $subject, $message, $headers );
|
613 |
-
}
|
614 |
-
}
|
615 |
-
}
|
616 |
-
|
617 |
-
// Delete our admin CSV if one is present.
|
618 |
-
if ( file_exists( $ninja_forms_processing->get_extra_value( '_attachment_csv_path' ) ) ) {
|
619 |
-
unlink ( $ninja_forms_processing->get_extra_value( '_attachment_csv_path' ) );
|
620 |
-
}
|
621 |
-
}
|
622 |
-
|
623 |
-
add_action('init', 'ninja_forms_register_email_user');
|
624 |
-
function ninja_forms_register_email_user(){
|
625 |
-
add_action( 'ninja_forms_post_process', 'ninja_forms_email_user', 1000 );
|
626 |
-
}
|
627 |
-
|
628 |
-
function ninja_forms_email_user(){
|
629 |
-
global $ninja_forms_processing;
|
630 |
-
|
631 |
-
do_action( 'ninja_forms_email_user' );
|
632 |
-
|
633 |
-
$form_ID = $ninja_forms_processing->get_form_ID();
|
634 |
-
$form_title = $ninja_forms_processing->get_form_setting('form_title');
|
635 |
-
$user_mailto = array();
|
636 |
-
$all_fields = $ninja_forms_processing->get_all_fields();
|
637 |
-
if(is_array($all_fields) AND !empty($all_fields)){
|
638 |
-
foreach($all_fields as $field_id => $user_value){
|
639 |
-
$field_row = $ninja_forms_processing->get_field_settings( $field_id );
|
640 |
-
|
641 |
-
if(isset($field_row['data']['send_email'])){
|
642 |
-
$send_email = $field_row['data']['send_email'];
|
643 |
-
}else{
|
644 |
-
$send_email = 0;
|
645 |
-
}
|
646 |
-
|
647 |
-
if($send_email){
|
648 |
-
array_push($user_mailto, $user_value);
|
649 |
-
}
|
650 |
-
}
|
651 |
-
}
|
652 |
-
|
653 |
-
$email_from = $ninja_forms_processing->get_form_setting('email_from');
|
654 |
-
$email_from_name = $ninja_forms_processing->get_form_setting( 'email_from_name' );
|
655 |
-
$email_type = $ninja_forms_processing->get_form_setting('email_type');
|
656 |
-
$subject = $ninja_forms_processing->get_form_setting('user_subject');
|
657 |
-
$message = $ninja_forms_processing->get_form_setting('user_email_msg');
|
658 |
-
$default_email = get_option( 'admin_email' );
|
659 |
-
|
660 |
-
if(!$subject){
|
661 |
-
$subject = $form_title;
|
662 |
-
}
|
663 |
-
if(!$message){
|
664 |
-
$message = __('Thank you for filling out this form.', 'ninja-forms');
|
665 |
-
}
|
666 |
-
if(!$email_from){
|
667 |
-
$email_from = $default_email;
|
668 |
-
}
|
669 |
-
if(!$email_type){
|
670 |
-
$email_type = '';
|
671 |
-
}
|
672 |
-
|
673 |
-
if( $email_type !== 'plain' ){
|
674 |
-
$message = apply_filters( 'ninja_forms_user_email_message_wpautop', wpautop( $message ) );
|
675 |
-
}
|
676 |
-
|
677 |
-
$email_from = $email_from_name.' <'.$email_from.'>';
|
678 |
-
|
679 |
-
$email_from = htmlspecialchars_decode($email_from);
|
680 |
-
$email_from = htmlspecialchars_decode($email_from);
|
681 |
-
|
682 |
-
$headers = array();
|
683 |
-
$headers[] = 'From: '.$email_from;
|
684 |
-
$headers[] = 'Content-Type: text/'.$email_type;
|
685 |
-
$headers[] = 'charset=utf-8';
|
686 |
-
|
687 |
-
$attachments = false;
|
688 |
-
if ( $ninja_forms_processing->get_form_setting( 'user_attachments' ) ) {
|
689 |
-
$attachments = $ninja_forms_processing->get_form_setting('user_attachments');
|
690 |
-
}
|
691 |
-
|
692 |
-
if ( is_array( $user_mailto ) AND ! empty( $user_mailto ) ) {
|
693 |
-
// check to make sure there's an attachment before attaching one
|
694 |
-
if ( $attachments ) {
|
695 |
-
wp_mail( $user_mailto, $subject, $message, $headers, $attachments );
|
696 |
-
} else {
|
697 |
-
wp_mail( $user_mailto, $subject, $message, $headers );
|
698 |
-
}
|
699 |
-
|
700 |
-
}
|
701 |
-
}
|
702 |
-
|
703 |
-
add_action( 'nf_save_sub', 'nf_csv_attachment' );
|
704 |
-
|
705 |
-
function nf_csv_attachment( $sub_id ){
|
706 |
-
global $ninja_forms_processing;
|
707 |
-
|
708 |
-
// make sure this form is supposed to attach a CSV
|
709 |
-
if( 1 == $ninja_forms_processing->get_form_setting( 'admin_attach_csv' ) AND 'submit' == $ninja_forms_processing->get_action() ) {
|
710 |
-
|
711 |
-
// create CSV content
|
712 |
-
$csv_content = Ninja_Forms()->sub( $sub_id )->export( true );
|
713 |
-
|
714 |
-
$upload_dir = wp_upload_dir();
|
715 |
-
$path = trailingslashit( $upload_dir['path'] );
|
716 |
-
|
717 |
-
// create temporary file
|
718 |
-
$path = tempnam( $path, 'Sub' );
|
719 |
-
$temp_file = fopen( $path, 'r+' );
|
720 |
-
|
721 |
-
// write to temp file
|
722 |
-
fwrite( $temp_file, $csv_content );
|
723 |
-
fclose( $temp_file );
|
724 |
-
|
725 |
-
// find the directory we will be using for the final file
|
726 |
-
$path = pathinfo( $path );
|
727 |
-
$dir = $path['dirname'];
|
728 |
-
$basename = $path['basename'];
|
729 |
-
|
730 |
-
// create name for file
|
731 |
-
$new_name = apply_filters( 'ninja_forms_submission_csv_name', 'ninja-forms-submission' );
|
732 |
-
|
733 |
-
// remove a file if it already exists
|
734 |
-
if( file_exists( $dir.'/'.$new_name.'.csv' ) ) {
|
735 |
-
unlink( $dir.'/'.$new_name.'.csv' );
|
736 |
-
}
|
737 |
-
|
738 |
-
// move file
|
739 |
-
rename( $dir.'/'.$basename, $dir.'/'.$new_name.'.csv' );
|
740 |
-
$file1 = $dir.'/'.$new_name.'.csv';
|
741 |
-
|
742 |
-
// add new file to array of existing files
|
743 |
-
$files = $ninja_forms_processing->get_form_setting( 'admin_attachments' );
|
744 |
-
array_push( $files, $file1 );
|
745 |
-
$ninja_forms_processing->update_form_setting( 'admin_attachments', $files );
|
746 |
-
$ninja_forms_processing->update_extra_value( '_attachment_csv_path', $file1 );
|
747 |
-
}
|
748 |
-
}
|
749 |
-
|
750 |
-
// Move any attachments that exist for our "admin" and "user" emails.
|
751 |
-
function nf_modify_attachments( $files, $n_id ) {
|
752 |
-
global $ninja_forms_processing;
|
753 |
-
|
754 |
-
if ( Ninja_Forms()->notification( $n_id )->get_setting( 'admin_email' ) ) {
|
755 |
-
if ( is_array( $ninja_forms_processing->get_form_setting( 'admin_attachments' ) ) ) {
|
756 |
-
$files = array_merge( $files, $ninja_forms_processing->get_form_setting( 'admin_attachments' ) );
|
757 |
-
}
|
758 |
-
} else if ( Ninja_Forms()->notification( $n_id )->get_setting( 'user_email' ) ) {
|
759 |
-
if ( is_array( $ninja_forms_processing->get_form_setting( 'user_attachments' ) ) ) {
|
760 |
-
$files = array_merge( $files, $ninja_forms_processing->get_form_setting( 'user_attachments' ) );
|
761 |
-
}
|
762 |
-
}
|
763 |
-
|
764 |
-
$ninja_forms_processing->update_form_setting( 'admin_attachments', '' );
|
765 |
-
|
766 |
-
return $files;
|
767 |
-
}
|
768 |
-
|
769 |
-
add_filter( 'nf_email_notification_attachments', 'nf_modify_attachments', 10, 2 );
|
770 |
-
|
771 |
-
// Deprecate old "add all fields" filters
|
772 |
-
function nf_deprecate_all_fields_email_field_label( $value, $field_id ) {
|
773 |
-
return apply_filters( 'ninja_forms_email_field_label', $value, $field_id );
|
774 |
-
}
|
775 |
-
|
776 |
-
add_filter( 'nf_all_fields_field_label', 'nf_deprecate_all_fields_email_field_label', 10, 2 );
|
777 |
-
|
778 |
-
function nf_deprecate_all_fields_email_field_value( $value, $field_id ) {
|
779 |
-
return apply_filters( 'ninja_forms_email_user_value', $value, $field_id );
|
780 |
-
}
|
781 |
-
|
782 |
-
add_filter( 'nf_all_fields_field_value', 'nf_deprecate_all_fields_email_field_value', 10, 2 );
|
783 |
-
|
784 |
-
function nf_deprecate_all_fields_email_table( $value, $form_id ) {
|
785 |
-
return apply_filters( 'ninja_forms_email_field_list', $value, $form_id );
|
786 |
-
}
|
787 |
-
|
788 |
-
add_filter( 'nf_all_fields_table', 'nf_deprecate_all_fields_email_table', 10, 2 );
|
789 |
-
|
790 |
-
// Deprecate our old success message filter
|
791 |
-
function nf_deprecate_success_message_filter( $message, $n_id ) {
|
792 |
-
return apply_filters( 'ninja_forms_success_msg', $message );
|
793 |
-
}
|
794 |
-
|
795 |
-
add_filter( 'nf_success_msg', 'nf_deprecate_success_message_filter', 10, 2 );
|
796 |
-
|
797 |
-
// Remove any references to "admin email" from our imported forms.
|
798 |
-
function nf_deprecate_form_import( $form ) {
|
799 |
-
if ( isset ( $form['data']['admin_mailto'] ) )
|
800 |
-
unset( $form['data']['admin_mailto'] );
|
801 |
-
|
802 |
-
if ( isset ( $form['data']['admin_email'] ) )
|
803 |
-
unset( $form['data']['admin_email'] );
|
804 |
-
|
805 |
-
if ( isset ( $form['data']['admin_subject'] ) )
|
806 |
-
unset( $form['data']['admin_subject'] );
|
807 |
-
|
808 |
-
if ( isset ( $form['data']['user_mailto'] ) )
|
809 |
-
unset( $form['data']['user_mailto'] );
|
810 |
-
|
811 |
-
if ( isset ( $form['data']['user_email'] ) )
|
812 |
-
unset( $form['data']['user_email'] );
|
813 |
-
|
814 |
-
if ( isset ( $form['data']['user_subject'] ) )
|
815 |
-
unset ( $form['data']['user_subject'] );
|
816 |
-
|
817 |
-
if ( isset ( $form['data']['landing_page'] ) )
|
818 |
-
unset ( $form['data']['landing_page'] );
|
819 |
-
|
820 |
-
return $form;
|
821 |
-
}
|
822 |
-
|
823 |
-
add_filter( 'ninja_forms_before_import_form', 'nf_deprecate_form_import' );
|
824 |
-
|
825 |
-
// Remove any references to "user email" from our imported forms.
|
826 |
-
function nf_deprecate_field_import( $data ) {
|
827 |
-
if ( isset ( $data['send_email'] ) )
|
828 |
-
unset ( $data['send_email'] );
|
829 |
-
|
830 |
-
if ( isset ( $data['from_email'] ) )
|
831 |
-
unset ( $data['from_email'] );
|
832 |
-
|
833 |
-
if ( isset ( $data['replyto_email'] ) )
|
834 |
-
unset ( $data['replyto_email'] );
|
835 |
-
|
836 |
-
return $data;
|
837 |
-
}
|
838 |
-
|
839 |
-
add_filter( 'nf_before_import_field', 'nf_deprecate_field_import' );
|
840 |
-
|
841 |
-
|
842 |
-
/**
|
843 |
-
* Deprecated as of version 2.9
|
844 |
-
*
|
845 |
-
*/
|
846 |
-
|
847 |
-
|
848 |
-
/**
|
849 |
-
* Get an array of form settings by form ID
|
850 |
-
*
|
851 |
-
* @since 2.7
|
852 |
-
* @param int $form_id
|
853 |
-
* @return array $form['data']
|
854 |
-
*/
|
855 |
-
function nf_get_form_settings( $form_id ) {
|
856 |
-
return nf_get_object_meta( $form_id );
|
857 |
-
}
|
858 |
-
|
859 |
-
/**
|
860 |
-
* Return form data
|
861 |
-
*
|
862 |
-
* @since 1.0
|
863 |
-
* @param int $form_id
|
864 |
-
* @return array $form
|
865 |
-
*/
|
866 |
-
function ninja_forms_get_form_by_id( $form_id ) {
|
867 |
-
$settings = Ninja_Forms()->form( $form_id )->get_all_settings();
|
868 |
-
$date_updated = Ninja_Forms()->form( $form_id )->get_setting( 'date_updated' );
|
869 |
-
return array( 'id' => $form_id, 'data' => $settings, 'date_updated' => $date_updated );
|
870 |
-
}
|
871 |
-
|
872 |
-
/**
|
873 |
-
* Get a form by field id
|
874 |
-
*
|
875 |
-
* @since 1.0
|
876 |
-
* @param int $field_id
|
877 |
-
* @param array $form
|
878 |
-
*/
|
879 |
-
function ninja_forms_get_form_by_field_id( $field_id ){
|
880 |
-
global $wpdb;
|
881 |
-
$form_id = $wpdb->get_row($wpdb->prepare("SELECT form_id FROM ".NINJA_FORMS_FIELDS_TABLE_NAME." WHERE id = %d", $field_id), ARRAY_A);
|
882 |
-
$form_id = $form_id['form_id'];
|
883 |
-
$form = ninja_forms_get_form_by_id( $form_id );
|
884 |
-
return $form;
|
885 |
-
}
|
886 |
-
|
887 |
-
/**
|
888 |
-
* Delete a form
|
889 |
-
*
|
890 |
-
* @since 1.0
|
891 |
-
*/
|
892 |
-
function ninja_forms_delete_form( $form_id = '' ){
|
893 |
-
global $wpdb;
|
894 |
-
|
895 |
-
// Bail if we aren't in the admin
|
896 |
-
if ( ! is_admin() )
|
897 |
-
return false;
|
898 |
-
|
899 |
-
// Bail if we don't have proper permissions
|
900 |
-
if ( ! current_user_can( apply_filters( 'nf_delete_form_capabilities', 'manage_options' ) ) )
|
901 |
-
return false;
|
902 |
-
|
903 |
-
if( $form_id == '' ){
|
904 |
-
$ajax = true;
|
905 |
-
$form_id = absint( $_REQUEST['form_id'] );
|
906 |
-
check_ajax_referer( 'nf_ajax', 'nf_ajax_nonce' );
|
907 |
-
}else{
|
908 |
-
$ajax = false;
|
909 |
-
}
|
910 |
-
|
911 |
-
Ninja_Forms()->form( $form_id )->delete();
|
912 |
-
|
913 |
-
if( $ajax ){
|
914 |
-
die();
|
915 |
-
}
|
916 |
-
}
|
917 |
-
|
918 |
-
add_action('wp_ajax_ninja_forms_delete_form', 'ninja_forms_delete_form');
|
919 |
-
|
920 |
-
function ninja_forms_get_all_forms( $debug = false ){
|
921 |
-
$forms = Ninja_Forms()->forms()->get_all();
|
922 |
-
|
923 |
-
$tmp_array = array();
|
924 |
-
$x = 0;
|
925 |
-
foreach ( $forms as $form_id ) {
|
926 |
-
$tmp_array[ $x ]['id'] = $form_id;
|
927 |
-
$tmp_array[ $x ]['data'] = Ninja_Forms()->form( $form_id )->get_all_settings();
|
928 |
-
$tmp_array[ $x ]['name'] = Ninja_Forms()->form( $form_id )->get_setting( 'form_title' );
|
929 |
-
$x++;
|
930 |
-
}
|
931 |
-
|
932 |
-
return $tmp_array;
|
933 |
-
}
|
934 |
-
|
935 |
-
/**
|
936 |
-
* Return our form count
|
937 |
-
*
|
938 |
-
* @since 2.8
|
939 |
-
* @return int $count
|
940 |
-
*/
|
941 |
-
|
942 |
-
function nf_get_form_count() {
|
943 |
-
global $wpdb;
|
944 |
-
|
945 |
-
$forms = Ninja_Forms()->forms()->get_all();
|
946 |
-
return count( $forms );
|
947 |
-
}
|
948 |
-
|
949 |
-
/**
|
950 |
-
* Old update form function.
|
951 |
-
*
|
952 |
-
* @since 1.0
|
953 |
-
* @return void
|
954 |
-
*/
|
955 |
-
function ninja_forms_update_form( $args ){
|
956 |
-
// Get our form id
|
957 |
-
$form_id = $args['where']['id'];
|
958 |
-
$update_array = $args['update_array'];
|
959 |
-
if ( isset ( $update_array['data'] ) ) {
|
960 |
-
$data = maybe_unserialize( $update_array['data'] );
|
961 |
-
if ( is_array( $data ) ) {
|
962 |
-
foreach ( $data as $key => $val ) {
|
963 |
-
Ninja_Forms()->form( $form_id )->update_setting( $key, $val );
|
964 |
-
}
|
965 |
-
}
|
966 |
-
unset( $update_array['data'] );
|
967 |
-
}
|
968 |
-
|
969 |
-
foreach ( $update_array as $key => $val ) {
|
970 |
-
Ninja_Forms()->form( $form_id )->update_setting( $key, $val );
|
971 |
-
}
|
972 |
-
|
973 |
-
Ninja_Forms()->form( $form_id )->dump_cache();
|
974 |
-
|
975 |
-
}
|
976 |
-
|
977 |
-
// Add our old form fields
|
978 |
-
require_once( NINJA_FORMS_DIR . "/includes/fields/honeypot.php" );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/display/fields/calc-field-class.php
DELETED
@@ -1,106 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
|
3 |
-
/*
|
4 |
-
*
|
5 |
-
* Function that adds a calc filter class to the field if appropriate.
|
6 |
-
*
|
7 |
-
* @since 2.4
|
8 |
-
* @return void
|
9 |
-
*/
|
10 |
-
|
11 |
-
function ninja_forms_calc_listen_field_class( $form_id ) {
|
12 |
-
global $ninja_forms_loading, $ninja_forms_processing;
|
13 |
-
|
14 |
-
$field_results = ninja_forms_get_fields_by_form_id( $form_id );
|
15 |
-
|
16 |
-
foreach( $field_results as $field_row ) {
|
17 |
-
|
18 |
-
$field_id = $field_row['id'];
|
19 |
-
|
20 |
-
if ( isset ( $field_row['type'] ) ) {
|
21 |
-
$field_type = $field_row['type'];
|
22 |
-
} else {
|
23 |
-
$field_type = '';
|
24 |
-
}
|
25 |
-
|
26 |
-
$field_data = $field_row['data'];
|
27 |
-
$field_data = apply_filters( 'ninja_forms_field', $field_data, $field_id );
|
28 |
-
$calc_listen = '';
|
29 |
-
|
30 |
-
$sub_total = false;
|
31 |
-
$tax = false;
|
32 |
-
foreach ( $field_results as $field ) {
|
33 |
-
|
34 |
-
$data = $field['data'];
|
35 |
-
|
36 |
-
if ( isset ( $field['type'] ) ) {
|
37 |
-
$field_type = $field['type'];
|
38 |
-
} else {
|
39 |
-
$field_type = '';
|
40 |
-
}
|
41 |
-
|
42 |
-
// Check for advanced calculation fields that reference this field. If we find one, and use_calc_adv is set to 1, add a special class to this field.
|
43 |
-
if ( $field_type == '_calc' ) {
|
44 |
-
|
45 |
-
// Check to see if this is a sub_total calculation
|
46 |
-
if ( isset ( $data['calc_method'] ) ) {
|
47 |
-
$calc_method = $data['calc_method'];
|
48 |
-
} else {
|
49 |
-
$calc_method = 'auto';
|
50 |
-
}
|
51 |
-
|
52 |
-
switch ( $calc_method ) {
|
53 |
-
case 'auto':
|
54 |
-
if ( isset ( $field_data['calc_auto_include'] ) AND $field_data['calc_auto_include'] == 1 ) {
|
55 |
-
$calc_listen = 'ninja-forms-field-calc-listen ninja-forms-field-calc-auto';
|
56 |
-
}
|
57 |
-
break;
|
58 |
-
case 'fields':
|
59 |
-
foreach ( $data['calc'] as $calc ) {
|
60 |
-
if ( $calc['field'] == $field_id ) {
|
61 |
-
if ( $calc_listen == '' ) {
|
62 |
-
$calc_listen = 'ninja-forms-field-calc-listen';
|
63 |
-
}
|
64 |
-
break;
|
65 |
-
}
|
66 |
-
}
|
67 |
-
break;
|
68 |
-
case 'eq':
|
69 |
-
$eq = $data['calc_eq'];
|
70 |
-
if (preg_match("/\bfield_".$field_id."\b/i", $eq ) ) {
|
71 |
-
if ( $calc_listen == '' ) {
|
72 |
-
$calc_listen = 'ninja-forms-field-calc-listen';
|
73 |
-
}
|
74 |
-
break;
|
75 |
-
}
|
76 |
-
break;
|
77 |
-
}
|
78 |
-
}
|
79 |
-
}
|
80 |
-
|
81 |
-
if ( isset ( $field_data['payment_sub_total'] ) AND $field_data['payment_sub_total'] == 1 ) {
|
82 |
-
if ( $calc_listen == '' ) {
|
83 |
-
$calc_listen = 'ninja-forms-field-calc-listen';
|
84 |
-
}
|
85 |
-
}
|
86 |
-
|
87 |
-
// Check to see if this is a tax field;
|
88 |
-
if ( $field_type == '_tax' ) {
|
89 |
-
if ( $calc_listen == '' ) {
|
90 |
-
$calc_listen = 'ninja-forms-field-calc-listen';
|
91 |
-
}
|
92 |
-
}
|
93 |
-
|
94 |
-
if ( isset ( $ninja_forms_loading ) ){
|
95 |
-
$field_class = $ninja_forms_loading->get_field_setting( $field_id, 'field_class' );
|
96 |
-
$field_class .= ' '.$calc_listen;
|
97 |
-
$ninja_forms_loading->update_field_setting( $field_id, 'field_class', $field_class );
|
98 |
-
} else {
|
99 |
-
$field_class = $ninja_forms_processing->get_field_setting( $field_id, 'field_class' );
|
100 |
-
$field_class .= ' '.$calc_listen;
|
101 |
-
$ninja_forms_processing->update_field_setting( $field_id, 'field_class', $field_class );
|
102 |
-
}
|
103 |
-
}
|
104 |
-
}
|
105 |
-
|
106 |
-
add_action( 'ninja_forms_display_init', 'ninja_forms_calc_listen_field_class' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/display/fields/clear-complete.php
DELETED
@@ -1,88 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Function that resets the field values to default if the form has been submitted.
|
5 |
-
*
|
6 |
-
* @since 2.5
|
7 |
-
* @return void
|
8 |
-
*/
|
9 |
-
|
10 |
-
function nf_clear_complete( $form_id ) {
|
11 |
-
global $ninja_forms_processing, $current_user, $post;
|
12 |
-
|
13 |
-
if ( ! isset ( $ninja_forms_processing ) or $ninja_forms_processing->get_form_setting( 'clear_complete' ) == 0 or $ninja_forms_processing->get_form_setting( 'processing_complete' ) != 1 )
|
14 |
-
return false;
|
15 |
-
|
16 |
-
$all_fields = $ninja_forms_processing->get_all_fields();
|
17 |
-
foreach ( $all_fields as $field_id => $user_value ) {
|
18 |
-
$default_value = $ninja_forms_processing->get_field_setting( $field_id, 'default_value' );
|
19 |
-
|
20 |
-
wp_get_current_user();
|
21 |
-
$user_ID = $current_user->ID;
|
22 |
-
if ( $user_ID and !empty( $user_ID ) ) {
|
23 |
-
$user_firstname = $current_user->user_firstname;
|
24 |
-
$user_lastname = $current_user->user_lastname;
|
25 |
-
$user_display_name = $current_user->display_name;
|
26 |
-
$user_email = $current_user->user_email;
|
27 |
-
} else {
|
28 |
-
$user_ID = '';
|
29 |
-
$user_firstname = '';
|
30 |
-
$user_lastname = '';
|
31 |
-
$user_display_name = '';
|
32 |
-
$user_email = '';
|
33 |
-
}
|
34 |
-
|
35 |
-
|
36 |
-
if ( is_object ( $post ) ) {
|
37 |
-
$post_ID = $post->ID;
|
38 |
-
$post_title = $post->post_title;
|
39 |
-
$post_url = get_permalink( $post_ID );
|
40 |
-
} else {
|
41 |
-
$post_ID = '';
|
42 |
-
$post_title = '';
|
43 |
-
$post_url = '';
|
44 |
-
}
|
45 |
-
|
46 |
-
switch( $default_value ){
|
47 |
-
case '_user_id':
|
48 |
-
$default_value = $user_ID;
|
49 |
-
break;
|
50 |
-
case '_user_firstname':
|
51 |
-
$default_value = $user_firstname;
|
52 |
-
break;
|
53 |
-
case '_user_lastname':
|
54 |
-
$default_value = $user_lastname;
|
55 |
-
break;
|
56 |
-
case '_user_display_name':
|
57 |
-
$default_value = $user_display_name;
|
58 |
-
break;
|
59 |
-
case '_user_email':
|
60 |
-
$default_value = $user_email;
|
61 |
-
break;
|
62 |
-
case 'post_id':
|
63 |
-
$default_value = $post_ID;
|
64 |
-
break;
|
65 |
-
case 'post_title':
|
66 |
-
$default_value = $post_title;
|
67 |
-
break;
|
68 |
-
case 'post_url':
|
69 |
-
$default_value = $post_url;
|
70 |
-
break;
|
71 |
-
case 'today':
|
72 |
-
$plugin_settings = nf_get_settings();
|
73 |
-
if ( isset ( $plugin_settings['date_format'] ) ) {
|
74 |
-
$date_format = $plugin_settings['date_format'];
|
75 |
-
} else {
|
76 |
-
$date_format = 'm/d/Y';
|
77 |
-
}
|
78 |
-
$default_value = date( $date_format, current_time( 'timestamp' ) );
|
79 |
-
break;
|
80 |
-
}
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
$ninja_forms_processing->update_field_value( $field_id, $default_value );
|
85 |
-
}
|
86 |
-
}
|
87 |
-
|
88 |
-
add_action( 'ninja_forms_display_init', 'nf_clear_complete', 999 );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/display/fields/default-value-filter.php
DELETED
@@ -1,36 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
|
3 |
-
/*
|
4 |
-
*
|
5 |
-
* Function that filters default values, replacing defined strings with the approparite values.
|
6 |
-
*
|
7 |
-
* @since 2.4
|
8 |
-
* @return $data
|
9 |
-
*/
|
10 |
-
|
11 |
-
function ninja_forms_default_value_filter( $data, $field_id ) {
|
12 |
-
global $ninja_forms_fields, $ninja_forms_loading, $ninja_forms_processing;
|
13 |
-
|
14 |
-
if ( isset ( $ninja_forms_loading ) ) {
|
15 |
-
$default_value = $ninja_forms_loading->get_field_value( $field_id );
|
16 |
-
$field_type = $ninja_forms_loading->get_field_setting( $field_id, 'type' );
|
17 |
-
} else {
|
18 |
-
$default_value = $ninja_forms_processing->get_field_value( $field_id );
|
19 |
-
$field_type = $ninja_forms_processing->get_field_setting( $field_id, 'type' );
|
20 |
-
}
|
21 |
-
|
22 |
-
if ( $default_value === false and isset ( $data['default_value'] ) ) {
|
23 |
-
$default_value = $data['default_value'];
|
24 |
-
if ( is_string( $default_value ) )
|
25 |
-
$default_value = do_shortcode( $default_value );
|
26 |
-
|
27 |
-
}
|
28 |
-
|
29 |
-
if ( isset ( $ninja_forms_fields[ $field_type ]['process_field'] ) and $ninja_forms_fields[ $field_type ]['process_field'] ) {
|
30 |
-
$data['default_value'] = $default_value;
|
31 |
-
}
|
32 |
-
|
33 |
-
return $data;
|
34 |
-
}
|
35 |
-
|
36 |
-
add_filter( 'ninja_forms_field', 'ninja_forms_default_value_filter', 7, 2 );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/display/fields/desc.php
DELETED
@@ -1,61 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
/**
|
3 |
-
* Outputs the HTML of the description content if it is set to display.
|
4 |
-
*
|
5 |
-
**/
|
6 |
-
|
7 |
-
// add_action( 'init', 'ninja_forms_init_field_desc' );
|
8 |
-
// function ninja_forms_init_field_desc() {
|
9 |
-
// add_action( 'ninja_forms_display_before_field', 'ninja_forms_add_field_desc', 10, 2 );
|
10 |
-
// }
|
11 |
-
|
12 |
-
function ninja_forms_add_field_desc( $field_id, $data ){
|
13 |
-
$plugin_settings = nf_get_settings();
|
14 |
-
|
15 |
-
if ( isset( $data['desc_pos'] ) ) {
|
16 |
-
$desc_pos = $data['desc_pos'];
|
17 |
-
} else {
|
18 |
-
$desc_pos = 'none';
|
19 |
-
}
|
20 |
-
|
21 |
-
if ( $desc_pos == 'none' ) {
|
22 |
-
remove_action( 'ninja_forms_display_after_opening_field_wrap', 'ninja_forms_display_field_desc', 10, 2 );
|
23 |
-
remove_action( 'ninja_forms_display_before_field_label', 'ninja_forms_display_field_desc', 10, 2 );
|
24 |
-
remove_action( 'ninja_forms_display_after_field_label', 'ninja_forms_display_field_desc', 10, 2 );
|
25 |
-
remove_action( 'ninja_forms_display_before_closing_field_wrap', 'ninja_forms_display_field_desc', 10, 2 );
|
26 |
-
} elseif ( $desc_pos == 'before_everything' ) {
|
27 |
-
add_action( 'ninja_forms_display_after_opening_field_wrap', 'ninja_forms_display_field_desc', 10, 2 );
|
28 |
-
remove_action( 'ninja_forms_display_before_field_label', 'ninja_forms_display_field_desc', 10, 2 );
|
29 |
-
remove_action( 'ninja_forms_display_after_field_label', 'ninja_forms_display_field_desc', 10, 2 );
|
30 |
-
remove_action( 'ninja_forms_display_before_closing_field_wrap', 'ninja_forms_display_field_desc', 10, 2 );
|
31 |
-
} elseif ( $desc_pos == 'before_label' ) {
|
32 |
-
add_action( 'ninja_forms_display_before_field_label', 'ninja_forms_display_field_desc', 10, 2 );
|
33 |
-
remove_action( 'ninja_forms_display_after_field_label', 'ninja_forms_display_field_desc', 10, 2 );
|
34 |
-
remove_action( 'ninja_forms_display_before_closing_field_wrap', 'ninja_forms_display_field_desc', 10, 2 );
|
35 |
-
remove_action( 'ninja_forms_display_after_opening_field_wrap', 'ninja_forms_display_field_desc', 10, 2 );
|
36 |
-
} elseif ( $desc_pos == 'after_label' ) {
|
37 |
-
add_action( 'ninja_forms_display_after_field_label', 'ninja_forms_display_field_desc', 10, 2 );
|
38 |
-
remove_action( 'ninja_forms_display_before_field_label', 'ninja_forms_display_field_desc', 10, 2 );
|
39 |
-
remove_action( 'ninja_forms_display_before_closing_field_wrap', 'ninja_forms_display_field_desc', 10, 2 );
|
40 |
-
remove_action( 'ninja_forms_display_after_opening_field_wrap', 'ninja_forms_display_field_desc', 10, 2 );
|
41 |
-
} elseif ( $desc_pos == 'after_everything' ) {
|
42 |
-
add_action( 'ninja_forms_display_before_closing_field_wrap', 'ninja_forms_display_field_desc', 10, 2 );
|
43 |
-
remove_action( 'ninja_forms_display_before_field_label', 'ninja_forms_display_field_desc', 10, 2 );
|
44 |
-
remove_action( 'ninja_forms_display_after_field_label', 'ninja_forms_display_field_desc', 10, 2 );
|
45 |
-
remove_action( 'ninja_forms_display_after_opening_field_wrap', 'ninja_forms_display_field_desc', 10, 2 );
|
46 |
-
}
|
47 |
-
|
48 |
-
}
|
49 |
-
add_action( 'ninja_forms_display_before_field', 'ninja_forms_add_field_desc', 10, 2 );
|
50 |
-
|
51 |
-
function ninja_forms_display_field_desc( $field_id, $data ){
|
52 |
-
$plugin_settings = nf_get_settings();
|
53 |
-
|
54 |
-
$class = apply_filters( 'ninja_forms_display_field_desc_class', 'ninja-forms-field-description', $field_id );
|
55 |
-
|
56 |
-
if ( ( isset( $data['show_desc'] ) and $data['show_desc'] == 1 ) and isset( $data['desc_text'] ) ) {
|
57 |
-
echo '<div class="' . $class . '">';
|
58 |
-
echo do_shortcode( wpautop( $data['desc_text'] ) );
|
59 |
-
echo '</div>';
|
60 |
-
}
|
61 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deprecated/includes/display/fields/display-fields.php
DELETED
@@ -1,318 +0,0 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
/**
|
3 |
-
* Outputs the HTML for each field within a given form_id.
|
4 |
-
* It is attached to the ninja_forms_display_fields hook which is excuted by ninja_forms_display_form() in display-form.php
|
5 |
-
**/
|
6 |
-
add_action('init', 'ninja_forms_register_display_fields');
|
7 |
-
function ninja_forms_register_display_fields(){
|
8 |
-
add_action('ninja_forms_display_fields', 'ninja_forms_display_fields', 10, 2);
|
9 |
-
}
|
10 |
-
|
11 |
-
function ninja_forms_display_fields($form_id){
|
12 |
-
global $ninja_forms_fields, $ninja_forms_loading, $ninja_forms_processing;
|
13 |
-
|
14 |
-
$field_results = ninja_forms_get_fields_by_form_id($form_id);
|
15 |
-
$field_results = apply_filters('ninja_forms_display_fields_array', $field_results, $form_id);
|
16 |
-
|
17 |
-
if ( is_array ( $field_results ) AND !empty ( $field_results ) ) {
|
18 |
-
foreach ( $field_results as $field ) {
|
19 |
-
if ( isset ( $ninja_forms_loading ) && $ninja_forms_loading->get_form_ID() == $form_id ) {
|
20 |
-
$field = $ninja_forms_loading->get_field_settings( $field['id'] );
|
21 |
-
} else if ( isset ( $ninja_forms_processing ) && $ninja_forms_processing->get_form_ID() == $form_id ) {
|
22 |
-
$field = $ninja_forms_processing->get_field_settings( $field['id'] );
|
23 |
-
}
|
24 |
-
|
25 |
-
if( isset( $ninja_forms_fields[$field['type']] ) ){
|
26 |
-
$type = $ninja_forms_fields[$field['type']];
|
27 |
-
|
28 |
-
$field_id = $field['id'];
|
29 |
-
if(isset($field['data']['req'])){
|
30 |
-
$req = $field['data']['req'];
|
31 |
-
}else{
|
32 |
-
$req = '';
|
33 |
-
}
|
34 |
-
|
35 |
-
$default_label_pos = $type['default_label_pos'];
|
36 |
-
$display_wrap = $type['display_wrap'];
|
37 |
-
$display_label = $type['display_label'];
|
38 |
-
$sub_edit_function = $type['sub_edit_function'];
|
39 |
-
$display_function = $type['display_function'];
|
40 |
-
|
41 |
-
//Check to see if we are currently editing a form submission.
|
42 |
-
//If we are, then $display_function should be set to the sub_edit_function instead.
|
43 |
-
if( is_object( $ninja_forms_processing)){
|
44 |
-
$sub_id = $ninja_forms_processing->get_form_setting('sub_id');
|
45 |
-
}else if(isset($_REQUEST['sub_id'])){
|
46 |
-
$sub_id = absint( $_REQUEST['sub_id'] );
|
47 |
-
}else{
|
48 |
-
$sub_id = '';
|
49 |
-
}
|
50 |
-
|
51 |
-
if ( $sub_id != '' AND $sub_edit_function != '' AND is_admin() ){
|
52 |
-
$display_function = $sub_edit_function;
|
53 |
-
}
|
54 |
-
|
55 |
-
$process_field = $type['process_field'];
|
56 |
-
$data = $field['data'];
|
57 |
-
|
58 |
-
|
59 |
-
//These filters can be used to temporarily modify the settings of a field, i.e. default_value.
|
60 |
-
$data = apply_filters( 'ninja_forms_field', $data, $field_id );
|
61 |
-
//Check the show_field value of our $data array. If it is set to false, don't output the field.
|
62 |
-
if(isset($data['show_field'])){
|
63 |
-
$show_field = $data['show_field'];
|
64 |
-
}else{
|
65 |
-
$show_field = true;
|
66 |
-
}
|
67 |
-
|
68 |
-
if( isset( $data['display_style'] ) ){
|
69 |
-
$display_style = $data['display_style'];
|
70 |
-
}else{
|
71 |
-
$display_style = '';
|
72 |
-
}
|
73 |
-
|
74 |
-
if( isset( $data['visible'] ) ){
|
75 |
-
$visible = $data['visible'];
|
76 |
-
}else{
|
77 |
-
$visible = true;
|
78 |
-
}
|
79 |
-
|
80 |
-
if ( $display_style != '' ) {
|
81 |
-
$display_style = 'style="'.$display_style.'"';
|
82 |
-
}
|
83 |
-
|
84 |
-
if ( $display_function != '' AND $show_field ) {
|
85 |
-
if ( isset( $data['label_pos'] ) ) {
|
86 |
-
$label_pos = $data['label_pos'];
|
87 |
-
}else{
|
88 |
-
$label_pos = '';
|
89 |
-
}
|
90 |
-
if( $label_pos == '' ) {
|
91 |
-
$label_pos = $default_label_pos;
|
92 |
-
}
|
93 |
-
|
94 |
-
do_action( 'ninja_forms_display_before_field', $field_id, $data );
|
95 |
-
|
96 |
-
//Check to see if display_wrap has been disabled. If it hasn't, show the wrapping DIV.
|
97 |
-
if($display_wrap){
|
98 |
-
$field_wrap_class = ninja_forms_get_field_wrap_class($field_id, $form_id);
|
99 |
-
$field_wrap_class = apply_filters( 'ninja_forms_field_wrap_class', $field_wrap_class, $field_id );
|
100 |
-
do_action( 'ninja_forms_display_before_opening_field_wrap', $field_id, $data );
|
101 |
-
?>
|
102 |
-
<div class="<?php echo $field_wrap_class;?>" <?php echo $display_style;?> id="ninja_forms_field_<?php echo $field_id;?>_div_wrap" data-visible="<?php echo $visible;?>">
|
103 |
-
<?php
|
104 |
-
do_action( 'ninja_forms_display_after_opening_field_wrap', $field_id, $data );
|
105 |
-
}
|
106 |
-
|
107 |
-
//Check to see if display_label has been disabled. If it hasn't, show the label.
|
108 |
-
if( $display_label ){
|
109 |
-
if( $label_pos == 'left' OR $label_pos == 'above' ){ // Check the label position variable. If it is left or above, show the label.
|
110 |
-
do_action( 'ninja_forms_display_before_field_label', $field_id, $data );
|
111 |
-
do_action( 'ninja_forms_display_field_label', $field_id, $data );
|
112 |
-
do_action( 'ninja_forms_display_after_field_label', $field_id, $data );
|
113 |
-
}
|
114 |
-
}
|
115 |
-
|
116 |
-
//Check to see if there is a registered display function. If so, call it.
|
117 |
-
if($display_function != ''){
|
118 |
-
|
119 |
-
do_action( 'ninja_forms_display_before_field_function', $field_id, $data );
|
120 |
-
$arguments['field_id'] = $field_id;
|
121 |
-
$arguments['data'] = $data;
|
122 |
-
$arguments['form_id'] = $form_id;
|
123 |
-
call_user_func_array($display_function, $arguments);
|
124 |
-
do_action( 'ninja_forms_display_after_field_function', $field_id, $data );
|
125 |
-
if( $label_pos == 'left' OR $label_pos == 'inside'){
|
126 |
-
do_action( 'ninja_forms_display_field_help', $field_id, $data );
|
127 |
-
}
|
128 |
-
}
|
129 |
-
|
130 |
-
//Check to see if display_label has been disabled. If it hasn't, show the label.
|
131 |
-
if($display_label){
|
132 |
-
if($label_pos == 'right' OR $label_pos == 'below'){ // Check the label position variable. If it is right or below, show the label.
|
133 |
-
do_action( 'ninja_forms_display_before_field_label', $field_id, $data );
|
134 |
-
do_action( 'ninja_forms_display_field_label', $field_id, $data );
|
135 |
-
do_action( 'ninja_forms_display_after_field_label', $field_id, $da
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|