Version Description
May 6th, 2022 =
Added: More compatiblity with Advanced Relationship Storage Add-On from Pods Pro by SKCDEV which allows for saving table-based relationship fields during the normal save process. (@sc0ttkclark)
Fixed: Booleans when saving to the database now prepare as
%d
instead of the generic%s
. (@sc0ttkclark)Fixed: Additional SV file escaping on exports to prevent formulas from evaluating in certain spreadsheet apps unexpectedly. (@sc0ttkclark)
Fixed: The old Pods / Pods API CLI commands were unintentially removed in Pods 2.8 and they have now been brought back as
wp pods-legacy
andwp pods-legacy-api
. (@sc0ttkclark)Fixed: Improved the text / link for registering connections on Post Types and Taxonomies so they reference the correct object type. (@sc0ttkclark)
Fixed: Multi-select fields were not saving properly in certain forms. #6498 #6216 (@zrothauser)
Confirmed compatibility with WordPress 6.0.
Release Info
Developer | sc0ttkclark |
Plugin | Pods – Custom Content Types and Fields |
Version | 2.8.16 |
Comparing to | |
See all releases |
Code changes from version 2.8.15 to 2.8.16
- classes/PodsAPI.php +15 -6
- classes/PodsMigrate.php +25 -4
- classes/cli/PodsAPI_CLI_Command.php +1 -1
- classes/cli/Pods_CLI_Command.php +1 -1
- classes/fields/boolean.php +1 -1
- classes/fields/file.php +14 -0
- classes/fields/pick.php +14 -0
- includes/general.php +23 -0
- init.php +2 -2
- readme.txt +12 -2
- src/Pods/Admin/Config/Pod.php +14 -12
- ui/admin/callouts/friends_2021_29.php +2 -2
- ui/js/jquery.pods.js +9 -1
@@ -5022,6 +5022,12 @@ class PodsAPI {
|
|
5022 |
$type = $field_data['type'];
|
5023 |
$options = pods_v( 'options', $field_data, [] );
|
5024 |
|
|
|
|
|
|
|
|
|
|
|
|
|
5025 |
if ( in_array( $type, $layout_field_types, true ) ) {
|
5026 |
continue;
|
5027 |
}
|
@@ -5145,8 +5151,12 @@ class PodsAPI {
|
|
5145 |
}
|
5146 |
}
|
5147 |
|
|
|
|
|
|
|
|
|
5148 |
// Prepare all table / meta data
|
5149 |
-
if ( $
|
5150 |
if ( in_array( $type, $repeatable_field_types, true ) && 1 === (int) pods_v( $type . '_repeatable', $field_data, 0 ) ) {
|
5151 |
// Don't save an empty array, just make it an empty string
|
5152 |
if ( empty( $value ) ) {
|
@@ -5157,12 +5167,11 @@ class PodsAPI {
|
|
5157 |
}
|
5158 |
}
|
5159 |
|
5160 |
-
$
|
5161 |
-
$
|
5162 |
-
$save_simple_to_meta = $simple && ( $is_settings_pod || pods_relationship_meta_storage_enabled_for_simple_relationships( $options, $pod ) );
|
5163 |
|
5164 |
// Check if we should save to the table, and then check if the field is not a simple relationship OR the simple relationship field is allowed to be saved to the table.
|
5165 |
-
if ( $save_to_table && ( ! $simple || $save_simple_to_table ) ) {
|
5166 |
$table_data[ $field ] = $value;
|
5167 |
|
5168 |
// Enforce JSON values for objects/arrays.
|
@@ -5176,7 +5185,7 @@ class PodsAPI {
|
|
5176 |
'{prefix}'
|
5177 |
], $table_data[ $field ] );
|
5178 |
|
5179 |
-
$table_formats[] = PodsForm::prepare( $type, $
|
5180 |
}
|
5181 |
|
5182 |
// Check if the field is not a simple relationship OR the simple relationship field is allowed to be saved to meta.
|
5022 |
$type = $field_data['type'];
|
5023 |
$options = pods_v( 'options', $field_data, [] );
|
5024 |
|
5025 |
+
$field_object = $field_data;
|
5026 |
+
|
5027 |
+
if ( $field_data instanceof Value_Field ) {
|
5028 |
+
$field_object = $field_data->get_field_object();
|
5029 |
+
}
|
5030 |
+
|
5031 |
if ( in_array( $type, $layout_field_types, true ) ) {
|
5032 |
continue;
|
5033 |
}
|
5151 |
}
|
5152 |
}
|
5153 |
|
5154 |
+
$is_tableless_field = in_array( $type, $tableless_field_types, true );
|
5155 |
+
$is_settings_pod = 'settings' === $pod['type'];
|
5156 |
+
$save_non_simple_to_table = $is_tableless_field && ! $simple && ! $is_settings_pod && pods_relationship_table_storage_enabled_for_object_relationships( $field_object, $pod );
|
5157 |
+
|
5158 |
// Prepare all table / meta data
|
5159 |
+
if ( ! $is_tableless_field || $simple || $save_non_simple_to_table ) {
|
5160 |
if ( in_array( $type, $repeatable_field_types, true ) && 1 === (int) pods_v( $type . '_repeatable', $field_data, 0 ) ) {
|
5161 |
// Don't save an empty array, just make it an empty string
|
5162 |
if ( empty( $value ) ) {
|
5167 |
}
|
5168 |
}
|
5169 |
|
5170 |
+
$save_simple_to_table = $simple && ! $is_settings_pod && pods_relationship_table_storage_enabled_for_simple_relationships( $field_object, $pod );
|
5171 |
+
$save_simple_to_meta = $simple && ( $is_settings_pod || pods_relationship_meta_storage_enabled_for_simple_relationships( $field_object, $pod ) );
|
|
|
5172 |
|
5173 |
// Check if we should save to the table, and then check if the field is not a simple relationship OR the simple relationship field is allowed to be saved to the table.
|
5174 |
+
if ( $save_to_table && ( ! $simple || $save_simple_to_table || $save_non_simple_to_table ) ) {
|
5175 |
$table_data[ $field ] = $value;
|
5176 |
|
5177 |
// Enforce JSON values for objects/arrays.
|
5185 |
'{prefix}'
|
5186 |
], $table_data[ $field ] );
|
5187 |
|
5188 |
+
$table_formats[] = PodsForm::prepare( $type, $field_object );
|
5189 |
}
|
5190 |
|
5191 |
// Check if the field is not a simple relationship OR the simple relationship field is allowed to be saved to meta.
|
@@ -273,11 +273,22 @@ class PodsMigrate {
|
|
273 |
$data['items'][ $key ] = array();
|
274 |
|
275 |
foreach ( $data['columns'] as $ckey => $column ) {
|
276 |
-
$
|
277 |
-
|
278 |
-
if ( 'NULL' === $
|
279 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
280 |
}
|
|
|
|
|
281 |
}
|
282 |
}
|
283 |
}
|
@@ -623,6 +634,16 @@ class PodsMigrate {
|
|
623 |
|
624 |
$value = str_replace( array( '"', "\r\n", "\r", "\n" ), array( '\\"', "\n", "\n", '\n' ), $value );
|
625 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
626 |
$line .= '"' . $value . '"' . $this->delimiter;
|
627 |
}//end foreach
|
628 |
|
273 |
$data['items'][ $key ] = array();
|
274 |
|
275 |
foreach ( $data['columns'] as $ckey => $column ) {
|
276 |
+
$column_value = ( isset( $row[ $ckey ] ) ? $row[ $ckey ] : '' );
|
277 |
+
|
278 |
+
if ( 'NULL' === $column_value ) {
|
279 |
+
// Maybe set the value as null.
|
280 |
+
$column_value = null;
|
281 |
+
} elseif (
|
282 |
+
0 === strpos( $column_value, '\\=' )
|
283 |
+
|| 0 === strpos( $column_value, '\\+' )
|
284 |
+
|| 0 === strpos( $column_value, '\\-' )
|
285 |
+
|| 0 === strpos( $column_value, '\\@' )
|
286 |
+
) {
|
287 |
+
// Maybe remove the first backslash.
|
288 |
+
$column_value = substr( $column_value, 1 );
|
289 |
}
|
290 |
+
|
291 |
+
$data['items'][ $key ][ $column ] = $column_value;
|
292 |
}
|
293 |
}
|
294 |
}
|
634 |
|
635 |
$value = str_replace( array( '"', "\r\n", "\r", "\n" ), array( '\\"', "\n", "\n", '\n' ), $value );
|
636 |
|
637 |
+
// Maybe escape the first character to prevent formulas from getting used when opening the file with a spreadsheet app.
|
638 |
+
if (
|
639 |
+
0 === strpos( $value, '=' )
|
640 |
+
|| 0 === strpos( $value, '+' )
|
641 |
+
|| 0 === strpos( $value, '-' )
|
642 |
+
|| 0 === strpos( $value, '@' )
|
643 |
+
) {
|
644 |
+
$value = '\\' . $value;
|
645 |
+
}
|
646 |
+
|
647 |
$line .= '"' . $value . '"' . $this->delimiter;
|
648 |
}//end foreach
|
649 |
|
@@ -504,4 +504,4 @@ class PodsAPI_CLI_Command extends WP_CLI_Command {
|
|
504 |
|
505 |
}
|
506 |
|
507 |
-
WP_CLI::add_command( 'pods-api', 'PodsAPI_CLI_Command' );
|
504 |
|
505 |
}
|
506 |
|
507 |
+
WP_CLI::add_command( 'pods-legacy-api', 'PodsAPI_CLI_Command' );
|
@@ -385,4 +385,4 @@ class Pods_CLI_Command extends WP_CLI_Command {
|
|
385 |
|
386 |
}
|
387 |
|
388 |
-
WP_CLI::add_command( 'pods', 'Pods_CLI_Command' );
|
385 |
|
386 |
}
|
387 |
|
388 |
+
WP_CLI::add_command( 'pods-legacy', 'Pods_CLI_Command' );
|
@@ -20,7 +20,7 @@ class PodsField_Boolean extends PodsField {
|
|
20 |
/**
|
21 |
* {@inheritdoc}
|
22 |
*/
|
23 |
-
public static $prepare = '%
|
24 |
|
25 |
/**
|
26 |
* {@inheritdoc}
|
20 |
/**
|
21 |
* {@inheritdoc}
|
22 |
*/
|
23 |
+
public static $prepare = '%d';
|
24 |
|
25 |
/**
|
26 |
* {@inheritdoc}
|
@@ -282,6 +282,20 @@ class PodsField_File extends PodsField {
|
|
282 |
|
283 |
}
|
284 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
285 |
/**
|
286 |
* {@inheritdoc}
|
287 |
*/
|
282 |
|
283 |
}
|
284 |
|
285 |
+
/**
|
286 |
+
* {@inheritdoc}
|
287 |
+
*/
|
288 |
+
public function prepare( $options = null ) {
|
289 |
+
$format = static::$prepare;
|
290 |
+
|
291 |
+
// Maybe use number format for storage if limit is one.
|
292 |
+
if ( $options instanceof Field && 1 === $options->get_limit() ) {
|
293 |
+
$format = '%d';
|
294 |
+
}
|
295 |
+
|
296 |
+
return $format;
|
297 |
+
}
|
298 |
+
|
299 |
/**
|
300 |
* {@inheritdoc}
|
301 |
*/
|
@@ -425,6 +425,20 @@ class PodsField_Pick extends PodsField {
|
|
425 |
|
426 |
}
|
427 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
428 |
/**
|
429 |
* Register a related object.
|
430 |
*
|
425 |
|
426 |
}
|
427 |
|
428 |
+
/**
|
429 |
+
* {@inheritdoc}
|
430 |
+
*/
|
431 |
+
public function prepare( $options = null ) {
|
432 |
+
$format = static::$prepare;
|
433 |
+
|
434 |
+
// Maybe use number format for storage if not a simple relationship and limit is one.
|
435 |
+
if ( $options instanceof Field && ! $options->is_simple_relationship() && 1 === $options->get_limit() ) {
|
436 |
+
$format = '%d';
|
437 |
+
}
|
438 |
+
|
439 |
+
return $format;
|
440 |
+
}
|
441 |
+
|
442 |
/**
|
443 |
* Register a related object.
|
444 |
*
|
@@ -552,6 +552,29 @@ function pods_relationship_table_storage_enabled_for_simple_relationships( $fiel
|
|
552 |
return (bool) apply_filters( 'pods_relationship_table_storage_enabled_for_simple_relationships', $enabled, $field, $pod );
|
553 |
}
|
554 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
555 |
/**
|
556 |
* Determine if Light Mode is enabled
|
557 |
*
|
552 |
return (bool) apply_filters( 'pods_relationship_table_storage_enabled_for_simple_relationships', $enabled, $field, $pod );
|
553 |
}
|
554 |
|
555 |
+
/**
|
556 |
+
* Determine whether relationship table storage is enabled for object based relationships.
|
557 |
+
*
|
558 |
+
* @since 2.8.16
|
559 |
+
*
|
560 |
+
* @param null|array|Field $field The field object.
|
561 |
+
* @param null|array|Pod $pod The pod object.
|
562 |
+
*
|
563 |
+
* @return bool Whether relationship table storage is enabled.
|
564 |
+
*/
|
565 |
+
function pods_relationship_table_storage_enabled_for_object_relationships( $field = null, $pod = null ) {
|
566 |
+
/**
|
567 |
+
* Allow filtering of whether relationship table storage is enabled for object based relationships.
|
568 |
+
*
|
569 |
+
* @since 2.8.16
|
570 |
+
*
|
571 |
+
* @param bool $enabled Whether relationship table storage table is enabled for object based relationships.
|
572 |
+
* @param null|array|Field $field The field object.
|
573 |
+
* @param null|array|Pod $pod The pod object.
|
574 |
+
*/
|
575 |
+
return (bool) apply_filters( 'pods_relationship_table_storage_enabled_for_object_relationships', false, $field, $pod );
|
576 |
+
}
|
577 |
+
|
578 |
/**
|
579 |
* Determine if Light Mode is enabled
|
580 |
*
|
@@ -10,7 +10,7 @@
|
|
10 |
* Plugin Name: Pods - Custom Content Types and Fields
|
11 |
* Plugin URI: https://pods.io/
|
12 |
* Description: Pods is a framework for creating, managing, and deploying customized content types and fields
|
13 |
-
* Version: 2.8.
|
14 |
* Author: Pods Framework Team
|
15 |
* Author URI: https://pods.io/about/
|
16 |
* Text Domain: pods
|
@@ -43,7 +43,7 @@ if ( defined( 'PODS_VERSION' ) || defined( 'PODS_DIR' ) ) {
|
|
43 |
add_action( 'init', 'pods_deactivate_pods_ui' );
|
44 |
} else {
|
45 |
// Current version.
|
46 |
-
define( 'PODS_VERSION', '2.8.
|
47 |
|
48 |
// Current database version, this is the last version the database changed.
|
49 |
define( 'PODS_DB_VERSION', '2.3.5' );
|
10 |
* Plugin Name: Pods - Custom Content Types and Fields
|
11 |
* Plugin URI: https://pods.io/
|
12 |
* Description: Pods is a framework for creating, managing, and deploying customized content types and fields
|
13 |
+
* Version: 2.8.16
|
14 |
* Author: Pods Framework Team
|
15 |
* Author URI: https://pods.io/about/
|
16 |
* Text Domain: pods
|
43 |
add_action( 'init', 'pods_deactivate_pods_ui' );
|
44 |
} else {
|
45 |
// Current version.
|
46 |
+
define( 'PODS_VERSION', '2.8.16' );
|
47 |
|
48 |
// Current database version, this is the last version the database changed.
|
49 |
define( 'PODS_DB_VERSION', '2.3.5' );
|
@@ -3,9 +3,9 @@ Contributors: sc0ttkclark, zrothauser, keraweb, jimtrue, quasel, nicdford, james
|
|
3 |
Donate link: https://friends.pods.io/
|
4 |
Tags: pods, custom post types, custom taxonomies, content types, custom fields, block
|
5 |
Requires at least: 5.5
|
6 |
-
Tested up to:
|
7 |
Requires PHP: 5.6
|
8 |
-
Stable tag: 2.8.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -156,6 +156,16 @@ Pods really wouldn't be where it is without all the contributions from our [dono
|
|
156 |
|
157 |
== Changelog ==
|
158 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
159 |
= 2.8.15 - April 16th, 2022 =
|
160 |
|
161 |
* Added: New `pods_callback` support in `Pods::find()` so that you can pass a callback function to use for `pods()` usage with relationships using the `output` as "pods". This allows for using shared instances across large data sets to reduce time. (@sc0ttkclark)
|
3 |
Donate link: https://friends.pods.io/
|
4 |
Tags: pods, custom post types, custom taxonomies, content types, custom fields, block
|
5 |
Requires at least: 5.5
|
6 |
+
Tested up to: 6.0
|
7 |
Requires PHP: 5.6
|
8 |
+
Stable tag: 2.8.16
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
156 |
|
157 |
== Changelog ==
|
158 |
|
159 |
+
= 2.8.16 - May 6th, 2022 =
|
160 |
+
|
161 |
+
* Added: More compatiblity with Advanced Relationship Storage Add-On from Pods Pro by SKCDEV which allows for saving table-based relationship fields during the normal save process. (@sc0ttkclark)
|
162 |
+
* Fixed: Booleans when saving to the database now prepare as `%d` instead of the generic `%s`. (@sc0ttkclark)
|
163 |
+
* Fixed: Additional SV file escaping on exports to prevent formulas from evaluating in certain spreadsheet apps unexpectedly. (@sc0ttkclark)
|
164 |
+
* Fixed: The old Pods / Pods API CLI commands were unintentially removed in Pods 2.8 and they have now been brought back as `wp pods-legacy` and `wp pods-legacy-api`. (@sc0ttkclark)
|
165 |
+
* Fixed: Improved the text / link for registering connections on Post Types and Taxonomies so they reference the correct object type. (@sc0ttkclark)
|
166 |
+
* Fixed: Multi-select fields were not saving properly in certain forms. #6498 #6216 (@zrothauser)
|
167 |
+
* Confirmed compatibility with WordPress 6.0.
|
168 |
+
|
169 |
= 2.8.15 - April 16th, 2022 =
|
170 |
|
171 |
* Added: New `pods_callback` support in `Pods::find()` so that you can pass a callback function to use for `pods()` usage with relationships using the `output` as "pods". This allows for using shared instances across large data sets to reduce time. (@sc0ttkclark)
|
@@ -723,13 +723,14 @@ class Pod extends Base {
|
|
723 |
];
|
724 |
}
|
725 |
|
726 |
-
$options['connections']['
|
727 |
-
'name' => '
|
728 |
-
'label' => __( 'Add new
|
729 |
'type' => 'html',
|
730 |
'html_content' => sprintf(
|
731 |
-
'<a href="%s"
|
732 |
-
esc_url( admin_url( 'admin.php?page=pods-add-new&create_extend=create&type=
|
|
|
733 |
),
|
734 |
];
|
735 |
|
@@ -1134,13 +1135,14 @@ class Pod extends Base {
|
|
1134 |
'type' => 'boolean_group',
|
1135 |
'boolean_group' => [],
|
1136 |
],
|
1137 |
-
'
|
1138 |
-
'name'
|
1139 |
-
'label'
|
1140 |
-
'type'
|
1141 |
-
'html_content'
|
1142 |
-
'<a href="%s"
|
1143 |
-
esc_url( admin_url( 'admin.php?page=pods-add-new&create_extend=create&type=
|
|
|
1144 |
),
|
1145 |
],
|
1146 |
];
|
723 |
];
|
724 |
}
|
725 |
|
726 |
+
$options['connections']['register_custom_taxonomy'] = [
|
727 |
+
'name' => 'register_custom_taxonomy',
|
728 |
+
'label' => __( 'Add new connection', 'pods' ),
|
729 |
'type' => 'html',
|
730 |
'html_content' => sprintf(
|
731 |
+
'<a href="%1$s">%2$s</a>',
|
732 |
+
esc_url( admin_url( 'admin.php?page=pods-add-new&create_extend=create&type=taxonomy' ) ),
|
733 |
+
esc_html__( 'Create a new Custom Taxonomy', 'pods' )
|
734 |
),
|
735 |
];
|
736 |
|
1135 |
'type' => 'boolean_group',
|
1136 |
'boolean_group' => [],
|
1137 |
],
|
1138 |
+
'register_custom_post_type' => [
|
1139 |
+
'name' => 'register_custom_post_type',
|
1140 |
+
'label' => __( 'Add new connection', 'pods' ),
|
1141 |
+
'type' => 'html',
|
1142 |
+
'html_content' => sprintf(
|
1143 |
+
'<a href="%1$s">%2$s</a>',
|
1144 |
+
esc_url( admin_url( 'admin.php?page=pods-add-new&create_extend=create&type=post_type' ) ),
|
1145 |
+
esc_html__( 'Create a new Custom Post Type', 'pods' )
|
1146 |
),
|
1147 |
],
|
1148 |
];
|
@@ -39,7 +39,7 @@ $donate_now_link = add_query_arg( $campaign_args, $donate_now_link );
|
|
39 |
<h2 class="pods-admin_friends-callout_headline">
|
40 |
<?php
|
41 |
printf(
|
42 |
-
esc_html__( 'We need %1$sYOU%2$s
|
43 |
'<span class="pods-admin_friends-you">',
|
44 |
'</span>'
|
45 |
);
|
@@ -51,7 +51,7 @@ $donate_now_link = add_query_arg( $campaign_args, $donate_now_link );
|
|
51 |
<?php
|
52 |
printf(
|
53 |
'%1$s: <a href="%2$s" target="_blank" rel="noreferrer">%3$s</a>',
|
54 |
-
esc_html__( 'Pods 2.8 is out
|
55 |
esc_url( $feature_callout_link ),
|
56 |
esc_html__( 'Simple Repeatable Fields', 'pods' )
|
57 |
);
|
39 |
<h2 class="pods-admin_friends-callout_headline">
|
40 |
<?php
|
41 |
printf(
|
42 |
+
esc_html__( 'We need %1$sYOU%2$s', 'pods' ),
|
43 |
'<span class="pods-admin_friends-you">',
|
44 |
'</span>'
|
45 |
);
|
51 |
<?php
|
52 |
printf(
|
53 |
'%1$s: <a href="%2$s" target="_blank" rel="noreferrer">%3$s</a>',
|
54 |
+
esc_html__( 'Pods 2.8 is out and we are building the next feature for Pods 2.9', 'pods' ),
|
55 |
esc_url( $feature_callout_link ),
|
56 |
esc_html__( 'Simple Repeatable Fields', 'pods' )
|
57 |
);
|
@@ -216,8 +216,16 @@
|
|
216 |
value = null;
|
217 |
}
|
218 |
|
|
|
219 |
if ( null !== value ) {
|
220 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
221 |
}
|
222 |
}
|
223 |
} );
|
216 |
value = null;
|
217 |
}
|
218 |
|
219 |
+
// Fix for FormData converting arrays into comma-separated strings.
|
220 |
if ( null !== value ) {
|
221 |
+
if ( field_name.endsWith( '[]' ) && Array.isArray( value ) ) {
|
222 |
+
value.forEach( ( subvalue ) => {
|
223 |
+
postdata.append( field_name, subvalue );
|
224 |
+
} );
|
225 |
+
} else {
|
226 |
+
postdata.append( field_name, value );
|
227 |
+
}
|
228 |
+
|
229 |
}
|
230 |
}
|
231 |
} );
|