@@ -266,11 +266,11 @@ discard block |
||
| 266 | 266 | private static function field_is_new( $type ) { |
| 267 | 267 | $release_dates = array(); |
| 268 | 268 | |
| 269 | - if ( ! isset( $release_dates[ $type ] ) ) { |
|
| 269 | + if ( ! isset( $release_dates[$type] ) ) { |
|
| 270 | 270 | return false; |
| 271 | 271 | } |
| 272 | 272 | |
| 273 | - $release_date = $release_dates[ $type ]; |
|
| 273 | + $release_date = $release_dates[$type]; |
|
| 274 | 274 | |
| 275 | 275 | $three_months_after_release = gmdate( 'Y-m-d', strtotime( $release_date . ' + 90 days' ) ); |
| 276 | 276 | return gmdate( 'Y-m-d' ) < $three_months_after_release; |
@@ -303,8 +303,8 @@ discard block |
||
| 303 | 303 | $values = FrmAppHelper::maybe_filter_array( $values, array( 'name', 'description' ) ); |
| 304 | 304 | |
| 305 | 305 | foreach ( array( 'name', 'description', 'type', 'default_value' ) as $col ) { |
| 306 | - if ( isset( $values[ $col ] ) ) { |
|
| 307 | - $new_values[ $col ] = $values[ $col ]; |
|
| 306 | + if ( isset( $values[$col] ) ) { |
|
| 307 | + $new_values[$col] = $values[$col]; |
|
| 308 | 308 | } |
| 309 | 309 | } |
| 310 | 310 | |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | $new_values['created_at'] = current_time( 'mysql', 1 ); |
| 317 | 317 | |
| 318 | 318 | if ( isset( $values['id'] ) ) { |
| 319 | - $frm_duplicate_ids[ $values['field_key'] ] = $new_values['field_key']; |
|
| 319 | + $frm_duplicate_ids[$values['field_key']] = $new_values['field_key']; |
|
| 320 | 320 | $new_values = apply_filters( 'frm_duplicated_field', $new_values ); |
| 321 | 321 | } |
| 322 | 322 | |
@@ -325,9 +325,9 @@ discard block |
||
| 325 | 325 | foreach ( $new_values as $k => $v ) { |
| 326 | 326 | if ( is_array( $v ) ) { |
| 327 | 327 | if ( $k === 'default_value' ) { |
| 328 | - $new_values[ $k ] = FrmAppHelper::maybe_json_encode( $v ); |
|
| 328 | + $new_values[$k] = FrmAppHelper::maybe_json_encode( $v ); |
|
| 329 | 329 | } else { |
| 330 | - $new_values[ $k ] = serialize( $v ); |
|
| 330 | + $new_values[$k] = serialize( $v ); |
|
| 331 | 331 | } |
| 332 | 332 | } |
| 333 | 333 | unset( $k, $v ); |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | } |
| 348 | 348 | |
| 349 | 349 | if ( isset( $values['id'] ) ) { |
| 350 | - $frm_duplicate_ids[ $values['id'] ] = $new_id; |
|
| 350 | + $frm_duplicate_ids[$values['id']] = $new_id; |
|
| 351 | 351 | } |
| 352 | 352 | |
| 353 | 353 | return $new_id; |
@@ -398,7 +398,7 @@ discard block |
||
| 398 | 398 | * @param array $match Shortcode data. |
| 399 | 399 | * @return string |
| 400 | 400 | */ |
| 401 | - function ( $match ) { |
|
| 401 | + function( $match ) { |
|
| 402 | 402 | $attr = shortcode_parse_atts( $match[3] ); |
| 403 | 403 | |
| 404 | 404 | if ( ! is_array( $attr ) ) { |
@@ -423,7 +423,7 @@ discard block |
||
| 423 | 423 | } |
| 424 | 424 | |
| 425 | 425 | if ( FrmAppHelper::input_key_is_safe( $key, 'update' ) ) { |
| 426 | - $safe_atts[ $key ] = $value; |
|
| 426 | + $safe_atts[$key] = $value; |
|
| 427 | 427 | } |
| 428 | 428 | } |
| 429 | 429 | |
@@ -481,7 +481,7 @@ discard block |
||
| 481 | 481 | public static function duplicate( $old_form_id, $form_id, $copy_keys = false, $blog_id = false ) { |
| 482 | 482 | global $frm_duplicate_ids; |
| 483 | 483 | |
| 484 | - $where = array( |
|
| 484 | + $where = array( |
|
| 485 | 485 | array( |
| 486 | 486 | 'or' => 1, |
| 487 | 487 | 'fi.form_id' => $old_form_id, |
@@ -527,8 +527,8 @@ discard block |
||
| 527 | 527 | |
| 528 | 528 | $values = apply_filters( 'frm_duplicated_field', $values ); |
| 529 | 529 | $new_id = self::create( $values ); |
| 530 | - $frm_duplicate_ids[ $field->id ] = $new_id; |
|
| 531 | - $frm_duplicate_ids[ $field->field_key ] = $new_id; |
|
| 530 | + $frm_duplicate_ids[$field->id] = $new_id; |
|
| 531 | + $frm_duplicate_ids[$field->field_key] = $new_id; |
|
| 532 | 532 | unset( $field ); |
| 533 | 533 | }//end foreach |
| 534 | 534 | } |
@@ -577,11 +577,11 @@ discard block |
||
| 577 | 577 | |
| 578 | 578 | // serialize array values |
| 579 | 579 | foreach ( array( 'field_options', 'options' ) as $opt ) { |
| 580 | - if ( isset( $values[ $opt ] ) && is_array( $values[ $opt ] ) ) { |
|
| 580 | + if ( isset( $values[$opt] ) && is_array( $values[$opt] ) ) { |
|
| 581 | 581 | if ( 'field_options' === $opt ) { |
| 582 | - $values[ $opt ] = self::maybe_filter_options( $values[ $opt ] ); |
|
| 582 | + $values[$opt] = self::maybe_filter_options( $values[$opt] ); |
|
| 583 | 583 | } |
| 584 | - $values[ $opt ] = serialize( $values[ $opt ] ); |
|
| 584 | + $values[$opt] = serialize( $values[$opt] ); |
|
| 585 | 585 | } |
| 586 | 586 | } |
| 587 | 587 | if ( isset( $values['default_value'] ) && is_array( $values['default_value'] ) ) { |
@@ -768,8 +768,8 @@ discard block |
||
| 768 | 768 | continue; |
| 769 | 769 | } |
| 770 | 770 | |
| 771 | - $fields[ $result->id ] = $result; |
|
| 772 | - ++$count; |
|
| 771 | + $fields[$result->id] = $result; |
|
| 772 | + ++ $count; |
|
| 773 | 773 | if ( $limit == 1 ) { |
| 774 | 774 | $fields = $result; |
| 775 | 775 | break; |
@@ -820,8 +820,8 @@ discard block |
||
| 820 | 820 | $fields = array(); |
| 821 | 821 | $count = 0; |
| 822 | 822 | foreach ( $results as $result ) { |
| 823 | - ++$count; |
|
| 824 | - $fields[ $result->id ] = $result; |
|
| 823 | + ++ $count; |
|
| 824 | + $fields[$result->id] = $result; |
|
| 825 | 825 | if ( ! empty( $limit ) && $count >= $limit ) { |
| 826 | 826 | break; |
| 827 | 827 | } |
@@ -935,7 +935,7 @@ discard block |
||
| 935 | 935 | $query_type = $limit === ' LIMIT 1' || $limit == 1 ? 'row' : 'results'; |
| 936 | 936 | |
| 937 | 937 | if ( is_array( $where ) ) { |
| 938 | - $args = array( |
|
| 938 | + $args = array( |
|
| 939 | 939 | 'order_by' => $order_by, |
| 940 | 940 | 'limit' => $limit, |
| 941 | 941 | ); |
@@ -968,9 +968,9 @@ discard block |
||
| 968 | 968 | FrmDb::set_cache( $result->field_key, $result, 'frm_field' ); |
| 969 | 969 | |
| 970 | 970 | self::prepare_options( $result ); |
| 971 | - $results[ $r_key ]->field_options = $result->field_options; |
|
| 972 | - $results[ $r_key ]->options = $result->options; |
|
| 973 | - $results[ $r_key ]->default_value = $result->default_value; |
|
| 971 | + $results[$r_key]->field_options = $result->field_options; |
|
| 972 | + $results[$r_key]->options = $result->options; |
|
| 973 | + $results[$r_key]->default_value = $result->default_value; |
|
| 974 | 974 | |
| 975 | 975 | unset( $r_key, $result ); |
| 976 | 976 | } |
@@ -1049,7 +1049,7 @@ discard block |
||
| 1049 | 1049 | |
| 1050 | 1050 | if ( count( $next_fields ) >= self::$transient_size ) { |
| 1051 | 1051 | // if this transient is full, check for another |
| 1052 | - ++$next; |
|
| 1052 | + ++ $next; |
|
| 1053 | 1053 | self::get_next_transient( $fields, $base_name, $next ); |
| 1054 | 1054 | } |
| 1055 | 1055 | } |
@@ -1077,7 +1077,7 @@ discard block |
||
| 1077 | 1077 | return; |
| 1078 | 1078 | } |
| 1079 | 1079 | |
| 1080 | - ++$next; |
|
| 1080 | + ++ $next; |
|
| 1081 | 1081 | } |
| 1082 | 1082 | } |
| 1083 | 1083 | |
@@ -1225,7 +1225,7 @@ discard block |
||
| 1225 | 1225 | * @return bool |
| 1226 | 1226 | */ |
| 1227 | 1227 | public static function is_option_true_in_array( $field, $option ) { |
| 1228 | - return ! empty( $field[ $option ] ); |
|
| 1228 | + return ! empty( $field[$option] ); |
|
| 1229 | 1229 | } |
| 1230 | 1230 | |
| 1231 | 1231 | /** |
@@ -1234,7 +1234,7 @@ discard block |
||
| 1234 | 1234 | * @return bool |
| 1235 | 1235 | */ |
| 1236 | 1236 | public static function is_option_true_in_object( $field, $option ) { |
| 1237 | - return isset( $field->field_options[ $option ] ) && $field->field_options[ $option ]; |
|
| 1237 | + return isset( $field->field_options[$option] ) && $field->field_options[$option]; |
|
| 1238 | 1238 | } |
| 1239 | 1239 | |
| 1240 | 1240 | /** |
@@ -1243,7 +1243,7 @@ discard block |
||
| 1243 | 1243 | * @return bool |
| 1244 | 1244 | */ |
| 1245 | 1245 | public static function is_option_empty_in_array( $field, $option ) { |
| 1246 | - return empty( $field[ $option ] ); |
|
| 1246 | + return empty( $field[$option] ); |
|
| 1247 | 1247 | } |
| 1248 | 1248 | |
| 1249 | 1249 | /** |
@@ -1252,7 +1252,7 @@ discard block |
||
| 1252 | 1252 | * @return bool |
| 1253 | 1253 | */ |
| 1254 | 1254 | public static function is_option_empty_in_object( $field, $option ) { |
| 1255 | - return empty( $field->field_options[ $option ] ); |
|
| 1255 | + return empty( $field->field_options[$option] ); |
|
| 1256 | 1256 | } |
| 1257 | 1257 | |
| 1258 | 1258 | /** |
@@ -1261,7 +1261,7 @@ discard block |
||
| 1261 | 1261 | * @return bool |
| 1262 | 1262 | */ |
| 1263 | 1263 | public static function is_option_value_in_object( $field, $option ) { |
| 1264 | - return isset( $field->field_options[ $option ] ) && $field->field_options[ $option ] != ''; |
|
| 1264 | + return isset( $field->field_options[$option] ) && $field->field_options[$option] != ''; |
|
| 1265 | 1265 | } |
| 1266 | 1266 | |
| 1267 | 1267 | /** |
@@ -1287,10 +1287,10 @@ discard block |
||
| 1287 | 1287 | * @return mixed |
| 1288 | 1288 | */ |
| 1289 | 1289 | public static function get_option_in_array( $field, $option ) { |
| 1290 | - if ( isset( $field[ $option ] ) ) { |
|
| 1291 | - $this_option = $field[ $option ]; |
|
| 1292 | - } elseif ( isset( $field['field_options'] ) && is_array( $field['field_options'] ) && isset( $field['field_options'][ $option ] ) ) { |
|
| 1293 | - $this_option = $field['field_options'][ $option ]; |
|
| 1290 | + if ( isset( $field[$option] ) ) { |
|
| 1291 | + $this_option = $field[$option]; |
|
| 1292 | + } elseif ( isset( $field['field_options'] ) && is_array( $field['field_options'] ) && isset( $field['field_options'][$option] ) ) { |
|
| 1293 | + $this_option = $field['field_options'][$option]; |
|
| 1294 | 1294 | } else { |
| 1295 | 1295 | $this_option = ''; |
| 1296 | 1296 | } |
@@ -1304,7 +1304,7 @@ discard block |
||
| 1304 | 1304 | * @return mixed |
| 1305 | 1305 | */ |
| 1306 | 1306 | public static function get_option_in_object( $field, $option ) { |
| 1307 | - return $field->field_options[ $option ] ?? ''; |
|
| 1307 | + return $field->field_options[$option] ?? ''; |
|
| 1308 | 1308 | } |
| 1309 | 1309 | |
| 1310 | 1310 | /** |