Skip to content

Commit df1a8dc

Browse files
authored
Version 2.21 (#2013)
This release enhances security, introduces support for LifterLMS, adds a new CSV/TSV export widget to the View editor along with the option to add Gravity Flow fields to the Search Bar, addresses PHP 8.2 deprecation notices, fixes a conflict with BuddyBoss Platform, and improves performance with updates to essential components. #### 🚀 Added * A View editor widget to export entries in CSV or TSV formats. * Support for SVG images. * Support for Gravity Flow's "Workflow User" and "Workflow Multi-User" fields inside the Search Bar. * Integration with LifterLMS that allows embedding Views inside Student Dashboards. * Notice to inform administrators that an embedded View was moved to "trash" and an option to restore it. * Click-to-copy shortcode functionality in the View editor and when listing existing Views. #### 🐛 Fixed * PHP 8.2 deprecation notices. * Fields linked to single entry layouts are now exported as plain text values, not hyperlinks, in CSV/TSV files. * Issue preventing the saving of pages/posts with GravityView Gutenberg blocks when BuddyBoss Platform is active. #### 🔐 Security * Enhanced security by adding a `secret` attribute to shortcodes and blocks connected to Views. #### 🔧 Updated * [Foundation](https://www.gravitykit.com/foundation/) to version 1.2.11. - GravityKit product updates are now showing on the Plugins page. - Database options that are no longer used are now automatically removed. __Developer Updates:__ * Added: `gk/gravityview/widget/search/clear-button/params` filter to modify the parameters of the Clear button in the search widget.
2 parents ead4fa8 + 0e8aaf9 commit df1a8dc

File tree

75 files changed

+2679
-1443
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+2679
-1443
lines changed

.circleci/config.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,4 +138,3 @@ workflows:
138138
- run_php_72_unit_tests
139139
- run_php_80_unit_tests
140140
# - run_acceptance_tests
141-

assets/css/admin-global.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/css/admin-views.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/css/scss/admin-global.scss

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,3 +171,64 @@
171171
margin: -1px;
172172
}
173173
}
174+
175+
176+
.gv-fields.csv-disabled {
177+
cursor: not-allowed;
178+
179+
.csv-disabled-notice {
180+
display: block;
181+
}
182+
.gv-field-label,
183+
.gv-field-controls button {
184+
color: #d7dade !important;
185+
}
186+
187+
.ui-tooltip-content .gv-items-picker-container.gv-widget-picker-container & {
188+
display: none;
189+
}
190+
}
191+
192+
193+
/** The "Embed Shortcode" section in the Publish metabox */
194+
.gv-shortcode {
195+
.dashicons-editor-code {
196+
color: #888;
197+
left: -1px;
198+
font-size: 20px;
199+
line-height: 1;
200+
201+
html[dir=rtl] & {
202+
left: auto;
203+
right: -1px;
204+
}
205+
}
206+
207+
html[dir=rtl] & .code.widefat {
208+
text-align: right;
209+
}
210+
211+
position: relative;
212+
213+
input.code {
214+
cursor: pointer;
215+
}
216+
217+
span.copied {
218+
display: none;
219+
position: absolute;
220+
top: 30px;
221+
right: 15px;
222+
background-color: #000;
223+
color: #FFF;
224+
padding: 2px 5px;
225+
border-radius: 5px;
226+
}
227+
228+
.wp-list-table & {
229+
span.copied {
230+
top: 3px;
231+
right: 3px;
232+
}
233+
}
234+
}

assets/css/scss/admin-views.scss

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1912,23 +1912,6 @@ $dialog-button-padding: 5px;
19121912
}
19131913
}
19141914

1915-
/** The "Embed Shortcode" section in the Publish metabox */
1916-
.gv-shortcode {
1917-
.dashicons-editor-code {
1918-
color: #888;
1919-
left: -1px;
1920-
font-size: 20px;
1921-
line-height: 1;
1922-
html[dir=rtl] & {
1923-
left: auto;
1924-
right: -1px;
1925-
}
1926-
}
1927-
html[dir=rtl] & .code.widefat {
1928-
text-align: right;
1929-
}
1930-
}
1931-
19321915
/** The "Direct Access" section in the Publish metabox */
19331916
#gv-direct-access:before {
19341917
font: normal 20px/1 Dashicons;

assets/js/admin-shortcode.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/**
2+
* Responsible for copying the short codes from the list and edit page.
3+
* @since 2.21
4+
*/
5+
( function ( $ ) {
6+
$( document ).on( 'ready', function () {
7+
var shortcode_clipboard = new ClipboardJS( '.gv-shortcode input.code', {
8+
text: function ( trigger ) {
9+
return $( trigger ).val();
10+
}
11+
} );
12+
13+
shortcode_clipboard.on('success', function (e) {
14+
var $el = $( e.trigger ).closest( '.gv-shortcode' ).find( '.copied' );
15+
$el.show();
16+
setTimeout( function () {
17+
$el.fadeOut();
18+
}, 1000 );
19+
});
20+
21+
// ClipBoardJS only listens to the `click` event, so we fake that here for `Enter`.
22+
$( '.gv-shortcode input.code' ).on( 'keydown', function ( e ) {
23+
if ( 'Enter' === e.key ) {
24+
e.preventDefault();
25+
$( this ).trigger( 'click' );
26+
}
27+
} );
28+
} );
29+
} )( jQuery );

