@@ -235,7 +235,7 @@ |
||
235 | 235 | if ( is_array( $upsell ) ) { |
236 | 236 | foreach ( $upsell as $k => $plugin ) { |
237 | 237 | if ( strpos( $plugin['slug'], 'wpforms' ) !== false ) { |
238 | - unset( $upsell[ $k ] ); |
|
238 | + unset( $upsell[$k] ); |
|
239 | 239 | } |
240 | 240 | } |
241 | 241 | } |
@@ -129,11 +129,11 @@ discard block |
||
129 | 129 | <?php } ?> |
130 | 130 | |
131 | 131 | .<?php echo esc_html( $style_class ); ?> .frm_icon_font.frm_minus_icon:before{ |
132 | - content:"\e<?php echo esc_html( isset( $minus_icons[ $repeat_icon ] ) ? $minus_icons[ $repeat_icon ]['-'] : $minus_icons[1]['-'] ); ?>"; |
|
132 | + content:"\e<?php echo esc_html( isset( $minus_icons[$repeat_icon] ) ? $minus_icons[$repeat_icon]['-'] : $minus_icons[1]['-'] ); ?>"; |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | .<?php echo esc_html( $style_class ); ?> .frm_icon_font.frm_plus_icon:before{ |
136 | - content:"\e<?php echo esc_html( isset( $minus_icons[ $repeat_icon ] ) ? $minus_icons[ $repeat_icon ]['+'] : $minus_icons[1]['+'] ); ?>"; |
|
136 | + content:"\e<?php echo esc_html( isset( $minus_icons[$repeat_icon] ) ? $minus_icons[$repeat_icon]['+'] : $minus_icons[1]['+'] ); ?>"; |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | .<?php echo esc_html( $style_class ); ?> .frm_icon_font.frm_minus_icon:before, |
@@ -145,14 +145,14 @@ discard block |
||
145 | 145 | } |
146 | 146 | |
147 | 147 | .<?php echo esc_html( $style_class ); ?> .frm_trigger.active .frm_icon_font.frm_arrow_icon:before{ |
148 | - content:"\e<?php echo esc_html( isset( $arrow_icons[ $collapse_icon ] ) ? $arrow_icons[ $collapse_icon ]['-'] : $arrow_icons[1]['-'] ); ?>"; |
|
148 | + content:"\e<?php echo esc_html( isset( $arrow_icons[$collapse_icon] ) ? $arrow_icons[$collapse_icon]['-'] : $arrow_icons[1]['-'] ); ?>"; |
|
149 | 149 | <?php if ( ! empty( $section_color ) ) { ?> |
150 | 150 | color:<?php echo esc_html( $section_color . $important ); ?>; |
151 | 151 | <?php } ?> |
152 | 152 | } |
153 | 153 | |
154 | 154 | .<?php echo esc_html( $style_class ); ?> .frm_trigger .frm_icon_font.frm_arrow_icon:before{ |
155 | - content:"\e<?php echo esc_html( isset( $arrow_icons[ $collapse_icon ] ) ? $arrow_icons[ $collapse_icon ]['+'] : $arrow_icons[1]['+'] ); ?>"; |
|
155 | + content:"\e<?php echo esc_html( isset( $arrow_icons[$collapse_icon] ) ? $arrow_icons[$collapse_icon]['+'] : $arrow_icons[1]['+'] ); ?>"; |
|
156 | 156 | <?php if ( ! empty( $section_color ) ) { ?> |
157 | 157 | color:<?php echo esc_html( $section_color . $important ); ?>; |
158 | 158 | <?php } ?> |
@@ -71,12 +71,12 @@ discard block |
||
71 | 71 | $show_intervals = array( 50, 200, 500 ); |
72 | 72 | $asked = $this->review_status['asked']; |
73 | 73 | |
74 | - if ( ! isset( $show_intervals[ $asked ] ) ) { |
|
74 | + if ( ! isset( $show_intervals[$asked] ) ) { |
|
75 | 75 | return; |
76 | 76 | } |
77 | 77 | |
78 | 78 | $entries = FrmEntry::getRecordCount(); |
79 | - $count = $show_intervals[ $asked ]; |
|
79 | + $count = $show_intervals[$asked]; |
|
80 | 80 | $user = wp_get_current_user(); |
81 | 81 | |
82 | 82 | // Only show review request if the site has collected enough entries |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | $requests = $message->get_messages(); |
119 | 119 | $key = $this->inbox_key . ( $asked ? $asked : '' ); |
120 | 120 | |
121 | - if ( isset( $requests[ $key ] ) ) { |
|
121 | + if ( isset( $requests[$key] ) ) { |
|
122 | 122 | return; |
123 | 123 | } |
124 | 124 | |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | * @since 4.05.02 |
155 | 155 | */ |
156 | 156 | private function has_later_request( $requests, $asked ) { |
157 | - return isset( $requests[ $this->inbox_key . ( $asked + 1 ) ] ) || isset( $requests[ $this->inbox_key . ( $asked + 2 ) ] ); |
|
157 | + return isset( $requests[$this->inbox_key . ( $asked + 1 )] ) || isset( $requests[$this->inbox_key . ( $asked + 2 )] ); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | /** |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | '-' => 'down', |
192 | 192 | '+' => 'up', |
193 | 193 | ); |
194 | - $class = 'frm_arrow' . $arrow[ $icon ]; |
|
194 | + $class = 'frm_arrow' . $arrow[$icon]; |
|
195 | 195 | } else { |
196 | 196 | //frm_minus1_icon |
197 | 197 | $key = str_replace( 'p', '', $key ); |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | '-' => 'minus', |
200 | 200 | '+' => 'plus', |
201 | 201 | ); |
202 | - $class = 'frm_' . $plus[ $icon ]; |
|
202 | + $class = 'frm_' . $plus[$icon]; |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | if ( $key ) { |
@@ -219,8 +219,8 @@ discard block |
||
219 | 219 | ?> |
220 | 220 | <div class="btn-group" id="frm_<?php echo esc_attr( $name ); ?>_select"> |
221 | 221 | <button class="multiselect dropdown-toggle btn btn-default" data-toggle="dropdown" type="button"> |
222 | - <?php FrmAppHelper::icon_by_class( 'frmfont ' . self::icon_key_to_class( $style->post_content[ $name ], '+', $type ) ); ?> |
|
223 | - <?php FrmAppHelper::icon_by_class( 'frmfont ' . self::icon_key_to_class( $style->post_content[ $name ], '-', $type ) ); ?> |
|
222 | + <?php FrmAppHelper::icon_by_class( 'frmfont ' . self::icon_key_to_class( $style->post_content[$name], '+', $type ) ); ?> |
|
223 | + <?php FrmAppHelper::icon_by_class( 'frmfont ' . self::icon_key_to_class( $style->post_content[$name], '-', $type ) ); ?> |
|
224 | 224 | <b class="caret"></b> |
225 | 225 | </button> |
226 | 226 | <ul class="multiselect-container frm-dropdown-menu"> |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | <li <?php echo ( $style->post_content['collapse_icon'] == $key ) ? 'class="active"' : ''; ?>> |
229 | 229 | <a href="javascript:void(0);"> |
230 | 230 | <label> |
231 | - <input type="radio" value="<?php echo esc_attr( $key ); ?>" name="<?php echo esc_attr( $frm_style->get_field_name( $name ) ); ?>" <?php checked( $style->post_content[ $name ], $key ); ?>/> |
|
231 | + <input type="radio" value="<?php echo esc_attr( $key ); ?>" name="<?php echo esc_attr( $frm_style->get_field_name( $name ) ); ?>" <?php checked( $style->post_content[$name], $key ); ?>/> |
|
232 | 232 | <span> |
233 | 233 | <?php FrmAppHelper::icon_by_class( 'frmfont ' . self::icon_key_to_class( $key, '+', $type ) ); ?> |
234 | 234 | <?php FrmAppHelper::icon_by_class( 'frmfont ' . self::icon_key_to_class( $key, '-', $type ) ); ?> |
@@ -310,15 +310,15 @@ discard block |
||
310 | 310 | $vars = array_diff( $vars, $remove ); |
311 | 311 | |
312 | 312 | foreach ( $vars as $var ) { |
313 | - if ( ! isset( $settings[ $var ] ) ) { |
|
313 | + if ( ! isset( $settings[$var] ) ) { |
|
314 | 314 | continue; |
315 | 315 | } |
316 | - if ( ! isset( $defaults[ $var ] ) ) { |
|
317 | - $defaults[ $var ] = ''; |
|
316 | + if ( ! isset( $defaults[$var] ) ) { |
|
317 | + $defaults[$var] = ''; |
|
318 | 318 | } |
319 | - $show = empty( $defaults ) || ( $settings[ $var ] !== '' && $settings[ $var ] !== $defaults[ $var ] ); |
|
319 | + $show = empty( $defaults ) || ( $settings[$var] !== '' && $settings[$var] !== $defaults[$var] ); |
|
320 | 320 | if ( $show ) { |
321 | - echo '--' . esc_html( str_replace( '_', '-', $var ) ) . ':' . ( $var === 'font' ? FrmAppHelper::kses( $settings[ $var ] ) : esc_html( $settings[ $var ] ) ) . ';'; // WPCS: XSS ok. |
|
321 | + echo '--' . esc_html( str_replace( '_', '-', $var ) ) . ':' . ( $var === 'font' ? FrmAppHelper::kses( $settings[$var] ) : esc_html( $settings[$var] ) ) . ';'; // WPCS: XSS ok. |
|
322 | 322 | } |
323 | 323 | } |
324 | 324 | } |
@@ -358,14 +358,14 @@ discard block |
||
358 | 358 | $settings['style_class'] = 'frm_style_' . $style->post_name . '.'; |
359 | 359 | } |
360 | 360 | |
361 | - $settings['style_class'] .= 'with_frm_style'; |
|
361 | + $settings['style_class'] .= 'with_frm_style'; |
|
362 | 362 | $settings['font'] = stripslashes( $settings['font'] ); |
363 | 363 | $settings['change_margin'] = self::description_margin_for_screensize( $settings['width'] ); |
364 | 364 | |
365 | 365 | $checkbox_opts = array( 'important_style', 'auto_width', 'submit_style', 'collapse_icon', 'center_form' ); |
366 | 366 | foreach ( $checkbox_opts as $opt ) { |
367 | - if ( ! isset( $settings[ $opt ] ) ) { |
|
368 | - $settings[ $opt ] = 0; |
|
367 | + if ( ! isset( $settings[$opt] ) ) { |
|
368 | + $settings[$opt] = 0; |
|
369 | 369 | } |
370 | 370 | } |
371 | 371 | |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | $css = ''; |
390 | 390 | } |
391 | 391 | foreach ( $opts as $opt ) { |
392 | - self::get_color_output( $css, $settings[ $opt ] ); |
|
392 | + self::get_color_output( $css, $settings[$opt] ); |
|
393 | 393 | } |
394 | 394 | } |
395 | 395 | } |
@@ -161,8 +161,8 @@ discard block |
||
161 | 161 | |
162 | 162 | $conditionally_add = array( 'include_fields', 'fields', 'exclude_fields', 'entry' ); |
163 | 163 | foreach ( $conditionally_add as $index ) { |
164 | - if ( isset( $atts[ $index ] ) ) { |
|
165 | - $entry_atts[ $index ] = $atts[ $index ]; |
|
164 | + if ( isset( $atts[$index] ) ) { |
|
165 | + $entry_atts[$index] = $atts[$index]; |
|
166 | 166 | } |
167 | 167 | } |
168 | 168 | |
@@ -331,8 +331,8 @@ discard block |
||
331 | 331 | |
332 | 332 | $unset = array( 'id', 'entry', 'form_id', 'format' ); |
333 | 333 | foreach ( $unset as $param ) { |
334 | - if ( isset( $atts[ $param ] ) ) { |
|
335 | - unset( $atts[ $param ] ); |
|
334 | + if ( isset( $atts[$param] ) ) { |
|
335 | + unset( $atts[$param] ); |
|
336 | 336 | } |
337 | 337 | } |
338 | 338 | |
@@ -485,11 +485,11 @@ discard block |
||
485 | 485 | |
486 | 486 | $displayed_value = $this->prepare_display_value_for_array( $field_value->get_displayed_value() ); |
487 | 487 | |
488 | - $output[ $this->get_key_or_id( $field_value ) ] = $displayed_value; |
|
488 | + $output[$this->get_key_or_id( $field_value )] = $displayed_value; |
|
489 | 489 | |
490 | 490 | $has_separate_value = (bool) $field_value->get_field_option( 'separate_value' ); |
491 | 491 | if ( $has_separate_value || $displayed_value !== $field_value->get_saved_value() ) { |
492 | - $output[ $this->get_key_or_id( $field_value ) . '-value' ] = $field_value->get_saved_value(); |
|
492 | + $output[$this->get_key_or_id( $field_value ) . '-value'] = $field_value->get_saved_value(); |
|
493 | 493 | } |
494 | 494 | } |
495 | 495 | } |
@@ -876,7 +876,7 @@ discard block |
||
876 | 876 | |
877 | 877 | if ( is_array( $value ) ) { |
878 | 878 | foreach ( $value as $key => $single_value ) { |
879 | - $value[ $key ] = $this->strip_html( $single_value ); |
|
879 | + $value[$key] = $this->strip_html( $single_value ); |
|
880 | 880 | } |
881 | 881 | } elseif ( $this->is_plain_text && ! is_array( $value ) ) { |
882 | 882 | if ( strpos( $value, '<img' ) !== false ) { |
@@ -125,7 +125,8 @@ |
||
125 | 125 | } |
126 | 126 | |
127 | 127 | // Only do this for single site installs. |
128 | - if ( isset( $_GET['activate-multi'] ) || is_network_admin() ) { // WPCS: CSRF ok. |
|
128 | + if ( isset( $_GET['activate-multi'] ) || is_network_admin() ) { |
|
129 | +// WPCS: CSRF ok. |
|
129 | 130 | return; |
130 | 131 | } |
131 | 132 |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | */ |
160 | 160 | public function add_settings( $sections ) { |
161 | 161 | wp_enqueue_style( 'formidable-pro-fields' ); |
162 | - $sections[ $this->plugin_slug ] = array( |
|
162 | + $sections[$this->plugin_slug] = array( |
|
163 | 163 | 'class' => $this, |
164 | 164 | 'function' => 'settings_page', |
165 | 165 | 'name' => $this->plugin_name(), |
@@ -316,9 +316,9 @@ discard block |
||
316 | 316 | // Set the current step. |
317 | 317 | if ( ! isset( $step['current'] ) ) { |
318 | 318 | if ( $step['complete'] ) { |
319 | - $steps[ $k ]['current'] = false; |
|
319 | + $steps[$k]['current'] = false; |
|
320 | 320 | } else { |
321 | - $steps[ $k ]['current'] = ! $has_current; |
|
321 | + $steps[$k]['current'] = ! $has_current; |
|
322 | 322 | $has_current = true; |
323 | 323 | } |
324 | 324 | } elseif ( $step['current'] ) { |
@@ -328,10 +328,10 @@ discard block |
||
328 | 328 | // Set disabled buttons. |
329 | 329 | $class = isset( $step['button_class'] ) ? $step['button_class'] : ''; |
330 | 330 | $class .= ' button-primary frm-button-primary'; |
331 | - if ( ! $steps[ $k ]['current'] ) { |
|
331 | + if ( ! $steps[$k]['current'] ) { |
|
332 | 332 | $class .= ' frm_grey disabled'; |
333 | 333 | } |
334 | - $steps[ $k ]['button_class'] = $class; |
|
334 | + $steps[$k]['button_class'] = $class; |
|
335 | 335 | } |
336 | 336 | |
337 | 337 | return $steps; |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | if ( $plugin['status'] === 'active' ) { |
354 | 354 | continue; |
355 | 355 | } |
356 | - $links[ $plugin_key ] = $plugin; |
|
356 | + $links[$plugin_key] = $plugin; |
|
357 | 357 | if ( isset( $plugin['url'] ) ) { |
358 | 358 | $rel[] = $plugin['url']; |
359 | 359 | } else { |
@@ -468,7 +468,7 @@ discard block |
||
468 | 468 | $addons = $api->get_api_info(); |
469 | 469 | |
470 | 470 | $id = $this->download_id(); |
471 | - $has_file = isset( $addons[ $id ] ) && isset( $addons[ $id ]['beta'] ); |
|
471 | + $has_file = isset( $addons[$id] ) && isset( $addons[$id]['beta'] ); |
|
472 | 472 | |
473 | 473 | if ( ! $step['current'] ) { |
474 | 474 | ?> |
@@ -483,10 +483,10 @@ discard block |
||
483 | 483 | |
484 | 484 | if ( ! $has_file ) { |
485 | 485 | echo '<p class="frm_error_style">' . esc_html__( 'We didn\'t find anything to import. Please contact our team.', 'formidable' ) . '</p>'; |
486 | - } elseif ( ! isset( $addons[ $id ]['beta']['package'] ) ) { |
|
486 | + } elseif ( ! isset( $addons[$id]['beta']['package'] ) ) { |
|
487 | 487 | echo '<p class="frm_error_style">' . esc_html__( 'Looks like you may not have a current subscription for this solution. Please check your account.', 'formidable' ) . '</p>'; |
488 | 488 | } else { |
489 | - $xml = $addons[ $id ]['beta']['package']; |
|
489 | + $xml = $addons[$id]['beta']['package']; |
|
490 | 490 | if ( is_array( $xml ) ) { |
491 | 491 | $xml = reset( $xml ); |
492 | 492 | } |
@@ -624,7 +624,7 @@ discard block |
||
624 | 624 | foreach ( $forms as $form ) { |
625 | 625 | $was_imported = isset( $form['form'] ) ? FrmForm::get_id_by_key( $form['form'] ) : false; |
626 | 626 | if ( $was_imported ) { |
627 | - $imported[ $form['form'] ] = $was_imported; |
|
627 | + $imported[$form['form']] = $was_imported; |
|
628 | 628 | } |
629 | 629 | } |
630 | 630 |
@@ -29,7 +29,7 @@ |
||
29 | 29 | </h3> |
30 | 30 | <span class="frm_inbox_date"> |
31 | 31 | <?php |
32 | - if ( ! isset( $message['read'] ) || ! isset( $message['read'][ $user->ID ] ) ) { |
|
32 | + if ( ! isset( $message['read'] ) || ! isset( $message['read'][$user->ID] ) ) { |
|
33 | 33 | $inbox->mark_read( $key ); |
34 | 34 | ?> |
35 | 35 | <span class="frm_inbox_unread"></span> |
@@ -117,10 +117,10 @@ discard block |
||
117 | 117 | if ( $_POST ) { |
118 | 118 | $repeating = isset( $args['repeating'] ) && $args['repeating']; |
119 | 119 | if ( $repeating ) { |
120 | - if ( isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field->id ] ) ) { |
|
120 | + if ( isset( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']][$field->id] ) ) { |
|
121 | 121 | $value_is_posted = true; |
122 | 122 | } |
123 | - } elseif ( isset( $_POST['item_meta'][ $field->id ] ) ) { |
|
123 | + } elseif ( isset( $_POST['item_meta'][$field->id] ) ) { |
|
124 | 124 | $value_is_posted = true; |
125 | 125 | } |
126 | 126 | } |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | preg_match_all( "/\[(default-message|default_message)\b(.*?)(?:(\/))?\]/s", $message, $shortcodes, PREG_PATTERN_ORDER ); |
151 | 151 | |
152 | 152 | foreach ( $shortcodes[0] as $short_key => $tag ) { |
153 | - $add_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][ $short_key ] ); |
|
153 | + $add_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][$short_key] ); |
|
154 | 154 | if ( ! empty( $add_atts ) ) { |
155 | 155 | $this_atts = array_merge( $atts, $add_atts ); |
156 | 156 | } else { |
@@ -160,14 +160,14 @@ discard block |
||
160 | 160 | $default = FrmEntriesController::show_entry_shortcode( $this_atts ); |
161 | 161 | |
162 | 162 | // Add the default message. |
163 | - $message = str_replace( $shortcodes[0][ $short_key ], $default, $message ); |
|
163 | + $message = str_replace( $shortcodes[0][$short_key], $default, $message ); |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | return $message; |
167 | 167 | } |
168 | 168 | |
169 | 169 | public static function prepare_display_value( $entry, $field, $atts ) { |
170 | - $field_value = isset( $entry->metas[ $field->id ] ) ? $entry->metas[ $field->id ] : false; |
|
170 | + $field_value = isset( $entry->metas[$field->id] ) ? $entry->metas[$field->id] : false; |
|
171 | 171 | |
172 | 172 | if ( FrmAppHelper::pro_is_installed() ) { |
173 | 173 | $empty = empty( $field_value ); |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | $child_entries = FrmEntry::getAll( array( 'it.parent_item_id' => $entry->id ) ); |
191 | 191 | } else { |
192 | 192 | // Get all values for this field. |
193 | - $child_values = isset( $entry->metas[ $atts['embedded_field_id'] ] ) ? $entry->metas[ $atts['embedded_field_id'] ] : false; |
|
193 | + $child_values = isset( $entry->metas[$atts['embedded_field_id']] ) ? $entry->metas[$atts['embedded_field_id']] : false; |
|
194 | 194 | |
195 | 195 | if ( $child_values ) { |
196 | 196 | $child_entries = FrmEntry::getAll( array( 'it.id' => (array) $child_values ) ); |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | $value = $args['temp_value']; |
309 | 309 | } |
310 | 310 | if ( empty( $args['parent_field_id'] ) ) { |
311 | - $_POST['item_meta'][ $field->id ] = $value; |
|
311 | + $_POST['item_meta'][$field->id] = $value; |
|
312 | 312 | } else { |
313 | 313 | self::set_parent_field_posted_value( $field, $value, $args ); |
314 | 314 | } |
@@ -320,20 +320,20 @@ discard block |
||
320 | 320 | * @since 4.01 |
321 | 321 | */ |
322 | 322 | private static function set_parent_field_posted_value( $field, $value, $args ) { |
323 | - if ( isset( $_POST['item_meta'][ $args['parent_field_id'] ] ) && |
|
324 | - is_array( $_POST['item_meta'][ $args['parent_field_id'] ] ) ) { |
|
323 | + if ( isset( $_POST['item_meta'][$args['parent_field_id']] ) && |
|
324 | + is_array( $_POST['item_meta'][$args['parent_field_id']] ) ) { |
|
325 | 325 | |
326 | - if ( ! isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ] ) || |
|
327 | - ! is_array( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ] ) ) { |
|
328 | - $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ] = array(); |
|
326 | + if ( ! isset( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']] ) || |
|
327 | + ! is_array( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']] ) ) { |
|
328 | + $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']] = array(); |
|
329 | 329 | } |
330 | 330 | } else { |
331 | 331 | // All of the section was probably removed. |
332 | - $_POST['item_meta'][ $args['parent_field_id'] ] = array(); |
|
333 | - $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ] = array(); |
|
332 | + $_POST['item_meta'][$args['parent_field_id']] = array(); |
|
333 | + $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']] = array(); |
|
334 | 334 | } |
335 | 335 | |
336 | - $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field->id ] = $value; |
|
336 | + $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']][$field->id] = $value; |
|
337 | 337 | } |
338 | 338 | |
339 | 339 | public static function get_posted_value( $field, &$value, $args ) { |
@@ -364,10 +364,10 @@ discard block |
||
364 | 364 | if ( empty( $args['parent_field_id'] ) ) { |
365 | 365 | // Sanitizing is done next. |
366 | 366 | // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
367 | - $value = isset( $_POST['item_meta'][ $field_id ] ) ? wp_unslash( $_POST['item_meta'][ $field_id ] ) : ''; |
|
367 | + $value = isset( $_POST['item_meta'][$field_id] ) ? wp_unslash( $_POST['item_meta'][$field_id] ) : ''; |
|
368 | 368 | } else { |
369 | 369 | // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
370 | - $value = isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field_id ] ) ? wp_unslash( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field_id ] ) : ''; |
|
370 | + $value = isset( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']][$field_id] ) ? wp_unslash( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']][$field_id] ) : ''; |
|
371 | 371 | } |
372 | 372 | return $value; |
373 | 373 | } |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | self::set_other_repeating_vals( $field, $value, $args ); |
399 | 399 | |
400 | 400 | // Check if there are any posted "Other" values. |
401 | - if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta']['other'][ $field->id ] ) ) { |
|
401 | + if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta']['other'][$field->id] ) ) { |
|
402 | 402 | |
403 | 403 | // Save original value. |
404 | 404 | $args['temp_value'] = $value; |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | |
407 | 407 | // Sanitizing is done next. |
408 | 408 | // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
409 | - $other_vals = wp_unslash( $_POST['item_meta']['other'][ $field->id ] ); |
|
409 | + $other_vals = wp_unslash( $_POST['item_meta']['other'][$field->id] ); |
|
410 | 410 | FrmAppHelper::sanitize_value( 'sanitize_text_field', $other_vals ); |
411 | 411 | |
412 | 412 | // Set the validation value now |
@@ -429,13 +429,13 @@ discard block |
||
429 | 429 | } |
430 | 430 | |
431 | 431 | // Check if there are any other posted "other" values for this field. |
432 | - if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ]['other'][ $field->id ] ) ) { |
|
432 | + if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']]['other'][$field->id] ) ) { |
|
433 | 433 | // Save original value |
434 | 434 | $args['temp_value'] = $value; |
435 | 435 | $args['other'] = true; |
436 | 436 | |
437 | 437 | // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
438 | - $other_vals = wp_unslash( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ]['other'][ $field->id ] ); |
|
438 | + $other_vals = wp_unslash( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']]['other'][$field->id] ); |
|
439 | 439 | FrmAppHelper::sanitize_value( 'sanitize_text_field', $other_vals ); |
440 | 440 | |
441 | 441 | // Set the validation value now. |
@@ -462,7 +462,7 @@ discard block |
||
462 | 462 | if ( is_array( $value ) && $field->type === 'checkbox' ) { |
463 | 463 | // Combine "Other" values with checked values. "Other" values will override checked box values. |
464 | 464 | foreach ( $other_vals as $k => $v ) { |
465 | - if ( isset( $value[ $k ] ) && trim( $v ) === '' ) { |
|
465 | + if ( isset( $value[$k] ) && trim( $v ) === '' ) { |
|
466 | 466 | // If the other box is checked, but doesn't have a value. |
467 | 467 | $value = ''; |
468 | 468 | break; |
@@ -479,25 +479,25 @@ discard block |
||
479 | 479 | |
480 | 480 | // Multi-select dropdown. |
481 | 481 | if ( is_array( $value ) ) { |
482 | - $o_key = array_search( $field->options[ $other_key ], $value ); |
|
482 | + $o_key = array_search( $field->options[$other_key], $value ); |
|
483 | 483 | |
484 | 484 | if ( $o_key !== false ) { |
485 | 485 | // Modify the original value so other key will be preserved. |
486 | - $value[ $other_key ] = $value[ $o_key ]; |
|
486 | + $value[$other_key] = $value[$o_key]; |
|
487 | 487 | |
488 | 488 | // By default, the array keys will be numeric for multi-select dropdowns. |
489 | 489 | // If going backwards and forwards between pages, the array key will match the other key. |
490 | 490 | if ( $o_key !== $other_key ) { |
491 | - unset( $value[ $o_key ] ); |
|
491 | + unset( $value[$o_key] ); |
|
492 | 492 | } |
493 | 493 | |
494 | 494 | $args['temp_value'] = $value; |
495 | - $value[ $other_key ] = reset( $other_vals ); |
|
496 | - if ( FrmAppHelper::is_empty_value( $value[ $other_key ] ) ) { |
|
497 | - unset( $value[ $other_key ] ); |
|
495 | + $value[$other_key] = reset( $other_vals ); |
|
496 | + if ( FrmAppHelper::is_empty_value( $value[$other_key] ) ) { |
|
497 | + unset( $value[$other_key] ); |
|
498 | 498 | } |
499 | 499 | } |
500 | - } elseif ( $field->options[ $other_key ] == $value ) { |
|
500 | + } elseif ( $field->options[$other_key] == $value ) { |
|
501 | 501 | $value = $other_vals; |
502 | 502 | } |
503 | 503 | } |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | |
141 | 141 | foreach ( $values as $value_key => $value ) { |
142 | 142 | if ( $value_key && in_array( $value_key, $form_fields ) ) { |
143 | - $new_values[ $value_key ] = $value; |
|
143 | + $new_values[$value_key] = $value; |
|
144 | 144 | } |
145 | 145 | } |
146 | 146 | |
@@ -210,15 +210,15 @@ discard block |
||
210 | 210 | $existing_keys = array_keys( $values['item_meta'] ); |
211 | 211 | foreach ( $all_fields as $fid ) { |
212 | 212 | if ( ! in_array( $fid->id, $existing_keys ) && ( isset( $values['frm_fields_submitted'] ) && in_array( $fid->id, $values['frm_fields_submitted'] ) ) || isset( $values['options'] ) ) { |
213 | - $values['item_meta'][ $fid->id ] = ''; |
|
213 | + $values['item_meta'][$fid->id] = ''; |
|
214 | 214 | } |
215 | - $field_array[ $fid->id ] = $fid; |
|
215 | + $field_array[$fid->id] = $fid; |
|
216 | 216 | } |
217 | 217 | unset( $all_fields ); |
218 | 218 | |
219 | 219 | foreach ( $values['item_meta'] as $field_id => $default_value ) { |
220 | - if ( isset( $field_array[ $field_id ] ) ) { |
|
221 | - $field = $field_array[ $field_id ]; |
|
220 | + if ( isset( $field_array[$field_id] ) ) { |
|
221 | + $field = $field_array[$field_id]; |
|
222 | 222 | } else { |
223 | 223 | $field = FrmField::getOne( $field_id ); |
224 | 224 | } |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | continue; |
228 | 228 | } |
229 | 229 | |
230 | - $is_settings_page = ( isset( $values['options'] ) || isset( $values['field_options'][ 'custom_html_' . $field_id ] ) ); |
|
230 | + $is_settings_page = ( isset( $values['options'] ) || isset( $values['field_options']['custom_html_' . $field_id] ) ); |
|
231 | 231 | if ( $is_settings_page ) { |
232 | 232 | self::get_settings_page_html( $values, $field ); |
233 | 233 | |
@@ -242,15 +242,15 @@ discard block |
||
242 | 242 | $update_options = apply_filters( 'frm_field_options_to_update', $update_options ); |
243 | 243 | |
244 | 244 | foreach ( $update_options as $opt => $default ) { |
245 | - $field->field_options[ $opt ] = isset( $values['field_options'][ $opt . '_' . $field_id ] ) ? $values['field_options'][ $opt . '_' . $field_id ] : $default; |
|
246 | - self::sanitize_field_opt( $opt, $field->field_options[ $opt ] ); |
|
245 | + $field->field_options[$opt] = isset( $values['field_options'][$opt . '_' . $field_id] ) ? $values['field_options'][$opt . '_' . $field_id] : $default; |
|
246 | + self::sanitize_field_opt( $opt, $field->field_options[$opt] ); |
|
247 | 247 | } |
248 | 248 | |
249 | 249 | $field->field_options = apply_filters( 'frm_update_field_options', $field->field_options, $field, $values ); |
250 | 250 | |
251 | 251 | $new_field = array( |
252 | 252 | 'field_options' => $field->field_options, |
253 | - 'default_value' => isset( $values[ 'default_value_' . $field_id ] ) ? FrmAppHelper::maybe_json_encode( $values[ 'default_value_' . $field_id ] ) : '', |
|
253 | + 'default_value' => isset( $values['default_value_' . $field_id] ) ? FrmAppHelper::maybe_json_encode( $values['default_value_' . $field_id] ) : '', |
|
254 | 254 | ); |
255 | 255 | |
256 | 256 | self::prepare_field_update_values( $field, $values, $new_field ); |
@@ -283,11 +283,11 @@ discard block |
||
283 | 283 | * Updating the settings page |
284 | 284 | */ |
285 | 285 | private static function get_settings_page_html( $values, &$field ) { |
286 | - if ( isset( $values['field_options'][ 'custom_html_' . $field->id ] ) ) { |
|
286 | + if ( isset( $values['field_options']['custom_html_' . $field->id] ) ) { |
|
287 | 287 | $prev_opts = array(); |
288 | 288 | $fallback_html = isset( $field->field_options['custom_html'] ) ? $field->field_options['custom_html'] : FrmFieldsHelper::get_default_html( $field->type ); |
289 | 289 | |
290 | - $field->field_options['custom_html'] = isset( $values['field_options'][ 'custom_html_' . $field->id ] ) ? $values['field_options'][ 'custom_html_' . $field->id ] : $fallback_html; |
|
290 | + $field->field_options['custom_html'] = isset( $values['field_options']['custom_html_' . $field->id] ) ? $values['field_options']['custom_html_' . $field->id] : $fallback_html; |
|
291 | 291 | } elseif ( $field->type == 'hidden' || $field->type == 'user_id' ) { |
292 | 292 | $prev_opts = $field->field_options; |
293 | 293 | } |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | foreach ( $field_cols as $col => $default ) { |
314 | 314 | $default = ( $default === '' ) ? $field->{$col} : $default; |
315 | 315 | |
316 | - $new_field[ $col ] = isset( $values['field_options'][ $col . '_' . $field->id ] ) ? $values['field_options'][ $col . '_' . $field->id ] : $default; |
|
316 | + $new_field[$col] = isset( $values['field_options'][$col . '_' . $field->id] ) ? $values['field_options'][$col . '_' . $field->id] : $default; |
|
317 | 317 | } |
318 | 318 | |
319 | 319 | // Don't save the template option. |
@@ -727,8 +727,8 @@ discard block |
||
727 | 727 | self::maybe_get_form( $form ); |
728 | 728 | } |
729 | 729 | |
730 | - if ( isset( $frm_vars['form_params'] ) && is_array( $frm_vars['form_params'] ) && isset( $frm_vars['form_params'][ $form->id ] ) ) { |
|
731 | - return $frm_vars['form_params'][ $form->id ]; |
|
730 | + if ( isset( $frm_vars['form_params'] ) && is_array( $frm_vars['form_params'] ) && isset( $frm_vars['form_params'][$form->id] ) ) { |
|
731 | + return $frm_vars['form_params'][$form->id]; |
|
732 | 732 | } |
733 | 733 | |
734 | 734 | $action_var = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action'; // WPCS: CSRF ok. |
@@ -757,15 +757,15 @@ discard block |
||
757 | 757 | //if there are two forms on the same page, make sure not to submit both |
758 | 758 | foreach ( $default_values as $var => $default ) { |
759 | 759 | if ( $var == 'action' ) { |
760 | - $values[ $var ] = FrmAppHelper::get_param( $action_var, $default, 'get', 'sanitize_title' ); |
|
760 | + $values[$var] = FrmAppHelper::get_param( $action_var, $default, 'get', 'sanitize_title' ); |
|
761 | 761 | } else { |
762 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
762 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
763 | 763 | } |
764 | 764 | unset( $var, $default ); |
765 | 765 | } |
766 | 766 | } else { |
767 | 767 | foreach ( $default_values as $var => $default ) { |
768 | - $values[ $var ] = $default; |
|
768 | + $values[$var] = $default; |
|
769 | 769 | unset( $var, $default ); |
770 | 770 | } |
771 | 771 | } |
@@ -791,7 +791,7 @@ discard block |
||
791 | 791 | 'sdir' => '', |
792 | 792 | ); |
793 | 793 | foreach ( $defaults as $var => $default ) { |
794 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
794 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
795 | 795 | } |
796 | 796 | |
797 | 797 | return $values; |
@@ -819,7 +819,7 @@ discard block |
||
819 | 819 | 'keep_post' => '', |
820 | 820 | ); |
821 | 821 | foreach ( $defaults as $var => $default ) { |
822 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
822 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
823 | 823 | } |
824 | 824 | |
825 | 825 | return $values; |
@@ -905,7 +905,7 @@ discard block |
||
905 | 905 | $form = $atts['form']; |
906 | 906 | $default = isset( $atts['default'] ) ? $atts['default'] : ''; |
907 | 907 | |
908 | - return isset( $form->options[ $atts['option'] ] ) ? $form->options[ $atts['option'] ] : $default; |
|
908 | + return isset( $form->options[$atts['option']] ) ? $form->options[$atts['option']] : $default; |
|
909 | 909 | } |
910 | 910 | |
911 | 911 | /** |