Skip to content

Commit

Permalink
Merge branch 'develop' into feature/lifterlms
Browse files Browse the repository at this point in the history
  • Loading branch information
zackkatz committed Mar 11, 2024
2 parents 7caa703 + 5468078 commit 472c8f1
Show file tree
Hide file tree
Showing 12 changed files with 215 additions and 227 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ anchors:
default_job_config: &default_job_config
working_directory: /home/circleci/plugin
machine:
image: ubuntu-2004:202201-02
image: default

test_job_config: &test_job_config
<<: *context
Expand Down
10 changes: 5 additions & 5 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 24 additions & 6 deletions future/includes/class-gv-view.php
Original file line number Diff line number Diff line change
Expand Up @@ -1450,7 +1450,20 @@ function () use ( $query ) {
private function run_db_query( GF_Query $query ) {
$db_entries = null;

$query_hash = md5( serialize( $query->_introspect() ) );
$query_introspect = $query->_introspect();

// Order keys are randomly generated, so we need to make them deterministic or else the query hash will change every time.
if ( isset( $query_introspect['order'] ) ) {
$order_hashes = [];

foreach ( $query_introspect['order'] as $order ) {
$order_hashes[] = md5( serialize( $order ) );
}

$query_introspect['order'] = $order_hashes;
}

$query_hash = md5( serialize( $query_introspect ) );

$atts = $this->settings->all();

Expand All @@ -1461,18 +1474,23 @@ private function run_db_query( GF_Query $query ) {
if ( $long_lived_cache->use_cache() ) {
$cached_entries = $long_lived_cache->get();

if ( $cached_entries ) {
if ( is_array( $cached_entries ) && array_key_exists( 'entries', $cached_entries ) && array_key_exists( 'total', $cached_entries ) ) {
$query->total_found = $cached_entries['total'];

return [
$cached_entries,
$cached_entries['entries'],
$query,
];
}

$db_entries = $query->get();
$cached_entries = [
'entries' => $query->get(),
'total' => $query->total_found,
];

if ( $long_lived_cache->set( $db_entries, 'entries' ) ) {
if ( $long_lived_cache->set( $cached_entries, 'entries' ) ) {
return [
$db_entries,
$cached_entries['entries'],
$query,
];
}
Expand Down
4 changes: 2 additions & 2 deletions gravityview.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: GravityView
* Plugin URI: https://www.gravitykit.com
* Description: The best, easiest way to display Gravity Forms entries on your website.
* Version: 2.20
* Version: 2.20.2
* Author: GravityKit
* Author URI: https://www.gravitykit.com
* Text Domain: gk-gravityview
Expand All @@ -27,7 +27,7 @@
/**
* The plugin version.
*/
define( 'GV_PLUGIN_VERSION', '2.20' );
define( 'GV_PLUGIN_VERSION', '2.20.2' );

/**
* Full path to the GravityView file
Expand Down
39 changes: 37 additions & 2 deletions includes/class-admin-welcome.php
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,36 @@ public function changelog_screen() {
* - If 4.28, include to 4.26.
*/
?>
<h3>2.20.2 on March 4, 2024</h3>

<p>This release enhances performance by optimizing caching and managing transients more effectively.</p>

<h4>✨ Improved</h4>

<ul>
<li>Enhanced detection of duplicate queries, resulting in fewer cache records stored in the database.</li>
</ul>

<h4>🔧 Updated</h4>

<p><a href="https://www.gravitykit.com/foundation/">Foundation</a> to version 1.2.10.</p>

<ul>
<li>Transients are no longer autoloaded.</li>
</ul>

<h3>2.20.1 on February 29, 2024</h3>

<p>This release fixes an issue with View caching and improves compatibility with the Advanced Custom Fields plugin.</p>

<h4>🐛 Fixed</h4>

<ul>
<li>Disappearing pagination and incorrect entry count when View caching is enabled.</li>
<li>Potential timeout issue when embedding GravityView shortcodes with Advanced Custom Fields plugin.</li>
<li>PHP 8.1+ deprecation notice.</li>
</ul>

<h3>2.20 on February 22, 2024</h3>

<p>This release introduces new settings for better control over View caching, adds support for the Advanced Post Creation Add-On when editing entries, fixes a fatal error when exporting entries to CSV, and updates internal components for better performance and compatibility.</p>
Expand All @@ -321,7 +351,7 @@ public function changelog_screen() {

<h4>🔧 Updated</h4>

<p><a href="https://www.gravitykit.com/foundation/">Foundation</a> to versions 1.2.9.</p>
<p><a href="https://www.gravitykit.com/foundation/">Foundation</a> to version 1.2.9.</p>

<ul>
<li>GravityKit products that are already installed can now be activated without a valid license.</li>
Expand Down Expand Up @@ -595,7 +625,12 @@ public function welcome() {

// Bail if no activation redirect
if ( ! get_transient( '_gv_activation_redirect' ) ) {
return; }
return;
}

if ( ( $_GET['page'] ?? '' ) === GravityKit\GravityView\Foundation\Licenses\Framework::ID ) {
return;
}

// Delete the redirect transient
delete_transient( '_gv_activation_redirect' );
Expand Down
4 changes: 2 additions & 2 deletions includes/class-gravityview-image.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ public static function get_image_extensions() {
/**
* tag.
*
* @param array $image_exts Default: `['jpg', 'jpeg', 'jpe', 'gif', 'png', 'bmp', 'tif', 'tiff', 'ico', 'webp']`
* @param array $image_exts Default: `['jpg', 'jpeg', 'jpe', 'gif', 'png', 'bmp', 'tif', 'tiff', 'ico', 'webp', 'svg']`
*/
$image_exts = apply_filters( 'gravityview_image_extensions', array( 'jpg', 'jpeg', 'jpe', 'gif', 'png', 'bmp', 'tif', 'tiff', 'ico', 'webp' ) );
$image_exts = apply_filters( 'gravityview_image_extensions', array( 'jpg', 'jpeg', 'jpe', 'gif', 'png', 'bmp', 'tif', 'tiff', 'ico', 'webp', 'svg' ) );

return (array) $image_exts;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ public static function display_note( $note, $show_delete = false, $context = nul
}

foreach ( $note_content as $tag => $value ) {
$note_detail_html = str_replace( '{' . $tag . '}', $value, $note_detail_html );
$note_detail_html = str_replace( '{' . $tag . '}', $value ?? '', $note_detail_html );
}

$replacements = array(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,12 @@ public function fileupload_link_atts( $link_atts, $field_compat = array(), $cont
$file_path = \GV\Utils::get( $additional_details, 'file_path', '' );

/**
* For file types that require IFRAME, declare `pdf` media type.
* For file types that require iframe (e.g., PDFs, text files), declare `pdf` media type.
* SVGs are not supported by Fancybox by default but render fine inside an iframe.
*
* @see https://fancyapps.com/docs/ui/fancybox#media-types
* @see https://web.archive.org/web/20230221135246/https://fancyapps.com/docs/ui/fancybox/#media-types
*/
if ( false !== strpos( $file_path, 'gv-iframe' ) ) {
if ( false !== strpos( $file_path, 'gv-iframe' ) || preg_match( '/\.svg$/i', $file_path ) ) {
$link_atts['data-type'] = 'pdf';
}

Expand Down
3 changes: 1 addition & 2 deletions includes/fields/class-gravityview-field-fileupload.php
Original file line number Diff line number Diff line change
Expand Up @@ -347,13 +347,12 @@ static function get_files_array( $value, $gv_class, $context = null ) {
unset( $gv_entry );

if ( $lightbox && empty( $field_settings['show_as_link'] ) ) {

$lightbox_link_atts = array(
'rel' => sprintf( '%s-%s', $gv_class, $entry_slug ),
'class' => '',
);

$lightbox_link_atts = apply_filters( 'gravityview/fields/fileupload/link_atts', $lightbox_link_atts, $field_compat, $context );
$lightbox_link_atts = apply_filters( 'gravityview/fields/fileupload/link_atts', $lightbox_link_atts, $field_compat, $context, compact( 'file_path', 'insecure_file_path', 'disable_lightbox' ) );

$rendered = gravityview_get_link( $file_path, $image->html(), $lightbox_link_atts );
} else {
Expand Down
32 changes: 24 additions & 8 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,43 @@ Beautifully display your Gravity Forms entries. Learn more on [gravitykit.com](h

== Changelog ==

= develop =
= 2.20.2 on March 4, 2024 =

* Fixed: Possible recursion timeout using GravityView shortcodes in "Advanced Custom Fields"-fields.
This release enhances performance by optimizing caching and managing transients more effectively.

#### ✨ Improved
* Enhanced detection of duplicate queries, resulting in fewer cache records stored in the database.

#### 🔧 Updated
* Updated [Foundation](https://www.gravitykit.com/foundation/) to version 1.2.10.
- Transients are no longer autoloaded.

= 2.20.1 on February 29, 2024 =

This release fixes an issue with View caching and improves compatibility with the Advanced Custom Fields plugin.

#### 🐛 Fixed
* Disappearing pagination and incorrect entry count when View caching is enabled.
* Potential timeout issue when embedding GravityView shortcodes with Advanced Custom Fields plugin.
* PHP 8.1+ deprecation notice.

= 2.20 on February 22, 2024 =

This release introduces new settings for better control over View caching, adds support for the Advanced Post Creation Add-On when editing entries, fixes a fatal error when exporting entries to CSV, and updates internal components for better performance and compatibility.

#### 🚀 Added
- Global and View-specific settings to control caching of View entries. [Learn more about GravityView caching](https://docs.gravitykit.com/article/58-about-gravityview-caching).
- Support for the [Advanced Post Creation Add-On](https://www.gravityforms.com/add-ons/advanced-post-creation/) when editing entries in GravityView's Edit Entry mode.
* Global and View-specific settings to control caching of View entries. [Learn more about GravityView caching](https://docs.gravitykit.com/article/58-about-gravityview-caching).
* Support for the [Advanced Post Creation Add-On](https://www.gravityforms.com/add-ons/advanced-post-creation/) when editing entries in GravityView's Edit Entry mode.

#### ✨ Improved
- If Gravity Forms is not installed and/or activated, a notice is displayed to alert users when creating new or listing existing Views.
* If Gravity Forms is not installed and/or activated, a notice is displayed to alert users when creating new or listing existing Views.

#### 🐛 Fixed
- Deprecation notice in PHP 8.1+ when displaying a View with file upload fields.
- Fatal error when exporting entries to CSV.
* Deprecation notice in PHP 8.1+ when displaying a View with file upload fields.
* Fatal error when exporting entries to CSV.

#### 🔧 Updated
* [Foundation](https://www.gravitykit.com/foundation/) to versions 1.2.9.
* [Foundation](https://www.gravitykit.com/foundation/) to version 1.2.9.
- GravityKit products that are already installed can now be activated without a valid license.
- Fixed PHP warning messages that appeared when deactivating the last active product with Foundation installed.

Expand Down
1 change: 1 addition & 0 deletions tests/unit-tests/GravityView_20_Issues.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ public function test_search_widget_embedded() {
* @since 2.0.6.2
*/
function test_gv_age_shortcode() {
$this->markTestSkipped('Flaky test; temporarily disable');

add_shortcode( 'gv_age_1_x', array( $this, '_gv_age_1_x_shortcode' ) );
add_shortcode( 'gv_age_2_0', array( $this, '_gv_age_2_0_shortcode' ) );
Expand Down
Loading

0 comments on commit 472c8f1

Please sign in to comment.