assets/js/admin-shortcode.min.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/js/admin-views.js

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,6 @@
144144
// bind Add Field fields to the addField method
145145
.on( 'click', '.ui-tooltip-content .gv-fields', vcfg.startAddField )
146146

147-
// When user clicks into the shortcode example field, select the example.
148-
.on( 'click', ".gv-shortcode input", vcfg.selectText )
149-
150147
// Show the direct access options and hide the toggle button when opened.
151148
.on( 'click', "#gv-direct-access .edit-direct-access", vcfg.editDirectAccess )
152149

@@ -2792,6 +2789,23 @@
27922789
}
27932790
} );
27942791

2792+
const $embedShortcodeEl = $( '#gv-embed-shortcode' );
2793+
$( '#gravityview_se_is_secure' ).on( 'change', function () {
2794+
let embedShortcode = $embedShortcodeEl.val();
2795+
if ( !embedShortcode ) {
2796+
return;
2797+
}
2798+
2799+
if ( $( this ).is( ':checked' ) ) {
2800+
embedShortcode = embedShortcode.replace( /]$/, ` secret="${ $embedShortcodeEl.data( 'secret' ) }"]` );
2801+
2802+
} else {
2803+
embedShortcode = embedShortcode.replace( / secret="[^"]+"/, '' );
2804+
}
2805+
2806+
$embedShortcodeEl.val( embedShortcode );
2807+
} );
2808+
27952809
// Expose globally methods to initialize/destroy tooltips and to display dialog window
27962810
window.gvAdminActions = {
27972811
initTooltips: viewConfiguration.init_tooltips,
@@ -2802,4 +2816,21 @@
28022816
$( document.body ).trigger( 'gravityview/loaded' );
28032817
} );
28042818

2819+
/**
2820+
* Handles CSV widget classes.
2821+
* @since 2.21
2822+
*/
2823+
$( function () {
2824+
const $csv_enable = $( '#gravityview_se_csv_enable' );
2825+
const update_csv_widget_classes = function () {
2826+
$( '[data-fieldid="export_link"]' )
2827+
.toggleClass( 'csv-disabled', !$csv_enable.is( ':checked' ) )
2828+
.attr( 'aria-disabled', $csv_enable.is( ':checked' ) ? 'false' : 'true' )
2829+
;
2830+
};
2831+
2832+
$csv_enable.on( 'change', update_csv_widget_classes );
2833+
update_csv_widget_classes();
2834+
} );
2835+
28052836
}(jQuery));

assets/js/admin-views.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

composer.lock

Lines changed: 13 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

future/includes/class-gv-entry-gravityforms.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ class GF_Entry extends Entry implements \ArrayAccess {
2020
*/
2121
public static $backend = 'gravityforms';
2222

23+
/**
24+
* The entry slug.
25+
*
26+
* @var string
27+
*/
28+
public $slug;
29+
2330
/**
2431
* Initialization.
2532
*/

future/includes/class-gv-entry.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,9 @@ public function get_permalink( \GV\View $view = null, \GV\Request $request = nul
154154
* Modify the URL to the View "directory" context.
155155
*
156156
* @since 1.19.4
157-
* @param string $link URL to the View's "directory" context (Multiple Entries screen)
158-
* @param int $post_id ID of the post to link to. If the View is embedded, it is the post or page ID
157+
*
158+
* @param string $permalink URL to the View's "directory" context (Multiple Entries screen).
159+
* @param int $post_id ID of the post to link to. If the View is embedded, it is the post or page ID.
159160
*/
160161
$permalink = apply_filters( 'gravityview_directory_link', $permalink, $request->is_view( false ) ? $view_id : ( $post ? $post->ID : null ) );
161162

future/includes/class-gv-field-internal.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@ class Internal_Field extends Field {
1717
*/
1818
public $field;
1919

20+
/**
21+
* The field type.
22+
*
23+
* @var string
24+
*/
25+
public $type;
26+
2027
/**
2128
* Create self from a configuration array.
2229
*

future/includes/class-gv-field.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,11 @@ public function get_label( View $view = null, Source $source = null, Entry $entr
297297

298298
/** A custom label is available. */
299299
if ( ! empty( $this->custom_label ) ) {
300-
return \GravityView_API::replace_variables( $this->custom_label, $source ? $source->form ? : null : null, $entry ? $entry->as_entry() : null );
300+
return \GravityView_API::replace_variables(
301+
$this->custom_label,
302+
$source ? $source->form ?? null : null,
303+
$entry ? $entry->as_entry() : null
304+
);
301305
}
302306

303307
return '';

0 commit comments

Comments
 (0)