Skip to content

Commit

Permalink
Version 2.21 (#2013)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mrcasual authored Mar 19, 2024
2 parents ead4fa8 + 0e8aaf9 commit df1a8dc
Show file tree
Hide file tree
Showing 75 changed files with 2,679 additions and 1,443 deletions.
1 change: 0 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,3 @@ workflows:
- run_php_72_unit_tests
- run_php_80_unit_tests
# - run_acceptance_tests

2 changes: 1 addition & 1 deletion assets/css/admin-global.css

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

2 changes: 1 addition & 1 deletion assets/css/admin-views.css

Large diffs are not rendered by default.

61 changes: 61 additions & 0 deletions assets/css/scss/admin-global.scss
Original file line number Diff line number Diff line change
Expand Up @@ -171,3 +171,64 @@
margin: -1px;
}
}


.gv-fields.csv-disabled {
cursor: not-allowed;

.csv-disabled-notice {
display: block;
}
.gv-field-label,
.gv-field-controls button {
color: #d7dade !important;
}

.ui-tooltip-content .gv-items-picker-container.gv-widget-picker-container & {
display: none;
}
}


/** The "Embed Shortcode" section in the Publish metabox */
.gv-shortcode {
.dashicons-editor-code {
color: #888;
left: -1px;
font-size: 20px;
line-height: 1;

html[dir=rtl] & {
left: auto;
right: -1px;
}
}

html[dir=rtl] & .code.widefat {
text-align: right;
}

position: relative;

input.code {
cursor: pointer;
}

span.copied {
display: none;
position: absolute;
top: 30px;
right: 15px;
background-color: #000;
color: #FFF;
padding: 2px 5px;
border-radius: 5px;
}

.wp-list-table & {
span.copied {
top: 3px;
right: 3px;
}
}
}
17 changes: 0 additions & 17 deletions assets/css/scss/admin-views.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1912,23 +1912,6 @@ $dialog-button-padding: 5px;
}
}

/** The "Embed Shortcode" section in the Publish metabox */
.gv-shortcode {
.dashicons-editor-code {
color: #888;
left: -1px;
font-size: 20px;
line-height: 1;
html[dir=rtl] & {
left: auto;
right: -1px;
}
}
html[dir=rtl] & .code.widefat {
text-align: right;
}
}

/** The "Direct Access" section in the Publish metabox */
#gv-direct-access:before {
font: normal 20px/1 Dashicons;
Expand Down
29 changes: 29 additions & 0 deletions assets/js/admin-shortcode.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/**
* Responsible for copying the short codes from the list and edit page.
* @since 2.21
*/
( function ( $ ) {
$( document ).on( 'ready', function () {
var shortcode_clipboard = new ClipboardJS( '.gv-shortcode input.code', {
text: function ( trigger ) {
return $( trigger ).val();
}
} );

shortcode_clipboard.on('success', function (e) {
var $el = $( e.trigger ).closest( '.gv-shortcode' ).find( '.copied' );
$el.show();
setTimeout( function () {
$el.fadeOut();
}, 1000 );
});

// ClipBoardJS only listens to the `click` event, so we fake that here for `Enter`.
$( '.gv-shortcode input.code' ).on( 'keydown', function ( e ) {
if ( 'Enter' === e.key ) {
e.preventDefault();
$( this ).trigger( 'click' );
}
} );
} );
} )( jQuery );
1 change: 1 addition & 0 deletions assets/js/admin-shortcode.min.js

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

37 changes: 34 additions & 3 deletions assets/js/admin-views.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,6 @@
// bind Add Field fields to the addField method
.on( 'click', '.ui-tooltip-content .gv-fields', vcfg.startAddField )

// When user clicks into the shortcode example field, select the example.
.on( 'click', ".gv-shortcode input", vcfg.selectText )

// Show the direct access options and hide the toggle button when opened.
.on( 'click', "#gv-direct-access .edit-direct-access", vcfg.editDirectAccess )

Expand Down Expand Up @@ -2792,6 +2789,23 @@
}
} );

const $embedShortcodeEl = $( '#gv-embed-shortcode' );
$( '#gravityview_se_is_secure' ).on( 'change', function () {
let embedShortcode = $embedShortcodeEl.val();
if ( !embedShortcode ) {
return;
}

if ( $( this ).is( ':checked' ) ) {
embedShortcode = embedShortcode.replace( /]$/, ` secret="${ $embedShortcodeEl.data( 'secret' ) }"]` );

} else {
embedShortcode = embedShortcode.replace( / secret="[^"]+"/, '' );
}

$embedShortcodeEl.val( embedShortcode );
} );

// Expose globally methods to initialize/destroy tooltips and to display dialog window
window.gvAdminActions = {
initTooltips: viewConfiguration.init_tooltips,
Expand All @@ -2802,4 +2816,21 @@
$( document.body ).trigger( 'gravityview/loaded' );
} );

/**
* Handles CSV widget classes.
* @since 2.21
*/
$( function () {
const $csv_enable = $( '#gravityview_se_csv_enable' );
const update_csv_widget_classes = function () {
$( '[data-fieldid="export_link"]' )
.toggleClass( 'csv-disabled', !$csv_enable.is( ':checked' ) )
.attr( 'aria-disabled', $csv_enable.is( ':checked' ) ? 'false' : 'true' )
;
};

$csv_enable.on( 'change', update_csv_widget_classes );
update_csv_widget_classes();
} );

}(jQuery));
2 changes: 1 addition & 1 deletion assets/js/admin-views.min.js

Large diffs are not rendered by default.

26 changes: 13 additions & 13 deletions composer.lock

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

7 changes: 7 additions & 0 deletions future/includes/class-gv-entry-gravityforms.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ class GF_Entry extends Entry implements \ArrayAccess {
*/
public static $backend = 'gravityforms';

/**
* The entry slug.
*
* @var string
*/
public $slug;

/**
* Initialization.
*/
Expand Down
5 changes: 3 additions & 2 deletions future/includes/class-gv-entry.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,9 @@ public function get_permalink( \GV\View $view = null, \GV\Request $request = nul
* Modify the URL to the View "directory" context.
*
* @since 1.19.4
* @param string $link URL to the View's "directory" context (Multiple Entries screen)
* @param int $post_id ID of the post to link to. If the View is embedded, it is the post or page ID
*
* @param string $permalink URL to the View's "directory" context (Multiple Entries screen).
* @param int $post_id ID of the post to link to. If the View is embedded, it is the post or page ID.
*/
$permalink = apply_filters( 'gravityview_directory_link', $permalink, $request->is_view( false ) ? $view_id : ( $post ? $post->ID : null ) );

Expand Down
7 changes: 7 additions & 0 deletions future/includes/class-gv-field-internal.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ class Internal_Field extends Field {
*/
public $field;

/**
* The field type.
*
* @var string
*/
public $type;

/**
* Create self from a configuration array.
*
Expand Down
6 changes: 5 additions & 1 deletion future/includes/class-gv-field.php
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,11 @@ public function get_label( View $view = null, Source $source = null, Entry $entr

/** A custom label is available. */
if ( ! empty( $this->custom_label ) ) {
return \GravityView_API::replace_variables( $this->custom_label, $source ? $source->form ? : null : null, $entry ? $entry->as_entry() : null );
return \GravityView_API::replace_variables(
$this->custom_label,
$source ? $source->form ?? null : null,
$entry ? $entry->as_entry() : null
);
}

return '';
Expand Down
Loading

0 comments on commit df1a8dc

Please sign in to comment.