Skip to content

Commit

Permalink
Merge branch 'release/2.2.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
remcotolsma committed Aug 25, 2017
2 parents 2799807 + a6ea0cd commit b516747
Show file tree
Hide file tree
Showing 64 changed files with 1,895 additions and 1,662 deletions.
48 changes: 48 additions & 0 deletions change_log.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,51 @@
------------------------------------------------------------------------------------------------------------------
Version 2.2.5
- Updated form view recording so that IP isn't included.
- Fixed an issue where the taxonomy returned in the $args by the gform_post_category_args filter is not used when populating the Category field choices.
- Fixed admin field labels being displayed when the form is embedded in an admin page or the front-end via Ajax.
- Fixed the Post Content field validation not checking the submitted value does not exceed the configured maximum characters.
- Fixed PHP notices in the form editor when creating a new form with quotes in the description.
- Fixed content templates being processed during post creation for fields hidden by conditional logic.
- Fixed the forms list views column displaying cached counts for a time after the views have been reset.
- Fixed missing dependency for form_admin.js on gravityforms.js (requires the gform object).
- Fixed JS error caused when 3rd party plugins include conditional_logic.js without genearting a gf_form_conditional_logic variable.
- Fixed a PHP notice which could occur if an array was passed to the rgblank helper function.
- Fixed dynamic population of the Multi Select field failing when multiple choices are passed in the query string.
- Fixed an issue with the redirect confirmation for Ajax enabled forms where the URL is encoded incorrectly.
- AF: Fixed js and css files registered with field enqueue conditions not being included in some situations.
- AF: Fixed js files registered with field enqueue conditions being included when the field is set to administrative which, in some situations, could cause JavaScript errors.

------------------------------------------------------------------------------------------------------------------
Version 2.2.4
- Added security enhancements.
- Added a period to the end of the string that warns when a field is deleted from a form. Done for consistency and translations.
- Added the 'gform_require_login_pre_download' filter allowing login to required to access files using the gf-download links.
- Added "gform_entry_list_action" action that fires after entry actions have been performed on the entry list.
- Added "gform_entry_list_bulk_actions" filter to modify bulk actions available in the entry list.
- Added entry object as fourth parameter to 'gform_pre_send_email' filter.
- Added 'gform_get_entries_args_entry_list' filter to allow filtering the arguments which will be used to fetch entries to display in the Entry List view.
- Added the gform_file_path_pre_delete_file filter allowing files stored outside the /wp-content/uploads/gravity_forms/ directory to be deleted.
- Added "gform_entry_detail_url" filter to modify entry detail URL when replacing entry URL merge tag.
- Updated reCAPTCHA string on Settings page for translations.
- Updated the text AJAX in strings to Ajax to match WordPress standard.
- Fixed a fatal error which could occur in some situations if the RGCurrency class had not been included.
- Fixed an issue with the submission time evaluation of greater/less than conditional logic rules based fields containing non-numeric values.
- Fixed a JavaScript error which could occur with the File Upload field when file selection is cancelled.
- Fixed an issue with the required validation of the other choice input for the Radio Buttons field.
- Fixed TinyMCE displaying an error message in Firefox when the confirmation message is displayed for an AJAX enabled form which includes a Rich Text Editor enabled Paragraph field.
- Fixed an issue where a calculation result could return NAN which would prevent the Save and Continue feature successfully saving the incomplete submission.
- Fixed an issue where merge tag modifiers can remain in the field object and impact display of the field value in other locations such as the entry detail page.
- Fixed an issue with the evaluation of conditional logic rules using the entry value of multi-select fields created with GF2.2+.
- Fixed an inconsistency between the front-end and validation character counts for the Rich Text Editor enabled Paragraph field when the value contains special characters.
- Fixed a PHP notice which can occur when enqueuing the form scripts if the WordPress pre_get_posts filter is being used.
- Fixed an issue where entering 0 in both the hours and minutes inputs of the Time field would result in the field value not being saved.
- Fixed an issue where clicking on a duplicated field in the form editor would not always open the field for editing.
- Fixed issue where email wasn't being sent because content type wasn't being set properly under certain scenarios.
- Fixed an issue with the tab index of the reCAPTCHA field.
- AF: Removed the add new button from the payment add-on feeds list page if the form requires a credit card field to be added before feeds can be configured.
- AF: Fixed the generic map field inserting new fields in the last position instead of the position after the button which was used.
- Reduced the maximum log file size from 100MB to 5MB.

