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