Version Description
- We've added a new, full screen builder for a faster and more enjoyable form building experience.
- Moved all settings into the sidebar instead of expanding/collapsing under each field.
- Faster way of adding new radio/select/checkbox options with drag and drop reordering.
- Added a separate placeholder option to make it easier to use, and to allow for both a placeholder and a default value. Existing placeholders will be automatically moved to the new setting.
- Added placeholder setting for dropdown fields, and allow the field label to be used as a placeholder.
- Long forms are easier to edit and save since only the fields settings that have been viewed will be saved.
- Replaced the form builder sidebar panel with in-field modals that include the possible values to insert.
- Added a way to more easily see and find all possible add-ons in the form actions.
- Add link to imported form in the import success message.
- Removed a few unused settings including the option to disable HTML5.
- New hooks: frm_after_field_choices, frm_field_options, frm_after_field_options, frm_[type]primary_field_options, Added hooks for each tab in the global settings: frm[section name]settings_form, frm_defaultvalue_setting
- Added better confirmation messages before deleting fields, forms, form actions, and entries.
- Change default settings to fade in forms and use css grids for new installs.
Download this release
Release Info
Developer | sswells |
Plugin | Formidable Forms – Form Builder for WordPress |
Version | 4.0 |
Comparing to | |
See all releases |
Code changes from version 3.06.06 to 4.0
- classes/controllers/FrmAddonsController.php +57 -36
- classes/controllers/FrmAppController.php +188 -150
- classes/controllers/FrmEntriesController.php +211 -218
- classes/controllers/FrmFieldsController.php +378 -296
- classes/controllers/FrmFormActionsController.php +336 -187
- classes/controllers/FrmFormsController.php +640 -494
- classes/controllers/FrmHooksController.php +133 -137
- classes/controllers/FrmSettingsController.php +159 -44
- classes/controllers/FrmSimpleBlocksController.php +5 -4
- classes/controllers/FrmStylesController.php +200 -244
- classes/controllers/FrmXMLController.php +52 -43
- classes/factories/FrmFieldFactory.php +5 -0
- classes/helpers/FrmAppHelper.php +909 -746
- classes/helpers/FrmCSVExportHelper.php +49 -43
- classes/helpers/FrmEmailHelper.php +3 -1
- classes/helpers/FrmEntriesHelper.php +306 -237
- classes/helpers/FrmEntriesListHelper.php +59 -56
- classes/helpers/FrmFieldsHelper.php +647 -280
- classes/helpers/FrmFormsHelper.php +506 -281
- classes/helpers/FrmFormsListHelper.php +131 -117
- classes/helpers/FrmListHelper.php +117 -82
- classes/helpers/FrmShortcodeHelper.php +6 -4
- classes/helpers/FrmStylesHelper.php +171 -78
- classes/helpers/FrmTipsHelper.php +24 -10
- classes/helpers/FrmXMLHelper.php +625 -463
- classes/models/FrmAddon.php +45 -34
- classes/models/FrmCreateFile.php +13 -11
- classes/models/FrmDb.php +196 -172
- classes/models/FrmEmail.php +6 -3
- classes/models/FrmEntry.php +372 -322
- classes/models/FrmEntryFormatter.php +21 -21
- classes/models/FrmEntryMeta.php +132 -127
- classes/models/FrmEntryShortcodeFormatter.php +2 -1
- classes/models/FrmEntryValidate.php +77 -67
- classes/models/FrmEntryValues.php +5 -5
- classes/models/FrmField.php +291 -266
- classes/models/FrmFieldFormHtml.php +9 -9
- classes/models/FrmFieldOption.php +1 -1
- classes/models/FrmFieldValue.php +4 -3
- classes/models/FrmFieldValueSelector.php +1 -2
- classes/models/FrmForm.php +311 -277
- classes/models/FrmFormAction.php +283 -221
- classes/models/FrmFormApi.php +8 -3
- classes/models/FrmFormMigrator.php +30 -20
- classes/models/FrmInstallerSkin.php +5 -2
- classes/models/FrmMigrate.php +140 -87
- classes/models/FrmNotification.php +1 -0
- classes/models/FrmPersonalData.php +13 -2
- classes/models/FrmReviews.php +5 -5
- classes/models/FrmSettings.php +129 -122
- classes/models/FrmStyle.php +287 -278
- classes/models/FrmTableHTMLGenerator.php +15 -7
- classes/models/FrmUsage.php +1 -0
- classes/models/fields/FrmFieldCaptcha.php +18 -12
- classes/models/fields/FrmFieldCheckbox.php +2 -7
- classes/models/fields/FrmFieldEmail.php +1 -0
- classes/models/fields/FrmFieldHTML.php +13 -1
- classes/models/fields/FrmFieldHidden.php +3 -1
- classes/models/fields/FrmFieldNumber.php +1 -1
- classes/models/fields/FrmFieldPhone.php +1 -0
- classes/models/fields/FrmFieldRadio.php +2 -7
- classes/models/fields/FrmFieldSelect.php +11 -1
- classes/models/fields/FrmFieldTextarea.php +2 -2
- classes/models/fields/FrmFieldType.php +165 -72
- classes/models/fields/FrmFieldUrl.php +3 -3
- classes/models/fields/FrmFieldUserID.php +6 -4
- classes/views/addons/list.php +31 -11
- classes/views/addons/settings.php +8 -8
- classes/views/addons/upgrade_to_pro.php +7 -7
- classes/views/frm-entries/_sidebar-shared-pub.php +24 -17
- classes/views/frm-entries/direct.php +1 -1
- classes/views/frm-entries/errors.php +22 -22
- classes/views/frm-entries/form.php +19 -10
- classes/views/frm-entries/list.php +44 -22
- classes/views/frm-entries/new.php +5 -5
- classes/views/frm-entries/no_entries.php +38 -5
- classes/views/frm-entries/show.php +54 -74
- classes/views/frm-entries/sidebar-shared.php +115 -90
- classes/views/frm-entries/sidebar-show.php +2 -24
- classes/views/frm-fields/back-end/ajax-field-placeholder.php +2 -2
- classes/views/frm-fields/back-end/automatic-width.php +6 -9
- classes/views/frm-fields/back-end/bulk-options-overlay.php +35 -0
- classes/views/frm-fields/back-end/dropdown-field.php +4 -10
- classes/views/frm-fields/back-end/field-captcha.php +7 -4
- classes/views/frm-fields/back-end/field-description.php +8 -0
- classes/views/frm-fields/back-end/field-hidden.php +2 -2
- classes/views/frm-fields/back-end/field-html.php +5 -5
- classes/views/frm-fields/back-end/field-multiple.php +5 -7
- classes/views/frm-fields/back-end/field-user-id.php +4 -3
- classes/views/frm-fields/back-end/html-content.php +11 -7
- classes/views/frm-fields/back-end/inline-modal.php +15 -0
- classes/views/frm-fields/back-end/input-mask-info.php +28 -0
- classes/views/frm-fields/back-end/layout-classes.php +44 -0
- classes/views/frm-fields/back-end/max.php +12 -1
- classes/views/frm-fields/back-end/number-range.php +19 -15
- classes/views/frm-fields/back-end/pixels-wide.php +15 -17
- classes/views/frm-fields/back-end/radio-field.php +48 -0
- classes/views/frm-fields/back-end/settings.php +386 -0
- classes/views/frm-fields/back-end/smart-values.php +18 -0
- classes/views/frm-fields/back-end/value-format.php +9 -7
- classes/views/frm-fields/front-end/checkbox-field.php +36 -27
- classes/views/frm-fields/front-end/dropdown-field.php +20 -1
- classes/views/frm-fields/front-end/radio-field.php +36 -29
- classes/views/frm-fields/import_choices.php +0 -61
- classes/views/frm-fields/single-option.php +11 -16
- classes/views/frm-form-actions/_action_icon.php +22 -0
- classes/views/frm-form-actions/_action_inside.php +30 -24
- classes/views/frm-form-actions/_email_settings.php +80 -84
- classes/views/frm-form-actions/default_actions.php +74 -10
- classes/views/frm-form-actions/email_action.php +17 -17
- classes/views/frm-form-actions/form_action.php +24 -23
- classes/views/frm-form-actions/settings.php +80 -0
- classes/views/frm-forms/_publish_box.php +17 -31
- classes/views/frm-forms/actions-dropdown.php +9 -9
- classes/views/frm-forms/add-new.php +0 -59
- classes/views/frm-forms/add_field.php +50 -335
- classes/views/frm-forms/add_field_links.php +63 -78
classes/controllers/FrmAddonsController.php
CHANGED
@@ -10,18 +10,28 @@ class FrmAddonsController {
|
|
10 |
add_submenu_page( 'formidable', 'Formidable | ' . __( 'Add-Ons', 'formidable' ), __( 'Add-Ons', 'formidable' ), 'frm_view_forms', 'formidable-addons', 'FrmAddonsController::list_addons' );
|
11 |
|
12 |
if ( ! FrmAppHelper::pro_is_installed() ) {
|
13 |
-
add_submenu_page(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
}
|
15 |
}
|
16 |
|
17 |
public static function list_addons() {
|
18 |
$installed_addons = apply_filters( 'frm_installed_addons', array() );
|
|
|
19 |
|
20 |
$addons = self::get_api_addons();
|
21 |
$errors = array();
|
|
|
22 |
if ( isset( $addons['error'] ) ) {
|
23 |
$api = new FrmFormApi();
|
24 |
$errors = $api->get_error_from_response( $addons );
|
|
|
25 |
unset( $addons['error'] );
|
26 |
}
|
27 |
self::prepare_addons( $addons );
|
@@ -35,6 +45,7 @@ class FrmAddonsController {
|
|
35 |
$plugins = apply_filters( 'frm_installed_addons', array() );
|
36 |
if ( empty( $plugins ) ) {
|
37 |
esc_html_e( 'There are no plugins on your site that require a license', 'formidable' );
|
|
|
38 |
return;
|
39 |
}
|
40 |
|
@@ -44,7 +55,7 @@ class FrmAddonsController {
|
|
44 |
}
|
45 |
|
46 |
private static function get_api_addons() {
|
47 |
-
$api
|
48 |
$addons = $api->get_api_info();
|
49 |
|
50 |
if ( empty( $addons ) ) {
|
@@ -74,64 +85,64 @@ class FrmAddonsController {
|
|
74 |
'docs' => '',
|
75 |
'excerpt' => 'Enhance your basic Formidable forms with a plethora of Pro field types and features. Create advanced forms and data-driven applications in minutes.',
|
76 |
),
|
77 |
-
'mailchimp'
|
78 |
'title' => 'MailChimp Forms',
|
79 |
'excerpt' => 'Get on the path to more sales and leads in a matter of minutes. Add leads to a MailChimp mailing list when they submit forms and update their information along with the entry.',
|
80 |
),
|
81 |
-
'registration'
|
82 |
'title' => 'User Registration Forms',
|
83 |
'link' => 'downloads/user-registration/',
|
84 |
'excerpt' => 'Give new users access to your site as quickly and painlessly as possible. Allow users to register, edit and be able to login to their profiles on your site from the front end in a clean, customized registration form.',
|
85 |
),
|
86 |
-
'paypal'
|
87 |
'title' => 'PayPal Standard Forms',
|
88 |
'link' => 'downloads/paypal-standard/',
|
89 |
'excerpt' => 'Automate your business by collecting instant payments from your clients. Collect information, calculate a total, and send them on to PayPal. Require a payment before publishing content on your site.',
|
90 |
),
|
91 |
-
'stripe'
|
92 |
'title' => 'Stripe Forms',
|
93 |
'docs' => 'knowledgebase/stripe/',
|
94 |
'excerpt' => 'Any Formidable forms on your site can accept credit card payments without users ever leaving your site.',
|
95 |
),
|
96 |
-
'authorize-net'
|
97 |
'title' => 'Authorize.net AIM Forms',
|
98 |
'link' => 'downloads/authorize-net-aim/',
|
99 |
'docs' => 'knowledgebase/authorize-net-aim/',
|
100 |
'excerpt' => 'Accept one-time payments directly on your site, using Authorize.net AIM.',
|
101 |
),
|
102 |
-
'woocommerce'
|
103 |
'title' => 'WooCommerce Forms',
|
104 |
'excerpt' => 'Use a Formidable form on your WooCommerce product pages.',
|
105 |
),
|
106 |
-
'autoresponder'
|
107 |
'title' => 'Form Action Automation',
|
108 |
'docs' => 'knowledgebase/schedule-autoresponder/',
|
109 |
'excerpt' => 'Schedule email notifications, SMS messages, and API actions.',
|
110 |
),
|
111 |
-
'modal'
|
112 |
'title' => 'Bootstrap Modal Forms',
|
113 |
'link' => 'downloads/bootstrap-modal/',
|
114 |
'docs' => 'knowledgebase/bootstrap-modal/',
|
115 |
'excerpt' => 'Open a view or form in a Bootstrap popup.',
|
116 |
),
|
117 |
-
'bootstrap'
|
118 |
'title' => 'Bootstrap Style Forms',
|
119 |
'excerpt' => 'Instantly add Bootstrap styling to all your Formidable forms.',
|
120 |
),
|
121 |
-
'zapier'
|
122 |
'title' => 'Zapier Forms',
|
123 |
'excerpt' => 'Connect with hundreds of different applications through Zapier. Insert a new row in a Google docs spreadsheet, post on Twitter, or add a new Dropbox file with your form.',
|
124 |
),
|
125 |
-
'signature'
|
126 |
'title' => 'Digital Signature Forms',
|
127 |
'excerpt' => 'Add a signature field to your form. The user may write their signature with a trackpad/mouse or just type it.',
|
128 |
),
|
129 |
-
'api'
|
130 |
'title' => 'Formidable Forms API',
|
131 |
'link' => 'downloads/formidable-api/',
|
132 |
'excerpt' => 'Send entry results to any other site that has a Rest API. This includes the option of sending entries from one Formidable site to another.',
|
133 |
),
|
134 |
-
'twilio'
|
135 |
'title' => 'Twilio SMS Forms',
|
136 |
'docs' => 'knowledgebase/twilio-add-on/',
|
137 |
'excerpt' => 'Allow users to text their votes for polls created by Formidable Forms, or send SMS notifications when entries are submitted or updated.',
|
@@ -146,8 +157,8 @@ class FrmAddonsController {
|
|
146 |
* @return string
|
147 |
*/
|
148 |
public static function get_pro_download_url() {
|
149 |
-
$pro_cred_store
|
150 |
-
$pro_wpmu_store
|
151 |
if ( is_multisite() && get_site_option( $pro_wpmu_store ) ) {
|
152 |
$creds = get_site_option( $pro_cred_store );
|
153 |
} else {
|
@@ -168,9 +179,9 @@ class FrmAddonsController {
|
|
168 |
$license = strtoupper( $license );
|
169 |
}
|
170 |
|
171 |
-
$api
|
172 |
$downloads = $api->get_api_info();
|
173 |
-
$pro
|
174 |
|
175 |
return isset( $pro['url'] ) ? $pro['url'] : '';
|
176 |
}
|
@@ -215,8 +226,8 @@ class FrmAddonsController {
|
|
215 |
$wp_version = isset( $wp_plugin['Version'] ) ? $wp_plugin['Version'] : '1.0';
|
216 |
|
217 |
if ( version_compare( $wp_version, $plugin->new_version, '<' ) ) {
|
218 |
-
$slug
|
219 |
-
$plugin->slug
|
220 |
$transient->response[ $folder ] = $plugin;
|
221 |
}
|
222 |
|
@@ -231,7 +242,9 @@ class FrmAddonsController {
|
|
231 |
* Check if a plugin is installed before showing an update for it
|
232 |
*
|
233 |
* @since 3.05
|
|
|
234 |
* @param string $plugin - the folder/filename.php for a plugin
|
|
|
235 |
* @return bool - True if installed
|
236 |
*/
|
237 |
private static function is_installed( $plugin ) {
|
@@ -240,6 +253,7 @@ class FrmAddonsController {
|
|
240 |
}
|
241 |
|
242 |
$all_plugins = get_plugins();
|
|
|
243 |
return isset( $all_plugins[ $plugin ] );
|
244 |
}
|
245 |
|
@@ -324,6 +338,10 @@ class FrmAddonsController {
|
|
324 |
'url' => $addon['url'],
|
325 |
'class' => 'frm-install-addon',
|
326 |
);
|
|
|
|
|
|
|
|
|
327 |
}
|
328 |
|
329 |
return $link;
|
@@ -332,13 +350,15 @@ class FrmAddonsController {
|
|
332 |
|
333 |
/**
|
334 |
* @since 3.04.03
|
|
|
335 |
* @param array $addons
|
336 |
* @param object $license The FrmAddon object
|
|
|
337 |
* @return array
|
338 |
*/
|
339 |
public static function get_addon_for_license( $addons, $license ) {
|
340 |
$download_id = $license->download_id;
|
341 |
-
$plugin
|
342 |
if ( empty( $download_id ) && ! empty( $addons ) ) {
|
343 |
foreach ( $addons as $addon ) {
|
344 |
if ( strtolower( $license->plugin_name ) == strtolower( $addon['title'] ) ) {
|
@@ -361,7 +381,7 @@ class FrmAddonsController {
|
|
361 |
$loop_addons = $addons;
|
362 |
foreach ( $loop_addons as $id => $addon ) {
|
363 |
if ( is_numeric( $id ) ) {
|
364 |
-
$slug
|
365 |
$file_name = $addon['plugin'];
|
366 |
} else {
|
367 |
$slug = $id;
|
@@ -379,8 +399,8 @@ class FrmAddonsController {
|
|
379 |
if ( $addon['installed'] && ! empty( $activate_url ) && ! is_plugin_active( $file_name ) ) {
|
380 |
$addon['activate_url'] = add_query_arg(
|
381 |
array(
|
382 |
-
'_wpnonce'
|
383 |
-
'plugin'
|
384 |
),
|
385 |
$activate_url
|
386 |
);
|
@@ -409,13 +429,13 @@ class FrmAddonsController {
|
|
409 |
if ( strpos( $link, 'http' ) !== 0 ) {
|
410 |
$link = $site_url . $link;
|
411 |
}
|
412 |
-
$link
|
413 |
$query_args = array(
|
414 |
'utm_source' => 'WordPress',
|
415 |
'utm_medium' => 'addons',
|
416 |
'utm_campaign' => 'liteplugin',
|
417 |
);
|
418 |
-
$link
|
419 |
}
|
420 |
|
421 |
/**
|
@@ -653,13 +673,13 @@ class FrmAddonsController {
|
|
653 |
|
654 |
private static function prepare_pro_info() {
|
655 |
return array(
|
656 |
-
'personal'
|
657 |
'id' => 2,
|
658 |
'download' => 19367654,
|
659 |
'price' => '49.00',
|
660 |
'name' => 'Personal',
|
661 |
),
|
662 |
-
'professional'
|
663 |
'id' => 0,
|
664 |
'download' => 19367001,
|
665 |
'price' => '99.00',
|
@@ -671,7 +691,7 @@ class FrmAddonsController {
|
|
671 |
'price' => '199.00',
|
672 |
'name' => 'Business',
|
673 |
),
|
674 |
-
'enterprise'
|
675 |
'id' => 0,
|
676 |
'download' => 19366992,
|
677 |
'price' => '399.00',
|
@@ -709,10 +729,10 @@ class FrmAddonsController {
|
|
709 |
ob_start();
|
710 |
|
711 |
$show_form = false;
|
712 |
-
$method
|
713 |
-
$url
|
714 |
-
$url
|
715 |
-
$creds
|
716 |
|
717 |
if ( false === $creds ) {
|
718 |
$show_form = true;
|
@@ -722,7 +742,7 @@ class FrmAddonsController {
|
|
722 |
}
|
723 |
|
724 |
if ( $show_form ) {
|
725 |
-
|
726 |
//TODO: test this: echo json_encode( array( 'form' => $form ) );
|
727 |
echo json_encode( array( 'form' => __( 'Sorry, you\'re site requires FTP authentication. Please install plugins manaully.', 'formidable' ) ) );
|
728 |
wp_die();
|
@@ -740,7 +760,7 @@ class FrmAddonsController {
|
|
740 |
private static function install_addon() {
|
741 |
require_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
|
742 |
|
743 |
-
$download_url =
|
744 |
|
745 |
// Create the plugin upgrader with our custom skin.
|
746 |
$installer = new Plugin_Upgrader( new FrmInstallerSkin() );
|
@@ -748,6 +768,7 @@ class FrmAddonsController {
|
|
748 |
|
749 |
// Flush the cache and return the newly installed plugin basename.
|
750 |
wp_cache_flush();
|
|
|
751 |
return $installer->plugin_info();
|
752 |
}
|
753 |
|
10 |
add_submenu_page( 'formidable', 'Formidable | ' . __( 'Add-Ons', 'formidable' ), __( 'Add-Ons', 'formidable' ), 'frm_view_forms', 'formidable-addons', 'FrmAddonsController::list_addons' );
|
11 |
|
12 |
if ( ! FrmAppHelper::pro_is_installed() ) {
|
13 |
+
add_submenu_page(
|
14 |
+
'formidable',
|
15 |
+
'Formidable | ' . __( 'Upgrade to Pro', 'formidable' ),
|
16 |
+
'<span style="color:#f15a24">' . __( 'Upgrade to Pro', 'formidable' ) . '</span>',
|
17 |
+
'frm_view_forms',
|
18 |
+
'formidable-pro-upgrade',
|
19 |
+
'FrmAddonsController::upgrade_to_pro'
|
20 |
+
);
|
21 |
}
|
22 |
}
|
23 |
|
24 |
public static function list_addons() {
|
25 |
$installed_addons = apply_filters( 'frm_installed_addons', array() );
|
26 |
+
$license_type = '';
|
27 |
|
28 |
$addons = self::get_api_addons();
|
29 |
$errors = array();
|
30 |
+
|
31 |
if ( isset( $addons['error'] ) ) {
|
32 |
$api = new FrmFormApi();
|
33 |
$errors = $api->get_error_from_response( $addons );
|
34 |
+
$license_type = isset( $addons['error']['type'] ) ? $addons['error']['type'] : '';
|
35 |
unset( $addons['error'] );
|
36 |
}
|
37 |
self::prepare_addons( $addons );
|
45 |
$plugins = apply_filters( 'frm_installed_addons', array() );
|
46 |
if ( empty( $plugins ) ) {
|
47 |
esc_html_e( 'There are no plugins on your site that require a license', 'formidable' );
|
48 |
+
|
49 |
return;
|
50 |
}
|
51 |
|
55 |
}
|
56 |
|
57 |
private static function get_api_addons() {
|
58 |
+
$api = new FrmFormApi();
|
59 |
$addons = $api->get_api_info();
|
60 |
|
61 |
if ( empty( $addons ) ) {
|
85 |
'docs' => '',
|
86 |
'excerpt' => 'Enhance your basic Formidable forms with a plethora of Pro field types and features. Create advanced forms and data-driven applications in minutes.',
|
87 |
),
|
88 |
+
'mailchimp' => array(
|
89 |
'title' => 'MailChimp Forms',
|
90 |
'excerpt' => 'Get on the path to more sales and leads in a matter of minutes. Add leads to a MailChimp mailing list when they submit forms and update their information along with the entry.',
|
91 |
),
|
92 |
+
'registration' => array(
|
93 |
'title' => 'User Registration Forms',
|
94 |
'link' => 'downloads/user-registration/',
|
95 |
'excerpt' => 'Give new users access to your site as quickly and painlessly as possible. Allow users to register, edit and be able to login to their profiles on your site from the front end in a clean, customized registration form.',
|
96 |
),
|
97 |
+
'paypal' => array(
|
98 |
'title' => 'PayPal Standard Forms',
|
99 |
'link' => 'downloads/paypal-standard/',
|
100 |
'excerpt' => 'Automate your business by collecting instant payments from your clients. Collect information, calculate a total, and send them on to PayPal. Require a payment before publishing content on your site.',
|
101 |
),
|
102 |
+
'stripe' => array(
|
103 |
'title' => 'Stripe Forms',
|
104 |
'docs' => 'knowledgebase/stripe/',
|
105 |
'excerpt' => 'Any Formidable forms on your site can accept credit card payments without users ever leaving your site.',
|
106 |
),
|
107 |
+
'authorize-net' => array(
|
108 |
'title' => 'Authorize.net AIM Forms',
|
109 |
'link' => 'downloads/authorize-net-aim/',
|
110 |
'docs' => 'knowledgebase/authorize-net-aim/',
|
111 |
'excerpt' => 'Accept one-time payments directly on your site, using Authorize.net AIM.',
|
112 |
),
|
113 |
+
'woocommerce' => array(
|
114 |
'title' => 'WooCommerce Forms',
|
115 |
'excerpt' => 'Use a Formidable form on your WooCommerce product pages.',
|
116 |
),
|
117 |
+
'autoresponder' => array(
|
118 |
'title' => 'Form Action Automation',
|
119 |
'docs' => 'knowledgebase/schedule-autoresponder/',
|
120 |
'excerpt' => 'Schedule email notifications, SMS messages, and API actions.',
|
121 |
),
|
122 |
+
'modal' => array(
|
123 |
'title' => 'Bootstrap Modal Forms',
|
124 |
'link' => 'downloads/bootstrap-modal/',
|
125 |
'docs' => 'knowledgebase/bootstrap-modal/',
|
126 |
'excerpt' => 'Open a view or form in a Bootstrap popup.',
|
127 |
),
|
128 |
+
'bootstrap' => array(
|
129 |
'title' => 'Bootstrap Style Forms',
|
130 |
'excerpt' => 'Instantly add Bootstrap styling to all your Formidable forms.',
|
131 |
),
|
132 |
+
'zapier' => array(
|
133 |
'title' => 'Zapier Forms',
|
134 |
'excerpt' => 'Connect with hundreds of different applications through Zapier. Insert a new row in a Google docs spreadsheet, post on Twitter, or add a new Dropbox file with your form.',
|
135 |
),
|
136 |
+
'signature' => array(
|
137 |
'title' => 'Digital Signature Forms',
|
138 |
'excerpt' => 'Add a signature field to your form. The user may write their signature with a trackpad/mouse or just type it.',
|
139 |
),
|
140 |
+
'api' => array(
|
141 |
'title' => 'Formidable Forms API',
|
142 |
'link' => 'downloads/formidable-api/',
|
143 |
'excerpt' => 'Send entry results to any other site that has a Rest API. This includes the option of sending entries from one Formidable site to another.',
|
144 |
),
|
145 |
+
'twilio' => array(
|
146 |
'title' => 'Twilio SMS Forms',
|
147 |
'docs' => 'knowledgebase/twilio-add-on/',
|
148 |
'excerpt' => 'Allow users to text their votes for polls created by Formidable Forms, or send SMS notifications when entries are submitted or updated.',
|
157 |
* @return string
|
158 |
*/
|
159 |
public static function get_pro_download_url() {
|
160 |
+
$pro_cred_store = 'frmpro-credentials';
|
161 |
+
$pro_wpmu_store = 'frmpro-wpmu-sitewide';
|
162 |
if ( is_multisite() && get_site_option( $pro_wpmu_store ) ) {
|
163 |
$creds = get_site_option( $pro_cred_store );
|
164 |
} else {
|
179 |
$license = strtoupper( $license );
|
180 |
}
|
181 |
|
182 |
+
$api = new FrmFormApi( $license );
|
183 |
$downloads = $api->get_api_info();
|
184 |
+
$pro = isset( $downloads['93790'] ) ? $downloads['93790'] : array();
|
185 |
|
186 |
return isset( $pro['url'] ) ? $pro['url'] : '';
|
187 |
}
|
226 |
$wp_version = isset( $wp_plugin['Version'] ) ? $wp_plugin['Version'] : '1.0';
|
227 |
|
228 |
if ( version_compare( $wp_version, $plugin->new_version, '<' ) ) {
|
229 |
+
$slug = explode( '/', $folder );
|
230 |
+
$plugin->slug = $slug[0];
|
231 |
$transient->response[ $folder ] = $plugin;
|
232 |
}
|
233 |
|
242 |
* Check if a plugin is installed before showing an update for it
|
243 |
*
|
244 |
* @since 3.05
|
245 |
+
*
|
246 |
* @param string $plugin - the folder/filename.php for a plugin
|
247 |
+
*
|
248 |
* @return bool - True if installed
|
249 |
*/
|
250 |
private static function is_installed( $plugin ) {
|
253 |
}
|
254 |
|
255 |
$all_plugins = get_plugins();
|
256 |
+
|
257 |
return isset( $all_plugins[ $plugin ] );
|
258 |
}
|
259 |
|
338 |
'url' => $addon['url'],
|
339 |
'class' => 'frm-install-addon',
|
340 |
);
|
341 |
+
} elseif ( isset( $addon['categories'] ) && ! empty( $addon['categories'] ) ) {
|
342 |
+
$link = array(
|
343 |
+
'categories' => $addon['categories'],
|
344 |
+
);
|
345 |
}
|
346 |
|
347 |
return $link;
|
350 |
|
351 |
/**
|
352 |
* @since 3.04.03
|
353 |
+
*
|
354 |
* @param array $addons
|
355 |
* @param object $license The FrmAddon object
|
356 |
+
*
|
357 |
* @return array
|
358 |
*/
|
359 |
public static function get_addon_for_license( $addons, $license ) {
|
360 |
$download_id = $license->download_id;
|
361 |
+
$plugin = array();
|
362 |
if ( empty( $download_id ) && ! empty( $addons ) ) {
|
363 |
foreach ( $addons as $addon ) {
|
364 |
if ( strtolower( $license->plugin_name ) == strtolower( $addon['title'] ) ) {
|
381 |
$loop_addons = $addons;
|
382 |
foreach ( $loop_addons as $id => $addon ) {
|
383 |
if ( is_numeric( $id ) ) {
|
384 |
+
$slug = str_replace( array( '-wordpress-plugin', '-wordpress' ), '', $addon['slug'] );
|
385 |
$file_name = $addon['plugin'];
|
386 |
} else {
|
387 |
$slug = $id;
|
399 |
if ( $addon['installed'] && ! empty( $activate_url ) && ! is_plugin_active( $file_name ) ) {
|
400 |
$addon['activate_url'] = add_query_arg(
|
401 |
array(
|
402 |
+
'_wpnonce' => wp_create_nonce( 'activate-plugin_' . $file_name ),
|
403 |
+
'plugin' => $file_name,
|
404 |
),
|
405 |
$activate_url
|
406 |
);
|
429 |
if ( strpos( $link, 'http' ) !== 0 ) {
|
430 |
$link = $site_url . $link;
|
431 |
}
|
432 |
+
$link = FrmAppHelper::make_affiliate_url( $link );
|
433 |
$query_args = array(
|
434 |
'utm_source' => 'WordPress',
|
435 |
'utm_medium' => 'addons',
|
436 |
'utm_campaign' => 'liteplugin',
|
437 |
);
|
438 |
+
$link = add_query_arg( $query_args, $link );
|
439 |
}
|
440 |
|
441 |
/**
|
673 |
|
674 |
private static function prepare_pro_info() {
|
675 |
return array(
|
676 |
+
'personal' => array(
|
677 |
'id' => 2,
|
678 |
'download' => 19367654,
|
679 |
'price' => '49.00',
|
680 |
'name' => 'Personal',
|
681 |
),
|
682 |
+
'professional' => array(
|
683 |
'id' => 0,
|
684 |
'download' => 19367001,
|
685 |
'price' => '99.00',
|
691 |
'price' => '199.00',
|
692 |
'name' => 'Business',
|
693 |
),
|
694 |
+
'enterprise' => array(
|
695 |
'id' => 0,
|
696 |
'download' => 19366992,
|
697 |
'price' => '399.00',
|
729 |
ob_start();
|
730 |
|
731 |
$show_form = false;
|
732 |
+
$method = '';
|
733 |
+
$url = add_query_arg( array( 'page' => 'formidable-settings' ), admin_url( 'admin.php' ) );
|
734 |
+
$url = esc_url_raw( $url );
|
735 |
+
$creds = request_filesystem_credentials( $url, $method, false, false, null );
|
736 |
|
737 |
if ( false === $creds ) {
|
738 |
$show_form = true;
|
742 |
}
|
743 |
|
744 |
if ( $show_form ) {
|
745 |
+
//$form = ob_get_clean();
|
746 |
//TODO: test this: echo json_encode( array( 'form' => $form ) );
|
747 |
echo json_encode( array( 'form' => __( 'Sorry, you\'re site requires FTP authentication. Please install plugins manaully.', 'formidable' ) ) );
|
748 |
wp_die();
|
760 |
private static function install_addon() {
|
761 |
require_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
|
762 |
|
763 |
+
$download_url = FrmAppHelper::get_param( 'plugin', '', 'post', 'esc_url_raw' );
|
764 |
|
765 |
// Create the plugin upgrader with our custom skin.
|
766 |
$installer = new Plugin_Upgrader( new FrmInstallerSkin() );
|
768 |
|
769 |
// Flush the cache and return the newly installed plugin basename.
|
770 |
wp_cache_flush();
|
771 |
+
|
772 |
return $installer->plugin_info();
|
773 |
}
|
774 |
|
classes/controllers/FrmAppController.php
CHANGED
@@ -3,14 +3,14 @@
|
|
3 |
class FrmAppController {
|
4 |
|
5 |
public static function menu() {
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
|
11 |
$menu_name = FrmAppHelper::get_menu_name();
|
12 |
add_menu_page( 'Formidable', $menu_name, 'frm_view_forms', 'formidable', 'FrmFormsController::route', self::menu_icon(), self::get_menu_position() );
|
13 |
-
|
14 |
|
15 |
private static function get_menu_position() {
|
16 |
return apply_filters( 'frm_menu_position', '29.3' );
|
@@ -27,6 +27,7 @@ class FrmAppController {
|
|
27 |
)
|
28 |
);
|
29 |
$icon = 'data:image/svg+xml;base64,' . base64_encode( $icon );
|
|
|
30 |
return apply_filters( 'frm_icon', $icon );
|
31 |
}
|
32 |
|
@@ -36,52 +37,90 @@ class FrmAppController {
|
|
36 |
public static function add_admin_class( $classes ) {
|
37 |
if ( self::is_white_page() ) {
|
38 |
$classes .= ' frm-white-body ';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
}
|
|
|
40 |
return $classes;
|
41 |
}
|
42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
/**
|
44 |
* @since 3.0
|
45 |
*/
|
46 |
private static function is_white_page() {
|
47 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
if ( ! $is_white_page ) {
|
49 |
-
$screen
|
50 |
-
$is_white_page = ( $screen && $screen->id
|
51 |
}
|
52 |
|
53 |
return $is_white_page;
|
54 |
}
|
55 |
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
|
60 |
public static function get_form_nav( $form, $show_nav = false, $title = 'show' ) {
|
61 |
$show_nav = FrmAppHelper::get_param( 'show_nav', $show_nav, 'get', 'absint' );
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
|
66 |
FrmForm::maybe_get_form( $form );
|
67 |
if ( ! is_object( $form ) ) {
|
68 |
return;
|
69 |
}
|
70 |
|
71 |
-
$id
|
72 |
$current_page = self::get_current_page();
|
73 |
-
$nav_items
|
74 |
|
75 |
include( FrmAppHelper::plugin_path() . '/classes/views/shared/form-nav.php' );
|
76 |
}
|
77 |
|
78 |
private static function get_current_page() {
|
79 |
-
|
80 |
-
|
81 |
-
$page = FrmAppHelper::simple_get( 'page', 'sanitize_title' );
|
82 |
-
$post_type = FrmAppHelper::simple_get( 'post_type', 'sanitize_title', 'None' );
|
83 |
$current_page = isset( $_GET['page'] ) ? $page : $post_type;
|
84 |
-
|
|
|
85 |
$current_page = 'frm_display';
|
86 |
}
|
87 |
|
@@ -93,24 +132,24 @@ class FrmAppController {
|
|
93 |
|
94 |
$nav_items = array(
|
95 |
array(
|
96 |
-
'link'
|
97 |
-
'label'
|
98 |
-
'current'
|
99 |
-
'page'
|
100 |
'permission' => 'frm_edit_forms',
|
101 |
),
|
102 |
array(
|
103 |
-
'link'
|
104 |
-
'label'
|
105 |
-
'current'
|
106 |
-
'page'
|
107 |
'permission' => 'frm_edit_forms',
|
108 |
),
|
109 |
array(
|
110 |
-
'link'
|
111 |
-
'label'
|
112 |
-
'current'
|
113 |
-
'page'
|
114 |
'permission' => 'frm_view_entries',
|
115 |
),
|
116 |
);
|
@@ -141,32 +180,32 @@ class FrmAppController {
|
|
141 |
'data-medium' => 'reports-nav',
|
142 |
),
|
143 |
);
|
144 |
-
self::include_upgrade_overlay();
|
145 |
}
|
146 |
|
147 |
$nav_args = array(
|
148 |
'form_id' => $id,
|
149 |
'form' => $form,
|
150 |
);
|
|
|
151 |
return apply_filters( 'frm_form_nav_list', $nav_items, $nav_args );
|
152 |
}
|
153 |
|
154 |
-
|
155 |
-
|
156 |
$settings = '<a href="' . esc_url( admin_url( 'admin.php?page=formidable' ) ) . '">' . __( 'Build a Form', 'formidable' ) . '</a>';
|
157 |
-
|
158 |
|
159 |
-
|
160 |
-
|
161 |
|
162 |
-
|
163 |
self::maybe_show_upgrade_bar();
|
164 |
self::review_request();
|
165 |
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
|
171 |
$pro_installed = is_dir( WP_PLUGIN_DIR . '/formidable-pro' );
|
172 |
$authorized = get_site_option( 'frmpro-authorized' ) && ! is_callable( 'load_formidable_pro' );
|
@@ -183,31 +222,32 @@ class FrmAppController {
|
|
183 |
$inst_install_url = wp_nonce_url( self_admin_url( 'plugins.php?action=activate&plugin=formidable-pro/formidable-pro.php' ), 'activate-plugin_formidable-pro/formidable-pro.php' );
|
184 |
} else {
|
185 |
$inst_install_url = '#';
|
186 |
-
$download_url
|
187 |
|
188 |
if ( empty( $download_url ) ) {
|
189 |
$inst_install_url = 'https://formidableforms.com/knowledgebase/install-formidable-forms/?utm_source=WordPress&utm_medium=get-started&utm_campaign=liteplugin';
|
190 |
}
|
191 |
}
|
192 |
-
?>
|
193 |
-
<div class="error frm_previous_install">
|
194 |
-
<?php
|
195 |
-
echo apply_filters( // WPCS: XSS ok.
|
196 |
-
'frm_pro_update_msg',
|
197 |
-
sprintf(
|
198 |
-
esc_html__( 'This site has been previously authorized to run Formidable Forms. %1$sInstall Formidable Pro%2$s or %3$sdeauthorize%4$s this site to continue running the free version and remove this message.', 'formidable' ),
|
199 |
-
'<br/><a href="' . esc_url( $inst_install_url ) . '" id="frm_install_link" target="_blank" data-prourl="' . esc_url( $download_url ) . '">',
|
200 |
-
'</a>',
|
201 |
-
'<a href="#" class="frm_deauthorize_link">',
|
202 |
-
'</a>'
|
203 |
-
),
|
204 |
-
esc_url( $inst_install_url )
|
205 |
-
);
|
206 |
?>
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
211 |
|
212 |
private static function maybe_show_upgrade_bar() {
|
213 |
if ( ! FrmAppHelper::is_formidable_admin() || FrmAppHelper::pro_is_installed() ) {
|
@@ -216,15 +256,17 @@ class FrmAppController {
|
|
216 |
|
217 |
$affiliate = FrmAppHelper::get_affiliate();
|
218 |
if ( ! empty( $affiliate ) ) {
|
219 |
-
$tip
|
220 |
$link = FrmAppHelper::admin_upgrade_link( 'banner' );
|
221 |
-
?>
|
222 |
-
<div class="update-nag frm-update-to-pro">
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
|
|
|
|
228 |
}
|
229 |
}
|
230 |
|
@@ -271,6 +313,8 @@ class FrmAppController {
|
|
271 |
'content' => 'upgrade',
|
272 |
);
|
273 |
include( FrmAppHelper::plugin_path() . '/classes/views/shared/upgrade_overlay.php' );
|
|
|
|
|
274 |
}
|
275 |
|
276 |
/**
|
@@ -294,6 +338,7 @@ class FrmAppController {
|
|
294 |
}
|
295 |
}
|
296 |
}
|
|
|
297 |
return $upsell;
|
298 |
}
|
299 |
|
@@ -326,6 +371,7 @@ class FrmAppController {
|
|
326 |
if ( ! $needs_upgrade ) {
|
327 |
$needs_upgrade = apply_filters( 'frm_db_needs_upgrade', $needs_upgrade );
|
328 |
}
|
|
|
329 |
return $needs_upgrade;
|
330 |
}
|
331 |
|
@@ -340,10 +386,10 @@ class FrmAppController {
|
|
340 |
if ( strpos( $db_version, '-' ) === false ) {
|
341 |
$needs_upgrade = true;
|
342 |
} else {
|
343 |
-
$last_upgrade
|
344 |
$needs_db_upgrade = (int) $last_upgrade[1] < (int) $atts['new_db_version'];
|
345 |
-
$new_version
|
346 |
-
$needs_upgrade
|
347 |
}
|
348 |
|
349 |
return $needs_upgrade;
|
@@ -361,14 +407,13 @@ class FrmAppController {
|
|
361 |
self::network_upgrade_site();
|
362 |
}
|
363 |
|
364 |
-
|
365 |
-
if ( ! FrmAppHelper::doing_ajax() || $action == 'frm_import_choices' ) {
|
366 |
// don't continue during ajax calls
|
367 |
self::admin_js();
|
368 |
}
|
369 |
}
|
370 |
|
371 |
-
|
372 |
$version = FrmAppHelper::plugin_version();
|
373 |
FrmAppHelper::load_admin_wide_js( false );
|
374 |
|
@@ -389,29 +434,29 @@ class FrmAppController {
|
|
389 |
|
390 |
wp_register_script( 'formidable_admin', FrmAppHelper::plugin_url() . '/js/formidable_admin.js', $dependecies, $version, true );
|
391 |
wp_register_style( 'formidable-admin', FrmAppHelper::plugin_url() . '/css/frm_admin.css', array(), $version );
|
392 |
-
|
393 |
wp_register_style( 'formidable-grids', FrmAppHelper::plugin_url() . '/css/frm_grids.css', array(), $version );
|
394 |
|
395 |
// load multselect js
|
396 |
-
|
|
|
397 |
|
398 |
-
$page
|
399 |
$post_type = FrmAppHelper::simple_get( 'post_type', 'sanitize_title' );
|
400 |
|
401 |
global $pagenow;
|
402 |
if ( strpos( $page, 'formidable' ) === 0 || ( $pagenow == 'edit.php' && $post_type == 'frm_display' ) ) {
|
403 |
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
FrmAppHelper::localize_script( 'admin' );
|
409 |
|
410 |
wp_enqueue_style( 'formidable-admin' );
|
411 |
if ( 'formidable-styles' !== $page ) {
|
412 |
wp_enqueue_style( 'formidable-grids' );
|
413 |
wp_enqueue_style( 'formidable-dropzone' );
|
414 |
-
add_thickbox();
|
415 |
} else {
|
416 |
$settings = FrmAppHelper::get_settings();
|
417 |
if ( empty( $settings->old_css ) ) {
|
@@ -419,36 +464,36 @@ class FrmAppController {
|
|
419 |
}
|
420 |
}
|
421 |
|
422 |
-
wp_register_script( 'formidable-editinplace', FrmAppHelper::plugin_url() . '/js/jquery/jquery.editinplace.packed.js', array( 'jquery' ), '2.3.0' );
|
423 |
-
|
424 |
do_action( 'frm_enqueue_builder_scripts' );
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
|
|
|
|
442 |
FrmAppHelper::localize_script( 'admin' );
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
|
453 |
/**
|
454 |
* Check if the styles are updated when a form is loaded on the front-end
|
@@ -510,6 +555,7 @@ class FrmAppController {
|
|
510 |
delete_option( 'frm_install_running' );
|
511 |
}
|
512 |
}
|
|
|
513 |
return true;
|
514 |
}
|
515 |
|
@@ -524,14 +570,14 @@ class FrmAppController {
|
|
524 |
wp_die();
|
525 |
}
|
526 |
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
|
532 |
-
|
533 |
FrmAppHelper::permission_check( 'administrator' );
|
534 |
-
|
535 |
|
536 |
$frmdb = new FrmMigrate();
|
537 |
$frmdb->uninstall();
|
@@ -540,42 +586,35 @@ class FrmAppController {
|
|
540 |
deactivate_plugins( FrmAppHelper::plugin_folder() . '/formidable.php', false, false );
|
541 |
echo esc_url_raw( admin_url( 'plugins.php?deactivate=true' ) );
|
542 |
|
543 |
-
|
544 |
-
|
545 |
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
return $tables;
|
553 |
-
}
|
554 |
|
555 |
-
|
|
|
|
|
|
|
556 |
FrmAppHelper::permission_check( 'frm_change_settings' );
|
557 |
-
|
558 |
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
|
566 |
public static function set_footer_text( $text ) {
|
567 |
if ( FrmAppHelper::is_formidable_admin() ) {
|
568 |
-
$
|
569 |
-
$text = sprintf(
|
570 |
-
__( 'Help us spread the %1$sFormidable Forms%2$s love with %3$s %5$s on WordPress.org%4$s. Thank you heaps!', 'formidable' ),
|
571 |
-
'<a href="' . esc_url( FrmAppHelper::make_affiliate_url( $link ) ) . '" target="_blank">',
|
572 |
-
'</a>',
|
573 |
-
'<a href="https://wordpress.org/support/plugin/formidable/reviews/?filter=5#new-post" target="_blank">',
|
574 |
-
'</a>',
|
575 |
-
'★★★★★'
|
576 |
-
);
|
577 |
-
$text = '<span id="footer-thankyou">' . $text . '</span>';
|
578 |
}
|
|
|
579 |
return $text;
|
580 |
}
|
581 |
|
@@ -583,9 +622,9 @@ class FrmAppController {
|
|
583 |
* @deprecated 1.07.05
|
584 |
* @codeCoverageIgnore
|
585 |
*/
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
|
590 |
/**
|
591 |
* @deprecated 2.5.4
|
@@ -605,7 +644,6 @@ class FrmAppController {
|
|
605 |
FrmDeprecated::front_head();
|
606 |
}
|
607 |
|
608 |
-
|
609 |
/**
|
610 |
* @deprecated 3.0.04
|
611 |
* @codeCoverageIgnore
|
3 |
class FrmAppController {
|
4 |
|
5 |
public static function menu() {
|
6 |
+
FrmAppHelper::maybe_add_permissions();
|
7 |
+
if ( ! current_user_can( 'frm_view_forms' ) ) {
|
8 |
+
return;
|
9 |
+
}
|
10 |
|
11 |
$menu_name = FrmAppHelper::get_menu_name();
|
12 |
add_menu_page( 'Formidable', $menu_name, 'frm_view_forms', 'formidable', 'FrmFormsController::route', self::menu_icon(), self::get_menu_position() );
|
13 |
+
}
|
14 |
|
15 |
private static function get_menu_position() {
|
16 |
return apply_filters( 'frm_menu_position', '29.3' );
|
27 |
)
|
28 |
);
|
29 |
$icon = 'data:image/svg+xml;base64,' . base64_encode( $icon );
|
30 |
+
|
31 |
return apply_filters( 'frm_icon', $icon );
|
32 |
}
|
33 |
|
37 |
public static function add_admin_class( $classes ) {
|
38 |
if ( self::is_white_page() ) {
|
39 |
$classes .= ' frm-white-body ';
|
40 |
+
$classes .= self::get_os();
|
41 |
+
|
42 |
+
$page = FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' );
|
43 |
+
if ( ! empty( $page ) ) {
|
44 |
+
$classes .= ' frm-admin-page-' . $page;
|
45 |
+
}
|
46 |
+
}
|
47 |
+
|
48 |
+
if ( FrmAppHelper::is_full_screen() ) {
|
49 |
+
$classes .= ' frm-full-screen';
|
50 |
}
|
51 |
+
|
52 |
return $classes;
|
53 |
}
|
54 |
|
55 |
+
/**
|
56 |
+
* @since 4.0
|
57 |
+
*/
|
58 |
+
private static function get_os() {
|
59 |
+
$agent = strtolower( FrmAppHelper::get_server_value( 'HTTP_USER_AGENT' ) );
|
60 |
+
$os = '';
|
61 |
+
if ( strpos( $agent, 'mac' ) !== false ) {
|
62 |
+
$os = ' osx';
|
63 |
+
} elseif ( strpos( $agent, 'linux' ) !== false ) {
|
64 |
+
$os = ' linux';
|
65 |
+
} elseif ( strpos( $agent, 'windows' ) !== false ) {
|
66 |
+
$os = ' windows';
|
67 |
+
}
|
68 |
+
return $os;
|
69 |
+
}
|
70 |
+
|
71 |
/**
|
72 |
* @since 3.0
|
73 |
*/
|
74 |
private static function is_white_page() {
|
75 |
+
$white_pages = array(
|
76 |
+
'formidable',
|
77 |
+
'formidable-entries',
|
78 |
+
'formidable-pro-upgrade',
|
79 |
+
'formidable-addons',
|
80 |
+
'formidable-import',
|
81 |
+
'formidable-settings',
|
82 |
+
'formidable-styles',
|
83 |
+
);
|
84 |
+
|
85 |
+
$get_page = FrmAppHelper::simple_get( 'page', 'sanitize_title' );
|
86 |
+
$is_white_page = in_array( $get_page, $white_pages );
|
87 |
+
|
88 |
if ( ! $is_white_page ) {
|
89 |
+
$screen = get_current_screen();
|
90 |
+
$is_white_page = ( $screen && strpos( $screen->id, 'frm_display' ) !== false );
|
91 |
}
|
92 |
|
93 |
return $is_white_page;
|
94 |
}
|
95 |
|
96 |
+
public static function load_wp_admin_style() {
|
97 |
+
FrmAppHelper::load_font_style();
|
98 |
+
}
|
99 |
|
100 |
public static function get_form_nav( $form, $show_nav = false, $title = 'show' ) {
|
101 |
$show_nav = FrmAppHelper::get_param( 'show_nav', $show_nav, 'get', 'absint' );
|
102 |
+
if ( empty( $show_nav ) || ! $form ) {
|
103 |
+
return;
|
104 |
+
}
|
105 |
|
106 |
FrmForm::maybe_get_form( $form );
|
107 |
if ( ! is_object( $form ) ) {
|
108 |
return;
|
109 |
}
|
110 |
|
111 |
+
$id = $form->id;
|
112 |
$current_page = self::get_current_page();
|
113 |
+
$nav_items = self::get_form_nav_items( $form );
|
114 |
|
115 |
include( FrmAppHelper::plugin_path() . '/classes/views/shared/form-nav.php' );
|
116 |
}
|
117 |
|
118 |
private static function get_current_page() {
|
119 |
+
$page = FrmAppHelper::simple_get( 'page', 'sanitize_title' );
|
120 |
+
$post_type = FrmAppHelper::simple_get( 'post_type', 'sanitize_title', 'None' );
|
|
|
|
|
121 |
$current_page = isset( $_GET['page'] ) ? $page : $post_type;
|
122 |
+
|
123 |
+
if ( FrmAppHelper::is_view_builder_page() ) {
|
124 |
$current_page = 'frm_display';
|
125 |
}
|
126 |
|
132 |
|
133 |
$nav_items = array(
|
134 |
array(
|
135 |
+
'link' => FrmForm::get_edit_link( $id ),
|
136 |
+
'label' => __( 'Build', 'formidable' ),
|
137 |
+
'current' => array( 'edit', 'new', 'duplicate' ),
|
138 |
+
'page' => 'formidable',
|
139 |
'permission' => 'frm_edit_forms',
|
140 |
),
|
141 |
array(
|
142 |
+
'link' => admin_url( 'admin.php?page=formidable&frm_action=settings&id=' . absint( $id ) ),
|
143 |
+
'label' => __( 'Settings', 'formidable' ),
|
144 |
+
'current' => array( 'settings' ),
|
145 |
+
'page' => 'formidable',
|
146 |
'permission' => 'frm_edit_forms',
|
147 |
),
|
148 |
array(
|
149 |
+
'link' => admin_url( 'admin.php?page=formidable-entries&frm-full=1&frm_action=list&form=' . absint( $id ) ),
|
150 |
+
'label' => __( 'Entries', 'formidable' ),
|
151 |
+
'current' => array(),
|
152 |
+
'page' => 'formidable-entries',
|
153 |
'permission' => 'frm_view_entries',
|
154 |
),
|
155 |
);
|
180 |
'data-medium' => 'reports-nav',
|
181 |
),
|
182 |
);
|
|
|
183 |
}
|
184 |
|
185 |
$nav_args = array(
|
186 |
'form_id' => $id,
|
187 |
'form' => $form,
|
188 |
);
|
189 |
+
|
190 |
return apply_filters( 'frm_form_nav_list', $nav_items, $nav_args );
|
191 |
}
|
192 |
|
193 |
+
// Adds a settings link to the plugins page
|
194 |
+
public static function settings_link( $links ) {
|
195 |
$settings = '<a href="' . esc_url( admin_url( 'admin.php?page=formidable' ) ) . '">' . __( 'Build a Form', 'formidable' ) . '</a>';
|
196 |
+
array_unshift( $links, $settings );
|
197 |
|
198 |
+
return $links;
|
199 |
+
}
|
200 |
|
201 |
+
public static function pro_get_started_headline() {
|
202 |
self::maybe_show_upgrade_bar();
|
203 |
self::review_request();
|
204 |
|
205 |
+
// Don't display this error as we're upgrading the thing, or if the user shouldn't see the message
|
206 |
+
if ( 'upgrade-plugin' == FrmAppHelper::simple_get( 'action', 'sanitize_title' ) || ! current_user_can( 'update_plugins' ) ) {
|
207 |
+
return;
|
208 |
+
}
|
209 |
|
210 |
$pro_installed = is_dir( WP_PLUGIN_DIR . '/formidable-pro' );
|
211 |
$authorized = get_site_option( 'frmpro-authorized' ) && ! is_callable( 'load_formidable_pro' );
|
222 |
$inst_install_url = wp_nonce_url( self_admin_url( 'plugins.php?action=activate&plugin=formidable-pro/formidable-pro.php' ), 'activate-plugin_formidable-pro/formidable-pro.php' );
|
223 |
} else {
|
224 |
$inst_install_url = '#';
|
225 |
+
$download_url = FrmAddonsController::get_pro_download_url();
|
226 |
|
227 |
if ( empty( $download_url ) ) {
|
228 |
$inst_install_url = 'https://formidableforms.com/knowledgebase/install-formidable-forms/?utm_source=WordPress&utm_medium=get-started&utm_campaign=liteplugin';
|
229 |
}
|
230 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
231 |
?>
|
232 |
+
<div class="error frm_previous_install">
|
233 |
+
<?php
|
234 |
+
echo apply_filters( // WPCS: XSS ok.
|
235 |
+
'frm_pro_update_msg',
|
236 |
+
sprintf(
|
237 |
+
/* translators: %1$s: Start link HTML, %2$s: End link HTML, %3$s: Start link HTML, %4$s: End link HTML */
|
238 |
+
esc_html__( 'This site has been previously authorized to run Formidable Forms. %1$sInstall Formidable Pro%2$s or %3$sdeauthorize%4$s this site to continue running the free version and remove this message.', 'formidable' ),
|
239 |
+
'<br/><a href="' . esc_url( $inst_install_url ) . '" id="frm_install_link" target="_blank" data-prourl="' . esc_url( $download_url ) . '">',
|
240 |
+
'</a>',
|
241 |
+
'<a href="#" class="frm_deauthorize_link">',
|
242 |
+
'</a>'
|
243 |
+
),
|
244 |
+
esc_url( $inst_install_url )
|
245 |
+
);
|
246 |
+
?>
|
247 |
+
<div id="frm_install_message" class="hidden frm_hidden"></div>
|
248 |
+
</div>
|
249 |
+
<?php
|
250 |
+
}
|
251 |
|
252 |
private static function maybe_show_upgrade_bar() {
|
253 |
if ( ! FrmAppHelper::is_formidable_admin() || FrmAppHelper::pro_is_installed() ) {
|
256 |
|
257 |
$affiliate = FrmAppHelper::get_affiliate();
|
258 |
if ( ! empty( $affiliate ) ) {
|
259 |
+
$tip = FrmTipsHelper::get_banner_tip();
|
260 |
$link = FrmAppHelper::admin_upgrade_link( 'banner' );
|
261 |
+
?>
|
262 |
+
<div class="update-nag frm-update-to-pro">
|
263 |
+
<?php echo FrmAppHelper::kses( $tip['tip'] ); // WPCS: XSS ok. ?>
|
264 |
+
<span><?php echo FrmAppHelper::kses( $tip['call'] ); // WPCS: XSS ok. ?></span>
|
265 |
+
<a href="<?php echo esc_url( FrmAppHelper::make_affiliate_url( $link ) ); ?>" class="button">
|
266 |
+
Upgrade to Pro
|
267 |
+
</a>
|
268 |
+
</div>
|
269 |
+
<?php
|
270 |
}
|
271 |
}
|
272 |
|
313 |
'content' => 'upgrade',
|
314 |
);
|
315 |
include( FrmAppHelper::plugin_path() . '/classes/views/shared/upgrade_overlay.php' );
|
316 |
+
|
317 |
+
include( FrmAppHelper::plugin_path() . '/classes/views/shared/confirm-overlay.php' );
|
318 |
}
|
319 |
|
320 |
/**
|
338 |
}
|
339 |
}
|
340 |
}
|
341 |
+
|
342 |
return $upsell;
|
343 |
}
|
344 |
|
371 |
if ( ! $needs_upgrade ) {
|
372 |
$needs_upgrade = apply_filters( 'frm_db_needs_upgrade', $needs_upgrade );
|
373 |
}
|
374 |
+
|
375 |
return $needs_upgrade;
|
376 |
}
|
377 |
|
386 |
if ( strpos( $db_version, '-' ) === false ) {
|
387 |
$needs_upgrade = true;
|
388 |
} else {
|
389 |
+
$last_upgrade = explode( '-', $db_version );
|
390 |
$needs_db_upgrade = (int) $last_upgrade[1] < (int) $atts['new_db_version'];
|
391 |
+
$new_version = version_compare( $last_upgrade[0], $atts['new_plugin_version'], '<' );
|
392 |
+
$needs_upgrade = $needs_db_upgrade || $new_version;
|
393 |
}
|
394 |
|
395 |
return $needs_upgrade;
|
407 |
self::network_upgrade_site();
|
408 |
}
|
409 |
|
410 |
+
if ( ! FrmAppHelper::doing_ajax() ) {
|
|
|
411 |
// don't continue during ajax calls
|
412 |
self::admin_js();
|
413 |
}
|
414 |
}
|
415 |
|
416 |
+
public static function admin_js() {
|
417 |
$version = FrmAppHelper::plugin_version();
|
418 |
FrmAppHelper::load_admin_wide_js( false );
|
419 |
|
434 |
|
435 |
wp_register_script( 'formidable_admin', FrmAppHelper::plugin_url() . '/js/formidable_admin.js', $dependecies, $version, true );
|
436 |
wp_register_style( 'formidable-admin', FrmAppHelper::plugin_url() . '/css/frm_admin.css', array(), $version );
|
437 |
+
wp_register_script( 'bootstrap_tooltip', FrmAppHelper::plugin_url() . '/js/bootstrap.min.js', array( 'jquery' ), '3.3.4' );
|
438 |
wp_register_style( 'formidable-grids', FrmAppHelper::plugin_url() . '/css/frm_grids.css', array(), $version );
|
439 |
|
440 |
// load multselect js
|
441 |
+
$depends_on = array( 'jquery', 'bootstrap_tooltip' );
|
442 |
+
wp_register_script( 'bootstrap-multiselect', FrmAppHelper::plugin_url() . '/js/bootstrap-multiselect.js', $depends_on, '0.9.8', true );
|
443 |
|
444 |
+
$page = FrmAppHelper::simple_get( 'page', 'sanitize_title' );
|
445 |
$post_type = FrmAppHelper::simple_get( 'post_type', 'sanitize_title' );
|
446 |
|
447 |
global $pagenow;
|
448 |
if ( strpos( $page, 'formidable' ) === 0 || ( $pagenow == 'edit.php' && $post_type == 'frm_display' ) ) {
|
449 |
|
450 |
+
wp_enqueue_script( 'admin-widgets' );
|
451 |
+
wp_enqueue_style( 'widgets' );
|
452 |
+
wp_enqueue_script( 'formidable' );
|
453 |
+
wp_enqueue_script( 'formidable_admin' );
|
454 |
FrmAppHelper::localize_script( 'admin' );
|
455 |
|
456 |
wp_enqueue_style( 'formidable-admin' );
|
457 |
if ( 'formidable-styles' !== $page ) {
|
458 |
wp_enqueue_style( 'formidable-grids' );
|
459 |
wp_enqueue_style( 'formidable-dropzone' );
|
|
|
460 |
} else {
|
461 |
$settings = FrmAppHelper::get_settings();
|
462 |
if ( empty( $settings->old_css ) ) {
|
464 |
}
|
465 |
}
|
466 |
|
|
|
|
|
467 |
do_action( 'frm_enqueue_builder_scripts' );
|
468 |
+
self::include_upgrade_overlay();
|
469 |
+
} elseif ( FrmAppHelper::is_view_builder_page() ) {
|
470 |
+
if ( isset( $_REQUEST['post_type'] ) ) {
|
471 |
+
$post_type = sanitize_title( wp_unslash( $_REQUEST['post_type'] ) );
|
472 |
+
} elseif ( isset( $_REQUEST['post'] ) && absint( $_REQUEST['post'] ) ) {
|
473 |
+
$post = get_post( absint( wp_unslash( $_REQUEST['post'] ) ) );
|
474 |
+
if ( ! $post ) {
|
475 |
+
return;
|
476 |
+
}
|
477 |
+
$post_type = $post->post_type;
|
478 |
+
} else {
|
479 |
+
return;
|
480 |
+
}
|
481 |
+
|
482 |
+
if ( $post_type == 'frm_display' ) {
|
483 |
+
wp_enqueue_style( 'formidable-grids' );
|
484 |
+
wp_enqueue_script( 'jquery-ui-draggable' );
|
485 |
+
wp_enqueue_script( 'formidable_admin' );
|
486 |
+
wp_enqueue_style( 'formidable-admin' );
|
487 |
FrmAppHelper::localize_script( 'admin' );
|
488 |
+
}
|
489 |
+
} elseif ( $pagenow == 'widgets.php' ) {
|
490 |
+
FrmAppHelper::load_admin_wide_js();
|
491 |
+
}
|
492 |
+
}
|
493 |
|
494 |
+
public static function load_lang() {
|
495 |
+
load_plugin_textdomain( 'formidable', false, FrmAppHelper::plugin_folder() . '/languages/' );
|
496 |
+
}
|
497 |
|
498 |
/**
|
499 |
* Check if the styles are updated when a form is loaded on the front-end
|
555 |
delete_option( 'frm_install_running' );
|
556 |
}
|
557 |
}
|
558 |
+
|
559 |
return true;
|
560 |
}
|
561 |
|
570 |
wp_die();
|
571 |
}
|
572 |
|
573 |
+
public static function install() {
|
574 |
+
$frmdb = new FrmMigrate();
|
575 |
+
$frmdb->upgrade();
|
576 |
+
}
|
577 |
|
578 |
+
public static function uninstall() {
|
579 |
FrmAppHelper::permission_check( 'administrator' );
|
580 |
+
check_ajax_referer( 'frm_ajax', 'nonce' );
|
581 |
|
582 |
$frmdb = new FrmMigrate();
|
583 |
$frmdb->uninstall();
|
586 |
deactivate_plugins( FrmAppHelper::plugin_folder() . '/formidable.php', false, false );
|
587 |
echo esc_url_raw( admin_url( 'plugins.php?deactivate=true' ) );
|
588 |
|
589 |
+
wp_die();
|
590 |
+
}
|
591 |
|
592 |
+
public static function drop_tables( $tables ) {
|
593 |
+
global $wpdb;
|
594 |
+
$tables[] = $wpdb->prefix . 'frm_fields';
|
595 |
+
$tables[] = $wpdb->prefix . 'frm_forms';
|
596 |
+
$tables[] = $wpdb->prefix . 'frm_items';
|
597 |
+
$tables[] = $wpdb->prefix . 'frm_item_metas';
|
|
|
|
|
598 |
|
599 |
+
return $tables;
|
600 |
+
}
|
601 |
+
|
602 |
+
public static function deauthorize() {
|
603 |
FrmAppHelper::permission_check( 'frm_change_settings' );
|
604 |
+
check_ajax_referer( 'frm_ajax', 'nonce' );
|
605 |
|
606 |
+
delete_option( 'frmpro-credentials' );
|
607 |
+
delete_option( 'frmpro-authorized' );
|
608 |
+
delete_site_option( 'frmpro-credentials' );
|
609 |
+
delete_site_option( 'frmpro-authorized' );
|
610 |
+
wp_die();
|
611 |
+
}
|
612 |
|
613 |
public static function set_footer_text( $text ) {
|
614 |
if ( FrmAppHelper::is_formidable_admin() ) {
|
615 |
+
$text = '';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
616 |
}
|
617 |
+
|
618 |
return $text;
|
619 |
}
|
620 |
|
622 |
* @deprecated 1.07.05
|
623 |
* @codeCoverageIgnore
|
624 |
*/
|
625 |
+
public static function get_form_shortcode( $atts ) {
|
626 |
+
return FrmDeprecated::get_form_shortcode( $atts );
|
627 |
+
}
|
628 |
|
629 |
/**
|
630 |
* @deprecated 2.5.4
|
644 |
FrmDeprecated::front_head();
|
645 |
}
|
646 |
|
|
|
647 |
/**
|
648 |
* @deprecated 3.0.04
|
649 |
* @codeCoverageIgnore
|
classes/controllers/FrmEntriesController.php
CHANGED
@@ -16,7 +16,7 @@ class FrmEntriesController {
|
|
16 |
private static function load_manage_entries_hooks() {
|
17 |
if ( ! in_array( FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' ), array( 'edit', 'show', 'new' ) ) ) {
|
18 |
$menu_name = FrmAppHelper::get_menu_name();
|
19 |
-
$base
|
20 |
|
21 |
add_filter( 'manage_' . $base . '_columns', 'FrmEntriesController::manage_columns' );
|
22 |
add_filter( 'get_user_option_' . self::hidden_column_key( $menu_name ), 'FrmEntriesController::hidden_columns' );
|
@@ -26,61 +26,25 @@ class FrmEntriesController {
|
|
26 |
}
|
27 |
}
|
28 |
|
29 |
-
|
30 |
-
|
31 |
$action = FrmAppHelper::get_param( 'frm_action', '', 'get', 'sanitize_title' );
|
32 |
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
return self::display_list();
|
46 |
-
}
|
47 |
-
}
|
48 |
-
|
49 |
-
public static function contextual_help( $help, $screen_id, $screen ) {
|
50 |
-
// Only add to certain screens. add_help_tab was introduced in WordPress 3.3
|
51 |
-
if ( ! method_exists( $screen, 'add_help_tab' ) ) {
|
52 |
-
return $help;
|
53 |
-
}
|
54 |
-
|
55 |
-
$action = FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' );
|
56 |
-
$page = FrmAppHelper::simple_get( 'page', 'sanitize_title' );
|
57 |
-
$show_help = ( $page == 'formidable-entries' && ( empty( $action ) || $action == 'list' ) );
|
58 |
-
if ( ! $show_help ) {
|
59 |
-
return $help;
|
60 |
-
}
|
61 |
-
|
62 |
-
unset( $action, $page );
|
63 |
-
|
64 |
-
$screen->add_help_tab(
|
65 |
-
array(
|
66 |
-
'id' => 'formidable-entries-tab',
|
67 |
-
'title' => __( 'Overview', 'formidable' ),
|
68 |
-
'content' => '<p>' .
|
69 |
-
esc_html__( 'This screen provides access to all of your entries. You can customize the display of this screen to suit your workflow.', 'formidable' ) .
|
70 |
-
'</p> <p>' .
|
71 |
-
esc_html__( 'Hovering over a row in the entries list will display action links that allow you to manage your entry.', 'formidable' ) .
|
72 |
-
'</p>',
|
73 |
-
)
|
74 |
-
);
|
75 |
-
|
76 |
-
$screen->set_help_sidebar(
|
77 |
-
'<p><strong>' . esc_html__( 'For more information:', 'formidable' ) . '</strong></p>' .
|
78 |
-
'<p><a href="' . esc_url( FrmAppHelper::make_affiliate_url( 'https://formidableforms.com/knowledgebase/manage-entries-from-the-back-end/?utm_source=WordPress&utm_medium=entries&utm_campaign=liteplugin' ) ) . '" target="_blank">' . esc_html__( 'Documentation on Entries', 'formidable' ) . '</a></p>' .
|
79 |
-
'<p><a href="' . esc_url( FrmAppHelper::make_affiliate_url( 'https://formidableforms.com/support/?utm_source=WordPress&utm_medium=entries&utm_campaign=liteplugin' ) ) . '" target="_blank">' . esc_html__( 'Support', 'formidable' ) . '</a></p>'
|
80 |
-
);
|
81 |
|
82 |
-
|
83 |
-
|
|
|
84 |
|
85 |
/**
|
86 |
* Prevent the "screen options" tab from showing when
|
@@ -98,17 +62,17 @@ class FrmEntriesController {
|
|
98 |
}
|
99 |
|
100 |
public static function manage_columns( $columns ) {
|
101 |
-
|
102 |
$form_id = FrmForm::get_current_form_id();
|
103 |
|
104 |
-
$columns[ $form_id . '_id' ]
|
105 |
$columns[ $form_id . '_item_key' ] = esc_html__( 'Entry Key', 'formidable' );
|
106 |
|
107 |
if ( $form_id ) {
|
108 |
self::get_columns_for_form( $form_id, $columns );
|
109 |
} else {
|
110 |
$columns[ $form_id . '_form_id' ] = __( 'Form', 'formidable' );
|
111 |
-
$columns[ $form_id . '_name' ]
|
112 |
$columns[ $form_id . '_user_id' ] = __( 'Created By', 'formidable' );
|
113 |
}
|
114 |
|
@@ -116,7 +80,7 @@ class FrmEntriesController {
|
|
116 |
$columns[ $form_id . '_updated_at' ] = __( 'Entry update date', 'formidable' );
|
117 |
self::maybe_add_ip_col( $form_id, $columns );
|
118 |
|
119 |
-
|
120 |
|
121 |
$action = FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' );
|
122 |
if ( FrmAppHelper::is_admin_page( 'formidable-entries' ) && in_array( $action, array( '', 'list', 'destroy' ) ) ) {
|
@@ -128,10 +92,10 @@ class FrmEntriesController {
|
|
128 |
'option' => 'formidable_page_formidable_entries_per_page',
|
129 |
)
|
130 |
);
|
131 |
-
|
132 |
|
133 |
-
|
134 |
-
|
135 |
|
136 |
private static function get_columns_for_form( $form_id, &$columns ) {
|
137 |
$form_cols = FrmField::get_all_for_form( $form_id, '', 'include' );
|
@@ -196,73 +160,76 @@ class FrmEntriesController {
|
|
196 |
public static function check_hidden_cols( $check, $object_id, $meta_key, $meta_value, $prev_value ) {
|
197 |
$this_page_name = self::hidden_column_key();
|
198 |
if ( $meta_key != $this_page_name || $meta_value == $prev_value ) {
|
199 |
-
|
200 |
-
|
201 |
|
202 |
if ( empty( $prev_value ) ) {
|
203 |
$prev_value = get_metadata( 'user', $object_id, $meta_key, true );
|
204 |
}
|
205 |
|
206 |
-
|
207 |
//add a check so we don't create a loop
|
208 |
$frm_vars['prev_hidden_cols'] = ( isset( $frm_vars['prev_hidden_cols'] ) && $frm_vars['prev_hidden_cols'] ) ? false : $prev_value;
|
209 |
|
210 |
-
|
211 |
-
|
212 |
|
213 |
-
|
|
|
|
|
214 |
public static function update_hidden_cols( $meta_id, $object_id, $meta_key, $meta_value ) {
|
215 |
$this_page_name = self::hidden_column_key();
|
216 |
if ( $meta_key != $this_page_name ) {
|
217 |
-
|
218 |
-
|
219 |
|
220 |
global $frm_vars;
|
221 |
if ( ! isset( $frm_vars['prev_hidden_cols'] ) || ! $frm_vars['prev_hidden_cols'] ) {
|
222 |
-
return; //
|
223 |
}
|
224 |
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
|
232 |
$cur_form_prefix = reset( $meta_value );
|
233 |
$cur_form_prefix = explode( '_', $cur_form_prefix );
|
234 |
-
|
235 |
-
|
236 |
|
237 |
-
|
238 |
if ( empty( $prev_hidden ) || in_array( $prev_hidden, $meta_value ) ) {
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
|
243 |
$form_prefix = explode( '_', $prev_hidden );
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
unset( $form_prefix );
|
253 |
-
|
254 |
|
255 |
if ( $save ) {
|
256 |
$user_id = get_current_user_id();
|
257 |
update_user_option( $user_id, $this_page_name, $meta_value, true );
|
258 |
-
|
259 |
-
|
260 |
|
261 |
/**
|
262 |
* @since 2.05.07
|
263 |
*/
|
264 |
private static function hidden_column_key( $menu_name = '' ) {
|
265 |
$base = self::base_column_key( $menu_name );
|
|
|
266 |
return 'manage' . $base . 'columnshidden';
|
267 |
}
|
268 |
|
@@ -273,19 +240,21 @@ class FrmEntriesController {
|
|
273 |
if ( empty( $menu_name ) ) {
|
274 |
$menu_name = FrmAppHelper::get_menu_name();
|
275 |
}
|
|
|
276 |
return sanitize_title( $menu_name ) . '_page_formidable-entries';
|
277 |
}
|
278 |
|
279 |
public static function save_per_page( $save, $option, $value ) {
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
|
|
285 |
|
286 |
public static function sortable_columns() {
|
287 |
$form_id = FrmForm::get_current_form_id();
|
288 |
-
$fields
|
289 |
|
290 |
$columns = array(
|
291 |
$form_id . '_id' => 'id',
|
@@ -315,8 +284,8 @@ class FrmEntriesController {
|
|
315 |
$i = isset( $frm_vars['cols'] ) ? count( $frm_vars['cols'] ) : 0;
|
316 |
|
317 |
if ( ! empty( $hidden ) ) {
|
318 |
-
$result
|
319 |
-
$i
|
320 |
$max_columns = 11;
|
321 |
} else {
|
322 |
$max_columns = 8;
|
@@ -347,6 +316,7 @@ class FrmEntriesController {
|
|
347 |
unset( $form_prefix );
|
348 |
}
|
349 |
}
|
|
|
350 |
return $hidden;
|
351 |
}
|
352 |
|
@@ -362,7 +332,7 @@ class FrmEntriesController {
|
|
362 |
$atts['form_id'] . '_item_key' => '',
|
363 |
$atts['form_id'] . '_id' => '',
|
364 |
);
|
365 |
-
$cols
|
366 |
|
367 |
$i = $atts['i'];
|
368 |
|
@@ -381,69 +351,72 @@ class FrmEntriesController {
|
|
381 |
}
|
382 |
|
383 |
public static function display_list( $message = '', $errors = array() ) {
|
384 |
-
|
385 |
|
386 |
-
$form
|
387 |
$params = FrmForm::get_admin_params( $form );
|
388 |
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
|
393 |
self::get_delete_form_time( $form, $errors );
|
394 |
}
|
395 |
|
396 |
-
|
397 |
|
398 |
-
|
399 |
|
400 |
-
|
401 |
|
402 |
-
|
403 |
|
404 |
-
|
405 |
-
|
406 |
$url = add_query_arg( 'paged', $total_pages );
|
407 |
-
|
408 |
echo FrmAppHelper::js_redirect( $url ); // WPCS: XSS ok.
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
|
415 |
if ( empty( $message ) && isset( $_GET['import-message'] ) ) {
|
416 |
-
|
417 |
-
|
418 |
|
419 |
require( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/list.php' );
|
420 |
-
|
421 |
|
422 |
private static function get_delete_form_time( $form, &$errors ) {
|
423 |
if ( 'trash' == $form->status ) {
|
424 |
$delete_timestamp = time() - ( DAY_IN_SECONDS * EMPTY_TRASH_DAYS );
|
425 |
-
$time_to_delete
|
426 |
-
|
|
|
|
|
427 |
}
|
428 |
}
|
429 |
|
430 |
-
|
431 |
public static function show( $id = 0 ) {
|
432 |
FrmAppHelper::permission_check( 'frm_view_entries' );
|
433 |
|
434 |
-
|
435 |
$id = FrmAppHelper::get_param( 'id', 0, 'get', 'absint' );
|
436 |
|
437 |
-
|
438 |
$id = FrmAppHelper::get_param( 'item_id', 0, 'get', 'absint' );
|
439 |
-
|
440 |
-
|
441 |
|
442 |
$entry = FrmEntry::getOne( $id, true );
|
443 |
if ( ! $entry ) {
|
444 |
echo '<div id="form_show_entry_page" class="wrap">' .
|
445 |
esc_html__( 'You are trying to view an entry that does not exist.', 'formidable' ) .
|
446 |
'</div>';
|
|
|
447 |
return;
|
448 |
}
|
449 |
|
@@ -453,66 +426,66 @@ class FrmEntriesController {
|
|
453 |
}
|
454 |
|
455 |
$fields = FrmField::get_all_for_form( $entry->form_id, '', 'include' );
|
456 |
-
|
457 |
-
$form = FrmForm::getOne( $entry->form_id );
|
458 |
|
459 |
include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/show.php' );
|
460 |
-
|
461 |
|
462 |
-
|
463 |
FrmAppHelper::permission_check( 'frm_delete_entries' );
|
464 |
|
465 |
$params = FrmForm::get_admin_params();
|
466 |
|
467 |
if ( isset( $params['keep_post'] ) && $params['keep_post'] ) {
|
468 |
self::unlink_post( $params['id'] );
|
469 |
-
|
|
|
|
|
|
|
|
|
|
|
470 |
|
471 |
-
|
472 |
-
|
473 |
-
$message = __( 'Entry was Successfully Destroyed', 'formidable' );
|
474 |
-
}
|
475 |
|
476 |
-
|
477 |
-
|
|
|
|
|
|
|
478 |
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
}
|
484 |
|
485 |
-
$
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
}
|
500 |
-
}
|
501 |
-
|
502 |
-
$results = self::delete_form_entries( $form_id );
|
503 |
-
if ( $results ) {
|
504 |
FrmEntry::clear_cache();
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
|
511 |
-
|
512 |
-
|
513 |
|
514 |
/**
|
515 |
* @since 3.01
|
|
|
516 |
* @param int $form_id
|
517 |
*/
|
518 |
private static function delete_form_entries( $form_id ) {
|
@@ -520,26 +493,28 @@ class FrmEntriesController {
|
|
520 |
|
521 |
$form_ids = self::get_child_form_ids( $form_id );
|
522 |
|
523 |
-
$meta_query
|
524 |
$entry_query = $wpdb->prepare( "DELETE FROM {$wpdb->prefix}frm_items WHERE form_id=%d", $form_id );
|
525 |
|
526 |
if ( ! empty( $form_ids ) ) {
|
527 |
-
$form_query
|
528 |
-
$meta_query
|
529 |
$entry_query .= $form_query;
|
530 |
}
|
531 |
|
532 |
$wpdb->query( $meta_query ); // WPCS: unprepared SQL ok.
|
|
|
533 |
return $wpdb->query( $entry_query ); // WPCS: unprepared SQL ok.
|
534 |
}
|
535 |
|
536 |
/**
|
537 |
* @since 3.01
|
|
|
538 |
* @param int $form_id
|
539 |
* @param bool|string $implode
|
540 |
*/
|
541 |
private static function get_child_form_ids( $form_id, $implode = ',' ) {
|
542 |
-
$form_ids
|
543 |
$child_form_ids = FrmDb::get_col( 'frm_forms', array( 'parent_form_id' => $form_id ) );
|
544 |
if ( $child_form_ids ) {
|
545 |
$form_ids = $child_form_ids;
|
@@ -548,36 +523,37 @@ class FrmEntriesController {
|
|
548 |
if ( $implode ) {
|
549 |
$form_ids = implode( $implode, $form_ids );
|
550 |
}
|
|
|
551 |
return $form_ids;
|
552 |
}
|
553 |
|
554 |
-
|
555 |
$form_id = FrmAppHelper::get_post_param( 'form_id', '', 'absint' );
|
556 |
if ( FrmAppHelper::is_admin() || empty( $_POST ) || empty( $form_id ) || ! isset( $_POST['item_key'] ) ) {
|
557 |
-
|
558 |
-
|
559 |
|
560 |
-
|
561 |
|
562 |
$form = FrmForm::getOne( $form_id );
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
|
567 |
$params = FrmForm::get_params( $form );
|
568 |
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
$frm_vars['form_params'][ $form->id ] = $params;
|
573 |
|
574 |
if ( isset( $frm_vars['created_entries'][ $form_id ] ) ) {
|
575 |
-
|
576 |
-
|
577 |
|
578 |
-
|
579 |
$errors = FrmEntryValidate::validate( $_POST );
|
580 |
-
|
581 |
|
582 |
/**
|
583 |
* Use this filter to add trigger actions and add errors after
|
@@ -589,24 +565,25 @@ class FrmEntriesController {
|
|
589 |
|
590 |
$frm_vars['created_entries'][ $form_id ] = array( 'errors' => $errors );
|
591 |
|
592 |
-
|
593 |
$_POST['frm_skip_cookie'] = 1;
|
594 |
-
$do_success
|
595 |
-
|
596 |
if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][ $form_id ]['entry_id'] ) ) {
|
597 |
$frm_vars['created_entries'][ $form_id ]['entry_id'] = FrmEntry::create( $_POST );
|
|
|
598 |
$params['id'] = $frm_vars['created_entries'][ $form_id ]['entry_id'];
|
599 |
-
$do_success
|
600 |
-
|
601 |
-
|
602 |
|
603 |
-
|
604 |
if ( $do_success ) {
|
605 |
FrmFormsController::maybe_trigger_redirect( $form, $params, array( 'ajax' => $ajax ) );
|
606 |
}
|
607 |
unset( $_POST['frm_skip_cookie'] );
|
608 |
-
|
609 |
-
|
610 |
|
611 |
/**
|
612 |
* Escape url entities before redirect
|
@@ -614,33 +591,39 @@ class FrmEntriesController {
|
|
614 |
* @since 3.0
|
615 |
*
|
616 |
* @param string $url
|
|
|
617 |
* @return string
|
618 |
*/
|
619 |
public static function prepare_redirect_url( $url ) {
|
620 |
return str_replace( array( ' ', '[', ']', '|', '@' ), array( '%20', '%5B', '%5D', '%7C', '%40' ), $url );
|
621 |
}
|
622 |
|
623 |
-
|
624 |
-
|
625 |
-
return $url;
|
626 |
-
}
|
627 |
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
632 |
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
|
638 |
-
|
639 |
-
|
640 |
self::unlink_post( $entry_id );
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
|
645 |
/**
|
646 |
* Unlink entry from post
|
@@ -675,6 +658,7 @@ class FrmEntriesController {
|
|
675 |
'border_color' => '',
|
676 |
'bg_color' => '',
|
677 |
'alt_bg_color' => '',
|
|
|
678 |
'clickable' => false,
|
679 |
'exclude_fields' => '',
|
680 |
'include_fields' => '',
|
@@ -691,8 +675,9 @@ class FrmEntriesController {
|
|
691 |
'format' => $atts['format'],
|
692 |
'plain_text' => $atts['plain_text'],
|
693 |
);
|
694 |
-
|
695 |
-
$
|
|
|
696 |
|
697 |
} else {
|
698 |
|
@@ -704,8 +689,8 @@ class FrmEntriesController {
|
|
704 |
return $formatted_entry;
|
705 |
}
|
706 |
|
707 |
-
public static function entry_sidebar( $entry ) {
|
708 |
-
$data
|
709 |
$date_format = get_option( 'date_format' );
|
710 |
$time_format = get_option( 'time_format' );
|
711 |
if ( isset( $data['browser'] ) ) {
|
@@ -713,7 +698,15 @@ class FrmEntriesController {
|
|
713 |
}
|
714 |
|
715 |
include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/sidebar-shared.php' );
|
716 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
717 |
|
718 |
/**
|
719 |
* @deprecated 1.07.05
|
16 |
private static function load_manage_entries_hooks() {
|
17 |
if ( ! in_array( FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' ), array( 'edit', 'show', 'new' ) ) ) {
|
18 |
$menu_name = FrmAppHelper::get_menu_name();
|
19 |
+
$base = self::base_column_key( $menu_name );
|
20 |
|
21 |
add_filter( 'manage_' . $base . '_columns', 'FrmEntriesController::manage_columns' );
|
22 |
add_filter( 'get_user_option_' . self::hidden_column_key( $menu_name ), 'FrmEntriesController::hidden_columns' );
|
26 |
}
|
27 |
}
|
28 |
|
29 |
+
/* Display in Back End */
|
30 |
+
public static function route() {
|
31 |
$action = FrmAppHelper::get_param( 'frm_action', '', 'get', 'sanitize_title' );
|
32 |
|
33 |
+
switch ( $action ) {
|
34 |
+
case 'show':
|
35 |
+
case 'destroy':
|
36 |
+
case 'destroy_all':
|
37 |
+
return self::$action();
|
38 |
|
39 |
+
default:
|
40 |
+
do_action( 'frm_entry_action_route', $action );
|
41 |
+
if ( apply_filters( 'frm_entry_stop_action_route', false, $action ) ) {
|
42 |
+
return;
|
43 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
|
45 |
+
return self::display_list();
|
46 |
+
}
|
47 |
+
}
|
48 |
|
49 |
/**
|
50 |
* Prevent the "screen options" tab from showing when
|
62 |
}
|
63 |
|
64 |
public static function manage_columns( $columns ) {
|
65 |
+
global $frm_vars;
|
66 |
$form_id = FrmForm::get_current_form_id();
|
67 |
|
68 |
+
$columns[ $form_id . '_id' ] = 'ID';
|
69 |
$columns[ $form_id . '_item_key' ] = esc_html__( 'Entry Key', 'formidable' );
|
70 |
|
71 |
if ( $form_id ) {
|
72 |
self::get_columns_for_form( $form_id, $columns );
|
73 |
} else {
|
74 |
$columns[ $form_id . '_form_id' ] = __( 'Form', 'formidable' );
|
75 |
+
$columns[ $form_id . '_name' ] = __( 'Entry Name', 'formidable' );
|
76 |
$columns[ $form_id . '_user_id' ] = __( 'Created By', 'formidable' );
|
77 |
}
|
78 |
|
80 |
$columns[ $form_id . '_updated_at' ] = __( 'Entry update date', 'formidable' );
|
81 |
self::maybe_add_ip_col( $form_id, $columns );
|
82 |
|
83 |
+
$frm_vars['cols'] = $columns;
|
84 |
|
85 |
$action = FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' );
|
86 |
if ( FrmAppHelper::is_admin_page( 'formidable-entries' ) && in_array( $action, array( '', 'list', 'destroy' ) ) ) {
|
92 |
'option' => 'formidable_page_formidable_entries_per_page',
|
93 |
)
|
94 |
);
|
95 |
+
}
|
96 |
|
97 |
+
return $columns;
|
98 |
+
}
|
99 |
|
100 |
private static function get_columns_for_form( $form_id, &$columns ) {
|
101 |
$form_cols = FrmField::get_all_for_form( $form_id, '', 'include' );
|
160 |
public static function check_hidden_cols( $check, $object_id, $meta_key, $meta_value, $prev_value ) {
|
161 |
$this_page_name = self::hidden_column_key();
|
162 |
if ( $meta_key != $this_page_name || $meta_value == $prev_value ) {
|
163 |
+
return $check;
|
164 |
+
}
|
165 |
|
166 |
if ( empty( $prev_value ) ) {
|
167 |
$prev_value = get_metadata( 'user', $object_id, $meta_key, true );
|
168 |
}
|
169 |
|
170 |
+
global $frm_vars;
|
171 |
//add a check so we don't create a loop
|
172 |
$frm_vars['prev_hidden_cols'] = ( isset( $frm_vars['prev_hidden_cols'] ) && $frm_vars['prev_hidden_cols'] ) ? false : $prev_value;
|
173 |
|
174 |
+
return $check;
|
175 |
+
}
|
176 |
|
177 |
+
/**
|
178 |
+
* Add hidden columns back from other forms
|
179 |
+
*/
|
180 |
public static function update_hidden_cols( $meta_id, $object_id, $meta_key, $meta_value ) {
|
181 |
$this_page_name = self::hidden_column_key();
|
182 |
if ( $meta_key != $this_page_name ) {
|
183 |
+
return;
|
184 |
+
}
|
185 |
|
186 |
global $frm_vars;
|
187 |
if ( ! isset( $frm_vars['prev_hidden_cols'] ) || ! $frm_vars['prev_hidden_cols'] ) {
|
188 |
+
return; // Don't continue if there's no previous value.
|
189 |
}
|
190 |
|
191 |
+
foreach ( $meta_value as $mk => $mv ) {
|
192 |
+
// Remove blank values.
|
193 |
+
if ( empty( $mv ) ) {
|
194 |
+
unset( $meta_value[ $mk ] );
|
195 |
+
}
|
196 |
+
}
|
197 |
|
198 |
$cur_form_prefix = reset( $meta_value );
|
199 |
$cur_form_prefix = explode( '_', $cur_form_prefix );
|
200 |
+
$cur_form_prefix = $cur_form_prefix[0];
|
201 |
+
$save = false;
|
202 |
|
203 |
+
foreach ( (array) $frm_vars['prev_hidden_cols'] as $prev_hidden ) {
|
204 |
if ( empty( $prev_hidden ) || in_array( $prev_hidden, $meta_value ) ) {
|
205 |
+
// Don't add blank cols or process included cols.
|
206 |
+
continue;
|
207 |
+
}
|
208 |
|
209 |
$form_prefix = explode( '_', $prev_hidden );
|
210 |
+
$form_prefix = $form_prefix[0];
|
211 |
+
if ( $form_prefix == $cur_form_prefix ) {
|
212 |
+
// Don't add back columns that are meant to be hidden.
|
213 |
+
continue;
|
214 |
+
}
|
215 |
+
|
216 |
+
$meta_value[] = $prev_hidden;
|
217 |
+
$save = true;
|
218 |
unset( $form_prefix );
|
219 |
+
}
|
220 |
|
221 |
if ( $save ) {
|
222 |
$user_id = get_current_user_id();
|
223 |
update_user_option( $user_id, $this_page_name, $meta_value, true );
|
224 |
+
}
|
225 |
+
}
|
226 |
|
227 |
/**
|
228 |
* @since 2.05.07
|
229 |
*/
|
230 |
private static function hidden_column_key( $menu_name = '' ) {
|
231 |
$base = self::base_column_key( $menu_name );
|
232 |
+
|
233 |
return 'manage' . $base . 'columnshidden';
|
234 |
}
|
235 |
|
240 |
if ( empty( $menu_name ) ) {
|
241 |
$menu_name = FrmAppHelper::get_menu_name();
|
242 |
}
|
243 |
+
|
244 |
return sanitize_title( $menu_name ) . '_page_formidable-entries';
|
245 |
}
|
246 |
|
247 |
public static function save_per_page( $save, $option, $value ) {
|
248 |
+
if ( $option == 'formidable_page_formidable_entries_per_page' ) {
|
249 |
+
$save = (int) $value;
|
250 |
+
}
|
251 |
+
|
252 |
+
return $save;
|
253 |
+
}
|
254 |
|
255 |
public static function sortable_columns() {
|
256 |
$form_id = FrmForm::get_current_form_id();
|
257 |
+
$fields = FrmField::get_all_for_form( $form_id );
|
258 |
|
259 |
$columns = array(
|
260 |
$form_id . '_id' => 'id',
|
284 |
$i = isset( $frm_vars['cols'] ) ? count( $frm_vars['cols'] ) : 0;
|
285 |
|
286 |
if ( ! empty( $hidden ) ) {
|
287 |
+
$result = $hidden;
|
288 |
+
$i = $i - count( $result );
|
289 |
$max_columns = 11;
|
290 |
} else {
|
291 |
$max_columns = 8;
|
316 |
unset( $form_prefix );
|
317 |
}
|
318 |
}
|
319 |
+
|
320 |
return $hidden;
|
321 |
}
|
322 |
|
332 |
$atts['form_id'] . '_item_key' => '',
|
333 |
$atts['form_id'] . '_id' => '',
|
334 |
);
|
335 |
+
$cols = $remove_first + array_reverse( $frm_vars['cols'], true );
|
336 |
|
337 |
$i = $atts['i'];
|
338 |
|
351 |
}
|
352 |
|
353 |
public static function display_list( $message = '', $errors = array() ) {
|
354 |
+
global $wpdb, $frm_vars;
|
355 |
|
356 |
+
$form = FrmForm::maybe_get_current_form();
|
357 |
$params = FrmForm::get_admin_params( $form );
|
358 |
|
359 |
+
if ( $form ) {
|
360 |
+
$params['form'] = $form->id;
|
361 |
+
$frm_vars['current_form'] = $form;
|
362 |
|
363 |
self::get_delete_form_time( $form, $errors );
|
364 |
}
|
365 |
|
366 |
+
$table_class = apply_filters( 'frm_entries_list_class', 'FrmEntriesListHelper' );
|
367 |
|
368 |
+
$wp_list_table = new $table_class( array( 'params' => $params ) );
|
369 |
|
370 |
+
$pagenum = $wp_list_table->get_pagenum();
|
371 |
|
372 |
+
$wp_list_table->prepare_items();
|
373 |
|
374 |
+
$total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
|
375 |
+
if ( $pagenum > $total_pages && $total_pages > 0 ) {
|
376 |
$url = add_query_arg( 'paged', $total_pages );
|
377 |
+
if ( headers_sent() ) {
|
378 |
echo FrmAppHelper::js_redirect( $url ); // WPCS: XSS ok.
|
379 |
+
} else {
|
380 |
+
wp_redirect( esc_url_raw( $url ) );
|
381 |
+
}
|
382 |
+
die();
|
383 |
+
}
|
384 |
|
385 |
if ( empty( $message ) && isset( $_GET['import-message'] ) ) {
|
386 |
+
$message = __( 'Your import is complete', 'formidable' );
|
387 |
+
}
|
388 |
|
389 |
require( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/list.php' );
|
390 |
+
}
|
391 |
|
392 |
private static function get_delete_form_time( $form, &$errors ) {
|
393 |
if ( 'trash' == $form->status ) {
|
394 |
$delete_timestamp = time() - ( DAY_IN_SECONDS * EMPTY_TRASH_DAYS );
|
395 |
+
$time_to_delete = FrmAppHelper::human_time_diff( $delete_timestamp, ( isset( $form->options['trash_time'] ) ? ( $form->options['trash_time'] ) : time() ) );
|
396 |
+
|
397 |
+
/* translators: %1$s: Time string */
|
398 |
+
$errors['trash'] = sprintf( __( 'This form is in the trash and is scheduled to be deleted permanently in %s along with any entries.', 'formidable' ), $time_to_delete );
|
399 |
}
|
400 |
}
|
401 |
|
402 |
+
/* Back End CRUD */
|
403 |
public static function show( $id = 0 ) {
|
404 |
FrmAppHelper::permission_check( 'frm_view_entries' );
|
405 |
|
406 |
+
if ( ! $id ) {
|
407 |
$id = FrmAppHelper::get_param( 'id', 0, 'get', 'absint' );
|
408 |
|
409 |
+
if ( ! $id ) {
|
410 |
$id = FrmAppHelper::get_param( 'item_id', 0, 'get', 'absint' );
|
411 |
+
}
|
412 |
+
}
|
413 |
|
414 |
$entry = FrmEntry::getOne( $id, true );
|
415 |
if ( ! $entry ) {
|
416 |
echo '<div id="form_show_entry_page" class="wrap">' .
|
417 |
esc_html__( 'You are trying to view an entry that does not exist.', 'formidable' ) .
|
418 |
'</div>';
|
419 |
+
|
420 |
return;
|
421 |
}
|
422 |
|
426 |
}
|
427 |
|
428 |
$fields = FrmField::get_all_for_form( $entry->form_id, '', 'include' );
|
429 |
+
$form = FrmForm::getOne( $entry->form_id );
|
|
|
430 |
|
431 |
include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/show.php' );
|
432 |
+
}
|
433 |
|
434 |
+
public static function destroy() {
|
435 |
FrmAppHelper::permission_check( 'frm_delete_entries' );
|
436 |
|
437 |
$params = FrmForm::get_admin_params();
|
438 |
|
439 |
if ( isset( $params['keep_post'] ) && $params['keep_post'] ) {
|
440 |
self::unlink_post( $params['id'] );
|
441 |
+
}
|
442 |
+
|
443 |
+
$message = '';
|
444 |
+
if ( FrmEntry::destroy( $params['id'] ) ) {
|
445 |
+
$message = __( 'Entry was Successfully Deleted', 'formidable' );
|
446 |
+
}
|
447 |
|
448 |
+
self::display_list( $message );
|
449 |
+
}
|
|
|
|
|
450 |
|
451 |
+
public static function destroy_all() {
|
452 |
+
if ( ! current_user_can( 'frm_delete_entries' ) ) {
|
453 |
+
$frm_settings = FrmAppHelper::get_settings();
|
454 |
+
wp_die( esc_html( $frm_settings->admin_permission ) );
|
455 |
+
}
|
456 |
|
457 |
+
$params = FrmForm::get_admin_params();
|
458 |
+
$message = '';
|
459 |
+
$errors = array();
|
460 |
+
$form_id = (int) $params['form'];
|
|
|
461 |
|
462 |
+
if ( $form_id ) {
|
463 |
+
$entry_ids = FrmDb::get_col( 'frm_items', array( 'form_id' => $form_id ) );
|
464 |
+
$action = FrmFormAction::get_action_for_form( $form_id, 'wppost', 1 );
|
465 |
+
|
466 |
+
if ( $action ) {
|
467 |
+
// This action takes a while, so only trigger it if there are posts to delete.
|
468 |
+
foreach ( $entry_ids as $entry_id ) {
|
469 |
+
do_action( 'frm_before_destroy_entry', $entry_id );
|
470 |
+
unset( $entry_id );
|
471 |
+
}
|
472 |
+
}
|
473 |
+
|
474 |
+
$results = self::delete_form_entries( $form_id );
|
475 |
+
if ( $results ) {
|
|
|
|
|
|
|
|
|
|
|
476 |
FrmEntry::clear_cache();
|
477 |
+
$message = __( 'Entries Successfully Deleted', 'formidable' );
|
478 |
+
}
|
479 |
+
} else {
|
480 |
+
$errors = __( 'No Entries Selected', 'formidable' );
|
481 |
+
}
|
482 |
|
483 |
+
self::display_list( $message, $errors );
|
484 |
+
}
|
485 |
|
486 |
/**
|
487 |
* @since 3.01
|
488 |
+
*
|
489 |
* @param int $form_id
|
490 |
*/
|
491 |
private static function delete_form_entries( $form_id ) {
|
493 |
|
494 |
$form_ids = self::get_child_form_ids( $form_id );
|
495 |
|
496 |
+
$meta_query = $wpdb->prepare( "DELETE em.* FROM {$wpdb->prefix}frm_item_metas as em INNER JOIN {$wpdb->prefix}frm_items as e on (em.item_id=e.id) WHERE form_id=%d", $form_id );
|
497 |
$entry_query = $wpdb->prepare( "DELETE FROM {$wpdb->prefix}frm_items WHERE form_id=%d", $form_id );
|
498 |
|
499 |
if ( ! empty( $form_ids ) ) {
|
500 |
+
$form_query = ' OR form_id in (' . $form_ids . ')';
|
501 |
+
$meta_query .= $form_query;
|
502 |
$entry_query .= $form_query;
|
503 |
}
|
504 |
|
505 |
$wpdb->query( $meta_query ); // WPCS: unprepared SQL ok.
|
506 |
+
|
507 |
return $wpdb->query( $entry_query ); // WPCS: unprepared SQL ok.
|
508 |
}
|
509 |
|
510 |
/**
|
511 |
* @since 3.01
|
512 |
+
*
|
513 |
* @param int $form_id
|
514 |
* @param bool|string $implode
|
515 |
*/
|
516 |
private static function get_child_form_ids( $form_id, $implode = ',' ) {
|
517 |
+
$form_ids = array();
|
518 |
$child_form_ids = FrmDb::get_col( 'frm_forms', array( 'parent_form_id' => $form_id ) );
|
519 |
if ( $child_form_ids ) {
|
520 |
$form_ids = $child_form_ids;
|
523 |
if ( $implode ) {
|
524 |
$form_ids = implode( $implode, $form_ids );
|
525 |
}
|
526 |
+
|
527 |
return $form_ids;
|
528 |
}
|
529 |
|
530 |
+
public static function process_entry( $errors = '', $ajax = false ) {
|
531 |
$form_id = FrmAppHelper::get_post_param( 'form_id', '', 'absint' );
|
532 |
if ( FrmAppHelper::is_admin() || empty( $_POST ) || empty( $form_id ) || ! isset( $_POST['item_key'] ) ) {
|
533 |
+
return;
|
534 |
+
}
|
535 |
|
536 |
+
global $frm_vars;
|
537 |
|
538 |
$form = FrmForm::getOne( $form_id );
|
539 |
+
if ( ! $form ) {
|
540 |
+
return;
|
541 |
+
}
|
542 |
|
543 |
$params = FrmForm::get_params( $form );
|
544 |
|
545 |
+
if ( ! isset( $frm_vars['form_params'] ) ) {
|
546 |
+
$frm_vars['form_params'] = array();
|
547 |
+
}
|
548 |
$frm_vars['form_params'][ $form->id ] = $params;
|
549 |
|
550 |
if ( isset( $frm_vars['created_entries'][ $form_id ] ) ) {
|
551 |
+
return;
|
552 |
+
}
|
553 |
|
554 |
+
if ( $errors == '' && ! $ajax ) {
|
555 |
$errors = FrmEntryValidate::validate( $_POST );
|
556 |
+
}
|
557 |
|
558 |
/**
|
559 |
* Use this filter to add trigger actions and add errors after
|
565 |
|
566 |
$frm_vars['created_entries'][ $form_id ] = array( 'errors' => $errors );
|
567 |
|
568 |
+
if ( empty( $errors ) ) {
|
569 |
$_POST['frm_skip_cookie'] = 1;
|
570 |
+
$do_success = false;
|
571 |
+
if ( $params['action'] == 'create' ) {
|
572 |
if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][ $form_id ]['entry_id'] ) ) {
|
573 |
$frm_vars['created_entries'][ $form_id ]['entry_id'] = FrmEntry::create( $_POST );
|
574 |
+
|
575 |
$params['id'] = $frm_vars['created_entries'][ $form_id ]['entry_id'];
|
576 |
+
$do_success = true;
|
577 |
+
}
|
578 |
+
}
|
579 |
|
580 |
+
do_action( 'frm_process_entry', $params, $errors, $form, array( 'ajax' => $ajax ) );
|
581 |
if ( $do_success ) {
|
582 |
FrmFormsController::maybe_trigger_redirect( $form, $params, array( 'ajax' => $ajax ) );
|
583 |
}
|
584 |
unset( $_POST['frm_skip_cookie'] );
|
585 |
+
}
|
586 |
+
}
|
587 |
|
588 |
/**
|
589 |
* Escape url entities before redirect
|
591 |
* @since 3.0
|
592 |
*
|
593 |
* @param string $url
|
594 |
+
*
|
595 |
* @return string
|
596 |
*/
|
597 |
public static function prepare_redirect_url( $url ) {
|
598 |
return str_replace( array( ' ', '[', ']', '|', '@' ), array( '%20', '%5B', '%5D', '%7C', '%40' ), $url );
|
599 |
}
|
600 |
|
601 |
+
public static function delete_entry_before_redirect( $url, $form, $atts ) {
|
602 |
+
self::_delete_entry( $atts['id'], $form );
|
|
|
|
|
603 |
|
604 |
+
return $url;
|
605 |
+
}
|
606 |
+
|
607 |
+
/**
|
608 |
+
* Delete entry if not redirected.
|
609 |
+
*
|
610 |
+
* @param array $atts
|
611 |
+
*/
|
612 |
+
public static function delete_entry_after_save( $atts ) {
|
613 |
+
self::_delete_entry( $atts['entry_id'], $atts['form'] );
|
614 |
+
}
|
615 |
|
616 |
+
private static function _delete_entry( $entry_id, $form ) {
|
617 |
+
if ( ! $form ) {
|
618 |
+
return;
|
619 |
+
}
|
620 |
|
621 |
+
$form->options = maybe_unserialize( $form->options );
|
622 |
+
if ( isset( $form->options['no_save'] ) && $form->options['no_save'] ) {
|
623 |
self::unlink_post( $entry_id );
|
624 |
+
FrmEntry::destroy( $entry_id );
|
625 |
+
}
|
626 |
+
}
|
627 |
|
628 |
/**
|
629 |
* Unlink entry from post
|
658 |
'border_color' => '',
|
659 |
'bg_color' => '',
|
660 |
'alt_bg_color' => '',
|
661 |
+
'class' => '',
|
662 |
'clickable' => false,
|
663 |
'exclude_fields' => '',
|
664 |
'include_fields' => '',
|
675 |
'format' => $atts['format'],
|
676 |
'plain_text' => $atts['plain_text'],
|
677 |
);
|
678 |
+
|
679 |
+
$entry_formatter = FrmEntryFactory::entry_shortcode_formatter_instance( $atts['form_id'], $shortcode_atts );
|
680 |
+
$formatted_entry = $entry_formatter->content();
|
681 |
|
682 |
} else {
|
683 |
|
689 |
return $formatted_entry;
|
690 |
}
|
691 |
|
692 |
+
public static function entry_sidebar( $entry = false ) {
|
693 |
+
$data = maybe_unserialize( $entry->description );
|
694 |
$date_format = get_option( 'date_format' );
|
695 |
$time_format = get_option( 'time_format' );
|
696 |
if ( isset( $data['browser'] ) ) {
|
698 |
}
|
699 |
|
700 |
include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/sidebar-shared.php' );
|
701 |
+
}
|
702 |
+
|
703 |
+
/**
|
704 |
+
* @deprecated 4.0
|
705 |
+
*/
|
706 |
+
public static function contextual_help( $help, $screen_id, $screen ) {
|
707 |
+
_deprecated_function( __METHOD__, '4.0' );
|
708 |
+
return $help;
|
709 |
+
}
|
710 |
|
711 |
/**
|
712 |
* @deprecated 1.07.05
|
classes/controllers/FrmFieldsController.php
CHANGED
@@ -2,25 +2,24 @@
|
|
2 |
|
3 |
class FrmFieldsController {
|
4 |
|
5 |
-
|
6 |
FrmAppHelper::permission_check( 'frm_edit_forms' );
|
7 |
-
|
8 |
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
|
14 |
-
|
15 |
-
$fields = stripslashes_deep( $fields );
|
16 |
|
17 |
-
$values
|
18 |
-
'id'
|
19 |
'doing_ajax' => true,
|
20 |
);
|
21 |
-
|
22 |
|
23 |
-
|
24 |
$field = htmlspecialchars_decode( nl2br( $field ) );
|
25 |
$field = json_decode( $field );
|
26 |
if ( ! isset( $field->id ) || ! is_numeric( $field->id ) ) {
|
@@ -32,54 +31,55 @@ class FrmFieldsController {
|
|
32 |
$field->value = '';
|
33 |
}
|
34 |
$field->field_options = json_decode( json_encode( $field->field_options ), true );
|
35 |
-
$field->options
|
36 |
$field->default_value = json_decode( json_encode( $field->default_value ), true );
|
37 |
|
38 |
ob_start();
|
39 |
self::load_single_field( $field, $values );
|
40 |
$field_html[ absint( $field->id ) ] = ob_get_contents();
|
41 |
ob_end_clean();
|
42 |
-
|
43 |
|
44 |
echo json_encode( $field_html );
|
45 |
|
46 |
-
|
47 |
-
|
48 |
|
49 |
/**
|
50 |
* Create a new field with ajax
|
51 |
*/
|
52 |
-
|
53 |
FrmAppHelper::permission_check( 'frm_edit_forms' );
|
54 |
-
|
55 |
|
56 |
$field_type = FrmAppHelper::get_post_param( 'field_type', '', 'sanitize_text_field' );
|
57 |
-
$form_id
|
58 |
|
59 |
$field = self::include_new_field( $field_type, $form_id );
|
60 |
|
61 |
// this hook will allow for multiple fields to be added at once
|
62 |
do_action( 'frm_after_field_created', $field, $form_id );
|
63 |
|
64 |
-
|
65 |
-
|
66 |
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
|
|
74 |
public static function include_new_field( $field_type, $form_id ) {
|
75 |
$field_values = FrmFieldsHelper::setup_new_vars( $field_type, $form_id );
|
76 |
-
|
77 |
|
78 |
-
|
79 |
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
|
84 |
$field = self::get_field_array_from_id( $field_id );
|
85 |
|
@@ -95,47 +95,20 @@ class FrmFieldsController {
|
|
95 |
|
96 |
self::load_single_field( $field, $values, $form_id );
|
97 |
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
public static function update_ajax_option() {
|
102 |
-
FrmAppHelper::permission_check( 'frm_edit_forms' );
|
103 |
-
check_ajax_referer( 'frm_ajax', 'nonce' );
|
104 |
-
|
105 |
-
$field_id = FrmAppHelper::get_post_param( 'field', 0, 'absint' );
|
106 |
-
if ( ! $field_id ) {
|
107 |
-
wp_die();
|
108 |
-
}
|
109 |
-
|
110 |
-
$field = FrmField::getOne( $field_id );
|
111 |
-
|
112 |
-
if ( isset( $_POST['separate_value'] ) ) {
|
113 |
-
$new_val = FrmField::is_option_true( $field, 'separate_value' ) ? 0 : 1;
|
114 |
-
$field->field_options['separate_value'] = $new_val;
|
115 |
-
unset( $new_val );
|
116 |
-
}
|
117 |
-
|
118 |
-
FrmField::update(
|
119 |
-
$field_id,
|
120 |
-
array(
|
121 |
-
'field_options' => $field->field_options,
|
122 |
-
'form_id' => $field->form_id,
|
123 |
-
)
|
124 |
-
);
|
125 |
-
wp_die();
|
126 |
-
}
|
127 |
|
128 |
-
|
129 |
FrmAppHelper::permission_check( 'frm_edit_forms' );
|
130 |
-
|
131 |
|
132 |
$field_id = FrmAppHelper::get_post_param( 'field_id', 0, 'absint' );
|
133 |
-
$form_id
|
134 |
|
135 |
$copy_field = FrmField::getOne( $field_id );
|
136 |
-
|
137 |
wp_die();
|
138 |
-
|
139 |
|
140 |
do_action( 'frm_duplicate_field', $copy_field, $form_id );
|
141 |
do_action( 'frm_duplicate_field_' . $copy_field->type, $copy_field, $form_id );
|
@@ -151,8 +124,8 @@ class FrmFieldsController {
|
|
151 |
self::load_single_field( $field_id, $values );
|
152 |
}
|
153 |
|
154 |
-
|
155 |
-
|
156 |
|
157 |
/**
|
158 |
* @since 3.0
|
@@ -163,6 +136,7 @@ class FrmFieldsController {
|
|
163 |
*/
|
164 |
public static function get_field_array_from_id( $field_id ) {
|
165 |
$field = FrmField::getOne( $field_id );
|
|
|
166 |
return FrmFieldsHelper::setup_edit_vars( $field );
|
167 |
}
|
168 |
|
@@ -180,28 +154,23 @@ class FrmFieldsController {
|
|
180 |
if ( is_numeric( $field_object ) ) {
|
181 |
$field_object = FrmField::getOne( $field_object );
|
182 |
} elseif ( is_array( $field_object ) ) {
|
183 |
-
$field
|
184 |
$field_object = FrmField::getOne( $field['id'] );
|
185 |
}
|
186 |
|
187 |
$field_obj = FrmFieldFactory::get_field_factory( $field_object );
|
188 |
-
$display
|
189 |
|
190 |
-
$ajax_loading
|
191 |
$ajax_this_field = isset( $values['count'] ) && $values['count'] > 10 && ! in_array( $field_object->type, array( 'divider', 'end_divider' ) );
|
192 |
|
193 |
if ( $ajax_loading && $ajax_this_field ) {
|
194 |
$li_classes = self::get_classes_for_builder_field( array(), $display, $field_obj );
|
195 |
include( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/back-end/ajax-field-placeholder.php' );
|
196 |
} else {
|
197 |
-
$frm_settings = FrmAppHelper::get_settings();
|
198 |
-
|
199 |
-
$pro_field_selection = FrmField::pro_field_selection();
|
200 |
-
$frm_all_field_selection = array_merge( FrmField::field_selection(), $pro_field_selection );
|
201 |
-
$disabled_fields = FrmAppHelper::pro_is_installed() ? array() : $pro_field_selection;
|
202 |
-
|
203 |
if ( ! isset( $field ) && is_object( $field_object ) ) {
|
204 |
$field_object->parent_form_id = isset( $values['id'] ) ? $values['id'] : $field_object->form_id;
|
|
|
205 |
$field = FrmFieldsHelper::setup_edit_vars( $field_object );
|
206 |
}
|
207 |
|
@@ -217,98 +186,29 @@ class FrmFieldsController {
|
|
217 |
*/
|
218 |
private static function get_classes_for_builder_field( $field, $display, $field_info ) {
|
219 |
$li_classes = $field_info->form_builder_classes( $display['type'] );
|
|
|
|
|
|
|
|
|
|
|
|
|
220 |
if ( ! empty( $field ) ) {
|
221 |
$li_classes = apply_filters( 'frm_build_field_class', $li_classes, $field );
|
222 |
}
|
|
|
223 |
return $li_classes;
|
224 |
}
|
225 |
|
226 |
-
|
227 |
FrmAppHelper::permission_check( 'frm_edit_forms' );
|
228 |
-
|
229 |
|
230 |
$field_id = FrmAppHelper::get_post_param( 'field_id', 0, 'absint' );
|
231 |
FrmField::destroy( $field_id );
|
232 |
-
wp_die();
|
233 |
-
}
|
234 |
-
|
235 |
-
/* Field Options */
|
236 |
-
|
237 |
-
//Add Single Option or Other Option
|
238 |
-
public static function add_option() {
|
239 |
-
FrmAppHelper::permission_check( 'frm_edit_forms' );
|
240 |
-
check_ajax_referer( 'frm_ajax', 'nonce' );
|
241 |
-
|
242 |
-
$id = FrmAppHelper::get_post_param( 'field_id', 0, 'absint' );
|
243 |
-
$opt_type = FrmAppHelper::get_post_param( 'opt_type', '', 'sanitize_text_field' );
|
244 |
-
$opt_key = FrmAppHelper::get_post_param( 'opt_key', 0, 'absint' );
|
245 |
-
|
246 |
-
$field = FrmField::getOne( $id );
|
247 |
-
|
248 |
-
if ( 'other' == $opt_type ) {
|
249 |
-
$opt = __( 'Other', 'formidable' );
|
250 |
-
$opt_key = 'other_' . $opt_key;
|
251 |
-
} else {
|
252 |
-
$opt = __( 'New Option', 'formidable' );
|
253 |
-
}
|
254 |
-
|
255 |
-
$field_data = $field;
|
256 |
-
$field = (array) $field;
|
257 |
-
$field['separate_value'] = isset( $field_data->field_options['separate_value'] ) ? $field_data->field_options['separate_value'] : 0;
|
258 |
-
unset( $field_data );
|
259 |
-
$field['html_name'] = 'item_meta[' . $field['id'] . ']';
|
260 |
-
|
261 |
-
$field['options'] = array( $opt_key => $opt );
|
262 |
-
FrmFieldsHelper::show_single_option( $field );
|
263 |
-
|
264 |
wp_die();
|
265 |
-
|
266 |
-
|
267 |
-
public static function import_choices() {
|
268 |
-
FrmAppHelper::permission_check( 'frm_edit_forms', 'hide' );
|
269 |
-
|
270 |
-
$field_id = absint( $_REQUEST['field_id'] );
|
271 |
-
|
272 |
-
global $current_screen, $hook_suffix;
|
273 |
-
|
274 |
-
// Catch plugins that include admin-header.php before admin.php completes.
|
275 |
-
if ( empty( $current_screen ) && function_exists( 'set_current_screen' ) ) {
|
276 |
-
$hook_suffix = '';
|
277 |
-
set_current_screen();
|
278 |
-
}
|
279 |
-
|
280 |
-
if ( function_exists( 'register_admin_color_schemes' ) ) {
|
281 |
-
register_admin_color_schemes();
|
282 |
-
}
|
283 |
-
|
284 |
-
$hook_suffix = '';
|
285 |
-
$admin_body_class = '';
|
286 |
-
|
287 |
-
if ( get_user_setting( 'mfold' ) == 'f' ) {
|
288 |
-
$admin_body_class .= ' folded';
|
289 |
-
}
|
290 |
-
|
291 |
-
if ( function_exists( 'is_admin_bar_showing' ) && is_admin_bar_showing() ) {
|
292 |
-
$admin_body_class .= ' admin-bar';
|
293 |
-
}
|
294 |
-
|
295 |
-
if ( is_rtl() ) {
|
296 |
-
$admin_body_class .= ' rtl';
|
297 |
-
}
|
298 |
-
|
299 |
-
$admin_body_class .= ' admin-color-' . sanitize_html_class( get_user_option( 'admin_color' ), 'fresh' );
|
300 |
-
$prepop = array();
|
301 |
-
FrmFieldsHelper::get_bulk_prefilled_opts( $prepop );
|
302 |
-
|
303 |
-
$field = FrmField::getOne( $field_id );
|
304 |
-
|
305 |
-
wp_enqueue_script( 'utils' );
|
306 |
-
wp_enqueue_style( 'formidable-admin', FrmAppHelper::plugin_url() . '/css/frm_admin.css', array(), FrmAppHelper::plugin_version() );
|
307 |
-
FrmAppHelper::load_admin_wide_js();
|
308 |
|
309 |
-
|
310 |
-
wp_die();
|
311 |
-
}
|
312 |
|
313 |