@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | |
150 | 150 | // Build total for each currency. |
151 | 151 | foreach ( $payment_data['total'] as $currency => $amount ) { |
152 | - $stats[ 'payments_total_' . $currency ] = array( |
|
152 | + $stats['payments_total_' . $currency] = array( |
|
153 | 153 | // translators: currency name. |
154 | 154 | 'label' => sprintf( __( 'Total %s', 'formidable' ), strtoupper( $currency ) ), |
155 | 155 | 'count' => $amount, |
@@ -171,23 +171,23 @@ discard block |
||
171 | 171 | |
172 | 172 | // Compare total for each currency. |
173 | 173 | foreach ( $payment_data['total'] as $currency => $amount ) { |
174 | - if ( ! isset( $prev_payment_data['total'][ $currency ] ) ) { |
|
175 | - $stats[ 'payments_total_' . $currency ]['compare'] = 1; |
|
174 | + if ( ! isset( $prev_payment_data['total'][$currency] ) ) { |
|
175 | + $stats['payments_total_' . $currency]['compare'] = 1; |
|
176 | 176 | continue; |
177 | 177 | } |
178 | 178 | |
179 | - $stats[ 'payments_total_' . $currency ]['compare'] = $this->get_compare_diff( $amount, $prev_payment_data['total'][ $currency ] ); |
|
180 | - unset( $prev_payment_data['total'][ $currency ] ); |
|
179 | + $stats['payments_total_' . $currency]['compare'] = $this->get_compare_diff( $amount, $prev_payment_data['total'][$currency] ); |
|
180 | + unset( $prev_payment_data['total'][$currency] ); |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | // If prev month has more currencies. |
184 | 184 | foreach ( $prev_payment_data['total'] as $currency => $amount ) { |
185 | - $stats[ 'payments_total_' . $currency ] = array( |
|
185 | + $stats['payments_total_' . $currency] = array( |
|
186 | 186 | // translators: currency name. |
187 | 187 | 'label' => sprintf( __( 'Total %s', 'formidable' ), strtoupper( $currency ) ), |
188 | 188 | 'count' => 0, |
189 | 189 | 'display' => $this->get_formatted_price( 0, $currency ), |
190 | - 'compare' => -1, |
|
190 | + 'compare' => - 1, |
|
191 | 191 | ); |
192 | 192 | } |
193 | 193 | }//end if |
@@ -44,8 +44,8 @@ discard block |
||
44 | 44 | * @param array $atts |
45 | 45 | */ |
46 | 46 | private function _set( $param, $atts ) { |
47 | - if ( isset( $atts[ $param ] ) ) { |
|
48 | - $this->{$param} = $atts[ $param ]; |
|
47 | + if ( isset( $atts[$param] ) ) { |
|
48 | + $this->{$param} = $atts[$param]; |
|
49 | 49 | } |
50 | 50 | } |
51 | 51 | |
@@ -89,8 +89,8 @@ discard block |
||
89 | 89 | |
90 | 90 | $exclude = array( 'field_obj', 'html' ); |
91 | 91 | foreach ( $exclude as $ex ) { |
92 | - if ( isset( $atts[ $ex ] ) ) { |
|
93 | - unset( $this->pass_args[ $ex ] ); |
|
92 | + if ( isset( $atts[$ex] ) ) { |
|
93 | + unset( $this->pass_args[$ex] ); |
|
94 | 94 | } |
95 | 95 | } |
96 | 96 | } |
@@ -102,8 +102,8 @@ discard block |
||
102 | 102 | * @param array $set |
103 | 103 | */ |
104 | 104 | private function set_from_field( $atts, $set ) { |
105 | - if ( isset( $atts[ $set['param'] ] ) ) { |
|
106 | - $this->{$set['param']} = $atts[ $set['param'] ]; |
|
105 | + if ( isset( $atts[$set['param']] ) ) { |
|
106 | + $this->{$set['param']} = $atts[$set['param']]; |
|
107 | 107 | } else { |
108 | 108 | $this->{$set['param']} = $this->field_obj->get_field_column( $set['default'] ); |
109 | 109 | } |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | */ |
231 | 231 | private function replace_error_shortcode() { |
232 | 232 | $this->maybe_add_error_id(); |
233 | - $error = isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ? $this->pass_args['errors'][ 'field' . $this->field_id ] : false; |
|
233 | + $error = isset( $this->pass_args['errors']['field' . $this->field_id] ) ? $this->pass_args['errors']['field' . $this->field_id] : false; |
|
234 | 234 | |
235 | 235 | if ( ! empty( $error ) && false === strpos( $this->html, 'role="alert"' ) && FrmAppHelper::should_include_alert_role_on_field_errors() ) { |
236 | 236 | $error_body = self::get_error_body( $this->html ); |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | * @since 3.06.02 |
272 | 272 | */ |
273 | 273 | private function maybe_add_error_id() { |
274 | - if ( ! isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ) { |
|
274 | + if ( ! isset( $this->pass_args['errors']['field' . $this->field_id] ) ) { |
|
275 | 275 | return; |
276 | 276 | } |
277 | 277 | |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | preg_match_all( "/\[(input|deletelink)\b(.*?)(?:(\/))?\]/s", $this->html, $shortcodes, PREG_PATTERN_ORDER ); |
352 | 352 | |
353 | 353 | foreach ( $shortcodes[0] as $short_key => $tag ) { |
354 | - $shortcode_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][ $short_key ] ); |
|
354 | + $shortcode_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][$short_key] ); |
|
355 | 355 | $tag = FrmShortcodeHelper::get_shortcode_tag( $shortcodes, $short_key ); |
356 | 356 | |
357 | 357 | $replace_with = ''; |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | $replace_with = $this->replace_input_shortcode( $shortcode_atts ); |
363 | 363 | } |
364 | 364 | |
365 | - $this->html = str_replace( $shortcodes[0][ $short_key ], $replace_with, $this->html ); |
|
365 | + $this->html = str_replace( $shortcodes[0][$short_key], $replace_with, $this->html ); |
|
366 | 366 | } |
367 | 367 | } |
368 | 368 | |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | */ |
385 | 385 | private function prepare_input_shortcode_atts( $shortcode_atts ) { |
386 | 386 | if ( isset( $shortcode_atts['opt'] ) ) { |
387 | - --$shortcode_atts['opt']; |
|
387 | + -- $shortcode_atts['opt']; |
|
388 | 388 | } |
389 | 389 | |
390 | 390 | $field_class = isset( $shortcode_atts['class'] ) ? $shortcode_atts['class'] : ''; |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | unset( $shortcode_atts['class'] ); |
395 | 395 | } |
396 | 396 | |
397 | - $shortcode_atts['aria-invalid'] = isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ? 'true' : 'false'; |
|
397 | + $shortcode_atts['aria-invalid'] = isset( $this->pass_args['errors']['field' . $this->field_id] ) ? 'true' : 'false'; |
|
398 | 398 | |
399 | 399 | $this->field_obj->set_field_column( 'shortcodes', $shortcode_atts ); |
400 | 400 | |
@@ -446,7 +446,7 @@ discard block |
||
446 | 446 | */ |
447 | 447 | private function get_field_div_classes() { |
448 | 448 | // Add error class |
449 | - $classes = isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ? ' frm_blank_field' : ''; |
|
449 | + $classes = isset( $this->pass_args['errors']['field' . $this->field_id] ) ? ' frm_blank_field' : ''; |
|
450 | 450 | |
451 | 451 | // Add label position class |
452 | 452 | $settings = $this->field_obj->display_field_settings(); |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | |
145 | 145 | foreach ( $pass_settings as $setting ) { |
146 | 146 | if ( isset( $settings_list->$setting ) ) { |
147 | - $settings[ $setting ] = $this->maybe_json( $settings_list->$setting ); |
|
147 | + $settings[$setting] = $this->maybe_json( $settings_list->$setting ); |
|
148 | 148 | } |
149 | 149 | } |
150 | 150 | |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | |
179 | 179 | $message_settings = array(); |
180 | 180 | foreach ( $messages as $message ) { |
181 | - $message_settings[ $message ] = $settings_list->$message; |
|
181 | + $message_settings[$message] = $settings_list->$message; |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | return $message_settings; |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | |
199 | 199 | foreach ( $frm_roles as $frm_role => $frm_role_description ) { |
200 | 200 | if ( isset( $settings_list->$frm_role ) ) { |
201 | - $permissions[ $frm_role ] = $settings_list->$frm_role; |
|
201 | + $permissions[$frm_role] = $settings_list->$frm_role; |
|
202 | 202 | } |
203 | 203 | } |
204 | 204 | |
@@ -268,8 +268,8 @@ discard block |
||
268 | 268 | ); |
269 | 269 | |
270 | 270 | foreach ( $settings as $setting ) { |
271 | - if ( isset( $form->options[ $setting ] ) ) { |
|
272 | - $new_form[ $setting ] = $this->maybe_json( $form->options[ $setting ] ); |
|
271 | + if ( isset( $form->options[$setting] ) ) { |
|
272 | + $new_form[$setting] = $this->maybe_json( $form->options[$setting] ); |
|
273 | 273 | } |
274 | 274 | } |
275 | 275 | |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | $fields = FrmDb::get_results( 'frm_fields', array(), 'form_id, name, type, field_options', $args ); |
329 | 329 | foreach ( $fields as $k => $field ) { |
330 | 330 | FrmAppHelper::unserialize_or_decode( $field->field_options ); |
331 | - $fields[ $k ]->field_options = json_encode( $field->field_options ); |
|
331 | + $fields[$k]->field_options = json_encode( $field->field_options ); |
|
332 | 332 | } |
333 | 333 | return $fields; |
334 | 334 | } |
@@ -80,20 +80,20 @@ discard block |
||
80 | 80 | 'name' => sprintf( |
81 | 81 | /* translators: Formidable addon name */ |
82 | 82 | esc_html_x( 'Formidable %s', 'Formidable Addon Name', 'formidable' ), |
83 | - $addon_list[ $matching_addon ]['name'] |
|
83 | + $addon_list[$matching_addon]['name'] |
|
84 | 84 | ), |
85 | - 'addon' => $addon_list[ $matching_addon ]['slug'], |
|
86 | - 'short_description' => $addon_list[ $matching_addon ]['excerpt'], |
|
85 | + 'addon' => $addon_list[$matching_addon]['slug'], |
|
86 | + 'short_description' => $addon_list[$matching_addon]['excerpt'], |
|
87 | 87 | 'slug' => self::$slug, |
88 | - 'version' => $addon_list[ $matching_addon ]['version'], |
|
88 | + 'version' => $addon_list[$matching_addon]['version'], |
|
89 | 89 | ); |
90 | 90 | |
91 | - if ( ! empty( $addon_list[ $matching_addon ]['external'] ) ) { |
|
91 | + if ( ! empty( $addon_list[$matching_addon]['external'] ) ) { |
|
92 | 92 | unset( $overrides['name'] ); |
93 | 93 | } |
94 | 94 | |
95 | 95 | // Splice in the base addon data. |
96 | - $inject = array_merge( $inject, $addon_list[ $matching_addon ], $overrides ); |
|
96 | + $inject = array_merge( $inject, $addon_list[$matching_addon], $overrides ); |
|
97 | 97 | |
98 | 98 | // Add it to the top of the list. |
99 | 99 | array_unshift( $result->plugins, $inject ); |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | // Plugin installed, active, feature not enabled; prompt to enable. |
309 | 309 | if ( ! $is_active && $is_installed ) { |
310 | 310 | if ( current_user_can( 'activate_plugins' ) ) { |
311 | - $activate_url = add_query_arg( |
|
311 | + $activate_url = add_query_arg( |
|
312 | 312 | array( |
313 | 313 | 'action' => 'activate', |
314 | 314 | '_wpnonce' => wp_create_nonce( 'activate-plugin_' . $plugin['plugin'] ), |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | */ |
353 | 353 | protected function is_installed( $plugin ) { |
354 | 354 | $all_plugins = FrmAppHelper::get_plugins(); |
355 | - return isset( $all_plugins[ $plugin ] ); |
|
355 | + return isset( $all_plugins[$plugin] ); |
|
356 | 356 | } |
357 | 357 | |
358 | 358 | /** |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | |
95 | 95 | $templates = $this->get_api_info(); |
96 | 96 | $contact_form = 20872734; |
97 | - return isset( $templates[ $contact_form ] ) && ! empty( $templates[ $contact_form ]['url'] ); |
|
97 | + return isset( $templates[$contact_form] ) && ! empty( $templates[$contact_form]['url'] ); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | /** |
@@ -169,15 +169,15 @@ discard block |
||
169 | 169 | continue; |
170 | 170 | } |
171 | 171 | |
172 | - $data['urlByKey'][ $template['key'] ] = $template['url']; |
|
172 | + $data['urlByKey'][$template['key']] = $template['url']; |
|
173 | 173 | } |
174 | 174 | |
175 | - if ( ! isset( $data['urlByKey'][ $key ] ) ) { |
|
175 | + if ( ! isset( $data['urlByKey'][$key] ) ) { |
|
176 | 176 | $error = new WP_Error( 400, 'We were unable to retrieve the template' ); |
177 | 177 | wp_send_json_error( $error ); |
178 | 178 | } |
179 | 179 | |
180 | - $data['url'] = $data['urlByKey'][ $key ]; |
|
180 | + $data['url'] = $data['urlByKey'][$key]; |
|
181 | 181 | }//end if |
182 | 182 | |
183 | 183 | wp_send_json_success( $data ); |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | $metas = FrmEntryMeta::get_entry_meta_info( $entry_exist ); |
81 | 81 | $field_metas = array(); |
82 | 82 | foreach ( $metas as $meta ) { |
83 | - $field_metas[ $meta->field_id ] = $meta->meta_value; |
|
83 | + $field_metas[$meta->field_id] = $meta->meta_value; |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | $filtered_vals = array_filter( $values['item_meta'] ); |
@@ -136,10 +136,10 @@ discard block |
||
136 | 136 | $reduced = array(); |
137 | 137 | foreach ( $filter_vals as $field_id => $value ) { |
138 | 138 | $field = FrmFieldFactory::get_field_object( $field_id ); |
139 | - $reduced[ $field_id ] = $field->get_value_to_save( $value, array( 'entry_id' => $entry_id ) ); |
|
140 | - $reduced[ $field_id ] = $field->set_value_before_save( $reduced[ $field_id ] ); |
|
141 | - if ( '' === $reduced[ $field_id ] || ( is_array( $reduced[ $field_id ] ) && 0 === count( $reduced[ $field_id ] ) ) ) { |
|
142 | - unset( $reduced[ $field_id ] ); |
|
139 | + $reduced[$field_id] = $field->get_value_to_save( $value, array( 'entry_id' => $entry_id ) ); |
|
140 | + $reduced[$field_id] = $field->set_value_before_save( $reduced[$field_id] ); |
|
141 | + if ( '' === $reduced[$field_id] || ( is_array( $reduced[$field_id] ) && 0 === count( $reduced[$field_id] ) ) ) { |
|
142 | + unset( $reduced[$field_id] ); |
|
143 | 143 | } |
144 | 144 | } |
145 | 145 | return $reduced; |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | private static function prepare_entries( &$entries ) { |
402 | 402 | foreach ( $entries as $k => $entry ) { |
403 | 403 | self::prepare_entry( $entry ); |
404 | - $entries[ $k ] = $entry; |
|
404 | + $entries[$k] = $entry; |
|
405 | 405 | } |
406 | 406 | } |
407 | 407 | |
@@ -427,19 +427,19 @@ discard block |
||
427 | 427 | FrmFieldsHelper::prepare_field_value( $meta_val->meta_value, $meta_val->type ); |
428 | 428 | |
429 | 429 | if ( $meta_val->item_id == $entry->id ) { |
430 | - $entry->metas[ $meta_val->field_id ] = $meta_val->meta_value; |
|
430 | + $entry->metas[$meta_val->field_id] = $meta_val->meta_value; |
|
431 | 431 | if ( $include_key ) { |
432 | - $entry->metas[ $meta_val->field_key ] = $entry->metas[ $meta_val->field_id ]; |
|
432 | + $entry->metas[$meta_val->field_key] = $entry->metas[$meta_val->field_id]; |
|
433 | 433 | } |
434 | 434 | continue; |
435 | 435 | } |
436 | 436 | |
437 | 437 | // include sub entries in an array |
438 | - if ( ! isset( $entry->metas[ $meta_val->field_id ] ) ) { |
|
439 | - $entry->metas[ $meta_val->field_id ] = array(); |
|
438 | + if ( ! isset( $entry->metas[$meta_val->field_id] ) ) { |
|
439 | + $entry->metas[$meta_val->field_id] = array(); |
|
440 | 440 | } |
441 | 441 | |
442 | - $entry->metas[ $meta_val->field_id ][] = $meta_val->meta_value; |
|
442 | + $entry->metas[$meta_val->field_id][] = $meta_val->meta_value; |
|
443 | 443 | |
444 | 444 | unset( $meta_val ); |
445 | 445 | } |
@@ -534,16 +534,16 @@ discard block |
||
534 | 534 | } |
535 | 535 | |
536 | 536 | foreach ( $metas as $m_key => $meta_val ) { |
537 | - if ( ! isset( $entries[ $meta_val->item_id ] ) ) { |
|
537 | + if ( ! isset( $entries[$meta_val->item_id] ) ) { |
|
538 | 538 | continue; |
539 | 539 | } |
540 | 540 | |
541 | - if ( ! isset( $entries[ $meta_val->item_id ]->metas ) ) { |
|
542 | - $entries[ $meta_val->item_id ]->metas = array(); |
|
541 | + if ( ! isset( $entries[$meta_val->item_id]->metas ) ) { |
|
542 | + $entries[$meta_val->item_id]->metas = array(); |
|
543 | 543 | } |
544 | 544 | |
545 | 545 | FrmFieldsHelper::prepare_field_value( $meta_val->meta_value, $meta_val->type ); |
546 | - $entries[ $meta_val->item_id ]->metas[ $meta_val->field_id ] = $meta_val->meta_value; |
|
546 | + $entries[$meta_val->item_id]->metas[$meta_val->field_id] = $meta_val->meta_value; |
|
547 | 547 | unset( $m_key, $meta_val ); |
548 | 548 | } |
549 | 549 | |
@@ -725,7 +725,7 @@ discard block |
||
725 | 725 | } |
726 | 726 | |
727 | 727 | private static function get_entry_value( $values, $name, $default ) { |
728 | - return isset( $values[ $name ] ) ? $values[ $name ] : $default; |
|
728 | + return isset( $values[$name] ) ? $values[$name] : $default; |
|
729 | 729 | } |
730 | 730 | |
731 | 731 | /** |
@@ -910,7 +910,7 @@ discard block |
||
910 | 910 | private static function maybe_add_captcha_meta( $form_id, $entry_id ) { |
911 | 911 | global $frm_vars; |
912 | 912 | if ( array_key_exists( 'captcha_scores', $frm_vars ) && array_key_exists( $form_id, $frm_vars['captcha_scores'] ) ) { |
913 | - $captcha_score_meta = array( 'captcha_score' => $frm_vars['captcha_scores'][ $form_id ] ); |
|
913 | + $captcha_score_meta = array( 'captcha_score' => $frm_vars['captcha_scores'][$form_id] ); |
|
914 | 914 | FrmEntryMeta::add_entry_meta( $entry_id, 0, '', maybe_serialize( $captcha_score_meta ) ); |
915 | 915 | } |
916 | 916 | } |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | private function update_next_execution_time() { |
86 | 86 | $config_option_name = $this->config['config-option-name']; |
87 | 87 | |
88 | - $this->options_data[ $config_option_name ] = $this->get_next_execution(); |
|
88 | + $this->options_data[$config_option_name] = $this->get_next_execution(); |
|
89 | 89 | $this->update_options_data(); |
90 | 90 | } |
91 | 91 | |
@@ -104,11 +104,11 @@ discard block |
||
104 | 104 | * @return bool |
105 | 105 | */ |
106 | 106 | private function is_time_to_execute() { |
107 | - if ( ! isset( $this->options_data[ $this->config['config-option-name'] ] ) ) { |
|
107 | + if ( ! isset( $this->options_data[$this->config['config-option-name']] ) ) { |
|
108 | 108 | return true; |
109 | 109 | } |
110 | 110 | |
111 | - $options = $this->options_data[ $this->config['config-option-name'] ]; |
|
111 | + $options = $this->options_data[$this->config['config-option-name']]; |
|
112 | 112 | |
113 | 113 | return ! ( isset( $options['timestamp'] ) && (int) $options['timestamp'] > $this->get_time() ); |
114 | 114 | } |
@@ -208,9 +208,9 @@ discard block |
||
208 | 208 | $groups = FrmFormActionsController::form_action_groups(); |
209 | 209 | $group = 'misc'; |
210 | 210 | |
211 | - if ( isset( $action_options['group'] ) && isset( $groups[ $action_options['group'] ] ) ) { |
|
211 | + if ( isset( $action_options['group'] ) && isset( $groups[$action_options['group']] ) ) { |
|
212 | 212 | $group = $action_options['group']; |
213 | - } elseif ( isset( $groups[ $this->id_base ] ) ) { |
|
213 | + } elseif ( isset( $groups[$this->id_base] ) ) { |
|
214 | 214 | $group = $this->id_base; |
215 | 215 | } else { |
216 | 216 | foreach ( $groups as $name => $check_group ) { |
@@ -221,8 +221,8 @@ discard block |
||
221 | 221 | } |
222 | 222 | } |
223 | 223 | |
224 | - $groups[ $group ]['id'] = $group; |
|
225 | - return $groups[ $group ]; |
|
224 | + $groups[$group]['id'] = $group; |
|
225 | + return $groups[$group]; |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | /** |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | * @return int $post_id |
334 | 334 | */ |
335 | 335 | public function maybe_create_action( $action, $forms ) { |
336 | - if ( isset( $action['ID'] ) && is_numeric( $action['ID'] ) && isset( $forms[ $action['menu_order'] ] ) && $forms[ $action['menu_order'] ] == 'updated' ) { |
|
336 | + if ( isset( $action['ID'] ) && is_numeric( $action['ID'] ) && isset( $forms[$action['menu_order']] ) && $forms[$action['menu_order']] == 'updated' ) { |
|
337 | 337 | // Update action only |
338 | 338 | $action['post_content'] = FrmAppHelper::maybe_json_decode( $action['post_content'] ); |
339 | 339 | $post_id = $this->save_settings( $action ); |
@@ -356,18 +356,18 @@ discard block |
||
356 | 356 | $switch = $this->get_global_switch_fields(); |
357 | 357 | |
358 | 358 | foreach ( (array) $action->post_content as $key => $val ) { |
359 | - if ( is_numeric( $val ) && isset( $frm_duplicate_ids[ $val ] ) ) { |
|
360 | - $action->post_content[ $key ] = $frm_duplicate_ids[ $val ]; |
|
359 | + if ( is_numeric( $val ) && isset( $frm_duplicate_ids[$val] ) ) { |
|
360 | + $action->post_content[$key] = $frm_duplicate_ids[$val]; |
|
361 | 361 | } elseif ( ! is_array( $val ) ) { |
362 | - $action->post_content[ $key ] = FrmFieldsHelper::switch_field_ids( $val ); |
|
363 | - } elseif ( isset( $switch[ $key ] ) && is_array( $switch[ $key ] ) ) { |
|
362 | + $action->post_content[$key] = FrmFieldsHelper::switch_field_ids( $val ); |
|
363 | + } elseif ( isset( $switch[$key] ) && is_array( $switch[$key] ) ) { |
|
364 | 364 | // loop through each value if empty |
365 | - if ( empty( $switch[ $key ] ) ) { |
|
366 | - $switch[ $key ] = array_keys( $val ); |
|
365 | + if ( empty( $switch[$key] ) ) { |
|
366 | + $switch[$key] = array_keys( $val ); |
|
367 | 367 | } |
368 | 368 | |
369 | - foreach ( $switch[ $key ] as $subkey ) { |
|
370 | - $action->post_content[ $key ] = $this->duplicate_array_walk( $action->post_content[ $key ], $subkey, $val ); |
|
369 | + foreach ( $switch[$key] as $subkey ) { |
|
370 | + $action->post_content[$key] = $this->duplicate_array_walk( $action->post_content[$key], $subkey, $val ); |
|
371 | 371 | } |
372 | 372 | } |
373 | 373 | |
@@ -385,20 +385,20 @@ discard block |
||
385 | 385 | foreach ( $subkey as $subkey2 ) { |
386 | 386 | foreach ( (array) $val as $ck => $cv ) { |
387 | 387 | if ( is_array( $cv ) ) { |
388 | - $action[ $ck ] = $this->duplicate_array_walk( $action[ $ck ], $subkey2, $cv ); |
|
389 | - } elseif ( isset( $cv[ $subkey ] ) && is_numeric( $cv[ $subkey ] ) && isset( $frm_duplicate_ids[ $cv[ $subkey ] ] ) ) { |
|
390 | - $action[ $ck ][ $subkey ] = $frm_duplicate_ids[ $cv[ $subkey ] ]; |
|
388 | + $action[$ck] = $this->duplicate_array_walk( $action[$ck], $subkey2, $cv ); |
|
389 | + } elseif ( isset( $cv[$subkey] ) && is_numeric( $cv[$subkey] ) && isset( $frm_duplicate_ids[$cv[$subkey]] ) ) { |
|
390 | + $action[$ck][$subkey] = $frm_duplicate_ids[$cv[$subkey]]; |
|
391 | 391 | } |
392 | 392 | } |
393 | 393 | } |
394 | 394 | } else { |
395 | 395 | foreach ( (array) $val as $ck => $cv ) { |
396 | 396 | if ( is_array( $cv ) ) { |
397 | - $action[ $ck ] = $this->duplicate_array_walk( $action[ $ck ], $subkey, $cv ); |
|
398 | - } elseif ( $ck == $subkey && isset( $frm_duplicate_ids[ $cv ] ) ) { |
|
399 | - $action[ $ck ] = $frm_duplicate_ids[ $cv ]; |
|
397 | + $action[$ck] = $this->duplicate_array_walk( $action[$ck], $subkey, $cv ); |
|
398 | + } elseif ( $ck == $subkey && isset( $frm_duplicate_ids[$cv] ) ) { |
|
399 | + $action[$ck] = $frm_duplicate_ids[$cv]; |
|
400 | 400 | } elseif ( $ck == $subkey ) { |
401 | - $action[ $ck ] = $this->maybe_switch_field_ids( $action[ $ck ] ); |
|
401 | + $action[$ck] = $this->maybe_switch_field_ids( $action[$ck] ); |
|
402 | 402 | } |
403 | 403 | } |
404 | 404 | }//end if |
@@ -422,10 +422,10 @@ discard block |
||
422 | 422 | } |
423 | 423 | |
424 | 424 | // phpcs:ignore WordPress.Security.NonceVerification.Missing |
425 | - if ( isset( $_POST[ $this->option_name ] ) && is_array( $_POST[ $this->option_name ] ) ) { |
|
425 | + if ( isset( $_POST[$this->option_name] ) && is_array( $_POST[$this->option_name] ) ) { |
|
426 | 426 | // Sanitizing removes scripts and <email> type of values. |
427 | 427 | // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
428 | - $settings = wp_unslash( $_POST[ $this->option_name ] ); |
|
428 | + $settings = wp_unslash( $_POST[$this->option_name] ); |
|
429 | 429 | } else { |
430 | 430 | return; |
431 | 431 | } |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | foreach ( $settings as $number => $new_instance ) { |
436 | 436 | $this->_set( $number ); |
437 | 437 | |
438 | - $old_instance = isset( $all_instances[ $number ] ) ? $all_instances[ $number ] : array(); |
|
438 | + $old_instance = isset( $all_instances[$number] ) ? $all_instances[$number] : array(); |
|
439 | 439 | |
440 | 440 | if ( ! isset( $new_instance['post_status'] ) ) { |
441 | 441 | $new_instance['post_status'] = 'draft'; |
@@ -473,7 +473,7 @@ discard block |
||
473 | 473 | $instance['post_content'] = apply_filters( 'frm_before_save_' . $this->id_base . '_action', $instance['post_content'], $instance, $new_instance, $old_instance, $this ); |
474 | 474 | |
475 | 475 | if ( false !== $instance ) { |
476 | - $all_instances[ $number ] = $instance; |
|
476 | + $all_instances[$number] = $instance; |
|
477 | 477 | } |
478 | 478 | |
479 | 479 | $action_ids[] = $this->save_settings( $instance ); |
@@ -555,12 +555,12 @@ discard block |
||
555 | 555 | // some plugins/themes are formatting the post_excerpt |
556 | 556 | $action->post_excerpt = sanitize_title( $action->post_excerpt ); |
557 | 557 | |
558 | - if ( ! isset( $action_controls[ $action->post_excerpt ] ) ) { |
|
558 | + if ( ! isset( $action_controls[$action->post_excerpt] ) ) { |
|
559 | 559 | continue; |
560 | 560 | } |
561 | 561 | |
562 | - $action = $action_controls[ $action->post_excerpt ]->prepare_action( $action ); |
|
563 | - $settings[ $action->ID ] = $action; |
|
562 | + $action = $action_controls[$action->post_excerpt]->prepare_action( $action ); |
|
563 | + $settings[$action->ID] = $action; |
|
564 | 564 | |
565 | 565 | if ( count( $settings ) >= $limit ) { |
566 | 566 | break; |
@@ -593,7 +593,7 @@ discard block |
||
593 | 593 | 'limit' => 99, |
594 | 594 | 'post_status' => $default_status, |
595 | 595 | ); |
596 | - $args = wp_parse_args( $args, $defaults ); |
|
596 | + $args = wp_parse_args( $args, $defaults ); |
|
597 | 597 | } |
598 | 598 | |
599 | 599 | /** |
@@ -659,7 +659,7 @@ discard block |
||
659 | 659 | |
660 | 660 | $action = $this->prepare_action( $action ); |
661 | 661 | |
662 | - $settings[ $action->ID ] = $action; |
|
662 | + $settings[$action->ID] = $action; |
|
663 | 663 | } |
664 | 664 | |
665 | 665 | if ( 1 === $limit ) { |
@@ -702,10 +702,10 @@ discard block |
||
702 | 702 | |
703 | 703 | foreach ( $default_values as $k => $vals ) { |
704 | 704 | if ( is_array( $vals ) && ! empty( $vals ) ) { |
705 | - if ( 'event' === $k && ! $this->action_options['force_event'] && ! empty( $action->post_content[ $k ] ) ) { |
|
705 | + if ( 'event' === $k && ! $this->action_options['force_event'] && ! empty( $action->post_content[$k] ) ) { |
|
706 | 706 | continue; |
707 | 707 | } |
708 | - $action->post_content[ $k ] = wp_parse_args( $action->post_content[ $k ], $vals ); |
|
708 | + $action->post_content[$k] = wp_parse_args( $action->post_content[$k], $vals ); |
|
709 | 709 | } |
710 | 710 | } |
711 | 711 | |
@@ -793,9 +793,9 @@ discard block |
||
793 | 793 | |
794 | 794 | // fill with existing options |
795 | 795 | foreach ( $action->post_content as $name => $val ) { |
796 | - if ( isset( $form->options[ $name ] ) ) { |
|
797 | - $action->post_content[ $name ] = $form->options[ $name ]; |
|
798 | - unset( $form->options[ $name ] ); |
|
796 | + if ( isset( $form->options[$name] ) ) { |
|
797 | + $action->post_content[$name] = $form->options[$name]; |
|
798 | + unset( $form->options[$name] ); |
|
799 | 799 | } |
800 | 800 | } |
801 | 801 | |
@@ -861,7 +861,7 @@ discard block |
||
861 | 861 | $stop = $stop ? false : true; |
862 | 862 | } |
863 | 863 | |
864 | - $met[ $stop ] = $stop; |
|
864 | + $met[$stop] = $stop; |
|
865 | 865 | }//end foreach |
866 | 866 | |
867 | 867 | if ( $notification['conditions']['any_all'] == 'all' && ! empty( $met ) && isset( $met[0] ) && isset( $met[1] ) ) { |
@@ -915,8 +915,8 @@ discard block |
||
915 | 915 | private static function get_value_from_entry( $entry, $field_id ) { |
916 | 916 | $observed_value = ''; |
917 | 917 | |
918 | - if ( isset( $entry->metas[ $field_id ] ) ) { |
|
919 | - $observed_value = $entry->metas[ $field_id ]; |
|
918 | + if ( isset( $entry->metas[$field_id] ) ) { |
|
919 | + $observed_value = $entry->metas[$field_id]; |
|
920 | 920 | } elseif ( $entry->post_id && FrmAppHelper::pro_is_installed() ) { |
921 | 921 | $field = FrmField::getOne( $field_id ); |
922 | 922 | $observed_value = FrmProEntryMetaHelper::get_post_or_meta_value( |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | $to = $this->prepare_email_setting( $this->settings['email_to'], $user_id_args ); |
163 | 163 | $to = $this->explode_emails( $to ); |
164 | 164 | |
165 | - $where = array( |
|
165 | + $where = array( |
|
166 | 166 | 'it.field_id !' => 0, |
167 | 167 | 'it.item_id' => $this->entry->id, |
168 | 168 | ); |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | 'entry' => $this->entry, |
173 | 173 | 'form' => $this->form, |
174 | 174 | ); |
175 | - $to = apply_filters( 'frm_to_email', $to, $values, $this->form->id, $args ); |
|
175 | + $to = apply_filters( 'frm_to_email', $to, $values, $this->form->id, $args ); |
|
176 | 176 | |
177 | 177 | $this->to = array_unique( (array) $to ); |
178 | 178 | |
@@ -702,11 +702,11 @@ discard block |
||
702 | 702 | $name = trim( str_replace( $email, '', $val ) ); |
703 | 703 | } else { |
704 | 704 | // If user enters a name without an email |
705 | - unset( $recipients[ $key ] ); |
|
705 | + unset( $recipients[$key] ); |
|
706 | 706 | continue; |
707 | 707 | } |
708 | 708 | |
709 | - $recipients[ $key ] = $this->format_from_email( $name, $email ); |
|
709 | + $recipients[$key] = $this->format_from_email( $name, $email ); |
|
710 | 710 | }//end foreach |
711 | 711 | |
712 | 712 | return $recipients; |
@@ -856,7 +856,7 @@ discard block |
||
856 | 856 | ); |
857 | 857 | |
858 | 858 | // Remove phone number from to addresses |
859 | - unset( $this->to[ $key ] ); |
|
859 | + unset( $this->to[$key] ); |
|
860 | 860 | }//end if |
861 | 861 | }//end foreach |
862 | 862 | } |