Skip to content

Commit

Permalink
Merge pull request #1688 from gravityview/develop
Browse files Browse the repository at this point in the history
Release 2.14.2
  • Loading branch information
mrcasual authored Mar 11, 2022
2 parents 5012de8 + 8599dcd commit f757b18
Show file tree
Hide file tree
Showing 6,117 changed files with 467 additions and 723,602 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
79 changes: 1 addition & 78 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ jobs:
name: Installing build dependencies
command: |
/home/circleci/tooling/build-tools/build_tools.sh npm -o install
/home/circleci/tooling/build-tools/build_tools.sh composer -o install
- run:
name: Configuring tests environment
command: |
Expand All @@ -60,26 +61,6 @@ jobs:
paths:
- .

run_php_54_unit_tests:
<<: *default_job_config
steps:
- attach_workspace:
at: /home/circleci
- run:
name: Running PHP 5.4 unit tests
command: |
/home/circleci/tooling/docker-unit-tests/docker-unit-tests.sh test_54
run_php_55_unit_tests:
<<: *default_job_config
steps:
- attach_workspace:
at: /home/circleci
- run:
name: Running PHP 5.5 unit tests
command: |
/home/circleci/tooling/docker-unit-tests/docker-unit-tests.sh test_55
run_php_56_unit_tests:
<<: *default_job_config
steps:
Expand All @@ -90,46 +71,6 @@ jobs:
command: |
/home/circleci/tooling/docker-unit-tests/docker-unit-tests.sh test_56
run_php_70_unit_tests:
<<: *default_job_config
steps:
- attach_workspace:
at: /home/circleci
- run:
name: Running PHP 7.0 unit tests
command: |
/home/circleci/tooling/docker-unit-tests/docker-unit-tests.sh test_70
run_php_71_unit_tests:
<<: *default_job_config
steps:
- attach_workspace:
at: /home/circleci
- run:
name: Running PHP 7.1 unit tests
command: |
/home/circleci/tooling/docker-unit-tests/docker-unit-tests.sh test_71
run_php_72_unit_tests:
<<: *default_job_config
steps:
- attach_workspace:
at: /home/circleci
- run:
name: Running PHP 7.2 unit tests
command: |
/home/circleci/tooling/docker-unit-tests/docker-unit-tests.sh test_72
run_php_73_unit_tests:
<<: *default_job_config
steps:
- attach_workspace:
at: /home/circleci
- run:
name: Running PHP 7.3 unit tests
command: |
/home/circleci/tooling/docker-unit-tests/docker-unit-tests.sh test_73
run_php_74_unit_tests:
<<: *default_job_config
steps:
Expand Down Expand Up @@ -186,34 +127,16 @@ workflows:
jobs:
- prepare_test_and_build_environment:
<<: *context
# - run_php_54_unit_tests:
# <<: *test_job_config
# - run_php_55_unit_tests:
# <<: *test_job_config
- run_php_56_unit_tests:
<<: *test_job_config
# - run_php_70_unit_tests:
# <<: *test_job_config
# - run_php_71_unit_tests:
# <<: *test_job_config
# - run_php_72_unit_tests:
# <<: *test_job_config
# - run_php_73_unit_tests:
# <<: *test_job_config
- run_php_74_unit_tests:
<<: *test_job_config
# - run_acceptance_tests:
# <<: *context
- build_package_release:
<<: *context
requires:
# - run_php_54_unit_tests
# - run_php_55_unit_tests
- run_php_56_unit_tests
# - run_php_70_unit_tests
# - run_php_71_unit_tests
# - run_php_72_unit_tests
# - run_php_73_unit_tests
- run_php_74_unit_tests
# - run_acceptance_tests

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://gravityview.co
* Description: The best, easiest way to display Gravity Forms entries on your website.
* Version: 2.14.1
* Version: 2.14.2
* Author: GravityView
* Author URI: https://gravityview.co
* Text Domain: gravityview
Expand All @@ -22,7 +22,7 @@
/**
* The plugin version.
*/
define( 'GV_PLUGIN_VERSION', '2.14.1' );
define( 'GV_PLUGIN_VERSION', '2.14.2' );

