Skip to content

Commit

Permalink
Release 2.3.3 (#202)
Browse files Browse the repository at this point in the history
* Fix plugin icon color
* Add force download hook
---------

Co-authored-by: Zack Katz <[email protected]>
Co-authored-by: Vlad <[email protected]>
  • Loading branch information
3 people authored Oct 29, 2024
1 parent 714d36a commit 1a5e195
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 8 deletions.
4 changes: 2 additions & 2 deletions gfexcel.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* Plugin Name: GravityExport Lite
* Version: 2.3.2
* Version: 2.3.3
* Plugin URI: https://gfexcel.com
* Description: Export all Gravity Forms entries to Excel (.xlsx) or CSV via a secret shareable URL.
* Author: GravityKit
Expand All @@ -28,7 +28,7 @@
}

if ( ! defined( 'GFEXCEL_PLUGIN_VERSION' ) ) {
define( 'GFEXCEL_PLUGIN_VERSION', '2.3.2' );
define( 'GFEXCEL_PLUGIN_VERSION', '2.3.3' );
}

if ( ! defined( 'GFEXCEL_MIN_PHP_VERSION' ) ) {
Expand Down
8 changes: 6 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ Donate link: https://www.gravitykit.com/extensions/gravityexport/?utm_source=plu
Tags: Gravity Forms, GravityForms, Excel, Export, Entries
Requires at least: 4.0
Requires PHP: 7.2
Tested up to: 6.6.2
Stable tag: 2.3.2
Tested up to: 6.7
Stable tag: 2.3.3
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -256,6 +256,10 @@ You can hide a row by adding a hook. Checkout this example:

== Changelog ==

= 2.3.3 on October 29, 2024 =

* Enhancement: Added a `gfexcel_field_fileuploads_force_download` filter to control whether file upload links open in the browser or download directly.

= 2.3.2 on October 14, 2024 =

* Fixed: Added compatibility for servers that miss the `iconv` or `mbstring` PHP extension.
Expand Down
2 changes: 1 addition & 1 deletion src/Addon/GravityExportAddon.php
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ public function feed_settings_fields(): array {
* @since 2.0.0
*/
public function get_menu_icon(): string {
return '<svg style="height: 24px; width: 37px;" enable-background="new 0 0 226 148" height="148" viewBox="0 0 226 148" width="226" xmlns="http://www.w3.org/2000/svg"><path d="m176.8 118.8c-1.6 1.6-4.1 1.6-5.7 0l-5.7-5.7c-1.6-1.6-1.6-4.1 0-5.7l27.6-27.4h-49.2c-4.3 39.6-40 68.2-79.6 63.9s-68.2-40-63.9-79.6 40.1-68.2 79.7-63.9c25.9 2.8 48.3 19.5 58.5 43.5.6 1.5-.1 3.3-1.7 3.9-.4.1-.7.2-1.1.2h-9.9c-1.9 0-3.6-1.1-4.4-2.7-14.7-27.1-48.7-37.1-75.8-22.4s-37.2 48.8-22.4 75.9 48.8 37.2 75.9 22.4c15.5-8.4 26.1-23.7 28.6-41.2h-59.4c-2.2 0-4-1.8-4-4v-8c0-2.2 1.8-4 4-4h124.7l-27.5-27.5c-1.6-1.6-1.6-4.1 0-5.7l5.7-5.7c1.6-1.6 4.1-1.6 5.7 0l41.1 41.2c3.1 3.1 3.1 8.2 0 11.3z"/></svg>';
return '<svg style="height: 24px; width: 37px;" fill="currentColor" enable-background="new 0 0 226 148" height="148" viewBox="0 0 226 148" width="226" xmlns="http://www.w3.org/2000/svg"><path d="m176.8 118.8c-1.6 1.6-4.1 1.6-5.7 0l-5.7-5.7c-1.6-1.6-1.6-4.1 0-5.7l27.6-27.4h-49.2c-4.3 39.6-40 68.2-79.6 63.9s-68.2-40-63.9-79.6 40.1-68.2 79.7-63.9c25.9 2.8 48.3 19.5 58.5 43.5.6 1.5-.1 3.3-1.7 3.9-.4.1-.7.2-1.1.2h-9.9c-1.9 0-3.6-1.1-4.4-2.7-14.7-27.1-48.7-37.1-75.8-22.4s-37.2 48.8-22.4 75.9 48.8 37.2 75.9 22.4c15.5-8.4 26.1-23.7 28.6-41.2h-59.4c-2.2 0-4-1.8-4-4v-8c0-2.2 1.8-4 4-4h124.7l-27.5-27.5c-1.6-1.6-1.6-4.1 0-5.7l5.7-5.7c1.6-1.6 4.1-1.6 5.7 0l41.1 41.2c3.1 3.1 3.1 8.2 0 11.3z"/></svg>';
}

/**
Expand Down
26 changes: 23 additions & 3 deletions src/Field/FileUploadField.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

/**
* Class FileUploadField
*
* @since 1.1.0
*/
class FileUploadField extends BaseField implements RowsInterface {
Expand Down Expand Up @@ -51,7 +52,6 @@ public function getColumns() {
* @return bool Whether the uploads should be shown as a column.
*/
private function showFileUploadsAsColumn() {

// The default value of `true` will not be returned by get_plugin_setting(); it will return null by default.
// So we apply the ?? operator and return true as the default value.
$fileuploads_enabled = GravityExportAddon::get_instance()->get_plugin_setting( 'fileuploads_enabled' ) ?? true;
Expand Down Expand Up @@ -80,7 +80,9 @@ public function getRows( ?array $entry = null ): iterable {
}

foreach ( $files as $file ) {
yield $this->wrap( [ $this->field->get_download_url( $file, true ) ] );
yield $this->wrap( [
$this->field->get_download_url( $file, $this->should_force_download() ),
] );
}
}
} else {
Expand All @@ -98,6 +100,24 @@ protected function getFieldValue( $entry, $input_id = '' ) {
return $value;
}

return $this->field->get_download_url( $value, true );
return $this->field->get_download_url( $value, $this->should_force_download() );
}

/**
* Returns whether to force a download URL.
*
* @since 2.3.3
*
* @return bool Whether to force a download URL.
*/
private function should_force_download(): bool {
return (bool) gf_apply_filters(
[
'gfexcel_field_fileuploads_force_download',
$this->field->formId,
],
true,
$this->field
);
}
}

0 comments on commit 1a5e195

Please sign in to comment.