Version Description
- Fix an XSS vulnerability in the lite version. When the pro version is active, the vulnerability was resolved.
- Increased security
- Fix the shortcode display on form listing page
- Add frm_helper_shortcode filter
- Prevent javascript error on form settings page when WooThemes Helper plugin is active
- Prevent conflict from unknown plugin/theme that was modifying the post excerpt in form actions, which prevented them from showing
- Only scroll to the errored field and success message if they are not already in view
- Make sure admins always have permission to view menus
- Pro: Fix datepicker field when the jQuery CSS is set to load on all pages
- Pro: Added frm_footer_scripts hook
- Pro: Don't autoselect 0 in scale fields
Download this release
Release Info
Developer | sswells |
Plugin | Formidable Forms – Form Builder for WordPress |
Version | 2.0.06 |
Comparing to | |
See all releases |
Code changes from version 2.0.05 to 2.0.06
- classes/controllers/FrmAppController.php +53 -44
- classes/controllers/FrmEntriesController.php +13 -9
- classes/controllers/FrmFieldsController.php +10 -13
- classes/controllers/FrmFormsController.php +93 -27
- classes/controllers/FrmHooksController.php +85 -85
- classes/controllers/FrmSettingsController.php +10 -15
- classes/controllers/FrmStatisticsController.php +4 -4
- classes/controllers/FrmStylesController.php +14 -6
- classes/controllers/FrmXMLController.php +2 -2
- classes/helpers/FrmAppHelper.php +110 -147
- classes/helpers/FrmEntriesHelper.php +11 -7
- classes/helpers/FrmFieldsHelper.php +224 -12
- classes/helpers/FrmFormActionsHelper.php +8 -2
- classes/helpers/FrmFormsHelper.php +92 -14
- classes/helpers/FrmFormsListHelper.php +3 -3
- classes/helpers/FrmXMLHelper.php +1 -1
- classes/models/FrmEntry.php +3 -3
- classes/models/FrmField.php +5 -4
- classes/models/FrmForm.php +27 -49
- classes/models/FrmFormAction.php +3 -13
- classes/models/FrmNotification.php +4 -4
- classes/models/FrmSettings.php +6 -6
- classes/models/FrmStyle.php +3 -12
- classes/views/frm-entries/errors.php +4 -30
- classes/views/frm-entries/list.php +2 -2
- classes/views/frm-entries/new.php +1 -1
- classes/views/frm-entries/show.php +1 -1
- classes/views/frm-entries/sidebar-shared.php +7 -6
- classes/views/frm-fields/import_choices.php +1 -1
- classes/views/frm-fields/input.php +21 -14
- classes/views/frm-fields/radio.php +2 -2
- classes/views/frm-fields/show-build.php +2 -2
- classes/views/frm-form-actions/form_action.php +1 -1
- classes/views/frm-forms/add_field.php +5 -5
- classes/views/frm-forms/form.php +1 -1
- classes/views/frm-forms/list.php +1 -1
- classes/views/frm-forms/settings.php +2 -2
- classes/views/frm-settings/form.php +3 -3
- classes/views/shared/mb_adv_info.php +0 -28
- css/_single_theme.css.php +3 -2
- formidable.php +6 -6
- js/formidable.min.js +53 -53
- readme.txt +14 -1
classes/controllers/FrmAppController.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
class FrmAppController {
|
4 |
|
5 |
public static function menu() {
|
6 |
-
add_filter( 'plugin_action_links_'. FrmAppHelper::plugin_folder() .'/formidable.php', 'FrmAppController::settings_link' );
|
7 |
add_filter( 'admin_body_class', 'FrmAppController::wp_admin_body_class' );
|
8 |
|
9 |
FrmAppHelper::maybe_add_permissions();
|
@@ -17,18 +17,18 @@ class FrmAppController {
|
|
17 |
$pos = apply_filters( 'frm_menu_position', $pos );
|
18 |
|
19 |
$frm_settings = FrmAppHelper::get_settings();
|
20 |
-
add_menu_page( 'Formidable', $frm_settings->menu, 'frm_view_forms', 'formidable', 'FrmFormsController::route', FrmAppHelper::plugin_url() .'/images/form_16.png', $pos );
|
21 |
}
|
22 |
|
23 |
public static function load_wp_admin_style() {
|
24 |
-
wp_enqueue_style( 'frm_fonts',
|
25 |
}
|
26 |
|
27 |
public static function get_form_nav( $form, $show_nav = '', $title = 'show' ) {
|
28 |
global $pagenow, $frm_vars;
|
29 |
|
30 |
$show_nav = FrmAppHelper::get_param( 'show_nav', $show_nav, 'get', 'absint' );
|
31 |
-
if ( empty($show_nav) ) {
|
32 |
return;
|
33 |
}
|
34 |
|
@@ -42,15 +42,15 @@ class FrmAppController {
|
|
42 |
}
|
43 |
}
|
44 |
|
45 |
-
if ( ! isset($id) ) {
|
46 |
$form = $id = false;
|
47 |
}
|
48 |
|
49 |
-
include(FrmAppHelper::plugin_path() .'/classes/views/shared/form-nav.php');
|
50 |
}
|
51 |
|
52 |
// Adds a settings link to the plugins page
|
53 |
-
public static function settings_link($links) {
|
54 |
$settings = '<a href="' . esc_url( admin_url( 'admin.php?page=formidable-settings' ) ) . '">' . __( 'Settings', 'formidable' ) . '</a>';
|
55 |
array_unshift( $links, $settings );
|
56 |
|
@@ -133,11 +133,11 @@ class FrmAppController {
|
|
133 |
'jquery-ui-sortable',
|
134 |
'bootstrap_tooltip', 'bootstrap-multiselect',
|
135 |
), $version, true );
|
136 |
-
wp_register_style( 'formidable-admin', FrmAppHelper::plugin_url() .'/css/frm_admin.css', array(), $version );
|
137 |
-
wp_register_script( 'bootstrap_tooltip', FrmAppHelper::plugin_url() .'/js/bootstrap.min.js', array( 'jquery' ), '3.3.4' );
|
138 |
|
139 |
// load multselect js
|
140 |
-
wp_register_script( 'bootstrap-multiselect', FrmAppHelper::plugin_url() .'/js/bootstrap-multiselect.js', array( 'jquery', 'bootstrap_tooltip' ), '0.9.8', true );
|
141 |
|
142 |
$page = FrmAppHelper::simple_get( 'page', 'sanitize_title' );
|
143 |
$post_type = FrmAppHelper::simple_get( 'post_type', 'sanitize_title' );
|
@@ -154,10 +154,10 @@ class FrmAppController {
|
|
154 |
wp_enqueue_style( 'formidable-admin' );
|
155 |
add_thickbox();
|
156 |
|
157 |
-
wp_register_script( 'formidable-editinplace', FrmAppHelper::plugin_url() .'/js/jquery/jquery.editinplace.packed.js', array( 'jquery' ), '2.3.0' );
|
158 |
|
159 |
} else if ( $pagenow == 'post.php' || ( $pagenow == 'post-new.php' && $post_type == 'frm_display' ) ) {
|
160 |
-
if ( isset($_REQUEST['post_type']) ) {
|
161 |
$post_type = sanitize_title( $_REQUEST['post_type'] );
|
162 |
} else if ( isset( $_REQUEST['post'] ) && absint( $_REQUEST['post'] ) ) {
|
163 |
$post = get_post( absint( $_REQUEST['post'] ) );
|
@@ -191,7 +191,7 @@ class FrmAppController {
|
|
191 |
}
|
192 |
|
193 |
public static function load_lang() {
|
194 |
-
load_plugin_textdomain( 'formidable', false, FrmAppHelper::plugin_folder() .'/languages/' );
|
195 |
}
|
196 |
|
197 |
/**
|
@@ -219,7 +219,7 @@ class FrmAppController {
|
|
219 |
|
220 |
$version = FrmAppHelper::plugin_version();
|
221 |
wp_register_script( 'formidable', FrmAppHelper::plugin_url() . '/js/formidable.min.js', array( 'jquery' ), $version, true );
|
222 |
-
wp_register_script( 'jquery-placeholder', FrmAppHelper::plugin_url() .'/js/jquery/jquery.placeholder.js', array( 'jquery' ), '2.0.7', true );
|
223 |
|
224 |
if ( FrmAppHelper::is_admin() ) {
|
225 |
// don't load this in back-end
|
@@ -251,20 +251,20 @@ class FrmAppController {
|
|
251 |
/**
|
252 |
* @param string $location
|
253 |
*/
|
254 |
-
public static function localize_script($location) {
|
255 |
-
wp_localize_script('formidable', 'frm_js', array(
|
256 |
'ajax_url' => admin_url( 'admin-ajax.php' ),
|
257 |
-
'images_url' => FrmAppHelper::plugin_url() .'/images',
|
258 |
'loading' => __( 'Loading…' ),
|
259 |
'remove' => __( 'Remove', 'formidable' ),
|
260 |
'offset' => apply_filters( 'frm_scroll_offset', 4 ),
|
261 |
'nonce' => wp_create_nonce( 'frm_ajax' ),
|
262 |
'id' => __( 'ID', 'formidable' ),
|
263 |
-
));
|
264 |
|
265 |
if ( $location == 'admin' ) {
|
266 |
$frm_settings = FrmAppHelper::get_settings();
|
267 |
-
wp_localize_script('formidable_admin', 'frm_admin_js', array(
|
268 |
'confirm_uninstall' => __( 'Are you sure you want to do this? Clicking OK will delete all forms, form data, and all other Formidable data. There is no Undo.', 'formidable' ),
|
269 |
'desc' => __( '(Click to add description)', 'formidable' ),
|
270 |
'blank' => __( '(blank)', 'formidable' ),
|
@@ -296,32 +296,41 @@ class FrmAppController {
|
|
296 |
}
|
297 |
}
|
298 |
|
299 |
-
|
300 |
public static function custom_stylesheet() {
|
301 |
global $frm_vars;
|
302 |
-
|
|
|
303 |
|
304 |
-
if ( ! isset($frm_vars['css_loaded']) || ! $frm_vars['css_loaded'] ) {
|
305 |
//include css in head
|
306 |
-
|
307 |
-
if ( is_readable( $uploads['basedir'] .'/formidable/css/formidablepro.css' ) ) {
|
308 |
-
$css_file['formidable'] = $uploads['baseurl'] .'/formidable/css/formidablepro.css';
|
309 |
-
} else {
|
310 |
-
$css_file['formidable'] = admin_url( 'admin-ajax.php' ) . '?action=frmpro_css';
|
311 |
-
}
|
312 |
}
|
313 |
|
314 |
-
|
315 |
-
FrmStylesHelper::enqueue_jquery_css();
|
316 |
-
}
|
317 |
-
|
318 |
-
return $css_file;
|
319 |
}
|
320 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
321 |
public static function load_css() {
|
322 |
$css = get_transient( 'frmpro_css' );
|
323 |
|
324 |
-
include(FrmAppHelper::plugin_path() .'/css/custom_theme.css.php');
|
325 |
wp_die();
|
326 |
}
|
327 |
|
@@ -404,8 +413,8 @@ class FrmAppController {
|
|
404 |
$frmdb->uninstall();
|
405 |
|
406 |
//disable the plugin and redirect after uninstall so the tables don't get added right back
|
407 |
-
deactivate_plugins( FrmAppHelper::plugin_folder() .'/formidable.php', false, false );
|
408 |
-
echo esc_url( admin_url('plugins.php?deactivate=true') );
|
409 |
} else {
|
410 |
$frm_settings = FrmAppHelper::get_settings();
|
411 |
wp_die( $frm_settings->admin_permission );
|
@@ -413,28 +422,28 @@ class FrmAppController {
|
|
413 |
wp_die();
|
414 |
}
|
415 |
|
416 |
-
public static function drop_tables($tables) {
|
417 |
global $wpdb;
|
418 |
-
$tables[] = $wpdb->prefix .'frm_fields';
|
419 |
-
$tables[] = $wpdb->prefix .'frm_forms';
|
420 |
-
$tables[] = $wpdb->prefix .'frm_items';
|
421 |
-
$tables[] = $wpdb->prefix .'frm_item_metas';
|
422 |
return $tables;
|
423 |
}
|
424 |
|
425 |
// Routes for wordpress pages -- we're just replacing content here folks.
|
426 |
-
public static function page_route($content) {
|
427 |
global $post;
|
428 |
|
429 |
$frm_settings = FrmAppHelper::get_settings();
|
430 |
-
if ( $post && $post->ID == $frm_settings->preview_page_id && isset($_GET['form']) ) {
|
431 |
$content = FrmFormsController::page_preview();
|
432 |
}
|
433 |
|
434 |
return $content;
|
435 |
}
|
436 |
|
437 |
-
public static function update_message($features) {
|
438 |
_deprecated_function( __FUNCTION__, '2.0', 'FrmAppHelper::update_message' );
|
439 |
return FrmAppHelper::update_message( $features );
|
440 |
}
|
3 |
class FrmAppController {
|
4 |
|
5 |
public static function menu() {
|
6 |
+
add_filter( 'plugin_action_links_' . FrmAppHelper::plugin_folder() . '/formidable.php', 'FrmAppController::settings_link' );
|
7 |
add_filter( 'admin_body_class', 'FrmAppController::wp_admin_body_class' );
|
8 |
|
9 |
FrmAppHelper::maybe_add_permissions();
|
17 |
$pos = apply_filters( 'frm_menu_position', $pos );
|
18 |
|
19 |
$frm_settings = FrmAppHelper::get_settings();
|
20 |
+
add_menu_page( 'Formidable', $frm_settings->menu, 'frm_view_forms', 'formidable', 'FrmFormsController::route', FrmAppHelper::plugin_url() . '/images/form_16.png', $pos );
|
21 |
}
|
22 |
|
23 |
public static function load_wp_admin_style() {
|
24 |
+
wp_enqueue_style( 'frm_fonts', FrmAppHelper::plugin_url() . '/css/frm_fonts.css', array(), FrmAppHelper::plugin_version() );
|
25 |
}
|
26 |
|
27 |
public static function get_form_nav( $form, $show_nav = '', $title = 'show' ) {
|
28 |
global $pagenow, $frm_vars;
|
29 |
|
30 |
$show_nav = FrmAppHelper::get_param( 'show_nav', $show_nav, 'get', 'absint' );
|
31 |
+
if ( empty( $show_nav ) ) {
|
32 |
return;
|
33 |
}
|
34 |
|
42 |
}
|
43 |
}
|
44 |
|
45 |
+
if ( ! isset( $id ) ) {
|
46 |
$form = $id = false;
|
47 |
}
|
48 |
|
49 |
+
include( FrmAppHelper::plugin_path() . '/classes/views/shared/form-nav.php' );
|
50 |
}
|
51 |
|
52 |
// Adds a settings link to the plugins page
|
53 |
+
public static function settings_link( $links ) {
|
54 |
$settings = '<a href="' . esc_url( admin_url( 'admin.php?page=formidable-settings' ) ) . '">' . __( 'Settings', 'formidable' ) . '</a>';
|
55 |
array_unshift( $links, $settings );
|
56 |
|
133 |
'jquery-ui-sortable',
|
134 |
'bootstrap_tooltip', 'bootstrap-multiselect',
|
135 |
), $version, true );
|
136 |
+
wp_register_style( 'formidable-admin', FrmAppHelper::plugin_url() . '/css/frm_admin.css', array(), $version );
|
137 |
+
wp_register_script( 'bootstrap_tooltip', FrmAppHelper::plugin_url() . '/js/bootstrap.min.js', array( 'jquery' ), '3.3.4' );
|
138 |
|
139 |
// load multselect js
|
140 |
+
wp_register_script( 'bootstrap-multiselect', FrmAppHelper::plugin_url() . '/js/bootstrap-multiselect.js', array( 'jquery', 'bootstrap_tooltip' ), '0.9.8', true );
|
141 |
|
142 |
$page = FrmAppHelper::simple_get( 'page', 'sanitize_title' );
|
143 |
$post_type = FrmAppHelper::simple_get( 'post_type', 'sanitize_title' );
|
154 |
wp_enqueue_style( 'formidable-admin' );
|
155 |
add_thickbox();
|
156 |
|
157 |
+
wp_register_script( 'formidable-editinplace', FrmAppHelper::plugin_url() . '/js/jquery/jquery.editinplace.packed.js', array( 'jquery' ), '2.3.0' );
|
158 |
|
159 |
} else if ( $pagenow == 'post.php' || ( $pagenow == 'post-new.php' && $post_type == 'frm_display' ) ) {
|
160 |
+
if ( isset( $_REQUEST['post_type'] ) ) {
|
161 |
$post_type = sanitize_title( $_REQUEST['post_type'] );
|
162 |
} else if ( isset( $_REQUEST['post'] ) && absint( $_REQUEST['post'] ) ) {
|
163 |
$post = get_post( absint( $_REQUEST['post'] ) );
|
191 |
}
|
192 |
|
193 |
public static function load_lang() {
|
194 |
+
load_plugin_textdomain( 'formidable', false, FrmAppHelper::plugin_folder() . '/languages/' );
|
195 |
}
|
196 |
|
197 |
/**
|
219 |
|
220 |
$version = FrmAppHelper::plugin_version();
|
221 |
wp_register_script( 'formidable', FrmAppHelper::plugin_url() . '/js/formidable.min.js', array( 'jquery' ), $version, true );
|
222 |
+
wp_register_script( 'jquery-placeholder', FrmAppHelper::plugin_url() . '/js/jquery/jquery.placeholder.js', array( 'jquery' ), '2.0.7', true );
|
223 |
|
224 |
if ( FrmAppHelper::is_admin() ) {
|
225 |
// don't load this in back-end
|
251 |
/**
|
252 |
* @param string $location
|
253 |
*/
|
254 |
+
public static function localize_script( $location ) {
|
255 |
+
wp_localize_script( 'formidable', 'frm_js', array(
|
256 |
'ajax_url' => admin_url( 'admin-ajax.php' ),
|
257 |
+
'images_url' => FrmAppHelper::plugin_url() . '/images',
|
258 |
'loading' => __( 'Loading…' ),
|
259 |
'remove' => __( 'Remove', 'formidable' ),
|
260 |
'offset' => apply_filters( 'frm_scroll_offset', 4 ),
|
261 |
'nonce' => wp_create_nonce( 'frm_ajax' ),
|
262 |
'id' => __( 'ID', 'formidable' ),
|
263 |
+
) );
|
264 |
|
265 |
if ( $location == 'admin' ) {
|
266 |
$frm_settings = FrmAppHelper::get_settings();
|
267 |
+
wp_localize_script( 'formidable_admin', 'frm_admin_js', array(
|
268 |
'confirm_uninstall' => __( 'Are you sure you want to do this? Clicking OK will delete all forms, form data, and all other Formidable data. There is no Undo.', 'formidable' ),
|
269 |
'desc' => __( '(Click to add description)', 'formidable' ),
|
270 |
'blank' => __( '(blank)', 'formidable' ),
|
296 |
}
|
297 |
}
|
298 |
|
|
|
299 |
public static function custom_stylesheet() {
|
300 |
global $frm_vars;
|
301 |
+
$stylesheet_urls = array();
|
302 |
+
self::maybe_enqueue_jquery_css();
|
303 |
|
304 |
+
if ( ! isset( $frm_vars['css_loaded'] ) || ! $frm_vars['css_loaded'] ) {
|
305 |
//include css in head
|
306 |
+
self::get_url_to_custom_style( $stylesheet_urls );
|
|
|
|
|
|
|
|
|
|
|
307 |
}
|
308 |
|
309 |
+
return $stylesheet_urls;
|
|
|
|
|
|
|
|
|
310 |
}
|
311 |
|
312 |
+
private static function get_url_to_custom_style( &$stylesheet_urls ) {
|
313 |
+
$uploads = FrmStylesHelper::get_upload_base();
|
314 |
+
$saved_css_path = '/formidable/css/formidablepro.css';
|
315 |
+
if ( is_readable( $uploads['basedir'] . $saved_css_path ) ) {
|
316 |
+
$url = $uploads['baseurl'] . $saved_css_path;
|
317 |
+
} else {
|
318 |
+
$url = admin_url( 'admin-ajax.php' ) . '?action=frmpro_css';
|
319 |
+
}
|
320 |
+
$stylesheet_urls['formidable'] = $url;
|
321 |
+
}
|
322 |
+
|
323 |
+
private static function maybe_enqueue_jquery_css() {
|
324 |
+
global $frm_vars;
|
325 |
+
if ( isset( $frm_vars['datepicker_loaded'] ) && ! empty( $frm_vars['datepicker_loaded'] ) ) {
|
326 |
+
FrmStylesHelper::enqueue_jquery_css();
|
327 |
+
}
|
328 |
+
}
|
329 |
+
|
330 |
public static function load_css() {
|
331 |
$css = get_transient( 'frmpro_css' );
|
332 |
|
333 |
+
include( FrmAppHelper::plugin_path() . '/css/custom_theme.css.php' );
|
334 |
wp_die();
|
335 |
}
|
336 |
|
413 |
$frmdb->uninstall();
|
414 |
|
415 |
//disable the plugin and redirect after uninstall so the tables don't get added right back
|
416 |
+
deactivate_plugins( FrmAppHelper::plugin_folder() . '/formidable.php', false, false );
|
417 |
+
echo esc_url( admin_url( 'plugins.php?deactivate=true' ) );
|
418 |
} else {
|
419 |
$frm_settings = FrmAppHelper::get_settings();
|
420 |
wp_die( $frm_settings->admin_permission );
|
422 |
wp_die();
|
423 |
}
|
424 |
|
425 |
+
public static function drop_tables( $tables ) {
|
426 |
global $wpdb;
|
427 |
+
$tables[] = $wpdb->prefix . 'frm_fields';
|
428 |
+
$tables[] = $wpdb->prefix . 'frm_forms';
|
429 |
+
$tables[] = $wpdb->prefix . 'frm_items';
|
430 |
+
$tables[] = $wpdb->prefix . 'frm_item_metas';
|
431 |
return $tables;
|
432 |
}
|
433 |
|
434 |
// Routes for wordpress pages -- we're just replacing content here folks.
|
435 |
+
public static function page_route( $content ) {
|
436 |
global $post;
|
437 |
|
438 |
$frm_settings = FrmAppHelper::get_settings();
|
439 |
+
if ( $post && $post->ID == $frm_settings->preview_page_id && isset( $_GET['form'] ) ) {
|
440 |
$content = FrmFormsController::page_preview();
|
441 |
}
|
442 |
|
443 |
return $content;
|
444 |
}
|
445 |
|
446 |
+
public static function update_message( $features ) {
|
447 |
_deprecated_function( __FUNCTION__, '2.0', 'FrmAppHelper::update_message' );
|
448 |
return FrmAppHelper::update_message( $features );
|
449 |
}
|
classes/controllers/FrmEntriesController.php
CHANGED
@@ -3,15 +3,11 @@
|
|
3 |
class FrmEntriesController {
|
4 |
|
5 |
public static function menu() {
|
6 |
-
|
7 |
-
global $wp_roles;
|
8 |
-
$wp_roles->add_cap( 'administrator', 'frm_view_entries' );
|
9 |
-
$wp_roles->add_cap( 'administrator', 'frm_delete_entries' );
|
10 |
-
}
|
11 |
|
12 |
add_submenu_page('formidable', 'Formidable | '. __( 'Entries', 'formidable' ), __( 'Entries', 'formidable' ), 'frm_view_entries', 'formidable-entries', 'FrmEntriesController::route' );
|
13 |
|
14 |
-
if ( !
|
15 |
$frm_settings = FrmAppHelper::get_settings();
|
16 |
add_filter( 'manage_' . sanitize_title( $frm_settings->menu ) . '_page_formidable-entries_columns', 'FrmEntriesController::manage_columns' );
|
17 |
add_filter( 'manage_' . sanitize_title( $frm_settings->menu ) . '_page_formidable-entries_sortable_columns', 'FrmEntriesController::sortable_columns' );
|
@@ -81,7 +77,7 @@ class FrmEntriesController {
|
|
81 |
$form_cols = FrmField::get_all_for_form($form_id, '', 'include');
|
82 |
|
83 |
foreach ( $form_cols as $form_col ) {
|
84 |
-
|
85 |
continue;
|
86 |
}
|
87 |
|
@@ -126,13 +122,13 @@ class FrmEntriesController {
|
|
126 |
return $columns;
|
127 |
}
|
128 |
|
129 |
-
|
130 |
$frm_settings = FrmAppHelper::get_settings();
|
131 |
if ( $meta_key != 'manage'. sanitize_title($frm_settings->menu) .'_page_formidable-entriescolumnshidden' || $meta_value == $prev_value ) {
|
132 |
return $check;
|
133 |
}
|
134 |
|
135 |
-
|
136 |
$prev_value = get_metadata('user', $object_id, $meta_key, true);
|
137 |
}
|
138 |
|
@@ -445,6 +441,14 @@ class FrmEntriesController {
|
|
445 |
if ( $errors == '' ) {
|
446 |
$errors = FrmEntry::validate( $_POST );
|
447 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
448 |
$frm_vars['created_entries'][ $form_id ] = array( 'errors' => $errors );
|
449 |
|
450 |
if ( empty( $errors ) ) {
|
3 |
class FrmEntriesController {
|
4 |
|
5 |
public static function menu() {
|
6 |
+
FrmAppHelper::force_capability( 'frm_view_entries' );
|
|
|
|
|
|
|
|
|
7 |
|
8 |
add_submenu_page('formidable', 'Formidable | '. __( 'Entries', 'formidable' ), __( 'Entries', 'formidable' ), 'frm_view_entries', 'formidable-entries', 'FrmEntriesController::route' );
|
9 |
|
10 |
+
if ( ! in_array( FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' ), array( 'edit', 'show' ) ) ) {
|
11 |
$frm_settings = FrmAppHelper::get_settings();
|
12 |
add_filter( 'manage_' . sanitize_title( $frm_settings->menu ) . '_page_formidable-entries_columns', 'FrmEntriesController::manage_columns' );
|
13 |
add_filter( 'manage_' . sanitize_title( $frm_settings->menu ) . '_page_formidable-entries_sortable_columns', 'FrmEntriesController::sortable_columns' );
|
77 |
$form_cols = FrmField::get_all_for_form($form_id, '', 'include');
|
78 |
|
79 |
foreach ( $form_cols as $form_col ) {
|
80 |
+
if ( FrmFieldsHelper::is_no_save_field( $form_col->type ) ) {
|
81 |
continue;
|
82 |
}
|
83 |
|
122 |
return $columns;
|
123 |
}
|
124 |
|
125 |
+
public static function check_hidden_cols( $check, $object_id, $meta_key, $meta_value, $prev_value ) {
|
126 |
$frm_settings = FrmAppHelper::get_settings();
|
127 |
if ( $meta_key != 'manage'. sanitize_title($frm_settings->menu) .'_page_formidable-entriescolumnshidden' || $meta_value == $prev_value ) {
|
128 |
return $check;
|
129 |
}
|
130 |
|
131 |
+
if ( empty( $prev_value ) ) {
|
132 |
$prev_value = get_metadata('user', $object_id, $meta_key, true);
|
133 |
}
|
134 |
|
441 |
if ( $errors == '' ) {
|
442 |
$errors = FrmEntry::validate( $_POST );
|
443 |
}
|
444 |
+
|
445 |
+
/**
|
446 |
+
* Use this filter to add trigger actions and add errors after
|
447 |
+
* all other errors have been processed
|
448 |
+
* @since 2.0.6
|
449 |
+
*/
|
450 |
+
$errors = apply_filters( 'frm_entries_before_create', $errors, $form );
|
451 |
+
|
452 |
$frm_vars['created_entries'][ $form_id ] = array( 'errors' => $errors );
|
453 |
|
454 |
if ( empty( $errors ) ) {
|
classes/controllers/FrmFieldsController.php
CHANGED
@@ -332,14 +332,14 @@ class FrmFieldsController {
|
|
332 |
$response = array( 'other' => true );
|
333 |
|
334 |
//If the deleted option is an "other" option
|
335 |
-
|
336 |
//Assume all other options are gone, unless proven otherwise
|
337 |
$other = false;
|
338 |
|
339 |
//Check if all other options are really gone
|
340 |
foreach ( $options as $o_key => $o_val ) {
|
341 |
//If there is still an other option in the field, set other to true
|
342 |
-
|
343 |
$other = true;
|
344 |
break;
|
345 |
}
|
@@ -350,13 +350,13 @@ class FrmFieldsController {
|
|
350 |
if ( false === $other ) {
|
351 |
$field_options = maybe_unserialize( $field->field_options );
|
352 |
$field_options['other'] = 0;
|
353 |
-
|
354 |
$response = array( 'other' => false );
|
355 |
}
|
356 |
}
|
357 |
echo json_encode( $response );
|
358 |
|
359 |
-
|
360 |
|
361 |
wp_die();
|
362 |
}
|
@@ -471,11 +471,10 @@ class FrmFieldsController {
|
|
471 |
|
472 |
public static function update_order() {
|
473 |
check_ajax_referer( 'frm_ajax', 'nonce' );
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
}
|
479 |
wp_die();
|
480 |
}
|
481 |
|
@@ -539,13 +538,11 @@ class FrmFieldsController {
|
|
539 |
|
540 |
$class = apply_filters('frm_field_classes', implode(' ', $class), $field);
|
541 |
|
542 |
-
|
543 |
-
$add_html['class'] = 'class="' . esc_attr( trim( $class ) ) . '"';
|
544 |
-
}
|
545 |
|
546 |
self::add_shortcodes_to_html($field, $add_html);
|
547 |
|
548 |
-
|
549 |
|
550 |
if ( $echo ) {
|
551 |
echo $add_html;
|
332 |
$response = array( 'other' => true );
|
333 |
|
334 |
//If the deleted option is an "other" option
|
335 |
+
if ( FrmFieldsHelper::is_other_opt( $opt_key ) ) {
|
336 |
//Assume all other options are gone, unless proven otherwise
|
337 |
$other = false;
|
338 |
|
339 |
//Check if all other options are really gone
|
340 |
foreach ( $options as $o_key => $o_val ) {
|
341 |
//If there is still an other option in the field, set other to true
|
342 |
+
if ( FrmFieldsHelper::is_other_opt( $o_key ) ) {
|
343 |
$other = true;
|
344 |
break;
|
345 |
}
|
350 |
if ( false === $other ) {
|
351 |
$field_options = maybe_unserialize( $field->field_options );
|
352 |
$field_options['other'] = 0;
|
353 |
+
FrmField::update( $field_id, array( 'field_options' => maybe_serialize( $field_options ) ) );
|
354 |
$response = array( 'other' => false );
|
355 |
}
|
356 |
}
|
357 |
echo json_encode( $response );
|
358 |
|
359 |
+
FrmField::update( $field_id, array( 'options' => maybe_serialize( $options ) ) );
|
360 |
|
361 |
wp_die();
|
362 |
}
|
471 |
|
472 |
public static function update_order() {
|
473 |
check_ajax_referer( 'frm_ajax', 'nonce' );
|
474 |
+
$fields = FrmAppHelper::get_post_param( 'frm_field_id' );
|
475 |
+
foreach ( (array) $fields as $position => $item ) {
|
476 |
+
FrmField::update( absint( $item ), array( 'field_order' => absint( $position ) ) );
|
477 |
+
}
|
|
|
478 |
wp_die();
|
479 |
}
|
480 |
|
538 |
|
539 |
$class = apply_filters('frm_field_classes', implode(' ', $class), $field);
|
540 |
|
541 |
+
FrmFormsHelper::add_html_attr( $class, 'class', $add_html );
|
|
|
|
|
542 |
|
543 |
self::add_shortcodes_to_html($field, $add_html);
|
544 |
|
545 |
+
$add_html = ' ' . implode( ' ', $add_html ) . ' ';
|
546 |
|
547 |
if ( $echo ) {
|
548 |
echo $add_html;
|
classes/controllers/FrmFormsController.php
CHANGED
@@ -141,12 +141,13 @@ class FrmFormsController {
|
|
141 |
check_ajax_referer( 'frm_ajax', 'nonce' );
|
142 |
FrmAppHelper::permission_check('frm_edit_forms', 'hide');
|
143 |
|
144 |
-
|
145 |
-
|
146 |
|
147 |
-
|
148 |
-
|
149 |
-
|
|
|
150 |
wp_die();
|
151 |
}
|
152 |
|
@@ -154,8 +155,12 @@ class FrmFormsController {
|
|
154 |
check_ajax_referer( 'frm_ajax', 'nonce' );
|
155 |
FrmAppHelper::permission_check('frm_edit_forms', 'hide');
|
156 |
|
157 |
-
|
158 |
-
|
|
|
|
|
|
|
|
|
159 |
echo $description;
|
160 |
wp_die();
|
161 |
}
|
@@ -265,9 +270,13 @@ class FrmFormsController {
|
|
265 |
|
266 |
header( 'Content-Type: text/html; charset='. get_option( 'blog_charset' ) );
|
267 |
|
268 |
-
|
269 |
-
|
270 |
-
|
|
|
|
|
|
|
|
|
271 |
$form = FrmForm::getAll( array(), '', 1 );
|
272 |
}
|
273 |
|
@@ -414,7 +423,7 @@ class FrmFormsController {
|
|
414 |
public static function get_shortcode_opts() {
|
415 |
check_ajax_referer( 'frm_ajax', 'nonce' );
|
416 |
|
417 |
-
|
418 |
if ( empty($shortcode) ) {
|
419 |
wp_die();
|
420 |
}
|
@@ -614,36 +623,93 @@ class FrmFormsController {
|
|
614 |
$col = 'one';
|
615 |
$settings_tab = FrmAppHelper::is_admin_page('formidable' ) ? true : false;
|
616 |
|
617 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
618 |
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
624 |
);
|
625 |
-
$adv_shortcodes = apply_filters('frm_advanced_shortcodes', $adv_shortcodes);
|
626 |
|
627 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
628 |
|
629 |
-
|
|
|
|
|
|
|
|
|
|
|
630 |
|
631 |
-
|
632 |
-
|
633 |
|
634 |
// Insert the form class setting into the form
|
635 |
public static function form_classes($form) {
|
636 |
if ( isset($form->options['form_class']) ) {
|
637 |
-
|
638 |
}
|
639 |
}
|
640 |
|
641 |
public static function get_email_html() {
|
642 |
check_ajax_referer( 'frm_ajax', 'nonce' );
|
643 |
echo FrmEntriesController::show_entry_shortcode( array(
|
644 |
-
|
645 |
'default_email' => true,
|
646 |
-
|
647 |
) );
|
648 |
wp_die();
|
649 |
}
|
@@ -651,7 +717,7 @@ class FrmFormsController {
|
|
651 |
public static function filter_content( $content, $form, $entry = false ) {
|
652 |
if ( ! $entry || ! is_object( $entry ) ) {
|
653 |
if ( ! $entry || ! is_numeric( $entry ) ) {
|
654 |
-
|
655 |
}
|
656 |
|
657 |
FrmEntriesHelper::maybe_get_entry( $entry );
|
@@ -723,7 +789,7 @@ class FrmFormsController {
|
|
723 |
}
|
724 |
|
725 |
if ( isset( $message ) && ! empty( $message ) ) {
|
726 |
-
|
727 |
}
|
728 |
|
729 |
return $errors;
|
141 |
check_ajax_referer( 'frm_ajax', 'nonce' );
|
142 |
FrmAppHelper::permission_check('frm_edit_forms', 'hide');
|
143 |
|
144 |
+
$form_key = FrmAppHelper::get_post_param( 'update_value', '', 'sanitize_title' );
|
145 |
+
$values = array( 'form_key' => trim( $form_key ) );
|
146 |
|
147 |
+
$form_id = FrmAppHelper::get_post_param( 'form_id', '', 'absint' );
|
148 |
+
FrmForm::update( $form_id, $values );
|
149 |
+
$key = FrmForm::getKeyById( $form_id );
|
150 |
+
echo stripslashes( $key );
|
151 |
wp_die();
|
152 |
}
|
153 |
|
155 |
check_ajax_referer( 'frm_ajax', 'nonce' );
|
156 |
FrmAppHelper::permission_check('frm_edit_forms', 'hide');
|
157 |
|
158 |
+
$form_id = FrmAppHelper::get_post_param( 'form_id', '', 'absint' );
|
159 |
+
$value = FrmAppHelper::get_post_param( 'update_value', '', 'wp_filter_post_kses' );
|
160 |
+
|
161 |
+
FrmForm::update( $form_id, array( 'description' => $value ) );
|
162 |
+
|
163 |
+
$description = FrmAppHelper::use_wpautop( stripslashes( $value ) );
|
164 |
echo $description;
|
165 |
wp_die();
|
166 |
}
|
270 |
|
271 |
header( 'Content-Type: text/html; charset='. get_option( 'blog_charset' ) );
|
272 |
|
273 |
+
$key = FrmAppHelper::simple_get( 'form', 'sanitize_title' );
|
274 |
+
if ( $key == '' ) {
|
275 |
+
$key = FrmAppHelper::get_post_param( 'form', '', 'sanitize_title' );
|
276 |
+
}
|
277 |
+
|
278 |
+
$form = FrmForm::getAll( array( 'form_key' => $key ), '', 1 );
|
279 |
+
if ( empty( $form ) ) {
|
280 |
$form = FrmForm::getAll( array(), '', 1 );
|
281 |
}
|
282 |
|
423 |
public static function get_shortcode_opts() {
|
424 |
check_ajax_referer( 'frm_ajax', 'nonce' );
|
425 |
|
426 |
+
$shortcode = FrmAppHelper::get_post_param( 'shortcode', '', 'sanitize_text_field' );
|
427 |
if ( empty($shortcode) ) {
|
428 |
wp_die();
|
429 |
}
|
623 |
$col = 'one';
|
624 |
$settings_tab = FrmAppHelper::is_admin_page('formidable' ) ? true : false;
|
625 |
|
626 |
+
$cond_shortcodes = apply_filters( 'frm_conditional_shortcodes', array() );
|
627 |
+
$adv_shortcodes = self::get_advanced_shortcodes();
|
628 |
+
$user_fields = apply_filters( 'frm_user_shortcodes', array() );
|
629 |
+
$entry_shortcodes = self::get_shortcode_helpers( $settings_tab );
|
630 |
+
|
631 |
+
include( FrmAppHelper::plugin_path() . '/classes/views/shared/mb_adv_info.php' );
|
632 |
+
}
|
633 |
+
|
634 |
+
/**
|
635 |
+
* Get an array of the options to display in the advanced tab
|
636 |
+
* of the customization panel
|
637 |
+
* @since 2.0.6
|
638 |
+
*/
|
639 |
+
private static function get_advanced_shortcodes() {
|
640 |
+
$adv_shortcodes = array(
|
641 |
+
'sep=", "' => array(
|
642 |
+
'label' => __( 'Separator', 'formidable' ),
|
643 |
+
'title' => __( 'Use a different separator for checkbox fields', 'formidable' ),
|
644 |
+
),
|
645 |
+
'format="d-m-Y"' => __( 'Date Format', 'formidable' ),
|
646 |
+
'show="field_label"' => __( 'Field Label', 'formidable' ),
|
647 |
+
'wpautop=0' => array(
|
648 |
+
'label' => __( 'No Auto P', 'formidable' ),
|
649 |
+
'title' => __( 'Do not automatically add any paragraphs or line breaks', 'formidable' ),
|
650 |
+
),
|
651 |
+
);
|
652 |
+
$adv_shortcodes = apply_filters( 'frm_advanced_shortcodes', $adv_shortcodes );
|
653 |
+
// __( 'Leave blank instead of defaulting to User Login', 'formidable' ) : blank=1
|
654 |
|
655 |
+
return $adv_shortcodes;
|
656 |
+
}
|
657 |
+
|
658 |
+
/**
|
659 |
+
* Get an array of the helper shortcodes to display in the customization panel
|
660 |
+
* @since 2.0.6
|
661 |
+
*/
|
662 |
+
private static function get_shortcode_helpers( $settings_tab ) {
|
663 |
+
$entry_shortcodes = array(
|
664 |
+
'id' => __( 'Entry ID', 'formidable' ),
|
665 |
+
'key' => __( 'Entry Key', 'formidable' ),
|
666 |
+
'post_id' => __( 'Post ID', 'formidable' ),
|
667 |
+
'ip' => __( 'User IP', 'formidable' ),
|
668 |
+
'created-at' => __( 'Entry created', 'formidable' ),
|
669 |
+
'updated-at' => __( 'Entry updated', 'formidable' ),
|
670 |
+
'' => '',
|
671 |
+
'siteurl' => __( 'Site URL', 'formidable' ),
|
672 |
+
'sitename' => __( 'Site Name', 'formidable' ),
|
673 |
);
|
|
|
674 |
|
675 |
+
if ( ! FrmAppHelper::pro_is_installed() ) {
|
676 |
+
unset( $entry_shortcodes['post_id'] );
|
677 |
+
}
|
678 |
+
|
679 |
+
if ( $settings_tab ) {
|
680 |
+
$entry_shortcodes['default-message'] = __( 'Default Msg', 'formidable' );
|
681 |
+
$entry_shortcodes['default-html'] = __( 'Default HTML', 'formidable' );
|
682 |
+
$entry_shortcodes['default-plain'] = __( 'Default Plain', 'formidable' );
|
683 |
+
} else {
|
684 |
+
$entry_shortcodes['detaillink'] = __( 'Detail Link', 'formidable' );
|
685 |
+
$entry_shortcodes['editlink location="front" label="Edit" page_id=x'] = __( 'Edit Entry Link', 'formidable' );
|
686 |
+
$entry_shortcodes['evenodd'] = __( 'Even/Odd', 'formidable' );
|
687 |
+
$entry_shortcodes['entry_count'] = __( 'Entry Count', 'formidable' );
|
688 |
+
}
|
689 |
|
690 |
+
/**
|
691 |
+
* Use this hook to add or remove buttons in the helpers section
|
692 |
+
* in the customization panel
|
693 |
+
* @since 2.0.6
|
694 |
+
*/
|
695 |
+
$entry_shortcodes = apply_filters( 'frm_helper_shortcodes', $entry_shortcodes, $settings_tab );
|
696 |
|
697 |
+
return $entry_shortcodes;
|
698 |
+
}
|
699 |
|
700 |
// Insert the form class setting into the form
|
701 |
public static function form_classes($form) {
|
702 |
if ( isset($form->options['form_class']) ) {
|
703 |
+
echo esc_attr( sanitize_text_field( $form->options['form_class'] ) );
|
704 |
}
|
705 |
}
|
706 |
|
707 |
public static function get_email_html() {
|
708 |
check_ajax_referer( 'frm_ajax', 'nonce' );
|
709 |
echo FrmEntriesController::show_entry_shortcode( array(
|
710 |
+
'form_id' => FrmAppHelper::get_post_param( 'form_id', '', 'absint' ),
|
711 |
'default_email' => true,
|
712 |
+
'plain_text' => FrmAppHelper::get_post_param( 'plain_text', '', 'absint' ),
|
713 |
) );
|
714 |
wp_die();
|
715 |
}
|
717 |
public static function filter_content( $content, $form, $entry = false ) {
|
718 |
if ( ! $entry || ! is_object( $entry ) ) {
|
719 |
if ( ! $entry || ! is_numeric( $entry ) ) {
|
720 |
+
$entry = FrmAppHelper::get_post_param( 'id', false, 'sanitize_title' );
|
721 |
}
|
722 |
|
723 |
FrmEntriesHelper::maybe_get_entry( $entry );
|
789 |
}
|
790 |
|
791 |
if ( isset( $message ) && ! empty( $message ) ) {
|
792 |
+
echo '<div id="message" class="updated frm_msg_padding">' . FrmAppHelper::kses( $message ) . '</div>';
|
793 |
}
|
794 |
|
795 |
return $errors;
|
classes/controllers/FrmHooksController.php
CHANGED
@@ -24,9 +24,9 @@ class FrmHooksController {
|
|
24 |
}
|
25 |
} else {
|
26 |
// Make sure the hooks are only triggered once
|
27 |
-
add_filter('frm'. str_replace('load', '', $trigger_hooks) .'_loaded', '__return_true');
|
28 |
}
|
29 |
-
unset($trigger_hooks);
|
30 |
|
31 |
// Instansiate Controllers
|
32 |
foreach ( $controllers as $c ) {
|
@@ -41,156 +41,156 @@ class FrmHooksController {
|
|
41 |
|
42 |
public static function load_hooks() {
|
43 |
if ( ! is_admin() ) {
|
44 |
-
add_filter('the_content', 'FrmAppController::page_route', 10);
|
45 |
}
|
46 |
|
47 |
-
add_action('plugins_loaded', 'FrmAppController::load_lang' );
|
48 |
-
add_action('init', 'FrmAppController::front_head' );
|
49 |
-
add_filter('widget_text', 'FrmAppController::widget_text_filter', 8 );
|
50 |
-
add_action('wp_footer', 'FrmAppController::footer_js', 1, 0);
|
51 |
|
52 |
// Entries controller
|
53 |
-
add_action('wp', 'FrmEntriesController::process_entry', 10, 0);
|
54 |
-
add_action('frm_wp', 'FrmEntriesController::process_entry', 10, 0);
|
55 |
-
add_filter('frm_redirect_url', 'FrmEntriesController::delete_entry_before_redirect', 50, 3);
|
56 |
-
add_action('frm_after_entry_processed', 'FrmEntriesController::delete_entry_after_save', 100);
|
57 |
-
add_filter('frm_email_value', 'FrmEntriesController::filter_email_value', 10, 3);
|
58 |
-
add_filter('frmpro_fields_replace_shortcodes', 'FrmEntriesController::filter_shortcode_value', 10, 4);
|
59 |
|
60 |
// Form Actions Controller
|
61 |
-
add_action('init', 'FrmFormActionsController::register_post_types', 1);
|
62 |
add_action( 'frm_after_create_entry', 'FrmFormActionsController::trigger_create_actions', 20, 3 );
|
63 |
|
64 |
// Forms Controller
|
65 |
-
add_action('widgets_init', 'FrmFormsController::register_widgets' );
|
66 |
-
add_filter('frm_content', 'FrmFormsController::filter_content', 10, 3);
|
67 |
-
add_filter('frm_replace_content_shortcodes', 'FrmFormsController::replace_content_shortcodes', 20, 3);
|
68 |
-
add_action('admin_bar_init', 'FrmFormsController::admin_bar_css' );
|
69 |
-
add_action('wp_before_admin_bar_render', 'FrmFormsController::admin_bar_configure' );
|
70 |
-
add_action('wp_scheduled_delete', 'FrmFormsController::scheduled_delete' );
|
71 |
|
72 |
// Form Shortcodes
|
73 |
-
add_shortcode('formidable', 'FrmFormsController::get_form_shortcode' );
|
74 |
|
75 |
// Styles Controller
|
76 |
-
add_action('init', 'FrmStylesController::register_post_types', 0);
|
77 |
-
add_filter('frm_get_style_opts', 'FrmStylesController::get_style_opts');
|
78 |
-
add_filter('frm_add_form_style_class', 'FrmStylesController::get_form_style_class', 10, 2);
|
79 |
-
add_filter('frm_show_entry_styles', 'FrmStylesController::show_entry_styles');
|
80 |
}
|
81 |
|
82 |
public static function load_admin_hooks() {
|
83 |
-
add_action('admin_menu', 'FrmAppController::menu', 1);
|
84 |
-
add_action('admin_enqueue_scripts', 'FrmAppController::load_wp_admin_style' );
|
85 |
-
add_action('admin_notices', 'FrmAppController::pro_get_started_headline' );
|
86 |
add_action( 'admin_init', 'FrmAppController::admin_init', 11 );
|
87 |
-
register_activation_hook(FrmAppHelper::plugin_path().'/formidable.php', 'FrmAppController::activation_install' );
|
88 |
|
89 |
// Entries Controller
|
90 |
-
add_action('admin_menu', 'FrmEntriesController::menu', 12);
|
91 |
-
add_filter('contextual_help', 'FrmEntriesController::contextual_help', 10, 3 );
|
92 |
-
add_filter('set-screen-option', 'FrmEntriesController::save_per_page', 10, 3);
|
93 |
-
add_filter('update_user_metadata', 'FrmEntriesController::check_hidden_cols', 10, 5);
|
94 |
-
add_action('updated_user_meta', 'FrmEntriesController::update_hidden_cols', 10, 4);
|
95 |
|
96 |
// Fields Controller
|
97 |
-
add_filter('frm_display_field_options', 'FrmFieldsController::display_field_options');
|
98 |
-
add_action('frm_field_options_form', 'FrmFieldsController::add_conditional_update_msg', 50);
|
99 |
|
100 |
// Form Actions Controller
|
101 |
-
if ( FrmAppHelper::is_admin_page('formidable' ) ) {
|
102 |
-
add_action('frm_before_update_form_settings', 'FrmFormActionsController::update_settings');
|
103 |
}
|
104 |
-
add_action('frm_after_duplicate_form', 'FrmFormActionsController::duplicate_form_actions', 20, 3);
|
105 |
|
106 |
// Forms Controller
|
107 |
-
add_action('admin_menu', 'FrmFormsController::menu', 10);
|
108 |
-
add_action('admin_head-toplevel_page_formidable', 'FrmFormsController::head' );
|
109 |
|
110 |
-
add_filter('set-screen-option', 'FrmFormsController::save_per_page', 10, 3);
|
111 |
-
add_action('admin_footer',
|
112 |
-
add_filter('media_buttons_context', 'FrmFormsController::insert_form_button' );
|
113 |
|
114 |
// Forms Model
|
115 |
-
add_action('frm_after_duplicate_form', 'FrmForm::after_duplicate', 10, 2);
|
116 |
|
117 |
// Settings Controller
|
118 |
-
add_action('admin_menu', 'FrmSettingsController::menu', 45);
|
119 |
-
add_action('frm_before_settings', 'FrmSettingsController::license_box');
|
120 |
|
121 |
// Stats Controller
|
122 |
-
add_action('admin_menu', 'FrmStatisticsController::menu', 24);
|
123 |
-
add_action('frm_form_action_reports', 'FrmStatisticsController::list_reports');
|
124 |
|
125 |
// Styles Controller
|
126 |
-
add_action('admin_menu', 'FrmStylesController::menu', 14);
|
127 |
-
add_action('admin_init', 'FrmStylesController::admin_init');
|
128 |
|
129 |
// XML Controller
|
130 |
-
add_action('admin_menu', 'FrmXMLController::menu', 41);
|
131 |
}
|
132 |
|
133 |
public static function load_ajax_hooks() {
|
134 |
add_action( 'wp_ajax_frm_silent_upgrade', 'FrmAppController::ajax_install' );
|
135 |
add_action( 'wp_ajax_nopriv_frm_silent_upgrade', 'FrmAppController::ajax_install' );
|
136 |
add_action( 'wp_ajax_frm_install', 'FrmAppController::ajax_install' );
|
137 |
-
add_action('wp_ajax_frm_uninstall', 'FrmAppController::uninstall' );
|
138 |
-
add_action('wp_ajax_frm_deauthorize', 'FrmAppController::deauthorize' );
|
139 |
|
140 |
-
add_action('wp_ajax_frmpro_css', 'FrmAppController::load_css' );
|
141 |
-
add_action('wp_ajax_nopriv_frmpro_css', 'FrmAppController::load_css' );
|
142 |
|
143 |
// Fields Controller
|
144 |
-
add_action('wp_ajax_frm_load_field', 'FrmFieldsController::load_field');
|
145 |
-
add_action('wp_ajax_frm_insert_field', 'FrmFieldsController::create');
|
146 |
-
add_action('wp_ajax_frm_update_field_form_id', 'FrmFieldsController::update_form_id');
|
147 |
-
add_action('wp_ajax_frm_field_name_in_place_edit', 'FrmFieldsController::edit_name');
|
148 |
-
add_action('wp_ajax_frm_update_ajax_option', 'FrmFieldsController::update_ajax_option');
|
149 |
-
add_action('wp_ajax_frm_duplicate_field', 'FrmFieldsController::duplicate');
|
150 |
-
add_action('wp_ajax_frm_delete_field', 'FrmFieldsController::destroy');
|
151 |
-
add_action('wp_ajax_frm_add_field_option', 'FrmFieldsController::add_option');
|
152 |
-
add_action('wp_ajax_frm_field_option_ipe', 'FrmFieldsController::edit_option');
|
153 |
-
add_action('wp_ajax_frm_delete_field_option', 'FrmFieldsController::delete_option');
|
154 |
-
add_action('wp_ajax_frm_import_choices', 'FrmFieldsController::import_choices');
|
155 |
-
add_action('wp_ajax_frm_import_options', 'FrmFieldsController::import_options');
|
156 |
-
add_action('wp_ajax_frm_update_field_order', 'FrmFieldsController::update_order');
|
157 |
|
158 |
// Form Actions Controller
|
159 |
-
add_action('wp_ajax_frm_add_form_action', 'FrmFormActionsController::add_form_action');
|
160 |
-
add_action('wp_ajax_frm_form_action_fill', 'FrmFormActionsController::fill_action');
|
161 |
|
162 |
// Forms Controller
|
163 |
add_action( 'wp_ajax_frm_create_from_template', 'FrmFormsController::_create_from_template' );
|
164 |
add_action( 'wp_ajax_frm_save_form', 'FrmFormsController::route' );
|
165 |
add_action( 'wp_ajax_frm_form_key_in_place_edit', 'FrmFormsController::edit_key' );
|
166 |
add_action( 'wp_ajax_frm_form_desc_in_place_edit', 'FrmFormsController::edit_description' );
|
167 |
-
add_action('wp_ajax_frm_get_default_html', 'FrmFormsController::get_email_html' );
|
168 |
-
add_action('wp_ajax_frm_get_shortcode_opts',
|
169 |
-
add_action('wp_ajax_frm_forms_preview', 'FrmFormsController::preview' );
|
170 |
-
add_action('wp_ajax_nopriv_frm_forms_preview', 'FrmFormsController::preview' );
|
171 |
|
172 |
// Styles Controller
|
173 |
-
add_action('wp_ajax_frm_settings_reset', 'FrmStylesController::reset_styling');
|
174 |
-
add_action('wp_ajax_frm_change_styling', 'FrmStylesController::change_styling');
|
175 |
-
add_action('wp_ajax_frmpro_load_css', 'FrmStylesController::load_css');
|
176 |
-
add_action('wp_ajax_nopriv_frmpro_load_css', 'FrmStylesController::load_css');
|
177 |
|
178 |
// XML Controller
|
179 |
-
add_action('wp_ajax_frm_export_xml', 'FrmXMLController::export_xml');
|
180 |
}
|
181 |
|
182 |
public static function load_form_hooks() {
|
183 |
// Fields Controller
|
184 |
-
add_filter('frm_field_type', 'FrmFieldsController::change_type');
|
185 |
-
add_action('frm_field_input_html', 'FrmFieldsController::input_html');
|
186 |
-
add_filter('frm_field_value_saved', 'FrmFieldsController::check_value', 50, 3);
|
187 |
-
add_filter('frm_field_label_seen', 'FrmFieldsController::check_label');
|
188 |
|
189 |
// Forms Controller
|
190 |
add_filter( 'frm_form_classes', 'FrmFormsController::form_classes' );
|
191 |
|
192 |
// Styles Controller
|
193 |
-
add_filter('frm_use_important_width', 'FrmStylesController::important_style', 10, 2 );
|
194 |
}
|
195 |
|
196 |
public static function load_view_hooks() {
|
24 |
}
|
25 |
} else {
|
26 |
// Make sure the hooks are only triggered once
|
27 |
+
add_filter( 'frm' . str_replace( 'load', '', $trigger_hooks ) . '_loaded', '__return_true' );
|
28 |
}
|
29 |
+
unset( $trigger_hooks );
|
30 |
|
31 |
// Instansiate Controllers
|
32 |
foreach ( $controllers as $c ) {
|
41 |
|
42 |
public static function load_hooks() {
|
43 |
if ( ! is_admin() ) {
|
44 |
+
add_filter( 'the_content', 'FrmAppController::page_route', 10 );
|
45 |
}
|
46 |
|
47 |
+
add_action( 'plugins_loaded', 'FrmAppController::load_lang' );
|
48 |
+
add_action( 'init', 'FrmAppController::front_head' );
|
49 |
+
add_filter( 'widget_text', 'FrmAppController::widget_text_filter', 8 );
|
50 |
+
add_action( 'wp_footer', 'FrmAppController::footer_js', 1, 0 );
|
51 |
|
52 |
// Entries controller
|
53 |
+
add_action( 'wp', 'FrmEntriesController::process_entry', 10, 0 );
|
54 |
+
add_action( 'frm_wp', 'FrmEntriesController::process_entry', 10, 0 );
|
55 |
+
add_filter( 'frm_redirect_url', 'FrmEntriesController::delete_entry_before_redirect', 50, 3 );
|
56 |
+
add_action( 'frm_after_entry_processed', 'FrmEntriesController::delete_entry_after_save', 100 );
|
57 |
+
add_filter( 'frm_email_value', 'FrmEntriesController::filter_email_value', 10, 3 );
|
58 |
+
add_filter( 'frmpro_fields_replace_shortcodes', 'FrmEntriesController::filter_shortcode_value', 10, 4 );
|
59 |
|
60 |
// Form Actions Controller
|
61 |
+
add_action( 'init', 'FrmFormActionsController::register_post_types', 1 );
|
62 |
add_action( 'frm_after_create_entry', 'FrmFormActionsController::trigger_create_actions', 20, 3 );
|
63 |
|
64 |
// Forms Controller
|
65 |
+
add_action( 'widgets_init', 'FrmFormsController::register_widgets' );
|
66 |
+
add_filter( 'frm_content', 'FrmFormsController::filter_content', 10, 3 );
|
67 |
+
add_filter( 'frm_replace_content_shortcodes', 'FrmFormsController::replace_content_shortcodes', 20, 3 );
|
68 |
+
add_action( 'admin_bar_init', 'FrmFormsController::admin_bar_css' );
|
69 |
+
add_action( 'wp_before_admin_bar_render', 'FrmFormsController::admin_bar_configure' );
|
70 |
+
add_action( 'wp_scheduled_delete', 'FrmFormsController::scheduled_delete' );
|
71 |
|
72 |
// Form Shortcodes
|
73 |
+
add_shortcode( 'formidable', 'FrmFormsController::get_form_shortcode' );
|
74 |
|
75 |
// Styles Controller
|
76 |
+
add_action( 'init', 'FrmStylesController::register_post_types', 0 );
|
77 |
+
add_filter( 'frm_get_style_opts', 'FrmStylesController::get_style_opts' );
|
78 |
+
add_filter( 'frm_add_form_style_class', 'FrmStylesController::get_form_style_class', 10, 2 );
|
79 |
+
add_filter( 'frm_show_entry_styles', 'FrmStylesController::show_entry_styles' );
|
80 |
}
|
81 |
|
82 |
public static function load_admin_hooks() {
|
83 |
+
add_action( 'admin_menu', 'FrmAppController::menu', 1 );
|
84 |
+
add_action( 'admin_enqueue_scripts', 'FrmAppController::load_wp_admin_style' );
|
85 |
+
add_action( 'admin_notices', 'FrmAppController::pro_get_started_headline' );
|
86 |
add_action( 'admin_init', 'FrmAppController::admin_init', 11 );
|
87 |
+
register_activation_hook( FrmAppHelper::plugin_path() . '/formidable.php', 'FrmAppController::activation_install' );
|
88 |
|
89 |
// Entries Controller
|
90 |
+
add_action( 'admin_menu', 'FrmEntriesController::menu', 12 );
|
91 |
+
add_filter( 'contextual_help', 'FrmEntriesController::contextual_help', 10, 3 );
|
92 |
+
add_filter( 'set-screen-option', 'FrmEntriesController::save_per_page', 10, 3 );
|
93 |
+
add_filter( 'update_user_metadata', 'FrmEntriesController::check_hidden_cols', 10, 5 );
|
94 |
+
add_action( 'updated_user_meta', 'FrmEntriesController::update_hidden_cols', 10, 4 );
|
95 |
|
96 |
// Fields Controller
|
97 |
+
add_filter( 'frm_display_field_options', 'FrmFieldsController::display_field_options' );
|
98 |
+
add_action( 'frm_field_options_form', 'FrmFieldsController::add_conditional_update_msg', 50 );
|
99 |
|
100 |
// Form Actions Controller
|
101 |
+
if ( FrmAppHelper::is_admin_page( 'formidable' ) ) {
|
102 |
+
add_action( 'frm_before_update_form_settings', 'FrmFormActionsController::update_settings' );
|
103 |
}
|
104 |
+
add_action( 'frm_after_duplicate_form', 'FrmFormActionsController::duplicate_form_actions', 20, 3 );
|
105 |
|
106 |
// Forms Controller
|
107 |
+
add_action( 'admin_menu', 'FrmFormsController::menu', 10 );
|
108 |
+
add_action( 'admin_head-toplevel_page_formidable', 'FrmFormsController::head' );
|
109 |
|
110 |
+
add_filter( 'set-screen-option', 'FrmFormsController::save_per_page', 10, 3 );
|
111 |
+
add_action( 'admin_footer', 'FrmFormsController::insert_form_popup' );
|
112 |
+
add_filter( 'media_buttons_context', 'FrmFormsController::insert_form_button' );
|
113 |
|
114 |
// Forms Model
|
115 |
+
add_action( 'frm_after_duplicate_form', 'FrmForm::after_duplicate', 10, 2 );
|
116 |
|
117 |
// Settings Controller
|
118 |
+
add_action( 'admin_menu', 'FrmSettingsController::menu', 45 );
|
119 |
+
add_action( 'frm_before_settings', 'FrmSettingsController::license_box' );
|
120 |
|
121 |
// Stats Controller
|
122 |
+
add_action( 'admin_menu', 'FrmStatisticsController::menu', 24 );
|
123 |
+
add_action( 'frm_form_action_reports', 'FrmStatisticsController::list_reports' );
|
124 |
|
125 |
// Styles Controller
|
126 |
+
add_action( 'admin_menu', 'FrmStylesController::menu', 14 );
|
127 |
+
add_action( 'admin_init', 'FrmStylesController::admin_init' );
|
128 |
|
129 |
// XML Controller
|
130 |
+
add_action( 'admin_menu', 'FrmXMLController::menu', 41 );
|
131 |
}
|
132 |
|
133 |
public static function load_ajax_hooks() {
|
134 |
add_action( 'wp_ajax_frm_silent_upgrade', 'FrmAppController::ajax_install' );
|
135 |
add_action( 'wp_ajax_nopriv_frm_silent_upgrade', 'FrmAppController::ajax_install' );
|
136 |
add_action( 'wp_ajax_frm_install', 'FrmAppController::ajax_install' );
|
137 |
+
add_action( 'wp_ajax_frm_uninstall', 'FrmAppController::uninstall' );
|
138 |
+
add_action( 'wp_ajax_frm_deauthorize', 'FrmAppController::deauthorize' );
|
139 |
|
140 |
+
add_action( 'wp_ajax_frmpro_css', 'FrmAppController::load_css' );
|
141 |
+
add_action( 'wp_ajax_nopriv_frmpro_css', 'FrmAppController::load_css' );
|
142 |
|
143 |
// Fields Controller
|
144 |
+
add_action( 'wp_ajax_frm_load_field', 'FrmFieldsController::load_field' );
|
145 |
+
add_action( 'wp_ajax_frm_insert_field', 'FrmFieldsController::create' );
|
146 |
+
add_action( 'wp_ajax_frm_update_field_form_id', 'FrmFieldsController::update_form_id' );
|
147 |
+
add_action( 'wp_ajax_frm_field_name_in_place_edit', 'FrmFieldsController::edit_name' );
|
148 |
+
add_action( 'wp_ajax_frm_update_ajax_option', 'FrmFieldsController::update_ajax_option' );
|
149 |
+
add_action( 'wp_ajax_frm_duplicate_field', 'FrmFieldsController::duplicate' );
|
150 |
+
add_action( 'wp_ajax_frm_delete_field', 'FrmFieldsController::destroy' );
|
151 |
+
add_action( 'wp_ajax_frm_add_field_option', 'FrmFieldsController::add_option' );
|
152 |
+
add_action( 'wp_ajax_frm_field_option_ipe', 'FrmFieldsController::edit_option' );
|
153 |
+
add_action( 'wp_ajax_frm_delete_field_option', 'FrmFieldsController::delete_option' );
|
154 |
+
add_action( 'wp_ajax_frm_import_choices', 'FrmFieldsController::import_choices' );
|
155 |
+
add_action( 'wp_ajax_frm_import_options', 'FrmFieldsController::import_options' );
|
156 |
+
add_action( 'wp_ajax_frm_update_field_order', 'FrmFieldsController::update_order' );
|
157 |
|
158 |
// Form Actions Controller
|
159 |
+
add_action( 'wp_ajax_frm_add_form_action', 'FrmFormActionsController::add_form_action' );
|
160 |
+
add_action( 'wp_ajax_frm_form_action_fill', 'FrmFormActionsController::fill_action' );
|
161 |
|
162 |
// Forms Controller
|
163 |
add_action( 'wp_ajax_frm_create_from_template', 'FrmFormsController::_create_from_template' );
|
164 |
add_action( 'wp_ajax_frm_save_form', 'FrmFormsController::route' );
|
165 |
add_action( 'wp_ajax_frm_form_key_in_place_edit', 'FrmFormsController::edit_key' );
|
166 |
add_action( 'wp_ajax_frm_form_desc_in_place_edit', 'FrmFormsController::edit_description' );
|
167 |
+
add_action( 'wp_ajax_frm_get_default_html', 'FrmFormsController::get_email_html' );
|
168 |
+
add_action( 'wp_ajax_frm_get_shortcode_opts', 'FrmFormsController::get_shortcode_opts' );
|
169 |
+
add_action( 'wp_ajax_frm_forms_preview', 'FrmFormsController::preview' );
|
170 |
+
add_action( 'wp_ajax_nopriv_frm_forms_preview', 'FrmFormsController::preview' );
|
171 |
|
172 |
// Styles Controller
|
173 |
+
add_action( 'wp_ajax_frm_settings_reset', 'FrmStylesController::reset_styling' );
|
174 |
+
add_action( 'wp_ajax_frm_change_styling', 'FrmStylesController::change_styling' );
|
175 |
+
add_action( 'wp_ajax_frmpro_load_css', 'FrmStylesController::load_css' );
|
176 |
+
add_action( 'wp_ajax_nopriv_frmpro_load_css', 'FrmStylesController::load_css' );
|
177 |
|
178 |
// XML Controller
|
179 |
+
add_action( 'wp_ajax_frm_export_xml', 'FrmXMLController::export_xml' );
|
180 |
}
|
181 |
|
182 |
public static function load_form_hooks() {
|
183 |
// Fields Controller
|
184 |
+
add_filter( 'frm_field_type', 'FrmFieldsController::change_type' );
|
185 |
+
add_action( 'frm_field_input_html', 'FrmFieldsController::input_html' );
|
186 |
+
add_filter( 'frm_field_value_saved', 'FrmFieldsController::check_value', 50, 3 );
|
187 |
+
add_filter( 'frm_field_label_seen', 'FrmFieldsController::check_label' );
|
188 |
|
189 |
// Forms Controller
|
190 |
add_filter( 'frm_form_classes', 'FrmFormsController::form_classes' );
|
191 |
|
192 |
// Styles Controller
|
193 |
+
add_filter( 'frm_use_important_width', 'FrmStylesController::important_style', 10, 2 );
|
194 |
}
|
195 |
|
196 |
public static function load_view_hooks() {
|
classes/controllers/FrmSettingsController.php
CHANGED
@@ -4,20 +4,14 @@ class FrmSettingsController {
|
|
4 |
|
5 |
public static function menu() {
|
6 |
// Make sure admins can see the menu items
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
foreach ( $frm_roles as $frm_role => $frm_role_description ) {
|
11 |
-
$role->add_cap( $frm_role );
|
12 |
-
}
|
13 |
-
}
|
14 |
-
|
15 |
-
add_submenu_page('formidable', 'Formidable | '. __( 'Global Settings', 'formidable' ), __( 'Global Settings', 'formidable' ), 'frm_change_settings', 'formidable-settings', 'FrmSettingsController::route');
|
16 |
}
|
17 |
|
18 |
public static function license_box() {
|
19 |
-
|
20 |
-
include(FrmAppHelper::plugin_path() .'/classes/views/frm-settings/license_box.php');
|
21 |
}
|
22 |
|
23 |
public static function display_form( $errors = array(), $message = '' ) {
|
@@ -28,11 +22,11 @@ class FrmSettingsController {
|
|
28 |
|
29 |
$uploads = wp_upload_dir();
|
30 |
$target_path = $uploads['basedir'] . '/formidable/css';
|
31 |
-
$sections = apply_filters('frm_add_settings_section', array());
|
32 |
|
33 |
-
$captcha_lang = FrmAppHelper::locales('captcha');
|
34 |
|
35 |
-
require(FrmAppHelper::plugin_path() .'/classes/views/frm-settings/form.php');
|
36 |
}
|
37 |
|
38 |
public static function process_form( $stop_load = false ) {
|
@@ -40,7 +34,8 @@ class FrmSettingsController {
|
|
40 |
|
41 |
$frm_settings = FrmAppHelper::get_settings();
|
42 |
|
43 |
-
|
|
|
44 |
wp_die( $frm_settings->admin_permission );
|
45 |
}
|
46 |
|
4 |
|
5 |
public static function menu() {
|
6 |
// Make sure admins can see the menu items
|
7 |
+
FrmAppHelper::force_capability( 'frm_change_settings' );
|
8 |
+
|
9 |
+
add_submenu_page( 'formidable', 'Formidable | ' . __( 'Global Settings', 'formidable' ), __( 'Global Settings', 'formidable' ), 'frm_change_settings', 'formidable-settings', 'FrmSettingsController::route' );
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
}
|
11 |
|
12 |
public static function license_box() {
|
13 |
+
$a = FrmAppHelper::simple_get( 't', 'sanitize_title', 'general_settings' );
|
14 |
+
include( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/license_box.php' );
|
15 |
}
|
16 |
|
17 |
public static function display_form( $errors = array(), $message = '' ) {
|
22 |
|
23 |
$uploads = wp_upload_dir();
|
24 |
$target_path = $uploads['basedir'] . '/formidable/css';
|
25 |
+
$sections = apply_filters( 'frm_add_settings_section', array() );
|
26 |
|
27 |
+
$captcha_lang = FrmAppHelper::locales( 'captcha' );
|
28 |
|
29 |
+
require( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/form.php' );
|
30 |
}
|
31 |
|
32 |
public static function process_form( $stop_load = false ) {
|
34 |
|
35 |
$frm_settings = FrmAppHelper::get_settings();
|
36 |
|
37 |
+
$process_form = FrmAppHelper::simple_request( array( 'param' => 'process_form', 'sanitize' => 'sanitize_text_field', 'type' => 'post' ) );
|
38 |
+
if ( ! wp_verify_nonce( $process_form, 'process_form_nonce' ) ) {
|
39 |
wp_die( $frm_settings->admin_permission );
|
40 |
}
|
41 |
|
classes/controllers/FrmStatisticsController.php
CHANGED
@@ -3,18 +3,18 @@
|
|
3 |
class FrmStatisticsController {
|
4 |
|
5 |
public static function menu() {
|
6 |
-
add_submenu_page( 'formidable', 'Formidable | '. __( 'Views', 'formidable' ), '<span class="frm_inactive_menu">'. __( 'Views', 'formidable' ) .'</span>', 'administrator', 'formidable-entry-templates', 'FrmStatisticsController::list_displays' );
|
7 |
}
|
8 |
|
9 |
public static function list_reports() {
|
10 |
-
add_filter('frm_form_stop_action_reports', '__return_true');
|
11 |
$form = FrmAppHelper::get_param( 'form', false, 'get', 'absint' );
|
12 |
-
require(FrmAppHelper::plugin_path() .'/classes/views/frm-statistics/list.php');
|
13 |
}
|
14 |
|
15 |
public static function list_displays() {
|
16 |
$form = FrmAppHelper::get_param( 'form', false, 'get', 'sanitize_title' );
|
17 |
-
require(FrmAppHelper::plugin_path() .'/classes/views/frm-statistics/list_displays.php');
|
18 |
}
|
19 |
|
20 |
}
|
3 |
class FrmStatisticsController {
|
4 |
|
5 |
public static function menu() {
|
6 |
+
add_submenu_page( 'formidable', 'Formidable | ' . __( 'Views', 'formidable' ), '<span class="frm_inactive_menu">' . __( 'Views', 'formidable' ) . '</span>', 'administrator', 'formidable-entry-templates', 'FrmStatisticsController::list_displays' );
|
7 |
}
|
8 |
|
9 |
public static function list_reports() {
|
10 |
+
add_filter( 'frm_form_stop_action_reports', '__return_true' );
|
11 |
$form = FrmAppHelper::get_param( 'form', false, 'get', 'absint' );
|
12 |
+
require( FrmAppHelper::plugin_path() . '/classes/views/frm-statistics/list.php' );
|
13 |
}
|
14 |
|
15 |
public static function list_displays() {
|
16 |
$form = FrmAppHelper::get_param( 'form', false, 'get', 'sanitize_title' );
|
17 |
+
require( FrmAppHelper::plugin_path() . '/classes/views/frm-statistics/list_displays.php' );
|
18 |
}
|
19 |
|
20 |
}
|
classes/controllers/FrmStylesController.php
CHANGED
@@ -91,8 +91,10 @@ class FrmStylesController {
|
|
91 |
public static function save() {
|
92 |
$frm_style = new FrmStyle();
|
93 |
$message = '';
|
94 |
-
|
95 |
-
|
|
|
|
|
96 |
$id = $frm_style->update($post_id);
|
97 |
if ( empty($post_id) && ! empty($id) ) {
|
98 |
// set the post id to the new style so it will be loaded for editing
|
@@ -123,6 +125,10 @@ class FrmStylesController {
|
|
123 |
include(FrmAppHelper::plugin_path() .'/classes/views/styles/show.php');
|
124 |
}
|
125 |
|
|
|
|
|
|
|
|
|
126 |
private static function manage($message = '', $forms = array()) {
|
127 |
$frm_style = new FrmStyle();
|
128 |
$styles = $frm_style->get_all();
|
@@ -136,7 +142,8 @@ class FrmStylesController {
|
|
136 |
}
|
137 |
|
138 |
private static function manage_styles() {
|
139 |
-
|
|
|
140 |
return self::manage();
|
141 |
}
|
142 |
|
@@ -175,8 +182,9 @@ class FrmStylesController {
|
|
175 |
$frm_style = new FrmStyle();
|
176 |
|
177 |
$message = '';
|
178 |
-
|
179 |
-
|
|
|
180 |
$frm_style->update($post_id);
|
181 |
$message = __( 'Your styling settings have been saved.', 'formidable' );
|
182 |
}
|
@@ -262,7 +270,7 @@ class FrmStylesController {
|
|
262 |
|
263 |
public static function include_style_section($atts, $sec) {
|
264 |
extract($atts);
|
265 |
-
|
266 |
include(FrmAppHelper::plugin_path() .'/classes/views/styles/_'. $sec['args'] .'.php');
|
267 |
}
|
268 |
|
91 |
public static function save() {
|
92 |
$frm_style = new FrmStyle();
|
93 |
$message = '';
|
94 |
+
$post_id = FrmAppHelper::get_post_param( 'ID', false, 'sanitize_title' );
|
95 |
+
$style_nonce = FrmAppHelper::get_post_param( 'frm_style', '', 'sanitize_text_field' );
|
96 |
+
|
97 |
+
if ( $post_id !== false && wp_verify_nonce( $style_nonce, 'frm_style_nonce' ) ) {
|
98 |
$id = $frm_style->update($post_id);
|
99 |
if ( empty($post_id) && ! empty($id) ) {
|
100 |
// set the post id to the new style so it will be loaded for editing
|
125 |
include(FrmAppHelper::plugin_path() .'/classes/views/styles/show.php');
|
126 |
}
|
127 |
|
128 |
+
/**
|
129 |
+
* @param string $message
|
130 |
+
* @param array $forms
|
131 |
+
*/
|
132 |
private static function manage($message = '', $forms = array()) {
|
133 |
$frm_style = new FrmStyle();
|
134 |
$styles = $frm_style->get_all();
|
142 |
}
|
143 |
|
144 |
private static function manage_styles() {
|
145 |
+
$style_nonce = FrmAppHelper::get_post_param( 'frm_manage_style', '', 'sanitize_text_field' );
|
146 |
+
if ( ! $_POST || ! isset( $_POST['style'] ) || ! wp_verify_nonce( $style_nonce, 'frm_manage_style_nonce' ) ) {
|
147 |
return self::manage();
|
148 |
}
|
149 |
|
182 |
$frm_style = new FrmStyle();
|
183 |
|
184 |
$message = '';
|
185 |
+
$post_id = FrmAppHelper::get_post_param( 'ID', false, 'sanitize_text_field' );
|
186 |
+
$nonce = FrmAppHelper::get_post_param( 'frm_custom_css', '', 'sanitize_text_field' );
|
187 |
+
if ( wp_verify_nonce( $nonce, 'frm_custom_css_nonce' ) ) {
|
188 |
$frm_style->update($post_id);
|
189 |
$message = __( 'Your styling settings have been saved.', 'formidable' );
|
190 |
}
|
270 |
|
271 |
public static function include_style_section($atts, $sec) {
|
272 |
extract($atts);
|
273 |
+
$current_tab = FrmAppHelper::simple_get( 'page-tab', 'sanitize_title', 'default' );
|
274 |
include(FrmAppHelper::plugin_path() .'/classes/views/styles/_'. $sec['args'] .'.php');
|
275 |
}
|
276 |
|
classes/controllers/FrmXMLController.php
CHANGED
@@ -137,8 +137,8 @@ class FrmXMLController {
|
|
137 |
wp_die( $error );
|
138 |
}
|
139 |
|
140 |
-
$ids =
|
141 |
-
$type =
|
142 |
$format = FrmAppHelper::get_post_param( 'format', 'xml', 'sanitize_title' );
|
143 |
|
144 |
if ( ! headers_sent() && ! $type ) {
|
137 |
wp_die( $error );
|
138 |
}
|
139 |
|
140 |
+
$ids = FrmAppHelper::get_post_param( 'frm_export_forms', array() );
|
141 |
+
$type = FrmAppHelper::get_post_param( 'type', array() );
|
142 |
$format = FrmAppHelper::get_post_param( 'format', 'xml', 'sanitize_title' );
|
143 |
|
144 |
if ( ! headers_sent() && ! $type ) {
|
classes/helpers/FrmAppHelper.php
CHANGED
@@ -10,7 +10,7 @@ class FrmAppHelper {
|
|
10 |
/**
|
11 |
* @since 2.0
|
12 |
*/
|
13 |
-
public static $plug_version = '2.0.
|
14 |
|
15 |
/**
|
16 |
* @since 1.07.02
|
@@ -104,11 +104,12 @@ class FrmAppHelper {
|
|
104 |
*/
|
105 |
public static function is_admin_page($page = 'formidable' ) {
|
106 |
global $pagenow;
|
|
|
107 |
if ( $pagenow ) {
|
108 |
-
|
109 |
}
|
110 |
|
111 |
-
|
112 |
}
|
113 |
|
114 |
/**
|
@@ -121,7 +122,8 @@ class FrmAppHelper {
|
|
121 |
*/
|
122 |
public static function is_preview_page() {
|
123 |
global $pagenow;
|
124 |
-
|
|
|
125 |
}
|
126 |
|
127 |
/**
|
@@ -211,7 +213,7 @@ class FrmAppHelper {
|
|
211 |
}
|
212 |
self::sanitize_value( $value, $sanitize );
|
213 |
} else {
|
214 |
-
$value = self::
|
215 |
}
|
216 |
|
217 |
if ( isset( $params ) && is_array( $value ) && ! empty( $value ) ) {
|
@@ -228,13 +230,15 @@ class FrmAppHelper {
|
|
228 |
return $value;
|
229 |
}
|
230 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
231 |
public static function get_post_param( $param, $default = '', $sanitize = '' ) {
|
232 |
-
$
|
233 |
-
if ( isset( $_POST[ $param ] ) ) {
|
234 |
-
$val = stripslashes_deep( maybe_unserialize( $_POST[ $param ] ) );
|
235 |
-
self::sanitize_value( $value, $sanitize );
|
236 |
-
}
|
237 |
-
return $val;
|
238 |
}
|
239 |
|
240 |
public static function sanitize_value( &$value, $sanitize ) {
|
@@ -242,18 +246,51 @@ class FrmAppHelper {
|
|
242 |
$value = call_user_func( $sanitize, $value );
|
243 |
}
|
244 |
}
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
|
|
|
|
255 |
}
|
256 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
257 |
public static function sanitize_request( $sanitize_method, &$values ) {
|
258 |
$temp_values = $values;
|
259 |
foreach ( $temp_values as $k => $val ) {
|
@@ -451,13 +488,14 @@ class FrmAppHelper {
|
|
451 |
|
452 |
public static function wp_pages_dropdown( $field_name, $page_id, $truncate = false ) {
|
453 |
$pages = self::get_pages();
|
|
|
454 |
?>
|
455 |
<select name="<?php echo esc_attr($field_name); ?>" id="<?php echo esc_attr($field_name); ?>" class="frm-pages-dropdown">
|
456 |
<option value=""> </option>
|
457 |
<?php foreach ( $pages as $page ) { ?>
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
<?php } ?>
|
462 |
</select>
|
463 |
<?php
|
@@ -500,6 +538,21 @@ class FrmAppHelper {
|
|
500 |
}
|
501 |
}
|
502 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
503 |
public static function frm_capabilities($type = 'auto') {
|
504 |
$cap = array(
|
505 |
'frm_view_forms' => __( 'View Forms and Templates', 'formidable' ),
|
@@ -550,6 +603,8 @@ class FrmAppHelper {
|
|
550 |
* @since 2.0
|
551 |
*/
|
552 |
public static function maybe_add_permissions() {
|
|
|
|
|
553 |
if ( ! current_user_can('administrator') || current_user_can('frm_view_forms') ) {
|
554 |
return;
|
555 |
}
|
@@ -626,7 +681,8 @@ class FrmAppHelper {
|
|
626 |
* @return boolean Returns true if current field option is an "Other" option
|
627 |
*/
|
628 |
public static function is_other_opt( $opt_key ) {
|
629 |
-
|
|
|
630 |
}
|
631 |
|
632 |
/**
|
@@ -639,68 +695,8 @@ class FrmAppHelper {
|
|
639 |
* @return string $other_val
|
640 |
*/
|
641 |
public static function get_other_val( $opt_key, $field, $parent = false, $pointer = false ) {
|
642 |
-
|
643 |
-
|
644 |
-
//If option is an "other" option and there is a value set for this field, check if the value belongs in the current "Other" option text field
|
645 |
-
if ( ! self::is_other_opt( $opt_key ) || ! isset( $field['value'] ) || ! $field['value'] ) {
|
646 |
-
return $other_val;
|
647 |
-
}
|
648 |
-
|
649 |
-
// Check posted vals before checking saved values
|
650 |
-
|
651 |
-
// For fields inside repeating sections - note, don't check if $pointer is true because it will often be zero
|
652 |
-
if ( $parent && isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ) {
|
653 |
-
if ( FrmFieldsHelper::is_field_with_multiple_values( $field ) ) {
|
654 |
-
$other_val = isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ][ $opt_key ] ) ? $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ][ $opt_key ] : '';
|
655 |
-
} else {
|
656 |
-
$other_val = $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ];
|
657 |
-
}
|
658 |
-
return $other_val;
|
659 |
-
|
660 |
-
} else if ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][ $field['id'] ] ) ) {
|
661 |
-
// For normal fields
|
662 |
-
|
663 |
-
if ( FrmFieldsHelper::is_field_with_multiple_values( $field ) ) {
|
664 |
-
$other_val = isset( $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] ) ? $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] : '';
|
665 |
-
} else {
|
666 |
-
$other_val = sanitize_text_field( $_POST['item_meta']['other'][ $field['id'] ] );
|
667 |
-
}
|
668 |
-
return $other_val;
|
669 |
-
}
|
670 |
-
|
671 |
-
// For checkboxes
|
672 |
-
if ( $field['type'] == 'checkbox' && is_array( $field['value'] ) ) {
|
673 |
-
// Check if there is an "other" val in saved value and make sure the "other" val is not equal to the Other checkbox option
|
674 |
-
if ( isset( $field['value'][ $opt_key ] ) && $field['options'][ $opt_key ] != $field['value'][ $opt_key ] ) {
|
675 |
-
$other_val = $field['value'][ $opt_key ];
|
676 |
-
}
|
677 |
-
} else {
|
678 |
-
/**
|
679 |
-
* For radio buttons and dropdowns
|
680 |
-
* Check if saved value equals any of the options. If not, set it as the other value.
|
681 |
-
*/
|
682 |
-
foreach ( $field['options'] as $opt_key => $opt_val ) {
|
683 |
-
$temp_val = is_array( $opt_val ) ? $opt_val['value'] : $opt_val;
|
684 |
-
// Multi-select dropdowns - key is not preserved
|
685 |
-
if ( is_array( $field['value'] ) ) {
|
686 |
-
$o_key = array_search( $temp_val, $field['value'] );
|
687 |
-
if ( isset( $field['value'][ $o_key ] ) ) {
|
688 |
-
unset( $field['value'][ $o_key ], $o_key );
|
689 |
-
}
|
690 |
-
} else if ( $temp_val == $field['value'] ) {
|
691 |
-
// For radio and regular dropdowns
|
692 |
-
return '';
|
693 |
-
} else {
|
694 |
-
$other_val = $field['value'];
|
695 |
-
}
|
696 |
-
unset($opt_key, $opt_val, $temp_val);
|
697 |
-
}
|
698 |
-
// For multi-select dropdowns only
|
699 |
-
if ( is_array( $field['value'] ) && ! empty( $field['value'] ) ) {
|
700 |
-
$other_val = reset( $field['value'] );
|
701 |
-
}
|
702 |
-
}
|
703 |
-
return $other_val;
|
704 |
}
|
705 |
|
706 |
/**
|
@@ -716,42 +712,9 @@ class FrmAppHelper {
|
|
716 |
* @return string $other_val
|
717 |
*/
|
718 |
public static function prepare_other_input( $field, &$other_opt, &$checked, $args = array() ) {
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
}
|
723 |
-
|
724 |
-
$other_opt = true;
|
725 |
-
$other_args = array();
|
726 |
-
$parent = $pointer = '';
|
727 |
-
|
728 |
-
// Check for parent ID and pointer
|
729 |
-
$temp_array = explode( '[', $args['field_name'] );
|
730 |
-
// Count should only be greater than 3 if inside of a repeating section
|
731 |
-
if ( count( $temp_array ) > 3 ) {
|
732 |
-
$parent = str_replace( ']', '', $temp_array[1] );
|
733 |
-
$pointer = str_replace( ']', '', $temp_array[2]);
|
734 |
-
}
|
735 |
-
unset( $temp_array );
|
736 |
-
|
737 |
-
//Set up name for other field
|
738 |
-
$other_args['name'] = str_replace( '[]', '', $args['field_name'] );
|
739 |
-
$other_args['name'] = preg_replace('/\[' . $field['id'] . '\]$/', '', $other_args['name']);
|
740 |
-
$other_args['name'] = $other_args['name'] . '[other]' . '[' . $field['id'] . ']';
|
741 |
-
//Converts item_meta[field_id] => item_meta[other][field_id] and
|
742 |
-
//item_meta[parent][0][field_id] => item_meta[parent][0][other][field_id]
|
743 |
-
if ( FrmFieldsHelper::is_field_with_multiple_values( $field ) ) {
|
744 |
-
$other_args['name'] .= '[' . $args['opt_key'] . ']';
|
745 |
-
}
|
746 |
-
|
747 |
-
// Get text for "other" text field
|
748 |
-
$other_args['value'] = self::get_other_val( $args['opt_key'], $field, $parent, $pointer );
|
749 |
-
|
750 |
-
if ( $other_args['value'] ) {
|
751 |
-
$checked = 'checked="checked" ';
|
752 |
-
}
|
753 |
-
|
754 |
-
return $other_args;
|
755 |
}
|
756 |
|
757 |
public static function recursive_trim(&$value) {
|
@@ -1072,29 +1035,7 @@ class FrmAppHelper {
|
|
1072 |
|
1073 |
foreach ( $form_defaults as $opt => $default ) {
|
1074 |
if ( ! isset( $values[ $opt ] ) || $values[ $opt ] == '' ) {
|
1075 |
-
|
1076 |
-
$values[ $opt ] = ( $post_values && isset( $post_values[ $opt ] ) ) ? $post_values[ $opt ] : $default;
|
1077 |
-
|
1078 |
-
foreach ( $default as $o => $d ) {
|
1079 |
-
if ( $o == 'email_to' ) {
|
1080 |
-
$d = ''; //allow blank email address
|
1081 |
-
}
|
1082 |
-
$values[ $opt ][0][ $o ] = ( $post_values && isset( $post_values[ $opt ][0][ $o ]) ) ? $post_values[ $opt ][0][ $o ] : $d;
|
1083 |
-
unset($o, $d);
|
1084 |
-
}
|
1085 |
-
} else {
|
1086 |
-
$values[ $opt ] = ( $post_values && isset( $post_values['options'][ $opt ] ) ) ? $post_values['options'][ $opt ] : $default;
|
1087 |
-
}
|
1088 |
-
} else if ( $values[ $opt ] == 'notification' ) {
|
1089 |
-
foreach ( $values[ $opt ] as $k => $n ) {
|
1090 |
-
foreach ( $default as $o => $d ) {
|
1091 |
-
if ( ! isset( $n[ $o ] ) ) {
|
1092 |
-
$values[ $opt ][ $k ][ $o ] = ( $post_values && isset( $post_values[ $opt ][ $k ][ $o ] ) ) ? $post_values[ $opt ][ $k ][ $o ] : $d;
|
1093 |
-
}
|
1094 |
-
unset($o, $d);
|
1095 |
-
}
|
1096 |
-
unset($k, $n);
|
1097 |
-
}
|
1098 |
}
|
1099 |
|
1100 |
unset($opt, $defaut);
|
@@ -1102,7 +1043,7 @@ class FrmAppHelper {
|
|
1102 |
|
1103 |
if ( ! isset($values['custom_style']) ) {
|
1104 |
$frm_settings = self::get_settings();
|
1105 |
-
|
1106 |
}
|
1107 |
|
1108 |
foreach ( array( 'before', 'after', 'submit') as $h ) {
|
@@ -1584,6 +1525,28 @@ class FrmAppHelper {
|
|
1584 |
}
|
1585 |
}
|
1586 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1587 |
/**
|
1588 |
* Since actions are JSON encoded, we don't want any filters messing with it.
|
1589 |
* Remove the filters and then add them back in case any posts or views are
|
10 |
/**
|
11 |
* @since 2.0
|
12 |
*/
|
13 |
+
public static $plug_version = '2.0.06';
|
14 |
|
15 |
/**
|
16 |
* @since 1.07.02
|
104 |
*/
|
105 |
public static function is_admin_page($page = 'formidable' ) {
|
106 |
global $pagenow;
|
107 |
+
$get_page = self::simple_get( 'page', 'sanitize_title' );
|
108 |
if ( $pagenow ) {
|
109 |
+
return $pagenow == 'admin.php' && $get_page == $page;
|
110 |
}
|
111 |
|
112 |
+
return is_admin() && $get_page == $page;
|
113 |
}
|
114 |
|
115 |
/**
|
122 |
*/
|
123 |
public static function is_preview_page() {
|
124 |
global $pagenow;
|
125 |
+
$action = FrmAppHelper::simple_get( 'action', 'sanitize_title' );
|
126 |
+
return $pagenow && $pagenow == 'admin-ajax.php' && $action == 'frm_forms_preview';
|
127 |
}
|
128 |
|
129 |
/**
|
213 |
}
|
214 |
self::sanitize_value( $value, $sanitize );
|
215 |
} else {
|
216 |
+
$value = self::simple_request( array( 'type' => 'post', 'param' => $param, 'default' => $default, 'sanitize' => $sanitize ) );
|
217 |
}
|
218 |
|
219 |
if ( isset( $params ) && is_array( $value ) && ! empty( $value ) ) {
|
230 |
return $value;
|
231 |
}
|
232 |
|
233 |
+
/**
|
234 |
+
* @todo Deprecate this and use simple_request instead
|
235 |
+
*
|
236 |
+
* @param string $param
|
237 |
+
* @param mixed $default
|
238 |
+
* @param string $sanitize
|
239 |
+
*/
|
240 |
public static function get_post_param( $param, $default = '', $sanitize = '' ) {
|
241 |
+
return self::simple_request( array( 'type' => 'post', 'param' => $param, 'default' => $default, 'sanitize' => $sanitize ) );
|
|
|
|
|
|
|
|
|
|
|
242 |
}
|
243 |
|
244 |
public static function sanitize_value( &$value, $sanitize ) {
|
246 |
$value = call_user_func( $sanitize, $value );
|
247 |
}
|
248 |
}
|
249 |
+
|
250 |
+
/**
|
251 |
+
* @since 2.0
|
252 |
+
*
|
253 |
+
* @param string $param
|
254 |
+
* @param string $sanitize
|
255 |
+
* @param string $default
|
256 |
+
*
|
257 |
+
* @todo Deprecate this and use simple_request instead
|
258 |
+
*/
|
259 |
+
public static function simple_get( $param, $sanitize = 'sanitize_text_field', $default = '' ) {
|
260 |
+
return self::simple_request( array( 'type' => 'get', 'param' => $param, 'default' => $default, 'sanitize' => $sanitize ) );
|
261 |
}
|
262 |
|
263 |
+
/**
|
264 |
+
* Get a GET/POST/REQUEST value and sanitize it
|
265 |
+
*
|
266 |
+
* @since 2.0.6
|
267 |
+
*/
|
268 |
+
public static function simple_request( $args ) {
|
269 |
+
$defaults = array(
|
270 |
+
'param' => '', 'default' => '',
|
271 |
+
'type' => 'get', 'sanitize' => 'sanitize_text_field',
|
272 |
+
);
|
273 |
+
$args = wp_parse_args( $args, $defaults );
|
274 |
+
|
275 |
+
$value = $args['default'];
|
276 |
+
if ( $args['type'] == 'get' ) {
|
277 |
+
if ( $_GET && isset( $_GET[ $args['param'] ] ) ) {
|
278 |
+
$value = $_GET[ $args['param'] ];
|
279 |
+
}
|
280 |
+
} else if ( $args['type'] == 'post' ) {
|
281 |
+
if ( isset( $_POST[ $args['param'] ] ) ) {
|
282 |
+
$value = stripslashes_deep( maybe_unserialize( $_POST[ $args['param'] ] ) );
|
283 |
+
}
|
284 |
+
} else {
|
285 |
+
if ( isset( $_REQUEST[ $args['param'] ] ) ) {
|
286 |
+
$value = $_REQUEST[ $args['param'] ];
|
287 |
+
}
|
288 |
+
}
|
289 |
+
|
290 |
+
self::sanitize_value( $value, $args['sanitize'] );
|
291 |
+
return $value;
|
292 |
+
}
|
293 |
+
|
294 |
public static function sanitize_request( $sanitize_method, &$values ) {
|
295 |
$temp_values = $values;
|
296 |
foreach ( $temp_values as $k => $val ) {
|
488 |
|
489 |
public static function wp_pages_dropdown( $field_name, $page_id, $truncate = false ) {
|
490 |
$pages = self::get_pages();
|
491 |
+
$selected = self::get_post_param( $field_name, $page_id, 'absint' );
|
492 |
?>
|
493 |
<select name="<?php echo esc_attr($field_name); ?>" id="<?php echo esc_attr($field_name); ?>" class="frm-pages-dropdown">
|
494 |
<option value=""> </option>
|
495 |
<?php foreach ( $pages as $page ) { ?>
|
496 |
+
<option value="<?php echo esc_attr($page->ID); ?>" <?php selected( $selected, $page->ID ) ?>>
|
497 |
+
<?php echo esc_html( $truncate ? self::truncate( $page->post_title, $truncate ) : $page->post_title ); ?>
|
498 |
+
</option>
|
499 |
<?php } ?>
|
500 |
</select>
|
501 |
<?php
|
538 |
}
|
539 |
}
|
540 |
|
541 |
+
/**
|
542 |
+
* Make sure admins have permission to see the menu items
|
543 |
+
* @since 2.0.6
|
544 |
+
*/
|
545 |
+
public static function force_capability( $cap = 'frm_change_settings' ) {
|
546 |
+
// Make sure admins can see the menu items
|
547 |
+
if ( current_user_can( 'administrator' ) && ! current_user_can( $cap ) ) {
|
548 |
+
$role = get_role( 'administrator' );
|
549 |
+
$frm_roles = self::frm_capabilities();
|
550 |
+
foreach ( $frm_roles as $frm_role => $frm_role_description ) {
|
551 |
+
$role->add_cap( $frm_role );
|
552 |
+
}
|
553 |
+
}
|
554 |
+
}
|
555 |
+
|
556 |
public static function frm_capabilities($type = 'auto') {
|
557 |
$cap = array(
|
558 |
'frm_view_forms' => __( 'View Forms and Templates', 'formidable' ),
|
603 |
* @since 2.0
|
604 |
*/
|
605 |
public static function maybe_add_permissions() {
|
606 |
+
self::force_capability( 'frm_view_entries' );
|
607 |
+
|
608 |
if ( ! current_user_can('administrator') || current_user_can('frm_view_forms') ) {
|
609 |
return;
|
610 |
}
|
681 |
* @return boolean Returns true if current field option is an "Other" option
|
682 |
*/
|
683 |
public static function is_other_opt( $opt_key ) {
|
684 |
+
_deprecated_function( __FUNCTION__, '2.0.6', 'FrmFieldsHelper::is_other_opt' );
|
685 |
+
return FrmFieldsHelper::is_other_opt( $opt_key );
|
686 |
}
|
687 |
|
688 |
/**
|
695 |
* @return string $other_val
|
696 |
*/
|
697 |
public static function get_other_val( $opt_key, $field, $parent = false, $pointer = false ) {
|
698 |
+
_deprecated_function( __FUNCTION__, '2.0.6', 'FrmFieldsHelper::get_other_val' );
|
699 |
+
return FrmFieldsHelper::get_other_val( compact( 'opt_key', 'field', 'parent', 'pointer' ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
700 |
}
|
701 |
|
702 |
/**
|
712 |
* @return string $other_val
|
713 |
*/
|
714 |
public static function prepare_other_input( $field, &$other_opt, &$checked, $args = array() ) {
|
715 |
+
_deprecated_function( __FUNCTION__, '2.0.6', 'FrmFieldsHelper::prepare_other_input' );
|
716 |
+
$args['field'] = $field;
|
717 |
+
return FrmFieldsHelper::prepare_other_input( $args, $other_opt, $checked );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
718 |
}
|
719 |
|
720 |
public static function recursive_trim(&$value) {
|
1035 |
|
1036 |
foreach ( $form_defaults as $opt => $default ) {
|
1037 |
if ( ! isset( $values[ $opt ] ) || $values[ $opt ] == '' ) {
|
1038 |
+
$values[ $opt ] = ( $post_values && isset( $post_values['options'][ $opt ] ) ) ? $post_values['options'][ $opt ] : $default;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1039 |
}
|
1040 |
|
1041 |
unset($opt, $defaut);
|
1043 |
|
1044 |
if ( ! isset($values['custom_style']) ) {
|
1045 |
$frm_settings = self::get_settings();
|
1046 |
+
$values['custom_style'] = ( $post_values && isset( $post_values['options']['custom_style'] ) ) ? absint( $_POST['options']['custom_style'] ) : ( $frm_settings->load_style != 'none' );
|
1047 |
}
|
1048 |
|
1049 |
foreach ( array( 'before', 'after', 'submit') as $h ) {
|
1525 |
}
|
1526 |
}
|
1527 |
|
1528 |
+
/**
|
1529 |
+
* Prepare and save settings in styles and actions
|
1530 |
+
*
|
1531 |
+
* @param array $settings
|
1532 |
+
* @param string $group
|
1533 |
+
*
|
1534 |
+
* @since 2.0.6
|
1535 |
+
*/
|
1536 |
+
public static function save_settings( $settings, $group ) {
|
1537 |
+
$settings = (array) $settings;
|
1538 |
+
$settings['post_content'] = FrmAppHelper::prepare_and_encode( $settings['post_content'] );
|
1539 |
+
|
1540 |
+
if ( empty( $settings['ID'] ) ) {
|
1541 |
+
unset( $settings['ID']);
|
1542 |
+
}
|
1543 |
+
|
1544 |
+
// delete all caches for this group
|
1545 |
+
self::cache_delete_group( $group );
|
1546 |
+
|
1547 |
+
return self::save_json_post( $settings );
|
1548 |
+
}
|
1549 |
+
|
1550 |
/**
|
1551 |
* Since actions are JSON encoded, we don't want any filters messing with it.
|
1552 |
* Remove the filters and then add them back in case any posts or views are
|
classes/helpers/FrmEntriesHelper.php
CHANGED
@@ -224,11 +224,6 @@ class FrmEntriesHelper {
|
|
224 |
}
|
225 |
}
|
226 |
|
227 |
-
// Don't include blank values
|
228 |
-
if ( ! $atts['include_blank'] && isset( $atts['entry']->metas[ $f->id ] ) && FrmAppHelper::is_empty_value( $atts['entry']->metas[ $f->id ] ) ) {
|
229 |
-
return;
|
230 |
-
}
|
231 |
-
|
232 |
$val = '';
|
233 |
if ( $atts['entry'] ) {
|
234 |
$prev_val = maybe_unserialize( $atts['entry']->metas[ $f->id ] );
|
@@ -242,6 +237,11 @@ class FrmEntriesHelper {
|
|
242 |
}
|
243 |
}
|
244 |
|
|
|
|
|
|
|
|
|
|
|
245 |
self::textarea_display_value( $val, $f->type, $atts['plain_text'] );
|
246 |
|
247 |
if ( is_array($val) && $atts['format'] == 'text' ) {
|
@@ -429,7 +429,6 @@ class FrmEntriesHelper {
|
|
429 |
|
430 |
if ( $child_values ) {
|
431 |
$child_entries = FrmEntry::getAll( array( 'it.id' => (array) $child_values ) );
|
432 |
-
//$atts['post_id']
|
433 |
}
|
434 |
}
|
435 |
|
@@ -455,6 +454,7 @@ class FrmEntriesHelper {
|
|
455 |
}
|
456 |
|
457 |
$val = implode(', ', (array) $field_value );
|
|
|
458 |
|
459 |
return $val;
|
460 |
}
|
@@ -523,6 +523,10 @@ class FrmEntriesHelper {
|
|
523 |
$value = FrmAppHelper::truncate($value, 50);
|
524 |
}
|
525 |
|
|
|
|
|
|
|
|
|
526 |
return apply_filters('frm_display_value', $value, $field, $atts);
|
527 |
}
|
528 |
|
@@ -700,11 +704,11 @@ class FrmEntriesHelper {
|
|
700 |
}
|
701 |
|
702 |
$agent_options = array(
|
703 |
-
'Firefox' => 'Mozilla Firefox',
|
704 |
'Chrome' => 'Google Chrome',
|
705 |
'Safari' => 'Apple Safari',
|
706 |
'Opera' => 'Opera',
|
707 |
'Netscape' => 'Netscape',
|
|
|
708 |
);
|
709 |
|
710 |
// Next get the name of the useragent yes seperately and for good reason
|
224 |
}
|
225 |
}
|
226 |
|
|
|
|
|
|
|
|
|
|
|
227 |
$val = '';
|
228 |
if ( $atts['entry'] ) {
|
229 |
$prev_val = maybe_unserialize( $atts['entry']->metas[ $f->id ] );
|
237 |
}
|
238 |
}
|
239 |
|
240 |
+
// Don't include blank values
|
241 |
+
if ( ! $atts['include_blank'] && FrmAppHelper::is_empty_value( $val ) ) {
|
242 |
+
return;
|
243 |
+
}
|
244 |
+
|
245 |
self::textarea_display_value( $val, $f->type, $atts['plain_text'] );
|
246 |
|
247 |
if ( is_array($val) && $atts['format'] == 'text' ) {
|
429 |
|
430 |
if ( $child_values ) {
|
431 |
$child_entries = FrmEntry::getAll( array( 'it.id' => (array) $child_values ) );
|
|
|
432 |
}
|
433 |
}
|
434 |
|
454 |
}
|
455 |
|
456 |
$val = implode(', ', (array) $field_value );
|
457 |
+
$val = wp_kses_post( $val );
|
458 |
|
459 |
return $val;
|
460 |
}
|
523 |
$value = FrmAppHelper::truncate($value, 50);
|
524 |
}
|
525 |
|
526 |
+
if ( ! $atts['keepjs'] && ! is_array( $value ) ) {
|
527 |
+
$value = wp_kses_post( $value );
|
528 |
+
}
|
529 |
+
|
530 |
return apply_filters('frm_display_value', $value, $field, $atts);
|
531 |
}
|
532 |
|
704 |
}
|
705 |
|
706 |
$agent_options = array(
|
|
|
707 |
'Chrome' => 'Google Chrome',
|
708 |
'Safari' => 'Apple Safari',
|
709 |
'Opera' => 'Opera',
|
710 |
'Netscape' => 'Netscape',
|
711 |
+
'Firefox' => 'Mozilla Firefox',
|
712 |
);
|
713 |
|
714 |
// Next get the name of the useragent yes seperately and for good reason
|
classes/helpers/FrmFieldsHelper.php
CHANGED
@@ -90,10 +90,17 @@ class FrmFieldsHelper {
|
|
90 |
return $field['type'] == 'checkbox' || ( $field['type'] == 'data' && isset($field['data_type']) && $field['data_type'] == 'checkbox' ) || self::is_multiple_select( $field );
|
91 |
} else {
|
92 |
// For field object
|
93 |
-
|
94 |
}
|
95 |
}
|
96 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
/**
|
98 |
* If $field is numeric, get the field object
|
99 |
*/
|
@@ -341,7 +348,7 @@ DEFAULT_HTML;
|
|
341 |
$html = str_replace('[key]', $field['field_key'], $html);
|
342 |
|
343 |
//replace [description] and [required_label] and [error]
|
344 |
-
|
345 |
if ( ! is_array( $errors ) ) {
|
346 |
$errors = array();
|
347 |
}
|
@@ -361,7 +368,7 @@ DEFAULT_HTML;
|
|
361 |
}
|
362 |
|
363 |
//replace [required_class]
|
364 |
-
$required_class = ($field
|
365 |
$html = str_replace('[required_class]', $required_class, $html);
|
366 |
|
367 |
//replace [label_position]
|
@@ -382,7 +389,7 @@ DEFAULT_HTML;
|
|
382 |
$html = str_replace('[error_class]', $error_class, $html);
|
383 |
|
384 |
//replace [entry_key]
|
385 |
-
$entry_key = (
|
386 |
$html = str_replace('[entry_key]', $entry_key, $html);
|
387 |
|
388 |
//replace [input]
|
@@ -573,9 +580,9 @@ DEFAULT_HTML;
|
|
573 |
$opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field);
|
574 |
|
575 |
// If this is an "Other" option, get the HTML for it
|
576 |
-
|
577 |
// Get string for Other text field, if needed
|
578 |
-
|
579 |
require(FrmAppHelper::plugin_path() .'/pro/classes/views/frmpro-fields/other-option.php');
|
580 |
} else {
|
581 |
require(FrmAppHelper::plugin_path() .'/classes/views/frm-fields/single-option.php');
|
@@ -1006,16 +1013,221 @@ DEFAULT_HTML;
|
|
1006 |
}
|
1007 |
}
|
1008 |
|
1009 |
-
|
1010 |
-
|
1011 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1012 |
}
|
1013 |
|
1014 |
-
|
1015 |
-
|
1016 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1017 |
}
|
1018 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1019 |
public static function switch_field_ids($val) {
|
1020 |
global $frm_duplicate_ids;
|
1021 |
$replace = array();
|
90 |
return $field['type'] == 'checkbox' || ( $field['type'] == 'data' && isset($field['data_type']) && $field['data_type'] == 'checkbox' ) || self::is_multiple_select( $field );
|
91 |
} else {
|
92 |
// For field object
|
93 |
+
return $field->type == 'checkbox' || ( $field->type == 'data' && isset( $field->field_options['data_type'] ) && $field->field_options['data_type'] == 'checkbox' ) || self::is_multiple_select($field);
|
94 |
}
|
95 |
}
|
96 |
|
97 |
+
/**
|
98 |
+
* @since 2.0.6
|
99 |
+
*/
|
100 |
+
public static function is_required_field( $field ) {
|
101 |
+
return $field['required'] != '0';
|
102 |
+
}
|
103 |
+
|
104 |
/**
|
105 |
* If $field is numeric, get the field object
|
106 |
*/
|
348 |
$html = str_replace('[key]', $field['field_key'], $html);
|
349 |
|
350 |
//replace [description] and [required_label] and [error]
|
351 |
+
$required = self::is_required_field( $field ) ? $field['required_indicator'] : '';
|
352 |
if ( ! is_array( $errors ) ) {
|
353 |
$errors = array();
|
354 |
}
|
368 |
}
|
369 |
|
370 |
//replace [required_class]
|
371 |
+
$required_class = self::is_required_field( $field ) ? ' frm_required_field' : '';
|
372 |
$html = str_replace('[required_class]', $required_class, $html);
|
373 |
|
374 |
//replace [label_position]
|
389 |
$html = str_replace('[error_class]', $error_class, $html);
|
390 |
|
391 |
//replace [entry_key]
|
392 |
+
$entry_key = FrmAppHelper::simple_get( 'entry', 'sanitize_title' );
|
393 |
$html = str_replace('[entry_key]', $entry_key, $html);
|
394 |
|
395 |
//replace [input]
|
580 |
$opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field);
|
581 |
|
582 |
// If this is an "Other" option, get the HTML for it
|
583 |
+
if ( self::is_other_opt( $opt_key ) ) {
|
584 |
// Get string for Other text field, if needed
|
585 |
+
$other_val = self::get_other_val( compact( 'opt_key', 'field' ) );
|
586 |
require(FrmAppHelper::plugin_path() .'/pro/classes/views/frmpro-fields/other-option.php');
|
587 |
} else {
|
588 |
require(FrmAppHelper::plugin_path() .'/classes/views/frm-fields/single-option.php');
|
1013 |
}
|
1014 |
}
|
1015 |
|
1016 |
+
/**
|
1017 |
+
* Check if current field option is an "other" option
|
1018 |
+
*
|
1019 |
+
* @since 2.0.6
|
1020 |
+
*
|
1021 |
+
* @param string $opt_key
|
1022 |
+
* @return boolean Returns true if current field option is an "Other" option
|
1023 |
+
*/
|
1024 |
+
public static function is_other_opt( $opt_key ) {
|
1025 |
+
return $opt_key && strpos( $opt_key, 'other' ) !== false;
|
1026 |
}
|
1027 |
|
1028 |
+
/**
|
1029 |
+
* Get value that belongs in "Other" text box
|
1030 |
+
*
|
1031 |
+
* @since 2.0.6
|
1032 |
+
*
|
1033 |
+
* @param array $args
|
1034 |
+
*/
|
1035 |
+
public static function get_other_val( $args ) {
|
1036 |
+
$defaults = array(
|
1037 |
+
'opt_key' => 0, 'field' => array(),
|
1038 |
+
'parent' => false, 'pointer' => false,
|
1039 |
+
);
|
1040 |
+
$args = wp_parse_args( $args, $defaults );
|
1041 |
+
|
1042 |
+
$opt_key = $args['opt_key'];
|
1043 |
+
$field = $args['field'];
|
1044 |
+
$parent = $args['parent'];
|
1045 |
+
$pointer = $args['pointer'];
|
1046 |
+
$other_val = '';
|
1047 |
+
|
1048 |
+
// If option is an "other" option and there is a value set for this field,
|
1049 |
+
// check if the value belongs in the current "Other" option text field
|
1050 |
+
if ( ! FrmFieldsHelper::is_other_opt( $opt_key ) || ! isset( $field['value'] ) || ! $field['value'] ) {
|
1051 |
+
return $other_val;
|
1052 |
+
}
|
1053 |
+
|
1054 |
+
// Check posted vals before checking saved values
|
1055 |
+
|
1056 |
+
// For fields inside repeating sections - note, don't check if $pointer is true because it will often be zero
|
1057 |
+
if ( $parent && isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ) {
|
1058 |
+
if ( FrmFieldsHelper::is_field_with_multiple_values( $field ) ) {
|
1059 |
+
$other_val = isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ][ $opt_key ] ) ? sanitize_text_field( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ][ $opt_key ] ) : '';
|
1060 |
+
} else {
|
1061 |
+
$other_val = sanitize_text_field( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] );
|
1062 |
+
}
|
1063 |
+
return $other_val;
|
1064 |
+
|
1065 |
+
} else if ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][ $field['id'] ] ) ) {
|
1066 |
+
// For normal fields
|
1067 |
+
|
1068 |
+
if ( FrmFieldsHelper::is_field_with_multiple_values( $field ) ) {
|
1069 |
+
$other_val = isset( $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] ) ? sanitize_text_field( $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] ) : '';
|
1070 |
+
} else {
|
1071 |
+
$other_val = sanitize_text_field( $_POST['item_meta']['other'][ $field['id'] ] );
|
1072 |
+
}
|
1073 |
+
return $other_val;
|
1074 |
+
}
|
1075 |
+
|
1076 |
+
// For checkboxes
|
1077 |
+
if ( $field['type'] == 'checkbox' && is_array( $field['value'] ) ) {
|
1078 |
+
// Check if there is an "other" val in saved value and make sure the
|
1079 |
+
// "other" val is not equal to the Other checkbox option
|
1080 |
+
if ( isset( $field['value'][ $opt_key ] ) && $field['options'][ $opt_key ] != $field['value'][ $opt_key ] ) {
|
1081 |
+
$other_val = $field['value'][ $opt_key ];
|
1082 |
+
}
|
1083 |
+
} else {
|
1084 |
+
/**
|
1085 |
+
* For radio buttons and dropdowns
|
1086 |
+
* Check if saved value equals any of the options. If not, set it as the other value.
|
1087 |
+
*/
|
1088 |
+
foreach ( $field['options'] as $opt_key => $opt_val ) {
|
1089 |
+
$temp_val = is_array( $opt_val ) ? $opt_val['value'] : $opt_val;
|
1090 |
+
// Multi-select dropdowns - key is not preserved
|
1091 |
+
if ( is_array( $field['value'] ) ) {
|
1092 |
+
$o_key = array_search( $temp_val, $field['value'] );
|
1093 |
+
if ( isset( $field['value'][ $o_key ] ) ) {
|
1094 |
+
unset( $field['value'][ $o_key ], $o_key );
|
1095 |
+
}
|
1096 |
+
} else if ( $temp_val == $field['value'] ) {
|
1097 |
+
// For radio and regular dropdowns
|
1098 |
+
return '';
|
1099 |
+
} else {
|
1100 |
+
$other_val = $field['value'];
|
1101 |
+
}
|
1102 |
+
unset( $opt_key, $opt_val, $temp_val );
|
1103 |
+
}
|
1104 |
+
// For multi-select dropdowns only
|
1105 |
+
if ( is_array( $field['value'] ) && ! empty( $field['value'] ) ) {
|
1106 |
+
$other_val = reset( $field['value'] );
|
1107 |
+
}
|
1108 |
+
}
|
1109 |
+
|
1110 |
+
return $other_val;
|
1111 |
+
}
|
1112 |
+
|
1113 |
+
/**
|
1114 |
+
* Check if there is a saved value for the "Other" text field. If so, set it as the $other_val.
|
1115 |
+
* Intended for front-end use
|
1116 |
+
*
|
1117 |
+
* @since 2.0.6
|
1118 |
+
*
|
1119 |
+
* @param array $args should include field, opt_key and field name
|
1120 |
+
* @param boolean $other_opt
|
1121 |
+
* @param string $checked
|
1122 |
+
* @return string $other_val
|
1123 |
+
*/
|
1124 |
+
public static function prepare_other_input( $args, &$other_opt, &$checked ) {
|
1125 |
+
//Check if this is an "Other" option
|
1126 |
+
if ( ! self::is_other_opt( $args['opt_key'] ) ) {
|
1127 |
+
return;
|
1128 |
+
}
|
1129 |
+
|
1130 |
+
$other_opt = true;
|
1131 |
+
$other_args = array();
|
1132 |
+
|
1133 |
+
self::set_other_name( $args, $other_args );
|
1134 |
+
self::set_other_value( $args, $other_args );
|
1135 |
+
|
1136 |
+
if ( $other_args['value'] ) {
|
1137 |
+
$checked = 'checked="checked" ';
|
1138 |
+
}
|
1139 |
+
|
1140 |
+
return $other_args;
|
1141 |
}
|
1142 |
|
1143 |
+
/**
|
1144 |
+
* @param array $args
|
1145 |
+
* @param array $other_args
|
1146 |
+
* @since 2.0.6
|
1147 |
+
*/
|
1148 |
+
private static function set_other_name( $args, &$other_args ) {
|
1149 |
+
//Set up name for other field
|
1150 |
+
$other_args['name'] = str_replace( '[]', '', $args['field_name'] );
|
1151 |
+
$other_args['name'] = preg_replace('/\[' . $args['field']['id'] . '\]$/', '', $other_args['name']);
|
1152 |
+
$other_args['name'] = $other_args['name'] . '[other]' . '[' . $args['field']['id'] . ']';
|
1153 |
+
|
1154 |
+
//Converts item_meta[field_id] => item_meta[other][field_id] and
|
1155 |
+
//item_meta[parent][0][field_id] => item_meta[parent][0][other][field_id]
|
1156 |
+
if ( self::is_field_with_multiple_values( $args['field'] ) ) {
|
1157 |
+
$other_args['name'] .= '[' . $args['opt_key'] . ']';
|
1158 |
+
}
|
1159 |
+
}
|
1160 |
+
|
1161 |
+
/**
|
1162 |
+
* Find the parent and pointer, and get text for "other" text field
|
1163 |
+
* @param array $args
|
1164 |
+
* @param array $other_args
|
1165 |
+
*
|
1166 |
+
* @since 2.0.6
|
1167 |
+
*/
|
1168 |
+
private static function set_other_value( $args, &$other_args ) {
|
1169 |
+
$parent = $pointer = '';
|
1170 |
+
|
1171 |
+
// Check for parent ID and pointer
|
1172 |
+
$temp_array = explode( '[', $args['field_name'] );
|
1173 |
+
|
1174 |
+
// Count should only be greater than 3 if inside of a repeating section
|
1175 |
+
if ( count( $temp_array ) > 3 ) {
|
1176 |
+
$parent = str_replace( ']', '', $temp_array[1] );
|
1177 |
+
$pointer = str_replace( ']', '', $temp_array[2]);
|
1178 |
+
}
|
1179 |
+
|
1180 |
+
// Get text for "other" text field
|
1181 |
+
$other_args['value'] = self::get_other_val( array( 'opt_key' => $args['opt_key'], 'field' => $args['field'], 'parent' => $parent, 'pointer' => $pointer ) );
|
1182 |
+
}
|
1183 |
+
|
1184 |
+
/**
|
1185 |
+
* If this field includes an other option, show it
|
1186 |
+
* @param $args array
|
1187 |
+
* @since 2.0.6
|
1188 |
+
*/
|
1189 |
+
public static function include_other_input( $args ) {
|
1190 |
+
if ( ! $args['other_opt'] ) {
|
1191 |
+
return;
|
1192 |
+
}
|
1193 |
+
|
1194 |
+
$classes = array( 'frm_other_input' );
|
1195 |
+
if ( ! $args['checked'] || trim( $args['checked'] ) == '' ) {
|
1196 |
+
// hide the field if the other option is not selected
|
1197 |
+
$classes[] = 'frm_pos_none';
|
1198 |
+
}
|
1199 |
+
if ( $args['field']['type'] == 'select' && $args['field']['multiple'] ) {
|
1200 |
+
$classes[] = 'frm_other_full';
|
1201 |
+
}
|
1202 |
+
|
1203 |
+
?><input type="text" class="<?php echo sanitize_text_field( implode( ' ', $classes ) ) ?>" <?php
|
1204 |
+
echo ( $args['read_only'] ? ' readonly="readonly" disabled="disabled"' : '' );
|
1205 |
+
?> name="<?php echo esc_attr( $args['name'] ) ?>" value="<?php echo esc_attr( $args['value'] ); ?>"><?php
|
1206 |
+
}
|
1207 |
+
|
1208 |
+
public static function show_onfocus_js( $is_selected ) {
|
1209 |
+
$atts = array(
|
1210 |
+
'icon' => 'frm_reload_icon',
|
1211 |
+
'message' => $is_selected ? __( 'Clear default value when typing', 'formidable' ) : __( 'Do not clear default value when typing', 'formidable' ),
|
1212 |
+
'is_selected' => $is_selected,
|
1213 |
+
);
|
1214 |
+
self::show_icon_link_js( $atts );
|
1215 |
+
}
|
1216 |
+
|
1217 |
+
public static function show_default_blank_js( $is_selected ) {
|
1218 |
+
$atts = array(
|
1219 |
+
'icon' => 'frm_error_icon',
|
1220 |
+
'message' => $is_selected ? __( 'Default value will NOT pass form validation', 'formidable' ) : __( 'Default value will pass form validation', 'formidable' ),
|
1221 |
+
'is_selected' => $is_selected,
|
1222 |
+
);
|
1223 |
+
self::show_icon_link_js( $atts );
|
1224 |
+
}
|
1225 |
+
|
1226 |
+
public static function show_icon_link_js( $atts ) {
|
1227 |
+
$atts['icon'] .= $atts['is_selected'] ? ' ' : ' frm_inactive_icon ';
|
1228 |
+
?><a href="javascript:void(0)" class="frm_bstooltip <?php echo esc_attr( $atts['icon'] ); ?>frm_default_val_icons frm_action_icon frm_icon_font" title="<?php echo esc_attr( $atts['message'] ); ?>"></a><?php
|
1229 |
+
}
|
1230 |
+
|
1231 |
public static function switch_field_ids($val) {
|
1232 |
global $frm_duplicate_ids;
|
1233 |
$replace = array();
|
classes/helpers/FrmFormActionsHelper.php
CHANGED
@@ -25,13 +25,19 @@ class FrmFormActionsHelper {
|
|
25 |
|
26 |
$settings = array();
|
27 |
foreach ( $actions as $action ) {
|
28 |
-
|
|
|
|
|
|
|
29 |
continue;
|
30 |
}
|
31 |
|
32 |
$action = $action_controls[ $action->post_excerpt ]->prepare_action( $action );
|
|
|
33 |
|
34 |
-
|
|
|
|
|
35 |
}
|
36 |
|
37 |
if ( 1 === $limit ) {
|
25 |
|
26 |
$settings = array();
|
27 |
foreach ( $actions as $action ) {
|
28 |
+
// some plugins/themes are formatting the post_excerpt
|
29 |
+
$action->post_excerpt = sanitize_title( $action->post_excerpt );
|
30 |
+
|
31 |
+
if ( ! isset( $action_controls[ $action->post_excerpt ] ) ) {
|
32 |
continue;
|
33 |
}
|
34 |
|
35 |
$action = $action_controls[ $action->post_excerpt ]->prepare_action( $action );
|
36 |
+
$settings[ $action->ID ] = $action;
|
37 |
|
38 |
+
if ( count( $settings ) >= $limit ) {
|
39 |
+
break;
|
40 |
+
}
|
41 |
}
|
42 |
|
43 |
if ( 1 === $limit ) {
|
classes/helpers/FrmFormsHelper.php
CHANGED
@@ -42,26 +42,37 @@ class FrmFormsHelper {
|
|
42 |
|
43 |
$where = apply_filters('frm_forms_dropdown', $query, $field_name);
|
44 |
$forms = FrmForm::get_published_forms( $where );
|
|
|
|
|
|
|
|
|
45 |
?>
|
46 |
-
|
47 |
-
if ( $args['onchange'] ) {
|
48 |
-
echo ' onchange="' . esc_attr( $args['onchange'] ) . '"';
|
49 |
-
}
|
50 |
-
if ( ! empty( $args['class'] ) ) {
|
51 |
-
echo ' class="' . esc_attr( $args['class'] ) . '"';
|
52 |
-
} ?>>
|
53 |
<?php if ( $args['blank'] ) { ?>
|
54 |
<option value=""><?php echo ( $args['blank'] == 1 ) ? ' ' : '- ' . esc_attr( $args['blank'] ) . ' -'; ?></option>
|
55 |
<?php } ?>
|
56 |
<?php foreach ( $forms as $form ) { ?>
|
57 |
<option value="<?php echo esc_attr( $form->id ); ?>" <?php selected( $field_value, $form->id ); ?>><?php
|
58 |
-
echo '' == $form->name ?
|
59 |
?></option>
|
60 |
<?php } ?>
|
61 |
</select>
|
62 |
<?php
|
63 |
}
|
64 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
public static function form_switcher() {
|
66 |
$where = apply_filters( 'frm_forms_dropdown', array(), '' );
|
67 |
$forms = FrmForm::get_published_forms( $where );
|
@@ -73,10 +84,11 @@ class FrmFormsHelper {
|
|
73 |
unset( $args['id'] );
|
74 |
}
|
75 |
|
76 |
-
|
|
|
77 |
$args['frm_action'] = 'list';
|
78 |
$args['form'] = 0;
|
79 |
-
} else if ( FrmAppHelper::is_admin_page('formidable' ) &&
|
80 |
$args['frm_action'] = 'edit';
|
81 |
} else if ( isset( $_GET['post'] ) ) {
|
82 |
$args['form'] = 0;
|
@@ -96,7 +108,7 @@ class FrmFormsHelper {
|
|
96 |
$args['form'] = $form->id;
|
97 |
}
|
98 |
?>
|
99 |
-
<li><a href="<?php echo esc_url( isset( $base ) ? add_query_arg( $args, $base ) : add_query_arg( $args ) ); ?>" tabindex="-1"><?php echo empty( $form->name ) ? __( '(no title)') : FrmAppHelper::truncate( $form->name, 33 ); ?></a></li>
|
100 |
<?php
|
101 |
unset( $form );
|
102 |
} ?>
|
@@ -215,6 +227,18 @@ class FrmFormsHelper {
|
|
215 |
);
|
216 |
}
|
217 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
218 |
/**
|
219 |
* @param string $loc
|
220 |
*/
|
@@ -282,6 +306,7 @@ BEFORE_HTML;
|
|
282 |
$end_section_values = apply_filters( 'frm_before_field_created', FrmFieldsHelper::setup_new_vars( 'end_divider', $form->id ) );
|
283 |
$open = $prev_order = false;
|
284 |
$add_order = 0;
|
|
|
285 |
foreach ( $fields as $field ) {
|
286 |
if ( $prev_order === $field->field_order ) {
|
287 |
$add_order++;
|
@@ -315,9 +340,12 @@ BEFORE_HTML;
|
|
315 |
$open = false;
|
316 |
}
|
317 |
$prev_order = $field->field_order;
|
|
|
|
|
|
|
318 |
}
|
319 |
|
320 |
-
self::maybe_create_end_section($open, $reset_fields, $add_order, $end_section_values, $
|
321 |
}
|
322 |
|
323 |
/**
|
@@ -350,7 +378,7 @@ BEFORE_HTML;
|
|
350 |
} else if ( $code == 'form_description' ) {
|
351 |
$replace_with = FrmAppHelper::use_wpautop($form->description);
|
352 |
} else if ( $code == 'entry_key' && isset($_GET) && isset($_GET['entry']) ) {
|
353 |
-
$replace_with =
|
354 |
} else {
|
355 |
$replace_with = '';
|
356 |
}
|
@@ -425,7 +453,7 @@ BEFORE_HTML;
|
|
425 |
/**
|
426 |
* @param string|boolean $form
|
427 |
*
|
428 |
-
* @return
|
429 |
*/
|
430 |
public static function get_form_style( $form ) {
|
431 |
$style = 1;
|
@@ -469,6 +497,56 @@ BEFORE_HTML;
|
|
469 |
}
|
470 |
}
|
471 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
472 |
public static function get_scroll_js($form_id) {
|
473 |
?><script type="text/javascript">jQuery(document).ready(function(){frmFrontForm.scrollMsg(<?php echo (int) $form_id ?>);})</script><?php
|
474 |
}
|
42 |
|
43 |
$where = apply_filters('frm_forms_dropdown', $query, $field_name);
|
44 |
$forms = FrmForm::get_published_forms( $where );
|
45 |
+
$add_html = array();
|
46 |
+
self::add_html_attr( $args['onchange'], 'onchange', $add_html );
|
47 |
+
self::add_html_attr( $args['class'], 'class', $add_html );
|
48 |
+
|
49 |
?>
|
50 |
+
<select name="<?php echo esc_attr( $field_name ); ?>" id="<?php echo esc_attr( $args['field_id'] ) ?>" <?php echo implode( ' ', $add_html ); ?>>
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
<?php if ( $args['blank'] ) { ?>
|
52 |
<option value=""><?php echo ( $args['blank'] == 1 ) ? ' ' : '- ' . esc_attr( $args['blank'] ) . ' -'; ?></option>
|
53 |
<?php } ?>
|
54 |
<?php foreach ( $forms as $form ) { ?>
|
55 |
<option value="<?php echo esc_attr( $form->id ); ?>" <?php selected( $field_value, $form->id ); ?>><?php
|
56 |
+
echo ( '' == $form->name ) ? esc_html__( '(no title)', 'formidable' ) : esc_html( FrmAppHelper::truncate( $form->name, 33 ) );
|
57 |
?></option>
|
58 |
<?php } ?>
|
59 |
</select>
|
60 |
<?php
|
61 |
}
|
62 |
|
63 |
+
/**
|
64 |
+
* @param string $class
|
65 |
+
* @param string $param
|
66 |
+
* @param array $add_html
|
67 |
+
*
|
68 |
+
* @since 2.0.6
|
69 |
+
*/
|
70 |
+
public static function add_html_attr( $class, $param, &$add_html ) {
|
71 |
+
if ( ! empty( $class ) ) {
|
72 |
+
$add_html[ $param ] = sanitize_title( $param ) . '="' . esc_attr( trim( sanitize_text_field( $class ) ) ) . '"';
|
73 |
+
}
|
74 |
+
}
|
75 |
+
|
76 |
public static function form_switcher() {
|
77 |
$where = apply_filters( 'frm_forms_dropdown', array(), '' );
|
78 |
$forms = FrmForm::get_published_forms( $where );
|
84 |
unset( $args['id'] );
|
85 |
}
|
86 |
|
87 |
+
$frm_action = FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' );
|
88 |
+
if ( FrmAppHelper::is_admin_page( 'formidable-entries' ) && in_array( $frm_action, array( 'edit', 'show', 'destroy_all' ) ) ) {
|
89 |
$args['frm_action'] = 'list';
|
90 |
$args['form'] = 0;
|
91 |
+
} else if ( FrmAppHelper::is_admin_page('formidable' ) && in_array( $frm_action, array( 'new', 'duplicate' ) ) ) {
|
92 |
$args['frm_action'] = 'edit';
|
93 |
} else if ( isset( $_GET['post'] ) ) {
|
94 |
$args['form'] = 0;
|
108 |
$args['form'] = $form->id;
|
109 |
}
|
110 |
?>
|
111 |
+
<li><a href="<?php echo esc_url( isset( $base ) ? add_query_arg( $args, $base ) : add_query_arg( $args ) ); ?>" tabindex="-1"><?php echo esc_html( empty( $form->name ) ? __( '(no title)') : FrmAppHelper::truncate( $form->name, 33 ) ); ?></a></li>
|
112 |
<?php
|
113 |
unset( $form );
|
114 |
} ?>
|
227 |
);
|
228 |
}
|
229 |
|
230 |
+
/**
|
231 |
+
* @param array $options
|
232 |
+
* @since 2.0.6
|
233 |
+
*/
|
234 |
+
public static function fill_form_options( &$options ) {
|
235 |
+
$defaults = self::get_default_opts();
|
236 |
+
foreach ( $defaults as $var => $default ) {
|
237 |
+
$options[ $var ] = isset( $values['options'][ $var ] ) ? $values['options'][ $var ] : $default;
|
238 |
+
unset( $var, $default );
|
239 |
+
}
|
240 |
+
}
|
241 |
+
|
242 |
/**
|
243 |
* @param string $loc
|
244 |
*/
|
306 |
$end_section_values = apply_filters( 'frm_before_field_created', FrmFieldsHelper::setup_new_vars( 'end_divider', $form->id ) );
|
307 |
$open = $prev_order = false;
|
308 |
$add_order = 0;
|
309 |
+
$last_field = false;
|
310 |
foreach ( $fields as $field ) {
|
311 |
if ( $prev_order === $field->field_order ) {
|
312 |
$add_order++;
|
340 |
$open = false;
|
341 |
}
|
342 |
$prev_order = $field->field_order;
|
343 |
+
|
344 |
+
$last_field = $field;
|
345 |
+
unset( $field );
|
346 |
}
|
347 |
|
348 |
+
self::maybe_create_end_section( $open, $reset_fields, $add_order, $end_section_values, $last_field );
|
349 |
}
|
350 |
|
351 |
/**
|
378 |
} else if ( $code == 'form_description' ) {
|
379 |
$replace_with = FrmAppHelper::use_wpautop($form->description);
|
380 |
} else if ( $code == 'entry_key' && isset($_GET) && isset($_GET['entry']) ) {
|
381 |
+
$replace_with = FrmAppHelper::simple_get( 'entry' );
|
382 |
} else {
|
383 |
$replace_with = '';
|
384 |
}
|
453 |
/**
|
454 |
* @param string|boolean $form
|
455 |
*
|
456 |
+
* @return string
|
457 |
*/
|
458 |
public static function get_form_style( $form ) {
|
459 |
$style = 1;
|
497 |
}
|
498 |
}
|
499 |
|
500 |
+
/**
|
501 |
+
* Display the validation error messages when an entry is submitted
|
502 |
+
*
|
503 |
+
* @param array $args - includes img, errors
|
504 |
+
* @since 2.0.6
|
505 |
+
*/
|
506 |
+
public static function show_errors( $args ) {
|
507 |
+
$frm_settings = FrmAppHelper::get_settings();
|
508 |
+
if ( empty( $frm_settings->invalid_msg ) ) {
|
509 |
+
$show_img = false;
|
510 |
+
} else {
|
511 |
+
echo wp_kses_post( $frm_settings->invalid_msg );
|
512 |
+
$show_img = true;
|
513 |
+
}
|
514 |
+
|
515 |
+
self::show_error( array( 'img' => $args['img'], 'errors' => $args['errors'], 'show_img' => $show_img ) );
|
516 |
+
}
|
517 |
+
|
518 |
+
/**
|
519 |
+
* Display the error message in the front-end along with the image if set
|
520 |
+
* The image was removed from the styling settings, but it may still be set with a hook
|
521 |
+
* If the message in the global settings is empty, show every validation message in the error box
|
522 |
+
*
|
523 |
+
* @param array $args - includes img, errors, and show_img
|
524 |
+
* @since 2.0.6
|
525 |
+
*/
|
526 |
+
public static function show_error( $args ) {
|
527 |
+
$line_break_first = $args['show_img'];
|
528 |
+
foreach ( $args['errors'] as $error_key => $error ) {
|
529 |
+
if ( $line_break_first && ! is_numeric( $error_key ) && ( $error_key == 'cptch_number' || strpos( $error_key, 'field' ) === 0 ) ) {
|
530 |
+
continue;
|
531 |
+
}
|
532 |
+
|
533 |
+
if ( $line_break_first ) {
|
534 |
+
echo '<br/>';
|
535 |
+
}
|
536 |
+
|
537 |
+
if ( $args['show_img'] && ! empty( $args['img'] ) ) {
|
538 |
+
?><img src="<?php echo esc_attr( $args['img'] ) ?>" alt="" /><?php
|
539 |
+
} else {
|
540 |
+
$args['show_img'] = true;
|
541 |
+
}
|
542 |
+
|
543 |
+
echo wp_kses_post( $error );
|
544 |
+
|
545 |
+
if ( ! $line_break_first ) {
|
546 |
+
echo '<br/>';
|
547 |
+
}
|
548 |
+
}
|
549 |
+
}
|
550 |
public static function get_scroll_js($form_id) {
|
551 |
?><script type="text/javascript">jQuery(document).ready(function(){frmFrontForm.scrollMsg(<?php echo (int) $form_id ?>);})</script><?php
|
552 |
}
|
classes/helpers/FrmFormsListHelper.php
CHANGED
@@ -146,7 +146,7 @@ class FrmFormsListHelper extends FrmListHelper {
|
|
146 |
} else {
|
147 |
foreach ( $forms as $form ) {
|
148 |
$args['id'] = $form->id; ?>
|
149 |
-
<li><a href="<?php echo esc_url( add_query_arg( $args, $base ) ); ?>" tabindex="-1"><?php echo empty( $form->name ) ? __( '(no title)' ) : FrmAppHelper::truncate( $form->name, 33 ); ?></a></li>
|
150 |
<?php
|
151 |
unset($form);
|
152 |
}
|
@@ -252,9 +252,9 @@ class FrmFormsListHelper extends FrmListHelper {
|
|
252 |
$val = '<abbr title="' . esc_attr( date( 'Y/m/d g:i:s A', strtotime( $item->created_at ) ) ) . '">' . $date . '</abbr>';
|
253 |
break;
|
254 |
case 'shortcode':
|
255 |
-
$val = '<input type="text" readonly="readonly" class="frm_select_box" value="' . esc_attr(
|
256 |
if ( 'excerpt' == $mode ) {
|
257 |
-
$val .= '<input type="text" readonly="readonly" class="frm_select_box" value="' . esc_attr(
|
258 |
}
|
259 |
break;
|
260 |
case 'entries':
|
146 |
} else {
|
147 |
foreach ( $forms as $form ) {
|
148 |
$args['id'] = $form->id; ?>
|
149 |
+
<li><a href="<?php echo esc_url( add_query_arg( $args, $base ) ); ?>" tabindex="-1"><?php echo esc_html( empty( $form->name ) ? __( '(no title)' ) : FrmAppHelper::truncate( $form->name, 33 ) ); ?></a></li>
|
150 |
<?php
|
151 |
unset($form);
|
152 |
}
|
252 |
$val = '<abbr title="' . esc_attr( date( 'Y/m/d g:i:s A', strtotime( $item->created_at ) ) ) . '">' . $date . '</abbr>';
|
253 |
break;
|
254 |
case 'shortcode':
|
255 |
+
$val = '<input type="text" readonly="readonly" class="frm_select_box" value="' . esc_attr( '[formidable id=' . $item->id .']' ) . '" /><br/>';
|
256 |
if ( 'excerpt' == $mode ) {
|
257 |
+
$val .= '<input type="text" readonly="readonly" class="frm_select_box" value="' . esc_attr( '[formidable key=' . $item->form_key . ']' ) . '" />';
|
258 |
}
|
259 |
break;
|
260 |
case 'entries':
|
classes/helpers/FrmXMLHelper.php
CHANGED
@@ -879,7 +879,7 @@ class FrmXMLHelper {
|
|
879 |
*
|
880 |
* @param $post_content array, pass by reference
|
881 |
*/
|
882 |
-
private static function switch_email_contition_field_ids( &$post_content ){
|
883 |
// Switch field IDs in conditional logic
|
884 |
if ( isset( $post_content['conditions'] ) && is_array( $post_content['conditions'] ) ) {
|
885 |
foreach ( $post_content['conditions'] as $email_key => $val ) {
|
879 |
*
|
880 |
* @param $post_content array, pass by reference
|
881 |
*/
|
882 |
+
private static function switch_email_contition_field_ids( &$post_content ) {
|
883 |
// Switch field IDs in conditional logic
|
884 |
if ( isset( $post_content['conditions'] ) && is_array( $post_content['conditions'] ) ) {
|
885 |
foreach ( $post_content['conditions'] as $email_key => $val ) {
|
classes/models/FrmEntry.php
CHANGED
@@ -237,7 +237,7 @@ class FrmEntry {
|
|
237 |
return $query_results;
|
238 |
}
|
239 |
|
240 |
-
|
241 |
global $wpdb;
|
242 |
$id = (int) $id;
|
243 |
|
@@ -257,7 +257,7 @@ class FrmEntry {
|
|
257 |
return $result;
|
258 |
}
|
259 |
|
260 |
-
|
261 |
global $wpdb;
|
262 |
$form_id = isset($value) ? $form_id : null;
|
263 |
$result = $wpdb->update( $wpdb->prefix .'frm_items', array( 'form_id' => $form_id), array( 'id' => $id ) );
|
@@ -345,7 +345,7 @@ class FrmEntry {
|
|
345 |
/**
|
346 |
* @param string $id
|
347 |
*/
|
348 |
-
|
349 |
global $wpdb;
|
350 |
|
351 |
if ( FrmAppHelper::check_cache( $id, 'frm_entry' ) ) {
|
237 |
return $query_results;
|
238 |
}
|
239 |
|
240 |
+
public static function &destroy( $id ) {
|
241 |
global $wpdb;
|
242 |
$id = (int) $id;
|
243 |
|
257 |
return $result;
|
258 |
}
|
259 |
|
260 |
+
public static function &update_form( $id, $value, $form_id ) {
|
261 |
global $wpdb;
|
262 |
$form_id = isset($value) ? $form_id : null;
|
263 |
$result = $wpdb->update( $wpdb->prefix .'frm_items', array( 'form_id' => $form_id), array( 'id' => $id ) );
|
345 |
/**
|
346 |
* @param string $id
|
347 |
*/
|
348 |
+
public static function &exists( $id ) {
|
349 |
global $wpdb;
|
350 |
|
351 |
if ( FrmAppHelper::check_cache( $id, 'frm_entry' ) ) {
|
classes/models/FrmField.php
CHANGED
@@ -3,7 +3,7 @@ if ( ! defined('ABSPATH') ) {
|
|
3 |
die( 'You are not allowed to call this page directly.' );
|
4 |
}
|
5 |
|
6 |
-
class FrmField{
|
7 |
static $use_cache = true;
|
8 |
static $transient_size = 200;
|
9 |
|
@@ -42,6 +42,7 @@ class FrmField{
|
|
42 |
// $new_values['id'] = $values['id'];
|
43 |
|
44 |
$query_results = $wpdb->insert( $wpdb->prefix .'frm_fields', $new_values );
|
|
|
45 |
if ( $query_results ) {
|
46 |
self::delete_form_transient( $new_values['form_id'] );
|
47 |
$new_id = $wpdb->insert_id;
|
@@ -99,7 +100,7 @@ class FrmField{
|
|
99 |
}
|
100 |
}
|
101 |
|
102 |
-
|
103 |
global $wpdb;
|
104 |
|
105 |
$id = absint( $id );
|
@@ -180,7 +181,7 @@ class FrmField{
|
|
180 |
}
|
181 |
}
|
182 |
|
183 |
-
|
184 |
if ( empty( $id ) ) {
|
185 |
return;
|
186 |
}
|
@@ -479,7 +480,7 @@ class FrmField{
|
|
479 |
}
|
480 |
}
|
481 |
|
482 |
-
|
483 |
_deprecated_function( __FUNCTION__, '2.0' );
|
484 |
global $wpdb;
|
485 |
if ( ! empty($order_by) && ! strpos($order_by, 'ORDER BY') !== false ) {
|
3 |
die( 'You are not allowed to call this page directly.' );
|
4 |
}
|
5 |
|
6 |
+
class FrmField {
|
7 |
static $use_cache = true;
|
8 |
static $transient_size = 200;
|
9 |
|
42 |
// $new_values['id'] = $values['id'];
|
43 |
|
44 |
$query_results = $wpdb->insert( $wpdb->prefix .'frm_fields', $new_values );
|
45 |
+
$new_id = 0;
|
46 |
if ( $query_results ) {
|
47 |
self::delete_form_transient( $new_values['form_id'] );
|
48 |
$new_id = $wpdb->insert_id;
|
100 |
}
|
101 |
}
|
102 |
|
103 |
+
public static function update( $id, $values ) {
|
104 |
global $wpdb;
|
105 |
|
106 |
$id = absint( $id );
|
181 |
}
|
182 |
}
|
183 |
|
184 |
+
public static function getOne( $id ) {
|
185 |
if ( empty( $id ) ) {
|
186 |
return;
|
187 |
}
|
480 |
}
|
481 |
}
|
482 |
|
483 |
+
public static function getIds( $where = '', $order_by = '', $limit = '' ) {
|
484 |
_deprecated_function( __FUNCTION__, '2.0' );
|
485 |
global $wpdb;
|
486 |
if ( ! empty($order_by) && ! strpos($order_by, 'ORDER BY') !== false ) {
|
classes/models/FrmForm.php
CHANGED
@@ -3,7 +3,7 @@ if ( ! defined('ABSPATH') ) {
|
|
3 |
die('You are not allowed to call this page directly.');
|
4 |
}
|
5 |
|
6 |
-
class FrmForm{
|
7 |
|
8 |
/**
|
9 |
* @return int|boolean id on success or false on failure
|
@@ -25,12 +25,7 @@ class FrmForm{
|
|
25 |
);
|
26 |
|
27 |
$options = array();
|
28 |
-
|
29 |
-
$defaults = FrmFormsHelper::get_default_opts();
|
30 |
-
foreach ( $defaults as $var => $default ) {
|
31 |
-
$options[ $var ] = isset( $values['options'][ $var ] ) ? $values['options'][ $var ] : $default;
|
32 |
-
unset( $var, $default );
|
33 |
-
}
|
34 |
|
35 |
$options['before_html'] = isset($values['options']['before_html']) ? $values['options']['before_html'] : FrmFormsHelper::get_default_html('before');
|
36 |
$options['after_html'] = isset($values['options']['after_html']) ? $values['options']['after_html'] : FrmFormsHelper::get_default_html('after');
|
@@ -177,11 +172,7 @@ class FrmForm{
|
|
177 |
}
|
178 |
|
179 |
$options = array();
|
180 |
-
|
181 |
-
$defaults = FrmFormsHelper::get_default_opts();
|
182 |
-
foreach ( $defaults as $var => $default ) {
|
183 |
-
$options[ $var ] = isset( $values['options'][ $var ] ) ? $values['options'][ $var ] : $default;
|
184 |
-
}
|
185 |
|
186 |
$options['custom_style'] = isset($values['options']['custom_style']) ? $values['options']['custom_style'] : 0;
|
187 |
$options['before_html'] = isset($values['options']['before_html']) ? $values['options']['before_html'] : FrmFormsHelper::get_default_html('before');
|
@@ -347,7 +338,7 @@ class FrmForm{
|
|
347 |
/**
|
348 |
* @return int|boolean
|
349 |
*/
|
350 |
-
|
351 |
global $wpdb;
|
352 |
|
353 |
$form = self::getOne($id);
|
@@ -404,7 +395,7 @@ class FrmForm{
|
|
404 |
* @param string $key
|
405 |
* @return int form id
|
406 |
*/
|
407 |
-
|
408 |
$id = FrmDb::get_var( 'frm_forms', array( 'form_key' => sanitize_title( $key ) ) );
|
409 |
return $id;
|
410 |
}
|
@@ -413,7 +404,7 @@ class FrmForm{
|
|
413 |
* @param int $id
|
414 |
* @return string form key
|
415 |
*/
|
416 |
-
|
417 |
$id = (int) $id;
|
418 |
$cache = FrmAppHelper::check_cache($id, 'frm_form');
|
419 |
if ( $cache ) {
|
@@ -464,43 +455,30 @@ class FrmForm{
|
|
464 |
}
|
465 |
|
466 |
/**
|
467 |
-
* @return array of objects
|
468 |
*/
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
}
|
475 |
-
|
476 |
-
$query = 'SELECT * FROM ' . $wpdb->prefix .'frm_forms' . FrmAppHelper::prepend_and_or_where(' WHERE ', $where) . FrmAppHelper::esc_order($order_by) . FrmAppHelper::esc_limit($limit);
|
477 |
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
// the query has already been prepared if this is not an array
|
483 |
-
$results = $wpdb->get_row($query);
|
484 |
-
}
|
485 |
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
$results = FrmDb::get_results( $wpdb->prefix .'frm_forms', $where, '*', compact('order_by', 'limit') );
|
493 |
-
} else {
|
494 |
-
$results = $wpdb->get_results($query);
|
495 |
-
}
|
496 |
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
}
|
502 |
-
}
|
503 |
-
}
|
504 |
|
505 |
return stripslashes_deep($results);
|
506 |
}
|
@@ -576,7 +554,7 @@ class FrmForm{
|
|
576 |
/**
|
577 |
* @return array of errors
|
578 |
*/
|
579 |
-
|
580 |
$errors = array();
|
581 |
|
582 |
return apply_filters('frm_validate_form', $errors, $values);
|
3 |
die('You are not allowed to call this page directly.');
|
4 |
}
|
5 |
|
6 |
+
class FrmForm {
|
7 |
|
8 |
/**
|
9 |
* @return int|boolean id on success or false on failure
|
25 |
);
|
26 |
|
27 |
$options = array();
|
28 |
+
FrmFormsHelper::fill_form_options( $options );
|
|
|
|
|
|
|
|
|
|
|
29 |
|
30 |
$options['before_html'] = isset($values['options']['before_html']) ? $values['options']['before_html'] : FrmFormsHelper::get_default_html('before');
|
31 |
$options['after_html'] = isset($values['options']['after_html']) ? $values['options']['after_html'] : FrmFormsHelper::get_default_html('after');
|
172 |
}
|
173 |
|
174 |
$options = array();
|
175 |
+
FrmFormsHelper::fill_form_options( $options );
|
|
|
|
|
|
|
|
|
176 |
|
177 |
$options['custom_style'] = isset($values['options']['custom_style']) ? $values['options']['custom_style'] : 0;
|
178 |
$options['before_html'] = isset($values['options']['before_html']) ? $values['options']['before_html'] : FrmFormsHelper::get_default_html('before');
|
338 |
/**
|
339 |
* @return int|boolean
|
340 |
*/
|
341 |
+
public static function destroy( $id ) {
|
342 |
global $wpdb;
|
343 |
|
344 |
$form = self::getOne($id);
|
395 |
* @param string $key
|
396 |
* @return int form id
|
397 |
*/
|
398 |
+
public static function &getIdByKey( $key ) {
|
399 |
$id = FrmDb::get_var( 'frm_forms', array( 'form_key' => sanitize_title( $key ) ) );
|
400 |
return $id;
|
401 |
}
|
404 |
* @param int $id
|
405 |
* @return string form key
|
406 |
*/
|
407 |
+
public static function &getKeyById( $id ) {
|
408 |
$id = (int) $id;
|
409 |
$cache = FrmAppHelper::check_cache($id, 'frm_form');
|
410 |
if ( $cache ) {
|
455 |
}
|
456 |
|
457 |
/**
|
458 |
+
* @return object|array of objects
|
459 |
*/
|
460 |
+
public static function getAll( $where = array(), $order_by = '', $limit = '' ) {
|
461 |
+
if ( is_array( $where ) && ! empty( $where ) ) {
|
462 |
+
$results = FrmDb::get_results( 'frm_forms', $where, '*', array( 'order_by' => $order_by, 'limit' => $limit ) );
|
463 |
+
} else {
|
464 |
+
global $wpdb;
|
|
|
|
|
|
|
465 |
|
466 |
+
// the query has already been prepared if this is not an array
|
467 |
+
$query = 'SELECT * FROM ' . $wpdb->prefix . 'frm_forms' . FrmAppHelper::prepend_and_or_where( ' WHERE ', $where ) . FrmAppHelper::esc_order( $order_by ) . FrmAppHelper::esc_limit( $limit );
|
468 |
+
$results = $wpdb->get_results( $query );
|
469 |
+
}
|
|
|
|
|
|
|
470 |
|
471 |
+
if ( $results ) {
|
472 |
+
foreach ( $results as $result ) {
|
473 |
+
wp_cache_set( $result->id, $result, 'frm_form' );
|
474 |
+
$result->options = maybe_unserialize( $result->options );
|
475 |
+
}
|
476 |
+
}
|
|
|
|
|
|
|
|
|
477 |
|
478 |
+
if ( $limit == ' LIMIT 1' || $limit == 1 ) {
|
479 |
+
// return the first form object if we are only getting one form
|
480 |
+
$results = reset( $results );
|
481 |
+
}
|
|
|
|
|
|
|
482 |
|
483 |
return stripslashes_deep($results);
|
484 |
}
|
554 |
/**
|
555 |
* @return array of errors
|
556 |
*/
|
557 |
+
public static function validate( $values ) {
|
558 |
$errors = array();
|
559 |
|
560 |
return apply_filters('frm_validate_form', $errors, $values);
|
classes/models/FrmFormAction.php
CHANGED
@@ -35,7 +35,7 @@ class FrmFormAction {
|
|
35 |
* @param array $instance Current settings
|
36 |
*/
|
37 |
public function form($instance, $args = array()) {
|
38 |
-
echo '<p class="no-options-widget">' .
|
39 |
return 'noform';
|
40 |
}
|
41 |
|
@@ -334,18 +334,7 @@ class FrmFormAction {
|
|
334 |
}
|
335 |
|
336 |
public function save_settings($settings) {
|
337 |
-
|
338 |
-
|
339 |
-
$settings['post_content'] = FrmAppHelper::prepare_and_encode( $settings['post_content'] );
|
340 |
-
|
341 |
-
if ( empty($settings['ID']) ) {
|
342 |
-
unset($settings['ID']);
|
343 |
-
}
|
344 |
-
|
345 |
-
// delete all action caches
|
346 |
-
self::clear_cache();
|
347 |
-
|
348 |
-
return FrmAppHelper::save_json_post( $settings );
|
349 |
}
|
350 |
|
351 |
public function get_single_action( $id ) {
|
@@ -412,6 +401,7 @@ class FrmFormAction {
|
|
412 |
|
413 |
public function prepare_action($action) {
|
414 |
$action->post_content = FrmAppHelper::maybe_json_decode($action->post_content);
|
|
|
415 |
|
416 |
$default_values = $this->get_global_defaults();
|
417 |
|
35 |
* @param array $instance Current settings
|
36 |
*/
|
37 |
public function form($instance, $args = array()) {
|
38 |
+
echo '<p class="no-options-widget">' . esc_html__( 'There are no options for this action.', 'formidable' ) . '</p>';
|
39 |
return 'noform';
|
40 |
}
|
41 |
|
334 |
}
|
335 |
|
336 |
public function save_settings($settings) {
|
337 |
+
return FrmAppHelper::save_settings( $settings, 'frm_actions' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
338 |
}
|
339 |
|
340 |
public function get_single_action( $id ) {
|
401 |
|
402 |
public function prepare_action($action) {
|
403 |
$action->post_content = FrmAppHelper::maybe_json_decode($action->post_content);
|
404 |
+
$action->post_excerpt = sanitize_title( $action->post_excerpt );
|
405 |
|
406 |
$default_values = $this->get_global_defaults();
|
407 |
|
classes/models/FrmNotification.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
class FrmNotification{
|
4 |
-
|
5 |
if ( ! defined('ABSPATH') ) {
|
6 |
die('You are not allowed to call this page directly.');
|
7 |
}
|
@@ -9,7 +9,7 @@ class FrmNotification{
|
|
9 |
}
|
10 |
|
11 |
public static function trigger_email($action, $entry, $form) {
|
12 |
-
|
13 |
return;
|
14 |
}
|
15 |
|
@@ -378,7 +378,7 @@ class FrmNotification{
|
|
378 |
$sent_to = array_filter( $sent_to );
|
379 |
if ( apply_filters('frm_echo_emails', false) ) {
|
380 |
$temp = str_replace('<', '<', $sent_to);
|
381 |
-
|
382 |
}
|
383 |
return $sent_to;
|
384 |
}
|
1 |
<?php
|
2 |
|
3 |
+
class FrmNotification {
|
4 |
+
public function __construct() {
|
5 |
if ( ! defined('ABSPATH') ) {
|
6 |
die('You are not allowed to call this page directly.');
|
7 |
}
|
9 |
}
|
10 |
|
11 |
public static function trigger_email($action, $entry, $form) {
|
12 |
+
if ( defined( 'WP_IMPORTING' ) && WP_IMPORTING ) {
|
13 |
return;
|
14 |
}
|
15 |
|
378 |
$sent_to = array_filter( $sent_to );
|
379 |
if ( apply_filters('frm_echo_emails', false) ) {
|
380 |
$temp = str_replace('<', '<', $sent_to);
|
381 |
+
echo ' ' . FrmAppHelper::kses( implode(', ', (array) $temp ) );
|
382 |
}
|
383 |
return $sent_to;
|
384 |
}
|
classes/models/FrmSettings.php
CHANGED
@@ -74,7 +74,7 @@ class FrmSettings{
|
|
74 |
/**
|
75 |
* @return array
|
76 |
*/
|
77 |
-
|
78 |
return array(
|
79 |
'menu' => 'Formidable',
|
80 |
'mu_menu' => 0,
|
@@ -97,7 +97,7 @@ class FrmSettings{
|
|
97 |
);
|
98 |
}
|
99 |
|
100 |
-
|
101 |
$this->fill_recaptcha_settings();
|
102 |
|
103 |
if ( ! isset($this->load_style) ) {
|
@@ -169,7 +169,7 @@ class FrmSettings{
|
|
169 |
return $errors;
|
170 |
}
|
171 |
|
172 |
-
|
173 |
$this->fill_with_defaults($params);
|
174 |
$this->update_settings($params);
|
175 |
|
@@ -197,8 +197,8 @@ class FrmSettings{
|
|
197 |
|
198 |
$this->use_html = isset($params['frm_use_html']) ? $params['frm_use_html'] : 0;
|
199 |
//$this->custom_style = isset($params['frm_custom_style']) ? $params['frm_custom_style'] : 0;
|
200 |
-
|
201 |
-
|
202 |
}
|
203 |
|
204 |
private function update_roles($params) {
|
@@ -236,7 +236,7 @@ class FrmSettings{
|
|
236 |
}
|
237 |
}
|
238 |
|
239 |
-
|
240 |
// Save the posted value in the database
|
241 |
|
242 |
update_option('frm_options', $this);
|
74 |
/**
|
75 |
* @return array
|
76 |
*/
|
77 |
+
public function default_options() {
|
78 |
return array(
|
79 |
'menu' => 'Formidable',
|
80 |
'mu_menu' => 0,
|
97 |
);
|
98 |
}
|
99 |
|
100 |
+
private function set_default_options() {
|
101 |
$this->fill_recaptcha_settings();
|
102 |
|
103 |
if ( ! isset($this->load_style) ) {
|
169 |
return $errors;
|
170 |
}
|
171 |
|
172 |
+
public function update( $params ) {
|
173 |
$this->fill_with_defaults($params);
|
174 |
$this->update_settings($params);
|
175 |
|
197 |
|
198 |
$this->use_html = isset($params['frm_use_html']) ? $params['frm_use_html'] : 0;
|
199 |
//$this->custom_style = isset($params['frm_custom_style']) ? $params['frm_custom_style'] : 0;
|
200 |
+
$this->jquery_css = isset( $params['frm_jquery_css'] ) ? absint( $params['frm_jquery_css'] ) : 0;
|
201 |
+
$this->accordion_js = isset( $params['frm_accordion_js'] ) ? absint( $params['frm_accordion_js'] ) : 0;
|
202 |
}
|
203 |
|
204 |
private function update_roles($params) {
|
236 |
}
|
237 |
}
|
238 |
|
239 |
+
public function store() {
|
240 |
// Save the posted value in the database
|
241 |
|
242 |
update_option('frm_options', $this);
|
classes/models/FrmStyle.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<?php
|
2 |
-
class FrmStyle{
|
3 |
public $number = false; // Unique ID number of the current instance.
|
4 |
public $id = 0; // the id of the post
|
5 |
|
@@ -31,16 +31,7 @@ class FrmStyle{
|
|
31 |
}
|
32 |
|
33 |
public function save($settings) {
|
34 |
-
|
35 |
-
|
36 |
-
if ( empty($settings['ID']) ) {
|
37 |
-
unset($settings['ID']);
|
38 |
-
}
|
39 |
-
|
40 |
-
// delete all styling caches
|
41 |
-
FrmAppHelper::cache_delete_group('frm_styles');
|
42 |
-
|
43 |
-
return FrmAppHelper::save_json_post( $settings );
|
44 |
}
|
45 |
|
46 |
public function duplicate($id) {
|
@@ -310,7 +301,7 @@ class FrmStyle{
|
|
310 |
return $settings;
|
311 |
}
|
312 |
|
313 |
-
|
314 |
return array(
|
315 |
'theme_css' => 'ui-lightness',
|
316 |
'theme_name' => 'UI Lightness',
|
1 |
<?php
|
2 |
+
class FrmStyle {
|
3 |
public $number = false; // Unique ID number of the current instance.
|
4 |
public $id = 0; // the id of the post
|
5 |
|
31 |
}
|
32 |
|
33 |
public function save($settings) {
|
34 |
+
return FrmAppHelper::save_settings( $settings, 'frm_styles' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
}
|
36 |
|
37 |
public function duplicate($id) {
|
301 |
return $settings;
|
302 |
}
|
303 |
|
304 |
+
public function get_defaults() {
|
305 |
return array(
|
306 |
'theme_css' => 'ui-lightness',
|
307 |
'theme_name' => 'UI Lightness',
|
classes/views/frm-entries/errors.php
CHANGED
@@ -5,10 +5,10 @@ if ( isset($include_extra_container) ) { ?>
|
|
5 |
}
|
6 |
if ( isset( $message ) && $message != '' ) {
|
7 |
if ( FrmAppHelper::is_admin() ) {
|
8 |
-
|
9 |
} else {
|
10 |
FrmFormsHelper::get_scroll_js($form->id);
|
11 |
-
|
12 |
}
|
13 |
}
|
14 |
|
@@ -28,35 +28,9 @@ if ( ! FrmAppHelper::is_admin() ) {
|
|
28 |
}
|
29 |
}
|
30 |
|
31 |
-
|
32 |
-
if ( empty( $frm_settings->invalid_msg ) ) {
|
33 |
-
$show_img = false;
|
34 |
-
foreach ( $errors as $error ) {
|
35 |
-
if ( $show_img && ! empty($img) ) {
|
36 |
-
?><img src="<?php echo esc_attr( $img ) ?>" alt="" /><?php
|
37 |
-
} else {
|
38 |
-
$show_img = true;
|
39 |
-
}
|
40 |
-
echo $error . '<br/>';
|
41 |
-
}
|
42 |
-
} else {
|
43 |
-
echo $frm_settings->invalid_msg;
|
44 |
-
|
45 |
-
$show_img = true;
|
46 |
-
foreach ( $errors as $err_key => $error ) {
|
47 |
-
if ( ! is_numeric($err_key) && ( $err_key == 'cptch_number' || strpos($err_key, 'field') === 0 ) ) {
|
48 |
-
continue;
|
49 |
-
}
|
50 |
|
51 |
-
|
52 |
-
if ( $show_img && ! empty($img) ) {
|
53 |
-
?><img src="<?php echo esc_attr( $img ) ?>" alt="" /><?php
|
54 |
-
} else {
|
55 |
-
$show_img = true;
|
56 |
-
}
|
57 |
-
echo $error;
|
58 |
-
}
|
59 |
-
} ?>
|
60 |
</div>
|
61 |
<?php
|
62 |
}
|
5 |
}
|
6 |
if ( isset( $message ) && $message != '' ) {
|
7 |
if ( FrmAppHelper::is_admin() ) {
|
8 |
+
?><div id="message" class="frm_message updated frm_msg_padding"><?php echo wp_kses_post( $message ) ?></div><?php
|
9 |
} else {
|
10 |
FrmFormsHelper::get_scroll_js($form->id);
|
11 |
+
echo wp_kses_post( $message );
|
12 |
}
|
13 |
}
|
14 |
|
28 |
}
|
29 |
}
|
30 |
|
31 |
+
FrmFormsHelper::show_errors( compact( 'img', 'errors' ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
|
33 |
+
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
</div>
|
35 |
<?php
|
36 |
}
|
classes/views/frm-entries/list.php
CHANGED
@@ -14,7 +14,7 @@
|
|
14 |
</div>
|
15 |
<div id="postbox-container-1" class="postbox-container">
|
16 |
<input type="hidden" name="page" value="formidable-entries" />
|
17 |
-
|
18 |
<input type="hidden" name="frm_action" value="list" />
|
19 |
<?php $wp_list_table->search_box( __( 'Search', 'formidable' ), 'entry' ); ?>
|
20 |
</div>
|
@@ -22,7 +22,7 @@
|
|
22 |
</div>
|
23 |
<?php if ( $form ) { ?>
|
24 |
<div id="titlediv">
|
25 |
-
|
26 |
</div>
|
27 |
<?php } ?>
|
28 |
|
14 |
</div>
|
15 |
<div id="postbox-container-1" class="postbox-container">
|
16 |
<input type="hidden" name="page" value="formidable-entries" />
|
17 |
+
<input type="hidden" name="form" value="<?php echo esc_attr( $form ? $form->id : '' ); ?>" />
|
18 |
<input type="hidden" name="frm_action" value="list" />
|
19 |
<?php $wp_list_table->search_box( __( 'Search', 'formidable' ), 'entry' ); ?>
|
20 |
</div>
|
22 |
</div>
|
23 |
<?php if ( $form ) { ?>
|
24 |
<div id="titlediv">
|
25 |
+
<input id="title" type="text" value="<?php echo esc_attr( $form->name == '' ? __( '(no title)' ) : $form->name ) ?>" readonly="readonly" disabled="disabled" />
|
26 |
</div>
|
27 |
<?php } ?>
|
28 |
|
classes/views/frm-entries/new.php
CHANGED
@@ -8,7 +8,7 @@ if ( empty($values) || ! isset($values['fields']) || empty($values['fields']) )
|
|
8 |
return;
|
9 |
} ?>
|
10 |
<div class="frm_forms <?php echo FrmFormsHelper::get_form_style_class($values); ?>" id="frm_form_<?php echo esc_attr( $form->id ) ?>_container">
|
11 |
-
<form enctype="<?php echo apply_filters('frm_form_enctype', 'multipart/form-data', $form) ?>" method="post" class="frm-show-form <?php do_action('frm_form_classes', $form) ?>" id="form_<?php echo esc_attr( $form->form_key ) ?>" <?php echo $frm_settings->use_html ? '' : 'action=""'; ?>>
|
12 |
<?php
|
13 |
include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/errors.php');
|
14 |
$form_action = 'create';
|
8 |
return;
|
9 |
} ?>
|
10 |
<div class="frm_forms <?php echo FrmFormsHelper::get_form_style_class($values); ?>" id="frm_form_<?php echo esc_attr( $form->id ) ?>_container">
|
11 |
+
<form enctype="<?php echo esc_attr( apply_filters( 'frm_form_enctype', 'multipart/form-data', $form ) ) ?>" method="post" class="frm-show-form <?php do_action('frm_form_classes', $form) ?>" id="form_<?php echo esc_attr( $form->form_key ) ?>" <?php echo $frm_settings->use_html ? '' : 'action=""'; ?>>
|
12 |
<?php
|
13 |
include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/errors.php');
|
14 |
$form_action = 'create';
|
classes/views/frm-entries/show.php
CHANGED
@@ -55,7 +55,7 @@
|
|
55 |
|
56 |
<?php if ( $entry->parent_item_id ) { ?>
|
57 |
<tr><th><?php _e( 'Parent Entry ID', 'formidable' ) ?>:</th>
|
58 |
-
|
59 |
</td></tr>
|
60 |
<?php } ?>
|
61 |
</tbody></table>
|
55 |
|
56 |
<?php if ( $entry->parent_item_id ) { ?>
|
57 |
<tr><th><?php _e( 'Parent Entry ID', 'formidable' ) ?>:</th>
|
58 |
+
<td><?php echo absint( $entry->parent_item_id ) ?>
|
59 |
</td></tr>
|
60 |
<?php } ?>
|
61 |
</tbody></table>
|
classes/views/frm-entries/sidebar-shared.php
CHANGED
@@ -14,13 +14,14 @@
|
|
14 |
|
15 |
<div class="misc-pub-section">
|
16 |
<span class="dashicons dashicons-id wp-media-buttons-icon"></span>
|
17 |
-
|
|
|
18 |
</div>
|
19 |
|
20 |
<div class="misc-pub-section">
|
21 |
<span class="dashicons dashicons-post-status wp-media-buttons-icon"></span>
|
22 |
<?php _e( 'Entry Key', 'formidable' ) ?>:
|
23 |
-
|
24 |
</div>
|
25 |
|
26 |
<?php if ( FrmAppHelper::pro_is_installed() ) { ?>
|
@@ -49,7 +50,7 @@
|
|
49 |
<div class="inside">
|
50 |
<div class="misc-pub-section">
|
51 |
<?php _e( 'IP Address', 'formidable' ) ?>:
|
52 |
-
|
53 |
</div>
|
54 |
|
55 |
<?php if ( isset($data['browser']) ) { ?>
|
@@ -62,7 +63,7 @@
|
|
62 |
<?php if ( isset($data['referrer']) ) { ?>
|
63 |
<div class="misc-pub-section">
|
64 |
<b><?php _e( 'Referrer', 'formidable' ) ?></b>:<br/>
|
65 |
-
|
66 |
</div>
|
67 |
<?php } ?>
|
68 |
|
@@ -73,8 +74,8 @@
|
|
73 |
}
|
74 |
?>
|
75 |
<div class="misc-pub-section">
|
76 |
-
|
77 |
-
|
78 |
</div>
|
79 |
<?php
|
80 |
unset($k, $d);
|
14 |
|
15 |
<div class="misc-pub-section">
|
16 |
<span class="dashicons dashicons-id wp-media-buttons-icon"></span>
|
17 |
+
<?php _e( 'Entry ID', 'formidable' ) ?>:
|
18 |
+
<b><?php echo absint( $entry->id ) ?></b>
|
19 |
</div>
|
20 |
|
21 |
<div class="misc-pub-section">
|
22 |
<span class="dashicons dashicons-post-status wp-media-buttons-icon"></span>
|
23 |
<?php _e( 'Entry Key', 'formidable' ) ?>:
|
24 |
+
<b><?php echo sanitize_title( $entry->item_key ) ?></b>
|
25 |
</div>
|
26 |
|
27 |
<?php if ( FrmAppHelper::pro_is_installed() ) { ?>
|
50 |
<div class="inside">
|
51 |
<div class="misc-pub-section">
|
52 |
<?php _e( 'IP Address', 'formidable' ) ?>:
|
53 |
+
<b><?php echo sanitize_text_field( $entry->ip ); ?></b>
|
54 |
</div>
|
55 |
|
56 |
<?php if ( isset($data['browser']) ) { ?>
|
63 |
<?php if ( isset($data['referrer']) ) { ?>
|
64 |
<div class="misc-pub-section">
|
65 |
<b><?php _e( 'Referrer', 'formidable' ) ?></b>:<br/>
|
66 |
+
<?php echo wp_kses_post( str_replace( "\r\n", '<br/>', $data['referrer'] ) ); ?>
|
67 |
</div>
|
68 |
<?php } ?>
|
69 |
|
74 |
}
|
75 |
?>
|
76 |
<div class="misc-pub-section">
|
77 |
+
<b><?php echo sanitize_text_field( ucfirst( str_replace( '-', ' ', $k ) ) ); ?></b>:
|
78 |
+
<?php echo wp_kses_post( implode( ', ', (array) $d ) ); ?>
|
79 |
</div>
|
80 |
<?php
|
81 |
unset($k, $d);
|
classes/views/frm-fields/import_choices.php
CHANGED
@@ -17,7 +17,7 @@
|
|
17 |
|
18 |
?>
|
19 |
</head>
|
20 |
-
<body class="wp-admin no-js wp-core-ui frm_field_opts_popup <?php echo apply_filters( 'admin_body_class', '' ) .
|
21 |
<div class="frm_med_padding">
|
22 |
<p class="howto"><?php _e( 'Edit or add field options (one per line)', 'formidable' ) ?></p>
|
23 |
<ul class="frm_prepop">
|
17 |
|
18 |
?>
|
19 |
</head>
|
20 |
+
<body class="wp-admin no-js wp-core-ui frm_field_opts_popup <?php echo esc_attr( apply_filters( 'admin_body_class', '' ) . ' ' . $admin_body_class ); ?>">
|
21 |
<div class="frm_med_padding">
|
22 |
<p class="howto"><?php _e( 'Edit or add field options (one per line)', 'formidable' ) ?></p>
|
23 |
<ul class="frm_prepop">
|
classes/views/frm-fields/input.php
CHANGED
@@ -35,7 +35,7 @@ do_action('frm_field_input_html', $field);
|
|
35 |
$checked = FrmAppHelper::check_selected($field['value'], $field_val) ? 'checked="checked" ' : ' ';
|
36 |
|
37 |
$other_opt = false;
|
38 |
-
$other_args =
|
39 |
?>
|
40 |
<input type="radio" name="<?php echo esc_attr( $field_name ) ?>" id="<?php echo esc_attr( $html_id . '-' . $opt_key ) ?>" value="<?php echo esc_attr( $field_val ) ?>" <?php
|
41 |
echo $checked;
|
@@ -46,9 +46,12 @@ do_action('frm_field_input_html', $field);
|
|
46 |
echo ' '. $opt .'</label>';
|
47 |
}
|
48 |
|
49 |
-
|
50 |
-
|
51 |
-
|
|
|
|
|
|
|
52 |
unset( $other_opt, $other_args );
|
53 |
?></div>
|
54 |
<?php
|
@@ -73,20 +76,22 @@ do_action('frm_field_input_html', $field);
|
|
73 |
$opt = apply_filters( 'frm_field_label_seen', $opt, $opt_key, $field );
|
74 |
$selected = FrmAppHelper::check_selected( $field['value'], $field_val );
|
75 |
if ( $other_opt === false ) {
|
76 |
-
$other_args =
|
77 |
-
if (
|
78 |
$other_checked = true;
|
79 |
}
|
80 |
}
|
81 |
?>
|
82 |
-
|
83 |
<?php
|
84 |
} ?>
|
85 |
</select>
|
86 |
<?php
|
87 |
-
|
88 |
-
|
89 |
-
|
|
|
|
|
90 |
}
|
91 |
} else if ( $field['type'] == 'checkbox' ) {
|
92 |
$checked_values = $field['value'];
|
@@ -119,7 +124,7 @@ do_action('frm_field_input_html', $field);
|
|
119 |
|
120 |
// Check if other opt, and get values for other field if needed
|
121 |
$other_opt = false;
|
122 |
-
|
123 |
|
124 |
?>
|
125 |
<div class="<?php echo esc_attr( apply_filters( 'frm_checkbox_class', 'frm_checkbox', $field, $field_val ) ) ?>" id="frm_checkbox_<?php echo esc_attr( $field['id'] ) ?>-<?php echo esc_attr( $opt_key ) ?>"><?php
|
@@ -134,9 +139,11 @@ do_action('frm_field_input_html', $field);
|
|
134 |
echo ' '. $opt .'</label>';
|
135 |
}
|
136 |
|
137 |
-
|
138 |
-
|
139 |
-
|
|
|
|
|
140 |
|
141 |
unset( $other_opt, $other_args, $checked );
|
142 |
|
35 |
$checked = FrmAppHelper::check_selected($field['value'], $field_val) ? 'checked="checked" ' : ' ';
|
36 |
|
37 |
$other_opt = false;
|
38 |
+
$other_args = FrmFieldsHelper::prepare_other_input( compact( 'field_name', 'opt_key', 'field' ), $other_opt, $checked );
|
39 |
?>
|
40 |
<input type="radio" name="<?php echo esc_attr( $field_name ) ?>" id="<?php echo esc_attr( $html_id . '-' . $opt_key ) ?>" value="<?php echo esc_attr( $field_val ) ?>" <?php
|
41 |
echo $checked;
|
46 |
echo ' '. $opt .'</label>';
|
47 |
}
|
48 |
|
49 |
+
FrmFieldsHelper::include_other_input( array(
|
50 |
+
'other_opt' => $other_opt, 'read_only' => $read_only,
|
51 |
+
'checked' => $checked, 'name' => $other_args['name'],
|
52 |
+
'value' => $other_args['value'], 'field' => $field,
|
53 |
+
) );
|
54 |
+
|
55 |
unset( $other_opt, $other_args );
|
56 |
?></div>
|
57 |
<?php
|
76 |
$opt = apply_filters( 'frm_field_label_seen', $opt, $opt_key, $field );
|
77 |
$selected = FrmAppHelper::check_selected( $field['value'], $field_val );
|
78 |
if ( $other_opt === false ) {
|
79 |
+
$other_args = FrmFieldsHelper::prepare_other_input( compact( 'field', 'field_name', 'opt_key' ), $other_opt, $selected );
|
80 |
+
if ( FrmFieldsHelper::is_other_opt( $opt_key ) && $selected ) {
|
81 |
$other_checked = true;
|
82 |
}
|
83 |
}
|
84 |
?>
|
85 |
+
<option value="<?php echo esc_attr($field_val) ?>" <?php echo $selected ? ' selected="selected"' : ''; ?><?php echo ( FrmFieldsHelper::is_other_opt( $opt_key ) ) ? ' class="frm_other_trigger"' : '';?>><?php echo ($opt == '') ? ' ' : $opt; ?></option>
|
86 |
<?php
|
87 |
} ?>
|
88 |
</select>
|
89 |
<?php
|
90 |
+
FrmFieldsHelper::include_other_input( array(
|
91 |
+
'other_opt' => $other_opt, 'read_only' => $read_only,
|
92 |
+
'checked' => $other_checked, 'name' => $other_args['name'],
|
93 |
+
'value' => $other_args['value'], 'field' => $field,
|
94 |
+
) );
|
95 |
}
|
96 |
} else if ( $field['type'] == 'checkbox' ) {
|
97 |
$checked_values = $field['value'];
|
124 |
|
125 |
// Check if other opt, and get values for other field if needed
|
126 |
$other_opt = false;
|
127 |
+
$other_args = FrmFieldsHelper::prepare_other_input( compact( 'field', 'field_name', 'opt_key' ), $other_opt, $checked );
|
128 |
|
129 |
?>
|
130 |
<div class="<?php echo esc_attr( apply_filters( 'frm_checkbox_class', 'frm_checkbox', $field, $field_val ) ) ?>" id="frm_checkbox_<?php echo esc_attr( $field['id'] ) ?>-<?php echo esc_attr( $opt_key ) ?>"><?php
|
139 |
echo ' '. $opt .'</label>';
|
140 |
}
|
141 |
|
142 |
+
FrmFieldsHelper::include_other_input( array(
|
143 |
+
'other_opt' => $other_opt, 'read_only' => $read_only,
|
144 |
+
'checked' => $checked, 'name' => $other_args['name'],
|
145 |
+
'value' => $other_args['value'], 'field' => $field,
|
146 |
+
) );
|
147 |
|
148 |
unset( $other_opt, $other_args, $checked );
|
149 |
|
classes/views/frm-fields/radio.php
CHANGED
@@ -8,11 +8,11 @@ foreach ( $field['options'] as $opt_key => $opt ) {
|
|
8 |
$opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field);
|
9 |
|
10 |
// Get string for Other text field, if needed
|
11 |
-
|
12 |
|
13 |
$checked = ( $other_val || isset($field['value']) && (( ! is_array($field['value']) && $field['value'] == $field_val ) || (is_array($field['value']) && in_array($field_val, $field['value']) ) ) ) ? ' checked="checked"':'';
|
14 |
|
15 |
-
|
16 |
include(FrmAppHelper::plugin_path() .'/pro/classes/views/frmpro-fields/other-option.php');
|
17 |
} else {
|
18 |
include(FrmAppHelper::plugin_path() .'/classes/views/frm-fields/single-option.php');
|
8 |
$opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field);
|
9 |
|
10 |
// Get string for Other text field, if needed
|
11 |
+
$other_val = FrmFieldsHelper::get_other_val( compact( 'opt_key', 'field' ) );
|
12 |
|
13 |
$checked = ( $other_val || isset($field['value']) && (( ! is_array($field['value']) && $field['value'] == $field_val ) || (is_array($field['value']) && in_array($field_val, $field['value']) ) ) ) ? ' checked="checked"':'';
|
14 |
|
15 |
+
if ( FrmFieldsHelper::is_other_opt( $opt_key ) ) {
|
16 |
include(FrmAppHelper::plugin_path() .'/pro/classes/views/frmpro-fields/other-option.php');
|
17 |
} else {
|
18 |
include(FrmAppHelper::plugin_path() .'/classes/views/frm-fields/single-option.php');
|
classes/views/frm-fields/show-build.php
CHANGED
@@ -28,7 +28,7 @@
|
|
28 |
<?php foreach ( $field['options'] as $opt_key => $opt ) {
|
29 |
$field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field);
|
30 |
$opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field);
|
31 |
-
|
32 |
<option value="<?php echo esc_attr( $field_val ) ?>"<?php echo $selected ?>><?php echo esc_html( $opt ) ?> </option>
|
33 |
<?php } ?>
|
34 |
</select>
|
@@ -36,7 +36,7 @@
|
|
36 |
|
37 |
if ( $display['default_blank'] ) { ?>
|
38 |
<span id="frm_clear_on_focus_<?php echo esc_attr( $field['id'] ) ?>" class="frm_clear_on_focus frm-show-click">
|
39 |
-
|
40 |
</span>
|
41 |
<?php } ?>
|
42 |
<div class="clear"></div>
|
28 |
<?php foreach ( $field['options'] as $opt_key => $opt ) {
|
29 |
$field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field);
|
30 |
$opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field);
|
31 |
+
$selected = ( $field['default_value'] == $field_val || FrmFieldsHelper::get_other_val( array( 'opt_key', 'field' ) ) ) ? ' selected="selected"' : ''; ?>
|
32 |
<option value="<?php echo esc_attr( $field_val ) ?>"<?php echo $selected ?>><?php echo esc_html( $opt ) ?> </option>
|
33 |
<?php } ?>
|
34 |
</select>
|
36 |
|
37 |
if ( $display['default_blank'] ) { ?>
|
38 |
<span id="frm_clear_on_focus_<?php echo esc_attr( $field['id'] ) ?>" class="frm_clear_on_focus frm-show-click">
|
39 |
+
<?php FrmFieldsHelper::show_default_blank_js( $field['default_blank'] ); ?>
|
40 |
</span>
|
41 |
<?php } ?>
|
42 |
<div class="clear"></div>
|
classes/views/frm-form-actions/form_action.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<?php
|
2 |
-
$a =
|
3 |
|
4 |
$form_action = apply_filters('frm_form_action_settings', $form_action, $form_action->post_excerpt);
|
5 |
$form_action = apply_filters('frm_form_'. $form_action->post_excerpt .'_action_settings', $form_action);
|
1 |
<?php
|
2 |
+
$a = FrmAppHelper::simple_get( 't', 'sanitize_title', 'advanced_settings' );
|
3 |
|
4 |
$form_action = apply_filters('frm_form_action_settings', $form_action, $form_action->post_excerpt);
|
5 |
$form_action = apply_filters('frm_form_'. $form_action->post_excerpt .'_action_settings', $form_action);
|
classes/views/frm-forms/add_field.php
CHANGED
@@ -54,7 +54,7 @@ if ( $field['type'] == 'divider' ) { ?>
|
|
54 |
<?php do_action('frm_extra_field_actions', $field['id']); ?>
|
55 |
<?php if ( $display['required'] ) { ?>
|
56 |
<span id="require_field_<?php echo esc_attr( $field['id'] ); ?>">
|
57 |
-
|
58 |
</span>
|
59 |
<?php }
|
60 |
|
@@ -71,10 +71,10 @@ if ( $display['clear_on_focus'] ) { ?>
|
|
71 |
<span id="frm_clear_on_focus_<?php echo esc_attr( $field['id'] ) ?>" class="frm-show-click"><?php
|
72 |
|
73 |
if ( $display['default_blank'] ) {
|
74 |
-
|
75 |
}
|
76 |
|
77 |
-
|
78 |
?>
|
79 |
</span>
|
80 |
<?php
|
@@ -104,10 +104,10 @@ if ( $display['conf_field'] ) { ?>
|
|
104 |
<span id="frm_clear_on_focus_<?php echo esc_attr( $field['id'] ) ?>_conf" class="frm-show-click">
|
105 |
<?php
|
106 |
if ( $display['default_blank'] ) {
|
107 |
-
|
108 |
}
|
109 |
|
110 |
-
|
111 |
?>
|
112 |
</span>
|
113 |
</div>
|
54 |
<?php do_action('frm_extra_field_actions', $field['id']); ?>
|
55 |
<?php if ( $display['required'] ) { ?>
|
56 |
<span id="require_field_<?php echo esc_attr( $field['id'] ); ?>">
|
57 |
+
<a href="javascript:void(0);" class="frm_req_field frm_action_icon frm_required_icon frm_icon_font alignleft frm_required<?php echo (int) $field['required'] ?>" id="req_field_<?php echo esc_attr( $field['id'] ); ?>" title="Click to Mark as <?php echo FrmFieldsHelper::is_required_field( $field ) ? 'not ' : ''; ?>Required"></a>
|
58 |
</span>
|
59 |
<?php }
|
60 |
|
71 |
<span id="frm_clear_on_focus_<?php echo esc_attr( $field['id'] ) ?>" class="frm-show-click"><?php
|
72 |
|
73 |
if ( $display['default_blank'] ) {
|
74 |
+
FrmFieldsHelper::show_default_blank_js( $field['default_blank'] );
|
75 |
}
|
76 |
|
77 |
+
FrmFieldsHelper::show_onfocus_js( $field['clear_on_focus'] );
|
78 |
?>
|
79 |
</span>
|
80 |
<?php
|
104 |
<span id="frm_clear_on_focus_<?php echo esc_attr( $field['id'] ) ?>_conf" class="frm-show-click">
|
105 |
<?php
|
106 |
if ( $display['default_blank'] ) {
|
107 |
+
FrmFieldsHelper::show_default_blank_js( $field['default_blank'] );
|
108 |
}
|
109 |
|
110 |
+
FrmFieldsHelper::show_onfocus_js( $field['clear_on_focus'] );
|
111 |
?>
|
112 |
</span>
|
113 |
</div>
|
classes/views/frm-forms/form.php
CHANGED
@@ -10,7 +10,7 @@
|
|
10 |
<strong><?php _e( 'Form Key:', 'formidable' ) ?></strong>
|
11 |
<div id="editable-post-name" class="frm_ipe_form_key" title="<?php esc_attr_e( 'Click to edit.', 'formidable' ) ?>"><?php echo esc_html( $form->form_key ); ?></div>
|
12 |
</div>
|
13 |
-
|
14 |
<div class="frm_clear"></div>
|
15 |
</div>
|
16 |
</div>
|
10 |
<strong><?php _e( 'Form Key:', 'formidable' ) ?></strong>
|
11 |
<div id="editable-post-name" class="frm_ipe_form_key" title="<?php esc_attr_e( 'Click to edit.', 'formidable' ) ?>"><?php echo esc_html( $form->form_key ); ?></div>
|
12 |
</div>
|
13 |
+
<div id="frm_form_desc" class="frm_ipe_form_desc alignleft"><?php echo ( $form->description == '' ) ? esc_html__( '(Click to add description)', 'formidable' ) : wp_kses_post( force_balance_tags( $form->description ) ); ?></div>
|
14 |
<div class="frm_clear"></div>
|
15 |
</div>
|
16 |
</div>
|
classes/views/frm-forms/list.php
CHANGED
@@ -15,7 +15,7 @@ $wp_list_table->views();
|
|
15 |
?>
|
16 |
|
17 |
<form id="posts-filter" method="get">
|
18 |
-
<input type="hidden" name="page" value="<?php echo esc_attr(
|
19 |
<input type="hidden" name="frm_action" value="list" />
|
20 |
<?php
|
21 |
|
15 |
?>
|
16 |
|
17 |
<form id="posts-filter" method="get">
|
18 |
+
<input type="hidden" name="page" value="<?php echo esc_attr( FrmAppHelper::simple_get( 'page', 'sanitize_title' ) ) ?>" />
|
19 |
<input type="hidden" name="frm_action" value="list" />
|
20 |
<?php
|
21 |
|
classes/views/frm-forms/settings.php
CHANGED
@@ -21,14 +21,14 @@
|
|
21 |
<input type="hidden" name="frm_action" value="update_settings" />
|
22 |
|
23 |
<div class="meta-box-sortables">
|
24 |
-
<div class="categorydiv postbox">
|
25 |
<h3 class="hndle"><span><?php echo __( 'Form Settings', 'formidable' ) ?></span></h3>
|
26 |
<div class="inside frm-help-tabs">
|
27 |
<div id="contextual-help-back"></div>
|
28 |
<div id="contextual-help-columns">
|
29 |
<div class="contextual-help-tabs">
|
30 |
<ul class="frm-category-tabs frm-form-setting-tabs">
|
31 |
-
|
32 |
<li <?php echo ($a == 'advanced_settings') ? 'class="tabs active"' : '' ?>><a href="#advanced_settings"><?php _e( 'General', 'formidable' ) ?></a></li>
|
33 |
<li <?php echo ($a == 'email_settings') ? 'class="tabs active"' : '' ?>><a href="#email_settings"><?php _e( 'Form Actions', 'formidable' ); ?></a></li>
|
34 |
<li <?php echo ($a == 'html_settings') ? 'class="tabs active"' : '' ?>><a href="#html_settings"><?php _e( 'Customize HTML', 'formidable' ) ?></a></li>
|
21 |
<input type="hidden" name="frm_action" value="update_settings" />
|
22 |
|
23 |
<div class="meta-box-sortables">
|
24 |
+
<div class="categorydiv postbox" id="frm-categorydiv">
|
25 |
<h3 class="hndle"><span><?php echo __( 'Form Settings', 'formidable' ) ?></span></h3>
|
26 |
<div class="inside frm-help-tabs">
|
27 |
<div id="contextual-help-back"></div>
|
28 |
<div id="contextual-help-columns">
|
29 |
<div class="contextual-help-tabs">
|
30 |
<ul class="frm-category-tabs frm-form-setting-tabs">
|
31 |
+
<?php $a = FrmAppHelper::simple_get( 't', 'sanitize_title', 'advanced_settings' ); ?>
|
32 |
<li <?php echo ($a == 'advanced_settings') ? 'class="tabs active"' : '' ?>><a href="#advanced_settings"><?php _e( 'General', 'formidable' ) ?></a></li>
|
33 |
<li <?php echo ($a == 'email_settings') ? 'class="tabs active"' : '' ?>><a href="#email_settings"><?php _e( 'Form Actions', 'formidable' ); ?></a></li>
|
34 |
<li <?php echo ($a == 'html_settings') ? 'class="tabs active"' : '' ?>><a href="#html_settings"><?php _e( 'Customize HTML', 'formidable' ) ?></a></li>
|
classes/views/frm-settings/form.php
CHANGED
@@ -7,14 +7,14 @@
|
|
7 |
<div id="poststuff" class="metabox-holder">
|
8 |
<div id="post-body">
|
9 |
<div class="meta-box-sortables">
|
10 |
-
<div class="categorydiv postbox">
|
11 |
<h3 class="hndle"><span><?php _e( 'Global Settings', 'formidable' ) ?></span></h3>
|
12 |
<div class="inside frm-help-tabs">
|
13 |
<div id="contextual-help-back"></div>
|
14 |
<div id="contextual-help-columns">
|
15 |
<div class="contextual-help-tabs">
|
16 |
<ul class="frm-category-tabs">
|
17 |
-
|
18 |
<li <?php echo ($a == 'general_settings') ? 'class="tabs active"' : '' ?>><a href="#general_settings" class="frm_cursor_pointer"><?php _e( 'General', 'formidable' ) ?></a></li>
|
19 |
<?php foreach ( $sections as $sec_name => $section ) { ?>
|
20 |
<li <?php echo ($a == $sec_name .'_settings') ? 'class="tabs active"' : '' ?>><a href="#<?php echo esc_attr( $sec_name ) ?>_settings"><?php echo isset($section['name']) ? $section['name'] : ucfirst($sec_name) ?></a></li>
|
@@ -24,7 +24,7 @@
|
|
24 |
|
25 |
<?php do_action('frm_before_settings'); ?>
|
26 |
|
27 |
-
|
28 |
<input type="hidden" name="frm_action" value="process-form" />
|
29 |
<input type="hidden" name="action" value="process-form" />
|
30 |
<?php wp_nonce_field('process_form_nonce', 'process_form'); ?>
|
7 |
<div id="poststuff" class="metabox-holder">
|
8 |
<div id="post-body">
|
9 |
<div class="meta-box-sortables">
|
10 |
+
<div class="categorydiv postbox" id="frm-categorydiv">
|
11 |
<h3 class="hndle"><span><?php _e( 'Global Settings', 'formidable' ) ?></span></h3>
|
12 |
<div class="inside frm-help-tabs">
|
13 |
<div id="contextual-help-back"></div>
|
14 |
<div id="contextual-help-columns">
|
15 |
<div class="contextual-help-tabs">
|
16 |
<ul class="frm-category-tabs">
|
17 |
+
<?php $a = FrmAppHelper::simple_get( 't', 'sanitize_title', 'general_settings' ); ?>
|
18 |
<li <?php echo ($a == 'general_settings') ? 'class="tabs active"' : '' ?>><a href="#general_settings" class="frm_cursor_pointer"><?php _e( 'General', 'formidable' ) ?></a></li>
|
19 |
<?php foreach ( $sections as $sec_name => $section ) { ?>
|
20 |
<li <?php echo ($a == $sec_name .'_settings') ? 'class="tabs active"' : '' ?>><a href="#<?php echo esc_attr( $sec_name ) ?>_settings"><?php echo isset($section['name']) ? $section['name'] : ucfirst($sec_name) ?></a></li>
|
24 |
|
25 |
<?php do_action('frm_before_settings'); ?>
|
26 |
|
27 |
+
<form name="frm_settings_form" method="post" class="frm_settings_form" action="?page=formidable-settings<?php echo ( $a ? '&t=' . $a : '' ); ?>">
|
28 |
<input type="hidden" name="frm_action" value="process-form" />
|
29 |
<input type="hidden" name="action" value="process-form" />
|
30 |
<?php wp_nonce_field('process_form_nonce', 'process_form'); ?>
|
classes/views/shared/mb_adv_info.php
CHANGED
@@ -67,34 +67,6 @@
|
|
67 |
<ul class="frm_code_list">
|
68 |
<?php
|
69 |
$col = 'one';
|
70 |
-
$entry_shortcodes = array(
|
71 |
-
'id' => __( 'Entry ID', 'formidable' ),
|
72 |
-
'key' => __( 'Entry Key', 'formidable' ),
|
73 |
-
'post_id' => __( 'Post ID', 'formidable' ),
|
74 |
-
'ip' => __( 'User IP', 'formidable' ),
|
75 |
-
'created-at' => __( 'Entry created', 'formidable' ),
|
76 |
-
'updated-at' => __( 'Entry updated', 'formidable' ),
|
77 |
-
'' => '',
|
78 |
-
'siteurl' => __( 'Site URL', 'formidable' ),
|
79 |
-
'sitename' => __( 'Site Name', 'formidable' ),
|
80 |
-
);
|
81 |
-
|
82 |
-
if ( ! FrmAppHelper::pro_is_installed() ) {
|
83 |
-
unset($entry_shortcodes['post_id']);
|
84 |
-
}
|
85 |
-
|
86 |
-
if ( $settings_tab ) {
|
87 |
-
$entry_shortcodes['default-message'] = __( 'Default Msg', 'formidable' );
|
88 |
-
$entry_shortcodes['default-html'] = __( 'Default HTML', 'formidable' );
|
89 |
-
$entry_shortcodes['default-plain'] = __( 'Default Plain', 'formidable' );
|
90 |
-
} else {
|
91 |
-
$entry_shortcodes['detaillink'] = __( 'Detail Link', 'formidable' );
|
92 |
-
$entry_shortcodes['editlink location="front" label="Edit" page_id=x'] = __( 'Edit Entry Link', 'formidable' );
|
93 |
-
$entry_shortcodes['evenodd'] = __( 'Even/Odd', 'formidable' );
|
94 |
-
$entry_shortcodes['entry_count'] = __( 'Entry Count', 'formidable' );
|
95 |
-
}
|
96 |
-
|
97 |
-
|
98 |
foreach ( $entry_shortcodes as $skey => $sname ) {
|
99 |
if ( empty( $skey ) ) {
|
100 |
$col = 'one';
|
67 |
<ul class="frm_code_list">
|
68 |
<?php
|
69 |
$col = 'one';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
foreach ( $entry_shortcodes as $skey => $sname ) {
|
71 |
if ( empty( $skey ) ) {
|
72 |
$col = 'one';
|
css/_single_theme.css.php
CHANGED
@@ -11,8 +11,9 @@ if ( isset($_GET['frm_style_setting']) || isset($_GET['flat']) ) {
|
|
11 |
$auto_width = isset($auto_width) ? $auto_width : 0;
|
12 |
$submit_style = isset($submit_style) ? $submit_style : 0;
|
13 |
|
14 |
-
|
15 |
-
|
|
|
16 |
} else {
|
17 |
$style_class = 'with_frm_style';
|
18 |
}
|
11 |
$auto_width = isset($auto_width) ? $auto_width : 0;
|
12 |
$submit_style = isset($submit_style) ? $submit_style : 0;
|
13 |
|
14 |
+
$style_name = FrmAppHelper::simple_get( 'style_name', 'sanitize_title' );
|
15 |
+
if ( ! empty( $style_name ) ) {
|
16 |
+
$style_class = $style_name . '.with_frm_style';
|
17 |
} else {
|
18 |
$style_class = 'with_frm_style';
|
19 |
}
|
formidable.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/*
|
3 |
Plugin Name: Formidable
|
4 |
Description: Quickly and easily create drag-and-drop forms
|
5 |
-
Version: 2.0.
|
6 |
Plugin URI: http://formidablepro.com/
|
7 |
Author URI: http://strategy11.com
|
8 |
Author: Strategy11
|
@@ -28,21 +28,21 @@ $frm_vars = array(
|
|
28 |
'pro_is_authorized' => false,
|
29 |
);
|
30 |
|
31 |
-
function frm_forms_autoloader($class_name) {
|
32 |
// Only load Frm classes here
|
33 |
-
|
34 |
return;
|
35 |
}
|
36 |
|
37 |
$filepath = dirname(__FILE__);
|
38 |
-
|
39 |
$filepath .= '/pro';
|
40 |
}
|
41 |
$filepath .= '/classes';
|
42 |
|
43 |
-
|
44 |
$filepath .= '/helpers/';
|
45 |
-
|
46 |
$filepath .= '/controllers/';
|
47 |
} else {
|
48 |
$filepath .= '/models/';
|
2 |
/*
|
3 |
Plugin Name: Formidable
|
4 |
Description: Quickly and easily create drag-and-drop forms
|
5 |
+
Version: 2.0.06
|
6 |
Plugin URI: http://formidablepro.com/
|
7 |
Author URI: http://strategy11.com
|
8 |
Author: Strategy11
|
28 |
'pro_is_authorized' => false,
|
29 |
);
|
30 |
|
31 |
+
function frm_forms_autoloader( $class_name ) {
|
32 |
// Only load Frm classes here
|
33 |
+
if ( ! preg_match( '/^Frm.+$/', $class_name ) ) {
|
34 |
return;
|
35 |
}
|
36 |
|
37 |
$filepath = dirname(__FILE__);
|
38 |
+
if ( preg_match( '/^FrmPro.+$/', $class_name ) || 'FrmUpdatesController' == $class_name ) {
|
39 |
$filepath .= '/pro';
|
40 |
}
|
41 |
$filepath .= '/classes';
|
42 |
|
43 |
+
if ( preg_match( '/^.+Helper$/', $class_name ) ) {
|
44 |
$filepath .= '/helpers/';
|
45 |
+
} else if ( preg_match( '/^.+Controller$/', $class_name ) ) {
|
46 |
$filepath .= '/controllers/';
|
47 |
} else {
|
48 |
$filepath .= '/models/';
|
js/formidable.min.js
CHANGED
@@ -1,54 +1,54 @@
|
|
1 |
-
function frmFrontFormJS(){function g(b){var a=jQuery(this),c=a.attr("type");"submit"
|
2 |
-
jQuery(this).toggleClass("active").children(".ui-icon-triangle-1-e, .ui-icon-triangle-1-s").toggleClass("ui-icon-triangle-1-s ui-icon-triangle-1-e")}function
|
3 |
-
d[e].className&&d[e].selected){a=!0;break}c?(b=jQuery(this).parent().children(".frm_other_input"),a?b[0].className=b[0].className.replace("frm_pos_none",""):(1>b[0].className.indexOf("frm_pos_none")&&(b[0].className+=" frm_pos_none"),b[0].value="")):"radio"
|
4 |
-
b&&(this.checked?jQuery(this).closest(".frm_checkbox").children(".frm_other_input").removeClass("frm_pos_none"):jQuery(this).closest(".frm_checkbox").children(".frm_other_input").addClass("frm_pos_none").val(""))}function z(b){var a;a=this.name.replace("item_meta[","").split("]");var c=a[0],d=!1;jQuery('input[name="item_meta['+c+'][form]"]').length&&(c=a[2].replace("[",""),d=!0);"other"
|
5 |
-
d,e){if("undefined"
|
6 |
-
typeof
|
7 |
-
"_container"),a.containerID=
|
8 |
-
(a.hideBy=".");if(a.FieldName
|
9 |
-
c.length)){c.each(function(){u(b,a,a.FieldName,d,e,jQuery(this))});return}d=""}c=[];if("checkbox"==a.Type||"data-checkbox"==a.Type)c=
|
10 |
-
!1===c&&(
|
11 |
-
jQuery.isArray(d)?(v(a.hideContainerID,a.hideBy),
|
12 |
-
a.MatchType||!1===
|
13 |
-
c){if("undefined"!=typeof c&&"undefined"!=typeof c.result){var d=jQuery(c.hideBy+c.hideContainerID),e=c.show;if(d.length){if("any"==c.match&&-1==jQuery.inArray(!0,
|
14 |
-
(a=parseFloat(a),c=parseFloat(c));return"-1"!=String(a).indexOf(""")&&y(b,a.replace(""",'"'),c)?!0:{"==":function(a,b){return a==b},"!=":function(a,b){return a!=b},"<":function(a,b){return a>b},">":function(a,b){return a<b},LIKE:function(a,b){return b?-1!=b.indexOf(a):0},"not LIKE":function(a,b){return b?-1==b.indexOf(a):1}}[b](a,c)}function
|
15 |
-
e=jQuery(d).find(".frm_data_field_container");if(0===e.length)return!0;c||e.html('<span class="frm-loading-img"></span>');jQuery.ajax({type:"POST",url:frm_js.ajax_url,data:{action:"frm_fields_ajax_get_data",entry_id:a,field_id:b.LinkedField,current_field:b.HideField,hide_id:b.hideContainerID,nonce:frm_js.nonce},success:function(f){""!==f&&(d.style.display="");if(c)e.append(f);else{e.html(f);var h=e.children("input"),
|
16 |
-
function
|
17 |
-
|
18 |
-
hide_field:c,entry_id:a,selected_field_id:b.LinkedField,field_id:b.HideField,hide_id:b.hideContainerID,nonce:frm_js.nonce},success:function(a){""===a?(h.style.display="none",f=""):"all"!=b.MatchType&&(h.style.display="");
|
19 |
-
"checked");else if("select"==
|
20 |
-
c.calc[d[h]],l
|
21 |
-
e[
|
22 |
-
b);null!==h&&(e[a]=Math.ceil(h/864E5))}""!==b&&0!==b&&(b=parseFloat(b.replace(/,/g,"").match(/-?[\d\.]+$/)));if("undefined"===typeof b||isNaN(b))b=0;e[a]+=b});return e[a]}function
|
23 |
-
|
24 |
-
a.closest(".frm_form_field").replaceWith('<input type="hidden" name="recaptcha_checked" value="'+frm_js.nonce+'">');b.submit()}else if("object"!=typeof a){jQuery(b).find(".frm_ajax_loading").removeClass("frm_loading_now");
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
jQuery(document).on("change",
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
c.
|
47 |
-
|
48 |
-
function frmEditEntry(g,
|
49 |
-
g+'"><a onclick="frmCancelEdit('+g+",'"+
|
50 |
-
function frmCancelEdit(g,
|
51 |
-
function frmUpdateField(g,
|
52 |
-
function frmDeleteEntry(g,
|
53 |
function frmOnSubmit(g){console.warn("DEPRECATED: function frmOnSubmit in v2.0 use frmFrontForm.submitForm");frmFrontForm.submitForm(g,this)}
|
54 |
-
function frm_resend_email(g,
|
1 |
+
function frmFrontFormJS(){function g(b){var a=jQuery(this),c=a.attr("type");"submit"!==c&&b.preventDefault();b=a.parents("form:first");var d=a="",e=this.name;if("frm_prev_page"===e||-1!==this.className.indexOf("frm_prev_page"))a=jQuery(b).find(".frm_next_page").attr("id").replace("frm_next_p_","");else if("frm_save_draft"===e||-1!==this.className.indexOf("frm_save_draft"))d=1;jQuery(".frm_next_page").val(a);jQuery(".frm_saving_draft").val(d);"submit"!==c&&b.trigger("submit")}function n(){jQuery(this).parent().children(".frm_toggle_container").slideToggle("fast");
|
2 |
+
jQuery(this).toggleClass("active").children(".ui-icon-triangle-1-e, .ui-icon-triangle-1-s").toggleClass("ui-icon-triangle-1-s ui-icon-triangle-1-e")}function q(){this.className=this.className.replace("frm_transparent","");this.parentNode.getElementsByTagName("a")[0].className+=" frm_hidden"}function x(){var b=this.type,a=!1,c=!1;if("select-one"===b)c=!0,"frm_other_trigger"===this.options[this.selectedIndex].className&&(a=!0);else if("select-multiple"===b)for(var c=!0,d=this.options,a=!1,e=0;e<d.length;e++)if("frm_other_trigger"===
|
3 |
+
d[e].className&&d[e].selected){a=!0;break}c?(b=jQuery(this).parent().children(".frm_other_input"),a?b[0].className=b[0].className.replace("frm_pos_none",""):(1>b[0].className.indexOf("frm_pos_none")&&(b[0].className+=" frm_pos_none"),b[0].value="")):"radio"===b?jQuery(this).is(":checked")&&(jQuery(this).closest(".frm_radio").children(".frm_other_input").removeClass("frm_pos_none"),jQuery(this).closest(".frm_radio").siblings().children(".frm_other_input").addClass("frm_pos_none").val("")):"checkbox"===
|
4 |
+
b&&(this.checked?jQuery(this).closest(".frm_checkbox").children(".frm_other_input").removeClass("frm_pos_none"):jQuery(this).closest(".frm_checkbox").children(".frm_other_input").addClass("frm_pos_none").val(""))}function z(b){var a;a=this.name.replace("item_meta[","").split("]");var c=a[0],d=!1;jQuery('input[name="item_meta['+c+'][form]"]').length&&(c=a[2].replace("[",""),d=!0);"other"===c&&(c=d?a[3].replace("[",""):a[1].replace("[",""));if(a=c)p("und",a,null,jQuery(this)),C(b,a)}function p(b,a,
|
5 |
+
c,d,e){if("undefined"!==typeof __FRMRULES){var f=__FRMRULES[a];if("undefined"!==typeof f){if("undefined"===typeof c||null===c)c="go";"persist"!==e&&(m=[]);e=[];for(var h=0,k=f.length;h<k;h++){var l=f[h];if("undefined"!==typeof l)for(var r=0,g=l.Conditions.length;r<g;r++){var t=l.Conditions[r];t.HideField=l.Setting.FieldName;t.MatchType=l.MatchType;t.Show=l.Show;e.push(t)}}f=e.length;h=0;for(k=f;h<k;h++)e[h].FieldName===a?u(h,e[h],a,b,c,d):u(h,e[h],a,b,c),h===f-1&&D(c)}}}function u(b,a,c,d,e,f){"undefined"===
|
6 |
+
typeof m[a.HideField]&&(m[a.HideField]=[]);a.inputName="item_meta["+a.FieldName+"]";a.hiddenName="item_meta["+a.HideField+"]";a.containerID="frm_field_"+a.FieldName+"_container";a.hideContainerID="frm_field_"+a.HideField+"_container";a.hideBy="#";var h=!1;if("undefined"!==typeof f&&null!==f){1<f.length&&(f=f.eq(0));if("undefined"===typeof f.attr("name"))return;a.inputName=f.attr("name").replace("[other]","").replace("[]","");var k=f.closest(".frm_repeat_sec");k.length&&(k=k.find(".frm_field_"+a.FieldName+
|
7 |
+
"_container"),a.containerID=k.attr("id"),a.hideContainerID=a.containerID.replace(a.FieldName,a.HideField),a.hiddenName=a.inputName.replace("["+a.FieldName+"]","["+a.HideField+"]"))}else{h=!0;f=jQuery('input[name^="'+a.inputName+'"], textarea[name^="'+a.inputName+'"], select[name^="'+a.inputName+'"]');if(1>f.length&&(f=jQuery("."+a.containerID+" input, ."+a.containerID+" textarea, ."+a.containerID+" select"),f.length)){u(b,a,c,d,e,f);return}1<f.length&&(f=f.eq(0))}null===document.getElementById(a.hideContainerID)&&
|
8 |
+
(a.hideBy=".");if(a.FieldName!==c||"undefined"===typeof d||"und"===d)if(("radio"===a.Type||"data-radio"===a.Type)&&"radio"===f.attr("type"))d=jQuery('input[name="'+a.inputName+'"]:checked').val(),"undefined"===typeof d&&(d="");else if("select"===a.Type||"time"===a.Type||"data-select"===a.Type||"checkbox"!==a.Type&&"data-checkbox"!==a.Type)d=f.val();"undefined"==typeof d&&(d=f.val());if("undefined"==typeof d){if(!0===h&&(c=jQuery("."+a.containerID+" input, ."+a.containerID+" select, ."+a.containerID+
|
9 |
+
" textarea"),c.length)){c.each(function(){u(b,a,a.FieldName,d,e,jQuery(this))});return}d=""}c=[];if("checkbox"==a.Type||"data-checkbox"==a.Type)c=N(a.containerID,a.inputName),d=c.length?c:"";m[a.HideField][b]=""===d||1>d.length?!1:{funcName:"getDataOpts",f:a,sel:d};if("checkbox"==a.Type||"data-checkbox"==a.Type&&"undefined"==typeof a.LinkedField)if(c=m[a.HideField][b]=!1,""!==d)for("!="==a.Condition&&(m[a.HideField][b]=!0),f=0;f<d.length;f++)c=y(a.Condition,a.Value,d[f]),"!="==a.Condition?!0===m[a.HideField][b]&&
|
10 |
+
!1===c&&(m[a.HideField][b]=!1):!1===m[a.HideField][b]&&c&&(m[a.HideField][b]=!0);else c=y(a.Condition,a.Value,""),!1===m[a.HideField][b]&&c&&(m[a.HideField][b]=!0);else if("undefined"!=typeof a.LinkedField&&0===a.Type.indexOf("data-")){if("undefined"==typeof a.DataType||"data"===a.DataType)""===d?v(a.hideContainerID,a.hideBy):"data-radio"==a.Type?m[a.HideField][b]="undefined"==typeof a.DataType?y(a.Condition,a.Value,d):{funcName:"getData",f:a,sel:d}:"data-checkbox"==a.Type||"data-select"==a.Type&&
|
11 |
+
jQuery.isArray(d)?(v(a.hideContainerID,a.hideBy),m[a.HideField][b]=!0,H(a,d,1)):"data-select"==a.Type&&(m[a.HideField][b]={funcName:"getData",f:a,sel:d})}else"undefined"==typeof a.Value&&0===a.Type.indexOf("data")?(a.Value=""===d?"1":d,m[a.HideField][b]=y(a.Condition,a.Value,d),a.Value=void 0):m[a.HideField][b]=y(a.Condition,a.Value,d);A(b,a,e)}function v(b,a){b="."===a?jQuery("."+b):jQuery(document.getElementById(b));b.fadeOut("slow");b.find(".frm_data_field_container").empty()}function A(b,a,c){if("all"==
|
12 |
+
a.MatchType||!1===m[a.HideField][b])E.push({result:m[a.HideField][b],show:a.Show,match:a.MatchType,fname:a.FieldName,fkey:a.HideField,hideContainerID:a.hideContainerID,hideBy:a.hideBy});else{var d="none";if("show"==a.Show){if(!0!==m[a.HideField][b]){I(m[a.HideField][b],a.FieldName,c);return}d=""}"."===a.hideBy?(b=jQuery("."+a.hideContainerID),b.length&&("none"===d?b.hide():b.show())):(b=document.getElementById(a.hideContainerID),null!==b&&(b.style.display=d))}}function D(b){jQuery.each(E,function(a,
|
13 |
+
c){if("undefined"!=typeof c&&"undefined"!=typeof c.result){var d=jQuery(c.hideBy+c.hideContainerID),e=c.show;if(d.length){if("any"==c.match&&-1==jQuery.inArray(!0,m[c.fkey])||"all"==c.match&&-1<jQuery.inArray(!1,m[c.fkey]))e="show"==c.show?"hide":"show";"show"==e?d.show():(d.filter(":hidden").hide(),d.hide());!1!==typeof c.result&&!0!==typeof c.result&&I(c.result,c.fname,b)}delete E[a]}})}function y(b,a,c){"undefined"==typeof c&&(c="");jQuery.isArray(c)&&-1<jQuery.inArray(a,c)&&(c=a);-1!=String(a).search(/^\s*(\+|-)?((\d+(\.\d+)?)|(\.\d+))\s*$/)&&
|
14 |
+
(a=parseFloat(a),c=parseFloat(c));return"-1"!=String(a).indexOf(""")&&y(b,a.replace(""",'"'),c)?!0:{"==":function(a,b){return a==b},"!=":function(a,b){return a!=b},"<":function(a,b){return a>b},">":function(a,b){return a<b},LIKE:function(a,b){return b?-1!=b.indexOf(a):0},"not LIKE":function(a,b){return b?-1==b.indexOf(a):1}}[b](a,c)}function I(b,a,c){"getDataOpts"==b.funcName?O(b.f,b.sel,a,c):"getData"==b.funcName&&H(b.f,b.sel,0)}function H(b,a,c){var d=document.getElementById(b.hideContainerID),
|
15 |
+
e=jQuery(d).find(".frm_data_field_container");if(0===e.length)return!0;c||e.html('<span class="frm-loading-img"></span>');jQuery.ajax({type:"POST",url:frm_js.ajax_url,data:{action:"frm_fields_ajax_get_data",entry_id:a,field_id:b.LinkedField,current_field:b.HideField,hide_id:b.hideContainerID,nonce:frm_js.nonce},success:function(f){""!==f&&(d.style.display="");if(c)e.append(f);else{e.html(f);var h=e.children("input"),k=h.val();if(""===f||""===k)d.style.display="none";p(a,b.HideField,null,h)}return!0}})}
|
16 |
+
function O(b,a,c,d){if(!("stop"==d&&-1<jQuery.inArray(b.HideField,F)&&"hidden"==b.parentField.attr("type"))){var e=jQuery('input[name^="'+b.hiddenName+'"], select[name^="'+b.hiddenName+'"]:not(":disabled"), textarea[name^="'+b.hiddenName+'"]'),f=[];e.each(function(){"radio"==this.type||"checkbox"==this.type?!0===this.checked&&f.push(jQuery(this).val()):f.push(jQuery(this).val())});if("select"!=b.DataType||"stop"!=d&&!jQuery("#"+b.hideContainerID+" .frm-loading-img").length||!(-1<jQuery.inArray(b.HideField,
|
17 |
+
F))){0===f.length&&(f="");F.push(b.HideField);var h=document.getElementById(b.hideContainerID),k=jQuery(h).find(".frm_data_field_container");if(0===k.length&&e.length)return p(f,b.HideField,"stop",e),!1;if(""!==b.Value&&!y(b.Condition,b.Value,a))return h.style.display="none",k.html(""),p("",b.HideField,"stop",e),!1;k.html('<span class="frm-loading-img" style="visibility:visible;display:inline;"></span>');var l=b.DataType;jQuery.ajax({type:"POST",url:frm_js.ajax_url,data:{action:"frm_fields_ajax_data_options",
|
18 |
+
hide_field:c,entry_id:a,selected_field_id:b.LinkedField,field_id:b.HideField,hide_id:b.hideContainerID,nonce:frm_js.nonce},success:function(a){""===a?(h.style.display="none",f=""):"all"!=b.MatchType&&(h.style.display="");k.html(a);var c=k.find("select, input, textarea");""!==a&&""!==f&&(jQuery.isArray(f)||(a=[],a.push(f),f=a),jQuery.each(f,function(a,b){if("undefined"!=typeof b&&""!==b)if("checkbox"==l||"radio"==l)1<c.length?c.filter('[value="'+b+'"]').attr("checked","checked"):c.val()==b&&c.attr("checked",
|
19 |
+
"checked");else if("select"==l){var d=c.children('option[value="'+b+'"]');d.length?d.prop("selected",!0):f.splice(a,1)}else c.val(b)}));c.hasClass("frm_chzn")&&jQuery().chosen&&jQuery(".frm_chzn").chosen({allow_single_deselect:!0});c.length?p(f,b.HideField,"stop",c):p(f,b.HideField,"stop")}})}}}function C(b,a){if("undefined"!=typeof __FRMCALC){var c=__FRMCALC,d=c.fields[a];if("undefined"!=typeof d){d=d.total;if(b.frmTriggered&&b.frmTriggered==a)return!1;for(var e=[],f=0,h=0,k=d.length;h<k;h++){for(var l=
|
20 |
+
c.calc[d[h]],r=l.calc,f=l.fields.length,g=0;g<f;g++){var t=l.fields[g],m=c.fields[t],n="input"+c.fieldKeys[t];"checkbox"==m.type||"select"==m.type?n=n+":checked,select"+c.fieldKeys[t]+" option:selected,"+n+"[type=hidden]":"radio"==m.type||"scale"==m.type?n=n+":checked,"+n+"[type=hidden]":"textarea"==m.type&&(n=n+",textarea"+c.fieldKeys[t]);e[t]=P(n,t,m,c,e);if("undefined"===typeof e[t]||isNaN(e[t]))e[t]=0;m="["+t+"]";m=m.replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1");r=r.replace(new RegExp(m,"g"),
|
21 |
+
e[t])}l=l.calc_dec;r.indexOf(").toFixed(")&&(g=r.split(").toFixed("),J(g[1])&&(l=g[1],r=r.replace(").toFixed("+l,"")));r=parseFloat(eval(r));J(l)&&(r=r.toFixed(l));"undefined"===typeof r&&(r=0);jQuery(document.getElementById("field_"+d[h])).val(r).trigger({type:"change",frmTriggered:d[h],selfTriggered:!0})}}}}function P(b,a,c,d,e){if("undefined"!==typeof e[a]&&0!==e[a])return e[a];jQuery(b).each(function(){"undefined"===typeof e[a]&&(e[a]=0);var b=jQuery(this).val();if("date"==c.type){var h=jQuery.datepicker.parseDate(d.date,
|
22 |
+
b);null!==h&&(e[a]=Math.ceil(h/864E5))}""!==b&&0!==b&&(b=parseFloat(b.replace(/,/g,"").match(/-?[\d\.]+$/)));if("undefined"===typeof b||isNaN(b))b=0;e[a]+=b});return e[a]}function K(b,a){jQuery(b).find('input[type="submit"], input[type="button"]').attr("disabled","disabled");jQuery(b).find(".frm_ajax_loading").addClass("frm_loading_now");"undefined"==typeof a&&jQuery(b).find('input[name="frm_action"]').val();jQuery.ajax({type:"POST",url:frm_js.ajax_url,data:jQuery(b).serialize()+"&action=frm_entries_"+
|
23 |
+
a+"&nonce="+frm_js.nonce,success:function(a){a=a.replace(/^\s+|\s+$/g,"");0===a.indexOf("{")&&(a=jQuery.parseJSON(a));if(""===a||!a||"0"===a||"object"!=typeof a&&0===a.indexOf("<!DOCTYPE")){var d=document.getElementById("frm_loading");null!==d&&(a=jQuery(b).find("input[type=file]").val(),"undefined"!=typeof a&&""!==a&&setTimeout(function(){jQuery(d).fadeIn("slow")},2E3));a=jQuery(b).find(".g-recaptcha");a.length&&(1>jQuery(b).find(".frm_next_page").length||1>jQuery(b).find(".frm_next_page").val())&&
|
24 |
+
a.closest(".frm_form_field").replaceWith('<input type="hidden" name="recaptcha_checked" value="'+frm_js.nonce+'">');b.submit()}else if("object"!=typeof a){jQuery(b).find(".frm_ajax_loading").removeClass("frm_loading_now");var e=jQuery(b).find('input[name="form_id"]').val();jQuery(b).closest("#frm_form_"+e+"_container").replaceWith(a);frmFrontForm.scrollMsg(e);if("function"==typeof frmThemeOverride_frmAfterSubmit){var e=jQuery('input[name="frm_page_order_'+e+'"]').val(),f=jQuery(a).find('input[name="form_id"]').val();
|
25 |
+
frmThemeOverride_frmAfterSubmit(f,e,a,b)}a=jQuery(b).find('input[name="id"]');a.length&&jQuery(document.getElementById("frm_edit_"+a.val())).find("a").addClass("frm_ajax_edited").click()}else{jQuery(b).find('input[type="submit"], input[type="button"]').removeAttr("disabled");jQuery(b).find(".frm_ajax_loading").removeClass("frm_loading_now");e=!0;jQuery(".form-field").removeClass("frm_blank_field");jQuery(".form-field .frm_error").replaceWith("");var f="",h=!1,k=null,l;for(l in a)if(k=jQuery(b).find(jQuery(document.getElementById("frm_field_"+
|
26 |
+
l+"_container"))),k.length&&k.is(":visible"))e=!1,""===f&&(frmFrontForm.scrollMsg(l,b,!0),f="#frm_field_"+l+"_container"),jQuery(b).find("#frm_field_"+l+"_container .g-recaptcha").length&&(h=!0,grecaptcha.reset()),k.addClass("frm_blank_field"),"function"==typeof frmThemeOverride_frmPlaceError?frmThemeOverride_frmPlaceError(l,a):k.append('<div class="frm_error">'+a[l]+"</div>");else if("redirect"==l){window.location=a[l];return}!0!==h&&jQuery(b).find(".g-recaptcha").closest(".frm_form_field").replaceWith('<input type="hidden" name="recaptcha_checked" value="'+
|
27 |
+
frm_js.nonce+'">');e&&b.submit()}},error:function(){jQuery(b).find('input[type="submit"], input[type="button"]').removeAttr("disabled");b.submit()}})}function Q(){L(jQuery(this),"clear")}function R(){L(jQuery(this),"replace")}function L(b,a){var c=b.data("frmval").replace(/(\n|\r\n)/g,"\r");if(""===c||"undefined"==typeof c)return!1;var d=b.val().replace(/(\n|\r\n)/g,"\r");"replace"==a?""===d&&b.addClass("frm_default").val(c):d==c&&b.removeClass("frm_default").val("")}function S(){var b=jQuery(this),
|
28 |
+
a=b.data("eid"),c=b.data("fid");b.append('<span class="spinner" style="display:inline"></span>');jQuery.ajax({type:"POST",url:frm_js.ajax_url,data:{action:"frm_entries_send_email",entry_id:a,form_id:c,nonce:frm_js.nonce},success:function(a){b.replaceWith(a)}});return!1}function M(b){var a="string";if("number"==b.type)a="number";else if("checkbox"==b.type||"select"==b.type){var c=b.options.length;"select"==b.type&&""===b.options[0]&&(c="post_status"==b.field_options.post_field?3:c-1);1==c&&(a="boolean")}return a}
|
29 |
+
function T(){var b=jQuery(this),a=b.data("fid");b.wrap('<div class="frm_file_names frm_uploaded_files">');for(var c=b.get(0).files,d=0;d<c.length;d++)1==c.length?b.after(c[d].name+' <a href="#" class="frm_clear_file_link">'+frm_js.remove+"</a>"):b.after(c[d].name+"<br/>");b.hide();c=b.attr("name");c!="item_meta["+a+"][]"&&c.replace("item_meta[","").replace("[]","").split("][");b.closest(".frm_form_field").find(".frm_uploaded_files:last").after('<input name="'+c+'" data-fid="'+a+'"class="frm_transparent frm_multiple_file" multiple="multiple" type="file" />')}
|
30 |
+
function U(){V(jQuery(this).parent(".frm_uploaded_files"))}function W(){jQuery(this).parent(".frm_file_names").replaceWith("");return!1}function X(){var b="frm_section_"+jQuery(this).data("parent")+"-"+jQuery(this).data("key"),a=jQuery(document.getElementById(b)),c=a.find("input, select, textarea");a.fadeOut("slow",function(){a.remove();c.each(function(){if("file"!=this.type){var a=this.name.replace("item_meta[","").split("]")[2].replace("[","");C("",a)}})});return!1}function Y(){var b=jQuery(this).data("parent"),
|
31 |
+
a=0;0<jQuery(".frm_repeat_"+b).length&&(a=1+parseInt(jQuery(".frm_repeat_"+b+":last").attr("id").replace("frm_section_"+b+"-","")),"undefined"==typeof a&&(a=1));jQuery.ajax({type:"POST",url:frm_js.ajax_url,dataType:"json",data:{action:"frm_add_form_row",field_id:b,i:a,nonce:frm_js.nonce},success:function(a){var d=a.html,e=jQuery(d).hide().fadeIn("slow");jQuery(".frm_repeat_"+b+":last").after(e);var f=["other"],h,k="reset";jQuery(d).find("input, select, textarea").each(function(){"file"!=this.type&&
|
32 |
+
(h=this.name.replace("item_meta[","").split("]")[2].replace("[",""),-1==jQuery.inArray(h,f)&&(f.push(h),p("und",h,null,jQuery(this),k),C("",h),k="persist"))});for(var e=0,l=a.logic.check.length;e<l;e++)-1==jQuery.inArray(a.logic.check[e],f)&&1>jQuery(d).find(".frm_field_"+a.logic.check[e]+"_container").length&&(p("und",a.logic.check[e],null,null,k),k="persist");0<jQuery(d).find(".star").length&&jQuery(".star").rating();0<jQuery(d).find(".frm_chzn").length&&jQuery().chosen&&jQuery(".frm_chzn").chosen({allow_single_deselect:!0});
|
33 |
+
"function"==typeof frmThemeOverride_frmAddRow&&frmThemeOverride_frmAddRow(b,a)}});return!1}function V(b){b.fadeOut("slow",function(){b.remove()})}function Z(){var b=jQuery(this).data("frmtoggle");jQuery(b).is(":visible")?jQuery(b).slideUp("fast"):jQuery(b).slideDown("fast");return!1}function J(b){return!jQuery.isArray(b)&&0<=b-parseFloat(b)+1}function N(b,a){var c=[];if("undefined"==typeof document.querySelector)jQuery("#"+b+' input[type=checkbox]:checked, input[type=hidden][name^="'+a+'"]').each(function(){c.push(this.value)});
|
34 |
+
else for(var d=document.querySelectorAll("#"+b+' input[type=checkbox], input[type=hidden][name^="'+a+'"]'),e=0;e<d.length;e++)("checkbox"==d[e].type&&d[e].checked||"hidden"==d[e].type)&&c.push(d[e].value);return c}var m=[],E=[],F=[],G="",B=[];return{init:function(){jQuery(document).on("click",".frm_trigger",n);var b=jQuery(".frm_blank_field");b.length&&b.closest(".frm_toggle_container").prev(".frm_trigger").click();jQuery.isFunction(jQuery.fn.placeholder)?jQuery(".frm-show-form input, .frm-show-form textarea").placeholder():
|
35 |
+
jQuery(".frm-show-form input[onblur], .frm-show-form textarea[onblur]").each(function(){""===jQuery(this).val()&&jQuery(this).blur()});jQuery(document).on("focus",".frm_toggle_default",Q);jQuery(document).on("blur",".frm_toggle_default",R);jQuery(".frm_toggle_default").blur();jQuery(document.getElementById("frm_resend_email")).click(S);jQuery(document).on("change",".frm_multiple_file",T);jQuery(document).on("click",".frm_clear_file_link",W);jQuery(document).on("click",".frm_remove_link",U);jQuery(document).on("focusin",
|
36 |
+
"input[data-frmmask]",function(){jQuery(this).mask(jQuery(this).data("frmmask").toString())});jQuery(document).on("change",'.frm-show-form input[name^="item_meta"], .frm-show-form select[name^="item_meta"], .frm-show-form textarea[name^="item_meta"]',z);jQuery(document).on("click",'.frm-show-form input[type="submit"], .frm-show-form input[name="frm_prev_page"], .frm-show-form .frm_save_draft',g);jQuery(document).on("change",'.frm_other_container input[type="checkbox"], .frm_other_container input[type="radio"], .frm_other_container select',
|
37 |
+
x);jQuery(document).on("change","input[type=file].frm_transparent",q);jQuery(document).on("click",".frm_remove_form_row",X);jQuery(document).on("click",".frm_add_form_row",Y);jQuery("a[data-frmtoggle]").click(Z);jQuery(".frm_month_heading, .frm_year_heading").click(function(){var a=jQuery(this).children(".ui-icon-triangle-1-e, .ui-icon-triangle-1-s");a.hasClass("ui-icon-triangle-1-e")?(a.addClass("ui-icon-triangle-1-s").removeClass("ui-icon-triangle-1-e"),jQuery(this).next(".frm_toggle_container").fadeIn("slow")):
|
38 |
+
(a.addClass("ui-icon-triangle-1-e").removeClass("ui-icon-triangle-1-s"),jQuery(this).next(".frm_toggle_container").hide())})},submitForm:function(b){b.preventDefault();jQuery(this).find(".wp-editor-wrap").length&&"undefined"!=typeof tinyMCE&&tinyMCE.triggerSave();G=jQuery(this).find('input[name="frm_action"]').val();B=[];"function"==typeof frmThemeOverride_jsErrors&&(B=frmThemeOverride_jsErrors(G,this));if(0===B.length)K(this,G);else for(var a in B)$fieldCont=jQuery(this).find(jQuery(document.getElementById("frm_field_"+
|
39 |
+
a+"_container"))),$fieldCont.length&&$fieldCont.is(":visible")&&($fieldCont.addClass("frm_blank_field"),"function"==typeof frmThemeOverride_frmPlaceError?frmThemeOverride_frmPlaceError(a,errObj):$fieldCont.append('<div class="frm_error">'+errObj[a]+"</div>"))},checkFormErrors:function(b,a){K(b,a)},scrollToID:function(b){b=jQuery(document.getElementById(b).offset());window.scrollTo(b.left,b.top)},scrollMsg:function(b,a,c){var d="";if(d="undefined"==typeof a?jQuery(document.getElementById("frm_form_"+
|
40 |
+
b+"_container")).offset().top:jQuery(a).find(document.getElementById("frm_field_"+b+"_container")).offset().top){d-=frm_js.offset;b=jQuery("html").css("margin-top");a=jQuery("body").css("margin-top");if(b||a)d=d-parseInt(b)-parseInt(a);if(d&&window.innerHeight&&(b=document.documentElement.scrollTop||document.body.scrollTop,d>b+window.innerHeight||d<b))return"undefined"===typeof c?jQuery(window).scrollTop(d):jQuery("html,body").animate({scrollTop:d},500),!1}},hideCondFields:function(b){b=JSON.parse(b);
|
41 |
+
for(var a=0,c=b.length;a<c;a++){var d=document.getElementById("frm_field_"+b[a]+"_container");null!==d?d.style.display="none":jQuery(".frm_field_"+b[a]+"_container").hide()}},checkDependent:function(b){b=JSON.parse(b);for(var a="reset",c=0,d=b.length;c<d;c++)p("und",b[c],null,null,a),a="persist"},generateGoogleTable:function(b,a){var c=__FRMTABLES;if("undefined"!=typeof c)if("table"==a){var c=c.table[b],d=new google.visualization.DataTable,e=!1;jQuery.inArray("id",c.options.fields)&&(e=!0,d.addColumn("number",
|
42 |
+
frm_js.id));for(var f=c.fields.length,h="string",k=0,l=f;k<l;k++){var g=c.fields[k],h=M(g);d.addColumn(h,g.name)}k=!1;c.options.edit_link&&(k=!0,d.addColumn("string",c.options.edit_link));l=!1;c.options.delete_link&&(l=!0,d.addColumn("string",c.options.delete_link));g=0;if(null!==c.entries){var m=c.entries.length;d.addRows(m);for(var n=0,p=0;p<m;p++){var g=0,q=c.entries[p];e&&(d.setCell(n,g,q.id),g++);for(var u=0,v=f;u<v;u++){var w=c.fields[u],h=M(w),w=q.metas[w.id];"number"!=h||null!==w&&""!==w?
|
43 |
+
"boolean"==h&&(w=null===w||"false"==w||!1===w?"false":"true"):w=0;d.setCell(n,g,w);g++}k&&("undefined"!==typeof q.editLink?d.setCell(n,g,'<a href="'+q.editLink+'">'+c.options.edit_link+"</a>"):d.setCell(n,g,""),g++);l&&("undefined"!==typeof q.deleteLink?d.setCell(n,g,'<a href="'+q.deleteLink+'" class="frm_delete_link" onclick="return confirm('+c.options.confirm+')">'+c.options.delete_link+"</a>"):d.setCell(n,g,""));n++}}else for(d.addRows(1),k=g=0,l=f;k<l;k++)0<g?d.setCell(0,g,""):d.setCell(0,g,c.options.no_entries),
|
44 |
+
g++;(new google.visualization.Table(document.getElementById("frm_google_table_"+c.options.form_id))).draw(d,c.graphOpts)}else{c=c[a][b];d=new google.visualization.DataTable;e=!1;f=c.rows.length;if(0<f)if("table"==c.type)for(e=!0,d.addRows(c.rows[f-1][0]+1),h=0;h<f;h++)d.setCell(c.rows[h]);else if("undefined"!=typeof c.rows[0].tooltip){e=!0;d.addColumn({type:"string",role:"tooltip"});for(h=0;h<f;h++)g=c.rows[h].tooltip,c.rows[h].tooltip=null,c.rows[h].push(g);d.addRows(c.rows)}f=c.cols.length;if(e){if(0<
|
45 |
+
f)for(e=0;e<f;e++)h=c.cols[e],d.addColumn(h.type,h.name)}else{d=[[]];for(e=0;e<f;e++)d[0].push(c.cols[e].name);d=d.concat(c.rows);d=google.visualization.arrayToDataTable(d)}e=c.type.charAt(0).toUpperCase()+c.type.slice(1)+"Chart";(new google.visualization[e](document.getElementById("chart_"+c.graph_id))).draw(d,c.options)}},removeUsedTimes:function(b,a){var c=jQuery(b).parents("form:first").find('input[name="id"]');jQuery.ajax({type:"POST",url:frm_js.ajax_url,dataType:"json",data:{action:"frm_fields_ajax_time_options",
|
46 |
+
time_field:a,date_field:b.id,entry_id:c?c.val():"",date:jQuery(b).val(),nonce:frm_js.nonce},success:function(b){var c=jQuery(document.getElementById(a));c.find("option").removeAttr("disabled");if(b&&""!==b)for(var f in b)c.find('option[value="'+f+'"]').attr("disabled","disabled")}})},escapeHtml:function(b){return b.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")},invisible:function(b){jQuery(b).css("visibility","hidden")},visible:function(b){jQuery(b).css("visibility",
|
47 |
+
"visible")}}}var frmFrontForm=frmFrontFormJS();jQuery(document).ready(function(g){frmFrontForm.init()});
|
48 |
+
function frmEditEntry(g,n,q,x,z,p){var u=jQuery(document.getElementById("frm_edit_"+g)),v=u.html(),A=jQuery(document.getElementById(n+g)),D=A.html();A.html('<span class="frm-loading-img" id="'+n+g+'"></span><div class="frm_orig_content" style="display:none">'+D+"</div>");jQuery.ajax({type:"POST",url:frm_js.ajax_url,dataType:"html",data:{action:"frm_entries_edit_entry_ajax",post_id:q,entry_id:g,id:x,nonce:frm_js.nonce},success:function(y){A.children(".frm-loading-img").replaceWith(y);u.replaceWith('<span id="frm_edit_'+
|
49 |
+
g+'"><a onclick="frmCancelEdit('+g+",'"+n+"','"+frmFrontForm.escapeHtml(v)+"',"+q+","+x+",'"+p+'\')" class="'+p+'">'+z+"</a></span>")}})}
|
50 |
+
function frmCancelEdit(g,n,q,x,z,p){var u=jQuery(document.getElementById("frm_edit_"+g)),v=u.find("a"),A=v.html();v.hasClass("frm_ajax_edited")||(v=jQuery(document.getElementById(n+g)),v.children(".frm_forms").replaceWith(""),v.children(".frm_orig_content").fadeIn("slow").removeClass("frm_orig_content"));u.replaceWith('<a id="frm_edit_'+g+'" class="frm_edit_link '+p+'" href="javascript:frmEditEntry('+g+",'"+n+"',"+x+","+z+",'"+frmFrontForm.escapeHtml(A)+"','"+p+"')\">"+q+"</a>")}
|
51 |
+
function frmUpdateField(g,n,q,x,z){jQuery(document.getElementById("frm_update_field_"+g+"_"+n)).html('<span class="frm-loading-img"></span>');jQuery.ajax({type:"POST",url:frm_js.ajax_url,data:{action:"frm_entries_update_field_ajax",entry_id:g,field_id:n,value:q,nonce:frm_js.nonce},success:function(){""===x.replace(/^\s+|\s+$/g,"")?jQuery(document.getElementById("frm_update_field_"+g+"_"+n+"_"+z)).fadeOut("slow"):jQuery(document.getElementById("frm_update_field_"+g+"_"+n+"_"+z)).replaceWith(x)}})}
|
52 |
+
function frmDeleteEntry(g,n){jQuery(document.getElementById("frm_delete_"+g)).replaceWith('<span class="frm-loading-img" id="frm_delete_'+g+'"></span>');jQuery.ajax({type:"POST",url:frm_js.ajax_url,data:{action:"frm_entries_destroy",entry:g,nonce:frm_js.nonce},success:function(q){"success"==q.replace(/^\s+|\s+$/g,"")?jQuery(document.getElementById(n+g)).fadeOut("slow"):jQuery(document.getElementById("frm_delete_"+g)).replaceWith(q)}})}
|
53 |
function frmOnSubmit(g){console.warn("DEPRECATED: function frmOnSubmit in v2.0 use frmFrontForm.submitForm");frmFrontForm.submitForm(g,this)}
|
54 |
+
function frm_resend_email(g,n){console.warn("DEPRECATED: function frm_resend_email in v2.0");$link=jQuery(document.getElementById("frm_resend_email"));$link.append('<span class="spinner" style="display:inline"></span>');jQuery.ajax({type:"POST",url:frm_js.ajax_url,data:{action:"frm_entries_send_email",entry_id:g,form_id:n,nonce:frm_js.nonce},success:function(g){$link.replaceWith(g)}})};
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://formidablepro.com/donate
|
|
4 |
Tags: admin, AJAX, captcha, contact, contact form, database, email, feedback, form, forms, javascript, jquery, page, plugin, poll, Post, spam, survey, template, widget, wpmu, form builder
|
5 |
Requires at least: 3.6
|
6 |
Tested up to: 4.2
|
7 |
-
Stable tag: 2.0.
|
8 |
|
9 |
Beautiful forms in 60 seconds. The WordPress form builder that enables you to create forms with a simple drag-and-drop interface and in-place editing.
|
10 |
|
@@ -89,6 +89,19 @@ A. Try clearing your browser cache. As plugin modifications are made, frequent j
|
|
89 |
[See more FAQs](http://formidablepro.com/formidable-faqs/ "Formidable Form FAQs")
|
90 |
|
91 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
= 2.0.05 =
|
93 |
* Remove deprecated jQuery toggle() calls
|
94 |
* Add html ids to hidden fields
|
4 |
Tags: admin, AJAX, captcha, contact, contact form, database, email, feedback, form, forms, javascript, jquery, page, plugin, poll, Post, spam, survey, template, widget, wpmu, form builder
|
5 |
Requires at least: 3.6
|
6 |
Tested up to: 4.2
|
7 |
+
Stable tag: 2.0.06
|
8 |
|
9 |
Beautiful forms in 60 seconds. The WordPress form builder that enables you to create forms with a simple drag-and-drop interface and in-place editing.
|
10 |
|
89 |
[See more FAQs](http://formidablepro.com/formidable-faqs/ "Formidable Form FAQs")
|
90 |
|
91 |
== Changelog ==
|
92 |
+
= 2.0.06 =
|
93 |
+
* Fix an XSS vulnerability in the lite version. When the pro version is active, the vulnerability was resolved.
|
94 |
+
* Increased security
|
95 |
+
* Fix the shortcode display on form listing page
|
96 |
+
* Add frm_helper_shortcode filter
|
97 |
+
* Prevent javascript error on form settings page when WooThemes Helper plugin is active
|
98 |
+
* Prevent conflict from unknown plugin/theme that was modifying the post excerpt in form actions, which prevented them from showing
|
99 |
+
* Only scroll to the errored field and success message if they are not already in view
|
100 |
+
* Make sure admins always have permission to view menus
|
101 |
+
* Pro: Fix datepicker field when the jQuery CSS is set to load on all pages
|
102 |
+
* Pro: Added frm_footer_scripts hook
|
103 |
+
* Pro: Don't autoselect 0 in scale fields
|
104 |
+
|
105 |
= 2.0.05 =
|
106 |
* Remove deprecated jQuery toggle() calls
|
107 |
* Add html ids to hidden fields
|