Skip to content

Commit

Permalink
Merge pull request #7208 from pods-framework/release/3.0.9
Browse files Browse the repository at this point in the history
  • Loading branch information
sc0ttkclark authored Dec 7, 2023
2 parents 4e6e588 + 02c114b commit fa97b01
Show file tree
Hide file tree
Showing 26 changed files with 636 additions and 1,760 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/wporg-replace.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@ on:
description: 'Minimum PHP version'
required: false
jobs:
prepare_release:
wporg_replace:
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout@v4
- name: What are we doing?
run: |
echo plugin_version: ${{ github.event.inputs.plugin_version }}
echo tested_wp_version: ${{ github.event.inputs.tested_wp_version }}
echo minimum_wp_version: ${{ github.event.inputs.minimum_wp_version }}
echo minimum_php_version: ${{ github.event.inputs.minimum_php_version }}
- name: Checkout the code
uses: actions/checkout@v4
- name: Run wporg-replace
uses: sc0ttkclark/[email protected].0
uses: sc0ttkclark/[email protected].6
with:
plugin_version: ${{ github.event.inputs.plugin_version }}
plugin_version_constant_name: ${{ env.WPORG_PLUGIN_VERSION_CONSTANT_NAME }}
Expand Down
60 changes: 0 additions & 60 deletions Gruntfile.js

This file was deleted.

9 changes: 9 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@ 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.0.9 - December 7th, 2023 =

* Feature: Added support for disabling Quick Edit for custom post types for sites on WP 6.4+. (@sc0ttkclark)
* Tweak: Revamped the Pods Blocks error handling so it looks nicer. (@sc0ttkclark)
* Tweak: Updated the default values used for "Add New" labels to use "Add New {singularLabel}" instead to follow WP core's direction. (@sc0ttkclark)
* Fixed: Custom capability types now save as empty and remain empty as intended. When empty, they will default to the current post type name and a placeholder shows what that would be. #7218 (@sc0ttkclark)
* Fixed: Added more handling for SQL errors for Pods Blocks. #7207 (@sc0ttkclark)
* Fixed: Resolved WP debug notices when calling `wp_cache_flush_group` by checking if `wp_wp_cache_supports( 'flush_group' )` first. (@sc0ttkclark)

= 3.0.8 - October 20th, 2023 =

* Fixed: Resolved the hooked var handling for pre-save hooks in PodsAPI::save_pod_item() that was broken in Pods 3.0. #5532 #7195 (@sc0ttkclark, @olivierguerriat, @HmCody)
Expand Down
23 changes: 18 additions & 5 deletions classes/PodsAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -5464,7 +5464,11 @@ public function save_pod_item( $params ) {
|| $save_non_simple_to_table
)
) {
$value_data = $this->prepare_tableless_data_for_save( $pod, $field_data, $value, compact( $pieces ) );
try {
$value_data = $this->prepare_tableless_data_for_save( $pod, $field_data, $value, compact( $pieces ) );
} catch ( Throwable $throwable ) {
return pods_error( $throwable->getMessage(), $error_mode );
}
}

