@@ -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 | |
@@ -410,6 +416,9 @@ discard block |
||
| 410 | 416 | return $value; |
| 411 | 417 | } |
| 412 | 418 | |
| 419 | + /** |
|
| 420 | + * @param string $param |
|
| 421 | + */ |
|
| 413 | 422 | public static function get_post_param( $param, $default = '', $sanitize = '', $serialized = false ) { |
| 414 | 423 | return self::get_simple_request( |
| 415 | 424 | array( |
@@ -1178,6 +1187,9 @@ discard block |
||
| 1178 | 1187 | return ( is_array( $values ) && in_array( $current, $values ) ) || ( ! is_array( $values ) && $values == $current ); |
| 1179 | 1188 | } |
| 1180 | 1189 | |
| 1190 | + /** |
|
| 1191 | + * @param string $function |
|
| 1192 | + */ |
|
| 1181 | 1193 | public static function recursive_function_map( $value, $function ) { |
| 1182 | 1194 | if ( is_array( $value ) ) { |
| 1183 | 1195 | $original_function = $function; |
@@ -1226,6 +1238,9 @@ discard block |
||
| 1226 | 1238 | return $return; |
| 1227 | 1239 | } |
| 1228 | 1240 | |
| 1241 | + /** |
|
| 1242 | + * @return string |
|
| 1243 | + */ |
|
| 1229 | 1244 | public static function esc_textarea( $text, $is_rich_text = false ) { |
| 1230 | 1245 | $safe_text = str_replace( '"', '"', $text ); |
| 1231 | 1246 | if ( ! $is_rich_text ) { |
@@ -1438,6 +1453,9 @@ discard block |
||
| 1438 | 1453 | return $values; |
| 1439 | 1454 | } |
| 1440 | 1455 | |
| 1456 | + /** |
|
| 1457 | + * @param string $fields |
|
| 1458 | + */ |
|
| 1441 | 1459 | private static function prepare_field_arrays( $fields, $record, array &$values, $args ) { |
| 1442 | 1460 | if ( ! empty( $fields ) ) { |
| 1443 | 1461 | foreach ( (array) $fields as $field ) { |
@@ -1641,6 +1659,9 @@ discard block |
||
| 1641 | 1659 | return $sub . ( ( $len < $original_len ) ? $continue : '' ); |
| 1642 | 1660 | } |
| 1643 | 1661 | |
| 1662 | + /** |
|
| 1663 | + * @param string[] $function_names |
|
| 1664 | + */ |
|
| 1644 | 1665 | public static function mb_function( $function_names, $args ) { |
| 1645 | 1666 | $mb_function_name = $function_names[0]; |
| 1646 | 1667 | $function_name = $function_names[1]; |
@@ -1675,6 +1696,9 @@ discard block |
||
| 1675 | 1696 | return $formatted; |
| 1676 | 1697 | } |
| 1677 | 1698 | |
| 1699 | + /** |
|
| 1700 | + * @param string $time_format |
|
| 1701 | + */ |
|
| 1678 | 1702 | private static function add_time_to_date( $time_format, $date ) { |
| 1679 | 1703 | if ( empty( $time_format ) ) { |
| 1680 | 1704 | $time_format = get_option( 'time_format' ); |
@@ -1999,6 +2023,7 @@ discard block |
||
| 1999 | 2023 | |
| 2000 | 2024 | /** |
| 2001 | 2025 | * @since 4.02.03 |
| 2026 | + * @return string |
|
| 2002 | 2027 | */ |
| 2003 | 2028 | public static function maybe_json_encode( $value ) { |
| 2004 | 2029 | if ( is_array( $value ) ) { |
@@ -2152,6 +2177,7 @@ discard block |
||
| 2152 | 2177 | * If Pro is far outdated, show a message. |
| 2153 | 2178 | * |
| 2154 | 2179 | * @since 4.0.01 |
| 2180 | + * @param string $min_version |
|
| 2155 | 2181 | */ |
| 2156 | 2182 | public static function min_pro_version_notice( $min_version ) { |
| 2157 | 2183 | if ( ! self::is_formidable_admin() ) { |
@@ -1998,8 +1998,8 @@ |
||
| 1998 | 1998 | } |
| 1999 | 1999 | |
| 2000 | 2000 | /** |
| 2001 | - * @since 4.02.03 |
|
| 2002 | - */ |
|
| 2001 | + * @since 4.02.03 |
|
| 2002 | + */ |
|
| 2003 | 2003 | public static function maybe_json_encode( $value ) { |
| 2004 | 2004 | if ( is_array( $value ) ) { |
| 2005 | 2005 | $value = wp_json_encode( $value ); |
@@ -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 | <path fill="' . esc_attr( $atts['orange'] ) . '" d="M289.6 384h140v76h-140z"/> |
@@ -333,7 +333,7 @@ discard block |
||
| 333 | 333 | * @return string |
| 334 | 334 | */ |
| 335 | 335 | public static function get_server_value( $value ) { |
| 336 | - return isset( $_SERVER[ $value ] ) ? wp_strip_all_tags( wp_unslash( $_SERVER[ $value ] ) ) : ''; |
|
| 336 | + return isset( $_SERVER[$value] ) ? wp_strip_all_tags( wp_unslash( $_SERVER[$value] ) ) : ''; |
|
| 337 | 337 | } |
| 338 | 338 | |
| 339 | 339 | /** |
@@ -356,7 +356,7 @@ discard block |
||
| 356 | 356 | ); |
| 357 | 357 | $ip = ''; |
| 358 | 358 | foreach ( $ip_options as $key ) { |
| 359 | - if ( ! isset( $_SERVER[ $key ] ) ) { |
|
| 359 | + if ( ! isset( $_SERVER[$key] ) ) { |
|
| 360 | 360 | continue; |
| 361 | 361 | } |
| 362 | 362 | |
@@ -380,9 +380,9 @@ discard block |
||
| 380 | 380 | } |
| 381 | 381 | |
| 382 | 382 | if ( $src == 'get' ) { |
| 383 | - $value = isset( $_POST[ $param ] ) ? wp_unslash( $_POST[ $param ] ) : ( isset( $_GET[ $param ] ) ? wp_unslash( $_GET[ $param ] ) : $default ); |
|
| 384 | - if ( ! isset( $_POST[ $param ] ) && isset( $_GET[ $param ] ) && ! is_array( $value ) ) { |
|
| 385 | - $value = htmlspecialchars_decode( wp_unslash( $_GET[ $param ] ) ); |
|
| 383 | + $value = isset( $_POST[$param] ) ? wp_unslash( $_POST[$param] ) : ( isset( $_GET[$param] ) ? wp_unslash( $_GET[$param] ) : $default ); |
|
| 384 | + if ( ! isset( $_POST[$param] ) && isset( $_GET[$param] ) && ! is_array( $value ) ) { |
|
| 385 | + $value = htmlspecialchars_decode( wp_unslash( $_GET[$param] ) ); |
|
| 386 | 386 | } |
| 387 | 387 | self::sanitize_value( $sanitize, $value ); |
| 388 | 388 | } else { |
@@ -403,7 +403,7 @@ discard block |
||
| 403 | 403 | } |
| 404 | 404 | |
| 405 | 405 | $p = trim( $p, ']' ); |
| 406 | - $value = isset( $value[ $p ] ) ? $value[ $p ] : $default; |
|
| 406 | + $value = isset( $value[$p] ) ? $value[$p] : $default; |
|
| 407 | 407 | } |
| 408 | 408 | } |
| 409 | 409 | |
@@ -459,23 +459,23 @@ discard block |
||
| 459 | 459 | 'sanitize' => 'sanitize_text_field', |
| 460 | 460 | 'serialized' => false, |
| 461 | 461 | ); |
| 462 | - $args = wp_parse_args( $args, $defaults ); |
|
| 462 | + $args = wp_parse_args( $args, $defaults ); |
|
| 463 | 463 | |
| 464 | 464 | $value = $args['default']; |
| 465 | 465 | if ( $args['type'] == 'get' ) { |
| 466 | - if ( $_GET && isset( $_GET[ $args['param'] ] ) ) { |
|
| 467 | - $value = wp_unslash( $_GET[ $args['param'] ] ); |
|
| 466 | + if ( $_GET && isset( $_GET[$args['param']] ) ) { |
|
| 467 | + $value = wp_unslash( $_GET[$args['param']] ); |
|
| 468 | 468 | } |
| 469 | 469 | } elseif ( $args['type'] == 'post' ) { |
| 470 | - if ( isset( $_POST[ $args['param'] ] ) ) { |
|
| 471 | - $value = wp_unslash( $_POST[ $args['param'] ] ); |
|
| 470 | + if ( isset( $_POST[$args['param']] ) ) { |
|
| 471 | + $value = wp_unslash( $_POST[$args['param']] ); |
|
| 472 | 472 | if ( $args['serialized'] === true && is_serialized_string( $value ) && is_serialized( $value ) ) { |
| 473 | 473 | self::unserialize_or_decode( $value ); |
| 474 | 474 | } |
| 475 | 475 | } |
| 476 | 476 | } else { |
| 477 | - if ( isset( $_REQUEST[ $args['param'] ] ) ) { |
|
| 478 | - $value = wp_unslash( $_REQUEST[ $args['param'] ] ); |
|
| 477 | + if ( isset( $_REQUEST[$args['param']] ) ) { |
|
| 478 | + $value = wp_unslash( $_REQUEST[$args['param']] ); |
|
| 479 | 479 | } |
| 480 | 480 | } |
| 481 | 481 | |
@@ -507,7 +507,7 @@ discard block |
||
| 507 | 507 | if ( is_array( $value ) ) { |
| 508 | 508 | $temp_values = $value; |
| 509 | 509 | foreach ( $temp_values as $k => $v ) { |
| 510 | - self::sanitize_value( $sanitize, $value[ $k ] ); |
|
| 510 | + self::sanitize_value( $sanitize, $value[$k] ); |
|
| 511 | 511 | } |
| 512 | 512 | } else { |
| 513 | 513 | $value = call_user_func( $sanitize, $value ); |
@@ -518,8 +518,8 @@ discard block |
||
| 518 | 518 | public static function sanitize_request( $sanitize_method, &$values ) { |
| 519 | 519 | $temp_values = $values; |
| 520 | 520 | foreach ( $temp_values as $k => $val ) { |
| 521 | - if ( isset( $sanitize_method[ $k ] ) ) { |
|
| 522 | - $values[ $k ] = call_user_func( $sanitize_method[ $k ], $val ); |
|
| 521 | + if ( isset( $sanitize_method[$k] ) ) { |
|
| 522 | + $values[$k] = call_user_func( $sanitize_method[$k], $val ); |
|
| 523 | 523 | } |
| 524 | 524 | } |
| 525 | 525 | } |
@@ -542,7 +542,7 @@ discard block |
||
| 542 | 542 | if ( is_array( $value ) ) { |
| 543 | 543 | $temp_values = $value; |
| 544 | 544 | foreach ( $temp_values as $k => $v ) { |
| 545 | - self::decode_specialchars( $value[ $k ] ); |
|
| 545 | + self::decode_specialchars( $value[$k] ); |
|
| 546 | 546 | } |
| 547 | 547 | } else { |
| 548 | 548 | $value = wp_specialchars_decode( $value, ENT_COMPAT ); |
@@ -575,7 +575,7 @@ discard block |
||
| 575 | 575 | $allowed_html = $html; |
| 576 | 576 | } elseif ( ! empty( $allowed ) ) { |
| 577 | 577 | foreach ( (array) $allowed as $a ) { |
| 578 | - $allowed_html[ $a ] = isset( $html[ $a ] ) ? $html[ $a ] : array(); |
|
| 578 | + $allowed_html[$a] = isset( $html[$a] ) ? $html[$a] : array(); |
|
| 579 | 579 | } |
| 580 | 580 | } |
| 581 | 581 | |
@@ -732,8 +732,8 @@ discard block |
||
| 732 | 732 | } |
| 733 | 733 | |
| 734 | 734 | global $wp_query; |
| 735 | - if ( isset( $wp_query->query_vars[ $param ] ) ) { |
|
| 736 | - $value = $wp_query->query_vars[ $param ]; |
|
| 735 | + if ( isset( $wp_query->query_vars[$param] ) ) { |
|
| 736 | + $value = $wp_query->query_vars[$param]; |
|
| 737 | 737 | } |
| 738 | 738 | |
| 739 | 739 | return $value; |
@@ -897,7 +897,7 @@ discard block |
||
| 897 | 897 | 'new_file_path' => self::plugin_path() . '/js', |
| 898 | 898 | ) |
| 899 | 899 | ); |
| 900 | - $new_file = new FrmCreateFile( $file_atts ); |
|
| 900 | + $new_file = new FrmCreateFile( $file_atts ); |
|
| 901 | 901 | |
| 902 | 902 | $files = array( |
| 903 | 903 | self::plugin_path() . '/js/jquery/jquery.placeholder.min.js', |
@@ -1155,8 +1155,8 @@ discard block |
||
| 1155 | 1155 | return $error; |
| 1156 | 1156 | } |
| 1157 | 1157 | |
| 1158 | - $nonce_value = ( $_REQUEST && isset( $_REQUEST[ $nonce_name ] ) ) ? sanitize_text_field( wp_unslash( $_REQUEST[ $nonce_name ] ) ) : ''; |
|
| 1159 | - if ( $_REQUEST && ( ! isset( $_REQUEST[ $nonce_name ] ) || ! wp_verify_nonce( $nonce_value, $nonce ) ) ) { |
|
| 1158 | + $nonce_value = ( $_REQUEST && isset( $_REQUEST[$nonce_name] ) ) ? sanitize_text_field( wp_unslash( $_REQUEST[$nonce_name] ) ) : ''; |
|
| 1159 | + if ( $_REQUEST && ( ! isset( $_REQUEST[$nonce_name] ) || ! wp_verify_nonce( $nonce_value, $nonce ) ) ) { |
|
| 1160 | 1160 | $frm_settings = self::get_settings(); |
| 1161 | 1161 | $error = $frm_settings->admin_permission; |
| 1162 | 1162 | } |
@@ -1191,7 +1191,7 @@ discard block |
||
| 1191 | 1191 | } else { |
| 1192 | 1192 | foreach ( $value as $k => $v ) { |
| 1193 | 1193 | if ( ! is_array( $v ) ) { |
| 1194 | - $value[ $k ] = call_user_func( $original_function, $v ); |
|
| 1194 | + $value[$k] = call_user_func( $original_function, $v ); |
|
| 1195 | 1195 | } |
| 1196 | 1196 | } |
| 1197 | 1197 | } |
@@ -1216,7 +1216,7 @@ discard block |
||
| 1216 | 1216 | $return = array_merge( $return, self::array_flatten( $value, $keys ) ); |
| 1217 | 1217 | } else { |
| 1218 | 1218 | if ( $keys == 'keep' ) { |
| 1219 | - $return[ $key ] = $value; |
|
| 1219 | + $return[$key] = $value; |
|
| 1220 | 1220 | } else { |
| 1221 | 1221 | $return[] = $value; |
| 1222 | 1222 | } |
@@ -1280,11 +1280,11 @@ discard block |
||
| 1280 | 1280 | } |
| 1281 | 1281 | |
| 1282 | 1282 | $ver = $default; |
| 1283 | - if ( ! isset( $wp_scripts->registered[ $handle ] ) ) { |
|
| 1283 | + if ( ! isset( $wp_scripts->registered[$handle] ) ) { |
|
| 1284 | 1284 | return $ver; |
| 1285 | 1285 | } |
| 1286 | 1286 | |
| 1287 | - $query = $wp_scripts->registered[ $handle ]; |
|
| 1287 | + $query = $wp_scripts->registered[$handle]; |
|
| 1288 | 1288 | if ( is_object( $query ) && ! empty( $query->ver ) ) { |
| 1289 | 1289 | $ver = $query->ver; |
| 1290 | 1290 | } |
@@ -1419,7 +1419,7 @@ discard block |
||
| 1419 | 1419 | |
| 1420 | 1420 | foreach ( array( 'name', 'description' ) as $var ) { |
| 1421 | 1421 | $default_val = isset( $record->{$var} ) ? $record->{$var} : ''; |
| 1422 | - $values[ $var ] = self::get_param( $var, $default_val, 'get', 'wp_kses_post' ); |
|
| 1422 | + $values[$var] = self::get_param( $var, $default_val, 'get', 'wp_kses_post' ); |
|
| 1423 | 1423 | unset( $var, $default_val ); |
| 1424 | 1424 | } |
| 1425 | 1425 | |
@@ -1474,9 +1474,9 @@ discard block |
||
| 1474 | 1474 | } |
| 1475 | 1475 | } |
| 1476 | 1476 | |
| 1477 | - $field_type = isset( $post_values['field_options'][ 'type_' . $field->id ] ) ? $post_values['field_options'][ 'type_' . $field->id ] : $field->type; |
|
| 1478 | - if ( isset( $post_values['item_meta'][ $field->id ] ) ) { |
|
| 1479 | - $new_value = $post_values['item_meta'][ $field->id ]; |
|
| 1477 | + $field_type = isset( $post_values['field_options']['type_' . $field->id] ) ? $post_values['field_options']['type_' . $field->id] : $field->type; |
|
| 1478 | + if ( isset( $post_values['item_meta'][$field->id] ) ) { |
|
| 1479 | + $new_value = $post_values['item_meta'][$field->id]; |
|
| 1480 | 1480 | self::unserialize_or_decode( $new_value ); |
| 1481 | 1481 | } else { |
| 1482 | 1482 | $new_value = $meta_value; |
@@ -1497,7 +1497,7 @@ discard block |
||
| 1497 | 1497 | |
| 1498 | 1498 | $field_array = array_merge( $field->field_options, $field_array ); |
| 1499 | 1499 | |
| 1500 | - $values['fields'][ $field->id ] = $field_array; |
|
| 1500 | + $values['fields'][$field->id] = $field_array; |
|
| 1501 | 1501 | } |
| 1502 | 1502 | |
| 1503 | 1503 | /** |
@@ -1544,11 +1544,11 @@ discard block |
||
| 1544 | 1544 | } |
| 1545 | 1545 | |
| 1546 | 1546 | foreach ( $form->options as $opt => $value ) { |
| 1547 | - if ( isset( $post_values[ $opt ] ) ) { |
|
| 1548 | - $values[ $opt ] = $post_values[ $opt ]; |
|
| 1549 | - self::unserialize_or_decode( $values[ $opt ] ); |
|
| 1547 | + if ( isset( $post_values[$opt] ) ) { |
|
| 1548 | + $values[$opt] = $post_values[$opt]; |
|
| 1549 | + self::unserialize_or_decode( $values[$opt] ); |
|
| 1550 | 1550 | } else { |
| 1551 | - $values[ $opt ] = $value; |
|
| 1551 | + $values[$opt] = $value; |
|
| 1552 | 1552 | } |
| 1553 | 1553 | } |
| 1554 | 1554 | |
@@ -1562,8 +1562,8 @@ discard block |
||
| 1562 | 1562 | $form_defaults = FrmFormsHelper::get_default_opts(); |
| 1563 | 1563 | |
| 1564 | 1564 | foreach ( $form_defaults as $opt => $default ) { |
| 1565 | - if ( ! isset( $values[ $opt ] ) || $values[ $opt ] == '' ) { |
|
| 1566 | - $values[ $opt ] = ( $post_values && isset( $post_values['options'][ $opt ] ) ) ? $post_values['options'][ $opt ] : $default; |
|
| 1565 | + if ( ! isset( $values[$opt] ) || $values[$opt] == '' ) { |
|
| 1566 | + $values[$opt] = ( $post_values && isset( $post_values['options'][$opt] ) ) ? $post_values['options'][$opt] : $default; |
|
| 1567 | 1567 | } |
| 1568 | 1568 | |
| 1569 | 1569 | unset( $opt, $default ); |
@@ -1574,8 +1574,8 @@ discard block |
||
| 1574 | 1574 | } |
| 1575 | 1575 | |
| 1576 | 1576 | foreach ( array( 'before', 'after', 'submit' ) as $h ) { |
| 1577 | - if ( ! isset( $values[ $h . '_html' ] ) ) { |
|
| 1578 | - $values[ $h . '_html' ] = ( isset( $post_values['options'][ $h . '_html' ] ) ? $post_values['options'][ $h . '_html' ] : FrmFormsHelper::get_default_html( $h ) ); |
|
| 1577 | + if ( ! isset( $values[$h . '_html'] ) ) { |
|
| 1578 | + $values[$h . '_html'] = ( isset( $post_values['options'][$h . '_html'] ) ? $post_values['options'][$h . '_html'] : FrmFormsHelper::get_default_html( $h ) ); |
|
| 1579 | 1579 | } |
| 1580 | 1580 | unset( $h ); |
| 1581 | 1581 | } |
@@ -1725,10 +1725,10 @@ discard block |
||
| 1725 | 1725 | $time_strings = self::get_time_strings(); |
| 1726 | 1726 | |
| 1727 | 1727 | foreach ( $time_strings as $k => $v ) { |
| 1728 | - if ( $diff[ $k ] ) { |
|
| 1729 | - $time_strings[ $k ] = $diff[ $k ] . ' ' . ( $diff[ $k ] > 1 ? $v[1] : $v[0] ); |
|
| 1728 | + if ( $diff[$k] ) { |
|
| 1729 | + $time_strings[$k] = $diff[$k] . ' ' . ( $diff[$k] > 1 ? $v[1] : $v[0] ); |
|
| 1730 | 1730 | } else { |
| 1731 | - unset( $time_strings[ $k ] ); |
|
| 1731 | + unset( $time_strings[$k] ); |
|
| 1732 | 1732 | } |
| 1733 | 1733 | } |
| 1734 | 1734 | |
@@ -1809,17 +1809,17 @@ discard block |
||
| 1809 | 1809 | |
| 1810 | 1810 | case 1: |
| 1811 | 1811 | $l2 = $name; |
| 1812 | - self::add_value_to_array( $name, $l2, $this_val, $vars[ $l1 ] ); |
|
| 1812 | + self::add_value_to_array( $name, $l2, $this_val, $vars[$l1] ); |
|
| 1813 | 1813 | break; |
| 1814 | 1814 | |
| 1815 | 1815 | case 2: |
| 1816 | 1816 | $l3 = $name; |
| 1817 | - self::add_value_to_array( $name, $l3, $this_val, $vars[ $l1 ][ $l2 ] ); |
|
| 1817 | + self::add_value_to_array( $name, $l3, $this_val, $vars[$l1][$l2] ); |
|
| 1818 | 1818 | break; |
| 1819 | 1819 | |
| 1820 | 1820 | case 3: |
| 1821 | 1821 | $l4 = $name; |
| 1822 | - self::add_value_to_array( $name, $l4, $this_val, $vars[ $l1 ][ $l2 ][ $l3 ] ); |
|
| 1822 | + self::add_value_to_array( $name, $l4, $this_val, $vars[$l1][$l2][$l3] ); |
|
| 1823 | 1823 | } |
| 1824 | 1824 | |
| 1825 | 1825 | unset( $this_val, $n ); |
@@ -1838,8 +1838,8 @@ discard block |
||
| 1838 | 1838 | public static function add_value_to_array( $name, $l1, $val, &$vars ) { |
| 1839 | 1839 | if ( $name == '' ) { |
| 1840 | 1840 | $vars[] = $val; |
| 1841 | - } elseif ( ! isset( $vars[ $l1 ] ) ) { |
|
| 1842 | - $vars[ $l1 ] = $val; |
|
| 1841 | + } elseif ( ! isset( $vars[$l1] ) ) { |
|
| 1842 | + $vars[$l1] = $val; |
|
| 1843 | 1843 | } |
| 1844 | 1844 | } |
| 1845 | 1845 | |
@@ -1855,7 +1855,7 @@ discard block |
||
| 1855 | 1855 | '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() ) ), |
| 1856 | 1856 | ); |
| 1857 | 1857 | |
| 1858 | - if ( ! isset( $tooltips[ $name ] ) ) { |
|
| 1858 | + if ( ! isset( $tooltips[$name] ) ) { |
|
| 1859 | 1859 | return; |
| 1860 | 1860 | } |
| 1861 | 1861 | |
@@ -1865,7 +1865,7 @@ discard block |
||
| 1865 | 1865 | echo ' class="frm_help"'; |
| 1866 | 1866 | } |
| 1867 | 1867 | |
| 1868 | - echo ' title="' . esc_attr( $tooltips[ $name ] ); |
|
| 1868 | + echo ' title="' . esc_attr( $tooltips[$name] ); |
|
| 1869 | 1869 | |
| 1870 | 1870 | if ( 'open' != $class ) { |
| 1871 | 1871 | echo '"'; |
@@ -1918,13 +1918,13 @@ discard block |
||
| 1918 | 1918 | } |
| 1919 | 1919 | |
| 1920 | 1920 | private static function prepare_action_slashes( $val, $key, &$post_content ) { |
| 1921 | - if ( ! isset( $post_content[ $key ] ) ) { |
|
| 1921 | + if ( ! isset( $post_content[$key] ) ) { |
|
| 1922 | 1922 | return; |
| 1923 | 1923 | } |
| 1924 | 1924 | |
| 1925 | 1925 | if ( is_array( $val ) ) { |
| 1926 | 1926 | foreach ( $val as $k1 => $v1 ) { |
| 1927 | - self::prepare_action_slashes( $v1, $k1, $post_content[ $key ] ); |
|
| 1927 | + self::prepare_action_slashes( $v1, $k1, $post_content[$key] ); |
|
| 1928 | 1928 | unset( $k1, $v1 ); |
| 1929 | 1929 | } |
| 1930 | 1930 | } else { |
@@ -1932,7 +1932,7 @@ discard block |
||
| 1932 | 1932 | $val = stripslashes( $val ); |
| 1933 | 1933 | |
| 1934 | 1934 | // Add backslashes before double quotes and forward slashes only |
| 1935 | - $post_content[ $key ] = addcslashes( $val, '"\\/' ); |
|
| 1935 | + $post_content[$key] = addcslashes( $val, '"\\/' ); |
|
| 1936 | 1936 | } |
| 1937 | 1937 | } |
| 1938 | 1938 | |
@@ -1983,14 +1983,14 @@ discard block |
||
| 1983 | 1983 | |
| 1984 | 1984 | foreach ( $form as $input ) { |
| 1985 | 1985 | $key = $input['name']; |
| 1986 | - if ( isset( $formatted[ $key ] ) ) { |
|
| 1987 | - if ( is_array( $formatted[ $key ] ) ) { |
|
| 1988 | - $formatted[ $key ][] = $input['value']; |
|
| 1986 | + if ( isset( $formatted[$key] ) ) { |
|
| 1987 | + if ( is_array( $formatted[$key] ) ) { |
|
| 1988 | + $formatted[$key][] = $input['value']; |
|
| 1989 | 1989 | } else { |
| 1990 | - $formatted[ $key ] = array( $formatted[ $key ], $input['value'] ); |
|
| 1990 | + $formatted[$key] = array( $formatted[$key], $input['value'] ); |
|
| 1991 | 1991 | } |
| 1992 | 1992 | } else { |
| 1993 | - $formatted[ $key ] = $input['value']; |
|
| 1993 | + $formatted[$key] = $input['value']; |
|
| 1994 | 1994 | } |
| 1995 | 1995 | } |
| 1996 | 1996 | |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | |
| 140 | 140 | foreach ( $pass_settings as $setting ) { |
| 141 | 141 | if ( isset( $settings_list->$setting ) ) { |
| 142 | - $settings[ $setting ] = $this->maybe_json( $settings_list->$setting ); |
|
| 142 | + $settings[$setting] = $this->maybe_json( $settings_list->$setting ); |
|
| 143 | 143 | } |
| 144 | 144 | } |
| 145 | 145 | |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | |
| 172 | 172 | $message_settings = array(); |
| 173 | 173 | foreach ( $messages as $message ) { |
| 174 | - $message_settings[ $message ] = $settings_list->$message; |
|
| 174 | + $message_settings[$message] = $settings_list->$message; |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | return $message_settings; |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | |
| 190 | 190 | foreach ( $frm_roles as $frm_role => $frm_role_description ) { |
| 191 | 191 | if ( isset( $settings_list->$frm_role ) ) { |
| 192 | - $permissions[ $frm_role ] = $settings_list->$frm_role; |
|
| 192 | + $permissions[$frm_role] = $settings_list->$frm_role; |
|
| 193 | 193 | } |
| 194 | 194 | } |
| 195 | 195 | |
@@ -256,8 +256,8 @@ discard block |
||
| 256 | 256 | ); |
| 257 | 257 | |
| 258 | 258 | foreach ( $settings as $setting ) { |
| 259 | - if ( isset( $form->options[ $setting ] ) ) { |
|
| 260 | - $new_form[ $setting ] = $this->maybe_json( $form->options[ $setting ] ); |
|
| 259 | + if ( isset( $form->options[$setting] ) ) { |
|
| 260 | + $new_form[$setting] = $this->maybe_json( $form->options[$setting] ); |
|
| 261 | 261 | } |
| 262 | 262 | } |
| 263 | 263 | |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | * @return array |
| 309 | 309 | */ |
| 310 | 310 | private function fields() { |
| 311 | - $args = array( |
|
| 311 | + $args = array( |
|
| 312 | 312 | 'limit' => 50, |
| 313 | 313 | 'order_by' => 'id DESC', |
| 314 | 314 | ); |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | $fields = FrmDb::get_results( 'frm_fields', array(), 'form_id, name, type, field_options', $args ); |
| 317 | 317 | foreach ( $fields as $k => $field ) { |
| 318 | 318 | FrmAppHelper::unserialize_or_decode( $field->field_options ); |
| 319 | - $fields[ $k ]->field_options = json_encode( $field->field_options ); |
|
| 319 | + $fields[$k]->field_options = json_encode( $field->field_options ); |
|
| 320 | 320 | } |
| 321 | 321 | return $fields; |
| 322 | 322 | } |
@@ -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 | |
@@ -669,14 +669,14 @@ discard block |
||
| 669 | 669 | * Migrate settings from form->options into new action. |
| 670 | 670 | */ |
| 671 | 671 | public function migrate_to_2( $form, $update = 'update' ) { |
| 672 | - $action = $this->prepare_new( $form->id ); |
|
| 672 | + $action = $this->prepare_new( $form->id ); |
|
| 673 | 673 | FrmAppHelper::unserialize_or_decode( $form->options ); |
| 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( |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | |
| 330 | 330 | foreach ( (array) $fields as $f ) { |
| 331 | 331 | FrmAppHelper::unserialize_or_decode( $f->field_options ); |
| 332 | - $size = $f->field_options['size']; |
|
| 332 | + $size = $f->field_options['size']; |
|
| 333 | 333 | $this->maybe_convert_migrated_size( $size ); |
| 334 | 334 | |
| 335 | 335 | if ( $size === $f->field_options['size'] ) { |
@@ -392,7 +392,7 @@ discard block |
||
| 392 | 392 | continue; |
| 393 | 393 | } |
| 394 | 394 | |
| 395 | - $this->maybe_convert_migrated_size( $widgets[ $k ]['size'] ); |
|
| 395 | + $this->maybe_convert_migrated_size( $widgets[$k]['size'] ); |
|
| 396 | 396 | } |
| 397 | 397 | update_option( 'widget_frm_show_form', $widgets ); |
| 398 | 398 | } |
@@ -491,7 +491,7 @@ discard block |
||
| 491 | 491 | if ( ! is_array( $widget ) || ! isset( $widget['size'] ) ) { |
| 492 | 492 | continue; |
| 493 | 493 | } |
| 494 | - $this->convert_character_to_px( $widgets[ $k ]['size'] ); |
|
| 494 | + $this->convert_character_to_px( $widgets[$k]['size'] ); |
|
| 495 | 495 | } |
| 496 | 496 | update_option( 'widget_frm_show_form', $widgets ); |
| 497 | 497 | } |
@@ -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 ); |
@@ -279,11 +279,11 @@ discard block |
||
| 279 | 279 | * Updating the settings page |
| 280 | 280 | */ |
| 281 | 281 | private static function get_settings_page_html( $values, &$field ) { |
| 282 | - if ( isset( $values['field_options'][ 'custom_html_' . $field->id ] ) ) { |
|
| 282 | + if ( isset( $values['field_options']['custom_html_' . $field->id] ) ) { |
|
| 283 | 283 | $prev_opts = array(); |
| 284 | 284 | $fallback_html = isset( $field->field_options['custom_html'] ) ? $field->field_options['custom_html'] : FrmFieldsHelper::get_default_html( $field->type ); |
| 285 | 285 | |
| 286 | - $field->field_options['custom_html'] = isset( $values['field_options'][ 'custom_html_' . $field->id ] ) ? $values['field_options'][ 'custom_html_' . $field->id ] : $fallback_html; |
|
| 286 | + $field->field_options['custom_html'] = isset( $values['field_options']['custom_html_' . $field->id] ) ? $values['field_options']['custom_html_' . $field->id] : $fallback_html; |
|
| 287 | 287 | } elseif ( $field->type == 'hidden' || $field->type == 'user_id' ) { |
| 288 | 288 | $prev_opts = $field->field_options; |
| 289 | 289 | } |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | foreach ( $field_cols as $col => $default ) { |
| 310 | 310 | $default = ( $default === '' ) ? $field->{$col} : $default; |
| 311 | 311 | |
| 312 | - $new_field[ $col ] = isset( $values['field_options'][ $col . '_' . $field->id ] ) ? $values['field_options'][ $col . '_' . $field->id ] : $default; |
|
| 312 | + $new_field[$col] = isset( $values['field_options'][$col . '_' . $field->id] ) ? $values['field_options'][$col . '_' . $field->id] : $default; |
|
| 313 | 313 | } |
| 314 | 314 | |
| 315 | 315 | // Don't save the template option. |
@@ -723,8 +723,8 @@ discard block |
||
| 723 | 723 | self::maybe_get_form( $form ); |
| 724 | 724 | } |
| 725 | 725 | |
| 726 | - if ( isset( $frm_vars['form_params'] ) && is_array( $frm_vars['form_params'] ) && isset( $frm_vars['form_params'][ $form->id ] ) ) { |
|
| 727 | - return $frm_vars['form_params'][ $form->id ]; |
|
| 726 | + if ( isset( $frm_vars['form_params'] ) && is_array( $frm_vars['form_params'] ) && isset( $frm_vars['form_params'][$form->id] ) ) { |
|
| 727 | + return $frm_vars['form_params'][$form->id]; |
|
| 728 | 728 | } |
| 729 | 729 | |
| 730 | 730 | $action_var = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action'; // WPCS: CSRF ok. |
@@ -753,15 +753,15 @@ discard block |
||
| 753 | 753 | //if there are two forms on the same page, make sure not to submit both |
| 754 | 754 | foreach ( $default_values as $var => $default ) { |
| 755 | 755 | if ( $var == 'action' ) { |
| 756 | - $values[ $var ] = FrmAppHelper::get_param( $action_var, $default, 'get', 'sanitize_title' ); |
|
| 756 | + $values[$var] = FrmAppHelper::get_param( $action_var, $default, 'get', 'sanitize_title' ); |
|
| 757 | 757 | } else { |
| 758 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 758 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 759 | 759 | } |
| 760 | 760 | unset( $var, $default ); |
| 761 | 761 | } |
| 762 | 762 | } else { |
| 763 | 763 | foreach ( $default_values as $var => $default ) { |
| 764 | - $values[ $var ] = $default; |
|
| 764 | + $values[$var] = $default; |
|
| 765 | 765 | unset( $var, $default ); |
| 766 | 766 | } |
| 767 | 767 | } |
@@ -787,7 +787,7 @@ discard block |
||
| 787 | 787 | 'sdir' => '', |
| 788 | 788 | ); |
| 789 | 789 | foreach ( $defaults as $var => $default ) { |
| 790 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 790 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 791 | 791 | } |
| 792 | 792 | |
| 793 | 793 | return $values; |
@@ -815,7 +815,7 @@ discard block |
||
| 815 | 815 | 'keep_post' => '', |
| 816 | 816 | ); |
| 817 | 817 | foreach ( $defaults as $var => $default ) { |
| 818 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 818 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 819 | 819 | } |
| 820 | 820 | |
| 821 | 821 | return $values; |
@@ -900,7 +900,7 @@ discard block |
||
| 900 | 900 | public static function get_option( $atts ) { |
| 901 | 901 | $form = $atts['form']; |
| 902 | 902 | |
| 903 | - return isset( $form->options[ $atts['option'] ] ) ? $form->options[ $atts['option'] ] : $atts['default']; |
|
| 903 | + return isset( $form->options[$atts['option']] ) ? $form->options[$atts['option']] : $atts['default']; |
|
| 904 | 904 | } |
| 905 | 905 | |
| 906 | 906 | /** |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | global $wpdb; |
| 56 | 56 | |
| 57 | - $values = array( |
|
| 57 | + $values = array( |
|
| 58 | 58 | 'item_id' => $entry_id, |
| 59 | 59 | 'field_id' => $field_id, |
| 60 | 60 | ); |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | |
| 129 | 129 | if ( ( is_array( $meta_value ) && empty( $meta_value ) ) || ( ! is_array( $meta_value ) && trim( $meta_value ) == '' ) ) { |
| 130 | 130 | // remove blank fields |
| 131 | - unset( $values[ $field_id ] ); |
|
| 131 | + unset( $values[$field_id] ); |
|
| 132 | 132 | } else { |
| 133 | 133 | // if value exists, then update it |
| 134 | 134 | self::update_entry_meta( $entry_id, $field_id, '', $meta_value ); |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | */ |
| 194 | 194 | public static function get_meta_value( $entry, $field_id ) { |
| 195 | 195 | if ( isset( $entry->metas ) ) { |
| 196 | - return isset( $entry->metas[ $field_id ] ) ? $entry->metas[ $field_id ] : false; |
|
| 196 | + return isset( $entry->metas[$field_id] ) ? $entry->metas[$field_id] : false; |
|
| 197 | 197 | } else { |
| 198 | 198 | return self::get_entry_meta_by_field( $entry->id, $field_id ); |
| 199 | 199 | } |
@@ -211,8 +211,8 @@ discard block |
||
| 211 | 211 | $cached = FrmDb::check_cache( $entry_id, 'frm_entry' ); |
| 212 | 212 | } |
| 213 | 213 | |
| 214 | - if ( $cached && isset( $cached->metas ) && isset( $cached->metas[ $field_id ] ) ) { |
|
| 215 | - $result = $cached->metas[ $field_id ]; |
|
| 214 | + if ( $cached && isset( $cached->metas ) && isset( $cached->metas[$field_id] ) ) { |
|
| 215 | + $result = $cached->metas[$field_id]; |
|
| 216 | 216 | |
| 217 | 217 | return wp_unslash( $result ); |
| 218 | 218 | } |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | if ( is_numeric( $field_id ) ) { |
| 223 | 223 | $query['field_id'] = $field_id; |
| 224 | 224 | } else { |
| 225 | - $get_table .= ' it LEFT OUTER JOIN ' . $wpdb->prefix . 'frm_fields fi ON it.field_id=fi.id'; |
|
| 225 | + $get_table .= ' it LEFT OUTER JOIN ' . $wpdb->prefix . 'frm_fields fi ON it.field_id=fi.id'; |
|
| 226 | 226 | $query['fi.field_key'] = $field_id; |
| 227 | 227 | } |
| 228 | 228 | |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | 'stripslashes' => true, |
| 241 | 241 | 'is_draft' => false, |
| 242 | 242 | ); |
| 243 | - $args = wp_parse_args( $args, $defaults ); |
|
| 243 | + $args = wp_parse_args( $args, $defaults ); |
|
| 244 | 244 | |
| 245 | 245 | $query = array(); |
| 246 | 246 | self::meta_field_query( $field_id, $order, $limit, $args, $query ); |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | |
| 256 | 256 | foreach ( $values as $k => $v ) { |
| 257 | 257 | FrmAppHelper::unserialize_or_decode( $v ); |
| 258 | - $values[ $k ] = $v; |
|
| 258 | + $values[$k] = $v; |
|
| 259 | 259 | unset( $k, $v ); |
| 260 | 260 | } |
| 261 | 261 | |
@@ -312,7 +312,7 @@ discard block |
||
| 312 | 312 | |
| 313 | 313 | foreach ( $results as $k => $result ) { |
| 314 | 314 | FrmAppHelper::unserialize_or_decode( $result->meta_value ); |
| 315 | - $results[ $k ]->meta_value = wp_unslash( $result->meta_value ); |
|
| 315 | + $results[$k]->meta_value = wp_unslash( $result->meta_value ); |
|
| 316 | 316 | unset( $k, $result ); |
| 317 | 317 | } |
| 318 | 318 | |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | 'user_id' => '', |
| 326 | 326 | 'group_by' => '', |
| 327 | 327 | ); |
| 328 | - $args = wp_parse_args( $args, $defaults ); |
|
| 328 | + $args = wp_parse_args( $args, $defaults ); |
|
| 329 | 329 | |
| 330 | 330 | $query = array(); |
| 331 | 331 | self::get_ids_query( $where, $order_by, $limit, $unique, $args, $query ); |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | $metas = FrmEntryMeta::get_entry_meta_info( $entry_exist ); |
| 77 | 77 | $field_metas = array(); |
| 78 | 78 | foreach ( $metas as $meta ) { |
| 79 | - $field_metas[ $meta->field_id ] = $meta->meta_value; |
|
| 79 | + $field_metas[$meta->field_id] = $meta->meta_value; |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | // If prev entry is empty and current entry is not, they are not duplicates |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | $query = "SELECT it.*, fr.name as form_name, fr.form_key as form_key FROM {$wpdb->prefix}frm_items it |
| 304 | 304 | LEFT OUTER JOIN {$wpdb->prefix}frm_forms fr ON it.form_id=fr.id WHERE "; |
| 305 | 305 | |
| 306 | - $query .= is_numeric( $id ) ? 'it.id=%d' : 'it.item_key=%s'; |
|
| 306 | + $query .= is_numeric( $id ) ? 'it.id=%d' : 'it.item_key=%s'; |
|
| 307 | 307 | $query_args = array( $id ); |
| 308 | 308 | $query = $wpdb->prepare( $query, $query_args ); // WPCS: unprepared SQL ok. |
| 309 | 309 | |
@@ -344,21 +344,21 @@ discard block |
||
| 344 | 344 | $include_key = apply_filters( 'frm_include_meta_keys', false, array( 'form_id' => $entry->form_id ) ); |
| 345 | 345 | foreach ( $metas as $meta_val ) { |
| 346 | 346 | if ( $meta_val->item_id == $entry->id ) { |
| 347 | - $entry->metas[ $meta_val->field_id ] = $meta_val->meta_value; |
|
| 348 | - FrmAppHelper::unserialize_or_decode( $entry->metas[ $meta_val->field_id ] ); |
|
| 347 | + $entry->metas[$meta_val->field_id] = $meta_val->meta_value; |
|
| 348 | + FrmAppHelper::unserialize_or_decode( $entry->metas[$meta_val->field_id] ); |
|
| 349 | 349 | if ( $include_key ) { |
| 350 | - $entry->metas[ $meta_val->field_key ] = $entry->metas[ $meta_val->field_id ]; |
|
| 350 | + $entry->metas[$meta_val->field_key] = $entry->metas[$meta_val->field_id]; |
|
| 351 | 351 | } |
| 352 | 352 | continue; |
| 353 | 353 | } |
| 354 | 354 | |
| 355 | 355 | // include sub entries in an array |
| 356 | - if ( ! isset( $entry_metas[ $meta_val->field_id ] ) ) { |
|
| 357 | - $entry->metas[ $meta_val->field_id ] = array(); |
|
| 356 | + if ( ! isset( $entry_metas[$meta_val->field_id] ) ) { |
|
| 357 | + $entry->metas[$meta_val->field_id] = array(); |
|
| 358 | 358 | } |
| 359 | 359 | |
| 360 | 360 | FrmAppHelper::unserialize_or_decode( $meta_val->meta_value ); |
| 361 | - $entry->metas[ $meta_val->field_id ][] = $meta_val->meta_value; |
|
| 361 | + $entry->metas[$meta_val->field_id][] = $meta_val->meta_value; |
|
| 362 | 362 | |
| 363 | 363 | unset( $meta_val ); |
| 364 | 364 | } |
@@ -405,13 +405,13 @@ discard block |
||
| 405 | 405 | |
| 406 | 406 | if ( $inc_form ) { |
| 407 | 407 | $fields = 'it.*, fr.name as form_name,fr.form_key as form_key'; |
| 408 | - $table .= 'LEFT OUTER JOIN ' . $wpdb->prefix . 'frm_forms fr ON it.form_id=fr.id '; |
|
| 408 | + $table .= 'LEFT OUTER JOIN ' . $wpdb->prefix . 'frm_forms fr ON it.form_id=fr.id '; |
|
| 409 | 409 | } |
| 410 | 410 | |
| 411 | 411 | if ( preg_match( '/ meta_([0-9]+)/', $order_by, $order_matches ) ) { |
| 412 | 412 | // sort by a requested field |
| 413 | 413 | $field_id = (int) $order_matches[1]; |
| 414 | - $fields .= ', (SELECT meta_value FROM ' . $wpdb->prefix . 'frm_item_metas WHERE field_id = ' . $field_id . ' AND item_id = it.id) as meta_' . $field_id; |
|
| 414 | + $fields .= ', (SELECT meta_value FROM ' . $wpdb->prefix . 'frm_item_metas WHERE field_id = ' . $field_id . ' AND item_id = it.id) as meta_' . $field_id; |
|
| 415 | 415 | unset( $order_matches, $field_id ); |
| 416 | 416 | } |
| 417 | 417 | |
@@ -449,16 +449,16 @@ discard block |
||
| 449 | 449 | } |
| 450 | 450 | |
| 451 | 451 | foreach ( $metas as $m_key => $meta_val ) { |
| 452 | - if ( ! isset( $entries[ $meta_val->item_id ] ) ) { |
|
| 452 | + if ( ! isset( $entries[$meta_val->item_id] ) ) { |
|
| 453 | 453 | continue; |
| 454 | 454 | } |
| 455 | 455 | |
| 456 | - if ( ! isset( $entries[ $meta_val->item_id ]->metas ) ) { |
|
| 457 | - $entries[ $meta_val->item_id ]->metas = array(); |
|
| 456 | + if ( ! isset( $entries[$meta_val->item_id]->metas ) ) { |
|
| 457 | + $entries[$meta_val->item_id]->metas = array(); |
|
| 458 | 458 | } |
| 459 | 459 | |
| 460 | 460 | FrmAppHelper::unserialize_or_decode( $meta_val->meta_value ); |
| 461 | - $entries[ $meta_val->item_id ]->metas[ $meta_val->field_id ] = $meta_val->meta_value; |
|
| 461 | + $entries[$meta_val->item_id]->metas[$meta_val->field_id] = $meta_val->meta_value; |
|
| 462 | 462 | unset( $m_key, $meta_val ); |
| 463 | 463 | } |
| 464 | 464 | |
@@ -615,7 +615,7 @@ discard block |
||
| 615 | 615 | } |
| 616 | 616 | |
| 617 | 617 | private static function get_entry_value( $values, $name, $default ) { |
| 618 | - return isset( $values[ $name ] ) ? $values[ $name ] : $default; |
|
| 618 | + return isset( $values[$name] ) ? $values[$name] : $default; |
|
| 619 | 619 | } |
| 620 | 620 | |
| 621 | 621 | /** |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | $to = $this->prepare_email_setting( $this->settings['email_to'], $user_id_args ); |
| 86 | 86 | $to = $this->explode_emails( $to ); |
| 87 | 87 | |
| 88 | - $where = array( |
|
| 88 | + $where = array( |
|
| 89 | 89 | 'it.field_id !' => 0, |
| 90 | 90 | 'it.item_id' => $this->entry->id, |
| 91 | 91 | ); |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | 'entry' => $this->entry, |
| 96 | 96 | 'form' => $this->form, |
| 97 | 97 | ); |
| 98 | - $to = apply_filters( 'frm_to_email', $to, $values, $this->form->id, $args ); |
|
| 98 | + $to = apply_filters( 'frm_to_email', $to, $values, $this->form->id, $args ); |
|
| 99 | 99 | |
| 100 | 100 | $this->to = array_unique( (array) $to ); |
| 101 | 101 | |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | |
| 299 | 299 | // Add the user info if it isn't already included |
| 300 | 300 | if ( $this->include_user_info && $prev_mail_body === $mail_body ) { |
| 301 | - $data = $this->entry->description; |
|
| 301 | + $data = $this->entry->description; |
|
| 302 | 302 | FrmAppHelper::unserialize_or_decode( $data ); |
| 303 | 303 | $mail_body .= "\r\n\r\n" . __( 'User Information', 'formidable' ) . "\r\n"; |
| 304 | 304 | $this->maybe_add_ip( $mail_body ); |
@@ -564,12 +564,12 @@ discard block |
||
| 564 | 564 | $name = trim( str_replace( $email, '', $val ) ); |
| 565 | 565 | } else { |
| 566 | 566 | // If user enters a name without an email |
| 567 | - unset( $recipients[ $key ] ); |
|
| 567 | + unset( $recipients[$key] ); |
|
| 568 | 568 | continue; |
| 569 | 569 | } |
| 570 | 570 | } |
| 571 | 571 | |
| 572 | - $recipients[ $key ] = $this->format_from_email( $name, $email ); |
|
| 572 | + $recipients[$key] = $this->format_from_email( $name, $email ); |
|
| 573 | 573 | } |
| 574 | 574 | |
| 575 | 575 | return $recipients; |
@@ -710,7 +710,7 @@ discard block |
||
| 710 | 710 | ); |
| 711 | 711 | |
| 712 | 712 | // Remove phone number from to addresses |
| 713 | - unset( $this->to[ $key ] ); |
|
| 713 | + unset( $this->to[$key] ); |
|
| 714 | 714 | } |
| 715 | 715 | } |
| 716 | 716 | } |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | $new_values['field_key'] = FrmAppHelper::get_unique_key( $key, $wpdb->prefix . 'frm_fields', 'field_key' ); |
| 184 | 184 | |
| 185 | 185 | foreach ( array( 'name', 'description', 'type', 'default_value' ) as $col ) { |
| 186 | - $new_values[ $col ] = $values[ $col ]; |
|
| 186 | + $new_values[$col] = $values[$col]; |
|
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | $new_values['options'] = $values['options']; |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | $new_values['created_at'] = current_time( 'mysql', 1 ); |
| 196 | 196 | |
| 197 | 197 | if ( isset( $values['id'] ) ) { |
| 198 | - $frm_duplicate_ids[ $values['field_key'] ] = $new_values['field_key']; |
|
| 198 | + $frm_duplicate_ids[$values['field_key']] = $new_values['field_key']; |
|
| 199 | 199 | $new_values = apply_filters( 'frm_duplicated_field', $new_values ); |
| 200 | 200 | } |
| 201 | 201 | |
@@ -204,9 +204,9 @@ discard block |
||
| 204 | 204 | foreach ( $new_values as $k => $v ) { |
| 205 | 205 | if ( is_array( $v ) ) { |
| 206 | 206 | if ( $k === 'default_value' ) { |
| 207 | - $new_values[ $k ] = FrmAppHelper::maybe_json_encode( $v ); |
|
| 207 | + $new_values[$k] = FrmAppHelper::maybe_json_encode( $v ); |
|
| 208 | 208 | } else { |
| 209 | - $new_values[ $k ] = serialize( $v ); |
|
| 209 | + $new_values[$k] = serialize( $v ); |
|
| 210 | 210 | } |
| 211 | 211 | } |
| 212 | 212 | unset( $k, $v ); |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | |
| 229 | 229 | if ( $query_results ) { |
| 230 | 230 | if ( isset( $values['id'] ) ) { |
| 231 | - $frm_duplicate_ids[ $values['id'] ] = $new_id; |
|
| 231 | + $frm_duplicate_ids[$values['id']] = $new_id; |
|
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | return $new_id; |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | public static function duplicate( $old_form_id, $form_id, $copy_keys = false, $blog_id = false ) { |
| 241 | 241 | global $frm_duplicate_ids; |
| 242 | 242 | |
| 243 | - $where = array( |
|
| 243 | + $where = array( |
|
| 244 | 244 | array( |
| 245 | 245 | 'or' => 1, |
| 246 | 246 | 'fi.form_id' => $old_form_id, |
@@ -286,8 +286,8 @@ discard block |
||
| 286 | 286 | |
| 287 | 287 | $values = apply_filters( 'frm_duplicated_field', $values ); |
| 288 | 288 | $new_id = self::create( $values ); |
| 289 | - $frm_duplicate_ids[ $field->id ] = $new_id; |
|
| 290 | - $frm_duplicate_ids[ $field->field_key ] = $new_id; |
|
| 289 | + $frm_duplicate_ids[$field->id] = $new_id; |
|
| 290 | + $frm_duplicate_ids[$field->field_key] = $new_id; |
|
| 291 | 291 | unset( $field ); |
| 292 | 292 | } |
| 293 | 293 | } |
@@ -318,8 +318,8 @@ discard block |
||
| 318 | 318 | |
| 319 | 319 | // serialize array values |
| 320 | 320 | foreach ( array( 'field_options', 'options' ) as $opt ) { |
| 321 | - if ( isset( $values[ $opt ] ) && is_array( $values[ $opt ] ) ) { |
|
| 322 | - $values[ $opt ] = serialize( $values[ $opt ] ); |
|
| 321 | + if ( isset( $values[$opt] ) && is_array( $values[$opt] ) ) { |
|
| 322 | + $values[$opt] = serialize( $values[$opt] ); |
|
| 323 | 323 | } |
| 324 | 324 | } |
| 325 | 325 | if ( isset( $values['default_value'] ) && is_array( $values['default_value'] ) ) { |
@@ -471,7 +471,7 @@ discard block |
||
| 471 | 471 | 'id' => $id, |
| 472 | 472 | 'field_key' => $id, |
| 473 | 473 | ); |
| 474 | - $type = FrmDb::get_var( 'frm_fields', $where, $col ); |
|
| 474 | + $type = FrmDb::get_var( 'frm_fields', $where, $col ); |
|
| 475 | 475 | } |
| 476 | 476 | |
| 477 | 477 | return $type; |
@@ -497,7 +497,7 @@ discard block |
||
| 497 | 497 | continue; |
| 498 | 498 | } |
| 499 | 499 | |
| 500 | - $fields[ $result->id ] = $result; |
|
| 500 | + $fields[$result->id] = $result; |
|
| 501 | 501 | $count ++; |
| 502 | 502 | if ( $limit == 1 ) { |
| 503 | 503 | $fields = $result; |
@@ -543,7 +543,7 @@ discard block |
||
| 543 | 543 | $count = 0; |
| 544 | 544 | foreach ( $results as $result ) { |
| 545 | 545 | $count ++; |
| 546 | - $fields[ $result->id ] = $result; |
|
| 546 | + $fields[$result->id] = $result; |
|
| 547 | 547 | if ( ! empty( $limit ) && $count >= $limit ) { |
| 548 | 548 | break; |
| 549 | 549 | } |
@@ -612,7 +612,7 @@ discard block |
||
| 612 | 612 | } |
| 613 | 613 | |
| 614 | 614 | if ( ! empty( $sub_fields ) ) { |
| 615 | - $index = $k + $index_offset; |
|
| 615 | + $index = $k + $index_offset; |
|
| 616 | 616 | $index_offset += count( $sub_fields ); |
| 617 | 617 | array_splice( $results, $index, 0, $sub_fields ); |
| 618 | 618 | } |
@@ -657,7 +657,7 @@ discard block |
||
| 657 | 657 | $query_type = ( $limit == ' LIMIT 1' || $limit == 1 ) ? 'row' : 'results'; |
| 658 | 658 | |
| 659 | 659 | if ( is_array( $where ) ) { |
| 660 | - $args = array( |
|
| 660 | + $args = array( |
|
| 661 | 661 | 'order_by' => $order_by, |
| 662 | 662 | 'limit' => $limit, |
| 663 | 663 | ); |
@@ -688,9 +688,9 @@ discard block |
||
| 688 | 688 | FrmDb::set_cache( $result->field_key, $result, 'frm_field' ); |
| 689 | 689 | |
| 690 | 690 | self::prepare_options( $result ); |
| 691 | - $results[ $r_key ]->field_options = $result->field_options; |
|
| 692 | - $results[ $r_key ]->options = $result->options; |
|
| 693 | - $results[ $r_key ]->default_value = $result->default_value; |
|
| 691 | + $results[$r_key]->field_options = $result->field_options; |
|
| 692 | + $results[$r_key]->options = $result->options; |
|
| 693 | + $results[$r_key]->default_value = $result->default_value; |
|
| 694 | 694 | |
| 695 | 695 | unset( $r_key, $result ); |
| 696 | 696 | } |
@@ -886,23 +886,23 @@ discard block |
||
| 886 | 886 | } |
| 887 | 887 | |
| 888 | 888 | public static function is_option_true_in_array( $field, $option ) { |
| 889 | - return isset( $field[ $option ] ) && $field[ $option ]; |
|
| 889 | + return isset( $field[$option] ) && $field[$option]; |
|
| 890 | 890 | } |
| 891 | 891 | |
| 892 | 892 | public static function is_option_true_in_object( $field, $option ) { |
| 893 | - return isset( $field->field_options[ $option ] ) && $field->field_options[ $option ]; |
|
| 893 | + return isset( $field->field_options[$option] ) && $field->field_options[$option]; |
|
| 894 | 894 | } |
| 895 | 895 | |
| 896 | 896 | public static function is_option_empty_in_array( $field, $option ) { |
| 897 | - return ! isset( $field[ $option ] ) || empty( $field[ $option ] ); |
|
| 897 | + return ! isset( $field[$option] ) || empty( $field[$option] ); |
|
| 898 | 898 | } |
| 899 | 899 | |
| 900 | 900 | public static function is_option_empty_in_object( $field, $option ) { |
| 901 | - return ! isset( $field->field_options[ $option ] ) || empty( $field->field_options[ $option ] ); |
|
| 901 | + return ! isset( $field->field_options[$option] ) || empty( $field->field_options[$option] ); |
|
| 902 | 902 | } |
| 903 | 903 | |
| 904 | 904 | public static function is_option_value_in_object( $field, $option ) { |
| 905 | - return isset( $field->field_options[ $option ] ) && $field->field_options[ $option ] != ''; |
|
| 905 | + return isset( $field->field_options[$option] ) && $field->field_options[$option] != ''; |
|
| 906 | 906 | } |
| 907 | 907 | |
| 908 | 908 | /** |
@@ -919,11 +919,11 @@ discard block |
||
| 919 | 919 | } |
| 920 | 920 | |
| 921 | 921 | public static function get_option_in_array( $field, $option ) { |
| 922 | - return isset( $field[ $option ] ) ? $field[ $option ] : ''; |
|
| 922 | + return isset( $field[$option] ) ? $field[$option] : ''; |
|
| 923 | 923 | } |
| 924 | 924 | |
| 925 | 925 | public static function get_option_in_object( $field, $option ) { |
| 926 | - return isset( $field->field_options[ $option ] ) ? $field->field_options[ $option ] : ''; |
|
| 926 | + return isset( $field->field_options[$option] ) ? $field->field_options[$option] : ''; |
|
| 927 | 927 | } |
| 928 | 928 | |
| 929 | 929 | /** |