@@ -98,19 +98,19 @@ discard block |
||
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | foreach ( $action_controls as $action ) { |
| 101 | - if ( isset( $groups[ $action->id_base ] ) || in_array( $action->id_base, $grouped ) ) { |
|
| 101 | + if ( isset( $groups[$action->id_base] ) || in_array( $action->id_base, $grouped ) ) { |
|
| 102 | 102 | continue; |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | $this_group = $action->action_options['group']; |
| 106 | - if ( ! isset( $groups[ $this_group ] ) ) { |
|
| 106 | + if ( ! isset( $groups[$this_group] ) ) { |
|
| 107 | 107 | $this_group = 'misc'; |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - if ( ! isset( $groups[ $this_group ]['actions'] ) ) { |
|
| 111 | - $groups[ $this_group ]['actions'] = array(); |
|
| 110 | + if ( ! isset( $groups[$this_group]['actions'] ) ) { |
|
| 111 | + $groups[$this_group]['actions'] = array(); |
|
| 112 | 112 | } |
| 113 | - $groups[ $this_group ]['actions'][] = $action->id_base; |
|
| 113 | + $groups[$this_group]['actions'][] = $action->id_base; |
|
| 114 | 114 | |
| 115 | 115 | unset( $action ); |
| 116 | 116 | } |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | return $a; |
| 242 | 242 | } |
| 243 | 243 | |
| 244 | - $actions[ $a->id_base ] = $a; |
|
| 244 | + $actions[$a->id_base] = $a; |
|
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | return $actions; |
@@ -272,16 +272,16 @@ discard block |
||
| 272 | 272 | $action_map = array(); |
| 273 | 273 | |
| 274 | 274 | foreach ( $action_controls as $key => $control ) { |
| 275 | - $action_map[ $control->id_base ] = $key; |
|
| 275 | + $action_map[$control->id_base] = $key; |
|
| 276 | 276 | } |
| 277 | 277 | |
| 278 | 278 | foreach ( $form_actions as $action ) { |
| 279 | - if ( ! isset( $action_map[ $action->post_excerpt ] ) ) { |
|
| 279 | + if ( ! isset( $action_map[$action->post_excerpt] ) ) { |
|
| 280 | 280 | // don't try and show settings if action no longer exists |
| 281 | 281 | continue; |
| 282 | 282 | } |
| 283 | 283 | |
| 284 | - self::action_control( $action, $form, $action->ID, $action_controls[ $action_map[ $action->post_excerpt ] ], $values ); |
|
| 284 | + self::action_control( $action, $form, $action->ID, $action_controls[$action_map[$action->post_excerpt]], $values ); |
|
| 285 | 285 | } |
| 286 | 286 | } |
| 287 | 287 | |
@@ -489,8 +489,8 @@ discard block |
||
| 489 | 489 | } |
| 490 | 490 | |
| 491 | 491 | // Store actions so they can be triggered with the correct priority. |
| 492 | - $stored_actions[ $action->ID ] = $action; |
|
| 493 | - $action_priority[ $action->ID ] = $link_settings[ $action->post_excerpt ]->action_options['priority']; |
|
| 492 | + $stored_actions[$action->ID] = $action; |
|
| 493 | + $action_priority[$action->ID] = $link_settings[$action->post_excerpt]->action_options['priority']; |
|
| 494 | 494 | |
| 495 | 495 | unset( $action ); |
| 496 | 496 | } |
@@ -502,7 +502,7 @@ discard block |
||
| 502 | 502 | new FrmNotification(); |
| 503 | 503 | |
| 504 | 504 | foreach ( $action_priority as $action_id => $priority ) { |
| 505 | - $action = $stored_actions[ $action_id ]; |
|
| 505 | + $action = $stored_actions[$action_id]; |
|
| 506 | 506 | do_action( 'frm_trigger_' . $action->post_excerpt . '_action', $action, $entry, $form, $event ); |
| 507 | 507 | do_action( 'frm_trigger_' . $action->post_excerpt . '_' . $event . '_action', $action, $entry, $form ); |
| 508 | 508 | |
@@ -549,12 +549,12 @@ discard block |
||
| 549 | 549 | } |
| 550 | 550 | |
| 551 | 551 | public function register( $action_class ) { |
| 552 | - $this->actions[ $action_class ] = new $action_class(); |
|
| 552 | + $this->actions[$action_class] = new $action_class(); |
|
| 553 | 553 | } |
| 554 | 554 | |
| 555 | 555 | public function unregister( $action_class ) { |
| 556 | - if ( isset( $this->actions[ $action_class ] ) ) { |
|
| 557 | - unset( $this->actions[ $action_class ] ); |
|
| 556 | + if ( isset( $this->actions[$action_class] ) ) { |
|
| 557 | + unset( $this->actions[$action_class] ); |
|
| 558 | 558 | } |
| 559 | 559 | } |
| 560 | 560 | |
@@ -563,8 +563,8 @@ discard block |
||
| 563 | 563 | |
| 564 | 564 | foreach ( $keys as $key ) { |
| 565 | 565 | // don't register new action if old action with the same id is already registered |
| 566 | - if ( ! isset( $this->actions[ $key ] ) ) { |
|
| 567 | - $this->actions[ $key ]->_register(); |
|
| 566 | + if ( ! isset( $this->actions[$key] ) ) { |
|
| 567 | + $this->actions[$key]->_register(); |
|
| 568 | 568 | } |
| 569 | 569 | } |
| 570 | 570 | } |
@@ -85,11 +85,11 @@ discard block |
||
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | .<?php echo esc_html( $style_class ); ?> .frm_icon_font.frm_minus_icon:before{ |
| 88 | - content:"\e<?php echo esc_html( isset( $minus_icons[ $repeat_icon ] ) ? $minus_icons[ $repeat_icon ]['-'] : $minus_icons[1]['-'] ); ?>"; |
|
| 88 | + content:"\e<?php echo esc_html( isset( $minus_icons[$repeat_icon] ) ? $minus_icons[$repeat_icon]['-'] : $minus_icons[1]['-'] ); ?>"; |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | .<?php echo esc_html( $style_class ); ?> .frm_icon_font.frm_plus_icon:before{ |
| 92 | - content:"\e<?php echo esc_html( isset( $minus_icons[ $repeat_icon ] ) ? $minus_icons[ $repeat_icon ]['+'] : $minus_icons[1]['+'] ); ?>"; |
|
| 92 | + content:"\e<?php echo esc_html( isset( $minus_icons[$repeat_icon] ) ? $minus_icons[$repeat_icon]['+'] : $minus_icons[1]['+'] ); ?>"; |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | .<?php echo esc_html( $style_class ); ?> .frm_icon_font.frm_minus_icon:before, |
@@ -99,12 +99,12 @@ discard block |
||
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | .<?php echo esc_html( $style_class ); ?> .frm_trigger.active .frm_icon_font.frm_arrow_icon:before{ |
| 102 | - content:"\e<?php echo esc_html( isset( $arrow_icons[ $collapse_icon ] ) ? $arrow_icons[ $collapse_icon ]['-'] : $arrow_icons[1]['-'] ); ?>"; |
|
| 102 | + content:"\e<?php echo esc_html( isset( $arrow_icons[$collapse_icon] ) ? $arrow_icons[$collapse_icon]['-'] : $arrow_icons[1]['-'] ); ?>"; |
|
| 103 | 103 | color:<?php echo esc_html( $section_color . $important ); ?>; |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | .<?php echo esc_html( $style_class ); ?> .frm_trigger .frm_icon_font.frm_arrow_icon:before{ |
| 107 | - content:"\e<?php echo esc_html( isset( $arrow_icons[ $collapse_icon ] ) ? $arrow_icons[ $collapse_icon ]['+'] : $arrow_icons[1]['+'] ); ?>"; |
|
| 107 | + content:"\e<?php echo esc_html( isset( $arrow_icons[$collapse_icon] ) ? $arrow_icons[$collapse_icon]['+'] : $arrow_icons[1]['+'] ); ?>"; |
|
| 108 | 108 | color:<?php echo esc_html( $section_color . $important ); ?>; |
| 109 | 109 | } |
| 110 | 110 | |
@@ -69,6 +69,9 @@ discard block |
||
| 69 | 69 | return $url; |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | + /** |
|
| 73 | + * @return string |
|
| 74 | + */ |
|
| 72 | 75 | public static function get_affiliate() { |
| 73 | 76 | return absint( apply_filters( 'frm_affiliate_id', 0 ) ); |
| 74 | 77 | } |
@@ -129,6 +132,9 @@ discard block |
||
| 129 | 132 | return $frm_settings; |
| 130 | 133 | } |
| 131 | 134 | |
| 135 | + /** |
|
| 136 | + * @return string |
|
| 137 | + */ |
|
| 132 | 138 | public static function get_menu_name() { |
| 133 | 139 | $frm_settings = self::get_settings(); |
| 134 | 140 | |
@@ -413,6 +419,9 @@ discard block |
||
| 413 | 419 | return $value; |
| 414 | 420 | } |
| 415 | 421 | |
| 422 | + /** |
|
| 423 | + * @param string $param |
|
| 424 | + */ |
|
| 416 | 425 | public static function get_post_param( $param, $default = '', $sanitize = '' ) { |
| 417 | 426 | return self::get_simple_request( |
| 418 | 427 | array( |
@@ -1151,6 +1160,9 @@ discard block |
||
| 1151 | 1160 | return ( is_array( $values ) && in_array( $current, $values ) ) || ( ! is_array( $values ) && $values == $current ); |
| 1152 | 1161 | } |
| 1153 | 1162 | |
| 1163 | + /** |
|
| 1164 | + * @param string $function |
|
| 1165 | + */ |
|
| 1154 | 1166 | public static function recursive_function_map( $value, $function ) { |
| 1155 | 1167 | if ( is_array( $value ) ) { |
| 1156 | 1168 | $original_function = $function; |
@@ -1199,6 +1211,9 @@ discard block |
||
| 1199 | 1211 | return $return; |
| 1200 | 1212 | } |
| 1201 | 1213 | |
| 1214 | + /** |
|
| 1215 | + * @return string |
|
| 1216 | + */ |
|
| 1202 | 1217 | public static function esc_textarea( $text, $is_rich_text = false ) { |
| 1203 | 1218 | $safe_text = str_replace( '"', '"', $text ); |
| 1204 | 1219 | if ( ! $is_rich_text ) { |
@@ -1411,6 +1426,9 @@ discard block |
||
| 1411 | 1426 | return $values; |
| 1412 | 1427 | } |
| 1413 | 1428 | |
| 1429 | + /** |
|
| 1430 | + * @param string $fields |
|
| 1431 | + */ |
|
| 1414 | 1432 | private static function prepare_field_arrays( $fields, $record, array &$values, $args ) { |
| 1415 | 1433 | if ( ! empty( $fields ) ) { |
| 1416 | 1434 | foreach ( (array) $fields as $field ) { |
@@ -1604,6 +1622,9 @@ discard block |
||
| 1604 | 1622 | return $sub . ( ( $len < $original_len ) ? $continue : '' ); |
| 1605 | 1623 | } |
| 1606 | 1624 | |
| 1625 | + /** |
|
| 1626 | + * @param string[] $function_names |
|
| 1627 | + */ |
|
| 1607 | 1628 | public static function mb_function( $function_names, $args ) { |
| 1608 | 1629 | $mb_function_name = $function_names[0]; |
| 1609 | 1630 | $function_name = $function_names[1]; |
@@ -1638,6 +1659,9 @@ discard block |
||
| 1638 | 1659 | return $formatted; |
| 1639 | 1660 | } |
| 1640 | 1661 | |
| 1662 | + /** |
|
| 1663 | + * @param string $time_format |
|
| 1664 | + */ |
|
| 1641 | 1665 | private static function add_time_to_date( $time_format, $date ) { |
| 1642 | 1666 | if ( empty( $time_format ) ) { |
| 1643 | 1667 | $time_format = get_option( 'time_format' ); |
@@ -2062,6 +2086,7 @@ discard block |
||
| 2062 | 2086 | * If Pro is far outdated, show a message. |
| 2063 | 2087 | * |
| 2064 | 2088 | * @since 4.0.01 |
| 2089 | + * @param string $min_version |
|
| 2065 | 2090 | */ |
| 2066 | 2091 | public static function min_pro_version_notice( $min_version ) { |
| 2067 | 2092 | if ( ! self::is_formidable_admin() ) { |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | 'fill' => '#4d4d4d', |
| 146 | 146 | 'orange' => '#f05a24', |
| 147 | 147 | ); |
| 148 | - $atts = array_merge( $defaults, $atts ); |
|
| 148 | + $atts = array_merge( $defaults, $atts ); |
|
| 149 | 149 | |
| 150 | 150 | return '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 599.68 601.37" width="' . esc_attr( $atts['width'] ) . '" height="' . esc_attr( $atts['height'] ) . '"> |
| 151 | 151 | <defs /> |
@@ -336,7 +336,7 @@ discard block |
||
| 336 | 336 | * @return string |
| 337 | 337 | */ |
| 338 | 338 | public static function get_server_value( $value ) { |
| 339 | - return isset( $_SERVER[ $value ] ) ? wp_strip_all_tags( wp_unslash( $_SERVER[ $value ] ) ) : ''; |
|
| 339 | + return isset( $_SERVER[$value] ) ? wp_strip_all_tags( wp_unslash( $_SERVER[$value] ) ) : ''; |
|
| 340 | 340 | } |
| 341 | 341 | |
| 342 | 342 | /** |
@@ -359,7 +359,7 @@ discard block |
||
| 359 | 359 | ); |
| 360 | 360 | $ip = ''; |
| 361 | 361 | foreach ( $ip_options as $key ) { |
| 362 | - if ( ! isset( $_SERVER[ $key ] ) ) { |
|
| 362 | + if ( ! isset( $_SERVER[$key] ) ) { |
|
| 363 | 363 | continue; |
| 364 | 364 | } |
| 365 | 365 | |
@@ -383,9 +383,9 @@ discard block |
||
| 383 | 383 | } |
| 384 | 384 | |
| 385 | 385 | if ( $src == 'get' ) { |
| 386 | - $value = isset( $_POST[ $param ] ) ? wp_unslash( $_POST[ $param ] ) : ( isset( $_GET[ $param ] ) ? wp_unslash( $_GET[ $param ] ) : $default ); |
|
| 387 | - if ( ! isset( $_POST[ $param ] ) && isset( $_GET[ $param ] ) && ! is_array( $value ) ) { |
|
| 388 | - $value = htmlspecialchars_decode( wp_unslash( $_GET[ $param ] ) ); |
|
| 386 | + $value = isset( $_POST[$param] ) ? wp_unslash( $_POST[$param] ) : ( isset( $_GET[$param] ) ? wp_unslash( $_GET[$param] ) : $default ); |
|
| 387 | + if ( ! isset( $_POST[$param] ) && isset( $_GET[$param] ) && ! is_array( $value ) ) { |
|
| 388 | + $value = htmlspecialchars_decode( wp_unslash( $_GET[$param] ) ); |
|
| 389 | 389 | } |
| 390 | 390 | self::sanitize_value( $sanitize, $value ); |
| 391 | 391 | } else { |
@@ -406,7 +406,7 @@ discard block |
||
| 406 | 406 | } |
| 407 | 407 | |
| 408 | 408 | $p = trim( $p, ']' ); |
| 409 | - $value = isset( $value[ $p ] ) ? $value[ $p ] : $default; |
|
| 409 | + $value = isset( $value[$p] ) ? $value[$p] : $default; |
|
| 410 | 410 | } |
| 411 | 411 | } |
| 412 | 412 | |
@@ -460,20 +460,20 @@ discard block |
||
| 460 | 460 | 'type' => 'get', |
| 461 | 461 | 'sanitize' => 'sanitize_text_field', |
| 462 | 462 | ); |
| 463 | - $args = wp_parse_args( $args, $defaults ); |
|
| 463 | + $args = wp_parse_args( $args, $defaults ); |
|
| 464 | 464 | |
| 465 | 465 | $value = $args['default']; |
| 466 | 466 | if ( $args['type'] == 'get' ) { |
| 467 | - if ( $_GET && isset( $_GET[ $args['param'] ] ) ) { |
|
| 468 | - $value = wp_unslash( $_GET[ $args['param'] ] ); |
|
| 467 | + if ( $_GET && isset( $_GET[$args['param']] ) ) { |
|
| 468 | + $value = wp_unslash( $_GET[$args['param']] ); |
|
| 469 | 469 | } |
| 470 | 470 | } elseif ( $args['type'] == 'post' ) { |
| 471 | - if ( isset( $_POST[ $args['param'] ] ) ) { |
|
| 472 | - $value = maybe_unserialize( wp_unslash( $_POST[ $args['param'] ] ) ); |
|
| 471 | + if ( isset( $_POST[$args['param']] ) ) { |
|
| 472 | + $value = maybe_unserialize( wp_unslash( $_POST[$args['param']] ) ); |
|
| 473 | 473 | } |
| 474 | 474 | } else { |
| 475 | - if ( isset( $_REQUEST[ $args['param'] ] ) ) { |
|
| 476 | - $value = wp_unslash( $_REQUEST[ $args['param'] ] ); |
|
| 475 | + if ( isset( $_REQUEST[$args['param']] ) ) { |
|
| 476 | + $value = wp_unslash( $_REQUEST[$args['param']] ); |
|
| 477 | 477 | } |
| 478 | 478 | } |
| 479 | 479 | |
@@ -505,7 +505,7 @@ discard block |
||
| 505 | 505 | if ( is_array( $value ) ) { |
| 506 | 506 | $temp_values = $value; |
| 507 | 507 | foreach ( $temp_values as $k => $v ) { |
| 508 | - self::sanitize_value( $sanitize, $value[ $k ] ); |
|
| 508 | + self::sanitize_value( $sanitize, $value[$k] ); |
|
| 509 | 509 | } |
| 510 | 510 | } else { |
| 511 | 511 | $value = call_user_func( $sanitize, $value ); |
@@ -516,8 +516,8 @@ discard block |
||
| 516 | 516 | public static function sanitize_request( $sanitize_method, &$values ) { |
| 517 | 517 | $temp_values = $values; |
| 518 | 518 | foreach ( $temp_values as $k => $val ) { |
| 519 | - if ( isset( $sanitize_method[ $k ] ) ) { |
|
| 520 | - $values[ $k ] = call_user_func( $sanitize_method[ $k ], $val ); |
|
| 519 | + if ( isset( $sanitize_method[$k] ) ) { |
|
| 520 | + $values[$k] = call_user_func( $sanitize_method[$k], $val ); |
|
| 521 | 521 | } |
| 522 | 522 | } |
| 523 | 523 | } |
@@ -540,7 +540,7 @@ discard block |
||
| 540 | 540 | if ( is_array( $value ) ) { |
| 541 | 541 | $temp_values = $value; |
| 542 | 542 | foreach ( $temp_values as $k => $v ) { |
| 543 | - self::decode_specialchars( $value[ $k ] ); |
|
| 543 | + self::decode_specialchars( $value[$k] ); |
|
| 544 | 544 | } |
| 545 | 545 | } else { |
| 546 | 546 | $value = wp_specialchars_decode( $value, ENT_COMPAT ); |
@@ -573,7 +573,7 @@ discard block |
||
| 573 | 573 | $allowed_html = $html; |
| 574 | 574 | } elseif ( ! empty( $allowed ) ) { |
| 575 | 575 | foreach ( (array) $allowed as $a ) { |
| 576 | - $allowed_html[ $a ] = isset( $html[ $a ] ) ? $html[ $a ] : array(); |
|
| 576 | + $allowed_html[$a] = isset( $html[$a] ) ? $html[$a] : array(); |
|
| 577 | 577 | } |
| 578 | 578 | } |
| 579 | 579 | |
@@ -730,8 +730,8 @@ discard block |
||
| 730 | 730 | } |
| 731 | 731 | |
| 732 | 732 | global $wp_query; |
| 733 | - if ( isset( $wp_query->query_vars[ $param ] ) ) { |
|
| 734 | - $value = $wp_query->query_vars[ $param ]; |
|
| 733 | + if ( isset( $wp_query->query_vars[$param] ) ) { |
|
| 734 | + $value = $wp_query->query_vars[$param]; |
|
| 735 | 735 | } |
| 736 | 736 | |
| 737 | 737 | return $value; |
@@ -895,7 +895,7 @@ discard block |
||
| 895 | 895 | 'new_file_path' => self::plugin_path() . '/js', |
| 896 | 896 | ) |
| 897 | 897 | ); |
| 898 | - $new_file = new FrmCreateFile( $file_atts ); |
|
| 898 | + $new_file = new FrmCreateFile( $file_atts ); |
|
| 899 | 899 | |
| 900 | 900 | $files = array( |
| 901 | 901 | self::plugin_path() . '/js/jquery/jquery.placeholder.min.js', |
@@ -1153,8 +1153,8 @@ discard block |
||
| 1153 | 1153 | return $error; |
| 1154 | 1154 | } |
| 1155 | 1155 | |
| 1156 | - $nonce_value = ( $_REQUEST && isset( $_REQUEST[ $nonce_name ] ) ) ? sanitize_text_field( wp_unslash( $_REQUEST[ $nonce_name ] ) ) : ''; |
|
| 1157 | - if ( $_REQUEST && ( ! isset( $_REQUEST[ $nonce_name ] ) || ! wp_verify_nonce( $nonce_value, $nonce ) ) ) { |
|
| 1156 | + $nonce_value = ( $_REQUEST && isset( $_REQUEST[$nonce_name] ) ) ? sanitize_text_field( wp_unslash( $_REQUEST[$nonce_name] ) ) : ''; |
|
| 1157 | + if ( $_REQUEST && ( ! isset( $_REQUEST[$nonce_name] ) || ! wp_verify_nonce( $nonce_value, $nonce ) ) ) { |
|
| 1158 | 1158 | $frm_settings = self::get_settings(); |
| 1159 | 1159 | $error = $frm_settings->admin_permission; |
| 1160 | 1160 | } |
@@ -1189,7 +1189,7 @@ discard block |
||
| 1189 | 1189 | } else { |
| 1190 | 1190 | foreach ( $value as $k => $v ) { |
| 1191 | 1191 | if ( ! is_array( $v ) ) { |
| 1192 | - $value[ $k ] = call_user_func( $original_function, $v ); |
|
| 1192 | + $value[$k] = call_user_func( $original_function, $v ); |
|
| 1193 | 1193 | } |
| 1194 | 1194 | } |
| 1195 | 1195 | } |
@@ -1214,7 +1214,7 @@ discard block |
||
| 1214 | 1214 | $return = array_merge( $return, self::array_flatten( $value, $keys ) ); |
| 1215 | 1215 | } else { |
| 1216 | 1216 | if ( $keys == 'keep' ) { |
| 1217 | - $return[ $key ] = $value; |
|
| 1217 | + $return[$key] = $value; |
|
| 1218 | 1218 | } else { |
| 1219 | 1219 | $return[] = $value; |
| 1220 | 1220 | } |
@@ -1278,11 +1278,11 @@ discard block |
||
| 1278 | 1278 | } |
| 1279 | 1279 | |
| 1280 | 1280 | $ver = $default; |
| 1281 | - if ( ! isset( $wp_scripts->registered[ $handle ] ) ) { |
|
| 1281 | + if ( ! isset( $wp_scripts->registered[$handle] ) ) { |
|
| 1282 | 1282 | return $ver; |
| 1283 | 1283 | } |
| 1284 | 1284 | |
| 1285 | - $query = $wp_scripts->registered[ $handle ]; |
|
| 1285 | + $query = $wp_scripts->registered[$handle]; |
|
| 1286 | 1286 | if ( is_object( $query ) && ! empty( $query->ver ) ) { |
| 1287 | 1287 | $ver = $query->ver; |
| 1288 | 1288 | } |
@@ -1417,7 +1417,7 @@ discard block |
||
| 1417 | 1417 | |
| 1418 | 1418 | foreach ( array( 'name', 'description' ) as $var ) { |
| 1419 | 1419 | $default_val = isset( $record->{$var} ) ? $record->{$var} : ''; |
| 1420 | - $values[ $var ] = self::get_param( $var, $default_val, 'get', 'wp_kses_post' ); |
|
| 1420 | + $values[$var] = self::get_param( $var, $default_val, 'get', 'wp_kses_post' ); |
|
| 1421 | 1421 | unset( $var, $default_val ); |
| 1422 | 1422 | } |
| 1423 | 1423 | |
@@ -1472,8 +1472,8 @@ discard block |
||
| 1472 | 1472 | } |
| 1473 | 1473 | } |
| 1474 | 1474 | |
| 1475 | - $field_type = isset( $post_values['field_options'][ 'type_' . $field->id ] ) ? $post_values['field_options'][ 'type_' . $field->id ] : $field->type; |
|
| 1476 | - $new_value = isset( $post_values['item_meta'][ $field->id ] ) ? maybe_unserialize( $post_values['item_meta'][ $field->id ] ) : $meta_value; |
|
| 1475 | + $field_type = isset( $post_values['field_options']['type_' . $field->id] ) ? $post_values['field_options']['type_' . $field->id] : $field->type; |
|
| 1476 | + $new_value = isset( $post_values['item_meta'][$field->id] ) ? maybe_unserialize( $post_values['item_meta'][$field->id] ) : $meta_value; |
|
| 1477 | 1477 | |
| 1478 | 1478 | $field_array = self::start_field_array( $field ); |
| 1479 | 1479 | $field_array['value'] = $new_value; |
@@ -1490,7 +1490,7 @@ discard block |
||
| 1490 | 1490 | |
| 1491 | 1491 | $field_array = array_merge( $field->field_options, $field_array ); |
| 1492 | 1492 | |
| 1493 | - $values['fields'][ $field->id ] = $field_array; |
|
| 1493 | + $values['fields'][$field->id] = $field_array; |
|
| 1494 | 1494 | } |
| 1495 | 1495 | |
| 1496 | 1496 | /** |
@@ -1537,7 +1537,7 @@ discard block |
||
| 1537 | 1537 | } |
| 1538 | 1538 | |
| 1539 | 1539 | foreach ( $form->options as $opt => $value ) { |
| 1540 | - $values[ $opt ] = isset( $post_values[ $opt ] ) ? maybe_unserialize( $post_values[ $opt ] ) : $value; |
|
| 1540 | + $values[$opt] = isset( $post_values[$opt] ) ? maybe_unserialize( $post_values[$opt] ) : $value; |
|
| 1541 | 1541 | } |
| 1542 | 1542 | |
| 1543 | 1543 | self::fill_form_defaults( $post_values, $values ); |
@@ -1550,8 +1550,8 @@ discard block |
||
| 1550 | 1550 | $form_defaults = FrmFormsHelper::get_default_opts(); |
| 1551 | 1551 | |
| 1552 | 1552 | foreach ( $form_defaults as $opt => $default ) { |
| 1553 | - if ( ! isset( $values[ $opt ] ) || $values[ $opt ] == '' ) { |
|
| 1554 | - $values[ $opt ] = ( $post_values && isset( $post_values['options'][ $opt ] ) ) ? $post_values['options'][ $opt ] : $default; |
|
| 1553 | + if ( ! isset( $values[$opt] ) || $values[$opt] == '' ) { |
|
| 1554 | + $values[$opt] = ( $post_values && isset( $post_values['options'][$opt] ) ) ? $post_values['options'][$opt] : $default; |
|
| 1555 | 1555 | } |
| 1556 | 1556 | |
| 1557 | 1557 | unset( $opt, $default ); |
@@ -1562,8 +1562,8 @@ discard block |
||
| 1562 | 1562 | } |
| 1563 | 1563 | |
| 1564 | 1564 | foreach ( array( 'before', 'after', 'submit' ) as $h ) { |
| 1565 | - if ( ! isset( $values[ $h . '_html' ] ) ) { |
|
| 1566 | - $values[ $h . '_html' ] = ( isset( $post_values['options'][ $h . '_html' ] ) ? $post_values['options'][ $h . '_html' ] : FrmFormsHelper::get_default_html( $h ) ); |
|
| 1565 | + if ( ! isset( $values[$h . '_html'] ) ) { |
|
| 1566 | + $values[$h . '_html'] = ( isset( $post_values['options'][$h . '_html'] ) ? $post_values['options'][$h . '_html'] : FrmFormsHelper::get_default_html( $h ) ); |
|
| 1567 | 1567 | } |
| 1568 | 1568 | unset( $h ); |
| 1569 | 1569 | } |
@@ -1713,10 +1713,10 @@ discard block |
||
| 1713 | 1713 | $time_strings = self::get_time_strings(); |
| 1714 | 1714 | |
| 1715 | 1715 | foreach ( $time_strings as $k => $v ) { |
| 1716 | - if ( $diff[ $k ] ) { |
|
| 1717 | - $time_strings[ $k ] = $diff[ $k ] . ' ' . ( $diff[ $k ] > 1 ? $v[1] : $v[0] ); |
|
| 1716 | + if ( $diff[$k] ) { |
|
| 1717 | + $time_strings[$k] = $diff[$k] . ' ' . ( $diff[$k] > 1 ? $v[1] : $v[0] ); |
|
| 1718 | 1718 | } else { |
| 1719 | - unset( $time_strings[ $k ] ); |
|
| 1719 | + unset( $time_strings[$k] ); |
|
| 1720 | 1720 | } |
| 1721 | 1721 | } |
| 1722 | 1722 | |
@@ -1797,17 +1797,17 @@ discard block |
||
| 1797 | 1797 | |
| 1798 | 1798 | case 1: |
| 1799 | 1799 | $l2 = $name; |
| 1800 | - self::add_value_to_array( $name, $l2, $this_val, $vars[ $l1 ] ); |
|
| 1800 | + self::add_value_to_array( $name, $l2, $this_val, $vars[$l1] ); |
|
| 1801 | 1801 | break; |
| 1802 | 1802 | |
| 1803 | 1803 | case 2: |
| 1804 | 1804 | $l3 = $name; |
| 1805 | - self::add_value_to_array( $name, $l3, $this_val, $vars[ $l1 ][ $l2 ] ); |
|
| 1805 | + self::add_value_to_array( $name, $l3, $this_val, $vars[$l1][$l2] ); |
|
| 1806 | 1806 | break; |
| 1807 | 1807 | |
| 1808 | 1808 | case 3: |
| 1809 | 1809 | $l4 = $name; |
| 1810 | - self::add_value_to_array( $name, $l4, $this_val, $vars[ $l1 ][ $l2 ][ $l3 ] ); |
|
| 1810 | + self::add_value_to_array( $name, $l4, $this_val, $vars[$l1][$l2][$l3] ); |
|
| 1811 | 1811 | } |
| 1812 | 1812 | |
| 1813 | 1813 | unset( $this_val, $n ); |
@@ -1826,8 +1826,8 @@ discard block |
||
| 1826 | 1826 | public static function add_value_to_array( $name, $l1, $val, &$vars ) { |
| 1827 | 1827 | if ( $name == '' ) { |
| 1828 | 1828 | $vars[] = $val; |
| 1829 | - } elseif ( ! isset( $vars[ $l1 ] ) ) { |
|
| 1830 | - $vars[ $l1 ] = $val; |
|
| 1829 | + } elseif ( ! isset( $vars[$l1] ) ) { |
|
| 1830 | + $vars[$l1] = $val; |
|
| 1831 | 1831 | } |
| 1832 | 1832 | } |
| 1833 | 1833 | |
@@ -1843,7 +1843,7 @@ discard block |
||
| 1843 | 1843 | 'email_subject' => esc_attr( sprintf( __( 'If you leave the subject blank, the default will be used: %1$s Form submitted on %2$s', 'formidable' ), $form_name, self::site_name() ) ), |
| 1844 | 1844 | ); |
| 1845 | 1845 | |
| 1846 | - if ( ! isset( $tooltips[ $name ] ) ) { |
|
| 1846 | + if ( ! isset( $tooltips[$name] ) ) { |
|
| 1847 | 1847 | return; |
| 1848 | 1848 | } |
| 1849 | 1849 | |
@@ -1853,7 +1853,7 @@ discard block |
||
| 1853 | 1853 | echo ' class="frm_help"'; |
| 1854 | 1854 | } |
| 1855 | 1855 | |
| 1856 | - echo ' title="' . esc_attr( $tooltips[ $name ] ); |
|
| 1856 | + echo ' title="' . esc_attr( $tooltips[$name] ); |
|
| 1857 | 1857 | |
| 1858 | 1858 | if ( 'open' != $class ) { |
| 1859 | 1859 | echo '"'; |
@@ -1906,13 +1906,13 @@ discard block |
||
| 1906 | 1906 | } |
| 1907 | 1907 | |
| 1908 | 1908 | private static function prepare_action_slashes( $val, $key, &$post_content ) { |
| 1909 | - if ( ! isset( $post_content[ $key ] ) ) { |
|
| 1909 | + if ( ! isset( $post_content[$key] ) ) { |
|
| 1910 | 1910 | return; |
| 1911 | 1911 | } |
| 1912 | 1912 | |
| 1913 | 1913 | if ( is_array( $val ) ) { |
| 1914 | 1914 | foreach ( $val as $k1 => $v1 ) { |
| 1915 | - self::prepare_action_slashes( $v1, $k1, $post_content[ $key ] ); |
|
| 1915 | + self::prepare_action_slashes( $v1, $k1, $post_content[$key] ); |
|
| 1916 | 1916 | unset( $k1, $v1 ); |
| 1917 | 1917 | } |
| 1918 | 1918 | } else { |
@@ -1920,7 +1920,7 @@ discard block |
||
| 1920 | 1920 | $val = stripslashes( $val ); |
| 1921 | 1921 | |
| 1922 | 1922 | // Add backslashes before double quotes and forward slashes only |
| 1923 | - $post_content[ $key ] = addcslashes( $val, '"\\/' ); |
|
| 1923 | + $post_content[$key] = addcslashes( $val, '"\\/' ); |
|
| 1924 | 1924 | } |
| 1925 | 1925 | } |
| 1926 | 1926 | |
@@ -93,7 +93,7 @@ |
||
| 93 | 93 | printf( |
| 94 | 94 | /* translators: %s: Field type */ |
| 95 | 95 | esc_html__( '%s Options', 'formidable' ), |
| 96 | - esc_html( $all_field_types[ $display['type'] ]['name'] ) |
|
| 96 | + esc_html( $all_field_types[$display['type']]['name'] ) |
|
| 97 | 97 | ); |
| 98 | 98 | ?> |
| 99 | 99 | <i class="frm_icon_font frm_arrowdown6_icon"></i> |
@@ -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,20 +297,20 @@ 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 | } elseif ( $ck == $subkey ) { |
| 313 | - $action[ $ck ] = FrmFieldsHelper::switch_field_ids( $action[ $ck ] ); |
|
| 313 | + $action[$ck] = FrmFieldsHelper::switch_field_ids( $action[$ck] ); |
|
| 314 | 314 | } |
| 315 | 315 | } |
| 316 | 316 | } |
@@ -333,8 +333,8 @@ discard block |
||
| 333 | 333 | return; |
| 334 | 334 | } |
| 335 | 335 | |
| 336 | - if ( isset( $_POST[ $this->option_name ] ) && is_array( $_POST[ $this->option_name ] ) ) { |
|
| 337 | - $settings = wp_unslash( $_POST[ $this->option_name ] ); |
|
| 336 | + if ( isset( $_POST[$this->option_name] ) && is_array( $_POST[$this->option_name] ) ) { |
|
| 337 | + $settings = wp_unslash( $_POST[$this->option_name] ); |
|
| 338 | 338 | } else { |
| 339 | 339 | return; |
| 340 | 340 | } |
@@ -344,7 +344,7 @@ discard block |
||
| 344 | 344 | foreach ( $settings as $number => $new_instance ) { |
| 345 | 345 | $this->_set( $number ); |
| 346 | 346 | |
| 347 | - $old_instance = isset( $all_instances[ $number ] ) ? $all_instances[ $number ] : array(); |
|
| 347 | + $old_instance = isset( $all_instances[$number] ) ? $all_instances[$number] : array(); |
|
| 348 | 348 | |
| 349 | 349 | if ( ! isset( $new_instance['post_status'] ) ) { |
| 350 | 350 | $new_instance['post_status'] = 'draft'; |
@@ -384,7 +384,7 @@ discard block |
||
| 384 | 384 | $instance['post_content'] = apply_filters( 'frm_before_save_' . $this->id_base . '_action', $new_instance['post_content'], $instance, $new_instance, $old_instance, $this ); |
| 385 | 385 | |
| 386 | 386 | if ( false !== $instance ) { |
| 387 | - $all_instances[ $number ] = $instance; |
|
| 387 | + $all_instances[$number] = $instance; |
|
| 388 | 388 | } |
| 389 | 389 | |
| 390 | 390 | $action_ids[] = $this->save_settings( $instance ); |
@@ -460,12 +460,12 @@ discard block |
||
| 460 | 460 | // some plugins/themes are formatting the post_excerpt |
| 461 | 461 | $action->post_excerpt = sanitize_title( $action->post_excerpt ); |
| 462 | 462 | |
| 463 | - if ( ! isset( $action_controls[ $action->post_excerpt ] ) ) { |
|
| 463 | + if ( ! isset( $action_controls[$action->post_excerpt] ) ) { |
|
| 464 | 464 | continue; |
| 465 | 465 | } |
| 466 | 466 | |
| 467 | - $action = $action_controls[ $action->post_excerpt ]->prepare_action( $action ); |
|
| 468 | - $settings[ $action->ID ] = $action; |
|
| 467 | + $action = $action_controls[$action->post_excerpt]->prepare_action( $action ); |
|
| 468 | + $settings[$action->ID] = $action; |
|
| 469 | 469 | |
| 470 | 470 | if ( count( $settings ) >= $limit ) { |
| 471 | 471 | break; |
@@ -495,7 +495,7 @@ discard block |
||
| 495 | 495 | 'limit' => 99, |
| 496 | 496 | 'post_status' => $default_status, |
| 497 | 497 | ); |
| 498 | - $args = wp_parse_args( $args, $defaults ); |
|
| 498 | + $args = wp_parse_args( $args, $defaults ); |
|
| 499 | 499 | } |
| 500 | 500 | |
| 501 | 501 | /** |
@@ -556,7 +556,7 @@ discard block |
||
| 556 | 556 | |
| 557 | 557 | $action = $this->prepare_action( $action ); |
| 558 | 558 | |
| 559 | - $settings[ $action->ID ] = $action; |
|
| 559 | + $settings[$action->ID] = $action; |
|
| 560 | 560 | } |
| 561 | 561 | |
| 562 | 562 | if ( 1 === $limit ) { |
@@ -593,10 +593,10 @@ discard block |
||
| 593 | 593 | |
| 594 | 594 | foreach ( $default_values as $k => $vals ) { |
| 595 | 595 | if ( is_array( $vals ) && ! empty( $vals ) ) { |
| 596 | - if ( 'event' == $k && ! $this->action_options['force_event'] && ! empty( $action->post_content[ $k ] ) ) { |
|
| 596 | + if ( 'event' == $k && ! $this->action_options['force_event'] && ! empty( $action->post_content[$k] ) ) { |
|
| 597 | 597 | continue; |
| 598 | 598 | } |
| 599 | - $action->post_content[ $k ] = wp_parse_args( $action->post_content[ $k ], $vals ); |
|
| 599 | + $action->post_content[$k] = wp_parse_args( $action->post_content[$k], $vals ); |
|
| 600 | 600 | } |
| 601 | 601 | } |
| 602 | 602 | |
@@ -674,9 +674,9 @@ discard block |
||
| 674 | 674 | |
| 675 | 675 | // fill with existing options |
| 676 | 676 | foreach ( $action->post_content as $name => $val ) { |
| 677 | - if ( isset( $form->options[ $name ] ) ) { |
|
| 678 | - $action->post_content[ $name ] = $form->options[ $name ]; |
|
| 679 | - unset( $form->options[ $name ] ); |
|
| 677 | + if ( isset( $form->options[$name] ) ) { |
|
| 678 | + $action->post_content[$name] = $form->options[$name]; |
|
| 679 | + unset( $form->options[$name] ); |
|
| 680 | 680 | } |
| 681 | 681 | } |
| 682 | 682 | |
@@ -737,7 +737,7 @@ discard block |
||
| 737 | 737 | $stop = $stop ? false : true; |
| 738 | 738 | } |
| 739 | 739 | |
| 740 | - $met[ $stop ] = $stop; |
|
| 740 | + $met[$stop] = $stop; |
|
| 741 | 741 | } |
| 742 | 742 | |
| 743 | 743 | if ( $notification['conditions']['any_all'] == 'all' && ! empty( $met ) && isset( $met[0] ) && isset( $met[1] ) ) { |
@@ -779,8 +779,8 @@ discard block |
||
| 779 | 779 | private static function get_value_from_entry( $entry, $field_id ) { |
| 780 | 780 | $observed_value = ''; |
| 781 | 781 | |
| 782 | - if ( isset( $entry->metas[ $field_id ] ) ) { |
|
| 783 | - $observed_value = $entry->metas[ $field_id ]; |
|
| 782 | + if ( isset( $entry->metas[$field_id] ) ) { |
|
| 783 | + $observed_value = $entry->metas[$field_id]; |
|
| 784 | 784 | } elseif ( $entry->post_id && FrmAppHelper::pro_is_installed() ) { |
| 785 | 785 | $field = FrmField::getOne( $field_id ); |
| 786 | 786 | $observed_value = FrmProEntryMetaHelper::get_post_or_meta_value( |
@@ -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 | FrmProEntriesHelper::get_dynamic_list_values( $field, $entry, $field_value ); |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | $child_entries = FrmEntry::getAll( array( 'it.parent_item_id' => $entry->id ) ); |
| 186 | 186 | } else { |
| 187 | 187 | // Get all values for this field. |
| 188 | - $child_values = isset( $entry->metas[ $atts['embedded_field_id'] ] ) ? $entry->metas[ $atts['embedded_field_id'] ] : false; |
|
| 188 | + $child_values = isset( $entry->metas[$atts['embedded_field_id']] ) ? $entry->metas[$atts['embedded_field_id']] : false; |
|
| 189 | 189 | |
| 190 | 190 | if ( $child_values ) { |
| 191 | 191 | $child_entries = FrmEntry::getAll( array( 'it.id' => (array) $child_values ) ); |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | $value = $args['temp_value']; |
| 299 | 299 | } |
| 300 | 300 | if ( empty( $args['parent_field_id'] ) ) { |
| 301 | - $_POST['item_meta'][ $field->id ] = $value; |
|
| 301 | + $_POST['item_meta'][$field->id] = $value; |
|
| 302 | 302 | } else { |
| 303 | 303 | self::set_parent_field_posted_value( $field, $value, $args ); |
| 304 | 304 | } |
@@ -310,29 +310,29 @@ discard block |
||
| 310 | 310 | * @since 4.01 |
| 311 | 311 | */ |
| 312 | 312 | private static function set_parent_field_posted_value( $field, $value, $args ) { |
| 313 | - if ( isset( $_POST['item_meta'][ $args['parent_field_id'] ] ) && |
|
| 314 | - is_array( $_POST['item_meta'][ $args['parent_field_id'] ] ) ) { |
|
| 313 | + if ( isset( $_POST['item_meta'][$args['parent_field_id']] ) && |
|
| 314 | + is_array( $_POST['item_meta'][$args['parent_field_id']] ) ) { |
|
| 315 | 315 | |
| 316 | - if ( ! isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ] ) || |
|
| 317 | - ! is_array( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ] ) ) { |
|
| 318 | - $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ] = array(); |
|
| 316 | + if ( ! isset( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']] ) || |
|
| 317 | + ! is_array( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']] ) ) { |
|
| 318 | + $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']] = array(); |
|
| 319 | 319 | } |
| 320 | 320 | } else { |
| 321 | 321 | // All of the section was probably removed. |
| 322 | - $_POST['item_meta'][ $args['parent_field_id'] ] = array(); |
|
| 323 | - $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ] = array(); |
|
| 322 | + $_POST['item_meta'][$args['parent_field_id']] = array(); |
|
| 323 | + $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']] = array(); |
|
| 324 | 324 | } |
| 325 | 325 | |
| 326 | - $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field->id ] = $value; |
|
| 326 | + $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']][$field->id] = $value; |
|
| 327 | 327 | } |
| 328 | 328 | |
| 329 | 329 | public static function get_posted_value( $field, &$value, $args ) { |
| 330 | 330 | $field_id = is_object( $field ) ? $field->id : $field; |
| 331 | 331 | |
| 332 | 332 | if ( empty( $args['parent_field_id'] ) ) { |
| 333 | - $value = isset( $_POST['item_meta'][ $field_id ] ) ? wp_unslash( $_POST['item_meta'][ $field_id ] ) : ''; |
|
| 333 | + $value = isset( $_POST['item_meta'][$field_id] ) ? wp_unslash( $_POST['item_meta'][$field_id] ) : ''; |
|
| 334 | 334 | } else { |
| 335 | - $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 ] ) : ''; |
|
| 335 | + $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] ) : ''; |
|
| 336 | 336 | } |
| 337 | 337 | |
| 338 | 338 | if ( is_array( $field ) ) { |
@@ -365,12 +365,12 @@ discard block |
||
| 365 | 365 | self::set_other_repeating_vals( $field, $value, $args ); |
| 366 | 366 | |
| 367 | 367 | // Check if there are any posted "Other" values. |
| 368 | - if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta']['other'][ $field->id ] ) ) { |
|
| 368 | + if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta']['other'][$field->id] ) ) { |
|
| 369 | 369 | |
| 370 | 370 | // Save original value. |
| 371 | 371 | $args['temp_value'] = $value; |
| 372 | 372 | $args['other'] = true; |
| 373 | - $other_vals = wp_unslash( $_POST['item_meta']['other'][ $field->id ] ); |
|
| 373 | + $other_vals = wp_unslash( $_POST['item_meta']['other'][$field->id] ); |
|
| 374 | 374 | |
| 375 | 375 | // Set the validation value now |
| 376 | 376 | self::set_other_validation_val( $value, $other_vals, $field, $args ); |
@@ -392,12 +392,12 @@ discard block |
||
| 392 | 392 | } |
| 393 | 393 | |
| 394 | 394 | // Check if there are any other posted "other" values for this field. |
| 395 | - if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ]['other'][ $field->id ] ) ) { |
|
| 395 | + if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']]['other'][$field->id] ) ) { |
|
| 396 | 396 | // Save original value |
| 397 | 397 | $args['temp_value'] = $value; |
| 398 | 398 | $args['other'] = true; |
| 399 | 399 | |
| 400 | - $other_vals = wp_unslash( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ]['other'][ $field->id ] ); |
|
| 400 | + $other_vals = wp_unslash( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']]['other'][$field->id] ); |
|
| 401 | 401 | |
| 402 | 402 | // Set the validation value now. |
| 403 | 403 | self::set_other_validation_val( $value, $other_vals, $field, $args ); |
@@ -434,25 +434,25 @@ discard block |
||
| 434 | 434 | |
| 435 | 435 | // Multi-select dropdown. |
| 436 | 436 | if ( is_array( $value ) ) { |
| 437 | - $o_key = array_search( $field->options[ $other_key ], $value ); |
|
| 437 | + $o_key = array_search( $field->options[$other_key], $value ); |
|
| 438 | 438 | |
| 439 | 439 | if ( $o_key !== false ) { |
| 440 | 440 | // Modify the original value so other key will be preserved. |
| 441 | - $value[ $other_key ] = $value[ $o_key ]; |
|
| 441 | + $value[$other_key] = $value[$o_key]; |
|
| 442 | 442 | |
| 443 | 443 | // By default, the array keys will be numeric for multi-select dropdowns. |
| 444 | 444 | // If going backwards and forwards between pages, the array key will match the other key. |
| 445 | 445 | if ( $o_key !== $other_key ) { |
| 446 | - unset( $value[ $o_key ] ); |
|
| 446 | + unset( $value[$o_key] ); |
|
| 447 | 447 | } |
| 448 | 448 | |
| 449 | 449 | $args['temp_value'] = $value; |
| 450 | - $value[ $other_key ] = reset( $other_vals ); |
|
| 451 | - if ( FrmAppHelper::is_empty_value( $value[ $other_key ] ) ) { |
|
| 452 | - unset( $value[ $other_key ] ); |
|
| 450 | + $value[$other_key] = reset( $other_vals ); |
|
| 451 | + if ( FrmAppHelper::is_empty_value( $value[$other_key] ) ) { |
|
| 452 | + unset( $value[$other_key] ); |
|
| 453 | 453 | } |
| 454 | 454 | } |
| 455 | - } elseif ( $field->options[ $other_key ] == $value ) { |
|
| 455 | + } elseif ( $field->options[$other_key] == $value ) { |
|
| 456 | 456 | $value = $other_vals; |
| 457 | 457 | } |
| 458 | 458 | } |