Version Description
July 4th, 2022 =
Tweak: Added support for exporting post types and taxonomies to PHP for debugging purposes. While logged in as an admin, add
?pods_debug_register_export=1
to expose textareas on the page to get the code. (@sc0ttkclark)Tweak: Added support for new
{@_current_page}
calculation value. (@sc0ttkclark)Tweak: Added support for calculation values in conditional display tags like
[if field="_position" value="2"]
. #6513 (@sc0ttkclark)Fixed: Resolved revision issues when
revisions_to_keep_limit
is set to 0 in the post type. It was supposed to see 0 and use the default revision limit. Instead, it was disabling the revisions for that post type. #6499 (@sc0ttkclark)Fixed: Resolved potential PHP warnings on certain sites by preparing SQL queries separately from other string processing. #6556 #6555 #6554 (@JoryHogeveen, @sc0ttkclark)
Fixed: Resolved potential PHP notices when getting table information in
PodsData::table()
. (@JoryHogeveen)Fixed: Resolved potential PHP type conversion warnings by passing
SORT_REGULAR
toarray_unique()
` in the File field saving process. (@JoryHogeveen)Fixed: Pods Auto Templates defaults for some fields were set to "true" and that is now treated as empty. The default for those fields are now empty as intended. This resolves notices on the Edit Pod screen about templates being used for Archives when Archives are disabled, but there was no template intentionally set for Archive. (@sc0ttkclark)
Release Info
Developer | sc0ttkclark |
Plugin | Pods – Custom Content Types and Fields |
Version | 2.8.23 |
Comparing to | |
See all releases |
Code changes from version 2.8.22.1 to 2.8.23
- classes/PodsData.php +12 -5
- classes/PodsInit.php +8 -0
- classes/PodsMeta.php +1 -1
- classes/fields/file.php +1 -1
- components/Templates/includes/auto-template/Pods_Templates_Auto_Template_Front_End.php +8 -0
- components/Templates/includes/auto-template/Pods_Templates_Auto_Template_Settings.php +1 -1
- components/Templates/includes/functions-view_template.php +15 -1
- includes/general.php +15 -7
- init.php +2 -2
- readme.txt +13 -2
- src/Pods/Data/Map_Field_Values.php +5 -0
@@ -394,7 +394,7 @@ class PodsData {
|
|
394 |
}
|
395 |
|
396 |
// Check for pod object.
|
397 |
-
if ( $table['pod'] instanceof Pod ) {
|
398 |
$this->pod_data = $table['pod'];
|
399 |
} else {
|
400 |
$this->table_info = $table;
|
@@ -2386,16 +2386,21 @@ class PodsData {
|
|
2386 |
// Handle Preparations of Values (sprintf format).
|
2387 |
if ( is_array( $sql ) ) {
|
2388 |
if ( isset( $sql[0] ) && 1 < count( $sql ) ) {
|
|
|
|
|
2389 |
if ( 2 === count( $sql ) ) {
|
2390 |
if ( ! is_array( $sql[1] ) ) {
|
2391 |
-
$sql[1] =
|
|
|
|
|
2392 |
}
|
2393 |
|
2394 |
$params->sql = self::prepare( $sql[0], $sql[1] );
|
2395 |
-
} elseif ( 3 === count( $sql ) ) {
|
2396 |
-
$params->sql = self::prepare( $sql[0], array( $sql[1], $sql[2] ) );
|
2397 |
} else {
|
2398 |
-
$
|
|
|
|
|
|
|
2399 |
}
|
2400 |
} else {
|
2401 |
$params = (object) array_merge( get_object_vars( $params ), $sql );
|
@@ -3698,6 +3703,8 @@ class PodsData {
|
|
3698 |
* Get the complete sql
|
3699 |
*
|
3700 |
* @since 2.0.5
|
|
|
|
|
3701 |
*/
|
3702 |
public function get_sql( $sql = '' ) {
|
3703 |
|
394 |
}
|
395 |
|
396 |
// Check for pod object.
|
397 |
+
if ( ! empty( $table['pod'] ) && $table['pod'] instanceof Pod ) {
|
398 |
$this->pod_data = $table['pod'];
|
399 |
} else {
|
400 |
$this->table_info = $table;
|
2386 |
// Handle Preparations of Values (sprintf format).
|
2387 |
if ( is_array( $sql ) ) {
|
2388 |
if ( isset( $sql[0] ) && 1 < count( $sql ) ) {
|
2389 |
+
$sql = array_values( $sql );
|
2390 |
+
|
2391 |
if ( 2 === count( $sql ) ) {
|
2392 |
if ( ! is_array( $sql[1] ) ) {
|
2393 |
+
$sql[1] = [
|
2394 |
+
$sql[1],
|
2395 |
+
];
|
2396 |
}
|
2397 |
|
2398 |
$params->sql = self::prepare( $sql[0], $sql[1] );
|
|
|
|
|
2399 |
} else {
|
2400 |
+
$sql_query = array_shift( $sql );
|
2401 |
+
$prepare = $sql;
|
2402 |
+
|
2403 |
+
$params->sql = self::prepare( $sql_query, $prepare );
|
2404 |
}
|
2405 |
} else {
|
2406 |
$params = (object) array_merge( get_object_vars( $params ), $sql );
|
3703 |
* Get the complete sql
|
3704 |
*
|
3705 |
* @since 2.0.5
|
3706 |
+
*
|
3707 |
+
* @param string|array $sql The SQL query, optionally an array with the query first and the variables to prepare after that.
|
3708 |
*/
|
3709 |
public function get_sql( $sql = '' ) {
|
3710 |
|
@@ -1841,6 +1841,10 @@ class PodsInit {
|
|
1841 |
pods_debug( [ __METHOD__ . '/register_taxonomy', compact( 'taxonomy', 'ct_post_types', 'options' ) ] );
|
1842 |
}
|
1843 |
|
|
|
|
|
|
|
|
|
1844 |
register_taxonomy( $taxonomy, $ct_post_types, $options );
|
1845 |
|
1846 |
if ( ! empty( $options['show_in_rest'] ) ) {
|
@@ -1889,6 +1893,10 @@ class PodsInit {
|
|
1889 |
pods_debug( [ __METHOD__ . '/register_post_type', compact( 'post_type', 'options' ) ] );
|
1890 |
}
|
1891 |
|
|
|
|
|
|
|
|
|
1892 |
register_post_type( $post_type, $options );
|
1893 |
|
1894 |
// Register post format taxonomy for this post type
|
1841 |
pods_debug( [ __METHOD__ . '/register_taxonomy', compact( 'taxonomy', 'ct_post_types', 'options' ) ] );
|
1842 |
}
|
1843 |
|
1844 |
+
if ( 1 === (int) pods_v( 'pods_debug_register_export', 'get', 0 ) && pods_is_admin( array( 'pods' ) ) ) {
|
1845 |
+
echo '<textarea cols="100" rows="24">' . esc_textarea( 'register_taxonomy( ' . var_export( $taxonomy, true ) . ', ' . var_export( $ct_post_types, true ) . ', ' . var_export( $options, true ) . ' );' ) . '</textarea>';
|
1846 |
+
}
|
1847 |
+
|
1848 |
register_taxonomy( $taxonomy, $ct_post_types, $options );
|
1849 |
|
1850 |
if ( ! empty( $options['show_in_rest'] ) ) {
|
1893 |
pods_debug( [ __METHOD__ . '/register_post_type', compact( 'post_type', 'options' ) ] );
|
1894 |
}
|
1895 |
|
1896 |
+
if ( 1 === (int) pods_v( 'pods_debug_register_export', 'get', 0 ) && pods_is_admin( array( 'pods' ) ) ) {
|
1897 |
+
echo '<textarea cols="100" rows="24">' . esc_textarea( 'register_post_type( ' . var_export( $post_type, true ) . ', ' . var_export( $options, true ) . ' );' ) . '</textarea>';
|
1898 |
+
}
|
1899 |
+
|
1900 |
register_post_type( $post_type, $options );
|
1901 |
|
1902 |
// Register post format taxonomy for this post type
|
@@ -1106,7 +1106,7 @@ class PodsMeta {
|
|
1106 |
$revisions_to_keep_limit = pods_v( 'revisions_to_keep_limit', $pod->pod_data );
|
1107 |
|
1108 |
// Check if we have a valid limit.
|
1109 |
-
if ( ! is_numeric( $revisions_to_keep_limit ) ) {
|
1110 |
return $num;
|
1111 |
}
|
1112 |
|
1106 |
$revisions_to_keep_limit = pods_v( 'revisions_to_keep_limit', $pod->pod_data );
|
1107 |
|
1108 |
// Check if we have a valid limit.
|
1109 |
+
if ( ! is_numeric( $revisions_to_keep_limit ) || 0 === (int) $revisions_to_keep_limit ) {
|
1110 |
return $num;
|
1111 |
}
|
1112 |
|
@@ -685,7 +685,7 @@ class PodsField_File extends PodsField {
|
|
685 |
];
|
686 |
}
|
687 |
|
688 |
-
$value = array_unique( array_filter( $value ) );
|
689 |
|
690 |
// Handle File title saving.
|
691 |
foreach ( $value as $id ) {
|
685 |
];
|
686 |
}
|
687 |
|
688 |
+
$value = array_unique( array_filter( $value ), SORT_REGULAR );
|
689 |
|
690 |
// Handle File title saving.
|
691 |
foreach ( $value as $id ) {
|
@@ -220,6 +220,14 @@ class Pods_Templates_Auto_Template_Front_End {
|
|
220 |
$archive_filter = pods_v( 'pfat_filter_archive', $options, $default_hook, true );
|
221 |
$run_outside_loop = pods_v( 'pfat_run_outside_loop', $options, false, true );
|
222 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
223 |
if ( 'custom' === $single_filter ) {
|
224 |
$single_filter = pods_v( 'pfat_filter_single_custom', $options, $default_hook, true );
|
225 |
}
|
220 |
$archive_filter = pods_v( 'pfat_filter_archive', $options, $default_hook, true );
|
221 |
$run_outside_loop = pods_v( 'pfat_run_outside_loop', $options, false, true );
|
222 |
|
223 |
+
if ( 'true' === $single ) {
|
224 |
+
$single = '';
|
225 |
+
}
|
226 |
+
|
227 |
+
if ( 'true' === $archive ) {
|
228 |
+
$archive = '';
|
229 |
+
}
|
230 |
+
|
231 |
if ( 'custom' === $single_filter ) {
|
232 |
$single_filter = pods_v( 'pfat_filter_single_custom', $options, $default_hook, true );
|
233 |
}
|
@@ -296,7 +296,7 @@ class Pods_Templates_Auto_Template_Settings {
|
|
296 |
'type' => 'pick',
|
297 |
'pick_format_type' => 'single',
|
298 |
'pick_format_single' => 'dropdown',
|
299 |
-
'default' => '
|
300 |
);
|
301 |
|
302 |
// get template titles
|
296 |
'type' => 'pick',
|
297 |
'pick_format_type' => 'single',
|
298 |
'pick_format_single' => 'dropdown',
|
299 |
+
'default' => '',
|
300 |
);
|
301 |
|
302 |
// get template titles
|
@@ -121,7 +121,21 @@ function frontier_if_block( $attributes, $code ) {
|
|
121 |
$field_type = 'text';
|
122 |
|
123 |
if ( ! empty( $attributes['field'] ) ) {
|
124 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
$field_data = pods_v( 'index', $attributes );
|
126 |
} else {
|
127 |
$field_data = $pod->field( $attributes['field'] );
|
121 |
$field_type = 'text';
|
122 |
|
123 |
if ( ! empty( $attributes['field'] ) ) {
|
124 |
+
$supported_calculations = [
|
125 |
+
'_zebra' => 'number',
|
126 |
+
'_position' => 'number',
|
127 |
+
'_total' => 'number',
|
128 |
+
'_total_found' => 'number',
|
129 |
+
'_total_all_rows' => 'number',
|
130 |
+
'_total_pages' => 'number',
|
131 |
+
'_current_page' => 'number',
|
132 |
+
];
|
133 |
+
|
134 |
+
if ( isset( $supported_calculations[ $attributes['field'] ] ) ) {
|
135 |
+
// Support [if field="_position" value="2"] and other calculation value handlers.
|
136 |
+
$field_data = $pod->field( $attributes['field'] );
|
137 |
+
$field_type = $supported_calculations[ $attributes['field'] ];
|
138 |
+
} elseif ( '_index' === $attributes['field'] ) {
|
139 |
$field_data = pods_v( 'index', $attributes );
|
140 |
} else {
|
141 |
$field_data = $pod->field( $attributes['field'] );
|
@@ -17,10 +17,10 @@ use Pods\Static_Cache;
|
|
17 |
*
|
18 |
* @see PodsData::query
|
19 |
*
|
20 |
-
* @param string $sql SQL
|
21 |
-
* @param string
|
22 |
-
* @param string
|
23 |
-
* @param string
|
24 |
*
|
25 |
* @return array|bool|mixed|null|void
|
26 |
* @since 2.0.0
|
@@ -32,9 +32,7 @@ function pods_query( $sql, $error = 'Database Error', $results_error = null, $no
|
|
32 |
return null;
|
33 |
}
|
34 |
|
35 |
-
$
|
36 |
-
$sql = $podsdata->get_sql( $sql );
|
37 |
-
|
38 |
if ( is_array( $error ) ) {
|
39 |
if ( ! is_array( $sql ) ) {
|
40 |
$sql = array( $sql, $error );
|
@@ -43,6 +41,16 @@ function pods_query( $sql, $error = 'Database Error', $results_error = null, $no
|
|
43 |
$error = 'Database Error';
|
44 |
}
|
45 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
if ( 1 === (int) pods_v( 'pods_debug_sql_all' ) && is_user_logged_in() && pods_is_admin( array( 'pods' ) ) ) {
|
47 |
$debug_sql = $sql;
|
48 |
|
17 |
*
|
18 |
* @see PodsData::query
|
19 |
*
|
20 |
+
* @param string|array $sql The SQL query or an array with the SQL query and the values to prepare.
|
21 |
+
* @param string $error (optional) The failure message to use for Database errors.
|
22 |
+
* @param string $results_error (optional) Throw an error if a records are found.
|
23 |
+
* @param string $no_results_error (optional) Throw an error if no records are found.
|
24 |
*
|
25 |
* @return array|bool|mixed|null|void
|
26 |
* @since 2.0.0
|
32 |
return null;
|
33 |
}
|
34 |
|
35 |
+
// If the $error is the $prepare array, set the $error to the default message.
|
|
|
|
|
36 |
if ( is_array( $error ) ) {
|
37 |
if ( ! is_array( $sql ) ) {
|
38 |
$sql = array( $sql, $error );
|
41 |
$error = 'Database Error';
|
42 |
}
|
43 |
|
44 |
+
if ( is_array( $sql ) ) {
|
45 |
+
$sql = array_values( $sql );
|
46 |
+
|
47 |
+
$sql[0] = apply_filters( 'pods_query_sql', $sql[0], $error, $results_error, $no_results_error );
|
48 |
+
$sql[0] = $podsdata->get_sql( $sql[0] );
|
49 |
+
} else {
|
50 |
+
$sql = apply_filters( 'pods_query_sql', $sql, $error, $results_error, $no_results_error );
|
51 |
+
$sql = $podsdata->get_sql( $sql );
|
52 |
+
}
|
53 |
+
|
54 |
if ( 1 === (int) pods_v( 'pods_debug_sql_all' ) && is_user_logged_in() && pods_is_admin( array( 'pods' ) ) ) {
|
55 |
$debug_sql = $sql;
|
56 |
|
@@ -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.23
|
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.23' );
|
47 |
|
48 |
// Current database version, this is the last version the database changed.
|
49 |
define( 'PODS_DB_VERSION', '2.3.5' );
|
@@ -5,7 +5,7 @@ Tags: pods, custom post types, custom taxonomies, content types, custom fields,
|
|
5 |
Requires at least: 5.5
|
6 |
Tested up to: 6.0
|
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,9 +156,20 @@ Pods really wouldn't be where it is without all the contributions from our [dono
|
|
156 |
|
157 |
== Changelog ==
|
158 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
159 |
= 2.8.22.1 - July 3rd, 2022 =
|
160 |
|
161 |
-
* Fixed: Resolve potential PHP errors from Relationship/File field saves by ensuring consistent array structures.
|
162 |
|
163 |
= 2.8.22 - July 3rd, 2022 =
|
164 |
|
5 |
Requires at least: 5.5
|
6 |
Tested up to: 6.0
|
7 |
Requires PHP: 5.6
|
8 |
+
Stable tag: 2.8.23
|
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.23 - July 4th, 2022 =
|
160 |
+
|
161 |
+
* Tweak: Added support for exporting post types and taxonomies to PHP for debugging purposes. While logged in as an admin, add `?pods_debug_register_export=1` to expose textareas on the page to get the code. (@sc0ttkclark)
|
162 |
+
* Tweak: Added support for new `{@_current_page}` calculation value. (@sc0ttkclark)
|
163 |
+
* Tweak: Added support for calculation values in conditional display tags like `[if field="_position" value="2"]`. #6513 (@sc0ttkclark)
|
164 |
+
* Fixed: Resolved revision issues when `revisions_to_keep_limit` is set to 0 in the post type. It was supposed to see 0 and use the default revision limit. Instead, it was disabling the revisions for that post type. #6499 (@sc0ttkclark)
|
165 |
+
* Fixed: Resolved potential PHP warnings on certain sites by preparing SQL queries separately from other string processing. #6556 #6555 #6554 (@JoryHogeveen, @sc0ttkclark)
|
166 |
+
* Fixed: Resolved potential PHP notices when getting table information in `PodsData::table()`. (@JoryHogeveen)
|
167 |
+
* Fixed: Resolved potential PHP type conversion warnings by passing `SORT_REGULAR` to `array_unique()`` in the File field saving process. (@JoryHogeveen)
|
168 |
+
* Fixed: Pods Auto Templates defaults for some fields were set to "true" and that is now treated as empty. The default for those fields are now empty as intended. This resolves notices on the Edit Pod screen about templates being used for Archives when Archives are disabled, but there was no template intentionally set for Archive. (@sc0ttkclark)
|
169 |
+
|
170 |
= 2.8.22.1 - July 3rd, 2022 =
|
171 |
|
172 |
+
* Fixed: Resolve potential PHP errors from Relationship/File field saves by ensuring consistent array structures. (@sc0ttkclark)
|
173 |
|
174 |
= 2.8.22 - July 3rd, 2022 =
|
175 |
|
@@ -284,6 +284,7 @@ class Map_Field_Values {
|
|
284 |
'_total_found',
|
285 |
'_total_all_rows',
|
286 |
'_total_pages',
|
|
|
287 |
];
|
288 |
|
289 |
// Skip if not the field we are looking for.
|
@@ -317,6 +318,10 @@ class Map_Field_Values {
|
|
317 |
case '_total_pages':
|
318 |
$value = $obj->total_pages();
|
319 |
|
|
|
|
|
|
|
|
|
320 |
break;
|
321 |
}
|
322 |
|
284 |
'_total_found',
|
285 |
'_total_all_rows',
|
286 |
'_total_pages',
|
287 |
+
'_current_page',
|
288 |
];
|
289 |
|
290 |
// Skip if not the field we are looking for.
|
318 |
case '_total_pages':
|
319 |
$value = $obj->total_pages();
|
320 |
|
321 |
+
break;
|
322 |
+
case '_current_page':
|
323 |
+
$value = (int) $obj->page;
|
324 |
+
|
325 |
break;
|
326 |
}
|
327 |
|