Skip to content

Commit 08a7bc7

Browse files
authored
Pods 3.3 (#7398)
2 parents f20f8ca + 1ffff14 commit 08a7bc7

File tree

85 files changed

+949
-614
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+949
-614
lines changed

.env.testing.slic

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ PODS_REBUILD_DATA=false
55
# Set this back to "pods" when done testing
66
PODS_ROOT_FOLDER="pods"
77

8+
# Workaround for slic / testing not supporting 6.3+
9+
PODS_WP_VERSION_MINIMUM="6.1"
10+
811
# This file will be consumed by both the CI and the tests.
912
# Some environment variables might not apply to one but might apply to the other: modify with care.
1013

.github/workflows/build-zip.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Build ZIP for new release
2+
on:
3+
release:
4+
types:
5+
- published
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout files
11+
uses: actions/checkout@v4
12+
- name: Create zip
13+
run: |
14+
git archive --format=zip --worktree-attributes -9 -o ${{ github.event.repository.name }}.zip HEAD
15+
unzip -d ${{ github.event.repository.name }} ${{ github.event.repository.name }}.zip
16+
zip -9 -r ${{ github.event.repository.name }}.${{ github.ref_name }}.zip ${{ github.event.repository.name }}
17+
- name: Add asset to release
18+
uses: softprops/action-gh-release@v1
19+
if: startsWith(github.ref, 'refs/tags/')
20+
with:
21+
files: ${{ github.event.repository.name }}.${{ github.ref_name }}.zip
22+
env:
23+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

changelog.txt

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,28 @@ Found a bug? Have a great feature idea? Get on GitHub and tell us about it and w
22

33
Our GitHub has the full list of all prior releases of Pods: https://github.com/pods-framework/pods/releases
44

5+
= 3.3 - May 1st, 2025 =
6+
7+
* New minimum WP version required: WordPress 6.3+ (previously: WP 6.0+)
8+
* Removed: PHP support for Pod Templates and Pod Pages has been officially removed from Pods. This feature was deprecated in Pods 2.3. We recommend you follow the newer more secure way: https://docs.pods.io/displaying-pods/pod-page-template-hierarchy-for-themes/ and https://docs.pods.io/displaying-pods/pod-template-hierarchy-for-themes/ and a snippet if you absolutely still need PHP support for now https://gist.github.com/sc0ttkclark/35a15e6f93622c45f12d671184fb1315 (@sc0ttkclark)
9+
* Feature: Form validation for the Block Editor now prevents saving a post if there are required fields and shows the appropriate error message. #7343 #7369 (@JoryHogeveen, @sc0ttkclark)
10+
* Feature: Upgraded Pods Blocks to the WP Blocks API version 3 to support more feautres like block wrapper attributes and the iframe editor. (@sc0ttkclark)
11+
* Feature: Added support for WYSIWYG field type when using the TinyMCE editor to allow Delayed initialization and not showing the editor until clicking. This is optional and can be enabled per field. (@sc0ttkclark)
12+
* Feature: Added support for WYSIWYG field type when using the TinyMCE editor to refresh the editor if you encounter compatibility issues with other plugins on load. (@sc0ttkclark)
13+
* Tweak: Allow forcing `pods_serial_comma()` to use exactly what is sent instead of relying on the field config itself. (@sc0ttkclark)
14+
* Tweak: Remove Pods Pro WPGraphQL deactivation message to support future features there. The core functionality of that was merged into Pods 2.9 but new work is still being done in the add-on. (@sc0ttkclark)
15+
* Tweak: Pods Forms now wrap `div` / `p` form output types within a new `div.pods-form-fieldset` wrapper element. The table form output type has the new class `pods-form-fieldset` added to it too. (@sc0ttkclark)
16+
* Fixed: Prevent doing it wrong notices in WP from unintentionally loading translatable strings too early. (@sc0ttkclark)
17+
* Fixed: Improved PHP compatibiltiy with strlen() usage. #7394 (@lbonomo, @sc0ttkclark)
18+
* Fixed: More PHP 8.x compatibility fixes for `PodsUI`. (@sc0ttkclark)
19+
* Fixed: Docs link for Date / Time field type now points to the correct URL. #7405 (@BrookeDot)
20+
* Fixed: Remove unnecessary duplicate IDs in the fetching within `Pods::field()`. (@sc0ttkclark)
21+
* Fixed: Name check handling when duplicating pod now works as expected and prevents weirdly named duplicate pod names. (@sc0ttkclark)
22+
* Tooling: Generate build provenance attestation during deployment for .org zip. #7419 (@johnbillion)
23+
524
= 3.2.8.2 - February 7th, 2025 =
625

7-
* Security: Do not allow using custom SQL clauses for Relationship fields when SQL clauses are disabled in the Pods security settings. Props to the CleanTalk / Dmitrii Ignatyev for responsibly reporting this. (@sc0ttkclark)
26+
* Security: Do not allow using custom SQL clauses for Relationship fields when SQL clauses are disabled in the Pods security settings. Props to the CleanTalk / Dmitrii Ignatyev for responsibly reporting this. (@sc0ttkclark)
827

928
= 3.2.8.1 - November 22nd, 2024 =
1029

@@ -108,7 +127,7 @@ To be safe and sure that those who are using Pods do not mistake Pods 3.2.3 as a
108127
* Fixed: PHP 8.1 compatibility fix for null values passed to esc_* functions in WP. (@sc0ttkclark)
109128
* Fixed: PHP 8.1 compatibility fix for html_entity_decode. (@sc0ttkclark)
110129

111-
= 3.2.0 - March 25th, 2024 =
130+
= 3.2 - March 25th, 2024 =
112131

113132
* Feature: New support for Custom Field revisions in Pods that are Post Types that use Meta storage. You can optionally enable the feature per-pod or per-field. #7265 (@sc0ttkclark)
114133
* Feature: New support for WordPress `register_meta()` for all Pods fields on meta-based Pods. You can enable this feature in Pods Admin > Settings > "Register meta fields". (@sc0ttkclark)

classes/Pods.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1174,6 +1174,9 @@ public function field( $name, $single = null, $raw = false ) {
11741174
$last_options = $current_field;
11751175
$last_object_options = $current_field;
11761176

1177+
// Don't fetch extra unnecessary data.
1178+
$ids = array_unique( $ids );
1179+
11771180
// Temporary hack until there's some better handling here.
11781181
$last_limit *= count( $ids );
11791182

classes/PodsAPI.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6552,10 +6552,10 @@ public function duplicate_pod( $params, $strict = false ) {
65526552

65536553
if ( 'post_type' === $pod['type'] ) {
65546554
// Max length for post types are 20 characters, so let's limit it to that minus the strlen of $try.
6555-
$check_name_limited = substr( $$check_name_limited, 0, 20 - strlen( (string) $try ) );
6555+
$check_name_limited = substr( $check_name_limited, 0, 20 - strlen( (string) $try ) );
65566556
} elseif ( 'taxonomy' === $pod['type'] ) {
65576557
// Max length for taxonomies are 32 characters, so let's limit it to that minus the strlen of $try.
6558-
$check_name_limited = substr( $$check_name_limited, 0, 32 - strlen( (string) $try ) );
6558+
$check_name_limited = substr( $check_name_limited, 0, 32 - strlen( (string) $try ) );
65596559
}
65606560

65616561
$check_name = $check_name_limited . $try;

classes/PodsAdmin.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2019,9 +2019,7 @@ public function admin_access_rights_review() {
20192019
*/
20202020
public function get_callouts() {
20212021
// Demo mode always bypasses callouts.
2022-
if ( pods_is_demo() ) {
2023-
return [];
2024-
}
2022+
$is_demo = pods_is_demo();
20252023

20262024
$force_callouts = 1 === (int) pods_v( 'pods_force_callouts' );
20272025

@@ -2035,9 +2033,10 @@ public function get_callouts() {
20352033

20362034
if ( ! $callouts ) {
20372035
$callouts = [
2038-
'friends_2024_docs' => 1,
2036+
'friends_2024_docs' => $is_demo ? 0 : 1,
20392037
'access_rights' => (
2040-
PodsInit::$version_last
2038+
! $is_demo
2039+
&& PodsInit::$version_last
20412040
&& version_compare( PodsInit::$version_last, '3.1.0-a-1', '<' )
20422041
) ? 1 : 0,
20432042
];
@@ -2046,8 +2045,8 @@ public function get_callouts() {
20462045
}
20472046

20482047
// Handle callouts logic.
2049-
$callouts['access_rights'] = ! isset( $callouts['access_rights'] ) || $callouts['access_rights'] ? 1 : 0;
2050-
$callouts['friends_2024_docs'] = ! isset( $callouts['friends_2024_docs'] ) || $callouts['friends_2024_docs'] || $force_callouts ? 1 : 0;
2048+
$callouts['access_rights'] = $callouts['access_rights'] ?? 0;
2049+
$callouts['friends_2024_docs'] = ( ! isset( $callouts['friends_2024_docs'] ) || $callouts['friends_2024_docs'] || $force_callouts ) ? 1 : 0;
20512050

20522051
/**
20532052
* Allow hooking into whether or not the specific callouts should show.

classes/PodsForm.php

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -228,21 +228,6 @@ public static function field( $name, $value, $type = 'text', $options = null, $p
228228
$value = apply_filters( "pods_form_ui_field_{$type}_value", $value, $name, $options, $pod, $id );
229229
$form_field_type = self::$field_type;
230230

231-
$helper = false;
232-
233-
$input_helper = pods_v( 'input_helper', $options );
234-
235-
/**
236-
* Input helpers are deprecated and not guaranteed to work properly.
237-
*
238-
* They will be entirely removed in Pods 3.0.
239-
*
240-
* @deprecated 2.7.0
241-
*/
242-
if ( is_string( $input_helper ) && 0 < strlen( $input_helper ) ) {
243-
$helper = pods_api()->load_helper( array( 'name' => $input_helper ) );
244-
}
245-
246231
if ( empty( $type ) ) {
247232
return;
248233
}
@@ -485,6 +470,8 @@ public static function attributes( $attributes, $name = null, $type = null, $opt
485470

486471
$attributes = (array) apply_filters( "pods_form_ui_field_{$type}_attributes", $attributes, $name, $options );
487472

473+
$final_attributes = [];
474+
488475
foreach ( $attributes as $attribute => $value ) {
489476
if ( null === $value ) {
490477
continue;
@@ -496,6 +483,16 @@ public static function attributes( $attributes, $name = null, $type = null, $opt
496483
$value = pods_enforce_safe_id( $value );
497484
}
498485

486+
$final_attributes[ (string) $attribute ] = (string) $value;
487+
}
488+
489+
if (pods_render_is_in_block()) {
490+
echo get_block_wrapper_attributes( $final_attributes );
491+
492+
return;
493+
}
494+
495+
foreach ( $final_attributes as $attribute => $value ) {
499496
echo ' ' . esc_attr( (string) $attribute ) . '="' . esc_attr( (string) $value ) . '"';
500497
}
501498
}

classes/PodsInit.php

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
<?php
22

33
use Pods\Config_Handler;
4-
use Pods\Static_Cache;
5-
use Pods\Whatsit\Pod;
4+
use Pods\Whatsit\Store;
65
use Pods\Wisdom_Tracker;
76

87
/**
@@ -216,7 +215,7 @@ public static function autoload_class( $class ) {
216215
);
217216

218217
if ( ! empty( $loader['exclude_prefix'] ) ) {
219-
$class = substr( $class, strlen( $loader['prefix'] ) );
218+
$class = substr( $class, strlen( (string) $loader['prefix'] ) );
220219
}
221220

222221
if ( ! empty( $loader['filter'] ) ) {
@@ -256,10 +255,6 @@ public function plugins_loaded() {
256255
define( 'PODS_TABLELESS', false );
257256
}
258257

259-
if ( ! defined( 'PODS_DISABLE_EVAL' ) ) {
260-
define( 'PODS_DISABLE_EVAL', true );
261-
}
262-
263258
if ( ! defined( 'PODS_STATS_TRACKING' ) || PODS_STATS_TRACKING ) {
264259
$this->stats_tracking( PODS_FILE, 'pods' );
265260
}
@@ -383,7 +378,7 @@ public function stats_tracking( $plugin_file, $plugin_slug ) {
383378
];
384379

385380
foreach ( $tlds_to_check as $tld ) {
386-
$minus_tld = strlen( $host ) - strlen( $tld );
381+
$minus_tld = strlen( (string) $host ) - strlen( (string) $tld );
387382

388383
if ( $minus_tld === strpos( $host, $tld ) ) {
389384
return true;
@@ -924,7 +919,7 @@ public function register_pods() {
924919
'delete_with_user' => false,
925920
);
926921

927-
$args = self::object_label_fix( $args, 'post_type' );
922+
$args = self::object_label_fix( $args, 'post_type', '_pods_pod' );
928923

929924
register_post_type( '_pods_pod', apply_filters( 'pods_internal_register_post_type_pod', $args ) );
930925

@@ -943,7 +938,7 @@ public function register_pods() {
943938
'delete_with_user' => false,
944939
);
945940

946-
$args = self::object_label_fix( $args, 'post_type' );
941+
$args = self::object_label_fix( $args, 'post_type', '_pods_group' );
947942

948943
register_post_type( '_pods_group', apply_filters( 'pods_internal_register_post_type_group', $args ) );
949944

@@ -962,7 +957,7 @@ public function register_pods() {
962957
'delete_with_user' => false,
963958
);
964959

965-
$args = self::object_label_fix( $args, 'post_type' );
960+
$args = self::object_label_fix( $args, 'post_type', '_pods_field' );
966961

967962
register_post_type( '_pods_field', apply_filters( 'pods_internal_register_post_type_field', $args ) );
968963

@@ -1631,7 +1626,7 @@ public function setup_content_types( $force = false ) {
16311626
$ct_post_types = $options['post_types'];
16321627
$options = $options['options'];
16331628

1634-
$options = self::object_label_fix( $options, 'taxonomy' );
1629+
$options = self::object_label_fix( $options, 'taxonomy', $taxonomy );
16351630

16361631
// Max length for taxonomies are 32 characters
16371632
$taxonomy = substr( $taxonomy, 0, 32 );
@@ -1688,7 +1683,7 @@ public function setup_content_types( $force = false ) {
16881683
continue;
16891684
}
16901685

1691-
$options = self::object_label_fix( $options, 'post_type' );
1686+
$options = self::object_label_fix( $options, 'post_type', $post_type );
16921687

16931688
// Max length for post types are 20 characters
16941689
$post_type = substr( $post_type, 0, 20 );
@@ -1942,7 +1937,7 @@ public function setup_updated_messages( $messages ) {
19421937
continue;
19431938
}
19441939

1945-
$labels = self::object_label_fix( $pods_cpt_ct['post_types'][ $post_type['name'] ], 'post_type' );
1940+
$labels = self::object_label_fix( $pods_cpt_ct['post_types'][ $post_type['name'] ], 'post_type', $post_type['name'] );
19461941
$labels = $labels['labels'];
19471942

19481943
$revision = (int) pods_v( 'revision' );
@@ -1991,20 +1986,31 @@ public function setup_updated_messages( $messages ) {
19911986
return $messages;
19921987
}
19931988

1994-
/**
1995-
* @param $args
1996-
* @param string $type
1997-
*
1998-
* @return array
1999-
*/
2000-
public static function object_label_fix( $args, $type = 'post_type' ) {
1989+
public static function object_label_fix( array $args, string $type, ?string $name = null ): array {
20011990

2002-
if ( empty( $args ) || ! is_array( $args ) ) {
2003-
$args = array();
1991+
if ( empty( $args ) ) {
1992+
$args = [];
20041993
}
20051994

20061995
if ( ! isset( $args['labels'] ) || ! is_array( $args['labels'] ) ) {
2007-
$args['labels'] = array();
1996+
$args['labels'] = [];
1997+
}
1998+
1999+
$is_placeholder_label = Store::PLACEHOLDER === pods_v( 'label', $args );
2000+
$is_placeholder_description = Store::PLACEHOLDER === pods_v( 'description', $args );
2001+
2002+
if ( $is_placeholder_label || $is_placeholder_description ) {
2003+
$default_object_labels = Store::get_default_object_labels();
2004+
2005+
if ( $name && isset( $default_object_labels[ $name ] ) ) {
2006+
if ( $is_placeholder_label ) {
2007+
$args['label'] = $default_object_labels[ $name ]['label'] ?? null;
2008+
}
2009+
2010+
if ( $is_placeholder_description ) {
2011+
$args['description'] = $default_object_labels[ $name ]['description'] ?? null;
2012+
}
2013+
}
20082014
}
20092015

20102016
$label = pods_v( 'name', $args['labels'], pods_v( 'label', $args, __( 'Items', 'pods' ), true ), true );

0 commit comments

Comments
 (0)