From 46af1c255ddc9ee278b8a82fe3817c3e420a18f8 Mon Sep 17 00:00:00 2001 From: Zack Katz Date: Fri, 18 May 2018 12:21:36 -0600 Subject: [PATCH 01/12] Update Avia to use $content_meta_keys 2.0 uses $content_meta_keys, not original $meta_keys --- .../class-gravityview-theme-hooks-avia.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/plugin-and-theme-hooks/class-gravityview-theme-hooks-avia.php b/includes/plugin-and-theme-hooks/class-gravityview-theme-hooks-avia.php index 632f578f5..2cf979059 100644 --- a/includes/plugin-and-theme-hooks/class-gravityview-theme-hooks-avia.php +++ b/includes/plugin-and-theme-hooks/class-gravityview-theme-hooks-avia.php @@ -28,7 +28,7 @@ class GravityView_Theme_Hooks_Avia extends GravityView_Plugin_and_Theme_Hooks { * @inheritDoc * @since 1.15.2 */ - protected $meta_keys = array( + protected $content_meta_keys = array( '_aviaLayoutBuilderCleanData' ); From 864ea5289d2b64a288f9cbb795aa07d40464d41e Mon Sep 17 00:00:00 2001 From: Zack Katz Date: Fri, 18 May 2018 12:23:47 -0600 Subject: [PATCH 02/12] Deprecate $meta_keys with back-compat, add $views by reference - Deprecate $meta_keys but retain support for it. $content_meta_keys is the 2.0 way to do things - Add $views collection, passed by reference, to allow subclasses to add to the collection - Deprecate `gravityview/data/parse/meta_keys` using `apply_filters_deprecated()` --- future/includes/class-gv-collection-view.php | 23 +++++++---- ...act-gravityview-plugin-and-theme-hooks.php | 40 ++++++++++++++++--- 2 files changed, 50 insertions(+), 13 deletions(-) diff --git a/future/includes/class-gv-collection-view.php b/future/includes/class-gv-collection-view.php index 8c9c81e7f..200af3616 100644 --- a/future/includes/class-gv-collection-view.php +++ b/future/includes/class-gv-collection-view.php @@ -90,18 +90,25 @@ public static function from_post( \WP_Post $post ) { * This is useful when using themes that store content that may contain shortcodes in custom post meta. * * @since 2.0 + * @since 2.0.7 Added $views parameter, passed by reference * * @param[in,out] array $meta_keys Array of key values to check. If empty, do not check. Default: empty array * @param[in] \WP_Post $post The post that is being checked + * @param \GV\View_Collection $views The current View Collection object, passed as reference */ - $meta_keys = apply_filters( 'gravityview/view_collection/from_post/meta_keys', array(), $post ); - - /** - * @filter `gravityview/data/parse/meta_keys` - * @deprecated - * @see The `gravityview/view_collection/from_post/meta_keys` filter. - */ - $meta_keys = (array)apply_filters( 'gravityview/data/parse/meta_keys', $meta_keys, $post->ID ); + $meta_keys = apply_filters_ref_array( 'gravityview/view_collection/from_post/meta_keys', array( array(), $post, &$views ) ); + + if ( function_exists( 'apply_filters_deprecated' ) ) { + $meta_keys = (array) apply_filters_deprecated( 'gravityview/data/parse/meta_keys', array( $meta_keys, $post->ID ), '2.0.7', 'gravityview/view_collection/from_post/meta_keys' ); + } else { + /** + * @filter `gravityview/data/parse/meta_keys` + * @deprecated + * @todo Require WP 4.6.0 so that `apply_filters_deprecated` is always available + * @see The `gravityview/view_collection/from_post/meta_keys` filter. + */ + $meta_keys = (array) apply_filters( 'gravityview/data/parse/meta_keys', $meta_keys, $post->ID ); + } /** What about inside post meta values? */ foreach ( $meta_keys as $meta_key ) { diff --git a/includes/plugin-and-theme-hooks/abstract-gravityview-plugin-and-theme-hooks.php b/includes/plugin-and-theme-hooks/abstract-gravityview-plugin-and-theme-hooks.php index 40034636e..b1bf8e660 100644 --- a/includes/plugin-and-theme-hooks/abstract-gravityview-plugin-and-theme-hooks.php +++ b/includes/plugin-and-theme-hooks/abstract-gravityview-plugin-and-theme-hooks.php @@ -39,16 +39,25 @@ abstract class GravityView_Plugin_and_Theme_Hooks { */ protected $constant_name = false; + /** + * Define the keys to be parsed by the `gravityview/view_collection/from_post/meta_keys` hook + * @see View_Collection::from_post + * @since 2.0 + * @type array + */ + protected $content_meta_keys = array(); + /** * Define the keys to be parsed by the `gravityview/data/parse/meta_keys` hook * @see GravityView_View_Data::parse_post_meta + * @deprecated 2.0 * @since 1.15.2 * @type array */ - protected $content_meta_keys = array(); + protected $meta_keys = array(); /** - * Define script handles used by the theme or plugin to be parsed by the `gravityview/data/parse/meta_keys` hook + * Define script handles used by the theme or plugin to be added to allowed no-conflict scripts * @see GravityView_Admin::remove_conflicts * @since 1.15.2 * @type array @@ -56,7 +65,7 @@ abstract class GravityView_Plugin_and_Theme_Hooks { protected $script_handles = array(); /** - * Define style handles used by the theme or plugin to be parsed by the `gravityview/data/parse/meta_keys` hook + * Define style handles used by the theme or plugin to be added to allowed no-conflict styles * @see GravityView_Admin::remove_conflicts * @since 1.15.2 * @type array @@ -114,8 +123,13 @@ private function maybe_add_hooks() { * @return void */ protected function add_hooks() { + + if( $this->meta_keys ) { + add_filter( 'gravityview/data/parse/meta_keys', array( $this, 'merge_meta_keys' ), 10, 2 ); + } + if( $this->content_meta_keys ) { - add_filter( 'gravityview/data/parse/meta_keys', array( $this, 'merge_content_meta_keys' ), 10, 2 ); + add_filter( 'gravityview/view_collection/from_post/meta_keys', array( $this, 'merge_content_meta_keys' ), 10, 3 ); } if( $this->script_handles ) { @@ -179,12 +193,28 @@ public function merge_noconflict_scripts( $handles ) { * * @since 1.15.2 * + * @deprecated 2.0.7 + * * @param array $handles Array of meta keys to check for existence of shortcodes * @param int $post_id The ID being checked by GravityView * * @return array Meta key array, merged with existing meta keys */ - public function merge_content_meta_keys( $meta_keys = array(), $post_id = 0 ) { + public function merge_meta_keys( $meta_keys = array(), $post_id = 0 ) { + return array_merge( $this->meta_keys, $meta_keys ); + } + + /** + * Merge plugin or theme meta keys that store shortcode data with existing keys to check + * + * @since 2.0.7 + * + * @param array $handles Array of meta keys to check for existence of shortcodes + * @param \WP_Post $post The ID being checked by GravityView + * + * @return array Meta key array, merged with existing meta keys + */ + public function merge_content_meta_keys( $meta_keys = array(), $post = null, & $views = null ) { return array_merge( $this->content_meta_keys, $meta_keys ); } From 221cfd9ab6221a6a0ef27193e4a64dc4566251b6 Mon Sep 17 00:00:00 2001 From: Zack Katz Date: Fri, 18 May 2018 12:24:55 -0600 Subject: [PATCH 03/12] Add support for SiteOrigin Page Builder meta storage Related to #1045 --- ...ass-gravityview-theme-hooks-siteorigin.php | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 includes/plugin-and-theme-hooks/class-gravityview-theme-hooks-siteorigin.php diff --git a/includes/plugin-and-theme-hooks/class-gravityview-theme-hooks-siteorigin.php b/includes/plugin-and-theme-hooks/class-gravityview-theme-hooks-siteorigin.php new file mode 100644 index 000000000..924f25a87 --- /dev/null +++ b/includes/plugin-and-theme-hooks/class-gravityview-theme-hooks-siteorigin.php @@ -0,0 +1,60 @@ +panels_data ) || empty( $post->panels_data['widgets'] ) ) { + return $meta_keys; + } + + foreach ( (array) $post->panels_data['widgets'] as $widget ) { + + if ( empty( $widget['text'] ) ) { + continue; + } + + $views->merge( \GV\View_Collection::from_content( $widget['text'] ) ); + } + + return $meta_keys; + } + +} + +new GravityView_Theme_Hooks_SiteOrigin; \ No newline at end of file From d9b40be55dc6d910da4a16de6ce09da8dda67286 Mon Sep 17 00:00:00 2001 From: Zack Katz Date: Fri, 18 May 2018 12:45:10 -0600 Subject: [PATCH 04/12] Tell the unit tests not to worry about deprecated filter --- tests/unit-tests/GravityView_Future_Test.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/unit-tests/GravityView_Future_Test.php b/tests/unit-tests/GravityView_Future_Test.php index 363c606b5..0393a1746 100644 --- a/tests/unit-tests/GravityView_Future_Test.php +++ b/tests/unit-tests/GravityView_Future_Test.php @@ -508,8 +508,10 @@ public function test_data_get_views() { * @covers \GV\View_Collection::contains() * @covers \GravityView_View_Data::maybe_get_view_id() * @covers \GravityView_View_Data::is_valid_embed_id() + * @expectedDeprecated gravityview/data/parse/meta_keys */ public function test_view_collection_from_post() { + $original_shortcode = $GLOBALS['shortcode_tags']['gravityview']; remove_shortcode( 'gravityview' ); /** Conflicts with existing shortcode right now. */ \GV\Shortcodes\gravityview::add(); From 1e8f76aa900140278aaec3bb423d5416f7564a42 Mon Sep 17 00:00:00 2001 From: Zack Katz Date: Fri, 18 May 2018 12:50:20 -0600 Subject: [PATCH 05/12] Why doesn't .gitignore always work? --- .gitignore | 7 +++---- .idea/php.xml | 50 -------------------------------------------------- 2 files changed, 3 insertions(+), 54 deletions(-) delete mode 100644 .idea/php.xml diff --git a/.gitignore b/.gitignore index 08d151da9..6ab89fcb8 100644 --- a/.gitignore +++ b/.gitignore @@ -22,8 +22,9 @@ vendor/*/.git vendor/composer/ vendor/autoload.php -### Grunt ### +### Node ### node_modules/* +package-lock.json ### CodeKit #### .sass-cache @@ -45,6 +46,7 @@ languages/gravityview-pt.po .idea/dictionaries .idea/deployment.xml .idea/modules.xml + .idea/php.xml # Sensitive or high-churn files: @@ -86,6 +88,3 @@ docs/html # VIM *.swp - -.idea/php.xml -package-lock.json diff --git a/.idea/php.xml b/.idea/php.xml deleted file mode 100644 index 782c29583..000000000 --- a/.idea/php.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file From 3341e00f61496bf429b36b1946f3b4ef9977faee Mon Sep 17 00:00:00 2001 From: Zack Katz Date: Fri, 18 May 2018 12:57:31 -0600 Subject: [PATCH 06/12] Maybe this will help with intermittently-failing tests? #1009 Could it be caused by collisions? Unlikely, but possible. --- tests/unit-tests/GravityView_Future_Test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit-tests/GravityView_Future_Test.php b/tests/unit-tests/GravityView_Future_Test.php index 0393a1746..c48eb5421 100644 --- a/tests/unit-tests/GravityView_Future_Test.php +++ b/tests/unit-tests/GravityView_Future_Test.php @@ -5318,7 +5318,7 @@ public function test_widget_render() { 'widgets' => array( 'header_top' => array( wp_generate_password( 4, false ) => array( - 'id' => $widget_id = wp_generate_password( 4, false ) . '-widget', + 'id' => $widget_id = wp_generate_password( 12, false ) . '-widget', 'test' => 'foo', ), ), From 8a4a8cecd194d70342d14ff1db72948d6acb589b Mon Sep 17 00:00:00 2001 From: Zack Katz Date: Fri, 18 May 2018 13:18:05 -0600 Subject: [PATCH 07/12] Add support for LiveMesh and SiteOrigin tabs --- ...class-gravityview-theme-hooks-siteorigin.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/includes/plugin-and-theme-hooks/class-gravityview-theme-hooks-siteorigin.php b/includes/plugin-and-theme-hooks/class-gravityview-theme-hooks-siteorigin.php index 924f25a87..03ce42014 100644 --- a/includes/plugin-and-theme-hooks/class-gravityview-theme-hooks-siteorigin.php +++ b/includes/plugin-and-theme-hooks/class-gravityview-theme-hooks-siteorigin.php @@ -45,11 +45,24 @@ function merge_content_meta_keys( $meta_keys = array(), $post = null, & $views = foreach ( (array) $post->panels_data['widgets'] as $widget ) { - if ( empty( $widget['text'] ) ) { + $views->merge( \GV\View_Collection::from_content( \GV\Utils::get( $widget, 'text' ) ) ); + + if ( empty( $widget['tabs'] ) || ! is_array( $widget['tabs'] ) ) { continue; } - $views->merge( \GV\View_Collection::from_content( $widget['text'] ) ); + foreach ( $widget['tabs'] as $tab ) { + + // Livemesh Tabs + $backup = \GV\Utils::get( $tab, 'tab_content' ); + + // SiteOrigin Tabs + $content = \GV\Utils::get( $tab, 'content_text', $backup ); + + if( $content ) { + $views->merge( \GV\View_Collection::from_content( $content ) ); + } + } } return $meta_keys; From 6a20c4df20052f4159a2bee9656c67a4d97bb218 Mon Sep 17 00:00:00 2001 From: Zack Katz Date: Fri, 18 May 2018 15:24:57 -0600 Subject: [PATCH 08/12] Return early if form not exists or empty slug/id --- includes/class-common.php | 49 +++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/includes/class-common.php b/includes/class-common.php index 431daf209..f1d50de36 100644 --- a/includes/class-common.php +++ b/includes/class-common.php @@ -659,39 +659,38 @@ public static function get_entry_id( $entry_id_or_slug = '', $force_allow_ids = */ public static function get_entry( $entry_slug, $force_allow_ids = false, $check_entry_display = true ) { - if ( class_exists( 'GFAPI' ) && ! empty( $entry_slug ) ) { - - $entry_id = self::get_entry_id( $entry_slug, $force_allow_ids ); + if ( ! class_exists( 'GFAPI' ) || empty( $entry_slug ) ) { + return false; + } - if ( empty( $entry_id ) ) { - return false; - } + $entry_id = self::get_entry_id( $entry_slug, $force_allow_ids ); - // fetch the entry - $entry = GFAPI::get_entry( $entry_id ); + if ( empty( $entry_id ) ) { + return false; + } - /** - * @filter `gravityview/common/get_entry/check_entry_display` Override whether to check entry display rules against filters - * @since 1.16.2 - * @param bool $check_entry_display Check whether the entry is visible for the current View configuration. Default: true. - * @param array $entry Gravity Forms entry array - */ - $check_entry_display = apply_filters( 'gravityview/common/get_entry/check_entry_display', $check_entry_display, $entry ); + // fetch the entry + $entry = GFAPI::get_entry( $entry_id ); - if( $check_entry_display ) { - // Is the entry allowed - $entry = self::check_entry_display( $entry ); - } + /** + * @filter `gravityview/common/get_entry/check_entry_display` Override whether to check entry display rules against filters + * @since 1.16.2 + * @param bool $check_entry_display Check whether the entry is visible for the current View configuration. Default: true. + * @param array $entry Gravity Forms entry array + */ + $check_entry_display = apply_filters( 'gravityview/common/get_entry/check_entry_display', $check_entry_display, $entry ); - if( is_wp_error( $entry ) ) { - gravityview()->log->error( '{error}', array( 'error' => $entry->get_error_message() ) ); - return false; - } + if( $check_entry_display ) { + // Is the entry allowed + $entry = self::check_entry_display( $entry ); + } - return $entry; + if( is_wp_error( $entry ) ) { + gravityview()->log->error( '{error}', array( 'error' => $entry->get_error_message() ) ); + return false; } - return false; + return $entry; } /** From e1cd9b67f3ea63f0e52fab5a827be347a8188e12 Mon Sep 17 00:00:00 2001 From: Zack Katz Date: Mon, 21 May 2018 11:47:59 -0600 Subject: [PATCH 09/12] Fix search fields not being processed, breaking `$request->is_search()` This is a temporary fix until https://github.com/gravityview/GravityView/projects/5 is done. Tests incorrectly passed before because checking for isset, while also setting the key. --- future/includes/class-gv-request.php | 39 +++++++++++++- tests/unit-tests/GravityView_Future_Test.php | 54 ++++++++++++++++++-- 2 files changed, 89 insertions(+), 4 deletions(-) diff --git a/future/includes/class-gv-request.php b/future/includes/class-gv-request.php index 740e0d3f2..3d5f99f9b 100644 --- a/future/includes/class-gv-request.php +++ b/future/includes/class-gv-request.php @@ -141,7 +141,44 @@ public function is_search() { $get = $_GET; } - return $this->is_view() && ( isset( $get['gv_search'] ) || isset( $get['gv_start'] ) || isset( $get['gv_end'] ) || isset( $get['gv_by'] ) || isset( $get['gv_id'] ) ); + $has_field_key = $this->_has_field_key( $get ); + + return $this->is_view() && ( $has_field_key || isset( $get['gv_search'] ) || isset( $get['gv_start'] ) || isset( $get['gv_end'] ) || isset( $get['gv_by'] ) || isset( $get['gv_id'] ) ); + } + + /** + * Calculate whether the $_REQUEST has a GravityView field + * + * @internal + * @todo Roll into the future Search refactor + * + * @since 2.0.7 + * + * @param array $get $_POST or $_GET array + * + * @return bool True: GravityView-formatted field detected; False: not detected + */ + private function _has_field_key( $get ) { + + $has_field_key = false; + + $fields = \GravityView_Fields::get_all(); + + $meta = array(); + foreach ( $fields as $field ) { + if( empty( $field->_gf_field_class_name ) ) { + $meta[] = preg_quote( $field->name ); + } + } + + foreach ( $get as $key => $value ) { + if ( preg_match('/^filter_(([0-9_]+)|'. implode( '|', $meta ) .')$/ism', $key ) ) { + $has_field_key = true; + break; + } + } + + return $has_field_key; } } diff --git a/tests/unit-tests/GravityView_Future_Test.php b/tests/unit-tests/GravityView_Future_Test.php index c48eb5421..77ec44e5d 100644 --- a/tests/unit-tests/GravityView_Future_Test.php +++ b/tests/unit-tests/GravityView_Future_Test.php @@ -859,7 +859,54 @@ public function test_frontend_request_is_search() { $this->assertTrue( $request->is_search() ); $_GET = array( - 'gv_search' => '', + 'filter_currency' => 'USD', + ); + + $this->assertTrue( $request->is_search() ); + + $_GET = array( + 'gv_start' => '2001-01-01', + ); + + $this->assertTrue( $request->is_search() ); + + $_GET = array( + 'gv_end' => '2001-01-01', + ); + + $this->assertTrue( $request->is_search() ); + + $_GET = array( + 'gv_by' => '1', + ); + + $this->assertTrue( $request->is_search() ); + + $_GET = array( + 'gv_id' => '123', + ); + + $this->assertTrue( $request->is_search() ); + + $_GET = array( + 'filter_payment_status' => 'Completed', + ); + + $this->assertTrue( $request->is_search() ); + + $_GET = array( + '_filter_16' => 'Features+%2F+Enhancements', // Not GV field key + ); + + $this->assertFalse( $request->is_search() ); + + $_GET = array( + 'filter_16_And_Then_Some' => 'Features+%2F+Enhancements', // Not GV field key + ); + + $this->assertFalse( $request->is_search() ); + + $_GET = array( 'filter_16' => 'Features+%2F+Enhancements', ); $this->assertTrue( $request->is_search() ); @@ -868,7 +915,6 @@ public function test_frontend_request_is_search() { $_GET = array(); $_POST = array( - 'gv_search' => '', 'filter_16' => 'Features+%2F+Enhancements', ); $this->assertFalse( $request->is_search() ); @@ -879,11 +925,13 @@ public function test_frontend_request_is_search() { }); $_POST = array( - 'gv_search' => '', 'filter_16' => 'Features+%2F+Enhancements', ); $this->assertTrue( $request->is_search() ); + $_POST = array(); + $this->assertFalse( $request->is_search() ); + remove_filter( 'gravityview/search/method', $use_post ); $this->assertFalse( $request->is_search() ); From 09758f1007a5e5a40cf2bc851f1a30d9afbc22ae Mon Sep 17 00:00:00 2001 From: Zack Katz Date: Mon, 21 May 2018 11:49:27 -0600 Subject: [PATCH 10/12] Fix the "hide until searched" logic for new templates Fixes #1046 along with e1cd9b6 --- includes/class-api.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/includes/class-api.php b/includes/class-api.php index da7b2f4fa..929cc9754 100644 --- a/includes/class-api.php +++ b/includes/class-api.php @@ -677,7 +677,9 @@ function gv_container_class( $passed_css_class = '', $echo = true, $context = nu $view_id = 0; if ( $context->view ) { $view_id = $context->view->ID; - $hide_until_searched = $context->view->settings->get( 'hide_until_searched' ); + if( $context->view->settings->get( 'hide_until_searched' ) ) { + $hide_until_searched = ! $context->request->is_search(); + } } if ( $context->entries ) { $total_entries = $context->entries->total(); From f73a59e0774175598c5eb08117d5c6015ce7968e Mon Sep 17 00:00:00 2001 From: Zack Katz Date: Mon, 21 May 2018 12:50:17 -0600 Subject: [PATCH 11/12] Add some tests for CSS class when passing $context --- tests/unit-tests/GravityView_API_Test.php | 54 +++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/tests/unit-tests/GravityView_API_Test.php b/tests/unit-tests/GravityView_API_Test.php index dd34a03fc..3c44792cc 100644 --- a/tests/unit-tests/GravityView_API_Test.php +++ b/tests/unit-tests/GravityView_API_Test.php @@ -90,6 +90,47 @@ public function test_gv_container_class() { $this->assertEquals( $expected, $formatted, $expected ); } + $post = $this->factory->view->create_and_get( array( 'form_id' => $this->form_id ) ); + $view = \GV\View::from_post( $post ); + $view->settings->update( array( 'page_size' => 3 ) ); + + $entries = new \GV\Entry_Collection(); + + foreach ( range( 1, 5 ) as $i ) { + $entry = $this->factory->entry->create_and_get( array( + 'form_id' => $this->form_id, + 'status' => 'active', + '16' => wp_generate_password( 12 ), + ) ); + $entries->add( \GV\GF_Entry::by_id( $entry['id'] ) ); + } + + $context = new \GV\Template_Context(); + $context->request = new \GV\Mock_Request(); + $context->entries = $entries; + + $classes = array( + 'gv-container' => gv_container_class( '', false, $context ), + 'with-passed-class gv-container' => gv_container_class( 'with-passed-class', false, $context ), + 'with-passed-class and-whitespace gv-container' => gv_container_class( ' with-passed-class and-whitespace ', false, $context ), + ); + + foreach ( $classes as $expected => $formatted ) { + $this->assertEquals( $expected, $formatted, $expected ); + } + + $context->view = $view; + + $classes = array( + 'gv-container gv-container-' . $view->ID => gv_container_class( '', false, $context ), + 'with-passed-class gv-container gv-container-' . $view->ID => gv_container_class( 'with-passed-class', false, $context ), + 'with-passed-class and-whitespace gv-container gv-container-' . $view->ID => gv_container_class( ' with-passed-class and-whitespace ', false, $context ), + ); + + foreach ( $classes as $expected => $formatted ) { + $this->assertEquals( $expected, $formatted, $expected ); + } + // Test Hide Until Search formatting GravityView_View::getInstance()->setHideUntilSearched( true ); @@ -103,6 +144,19 @@ public function test_gv_container_class() { $this->assertEquals( $expected, $formatted, $expected ); } + $context->view->settings->set( 'hide_until_searched', '1' ); + $context->request->returns['is_search'] = false; + + $classes = array( + 'gv-container gv-container-' . $view->ID .' hidden' => gv_container_class( '', false, $context ), + 'with-passed-class gv-container gv-container-' . $view->ID .' hidden' => gv_container_class( 'with-passed-class', false, $context ), + 'with-passed-class and-whitespace gv-container gv-container-' . $view->ID .' hidden' => gv_container_class( ' with-passed-class and-whitespace ', false, $context ), + ); + + foreach ( $classes as $expected => $formatted ) { + $this->assertEquals( $expected, $formatted, $expected ); + } + // Test View ID formatting GravityView_View::getInstance()->setViewId( 12 ); From 345e3543ae6a8551ffc5bca8f4506080e782a2aa Mon Sep 17 00:00:00 2001 From: Zack Katz Date: Mon, 21 May 2018 12:59:37 -0600 Subject: [PATCH 12/12] Version bump --- gravityview.php | 4 ++-- includes/class-admin-welcome.php | 8 ++++++++ readme.txt | 8 +++++++- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/gravityview.php b/gravityview.php index 7bba203ff..f770d1fc8 100644 --- a/gravityview.php +++ b/gravityview.php @@ -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.0.6 + * Version: 2.0.6.1 * Author: GravityView * Author URI: https://gravityview.co * Text Domain: gravityview @@ -22,7 +22,7 @@ /** * The plugin version. */ -define( 'GV_PLUGIN_VERSION', '2.0.6' ); +define( 'GV_PLUGIN_VERSION', '2.0.6.1' ); /** * Full path to the GravityView file diff --git a/includes/class-admin-welcome.php b/includes/class-admin-welcome.php index dce6f7870..7209808ac 100644 --- a/includes/class-admin-welcome.php +++ b/includes/class-admin-welcome.php @@ -305,6 +305,14 @@ public function changelog_screen() { +

2.0.6.1 on May 21, 2018

+ +
    +
  • Fixed: "Hide View data until search is performed" not working
  • +
  • Added: Support for SiteOrigin Page Builder and LiveMesh SiteOrigin Widgets
  • +
  • Fixed: Enfold Theme layout builder no longer rendering Views
  • +
+

2.0.6 on May 17, 2018

    diff --git a/readme.txt b/readme.txt index f56622ab0..3285f1cc5 100644 --- a/readme.txt +++ b/readme.txt @@ -1,7 +1,7 @@ === GravityView === Tags: gravity forms, directory, gravity forms directory Requires at least: 4.4 -Tested up to: 4.9.5 +Tested up to: 4.9.6 Requires PHP: 5.3 Stable tag: trunk Contributors: The GravityView Team @@ -21,6 +21,12 @@ Beautifully display your Gravity Forms entries. Learn more on [gravityview.co](h == Changelog == += 2.0.6.1 on May 21, 2018 = + +* Fixed: "Hide View data until search is performed" not working +* Added: Support for SiteOrigin Page Builder and LiveMesh SiteOrigin Widgets +* Fixed: Enfold Theme layout builder no longer rendering Views + = 2.0.6 on May 17, 2018 = * Fixed: Conflicts with Yoast SEO & Jetpack plugins that prevent widgets from displaying