@@ -7,15 +7,15 @@ |
||
7 | 7 | <?php |
8 | 8 | foreach ( $type as $tb_type ) { |
9 | 9 | |
10 | - if ( ! isset( $tables[ $tb_type ] ) ) { |
|
10 | + if ( ! isset( $tables[ $tb_type ] ) ) { |
|
11 | 11 | do_action( 'frm_xml_import_' . $tb_type, $args ); |
12 | - continue; |
|
13 | - } |
|
12 | + continue; |
|
13 | + } |
|
14 | 14 | |
15 | - //no records |
|
16 | - if ( ! isset( $records[ $tb_type ] ) ) { |
|
17 | - continue; |
|
18 | - } |
|
15 | + //no records |
|
16 | + if ( ! isset( $records[ $tb_type ] ) ) { |
|
17 | + continue; |
|
18 | + } |
|
19 | 19 | |
20 | 20 | $item_ids = $records[ $tb_type ]; |
21 | 21 | if ( in_array( $tb_type, array( 'styles', 'actions' ) ) ) { |
@@ -7,17 +7,17 @@ discard block |
||
7 | 7 | <?php |
8 | 8 | foreach ( $type as $tb_type ) { |
9 | 9 | |
10 | - if ( ! isset( $tables[ $tb_type ] ) ) { |
|
10 | + if ( ! isset( $tables[$tb_type] ) ) { |
|
11 | 11 | do_action( 'frm_xml_import_' . $tb_type, $args ); |
12 | 12 | continue; |
13 | 13 | } |
14 | 14 | |
15 | 15 | //no records |
16 | - if ( ! isset( $records[ $tb_type ] ) ) { |
|
16 | + if ( ! isset( $records[$tb_type] ) ) { |
|
17 | 17 | continue; |
18 | 18 | } |
19 | 19 | |
20 | - $item_ids = $records[ $tb_type ]; |
|
20 | + $item_ids = $records[$tb_type]; |
|
21 | 21 | if ( in_array( $tb_type, array( 'styles', 'actions' ) ) ) { |
22 | 22 | include( dirname( __FILE__ ) . '/posts_xml.php' ); |
23 | 23 | } else if ( file_exists( dirname( __FILE__ ) . '/' . $tb_type . '_xml.php' ) ) { |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | include( FrmAppHelper::plugin_path() . '/pro/classes/views/xml/' . $tb_type . '_xml.php' ); |
27 | 27 | } |
28 | 28 | |
29 | - unset( $item_ids, $records[ $tb_type ], $tb_type ); |
|
29 | + unset( $item_ids, $records[$tb_type], $tb_type ); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | ?> |
@@ -64,7 +64,7 @@ |
||
64 | 64 | <a href="<?php echo esc_url( admin_url( 'admin.php?page=formidable-styles&frm_action=destroy&id=' . $style->ID ) ); ?>" id="frm_delete_style" class="submitdelete deletion" onclick="return confirm('<?php esc_attr_e( 'Are you sure you want to delete that style?', 'formidable' ) ?>')"><?php _e( 'Delete Style', 'formidable' ) ?></a> |
65 | 65 | <?php } ?> |
66 | 66 | <?php |
67 | - if ( $style->ID ) { |
|
67 | + if ( $style->ID ) { |
|
68 | 68 | echo '<span class="howto"><span>.frm_style_' . esc_attr( $style->post_name ) . '</span></span>'; |
69 | 69 | } ?> |
70 | 70 | <div class="publishing-action"> |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | <form id="frm_styling_form" action="" name="frm_styling_form" method="post"> |
10 | 10 | <input type="hidden" name="ID" value="<?php echo esc_attr( $style->ID ) ?>" /> |
11 | 11 | <input type="hidden" name="frm_action" value="save" /> |
12 | - <textarea name="<?php echo esc_attr( $frm_style->get_field_name('custom_css') ) ?>" class="frm_hidden"><?php echo FrmAppHelper::esc_textarea( $style->post_content['custom_css'] ) ?></textarea> |
|
12 | + <textarea name="<?php echo esc_attr( $frm_style->get_field_name( 'custom_css' ) ) ?>" class="frm_hidden"><?php echo FrmAppHelper::esc_textarea( $style->post_content['custom_css'] ) ?></textarea> |
|
13 | 13 | <?php wp_nonce_field( 'frm_style_nonce', 'frm_style' ); ?> |
14 | 14 | <?php FrmTipsHelper::pro_tip( 'get_styling_tip', 'p' ); ?> |
15 | 15 | <div id="nav-menus-frame"> |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | |
19 | 19 | <div class="styling_settings"> |
20 | 20 | <input type="hidden" name="style_name" value="frm_style_<?php echo esc_attr( $style->post_name ) ?>" /> |
21 | - <?php FrmStylesController::do_accordion_sections( FrmStylesController::$screen, 'side', compact('style', 'frm_style') ); ?> |
|
21 | + <?php FrmStylesController::do_accordion_sections( FrmStylesController::$screen, 'side', compact( 'style', 'frm_style' ) ); ?> |
|
22 | 22 | </div> |
23 | 23 | |
24 | 24 | </div><!-- /#menu-settings-column --> |
@@ -31,17 +31,17 @@ discard block |
||
31 | 31 | <div class="major-publishing-actions"> |
32 | 32 | <label class="menu-name-label howto open-label" for="menu-name"> |
33 | 33 | <span><?php _e( 'Style Name', 'formidable' ) ?></span> |
34 | - <input id="menu-name" name="<?php echo esc_attr( $frm_style->get_field_name('post_title', '') ); ?>" type="text" class="menu-name regular-text menu-item-textbox" title="<?php esc_attr_e( 'Enter style name here', 'formidable' ) ?>" value="<?php echo esc_attr( $style->post_title ) ?>" /> |
|
34 | + <input id="menu-name" name="<?php echo esc_attr( $frm_style->get_field_name( 'post_title', '' ) ); ?>" type="text" class="menu-name regular-text menu-item-textbox" title="<?php esc_attr_e( 'Enter style name here', 'formidable' ) ?>" value="<?php echo esc_attr( $style->post_title ) ?>" /> |
|
35 | 35 | </label> |
36 | 36 | |
37 | - <input name="prev_menu_order" type="hidden" value="<?php echo esc_attr($style->menu_order) ?>" /> |
|
37 | + <input name="prev_menu_order" type="hidden" value="<?php echo esc_attr( $style->menu_order ) ?>" /> |
|
38 | 38 | <label class="menu-name-label howto open-label default-style-box" for="menu_order"> |
39 | 39 | <span> |
40 | 40 | <?php if ( $style->menu_order ) { ?> |
41 | - <input name="<?php echo esc_attr( $frm_style->get_field_name('menu_order', '') ); ?>" type="hidden" value="1" /> |
|
42 | - <input id="menu_order" disabled="disabled" type="checkbox" value="1" <?php checked($style->menu_order, 1) ?> /> |
|
41 | + <input name="<?php echo esc_attr( $frm_style->get_field_name( 'menu_order', '' ) ); ?>" type="hidden" value="1" /> |
|
42 | + <input id="menu_order" disabled="disabled" type="checkbox" value="1" <?php checked( $style->menu_order, 1 ) ?> /> |
|
43 | 43 | <?php } else { ?> |
44 | - <input id="menu_order" name="<?php echo esc_attr( $frm_style->get_field_name('menu_order', '') ); ?>" type="checkbox" value="1" <?php checked($style->menu_order, 1) ?> /> |
|
44 | + <input id="menu_order" name="<?php echo esc_attr( $frm_style->get_field_name( 'menu_order', '' ) ); ?>" type="checkbox" value="1" <?php checked( $style->menu_order, 1 ) ?> /> |
|
45 | 45 | <?php } ?> |
46 | 46 | <?php _e( 'Make default style', 'formidable' ) ?></span> |
47 | 47 | </label> |
@@ -51,15 +51,15 @@ |
||
51 | 51 | <ul id="new_fields" class="frm_sorting <?php echo version_compare( $GLOBALS['wp_version'], '3.7.2', '>') ? 'inside' : ''; ?>"> |
52 | 52 | <?php |
53 | 53 | if ( isset($values['fields']) && ! empty($values['fields']) ) { |
54 | - $count = 0; |
|
55 | - foreach ( $values['fields'] as $field ) { |
|
56 | - $count++; |
|
54 | + $count = 0; |
|
55 | + foreach ( $values['fields'] as $field ) { |
|
56 | + $count++; |
|
57 | 57 | $field_name = 'item_meta[' . $field['id'] . ']'; |
58 | - $html_id = FrmFieldsHelper::get_html_id($field); |
|
58 | + $html_id = FrmFieldsHelper::get_html_id($field); |
|
59 | 59 | require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/add_field.php' ); |
60 | - unset($field, $field_name); |
|
61 | - } |
|
62 | - unset($count); |
|
60 | + unset($field, $field_name); |
|
61 | + } |
|
62 | + unset($count); |
|
63 | 63 | } ?> |
64 | 64 | </ul> |
65 | 65 | </div> |
@@ -1,10 +1,10 @@ discard block |
||
1 | -<?php wp_nonce_field('frm_save_form_nonce', 'frm_save_form'); ?> |
|
1 | +<?php wp_nonce_field( 'frm_save_form_nonce', 'frm_save_form' ); ?> |
|
2 | 2 | <input type="hidden" name="status" value="<?php echo esc_attr( $values['status'] ); ?>" /> |
3 | 3 | <input type="hidden" name="new_status" value="" /> |
4 | 4 | |
5 | 5 | <div id="frm_form_editor_container"> |
6 | 6 | <div id="titlediv"> |
7 | - <input type="text" name="name" value="<?php echo esc_attr($form->name); ?>" id="title" placeholder="<?php esc_attr_e( 'Enter title here') ?>" /> |
|
7 | + <input type="text" name="name" value="<?php echo esc_attr( $form->name ); ?>" id="title" placeholder="<?php esc_attr_e( 'Enter title here' ) ?>" /> |
|
8 | 8 | <div id="edit-slug-box" class="hide-if-no-js"> |
9 | 9 | <div id="frm_form_key_box" class="alignright"> |
10 | 10 | <strong><?php _e( 'Form Key:', 'formidable' ) ?></strong> |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | </div> |
17 | 17 | |
18 | 18 | <div class="postbox"> |
19 | - <div class="frm_no_fields <?php echo ( isset($values['fields']) && ! empty($values['fields']) ) ? 'frm_hidden' : ''; ?>"> |
|
19 | + <div class="frm_no_fields <?php echo ( isset( $values['fields'] ) && ! empty( $values['fields'] ) ) ? 'frm_hidden' : ''; ?>"> |
|
20 | 20 | <div class="alignleft sketch1"> |
21 | 21 | <img src="<?php echo esc_url( FrmAppHelper::plugin_url() . '/images/sketch_arrow1.png' ); ?>" alt="" /> |
22 | 22 | </div> |
@@ -50,16 +50,16 @@ discard block |
||
50 | 50 | </div> |
51 | 51 | <ul id="new_fields" class="frm_sorting inside"> |
52 | 52 | <?php |
53 | -if ( isset($values['fields']) && ! empty($values['fields']) ) { |
|
53 | +if ( isset( $values['fields'] ) && ! empty( $values['fields'] ) ) { |
|
54 | 54 | $count = 0; |
55 | 55 | foreach ( $values['fields'] as $field ) { |
56 | - $count++; |
|
56 | + $count ++; |
|
57 | 57 | $field_name = 'item_meta[' . $field['id'] . ']'; |
58 | - $html_id = FrmFieldsHelper::get_html_id($field); |
|
58 | + $html_id = FrmFieldsHelper::get_html_id( $field ); |
|
59 | 59 | require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/add_field.php' ); |
60 | - unset($field, $field_name); |
|
60 | + unset( $field, $field_name ); |
|
61 | 61 | } |
62 | - unset($count); |
|
62 | + unset( $count ); |
|
63 | 63 | } ?> |
64 | 64 | </ul> |
65 | 65 | </div> |
@@ -8,12 +8,12 @@ |
||
8 | 8 | <div id="post-body" class="metabox-holder columns-2"> |
9 | 9 | <div id="post-body-content"> |
10 | 10 | <?php |
11 | - if ( ! $values['is_template'] ) { |
|
12 | - FrmAppController::get_form_nav($id, true, 'hide'); |
|
13 | - } |
|
11 | + if ( ! $values['is_template'] ) { |
|
12 | + FrmAppController::get_form_nav($id, true, 'hide'); |
|
13 | + } |
|
14 | 14 | require( FrmAppHelper::plugin_path() . '/classes/views/shared/errors.php' ); |
15 | 15 | |
16 | - ?> |
|
16 | + ?> |
|
17 | 17 | |
18 | 18 | <div class="frm_form_builder with_frm_style"> |
19 | 19 |
@@ -9,7 +9,7 @@ |
||
9 | 9 | <div id="post-body-content"> |
10 | 10 | <?php |
11 | 11 | if ( ! $values['is_template'] ) { |
12 | - FrmAppController::get_form_nav($id, true, 'hide'); |
|
12 | + FrmAppController::get_form_nav( $id, true, 'hide' ); |
|
13 | 13 | } |
14 | 14 | require( FrmAppHelper::plugin_path() . '/classes/views/shared/errors.php' ); |
15 | 15 |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | <option value="message" <?php selected($values['success_action'], 'message') ?>><?php _e( 'Show Message', 'formidable' )?></option> |
62 | 62 | <?php if ( FrmAppHelper::pro_is_installed() ) { ?> |
63 | 63 | <option value="redirect" <?php selected($values['success_action'], 'redirect'); |
64 | - ?>><?php _e( 'Redirect to URL', 'formidable' ) ?></option> |
|
64 | + ?>><?php _e( 'Redirect to URL', 'formidable' ) ?></option> |
|
65 | 65 | <option value="page" <?php selected($values['success_action'], 'page'); |
66 | 66 | ?>><?php _e( 'Show Page Content', 'formidable' ) ?></option> |
67 | 67 | <?php } else { ?> |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | <?php _e( '(Premium feature)', 'formidable' ); ?> |
72 | 72 | </option> |
73 | 73 | <option value="page" disabled="disabled" <?php selected($values['success_action'], 'page'); |
74 | - ?>> |
|
74 | + ?>> |
|
75 | 75 | <?php _e( 'Show Page Content', 'formidable' ); ?> |
76 | 76 | <?php _e( '(Premium feature)', 'formidable' ); ?> |
77 | 77 | </option> |
@@ -193,17 +193,17 @@ discard block |
||
193 | 193 | <ul class="frm_actions_list"> |
194 | 194 | <?php |
195 | 195 | |
196 | - //For each add-on, add an li, class, and javascript function. If active, add an additional class. |
|
197 | - foreach ( $action_controls as $action_control ) { |
|
198 | - ?> |
|
196 | + //For each add-on, add an li, class, and javascript function. If active, add an additional class. |
|
197 | + foreach ( $action_controls as $action_control ) { |
|
198 | + ?> |
|
199 | 199 | <li><a href="javascript:void(0)" class="frm_<?php echo esc_attr( $action_control->id_base ) ?>_action frm_bstooltip <?php |
200 | - echo ( isset($action_control->action_options['active']) && $action_control->action_options['active']) ? 'frm_active_action ' : 'frm_inactive_action '; |
|
201 | - echo esc_attr( $action_control->action_options['classes'] ); |
|
202 | - ?>" title="<?php echo esc_attr($action_control->action_options['tooltip']) ?>" data-limit="<?php echo isset($action_control->action_options['limit']) ? esc_attr( $action_control->action_options['limit'] ) : '99' ?>" data-actiontype="<?php echo esc_attr($action_control->id_base) ?>"></a></li> |
|
200 | + echo ( isset($action_control->action_options['active']) && $action_control->action_options['active']) ? 'frm_active_action ' : 'frm_inactive_action '; |
|
201 | + echo esc_attr( $action_control->action_options['classes'] ); |
|
202 | + ?>" title="<?php echo esc_attr($action_control->action_options['tooltip']) ?>" data-limit="<?php echo isset($action_control->action_options['limit']) ? esc_attr( $action_control->action_options['limit'] ) : '99' ?>" data-actiontype="<?php echo esc_attr($action_control->id_base) ?>"></a></li> |
|
203 | 203 | <?php |
204 | - unset($actions_icon); |
|
205 | - } |
|
206 | - ?> |
|
204 | + unset($actions_icon); |
|
205 | + } |
|
206 | + ?> |
|
207 | 207 | </ul> |
208 | 208 | </div> |
209 | 209 | <div class="frm_no_actions"> |
@@ -235,9 +235,9 @@ discard block |
||
235 | 235 | <p><label><?php echo esc_html( $field['name'] ) ?></label> |
236 | 236 | <textarea name="field_options[custom_html_<?php echo esc_attr( $field['id'] ) ?>]" rows="7" id="custom_html_<?php echo esc_attr( $field['id'] ) ?>" class="field_custom_html frm_long_input"><?php echo FrmAppHelper::esc_textarea($field['custom_html']) ?></textarea></p> |
237 | 237 | <?php } |
238 | - unset($field); |
|
239 | - } |
|
240 | - } ?> |
|
238 | + unset($field); |
|
239 | + } |
|
240 | + } ?> |
|
241 | 241 | </div> |
242 | 242 | |
243 | 243 | <p><label><?php _e( 'After Fields', 'formidable' ) ?></label> |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | call_user_func( array( $section['class'], $section['function'] ), $values ); |
260 | 260 | } else { |
261 | 261 | call_user_func( ( isset( $section['function'] ) ? $section['function'] : $section ), $values ); |
262 | - } ?> |
|
262 | + } ?> |
|
263 | 263 | </div> |
264 | 264 | <?php } ?> |
265 | 265 |
@@ -27,9 +27,9 @@ discard block |
||
27 | 27 | <div class="contextual-help-tabs"> |
28 | 28 | <ul class="frm-category-tabs frm-form-setting-tabs"> |
29 | 29 | <?php $a = FrmAppHelper::simple_get( 't', 'sanitize_title', 'advanced_settings' ); ?> |
30 | - <li <?php echo ($a == 'advanced_settings') ? 'class="tabs active"' : '' ?>><a href="#advanced_settings"><?php _e( 'General', 'formidable' ) ?></a></li> |
|
31 | - <li <?php echo ($a == 'email_settings') ? 'class="tabs active"' : '' ?>><a href="#email_settings"><?php _e( 'Form Actions', 'formidable' ); ?></a></li> |
|
32 | - <li <?php echo ($a == 'html_settings') ? 'class="tabs active"' : '' ?>><a href="#html_settings"><?php _e( 'Customize HTML', 'formidable' ) ?></a></li> |
|
30 | + <li <?php echo ( $a == 'advanced_settings' ) ? 'class="tabs active"' : '' ?>><a href="#advanced_settings"><?php _e( 'General', 'formidable' ) ?></a></li> |
|
31 | + <li <?php echo ( $a == 'email_settings' ) ? 'class="tabs active"' : '' ?>><a href="#email_settings"><?php _e( 'Form Actions', 'formidable' ); ?></a></li> |
|
32 | + <li <?php echo ( $a == 'html_settings' ) ? 'class="tabs active"' : '' ?>><a href="#html_settings"><?php _e( 'Customize HTML', 'formidable' ) ?></a></li> |
|
33 | 33 | <?php foreach ( $sections as $key => $section ) { |
34 | 34 | if ( isset( $section['name'] ) ) { |
35 | 35 | $sec_name = $section['name']; |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | <?php } ?> |
44 | 44 | </ul> |
45 | 45 | </div> |
46 | - <div class="advanced_settings tabs-panel <?php echo ($a == 'advanced_settings') ? 'frm_block' : 'frm_hidden' ?>"> |
|
46 | + <div class="advanced_settings tabs-panel <?php echo ( $a == 'advanced_settings' ) ? 'frm_block' : 'frm_hidden' ?>"> |
|
47 | 47 | <?php FrmTipsHelper::pro_tip( 'get_form_settings_tip', 'p' ); ?> |
48 | 48 | |
49 | 49 | <h3 class="frm_first_h3"><?php _e( 'On Submit', 'formidable' ); ?> |
@@ -58,19 +58,19 @@ discard block |
||
58 | 58 | <tr> |
59 | 59 | <td class="frm_175_width"> |
60 | 60 | <select name="options[success_action]" id="success_action"> |
61 | - <option value="message" <?php selected($values['success_action'], 'message') ?>><?php _e( 'Show Message', 'formidable' )?></option> |
|
61 | + <option value="message" <?php selected( $values['success_action'], 'message' ) ?>><?php _e( 'Show Message', 'formidable' )?></option> |
|
62 | 62 | <?php if ( FrmAppHelper::pro_is_installed() ) { ?> |
63 | - <option value="redirect" <?php selected($values['success_action'], 'redirect'); |
|
63 | + <option value="redirect" <?php selected( $values['success_action'], 'redirect' ); |
|
64 | 64 | ?>><?php _e( 'Redirect to URL', 'formidable' ) ?></option> |
65 | - <option value="page" <?php selected($values['success_action'], 'page'); |
|
65 | + <option value="page" <?php selected( $values['success_action'], 'page' ); |
|
66 | 66 | ?>><?php _e( 'Show Page Content', 'formidable' ) ?></option> |
67 | 67 | <?php } else { ?> |
68 | - <option value="redirect" disabled="disabled" <?php selected($values['success_action'], 'redirect'); |
|
68 | + <option value="redirect" disabled="disabled" <?php selected( $values['success_action'], 'redirect' ); |
|
69 | 69 | ?>> |
70 | 70 | <?php _e( 'Redirect to URL', 'formidable' ); ?> |
71 | 71 | <?php _e( '(Premium feature)', 'formidable' ); ?> |
72 | 72 | </option> |
73 | - <option value="page" disabled="disabled" <?php selected($values['success_action'], 'page'); |
|
73 | + <option value="page" disabled="disabled" <?php selected( $values['success_action'], 'page' ); |
|
74 | 74 | ?>> |
75 | 75 | <?php _e( 'Show Page Content', 'formidable' ); ?> |
76 | 76 | <?php _e( '(Premium feature)', 'formidable' ); ?> |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | </select> |
80 | 80 | </td> |
81 | 81 | <td> |
82 | - <span class="success_action_redirect_box success_action_box<?php echo ($values['success_action'] == 'redirect') ? '' : ' frm_hidden'; ?>"> |
|
82 | + <span class="success_action_redirect_box success_action_box<?php echo ( $values['success_action'] == 'redirect' ) ? '' : ' frm_hidden'; ?>"> |
|
83 | 83 | <input type="text" name="options[success_url]" id="success_url" value="<?php |
84 | 84 | if ( isset( $values['success_url'] ) ) { |
85 | 85 | echo esc_attr( $values['success_url'] ); |
@@ -87,23 +87,23 @@ discard block |
||
87 | 87 | </span> |
88 | 88 | |
89 | 89 | <?php if ( FrmAppHelper::pro_is_installed() ) { ?> |
90 | - <span class="success_action_page_box success_action_box<?php echo ($values['success_action'] == 'page') ? '' : ' frm_hidden'; ?>"> |
|
90 | + <span class="success_action_page_box success_action_box<?php echo ( $values['success_action'] == 'page' ) ? '' : ' frm_hidden'; ?>"> |
|
91 | 91 | <label><?php _e( 'Use Content from Page', 'formidable' ) ?></label> |
92 | 92 | <?php FrmAppHelper::wp_pages_dropdown( 'options[success_page_id]', $values['success_page_id'] ) ?> |
93 | 93 | </span> |
94 | 94 | <?php } ?> |
95 | 95 | </td> |
96 | 96 | </tr> |
97 | - <tr class="frm_show_form_opt success_action_message_box success_action_box<?php echo ($values['success_action'] == 'message') ? '' : ' frm_hidden'; ?>"> |
|
97 | + <tr class="frm_show_form_opt success_action_message_box success_action_box<?php echo ( $values['success_action'] == 'message' ) ? '' : ' frm_hidden'; ?>"> |
|
98 | 98 | <td colspan="2"> |
99 | 99 | <label for="show_form"><input type="checkbox" name="options[show_form]" id="show_form" value="1" <?php checked( $values['show_form'], 1 ) ?> /> <?php _e( 'Show the form with the confirmation message', 'formidable' ) ?></label> |
100 | 100 | </td> |
101 | 101 | </tr> |
102 | 102 | <tr> |
103 | - <td colspan="2"><label for="no_save"><input type="checkbox" name="options[no_save]" id="no_save" value="1" <?php checked($values['no_save'], 1); ?> /> <?php _e( 'Do not store entries submitted from this form', 'formidable' ) ?></label> |
|
103 | + <td colspan="2"><label for="no_save"><input type="checkbox" name="options[no_save]" id="no_save" value="1" <?php checked( $values['no_save'], 1 ); ?> /> <?php _e( 'Do not store entries submitted from this form', 'formidable' ) ?></label> |
|
104 | 104 | </td> |
105 | 105 | </tr> |
106 | - <?php if ( function_exists( 'akismet_http_post') ) { ?> |
|
106 | + <?php if ( function_exists( 'akismet_http_post' ) ) { ?> |
|
107 | 107 | <tr> |
108 | 108 | <td colspan="2"><?php _e( 'Use Akismet to check entries for spam for', 'formidable' ) ?> |
109 | 109 | <select name="options[akismet]"> |
@@ -129,12 +129,12 @@ discard block |
||
129 | 129 | <span class="frm_help frm_icon_font frm_tooltip_icon" title="<?php esc_attr_e( 'Recommended for long forms.', 'formidable' ) ?>" ></span> |
130 | 130 | </td> |
131 | 131 | </tr> |
132 | - <?php do_action('frm_add_form_ajax_options', $values); ?> |
|
132 | + <?php do_action( 'frm_add_form_ajax_options', $values ); ?> |
|
133 | 133 | </table> |
134 | 134 | |
135 | 135 | <!--Permissions Section--> |
136 | 136 | <table class="form-table"> |
137 | - <?php do_action('frm_add_form_perm_options', $values); ?> |
|
137 | + <?php do_action( 'frm_add_form_perm_options', $values ); ?> |
|
138 | 138 | </table> |
139 | 139 | |
140 | 140 | <!--Styling & Buttons Section--> |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | </tr> |
157 | 157 | <tr> |
158 | 158 | <td><label><?php _e( 'Submit Button Text', 'formidable' ) ?></label></td> |
159 | - <td><input type="text" name="options[submit_value]" value="<?php echo esc_attr($values['submit_value']); ?>" /></td> |
|
159 | + <td><input type="text" name="options[submit_value]" value="<?php echo esc_attr( $values['submit_value'] ); ?>" /></td> |
|
160 | 160 | </tr> |
161 | 161 | <?php do_action( 'frm_add_form_button_options', $values ); ?> |
162 | 162 | </table> |
@@ -166,27 +166,27 @@ discard block |
||
166 | 166 | <span class="frm_help frm_icon_font frm_tooltip_icon" title="<?php esc_attr_e( 'Set up your confirmation messages.', 'formidable' ) ?>" ></span> |
167 | 167 | </h3> |
168 | 168 | <table class="form-table"> |
169 | - <tr class="success_action_message_box success_action_box<?php echo ($values['success_action'] == 'message') ? '' : ' frm_hidden'; ?>"> |
|
169 | + <tr class="success_action_message_box success_action_box<?php echo ( $values['success_action'] == 'message' ) ? '' : ' frm_hidden'; ?>"> |
|
170 | 170 | <td> |
171 | 171 | <div><?php _e( 'On Submit', 'formidable' ) ?></div> |
172 | - <textarea id="success_msg" name="options[success_msg]" cols="50" rows="2" class="frm_long_input"><?php echo FrmAppHelper::esc_textarea($values['success_msg']); ?></textarea> |
|
172 | + <textarea id="success_msg" name="options[success_msg]" cols="50" rows="2" class="frm_long_input"><?php echo FrmAppHelper::esc_textarea( $values['success_msg'] ); ?></textarea> |
|
173 | 173 | </td> |
174 | 174 | </tr> |
175 | - <?php do_action('frm_add_form_msg_options', $values); ?> |
|
175 | + <?php do_action( 'frm_add_form_msg_options', $values ); ?> |
|
176 | 176 | </table> |
177 | 177 | |
178 | 178 | <!--Misc Section--> |
179 | 179 | <?php if ( has_action( 'frm_additional_form_options' ) ) { ?> |
180 | 180 | <h3><?php _e( 'Miscellaneous', 'formidable' ); ?></h3> |
181 | 181 | <table class="form-table"> |
182 | - <?php do_action('frm_additional_form_options', $values); ?> |
|
182 | + <?php do_action( 'frm_additional_form_options', $values ); ?> |
|
183 | 183 | </table> |
184 | 184 | <?php } ?> |
185 | 185 | |
186 | 186 | </div> |
187 | 187 | |
188 | 188 | |
189 | - <div id="frm_notification_settings" class="frm_email_settings email_settings tabs-panel widgets-holder-wrap <?php echo ($a == 'email_settings') ? ' frm_block' : ' frm_hidden'; ?>"> |
|
189 | + <div id="frm_notification_settings" class="frm_email_settings email_settings tabs-panel widgets-holder-wrap <?php echo ( $a == 'email_settings' ) ? ' frm_block' : ' frm_hidden'; ?>"> |
|
190 | 190 | <?php FrmTipsHelper::pro_tip( 'get_form_action_tip', 'p' ); ?> |
191 | 191 | <div id="frm_email_addon_menu" class="manage-menus"> |
192 | 192 | <h3><?php _e( 'Add New Action', 'formidable' ) ?></h3> |
@@ -197,11 +197,11 @@ discard block |
||
197 | 197 | foreach ( $action_controls as $action_control ) { |
198 | 198 | ?> |
199 | 199 | <li><a href="javascript:void(0)" class="frm_<?php echo esc_attr( $action_control->id_base ) ?>_action frm_bstooltip <?php |
200 | - echo ( isset($action_control->action_options['active']) && $action_control->action_options['active']) ? 'frm_active_action ' : 'frm_inactive_action '; |
|
200 | + echo ( isset( $action_control->action_options['active'] ) && $action_control->action_options['active'] ) ? 'frm_active_action ' : 'frm_inactive_action '; |
|
201 | 201 | echo esc_attr( $action_control->action_options['classes'] ); |
202 | - ?>" title="<?php echo esc_attr($action_control->action_options['tooltip']) ?>" data-limit="<?php echo isset($action_control->action_options['limit']) ? esc_attr( $action_control->action_options['limit'] ) : '99' ?>" data-actiontype="<?php echo esc_attr($action_control->id_base) ?>"></a></li> |
|
202 | + ?>" title="<?php echo esc_attr( $action_control->action_options['tooltip'] ) ?>" data-limit="<?php echo isset( $action_control->action_options['limit'] ) ? esc_attr( $action_control->action_options['limit'] ) : '99' ?>" data-actiontype="<?php echo esc_attr( $action_control->id_base ) ?>"></a></li> |
|
203 | 203 | <?php |
204 | - unset($actions_icon); |
|
204 | + unset( $actions_icon ); |
|
205 | 205 | } |
206 | 206 | ?> |
207 | 207 | </ul> |
@@ -213,19 +213,19 @@ discard block |
||
213 | 213 | <?php _e( 'Click an action to add it to this form', 'formidable' ) ?> |
214 | 214 | </div> |
215 | 215 | </div> |
216 | - <?php FrmFormActionsController::list_actions($form, $values); ?> |
|
216 | + <?php FrmFormActionsController::list_actions( $form, $values ); ?> |
|
217 | 217 | </div> |
218 | 218 | |
219 | - <div id="html_settings" class="tabs-panel <?php echo ($a == 'html_settings') ? ' frm_block' : ' frm_hidden'; ?>"> |
|
219 | + <div id="html_settings" class="tabs-panel <?php echo ( $a == 'html_settings' ) ? ' frm_block' : ' frm_hidden'; ?>"> |
|
220 | 220 | |
221 | 221 | <div class="frm_field_html_box frm_top_container"> |
222 | 222 | <p><label><?php _e( 'Form Classes', 'formidable' ) ?></label> |
223 | - <input type="text" name="options[form_class]" value="<?php echo esc_attr($values['form_class']) ?>" /> |
|
223 | + <input type="text" name="options[form_class]" value="<?php echo esc_attr( $values['form_class'] ) ?>" /> |
|
224 | 224 | </p> |
225 | 225 | <div class="clear"></div> |
226 | 226 | |
227 | 227 | <p><label><?php _e( 'Before Fields', 'formidable' ) ?></label> |
228 | - <textarea name="options[before_html]" rows="4" id="before_html" class="frm_long_input"><?php echo FrmAppHelper::esc_textarea($values['before_html']) ?></textarea></p> |
|
228 | + <textarea name="options[before_html]" rows="4" id="before_html" class="frm_long_input"><?php echo FrmAppHelper::esc_textarea( $values['before_html'] ) ?></textarea></p> |
|
229 | 229 | |
230 | 230 | <div id="add_html_fields"> |
231 | 231 | <?php |
@@ -233,18 +233,18 @@ discard block |
||
233 | 233 | foreach ( $values['fields'] as $field ) { |
234 | 234 | if ( apply_filters( 'frm_show_custom_html', true, $field['type'] ) ) { ?> |
235 | 235 | <p><label><?php echo esc_html( $field['name'] ) ?></label> |
236 | - <textarea name="field_options[custom_html_<?php echo esc_attr( $field['id'] ) ?>]" rows="7" id="custom_html_<?php echo esc_attr( $field['id'] ) ?>" class="field_custom_html frm_long_input"><?php echo FrmAppHelper::esc_textarea($field['custom_html']) ?></textarea></p> |
|
236 | + <textarea name="field_options[custom_html_<?php echo esc_attr( $field['id'] ) ?>]" rows="7" id="custom_html_<?php echo esc_attr( $field['id'] ) ?>" class="field_custom_html frm_long_input"><?php echo FrmAppHelper::esc_textarea( $field['custom_html'] ) ?></textarea></p> |
|
237 | 237 | <?php } |
238 | - unset($field); |
|
238 | + unset( $field ); |
|
239 | 239 | } |
240 | 240 | } ?> |
241 | 241 | </div> |
242 | 242 | |
243 | 243 | <p><label><?php _e( 'After Fields', 'formidable' ) ?></label> |
244 | - <textarea name="options[after_html]" rows="3" id="after_html" class="frm_long_input"><?php echo FrmAppHelper::esc_textarea($values['after_html']) ?></textarea></p> |
|
244 | + <textarea name="options[after_html]" rows="3" id="after_html" class="frm_long_input"><?php echo FrmAppHelper::esc_textarea( $values['after_html'] ) ?></textarea></p> |
|
245 | 245 | |
246 | 246 | <p><label><?php _e( 'Submit Button', 'formidable' ) ?></label> |
247 | - <textarea name="options[submit_html]" rows="3" id="submit_html" class="frm_long_input"><?php echo FrmAppHelper::esc_textarea($values['submit_html']) ?></textarea></p> |
|
247 | + <textarea name="options[submit_html]" rows="3" id="submit_html" class="frm_long_input"><?php echo FrmAppHelper::esc_textarea( $values['submit_html'] ) ?></textarea></p> |
|
248 | 248 | </div> |
249 | 249 | </div> |
250 | 250 | |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | </div> |
264 | 264 | <?php } ?> |
265 | 265 | |
266 | - <?php do_action('frm_add_form_option_section', $values); ?> |
|
266 | + <?php do_action( 'frm_add_form_option_section', $values ); ?> |
|
267 | 267 | <div class="clear"></div> |
268 | 268 | </div> |
269 | 269 | </div> |
@@ -1,11 +1,11 @@ |
||
1 | 1 | <div id="postbox-container-1" class="postbox-container"> |
2 | 2 | <?php |
3 | 3 | |
4 | - if ( ! isset($hide_preview) || ! $hide_preview ) { |
|
4 | + if ( ! isset($hide_preview) || ! $hide_preview ) { |
|
5 | 5 | include( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/_publish_box.php' ); |
6 | - } |
|
6 | + } |
|
7 | 7 | |
8 | 8 | include( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/mb_insert_fields.php' ); |
9 | 9 | |
10 | - ?> |
|
10 | + ?> |
|
11 | 11 | </div> |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <div id="postbox-container-1" class="postbox-container"> |
2 | 2 | <?php |
3 | 3 | |
4 | - if ( ! isset($hide_preview) || ! $hide_preview ) { |
|
4 | + if ( ! isset( $hide_preview ) || ! $hide_preview ) { |
|
5 | 5 | include( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/_publish_box.php' ); |
6 | 6 | } |
7 | 7 |
@@ -21,15 +21,15 @@ |
||
21 | 21 | </div> |
22 | 22 | <div class="widget-inside frm_hidden"> |
23 | 23 | <?php |
24 | - if ( defined('DOING_AJAX') || ! $action_control->action_options['ajax_load'] ) { |
|
25 | - // only load settings if they are just added or are open |
|
24 | + if ( defined('DOING_AJAX') || ! $action_control->action_options['ajax_load'] ) { |
|
25 | + // only load settings if they are just added or are open |
|
26 | 26 | include( dirname( __FILE__ ) . '/_action_inside.php' ); |
27 | - } else { |
|
28 | - // include hidden settings so action won't get lost on update ?> |
|
27 | + } else { |
|
28 | + // include hidden settings so action won't get lost on update ?> |
|
29 | 29 | <input type="hidden" name="<?php echo esc_attr( $action_control->get_field_name('post_excerpt', '') ) ?>" class="frm_action_name" value="<?php echo esc_attr( $form_action->post_excerpt ); ?>" /> |
30 | 30 | <input type="hidden" name="<?php echo esc_attr( $action_control->get_field_name('ID', '') ) ?>" value="<?php echo esc_attr( $form_action->ID ); ?>" /> |
31 | 31 | <?php |
32 | - } ?> |
|
32 | + } ?> |
|
33 | 33 | </div> |
34 | 34 | <style type="text/css"> |
35 | 35 | .frm_no_actions{ |
@@ -21,13 +21,13 @@ |
||
21 | 21 | </div> |
22 | 22 | <div class="widget-inside frm_hidden"> |
23 | 23 | <?php |
24 | - if ( defined('DOING_AJAX') || ! $action_control->action_options['ajax_load'] ) { |
|
24 | + if ( defined( 'DOING_AJAX' ) || ! $action_control->action_options['ajax_load'] ) { |
|
25 | 25 | // only load settings if they are just added or are open |
26 | 26 | include( dirname( __FILE__ ) . '/_action_inside.php' ); |
27 | 27 | } else { |
28 | 28 | // include hidden settings so action won't get lost on update ?> |
29 | - <input type="hidden" name="<?php echo esc_attr( $action_control->get_field_name('post_excerpt', '') ) ?>" class="frm_action_name" value="<?php echo esc_attr( $form_action->post_excerpt ); ?>" /> |
|
30 | - <input type="hidden" name="<?php echo esc_attr( $action_control->get_field_name('ID', '') ) ?>" value="<?php echo esc_attr( $form_action->ID ); ?>" /> |
|
29 | + <input type="hidden" name="<?php echo esc_attr( $action_control->get_field_name( 'post_excerpt', '' ) ) ?>" class="frm_action_name" value="<?php echo esc_attr( $form_action->post_excerpt ); ?>" /> |
|
30 | + <input type="hidden" name="<?php echo esc_attr( $action_control->get_field_name( 'ID', '' ) ) ?>" value="<?php echo esc_attr( $form_action->ID ); ?>" /> |
|
31 | 31 | <?php |
32 | 32 | } ?> |
33 | 33 | </div> |
@@ -4,12 +4,12 @@ discard block |
||
4 | 4 | |
5 | 5 | public function __construct() { |
6 | 6 | $action_ops = array( |
7 | - 'classes' => 'frm_email_icon frm_icon_font', |
|
8 | - 'active' => true, |
|
7 | + 'classes' => 'frm_email_icon frm_icon_font', |
|
8 | + 'active' => true, |
|
9 | 9 | 'event' => array( 'create' ), |
10 | - 'limit' => 99, |
|
11 | - 'priority' => 10, |
|
12 | - 'ajax_load' => false, |
|
10 | + 'limit' => 99, |
|
11 | + 'priority' => 10, |
|
12 | + 'ajax_load' => false, |
|
13 | 13 | ); |
14 | 14 | $action_ops = apply_filters('frm_email_control_settings', $action_ops); |
15 | 15 | |
@@ -17,23 +17,23 @@ discard block |
||
17 | 17 | } |
18 | 18 | |
19 | 19 | public function form( $form_action, $args = array() ) { |
20 | - extract($args); |
|
20 | + extract($args); |
|
21 | 21 | |
22 | 22 | include( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/_email_settings.php' ); |
23 | 23 | } |
24 | 24 | |
25 | 25 | public function get_defaults() { |
26 | - return array( |
|
27 | - 'email_to' => '[admin_email]', |
|
28 | - 'cc' => '', |
|
29 | - 'bcc' => '', |
|
30 | - 'from' => '[sitename] <[admin_email]>', |
|
31 | - 'reply_to' => '', |
|
32 | - 'email_subject' => '', |
|
33 | - 'email_message' => '[default-message]', |
|
34 | - 'inc_user_info' => 0, |
|
35 | - 'plain_text' => 0, |
|
26 | + return array( |
|
27 | + 'email_to' => '[admin_email]', |
|
28 | + 'cc' => '', |
|
29 | + 'bcc' => '', |
|
30 | + 'from' => '[sitename] <[admin_email]>', |
|
31 | + 'reply_to' => '', |
|
32 | + 'email_subject' => '', |
|
33 | + 'email_message' => '[default-message]', |
|
34 | + 'inc_user_info' => 0, |
|
35 | + 'plain_text' => 0, |
|
36 | 36 | 'event' => array( 'create' ), |
37 | - ); |
|
37 | + ); |
|
38 | 38 | } |
39 | 39 | } |
@@ -11,13 +11,13 @@ |
||
11 | 11 | 'priority' => 10, |
12 | 12 | 'ajax_load' => false, |
13 | 13 | ); |
14 | - $action_ops = apply_filters('frm_email_control_settings', $action_ops); |
|
14 | + $action_ops = apply_filters( 'frm_email_control_settings', $action_ops ); |
|
15 | 15 | |
16 | - parent::__construct('email', __( 'Email Notification', 'formidable' ), $action_ops); |
|
16 | + parent::__construct( 'email', __( 'Email Notification', 'formidable' ), $action_ops ); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | public function form( $form_action, $args = array() ) { |
20 | - extract($args); |
|
20 | + extract( $args ); |
|
21 | 21 | |
22 | 22 | include( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/_email_settings.php' ); |
23 | 23 | } |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | public $action_options; // Option array passed to wp_register_sidebar_widget() |
9 | 9 | public $control_options; // Option array passed to wp_register_widget_control() |
10 | 10 | |
11 | - public $form_id; // The ID of the form to evaluate |
|
11 | + public $form_id; // The ID of the form to evaluate |
|
12 | 12 | public $number = false; // Unique ID number of the current instance. |
13 | 13 | public $id = ''; // Unique ID string of the current instance (id_base-number) |
14 | 14 | public $updated = false; // Set true when we update the data after a POST submit - makes sure we don't do it twice. |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | } |
30 | 30 | |
31 | 31 | /** |
32 | - * Echo the settings update form |
|
32 | + * Echo the settings update form |
|
33 | 33 | * |
34 | 34 | * @param array $instance Current settings |
35 | 35 | */ |
@@ -42,15 +42,15 @@ discard block |
||
42 | 42 | * @return array of the default options |
43 | 43 | */ |
44 | 44 | public function get_defaults() { |
45 | - return array(); |
|
45 | + return array(); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | public function get_switch_fields() { |
49 | - return array(); |
|
49 | + return array(); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | public function migrate_values( $action, $form ) { |
53 | - return $action; |
|
53 | + return $action; |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | // Functions you'll need to call. |
@@ -69,24 +69,24 @@ discard block |
||
69 | 69 | * - height: currently not used but may be needed in the future |
70 | 70 | */ |
71 | 71 | public function __construct( $id_base, $name, $action_options = array(), $control_options = array() ) { |
72 | - if ( ! defined('ABSPATH') ) { |
|
73 | - die('You are not allowed to call this page directly.'); |
|
74 | - } |
|
72 | + if ( ! defined('ABSPATH') ) { |
|
73 | + die('You are not allowed to call this page directly.'); |
|
74 | + } |
|
75 | 75 | |
76 | 76 | $this->id_base = strtolower($id_base); |
77 | 77 | $this->name = $name; |
78 | 78 | $this->option_name = 'frm_' . $this->id_base . '_action'; |
79 | 79 | |
80 | - $default_options = array( |
|
81 | - 'classes' => '', |
|
82 | - 'active' => true, |
|
80 | + $default_options = array( |
|
81 | + 'classes' => '', |
|
82 | + 'active' => true, |
|
83 | 83 | 'event' => array( 'create' ), |
84 | - 'limit' => 1, |
|
85 | - 'force_event' => false, |
|
86 | - 'priority' => 20, |
|
87 | - 'ajax_load' => true, |
|
88 | - 'tooltip' => $name, |
|
89 | - ); |
|
84 | + 'limit' => 1, |
|
85 | + 'force_event' => false, |
|
86 | + 'priority' => 20, |
|
87 | + 'ajax_load' => true, |
|
88 | + 'tooltip' => $name, |
|
89 | + ); |
|
90 | 90 | |
91 | 91 | $action_options = apply_filters( 'frm_' . $id_base . '_action_options', $action_options ); |
92 | 92 | $this->action_options = wp_parse_args( $action_options, $default_options ); |
@@ -135,132 +135,132 @@ discard block |
||
135 | 135 | } |
136 | 136 | |
137 | 137 | public function prepare_new( $form_id = false ) { |
138 | - if ( $form_id ) { |
|
139 | - $this->form_id = $form_id; |
|
140 | - } |
|
141 | - |
|
142 | - $post_content = array(); |
|
143 | - $default_values = $this->get_global_defaults(); |
|
144 | - |
|
145 | - // fill default values |
|
146 | - $post_content = wp_parse_args( $post_content, $default_values); |
|
147 | - |
|
148 | - if ( ! isset($post_content['event']) && ! $this->action_options['force_event'] ) { |
|
149 | - $post_content['event'] = array( reset($this->action_options['event']) ); |
|
150 | - } |
|
151 | - |
|
152 | - $form_action = array( |
|
153 | - 'post_title' => $this->name, |
|
154 | - 'post_content' => $post_content, |
|
155 | - 'post_excerpt' => $this->id_base, |
|
156 | - 'ID' => '', |
|
157 | - 'post_status' => 'publish', |
|
158 | - 'post_type' => FrmFormActionsController::$action_post_type, |
|
138 | + if ( $form_id ) { |
|
139 | + $this->form_id = $form_id; |
|
140 | + } |
|
141 | + |
|
142 | + $post_content = array(); |
|
143 | + $default_values = $this->get_global_defaults(); |
|
144 | + |
|
145 | + // fill default values |
|
146 | + $post_content = wp_parse_args( $post_content, $default_values); |
|
147 | + |
|
148 | + if ( ! isset($post_content['event']) && ! $this->action_options['force_event'] ) { |
|
149 | + $post_content['event'] = array( reset($this->action_options['event']) ); |
|
150 | + } |
|
151 | + |
|
152 | + $form_action = array( |
|
153 | + 'post_title' => $this->name, |
|
154 | + 'post_content' => $post_content, |
|
155 | + 'post_excerpt' => $this->id_base, |
|
156 | + 'ID' => '', |
|
157 | + 'post_status' => 'publish', |
|
158 | + 'post_type' => FrmFormActionsController::$action_post_type, |
|
159 | 159 | 'post_name' => $this->form_id . '_' . $this->id_base . '_' . $this->number, |
160 | - 'menu_order' => $this->form_id, |
|
161 | - ); |
|
162 | - unset($post_content); |
|
160 | + 'menu_order' => $this->form_id, |
|
161 | + ); |
|
162 | + unset($post_content); |
|
163 | 163 | |
164 | - return (object) $form_action; |
|
165 | - } |
|
164 | + return (object) $form_action; |
|
165 | + } |
|
166 | 166 | |
167 | 167 | public function create( $form_id ) { |
168 | - $this->form_id = $form_id; |
|
168 | + $this->form_id = $form_id; |
|
169 | 169 | |
170 | - $action = $this->prepare_new(); |
|
170 | + $action = $this->prepare_new(); |
|
171 | 171 | |
172 | - return $this->save_settings($action); |
|
173 | - } |
|
172 | + return $this->save_settings($action); |
|
173 | + } |
|
174 | 174 | |
175 | 175 | public function duplicate_form_actions( $form_id, $old_id ) { |
176 | - if ( $form_id == $old_id ) { |
|
177 | - // don't duplicate the actions if this is a template getting updated |
|
178 | - return; |
|
179 | - } |
|
180 | - |
|
181 | - $this->form_id = $old_id; |
|
182 | - $actions = $this->get_all( $old_id ); |
|
183 | - |
|
184 | - $this->form_id = $form_id; |
|
185 | - foreach ( $actions as $action ) { |
|
186 | - $this->duplicate_one($action, $form_id); |
|
187 | - unset($action); |
|
188 | - } |
|
189 | - } |
|
190 | - |
|
191 | - /* Check if imported action should be created or updated |
|
176 | + if ( $form_id == $old_id ) { |
|
177 | + // don't duplicate the actions if this is a template getting updated |
|
178 | + return; |
|
179 | + } |
|
180 | + |
|
181 | + $this->form_id = $old_id; |
|
182 | + $actions = $this->get_all( $old_id ); |
|
183 | + |
|
184 | + $this->form_id = $form_id; |
|
185 | + foreach ( $actions as $action ) { |
|
186 | + $this->duplicate_one($action, $form_id); |
|
187 | + unset($action); |
|
188 | + } |
|
189 | + } |
|
190 | + |
|
191 | + /* Check if imported action should be created or updated |
|
192 | 192 | * |
193 | 193 | * Since 2.0 |
194 | 194 | * |
195 | 195 | * @param array $action |
196 | 196 | * @return integer $post_id |
197 | 197 | */ |
198 | - public function maybe_create_action( $action, $forms ) { |
|
198 | + public function maybe_create_action( $action, $forms ) { |
|
199 | 199 | if ( isset( $action['ID'] ) && is_numeric( $action['ID'] ) && $forms[ $action['menu_order'] ] == 'updated' ) { |
200 | - // Update action only |
|
201 | - $action['post_content'] = FrmAppHelper::maybe_json_decode( $action['post_content'] ); |
|
202 | - $post_id = $this->save_settings( $action ); |
|
203 | - } else { |
|
204 | - // Create action |
|
205 | - $action['post_content'] = FrmAppHelper::maybe_json_decode($action['post_content']); |
|
206 | - $post_id = $this->duplicate_one( (object) $action, $action['menu_order']); |
|
207 | - } |
|
208 | - return $post_id; |
|
209 | - } |
|
200 | + // Update action only |
|
201 | + $action['post_content'] = FrmAppHelper::maybe_json_decode( $action['post_content'] ); |
|
202 | + $post_id = $this->save_settings( $action ); |
|
203 | + } else { |
|
204 | + // Create action |
|
205 | + $action['post_content'] = FrmAppHelper::maybe_json_decode($action['post_content']); |
|
206 | + $post_id = $this->duplicate_one( (object) $action, $action['menu_order']); |
|
207 | + } |
|
208 | + return $post_id; |
|
209 | + } |
|
210 | 210 | |
211 | 211 | public function duplicate_one( $action, $form_id ) { |
212 | - global $frm_duplicate_ids; |
|
212 | + global $frm_duplicate_ids; |
|
213 | 213 | |
214 | - $action->menu_order = $form_id; |
|
215 | - $switch = $this->get_global_switch_fields(); |
|
216 | - foreach ( (array) $action->post_content as $key => $val ) { |
|
214 | + $action->menu_order = $form_id; |
|
215 | + $switch = $this->get_global_switch_fields(); |
|
216 | + foreach ( (array) $action->post_content as $key => $val ) { |
|
217 | 217 | if ( is_numeric( $val ) && isset( $frm_duplicate_ids[ $val ] ) ) { |
218 | 218 | $action->post_content[ $key ] = $frm_duplicate_ids[ $val ]; |
219 | - } else if ( ! is_array( $val ) ) { |
|
219 | + } else if ( ! is_array( $val ) ) { |
|
220 | 220 | $action->post_content[ $key ] = FrmFieldsHelper::switch_field_ids( $val ); |
221 | 221 | } else if ( isset( $switch[ $key ] ) && is_array( $switch[ $key ] ) ) { |
222 | - // loop through each value if empty |
|
222 | + // loop through each value if empty |
|
223 | 223 | if ( empty( $switch[ $key ] ) ) { |
224 | 224 | $switch[ $key ] = array_keys( $val ); |
225 | 225 | } |
226 | 226 | |
227 | 227 | foreach ( $switch[ $key ] as $subkey ) { |
228 | 228 | $action->post_content[ $key ] = $this->duplicate_array_walk( $action->post_content[ $key ], $subkey, $val ); |
229 | - } |
|
230 | - } |
|
229 | + } |
|
230 | + } |
|
231 | 231 | |
232 | - unset($key, $val); |
|
233 | - } |
|
234 | - unset($action->ID); |
|
232 | + unset($key, $val); |
|
233 | + } |
|
234 | + unset($action->ID); |
|
235 | 235 | |
236 | - return $this->save_settings($action); |
|
237 | - } |
|
236 | + return $this->save_settings($action); |
|
237 | + } |
|
238 | 238 | |
239 | 239 | private function duplicate_array_walk( $action, $subkey, $val ) { |
240 | - global $frm_duplicate_ids; |
|
240 | + global $frm_duplicate_ids; |
|
241 | 241 | |
242 | - if ( is_array($subkey) ) { |
|
243 | - foreach ( $subkey as $subkey2 ) { |
|
244 | - foreach ( (array) $val as $ck => $cv ) { |
|
245 | - if ( is_array($cv) ) { |
|
242 | + if ( is_array($subkey) ) { |
|
243 | + foreach ( $subkey as $subkey2 ) { |
|
244 | + foreach ( (array) $val as $ck => $cv ) { |
|
245 | + if ( is_array($cv) ) { |
|
246 | 246 | $action[ $ck ] = $this->duplicate_array_walk( $action[ $ck ], $subkey2, $cv ); |
247 | 247 | } else if ( isset( $cv[ $subkey ] ) && is_numeric( $cv[ $subkey ] ) && isset( $frm_duplicate_ids[ $cv[ $subkey ] ] ) ) { |
248 | 248 | $action[ $ck ][ $subkey ] = $frm_duplicate_ids[ $cv[ $subkey ] ]; |
249 | - } |
|
250 | - } |
|
251 | - } |
|
252 | - } else { |
|
253 | - foreach ( (array) $val as $ck => $cv ) { |
|
254 | - if ( is_array($cv) ) { |
|
249 | + } |
|
250 | + } |
|
251 | + } |
|
252 | + } else { |
|
253 | + foreach ( (array) $val as $ck => $cv ) { |
|
254 | + if ( is_array($cv) ) { |
|
255 | 255 | $action[ $ck ] = $this->duplicate_array_walk( $action[ $ck ], $subkey, $cv ); |
256 | 256 | } else if ( $ck == $subkey && isset( $frm_duplicate_ids[ $cv ] ) ) { |
257 | 257 | $action[ $ck ] = $frm_duplicate_ids[ $cv ]; |
258 | - } |
|
259 | - } |
|
260 | - } |
|
258 | + } |
|
259 | + } |
|
260 | + } |
|
261 | 261 | |
262 | - return $action; |
|
263 | - } |
|
262 | + return $action; |
|
263 | + } |
|
264 | 264 | |
265 | 265 | /** |
266 | 266 | * Deal with changed settings. |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | * |
270 | 270 | */ |
271 | 271 | public function update_callback( $form_id ) { |
272 | - $this->form_id = $form_id; |
|
272 | + $this->form_id = $form_id; |
|
273 | 273 | |
274 | 274 | $all_instances = $this->get_settings(); |
275 | 275 | |
@@ -284,25 +284,25 @@ discard block |
||
284 | 284 | return; |
285 | 285 | } |
286 | 286 | |
287 | - $action_ids = array(); |
|
287 | + $action_ids = array(); |
|
288 | 288 | |
289 | 289 | foreach ( $settings as $number => $new_instance ) { |
290 | 290 | $this->_set($number); |
291 | 291 | |
292 | 292 | if ( ! isset($new_instance['post_title']) ) { |
293 | - // settings were never opened, so don't update |
|
294 | - $action_ids[] = $new_instance['ID']; |
|
295 | - $this->updated = true; |
|
296 | - continue; |
|
293 | + // settings were never opened, so don't update |
|
294 | + $action_ids[] = $new_instance['ID']; |
|
295 | + $this->updated = true; |
|
296 | + continue; |
|
297 | 297 | } |
298 | 298 | |
299 | 299 | $old_instance = isset( $all_instances[ $number ] ) ? $all_instances[ $number ] : array(); |
300 | 300 | |
301 | 301 | $new_instance['post_type'] = FrmFormActionsController::$action_post_type; |
302 | 302 | $new_instance['post_name'] = $this->form_id . '_' . $this->id_base . '_' . $this->number; |
303 | - $new_instance['menu_order'] = $this->form_id; |
|
304 | - $new_instance['post_status'] = 'publish'; |
|
305 | - $new_instance['post_date'] = isset( $old_instance->post_date ) ? $old_instance->post_date : ''; |
|
303 | + $new_instance['menu_order'] = $this->form_id; |
|
304 | + $new_instance['post_status'] = 'publish'; |
|
305 | + $new_instance['post_date'] = isset( $old_instance->post_date ) ? $old_instance->post_date : ''; |
|
306 | 306 | |
307 | 307 | $instance = $this->update( $new_instance, $old_instance ); |
308 | 308 | |
@@ -328,9 +328,9 @@ discard block |
||
328 | 328 | $all_instances[ $number ] = $instance; |
329 | 329 | } |
330 | 330 | |
331 | - $action_ids[] = $this->save_settings($instance); |
|
331 | + $action_ids[] = $this->save_settings($instance); |
|
332 | 332 | |
333 | - $this->updated = true; |
|
333 | + $this->updated = true; |
|
334 | 334 | } |
335 | 335 | |
336 | 336 | return $action_ids; |
@@ -342,100 +342,100 @@ discard block |
||
342 | 342 | } |
343 | 343 | |
344 | 344 | public function get_single_action( $id ) { |
345 | - $action = get_post($id); |
|
345 | + $action = get_post($id); |
|
346 | 346 | if ( $action ) { |
347 | 347 | $action = $this->prepare_action( $action ); |
348 | 348 | $this->_set( $id ); |
349 | 349 | } |
350 | - return $action; |
|
350 | + return $action; |
|
351 | 351 | } |
352 | 352 | |
353 | 353 | public function get_one( $form_id ) { |
354 | - return $this->get_all($form_id, 1); |
|
354 | + return $this->get_all($form_id, 1); |
|
355 | 355 | } |
356 | 356 | |
357 | - public static function get_action_for_form( $form_id, $type = 'all', $limit = 99 ) { |
|
358 | - $action_controls = FrmFormActionsController::get_form_actions( $type ); |
|
359 | - if ( empty($action_controls) ) { |
|
360 | - // don't continue if there are no available actions |
|
361 | - return array(); |
|
362 | - } |
|
357 | + public static function get_action_for_form( $form_id, $type = 'all', $limit = 99 ) { |
|
358 | + $action_controls = FrmFormActionsController::get_form_actions( $type ); |
|
359 | + if ( empty($action_controls) ) { |
|
360 | + // don't continue if there are no available actions |
|
361 | + return array(); |
|
362 | + } |
|
363 | 363 | |
364 | - if ( 'all' != $type ) { |
|
365 | - return $action_controls->get_all( $form_id, $limit ); |
|
366 | - } |
|
364 | + if ( 'all' != $type ) { |
|
365 | + return $action_controls->get_all( $form_id, $limit ); |
|
366 | + } |
|
367 | 367 | |
368 | 368 | $args = self::action_args( $form_id, $limit ); |
369 | 369 | $actions = FrmAppHelper::check_cache( serialize( $args ), 'frm_actions', $args, 'get_posts' ); |
370 | 370 | |
371 | - if ( ! $actions ) { |
|
372 | - return array(); |
|
373 | - } |
|
371 | + if ( ! $actions ) { |
|
372 | + return array(); |
|
373 | + } |
|
374 | 374 | |
375 | - $settings = array(); |
|
376 | - foreach ( $actions as $action ) { |
|
375 | + $settings = array(); |
|
376 | + foreach ( $actions as $action ) { |
|
377 | 377 | // some plugins/themes are formatting the post_excerpt |
378 | 378 | $action->post_excerpt = sanitize_title( $action->post_excerpt ); |
379 | 379 | |
380 | 380 | if ( ! isset( $action_controls[ $action->post_excerpt ] ) ) { |
381 | - continue; |
|
382 | - } |
|
381 | + continue; |
|
382 | + } |
|
383 | 383 | |
384 | - $action = $action_controls[ $action->post_excerpt ]->prepare_action( $action ); |
|
384 | + $action = $action_controls[ $action->post_excerpt ]->prepare_action( $action ); |
|
385 | 385 | $settings[ $action->ID ] = $action; |
386 | 386 | |
387 | 387 | if ( count( $settings ) >= $limit ) { |
388 | 388 | break; |
389 | 389 | } |
390 | - } |
|
390 | + } |
|
391 | 391 | |
392 | - if ( 1 === $limit ) { |
|
393 | - $settings = reset($settings); |
|
394 | - } |
|
392 | + if ( 1 === $limit ) { |
|
393 | + $settings = reset($settings); |
|
394 | + } |
|
395 | 395 | |
396 | - return $settings; |
|
397 | - } |
|
396 | + return $settings; |
|
397 | + } |
|
398 | 398 | |
399 | 399 | public function get_all( $form_id = false, $limit = 99 ) { |
400 | - if ( $form_id ) { |
|
401 | - $this->form_id = $form_id; |
|
402 | - } |
|
400 | + if ( $form_id ) { |
|
401 | + $this->form_id = $form_id; |
|
402 | + } |
|
403 | 403 | |
404 | - $type = $this->id_base; |
|
404 | + $type = $this->id_base; |
|
405 | 405 | |
406 | - global $frm_vars; |
|
407 | - $frm_vars['action_type'] = $type; |
|
406 | + global $frm_vars; |
|
407 | + $frm_vars['action_type'] = $type; |
|
408 | 408 | |
409 | - add_filter( 'posts_where' , 'FrmFormActionsController::limit_by_type' ); |
|
409 | + add_filter( 'posts_where' , 'FrmFormActionsController::limit_by_type' ); |
|
410 | 410 | $query = self::action_args( $form_id, $limit ); |
411 | - $query['post_status'] = 'any'; |
|
412 | - $query['suppress_filters'] = false; |
|
411 | + $query['post_status'] = 'any'; |
|
412 | + $query['suppress_filters'] = false; |
|
413 | 413 | |
414 | 414 | $actions = FrmAppHelper::check_cache( serialize( $query ) . '_type_' . $type, 'frm_actions', $query, 'get_posts' ); |
415 | - unset($query); |
|
415 | + unset($query); |
|
416 | 416 | |
417 | - remove_filter( 'posts_where' , 'FrmFormActionsController::limit_by_type' ); |
|
417 | + remove_filter( 'posts_where' , 'FrmFormActionsController::limit_by_type' ); |
|
418 | 418 | |
419 | - if ( empty($actions) ) { |
|
420 | - return array(); |
|
421 | - } |
|
419 | + if ( empty($actions) ) { |
|
420 | + return array(); |
|
421 | + } |
|
422 | 422 | |
423 | - $settings = array(); |
|
424 | - foreach ( $actions as $action ) { |
|
425 | - if ( count($settings) >= $limit ) { |
|
426 | - continue; |
|
427 | - } |
|
423 | + $settings = array(); |
|
424 | + foreach ( $actions as $action ) { |
|
425 | + if ( count($settings) >= $limit ) { |
|
426 | + continue; |
|
427 | + } |
|
428 | 428 | |
429 | - $action = $this->prepare_action($action); |
|
429 | + $action = $this->prepare_action($action); |
|
430 | 430 | |
431 | 431 | $settings[ $action->ID ] = $action; |
432 | - } |
|
432 | + } |
|
433 | 433 | |
434 | - if ( 1 === $limit ) { |
|
435 | - $settings = reset($settings); |
|
436 | - } |
|
434 | + if ( 1 === $limit ) { |
|
435 | + $settings = reset($settings); |
|
436 | + } |
|
437 | 437 | |
438 | - return $settings; |
|
438 | + return $settings; |
|
439 | 439 | } |
440 | 440 | |
441 | 441 | public static function action_args( $form_id = 0, $limit = 99 ) { |
@@ -458,45 +458,45 @@ discard block |
||
458 | 458 | $action->post_content = (array) FrmAppHelper::maybe_json_decode($action->post_content); |
459 | 459 | $action->post_excerpt = sanitize_title( $action->post_excerpt ); |
460 | 460 | |
461 | - $default_values = $this->get_global_defaults(); |
|
461 | + $default_values = $this->get_global_defaults(); |
|
462 | 462 | |
463 | - // fill default values |
|
464 | - $action->post_content += $default_values; |
|
463 | + // fill default values |
|
464 | + $action->post_content += $default_values; |
|
465 | 465 | |
466 | - foreach ( $default_values as $k => $vals ) { |
|
467 | - if ( is_array($vals) && ! empty($vals) ) { |
|
466 | + foreach ( $default_values as $k => $vals ) { |
|
467 | + if ( is_array($vals) && ! empty($vals) ) { |
|
468 | 468 | if ( 'event' == $k && ! $this->action_options['force_event'] && ! empty( $action->post_content[ $k ] ) ) { |
469 | - continue; |
|
470 | - } |
|
469 | + continue; |
|
470 | + } |
|
471 | 471 | $action->post_content[ $k ] = wp_parse_args( $action->post_content[ $k ], $vals ); |
472 | - } |
|
473 | - } |
|
472 | + } |
|
473 | + } |
|
474 | 474 | |
475 | - if ( ! is_array($action->post_content['event']) ) { |
|
476 | - $action->post_content['event'] = explode(',', $action->post_content['event']); |
|
477 | - } |
|
475 | + if ( ! is_array($action->post_content['event']) ) { |
|
476 | + $action->post_content['event'] = explode(',', $action->post_content['event']); |
|
477 | + } |
|
478 | 478 | |
479 | - return $action; |
|
479 | + return $action; |
|
480 | 480 | } |
481 | 481 | |
482 | 482 | public function destroy( $form_id = false, $type = 'default' ) { |
483 | - global $wpdb; |
|
483 | + global $wpdb; |
|
484 | 484 | |
485 | - $this->form_id = $form_id; |
|
485 | + $this->form_id = $form_id; |
|
486 | 486 | |
487 | - $query = array( 'post_type' => FrmFormActionsController::$action_post_type ); |
|
488 | - if ( $form_id ) { |
|
489 | - $query['menu_order'] = $form_id; |
|
490 | - } |
|
491 | - if ( 'all' != $type ) { |
|
492 | - $query['post_excerpt'] = $this->id_base; |
|
493 | - } |
|
487 | + $query = array( 'post_type' => FrmFormActionsController::$action_post_type ); |
|
488 | + if ( $form_id ) { |
|
489 | + $query['menu_order'] = $form_id; |
|
490 | + } |
|
491 | + if ( 'all' != $type ) { |
|
492 | + $query['post_excerpt'] = $this->id_base; |
|
493 | + } |
|
494 | 494 | |
495 | - $post_ids = FrmDb::get_col( $wpdb->posts, $query, 'ID' ); |
|
495 | + $post_ids = FrmDb::get_col( $wpdb->posts, $query, 'ID' ); |
|
496 | 496 | |
497 | - foreach ( $post_ids as $id ) { |
|
498 | - wp_delete_post($id); |
|
499 | - } |
|
497 | + foreach ( $post_ids as $id ) { |
|
498 | + wp_delete_post($id); |
|
499 | + } |
|
500 | 500 | self::clear_cache(); |
501 | 501 | } |
502 | 502 | |
@@ -514,69 +514,69 @@ discard block |
||
514 | 514 | } |
515 | 515 | |
516 | 516 | public function get_global_defaults() { |
517 | - $defaults = $this->get_defaults(); |
|
517 | + $defaults = $this->get_defaults(); |
|
518 | 518 | |
519 | - if ( ! isset($defaults['event']) ) { |
|
519 | + if ( ! isset($defaults['event']) ) { |
|
520 | 520 | $defaults['event'] = array( 'create' ); |
521 | - } |
|
521 | + } |
|
522 | 522 | |
523 | - if ( ! isset($defaults['conditions']) ) { |
|
524 | - $defaults['conditions'] = array( |
|
525 | - 'send_stop' => '', |
|
526 | - 'any_all' => '', |
|
527 | - ); |
|
528 | - } |
|
523 | + if ( ! isset($defaults['conditions']) ) { |
|
524 | + $defaults['conditions'] = array( |
|
525 | + 'send_stop' => '', |
|
526 | + 'any_all' => '', |
|
527 | + ); |
|
528 | + } |
|
529 | 529 | |
530 | - return $defaults; |
|
530 | + return $defaults; |
|
531 | 531 | } |
532 | 532 | |
533 | 533 | public function get_global_switch_fields() { |
534 | - $switch = $this->get_switch_fields(); |
|
534 | + $switch = $this->get_switch_fields(); |
|
535 | 535 | $switch['conditions'] = array( 'hide_field' ); |
536 | - return $switch; |
|
536 | + return $switch; |
|
537 | 537 | } |
538 | 538 | |
539 | 539 | /** |
540 | 540 | * Migrate settings from form->options into new action. |
541 | 541 | */ |
542 | 542 | public function migrate_to_2( $form, $update = 'update' ) { |
543 | - $action = $this->prepare_new($form->id); |
|
544 | - $form->options = maybe_unserialize($form->options); |
|
543 | + $action = $this->prepare_new($form->id); |
|
544 | + $form->options = maybe_unserialize($form->options); |
|
545 | 545 | |
546 | - // fill with existing options |
|
547 | - foreach ( $action->post_content as $name => $val ) { |
|
546 | + // fill with existing options |
|
547 | + foreach ( $action->post_content as $name => $val ) { |
|
548 | 548 | if ( isset( $form->options[ $name ] ) ) { |
549 | 549 | $action->post_content[ $name ] = $form->options[ $name ]; |
550 | 550 | unset( $form->options[ $name ] ); |
551 | - } |
|
552 | - } |
|
551 | + } |
|
552 | + } |
|
553 | 553 | |
554 | - $action = $this->migrate_values($action, $form); |
|
554 | + $action = $this->migrate_values($action, $form); |
|
555 | 555 | |
556 | - // check if action already exists |
|
557 | - $post_id = get_posts( array( |
|
558 | - 'name' => $action->post_name, |
|
559 | - 'post_type' => FrmFormActionsController::$action_post_type, |
|
560 | - 'post_status' => $action->post_status, |
|
561 | - 'numberposts' => 1, |
|
562 | - ) ); |
|
556 | + // check if action already exists |
|
557 | + $post_id = get_posts( array( |
|
558 | + 'name' => $action->post_name, |
|
559 | + 'post_type' => FrmFormActionsController::$action_post_type, |
|
560 | + 'post_status' => $action->post_status, |
|
561 | + 'numberposts' => 1, |
|
562 | + ) ); |
|
563 | 563 | |
564 | - if ( empty($post_id) ) { |
|
565 | - // create action now |
|
566 | - $post_id = $this->save_settings($action); |
|
567 | - } |
|
564 | + if ( empty($post_id) ) { |
|
565 | + // create action now |
|
566 | + $post_id = $this->save_settings($action); |
|
567 | + } |
|
568 | 568 | |
569 | - if ( $post_id && 'update' == $update ) { |
|
570 | - global $wpdb; |
|
571 | - $form->options = maybe_serialize($form->options); |
|
569 | + if ( $post_id && 'update' == $update ) { |
|
570 | + global $wpdb; |
|
571 | + $form->options = maybe_serialize($form->options); |
|
572 | 572 | |
573 | - // update form options |
|
573 | + // update form options |
|
574 | 574 | $wpdb->update( $wpdb->prefix . 'frm_forms', array( 'options' => $form->options ), array( 'id' => $form->id ) ); |
575 | - wp_cache_delete( $form->id, 'frm_form'); |
|
576 | - } |
|
575 | + wp_cache_delete( $form->id, 'frm_form'); |
|
576 | + } |
|
577 | 577 | |
578 | - return $post_id; |
|
579 | - } |
|
578 | + return $post_id; |
|
579 | + } |
|
580 | 580 | |
581 | 581 | public static function action_conditions_met( $action, $entry ) { |
582 | 582 | $notification = $action->post_content; |
@@ -2,16 +2,16 @@ discard block |
||
2 | 2 | |
3 | 3 | class FrmFormAction { |
4 | 4 | |
5 | - public $id_base; // Root id for all actions of this type. |
|
6 | - public $name; // Name for this action type. |
|
5 | + public $id_base; // Root id for all actions of this type. |
|
6 | + public $name; // Name for this action type. |
|
7 | 7 | public $option_name; |
8 | - public $action_options; // Option array passed to wp_register_sidebar_widget() |
|
9 | - public $control_options; // Option array passed to wp_register_widget_control() |
|
8 | + public $action_options; // Option array passed to wp_register_sidebar_widget() |
|
9 | + public $control_options; // Option array passed to wp_register_widget_control() |
|
10 | 10 | |
11 | - public $form_id; // The ID of the form to evaluate |
|
12 | - public $number = false; // Unique ID number of the current instance. |
|
13 | - public $id = ''; // Unique ID string of the current instance (id_base-number) |
|
14 | - public $updated = false; // Set true when we update the data after a POST submit - makes sure we don't do it twice. |
|
11 | + public $form_id; // The ID of the form to evaluate |
|
12 | + public $number = false; // Unique ID number of the current instance. |
|
13 | + public $id = ''; // Unique ID string of the current instance (id_base-number) |
|
14 | + public $updated = false; // Set true when we update the data after a POST submit - makes sure we don't do it twice. |
|
15 | 15 | |
16 | 16 | // Member functions that you must over-ride. |
17 | 17 | |
@@ -69,11 +69,11 @@ discard block |
||
69 | 69 | * - height: currently not used but may be needed in the future |
70 | 70 | */ |
71 | 71 | public function __construct( $id_base, $name, $action_options = array(), $control_options = array() ) { |
72 | - if ( ! defined('ABSPATH') ) { |
|
73 | - die('You are not allowed to call this page directly.'); |
|
72 | + if ( ! defined( 'ABSPATH' ) ) { |
|
73 | + die( 'You are not allowed to call this page directly.' ); |
|
74 | 74 | } |
75 | 75 | |
76 | - $this->id_base = strtolower($id_base); |
|
76 | + $this->id_base = strtolower( $id_base ); |
|
77 | 77 | $this->name = $name; |
78 | 78 | $this->option_name = 'frm_' . $this->id_base . '_action'; |
79 | 79 | |
@@ -143,10 +143,10 @@ discard block |
||
143 | 143 | $default_values = $this->get_global_defaults(); |
144 | 144 | |
145 | 145 | // fill default values |
146 | - $post_content = wp_parse_args( $post_content, $default_values); |
|
146 | + $post_content = wp_parse_args( $post_content, $default_values ); |
|
147 | 147 | |
148 | - if ( ! isset($post_content['event']) && ! $this->action_options['force_event'] ) { |
|
149 | - $post_content['event'] = array( reset($this->action_options['event']) ); |
|
148 | + if ( ! isset( $post_content['event'] ) && ! $this->action_options['force_event'] ) { |
|
149 | + $post_content['event'] = array( reset( $this->action_options['event'] ) ); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | $form_action = array( |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | 'post_name' => $this->form_id . '_' . $this->id_base . '_' . $this->number, |
160 | 160 | 'menu_order' => $this->form_id, |
161 | 161 | ); |
162 | - unset($post_content); |
|
162 | + unset( $post_content ); |
|
163 | 163 | |
164 | 164 | return (object) $form_action; |
165 | 165 | } |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | |
170 | 170 | $action = $this->prepare_new(); |
171 | 171 | |
172 | - return $this->save_settings($action); |
|
172 | + return $this->save_settings( $action ); |
|
173 | 173 | } |
174 | 174 | |
175 | 175 | public function duplicate_form_actions( $form_id, $old_id ) { |
@@ -183,8 +183,8 @@ discard block |
||
183 | 183 | |
184 | 184 | $this->form_id = $form_id; |
185 | 185 | foreach ( $actions as $action ) { |
186 | - $this->duplicate_one($action, $form_id); |
|
187 | - unset($action); |
|
186 | + $this->duplicate_one( $action, $form_id ); |
|
187 | + unset( $action ); |
|
188 | 188 | } |
189 | 189 | } |
190 | 190 | |
@@ -196,14 +196,14 @@ discard block |
||
196 | 196 | * @return integer $post_id |
197 | 197 | */ |
198 | 198 | public function maybe_create_action( $action, $forms ) { |
199 | - if ( isset( $action['ID'] ) && is_numeric( $action['ID'] ) && $forms[ $action['menu_order'] ] == 'updated' ) { |
|
199 | + if ( isset( $action['ID'] ) && is_numeric( $action['ID'] ) && $forms[$action['menu_order']] == 'updated' ) { |
|
200 | 200 | // Update action only |
201 | 201 | $action['post_content'] = FrmAppHelper::maybe_json_decode( $action['post_content'] ); |
202 | 202 | $post_id = $this->save_settings( $action ); |
203 | 203 | } else { |
204 | 204 | // Create action |
205 | - $action['post_content'] = FrmAppHelper::maybe_json_decode($action['post_content']); |
|
206 | - $post_id = $this->duplicate_one( (object) $action, $action['menu_order']); |
|
205 | + $action['post_content'] = FrmAppHelper::maybe_json_decode( $action['post_content'] ); |
|
206 | + $post_id = $this->duplicate_one( (object) $action, $action['menu_order'] ); |
|
207 | 207 | } |
208 | 208 | return $post_id; |
209 | 209 | } |
@@ -214,47 +214,47 @@ discard block |
||
214 | 214 | $action->menu_order = $form_id; |
215 | 215 | $switch = $this->get_global_switch_fields(); |
216 | 216 | foreach ( (array) $action->post_content as $key => $val ) { |
217 | - if ( is_numeric( $val ) && isset( $frm_duplicate_ids[ $val ] ) ) { |
|
218 | - $action->post_content[ $key ] = $frm_duplicate_ids[ $val ]; |
|
217 | + if ( is_numeric( $val ) && isset( $frm_duplicate_ids[$val] ) ) { |
|
218 | + $action->post_content[$key] = $frm_duplicate_ids[$val]; |
|
219 | 219 | } else if ( ! is_array( $val ) ) { |
220 | - $action->post_content[ $key ] = FrmFieldsHelper::switch_field_ids( $val ); |
|
221 | - } else if ( isset( $switch[ $key ] ) && is_array( $switch[ $key ] ) ) { |
|
220 | + $action->post_content[$key] = FrmFieldsHelper::switch_field_ids( $val ); |
|
221 | + } else if ( isset( $switch[$key] ) && is_array( $switch[$key] ) ) { |
|
222 | 222 | // loop through each value if empty |
223 | - if ( empty( $switch[ $key ] ) ) { |
|
224 | - $switch[ $key ] = array_keys( $val ); |
|
223 | + if ( empty( $switch[$key] ) ) { |
|
224 | + $switch[$key] = array_keys( $val ); |
|
225 | 225 | } |
226 | 226 | |
227 | - foreach ( $switch[ $key ] as $subkey ) { |
|
228 | - $action->post_content[ $key ] = $this->duplicate_array_walk( $action->post_content[ $key ], $subkey, $val ); |
|
227 | + foreach ( $switch[$key] as $subkey ) { |
|
228 | + $action->post_content[$key] = $this->duplicate_array_walk( $action->post_content[$key], $subkey, $val ); |
|
229 | 229 | } |
230 | 230 | } |
231 | 231 | |
232 | - unset($key, $val); |
|
232 | + unset( $key, $val ); |
|
233 | 233 | } |
234 | - unset($action->ID); |
|
234 | + unset( $action->ID ); |
|
235 | 235 | |
236 | - return $this->save_settings($action); |
|
236 | + return $this->save_settings( $action ); |
|
237 | 237 | } |
238 | 238 | |
239 | 239 | private function duplicate_array_walk( $action, $subkey, $val ) { |
240 | 240 | global $frm_duplicate_ids; |
241 | 241 | |
242 | - if ( is_array($subkey) ) { |
|
242 | + if ( is_array( $subkey ) ) { |
|
243 | 243 | foreach ( $subkey as $subkey2 ) { |
244 | 244 | foreach ( (array) $val as $ck => $cv ) { |
245 | - if ( is_array($cv) ) { |
|
246 | - $action[ $ck ] = $this->duplicate_array_walk( $action[ $ck ], $subkey2, $cv ); |
|
247 | - } else if ( isset( $cv[ $subkey ] ) && is_numeric( $cv[ $subkey ] ) && isset( $frm_duplicate_ids[ $cv[ $subkey ] ] ) ) { |
|
248 | - $action[ $ck ][ $subkey ] = $frm_duplicate_ids[ $cv[ $subkey ] ]; |
|
245 | + if ( is_array( $cv ) ) { |
|
246 | + $action[$ck] = $this->duplicate_array_walk( $action[$ck], $subkey2, $cv ); |
|
247 | + } else if ( isset( $cv[$subkey] ) && is_numeric( $cv[$subkey] ) && isset( $frm_duplicate_ids[$cv[$subkey]] ) ) { |
|
248 | + $action[$ck][$subkey] = $frm_duplicate_ids[$cv[$subkey]]; |
|
249 | 249 | } |
250 | 250 | } |
251 | 251 | } |
252 | 252 | } else { |
253 | 253 | foreach ( (array) $val as $ck => $cv ) { |
254 | - if ( is_array($cv) ) { |
|
255 | - $action[ $ck ] = $this->duplicate_array_walk( $action[ $ck ], $subkey, $cv ); |
|
256 | - } else if ( $ck == $subkey && isset( $frm_duplicate_ids[ $cv ] ) ) { |
|
257 | - $action[ $ck ] = $frm_duplicate_ids[ $cv ]; |
|
254 | + if ( is_array( $cv ) ) { |
|
255 | + $action[$ck] = $this->duplicate_array_walk( $action[$ck], $subkey, $cv ); |
|
256 | + } else if ( $ck == $subkey && isset( $frm_duplicate_ids[$cv] ) ) { |
|
257 | + $action[$ck] = $frm_duplicate_ids[$cv]; |
|
258 | 258 | } |
259 | 259 | } |
260 | 260 | } |
@@ -278,8 +278,8 @@ discard block |
||
278 | 278 | return; |
279 | 279 | } |
280 | 280 | |
281 | - if ( isset( $_POST[ $this->option_name ] ) && is_array( $_POST[ $this->option_name ] ) ) { |
|
282 | - $settings = $_POST[ $this->option_name ]; |
|
281 | + if ( isset( $_POST[$this->option_name] ) && is_array( $_POST[$this->option_name] ) ) { |
|
282 | + $settings = $_POST[$this->option_name]; |
|
283 | 283 | } else { |
284 | 284 | return; |
285 | 285 | } |
@@ -287,19 +287,19 @@ discard block |
||
287 | 287 | $action_ids = array(); |
288 | 288 | |
289 | 289 | foreach ( $settings as $number => $new_instance ) { |
290 | - $this->_set($number); |
|
290 | + $this->_set( $number ); |
|
291 | 291 | |
292 | - if ( ! isset($new_instance['post_title']) ) { |
|
292 | + if ( ! isset( $new_instance['post_title'] ) ) { |
|
293 | 293 | // settings were never opened, so don't update |
294 | 294 | $action_ids[] = $new_instance['ID']; |
295 | 295 | $this->updated = true; |
296 | 296 | continue; |
297 | 297 | } |
298 | 298 | |
299 | - $old_instance = isset( $all_instances[ $number ] ) ? $all_instances[ $number ] : array(); |
|
299 | + $old_instance = isset( $all_instances[$number] ) ? $all_instances[$number] : array(); |
|
300 | 300 | |
301 | - $new_instance['post_type'] = FrmFormActionsController::$action_post_type; |
|
302 | - $new_instance['post_name'] = $this->form_id . '_' . $this->id_base . '_' . $this->number; |
|
301 | + $new_instance['post_type'] = FrmFormActionsController::$action_post_type; |
|
302 | + $new_instance['post_name'] = $this->form_id . '_' . $this->id_base . '_' . $this->number; |
|
303 | 303 | $new_instance['menu_order'] = $this->form_id; |
304 | 304 | $new_instance['post_status'] = 'publish'; |
305 | 305 | $new_instance['post_date'] = isset( $old_instance->post_date ) ? $old_instance->post_date : ''; |
@@ -321,14 +321,14 @@ discard block |
||
321 | 321 | */ |
322 | 322 | $instance = apply_filters( 'frm_action_update_callback', $instance, $new_instance, $old_instance, $this ); |
323 | 323 | |
324 | - $instance['post_content'] = apply_filters('frm_before_save_action', $instance['post_content'], $instance, $new_instance, $old_instance, $this); |
|
324 | + $instance['post_content'] = apply_filters( 'frm_before_save_action', $instance['post_content'], $instance, $new_instance, $old_instance, $this ); |
|
325 | 325 | $instance['post_content'] = apply_filters( 'frm_before_save_' . $this->id_base . '_action', $new_instance['post_content'], $instance, $new_instance, $old_instance, $this ); |
326 | 326 | |
327 | 327 | if ( false !== $instance ) { |
328 | - $all_instances[ $number ] = $instance; |
|
328 | + $all_instances[$number] = $instance; |
|
329 | 329 | } |
330 | 330 | |
331 | - $action_ids[] = $this->save_settings($instance); |
|
331 | + $action_ids[] = $this->save_settings( $instance ); |
|
332 | 332 | |
333 | 333 | $this->updated = true; |
334 | 334 | } |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | } |
343 | 343 | |
344 | 344 | public function get_single_action( $id ) { |
345 | - $action = get_post($id); |
|
345 | + $action = get_post( $id ); |
|
346 | 346 | if ( $action ) { |
347 | 347 | $action = $this->prepare_action( $action ); |
348 | 348 | $this->_set( $id ); |
@@ -351,12 +351,12 @@ discard block |
||
351 | 351 | } |
352 | 352 | |
353 | 353 | public function get_one( $form_id ) { |
354 | - return $this->get_all($form_id, 1); |
|
354 | + return $this->get_all( $form_id, 1 ); |
|
355 | 355 | } |
356 | 356 | |
357 | 357 | public static function get_action_for_form( $form_id, $type = 'all', $limit = 99 ) { |
358 | 358 | $action_controls = FrmFormActionsController::get_form_actions( $type ); |
359 | - if ( empty($action_controls) ) { |
|
359 | + if ( empty( $action_controls ) ) { |
|
360 | 360 | // don't continue if there are no available actions |
361 | 361 | return array(); |
362 | 362 | } |
@@ -377,12 +377,12 @@ discard block |
||
377 | 377 | // some plugins/themes are formatting the post_excerpt |
378 | 378 | $action->post_excerpt = sanitize_title( $action->post_excerpt ); |
379 | 379 | |
380 | - if ( ! isset( $action_controls[ $action->post_excerpt ] ) ) { |
|
380 | + if ( ! isset( $action_controls[$action->post_excerpt] ) ) { |
|
381 | 381 | continue; |
382 | 382 | } |
383 | 383 | |
384 | - $action = $action_controls[ $action->post_excerpt ]->prepare_action( $action ); |
|
385 | - $settings[ $action->ID ] = $action; |
|
384 | + $action = $action_controls[$action->post_excerpt]->prepare_action( $action ); |
|
385 | + $settings[$action->ID] = $action; |
|
386 | 386 | |
387 | 387 | if ( count( $settings ) >= $limit ) { |
388 | 388 | break; |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | } |
391 | 391 | |
392 | 392 | if ( 1 === $limit ) { |
393 | - $settings = reset($settings); |
|
393 | + $settings = reset( $settings ); |
|
394 | 394 | } |
395 | 395 | |
396 | 396 | return $settings; |
@@ -423,33 +423,33 @@ discard block |
||
423 | 423 | global $frm_vars; |
424 | 424 | $frm_vars['action_type'] = $type; |
425 | 425 | |
426 | - add_filter( 'posts_where' , 'FrmFormActionsController::limit_by_type' ); |
|
426 | + add_filter( 'posts_where', 'FrmFormActionsController::limit_by_type' ); |
|
427 | 427 | $query = self::action_args( $form_id, $limit ); |
428 | 428 | $query['post_status'] = 'any'; |
429 | 429 | $query['suppress_filters'] = false; |
430 | 430 | |
431 | 431 | $actions = FrmAppHelper::check_cache( serialize( $query ) . '_type_' . $type, 'frm_actions', $query, 'get_posts' ); |
432 | - unset($query); |
|
432 | + unset( $query ); |
|
433 | 433 | |
434 | - remove_filter( 'posts_where' , 'FrmFormActionsController::limit_by_type' ); |
|
434 | + remove_filter( 'posts_where', 'FrmFormActionsController::limit_by_type' ); |
|
435 | 435 | |
436 | - if ( empty($actions) ) { |
|
436 | + if ( empty( $actions ) ) { |
|
437 | 437 | return array(); |
438 | 438 | } |
439 | 439 | |
440 | 440 | $settings = array(); |
441 | 441 | foreach ( $actions as $action ) { |
442 | - if ( count($settings) >= $limit ) { |
|
442 | + if ( count( $settings ) >= $limit ) { |
|
443 | 443 | continue; |
444 | 444 | } |
445 | 445 | |
446 | - $action = $this->prepare_action($action); |
|
446 | + $action = $this->prepare_action( $action ); |
|
447 | 447 | |
448 | - $settings[ $action->ID ] = $action; |
|
448 | + $settings[$action->ID] = $action; |
|
449 | 449 | } |
450 | 450 | |
451 | 451 | if ( 1 === $limit ) { |
452 | - $settings = reset($settings); |
|
452 | + $settings = reset( $settings ); |
|
453 | 453 | } |
454 | 454 | |
455 | 455 | return $settings; |
@@ -472,7 +472,7 @@ discard block |
||
472 | 472 | } |
473 | 473 | |
474 | 474 | public function prepare_action( $action ) { |
475 | - $action->post_content = (array) FrmAppHelper::maybe_json_decode($action->post_content); |
|
475 | + $action->post_content = (array) FrmAppHelper::maybe_json_decode( $action->post_content ); |
|
476 | 476 | $action->post_excerpt = sanitize_title( $action->post_excerpt ); |
477 | 477 | |
478 | 478 | $default_values = $this->get_global_defaults(); |
@@ -481,16 +481,16 @@ discard block |
||
481 | 481 | $action->post_content += $default_values; |
482 | 482 | |
483 | 483 | foreach ( $default_values as $k => $vals ) { |
484 | - if ( is_array($vals) && ! empty($vals) ) { |
|
485 | - if ( 'event' == $k && ! $this->action_options['force_event'] && ! empty( $action->post_content[ $k ] ) ) { |
|
484 | + if ( is_array( $vals ) && ! empty( $vals ) ) { |
|
485 | + if ( 'event' == $k && ! $this->action_options['force_event'] && ! empty( $action->post_content[$k] ) ) { |
|
486 | 486 | continue; |
487 | 487 | } |
488 | - $action->post_content[ $k ] = wp_parse_args( $action->post_content[ $k ], $vals ); |
|
488 | + $action->post_content[$k] = wp_parse_args( $action->post_content[$k], $vals ); |
|
489 | 489 | } |
490 | 490 | } |
491 | 491 | |
492 | - if ( ! is_array($action->post_content['event']) ) { |
|
493 | - $action->post_content['event'] = explode(',', $action->post_content['event']); |
|
492 | + if ( ! is_array( $action->post_content['event'] ) ) { |
|
493 | + $action->post_content['event'] = explode( ',', $action->post_content['event'] ); |
|
494 | 494 | } |
495 | 495 | |
496 | 496 | return $action; |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | $post_ids = FrmDb::get_col( $wpdb->posts, $query, 'ID' ); |
513 | 513 | |
514 | 514 | foreach ( $post_ids as $id ) { |
515 | - wp_delete_post($id); |
|
515 | + wp_delete_post( $id ); |
|
516 | 516 | } |
517 | 517 | self::clear_cache(); |
518 | 518 | } |
@@ -533,11 +533,11 @@ discard block |
||
533 | 533 | public function get_global_defaults() { |
534 | 534 | $defaults = $this->get_defaults(); |
535 | 535 | |
536 | - if ( ! isset($defaults['event']) ) { |
|
536 | + if ( ! isset( $defaults['event'] ) ) { |
|
537 | 537 | $defaults['event'] = array( 'create' ); |
538 | 538 | } |
539 | 539 | |
540 | - if ( ! isset($defaults['conditions']) ) { |
|
540 | + if ( ! isset( $defaults['conditions'] ) ) { |
|
541 | 541 | $defaults['conditions'] = array( |
542 | 542 | 'send_stop' => '', |
543 | 543 | 'any_all' => '', |
@@ -557,18 +557,18 @@ discard block |
||
557 | 557 | * Migrate settings from form->options into new action. |
558 | 558 | */ |
559 | 559 | public function migrate_to_2( $form, $update = 'update' ) { |
560 | - $action = $this->prepare_new($form->id); |
|
561 | - $form->options = maybe_unserialize($form->options); |
|
560 | + $action = $this->prepare_new( $form->id ); |
|
561 | + $form->options = maybe_unserialize( $form->options ); |
|
562 | 562 | |
563 | 563 | // fill with existing options |
564 | 564 | foreach ( $action->post_content as $name => $val ) { |
565 | - if ( isset( $form->options[ $name ] ) ) { |
|
566 | - $action->post_content[ $name ] = $form->options[ $name ]; |
|
567 | - unset( $form->options[ $name ] ); |
|
565 | + if ( isset( $form->options[$name] ) ) { |
|
566 | + $action->post_content[$name] = $form->options[$name]; |
|
567 | + unset( $form->options[$name] ); |
|
568 | 568 | } |
569 | 569 | } |
570 | 570 | |
571 | - $action = $this->migrate_values($action, $form); |
|
571 | + $action = $this->migrate_values( $action, $form ); |
|
572 | 572 | |
573 | 573 | // check if action already exists |
574 | 574 | $post_id = get_posts( array( |
@@ -578,18 +578,18 @@ discard block |
||
578 | 578 | 'numberposts' => 1, |
579 | 579 | ) ); |
580 | 580 | |
581 | - if ( empty($post_id) ) { |
|
581 | + if ( empty( $post_id ) ) { |
|
582 | 582 | // create action now |
583 | - $post_id = $this->save_settings($action); |
|
583 | + $post_id = $this->save_settings( $action ); |
|
584 | 584 | } |
585 | 585 | |
586 | 586 | if ( $post_id && 'update' == $update ) { |
587 | 587 | global $wpdb; |
588 | - $form->options = maybe_serialize($form->options); |
|
588 | + $form->options = maybe_serialize( $form->options ); |
|
589 | 589 | |
590 | 590 | // update form options |
591 | 591 | $wpdb->update( $wpdb->prefix . 'frm_forms', array( 'options' => $form->options ), array( 'id' => $form->id ) ); |
592 | - wp_cache_delete( $form->id, 'frm_form'); |
|
592 | + wp_cache_delete( $form->id, 'frm_form' ); |
|
593 | 593 | } |
594 | 594 | |
595 | 595 | return $post_id; |
@@ -617,18 +617,18 @@ discard block |
||
617 | 617 | |
618 | 618 | $observed_value = self::get_value_from_entry( $entry, $condition['hide_field'] ); |
619 | 619 | |
620 | - $stop = FrmFieldsHelper::value_meets_condition($observed_value, $condition['hide_field_cond'], $condition['hide_opt']); |
|
620 | + $stop = FrmFieldsHelper::value_meets_condition( $observed_value, $condition['hide_field_cond'], $condition['hide_opt'] ); |
|
621 | 621 | |
622 | 622 | if ( $notification['conditions']['send_stop'] == 'send' ) { |
623 | 623 | $stop = $stop ? false : true; |
624 | 624 | } |
625 | 625 | |
626 | - $met[ $stop ] = $stop; |
|
626 | + $met[$stop] = $stop; |
|
627 | 627 | } |
628 | 628 | |
629 | 629 | if ( $notification['conditions']['any_all'] == 'all' && ! empty( $met ) && isset( $met[0] ) && isset( $met[1] ) ) { |
630 | - $stop = ($notification['conditions']['send_stop'] == 'send'); |
|
631 | - } else if ( $notification['conditions']['any_all'] == 'any' && $notification['conditions']['send_stop'] == 'send' && isset($met[0]) ) { |
|
630 | + $stop = ( $notification['conditions']['send_stop'] == 'send' ); |
|
631 | + } else if ( $notification['conditions']['any_all'] == 'any' && $notification['conditions']['send_stop'] == 'send' && isset( $met[0] ) ) { |
|
632 | 632 | $stop = false; |
633 | 633 | } |
634 | 634 | |
@@ -665,8 +665,8 @@ discard block |
||
665 | 665 | private static function get_value_from_entry( $entry, $field_id ) { |
666 | 666 | $observed_value = ''; |
667 | 667 | |
668 | - if ( isset( $entry->metas[ $field_id ] ) ) { |
|
669 | - $observed_value = $entry->metas[ $field_id ]; |
|
668 | + if ( isset( $entry->metas[$field_id] ) ) { |
|
669 | + $observed_value = $entry->metas[$field_id]; |
|
670 | 670 | } else if ( $entry->post_id && FrmAppHelper::pro_is_installed() ) { |
671 | 671 | $field = FrmField::getOne( $field_id ); |
672 | 672 | $observed_value = FrmProEntryMetaHelper::get_post_or_meta_value( $entry, $field, array( 'links' => false, 'truncate' => false ) ); |