@@ 3460-3469 (lines=10) @@ | ||
3457 | $value = array_slice( $value, 0, $pick_limit ); |
|
3458 | ||
3459 | // Don't save an empty array, just make it an empty string |
|
3460 | if ( empty( $value ) ) |
|
3461 | $value = ''; |
|
3462 | elseif ( is_array( $value ) ) { |
|
3463 | // If there's just one item, don't save as an array, save the string |
|
3464 | if ( 1 == $pick_limit || 1 == count( $value ) ) |
|
3465 | $value = implode( '', $value ); |
|
3466 | // If storage is set to table, json encode, otherwise WP will serialize automatically |
|
3467 | elseif ( 'table' == pods_var( 'storage', $pod ) ) |
|
3468 | $value = version_compare( PHP_VERSION, '5.4.0', '>=' ) ? json_encode( $value, JSON_UNESCAPED_UNICODE ) : json_encode( $value ); |
|
3469 | } |
|
3470 | } |
|
3471 | ||
3472 | // Prepare all table / meta data |
|
@@ 3476-3485 (lines=10) @@ | ||
3473 | if ( !in_array( $type, $tableless_field_types ) || $simple ) { |
|
3474 | if ( in_array( $type, $repeatable_field_types ) && 1 == pods_var( $type . '_repeatable', $field_data, 0 ) ) { |
|
3475 | // Don't save an empty array, just make it an empty string |
|
3476 | if ( empty( $value ) ) |
|
3477 | $value = ''; |
|
3478 | elseif ( is_array( $value ) ) { |
|
3479 | // If there's just one item, don't save as an array, save the string |
|
3480 | if ( 1 == count( $value ) ) |
|
3481 | $value = implode( '', $value ); |
|
3482 | // If storage is set to table, json encode, otherwise WP will serialize automatically |
|
3483 | elseif ( 'table' == pods_var( 'storage', $pod ) ) |
|
3484 | $value = version_compare( PHP_VERSION, '5.4.0', '>=' ) ? json_encode( $value, JSON_UNESCAPED_UNICODE ) : json_encode( $value ); |
|
3485 | } |
|
3486 | } |
|
3487 | ||
3488 | $table_data[ $field ] = str_replace( array( '{prefix}', '@wp_' ), array( '{/prefix/}', '{prefix}' ), $value ); // Fix for pods_query |