/**
* Full path to the GravityView file
Expand Down
10 changes: 10 additions & 0 deletions includes/class-admin-welcome.php
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,16 @@ public function changelog_screen() {
<h2 style="border-bottom: 1px solid #ccc; padding-bottom: 1em; margin-bottom: 0; margin-top: 0"><?php esc_html_e( 'What&rsquo;s New', 'gravityview' ); ?></h2>
</div>

<h3>2.14.2 on March 10, 2022</h3>

<ul>
<li>Fixed: Potential fatal error on PHP 8 when exporting View entries in CSV and TSV formats</li>
<li>Fixed: Search widget would cause a fatal error when the Number field is used with the "is" operator</li>
<li>Fixed: Search widget returning incorrect results when a field value is blank and the operator is set to "is"</li>
<li>Fixed: Gravity Forms widget icon not showing</li>
<li>Fixed: Gravity Forms widget not displaying available forms when the View is saved</li>
</ul>

<h3>2.14.1 on January 25, 2022</h3>

<ul>
Expand Down
30 changes: 17 additions & 13 deletions includes/widgets/class-gravityview-widget-gravityforms.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<?php

use GV\View;

/**
* Widget to display a Gravity Forms form
*/
class GravityView_Widget_Gravity_Forms extends \GV\Widget {

public $icon = 'data:image/svg+xml;base64,PHN2ZyBpZD0iTGF5ZXJfMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB3aWR0aD0iMTE0IiBoZWlnaHQ9IjEyMy42Ij48c3R5bGU-LnN0MHtmaWxsOm5vbmV9PC9zdHlsZT48cGF0aCBjbGFzcz0ic3QwIiBkPSJNMzguOCA0NC44Yy0yLjMgMS00LjMgMi40LTYuMSA0LjMtNC4yIDQuNS02LjUgMTAtNi44IDE2LjQtLjMgNi40LS40IDkuOC0uMyAxMC4xbC40IDUuMWg2Mi41VjY0SDc3LjZ2NS44SDM2LjVjLjEtMS44LjQtNCAxLTYuN3MxLjYtNC45IDMuMS02LjZjLjgtLjcgMS42LTEuMiAyLjUtMS42LjktLjQgMi0uNiAzLjEtLjZoNDIuNnYtMTFINDYuNGMtMi44LjEtNS4zLjYtNy42IDEuNXoiLz48cGF0aCBkPSJNMTEwLjEgMzEuNmMtMS43LTMtMy44LTUuMS02LjItNi42TDY2IDMuMUM2My42IDEuNyA2MC42IDEgNTcuMiAxYy0zLjUgMC02LjQuNy04LjggMi4xTDEwLjUgMjVjLTIuNCAxLjQtNC41IDMuNi02LjIgNi42LTEuOCAzLTIuNiA1LjktMi42IDguN1Y4NGMwIDIuOC45IDUuNiAyLjYgOC42czMuOCA1Lj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guMywxNTQsNDkwLjIsMTIyLjYsNDY4LDEwOS44eiBNMzk5LjMsMjQ0LjRsLTE5NS4xLDBjLTExLDAtMTkuMiwzLjItMjUuNiwxMGMtMTQuMiwxNS4xLTE4LjIsNDQuNC0xOS4zLDYwLjdIMzQ4di0yNi40aDQ5LjkJdjc2LjNIMTExLjNsLTEuOC0yM2MtMC4zLTMuMy01LjktODAuNywzMi44LTEyMS45YzE2LjEtMTcuMSwzNy4xLTI1LjgsNjIuNC0yNS44aDE5NC43VjI0NC40eiI+PC9wYXRoPjwvZz48L3N2Zz4=';

/**
* Does this get displayed on a single entry?
Expand All @@ -14,6 +16,14 @@ class GravityView_Widget_Gravity_Forms extends \GV\Widget {
protected $show_on_single = true;

function __construct() {
// Initialize widget in the frontend or when editing a View/performing widget AJAX action
$doing_ajax = defined( 'DOING_AJAX' ) && DOING_AJAX && 'gv_field_options' === \GV\Utils::_POST( 'action' );
$editing_view = 'edit' === \GV\Utils::_GET( 'action' ) && 'gravityview' === get_post_type( \GV\Utils::_GET( 'post' ) );
$is_frontend = gravityview()->request->is_frontend();

if ( ! $doing_ajax && ! $editing_view && ! $is_frontend ) {
return;
}

$this->widget_description = __('Display a Gravity Forms form.', 'gravityview' );

Expand Down Expand Up @@ -67,7 +77,6 @@ function __construct() {
* @return array Array with key set to Form ID => Form Title, with `0` as default placeholder.
*/
private function _get_form_choices() {

$choices = array(
0 => '&mdash; ' . esc_html__( 'list of forms', 'gravityview' ) . '&mdash;',
);
Expand All @@ -76,20 +85,15 @@ private function _get_form_choices() {
return $choices;
}

// Inside GV's widget AJAX request
$doing_ajax = defined( 'DOING_AJAX' ) && DOING_AJAX && 'gv_field_options' === \GV\Utils::_POST( 'action' );

if ( $doing_ajax || \GV\Admin_Request::is_admin( '', 'multiple' ) ) {
global $wpdb;
global $wpdb;

$table = GFFormsModel::get_form_table_name();
$table = GFFormsModel::get_form_table_name();

$results = $wpdb->get_results( "SELECT id, title FROM ${table} WHERE is_active = 1" );
$results = $wpdb->get_results( "SELECT id, title FROM ${table} WHERE is_active = 1" );

if ( ! empty( $results ) ) {
foreach ( $results as $form ) {
$choices[ $form->id ] = $form->title;
}
if ( ! empty( $results ) ) {
foreach ( $results as $form ) {
$choices[ $form->id ] = $form->title;
}
}

Expand Down
40 changes: 38 additions & 2 deletions includes/widgets/search-widget/class-search-widget.php
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,11 @@ public function filter_entries( $search_criteria, $form_id = null, $args = array
}

if ( gv_empty( $value, false, false ) || ( is_array( $value ) && count( $value ) === 1 && gv_empty( $value[0], false, false ) ) ) {
continue;
if ( is_array( $value ) ) {
continue;
}

$value = '';
}

if ( strpos( $key, '|op' ) !== false ) {
Expand All @@ -749,6 +753,15 @@ public function filter_entries( $search_criteria, $form_id = null, $args = array

$filter_key = $this->convert_request_key_to_filter_key( $key );

if ( '' === $value ) {
$field = GFAPI::get_field( $view->form->ID, $filter_key );

// GF_Query casts Number field values to decimal, which may return unexpected result when the value is blank.
if ( $field && 'number' === $field->type ) {
$value = '-' . PHP_INT_MAX;
}
}

if ( ! $filter = $this->prepare_field_filter( $filter_key, $value, $view, $searchable_field_objects, $get ) ) {
continue;
}
Expand Down Expand Up @@ -831,7 +844,7 @@ public function gf_query_filter( &$query, $view, $request ) {
$extra_conditions = array();
$mode = 'any';

foreach ( $search_criteria['field_filters'] as &$filter ) {
foreach ( $search_criteria['field_filters'] as $key => &$filter ) {
if ( ! is_array( $filter ) ) {
if ( in_array( strtolower( $filter ), array( 'any', 'all' ) ) ) {
$mode = $filter;
Expand Down Expand Up @@ -892,6 +905,10 @@ public function gf_query_filter( &$query, $view, $request ) {
* @param \GV\View $view The View we're operating on.
*/
$filter['operator'] = apply_filters( 'gravityview_search_operator', $filter['operator'], $filter, $view );

if ( 'is' !== $filter['operator'] && '' === $filter['value'] ) {
unset( $search_criteria['field_filters'][ $key ] );
}
}

if ( ! empty( $search_criteria['start_date'] ) || ! empty( $search_criteria['end_date'] ) ) {
Expand Down Expand Up @@ -932,6 +949,25 @@ public function gf_query_filter( &$query, $view, $request ) {
$search_conditions[] = $search_condition;
} else {
$left = $search_condition->left;

// When casting a column value to a certain type (e.g., happens with the Number field), GF_Query_Column is wrapped in a GF_Query_Call class.
if ( $left instanceof GF_Query_Call ) {
try {
$reflectionProperty = new \ReflectionProperty( $left, '_parameters' );
$reflectionProperty->setAccessible( true );

$value = $reflectionProperty->getValue( $left );

if ( ! empty( $value[0] ) && $value[0] instanceof GF_Query_Column ) {
$left = $value[0];
} else {
continue;
}
} catch ( ReflectionException $e ) {
continue;
}
}

$alias = $query->_alias( $left->field_id, $left->source, $left->is_entry_column() ? 't' : 'm' );

if ( $view->joins && $left->field_id == GF_Query_Column::META ) {
Expand Down
27 changes: 25 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,35 @@
If you are using the plugin on a live site, please purchase a valid license from the [website](https://gravityview.co/?utm_source=github&utm_medium=readme&utm_campaign=readme). We cannot provide support to anyone that does not hold a valid license key.

----------
### Installation Instructions

To install the plugin, clone this repo to your WordPress plugins folder and activate it. Alternatively, you can download [the latest release](https://github.com/gravityview/GravityView/releases) to your WordPress plugins folder and then activate it.

### For Developers

If you wish to make changes to the plugin, you need to install developer dependencies. First, a couple of prerequisites:

1. Make sure that you have the full plugin source code by either cloning this repo or downloading the source code (not the versioned release) from the [Releases section](https://github.com/gravityview/GravityView/releases)
2. Install [Composer](https://getcomposer.org/)
3. Install [Node.js](https://nodejs.org/en/)
- We recommend a Node.js version manager [for Linux/macOS](https://github.com/nvm-sh/nvm) or [Windows](https://github.com/coreybutler/nvm-windows)
- Run `npm install -g grunt-cli` if this the first time you've installed Node.js or switched to a new version

Next, install dependencies:
1. Run `composer install` to install Composer dependencies
2. Run `npm install` to install Node.js dependencies

To compile/minify UI assets, use the following commands:

1. `grunt sass` & `grunt postcss` to compile and minify CSS files
2. `grunt uglify` to minify JavaScript files
3. `grunt imagemin` to minify images

#### Unit Tests

The plugin uses [PHPUnit](https://phpunit.de/) as part of the development process. We offer preconfigured Docker containers and a custom Bash script to facilitate running tests against multiple PHP and WordPress versions in a predictable environment. Visit our [Tooling](https://github.com/gravityview/Tooling/blob/main/docker-unit-tests/) repo for information regarding how to configure and run tests.

### Acceptance Tests
#### Acceptance Tests

The plugin uses [Codeception](https://codeception.com/) for acceptance testing. To configure and run tests:

Expand All @@ -27,7 +50,7 @@ See [Codeception commands reference](https://codeception.com/docs/reference/Comm

----------

#### Acknowledgements
### Acknowledgements

We are thankful to the following services and open source software that help enhance our plugin:

Expand Down
8 changes: 8 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ Beautifully display your Gravity Forms entries. Learn more on [gravityview.co](h

== Changelog ==

= 2.14.2 on March 10, 2022 =

* Fixed: Potential fatal error on PHP 8 when exporting View entries in CSV and TSV formats
* Fixed: Search widget would cause a fatal error when the Number field is used with the "is" operator
* Fixed: Search widget returning incorrect results when a field value is blank and the operator is set to "is"
* Fixed: Gravity Forms widget icon not showing
* Fixed: Gravity Forms widget not displaying available forms when the View is saved

= 2.14.1 on January 25, 2022 =

* Tested with WordPress 5.9
Expand Down
Loading

0 comments on commit f757b18

Please sign in to comment.