@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | $new_values['field_key'] = FrmAppHelper::get_unique_key( $key, $wpdb->prefix . 'frm_fields', 'field_key' ); |
184 | 184 | |
185 | 185 | foreach ( array( 'name', 'description', 'type', 'default_value' ) as $col ) { |
186 | - $new_values[ $col ] = $values[ $col ]; |
|
186 | + $new_values[$col] = $values[$col]; |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | $new_values['options'] = $values['options']; |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | $new_values['created_at'] = current_time( 'mysql', 1 ); |
196 | 196 | |
197 | 197 | if ( isset( $values['id'] ) ) { |
198 | - $frm_duplicate_ids[ $values['field_key'] ] = $new_values['field_key']; |
|
198 | + $frm_duplicate_ids[$values['field_key']] = $new_values['field_key']; |
|
199 | 199 | $new_values = apply_filters( 'frm_duplicated_field', $new_values ); |
200 | 200 | } |
201 | 201 | |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | |
204 | 204 | foreach ( $new_values as $k => $v ) { |
205 | 205 | if ( is_array( $v ) ) { |
206 | - $new_values[ $k ] = serialize( $v ); |
|
206 | + $new_values[$k] = serialize( $v ); |
|
207 | 207 | } |
208 | 208 | unset( $k, $v ); |
209 | 209 | } |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | |
225 | 225 | if ( $query_results ) { |
226 | 226 | if ( isset( $values['id'] ) ) { |
227 | - $frm_duplicate_ids[ $values['id'] ] = $new_id; |
|
227 | + $frm_duplicate_ids[$values['id']] = $new_id; |
|
228 | 228 | } |
229 | 229 | |
230 | 230 | return $new_id; |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | public static function duplicate( $old_form_id, $form_id, $copy_keys = false, $blog_id = false ) { |
237 | 237 | global $frm_duplicate_ids; |
238 | 238 | |
239 | - $where = array( |
|
239 | + $where = array( |
|
240 | 240 | array( |
241 | 241 | 'or' => 1, |
242 | 242 | 'fi.form_id' => $old_form_id, |
@@ -282,8 +282,8 @@ discard block |
||
282 | 282 | |
283 | 283 | $values = apply_filters( 'frm_duplicated_field', $values ); |
284 | 284 | $new_id = self::create( $values ); |
285 | - $frm_duplicate_ids[ $field->id ] = $new_id; |
|
286 | - $frm_duplicate_ids[ $field->field_key ] = $new_id; |
|
285 | + $frm_duplicate_ids[$field->id] = $new_id; |
|
286 | + $frm_duplicate_ids[$field->field_key] = $new_id; |
|
287 | 287 | unset( $field ); |
288 | 288 | } |
289 | 289 | } |
@@ -314,8 +314,8 @@ discard block |
||
314 | 314 | |
315 | 315 | // serialize array values |
316 | 316 | foreach ( array( 'default_value', 'field_options', 'options' ) as $opt ) { |
317 | - if ( isset( $values[ $opt ] ) && is_array( $values[ $opt ] ) ) { |
|
318 | - $values[ $opt ] = serialize( $values[ $opt ] ); |
|
317 | + if ( isset( $values[$opt] ) && is_array( $values[$opt] ) ) { |
|
318 | + $values[$opt] = serialize( $values[$opt] ); |
|
319 | 319 | } |
320 | 320 | } |
321 | 321 | |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | 'id' => $id, |
465 | 465 | 'field_key' => $id, |
466 | 466 | ); |
467 | - $type = FrmDb::get_var( 'frm_fields', $where, $col ); |
|
467 | + $type = FrmDb::get_var( 'frm_fields', $where, $col ); |
|
468 | 468 | } |
469 | 469 | |
470 | 470 | return $type; |
@@ -490,7 +490,7 @@ discard block |
||
490 | 490 | continue; |
491 | 491 | } |
492 | 492 | |
493 | - $fields[ $result->id ] = $result; |
|
493 | + $fields[$result->id] = $result; |
|
494 | 494 | $count ++; |
495 | 495 | if ( $limit == 1 ) { |
496 | 496 | $fields = $result; |
@@ -536,7 +536,7 @@ discard block |
||
536 | 536 | $count = 0; |
537 | 537 | foreach ( $results as $result ) { |
538 | 538 | $count ++; |
539 | - $fields[ $result->id ] = $result; |
|
539 | + $fields[$result->id] = $result; |
|
540 | 540 | if ( ! empty( $limit ) && $count >= $limit ) { |
541 | 541 | break; |
542 | 542 | } |
@@ -599,7 +599,7 @@ discard block |
||
599 | 599 | } |
600 | 600 | |
601 | 601 | if ( ! empty( $sub_fields ) ) { |
602 | - $index = $k + $index_offset; |
|
602 | + $index = $k + $index_offset; |
|
603 | 603 | $index_offset += count( $sub_fields ); |
604 | 604 | array_splice( $results, $index, 0, $sub_fields ); |
605 | 605 | } |
@@ -644,7 +644,7 @@ discard block |
||
644 | 644 | $query_type = ( $limit == ' LIMIT 1' || $limit == 1 ) ? 'row' : 'results'; |
645 | 645 | |
646 | 646 | if ( is_array( $where ) ) { |
647 | - $args = array( |
|
647 | + $args = array( |
|
648 | 648 | 'order_by' => $order_by, |
649 | 649 | 'limit' => $limit, |
650 | 650 | ); |
@@ -674,9 +674,9 @@ discard block |
||
674 | 674 | FrmDb::set_cache( $result->id, $result, 'frm_field' ); |
675 | 675 | FrmDb::set_cache( $result->field_key, $result, 'frm_field' ); |
676 | 676 | |
677 | - $results[ $r_key ]->field_options = maybe_unserialize( $result->field_options ); |
|
678 | - $results[ $r_key ]->options = maybe_unserialize( $result->options ); |
|
679 | - $results[ $r_key ]->default_value = maybe_unserialize( $result->default_value ); |
|
677 | + $results[$r_key]->field_options = maybe_unserialize( $result->field_options ); |
|
678 | + $results[$r_key]->options = maybe_unserialize( $result->options ); |
|
679 | + $results[$r_key]->default_value = maybe_unserialize( $result->default_value ); |
|
680 | 680 | |
681 | 681 | unset( $r_key, $result ); |
682 | 682 | } |
@@ -873,23 +873,23 @@ discard block |
||
873 | 873 | } |
874 | 874 | |
875 | 875 | public static function is_option_true_in_array( $field, $option ) { |
876 | - return isset( $field[ $option ] ) && $field[ $option ]; |
|
876 | + return isset( $field[$option] ) && $field[$option]; |
|
877 | 877 | } |
878 | 878 | |
879 | 879 | public static function is_option_true_in_object( $field, $option ) { |
880 | - return isset( $field->field_options[ $option ] ) && $field->field_options[ $option ]; |
|
880 | + return isset( $field->field_options[$option] ) && $field->field_options[$option]; |
|
881 | 881 | } |
882 | 882 | |
883 | 883 | public static function is_option_empty_in_array( $field, $option ) { |
884 | - return ! isset( $field[ $option ] ) || empty( $field[ $option ] ); |
|
884 | + return ! isset( $field[$option] ) || empty( $field[$option] ); |
|
885 | 885 | } |
886 | 886 | |
887 | 887 | public static function is_option_empty_in_object( $field, $option ) { |
888 | - return ! isset( $field->field_options[ $option ] ) || empty( $field->field_options[ $option ] ); |
|
888 | + return ! isset( $field->field_options[$option] ) || empty( $field->field_options[$option] ); |
|
889 | 889 | } |
890 | 890 | |
891 | 891 | public static function is_option_value_in_object( $field, $option ) { |
892 | - return isset( $field->field_options[ $option ] ) && $field->field_options[ $option ] != ''; |
|
892 | + return isset( $field->field_options[$option] ) && $field->field_options[$option] != ''; |
|
893 | 893 | } |
894 | 894 | |
895 | 895 | /** |
@@ -906,11 +906,11 @@ discard block |
||
906 | 906 | } |
907 | 907 | |
908 | 908 | public static function get_option_in_array( $field, $option ) { |
909 | - return isset( $field[ $option ] ) ? $field[ $option ] : ''; |
|
909 | + return isset( $field[$option] ) ? $field[$option] : ''; |
|
910 | 910 | } |
911 | 911 | |
912 | 912 | public static function get_option_in_object( $field, $option ) { |
913 | - return isset( $field->field_options[ $option ] ) ? $field->field_options[ $option ] : ''; |
|
913 | + return isset( $field->field_options[$option] ) ? $field->field_options[$option] : ''; |
|
914 | 914 | } |
915 | 915 | |
916 | 916 | /** |
@@ -149,8 +149,8 @@ discard block |
||
149 | 149 | } |
150 | 150 | |
151 | 151 | foreach ( $settings as $setting => $default ) { |
152 | - if ( isset( $params[ 'frm_' . $setting ] ) ) { |
|
153 | - $this->{$setting} = $params[ 'frm_' . $setting ]; |
|
152 | + if ( isset( $params['frm_' . $setting] ) ) { |
|
153 | + $this->{$setting} = $params['frm_' . $setting]; |
|
154 | 154 | } elseif ( ! isset( $this->{$setting} ) ) { |
155 | 155 | $this->{$setting} = $default; |
156 | 156 | } |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | |
256 | 256 | $checkboxes = array( 'mu_menu', 're_multi', 'use_html', 'jquery_css', 'accordion_js', 'fade_form', 'old_css', 'no_ips', 'tracking' ); |
257 | 257 | foreach ( $checkboxes as $set ) { |
258 | - $this->$set = isset( $params[ 'frm_' . $set ] ) ? $params[ 'frm_' . $set ] : 0; |
|
258 | + $this->$set = isset( $params['frm_' . $set] ) ? $params['frm_' . $set] : 0; |
|
259 | 259 | } |
260 | 260 | } |
261 | 261 | |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | $frm_roles = FrmAppHelper::frm_capabilities(); |
266 | 266 | $roles = get_editable_roles(); |
267 | 267 | foreach ( $frm_roles as $frm_role => $frm_role_description ) { |
268 | - $this->$frm_role = (array) ( isset( $params[ $frm_role ] ) ? $params[ $frm_role ] : 'administrator' ); |
|
268 | + $this->$frm_role = (array) ( isset( $params[$frm_role] ) ? $params[$frm_role] : 'administrator' ); |
|
269 | 269 | |
270 | 270 | // Make sure administrators always have permissions |
271 | 271 | if ( ! in_array( 'administrator', $this->$frm_role ) ) { |
@@ -56,7 +56,8 @@ discard block |
||
56 | 56 | } |
57 | 57 | |
58 | 58 | private function translate_settings( $settings ) { |
59 | - if ( $settings ) { //workaround for W3 total cache conflict |
|
59 | + if ( $settings ) { |
|
60 | +//workaround for W3 total cache conflict |
|
60 | 61 | return unserialize( serialize( $settings ) ); |
61 | 62 | } |
62 | 63 | |
@@ -68,7 +69,8 @@ discard block |
||
68 | 69 | } |
69 | 70 | |
70 | 71 | // If unserializing didn't work |
71 | - if ( $settings ) { //workaround for W3 total cache conflict |
|
72 | + if ( $settings ) { |
|
73 | +//workaround for W3 total cache conflict |
|
72 | 74 | $settings = unserialize( serialize( $settings ) ); |
73 | 75 | } else { |
74 | 76 | $settings = $this; |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | |
139 | 139 | foreach ( $values as $value_key => $value ) { |
140 | 140 | if ( $value_key && in_array( $value_key, $form_fields ) ) { |
141 | - $new_values[ $value_key ] = $value; |
|
141 | + $new_values[$value_key] = $value; |
|
142 | 142 | } |
143 | 143 | } |
144 | 144 | |
@@ -208,15 +208,15 @@ discard block |
||
208 | 208 | $existing_keys = array_keys( $values['item_meta'] ); |
209 | 209 | foreach ( $all_fields as $fid ) { |
210 | 210 | if ( ! in_array( $fid->id, $existing_keys ) && ( isset( $values['frm_fields_submitted'] ) && in_array( $fid->id, $values['frm_fields_submitted'] ) ) || isset( $values['options'] ) ) { |
211 | - $values['item_meta'][ $fid->id ] = ''; |
|
211 | + $values['item_meta'][$fid->id] = ''; |
|
212 | 212 | } |
213 | - $field_array[ $fid->id ] = $fid; |
|
213 | + $field_array[$fid->id] = $fid; |
|
214 | 214 | } |
215 | 215 | unset( $all_fields ); |
216 | 216 | |
217 | 217 | foreach ( $values['item_meta'] as $field_id => $default_value ) { |
218 | - if ( isset( $field_array[ $field_id ] ) ) { |
|
219 | - $field = $field_array[ $field_id ]; |
|
218 | + if ( isset( $field_array[$field_id] ) ) { |
|
219 | + $field = $field_array[$field_id]; |
|
220 | 220 | } else { |
221 | 221 | $field = FrmField::getOne( $field_id ); |
222 | 222 | } |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | continue; |
226 | 226 | } |
227 | 227 | |
228 | - $is_settings_page = ( isset( $values['options'] ) || isset( $values['field_options'][ 'custom_html_' . $field_id ] ) ); |
|
228 | + $is_settings_page = ( isset( $values['options'] ) || isset( $values['field_options']['custom_html_' . $field_id] ) ); |
|
229 | 229 | if ( $is_settings_page ) { |
230 | 230 | self::get_settings_page_html( $values, $field ); |
231 | 231 | |
@@ -240,15 +240,15 @@ discard block |
||
240 | 240 | $update_options = apply_filters( 'frm_field_options_to_update', $update_options ); |
241 | 241 | |
242 | 242 | foreach ( $update_options as $opt => $default ) { |
243 | - $field->field_options[ $opt ] = isset( $values['field_options'][ $opt . '_' . $field_id ] ) ? $values['field_options'][ $opt . '_' . $field_id ] : $default; |
|
244 | - self::sanitize_field_opt( $opt, $field->field_options[ $opt ] ); |
|
243 | + $field->field_options[$opt] = isset( $values['field_options'][$opt . '_' . $field_id] ) ? $values['field_options'][$opt . '_' . $field_id] : $default; |
|
244 | + self::sanitize_field_opt( $opt, $field->field_options[$opt] ); |
|
245 | 245 | } |
246 | 246 | |
247 | 247 | $field->field_options = apply_filters( 'frm_update_field_options', $field->field_options, $field, $values ); |
248 | 248 | |
249 | 249 | $new_field = array( |
250 | 250 | 'field_options' => $field->field_options, |
251 | - 'default_value' => isset( $values[ 'default_value_' . $field_id ] ) ? maybe_serialize( $values[ 'default_value_' . $field_id ] ) : '', |
|
251 | + 'default_value' => isset( $values['default_value_' . $field_id] ) ? maybe_serialize( $values['default_value_' . $field_id] ) : '', |
|
252 | 252 | ); |
253 | 253 | |
254 | 254 | self::prepare_field_update_values( $field, $values, $new_field ); |
@@ -277,11 +277,11 @@ discard block |
||
277 | 277 | * Updating the settings page |
278 | 278 | */ |
279 | 279 | private static function get_settings_page_html( $values, &$field ) { |
280 | - if ( isset( $values['field_options'][ 'custom_html_' . $field->id ] ) ) { |
|
280 | + if ( isset( $values['field_options']['custom_html_' . $field->id] ) ) { |
|
281 | 281 | $prev_opts = array(); |
282 | 282 | $fallback_html = isset( $field->field_options['custom_html'] ) ? $field->field_options['custom_html'] : FrmFieldsHelper::get_default_html( $field->type ); |
283 | 283 | |
284 | - $field->field_options['custom_html'] = isset( $values['field_options'][ 'custom_html_' . $field->id ] ) ? $values['field_options'][ 'custom_html_' . $field->id ] : $fallback_html; |
|
284 | + $field->field_options['custom_html'] = isset( $values['field_options']['custom_html_' . $field->id] ) ? $values['field_options']['custom_html_' . $field->id] : $fallback_html; |
|
285 | 285 | } elseif ( $field->type == 'hidden' || $field->type == 'user_id' ) { |
286 | 286 | $prev_opts = $field->field_options; |
287 | 287 | } |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | foreach ( $field_cols as $col => $default ) { |
308 | 308 | $default = ( $default === '' ) ? $field->{$col} : $default; |
309 | 309 | |
310 | - $new_field[ $col ] = isset( $values['field_options'][ $col . '_' . $field->id ] ) ? $values['field_options'][ $col . '_' . $field->id ] : $default; |
|
310 | + $new_field[$col] = isset( $values['field_options'][$col . '_' . $field->id] ) ? $values['field_options'][$col . '_' . $field->id] : $default; |
|
311 | 311 | } |
312 | 312 | |
313 | 313 | // Don't save the template option. |
@@ -721,8 +721,8 @@ discard block |
||
721 | 721 | self::maybe_get_form( $form ); |
722 | 722 | } |
723 | 723 | |
724 | - if ( isset( $frm_vars['form_params'] ) && is_array( $frm_vars['form_params'] ) && isset( $frm_vars['form_params'][ $form->id ] ) ) { |
|
725 | - return $frm_vars['form_params'][ $form->id ]; |
|
724 | + if ( isset( $frm_vars['form_params'] ) && is_array( $frm_vars['form_params'] ) && isset( $frm_vars['form_params'][$form->id] ) ) { |
|
725 | + return $frm_vars['form_params'][$form->id]; |
|
726 | 726 | } |
727 | 727 | |
728 | 728 | $action_var = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action'; // WPCS: CSRF ok. |
@@ -751,15 +751,15 @@ discard block |
||
751 | 751 | //if there are two forms on the same page, make sure not to submit both |
752 | 752 | foreach ( $default_values as $var => $default ) { |
753 | 753 | if ( $var == 'action' ) { |
754 | - $values[ $var ] = FrmAppHelper::get_param( $action_var, $default, 'get', 'sanitize_title' ); |
|
754 | + $values[$var] = FrmAppHelper::get_param( $action_var, $default, 'get', 'sanitize_title' ); |
|
755 | 755 | } else { |
756 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
756 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
757 | 757 | } |
758 | 758 | unset( $var, $default ); |
759 | 759 | } |
760 | 760 | } else { |
761 | 761 | foreach ( $default_values as $var => $default ) { |
762 | - $values[ $var ] = $default; |
|
762 | + $values[$var] = $default; |
|
763 | 763 | unset( $var, $default ); |
764 | 764 | } |
765 | 765 | } |
@@ -785,7 +785,7 @@ discard block |
||
785 | 785 | 'sdir' => '', |
786 | 786 | ); |
787 | 787 | foreach ( $defaults as $var => $default ) { |
788 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
788 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
789 | 789 | } |
790 | 790 | |
791 | 791 | return $values; |
@@ -813,7 +813,7 @@ discard block |
||
813 | 813 | 'keep_post' => '', |
814 | 814 | ); |
815 | 815 | foreach ( $defaults as $var => $default ) { |
816 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
816 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
817 | 817 | } |
818 | 818 | |
819 | 819 | return $values; |
@@ -898,7 +898,7 @@ discard block |
||
898 | 898 | public static function get_option( $atts ) { |
899 | 899 | $form = $atts['form']; |
900 | 900 | |
901 | - return isset( $form->options[ $atts['option'] ] ) ? $form->options[ $atts['option'] ] : $atts['default']; |
|
901 | + return isset( $form->options[$atts['option']] ) ? $form->options[$atts['option']] : $atts['default']; |
|
902 | 902 | } |
903 | 903 | |
904 | 904 | /** |
@@ -2,15 +2,15 @@ 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() |
|
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 |
|
12 | - public $number = false; // Unique ID number of the current instance. |
|
13 | - public $id = ''; // Unique ID string of the current instance (id_base-number) |
|
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 | 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. |
@@ -133,9 +133,9 @@ discard block |
||
133 | 133 | $groups = FrmFormActionsController::form_action_groups(); |
134 | 134 | $group = 'misc'; |
135 | 135 | |
136 | - if ( isset( $action_options['group'] ) && isset( $groups[ $action_options['group'] ] ) ) { |
|
136 | + if ( isset( $action_options['group'] ) && isset( $groups[$action_options['group']] ) ) { |
|
137 | 137 | $group = $action_options['group']; |
138 | - } elseif ( isset( $groups[ $this->id_base ] ) ) { |
|
138 | + } elseif ( isset( $groups[$this->id_base] ) ) { |
|
139 | 139 | $group = $this->id_base; |
140 | 140 | } else { |
141 | 141 | foreach ( $groups as $name => $check_group ) { |
@@ -146,8 +146,8 @@ discard block |
||
146 | 146 | } |
147 | 147 | } |
148 | 148 | |
149 | - $groups[ $group ]['id'] = $group; |
|
150 | - return $groups[ $group ]; |
|
149 | + $groups[$group]['id'] = $group; |
|
150 | + return $groups[$group]; |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | /** |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | * @return integer $post_id |
250 | 250 | */ |
251 | 251 | public function maybe_create_action( $action, $forms ) { |
252 | - if ( isset( $action['ID'] ) && is_numeric( $action['ID'] ) && isset( $forms[ $action['menu_order'] ] ) && $forms[ $action['menu_order'] ] == 'updated' ) { |
|
252 | + if ( isset( $action['ID'] ) && is_numeric( $action['ID'] ) && isset( $forms[$action['menu_order']] ) && $forms[$action['menu_order']] == 'updated' ) { |
|
253 | 253 | // Update action only |
254 | 254 | $action['post_content'] = FrmAppHelper::maybe_json_decode( $action['post_content'] ); |
255 | 255 | $post_id = $this->save_settings( $action ); |
@@ -268,18 +268,18 @@ discard block |
||
268 | 268 | $action->menu_order = $form_id; |
269 | 269 | $switch = $this->get_global_switch_fields(); |
270 | 270 | foreach ( (array) $action->post_content as $key => $val ) { |
271 | - if ( is_numeric( $val ) && isset( $frm_duplicate_ids[ $val ] ) ) { |
|
272 | - $action->post_content[ $key ] = $frm_duplicate_ids[ $val ]; |
|
271 | + if ( is_numeric( $val ) && isset( $frm_duplicate_ids[$val] ) ) { |
|
272 | + $action->post_content[$key] = $frm_duplicate_ids[$val]; |
|
273 | 273 | } elseif ( ! is_array( $val ) ) { |
274 | - $action->post_content[ $key ] = FrmFieldsHelper::switch_field_ids( $val ); |
|
275 | - } elseif ( isset( $switch[ $key ] ) && is_array( $switch[ $key ] ) ) { |
|
274 | + $action->post_content[$key] = FrmFieldsHelper::switch_field_ids( $val ); |
|
275 | + } elseif ( isset( $switch[$key] ) && is_array( $switch[$key] ) ) { |
|
276 | 276 | // loop through each value if empty |
277 | - if ( empty( $switch[ $key ] ) ) { |
|
278 | - $switch[ $key ] = array_keys( $val ); |
|
277 | + if ( empty( $switch[$key] ) ) { |
|
278 | + $switch[$key] = array_keys( $val ); |
|
279 | 279 | } |
280 | 280 | |
281 | - foreach ( $switch[ $key ] as $subkey ) { |
|
282 | - $action->post_content[ $key ] = $this->duplicate_array_walk( $action->post_content[ $key ], $subkey, $val ); |
|
281 | + foreach ( $switch[$key] as $subkey ) { |
|
282 | + $action->post_content[$key] = $this->duplicate_array_walk( $action->post_content[$key], $subkey, $val ); |
|
283 | 283 | } |
284 | 284 | } |
285 | 285 | |
@@ -297,18 +297,18 @@ discard block |
||
297 | 297 | foreach ( $subkey as $subkey2 ) { |
298 | 298 | foreach ( (array) $val as $ck => $cv ) { |
299 | 299 | if ( is_array( $cv ) ) { |
300 | - $action[ $ck ] = $this->duplicate_array_walk( $action[ $ck ], $subkey2, $cv ); |
|
301 | - } elseif ( isset( $cv[ $subkey ] ) && is_numeric( $cv[ $subkey ] ) && isset( $frm_duplicate_ids[ $cv[ $subkey ] ] ) ) { |
|
302 | - $action[ $ck ][ $subkey ] = $frm_duplicate_ids[ $cv[ $subkey ] ]; |
|
300 | + $action[$ck] = $this->duplicate_array_walk( $action[$ck], $subkey2, $cv ); |
|
301 | + } elseif ( isset( $cv[$subkey] ) && is_numeric( $cv[$subkey] ) && isset( $frm_duplicate_ids[$cv[$subkey]] ) ) { |
|
302 | + $action[$ck][$subkey] = $frm_duplicate_ids[$cv[$subkey]]; |
|
303 | 303 | } |
304 | 304 | } |
305 | 305 | } |
306 | 306 | } else { |
307 | 307 | foreach ( (array) $val as $ck => $cv ) { |
308 | 308 | if ( is_array( $cv ) ) { |
309 | - $action[ $ck ] = $this->duplicate_array_walk( $action[ $ck ], $subkey, $cv ); |
|
310 | - } elseif ( $ck == $subkey && isset( $frm_duplicate_ids[ $cv ] ) ) { |
|
311 | - $action[ $ck ] = $frm_duplicate_ids[ $cv ]; |
|
309 | + $action[$ck] = $this->duplicate_array_walk( $action[$ck], $subkey, $cv ); |
|
310 | + } elseif ( $ck == $subkey && isset( $frm_duplicate_ids[$cv] ) ) { |
|
311 | + $action[$ck] = $frm_duplicate_ids[$cv]; |
|
312 | 312 | } |
313 | 313 | } |
314 | 314 | } |
@@ -331,8 +331,8 @@ discard block |
||
331 | 331 | return; |
332 | 332 | } |
333 | 333 | |
334 | - if ( isset( $_POST[ $this->option_name ] ) && is_array( $_POST[ $this->option_name ] ) ) { |
|
335 | - $settings = wp_unslash( $_POST[ $this->option_name ] ); |
|
334 | + if ( isset( $_POST[$this->option_name] ) && is_array( $_POST[$this->option_name] ) ) { |
|
335 | + $settings = wp_unslash( $_POST[$this->option_name] ); |
|
336 | 336 | } else { |
337 | 337 | return; |
338 | 338 | } |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | foreach ( $settings as $number => $new_instance ) { |
343 | 343 | $this->_set( $number ); |
344 | 344 | |
345 | - $old_instance = isset( $all_instances[ $number ] ) ? $all_instances[ $number ] : array(); |
|
345 | + $old_instance = isset( $all_instances[$number] ) ? $all_instances[$number] : array(); |
|
346 | 346 | |
347 | 347 | if ( ! isset( $new_instance['post_status'] ) ) { |
348 | 348 | $new_instance['post_status'] = 'draft'; |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | $instance['post_content'] = apply_filters( 'frm_before_save_' . $this->id_base . '_action', $new_instance['post_content'], $instance, $new_instance, $old_instance, $this ); |
383 | 383 | |
384 | 384 | if ( false !== $instance ) { |
385 | - $all_instances[ $number ] = $instance; |
|
385 | + $all_instances[$number] = $instance; |
|
386 | 386 | } |
387 | 387 | |
388 | 388 | $action_ids[] = $this->save_settings( $instance ); |
@@ -458,12 +458,12 @@ discard block |
||
458 | 458 | // some plugins/themes are formatting the post_excerpt |
459 | 459 | $action->post_excerpt = sanitize_title( $action->post_excerpt ); |
460 | 460 | |
461 | - if ( ! isset( $action_controls[ $action->post_excerpt ] ) ) { |
|
461 | + if ( ! isset( $action_controls[$action->post_excerpt] ) ) { |
|
462 | 462 | continue; |
463 | 463 | } |
464 | 464 | |
465 | - $action = $action_controls[ $action->post_excerpt ]->prepare_action( $action ); |
|
466 | - $settings[ $action->ID ] = $action; |
|
465 | + $action = $action_controls[$action->post_excerpt]->prepare_action( $action ); |
|
466 | + $settings[$action->ID] = $action; |
|
467 | 467 | |
468 | 468 | if ( count( $settings ) >= $limit ) { |
469 | 469 | break; |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | 'limit' => 99, |
494 | 494 | 'post_status' => $default_status, |
495 | 495 | ); |
496 | - $args = wp_parse_args( $args, $defaults ); |
|
496 | + $args = wp_parse_args( $args, $defaults ); |
|
497 | 497 | } |
498 | 498 | |
499 | 499 | /** |
@@ -554,7 +554,7 @@ discard block |
||
554 | 554 | |
555 | 555 | $action = $this->prepare_action( $action ); |
556 | 556 | |
557 | - $settings[ $action->ID ] = $action; |
|
557 | + $settings[$action->ID] = $action; |
|
558 | 558 | } |
559 | 559 | |
560 | 560 | if ( 1 === $limit ) { |
@@ -591,10 +591,10 @@ discard block |
||
591 | 591 | |
592 | 592 | foreach ( $default_values as $k => $vals ) { |
593 | 593 | if ( is_array( $vals ) && ! empty( $vals ) ) { |
594 | - if ( 'event' == $k && ! $this->action_options['force_event'] && ! empty( $action->post_content[ $k ] ) ) { |
|
594 | + if ( 'event' == $k && ! $this->action_options['force_event'] && ! empty( $action->post_content[$k] ) ) { |
|
595 | 595 | continue; |
596 | 596 | } |
597 | - $action->post_content[ $k ] = wp_parse_args( $action->post_content[ $k ], $vals ); |
|
597 | + $action->post_content[$k] = wp_parse_args( $action->post_content[$k], $vals ); |
|
598 | 598 | } |
599 | 599 | } |
600 | 600 | |
@@ -672,9 +672,9 @@ discard block |
||
672 | 672 | |
673 | 673 | // fill with existing options |
674 | 674 | foreach ( $action->post_content as $name => $val ) { |
675 | - if ( isset( $form->options[ $name ] ) ) { |
|
676 | - $action->post_content[ $name ] = $form->options[ $name ]; |
|
677 | - unset( $form->options[ $name ] ); |
|
675 | + if ( isset( $form->options[$name] ) ) { |
|
676 | + $action->post_content[$name] = $form->options[$name]; |
|
677 | + unset( $form->options[$name] ); |
|
678 | 678 | } |
679 | 679 | } |
680 | 680 | |
@@ -735,7 +735,7 @@ discard block |
||
735 | 735 | $stop = $stop ? false : true; |
736 | 736 | } |
737 | 737 | |
738 | - $met[ $stop ] = $stop; |
|
738 | + $met[$stop] = $stop; |
|
739 | 739 | } |
740 | 740 | |
741 | 741 | if ( $notification['conditions']['any_all'] == 'all' && ! empty( $met ) && isset( $met[0] ) && isset( $met[1] ) ) { |
@@ -777,8 +777,8 @@ discard block |
||
777 | 777 | private static function get_value_from_entry( $entry, $field_id ) { |
778 | 778 | $observed_value = ''; |
779 | 779 | |
780 | - if ( isset( $entry->metas[ $field_id ] ) ) { |
|
781 | - $observed_value = $entry->metas[ $field_id ]; |
|
780 | + if ( isset( $entry->metas[$field_id] ) ) { |
|
781 | + $observed_value = $entry->metas[$field_id]; |
|
782 | 782 | } elseif ( $entry->post_id && FrmAppHelper::pro_is_installed() ) { |
783 | 783 | $field = FrmField::getOne( $field_id ); |
784 | 784 | $observed_value = FrmProEntryMetaHelper::get_post_or_meta_value( |
@@ -146,7 +146,7 @@ |
||
146 | 146 | |
147 | 147 | $next_dir = ''; |
148 | 148 | foreach ( $dir_names as $dir ) { |
149 | - $next_dir .= '/' . $dir; |
|
149 | + $next_dir .= '/' . $dir; |
|
150 | 150 | $needed_dirs[] = $this->uploads['basedir'] . $next_dir; |
151 | 151 | } |
152 | 152 |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | * @param array $atts |
72 | 72 | */ |
73 | 73 | private function init_style_settings( $atts ) { |
74 | - $style_settings = array( |
|
74 | + $style_settings = array( |
|
75 | 75 | 'border_color' => 'dddddd', |
76 | 76 | 'bg_color' => 'f7f7f7', |
77 | 77 | 'text_color' => '444444', |
@@ -82,12 +82,12 @@ discard block |
||
82 | 82 | $this->style_settings = apply_filters( 'frm_show_entry_styles', $style_settings ); |
83 | 83 | |
84 | 84 | foreach ( $this->style_settings as $key => $setting ) { |
85 | - if ( isset( $atts[ $key ] ) && $atts[ $key ] !== '' ) { |
|
86 | - $this->style_settings[ $key ] = $atts[ $key ]; |
|
85 | + if ( isset( $atts[$key] ) && $atts[$key] !== '' ) { |
|
86 | + $this->style_settings[$key] = $atts[$key]; |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | if ( $this->is_color_setting( $key ) ) { |
90 | - $this->style_settings[ $key ] = $this->get_color_markup( $this->style_settings[ $key ] ); |
|
90 | + $this->style_settings[$key] = $this->get_color_markup( $this->style_settings[$key] ); |
|
91 | 91 | } |
92 | 92 | } |
93 | 93 |
@@ -41,8 +41,8 @@ discard block |
||
41 | 41 | * @param array $atts |
42 | 42 | */ |
43 | 43 | private function _set( $param, $atts ) { |
44 | - if ( isset( $atts[ $param ] ) ) { |
|
45 | - $this->{$param} = $atts[ $param ]; |
|
44 | + if ( isset( $atts[$param] ) ) { |
|
45 | + $this->{$param} = $atts[$param]; |
|
46 | 46 | } |
47 | 47 | } |
48 | 48 | |
@@ -86,8 +86,8 @@ discard block |
||
86 | 86 | |
87 | 87 | $exclude = array( 'field_obj', 'html' ); |
88 | 88 | foreach ( $exclude as $ex ) { |
89 | - if ( isset( $atts[ $ex ] ) ) { |
|
90 | - unset( $this->pass_args[ $ex ] ); |
|
89 | + if ( isset( $atts[$ex] ) ) { |
|
90 | + unset( $this->pass_args[$ex] ); |
|
91 | 91 | } |
92 | 92 | } |
93 | 93 | } |
@@ -99,8 +99,8 @@ discard block |
||
99 | 99 | * @param array $set |
100 | 100 | */ |
101 | 101 | private function set_from_field( $atts, $set ) { |
102 | - if ( isset( $atts[ $set['param'] ] ) ) { |
|
103 | - $this->{$set['param']} = $atts[ $set['param'] ]; |
|
102 | + if ( isset( $atts[$set['param']] ) ) { |
|
103 | + $this->{$set['param']} = $atts[$set['param']]; |
|
104 | 104 | } else { |
105 | 105 | $this->{$set['param']} = $this->field_obj->get_field_column( $set['default'] ); |
106 | 106 | } |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | */ |
226 | 226 | private function replace_error_shortcode() { |
227 | 227 | $this->maybe_add_error_id(); |
228 | - $error = isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ? $this->pass_args['errors'][ 'field' . $this->field_id ] : false; |
|
228 | + $error = isset( $this->pass_args['errors']['field' . $this->field_id] ) ? $this->pass_args['errors']['field' . $this->field_id] : false; |
|
229 | 229 | FrmShortcodeHelper::remove_inline_conditions( ! empty( $error ), 'error', $error, $this->html ); |
230 | 230 | } |
231 | 231 | |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | * @since 3.06.02 |
237 | 237 | */ |
238 | 238 | private function maybe_add_error_id() { |
239 | - if ( ! isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ) { |
|
239 | + if ( ! isset( $this->pass_args['errors']['field' . $this->field_id] ) ) { |
|
240 | 240 | return; |
241 | 241 | } |
242 | 242 | |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | preg_match_all( "/\[(input|deletelink)\b(.*?)(?:(\/))?\]/s", $this->html, $shortcodes, PREG_PATTERN_ORDER ); |
317 | 317 | |
318 | 318 | foreach ( $shortcodes[0] as $short_key => $tag ) { |
319 | - $shortcode_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][ $short_key ] ); |
|
319 | + $shortcode_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][$short_key] ); |
|
320 | 320 | $tag = FrmShortcodeHelper::get_shortcode_tag( $shortcodes, $short_key ); |
321 | 321 | |
322 | 322 | $replace_with = ''; |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | $replace_with = $this->replace_input_shortcode( $shortcode_atts ); |
328 | 328 | } |
329 | 329 | |
330 | - $this->html = str_replace( $shortcodes[0][ $short_key ], $replace_with, $this->html ); |
|
330 | + $this->html = str_replace( $shortcodes[0][$short_key], $replace_with, $this->html ); |
|
331 | 331 | } |
332 | 332 | } |
333 | 333 | |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | unset( $shortcode_atts['class'] ); |
360 | 360 | } |
361 | 361 | |
362 | - if ( isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ) { |
|
362 | + if ( isset( $this->pass_args['errors']['field' . $this->field_id] ) ) { |
|
363 | 363 | $shortcode_atts['aria-invalid'] = 'true'; |
364 | 364 | } |
365 | 365 | |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | */ |
417 | 417 | private function get_field_div_classes() { |
418 | 418 | // Add error class |
419 | - $classes = isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ? ' frm_blank_field' : ''; |
|
419 | + $classes = isset( $this->pass_args['errors']['field' . $this->field_id] ) ? ' frm_blank_field' : ''; |
|
420 | 420 | |
421 | 421 | // Add label position class |
422 | 422 | $settings = $this->field_obj->display_field_settings(); |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | $to = $this->prepare_email_setting( $this->settings['email_to'], $user_id_args ); |
86 | 86 | $to = $this->explode_emails( $to ); |
87 | 87 | |
88 | - $where = array( |
|
88 | + $where = array( |
|
89 | 89 | 'it.field_id !' => 0, |
90 | 90 | 'it.item_id' => $this->entry->id, |
91 | 91 | ); |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | 'entry' => $this->entry, |
96 | 96 | 'form' => $this->form, |
97 | 97 | ); |
98 | - $to = apply_filters( 'frm_to_email', $to, $values, $this->form->id, $args ); |
|
98 | + $to = apply_filters( 'frm_to_email', $to, $values, $this->form->id, $args ); |
|
99 | 99 | |
100 | 100 | $this->to = array_unique( (array) $to ); |
101 | 101 | |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | |
299 | 299 | // Add the user info if it isn't already included |
300 | 300 | if ( $this->include_user_info && $prev_mail_body === $mail_body ) { |
301 | - $data = maybe_unserialize( $this->entry->description ); |
|
301 | + $data = maybe_unserialize( $this->entry->description ); |
|
302 | 302 | $mail_body .= "\r\n\r\n" . __( 'User Information', 'formidable' ) . "\r\n"; |
303 | 303 | $this->maybe_add_ip( $mail_body ); |
304 | 304 | $mail_body .= __( 'User-Agent (Browser/OS)', 'formidable' ) . ': ' . FrmEntriesHelper::get_browser( $data['browser'] ) . "\r\n"; |
@@ -563,12 +563,12 @@ discard block |
||
563 | 563 | $name = trim( str_replace( $email, '', $val ) ); |
564 | 564 | } else { |
565 | 565 | // If user enters a name without an email |
566 | - unset( $recipients[ $key ] ); |
|
566 | + unset( $recipients[$key] ); |
|
567 | 567 | continue; |
568 | 568 | } |
569 | 569 | } |
570 | 570 | |
571 | - $recipients[ $key ] = $this->format_from_email( $name, $email ); |
|
571 | + $recipients[$key] = $this->format_from_email( $name, $email ); |
|
572 | 572 | } |
573 | 573 | |
574 | 574 | return $recipients; |
@@ -709,7 +709,7 @@ discard block |
||
709 | 709 | ); |
710 | 710 | |
711 | 711 | // Remove phone number from to addresses |
712 | - unset( $this->to[ $key ] ); |
|
712 | + unset( $this->to[$key] ); |
|
713 | 713 | } |
714 | 714 | } |
715 | 715 | } |
@@ -59,8 +59,8 @@ |
||
59 | 59 | protected function init_saved_value( $entry ) { |
60 | 60 | if ( $this->field->type === 'html' ) { |
61 | 61 | $this->saved_value = $this->field->description; |
62 | - } elseif ( isset( $entry->metas[ $this->field->id ] ) ) { |
|
63 | - $this->saved_value = $entry->metas[ $this->field->id ]; |
|
62 | + } elseif ( isset( $entry->metas[$this->field->id] ) ) { |
|
63 | + $this->saved_value = $entry->metas[$this->field->id]; |
|
64 | 64 | } else { |
65 | 65 | $this->saved_value = ''; |
66 | 66 | } |