------------------------------------------------------------------------------------------------------------------
Version 2.2.3
- Added security enhancements. Credit: Gennady Kovshenin.
Expand Down
78 changes: 45 additions & 33 deletions common.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,6 @@ public static function format_number( $number, $number_format, $currency = '', $
$currency = GFCommon::get_currency();
}

if ( false === class_exists( 'RGCurrency' ) ) {
require_once( GFCommon::get_base_path() . '/currency.php' );
}
$currency = new RGCurrency( $currency );
$number = $currency->to_money( $number );
} else {
Expand Down Expand Up @@ -228,10 +225,6 @@ public static function clean_number( $number, $number_format = '' ) {
} else if ( $number_format == 'decimal_comma' ) {
$decimal_char = ',';
} else if ( $number_format == 'currency' ) {
if ( ! class_exists( 'RGCurrency' ) ) {
require_once( self::get_base_path() . '/currency.php' );
}

$currency = RGCurrency::get_currency( GFCommon::get_currency() );
$decimal_char = $currency['decimal_separator'];
}
Expand Down Expand Up @@ -1019,7 +1012,20 @@ public static function replace_variables( $text, $form, $lead, $url_encode = fal

// Entry URL.
$entry_url = get_bloginfo( 'wpurl' ) . '/wp-admin/admin.php?page=gf_entries&view=entry&id=' . rgar( $form, 'id' ) . '&lid=' . rgar( $lead, 'id' );
$text = str_replace( '{entry_url}', $url_encode ? urlencode( $entry_url ) : $entry_url, $text );

/**
* Filter the entry URL
*
* Allows for the filtering of the entry_url placeholder to handle situation in which the wpurl might not agree with the admin_url.
*
* @since 2.2.3.14
*
* @param string $entry_url The Entry URL to filter.
* @param array $form The current Form object.
* @param array $lead The current Entry object.
*/
$entry_url = esc_url( apply_filters( 'gform_entry_detail_url', $entry_url, $form, $lead ) );
$text = str_replace( '{entry_url}', $url_encode ? urlencode( $entry_url ) : $entry_url, $text );

// Post ID.
$text = str_replace( '{post_id}', $url_encode ? urlencode( rgar( $lead, 'post_id' ) ) : rgar( $lead, 'post_id' ), $text );
Expand Down Expand Up @@ -1323,6 +1329,9 @@ public static function get_submitted_fields( $form, $lead, $display_empty = fals

$field_value = apply_filters( 'gform_merge_tag_filter', $field_value, $merge_tag, $options, $field, $raw_field_value );

// Clear merge tag modifiers from the field object.
$field->set_modifiers( array() );

if ( $field_value === false ) {
continue;
}
Expand Down Expand Up @@ -1947,7 +1956,8 @@ public static function send_email( $from, $to, $bcc, $reply_to, $subject, $messa
break;

default :
$error = new WP_Error( 'invalid_message_format', "Cannot send email because the message format ({$message_format}) is invalid." );
//When content type is unknown, default to HTML
$content_type = 'text/html';

break;
}
Expand Down Expand Up @@ -2001,7 +2011,21 @@ public static function send_email( $from, $to, $bcc, $reply_to, $subject, $messa
$headers['Content-type'] = "Content-type: {$content_type}; charset=" . get_option( 'blog_charset' );

$abort_email = false;
extract( apply_filters( 'gform_pre_send_email', compact( 'to', 'subject', 'message', 'headers', 'attachments', 'abort_email' ), $message_format, $notification ) );

/**
* Modify the email before a notification has been sent.
* You may also use this to prevent an email from being sent.
*
* @since 2.2.3.8 Added $entry parameter.
* @since 1.9.15.6 Added $notification parameter.
* @since Unknown
*
* @param array $email An array containing the email to address, subject, message, headers, attachments and abort email flag.
* @param string $message_format The message format: html or text.
* @param array $notification The current Notification object.
* @param array $entry The current Entry object.
*/
extract( apply_filters( 'gform_pre_send_email', compact( 'to', 'subject', 'message', 'headers', 'attachments', 'abort_email' ), $message_format, $notification, $entry ) );

$is_success = false;
if ( ! $abort_email ) {
Expand Down Expand Up @@ -3319,10 +3343,6 @@ public static function check_type_and_ext( $file, $file_name = '' ) {
}

public static function to_money( $number, $currency_code = '' ) {
if ( ! class_exists( 'RGCurrency' ) ) {
require_once( 'currency.php' );
}

if ( empty( $currency_code ) ) {
$currency_code = self::get_currency();
}
Expand All @@ -3333,16 +3353,10 @@ public static function to_money( $number, $currency_code = '' ) {
}

public static function to_number( $text, $currency_code = '' ) {
if ( ! class_exists( 'RGCurrency' ) ) {
require_once( 'currency.php' );
}


if ( empty( $currency_code ) ) {
$currency_code = self::get_currency();
}


$currency = new RGCurrency( $currency_code );

return $currency->to_number( $text );
Expand Down Expand Up @@ -4002,7 +4016,7 @@ public static function add_categories_as_choices( $field, $value ) {

$display_all = $field->displayAllCategories;

$args = array( 'hide_empty' => false, 'orderby' => 'name' );
$args = array( 'hide_empty' => false, 'orderby' => 'name', 'taxonomy' => 'category' );

if ( ! $display_all ) {
foreach ( $field->choices as $field_choice_to_include ) {
Expand All @@ -4011,7 +4025,7 @@ public static function add_categories_as_choices( $field, $value ) {
}

$args = gf_apply_filters( array( 'gform_post_category_args', $field->id ), $args, $field );
$terms = get_terms( 'category', $args );
$terms = get_terms( $args['taxonomy'], $args );

$terms_copy = unserialize( serialize( $terms ) ); // deep copy the terms to avoid repeating GFCategoryWalker on previously cached terms.
$walker = new GFCategoryWalker();
Expand Down Expand Up @@ -4130,9 +4144,6 @@ public static function calculate( $field, $form, $lead ) {
$number_format = $field->numberFormat;

if ( empty( $number_format ) ) {
if ( ! class_exists( 'RGCurrency' ) ) {
require_once( GFCommon::get_base_path() . '/currency.php' );
}
$currency = RGCurrency::get_currency( rgar( $lead, 'currency' ) );
$number_format = self::is_currency_decimal_dot( $currency ) ? 'decimal_dot' : 'decimal_comma';
}
Expand Down Expand Up @@ -4166,6 +4177,11 @@ public static function calculate( $field, $form, $lead ) {

$result = apply_filters( 'gform_calculation_result', $result, $formula, $field, $form, $lead );

if ( ! $result || ! is_numeric( $result ) || is_nan( $result ) ) {
GFCommon::log_debug( __METHOD__ . '(): No result or non-numeric result. Returning zero instead.' );
$result = 0;
}

return $result;
}

Expand Down Expand Up @@ -4301,9 +4317,6 @@ public static function echo_if( $condition, $text ) {
}

public static function gf_global( $echo = true ) {

require_once( GFCommon::get_base_path() . '/currency.php' );

$gf_global = array();
$gf_global['gf_currency_config'] = RGCurrency::get_currency( GFCommon::get_currency() );
$gf_global['base_url'] = GFCommon::get_base_url();
Expand All @@ -4320,10 +4333,6 @@ public static function gf_global( $echo = true ) {
}

public static function gf_vars( $echo = true ) {
if ( ! class_exists( 'RGCurrency' ) ) {
require_once( 'currency.php' );
}

$gf_vars = array();
$gf_vars['active'] = esc_attr__( 'Active', 'gravityforms' );
$gf_vars['inactive'] = esc_attr__( 'Inactive', 'gravityforms' );
Expand Down Expand Up @@ -4369,7 +4378,7 @@ public static function gf_vars( $echo = true ) {
$gf_vars['confirmationInvalidPageSelection'] = __( 'Please select a page.', 'gravityforms' );
$gf_vars['confirmationInvalidRedirect'] = __( 'Please enter a URL.', 'gravityforms' );
$gf_vars['confirmationInvalidName'] = __( 'Please enter a confirmation name.', 'gravityforms' );
$gf_vars['confirmationDeleteField'] = __( "Warning! Deleting this field will also delete all entry data associated with it. 'Cancel' to stop. 'OK' to delete", 'gravityforms' );
$gf_vars['confirmationDeleteField'] = __( "Warning! Deleting this field will also delete all entry data associated with it. 'Cancel' to stop. 'OK' to delete.", 'gravityforms' );

$gf_vars['conditionalLogicDependency'] = __( "Warning! This form contains conditional logic dependent upon this field. Deleting this field will deactivate those conditional logic rules and also delete all entry data associated with the field. 'OK' to delete, 'Cancel' to abort.", 'gravityforms' );
$gf_vars['conditionalLogicDependencyChoice'] = __( "This form contains conditional logic dependent upon this choice. Are you sure you want to delete this choice? 'OK' to delete, 'Cancel' to abort.", 'gravityforms' );
Expand Down Expand Up @@ -5348,6 +5357,9 @@ public static function replace_field_variable( $text, $form, $lead, $url_encode,
$value = '';
}

// Clear merge tag modifiers from the field object.
$field->set_modifiers( array() );

if ( $match[0][0] != '{' ) {
// Replace the merge tag in the conditional shortcode merge_tag attr.
$value = str_replace( $match[1], $value, $match[0] );
Expand Down
57 changes: 54 additions & 3 deletions entry_list.php
Original file line number Diff line number Diff line change
Expand Up @@ -640,11 +640,28 @@ function prepare_items() {
$paging = array( 'offset' => $first_item_index, 'page_size' => $page_size );
$total_count = 0;

$entries = GFAPI::get_entries( $form_id, $search_criteria, $sorting, $paging, $total_count );
/**
* Filter the arguments that will be used to fetch entries for display on the Entry List view.
*
* @since 2.2.3.4
*
* @param array $args {
*
* Array of arguments that will be passed to GFAPI::get_entries() to fetch the entries to be displayed.
*
* @var int $form_id The form ID for which entries will be loaded.
* @var array $search_criteria An array of search critiera that will be used to filter entries.
* @var array $sorting An array containing properties that specify how the entries will be sorted.
* @var array $paging An array containing properties that specify how the entries will be paginated.
* }
*/
$args = gf_apply_filters( array( 'gform_get_entries_args_entry_list', $form_id ), compact( 'form_id', 'search_criteria', 'sorting', 'paging' ) );

$entries = GFAPI::get_entries( $args['form_id'], $args['search_criteria'], $args['sorting'], $args['paging'], $total_count );

$this->set_pagination_args( array(
'total_items' => $total_count,
'per_page' => $page_size,
'per_page' => $args['paging']['page_size'],
) );

$this->items = $entries;
Expand Down Expand Up @@ -1166,6 +1183,7 @@ function get_primary_column_name() {
* @return array
*/
function get_bulk_actions() {

$actions = array();

switch ( $this->filter ) {
Expand Down Expand Up @@ -1193,7 +1211,20 @@ function get_bulk_actions() {
$actions['trash'] = esc_html__( 'Trash', 'gravityforms' );
}
}
return $actions;

// Get the current form ID.
$form_id = $this->get_form_id();

/**
* Modifies available bulk actions for the entries list.
*
* @since 2.2.3.12
*
* @param array $actions Bulk actions.
* @param int $form_id The ID of the current form.
*/
return gf_apply_filters( array( 'gform_entry_list_bulk_actions', $form_id ), $actions, $form_id );

}

/**
Expand Down Expand Up @@ -1262,6 +1293,16 @@ function process_action() {
break;

}

/**
* Fires after the default entry list actions have been processed.
*
* @param string $action Action being performed.
* @param array $entries The entry IDs the action is being applied to.
* @param int $form_id The current form ID.
*/
gf_do_action( array( 'gform_entry_list_action', $single_action, $form_id ), $single_action, array( $entry_id ), $form_id );

} elseif ( $bulk_action ) {

$select_all = rgpost( 'all_entries' );
Expand Down Expand Up @@ -1322,6 +1363,16 @@ function process_action() {
break;

}

/**
* Fires after the default entry list actions have been processed.
*
* @param string $action Action being performed.
* @param array $entries The entry IDs the action is being applied to.
* @param int $form_id The current form ID.
*/
gf_do_action( array( 'gform_entry_list_action', $bulk_action, $form_id ), $bulk_action, $entries, $form_id );

}

if ( ! empty( $message ) ) {
Expand Down
2 changes: 0 additions & 2 deletions form_detail.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ function () {
$update_result = self::save_form_info( $form_id, rgpost( 'gform_meta', false ) );
}

require_once( GFCommon::get_base_path() . '/currency.php' );

wp_print_styles( array( 'thickbox' ) );

/* @var GF_Field_Address $gf_address_field */
Expand Down
Loading

0 comments on commit b516747

Please sign in to comment.