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