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