Skip to content

Commit

Permalink
Merge pull request #904 from gravityview/develop
Browse files Browse the repository at this point in the history
Version 1.21.5.2
  • Loading branch information
zackkatz committed Jun 26, 2017
2 parents e57dae7 + 56fa65a commit fd214a4
Show file tree
Hide file tree
Showing 103 changed files with 3,459 additions and 3,327 deletions.
15 changes: 15 additions & 0 deletions future/includes/class-gv-entry-gravityforms.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,21 @@ public static function by_id( $entry_id ) {
return null;
}

return self::from_entry( $entry );
}

/**
* Construct a \GV\Entry instance from a Gravity Forms entry array.
*
* @param array $entry The array ID.
*
* @return \GV\Entry|null An instance of this entry or null if not found.
*/
public static function from_entry( $entry ) {
if ( empty( $entry['id'] ) ) {
return null;
}

$self = new self();
$self->entry = $entry;

Expand Down
2 changes: 1 addition & 1 deletion future/includes/class-gv-form-gravityforms.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public function get_entries() {
}

foreach ( \GFAPI::get_entries( $form->ID, $search_criteria, $sorting, $paging ) as $entry ) {
$entries->add( \GV\GF_Entry::by_id( $entry['id'] ) );
$entries->add( \GV\GF_Entry::from_entry( $entry ) );
}

return $entries;
Expand Down
1 change: 1 addition & 0 deletions future/includes/class-gv-settings-view.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ public static function defaults( $detailed = false, $group = null ) {
'desc' => __('Only allow access to this View when embedded using the shortcode.', 'gravityview'),
'type' => 'checkbox',
'value' => '',
'tooltip' => false,
'show_in_shortcode' => false,
'full_width' => true,
),
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: 1.21.5.1
* Version: 1.21.5.2
* Author: GravityView
* Author URI: https://gravityview.co
* Text Domain: gravityview
Expand Down Expand Up @@ -79,7 +79,7 @@
*/
final class GravityView_Plugin {

const version = '1.21.5.1';
const version = '1.21.5.2';

private static $instance;

Expand Down
14 changes: 14 additions & 0 deletions includes/class-admin-welcome.php
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,20 @@ public function changelog_screen() {
<div class="headline-feature" style="max-width: 100%">
<h2 style="border-bottom: 1px solid #ccc; padding-bottom: 1em; margin-bottom: 0;"><?php esc_html_e( 'What&rsquo;s New', 'gravityview' ); ?></h2>
</div>

<h3>1.21.5.2 on June 26, 2017</h3>

<ul>
<li>Tweak: Improved plugin speed by reducing amount of information logged</li>
<li>Fixed: Duplicate descriptions on the settings screen</li>
<li>Fixed: Our &quot;No-Conflict Mode&quot; made the settings screen look bad. Yes, we recognize the irony.</li>
<li>Updated: Translations - thank you, translators!

<ul>
<li>Turkish translation by <a href="https://www.transifex.com/accounts/profile/suhakaralar/">@suhakaralar</a></li>
<li>Dutch translations by Thom</li>
</ul></li>
</ul>

<h3>1.21.5.1 on June 13, 2017</h3>

Expand Down
1 change: 1 addition & 0 deletions includes/class-data.php
Original file line number Diff line number Diff line change
Expand Up @@ -903,6 +903,7 @@ public static function get_default_args( $with_details = false, $group = NULL )
'desc' => __('Only allow access to this View when embedded using the shortcode.', 'gravityview'),
'type' => 'checkbox',
'value' => '',
'tooltip' => false,
'show_in_shortcode' => false,
'full_width' => true,
),
Expand Down
4 changes: 2 additions & 2 deletions includes/class-gravityview-admin-notices.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ public function dismiss_notice() {

$dismissed_notices = array_unique( $dismissed_notices );

// Remind users every 16 weeks
set_transient( 'gravityview_dismissed_notices', $dismissed_notices, WEEK_IN_SECONDS * 16 );
// Remind users every week
set_transient( 'gravityview_dismissed_notices', $dismissed_notices, WEEK_IN_SECONDS );

}

Expand Down
2 changes: 1 addition & 1 deletion includes/class-gravityview-compatibility.php
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ public static function check_gravityforms() {
// Show the notice even if the future version requirements aren't met
self::$notices['gf_version'] = array(
'class' => $class,
'message' => sprintf( __( "%sGravityView requires Gravity Forms Version %s or newer.%s \n\nYou're using Version %s. Please update your Gravity Forms or purchase a license. %sGet Gravity Forms%s - starting at $39%s%s", 'gravityview' ), '<h3>', GV_FUTURE_MIN_GF_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">'.GFCommon::$version.'</span>', "\n\n".'<a href="https://katz.si/gravityforms" class="button button-secondary button-large button-hero">' , '<em>', '</em>', '</a>'),
'message' => sprintf( __( "%sGravityView requires Gravity Forms Version %s or newer.%s \n\nYou're using Version %s. Please update your Gravity Forms or purchase a license. %sGet Gravity Forms%s - starting at $39%s%s", 'gravityview' ), '<h3>', GV_FUTURE_MIN_GF_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">'.GFCommon::$version.'</span>', "\n\n".'<a href="https://gravityview.co/gravityforms/" class="button button-secondary button-large button-hero">' , '<em>', '</em>', '</a>'),
'cap' => 'update_plugins',
'dismiss' => 'gf_version_' . GV_FUTURE_MIN_GF_VERSION,
);
Expand Down
4 changes: 2 additions & 2 deletions includes/class-gravityview-logging.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,10 @@ static function log_error( $message = '', $data = null ) {

if ( class_exists("GFLogging") ) {
GFLogging::include_logger();
GFLogging::log_message( 'gravityview', $function ( $message, true ) . $function ($data, true), KLogger::ERROR );
GFLogging::log_message( 'gravityview', $function ( $message, true ) . $function ( $error, true), KLogger::ERROR );
}
}

}

new GravityView_Logging;
new GravityView_Logging;
22 changes: 21 additions & 1 deletion includes/class-gravityview-roles-capabilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,27 @@ public static function all_caps( $single_role = false, $flat_array = true ) {
*/
public static function has_cap( $caps_to_check = '', $object_id = null, $user_id = null ) {

if( ! is_user_logged_in() || empty( $caps_to_check ) ) {
/**
* @filter `gravityview/capabilities/allow_logged_out` Shall we allow a cap check for non-logged in users?
*
* There are use-cases, albeit strange ones, where we'd like to check and override capabilities for
* for a non-logged in user.
*
* Examples, you ask? https://github.com/gravityview/GravityView/issues/826
*
* @param boolean $allow_logged_out Allow the capability check or bail without even checking. Default: false. Do not allow. Do not pass Go. Do not collect $200.
* @param int|null $object_id (optional) Parameter can be used to check for capabilities against a specific object, such as a post or us.
* @param int|null $user_id (optional) Check the capabilities for a user who is not necessarily the currently logged-in user.
*/
$allow_logged_out = apply_filters( 'gravityview/capabilities/allow_logged_out', false, $caps_to_check, $object_id, $user_id );

/**
* We bail with a negative response without even checking if:
*
* 1. The current user is not logged in and non-logged in users are considered unprivileged (@see `gravityview/capabilities/allow_logged_out` filter).
* 2. If the caps to check are empty.
*/
if ( ( ! is_user_logged_in() && ! $allow_logged_out ) || empty( $caps_to_check ) ) {
return false;
}

Expand Down
48 changes: 33 additions & 15 deletions includes/class-gravityview-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -422,11 +422,6 @@ private function _load_license_handler() {
*/
function license_key_notice() {

// Only show on GravityView pages
if( ! gravityview_is_admin_page() ) {
return;
}

$license_status = self::getSetting('license_key_status');
$license_key = self::getSetting('license_key');
if( '' === $license_key ) {
Expand All @@ -445,7 +440,8 @@ function license_key_notice() {
$status = '';
$update_below = false;
$primary_button_link = admin_url( 'edit.php?post_type=gravityview&amp;page=gravityview_settings' );
switch ( $license_status ) {

switch ( $license_status ) {
/** @since 1.17 */
case 'expired':
$title = __('Expired License', 'gravityview');
Expand Down Expand Up @@ -482,11 +478,11 @@ function license_key_notice() {
if( !empty( $status ) ) {
GravityView_Admin_Notices::add_notice( array(
'message' => $message,
'class' => 'updated',
'title' => $title,
'cap' => 'gravityview_edit_settings',
'dismiss' => sha1( $license_status.'_'.$license_id ),
));
'class' => 'updated',
'title' => $title,
'cap' => 'gravityview_edit_settings',
'dismiss' => sha1( $license_status . '_' . $license_id . '_' . date( 'z' ) ), // Show every day, instead of every 8 weeks (which is the default)
) );
}
}

Expand Down Expand Up @@ -527,6 +523,7 @@ public function styles() {
'src' => plugins_url( 'assets/css/admin-settings.css', GRAVITYVIEW_FILE ),
'version' => GravityView_Plugin::version,
"deps" => array(
'gform_admin',
'gaddon_form_settings_css',
'gform_tooltip',
'gform_font_awesome',
Expand Down Expand Up @@ -764,6 +761,29 @@ public function settings_save( $field, $echo = true ) {
}


/**
* Keep GravityView styling for `$field['description']`, even though Gravity Forms added support for it
*
* Converts `$field['description']` to `$field['gv_description']`
* Converts `$field['subtitle']` to `$field['description']`
*
* @see GravityView_Settings::single_setting_label Converts `gv_description` back to `description`
* @see http://share.gravityview.co/P28uGp/2OIRKxog for image that shows subtitle vs description
*
* @since 1.21.5.2
*
* @param array $field
*
* @return void
*/
public function single_setting_row( $field ) {

$field['gv_description'] = rgar( $field, 'description' );
$field['description'] = rgar( $field, 'subtitle' );

parent::single_setting_row( $field );
}

/**
* The same as the parent, except added support for field descriptions
* @inheritDoc
Expand All @@ -773,11 +793,9 @@ public function single_setting_label( $field ) {

parent::single_setting_label( $field );

// Added by GravityView
if ( isset( $field['description'] ) ) {
echo '<span class="description">'. $field['description'] .'</span>';
if ( $description = rgar( $field, 'gv_description' ) ) {
echo '<span class="description">'. $description .'</span>';
}

}

/**
Expand Down
5 changes: 4 additions & 1 deletion includes/class-gv-license-handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -647,11 +647,14 @@ public function license_call( $array = array() ) {

$is_check_action_button = ( 'check_license' === $data['edd_action'] && defined( 'DOING_AJAX' ) && DOING_AJAX );

if( $is_check_action_button ) {
delete_transient( self::status_transient_key );
}
// Failed is the response from trying to de-activate a license and it didn't work.
// This likely happened because people entered in a different key and clicked "Deactivate",
// meaning to deactivate the original key. We don't want to save this response, since it is
// most likely a mistake.
if ( $license_data->license !== 'failed' && ! $is_check_action_button && $update_license ) {
else if ( $license_data->license !== 'failed' && $update_license ) {

if ( ! empty( $data['field_id'] ) ) {
set_transient( self::status_transient_key, $license_data, DAY_IN_SECONDS );
Expand Down
2 changes: 1 addition & 1 deletion includes/fields/class-gravityview-field-source-url.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function field_options( $field_options, $template_id, $field_id, $context, $inpu
$add_options['source_link_text'] = array(
'type' => 'text',
'label' => __( 'Link Text:', 'gravityview' ),
'desc' => __('Customize the link text. If empty, the link text will be the the URL.', 'gravityview'),
'desc' => __('Customize the link text. If empty, the link text will be the URL.', 'gravityview'),
'value' => NULL,
'merge_tags' => true,
);
Expand Down
Binary file modified languages/gravityview-ady.mo
Binary file not shown.
Loading

0 comments on commit fd214a4

Please sign in to comment.