@@ 3475-3484 (lines=10) @@ | ||
3472 | $value = array_slice( $value, 0, $pick_limit ); |
|
3473 | ||
3474 | // Don't save an empty array, just make it an empty string |
|
3475 | if ( empty( $value ) ) |
|
3476 | $value = ''; |
|
3477 | elseif ( is_array( $value ) ) { |
|
3478 | // If there's just one item, don't save as an array, save the string |
|
3479 | if ( 1 == $pick_limit || 1 == count( $value ) ) |
|
3480 | $value = implode( '', $value ); |
|
3481 | // If storage is set to table, json encode, otherwise WP will serialize automatically |
|
3482 | elseif ( 'table' == pods_var( 'storage', $pod ) ) |
|
3483 | $value = version_compare( PHP_VERSION, '5.4.0', '>=' ) ? json_encode( $value, JSON_UNESCAPED_UNICODE ) : json_encode( $value ); |
|
3484 | } |
|
3485 | } |
|
3486 | ||
3487 | // Prepare all table / meta data |
|
@@ 3491-3500 (lines=10) @@ | ||
3488 | if ( !in_array( $type, $tableless_field_types ) || $simple ) { |
|
3489 | if ( in_array( $type, $repeatable_field_types ) && 1 == pods_var( $type . '_repeatable', $field_data, 0 ) ) { |
|
3490 | // Don't save an empty array, just make it an empty string |
|
3491 | if ( empty( $value ) ) |
|
3492 | $value = ''; |
|
3493 | elseif ( is_array( $value ) ) { |
|
3494 | // If there's just one item, don't save as an array, save the string |
|
3495 | if ( 1 == count( $value ) ) |
|
3496 | $value = implode( '', $value ); |
|
3497 | // If storage is set to table, json encode, otherwise WP will serialize automatically |
|
3498 | elseif ( 'table' == pods_var( 'storage', $pod ) ) |
|
3499 | $value = version_compare( PHP_VERSION, '5.4.0', '>=' ) ? json_encode( $value, JSON_UNESCAPED_UNICODE ) : json_encode( $value ); |
|
3500 | } |
|
3501 | } |
|
3502 | ||
3503 | $table_data[ $field ] = str_replace( array( '{prefix}', '@wp_' ), array( '{/prefix/}', '{prefix}' ), $value ); // Fix for pods_query |