Skip to content

Commit

Permalink
Merge pull request #1038 from gravityview/develop
Browse files Browse the repository at this point in the history
2.0.5
  • Loading branch information
zackkatz authored May 16, 2018
2 parents b9ab02c + 4df9efe commit 8a7f170
Show file tree
Hide file tree
Showing 13 changed files with 270 additions and 55 deletions.
4 changes: 4 additions & 0 deletions future/includes/class-gv-renderer-view.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ public function render( View $view, Request $request = null ) {
/** @todo Deprecate this! */
$parameters = \GravityView_frontend::get_view_entries_parameters( $view->settings->as_atts(), $view->form->ID );

global $post;

/** Mock the legacy state for the widgets and whatnot */
\GV\Mocks\Legacy_Context::push( array_merge( array(
'view' => $view,
Expand All @@ -115,6 +117,8 @@ public function render( View $view, Request $request = null ) {
), empty( $parameters ) ? array() : array(
'paging' => $parameters['paging'],
'sorting' => $parameters['sorting'],
), empty( $post ) ? array() : array(
'post' => $post,
) ) );

add_action( 'gravityview/template/after', $view_id_output = function( $context ) {
Expand Down
14 changes: 14 additions & 0 deletions future/includes/class-gv-shortcode-gravityview.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,13 @@ public function callback( $atts, $content = null ) {
* Editing a single entry.
*/
} else if ( ! $is_reembedded && ( $entry = $request->is_edit_entry() ) ) {
/**
* When editing an entry don't render multiple views.
*/
if ( ( $selected = \GV\Utils::_GET( 'gvid' ) ) && $view->ID != $selected ) {
return '';
}

if ( $entry['status'] != 'active' ) {
gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) );
return __( 'You are not allowed to view this content.', 'gravityview' );
Expand All @@ -131,6 +138,13 @@ public function callback( $atts, $content = null ) {
* Viewing a single entry.
*/
} else if ( ! $is_reembedded && ( $entry = $request->is_entry() ) ) {
/**
* When viewing an entry don't render multiple views.
*/
if ( ( $selected = \GV\Utils::_GET( 'gvid' ) ) && $view->ID != $selected ) {
return '';
}

if ( $entry['status'] != 'active' ) {
gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) );
return __( 'You are not allowed to view this content.', 'gravityview' );
Expand Down
2 changes: 1 addition & 1 deletion future/includes/class-gv-template-entry-list.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function the_field( \GV\Field $field, $extras = null ) {

/**
* @filter `gravityview/template/table/entry/hide_empty`
* @param boolean Should the row be hidden if the value is empty? Default: don't hide.
* @param boolean $hide_empty Should the row be hidden if the value is empty? Default: don't hide.
* @param \GV\Template_Context $context The context ;) Love it, cherish it. And don't you dare modify it!
*/
$hide_empty = apply_filters( 'gravityview/render/hide-empty-zone', Utils::get( $extras, 'hide_empty', $this->view->settings->get( 'hide_empty', false ) ), $context );
Expand Down
17 changes: 5 additions & 12 deletions future/includes/class-gv-template-view-table.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,32 +29,25 @@ class View_Table_Template extends View_Template {
*/
public function __construct( View $view, Entry_Collection $entries, Request $request ) {

add_filter( 'gravityview/template/field/label', array( $this, 'add_columns_sort_links' ), 100, 2 );
add_filter( 'gravityview/template/field/label', array( __CLASS__, 'add_columns_sort_links' ), 100, 2 );

parent::__construct( $view, $entries, $request );
}

/**
* @since 2.0.4
*/
public function __destruct() {

remove_filter( 'gravityview/template/field/label', array( $this, 'add_columns_sort_links' ), 100 );

parent::__destruct();
}

/**
* Add sorting links to HTML columns that support sorting
*
* @since 2.0.4
* @since 2.0.5 Made static
*
* @static
*
* @param string $column_label Label for the table column
* @param \GV\Template_Context $context
*
* @return string
*/
public function add_columns_sort_links( $column_label, $context = null ) {
static public function add_columns_sort_links( $column_label, $context = null ) {

$sort_columns = $context->view->settings->get( 'sort_columns' );

Expand Down
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.0.4
* Version: 2.0.5
* Author: GravityView
* Author URI: https://gravityview.co
* Text Domain: gravityview
Expand All @@ -22,7 +22,7 @@
/**
* The plugin version.
*/
define( 'GV_PLUGIN_VERSION', '2.0.4' );
define( 'GV_PLUGIN_VERSION', '2.0.5' );

/**
* Full path to the GravityView file
Expand Down
12 changes: 12 additions & 0 deletions includes/class-admin-welcome.php
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,18 @@ public function changelog_screen() {
</ul>
</div>

<h3> 2.0.5 on May 16, 2018</h3>

<ul>
<li>Fixed: Entry Link fields and <code>[gv_entry_link]</code> shortcode not working properly with DataTables when embedded</li>
<li>Fixed: Do not output other shortcodes in single entry mode</li>
<li>Fixed: Error when deleting an entry</li>
<li>Fixed: When multiple Views are embedded on a page, and one or more has Advanced Filters enabled, no entries will be displayed</li>
<li>Fixed: PHP warning with <code>[gravitypdf]</code> shortcode</li>
<li>Fixed: When multiple table layout Views are embedded on a page, there are multiple column sorting links displayed</li>
<li>Fixed: Error displaying message that a license is expired</li>
</ul>

<h3>2.0.4 on May 12, 2018</h3>

<ul>
Expand Down
26 changes: 11 additions & 15 deletions includes/class-common.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public static function get_form( $form_id ) {
}

// Only get_form_meta is cached. ::facepalm::
if ( class_exists( 'RGFormsModel' ) ) {
if ( class_exists( 'GFFormsModel' ) ) {
return GFFormsModel::get_form_meta( $form_id );
}

Expand Down Expand Up @@ -429,6 +429,7 @@ public static function calculate_get_entries_criteria( $passed_criteria = array(
'sorting' => null,
'paging' => null,
'cache' => (isset( $passed_criteria['cache'] ) ? (bool) $passed_criteria['cache'] : true),
'context_view_id' => null,
);

$criteria = wp_parse_args( $passed_criteria, $search_criteria_defaults );
Expand Down Expand Up @@ -483,20 +484,15 @@ public static function calculate_get_entries_criteria( $passed_criteria = array(
}
}

if ( ! GravityView_frontend::getInstance()->getSingleEntry() ) {
$multiple_original = class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance() && GravityView_View_Data::getInstance()->has_multiple_views();
}

// Calculate the context view id and send it to the advanced filter
if ( GravityView_frontend::getInstance()->getSingleEntry() ) {
$criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id();
} elseif ( $multiple_original ) {
$criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id();
} elseif ( 'delete' === GFForms::get( 'action' ) ) {
$criteria['context_view_id'] = isset( $_GET['view_id'] ) ? intval( $_GET['view_id'] ) : null;
} elseif( !isset( $criteria['context_view_id'] ) ) {
// Prevent overriding the Context View ID: Some widgets could set the context_view_id (e.g. Recent Entries widget)
$criteria['context_view_id'] = null;
if ( empty( $criteria['context_view_id'] ) ) {
// Calculate the context view id and send it to the advanced filter
if ( GravityView_frontend::getInstance()->getSingleEntry() ) {
$criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id();
} else if ( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance() && GravityView_View_Data::getInstance()->has_multiple_views() ) {
$criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id();
} else if ( 'delete' === GFForms::get( 'action' ) ) {
$criteria['context_view_id'] = isset( $_GET['view_id'] ) ? intval( $_GET['view_id'] ) : null;
}
}

/**
Expand Down
3 changes: 1 addition & 2 deletions includes/class-gravityview-entry-link-shortcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ public function delete_shortcode( $atts = array(), $content = null, $context = '
* @return null|string If admin or an error occurred, returns null. Otherwise, returns entry link output. If `$atts['return']` is 'url', the entry link URL. Otherwise, entry link `<a>` HTML tag.
*/
private function shortcode( $atts, $content = null, $context = 'gv_entry_link' ) {

// Don't process when saving post. Keep processing if it's admin-ajax.php
if ( gravityview()->request->is_admin() ) {
return null;
Expand Down Expand Up @@ -234,7 +233,7 @@ private function get_anchor_text( $content = null ) {
private function get_url() {

// if post_id is not defined, default to view_id
$post_id = empty( $this->settings['post_id'] ) ? $this->view_id : absint( $this->settings['post_id'] );
$post_id = empty( $this->settings['post_id'] ) ? null : absint( $this->settings['post_id'] );

switch ( $this->settings['action'] ) {
case 'edit':
Expand Down
2 changes: 1 addition & 1 deletion includes/extensions/delete-entry/class-delete-entry.php
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ public static function get_confirm_dialog() {
* @param array $entry Gravity Forms entry array
* @return boolean|WP_Error True: can edit form. WP_Error: nope.
*/
function user_can_delete_entry( $entry = array(), $view_id ) {
function user_can_delete_entry( $entry = array(), $view_id = null ) {

$error = NULL;

Expand Down
38 changes: 19 additions & 19 deletions languages/gravityview.pot
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# This file is distributed under the GPLv2 or later.
msgid ""
msgstr ""
"Project-Id-Version: GravityView 2.0.3\n"
"Project-Id-Version: GravityView 2.0.5\n"
"Report-Msgid-Bugs-To: https://gravityview.co/support/\n"
"POT-Creation-Date: 2018-05-08 22:37:16+00:00\n"
"MIME-Version: 1.0\n"
Expand Down Expand Up @@ -172,12 +172,12 @@ msgstr ""
#: future/includes/class-gv-oembed.php:204
#: future/includes/class-gv-oembed.php:210
#: future/includes/class-gv-shortcode-gravityview.php:97
#: future/includes/class-gv-shortcode-gravityview.php:112
#: future/includes/class-gv-shortcode-gravityview.php:117
#: future/includes/class-gv-shortcode-gravityview.php:123
#: future/includes/class-gv-shortcode-gravityview.php:136
#: future/includes/class-gv-shortcode-gravityview.php:141
#: future/includes/class-gv-shortcode-gravityview.php:147
#: future/includes/class-gv-shortcode-gravityview.php:119
#: future/includes/class-gv-shortcode-gravityview.php:124
#: future/includes/class-gv-shortcode-gravityview.php:130
#: future/includes/class-gv-shortcode-gravityview.php:150
#: future/includes/class-gv-shortcode-gravityview.php:155
#: future/includes/class-gv-shortcode-gravityview.php:161
#: future/includes/class-gv-view.php:224 future/includes/class-gv-view.php:263
#: future/includes/class-gv-view.php:271 future/includes/class-gv-view.php:278
#: future/includes/class-gv-view.php:287 future/includes/class-gv-view.php:292
Expand Down Expand Up @@ -221,7 +221,7 @@ msgstr ""
#: includes/admin/metaboxes/views/view-configuration.php:6
#: includes/class-frontend-views.php:560
#: includes/class-gravityview-admin-bar.php:104
#: includes/class-gravityview-entry-link-shortcode.php:211
#: includes/class-gravityview-entry-link-shortcode.php:210
#: includes/extensions/edit-entry/class-edit-entry-admin.php:58
#: includes/extensions/edit-entry/class-edit-entry-admin.php:116
#: includes/extensions/edit-entry/class-edit-entry-render.php:898
Expand Down Expand Up @@ -562,12 +562,12 @@ msgid "Sort by field"
msgstr ""

#: future/includes/class-gv-settings-view.php:138
#: includes/class-common.php:1309
#: includes/class-common.php:1305
msgid "Default"
msgstr ""

#: future/includes/class-gv-settings-view.php:139
#: includes/class-common.php:1352
#: includes/class-common.php:1348
#: includes/fields/class-gravityview-field-date-created.php:27
msgid "Date Created"
msgstr ""
Expand Down Expand Up @@ -1482,23 +1482,23 @@ msgstr ""
msgid "What&rsquo;s New"
msgstr ""

#: includes/class-admin-welcome.php:408
#: includes/class-admin-welcome.php:438
msgid "View change history"
msgstr ""

#: includes/class-admin-welcome.php:429
#: includes/class-admin-welcome.php:459
msgid "GravityView is brought to you by:"
msgstr ""

#: includes/class-admin-welcome.php:464
#: includes/class-admin-welcome.php:494
msgid "Contributors"
msgstr ""

#: includes/class-admin-welcome.php:489
#: includes/class-admin-welcome.php:519
msgid "Want to contribute?"
msgstr ""

#: includes/class-admin-welcome.php:490
#: includes/class-admin-welcome.php:520
msgid ""
"If you want to contribute to the code, %syou can on Github%s. If your "
"contributions are accepted, you will be thanked here."
Expand Down Expand Up @@ -1651,13 +1651,13 @@ msgstr ""
msgid "Post ID"
msgstr ""

#: includes/class-common.php:979
#: includes/class-common.php:975
#. translators: %s: relative time from now, used for generic date comparisons.
#. "1 day ago", or "20 seconds ago"
msgid "%s ago"
msgstr ""

#: includes/class-common.php:1462
#: includes/class-common.php:1458
msgid "Email hidden; Javascript is required."
msgstr ""

Expand Down Expand Up @@ -1880,7 +1880,7 @@ msgstr ""
msgid "Reset Entry approval for GravityView"
msgstr ""

#: includes/class-gravityview-entry-link-shortcode.php:214
#: includes/class-gravityview-entry-link-shortcode.php:213
#: includes/extensions/delete-entry/class-delete-entry.php:117
#: includes/extensions/delete-entry/class-delete-entry.php:147
#: includes/extensions/delete-entry/class-delete-entry.php:164
Expand All @@ -1889,7 +1889,7 @@ msgstr ""
msgid "Delete Entry"
msgstr ""

#: includes/class-gravityview-entry-link-shortcode.php:217
#: includes/class-gravityview-entry-link-shortcode.php:216
#: includes/fields/class-gravityview-field-entry-link.php:51
#: templates/deprecated/fields/entry_link.php:16
#: templates/fields/field-entry_link-html.php:12
Expand Down
10 changes: 10 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ Beautifully display your Gravity Forms entries. Learn more on [gravityview.co](h

== Changelog ==

= 2.0.5 on May 16, 2018 =

* Fixed: Entry Link fields and `[gv_entry_link]` shortcode not working properly with DataTables when embedded
* Fixed: Do not output other shortcodes in single entry mode
* Fixed: Error when deleting an entry
* Fixed: When multiple Views are embedded on a page, and one or more has Advanced Filters enabled, no entries will be displayed
* Fixed: PHP warning with `[gravitypdf]` shortcode
* Fixed: When multiple table layout Views are embedded on a page, there are multiple column sorting links displayed
* Fixed: Error displaying message that a license is expired

= 2.0.4 on May 12, 2018 =

* Fixed: Slow front-end performance, affecting all layout types
Expand Down
Loading

0 comments on commit 8a7f170

Please sign in to comment.