Skip to content

Commit

Permalink
Merge pull request #7267 from pods-framework/release/3.1.4
Browse files Browse the repository at this point in the history
  • Loading branch information
sc0ttkclark committed Feb 28, 2024
2 parents 5d047cc + 7ea9598 commit a45cf6f
Show file tree
Hide file tree
Showing 23 changed files with 379 additions and 431 deletions.
6 changes: 6 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ Found a bug? Have a great feature idea? Get on GitHub and tell us about it and w

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

= 3.1.4 - February 28th, 2024 =

* Fixed: Defaults now show correctly for checkbox groups in the Edit Field modals. (@sc0ttkclark)
* Fixed: Resolve potential PHP errors with cached configs in Collections classes that has been there since Pods 2.x. (@sc0ttkclark)
* Fixed: Revisited due to our automated NPM build issue - Resolved an issue with CodeMirror 6.x fields in forms (this is separate from the version 5.x that the Pods Template editor uses). (@sc0ttkclark)

= 3.1.3 - February 27th, 2024 =

* Fixed: Resolved an issue with CodeMirror 6.x fields in forms (this is separate from the version 5.x that the Pods Template editor uses). (@sc0ttkclark)
Expand Down
2 changes: 1 addition & 1 deletion classes/PodsField.php
Original file line number Diff line number Diff line change
Expand Up @@ -937,7 +937,7 @@ public function strip_html( $value, $options = null ) {
*/
public function maybe_sanitize_output( $value, $options = null ) {
// Maybe check for a sanitize output option.
$should_sanitize = null === $options || 1 === (int) pods_v( static::$type . '_output', $options, 1 );
$should_sanitize = null === $options || 1 === (int) pods_v( static::$type . '_sanitize_html', $options, 0 );

/**
* Allow filtering whether to sanitize the field value before output.
Expand Down
2 changes: 1 addition & 1 deletion classes/fields/code.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function options() {
'default' => 0,
'type' => 'boolean',
],
static::$type . '_output' => [
static::$type . '_sanitize_html' => [
'label' => __( 'Sanitize HTML', 'pods' ),
'default' => 1,
'help' => __( 'This sanitizes things like script tags and other content not normally allowed in WordPress content. Disable this only if you trust users who will have access to enter content into this field.', 'pods' ),
Expand Down
2 changes: 1 addition & 1 deletion classes/fields/heading.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function options() {
'type' => 'boolean',
'dependency' => true,
],
static::$type . '_output' => [
static::$type . '_sanitize_html' => [
'label' => __( 'Sanitize HTML', 'pods' ),
'default' => 1,
'help' => __( 'This sanitizes things like script tags and other content not normally allowed in WordPress content. Disable this only if you trust users who will have access to enter content into this field.', 'pods' ),
Expand Down
2 changes: 1 addition & 1 deletion classes/fields/paragraph.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function options() {
'type' => 'boolean',
'dependency' => true,
],
static::$type . '_output' => [
static::$type . '_sanitize_html' => [
'label' => __( 'Sanitize HTML', 'pods' ),
'default' => 1,
'help' => __( 'This sanitizes things like script tags and other content not normally allowed in WordPress content. Disable this only if you trust users who will have access to enter content into this field.', 'pods' ),
Expand Down
2 changes: 1 addition & 1 deletion classes/fields/text.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function options() {
'type' => 'boolean',
'dependency' => true,
],
static::$type . '_output' => [
static::$type . '_sanitize_html' => [
'label' => __( 'Sanitize HTML', 'pods' ),
'default' => 1,
'help' => __( 'This sanitizes things like script tags and other content not normally allowed in WordPress content. Disable this only if you trust users who will have access to enter content into this field.', 'pods' ),
Expand Down
2 changes: 1 addition & 1 deletion classes/fields/wysiwyg.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public function options() {
'default' => 0,
'type' => 'boolean',
],
static::$type . '_output' => [
static::$type . '_sanitize_html' => [
'label' => __( 'Sanitize HTML', 'pods' ),
'default' => 1,
'help' => __( 'This sanitizes things like script tags and other content not normally allowed in WordPress content. Disable this only if you trust users who will have access to enter content into this field.', 'pods' ),
Expand Down
38 changes: 38 additions & 0 deletions includes/data.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* @package Pods\Global\Functions\Data
*/

use Pods\Whatsit;
use Pods\Whatsit\Field;

/**
Expand Down Expand Up @@ -2960,3 +2961,40 @@ function pods_kses_exclude_p( $content ) {
]
);
}

/**
* Key the list of objects by name.
*
* @since 3.1.4
*
* @param array<int|string, Whatsit|stdClass|WP_Post> $objects The list of objects.
*
* @return array<string, Whatsit|stdClass|WP_Post> The list objects keyed by name.
*/
function pods_objects_keyed_by_name( $objects ) {
$new_list = [];

$objects = array_filter( $objects );

$names = wp_list_pluck( $objects, 'name' );

if ( count( $names ) === count( $objects ) ) {
$new_list = array_combine( $names, $objects );
} else {
foreach ( $objects as $object ) {
if ( $object instanceof Whatsit ) {
$name = $object->get_name();
} elseif ( $object instanceof WP_Post ) {
$name = $object->post_name;
} elseif ( is_object( $object ) && isset( $object->name ) ) {
$name = $object->name;
} else {
continue;
}

$new_list[ $name ] = $object;
}
}

return $new_list;
}
4 changes: 2 additions & 2 deletions init.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* Plugin Name: Pods - Custom Content Types and Fields
* Plugin URI: https://pods.io/
* Description: Pods is a framework for creating, managing, and deploying customized content types and fields
* Version: 3.1.3
* Version: 3.1.4
* Author: Pods Framework Team
* Author URI: https://pods.io/about/
* Text Domain: pods
Expand Down Expand Up @@ -43,7 +43,7 @@
add_action( 'init', 'pods_deactivate_pods_ui' );
} else {
// Current version.
define( 'PODS_VERSION', '3.1.3' );
define( 'PODS_VERSION', '3.1.4' );

// Current database version, this is the last version the database changed.
define( 'PODS_DB_VERSION', '2.3.5' );
Expand Down
Loading

0 comments on commit a45cf6f

Please sign in to comment.