diff --git a/experimental/gpdtc-recalc.php b/experimental/gpdtc-recalc.php
index 8e3b24f8a..2a2f4ba9d 100644
--- a/experimental/gpdtc-recalc.php
+++ b/experimental/gpdtc-recalc.php
@@ -3,7 +3,7 @@
* Re-calculate a GPDTC calculated field dynamically every time it's viewed.
*/
add_action( 'wp_loaded', function() {
- $form_id = 13; // Change this to the form's ID
+ $form_id = 13; // Change this to the form's ID
$field_id = 132; // Change this to the Age's field ID
if ( class_exists( 'GP_Date_Time_Calculator' ) ) {
$values = array();
diff --git a/experimental/gpepee-conditional-edit.php b/experimental/gpepee-conditional-edit.php
index bffde7929..ec1294d24 100644
--- a/experimental/gpepee-conditional-edit.php
+++ b/experimental/gpepee-conditional-edit.php
@@ -2,8 +2,8 @@
/**
* Gravity Perks // Easy Passthrough Edit Entry // Conditional Edit
* https://gravitywiz.com/edit-gravity-forms-entries-on-the-front-end/
- *
- * Create a field on your form and check for a specific value on that field to determine if the passed
+ *
+ * Create a field on your form and check for a specific value on that field to determine if the passed
* through entry should be edited or if a new entry should be created.
*/
// Update "123" to the form you are using to edit entries.
diff --git a/experimental/gpi-auto-selections.php b/experimental/gpi-auto-selections.php
index 49145ff4d..04ccc0647 100644
--- a/experimental/gpi-auto-selections.php
+++ b/experimental/gpi-auto-selections.php
@@ -5,8 +5,8 @@
*/
global $gpias_form_id, $gpias_list_field_id, $gpias_product_field_id;
-$gpias_form_id = 123;
-$gpias_list_field_id = 4;
+$gpias_form_id = 123;
+$gpias_list_field_id = 4;
$gpias_product_field_id = 5;
add_filter( "gform_column_input_{$gpias_form_id}_{$gpias_list_field_id}_1", function( $input_info, $field, $column, $value, $form_id ) {
@@ -32,7 +32,7 @@
global $gpias_list_field_id, $gpias_product_field_id;
$list_field = GFAPI::get_field( $form, $gpias_list_field_id );
- $booths = $list_field->get_value_submission( array() );
+ $booths = $list_field->get_value_submission( array() );
foreach ( $form['fields'] as $field ) {
@@ -42,13 +42,16 @@
while ( ! empty( $booths ) ) {
- $booth = array_shift( $booths );
- $_POST["input_{$field->id}"] = $booth;
+ $booth = array_shift( $booths );
+ $_POST[ "input_{$field->id}" ] = $booth;
- $_fields = $form['fields'];
+ $_fields = $form['fields'];
$form['fields'] = array( $field );
- $result = gp_inventory_type_choices()->validation( array( 'is_valid' => true, 'form' => $form ) );
+ $result = gp_inventory_type_choices()->validation( array(
+ 'is_valid' => true,
+ 'form' => $form,
+ ) );
$form['fields'] = $_fields;
@@ -56,14 +59,12 @@
$field->failed_validation = false;
return $form;
}
-
}
if ( empty( $booths ) ) {
- $list_field->failed_validation = true;
+ $list_field->failed_validation = true;
$list_field->validation_message = 'None of your selected booths are available.';
}
-
}
return $form;
diff --git a/experimental/gpi-packaged-products.php b/experimental/gpi-packaged-products.php
index b6b07039c..f5c29ef5f 100644
--- a/experimental/gpi-packaged-products.php
+++ b/experimental/gpi-packaged-products.php
@@ -46,17 +46,17 @@ public function __construct( $args = array() ) {
public function init() {
add_filter( 'gpi_claimed_inventory_' . $this->form_id, array(
$this,
- 'package_field_claimed_inventory'
+ 'package_field_claimed_inventory',
), 10, 2 );
add_filter( 'gpi_claimed_inventory_' . $this->form_id, array(
$this,
- 'add_claimed_package_inventory_to_individual_products'
+ 'add_claimed_package_inventory_to_individual_products',
), 10, 2 );
add_filter( 'gpi_requested_quantity_' . $this->form_id, array(
$this,
- 'add_requested_packages_to_individual_products'
+ 'add_requested_packages_to_individual_products',
), 10, 2 );
}
@@ -70,7 +70,7 @@ public function package_field_claimed_inventory( $package_claimed_inventory, $fi
remove_filter( 'gpi_claimed_inventory_' . $this->form_id, array(
$this,
- 'add_claimed_package_inventory_to_individual_products'
+ 'add_claimed_package_inventory_to_individual_products',
) );
$inventory_limit = gp_inventory_type_advanced()->get_stock_quantity( $this->package_field );
@@ -92,7 +92,7 @@ public function package_field_claimed_inventory( $package_claimed_inventory, $fi
add_filter( 'gpi_claimed_inventory_' . $this->form_id, array(
$this,
- 'add_claimed_package_inventory_to_individual_products'
+ 'add_claimed_package_inventory_to_individual_products',
), 10, 2 );
return $package_claimed_inventory;
@@ -108,14 +108,14 @@ public function add_claimed_package_inventory_to_individual_products( $claimed_i
remove_filter( 'gpi_claimed_inventory_' . $this->form_id, array(
$this,
- 'package_field_claimed_inventory'
+ 'package_field_claimed_inventory',
) );
$claimed_packages_inventory = gp_inventory_type_advanced()->get_claimed_inventory( $this->package_field );
add_filter( 'gpi_claimed_inventory_' . $this->form_id, array(
$this,
- 'package_field_claimed_inventory'
+ 'package_field_claimed_inventory',
), 10, 2 );
return (int) $claimed_inventory + (int) $claimed_packages_inventory;
@@ -142,5 +142,5 @@ public function add_requested_packages_to_individual_products( $requested_quanti
new GP_Inventory_Packaged_Products( array(
'form_id' => 2,
'package_field_id' => 4,
- 'field_ids_in_package' => array( 1, 2 )
+ 'field_ids_in_package' => array( 1, 2 ),
) );
diff --git a/experimental/gpml-auto-add-terms.php b/experimental/gpml-auto-add-terms.php
index 26fadf8f3..34b242c33 100644
--- a/experimental/gpml-auto-add-terms.php
+++ b/experimental/gpml-auto-add-terms.php
@@ -1,21 +1,21 @@
array(
'Red',
'Green',
- 'Blue'
+ 'Blue',
),
'post_tag' => array(
'Small',
'Medium',
- 'Large'
- )
+ 'Large',
+ ),
);
$gpml_media_data['post_data']['tax_input'] = $terms;
return $gpml_media_data;
diff --git a/experimental/gpnf-exclude-gf-inline-scripts-from-cloudflare-rocket-loader.php b/experimental/gpnf-exclude-gf-inline-scripts-from-cloudflare-rocket-loader.php
index be968360a..e813dc79b 100644
--- a/experimental/gpnf-exclude-gf-inline-scripts-from-cloudflare-rocket-loader.php
+++ b/experimental/gpnf-exclude-gf-inline-scripts-from-cloudflare-rocket-loader.php
@@ -5,7 +5,7 @@
*/
add_filter( 'wp_inline_script_attributes', function ( $attributes, $javascript ) {
if ( strpos( $javascript, 'gform.' ) ) {
- $attributes['data-cfasync'] = 'false';
+ $attributes['data-cfasync'] = 'false';
}
return $attributes;
}, 10, 2 );
diff --git a/experimental/gppa-acf-populate-multiple-items-from-repeater-row.php b/experimental/gppa-acf-populate-multiple-items-from-repeater-row.php
index 8217cf4d9..a1a809ec3 100644
--- a/experimental/gppa-acf-populate-multiple-items-from-repeater-row.php
+++ b/experimental/gppa-acf-populate-multiple-items-from-repeater-row.php
@@ -7,8 +7,8 @@
add_filter( 'gppa_input_choices_123_4', function( $choices, $field, $objects ) {
$filtered = array();
foreach ( $choices as $choice ) {
- $index = explode( '_', $choice['object']['meta_key'] )[1];
- $is_available = (bool) get_post_meta( $choice['object']['post_id'],substr( $choice['object']['meta_key'], 0, -5 ) . 'tillganglighet', true );
+ $index = explode( '_', $choice['object']['meta_key'] )[1];
+ $is_available = (bool) get_post_meta( $choice['object']['post_id'], substr( $choice['object']['meta_key'], 0, -5 ) . 'tillganglighet', true );
if ( $is_available ) {
$title = get_post_meta( $choice['object']['post_id'], "plats_{$index}_plats_och_datum_plats", true );
$choice['text'] .= sprintf( ' (%s)', $title );
diff --git a/experimental/gppa-enable-choice-values-for-gravity-view.php b/experimental/gppa-enable-choice-values-for-gravity-view.php
index 178c6a82d..3b6525de8 100644
--- a/experimental/gppa-enable-choice-values-for-gravity-view.php
+++ b/experimental/gppa-enable-choice-values-for-gravity-view.php
@@ -1,8 +1,8 @@
enableChoiceValue = true;
}
}
-
+
return $form;
} );
diff --git a/experimental/gppa-gv-display-field-value.php b/experimental/gppa-gv-display-field-value.php
index 4bcab643b..3210789c4 100644
--- a/experimental/gppa-gv-display-field-value.php
+++ b/experimental/gppa-gv-display-field-value.php
@@ -7,7 +7,7 @@
// Update "123" to your form ID. Update to "4", "5", and "6" to your field IDs.
$targets = array(
- 123 => array( 4, 5, 6 )
+ 123 => array( 4, 5, 6 ),
);
if ( ! function_exists( 'gravityview' ) || ! gravityview()->request->is_view() ) {
diff --git a/experimental/gppa-multi-file-value-as-links.php b/experimental/gppa-multi-file-value-as-links.php
index ed6ea265e..c032ab52b 100644
--- a/experimental/gppa-multi-file-value-as-links.php
+++ b/experimental/gppa-multi-file-value-as-links.php
@@ -2,16 +2,16 @@
/**
* Gravity Perks // Populate Anything // Format Comma-delimited List of Files as Links
* https://gravitywiz.com/documentation/gravity-forms-populate-anything/
- *
+ *
* Populate a Single Line Text field with the value of a Multi-file Upload field and then use this snippet to display
* the file URLs as links instead of plain text.
*/
// Update "123" to your form ID and "4" to the field ID being populated with your file URLs.
add_filter( 'gppa_live_merge_tag_value_348_2', function( $merge_tag_match_value, $merge_tag, $form, $field_id, $entry_values ) {
- $urls = explode( ', ', $merge_tag_match_value );
+ $urls = explode( ', ', $merge_tag_match_value );
$links = array();
foreach ( $urls as $url ) {
$links[] = sprintf( '%s', $url, basename( $url ) );
}
- return implode( "
", $links );
+ return implode( '
', $links );
}, 10, 5 );
diff --git a/experimental/gppa-object-type-acf-options-page.php b/experimental/gppa-object-type-acf-options-page.php
index 5b2363788..4ac80185d 100644
--- a/experimental/gppa-object-type-acf-options-page.php
+++ b/experimental/gppa-object-type-acf-options-page.php
@@ -7,7 +7,7 @@
* Advanced Custom Fields. For more on Options Pages, see https://www.advancedcustomfields.com/resources/options-page/
*
* Installation: https://gravitywiz.com/documentation/how-do-i-install-a-snippet/
- *
+ *
* Known Limitations:
* * Filtering is not supported with this Object Type
*/
@@ -29,24 +29,24 @@ public function get_options_pages() {
}
public function get_properties( $options_page = null ) {
- $field_groups = acf_get_field_groups(array(
- 'options_page' => $options_page
- ));
+ $field_groups = acf_get_field_groups(array(
+ 'options_page' => $options_page,
+ ));
- $properties = array();
+ $properties = array();
- foreach ( $field_groups as $field_group ) {
- $fields = acf_get_fields( $field_group );
+ foreach ( $field_groups as $field_group ) {
+ $fields = acf_get_fields( $field_group );
- foreach ( $fields as $field ) {
- $properties[ $field['name'] ] = array(
- 'value' => $field['name'],
- 'label' => $field['label'],
- 'callable' => '__return_false',
- 'orderby' => false,
- );
- }
- }
+ foreach ( $fields as $field ) {
+ $properties[ $field['name'] ] = array(
+ 'value' => $field['name'],
+ 'label' => $field['label'],
+ 'callable' => '__return_false',
+ 'orderby' => false,
+ );
+ }
+ }
return $properties;
}
diff --git a/experimental/gppa-populate-date-in-fields-format.php b/experimental/gppa-populate-date-in-fields-format.php
index 0b31aa64b..13cbdd274 100644
--- a/experimental/gppa-populate-date-in-fields-format.php
+++ b/experimental/gppa-populate-date-in-fields-format.php
@@ -6,14 +6,14 @@
add_filter( 'gppa_process_template_value', function( $value, $field ) {
if ( $field->get_input_type() === 'date' && $field->dateType === 'datepicker' ) {
list( $format, $separator ) = array_pad( explode( '_', $field->dateFormat ), 2, 'slash' );
- $separators = array(
+ $separators = array(
'slash' => '/',
'dash' => '-',
'dot' => '.',
);
- $format = str_replace( 'y', 'Y', $format );
- $format = implode( $separators[ $separator ], str_split( $format ) );
- $value = date( $format, strtotime( $value ) );
+ $format = str_replace( 'y', 'Y', $format );
+ $format = implode( $separators[ $separator ], str_split( $format ) );
+ $value = date( $format, strtotime( $value ) );
}
return $value;
}, 10, 2 );
diff --git a/experimental/gppa-wc-country-to-gf-address-field.php b/experimental/gppa-wc-country-to-gf-address-field.php
index 221d71fcb..063f8c9d8 100644
--- a/experimental/gppa-wc-country-to-gf-address-field.php
+++ b/experimental/gppa-wc-country-to-gf-address-field.php
@@ -6,7 +6,7 @@
// Update "26" to your Address field ID. Leave the ".6" alone.
add_filter( 'gppa_process_template_26.6', function( $template_value, $field, $template_name, $populate, $object, $object_type, $objects, $template ) {
if ( $template === 'meta_billing_country' ) {
- $countries = GF_Fields::get( 'address' )->get_default_countries();
+ $countries = GF_Fields::get( 'address' )->get_default_countries();
$template_value = rgar( $countries, $template_value, $template_value );
}
return $template_value;
diff --git a/experimental/gppa-woo-commerce-lmt.php b/experimental/gppa-woo-commerce-lmt.php
index 5bfabec15..e5bbdccc9 100644
--- a/experimental/gppa-woo-commerce-lmt.php
+++ b/experimental/gppa-woo-commerce-lmt.php
@@ -4,11 +4,13 @@
* See: https://secure.helpscout.net/conversation/1520295750/24633?folderId=3808239
*/
add_action( 'wp', function() {
- if ( ! function_exists('WC' ) || ( ! is_cart() && ! is_checkout() ) ) return;
+ if ( ! function_exists( 'WC' ) || ( ! is_cart() && ! is_checkout() ) ) {
+ return;
+ }
foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
- add_filter( 'gform_pre_render', function( $form ) use ($cart_item) {
+ add_filter( 'gform_pre_render', function( $form ) use ( $cart_item ) {
$gravity_form_data = $cart_item['_gravity_form_data'];
- $form_meta = RGFormsModel::get_form_meta( $gravity_form_data['id'] );
+ $form_meta = RGFormsModel::get_form_meta( $gravity_form_data['id'] );
foreach ( $form_meta['fields'] as $field_index => $field ) {
if ( ! $field['choices'] ) {
continue;
diff --git a/experimental/gpuid-clear-index.php b/experimental/gpuid-clear-index.php
index a77748c77..971627d79 100644
--- a/experimental/gpuid-clear-index.php
+++ b/experimental/gpuid-clear-index.php
@@ -3,7 +3,9 @@
* Clear all indexes for GPUID.
*/
add_action( 'admin_init', function() {
- if ( ! rgget( 'gpuid_clear_indexes' ) ) return;
+ if ( ! rgget( 'gpuid_clear_indexes' ) ) {
+ return;
+ }
// Ensure GPUID is disabled
if ( class_exists( 'GP_Unique_ID' ) ) {
wp_redirect( '/wp-admin/plugins.php?plugin_status=active&guid_clear_indexes_error_active=true' );
@@ -30,24 +32,24 @@
} );
add_action( 'admin_notices', function ( $messages ) {
- if ( rgget( 'guid_clear_indexes_error_active' ) ):
+ if ( rgget( 'guid_clear_indexes_error_active' ) ) :
?>
Please disable GP Unique ID before attempting to clear the indexes.
GP Unique ID table indexes were cleared. Please de-activate this snippet and enable GPUID again.
-
GP Unique ID Clear Indexes snippet is active. If you have already cleared the indexes please remove it.
Otherwise you can start clearing indexes here.
- id );
@@ -42,11 +42,11 @@ function gw_add_attachments_by_field( $notification, $form, $entry, $notificatio
if ( $field->multipleFiles ) {
$uploaded_files = json_decode( stripslashes( $url ), true );
foreach ( $uploaded_files as $uploaded_file ) {
- $attachment = preg_replace( '|^(.*?)/gravity_forms/|', $upload_root, $uploaded_file );
+ $attachment = preg_replace( '|^(.*?)/gravity_forms/|', $upload_root, $uploaded_file );
$notification['attachments'][] = $attachment;
}
} else {
- $attachment = preg_replace( '|^(.*?)/gravity_forms/|', $upload_root, $url );
+ $attachment = preg_replace( '|^(.*?)/gravity_forms/|', $upload_root, $url );
$notification['attachments'][] = $attachment;
}
diff --git a/experimental/gw-capture-file-extension.php b/experimental/gw-capture-file-extension.php
index 88211a542..f942ae615 100644
--- a/experimental/gw-capture-file-extension.php
+++ b/experimental/gw-capture-file-extension.php
@@ -3,9 +3,9 @@
* Gravity Wiz // Gravity Forms // Capture File Extension
* https://gravitywiz.com/
*
- * Capture the file extension of any file uploaded into a File Upload field on submission.
+ * Capture the file extension of any file uploaded into a File Upload field on submission.
* This only works with single File Upload fields.
- *
+ *
* @see https://www.loom.com/share/52b2c139ed42465c9230cf05d9b7fc16
*/
// Update "123" to your form ID.
@@ -13,7 +13,7 @@
// Update "4" to the ID of your File Upload field.
$file_upload_field_id = 4;
-
+
// Update "5" to the ID of the field in which the file extension should be captured.
$ext_field_id = 5;
diff --git a/experimental/gw-create-extra-entry.php b/experimental/gw-create-extra-entry.php
index b0b87ac43..46d8713f8 100644
--- a/experimental/gw-create-extra-entry.php
+++ b/experimental/gw-create-extra-entry.php
@@ -2,9 +2,9 @@
/**
* Gravity Wiz // Gravity Forms // Create an Extra Entry if Checkbox is Checked
* https://gravitywiz.com/
- *
+ *
* Create an additional entry identical to the first if a specified checkbox is checked.
- *
+ *
* @see https://stackoverflow.com/a/69497108/227711
*/
// Update "123" to your form ID.
diff --git a/experimental/gw-field-ids-in-editor-labels.php b/experimental/gw-field-ids-in-editor-labels.php
index 4519f2a2f..11a3bde7b 100644
--- a/experimental/gw-field-ids-in-editor-labels.php
+++ b/experimental/gw-field-ids-in-editor-labels.php
@@ -14,7 +14,7 @@
static $_gw_inline_field_id_style;
if ( ! $_gw_inline_field_id_style ) {
- $content .= '
+ $content .= '
- _args = wp_parse_args( $args, array(
- 'form_id' => false,
- 'address_field_id' => false,
- 'single_line_field_id' => false,
- ) );
+ $this->_args = wp_parse_args( $args, array(
+ 'form_id' => false,
+ 'address_field_id' => false,
+ 'single_line_field_id' => false,
+ ) );
- add_action( 'init', array( $this, 'init' ) );
+ add_action( 'init', array( $this, 'init' ) );
- }
+ }
- public function init() {
+ public function init() {
- add_filter( 'gform_pre_render', array( $this, 'load_form_script' ), 10, 2 );
- add_filter( 'gform_register_init_scripts', array( $this, 'add_init_script' ), 10, 2 );
- add_filter( 'gpaa_init_args_' . $this->_args['form_id'] . '_' . $this->_args['address_field_id'], array( $this, 'add_gpaa_init' ), 10, 2 );
+ add_filter( 'gform_pre_render', array( $this, 'load_form_script' ), 10, 2 );
+ add_filter( 'gform_register_init_scripts', array( $this, 'add_init_script' ), 10, 2 );
+ add_filter( 'gpaa_init_args_' . $this->_args['form_id'] . '_' . $this->_args['address_field_id'], array( $this, 'add_gpaa_init' ), 10, 2 );
- }
+ }
- public function load_form_script( $form, $is_ajax_enabled ) {
+ public function load_form_script( $form, $is_ajax_enabled ) {
- if ( $this->is_applicable_form( $form ) && ! has_action( 'wp_footer', array( $this, 'output_script' ) ) ) {
- add_action( 'wp_footer', array( $this, 'output_script' ) );
- add_action( 'gform_preview_footer', array( $this, 'output_script' ) );
- }
+ if ( $this->is_applicable_form( $form ) && ! has_action( 'wp_footer', array( $this, 'output_script' ) ) ) {
+ add_action( 'wp_footer', array( $this, 'output_script' ) );
+ add_action( 'gform_preview_footer', array( $this, 'output_script' ) );
+ }
- return $form;
- }
+ return $form;
+ }
- public function output_script() {
- ?>
+ public function output_script() {
+ ?>
-
+
- is_applicable_form( $form ) ) {
- return;
- }
+ if ( ! $this->is_applicable_form( $form ) ) {
+ return;
+ }
- $args = array(
- 'formId' => $this->_args['form_id'],
- 'addressFieldId' => $this->_args['address_field_id'],
- 'singleLineFieldId' => $this->_args['single_line_field_id'],
- );
+ $args = array(
+ 'formId' => $this->_args['form_id'],
+ 'addressFieldId' => $this->_args['address_field_id'],
+ 'singleLineFieldId' => $this->_args['single_line_field_id'],
+ );
- $script = 'new GPAASingleLineInput( ' . json_encode( $args ) . ' );';
- $slug = implode( '_', array( 'gw_js_snippet_template', $this->_args['form_id'], $this->_args['address_field_id'] ) );
+ $script = 'new GPAASingleLineInput( ' . json_encode( $args ) . ' );';
+ $slug = implode( '_', array( 'gw_js_snippet_template', $this->_args['form_id'], $this->_args['address_field_id'] ) );
- GFFormDisplay::add_init_script( $this->_args['form_id'], $slug, GFFormDisplay::ON_PAGE_RENDER, $script );
+ GFFormDisplay::add_init_script( $this->_args['form_id'], $slug, GFFormDisplay::ON_PAGE_RENDER, $script );
- }
+ }
- public function add_gpaa_init( $args ){
+ public function add_gpaa_init( $args ) {
- $args['inputSelectors']['autocomplete'] = '#input_' . $this->_args['form_id'] . '_' . $this->_args['single_line_field_id'];
+ $args['inputSelectors']['autocomplete'] = '#input_' . $this->_args['form_id'] . '_' . $this->_args['single_line_field_id'];
- return $args;
+ return $args;
- }
+ }
- public function is_applicable_form( $form ) {
+ public function is_applicable_form( $form ) {
- $form_id = isset( $form['id'] ) ? $form['id'] : $form;
+ $form_id = isset( $form['id'] ) ? $form['id'] : $form;
- return empty( $this->_args['form_id'] ) || (int) $form_id == (int) $this->_args['form_id'];
- }
+ return empty( $this->_args['form_id'] ) || (int) $form_id == (int) $this->_args['form_id'];
+ }
}
// Configuration
-new GPAA_Single_Line_Input ( array(
- 'form_id' => 123, // The ID of your form.
- 'address_field_id' => 4, // The ID of the Address field.
- 'single_line_field_id' => 5 // The ID of the Single Line Text field.
+new GPAA_Single_Line_Input( array(
+ 'form_id' => 123, // The ID of your form.
+ 'address_field_id' => 4, // The ID of the Address field.
+ 'single_line_field_id' => 5, // The ID of the Single Line Text field.
) );
diff --git a/gp-better-user-activation/gpbua-set-redirect-url-by-entry-value.php b/gp-better-user-activation/gpbua-set-redirect-url-by-entry-value.php
index c98d00c53..97170715a 100644
--- a/gp-better-user-activation/gpbua-set-redirect-url-by-entry-value.php
+++ b/gp-better-user-activation/gpbua-set-redirect-url-by-entry-value.php
@@ -11,7 +11,7 @@
$entry = $activation->get_signup()->lead;
// Update "123" to your target form ID.
- if( $entry['form_id'] == 123 ) {
+ if ( $entry['form_id'] == 123 ) {
// Update "1" to the field ID containing the page ID to which you would like to redirect.
$url = get_permalink( $entry[1] );
}
diff --git a/gp-conditional-pricing/gpcp-product-pricing-labels.php b/gp-conditional-pricing/gpcp-product-pricing-labels.php
index b65b6849e..e4c3a23df 100644
--- a/gp-conditional-pricing/gpcp-product-pricing-labels.php
+++ b/gp-conditional-pricing/gpcp-product-pricing-labels.php
@@ -12,9 +12,10 @@
// No need to edit below.
if ( $field->type === 'product' ) {
- $template = str_replace( '{label}', $choice['text'], $template );
- $replace = sprintf( ' data-gpcp-template="%s">%s<', $template, str_replace( '{price}', GFCommon::to_money( $choice['price'] ), $template ) );
- $choice_markup = str_replace( ">{$choice['text']}<", $replace, $choice_markup );;
+ $template = str_replace( '{label}', $choice['text'], $template );
+ $replace = sprintf( ' data-gpcp-template="%s">%s<', $template, str_replace( '{price}', GFCommon::to_money( $choice['price'] ), $template ) );
+ $choice_markup = str_replace( ">{$choice['text']}<", $replace, $choice_markup );
+
}
return $choice_markup;
diff --git a/gp-easy-passthrough/gpep-enable-multi-page-navigation-on-edit.php b/gp-easy-passthrough/gpep-enable-multi-page-navigation-on-edit.php
index 15402ff9f..41e80de0a 100644
--- a/gp-easy-passthrough/gpep-enable-multi-page-navigation-on-edit.php
+++ b/gp-easy-passthrough/gpep-enable-multi-page-navigation-on-edit.php
@@ -14,7 +14,7 @@
if ( is_callable( 'gp_easy_passthrough' ) ) {
$session = gp_easy_passthrough()->session_manager();
$update_entry_id = $session[ gp_easy_passthrough()->get_slug() . '_' . $form['id'] ];
- if( $update_entry_id ) {
+ if ( $update_entry_id ) {
$_POST['gw_page_progression'] = GFFormDisplay::get_max_page_number( $form );
}
}
diff --git a/gp-easy-passthrough/gpep-save-token-to-field.php b/gp-easy-passthrough/gpep-save-token-to-field.php
index cfeabc23b..d5f078bfa 100644
--- a/gp-easy-passthrough/gpep-save-token-to-field.php
+++ b/gp-easy-passthrough/gpep-save-token-to-field.php
@@ -12,7 +12,7 @@
// Update "4" to the ID of the field you woule like to populate with the EP token.
$target_field_id = 4;
- if( is_callable( 'gp_easy_passthrough' ) ) {
+ if ( is_callable( 'gp_easy_passthrough' ) ) {
$token = gp_easy_passthrough()->get_entry_token( $entry );
GFAPI::update_entry_field( $entry['id'], $target_field_id, $token );
$entry[ $target_field_id ] = $token;
diff --git a/gp-ecommerce-fields/gpecf-consolidate-discounts.php b/gp-ecommerce-fields/gpecf-consolidate-discounts.php
index 38745a0a0..8881387bf 100644
--- a/gp-ecommerce-fields/gpecf-consolidate-discounts.php
+++ b/gp-ecommerce-fields/gpecf-consolidate-discounts.php
@@ -9,19 +9,19 @@
// Update "123" to your form ID - or - remove "_123" to apply to all forms.
add_filter( 'gpecf_order_summary_123', function( $summary ) {
- if( empty( $summary['discounts'] ) ) {
+ if ( empty( $summary['discounts'] ) ) {
return $summary;
}
- $consolidated_discount = $summary['discounts'][0];
- $consolidated_discount['name'] = 'Discounts';
+ $consolidated_discount = $summary['discounts'][0];
+ $consolidated_discount['name'] = 'Discounts';
$consolidated_discount['price'] = 0;
- foreach( $summary['discounts'] as $discount ) {
+ foreach ( $summary['discounts'] as $discount ) {
$consolidated_discount['price'] += $discount['price'];
}
$summary['discounts'] = array( $consolidated_discount );
return $summary;
-} );
\ No newline at end of file
+} );
diff --git a/gp-ecommerce-fields/gpecf-custom-total.php b/gp-ecommerce-fields/gpecf-custom-total.php
index 92acf83dc..ef18ffc92 100644
--- a/gp-ecommerce-fields/gpecf-custom-total.php
+++ b/gp-ecommerce-fields/gpecf-custom-total.php
@@ -6,12 +6,14 @@
// Update "123" with your form ID.
add_filter( 'gpecf_order_summary_123', function( $order_summary ) {
- $order_summary['total'] = array_merge( array( array(
- 'name' => 'Recurring Total',
- 'price' => '$400',
- 'quantity' => 1,
- 'class' => 'total'
- ) ), $order_summary['total'] );
+ $order_summary['total'] = array_merge( array(
+ array(
+ 'name' => 'Recurring Total',
+ 'price' => '$400',
+ 'quantity' => 1,
+ 'class' => 'total',
+ ),
+ ), $order_summary['total'] );
return $order_summary;
-} );
\ No newline at end of file
+} );
diff --git a/gp-ecommerce-fields/gpecf-customize-order-summary-markup-with-modifier.php b/gp-ecommerce-fields/gpecf-customize-order-summary-markup-with-modifier.php
index 8b0b7acd9..083458428 100644
--- a/gp-ecommerce-fields/gpecf-customize-order-summary-markup-with-modifier.php
+++ b/gp-ecommerce-fields/gpecf-customize-order-summary-markup-with-modifier.php
@@ -17,7 +17,8 @@ function get_custom_order_summary_markup( $markup, $order, $form, $entry, $order
- is_ecommerce_product( $product ) ) {
continue;
}
@@ -30,13 +31,13 @@ function get_custom_order_summary_markup( $markup, $order, $form, $entry, $order
$option ):
+ if ( is_array( rgar( $product, 'options' ) ) ) :
+ foreach ( $product['options'] as $index => $option ) :
$price += GFCommon::to_number( $option['price'] );
- $class = $index == count( $product['options'] ) - 1 ? '.last-child' : '';
+ $class = $index == count( $product['options'] ) - 1 ? '.last-child' : '';
?>
- - ">
- style( ".order-summary/.product-options/li{$class}" ); ?>">
+
|
- |
- |
+ |
+ |
-
- get_order_summary( $order, $form, $entry ) as $index => $group ): ?>
- get_order_summary( $order, $form, $entry ) as $index => $group ) : ?>
+
-
+
|
"> |
- "> |
+ "> |
diff --git a/gp-ecommerce-fields/gpecf-customize-order-summary-markup.php b/gp-ecommerce-fields/gpecf-customize-order-summary-markup.php
index 973a0db9f..e02bd818d 100644
--- a/gp-ecommerce-fields/gpecf-customize-order-summary-markup.php
+++ b/gp-ecommerce-fields/gpecf-customize-order-summary-markup.php
@@ -14,7 +14,8 @@ function get_custom_order_summary_markup( $markup, $order, $form, $entry, $order
- is_ecommerce_product( $product ) ) {
continue;
}
@@ -27,13 +28,13 @@ function get_custom_order_summary_markup( $markup, $order, $form, $entry, $order
$option ):
+ if ( is_array( rgar( $product, 'options' ) ) ) :
+ foreach ( $product['options'] as $index => $option ) :
$price += GFCommon::to_number( $option['price'] );
- $class = $index == count( $product['options'] ) - 1 ? '.last-child' : '';
+ $class = $index == count( $product['options'] ) - 1 ? '.last-child' : '';
?>
- - ">
- style( ".order-summary/.product-options/li{$class}" ); ?>">
+
|
- |
- |
+ |
+ |
-
- get_order_summary( $order, $form, $entry ) as $index => $group ): ?>
- get_order_summary( $order, $form, $entry ) as $index => $group ) : ?>
+
-
+
|
"> |
- "> |
+ "> |
@@ -67,4 +69,4 @@ function get_custom_order_summary_markup( $markup, $order, $form, $entry, $order
_args['form_id'] ) {
+ elseif ( (int) $form['id'] !== (int) $this->_args['form_id'] ) {
return gp_ecommerce_fields()->add_ecommerce_fields_to_order( $order, $form, $entry );
}
diff --git a/gp-ecommerce-fields/gpecf-dynamically-set-discount.php b/gp-ecommerce-fields/gpecf-dynamically-set-discount.php
index 9eb816e3b..d492e6fe3 100644
--- a/gp-ecommerce-fields/gpecf-dynamically-set-discount.php
+++ b/gp-ecommerce-fields/gpecf-dynamically-set-discount.php
@@ -9,13 +9,12 @@
add_filter( 'gform_pre_submission_filter_123', 'gw_set_discount_amount' );
function gw_set_discount_amount( $form ) {
- foreach( $form['fields'] as &$field ) {
+ foreach ( $form['fields'] as &$field ) {
// Update "2" to your Discount field ID.
- if( $field->id == 2 ) {
+ if ( $field->id == 2 ) {
$field->discountAmount = 50;
}
-
}
return $form;
diff --git a/gp-ecommerce-fields/gpecf-itemized-product-options-order-summary-markup.php b/gp-ecommerce-fields/gpecf-itemized-product-options-order-summary-markup.php
index ef0161b34..e510204b5 100644
--- a/gp-ecommerce-fields/gpecf-itemized-product-options-order-summary-markup.php
+++ b/gp-ecommerce-fields/gpecf-itemized-product-options-order-summary-markup.php
@@ -14,7 +14,8 @@ function get_custom_order_summary_markup( $markup, $order, $form, $entry, $order
- is_ecommerce_product( $product ) ) {
continue;
}
@@ -27,15 +28,15 @@ function get_custom_order_summary_markup( $markup, $order, $form, $entry, $order
$option ):
+ if ( is_array( rgar( $product, 'options' ) ) ) :
+ foreach ( $product['options'] as $index => $option ) :
$class = $index == count( $product['options'] ) - 1 ? '.last-child' : '';
?>
- - ">
- style( ".order-summary/.product-options/li{$class}" ); ?>">
+
@@ -44,12 +45,12 @@ function get_custom_order_summary_markup( $markup, $order, $form, $entry, $order
$option ):
+ if ( is_array( rgar( $product, 'options' ) ) ) :
+ foreach ( $product['options'] as $index => $option ) :
$class = $index == count( $product['options'] ) - 1 ? '.last-child' : '';
?>
- list-style-type: none !important;">
-
@@ -58,34 +59,35 @@ function get_custom_order_summary_markup( $markup, $order, $form, $entry, $order
$option ):
- $class = $index == count( $product['options'] ) - 1 ? '.last-child' : '';
+ if ( is_array( rgar( $product, 'options' ) ) ) :
+ foreach ( $product['options'] as $index => $option ) :
+ $class = $index == count( $product['options'] ) - 1 ? '.last-child' : '';
$option_total = floatval( $product['quantity'] ) * $option['price'];
?>
- list-style-type: none !important;">
-
|
-
|
- get_order_summary( $order, $form, $entry ) as $index => $group ): ?>
- get_order_summary( $order, $form, $entry ) as $index => $group ) : ?>
+
-
+
|
"> |
- "> |
+ "> |
diff --git a/gp-ecommerce-fields/gpecf-remove-field-label-from-option-label.php b/gp-ecommerce-fields/gpecf-remove-field-label-from-option-label.php
index 88d847d59..6199b1b1b 100644
--- a/gp-ecommerce-fields/gpecf-remove-field-label-from-option-label.php
+++ b/gp-ecommerce-fields/gpecf-remove-field-label-from-option-label.php
@@ -2,10 +2,10 @@
/**
* Gravity Perks // eCommerce Fields // Remove Field Label from Option Label in Order Summary
* https://gravitywiz.com/documentation/gravity-forms-ecommerce-fields/
- *
+ *
* By default, Gravity Forms displays options in order summary like so:
* Field Label: Option Label
- *
+ *
* With this snippet in place, options will be displayed as:
* Option Label
*/
diff --git a/gp-ecommerce-fields/gpecf-set-discount-dynamically.php b/gp-ecommerce-fields/gpecf-set-discount-dynamically.php
index a9f6fb379..623d0a6c7 100644
--- a/gp-ecommerce-fields/gpecf-set-discount-dynamically.php
+++ b/gp-ecommerce-fields/gpecf-set-discount-dynamically.php
@@ -20,7 +20,6 @@ function gw_set_discount_amount( $form ) {
if ( $field->id == 5 ) {
$field->discountAmount = 50;
}
-
}
return $form;
diff --git a/gp-ecommerce-fields/gpecf-tax-amounts-by-field-value.php b/gp-ecommerce-fields/gpecf-tax-amounts-by-field-value.php
index 5eca59c92..5a62acad9 100644
--- a/gp-ecommerce-fields/gpecf-tax-amounts-by-field-value.php
+++ b/gp-ecommerce-fields/gpecf-tax-amounts-by-field-value.php
@@ -21,7 +21,7 @@ public function __construct( $args = array() ) {
'form_id' => false,
'value_field_id' => false,
'tax_field_id' => false,
- 'tax_amounts' => array()
+ 'tax_amounts' => array(),
) );
// do version check in the init to make sure if GF is going to be loaded, it is already loaded
diff --git a/gp-file-upload-pro/gpfup-big-images.css b/gp-file-upload-pro/gpfup-big-images.css
index bf432a7a8..c5540c46d 100644
--- a/gp-file-upload-pro/gpfup-big-images.css
+++ b/gp-file-upload-pro/gpfup-big-images.css
@@ -14,8 +14,8 @@
margin: 0 0.5rem 1rem !important;
background: rgba( 0, 0, 0, 0.9 );
border-radius: 4px;
- overflow: hidden;
- min-height: 100px;
+ overflow: hidden;
+ min-height: 100px;
}
.gpfup-big-images .gpfup__preview {
@@ -28,7 +28,7 @@
height: auto !important;
display: block;
margin: auto;
- border-radius: 0;
+ border-radius: 0;
}
.gpfup-big-images .gpfup__file-info {
@@ -50,7 +50,7 @@
.gpfup-big-images .gpfup__file-actions {
top: 0.5rem;
right: 0.5rem;
- position: absolute;
+ position: absolute;
}
.gpfup-big-images .gpfup__delete {
@@ -70,7 +70,7 @@
}
.gpfup-big-images .gpfup--images-only .gpfup__preview {
- width: auto;
+ width: auto;
}
.gpfup-big-images .gpfup__delete:hover svg {
@@ -79,11 +79,11 @@
.gpfup-big-images .gpfup__droparea {
border-radius: 4px;
- border-top: 1px dashed rgba( 0, 0, 0, 0.15 );
+ border-top: 1px dashed rgba( 0, 0, 0, 0.15 );
}
.gpfup-big-images .gpfup__edit {
width: 2.6rem;
height: 2.6rem;
- line-height: 1;
+ line-height: 1;
}
diff --git a/gp-file-upload-pro/gpfup-file-icons.css b/gp-file-upload-pro/gpfup-file-icons.css
index 0cd6c55d8..e219f1806 100644
--- a/gp-file-upload-pro/gpfup-file-icons.css
+++ b/gp-file-upload-pro/gpfup-file-icons.css
@@ -6,15 +6,15 @@
* types we should support [via support](https://gravitywiz.com/support/)!
*/
.gpfup__file-icon svg {
- visibility: hidden;
+ visibility: hidden;
}
.gpfup__file[data-file-ext="zip"] .gpfup__file-icon {
- background: url( https://cdn.jsdelivr.net/npm/pretty-file-icons@2.2.1/svg/zip.svg );
+ background: url( https://cdn.jsdelivr.net/npm/pretty-file-icons@2.2.1/svg/zip.svg );
}
.gpfup__file[data-file-ext="doc"] .gpfup__file-icon,
.gpfup__file[data-file-ext="docx"] .gpfup__file-icon {
- background: url( https://cdn.jsdelivr.net/npm/pretty-file-icons@2.2.1/svg/doc.svg );
+ background: url( https://cdn.jsdelivr.net/npm/pretty-file-icons@2.2.1/svg/doc.svg );
}
.gpfup__file[data-file-ext="pdf"] .gpfup__file-icon {
- background: url( https://cdn.jsdelivr.net/npm/pretty-file-icons@2.2.1/svg/pdf.svg );
+ background: url( https://cdn.jsdelivr.net/npm/pretty-file-icons@2.2.1/svg/pdf.svg );
}
diff --git a/gp-file-upload-pro/gpfup-single-file.css b/gp-file-upload-pro/gpfup-single-file.css
index ecce9a711..f30788f6a 100644
--- a/gp-file-upload-pro/gpfup-single-file.css
+++ b/gp-file-upload-pro/gpfup-single-file.css
@@ -63,10 +63,10 @@
}
.gpfup-single-file .gpfup__file-actions {
- position: absolute;
- display: block;
- top: 1rem;
- right: 1rem;
- background: white;
- border-radius: 50%;
+ position: absolute;
+ display: block;
+ top: 1rem;
+ right: 1rem;
+ background: white;
+ border-radius: 50%;
}
diff --git a/gp-inventory/gpi-waiting-list.php b/gp-inventory/gpi-waiting-list.php
index c674ca154..92750be86 100644
--- a/gp-inventory/gpi-waiting-list.php
+++ b/gp-inventory/gpi-waiting-list.php
@@ -14,7 +14,7 @@
$limit = rgar( $choice, 'inventory_limit' );
$how_many_left = max( $limit - $count, 0 );
- if( $how_many_left <= 0 ) {
+ if ( $how_many_left <= 0 ) {
$message = '(waiting list)';
$default_message = gp_inventory_type_choices()->replace_choice_available_inventory_merge_tags( gp_inventory_type_choices()->get_inventory_available_message( $field ), $field, $form, $choice, $how_many_left );
$choice['text'] = str_replace( $default_message, $message, $choice['text'] );
diff --git a/gp-limit-checkboxes/gplcb-conditional-limits.php b/gp-limit-checkboxes/gplcb-conditional-limits.php
index 213e44efd..fb614fc9a 100644
--- a/gp-limit-checkboxes/gplcb-conditional-limits.php
+++ b/gp-limit-checkboxes/gplcb-conditional-limits.php
@@ -25,7 +25,7 @@ public function __construct( $args = array() ) {
// set our default arguments, parse against the provided arguments, and store for use throughout the class
$this->_args = wp_parse_args( $args, array(
'form_id' => false,
- 'field_id' => false
+ 'field_id' => false,
) );
// do version check in the init to make sure if GF is going to be loaded, it is already loaded
@@ -36,7 +36,7 @@ public function __construct( $args = array() ) {
public function init() {
// make sure we're running the required minimum version of Gravity Forms
- if( ! property_exists( 'GFCommon', 'version' ) || ! version_compare( GFCommon::$version, '1.8', '>=' ) ) {
+ if ( ! property_exists( 'GFCommon', 'version' ) || ! version_compare( GFCommon::$version, '1.8', '>=' ) ) {
return;
}
@@ -50,21 +50,21 @@ public function init() {
}
public function add_trigger_class( $form ) {
- foreach( $form['fields'] as &$field ) {
+ foreach ( $form['fields'] as &$field ) {
$field->cssClass .= ' gfield_trigger_change';
}
return $form;
}
public function enqueue_form_scripts( $form ) {
- if( $this->is_applicable_form( $form ) ) {
+ if ( $this->is_applicable_form( $form ) ) {
wp_enqueue_script( 'gform_conditional_logic' );
}
}
public function load_form_script( $form, $is_ajax_enabled ) {
- if( $this->is_applicable_form( $form ) && ! self::$is_script_output && ! $this->is_ajax_submission( $form['id'], $is_ajax_enabled ) ) {
+ if ( $this->is_applicable_form( $form ) && ! self::$is_script_output && ! $this->is_ajax_submission( $form['id'], $is_ajax_enabled ) ) {
$this->output_script();
}
@@ -160,7 +160,7 @@ public function output_script() {
public function add_init_script( $form ) {
- if( ! $this->is_applicable_form( $form ) ) {
+ if ( ! $this->is_applicable_form( $form ) ) {
return;
}
@@ -179,12 +179,12 @@ public function add_init_script( $form ) {
public function handle_conditionals( $group, $form ) {
- if( ! in_array( $this->_args['field_id'], $group['fields'] ) ) {
+ if ( ! in_array( $this->_args['field_id'], $group['fields'] ) ) {
return $group;
}
- foreach( $this->_args['conditionals'] as $conditional ) {
- if( GFCommon::evaluate_conditional_logic( $conditional['conditionalLogic'], $form, GFFormsModel::get_current_lead() ) ) {
+ foreach ( $this->_args['conditionals'] as $conditional ) {
+ if ( GFCommon::evaluate_conditional_logic( $conditional['conditionalLogic'], $form, GFFormsModel::get_current_lead() ) ) {
$group['min'] = $conditional['min'];
$group['max'] = $conditional['max'];
break;
@@ -206,38 +206,38 @@ public function is_applicable_form( $form ) {
# Configuration
new GPLCB_Conditional_Limits( array(
- 'form_id' => 1654,
- 'field_id' => 7,
- 'conditionals' => array(
- array(
- 'min' => 2,
- 'max' => 2,
- 'conditionalLogic' => array(
- 'logicType' => 'all',
- 'actionType' => 'show',
- 'rules' => array(
- array(
- 'fieldId' => 2,
- 'operator' => 'is',
- 'value' => 'MX250-2'
- )
- )
- )
- ),
- array(
- 'min' => 3,
- 'max' => 3,
- 'conditionalLogic' => array(
- 'logicType' => 'all',
- 'actionType' => 'show',
- 'rules' => array(
- array(
- 'fieldId' => 2,
- 'operator' => 'is',
- 'value' => 'MX 250-3'
- )
- )
- )
- )
- )
+ 'form_id' => 1654,
+ 'field_id' => 7,
+ 'conditionals' => array(
+ array(
+ 'min' => 2,
+ 'max' => 2,
+ 'conditionalLogic' => array(
+ 'logicType' => 'all',
+ 'actionType' => 'show',
+ 'rules' => array(
+ array(
+ 'fieldId' => 2,
+ 'operator' => 'is',
+ 'value' => 'MX250-2',
+ ),
+ ),
+ ),
+ ),
+ array(
+ 'min' => 3,
+ 'max' => 3,
+ 'conditionalLogic' => array(
+ 'logicType' => 'all',
+ 'actionType' => 'show',
+ 'rules' => array(
+ array(
+ 'fieldId' => 2,
+ 'operator' => 'is',
+ 'value' => 'MX 250-3',
+ ),
+ ),
+ ),
+ ),
+ ),
) );
diff --git a/gp-limit-choices/gplc-daily-limit.php b/gp-limit-choices/gplc-daily-limit.php
index 21a98b317..5e030995a 100644
--- a/gp-limit-choices/gplc-daily-limit.php
+++ b/gp-limit-choices/gplc-daily-limit.php
@@ -17,8 +17,8 @@ class GWLimitChoicesDailyLimit {
function __construct( $args ) {
$this->_args = wp_parse_args( $args, array(
- 'form_id' => false,
- 'field_ids' => array()
+ 'form_id' => false,
+ 'field_ids' => array(),
) );
add_filter( "gwlc_choice_counts_query_{$this->_args['form_id']}", array( $this, 'modify_choice_counts_query' ), 10, 2 );
@@ -29,9 +29,9 @@ function modify_choice_counts_query( $query, $field ) {
$form = GFAPI::get_form( $field['formId'] );
- foreach( $form['fields'] as $field ) {
+ foreach ( $form['fields'] as $field ) {
- if( ! in_array( $field['id'], $this->_args['field_ids'] ) ) {
+ if ( ! in_array( $field['id'], $this->_args['field_ids'] ) ) {
continue;
}
@@ -46,6 +46,6 @@ function modify_choice_counts_query( $query, $field ) {
}
new GWLimitChoicesDailyLimit( array(
- 'form_id' => 436,
- 'field_ids' => array( 4 )
+ 'form_id' => 436,
+ 'field_ids' => array( 4 ),
) );
diff --git a/gp-limit-choices/gplc-shared-limits.php b/gp-limit-choices/gplc-shared-limits.php
index 64bb82a30..a66f2bbb9 100644
--- a/gp-limit-choices/gplc-shared-limits.php
+++ b/gp-limit-choices/gplc-shared-limits.php
@@ -21,7 +21,7 @@ public function __construct( $args = array() ) {
$this->_args = wp_parse_args( $args, array(
'form_id' => false,
'field_groups' => array(),
- 'form_groups' => array()
+ 'form_groups' => array(),
) );
// do version check in the init to make sure if GF is going to be loaded, it is already loaded
@@ -31,7 +31,7 @@ public function __construct( $args = array() ) {
public function init() {
- if( ! is_callable( array( 'GFFormsModel', 'get_database_version' ) ) ) {
+ if ( ! is_callable( array( 'GFFormsModel', 'get_database_version' ) ) ) {
return;
}
@@ -42,15 +42,15 @@ public function init() {
public function modify_choice_counts_query( $query, $field ) {
- if( ! $this->is_applicable_form( $field->formId ) ) {
+ if ( ! $this->is_applicable_form( $field->formId ) ) {
return $query;
}
- if( ! empty( $this->_args['form_groups'] ) ) {
+ if ( ! empty( $this->_args['form_groups'] ) ) {
$query = $this->modify_query_for_form_groups( $query, $field );
}
- if( ! empty( $this->_args['field_groups'] ) ) {
+ if ( ! empty( $this->_args['field_groups'] ) ) {
$query = $this->modify_query_for_field_groups( $query, $field );
}
@@ -60,23 +60,22 @@ public function modify_choice_counts_query( $query, $field ) {
public function modify_query_for_field_groups( $query, $field ) {
global $wpdb;
- $from_search = $wpdb->prepare( "(em.meta_key = %s OR em.meta_key LIKE %s)", $field['id'], $wpdb->esc_like( $field['id'] ) . '.%' );
+ $from_search = $wpdb->prepare( '(em.meta_key = %s OR em.meta_key LIKE %s)', $field['id'], $wpdb->esc_like( $field['id'] ) . '.%' );
$from_replace = array();
- foreach( $this->_args['field_groups'] as $field_group ) {
+ foreach ( $this->_args['field_groups'] as $field_group ) {
- if( ! in_array( $field['id'], $field_group ) ) {
+ if ( ! in_array( $field['id'], $field_group ) ) {
continue;
}
- foreach( $field_group as $field_id ) {
- $from_replace[] = $wpdb->prepare( "em.meta_key = %s OR em.meta_key LIKE %s", $field_id, $wpdb->esc_like( $field_id ) . '.%' );
+ foreach ( $field_group as $field_id ) {
+ $from_replace[] = $wpdb->prepare( 'em.meta_key = %s OR em.meta_key LIKE %s', $field_id, $wpdb->esc_like( $field_id ) . '.%' );
}
-
}
- if( ! empty( $from_replace ) ) {
- $from_replace = sprintf( '( %s )', implode( ' OR ', $from_replace ) );
+ if ( ! empty( $from_replace ) ) {
+ $from_replace = sprintf( '( %s )', implode( ' OR ', $from_replace ) );
$query['from'] = str_replace( $from_search, $from_replace, $query['from'] );
}
@@ -86,16 +85,16 @@ public function modify_query_for_field_groups( $query, $field ) {
public function modify_query_for_form_groups( $query, $field ) {
global $wpdb;
- foreach( $this->_args['form_groups'] as $form_group ) {
+ foreach ( $this->_args['form_groups'] as $form_group ) {
- if( ! $this->is_form_group_field( $field, $form_group ) ) {
+ if ( ! $this->is_form_group_field( $field, $form_group ) ) {
continue;
}
$query['where'] = str_replace( sprintf( 'AND em.form_id = %d', $field->formId ), '', $query['where'] );
$join_conditions = array();
- foreach( $form_group as $form_id => $field_ids ) {
+ foreach ( $form_group as $form_id => $field_ids ) {
$field_clauses = array();
if ( ! is_array( $field_ids ) ) {
$field_ids = array( $field_ids );
@@ -103,7 +102,7 @@ public function modify_query_for_form_groups( $query, $field ) {
foreach ( $field_ids as $field_id ) {
$field_clauses[] = "em.meta_key = '{$field_id}' OR em.meta_key LIKE '{$field_id}%'";
}
- $join_conditions[] = "( em.form_id = {$form_id} AND ( " . implode( " OR ", $field_clauses ) . " ) )";
+ $join_conditions[] = "( em.form_id = {$form_id} AND ( " . implode( ' OR ', $field_clauses ) . ' ) )';
}
$query['from'] = sprintf( "FROM {$wpdb->prefix}gf_entry e INNER JOIN {$wpdb->prefix}gf_entry_meta em ON em.entry_id = e.id AND ( %s )", implode( "\nOR\n", $join_conditions ) );
@@ -115,13 +114,13 @@ public function modify_query_for_form_groups( $query, $field ) {
public function modify_requested_count( $requested_count, $field ) {
- if( ! $this->is_applicable_form( $field['formId'] ) ) {
+ if ( ! $this->is_applicable_form( $field['formId'] ) ) {
return $requested_count;
}
- foreach( $this->_args['field_groups'] as $field_group ) {
+ foreach ( $this->_args['field_groups'] as $field_group ) {
- if( ! in_array( $field->id, $field_group ) ) {
+ if ( ! in_array( $field->id, $field_group ) ) {
continue;
}
@@ -131,7 +130,7 @@ public function modify_requested_count( $requested_count, $field ) {
remove_filter( 'gplc_requested_count', array( $this, 'modify_requested_count' ) );
- foreach( $field_group as $field_id ) {
+ foreach ( $field_group as $field_id ) {
$form = GFAPI::get_form( $field->formId );
$group_field = GFFormsModel::get_field( $form, $field_id );
@@ -139,10 +138,9 @@ public function modify_requested_count( $requested_count, $field ) {
$selected_choices = gp_limit_choices()->get_selected_choices( $group_field );
$selected_choice = reset( $selected_choices );
- if( $selected_choice['value'] == $primary_choice['value'] ) {
+ if ( $selected_choice['value'] == $primary_choice['value'] ) {
$shared_requested_count += gp_limit_choices()->get_requested_count( $group_field );
}
-
}
add_filter( 'gplc_requested_count', array( $this, 'modify_requested_count' ), 10, 2 );
@@ -160,9 +158,9 @@ public function is_applicable_form( $form ) {
$is_applicable_form = false;
if ( ! empty( $this->_args['form_groups'] ) ) {
- foreach( $this->_args['form_groups'] as $form_group ) {
+ foreach ( $this->_args['form_groups'] as $form_group ) {
$is_applicable_form = $this->is_form_group_form( $form, $form_group );
- if( $is_applicable_form ) {
+ if ( $is_applicable_form ) {
break;
}
}
@@ -184,7 +182,7 @@ public function is_form_group_field( $field, $form_group ) {
public function get_form_group_fields( $form_group ) {
$form_group_fields = array();
- foreach( $form_group as $form_id => $field_ids ) {
+ foreach ( $form_group as $form_id => $field_ids ) {
if ( ! is_array( $field_ids ) ) {
$field_ids = array( $field_ids );
}
@@ -198,7 +196,7 @@ public function get_form_group_fields( $form_group ) {
# Configuration
new GPLS_Shared_Limits( array(
- 'form_id' => 123,
+ 'form_id' => 123,
'field_groups' => array(
array( 1, 2 ),
),
@@ -214,13 +212,13 @@ public function get_form_group_fields( $form_group ) {
'form_groups' => array(
array(
123 => 3,
- 124 => 4
+ 124 => 4,
),
array(
123 => 5,
- 124 => 6
+ 124 => 6,
),
- )
+ ),
) );
/**
@@ -231,7 +229,7 @@ public function get_form_group_fields( $form_group ) {
'form_groups' => array(
array(
123 => array( 1, 2 ),
- 124 => array( 3, 4 )
+ 124 => array( 3, 4 ),
),
),
-) );
\ No newline at end of file
+) );
diff --git a/gp-limit-choices/gplc-spots-left-admin-only.php b/gp-limit-choices/gplc-spots-left-admin-only.php
index cf7c9604b..fecbb26f4 100644
--- a/gp-limit-choices/gplc-spots-left-admin-only.php
+++ b/gp-limit-choices/gplc-spots-left-admin-only.php
@@ -7,17 +7,17 @@
*/
add_filter( 'gplc_pre_render_choice', 'my_add_how_many_left_message', 10, 4 );
function my_add_how_many_left_message( $choice, $exceeded_limit, $field, $form ) {
-
- if( ! current_user_can( 'administrator' ) ) {
- return $choice;
- }
- $limit = method_exists( gp_limit_choices(), 'get_choice_limit' ) ? gp_limit_choices()->get_choice_limit( $choice, $field->formId, $field->id ) : rgar( $choice, 'limit' );
- $how_many_left = max( $limit - $count, 0 );
+ if ( ! current_user_can( 'administrator' ) ) {
+ return $choice;
+ }
- $message = "($how_many_left spots left)";
+ $limit = method_exists( gp_limit_choices(), 'get_choice_limit' ) ? gp_limit_choices()->get_choice_limit( $choice, $field->formId, $field->id ) : rgar( $choice, 'limit' );
+ $how_many_left = max( $limit - $count, 0 );
- $choice['text'] = $choice['text'] . " $message";
+ $message = "($how_many_left spots left)";
- return $choice;
+ $choice['text'] = $choice['text'] . " $message";
+
+ return $choice;
}
diff --git a/gp-limit-choices/gplc-spots-left-plus-waiting-list.php b/gp-limit-choices/gplc-spots-left-plus-waiting-list.php
index 811064ffe..f5e0e2014 100644
--- a/gp-limit-choices/gplc-spots-left-plus-waiting-list.php
+++ b/gp-limit-choices/gplc-spots-left-plus-waiting-list.php
@@ -17,15 +17,15 @@
add_filter( 'gplc_pre_render_choice', 'my_add_how_many_left_message', 10, 5 );
function my_add_how_many_left_message( $choice, $exceeded_limit, $field, $form, $count ) {
- $limit = rgar( $choice, 'limit' );
- $how_many_left = max( $limit - $count, 0 );
+ $limit = rgar( $choice, 'limit' );
+ $how_many_left = max( $limit - $count, 0 );
- if( $how_many_left <= 0 ) {
- $message = '(waiting list)';
- } else {
- $message = "($how_many_left spots left)";
- }
-
- $choice['text'] = $choice['text'] . " $message";
- return $choice;
+ if ( $how_many_left <= 0 ) {
+ $message = '(waiting list)';
+ } else {
+ $message = "($how_many_left spots left)";
+ }
+
+ $choice['text'] = $choice['text'] . " $message";
+ return $choice;
}
diff --git a/gp-limit-dates/gpld-block-reserved-date-ranges.php b/gp-limit-dates/gpld-block-reserved-date-ranges.php
index 5e5f43ea1..1443af5a7 100644
--- a/gp-limit-dates/gpld-block-reserved-date-ranges.php
+++ b/gp-limit-dates/gpld-block-reserved-date-ranges.php
@@ -23,7 +23,7 @@ public function __construct( $args = array() ) {
// set our default arguments, parse against the provided arguments, and store for use throughout the class
$this->_args = wp_parse_args( $args, array(
'form_id' => false,
- 'field_id' => false
+ 'field_id' => false,
) );
// do version check in the init to make sure if GF is going to be loaded, it is already loaded
diff --git a/gp-limit-dates/gpld-disable-all-dates-with-exceptions.php b/gp-limit-dates/gpld-disable-all-dates-with-exceptions.php
index 6142baedb..4451ff852 100644
--- a/gp-limit-dates/gpld-disable-all-dates-with-exceptions.php
+++ b/gp-limit-dates/gpld-disable-all-dates-with-exceptions.php
@@ -6,7 +6,7 @@
add_filter( 'gpld_limit_dates_options_123_1', function( $options, $form, $field ) {
$options['exceptionMode'] = 'enable';
- $options['disableAll'] = true;
+ $options['disableAll'] = true;
return $options;
-}, 10, 3 );
\ No newline at end of file
+}, 10, 3 );
diff --git a/gp-limit-dates/gpld-exclude-blocked-dates-from-modifiers.php b/gp-limit-dates/gpld-exclude-blocked-dates-from-modifiers.php
index 7d9c799a4..5cfdd715a 100644
--- a/gp-limit-dates/gpld-exclude-blocked-dates-from-modifiers.php
+++ b/gp-limit-dates/gpld-exclude-blocked-dates-from-modifiers.php
@@ -20,130 +20,130 @@
add_filter( 'gpld_date_value', 'gpld_extend_modifiers_by_blocked_dates', 10, 4 );
function gpld_extend_modifiers_by_blocked_dates( $end_date, $field, $key, $options ) {
- if( ! $end_date ) {
- return $end_date;
- }
-
- $value = rgar( $options, $key );
- $is_field_id = is_numeric( $value ) && $value > 0;
-
- if( $value == '{today}' ) {
- $date = strtotime( 'midnight', current_time( 'timestamp' ) );
- //$date = strtotime( '05/21/2016 midnight' );
- } else if( $is_field_id ) {
-
- $mod_field_id = $value;
- $form = GFAPI::get_form( $field->formId );
- $mod_field = GFFormsModel::get_field( $form, $mod_field_id );
-
- $date = gp_limit_dates()->parse_timestamp( rgpost( sprintf( 'input_%s', $mod_field->id ) ), $mod_field );
-
- } else {
- $date = strtotime( $value );
- }
-
- $blocked_count = 0;
- $begin = new DateTime( date( 'Y-m-d', $date ) );
- $end = new DateTime( date( 'Y-m-d', $end_date ) );
- $interval = DateInterval::createFromDateString( '1 day' );
-
- // period should not include the starting day, should always inlude the very last day
- $period = new DatePeriod( $begin, $interval, $end->add( $interval ) );
-
- foreach ( $period as $_date ) {
- if( ! gpld_is_valid_date( $_date->getTimestamp(), $field ) ) {
- $blocked_count++;
- }
- }
-
- if( ! $blocked_count ) {
- return $end_date;
- }
-
- $end = new DateTime( date( 'Y-m-d', $end_date ) );
-
- // extend endDate to account for blocked dates
- while( $blocked_count > 0 ) {
- $end->add( DateInterval::createFromDateString( '1 day' ) );
- // only deduct valid dates from our counter
- if( gpld_is_valid_date( $end->getTimestamp(), $field ) ) {
- $blocked_count--;
- }
- }
-
- // set end date to first unblocked date
- while( ! gpld_is_valid_date( $end->getTimestamp(), $field ) ) {
- $end->add( $interval );
- }
-
- return $end->getTimestamp();
+ if ( ! $end_date ) {
+ return $end_date;
+ }
+
+ $value = rgar( $options, $key );
+ $is_field_id = is_numeric( $value ) && $value > 0;
+
+ if ( $value == '{today}' ) {
+ $date = strtotime( 'midnight', current_time( 'timestamp' ) );
+ //$date = strtotime( '05/21/2016 midnight' );
+ } elseif ( $is_field_id ) {
+
+ $mod_field_id = $value;
+ $form = GFAPI::get_form( $field->formId );
+ $mod_field = GFFormsModel::get_field( $form, $mod_field_id );
+
+ $date = gp_limit_dates()->parse_timestamp( rgpost( sprintf( 'input_%s', $mod_field->id ) ), $mod_field );
+
+ } else {
+ $date = strtotime( $value );
+ }
+
+ $blocked_count = 0;
+ $begin = new DateTime( date( 'Y-m-d', $date ) );
+ $end = new DateTime( date( 'Y-m-d', $end_date ) );
+ $interval = DateInterval::createFromDateString( '1 day' );
+
+ // period should not include the starting day, should always inlude the very last day
+ $period = new DatePeriod( $begin, $interval, $end->add( $interval ) );
+
+ foreach ( $period as $_date ) {
+ if ( ! gpld_is_valid_date( $_date->getTimestamp(), $field ) ) {
+ $blocked_count++;
+ }
+ }
+
+ if ( ! $blocked_count ) {
+ return $end_date;
+ }
+
+ $end = new DateTime( date( 'Y-m-d', $end_date ) );
+
+ // extend endDate to account for blocked dates
+ while ( $blocked_count > 0 ) {
+ $end->add( DateInterval::createFromDateString( '1 day' ) );
+ // only deduct valid dates from our counter
+ if ( gpld_is_valid_date( $end->getTimestamp(), $field ) ) {
+ $blocked_count--;
+ }
+ }
+
+ // set end date to first unblocked date
+ while ( ! gpld_is_valid_date( $end->getTimestamp(), $field ) ) {
+ $end->add( $interval );
+ }
+
+ return $end->getTimestamp();
}
function gpld_is_valid_date( $date, $field ) {
- $date = gp_limit_dates()->parse_timestamp( $date, $field );
+ $date = gp_limit_dates()->parse_timestamp( $date, $field );
- $is_valid_day = gp_limit_dates()->is_valid_day_of_week( $date, $field );
- $is_valid = $is_valid_day;
- $is_excepted = gp_limit_dates()->is_excepted( $date, $field );
+ $is_valid_day = gp_limit_dates()->is_valid_day_of_week( $date, $field );
+ $is_valid = $is_valid_day;
+ $is_excepted = gp_limit_dates()->is_excepted( $date, $field );
- if( $is_excepted ) {
- $is_valid = ! $is_valid;
- }
+ if ( $is_excepted ) {
+ $is_valid = ! $is_valid;
+ }
- return $is_valid;
+ return $is_valid;
}
add_filter( 'wp_footer', 'gpld_exclude_blocked_dates_js' );
add_filter( 'gform_preview_footer', 'gpld_exclude_blocked_dates_js' );
function gpld_exclude_blocked_dates_js() {
- ?>
+ ?>
-
+
- applicable_forms = $applicable_forms;
}
return $rule_groups;
-}, 10, 2 );
\ No newline at end of file
+}, 10, 2 );
diff --git a/gp-limit-submissions/gpls-apply-same-feed-to-group.php b/gp-limit-submissions/gpls-apply-same-feed-to-group.php
index ccdeb88a8..dc89cab68 100644
--- a/gp-limit-submissions/gpls-apply-same-feed-to-group.php
+++ b/gp-limit-submissions/gpls-apply-same-feed-to-group.php
@@ -8,12 +8,12 @@
// Update "123" to the ID of your form.
$primary_form_id = 123;
- if( $form_id == $primary_form_id || ! in_array( $form_id, array( 124, 125, 126 ) ) ) {
+ if ( $form_id == $primary_form_id || ! in_array( $form_id, array( 124, 125, 126 ) ) ) {
return $rule_groups;
}
$rule_groups = array_merge( $rule_groups, GPLS_RuleGroup::load_by_form( $primary_form_id ) );
- foreach( $rule_groups as $rule_group ) {
+ foreach ( $rule_groups as $rule_group ) {
$rule_group->applicable_forms = false;
}
diff --git a/gp-limit-submissions/gpls-disable-for-gravity-view.php b/gp-limit-submissions/gpls-disable-for-gravity-view.php
index c68e96048..aae0bbd6d 100644
--- a/gp-limit-submissions/gpls-disable-for-gravity-view.php
+++ b/gp-limit-submissions/gpls-disable-for-gravity-view.php
@@ -5,9 +5,9 @@
*/
add_filter( 'gpls_rule_groups', function( $rule_groups, $form_id ) {
- if( is_callable( 'gravityview_get_context' ) && gravityview_get_context() == 'edit' ) {
+ if ( is_callable( 'gravityview_get_context' ) && gravityview_get_context() == 'edit' ) {
$rule_groups = array();
}
return $rule_groups;
-}, 10, 2 );
\ No newline at end of file
+}, 10, 2 );
diff --git a/gp-limit-submissions/gpls-global-feeds.php b/gp-limit-submissions/gpls-global-feeds.php
index cc2340238..b1b6b5ece 100644
--- a/gp-limit-submissions/gpls-global-feeds.php
+++ b/gp-limit-submissions/gpls-global-feeds.php
@@ -8,12 +8,12 @@
// Update "123" to the ID of your form.
$primary_form_id = 123;
- if( $form_id == $primary_form_id ) {
+ if ( $form_id == $primary_form_id ) {
return $rule_groups;
}
$rule_groups = array_merge( $rule_groups, GPLS_RuleGroup::load_by_form( $primary_form_id ) );
- foreach( $rule_groups as $rule_group ) {
+ foreach ( $rule_groups as $rule_group ) {
$rule_group->applicable_forms = false;
}
diff --git a/gp-live-preview/gplp-filter-preview-template-path.php b/gp-live-preview/gplp-filter-preview-template-path.php
index cef76fafa..8b19b1944 100644
--- a/gp-live-preview/gplp-filter-preview-template-path.php
+++ b/gp-live-preview/gplp-filter-preview-template-path.php
@@ -6,5 +6,5 @@
* Change the page template used to render the live preview.
*/
add_filter( 'gplp_preview_template', function( $template ) {
- return get_stylesheet_directory() . '/custom-template.php';
+ return get_stylesheet_directory() . '/custom-template.php';
} );
diff --git a/gp-media-library/gpml-ajax-upload.php b/gp-media-library/gpml-ajax-upload.php
index de56d74f8..dbd15a873 100644
--- a/gp-media-library/gpml-ajax-upload.php
+++ b/gp-media-library/gpml-ajax-upload.php
@@ -14,68 +14,68 @@
*/
class GPML_Ajax_Upload {
- public function __construct( $args = array() ) {
+ public function __construct( $args = array() ) {
- $this->_args = wp_parse_args( $args, array(
- 'default_entry_id' => 1,
- ) );
+ $this->_args = wp_parse_args( $args, array(
+ 'default_entry_id' => 1,
+ ) );
- add_action( 'init', array( $this, 'init' ), 11 );
+ add_action( 'init', array( $this, 'init' ), 11 );
- }
+ }
- public function init() {
+ public function init() {
- if( ! is_callable( 'gp_media_library' ) ) {
- return;
- }
+ if ( ! is_callable( 'gp_media_library' ) ) {
+ return;
+ }
- add_action( 'gform_post_multifile_upload', array( $this, 'upload' ), 10, 5 );
+ add_action( 'gform_post_multifile_upload', array( $this, 'upload' ), 10, 5 );
- remove_action( 'gform_entry_post_save', array( gp_media_library(), 'maybe_upload_to_media_library' ) );
- add_filter( 'gform_entry_post_save', array( $this, 'update_entry_field_values' ), 10, 2 );
+ remove_action( 'gform_entry_post_save', array( gp_media_library(), 'maybe_upload_to_media_library' ) );
+ add_filter( 'gform_entry_post_save', array( $this, 'update_entry_field_values' ), 10, 2 );
- // This filter ensures that this snippet is called on Gravity Flow inbox pages which do not
- // seem to trigger `gform_entry_post_save` when updating entries.
- add_filter( 'gravityflow_next_step', array( $this, 'gpml_gflow_next_step' ), 10, 4 );
+ // This filter ensures that this snippet is called on Gravity Flow inbox pages which do not
+ // seem to trigger `gform_entry_post_save` when updating entries.
+ add_filter( 'gravityflow_next_step', array( $this, 'gpml_gflow_next_step' ), 10, 4 );
- }
-
- public function gpml_gflow_next_step( $step, $current_step, $entry, $steps ) {
- $form = GFAPI::get_form( $entry[ 'form_id' ] );
+ }
+
+ public function gpml_gflow_next_step( $step, $current_step, $entry, $steps ) {
+ $form = GFAPI::get_form( $entry['form_id'] );
$this->update_entry_field_values( $entry, $form );
return $step;
- }
+ }
- public function upload( $form, $field, $uploaded_filename, $tmp_file_name, $file_path ) {
+ public function upload( $form, $field, $uploaded_filename, $tmp_file_name, $file_path ) {
- if( ! gp_media_library()->is_applicable_field( $field ) ) {
- return;
- }
+ if ( ! gp_media_library()->is_applicable_field( $field ) ) {
+ return;
+ }
- $field_uid = implode( '_', array( rgpost( 'gform_unique_id' ), $field->id ) );
+ $field_uid = implode( '_', array( rgpost( 'gform_unique_id' ), $field->id ) );
- $renamed_file_path = str_replace( basename( $file_path ), $uploaded_filename, $file_path );
+ $renamed_file_path = str_replace( basename( $file_path ), $uploaded_filename, $file_path );
rename( $file_path, $renamed_file_path );
- $id = gp_media_library()->upload_to_media_library( $renamed_file_path, $field, array( 'id' => $this->_args['default_entry_id'] ) );
- if( is_wp_error( $id ) ) {
- return;
- }
+ $id = gp_media_library()->upload_to_media_library( $renamed_file_path, $field, array( 'id' => $this->_args['default_entry_id'] ) );
+ if ( is_wp_error( $id ) ) {
+ return;
+ }
$key = sprintf( 'gpml_ids_%s', $field_uid );
- // Get file IDs.
- $ids = gform_get_meta( $this->_args['default_entry_id'], $key );
+ // Get file IDs.
+ $ids = gform_get_meta( $this->_args['default_entry_id'], $key );
- if( ! is_array( $ids ) ) {
- $ids = array();
- }
+ if ( ! is_array( $ids ) ) {
+ $ids = array();
+ }
- $ids[] = $id[0];
+ $ids[] = $id[0];
- // Update file IDs.
- gform_update_meta( $this->_args['default_entry_id'], $key, $ids, $form['id'] );
+ // Update file IDs.
+ gform_update_meta( $this->_args['default_entry_id'], $key, $ids, $form['id'] );
$output = array(
'status' => 'ok',
@@ -83,58 +83,58 @@ public function upload( $form, $field, $uploaded_filename, $tmp_file_name, $file
'temp_filename' => $tmp_file_name,
'uploaded_filename' => str_replace( "\\'", "'", urldecode( $uploaded_filename ) ), //Decoding filename to prevent file name mismatch.
'url' => wp_get_attachment_image_url( $id[0] ),
- )
+ ),
);
$output = json_encode( $output );
die( $output );
- }
+ }
- public function update_entry_field_values( $entry, $form ) {
+ public function update_entry_field_values( $entry, $form ) {
- foreach( $form['fields'] as $field ) {
+ foreach ( $form['fields'] as $field ) {
- if( $field->get_input_type() != 'fileupload' || ! $field->multipleFiles ) {
- continue;
- }
+ if ( $field->get_input_type() != 'fileupload' || ! $field->multipleFiles ) {
+ continue;
+ }
- $field_uid = implode( '_', array( rgpost( 'gform_unique_id' ), $field->id ) );
- $ids = gform_get_meta( $this->_args['default_entry_id'], sprintf( 'gpml_ids_%s', $field_uid ) );
- if( empty( $ids ) ) {
- continue;
- }
+ $field_uid = implode( '_', array( rgpost( 'gform_unique_id' ), $field->id ) );
+ $ids = gform_get_meta( $this->_args['default_entry_id'], sprintf( 'gpml_ids_%s', $field_uid ) );
+ if ( empty( $ids ) ) {
+ continue;
+ }
- $new_value = array();
+ $new_value = array();
- foreach( $ids as $id ) {
- if( ! is_wp_error( $id ) ) {
- $new_value[] = wp_get_attachment_url( $id );
- }
- }
- // Append to current value if present
- $current_value = rgar( $entry, $field->id, false );
- if ( $current_value ) {
- $new_value = array_merge( json_decode( $current_value ), $new_value );
- }
- $entry[ $field->id ] = json_encode( $new_value );
+ foreach ( $ids as $id ) {
+ if ( ! is_wp_error( $id ) ) {
+ $new_value[] = wp_get_attachment_url( $id );
+ }
+ }
+ // Append to current value if present
+ $current_value = rgar( $entry, $field->id, false );
+ if ( $current_value ) {
+ $new_value = array_merge( json_decode( $current_value ), $new_value );
+ }
+ $entry[ $field->id ] = json_encode( $new_value );
- $entry[ $field->id ] = json_encode( $new_value );
+ $entry[ $field->id ] = json_encode( $new_value );
- // Save our changes to the DB for this entry.
- GFAPI::update_entry_field( $entry['id'], $field->id, $entry[ $field->id ] );
+ // Save our changes to the DB for this entry.
+ GFAPI::update_entry_field( $entry['id'], $field->id, $entry[ $field->id ] );
- // Delete temporary file ID meta.
- gform_delete_meta( $this->_args['default_entry_id'], sprintf( 'gpml_ids_%s', $field_uid ) );
+ // Delete temporary file ID meta.
+ gform_delete_meta( $this->_args['default_entry_id'], sprintf( 'gpml_ids_%s', $field_uid ) );
- // Save the file ID meta to the actual entry/field.
- gp_media_library()->update_file_ids( $entry['id'], $field->id, $ids );
+ // Save the file ID meta to the actual entry/field.
+ gp_media_library()->update_file_ids( $entry['id'], $field->id, $ids );
- }
+ }
- return $entry;
- }
+ return $entry;
+ }
}
diff --git a/gp-media-library/gpml-attachment-id-merge-tag.php b/gp-media-library/gpml-attachment-id-merge-tag.php
index e9c5c3dbe..7b50a8e9b 100644
--- a/gp-media-library/gpml-attachment-id-merge-tag.php
+++ b/gp-media-library/gpml-attachment-id-merge-tag.php
@@ -2,8 +2,8 @@
/**
* Gravity Perks // Media Library // Merge Tag for Media Library IDs
* https://gravitywiz.com/documentation/gravity-forms-media-library/
- *
- * Adds support for fetching a comma-delimited list of attachment IDs after GPML has imported the files into the
+ *
+ * Adds support for fetching a comma-delimited list of attachment IDs after GPML has imported the files into the
* Media Library. Use the {entry:gpml_ids_FIELDID} merge tag.
*/
add_filter( 'gform_merge_tag_data', function( $data, $text, $form ) {
diff --git a/gp-media-library/gpml-change-upload-directory.php b/gp-media-library/gpml-change-upload-directory.php
index 5a08ef3f8..d8065024c 100644
--- a/gp-media-library/gpml-change-upload-directory.php
+++ b/gp-media-library/gpml-change-upload-directory.php
@@ -9,7 +9,7 @@
// Update "123" to your form ID.
add_filter( 'gpml_media_data_123', function( $return, $field, $entry ) {
$modify_upload_dir = function( $upload_dir ) use ( $entry ) {
- // Update the path and URL as desired.
+ // Update the path and URL as desired.
// You can use values from the entry to create a custom folder.
$upload_dir['path'] = WP_CONTENT_DIR . "/uploads/{$entry[4]}/my-custom-folder";
$upload_dir['url'] = WP_CONTENT_URL . "/uploads/{$entry[4]}/my-custom-folder";
diff --git a/gp-multi-page-navigation/gpmpn-gppa-disable-multi-page-navigation-page-links.css b/gp-multi-page-navigation/gpmpn-gppa-disable-multi-page-navigation-page-links.css
index 74c9698d4..8d5eb6a82 100644
--- a/gp-multi-page-navigation/gpmpn-gppa-disable-multi-page-navigation-page-links.css
+++ b/gp-multi-page-navigation/gpmpn-gppa-disable-multi-page-navigation-page-links.css
@@ -5,10 +5,10 @@
* This CSS disables Mulit-page Naviation's page links whenever GP Populate Anything disables the form navigation.
*/
.gppa-navigation-disabled .gwmpn-page-link {
- cursor: not-allowed;
- opacity: 0.5;
- color: currentColor;
- display: inline-block; /* For IE11/ MS Edge bug */
- pointer-events: none;
- text-decoration: none;
+ cursor: not-allowed;
+ opacity: 0.5;
+ color: currentColor;
+ display: inline-block; /* For IE11/ MS Edge bug */
+ pointer-events: none;
+ text-decoration: none;
}
diff --git a/gp-nested-forms/gpnf-add-child-entry-total-in-entry-list.php b/gp-nested-forms/gpnf-add-child-entry-total-in-entry-list.php
index 4004328d5..6cf2bce59 100644
--- a/gp-nested-forms/gpnf-add-child-entry-total-in-entry-list.php
+++ b/gp-nested-forms/gpnf-add-child-entry-total-in-entry-list.php
@@ -11,7 +11,7 @@
return $form;
}
- foreach( $form['fields'] as &$field ) {
+ foreach ( $form['fields'] as &$field ) {
if ( $field->get_input_type() !== 'form' ) {
continue;
diff --git a/gp-nested-forms/gpnf-add-custom-classes-to-add-entry-button.php b/gp-nested-forms/gpnf-add-custom-classes-to-add-entry-button.php
index f3130e361..fb6c5a2c7 100644
--- a/gp-nested-forms/gpnf-add-custom-classes-to-add-entry-button.php
+++ b/gp-nested-forms/gpnf-add-custom-classes-to-add-entry-button.php
@@ -5,7 +5,7 @@
*/
add_filter( 'gpnf_template_args', function( $args ) {
if ( $args['template'] === 'nested-entries' ) {
- $append_classes = 'class-a class-b';
+ $append_classes = 'class-a class-b';
$args['add_button'] = str_replace( 'gpnf-add-entry', 'gpnf-add-entry ' . $append_classes, $args['add_button'] );
}
return $args;
diff --git a/gp-nested-forms/gpnf-auto-attach-child-files.php b/gp-nested-forms/gpnf-auto-attach-child-files.php
index 887fd3007..5accc89d4 100644
--- a/gp-nested-forms/gpnf-auto-attach-child-files.php
+++ b/gp-nested-forms/gpnf-auto-attach-child-files.php
@@ -4,7 +4,7 @@
* http://gravitywiz.com/documentation/gravity-forms-nested-forms/
*
* This snippet automatically attaches files uploaded onto the child form to the parent form notifications.
- * If parent form has any File Upload fields, this snippet will rely on the "Attachments" setting for each parent notification.
+ * If parent form has any File Upload fields, this snippet will rely on the "Attachments" setting for each parent notification.
* Otherwise, you must specify a list of notifications by ID to which child uploads should be attached.
*
* Plugin Name: GP Nested Forms - Auto-attach Uploaded Files from Child to Parent Notifications
@@ -70,10 +70,8 @@
$attachment_url = preg_replace( '|^(.*?)/gravity_forms/|', $upload_root, $attachment_url );
$attachments[] = $attachment_url;
}
-
}
}
-
}
return $notification;
diff --git a/gp-nested-forms/gpnf-change-modal-title-and-submit-button.php b/gp-nested-forms/gpnf-change-modal-title-and-submit-button.php
index 3acba3ef2..12f97ad15 100644
--- a/gp-nested-forms/gpnf-change-modal-title-and-submit-button.php
+++ b/gp-nested-forms/gpnf-change-modal-title-and-submit-button.php
@@ -1,13 +1,13 @@
delete_cookie();
- }
- return $form;
+ if ( empty( $_POST ) && class_exists( 'GPNF_Session' ) ) {
+ $session = new GPNF_Session( $form['id'] );
+ $session->delete_cookie();
+ }
+ return $form;
} );
diff --git a/gp-nested-forms/gpnf-display-child-entries-table-format.php b/gp-nested-forms/gpnf-display-child-entries-table-format.php
index b3dc551da..c09f684f6 100644
--- a/gp-nested-forms/gpnf-display-child-entries-table-format.php
+++ b/gp-nested-forms/gpnf-display-child-entries-table-format.php
@@ -89,4 +89,4 @@ function gpnf_parse_input_ids( $input_ids, $nested_form_field_id ) {
}
}
return $input_ids;
-}
\ No newline at end of file
+}
diff --git a/gp-nested-forms/gpnf-display-image-file-upload.php b/gp-nested-forms/gpnf-display-image-file-upload.php
index da6d81d8e..af15d6564 100644
--- a/gp-nested-forms/gpnf-display-image-file-upload.php
+++ b/gp-nested-forms/gpnf-display-image-file-upload.php
@@ -3,4 +3,4 @@
add_filter( 'gpnf_display_value_123_4', function( $value, $field, $form, $entry ) {
$value['label'] = sprintf( '
', $value['value'] );
return $value;
-}, 10, 4 );
\ No newline at end of file
+}, 10, 4 );
diff --git a/gp-nested-forms/gpnf-display-value-drop-down-product.php b/gp-nested-forms/gpnf-display-value-drop-down-product.php
index 687815fcb..45558976a 100644
--- a/gp-nested-forms/gpnf-display-value-drop-down-product.php
+++ b/gp-nested-forms/gpnf-display-value-drop-down-product.php
@@ -6,11 +6,11 @@
* "My Product Choice ($10.00)" => "My Product Choice"
*/
add_filter( 'gpnf_select_display_value', function( $value, $field ) {
- if( $field->type == 'product' ) {
+ if ( $field->type == 'product' ) {
$index = strpos( $value['label'], '(' );
- if( $index !== false ) {
+ if ( $index !== false ) {
$value['label'] = substr( $value['label'], 0, $index );
}
}
return $value;
-}, 10, 2 );
\ No newline at end of file
+}, 10, 2 );
diff --git a/gp-nested-forms/gpnf-do-not-trash-child-entries.php b/gp-nested-forms/gpnf-do-not-trash-child-entries.php
index 241ce6146..e107afafe 100644
--- a/gp-nested-forms/gpnf-do-not-trash-child-entries.php
+++ b/gp-nested-forms/gpnf-do-not-trash-child-entries.php
@@ -2,7 +2,7 @@
/**
* Gravity Perks // Nested Forms // Don't Trash Child Entries
* https://gravitywiz.com/documentation/gravity-forms-nested-forms/
- *
+ *
* By default, Nested Forms will trash child entries when the parent entry is trashed. Use this snippet to prevent this
* default behavior.
*/
diff --git a/gp-nested-forms/gpnf-fillablepdfs-auto-attach-child-pdfs.php b/gp-nested-forms/gpnf-fillablepdfs-auto-attach-child-pdfs.php
index 0d9360776..3fdfa872a 100644
--- a/gp-nested-forms/gpnf-fillablepdfs-auto-attach-child-pdfs.php
+++ b/gp-nested-forms/gpnf-fillablepdfs-auto-attach-child-pdfs.php
@@ -11,7 +11,7 @@
// Initialize attachments array.
if ( ! isset( $notification['attachments'] ) ) {
- $notification['attachments'] = [];
+ $notification['attachments'] = array();
}
$attachments =& $notification['attachments'];
@@ -54,9 +54,7 @@
$attachments[] = fg_fillablepdfs()->get_physical_file_path( $entry_pdf );
}
-
}
-
}
return $notification;
diff --git a/gp-nested-forms/gpnf-gv-auto-attach-child-entries.php b/gp-nested-forms/gpnf-gv-auto-attach-child-entries.php
index 84d3ad010..f249f5a4b 100644
--- a/gp-nested-forms/gpnf-gv-auto-attach-child-entries.php
+++ b/gp-nested-forms/gpnf-gv-auto-attach-child-entries.php
@@ -9,7 +9,7 @@
*
* Use this snippet to automatically attach the child entry to the parent as soon as the child form is submitted.
*
- * To preserve the default behavior but warn users that newly added child entries have not been attached to the parent, see:
+ * To preserve the default behavior but warn users that newly added child entries have not been attached to the parent, see:
* https://github.com/gravitywiz/snippet-library/blob/master/gp-nested-forms/gpnf-gv-unsaved-child-entries-warning.js
*/
add_filter( 'gpnf_set_parent_entry_id', function( $parent_entry_id ) {
diff --git a/gp-nested-forms/gpnf-per-page-sessions.php b/gp-nested-forms/gpnf-per-page-sessions.php
index aeaff860d..a9078c994 100644
--- a/gp-nested-forms/gpnf-per-page-sessions.php
+++ b/gp-nested-forms/gpnf-per-page-sessions.php
@@ -3,9 +3,9 @@
* Gravity Perks // Nested Forms // Create Unique Sessions Per Page
* https://gravitywiz.com/documentation/gravity-forms-nested-forms/
*
- * By default, Nested Forms creates a session that is specific to the parent form. If you're
- * embedding the parent form on multiple pages, it may be undesirable for the parent form to share
- * the same session. This snippet will make the session unique to the page the parent form is
+ * By default, Nested Forms creates a session that is specific to the parent form. If you're
+ * embedding the parent form on multiple pages, it may be undesirable for the parent form to share
+ * the same session. This snippet will make the session unique to the page the parent form is
* embedded on.
*/
add_filter( 'gpnf_cookie_name', function ( $name ) {
diff --git a/gp-nested-forms/gpnf-short-labels.php b/gp-nested-forms/gpnf-short-labels.php
index 18fe35476..6fae7989e 100644
--- a/gp-nested-forms/gpnf-short-labels.php
+++ b/gp-nested-forms/gpnf-short-labels.php
@@ -10,12 +10,12 @@
add_filter( 'gpnf_template_args_123_4', function( $args ) {
if ( $args['template'] === 'nested-entries' ) {
foreach ( $args['nested_fields'] as &$nested_field ) {
- switch( $nested_field->id ) {
+ switch ( $nested_field->id ) {
// Update "1" to the field ID on your child form for which you would like to provide a shorter label.
case 1:
$nested_field->label = 'Choice';
break;
- // Add a new "case" statement for each field you need to customize.
+ // Add a new "case" statement for each field you need to customize.
case 2:
$nested_field->label = 'Text';
break;
diff --git a/gp-nested-forms/gpnf-sync-parent-child-entry-payment-status.php b/gp-nested-forms/gpnf-sync-parent-child-entry-payment-status.php
index e7fec9cd9..aa36f8029 100644
--- a/gp-nested-forms/gpnf-sync-parent-child-entry-payment-status.php
+++ b/gp-nested-forms/gpnf-sync-parent-child-entry-payment-status.php
@@ -6,7 +6,7 @@
* Sync the payment status of child entries with their parent's. This is useful with GP Limit Choices and GP Inventory
* to ensure that limits/inventories applied to child field's will not include child entries where payment has not been
* collected for their parent entry.
- *
+ *
* Plugin Name: GP Nested Forms — Sync Parent/Child Entry Payment Status
* Plugin URI: https://gravitywiz.com/documentation/gravity-forms-nested-forms/
* Description: Sync the payment status of child entries with their parent's.
diff --git a/gp-nested-forms/gpnf-triggered-population.php b/gp-nested-forms/gpnf-triggered-population.php
index d15ac41f5..85db34cba 100644
--- a/gp-nested-forms/gpnf-triggered-population.php
+++ b/gp-nested-forms/gpnf-triggered-population.php
@@ -21,10 +21,10 @@ public function __construct( $args = array() ) {
// set our default arguments, parse against the provided arguments, and store for use throughout the class
$this->_args = wp_parse_args( $args, array(
- 'form_id' => 0,
- 'trigger_field_id' => 0,
+ 'form_id' => 0,
+ 'trigger_field_id' => 0,
'trigger_field_value' => true,
- 'field_map' => array(),
+ 'field_map' => array(),
) );
// do version check in the init to make sure if GF is going to be loaded, it is already loaded
@@ -44,7 +44,7 @@ public function init() {
public function load_form_script( $form, $is_ajax_enabled ) {
- if( $this->is_applicable_form( $form ) && ! has_action( 'wp_footer', array( $this, 'output_script' ) ) ) {
+ if ( $this->is_applicable_form( $form ) && ! has_action( 'wp_footer', array( $this, 'output_script' ) ) ) {
add_action( 'wp_footer', array( $this, 'output_script' ) );
add_action( 'gform_preview_footer', array( $this, 'output_script' ) );
}
@@ -121,19 +121,19 @@ public function output_script() {
public function add_init_script( $form ) {
- if( ! $this->is_applicable_form( $form ) ) {
+ if ( ! $this->is_applicable_form( $form ) ) {
return;
}
$args = array(
- 'formId' => $this->_args['form_id'],
- 'triggerFieldId' => $this->_args['trigger_field_id'],
+ 'formId' => $this->_args['form_id'],
+ 'triggerFieldId' => $this->_args['trigger_field_id'],
'triggerFieldValue' => $this->_args['trigger_field_value'],
'nestedFormFieldId' => $this->_args['nested_form_field_id'],
- 'fieldMap' => $this->_args['field_map'],
- 'ajaxUrl' => admin_url( 'admin-ajax.php' ),
- 'nonce' => wp_create_nonce( 'gpnf_triggered_population_add_child_entry' ),
- 'hash' => $this->get_instance_hash(),
+ 'fieldMap' => $this->_args['field_map'],
+ 'ajaxUrl' => admin_url( 'admin-ajax.php' ),
+ 'nonce' => wp_create_nonce( 'gpnf_triggered_population_add_child_entry' ),
+ 'hash' => $this->get_instance_hash(),
);
$script = 'new GPNFTriggeredPopulation( ' . json_encode( $args ) . ' );';
@@ -162,14 +162,14 @@ public function ajax_add_child_entry() {
}
$nested_form_field = GFAPI::get_field( $this->_args['form_id'], $this->_args['nested_form_field_id'] );
- $child_form_id = $nested_form_field->gpnfForm;
+ $child_form_id = $nested_form_field->gpnfForm;
parse_str( rgpost( 'data' ), $data );
$entry_data = array();
- foreach( $this->_args['field_map'] as $source_field_id => $target_field_id ) {
- foreach( $data as $key => $value ) {
+ foreach ( $this->_args['field_map'] as $source_field_id => $target_field_id ) {
+ foreach ( $data as $key => $value ) {
if ( sprintf( 'input_%s', str_replace( '.', '_', $source_field_id ) ) === $key ) {
$entry_data[ $target_field_id ] = $value;
}
@@ -183,8 +183,8 @@ public function ajax_add_child_entry() {
$entry_data['form_id'] = $child_form_id;
$child_entry_id = GFAPI::add_entry( $entry_data );
- $child_entry = GFAPI::get_entry( $child_entry_id );
- $field_values = gp_nested_forms()->get_entry_display_values( $child_entry, GFAPI::get_form( $child_form_id ) );
+ $child_entry = GFAPI::get_entry( $child_entry_id );
+ $field_values = gp_nested_forms()->get_entry_display_values( $child_entry, GFAPI::get_form( $child_form_id ) );
$child_entry = new GPNF_Entry( GFAPI::get_entry( $child_entry_id ) );
$child_entry->set_parent_form( $this->_args['form_id'] );
@@ -218,15 +218,15 @@ public function get_instance_hash() {
# Configuration
new GPNF_Triggered_Population( array(
- 'form_id' => 123,
- 'trigger_field_id' => 4,
- 'trigger_field_value' => 'Yes',
+ 'form_id' => 123,
+ 'trigger_field_id' => 4,
+ 'trigger_field_value' => 'Yes',
'nested_form_field_id' => 5,
- 'field_map' => array(
+ 'field_map' => array(
// source field ID => target field ID
'6.3' => '3.3',
'6.6' => '3.6',
'7' => '4',
'8' => '5',
- )
+ ),
) );
diff --git a/gp-populate-anything/gppa-acf-repeater-mapper.php b/gp-populate-anything/gppa-acf-repeater-mapper.php
index f217d7c95..4ed4aa8a7 100644
--- a/gp-populate-anything/gppa-acf-repeater-mapper.php
+++ b/gp-populate-anything/gppa-acf-repeater-mapper.php
@@ -38,7 +38,7 @@
// Look for ACF repeater meta: repeater_name_0_subfield_name
if ( preg_match( '/meta_([^0-9]+)_([0-9]+)_(.+)/', $key, $matches ) ) {
list( , $repeater, $index, $subfield ) = $matches;
- $map[ $template ] = $subfield;
+ $map[ $template ] = $subfield;
}
}
@@ -51,7 +51,7 @@
foreach ( $objects as $object ) {
$rows = get_field( $repeater, $object->ID );
if ( $rows ) {
- foreach( $rows as $row ) {
+ foreach ( $rows as $row ) {
$choices[] = array(
'value' => rgar( $row, $map['value'] ),
'text' => rgar( $row, $map['label'] ),
diff --git a/gp-populate-anything/gppa-filter-by-relative-dates.php b/gp-populate-anything/gppa-filter-by-relative-dates.php
index 447f3f2a7..e238629d2 100644
--- a/gp-populate-anything/gppa-filter-by-relative-dates.php
+++ b/gp-populate-anything/gppa-filter-by-relative-dates.php
@@ -2,24 +2,24 @@
/**
* Gravity Perks // Populate Anything // Filter Results on Relative Dates
* https://gravitywiz.com/documentation/gravity-forms-populate-anything/#how-can-i-filter-posts-those-published-in-the-last-month
- *
+ *
* It adds merge tags that can be used as Custom Values in this format: {INTEGER UNIT ago}, to filter the results on relative dates.
*
* -------
* Instructions:
* -------
* 1. Replace 'post' with whatever object type you wish to add these merge tags to.
- *
- * Note, newer versions of GP Populate Anything support 'gppa_replace_filter_value_variables' which works for all
+ *
+ * Note, newer versions of GP Populate Anything support 'gppa_replace_filter_value_variables' which works for all
* object types.
*
- * 2. Change the filter value to "Add Custom Value" and insert a merge tag that follows
+ * 2. Change the filter value to "Add Custom Value" and insert a merge tag that follows
* the following format: {INTEGER UNIT ago}
*
* Examples:
* {3 days ago}
* {2 hours ago}
- * {1 month ago}
+ * {1 month ago}
* {3 weeks ago}
* {1 year ago}
*
diff --git a/gp-populate-anything/gppa-force-dyn-pop-on-gv-edit.php b/gp-populate-anything/gppa-force-dyn-pop-on-gv-edit.php
index 89e164fdf..5a4cdb8e0 100644
--- a/gp-populate-anything/gppa-force-dyn-pop-on-gv-edit.php
+++ b/gp-populate-anything/gppa-force-dyn-pop-on-gv-edit.php
@@ -11,7 +11,7 @@
if ( $field->formId == 123 && $field->id == 4 ) {
if ( isset( $GLOBALS['gppa-field-values'] ) ) {
$hydrated_field = gp_populate_anything()->hydrate_field( $field, GFAPI::get_form( $field->formId ), array(), null, false );
- $field_value = $hydrated_field['field_value'];
+ $field_value = $hydrated_field['field_value'];
}
}
return $field_value;
diff --git a/gp-populate-anything/gppa-lmt-diff-modifier.php b/gp-populate-anything/gppa-lmt-diff-modifier.php
index 3246f6c88..fc6b29cd8 100644
--- a/gp-populate-anything/gppa-lmt-diff-modifier.php
+++ b/gp-populate-anything/gppa-lmt-diff-modifier.php
@@ -28,7 +28,7 @@
$format = rgar( $modifiers, 'format', 'y' );
- return $diff->format("%{$format}" );
+ return $diff->format( "%{$format}" );
}, 10, 5 );
if ( ! function_exists( 'gw_parse_modifiers' ) ) {
diff --git a/gp-populate-anything/gppa-merge-tag-context-modifier.php b/gp-populate-anything/gppa-merge-tag-context-modifier.php
index b025f5b81..b53cb5daf 100644
--- a/gp-populate-anything/gppa-merge-tag-context-modifier.php
+++ b/gp-populate-anything/gppa-merge-tag-context-modifier.php
@@ -32,17 +32,17 @@
function gw_parse_modifiers( $modifiers_str ) {
preg_match_all( '/([a-z]+)(?:(?:\[(.+?)\])|,?)/i', $modifiers_str, $modifiers, PREG_SET_ORDER );
- $parsed = array();
+ $parsed = array();
- foreach( $modifiers as $modifier ) {
+ foreach ( $modifiers as $modifier ) {
list( $match, $modifier, $value ) = array_pad( $modifier, 3, null );
- if( $value === null ) {
+ if ( $value === null ) {
$value = $modifier;
}
// Split '1,2,3' into array( 1, 2, 3 ).
- if( strpos( $value, ',' ) !== false ) {
+ if ( strpos( $value, ',' ) !== false ) {
$value = array_map( 'trim', explode( ',', $value ) );
}
diff --git a/gp-populate-anything/gppa-populate-child-entries.php b/gp-populate-anything/gppa-populate-child-entries.php
index 7c4672fef..c1668507b 100644
--- a/gp-populate-anything/gppa-populate-child-entries.php
+++ b/gp-populate-anything/gppa-populate-child-entries.php
@@ -89,7 +89,7 @@ public function modify_gv_entry( $gv_edit_entry_renderer ) {
public function load_form_script( $form, $is_ajax_enabled ) {
- if( $this->is_applicable_form( $form ) && ! has_action( 'wp_footer', array( $this, 'output_script' ) ) ) {
+ if ( $this->is_applicable_form( $form ) && ! has_action( 'wp_footer', array( $this, 'output_script' ) ) ) {
add_action( 'wp_footer', array( $this, 'output_script' ) );
add_action( 'gform_preview_footer', array( $this, 'output_script' ) );
}
@@ -163,7 +163,7 @@ public function output_script() {
public function add_init_script( $form ) {
- if( ! $this->is_applicable_form( $form ) ) {
+ if ( ! $this->is_applicable_form( $form ) ) {
return;
}
@@ -185,7 +185,7 @@ public function is_applicable_form( $form ) {
}
public function get_parent_entry_id_field( $form ) {
- foreach( $form['fields'] as $field ) {
+ foreach ( $form['fields'] as $field ) {
if ( $field->inputName === 'gpnf_parent_entry_id' ) {
return $field->id;
}
diff --git a/gp-populate-anything/gppa-postmeta-property-value-limit.php b/gp-populate-anything/gppa-postmeta-property-value-limit.php
index 2f7fade99..97d8b7d35 100644
--- a/gp-populate-anything/gppa-postmeta-property-value-limit.php
+++ b/gp-populate-anything/gppa-postmeta-property-value-limit.php
@@ -11,4 +11,4 @@
$sql = str_replace( '1000', $meta_limit, $sql );
}
return $sql;
-}, 10, 4 );
\ No newline at end of file
+}, 10, 4 );
diff --git a/gp-populate-anything/gppa-preserve-selections.php b/gp-populate-anything/gppa-preserve-selections.php
index ae30bac9f..a2a4ca6d2 100644
--- a/gp-populate-anything/gppa-preserve-selections.php
+++ b/gp-populate-anything/gppa-preserve-selections.php
@@ -3,7 +3,7 @@
* Gravity Perks // Populate Anything // Preserve Field Selections on Repopulation
* https://gravitywiz.com/documentation/gravity-forms-populate-anything/
*/
-// Update "123" to your form ID and "4" to your field ID.
+// Update "123" to your form ID and "4" to your field ID.
add_filter( 'gppa_input_choices_123_4', function( $choices, $field, $objects ) {
$selected_values = (array) rgar( gp_populate_anything()->get_field_values_from_request(), $field->id );
foreach ( $choices as &$choice ) {
diff --git a/gp-populate-anything/gppa-set-current-form-on-duplicate.php b/gp-populate-anything/gppa-set-current-form-on-duplicate.php
index 26c15b8c5..75da4061a 100644
--- a/gp-populate-anything/gppa-set-current-form-on-duplicate.php
+++ b/gp-populate-anything/gppa-set-current-form-on-duplicate.php
@@ -4,23 +4,23 @@
* https://gravitywiz.com/documentation/gravity-forms-populate-anything/
*
* When populating Gravity Forms Entries via Populate Anything, it can save time to automatically update the selected
- * form ID to the new form ID when duplicating an existing form.
+ * form ID to the new form ID when duplicating an existing form.
*
* To enable on any field, just set the "gppa-set-current-form" class on the CSS Class Name setting.
- *
+ *
* Plugin Name: GP Populate Anything - Auto-update Form ID on Form Duplication
* Plugin URI: https://gravitywiz.com/documentation/gravity-forms-populate-anything/
- * Description: Auto-update form ID to the new form ID when duplicating an existing form.
+ * Description: Auto-update form ID to the new form ID when duplicating an existing form.
* Author: Gravity Wiz
* Version: 0.1
* Author URI: https://gravitywiz.com/
*/
add_action( 'gform_post_form_duplicated', function( $form_id, $new_id ) {
- $form = GFAPI::get_form( $new_id );
+ $form = GFAPI::get_form( $new_id );
$has_change = false;
foreach ( $form['fields'] as &$field ) {
if ( strpos( $field->cssClass, 'gppa-set-current-form' ) !== false ) {
- $has_change = true;
+ $has_change = true;
$field->{'gppa-values-primary-property'} = $new_id;
}
}
diff --git a/gp-populate-anything/gppa-set-post-taxonomy-terms.php b/gp-populate-anything/gppa-set-post-taxonomy-terms.php
index 3f149fca1..a3dc83f5b 100644
--- a/gp-populate-anything/gppa-set-post-taxonomy-terms.php
+++ b/gp-populate-anything/gppa-set-post-taxonomy-terms.php
@@ -2,19 +2,19 @@
/**
* Gravity Perks // Populate Anything // Set Post Taxonomy Terms
* https://gravitywiz.com/documentation/gravity-forms-populate-anything/
- *
- * When the Term ID is set as the value of a dynamically populated choice-based, this snippet allows you
- * update the post that is created with the name of the taxonomy instead the term ID.
+ *
+ * When the Term ID is set as the value of a dynamically populated choice-based, this snippet allows you
+ * update the post that is created with the name of the taxonomy instead the term ID.
*
* Note: This only applies to forms that have Post Fields.
*/
add_filter( 'gform_after_create_post', function( $post_id, $entry, $form ) {
- foreach( $form['fields'] as &$field ) {
- if( is_callable( 'gp_populate_anything' ) && $field->{'gppa-choices-enabled'} && $field->{'gppa-choices-object-type'} == 'term' ) {
- $value = gp_populate_anything()->get_field_value( $form, $entry, $field->id );
+ foreach ( $form['fields'] as &$field ) {
+ if ( is_callable( 'gp_populate_anything' ) && $field->{'gppa-choices-enabled'} && $field->{'gppa-choices-object-type'} == 'term' ) {
+ $value = gp_populate_anything()->get_field_value( $form, $entry, $field->id );
$term_ids = is_array( $value ) ? $value : explode( ',', $value );
- $term = get_term( $term_ids[0] );
+ $term = get_term( $term_ids[0] );
wp_set_post_terms( $post_id, $term_ids, $term->taxonomy );
}
}
diff --git a/gp-post-content-merge-tags/gppcmt-save-confirmation-url-to-field.php b/gp-post-content-merge-tags/gppcmt-save-confirmation-url-to-field.php
index 764acbf8f..91dbcc2ea 100644
--- a/gp-post-content-merge-tags/gppcmt-save-confirmation-url-to-field.php
+++ b/gp-post-content-merge-tags/gppcmt-save-confirmation-url-to-field.php
@@ -3,7 +3,7 @@
* Gravity Perks // GP Post Content Merge Tags // Save Confirmation URL to Field
* https://gravitywiz.com/documentation/gravity-forms-post-content-merge-tags/
*
- * Save the confirmation URL (including the generated eid parameter) to a field on your form
+ * Save the confirmation URL (including the generated eid parameter) to a field on your form
* so that it can be mapped via Gravity Forms feeds and used anywhere field-based merge tags are supported.
*/
// 1. Update "123" to your form ID.
@@ -17,7 +17,7 @@
/* DON'T EDIT BELOW THIS LINE */
- if( function_exists( 'gp_post_content_merge_tags' ) ) {
+ if ( function_exists( 'gp_post_content_merge_tags' ) ) {
$eid = gp_post_content_merge_tags()->prepare_eid( $entry['id'], true );
$url = add_query_arg( 'eid', $eid, $url );
diff --git a/gp-price-range/gppr-validation-messages.php b/gp-price-range/gppr-validation-messages.php
index 55cb75648..294cb2c55 100644
--- a/gp-price-range/gppr-validation-messages.php
+++ b/gp-price-range/gppr-validation-messages.php
@@ -4,13 +4,13 @@
* http://gravitywiz.com/documentation/gp-price-range/
*/
add_filter( 'gppr_validation_messages', function( $messages, $min, $max, $form_id, $field_id ) {
-
- $min = GFCommon::to_money( $min );
- $max = GFCommon::to_money( $max );
-
- $messages['min_and_max'] = sprintf( 'Please enter an amount between %s and %s.', $min, $max );
- $messages['min'] = sprintf( 'Please enter a price greater than or equal to %s.', $min );
- $messages['max'] = sprintf( 'Please enter a price less than or equal to %s.', $max );
-
- return $messages;
-}, 10, 5 );
\ No newline at end of file
+
+ $min = GFCommon::to_money( $min );
+ $max = GFCommon::to_money( $max );
+
+ $messages['min_and_max'] = sprintf( 'Please enter an amount between %s and %s.', $min, $max );
+ $messages['min'] = sprintf( 'Please enter a price greater than or equal to %s.', $min );
+ $messages['max'] = sprintf( 'Please enter a price less than or equal to %s.', $max );
+
+ return $messages;
+}, 10, 5 );
diff --git a/gp-read-only/gpro-disable-for-admins.php b/gp-read-only/gpro-disable-for-admins.php
index 4d9a581cd..be96ec2c3 100644
--- a/gp-read-only/gpro-disable-for-admins.php
+++ b/gp-read-only/gpro-disable-for-admins.php
@@ -21,10 +21,10 @@
* Author URI: https://gravitywiz.com/
*/
add_filter( 'gform_pre_render', function( $form ) {
- foreach( $form['fields'] as $field ) {
- if( strpos( $field->cssClass, "gp-read-only-except-admin" ) !== false && current_user_can( 'administrator' ) ) {
- $field->gwreadonly_enable = false;
- }
- }
- return $form;
+ foreach ( $form['fields'] as $field ) {
+ if ( strpos( $field->cssClass, 'gp-read-only-except-admin' ) !== false && current_user_can( 'administrator' ) ) {
+ $field->gwreadonly_enable = false;
+ }
+ }
+ return $form;
} );
diff --git a/gp-unique-id/gpuid-dynamic-population.php b/gp-unique-id/gpuid-dynamic-population.php
index 28882e3a8..24734fee0 100644
--- a/gp-unique-id/gpuid-dynamic-population.php
+++ b/gp-unique-id/gpuid-dynamic-population.php
@@ -11,23 +11,23 @@
* 4 - Set "uid" as the value for the Paramater Name setting (screenshot: https://gwiz.io/2HhtBTa).
*/
add_filter( 'gform_field_value_uid', function( $value, $field ) {
-
- // Update what type of unique ID you would like to generate. Accepts 'alphanumeric', 'numeric', or 'sequential'.
- $type_of_id = 'alphanumeric';
-
- // How long would you like your unique ID to be?
- $length = 4;
-
+
+ // Update what type of unique ID you would like to generate. Accepts 'alphanumeric', 'numeric', or 'sequential'.
+ $type_of_id = 'alphanumeric';
+
+ // How long would you like your unique ID to be?
+ $length = 4;
+
if ( function_exists( 'gp_unique_id' ) ) {
// This filter will be called multiple times per page load. Only generate a new ID once.
- static $gw_uid = false;
- $field[ gp_unique_id()->perk->key( 'type' ) ] = $type_of_id;
+ static $gw_uid = false;
+ $field[ gp_unique_id()->perk->key( 'type' ) ] = $type_of_id;
$field[ gp_unique_id()->perk->key( 'length' ) ] = $length;
if ( ! $gw_uid ) {
$gw_uid = gp_unique_id()->get_unique( $field->formId, $field );
}
$value = $gw_uid;
}
-
+
return $value;
}, 10, 2 );
diff --git a/gp-unique-id/gpuid-global-sequential-id.php b/gp-unique-id/gpuid-global-sequential-id.php
index 84227c3ec..ebb5bd3aa 100644
--- a/gp-unique-id/gpuid-global-sequential-id.php
+++ b/gp-unique-id/gpuid-global-sequential-id.php
@@ -3,14 +3,14 @@
* Gravity Perks // Unique ID // Share a global sequential unique ID across all forms
* https://gravitywiz.com/documentation/gravity-forms-unique-id/
*
- * Sets a global sequential unique ID across all forms on the website.
+ * Sets a global sequential unique ID across all forms on the website.
*
- * To use this snippet, add Unique ID fields on all the forms you'd like to generate Unique IDs,
- * and update the $atts variable within the snippet to target any of the forms and its Unique ID field.
+ * To use this snippet, add Unique ID fields on all the forms you'd like to generate Unique IDs,
+ * and update the $atts variable within the snippet to target any of the forms and its Unique ID field.
*
* Plugin Name: GP Unique ID — Global Sequential ID
* Plugin URI: https://gravitywiz.com/documentation/gravity-forms-unique-id/
- * Description: Sets a global sequential unique ID across all forms on the website.
+ * Description: Sets a global sequential unique ID across all forms on the website.
* Author: Gravity Wiz
* Version: 0.1
* Author URI: https://gravitywiz.com/
@@ -18,10 +18,10 @@
add_filter( 'gpui_unique_id_attributes', 'gwiz_unique_id_global_sequential_index', 10, 3 );
function gwiz_unique_id_global_sequential_index( $atts, $form_id, $field_id ) {
- if( $atts['type'] == 'sequential' ) {
+ if ( $atts['type'] == 'sequential' ) {
$atts['starting_number'] = 1;
- $atts['form_id'] = 1;
- $atts['field_id'] = 1;
+ $atts['form_id'] = 1;
+ $atts['field_id'] = 1;
}
return $atts;
diff --git a/gp-unique-id/gpuid-input-masks.php b/gp-unique-id/gpuid-input-masks.php
index 82f5270c5..3ff2c6176 100644
--- a/gp-unique-id/gpuid-input-masks.php
+++ b/gp-unique-id/gpuid-input-masks.php
@@ -6,13 +6,13 @@
add_filter( 'gpui_unique_id', function( $unique, $form_id, $field_id ) {
// Update "123" to your form ID and "4" to your Unique ID's field ID.
if ( $form_id == 123 && $field_id == 4 ) {
- /*
- * Define your input mask.
+ /*
+ * Define your input mask.
* - "a" will be any lowercase letter a through z.
* - "A" will be any uppercase letter A through Z.
* - "9" will be any number 0 - 9.
*/
- $mask = 'aa 999 999';
+ $mask = 'aa 999 999';
$unique = gpui_generate_unique_id_from_mask( $mask );
}
return $unique;
@@ -20,7 +20,7 @@
if ( ! function_exists( 'gpui_generate_unique_id_from_mask' ) ) {
function gpui_generate_unique_id_from_mask( $mask ) {
- $uid = '';
+ $uid = '';
$chars = str_split( $mask );
foreach ( $chars as $char ) {
switch ( $char ) {
diff --git a/gp-unique-id/gpuid-populate-on-pre-submission.php b/gp-unique-id/gpuid-populate-on-pre-submission.php
index bf496bb78..7b5551d07 100644
--- a/gp-unique-id/gpuid-populate-on-pre-submission.php
+++ b/gp-unique-id/gpuid-populate-on-pre-submission.php
@@ -8,14 +8,14 @@
*
* Plugin Name: GP Unique ID - Populate Unique ID on Pre Submission
* Plugin URI: https://gravitywiz.com/documentation/gravity-forms-unique-id/
- * Description: Generate and populate the Unique ID on pre submission prior to the entry creation.
+ * Description: Generate and populate the Unique ID on pre submission prior to the entry creation.
* Author: Gravity Wiz
* Version: 0.1
* Author URI: https://gravitywiz.com/
*/
add_action( 'gform_pre_submission', function( $form ) {
- if( ! function_exists( 'gp_unique_id' ) ) {
+ if ( ! function_exists( 'gp_unique_id' ) ) {
return;
}
@@ -26,8 +26,8 @@
remove_filter( 'gform_entry_post_save', array( $gpui_field, 'populate_field_value' ) );
// loop through the submitted form object for Unique ID fields
- foreach( $form['fields'] as $field ) {
- if( $field->get_input_type() == 'uid' && ! GFFormsModel::is_field_hidden( $form, $field, array() ) ) {
+ foreach ( $form['fields'] as $field ) {
+ if ( $field->get_input_type() == 'uid' && ! GFFormsModel::is_field_hidden( $form, $field, array() ) ) {
// generate a unique ID
$value = gp_unique_id()->get_unique( $form['id'], $field );
@@ -36,7 +36,7 @@
$_POST[ sprintf( 'input_%s', $field['id'] ) ] = $value;
// since the "current entry" is already set, we need to update it manually so other plugins will have access to the unique ID
- $entry = GFFormsModel::get_current_lead();
+ $entry = GFFormsModel::get_current_lead();
$entry[ $field['id'] ] = $value;
GFFormsModel::set_current_lead( $entry );
diff --git a/gp-unique-id/gpuid-set-authorize-net-invoice-number.php b/gp-unique-id/gpuid-set-authorize-net-invoice-number.php
index f33f56a8c..9a39ea0bc 100644
--- a/gp-unique-id/gpuid-set-authorize-net-invoice-number.php
+++ b/gp-unique-id/gpuid-set-authorize-net-invoice-number.php
@@ -8,19 +8,19 @@
add_filter( 'gform_authorizenet_transaction_pre_capture', 'gpui_set_unique_transaction_id', 10, 5 );
function gpui_set_unique_transaction_id( $transaction, $form_data, $config, $form ) {
- // Update "123" to the form ID
- $target_form_id = 123;
- // Update "4" to the Unique ID field ID
- $unique_id_field_id = 4;
+ // Update "123" to the form ID
+ $target_form_id = 123;
+ // Update "4" to the Unique ID field ID
+ $unique_id_field_id = 4;
- if( $form['id'] == $target_form_id && is_callable( 'gp_unique_id' ) ) {
- foreach ( $form['fields'] as $field ) {
- if ($field->id == $unique_id_field_id){
- $uid = gp_unique_id()->get_unique( $form['id'], $field );
- $transaction->invoice_num = $uid;
- $_POST[ "input_{$unique_id_field_id}" ] = $uid;
- }
- }
- }
- return $transaction;
+ if ( $form['id'] == $target_form_id && is_callable( 'gp_unique_id' ) ) {
+ foreach ( $form['fields'] as $field ) {
+ if ( $field->id == $unique_id_field_id ) {
+ $uid = gp_unique_id()->get_unique( $form['id'], $field );
+ $transaction->invoice_num = $uid;
+ $_POST[ "input_{$unique_id_field_id}" ] = $uid;
+ }
+ }
+ }
+ return $transaction;
}
diff --git a/gp-unique-id/gpuid-shared-sequences.php b/gp-unique-id/gpuid-shared-sequences.php
index 434cd3ae5..ff330c3da 100644
--- a/gp-unique-id/gpuid-shared-sequences.php
+++ b/gp-unique-id/gpuid-shared-sequences.php
@@ -6,9 +6,9 @@
* Share sequences between sequential Unique ID fields; works with fields on different forms as well.
*
* To use the snippet, replace the numbers in the array below to match your form IDs and field IDs.
- * For example, if Form A has an ID of 123 and its Unique ID field's ID is 1 and Form B has an ID of
+ * For example, if Form A has an ID of 123 and its Unique ID field's ID is 1 and Form B has an ID of
* 456 and its Unique ID field's ID is 2, then you would set up the group like so:
- *
+ *
* $groups = array(
* array(
* 123 => 1,
diff --git a/gp-unique-id/gpuid-site-address-title-validation.php b/gp-unique-id/gpuid-site-address-title-validation.php
index eb8c65e0b..d01acaf1e 100644
--- a/gp-unique-id/gpuid-site-address-title-validation.php
+++ b/gp-unique-id/gpuid-site-address-title-validation.php
@@ -19,12 +19,11 @@ function gp_unique_id_for_site_validation( $form, $feed ) {
$site_address_field_id = rgars( $feed, 'meta/multisite_options/site_address' );
$site_name_field_id = rgars( $feed, 'meta/multisite_options/site_title' );
- foreach( $form['fields'] as &$field ) {
+ foreach ( $form['fields'] as &$field ) {
- if( $field['type'] == 'uid' && in_array( $field['id'], array( $site_address_field_id, $site_name_field_id ) ) ) {
+ if ( $field['type'] == 'uid' && in_array( $field['id'], array( $site_address_field_id, $site_name_field_id ) ) ) {
$field['failed_validation'] = false;
}
-
}
return $form;
diff --git a/gp-unique-id/gpuid-username-validation.php b/gp-unique-id/gpuid-username-validation.php
index 393a69e18..37b9a3577 100644
--- a/gp-unique-id/gpuid-username-validation.php
+++ b/gp-unique-id/gpuid-username-validation.php
@@ -21,8 +21,8 @@ function gp_unique_id_for_username_validation( $form, $feed ) {
$username_field_id = rgars( $feed, 'meta/username' );
$site_address_field_id = rgars( $feed, 'meta/multisite_options/site_address' );
- foreach( $form['fields'] as &$field ) {
- if( in_array( $field['id'], array( $username_field_id, $site_address_field_id ) ) && $field['type'] == 'uid' ) {
+ foreach ( $form['fields'] as &$field ) {
+ if ( in_array( $field['id'], array( $username_field_id, $site_address_field_id ) ) && $field['type'] == 'uid' ) {
$field['failed_validation'] = false;
}
}
diff --git a/gp-unique-id/gpuid-wait-for-payment-support-for-payfast.php b/gp-unique-id/gpuid-wait-for-payment-support-for-payfast.php
index 5b73c65e6..8eeb6ce1a 100644
--- a/gp-unique-id/gpuid-wait-for-payment-support-for-payfast.php
+++ b/gp-unique-id/gpuid-wait-for-payment-support-for-payfast.php
@@ -2,7 +2,7 @@
/**
* Gravity Perks // GP Unique ID // Add Wait-for-payment Support for PayFast
* https://gravitywiz.com/documentation/gp-unique-id/
- *
+ *
* Capture a payment made via PayFast before generating the Unique ID.
*
* Plugin Name: GP Unique ID — Add Wait-for-payment Support for PayFast
@@ -14,18 +14,18 @@
*/
// 1 - Indicate that waiting for payments is enabled.
add_filter( 'gpui_wait_for_payment', '__return_true' );
-
+
// 2 - Fetch the applicable payment feed for your gateway.
add_filter( 'gpui_wait_for_payment_feed', function ( $return_feed, $form, $entry ) {
- $entry['id'] = null;
- $feed = gf_payfast()->get_payment_feed( $entry, $form );
+ $entry['id'] = null;
+ $feed = gf_payfast()->get_payment_feed( $entry, $form );
$submission_data = gf_payfast()->get_submission_data( $feed, $form, $entry );
if ( $feed && ! empty( $submission_data['payment_amount'] ) ) {
$return_feed = $feed;
}
return $return_feed;
}, 10, 3 );
-
+
// 3 - Call populate_field_value() with the $fulfilled flag set to true when the payment is completed.
// This example is how it works with the Gravity Forms PayPal add-on. When the payment is fulfilled,
// PayPal triggers the gform_paypal_fulfillment action. We bind to that action and call the
diff --git a/gp-word-count/gpwc-disable-limits-for-logged-in-users.php b/gp-word-count/gpwc-disable-limits-for-logged-in-users.php
index 5a889ce0b..52a44758c 100644
--- a/gp-word-count/gpwc-disable-limits-for-logged-in-users.php
+++ b/gp-word-count/gpwc-disable-limits-for-logged-in-users.php
@@ -18,4 +18,4 @@ function gpwc_remove_limits_for_logged_in_user( $form ) {
}
return $form;
-}
\ No newline at end of file
+}
diff --git a/gravity-forms/display-number-of-entries-left.php b/gravity-forms/display-number-of-entries-left.php
index 005bf36e6..86904d950 100644
--- a/gravity-forms/display-number-of-entries-left.php
+++ b/gravity-forms/display-number-of-entries-left.php
@@ -11,7 +11,7 @@
function gwiz_entries_left_shortcode( $output, $atts ) {
extract( shortcode_atts( array(
'id' => false,
- 'format' => false // should be 'comma', 'decimal'
+ 'format' => false, // should be 'comma', 'decimal'
), $atts ) );
if ( ! $id ) {
@@ -23,8 +23,8 @@ function gwiz_entries_left_shortcode( $output, $atts ) {
return '';
}
- $entry_count = GFAPI::count_entries( $form['id'], array(
- 'status' => 'active'
+ $entry_count = GFAPI::count_entries( $form['id'], array(
+ 'status' => 'active',
) );
$entries_left = rgar( $form, 'limitEntriesCount' ) - $entry_count;
diff --git a/gravity-forms/gw-advanced-conditional-shortcodes.php b/gravity-forms/gw-advanced-conditional-shortcodes.php
index aa6e6ce22..1975c026c 100644
--- a/gravity-forms/gw-advanced-conditional-shortcodes.php
+++ b/gravity-forms/gw-advanced-conditional-shortcodes.php
@@ -19,45 +19,44 @@
*/
add_filter( 'gform_shortcode_conditional', function( $result, $atts, $content ) {
- if( ! isset( $atts['value'] ) || isset( $atts['merge_tag'] ) ) {
+ if ( ! isset( $atts['value'] ) || isset( $atts['merge_tag'] ) ) {
return $result;
}
$relation = strtolower( rgar( $atts, 'relation', 'all' ) ); // or 'any'
$conditions = array();
- foreach( $atts as $key => $prop ) {
+ foreach ( $atts as $key => $prop ) {
preg_match( '|value(\d*)$|', $key, $match );
- if( ! empty( $match ) ) {
+ if ( ! empty( $match ) ) {
list( , $index ) = $match;
- $conditions[] = array(
+ $conditions[] = array(
'value' => rgar( $atts, sprintf( 'value%s', $index ) ),
'operator' => rgar( $atts, sprintf( 'operator%s', $index ) ),
'compare' => rgar( $atts, sprintf( 'compare%s', $index ) ),
);
}
-
}
$conditional_met = $relation == 'all';
- foreach( $conditions as $condition ) {
+ foreach ( $conditions as $condition ) {
$is_match = GFFormsModel::matches_operation( $condition['value'], $condition['compare'], $condition['operator'] );
- if( $relation == 'any' && $is_match ) {
+ if ( $relation == 'any' && $is_match ) {
$conditional_met = true;
break;
- } else if( $relation == 'all' && ! $is_match ) {
+ } elseif ( $relation == 'all' && ! $is_match ) {
$conditional_met = false;
}
}
- if( ! $conditional_met ) {
+ if ( ! $conditional_met ) {
return '';
}
// find and remove any starting/closing
tags
- if( rgar( $atts, 'format' ) != 'raw' ) {
+ if ( rgar( $atts, 'format' ) != 'raw' ) {
$content = preg_replace( '/^
|
$/', '', $content );
}
diff --git a/gravity-forms/gw-all-fields-template.php b/gravity-forms/gw-all-fields-template.php
index 2c2ee7edf..df62288f4 100644
--- a/gravity-forms/gw-all-fields-template.php
+++ b/gravity-forms/gw-all-fields-template.php
@@ -192,7 +192,6 @@ public function all_fields_extra_options( $value, $merge_tag, $modifiers, $field
$field_ids[] = (int) array_pop( $field_id_bits );
}
}
-
} else {
$input_ids = $mod_values;
@@ -242,7 +241,7 @@ public function all_fields_extra_options( $value, $merge_tag, $modifiers, $field
}
}
// Check for exclusions excluding a specific child field from a Nested Form field.
- else if ( $field->get_input_type() === 'form' && (int) $mod_value != $mod_value ) {
+ elseif ( $field->get_input_type() === 'form' && (int) $mod_value != $mod_value ) {
// GPNF assumes Nested Form field should be excluded if $value is false. Prevent this and
// allow GPNF to load the {all_fields} markup for its children.
$exclude_full_value = false;
@@ -251,7 +250,6 @@ public function all_fields_extra_options( $value, $merge_tag, $modifiers, $field
if ( $exclude_full_value ) {
$value = false;
}
-
}
break;
}
diff --git a/gravity-forms/gw-allow-create-and-update-feeds.php b/gravity-forms/gw-allow-create-and-update-feeds.php
index 479927134..15509f38d 100644
--- a/gravity-forms/gw-allow-create-and-update-feeds.php
+++ b/gravity-forms/gw-allow-create-and-update-feeds.php
@@ -17,42 +17,42 @@
*/
class GW_GFUR_Update_Create_Same_Form {
- public function __construct( $args = array() ) {
+ public function __construct( $args = array() ) {
- // set our default arguments, parse against the provided arguments, and store for use throughout the class
- $this->_args = wp_parse_args( $args, array(
- 'form_ids' => array(),
- 'exclude_form_ids' => array()
- ) );
+ // set our default arguments, parse against the provided arguments, and store for use throughout the class
+ $this->_args = wp_parse_args( $args, array(
+ 'form_ids' => array(),
+ 'exclude_form_ids' => array(),
+ ) );
- // do version check in the init to make sure if GF is going to be loaded, it is already loaded
- add_action( 'init', array( $this, 'init' ) );
+ // do version check in the init to make sure if GF is going to be loaded, it is already loaded
+ add_action( 'init', array( $this, 'init' ) );
- }
+ }
- public function init() {
+ public function init() {
- // make sure we're running the required minimum version of Gravity Forms
- if( ! property_exists( 'GFCommon', 'version' ) || ! version_compare( GFCommon::$version, '1.8', '>=' ) ) {
- return;
- }
+ // make sure we're running the required minimum version of Gravity Forms
+ if ( ! property_exists( 'GFCommon', 'version' ) || ! version_compare( GFCommon::$version, '1.8', '>=' ) ) {
+ return;
+ }
- // make sure User Registration is loaded
- if( ! is_callable( 'gf_user_registration' ) || ! is_callable( array( gf_user_registration(), 'get_single_submission_feed' ) ) ) {
- return;
- }
+ // make sure User Registration is loaded
+ if ( ! is_callable( 'gf_user_registration' ) || ! is_callable( array( gf_user_registration(), 'get_single_submission_feed' ) ) ) {
+ return;
+ }
- add_filter( 'gform_userregistration_feed_settings_fields', array( $this, 'enable_both_feed_types' ) );
- add_filter( 'gform_get_form_filter', array( $this, 'remove_hide_form_function' ), 10, 2 );
+ add_filter( 'gform_userregistration_feed_settings_fields', array( $this, 'enable_both_feed_types' ) );
+ add_filter( 'gform_get_form_filter', array( $this, 'remove_hide_form_function' ), 10, 2 );
- }
+ }
public function enable_both_feed_types( $fields ) {
- foreach( $fields as &$group ) {
- if( rgar( $group, 'title' ) == esc_html__( 'Feed Settings', 'gravityformsuserregistration' ) ) {
- foreach( $group['fields'] as &$field ) {
- if( rgar( $field, 'name' ) == 'feedType' ) {
+ foreach ( $fields as &$group ) {
+ if ( rgar( $group, 'title' ) == esc_html__( 'Feed Settings', 'gravityformsuserregistration' ) ) {
+ foreach ( $group['fields'] as &$field ) {
+ if ( rgar( $field, 'name' ) == 'feedType' ) {
unset( $field['choices']['create']['disabled'] );
unset( $field['choices']['update']['disabled'] );
}
@@ -63,52 +63,51 @@ public function enable_both_feed_types( $fields ) {
return $fields;
}
- public function remove_hide_form_function( $string, $form ) {
+ public function remove_hide_form_function( $string, $form ) {
- // if we have both feed types and the user is not logged in, make sure we don't hide the form
- if( $this->is_applicable_form( $form ) && ! is_user_logged_in() && $this->has_both_feed_types( $form ) ) {
- remove_action( 'gform_get_form_filter_' . $form['id'], array( gf_user_registration(), 'hide_form' ) );
- }
-
- return $string;
- }
+ // if we have both feed types and the user is not logged in, make sure we don't hide the form
+ if ( $this->is_applicable_form( $form ) && ! is_user_logged_in() && $this->has_both_feed_types( $form ) ) {
+ remove_action( 'gform_get_form_filter_' . $form['id'], array( gf_user_registration(), 'hide_form' ) );
+ }
- public function has_both_feed_types( $form ) {
+ return $string;
+ }
- $feeds = gf_user_registration()->get_feeds( $form['id'] );
+ public function has_both_feed_types( $form ) {
- $has_create_feed = false;
- $has_update_feed = false;
+ $feeds = gf_user_registration()->get_feeds( $form['id'] );
- foreach( $feeds as $feed ) {
+ $has_create_feed = false;
+ $has_update_feed = false;
- if( ! $feed['is_active'] ) {
- continue;
- }
+ foreach ( $feeds as $feed ) {
- if( $feed['meta']['feedType'] == 'create' ) {
- $has_create_feed = true;
- } else if( $feed['meta']['feedType'] == 'update' ) {
- $has_update_feed = true;
- }
+ if ( ! $feed['is_active'] ) {
+ continue;
+ }
- }
+ if ( $feed['meta']['feedType'] == 'create' ) {
+ $has_create_feed = true;
+ } elseif ( $feed['meta']['feedType'] == 'update' ) {
+ $has_update_feed = true;
+ }
+ }
- return $has_create_feed && $has_update_feed;
- }
+ return $has_create_feed && $has_update_feed;
+ }
- public function is_applicable_form( $form ) {
+ public function is_applicable_form( $form ) {
- $form_id = isset( $form['id'] ) ? $form['id'] : $form;
+ $form_id = isset( $form['id'] ) ? $form['id'] : $form;
- if( ! empty( $this->_args['exclude_form_ids'] ) ) {
- return ! in_array( $form_id, $this->_args['exclude_form_ids'] );
- } else if( ! empty( $this->_args['form_ids'] ) ) {
- return in_array( $form_id, $this->_args['form_ids'] );
- }
+ if ( ! empty( $this->_args['exclude_form_ids'] ) ) {
+ return ! in_array( $form_id, $this->_args['exclude_form_ids'] );
+ } elseif ( ! empty( $this->_args['form_ids'] ) ) {
+ return in_array( $form_id, $this->_args['form_ids'] );
+ }
- return true;
- }
+ return true;
+ }
}
diff --git a/gravity-forms/gw-cache-buster.php b/gravity-forms/gw-cache-buster.php
index 0e345664d..6e8ee7525 100644
--- a/gravity-forms/gw-cache-buster.php
+++ b/gravity-forms/gw-cache-buster.php
@@ -151,7 +151,7 @@ public function shortcode( $markup, $attributes, $content ) {
?>
+
- $form['id'],
- 'inputHtmlIds' => $this->get_required_input_html_ids( $form )
- );
+ $args = array(
+ 'formId' => $form['id'],
+ 'inputHtmlIds' => $this->get_required_input_html_ids( $form ),
+ );
- $script = '; new GWDisableSubmit( ' . json_encode( $args ) . ' );';
- $slug = "gw_disable_submit_{$form['id']}";
+ $script = '; new GWDisableSubmit( ' . json_encode( $args ) . ' );';
+ $slug = "gw_disable_submit_{$form['id']}";
- GFFormDisplay::add_init_script( $form['id'], $slug, GFFormDisplay::ON_PAGE_RENDER, $script );
+ GFFormDisplay::add_init_script( $form['id'], $slug, GFFormDisplay::ON_PAGE_RENDER, $script );
- }
+ }
- public function get_required_input_html_ids( $form ) {
+ public function get_required_input_html_ids( $form ) {
- $html_ids = '';
+ $html_ids = '';
- foreach( $form['fields'] as &$field ) {
+ foreach ( $form['fields'] as &$field ) {
- if( ! $field['isRequired'] )
- continue;
+ if ( ! $field['isRequired'] ) {
+ continue;
+ }
- $input_ids = false;
+ $input_ids = false;
- switch( GFFormsModel::get_input_type( $field ) ) {
+ switch ( GFFormsModel::get_input_type( $field ) ) {
- case 'address':
- $input_ids = array( 1, 3, 4, 5, 6 );
- break;
+ case 'address':
+ $input_ids = array( 1, 3, 4, 5, 6 );
+ break;
- case 'name':
- $input_ids = array( 1, 2, 3, 4, 5, 6 );
- break;
+ case 'name':
+ $input_ids = array( 1, 2, 3, 4, 5, 6 );
+ break;
- default:
- $html_ids[] = "#input_{$form['id']}_{$field['id']}";
- break;
+ default:
+ $html_ids[] = "#input_{$form['id']}_{$field['id']}";
+ break;
- }
+ }
- if( ! $input_ids )
- continue;
+ if ( ! $input_ids ) {
+ continue;
+ }
- foreach( $input_ids as $input_id ) {
- $html_ids[] = "#input_{$form['id']}_{$field['id']}_{$input_id}";
- }
+ foreach ( $input_ids as $input_id ) {
+ $html_ids[] = "#input_{$form['id']}_{$field['id']}_{$input_id}";
+ }
+ }
- }
-
- return $html_ids;
- }
+ return $html_ids;
+ }
}
diff --git a/gravity-forms/gw-double-confirmation-fields.php b/gravity-forms/gw-double-confirmation-fields.php
index 817080a47..debf16c30 100644
--- a/gravity-forms/gw-double-confirmation-fields.php
+++ b/gravity-forms/gw-double-confirmation-fields.php
@@ -72,4 +72,4 @@ function register_confirmation_fields( $form_id, $fields ) {
$gfcf_fields[ $form_id ][] = $fields;
}
-register_confirmation_fields( 1, array( 2, 3 ) );
\ No newline at end of file
+register_confirmation_fields( 1, array( 2, 3 ) );
diff --git a/gravity-forms/gw-edit-product-and-payment-details.php b/gravity-forms/gw-edit-product-and-payment-details.php
index 38597d91c..916cb5a09 100644
--- a/gravity-forms/gw-edit-product-and-payment-details.php
+++ b/gravity-forms/gw-edit-product-and-payment-details.php
@@ -18,234 +18,237 @@
*/
class GW_Edit_Products {
- private static $instance = null;
+ private static $instance = null;
- public static function get_instance( $args = array() ) {
- if( null == self::$instance )
- self::$instance = new self( $args );
- return self::$instance;
- }
+ public static function get_instance( $args = array() ) {
+ if ( null == self::$instance ) {
+ self::$instance = new self( $args );
+ }
+ return self::$instance;
+ }
- private function __construct( $args ) {
+ private function __construct( $args ) {
- // make sure we're running the required minimum version of Gravity Forms
- if( ! property_exists( 'GFCommon', 'version' ) || ! version_compare( GFCommon::$version, '1.8', '>=' ) ) {
- return;
- }
+ // make sure we're running the required minimum version of Gravity Forms
+ if ( ! property_exists( 'GFCommon', 'version' ) || ! version_compare( GFCommon::$version, '1.8', '>=' ) ) {
+ return;
+ }
- // time for hooks
- add_filter( 'gform_field_input', array( $this, 'display_product_edit_mode' ), 10, 5 );
- add_filter( 'gform_after_update_entry', array( $this, 'save_product_edits' ), 10, 2 );
+ // time for hooks
+ add_filter( 'gform_field_input', array( $this, 'display_product_edit_mode' ), 10, 5 );
+ add_filter( 'gform_after_update_entry', array( $this, 'save_product_edits' ), 10, 2 );
- // edit payment status
- add_filter( 'gform_entry_detail_meta_boxes', array( $this, 'handle_payment_details_meta_box' ), 10, 3 );
- add_action( 'gform_payment_details', array( $this, 'maybe_render_payment_details_edit_form' ), 10, 2 );
+ // edit payment status
+ add_filter( 'gform_entry_detail_meta_boxes', array( $this, 'handle_payment_details_meta_box' ), 10, 3 );
+ add_action( 'gform_payment_details', array( $this, 'maybe_render_payment_details_edit_form' ), 10, 2 );
- }
+ }
- public function display_product_edit_mode( $input, $field, $value, $entry_id, $form_id ) {
+ public function display_product_edit_mode( $input, $field, $value, $entry_id, $form_id ) {
- if( ! $this->is_entry_detail() || ! GFCommon::is_product_field( $field['type'] ) || $field->type == 'total' ) {
- return $input;
- }
+ if ( ! $this->is_entry_detail() || ! GFCommon::is_product_field( $field['type'] ) || $field->type == 'total' ) {
+ return $input;
+ }
- //$orig_type = $field->type;
- $field->type = 'GWEP';
- $input = $this->get_field_input( $field, $value, $entry_id, $form_id );
- //$field->type = $orig_type;
+ //$orig_type = $field->type;
+ $field->type = 'GWEP';
+ $input = $this->get_field_input( $field, $value, $entry_id, $form_id );
+ //$field->type = $orig_type;
- return $input;
- }
+ return $input;
+ }
- public function get_field_input( $field, $value, $entry_id, $form_id ) {
+ public function get_field_input( $field, $value, $entry_id, $form_id ) {
- remove_filter( 'gform_field_input', array( $this, 'display_product_edit_mode' ) );
+ remove_filter( 'gform_field_input', array( $this, 'display_product_edit_mode' ) );
- $input = GFCommon::get_field_input( $field, $value, $entry_id, $form_id, GFAPI::get_form( $form_id ) );
+ $input = GFCommon::get_field_input( $field, $value, $entry_id, $form_id, GFAPI::get_form( $form_id ) );
- add_filter( 'gform_field_input', array( $this, 'display_product_edit_mode' ), 10, 5 );
+ add_filter( 'gform_field_input', array( $this, 'display_product_edit_mode' ), 10, 5 );
- return $input;
- }
+ return $input;
+ }
- public function save_product_edits( $form, $entry_id ) {
+ public function save_product_edits( $form, $entry_id ) {
- if( ! $this->is_entry_detail() ) {
- return;
- }
+ if ( ! $this->is_entry_detail() ) {
+ return;
+ }
- $has_product_field = false;
+ $has_product_field = false;
- foreach( $form['fields'] as &$field ) {
- if( GFCommon::is_product_field( $field['type'] ) ) {
- $has_product_field = true;
- $field->origType = $field->type;
- $field->type = 'GWEP';
- }
- }
+ foreach ( $form['fields'] as &$field ) {
+ if ( GFCommon::is_product_field( $field['type'] ) ) {
+ $has_product_field = true;
+ $field->origType = $field->type;
+ $field->type = 'GWEP';
+ }
+ }
- if( $has_product_field ) {
+ if ( $has_product_field ) {
- $entry = GFAPI::get_entry( $entry_id );
- GFFormsModel::save_lead( $form, $entry );
+ $entry = GFAPI::get_entry( $entry_id );
+ GFFormsModel::save_lead( $form, $entry );
- // set in GFCommon::get_product_fields_by_type(); reset.
- global $_product_fields;
- $_product_fields = array();
+ // set in GFCommon::get_product_fields_by_type(); reset.
+ global $_product_fields;
+ $_product_fields = array();
- $this->clear_product_cache( $entry_id );
+ $this->clear_product_cache( $entry_id );
- }
+ }
- // reset original field type
- foreach( $form['fields'] as &$field ) {
- if( $field->origType ) {
- $field->type = $field->origType;
- }
- }
+ // reset original field type
+ foreach ( $form['fields'] as &$field ) {
+ if ( $field->origType ) {
+ $field->type = $field->origType;
+ }
+ }
- if( $has_product_field ) {
- // calculate the total once product fields have been restored to their original types
- $total = GFCommon::get_order_total( $form, $entry );
- foreach( $form['fields'] as &$field ) {
- if( $field->type == 'total' ) {
- GFAPI::update_entry_field( $entry['id'], $field->id, $total );
- }
- }
- }
+ if ( $has_product_field ) {
+ // calculate the total once product fields have been restored to their original types
+ $total = GFCommon::get_order_total( $form, $entry );
+ foreach ( $form['fields'] as &$field ) {
+ if ( $field->type == 'total' ) {
+ GFAPI::update_entry_field( $entry['id'], $field->id, $total );
+ }
+ }
+ }
- }
+ }
- public function clear_product_cache( $entry_id ) {
+ public function clear_product_cache( $entry_id ) {
- gform_delete_meta( $entry_id, 'gform_product_info_1_1' );
- gform_delete_meta( $entry_id, 'gform_product_info__1' );
- gform_delete_meta( $entry_id, 'gform_product_info_1_' );
- gform_delete_meta( $entry_id, 'gform_product_info__' );
+ gform_delete_meta( $entry_id, 'gform_product_info_1_1' );
+ gform_delete_meta( $entry_id, 'gform_product_info__1' );
+ gform_delete_meta( $entry_id, 'gform_product_info_1_' );
+ gform_delete_meta( $entry_id, 'gform_product_info__' );
- }
+ }
- public function is_entry_detail() {
- return in_array( GFForms::get_page(), array( 'entry_detail', 'entry_detail_edit' ) );
- }
+ public function is_entry_detail() {
+ return in_array( GFForms::get_page(), array( 'entry_detail', 'entry_detail_edit' ) );
+ }
public function is_entry_detail_edit() {
return GFForms::get_page() == 'entry_detail_edit';
}
- public function handle_payment_details_meta_box( $meta_boxes, $entry, $form ) {
-
- $entry = $this->save_payment_details( $entry );
-
- if ( ! isset( $meta_boxes['payment'] ) && ( $this->is_entry_detail_edit() || ! empty( $entry['payment_status'] ) ) ) {
- $meta_boxes['payment'] = array(
- 'title' => $entry['transaction_type'] == 2 ? esc_html__( 'Subscription Details', 'gravityforms' ) : esc_html__( 'Payment Details', 'gravityforms' ),
- 'callback' => array( 'GFEntryDetail', 'meta_box_payment_details' ),
- 'context' => 'side',
- );
- }
-
- return $meta_boxes;
- }
-
- public function maybe_render_payment_details_edit_form( $form_id, $entry ) {
-
- if( ! $this->is_entry_detail_edit() ) {
- return;
- }
-
- ?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ public function handle_payment_details_meta_box( $meta_boxes, $entry, $form ) {
+
+ $entry = $this->save_payment_details( $entry );
+
+ if ( ! isset( $meta_boxes['payment'] ) && ( $this->is_entry_detail_edit() || ! empty( $entry['payment_status'] ) ) ) {
+ $meta_boxes['payment'] = array(
+ 'title' => $entry['transaction_type'] == 2 ? esc_html__( 'Subscription Details', 'gravityforms' ) : esc_html__( 'Payment Details', 'gravityforms' ),
+ 'callback' => array( 'GFEntryDetail', 'meta_box_payment_details' ),
+ 'context' => 'side',
+ );
+ }
+
+ return $meta_boxes;
+ }
+
+ public function maybe_render_payment_details_edit_form( $form_id, $entry ) {
+
+ if ( ! $this->is_entry_detail_edit() ) {
+ return;
+ }
+
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
is_entry_detail() || rgpost( 'action' ) != 'update' ) {
- return $entry;
- }
+ if ( ! $this->is_entry_detail() || rgpost( 'action' ) != 'update' ) {
+ return $entry;
+ }
$keys = array( 'payment_status', 'payment_date', 'payment_amount', 'transaction_id', 'transaction_type', 'payment_method' );
- foreach( $keys as $key ) {
- if( isset( $_POST[ $key ] ) ) {
+ foreach ( $keys as $key ) {
+ if ( isset( $_POST[ $key ] ) ) {
$entry[ $key ] = $_POST[ $key ];
}
}
GFAPI::update_entry( $entry );
- GFEntryDetail::set_current_entry( $entry );
+ GFEntryDetail::set_current_entry( $entry );
- return $entry;
- }
+ return $entry;
+ }
}
function gw_edit_products( $args = array() ) {
- return GW_Edit_Products::get_instance( $args );
+ return GW_Edit_Products::get_instance( $args );
}
# Configuration
diff --git a/gravity-forms/gw-email-domain-validator.php b/gravity-forms/gw-email-domain-validator.php
index 8614fd346..289a47227 100644
--- a/gravity-forms/gw-email-domain-validator.php
+++ b/gravity-forms/gw-email-domain-validator.php
@@ -14,107 +14,110 @@
*/
class GW_Email_Domain_Validator {
- private $_args;
+ private $_args;
- function __construct($args) {
+ function __construct( $args ) {
- $this->_args = wp_parse_args( $args, array(
- 'form_id' => false,
- 'field_id' => false,
- 'domains' => false,
- 'validation_message' => __( 'Sorry, %s email accounts are not eligible for this form.' ),
- 'mode' => 'ban' // also accepts "limit"
- ) );
+ $this->_args = wp_parse_args( $args, array(
+ 'form_id' => false,
+ 'field_id' => false,
+ 'domains' => false,
+ 'validation_message' => __( 'Sorry, %s email accounts are not eligible for this form.' ),
+ 'mode' => 'ban', // also accepts "limit"
+ ) );
- // convert field ID to an array for consistency, it can be passed as an array or a single ID
- if($this->_args['field_id'] && !is_array($this->_args['field_id']))
- $this->_args['field_id'] = array($this->_args['field_id']);
+ // convert field ID to an array for consistency, it can be passed as an array or a single ID
+ if ( $this->_args['field_id'] && ! is_array( $this->_args['field_id'] ) ) {
+ $this->_args['field_id'] = array( $this->_args['field_id'] );
+ }
- $form_filter = $this->_args['form_id'] ? "_{$this->_args['form_id']}" : '';
+ $form_filter = $this->_args['form_id'] ? "_{$this->_args['form_id']}" : '';
- add_filter("gform_validation{$form_filter}", array($this, 'validate'));
+ add_filter( "gform_validation{$form_filter}", array( $this, 'validate' ) );
- }
+ }
- function validate($validation_result) {
+ function validate( $validation_result ) {
- $form = $validation_result['form'];
+ $form = $validation_result['form'];
- foreach($form['fields'] as &$field) {
+ foreach ( $form['fields'] as &$field ) {
- // if this is not an email field, skip
- if(RGFormsModel::get_input_type($field) != 'email')
- continue;
+ // if this is not an email field, skip
+ if ( RGFormsModel::get_input_type( $field ) != 'email' ) {
+ continue;
+ }
- // if field ID was passed and current field is not in that array, skip
- if($this->_args['field_id'] && !in_array($field['id'], $this->_args['field_id']))
- continue;
+ // if field ID was passed and current field is not in that array, skip
+ if ( $this->_args['field_id'] && ! in_array( $field['id'], $this->_args['field_id'] ) ) {
+ continue;
+ }
- $page_number = GFFormDisplay::get_source_page( $form['id'] );
- if( $page_number > 0 && $field->pageNumber != $page_number ) {
- continue;
- }
+ $page_number = GFFormDisplay::get_source_page( $form['id'] );
+ if ( $page_number > 0 && $field->pageNumber != $page_number ) {
+ continue;
+ }
- if( GFFormsModel::is_field_hidden( $form, $field, array() ) ) {
- continue;
- }
+ if ( GFFormsModel::is_field_hidden( $form, $field, array() ) ) {
+ continue;
+ }
- $domain = $this->get_email_domain($field);
+ $domain = $this->get_email_domain( $field );
- // if domain is valid OR if the email field is empty, skip
- if($this->is_domain_valid($domain) || empty($domain))
- continue;
+ // if domain is valid OR if the email field is empty, skip
+ if ( $this->is_domain_valid( $domain ) || empty( $domain ) ) {
+ continue;
+ }
- $validation_result['is_valid'] = false;
- $field['failed_validation'] = true;
- $field['validation_message'] = sprintf($this->_args['validation_message'], $domain);
+ $validation_result['is_valid'] = false;
+ $field['failed_validation'] = true;
+ $field['validation_message'] = sprintf( $this->_args['validation_message'], $domain );
- }
+ }
- $validation_result['form'] = $form;
- return $validation_result;
- }
+ $validation_result['form'] = $form;
+ return $validation_result;
+ }
- function get_email_domain( $field ) {
- $email = explode( '@', rgpost( "input_{$field['id']}" ) );
- return trim( rgar( $email, 1 ) );
- }
+ function get_email_domain( $field ) {
+ $email = explode( '@', rgpost( "input_{$field['id']}" ) );
+ return trim( rgar( $email, 1 ) );
+ }
- function is_domain_valid( $domain ) {
+ function is_domain_valid( $domain ) {
- $mode = $this->_args['mode'];
- $domain = strtolower( $domain );
+ $mode = $this->_args['mode'];
+ $domain = strtolower( $domain );
- foreach( $this->_args['domains'] as $_domain ) {
+ foreach ( $this->_args['domains'] as $_domain ) {
- $_domain = strtolower( $_domain );
+ $_domain = strtolower( $_domain );
- $full_match = $domain == $_domain;
- $suffix_match = strpos( $_domain, '.' ) === 0 && $this->string_ends_with( $domain, $_domain );
- $has_match = $full_match || $suffix_match;
+ $full_match = $domain == $_domain;
+ $suffix_match = strpos( $_domain, '.' ) === 0 && $this->string_ends_with( $domain, $_domain );
+ $has_match = $full_match || $suffix_match;
- if( $mode == 'ban' && $has_match ) {
- return false;
- } else if( $mode == 'limit' && $has_match ) {
- return true;
- }
+ if ( $mode == 'ban' && $has_match ) {
+ return false;
+ } elseif ( $mode == 'limit' && $has_match ) {
+ return true;
+ }
+ }
- }
+ return $mode == 'limit' ? false : true;
+ }
- return $mode == 'limit' ? false : true;
- }
+ function string_ends_with( $string, $text ) {
- function string_ends_with( $string, $text ) {
+ $length = strlen( $string );
+ $text_length = strlen( $text );
- $length = strlen( $string );
- $text_length = strlen( $text );
+ if ( $text_length > $length ) {
+ return false;
+ }
- if( $text_length > $length ) {
- return false;
- }
-
- return substr_compare( $string, $text, $length - $text_length, $text_length ) === 0;
- }
+ return substr_compare( $string, $text, $length - $text_length, $text_length ) === 0;
+ }
}
@@ -123,9 +126,9 @@ class GWEmailDomainControl extends GW_Email_Domain_Validator { }
# Configuration
new GW_Email_Domain_Validator( array(
- 'form_id' => 326,
- 'field_id' => 1,
- 'domains' => array( 'gmail.com', 'hotmail.com', '.co.uk' ),
- 'validation_message' => __( 'Oh no! %s email accounts are not eligible for this form.' ),
- 'mode' => 'limit'
+ 'form_id' => 326,
+ 'field_id' => 1,
+ 'domains' => array( 'gmail.com', 'hotmail.com', '.co.uk' ),
+ 'validation_message' => __( 'Oh no! %s email accounts are not eligible for this form.' ),
+ 'mode' => 'limit',
) );
diff --git a/gravity-forms/gw-entry-count-shortcode.php b/gravity-forms/gw-entry-count-shortcode.php
index 87580a16b..195c0f354 100644
--- a/gravity-forms/gw-entry-count-shortcode.php
+++ b/gravity-forms/gw-entry-count-shortcode.php
@@ -8,27 +8,27 @@
* @version 1.0
* @author David Smith
* @license GPL-2.0+
- * @link http://gravitywiz.com/
+ * @link http://gravitywiz.com/
*/
add_filter( 'gform_shortcode_entry_count', 'gwiz_entry_count_shortcode', 10, 2 );
function gwiz_entry_count_shortcode( $output, $atts ) {
extract( shortcode_atts( array(
- 'id' => false,
+ 'id' => false,
'status' => 'total', // accepts 'total', 'unread', 'starred', 'trash', 'spam'
- 'format' => false // should be 'comma', 'decimal'
+ 'format' => false, // should be 'comma', 'decimal'
), $atts ) );
$valid_statuses = array( 'total', 'unread', 'starred', 'trash', 'spam' );
- if( ! $id || ! in_array( $status, $valid_statuses ) ) {
+ if ( ! $id || ! in_array( $status, $valid_statuses ) ) {
return current_user_can( 'update_core' ) ? __( 'Invalid "id" (the form ID) or "status" (i.e. "total", "trash", etc.) parameter passed.' ) : '';
}
$counts = GFFormsModel::get_form_counts( $id );
$output = rgar( $counts, $status );
- if( $format ) {
+ if ( $format ) {
$format = $format == 'decimal' ? '.' : ',';
$output = number_format( $output, 0, false, $format );
}
diff --git a/gravity-forms/gw-feed-specific-submit-button.php b/gravity-forms/gw-feed-specific-submit-button.php
index 2c82d6313..03bd94282 100644
--- a/gravity-forms/gw-feed-specific-submit-button.php
+++ b/gravity-forms/gw-feed-specific-submit-button.php
@@ -23,20 +23,20 @@
*/
class GW_Feed_Specific_Submit_Button {
- private static $instance = null;
+ private static $instance = null;
- public static function get_instance() {
- if ( self::$instance === null ) {
+ public static function get_instance() {
+ if ( self::$instance === null ) {
self::$instance = new self;
}
- return self::$instance;
- }
+ return self::$instance;
+ }
- private function __construct() {
+ private function __construct() {
add_action( 'init', array( $this, 'init' ) );
- }
+ }
public function init() {
@@ -55,7 +55,7 @@ public function add_submit_button_setting( $settings ) {
'tooltip' => '' . esc_html__( 'Submit Button Label' ) . '
' . esc_html__( 'Specify a custom label for the submit button that will be used if this feed will be used to process the payment.' ),
);
- $stripe = GFStripe::get_instance();
+ $stripe = GFStripe::get_instance();
$settings = $stripe->add_field_after( 'conditionalLogic', $submit_button_setting, $settings );
return $settings;
@@ -68,7 +68,7 @@ public function add_submit_button_setting_to_frontend_feed( $feed, $form, $raw_f
public function load_form_script( $form, $is_ajax_enabled ) {
- if( $this->is_applicable_form( $form ) && ! has_action( 'wp_footer', array( $this, 'output_script' ) ) ) {
+ if ( $this->is_applicable_form( $form ) && ! has_action( 'wp_footer', array( $this, 'output_script' ) ) ) {
add_action( 'wp_footer', array( $this, 'output_script' ), 99 );
add_action( 'gform_preview_footer', array( $this, 'output_script' ), 99 );
}
@@ -119,7 +119,7 @@ public function is_applicable_form( $form ) {
}
function gw_feed_specific_submit_button() {
- return GW_Feed_Specific_Submit_Button::get_instance();
+ return GW_Feed_Specific_Submit_Button::get_instance();
}
gw_feed_specific_submit_button();
diff --git a/gravity-forms/gw-field-to-field-conditional-logic.php b/gravity-forms/gw-field-to-field-conditional-logic.php
index 19a60be72..f68d869f1 100644
--- a/gravity-forms/gw-field-to-field-conditional-logic.php
+++ b/gravity-forms/gw-field-to-field-conditional-logic.php
@@ -58,8 +58,8 @@ public function output_admin_inline_script() {
// If this is not a