// Prepare all table / meta data.
Expand Down Expand Up @@ -5991,10 +5995,19 @@ public function prepare_tableless_data_for_save( $pod, $field, $values, $pieces
if ( empty( $v ) ) {
try {
$v = pods_attachment_import( $v );
} catch ( Exception $exception ) {
pods_debug_log( $exception );

continue;
} catch ( Throwable $throwable ) {
pods_debug_log( $throwable );

throw new Exception(
sprintf(
// translators: %1$s is the field label, %2$s is the file value.
__( 'Pods file field error for field "%1$s" - Unable to import file from: %2$s', 'pods' ),
esc_html( $field->get_label() ),
esc_html( $v )
),
500,
$throwable
);
}
}
} elseif ( $search_data ) {
Expand Down
6 changes: 3 additions & 3 deletions classes/PodsAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ public function admin_menu() {
if ( 'edit' === pods_v( 'action', 'get', 'manage' ) ) {
$all_title = pods_v( 'label_edit_item', $pod['options'], __( 'Edit', 'pods' ) . ' ' . $singular_label );
} elseif ( 'add' === pods_v( 'action', 'get', 'manage' ) ) {
$all_title = pods_v( 'label_add_new_item', $pod['options'], __( 'Add New', 'pods' ) . ' ' . $singular_label );
$all_title = pods_v( 'label_add_new_item', $pod['options'], sprintf( __( 'Add New %s', 'pods' ), $singular_label ) );
}
}

Expand All @@ -307,8 +307,8 @@ public function admin_menu() {
add_menu_page( $page_title, $menu_label, 'read', $parent_page, '', $menu_icon, $menu_position );
}

$add_title = pods_v( 'label_add_new_item', $pod['options'], __( 'Add New', 'pods' ) . ' ' . $singular_label );
$add_label = pods_v( 'label_add_new', $pod['options'], __( 'Add New', 'pods' ) );
$add_title = pods_v( 'label_add_new_item', $pod['options'], sprintf( __( 'Add New %s', 'pods' ), $singular_label ) );
$add_label = pods_v( 'label_add_new', $pod['options'], sprintf( __( 'Add New %s', 'pods' ), $singular_label ) );

add_submenu_page(
$parent_page, $add_title, $add_label, 'read', $page, array(
Expand Down
2 changes: 1 addition & 1 deletion classes/PodsData.php
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@ public function select( $params ) {

// Cache if enabled.
if ( false !== $cache_key ) {
pods_view_set( $cache_key, $results, pods_v( 'expires', $params, 0, false ), pods_v( 'cache_mode', $params, 'cache', true ), 'pods_data_select' );
pods_view_set( $cache_key, $results, (int) pods_v( 'expires', $params, 0, false ), pods_v( 'cache_mode', $params, 'cache', true ), 'pods_data_select' );
}
}//end if

Expand Down
51 changes: 50 additions & 1 deletion classes/PodsInit.php
Original file line number Diff line number Diff line change
Expand Up @@ -1167,6 +1167,7 @@ public function setup_content_types( $force = false ) {
'revisions' => (boolean) pods_v( 'supports_revisions', $post_type, false ),
'page-attributes' => (boolean) pods_v( 'supports_page_attributes', $post_type, false ),
'post-formats' => (boolean) pods_v( 'supports_post_formats', $post_type, false ),
'quick-edit' => (boolean) pods_v( 'supports_quick_edit', $post_type, true ),
);

// Custom Supported
Expand Down Expand Up @@ -1811,6 +1812,50 @@ public function setup_content_types( $force = false ) {
}
}

/**
* Filter whether Quick Edit should be enabled for the given post type.
*
* @since TBD
*
* @param bool $enable Whether to enable the Quick Edit functionality.
* @param string $post_type The post type name.
*
* @return bool Whether to enable the Quick Edit functionality.
*/
public function quick_edit_enabled_for_post_type( bool $enable, string $post_type ) {
if ( ! $enable ) {
return $enable;
}

if ( ! isset( PodsMeta::$post_types[ $post_type ] ) ) {
return $enable;
}

return (boolean) pods_v( 'supports_quick_edit', PodsMeta::$post_types[ $post_type ], true );
}

/**
* Filter whether Quick Edit should be enabled for the given taxonomy.
*
* @since TBD
*
* @param bool $enable Whether to enable the Quick Edit functionality.
* @param string $taxonomy The taxonomy name.
*
* @return bool Whether to enable the Quick Edit functionality.
*/
public function quick_edit_enabled_for_taxonomy( bool $enable, string $taxonomy ) {
if ( ! $enable ) {
return $enable;
}

if ( ! isset( PodsMeta::$taxonomies[ $taxonomy ] ) ) {
return $enable;
}

return (boolean) pods_v( 'supports_quick_edit', PodsMeta::$taxonomies[ $taxonomy ], true );
}

/**
* Check if we need to flush WordPress rewrite rules
* This gets run during 'init' action late in the game to give other plugins time to register their rewrite rules
Expand Down Expand Up @@ -1947,7 +1992,7 @@ public static function object_label_fix( $args, $type = 'post_type' ) {
if ( 'post_type' === $type ) {
$labels['menu_name'] = strip_tags( pods_v( 'menu_name', $labels, $label, true ) );
$labels['name_admin_bar'] = pods_v( 'name_admin_bar', $labels, $singular_label, true );
$labels['add_new'] = pods_v( 'add_new', $labels, __( 'Add New', 'pods' ), true );
$labels['add_new'] = pods_v( 'add_new', $labels, sprintf( __( 'Add New %s', 'pods' ), $singular_label ), true );
$labels['add_new_item'] = pods_v( 'add_new_item', $labels, sprintf( __( 'Add New %s', 'pods' ), $singular_label ), true );
$labels['new_item'] = pods_v( 'new_item', $labels, sprintf( __( 'New %s', 'pods' ), $singular_label ), true );
$labels['edit'] = pods_v( 'edit', $labels, __( 'Edit', 'pods' ), true );
Expand Down Expand Up @@ -2439,6 +2484,10 @@ public function run() {
// Compatibility for Query Monitor conditionals
add_filter( 'query_monitor_conditionals', array( $this, 'filter_query_monitor_conditionals' ) );

// Support for quick edit in WP 6.4+.
add_filter( 'quick_edit_enabled_for_post_type', [ $this, 'quick_edit_enabled_for_post_type' ], 10, 2 );
add_filter( 'quick_edit_enabled_for_taxonomy', [ $this, 'quick_edit_enabled_for_taxonomy' ], 10, 2 );

require_once PODS_DIR . 'includes/compatibility.php';
}

Expand Down
4 changes: 2 additions & 2 deletions classes/PodsUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,7 @@ public function setup( $options ) {
$options->validate(
'heading', array(
'manage' => pods_v( 'label_manage', $this->label, __( 'Manage', 'pods' ) ),
'add' => pods_v( 'label_add_new', $this->label, __( 'Add New', 'pods' ) ),
'add' => pods_v( 'label_add_new', $this->label, sprintf( __( 'Add New %s', 'pods' ), $options->item ) ),
'edit' => pods_v( 'label_edit', $this->label, __( 'Edit', 'pods' ) ),
'duplicate' => pods_v( 'label_duplicate', $this->label, __( 'Duplicate', 'pods' ) ),
'view' => pods_v( 'label_view', $this->label, __( 'View', 'pods' ) ),
Expand All @@ -769,7 +769,7 @@ public function setup( $options ) {
$options->validate(
'label', array(
'add' => pods_v( 'label_add_new_item', $this->label, sprintf( __( 'Add New %s', 'pods' ), $options->item ) ),
'add_new' => pods_v( 'label_add_new', $this->label, __( 'Add New', 'pods' ) ),
'add_new' => pods_v( 'label_add_new', $this->label, sprintf( __( 'Add New %s', 'pods' ), $options->item ) ),
'edit' => pods_v( 'label_update_item', $this->label, sprintf( __( 'Update %s', 'pods' ), $options->item ) ),
'duplicate' => pods_v( 'label_duplicate_item', $this->label, sprintf( __( 'Duplicate %s', 'pods' ), $options->item ) ),
'delete' => pods_v( 'label_delete_item', $this->label, sprintf( __( 'Delete this %s', 'pods' ), $options->item ) ),
Expand Down
6 changes: 3 additions & 3 deletions classes/PodsView.php
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ public static function clear( $key = true, $cache_mode = null, $group = '' ) {
$wpdb->query( "DELETE FROM `{$wpdb->options}` WHERE option_name LIKE '_transient_{$group_key}%'" );

if ( $object_cache_enabled ) {
if ( $group && function_exists( 'wp_cache_flush_group' ) ) {
if ( $group && function_exists( 'wp_cache_flush_group' ) && wp_cache_supports( 'flush_group' ) ) {
wp_cache_flush_group( $group );
} else {
wp_cache_flush();
Expand All @@ -618,7 +618,7 @@ public static function clear( $key = true, $cache_mode = null, $group = '' ) {
$wpdb->query( "DELETE FROM `{$wpdb->options}` WHERE option_name LIKE '_site_transient_{$group_key}%'" );

if ( $object_cache_enabled ) {
if ( $group && function_exists( 'wp_cache_flush_group' ) ) {
if ( $group && function_exists( 'wp_cache_flush_group' ) && wp_cache_supports( 'flush_group' ) ) {
wp_cache_flush_group( $group );
} else {
wp_cache_flush();
Expand All @@ -633,7 +633,7 @@ public static function clear( $key = true, $cache_mode = null, $group = '' ) {
}
} elseif ( 'cache' === $cache_mode && $object_cache_enabled ) {
if ( true === $key ) {
if ( $group && function_exists( 'wp_cache_flush_group' ) ) {
if ( $group && function_exists( 'wp_cache_flush_group' ) && wp_cache_supports( 'flush_group' ) ) {
wp_cache_flush_group( $group );

self::reset_cached_keys( $cache_mode, $group );
Expand Down
19 changes: 16 additions & 3 deletions includes/general.php
Original file line number Diff line number Diff line change
Expand Up @@ -1337,21 +1337,34 @@ function pods_shortcode( $tags, $content = null ) {

try {
$return = pods_shortcode_run( $tags, $content );
} catch ( Exception $exception ) {
} catch ( Throwable $throwable ) {
/**
* Allow filtering whether to throw errors for the shortcode.
*
* @since 3.0.9
*
* @param bool $throw_errors Whether to throw errors for the shortcode.
*/
$throw_errors = apply_filters( 'pods_shortcode_throw_errors', false );

if ( $throw_errors ) {
throw $throwable;
}

$return = '';

if ( pods_is_debug_display() ) {
$return = pods_message(
sprintf(
'<strong>%1$s:</strong> %2$s',
esc_html__( 'Pods Renderer Error', 'pods' ),
esc_html( $exception->getMessage() )
esc_html( $throwable->getMessage() )
),
'error',
true
);

$return .= '<pre style="overflow:scroll">' . esc_html( $exception->getTraceAsString() ) . '</pre>';
$return .= '<pre style="overflow:scroll">' . esc_html( $throwable->getTraceAsString() ) . '</pre>';
} elseif (
is_user_logged_in()
&& (
Expand Down
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.0.8
* Version: 3.0.9
* 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.0.8' );
define( 'PODS_VERSION', '3.0.9' );

// 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 fa97b01

Please sign in to comment.