Skip to content

Commit

Permalink
Updates to 2.8.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Gravity Forms committed Feb 2, 2024
1 parent ab6795b commit 69d467a
Show file tree
Hide file tree
Showing 7 changed files with 130 additions and 38 deletions.
6 changes: 6 additions & 0 deletions change_log.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
### 2.8.3 | 2024-02-01
- Added telemetry data points.
- Fixed an issue where the honeypot was not working on forms using the Stripe Field with additional payment methods enabled.
- Fixed an issue where under certain conditions, an error saying "undefined index 'page_instance'" is shown when rendering a form.
- AF: Updated the Settings API so that form meta saved in a settings field save callback will not be lost.

### 2.8.2 | 2024-01-18
- Added security enhancements.
- Fixed an issue where the datepicker does not work in the repeater field.
Expand Down
4 changes: 2 additions & 2 deletions gravityforms.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Plugin Name: Gravity Forms
Plugin URI: https://gravityforms.com
Description: Easily create web forms and manage form entries within the WordPress admin.
Version: 2.8.2
Version: 2.8.3
Requires at least: 4.0
Requires PHP: 5.6
Author: Gravity Forms
Expand Down Expand Up @@ -245,7 +245,7 @@ class GFForms {
*
* @var string $version The version number.
*/
public static $version = '2.8.2';
public static $version = '2.8.3';

/**
* Handles background upgrade tasks.
Expand Down
11 changes: 9 additions & 2 deletions includes/addon/class-gf-addon.php
Original file line number Diff line number Diff line change
Expand Up @@ -1242,14 +1242,14 @@ public function theme_layer_third_party_styles( $form_id, $settings, $block_sett
public function output_third_party_styles( $markup, $form ) {
$settings = $this->get_current_settings();
$all_block_settings = apply_filters( 'gform_form_block_attribute_values', array() );
$block_settings = isset( $all_block_settings[ $form['id'] ][ $form['page_instance'] ] ) ? $all_block_settings[ $form['id'] ][ $form['page_instance'] ] : array();
$page_instance = isset( $form['page_instance'] ) ? $form['page_instance'] : 0;
$block_settings = isset( $all_block_settings[ $form['id'] ][ $page_instance ] ) ? $all_block_settings[ $form['id'] ][ $page_instance ] : array();
$properties = call_user_func_array( array( $this, 'theme_layer_third_party_styles' ), array( $form['id'], $settings, $block_settings ) );

if ( empty( $properties ) ) {
return $markup;
}

$page_instance = isset( $form['page_instance'] ) ? $form['page_instance'] : 0;
$base_identifier = sprintf( 'gform.extensions.styles.%s', $this->get_slug() );
$form_identifier = sprintf( 'gform.extensions.styles.%s[%s]', $this->get_slug(), $form['id'] );
$full_identifier = sprintf( 'gform.extensions.styles.%s[%s][%s]', $this->get_slug(), $form['id'], $page_instance );
Expand Down Expand Up @@ -4331,6 +4331,13 @@ public function maybe_save_form_settings( $form ) {
* @return true|false True on success or false on error
*/
public function save_form_settings( $form, $settings ) {
$existing_meta = GFFormsModel::get_form_meta( $form['id'] );
$existing_settings = rgar( $existing_meta, $this->_slug );

if ( is_array( $existing_settings ) ) {
$settings = array_merge( $existing_settings, $settings );
}

$form[ $this->_slug ] = $settings;
$result = GFFormsModel::update_form_meta( $form['id'], $form );

Expand Down
3 changes: 2 additions & 1 deletion includes/honeypot/class-gf-honeypot-handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,8 @@ public function is_honeypot_enabled( $form ) {
// 1- honeypot is not enabled by this form in form settings.
// 2- the form is submitted from preview.
// 3- the form is submitted from the WP dashboard.
$is_disabled = ! rgar( $form, 'enableHoneypot' ) || \GFCommon::is_preview() || is_admin();
$is_wp_dashboard = is_admin() && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX );
$is_disabled = ! rgar( $form, 'enableHoneypot' ) || \GFCommon::is_preview() || $is_wp_dashboard;

return ! $is_disabled;
}
Expand Down
20 changes: 20 additions & 0 deletions includes/telemetry/class-gf-telemetry-data.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,31 @@ abstract class GF_Telemetry_Data {
*/
public $key = '';

/**
* @var bool $data_collection Whether data collection is allowed.
*/
public $data_collection = '';

/**
* @var string
*/
const TELEMETRY_ENDPOINT = 'https://in.gravity.io/';

public function __construct() {
$this->data_collection = $this->is_data_collection_allowed();
}

/**
* Determine if the user has allowed data collection.
*
* @since 2.8.3
*
* @return false|mixed|null
*/
public function is_data_collection_allowed() {
return get_option( 'rg_gforms_dataCollection', false );
}

/**
* Get the current telemetry data.
*
Expand Down
58 changes: 58 additions & 0 deletions includes/telemetry/class-gf-telemetry-snapshot-data.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,16 @@ class GF_Telemetry_Snapshot_Data extends GF_Telemetry_Data {
public $key = 'snapshot';

public function __construct() {
parent::__construct();
/**
* Array of callback functions returning an array of data to be included in the telemetry snapshot.
*
* @since 2.8
*/
$callbacks = array(
array( $this, 'get_site_basic_info' ),
array( $this, 'get_gf_settings' ),
array( $this, 'get_legacy_forms' ),
);

// Merges the default callbacks with any additional callbacks added via the gform_telemetry_snapshot_data filter. Default callbacks are added last so they can't be overridden.
Expand Down Expand Up @@ -101,6 +104,7 @@ public function get_site_basic_info() {
$meta_counts = GFFormsModel::get_entry_meta_counts();
$im = is_multisite();
$lang = get_locale();
$db = GFCommon::get_dbms_type();

$post = array(
'key' => GFCommon::get_key(),
Expand All @@ -122,6 +126,7 @@ public function get_site_basic_info() {
'entry_details_count' => $meta_counts['details'],
'entry_notes_count' => $meta_counts['notes'],
'lang' => $lang,
'db' => $db,
);

$installation_telemetry = array(
Expand All @@ -146,6 +151,59 @@ public function get_site_basic_info() {
return $post;
}

/**
* Collect the data from the Gravity Forms settings page
*
* @since 2.8.3
*
* @return array
*/
public function get_gf_settings() {
if ( ! $this->data_collection ) {
return array();
}

$gform_settings = array();

$settings_keys = array(
'gform_enable_logging',
'rg_gforms_default_theme',
'gform_enable_toolbar_menu',
'gform_enable_noconflict',
);

foreach ( $settings_keys as $key ) {
$gform_settings[ $key ] = get_option( $key );
}

return $gform_settings;
}

/**
* Count the number of forms with legacy mode enabled.
*
* @since 2.8.3
*
* @return array
*/
public function get_legacy_forms() {
if ( ! $this->data_collection ) {
return array();
}

$legacy_forms = 0;

$forms = GFFormsModel::get_forms();
foreach ( $forms as $form ) {
// if form has legacy mode enabled, add it to the total
if ( GFCommon::is_legacy_markup_enabled( $form->id ) ) {
$legacy_forms++;
}
}

return array( 'legacy_forms' => $legacy_forms );
}

/**
* Stores the response from the version.php endpoint, to be used by the license service.
*
Expand Down
66 changes: 33 additions & 33 deletions languages/gravityforms.pot
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
# This file is distributed under the GPL-2.0+.
msgid ""
msgstr ""
"Project-Id-Version: Gravity Forms 2.8.2\n"
"Project-Id-Version: Gravity Forms 2.8.3\n"
"Report-Msgid-Bugs-To: https://gravityforms.com/support\n"
"Last-Translator: Gravity Forms <support@gravityforms.com>\n"
"Language-Team: Gravity Forms <support@gravityforms.com>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"POT-Creation-Date: 2024-01-18T18:37:57+00:00\n"
"POT-Creation-Date: 2024-02-01T17:51:03+00:00\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"X-Generator: WP-CLI 2.8.1\n"
"X-Domain: gravityforms\n"
Expand Down Expand Up @@ -5061,10 +5061,10 @@ msgstr ""
#: gravityforms.php:2274
#: gravityforms.php:5350
#: gravityforms.php:5636
#: includes/addon/class-gf-addon.php:4504
#: includes/addon/class-gf-addon.php:4782
#: includes/addon/class-gf-addon.php:4955
#: includes/addon/class-gf-addon.php:5388
#: includes/addon/class-gf-addon.php:4511
#: includes/addon/class-gf-addon.php:4789
#: includes/addon/class-gf-addon.php:4962
#: includes/addon/class-gf-addon.php:5395
#: includes/class-gf-osdxp.php:27
#: includes/fields/class-gf-field.php:1615
#: includes/system-status/class-gf-update.php:75
Expand Down Expand Up @@ -5509,8 +5509,8 @@ msgid "GF Add-Ons"
msgstr ""

#: includes/addon/class-gf-addon.php:1651
#: includes/addon/class-gf-addon.php:4967
#: includes/addon/class-gf-addon.php:5322
#: includes/addon/class-gf-addon.php:4974
#: includes/addon/class-gf-addon.php:5329
#: settings.php:1294
msgid "Uninstall"
msgstr ""
Expand All @@ -5532,8 +5532,8 @@ msgid "Gravity Forms Add-Ons"
msgstr ""

#: includes/addon/class-gf-addon.php:1796
#: includes/addon/class-gf-addon.php:4843
#: includes/addon/class-gf-addon.php:5148
#: includes/addon/class-gf-addon.php:4850
#: includes/addon/class-gf-addon.php:5155
#: includes/addon/class-gf-feed-addon.php:1823
msgid "%s Settings"
msgstr ""
Expand Down Expand Up @@ -5643,79 +5643,79 @@ msgstr ""
msgid "Unable to render form settings."
msgstr ""

#: includes/addon/class-gf-addon.php:4630
#: includes/addon/class-gf-addon.php:4636
#: includes/addon/class-gf-addon.php:4637
#: includes/addon/class-gf-addon.php:4643
msgid "You don't have adequate permission to view this page"
msgstr ""

#: includes/addon/class-gf-addon.php:4798
#: includes/addon/class-gf-addon.php:4805
msgid "This add-on needs to be updated. Please contact the developer."
msgstr ""

#: includes/addon/class-gf-addon.php:4812
#: includes/addon/class-gf-addon.php:4985
#: includes/addon/class-gf-addon.php:5106
#: includes/addon/class-gf-addon.php:4819
#: includes/addon/class-gf-addon.php:4992
#: includes/addon/class-gf-addon.php:5113
msgid "%s has been successfully uninstalled. It can be re-activated from the %splugins page%s."
msgstr ""

#: includes/addon/class-gf-addon.php:4996
#: includes/addon/class-gf-addon.php:5010
#: includes/addon/class-gf-addon.php:5320
#: includes/addon/class-gf-addon.php:5003
#: includes/addon/class-gf-addon.php:5017
#: includes/addon/class-gf-addon.php:5327
msgid "Uninstall %s"
msgstr ""

#: includes/addon/class-gf-addon.php:5002
#: includes/addon/class-gf-addon.php:5009
msgid "Warning"
msgstr ""

#: includes/addon/class-gf-addon.php:5217
#: includes/addon/class-gf-addon.php:5224
msgid "You don't have sufficient permissions to update the settings."
msgstr ""

#: includes/addon/class-gf-addon.php:5285
#: includes/addon/class-gf-addon.php:5292
msgid "This operation deletes ALL %s settings."
msgstr ""

#: includes/addon/class-gf-addon.php:5315
#: includes/addon/class-gf-addon.php:5382
#: includes/addon/class-gf-addon.php:5322
#: includes/addon/class-gf-addon.php:5389
msgid "%s"
msgstr ""

#: includes/addon/class-gf-addon.php:5333
#: includes/addon/class-gf-addon.php:5340
msgid "Uninstall %s Add-On"
msgstr ""

#: includes/addon/class-gf-addon.php:5352
#: includes/addon/class-gf-addon.php:5359
msgid "Uninstall Add-On"
msgstr ""

#: includes/addon/class-gf-addon.php:5383
#: includes/addon/class-gf-addon.php:5390
msgid "To continue uninstalling this add-on click the settings button."
msgstr ""

#: includes/addon/class-gf-addon.php:5397
#: includes/addon/class-gf-addon.php:5404
msgid "%sThis operation deletes ALL %s settings%s. If you continue, you will NOT be able to retrieve these settings."
msgstr ""

#: includes/addon/class-gf-addon.php:5401
#: includes/addon/class-gf-addon.php:5408
msgid "Warning! ALL %s settings will be deleted. This cannot be undone. 'OK' to delete, 'Cancel' to stop"
msgstr ""

#: includes/addon/class-gf-addon.php:5427
#: includes/addon/class-gf-addon.php:5434
msgid "You don't have adequate permission to uninstall this add-on: "
msgstr ""

#: includes/addon/class-gf-addon.php:5533
#: includes/addon/class-gf-addon.php:5540
#: includes/addon/class-gf-auto-upgrade.php:66
msgid "Gravity Forms %s is required. Activate it now or %spurchase it today!%s"
msgstr ""

#: includes/addon/class-gf-addon.php:5546
#: includes/addon/class-gf-addon.php:5553
msgid "Some features of the add-on are not available on the current version of Gravity Forms. Please update to the latest Gravity Forms version for full compatibility."
msgstr ""

#. translators: 1: Add-on title
#: includes/addon/class-gf-addon.php:6118
#: includes/addon/class-gf-addon.php:6125
msgid "Some features of the %1$s Add-on are not available on this version of Gravity Forms. Please update to the latest version for full compatibility."
msgstr ""

Expand Down

0 comments on commit 69d467a

Please sign in to comment.