diff --git a/change_log.txt b/change_log.txt index 7161c12..7500988 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,24 +1,339 @@ ------------------------------------------------------------------------------------------------------------------- -Version 1.8.20.5 - - Fixed issue with exporting/importing some post field settings. - - Fixed notice when filter entries with empty filter value +Version 1.9 + + - Added drop and drop to the field buttons in the Form Editor. + - Added placeholder field settings. + - Added default input values field settings. + - Added label placement and visibility field settings. These settings are currently hidden by default in the Form Editor. Use the gform_enable_field_label_placement_settings filter to display the settings. + add_filter("gform_enable_field_label_placement_settings", "__return_true"); + - Added support for rendering forms in admin pages with the gravity_form() function and the gravityform shortcode. Use in conjunction with gravity_form_enqueue_scripts(). + - Added support for retrieving form markup via ajax. + - Added save and continue. + - Added support for string customization options in the {save_email_input} merge tag. The two options, button_text and validation_message, can be added using shortcode syntax. E.g., + {save_email_input: button_text="Send the link to my email address" validation_message="The link couldn't be sent because the email address is not valid."} + - Added automatic background updates. Minor versions only e.g. from 1.9.1 to 1.9.2 + - Added setting to enable background updates. Use the GFORM_DISABLE_AUTO_UPDATE constant or gform_disable_auto_update filter to override. The filter will override the setting and the constant will override the filter. + define( 'GFORM_DISABLE_AUTO_UPDATE', true ); + add_filter( 'gform_disable_auto_update', '__return_true' ); + - Added shortcode preview in the post/page editor visual editor. The preview is disabled by default. Use the gform_shortcode_preview_disabled filter to enable. + add_filter('gform_shortcode_preview_disabled', '__return_false'); + - Added gravityforms.min.js. The minified file loads by default unless SCRIPT_DEBUG is active or query param gform_debug is set. e.g. domain.com/?gform_debug + - Added the add-ons to the updates page. + - Added visual editor to the confirmation message UI. + - Added Middle Name input to the name field. + - Added Name Prefix drop-down plus sub-setting UI. + - Added Name Fields sub-setting to the Name field. + - Added Address Fields sub-setting to the Address field. + - Added support for translation (.mo) files in the WP_LANG_DIR/gravityforms folder. e.g. /wp-content/languages/gravityforms/gravityforms-es_ES.mo + - Added classes to complex fields. + - Added HTML5 support for date field when configured with input type "date field". + - Added support for 'gform_file_upload_markup' JS and PHP hooks; useful for modifying the multi-file upload "preview". + - Added the gform_incomplete_submissions_expiration_days filter to allow the lifetime of saved incomplete submissions to be customized. + - Added change event when updating value of total input. + - Added min='0' attribute to product field quantity input when HTML5 enabled. + - Added input mask to the Phone field (standard format). + - Added sub-label setting to Date, Time, Email and Credit Card Fields. + - Added min and max attributes to HTML5 number input with values using the fields min and max range setting. + - Added support for filtering entries using the contains operator for the name, address, single line and paragraph fields. Applies to the entry list, export entries and results pages. + - Added support for date format modifiers (:year, :month, :day, :dmy, :mdy, :ymd etc.) to Date field merge tag. + - Added support for :title, :caption, and :description modifiers to Post Image field merge tag. + - Added Gravity Font. + - Added min, max and step attributes to HTML5 Date Field number inputs. The min and max for the year input can be set using the gform_date_min_year and gform_date_max_year hooks. + - Added condition to not include "gform_chosen" if "chosen" is already enqueued. + - Added support for the Russian Ruble. + - Added Bulgarian translation file. + - Added gform_form_args hook to allow modification of the options used to display the form. + - Added $field_values as a third parameter for the gform_pre_render filter. + - Added form-specific version of "gform_pre_validation" filter. + - Added PHP version of the 'gform_merge_tag_value_pre_calculation' filter. + add_filter( 'gform_merge_tag_value_pre_calculation', 'merge_tag_value', 10, 6 ); + function merge_tag_value( $value, $input_id, $modifier, $field, $form, $entry ) { + // modify the $value + return $value; + } + - Added the gform_submission_values_pre_save filter to allow submitted values to be modified before saving. + add_filter( 'gform_submission_values_pre_save', 'submission_values_pre_save', 10, 2 ); + function submission_values_pre_save( $submitted_values, $form ) { + $submitted_values['custom_value'] = $_POST['custom_value']; + return $submitted_values; + } + - Added 'gform_disable_address_map_link' filter allowing address field map link to be removed. + add_filter( 'gform_disable_address_map_link', '__return_true' ); + - Added 'gform_entry_detail_title' hook for changing the title in the entry detail table. + add_filter( 'gform_entry_detail_title', function( $title, $form, $entry ) { + return 'Your new title for entry #' . $entry['id']; + }, 10, 3 ); + - Added 'gform_incomplete_submission_post_save' hook for performing custom actions when an incomplete submission has been saved. + add_action( 'gform_incomplete_submission_post_save', function ( $submission, $resume_token, $form, $entry ) { + // do stuff + }, 10, 4 ); + - Added 'gform_save_and_continue_resume_url' hook to allow modification of the Save & Continue resume URL + add_filter( 'gform_save_and_continue_resume_url', function( $resume_url, $form, $token, $email ) { + + // remove specific query arg + //$resume_url = remove_query_arg( array( 'boom' ), $resume_url ); + + // remove ALL query args + $resume_url = add_query_arg( array( 'gf_token' => $token ), array_shift( explode( '?', $resume_url ) ) ); + + return $resume_url; + }, 10, 4 ); + - Added new action 'gform_pre_confirmation_deleted' to allow users to perform custom actions just before deleting a confirmation + add_action( 'gform_pre_confirmation_deleted', 'my_pre_confirmation_deleted_func' 10, 2); + function my_pre_confirmation_deleted_func( $confirmation_id, $form ) { + // perform action before a confirmation is deleted + } + - Added new action 'gform_post_form_activated' to allow users to perform custom actions just after a form has been activated + add_action( 'gform_post_form_activated', 'my_post_form_activated_func', 10); + function my_post_form_activated_func( $form_id ) { + // perform action after a form has been activated + } + - Added new action 'gform_post_form_deactivated' to allow users to perform custom actions just after a form has been deactivated + add_action( 'gform_post_form_deactivated', 'my_post_form_deactivated_func', 10); + function my_post_form_deactivated_func( $form_id ) { + // perform action after a form has been deactivated + } + - Added new action 'gform_post_form_trashed' to allow users to perform custom actions just after a form has been moved to the trash + add_action( 'gform_post_form_trashed', 'my_post_form_trashed_func', 10); + function my_post_form_trashed_func( $form_id ) { + // perform action after a form has been moved to the trash + } + - Added new action 'gform_post_form_restored' to allow users to perform custom actions just after a form has been restored + add_action( 'gform_post_form_restored', 'my_post_form_restored_func', 10); + function my_post_form_restored_func( $form_id ) { + // perform action after a form has been restored + } + - Added new action 'gform_post_form_duplicated' to allow users to perform custom actions just after a form has been duplicated. This replaces the deprecated gform_after_duplicate_form action. + add_action( 'gform_post_form_duplicated', 'my_post_form_duplicated_func', 10, 2); + function my_post_form_duplicated_func( $form_id, $new_form_id ) ) { + // perform action after a form has been duplicated + } + - Added new action 'gform_post_form_views_deleted' to allow users to perform custom actions just after the form view count has been reset to zero + add_action( 'gform_post_form_views_deleted', 'my_post_form_views_deleted_func', 10); + function my_post_form_views_deleted_func( $form_id ) { + // perform action after the form view count has been reset to zero + } + - Added new action 'gform_post_note_added' to allow users to perform custom actions just after a note has been added + add_action( 'gform_post_note_added', 'my_post_note_added_func', 10, 6); + function my_post_note_added_func( $note_id, $lead_id, $user_id, $user_name, $note, $note_type ) { + // perform action after the note has been added + } + - Added new action 'gform_pre_note_deleted' to allow users to perform custom actions just before a note has been deleted + add_action( 'gform_pre_note_deleted', 'my_pre_note_deleted_func', 10, 2); + function my_pre_note_deleted_func( $note_id, $lead_id ) { + // perform action just before after the note has been deleted + } + - Added PHP version of the "gform_calculation_result" filter + add_filter( 'gform_calculation_result', 'my_calc_result', 10, 5 ); + function my_calc_result( $result, $formula, $field, $form, $entry ) { + // modify result as needed + return $result; + } + - Added new JS filter: 'gform_calculation_formula' to allow modifying formula before it is processed by GF on frontend + gform.addFilter( 'gform_calculation_formula', function( formula, formulaField, formId, calcObj ) { + // custom code here + return formula; + } ); + - Added JS filter 'gform_list_item_pre_add' to allow new list field row to be modifed before the row is inserted. + gform.addFilter( 'gform_list_item_pre_add', function( clone ) { + // handle datepicker + clone.find( '.ui-datepicker-trigger' ).remove(); + clone.find( 'input.datepicker' ).removeClass( 'hasDatepicker' ).removeAttr( 'id' ); + return clone; + }); + - Added JS 'gform_post_calculation_events' action hook to allow custom methods for triggering calculations. + gform.addAction( 'gform_post_calculation_events', function( mergeTagArr, formulaField, formId, calcObj ){ + var fieldId = parseInt( mergeTagArr[1] ), + fieldSelector = '#field_' + formId + '_' + fieldId; + + if ( jQuery( fieldSelector + ' table.gfield_list' ).length == 1 ) { + jQuery( fieldSelector ) + .on( 'click', '.add_list_item', function () { + jQuery( fieldSelector + ' .delete_list_item' ).removeProp( 'onclick' ); + calcObj.bindCalcEvent( fieldId, formulaField, formId, 0 ); + }) + .on( 'click', '.delete_list_item', function () { + gformDeleteListItem( this, 0 ); + calcObj.bindCalcEvent( fieldId, formulaField, formId, 0 ); + }); + + if ( mergeTagArr[2] != null ) { + var columnNo = mergeTag[2].substr( 1 ), + columnSelector = '.gfield_list_' + fieldId + '_cell' + columnNo + ' :input'; + jQuery( fieldSelector ).on( 'change', columnSelector, function () { + calcObj.bindCalcEvent( fieldId, formulaField, formId, 0 ); + }); + } + } + }); + - Added JS 'gform_merge_tag_value_pre_calculation' hook to allow merge tag value to be modified before calculation is performed. + gform.addFilter( 'gform_merge_tag_value_pre_calculation', function( value, mergeTagArr, isVisible, formulaField, formId ){ + var fieldId = parseInt( mergeTagArr[1] ), + fieldSelector = '#field_' + formId + '_' + fieldId; + + // check if merge tag belongs to a List field and that it isn't hidden by conditional logic + if ( jQuery( fieldSelector + ' table.gfield_list' ).length == 1 && isVisible ) { + + if ( mergeTagArr[2] == null ) { + // if no column specified count the rows + value = jQuery( fieldSelector + ' tbody tr' ).length; + } else { + var columnNo = mergeTagArr[2].substr( 1 ), + columnSelector = '.gfield_list_' + fieldId + '_cell' + columnNo + ' :input', + cellValue = 0; + + // if column specified get the input values from each row and calculate the sum + jQuery( columnSelector ).each( function () { + cellValue = gformToNumber( jQuery( this ).val() ); + value += parseFloat( cellValue ) || 0; + }); + } + + } + + return value; + }); + - Added JS filter 'gform_datepicker_options_pre_init' to allow datepicker options to be modified before the datepicker is initialized. gform_datepicker_init now has gform_gravityforms as a dependency. + gform.addFilter( 'gform_datepicker_options_pre_init', function( optionsObj, formId, fieldId ) { + if ( formId == 587 && fieldId == 1 ) { + optionsObj.minDate = 2; + optionsObj.beforeShowDay = function(date) { + var day = date.getDay(); + return [(day > 1)]; + }; + } + return optionsObj; + }); + - Added $form and $field parameters to the 'gform_date_min_year' and 'gform_date_max_year' filters. + add_filter( 'gform_date_max_year', 'change_max_year', 10, 3 ); + function change_max_year( $max_year, $form, $field ) { + // do stuff with the $form and/or $field + return $max_year; + } + + - Updated GFCommon::replace_variables_prepopulate to support replacing custom merge tags via the 'gform_replace_merge_tags' hook. + - Updated set_logging_supported function to be public instead of protected. + - Updated register strings with URLs in them to be able to be translated properly. + - Updated trim_conditional_logic_values_from_element function to handle when the element's class is GF_Field. + - Updated select, radio and checkbox type pricing fields to use 0 for price if choice price is blank, preventing validation error. + - Updated the Forms menu icon and Add Form button icon. + - Updated the placeholders.js script to the latest version (3.0.2). Removed jquery.placeholders.2.1.1.min.js. Added placeholders.jquery.min.js. This is the jQuery adapter version of the script which patches val() to return an empty string when the placeholder is active. gform_placeholder now has jQuery as a dependency. + - Updated name of "gform_before_update_form_meta" hook to "gform_post_update_form_meta" and changed from "add_action" to "do_action". + - Updated GFFormsModel::get_form_meta() to return an array of GF_Field objects in the fields array. + - Updated the forms import & export tools to use JSON. Legacy XML files are still supported on import. + - Updated the update button on the entry edit page to be disabled until the page loads completely. + - Updated the field settings to hide the advanced tab if no advanced fields are available for the field. + - Updated the Add Field button in the Form Editor to require the field type in the "type" data attribute. Use of the inline onclick attribute to trigger StartAddField() is now deprecated. + - Updated the permission check for bulk deleting notes from GFFormsModel to GFEntryDetail. + - Updated the gform_pre_confirmation_save filter to send $is_new_confirmation as an additional parameter. + - Updated the 'chosen' script and styles to v1.1.0. + - Updated the contents of the entries export csv file to use UTF-16LE encoding. + - Updated Time field hour and minute inputs to use number type and include min, max and step attributes when HTML5 enabled. + - Updated a variety of strings to be translatable. + - Updated gravityforms.pot. + - Updated Danish translation file. + - Updated Spanish (es_ES) translation. + - Updated German translation file. + + - Deprecated the gform_after_duplicate_form action. Use the gform_post_form_duplicated action instead. + - Deprecated GFCommon::get_us_states() and GFCommon::get_canadian_provinces(). + + - Removed RGFormsModel::add_default_properties(). + - Removed support for legacy post category fields created before version 1.6.3. Post category fields created after version 1.6.3 remain functional and continue to be supported. + + - AF: Added GF_Field for all field objects with support for array notation for backward compatibility (with some limitations). + - AF: Added get_form_editor_inline_script() and get_form_inline_script() to GF_Field. + - AF: Added fail_payment, add_pending_payment, void_authorization, expire_subscription for the Payment Add-On. + - AF: Added tooltips for the Payment Add-On. + - AF: Added create_subscription action type for Payment the Add-On. + - AF: Added support for array values in the Settings API. Added support for array values to the select setting. + - AF: Added has_subscription function to check if a subscription exists for Payment the Add-On. + - AF: Added 'title' to the settings tabs array so the title can be customized. + - AF: Added form id and form title to the results page title. + - AF: Added a warning to the add-on settings page which appears if the add-on contains deprecated methods. + - AF: Added support in the results page for score averages by row in multi-row Likert fields. + - AF: Added helper function in the Payment Add-On to remove spaces from credit card number. + + - AF: Updated note set in complete_payment for Payment the Add-On. + - AF: Updated start_subscription to check if a subscription has already been created for Payment the Add-On. + - AF: Updated add_subscription_payment to check is a subscription has already been created for Payment the Add-On. + - AF: Updated log messages for Payment the Add-On. + - AF: Updated the parameters for the post_callback function to two (the action and the result) for the Payment Add-On. + - AF: Updated fail_subscription_payment to set the entry payment status to Failed for Payment the Add-On. + - AF: Updated get_setting function to handle when the part is a zero. + - AF: Updated localization of certain strings for the Payment Add-On Framework. + - AF: Updated feed field mapping to exclude credit card field options, except the credit card number (last 4 digits) and credit card type as choices. + + - AF: Deprecated protected access level for all methods. Use either public or private instead. Deprecation notices are triggered in the admin footer when WP_DEBUG is on. + + - API: Added GFAPI::update_entry_field() to allow updates of individual entry fields. + - API: Added GFAPI::get_forms(). + - API: Added GFAPI::send_notifications(). + - API: Updated GFAPI::update_entry() to update only changed values. ------------------------------------------------------------------------------------------------------------------- -Version 1.8.20.4 - - Fixed issue with password field on multi-page forms +Version 1.8.22.9 + - Fixed issue where 'sack' was not available on some pages ------------------------------------------------------------------------------------------------------------------- -Version 1.8.20.3 - - Fixed an issue with list field shim when RTL was enabled - - Fixed an issue with the results page where the 'show more' link retrieves duplicate values if some values of that field are empty. +Version 1.8.22.8 + - Fixed an issue with some entries where the Checkbox field value could be ordered incorrectly when the field has ten or more choices. ------------------------------------------------------------------------------------------------------------------- -Version 1.8.20.2 - - Fixed issue with section breaks getting displayed on {all_fields_display_empty} even when hidden by conditional logic. +Version 1.8.22.7 + - Fixed issue when search entries with an & character. + +------------------------------------------------------------------------------------------------------------------- +Version 1.8.22.6 + - Fixed issue with gform_confirmation_loaded event not firing under certain conditions. + +------------------------------------------------------------------------------------------------------------------- +Version 1.8.22.5 + - AF: Fixed notice for payment feeds. ------------------------------------------------------------------------------------------------------------------- -Version 1.8.20.1 +Version 1.8.22.4 + - Fixed issue when searching entries with single quotes under certain scenarios. + +------------------------------------------------------------------------------------------------------------------- +Version 1.8.22.3 + - Fixed issue where extra call to wp_print_scripts was causing issues and removing broke New Form modal + +------------------------------------------------------------------------------------------------------------------- +Version 1.8.22.2 + - Fixed issue when searching for entries with single quotes. + +------------------------------------------------------------------------------------------------------------------- +Version 1.8.22.1 + - Fixed an issue with positioning of multi-page form buttons following display by conditional logic. + +------------------------------------------------------------------------------------------------------------------- +Version 1.8.22 + - Added logging statements. + - Fixed issue when displaying new form modal. + +------------------------------------------------------------------------------------------------------------------- +Version 1.8.21 + - Added logging statements around post creation. + - Updated translation in Finnish PO file to fix a javascript error thrown on the entry detail page. + - Updated notification validation so that it allows a comma separate list of emails in Reply-To (compliant with RFC 5322). + - Fixed issue where total was displayed as -$0.00 instead of $0.00 in certain scenarios. + - Fixed issue where {admin_email} could not be used in notification "To" fields. + - Fixed conflict with Jetpack by removing unneccessary call to wp_print_scripts(). + - Fixed an issue with the AJAX spinner and the multi-file uploader. + - Fixed signup URL for reCAPTCHA in error messages. + - Fixed issue with input-based fields with over 100 inputs. + - Fixed duplicate choice label causing issues on checkbox and radio button fields when there are multiple forms on one page. + - Fixed an issue with the results page for forms with a lot of fields on servers with limited resources. + - Fixed issue with exporting/importing some post field settings. + - Fixed notice when filter entries with empty filter value. + - Fixed issue with password field on multi-page forms. + - Fixed an issue with list field shim when RTL was enabled. + - Fixed an issue with the results page where the 'show more' link retrieves duplicate values if some values of that field are empty. + - Fixed issue with section breaks getting displayed on {all_fields_display_empty} even when hidden by conditional logic. - Fixed an issue where exporting lead data for checkbox fields did not work when the choice label included quotes. + - AF: Fixed issue with Sales results incorrectly calculating refunds. + - AF: Fixed issue with the billing cycle length drop down not showing appropriate numbers in some instances in the Payment Add-On. ------------------------------------------------------------------------------------------------------------------- Version 1.8.20 @@ -98,7 +413,7 @@ Version 1.8.17 - Fixed issue with Add-On manager displaying error when installing Add-Ons. - Fixed notice when $form['pagination']['display_progressbar_on_confirmation'] was not set. - Fixed issue with entry list page payment status drop down containing "Approved" instead of "Paid". - - Fixed issue where setting an input-based field value to empty would fail to save. + - Fixed issue where setting an input-based field value to empty would fail to field hour and minute inputs tosave. - AF: Added get_feeds_by_slug function. - AF: Added is_delayed function to check whether a feed is delayed processing with PayPal Standard. - AF: Updated maybe_process_feed function to handle processing when add-on is set as delayed in PayPal Standard feed setup. @@ -254,7 +569,7 @@ Version 1.8.9 - Added "password" to the list of fields which allow HTML input. - Added 'gform_field_container' filter to allow modifying the field container markup. - add_action( 'gform_field_container', 'my_field_container', 10, 6 ); + add_filter( 'gform_field_container', 'my_field_container', 10, 6 ); function my_field_container( $field_container, $field, $form, $class_attr, $style, $field_content ) { return '
  • {FIELD_CONTENT}
  • '; } diff --git a/common.php b/common.php index 5dbc68e..eab25f6 100644 --- a/common.php +++ b/common.php @@ -1,224 +1,264 @@ " . $field_label . ""; - } - } - return $str; - } + $str = ''; + foreach ( $form['fields'] as $field ) { + $input_type = RGFormsModel::get_input_type( $field ); + $field_label = RGFormsModel::get_label( $field ); + if ( $input_type == 'checkbox' || $input_type == 'radio' || $input_type == 'select' ) { + $selected = $field->id == $selected_field_id ? "selected='selected'" : ''; + $str .= "'; + } + } - public static function is_numeric($value, $number_format=""){ + return $str; + } - if($number_format == "currency"){ + public static function is_numeric( $value, $number_format = '' ) { - $number_format = self::is_currency_decimal_dot() ? "decimal_dot" : "decimal_comma"; - $value = self::remove_currency_symbol($value); - } + if ( $number_format == 'currency' ) { - switch($number_format){ - case "decimal_dot" : - return preg_match("/^(-?[0-9]{1,3}(?:,?[0-9]{3})*(?:\.[0-9]+)?)$/", $value); - break; + $number_format = self::is_currency_decimal_dot() ? 'decimal_dot' : 'decimal_comma'; + $value = self::remove_currency_symbol( $value ); + } - case "decimal_comma" : - return preg_match("/^(-?[0-9]{1,3}(?:\.?[0-9]{3})*(?:,[0-9]+)?)$/", $value); - break; + switch ( $number_format ) { + case 'decimal_dot' : + return preg_match( "/^(-?[0-9]{1,3}(?:,?[0-9]{3})*(?:\.[0-9]+)?)$/", $value ); + break; - default : - return preg_match("/^(-?[0-9]{1,3}(?:,?[0-9]{3})*(?:\.[0-9]{2})?)$/", $value) || preg_match("/^(-?[0-9]{1,3}(?:\.?[0-9]{3})*(?:,[0-9]{2})?)$/", $value); + case 'decimal_comma' : + return preg_match( "/^(-?[0-9]{1,3}(?:\.?[0-9]{3})*(?:,[0-9]+)?)$/", $value ); + break; - } - } + default : + return preg_match( "/^(-?[0-9]{1,3}(?:,?[0-9]{3})*(?:\.[0-9]{2})?)$/", $value ) || preg_match( "/^(-?[0-9]{1,3}(?:\.?[0-9]{3})*(?:,[0-9]{2})?)$/", $value ); - public static function remove_currency_symbol($value, $currency = null){ - if($currency == null){ - $code = GFCommon::get_currency(); - if(empty($code)) - $code = "USD"; + } + } - $currency = RGCurrency::get_currency($code); - } + public static function remove_currency_symbol( $value, $currency = null ) { + if ( $currency == null ) { + $code = GFCommon::get_currency(); + if ( empty( $code ) ) { + $code = 'USD'; + } - $value = str_replace($currency["symbol_left"], "", $value); - $value = str_replace($currency["symbol_right"], "", $value); + $currency = RGCurrency::get_currency( $code ); + } - //some symbols can't be easily matched up, so this will catch any of them - $value = preg_replace('/[^,.\d]/', "", $value); + $value = str_replace( $currency['symbol_left'], '', $value ); + $value = str_replace( $currency['symbol_right'], '', $value ); - return $value; - } + //some symbols can't be easily matched up, so this will catch any of them + $value = preg_replace( '/[^,.\d]/', '', $value ); - public static function is_currency_decimal_dot($currency = null){ + return $value; + } - if($currency == null){ - $code = GFCommon::get_currency(); - if(empty($code)) - $code = "USD"; + public static function is_currency_decimal_dot( $currency = null ) { - $currency = RGCurrency::get_currency($code); - } + if ( $currency == null ) { + $code = GFCommon::get_currency(); + if ( empty( $code ) ) { + $code = 'USD'; + } - return rgar($currency, "decimal_separator") == "."; - } + $currency = RGCurrency::get_currency( $code ); + } - public static function trim_all($text){ - $text = trim($text); - do{ - $prev_text = $text; - $text = str_replace(" ", " ", $text); - } - while($text != $prev_text); + return rgar( $currency, 'decimal_separator' ) == '.'; + } - return $text; - } + public static function trim_all( $text ) { + $text = trim( $text ); + do { + $prev_text = $text; + $text = str_replace( ' ', ' ', $text ); + } while ( $text != $prev_text ); - public static function format_number($number, $number_format){ - if(!is_numeric($number)) - return $number; - - //replacing commas with dots and dots with commas - if($number_format == "currency"){ - if(false === class_exists('RGCurrency')){ - require_once( GFCommon::get_base_path() . '/currency.php' ); - } - $currency = new RGCurrency( GFCommon::get_currency() ); - $number = $currency->to_money( $number ); - } elseif ($number_format == "decimal_comma"){ - $number = str_replace(",", "|", $number); - $number = str_replace(".", ",", $number); - $number = str_replace("|", ".", $number); - } + return $text; + } - return $number; - } + public static function format_number( $number, $number_format ) { + if ( ! is_numeric( $number ) ) { + return $number; + } - public static function recursive_add_index_file($dir) { - if(!is_dir($dir)) - return; + //replacing commas with dots and dots with commas + if ( $number_format == 'currency' ) { + if ( false === class_exists( 'RGCurrency' ) ) { + require_once( GFCommon::get_base_path() . '/currency.php' ); + } + $currency = new RGCurrency( GFCommon::get_currency() ); + $number = $currency->to_money( $number ); + } elseif ( $number_format == 'decimal_comma' ) { + $number = str_replace( ',', '|', $number ); + $number = str_replace( '.', ',', $number ); + $number = str_replace( '|', '.', $number ); + } - if(!($dp = opendir($dir))) - return; + return $number; + } - //ignores all errors - set_error_handler(create_function("", "return 0;"), E_ALL); + public static function recursive_add_index_file( $dir ) { + if ( ! is_dir( $dir ) ) { + return; + } - //creates an empty index.html file - if($f = fopen($dir . "/index.html", 'w')) - fclose($f); + if ( ! ( $dp = opendir( $dir ) ) ) { + return; + } - //restores error handler - restore_error_handler(); + //ignores all errors + set_error_handler( create_function( '', 'return 0;' ), E_ALL ); - while((false !== $file = readdir($dp))){ - if(is_dir("$dir/$file") && $file != '.' && $file !='..') - self::recursive_add_index_file("$dir/$file"); - } + //creates an empty index.html file + if ( $f = fopen( $dir . '/index.html', 'w' ) ) { + fclose( $f ); + } - closedir($dp); - } + //restores error handler + restore_error_handler(); - public static function clean_number($number, $number_format=""){ - if(rgblank($number)) - return $number; - - $decimal_char = ""; - if($number_format == "decimal_dot") - $decimal_char = "."; - else if($number_format == "decimal_comma") - $decimal_char = ","; - - $float_number = ""; - $clean_number = ""; - $is_negative = false; - - //Removing all non-numeric characters - $array = str_split($number); - foreach($array as $char){ - if (($char >= '0' && $char <= '9') || $char=="," || $char==".") - $clean_number .= $char; - else if($char == '-') - $is_negative = true; - } + while ( ( false !== $file = readdir( $dp ) ) ) { + if ( is_dir( "$dir/$file" ) && $file != '.' && $file != '..' ) { + self::recursive_add_index_file( "$dir/$file" ); + } + } + + closedir( $dp ); + } + + public static function add_htaccess_file(){ - //Removing thousand separators but keeping decimal point - $array = str_split($clean_number); - for($i=0, $count = sizeof($array); $i<$count; $i++) - { - $char = $array[$i]; - if ($char >= '0' && $char <= '9') - $float_number .= $char; - else if(empty($decimal_char) && ($char == "." || $char == ",") && strlen($clean_number) - $i <= 3) - $float_number .= "."; - else if($decimal_char == $char) - $float_number .= "."; + $upload_root = GFFormsModel::get_upload_root(); + + if ( ! is_dir( $upload_root ) ) { + return; } + $htaccess_file = $upload_root . '/.htaccess'; + if ( file_exists( $htaccess_file ) ) { + unlink($htaccess_file); + } + $txt= '# Disable parsing of PHP for some server configurations. + + SetHandler none + SetHandler default-handler + Options -ExecCGI + RemoveHandler .cgi .php .php3 .php4 .php5 .phtml .pl .py .pyc .pyo + + + php_flag engine off +'; + $rules = explode( "\n", $txt ); + insert_with_markers( $htaccess_file, 'Gravity Forms', $rules ); + + } + + public static function clean_number( $number, $number_format = '' ) { + if ( rgblank( $number ) ) { + return $number; + } - if($is_negative) - $float_number = "-" . $float_number; + $decimal_char = ''; + if ( $number_format == 'decimal_dot' ) { + $decimal_char = '.'; + } else if ( $number_format == 'decimal_comma' ) { + $decimal_char = ','; + } - return $float_number; + $float_number = ''; + $clean_number = ''; + $is_negative = false; + + //Removing all non-numeric characters + $array = str_split( $number ); + foreach ( $array as $char ) { + if ( ( $char >= '0' && $char <= '9' ) || $char == ',' || $char == '.' ) { + $clean_number .= $char; + } else if ( $char == '-' ) { + $is_negative = true; + } + } - } + //Removing thousand separators but keeping decimal point + $array = str_split( $clean_number ); + for ( $i = 0, $count = sizeof( $array ); $i < $count; $i ++ ) { + $char = $array[ $i ]; + if ( $char >= '0' && $char <= '9' ) { + $float_number .= $char; + } else if ( empty( $decimal_char ) && ( $char == '.' || $char == ',' ) && strlen( $clean_number ) - $i <= 3 ) { + $float_number .= '.'; + } else if ( $decimal_char == $char ) { + $float_number .= '.'; + } + } - public static function json_encode($value){ - return json_encode($value); - } + if ( $is_negative ) { + $float_number = '-' . $float_number; + } - public static function json_decode($str, $is_assoc=true){ - return json_decode($str, $is_assoc); - } + return $float_number; - //Returns the url of the plugin's root folder - public static function get_base_url(){ - return plugins_url( '', __FILE__ ); - } + } - //Returns the physical path of the plugin's root folder - public static function get_base_path(){ - return dirname( __FILE__ ); - } + public static function json_encode( $value ) { + return json_encode( $value ); + } - public static function get_email_fields($form){ - $fields = array(); - foreach($form["fields"] as $field){ - if(RGForms::get("type", $field) == "email" || RGForms::get("inputType", $field) == "email") - $fields[] = $field; - } + public static function json_decode( $str, $is_assoc = true ) { + return json_decode( $str, $is_assoc ); + } - return $fields; - } + //Returns the url of the plugin's root folder + public static function get_base_url() { + return plugins_url( '', __FILE__ ); + } - public static function truncate_middle($text, $max_length){ - if(strlen($text) <= $max_length) - return $text; + //Returns the physical path of the plugin's root folder + public static function get_base_path() { + return dirname( __FILE__ ); + } - $middle = intval($max_length / 2); - return self::safe_substr($text, 0, $middle) . "..." . self::safe_substr($text, strlen($text) - $middle, $middle); - } + public static function get_email_fields( $form ) { + $fields = array(); + foreach ( $form['fields'] as $field ) { + if ( $field->type == 'email' || $field->inputType == 'email' ) { + $fields[] = $field; + } + } - public static function is_invalid_or_empty_email($email){ - return empty($email) || !self::is_valid_email($email); - } + return $fields; + } + + public static function truncate_middle( $text, $max_length ) { + if ( strlen( $text ) <= $max_length ) { + return $text; + } + + $middle = intval( $max_length / 2 ); + + return self::safe_substr( $text, 0, $middle ) . '...' . self::safe_substr( $text, strlen( $text ) - $middle, $middle ); + } + + public static function is_invalid_or_empty_email( $email ) { + return empty( $email ) || ! self::is_valid_email( $email ); + } public static function is_valid_url( $url ) { $url = trim( $url ); @@ -246,906 +286,859 @@ public static function is_valid_email_list( $email_list ) { return true; } - public static function get_label($field, $input_id = 0, $input_only = false){ - return RGFormsModel::get_label($field, $input_id, $input_only); - } - - public static function get_input($field, $id){ - return RGFormsModel::get_input($field, $id); - } - - public static function insert_variables($fields, $element_id, $hide_all_fields=false, $callback="", $onchange="", $max_label_size=40, $exclude = null, $args="", $class_name=""){ - - if($fields == null) - $fields = array(); + public static function get_label( $field, $input_id = 0, $input_only = false ) { + return RGFormsModel::get_label( $field, $input_id, $input_only ); + } - if($exclude == null) - $exclude = array(); + public static function get_input( $field, $id ) { + return RGFormsModel::get_input( $field, $id ); + } - $exclude = apply_filters("gform_merge_tag_list_exclude", $exclude, $element_id, $fields); - $merge_tags = self::get_merge_tags($fields, $element_id, $hide_all_fields, $exclude, $args); + public static function insert_variables( $fields, $element_id, $hide_all_fields = false, $callback = '', $onchange = '', $max_label_size = 40, $exclude = null, $args = '', $class_name = '' ) { - $onchange = empty($onchange) ? "InsertVariable('{$element_id}', '{$callback}');" : $onchange; - $class = trim($class_name . " gform_merge_tags"); + if ( $fields == null ) { + $fields = array(); + } - ?> + if ( $exclude == null ) { + $exclude = array(); + } - + - if($group_label) { ?> - - + $group_tags ) { - - - - - + if ( $group_label ) { + ?> + + - + + + + + - /** - * This function is used by the gfMergeTags JS object to get the localized label for non-field merge tags as well as - * for backwards compatability with the gform_custom_merge_tags hook. Lastly, this plugin is used by the soon-to-be - * deprecrated insert_variables() function as the new gfMergeTags object has not yet been applied to the Post Content - * Template setting. - * - * @param $fields - * @param $element_id - * @param bool $hide_all_fields - * @param array $exclude_field_types - * @param string $option - * @return array - */ - public static function get_merge_tags($fields, $element_id, $hide_all_fields = false, $exclude_field_types = array(), $option = '') { + - if($fields == null) - $fields = array(); + '{all_fields}', 'label' => __('All Submitted Fields', 'gravityforms')); + $required_fields = $optional_fields = $pricing_fields = array(); + $ungrouped = $required_group = $optional_group = $pricing_group = $other_group = array(); - // group fields by required, optional, and pricing - foreach($fields as $field) { + if ( ! $hide_all_fields ) { + $ungrouped[] = array( 'tag' => '{all_fields}', 'label' => __( 'All Submitted Fields', 'gravityforms' ) ); + } - if(rgget("displayOnly", $field)) - continue; + // group fields by required, optional, and pricing + foreach ( $fields as $field ) { - $input_type = RGFormsModel::get_input_type($field); + if ( $field->displayOnly ) { + continue; + } - // skip field types that should be excluded - if(is_array($exclude_field_types) && in_array($input_type, $exclude_field_types)) - continue; + $input_type = RGFormsModel::get_input_type( $field ); - if(rgar($field, 'isRequired')) { + // skip field types that should be excluded + if ( is_array( $exclude_field_types ) && in_array( $input_type, $exclude_field_types ) ) { + continue; + } - switch($input_type) { + if ( $field->isRequired ) { - case "name" : + switch ( $input_type ) { - if(rgar($field,"nameFormat") == "extended") { + case 'name' : - $prefix = GFCommon::get_input($field, $field["id"] + 0.2); - $suffix = GFCommon::get_input($field, $field["id"] + 0.8); - $optional_field = $field; - $optional_field["inputs"] = array($prefix, $suffix); + if ( $field->nameFormat == 'extended' ) { - //Add optional name fields to the optional list - $optional_fields[] = $optional_field; + $prefix = GFCommon::get_input( $field, $field->id . '.2' ); + $suffix = GFCommon::get_input( $field, $field->id . '.8' ); + $optional_field = $field; + $optional_field['inputs'] = array( $prefix, $suffix ); - //Remove optional name field from required list - unset($field["inputs"][0]); - unset($field["inputs"][3]); + //Add optional name fields to the optional list + $optional_fields[] = $optional_field; - } + //Remove optional name field from required list + unset( $field->inputs[0] ); + unset( $field->inputs[3] ); - $required_fields[] = $field; + } - break; + $required_fields[] = $field; - default: - $required_fields[] = $field; - } - } - else { - $optional_fields[] = $field; - } + break; - if(self::is_pricing_field($field["type"])){ - $pricing_fields[] = $field; - } + default: + $required_fields[] = $field; + } + } else { + $optional_fields[] = $field; + } - } + if ( self::is_pricing_field( $field->type ) ) { + $pricing_fields[] = $field; + } + } - if(!empty($required_fields)){ - foreach($required_fields as $field){ - $required_group = array_merge($required_group, self::get_field_merge_tags($field, $option)); - } - } + if ( ! empty( $required_fields ) ) { + foreach ( $required_fields as $field ) { + $required_group = array_merge( $required_group, self::get_field_merge_tags( $field, $option ) ); + } + } - if(!empty($optional_fields)){ - foreach($optional_fields as $field){ - $optional_group = array_merge($optional_group, self::get_field_merge_tags($field, $option)); - } - } + if ( ! empty( $optional_fields ) ) { + foreach ( $optional_fields as $field ) { + $optional_group = array_merge( $optional_group, self::get_field_merge_tags( $field, $option ) ); + } + } - if(!empty($pricing_fields)){ + if ( ! empty( $pricing_fields ) ) { - if(!$hide_all_fields) - $pricing_group[] = array('tag' => '{pricing_fields}', 'label' => __("All Pricing Fields", "gravityforms")); + if ( ! $hide_all_fields ) { + $pricing_group[] = array( 'tag' => '{pricing_fields}', 'label' => __( 'All Pricing Fields', 'gravityforms' ) ); + } - foreach($pricing_fields as $field){ - $pricing_group = array_merge($pricing_group, self::get_field_merge_tags($field, $option)); - } + foreach ( $pricing_fields as $field ) { + $pricing_group = array_merge( $pricing_group, self::get_field_merge_tags( $field, $option ) ); + } + } - } + $other_group[] = array( 'tag' => '{ip}', 'label' => __( 'User IP Address', 'gravityforms' ) ); + $other_group[] = array( 'tag' => '{date_mdy}', 'label' => __( 'Date', 'gravityforms' ) . ' (mm/dd/yyyy)' ); + $other_group[] = array( 'tag' => '{date_dmy}', 'label' => __( 'Date', 'gravityforms' ) . ' (dd/mm/yyyy)' ); + $other_group[] = array( 'tag' => '{embed_post:ID}', 'label' => __( 'Embed Post/Page Id', 'gravityforms' ) ); + $other_group[] = array( 'tag' => '{embed_post:post_title}', 'label' => __( 'Embed Post/Page Title', 'gravityforms' ) ); + $other_group[] = array( 'tag' => '{embed_url}', 'label' => __( 'Embed URL', 'gravityforms' ) ); + $other_group[] = array( 'tag' => '{entry_id}', 'label' => __( 'Entry Id', 'gravityforms' ) ); + $other_group[] = array( 'tag' => '{entry_url}', 'label' => __( 'Entry URL', 'gravityforms' ) ); + $other_group[] = array( 'tag' => '{form_id}', 'label' => __( 'Form Id', 'gravityforms' ) ); + $other_group[] = array( 'tag' => '{form_title}', 'label' => __( 'Form Title', 'gravityforms' ) ); + $other_group[] = array( 'tag' => '{user_agent}', 'label' => __( 'HTTP User Agent', 'gravityforms' ) ); + $other_group[] = array( 'tag' => '{referer}', 'label' => __( 'HTTP Referer URL', 'gravityforms' ) ); + + if ( self::has_post_field( $fields ) ) { + $other_group[] = array( 'tag' => '{post_id}', 'label' => __( 'Post Id', 'gravityforms' ) ); + $other_group[] = array( 'tag' => '{post_edit_url}', 'label' => __( 'Post Edit URL', 'gravityforms' ) ); + } - $other_group[] = array('tag' => '{ip}', 'label' => __("User IP Address", "gravityforms")); - $other_group[] = array('tag' => '{date_mdy}', 'label' => __("Date", "gravityforms") . ' (mm/dd/yyyy)'); - $other_group[] = array('tag' => '{date_dmy}', 'label' => __("Date", "gravityforms") . ' (dd/mm/yyyy)'); - $other_group[] = array('tag' => '{embed_post:ID}', 'label' => __("Embed Post/Page Id", "gravityforms")); - $other_group[] = array('tag' => '{embed_post:post_title}', 'label' => __("Embed Post/Page Title", "gravityforms")); - $other_group[] = array('tag' => '{embed_url}', 'label' => __("Embed URL", "gravityforms")); - $other_group[] = array('tag' => '{entry_id}', 'label' => __("Entry Id", "gravityforms")); - $other_group[] = array('tag' => '{entry_url}', 'label' => __("Entry URL", "gravityforms")); - $other_group[] = array('tag' => '{form_id}', 'label' => __("Form Id", "gravityforms")); - $other_group[] = array('tag' => '{form_title}', 'label' => __("Form Title", "gravityforms")); - $other_group[] = array('tag' => '{user_agent}', 'label' => __("HTTP User Agent", "gravityforms")); - $other_group[] = array('tag' => '{referer}', 'label' => __("HTTP Referer URL", "gravityforms")); - - if(self::has_post_field($fields)) { - $other_group[] = array('tag' => '{post_id}', 'label' => __("Post Id", "gravityforms")); - $other_group[] = array('tag' => '{post_edit_url}', 'label' => __("Post Edit URL", "gravityforms")); - } + $other_group[] = array( 'tag' => '{user:display_name}', 'label' => __( 'User Display Name', 'gravityforms' ) ); + $other_group[] = array( 'tag' => '{user:user_email}', 'label' => __( 'User Email', 'gravityforms' ) ); + $other_group[] = array( 'tag' => '{user:user_login}', 'label' => __( 'User Login', 'gravityforms' ) ); + + $form_id = isset($fields[0]) ? $fields[0]->formId : 0; + + $custom_group = apply_filters( 'gform_custom_merge_tags', array(), $form_id, $fields, $element_id ); + + $merge_tags = array( + 'ungrouped' => array( + 'label' => false, + 'tags' => $ungrouped, + ), + 'required' => array( + 'label' => __( 'Required form fields', 'gravityforms' ), + 'tags' => $required_group, + ), + 'optional' => array( + 'label' => __( 'Optional form fields', 'gravityforms' ), + 'tags' => $optional_group, + ), + 'pricing' => array( + 'label' => __( 'Pricing form fields', 'gravityforms' ), + 'tags' => $pricing_group, + ), + 'other' => array( + 'label' => __( 'Other', 'gravityforms' ), + 'tags' => $other_group, + ), + 'custom' => array( + 'label' => __( 'Custom', 'gravityforms' ), + 'tags' => $custom_group, + ) + ); + + return $merge_tags; + } - $other_group[] = array('tag' => '{user:display_name}', 'label' => __("User Display Name", "gravityforms")); - $other_group[] = array('tag' => '{user:user_email}', 'label' => __("User Email", "gravityforms")); - $other_group[] = array('tag' => '{user:user_login}', 'label' => __("User Login", "gravityforms")); - - $custom_group = apply_filters('gform_custom_merge_tags', array(), rgars($fields, '0/formId'), $fields, $element_id); - - $merge_tags = array( - 'ungrouped' => array( - 'label' => false, - 'tags' => $ungrouped - ), - 'required' => array( - 'label' => __("Required form fields", "gravityforms"), - 'tags' => $required_group - ), - 'optional' => array( - 'label' => __("Optional form fields", "gravityforms"), - 'tags' => $optional_group - ), - 'pricing' => array( - 'label' => __("Pricing form fields", "gravityforms"), - 'tags' => $pricing_group - ), - 'other' => array( - 'label' => __("Other", "gravityforms"), - 'tags' => $other_group - ), - 'custom' => array( - 'label' => __("Custom", "gravityforms"), - 'tags' => $custom_group - ) - ); - - return $merge_tags; - } + /** + * @param GF_Field $field + * @param string $option + * @return string + */ + public static function get_field_merge_tags( $field, $option = '' ) { - public static function get_field_merge_tags($field, $option="") { + $merge_tags = array(); + $tag_args = RGFormsModel::get_input_type( $field ) == 'list' ? ":{$option}" : ''; //args currently only supported by list field - $merge_tags = array(); - $tag_args = RGFormsModel::get_input_type($field) == "list" ? ":{$option}" : ""; //args currently only supported by list field + $inputs = $field->get_entry_inputs(); - if(isset($field["inputs"]) && is_array($field["inputs"])) { + if ( is_array( $inputs ) ) { - if(RGFormsModel::get_input_type($field) == "checkbox") { - $value = "{" . esc_html(GFCommon::get_label($field, $field["id"])) . ":" . $field["id"] . "{$tag_args}}"; - $merge_tags[] = array( 'tag' => $value, 'label' => esc_html(GFCommon::get_label($field, $field["id"])) ); - } + if ( RGFormsModel::get_input_type( $field ) == 'checkbox' ) { + $value = '{' . esc_html( GFCommon::get_label( $field, $field->id ) ) . ':' . $field->id . "{$tag_args}}"; + $merge_tags[] = array( + 'tag' => $value, + 'label' => esc_html( GFCommon::get_label( $field, $field->id ) ) + ); + } - foreach($field["inputs"] as $input) { - if( RGFormsModel::get_input_type( $field ) == 'creditcard' ) { + foreach ( $field->inputs as $input ) { + if ( RGFormsModel::get_input_type( $field ) == 'creditcard' ) { //only include the credit card type (field_id.4) and number (field_id.1) if ( $input['id'] == $field['id'] . '.1' || $input['id'] == $field['id'] . '.4' ) { - $value = '{' . esc_html( GFCommon::get_label( $field, $input['id'] ) ) . ':' . $input['id'] . "{$tag_args}}"; - $merge_tags[] = array( 'tag' => $value, 'label' => esc_html( GFCommon::get_label( $field, $input['id'] ) ) ); + $value = '{' . esc_html( GFCommon::get_label( $field, $input['id'] ) ) . ':' . $input['id'] . "{$tag_args}}"; + $merge_tags[] = array( + 'tag' => $value, + 'label' => esc_html( GFCommon::get_label( $field, $input['id'] ) ) + ); } - } - else { - $value = "{" . esc_html(GFCommon::get_label($field, $input["id"])) . ":" . $input["id"] . "{$tag_args}}"; - $merge_tags[] = array( 'tag' => $value, 'label' => esc_html(GFCommon::get_label($field, $input["id"])) ); + } else { + $value = '{' . esc_html( GFCommon::get_label( $field, $input['id'] ) ) . ':' . $input['id'] . "{$tag_args}}"; + $merge_tags[] = array( + 'tag' => $value, + 'label' => esc_html( GFCommon::get_label( $field, $input['id'] ) ) + ); } } + } else { + $value = '{' . esc_html( GFCommon::get_label( $field ) ) . ':' . $field->id . "{$tag_args}}"; + $merge_tags[] = array( + 'tag' => $value, + 'label' => esc_html( GFCommon::get_label( $field ) ) + ); + } - } - else { - $value = "{" . esc_html(GFCommon::get_label($field)) . ":" . $field["id"] . "{$tag_args}}"; - $merge_tags[] = array( 'tag' => $value, 'label' => esc_html(GFCommon::get_label($field)) ); - } + return $merge_tags; + } - return $merge_tags; - } + public static function insert_field_variable( $field, $max_label_size = 40, $args = '' ) { + + $tag_args = RGFormsModel::get_input_type( $field ) == 'list' ? ":{$args}" : ''; //args currently only supported by list field + + if ( is_array( $field->inputs ) ) { + if ( RGFormsModel::get_input_type( $field ) == 'checkbox' ) { + ?> + + inputs as $input ) { + ?> + + + + +    + + - - - - - - -    - - + + - - "> + - formId : 0; + $custom_merge_tags = apply_filters( 'gform_custom_merge_tags', array(), $form_id, $fields, $element_id ); - if(!self::is_valid_for_calcuation($field)) - continue; + if ( is_array( $custom_merge_tags ) && ! empty( $custom_merge_tags ) ) { + ?> - if(RGFormsModel::get_input_type($field) == 'checkbox') { - foreach($field["inputs"] as $input){ - ?> - - "> - } - ?> + - + - - $custom_merge_tags = apply_filters('gform_custom_merge_tags', array(), rgars($fields, '0/formId'), $fields, $element_id); + - if(is_array($custom_merge_tags) && !empty($custom_merge_tags)) { ?> + - "> + - + '> + private static function get_post_image_variable( $media_id, $arg1, $arg2, $is_url = false ) { - + if ( $is_url ) { + $image = wp_get_attachment_image_src( $media_id, $arg1 ); + if ( $image ) { + list( $src, $width, $height ) = $image; + } - + return $src; + } - + switch ( $arg1 ) { + case 'title' : + $media = get_post( $media_id ); - + return $media->post_title; + case 'caption' : + $media = get_post( $media_id ); - post_excerpt; + case 'description' : + $media = get_post( $media_id ); - private static function get_post_image_variable($media_id, $arg1, $arg2, $is_url = false){ + return $media->post_content; - if($is_url){ - $image = wp_get_attachment_image_src($media_id, $arg1); - if ( $image ) - list($src, $width, $height) = $image; + default : - return $src; - } + $img = wp_get_attachment_image( $media_id, $arg1, false, array( 'class' => "size-{$arg1} align{$arg2} wp-image-{$media_id}" ) ); - switch($arg1){ - case "title" : - $media = get_post($media_id); - return $media->post_title; - case "caption" : - $media = get_post($media_id); - return $media->post_excerpt; - case "description" : - $media = get_post($media_id); - return $media->post_content; - - default : - - $img = wp_get_attachment_image($media_id, $arg1, false, array("class" => "size-{$arg1} align{$arg2} wp-image-{$media_id}")); - return $img; - } - } + return $img; + } + } - public static function replace_variables_post_image($text, $post_images, $lead){ - - preg_match_all('/{[^{]*?:(\d+)(:([^:]*?))?(:([^:]*?))?(:url)?}/mi', $text, $matches, PREG_SET_ORDER); - if(is_array($matches)) - { - foreach($matches as $match){ - $input_id = $match[1]; - - //ignore fields that are not post images - if(!isset($post_images[$input_id])) - continue; - - //Reading alignment and "url" parameters. - //Format could be {image:5:medium:left:url} or {image:5:medium:url} - $size_meta = empty($match[3]) ? "full" : $match[3]; - $align = empty($match[5]) ? "none" : $match[5]; - if($align == "url"){ - $align = "none"; - $is_url = true; - } - else{ - $is_url = rgar($match,6) == ":url"; - } - - $media_id = $post_images[$input_id]; - $value = is_wp_error($media_id) ? "" : self::get_post_image_variable($media_id, $size_meta, $align, $is_url); - - $text = str_replace($match[0], $value , $text); - } - } + public static function replace_variables_post_image( $text, $post_images, $lead ) { - return $text; - } + preg_match_all( '/{[^{]*?:(\d+)(:([^:]*?))?(:([^:]*?))?(:url)?}/mi', $text, $matches, PREG_SET_ORDER ); + if ( is_array( $matches ) ) { + foreach ( $matches as $match ) { + $input_id = $match[1]; - public static function implode_non_blank($separator, $array){ + //ignore fields that are not post images + if ( ! isset( $post_images[ $input_id ] ) ) { + continue; + } - if(!is_array($array)) - return ""; + //Reading alignment and 'url' parameters. + //Format could be {image:5:medium:left:url} or {image:5:medium:url} + $size_meta = empty( $match[3] ) ? 'full' : $match[3]; + $align = empty( $match[5] ) ? 'none' : $match[5]; + if ( $align == 'url' ) { + $align = 'none'; + $is_url = true; + } else { + $is_url = rgar( $match, 6 ) == ':url'; + } - $ary = array(); - foreach($array as $item){ - if(!rgblank($item)) - $ary[] = $item; - } - return implode($separator, $ary); - } + $media_id = $post_images[ $input_id ]; + $value = is_wp_error( $media_id ) ? '' : self::get_post_image_variable( $media_id, $size_meta, $align, $is_url ); - private static function format_variable_value($value, $url_encode, $esc_html, $format){ - if($esc_html) - $value = esc_html($value); + $text = str_replace( $match[0], $value, $text ); + } + } - if($format == "html") - $value = nl2br($value); + return $text; + } - if($url_encode) - $value = urlencode($value); + public static function implode_non_blank( $separator, $array ) { - return $value; - } + if ( ! is_array( $array ) ) { + return ''; + } - public static function replace_variables($text, $form, $lead, $url_encode = false, $esc_html=true, $nl2br = true, $format="html"){ - $text = $nl2br ? nl2br($text) : $text; + $ary = array(); + foreach ( $array as $item ) { + if ( ! rgblank( $item ) ) { + $ary[] = $item; + } + } - //Replacing field variables: {FIELD_LABEL:FIELD_ID} {My Field:2} - preg_match_all('/{[^{]*?:(\d+(\.\d+)?)(:(.*?))?}/mi', $text, $matches, PREG_SET_ORDER); - if(is_array($matches)) - { - foreach($matches as $match){ - $input_id = $match[1]; + return implode( $separator, $ary ); + } - $field = RGFormsModel::get_field($form,$input_id); + public static function format_variable_value( $value, $url_encode, $esc_html, $format ) { + if ( $esc_html ) { + $value = esc_html( $value ); + } - $value = RGFormsModel::get_lead_field_value($lead, $field); - $raw_value = $value; + if ( $format == 'html' ) { + $value = nl2br( $value ); + } - if(is_array($value)) - $value = rgar($value, $input_id); + if ( $url_encode ) { + $value = urlencode( $value ); + } - $value = self::format_variable_value($value, $url_encode, $esc_html, $format); + return $value; + } - switch(RGFormsModel::get_input_type($field)){ + public static function replace_variables( $text, $form, $lead, $url_encode = false, $esc_html = true, $nl2br = true, $format = 'html' ) { + $text = $nl2br ? nl2br( $text ) : $text; - case "number" : + //Replacing field variables: {FIELD_LABEL:FIELD_ID} {My Field:2} + preg_match_all( '/{[^{]*?:(\d+(\.\d+)?)(:(.*?))?}/mi', $text, $matches, PREG_SET_ORDER ); + if ( is_array( $matches ) ) { + foreach ( $matches as $match ) { + $input_id = $match[1]; - $value = GFCommon::format_number($value, rgar($field, "numberFormat")); + $field = RGFormsModel::get_field( $form, $input_id ); - break; + if ( ! $field instanceof GF_Field ) { + $field = GF_Fields::create( $field ); + } - case "fileupload" : - if(rgar($field, "multipleFiles")){ + $value = RGFormsModel::get_lead_field_value( $lead, $field ); + $raw_value = $value; - $files = empty( $raw_value ) ? array() : json_decode( $raw_value, true ); - foreach ( $files as &$file ) { + if ( is_array( $value ) ) { + $value = rgar( $value, $input_id ); + } - $file = str_replace( ' ', '%20', $file ); + $value = self::format_variable_value( $value, $url_encode, $esc_html, $format ); - if ( $esc_html ){ - $value = esc_html( $value ); - } - } - $value = $format == 'html' ? join( "
    ", $files ) : join( ", ", $files ); + $modifier = strtolower( rgar( $match, 4 ) ); - } else { - $value = str_replace( ' ', '%20', $value ); - } + $value = $field->get_value_merge_tag( $value, $input_id, $lead, $form, $modifier, $raw_value, $url_encode, $esc_html, $format ); - if ( $url_encode ){ - $value = urlencode( $value ); + if ( $modifier == 'label' ) { + $value = empty( $value ) ? '' : $field->label; + } else if ( $modifier == 'qty' && $field->type == 'product' ) { + //getting quantity associated with product field + $products = self::get_product_fields( $form, $lead, false, false ); + $value = 0; + foreach ( $products['products'] as $product_id => $product ) { + if ( $product_id == $field->id ) { + $value = $product['quantity']; } + } + } - break; - - case "post_image" : - list( $url, $title, $caption, $description ) = array_pad( explode( '|:|', $value ), 4, false ); - $value = str_replace( ' ', '%20', $url ); - break; - - case "checkbox" : - case "select" : - case "radio" : - - $use_value = rgar($match,4) == "value"; - $use_price = in_array(rgar($match,4), array("price", "currency")); - $format_currency = rgar($match,4) == "currency"; - - if(is_array($raw_value) && (string)intval($input_id) != $input_id){ - $items = array($input_id => $value); //float input Ids. (i.e. 4.1 ). Used when targeting specific checkbox items - } - else if(is_array($raw_value)){ - $items = $raw_value; - } - else{ - $items = array($input_id => $raw_value); - } - - $ary = array(); - - foreach($items as $input_id => $item){ - if($use_value){ - list($val, $price) = rgexplode("|", $item, 2); - } - else if($use_price){ - list($name, $val) = rgexplode("|", $item, 2); - if($format_currency) - $val = GFCommon::to_money($val, rgar($lead, "currency")); - } - else if($field["type"] == "post_category"){ - $use_id = strtolower(rgar($match,4)) == "id"; - $item_value = self::format_post_category($item, $use_id); - - $val = RGFormsModel::is_field_hidden($form, $field, array(), $lead) ? "" : $item_value; - } - else{ - $val = RGFormsModel::is_field_hidden($form, $field, array(), $lead) ? "" : RGFormsModel::get_choice_text($field, $raw_value, $input_id); - } - - $ary[] = self::format_variable_value($val, $url_encode, $esc_html, $format); - } - - $value = self::implode_non_blank(", ", $ary); - - break; - - case "multiselect" : - if($field["type"] == "post_category"){ - $use_id = strtolower(rgar($match,4)) == "id"; - $items = explode(",", $value); - - if(is_array($items)){ - $cats = array(); - foreach($items as $item){ - $cat = self::format_post_category($item, $use_id); - $cats[] = self::format_variable_value($cat, $url_encode, $esc_html, $format); - } - $value = self::implode_non_blank(", ", $cats); - } - } - - break; - - case "date" : - $value = self::date_display($value, rgar($field,"dateFormat")); - break; - - case "total" : - $format_numeric = rgar($match,4) == "price"; - - $value = $format_numeric ? GFCommon::to_number($value) : GFCommon::to_money($value); - - $value = self::format_variable_value($value, $url_encode, $esc_html, $format); - break; - - case "post_category" : - $use_id = strtolower(rgar($match,4)) == "id"; - $value = self::format_post_category($value, $use_id); - $value = self::format_variable_value($value, $url_encode, $esc_html, $format); - break; - - case "list" : - $output_format = in_array(rgar($match,4), array("text", "html", "url")) ? rgar($match,4) : $format; - $value = self::get_lead_field_display($field, $raw_value, $lead["currency"], true, $output_format); - break; - } - - if(rgar($match,4) == "label"){ - $value = empty($value) ? "" : rgar($field, "label"); - } - else if(rgar($match,4) == "qty" && $field["type"] == "product"){ - //getting quantity associated with product field - $products = self::get_product_fields($form, $lead, false, false); - $value = 0; - foreach($products["products"] as $product_id => $product) - { - if($product_id == $field["id"]) - $value = $product["quantity"]; - } - } - - //Encoding left curly bracket so that merge tags entered in the front end are displayed as is and not "executed" - $value = self::encode_merge_tag($value); - - //filter can change merge code variable - $value = apply_filters("gform_merge_tag_filter", $value, $input_id, rgar($match,4), $field, $raw_value); - if($value === false) - $value = ""; - - $text = str_replace($match[0], $value , $text); - } - } + //Encoding left curly bracket so that merge tags entered in the front end are displayed as is and not 'executed' + $value = self::encode_merge_tag( $value ); - //replacing global variables - //form title - $text = str_replace("{form_title}", $url_encode ? urlencode($form["title"]) : $form["title"], $text); - - $matches = array(); - preg_match_all("/{all_fields(:(.*?))?}/", $text, $matches, PREG_SET_ORDER); - foreach($matches as $match){ - $options = explode(",", rgar($match,2)); - $use_value = in_array("value", $options); - $display_empty = in_array("empty", $options); - $use_admin_label = in_array("admin", $options); - - //all submitted fields using text - if (strpos($text, $match[0]) !== false){ - $text = str_replace($match[0], self::get_submitted_fields($form, $lead, $display_empty, !$use_value, $format, $use_admin_label, "all_fields", rgar($match,2)), $text); - } - } + //filter can change merge tab variable + $value = apply_filters( 'gform_merge_tag_filter', $value, $input_id, $modifier, $field, $raw_value ); + if ( $value === false ) { + $value = ''; + } - //all submitted fields including empty fields - if (strpos($text, "{all_fields_display_empty}") !== false){ - $text = str_replace("{all_fields_display_empty}", self::get_submitted_fields($form, $lead, true, true, $format, false, "all_fields_display_empty"), $text); - } + $text = str_replace( $match[0], $value, $text ); + } + } + + //replacing global variables + //form title + $text = str_replace( '{form_title}', $url_encode ? urlencode( $form['title'] ) : $form['title'], $text ); + + $matches = array(); + preg_match_all( "/{all_fields(:(.*?))?}/", $text, $matches, PREG_SET_ORDER ); + foreach ( $matches as $match ) { + $options = explode( ',', rgar( $match, 2 ) ); + $use_value = in_array( 'value', $options ); + $display_empty = in_array( 'empty', $options ); + $use_admin_label = in_array( 'admin', $options ); + + //all submitted fields using text + if ( strpos( $text, $match[0] ) !== false ) { + $text = str_replace( $match[0], self::get_submitted_fields( $form, $lead, $display_empty, ! $use_value, $format, $use_admin_label, 'all_fields', rgar( $match, 2 ) ), $text ); + } + } + + //all submitted fields including empty fields + if ( strpos( $text, '{all_fields_display_empty}' ) !== false ) { + $text = str_replace( '{all_fields_display_empty}', self::get_submitted_fields( $form, $lead, true, true, $format, false, 'all_fields_display_empty' ), $text ); + } - //pricing fields - if (strpos($text, "{pricing_fields}") !== false){ - $text = str_replace("{pricing_fields}", ' + //pricing fields + if ( strpos( $text, '{pricing_fields}' ) !== false ) { + $pricing_fields = self::get_submitted_pricing_fields( $form, $lead, $format ); + if ( $format == 'html' ) { + $text = str_replace( + '{pricing_fields}', '
    ' . - self::get_submitted_pricing_fields($form, $lead, $format) . - '
    + $pricing_fields . + '
    ', - $text); - } + $text + ); + } else { + $text = str_replace( '{pricing_fields}', $pricing_fields, $text ); + } + } - //form id - $text = str_replace("{form_id}", $url_encode ? urlencode($form["id"]) : $form["id"], $text); + //form id + $text = str_replace( '{form_id}', $url_encode ? urlencode( $form['id'] ) : $form['id'], $text ); - //entry id - $text = str_replace("{entry_id}", $url_encode ? urlencode(rgar($lead, "id")) : rgar($lead, "id"), $text); + //entry id + $text = str_replace( '{entry_id}', $url_encode ? urlencode( rgar( $lead, 'id' ) ) : rgar( $lead, 'id' ), $text ); - //entry url - $entry_url = get_bloginfo("wpurl") . "/wp-admin/admin.php?page=gf_entries&view=entry&id=" . $form["id"] . "&lid=" . rgar($lead,"id"); - $text = str_replace("{entry_url}", $url_encode ? urlencode($entry_url) : $entry_url, $text); + //entry url + $entry_url = get_bloginfo( 'wpurl' ) . '/wp-admin/admin.php?page=gf_entries&view=entry&id=' . $form['id'] . '&lid=' . rgar( $lead, 'id' ); + $text = str_replace( '{entry_url}', $url_encode ? urlencode( $entry_url ) : $entry_url, $text ); - //post id - $text = str_replace("{post_id}", $url_encode ? urlencode(rgar($lead, "post_id")) : rgar($lead, "post_id"), $text); + //post id + $text = str_replace( '{post_id}', $url_encode ? urlencode( rgar( $lead, 'post_id' ) ) : rgar( $lead, 'post_id' ), $text ); - //admin email - $wp_email = get_bloginfo("admin_email"); - $text = str_replace("{admin_email}", $url_encode ? urlencode($wp_email) : $wp_email, $text); + //admin email + $wp_email = get_bloginfo( 'admin_email' ); + $text = str_replace( '{admin_email}', $url_encode ? urlencode( $wp_email ) : $wp_email, $text ); - //post edit url - $post_url = get_bloginfo("wpurl") . "/wp-admin/post.php?action=edit&post=" . rgar($lead, "post_id"); - $text = str_replace("{post_edit_url}", $url_encode ? urlencode($post_url) : $post_url, $text); + //post edit url + $post_url = get_bloginfo( 'wpurl' ) . '/wp-admin/post.php?action=edit&post=' . rgar( $lead, 'post_id' ); + $text = str_replace( '{post_edit_url}', $url_encode ? urlencode( $post_url ) : $post_url, $text ); - $text = self::replace_variables_prepopulate($text, $url_encode, $lead); + $text = self::replace_variables_prepopulate( $text, $url_encode, $lead ); - // hook allows for custom merge tags - $text = apply_filters('gform_replace_merge_tags', $text, $form, $lead, $url_encode, $esc_html, $nl2br, $format); + // hook allows for custom merge tags + $text = apply_filters( 'gform_replace_merge_tags', $text, $form, $lead, $url_encode, $esc_html, $nl2br, $format ); - // TODO: Deprecate the 'gform_replace_merge_tags' and replace it with a call to the 'gform_merge_tag_filter' - //$text = apply_filters('gform_merge_tag_filter', $text, false, false, false ); + // TODO: Deprecate the 'gform_replace_merge_tags' and replace it with a call to the 'gform_merge_tag_filter' + //$text = apply_filters('gform_merge_tag_filter', $text, false, false, false ); - $text = self::decode_merge_tag($text); - return $text; - } + $text = self::decode_merge_tag( $text ); - public static function encode_merge_tag($text){ - return str_replace("{", "{", $text); - } + return $text; + } - public static function decode_merge_tag($text){ - return str_replace("{", "{", $text); - } + public static function encode_merge_tag( $text ) { + return str_replace( '{', '{', $text ); + } - public static function format_post_category($value, $use_id){ + public static function decode_merge_tag( $text ) { + return str_replace( '{', '{', $text ); + } - list($item_value, $item_id) = rgexplode(":", $value, 2); + public static function format_post_category( $value, $use_id ) { - if($use_id && !empty($item_id)) - $item_value = $item_id; + list( $item_value, $item_id ) = rgexplode( ':', $value, 2 ); - return $item_value; - } + if ( $use_id && ! empty( $item_id ) ) { + $item_value = $item_id; + } - public static function get_embed_post(){ - global $embed_post, $post, $wp_query; + return $item_value; + } - if($embed_post){ - return $embed_post; - } + public static function get_embed_post() { + global $embed_post, $post, $wp_query; - if(!rgempty("gform_embed_post")){ - $post_id = absint(rgpost("gform_embed_post")); - $embed_post = get_post($post_id); - } - else if($wp_query->is_in_loop){ - $embed_post = $post; - } - else{ - $embed_post = array(); - } - } + if ( $embed_post ) { + return $embed_post; + } + + if ( ! rgempty( 'gform_embed_post' ) ) { + $post_id = absint( rgpost( 'gform_embed_post' ) ); + $embed_post = get_post( $post_id ); + } else if ( $wp_query->is_in_loop ) { + $embed_post = $post; + } else { + $embed_post = array(); + } + } - public static function replace_variables_prepopulate($text, $url_encode=false, $entry=false){ + public static function get_ul_classes( $form ){ - //embed url - $text = str_replace("{embed_url}", $url_encode ? urlencode(RGFormsModel::get_current_page_url()) : RGFormsModel::get_current_page_url(), $text); + $description_class = rgar( $form, 'descriptionPlacement' ) == 'above' ? 'description_above' : 'description_below'; + $sublabel_class = rgar( $form, 'subLabelPlacement' ) == 'above' ? 'form_sublabel_above' : 'form_sublabel_below'; + $label_class = rgempty( 'labelPlacement', $form ) ? 'top_label' : rgar( $form, 'labelPlacement' ); - $local_timestamp = self::get_local_timestamp(time()); + $css_class = preg_replace( '/\s+/', ' ', "gform_fields {$label_class} {$sublabel_class} {$description_class}" ); //removing extra spaces - //date (mm/dd/yyyy) - $local_date_mdy = date_i18n("m/d/Y", $local_timestamp, true); - $text = str_replace("{date_mdy}", $url_encode ? urlencode($local_date_mdy) : $local_date_mdy, $text); + return $css_class; + } - //date (dd/mm/yyyy) - $local_date_dmy = date_i18n("d/m/Y", $local_timestamp, true); - $text = str_replace("{date_dmy}", $url_encode ? urlencode($local_date_dmy) : $local_date_dmy, $text); - // ip - $ip = isset( $entry['ip'] ) ? $entry['ip'] : GFFormsModel::get_ip(); - $text = str_replace( '{ip}', $url_encode ? urlencode( $ip ) : $ip, $text ); + public static function replace_variables_prepopulate( $text, $url_encode = false, $entry = false ) { - global $post; - $post_array = self::object_to_array($post); - preg_match_all("/\{embed_post:(.*?)\}/", $text, $matches, PREG_SET_ORDER); - foreach($matches as $match){ - $full_tag = $match[0]; - $property = $match[1]; - $text = str_replace($full_tag, $url_encode ? urlencode($post_array[$property]) : $post_array[$property], $text); - } + //embed url + $text = str_replace( '{embed_url}', $url_encode ? urlencode( RGFormsModel::get_current_page_url() ) : RGFormsModel::get_current_page_url(), $text ); - //embed post custom fields - preg_match_all("/\{custom_field:(.*?)\}/", $text, $matches, PREG_SET_ORDER); - foreach($matches as $match){ + $local_timestamp = self::get_local_timestamp( time() ); - $full_tag = $match[0]; - $custom_field_name = $match[1]; - $custom_field_value = !empty($post_array["ID"]) ? get_post_meta($post_array["ID"], $custom_field_name, true) : ""; - $text = str_replace($full_tag, $url_encode ? urlencode($custom_field_value) : $custom_field_value, $text); - } + //date (mm/dd/yyyy) + $local_date_mdy = date_i18n( 'm/d/Y', $local_timestamp, true ); + $text = str_replace( '{date_mdy}', $url_encode ? urlencode( $local_date_mdy ) : $local_date_mdy, $text ); - //user agent - $text = str_replace("{user_agent}", $url_encode ? urlencode(RGForms::get("HTTP_USER_AGENT", $_SERVER)) : RGForms::get("HTTP_USER_AGENT", $_SERVER), $text); + //date (dd/mm/yyyy) + $local_date_dmy = date_i18n( 'd/m/Y', $local_timestamp, true ); + $text = str_replace( '{date_dmy}', $url_encode ? urlencode( $local_date_dmy ) : $local_date_dmy, $text ); - //referrer - $text = str_replace("{referer}", $url_encode ? urlencode(RGForms::get("HTTP_REFERER", $_SERVER)) : RGForms::get("HTTP_REFERER", $_SERVER), $text); + // ip + $ip = isset( $entry['ip'] ) ? $entry['ip'] : GFFormsModel::get_ip(); + $text = str_replace( '{ip}', $url_encode ? urlencode( $ip ) : $ip, $text ); - //logged in user info - global $userdata, $wp_version, $current_user; - $user_array = self::object_to_array($userdata); + global $post; + $post_array = self::object_to_array( $post ); + preg_match_all( "/\{embed_post:(.*?)\}/", $text, $matches, PREG_SET_ORDER ); + foreach ( $matches as $match ) { + $full_tag = $match[0]; + $property = $match[1]; + $text = str_replace( $full_tag, $url_encode ? urlencode( $post_array[ $property ] ) : $post_array[ $property ], $text ); + } - preg_match_all("/\{user:(.*?)\}/", $text, $matches, PREG_SET_ORDER); - foreach($matches as $match){ - $full_tag = $match[0]; - $property = $match[1]; + //embed post custom fields + preg_match_all( "/\{custom_field:(.*?)\}/", $text, $matches, PREG_SET_ORDER ); + foreach ( $matches as $match ) { - $value = version_compare($wp_version, '3.3', '>=') ? $current_user->get($property) : $user_array[$property]; - $value = $url_encode ? urlencode($value) : $value; + $full_tag = $match[0]; + $custom_field_name = $match[1]; + $custom_field_value = ! empty( $post_array['ID'] ) ? get_post_meta( $post_array['ID'], $custom_field_name, true ) : ''; + $text = str_replace( $full_tag, $url_encode ? urlencode( $custom_field_value ) : $custom_field_value, $text ); + } - $text = str_replace($full_tag, $value, $text); - } + //user agent + $text = str_replace( '{user_agent}', $url_encode ? urlencode( RGForms::get( 'HTTP_USER_AGENT', $_SERVER ) ) : RGForms::get( 'HTTP_USER_AGENT', $_SERVER ), $text ); - return $text; - } + //referrer + $text = str_replace( '{referer}', $url_encode ? urlencode( RGForms::get( 'HTTP_REFERER', $_SERVER ) ) : RGForms::get( 'HTTP_REFERER', $_SERVER ), $text ); - public static function object_to_array($object){ - $array=array(); - if(!empty($object)){ - foreach($object as $member=>$data) - $array[$member]=$data; - } - return $array; - } + //logged in user info + global $userdata, $wp_version, $current_user; + $user_array = self::object_to_array( $userdata ); - public static function is_empty_array($val){ - if(!is_array($val)) - $val = array($val); + preg_match_all( "/\{user:(.*?)\}/", $text, $matches, PREG_SET_ORDER ); + foreach ( $matches as $match ) { + $full_tag = $match[0]; + $property = $match[1]; - $ary = array_values($val); - foreach($ary as $item){ - if(!rgblank($item)) - return false; - } - return true; - } + $value = version_compare( $wp_version, '3.3', '>=' ) ? $current_user->get( $property ) : $user_array[ $property ]; + $value = $url_encode ? urlencode( $value ) : $value; - public static function get_submitted_fields($form, $lead, $display_empty=false, $use_text=false, $format="html", $use_admin_label=false, $merge_tag="", $options=""){ + $text = str_replace( $full_tag, $value, $text ); + } + + $text = apply_filters( 'gform_replace_merge_tags', $text, false, false, $url_encode, false, false, false ); + + return $text; + } + + public static function object_to_array( $object ) { + $array = array(); + if ( ! empty( $object ) ) { + foreach ( $object as $member => $data ) { + $array[ $member ] = $data; + } + } + + return $array; + } + + public static function is_empty_array( $val ) { + if ( ! is_array( $val ) ) { + $val = array( $val ); + } + + $ary = array_values( $val ); + foreach ( $ary as $item ) { + if ( ! rgblank( $item ) ) { + return false; + } + } + + return true; + } - $field_data = ""; - if($format == "html"){ - $field_data = '
    + public static function get_submitted_fields( $form, $lead, $display_empty = false, $use_text = false, $format = 'html', $use_admin_label = false, $merge_tag = '', $options = '' ) { + + $field_data = ''; + if ( $format == 'html' ) { + $field_data = '
    '; - } + } - $options_array = explode(",", $options); - $no_admin = in_array("noadmin", $options_array); - $no_hidden = in_array("nohidden", $options_array); - $display_product_summary = false; + $options_array = explode( ',', $options ); + $no_admin = in_array( 'noadmin', $options_array ); + $no_hidden = in_array( 'nohidden', $options_array ); + $display_product_summary = false; - foreach($form["fields"] as $field){ - $field_value = ""; + foreach ( $form['fields'] as $field ) { + $field_value = ''; - $field_label = $use_admin_label && !rgempty("adminLabel", $field) ? rgar($field, "adminLabel") : esc_html(GFCommon::get_label($field)); + $field_label = $use_admin_label && ! empty( $field->adminLabel ) ? $field->adminLabel : esc_html( GFCommon::get_label( $field ) ); - switch($field["type"]){ - case "captcha" : - break; + switch ( $field->type ) { + case 'captcha' : + break; - case "section" : + case 'section' : if ( GFFormsModel::is_field_hidden( $form, $field, array(), $lead ) ){ continue; } - if ( ( ! GFCommon::is_section_empty( $field, $form, $lead ) || $display_empty ) && !rgar( $field, "adminOnly" ) ) { + if ( ( ! GFCommon::is_section_empty( $field, $form, $lead ) || $display_empty ) && ! $field->adminOnly ) { - switch($format){ - case "text" : - $field_value = "--------------------------------\n{$field_label}\n\n"; - break; + switch ( $format ) { + case 'text' : + $field_value = "--------------------------------\n{$field_label}\n\n"; + break; - default: - $field_value = sprintf(' + default: + $field_value = sprintf( + ' - ', $field_label); - break; - } - } - - $field_value = apply_filters("gform_merge_tag_filter", $field_value, $merge_tag, $options, $field, $field_label); + ', $field_label + ); + break; + } + } - $field_data .= $field_value; + $field_value = apply_filters( 'gform_merge_tag_filter', $field_value, $merge_tag, $options, $field, $field_label ); - break; - case "password" : - //ignore password fields - break; + $field_data .= $field_value; - default : + break; + case 'password' : + //ignore password fields + break; - if( self::is_product_field( $field['type'] ) ) { + default : - // ignore product fields as they will be grouped together at the end of the grid - $display_product_summary = apply_filters( 'gform_display_product_summary', true, $field, $form, $lead ); - if( $display_product_summary ) - continue; + if ( self::is_product_field( $field->type ) ) { - } - else if( GFFormsModel::is_field_hidden( $form, $field, array(), $lead) ){ - // ignore fields hidden by conditional logic - continue; - } + // ignore product fields as they will be grouped together at the end of the grid + $display_product_summary = apply_filters( 'gform_display_product_summary', true, $field, $form, $lead ); + if ( $display_product_summary ) { + continue; + } + } else if ( GFFormsModel::is_field_hidden( $form, $field, array(), $lead ) ) { + // ignore fields hidden by conditional logic + continue; + } - $raw_field_value = RGFormsModel::get_lead_field_value($lead, $field); - $field_value = GFCommon::get_lead_field_display($field, $raw_field_value, rgar($lead,"currency"), $use_text, $format, "email"); + $raw_field_value = RGFormsModel::get_lead_field_value( $lead, $field ); + $field_value = GFCommon::get_lead_field_display( $field, $raw_field_value, rgar( $lead, 'currency' ), $use_text, $format, 'email' ); - $display_field = true; - //depending on parameters, don't display adminOnly or hidden fields - if($no_admin && rgar($field, "adminOnly")) - $display_field = false; - else if($no_hidden && RGFormsModel::get_input_type($field) == "hidden") - $display_field = false; + $display_field = true; + //depending on parameters, don't display adminOnly or hidden fields + if ( $no_admin && $field->adminOnly ) { + $display_field = false; + } else if ( $no_hidden && RGFormsModel::get_input_type( $field ) == 'hidden' ) { + $display_field = false; + } - //if field is not supposed to be displayed, pass false to filter. otherwise, pass field's value - if(!$display_field) - $field_value = false; + //if field is not supposed to be displayed, pass false to filter. otherwise, pass field's value + if ( ! $display_field ) { + $field_value = false; + } - $field_value = apply_filters("gform_merge_tag_filter", $field_value, $merge_tag, $options, $field, $raw_field_value); + $field_value = apply_filters( 'gform_merge_tag_filter', $field_value, $merge_tag, $options, $field, $raw_field_value ); - if($field_value === false) - continue; + if ( $field_value === false ) { + continue; + } - if( !empty($field_value) || strlen($field_value) > 0 || $display_empty){ - switch($format){ - case "text" : - $field_data .= "{$field_label}: {$field_value}\n\n"; - break; + if ( ! empty( $field_value ) || strlen( $field_value ) > 0 || $display_empty ) { + switch ( $format ) { + case 'text' : + $field_data .= "{$field_label}: {$field_value}\n\n"; + break; - default: + default: - $field_data .= sprintf(' + $field_data .= sprintf( + ' @@ -1156,67 +1149,70 @@ public static function get_submitted_fields($form, $lead, $display_empty=false, %2$s - ', $field_label, empty($field_value) && strlen($field_value) == 0 ? " " : $field_value, apply_filters("gform_email_background_color_label", '#EAF2FA', $field, $lead), apply_filters("gform_email_background_color_data", '#FFFFFF', $field, $lead) ); - break; - } - } - } - } + ', $field_label, empty( $field_value ) && strlen( $field_value ) == 0 ? ' ' : $field_value, apply_filters( 'gform_email_background_color_label', '#EAF2FA', $field, $lead ), apply_filters( 'gform_email_background_color_data', '#FFFFFF', $field, $lead ) + ); + break; + } + } + } + } - if( $display_product_summary ) - $field_data .= self::get_submitted_pricing_fields( $form, $lead, $format, $use_text, $use_admin_label ); + if ( $display_product_summary ) { + $field_data .= self::get_submitted_pricing_fields( $form, $lead, $format, $use_text, $use_admin_label ); + } - if($format == "html"){ - $field_data .='
    %s
    %1$s
    + if ( $format == 'html' ) { + $field_data .= '
    '; - } + } - return $field_data; - } + return $field_data; + } + + public static function get_submitted_pricing_fields( $form, $lead, $format, $use_text = true, $use_admin_label = false ) { + $form_id = $form['id']; + $order_label = apply_filters( "gform_order_label_{$form['id']}", apply_filters( 'gform_order_label', __( 'Order' , 'gravityforms' ), $form['id'] ), $form['id'] ); + $products = GFCommon::get_product_fields( $form, $lead, $use_text, $use_admin_label ); + $total = 0; + $field_data = ''; + + switch ( $format ) { + case 'text' : + if ( ! empty( $products['products'] ) ) { + $field_data = "--------------------------------\n" . $order_label . "\n\n"; + foreach ( $products['products'] as $product ) { + $product_name = $product['quantity'] . ' ' . $product['name']; + $price = self::to_number( $product['price'] ); + if ( ! empty( $product['options'] ) ) { + $product_name .= ' ('; + $options = array(); + foreach ( $product['options'] as $option ) { + $price += self::to_number( $option['price'] ); + $options[] = $option['option_name']; + } + $product_name .= implode( ', ', $options ) . ')'; + } + $subtotal = floatval( $product['quantity'] ) * $price; + $total += $subtotal; + + $field_data .= "{$product_name}: " . self::to_money( $subtotal, $lead['currency'] ) . "\n\n"; + } + $total += floatval( $products['shipping']['price'] ); + + if ( ! empty( $products['shipping']['name'] ) ) { + $field_data .= $products['shipping']['name'] . ': ' . self::to_money( $products['shipping']['price'], $lead['currency'] ) . "\n\n"; + } - public static function get_submitted_pricing_fields($form, $lead, $format, $use_text=true, $use_admin_label=false){ - $form_id = $form["id"]; - $order_label = apply_filters("gform_order_label_{$form["id"]}", apply_filters("gform_order_label", __("Order", "gravityforms"), $form["id"]), $form["id"]); - $products = GFCommon::get_product_fields($form, $lead, $use_text, $use_admin_label); - $total = 0; - $field_data = ""; - - switch($format){ - case "text" : - if(!empty($products["products"])){ - $field_data = "--------------------------------\n" . $order_label . "\n\n"; - foreach($products["products"] as $product){ - $product_name = $product["quantity"] . " " . $product["name"]; - $price = self::to_number($product["price"]); - if(!empty($product["options"])){ - $product_name .= " ("; - $options = array(); - foreach($product["options"] as $option){ - $price += self::to_number($option["price"]); - $options[] = $option["option_name"]; - } - $product_name .= implode(", ", $options) . ")"; - } - $subtotal = floatval($product["quantity"]) * $price; - $total += $subtotal; - - $field_data .= "{$product_name}: " . self::to_money($subtotal, $lead["currency"]) . "\n\n"; - } - $total += floatval($products["shipping"]["price"]); - - if(!empty($products["shipping"]["name"])) - $field_data .= $products["shipping"]["name"] . ": " . self::to_money($products["shipping"]["price"], $lead["currency"]) . "\n\n"; - - $field_data .= __("Total", "gravityforms") . ": " . self::to_money($total, $lead["currency"]) . "\n\n"; - } - break; - - - default : - if(!empty($products["products"])){ - $field_data =' + $field_data .= __( 'Total' , 'gravityforms' ) . ': ' . self::to_money( $total, $lead['currency'] ) . "\n\n"; + } + break; + + + default : + if ( ! empty( $products['products'] ) ) { + $field_data = ' ' . $order_label . ' @@ -1226,827 +1222,833 @@ public static function get_submitted_pricing_fields($form, $lead, $format, $use_ - - - - + + + + '; - foreach($products["products"] as $product){ + foreach ( $products['products'] as $product ) { - $field_data .= ' + $field_data .= ' - - - + + + '; - } - $total += floatval($products["shipping"]["price"]); - $field_data .= ' + } + $total += floatval( $products['shipping']['price'] ); + $field_data .= ''; - if(!empty($products["shipping"]["name"])){ - $field_data .= ' + if ( ! empty( $products['shipping']['name'] ) ) { + $field_data .= ' - - + + '; - } + } - $field_data .= ' + $field_data .= ' '; - if(empty($products["shipping"]["name"])){ - $field_data .= ' + if ( empty( $products['shipping']['name'] ) ) { + $field_data .= ' '; - } + } - $field_data .= ' - - + $field_data .= ' + +
    ' . apply_filters("gform_product_{$form_id}", apply_filters("gform_product", __("Product", "gravityforms"), $form_id), $form_id) . '' . apply_filters("gform_product_qty_{$form_id}", apply_filters("gform_product_qty", __("Qty", "gravityforms"), $form_id), $form_id) . '' . apply_filters("gform_product_unitprice_{$form_id}", apply_filters("gform_product_unitprice", __("Unit Price", "gravityforms"), $form_id), $form_id) . '' . apply_filters("gform_product_price_{$form_id}", apply_filters("gform_product_price", __("Price", "gravityforms"), $form_id), $form_id) . '' . apply_filters( "gform_product_{$form_id}", apply_filters( 'gform_product', __( 'Product' , 'gravityforms' ), $form_id ), $form_id ) . '' . apply_filters( "gform_product_qty_{$form_id}", apply_filters( 'gform_product_qty', __( 'Qty' , 'gravityforms' ), $form_id ), $form_id ) . '' . apply_filters( "gform_product_unitprice_{$form_id}", apply_filters( 'gform_product_unitprice', __( 'Unit Price' , 'gravityforms' ), $form_id ), $form_id ) . '' . apply_filters( "gform_product_price_{$form_id}", apply_filters( 'gform_product_price', __( 'Price' , 'gravityforms' ), $form_id ), $form_id ) . '
    - ' . $product["name"] .' + ' . $product['name'] . '
      '; - $price = self::to_number($product["price"]); - if(is_array(rgar($product,"options"))){ - foreach($product["options"] as $option){ - $price += self::to_number($option["price"]); - $field_data .= '
    • ' . $option["option_label"] .'
    • '; - } - } - $subtotal = floatval($product["quantity"]) * $price; - $total += $subtotal; - - $field_data .='
    + $price = self::to_number( $product['price'] ); + if ( is_array( rgar( $product, 'options' ) ) ) { + foreach ( $product['options'] as $option ) { + $price += self::to_number( $option['price'] ); + $field_data .= '
  • ' . $option['option_label'] . '
  • '; + } + } + $subtotal = floatval( $product['quantity'] ) * $price; + $total += $subtotal; + + $field_data .= '
    ' . $product["quantity"] .'' . self::to_money($price, $lead["currency"]) .'' . self::to_money($subtotal, $lead["currency"]) .'' . $product['quantity'] . '' . self::to_money( $price, $lead['currency'] ) . '' . self::to_money( $subtotal, $lead['currency'] ) . '
     ' . $products["shipping"]["name"] . ''. self::to_money($products["shipping"]["price"], $lead["currency"]) . '' . $products['shipping']['name'] . '' . self::to_money( $products['shipping']['price'], $lead['currency'] ) . '
     ' . __("Total:", "gravityforms") . ''. self::to_money($total, $lead["currency"]) . '' . __( 'Total:' , 'gravityforms' ) . '' . self::to_money( $total, $lead['currency'] ) . '
    '; - } - break; - } + } + break; + } - return $field_data; - } + return $field_data; + } - public static function send_user_notification($form, $lead, $override_options = false){ - _deprecated_function("send_user_notification", "1.7", "send_notification"); + public static function send_user_notification( $form, $lead, $override_options = false ) { + _deprecated_function( 'send_user_notification', '1.7', 'send_notification' ); - $notification = self::prepare_user_notification($form, $lead, $override_options); - self::send_email($notification["from"], $notification["to"], $notification["bcc"], $notification["reply_to"], $notification["subject"], $notification["message"], $notification["from_name"], $notification["message_format"], $notification["attachments"]); - } + $notification = self::prepare_user_notification( $form, $lead, $override_options ); + self::send_email( $notification['from'], $notification['to'], $notification['bcc'], $notification['reply_to'], $notification['subject'], $notification['message'], $notification['from_name'], $notification['message_format'], $notification['attachments'] ); + } - public static function send_admin_notification($form, $lead, $override_options = false){ - _deprecated_function("send_admin_notification", "1.7", "send_notification"); + public static function send_admin_notification( $form, $lead, $override_options = false ) { + _deprecated_function( 'send_admin_notification', '1.7', 'send_notification' ); - $notification = self::prepare_admin_notification($form, $lead, $override_options); - self::send_email($notification["from"], $notification["to"], $notification["bcc"], $notification["replyTo"], $notification["subject"], $notification["message"], $notification["from_name"], $notification["message_format"], $notification["attachments"]); - } + $notification = self::prepare_admin_notification( $form, $lead, $override_options ); + self::send_email( $notification['from'], $notification['to'], $notification['bcc'], $notification['replyTo'], $notification['subject'], $notification['message'], $notification['from_name'], $notification['message_format'], $notification['attachments'] ); + } - private static function prepare_user_notification($form, $lead, $override_options = false){ - $form_id = $form["id"]; + private static function prepare_user_notification( $form, $lead, $override_options = false ) { + $form_id = $form['id']; - if(!isset($form["autoResponder"])) - return; + if ( ! isset( $form['autoResponder'] ) ) { + return; + } - //handling autoresponder email - $to_field = isset($form["autoResponder"]["toField"]) ? rgget($form["autoResponder"]["toField"], $lead) : ""; - $to = apply_filters("gform_autoresponder_email_{$form_id}", apply_filters("gform_autoresponder_email", $to_field, $form), $form); - $subject = GFCommon::replace_variables(rgget("subject", $form["autoResponder"]), $form, $lead, false, false); + //handling autoresponder email + $to_field = isset( $form['autoResponder']['toField'] ) ? rgget( $form['autoResponder']['toField'], $lead ) : ''; + $to = apply_filters( "gform_autoresponder_email_{$form_id}", apply_filters( 'gform_autoresponder_email', $to_field, $form ), $form ); + $subject = GFCommon::replace_variables( rgget( 'subject', $form['autoResponder'] ), $form, $lead, false, false ); + + $message_format = apply_filters( "gform_notification_format_{$form['id']}", apply_filters( 'gform_notification_format', 'html', 'user', $form, $lead ), 'user', $form, $lead ); + $message = GFCommon::replace_variables( rgget( 'message', $form['autoResponder'] ), $form, $lead, false, false, ! rgget( 'disableAutoformat', $form['autoResponder'] ), $message_format ); + $message = do_shortcode( $message ); + + //Running trough variable replacement + $to = GFCommon::replace_variables( $to, $form, $lead, false, false ); + $from = GFCommon::replace_variables( rgget( 'from', $form['autoResponder'] ), $form, $lead, false, false ); + $bcc = GFCommon::replace_variables( rgget( 'bcc', $form['autoResponder'] ), $form, $lead, false, false ); + $reply_to = GFCommon::replace_variables( rgget( 'replyTo', $form['autoResponder'] ), $form, $lead, false, false ); + $from_name = GFCommon::replace_variables( rgget( 'fromName', $form['autoResponder'] ), $form, $lead, false, false ); + + // override default values if override options provided + if ( $override_options && is_array( $override_options ) ) { + foreach ( $override_options as $override_key => $override_value ) { + ${$override_key} = $override_value; + } + } - $message_format = apply_filters("gform_notification_format_{$form["id"]}", apply_filters("gform_notification_format", "html", "user", $form, $lead), "user", $form, $lead); - $message = GFCommon::replace_variables(rgget("message", $form["autoResponder"]), $form, $lead, false, false, !rgget("disableAutoformat", $form["autoResponder"]), $message_format); + $attachments = apply_filters( "gform_user_notification_attachments_{$form_id}", apply_filters( 'gform_user_notification_attachments', array(), $lead, $form ), $lead, $form ); - if(apply_filters("gform_enable_shortcode_notification_message", true, $form, $lead)){ - $message = do_shortcode($message); - } + //Disabling autoformat to prevent double autoformatting of messages + $disableAutoformat = '1'; - //Running trough variable replacement - $to = GFCommon::replace_variables($to, $form, $lead, false, false); - $from = GFCommon::replace_variables(rgget("from", $form["autoResponder"]), $form, $lead, false, false); - $bcc = GFCommon::replace_variables(rgget("bcc", $form["autoResponder"]), $form, $lead, false, false); - $reply_to = GFCommon::replace_variables(rgget("replyTo", $form["autoResponder"]), $form, $lead, false, false); - $from_name = GFCommon::replace_variables(rgget("fromName", $form["autoResponder"]), $form, $lead, false, false); - - // override default values if override options provided - if($override_options && is_array($override_options)){ - foreach($override_options as $override_key => $override_value){ - ${$override_key} = $override_value; - } - } + return compact( 'to', 'from', 'bcc', 'reply_to', 'subject', 'message', 'from_name', 'message_format', 'attachments', 'disableAutoformat' ); + } - $attachments = apply_filters("gform_user_notification_attachments_{$form_id}", apply_filters("gform_user_notification_attachments", array(), $lead, $form), $lead, $form); + private static function prepare_admin_notification( $form, $lead, $override_options = false ) { + $form_id = $form['id']; - //Disabling autoformat to prevent double autoformatting of messages - $disableAutoformat = "1"; + //handling admin notification email + $subject = GFCommon::replace_variables( rgget( 'subject', $form['notification'] ), $form, $lead, false, false ); - return compact("to", "from", "bcc", "reply_to", "subject", "message", "from_name", "message_format", "attachments", "disableAutoformat"); - } + $message_format = apply_filters( "gform_notification_format_{$form['id']}", apply_filters( 'gform_notification_format', 'html', 'admin', $form, $lead ), 'admin', $form, $lead ); + $message = GFCommon::replace_variables( rgget( 'message', $form['notification'] ), $form, $lead, false, false, ! rgget( 'disableAutoformat', $form['notification'] ), $message_format ); + $message = do_shortcode( $message ); - private static function prepare_admin_notification($form, $lead, $override_options = false){ - $form_id = $form["id"]; + $version_info = self::get_version_info(); + $is_expired = ! rgempty( 'expiration_time', $version_info ) && $version_info['expiration_time'] < time(); + if ( ! rgar( $version_info, 'is_valid_key' ) && $is_expired ) { + $message .= "

    Your Gravity Forms License Key has expired. In order to continue receiving support and software updates you must renew your license key. You can do so by following the renewal instructions on the Gravity Forms Settings page in your WordPress Dashboard or by clicking here."; + } - //handling admin notification email - $subject = GFCommon::replace_variables(rgget("subject", $form["notification"]), $form, $lead, false, false); + $from = rgempty( 'fromField', $form['notification'] ) ? rgget( 'from', $form['notification'] ) : rgget( $form['notification']['fromField'], $lead ); - $message_format = apply_filters("gform_notification_format_{$form["id"]}", apply_filters("gform_notification_format", "html", "admin", $form, $lead), "admin", $form, $lead); - $message = GFCommon::replace_variables(rgget("message", $form["notification"]), $form, $lead, false, false, !rgget("disableAutoformat", $form["notification"]), $message_format); + if ( rgempty( 'fromNameField', $form['notification'] ) ) { + $from_name = rgget( 'fromName', $form['notification'] ); + } else { + $field = RGFormsModel::get_field( $form, rgget( 'fromNameField', $form['notification'] ) ); + $value = RGFormsModel::get_lead_field_value( $lead, $field ); + $from_name = GFCommon::get_lead_field_display( $field, $value ); + } - if(apply_filters("gform_enable_shortcode_notification_message", true, $form, $lead)){ - $message = do_shortcode($message); - } + $replyTo = rgempty( 'replyToField', $form['notification'] ) ? rgget( 'replyTo', $form['notification'] ) : rgget( $form['notification']['replyToField'], $lead ); - $version_info = self::get_version_info(); - $is_expired = !rgempty("expiration_time", $version_info) && $version_info["expiration_time"] < time(); - if( !rgar($version_info, "is_valid_key") && $is_expired){ - $message .= "

    Your Gravity Forms License Key has expired. In order to continue receiving support and software updates you must renew your license key. You can do so by following the renewal instructions on the Gravity Forms Settings page in your WordPress Dashboard or by clicking here."; - } + if ( rgempty( 'routing', $form['notification'] ) ) { + $email_to = rgempty( 'toField', $form['notification'] ) ? rgget( 'to', $form['notification'] ) : rgget( 'toField', $form['notification'] ); + } else { + $email_to = array(); + foreach ( $form['notification']['routing'] as $routing ) { - $from = rgempty("fromField", $form["notification"]) ? rgget("from", $form["notification"]) : rgget($form["notification"]["fromField"], $lead); + $source_field = RGFormsModel::get_field( $form, $routing['fieldId'] ); + $field_value = RGFormsModel::get_lead_field_value( $lead, $source_field ); + $is_value_match = RGFormsModel::is_value_match( $field_value, $routing['value'], $routing['operator'], $source_field, $routing, $form ) && ! RGFormsModel::is_field_hidden( $form, $source_field, array(), $lead ); - if(rgempty("fromNameField", $form["notification"])){ - $from_name = rgget("fromName", $form["notification"]); - } - else{ - $field = RGFormsModel::get_field($form, rgget("fromNameField", $form["notification"])); - $value = RGFormsModel::get_lead_field_value($lead, $field); - $from_name = GFCommon::get_lead_field_display($field, $value); - } + if ( $is_value_match ) { + $email_to[] = $routing['email']; + } + } - $replyTo = rgempty("replyToField", $form["notification"]) ? rgget("replyTo", $form["notification"]): rgget($form["notification"]["replyToField"], $lead); + $email_to = join( ',', $email_to ); + } - if(rgempty("routing", $form["notification"])){ - $email_to = rgempty("toField", $form["notification"]) ? rgget("to", $form["notification"]) : rgget("toField", $form["notification"]); - } - else{ - $email_to = array(); - foreach($form["notification"]["routing"] as $routing){ + //Running through variable replacement + $email_to = GFCommon::replace_variables( $email_to, $form, $lead, false, false ); + $from = GFCommon::replace_variables( $from, $form, $lead, false, false ); + $bcc = GFCommon::replace_variables( rgget( 'bcc', $form['notification'] ), $form, $lead, false, false ); + $reply_to = GFCommon::replace_variables( $replyTo, $form, $lead, false, false ); + $from_name = GFCommon::replace_variables( $from_name, $form, $lead, false, false ); - $source_field = RGFormsModel::get_field($form, $routing["fieldId"]); - $field_value = RGFormsModel::get_lead_field_value($lead, $source_field); - $is_value_match = RGFormsModel::is_value_match( $field_value, $routing["value"], $routing["operator"], $source_field, $routing, $form ) && !RGFormsModel::is_field_hidden($form, $source_field, array(), $lead); + //Filters the admin notification email to address. Allows users to change email address before notification is sent + $to = apply_filters( "gform_notification_email_{$form_id}", apply_filters( 'gform_notification_email', $email_to, $lead ), $lead ); - if ($is_value_match) - $email_to[] = $routing["email"]; - } + // override default values if override options provided + if ( $override_options && is_array( $override_options ) ) { + foreach ( $override_options as $override_key => $override_value ) { + ${$override_key} = $override_value; + } + } - $email_to = join(",", $email_to); - } + $attachments = apply_filters( "gform_admin_notification_attachments_{$form_id}", apply_filters( 'gform_admin_notification_attachments', array(), $lead, $form ), $lead, $form ); - //Running through variable replacement - $email_to = GFCommon::replace_variables($email_to, $form, $lead, false, false); - $from = GFCommon::replace_variables($from, $form, $lead, false, false); - $bcc = GFCommon::replace_variables(rgget("bcc", $form["notification"]), $form, $lead, false, false); - $reply_to = GFCommon::replace_variables($replyTo, $form, $lead, false, false); - $from_name = GFCommon::replace_variables($from_name, $form, $lead, false, false); - - //Filters the admin notification email to address. Allows users to change email address before notification is sent - $to = apply_filters("gform_notification_email_{$form_id}" , apply_filters("gform_notification_email", $email_to, $lead), $lead); - - // override default values if override options provided - if($override_options && is_array($override_options)){ - foreach($override_options as $override_key => $override_value){ - ${$override_key} = $override_value; - } - } + //Disabling autoformat to prevent double autoformatting of messages + $disableAutoformat = '1'; - $attachments = apply_filters("gform_admin_notification_attachments_{$form_id}", apply_filters("gform_admin_notification_attachments", array(), $lead, $form), $lead, $form); + return compact( 'to', 'from', 'bcc', 'replyTo', 'subject', 'message', 'from_name', 'message_format', 'attachments', 'disableAutoformat' ); - //Disabling autoformat to prevent double autoformatting of messages - $disableAutoformat = "1"; + } - return compact("to", "from", "bcc", "replyTo", "subject", "message", "from_name", "message_format", "attachments", "disableAutoformat"); + public static function send_notification( $notification, $form, $lead ) { - } + GFCommon::log_debug( "GFCommon::send_notification(): Starting to process notification (#{$notification['id']} - {$notification['name']})." ); + $notification = apply_filters( "gform_notification_{$form['id']}", apply_filters( 'gform_notification', $notification, $form, $lead ), $form, $lead ); + + $to_field = ''; + if ( rgar( $notification, 'toType' ) == 'field' ) { + $to_field = rgar( $notification, 'toField' ); + if ( rgempty( 'toField', $notification ) ) { + $to_field = rgar( $notification, 'to' ); + } + } - public static function send_notification($notification, $form, $lead){ + $email_to = rgar( $notification, 'to' ); + //do routing logic if "to" field doesn't have a value (to support legacy notifications that will run routing prior to this method) + if ( empty( $email_to ) && rgar( $notification, 'toType' ) == 'routing' ) { + $email_to = array(); + foreach ( $notification['routing'] as $routing ) { - $notification = apply_filters("gform_notification_{$form["id"]}", apply_filters("gform_notification", $notification, $form, $lead), $form, $lead); + $source_field = RGFormsModel::get_field( $form, $routing['fieldId'] ); + $field_value = RGFormsModel::get_lead_field_value( $lead, $source_field ); + $is_value_match = RGFormsModel::is_value_match( $field_value, $routing['value'], $routing['operator'], $source_field, $routing, $form ) && ! RGFormsModel::is_field_hidden( $form, $source_field, array(), $lead ); - $to_field = ""; - if(rgar($notification, "toType") == "field"){ - $to_field = rgar($notification, "toField"); - if(rgempty("toField", $notification)){ - $to_field = rgar($notification, "to"); + if ( $is_value_match ) { + $email_to[] = $routing['email']; + } } - } - $email_to = rgar($notification, "to"); - //do routing logic if "to" field doesn't have a value (to support legacy notifications what will run routing prior to this method - if(empty($email_to) && rgar($notification, "toType") == "routing"){ - $email_to = array(); - foreach($notification["routing"] as $routing){ + $email_to = join( ',', $email_to ); + } else if ( ! empty( $to_field ) ) { + $source_field = RGFormsModel::get_field( $form, $to_field ); + $email_to = RGFormsModel::get_lead_field_value( $lead, $source_field ); + } - $source_field = RGFormsModel::get_field($form, $routing["fieldId"]); - $field_value = RGFormsModel::get_lead_field_value($lead, $source_field); - $is_value_match = RGFormsModel::is_value_match($field_value, $routing["value"], $routing["operator"], $source_field, $routing, $form ) && !RGFormsModel::is_field_hidden($form, $source_field, array(), $lead); + //Running through variable replacement + $to = GFCommon::replace_variables( $email_to, $form, $lead, false, false ); + $subject = GFCommon::replace_variables( rgar( $notification, 'subject' ), $form, $lead, false, false, true, 'text' ); + $from = GFCommon::replace_variables( rgar( $notification, 'from' ), $form, $lead, false, false ); + $from_name = GFCommon::replace_variables( rgar( $notification, 'fromName' ), $form, $lead, false, false, true, 'text' ); + $bcc = GFCommon::replace_variables( rgar( $notification, 'bcc' ), $form, $lead, false, false ); + $replyTo = GFCommon::replace_variables( rgar( $notification, 'replyTo' ), $form, $lead, false, false ); + + $message_format = rgempty( 'message_format', $notification ) ? 'html' : rgar( $notification, 'message_format' ); + $message = GFCommon::replace_variables( rgar( $notification, 'message' ), $form, $lead, false, false, ! rgar( $notification, 'disableAutoformat' ), $message_format ); + $message = do_shortcode( $message ); + + // allow attachments to be passed as a single path (string) or an array of paths, if string provided, add to array + $attachments = rgar( $notification, 'attachments' ); + if ( ! empty( $attachments ) ) { + $attachments = is_array( $attachments ) ? $attachments : array( $attachments ); + } else { + $attachments = array(); + } - if ($is_value_match) - $email_to[] = $routing["email"]; - } + self::send_email( $from, $to, $bcc, $replyTo, $subject, $message, $from_name, $message_format, $attachments ); - $email_to = join(",", $email_to); - } - else if (!empty($to_field)) { - $source_field = RGFormsModel::get_field($form, $to_field); - $email_to = RGFormsModel::get_lead_field_value($lead, $source_field); - } + return compact( 'to', 'from', 'bcc', 'replyTo', 'subject', 'message', 'from_name', 'message_format', 'attachments' ); - //Running through variable replacement - $to = GFCommon::replace_variables($email_to, $form, $lead, false, false); - $subject = GFCommon::replace_variables(rgar($notification, "subject"), $form, $lead, false, false, true, 'text'); - $from = GFCommon::replace_variables(rgar($notification, "from"), $form, $lead, false, false); - $from_name = GFCommon::replace_variables(rgar($notification, "fromName"), $form, $lead, false, false, true, 'text'); - $bcc = GFCommon::replace_variables(rgar($notification, "bcc"), $form, $lead, false, false); - $replyTo = GFCommon::replace_variables(rgar($notification, "replyTo"), $form, $lead, false, false); + } - $message_format = rgempty("message_format", $notification) ? "html" : rgar($notification, "message_format"); - $message = GFCommon::replace_variables(rgar($notification, "message"), $form, $lead, false, false, !rgar($notification, "disableAutoformat"), $message_format); + public static function send_notifications( $notification_ids, $form, $lead, $do_conditional_logic = true, $event = 'form_submission' ) { + if ( ! is_array( $notification_ids ) || empty( $notification_ids ) ) { + GFCommon::log_debug( "GFCommon::send_notifications(): Aborting. No notifications to process for {$event} event." ); - if(apply_filters("gform_enable_shortcode_notification_message", true, $form, $lead)){ - $message = do_shortcode($message); - } + return; + } - // allow attachments to be passed as a single path (string) or an array of paths, if string provided, add to array - $attachments = rgar( $notification, "attachments" ); - if( !empty( $attachments ) ) { - $attachments = is_array( $attachments ) ? $attachments : array( $attachments ); - } else { - $attachments = array(); - } + GFCommon::log_debug( "GFCommon::send_notifications(): Processing notifications for {$event} event: " . print_r( $notification_ids, true ) . "\n(only active/applicable notifications are sent)" ); - self::send_email($from, $to, $bcc, $replyTo, $subject, $message, $from_name, $message_format, $attachments); + foreach ( $notification_ids as $notification_id ) { + if ( ! isset( $form['notifications'][ $notification_id ] ) ) { + continue; + } + if ( isset( $form['notifications'][ $notification_id ]['isActive'] ) && ! $form['notifications'][ $notification_id ]['isActive'] ) { + GFCommon::log_debug( "GFCommon::send_notifications(): Notification is inactive, not processing notification (#{$notification_id} - {$form['notifications'][$notification_id]['name']})." ); + continue; + } - return compact("to", "from", "bcc", "replyTo", "subject", "message", "from_name", "message_format", "attachments"); + $notification = $form['notifications'][ $notification_id ]; - } + //check conditional logic when appropriate + if ( $do_conditional_logic && ! GFCommon::evaluate_conditional_logic( rgar( $notification, 'conditionalLogic' ), $form, $lead ) ) { + GFCommon::log_debug( "GFCommon::send_notifications(): Notification conditional logic not met, not processing notification (#{$notification_id} - {$notification['name']})." ); + continue; + } - public static function send_notifications($notification_ids, $form, $lead, $do_conditional_logic = true, $event = "form_submission"){ - if(!is_array($notification_ids)){ - GFCommon::log_debug("No notifications to be sent."); - return; - } + if ( rgar( $notification, 'type' ) == 'user' ) { - GFCommon::log_debug( 'Processing notifications: ' . print_r( $notification_ids, true ) . "\n(only active/applicable notifications are sent)" ); + //Getting user notification from legacy structure (for backwards compatibility) + $legacy_notification = GFCommon::prepare_user_notification( $form, $lead ); + $notification = self::merge_legacy_notification( $notification, $legacy_notification ); + } else if ( rgar( $notification, 'type' ) == 'admin' ) { - foreach($notification_ids as $notification_id){ - if(!isset($form["notifications"][$notification_id])){ - continue; - } - if(isset($form["notifications"][$notification_id]["isActive"]) && ! $form["notifications"][$notification_id]["isActive"]){ - continue; - } + //Getting admin notification from legacy structure (for backwards compatibility) + $legacy_notification = GFCommon::prepare_admin_notification( $form, $lead ); + $notification = self::merge_legacy_notification( $notification, $legacy_notification ); + } - $notification = $form["notifications"][$notification_id]; + //sending notification + self::send_notification( $notification, $form, $lead ); + } - //check conditional logic when appropriate - if($do_conditional_logic && !GFCommon::evaluate_conditional_logic( rgar($notification,"conditionalLogic"), $form, $lead) ){ - continue; - } + } - if(rgar($notification,"type") == "user"){ + public static function send_form_submission_notifications( $form, $lead ) { + GFAPI::send_notifications( $form, $lead ); + } - //Getting user notification from legacy structure (for backwards compatibility) - $legacy_notification = GFCommon::prepare_user_notification($form, $lead); - $notification = self::merge_legacy_notification($notification, $legacy_notification); - } - else if(rgar($notification,"type") == "admin"){ + private static function merge_legacy_notification( $notification, $notification_data ) { - //Getting admin notification from legacy structure (for backwards compatibility) - $legacy_notification = GFCommon::prepare_admin_notification($form, $lead); - $notification = self::merge_legacy_notification($notification, $legacy_notification); - } + $keys = array( 'to', 'from', 'bcc', 'replyTo', 'subject', 'message', 'from_name', 'message_format', 'attachments', 'disableAutoformat' ); + foreach ( $keys as $key ) { + $notification[ $key ] = rgar( $notification_data, $key ); + } + return $notification; + } - //sending notification - self::send_notification($notification, $form, $lead); - } + public static function get_notifications_to_send( $event, $form, $lead ) { + $notifications = self::get_notifications( $event, $form ); + $notifications_to_send = array(); + foreach ( $notifications as $notification ) { + if ( GFCommon::evaluate_conditional_logic( rgar( $notification, 'conditionalLogic' ), $form, $lead ) ) { + $notifications_to_send[] = $notification; + } + } - } + return $notifications_to_send; + } - public static function send_form_submission_notifications($form, $lead){ - $notifications = self::get_notifications_to_send("form_submission", $form, $lead); - $notifications_to_send = array(); + public static function get_notifications( $event, $form ) { + if ( rgempty( 'notifications', $form ) ) { + return array(); + } + $notifications = array(); + foreach ( $form['notifications'] as $notification ) { + if ( rgar( $notification, 'event' ) == $event ) { + $notifications[] = $notification; + } + } + return $notifications; + } - //running through filters that disable form submission notifications - foreach($notifications as $notification){ + public static function has_admin_notification( $form ) { - if(rgar($notification,"type") == "user" && apply_filters("gform_disable_user_notification_{$form["id"]}", apply_filters("gform_disable_user_notification", false, $form, $lead), $form, $lead)){ - //skip user notification if it has been disabled by a hook - continue; - } - else if(rgar($notification,"type") == "admin" && apply_filters("gform_disable_admin_notification_{$form["id"]}", apply_filters("gform_disable_admin_notification", false, $form, $lead), $form, $lead)){ - //skip admin notification if it has been disabled by a hook - continue; - } + return ( ! empty( $form['notification']['to'] ) || ! empty( $form['notification']['routing'] ) ) && ( ! empty( $form['notification']['subject'] ) || ! empty( $form['notification']['message'] ) ); - if(apply_filters("gform_disable_notification_{$form["id"]}", apply_filters("gform_disable_notification", false, $notification, $form, $lead), $notification, $form, $lead)){ - //skip notifications if it has been disabled by a hook - continue; - } + } - $notifications_to_send[] = $notification["id"]; - } + public static function has_user_notification( $form ) { + return ! empty( $form['autoResponder']['toField'] ) && ( ! empty( $form['autoResponder']['subject'] ) || ! empty( $form['autoResponder']['message'] ) ); - self::send_notifications($notifications_to_send, $form, $lead, true, "form_submission"); - } + } - private static function merge_legacy_notification($notification, $notification_data){ + private static function send_email( $from, $to, $bcc, $reply_to, $subject, $message, $from_name = '', $message_format = 'html', $attachments = '' ) { - $keys = array("to", "from", "bcc", "replyTo", "subject", "message", "from_name", "message_format", "attachments", "disableAutoformat"); - foreach($keys as $key) - $notification[$key] = rgar($notification_data,$key); + $to = str_replace( ' ', '', $to ); + $bcc = str_replace( ' ', '', $bcc ); + $error = false; - return $notification; - } + if ( ! GFCommon::is_valid_email( $from ) ) { + $from = get_bloginfo( 'admin_email' ); + } - public static function get_notifications_to_send($action, $form, $lead){ - $notifications = self::get_notifications($action, $form); - $notifications_to_send = array(); - foreach($notifications as $notification){ - if(GFCommon::evaluate_conditional_logic(rgar($notification,"conditionalLogic"), $form, $lead)){ - $notifications_to_send[] = $notification; - } - } + if ( ! GFCommon::is_valid_email_list( $to ) ) { + $error = new WP_Error( 'invalid_to', 'Cannot send email because the TO address is invalid.' ); + } else if ( empty( $subject ) && empty( $message ) ) { + $error = new WP_Error( 'missing_subject_and_message', 'Cannot send email because there is no SUBJECT and no MESSAGE.' ); + } else if ( ! GFCommon::is_valid_email( $from ) ) { + $error = new WP_Error( 'invalid_from', 'Cannot send email because the FROM address is invalid.' ); + } - return $notifications_to_send; - } + if ( is_wp_error( $error ) ) { + GFCommon::log_error( 'GFCommon::send_email(): ' . $error->get_error_message() ); + GFCommon::log_error( print_r( compact( 'to', 'subject', 'message' ), true ) ); + do_action( 'gform_send_email_failed', $error, compact( 'from', 'to', 'bcc', 'reply_to', 'subject', 'message', 'from_name', 'message_format', 'attachments' ) ); - public static function get_notifications($action, $form){ - if(rgempty("notifications", $form)) - return array(); + return; + } - $notifications = array(); - foreach($form["notifications"] as $notification){ - if(rgar($notification, "event") == $action) - $notifications[] = $notification; - } + $content_type = $message_format == 'html' ? 'text/html' : 'text/plain'; + $name = empty( $from_name ) ? $from : $from_name; - return $notifications; - } + $headers = array(); + $headers['From'] = "From: \"" . wp_strip_all_tags($name, true) . "\" <{$from}>"; - public static function has_admin_notification($form){ + if ( GFCommon::is_valid_email_list( $reply_to ) ) { + $headers['Reply-To'] = "Reply-To: {$reply_to}"; + } - return (!empty($form["notification"]["to"]) || !empty($form["notification"]["routing"])) && (!empty($form["notification"]["subject"]) || !empty($form["notification"]["message"])); + if ( GFCommon::is_valid_email_list( $bcc ) ) { + $headers['Bcc'] = "Bcc: $bcc"; + } - } + $headers['Content-type'] = "Content-type: {$content_type}; charset=" . get_option( 'blog_charset' ); + + $abort_email = false; + extract( apply_filters( 'gform_pre_send_email', compact( 'to', 'subject', 'message', 'headers', 'attachments', 'abort_email' ), $message_format ) ); + + $is_success = false; + if ( ! $abort_email ) { + GFCommon::log_debug( 'GFCommon::send_email(): Sending email via wp_mail().' ); + GFCommon::log_debug( print_r( compact( 'to', 'subject', 'message', 'headers', 'attachments', 'abort_email' ), true ) ); + $is_success = wp_mail( $to, $subject, $message, $headers, $attachments ); + GFCommon::log_debug( "GFCommon::send_email(): Result from wp_mail(): {$is_success}" ); + if ( $is_success ) { + GFCommon::log_debug( 'GFCommon::send_email(): Mail was passed from WordPress to the mail server.' ); + } else { + GFCommon::log_error( 'GFCommon::send_email(): The mail message was passed off to WordPress for processing, but WordPress was unable to send the message.' ); + } + } else { + GFCommon::log_debug( 'GFCommon::send_email(): Aborting. The gform_pre_send_email hook was used to set the abort_email parameter to true.' ); + } - public static function has_user_notification($form){ + self::add_emails_sent(); - return !empty($form["autoResponder"]["toField"]) && (!empty($form["autoResponder"]["subject"]) || !empty($form["autoResponder"]["message"])); + do_action( 'gform_after_email', $is_success, $to, $subject, $message, $headers, $attachments, $message_format ); + } - } + public static function add_emails_sent() { - private static function send_email($from, $to, $bcc, $reply_to, $subject, $message, $from_name="", $message_format="html", $attachments=""){ + $count = self::get_emails_sent(); - $to = str_replace( " ", "", $to ); - $bcc = str_replace( " ", "", $bcc ); - $error = false; + update_option( 'gform_email_count', ++$count ); - if( ! GFCommon::is_valid_email( $from ) ) { - $from = get_bloginfo( 'admin_email' ); - } + } - if( ! GFCommon::is_valid_email_list( $to ) ) { - $error = new WP_Error( 'invalid_to', 'Cannot send email because the TO address is invalid.' ); - } else if( empty( $subject ) && empty( $message ) ) { - $error = new WP_Error( 'missing_subject_and_message', 'Cannot send email because there is no SUBJECT and no MESSAGE.' ); - } else if( ! GFCommon::is_valid_email( $from ) ) { - $error = new WP_Error( 'invalid_from', 'Cannot send email because the FROM address is invalid.' ); - } + public static function get_emails_sent() { + $count = get_option( 'gform_email_count' ); - if( is_wp_error( $error ) ) { - GFCommon::log_debug( $error->get_error_message() ); - GFCommon::log_debug( print_r( compact( 'to', 'subject', 'message' ), true ) ); - do_action( 'gform_send_email_failed', $error, compact( 'from', 'to', 'bcc', 'reply_to', 'subject', 'message', 'from_name', 'message_format', 'attachments' ) ); - return; - } + if ( ! $count ) { + $count = 0; + } - $content_type = $message_format == "html" ? "text/html" : "text/plain"; - $name = empty($from_name) ? $from : $from_name; + return $count; + } - $headers = array(); - $headers["From"] = "From: \"" . wp_strip_all_tags($name, true) . "\" <{$from}>"; + public static function get_api_calls() { + $count = get_option( 'gform_api_count' ); - if(GFCommon::is_valid_email($reply_to)) - $headers["Reply-To"] = "Reply-To: {$reply_to}"; + if ( ! $count ) { + $count = 0; + } - if(GFCommon::is_valid_email_list($bcc)) - $headers["Bcc"] = "Bcc: $bcc"; + return $count; + } - $headers["Content-type"] = "Content-type: {$content_type}; charset=" . get_option('blog_charset'); + public static function add_api_call() { - $abort_email = false; - extract(apply_filters("gform_pre_send_email", compact("to", "subject", "message", "headers", "attachments", "abort_email"), $message_format)); + $count = self::get_api_calls(); - $is_success = false; - if(!$abort_email){ - GFCommon::log_debug("Sending email via wp_mail()"); - GFCommon::log_debug(print_r(compact("to", "subject", "message", "headers", "attachments", "abort_email"), true)); - $is_success = wp_mail($to, $subject, $message, $headers, $attachments); - GFCommon::log_debug( "Result from wp_mail(): {$is_success}" ); - if( $is_success ) { - GFCommon::log_debug( 'Mail was passed from WordPress to the mail server.' ); - } else { - GFCommon::log_debug( 'The mail message was passed off to WordPress for processing, but WordPress was unable to send the message.' ); - } + update_option( 'gform_api_count', ++$count ); - } + } - self::add_emails_sent(); + public static function has_post_field( $fields ) { + foreach ( $fields as $field ) { + if ( in_array( $field->type, array( 'post_title', 'post_content', 'post_excerpt', 'post_category', 'post_image', 'post_tags', 'post_custom_field' ) ) ) { + return true; + } + } - do_action("gform_after_email", $is_success, $to, $subject, $message, $headers, $attachments, $message_format); - } + return false; + } - public static function add_emails_sent(){ + public static function has_list_field( $form ) { + return self::has_field_by_type( $form, 'list' ); + } - $count = self::get_emails_sent(); + public static function has_credit_card_field( $form ) { + return self::has_field_by_type( $form, 'creditcard' ); + } - update_option("gform_email_count", ++$count); + private static function has_field_by_type( $form, $type ) { + if ( is_array( $form['fields'] ) ) { + foreach ( $form['fields'] as $field ) { - } + if ( RGFormsModel::get_input_type( $field ) == $type ) { + return true; + } + } + } - public static function get_emails_sent(){ - $count = get_option("gform_email_count"); + return false; + } - if(!$count) - $count = 0; + public static function current_user_can_any( $caps ) { - return $count; - } + if ( ! is_array( $caps ) ) { + $has_cap = current_user_can( $caps ) || current_user_can( 'gform_full_access' ); - public static function get_api_calls(){ - $count = get_option("gform_api_count"); + return $has_cap; + } - if(!$count) - $count = 0; + foreach ( $caps as $cap ) { + if ( current_user_can( $cap ) ) { + return true; + } + } - return $count; - } + $has_full_access = current_user_can( 'gform_full_access' ); - public static function add_api_call(){ + return $has_full_access; + } - $count = self::get_api_calls(); + public static function current_user_can_which( $caps ) { - update_option("gform_api_count", ++$count); + foreach ( $caps as $cap ) { + if ( current_user_can( $cap ) ) { + return $cap; + } + } - } + return ''; + } - public static function has_post_field($fields){ - foreach($fields as $field){ - if(in_array($field["type"], array("post_title", "post_content", "post_excerpt", "post_category", "post_image", "post_tags", "post_custom_field"))) - return true; - } - return false; - } + public static function is_pricing_field( $field_type ) { + return self::is_product_field( $field_type ) || $field_type == 'donation'; + } - public static function has_list_field($form){ - return self::has_field_by_type($form, 'list'); - } + public static function is_product_field( $field_type ) { + return in_array( $field_type, array( 'option', 'quantity', 'product', 'total', 'shipping', 'calculation' ) ); + } - public static function has_credit_card_field($form){ - return self::has_field_by_type($form, 'creditcard'); - } + public static function all_caps() { + return array( + 'gravityforms_edit_forms', + 'gravityforms_delete_forms', + 'gravityforms_create_form', + 'gravityforms_view_entries', + 'gravityforms_edit_entries', + 'gravityforms_delete_entries', + 'gravityforms_view_settings', + 'gravityforms_edit_settings', + 'gravityforms_export_entries', + 'gravityforms_uninstall', + 'gravityforms_view_entry_notes', + 'gravityforms_edit_entry_notes', + 'gravityforms_view_updates', + 'gravityforms_view_addons', + 'gravityforms_preview_forms', + ); + } - private static function has_field_by_type($form, $type) { - if(is_array($form["fields"])){ - foreach($form["fields"] as $field){ + public static function delete_directory( $dir ) { + if ( ! file_exists( $dir ) ) { + return; + } - if(RGFormsModel::get_input_type($field) == $type) - return true; - } - } - return false; - } + if ( $handle = opendir( $dir ) ) { + $array = array(); + while ( false !== ( $file = readdir( $handle ) ) ) { + if ( $file != '.' && $file != '..' ) { + if ( is_dir( $dir . $file ) ) { + if ( ! @rmdir( $dir . $file ) ) { + // Empty directory? Remove it + self::delete_directory( $dir . $file . '/' ); + } // Not empty? Delete the files inside it + } else { + @unlink( $dir . $file ); + } + } + } + closedir( $handle ); + @rmdir( $dir ); + } + } - public static function current_user_can_any($caps){ + public static function get_remote_message() { + return stripslashes( get_option( 'rg_gforms_message' ) ); + } - if(!is_array($caps)){ - $has_cap = current_user_can($caps) || current_user_can("gform_full_access"); - return $has_cap; - } + public static function get_key() { + return get_option( 'rg_gforms_key' ); + } - foreach($caps as $cap){ - if(current_user_can($cap)){ - return true; - } - } + public static function has_update( $use_cache = true ) { + $version_info = GFCommon::get_version_info( $use_cache ); + $version = rgar( $version_info, 'version' ); - $has_full_access = current_user_can("gform_full_access"); - return $has_full_access; - } + return empty( $version ) ? false : version_compare( GFCommon::$version, $version, '<' ); + } - public static function current_user_can_which($caps){ + public static function get_key_info( $key ) { - foreach($caps as $cap){ - if(current_user_can($cap)) - return $cap; - } + $options = array( 'method' => 'POST', 'timeout' => 3 ); + $options['headers'] = array( + 'Content-Type' => 'application/x-www-form-urlencoded; charset=' . get_option( 'blog_charset' ), + 'User-Agent' => 'WordPress/' . get_bloginfo( 'version' ), + 'Referer' => get_bloginfo( 'url' ) + ); - return ""; - } + $raw_response = self::post_to_manager( 'api.php', "op=get_key&key={$key}", $options ); - public static function is_pricing_field($field_type){ - return self::is_product_field($field_type) || $field_type == "donation"; - } + if ( is_wp_error( $raw_response ) || $raw_response['response']['code'] != 200 ) { + return array(); + } - public static function is_product_field($field_type){ - return in_array($field_type, array("option", "quantity", "product", "total", "shipping", "calculation")); - } + $key_info = unserialize( trim( $raw_response['body'] ) ); - public static function all_caps(){ - return array( 'gravityforms_edit_forms', - 'gravityforms_delete_forms', - 'gravityforms_create_form', - 'gravityforms_view_entries', - 'gravityforms_edit_entries', - 'gravityforms_delete_entries', - 'gravityforms_view_settings', - 'gravityforms_edit_settings', - 'gravityforms_export_entries', - 'gravityforms_uninstall', - 'gravityforms_view_entry_notes', - 'gravityforms_edit_entry_notes', - 'gravityforms_view_updates', - 'gravityforms_view_addons', - 'gravityforms_preview_forms' - ); - } + return $key_info ? $key_info : array(); + } - public static function delete_directory($dir) { - if(!file_exists($dir)) - return; + public static function get_version_info( $cache = true ) { - if ($handle = opendir($dir)){ - $array = array(); - while (false !== ($file = readdir($handle))) { - if ($file != "." && $file != "..") { - if(is_dir($dir.$file)){ - if(!@rmdir($dir.$file)) // Empty directory? Remove it - self::delete_directory($dir.$file.'/'); // Not empty? Delete the files inside it - } - else{ - @unlink($dir.$file); - } - } - } - closedir($handle); - @rmdir($dir); - } - } + $raw_response = get_transient( 'gform_update_info' ); + if ( ! $cache ) { + $raw_response = null; + } - public static function get_remote_message(){ - return stripslashes(get_option("rg_gforms_message")); - } + if ( ! $raw_response ) { + //Getting version number + $options = array( 'method' => 'POST', 'timeout' => 20 ); + $options['headers'] = array( + 'Content-Type' => 'application/x-www-form-urlencoded; charset=' . get_option( 'blog_charset' ), + 'User-Agent' => 'WordPress/' . get_bloginfo( 'version' ), + 'Referer' => get_bloginfo( 'url' ) + ); + $options['body'] = self::get_remote_post_params(); + $options['timeout'] = 15; - public static function get_key(){ - return get_option("rg_gforms_key"); - } + $nocache = $cache ? '' : 'nocache=1'; //disabling server side caching - public static function has_update($use_cache=true){ - $version_info = GFCommon::get_version_info($use_cache); - $version = rgar($version_info, "version"); - return empty($version) ? false : version_compare(GFCommon::$version, $version, '<'); - } + $raw_response = self::post_to_manager( 'version.php', $nocache, $options ); - public static function get_key_info($key){ + //caching responses. + set_transient( 'gform_update_info', $raw_response, 86400 ); //caching for 24 hours + } - $options = array('method' => 'POST', 'timeout' => 3); - $options['headers'] = array( - 'Content-Type' => 'application/x-www-form-urlencoded; charset=' . get_option('blog_charset'), - 'User-Agent' => 'WordPress/' . get_bloginfo("version"), - 'Referer' => get_bloginfo("url") - ); - $raw_response = self::post_to_manager("api.php", "op=get_key&key={$key}", $options); - if ( is_wp_error( $raw_response ) || $raw_response['response']['code'] != 200) - return array(); + if ( is_wp_error( $raw_response ) || rgars( $raw_response, 'response/code' ) != 200 ) { - $key_info = unserialize(trim($raw_response["body"])); - return $key_info ? $key_info : array(); - } + return array( 'is_valid_key' => '1', 'version' => '', 'url' => '', 'is_error' => '1' ); + } - public static function get_version_info($cache=true){ + $version_info = json_decode( $raw_response['body'], true ); - $raw_response = get_transient("gform_update_info"); - if(!$cache) - $raw_response = null; + if ( empty( $version_info ) ) { + return array( 'is_valid_key' => '1', 'version' => '', 'url' => '', 'is_error' => '1' ); + } - if(!$raw_response){ - //Getting version number - $options = array('method' => 'POST', 'timeout' => 20); - $options['headers'] = array( - 'Content-Type' => 'application/x-www-form-urlencoded; charset=' . get_option('blog_charset'), - 'User-Agent' => 'WordPress/' . get_bloginfo("version"), - 'Referer' => get_bloginfo("url") - ); - $options['body'] = self::get_remote_post_params(); - $options['timeout'] = 15; + return $version_info; + } - $nocache = $cache ? "" : "nocache=1"; //disabling server side caching + public static function get_remote_request_params() { + global $wpdb; - $raw_response = self::post_to_manager("version.php", $nocache, $options); + return sprintf( 'of=GravityForms&key=%s&v=%s&wp=%s&php=%s&mysql=%s&version=2', urlencode( self::get_key() ), urlencode( self::$version ), urlencode( get_bloginfo( 'version' ) ), urlencode( phpversion() ), urlencode( $wpdb->db_version() ) ); + } - //caching responses. - set_transient("gform_update_info", $raw_response, 86400); //caching for 24 hours - } + public static function get_remote_post_params() { + global $wpdb; - if ( is_wp_error( $raw_response ) || rgars($raw_response, 'response/code') != 200 ) { - return array("is_valid_key" => "1", "version" => "", "url" => "", "is_error" => "1"); + if ( ! function_exists( 'get_plugins' ) ) { + require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); } + $plugin_list = get_plugins(); + $site_url = get_bloginfo( 'url' ); + $plugins = array(); - $version_info = json_decode($raw_response['body'], true); - - if( empty($version_info) ) - return array("is_valid_key" => "1", "version" => "", "url" => "", "is_error" => "1"); - - return $version_info; - } + $active_plugins = get_option( 'active_plugins' ); - public static function get_remote_request_params(){ - global $wpdb; + foreach ( $plugin_list as $key => $plugin ) { + $is_active = in_array( $key, $active_plugins ); - return sprintf("of=GravityForms&key=%s&v=%s&wp=%s&php=%s&mysql=%s&version=2", urlencode(self::get_key()), urlencode(self::$version), urlencode(get_bloginfo("version")), urlencode(phpversion()), urlencode($wpdb->db_version())); - } + //filter for only gravityforms ones, may get some others if using our naming convention + if ( strpos( strtolower( $plugin['Title'] ), 'gravity forms' ) !== false ) { + $name = substr( $key, 0, strpos( $key, '/' ) ); + $plugins[] = array( 'name' => $name, 'version' => $plugin['Version'], 'is_active' => $is_active ); + } + } + $plugins = json_encode( $plugins ); + + //get theme info + $theme = wp_get_theme(); + $theme_name = $theme->get( 'Name' ); + $theme_uri = $theme->get( 'ThemeURI' ); + $theme_version = $theme->get( 'Version' ); + $theme_author = $theme->get( 'Author' ); + $theme_author_uri = $theme->get( 'AuthorURI' ); + + $form_counts = GFFormsModel::get_form_count(); + $active_count = $form_counts['active']; + $inactive_count = $form_counts['inactive']; + $fc = abs( $active_count ) + abs( $inactive_count ); + $entry_count = GFFormsModel::get_lead_count_all_forms( 'active' ); + $im = is_multisite(); + + $post = array( 'of' => 'gravityforms', 'key' => self::get_key(), 'v' => self::$version, 'wp' => get_bloginfo( 'version' ), 'php' => phpversion(), 'mysql' => $wpdb->db_version(), 'version' => '2', 'plugins' => $plugins, 'tn' => $theme_name, 'tu' => $theme_uri, 'tv' => $theme_version, 'ta' => $theme_author, 'tau' => $theme_author_uri, 'im' => $im, 'fc' => $fc, 'ec' => $entry_count, 'emc' => self::get_emails_sent(), 'api' => self::get_api_calls() ); + + return $post; + } - public static function get_remote_post_params(){ - global $wpdb; + public static function ensure_wp_version() { + if ( ! GF_SUPPORTED_WP_VERSION ) { + echo "
    " . sprintf( __( 'Gravity Forms require WordPress %s or greater. You must upgrade WordPress in order to use Gravity Forms' , 'gravityforms' ), GF_MIN_WP_VERSION ) . '
    '; - if(!function_exists('get_plugins')){ - require_once(ABSPATH . 'wp-admin/includes/plugin.php'); - } - $plugin_list = get_plugins(); - $site_url = get_bloginfo("url"); - $plugins = array(); + return false; + } - $active_plugins = get_option( 'active_plugins' ); + return true; + } - foreach ($plugin_list as $key => $plugin) { - $is_active = in_array($key, $active_plugins); + public static function check_update( $option, $cache = true ) { - //filter for only gravityforms ones, may get some others if using our naming convention - if (strpos(strtolower($plugin["Title"]), "gravity forms") !== false){ - $name = substr($key, 0, strpos($key,"/")); - $plugins[] = array("name" => $name, "version" => $plugin["Version"], "is_active" => $is_active); - } - } - $plugins = json_encode($plugins); - - //get theme info - $theme = wp_get_theme(); - $theme_name = $theme->get("Name"); - $theme_uri = $theme->get("ThemeURI"); - $theme_version = $theme->get("Version"); - $theme_author = $theme->get("Author"); - $theme_author_uri = $theme->get("AuthorURI"); - - $form_counts = GFFormsModel::get_form_count(); - $active_count = $form_counts["active"]; - $inactive_count = $form_counts["inactive"]; - $fc = abs($active_count) + abs($inactive_count); - $entry_count = GFFormsModel::get_lead_count_all_forms("active"); - $im = is_multisite(); - - $post = array("of" => "gravityforms", "key" => self::get_key(), "v" => self::$version, "wp" => get_bloginfo("version"), "php" => phpversion(), "mysql" => $wpdb->db_version(), "version" => "2", "plugins" => $plugins, "tn" => $theme_name, "tu" => $theme_uri, "tv" => $theme_version, "ta" => $theme_author, "tau" => $theme_author_uri, "im" => $im, "fc" => $fc, "ec" => $entry_count, "emc" => self::get_emails_sent(), "api" => self::get_api_calls()); - return $post; - } + if ( ! is_object( $option ) ) { + return $option; + } - public static function ensure_wp_version(){ - if(!GF_SUPPORTED_WP_VERSION){ - echo "
    " . sprintf(__("Gravity Forms require WordPress %s or greater. You must upgrade WordPress in order to use Gravity Forms", "gravityforms"), GF_MIN_WP_VERSION) . "
    "; - return false; - } - return true; - } + $version_info = self::get_version_info( $cache ); - public static function check_update($option, $cache=true){ + if ( ! $version_info ) { + return $option; + } - if(!is_object($option)) - return $option; + $plugin_path = 'gravityforms/gravityforms.php'; + if ( empty( $option->response[ $plugin_path ] ) ) { + $option->response[ $plugin_path ] = new stdClass(); + } - $version_info = self::get_version_info($cache); + $version = rgar( $version_info, 'version' ); + //Empty response means that the key is invalid. Do not queue for upgrade + if ( ! rgar( $version_info, 'is_valid_key' ) || version_compare( GFCommon::$version, $version, '>=' ) ) { + unset( $option->response[ $plugin_path ] ); + } else { + $url = rgar( $version_info, 'url' ); + $option->response[ $plugin_path ]->url = 'http://www.gravityforms.com'; + $option->response[ $plugin_path ]->slug = 'gravityforms'; + $option->response[ $plugin_path ]->plugin = $plugin_path; + $option->response[ $plugin_path ]->package = str_replace( '{KEY}', GFCommon::get_key(), $url ); + $option->response[ $plugin_path ]->new_version = $version; + $option->response[ $plugin_path ]->id = '0'; + } - if (!$version_info) - return $option; + return $option; - $plugin_path = "gravityforms/gravityforms.php"; - if(empty($option->response[$plugin_path])) - $option->response[$plugin_path] = new stdClass(); + } - $version = rgar($version_info, "version"); - //Empty response means that the key is invalid. Do not queue for upgrade - if(!rgar($version_info, "is_valid_key") || version_compare(GFCommon::$version, $version, '>=')){ - unset($option->response[$plugin_path]); - } - else{ - $url = rgar($version_info, "url"); - $option->response[$plugin_path]->url = "http://www.gravityforms.com"; - $option->response[$plugin_path]->slug = "gravityforms"; - $option->response[$plugin_path]->package = str_replace("{KEY}", GFCommon::get_key(), $url); - $option->response[$plugin_path]->new_version = $version; - $option->response[$plugin_path]->id = "0"; - } + public static function cache_remote_message() { + //Getting version number + $key = GFCommon::get_key(); + $body = "key=$key"; + $options = array( 'method' => 'POST', 'timeout' => 3, 'body' => $body ); + $options['headers'] = array( + 'Content-Type' => 'application/x-www-form-urlencoded; charset=' . get_option( 'blog_charset' ), + 'Content-Length' => strlen( $body ), + 'User-Agent' => 'WordPress/' . get_bloginfo( 'version' ), + 'Referer' => get_bloginfo( 'url' ) + ); + + $raw_response = self::post_to_manager( 'message.php', GFCommon::get_remote_request_params(), $options ); + + if ( is_wp_error( $raw_response ) || 200 != $raw_response['response']['code'] ) { + $message = ''; + } else { + $message = $raw_response['body']; + } - return $option; + //validating that message is a valid Gravity Form message. If message is invalid, don't display anything + if ( substr( $message, 0, 10 ) != '' ) { + $message = ''; + } - } + update_option( 'rg_gforms_message', $message ); + } - public static function cache_remote_message(){ - //Getting version number - $key = GFCommon::get_key(); - $body = "key=$key"; - $options = array('method' => 'POST', 'timeout' => 3, 'body' => $body); - $options['headers'] = array( - 'Content-Type' => 'application/x-www-form-urlencoded; charset=' . get_option('blog_charset'), - 'Content-Length' => strlen($body), - 'User-Agent' => 'WordPress/' . get_bloginfo("version"), - 'Referer' => get_bloginfo("url") - ); - - $raw_response = self::post_to_manager("message.php", GFCommon::get_remote_request_params(), $options); - - if ( is_wp_error( $raw_response ) || 200 != $raw_response['response']['code'] ) - $message = ""; - else - $message = $raw_response['body']; - - //validating that message is a valid Gravity Form message. If message is invalid, don't display anything - if(substr($message, 0, 10) != "") - $message = ""; - - update_option("rg_gforms_message", $message); - } + public static function post_to_manager( $file, $query, $options ) { - public static function post_to_manager($file, $query, $options){ + $request_url = GRAVITY_MANAGER_URL . '/' . $file . '?' . $query; + $raw_response = wp_remote_post( $request_url, $options ); - $request_url = GRAVITY_MANAGER_URL . "/" . $file . "?" . $query; - $raw_response = wp_remote_post($request_url, $options); + if ( is_wp_error( $raw_response ) || 200 != $raw_response['response']['code'] ) { + $request_url = GRAVITY_MANAGER_PROXY_URL . '/proxy.php?f=' . $file . '&' . $query; + $raw_response = wp_remote_post( $request_url, $options ); + } - if ( is_wp_error( $raw_response ) || 200 != $raw_response['response']['code'] ){ - $request_url = GRAVITY_MANAGER_PROXY_URL . "/proxy.php?f=" . $file . "&" . $query; - $raw_response = wp_remote_post($request_url, $options); - } + return $raw_response; + } - return $raw_response; - } + public static function get_local_timestamp( $timestamp = null ) { + if ( $timestamp == null ) { + $timestamp = time(); + } - public static function get_local_timestamp($timestamp = null){ - if($timestamp == null) - $timestamp = time(); + return $timestamp + ( get_option( 'gmt_offset' ) * 3600 ); + } - return $timestamp + (get_option( 'gmt_offset' ) * 3600 ); - } + public static function get_gmt_timestamp( $local_timestamp ) { + return $local_timestamp - ( get_option( 'gmt_offset' ) * 3600 ); + } - public static function get_gmt_timestamp($local_timestamp){ - return $local_timestamp - (get_option( 'gmt_offset' ) * 3600 ); - } + public static function format_date( $gmt_datetime, $is_human = true, $date_format = '', $include_time = true ) { + if ( empty( $gmt_datetime ) ) { + return ''; + } - public static function format_date($gmt_datetime, $is_human = true, $date_format="", $include_time=true){ - if(empty($gmt_datetime)) - return ""; + //adjusting date to local configured Time Zone + $lead_gmt_time = mysql2date( 'G', $gmt_datetime ); + $lead_local_time = self::get_local_timestamp( $lead_gmt_time ); - //adjusting date to local configured Time Zone - $lead_gmt_time = mysql2date("G", $gmt_datetime); - $lead_local_time = self::get_local_timestamp($lead_gmt_time); + if ( empty( $date_format ) ) { + $date_format = get_option( 'date_format' ); + } - if(empty($date_format)) - $date_format = get_option('date_format'); + if ( $is_human ) { + $time_diff = time() - $lead_gmt_time; - if($is_human){ - $time_diff = time() - $lead_gmt_time; + if ( $time_diff > 0 && $time_diff < 24 * 60 * 60 ) { + $date_display = sprintf( __( '%s ago', 'gravityforms' ), human_time_diff( $lead_gmt_time ) ); + } else { + $date_display = $include_time ? sprintf( __( '%1$s at %2$s', 'gravityforms' ), date_i18n( $date_format, $lead_local_time, true ), date_i18n( get_option( 'time_format' ), $lead_local_time, true ) ) : date_i18n( $date_format, $lead_local_time, true ); + } + } else { + $date_display = $include_time ? sprintf( __( '%1$s at %2$s', 'gravityforms' ), date_i18n( $date_format, $lead_local_time, true ), date_i18n( get_option( 'time_format' ), $lead_local_time, true ) ) : date_i18n( $date_format, $lead_local_time, true ); + } - if ($time_diff > 0 && $time_diff < 24*60*60) - $date_display = sprintf(__('%s ago', 'gravityforms'), human_time_diff($lead_gmt_time)); - else - $date_display = $include_time ? sprintf(__('%1$s at %2$s', 'gravityforms'), date_i18n($date_format, $lead_local_time, true), date_i18n(get_option('time_format'), $lead_local_time, true)) : date_i18n($date_format, $lead_local_time, true); - } - else{ - $date_display = $include_time ? sprintf(__('%1$s at %2$s', 'gravityforms'), date_i18n($date_format, $lead_local_time, true), date_i18n(get_option('time_format'), $lead_local_time, true)) : date_i18n($date_format, $lead_local_time, true); - } + return $date_display; + } - return $date_display; - } + public static function get_selection_value( $value ) { + $ary = explode( '|', $value ); + $val = $ary[0]; - public static function get_selection_value($value){ - $ary = explode("|", $value); - $val = $ary[0]; - return $val; - } + return $val; + } - public static function selection_display($value, $field, $currency="", $use_text=false){ - if (is_array($value)){ - return ""; - } + public static function selection_display( $value, $field, $currency = '', $use_text = false ) { + if ( is_array( $value ) ) { + return ''; + } - if ( isset( $field['enablePrice'] ) && $field['enablePrice'] ) { + if ( $field !== null && $field->enablePrice ) { $ary = explode( '|', $value ); $val = $ary[0]; $price = count( $ary ) > 1 ? $ary[1] : ''; @@ -2055,3933 +2057,1990 @@ public static function selection_display($value, $field, $currency="", $use_text $price = ''; } - if($use_text) - $val = RGFormsModel::get_choice_text($field, $val); - - if(!empty($price)) - return "$val (" . self::to_money($price, $currency) . ")"; - else - return $val; - } + if ( $use_text ) { + $val = RGFormsModel::get_choice_text( $field, $val ); + } - public static function date_display($value, $format = "mdy"){ - $date = self::parse_date($value, $format); - if(empty($date)) - return $value; - - list($position, $separator) = rgexplode("_", $format, 2); - switch($separator){ - case "dash" : - $separator = "-"; - break; - case "dot" : - $separator = "."; - break; - default : - $separator = "/"; - break; - } + if ( ! empty( $price ) ) { + return "$val (" . self::to_money( $price, $currency ) . ')'; + } else { + return $val; + } + } - switch($position){ - case "ymd" : - return $date["year"] . $separator . $date["month"] . $separator . $date["day"]; - break; + public static function date_display( $value, $format = 'mdy' ) { + $date = self::parse_date( $value, $format ); + if ( empty( $date ) ) { + return $value; + } - case "dmy" : - return $date["day"] . $separator . $date["month"] . $separator . $date["year"]; - break; - - default : - return $date["month"] . $separator . $date["day"] . $separator . $date["year"]; - break; - - } - } - - public static function parse_date($date, $format="mdy"){ - $date_info = array(); - - $position = substr($format, 0, 3); - - if(is_array($date)){ - - switch($position){ - case "mdy" : - $date_info["month"] = rgar($date, 0); - $date_info["day"] = rgar($date, 1); - $date_info["year"] = rgar($date, 2); - break; - - case "dmy" : - $date_info["day"] = rgar($date, 0); - $date_info["month"] = rgar($date, 1); - $date_info["year"] = rgar($date, 2); - break; - - case "ymd" : - $date_info["year"] = rgar($date, 0); - $date_info["month"] = rgar($date, 1); - $date_info["day"] = rgar($date, 2); - break; - } - return $date_info; - } - - $date = preg_replace("|[/\.]|", "-", $date); - if(preg_match('/^(\d{1,4})-(\d{1,2})-(\d{1,4})$/', $date, $matches)){ - - if(strlen($matches[1]) == 4){ - //format yyyy-mm-dd - $date_info["year"] = $matches[1]; - $date_info["month"] = $matches[2]; - $date_info["day"] = $matches[3]; - } - else if ($position == "mdy"){ - //format mm-dd-yyyy - $date_info["month"] = $matches[1]; - $date_info["day"] = $matches[2]; - $date_info["year"] = $matches[3]; - } - else{ - //format dd-mm-yyyy - $date_info["day"] = $matches[1]; - $date_info["month"] = $matches[2]; - $date_info["year"] = $matches[3]; - } - } - - return $date_info; - } - - - public static function truncate_url($url){ - $truncated_url = basename($url); - if(empty($truncated_url)) - $truncated_url = dirname($url); - - $ary = explode("?", $truncated_url); - - return $ary[0]; - } - - public static function get_tabindex(){ - return GFCommon::$tab_index > 0 ? "tabindex='" . GFCommon::$tab_index++ . "'" : ""; - } - - public static function get_checkbox_choices($field, $value, $disabled_text){ - $choices = ""; - - if(is_array($field["choices"])){ - $choice_number = 1; - $count = 1; - foreach($field["choices"] as $choice){ - if($choice_number % 10 == 0) //hack to skip numbers ending in 0. so that 5.1 doesn't conflict with 5.10 - $choice_number++; - - $input_id = $field["id"] . '.' . $choice_number; - $id = $field["id"] . '_' . $choice_number++; - - if(empty($_POST) && rgar($choice,"isSelected")){ - $checked = "checked='checked'"; - } - else if(is_array($value) && RGFormsModel::choice_value_match($field, $choice, rgget($input_id, $value))){ - $checked = "checked='checked'"; - } - else if(!is_array($value) && RGFormsModel::choice_value_match($field, $choice, $value)){ - $checked = "checked='checked'"; - } - else{ - $checked = ""; - } - - $logic_event = self::get_logic_event($field, "click"); - - $tabindex = self::get_tabindex(); - $choice_value = $choice["value"]; - if(rgget("enablePrice", $field)) - $choice_value .= "|" . GFCommon::to_number(rgar($choice,"price")); - - $choices.= sprintf("
  • ", $input_id, esc_attr($choice_value), $checked, $id, $disabled_text, $id, $id, $choice["text"]); - - if(IS_ADMIN && RG_CURRENT_VIEW != "entry" && $count >=5) - break; - - $count++; - } - - $total = sizeof($field["choices"]); - if($count < $total) - $choices .= "
  • " . sprintf(__("%d of %d items shown. Edit field to view all", "gravityforms"), $count, $total) . "
  • "; - } - - return apply_filters("gform_field_choices_" . rgget("formId", $field), apply_filters("gform_field_choices", $choices, $field), $field); - - } - - public static function get_radio_choices($field, $value="", $disabled_text){ - $choices = ""; - - if(is_array($field["choices"])){ - $choice_id = 0; - - // add "other" choice to choices if enabled - if(rgar($field, 'enableOtherChoice')) { - $other_default_value = GFCommon::get_other_choice_value(); - $field["choices"][] = array('text' => $other_default_value, 'value' => 'gf_other_choice', 'isSelected' => false, 'isOtherChoice' => true); - } + list( $position, $separator ) = rgexplode( '_', $format, 2 ); + switch ( $separator ) { + case 'dash' : + $separator = '-'; + break; + case 'dot' : + $separator = '.'; + break; + default : + $separator = '/'; + break; + } - $logic_event = self::get_logic_event($field, "click"); - $count = 1; + switch ( $position ) { + case 'year' : + case 'month' : + case 'day' : + return $date[ $position ]; - foreach($field["choices"] as $choice){ - $id = $field["id"] . '_' . $choice_id++; + case 'ymd' : + return $date['year'] . $separator . $date['month'] . $separator . $date['day']; + break; - $field_value = !empty($choice["value"]) || rgar($field, "enableChoiceValue") ? $choice["value"] : $choice["text"]; + case 'dmy' : + return $date['day'] . $separator . $date['month'] . $separator . $date['year']; + break; - if(rgget("enablePrice", $field)) - $field_value .= "|" . GFCommon::to_number(rgar($choice,"price")); + default : + return $date['month'] . $separator . $date['day'] . $separator . $date['year']; + break; - if(rgblank($value) && RG_CURRENT_VIEW != "entry"){ - $checked = rgar($choice,"isSelected") ? "checked='checked'" : ""; - } - else { - $checked = RGFormsModel::choice_value_match($field, $choice, $value) ? "checked='checked'" : ""; - } + } + } - $tabindex = self::get_tabindex(); - $label = sprintf("", $id, $id, $choice["text"]); - $input_focus = ''; + public static function parse_date( $date, $format = 'mdy' ) { + $date_info = array(); - // handle "other" choice - if(rgar($choice, 'isOtherChoice')) { + $position = substr( $format, 0, 3 ); - $onfocus = !IS_ADMIN ? 'jQuery(this).prev("input").attr("checked", true); if(jQuery(this).val() == "' . $other_default_value . '") { jQuery(this).val(""); }' : ''; - $onblur = !IS_ADMIN ? 'if(jQuery(this).val().replace(" ", "") == "") { jQuery(this).val("' . $other_default_value . '"); }' : ''; - $onkeyup = self::get_logic_event($field, "keyup"); + if ( is_array( $date ) ) { - $input_focus = !IS_ADMIN ? "onfocus=\"jQuery(this).next('input').focus();\"" : ""; - $value_exists = RGFormsModel::choices_value_match($field, $field["choices"], $value); + switch ( $position ) { + case 'mdy' : + $date_info['month'] = rgar( $date, 0 ); + $date_info['day'] = rgar( $date, 1 ); + $date_info['year'] = rgar( $date, 2 ); + break; - if($value == 'gf_other_choice' && rgpost("input_{$field["id"]}_other")){ - $other_value = rgpost("input_{$field["id"]}_other"); - } else if(!$value_exists && !empty($value)){ - $other_value = $value; - $value = 'gf_other_choice'; - $checked = "checked='checked'"; - } else { - $other_value = $other_default_value; - } - $label = ""; - } + case 'dmy' : + $date_info['day'] = rgar( $date, 0 ); + $date_info['month'] = rgar( $date, 1 ); + $date_info['year'] = rgar( $date, 2 ); + break; - $choices .= sprintf("
  • %s
  • ", $field["id"], esc_attr($field_value), $checked, $id, $disabled_text, $input_focus, $label); + case 'ymd' : + $date_info['year'] = rgar( $date, 0 ); + $date_info['month'] = rgar( $date, 1 ); + $date_info['day'] = rgar( $date, 2 ); + break; + } + return $date_info; + } - if(IS_ADMIN && RG_CURRENT_VIEW != "entry" && $count >=5) - break; + $date = preg_replace( "|[/\.]|", '-', $date ); + if ( preg_match( '/^(\d{1,4})-(\d{1,2})-(\d{1,4})$/', $date, $matches ) ) { + + if ( strlen( $matches[1] ) == 4 ) { + //format yyyy-mm-dd + $date_info['year'] = $matches[1]; + $date_info['month'] = $matches[2]; + $date_info['day'] = $matches[3]; + } else if ( $position == 'mdy' ) { + //format mm-dd-yyyy + $date_info['month'] = $matches[1]; + $date_info['day'] = $matches[2]; + $date_info['year'] = $matches[3]; + } else { + //format dd-mm-yyyy + $date_info['day'] = $matches[1]; + $date_info['month'] = $matches[2]; + $date_info['year'] = $matches[3]; + } + } - $count++; - } + return $date_info; + } - $total = sizeof($field["choices"]); - if($count < $total) - $choices .= "
  • " . sprintf(__("%d of %d items shown. Edit field to view all", "gravityforms"), $count, $total) . "
  • "; - } - return apply_filters("gform_field_choices_" . rgget("formId", $field), apply_filters("gform_field_choices", $choices, $field), $field); - } + public static function truncate_url( $url ) { + $truncated_url = basename( $url ); + if ( empty( $truncated_url ) ) { + $truncated_url = dirname( $url ); + } - public static function get_field_type_title($type){ - switch($type){ - case "text" : - return __("Single Line Text", "gravityforms"); - case "textarea" : - return __("Paragraph Text", "gravityforms"); - case "select" : - return __("Drop Down", "gravityforms"); - case "multiselect" : - return __("Multi Select", "gravityforms"); - case "number" : - return __("Number", "gravityforms"); - case "checkbox" : - return __("Checkboxes", "gravityforms"); - case "radio" : - return __("Radio Buttons", "gravityforms"); - case "hidden" : - return __("Hidden", "gravityforms"); - case "html" : - return __("HTML", "gravityforms"); - case "section" : - return __("Section Break", "gravityforms"); - case "page" : - return __("Page Break", "gravityforms"); - case "name" : - return __("Name", "gravityforms"); - case "date" : - return __("Date", "gravityforms"); - case "time" : - return __("Time", "gravityforms"); - case "phone" : - return __("Phone", "gravityforms"); - case "address" : - return __("Address", "gravityforms"); - case "website" : - return __("Website", "gravityforms"); - case "email" : - return __("Email", "gravityforms"); - case "password" : - return __("Password", "gravityforms"); - case "fileupload" : - return __("File Upload", "gravityforms"); - case "captcha" : - return __("CAPTCHA", "gravityforms"); - case "list" : - return __("List", "gravityforms"); - case "creditcard" : - return __("Credit Card", "gravityforms"); - case "post_title" : - return __("Title", "gravityforms"); - case "post_content" : - return __("Body", "gravityforms"); - case "post_excerpt" : - return __("Excerpt", "gravityforms"); - case "post_tags" : - return __("Tags", "gravityforms"); - case "post_category" : - return __("Category", "gravityforms"); - case "post_image" : - return __("Image", "gravityforms"); - case "post_custom_field" : - return __("Custom Field", "gravityforms"); - case "product" : - return __("Product", "gravityforms"); - case "quantity" : - return __("Quantity", "gravityforms"); - case "option" : - return __("Option", "gravityforms"); - case "shipping" : - return __("Shipping", "gravityforms"); - case "total" : - return __("Total", "gravityforms"); - - default : - return apply_filters("gform_field_type_title", $type, $type); - } - } + $ary = explode( '?', $truncated_url ); - public static function get_select_choices($field, $value=""){ - $choices = ""; - - if(RG_CURRENT_VIEW == "entry" && empty($value)) - $choices .= ""; - - if(is_array(rgar($field, "choices"))){ - foreach($field["choices"] as $choice){ - - //needed for users upgrading from 1.0 - $field_value = !empty($choice["value"]) || rgget("enableChoiceValue", $field) || $field['type'] == 'post_category' ? $choice["value"] : $choice["text"]; - if(rgget("enablePrice", $field)) - $field_value .= "|" . GFCommon::to_number(rgar($choice,"price")); - - if(rgblank($value) && RG_CURRENT_VIEW != "entry"){ - $selected = rgar($choice,"isSelected") ? "selected='selected'" : ""; - } - else{ - if(is_array($value)){ - $is_match = false; - foreach($value as $item){ - if(RGFormsModel::choice_value_match($field, $choice, $item)){ - $is_match = true; - break; - } - } - $selected = $is_match ? "selected='selected'" : ""; - } - else{ - $selected = RGFormsModel::choice_value_match($field, $choice, $value) ? "selected='selected'" : ""; - } - } - - $choices.= sprintf("", esc_attr($field_value), $selected, esc_html($choice["text"])); - } - } - return $choices; - } + return $ary[0]; + } - public static function is_section_empty( $section_field, $form, $entry ) { + public static function get_field_placeholder_attribute( $field ) { - $cache_key = "GFCommon::is_section_empty_{$form['id']}_{$section_field['id']}"; - $value = GFCache::get( $cache_key ); + $placeholder_value = GFCommon::replace_variables_prepopulate( $field->placeholder ); - if( $value !== false ) { - return $value == true; - } + return ! empty( $placeholder_value ) ? sprintf( "placeholder='%s'", $placeholder_value ) : ''; + } - $fields = self::get_section_fields( $form, $section_field['id'] ); - if( ! is_array( $fields ) ) { - GFCache::set( $cache_key, 1 ); - return true; - } + public static function get_input_placeholder_attribute( $input ) { - foreach( $fields as $field ) { + $placeholder_value = self::get_input_placeholder_value( $input ); - $value = GFFormsModel::get_lead_field_value( $entry, $field ); - $value = GFCommon::get_lead_field_display( $field, $value, rgar( $entry, 'currency' ) ); + return ! empty( $placeholder_value ) ? sprintf( "placeholder='%s'", $placeholder_value ) : ''; + } - if( rgblank( $value ) ) { - continue; - } + public static function get_input_placeholder_value( $input ) { - // most fields are displayed in the section by default, exceptions are handled below - $is_field_displayed_in_section = true; + $placeholder = rgar( $input, 'placeholder' ); - // by default, product fields are not displayed in their containing section (displayed in a product summary table) - // if the filter is used to disable this, product fields are displayed in the section like other fields - if( self::is_product_field( $field['type'] ) ) { - $display_product_summary = apply_filters( 'gform_display_product_summary', true, $field, $form, $entry ); - $is_field_displayed_in_section = ! $display_product_summary; - } + return empty( $placeholder ) ? '' : GFCommon::replace_variables_prepopulate( $placeholder ); + } - if( $is_field_displayed_in_section ) { - GFCache::set( $cache_key, 0 ); - return false; - } + public static function get_tabindex() { + return GFCommon::$tab_index > 0 ? "tabindex='" . GFCommon::$tab_index ++ . "'" : ''; + } - } + /** + * @deprecated + * + * @param GF_Field_Checkbox $field + * @param $value + * @param $disabled_text + * + * @return mixed + */ + public static function get_checkbox_choices( $field, $value, $disabled_text ) { + _deprecated_function( 'get_checkbox_choices', '1.9', 'GF_Field_Checkbox::get_checkbox_choices' ); + + return $field->get_checkbox_choices( $value, $disabled_text ); + } - GFCache::set( $cache_key, 1 ); + /** + * @deprecated + * + * @param GF_Field_Radio $field + * @param string $value + * @param $disabled_text + * + * @return mixed + */ + public static function get_radio_choices( $field, $value = '', $disabled_text ) { + _deprecated_function( 'get_radio_choices', '1.9', 'GF_Field_Checkbox::get_radio_choices' ); + + return $field->get_radio_choices( $value, $disabled_text ); + } - return true; - } + public static function get_field_type_title( $type ) { + $gf_field = GF_Fields::get( $type ); + if ( ! empty( $gf_field ) ) { + return $gf_field->get_form_editor_field_title(); + } - public static function get_section_fields($form, $section_field_id){ - $fields = array(); - $in_section = false; - foreach($form["fields"] as $field){ - if(in_array($field["type"], array("section", "page")) && $in_section) - return $fields; + return apply_filters( 'gform_field_type_title', $type, $type ); + } - if($field["id"] == $section_field_id) - $in_section = true; + public static function get_select_choices( $field, $value = '' ) { + $choices = ''; - if($in_section) - $fields[] = $field; - } + if ( RG_CURRENT_VIEW == 'entry' && empty( $value ) && empty( $field->placeholder ) ) { + $choices .= ""; + } - return $fields; - } + if ( is_array( $field->choices ) ) { + if ( GFFormsModel::get_input_type( $field ) == 'select' && ! empty( $field->placeholder ) ) { + $selected = empty( $value ) ? "selected='selected'" : ''; + $choices .= sprintf( "", $selected, esc_html( $field->placeholder ) ); + } - public static function get_countries(){ - return apply_filters("gform_countries", array( - __('Afghanistan', 'gravityforms'),__('Albania', 'gravityforms'),__('Algeria', 'gravityforms'), __('American Samoa', 'gravityforms'), __('Andorra', 'gravityforms'),__('Angola', 'gravityforms'),__('Antigua and Barbuda', 'gravityforms'),__('Argentina', 'gravityforms'),__('Armenia', 'gravityforms'),__('Australia', 'gravityforms'),__('Austria', 'gravityforms'),__('Azerbaijan', 'gravityforms'),__('Bahamas', 'gravityforms'),__('Bahrain', 'gravityforms'),__('Bangladesh', 'gravityforms'),__('Barbados', 'gravityforms'),__('Belarus', 'gravityforms'),__('Belgium', 'gravityforms'),__('Belize', 'gravityforms'),__('Benin', 'gravityforms'),__('Bermuda', 'gravityforms'),__('Bhutan', 'gravityforms'),__('Bolivia', 'gravityforms'),__('Bosnia and Herzegovina', 'gravityforms'),__('Botswana', 'gravityforms'),__('Brazil', 'gravityforms'),__('Brunei', 'gravityforms'),__('Bulgaria', 'gravityforms'),__('Burkina Faso', 'gravityforms'),__('Burundi', 'gravityforms'),__('Cambodia', 'gravityforms'),__('Cameroon', 'gravityforms'),__('Canada', 'gravityforms'),__('Cape Verde', 'gravityforms'),__('Cayman Islands', 'gravityforms'),__('Central African Republic', 'gravityforms'),__('Chad', 'gravityforms'),__('Chile', 'gravityforms'),__('China', 'gravityforms'),__('Colombia', 'gravityforms'),__('Comoros', 'gravityforms'),__('Congo, Democratic Republic of the', 'gravityforms'),__('Congo, Republic of the', 'gravityforms'),__('Costa Rica', 'gravityforms'),__('Côte d\'Ivoire', 'gravityforms'),__('Croatia', 'gravityforms'),__('Cuba', 'gravityforms'),__('Cyprus', 'gravityforms'),__('Czech Republic', 'gravityforms'),__('Denmark', 'gravityforms'),__('Djibouti', 'gravityforms'),__('Dominica', 'gravityforms'),__('Dominican Republic', 'gravityforms'),__('East Timor', 'gravityforms'),__('Ecuador', 'gravityforms'),__('Egypt', 'gravityforms'),__('El Salvador', 'gravityforms'),__('Equatorial Guinea', 'gravityforms'),__('Eritrea', 'gravityforms'),__('Estonia', 'gravityforms'),__('Ethiopia', 'gravityforms'),__('Fiji', 'gravityforms'),__('Finland', 'gravityforms'),__('France', 'gravityforms'), __('French Polynesia', 'gravityforms'), __('Gabon', 'gravityforms'), - __('Gambia', 'gravityforms'),_x('Georgia', 'Country', 'gravityforms'),__('Germany', 'gravityforms'),__('Ghana', 'gravityforms'),__('Greece', 'gravityforms'),__('Greenland', 'gravityforms'),__('Grenada', 'gravityforms'),__('Guam', 'gravityforms'),__('Guatemala', 'gravityforms'),__('Guinea', 'gravityforms'),__('Guinea-Bissau', 'gravityforms'),__('Guyana', 'gravityforms'),__('Haiti', 'gravityforms'),__('Honduras', 'gravityforms'),__('Hong Kong', 'gravityforms'),__('Hungary', 'gravityforms'),__('Iceland', 'gravityforms'),__('India', 'gravityforms'),__('Indonesia', 'gravityforms'),__('Iran', 'gravityforms'),__('Iraq', 'gravityforms'),__('Ireland', 'gravityforms'),__('Israel', 'gravityforms'),__('Italy', 'gravityforms'),__('Jamaica', 'gravityforms'),__('Japan', 'gravityforms'),__('Jordan', 'gravityforms'),__('Kazakhstan', 'gravityforms'),__('Kenya', 'gravityforms'),__('Kiribati', 'gravityforms'),__('North Korea', 'gravityforms'),__('South Korea', 'gravityforms'),__('Kosovo', 'gravityforms'),__('Kuwait', 'gravityforms'),__('Kyrgyzstan', 'gravityforms'),__('Laos', 'gravityforms'),__('Latvia', 'gravityforms'),__('Lebanon', 'gravityforms'),__('Lesotho', 'gravityforms'),__('Liberia', 'gravityforms'),__('Libya', 'gravityforms'),__('Liechtenstein', 'gravityforms'),__('Lithuania', 'gravityforms'),__('Luxembourg', 'gravityforms'),__('Macedonia', 'gravityforms'),__('Madagascar', 'gravityforms'),__('Malawi', 'gravityforms'),__('Malaysia', 'gravityforms'),__('Maldives', 'gravityforms'),__('Mali', 'gravityforms'),__('Malta', 'gravityforms'),__('Marshall Islands', 'gravityforms'),__('Mauritania', 'gravityforms'),__('Mauritius', 'gravityforms'),__('Mexico', 'gravityforms'),__('Micronesia', 'gravityforms'),__('Moldova', 'gravityforms'),__('Monaco', 'gravityforms'),__('Mongolia', 'gravityforms'),__('Montenegro', 'gravityforms'),__('Morocco', 'gravityforms'),__('Mozambique', 'gravityforms'),__('Myanmar', 'gravityforms'),__('Namibia', 'gravityforms'),__('Nauru', 'gravityforms'),__('Nepal', 'gravityforms'),__('Netherlands', 'gravityforms'),__('New Zealand', 'gravityforms'), - __('Nicaragua', 'gravityforms'),__('Niger', 'gravityforms'),__('Nigeria', 'gravityforms'),__('Norway', 'gravityforms'), __('Northern Mariana Islands', 'gravityforms'), __('Oman', 'gravityforms'),__('Pakistan', 'gravityforms'),__('Palau', 'gravityforms'),__('Palestine', 'gravityforms'),__('Panama', 'gravityforms'),__('Papua New Guinea', 'gravityforms'),__('Paraguay', 'gravityforms'),__('Peru', 'gravityforms'),__('Philippines', 'gravityforms'),__('Poland', 'gravityforms'),__('Portugal', 'gravityforms'),__('Puerto Rico', 'gravityforms'),__('Qatar', 'gravityforms'),__('Romania', 'gravityforms'),__('Russia', 'gravityforms'),__('Rwanda', 'gravityforms'),__('Saint Kitts and Nevis', 'gravityforms'),__('Saint Lucia', 'gravityforms'),__('Saint Vincent and the Grenadines', 'gravityforms'),__('Samoa', 'gravityforms'),__('San Marino', 'gravityforms'),__('Sao Tome and Principe', 'gravityforms'),__('Saudi Arabia', 'gravityforms'),__('Senegal', 'gravityforms'),__('Serbia and Montenegro', 'gravityforms'),__('Seychelles', 'gravityforms'),__('Sierra Leone', 'gravityforms'),__('Singapore', 'gravityforms'),__('Slovakia', 'gravityforms'),__('Slovenia', 'gravityforms'),__('Solomon Islands', 'gravityforms'),__('Somalia', 'gravityforms'),__('South Africa', 'gravityforms'),__('Spain', 'gravityforms'),__('Sri Lanka', 'gravityforms'),__('Sudan', 'gravityforms'),__('Sudan, South', 'gravityforms'),__('Suriname', 'gravityforms'),__('Swaziland', 'gravityforms'),__('Sweden', 'gravityforms'),__('Switzerland', 'gravityforms'),__('Syria', 'gravityforms'),__('Taiwan', 'gravityforms'),__('Tajikistan', 'gravityforms'),__('Tanzania', 'gravityforms'),__('Thailand', 'gravityforms'),__('Togo', 'gravityforms'),__('Tonga', 'gravityforms'),__('Trinidad and Tobago', 'gravityforms'),__('Tunisia', 'gravityforms'),__('Turkey', 'gravityforms'),__('Turkmenistan', 'gravityforms'),__('Tuvalu', 'gravityforms'),__('Uganda', 'gravityforms'),__('Ukraine', 'gravityforms'),__('United Arab Emirates', 'gravityforms'),__('United Kingdom', 'gravityforms'), - __('United States', 'gravityforms'),__('Uruguay', 'gravityforms'),__('Uzbekistan', 'gravityforms'),__('Vanuatu', 'gravityforms'),__('Vatican City', 'gravityforms'),__('Venezuela', 'gravityforms'),__('Vietnam', 'gravityforms'), __('Virgin Islands, British', 'gravityforms'), __('Virgin Islands, U.S.', 'gravityforms'),__('Yemen', 'gravityforms'),__('Zambia', 'gravityforms'),__('Zimbabwe', 'gravityforms'))); + foreach ( $field->choices as $choice ) { + //needed for users upgrading from 1.0 + $field_value = ! empty( $choice['value'] ) || $field->enableChoiceValue || $field->type == 'post_category' ? $choice['value'] : $choice['text']; + if ( $field->enablePrice ) { + $price = rgempty( 'price', $choice ) ? 0 : GFCommon::to_number( rgar( $choice, 'price' ) ); + $field_value .= '|' . $price; + } - } + if ( rgblank( $value ) && RG_CURRENT_VIEW != 'entry' ) { + $selected = rgar( $choice, 'isSelected' ) ? "selected='selected'" : ''; + } else { + if ( is_array( $value ) ) { + $is_match = false; + foreach ( $value as $item ) { + if ( RGFormsModel::choice_value_match( $field, $choice, $item ) ) { + $is_match = true; + break; + } + } + $selected = $is_match ? "selected='selected'" : ''; + } else { + $selected = RGFormsModel::choice_value_match( $field, $choice, $value ) ? "selected='selected'" : ''; + } + } - public static function get_country_code($country_name) { - $codes = array( - __('AFGHANISTAN', 'gravityforms') => "AF" , - __('ALBANIA', 'gravityforms') => "AL" , - __('ALGERIA', 'gravityforms') => "DZ" , - __('AMERICAN SAMOA', 'gravityforms') => "AS" , - __('ANDORRA', 'gravityforms') => "AD" , - __('ANGOLA', 'gravityforms') => "AO" , - __('ANTIGUA AND BARBUDA', 'gravityforms') => "AG" , - __('ARGENTINA', 'gravityforms') => "AR" , - __('ARMENIA', 'gravityforms') => "AM" , - __('AUSTRALIA', 'gravityforms') => "AU" , - __('AUSTRIA', 'gravityforms') => "AT" , - __('AZERBAIJAN', 'gravityforms') => "AZ" , - __('BAHAMAS', 'gravityforms') => "BS" , - __('BAHRAIN', 'gravityforms') => "BH" , - __('BANGLADESH', 'gravityforms') => "BD" , - __('BARBADOS', 'gravityforms') => "BB" , - __('BELARUS', 'gravityforms') => "BY" , - __('BELGIUM', 'gravityforms') => "BE" , - __('BELIZE', 'gravityforms') => "BZ" , - __('BENIN', 'gravityforms') => "BJ" , - __('BERMUDA', 'gravityforms') => "BM" , - __('BHUTAN', 'gravityforms') => "BT" , - __('BOLIVIA', 'gravityforms') => "BO" , - __('BOSNIA AND HERZEGOVINA', 'gravityforms') => "BA" , - __('BOTSWANA', 'gravityforms') => "BW" , - __('BRAZIL', 'gravityforms') => "BR" , - __('BRUNEI', 'gravityforms') => "BN" , - __('BULGARIA', 'gravityforms') => "BG" , - __('BURKINA FASO', 'gravityforms') => "BF" , - __('BURUNDI', 'gravityforms') => "BI" , - __('CAMBODIA', 'gravityforms') => "KH" , - __('CAMEROON', 'gravityforms') => "CM" , - __('CANADA', 'gravityforms') => "CA" , - __('CAPE VERDE', 'gravityforms') => "CV" , - __('CAYMAN ISLANDS', 'gravityforms') => "KY" , - __('CENTRAL AFRICAN REPUBLIC', 'gravityforms') => "CF" , - __('CHAD', 'gravityforms') => "TD" , - __('CHILE', 'gravityforms') => "CL" , - __('CHINA', 'gravityforms') => "CN" , - __('COLOMBIA', 'gravityforms') => "CO" , - __('COMOROS', 'gravityforms') => "KM" , - __('CONGO, DEMOCRATIC REPUBLIC OF THE', 'gravityforms') => "CD" , - __('CONGO, REPUBLIC OF THE', 'gravityforms') => "CG" , - __('COSTA RICA', 'gravityforms') => "CR" , - __('C&OCIRC;TE D\'IVOIRE', 'gravityforms') => "CI" , - __('CROATIA', 'gravityforms') => "HR" , - __('CUBA', 'gravityforms') => "CU" , - __('CYPRUS', 'gravityforms') => "CY" , - __('CZECH REPUBLIC', 'gravityforms') => "CZ" , - __('DENMARK', 'gravityforms') => "DK" , - __('DJIBOUTI', 'gravityforms') => "DJ" , - __('DOMINICA', 'gravityforms') => "DM" , - __('DOMINICAN REPUBLIC', 'gravityforms') => "DO" , - __('EAST TIMOR', 'gravityforms') => "TL" , - __('ECUADOR', 'gravityforms') => "EC" , - __('EGYPT', 'gravityforms') => "EG" , - __('EL SALVADOR', 'gravityforms') => "SV" , - __('EQUATORIAL GUINEA', 'gravityforms') => "GQ" , - __('ERITREA', 'gravityforms') => "ER" , - __('ESTONIA', 'gravityforms') => "EE" , - __('ETHIOPIA', 'gravityforms') => "ET" , - __('FIJI', 'gravityforms') => "FJ" , - __('FINLAND', 'gravityforms') => "FI" , - __('FRANCE', 'gravityforms') => "FR" , - __('GABON', 'gravityforms') => "GA" , - __('GAMBIA', 'gravityforms') => "GM" , - _x('GEORGIA', 'Country', 'gravityforms') => "GE" , - __('GERMANY', 'gravityforms') => "DE" , - __('GHANA', 'gravityforms') => "GH" , - __('GREECE', 'gravityforms') => "GR" , - __('GREENLAND', 'gravityforms') => "GL" , - __('GRENADA', 'gravityforms') => "GD" , - __('GUAM', 'gravityforms') => "GU" , - __('GUATEMALA', 'gravityforms') => "GT" , - __('GUINEA', 'gravityforms') => "GN" , - __('GUINEA-BISSAU', 'gravityforms') => "GW" , - __('GUYANA', 'gravityforms') => "GY" , - __('HAITI', 'gravityforms') => "HT" , - __('HONDURAS', 'gravityforms') => "HN" , - __('HONG KONG', 'gravityforms') => "HK" , - __('HUNGARY', 'gravityforms') => "HU" , - __('ICELAND', 'gravityforms') => "IS" , - __('INDIA', 'gravityforms') => "IN" , - __('INDONESIA', 'gravityforms') => "ID" , - __('IRAN', 'gravityforms') => "IR" , - __('IRAQ', 'gravityforms') => "IQ" , - __('IRELAND', 'gravityforms') => "IE" , - __('ISRAEL', 'gravityforms') => "IL" , - __('ITALY', 'gravityforms') => "IT" , - __('JAMAICA', 'gravityforms') => "JM" , - __('JAPAN', 'gravityforms') => "JP" , - __('JORDAN', 'gravityforms') => "JO" , - __('KAZAKHSTAN', 'gravityforms') => "KZ" , - __('KENYA', 'gravityforms') => "KE" , - __('KIRIBATI', 'gravityforms') => "KI" , - __('NORTH KOREA', 'gravityforms') => "KP" , - __('SOUTH KOREA', 'gravityforms') => "KR" , - __('KOSOVO', 'gravityforms') => "KV" , - __('KUWAIT', 'gravityforms') => "KW" , - __('KYRGYZSTAN', 'gravityforms') => "KG" , - __('LAOS', 'gravityforms') => "LA" , - __('LATVIA', 'gravityforms') => "LV" , - __('LEBANON', 'gravityforms') => "LB" , - __('LESOTHO', 'gravityforms') => "LS" , - __('LIBERIA', 'gravityforms') => "LR" , - __('LIBYA', 'gravityforms') => "LY" , - __('LIECHTENSTEIN', 'gravityforms') => "LI" , - __('LITHUANIA', 'gravityforms') => "LT" , - __('LUXEMBOURG', 'gravityforms') => "LU" , - __('MACEDONIA', 'gravityforms') => "MK" , - __('MADAGASCAR', 'gravityforms') => "MG" , - __('MALAWI', 'gravityforms') => "MW" , - __('MALAYSIA', 'gravityforms') => "MY" , - __('MALDIVES', 'gravityforms') => "MV" , - __('MALI', 'gravityforms') => "ML" , - __('MALTA', 'gravityforms') => "MT" , - __('MARSHALL ISLANDS', 'gravityforms') => "MH" , - __('MAURITANIA', 'gravityforms') => "MR" , - __('MAURITIUS', 'gravityforms') => "MU" , - __('MEXICO', 'gravityforms') => "MX" , - __('MICRONESIA', 'gravityforms') => "FM" , - __('MOLDOVA', 'gravityforms') => "MD" , - __('MONACO', 'gravityforms') => "MC" , - __('MONGOLIA', 'gravityforms') => "MN" , - __('MONTENEGRO', 'gravityforms') => "ME" , - __('MOROCCO', 'gravityforms') => "MA" , - __('MOZAMBIQUE', 'gravityforms') => "MZ" , - __('MYANMAR', 'gravityforms') => "MM" , - __('NAMIBIA', 'gravityforms') => "NA" , - __('NAURU', 'gravityforms') => "NR" , - __('NEPAL', 'gravityforms') => "NP" , - __('NETHERLANDS', 'gravityforms') => "NL" , - __('NEW ZEALAND', 'gravityforms') => "NZ" , - __('NICARAGUA', 'gravityforms') => "NI" , - __('NIGER', 'gravityforms') => "NE" , - __('NIGERIA', 'gravityforms') => "NG" , - __('NORTHERN MARIANA ISLANDS', 'gravityforms') => "MP" , - __('NORWAY', 'gravityforms') => "NO" , - __('OMAN', 'gravityforms') => "OM" , - __('PAKISTAN', 'gravityforms') => "PK" , - __('PALAU', 'gravityforms') => "PW" , - __('PALESTINE', 'gravityforms') => "PS" , - __('PANAMA', 'gravityforms') => "PA" , - __('PAPUA NEW GUINEA', 'gravityforms') => "PG" , - __('PARAGUAY', 'gravityforms') => "PY" , - __('PERU', 'gravityforms') => "PE" , - __('PHILIPPINES', 'gravityforms') => "PH" , - __('POLAND', 'gravityforms') => "PL" , - __('PORTUGAL', 'gravityforms') => "PT" , - __('PUERTO RICO', 'gravityforms') => "PR" , - __('QATAR', 'gravityforms') => "QA" , - __('ROMANIA', 'gravityforms') => "RO" , - __('RUSSIA', 'gravityforms') => "RU" , - __('RWANDA', 'gravityforms') => "RW" , - __('SAINT KITTS AND NEVIS', 'gravityforms') => "KN" , - __('SAINT LUCIA', 'gravityforms') => "LC" , - __('SAINT VINCENT AND THE GRENADINES', 'gravityforms') => "VC" , - __('SAMOA', 'gravityforms') => "WS" , - __('SAN MARINO', 'gravityforms') => "SM" , - __('SAO TOME AND PRINCIPE', 'gravityforms') => "ST" , - __('SAUDI ARABIA', 'gravityforms') => "SA" , - __('SENEGAL', 'gravityforms') => "SN" , - __('SERBIA AND MONTENEGRO', 'gravityforms') => "RS" , - __('SEYCHELLES', 'gravityforms') => "SC" , - __('SIERRA LEONE', 'gravityforms') => "SL" , - __('SINGAPORE', 'gravityforms') => "SG" , - __('SLOVAKIA', 'gravityforms') => "SK" , - __('SLOVENIA', 'gravityforms') => "SI" , - __('SOLOMON ISLANDS', 'gravityforms') => "SB" , - __('SOMALIA', 'gravityforms') => "SO" , - __('SOUTH AFRICA', 'gravityforms') => "ZA" , - __('SPAIN', 'gravityforms') => "ES" , - __('SRI LANKA', 'gravityforms') => "LK" , - __('SUDAN', 'gravityforms') => "SD" , - __('SUDAN, SOUTH', 'gravityforms') => "SS" , - __('SURINAME', 'gravityforms') => "SR" , - __('SWAZILAND', 'gravityforms') => "SZ" , - __('SWEDEN', 'gravityforms') => "SE" , - __('SWITZERLAND', 'gravityforms') => "CH" , - __('SYRIA', 'gravityforms') => "SY" , - __('TAIWAN', 'gravityforms') => "TW" , - __('TAJIKISTAN', 'gravityforms') => "TJ" , - __('TANZANIA', 'gravityforms') => "TZ" , - __('THAILAND', 'gravityforms') => "TH" , - __('TOGO', 'gravityforms') => "TG" , - __('TONGA', 'gravityforms') => "TO" , - __('TRINIDAD AND TOBAGO', 'gravityforms') => "TT" , - __('TUNISIA', 'gravityforms') => "TN" , - __('TURKEY', 'gravityforms') => "TR" , - __('TURKMENISTAN', 'gravityforms') => "TM" , - __('TUVALU', 'gravityforms') => "TV" , - __('UGANDA', 'gravityforms') => "UG" , - __('UKRAINE', 'gravityforms') => "UA" , - __('UNITED ARAB EMIRATES', 'gravityforms') => "AE" , - __('UNITED KINGDOM', 'gravityforms') => "GB" , - __('UNITED STATES', 'gravityforms') => "US" , - __('URUGUAY', 'gravityforms') => "UY" , - __('UZBEKISTAN', 'gravityforms') => "UZ" , - __('VANUATU', 'gravityforms') => "VU" , - __('VATICAN CITY', 'gravityforms') => "" , - __('VENEZUELA', 'gravityforms') => "VE" , - __('VIRGIN ISLANDS, BRITISH', 'gravityforms') => "VG" , - __('VIRGIN ISLANDS, U.S.', 'gravityforms') => "VI" , - __('VIETNAM', 'gravityforms') => "VN" , - __('YEMEN', 'gravityforms') => "YE" , - __('ZAMBIA', 'gravityforms') => "ZM" , - __('ZIMBABWE', 'gravityforms') => "ZW" ); - - return rgar($codes, strtoupper($country_name)); - } + $choices .= sprintf( "", esc_attr( $field_value ), $selected, esc_html( $choice['text'] ) ); + } + } - public static function get_us_states(){ - return apply_filters("gform_us_states", array( - __("Alabama","gravityforms"),__("Alaska","gravityforms"),__("Arizona","gravityforms"),__("Arkansas","gravityforms"), - __("California","gravityforms"),__("Colorado","gravityforms"),__("Connecticut","gravityforms"),__("Delaware","gravityforms"), - __("District of Columbia", "gravityforms"), __("Florida","gravityforms"),_x("Georgia","US State","gravityforms"), - __("Hawaii","gravityforms"),__("Idaho","gravityforms"),__("Illinois","gravityforms"),__("Indiana","gravityforms"), - __("Iowa","gravityforms"),__("Kansas","gravityforms"),__("Kentucky","gravityforms"),__("Louisiana","gravityforms"), - __("Maine","gravityforms"),__("Maryland","gravityforms"),__("Massachusetts","gravityforms"),__("Michigan","gravityforms"), - __("Minnesota","gravityforms"),__("Mississippi","gravityforms"),__("Missouri","gravityforms"),__("Montana","gravityforms"), - __("Nebraska","gravityforms"),__("Nevada","gravityforms"),__("New Hampshire","gravityforms"),__("New Jersey","gravityforms"), - __("New Mexico","gravityforms"),__("New York","gravityforms"),__("North Carolina","gravityforms"), - __("North Dakota","gravityforms"),__("Ohio","gravityforms"),__("Oklahoma","gravityforms"),__("Oregon","gravityforms"), - __("Pennsylvania","gravityforms"),__("Rhode Island","gravityforms"),__("South Carolina","gravityforms"), - __("South Dakota","gravityforms"),__("Tennessee","gravityforms"),__("Texas","gravityforms"),__("Utah","gravityforms"), - __("Vermont","gravityforms"),__("Virginia","gravityforms"),__("Washington","gravityforms"),__("West Virginia","gravityforms"), - __("Wisconsin","gravityforms"),__("Wyoming","gravityforms"), __("Armed Forces Americas","gravityforms"), - __("Armed Forces Europe","gravityforms"),__("Armed Forces Pacific","gravityforms")) - ); - } + return $choices; + } - public static function get_us_state_code($state_name){ - $states = array( - strtoupper(__("Alabama","gravityforms")) => "AL", - strtoupper(__("Alaska","gravityforms")) => "AK", - strtoupper(__("Arizona","gravityforms")) => "AZ", - strtoupper(__("Arkansas","gravityforms")) => "AR", - strtoupper(__("California","gravityforms")) => "CA", - strtoupper(__("Colorado","gravityforms")) => "CO", - strtoupper(__("Connecticut","gravityforms")) => "CT", - strtoupper(__("Delaware","gravityforms")) => "DE", - strtoupper(__("District of Columbia", "gravityforms")) => "DC", - strtoupper(__("Florida","gravityforms")) => "FL", - strtoupper(_x("Georgia","US State","gravityforms")) => "GA", - strtoupper(__("Hawaii","gravityforms")) => "HI", - strtoupper(__("Idaho","gravityforms")) => "ID", - strtoupper(__("Illinois","gravityforms")) => "IL", - strtoupper(__("Indiana","gravityforms")) => "IN", - strtoupper(__("Iowa","gravityforms")) => "IA", - strtoupper(__("Kansas","gravityforms")) => "KS", - strtoupper(__("Kentucky","gravityforms")) => "KY", - strtoupper(__("Louisiana","gravityforms")) => "LA", - strtoupper(__("Maine","gravityforms")) => "ME", - strtoupper(__("Maryland","gravityforms")) => "MD", - strtoupper(__("Massachusetts","gravityforms")) => "MA", - strtoupper(__("Michigan","gravityforms")) => "MI", - strtoupper(__("Minnesota","gravityforms")) => "MN", - strtoupper(__("Mississippi","gravityforms")) => "MS", - strtoupper(__("Missouri","gravityforms")) => "MO", - strtoupper(__("Montana","gravityforms")) => "MT", - strtoupper(__("Nebraska","gravityforms")) => "NE", - strtoupper(__("Nevada","gravityforms")) => "NV", - strtoupper(__("New Hampshire","gravityforms")) => "NH", - strtoupper(__("New Jersey","gravityforms")) => "NJ", - strtoupper(__("New Mexico","gravityforms")) => "NM", - strtoupper(__("New York","gravityforms")) => "NY", - strtoupper(__("North Carolina","gravityforms")) => "NC", - strtoupper(__("North Dakota","gravityforms")) => "ND", - strtoupper(__("Ohio","gravityforms")) => "OH", - strtoupper(__("Oklahoma","gravityforms")) => "OK", - strtoupper(__("Oregon","gravityforms")) => "OR", - strtoupper(__("Pennsylvania","gravityforms")) => "PA", - strtoupper(__("Rhode Island","gravityforms")) => "RI", - strtoupper(__("South Carolina","gravityforms")) => "SC", - strtoupper(__("South Dakota","gravityforms")) => "SD", - strtoupper(__("Tennessee","gravityforms")) => "TN", - strtoupper(__("Texas","gravityforms")) => "TX", - strtoupper(__("Utah","gravityforms")) => "UT", - strtoupper(__("Vermont","gravityforms")) => "VT", - strtoupper(__("Virginia","gravityforms")) => "VA", - strtoupper(__("Washington","gravityforms")) => "WA", - strtoupper(__("West Virginia","gravityforms")) => "WV", - strtoupper(__("Wisconsin","gravityforms")) => "WI", - strtoupper(__("Wyoming","gravityforms")) => "WY", - strtoupper(__("Armed Forces Americas","gravityforms")) => "AA", - strtoupper(__("Armed Forces Europe","gravityforms")) => "AE", - strtoupper(__("Armed Forces Pacific","gravityforms")) => "AP" - ); - - $code = isset($states[strtoupper($state_name)]) ? $states[strtoupper($state_name)] : strtoupper($state_name); - - return $code; - } + public static function is_section_empty( $section_field, $form, $entry ) { + $cache_key = "GFCommon::is_section_empty_{$form['id']}_{$section_field['id']}"; + $value = GFCache::get( $cache_key ); - public static function get_canadian_provinces(){ - return array(__("Alberta","gravityforms"),__("British Columbia","gravityforms"),__("Manitoba","gravityforms"),__("New Brunswick","gravityforms"),__("Newfoundland & Labrador","gravityforms"),__("Northwest Territories","gravityforms"),__("Nova Scotia","gravityforms"),__("Nunavut","gravityforms"),__("Ontario","gravityforms"),__("Prince Edward Island","gravityforms"),__("Quebec","gravityforms"),__("Saskatchewan","gravityforms"),__("Yukon","gravityforms")); + if ( $value !== false ) { + return $value == true; + } - } + $fields = self::get_section_fields( $form, $section_field['id'] ); + if ( ! is_array( $fields ) ) { + GFCache::set( $cache_key, 1 ); - public static function get_state_dropdown($states, $selected_state=""){ - $str = ""; - foreach($states as $code => $state){ - if(is_numeric($code)) - $code = $state; + return true; + } - $selected = $code == $selected_state ? "selected='selected'" : ""; - $str .= ""; - } - return $str; - } + foreach ( $fields as $field ) { - public static function get_us_state_dropdown($selected_state = ""){ - $states = array_merge(array(''), self::get_us_states()); - foreach($states as $code => $state){ - if(is_numeric($code)) - $code = $state; + $value = GFFormsModel::get_lead_field_value( $entry, $field ); + $value = GFCommon::get_lead_field_display( $field, $value, rgar( $entry, 'currency' ) ); - $selected = $code == $selected_state ? "selected='selected'" : ""; - $str .= ""; - } - return $str; - } + if ( rgblank( $value ) ) { + continue; + } - public static function get_canadian_provinces_dropdown($selected_province = ""){ - $states = array_merge(array(''), self::get_canadian_provinces()); - foreach($states as $state){ - $selected = $state == $selected_province ? "selected='selected'" : ""; - $str .= ""; - } - return $str; - } + // most fields are displayed in the section by default, exceptions are handled below + $is_field_displayed_in_section = true; - public static function get_country_dropdown($selected_country = ""){ - $str = ""; - $countries = array_merge(array(''), self::get_countries()); - foreach($countries as $code => $country){ - if(is_numeric($code)) - $code = $country; + // by default, product fields are not displayed in their containing section (displayed in a product summary table) + // if the filter is used to disable this, product fields are displayed in the section like other fields + if ( self::is_product_field( $field['type'] ) ) { - $selected = $code == $selected_country ? "selected='selected'" : ""; - $str .= ""; - } - return $str; - } + $display_product_summary = apply_filters( 'gform_display_product_summary', true, $field, $form, $entry ); - public static function is_post_field($field){ - return in_array($field["type"], array("post_title", "post_tags", "post_category", "post_custom_field", "post_content", "post_excerpt", "post_image")); - } + $is_field_displayed_in_section = ! $display_product_summary; + } - public static function get_range_message($field){ - $min = $field["rangeMin"]; - $max = $field["rangeMax"]; - $message = ""; - - if(is_numeric($min) && is_numeric($max)) - $message = sprintf(__("Please enter a value between %s and %s.", "gravityforms"), "$min", "$max") ; - else if(is_numeric($min)) - $message = sprintf(__("Please enter a value greater than or equal to %s.", "gravityforms"), "$min"); - else if(is_numeric($max)) - $message = sprintf(__("Please enter a value less than or equal to %s.", "gravityforms"), "$max"); - else if($field["failed_validation"]) - $message = __("Please enter a valid number", "gravityforms"); - - return $message; - } + if ( $is_field_displayed_in_section ) { + GFCache::set( $cache_key, 0 ); - public static function get_fields_by_type($form, $types){ - $fields = array(); - if(!is_array(rgar($form,"fields"))) - return $fields; + return false; + } + } - foreach($form["fields"] as $field){ - if(in_array(rgar($field,"type"), $types)) - $fields[] = $field; - } - return $fields; - } + GFCache::set( $cache_key, 1 ); - public static function has_pages($form){ - return sizeof(self::get_fields_by_type($form, array("page"))) > 0; - } + return true; + } - public static function get_product_fields_by_type($form, $types, $product_id){ - global $_product_fields; - $key = json_encode($types) . "_" . $product_id . "_" . $form["id"]; - if(!isset($_product_fields[$key])){ - $fields = array(); - for($i=0, $count=sizeof($form["fields"]); $i<$count; $i++){ - $field = $form["fields"][$i]; - if(in_array($field["type"], $types) && $field["productField"] == $product_id){ - $fields[] = $field; - } - } - $_product_fields[$key] = $fields; - } - return $_product_fields[$key]; - } + public static function get_section_fields( $form, $section_field_id ) { + $fields = array(); + $in_section = false; + foreach ( $form['fields'] as $field ) { + if ( in_array( $field->type, array( 'section', 'page' ) ) && $in_section ) { + return $fields; + } - private static function get_month_dropdown($name="", $id="", $selected_value="", $tabindex="", $disabled_text=""){ - return self::get_number_dropdown($name, $id, $selected_value, $tabindex, $disabled_text, __("Month", "gravityforms"), 1, 12); - } + if ( $field->id == $section_field_id ) { + $in_section = true; + } - private static function get_day_dropdown($name="", $id="", $selected_value="", $tabindex="", $disabled_text=""){ - return self::get_number_dropdown($name, $id, $selected_value, $tabindex, $disabled_text, __("Day", "gravityforms"), 1, 31); - } + if ( $in_section ) { + $fields[] = $field; + } + } - private static function get_year_dropdown($name="", $id="", $selected_value="", $tabindex="", $disabled_text=""){ - $year_min = apply_filters("gform_date_min_year", "1920"); - $year_max = apply_filters("gform_date_max_year", date("Y") + 1); - return self::get_number_dropdown($name, $id, $selected_value, $tabindex, $disabled_text, __("Year", "gravityforms"), $year_max, $year_min); - } + return $fields; + } - private static function get_number_dropdown($name, $id, $selected_value, $tabindex, $disabled_text, $placeholder, $start_number, $end_number){ - $str = ""; - return $str; - } + public static function get_country_code( $country_name ) { + if ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) { + _deprecated_function( 'GFCommon::get_country_code', '1.9', 'GF_Field_Address::get_country_code' ); + } - private static function get_logic_event($field, $event){ - if(empty($field["conditionalLogicFields"]) || IS_ADMIN) - return ""; + return GF_Fields::get( 'address' )->get_country_code( $country_name ); + } - switch($event){ - case "keyup" : - return "onchange='gf_apply_rules(" . $field["formId"] . "," . GFCommon::json_encode($field["conditionalLogicFields"]) . ");' onkeyup='clearTimeout(__gf_timeout_handle); __gf_timeout_handle = setTimeout(\"gf_apply_rules(" . $field["formId"] . "," . GFCommon::json_encode($field["conditionalLogicFields"]) . ")\", 300);'"; - break; + public static function get_us_states() { + if ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) { + _deprecated_function( 'GFCommon::get_us_states', '1.9', 'GF_Field_Address::get_us_states' ); + } - case "click" : - return "onclick='gf_apply_rules(" . $field["formId"] . "," . GFCommon::json_encode($field["conditionalLogicFields"]) . ");'"; - break; + return GF_Fields::get( 'address' )->get_us_states(); + } - case "change" : - return "onchange='gf_apply_rules(" . $field["formId"] . "," . GFCommon::json_encode($field["conditionalLogicFields"]) . ");'"; - break; - } - } + public static function get_canadian_provinces() { + if ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) { + _deprecated_function( 'GFCommon::get_canadian_provinces', '1.9', 'GF_Field_Address::get_canadian_provinces' ); + } - public static function has_field_calculation($field) { + return GF_Fields::get( 'address' )->get_canadian_provinces(); + } - if($field['type'] == 'number') { - return rgar($field, 'enableCalculation') && rgar($field, 'calculationFormula'); - } - return RGFormsModel::get_input_type($field) == 'calculation'; - } + public static function is_post_field( $field ) { + return in_array( $field->type, array( 'post_title', 'post_tags', 'post_category', 'post_custom_field', 'post_content', 'post_excerpt', 'post_image' ) ); + } - public static function get_field_input($field, $value="", $lead_id=0, $form_id=0){ - - $id = $field["id"]; - $field_id = IS_ADMIN || $form_id == 0 ? "input_$id" : "input_" . $form_id . "_$id"; - $form_id = IS_ADMIN && empty($form_id) ? rgget("id") : $form_id; - - $size = rgar($field, "size"); - $disabled_text = (IS_ADMIN && RG_CURRENT_VIEW != "entry") ? "disabled='disabled'" : ""; - $class_suffix = RG_CURRENT_VIEW == "entry" ? "_admin" : ""; - $class = $size . $class_suffix; - - $currency = ""; - if(RG_CURRENT_VIEW == "entry"){ - $lead = RGFormsModel::get_lead($lead_id); - $post_id = $lead["post_id"]; - $post_link = ""; - if(is_numeric($post_id) && self::is_post_field($field)){ - $post_link = "You can edit this post from the post page."; - } - $currency = $lead["currency"]; - } + public static function get_fields_by_type( $form, $types ) { + $fields = array(); + if ( ! is_array( rgar( $form, 'fields' ) ) ) { + return $fields; + } - $field_input = apply_filters("gform_field_input", "", $field, $value, $lead_id, $form_id); - if($field_input) - return $field_input; + foreach ( $form['fields'] as $field ) { + if ( in_array( $field->type, $types ) ) { + $fields[] = $field; + } + } - //product fields are not editable - if(RG_CURRENT_VIEW == "entry" && self::is_product_field($field["type"])) - return "
    " . __("Product fields are not editable", "gravityforms") . "
    "; + return $fields; + } - else if(RG_CURRENT_VIEW == "entry" && $field["type"] == "donation") - return "
    " . __("Donations are not editable", "gravityforms") . "
    "; + public static function has_pages( $form ) { + return sizeof( self::get_fields_by_type( $form, array( 'page' ) ) ) > 0; + } - // add categories as choices for Post Category field - if($field['type'] == 'post_category'){ - $field = self::add_categories_as_choices($field, $value); + public static function get_product_fields_by_type( $form, $types, $product_id ) { + global $_product_fields; + $key = json_encode( $types ) . '_' . $product_id . '_' . $form['id']; + if ( ! isset( $_product_fields[ $key ] ) ) { + $fields = array(); + for ( $i = 0, $count = sizeof( $form['fields'] ); $i < $count; $i ++ ) { + $field = $form['fields'][ $i ]; + if ( in_array( $field->type, $types ) && $field->productField == $product_id ) { + $fields[] = $field; + } + } + $_product_fields[ $key ] = $fields; } - $max_length = ""; - $html5_attributes = ""; + return $_product_fields[ $key ]; + } - switch(RGFormsModel::get_input_type($field)){ + private static function get_logic_event( $field, $event ) { + _deprecated_function( 'GFCommon::get_logic_event', '1.9', 'GF_Field::get_logic_event' ); - case "total" : - if(RG_CURRENT_VIEW == "entry") - return "
    "; - else - return "
    " . self::to_money("0") . "
    "; - break; + $is_form_editor = GFCommon::is_form_editor(); + $is_entry_detail = GFCommon::is_entry_detail(); + $is_admin = $is_form_editor || $is_entry_detail; - case "calculation" : - case "singleproduct" : + if ( empty( $field->conditionalLogicFields ) || $is_admin ) { + return ''; + } - $product_name = !is_array($value) || empty($value[$field["id"] . ".1"]) ? esc_attr($field["label"]) : esc_attr($value[$field["id"] . ".1"]); - $price = !is_array($value) || empty($value[$field["id"] . ".2"]) ? rgget("basePrice", $field) : esc_attr($value[$field["id"] . ".2"]); - $quantity = is_array($value) ? esc_attr($value[$field["id"] . ".3"]) : ""; + switch ( $event ) { + case 'keyup' : + return "onchange='gf_apply_rules(" . $field->formId . ',' . GFCommon::json_encode( $field->conditionalLogicFields ) . ");' onkeyup='clearTimeout(__gf_timeout_handle); __gf_timeout_handle = setTimeout(\"gf_apply_rules(" . $field->formId . ',' . GFCommon::json_encode( $field->conditionalLogicFields ) . ")\", 300);'"; + break; - if(empty($price)) - $price = 0; + case 'click' : + return "onclick='gf_apply_rules(" . $field->formId . ',' . GFCommon::json_encode( $field->conditionalLogicFields ) . ");'"; + break; - $form = RGFormsModel::get_form_meta($form_id); - $has_quantity = sizeof(GFCommon::get_product_fields_by_type($form, array("quantity"), $field["id"])) > 0; - if($has_quantity) - $field["disableQuantity"] = true; + case 'change' : + return "onchange='gf_apply_rules(" . $field->formId . ',' . GFCommon::json_encode( $field->conditionalLogicFields ) . ");'"; + break; + } + } - $quantity_field = ""; + /** + * @deprecated + * + * @param GF_Field $field + * + * @return mixed + */ + public static function has_field_calculation( $field ) { + _deprecated_function( 'has_field_calculation', '1.7', 'GF_Field::has_calculation' ); + + return $field->has_calculation(); + } - $qty_input_type = GFFormsModel::is_html5_enabled() ? "number" : "text"; + /** + * @param GF_Field $field + * @param string $value + * @param int $lead_id + * @param int $form_id + * @param null $form + * + * @return mixed|string|void + */ + public static function get_field_input( $field, $value = '', $lead_id = 0, $form_id = 0, $form = null ) { + + if ( ! $field instanceof GF_Field ) { + $field = GF_Fields::create( $field ); + } - if(IS_ADMIN){ - $style = rgget("disableQuantity", $field) ? "style='display:none;'" : ""; - $quantity_field = " " . apply_filters("gform_product_quantity_{$form_id}",apply_filters("gform_product_quantity",__("Quantity:", "gravityforms"), $form_id), $form_id) . " "; - } - else if(!rgget("disableQuantity", $field)){ - $tabindex = self::get_tabindex(); - $quantity_field .= " " . apply_filters("gform_product_quantity_{$form_id}",apply_filters("gform_product_quantity",__("Quantity:", "gravityforms"), $form_id), $form_id) . " "; - } - else{ - if(!is_numeric($quantity)) - $quantity = 1; + $is_form_editor = GFCommon::is_form_editor(); + $is_entry_detail = GFCommon::is_entry_detail(); + $is_admin = $is_form_editor || $is_entry_detail; - if(!$has_quantity){ - $quantity_field .= ""; - } - } + $id = intval( $field->id ); + $field_id = $is_admin || $form_id == 0 ? "input_$id" : 'input_' . $form_id . "_$id"; + $form_id = $is_admin && empty( $form_id ) ? rgget( 'id' ) : $form_id; - return "
    " . apply_filters("gform_product_price_{$form_id}", apply_filters("gform_product_price",__("Price", "gravityforms"), $form_id), $form_id) . ": " . esc_html(GFCommon::to_money($price, $currency)) ."{$quantity_field}
    "; + if ( RG_CURRENT_VIEW == 'entry' ) { + $lead = RGFormsModel::get_lead( $lead_id ); + $post_id = $lead['post_id']; + $post_link = ''; + if ( is_numeric( $post_id ) && self::is_post_field( $field ) ) { + $post_link = "
    You can edit this post from the post page.
    "; + } + } - break; + $field_input = apply_filters( 'gform_field_input', '', $field, $value, $lead_id, $form_id ); + if ( $field_input ) { + return $field_input; + } - case "hiddenproduct" : + //product fields are not editable + if ( RG_CURRENT_VIEW == 'entry' && self::is_product_field( $field->type ) ) { + return "
    " . __( 'Product fields are not editable' , 'gravityforms' ) . '
    '; + } else if ( RG_CURRENT_VIEW == 'entry' && $field->type == 'donation' ) { + return "
    " . __( 'Donations are not editable' , 'gravityforms' ) . '
    '; + } - $form = RGFormsModel::get_form_meta($form_id); - $has_quantity_field = sizeof(GFCommon::get_product_fields_by_type($form, array("quantity"), $field["id"])) > 0; + // add categories as choices for Post Category field + if ( $field->type == 'post_category' ) { + $field = self::add_categories_as_choices( $field, $value ); + } - $product_name = !is_array($value) || empty($value[$field["id"] . ".1"]) ? esc_attr($field["label"]) : esc_attr($value[$field["id"] . ".1"]); - $quantity = is_array($value) ? esc_attr($value[$field["id"] . ".3"]) : "1"; - $price = !is_array($value) || empty($value[$field["id"] . ".2"]) ? rgget("basePrice", $field) : esc_attr($value[$field["id"] . ".2"]); - if(empty($price)) - $price = 0; + $type = RGFormsModel::get_input_type( $field ); + switch ( $type ) { - $quantity_field = $has_quantity_field ? "" : ""; - $product_name_field = ""; + case 'honeypot': + $autocomplete = RGFormsModel::is_html5_enabled() ? "autocomplete='off'" : ''; - $field_type = IS_ADMIN ? "text" : "hidden"; + return "
    "; + break; - return $quantity_field . $product_name_field . sprintf("", $id, esc_attr($price), $disabled_text); + case 'adminonly_hidden' : + if ( ! is_array( $field->inputs ) ) { + if ( is_array( $value ) ) { + $value = json_encode( $value ); + } - break; + return sprintf( "", $id, $field_id, esc_attr( $value ) ); + } - case "singleshipping" : - $price = !empty($value) ? $value : rgget("basePrice", $field); - if(empty($price)) - $price = 0; + $fields = ''; + foreach ( $field->inputs as $input ) { + $fields .= sprintf( "", $input['id'], esc_attr( rgar( $value, strval( $input['id'] ) ) ) ); + } - return "
    " . GFCommon::to_money($price, $currency) ."
    "; + return $fields; + break; - break; + default : - case "website": - $is_html5 = RGFormsModel::is_html5_enabled(); - $value = empty($value) && !$is_html5 ? "http://" : $value; - $html_input_type = $is_html5 ? "url" : "text"; - $html5_attributes = $is_html5 ? "placeholder='http://'" : ""; - case "text": - if(empty($html_input_type)) - $html_input_type = "text"; + if ( ! empty( $post_link ) ) { + return $post_link; + } - if(rgget("enablePasswordInput", $field) && RG_CURRENT_VIEW != "entry") - $html_input_type = "password"; + if ( ! isset( $lead ) ) { + $lead = null; + } - if(is_numeric(rgget("maxLength", $field))) - $max_length = "maxlength='{$field["maxLength"]}'"; + return $field->get_field_input( $form, $value, $lead ); - if(!empty($post_link)) - return $post_link; + break; - $logic_event = self::get_logic_event($field, "keyup"); + } + } - $tabindex = self::get_tabindex(); - return sprintf("
    ", $id, $field_id, $html_input_type, esc_attr($value), esc_attr($class), $disabled_text); - break; + public static function is_ssl() { + global $wordpress_https; + $is_ssl = false; - case "email": + $has_https_plugin = class_exists( 'WordPressHTTPS' ) && isset( $wordpress_https ); + $has_is_ssl_method = $has_https_plugin && method_exists( 'WordPressHTTPS', 'is_ssl' ); + $has_isSsl_method = $has_https_plugin && method_exists( 'WordPressHTTPS', 'isSsl' ); - if(!empty($post_link)) - return $post_link; + //Use the WordPress HTTPs plugin if installed + if ( $has_https_plugin && $has_is_ssl_method ) { + $is_ssl = $wordpress_https->is_ssl(); + } else if ( $has_https_plugin && $has_isSsl_method ) { + $is_ssl = $wordpress_https->isSsl(); + } else { + $is_ssl = is_ssl(); + } - $html_input_type = RGFormsModel::is_html5_enabled() ? "email" : "text"; - if(IS_ADMIN && RG_CURRENT_VIEW != "entry"){ - $single_style = rgget("emailConfirmEnabled", $field) ? "style='display:none;'" : ""; - $confirm_style = rgget("emailConfirmEnabled", $field) ? "" : "style='display:none;'"; - return "
    "; - } - else{ - $logic_event = self::get_logic_event($field, "keyup"); + if ( ! $is_ssl && isset( $_SERVER['HTTP_CF_VISITOR'] ) && strpos( $_SERVER['HTTP_CF_VISITOR'], 'https' ) ) { + $is_ssl = true; + } - if(rgget("emailConfirmEnabled", $field) && RG_CURRENT_VIEW != "entry"){ - $first_tabindex = self::get_tabindex(); - $last_tabindex = self::get_tabindex(); - return "
    "; - } - else{ - $tabindex = self::get_tabindex(); - return sprintf("
    ", $id, $field_id, $html_input_type, esc_attr($value), esc_attr($class), $disabled_text); - } - } + return apply_filters( 'gform_is_ssl', $is_ssl ); + } - break; - case "honeypot": - $autocomplete = RGFormsModel::is_html5_enabled() ? "autocomplete='off'" : ""; - return "
    "; - break; + public static function is_preview() { + $url_info = parse_url( RGFormsModel::get_current_page_url() ); + $file_name = basename( $url_info['path'] ); - case "hidden" : - if(!empty($post_link)) - return $post_link; + return $file_name == 'preview.php' || rgget( 'gf_page', $_GET ) == 'preview'; + } - $field_type = IS_ADMIN ? "text" : "hidden"; - $class_attribute = IS_ADMIN ? "" : "class='gform_hidden'"; + public static function clean_extensions( $extensions ) { + $count = sizeof( $extensions ); + for ( $i = 0; $i < $count; $i ++ ) { + $extensions[ $i ] = str_replace( '.', '', str_replace( ' ', '', $extensions[ $i ] ) ); + } - return sprintf("", $id, $field_id, esc_attr($value), $disabled_text); - break; + return $extensions; + } - case "html" : - $content = IS_ADMIN ? "
    " . __("HTML Content", "gravityforms") . "" . __("This is a content placeholder. HTML content is not displayed in the form admin. Preview this form to view the content.", "gravityforms") . "
    " : $field["content"]; - $content = GFCommon::replace_variables_prepopulate($content); //adding support for merge tags - $content = do_shortcode($content); //adding support for shortcodes - return $content; - break; + public static function get_disallowed_file_extensions() { + return array( 'php', 'asp', 'exe', 'com', 'htaccess', 'phtml', 'php3', 'php4', 'php5', 'php6' ); + } - case "adminonly_hidden" : - if(!is_array($field["inputs"])){ - if(is_array($value)) - $value = json_encode($value); - return sprintf("", $id, $field_id, esc_attr($value)); - } + public static function match_file_extension( $file_name, $extensions ) { + if ( empty ( $extensions ) || ! is_array( $extensions ) ) { + return false; + } + $ext = strtolower( pathinfo( $file_name, PATHINFO_EXTENSION ) ); + if ( in_array( $ext, $extensions ) ) { + return true; + } - $fields = ""; - foreach($field["inputs"] as $input){ - $fields .= sprintf("", $input["id"], esc_attr(rgar($value, strval($input["id"])))); - } - return $fields; - break; + return false; + } - case "number" : - if(!empty($post_link)) - return $post_link; + public static function file_name_has_disallowed_extension( $file_name ) { - $instruction = ""; - $read_only = ""; + return self::match_file_extension( $file_name, self::get_disallowed_file_extensions() ) || strpos( strtolower( $file_name ), '.php.' ) !== false; + } - if(!IS_ADMIN){ + public static function to_money( $number, $currency_code = '' ) { + if ( ! class_exists( 'RGCurrency' ) ) { + require_once( 'currency.php' ); + } - if(GFCommon::has_field_calculation($field)) { + if ( empty( $currency_code ) ) { + $currency_code = self::get_currency(); + } - // calculation-enabled fields should be read only - $read_only = 'readonly="readonly"'; + $currency = new RGCurrency( $currency_code ); - } else { + return $currency->to_money( $number ); + } - $message = self::get_range_message($field); - $validation_class = $field["failed_validation"] ? "validation_message" : ""; + public static function to_number( $text, $currency_code = '' ) { + if ( ! class_exists( 'RGCurrency' ) ) { + require_once( 'currency.php' ); + } - if(!$field["failed_validation"] && !empty($message) && empty($field["errorMessage"])) - $instruction = "
    " . $message . "
    "; + if ( empty( $currency_code ) ) { + $currency_code = self::get_currency(); + } - } + $currency = new RGCurrency( $currency_code ); - } - else if( RG_CURRENT_VIEW == "entry" ){ - $value = GFCommon::format_number($value, rgar($field, "numberFormat")); - } + return $currency->to_number( $text ); + } - $is_html5 = RGFormsModel::is_html5_enabled(); - $html_input_type = $is_html5 && !GFCommon::has_field_calculation($field) && ($field["numberFormat"] != "currency" && $field["numberFormat"] != "decimal_comma" ) ? "number" : "text"; // chrome does not allow number fields to have commas, calculations and currency values display numbers with commas - $step_attr = $is_html5 ? "step='any'" : ""; + public static function get_currency() { + $currency = get_option( 'rg_gforms_currency' ); + $currency = empty( $currency ) ? 'USD' : $currency; - $logic_event = self::get_logic_event($field, "keyup"); + return apply_filters( 'gform_currency', $currency ); + } - $value = GFCommon::format_number($value, $field["numberFormat"]); - - $tabindex = self::get_tabindex(); - return sprintf("
    %s
    ", $id, $field_id, esc_attr($value), esc_attr($class), $disabled_text, $instruction); - - case "donation" : - $tabindex = self::get_tabindex(); - return sprintf("
    ", $id, $field_id, esc_attr($value), esc_attr($class), $disabled_text); - - case "price" : - $logic_event = self::get_logic_event($field, "keyup"); - - $tabindex = self::get_tabindex(); - return sprintf("
    ", $id, $field_id, esc_attr($value), esc_attr($class), $disabled_text); - - case "phone" : - if(!empty($post_link)) - return $post_link; - - $instruction = $field["phoneFormat"] == "standard" ? __("Phone format:", "gravityforms") . " (###)###-####" : ""; - $instruction_div = rgget("failed_validation", $field) && !empty($instruction) ? "
    $instruction
    " : ""; - $html_input_type = RGFormsModel::is_html5_enabled() ? "tel" : "text"; - $logic_event = self::get_logic_event($field, "keyup"); + public static function get_simple_captcha() { + _deprecated_function( 'GFCommon::get_simple_captcha', '1.9', 'GFField_CAPTCHA::get_simple_captcha' ); + $captcha = new ReallySimpleCaptcha(); + $captcha->tmp_dir = RGFormsModel::get_upload_path( 'captcha' ) . '/'; - $tabindex = self::get_tabindex(); - return sprintf("
    {$instruction_div}
    ", $id, $field_id, esc_attr($value), esc_attr($class), $disabled_text); + return $captcha; + } - case "textarea": - $max_chars = ""; - $logic_event = self::get_logic_event($field, "keyup"); + /** + * @deprecated + * + * @param GF_Field_CAPTCH $field + * + * @return mixed + */ + public static function get_captcha( $field ) { + _deprecated_function( 'GFCommon::get_captcha', '1.9', 'GFField_CAPTCHA::get_captcha' ); + + return $field->get_captcha(); + } - $tabindex = self::get_tabindex(); - return sprintf("
    {$max_chars}", $id, $field_id, esc_attr($class), $disabled_text, esc_html($value)); + /** + * @deprecated + * + * @param $field + * @param $pos + * + * @return mixed + */ + public static function get_math_captcha( $field, $pos ) { + _deprecated_function( 'GFCommon::get_math_captcha', '1.9', 'GFField_CAPTCHA::get_math_captcha' ); + + return $field->get_math_captcha( $pos ); + } - case "post_title": - case "post_tags": - case "post_custom_field": - $tabindex = self::get_tabindex(); - $logic_event = self::get_logic_event($field, "keyup"); + private static function hex2rgb( $color ) { + if ( $color[0] == '#' ) { + $color = substr( $color, 1 ); + } - return !empty($post_link) ? $post_link : sprintf("
    ", $id, $field_id, esc_attr($value), esc_attr($class), $disabled_text); - break; + if ( strlen( $color ) == 6 ) { + list( $r, $g, $b ) = array( + $color[0] . $color[1], + $color[2] . $color[3], + $color[4] . $color[5], + ); + } elseif ( strlen( $color ) == 3 ) { + list( $r, $g, $b ) = array( $color[0] . $color[0], $color[1] . $color[1], $color[2] . $color[2] ); + } else { + return false; + } - case "post_content": - case "post_excerpt": - $max_chars = ""; - $logic_event = self::get_logic_event($field, "keyup"); + $r = hexdec( $r ); + $g = hexdec( $g ); + $b = hexdec( $b ); - $tabindex = self::get_tabindex(); - return !empty($post_link) ? $post_link : sprintf("
    {$max_chars}", $id, $field_id, esc_attr($class), $disabled_text, esc_html($value)); - break; + return array( $r, $g, $b ); + } - case "post_category" : - if(!empty($post_link)) - return $post_link; + /** + * @param GF_Field $field + * @param $value + * @param string $currency + * @param bool $use_text + * @param string $format + * @param string $media + * + * @return array|mixed|string + */ + public static function get_lead_field_display( $field, $value, $currency = '', $use_text = false, $format = 'html', $media = 'screen' ) { + + if ( ! $field instanceof GF_Field ) { + $field = GF_Fields::create( $field ); + } - if(rgget("displayAllCategories", $field) && !IS_ADMIN){ - $default_category = rgget("categoryInitialItemEnabled", $field) ? "-1" : get_option('default_category'); - $selected = empty($value) ? $default_category : $value; - $args = array('echo' => 0, 'selected' => $selected, "class" => esc_attr($class) . " gfield_select", 'hide_empty' => 0, 'name' => "input_$id", 'orderby' => 'name', 'hierarchical' => true ); - if(self::$tab_index > 0) - $args["tab_index"] = self::$tab_index++; + if ( $field->type == 'post_category' ) { + $value = self::prepare_post_category_value( $value, $field ); + } - if(rgget("categoryInitialItemEnabled", $field)){ - $args["show_option_none"] = empty($field["categoryInitialItem"]) ? " " : $field["categoryInitialItem"]; - } + return $field->get_value_entry_detail( $value, $currency, $use_text, $format, $media ); + } - $args = apply_filters("gform_post_category_args_{$field["id"]}", apply_filters("gform_post_category_args", $args, $field), $field); + public static function get_product_fields( $form, $lead, $use_choice_text = false, $use_admin_label = false ) { + $products = array(); - return "
    " . wp_dropdown_categories($args) . "
    "; - } - else{ - $tabindex = self::get_tabindex(); - if(is_array(rgar($field, "choices"))) - usort($field["choices"], create_function('$a,$b', 'return strcmp($a["text"], $b["text"]);')); + $product_info = null; + // retrieve static copy of product info (only for 'real' entries) + if ( ! rgempty( 'id', $lead ) ) { + $product_info = gform_get_meta( rgar( $lead, 'id' ), "gform_product_info_{$use_choice_text}_{$use_admin_label}" ); + } - $choices = self::get_select_choices($field, $value); + // if no static copy, generate from form/lead info + if ( ! $product_info ) { - //Adding first option - if(rgget("categoryInitialItemEnabled", $field)){ - $selected = empty($value) ? "selected='selected'" : ""; - $choices = "" . $choices; - } + foreach ( $form['fields'] as $field ) { + $id = $field->id; + $lead_value = RGFormsModel::get_lead_field_value( $lead, $field ); - return sprintf("
    ", $id, $field_id, esc_attr($class), $disabled_text, $choices); - } - break; + $quantity_field = self::get_product_fields_by_type( $form, array( 'quantity' ), $id ); + $quantity = sizeof( $quantity_field ) > 0 && ! RGFormsModel::is_field_hidden( $form, $quantity_field[0], array(), $lead ) ? RGFormsModel::get_lead_field_value( $lead, $quantity_field[0] ) : 1; - case "post_image" : - if(!empty($post_link)) - return $post_link; + switch ( $field->type ) { - $title = esc_attr(rgget($field["id"] . ".1", $value)); - $caption = esc_attr(rgget($field["id"] . ".4", $value)); - $description = esc_attr(rgget($field["id"] . ".7", $value)); + case 'product' : - //hidding meta fields for admin - $hidden_style = "style='display:none;'"; - $title_style = !rgget("displayTitle", $field) && IS_ADMIN ? $hidden_style : ""; - $caption_style = !rgget("displayCaption", $field) && IS_ADMIN ? $hidden_style : ""; - $description_style = !rgget("displayDescription", $field) && IS_ADMIN ? $hidden_style : ""; - $file_label_style = IS_ADMIN && !(rgget("displayTitle", $field) || rgget("displayCaption", $field) || rgget("displayDescription", $field)) ? $hidden_style : ""; - - $hidden_class = $preview = ""; - $file_info = RGFormsModel::get_temp_filename($form_id, "input_{$id}"); - if($file_info){ - $hidden_class = " gform_hidden"; - $file_label_style = $hidden_style; - $preview = "" . esc_html($file_info["uploaded_filename"]) . " | " . __("delete", "gravityforms") . ""; - } - - //in admin, render all meta fields to allow for immediate feedback, but hide the ones not selected - $file_label = (IS_ADMIN || rgget("displayTitle", $field) || rgget("displayCaption", $field) || rgget("displayDescription", $field)) ? "" : ""; - - $tabindex = self::get_tabindex(); - $upload = sprintf("{$preview}$file_label", $id, $field_id, esc_attr($value), esc_attr($class . $hidden_class), $disabled_text); - - $tabindex = self::get_tabindex(); - $title_field = rgget("displayTitle", $field) || IS_ADMIN ? sprintf("", $id, $field_id, $title, $disabled_text, $field_id) : ""; - - $tabindex = self::get_tabindex(); - $caption_field = rgget("displayCaption", $field) || IS_ADMIN ? sprintf("", $id, $field_id, $caption, $disabled_text, $field_id) : ""; - - $tabindex = self::get_tabindex(); - $description_field = rgget("displayDescription", $field) || IS_ADMIN? sprintf("", $id, $field_id, $description, $disabled_text, $field_id) : ""; - - return "
    " . $upload . $title_field . $caption_field . $description_field . "
    "; - - break; - - case "multiselect" : - if(!empty($post_link)) - return $post_link; - - $placeholder = rgar($field, "enableEnhancedUI") ? "data-placeholder='" . esc_attr(apply_filters("gform_multiselect_placeholder_{$form_id}", apply_filters("gform_multiselect_placeholder", __("Click to select...", "gravityforms"), $form_id), $form_id)) . "'" : ""; - $logic_event = self::get_logic_event($field, "keyup"); - $css_class = trim(esc_attr($class) . " gfield_select"); - $size = rgar($field, "multiSelectSize"); - if(empty($size)) - $size = 7; - - $tabindex = self::get_tabindex(); - return sprintf("
    ", $id, $field_id, $css_class, $disabled_text, self::get_select_choices($field, $value)); - - break; - - case "select" : - if(!empty($post_link)) - return $post_link; - - $logic_event = self::get_logic_event($field, "change"); - $css_class = trim(esc_attr($class) . " gfield_select"); - $tabindex = self::get_tabindex(); - return sprintf("
    ", $id, $field_id, $css_class, $disabled_text, self::get_select_choices($field, $value)); - - case "checkbox" : - if(!empty($post_link)) - return $post_link; - - return sprintf("
    ", $field_id, self::get_checkbox_choices($field, $value, $disabled_text)); - - case "radio" : - if(!empty($post_link)) - return $post_link; - - return sprintf("
    ", $field_id, self::get_radio_choices($field, $value, $disabled_text)); - - case "password" : - - $first_tabindex = self::get_tabindex(); - $last_tabindex = self::get_tabindex(); - - $strength_style = !rgar($field,"passwordStrengthEnabled") ? "style='display:none;'" : ""; - $strength = rgar($field,"passwordStrengthEnabled") || IS_ADMIN ? "
    " . __("Strength indicator", "gravityforms") . "
    " : ""; - - $action = !IS_ADMIN ? "gformShowPasswordStrength(\"$field_id\");" : ""; - $onchange= rgar($field,"passwordStrengthEnabled") ? "onchange='{$action}'" : ""; - $onkeyup = rgar($field,"passwordStrengthEnabled") ? "onkeyup='{$action}'" : ""; - - $pass = is_array( $value ) ? rgar( $value, $id ) : $value; - $confirm_pass = RGForms::post("input_" . $id ."_2"); - return sprintf("
    {$strength}", $id, $field_id, esc_attr($pass), $disabled_text, $field_id, $id, $field_id, esc_attr($confirm_pass), $disabled_text, $field_id); - - case "name" : - $prefix = ""; - $first = ""; - $last = ""; - $suffix = ""; - if(is_array($value)){ - $prefix = esc_attr(RGForms::get($field["id"] . ".2", $value)); - $first = esc_attr(RGForms::get($field["id"] . ".3", $value)); - $last = esc_attr(RGForms::get($field["id"] . ".6", $value)); - $suffix = esc_attr(RGForms::get($field["id"] . ".8", $value)); - } - switch(rgget("nameFormat", $field)){ - - case "extended" : - $prefix_tabindex = self::get_tabindex(); - $first_tabindex = self::get_tabindex(); - $last_tabindex = self::get_tabindex(); - $suffix_tabindex = self::get_tabindex(); - return sprintf("
    ", $id, $field_id, $prefix, $disabled_text, $field_id, $id, $field_id, $first, $disabled_text, $field_id, $id, $field_id, $last, $disabled_text, $field_id, $id, $field_id, $suffix, $disabled_text, $field_id); - - case "simple" : - $tabindex = self::get_tabindex(); - return sprintf("
    ", $id, $field_id, esc_attr($value), esc_attr($class), $disabled_text); - - default : - $first_tabindex = self::get_tabindex(); - $last_tabindex = self::get_tabindex(); - return sprintf("
    ", $id, $field_id, $first, $disabled_text, $field_id, $id, $field_id, $last, $disabled_text, $field_id); - } - - case "address" : - $street_value =""; - $street2_value =""; - $city_value =""; - $state_value =""; - $zip_value =""; - $country_value =""; - - if(is_array($value)){ - $street_value = esc_attr(rgget($field["id"] . ".1",$value)); - $street2_value = esc_attr(rgget($field["id"] . ".2",$value)); - $city_value = esc_attr(rgget($field["id"] . ".3",$value)); - $state_value = esc_attr(rgget($field["id"] . ".4",$value)); - $zip_value = esc_attr(rgget($field["id"] . ".5",$value)); - $country_value = esc_attr(rgget($field["id"] . ".6",$value)); - } - - $address_types = self::get_address_types($form_id); - $addr_type = empty($field["addressType"]) ? "international" : $field["addressType"]; - $address_type = $address_types[$addr_type]; - - $state_label = empty($address_type["state_label"]) ? __("State", "gravityforms") : $address_type["state_label"]; - $zip_label = empty($address_type["zip_label"]) ? __("Zip Code", "gravityforms") : $address_type["zip_label"]; - $hide_country = !empty($address_type["country"]) || rgget("hideCountry", $field); - - if(empty($country_value)) - $country_value = rgget("defaultCountry", $field); - - if(empty($state_value)) - $state_value = rgget("defaultState", $field); - - $country_list = self::get_country_dropdown($country_value); - - //changing css classes based on field format to ensure proper display - $address_display_format = apply_filters("gform_address_display_format", "default"); - $city_location = $address_display_format == "zip_before_city" ? "right" : "left"; - $zip_location = $address_display_format != "zip_before_city" && rgar($field,"hideState") ? "right" : "left"; - $state_location = $address_display_format == "zip_before_city" ? "left" : "right"; - $country_location = rgar($field,"hideState") ? "left" : "right"; - - //address field - $tabindex = self::get_tabindex(); - $street_address = sprintf("", $id, $field_id, $street_value, $disabled_text, $field_id); - - //address line 2 field - $street_address2 = ""; - $style = (IS_ADMIN && rgget("hideAddress2", $field)) ? "style='display:none;'" : ""; - if(IS_ADMIN || !rgget("hideAddress2", $field)){ - $tabindex = self::get_tabindex(); - $street_address2 = sprintf("", $id, $field_id, $street2_value, $disabled_text, $field_id); - } - - if($address_display_format == "zip_before_city"){ - //zip field - $tabindex = self::get_tabindex(); - $zip = sprintf("", $id, $field_id, $zip_value, $disabled_text, $field_id); - - //city field - $tabindex = self::get_tabindex(); - $city = sprintf("", $id, $field_id, $city_value, $disabled_text, $field_id); - - //state field - $style = (IS_ADMIN && rgget("hideState", $field)) ? "style='display:none;'" : ""; - if(IS_ADMIN || !rgget("hideState", $field)){ - $state_field = self::get_state_field($field, $id, $field_id, $state_value, $disabled_text, $form_id); - $state = sprintf("$state_field", $field_id); - } - else{ - $state = sprintf("", $id, $field_id, $state_value); - } - } - else{ - - //city field - $tabindex = self::get_tabindex(); - $city = sprintf("", $id, $field_id, $city_value, $disabled_text, $field_id); - - //state field - $style = (IS_ADMIN && rgget("hideState", $field)) ? "style='display:none;'" : ""; - if(IS_ADMIN || !rgget("hideState", $field)){ - $state_field = self::get_state_field($field, $id, $field_id, $state_value, $disabled_text, $form_id); - $state = sprintf("$state_field", $field_id); - } - else{ - $state = sprintf("", $id, $field_id, $state_value); - } - - //zip field - $tabindex = self::get_tabindex(); - $zip = sprintf("", $id, $field_id, $zip_value, $disabled_text, $field_id); - - } - - if(IS_ADMIN || !$hide_country){ - $style = $hide_country ? "style='display:none;'" : ""; - $tabindex = self::get_tabindex(); - $country = sprintf("", $id, $field_id, $disabled_text, $country_list, $field_id); - } - else{ - $country = sprintf("", $id, $field_id, $country_value); - } - - $inputs = $address_display_format == "zip_before_city" ? $street_address . $street_address2 . $zip . $city . $state . $country : $street_address . $street_address2 . $city . $state . $zip . $country; - - return "
    " . $inputs . "
    "; - - case "date" : - if(!empty($post_link)) - return $post_link; - - $format = empty($field["dateFormat"]) ? "mdy" : esc_attr($field["dateFormat"]); - $field_position = substr($format, 0, 3); - if(IS_ADMIN && RG_CURRENT_VIEW != "entry"){ - $datepicker_display = in_array(rgget("dateType", $field), array("datefield", "datedropdown")) ? "none" : "inline"; - $datefield_display = rgget("dateType", $field) == "datefield" ? "inline" : "none"; - $dropdown_display = rgget("dateType", $field) == "datedropdown" ? "inline" : "none"; - $icon_display = rgget("calendarIconType", $field) == "calendar" ? "inline" : "none"; - - $month_field = "
    "; - $day_field = "
    "; - $year_field = "
    "; - - $month_dropdown = "
    " . self::get_month_dropdown("","","","","disabled='disabled'") . "
    "; - $day_dropdown = "
    " . self::get_day_dropdown("","","","","disabled='disabled'") . "
    "; - $year_dropdown = "
    " . self::get_year_dropdown("","","","","disabled='disabled'") . "
    "; - - $field_string ="
    "; - - switch($field_position){ - case "dmy" : - $field_string .= $day_field . $month_field . $year_field . $day_dropdown . $month_dropdown . $year_dropdown; - break; - - case "ymd" : - $field_string .= $year_field . $month_field . $day_field . $year_dropdown . $month_dropdown . $day_dropdown; - break; - - default : - $field_string .= $month_field . $day_field . $year_field . $month_dropdown . $day_dropdown . $year_dropdown; - break; - } - - return $field_string; - } - else{ - $date_info = self::parse_date($value, $format); - $date_type = rgget("dateType", $field); - if(in_array($date_type, array("datefield", "datedropdown"))) - { - switch($field_position){ - - case "dmy" : - $tabindex = self::get_tabindex(); - $field_str = $date_type == "datedropdown" - ? "
    " . self::get_day_dropdown("input_{$id}[]", "{$field_id}_2", rgar($date_info,"day"), $tabindex, $disabled_text) . "
    " - : sprintf("
    ", $field_id, $id, $field_id, esc_attr(rgget("day", $date_info)), $disabled_text, $field_id); - - $tabindex = self::get_tabindex(); - $field_str .= $date_type == "datedropdown" - ? "
    " . self::get_month_dropdown("input_{$id}[]", "{$field_id}_1", rgar($date_info,"month"), $tabindex, $disabled_text) . "
    " - : sprintf("
    ", $field_id, $id, $field_id, esc_attr(rgget("month", $date_info)), $disabled_text, $field_id); - - $tabindex = self::get_tabindex(); - $field_str .= $date_type == "datedropdown" - ? "
    " . self::get_year_dropdown("input_{$id}[]", "{$field_id}_3", rgar($date_info,"year"), $tabindex, $disabled_text) . "
    " - : sprintf("
    ", $field_id, $id, $field_id, esc_attr(rgget("year", $date_info)), $disabled_text, $field_id); - - break; - - case "ymd" : - $tabindex = self::get_tabindex(); - $field_str = $date_type == "datedropdown" - ? "
    " . self::get_year_dropdown("input_{$id}[]", "{$field_id}_3", rgar($date_info,"year"), $tabindex, $disabled_text) . "
    " - : sprintf("
    ", $field_id, $id, $field_id, esc_attr(rgget("year", $date_info)), $disabled_text, $field_id); - - $field_str .= $date_type == "datedropdown" - ? "
    " . self::get_month_dropdown("input_{$id}[]", "{$field_id}_1", rgar($date_info,"month"), $tabindex, $disabled_text) . "
    " - : sprintf("
    ", $field_id, $id, $field_id, esc_attr(rgar($date_info,"month")), $disabled_text, $field_id); - - $tabindex = self::get_tabindex(); - $field_str .= $date_type == "datedropdown" - ? "
    " . self::get_day_dropdown("input_{$id}[]", "{$field_id}_2", rgar($date_info,"day"), $tabindex, $disabled_text) . "
    " - : sprintf("
    ", $field_id, $id, $field_id, esc_attr(rgar($date_info,"day")), $disabled_text, $field_id); - - break; - - default : - $tabindex = self::get_tabindex(); - - $field_str = $date_type == "datedropdown" - ? "
    " . self::get_month_dropdown("input_{$id}[]", "{$field_id}_1", rgar($date_info,"month"), $tabindex, $disabled_text) . "
    " - : sprintf("
    ", $field_id, $id, $field_id, esc_attr(rgar($date_info,"month")), $disabled_text, $field_id); - - $tabindex = self::get_tabindex(); - $field_str .= $date_type == "datedropdown" - ? "
    " . self::get_day_dropdown("input_{$id}[]", "{$field_id}_2", rgar($date_info,"day"), $tabindex, $disabled_text) . "
    " - : sprintf("
    ", $field_id, $id, $field_id, esc_attr(rgar($date_info,"day")), $disabled_text, $field_id); - - $tabindex = self::get_tabindex(); - $field_str .= $date_type == "datedropdown" - ? "
    " . self::get_year_dropdown("input_{$id}[]", "{$field_id}_3", rgar($date_info,"year"), $tabindex, $disabled_text) . "
    " - : sprintf("
    ", $field_id, $id, $field_id, esc_attr(rgget("year", $date_info)), $disabled_text, $field_id); - - break; - } - - return $field_str; - } - else - { - $value = GFCommon::date_display($value, $format); - $icon_class = $field["calendarIconType"] == "none" ? "datepicker_no_icon" : "datepicker_with_icon"; - $icon_url = empty($field["calendarIconUrl"]) ? GFCommon::get_base_url() . "/images/calendar.png" : $field["calendarIconUrl"]; - $tabindex = self::get_tabindex(); - return sprintf("
    ", $id, $field_id, esc_attr($value), esc_attr($class), $format, $icon_class, $disabled_text); - } - } - - case "time" : - if(!empty($post_link)) - return $post_link; - - $hour = $minute = $am_selected = $pm_selected = ""; - - if(!is_array($value) && !empty($value)){ - preg_match('/^(\d*):(\d*) ?(.*)$/', $value, $matches); - $hour = esc_attr($matches[1]); - $minute = esc_attr($matches[2]); - $am_selected = rgar($matches,3) == "am" ? "selected='selected'" : ""; - $pm_selected = rgar($matches,3) == "pm" ? "selected='selected'" : ""; - } - else if(is_array($value)){ - $hour = esc_attr($value[0]); - $minute = esc_attr($value[1]); - $am_selected = rgar($value,2) == "am" ? "selected='selected'" : ""; - $pm_selected = rgar($value,2) == "pm" ? "selected='selected'" : ""; - } - $hour_tabindex = self::get_tabindex(); - $minute_tabindex = self::get_tabindex(); - $ampm_tabindex = self::get_tabindex(); - - $ampm_field_style = is_admin() && rgar($field, "timeFormat") == "24" ? "style='display:none;'" : ""; - $ampm_field = is_admin() || rgar($field, "timeFormat") != "24" ? "
    " : ""; - - return sprintf("
    :
    {$ampm_field}
    ", $field_id, $id, $field_id, $hour, $disabled_text, $field_id, $id, $field_id, $minute, $disabled_text, $field_id); - - case "fileupload" : - $tabindex = self::get_tabindex(); - $multiple_files = rgar($field, "multipleFiles"); - $file_list_id = "gform_preview_" . $form_id . "_". $id; - $max_upload_size = ! IS_ADMIN && isset($field["maxFileSize"]) && $field["maxFileSize"] > 0 ? $field["maxFileSize"] * 1048576: wp_max_upload_size(); - if($multiple_files){ - $upload_action_url = trailingslashit(site_url()) . "?gf_page=upload"; - $max_files = isset($field["maxFiles"]) && $field["maxFiles"] > 0 ? $field["maxFiles"]: 0; - $browse_button_id = 'gform_browse_button_' . $form_id . "_" . $id; - $container_id = 'gform_multifile_upload_' . $form_id . "_" . $id; - $drag_drop_id = 'gform_drag_drop_area_' . $form_id . "_" . $id; - - $messages_id = "gform_multifile_messages_{$form_id}_{$id}"; - $allowed_extensions = isset($field["allowedExtensions"]) && !empty($field["allowedExtensions"]) ? join(",", GFCommon::clean_extensions(explode(",", strtolower($field["allowedExtensions"])))) : array(); - if(empty($allowed_extensions)) - $allowed_extensions="*"; - $disallowed_extensions = GFCommon::get_disallowed_file_extensions(); - - if( defined('DOING_AJAX') && DOING_AJAX && "rg_change_input_type" === rgpost('action')){ - $plupload_init = array(); - } else { - $plupload_init = array( - 'runtimes' => 'html5,flash,html4', - 'browse_button' => $browse_button_id, - 'container' => $container_id, - 'drop_element' => $drag_drop_id, - 'filelist' => $file_list_id, - 'unique_names' => true, - 'file_data_name' => 'file', - /*'chunk_size' => '10mb',*/ // chunking doesn't currently have very good cross-browser support - 'url' => $upload_action_url, - 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'), - 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'), - 'filters' => array( - 'mime_types' => array(array('title' => __( 'Allowed Files', 'gravityforms' ), 'extensions' => $allowed_extensions)), - 'max_file_size' => $max_upload_size . 'b' - ), - 'multipart' => true, - 'urlstream_upload' => false, - 'multipart_params' => array( - "form_id" => $form_id, - "field_id" => $id - ), - 'gf_vars' => array( - 'max_files' => $max_files, - 'message_id' => $messages_id, - 'disallowed_extensions' => $disallowed_extensions - ) - ); - - // plupload 2 was introduced in WordPress 3.9. Plupload 1 accepts a slightly different init array. - if (version_compare(get_bloginfo('version'), "3.9-RC1", "<")) { - $plupload_init['max_file_size'] = $max_upload_size . 'b'; - $plupload_init['filters'] = array(array('title' => __('Allowed Files', 'gravityforms'), 'extensions' => $allowed_extensions)); - } - } - - - $plupload_init = apply_filters("gform_plupload_settings_{$form_id}", apply_filters('gform_plupload_settings', $plupload_init, $form_id, $field), $form_id, $field); - - // Multi-file uploading doesn't currently work in iOS Safari, - // single-file allows the built-in camera to be used as source for images - if ( wp_is_mobile() ) - $plupload_init['multi_selection'] = false; - - $plupload_init_json = htmlspecialchars(json_encode($plupload_init), ENT_QUOTES, 'UTF-8'); - $upload = sprintf("
    %s
    ",$container_id, $plupload_init_json, $drag_drop_id, __("Drop files here or" ,"gravityforms"), $browse_button_id, __("Select files", "gravityforms") ) ; - if(!IS_ADMIN) - $upload .= "
    "; - - if(IS_ADMIN && RG_CURRENT_VIEW === "entry") - $upload .= sprintf('', $id, esc_attr($value)); - - } else { - $upload = ''; - if ( $max_upload_size <= 2047 * 1048576 ) { - // MAX_FILE_SIZE > 2048MB fails. The file size is checked anyway once uploaded, so it's not necessary. - $upload = sprintf( "", $max_upload_size ); - } - $upload .= sprintf("", $id, $field_id, esc_attr($class), $disabled_text); - } - - if(IS_ADMIN && RG_CURRENT_VIEW === "entry" && !empty($value)){ // edit entry - $file_urls = $multiple_files ? json_decode($value) : array($value); - $upload_display = $multiple_files ? "" : "style='display:none'"; - $preview = "
    $upload
    "; - $preview .= sprintf("
    ", $file_list_id); - $preview .= sprintf("
    ", $id); - - foreach($file_urls as $file_index => $file_url){ - if(self::is_ssl() && strpos($file_url, "http:") !== false ){ - $file_url = str_replace("http:", "https:", $file_url); - } - $file_url = esc_attr($file_url); - $preview .= sprintf("
    %s
    ", $file_index, $file_url, $file_url, $file_url, GFCommon::truncate_url($file_url), $file_url, GFCommon::get_base_url() . "/images/download.png", $lead_id, $id, GFCommon::get_base_url() . "/images/delete.png"); - } - - $preview .="
    "; - - return $preview; - } else { - $input_name = "input_{$id}"; - $uploaded_files = isset(GFFormsModel::$uploaded_files[$form_id][$input_name]) ? GFFormsModel::$uploaded_files[$form_id][$input_name] : array(); - $file_infos = $multiple_files ? $uploaded_files : RGFormsModel::get_temp_filename($form_id, $input_name); - - if(!empty($file_infos)){ - $preview = sprintf("
    ", $file_list_id); - $file_infos = $multiple_files ? $uploaded_files : array($file_infos); - foreach($file_infos as $file_info){ - $preview .= "
    " . esc_html($file_info["uploaded_filename"]) . "
    "; - } - $preview .= "
    "; - if(!$multiple_files) - $upload = str_replace(" class='", " class='gform_hidden ", $upload); - return "
    " . $upload . " {$preview}
    "; - } - else{ - - $preview = $multiple_files ? sprintf("
    ", $file_list_id) : ""; - - return "
    $upload
    " . $preview; - } - } - - case "captcha" : - - switch(rgget("captchaType", $field)){ - case "simple_captcha" : - $size = rgempty("simpleCaptchaSize", $field) ? "medium" : $field["simpleCaptchaSize"]; - $captcha = self::get_captcha($field); - - $tabindex = self::get_tabindex(); - - $dimensions = IS_ADMIN ? "" : "width='" . rgar($captcha,"width") . "' height='" . rgar($captcha,"height") . "'"; - return "
    "; - break; - - case "math" : - $size = empty($field["simpleCaptchaSize"]) ? "medium" : $field["simpleCaptchaSize"]; - $captcha_1 = self::get_math_captcha($field, 1); - $captcha_2 = self::get_math_captcha($field, 2); - $captcha_3 = self::get_math_captcha($field, 3); - - $tabindex = self::get_tabindex(); - - $dimensions = IS_ADMIN ? "" : "width='{$captcha_1["width"]}' height='{$captcha_1["height"]}'"; - return "
    "; - break; - - default: - - if(!function_exists("recaptcha_get_html")){ - require_once(GFCommon::get_base_path() . '/recaptchalib.php'); - } - - $theme = empty($field["captchaTheme"]) ? "red" : esc_attr($field["captchaTheme"]); - $publickey = get_option("rg_gforms_captcha_public_key"); - $privatekey = get_option("rg_gforms_captcha_private_key"); - if(IS_ADMIN){ - if(empty($publickey) || empty($privatekey)){ - return "
    " . __("To use the reCaptcha field you must first do the following:", "gravityforms") . "
    1 - " . sprintf(__("Sign up%s for a free reCAPTCHA account", "gravityforms"), "") . "
    2 - " . sprintf(__("Enter your reCAPTCHA keys in the %ssettings page%s", "gravityforms"), "", "") . "
    "; - } - else{ - return "
    reCAPTCHA
    "; - } - } - else{ - $language = empty($field["captchaLanguage"]) ? "en" : esc_attr($field["captchaLanguage"]); - - if(empty(self::$tab_index)) - self::$tab_index = 1; - - $options = ""; - - $is_ssl = !empty($_SERVER['HTTPS']); - return $options . "
    " . recaptcha_get_html($publickey, null, $is_ssl, $language) . "
    "; - } - } - break; - - case "creditcard" : - - $card_number = ""; - $card_name = ""; - $expiration_date = ""; - $expiration_month = ""; - $expiration_year = ""; - $security_code = ""; - $autocomplete = RGFormsModel::is_html5_enabled() ? "autocomplete='off'" : ""; - - if(is_array($value)){ - $card_number = esc_attr(rgget($field["id"] . ".1",$value)); - $card_name = esc_attr(rgget($field["id"] . ".5",$value)); - $expiration_date = rgget($field["id"] . ".2",$value); - if(!is_array($expiration_date) && !empty($expiration_date)) - $expiration_date = explode("/", $expiration_date); - - if(is_array($expiration_date) && count($expiration_date) == 2){ - $expiration_month = $expiration_date[0]; - $expiration_year = $expiration_date[1]; - } - - $security_code = esc_attr(rgget($field["id"] . ".3",$value)); - } - - $action = !IS_ADMIN ? "gformMatchCard(\"{$field_id}_1\");" : ""; - - $onchange= "onchange='{$action}'"; - $onkeyup = "onkeyup='{$action}'"; - - $card_icons = ''; - $cards = GFCommon::get_card_types(); - $card_style = rgar($field, 'creditCardStyle') ? rgar($field, 'creditCardStyle') : 'style1'; - - foreach($cards as $card) { + //ignore products that have been hidden by conditional logic + $is_hidden = RGFormsModel::is_field_hidden( $form, $field, array(), $lead ); + if ( $is_hidden ) { + continue; + } - $style = ""; - if(self::is_card_supported($field, $card["slug"])){ - $print_card = true; - } - else if (IS_ADMIN){ - $print_card = true; - $style = "style='display:none;'"; - } - else{ - $print_card = false; - } - - if($print_card){ - $card_icons .= "
    {$card['name']}
    "; - } - } - - $payment_methods = apply_filters("gform_payment_methods", array(), $field, $form_id); - $payment_options = ""; - if(is_array($payment_methods)){ - foreach($payment_methods as $payment_method){ - $checked = rgpost("gform_payment_method") == $payment_method["key"] ? "checked='checked'" : ""; - $payment_options .="
    {$payment_method["label"]}
    "; - } - } - $checked = rgpost("gform_payment_method") == "creditcard" || rgempty("gform_payment_method") ? "checked='checked'" : ""; - $card_radio_button = empty($payment_options) ? "" : ""; - $card_icons = "{$payment_options}
    {$card_radio_button}{$card_icons}
    "; - - - - //card number fields - $tabindex = self::get_tabindex(); - $html5_output = ! is_admin() && GFFormsModel::is_html5_enabled() ? "pattern='[0-9]*' title='" . __("Only digits are allowed", "gravityforms") . "'" : ""; - $card_field = sprintf("{$card_icons}", $id, $field_id, $card_number, $disabled_text, $field_id); - - //expiration date field - $expiration_field = "". - - "". - - "". - - // month selector - "". - - // year selector - "". - - // label for the expiration fields - "". - - "". - ""; - - //security code field - $tabindex = self::get_tabindex(); - $html5_output = GFFormsModel::is_html5_enabled() ? "pattern='[0-9]*' title='" . __("Only digits are allowed", "gravityforms") . "'" : ""; - $security_field = "". - "". - " ". - "". - "". - ""; - - $tabindex = self::get_tabindex(); - $card_name_field = sprintf("", $id, $field_id, $card_name, $disabled_text, $field_id); - - return "
    " . $card_field . $expiration_field . $security_field . $card_name_field . "
    "; - - break; + //if single product, get values from the multiple inputs + if ( is_array( $lead_value ) ) { + $product_quantity = sizeof( $quantity_field ) == 0 && ! $field->disableQuantity ? rgget( $id . '.3', $lead_value ) : $quantity; + if ( empty( $product_quantity ) ) { + continue; + } - case "list" : + if ( ! rgget( $id, $products ) ) { + $products[ $id ] = array(); + } - if(!empty($value)) - $value = maybe_unserialize($value); + $products[ $id ]['name'] = $use_admin_label && ! rgempty( 'adminLabel', $field ) ? $field->adminLabel : $lead_value[ $id . '.1' ]; + $products[ $id ]['price'] = rgar( $lead_value, $id . '.2' ); + $products[ $id ]['quantity'] = $product_quantity; + } else if ( ! empty( $lead_value ) ) { - if(!is_array($value)) - $value = array(array()); + if ( empty( $quantity ) ) { + continue; + } - $has_columns = is_array(rgar($field, "choices")); - $columns = $has_columns ? rgar($field, "choices") : array(array()); + if ( ! rgar( $products, $id ) ) { + $products[ $id ] = array(); + } - $shim_style = is_rtl() ? 'position:absolute;left:999em;' : 'position:absolute;left:-999em;'; - $label_target_shim = sprintf( '', $form_id, $field['id'], $shim_style ); + if ( $field->inputType == 'price' ) { + $name = $field->label; + $price = $lead_value; + } else { + list( $name, $price ) = explode( '|', $lead_value ); + } - $list = "
    " . - $label_target_shim . - ""; + $products[ $id ]['name'] = ! $use_choice_text ? $name : RGFormsModel::get_choice_text( $field, $name ); + $products[ $id ]['price'] = $price; + $products[ $id ]['quantity'] = $quantity; + $products[ $id ]['options'] = array(); + } - $class_attr = ""; - if($has_columns){ + if ( isset( $products[ $id ] ) ) { + $options = self::get_product_fields_by_type( $form, array( 'option' ), $id ); + foreach ( $options as $option ) { + $option_value = RGFormsModel::get_lead_field_value( $lead, $option ); + $option_label = empty( $option['adminLabel'] ) ? $option['label'] : $option['adminLabel']; + if ( is_array( $option_value ) ) { + foreach ( $option_value as $value ) { + $option_info = self::get_option_info( $value, $option, $use_choice_text ); + if ( ! empty( $option_info ) ) { + $products[ $id ]['options'][] = array( 'field_label' => rgar( $option, 'label' ), 'option_name' => rgar( $option_info, 'name' ), 'option_label' => $option_label . ': ' . rgar( $option_info, 'name' ), 'price' => rgar( $option_info, 'price' ) ); + } + } + } else if ( ! empty( $option_value ) ) { + $option_info = self::get_option_info( $option_value, $option, $use_choice_text ); + $products[ $id ]['options'][] = array( 'field_label' => rgar( $option, 'label' ), 'option_name' => rgar( $option_info, 'name' ), 'option_label' => $option_label . ': ' . rgar( $option_info, 'name' ), 'price' => rgar( $option_info, 'price' ) ); + } + } + } + break; + } + } - $list .= ''; - for( $colnum = 1; $colnum <= count( $columns ) + 1; $colnum++ ) { - $odd_even = ( $colnum % 2 ) == 0 ? 'even' : 'odd'; - $list .= sprintf( "", $field['id'], $colnum, $odd_even ); - } - $list .= ''; + $shipping_field = self::get_fields_by_type( $form, array( 'shipping' ) ); + $shipping_price = $shipping_name = ''; + $shipping_field_id = ''; + if ( ! empty( $shipping_field ) && ! RGFormsModel::is_field_hidden( $form, $shipping_field[0], array(), $lead ) ) { + $shipping_price = RGFormsModel::get_lead_field_value( $lead, $shipping_field[0] ); + $shipping_name = $shipping_field[0]['label']; + $shipping_field_id = $shipping_field[0]['id']; + if ( $shipping_field[0]['inputType'] != 'singleshipping' ) { + list( $shipping_method, $shipping_price ) = explode( '|', $shipping_price ); + $shipping_name = $shipping_field[0]['label'] . " ($shipping_method)"; + } + } + $shipping_price = self::to_number( $shipping_price ); - $list .= ""; - foreach($columns as $column){ - $list .= ""; - } - $list .= ""; - } - else{ - $list .= - '' . - "" . - "" . - ''; - } + $product_info = array( 'products' => $products, 'shipping' => array( 'id' => $shipping_field_id, 'name' => $shipping_name, 'price' => $shipping_price ) ); - $delete_display = count($value) == 1 ? "visibility:hidden;" : ""; - $maxRow = intval(rgar($field, "maxRows")); - $disabled_icon_class = !empty($maxRow) && count($value) >= $maxRow ? "gfield_icon_disabled" : ""; + $product_info = apply_filters( "gform_product_info_{$form['id']}", apply_filters( 'gform_product_info', $product_info, $form, $lead ), $form, $lead ); - $list .= ""; - $rownum = 1; - foreach($value as $item){ + // save static copy of product info (only for 'real' entries) + if ( ! rgempty( 'id', $lead ) && ! empty( $product_info['products'] ) ) { + gform_update_meta( $lead['id'], "gform_product_info_{$use_choice_text}_{$use_admin_label}", $product_info ); + } + } - $odd_even = ($rownum % 2) == 0 ? "even" : "odd"; + return $product_info; + } - $list .= ""; - $colnum = 1; - foreach($columns as $column){ + public static function get_order_total( $form, $lead ) { - //getting value. taking into account columns being added/removed from form meta - if(is_array($item)){ - if($has_columns){ - $val = rgar($item, $column["text"]); - } - else{ - $vals = array_values($item); - $val = rgar($vals, 0); - } - } - else{ - $val = $colnum == 1 ? $item : ""; - } + $products = self::get_product_fields( $form, $lead, false ); - $list .= ""; - $colnum++; - } + return self::get_total( $products ); + } - $add_icon = !rgempty("addIconUrl", $field) ? $field["addIconUrl"] : GFCommon::get_base_url() . "/images/add.png"; - $delete_icon = !rgempty("deleteIconUrl", $field) ? $field["deleteIconUrl"] : GFCommon::get_base_url() . "/images/remove.png"; + public static function get_total( $products ) { - $on_click = IS_ADMIN && RG_CURRENT_VIEW != "entry" ? "" : "onclick='gformAddListItem(this, {$maxRow})'"; + $total = 0; + foreach ( $products['products'] as $product ) { - if(rgar($field, "maxRows") != 1){ + $price = self::to_number( $product['price'] ); + if ( is_array( rgar( $product, 'options' ) ) ) { + foreach ( $product['options'] as $option ) { + $price += self::to_number( $option['price'] ); + } + } + $subtotal = floatval( $product['quantity'] ) * $price; + $total += $subtotal; - // can't replace these icons with the webfont versions since they appear on the front end. + } - $list .=""; - } + return $total; + } - $list .= ""; + public static function get_option_info( $value, $option, $use_choice_text ) { + if ( empty( $value ) ) { + return array(); + } - if(!empty($maxRow) && $rownum >= $maxRow) - break; + list( $name, $price ) = explode( '|', $value ); + if ( $use_choice_text ) { + $name = RGFormsModel::get_choice_text( $option, $name ); + } - $rownum++; - } + return array( 'name' => $name, 'price' => $price ); + } - $list .="
    " . esc_html($column["text"]) . " 
    " . self::get_list_input($field, $has_columns, $column, $val, $form_id) . ""; - $list .=" " . __("Add a row", "gravityforms") . "" . - " " . __("Remove this row", "gravityforms") . ""; + $total += floatval( $products['shipping']['price'] ); - $list .="
    "; + public static function gform_do_shortcode( $content ) { - return $list; - break; - } - } + $is_ajax = false; + $forms = GFFormDisplay::get_embedded_forms( $content, $is_ajax ); - public static function is_ssl(){ - global $wordpress_https; - $is_ssl = false; + foreach ( $forms as $form ) { + if ( headers_sent() ) { + GFFormDisplay::print_form_scripts( $form, $is_ajax ); + } else { + GFFormDisplay::enqueue_form_scripts( $form, $is_ajax ); + } + } - $has_https_plugin = class_exists('WordPressHTTPS') && isset($wordpress_https); - $has_is_ssl_method = $has_https_plugin && method_exists('WordPressHTTPS', 'is_ssl'); - $has_isSsl_method = $has_https_plugin && method_exists('WordPressHTTPS', 'isSsl'); + return do_shortcode( $content ); + } - //Use the WordPress HTTPs plugin if installed - if ($has_https_plugin && $has_is_ssl_method){ - $is_ssl = $wordpress_https->is_ssl(); - } - else if ($has_https_plugin && $has_isSsl_method){ - $is_ssl = $wordpress_https->isSsl(); - } - else{ - $is_ssl = is_ssl(); - } + public static function spam_enabled( $form_id ) { + $spam_enabled = self::akismet_enabled( $form_id ) || has_filter( 'gform_entry_is_spam' ) || has_filter( "gform_entry_is_spam_{$form_id}" ); + return $spam_enabled; + } - if(!$is_ssl && isset($_SERVER["HTTP_CF_VISITOR"]) && strpos($_SERVER["HTTP_CF_VISITOR"], "https")){ - $is_ssl=true; - } + public static function has_akismet() { + $akismet_exists = function_exists( 'akismet_http_post' ) || function_exists( 'Akismet::http_post' ); - return apply_filters("gform_is_ssl", $is_ssl); - } + return $akismet_exists; + } - public static function is_card_supported($field, $card_slug){ - $supported_cards = rgar($field, 'creditCards'); - $default_cards = array('amex', 'discover', 'mastercard', 'visa'); + public static function akismet_enabled( $form_id ) { - if(!empty($supported_cards) && in_array($card_slug, $supported_cards)) { - return true; - } - else if(empty($supported_cards) && in_array($card_slug, $default_cards)) { - return true; - } + if ( ! self::has_akismet() ) { + return false; + } - return false; + // if no option is set, leave akismet enabled; otherwise, use option value true/false + $enabled_by_setting = get_option( 'rg_gforms_enable_akismet' ) === false ? true : get_option( 'rg_gforms_enable_akismet' ) == true; + $enabled_by_filter = apply_filters( "gform_akismet_enabled_$form_id", apply_filters( 'gform_akismet_enabled', $enabled_by_setting ) ); - } + return $enabled_by_filter; - public static function is_preview(){ - $url_info = parse_url(RGFormsModel::get_current_page_url()); - $file_name = basename($url_info["path"]); - return $file_name == "preview.php" || rgget("gf_page", $_GET) == "preview"; - } + } - private static function get_expiration_months($selected_month){ - $str = ""; - for($i=1; $i<13; $i++){ - $selected = intval($selected_month) == $i ? "selected='selected'" : ""; - $month = str_pad($i, 2, "0", STR_PAD_LEFT); - $str .= ""; - } - return $str; - } + public static function is_akismet_spam( $form, $lead ) { - private static function get_expiration_years($selected_year){ - $str = ""; - $year = intval(date("Y")); - for($i=$year; $i < ($year + 20); $i++){ - $selected = intval($selected_year) == $i ? "selected='selected'" : ""; - $str .= ""; - } - return $str; - } + global $akismet_api_host, $akismet_api_port; - private static function get_list_input($field, $has_columns, $column, $value, $form_id){ + $fields = self::get_akismet_fields( $form, $lead ); - $tabindex = GFCommon::get_tabindex(); + //Submitting info to Akismet + if ( defined( 'AKISMET_VERSION' ) && AKISMET_VERSION < 3.0 ) { + //Akismet versions before 3.0 + $response = akismet_http_post( $fields, $akismet_api_host, '/1.1/comment-check', $akismet_api_port ); + } else { + $response = Akismet::http_post( $fields, 'comment-check' ); + } + $is_spam = trim( rgar( $response, 1 ) ) == 'true'; - $column_index = 1; - if($has_columns && is_array(rgar($field, "choices"))){ - foreach($field["choices"] as $choice){ - if($choice["text"] == $column["text"]) - break; + return $is_spam; + } - $column_index++; - } - } - $input_info = array("type" => "text"); - - $input_info = apply_filters("gform_column_input_{$form_id}_{$field["id"]}_{$column_index}", apply_filters("gform_column_input", $input_info, $field, rgar($column, "text"), $value, $form_id), $field, rgar($column, "text"), $value, $form_id); - - switch($input_info["type"]){ - - case "select" : - $input = ""; - - break; - - default : - $input = ""; - break; - } + public static function mark_akismet_spam( $form, $lead, $is_spam ) { - return apply_filters("gform_column_input_content_{$form_id}_{$field["id"]}_{$column_index}", - apply_filters("gform_column_input_content", $input, $input_info, $field, rgar($column, "text"), $value, $form_id), - $input_info, $field, rgar($column, "text"), $value, $form_id); + global $akismet_api_host, $akismet_api_port; - } + $fields = self::get_akismet_fields( $form, $lead ); + $as = $is_spam ? 'spam' : 'ham'; - public static function clean_extensions($extensions){ - $count = sizeof($extensions); - for($i=0; $i<$count; $i++){ - $extensions[$i] = str_replace(".", "",str_replace(" ", "", $extensions[$i])); - } - return $extensions; - } + //Submitting info to Akismet + if ( defined( 'AKISMET_VERSION' ) && AKISMET_VERSION < 3.0 ) { + //Akismet versions before 3.0 + akismet_http_post( $fields, $akismet_api_host, '/1.1/submit-' . $as, $akismet_api_port ); + } else { + Akismet::http_post( $fields, 'submit-' . $as ); + } + } - public static function get_disallowed_file_extensions(){ - return array("php", "asp", "exe", "com", "htaccess", "phtml", "php3", "php4", "php5", "php6"); - } + private static function get_akismet_fields( $form, $lead ) { + + $is_form_editor = GFCommon::is_form_editor(); + $is_entry_detail = GFCommon::is_entry_detail(); + $is_admin = $is_form_editor || $is_entry_detail; + + //Gathering Akismet information + $akismet_info = array(); + $akismet_info['comment_type'] = 'gravity_form'; + $akismet_info['comment_author'] = self::get_akismet_field( 'name', $form, $lead ); + $akismet_info['comment_author_email'] = self::get_akismet_field( 'email', $form, $lead ); + $akismet_info['comment_author_url'] = self::get_akismet_field( 'website', $form, $lead ); + $akismet_info['comment_content'] = self::get_akismet_field( 'textarea', $form, $lead ); + $akismet_info['contact_form_subject'] = $form['title']; + $akismet_info['comment_author_IP'] = $lead['ip']; + $akismet_info['permalink'] = $lead['source_url']; + $akismet_info['user_ip'] = preg_replace( '/[^0-9., ]/', '', $lead['ip'] ); + $akismet_info['user_agent'] = $lead['user_agent']; + $akismet_info['referrer'] = $is_admin ? '' : $_SERVER['HTTP_REFERER']; + $akismet_info['blog'] = get_option( 'home' ); + + $akismet_info = apply_filters( "gform_akismet_fields_{$form['id']}", apply_filters( 'gform_akismet_fields', $akismet_info, $form, $lead ), $form, $lead ); + + return http_build_query( $akismet_info ); + } - public static function match_file_extension( $file_name, $extensions ) { - if ( empty ( $extensions ) || ! is_array( $extensions ) ) { - return false; + private static function get_akismet_field( $field_type, $form, $lead ) { + $fields = GFCommon::get_fields_by_type( $form, array( $field_type ) ); + if ( empty( $fields ) ) { + return ''; } - $ext = strtolower( pathinfo( $file_name, PATHINFO_EXTENSION ) ); - if ( in_array( $ext, $extensions ) ) { - return true; + $value = RGFormsModel::get_lead_field_value( $lead, $fields[0] ); + switch ( $field_type ) { + case 'name' : + $value = GFCommon::get_lead_field_display( $fields[0], $value ); + break; } - return false; + return $value; } - public static function file_name_has_disallowed_extension( $file_name ) { + public static function get_other_choice_value() { + $value = apply_filters( 'gform_other_choice_value', __( 'Other' , 'gravityforms' ) ); - return self::match_file_extension( $file_name, self::get_disallowed_file_extensions() ) || strpos( strtolower( $file_name ), '.php.' ) !== false; + return $value; } - public static function to_money($number, $currency_code=""){ - if(!class_exists("RGCurrency")) - require_once("currency.php"); - - if(empty($currency_code)) - $currency_code = self::get_currency(); - - $currency = new RGCurrency($currency_code); - return $currency->to_money($number); - } - - public static function to_number($text, $currency_code=""){ - if(!class_exists("RGCurrency")) - require_once("currency.php"); - - if(empty($currency_code)) - $currency_code = self::get_currency(); - - $currency = new RGCurrency($currency_code); - - return $currency->to_number($text); - } - - public static function get_currency(){ - $currency = get_option("rg_gforms_currency"); - $currency = empty($currency) ? "USD" : $currency; - - return apply_filters("gform_currency", $currency); - } - - - public static function get_simple_captcha(){ - $captcha = new ReallySimpleCaptcha(); - $captcha->tmp_dir = RGFormsModel::get_upload_path("captcha") . "/"; - return $captcha; - } - - public static function get_captcha($field){ - if(!class_exists("ReallySimpleCaptcha")) - return array(); - - $captcha = self::get_simple_captcha(); - - //If captcha folder does not exist and can't be created, return an empty captcha - if(!wp_mkdir_p($captcha->tmp_dir)) - return array(); - - $captcha->char_length = 5; - switch(rgar($field,"simpleCaptchaSize")){ - case "small" : - $captcha->img_size = array( 100, 28 ); - $captcha->font_size = 18; - $captcha->base = array( 8, 20 ); - $captcha->font_char_width = 17; - - break; - - case "large" : - $captcha->img_size = array( 200, 56 ); - $captcha->font_size = 32; - $captcha->base = array( 18, 42 ); - $captcha->font_char_width = 35; - break; - - default : - $captcha->img_size = array( 150, 42 ); - $captcha->font_size = 26; - $captcha->base = array( 15, 32 ); - $captcha->font_char_width = 25; - break; - } - - if(!empty($field["simpleCaptchaFontColor"])){ - $captcha->fg = self::hex2rgb($field["simpleCaptchaFontColor"]); - } - if(!empty($field["simpleCaptchaBackgroundColor"])){ - $captcha->bg = self::hex2rgb($field["simpleCaptchaBackgroundColor"]); - } - - $word = $captcha->generate_random_word(); - $prefix = mt_rand(); - $filename = $captcha->generate_image($prefix, $word); - $url = RGFormsModel::get_upload_url("captcha") . "/" . $filename; - $path = $captcha->tmp_dir . $filename; - - if(self::is_ssl() && strpos($url, "http:") !== false ){ - $url = str_replace("http:", "https:", $url); - } - - return array("path"=>$path, "url"=> $url, "height" => $captcha->img_size[1], "width" => $captcha->img_size[0], "prefix" => $prefix); - } - - public static function get_math_captcha($field, $pos){ - if(!class_exists("ReallySimpleCaptcha")) - return array(); - - $captcha = self::get_simple_captcha(); - - //If captcha folder does not exist and can't be created, return an empty captcha - if(!wp_mkdir_p($captcha->tmp_dir)) - return array(); - - $captcha->char_length = 1; - if($pos == 1 || $pos == 3) - $captcha->chars = '0123456789'; - else - $captcha->chars = '+'; - - switch(rgar($field,"simpleCaptchaSize")){ - case "small" : - $captcha->img_size = array( 23, 28 ); - $captcha->font_size = 18; - $captcha->base = array( 6, 20 ); - $captcha->font_char_width = 17; - - break; - - case "large" : - $captcha->img_size = array( 36, 56 ); - $captcha->font_size = 32; - $captcha->base = array( 10, 42 ); - $captcha->font_char_width = 35; - break; - - default : - $captcha->img_size = array( 30, 42 ); - $captcha->font_size = 26; - $captcha->base = array( 9, 32 ); - $captcha->font_char_width = 25; - break; - } - - if(!empty($field["simpleCaptchaFontColor"])){ - $captcha->fg = self::hex2rgb($field["simpleCaptchaFontColor"]); - } - if(!empty($field["simpleCaptchaBackgroundColor"])){ - $captcha->bg = self::hex2rgb($field["simpleCaptchaBackgroundColor"]); - } - - $word = $captcha->generate_random_word(); - $prefix = mt_rand(); - $filename = $captcha->generate_image($prefix, $word); - $url = RGFormsModel::get_upload_url("captcha") . "/" . $filename; - $path = $captcha->tmp_dir . $filename; - - return array("path"=>$path, "url"=> $url, "height" => $captcha->img_size[1], "width" => $captcha->img_size[0], "prefix" => $prefix); - } - - private static function hex2rgb($color){ - if ($color[0] == '#') - $color = substr($color, 1); - - if (strlen($color) == 6) - list($r, $g, $b) = array($color[0].$color[1], - $color[2].$color[3], - $color[4].$color[5]); - elseif (strlen($color) == 3) - list($r, $g, $b) = array($color[0].$color[0], $color[1].$color[1], $color[2].$color[2]); - else - return false; - - $r = hexdec($r); $g = hexdec($g); $b = hexdec($b); - - return array($r, $g, $b); - } - - public static function get_address_types($form_id){ - - $addressTypes = array( - "international" => array("label" => __("International", "gravityforms"),"zip_label" => apply_filters("gform_address_zip_{$form_id}",apply_filters("gform_address_zip", __("ZIP / Postal Code", "gravityforms"), $form_id), $form_id),"state_label" => apply_filters("gform_address_state_{$form_id}",apply_filters("gform_address_state",__("State / Province / Region", "gravityforms"), $form_id), $form_id)), - "us" => array("label" => __("United States", "gravityforms"),"zip_label" => apply_filters("gform_address_zip_{$form_id}",apply_filters("gform_address_zip", __("ZIP Code", "gravityforms"), $form_id), $form_id), "state_label" => apply_filters("gform_address_state_{$form_id}",apply_filters("gform_address_state",__("State", "gravityforms"), $form_id), $form_id), "country" => "United States", "states" => array_merge(array(''), GFCommon::get_us_states())), - "canadian" => array("label" => __("Canadian", "gravityforms"), "zip_label" => apply_filters("gform_address_zip_{$form_id}",apply_filters("gform_address_zip", __("Postal Code", "gravityforms"), $form_id), $form_id), "state_label" => apply_filters("gform_address_state_{$form_id}",apply_filters("gform_address_state",__("Province", "gravityforms"), $form_id), $form_id),"country" => "Canada", "states" => array_merge(array(''), GFCommon::get_canadian_provinces())) - ); - - return apply_filters("gform_address_types_{$form_id}", apply_filters("gform_address_types", $addressTypes, $form_id), $form_id); - } + public static function get_browser_class() { + global $is_lynx, $is_gecko, $is_IE, $is_opera, $is_NS4, $is_safari, $is_chrome, $is_iphone, $post; + + $classes = array(); + + //adding browser related class + if ( $is_lynx ) { + $classes[] = 'gf_browser_lynx'; + } else if ( $is_gecko ) { + $classes[] = 'gf_browser_gecko'; + } else if ( $is_opera ) { + $classes[] = 'gf_browser_opera'; + } else if ( $is_NS4 ) { + $classes[] = 'gf_browser_ns4'; + } else if ( $is_safari ) { + $classes[] = 'gf_browser_safari'; + } else if ( $is_chrome ) { + $classes[] = 'gf_browser_chrome'; + } else if ( $is_IE ) { + $classes[] = 'gf_browser_ie'; + } else { + $classes[] = 'gf_browser_unknown'; + } - private static function get_state_field($field, $id, $field_id, $state_value, $disabled_text, $form_id){ - $state_dropdown_class = $state_text_class = $state_style = $text_style = $state_field_id = ""; - if(empty($state_value)){ - $state_value = rgget("defaultState", $field); + //adding IE version + if ( $is_IE ) { + if ( strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE 6' ) !== false ) { + $classes[] = 'gf_browser_ie6'; + } else if ( strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE 7' ) !== false ) { + $classes[] = 'gf_browser_ie7'; + } + if ( strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE 8' ) !== false ) { + $classes[] = 'gf_browser_ie8'; + } + if ( strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE 9' ) !== false ) { + $classes[] = 'gf_browser_ie9'; + } + } - //for backwards compatibility (canadian address type used to store the default state into the defaultProvince property) - if (rgget("addressType", $field) == "canadian" && !rgempty("defaultProvince", $field)) - $state_value = $field["defaultProvince"]; - } + if ( $is_iphone ) { + $classes[] = 'gf_browser_iphone'; + } - $address_type = rgempty("addressType", $field) ? "international" : $field["addressType"]; - $address_types = self::get_address_types($form_id); - $has_state_drop_down = isset($address_types[$address_type]["states"]) && is_array($address_types[$address_type]["states"]); + return implode( ' ', $classes ); + } - if(IS_ADMIN && RG_CURRENT_VIEW != "entry"){ - $state_dropdown_class = "class='state_dropdown'"; - $state_text_class = "class='state_text'"; - $state_style = !$has_state_drop_down ? "style='display:none;'" : ""; - $text_style = $has_state_drop_down ? "style='display:none;'" : ""; - $state_field_id = ""; - } - else{ - //id only displayed on front end - $state_field_id = "id='" . $field_id . "_4'"; - } + public static function create_post( $form, &$lead ) { + $disable_post = apply_filters( "gform_disable_post_creation_{$form['id']}", apply_filters( 'gform_disable_post_creation', false, $form, $lead ), $form, $lead ); + $post_id = 0; + if ( ! $disable_post ) { + //creates post if the form has any post fields + $post_id = RGFormsModel::create_post( $form, $lead ); + } - $tabindex = self::get_tabindex(); - $states = empty($address_types[$address_type]["states"]) ? array() : $address_types[$address_type]["states"]; - $state_dropdown = sprintf("", $id, $state_field_id, $disabled_text, GFCommon::get_state_dropdown($states, $state_value)); + return $post_id; + } - $tabindex = self::get_tabindex(); - $state_text = sprintf("", $id, $state_field_id, $state_value, $disabled_text); + public static function evaluate_conditional_logic( $logic, $form, $lead ) { - if(IS_ADMIN && RG_CURRENT_VIEW != "entry") - return $state_dropdown . $state_text; - else if($has_state_drop_down) - return $state_dropdown; - else - return $state_text; - } + if ( ! $logic || ! is_array( rgar( $logic, 'rules' ) ) ) { + return true; + } - public static function get_lead_field_display($field, $value, $currency="", $use_text=false, $format="html", $media="screen"){ - - if($field['type'] == 'post_category') - $value = self::prepare_post_category_value($value, $field); - - switch(RGFormsModel::get_input_type($field)){ - case "name" : - if(is_array($value)){ - $prefix = trim(rgget($field["id"] . ".2", $value)); - $first = trim(rgget($field["id"] . ".3", $value)); - $last = trim(rgget($field["id"] . ".6", $value)); - $suffix = trim(rgget($field["id"] . ".8", $value)); - - $name = $prefix; - $name .= !empty($name) && !empty($first) ? " $first" : $first; - $name .= !empty($name) && !empty($last) ? " $last" : $last; - $name .= !empty($name) && !empty($suffix) ? " $suffix" : $suffix; - - return $name; - } - else{ - return $value; - } - - break; - case "creditcard" : - if(is_array($value)){ - $card_number = trim(rgget($field["id"] . ".1", $value)); - $card_type = trim(rgget($field["id"] . ".4", $value)); - $separator = $format == "html" ? "
    " : "\n"; - return empty($card_number) ? "" : $card_type . $separator . $card_number; - } - else{ - return ""; - } - break; - - case "address" : - if(is_array($value)){ - $street_value = trim(rgget($field["id"] . ".1", $value)); - $street2_value = trim(rgget($field["id"] . ".2", $value)); - $city_value = trim(rgget($field["id"] . ".3", $value)); - $state_value = trim(rgget($field["id"] . ".4", $value)); - $zip_value = trim(rgget($field["id"] . ".5", $value)); - $country_value = trim(rgget($field["id"] . ".6", $value)); - - $line_break = $format == "html" ? "
    " : "\n"; - - $address_display_format = apply_filters("gform_address_display_format", "default"); - if($address_display_format == "zip_before_city"){ - /* - Sample: - 3333 Some Street - suite 16 - 2344 City, State - Country - */ - - $addr_ary = array(); - $addr_ary[] = $street_value; - - if(!empty($street2_value)) - $addr_ary[] = $street2_value; - - $zip_line = trim($zip_value . " " . $city_value); - $zip_line .= !empty($zip_line) && !empty($state_value) ? ", {$state_value}" : $state_value; - $zip_line = trim($zip_line); - if(!empty($zip_line)) - $addr_ary[] = $zip_line; - - if(!empty($country_value)) - $addr_ary[] = $country_value; - - $address = implode("
    ", $addr_ary); - - } - else{ - $address = $street_value; - $address .= !empty($address) && !empty($street2_value) ? $line_break . $street2_value : $street2_value; - $address .= !empty($address) && (!empty($city_value) || !empty($state_value)) ? $line_break. $city_value : $city_value; - $address .= !empty($address) && !empty($city_value) && !empty($state_value) ? ", $state_value" : $state_value; - $address .= !empty($address) && !empty($zip_value) ? " $zip_value" : $zip_value; - $address .= !empty($address) && !empty($country_value) ? $line_break . $country_value : $country_value; - } - - //adding map link - if(!empty($address) && $format == "html"){ - $address_qs = str_replace($line_break, " ", $address); //replacing
    and \n with spaces - $address_qs = urlencode($address_qs); - $address .= "
    Map It"; - } - - return $address; - } - else{ - return ""; - } - break; - - case "email" : - return GFCommon::is_valid_email($value) && $format == "html" ? "$value" : $value; - break; - - case "website" : - return GFCommon::is_valid_url($value) && $format == "html" ? "$value" : $value; - break; - - case "checkbox" : - if(is_array($value)){ - - $items = ''; - - foreach($value as $key => $item){ - if(!empty($item)){ - switch($format){ - case "text" : - $items .= GFCommon::selection_display($item, $field, $currency, $use_text) . ", "; - break; - - default: - $items .= "
  • " . GFCommon::selection_display($item, $field, $currency, $use_text) . "
  • "; - break; - } - } - } - if(empty($items)){ - return ""; - } - else if($format == "text"){ - return substr($items, 0, strlen($items)-2); //removing last comma - } - else{ - return ""; - } - } - else{ - return $value; - } - break; - - case "post_image" : - $ary = explode("|:|", $value); - $url = count($ary) > 0 ? $ary[0] : ""; - $title = count($ary) > 1 ? $ary[1] : ""; - $caption = count($ary) > 2 ? $ary[2] : ""; - $description = count($ary) > 3 ? $ary[3] : ""; - - if(!empty($url)){ - $url = str_replace(" ", "%20", $url); - - switch($format){ - case "text" : - $value = $url; - $value .= !empty($title) ? "\n\n" . $field["label"] . " (" . __("Title", "gravityforms") . "): " . $title : ""; - $value .= !empty($caption) ? "\n\n" . $field["label"] . " (" . __("Caption", "gravityforms") . "): " . $caption : ""; - $value .= !empty($description) ? "\n\n" . $field["label"] . " (" . __("Description", "gravityforms") . "): " . $description : ""; - break; - - default : - $value = ""; - $value .= !empty($title) ? "
    Title: $title
    " : ""; - $value .= !empty($caption) ? "
    Caption: $caption
    " : ""; - $value .= !empty($description) ? "
    Description: $description
    ": ""; - - break; - } - } - return $value; - - case "fileupload" : - $output = ""; - if(!empty($value)){ - $output_arr = array(); - $file_paths = rgar($field,"multipleFiles") ? json_decode($value) : array($value); - foreach($file_paths as $file_path){ - $info = pathinfo($file_path); - if(self::is_ssl() && strpos($file_path, "http:") !== false ){ - $file_path = str_replace("http:", "https:", $file_path); - } - $file_path = esc_attr(str_replace(" ", "%20", $file_path)); - $output_arr[] = $format == "text" ? $file_path . PHP_EOL: "
  • " . $info["basename"] . "
  • "; - } - $output = join(PHP_EOL, $output_arr); - } - $output = empty($output) || $format == "text" ? $output : sprintf("", $output); - return $output; - break; - - case "date" : - return GFCommon::date_display($value, rgar($field, "dateFormat")); - break; - - case "radio" : - case "select" : - return GFCommon::selection_display($value, $field, $currency, $use_text); - break; - - case "multiselect" : - if(empty($value) || $format == "text") - return $value; - - $value = explode(",", $value); - - $items = ''; - foreach($value as $item){ - $items .= "
  • " . GFCommon::selection_display($item, $field, $currency, $use_text) . "
  • "; - } - - return ""; - - break; - - case "calculation" : - case "singleproduct" : - if(is_array($value) && !empty($value)){ - $product_name = trim($value[$field["id"] . ".1"]); - $price = trim($value[$field["id"] . ".2"]); - $quantity = trim($value[$field["id"] . ".3"]); - - $product = $product_name . ", " . __("Qty: ", "gravityforms") . $quantity . ", " . __("Price: ", "gravityforms") . $price; - return $product; - } - else{ - return ""; - } - break; - - case "number" : - return GFCommon::format_number($value, rgar($field, "numberFormat")); - break; - - case "singleshipping" : - case "donation" : - case "total" : - case "price" : - return GFCommon::to_money($value, $currency); - - case "list" : - if(empty($value)) - return ""; - $value = unserialize($value); - - $has_columns = is_array($value[0]); - - if(!$has_columns){ - $items = ''; - foreach($value as $key => $item){ - if(!empty($item)){ - switch($format){ - case "text" : - $items .= $item . ", "; - break; - case "url" : - $items .= $item . ","; - break; - default : - if($media == "email"){ - $items .= "
  • {$item}
  • "; - } - else{ - $items .= "
  • {$item}
  • "; - } - break; - } - } - } - - if(empty($items)){ - return ""; - } - else if($format == "text"){ - return substr($items, 0, strlen($items)-2); //removing last comma - } - else if($format == "url"){ - return substr($items, 0, strlen($items)-1); //removing last comma - } - else if($media == "email"){ - return ""; - } - else{ - return ""; - } - } - else if(is_array($value)){ - $columns = array_keys($value[0]); - - $list = ""; - - switch($format){ - case "text" : - $is_first_row = true; - foreach($value as $item){ - if(!$is_first_row) - $list .= "\n\n" . $field["label"] . ": "; - $list .= implode(",", array_values($item)); - - $is_first_row = false; - } - break; - - case "url" : - foreach($value as $item){ - $list .= implode("|", array_values($item)) . ","; - } - if(!empty($list)) - $list = substr($list, 0, strlen($list)-1); - break; - - default : - if($media == "email"){ - $list = "\n"; - - //reading columns from entry data - foreach($columns as $column){ - $list .= "\n"; - } - $list .= "\n"; - - $list .= ""; - foreach($value as $item){ - $list .= ""; - foreach($columns as $column){ - $val = rgar($item, $column); - $list .= "\n"; - } - - $list .="\n"; - } - - $list .="
    " . esc_html($column) . "
    {$val}
    \n"; - } - else{ - $list = "\n"; - - //reading columns from entry data - foreach($columns as $column){ - $list .= "\n"; - } - $list .= "\n"; - - $list .= ""; - foreach($value as $item){ - $list .= ""; - foreach($columns as $column){ - $val = rgar($item, $column); - $list .= "\n"; - } - - $list .="\n"; - } - - $list .="
    " . esc_html($column) . "
    {$val}
    \n"; - } - break; - } - - return $list; - } - return ""; - break; - - default : - if (!is_array($value)){ - return $format == "html" ? nl2br($value) : $value; + $entry_meta_keys = array_keys( GFFormsModel::get_entry_meta( $form['id'] ) ); + $match_count = 0; + if ( is_array( $logic['rules'] ) ) { + foreach ( $logic['rules'] as $rule ) { + + if ( in_array( $rule['fieldId'], $entry_meta_keys ) ) { + $is_value_match = GFFormsModel::is_value_match( rgar( $lead, $rule['fieldId'] ), $rule['value'], $rule['operator'], $rule, $form ); + } else { + $source_field = GFFormsModel::get_field( $form, $rule['fieldId'] ); + $field_value = empty( $lead ) ? GFFormsModel::get_field_value( $source_field, array() ) : GFFormsModel::get_lead_field_value( $lead, $source_field ); + $is_value_match = GFFormsModel::is_value_match( $field_value, $rule['value'], $rule['operator'], $source_field, $rule, $form ); } - break; - } - } - - public static function get_product_fields($form, $lead, $use_choice_text=false, $use_admin_label=false){ - $products = array(); - - $product_info = null; - // retrieve static copy of product info (only for "real" entries) - if(!rgempty("id", $lead)){ - $product_info = gform_get_meta(rgar($lead,'id'), "gform_product_info_{$use_choice_text}_{$use_admin_label}"); - } - - // if no static copy, generate from form/lead info - if(!$product_info) { - - foreach($form["fields"] as $field){ - $id = $field["id"]; - $lead_value = RGFormsModel::get_lead_field_value($lead, $field); - - $quantity_field = self::get_product_fields_by_type($form, array("quantity"), $id); - $quantity = sizeof($quantity_field) > 0 && !RGFormsModel::is_field_hidden($form, $quantity_field[0], array(), $lead) ? RGFormsModel::get_lead_field_value($lead, $quantity_field[0]) : 1; - - switch($field["type"]){ - - case "product" : - - //ignore products that have been hidden by conditional logic - $is_hidden = RGFormsModel::is_field_hidden($form, $field, array(), $lead); - if($is_hidden) - continue; - - //if single product, get values from the multiple inputs - if(is_array($lead_value)){ - $product_quantity = sizeof($quantity_field) == 0 && !rgar($field,"disableQuantity") ? rgget($id . ".3", $lead_value) : $quantity; - if(empty($product_quantity)) - continue; - - if(!rgget($id, $products)) - $products[$id] = array(); - - $products[$id]["name"] = $use_admin_label && !rgempty("adminLabel", $field) ? $field["adminLabel"] : $lead_value[$id . ".1"]; - $products[$id]["price"] = rgar($lead_value, $id . ".2"); - $products[$id]["quantity"] = $product_quantity; - } - else if(!empty($lead_value)){ - - if(empty($quantity)) - continue; - - if(!rgar($products,$id)) - $products[$id] = array(); - - if($field["inputType"] == "price"){ - $name = $field["label"]; - $price = $lead_value; - } - else{ - list($name, $price) = explode("|", $lead_value); - } - - $products[$id]["name"] = !$use_choice_text ? $name : RGFormsModel::get_choice_text($field, $name); - $products[$id]["price"] = $price; - $products[$id]["quantity"] = $quantity; - $products[$id]["options"] = array(); - } - - if(isset($products[$id])){ - $options = self::get_product_fields_by_type($form, array("option"), $id); - foreach($options as $option){ - $option_value = RGFormsModel::get_lead_field_value($lead, $option); - $option_label = empty($option["adminLabel"]) ? $option["label"] : $option["adminLabel"]; - if(is_array($option_value)){ - foreach($option_value as $value){ - $option_info = self::get_option_info($value, $option, $use_choice_text); - if(!empty($option_info)) - $products[$id]["options"][] = array("field_label" => rgar($option, "label"), "option_name"=> rgar($option_info, "name"), "option_label" => $option_label . ": " . rgar($option_info, "name"), "price" => rgar($option_info,"price")); - } - } - else if(!empty($option_value)){ - $option_info = self::get_option_info($option_value, $option, $use_choice_text); - $products[$id]["options"][] = array("field_label" => rgar($option, "label"), "option_name"=> rgar($option_info, "name"), "option_label" => $option_label . ": " . rgar($option_info, "name"), "price" => rgar($option_info,"price")); - } - - } - } - break; - } - } - - $shipping_field = self::get_fields_by_type($form, array("shipping")); - $shipping_price = $shipping_name = ""; - $shipping_field_id = ""; - if(!empty($shipping_field) && !RGFormsModel::is_field_hidden($form, $shipping_field[0], array(), $lead)){ - $shipping_price = RGFormsModel::get_lead_field_value($lead, $shipping_field[0]); - $shipping_name = $shipping_field[0]["label"]; - $shipping_field_id = $shipping_field[0]["id"]; - if($shipping_field[0]["inputType"] != "singleshipping"){ - list($shipping_method, $shipping_price) = explode("|", $shipping_price); - $shipping_name = $shipping_field[0]["label"] . " ($shipping_method)"; - } - } - $shipping_price = self::to_number($shipping_price); - - $product_info = array("products" => $products, "shipping" => array("id"=> $shipping_field_id, "name" => $shipping_name, "price" => $shipping_price)); - - $product_info = apply_filters("gform_product_info_{$form["id"]}", apply_filters("gform_product_info", $product_info, $form, $lead), $form, $lead); - - // save static copy of product info (only for "real" entries) - if(!rgempty("id", $lead) && !empty($product_info["products"])){ - gform_update_meta($lead['id'], "gform_product_info_{$use_choice_text}_{$use_admin_label}", $product_info); - } - } - - return $product_info; - } - - public static function get_order_total($form, $lead) { - - $products = self::get_product_fields($form, $lead, false); - return self::get_total($products); - } - - public static function get_total($products) { - - $total = 0; - foreach($products["products"] as $product){ - - $price = self::to_number($product["price"]); - if(is_array(rgar($product,"options"))){ - foreach($product["options"] as $option){ - $price += self::to_number($option["price"]); - } - } - $subtotal = floatval($product["quantity"]) * $price; - $total += $subtotal; - - } - - $total += floatval($products["shipping"]["price"]); - - return $total; - } - - public static function get_option_info($value, $option, $use_choice_text){ - if(empty($value)) - return array(); - - list($name, $price) = explode("|", $value); - if($use_choice_text) - $name = RGFormsModel::get_choice_text($option, $name); - - return array("name" => $name, "price" => $price); - } - - public static function gform_do_shortcode($content){ - - $is_ajax = false; - $forms = GFFormDisplay::get_embedded_forms($content, $is_ajax); - foreach($forms as $form){ - if( headers_sent() ) { - GFFormDisplay::print_form_scripts( $form, $is_ajax ); - } else { - GFFormDisplay::enqueue_form_scripts( $form, $is_ajax ); - } - } + if ( $is_value_match ) { + $match_count ++; + } + } + } - return do_shortcode($content); - } + $do_action = ( $logic['logicType'] == 'all' && $match_count == sizeof( $logic['rules'] ) ) || ( $logic['logicType'] == 'any' && $match_count > 0 ); - public static function spam_enabled( $form_id ) { - $spam_enabled = self::akismet_enabled( $form_id ) || has_filter( 'gform_entry_is_spam' ) || has_filter( "gform_entry_is_spam_{$form_id}" ); + return $do_action; + } - return $spam_enabled; + public static function get_card_types() { + $cards = array( + + array( + 'name' => 'American Express', + 'slug' => 'amex', + 'lengths' => '15', + 'prefixes' => '34,37', + 'checksum' => true, + ), + array( + 'name' => 'Discover', + 'slug' => 'discover', + 'lengths' => '16', + 'prefixes' => '6011,622,64,65', + 'checksum' => true, + ), + array( + 'name' => 'MasterCard', + 'slug' => 'mastercard', + 'lengths' => '16', + 'prefixes' => '51,52,53,54,55', + 'checksum' => true, + ), + array( + 'name' => 'Visa', + 'slug' => 'visa', + 'lengths' => '13,16', + 'prefixes' => '4,417500,4917,4913,4508,4844', + 'checksum' => true, + ), + array( + 'name' => 'JCB', + 'slug' => 'jcb', + 'lengths' => '16', + 'prefixes' => '35', + 'checksum' => true, + ), + array( + 'name' => 'Maestro', + 'slug' => 'maestro', + 'lengths' => '12,13,14,15,16,18,19', + 'prefixes' => '5018,5020,5038,6304,6759,6761', + 'checksum' => true, + ), + ); + + $cards = apply_filters( 'gform_creditcard_types', $cards ); + + return $cards; } - public static function has_akismet(){ - $akismet_exists = function_exists('akismet_http_post') || function_exists('Akismet::http_post'); - return $akismet_exists; - } + public static function get_card_type( $number ) { - public static function akismet_enabled($form_id) { + //removing spaces from number + $number = str_replace( ' ', '', $number ); - if(!self::has_akismet()){ - return false; + if ( empty( $number ) ) { + return false; } - // if no option is set, leave akismet enabled; otherwise, use option value true/false - $enabled_by_setting = get_option('rg_gforms_enable_akismet') === false ? true : get_option('rg_gforms_enable_akismet') == true; - $enabled_by_filter = apply_filters("gform_akismet_enabled_$form_id", apply_filters("gform_akismet_enabled", $enabled_by_setting)); - - return $enabled_by_filter; + $cards = self::get_card_types(); - } - - public static function is_akismet_spam($form, $lead){ - - global $akismet_api_host, $akismet_api_port; - - $fields = self::get_akismet_fields($form, $lead); - - //Submitting info to Akismet - if (defined("AKISMET_VERSION") && AKISMET_VERSION < 3.0 ) { - //Akismet versions before 3.0 - $response = akismet_http_post($fields, $akismet_api_host, '/1.1/comment-check', $akismet_api_port ); - } - else{ - $response = Akismet::http_post($fields, 'comment-check'); + $matched_card = false; + foreach ( $cards as $card ) { + if ( self::matches_card_type( $number, $card ) ) { + $matched_card = $card; + break; + } } - $is_spam = trim(rgar($response, 1)) == "true"; - - return $is_spam; - } - - public static function mark_akismet_spam($form, $lead, $is_spam){ - - global $akismet_api_host, $akismet_api_port; - $fields = self::get_akismet_fields($form, $lead); - $as = $is_spam ? "spam" : "ham"; - - //Submitting info to Akismet - if (defined("AKISMET_VERSION") && AKISMET_VERSION < 3.0 ) { - //Akismet versions before 3.0 - akismet_http_post($fields, $akismet_api_host, '/1.1/submit-'.$as, $akismet_api_port ); - } - else{ - Akismet::http_post($fields, 'submit-'.$as); + if ( $matched_card && $matched_card['checksum'] && ! self::is_valid_card_checksum( $number ) ) { + $matched_card = false; } - } - private static function get_akismet_fields($form, $lead){ - //Gathering Akismet information - $akismet_info = array(); - $akismet_info['comment_type'] = 'gravity_form'; - $akismet_info['comment_author'] = self::get_akismet_field("name", $form, $lead); - $akismet_info['comment_author_email'] = self::get_akismet_field("email", $form, $lead); - $akismet_info['comment_author_url'] = self::get_akismet_field("website", $form, $lead); - $akismet_info['comment_content'] = self::get_akismet_field("textarea", $form, $lead); - $akismet_info['contact_form_subject'] = $form["title"]; - $akismet_info['comment_author_IP'] = $lead["ip"]; - $akismet_info['permalink'] = $lead["source_url"]; - $akismet_info['user_ip'] = preg_replace( '/[^0-9., ]/', '', $lead["ip"] ); - $akismet_info['user_agent'] = $lead["user_agent"]; - $akismet_info['referrer'] = is_admin() ? "" : $_SERVER['HTTP_REFERER']; - $akismet_info['blog'] = get_option('home'); - - $akismet_info = apply_filters("gform_akismet_fields_{$form["id"]}", apply_filters("gform_akismet_fields", $akismet_info, $form, $lead), $form, $lead); - - return http_build_query($akismet_info); - } - - private static function get_akismet_field($field_type, $form, $lead){ - $fields = GFCommon::get_fields_by_type($form, array($field_type)); - if(empty($fields)) - return ""; + return $matched_card ? $matched_card : false; - $value = RGFormsModel::get_lead_field_value($lead, $fields[0]); - switch($field_type){ - case "name" : - $value = GFCommon::get_lead_field_display($fields[0], $value); - break; - } + } - return $value; - } + private static function matches_card_type( $number, $card ) { - public static function get_other_choice_value(){ - $value = apply_filters('gform_other_choice_value', __("Other", "gravityforms")); - return $value; - } + //checking prefix + $prefixes = explode( ',', $card['prefixes'] ); + $matches_prefix = false; + foreach ( $prefixes as $prefix ) { + if ( preg_match( "|^{$prefix}|", $number ) ) { + $matches_prefix = true; + break; + } + } - public static function get_browser_class() { - global $is_lynx, $is_gecko, $is_IE, $is_opera, $is_NS4, $is_safari, $is_chrome, $is_iphone, $post; - - $classes = array(); - - //adding browser related class - if($is_lynx) $classes[] = 'gf_browser_lynx'; - else if($is_gecko) $classes[] = 'gf_browser_gecko'; - else if($is_opera) $classes[] = 'gf_browser_opera'; - else if($is_NS4) $classes[] = 'gf_browser_ns4'; - else if($is_safari) $classes[] = 'gf_browser_safari'; - else if($is_chrome) $classes[] = 'gf_browser_chrome'; - else if($is_IE) $classes[] = 'gf_browser_ie'; - else $classes[] = 'gf_browser_unknown'; - - - //adding IE version - if($is_IE){ - if(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 6') !== false) - $classes[] = 'gf_browser_ie6'; - else if(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 7') !== false) - $classes[] = 'gf_browser_ie7'; - if(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 8') !== false) - $classes[] = 'gf_browser_ie8'; - if(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 9') !== false) - $classes[] = 'gf_browser_ie9'; - } + //checking length + $lengths = explode( ',', $card['lengths'] ); + $matches_length = false; + foreach ( $lengths as $length ) { + if ( strlen( $number ) == absint( $length ) ) { + $matches_length = true; + break; + } + } - if($is_iphone) $classes[] = 'gf_browser_iphone'; + return $matches_prefix && $matches_length; - return implode(" " , $classes); - } + } - public static function create_post($form, &$lead) { - $disable_post = apply_filters("gform_disable_post_creation_{$form["id"]}", apply_filters("gform_disable_post_creation", false, $form, $lead), $form, $lead); - $post_id = 0; - if(!$disable_post){ - //creates post if the form has any post fields - $post_id = RGFormsModel::create_post($form, $lead); - } + private static function is_valid_card_checksum( $number ) { + $checksum = 0; + $num = 0; + $multiplier = 1; - return $post_id; - } + // Process each character starting at the right + for ( $i = strlen( $number ) - 1; $i >= 0; $i -- ) { - public static function evaluate_conditional_logic($logic, $form, $lead) { + //Multiply current digit by multiplier (1 or 2) + $num = $number{$i} * $multiplier; - if(!$logic || !is_array(rgar($logic,"rules"))) - return true; + // If the result is in greater than 9, add 1 to the checksum total + if ( $num >= 10 ) { + $checksum ++; + $num -= 10; + } - $entry_meta_keys = array_keys(GFFormsModel::get_entry_meta($form["id"])); - $match_count = 0; - if(is_array($logic["rules"])){ - foreach($logic["rules"] as $rule) { + //Update checksum + $checksum += $num; - if (in_array($rule["fieldId"], $entry_meta_keys)){ - $is_value_match = GFFormsModel::is_value_match(rgar($lead,$rule["fieldId"]), $rule["value"], $rule["operator"], null, $rule, $form ); - } else { - $source_field = GFFormsModel::get_field($form, $rule["fieldId"]); - $field_value = empty($lead) ? GFFormsModel::get_field_value($source_field, array()) : GFFormsModel::get_lead_field_value($lead, $source_field); - $is_value_match = GFFormsModel::is_value_match( $field_value, $rule["value"], $rule["operator"], $source_field, $rule, $form ); - } + //Update multiplier + $multiplier = $multiplier == 1 ? 2 : 1; + } - if($is_value_match) - $match_count++; + return $checksum % 10 == 0; - } - } + } - $do_action = ($logic["logicType"] == "all" && $match_count == sizeof($logic["rules"]) ) || ($logic["logicType"] == "any" && $match_count > 0); - return $do_action; - } + public static function is_wp_version( $min_version ) { + return ! version_compare( get_bloginfo( 'version' ), "{$min_version}.dev1", '<' ); + } - public static function get_card_types(){ - $cards = array ( - - array ( 'name' => 'American Express', - 'slug' => 'amex', - 'lengths' => '15', - 'prefixes' => '34,37', - 'checksum' => true - ), - array ( 'name' => 'Discover', - 'slug' => 'discover', - 'lengths' => '16', - 'prefixes' => '6011,622,64,65', - 'checksum' => true - ), - array ( 'name' => 'MasterCard', - 'slug' => 'mastercard', - 'lengths' => '16', - 'prefixes' => '51,52,53,54,55', - 'checksum' => true - ), - array ( 'name' => 'Visa', - 'slug' => 'visa', - 'lengths' => '13,16', - 'prefixes' => '4,417500,4917,4913,4508,4844', - 'checksum' => true - ), - array ( 'name' => 'JCB', - 'slug' => 'jcb', - 'lengths' => '16', - 'prefixes' => '35', - 'checksum' => true - ), - array ( 'name' => 'Maestro', - 'slug' => 'maestro', - 'lengths' => '12,13,14,15,16,18,19', - 'prefixes' => '5018,5020,5038,6304,6759,6761', - 'checksum' => true - ) - - ); - - $cards = apply_filters("gform_creditcard_types", $cards); - - return $cards; - } + public static function add_categories_as_choices( $field, $value ) { - public static function get_card_type($number){ + $choices = $inputs = array(); + $is_post = isset( $_POST['gform_submit'] ); + $has_placeholder = $field->categoryInitialItemEnabled && RGFormsModel::get_input_type( $field ) == 'select'; - //removing spaces from number - $number = str_replace (' ', '', $number); + if ( $has_placeholder ) { + $choices[] = array( 'text' => $field->categoryInitialItem, 'value' => '', 'isSelected' => true ); + } - if(empty($number)) - return false; + $display_all = $field->displayAllCategories; - $cards = self::get_card_types(); + $args = array( 'hide_empty' => false, 'orderby' => 'name' ); - $matched_card = false; - foreach($cards as $card){ - if(self::matches_card_type($number, $card)){ - $matched_card = $card; - break; - } - } + if ( ! $display_all ) { + foreach ( $field->choices as $field_choice_to_include ) { + $args['include'][] = $field_choice_to_include['value']; + } + } - if($matched_card && $matched_card["checksum"] && !self::is_valid_card_checksum($number)) - $matched_card = false; + $args = apply_filters( "gform_post_category_args_{$field->id}", apply_filters( 'gform_post_category_args', $args, $field ), $field ); + $terms = get_terms( 'category', $args ); + + $terms_copy = unserialize( serialize( $terms ) ); // deep copy the terms to avoid repeating GFCategoryWalker on previously cached terms. + $walker = new GFCategoryWalker(); + $categories = $walker->walk( $terms_copy, 0, array( 0 ) ); // 3rd parameter prevents notices triggered by $walker::display_element() function which checks $args[0] + + foreach ( $categories as $category ) { + if ( $display_all ) { + $selected = $value == $category->term_id || + ( + empty( $value ) && + get_option( 'default_category' ) == $category->term_id && + RGFormsModel::get_input_type( $field ) == 'select' && // only preselect default category on select fields + ! $is_post && + ! $has_placeholder + ); + $choices[] = array( 'text' => $category->name, 'value' => $category->term_id, 'isSelected' => $selected ); + } else { + foreach ( $field->choices as $field_choice ) { + if ( $field_choice['value'] == $category->term_id ) { + $choices[] = array( 'text' => $category->name, 'value' => $category->term_id ); + break; + } + } + } + } - return $matched_card ? $matched_card : false; + if ( empty( $choices ) ) { + $choices[] = array( 'text' => 'You must select at least one category.', 'value' => '' ); + } - } + $choice_number = 1; + foreach ( $choices as $choice ) { - private static function matches_card_type($number, $card){ + if ( $choice_number % 10 == 0 ) { + //hack to skip numbers ending in 0. so that 5.1 doesn't conflict with 5.10 + $choice_number ++; + } - //checking prefix - $prefixes = explode(',',$card['prefixes']); - $matches_prefix = false; - foreach($prefixes as $prefix){ - if(preg_match("|^{$prefix}|", $number)){ - $matches_prefix = true; - break; - } - } + $input_id = $field->id . '.' . $choice_number; + $inputs[] = array( 'id' => $input_id, 'label' => $choice['text'], 'name' => '' ); + $choice_number ++; + } - //checking length - $lengths = explode(',',$card['lengths']); - $matches_length = false; - foreach($lengths as $length){ - if(strlen($number) == absint($length)){ - $matches_length = true; - break; - } - } + $field->choices = $choices; - return $matches_prefix && $matches_length; + $is_form_editor = GFCommon::is_form_editor(); + $is_entry_detail = GFCommon::is_entry_detail(); + $is_admin = $is_form_editor || $is_entry_detail; - } + $form_id = $is_admin ? rgget( 'id' ) : $field->formId; - private static function is_valid_card_checksum($number){ - $checksum = 0; - $num = 0; - $multiplier = 1; + $field->choices = apply_filters( 'gform_post_category_choices', $field->choices, $field, $form_id ); + $field->choices = apply_filters( "gform_post_category_choices_{$form_id}_{$field->id}", $field->choices, $field, $form_id ); - // Process each character starting at the right - for ($i = strlen($number) - 1; $i >= 0; $i--) { + if ( RGFormsModel::get_input_type( $field ) == 'checkbox' ) { + $field->inputs = $inputs; + } - //Multiply current digit by multiplier (1 or 2) - $num = $number{$i} * $multiplier; + return $field; + } - // If the result is in greater than 9, add 1 to the checksum total - if ($num >= 10) { - $checksum++; - $num -= 10; - } + public static function prepare_post_category_value( $value, $field, $mode = 'entry_detail' ) { - //Update checksum - $checksum += $num; + if ( ! is_array( $value ) ) { + $value = explode( ',', $value ); + } - //Update multiplier - $multiplier = $multiplier == 1 ? 2 : 1; - } + $cat_names = array(); + $cat_ids = array(); + foreach ( $value as $cat_string ) { + $ary = explode( ':', $cat_string ); + $cat_name = count( $ary ) > 0 ? $ary[0] : ''; + $cat_id = count( $ary ) > 1 ? $ary[1] : $ary[0]; - return $checksum % 10 == 0; + if ( ! empty( $cat_name ) ) { + $cat_names[] = $cat_name; + } - } + if ( ! empty( $cat_id ) ) { + $cat_ids[] = $cat_id; + } + } - public static function is_wp_version($min_version){ - return !version_compare(get_bloginfo("version"), "{$min_version}.dev1", '<'); - } + sort( $cat_names ); - public static function add_categories_as_choices($field, $value) { + switch ( $mode ) { + case 'entry_list': + $value = self::implode_non_blank( ', ', $cat_names ); + break; + case 'entry_detail': + $value = RGFormsModel::get_input_type( $field ) == 'checkbox' ? $cat_names : self::implode_non_blank( ', ', $cat_names ); + break; + case 'conditional_logic': + $value = array_values( $cat_ids ); + break; + } - $choices = $inputs = array(); - $is_post = isset($_POST["gform_submit"]); - $has_placeholder = rgar($field, 'categoryInitialItemEnabled') && RGFormsModel::get_input_type($field) == 'select'; + return $value; + } - if($has_placeholder) - $choices[] = array('text' => rgar($field, 'categoryInitialItem'), 'value' => '', 'isSelected' => true); + public static function calculate( $field, $form, $lead ) { - $display_all = rgar($field, "displayAllCategories"); + $formula = (string) apply_filters( 'gform_calculation_formula', $field->calculationFormula, $field, $form, $lead ); - $args = array('hide_empty' => false, 'orderby' => 'name'); + // replace multiple spaces and new lines with single space + // @props: http://stackoverflow.com/questions/3760816/remove-new-lines-from-string + $formula = trim( preg_replace( '/\s+/', ' ', $formula ) ); - if(!$display_all){ - foreach($field["choices"] as $field_choice_to_include){ - $args["include"][] = $field_choice_to_include["value"]; - } - } + preg_match_all( '/{[^{]*?:(\d+(\.\d+)?)(:(.*?))?}/mi', $formula, $matches, PREG_SET_ORDER ); - $args = apply_filters("gform_post_category_args_{$field["id"]}", apply_filters("gform_post_category_args", $args, $field), $field); - $terms = get_terms('category', $args); - - $terms_copy = unserialize(serialize($terms)); // deep copy the terms to avoid repeating GFCategoryWalker on previously cached terms. - $walker = new GFCategoryWalker(); - $categories = $walker->walk($terms_copy, 0, array(0)); // 3rd parameter prevents notices triggered by $walker::display_element() function which checks $args[0] - - foreach($categories as $category) { - if($display_all) { - $selected = $value == $category->term_id || - ( - empty($value) && - get_option('default_category') == $category->term_id && - RGFormsModel::get_input_type($field) == 'select' && // only preselect default category on select fields - !$is_post && - !$has_placeholder - ); - $choices[] = array('text' => $category->name, 'value' => $category->term_id, 'isSelected' => $selected); - } else { - foreach($field["choices"] as $field_choice){ - if($field_choice["value"] == $category->term_id){ - $choices[] = array('text' => $category->name, 'value' => $category->term_id); - break; - } - } - } - } + if ( is_array( $matches ) ) { + foreach ( $matches as $match ) { - if(empty($choices)) - $choices[] = array('text' => 'You must select at least one category.', 'value' => ''); + list( $text, $input_id ) = $match; + $value = self::get_calculation_value( $input_id, $form, $lead ); + $value = apply_filters( 'gform_merge_tag_value_pre_calculation', $value, $input_id, rgar( $match, 4 ), $field, $form, $lead ); + $formula = str_replace( $text, $value, $formula ); - $choice_number = 1; - foreach($choices as $choice) { + } + } - if($choice_number % 10 == 0) //hack to skip numbers ending in 0. so that 5.1 doesn't conflict with 5.10 - $choice_number++; + $result = preg_match( '/^[0-9 -\/*\(\)]+$/', $formula ) ? eval( "return {$formula};" ) : false; + $result = apply_filters( 'gform_calculation_result', $result, $formula, $field, $form, $lead ); - $input_id = $field["id"] . '.' . $choice_number; - $inputs[] = array('id' => $input_id, 'label' => $choice['text'], 'name' => ''); - $choice_number++; - } + return $result; + } - $field['choices'] = $choices; + public static function round_number( $number, $rounding ) { + if ( is_numeric( $rounding ) && $rounding >= 0 ) { + $number = round( $number, $rounding ); + } - $form_id = IS_ADMIN ? rgget("id") : rgar($field,"formId"); + return $number; + } - $field['choices'] = apply_filters("gform_post_category_choices", $field["choices"], $field, $form_id); - $field['choices'] = apply_filters("gform_post_category_choices_{$form_id}_{$field["id"]}", $field["choices"], $field, $form_id); + public static function get_calculation_value( $field_id, $form, $lead ) { - if(RGFormsModel::get_input_type($field) == 'checkbox') - $field['inputs'] = $inputs; + $filters = array( 'price', 'value', '' ); + $value = false; - return $field; - } + foreach ( $filters as $filter ) { + if ( is_numeric( $value ) ) { + //value found, exit loop + break; + } + $value = GFCommon::to_number( GFCommon::replace_variables( "{:{$field_id}:$filter}", $form, $lead ) ); + } - public static function prepare_post_category_value($value, $field, $mode = 'entry_detail') { + if ( ! $value || ! is_numeric( $value ) ) { + GFCommon::log_debug( "GFCommon::get_calculation_value(): No value or non-numeric value available for field #{$field_id}. Returning zero instead." ); + $value = 0; + } - if(!is_array($value)) - $value = explode(',', $value); + return $value; + } - $cat_names = array(); - $cat_ids = array(); - foreach($value as $cat_string) { - $ary = explode(":", $cat_string); - $cat_name = count($ary) > 0 ? $ary[0] : ""; - $cat_id = count($ary) > 1 ? $ary[1] : $ary[0]; + public static function conditional_shortcode( $attributes, $content = null ) { - if(!empty($cat_name)) - $cat_names[] = $cat_name; + extract( + shortcode_atts( + array( + 'merge_tag' => '', + 'condition' => '', + 'value' => '', + ), $attributes + ) + ); - if(!empty($cat_id)) - $cat_ids[] = $cat_id; - } + return RGFormsModel::matches_operation( $merge_tag, $value, $condition ) ? do_shortcode( $content ) : ''; - sort($cat_names); - - switch($mode) { - case 'entry_list': - $value = self::implode_non_blank(', ', $cat_names); - break; - case 'entry_detail': - $value = RGFormsModel::get_input_type($field) == 'checkbox' ? $cat_names : self::implode_non_blank(', ', $cat_names); - break; - case 'conditional_logic': - $value = array_values($cat_ids); - break; - } + } - return $value; - } + public static function is_valid_for_calcuation( $field ) { - public static function calculate($field, $form, $lead) { + $supported_input_types = array( 'text', 'select', 'number', 'checkbox', 'radio', 'hidden', 'singleproduct', 'price', 'hiddenproduct', 'calculation', 'singleshipping' ); + $unsupported_field_types = array( 'category' ); + $input_type = RGFormsModel::get_input_type( $field ); - $formula = (string) apply_filters( 'gform_calculation_formula', rgar( $field, 'calculationFormula' ), $field, $form, $lead ); + return in_array( $input_type, $supported_input_types ) && ! in_array( $input_type, $unsupported_field_types ); + } - // replace multiple spaces and new lines with single space - // @props: http://stackoverflow.com/questions/3760816/remove-new-lines-from-string - $formula = trim( preg_replace( '/\s+/', ' ', $formula ) ); + public static function log_error( $message ) { + if ( class_exists( 'GFLogging' ) ) { + GFLogging::include_logger(); + GFLogging::log_message( 'gravityforms', $message, KLogger::ERROR ); + } + } - preg_match_all( '/{[^{]*?:(\d+(\.\d+)?)(:(.*?))?}/mi', $formula, $matches, PREG_SET_ORDER ); + public static function log_debug( $message ) { + if ( class_exists( 'GFLogging' ) ) { + GFLogging::include_logger(); + GFLogging::log_message( 'gravityforms', $message, KLogger::DEBUG ); + } + } - if( is_array( $matches ) ) { - foreach( $matches as $match ) { + public static function echo_if( $condition, $text ) { - list( $text, $input_id ) = $match; - $value = self::get_calculation_value( $input_id, $form, $lead); - $formula = str_replace( $text, $value, $formula); + switch ( $text ) { + case 'checked': + $text = 'checked="checked"'; + break; + case 'selected': + $text = 'selected="selected"'; + } - } - } + echo $condition ? $text : ''; + } - $result = preg_match( '/^[0-9 -\/*\(\)]+$/', $formula ) ? eval( "return {$formula};" ) : false; - $result = apply_filters( 'gform_calculation_result', $result, $formula, $field, $form, $lead ); + public static function gf_global( $echo = true ) { - return $result; - } + require_once( GFCommon::get_base_path() . '/currency.php' ); - public static function round_number($number, $rounding ){ - if(is_numeric($rounding) && $rounding >= 0){ - $number = round($number, $rounding); - } - return $number; - } + $gf_global = array(); + $gf_global['gf_currency_config'] = RGCurrency::get_currency( GFCommon::get_currency() ); + $gf_global['base_url'] = GFCommon::get_base_url(); + $gf_global['number_formats'] = array(); + $gf_global['spinnerUrl'] = GFCommon::get_base_url() . '/images/spinner.gif'; - public static function get_calculation_value($field_id, $form, $lead) { + $gf_global_json = 'var gf_global = ' . json_encode( $gf_global ) . ';'; - $filters = array('price', 'value', ''); - $value = false; + if ( ! $echo ) { + return $gf_global_json; + } - foreach($filters as $filter) { - if (is_numeric($value)){ - //value found, exit loop - break; - } - $value = GFCommon::to_number(GFCommon::replace_variables("{:{$field_id}:$filter}", $form, $lead)); - } + echo $gf_global_json; + } - if(!$value || !is_numeric($value)) - $value = 0; + public static function gf_vars( $echo = true ) { + if ( ! class_exists( 'RGCurrency' ) ) { + require_once( 'currency.php' ); + } - return $value; - } + $gf_vars = array(); + $gf_vars['active'] = __( 'Active' , 'gravityforms' ); + $gf_vars['inactive'] = __( 'Inactive' , 'gravityforms' ); + $gf_vars['save'] = __( 'Save' , 'gravityforms' ); + $gf_vars['update'] = __( 'Update' , 'gravityforms' ); + $gf_vars['previousLabel'] = __( 'Previous' , 'gravityforms' ); + $gf_vars['selectFormat'] = __( 'Select a format' , 'gravityforms' ); + $gf_vars['editToViewAll'] = __( '5 of %d items shown. Edit field to view all' , 'gravityforms' ); + $gf_vars['enterValue'] = __( 'Enter a value' , 'gravityforms' ); + $gf_vars['formTitle'] = __( 'Untitled Form' , 'gravityforms' ); + $gf_vars['formDescription'] = __( 'We would love to hear from you! Please fill out this form and we will get in touch with you shortly.' , 'gravityforms' ); + $gf_vars['formConfirmationMessage'] = __( 'Thanks for contacting us! We will get in touch with you shortly.' , 'gravityforms' ); + $gf_vars['buttonText'] = __( 'Submit' , 'gravityforms' ); + $gf_vars['loading'] = __( 'Loading...' , 'gravityforms' ); + $gf_vars['thisFieldIf'] = __( 'this field if', 'gravityforms' ); + $gf_vars['thisPage'] = __( 'this page' , 'gravityforms' ); + $gf_vars['thisFormButton'] = __( 'this form button if', 'gravityforms' ); + $gf_vars['show'] = __( 'Show', 'gravityforms' ); + $gf_vars['hide'] = __( 'Hide', 'gravityforms' ); + $gf_vars['all'] = __( 'All', 'gravityforms' ); + $gf_vars['any'] = __( 'Any', 'gravityforms' ); + $gf_vars['ofTheFollowingMatch'] = __( 'of the following match:', 'gravityforms' ); + $gf_vars['is'] = __( 'is', 'gravityforms' ); + $gf_vars['isNot'] = __( 'is not', 'gravityforms' ); + $gf_vars['greaterThan'] = __( 'greater than', 'gravityforms' ); + $gf_vars['lessThan'] = __( 'less than', 'gravityforms' ); + $gf_vars['contains'] = __( 'contains', 'gravityforms' ); + $gf_vars['startsWith'] = __( 'starts with', 'gravityforms' ); + $gf_vars['endsWith'] = __( 'ends with', 'gravityforms' ); + + $gf_vars['thisConfirmation'] = __( 'Use this confirmation if', 'gravityforms' ); + $gf_vars['thisNotification'] = __( 'Send this notification if', 'gravityforms' ); + $gf_vars['confirmationSave'] = __( 'Save', 'gravityforms' ); + $gf_vars['confirmationSaving'] = __( 'Saving...', 'gravityforms' ); + $gf_vars['confirmationAreYouSure'] = __( 'Are you sure you wish to cancel these changes?', 'gravityforms' ); + $gf_vars['confirmationIssueSaving'] = __( 'There was an issue saving this confirmation.', 'gravityforms' ); + $gf_vars['confirmationConfirmDelete'] = __( 'Are you sure you wish to delete this confirmation?', 'gravityforms' ); + $gf_vars['confirmationIssueDeleting'] = __( 'There was an issue deleting this confirmation.', 'gravityforms' ); + $gf_vars['confirmationConfirmDiscard'] = __( 'There are unsaved changes to the current confirmation. Would you like to discard these changes?', 'gravityforms' ); + $gf_vars['confirmationDefaultName'] = __( 'Untitled Confirmation', 'gravityforms' ); + $gf_vars['confirmationDefaultMessage'] = __( 'Thanks for contacting us! We will get in touch with you shortly.', 'gravityforms' ); + $gf_vars['confirmationInvalidPageSelection'] = __( 'Please select a page.', 'gravityforms' ); + $gf_vars['confirmationInvalidRedirect'] = __( 'Please enter a URL.', 'gravityforms' ); + $gf_vars['confirmationInvalidName'] = __( 'Please enter a confirmation name.', 'gravityforms' ); + + $gf_vars['conditionalLogicDependency'] = __( 'This form contains conditional logic dependent upon this field. Are you sure you want to delete this field? \'OK\' to delete, \'Cancel\' to abort.', 'gravityforms' ); + $gf_vars['conditionalLogicDependencyChoice'] = __( 'This form contains conditional logic dependent upon this choice. Are you sure you want to delete this choice? \'OK\' to delete, \'Cancel\' to abort.', 'gravityforms' ); + $gf_vars['conditionalLogicDependencyChoiceEdit'] = __( 'This form contains conditional logic dependent upon this choice. Are you sure you want to modify this choice? \'OK\' to delete, \'Cancel\' to abort.', 'gravityforms' ); + + $gf_vars['mergeTagsTooltip'] = __( '
    Merge Tags
    Merge tags allow you to dynamically populate submitted field values in your form content wherever this merge tag icon is present.', 'gravityforms' ); + + $gf_vars['baseUrl'] = GFCommon::get_base_url(); + $gf_vars['gf_currency_config'] = RGCurrency::get_currency( GFCommon::get_currency() ); + $gf_vars['otherChoiceValue'] = GFCommon::get_other_choice_value(); + $gf_vars['isFormTrash'] = false; + $gf_vars['currentlyAddingField'] = false; + + $gf_vars['addFieldFilter'] = __( 'Add a condition' , 'gravityforms' ); + $gf_vars['removeFieldFilter'] = __( 'Remove a condition' , 'gravityforms' ); + $gf_vars['filterAndAny'] = __( 'Include results if {0} match:' , 'gravityforms' ); + + $gf_vars['customChoices'] = __( 'Custom Choices', 'gravityforms' ); + $gf_vars['predefinedChoices'] = __( 'Predefined Choices', 'gravityforms' ); + + + if ( is_admin() && rgget( 'id' ) ) { + $form = RGFormsModel::get_form_meta( rgget( 'id' ) ); + $gf_vars['mergeTags'] = GFCommon::get_merge_tags( $form['fields'], '', false ); + } - public static function conditional_shortcode($attributes, $content = null) { + $gf_vars_json = 'var gf_vars = ' . json_encode( $gf_vars ) . ';'; - extract(shortcode_atts(array( - 'merge_tag' => '', - 'condition' => '', - 'value' => '' - ), $attributes)); + if ( ! $echo ) { + return $gf_vars_json; + } else { + echo $gf_vars_json; + } + } - return RGFormsModel::matches_operation($merge_tag, $value, $condition) ? do_shortcode($content) : ''; + public static function is_bp_active() { + return defined( 'BP_VERSION' ) ? true : false; + } - } + public static function add_message( $message, $is_error = false ) { + if ( $is_error ) { + self::$errors[] = $message; + } else { + self::$messages[] = $message; + } + } - public static function is_valid_for_calcuation($field) { + public static function add_error_message( $message ) { + self::add_message( $message, true ); + } - $supported_input_types = array('text', 'select', 'number', 'checkbox', 'radio', 'hidden', 'singleproduct', 'price', 'hiddenproduct', 'calculation', 'singleshipping'); - $unsupported_field_types = array('category'); - $input_type = RGFormsModel::get_input_type($field); + public static function display_admin_message( $errors = false, $messages = false ) { - return in_array($input_type, $supported_input_types) && !in_array($input_type, $unsupported_field_types); - } + if ( ! $errors ) { + $errors = self::$errors; + } - public static function log_error($message){ - if(class_exists("GFLogging")) - { - GFLogging::include_logger(); - GFLogging::log_message("gravityforms", $message, KLogger::ERROR); - } - } + if ( ! $messages ) { + $messages = self::$messages; + } - public static function log_debug($message){ - if(class_exists("GFLogging")) - { - GFLogging::include_logger(); - GFLogging::log_message("gravityforms", $message, KLogger::DEBUG); - } - } + $errors = apply_filters( 'gform_admin_error_messages', $errors ); + $messages = apply_filters( 'gform_admin_messages', $messages ); + + if ( ! empty( $errors ) ) { + ?> +
    + 1 ) { ?> + + +

    + +
    + +
    + 1 ) { ?> + + +

    + +
    + ' . self::gf_vars( false ) . ''; + } + } - require_once(GFCommon::get_base_path() . '/currency.php'); + public static function maybe_add_leading_zero( $value ) { + $first_char = GFCommon::safe_substr( $value, 0, 1, 'utf-8' ); + if ( in_array( $first_char, array( '.', ',' ) ) ) { + $value = '0' . $value; + } - $gf_global = array(); - $gf_global["gf_currency_config"] = RGCurrency::get_currency(GFCommon::get_currency()); - $gf_global["base_url"] = GFCommon::get_base_url(); - $gf_global["number_formats"] = array(); - $gf_global["spinnerUrl"] = GFCommon::get_base_url() . '/images/spinner.gif'; + return $value; + } - $gf_global_json = 'var gf_global = ' . json_encode($gf_global) . ';'; + // used by the gfFieldFilterUI() jQuery plugin + public static function get_field_filter_settings( $form ) { + + $all_fields = $form['fields']; + + // set up filters + $fields = $all_fields; + $exclude_types = array( 'rank', 'page', 'html' ); + + $operators_by_input_type = array( + 'default' => array( 'is', 'isnot', '>', '<', ), + 'name' => array( 'is', 'isnot', '>', '<', 'contains' ), + 'address' => array( 'is', 'isnot', '>', '<', 'contains' ), + 'text' => array( 'is', 'isnot', '>', '<', 'contains' ), + 'textarea' => array( 'is', 'isnot', '>', '<', 'contains' ), + 'checkbox' => array( 'is' ), + 'multiselect' => array( 'contains' ), + 'number' => array( 'is', 'isnot', '>', '<' ), + 'select' => array( 'is', 'isnot', '>', '<' ), + 'likert' => array( 'is', 'isnot' ), + 'list' => array( 'contains' ) + ); + + for ( $i = 0; $i < count( $all_fields ); $i ++ ) { + $input_type = GFFormsmodel::get_input_type( $all_fields[ $i ] ); + if ( in_array( $input_type, $exclude_types ) ) { + unset( $fields[ $i ] ); + } + } + $fields = array_values( $fields ); - if(!$echo) - return $gf_global_json; + $field_filters = array( + array( + 'key' => '0', + 'text' => __( 'Any form field' , 'gravityforms' ), + 'operators' => array( 'contains', 'is' ), + 'preventMultiple' => false, + ), + ); - echo $gf_global_json; - } + foreach ( $fields as $field ) { - public static function gf_vars($echo = true) { - if(!class_exists("RGCurrency")) - require_once("currency.php"); - - $gf_vars = array(); - $gf_vars["active"] = __("Active", "gravityforms"); - $gf_vars["inactive"] = __("Inactive", "gravityforms"); - $gf_vars["save"] = __("Save", "gravityforms"); - $gf_vars["update"] = __("Update", "gravityforms"); - $gf_vars["previousLabel" ] = __("Previous", "gravityforms"); - $gf_vars["selectFormat" ] = __("Select a format", "gravityforms"); - $gf_vars["editToViewAll" ] = __("5 of %d items shown. Edit field to view all", "gravityforms"); - $gf_vars["enterValue" ] = __("Enter a value", "gravityforms"); - $gf_vars["formTitle" ] = __("Untitled Form", "gravityforms"); - $gf_vars["formDescription" ] = __("We would love to hear from you! Please fill out this form and we will get in touch with you shortly.", "gravityforms"); - $gf_vars["formConfirmationMessage" ] = __("Thanks for contacting us! We will get in touch with you shortly.", "gravityforms"); - $gf_vars["buttonText" ] = __("Submit", "gravityforms"); - $gf_vars["loading" ] = __("Loading...", "gravityforms"); - $gf_vars["thisFieldIf"] = __('this field if', 'gravityforms'); - $gf_vars["thisPage"] = __("this page", "gravityforms"); - $gf_vars["thisFormButton"] = __('this form button', 'gravityforms'); - $gf_vars["show"] = __('Show', 'gravityforms'); - $gf_vars["hide"] = __('Hide', 'gravityforms'); - $gf_vars["all"] = __('All', 'gravityforms'); - $gf_vars["any"] = __('Any', 'gravityforms'); - $gf_vars["ofTheFollowingMatch"] = __('of the following match:', 'gravityforms'); - $gf_vars["is"] = __('is', 'gravityforms'); - $gf_vars["isNot"] = __('is not', 'gravityforms'); - $gf_vars["greaterThan"] = __('greater than', 'gravityforms'); - $gf_vars["lessThan"] = __('less than', 'gravityforms'); - $gf_vars["contains"] = __('contains', 'gravityforms'); - $gf_vars["startsWith"] = __('starts with', 'gravityforms'); - $gf_vars["endsWith"] = __('ends with', 'gravityforms'); - - $gf_vars["thisConfirmation"] = __('Use this confirmation if', 'gravityforms'); - $gf_vars["thisNotification"] = __('Send this notification if', 'gravityforms'); - $gf_vars["confirmationSave"] = __('Save', 'gravityforms'); - $gf_vars["confirmationSaving"] = __('Saving...', 'gravityforms'); - $gf_vars["confirmationAreYouSure"] = __('Are you sure you wish to cancel these changes?', 'gravityforms'); - $gf_vars["confirmationIssueSaving"] = __('There was an issue saving this confirmation.', 'gravityforms'); - $gf_vars["confirmationConfirmDelete"] = __('Are you sure you wish to delete this confirmation?', 'gravityforms'); - $gf_vars["confirmationIssueDeleting"] = __('There was an issue deleting this confirmation.', 'gravityforms'); - $gf_vars["confirmationConfirmDiscard"] = __('There are unsaved changes to the current confirmation. Would you like to discard these changes?', 'gravityforms'); - $gf_vars["confirmationDefaultName"] = __('Untitled Confirmation', 'gravityforms'); - $gf_vars["confirmationDefaultMessage"] = __('Thanks for contacting us! We will get in touch with you shortly.', 'gravityforms'); - $gf_vars["confirmationInvalidPageSelection"] = __('Please select a page.', "gravityforms"); - $gf_vars["confirmationInvalidRedirect"] = __('Please enter a URL.', "gravityforms"); - $gf_vars["confirmationInvalidName"] = __('Please enter a confirmation name.', "gravityforms"); - - $gf_vars["conditionalLogicDependency"] = __('This form contains conditional logic dependent upon this field. Are you sure you want to delete this field? \'OK\' to delete, \'Cancel\' to abort.', 'gravityforms'); - $gf_vars["conditionalLogicDependencyChoice"] = __('This form contains conditional logic dependent upon this choice. Are you sure you want to delete this choice? \'OK\' to delete, \'Cancel\' to abort.', 'gravityforms'); - $gf_vars["conditionalLogicDependencyChoiceEdit"] = __('This form contains conditional logic dependent upon this choice. Are you sure you want to modify this choice? \'OK\' to delete, \'Cancel\' to abort.', 'gravityforms'); - - $gf_vars["mergeTagsTooltip"] = __('
    Merge Tags
    Merge tags allow you to dynamically populate submitted field values in your form content wherever this merge tag icon is present.', 'gravityforms'); - - $gf_vars["baseUrl"] = GFCommon::get_base_url(); - $gf_vars["gf_currency_config"] = RGCurrency::get_currency(GFCommon::get_currency()); - $gf_vars["otherChoiceValue"] = GFCommon::get_other_choice_value(); - $gf_vars["isFormTrash"] = false; - $gf_vars["currentlyAddingField"] = false; - - $gf_vars["addFieldFilter"] = __("Add a condition", "gravityforms"); - $gf_vars["removeFieldFilter"] = __("Remove a condition", "gravityforms"); - $gf_vars["filterAndAny"] = __("Include results if {0} match:", "gravityforms"); - - if(is_admin() && rgget('id')) { - $form = RGFormsModel::get_form_meta(rgget('id')); - $gf_vars["mergeTags"] = GFCommon::get_merge_tags($form['fields'], '', false); - } + $input_type = GFFormsModel::get_input_type( $field ); - $gf_vars_json = 'var gf_vars = ' . json_encode($gf_vars) . ';'; + $operators = isset( $operators_by_input_type[ $input_type ] ) ? $operators_by_input_type[ $input_type ] : $operators_by_input_type['default']; - if(!$echo){ - return $gf_vars_json; - } - else { - echo $gf_vars_json; - } - } + if ( $field->type == 'product' && in_array( $input_type, array( 'radio', 'select' ) ) ) { + $operators = array( 'is' ); + } elseif ( ! isset( $field->choices ) && ! in_array( 'contains', $operators ) ) { + $operators[] = 'contains'; + } - public static function is_bp_active() { - return defined('BP_VERSION') ? true : false; - } + $field_filter = array(); + $key = $field->id; + if ( $input_type == 'likert' && $field->gsurveyLikertEnableMultipleRows ) { + // multi-row likert fields + $field_filter['key'] = $key; + $field_filter['group'] = true; + $field_filter['text'] = GFFormsModel::get_label( $field ); + $sub_filters = array(); + $rows = $field->gsurveyLikertRows; + foreach ( $rows as $row ) { + $sub_filter = array(); + $sub_filter['key'] = $key . '|' . rgar( $row, 'value' ); + $sub_filter['text'] = rgar( $row, 'text' ); + $sub_filter['type'] = 'field'; + $sub_filter['preventMultiple'] = false; + $sub_filter['operators'] = $operators; + $sub_filter['values'] = $field->choices; + $sub_filters[] = $sub_filter; + } + $field_filter['filters'] = $sub_filters; + } elseif ( $input_type == 'name' && $field->nameFormat == '' || $input_type == 'address' ) { + // standard two input name field + $field_filter['key'] = $key; + $field_filter['group'] = true; + $field_filter['text'] = GFFormsModel::get_label( $field ); + $sub_filters = array(); + $inputs = $field->inputs; + foreach ( $inputs as $input ) { + $sub_filter = array(); + $sub_filter['key'] = rgar( $input, 'id' ); + $sub_filter['text'] = rgar( $input, 'label' ); + $sub_filter['preventMultiple'] = false; + $sub_filter['operators'] = $operators; + $sub_filters[] = $sub_filter; + } + $field_filter['filters'] = $sub_filters; + } else { + $field_filter['key'] = $key; + $field_filter['preventMultiple'] = false; + $field_filter['text'] = GFFormsModel::get_label( $field ); - public static function add_message($message, $is_error = false) { - if($is_error) { - self::$errors[] = $message; - } else { - self::$messages[] = $message; - } - } + $field_filter['operators'] = $operators; - public static function add_error_message($message) { - self::add_message($message, true); - } + if ( isset( $field->choices ) ) { + $field_filter['values'] = $field->choices; + } + } + $field_filters[] = $field_filter; - public static function display_admin_message($errors = false, $messages = false) { - - if(!$errors) - $errors = self::$errors; - - if(!$messages) - $messages = self::$messages; - - $errors = apply_filters('gform_admin_error_messages', $errors); - $messages = apply_filters('gform_admin_messages', $messages); - - if(!empty($errors)) { ?> -
    - 1) { ?> - - -

    - -
    - -
    - 1) { ?> - - -

    - -
    - $info_column ) { + $info_column['key'] = $key; + $info_column['preventMultiple'] = false; + $settings[] = $info_column; + } - private static function requires_gf_vars() { - $dependent_scripts = array( 'gform_form_admin', 'gform_gravityforms', 'gform_form_editor', 'gform_field_filter' ); - foreach( $dependent_scripts as $script ) { - if( wp_script_is( $script ) ) - return true; - } - return false; - } + return $settings; + } - public static function maybe_output_gf_vars() { - if( self::requires_gf_vars() ){ - echo ''; - } - } + public static function get_entry_info_filter_columns( $get_users = true ) { + $account_choices = array(); + if ( $get_users ) { + $args = apply_filters( 'gform_filters_get_users', array( 'number' => 200 ) ); + $accounts = get_users( $args ); + $account_choices = array(); + foreach ( $accounts as $account ) { + $account_choices[] = array( 'text' => $account->user_login, 'value' => $account->ID ); + } + } - public static function maybe_add_leading_zero($value){ - $first_char = GFCommon::safe_substr($value, 0, 1, 'utf-8'); - if(in_array($first_char, array(".", ","))) - $value = "0" . $value; - return $value; - } + return array( + 'entry_id' => array( + 'text' => __( 'Entry ID' , 'gravityforms' ), + 'operators' => array( 'is', 'isnot', '>', '<' ) + ), + 'date_created' => array( + 'text' => __( 'Entry Date' , 'gravityforms' ), + 'operators' => array( 'is', '>', '<' ), + 'placeholder' => __( 'yyyy-mm-dd' , 'gravityforms' ) + ), + 'is_starred' => array( + 'text' => __( 'Starred' , 'gravityforms' ), + 'operators' => array( 'is', 'isnot' ), + 'values' => array( + array( + 'text' => 'Yes', + 'value' => '1', + ), + array( + 'text' => 'No', + 'value' => '0', + ), + ) + ), + 'ip' => array( + 'text' => __( 'IP Address' , 'gravityforms' ), + 'operators' => array( 'is', 'isnot', '>', '<', 'contains' ) + ), + 'source_url' => array( + 'text' => __( 'Source URL' , 'gravityforms' ), + 'operators' => array( 'is', 'isnot', '>', '<', 'contains' ) + ), + 'payment_status' => array( + 'text' => __( 'Payment Status' , 'gravityforms' ), + 'operators' => array( 'is', 'isnot' ), + 'values' => array( + array( + 'text' => 'Paid', + 'value' => 'Paid', + ), + array( + 'text' => 'Processing', + 'value' => 'Processing', + ), + array( + 'text' => 'Failed', + 'value' => 'Failed', + ), + array( + 'text' => 'Active', + 'value' => 'Active', + ), + array( + 'text' => 'Cancelled', + 'value' => 'Cancelled', + ), + ) + ), + 'payment_date' => array( + 'text' => __( 'Payment Date' , 'gravityforms' ), + 'operators' => array( 'is', 'isnot', '>', '<' ) + ), + 'payment_amount' => array( + 'text' => __( 'Payment Amount' , 'gravityforms' ), + 'operators' => array( 'is', 'isnot', '>', '<', 'contains' ) + ), + 'transaction_id' => array( + 'text' => __( 'Transaction ID' , 'gravityforms' ), + 'operators' => array( 'is', 'isnot', '>', '<', 'contains' ) + ), + 'created_by' => array( + 'text' => __( 'User' , 'gravityforms' ), + 'operators' => array( 'is', 'isnot' ), + 'values' => $account_choices, + ) + ); + } - // used by the gfFieldFilterUI() jQuery plugin - public static function get_field_filter_settings($form) { + public static function get_entry_meta_filter_settings( $form_id ) { + $filters = array(); + $entry_meta = GFFormsModel::get_entry_meta( $form_id ); + if ( empty( $entry_meta ) ) { + return $filters; + } - $all_fields = $form["fields"]; + foreach ( $entry_meta as $key => $meta ) { + if ( isset( $meta['filter'] ) ) { + $filter = array(); + $filter['key'] = $key; + $filter['preventMultiple'] = isset( $meta['filter']['preventMultiple'] ) ? $meta['filter']['preventMultiple'] : false; + $filter['text'] = rgar( $meta, 'label' ); + $filter['operators'] = isset( $meta['filter']['operators'] ) ? $meta['filter']['operators'] : array( 'is', 'isnot' ); + if ( isset( $meta['filter']['choices'] ) ) { + $filter['values'] = $meta['filter']['choices']; + } + $filters[] = $filter; + } + } - // set up filters - $fields = $all_fields; - $exclude_types = array("rank", "page", "html"); + return $filters; + } - $operators_by_field_type = array( - "default" => array("is", "isnot", ">", "<"), - "checkbox" => array("is"), - "multiselect" => array("contains"), - "number" => array("is", "isnot", ">", "<"), - "likert" => array("is", "isnot"), - "list" => array("contains") - ); - for ($i = 0; $i < count($all_fields); $i++) { - $field_type = GFFormsmodel::get_input_type($all_fields[$i]); - if (in_array($field_type, $exclude_types)) - unset($fields[$i]); - } - $fields = array_values($fields); - - $field_filters = array( - array( - "key"=> "0", - "text" => __("Any form field", "gravityforms"), - "operators" => array("contains", "is") - ) - ); - - foreach ($fields as $field) { - - $input_type = GFFormsModel::get_input_type( $field ); - - $field_type = GFFormsModel::get_input_type($field); - - $operators = isset($operators_by_field_type[$field_type]) ? $operators_by_field_type[$field_type] : $operators_by_field_type["default"]; - - if ( $field['type'] == 'product' && in_array( $input_type, array( 'radio', 'select' ) ) ) { - $operators = array( 'is' ); - } elseif (!isset($field["choices"]) && !in_array("contains", $operators)){ - $operators[] = "contains"; - } - - $field_filter = array(); - $key = $field["id"]; - if ($field_type == "likert" && rgar($field, "gsurveyLikertEnableMultipleRows")) { - // multi-row likert fields - $field_filter["key"] = $key; - $field_filter["group"] = true; - $field_filter["text"] = GFFormsModel::get_label($field); - $sub_filters = array(); - $rows = rgar($field, "gsurveyLikertRows"); - foreach ($rows as $row) { - $sub_filter = array(); - $sub_filter["key"] = $key . "|" . rgar($row, "value"); - $sub_filter["text"] = rgar($row, "text"); - $sub_filter["type"] = "field"; - $sub_filter["preventMultiple"] = false; - $sub_filter["operators"] = $operators; - $sub_filter["values"] = $field["choices"]; - $sub_filters[] = $sub_filter; - } - $field_filter["filters"] = $sub_filters; - } elseif ($field_type == "name" && rgar($field, "nameFormat") == "" || $field_type == "address") { - // standard two input name field - $field_filter["key"] = $key; - $field_filter["group"] = true; - $field_filter["text"] = GFFormsModel::get_label($field); - $sub_filters = array(); - $inputs = rgar($field, "inputs"); - foreach ($inputs as $input) { - $sub_filter = array(); - $sub_filter["key"] = rgar($input, "id"); - $sub_filter["text"] = rgar($input, "label"); - $sub_filter["preventMultiple"] = false; - $sub_filter["operators"] = $operators; - $sub_filters[] = $sub_filter; - } - $field_filter["filters"] = $sub_filters; - } else { - $field_filter["key"] = $key; - $field_filter["preventMultiple"] = false; - $field_filter["text"] = GFFormsModel::get_label($field); - - $field_filter["operators"] = $operators; - - if (isset($field["choices"])) - $field_filter["values"] = $field["choices"]; - - - } - $field_filters[] = $field_filter; + public static function get_field_filters_from_post( $form ) { + $field_filters = array(); + $filter_fields = rgpost( 'f' ); + if ( is_array( $filter_fields ) ) { + $filter_operators = rgpost( 'o' ); + $filter_values = rgpost( 'v' ); + for ( $i = 0; $i < count( $filter_fields ); $i ++ ) { + $field_filter = array(); + $key = $filter_fields[ $i ]; + if ( 'entry_id' == $key ) { + $key = 'id'; + } + $operator = $filter_operators[ $i ]; + $val = $filter_values[ $i ]; + $strpos_row_key = strpos( $key, '|' ); + if ( $strpos_row_key !== false ) { //multi-row likert + $key_array = explode( '|', $key ); + $key = $key_array[0]; + $val = $key_array[1] . ':' . $val; + } + $field_filter['key'] = $key; - } - $form_id = $form["id"]; - $entry_meta_filters = self::get_entry_meta_filter_settings($form_id); - $field_filters = array_merge($field_filters, $entry_meta_filters); - $field_filters = array_values($field_filters); // reset the numeric keys in case some filters have been unset - $info_filters = self::get_entry_info_filter_settings(); - $field_filters = array_merge($field_filters, $info_filters); - $field_filters = array_values($field_filters); - return $field_filters; - } + $field = GFFormsModel::get_field( $form, $key ); + if ( $field ) { + $input_type = GFFormsModel::get_input_type( $field ); + if ( $field->type == 'product' && in_array( $input_type, array( 'radio', 'select' ) ) ) { + $operator = 'contains'; + } + } - public static function get_entry_info_filter_settings() { - $settings = array(); - $info_columns = self::get_entry_info_filter_columns(); - foreach($info_columns as $key => $info_column){ - $info_column["key"] = $key; - $info_column["preventMultiple"] = false; - $settings[] = $info_column; - } + $field_filter['operator'] = $operator; + $field_filter['value'] = $val; + $field_filters[] = $field_filter; + } + } + $field_filters['mode'] = rgpost( 'mode' ); - return $settings; - } + return $field_filters; + } - public static function get_entry_info_filter_columns($get_users = true){ - $account_choices = array(); - if($get_users){ - $args = apply_filters("gform_filters_get_users", array("number" => 200)); - $accounts = get_users($args); - $account_choices = array(); - foreach ($accounts as $account) { - $account_choices[] = array("text" => $account->user_login, "value" => $account->ID); - } - } - return array( - "entry_id" => array( - "text" => __("Entry ID", "gravityforms"), - "operators" => array( "is", "isnot", ">", "<") - ), - "date_created" => array( - "text" => __("Entry Date", "gravityforms"), - "operators" => array( "is", ">", "<"), - "placeholder" => __("yyyy-mm-dd", "gravityforms") - ), - "is_starred" => array( - "text" => __("Starred", "gravityforms"), - "operators" => array( "is", "isnot"), - "values" => array( - array( - "text" => "Yes", - "value" => "1" - ), - array( - "text" => "No", - "value" => "0" - ) - ) - ), - "ip" => array( - "text" => __("IP Address", "gravityforms"), - "operators" => array( "is", "isnot", ">", "<", "contains") - ), - "source_url" => array( - "text" => __("Source URL", "gravityforms"), - "operators" => array( "is", "isnot", ">", "<", "contains") - ), - "payment_status" => array( - "text" => __("Payment Status", "gravityforms"), - "operators" => array( "is", "isnot"), - "values" => array( - array( - "text" => "Paid", - "value" => "Paid" - ), - array( - "text" => "Processing", - "value" => "Processing" - ), - array( - "text" => "Failed", - "value" => "Failed" - ), - array( - "text" => "Active", - "value" => "Active" - ), - array( - "text" => "Cancelled", - "value" => "Cancelled" - ) - ) - ), - "payment_date" => array( - "text" => __("Payment Date", "gravityforms"), - "operators" => array( "is", "isnot", ">", "<") - ), - "payment_amount" => array( - "text" => __("Payment Amount", "gravityforms"), - "operators" => array( "is", "isnot", ">", "<", "contains") - ), - "transaction_id" => array( - "text" => __("Transaction ID", "gravityforms"), - "operators" => array( "is", "isnot", ">", "<", "contains") - ), - "created_by" => array( - "text" => __("User", "gravityforms"), - "operators" => array( "is", "isnot"), - "values" => $account_choices - ) - ); - } + public static function has_multifile_fileupload_field( $form ) { + $fileupload_fields = GFCommon::get_fields_by_type( $form, array( 'fileupload', 'post_custom_field' ) ); + if ( is_array( $fileupload_fields ) ) { + foreach ( $fileupload_fields as $field ) { + if ( $field->multipleFiles ) { + return true; + } + } + } - public static function get_entry_meta_filter_settings($form_id) { - $filters = array(); - $entry_meta = GFFormsModel::get_entry_meta($form_id); - if (empty($entry_meta)) - return $filters; - - foreach ($entry_meta as $key => $meta) { - if (isset($meta["filter"])) { - $filter = array(); - $filter["key"] = $key; - $filter["preventMultiple"] = isset($meta["filter"]["preventMultiple"]) ? $meta["filter"]["preventMultiple"] : false; - $filter["text"] = rgar($meta, "label"); - $filter["operators"] = isset($meta["filter"]["operators"]) ? $meta["filter"]["operators"] : array("is", "isnot"); - if (isset($meta["filter"]["choices"])) - $filter["values"] = $meta["filter"]["choices"]; - $filters[] = $filter; - } + return false; + } - } + public static function localize_gform_gravityforms_multifile() { + wp_localize_script( + 'gform_gravityforms', 'gform_gravityforms', array( + 'strings' => array( + 'invalid_file_extension' => __( 'This type of file is not allowed. Must be one of the following: ' , 'gravityforms' ), + 'delete_file' => __( 'Delete this file' , 'gravityforms' ), + 'in_progress' => __( 'in progress' , 'gravityforms' ), + 'file_exceeds_limit' => __( 'File exceeds size limit' , 'gravityforms' ), + 'illegal_extension' => __( 'This type of file is not allowed.' , 'gravityforms' ), + 'max_reached' => __( 'Maximum number of files reached' , 'gravityforms' ), + 'unknown_error' => __( 'There was a problem while saving the file on the server' , 'gravityforms' ), + 'currently_uploading' => __( 'Please wait for the uploading to complete' , 'gravityforms' ), + 'cancel' => __( 'Cancel' , 'gravityforms' ), + 'cancel_upload' => __( 'Cancel this upload' , 'gravityforms' ), + 'cancelled' => __( 'Cancelled' , 'gravityforms' ) + ), + 'vars' => array( + 'images_url' => GFCommon::get_base_url() . '/images' + ) + ) + ); + } - return $filters; - } + public static function send_resume_link( $message, $subject, $email, $embed_url, $resume_token ) { + $from = get_bloginfo( 'admin_email' ); + $from_name = get_bloginfo( 'name' ); - public static function get_field_filters_from_post($form){ - $field_filters = array(); - $filter_fields = rgpost("f"); - if (is_array($filter_fields)) { - $filter_operators = rgpost("o"); - $filter_values = rgpost("v"); - for ($i = 0; $i < count($filter_fields); $i++) { - $field_filter = array(); - $key = $filter_fields[$i]; - if("entry_id" == $key){ - $key = "id"; - } - $operator = $filter_operators[$i]; - $val = $filter_values[$i]; - $strpos_row_key = strpos($key, "|"); - if ($strpos_row_key !== false) { //multi-row likert - $key_array = explode("|", $key); - $key = $key_array[0]; - $val = $key_array[1] . ":" . $val; - } - $field_filter["key"] = $key; - - $field = GFFormsModel::get_field( $form, $key ); - if ( $field ) { - $input_type = GFFormsModel::get_input_type( $field ); - if ( $field['type'] == 'product' && in_array( $input_type, array( 'radio', 'select' ) ) ) { - $operator = 'contains'; - } - } - - $field_filter["operator"] = $operator; - $field_filter["value"] = $val; - $field_filters[] = $field_filter; - } - } - $field_filters["mode"] = rgpost("mode"); - return $field_filters; - } + $message_format = 'html'; - public static function has_multifile_fileupload_field($form){ - $fileupload_fields = GFCommon::get_fields_by_type($form, array("fileupload", "post_custom_field")); - if(is_array($fileupload_fields)){ - foreach($fileupload_fields as $field){ - if(rgar($field, "multipleFiles")) - return true; - } - } - return false; - } + $resume_url = add_query_arg( array( 'gf_token' => $resume_token ), $embed_url ); + $resume_link = "{$resume_url}"; + $message .= $resume_link; - public static function localize_gform_gravityforms_multifile(){ - wp_localize_script( 'gform_gravityforms', 'gform_gravityforms', array( - 'strings' => array( - 'invalid_file_extension' => __("This type of file is not allowed. Must be one of the following: ", "gravityforms" ), - 'delete_file' => __("Delete this file", "gravityforms"), - 'in_progress' => __("in progress", "gravityforms"), - 'file_exceeds_limit' => __("File exceeds size limit", "gravityforms"), - 'illegal_extension' => __("This type of file is not allowed." , "gravityforms"), - "max_reached" => __("Maximum number of files reached", "gravityforms"), - "unknown_error" => __("There was a problem while saving the file on the server", "gravityforms"), - "currently_uploading" => __("Please wait for the uploading to complete", "gravityforms"), - "cancel" => __("Cancel", "gravityforms"), - "cancel_upload" => __("Cancel this upload", "gravityforms"), - "cancelled" => __("Cancelled", "gravityforms") - ), - 'vars' => array( - 'images_url' => GFCommon::get_base_url() . "/images" - ) - ) ); - } + self::send_email( $from, $email, '', $from, $subject, $message, $from_name, $message_format ); + } - public static function safe_strlen($string){ + public static function safe_strlen( $string ) { - if(function_exists("mb_strlen")) - return mb_strlen($string); - else - return strlen($string); + if ( function_exists( 'mb_strlen' ) ) { + return mb_strlen( $string ); + } else { + return strlen( $string ); + } - } + } - public static function safe_substr($string, $start, $length = null){ - if(function_exists("mb_substr")) - return mb_substr($string, $start, $length); - else - return substr($string, $start, $length); - } + public static function safe_substr( $string, $start, $length = null ) { + if ( function_exists( 'mb_substr' ) ) { + return mb_substr( $string, $start, $length ); + } else { + return substr( $string, $start, $length ); + } + } - /** - * Reliablty compare floats. - * @param [float] $float1 - * @param [float] $float2 - * @param [string] $operator Supports: '<', '<=', '>', '>=', '==', '=', '!=' - * @return [bool] - */ - public static function compare_floats( $float1, $float2, $operator ) { - - $epsilon = 0.00001; - $is_equal = abs( floatval( $float1 ) - floatval( $float2 ) ) < $epsilon; - $is_greater = floatval( $float1 ) > floatval( $float2 ); - $is_less = floatval( $float1 ) < floatval( $float2 ); - - switch( $operator ) { - case '<': - return $is_less; - case '<=': - return $is_less || $is_equal; - case '>' : - return $is_greater; - case '>=': - return $is_greater || $is_equal; - case '==': - case '=': - return $is_equal; - case '!=': - return ! $is_equal; - } + /** + * Reliably compare floats. + * + * @param float $float1 + * @param float $float2 + * @param string $operator Supports: '<', '<=', '>', '>=', '==', '=', '!=' + * + * @return bool + */ + public static function compare_floats( $float1, $float2, $operator ) { + + $epsilon = 0.00001; + $is_equal = abs( floatval( $float1 ) - floatval( $float2 ) ) < $epsilon; + $is_greater = floatval( $float1 ) > floatval( $float2 ); + $is_less = floatval( $float1 ) < floatval( $float2 ); + + switch ( $operator ) { + case '<': + return $is_less; + case '<=': + return $is_less || $is_equal; + case '>' : + return $is_greater; + case '>=': + return $is_greater || $is_equal; + case '==': + case '=': + return $is_equal; + case '!=': + return ! $is_equal; + } - } + } - public static function encrypt( $text ) { + public static function encrypt( $text ) { $use_mcrypt = apply_filters('gform_use_mcrypt', function_exists( 'mcrypt_encrypt' ) ); if ( $use_mcrypt ){ @@ -5998,7 +4057,7 @@ public static function encrypt( $text ) { return $encrypted_value; } - public static function decrypt( $text ) { + public static function decrypt( $text ) { $use_mcrypt = apply_filters('gform_use_mcrypt', function_exists( 'mcrypt_decrypt' ) ); @@ -6014,7 +4073,7 @@ public static function decrypt( $text ) { } return $decrypted_value; - } + } public static function esc_like( $value ) { global $wpdb; @@ -6028,41 +4087,58 @@ public static function esc_like( $value ) { return $value; } + public static function is_form_editor(){ + return GFForms::get_page() == 'form_editor' || ( defined( 'DOING_AJAX' ) && DOING_AJAX && in_array( rgpost( 'action' ), array( 'rg_add_field', 'rg_refresh_field_preview', 'rg_duplicate_field', 'rg_delete_field', 'rg_change_input_type' ) ) ); + } + + public static function is_entry_detail(){ + return GFForms::get_page() == 'entry_detail_edit' || GFForms::get_page() == 'entry_detail' ; + } + + public static function is_entry_detail_view(){ + return GFForms::get_page() == 'entry_detail' ; + } + + public static function is_entry_detail_edit(){ + return GFForms::get_page() == 'entry_detail_edit'; + } } class GFCategoryWalker extends Walker { - /** - * @see Walker::$tree_type - * @since 2.1.0 - * @var string - */ - var $tree_type = 'category'; - - /** - * @see Walker::$db_fields - * @since 2.1.0 - * @todo Decouple this - * @var array - */ - var $db_fields = array ('parent' => 'parent', 'id' => 'term_id'); - - /** - * @see Walker::start_el() - * @since 2.1.0 - * - * @param string $output Passed by reference. Used to append additional content. - * @param object $category Category data object. - * @param int $depth Depth of category. Used for padding. - * @param array $args Uses 'selected' and 'show_count' keys, if they exist. - */ - function start_el( &$output, $object, $depth = 0, $args = array(), $current_object_id = 0) { - //$pad = str_repeat(' ', $depth * 3); - $pad = str_repeat('─', $depth); - if(!empty($pad)) - $pad .= " "; - $object->name = "{$pad}{$object->name}"; - $output[] = $object; - } + /** + * @see Walker::$tree_type + * @since 2.1.0 + * @var string + */ + var $tree_type = 'category'; + + /** + * @see Walker::$db_fields + * @since 2.1.0 + * @todo Decouple this + * @var array + */ + var $db_fields = array( 'parent' => 'parent', 'id' => 'term_id' ); + + /** + * @see Walker::start_el() + * @since 2.1.0 + * + * @param string $output Passed by reference. Used to append additional content. + * @param object $object Category data object. + * @param int $depth Depth of category. Used for padding. + * @param array $args Uses 'selected' and 'show_count' keys, if they exist. + * @param int $current_object_id + */ + function start_el( &$output, $object, $depth = 0, $args = array(), $current_object_id = 0 ) { + //$pad = str_repeat(' ', $depth * 3); + $pad = str_repeat( '─', $depth ); + if ( ! empty( $pad ) ) { + $pad .= ' '; + } + $object->name = "{$pad}{$object->name}"; + $output[] = $object; + } } /** @@ -6078,128 +4154,137 @@ function start_el( &$output, $object, $depth = 0, $args = array(), $current_obje * */ class GFCache { - private static $_transient_prefix = "GFCache_"; - private static $_cache = array(); + private static $_transient_prefix = 'GFCache_'; + private static $_cache = array(); - public static function get($key, &$found = null) { - global $blog_id; - if (is_multisite()) - $key = $blog_id . ':' . $key; + public static function get( $key, &$found = null ) { + global $blog_id; + if ( is_multisite() ) { + $key = $blog_id . ':' . $key; + } - if (isset(self::$_cache[$key])) { - $found = true; - $data = rgar(self::$_cache[$key], "data"); + if ( isset( self::$_cache[ $key ] ) ) { + $found = true; + $data = rgar( self::$_cache[ $key ], 'data' ); - return $data; - } + return $data; + } - $data = self::get_transient($key); + $data = self::get_transient( $key ); - if (false === ($data)) { - $found = false; + if ( false === ( $data ) ) { + $found = false; - return false; - } else { - self::$_cache[$key] = array("data" => $data, "is_persistent" => true); - $found = true; + return false; + } else { + self::$_cache[ $key ] = array( 'data' => $data, 'is_persistent' => true ); + $found = true; - return $data; - } + return $data; + } - } + } - public static function set($key, $data, $is_persistent = false, $expiration = 0) { - global $blog_id; - $success = true; + public static function set( $key, $data, $is_persistent = false, $expiration = 0 ) { + global $blog_id; + $success = true; - if (is_multisite()) - $key = $blog_id . ':' . $key; + if ( is_multisite() ) { + $key = $blog_id . ':' . $key; + } - if ($is_persistent) - $success = self::set_transient($key, $data, $expiration); + if ( $is_persistent ) { + $success = self::set_transient( $key, $data, $expiration ); + } - self::$_cache[$key] = array("data" => $data, "is_persistent" => $is_persistent); + self::$_cache[ $key ] = array( 'data' => $data, 'is_persistent' => $is_persistent ); - return $success; - } + return $success; + } - public static function delete($key) { - global $blog_id; - $success = true; + public static function delete( $key ) { + global $blog_id; + $success = true; - if (is_multisite()) - $key = $blog_id . ':' . $key; + if ( is_multisite() ) { + $key = $blog_id . ':' . $key; + } - if (isset(self::$_cache[$key])) { - if (self::$_cache[$key]["is_persistent"]) - $success = self::delete_transient($key); + if ( isset( self::$_cache[ $key ] ) ) { + if ( self::$_cache[ $key ]['is_persistent'] ) { + $success = self::delete_transient( $key ); + } - unset(self::$_cache[$key]); - } else { - $success = self::delete_transient($key); + unset( self::$_cache[ $key ] ); + } else { + $success = self::delete_transient( $key ); - } + } - return $success; - } + return $success; + } - public static function flush($flush_persistent = false) { - global $wpdb; + public static function flush( $flush_persistent = false ) { + global $wpdb; - self::$_cache = array(); + self::$_cache = array(); - if(false === $flush_persistent) - return true; + if ( false === $flush_persistent ) { + return true; + } - if (is_multisite()) { - $sql = " + if ( is_multisite() ) { + $sql = " DELETE FROM $wpdb->sitemeta WHERE meta_key LIKE '_site_transient_timeout_GFCache_%' OR meta_key LIKE '_site_transient_GFCache_%' "; - } else { - $sql = " + } else { + $sql = " DELETE FROM $wpdb->options WHERE option_name LIKE '_transient_timeout_GFCache_%' OR option_name LIKE '_transient_GFCache_%' "; - } - $rows_deleted = $wpdb->query($sql); + } + $rows_deleted = $wpdb->query( $sql ); - $success = $rows_deleted !== false ? true : false; + $success = $rows_deleted !== false ? true : false; - return $success; - } + return $success; + } - private static function delete_transient($key) { - $key = self::$_transient_prefix . wp_hash($key); - if (is_multisite()) - $success = delete_site_transient($key); - else - $success = delete_transient($key); + private static function delete_transient( $key ) { + $key = self::$_transient_prefix . wp_hash( $key ); + if ( is_multisite() ) { + $success = delete_site_transient( $key ); + } else { + $success = delete_transient( $key ); + } - return $success; - } + return $success; + } - private static function set_transient($key, $data, $expiration) { - $key = self::$_transient_prefix . wp_hash($key); - if (is_multisite()) - $success = set_site_transient($key, $data, $expiration); - else - $success = set_transient($key, $data, $expiration); + private static function set_transient( $key, $data, $expiration ) { + $key = self::$_transient_prefix . wp_hash( $key ); + if ( is_multisite() ) { + $success = set_site_transient( $key, $data, $expiration ); + } else { + $success = set_transient( $key, $data, $expiration ); + } - return $success; - } + return $success; + } - private static function get_transient($key) { - $key = self::$_transient_prefix . wp_hash($key); - if (is_multisite()) - $data = get_site_transient($key); - else - $data = get_transient($key); + private static function get_transient( $key ) { + $key = self::$_transient_prefix . wp_hash( $key ); + if ( is_multisite() ) { + $data = get_site_transient( $key ); + } else { + $data = get_transient( $key ); + } - return $data; - } + return $data; + } -} +} \ No newline at end of file diff --git a/css/admin.css b/css/admin.css index efa6d75..32b2756 100644 --- a/css/admin.css +++ b/css/admin.css @@ -1,18 +1,19 @@ @import url('datepicker.css'); @import url('jquery-ui.custom.css'); @import url('font-awesome.css'); +@import url('gravityfont.css'); @import url('rtl.css'); /* ---------------------------------------------------------------- admin.css -Gravity Forms Administration Form Styles +Gravity Forms Administration Styles http: //www.gravityforms.com -updated: December 12, 2013 12:14 PM +updated: January 22, 2015 9:27 AM Gravity Forms is a Rocketgenius project -copyright 2013 Rocketgenius Inc. +copyright 2008-2015 Rocketgenius Inc. http: //www.rocketgenius.com this may not be re-distrubited without the express written permission of the author. @@ -35,9 +36,8 @@ AND ANY CHANGES MADE HERE WILL BE OVERWRITTEN. input, textarea { outline-style: none; - font-family: sans-serif; - font-size: 12px; - padding: 2px 0; + font-family: inherit; + font-size: inherit; } ul { @@ -64,12 +64,13 @@ ul#gform_fields { } select { - font-size: 12px !important; + font-size: inherit; font-family: verdana,sans-serif; padding: 2px 0; } -/* As of 3.7.1, datepicker container shows up at the bottom of the page. This is quick fix to hide it. */ +/* As of 3.7.1, datepicker container shows up at the bottom of the page. This is quick fix to hide it. -----------------------------------------------------------------*/ + .ui-datepicker { display: none; } @@ -158,7 +159,6 @@ div.gforms_code pre { z-index: 100; position: relative; white-space: pre-wrap; - white-space: 0; word-wrap: break-word; padding: 6px 10px 6px 0; } @@ -199,7 +199,7 @@ div.delete-alert input.button:active { display: block; } -.settings_control_container{ +.settings_control_container { height: 18px; } @@ -223,7 +223,6 @@ li.field_setting select { display: -moz-inline-stack !important; display: inline-block !important; zoom: 1 !important; - *display: inline !important; } label.float_label { @@ -232,12 +231,17 @@ label.float_label { padding: 2px 0 0; } -#gform_fields li{ +#gform_fields li { border: 1px solid transparent; padding: 0px 10px 10px 10px; overflow-y: visible; } +.field_sublabel_hidden_label .ginput_complex.ginput_container input[type=text], +.field_sublabel_hidden_label .ginput_complex.ginput_container select { + margin-bottom: 0.750em; +} + #gform_fields li ul li { padding: 2px 0 4px 0; } @@ -278,6 +282,11 @@ label.float_label { margin-bottom: 4px; } +.gfield_time_hour i { + font-style: normal !important; + font-family: sans-serif !important; +} + .selectable.gfield { margin-bottom: 10px; } @@ -357,13 +366,14 @@ div#gform_last_page_settings.gform_settings_container .settings_control_containe } .field_name_first, +.field_name_middle, .field_name_last { - width: 50%; + width: 33.3%; float: left; } .field_name_first input,.ginput_complex .ginput_left input { - width: 90% !important; + width: 98% !important; } .field_name_last input { @@ -395,38 +405,70 @@ img#gfield_input_datepicker_icon { margin-top: 5px; } -.ginput_complex .ginput_left, -.ginput_complex .ginput_right { +.ginput_complex .ginput_left { width: 48%; float: left; } +.ginput_complex .ginput_right { + width: 48%; + float: right; + margin-right: .75%; +} + .ginput_complex input, .ginput_complex select { - width: 92% !important; + width: 99%; } .ginput_complex label, -.gfield_time_hour label,.gfield_time_minute label { +.gfield_time_hour label, +.gfield_time_minute label, +.gfield_time_ampm label { display: block; margin: 4px 0; + font-size: .8em; } .ginput_complex .name_prefix { - float: left; - width: 30px !important; - margin-right: 14px; + display: block; + width: auto; + clear: right; +} + +.ginput_complex .name_prefix select { + width: 4em; +} + +.ginput_complex .name_first, +.ginput_complex .name_middle, +.ginput_complex .name_last { + width: 32%; + display: -moz-inline-stack; + display: inline-block; + zoom: 1; +} + +.ginput_complex .name_first, +.ginput_complex .name_middle, +.ginput_complex .name_last { + width: 32%; + display: -moz-inline-stack; + display: inline-block; + zoom: 1; } .ginput_complex .name_suffix { - float: left; - width: 30px !important; + display: block; + width: auto; + clear: right; } -.ginput_complex .name_first,.ginput_complex .name_last { - float: left; - width: 100px; - margin-right: 8px; +.ginput_complex .name_suffix input[type=text] { + width: 4em !important; + display: block; + width: auto; + clear: left; } .top_label .gfield_label { @@ -450,7 +492,37 @@ img#gfield_input_datepicker_icon { text-align: right; } -.left_label ul.gfield_checkbox,.right_label ul.gfield_checkbox,.left_label ul.gfield_radio,.right_label ul.gfield_radio { +.right_label .gform_fileupload_multifile, +.left_label .gform_fileupload_multifile { + margin-left: 31%; +} + +/* Field Label Placement Overrides */ + +.hidden_label .gfield_label { + visibility:hidden; + line-height:0; +} + +.gfield.right_label .gfield_admin_icons, +.gfield.left_label .gfield_admin_icons { + padding-bottom:10px; +} + +.gfield label.hidden_sub_label { + display:none; +} + +.gfield .copy_values_option_container { + padding-bottom: 10px; +} +.gfield .copy_values_option_container .copy_values_enabled { + width:auto!important; +} + + +.left_label ul.gfield_checkbox,.right_label ul.gfield_checkbox, +.left_label ul.gfield_radio,.right_label ul.gfield_radio { margin-left: 32%; } @@ -466,7 +538,10 @@ img#gfield_input_datepicker_icon { .top_label input.large, .top_label select.large, -.top_label textarea.textarea { +.top_label textarea.textarea, +.hidden_label input.large, +.hidden_label select.large, +.hidden_label textarea.textarea { width: 96%; } @@ -583,7 +658,8 @@ table.gfield_list th { padding: 0 0 0.5em 0.7em !important } -.gform_wrapper .left_label .gfield_list, .gform_wrapper .right_label .gfield_list { +.gform_wrapper .left_label .gfield_list, +.gform_wrapper .right_label .gfield_list { width: 64% } @@ -591,7 +667,8 @@ table.gfield_list th { width: 96% } -.gform_wrapper .left_label .gf_list_one_column, .gform_wrapper .right_label .gf_list_one_column { +.gform_wrapper .left_label .gf_list_one_column, +.gform_wrapper .right_label .gf_list_one_column { width: 45% } @@ -616,7 +693,7 @@ table.gfield_list th { } -/* radio and checkbox styling - justifies lenghty labels ------------------------------------------------------*/ +/* radio and checkbox styling - justifies lengthy labels ------------------------------------------------------*/ ul.gfield_checkbox, ul.gfield_radio { @@ -643,27 +720,32 @@ ul.gfield_checkbox, ul.gfield_radio { .gfield_radio li input[type="radio"], .gfield_checkbox li input { float: left; - margin-top: 2px + margin-top: 2px; } -.description,.instruction, +.description, +.instruction, .gfield_description { - font-size: 11px; + font-size: .8em; line-height: 1.5; clear: both; padding: 10px 0 0 0; - font-family: verdana,sans-serif + font-family: inherit; } .description_above .gfield_description { - padding: 0 0 10px 0 + padding: 0 0 10px 0; +} + +.field_description_below .gfield_description { + padding: 10px 0 0 0; } .right_label .gfield_description, .left_label .gfield_description, .left_label .instruction, .right_label .instruction { - margin-left: 32.5% + margin-left: 32.5%; } .left_label .gsection .gsection_description, @@ -671,39 +753,35 @@ ul.gfield_checkbox, ul.gfield_radio { margin-left: 0; padding-left: 0; padding-top: 10px; - line-height: 1.5 -} - -.ginput_complex + .gfield_description { - padding-top: 0 !important + line-height: 1.5; } .gfield_required { color: #9E0B0F; - margin-left: 4px + margin-left: 4px; } textarea.small { - height: 80px + height: 80px; } textarea.medium { - height: 150px + height: 150px; } textarea.large { - height: 250px + height: 250px; } .gform_footer { padding: 10px 0 10px 10px; margin: 6px 0 0; - border-top: 1px dotted #CCC !important + border-top: 1px dotted #CCC !important; } .gform_wrapper .gform_footer+.right_label, .gform_wrapper .gform_footer+.left_label { - padding: 16px 0 10px 31% + padding: 16px 0 10px 31%; } div.gfield_admin_icons { @@ -713,17 +791,17 @@ div.gfield_admin_icons { } div.gform_admin_icons { - height: 20px + height: 20px; } ul#gform_fields.left_label div.gfield_admin_icons, ul#gform_fields.right_label div.gfield_admin_icons { - height: 30px + height: 30px; } div.gfield_admin_icons div.gfield_admin_header_title, div.gform_admin_icons div.gform_admin_header_title { - display: none + display: none; } .field_hover div.gfield_admin_icons div.gfield_admin_header_title, @@ -738,19 +816,6 @@ div.gform_admin_icons div.gform_admin_header_title { letter-spacing: 0.025em; } -a.close_icon { - position: absolute; - left: 100%; - margin-left: -27px; - top: 9px; - width: 16px; - height: 16px; - background-image: url(../images/close.png); - background-repeat: no-repeat; - text-indent: -9000px; - text-shadow: 0 1px 1px #FFF; -} - .gfield { position: relative } @@ -850,16 +915,16 @@ a.close_icon { img.gtitle_icon { float: left; - margin: 15px 7px 0 0 + margin: 15px 7px 0 0; } td.pad_top { - padding-top: 10px + padding-top: 10px; } #form_settings { padding: 0 5px 5px 5px; - margin-top: 10px + margin-top: 10px; } #form_settings h3 span i[class^="fa-"], @@ -871,11 +936,11 @@ td.pad_top { .input_size_a, .textarea_size_a { - width: 375px + width: 375px; } .form_button_options { - margin: 8px 0 + margin: 8px 0; } #form_button_text_container, @@ -884,16 +949,16 @@ td.pad_top { } .captcha_message { - padding: 5px + padding: 5px; } #after_insert_dialog div { - padding-bottom: 10px + padding-bottom: 10px; } #simplemodal-overlay { background-color: #000; - cursor: default + cursor: default; } #simplemodal-container { @@ -905,7 +970,7 @@ td.pad_top { -moz-border-radius: 8px; -webkit-border-radius: 8px; -khtml-border-radius: 8px; - border-radius: 8px + border-radius: 8px; } #simplemodal-container a.modalCloseImg { @@ -918,7 +983,7 @@ td.pad_top { position: absolute; top: -14px; right: -18px; - cursor: pointer + cursor: pointer; } div#after_insert_dialog h3 { @@ -930,7 +995,7 @@ div#after_insert_dialog h3 { -webkit-border-radius: 4px; -khtml-border-radius: 4px; border-radius: 4px; - margin: 0 0 4px + margin: 0 0 4px; } div.gold_notice { @@ -941,11 +1006,11 @@ div.gold_notice { -webkit-border-radius: 4px; -khtml-border-radius: 4px; border-radius: 4px; - margin: 0 0 4px + margin: 0 0 4px; } div#after_insert_dialog p { - text-align: center + text-align: center; } div.new-form-option a { @@ -964,7 +1029,7 @@ div.new-form-option a { border-radius: 4px; margin-bottom: 4px; background-image: url(../images/gf-new-option-bg.png); - background-repeat: repeat-x + background-repeat: repeat-x; } div.new-form-option a:hover { @@ -972,11 +1037,11 @@ div.new-form-option a:hover { border: 1px solid #D2E0EB; box-shadow: 0px 0px 5px #D2E0EB; -moz-box-shadow: 0px 0px 5px #D2E0EB; - -webkit-box-shadow: 0px 0px 5px #D2E0EB + -webkit-box-shadow: 0px 0px 5px #D2E0EB; } .installation_item_cell { - width: 40px + width: 40px; } .installation_item_message { @@ -986,44 +1051,34 @@ div.new-form-option a:hover { } div#wpbody { - position: relative + position: relative; } #add_fields { width: 285px; padding: 0; - text-align: left + text-align: left; } #floatMenu { width: 280px; z-index: 99; - padding-bottom: 20px + padding-bottom: 20px; } .button-title-link div.add-buttons-title { - height: 24px; + min-height: 24px; overflow: hidden; cursor: pointer; position: relative; - font-size: 15px; + font-size: 14px; border-width: 1px; border-style: solid; border-color: #DFDFDF; margin: 0 !important; - padding: 8px 10px 0; + padding: 8px 12px 5px; white-space: nowrap; - -webkit-border-radius: 4px; - -moz-border-radius: 4px; - border-radius: 4px; - background: #f8f8f8; - background: -moz-linear-gradient(top, #f8f8f8 0%, #eeeeee 100%); - background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f8f8f8), color-stop(100%,#eeeeee)); - background: -webkit-linear-gradient(top, #f8f8f8 0%,#eeeeee 100%); - background: -o-linear-gradient(top, #f8f8f8 0%,#eeeeee 100%); - background: -ms-linear-gradient(top, #f8f8f8 0%,#eeeeee 100%); - background: linear-gradient(to bottom, #f8f8f8 0%,#eeeeee 100%); - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f8f8f8', endColorstr='#eeeeee',GradientType=0 ); + background: #FFF; -webkit-box-shadow: 0px 1px 1px 0px rgba(0,0,0,0.1); -moz-box-shadow: 0px 1px 1px 0px rgba(0,0,0,0.1); box-shadow: 0px 1px 1px 0px rgba(0,0,0,0.1); @@ -1038,37 +1093,21 @@ div#wpbody { } .button-title-link.gf_button_title_active div.add-buttons-title { - -webkit-border-radius: 4px; - -webkit-border-bottom-right-radius: 0; - -webkit-border-bottom-left-radius: 0; - -moz-border-radius: 4px; - -moz-border-radius-bottomright: 0; - -moz-border-radius-bottomleft: 0; - border-radius: 4px; - border-bottom-right-radius: 0; - border-bottom-left-radius: 0 } .button-title-link { color: #464646; text-shadow: none; - font-family: Georgia,"Times New Roman","Bitstream Charter",Times,serif; - font-weight: normal; - cursor: text !important + font-weight: bold; + cursor: text !important; + font-family: "Open Sans",sans-serif; + line-height: 1.4; } .add-buttons { border-width: 0 1px 1px; border-style: none solid solid; - -moz-border-radius-bottomleft: 4px; - -moz-border-radius-bottomright: 4px; - -webkit-border-bottom-right-radius: 4px; - -webkit-border-bottom-left-radius: 4px; - -khtml-border-bottom-right-radius: 4px; - -khtml-border-bottom-left-radius: 4px; - border-bottom-right-radius: 4px; - border-bottom-left-radius: 4px; - background-color: #FCFCFC; + background-color: #FFF; border-color: #DFDFDF; padding: 12px; -webkit-box-shadow: 0px 1px 1px 0px rgba(0,0,0,0.1); @@ -1077,7 +1116,7 @@ div#wpbody { } ul.menu li { - margin-bottom: 10px + margin-bottom: 10px; } ol.field_type { @@ -1085,7 +1124,7 @@ ol.field_type { visibility: visible !important; overflow: hidden; margin: 0; - padding: 0 + padding: 0; } div.push-alert-gold { @@ -1099,7 +1138,7 @@ div.push-alert-gold { font-size: 1.1em; background-color: #FFFBCC; border-top: 1px solid #E6DB55; - border-bottom: 1px solid #E6DB55 + border-bottom: 1px solid #E6DB55; } div.push-alert-green { @@ -1113,7 +1152,7 @@ div.push-alert-green { min-width: 800px; padding: 10px 6px; text-align: center; - visibility: visible !important + visibility: visible !important; } div.push-alert-blue { @@ -1127,7 +1166,7 @@ div.push-alert-blue { min-width: 800px; padding: 10px 6px; text-align: center; - visibility: visible !important + visibility: visible !important; } div.push-alert-red { @@ -1141,14 +1180,15 @@ div.push-alert-red { min-width: 800px; padding: 10px 6px; text-align: center; - visibility: visible !important + visibility: visible !important; } #gfield_settings_category_container, -#gfield_settings_choices_container { +#gfield_settings_choices_container, +.gfield_settings_input_choices_container { border: 1px solid #DFDFDF; overflow: auto; - padding: 2px 0 6px + padding: 2px 0 6px; } .field-choice-handle { @@ -1158,150 +1198,159 @@ div.push-alert-red { #gfield_settings_category_container { margin: 8px 0 0; - max-height: 230px + max-height: 230px; } table td.gfield_category_cell { padding-top: 3px } -#gfield_settings_choices_container { +#gfield_settings_choices_container, +.gfield_settings_input_choices_container { margin: 8px 0 14px; - max-height: 230px + max-height: 230px; } -#field_choices li { +#field_choices li, +.field_input_choices li{ padding: 0 10px !important; - margin: 0 !important + margin: 0 !important; } #field_columns li { padding: 0 !important; - margin: 0 !important + margin: 0 !important; } #field_columns { padding: 10px 0 !important; - margin: 0 !important + margin: 0 !important; +} + +.input_active_icon { + cursor: pointer; + margin:15px 5px 0 0; } /* hidden value field ------------------------------------------------------*/ -#field_choices li input.field-choice-text { - width: 312px +#field_choices li input.field-choice-text, +.field_input_choices li input.field-choice-text { + width: 312px; } -#field_choices li input.field-choice-value { - display: none +#field_choices li input.field-choice-value, +.field_input_choices li input.field-choice-value { + display: none; } #field_choices li input.field-choice-price { - display: none + display: none; } .gfield_choice_header_label { padding-left: 51px; - display: none !important + display: none !important; } .gfield_choice_header_value { - display: none !important + display: none !important; } .gfield_choice_header_price { - display: none !important + display: none !important; } /* visible value field without price ------------------------------------------------------*/ .choice_with_value li input.field-choice-value { width: 155px !important; - display: inline !important + display: inline !important; } .choice_with_value li input.field-choice-text { - width: 155px !important + width: 155px !important; } .choice_with_value .gfield_choice_header_label { - display: inline !important + display: inline !important; } .choice_with_value .gfield_choice_header_value { padding-left: 120px; - display: inline !important + display: inline !important; } /* visible value field with price ------------------------------------------------------*/ .choice_with_value_and_price li input.field-choice-text { - width: 103px !important + width: 103px !important; } .choice_with_value_and_price li input.field-choice-value { width: 103px !important; - display: inline !important + display: inline !important; } .choice_with_value_and_price li input.field-choice-price { width: 103px !important; - display: inline !important + display: inline !important; } .choice_with_value_and_price .gfield_choice_header_label { - display: inline !important + display: inline !important; } .choice_with_value_and_price .gfield_choice_header_value { padding-left: 70px; - display: inline !important + display: inline !important; } .choice_with_value_and_price .gfield_choice_header_price { padding-left: 70px; - display: inline !important + display: inline !important; } /* visible price and no value ------------------------------------------------------*/ .choice_with_price li input.field-choice-text { - width: 155px !important + width: 155px !important; } .choice_with_price li input.field-choice-price { width: 155px !important; - display: inline !important + display: inline !important; } .choice_with_price .gfield_choice_header_label { - display: inline !important + display: inline !important; } .choice_with_price .gfield_choice_header_price { padding-left: 120px; - display: inline !important + display: inline !important; } /* columns (no price, value or default selection) ------------------------------------------------------*/ #field_columns li input.field-choice-value { - display: none + display: none; } #field_columns li input.field-choice-price { - display: none + display: none; } #field_columns li input.gfield_choice_radio { - display: none + display: none; } #field_columns li input.gfield_choice_checkbox { - display: none + display: none; } #field_columns li input.field-choice-text { - width: 312px !important + width: 312px !important; } /* view form styles ------------------------------------------------------*/ @@ -1360,47 +1409,30 @@ div.note-avatar { h6.note-author { font-weight: bold; - font-size: 13px; + font-size: 1.1em; + line-height: 1; margin: 0; padding: 0; } -p.note-author-email { +p.note-email { line-height: 1.3; margin: 0 !important; padding: 0 !important; text-align: left; } -div.detail-note-content:before { - content: " "; - width: 100%; - height: 30px; - position: absolute; - top: 0; - left: 0; - z-index: -1; - display: block; - background-color:#FFF; -} - div.detail-note-content { - margin: 10px 6px 10px 0; - padding: 20px 14px; - line-height: 1.8; - border: 1px solid #E6DB55; - border-bottom: 2px solid #E6DB55; + margin: 1.8em 1em 1.8em 0; + padding: 1.8em; + position: relative; + line-height: 1.8em; + border-left: 4px solid #E6DB55; background-color: #FFFBCC; - background-image: url(../images/top-highlight.png); - background-position: 0 0; - background-repeat: repeat-x; - -webkit-box-shadow: 0px 1px 1px 0px rgba(0,0,0,0.1); - -moz-box-shadow: 0px 1px 1px 0px rgba(0,0,0,0.1); - box-shadow: 0px 1px 1px 0px rgba(0,0,0,0.1); } div.detail-note-content p { - line-height: 1.8; + line-height: 30px; } div.detail-note-content.gforms_note_success{ @@ -1413,64 +1445,67 @@ div.detail-note-content.gforms_note_error{ border: 1px solid #CC0000; } + /* edit details form styles ------------------------------------------------------*/ -#namediv_admin { - position: relative; - min-width: 500px; + +body.forms_page_gf_entries table.entry-details td.detail-view label.detail-label,.ginput_full_admin label { + display: block; + font-weight: bold; + font-size: 13px; + margin-bottom: 4px } -body #namediv table.entry-details td.detail-view label.detail-label,.ginput_full_admin label {display: block; font-weight: bold; font-size: 13px; margin-bottom: 4px} -body #namediv div.ginput_complex_admin .ginput_full_admin label { +body.forms_page_gf_entries div.ginput_complex_admin .ginput_full_admin label { font-weight: normal; font-size: 11px; } -body #namediv table.entry-details input[type="text"], -body #namediv table.entry-details input { +body.forms_page_gf_entries table.entry-details input[type="text"], +body.forms_page_gf_entries table.entry-details input { width: 99%; } -body #namediv .ginput_complex_admin.ginput_container span.ginput_left, -body #namediv .ginput_complex_admin.ginput_container span.ginput_left_admin, -body #namediv .ginput_complex_admin.ginput_container span.ginput_right, -body #namediv .ginput_complex_admin.ginput_container span.ginput_right_admin { +body.forms_page_gf_entries .ginput_complex_admin.ginput_container span.ginput_left, +body.forms_page_gf_entries .ginput_complex_admin.ginput_container span.ginput_left_admin, +body.forms_page_gf_entries .ginput_complex_admin.ginput_container span.ginput_right, +body.forms_page_gf_entries .ginput_complex_admin.ginput_container span.ginput_right_admin { width: 49%; display: -moz-inline-stack; display: inline-block; zoom: 1; } -body #namediv .ginput_complex_admin.ginput_container span.ginput_left, -body #namediv .ginput_complex_admin.ginput_container span.ginput_left_admin { +body.forms_page_gf_entries .ginput_complex_admin.ginput_container span.ginput_left, +body.forms_page_gf_entries .ginput_complex_admin.ginput_container span.ginput_left_admin { margin-right: 1em; } -body #namediv .ginput_left_admin label, -body #namediv .ginput_right_admin label { +body.forms_page_gf_entries .ginput_left_admin label, +body.forms_page_gf_entries .ginput_right_admin label { display: block; } -body #namediv .ginput_container ul.gfield_radio li input, -body #namediv .ginput_container ul.gfield_checkbox li input { +body.forms_page_gf_entries .ginput_container ul.gfield_radio li input, +body.forms_page_gf_entries .ginput_container ul.gfield_checkbox li input { width: auto !important; } -body #namediv .ginput_left_admin input[type="text"] { +body.forms_page_gf_entries .ginput_left_admin input[type="text"] { width: 99% !important; } -body #namediv select.medium_admin { +body.forms_page_gf_entries select.medium_admin { max-width: 400px; } -body #namediv textarea.medium_admin { +body.forms_page_gf_entries textarea.medium_admin { width: 98%; min-width: 475px; min-height: 250px; } -body #namediv h2.detail_gsection_title { +body.forms_page_gf_entries h2.detail_gsection_title { font-family: helvetica,arial,sans-serif; font-size: 16px; font-style: normal !important; @@ -1480,6 +1515,14 @@ body #namediv h2.detail_gsection_title { padding: 0 !important; } + +body.forms_page_gf_entries div.ginput_complex_admin span label, +body.forms_page_gf_entries div.ginput_complex_admin span label { + display: block; + font-size: .8em; + margin: 4px 0; +} + /* notifications page styles ------------------------------------------------------*/ ul#form_notification_container,ul#form_autoresponder_container { @@ -1498,7 +1541,7 @@ ul#form_autoresponder_container li label { } #confirmation_list_form .check-column, -#notification_list_form .check-column{ +#notification_list_form .check-column { width:50px; } @@ -1597,9 +1640,9 @@ a.bulk-choice:first-child { .bulk-arrow-mid { float: left; - width: 40px; + width: 48px; height: 330px; - background-image: url(../images/arrow-right.jpg); + background-image: url(../images/arrow-right.png); background-position: 100% 50%; background-repeat: no-repeat; } @@ -1662,7 +1705,7 @@ table.form-table td .updated_base { font-size: 13px; } -#gform_no_product_field_message{ +#gform_no_product_field_message { background-color: #FFEBE8; border-color: #CC0000; border-width: 1px; @@ -1712,8 +1755,7 @@ table.form-table td .error_base { zoom: 1; } - -/*html block ------------------------------------------------------*/ +/* HTML block ------------------------------------------------------*/ li.gfield_html label.gfield_label { height: 18px; @@ -1721,7 +1763,7 @@ li.gfield_html label.gfield_label { /* simple captcha fields ------------------------------------------------------*/ -.gfield_captcha_input_container{ +.gfield_captcha_input_container { padding-top: 3px; } @@ -1974,7 +2016,6 @@ h3.gf_progressbar_title { display: -moz-inline-stack; display: inline-block; zoom: 1; - *display: inline } .gform_wrapper .gf_step span.gf_step_number { @@ -1998,19 +2039,26 @@ h3.gf_progressbar_title { margin: 12px 5px 5px 1px; padding: 3px 5px; text-align: center; - width: 200px; + width: 96%; + line-height: 1.8; background-color: #EEE; - border-color: #DDD !important + border-color: #DDD !important; +} + +ul.left_label .gfield_password_strength, +ul.right_label .gfield_password_strength { + margin-left: 32.5%; } /* tidy up the title area ----------------------------------------------------*/ p.search-box { - margin: 12px 0 0 0 + margin: 12px 0 0 0; } /* addonform settings ----------------------------------------------------*/ -#gform-settings .column-is_active{ + +#gform-settings .column-is_active { width:19px; } @@ -2021,7 +2069,7 @@ div#gform_heading.selectable.field_selected { background-position: 0 0; background-repeat: repeat-x; background-color: #F6FBFD; - padding-top: 8px + padding-top: 8px; } /* upgrade and renewal styles for settings page ----------------------------------------------------*/ @@ -2030,7 +2078,7 @@ div.gf_renew_license { border: 1px solid #CFADB3; color: #832525; background-color: #FAF2F5; - padding: 10px 0 20px 20px + padding: 10px 0 20px 20px; } p.gform_renew_expired strong { @@ -2040,13 +2088,13 @@ p.gform_renew_expired strong { div.gf_upgrade_license h4 { font-size: 14px; margin: 0; - padding: 0 + padding: 0; } div.gf_upgrade_developer_license, div.gf_upgrade_business_license { padding: 14px 0 0 140px; - min-height: 135px; + min-height: 175px; background-repeat: no-repeat; background-position: 0 0; } @@ -2054,11 +2102,13 @@ div.gf_upgrade_business_license { div.gf_upgrade_developer_license { background-image: url(../images/gravityforms-developer-upgrade.png); margin: 30px 0 0 0; + background-size: 133px 169px; } div.gf_upgrade_business_license { background-image: url(../images/gravityforms-business-upgrade.png); margin: 0; + background-size: 133px 169px; } p.gform_renew_expired, @@ -2066,7 +2116,28 @@ p.gform_renew_not_expired { background-position: 0 0; background-repeat: no-repeat; font-size: 1.4em; +} + +a.gf_upgrade_link { + -webkit-border-radius: 4; + -moz-border-radius: 4; + border-radius: 4px; + text-shadow: 1px 1px 2px #c24319; + font-family: Arial; + color: #ffffff; + font-size: 16px; + background: #D54E21; + padding: 10px 20px 11px 20px; + border: solid #c4461c 4px; + text-decoration: none; + display: -moz-inline-stack; + display: inline-block; + zoom: 1; +} +a.gf_upgrade_link:hover { + background: #db5428; + text-decoration: none; } /* update page status styles ----------------------------------------------------*/ @@ -2283,20 +2354,10 @@ ul#gf_form_toolbar_links { padding: 0 0 0 6px; border: 1px solid #DFDFDF; margin: 0; - -webkit-border-radius: 3px; - -moz-border-radius: 3px; - border-radius: 3px; -webkit-box-shadow: 0px 1px 1px 0px rgba(0,0,0,0.1); -moz-box-shadow: 0px 1px 1px 0px rgba(0,0,0,0.1); box-shadow: 0px 1px 1px 0px rgba(0,0,0,0.1); - background: #ffffff; - background: -moz-linear-gradient(top, #ffffff 0%, #f8f8f8 100%); - background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffffff), color-stop(100%,#f8f8f8)); - background: -webkit-linear-gradient(top, #ffffff 0%,#f8f8f8 100%); - background: -o-linear-gradient(top, #ffffff 0%,#f8f8f8 100%); - background: -ms-linear-gradient(top, #ffffff 0%,#f8f8f8 100%); - background: linear-gradient(to bottom, #ffffff 0%,#f8f8f8 100%); - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#f8f8f8',GradientType=0 ); + background: #FFF; } @@ -2474,16 +2535,13 @@ div#add_fields div#floatMenu ul#sidebarmenu1.menu li.add_field_button_container div#add_fields div#floatMenu ul#sidebarmenu1.menu li.add_field_button_container ul li.add-buttons ol.field_type li input.button:hover, div#add_fields div#floatMenu ul#sidebarmenu1.menu li.add_field_button_container ul li.add-buttons ol.field_type li input.button:focus, div#add_fields div#floatMenu ul#sidebarmenu1.menu li.add_field_button_container ul li.add-buttons ol.field_type li input.button:active { - -webkit-border-radius: 4px !important; - -moz-border-radius: 4px !important; - border-radius: 4px !important; + -webkit-border-radius: 3px !important; + -moz-border-radius: 3px !important; + border-radius: 3px !important; } div#add_fields div#floatMenu ul#sidebarmenu1.menu li.add_field_button_container ul li.add-buttons ol.field_type li input.button:hover { border-color: #CCC; - background-image:url(../images/gf-hovergrad-bg.png); - background-position: 0 0; - background-repeat: repeat-x; } div#add_fields div#floatMenu ul#sidebarmenu1.menu li.add_field_button_container ul li.add-buttons ol.field_type li input.button:focus, @@ -2556,7 +2614,7 @@ div#gravity-settings-icon, div#gravity-export-icon, div#gravity-import-icon, div#gravity-update-icon, -div#gravity-help-icon{ +div#gravity-help-icon { background-image:url(../images/gf-32-iconsprite.png); background-repeat: no-repeat; } @@ -2602,7 +2660,10 @@ div#major-publishing-actions { } html body.wp-admin div#wpwrap div#wpcontent div#wpbody div#wpbody-content div.wrap table.widefat thead tr th.manage-column, -html body.wp-admin div#wpwrap div#wpcontent div#wpbody div#wpbody-content div.wrap table.widefat tfoot tr th.manage-column {font-size: 13px !important} +html body.wp-admin div#wpwrap div#wpcontent div#wpbody div#wpbody-content div.wrap table.widefat tfoot tr th.manage-column { + font-size: 13px !important +} + th.manage-column.column-cb.check-column { vertical-align: top; } @@ -2885,7 +2946,7 @@ div.gform_card_icon { .ginput_complex select.ginput_card_expiration.ginput_card_expiration_month, .ginput_complex select.ginput_card_expiration.ginput_card_expiration_year { - width: 48% !important; + width: 47% !important; display: -moz-inline-stack; display: inline-block; zoom: 1; @@ -3270,14 +3331,16 @@ ul#gf_merge_tag_list a:hover { background-color: #EEE; } -.mt-gform_notification_message { +.mt-gform_notification_message, +.mt-form_confirmation_message { float: right; position: relative; right: 10px; top: 90px; } -#wp-gform_notification_message-wrap { +#wp-gform_notification_message-wrap, +#wp-form_confirmation_message-wrap { margin-right: 12px; } @@ -3539,6 +3602,30 @@ h3+h4.gf_settings_subheader { margin: 30px 0 30px 0 !important; } +#gform_fields .field-drop-zone { + border: 1px dashed #bbb; + background-color: #FFF; + margin: 0 auto 10px; + height: 75px; + width: 100%; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} + + +.gform_fields_empty{ + height:600px; +} + +.ui-draggable-dragging { + -webkit-transition: width .1s; + transition: width .1s; + width:120px; + z-index:9999; + color: #424242 !important; +} + ul.gforms_form_settings li { margin: 0; } @@ -3781,10 +3868,9 @@ h2.gf_admin_page_title span.gf_admin_page_subtitle { h2.gf_admin_page_title span.gf_admin_page_subtitle span.gf_admin_page_formid, h2.gf_admin_page_title span.gf_admin_page_subtitle span.gf_admin_page_formname { - background-color: #0074A2; color: #FFF; letter-spacing: 0.1em; - padding: 0 5px 1px 6px; + padding: 1px 8px 2px 9px; font-size: 11px !important; font-weight: normal !important; line-height: 1.8em !important; @@ -3800,11 +3886,11 @@ h2.gf_admin_page_title span.gf_admin_page_subtitle span.gf_admin_page_formname { } h2.gf_admin_page_title span.gf_admin_page_subtitle span.gf_admin_page_formid { - background-color: #0074A2; + background-color: #D54E21; } h2.gf_admin_page_title span.gf_admin_page_subtitle span.gf_admin_page_formname { - background-color: #333; + background-color: #0074A2; } #gform_notification_to_routing_container table { @@ -3813,6 +3899,9 @@ h2.gf_admin_page_title span.gf_admin_page_subtitle span.gf_admin_page_formname { /* Override the default jQuery UI styles for the editor tabs ------------------------------------------------------*/ +.ui-tabs>.ui-tabs-nav>.ui-state-disabled{ + display:none; +} ul#gform_fields li div#field_settings.ui-tabs div#gform_pagination div#pagination_settings.ui-tabs, @@ -3857,7 +3946,7 @@ input:checked+label { font-weight: 400; } -/* better float clearing in the formm builder ------------------------------------------------------*/ +/* better float clearing in the form builder ------------------------------------------------------*/ div.gf_clear { clear: both !important; @@ -3927,7 +4016,6 @@ div.gf_clear.gf_clear_complex { .gform-filter-field, .gform-filter-operator { height: 2em; - padding: 4px 2px 0 2px; box-sizing: border-box; -ms-box-sizing: border-box; -moz-box-sizing: border-box; @@ -3989,153 +4077,6 @@ tr.gf-locking.wp-locked img.gform_active_icon { display: none; } -/* Safari & Google Chrome (webkit) specific styles ------------------------------------------------------*/ - -@media screen and -webkit-min-device-pixel-ratio0#gfield_settings_category_container, -#gfield_settings_choices_container { - max-height: 222px -} - -/* Safari specific styles ----------------------------------------------------*/ - -div.wrap.gf_browser_safari div#add_fields div#floatMenu ul#sidebarmenu1.menu li.add_field_button_container ul li.add-buttons ol.field_type li input.button, -div.wrap.gf_browser_safari div#add_fields div#floatMenu ul#sidebarmenu1.menu li.add_field_button_container ul li.add-buttons ol.field_type li input.button:hover, -div.wrap.gf_browser_safari div#add_fields div#floatMenu ul#sidebarmenu1.menu li.add_field_button_container ul li.add-buttons ol.field_type li input.button:focus, -div.wrap.gf_browser_safari div#add_fields div#floatMenu ul#sidebarmenu1.menu li.add_field_button_container ul li.add-buttons ol.field_type li input.button:active { - padding-top: 6px; - padding-bottom: 6px; -} - -div.wrap.gf_browser_safari .ginput_complex .ginput_cardinfo_right span.ginput_card_security_code_icon { - top: -2px; -} - -div.wrap.gf_browser_safari div#add_fields div#floatMenu ul#sidebarmenu1.menu li.add_field_button_container ul li.add-buttons ol.field_type li input.button, -div.wrap.gf_browser_safari div#add_fields div#floatMenu ul#sidebarmenu1.menu li.add_field_button_container ul li.add-buttons ol.field_type li input.button:hover, -div.wrap.gf_browser_safari div#add_fields div#floatMenu ul#sidebarmenu1.menu li.add_field_button_container ul li.add-buttons ol.field_type li input.button:focus, -div.wrap.gf_browser_safari div#add_fields div#floatMenu ul#sidebarmenu1.menu li.add_field_button_container ul li.add-buttons ol.field_type li input.button:active { - line-height: 10px; -} - -div.wrap.gf_browser_safari .ui-tabs-panel ul li label.inline { - margin-bottom: 0 !important; -} - -/* Firefox specific styles ----------------------------------------------------*/ - -div.wrap.gf_browser_gecko div.new-form-option a { - padding: 16px 16px 14px 16px; -} - -div.wrap.gf_browser_gecko .ginput_complex .ginput_cardinfo_right span.ginput_card_security_code_icon { - top: -4px; -} - -div.wrap.gf_browser_gecko .ui-tabs-panel ul li label.inline { - margin-bottom: 0 !important; - margin-top: 1px !important; -} - - -div.wrap.gf_browser_gecko li.gf_form_switcher select#form_switcher { - max-width: 200px; - height: 24px; -} - -/* Internet Explorer specific styles ----------------------------------------------------*/ - -div.wrap.gf_browser_ie .menu.collapsible ol.field_type li { - width: 48%; -} - -div.wrap.gf_browser_ie .menu.collapsible ol.field_type li input.button { - width: 96% !important; -} - -div.wrap.gf_browser_ie .menu.collapsible li { - min-width: 20% !important; -} - -div.wrap.gf_browser_ie .gfield_checkbox li input[type="checkbox"], -div.wrap.gf_browser_ie .gfield_radio li input[type="radio"], -div.wrap.gf_browser_ie .gfield_checkbox li input { - margin-top: 0; -} - -.bulk-arrow-mid { - height: 300px; -} - -textarea#gfield_bulk_add_input { - width: 320px; - height: 290px; -} - -#TB_ajaxContent { - height: 400px !important; -} - -div.wrap.gf_browser_ie .ginput_complex .ginput_cardinfo_right input.ginput_card_security_code { - top: 0; -} - -div.wrap.gf_browser_ie .ginput_complex .ginput_cardinfo_right span.ginput_card_security_code_icon { - position: relative; - top: -2px; -} - -div.wrap.gf_browser_ie .menu.collapsible ol.field_type li { - width: 50%; - overflow: hidden; -} - -div.wrap.gf_browser_ie.gf_browser_ie8 .menu.collapsible ol.field_type li input.button, -div.wrap.gf_browser_ie.gf_browser_ie9 .menu.collapsible ol.field_type li input.button { - width: 92% !important; -} - -div.wrap.gf_browser_ie input.button-primary.gfbutton, -div.wrap.gf_browser_ie input.button-primary, -div.wrap.gf_browser_ie input.gfbutton { - padding: 0 6px; - line-height: 1em; -} - -div.wrap.gf_browser_ie ol.field_type { - width: 100% !important; -} - -div.wrap.gf_browser_ie ol.field_type li { - padding: 0 !important; -} - -div.wrap.gf_browser_ie ol.field_type input.button[type="button"] { - width: 140px !important; -} - -/* Google Chrome specific styles ----------------------------------------------------*/ - -body .gf_browser_chrome input.button-primary.gfbutton, -body .gf_browser_chrome button.button-primary.gfbutton, -body .gf_browser_chrome a.button-primary.gfbutton { - line-height: 1em !important; -} - -body .gf_browser_chrome h2.gf_admin_page_title span.gf_admin_page_subtitle { - margin-top: 2px; -} - -body .gf_browser_chrome .ui-tabs-panel ul li label.inline { - margin-bottom: 0 !important; - margin-top: 1px !important; -} - -div.wrap.gf_browser_chrome .gfield_checkbox li input[type="checkbox"], -div.wrap.gf_browser_chrome .gfield_radio li input[type="radio"], -div.wrap.gf_browser_chrome .gfield_checkbox li input { - margin-left: 2px !important; -} - /* new pagebreak styles ----------------------------------------------------*/ div.gf-pagebreak-container { @@ -4254,16 +4195,11 @@ body.mp6 #namediv input[type=radio] { width: auto !important; } - - - - span.gf_settings_description { display: block; margin-top: 6px; } - div.gf-html-container { border: 1px solid #E4E4E4; padding: 20px; @@ -4279,6 +4215,11 @@ div.gf-html-container span.gf_blockheader { line-height: 16px; } +ul.gform_fields.left_label li.gfield.gfield_html label.gfield_label, +ul.gform_fields.right_label li.gfield.gfield_html label.gfield_label { + float: none !important; +} + a.gf_insert_field_choice, a.gf_delete_field_choice { color: #9B9B9B; @@ -4325,4 +4266,172 @@ a.gf_delete_field_choice:active { .gaddon-section .settings-field-map-table tbody tr td { border-bottom: 1px dotted #eee !important; +} + +/* resize the sub-settings tables for more verbose inputs ----------------------------------------------------*/ + +table tbody tr#gform_notification_to_email_container.notification_to_container td.gf_sub_settings_cell div.gf_animate_sub_settings table th, +table tbody tr#gform_notification_to_field_container.notification_to_container td.gf_sub_settings_cell div.gf_animate_sub_settings table tbody tr th { + padding-left: 10px; + width: 175px !important; +} + +table tbody tr#gform_notification_to_email_container.notification_to_container td.gf_sub_settings_cell div.gf_animate_sub_settings table { + width: 100% !important; +} + +div#gform_notification_to_routing_rules div input:first-child { + min-width: 50%; +} + +/* Safari specific styles ----------------------------------------------------*/ + +div.wrap.gf_browser_safari div#add_fields div#floatMenu ul#sidebarmenu1.menu li.add_field_button_container ul li.add-buttons ol.field_type li input.button, +div.wrap.gf_browser_safari div#add_fields div#floatMenu ul#sidebarmenu1.menu li.add_field_button_container ul li.add-buttons ol.field_type li input.button:hover, +div.wrap.gf_browser_safari div#add_fields div#floatMenu ul#sidebarmenu1.menu li.add_field_button_container ul li.add-buttons ol.field_type li input.button:focus, +div.wrap.gf_browser_safari div#add_fields div#floatMenu ul#sidebarmenu1.menu li.add_field_button_container ul li.add-buttons ol.field_type li input.button:active { + padding-top: 6px; + padding-bottom: 6px; +} + +div.wrap.gf_browser_safari .ginput_complex .ginput_cardinfo_right span.ginput_card_security_code_icon { + top: -2px; +} + +div.wrap.gf_browser_safari div#add_fields div#floatMenu ul#sidebarmenu1.menu li.add_field_button_container ul li.add-buttons ol.field_type li input.button, +div.wrap.gf_browser_safari div#add_fields div#floatMenu ul#sidebarmenu1.menu li.add_field_button_container ul li.add-buttons ol.field_type li input.button:hover, +div.wrap.gf_browser_safari div#add_fields div#floatMenu ul#sidebarmenu1.menu li.add_field_button_container ul li.add-buttons ol.field_type li input.button:focus, +div.wrap.gf_browser_safari div#add_fields div#floatMenu ul#sidebarmenu1.menu li.add_field_button_container ul li.add-buttons ol.field_type li input.button:active { + line-height: 10px; +} + +div.wrap.gf_browser_safari .ui-tabs-panel ul li label.inline { + margin-bottom: 0 !important; +} + +#gfield_settings_category_container, +#gfield_settings_choices_container, +.gfield_settings_input_choices_container { + max-height: 222px +} + +/* Firefox specific styles ----------------------------------------------------*/ + +div.wrap.gf_browser_gecko div.new-form-option a { + padding: 16px 16px 14px 16px; +} + +div.wrap.gf_browser_gecko .ginput_complex .ginput_cardinfo_right span.ginput_card_security_code_icon { + top: -4px; +} + +div.wrap.gf_browser_gecko .ui-tabs-panel ul li label.inline { + margin-bottom: 0 !important; + margin-top: 1px !important; +} + + +div.wrap.gf_browser_gecko li.gf_form_switcher select#form_switcher { + max-width: 200px; + height: 24px; +} + +/* Internet Explorer specific styles ----------------------------------------------------*/ + +div.wrap.gf_browser_ie .menu.collapsible ol.field_type li { + width: 48%; +} + +div.wrap.gf_browser_ie .menu.collapsible ol.field_type li input.button { + width: 96% !important; +} + +div.wrap.gf_browser_ie .menu.collapsible li { + min-width: 20% !important; +} + +div.wrap.gf_browser_ie .gfield_checkbox li input[type="checkbox"], +div.wrap.gf_browser_ie .gfield_radio li input[type="radio"], +div.wrap.gf_browser_ie .gfield_checkbox li input { + margin-top: 0; +} + +.bulk-arrow-mid { + height: 300px; +} + +textarea#gfield_bulk_add_input { + width: 320px; + height: 290px; +} + +#TB_ajaxContent { + height: 400px !important; +} + +div.wrap.gf_browser_ie .ginput_complex .ginput_cardinfo_right input.ginput_card_security_code { + top: 0; +} + +div.wrap.gf_browser_ie .ginput_complex .ginput_cardinfo_right span.ginput_card_security_code_icon { + position: relative; + top: -2px; +} + +div.wrap.gf_browser_ie .menu.collapsible ol.field_type li { + width: 50%; + overflow: hidden; +} + +div.wrap.gf_browser_ie.gf_browser_ie8 .menu.collapsible ol.field_type li input.button, +div.wrap.gf_browser_ie.gf_browser_ie9 .menu.collapsible ol.field_type li input.button { + width: 92% !important; +} + +div.wrap.gf_browser_ie input.button-primary.gfbutton, +div.wrap.gf_browser_ie input.button-primary, +div.wrap.gf_browser_ie input.gfbutton { + padding: 0 6px; + line-height: 1em; +} + +div.wrap.gf_browser_ie ol.field_type { + width: 100% !important; +} + +div.wrap.gf_browser_ie ol.field_type li { + padding: 0 !important; +} + +div.wrap.gf_browser_ie ol.field_type input.button[type="button"] { + width: 140px !important; +} + +/* Google Chrome specific styles ----------------------------------------------------*/ + +body .gf_browser_chrome input.button-primary.gfbutton, +body .gf_browser_chrome button.button-primary.gfbutton, +body .gf_browser_chrome a.button-primary.gfbutton { + line-height: 1em !important; +} + +body .gf_browser_chrome h2.gf_admin_page_title span.gf_admin_page_subtitle { + margin-top: 2px; +} + +body .gf_browser_chrome .ui-tabs-panel ul li label.inline { + margin-bottom: 0 !important; + margin-top: 1px !important; +} + +div.wrap.gf_browser_chrome .gfield_checkbox li input[type="checkbox"], +div.wrap.gf_browser_chrome .gfield_radio li input[type="radio"], +div.wrap.gf_browser_chrome .gfield_checkbox li input { + margin-left: 2px !important; +} + +#gfield_settings_category_container, +#gfield_settings_choices_container, +.gfield_settings_input_choices_container { + max-height: 222px } \ No newline at end of file diff --git a/css/browsers.css b/css/browsers.css index f1ac34e..a0c7897 100644 --- a/css/browsers.css +++ b/css/browsers.css @@ -4,10 +4,10 @@ browsers.css Gravity Forms Browser-Specific CSS http://www.gravityforms.com -updated: June 3, 2013 5:39 PM +updated: January 28, 2015 2:05 PM Gravity Forms is a Rocketgenius project -copyright 2013 Rocketgenius Inc. +copyright 2008-2015 Rocketgenius Inc. http: //www.rocketgenius.com this may not be redistributed without the express written permission of the author. @@ -43,7 +43,21 @@ to no. .gform_wrapper.gf_browser_safari .gfield_checkbox li input[type=checkbox], .gform_wrapper.gf_browser_safari .gfield_radio li input[type=radio], .gform_wrapper.gf_browser_safari .gfield_checkbox li input { - margin-top: 4px; + margin-top: 0.250em; +} + +.gform_wrapper.gf_browser_safari.fixdrop_wrapper select { + height: 2.250em; + line-height: 2.125em; + background: inherit !important; + border-color: #A6A6A6; + border-style: solid; + margin-top: 1px; + margin-bottom: 1px; +} + +.gform_wrapper.gf_browser_safari select[multiple=multiple] { + height: auto !important; } /* Chrome specific rules ------------------------------------------------------*/ @@ -66,14 +80,48 @@ to no. .gform_wrapper.gf_browser_chrome .ginput_complex select, .gform_wrapper.gf_browser_chrome .ginput_complex .ginput_right select { - padding: 5px 0 5px; - margin-bottom: 5px; + text-indent: 0.188em; + line-height: 1.5em; + margin-bottom: 0.313em; } .gform_wrapper.gf_browser_chrome .gfield_checkbox li input[type=checkbox], .gform_wrapper.gf_browser_chrome .gfield_radio li input[type=radio], .gform_wrapper.gf_browser_chrome .gfield_checkbox li input { - margin-top: 4px; + margin-top: 0.375em; +} + +.gform_wrapper.gf_browser_chrome ul.gform_fields li.gfield div.ginput_complex span.ginput_left select, +.gform_wrapper.gf_browser_chrome ul.gform_fields li.gfield div.ginput_complex span.ginput_right select, +.gform_wrapper.gf_browser_chrome ul.gform_fields li.gfield select { + margin-left: 0.063em; +} + +.gform_wrapper.gf_browser_chrome ul.gform_fields li.gfield input[type=radio] { + margin-left: 0.063em; +} + +.gform_wrapper.gf_browser_chrome ul.gform_fields li.gfield span.name_first, +.gform_wrapper.gf_browser_chrome ul.gform_fields li.gfield span.name_middle, +.gform_wrapper.gf_browser_chrome ul.gform_fields li.gfield span.name_last { + padding-top: 2px; +} + +.gform_wrapper.gf_browser_chrome.fixdrop_wrapper select { + height: 2.250em; + line-height: 2.125em; + background: inherit !important; + border-style: solid; +} + +.gform_wrapper.gf_browser_chrome select[multiple=multiple] { + height: auto !important; +} + +@media all and (max-width: 480px), all and (max-device-width: 480px) { + body .gform_wrapper.gf_browser_chrome select { + width: 93.75% !important; + } } /* Firefox specific rules ------------------------------------------------------*/ @@ -88,15 +136,21 @@ to no. .gform_wrapper.gf_browser_gecko ul.gform_fields li.gfield div.ginput_complex span.ginput_left select, .gform_wrapper.gf_browser_gecko ul.gform_fields li.gfield div.ginput_complex span.ginput_right select, .gform_wrapper.gf_browser_gecko ul.gform_fields li.gfield select { - margin-left: 2px; + margin-left: 0.063em; } .gform_wrapper.gf_browser_gecko .ginput_complex .ginput_cardinfo_left select.ginput_card_expiration.ginput_card_expiration_month { - margin-right: 2px; + margin-right: 0.063em; +} + +.gform_wrapper.gf_browser_gecko .gfield_checkbox li input[type=checkbox], +.gform_wrapper.gf_browser_gecko .gfield_radio li input[type=radio], +.gform_wrapper.gf_browser_gecko .gfield_checkbox li input { + margin-top: 0.438em; } .gform_wrapper.gf_browser_gecko select { - padding: 5px 0 0 0; + padding: 0.188em 0 0.188em 0; } /* Opera specific rules ------------------------------------------------------*/ @@ -109,8 +163,8 @@ to no. } .gform_wrapper.gf_browser_opera .ginput_complex .ginput_right select { - padding: 5px 0 5px; - margin-bottom: 5px; + padding: 0.313em 0 0.313em 0; + margin-bottom: 0.313em; } .gform_wrapper.gf_browser_opera .gform_body ul.gform_fields li.gfield .ginput_container #recaptcha_widget_div #recaptcha_area { @@ -122,6 +176,21 @@ to no. margin-left: 32%; } +.gform_wrapper.gf_browser_opera.fixdrop_wrapper select { + height: 2.225em; + line-height: 2.125em; + background: inherit !important; + border-color: #A6A6A6; + border-style: solid; + border-collapse: collapse; + border-size: 1px; + margin-top: 1px; + margin-bottom: 1px; +} + +.gform_wrapper.gf_browser_opera select[multiple=multiple] { + height: auto !important; +} /* IE specific rules ------------------------------------------------------*/ @@ -133,15 +202,15 @@ to no. } .gform_wrapper.gf_browser_ie .gfield_time_hour { - width: 80px; + width: 5.00em; } .gform_wrapper.gf_browser_ie .gfield_time_minute { - width: 70px; + width: 4.375em; } .gform_wrapper.gf_browser_ie .gfield_time_ampm { - padding-top: 2px; + padding-top: 0.125em; } .gform_wrapper.gf_browser_ie .gfield_time_hour input, @@ -151,11 +220,11 @@ to no. .gform_wrapper.gf_browser_ie .ginput_complex .ginput_left label, .gform_wrapper.gf_browser_ie .ginput_complex .ginput_right label { - margin: 3px 0 5px 0; + margin: 0.188em 0 0.313em 0; } .gform_wrapper.gf_browser_ie .gform_footer input.button { - padding: 3px; + padding: 0.188em; } .gform_wrapper.gf_browser_ie ul.top_label .clear-multi { @@ -175,14 +244,17 @@ to no. .gform_wrapper.gf_browser_ie .ginput_complex .ginput_left select, .gform_wrapper.gf_browser_ie .ginput_complex .ginput_right select { - padding: 2px 0 2px 0; + padding: 0.125em 0 0.125em 0; +} + +.gform_wrapper.gf_browser_ie .gform_body ul.gform_fields li.gfield .ginput_container #recaptcha_widget_div #recaptcha_area { + width: 99%!important; } .gform_wrapper.gf_browser_ie .gform_body ul.gform_fields li.gfield .ginput_container #recaptcha_widget_div #recaptcha_area { width: 99%!important; } -.gform_wrapper.gf_browser_ie .gform_body ul.gform_fields li.gfield .ginput_container #recaptcha_widget_div #recaptcha_area {width: 99%!important} .gform_wrapper.gf_browser_ie .left_label #recaptcha_area #recaptcha_table, .gform_wrapper.gf_browser_ie .right_label #recaptcha_area #recaptcha_table { margin-left: 32%; @@ -194,6 +266,13 @@ to no. left: 4px; } +.gform_wrapper.gf_browser_ie img.add_list_item, +.gform_wrapper.gf_browser_ie img.delete_list_item { + width: 16px !important; + height: 16px !important; + background-size: 16px 16px !important; +} + /* iPhone specific rules ------------------------------------------------------*/ .gform_wrapper.gf_browser_iphone ul li:before, diff --git a/css/forms.css b/css/forms.css index 63b2b12..05ee1c9 100644 --- a/css/forms.css +++ b/css/forms.css @@ -3,4 +3,13 @@ @import url('formsmain.css'); @import url('readyclass.css'); @import url('browsers.css'); -@import url('rtl.css'); \ No newline at end of file +@import url('rtl.css'); + + +/* + +Note: October 2, 2014 3:51 PM +All CSS files are now enqueued directly for better minification support. +This file has been left in place temporarily for anyone who may have manually referenced this file in their theme. + +*/ \ No newline at end of file diff --git a/css/formsmain.css b/css/formsmain.css index 841111d..b330c17 100644 --- a/css/formsmain.css +++ b/css/formsmain.css @@ -2,12 +2,12 @@ ---------------------------------------------------------------- Gravity Forms Front End Form Styles -Version 1.8 +Version 1.9 http: //www.gravityforms.com -updated: January 31, 2014 3:35 PM +updated: January 28, 2015 1:28 PM Gravity Forms is a Rocketgenius project -copyright 2008-2014 Rocketgenius Inc. +copyright 2008-2015 Rocketgenius Inc. http: //www.rocketgenius.com this may not be redistributed without the express written permission of the author. @@ -27,8 +27,8 @@ to no. .gform_wrapper { overflow: inherit; - margin: 10px 0; - max-width: 98% + margin: 1em 0; + max-width: 98%; } .gform_wrapper h1, @@ -55,10 +55,11 @@ to no. .gform_wrapper input[type=number], .gform_wrapper input[type=password] { outline-style: none; - font-size: 11px; + font-size: inherit; font-family: inherit; - padding: 5px 2px 5px 2px; + padding: 0.313em 0 0.313em 0; letter-spacing: normal; + text-indent: 0.250em; } .gform_wrapper input[type=image] { @@ -69,10 +70,10 @@ to no. .gform_wrapper textarea { outline-style: none; - font-size: 11px; + font-size: inherit; font-family: inherit; letter-spacing: normal; - padding: 4px 2px 4px 2px; + padding: 0.250em 0.125em 0.250em 0.125em; resize: none; } @@ -131,14 +132,13 @@ html>body .entry ul, } .gform_wrapper select { - font-size: 11px; + font-size: inherit; font-family: inherit; - padding: 5px 0 5px 0; letter-spacing: normal; } .gform_wrapper select option { - padding: 2px 2px; + padding: 0.125em 0.125em; display: block; } @@ -148,7 +148,7 @@ html>body .entry ul, .gform_wrapper .gform_heading { width: 98%; - margin-bottom: 18px; + margin-bottom: 1.125em; } .gform_wrapper .gfield_time_hour, @@ -156,17 +156,26 @@ html>body .entry ul, .gform_wrapper .gfield_date_month, .gform_wrapper .gfield_date_day, .gform_wrapper .gfield_date_year { - width: 70px; + width: 4.688em; vertical-align: top; display: -moz-inline-stack; display: inline-block; zoom: 1; } +.gform_wrapper .gfield_time_hour i { + font-style: normal !important; + font-family: sans-serif !important; + width: 0.625em; + text-align: center; + float: right; + margin-top: 9%; +} + .gform_wrapper .gfield_date_month, .gform_wrapper .gfield_date_day, .gform_wrapper .gfield_date_year { - margin-right: 12px; + margin-right: 0.750em; } .gform_wrapper .gfield_date_dropdown_month, @@ -181,7 +190,7 @@ html>body .entry ul, .gform_wrapper .gfield_date_dropdown_month, .gform_wrapper .gfield_date_dropdown_day, .gform_wrapper .gfield_date_dropdown_year { - margin-right: 6px; + margin-right: 0.375em; } .gform_wrapper .gfield_time_ampm { @@ -192,7 +201,7 @@ html>body .entry ul, } .gform_wrapper .gfield_time_ampm select { - width: 60px !important; + width: 4.688em !important; } .gform_wrapper .gfield_time_hour input, @@ -206,7 +215,7 @@ html>body .entry ul, .gform_wrapper .gfield_date_month, .gform_wrapper .gfield_date_day, .gform_wrapper .gfield_date_year { - width: 50px; + width: 3.125em; float: left; } @@ -227,21 +236,16 @@ html>body .entry ul, } .gform_wrapper .field_name_first, +.gform_wrapper .field_name_middle, .gform_wrapper .field_name_last { - width: 50%; + width: 49.5%; float: left; } -.gform_wrapper .ginput_complex { +.gform_wrapper .ginput_complex.ginput_container { overflow: hidden; } -.gform_wrapper .ginput_left input:focus+label, -.gform_wrapper .ginput_right input:focus+label, -.gform_wrapper .ginput_full input:focus+label { - font-weight: bold; -} - .gform_wrapper .field_name_first input, .gform_wrapper .ginput_complex .ginput_left input { width: 95% !important; @@ -252,22 +256,23 @@ html>body .entry ul, } .gform_wrapper .datepicker { - width: 100px !important; + width: 6.750em !important; } .gform_wrapper .ginput_complex .ginput_left { - width: 50%; + width: 49.5%; float: left; } .gform_wrapper .ginput_complex .ginput_right { - width: 49%; + width: 49.5%; float: right; + margin-right: .5%; } .gform_wrapper .gfield_error .ginput_complex .ginput_left, .gform_wrapper .gfield_error .ginput_complex .ginput_right { - width: 50%; + width: 49.5%; } .gform_wrapper .gfield_error .ginput_complex .ginput_left input[type=text], @@ -311,58 +316,164 @@ html>body .entry ul, .gform_wrapper .ginput_complex label, .gform_wrapper .gfield_time_hour label, .gform_wrapper .gfield_time_minute label, +.gform_wrapper .gfield_time_ampm label, .gform_wrapper .gfield_date_month label, .gform_wrapper .gfield_date_day label, .gform_wrapper .gfield_date_year label, .gform_wrapper .instruction { display: block; - margin: 3px 0; - font-size: 11px; + font-size: 0.875em; letter-spacing: 0.5pt; } -.gform_wrapper .ginput_complex .name_prefix { - float: left; - width: 30px !important; - margin-right: 14px; +.gform_wrapper .ginput_complex label, +.gform_wrapper .gfield_time_hour label, +.gform_wrapper .gfield_time_minute label, +.gform_wrapper .gfield_time_ampm label, +.gform_wrapper .gfield_date_month label, +.gform_wrapper .gfield_date_day label, +.gform_wrapper .gfield_date_year label, +.gform_wrapper .instruction { + margin: 0.188em 0 0.750em 0; } -.gform_wrapper .ginput_complex .name_suffix { - float: left; - width: 30px !important; +.gform_wrapper .field_sublabel_above .ginput_complex label, +.gform_wrapper .field_sublabel_above .gfield_time_hour label, +.gform_wrapper .field_sublabel_above .gfield_time_minute label, +.gform_wrapper .field_sublabel_above .gfield_time_ampm label, +.gform_wrapper .field_sublabel_above .gfield_date_month label, +.gform_wrapper .field_sublabel_above .gfield_date_day label, +.gform_wrapper .field_sublabel_above .gfield_date_year label, +.gform_wrapper .field_sublabel_above .instruction { + margin: 0.750em 0 0.188em 0 ; } -.gform_wrapper .ginput_complex .name_first, -.gform_wrapper .ginput_complex .name_last { - float: left; - width: 100px; - margin-right: 8px; +.gform_wrapper .ginput_complex span.name_prefix, +.gform_wrapper .ginput_complex span.name_suffix { + display: block; + clear: right; + overflow: hidden; +} + +.gform_wrapper .ginput_complex span.name_prefix { + min-height: 2.20em +} + +.gform_wrapper .ginput_complex span.name_prefix select { + width: auto !important; +} + +.gform_wrapper .ginput_complex.has_middle span.name_suffix input[type=text] { + width: 32%; +} + +.gform_wrapper .ginput_complex span.name_first, +.gform_wrapper .ginput_complex span.name_middle, +.gform_wrapper .ginput_complex span.name_last { + vertical-align: bottom; + min-height: 2.813em; + display: -moz-inline-stack; + display: inline-block; + zoom: 1; +} + +.gform_wrapper .ginput_complex span.name_first, +.gform_wrapper .ginput_complex span.name_middle { + margin-right: 0.313em; +} + +.gform_wrapper .field_sublabel_above .ginput_complex .name_prefix, +.gform_wrapper .field_sublabel_above .ginput_complex span.name_suffix, +.gform_wrapper .field_sublabel_above .ginput_complex span.name_first, +.gform_wrapper .field_sublabel_above .ginput_complex span.name_middle, +.gform_wrapper .field_sublabel_above .ginput_complex span.name_last { + vertical-align: top; +} + +.gform_wrapper .ginput_complex.ginput_container.has_first_name span, +.gform_wrapper .ginput_complex.ginput_container.has_middle_name span, +.gform_wrapper .ginput_complex.ginput_container.has_last_name span { + width: 99.5% +} + +.gform_wrapper .ginput_complex.ginput_container.has_first_name.has_last_name span { + width: 49% +} + +.gform_wrapper .ginput_complex.ginput_container.has_first_name.has_middle_name.has_last_name span { + width: 32% } .gform_wrapper .top_label .gfield_label { - margin: 10px 0 4px 0; + margin: 0.625em 0 0.500em 0; font-weight: bold; display: -moz-inline-stack; display: inline-block; - line-height: 1.3em; + line-height: 1.30em; clear: both; } .gform_wrapper .left_label .gfield_label { float: left; - margin: 0 15px 0 0; + margin: 0.75em 15px 0 0; width: 29%; font-weight: bold; } +.gform_wrapper .left_label li.field_sublabel_below .gfield_label { + margin: 0 1em 0 0; +} + .gform_wrapper .right_label .gfield_label { float: left; - margin: 0 15px 0 0; + margin: 0.75em 1em 0 0; width: 29%; font-weight: bold; text-align: right; } +.gform_wrapper .right_label li.field_sublabel_below .gfield_label { + margin: 0 1em 0 0; +} + +.gform_wrapper .left_label li.hidden_label input, +.gform_wrapper .right_label li.hidden_label input { + margin-left: 30.7%; +} + +.gform_wrapper .left_label li.gfield .gfield_password_strength, +.gform_wrapper .right_label li.gfield .gfield_password_strength { + margin-left: 30.7%; +} + +body .gform_wrapper label.gfield_label + div.ginput_container { + margin-top: 0.375em; +} + +/* Field Label Placement Overrides ------------------------------------------------------*/ + +.gform_wrapper .hidden_label .gfield_label { + display: none !important; +} + +.gfield.right_label, +.gfield.left_label{ + padding-top:10px; +} + +.gform_wrapper li.hidden_label input { + margin-top: 0.75em; +} + +.gform_wrapper label.hidden_sub_label{ + display:none; +} + +.gform_wrapper .field_sublabel_hidden_label .ginput_complex.ginput_container input[type=text], +.gform_wrapper .field_sublabel_hidden_label .ginput_complex.ginput_container select { + margin-bottom: 0.750em; +} + .gform_wrapper .left_label ul.gfield_checkbox, .gform_wrapper .right_label ul.gfield_checkbox, .gform_wrapper .left_label ul.gfield_radio, @@ -387,7 +498,10 @@ html>body .entry ul, .gform_wrapper .top_label input.large, .gform_wrapper .top_label select.large, -.gform_wrapper .top_label textarea.textarea { +.gform_wrapper .top_label textarea.textarea, +.gform_wrapper .hidden_label input.large, +.gform_wrapper .hidden_label select.large, +.gform_wrapper .hidden_label textarea.textarea { width: 99.2%; } @@ -433,23 +547,17 @@ html>body .entry ul, .gform_wrapper h3.gform_title { letter-spacing: normal !important; - margin: 10px 0 6px 0; + margin: 0.625em 0 0.375em 0; } .gform_wrapper span.gform_description { font-weight: normal; } -.gform_wrapper h2.gsection_title, -.gform_wrapper .gsection_description, -.gform_wrapper h3.gform_title { - width: 98%; -} - .gform_wrapper .gsection { border-bottom: 1px dotted #CCC; - padding: 0 0 8px 0; - margin: 16px 0; + padding: 0 0 .5em 0; + margin: 1.8em 0; clear: both; } @@ -493,7 +601,7 @@ html>body .entry ul, .gform_wrapper .gfield_description, .gform_wrapper .gsection_description, .gform_wrapper .instruction { - font-size: 0.85em; + font-size: 0.875em; line-height: 1.5em; clear: both; font-family: sans-serif; @@ -503,21 +611,29 @@ html>body .entry ul, .gform_wrapper .description, .gform_wrapper .gfield_description, .gform_wrapper .gsection_description { - padding: 4px 0 8px 0; + padding: 0.5em 0; } .gform_wrapper .gfield_description { - padding: 10px 0 0 0; + padding: 0.625em 0 0 0; width: 99.8%; } +.gform_wrapper li.field_description_above .gfield_description { + margin-bottom: 0.75em; +} + .gform_wrapper .left_label .gfield_description, .gform_wrapper .right_label .gfield_description { width: 63%; } .gform_wrapper .description_above .gfield_description { - padding: 0 0 10px 0; + padding: 0 0 0.625em 0; +} + +.gform_wrapper .field_description_below .gfield_description { + padding: 0.625em 0 1em 0; } .gfield_date_year+.gfield_description { @@ -528,32 +644,32 @@ html>body .entry ul, .gform_wrapper .left_label .gfield_description, .gform_wrapper .left_label .instruction, .gform_wrapper .right_label .instruction { - margin-left: 31%; + margin-left: 30%; } .gform_wrapper .left_label .gsection .gsection_description, .gform_wrapper .right_label .gsection .gsection_description { margin-left: 0; - padding-top: 4px; + padding-top: 0.250em; padding-left: 0; line-height: 1.5em; } .gform_wrapper .gfield_required { color: #790000; - margin-left: 4px; + margin-left: 0.250em; } .gform_wrapper textarea.small { - height: 80px; + height: 5em; } .gform_wrapper textarea.medium { - height: 150px; + height: 9.375em; } .gform_wrapper textarea.large { - height: 250px; + height: 15.625em; } .gform_wrapper li.gfield.gfield_error, @@ -576,9 +692,6 @@ html>body .entry ul, font-family: "Lucida Grande", "Lucida Sans", "Lucida Sans Unicode", "DejaVu Sans", "Bitstream Vera Sans", "Liberation Sans", Verdana, "Verdana Ref", sans-serif; padding: 10px 20px 10px 45px; min-height: 25px; - background-image: url(../images/stopbanner.png); - background-repeat: no-repeat; - background-position: 0 0; background-color: #790000; border-bottom: 1px solid #620101; color: #FFF; @@ -626,32 +739,29 @@ li.gfield + li.gfield.gfield_creditcard_warning { .gform_wrapper li.gfield.gfield_error.gfield_contains_required label.gfield_label, .gform_wrapper li.gfield.gfield_error.gfield_contains_required div.ginput_container { - margin-top: 12px; -} - -.gform_wrapper div.validation_error { - color: #790000; - font-size: 1.2em; - font-weight: bold; - margin-bottom: 1.6em; + margin-top: 0.750em; } .gform_wrapper div.validation_error { color: #790000; - font-size: 1.2em; + font-size: 1.200em; font-weight: bold; + margin-bottom: 1.600em; + border-top: 2px solid #790000; + border-bottom: 2px solid #790000; + padding: 1em 0 1em 0; } div.gf_page_steps+div.validation_error { - margin-top: 16px; + margin-top: 1em; } .gform_wrapper div.gfield_description.validation_error { color: #790000; font-weight: bold; - font-size: 14px; - line-height: 1.2em; - margin-bottom: 16px; + font-size: 0.875em; + line-height: 1.200em; + margin-bottom: 1em; } .gform_wrapper .validation_message { @@ -677,14 +787,14 @@ div.gf_page_steps+div.validation_error { } .gform_wrapper .gform_footer { - padding: 16px 0 10px 0; - margin: 16px 0 0 0; + padding: 1em 0 0.625em 0; + margin: 1em 0 0 0; clear: both; } .gform_wrapper .gform_footer.right_label, .gform_wrapper .gform_footer.left_label { - padding: 16px 0 10px 31%; + padding: 1em 0 0.625em 30.5%; } .gform_wrapper .gform_footer input.button, @@ -692,6 +802,11 @@ div.gf_page_steps+div.validation_error { font-size: 1em; } +.gform_wrapper .gform_footer a.gform_save_link { + font-size: 1em; + margin-left: 1em; +} + .gform_wrapper .gform_footer input[type=image] { padding: 0; width: auto !important; @@ -702,7 +817,7 @@ div.gf_page_steps+div.validation_error { .gform_wrapper .ginput_complex .ginput_left, .gform_wrapper .ginput_complex .ginput_right, .gform_wrapper .ginput_complex .ginput_full { - min-height: 43px; + min-height: 2.813em; display: block; overflow: hidden; } @@ -718,8 +833,8 @@ div.gf_page_steps+div.validation_error { .gform_wrapper .gfield_checkbox li, .gform_wrapper .gfield_radio li { - margin: 0 0 8px 0; - line-height: 1.3em; + margin: 0 0 0.500em 0; + line-height: 1.300em; } .gform_wrapper ul.gfield_radio li input[type="radio"]:checked+label, @@ -728,7 +843,7 @@ div.gf_page_steps+div.validation_error { } .gform_wrapper input.datepicker.datepicker_with_icon { - margin-right: 4px !important; + margin-right: 0.250em !important; display: -moz-inline-stack; display: inline-block; zoom: 1; @@ -761,35 +876,40 @@ div.gf_page_steps+div.validation_error { } .gform_wrapper ul.gfield_radio li input+input { - margin-left: 4px; + margin-left: 0.250em; } .gform_wrapper ul.gfield_radio li input[value=gf_other_choice] { - margin-right: 6px; - margin-top: 4px; + margin-right: 0.375em; + margin-top: 0.250em; } .gform_wrapper .top_label .gfield_description, { - padding: 10px 0 0 0; + padding: 0.625em 0 0 0; } .gform_wrapper .top_label .gfield_description.validation_message, .gform_wrapper .gfield_description.validation_message { - padding: 10px 0 !important; + padding: 0.625em 0 !important; } .gform_wrapper .ginput_container + .gfield_description.validation_message { - margin-top: 6px; + margin-top: 0.375em; } .gform_wrapper .gfield_description + .gform_wrapper .gfield_description.validation_message { - margin-top: 6px; + margin-top: 0.375em; } .gform_wrapper .ginput_container.ginput_list + .gfield_description.validation_message { margin-top: 0; } +.gform_wrapper .left_label .ginput_container.ginput_list, +.gform_wrapper .right_label .ginput_container.ginput_list { + padding-top: 0.750em !important; +} + /* HTML field default margins -----------------------------------------------------*/ @@ -799,14 +919,20 @@ div.gf_page_steps+div.validation_error { } .gform_wrapper .gfield_html.gfield_no_follows_desc { - margin-top: 10px; + margin-top: 0.625em; +} + +/* HTML field max image width -----------------------------------------------------*/ + +body .gform_wrapper ul li.gfield.gfield_html img { + max-width: 98% !important; } /* ajax forms ------------------------------------------------------*/ .gform_wrapper .gform_ajax_spinner { - padding-left: 10px; + padding-left: 0.625em; } /* hide the honeypot field ------------------------------------------------------*/ @@ -826,19 +952,19 @@ body .gform_wrapper ul.gform_fields li.gfield.gform_validation_container { .gform_wrapper .gfield_captcha_input_container { - padding-top: 3px; + padding-top: 0.188em; } .gform_wrapper .simple_captcha_small input { - width: 100px; + width: 6.250em; } .gform_wrapper .simple_captcha_medium input { - width: 150px; + width: 9.375em; } .gform_wrapper .simple_captcha_large input { - width: 200px; + width: 12.500em; } .gform_wrapper .gform_wrapper .left_label .simple_captcha_small, @@ -862,15 +988,15 @@ body .gform_wrapper ul.gform_fields li.gfield.gform_validation_container { .gform_wrapper .math_small input { - width: 69px; + width: 4.313em; } .gform_wrapper .math_medium input { - width: 90px; + width: 5.625em; } .gform_wrapper .math_large input { - width: 108px; + width: 6.750em; } .gform_wrapper .left_label .math_small, @@ -886,8 +1012,8 @@ body .gform_wrapper ul.gform_fields li.gfield.gform_validation_container { .gform_wrapper div.charleft { - font-size: 11px; - margin-top: 4px; + font-size: 0.688em; + margin-top: 0.250em; color: #B7B7B7; width: 92% !important; white-space: nowrap !important; @@ -933,11 +1059,11 @@ body .gform_wrapper ul.gform_fields li.gfield.gform_validation_container { } .gform_wrapper .top_label span.ginput_total { - margin: 8px 0; + margin: 0.5em 0; } .gform_wrapper span.ginput_product_price_label { - margin-right: 2px; + margin-right: 0.125em; } .gform_wrapper span.ginput_product_price { @@ -945,25 +1071,27 @@ body .gform_wrapper ul.gform_fields li.gfield.gform_validation_container { } .gform_wrapper span.ginput_quantity_label { - margin-left: 10px; - margin-right: 2px; + margin-left: 0.625em; + margin-right: .125em; } .gform_wrapper input.ginput_quantity { - width: 40px; + width: 2.500em; } /* multi-page form paging ------------------------------------------------------*/ .gform_wrapper .gform_page_footer { - margin: 20px 0; + margin: 1.250em 0; width: 99%; border-top: 1px dotted #CCC; - padding: 16px 0 0 0; + padding: 1em 0 0 0; + clear: both; } +.gform_wrapper .gform_page_footer .button.gform_next_button, .gform_wrapper .gform_page_footer .button.gform_button { - margin-right: 10px; + margin-right: 0.625em; } /* multi-page progress bar ------------------------------------------------------*/ @@ -972,15 +1100,15 @@ body .gform_wrapper ul.gform_fields li.gfield.gform_validation_container { .gform_wrapper .gf_progressbar_wrapper { clear: both; width: 99%; - margin: 0 0 8px 0; - padding: 0 0 16px 0; + margin: 0 0 0.5em 0; + padding: 0 0 1em 0; border-bottom: 1px dotted #CCC; } .gform_wrapper .gf_progressbar_wrapper h3.gf_progressbar_title { - font-size: 13px; + font-size: 0.813em; line-height: 1em !important; - margin: 0 0 6px 0 !important; + margin: 0 0 0.375em 0 !important; padding: 0 !important; clear: both; filter: alpha(opacity=60); @@ -1073,17 +1201,17 @@ body .gform_wrapper ul.gform_fields li.gfield.gform_validation_container { .gform_wrapper .gf_page_steps { width: 99%; - margin: 0 0 8px 0; - padding: 0 0 4px 0; + margin: 0 0 0.50em 0; + padding: 0 0 0.250em 0; border-bottom: 1px dotted #CCC; } .gform_wrapper .gf_step { width: auto !important; - margin: 0 10px 10px 0; - font-size: 14px; - height: 20px; - line-height: 20px !important; + margin: 0 1em 0.625em 0; + font-size: 1em; + height: 1.250em; + line-height: 1.250em !important; filter: alpha(opacity=20); -moz-opacity: 0.2; -khtml-opacity: 0.2; @@ -1095,7 +1223,7 @@ body .gform_wrapper ul.gform_fields li.gfield.gform_validation_container { } .gform_wrapper .gf_step span.gf_step_number { - font-size: 20px; + font-size: 1.250em; float: left; font-family: arial,sans-serif; } @@ -1116,16 +1244,27 @@ body .gform_wrapper ul.gform_fields li.gfield.gform_validation_container { /* password strength indicator -----------------------------------------------------------------*/ - .gform_wrapper .gfield_password_strength { border: 1px solid #DDD; - margin: 0; - padding: 3px 5px; + margin-top: 1.150em; + margin-bottom: 1.150em; + line-height: 1.8; + padding: 0.313em 0.313em; text-align: center; - width: 200px; background-color: #EEE; } +.gform_wrapper ul.top_label li.gfield .gfield_password_strength { + width: 97%; +} + +.gform_wrapper ul.left_label li.gfield .gfield_password_strength, +.gform_wrapper ul.right_label li.gfield .gfield_password_strength { + margin-top: 1.150em; + margin-bottom: 1.150em; + width: 60%; +} + .gform_wrapper .gfield_password_strength.bad { background-color: #FFB78C; border-color: #FF853C; @@ -1253,7 +1392,7 @@ body .gform_wrapper div.gform_body ul.gform_fields li.gfield.gfield_html dl dd { .gform_wrapper table.gfield_list th + th, .gform_wrapper table.gfield_list td + td { - padding:0 0 0.5em 0.7em; + padding:0 0 0 0.7em; } .gform_wrapper .left_label .gfield_list, .gform_wrapper .right_label .gfield_list { @@ -1285,403 +1424,432 @@ body .gform_wrapper div.gform_body ul.gform_fields li.gfield.gfield_html dl dd { } .gform_wrapper table.gfield_list td.gfield_list_icons { - min-width: 45px !important; + width: 5%; + min-width: 3.750em !important; } -/* enhanced UI/select styles updated in v.1.8.12 -----------------------------------------------------------------*/ +.gform_wrapper table.gfield_list td.gfield_list_cell { + width: auto !important; +} +/* enhanced UI/select styles updated in v.1.9 -----------------------------------------------------------------*/ + + +.gform_wrapper select.chosen-select { + visibility: hidden; + height: 28px !important; + min-height: 28px !important; +} .gform_wrapper .chosen-container { - position: relative; - display: inline-block; - vertical-align: middle; - font-size: 13px; - zoom: 1; - *display: inline; - -webkit-user-select: none; - -moz-user-select: none; - user-select: none; + position: relative; + display: inline-block; + vertical-align: middle; + font-size: 13px; + zoom: 1; + *display: inline; + -webkit-user-select: none; + -moz-user-select: none; + user-select: none; } .gform_wrapper .chosen-container .chosen-drop { - position: absolute; - top: 100%; - left: -9999px; - z-index: 1010; - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; - width: 100%; - border: 1px solid #aaa; - border-top: 0; - background: #fff; - box-shadow: 0 4px 5px rgba(0, 0, 0, .15); + position: absolute; + top: 100%; + left: -9999px; + z-index: 1010; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + width: 100%; + border: 1px solid #aaa; + border-top: 0; + background: #fff; + box-shadow: 0 4px 5px rgba(0, 0, 0, 0.15); } .gform_wrapper .chosen-container.chosen-with-drop .chosen-drop { - left: 0; + left: 0; } .gform_wrapper .chosen-container a { - cursor: pointer; + cursor: pointer; } + .gform_wrapper .chosen-container-single .chosen-single { - position: relative; - display: block; - overflow: hidden; - padding: 0 0 0 8px; - height: 23px; - border: 1px solid #aaa; - border-radius: 5px; - background-color: #fff; - background: -webkit-gradient(linear, 50% 0, 50% 100%, color-stop(20%, #fff), color-stop(50%, #f6f6f6), color-stop(52%, #eee), color-stop(100%, #f4f4f4)); - background: -webkit-linear-gradient(top, #fff 20%, #f6f6f6 50%, #eee 52%, #f4f4f4 100%); - background: -moz-linear-gradient(top, #fff 20%, #f6f6f6 50%, #eee 52%, #f4f4f4 100%); - background: -o-linear-gradient(top, #fff 20%, #f6f6f6 50%, #eee 52%, #f4f4f4 100%); - background: linear-gradient(top, #fff 20%, #f6f6f6 50%, #eee 52%, #f4f4f4 100%); - background-clip: padding-box; - box-shadow: 0 0 3px #fff inset, 0 1px 1px rgba(0, 0, 0, .1); - color: #444; - text-decoration: none; - white-space: nowrap; - line-height: 24px; + position: relative; + display: block; + overflow: hidden; + padding: 0 0 0 8px; + height: 23px; + border: 1px solid #aaa; + border-radius: 5px; + background-color: #fff; + background: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #ffffff), color-stop(50%, #f6f6f6), color-stop(52%, #eeeeee), color-stop(100%, #f4f4f4)); + background: -webkit-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%); + background: -moz-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%); + background: -o-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%); + background: linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%); + background-clip: padding-box; + box-shadow: 0 0 3px white inset, 0 1px 1px rgba(0, 0, 0, 0.1); + color: #444; + text-decoration: none; + white-space: nowrap; + line-height: 24px; } .gform_wrapper .chosen-container-single .chosen-default { - color: #999; + color: #999; } .gform_wrapper .chosen-container-single .chosen-single span { - display: block; - overflow: hidden; - margin-right: 26px; - text-overflow: ellipsis; - white-space: nowrap; + display: block; + overflow: hidden; + margin-right: 26px; + text-overflow: ellipsis; + white-space: nowrap; } .gform_wrapper .chosen-container-single .chosen-single-with-deselect span { - margin-right: 38px; + margin-right: 38px; } .gform_wrapper .chosen-container-single .chosen-single abbr { - position: absolute; - top: 6px; - right: 26px; - display: block; - width: 12px; - height: 12px; - background: url(../images/chosen-sprite.png) -42px 1px no-repeat; - font-size: 1px; + position: absolute; + top: 6px; + right: 26px; + display: block; + width: 12px; + height: 12px; + background: url('../images/chosen-sprite.png') -42px 1px no-repeat; + font-size: 1px; } .gform_wrapper .chosen-container-single .chosen-single abbr:hover { - background-position: -42px -10px; + background-position: -42px -10px; } .gform_wrapper .chosen-container-single.chosen-disabled .chosen-single abbr:hover { - background-position: -42px -10px; + background-position: -42px -10px; } .gform_wrapper .chosen-container-single .chosen-single div { - position: absolute; - top: 0; - right: 0; - display: block; - width: 18px; - height: 100%} + position: absolute; + top: 0; + right: 0; + display: block; + width: 18px; + height: 100%; +} .gform_wrapper .chosen-container-single .chosen-single div b { - display: block; - width: 100%; - height: 100%; - background: url(../images/chosen-sprite.png) no-repeat 0 2px; + display: block; + width: 100%; + height: 100%; + background: url('../images/chosen-sprite.png') no-repeat 0px 2px; } .gform_wrapper .chosen-container-single .chosen-search { - position: relative; - z-index: 1010; - margin: 0; - padding: 3px 4px; - white-space: nowrap; -} -.gform_wrapper .chosen-container-single .chosen-search input[type=text] { - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; - margin: 1px 0; - padding: 4px 20px 4px 5px; - width: 100%; - height: auto; - outline: 0; - border: 1px solid #aaa; - background: #fff url(../images/chosen-sprite.png) no-repeat 100% -20px; - background: url(../images/chosen-sprite.png) no-repeat 100% -20px; - font-size: 1em; - font-family: sans-serif; - line-height: normal; - border-radius: 0; + position: relative; + z-index: 1010; + margin: 0; + padding: 3px 4px; + white-space: nowrap; +} +.gform_wrapper .chosen-container-single .chosen-search input[type="text"] { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + margin: 1px 0; + padding: 4px 20px 4px 5px; + width: 100%; + height: auto; + outline: 0; + border: 1px solid #aaa; + background: white url('../images/chosen-sprite.png') no-repeat 100% -20px; + background: url('../images/chosen-sprite.png') no-repeat 100% -20px; + font-size: 1em; + font-family: sans-serif; + line-height: normal; + border-radius: 0; } .gform_wrapper .chosen-container-single .chosen-drop { - margin-top: -1px; - border-radius: 0 0 4px 4px; - background-clip: padding-box; + margin-top: -1px; + border-radius: 0 0 4px 4px; + background-clip: padding-box; } .gform_wrapper .chosen-container-single.chosen-container-single-nosearch .chosen-search { - position: absolute; - left: -9999px; + position: absolute; + left: -9999px; } + .gform_wrapper .chosen-container .chosen-results { - position: relative; - overflow-x: hidden; - overflow-y: auto; - margin: 0 4px 4px 0; - padding: 0 0 0 4px; - max-height: 240px; - -webkit-overflow-scrolling: touch; + position: relative; + overflow-x: hidden; + overflow-y: auto; + margin: 0 4px 4px 0; + padding: 0 0 0 4px; + max-height: 240px; + -webkit-overflow-scrolling: touch; } .gform_wrapper .chosen-container .chosen-results li { - display: none; - margin: 0; - padding: 5px 6px; - list-style: none; - line-height: 15px; - -webkit-touch-callout: none; + display: none; + margin: 0; + padding: 5px 6px; + list-style: none; + line-height: 15px; + -webkit-touch-callout: none; } .gform_wrapper .chosen-container .chosen-results li.active-result { - display: list-item; - cursor: pointer; + display: list-item; + cursor: pointer; } .gform_wrapper .chosen-container .chosen-results li.disabled-result { - display: list-item; - color: #ccc; - cursor: default; + display: list-item; + color: #ccc; + cursor: default; } + .gform_wrapper .chosen-container .chosen-results li.highlighted { - background-color: #3875d7; - background-image: -webkit-gradient(linear, 50% 0, 50% 100%, color-stop(20%, #3875d7), color-stop(90%, #2a62bc)); - background-image: -webkit-linear-gradient(#3875d7 20%, #2a62bc 90%); - background-image: -moz-linear-gradient(#3875d7 20%, #2a62bc 90%); - background-image: -o-linear-gradient(#3875d7 20%, #2a62bc 90%); - background-image: linear-gradient(#3875d7 20%, #2a62bc 90%); - color: #fff; + background-color: #3875d7; + background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #3875d7), color-stop(90%, #2a62bc)); + background-image: -webkit-linear-gradient(#3875d7 20%, #2a62bc 90%); + background-image: -moz-linear-gradient(#3875d7 20%, #2a62bc 90%); + background-image: -o-linear-gradient(#3875d7 20%, #2a62bc 90%); + background-image: linear-gradient(#3875d7 20%, #2a62bc 90%); + color: #fff; } + .gform_wrapper .chosen-container .chosen-results li.no-results { - display: list-item; - background: #f4f4f4; + display: list-item; + background: #f4f4f4; } + .gform_wrapper .chosen-container .chosen-results li.group-result { - display: list-item; - font-weight: 700; - cursor: default; + display: list-item; + font-weight: bold; + cursor: default; } + .gform_wrapper .chosen-container .chosen-results li.group-option { - padding-left: 15px; + padding-left: 15px; } .gform_wrapper .chosen-container .chosen-results li em { - font-style: normal; - text-decoration: underline; + font-style: normal; + text-decoration: underline; } .gform_wrapper .chosen-container-multi .chosen-choices { - position: relative; - overflow: hidden; - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; - margin: 0; - padding: 0; - width: 100%; - height: auto!important; - height: 1%; - border: 1px solid #aaa; - background-color: #fff; - background-image: -webkit-gradient(linear, 50% 0, 50% 100%, color-stop(1%, #eee), color-stop(15%, #fff)); - background-image: -webkit-linear-gradient(#eee 1%, #fff 15%); - background-image: -moz-linear-gradient(#eee 1%, #fff 15%); - background-image: -o-linear-gradient(#eee 1%, #fff 15%); - background-image: linear-gradient(#eee 1%, #fff 15%); - cursor: text; + position: relative; + overflow: hidden; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + margin: 0; + padding: 0; + width: 100%; + height: auto !important; + height: 1%; + border: 1px solid #aaa; + background-color: #fff; + background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(1%, #eeeeee), color-stop(15%, #ffffff)); + background-image: -webkit-linear-gradient(#eeeeee 1%, #ffffff 15%); + background-image: -moz-linear-gradient(#eeeeee 1%, #ffffff 15%); + background-image: -o-linear-gradient(#eeeeee 1%, #ffffff 15%); + background-image: linear-gradient(#eeeeee 1%, #ffffff 15%); + cursor: text; } .gform_wrapper .chosen-container-multi .chosen-choices li { - float: left; - list-style: none; + float: left; + list-style: none; } .gform_wrapper .chosen-container-multi .chosen-choices li.search-field { - margin: 0; - padding: 0; - white-space: nowrap; -} -.gform_wrapper .chosen-container-multi .chosen-choices li.search-field input[type=text] { - margin: 1px 0; - padding: 5px; - height: 15px; - outline: 0; - border: 0!important; - background: transparent!important; - box-shadow: none; - color: #666; - font-size: 100%; - font-family: sans-serif; - line-height: normal; - border-radius: 0; + margin: 0; + padding: 0; + white-space: nowrap; +} +.gform_wrapper .chosen-container-multi .chosen-choices li.search-field input[type="text"] { + margin: 1px 0; + padding: 5px; + height: 15px; + outline: 0; + border: 0 !important; + background: transparent !important; + box-shadow: none; + color: #666; + font-size: 100%; + font-family: sans-serif; + line-height: normal; + border-radius: 0; } .gform_wrapper .chosen-container-multi .chosen-choices li.search-field .default { - color: #999; + color: #999; } .gform_wrapper .chosen-container-multi .chosen-choices li.search-choice { - position: relative; - margin: 3px 0 3px 5px !important; - padding: 3px 20px 3px 5px; - border: 1px solid #aaa; - border-radius: 3px; - background-color: #e4e4e4; - background-image: -webkit-gradient(linear, 50% 0, 50% 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eee)); - background-image: -webkit-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eee 100%); - background-image: -moz-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eee 100%); - background-image: -o-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eee 100%); - background-image: linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eee 100%); - background-clip: padding-box; - box-shadow: 0 0 2px #fff inset, 0 1px 0 rgba(0, 0, 0, .05); - color: #333; - line-height: 13px; - cursor: default; + position: relative; + margin: 3px 0 3px 5px; + padding: 3px 20px 3px 5px; + border: 1px solid #aaa; + border-radius: 3px; + background-color: #e4e4e4; + background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eeeeee)); + background-image: -webkit-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%); + background-image: -moz-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%); + background-image: -o-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%); + background-image: linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%); + background-clip: padding-box; + box-shadow: 0 0 2px white inset, 0 1px 0 rgba(0, 0, 0, 0.05); + color: #333; + line-height: 13px; + cursor: default; } .gform_wrapper .chosen-container-multi .chosen-choices li.search-choice .search-choice-close { - position: absolute; - top: 4px; - right: 3px; - display: block; - width: 12px; - height: 12px; - background: url(../images/chosen-sprite.png) -42px 1px no-repeat; - font-size: 1px; + position: absolute; + top: 4px; + right: 3px; + display: block; + width: 12px; + height: 12px; + background: url('../images/chosen-sprite.png') -42px 1px no-repeat; + font-size: 1px; } .gform_wrapper .chosen-container-multi .chosen-choices li.search-choice .search-choice-close:hover { - background-position: -42px -10px; + background-position: -42px -10px; } .gform_wrapper .chosen-container-multi .chosen-choices li.search-choice-disabled { - padding-right: 5px; - border: 1px solid #ccc; - background-color: #e4e4e4; - background-image: -webkit-gradient(linear, 50% 0, 50% 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eee)); - background-image: -webkit-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eee 100%); - background-image: -moz-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eee 100%); - background-image: -o-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eee 100%); - background-image: linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eee 100%); - color: #666; + padding-right: 5px; + border: 1px solid #ccc; + background-color: #e4e4e4; + background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eeeeee)); + background-image: -webkit-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%); + background-image: -moz-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%); + background-image: -o-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%); + background-image: linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%); + color: #666; } .gform_wrapper .chosen-container-multi .chosen-choices li.search-choice-focus { - background: #d4d4d4; + background: #d4d4d4; } .gform_wrapper .chosen-container-multi .chosen-choices li.search-choice-focus .search-choice-close { - background-position: -42px -10px; + background-position: -42px -10px; } .gform_wrapper .chosen-container-multi .chosen-results { - margin: 0; - padding: 0; + margin: 0; + padding: 0; } .gform_wrapper .chosen-container-multi .chosen-drop .result-selected { - display: list-item; - color: #ccc; - cursor: default; + display: list-item; + color: #ccc; + cursor: default; } + .gform_wrapper .chosen-container-active .chosen-single { - border: 1px solid #5897fb; - box-shadow: 0 0 5px rgba(0, 0, 0, .3); + border: 1px solid #5897fb; + box-shadow: 0 0 5px rgba(0, 0, 0, 0.3); } .gform_wrapper .chosen-container-active.chosen-with-drop .chosen-single { - border: 1px solid #aaa; - -moz-border-radius-bottomright: 0; - border-bottom-right-radius: 0; - -moz-border-radius-bottomleft: 0; - border-bottom-left-radius: 0; - background-image: -webkit-gradient(linear, 50% 0, 50% 100%, color-stop(20%, #eee), color-stop(80%, #fff)); - background-image: -webkit-linear-gradient(#eee 20%, #fff 80%); - background-image: -moz-linear-gradient(#eee 20%, #fff 80%); - background-image: -o-linear-gradient(#eee 20%, #fff 80%); - background-image: linear-gradient(#eee 20%, #fff 80%); - box-shadow: 0 1px 0 #fff inset; + border: 1px solid #aaa; + -moz-border-radius-bottomright: 0; + border-bottom-right-radius: 0; + -moz-border-radius-bottomleft: 0; + border-bottom-left-radius: 0; + background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #eeeeee), color-stop(80%, #ffffff)); + background-image: -webkit-linear-gradient(#eeeeee 20%, #ffffff 80%); + background-image: -moz-linear-gradient(#eeeeee 20%, #ffffff 80%); + background-image: -o-linear-gradient(#eeeeee 20%, #ffffff 80%); + background-image: linear-gradient(#eeeeee 20%, #ffffff 80%); + box-shadow: 0 1px 0 #fff inset; } .gform_wrapper .chosen-container-active.chosen-with-drop .chosen-single div { - border-left: 0; - background: transparent; + border-left: none; + background: transparent; } .gform_wrapper .chosen-container-active.chosen-with-drop .chosen-single div b { - background-position: -18px 2px; + background-position: -18px 2px; } .gform_wrapper .chosen-container-active .chosen-choices { - border: 1px solid #5897fb; - box-shadow: 0 0 5px rgba(0, 0, 0, .3); + border: 1px solid #5897fb; + box-shadow: 0 0 5px rgba(0, 0, 0, 0.3); } -.gform_wrapper .chosen-container-active .chosen-choices li.search-field input[type=text] { - color: #111!important; +.gform_wrapper .chosen-container-active .chosen-choices li.search-field input[type="text"] { + color: #111 !important; } + .gform_wrapper .chosen-disabled { - opacity: .5!important; - cursor: default; + opacity: 0.5 !important; + cursor: default; } .gform_wrapper .chosen-disabled .chosen-single { - cursor: default; + cursor: default; } .gform_wrapper .chosen-disabled .chosen-choices .search-choice .search-choice-close { - cursor: default; + cursor: default; } + .gform_wrapper .chosen-rtl { - text-align: right; + text-align: right; } .gform_wrapper .chosen-rtl .chosen-single { - overflow: visible; - padding: 0 8px 0 0; + overflow: visible; + padding: 0 8px 0 0; } .gform_wrapper .chosen-rtl .chosen-single span { - margin-right: 0; - margin-left: 26px; - direction: rtl; + margin-right: 0; + margin-left: 26px; + direction: rtl; } .gform_wrapper .chosen-rtl .chosen-single-with-deselect span { - margin-left: 38px; + margin-left: 38px; } .gform_wrapper .chosen-rtl .chosen-single div { - right: auto; - left: 3px; + right: auto; + left: 3px; } .gform_wrapper .chosen-rtl .chosen-single abbr { - right: auto; - left: 26px; + right: auto; + left: 26px; } .gform_wrapper .chosen-rtl .chosen-choices li { - float: right; + float: right; } -.gform_wrapper .chosen-rtl .chosen-choices li.search-field input[type=text] { - direction: rtl; +.gform_wrapper .chosen-rtl .chosen-choices li.search-field input[type="text"] { + direction: rtl; } .gform_wrapper .chosen-rtl .chosen-choices li.search-choice { - margin: 3px 5px 3px 0; - padding: 3px 5px 3px 19px; + margin: 3px 5px 3px 0; + padding: 3px 5px 3px 19px; } .gform_wrapper .chosen-rtl .chosen-choices li.search-choice .search-choice-close { - right: auto; - left: 4px; + right: auto; + left: 4px; } -.gform_wrapper .chosen-rtl.chosen-container-single-nosearch .chosen-search.gform_wrapper .chosen-rtl .chosen-drop { - left: 9999px; +.gform_wrapper .chosen-rtl.chosen-container-single-nosearch .chosen-search, +.gform_wrapper .chosen-rtl .chosen-drop { + left: 9999px; } .gform_wrapper .chosen-rtl.chosen-container-single .chosen-results { - margin: 0 0 4px 4px; - padding: 0 4px 0 0; + margin: 0 0 4px 4px; + padding: 0 4px 0 0; } .gform_wrapper .chosen-rtl .chosen-results li.group-option { - padding-right: 15px; - padding-left: 0; + padding-right: 15px; + padding-left: 0; } .gform_wrapper .chosen-rtl.chosen-container-active.chosen-with-drop .chosen-single div { - border-right: 0; + border-right: none; } -.gform_wrapper .chosen-rtl .chosen-search input[type=text] { - padding: 4px 5px 4px 20px; - background: #fff url(../images/chosen-sprite.png) no-repeat -30px -20px; - background: url(../images/chosen-sprite.png) no-repeat -30px -20px; - direction: rtl; +.gform_wrapper .chosen-rtl .chosen-search input[type="text"] { + padding: 4px 5px 4px 20px; + background: white url('../images/chosen-sprite.png') no-repeat -30px -20px; + background: url('../images/chosen-sprite.png') no-repeat -30px -20px; + direction: rtl; } .gform_wrapper .chosen-rtl.chosen-container-single .chosen-single div b { - background-position: 6px 2px; + background-position: 6px 2px; } .gform_wrapper .chosen-rtl.chosen-container-single.chosen-with-drop .chosen-single div b { - background-position: -12px 2px; + background-position: -12px 2px; } -@media only screen and (-webkit-min-device-pixel-ratio:2), only screen and (min-resolution:144dpi) { - .gform_wrapper .chosen-rtl .chosen-search input[type=text].gform_wrapper .chosen-container-single .chosen-single abbr.gform_wrapper .chosen-container-single .chosen-single div b.gform_wrapper .chosen-container-single .chosen-search input[type=text].gform_wrapper .chosen-container-multi .chosen-choices .search-choice .search-choice-close.gform_wrapper .chosen-container .chosen-results-scroll-down span.gform_wrapper .chosen-container .chosen-results-scroll-up span { - background-image: url(../images/chosen-sprite@2x.png)!important; - background-size: 52px 37px!important; - background-repeat: no-repeat!important; - } + +@media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min-resolution: 144dpi) { + .gform_wrapper .chosen-rtl .chosen-search input[type="text"], + .gform_wrapper .chosen-container-single .chosen-single abbr, + .gform_wrapper .chosen-container-single .chosen-single div b, + .gform_wrapper .chosen-container-single .chosen-search input[type="text"], + .gform_wrapper .chosen-container-multi .chosen-choices .search-choice .search-choice-close, + .gform_wrapper .chosen-container .chosen-results-scroll-down span, + .gform_wrapper .chosen-container .chosen-results-scroll-up span { + background-image: url('../images/chosen-sprite@2x.png') !important; + background-size: 52px 37px !important; + background-repeat: no-repeat !important; + } } /* credit card icons ------------------------------------------------------*/ @@ -1889,7 +2057,7 @@ body .gform_wrapper div.gform_body ul.gform_fields li.gfield.gfield_html dl dd { .gform_wrapper .ginput_complex select.ginput_card_expiration.ginput_card_expiration_month, .gform_wrapper .ginput_complex select.ginput_card_expiration.ginput_card_expiration_year { - width: 48% !important; + width: 47% !important; display: -moz-inline-stack; display: inline-block; zoom: 1; @@ -1927,7 +2095,7 @@ body .gform_wrapper div.gform_body ul.gform_fields li.gfield.gfield_html dl dd { .right_label .gform_fileupload_multifile, .left_label .gform_fileupload_multifile{ - margin-left: 31%; + margin-left: 30.5%; } .gform_delete{ @@ -1935,9 +2103,362 @@ body .gform_wrapper div.gform_body ul.gform_fields li.gfield.gfield_html dl dd { cursor:pointer; } +.gform_wrapper .copy_values_option_container .copy_values_enabled{ + width:auto; +} + +.gform_wrapper li.field_sublabel_above .ginput_complex input[type=text] { + margin-bottom: 1px; +} + +/* simple confirmation message styling ------------------------------------------------------*/ + +.gform_confirmation_message { + margin: 1em 0 1em 0; + padding: 1em; + font-size: 1em; + border: 2px solid #CFE2C0; + background-color: #E9FFD9; + text-align: center; + -webkit-border-radius: 2px; + -moz-border-radius: 2px; + border-radius: 2px; +} + +/* saved message confirmation ------------------------------------------------------*/ + +.form_saved_message { + fmargin: 1em 0 1em 0; + padding: 2.5em 1em 2.5em 1em; + font-size: 1em; + line-height: 1.8; + border: 2px solid #91AFC7; + background-color: #E3F3F3; + text-align: center; + -webkit-border-radius: 2px; + -moz-border-radius: 2px; + border-radius: 2px; +} + +.form_saved_message a { + word-wrap: break-word; +} + +.form_saved_message br + br { + display: none; +} + +.form_saved_message .form_saved_message_emailform { + margin: 1em 0 0 0; +} + +div.form_saved_message div.form_saved_message_emailform form input[type=text] { + line-height: 2.25em; + height: 2.25em; + margin-bottom: 0.250em; +} + +div.form_saved_message div.form_saved_message_emailform form input[type=submit] { + line-height: 2.25em; + min-height: 2.25em; +} + +.form_saved_message .form_saved_message_emailform .validation_message { + color:red; +} + +.form_saved_message_sent { + margin: 1em 0 1em 0; + padding: 1em; + font-size: 1em; + border: 2px solid #CFE2C0; + background-color: #E9FFD9; + text-align: center; + -webkit-border-radius: 2px; + -moz-border-radius: 2px; + border-radius: 2px; +} + /* fix recaptcha line height issue ------------------------------------------------------*/ body #content .entry-content .gform_wrapper form .gform_body .gform_fields .gfield .ginput_container #recaptcha_widget_div #recaptcha_area .recaptchatable tbody tr td .recaptcha_input_area, body .gform_wrapper form .gform_body .gform_fields .gfield .ginput_container #recaptcha_widget_div #recaptcha_area .recaptchatable tbody tr td .recaptcha_input_area { line-height: 1em !important; +} + +/* define datepicker image size to override generic theme image styles ------------------------------------------------------*/ + +body .gform_wrapper img.ui-datepicker-trigger { + width: 17px !important; + height: 16px !important; + display: -moz-inline-stack; + display: inline-block; + zoom: 1; +} + +body .gform_wrapper img.add_list_item, +body .gform_wrapper img.delete_list_item { + display: -moz-inline-stack; display: inline-block; zoom: 1; +} + + +/* Responsive Layout Changes -------------------------------------------------------*/ + +@media screen and (max-width: 570px) and (min-width: 480px) { + + body .gform_wrapper .ginput_complex.ginput_container.has_first_name span, + body .gform_wrapper .ginput_complex.ginput_container.has_middle_name span, + body .gform_wrapper .ginput_complex.ginput_container.has_last_name span { + width: 95% + } + + body .gform_wrapper .ginput_complex.ginput_container.has_first_name.has_last_name span { + width: 46% + } + + body .gform_wrapper .ginput_complex.ginput_container.has_first_name.has_middle_name.has_last_name span { + width: 30% + } + +} + +@media all and (max-width: 480px), all and (max-device-width: 480px) { + + body .gform_wrapper ul li.gfield, + body .gform_wrapper .ginput_container, + body .gform_wrapper div.ginput_complex, + body .gform_wrapper div.ginput_complex span, + body .gform_wrapper div.ginput_complex span.ginput_left, + body .gform_wrapper div.ginput_complex span.ginput_right, + body .gform_wrapper div.gfield_password_strength, + body .gform_wrapper div.gf_page_steps, + body .gform_wrapper div.gf_page_steps div { + display: block !important; + float: none !important; + clear: both !important; + margin-left: 0 !important; + margin-right: 0 !important; + } + + body .gform_wrapper .ginput_container, + body .gform_wrapper div.ginput_complex, + body .gform_wrapper div.gf_page_steps, + body .gform_wrapper div.gf_page_steps div { + width: 95% !important; + } + + body .gform_wrapper div.gfield_password_strength { + width: 90% !important; + } + + body .gform_wrapper ul li.gfield, + body .gform_wrapper div.ginput_complex span, + body .gform_wrapper div.ginput_complex span.ginput_left, + body .gform_wrapper div.ginput_complex span.ginput_right { + width: 100% !important; + } + + body .gform_wrapper .ginput_complex .ginput_right input[type=text], + body .gform_wrapper .ginput_complex .ginput_right input[type=url], + body .gform_wrapper .ginput_complex .ginput_right input[type=email], + body .gform_wrapper .ginput_complex .ginput_right input[type=tel], + body .gform_wrapper .ginput_complex .ginput_right input[type=number], + body .gform_wrapper .ginput_complex .ginput_right input[type=password], + body .gform_wrapper .ginput_complex .ginput_left input[type=text], + body .gform_wrapper .ginput_complex .ginput_left input[type=url], + body .gform_wrapper .ginput_complex .ginput_left input[type=email], + body .gform_wrapper .ginput_complex .ginput_left input[type=tel], + body .gform_wrapper .ginput_complex .ginput_left input[type=number], + body .gform_wrapper .ginput_complex .ginput_left input[type=password], + body .gform_wrapper .ginput_complex .ginput_full input[type=text], + body .gform_wrapper .ginput_complex .ginput_full input[type=url], + body .gform_wrapper .ginput_complex .ginput_full input[type=email], + body .gform_wrapper .ginput_complex .ginput_full input[type=tel], + body .gform_wrapper .ginput_complex .ginput_full input[type=number], + body .gform_wrapper .ginput_complex .ginput_full input[type=password], + body .gform_wrapper .ginput_complex .ginput_full select, + body .gform_wrapper input.gform_button.button, + body .gform_wrapper input[type=submit] { + width: 95% !important; + } + + body .gform_wrapper .ginput_container input.small, + body .gform_wrapper .ginput_container input.medium, + body .gform_wrapper .ginput_container input.large, + body .gform_wrapper .ginput_container select.small, + body .gform_wrapper .ginput_container select.medium, + body .gform_wrapper .ginput_container select.large, + body .gform_wrapper .ginput_container textarea.small, + body .gform_wrapper .ginput_container textarea.medium, + body .gform_wrapper .ginput_container textarea.large { + width: 95% !important; + } + + body .gform_wrapper div.chosen-container.chosen-container-single[style] { + width: 95% !important; + } + + body .gform_wrapper img.ui-datepicker-trigger { + display: none !important; + } + + body .gform_wrapper .gfield_time_hour input, + body .gform_wrapper .gfield_time_minute input, + body .gform_wrapper .gfield_date_month input, + body .gform_wrapper .gfield_date_day input, + body .gform_wrapper .gfield_date_year input { + width: 95% !important; + } + + body .gform_wrapper .gfield_time_hour i { + display: none !important; + } + + body .gform_wrapper .ginput_complex input[type=text], + body .gform_wrapper .ginput_complex input[type=url], + body .gform_wrapper .ginput_complex input[type=email], + body .gform_wrapper .ginput_complex input[type=tel], + body .gform_wrapper .ginput_complex input[type=number], + body .gform_wrapper .ginput_complex input[type=password] { + width: 95% !important; + } + + body .gform_wrapper .ginput_complex .ginput_right input[type=text], + body .gform_wrapper .ginput_complex .ginput_right input[type=url], + body .gform_wrapper .ginput_complex .ginput_right input[type=email], + body .gform_wrapper .ginput_complex .ginput_right input[type=tel], + body .gform_wrapper .ginput_complex .ginput_right input[type=number], + body .gform_wrapper .ginput_complex .ginput_right input[type=password] { + width: 95% !important; + } + + body .gform_wrapper .gfield_error .ginput_complex .ginput_left input[type=text], + body .gform_wrapper .gfield_error .ginput_complex .ginput_left input[type=url], + body .gform_wrapper .gfield_error .ginput_complex .ginput_left input[type=email], + body .gform_wrapper .gfield_error .ginput_complex .ginput_left input[type=tel], + body .gform_wrapper .gfield_error .ginput_complex .ginput_left input[type=number], + body .gform_wrapper .gfield_error .ginput_complex .ginput_left input[type=password], + body .gform_wrapper .gfield_error .ginput_complex .ginput_right input[type=text], + body .gform_wrapper .gfield_error .ginput_complex .ginput_right input[type=url], + body .gform_wrapper .gfield_error .ginput_complex .ginput_right input[type=email], + body .gform_wrapper .gfield_error .ginput_complex .ginput_right input[type=tel], + body .gform_wrapper .gfield_error .ginput_complex .ginput_right input[type=number], + body .gform_wrapper .gfield_error .ginput_complex .ginput_right input[type=password], + body .gform_wrapper .gfield_error .ginput_complex .ginput_full input[type=text], + body .gform_wrapper .gfield_error .ginput_complex .ginput_full input[type=url], + body .gform_wrapper .gfield_error .ginput_complex .ginput_full input[type=email], + body .gform_wrapper .gfield_error .ginput_complex .ginput_full input[type=tel], + body .gform_wrapper .gfield_error .ginput_complex .ginput_full input[type=number], + body .gform_wrapper .gfield_error .ginput_complex .ginput_full input[type=password] { + width: 95% !important; + } + + body .gform_wrapper .ginput_complex span.name_suffix input[type=text] { + width: 97.5% !important; + } + + body .gform_wrapper .ginput_complex .ginput_right select, + body .gform_wrapper .ginput_complex .ginput_left select, + body .gform_wrapper .ginput_complex span.name_prefix.name_prefix_select select, + body .gform_wrapper .gfield_time_ampm select, + body .gform_wrapper .ginput_complex select, + body .gform_wrapper .ginput_complex .ginput_right select { + width: 97% !important; + } + + body .gform_wrapper .right_label .gfield_description, + body .gform_wrapper .left_label .gfield_description, + body .gform_wrapper .left_label .instruction, + body .gform_wrapper .right_label .instruction { + margin-left: 0 !important; + } + + body .gform_wrapper .gform_footer.right_label, + body .gform_wrapper .gform_footer.left_label { + padding-left: 0 !important; + padding-right: 0 !important; + } + + body .gform_wrapper .gfield_description, + body .gform_wrapper .gsection_description, + body .gform_wrapper .gfield_description p, + body .gform_wrapper .gsection_description p { + width: 95% !important; + text-align: justify; + } + + body .gform_wrapper label.gfield_label + div.ginput_container { + margin-top: 0; + } + + body .gform_wrapper .gfield .ginput_complex.has_suffix span.name_suffix { + width: 98% !important; + } + + body .gform_wrapper .gfield .ginput_complex.has_suffix span.name_suffix input { + width: 97.5%; + } + + body .gform_wrapper ul.gform_fields.left_label li.gfield label.gfield_label, + body .gform_wrapper ul.gform_fields.right_label li.gfield label.gfield_label { + margin-left: 0 !important; + float: none !important; + } + + body .gform_wrapper ul li.gfield.gfield_html img { + max-width: 95% !important; + } + + body .gform_wrapper .gform_footer a.gform_save_link { + display: block; + margin: 1em 0 1em 0; + text-align: center; + } + + body .gform_wrapper ul li.gfield.gfield_html h1, + body .gform_wrapper ul li.gfield.gfield_html h2, + body .gform_wrapper ul li.gfield.gfield_html h3, + body .gform_wrapper ul li.gfield.gfield_html h4, + body .gform_wrapper ul li.gfield.gfield_html h5, + body .gform_wrapper ul li.gfield.gfield_html h6 { + white-space: normal !important + } + + body .gform_wrapper .top_label .gfield_error { + width: 90% !important; + } + + body .form_saved_message { + font-size: 0.813em; + } + + body .form_saved_message_sent { + font-size: 0.813em; + } + + body .gform_wrapper div.validation_error { + font-size: 1em; + } + + body .form_saved_message .form_saved_message_emailform input, + body .form_saved_message .form_saved_message_emailform input[type=submit] { + width: 95% !important; + } + +} + +@media all and (max-device-width: 480px) { + + body .gform_wrapper { + font-size: 2.60em; + } + + body .gform_wrapper .gfield_checkbox li input[type=checkbox], + body .gform_wrapper .gfield_radio li input[type=radio], + body .gform_wrapper .gfield_checkbox li input { + margin-top: 2.50em !important; + width: auto !important; + height: auto !important; + } + } \ No newline at end of file diff --git a/css/gravityfont.css b/css/gravityfont.css new file mode 100644 index 0000000..b44fddb --- /dev/null +++ b/css/gravityfont.css @@ -0,0 +1,340 @@ +@font-face { + font-family: 'gravityfont'; + src: url('fonts/gravityfont.eot'); +} +@font-face { + font-family: 'gravityfont'; + src: url(data:application/x-font-ttf;charset=utf-8;base64,AAEAAAALAIAAAwAwT1MvMghi/PMAAAC8AAAAYGNtYXDmeObuAAABHAAAAFRnYXNwAAAAEAAAAXAAAAAIZ2x5ZkL6K2kAAAF4AAA0HGhlYWQC4c4EAAA1lAAAADZoaGVhA+ECHwAANcwAAAAkaG10eHF7AO0AADXwAAABAGxvY2Gn7Zs2AAA28AAAAIJtYXhwAE8A1AAAN3QAAAAgbmFtZf6nqNIAADeUAAACZ3Bvc3QAAwAAAAA5/AAAACAAAwIAAZAABQAAAUwBZgAAAEcBTAFmAAAA9QAZAIQAAAAAAAAAAAAAAAAAAAABEAAAAAAAAAAAAAAAAAAAAABAAADmPQHg/+AAIAHgACAAAAABAAAAAAAAAAAAAAAgAAAAAAACAAAAAwAAABQAAwABAAAAFAAEAEAAAAAMAAgAAgAEAAEAIOY25j3//f//AAAAAAAg5gDmOf/9//8AAf/jGgQaAgADAAEAAAAAAAAAAAAAAAAAAQAB//8ADwABAAAAAAAAAAAAAgAANzkBAAAAAAEAAAAAAAAAAAACAAA3OQEAAAAAAQAAAAAAAAAAAAIAADc5AQAAAAACAAD/6QHRAdcAGAA/AAABNCYvASYiDwEOAR0BFBYfARYyPwE+AT0BDwEOASsBIiY1NDY1Nz4BOwEyFg8BDgErASIGDwEGFBUUFjsBMhYHAdEWD58PKw+fDxYWD58PKw+fDxZmBAEGBtsXGQEMBB4f2wYFAQQBBgbNCgsCCQEJCM0GBQEBPBEmCVsJCVsJJhG4ESYJWwkJWwkmEbiaFQYGFxUDBgRMGx4GBhUGBgoKPAEDAQcIBgYAAwAA/+kB0QHXABYALwBGAAABPAE1NCYrASIGDwEcARUUFjsBMjY/ATc0Ji8BJiIPAQ4BHQEUFh8BFjI/AT4BPQEHIyImNTQ2PwE+ATsBMhYVFAYVBw4BIwFNCQiWCgwBCwkIlgoMAQuEFg+fDysPnw8WFg+fDysPnw8Wn7EXGAEBDAUcHrEXGAENBB0eAQEBAgEICAsJQgEDAQcICwlCOxEmCVsJCVsJJhG4ESYJWwkJWwkmEbi7FhQDBgNSGR0WFAMGA1IZHQADAAD/6QHRAdcAEwAsAFAAADczNzY0NTQmKwEiBg8BHAEVFBYzJTQmLwEmIg8BDgEdARQWHwEWMj8BPgE9AQcjIiY/AT4BOwEyNj8BIyImNTQ2NTc+ATsBMhYVHAEPAQ4BI5utAQEJCJkICQEBBwcBNhYPnw8rD58PFhYPnw8rD58PFqrIBQUBAwEGBb4MDwIBsxgbAQQEHh6tFhgBCwUhIvUMAQMBBwgIBwIBAgEGBUcRJglbCQlbCSYRuBEmCVsJCVsJJhG4uwYFFQUFDQwHEBQDBQMWGhUWFAMGA0keIQAAAAAEAAD/6QHRAdcAFgAvAFoAcQAAJSMiBgcVFAYVFBY7ATI2NTc8ATU0JiM3NCYvASYiDwEOAR0BFBYfARYyPwE+AT0BDwEOASsBIiY1NDY/AT4BNy4BNTQ2NTc+ATsBMhYVFAYVBw4BBx4BFRwBByczMjY/ATwBNTQmKwEiBgcVHAEVFBYzATehBwoBAQgGoQgKAQcHmhYPnw8rD58PFhYPnw8rD58PFl4BBBwesRcbAQEBAg8OCAkBAQQdHqwXGgEBAg4NCQoB05sICQEBBwebCAoBBwfLBwcDAQIBBQYIBwIBAgEGBXERJglbCQlbCSYRuBEmCVsJCVsJJhG4hQcaFRAUAgYDBxEVBAQPCwIGAgcaFRAUAwUDBxAUBQQPDAMFAj4HBwICAgEFBggHAgECAQYFAAIAAP/pAdEB1wAYADIAAAE0Ji8BJiIPAQ4BHQEUFh8BFjI/AT4BPQEFDgErASImPwEjIiY/AT4BMyEyFg8BDgEPAQHRFg+fDysPnw8WFg+fDysPnw8W/uUGCQYrBQEEsMQFBQEDAQYGAQoFBQECAQYDuAE8ESYJWwkJWwkmEbgRJglbCQlbCSYRuLIFBAoDhwUFFQUGBgUOBQcDjQAAAAADAAD/6QHRAdcAEwAsAFAAACUjBwYUFRQWOwEyNjU3PAE1NCYjNzQmLwEmIg8BDgEdARQWHwEWMj8BPgE9AQ8BDgErASImNTwBPwE+ATsBMhYPAQ4BKwEiBg8BMzIWFRQGFQE2rQEBCQiZCAoBBwebFg+fDysPnw8WFg+fDysPnw8WXAQEHh6tFhgBCwUhIsgFBQEDAQYFvgwPAgGzGBsBywwBAwEHCAgHAgECAQYFcREmCVsJCVsJJhG4ESYJWwkJWwkmEbh2FhoVFhQDBgNJHiEGBRUFBQ0MBxETAwUDAAIAAP/pAdEB1wAYAEkAAAE0Ji8BJiIPAQ4BHQEUFh8BFjI/AT4BPQEPAQ4BKwEiJj8BPgE7ATI2NzU8ATU0JisBIiY/AT4BOwEyFhUHDgErAQczMhYVFAYVAdEWD58PKw+fDxYWD58PKw+fDxZaAwUdH9YGBAEDAQYF0AgKAQcHyQUFAQ8BBgXzBgQEAQYFzwWsFxsBATwRJglbCQlbCSYRuBEmCVsJCVsJJhG4dhYaFQYFFQUFCAcCAgEBBgUFBl4FBgYFFQUFIBETAwUDAAACAAD/6QHRAdcAGABGAAABNCYvASYiDwEOAR0BFBYfARYyPwE+AT0BDwEOASsBBw4BKwEiJj8BIyImPwE+AT8BPgE7ATIWDwEzNz4BOwEyFhUHMzIWBwHRFg+fDysPnw8WFg+fDysPnw8WUgMBBgUQBAEGBRoGBAED1QYEAQIBBQSJBgkHJgUBBIKUEAEGBRsFBBAPBgQBATwRJglbCQlbCSYRuBEmCVsJCVsJJhG4eBQGBRkFBgYFGQUGDgUHA2kFBAkDZGUFBgYFZQYFAAAAAgAA/+kB0QHXABgAXAAAJTU0Ji8BJiIPAQ4BHQEUFh8BFjI/AT4BNScjIiY/ATQ2OwEyNjc1MjQ1NCYrASImNTc+ATsBMjY1NzA0NTQmKwEiJj8BPgE7ATIWFRQGFQcOAQceARUcARUHDgEjAdEWD58PKw+fDxYWD58PKw+fDxakygUEAQMGBcIHCQEBBwapBQQDAQYFpgcKAQcGvwUFAQMBBgXHFRgBAQINDAkJAQQaHIS4ESYJWwkJWwkmEbgRJglbCQlbCSYRBQUFEwQGBgcDAgEFBQUFEwQGBgcDAgEFBQUFEwUFDxICBgIGEBIFAw4LAwQDBhgTAAAAAgAA/+kB0QHXABgATAAAATQmLwEmIg8BDgEdARQWHwEWMj8BPgE9AQcyFhUHDgEjISImPwE+ATsBMjY3NTQ2NTQmKwEiJj8BPgE7ATIWFRwBDwEOASsBIgYPATMB0RYPnw8rD58PFhYPnw8rD58PFm8GBAQBBgX+/wUFAQkEHh6gBwoBAQgGxwUFAQMBBgbNFxsBAwQeHqAHCgED3AE8ESYJWwkJWwkmEbgRJglbCQlbCSYRuJEFBRUFBgYFOhoVBwcDAQIBBQYFBRUFBhEUAgUDFhoVBwcSAAAAAAIAAP/pAdEB1wAYAC4AAAE0Ji8BJiIPAQ4BHQEUFh8BFjI/AT4BPQEHIyImNTcjIiY/AT4BOwEyFg8BDgEjAdEWD58PKw+fDxYWD58PKw+fDxbgGwUEFiAFBQEDAQYFRQYEARoBBgUBPBEmCVsJCVsJJhG4ESYJWwkJWwkmEbi7BgWJBQUVBQYGBagFBgAAAAcAAP/pAdEB1wAYAB0AIgAnACwAMQA2AAABJyYiDwEOAR0BFBYfARYyPwE+AT0BNCYnASM1MxU1IzUzFTUjNTMVFyM1MxU1IzUzFTUjNTMVAayfDysPnw8WFg+fDysPnw8WFg/+5Dw8PDw8PO3a2tra2toBfFsJCVsJJhG4ESYJWwkJWwkmEbgRJgn+9Ds7VDo6UTs7pTs7VDo6UTs7AAACAAD/6QHRAdcAGAA7AAABNCYvASYiDwEOAR0BFBYfARYyPwE+AT0BByMHDgErASImNTc+ATsBMhYVBw4BKwEiBg8BMzIWDwEOASMB0RYPnw8rD58PFhYPnw8rD58PFoPHCQEHBRwGBBQEHSDcBgQEAQYGzgoMAQLHBgQBAwEGBgE8ESYJWwkJWwkmEbgRJglbCQlbCSYRuHY5BgYGBnkbHgYGFQYGCgoMBgUWBgUAAAQAAP/pAdEB1wAYACAAQQBJAAABJyYiDwEOAR0BFBYfARYyPwE+AT0BNCYnDwEXFSc1NxU3Bw4BBxQGBw4BIyImNTQ2PwE+ATc+ATMyFhceARUUBgcXBzU3JzUXFQGsnw8rD58PFhYPnw8rD58PFhYP71FRdHRHIAEBAQIBAgMDBgUBASABAwEBBAQDBAECAgIBhHRRUXQBfFsJCVsJJhG4ESYJWwkJWwkmEbgRJgl+Hx8hMhwyISKFAwUCAgMBAQEFBQEHBYUFBwICAgECAQQCAgcETzIgIB8hMhwAAAAAAwAA/+kB0QHXABgAVwCWAAABJyYiDwEOAR0BFBYfARYyPwE+AT0BNCYnBw4BBw4BHQEUBgcOAQceARceAR0BFBYXHgEXFSMiJicuAT0BNCYnLgEnNT4BNz4BPQE0Njc+ATc+ATc+ATMVFw4BBw4BHQEUBgcOASsBNT4BNz4BPQE0Njc+ATcuAScuAT0BNCYnLgEnNTIWFx4BFx4BFx4BHQEUFhceARcVAayfDysPnw8WFg+fDysPnw8WFg/3BgcCAwMCAgQNCgkMAwMEAwQCBwUKCREHBwcFBQMJBgcJAgUFAQECBwUECgYECge8BggDBgUHBwcRCgkFBwIDBAQDBAwICQwDBAMCAwIIBgcKAwYLBAUGAgECBAUCCgcBfFsJCVsJJhG4ESYJWwkJWwkmEbgRJgkyAQQCAwoIHwcMBAgMBAQIBQUOCCIHCwMCAwIVBgYFEAoqCA0EAwQCEAIFAwQPCSQDBwQGCwMEBAEBARVyAgQCBQ0IKgoQBQYGFQIDAgMLByIJDgUECAQECgUFDwgfBwoDAwQBFQEBAQQEAwkFBQkDJAoOBAMFAhAAAAAABAAA/+kB0QHXABgAOQBqAJsAAAEnJiIPAQ4BHQEUFh8BFjI/AT4BPQE0JicFFAYrASIGHQEUFjsBMhYdARQGKwEiJj0BNDY7ATIWHQEXFAYrASImPQE0NjsBMjY1MTQmKwEiJj0BNDY7ATIWHQEUBisBIgYVMRQWOwEyFh0BMxQGKwEiJj0BNDY7ATI2NTE0JisBIiY9ATQ2OwEyFh0BFAYrASIGFTEUFjsBMhYdAQGsnw8rD58PFhYPnw8rD58PFhYP/v0CAksEBAQESwICAgJQCgsLClACAnQLClICAgICTwMDAwM/CgwMClECAgICTwIDAwJACgt0DApRAgMDAk8DAwMDPwoMDApQAgICAk4DAwMDPwoMAXxbCQlbCSYRuBEmCVsJCVsJJhG4ESYJhQIDAwQWBAMDAggCAgsKHAoLAgIIKAoIAgIIAgMCAwMCCAoHCggCAggCAwIDAwIICgcKCAICCAIDAgMDAggKBwoIAgIIAgMCAwMCCAoHAAAAAwAA/+kB0QHXAA4AJwA/AAABMjY1NCYrASIGFRQWOwEXNCYvASYiDwEOAR0BFBYfARYyPwE+AT0BBxUjFTMVFAYjIiY9ASMnNzMXByMVIxUzAQgEBAQEPwQEBAQ/yRYPnw8rD58PFhYPnw8rD58PFtEQEA4JCg4QICBPICAQEBABPwUDBAQEBAMFAxEmCVsJCVsJJhG4ESYJWwkJWwkmEbicDxAICg4OCocvMDAvUBAAAAAAAwAA/+kB0QHXABgAIgBMAAABNCYvASYiDwEOAR0BFBYfARYyPwE+AT0BByc3FzUzFTcXBzcjNTQmKwEiBh0BIyImNTQ2NyY0NTQ2MzIWFz4BMzIWFRwBMR4BFRQGIwHRFg+fDysPnw8WFg+fDysPnw8W6TkTGB0XFDpTNgoHFwcKNhMaEg8BFA4IDgUHIBUaJhAWGhMBPBEmCVsJCVsJJhG4ESYJWwkJWwkmEbjdORQYRkYYFDllFAYKCgYUGxIQFwQCBAIOFAgGEhYlGgECAxkREhsAAAAAAwAA/+kB0QHXABgAIgBIAAABNCYvASYiDwEOAR0BFBYfARYyPwE+AT0BBycVIzUHJzcXBzcjJyYiDwEjIiY1NDY3JjQ1NDYzMhYXPgEzMhYVHAExHgEVFAYjAdEWD58PKw+fDxYWD58PKw+fDxbBGR0ZFDs8FC4cLgQMBC4fExsTDwEUDwgPBQchFRwnEBcbEwE8ESYJWwkJWwkmEbgRJglbCQlbCSYRuK8YSEkZFDs7FDAtBQUtGxMQGAQCBAIOFQgGEhcmGwECAxoRExsAAAQAAP/pAdEB1wANABsANABzAAA3MzcjIgYPARwBMRQWMxcjBzMyNjc1NjQxNCYjNzQmLwEmIg8BDgEdARQWHwEWMj8BPgE9AQ8BDgErAQcOASsBIiY/ASMiJj8BPgE7ATcjIiY1PAE1Nz4BOwE3PgE7ATIWDwEzMhYPAQ4BKwEHMzIWFRwBB587BDsGCQEBBwaUOwU8BwgBAQcGnhYPnw8rD58PFhYPnw8rD58PFmACBB4eQgMBBgUQBQQBAmkFBQEDAQYFagVAFxsDBB4eQAMBBgUQBQQBA2kFBQEDAQYFaQVCFxsB8xwGBwIBAgUFJhwGBwIBAgUFbxEmCVsJCVsJJhG4ESYJWwkJWwkmEbh4DxkVEwYFBQYTBQYUBQYcERMDBQMPGhQTBgUFBhMFBhQFBhwRFAIFAwAAAAAFAAD/6QHRAdcAEAAYADEATgCGAAATJgYHMQYWFxYyNz4BJy4BJwciJjU0NjcVNycmIg8BDgEdARQWHwEWMj8BPgE9ATQmJwMxMCIxOAE5AS4BNTQ2NzE4ATEwMjkBHgEVFAYHNw4BBw4BJy4BJw4BIwYmJw4BBw4BBwYmJy4BJyY2Nz4BNzI0NSY2NzE+ATceARceAQceARceAQfrBw8FBwIHCRoIBwQDAw4JBAYICAbFnw8rD58PFhYPnw8rD58PFhYPxQEJFRUJAQkUFAlrAgYCAg8FCRIJBxIKCxUIBg0GAwYDBgwBAwYDAgcJBQoFAQITEQgRCwwQCBEUAgUMBQgHAgFJAQYHCBcICQgGEgkICgEtCQYGCAEeYFsJCVsJJhG4ESYJWwkJWwkmEbgRJgn+qgEyExQGAQEGFBMyAZwOGw0HBQQIEAcGCQEICAUMBQIGAgIGBg0aDQsXBwQIBQMBHzwZCxUHBxQLGj4gBQkFBxYKAAAAAwAA/+kB0QHXABgAeQCGAAABJyYiDwEOAR0BFBYfARYyPwE+AT0BNCYnBxQGKwEOAQcXFhQPAQYiLwEOAQcVFAYrASImPQEuAScHBiIvASY0PwEuAScjIiY9ATQ2OwE+ATcnJjQ/ATYyHwE+ATc1NDY7ATIWHQEeARc3NjIfARYUDwEeARczMhYdASciBhUUFjMyNjU0JiMBrJ8PKw+fDxYWD58PKw+fDxYWDykLCBcCBwQRBQUOBhAFEQcPCAsIEwgLCA8HEQUQBg4FBREEBwIXCAsLCBcCBwQRBQUOBhAFEQcPCAsIEwgLCA8HEQUQBg4FBREEBwIXCAuaIC4uICAtLSABfFsJCVsJJhG4ESYJWwkJWwkmEbgRJgmmCAsIDwcQBhAFDgYGEAQGAhcIDAwIFwIGBBAGBg4FEAYQBw8ICwgUCAsIDwcQBhAFDgYGEAQGAhcIDAwIFwIGBBAGBg4FEAYQBw8ICwgUVy0gIC0tICAtAAAAAAMAAP/pAdEB1wAYACkASAAAATQmLwEmIg8BDgEdARQWHwEWMj8BPgE9AQc3NDY7ATIWDwEOASsBIiY3FwcOASsBIiY1PAE/AT4BOwEyFg8BFAYVFBY7ATIWBwHRFg+fDysPnw8WFg+fDysPnw8W+wQHBx8HBQEEAQcGIAYGAkAEAQcGHhUWARIBBwYgBgUBEAEEBA8GBQEBPBEmCVsJCVsJJhG4ESYJWwkJWwkmEbgDGAYGBgYYBgcHBrEZBgYUEwIGA3IGBgYGaQEBAQMDBwYAAAAAAgAA/+kB0QHXABgAJQAAATQmLwEmIg8BDgEdARQWHwEWMj8BPgE9AQcuAScmNhc2FgcOAQcB0RYPnw8rD58PFhYPnw8rD58PFugSeQUEdR8hcQMEehEBPBEmCVsJCVsJJhG4ESYJWwkJWwkmEbjbLz4/OyhCQig7PUEuAAIAAP/pAdEB1wAYACoAAAE0Ji8BJiIPAQ4BHQEUFh8BFjI/AT4BPQEHIiYnBzcuATU0NjMyFhUUBiMB0RYPnw8rD58PFhYPnw8rD58PFugLFAlHGRIWSjQzSkozATwRJglbCQlbCSYRuBEmCVsJCVsJJhG4sQMDK0EOJxYrPT0rKj0AAAQAAP/pAdEB1wAMABkAMgCtAAATMjY1NCYjIgYVFBYzMzI2NTQmIyIGFRQWMzc0Ji8BJiIPAQ4BHQEUFh8BFjI/AT4BPQEHFAYrAQ4BBxcWFAcxBiIvAQ4BBw4BBzUiBiMqAScVLgEnLgEnBwYiJzEmND8BLgEnIyImPQE0NjsBNDY3JyY0NzE2Mh8BPgE3LgE1NDY3NTQ2OwEVOgEzOgEXNTMyFh0BHgEVFAYHHgEXNzYyFzEWFA8BHgEVMzIWHQHXBAcHBAUHBwUlBAcHBAUHBwXVFg+fDysPnw8WFg+fDysPnw8WYQYFMwEGAyoDAwMJAykCBQIEEQoDBAICBAEKEQQDBgMpAwkDAwMqAwYBMwQHBwQyBAIlAwMDCQMiAgMCAQIRDQYFBAIEAgIEAQUEBg4QAgECBAEiAwkDAwMlAgQyBQYBLgcFBAcHBAUHBwUEBwcEBQcOESYJWwkJWwkmEbgRJglbCQlbCSYRuGEEBwcMBioDCQMDAykCAwISGAQjAQEjBBcSAQQDKQMDAwkDKgYMBwcEAQUGBgwFJQMJAwMDIQIDAgQKBBAaBhEEBxcBGAcEEQcZEAQKBAIDAiEDAwMJAyUFDAYGBQEAAAAADgAA/+kB0QHXAAgAEQAaACMALAA1AD4ARwBQAFkAYgBrAIQAlwAAASYGBxU2Mhc1Bz4BFxUmBgc1FT4BFxUmBgc1FT4BFxUmBgc1FyYGBzU+ARcVNSYGBzU+ARcVJy4BBxU2Mhc1BzYWFxUuAQc1FTYWFxUuAQc1Fy4BBzU2FhcVNS4BBzU2FhcVJzU2FhcVLgEHJTQmLwEmIg8BDgEdARQWHwEWMj8BPgE9AQcmIgc8ATU2Mhc2MhccARUmIgcBUBoyFhc2FVMRIhESIhARIhESIhARIhESIhBEEiIQESIREiIQESIRYhYyGhU3FlMRIxAQIhIRIxAQIhJEECISESMQECISESMQRBEjEBAiEgFFFg+fDysPnw8WFg+fDysPnw8W6h1HHBxHHRxHHR1HHAEnEAkPiQ4GiQ8IAgUMBwUIDRgIAgUMBwQJDRgIAgUMBwQJDTcHBAkOBwIEDRgHBAkNCAIEDVYPCRCJBg6JAQQDBw0IBQcNGAQDBw0IBQcNWwkEBgwEAggNGAkEBgwEAggNHg0EAggNCAUHWxEmCVsJCVsJJhG4ESYJWwkJWwkmEbjFFhY0UzUWFhYWNVM0FhYAAAAJAAD/6QHRAdcAJQAqAC8ANABPAGgAeQB+AIMAADc5AjI2Nz4BNTkCNCYnMS4BIzkCIgYHDgEVOQIUFhceATM3MxUjNRUzFSM1NTMVIzUHJw4BIzkCIiYnBw4BHQEUFjsBMjY9ATQmJzc0Ji8BJiIPAQ4BHQEUFh8BFjI/AT4BPQEHIyImPQE0NjsBMhYdARQGIyczFSM1FTMVIzWzBgoEAwUFAwQKBgYKBAMFBQMECgZLVlZWVlZWGyAECAQECAQgAwMGBVYFBgMD7hYPnw8rD58PFhYPnw8rD58PFnjhBwkJB+EHCQkHW1ZWVlbXBQQFCwcGDAQEBQUEBAwGBwsFBAUtDw9WDg5yDg5gEQICAgIRAgQDBgQGBgQGAwQCfBEmCVsJCVsJJhG4ESYJWwkJWwkmEbi5CQeaBwkJB5oHCWQODhwPDwAABAAA/+kB0QHXABgAQwBtAH8AAAE0Ji8BJiIPAQ4BHQEUFh8BFjI/AT4BPQEHFAYHDgEHKgEjOQEiJicuATUjMTM0Njc5AT4BMzkBOgEzHgEXHgEdATkBJy4BJyoBIzkBIgYHMQ4BFTkCFBYXHgEzOQE6ATM+ATc+ATUwNDE0JicHIiY1NDY3Fyc+ATMyFhUUBiMB0RYPnw8rD58PFhYPnw8rD58PFjMcFxc9IwMGAiZBGBkdAQEdGRhBJgMGAyM8FxccUBIwGwIEAhw0ExMWFhMTMx0CBAIbMBIRFRURZR8rAwRDGgYNBx4rKx4BPBEmCVsJCVsJJhG4ESYJWwkJWwkmEbhdCy0WFSIDIhYXMAkKMBcWIwQiFhYtCgEwER0CHBIRHQQEHBESGwIcERAaBQEEGxB5Kx8IEAcfRQMCKx8fKwAAAwAA/+kB0QHXABgAJQA+AAABNCYvASYiDwEOAR0BFBYfARYyPwE+AT0BAyImNTQ2Nx4BFRQGIzcUBg8BBiY9ATQmLwEmNjsBMhYPAQ4BHQEB0RYPnw8rD58PFhYPnw8rD58PFugIChACARELByEHBSsFBwUEUwMCBfMFAgNTBAUBPBEmCVsJCVsJJhG4ESYJWwkJWwkmEbj+/wsHCxMMDBMLBwtiBQkCCgIGBUwFDARTAwYGA1MEDAU7AAACAAD/6QHRAdcAGAAyAAABNCYvASYiDwEOAR0BFBYfARYyPwE+AT0BBycHBiY/AScmNjM/ATYWHwIeAQ8BFxYGJwHRFg+fDysPnw8WFg+fDysPnw8Wrzs6CxIEETQKCQtFGQUXBBlFDAYJNRADFAgBPBEmCVsJCVsJJhG4ESYJWwkJWwkmEbjSJSQGDgtDLAgWBD8MAQtABQEXBixDDA0HAAAAAAIAAP/pAdEB1wAYAD0AAAE0Ji8BJiIPAQ4BHQEUFh8BFjI/AT4BPQEPAQYiLwEHBiIvASY0PwEnJjQ/ATYyHwE3NjIfARYUDwEXFhQHAdEWD58PKw+fDxYWD58PKw+fDxZxDwcWCENECBYHDwcHREQHBw8HFghEQwgWBw8HB0REBwcBPBEmCVsJCVsJJhG4ESYJWwkJWwkmEbjFDggIQ0MICA4IFghDQwgWCA4ICENDCAgOCBYIQ0MIFggAAgAA/+kB0QHXABgAKwAAATQmLwEmIg8BDgEdARQWHwEWMj8BPgE9AQUnJjQ/ATYyHwE3NjIfARYUDwEB0RYPnw8rD58PFhYPnw8rD58PFv8AYQgICgcWBzNiCBUHCggIkAE8ESYJWwkJWwkmEbgRJglbCQlbCSYRuL9iBxUICggIM2EICAoHFQiQAAAHAAD/6QHRAdcACgAVABoAHwAkAD0ATgAAATU0JisBIgYdATMHFRQWOwEyNj0BIxcjNTMVMyM1MxUzIzUzFTc0Ji8BJiIPAQ4BHQEUFh8BFjI/AT4BPQEHIyImPQE0NjsBMhYdARQGIwFZBQPRAwXh4QUD0QMF4SAQECAQECEREfgWD58PKw+fDxYWD58PKw+fDxaA0QkPDwnRCg4OCgEQGAMFBQMYMEgDBQUDSEAgICAgICCcESYJWwkJWwkmEbgRJglbCQlbCSYRuLwOCpAKDg4KkAoOAAAHAAD/6QHRAdcAGAApAC4AMwA4AD0AQgAAATQmLwEmIg8BDgEdARQWHwEWMj8BPgE9AQcjIiY9ATQ2OwEyFh0BFAYjJyMVMzUHMxUjNRcjNTMVNSM1MxUnNTMVIwHRFg+fDysPnw8WFg+fDysPnw8WiMEKDg4KwQoODgoIsbGRcXFxcXFxcXFxcQE8ESYJWwkJWwkmEbgRJglbCQlbCSYRuN0OCtIKDg4K0goO4sLCMRAQcBAQIBAQIBAQAAMAAP/pAdEB1wAMACUAPgAAJTQmIyIGFRQWMzI2NTc0Ji8BJiIPAQ4BHQEUFh8BFjI/AT4BPQEPAQYiLwEOASMiJjU0NjMyFhUUBgcXFhQHARUqHh0qKh0eKrwWD58PKw+fDxYWD58PKw+fDxZtAgQNBEUMHhEpOzspKjsKCUUEBPseKSkeHioqHkERJglbCQlbCSYRuBEmCVsJCVsJJhG41QIEBEUJCzsqKjo6KhAeDEUEDQQAAAABAAD/6QHRAdcAGAAAAScmIg8BDgEdARQWHwEWMj8BPgE9ATQmJwGsnw8rD58PFhYPnw8rD58PFhYPAXxbCQlbCSYRuBEmCVsJCVsJJhG4ESYJAAAC//4AawHTAVUAEAAhAAAlISImPQE0NjMhMhYdARQGIyc0JisBIgYdARQWOwEyNj0BAbb+ZQwREQwBmwwREQz0CAWDBQgIBYMFCGsRC7ILERELsgsRtgUICAWCBgcHBoIAAAAAAv/+AGsB0wFVABAAIQAAJzU0NjMhMhYdARQGIyEiJjUlFBY7ATI2PQE0JisBIgYdAQIRDAGbDBERDP5lDBEBEQgFgwUICAWDBQiHsgsREQuyCxERCxgGBwcGggUICAWCAAAAAAQAAP/pAdEB1wAPABsANABIAAA3NCYjIgYVFBYXBzMnPgE1NzU0JiMiBh0BNjIXNzQmLwEmIg8BDgEdARQWHwEWMj8BPgE9AQcGIic1PgE3NTQ2MzIWHQEeARcV+wsHCAsEAwclBwMEJCAWFyAbNxuyFg+fDysPnw8WFg+fDysPnw8WjSxfLAQKBCsfHisECgS7CAsLCAQHAykpAwcEMSsXICAXKwYGUBEmCVsJCVsJJhG4ESYJWwkJWwkmEbjKEhJuAgMCMB4rKx4wAgMCbgAMABMACwG/Ab8ADgAdAC8AQQBTAGUAdACJAJsArQC/ANEAABMiJj0BNDYzMhYdARQGIxEiJj0BNDYzMhYdARQGIwMiJi8BJjY3NhYfARYGBw4BIxMiJi8BJjY3NhYfARYGBw4BIyciJi8BLgE3PgEfAR4BBw4BIwUqAS8BLgE3PgEfAR4BBw4BIyUjIiY1NDY7ATIWFRQGIyU4ATEjIiY1NDYzOAExMzIWFRQGIwUiJicmNj8BNhYXFgYPAQ4BIyUiJicmNj8BNhYXFgYPAQ4BIwciJicuAT8BPgEXHgEPAQ4BIxMiJicuAT8BPgEXHgEPAQ4BI+0LDw8LCw8PCwcJCQcHCgoHOwYMAygFBggJFAUnBgYJAgcDngQHAigDBAUFDAMnAwMFAgQByQMGA0QIBQUFEghECQUFAwsGARECAwJEBQMDAwoFRAUDAwIGA/7fTwgNDQhPCQwMCQE7TwUICAVPBQgIBf6RBQoCBAQHRAcQBAQEB0QDBQIBEAMGAgMDBUQFCgMDAwVEAgMCyAMEAgcEBCgDDwYHAwMoAgkEnQIDAQUDAycDCgUFAwMnAgYEATwPC08LDw8LTwsP/s8JB08HCQkHTwcJASMGBkQJFAUFBghECRQFAgH++QQDRAYMAwMEBUQFDAMBAd0CAScFEwgIBQUnBRIIBgaTASgCCwUEAwMnAwoFAwNaDAkJDAwJCQwICAUFCAgFBQhpBQUHEAQnBAQHBxAEJwIBpAMDBQsCKAICBQUKAycBAeoBAQQOB0QGBAQDDwZEBQQBFQEBAwoFRAUCAgMKBUQDBAAAAAEAAAAQAgABoAAFAAABBycHFwEBsPBwUMABQAGg8HBQwAFAAAEAAf/hAf8B3wBUAAAlOAExJzc4ATE+ATc2Ji8BLgEHDgEHOAExByc4ATEuAScmBg8BDgEXHgEXOAExFwc4ATEOAQcGFh8BHgE3PgE3OAExNxc4ATEeARcWNj8BPgEnLgEnAfubmwIBAQICBEkDCgQCAgKbmwICAgQKA0kEAgIBAQKbmwIBAQICBEkDCgQCAgKbmwICAgQKA0kEAgIBAQJFm5sCAgIECgNJBAICAQECm5sCAQECAgRJAwoEAgICm5sCAgIECgNJBAICAQECm5sCAQECAgRJAwoEAgICAAAAAgAA/+wB9AHgACYAMwAAJScuAQc+ATU0JicuASMiBgcOARUUFhceATMyNjcGFh8BHgE3NiYnJSImNTQ2MzIWFRQGIwHweQoTCBYYHhoaRigoRhoaHh4aGkYoJD8aAQgJZw0mDQ0CD/7QNUtLNTVLSzUsZwkIARo/JChGGhoeHhoaRigoRhoaHhgWCBMKeQ8CDQ0mDXRLNTVLSzU1SwAAAAMAAP/gAgAB4AAMABIAFwAAATIWFRQGDwEnNz4BMwEHNwEnASUHJzcXAbAhLwgIIHAgChgO/nAgkAEocP7YAUbgHOAcAeAvIQ4YCiBwIAgI/pCQIAEocP7YuuAc4BwAAAcAQP/gAcAB4AAKAA8AIQAyADcAPABBAAABISIGHQEhNTQmIycXIzczNyMiBg8BBhY7ATI2LwEuASMxFyEiBhcTHgE7ATI2NxM2JiMDIyczFTMjNTMVMyM1MwcBkP7gFBwBgBwUVAeGB3gEgAoQAQoBDAqgCgwBCgEQClj+0A0RARoBFQ3wDRUBGgERDdgwEEBgQEBQMEAQAaAcFBAQFBwgMjIgDgpDCg0NCkMKDqATDf7gDRMTDQEgDRP+4ODg4ODg4AADAAD/4AIAAeAAGAAxAFAAACUUBgcOASMiJicuATU0Njc+ATMyFhceARUhFBYXHgEzMjY3PgE1NCYnLgEjIgYHDgEVNxcWFAcGIi8BFRQGIyImPQEHBiInLgE1NDY/ATYyFwIAKCMjXTU1XSMjKCgjI101NV0jIyj+MCEcHEwrK0wcHCEhHBxMKytMHBwh54AJCQoaCkkTDQ0TSQoaCgQFBQSAChoK4DVdIyMoKCMjXTU1XSMjKCgjI101K0wcHCEhHBxMKytMHBwhIRwcTCuXgAoaCgkJSrMNExMNs0oJCQUMBgYMBYAJCQAAAAMAAP/gAgAB4AAYADEAUAAAJTQmJy4BIyIGBw4BFRQWFx4BMzI2Nz4BNSE0Njc+ATMyFhceARUUBgcOASMiJicuATUXNzY0JyYiDwE1NCYjIgYdAScmIgcOARUUFh8BFjI3AgAoIyNdNTVdIyMoKCMjXTU1XSMjKP4wIRwcTCsrTBwcISEcHEwrK0wcHCHngAkJChoKSRMNDRNJChoKBAUFBIAKGgrgNV0jIygoIyNdNTVdIyMoKCMjXTUrTBwcISEcHEwrK0wcHCEhHBxMK5eAChoKCQlKsw0TEw2zSgkJBQwGBgwFgAkJAAAAAwAA/+ACAAHgABgAMQBQAAABMhYXHgEVFAYHDgEjIiYnLgE1NDY3PgEzETI2Nz4BNTQmJy4BIyIGBw4BFRQWFx4BMyc3NjIXFhQPATMyFhUUBisBFxYUBw4BIyImLwEmNDcBADVdIyMoKCMjXTU1XSMjKCgjI101K0wcHCEhHBxMKytMHBwhIRwcTCuXgAoaCgkJSrMNExMNs0oJCQUMBgYMBYAJCQHgKCMjXTU1XSMjKCgjI101NV0jIyj+MCEcHEwrK0wcHCEhHBxMKytMHBwh54AJCQoaCkkTDQ0TSQoaCgQFBQSAChoKAAADAAD/4AIAAeAAGAAxAFAAAAEiBgcOARUUFhceATMyNjc+ATU0JicuASMRIiYnLgE1NDY3PgEzMhYXHgEVFAYHDgEjNycmIgcGFB8BIyIGFRQWOwEHBhQXHgEzMjY/ATY0JwEANV0jIygoIyNdNTVdIyMoKCMjXTUrTBwcISEcHEwrK0wcHCEhHBxMK5eAChoKCQlKsw0TEw2zSgkJBQwGBgwFgAkJAeAoIyNdNTVdIyMoKCMjXTU1XSMjKP4wIRwcTCsrTBwcISEcHEwrK0wcHCHngAkJChoKSRMNDRNJChoKBAUFBIAKGgoAAAMAAP/gAgAB4AAYADEAPgAABSImJy4BNTQ2Nz4BMzIWFx4BFRQGBw4BIxEiBgcOARUUFhceATMyNjc+ATU0JicuASMTIzUjNTM1MxUzFSMVAQA1XSMjKCgjI101NV0jIygoIyNdNShGGhoeHhoaRigoRhoaHh4aGkYoIEBgYEBgYCAoIyNdNTVdIyMoKCMjXTU1XSMjKAHAHhoaRigoRhoaHh4aGkYoKEYaGh7+wGBAYGBAYAAAAAADAAD/4AIAAeAAGAAxADYAAAEiBgcOARUUFhceATMyNjc+ATU0JicuASMRIiYnLgE1NDY3PgEzMhYXHgEVFAYHDgEjJyE1IRUBADVdIyMoKCMjXTU1XSMjKCgjI101KEYaGh4eGhpGKChGGhoeHhoaRiiAAQD/AAHgKCMjXTU1XSMjKCgjI101NV0jIyj+QB4aGkYoKEYaGh4eGhpGKChGGhoeoEBAAAADADAAEAHAAaAAYABtAHoAACUjDgEHFxYUDwEGIi8BDgEHFRQGKwEiJj0BLgEnBwYiLwEmND8BLgEnIyImPQE0NjsBPgE3JyY0PwE2Mh8BPgE3NTQ2OwEyFh0BHgEXNzYyHwEWFA8BHgEXMzIWHQEUBiMnIgYVFBYzMjY1NCYjFSImNTQ2MzIWFRQGIwGgFQMHBRQJCQwJGwkUCBIJEw0QDRMJEggUCRsJDAkJFAUHAxUNExMNFQIIBBMJCQwJGwkTCBIKEw0QDRMKEggTCRsJDAkJEwQIAhUNExMNqCUzMyUlMzMlERcXEREXFxGvCRIIFAkbCQwJCRQFBwIVDRMTDRUCBwUUCQkMCRsJFAgSCRMNEA0TCRIIEwkbCQwJCRMFCAIWDRMTDRYCCAUTCQkMCRsJEwgSCRMNEA0TgDQlJDQ0JCU0gBgREBgYEBEYAAAEAAD/4AIAAeAAGAAxADYAOwAABSImJy4BNTQ2Nz4BMzIWFx4BFRQGBw4BIxEiBgcOARUUFhceATMyNjc+ATU0JicuASMDMxUjNTUzFSM1AQA1XSMjKCgjI101NV0jIygoIyNdNShGGhoeHhoaRigoRhoaHh4aGkYoIEBAQEAgKCMjXTU1XSMjKCgjI101NV0jIygBwB4aGkYoKEYaGh4eGhpGKChGGhoe/wBAQMCgoAAAAAADAAD/4AIAAeAAGAAmADQAAAUiJicuATU0Njc+ATMyFhceARUUBgcOASMDFBYXAS4BIyIGBw4BFSUBHgEzMjY3PgE1NCYnAQA1XSMjKCgjI101NV0jIygoIyNdNcATEQELGDgfKEYaGh4BXP71GDgfKEYaGh4TESAoIyNdNTVdIyMoKCMjXTU1XSMjKAEAHzgYAQsREx4aGkYob/71ERMeGhpGKB84GAABAB///wHhAcEACQAAARczBxcnBzcnMwEAPaSGMIuLMIakAcGsZbFqarFlAAIAH///AeEBwQAKABUAAAEjJwcjFwc3Fyc3DwE3Jxc3FzcHFycB4aQ9PaSGMIuLMIbhTSBJWhwcWkkgTQEVrKxlsWpqsWV6QFs7AmdnAjtbQAAAAAMAAP/gAgAB4AAYADEAPgAANy4BNTQ2Nz4BMzIWFx4BFRQGBw4BIyImJwEuASMiBgcOARUUFhceATMyNjc+ATU0JicHJzcnNxc3FwcXBycHSyYlJSYlXzExXyUmJSUmJV8xMV8lAT0cRyUlRxwcHBwcHEclJUccHBwcHMwtREQtREQtREQtREQrJV8xMV8lJiUlJiVfMTFfJSYlJSYBPRwcHBwcRyUlRxwcHBwcHEclJUcc+S1ERC1ERC1ERC1ERAAAAAAGABX/9AHrAcsAGAAnADYARQBSAGEAABMiBgcOARcUFhceATM+ATc+ASc0JicuAQcVMhYXBy4BIyIGByc+ATcDBy4BJzQ2NxcOARUUFhcXIiYnNx4BMzI2NxcOAQcnIiY1NDYzMhYVFAYjNz4BNTQmJzceARcUBgcn/TFVIB8kASYhIFYxMVUgHyQBJiEgVjEbMRYgDiARESAOIBUuGX41CgwBDAs1BwcHB4QbMRYgDiARESAOIBUuGQMvQkIvL0JCL4EHBwcHNQoMAQwLNQHLJiEgVjExVSAfJAEmISBWMTFVIB8kAR4MCzUHBwcHNQoMAf70HxQuGRsxFiAOIBERIA6ODAs1BwcHBzUKDAFcQi8vQkIvL0IyDiARESAOIBUuGRsxFiAAAAIAGgAlAesBnQAxADoAAAEOAQcOAQcOARceATEjFzA2Nz4BNzYWBw4BBw4BMTgBMQcXMBYXFjY3PgE3PgE1NiYHARQWNz4BMScVAd8Ei1RTiwMGAQYIWgE6VzQ1WAEDBQIBQCUmPgsPeQYGDAIBFw0OFwIIBv7WBAQFRFEBnQIxHR0yAQIHAwMkF0AmJ0ABAwYCAUQpKUMNCEEEAwUHBGM7OmIDBgcC/owFAgMEPipoAAAAAAEAAAABMzOcPi/AXw889QALAgAAAAAA0OItCgAAAADQ4i0K//7/4AIAAeAAAAAIAAIAAAAAAAAAAQAAAeD/4AAAAgD//v/+AgAAAQAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAABAAAAAdEAAAHRAAAB0QAAAdEAAAHRAAAB0QAAAdEAAAHRAAAB0QAAAdEAAAHRAAAB0QAAAdEAAAHRAAAB0QAAAdEAAAHRAAAB0QAAAdEAAAHRAAAB0QAAAdEAAAHRAAAB0QAAAdEAAAHRAAAB0QAAAdEAAAHRAAAB0QAAAdEAAAHRAAAB0QAAAdEAAAHRAAAB0QAAAdEAAAHR//4B0f/+AdEAAAHRABMCAAAAAgAAAQIAAAACAAAAAgAAQAIAAAACAAAAAgAAAAIAAAACAAAAAgAAAAIAADACAAAAAgAAAAIAAB8CAAAfAgAAAAIAABUCAAAaAAAAAAAKABQAHgB6AN4BUAHqAjoCqgMSA3oD+ARmBK4E/gVWBcYGngdeB7gIJAiMCSoJ5gqiCwwLSguMDHQNVg36DpwO+g9MD6oP8BBcELoRFhFAEXIRpBIMEzwTThO+FA4UPhSgFRYVjBYCFngW1BcoF9AYKhh+GJQYvhkgGbQaDgAAAAEAAABAANIADgAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAUAPYAAQAAAAAAAABKABYAAQAAAAAAAQAWAAAAAQAAAAAAAgAOARkAAQAAAAAAAwAWAOIAAQAAAAAABAAWAScAAQAAAAAABQAWAMwAAQAAAAAABgALAPgAAQAAAAAACgA0AT0AAQAAAAAACwA2AJYAAQAAAAAADAA2AGAAAwABBAkAAABKABYAAwABBAkAAQAWAAAAAwABBAkAAgAOARkAAwABBAkAAwAWAOIAAwABBAkABAAWAScAAwABBAkABQAWAMwAAwABBAkABgAWAQMAAwABBAkACgA0AT0AAwABBAkACwA2AJYAAwABBAkADAA2AGAAZwByAGEAdgBpAHQAeQBmAG8AbgB0AEMAbwBwAHkAcgBpAGcAaAB0ACAAMgAwADEANAAtADIAMAAxADUAIABSAG8AYwBrAGUAdABnAGUAbgBpAHUAcwAgAEkAbgBjAC4AaAB0AHQAcAA6AC8ALwB3AHcAdwAuAHIAbwBjAGsAZQB0AGcAZQBuAGkAdQBzAC4AYwBvAG0AaAB0AHQAcAA6AC8ALwB3AHcAdwAuAGcAcgBhAHYAaQB0AHkAZgBvAHIAbQBzAC4AYwBvAG0AVgBlAHIAcwBpAG8AbgAgADEALgAyAGcAcgBhAHYAaQB0AHkAZgBvAG4AdGdyYXZpdHlmb250AGcAcgBhAHYAaQB0AHkAZgBvAG4AdABSAGUAZwB1AGwAYQByAGcAcgBhAHYAaQB0AHkAZgBvAG4AdABGAG8AbgB0ACAAZwBlAG4AZQByAGEAdABlAGQAIABiAHkAIABJAGMAbwBNAG8AbwBuAC4AAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=) format('truetype'), + url(data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAADpoAAsAAAAAOhwAAQACAAAAAAAAAAAAAAAAAAAAAAAAAABPUy8yAAABCAAAAGAAAABgCGL882NtYXAAAAFoAAAAVAAAAFTmeObuZ2FzcAAAAbwAAAAIAAAACAAAABBnbHlmAAABxAAANBwAADQcQvoraWhlYWQAADXgAAAANgAAADYC4c4EaGhlYQAANhgAAAAkAAAAJAPhAh9obXR4AAA2PAAAAQAAAAEAcXsA7WxvY2EAADc8AAAAggAAAIKn7Zs2bWF4cAAAN8AAAAAgAAAAIABPANRuYW1lAAA34AAAAmcAAAJn/qeo0nBvc3QAADpIAAAAIAAAACAAAwAAAAMCAAGQAAUAAAFMAWYAAABHAUwBZgAAAPUAGQCEAAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAAAAAAAAAAAAAQAAA5j0B4P/gACAB4AAgAAAAAQAAAAAAAAAAAAAAIAAAAAAAAgAAAAMAAAAUAAMAAQAAABQABABAAAAADAAIAAIABAABACDmNuY9//3//wAAAAAAIOYA5jn//f//AAH/4xoEGgIAAwABAAAAAAAAAAAAAAAAAAEAAf//AA8AAQAAAAAAAAAAAAIAADc5AQAAAAABAAAAAAAAAAAAAgAANzkBAAAAAAEAAAAAAAAAAAACAAA3OQEAAAAAAgAA/+kB0QHXABgAPwAAATQmLwEmIg8BDgEdARQWHwEWMj8BPgE9AQ8BDgErASImNTQ2NTc+ATsBMhYPAQ4BKwEiBg8BBhQVFBY7ATIWBwHRFg+fDysPnw8WFg+fDysPnw8WZgQBBgbbFxkBDAQeH9sGBQEEAQYGzQoLAgkBCQjNBgUBATwRJglbCQlbCSYRuBEmCVsJCVsJJhG4mhUGBhcVAwYETBseBgYVBgYKCjwBAwEHCAYGAAMAAP/pAdEB1wAWAC8ARgAAATwBNTQmKwEiBg8BHAEVFBY7ATI2PwE3NCYvASYiDwEOAR0BFBYfARYyPwE+AT0BByMiJjU0Nj8BPgE7ATIWFRQGFQcOASMBTQkIlgoMAQsJCJYKDAELhBYPnw8rD58PFhYPnw8rD58PFp+xFxgBAQwFHB6xFxgBDQQdHgEBAQIBCAgLCUIBAwEHCAsJQjsRJglbCQlbCSYRuBEmCVsJCVsJJhG4uxYUAwYDUhkdFhQDBgNSGR0AAwAA/+kB0QHXABMALABQAAA3Mzc2NDU0JisBIgYPARwBFRQWMyU0Ji8BJiIPAQ4BHQEUFh8BFjI/AT4BPQEHIyImPwE+ATsBMjY/ASMiJjU0NjU3PgE7ATIWFRwBDwEOASObrQEBCQiZCAkBAQcHATYWD58PKw+fDxYWD58PKw+fDxaqyAUFAQMBBgW+DA8CAbMYGwEEBB4erRYYAQsFISL1DAEDAQcICAcCAQIBBgVHESYJWwkJWwkmEbgRJglbCQlbCSYRuLsGBRUFBQ0MBxAUAwUDFhoVFhQDBgNJHiEAAAAABAAA/+kB0QHXABYALwBaAHEAACUjIgYHFRQGFRQWOwEyNjU3PAE1NCYjNzQmLwEmIg8BDgEdARQWHwEWMj8BPgE9AQ8BDgErASImNTQ2PwE+ATcuATU0NjU3PgE7ATIWFRQGFQcOAQceARUcAQcnMzI2PwE8ATU0JisBIgYHFRwBFRQWMwE3oQcKAQEIBqEICgEHB5oWD58PKw+fDxYWD58PKw+fDxZeAQQcHrEXGwEBAQIPDggJAQEEHR6sFxoBAQIODQkKAdObCAkBAQcHmwgKAQcHywcHAwECAQUGCAcCAQIBBgVxESYJWwkJWwkmEbgRJglbCQlbCSYRuIUHGhUQFAIGAwcRFQQEDwsCBgIHGhUQFAMFAwcQFAUEDwwDBQI+BwcCAgIBBQYIBwIBAgEGBQACAAD/6QHRAdcAGAAyAAABNCYvASYiDwEOAR0BFBYfARYyPwE+AT0BBQ4BKwEiJj8BIyImPwE+ATMhMhYPAQ4BDwEB0RYPnw8rD58PFhYPnw8rD58PFv7lBgkGKwUBBLDEBQUBAwEGBgEKBQUBAgEGA7gBPBEmCVsJCVsJJhG4ESYJWwkJWwkmEbiyBQQKA4cFBRUFBgYFDgUHA40AAAAAAwAA/+kB0QHXABMALABQAAAlIwcGFBUUFjsBMjY1NzwBNTQmIzc0Ji8BJiIPAQ4BHQEUFh8BFjI/AT4BPQEPAQ4BKwEiJjU8AT8BPgE7ATIWDwEOASsBIgYPATMyFhUUBhUBNq0BAQkImQgKAQcHmxYPnw8rD58PFhYPnw8rD58PFlwEBB4erRYYAQsFISLIBQUBAwEGBb4MDwIBsxgbAcsMAQMBBwgIBwIBAgEGBXERJglbCQlbCSYRuBEmCVsJCVsJJhG4dhYaFRYUAwYDSR4hBgUVBQUNDAcREwMFAwACAAD/6QHRAdcAGABJAAABNCYvASYiDwEOAR0BFBYfARYyPwE+AT0BDwEOASsBIiY/AT4BOwEyNjc1PAE1NCYrASImPwE+ATsBMhYVBw4BKwEHMzIWFRQGFQHRFg+fDysPnw8WFg+fDysPnw8WWgMFHR/WBgQBAwEGBdAICgEHB8kFBQEPAQYF8wYEBAEGBc8FrBcbAQE8ESYJWwkJWwkmEbgRJglbCQlbCSYRuHYWGhUGBRUFBQgHAgIBAQYFBQZeBQYGBRUFBSAREwMFAwAAAgAA/+kB0QHXABgARgAAATQmLwEmIg8BDgEdARQWHwEWMj8BPgE9AQ8BDgErAQcOASsBIiY/ASMiJj8BPgE/AT4BOwEyFg8BMzc+ATsBMhYVBzMyFgcB0RYPnw8rD58PFhYPnw8rD58PFlIDAQYFEAQBBgUaBgQBA9UGBAECAQUEiQYJByYFAQSClBABBgUbBQQQDwYEAQE8ESYJWwkJWwkmEbgRJglbCQlbCSYRuHgUBgUZBQYGBRkFBg4FBwNpBQQJA2RlBQYGBWUGBQAAAAIAAP/pAdEB1wAYAFwAACU1NCYvASYiDwEOAR0BFBYfARYyPwE+ATUnIyImPwE0NjsBMjY3NTI0NTQmKwEiJjU3PgE7ATI2NTcwNDU0JisBIiY/AT4BOwEyFhUUBhUHDgEHHgEVHAEVBw4BIwHRFg+fDysPnw8WFg+fDysPnw8WpMoFBAEDBgXCBwkBAQcGqQUEAwEGBaYHCgEHBr8FBQEDAQYFxxUYAQECDQwJCQEEGhyEuBEmCVsJCVsJJhG4ESYJWwkJWwkmEQUFBRMEBgYHAwIBBQUFBRMEBgYHAwIBBQUFBRMFBQ8SAgYCBhASBQMOCwMEAwYYEwAAAAIAAP/pAdEB1wAYAEwAAAE0Ji8BJiIPAQ4BHQEUFh8BFjI/AT4BPQEHMhYVBw4BIyEiJj8BPgE7ATI2NzU0NjU0JisBIiY/AT4BOwEyFhUcAQ8BDgErASIGDwEzAdEWD58PKw+fDxYWD58PKw+fDxZvBgQEAQYF/v8FBQEJBB4eoAcKAQEIBscFBQEDAQYGzRcbAQMEHh6gBwoBA9wBPBEmCVsJCVsJJhG4ESYJWwkJWwkmEbiRBQUVBQYGBToaFQcHAwECAQUGBQUVBQYRFAIFAxYaFQcHEgAAAAACAAD/6QHRAdcAGAAuAAABNCYvASYiDwEOAR0BFBYfARYyPwE+AT0BByMiJjU3IyImPwE+ATsBMhYPAQ4BIwHRFg+fDysPnw8WFg+fDysPnw8W4BsFBBYgBQUBAwEGBUUGBAEaAQYFATwRJglbCQlbCSYRuBEmCVsJCVsJJhG4uwYFiQUFFQUGBgWoBQYAAAAHAAD/6QHRAdcAGAAdACIAJwAsADEANgAAAScmIg8BDgEdARQWHwEWMj8BPgE9ATQmJwEjNTMVNSM1MxU1IzUzFRcjNTMVNSM1MxU1IzUzFQGsnw8rD58PFhYPnw8rD58PFhYP/uQ8PDw8PDzt2tra2traAXxbCQlbCSYRuBEmCVsJCVsJJhG4ESYJ/vQ7O1Q6OlE7O6U7O1Q6OlE7OwAAAgAA/+kB0QHXABgAOwAAATQmLwEmIg8BDgEdARQWHwEWMj8BPgE9AQcjBw4BKwEiJjU3PgE7ATIWFQcOASsBIgYPATMyFg8BDgEjAdEWD58PKw+fDxYWD58PKw+fDxaDxwkBBwUcBgQUBB0g3AYEBAEGBs4KDAECxwYEAQMBBgYBPBEmCVsJCVsJJhG4ESYJWwkJWwkmEbh2OQYGBgZ5Gx4GBhUGBgoKDAYFFgYFAAAEAAD/6QHRAdcAGAAgAEEASQAAAScmIg8BDgEdARQWHwEWMj8BPgE9ATQmJw8BFxUnNTcVNwcOAQcUBgcOASMiJjU0Nj8BPgE3PgEzMhYXHgEVFAYHFwc1Nyc1FxUBrJ8PKw+fDxYWD58PKw+fDxYWD+9RUXR0RyABAQECAQIDAwYFAQEgAQMBAQQEAwQBAgICAYR0UVF0AXxbCQlbCSYRuBEmCVsJCVsJJhG4ESYJfh8fITIcMiEihQMFAgIDAQEBBQUBBwWFBQcCAgIBAgEEAgIHBE8yICAfITIcAAAAAAMAAP/pAdEB1wAYAFcAlgAAAScmIg8BDgEdARQWHwEWMj8BPgE9ATQmJwcOAQcOAR0BFAYHDgEHHgEXHgEdARQWFx4BFxUjIiYnLgE9ATQmJy4BJzU+ATc+AT0BNDY3PgE3PgE3PgEzFRcOAQcOAR0BFAYHDgErATU+ATc+AT0BNDY3PgE3LgEnLgE9ATQmJy4BJzUyFhceARceARceAR0BFBYXHgEXFQGsnw8rD58PFhYPnw8rD58PFhYP9wYHAgMDAgIEDQoJDAMDBAMEAgcFCgkRBwcHBQUDCQYHCQIFBQEBAgcFBAoGBAoHvAYIAwYFBwcHEQoJBQcCAwQEAwQMCAkMAwQDAgMCCAYHCgMGCwQFBgIBAgQFAgoHAXxbCQlbCSYRuBEmCVsJCVsJJhG4ESYJMgEEAgMKCB8HDAQIDAQECAUFDggiBwsDAgMCFQYGBRAKKggNBAMEAhACBQMEDwkkAwcEBgsDBAQBAQEVcgIEAgUNCCoKEAUGBhUCAwIDCwciCQ4FBAgEBAoFBQ8IHwcKAwMEARUBAQEEBAMJBQUJAyQKDgQDBQIQAAAAAAQAAP/pAdEB1wAYADkAagCbAAABJyYiDwEOAR0BFBYfARYyPwE+AT0BNCYnBRQGKwEiBh0BFBY7ATIWHQEUBisBIiY9ATQ2OwEyFh0BFxQGKwEiJj0BNDY7ATI2NTE0JisBIiY9ATQ2OwEyFh0BFAYrASIGFTEUFjsBMhYdATMUBisBIiY9ATQ2OwEyNjUxNCYrASImPQE0NjsBMhYdARQGKwEiBhUxFBY7ATIWHQEBrJ8PKw+fDxYWD58PKw+fDxYWD/79AgJLBAQEBEsCAgICUAoLCwpQAgJ0CwpSAgICAk8DAwMDPwoMDApRAgICAk8CAwMCQAoLdAwKUQIDAwJPAwMDAz8KDAwKUAICAgJOAwMDAz8KDAF8WwkJWwkmEbgRJglbCQlbCSYRuBEmCYUCAwMEFgQDAwIIAgILChwKCwICCCgKCAICCAIDAgMDAggKBwoIAgIIAgMCAwMCCAoHCggCAggCAwIDAwIICgcKCAICCAIDAgMDAggKBwAAAAMAAP/pAdEB1wAOACcAPwAAATI2NTQmKwEiBhUUFjsBFzQmLwEmIg8BDgEdARQWHwEWMj8BPgE9AQcVIxUzFRQGIyImPQEjJzczFwcjFSMVMwEIBAQEBD8EBAQEP8kWD58PKw+fDxYWD58PKw+fDxbREBAOCQoOECAgTyAgEBAQAT8FAwQEBAQDBQMRJglbCQlbCSYRuBEmCVsJCVsJJhG4nA8QCAoODgqHLzAwL1AQAAAAAAMAAP/pAdEB1wAYACIATAAAATQmLwEmIg8BDgEdARQWHwEWMj8BPgE9AQcnNxc1MxU3Fwc3IzU0JisBIgYdASMiJjU0NjcmNDU0NjMyFhc+ATMyFhUcATEeARUUBiMB0RYPnw8rD58PFhYPnw8rD58PFuk5ExgdFxQ6UzYKBxcHCjYTGhIPARQOCA4FByAVGiYQFhoTATwRJglbCQlbCSYRuBEmCVsJCVsJJhG43TkUGEZGGBQ5ZRQGCgoGFBsSEBcEAgQCDhQIBhIWJRoBAgMZERIbAAAAAAMAAP/pAdEB1wAYACIASAAAATQmLwEmIg8BDgEdARQWHwEWMj8BPgE9AQcnFSM1Byc3Fwc3IycmIg8BIyImNTQ2NyY0NTQ2MzIWFz4BMzIWFRwBMR4BFRQGIwHRFg+fDysPnw8WFg+fDysPnw8WwRkdGRQ7PBQuHC4EDAQuHxMbEw8BFA8IDwUHIRUcJxAXGxMBPBEmCVsJCVsJJhG4ESYJWwkJWwkmEbivGEhJGRQ7OxQwLQUFLRsTEBgEAgQCDhUIBhIXJhsBAgMaERMbAAAEAAD/6QHRAdcADQAbADQAcwAANzM3IyIGDwEcATEUFjMXIwczMjY3NTY0MTQmIzc0Ji8BJiIPAQ4BHQEUFh8BFjI/AT4BPQEPAQ4BKwEHDgErASImPwEjIiY/AT4BOwE3IyImNTwBNTc+ATsBNz4BOwEyFg8BMzIWDwEOASsBBzMyFhUcAQefOwQ7BgkBAQcGlDsFPAcIAQEHBp4WD58PKw+fDxYWD58PKw+fDxZgAgQeHkIDAQYFEAUEAQJpBQUBAwEGBWoFQBcbAwQeHkADAQYFEAUEAQNpBQUBAwEGBWkFQhcbAfMcBgcCAQIFBSYcBgcCAQIFBW8RJglbCQlbCSYRuBEmCVsJCVsJJhG4eA8ZFRMGBQUGEwUGFAUGHBETAwUDDxoUEwYFBQYTBQYUBQYcERQCBQMAAAAABQAA/+kB0QHXABAAGAAxAE4AhgAAEyYGBzEGFhcWMjc+AScuAScHIiY1NDY3FTcnJiIPAQ4BHQEUFh8BFjI/AT4BPQE0JicDMTAiMTgBOQEuATU0NjcxOAExMDI5AR4BFRQGBzcOAQcOAScuAScOASMGJicOAQcOAQcGJicuAScmNjc+ATcyNDUmNjcxPgE3HgEXHgEHHgEXHgEH6wcPBQcCBwkaCAcEAwMOCQQGCAgGxZ8PKw+fDxYWD58PKw+fDxYWD8UBCRUVCQEJFBQJawIGAgIPBQkSCQcSCgsVCAYNBgMGAwYMAQMGAwIHCQUKBQECExEIEQsMEAgRFAIFDAUIBwIBSQEGBwgXCAkIBhIJCAoBLQkGBggBHmBbCQlbCSYRuBEmCVsJCVsJJhG4ESYJ/qoBMhMUBgEBBhQTMgGcDhsNBwUECBAHBgkBCAgFDAUCBgICBgYNGg0LFwcECAUDAR88GQsVBwcUCxo+IAUJBQcWCgAAAAMAAP/pAdEB1wAYAHkAhgAAAScmIg8BDgEdARQWHwEWMj8BPgE9ATQmJwcUBisBDgEHFxYUDwEGIi8BDgEHFRQGKwEiJj0BLgEnBwYiLwEmND8BLgEnIyImPQE0NjsBPgE3JyY0PwE2Mh8BPgE3NTQ2OwEyFh0BHgEXNzYyHwEWFA8BHgEXMzIWHQEnIgYVFBYzMjY1NCYjAayfDysPnw8WFg+fDysPnw8WFg8pCwgXAgcEEQUFDgYQBREHDwgLCBMICwgPBxEFEAYOBQURBAcCFwgLCwgXAgcEEQUFDgYQBREHDwgLCBMICwgPBxEFEAYOBQURBAcCFwgLmiAuLiAgLS0gAXxbCQlbCSYRuBEmCVsJCVsJJhG4ESYJpggLCA8HEAYQBQ4GBhAEBgIXCAwMCBcCBgQQBgYOBRAGEAcPCAsIFAgLCA8HEAYQBQ4GBhAEBgIXCAwMCBcCBgQQBgYOBRAGEAcPCAsIFFctICAtLSAgLQAAAAADAAD/6QHRAdcAGAApAEgAAAE0Ji8BJiIPAQ4BHQEUFh8BFjI/AT4BPQEHNzQ2OwEyFg8BDgErASImNxcHDgErASImNTwBPwE+ATsBMhYPARQGFRQWOwEyFgcB0RYPnw8rD58PFhYPnw8rD58PFvsEBwcfBwUBBAEHBiAGBgJABAEHBh4VFgESAQcGIAYFARABBAQPBgUBATwRJglbCQlbCSYRuBEmCVsJCVsJJhG4AxgGBgYGGAYHBwaxGQYGFBMCBgNyBgYGBmkBAQEDAwcGAAAAAAIAAP/pAdEB1wAYACUAAAE0Ji8BJiIPAQ4BHQEUFh8BFjI/AT4BPQEHLgEnJjYXNhYHDgEHAdEWD58PKw+fDxYWD58PKw+fDxboEnkFBHUfIXEDBHoRATwRJglbCQlbCSYRuBEmCVsJCVsJJhG42y8+PzsoQkIoOz1BLgACAAD/6QHRAdcAGAAqAAABNCYvASYiDwEOAR0BFBYfARYyPwE+AT0BByImJwc3LgE1NDYzMhYVFAYjAdEWD58PKw+fDxYWD58PKw+fDxboCxQJRxkSFko0M0pKMwE8ESYJWwkJWwkmEbgRJglbCQlbCSYRuLEDAytBDicWKz09Kyo9AAAEAAD/6QHRAdcADAAZADIArQAAEzI2NTQmIyIGFRQWMzMyNjU0JiMiBhUUFjM3NCYvASYiDwEOAR0BFBYfARYyPwE+AT0BBxQGKwEOAQcXFhQHMQYiLwEOAQcOAQc1IgYjKgEnFS4BJy4BJwcGIicxJjQ/AS4BJyMiJj0BNDY7ATQ2NycmNDcxNjIfAT4BNy4BNTQ2NzU0NjsBFToBMzoBFzUzMhYdAR4BFRQGBx4BFzc2MhcxFhQPAR4BFTMyFh0B1wQHBwQFBwcFJQQHBwQFBwcF1RYPnw8rD58PFhYPnw8rD58PFmEGBTMBBgMqAwMDCQMpAgUCBBEKAwQCAgQBChEEAwYDKQMJAwMDKgMGATMEBwcEMgQCJQMDAwkDIgIDAgECEQ0GBQQCBAICBAEFBAYOEAIBAgQBIgMJAwMDJQIEMgUGAS4HBQQHBwQFBwcFBAcHBAUHDhEmCVsJCVsJJhG4ESYJWwkJWwkmEbhhBAcHDAYqAwkDAwMpAgMCEhgEIwEBIwQXEgEEAykDAwMJAyoGDAcHBAEFBgYMBSUDCQMDAyECAwIECgQQGgYRBAcXARgHBBEHGRAECgQCAwIhAwMDCQMlBQwGBgUBAAAAAA4AAP/pAdEB1wAIABEAGgAjACwANQA+AEcAUABZAGIAawCEAJcAAAEmBgcVNjIXNQc+ARcVJgYHNRU+ARcVJgYHNRU+ARcVJgYHNRcmBgc1PgEXFTUmBgc1PgEXFScuAQcVNjIXNQc2FhcVLgEHNRU2FhcVLgEHNRcuAQc1NhYXFTUuAQc1NhYXFSc1NhYXFS4BByU0Ji8BJiIPAQ4BHQEUFh8BFjI/AT4BPQEHJiIHPAE1NjIXNjIXHAEVJiIHAVAaMhYXNhVTESIREiIQESIREiIQESIREiIQRBIiEBEiERIiEBEiEWIWMhoVNxZTESMQECISESMQECISRBAiEhEjEBAiEhEjEEQRIxAQIhIBRRYPnw8rD58PFhYPnw8rD58PFuodRxwcRx0cRx0dRxwBJxAJD4kOBokPCAIFDAcFCA0YCAIFDAcECQ0YCAIFDAcECQ03BwQJDgcCBA0YBwQJDQgCBA1WDwkQiQYOiQEEAwcNCAUHDRgEAwcNCAUHDVsJBAYMBAIIDRgJBAYMBAIIDR4NBAIIDQgFB1sRJglbCQlbCSYRuBEmCVsJCVsJJhG4xRYWNFM1FhYWFjVTNBYWAAAACQAA/+kB0QHXACUAKgAvADQATwBoAHkAfgCDAAA3OQIyNjc+ATU5AjQmJzEuASM5AiIGBw4BFTkCFBYXHgEzNzMVIzUVMxUjNTUzFSM1BycOASM5AiImJwcOAR0BFBY7ATI2PQE0Jic3NCYvASYiDwEOAR0BFBYfARYyPwE+AT0BByMiJj0BNDY7ATIWHQEUBiMnMxUjNRUzFSM1swYKBAMFBQMECgYGCgQDBQUDBAoGS1ZWVlZWVhsgBAgEBAgEIAMDBgVWBQYDA+4WD58PKw+fDxYWD58PKw+fDxZ44QcJCQfhBwkJB1tWVlZW1wUEBQsHBgwEBAUFBAQMBgcLBQQFLQ8PVg4Ocg4OYBECAgICEQIEAwYEBgYEBgMEAnwRJglbCQlbCSYRuBEmCVsJCVsJJhG4uQkHmgcJCQeaBwlkDg4cDw8AAAQAAP/pAdEB1wAYAEMAbQB/AAABNCYvASYiDwEOAR0BFBYfARYyPwE+AT0BBxQGBw4BByoBIzkBIiYnLgE1IzEzNDY3OQE+ATM5AToBMx4BFx4BHQE5AScuAScqASM5ASIGBzEOARU5AhQWFx4BMzkBOgEzPgE3PgE1MDQxNCYnByImNTQ2NxcnPgEzMhYVFAYjAdEWD58PKw+fDxYWD58PKw+fDxYzHBcXPSMDBgImQRgZHQEBHRkYQSYDBgMjPBcXHFASMBsCBAIcNBMTFhYTEzMdAgQCGzASERUVEWUfKwMEQxoGDQceKyseATwRJglbCQlbCSYRuBEmCVsJCVsJJhG4XQstFhUiAyIWFzAJCjAXFiMEIhYWLQoBMBEdAhwSER0EBBwREhsCHBEQGgUBBBsQeSsfCBAHH0UDAisfHysAAAMAAP/pAdEB1wAYACUAPgAAATQmLwEmIg8BDgEdARQWHwEWMj8BPgE9AQMiJjU0NjceARUUBiM3FAYPAQYmPQE0Ji8BJjY7ATIWDwEOAR0BAdEWD58PKw+fDxYWD58PKw+fDxboCAoQAgERCwchBwUrBQcFBFMDAgXzBQIDUwQFATwRJglbCQlbCSYRuBEmCVsJCVsJJhG4/v8LBwsTDAwTCwcLYgUJAgoCBgVMBQwEUwMGBgNTBAwFOwAAAgAA/+kB0QHXABgAMgAAATQmLwEmIg8BDgEdARQWHwEWMj8BPgE9AQcnBwYmPwEnJjYzPwE2Fh8CHgEPARcWBicB0RYPnw8rD58PFhYPnw8rD58PFq87OgsSBBE0CgkLRRkFFwQZRQwGCTUQAxQIATwRJglbCQlbCSYRuBEmCVsJCVsJJhG40iUkBg4LQywIFgQ/DAELQAUBFwYsQwwNBwAAAAACAAD/6QHRAdcAGAA9AAABNCYvASYiDwEOAR0BFBYfARYyPwE+AT0BDwEGIi8BBwYiLwEmND8BJyY0PwE2Mh8BNzYyHwEWFA8BFxYUBwHRFg+fDysPnw8WFg+fDysPnw8WcQ8HFghDRAgWBw8HB0REBwcPBxYIREMIFgcPBwdERAcHATwRJglbCQlbCSYRuBEmCVsJCVsJJhG4xQ4ICENDCAgOCBYIQ0MIFggOCAhDQwgIDggWCENDCBYIAAIAAP/pAdEB1wAYACsAAAE0Ji8BJiIPAQ4BHQEUFh8BFjI/AT4BPQEFJyY0PwE2Mh8BNzYyHwEWFA8BAdEWD58PKw+fDxYWD58PKw+fDxb/AGEICAoHFgczYggVBwoICJABPBEmCVsJCVsJJhG4ESYJWwkJWwkmEbi/YgcVCAoICDNhCAgKBxUIkAAABwAA/+kB0QHXAAoAFQAaAB8AJAA9AE4AAAE1NCYrASIGHQEzBxUUFjsBMjY9ASMXIzUzFTMjNTMVMyM1MxU3NCYvASYiDwEOAR0BFBYfARYyPwE+AT0BByMiJj0BNDY7ATIWHQEUBiMBWQUD0QMF4eEFA9EDBeEgEBAgEBAhERH4Fg+fDysPnw8WFg+fDysPnw8WgNEJDw8J0QoODgoBEBgDBQUDGDBIAwUFA0hAICAgICAgnBEmCVsJCVsJJhG4ESYJWwkJWwkmEbi8DgqQCg4OCpAKDgAABwAA/+kB0QHXABgAKQAuADMAOAA9AEIAAAE0Ji8BJiIPAQ4BHQEUFh8BFjI/AT4BPQEHIyImPQE0NjsBMhYdARQGIycjFTM1BzMVIzUXIzUzFTUjNTMVJzUzFSMB0RYPnw8rD58PFhYPnw8rD58PFojBCg4OCsEKDg4KCLGxkXFxcXFxcXFxcXEBPBEmCVsJCVsJJhG4ESYJWwkJWwkmEbjdDgrSCg4OCtIKDuLCwjEQEHAQECAQECAQEAADAAD/6QHRAdcADAAlAD4AACU0JiMiBhUUFjMyNjU3NCYvASYiDwEOAR0BFBYfARYyPwE+AT0BDwEGIi8BDgEjIiY1NDYzMhYVFAYHFxYUBwEVKh4dKiodHiq8Fg+fDysPnw8WFg+fDysPnw8WbQIEDQRFDB4RKTs7KSo7CglFBAT7HikpHh4qKh5BESYJWwkJWwkmEbgRJglbCQlbCSYRuNUCBARFCQs7Kio6OioQHgxFBA0EAAAAAQAA/+kB0QHXABgAAAEnJiIPAQ4BHQEUFh8BFjI/AT4BPQE0JicBrJ8PKw+fDxYWD58PKw+fDxYWDwF8WwkJWwkmEbgRJglbCQlbCSYRuBEmCQAAAv/+AGsB0wFVABAAIQAAJSEiJj0BNDYzITIWHQEUBiMnNCYrASIGHQEUFjsBMjY9AQG2/mUMEREMAZsMEREM9AgFgwUICAWDBQhrEQuyCxERC7ILEbYFCAgFggYHBwaCAAAAAAL//gBrAdMBVQAQACEAACc1NDYzITIWHQEUBiMhIiY1JRQWOwEyNj0BNCYrASIGHQECEQwBmwwREQz+ZQwRAREIBYMFCAgFgwUIh7ILERELsgsREQsYBgcHBoIFCAgFggAAAAAEAAD/6QHRAdcADwAbADQASAAANzQmIyIGFRQWFwczJz4BNTc1NCYjIgYdATYyFzc0Ji8BJiIPAQ4BHQEUFh8BFjI/AT4BPQEHBiInNT4BNzU0NjMyFh0BHgEXFfsLBwgLBAMHJQcDBCQgFhcgGzcbshYPnw8rD58PFhYPnw8rD58PFo0sXywECgQrHx4rBAoEuwgLCwgEBwMpKQMHBDErFyAgFysGBlARJglbCQlbCSYRuBEmCVsJCVsJJhG4yhISbgIDAjAeKyseMAIDAm4ADAATAAsBvwG/AA4AHQAvAEEAUwBlAHQAiQCbAK0AvwDRAAATIiY9ATQ2MzIWHQEUBiMRIiY9ATQ2MzIWHQEUBiMDIiYvASY2NzYWHwEWBgcOASMTIiYvASY2NzYWHwEWBgcOASMnIiYvAS4BNz4BHwEeAQcOASMFKgEvAS4BNz4BHwEeAQcOASMlIyImNTQ2OwEyFhUUBiMlOAExIyImNTQ2MzgBMTMyFhUUBiMFIiYnJjY/ATYWFxYGDwEOASMlIiYnJjY/ATYWFxYGDwEOASMHIiYnLgE/AT4BFx4BDwEOASMTIiYnLgE/AT4BFx4BDwEOASPtCw8PCwsPDwsHCQkHBwoKBzsGDAMoBQYICRQFJwYGCQIHA54EBwIoAwQFBQwDJwMDBQIEAckDBgNECAUFBRIIRAkFBQMLBgERAgMCRAUDAwMKBUQFAwMCBgP+308IDQ0ITwkMDAkBO08FCAgFTwUICAX+kQUKAgQEB0QHEAQEBAdEAwUCARADBgIDAwVEBQoDAwMFRAIDAsgDBAIHBAQoAw8GBwMDKAIJBJ0CAwEFAwMnAwoFBQMDJwIGBAE8DwtPCw8PC08LD/7PCQdPBwkJB08HCQEjBgZECRQFBQYIRAkUBQIB/vkEA0QGDAMDBAVEBQwDAQHdAgEnBRMICAUFJwUSCAYGkwEoAgsFBAMDJwMKBQMDWgwJCQwMCQkMCAgFBQgIBQUIaQUFBxAEJwQEBwcQBCcCAaQDAwULAigCAgUFCgMnAQHqAQEEDgdEBgQEAw8GRAUEARUBAQMKBUQFAgIDCgVEAwQAAAABAAAAEAIAAaAABQAAAQcnBxcBAbDwcFDAAUABoPBwUMABQAABAAH/4QH/Ad8AVAAAJTgBMSc3OAExPgE3NiYvAS4BBw4BBzgBMQcnOAExLgEnJgYPAQ4BFx4BFzgBMRcHOAExDgEHBhYfAR4BNz4BNzgBMTcXOAExHgEXFjY/AT4BJy4BJwH7m5sCAQECAgRJAwoEAgICm5sCAgIECgNJBAICAQECm5sCAQECAgRJAwoEAgICm5sCAgIECgNJBAICAQECRZubAgICBAoDSQQCAgEBApubAgEBAgIESQMKBAICApubAgICBAoDSQQCAgEBApubAgEBAgIESQMKBAICAgAAAAIAAP/sAfQB4AAmADMAACUnLgEHPgE1NCYnLgEjIgYHDgEVFBYXHgEzMjY3BhYfAR4BNzYmJyUiJjU0NjMyFhUUBiMB8HkKEwgWGB4aGkYoKEYaGh4eGhpGKCQ/GgEICWcNJg0NAg/+0DVLSzU1S0s1LGcJCAEaPyQoRhoaHh4aGkYoKEYaGh4YFggTCnkPAg0NJg10SzU1S0s1NUsAAAADAAD/4AIAAeAADAASABcAAAEyFhUUBg8BJzc+ATMBBzcBJwElByc3FwGwIS8ICCBwIAoYDv5wIJABKHD+2AFG4BzgHAHgLyEOGAogcCAICP6QkCABKHD+2LrgHOAcAAAHAED/4AHAAeAACgAPACEAMgA3ADwAQQAAASEiBh0BITU0JiMnFyM3MzcjIgYPAQYWOwEyNi8BLgEjMRchIgYXEx4BOwEyNjcTNiYjAyMnMxUzIzUzFTMjNTMHAZD+4BQcAYAcFFQHhgd4BIAKEAEKAQwKoAoMAQoBEApY/tANEQEaARUN8A0VARoBEQ3YMBBAYEBAUDBAEAGgHBQQEBQcIDIyIA4KQwoNDQpDCg6gEw3+4A0TEw0BIA0T/uDg4ODg4OAAAwAA/+ACAAHgABgAMQBQAAAlFAYHDgEjIiYnLgE1NDY3PgEzMhYXHgEVIRQWFx4BMzI2Nz4BNTQmJy4BIyIGBw4BFTcXFhQHBiIvARUUBiMiJj0BBwYiJy4BNTQ2PwE2MhcCACgjI101NV0jIygoIyNdNTVdIyMo/jAhHBxMKytMHBwhIRwcTCsrTBwcIeeACQkKGgpJEw0NE0kKGgoEBQUEgAoaCuA1XSMjKCgjI101NV0jIygoIyNdNStMHBwhIRwcTCsrTBwcISEcHEwrl4AKGgoJCUqzDRMTDbNKCQkFDAYGDAWACQkAAAADAAD/4AIAAeAAGAAxAFAAACU0JicuASMiBgcOARUUFhceATMyNjc+ATUhNDY3PgEzMhYXHgEVFAYHDgEjIiYnLgE1Fzc2NCcmIg8BNTQmIyIGHQEnJiIHDgEVFBYfARYyNwIAKCMjXTU1XSMjKCgjI101NV0jIyj+MCEcHEwrK0wcHCEhHBxMKytMHBwh54AJCQoaCkkTDQ0TSQoaCgQFBQSAChoK4DVdIyMoKCMjXTU1XSMjKCgjI101K0wcHCEhHBxMKytMHBwhIRwcTCuXgAoaCgkJSrMNExMNs0oJCQUMBgYMBYAJCQAAAAMAAP/gAgAB4AAYADEAUAAAATIWFx4BFRQGBw4BIyImJy4BNTQ2Nz4BMxEyNjc+ATU0JicuASMiBgcOARUUFhceATMnNzYyFxYUDwEzMhYVFAYrARcWFAcOASMiJi8BJjQ3AQA1XSMjKCgjI101NV0jIygoIyNdNStMHBwhIRwcTCsrTBwcISEcHEwrl4AKGgoJCUqzDRMTDbNKCQkFDAYGDAWACQkB4CgjI101NV0jIygoIyNdNTVdIyMo/jAhHBxMKytMHBwhIRwcTCsrTBwcIeeACQkKGgpJEw0NE0kKGgoEBQUEgAoaCgAAAwAA/+ACAAHgABgAMQBQAAABIgYHDgEVFBYXHgEzMjY3PgE1NCYnLgEjESImJy4BNTQ2Nz4BMzIWFx4BFRQGBw4BIzcnJiIHBhQfASMiBhUUFjsBBwYUFx4BMzI2PwE2NCcBADVdIyMoKCMjXTU1XSMjKCgjI101K0wcHCEhHBxMKytMHBwhIRwcTCuXgAoaCgkJSrMNExMNs0oJCQUMBgYMBYAJCQHgKCMjXTU1XSMjKCgjI101NV0jIyj+MCEcHEwrK0wcHCEhHBxMKytMHBwh54AJCQoaCkkTDQ0TSQoaCgQFBQSAChoKAAADAAD/4AIAAeAAGAAxAD4AAAUiJicuATU0Njc+ATMyFhceARUUBgcOASMRIgYHDgEVFBYXHgEzMjY3PgE1NCYnLgEjEyM1IzUzNTMVMxUjFQEANV0jIygoIyNdNTVdIyMoKCMjXTUoRhoaHh4aGkYoKEYaGh4eGhpGKCBAYGBAYGAgKCMjXTU1XSMjKCgjI101NV0jIygBwB4aGkYoKEYaGh4eGhpGKChGGhoe/sBgQGBgQGAAAAAAAwAA/+ACAAHgABgAMQA2AAABIgYHDgEVFBYXHgEzMjY3PgE1NCYnLgEjESImJy4BNTQ2Nz4BMzIWFx4BFRQGBw4BIychNSEVAQA1XSMjKCgjI101NV0jIygoIyNdNShGGhoeHhoaRigoRhoaHh4aGkYogAEA/wAB4CgjI101NV0jIygoIyNdNTVdIyMo/kAeGhpGKChGGhoeHhoaRigoRhoaHqBAQAAAAwAwABABwAGgAGAAbQB6AAAlIw4BBxcWFA8BBiIvAQ4BBxUUBisBIiY9AS4BJwcGIi8BJjQ/AS4BJyMiJj0BNDY7AT4BNycmND8BNjIfAT4BNzU0NjsBMhYdAR4BFzc2Mh8BFhQPAR4BFzMyFh0BFAYjJyIGFRQWMzI2NTQmIxUiJjU0NjMyFhUUBiMBoBUDBwUUCQkMCRsJFAgSCRMNEA0TCRIIFAkbCQwJCRQFBwMVDRMTDRUCCAQTCQkMCRsJEwgSChMNEA0TChIIEwkbCQwJCRMECAIVDRMTDaglMzMlJTMzJREXFxERFxcRrwkSCBQJGwkMCQkUBQcCFQ0TEw0VAgcFFAkJDAkbCRQIEgkTDRANEwkSCBMJGwkMCQkTBQgCFg0TEw0WAggFEwkJDAkbCRMIEgkTDRANE4A0JSQ0NCQlNIAYERAYGBARGAAABAAA/+ACAAHgABgAMQA2ADsAAAUiJicuATU0Njc+ATMyFhceARUUBgcOASMRIgYHDgEVFBYXHgEzMjY3PgE1NCYnLgEjAzMVIzU1MxUjNQEANV0jIygoIyNdNTVdIyMoKCMjXTUoRhoaHh4aGkYoKEYaGh4eGhpGKCBAQEBAICgjI101NV0jIygoIyNdNTVdIyMoAcAeGhpGKChGGhoeHhoaRigoRhoaHv8AQEDAoKAAAAAAAwAA/+ACAAHgABgAJgA0AAAFIiYnLgE1NDY3PgEzMhYXHgEVFAYHDgEjAxQWFwEuASMiBgcOARUlAR4BMzI2Nz4BNTQmJwEANV0jIygoIyNdNTVdIyMoKCMjXTXAExEBCxg4HyhGGhoeAVz+9Rg4HyhGGhoeExEgKCMjXTU1XSMjKCgjI101NV0jIygBAB84GAELERMeGhpGKG/+9RETHhoaRigfOBgAAQAf//8B4QHBAAkAAAEXMwcXJwc3JzMBAD2khjCLizCGpAHBrGWxamqxZQACAB///wHhAcEACgAVAAABIycHIxcHNxcnNw8BNycXNxc3BxcnAeGkPT2khjCLizCG4U0gSVocHFpJIE0BFaysZbFqarFlekBbOwJnZwI7W0AAAAADAAD/4AIAAeAAGAAxAD4AADcuATU0Njc+ATMyFhceARUUBgcOASMiJicBLgEjIgYHDgEVFBYXHgEzMjY3PgE1NCYnByc3JzcXNxcHFwcnB0smJSUmJV8xMV8lJiUlJiVfMTFfJQE9HEclJUccHBwcHBxHJSVHHBwcHBzMLURELURELURELUREKyVfMTFfJSYlJSYlXzExXyUmJSUmAT0cHBwcHEclJUccHBwcHBxHJSVHHPktREQtREQtREQtREQAAAAABgAV//QB6wHLABgAJwA2AEUAUgBhAAATIgYHDgEXFBYXHgEzPgE3PgEnNCYnLgEHFTIWFwcuASMiBgcnPgE3AwcuASc0NjcXDgEVFBYXFyImJzceATMyNjcXDgEHJyImNTQ2MzIWFRQGIzc+ATU0Jic3HgEXFAYHJ/0xVSAfJAEmISBWMTFVIB8kASYhIFYxGzEWIA4gEREgDiAVLhl+NQoMAQwLNQcHBweEGzEWIA4gEREgDiAVLhkDL0JCLy9CQi+BBwcHBzUKDAEMCzUByyYhIFYxMVUgHyQBJiEgVjExVSAfJAEeDAs1BwcHBzUKDAH+9B8ULhkbMRYgDiARESAOjgwLNQcHBwc1CgwBXEIvL0JCLy9CMg4gEREgDiAVLhkbMRYgAAACABoAJQHrAZ0AMQA6AAABDgEHDgEHDgEXHgExIxcwNjc+ATc2FgcOAQcOATE4ATEHFzAWFxY2Nz4BNz4BNTYmBwEUFjc+ATEnFQHfBItUU4sDBgEGCFoBOlc0NVgBAwUCAUAlJj4LD3kGBgwCARcNDhcCCAb+1gQEBURRAZ0CMR0dMgECBwMDJBdAJidAAQMGAgFEKSlDDQhBBAMFBwRjOzpiAwYHAv6MBQIDBD4qaAAAAAABAAAAATMznD4vwF8PPPUACwIAAAAAANDiLQoAAAAA0OItCv/+/+ACAAHgAAAACAACAAAAAAAAAAEAAAHg/+AAAAIA//7//gIAAAEAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAQAAAAHRAAAB0QAAAdEAAAHRAAAB0QAAAdEAAAHRAAAB0QAAAdEAAAHRAAAB0QAAAdEAAAHRAAAB0QAAAdEAAAHRAAAB0QAAAdEAAAHRAAAB0QAAAdEAAAHRAAAB0QAAAdEAAAHRAAAB0QAAAdEAAAHRAAAB0QAAAdEAAAHRAAAB0QAAAdEAAAHRAAAB0QAAAdEAAAHRAAAB0f/+AdH//gHRAAAB0QATAgAAAAIAAAECAAAAAgAAAAIAAEACAAAAAgAAAAIAAAACAAAAAgAAAAIAAAACAAAwAgAAAAIAAAACAAAfAgAAHwIAAAACAAAVAgAAGgAAAAAACgAUAB4AegDeAVAB6gI6AqoDEgN6A/gEZgSuBP4FVgXGBp4HXge4CCQIjAkqCeYKogsMC0oLjAx0DVYN+g6cDvoPTA+qD/AQXBC6ERYRQBFyEaQSDBM8E04TvhQOFD4UoBUWFYwWAhZ4FtQXKBfQGCoYfhiUGL4ZIBm0Gg4AAAABAAAAQADSAA4AAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAFAD2AAEAAAAAAAAASgAWAAEAAAAAAAEAFgAAAAEAAAAAAAIADgEZAAEAAAAAAAMAFgDiAAEAAAAAAAQAFgEnAAEAAAAAAAUAFgDMAAEAAAAAAAYACwD4AAEAAAAAAAoANAE9AAEAAAAAAAsANgCWAAEAAAAAAAwANgBgAAMAAQQJAAAASgAWAAMAAQQJAAEAFgAAAAMAAQQJAAIADgEZAAMAAQQJAAMAFgDiAAMAAQQJAAQAFgEnAAMAAQQJAAUAFgDMAAMAAQQJAAYAFgEDAAMAAQQJAAoANAE9AAMAAQQJAAsANgCWAAMAAQQJAAwANgBgAGcAcgBhAHYAaQB0AHkAZgBvAG4AdABDAG8AcAB5AHIAaQBnAGgAdAAgADIAMAAxADQALQAyADAAMQA1ACAAUgBvAGMAawBlAHQAZwBlAG4AaQB1AHMAIABJAG4AYwAuAGgAdAB0AHAAOgAvAC8AdwB3AHcALgByAG8AYwBrAGUAdABnAGUAbgBpAHUAcwAuAGMAbwBtAGgAdAB0AHAAOgAvAC8AdwB3AHcALgBnAHIAYQB2AGkAdAB5AGYAbwByAG0AcwAuAGMAbwBtAFYAZQByAHMAaQBvAG4AIAAxAC4AMgBnAHIAYQB2AGkAdAB5AGYAbwBuAHRncmF2aXR5Zm9udABnAHIAYQB2AGkAdAB5AGYAbwBuAHQAUgBlAGcAdQBsAGEAcgBnAHIAYQB2AGkAdAB5AGYAbwBuAHQARgBvAG4AdAAgAGcAZQBuAGUAcgBhAHQAZQBkACAAYgB5ACAASQBjAG8ATQBvAG8AbgAuAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA) format('woff'); + font-weight: normal; + font-style: normal; +} + +[class^="gficon-"], [class*=" gficon-"] { + font-family: 'gravityfont'; + speak: none; + font-style: normal; + font-weight: normal; + font-variant: normal; + text-transform: none; + line-height: 1; + + /* Better Font Rendering =========== */ + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +.gficon-gravityforms-locked-icon:before { + content: "\e627"; +} + +.gficon-gravityforms-logo-icon:before { + content: "\e60c"; +} + +.gficon-gravitycharge-logo-icon:before { + content: "\e600"; +} + +.gficon-gravityforms-rocket-icon:before { + content: "\e614"; +} + +.gficon-gravityforms-form-icon:before { + content: "\e60b"; +} + +.gficon-gravityforms-css-alt-con:before { + content: "\e60e"; +} + +.gficon-gravityforms-markup-icon:before { + content: "\e60d"; +} + +.gficon-gravityforms-key-icon:before { + content: "\e610"; +} + +.gficon-gravityforms-upload-icon:before { + content: "\e612"; +} + +.gficon-gravityforms-download-icon:before { + content: "\e611"; +} + +.gficon-gravityforms-filter-icon:before { + content: "\e61d"; +} + +.gficon-gravityforms-settings-icon:before { + content: "\e615"; +} + +.gficon-gravityforms-eye-icon:before { + content: "\e61c"; +} + +.gficon-gravityforms-star-icon:before { + content: "\e61e"; +} + +.gficon-gravityforms-cross-icon:before { + content: "\e61f"; +} + +.gficon-gravityforms-tick-icon:before { + content: "\e620"; +} + +.gficon-gravityforms-credit-icon:before { + content: "\e621"; +} + +.gficon-gravityforms-file-icon:before { + content: "\e622"; +} + +.gficon-gravityforms-search-icon:before { + content: "\e623"; +} + +.gficon-gravityforms-bullet-icon:before { + content: "\e624"; +} + +.gficon-gravityforms-bug-icon:before { + content: "\e619"; +} + +.gficon-gravityforms-docs-icon:before { + content: "\e61a"; +} + +.gficon-gravityforms-vcard-icon:before { + content: "\e61b"; +} + +.gficon-gravityforms-info-icon:before { + content: "\e616"; +} + +.gficon-gravityforms-favorite-icon:before { + content: "\e617"; +} + +.gficon-gravityforms-chat-icon:before { + content: "\e618"; +} + +.gficon-gravityforms-zero-icon:before { + content: "\e601"; +} + +.gficon-gravityforms-nine-icon:before { + content: "\e602"; +} + +.gficon-gravityforms-eight-icon:before { + content: "\e603"; +} + +.gficon-gravityforms-seven-icon:before { + content: "\e604"; +} + +.gficon-gravityforms-six-icon:before { + content: "\e605"; +} + +.gficon-gravityforms-five-icon:before { + content: "\e606"; +} + +.gficon-gravityforms-four-icon:before { + content: "\e607"; +} + +.gficon-gravityforms-three-con:before { + content: "\e608"; +} + +.gficon-gravityforms-two-icon:before { + content: "\e609"; +} + +.gficon-gravityforms-one-icon:before { + content: "\e60a"; +} + +.gficon-gravityforms-css-icon:before { + content: "\e60f"; +} + +.gficon-gravityforms-dollar-icon:before { + content: "\e613"; +} + +.gficon-gravityforms-slideoff-icon:before { + content: "\e625"; +} + +.gficon-gravityforms-slideon-icon:before { + content: "\e626"; +} + +.gficon-settings-cog:before { + content: "\e634"; +} + +.gficon-gravityforms-spinner-icon:before { + content: "\e628"; +} + +.gficon-tick:before { + content: "\e629"; +} + +.gficon-cross:before { + content: "\e62a"; +} + +.gficon-search:before { + content: "\e62b"; +} + +.gficon-pencil:before { + content: "\e62c"; +} + +.gficon-exclamation:before { + content: "\e635"; +} + +.gficon-forbid:before { + content: "\e636"; +} + +.gficon-star:before { + content: "\e639"; +} + +.gficon-star-hollow:before { + content: "\e63a"; +} + +.gficon-trash:before { + content: "\e62d"; +} + +.gficon-arrow-up:before { + content: "\e62e"; +} + +.gficon-arrow-down:before { + content: "\e62f"; +} + +.gficon-arrow-left:before { + content: "\e630"; +} + +.gficon-arrow-right:before { + content: "\e631"; +} + +.gficon-add:before { + content: "\e632"; +} + +.gficon-subtract:before { + content: "\e633"; +} + +.gficon-close:before { + content: "\e63b"; +} + +.gficon-support:before { + content: "\e63c"; +} + +.gficon-send:before { + content: "\e63d"; +} + +/* star on */ +.gficon-star1:before { + content: "\e639"; + color: #FF9800; + font-size: 1.2em; + margin-top: 0.188em; +} + +/* star off */ +.gficon-star0:before { + content: "\e63a"; + color: #CCC; + font-size: 1.2em; + margin-top: 0.188em; +} + +/* credit card warning */ +.gfield_creditcard_warning_message .gficon-forbid { + color: #9C0F17 !important; + margin-right: 1em; +} + +/* increase sizes */ +.gficon-2x { + font-size: 2em; +} + +.gficon-3x { + font-size: 3em; +} + +/* animations */ + +@keyframes rotation { + 0% { + transform: rotate(0); + } + 100% { + transform: rotate(360deg); + } + } + + @-webkit-keyframes rotation { + 0% { + -webkit-transform: rotate(0); + } + 100% { + -webkit-transform: rotate(360deg); + } + } + + @-moz-keyframes rotation { + 0% { + -moz-transform: rotate(0); + } + 100% { + -moz-transform: rotate(360deg); + } + } + +.gficon-spin { + display: inline-block; + animation: rotation 2s linear infinite; + -webkit-animation: rotation 2s linear infinite; + -moz-animation: rotation 2s linear infinite; + text-shadow: 0px 0px 2px rgba(255, 255, 255, 0.2); + margin-left: 2px; + +} + +.gficon-gravityforms-spinner-icon.gficon-spin { + color: #D54E21; + font-size: 1.50em; +} \ No newline at end of file diff --git a/css/index.php b/css/index.php new file mode 100644 index 0000000..12c197f --- /dev/null +++ b/css/index.php @@ -0,0 +1,2 @@ + div { + margin-bottom: 10px; } +.gf-edit-shortcode-form .field-block label { + display: block; + margin-bottom: 5px; } +.gf-edit-shortcode-form .field-inline { + padding-top: 10px; } +.gf-edit-shortcode-form .field-inline label { + display: inline-block; } + + +.gf-edit-shortcode-form-standard-attrs div{ + display: inline; + margin-right:15px; +} +#gf-edit-shortcode-form-advanced-attrs div{ + margin-bottom:5px; +} + +#gf-edit-shortcode-form-advanced-attrs{ + margin-left:15px; +} + +#TB_ajaxContent { + height:92%!important; +} diff --git a/css/tooltip.css b/css/tooltip.css index ffc1dea..fd6bb87 100644 --- a/css/tooltip.css +++ b/css/tooltip.css @@ -43,7 +43,7 @@ a.tooltip_bottomleft:hover { .ui-tooltip { padding: 18px; position: absolute; - z-index: 9999; + z-index: 9999999; max-width: 300px;color: #000; text-shadow: 1px 1px 1px #fff; font-size: 1.0em; diff --git a/currency.php b/currency.php index 93da3f9..e8b7eb8 100644 --- a/currency.php +++ b/currency.php @@ -1,130 +1,142 @@ currency = $currency; - else - $this->currency = self::get_currency($currency); - } - - public function to_number($text){ - $text = strval($text); - - if(is_numeric($text)) - return floatval($text); - - //Making sure symbol is in unicode format (i.e. ᅜ) - $text = preg_replace("/&.*?;/", "", $text); - - //Removing symbol from text - $text = str_replace($this->currency["symbol_right"], "", $text); - $text = str_replace($this->currency["symbol_left"], "", $text); - - - //Removing all non-numeric characters - $array = str_split($text); - $is_negative = false; - $clean_number = ""; - foreach($array as $char){ - - if (($char >= '0' && $char <= '9') || $char == $this->currency["decimal_separator"]) - $clean_number .= $char; - else if($char == '-') - $is_negative = true; - } - - $decimal_separator = $this->currency && $this->currency["decimal_separator"] ? $this->currency["decimal_separator"] : "."; - - //Removing thousand separators but keeping decimal point - $array = str_split($clean_number); - $float_number = ""; - for($i=0, $count = sizeof($array); $i<$count; $i++) - { - $char = $array[$i]; - - if ($char >= '0' && $char <= '9') - $float_number .= $char; - else if($char == $decimal_separator) - $float_number .= "."; - } - - if($is_negative) - $float_number = "-" . $float_number; - - return is_numeric($float_number) ? floatval($float_number) : false; - } - - public function to_money($number, $do_encode=false){ - - if(!is_numeric($number)) - $number = $this->to_number($number); - - if($number === false) - return ""; - - $negative = ""; - if(strpos(strval($number), "-") !== false){ - $negative = "-"; - $number = floatval(substr($number,1)); - } - - $money = number_format($number, $this->currency["decimals"], $this->currency["decimal_separator"], $this->currency["thousand_separator"]); - $symbol_left = !empty($this->currency["symbol_left"]) ? $this->currency["symbol_left"] . $this->currency["symbol_padding"] : ""; - $symbol_right = !empty($this->currency["symbol_right"]) ? $this->currency["symbol_padding"] . $this->currency["symbol_right"] : ""; - - if($do_encode){ - $symbol_left = html_entity_decode($symbol_left); - $symbol_right = html_entity_decode($symbol_right); - } - - return $negative . $symbol_left . $money . $symbol_right; - } - - public static function get_currency($code){ - $currencies = self::get_currencies(); - return $currencies[$code]; - } - - public static function get_currencies(){ - $currencies = array( - "AUD" => array("name" => __("Australian Dollar", "gravityforms"), "symbol_left" => '$', "symbol_right" => "", "symbol_padding" => " ", "thousand_separator" => ',', "decimal_separator" => '.', "decimals" => 2), - "BRL" => array("name" => __("Brazilian Real", "gravityforms"), "symbol_left" => 'R$', "symbol_right" => "", "symbol_padding" => " ", "thousand_separator" => '.', "decimal_separator" => ',', "decimals" => 2), - "CAD" => array("name" => __("Canadian Dollar", "gravityforms"), "symbol_left" => '$', "symbol_right" => "CAD", "symbol_padding" => " ", "thousand_separator" => ',', "decimal_separator" => '.', "decimals" => 2), - "CZK" => array("name" => __("Czech Koruna", "gravityforms"), "symbol_left" => '', "symbol_right" => "Kč", "symbol_padding" => " ", "thousand_separator" => ' ', "decimal_separator" => ',', "decimals" => 2), - "DKK" => array("name" => __("Danish Krone", "gravityforms"), "symbol_left" => '', "symbol_right" => "kr.", "symbol_padding" => " ", "thousand_separator" => '.', "decimal_separator" => ',', "decimals" => 2), - "EUR" => array("name" => __("Euro", "gravityforms"), "symbol_left" => '', "symbol_right" => "€", "symbol_padding" => " ", "thousand_separator" => '.', "decimal_separator" => ',', "decimals" => 2), - "HKD" => array("name" => __("Hong Kong Dollar", "gravityforms"), "symbol_left" => 'HK$', "symbol_right" => "", "symbol_padding" => "", "thousand_separator" => ',', "decimal_separator" => '.', "decimals" => 2), - "HUF" => array("name" => __("Hungarian Forint", "gravityforms"), "symbol_left" => '', "symbol_right" => "Ft", "symbol_padding" => " ", "thousand_separator" => '.', "decimal_separator" => ',', "decimals" => 2), - "ILS" => array("name" => __("Israeli New Sheqel", "gravityforms"), "symbol_left" => '₪', "symbol_right" => "", "symbol_padding" => " ", "thousand_separator" => ',', "decimal_separator" => '.', "decimals" => 2), - "JPY" => array("name" => __("Japanese Yen", "gravityforms"), "symbol_left" => '¥', "symbol_right" => "", "symbol_padding" => " ", "thousand_separator" => ',', "decimal_separator" => '', "decimals" => 0), - "MYR" => array("name" => __("Malaysian Ringgit", "gravityforms"), "symbol_left" => 'RM', "symbol_right" => "", "symbol_padding" => " ", "thousand_separator" => ',', "decimal_separator" => '.', "decimals" => 2), - "MXN" => array("name" => __("Mexican Peso", "gravityforms"), "symbol_left" => '$', "symbol_right" => "", "symbol_padding" => " ", "thousand_separator" => ',', "decimal_separator" => '.', "decimals" => 2), - "NOK" => array("name" => __("Norwegian Krone", "gravityforms"), "symbol_left" => 'Kr', "symbol_right" => "", "symbol_padding" => " ", "thousand_separator" => '.', "decimal_separator" => ',', "decimals" => 2), - "NZD" => array("name" => __("New Zealand Dollar", "gravityforms"), "symbol_left" => '$', "symbol_right" => "", "symbol_padding" => " ", "thousand_separator" => ',', "decimal_separator" => '.', "decimals" => 2), - "PHP" => array("name" => __("Philippine Peso", "gravityforms"), "symbol_left" => 'Php', "symbol_right" => "", "symbol_padding" => " ", "thousand_separator" => ',', "decimal_separator" => '.', "decimals" => 2), - "PLN" => array("name" => __("Polish Zloty", "gravityforms"), "symbol_left" => 'zł', "symbol_right" => "", "symbol_padding" => " ", "thousand_separator" => '.', "decimal_separator" => ',', "decimals" => 2), - "GBP" => array("name" => __("Pound Sterling", "gravityforms"), "symbol_left" => '£', "symbol_right" => "", "symbol_padding" => " ", "thousand_separator" => ',', "decimal_separator" => '.', "decimals" => 2), - "SGD" => array("name" => __("Singapore Dollar", "gravityforms"), "symbol_left" => '$', "symbol_right" => "", "symbol_padding" => " ", "thousand_separator" => ',', "decimal_separator" => '.', "decimals" => 2), - "ZAR" => array("name" => __("South African Rand", "gravityforms"), "symbol_left" => 'R', "symbol_right" => "", "symbol_padding" => "", "thousand_separator" => ',', "decimal_separator" => '.', "decimals" => 2), - "SEK" => array("name" => __("Swedish Krona", "gravityforms"), "symbol_left" => '', "symbol_right" => "Kr", "symbol_padding" => " ", "thousand_separator" => ' ', "decimal_separator" => ',', "decimals" => 2), - "CHF" => array("name" => __("Swiss Franc", "gravityforms"), "symbol_left" => 'Fr.', "symbol_right" => "", "symbol_padding" => " ", "thousand_separator" => "'", "decimal_separator" => '.', "decimals" => 2), - "TWD" => array("name" => __("Taiwan New Dollar", "gravityforms"), "symbol_left" => '$', "symbol_right" => "", "symbol_padding" => " ", "thousand_separator" => ',', "decimal_separator" => '.', "decimals" => 2), - "THB" => array("name" => __("Thai Baht", "gravityforms"), "symbol_left" => '฿', "symbol_right" => "", "symbol_padding" => " ", "thousand_separator" => ',', "decimal_separator" => '.', "decimals" => 2), - "USD" => array("name" => __("U.S. Dollar", "gravityforms"), "symbol_left" => '$', "symbol_right" => "", "symbol_padding" => "", "thousand_separator" => ',', "decimal_separator" => '.', "decimals" => 2) - - ); - - return apply_filters("gform_currencies", $currencies); - } -} +if ( ! class_exists( 'RGCurrency' ) ) { + + class RGCurrency { + private $currency; + + public function __construct( $currency ) { + if ( is_array( $currency ) ) { + $this->currency = $currency; + } else { + $this->currency = self::get_currency( $currency ); + } + } + + public function to_number( $text ) { + $text = strval( $text ); + + if ( is_numeric( $text ) ) { + return floatval( $text ); + } + + //Making sure symbol is in unicode format (i.e. ᅜ) + $text = preg_replace( '/&.*?;/', '', $text ); + + //Removing symbol from text + $text = str_replace( $this->currency['symbol_right'], '', $text ); + $text = str_replace( $this->currency['symbol_left'], '', $text ); + + + //Removing all non-numeric characters + $array = str_split( $text ); + $is_negative = false; + $clean_number = ''; + foreach ( $array as $char ) { + + if ( ( $char >= '0' && $char <= '9' ) || $char == $this->currency['decimal_separator'] ) { + $clean_number .= $char; + } else if ( $char == '-' ) { + $is_negative = true; + } + } + + $decimal_separator = $this->currency && $this->currency['decimal_separator'] ? $this->currency['decimal_separator'] : '.'; + + //Removing thousand separators but keeping decimal point + $array = str_split( $clean_number ); + $float_number = ''; + for ( $i = 0, $count = sizeof( $array ); $i < $count; $i ++ ) { + $char = $array[ $i ]; + + if ( $char >= '0' && $char <= '9' ) { + $float_number .= $char; + } else if ( $char == $decimal_separator ) { + $float_number .= '.'; + } + } + + if ( $is_negative ) { + $float_number = '-' . $float_number; + } + + return is_numeric( $float_number ) ? floatval( $float_number ) : false; + } + + public function to_money( $number, $do_encode = false ) { + + if ( ! is_numeric( $number ) ) { + $number = $this->to_number( $number ); + } + + if ( $number === false ) { + return ''; + } + + $negative = ''; + if ( strpos( strval( $number ), '-' ) !== false ) { + $negative = '-'; + $number = floatval( substr( $number, 1 ) ); + } + + $money = number_format( $number, $this->currency['decimals'], $this->currency['decimal_separator'], $this->currency['thousand_separator'] ); + + if ( $money == '0.00' ){ + $negative = ''; + } + + $symbol_left = ! empty( $this->currency['symbol_left'] ) ? $this->currency['symbol_left'] . $this->currency['symbol_padding'] : ''; + $symbol_right = ! empty( $this->currency['symbol_right'] ) ? $this->currency['symbol_padding'] . $this->currency['symbol_right'] : ''; + + if ( $do_encode ) { + $symbol_left = html_entity_decode( $symbol_left ); + $symbol_right = html_entity_decode( $symbol_right ); + } + + return $negative . $symbol_left . $money . $symbol_right; + } + + public static function get_currency( $code ) { + $currencies = self::get_currencies(); + + return $currencies[ $code ]; + } + + public static function get_currencies() { + $currencies = array( + 'AUD' => array( 'name' => __( 'Australian Dollar', 'gravityforms' ), 'symbol_left' => '$', 'symbol_right' => '', 'symbol_padding' => ' ', 'thousand_separator' => ',', 'decimal_separator' => '.', 'decimals' => 2 ), + 'BRL' => array( 'name' => __( 'Brazilian Real', 'gravityforms' ), 'symbol_left' => 'R$', 'symbol_right' => '', 'symbol_padding' => ' ', 'thousand_separator' => '.', 'decimal_separator' => ',', 'decimals' => 2 ), + 'CAD' => array( 'name' => __( 'Canadian Dollar', 'gravityforms' ), 'symbol_left' => '$', 'symbol_right' => 'CAD', 'symbol_padding' => ' ', 'thousand_separator' => ',', 'decimal_separator' => '.', 'decimals' => 2 ), + 'CZK' => array( 'name' => __( 'Czech Koruna', 'gravityforms' ), 'symbol_left' => '', 'symbol_right' => 'Kč', 'symbol_padding' => ' ', 'thousand_separator' => ' ', 'decimal_separator' => ',', 'decimals' => 2 ), + 'DKK' => array( 'name' => __( 'Danish Krone', 'gravityforms' ), 'symbol_left' => '', 'symbol_right' => 'kr.', 'symbol_padding' => ' ', 'thousand_separator' => '.', 'decimal_separator' => ',', 'decimals' => 2 ), + 'EUR' => array( 'name' => __( 'Euro', 'gravityforms' ), 'symbol_left' => '', 'symbol_right' => '€', 'symbol_padding' => ' ', 'thousand_separator' => '.', 'decimal_separator' => ',', 'decimals' => 2 ), + 'HKD' => array( 'name' => __( 'Hong Kong Dollar', 'gravityforms' ), 'symbol_left' => 'HK$', 'symbol_right' => '', 'symbol_padding' => '', 'thousand_separator' => ',', 'decimal_separator' => '.', 'decimals' => 2 ), + 'HUF' => array( 'name' => __( 'Hungarian Forint', 'gravityforms' ), 'symbol_left' => '', 'symbol_right' => 'Ft', 'symbol_padding' => ' ', 'thousand_separator' => '.', 'decimal_separator' => ',', 'decimals' => 2 ), + 'ILS' => array( 'name' => __( 'Israeli New Sheqel', 'gravityforms' ), 'symbol_left' => '₪', 'symbol_right' => '', 'symbol_padding' => ' ', 'thousand_separator' => ',', 'decimal_separator' => '.', 'decimals' => 2 ), + 'JPY' => array( 'name' => __( 'Japanese Yen', 'gravityforms' ), 'symbol_left' => '¥', 'symbol_right' => '', 'symbol_padding' => ' ', 'thousand_separator' => ',', 'decimal_separator' => '', 'decimals' => 0 ), + 'MYR' => array( 'name' => __( 'Malaysian Ringgit', 'gravityforms' ), 'symbol_left' => 'RM', 'symbol_right' => '', 'symbol_padding' => ' ', 'thousand_separator' => ',', 'decimal_separator' => '.', 'decimals' => 2 ), + 'MXN' => array( 'name' => __( 'Mexican Peso', 'gravityforms' ), 'symbol_left' => '$', 'symbol_right' => '', 'symbol_padding' => ' ', 'thousand_separator' => ',', 'decimal_separator' => '.', 'decimals' => 2 ), + 'NOK' => array( 'name' => __( 'Norwegian Krone', 'gravityforms' ), 'symbol_left' => 'Kr', 'symbol_right' => '', 'symbol_padding' => ' ', 'thousand_separator' => '.', 'decimal_separator' => ',', 'decimals' => 2 ), + 'NZD' => array( 'name' => __( 'New Zealand Dollar', 'gravityforms' ), 'symbol_left' => '$', 'symbol_right' => '', 'symbol_padding' => ' ', 'thousand_separator' => ',', 'decimal_separator' => '.', 'decimals' => 2 ), + 'PHP' => array( 'name' => __( 'Philippine Peso', 'gravityforms' ), 'symbol_left' => 'Php', 'symbol_right' => '', 'symbol_padding' => ' ', 'thousand_separator' => ',', 'decimal_separator' => '.', 'decimals' => 2 ), + 'PLN' => array( 'name' => __( 'Polish Zloty', 'gravityforms' ), 'symbol_left' => 'zł', 'symbol_right' => '', 'symbol_padding' => ' ', 'thousand_separator' => '.', 'decimal_separator' => ',', 'decimals' => 2 ), + 'GBP' => array( 'name' => __( 'Pound Sterling', 'gravityforms' ), 'symbol_left' => '£', 'symbol_right' => '', 'symbol_padding' => ' ', 'thousand_separator' => ',', 'decimal_separator' => '.', 'decimals' => 2 ), + 'RUB' => array( 'name' => __( 'Russian Ruble', 'gravityforms' ), 'symbol_left' => '', 'symbol_right' => 'pyб', 'symbol_padding' => ' ', 'thousand_separator' => ' ', 'decimal_separator' => '.', 'decimals' => 2 ), + 'SGD' => array( 'name' => __( 'Singapore Dollar', 'gravityforms' ), 'symbol_left' => '$', 'symbol_right' => '', 'symbol_padding' => ' ', 'thousand_separator' => ',', 'decimal_separator' => '.', 'decimals' => 2 ), + 'ZAR' => array( 'name' => __( 'South African Rand', 'gravityforms' ), 'symbol_left' => 'R', 'symbol_right' => '', 'symbol_padding' => '', 'thousand_separator' => ',', 'decimal_separator' => '.', 'decimals' => 2 ), + 'SEK' => array( 'name' => __( 'Swedish Krona', 'gravityforms' ), 'symbol_left' => '', 'symbol_right' => 'Kr', 'symbol_padding' => ' ', 'thousand_separator' => ' ', 'decimal_separator' => ',', 'decimals' => 2 ), + 'CHF' => array( 'name' => __( 'Swiss Franc', 'gravityforms' ), 'symbol_left' => 'Fr.', 'symbol_right' => '', 'symbol_padding' => ' ', 'thousand_separator' => "'", 'decimal_separator' => '.', 'decimals' => 2 ), + 'TWD' => array( 'name' => __( 'Taiwan New Dollar', 'gravityforms' ), 'symbol_left' => '$', 'symbol_right' => '', 'symbol_padding' => ' ', 'thousand_separator' => ',', 'decimal_separator' => '.', 'decimals' => 2 ), + 'THB' => array( 'name' => __( 'Thai Baht', 'gravityforms' ), 'symbol_left' => '฿', 'symbol_right' => '', 'symbol_padding' => ' ', 'thousand_separator' => ',', 'decimal_separator' => '.', 'decimals' => 2 ), + 'USD' => array( 'name' => __( 'U.S. Dollar', 'gravityforms' ), 'symbol_left' => '$', 'symbol_right' => '', 'symbol_padding' => '', 'thousand_separator' => ',', 'decimal_separator' => '.', 'decimals' => 2 ) + ); + + return apply_filters( 'gform_currencies', $currencies ); + } + } } diff --git a/entry_detail.php b/entry_detail.php index 130c514..07d28f9 100644 --- a/entry_detail.php +++ b/entry_detail.php @@ -1,1024 +1,1069 @@ - "is_starred", "value" => (bool) $star); - if(!is_null($read)) - $search_criteria["field_filters"][] = array("key" => "is_read", "value" => (bool) $read); - - $search_field_id = rgget("field_id"); - - if(isset($_GET["field_id"]) && $_GET["field_id"] !== ''){ - $key = $search_field_id; - $val = rgget("s"); - $strpos_row_key = strpos($search_field_id, "|"); - if ($strpos_row_key !== false) { //multi-row likert - $key_array = explode("|", $search_field_id); - $key = $key_array[0]; - $val = $key_array[1] . ":" . $val; - } - $type = rgget("type"); - if(empty($type)){ - $type = rgget("field_id") == "0" ? "global" : "field"; - } - - $search_criteria["field_filters"][] = array( - "key" => $key, - "type" => $type, - "operator" => rgempty("operator", $_GET) ? "is" : rgget("operator"), - "value" => $val - ); - } - - $paging = array('offset' => $position, 'page_size' => 1); - - if(!empty($sort_field)) - $sorting = array('key' => $_GET["sort"], 'direction' => $sort_direction, 'is_numeric' => $is_numeric); - else - $sorting = array(); - $total_count = 0; - $leads = GFAPI::get_entries($form['id'], $search_criteria, $sorting, $paging, $total_count); - - $prev_pos = !rgblank($position) && $position > 0 ? $position - 1 : false; - $next_pos = !rgblank($position) && $position < $total_count - 1 ? $position + 1 : false; - - // unread filter requires special handling for pagination since entries are filter out of the query as they are read - if($filter == 'unread') { - $next_pos = $position; - - if($next_pos + 1 == $total_count) - $next_pos = false; - - } - - if(!$lead_id){ - $lead = !empty($leads) ? $leads[0] : false; - } else { - $lead = GFAPI::get_entry($lead_id); - } - - - if(!$lead) { - _e("Oops! We couldn't find your entry. Please try again", "gravityforms"); - return; - } - - RGFormsModel::update_lead_property($lead["id"], "is_read", 1); - - switch(RGForms::post("action")){ - case "update" : - check_admin_referer('gforms_save_entry', 'gforms_save_entry'); - //Loading files that have been uploaded to temp folder - $files = GFCommon::json_decode(stripslashes(RGForms::post("gform_uploaded_files"))); - if(!is_array($files)) - $files = array(); - - GFFormsModel::$uploaded_files[$form_id] = $files; - GFFormsModel::save_lead($form, $lead); - - do_action("gform_after_update_entry", $form, $lead["id"]); - do_action("gform_after_update_entry_{$form["id"]}", $form, $lead["id"]); - - $lead = RGFormsModel::get_lead($lead["id"]); - $lead = GFFormsModel::set_entry_meta($lead, $form); - break; - - case "add_note" : - check_admin_referer('gforms_update_note', 'gforms_update_note'); - $user_data = get_userdata($current_user->ID); - RGFormsModel::add_note($lead["id"], $current_user->ID, $user_data->display_name, stripslashes($_POST["new_note"])); - - //emailing notes if configured - if(rgpost("gentry_email_notes_to")){ - GFCommon::log_debug( 'Preparing to email entry notes.' ); - $email_to = $_POST["gentry_email_notes_to"]; - $email_from = $current_user->user_email; - $email_subject = stripslashes($_POST["gentry_email_subject"]); - $headers = "From: \"$email_from\" <$email_from> \r\n"; - $body = stripslashes( $_POST["new_note"] ); - GFCommon::log_debug( "Emailing notes - TO: $email_to SUBJECT: $email_subject BODY: $body HEADERS: $headers" ); - $result = wp_mail( $email_to, $email_subject, $body, $headers ); - } - break; - - case "add_quick_note" : - check_admin_referer('gforms_save_entry', 'gforms_save_entry'); - $user_data = get_userdata($current_user->ID); - RGFormsModel::add_note($lead["id"], $current_user->ID, $user_data->display_name, stripslashes($_POST["quick_note"])); - break; - - case "bulk" : - check_admin_referer('gforms_update_note', 'gforms_update_note'); - if($_POST["bulk_action"] == "delete") - RGFormsModel::delete_notes($_POST["note"]); - break; - - case "trash" : - check_admin_referer('gforms_save_entry', 'gforms_save_entry'); - RGFormsModel::update_lead_property($lead["id"], "status", "trash"); - $lead = RGFormsModel::get_lead($lead["id"]); - break; - - case "restore" : - case "unspam" : - check_admin_referer('gforms_save_entry', 'gforms_save_entry'); - RGFormsModel::update_lead_property($lead["id"], "status", "active"); - $lead = RGFormsModel::get_lead($lead["id"]); - break; - - case "spam" : - check_admin_referer('gforms_save_entry', 'gforms_save_entry'); - RGFormsModel::update_lead_property($lead["id"], "status", "spam"); - $lead = RGFormsModel::get_lead($lead["id"]); - break; - - case "delete" : - check_admin_referer('gforms_save_entry', 'gforms_save_entry'); - if(!GFCommon::current_user_can_any("gravityforms_delete_entries")) - die(__("You don't have adequate permissions to delete entries.", "gravityforms")); - RGFormsModel::delete_lead($lead["id"]); - ?> - - - - - -
    - - - " /> - -
    -

    ID: lock_info($lead_id);?>

    - - -
    -
      -
    • entry of
    • -
    • -
    • -
    -
    - - - - -
    -
    - - - -
    -

    - -

    -
    -
    -
    - :

    - : -

    - : -

    - - : " alt="" title="">user_login) ?> -

    - - - : " target="_blank" alt="" title="">.../ -

    - - : " title="">post_title) ?> -

    - : -

    - : -

    - : -

    - : -

    - -
    -
    - -
    - '; - echo apply_filters("gform_entrydetail_update_button", $update_button); - if($mode == "edit") - echo '  '; - } - ?> -
    -
    -
    -
    -
    -
    - - - - - - - -
    -

    -
    - -
    - -

    - - " class="button"> - - " id="notification_" onclick="toggleNotificationOverride();" /> -

    - - - - - " class="button" style="" onclick="ResendNotifications();"/> - - - -
    -
    -
    - - - - -
    - - - - - -
    - - -
    - -
    -
    - -
    -

    - -

    - - - -
    - -
    - -
    - -
    -
    -
    -
    - - -
    - -
    - -
    -

    - -

    -
    - - - - - - - "; - - $content = apply_filters("gform_field_content", $content, $field, $value, $lead["id"], $form["id"]); - - echo $content; - break; - } - } - ?> - -
    -

    -
    " . - GFCommon::get_field_input($field, $value, $lead["id"]) . "
    -
    - -
    -
    - 0 && $is_editable && GFCommon::current_user_can_any("gravityforms_edit_entry_notes")){ - ?> -
    - - - '; - echo apply_filters("gform_notes_apply_button", $apply_button); - ?> -
    - - - - - - - - - - - = $notes_count ? true : false; - ?> - - - - - - - - - - - - -
    Notes
    - - - - "> - note_type ? " gforms_note_{$note->note_type}" : ""; - ?> -
    -
    user_id, 48), $note);?>
    -
    user_name)?>
    -

    user_email) ?>
    - date_created, false)) ?>

    -
    -
    value) ?>
    -
    - - '; - echo apply_filters("gform_addnote_button", $note_button); - - if(!empty($emails)){ ?> -    - - -    - - - - -
    - - - - - - - - - - = $field_count ? true : false; - ?> - - - - = $field_count && !$has_product_fields ? true : false; - $last_row = $is_last ? " lastrow" : ""; - - $display_value = empty($display_value) && $display_value !== "0" ? " " : $display_value; - - $content = ' - - - - - - '; - - $content = apply_filters("gform_field_content", $content, $field, $value, $lead["id"], $form["id"]); - - echo $content; - - } - break; - } - } - - $products = array(); - if($has_product_fields){ - $products = GFCommon::get_product_fields($form, $lead); - if(!empty($products["products"])){ - ?> - - - - - - - - - -
    - : - - - onclick="ToggleShowEmptyFields();"/>   - -
    ">
    ' . esc_html(GFCommon::get_label($field)) . '
    ' . $display_value . '
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    -
      - - > - -
    -
      
     
    -
    - $pos), remove_query_arg(array('pos', 'lid'))) . '"': ''; - $class .= ' gf_entry_pagination_link'; - $class .= $pos !== false ? ' gf_entry_pagination_link_active' : ' gf_entry_pagination_link_inactive'; - - return ''; - } - - /** - * @param $lead - * @param $form - * @return mixed - */ - public static function payment_details_box($lead, $form) - { - ?> - -
    -

    - -

    - -
    -
    -
    - -
    - : - -
    - - -
    - : - -
    - -
    - : - -
    - -
    - : - -
    - -
    -
    -
    -
    - \ No newline at end of file + 'is_starred', 'value' => (bool) $star ); + } + if ( ! is_null( $read ) ) { + $search_criteria['field_filters'][] = array( 'key' => 'is_read', 'value' => (bool) $read ); + } + + $search_field_id = rgget( 'field_id' ); + + if ( isset( $_GET['field_id'] ) && $_GET['field_id'] !== '' ) { + $key = $search_field_id; + $val = rgget( 's' ); + $strpos_row_key = strpos( $search_field_id, '|' ); + if ( $strpos_row_key !== false ) { //multi-row likert + $key_array = explode( '|', $search_field_id ); + $key = $key_array[0]; + $val = $key_array[1] . ':' . $val; + } + + $search_criteria['field_filters'][] = array( + 'key' => $key, + 'operator' => rgempty( 'operator', $_GET ) ? 'is' : rgget( 'operator' ), + 'value' => $val, + ); + + $type = rgget( 'type' ); + if ( empty( $type ) ) { + if ( rgget( 'field_id' ) == '0' ) { + $search_criteria['type'] = 'global'; + } + } + } + + $paging = array( 'offset' => $position, 'page_size' => 1 ); + + if ( ! empty( $sort_field ) ) { + $sorting = array( 'key' => $_GET['sort'], 'direction' => $sort_direction, 'is_numeric' => $is_numeric ); + } else { + $sorting = array(); + } + $total_count = 0; + $leads = GFAPI::get_entries( $form['id'], $search_criteria, $sorting, $paging, $total_count ); + + $prev_pos = ! rgblank( $position ) && $position > 0 ? $position - 1 : false; + $next_pos = ! rgblank( $position ) && $position < $total_count - 1 ? $position + 1 : false; + + // unread filter requires special handling for pagination since entries are filter out of the query as they are read + if ( $filter == 'unread' ) { + $next_pos = $position; + + if ( $next_pos + 1 == $total_count ) { + $next_pos = false; + } + } + + if ( ! $lead_id ) { + $lead = ! empty( $leads ) ? $leads[0] : false; + } else { + $lead = GFAPI::get_entry( $lead_id ); + } + + if ( ! $lead ) { + _e( "Oops! We couldn't find your entry. Please try again", 'gravityforms' ); + + return; + } + + RGFormsModel::update_lead_property( $lead['id'], 'is_read', 1 ); + + switch ( RGForms::post( 'action' ) ) { + case 'update' : + check_admin_referer( 'gforms_save_entry', 'gforms_save_entry' ); + //Loading files that have been uploaded to temp folder + $files = GFCommon::json_decode( stripslashes( RGForms::post( 'gform_uploaded_files' ) ) ); + if ( ! is_array( $files ) ) { + $files = array(); + } + + GFFormsModel::$uploaded_files[ $form_id ] = $files; + GFFormsModel::save_lead( $form, $lead ); + + do_action( 'gform_after_update_entry', $form, $lead['id'] ); + do_action( "gform_after_update_entry_{$form['id']}", $form, $lead['id'] ); + + $lead = RGFormsModel::get_lead( $lead['id'] ); + $lead = GFFormsModel::set_entry_meta( $lead, $form ); + break; + + case 'add_note' : + check_admin_referer( 'gforms_update_note', 'gforms_update_note' ); + $user_data = get_userdata( $current_user->ID ); + RGFormsModel::add_note( $lead['id'], $current_user->ID, $user_data->display_name, stripslashes( $_POST['new_note'] ) ); + + //emailing notes if configured + if ( rgpost( 'gentry_email_notes_to' ) ) { + GFCommon::log_debug( 'GFEntryDetail::lead_detail_page(): Preparing to email entry notes.' ); + $email_to = $_POST['gentry_email_notes_to']; + $email_from = $current_user->user_email; + $email_subject = stripslashes( $_POST['gentry_email_subject'] ); + $body = stripslashes( $_POST['new_note'] ); + + $headers = "From: \"$email_from\" <$email_from> \r\n"; + GFCommon::log_debug( "GFEntryDetail::lead_detail_page(): Emailing notes - TO: $email_to SUBJECT: $email_subject BODY: $body HEADERS: $headers" ); + $result = wp_mail( $email_to, $email_subject, $body, $headers ); + GFCommon::log_debug( "GFEntryDetail::lead_detail_page(): Result from wp_mail(): {$result}" ); + if ( $result ) { + GFCommon::log_debug( 'GFEntryDetail::lead_detail_page(): Mail was passed from WordPress to the mail server.' ); + } else { + GFCommon::log_error( 'GFEntryDetail::lead_detail_page(): The mail message was passed off to WordPress for processing, but WordPress was unable to send the message.' ); + } + } + break; + + case 'add_quick_note' : + check_admin_referer( 'gforms_save_entry', 'gforms_save_entry' ); + $user_data = get_userdata( $current_user->ID ); + RGFormsModel::add_note( $lead['id'], $current_user->ID, $user_data->display_name, stripslashes( $_POST['quick_note'] ) ); + break; + + case 'bulk' : + check_admin_referer( 'gforms_update_note', 'gforms_update_note' ); + if ( $_POST['bulk_action'] == 'delete' ) { + if ( ! GFCommon::current_user_can_any( 'gravityforms_edit_entry_notes' ) ) { + die( __( "You don't have adequate permission to delete notes.", 'gravityforms' ) ); + } + RGFormsModel::delete_notes( $_POST['note'] ); + } + break; + + case 'trash' : + check_admin_referer( 'gforms_save_entry', 'gforms_save_entry' ); + RGFormsModel::update_lead_property( $lead['id'], 'status', 'trash' ); + $lead = RGFormsModel::get_lead( $lead['id'] ); + break; + + case 'restore' : + case 'unspam' : + check_admin_referer( 'gforms_save_entry', 'gforms_save_entry' ); + RGFormsModel::update_lead_property( $lead['id'], 'status', 'active' ); + $lead = RGFormsModel::get_lead( $lead['id'] ); + break; + + case 'spam' : + check_admin_referer( 'gforms_save_entry', 'gforms_save_entry' ); + RGFormsModel::update_lead_property( $lead['id'], 'status', 'spam' ); + $lead = RGFormsModel::get_lead( $lead['id'] ); + break; + + case 'delete' : + check_admin_referer( 'gforms_save_entry', 'gforms_save_entry' ); + if ( ! GFCommon::current_user_can_any( 'gravityforms_delete_entries' ) ) { + die( __( "You don't have adequate permission to delete entries.", 'gravityforms' ) ); + } + RGFormsModel::delete_lead( $lead['id'] ); + ?> + + + + + +
    + + + + +
    +

    + ID: : lock_info( $lead_id ); ?>

    + + +
    +
      +
    • + entry of +
    • +
    • +
    • +
    +
    + + + + +
    +
    + + + +
    +

    + +

    + +
    +
    +
    +
    + :

    + : +

    + : +

    + + : + user_login ) ?> +

    + + + : + .../ +

    + + : + post_title ) ?> +

    + : + +

    + : +

    + : +

    + : +

    + +
    +
    + +
    + '; + echo apply_filters( 'gform_entrydetail_update_button', $update_button ); + if ( $mode == 'edit' ) { + echo '  '; + } + } + ?> +
    +
    +
    +
    +
    +
    + + + + + + + +
    +

    + +
    + +
    + +

    + + " class="button"> + + + +

    + + + + + + + + +
    +
    +
    + + + + +
    + + + + + +
    + + +
    + +
    +
    + +
    +

    + +

    + + + +
    + id ] ) ) { + $emails[] = $lead[ $email_field->id ]; + } + } + //displaying notes grid + $subject = ''; + self::notes_grid( $notes, true, $emails, $subject ); + ?> +
    + +
    + +
    +
    +
    +
    + + +
    + +
    + +
    +

    + +

    + +
    + + + id; + switch ( RGFormsModel::get_input_type( $field ) ) { + case 'section' : + ?> + + + + '; + + $content = apply_filters( 'gform_field_content', $content, $field, $value, $lead['id'], $form['id'] ); + + echo $content; + break; + } + } + ?> + +
    +
    +

    +
    +
    ' . + GFCommon::get_field_input( $field, $value, $lead['id'], $form_id, $form ) . '
    +
    + + +
    +
    + 0 && $is_editable && GFCommon::current_user_can_any( 'gravityforms_edit_entry_notes' ) ) { + ?> +
    + + + '; + echo apply_filters( 'gform_notes_apply_button', $apply_button ); + ?> +
    + + + + + + + + + + + = $notes_count ? true : false; + ?> + + + + + + + + + + + + +
    Notes
    + + + + + note_type ? " gforms_note_{$note->note_type}" : ''; + ?> +
    +
    user_id, 48 ), $note ); ?>
    +
    user_name ) ?>
    +

    + user_email ) ?>
    + date_created, false ) ) ?> +

    +
    +
    value ) ?>
    +
    + + '; + echo apply_filters( 'gform_addnote_button', $note_button ); + + if ( ! empty( $emails ) ) { + ?> +    + + +    + + + + +
    + + + + + + + + + + = $field_count ? true : false; + ?> + + + + type ) ) { + $has_product_fields = true; + continue; + } + + $value = RGFormsModel::get_lead_field_value( $lead, $field ); + $display_value = GFCommon::get_lead_field_display( $field, $value, $lead['currency'] ); + + $display_value = apply_filters( 'gform_entry_field_value', $display_value, $field, $lead, $form ); + + if ( $display_empty_fields || ! empty( $display_value ) || $display_value === '0' ) { + $count ++; + $is_last = $count >= $field_count && ! $has_product_fields ? true : false; + $last_row = $is_last ? ' lastrow' : ''; + + $display_value = empty( $display_value ) && $display_value !== '0' ? ' ' : $display_value; + + $content = ' + + + + + + '; + + $content = apply_filters( 'gform_field_content', $content, $field, $value, $lead['id'], $form['id'] ); + + echo $content; + + } + break; + } + } + + $products = array(); + if ( $has_product_fields ) { + $products = GFCommon::get_product_fields( $form, $lead ); + if ( ! empty( $products['products'] ) ) { + ?> + + + + + + + + + +
    + + + + onclick="ToggleShowEmptyFields();" />   + + +
    ' . esc_html( GFCommon::get_label( $field ) ) . '
    ' . $display_value . '
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    +
      + + > + +
    +
      
     
    +
    + $pos ), remove_query_arg( array( 'pos', 'lid' ) ) ) . '"' : ''; + $class .= ' gf_entry_pagination_link'; + $class .= $pos !== false ? ' gf_entry_pagination_link_active' : ' gf_entry_pagination_link_inactive'; + + return ''; + } + + public static function payment_details_box( $lead, $form ) + { + ?> + +
    +

    + +

    + +
    +
    +
    + +
    + : + +
    + + +
    + : + +
    + +
    + : + +
    + +
    + : + +
    + +
    +
    +
    +
    + -
    - ', ''); ?> -
    - id; - - self::leads_page($id); - } - } - - public static function leads_page($form_id){ - global $wpdb; - - //quit if version of wp is not supported - if(!GFCommon::ensure_wp_version()) - return; - - echo GFCommon::get_remote_message(); - $action = RGForms::post("action"); - $filter = rgget("filter"); - $search = rgget("s"); - $page_index = empty($_GET["paged"]) ? 0 : intval($_GET["paged"]) - 1; - $star = $filter == "star" ? 1 : null; - $read = $filter == "unread" ? 0 : null; - $status = in_array($filter, array("trash", "spam")) ? $filter : "active"; - $form = RGFormsModel::get_form_meta( $form_id ); - - $search_criteria["status"] = $status; - - if($star) - $search_criteria["field_filters"][] = array("key"=> "is_starred", "value" => (bool) $star); - if(!is_null($read)) - $search_criteria["field_filters"][] = array("key"=> "is_read", "value" => (bool) $read); - - $search_field_id = rgget("field_id"); - - $search_operator = rgget("operator"); - if(isset($_GET["field_id"]) && $_GET["field_id"] !== ''){ - $key = $search_field_id; - $val = rgget("s"); - $strpos_row_key = strpos($search_field_id, "|"); - if ($strpos_row_key !== false) { //multi-row likert - $key_array = explode("|", $search_field_id); - $key = $key_array[0]; - $val = $key_array[1] . ":" . $val; - } - if("entry_id" == $key){ - $key = "id"; - } - - $filter_operator = empty( $search_operator ) ? 'is' : $search_operator; - - $field = GFFormsModel::get_field( $form, $key ); - if ( $field ) { - $input_type = GFFormsModel::get_input_type( $field ); - if ( $field['type'] == 'product' && in_array( $input_type, array( 'radio', 'select' ) ) ) { - $filter_operator = 'contains'; - } - } - - $search_criteria["field_filters"][] = array( - "key" => $key, - "operator" => $filter_operator, - "value" => $val - ); - } - - $update_message = ""; - switch($action){ - case "delete" : - check_admin_referer('gforms_entry_list', 'gforms_entry_list'); - $lead_id = $_POST["action_argument"]; - if(GFCommon::current_user_can_any("gravityforms_delete_entries")){ - RGFormsModel::delete_lead($lead_id); - $update_message = __("Entry deleted.", "gravityforms"); - } else { - $update_message = __("You don't have adequate permissions to delete entries.", "gravityforms"); - } - - break; - - case "bulk": - check_admin_referer('gforms_entry_list', 'gforms_entry_list'); - - $bulk_action = !empty($_POST["bulk_action"]) ? $_POST["bulk_action"] : $_POST["bulk_action2"]; - $select_all = rgpost("all_entries"); - $leads = empty($select_all) ? $_POST["lead"] : GFFormsModel::search_lead_ids($form_id, $search_criteria); - - $entry_count = count($leads) > 1 ? sprintf(__("%d entries", "gravityforms"), count($leads)) : __("1 entry", "gravityforms"); - - switch($bulk_action) { - case "delete": - if(GFCommon::current_user_can_any("gravityforms_delete_entries")){ - RGFormsModel::delete_leads($leads); - $update_message = sprintf(__("%s deleted.", "gravityforms"), $entry_count); - } else { - $update_message = __("You don't have adequate permissions to delete entries.", "gravityforms"); - } - break; - - case "trash": - RGFormsModel::update_leads_property($leads, "status", "trash"); - $update_message = sprintf(__("%s moved to Trash.", "gravityforms"), $entry_count); - break; - - case "restore": - RGFormsModel::update_leads_property($leads, "status", "active"); - $update_message = sprintf(__("%s restored from the Trash.", "gravityforms"), $entry_count); - break; - - case "unspam": - RGFormsModel::update_leads_property($leads, "status", "active"); - $update_message = sprintf(__("%s restored from the spam.", "gravityforms"), $entry_count); - break; - - case "spam": - RGFormsModel::update_leads_property($leads, "status", "spam"); - $update_message = sprintf(__("%s marked as spam.", "gravityforms"), $entry_count); - break; - - case "mark_read": - RGFormsModel::update_leads_property($leads, "is_read", 1); - $update_message = sprintf(__("%s marked as read.", "gravityforms"), $entry_count); - break; - - case "mark_unread": - RGFormsModel::update_leads_property($leads, "is_read", 0); - $update_message = sprintf(__("%s marked as unread.", "gravityforms"), $entry_count); - break; - - case "add_star": - RGFormsModel::update_leads_property($leads, "is_starred", 1); - $update_message = sprintf(__("%s starred.", "gravityforms"), $entry_count); - break; - - case "remove_star": - RGFormsModel::update_leads_property($leads, "is_starred", 0); - $update_message = sprintf(__("%s unstarred.", "gravityforms"), $entry_count); - break; - } - break; - - case "change_columns": - check_admin_referer('gforms_entry_list', 'gforms_entry_list'); - $columns = GFCommon::json_decode(stripslashes($_POST["grid_columns"]), true); - RGFormsModel::update_grid_column_meta($form_id, $columns); - break; - } - - if(rgpost("button_delete_permanently")){ - if(GFCommon::current_user_can_any("gravityforms_delete_entries")){ - RGFormsModel::delete_leads_by_form($form_id, $filter); - } - } - - $sort_field = empty($_GET["sort"]) ? 0 : $_GET["sort"]; - $sort_direction = empty($_GET["dir"]) ? "DESC" : $_GET["dir"]; - $form = RGFormsModel::get_form_meta($form_id); - $sort_field_meta = RGFormsModel::get_field($form, $sort_field); - $is_numeric = $sort_field_meta["type"] == "number"; - - $page_size = apply_filters("gform_entry_page_size", apply_filters("gform_entry_page_size_{$form_id}", 20, $form_id), $form_id); - $first_item_index = $page_index * $page_size; - - if(!empty($sort_field)) - $sorting = array('key' => $_GET["sort"], 'direction' => $sort_direction, 'is_numeric' => $is_numeric); - else - $sorting = array(); - - $paging = array('offset' => $first_item_index, 'page_size' => $page_size); - $total_count = 0; - - $leads = GFAPI::get_entries($form_id, $search_criteria, $sorting, $paging, $total_count); - - $summary = RGFormsModel::get_form_counts($form_id); - $active_lead_count = $summary["total"]; - $unread_count = $summary["unread"]; - $starred_count = $summary["starred"]; - $spam_count = $summary["spam"]; - $trash_count = $summary["trash"]; - - $columns = RGFormsModel::get_grid_columns($form_id, true); - - $search_qs = empty($search) ? "" : "&s=" . urlencode($search); - $sort_qs = empty($sort_field) ? "" : "&sort=$sort_field"; - $dir_qs = empty($sort_field) ? "" : "&dir=$sort_direction"; - $star_qs = $star !== null ? "&star=$star" : ""; - $read_qs = $read !== null ? "&read=$read" : ""; - $filter_qs = "&filter=" . $filter; - $search_field_id_qs = ! isset($_GET["field_id"]) ? "" : "&field_id=$search_field_id"; - $search_operator_urlencoded = urlencode($search_operator); - $search_operator_qs = empty($search_operator_urlencoded) ? "" : "&operator=$search_operator_urlencoded"; - - $display_total = ceil($total_count / $page_size); - $page_links = paginate_links( array( - 'base' => admin_url("admin.php") . "?page=gf_entries&view=entries&id=$form_id&%_%" . $search_qs . $sort_qs . $dir_qs. $star_qs . $read_qs . $filter_qs . $search_field_id_qs . $search_operator_qs, - 'format' => 'paged=%#%', - 'prev_text' => __('«', 'gravityforms'), - 'next_text' => __('»', 'gravityforms'), - 'total' => $display_total, - 'current' => $page_index + 1, - 'show_all' => false - )); - - wp_print_styles(array("thickbox")); - - $field_filters = GFCommon::get_field_filter_settings($form); - - $init_field_id = empty($search_field_id) ? 0 : $search_field_id; - $init_field_operator = empty($search_operator) ? "contains" : $search_operator; - $init_filter_vars = array( - "mode" => "off", - "filters" => array( - array( - "field" => $init_field_id, - "operator" => $init_field_operator, - "value" => $search - ) - ) - ) - ?> - - - - - - -
    -

    ID: :

    - - - -
    - - - - - - - - -
    - -
    -
    -
    - -
    - - - '; - echo apply_filters("gform_entry_apply_button", $apply_button); - - if(in_array($filter, array("trash", "spam"))){ - $message = $filter == "trash" ? __("WARNING! This operation cannot be undone. Empty trash? \'Ok\' to empty trash. \'Cancel\' to abort.", "gravityforms") : __("WARNING! This operation cannot be undone. Permanently delete all spam? \'Ok\' to delete. \'Cancel\' to abort.", "gravityforms"); - $button_label = $filter == "trash" ? __("Empty Trash", "gravityforms") : __("Delete All Spam", "gravityforms"); - ?> - - - + \ No newline at end of file + public static function get_tabs() { + + $setting_tabs = array(); + if ( GFCommon::current_user_can_any( 'gravityforms_export_entries' ) ) { + $setting_tabs['10'] = array( 'name' => 'export_entry', 'label' => __( 'Export Entries', 'gravityforms' ) ); + } + + if ( GFCommon::current_user_can_any( 'gravityforms_edit_forms' ) ) { + $setting_tabs['20'] = array( 'name' => 'export_form', 'label' => __( 'Export Forms', 'gravityforms' ) ); + $setting_tabs['30'] = array( 'name' => 'import_form', 'label' => __( 'Import Forms', 'gravityforms' ) ); + } + + $setting_tabs = apply_filters( 'gform_export_menu', $setting_tabs ); + ksort( $setting_tabs, SORT_NUMERIC ); + + return $setting_tabs; + } + +} \ No newline at end of file diff --git a/fonts/gravityfont.eot b/fonts/gravityfont.eot new file mode 100755 index 0000000..5652aec Binary files /dev/null and b/fonts/gravityfont.eot differ diff --git a/fonts/gravityfont.svg b/fonts/gravityfont.svg new file mode 100755 index 0000000..6804945 --- /dev/null +++ b/fonts/gravityfont.svg @@ -0,0 +1,79 @@ + + + + + +{ + "fontFamily": "gravityfont", + "majorVersion": 1, + "minorVersion": 2, + "copyright": "Copyright 2014-2015 Rocketgenius Inc.", + "designerURL": "http://www.rocketgenius.com", + "fontURL": "http://www.gravityforms.com", + "version": "Version 1.2", + "fontId": "gravityfont", + "psName": "gravityfont", + "subFamily": "Regular", + "fullName": "gravityfont", + "description": "Font generated by IcoMoon." +} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/fonts/gravityfont.ttf b/fonts/gravityfont.ttf new file mode 100755 index 0000000..3eae6fc Binary files /dev/null and b/fonts/gravityfont.ttf differ diff --git a/fonts/gravityfont.woff b/fonts/gravityfont.woff new file mode 100755 index 0000000..1cb1b30 Binary files /dev/null and b/fonts/gravityfont.woff differ diff --git a/fonts/index.php b/fonts/index.php new file mode 100644 index 0000000..12c197f --- /dev/null +++ b/fonts/index.php @@ -0,0 +1,2 @@ + - - - - - - - - - +class GFFormDetail { + + public static function forms_page( $form_id ) { + + global $wpdb; + + if ( ! GFCommon::ensure_wp_version() ) { + return; + } + + $update_result = ''; + if ( rgpost( 'operation' ) == 'trash' ) { + check_admin_referer( 'gforms_trash_form', 'gforms_trash_form' ); + GFFormsModel::trash_form( $form_id ); + ?> + + + + + + + + + + var form = " . json_encode( $form ) . ';'; + } else { + echo ""; + } + + ?> + + +
    + +

    + +

    + ID: : +

    + + + + + +
    + + ', '' ) ?> +
    + +
    + +
    + +
    + +
    + + + + + +
    + + +
    + + + + + + +
    + +
    +
    + +
    + + +
    +
    +
    +
    +
    + + +
    + +
      + + + + + +
    • + +
      +
      + + + +

      1.

      + +

      + +
      + + +
      + + + +

      2.

      + +

      + +
      + +
      + + + +

      3.

      + +

      + +
      + + + +
      + + + +

      4.

      + +

      + +
      + + +
      + + + +

      5.

      + +

      + +
      + + +
      + +
    • + + + +
    + +
    +
    + +
    + +
    +
    +
    +
    +
    + + + +
    + +
    + + + + +
    +
    +
    +
    + + + +
    + + + ' . __( 'Move to Trash', 'gravityforms' ) . ''; + $trash_link = apply_filters( 'gform_form_delete_link', $trash_link ); // deprecated + echo apply_filters( 'gform_form_trash_link', $trash_link ); + } + + $button_text = rgar( $form, 'id' ) > 0 ? __( 'Update Form', 'gravityforms' ) : __( 'Save Form', 'gravityforms' ); + $isNew = rgar( $form, 'id' ) > 0 ? 0 : 1; + $save_button = ''; + $save_button = apply_filters( 'gform_save_form_button', $save_button ); + echo $save_button; + ?> + + + + + + + + - - - - - - - -
    - - "; - } - } - - //Hierarchical category functions copied from WordPress core and modified. - private static function _cat_rows( $categories, &$count, &$output, $parent = 0, $level = 0, $page = 1, $per_page = 9999999 ) { - if ( empty($categories) ) { - $args = array('hide_empty' => 0); - if ( !empty($_POST['search']) ) - $args['search'] = $_POST['search']; - $categories = get_categories( $args ); - } - - if ( !$categories ) - return false; - - $children = self::_get_term_hierarchy('category'); - - $start = ($page - 1) * $per_page; - $end = $start + $per_page; - $i = -1; - foreach ( $categories as $category ) { - if ( $count >= $end ) - break; - - $i++; - - if ( $category->parent != $parent ) - continue; - - // If the page starts in a subtree, print the parents. - if ( $count == $start && $category->parent > 0 ) { - $my_parents = array(); - while ( $my_parent) { - $my_parent = get_category($my_parent); - $my_parents[] = $my_parent; - if ( !$my_parent->parent ) - break; - $my_parent = $my_parent->parent; - } - $num_parents = count($my_parents); - while( $my_parent = array_pop($my_parents) ) { - self::_cat_row( $my_parent, $level - $num_parents, $output ); - $num_parents--; - } - } - - if ( $count >= $start ) - self::_cat_row( $category, $level, $output ); - - //unset($categories[$i]); // Prune the working set - $count++; - - if ( isset($children[$category->term_id]) ) - self::_cat_rows( $categories, $count, $output, $category->term_id, $level + 1, $page, $per_page ); - - } -} - private static function _cat_row( $category, $level, &$output, $name_override = false ) { - static $row_class = ''; - - $cat = get_category( $category, OBJECT, 'display' ); +
    + + +
    - $default_cat_id = (int) get_option( 'default_category' ); - $pad = str_repeat( '— ', $level ); - $name = ( $name_override ? $name_override : $pad . ' ' . $cat->name ); +
    +
    +
    - $cat->count = number_format_i18n( $cat->count ); +
    - $output .=" + +
    + + + + + + + + + + + + + + + + +
    + + + + + + + + +
    + + + + + +
    + + '; + } + } + + //Hierarchical category functions copied from WordPress core and modified. + private static function _cat_rows( $categories, &$count, &$output, $parent = 0, $level = 0, $page = 1, $per_page = 9999999 ) { + if ( empty( $categories ) ) { + $args = array( 'hide_empty' => 0 ); + if ( ! empty( $_POST['search'] ) ) + $args['search'] = $_POST['search']; + $categories = get_categories( $args ); + } + + if ( ! $categories ) + return false; + + $children = self::_get_term_hierarchy( 'category' ); + + $start = ( $page - 1 ) * $per_page; + $end = $start + $per_page; + $i = - 1; + foreach ( $categories as $category ) { + if ( $count >= $end ) + break; + + $i ++; + + if ( $category->parent != $parent ) + continue; + + // If the page starts in a subtree, print the parents. + if ( $count == $start && $category->parent > 0 ) { + $my_parents = array(); + while ( $my_parent ) { + $my_parent = get_category( $my_parent ); + $my_parents[] = $my_parent; + if ( ! $my_parent->parent ) + break; + $my_parent = $my_parent->parent; + } + $num_parents = count( $my_parents ); + while ( $my_parent = array_pop( $my_parents ) ) { + self::_cat_row( $my_parent, $level - $num_parents, $output ); + $num_parents --; + } + } + + if ( $count >= $start ) + self::_cat_row( $category, $level, $output ); + + //unset($categories[ $i ]); // Prune the working set + $count ++; + + if ( isset( $children[ $category->term_id ] ) ) + self::_cat_rows( $categories, $count, $output, $category->term_id, $level + 1, $page, $per_page ); + + } + } + + private static function _cat_row( $category, $level, &$output, $name_override = false ) { + static $row_class = ''; + + $cat = get_category( $category, OBJECT, 'display' ); + + $default_cat_id = (int) get_option( 'default_category' ); + $pad = str_repeat( '— ', $level ); + $name = ( $name_override ? $name_override : $pad . ' ' . $cat->name ); + + $cat->count = number_format_i18n( $cat->count ); + + $output .= " - + $name "; - } - private static function _get_term_hierarchy($taxonomy) { - if ( !is_taxonomy_hierarchical($taxonomy) ) - return array(); - $children = get_option("{$taxonomy}_children"); - if ( is_array($children) ) - return $children; - - $children = array(); - $terms = get_terms($taxonomy, 'get=all'); - foreach ( $terms as $term ) { - if ( $term->parent > 0 ) - $children[$term->parent][] = $term->term_id; - } - update_option("{$taxonomy}_children", $children); - - return $children; - } - - private static function insert_variable_prepopulate($element_id, $callback=""){ - ?> - + + + + + + + + + + + + + + id; + $type = $field->inputType; + $form_id = $_GET['id']; + $form = GFFormsModel::get_form_meta( $form_id ); + + require_once( GFCommon::get_base_path() . '/form_display.php' ); + $field_content = GFFormDisplay::get_field_content( $field, '', true, $form_id, $form ); + $args['id'] = $id; + $args['type'] = $type; + $args['fieldString'] = $field_content; + $args_json = json_encode( $args ); + die( "EndChangeInputType($args_json);" ); + } + + public static function refresh_field_preview() { + check_ajax_referer( 'rg_refresh_field_preview', 'rg_refresh_field_preview' ); + $field_json = stripslashes_deep( $_POST['field'] ); + $field_properties = GFCommon::json_decode( $field_json, true ); + $field = GF_Fields::create( $field_properties ); + $form_id = $_POST['formId']; + $form = GFFormsModel::get_form_meta( $form_id ); + + require_once( GFCommon::get_base_path() . '/form_display.php' ); + $field_content = GFFormDisplay::get_field_content( $field, '', true, $form_id, $form ); + $args['fieldString'] = $field_content; + $args_json = json_encode( $args ); + die( $args_json ); + } + + public static function delete_custom_choice() { + check_ajax_referer( 'gf_delete_custom_choice', 'gf_delete_custom_choice' ); + RGFormsModel::delete_custom_choice( rgpost( 'name' ) ); + exit(); + } + + public static function save_custom_choice() { + check_ajax_referer( 'gf_save_custom_choice', 'gf_save_custom_choice' ); + RGFormsModel::save_custom_choice( rgpost( 'previous_name' ), rgpost( 'new_name' ), GFCommon::json_decode( rgpost( 'choices' ) ) ); + exit(); + } + + /** + * Saves form meta. Note the special requirements for the meta string. + * + * @param $id + * @param string $form_json A valid JSON string. The JSON is manipulated before decoding and is designed to work together with jQuery.toJSON() rather than json_encode. Avoid using json_encode as it will convert unicode characters into their respective entities with slashes. These slashes get stripped so unicode characters won't survive intact. + * + * @return array + */ + public static function save_form_info( $id, $form_json ) { + global $wpdb; + $form_json = stripslashes( $form_json ); + $form_json = nl2br( $form_json ); + + GFCommon::log_debug( 'GFFormDetail::save_form_info(): Form meta json: ' . $form_json ); + + $form_meta = json_decode( $form_json, true ); + $form_meta = GFFormsModel::convert_field_objects( $form_meta ); + + GFCommon::log_debug( 'GFFormDetail::save_form_info(): Form meta => ' . print_r( $form_meta, true ) ); + + if ( ! $form_meta ) + return array( 'status' => 'invalid_json', 'meta' => null ); + + $form_table_name = $wpdb->prefix . 'rg_form'; + + //Making sure title is not duplicate + $forms = RGFormsModel::get_forms(); + foreach ( $forms as $form ) + if ( strtolower( $form->title ) == strtolower( $form_meta['title'] ) && rgar( $form_meta, 'id' ) != $form->id ) + return array( 'status' => 'duplicate_title', 'meta' => $form_meta ); + + if ( $id > 0 ) { + $form_meta = GFFormsModel::trim_form_meta_values( $form_meta ); + RGFormsModel::update_form_meta( $id, $form_meta ); + + //updating form title + $wpdb->query( $wpdb->prepare( "UPDATE $form_table_name SET title=%s WHERE id=%d", $form_meta['title'], $form_meta['id'] ) ); + + $form_meta = RGFormsModel::get_form_meta( $id ); + + do_action( 'gform_after_save_form', $form_meta, false ); + + return array( 'status' => $id, 'meta' => $form_meta ); + } else { + + //inserting form + $id = RGFormsModel::insert_form( $form_meta['title'] ); + + //updating object's id property + $form_meta['id'] = $id; + + //creating default notification + if ( apply_filters( 'gform_default_notification', true ) ) { + + $default_notification = array( + 'id' => uniqid(), + 'to' => '{admin_email}', + 'name' => __( 'Admin Notification', 'gravityforms' ), + 'event' => 'form_submission', + 'toType' => 'email', + 'subject' => __( 'New submission from', 'gravityforms' ) . ' {form_title}', + 'message' => '{all_fields}', + ); + + $notifications = array( $default_notification['id'] => $default_notification ); + + //updating notifications form meta + RGFormsModel::save_form_notifications( $id, $notifications ); + } + + // add default confirmation when saving a new form + $confirmation_id = uniqid(); + $confirmations = array(); + $confirmations[ $confirmation_id ] = array( + 'id' => $confirmation_id, + 'name' => __( 'Default Confirmation', 'gravityforms' ), + 'isDefault' => true, + 'type' => 'message', + 'message' => __( 'Thanks for contacting us! We will get in touch with you shortly.', 'gravityforms' ), + 'url' => '', + 'pageId' => '', + 'queryString' => '', + ); + GFFormsModel::save_form_confirmations( $id, $confirmations ); + + //updating form meta + RGFormsModel::update_form_meta( $id, $form_meta ); + + $form_meta = RGFormsModel::get_form_meta( $id ); + + do_action( 'gform_after_save_form', $form_meta, true ); + + return array( 'status' => $id * - 1, 'meta' => $form_meta ); + } + } + + public static function save_form() { + + check_ajax_referer( 'rg_save_form', 'rg_save_form' ); + $id = $_POST['id']; + $form_json = $_POST['form']; + + $result = self::save_form_info( $id, $form_json ); + + switch ( rgar( $result, 'status' ) ) { + case 'invalid_json' : + die( 'EndUpdateForm(0);' ); + break; - } - } + case 'duplicate_title' : + die( 'DuplicateTitleMessage();' ); + break; - public static function get_post_category_values(){ - $has_input_name = strtolower(rgpost("inputName")) != "false"; - - $id = !$has_input_name ? rgpost("objectType") . "_rule_value_" . rgpost("ruleIndex") : rgpost("inputName"); - $selected = rgempty("selectedValue") ? 0 : rgpost("selectedValue"); - - $dropdown = wp_dropdown_categories(array("class"=>"gfield_rule_select gfield_rule_value_dropdown gfield_category_dropdown", "orderby"=> "name", "id"=> $id, "name"=> $id, "selected"=>$selected, "hierarchical"=>true, "hide_empty"=>0, "echo"=>false)); - die($dropdown); - } -} -?> \ No newline at end of file + default : + $form_id = $result['status']; + if ( $form_id < 0 ) + die( 'EndInsertForm(' . abs( $form_id ) . ');' ); + else + die( "EndUpdateForm({$form_id});" ); + break; + + } + } + + public static function get_post_category_values() { + $has_input_name = strtolower( rgpost( 'inputName' ) ) != 'false'; + + $id = ! $has_input_name ? rgpost( 'objectType' ) . '_rule_value_' . rgpost( 'ruleIndex' ) : rgpost( 'inputName' ); + $selected = rgempty( 'selectedValue' ) ? 0 : rgpost( 'selectedValue' ); + + $dropdown = wp_dropdown_categories( array( 'class' => 'gfield_rule_select gfield_rule_value_dropdown gfield_category_dropdown', 'orderby' => 'name', 'id' => $id, 'name' => $id, 'selected' => $selected, 'hierarchical' => true, 'hide_empty' => 0, 'echo' => false ) ); + die( $dropdown ); + } + + public static function inline_scripts( $echo = true ) { + $script_str = ''; + $conditional_logic_fields = array(); + $field_settings = array(); + + foreach ( GF_Fields::get_all() as $gf_field ) { + $settings_arr = $gf_field->get_form_editor_field_settings(); + if ( ! is_array( $settings_arr ) || empty( $settings_arr ) ) { + continue; + } + $settings = join( ', .', $settings_arr ); + $settings = '.' . $settings; + $field_settings[ $gf_field->type ] = $settings; + if ( $gf_field->is_conditional_logic_supported() ) { + $conditional_logic_fields[] = $gf_field->type; + } + + $field_script = $gf_field->get_form_editor_inline_script_on_page_render(); + if ( ! empty( $field_script ) ){ + $script_str .= $field_script . PHP_EOL; + } + } + + $script_str .= sprintf( 'fieldSettings = %s;', json_encode( $field_settings ) ) . PHP_EOL; + + $script_str .= sprintf( 'function GetConditionalLogicFields(){return %s;}', json_encode( $conditional_logic_fields ) ) . PHP_EOL; + + + if ( ! empty( $script_str ) ) { + $script_str = sprintf( '', $script_str ); + if ( $echo ) { + echo $script_str; + } + } + + return $script_str; + } + +} \ No newline at end of file diff --git a/form_display.php b/form_display.php index ea0136d..ab9ae85 100644 --- a/form_display.php +++ b/form_display.php @@ -1,2800 +1,2666 @@ = $page_number){ - $failed_validation_page = $page_number; - $is_valid = self::validate($form, $field_values, $page_number, $failed_validation_page); - } + //don't validate when going to previous page or saving for later + if ( ! $saving_for_later && ( empty( $target_page ) || $target_page >= $page_number ) ) { + $is_valid = self::validate( $form, $field_values, $page_number, $failed_validation_page ); + } + + $log_is_valid = $is_valid ? 'Yes' : 'No'; + GFCommon::log_debug( "GFFormDisplay::process_form(): After validation. Is submission valid? {$log_is_valid}." ); - GFCommon::log_debug("After validation. Is submission valid? {$is_valid}"); + //Upload files to temp folder when saving for later, going to the next page or when submitting the form and it failed validation + if ( $saving_for_later || $target_page >= $page_number || ( $target_page == 0 && ! $is_valid ) ) { - //Upload files to temp folder when going to the next page or when submitting the form and it failed validation - if( $target_page >= $page_number || ($target_page == 0 && !$is_valid) ){ + GFCommon::log_debug( 'GFFormDisplay::process_form(): Uploading files...' ); - GFCommon::log_debug("Uploading files..."); + //Uploading files to temporary folder + $files = self::upload_files( $form, $files ); - //Uploading files to temporary folder - $files = self::upload_files($form, $files); - RGFormsModel::$uploaded_files[$form_id] = $files; - } + RGFormsModel::$uploaded_files[ $form_id ] = $files; + } - // Load target page if it did not fail validation or if going to the previous page - if($is_valid){ - $page_number = $target_page; - } - else - { + // Load target page if it did not fail validation or if going to the previous page + if ( ! $saving_for_later && $is_valid ) { + $page_number = $target_page; + } else { $page_number = $failed_validation_page; - } + } + + $confirmation = ''; + if ( ( $is_valid && $page_number == 0 ) || $saving_for_later ) { + + $ajax = isset( $_POST['gform_ajax'] ); + + //adds honeypot field if configured + if ( rgar( $form, 'enableHoneypot' ) ) { + $form['fields'][] = self::get_honeypot_field( $form ); + } + + $failed_honeypot = rgar( $form, 'enableHoneypot' ) && ! self::validate_honeypot( $form ); + + if ( $failed_honeypot ) { + + GFCommon::log_debug( 'GFFormDisplay::process_form(): Failed Honeypot validation. Displaying confirmation and aborting.' ); + + //display confirmation but doesn't process the form when honeypot fails + $confirmation = self::handle_confirmation( $form, $lead, $ajax ); + $is_valid = false; + } elseif ( ! $saving_for_later ) { + + GFCommon::log_debug( 'GFFormDisplay::process_form(): Submission is valid. Moving forward.' ); + + $form = self::update_confirmation( $form ); + + //pre submission action + do_action( 'gform_pre_submission', $form ); + do_action( "gform_pre_submission_{$form['id']}", $form ); + + //pre submission filter + $form = apply_filters( "gform_pre_submission_filter_{$form['id']}", apply_filters( 'gform_pre_submission_filter', $form ) ); + + //handle submission + $confirmation = self::handle_submission( $form, $lead, $ajax ); + + //after submission hook + do_action( 'gform_after_submission', $lead, $form ); + do_action( "gform_after_submission_{$form['id']}", $lead, $form ); + + } elseif ( $saving_for_later ) { + GFCommon::log_debug( 'GFFormDisplay::process_form(): Saving for later.' ); + $lead = GFFormsModel::get_current_lead(); + $form = self::update_confirmation( $form, $lead, 'form_saved' ); + + $confirmation = rgar( $form['confirmation'], 'message' ); + $nl2br = rgar( $form['confirmation'], 'disableAutoformat' ) ? false : true; + $confirmation = GFCommon::replace_variables( $confirmation, $form, $lead, false, true, $nl2br ); + + $form_unique_id = GFFormsModel::get_form_unique_id( $form_id ); + $ip = GFFormsModel::get_ip(); + $source_url = GFFormsModel::get_current_page_url(); + $resume_token = rgpost( 'gform_resume_token' ); + $resume_token = GFFormsModel::save_incomplete_submission( $form, $lead, $field_values, $page_number, $files, $form_unique_id, $ip, $source_url, $resume_token ); + + $notifications_to_send = GFCommon::get_notifications_to_send( 'form_saved', $form, $lead ); + + $log_notification_event = empty( $notifications_to_send ) ? 'No notifications to process' : 'Processing notifications'; + GFCommon::log_debug( "GFFormDisplay::process_form(): {$log_notification_event} for form_saved event." ); + + foreach ( $notifications_to_send as $notification ) { + if ( isset( $notification['isActive'] ) && ! $notification['isActive'] ) { + GFCommon::log_debug( "GFFormDisplay::process_form(): Notification is inactive, not processing notification (#{$notification['id']} - {$notification['name']})." ); + continue; + } + $notification['message'] = self::replace_save_variables( $notification['message'], $form, $resume_token ); + GFCommon::send_notification( $notification, $form, $lead ); + } + self::set_submission_if_null( $form_id, 'saved_for_later', true ); + self::set_submission_if_null( $form_id, 'resume_token', $resume_token ); + GFCommon::log_debug( 'GFFormDisplay::process_form(): Saved incomplete submission.' ); + + } + + if ( is_array( $confirmation ) && isset( $confirmation['redirect'] ) ){ + header( "Location: {$confirmation["redirect"]}" ); + do_action( 'gform_post_submission', $lead, $form ); + do_action( "gform_post_submission_{$form["id"]}", $lead, $form ); + exit; + } + } + + + + if ( ! isset( self::$submission[ $form_id ] ) ) { + self::$submission[ $form_id ] = array(); + } + + self::set_submission_if_null( $form_id, 'is_valid', $is_valid ); + self::set_submission_if_null( $form_id, 'form', $form ); + self::set_submission_if_null( $form_id, 'lead', $lead ); + self::set_submission_if_null( $form_id, 'confirmation_message', $confirmation ); + self::set_submission_if_null( $form_id, 'page_number', $page_number ); + self::set_submission_if_null( $form_id, 'source_page_number', $source_page_number ); + + do_action( 'gform_post_process', $form, $page_number, $source_page_number ); + do_action( "gform_post_process_{$form['id']}", $form, $page_number, $source_page_number ); + + } + + private static function set_submission_if_null( $form_id, $key, $val ) { + if ( ! isset( self::$submission[ $form_id ][ $key ] ) ) { + self::$submission[ $form_id ][ $key ] = $val; + } + } + + + private static function upload_files( $form, $files ) { + + //Creating temp folder if it does not exist + $target_path = RGFormsModel::get_upload_path( $form['id'] ) . '/tmp/'; + wp_mkdir_p( $target_path ); + + foreach ( $form['fields'] as $field ) { + $input_name = "input_{$field->id}"; + + //skip fields that are not file upload fields or that don't have a file to be uploaded or that have failed validation + $input_type = RGFormsModel::get_input_type( $field ); + if ( ! in_array( $input_type, array( 'fileupload', 'post_image' ) ) || $field->multipleFiles ) { + continue; + } + + if ( $field->failed_validation || empty( $_FILES[ $input_name ]['name'] )) { + GFCommon::log_debug( "GFFormDisplay::upload_files(): Skipping field: {$field->label}({$field->id} - {$field->type})." ); + continue; + } + + $file_info = RGFormsModel::get_temp_filename( $form['id'], $input_name ); + GFCommon::log_debug( 'GFFormDisplay::upload_files(): Temp file info: ' . print_r( $file_info, true ) ); + + if ( $file_info && move_uploaded_file( $_FILES[ $input_name ]['tmp_name'], $target_path . $file_info['temp_filename'] ) ) { + GFFormsModel::set_permissions( $target_path . $file_info['temp_filename'] ); + $files[ $input_name ] = $file_info['uploaded_filename']; + GFCommon::log_debug( "GFFormDisplay::upload_files(): File uploaded successfully: {$file_info['uploaded_filename']}" ); + } else { + GFCommon::log_error( "GFFormDisplay::upload_files(): File could not be uploaded: tmp_name: {$_FILES[ $input_name ]['tmp_name']} - target location: " . $target_path . $file_info['temp_filename'] ); + } + } + return $files; + } + + public static function get_state( $form, $field_values ) { + $product_fields = array(); + foreach ( $form['fields'] as $field ) { + /* @var GF_Field $field */ + if ( GFCommon::is_product_field( $field->type ) || $field->type == 'donation' ) { + $value = RGFormsModel::get_field_value( $field, $field_values, false ); + $value = $field->get_value_default_if_empty( $value ); + + switch ( $field->inputType ) { + case 'calculation' : + case 'singleproduct' : + case 'hiddenproduct' : + $price = ! is_array( $value ) || empty( $value[ $field->id . '.2' ] ) ? $field->basePrice : $value[ $field->id . '.2' ]; + if ( empty( $price ) ) { + $price = 0; + } + + $price = GFCommon::to_number( $price ); + + $product_name = ! is_array( $value ) || empty( $value[ $field->id . '.1' ] ) ? $field->label : $value[ $field->id . '.1' ]; + + $product_fields[ $field->id . '.1' ] = wp_hash( GFFormsModel::maybe_trim_input( $product_name, $form['id'], $field ) ); + $product_fields[ $field->id . '.2' ] = wp_hash( GFFormsModel::maybe_trim_input( $price, $form['id'], $field ) ); + break; + + case 'singleshipping' : + $price = ! empty( $value ) ? $value : $field->basePrice; + $price = ! empty( $price ) ? GFCommon::to_number( $price ) : 0; + + $product_fields[ $field->id ] = wp_hash( GFFormsModel::maybe_trim_input( $price, $form['id'], $field ) ); + break; + case 'radio' : + case 'select' : + $product_fields[ $field->id ] = array(); + foreach ( $field->choices as $choice ) { + $field_value = ! empty( $choice['value'] ) || $field->enableChoiceValue ? $choice['value'] : $choice['text']; + if ( $field->enablePrice ) { + $price = rgempty( 'price', $choice ) ? 0 : GFCommon::to_number( rgar( $choice, 'price' ) ); + $field_value .= '|' . $price; + } + + $product_fields[ $field->id ][] = wp_hash( GFFormsModel::maybe_trim_input( $field_value, $form['id'], $field ) ); + } + break; + case 'checkbox' : + $index = 1; + foreach ( $field->choices as $choice ) { + $field_value = ! empty( $choice['value'] ) || $field->enableChoiceValue ? $choice['value'] : $choice['text']; + if ( $field->enablePrice ) { + $price = rgempty( 'price', $choice ) ? 0 : GFCommon::to_number( rgar( $choice, 'price' ) ); + $field_value .= '|' . $price; + } + + if ( $index % 10 == 0 ) { //hack to skip numbers ending in 0. so that 5.1 doesn't conflict with 5.10 + $index ++; + } + + $product_fields[ $field->id . '.' . $index ++ ] = wp_hash( GFFormsModel::maybe_trim_input( $field_value, $form['id'], $field ) ); + } + break; + + } + } + } + + $hash = json_encode( $product_fields ); + $checksum = wp_hash( crc32( $hash ) ); + + return base64_encode( json_encode( array( $hash, $checksum ) ) ); + + } + + private static function has_pages( $form ) { + return GFCommon::has_pages( $form ); + } + + private static function has_character_counter( $form ) { + + if ( ! is_array( $form['fields'] ) ) { + return false; + } + + foreach ( $form['fields'] as $field ) { + if ( $field->maxLength && ! $field->inputMask ) { + return true; + } + } + + return false; + } + + private static function has_placeholder( $form ) { + + if ( ! is_array( $form['fields'] ) ) { + return false; + } + + foreach ( $form['fields'] as $field ) { + if ( $field->placeholder != '' ) { + return true; + } + if ( is_array( $field->inputs ) ) { + foreach ( $field->inputs as $input ) { + if ( rgar( $input, 'placeholder' ) != '' ) { + return true; + } + } + } + } + + return false; + } + + + private static function has_enhanced_dropdown( $form ) { + + if ( ! is_array( $form['fields'] ) ) { + return false; + } + + foreach ( $form['fields'] as $field ) { + if ( in_array( RGFormsModel::get_input_type( $field ), array( 'select', 'multiselect' ) ) && $field->enableEnhancedUI ) { + return true; + } + } + + return false; + } + + private static function has_password_strength( $form ) { + + if ( ! is_array( $form['fields'] ) ) { + return false; + } + + foreach ( $form['fields'] as $field ) { + if ( $field->type == 'password' && $field->passwordStrengthEnabled ) { + return true; + } + } + + return false; + } + + private static function has_other_choice( $form ) { + + if ( ! is_array( $form['fields'] ) ) { + return false; + } + + foreach ( $form['fields'] as $field ) { + if ( $field->type == 'radio' && $field->enableOtherChoice ) { + return true; + } + } + + return false; + } + + + public static function get_target_page( $form, $current_page, $field_values ) { + $page_number = RGForms::post( "gform_target_page_number_{$form['id']}" ); + $page_number = ! is_numeric( $page_number ) ? 1 : $page_number; + + $direction = $page_number >= $current_page ? 1 : - 1; + + //Finding next page that is not hidden by conditional logic + while ( RGFormsModel::is_page_hidden( $form, $page_number, $field_values ) ) { + $page_number += $direction; + } + + //If all following pages are hidden, submit the form + if ( $page_number > self::get_max_page_number( $form ) ) { + $page_number = 0; + } + + return $page_number; + } + + public static function get_source_page( $form_id ) { + $page_number = RGForms::post( "gform_source_page_number_{$form_id}" ); + + return ! is_numeric( $page_number ) ? 1 : $page_number; + } + + public static function set_current_page( $form_id, $page_number ) { + self::$submission[ $form_id ]['page_number'] = $page_number; + } + + public static function get_current_page( $form_id ) { + $page_number = isset( self::$submission[ $form_id ] ) ? intval( self::$submission[ $form_id ]['page_number'] ) : 1; + + return $page_number; + } + + private static function is_page_active( $form_id, $page_number ) { + return intval( self::get_current_page( $form_id ) ) == intval( $page_number ); + } + + /** + * Determine if the last page for the current form object is being submitted or rendered (depending on the provided $mode). + * + * @param array $form A Gravity Forms form object. + * @param string $mode Mode to check for: 'submit' or 'render' + * + * @return boolean + */ + public static function is_last_page( $form, $mode = 'submit' ) { + + $page_number = self::get_source_page( $form['id'] ); + $field_values = GFForms::post( 'gform_field_values' ); + $target_page = self::get_target_page( $form, $page_number, $field_values ); + + if ( $mode == 'render' ) { + $is_last_page = $target_page == self::get_max_page_number( $form ); + } else { + $is_last_page = (string) $target_page === '0'; + } + + return $is_last_page; + } + + private static function get_limit_period_dates( $period ) { + if ( empty( $period ) ) { + return array( 'start_date' => null, 'end_date' => null ); + } + + switch ( $period ) { + case 'day' : + return array( + 'start_date' => gmdate( 'Y-m-d' ), + 'end_date' => gmdate( 'Y-m-d 23:59:59' ) + ); + break; + + case 'week' : + return array( + 'start_date' => gmdate( 'Y-m-d', strtotime( 'Monday this week' ) ), + 'end_date' => gmdate( 'Y-m-d 23:59:59', strtotime( 'next Sunday' ) ) + ); + break; + + case 'month' : + $month_start = gmdate( 'Y-m-1' ); + + return array( + 'start_date' => $month_start, + 'end_date' => gmdate( 'Y-m-d H:i:s', strtotime( "{$month_start} +1 month -1 second" ) ) + ); + break; + + case 'year' : + return array( + 'start_date' => gmdate( 'Y-1-1' ), + 'end_date' => gmdate( 'Y-12-31 23:59:59' ) + ); + break; + } + } + + public static function get_form( $form_id, $display_title = true, $display_description = true, $force_display = false, $field_values = null, $ajax = false, $tabindex = 1 ) { + + // provides the ability to modify the options used to display the form + $form_args = apply_filters( 'gform_form_args', compact( 'form_id', 'display_title', 'display_description', 'force_display', 'field_values', 'ajax', 'tabindex' ) ); + extract( $form_args ); + + //looking up form id by form name + if ( ! is_numeric( $form_id ) ) { + $form_id = RGFormsModel::get_form_id( $form_id ); + } + + //reading form metadata + $form = RGFormsModel::get_form_meta( $form_id, true ); + + $action = remove_query_arg( 'gf_token' ); + + //disable ajax if form has a reCAPTCHA field (not supported). + if ( $ajax && self::has_recaptcha_field( $form ) ) { + $ajax = false; + } + + if ( isset( $_POST['gform_send_resume_link'] ) ) { + $save_email_confirmation = self::handle_save_email_confirmation( $form, $ajax ); + if ( is_wp_error( $save_email_confirmation ) ) { // Failed email validation + $resume_token = rgpost('gform_resume_token'); + $incomplete_submission_info = GFFormsModel::get_incomplete_submission_values( rgpost('gform_resume_token') ); + if ( $incomplete_submission_info['form_id'] == $form_id ) { + $submission_details_json = $incomplete_submission_info['submission']; + $submission_details = json_decode( $submission_details_json, true ); + $partial_entry = $submission_details['partial_entry']; + $form = self::update_confirmation( $form, $partial_entry, 'form_saved' ); + $confirmation_message = rgar( $form['confirmation'], 'message' ); + $nl2br = rgar( $form['confirmation'], 'disableAutoformat' ) ? false : true; + $confirmation_message = GFCommon::replace_variables( $confirmation_message, $form, $partial_entry, false, true, $nl2br ); + return self::handle_save_confirmation( $form, $resume_token, $confirmation_message, $ajax ); + } + } else { + return $save_email_confirmation; + } + } + + $is_postback = false; + $is_valid = true; + $confirmation_message = ''; + + //If form was submitted, read variables set during form submission procedure + $submission_info = isset( self::$submission[ $form_id ] ) ? self::$submission[ $form_id ] : false; + + if ( rgar( $submission_info, 'saved_for_later' ) == true ) { + $resume_token = $submission_info['resume_token']; + $confirmation_message = rgar( $submission_info, 'confirmation_message' ); + + return self::handle_save_confirmation( $form, $resume_token, $confirmation_message, $ajax ); + } + + $partial_entry = $submitted_values = false; + if ( isset( $_GET['gf_token'] ) ) { + $incomplete_submission_info = GFFormsModel::get_incomplete_submission_values( $_GET['gf_token'] ); + if ( $incomplete_submission_info['form_id'] == $form_id ) { + $submission_details_json = $incomplete_submission_info['submission']; + $submission_details = json_decode( $submission_details_json, true ); + $partial_entry = $submission_details['partial_entry']; + $submitted_values = $submission_details['submitted_values']; + $field_values = $submission_details['field_values']; + GFFormsModel::$unique_ids[ $form_id ] = $submission_details['gform_unique_id']; + GFFormsModel::$uploaded_files[ $form_id ] = $submission_details['files']; + self::set_submission_if_null( $form_id, 'resuming_incomplete_submission', true ); + self::set_submission_if_null( $form_id, 'form_id', $form_id ); + self::set_submission_if_null( $form_id, 'page_number', $submission_details['page_number'] ); + } + } + + if ( ! is_array( $partial_entry ) ) { + $view_counter_disabled = apply_filters( 'gform_disable_view_counter', false ); + $view_counter_disabled = apply_filters( "gform_disable_view_counter_{$form_id}", $view_counter_disabled ); + + if ( $submission_info ) { + $is_postback = true; + $is_valid = rgar( $submission_info, 'is_valid' ) || rgar( $submission_info, 'is_confirmation' ); + $form = $submission_info['form']; + $lead = $submission_info['lead']; + $confirmation_message = rgget( 'confirmation_message', $submission_info ); + + if ( $is_valid && ! RGForms::get( 'is_confirmation', $submission_info ) ) { + + if ( $submission_info['page_number'] == 0 ) { + //post submission hook + do_action( 'gform_post_submission', $lead, $form ); + do_action( "gform_post_submission_{$form['id']}", $lead, $form ); + } else { + //change page hook + do_action( 'gform_post_paging', $form, $submission_info['source_page_number'], $submission_info['page_number'] ); + do_action( "gform_post_paging_{$form['id']}", $form, $submission_info['source_page_number'], $submission_info['page_number'] ); + } + } + } elseif ( ! current_user_can( 'administrator' ) && ! $view_counter_disabled ) { + RGFormsModel::insert_form_view( $form_id, $_SERVER['REMOTE_ADDR'] ); + } + } + + if ( rgar( $form, 'enableHoneypot' ) ) { + $form['fields'][] = self::get_honeypot_field( $form ); + } + + //Fired right before the form rendering process. Allow users to manipulate the form object before it gets displayed in the front end + $form = apply_filters( "gform_pre_render_{$form_id}", apply_filters( 'gform_pre_render', $form, $ajax, $field_values ), $ajax, $field_values ); + + if ( $form == null ) { + return '

    ' . __( 'Oops! We could not locate your form.', 'gravityforms' ) . '

    '; + } + + $has_pages = self::has_pages( $form ); + + //calling tab index filter + GFCommon::$tab_index = apply_filters( "gform_tabindex_{$form_id}", apply_filters( 'gform_tabindex', $tabindex, $form ), $form ); + + //Don't display inactive forms + if ( ! $force_display && ! $is_postback ) { + + $form_info = RGFormsModel::get_form( $form_id ); + if ( empty( $form_info ) || ! $form_info->is_active ) { + return ''; + } + + // If form requires login, check if user is logged in + if ( rgar( $form, 'requireLogin' ) ) { + if ( ! is_user_logged_in() ) { + return empty( $form['requireLoginMessage'] ) ? '

    ' . __( 'Sorry. You must be logged in to view this form.', 'gravityforms' ) . '

    ' : '

    ' . GFCommon::gform_do_shortcode( $form['requireLoginMessage'] ) . '

    '; + } + } + } + + // show the form regardless of the following validations when force display is set to true + if ( ! $force_display || $is_postback ) { + + $form_schedule_validation = self::validate_form_schedule( $form ); + + // if form schedule validation fails AND this is not a postback, display the validation error + // if form schedule validation fails AND this is a postback, make sure is not a valid submission (enables display of confirmation message) + if ( ( $form_schedule_validation && ! $is_postback ) || ( $form_schedule_validation && $is_postback && ! $is_valid ) ) { + return $form_schedule_validation; + } + + $entry_limit_validation = self::validate_entry_limit( $form ); + + // refer to form schedule condition notes above + if ( ( $entry_limit_validation && ! $is_postback ) || ( $entry_limit_validation && $is_postback && ! $is_valid ) ) { + return $entry_limit_validation; + } + } + + $form_string = ''; + + //When called via a template, this will enqueue the proper scripts + //When called via a shortcode, this will be ignored (too late to enqueue), but the scripts will be enqueued via the enqueue_scripts event + self::enqueue_form_scripts( $form, $ajax ); + + $is_form_editor = GFCommon::is_form_editor(); + $is_entry_detail = GFCommon::is_entry_detail(); + $is_admin = $is_form_editor || $is_entry_detail; + + if ( empty( $confirmation_message ) ) { + $wrapper_css_class = GFCommon::get_browser_class() . ' gform_wrapper'; + + if ( ! $is_valid ) { + $wrapper_css_class .= ' gform_validation_error'; + } + + //Hiding entire form if conditional logic is on to prevent 'hidden' fields from blinking. Form will be set to visible in the conditional_logic.php after the rules have been applied. + $style = self::has_conditional_logic( $form ) ? "style='display:none'" : ''; + $custom_wrapper_css_class = ! empty( $form['cssClass'] ) ? " {$form['cssClass']}_wrapper" : ''; + $form_string .= " +
    '; + + $default_anchor = $has_pages || $ajax ? true : false; + $use_anchor = apply_filters( "gform_confirmation_anchor_{$form['id']}", apply_filters( 'gform_confirmation_anchor', $default_anchor ) ); + if ( $use_anchor !== false ) { + $form_string .= ""; + $action .= "#gf_$form_id"; + } + $target = $ajax ? "target='gform_ajax_frame_{$form_id}'" : ''; + + $form_css_class = ! empty( $form['cssClass'] ) ? "class='{$form['cssClass']}'" : ''; + + $action = esc_url( $action ); + $form_string .= apply_filters( "gform_form_tag_{$form_id}", apply_filters( 'gform_form_tag', "
    ", $form ), $form ); + + if ( $display_title || $display_description ) { + $form_string .= " +
    "; + if ( $display_title ) { + $form_string .= " +

    " . $form['title'] . '

    '; + } + if ( $display_description ) { + $form_string .= " + " . rgar( $form, 'description' ) . ''; + } + $form_string .= ' +
    '; + } + + $current_page = self::get_current_page( $form_id ); + + if ( $has_pages && ! $is_admin ) { + + if ( $form['pagination']['type'] == 'percentage' ) { + $form_string .= self::get_progress_bar( $form, $form_id, $confirmation_message ); + } else if ( $form['pagination']['type'] == 'steps' ) { + $form_string .= " +
    "; + $pages = isset( $form['pagination']['pages'] ) ? $form['pagination']['pages'] : array(); + for ( $i = 0, $count = sizeof( $pages ); $i < $count; $i ++ ) { + $step_number = $i + 1; + $active_class = $step_number == $current_page ? ' gf_step_active' : ''; + $first_class = $i == 0 ? ' gf_step_first' : ''; + $last_class = $i + 1 == $count ? ' gf_step_last' : ''; + $complete_class = $step_number < $current_page ? ' gf_step_completed' : ''; + $previous_class = $step_number + 1 == $current_page ? ' gf_step_previous' : ''; + $next_class = $step_number - 1 == $current_page ? ' gf_step_next' : ''; + $pending_class = $step_number > $current_page ? ' gf_step_pending' : ''; + $classes = 'gf_step' . $active_class . $first_class . $last_class . $complete_class . $previous_class . $next_class . $pending_class; + + $classes = GFCommon::trim_all( $classes ); + + $form_string .= " +
    {$step_number} {$pages[ $i ]}
    "; + } + + $form_string .= " +
    +
    "; + } + } + + if ( $is_postback && ! $is_valid ) { + $validation_message = "
    " . __( 'There was a problem with your submission.', 'gravityforms' ) . ' ' . __( 'Errors have been highlighted below.', 'gravityforms' ) . '
    '; + $form_string .= apply_filters( "gform_validation_message_{$form['id']}", apply_filters( 'gform_validation_message', $validation_message, $form ), $form ); + } + + $form_string .= " +
    "; + + //add first page if this form has any page fields + if ( $has_pages ) { + $style = self::is_page_active( $form_id, 1 ) ? '' : "style='display:none;'"; + $class = ! empty( $form['firstPageCssClass'] ) ? " {$form['firstPageCssClass']}" : ''; + $form_string .= "
    +
    "; + } + + $description_class = rgar( $form, 'descriptionPlacement' ) == 'above' ? 'description_above' : 'description_below'; + $sublabel_class = rgar( $form, 'subLabelPlacement' ) == 'above' ? 'form_sublabel_above' : 'form_sublabel_below'; + + + $form_string .= "
      "; + + if ( is_array( $form['fields'] ) ) { + foreach ( $form['fields'] as $field ) { + /* @var GF_Field $field */ + $field->conditionalLogicFields = self::get_conditional_logic_fields( $form, $field->id ); + + if ( is_array( $submitted_values ) ) { + $field_value = $submitted_values[ $field->id ]; + } else { + $field_value = GFFormsModel::get_field_value( $field, $field_values ); + } + + $form_string .= self::get_field( $field, $field_value, false, $form, $field_values ); + } + } + $form_string .= ' +
    '; + + if ( $has_pages ) { + $previous_button = self::get_form_button( $form['id'], "gform_previous_button_{$form['id']}", $form['lastPageButton'], __( 'Previous', 'gravityforms' ), 'gform_previous_button', __( 'Previous Page', 'gravityforms' ), self::get_current_page( $form_id ) - 1 ); + $previous_button = apply_filters( 'gform_previous_button', $previous_button, $form ); + $previous_button = apply_filters( "gform_previous_button_{$form['id']}", $previous_button, $form ); + $form_string .= '
    ' . self::gform_footer( $form, 'gform_page_footer ' . $form['labelPlacement'], $ajax, $field_values, $previous_button, $display_title, $display_description, $is_postback ) . ' +
    '; //closes gform_page + } + + $form_string .= '
    '; //closes gform_body + + //suppress form footer for multi-page forms (footer will be included on the last page + if ( ! $has_pages ) { + $form_string .= self::gform_footer( $form, 'gform_footer ' . $form['labelPlacement'], $ajax, $field_values, '', $display_title, $display_description, $tabindex ); + } + + $form_string .= ' +
    +
    '; + + if ( $ajax && $is_postback ) { + global $wp_scripts; + + $form_string = apply_filters( + 'gform_ajax_iframe_content', '' . + "" . $form_string . '' + ); + + } + + if ( $ajax && ! $is_postback ) { + $spinner_url = apply_filters( "gform_ajax_spinner_url_{$form_id}", apply_filters( 'gform_ajax_spinner_url', GFCommon::get_base_url() . '/images/spinner.gif', $form ), $form ); + $scroll_position = array( 'default' => '', 'confirmation' => '' ); + + if ( $use_anchor !== false ) { + $scroll_position['default'] = is_numeric( $use_anchor ) ? 'jQuery(document).scrollTop(' . intval( $use_anchor ) . ');' : "jQuery(document).scrollTop(jQuery('#gform_wrapper_{$form_id}').offset().top);"; + $scroll_position['confirmation'] = is_numeric( $use_anchor ) ? 'jQuery(document).scrollTop(' . intval( $use_anchor ) . ');' : "jQuery(document).scrollTop(jQuery('#gforms_confirmation_message_{$form_id}').offset().top);"; + } + + $iframe_style = defined( 'GF_DEBUG' ) && GF_DEBUG ? 'display:block;width:600px;height:300px;border:1px solid #eee;' : 'display:none;width:0px;height:0px;'; + + $form_string .= " + + '; + } + + $is_first_load = ! $is_postback; + + if ( ( ! $ajax || $is_first_load ) ) { + + self::register_form_init_scripts( $form, $field_values, $ajax ); + + if ( apply_filters( 'gform_init_scripts_footer', false ) ) { + add_action( 'wp_footer', create_function( '', 'GFFormDisplay::footer_init_scripts(' . $form['id'] . ');' ), 20 ); + add_action( 'gform_preview_footer', create_function( '', 'GFFormDisplay::footer_init_scripts(' . $form['id'] . ');' ) ); + } else { + $form_string .= self::get_form_init_scripts( $form ); + $form_string .= "'; + } + } + + return apply_filters( "gform_get_form_filter_{$form['id']}", apply_filters( 'gform_get_form_filter', $form_string, $form ), $form ); + } else { + $progress_confirmation = ''; + + //check admin setting for whether the progress bar should start at zero + $start_at_zero = rgars( $form, 'pagination/display_progressbar_on_confirmation' ); + $start_at_zero = apply_filters( 'gform_progressbar_start_at_zero', $start_at_zero, $form ); + + //show progress bar on confirmation + if ( $start_at_zero && $has_pages && ! $is_admin && ( $form['confirmation']['type'] == 'message' && $form['pagination']['type'] == 'percentage' ) ) { + $progress_confirmation = self::get_progress_bar( $form, $form_id, $confirmation_message ); + if ( $ajax ) { + $progress_confirmation = apply_filters( 'gform_ajax_iframe_content', "" . $progress_confirmation . '' ); + } + } else { + //return regular confirmation message + if ( $ajax ) { + $progress_confirmation = apply_filters( 'gform_ajax_iframe_content', "" . $confirmation_message . '' ); + } else { + $progress_confirmation = $confirmation_message; + } + } + + return $progress_confirmation; + } + } + + public static function footer_init_scripts( $form_id ) { + global $_init_forms; + + $form = RGFormsModel::get_form_meta( $form_id ); + $form_string = self::get_form_init_scripts( $form ); + $current_page = self::get_current_page( $form_id ); + $form_string .= "'; + + $form_string = apply_filters( 'gform_footer_init_scripts_filter', $form_string, $form, $current_page ); + $form_string = apply_filters( 'gform_footer_init_scripts_filter_' . $form['id'], $form_string, $form, $current_page ); + + if ( ! isset( $_init_forms[ $form_id ] ) ) { + echo $form_string; + if ( ! is_array( $_init_forms ) ) { + $_init_forms = array(); + } + + $_init_forms[ $form_id ] = true; + } + } + + public static function add_init_script( $form_id, $script_name, $location, $script ) { + $key = $script_name . '_' . $location; + + if ( ! isset( self::$init_scripts[ $form_id ] ) ) { + self::$init_scripts[ $form_id ] = array(); + } + + //add script if it hasn't been added before + if ( ! array_key_exists( $key, self::$init_scripts[ $form_id ] ) ) { + self::$init_scripts[ $form_id ][ $key ] = array( 'location' => $location, 'script' => $script ); + } + } + + private static function get_form_button( $form_id, $button_input_id, $button, $default_text, $class, $alt, $target_page_number, $onclick = '' ) { + + $tabindex = GFCommon::get_tabindex(); + + $input_type = 'submit'; + + if ( ! empty( $target_page_number ) ) { + $onclick = "onclick='jQuery(\"#gform_target_page_number_{$form_id}\").val(\"{$target_page_number}\"); {$onclick} jQuery(\"#gform_{$form_id}\").trigger(\"submit\",[true]); '"; + $input_type = 'button'; + } else { + // prevent multiple form submissions when button is pressed multiple times + if ( GFFormsModel::is_html5_enabled() ) { + $set_submitting = "if( !jQuery(\"#gform_{$form_id}\")[0].checkValidity || jQuery(\"#gform_{$form_id}\")[0].checkValidity()){window[\"gf_submitting_{$form_id}\"]=true;}"; + } else { + $set_submitting = "window[\"gf_submitting_{$form_id}\"]=true;"; + } + + $onclick_submit = $button['type'] == 'link' ? "jQuery(\"#gform_{$form_id}\").trigger(\"submit\",[true]);" : ''; + + $onclick = "onclick='if(window[\"gf_submitting_{$form_id}\"]){return false;} {$set_submitting} {$onclick} {$onclick_submit}'"; + } + + if ( $button['type'] == 'text' || $button['type'] == 'link' || empty( $button['imageUrl'] ) ) { + $button_text = ! empty( $button['text'] ) ? $button['text'] : $default_text; + if ( $button['type'] == 'link' ) { + $button_input = "{$button_text}"; + } else { + $class .= ' button'; + $button_input = ""; + } + } else { + $imageUrl = $button['imageUrl']; + $class .= ' gform_image_button'; + $button_input = ""; + } + + return $button_input; + } + + private static function gform_footer( $form, $class, $ajax, $field_values, $previous_button, $display_title, $display_description, $tabindex = 1 ) { + $form_id = $form['id']; + $footer = " +
    "; + $button_input = self::get_form_button( $form['id'], "gform_submit_button_{$form['id']}", $form['button'], __( 'Submit', 'gravityforms' ), 'gform_button', __( 'Submit', 'gravityforms' ), 0 ); + $button_input = apply_filters( 'gform_submit_button', $button_input, $form ); + $button_input = apply_filters( "gform_submit_button_{$form_id}", $button_input, $form ); + + $save_button = rgars( $form, 'save/enabled' ) ? self::get_form_button( $form_id, "gform_save_{$form_id}", $form['save']['button'], rgars( $form, 'save/button/text' ), 'gform_save_link', rgars( $form, 'save/button/text' ), 0, "jQuery(\"#gform_save_{$form_id}\").val(1);" ) : ''; + + $footer .= $previous_button . ' ' . $button_input . ' ' . $save_button; + + if ( $ajax ) { + $footer .= ""; + } + + $current_page = self::get_current_page( $form_id ); + $next_page = $current_page + 1; + $next_page = $next_page > self::get_max_page_number( $form ) ? 0 : $next_page; + $field_values_str = is_array( $field_values ) ? http_build_query( $field_values ) : $field_values; + $files_input = ''; + if ( GFCommon::has_multifile_fileupload_field( $form ) || ! empty( RGFormsModel::$uploaded_files[ $form_id ] ) ) { + $files = ! empty( RGFormsModel::$uploaded_files[ $form_id ] ) ? GFCommon::json_encode( RGFormsModel::$uploaded_files[ $form_id ] ) : ''; + $files_input = ""; + } + $save_inputs = ''; + if ( rgars( $form, 'save/enabled' ) ) { + $resume_token = isset( $_POST['gform_resume_token'] ) ? $_POST['gform_resume_token'] : rgget( 'gf_token' ); + $save_inputs = " + "; + } + + $unique_id = isset( self::$submission[ $form_id ] ) && rgar( self::$submission[ $form_id ], 'resuming_incomplete_submission' ) == true ? rgar( GFFormsModel::$unique_ids, $form_id ) : GFFormsModel::get_form_unique_id( $form_id ); + $footer .= " + + + {$save_inputs} + + + + + + {$files_input} +
    "; + + return $footer; + } + + private static function get_max_page_number( $form ) { + $page_number = 0; + foreach ( $form['fields'] as $field ) { + if ( $field->type == 'page' ) { + $page_number ++; + } + } + + return $page_number == 0 ? 0 : $page_number + 1; + } + + + private static function get_honeypot_field( $form ) { + $max_id = self::get_max_field_id( $form ); + $labels = self::get_honeypot_labels(); + $properties = array( 'type' => 'honeypot', 'label' => $labels[ rand( 0, 3 ) ], 'id' => $max_id + 1, 'cssClass' => 'gform_validation_container', 'description' => __( 'This field is for validation purposes and should be left unchanged.', 'gravityforms' ) ); + $field = GF_Fields::create( $properties ); + + return $field; + } + + private static function get_max_field_id( $form ) { + $max = 0; + foreach ( $form['fields'] as $field ) { + if ( floatval( $field->id ) > $max ) { + $max = floatval( $field->id ); + } + } + + return $max; + } + + private static function get_honeypot_labels() { + return array( 'Name', 'Email', 'Phone', 'Comments' ); + } + + /** + * Used to determine the required validation result. + * + * @param GF_Field $field + * @param int $form_id + * + * @return bool + */ + public static function is_empty( $field, $form_id = 0 ) { + + if ( empty( $_POST[ 'is_submit_' . $field->formId ] ) ) { + return true; + } + + return $field->is_value_submission_empty( $form_id ); + } + + private static function validate_honeypot( $form ) { + $honeypot_id = self::get_max_field_id( $form ); + + return rgempty( "input_{$honeypot_id}" ); + } + + public static function handle_submission( $form, &$lead, $ajax = false ){ + + $lead_id = apply_filters( "gform_entry_id_pre_save_lead{$form['id']}", apply_filters( 'gform_entry_id_pre_save_lead', null, $form ), $form ); + + if ( ! empty( $lead_id ) ) { + if ( empty( $lead ) ) { + $lead = array(); + } + $lead['id'] = $lead_id; + } + + //creating entry in DB + RGFormsModel::save_lead( $form, $lead ); + + //reading entry that was just saved + $lead = RGFormsModel::get_lead( $lead['id'] ); + + $lead = GFFormsModel::set_entry_meta( $lead, $form ); + + //if Akismet plugin is installed, run lead through Akismet and mark it as Spam when appropriate + $is_spam = GFCommon::akismet_enabled( $form['id'] ) && GFCommon::is_akismet_spam( $form, $lead ); + $is_spam = apply_filters( 'gform_entry_is_spam', $is_spam, $form, $lead ); + $is_spam = apply_filters( "gform_entry_is_spam_{$form['id']}", $is_spam, $form, $lead ); + + if ( GFCommon::spam_enabled( $form['id'] ) ) { + GFCommon::log_debug( 'GFFormDisplay::handle_submission(): Akismet integration enabled OR gform_entry_is_spam hook in use.' ); + $log_is_spam = $is_spam ? 'Yes' : 'No'; + GFCommon::log_debug( "GFFormDisplay::handle_submission(): Is entry considered spam? {$log_is_spam}." ); + } + + if ( $is_spam ) { + + //marking entry as spam + RGFormsModel::update_lead_property( $lead['id'], 'status', 'spam', false, true ); + $lead['status'] = 'spam'; + + } + + do_action( 'gform_entry_created', $lead, $form ); + $lead = apply_filters( 'gform_entry_post_save', $lead, $form ); + + RGFormsModel::set_current_lead( $lead ); + + if ( ! $is_spam ) { + GFCommon::create_post( $form, $lead ); + //send notifications + GFCommon::send_form_submission_notifications( $form, $lead ); + } + + self::clean_up_files( $form ); + + // remove incomplete submission and purge expired + if ( rgars( $form, 'save/enabled' ) ) { + GFFormsModel::delete_incomplete_submission( rgpost( 'gform_resume_token' ) ); + GFFormsModel::purge_expired_incomplete_submissions(); + } + + //display confirmation message or redirect to confirmation page + return self::handle_confirmation( $form, $lead, $ajax ); + } + + public static function clean_up_files( $form ) { + $unique_form_id = rgpost( 'gform_unique_id' ); + if ( ! ctype_alnum( $unique_form_id ) ) { + return false; + } + $target_path = RGFormsModel::get_upload_path( $form['id'] ) . '/tmp/'; + $filename = $target_path . $unique_form_id . '_input_*'; + $files = glob( $filename ); + if ( is_array( $files ) ) { + array_map( 'unlink', $files ); + } + + // clean up files from abandoned submissions older than 48 hours (30 days if Save and Continue is enabled) + $files = glob( $target_path . '*' ); + if ( is_array( $files ) ) { + $seconds_in_day = 24 * 60 * 60; + $lifespan = rgars( $form, 'save/enabled' ) ? $expiration_days = apply_filters( 'gform_incomplete_submissions_expiration_days', 30 ) * $seconds_in_day : 2 * $seconds_in_day; + foreach ( $files as $file ) { + if ( is_file( $file ) && time() - filemtime( $file ) >= $lifespan ) { + unlink( $file ); + } + } + } + } + + public static function handle_confirmation( $form, $lead, $ajax = false ) { + + GFCommon::log_debug( 'GFFormDisplay::handle_confirmation(): Sending confirmation.' ); + + //run the function to populate the legacy confirmation format to be safe + $form = self::update_confirmation( $form, $lead ); + + if ( $form['confirmation']['type'] == 'message' ) { + $default_anchor = self::has_pages( $form ) ? 1 : 0; + $anchor = apply_filters( "gform_confirmation_anchor_{$form['id']}", apply_filters( 'gform_confirmation_anchor', $default_anchor ) ) ? "" : ''; + $nl2br = rgar( $form['confirmation'], 'disableAutoformat' ) ? false : true; + $cssClass = rgar( $form, 'cssClass' ); + $confirmation = empty( $form['confirmation']['message'] ) ? "{$anchor} " : "{$anchor}
    " . GFCommon::replace_variables( $form['confirmation']['message'], $form, $lead, false, true, $nl2br ) . '
    '; + } else { + if ( ! empty( $form['confirmation']['pageId'] ) ) { + $url = get_permalink( $form['confirmation']['pageId'] ); + + } else { + $url = GFCommon::replace_variables( trim( $form['confirmation']['url'] ), $form, $lead, false, true, true, 'text' ); + } + + $url_info = parse_url( $url ); + $query_string = rgar( $url_info, 'query' ); + $dynamic_query = GFCommon::replace_variables( trim( $form['confirmation']['queryString'] ), $form, $lead, true, false, false, 'text' ); + $dynamic_query = str_replace( array( "\r", "\n" ), '', $dynamic_query ); + $query_string .= rgempty( 'query', $url_info ) || empty( $dynamic_query ) ? $dynamic_query : '&' . $dynamic_query; + + if ( ! empty( $url_info['fragment'] ) ) { + $query_string .= '#' . rgar( $url_info, 'fragment' ); + } + + $url = isset( $url_info['scheme'] ) ? $url_info['scheme'] : 'http'; + $url .= '://' . rgar( $url_info, 'host' ); + if ( ! empty( $url_info['port'] ) ) { + $url .= ':' . rgar( $url_info, 'port' ); + } + + $url .= rgar( $url_info, 'path' ); + if ( ! empty( $query_string ) ) { + $url .= "?{$query_string}"; + } + + if ( headers_sent() || $ajax ) { + //Perform client side redirect for AJAX forms, of if headers have already been sent + $confirmation = self::get_js_redirect_confirmation( $url, $ajax ); + } else { + $confirmation = array( 'redirect' => $url ); + } + } + + $confirmation = apply_filters( "gform_confirmation_{$form['id']}", apply_filters( 'gform_confirmation', $confirmation, $form, $lead, $ajax ), $form, $lead, $ajax ); + + if ( ! is_array( $confirmation ) ) { + $confirmation = GFCommon::gform_do_shortcode( $confirmation ); //enabling shortcodes + } else if ( headers_sent() || $ajax ) { + //Perform client side redirect for AJAX forms, of if headers have already been sent + $confirmation = self::get_js_redirect_confirmation( $confirmation['redirect'], $ajax ); //redirecting via client side + } + + GFCommon::log_debug( 'GFFormDisplay::handle_confirmation(): Confirmation => ' . print_r( $confirmation, true ) ); + + return $confirmation; + } + + private static function get_js_redirect_confirmation( $url, $ajax ) { + $confirmation = "'; + + return $confirmation; + } + + public static function send_emails( $form, $lead ) { + _deprecated_function( 'send_emails', '1.7', 'GFCommon::send_form_submission_notifications' ); + GFCommon::send_form_submission_notifications( $form, $lead ); + } + + public static function validate( &$form, $field_values, $page_number = 0, &$failed_validation_page = 0 ) { + + $form = apply_filters( 'gform_pre_validation_' . $form['id'], apply_filters( 'gform_pre_validation', $form ) ); + + // validate form schedule + if ( self::validate_form_schedule( $form ) ) { + return false; + } + + // validate entry limit + if ( self::validate_entry_limit( $form ) ) { + return false; + } + + // Prevent tampering with the submitted form + if ( empty( $_POST[ 'is_submit_' . $form['id'] ] ) ) { + return false; + } + + foreach ( $form['fields'] as &$field ) { + /* @var GF_Field $field */ + + //If a page number is specified, only validates fields that are on current page + $field_in_other_page = $page_number > 0 && $field->pageNumber != $page_number; + + //validate fields with 'no duplicate' functionality when they are present on pages before the current page. + $validate_duplicate_feature = $field->noDuplicates && $page_number > 0 && $field->pageNumber <= $page_number; + + if ( $field_in_other_page && ! $validate_duplicate_feature ) { + continue; + } + + //ignore validation if field is hidden or admin only + if ( RGFormsModel::is_field_hidden( $form, $field, $field_values ) || $field->adminOnly ) { + continue; + } + + $value = RGFormsModel::get_field_value( $field ); + + $input_type = RGFormsModel::get_input_type( $field ); + + //display error message if field is marked as required and the submitted value is empty + if ( $field->isRequired && self::is_empty( $field, $form['id'] ) ) { + $field->failed_validation = true; + $field->validation_message = empty( $field->errorMessage ) ? __( 'This field is required.', 'gravityforms' ) : $field->errorMessage; + } //display error if field does not allow duplicates and the submitted value already exists + else if ( $field->noDuplicates && RGFormsModel::is_duplicate( $form['id'], $field, $value ) ) { + $field->failed_validation = true; + //set page number so the failed field displays if on multi-page form + $failed_validation_page = $field->pageNumber; + + switch ( $input_type ) { + case 'date' : + $default_message = __( 'This date has already been taken. Please select a new date.', 'gravityforms' ); + break; + + default: + $default_message = is_array( $value ) ? __( 'This field requires a unique entry and the values you entered have been already been used.', 'gravityforms' ) : + sprintf( __( "This field requires a unique entry and '%s' has already been used", 'gravityforms' ), $value ); + break; + } + + $field->validation_message = apply_filters( "gform_duplicate_message_{$form['id']}", apply_filters( 'gform_duplicate_message', $default_message, $form, $field, $value ), $form, $field, $value ); + + } else { + if ( self::failed_state_validation( $form['id'], $field, $value ) ) { + $field->failed_validation = true; + $field->validation_message = in_array( $field->inputType, array( 'singleproduct', 'singleshipping', 'hiddenproduct' ) ) ? __( 'Please enter a valid value.', 'gravityforms' ) : __( 'Invalid selection. Please select one of the available choices.', 'gravityforms' ); + } else { + $field->validate( $value, $form ); + } + } + + $custom_validation_result = apply_filters( 'gform_field_validation', array( 'is_valid' => $field->failed_validation ? false : true, 'message' => $field->validation_message ), $value, $form, $field ); + $custom_validation_result = apply_filters( "gform_field_validation_{$form['id']}", $custom_validation_result, $value, $form, $field ); + $custom_validation_result = apply_filters( "gform_field_validation_{$form['id']}_{$field->id}", $custom_validation_result, $value, $form, $field ); + + $field->failed_validation = rgar( $custom_validation_result, 'is_valid' ) ? false : true; + $field->validation_message = rgar( $custom_validation_result, 'message' ); + } + + $is_valid = true; + foreach ( $form['fields'] as $f ) { + if ( $f->failed_validation ) { + $is_valid = false; + break; + } + } + + $validation_result = apply_filters( "gform_validation_{$form['id']}", apply_filters( 'gform_validation', array( 'is_valid' => $is_valid, 'form' => $form ) ) ); + $is_valid = $validation_result['is_valid']; + $form = $validation_result['form']; + + return $is_valid; + } + + public static function failed_state_validation( $form_id, $field, $value ) { + + global $_gf_state; + + //if field can be populated dynamically, disable state validation + if ( $field->allowsPrepopulate ) { + return false; + } else if ( ! GFCommon::is_product_field( $field->type && $field->type != 'donation' ) ) { + return false; + } else if ( ! in_array( $field->inputType, array( 'singleshipping', 'singleproduct', 'hiddenproduct', 'checkbox', 'radio', 'select' ) ) ) { + return false; + } + + if ( ! isset( $_gf_state ) ) { + $state = json_decode( base64_decode( $_POST[ "state_{$form_id}" ] ), true ); + + if ( ! $state || sizeof( $state ) != 2 ) { + return true; + } + + //making sure state wasn't tampered with by validating checksum + $checksum = wp_hash( crc32( $state[0] ) ); + + if ( $checksum !== $state[1] ) { + return true; + } + + $_gf_state = json_decode( $state[0], true ); + } + + if ( ! is_array( $value ) ) { + $value = array( $field->id => $value ); + } + + foreach ( $value as $key => $input_value ) { + $state = isset( $_gf_state[ $key ] ) ? $_gf_state[ $key ] : false; + + //converting price to a number for single product fields and single shipping fields + if ( ( in_array( $field->inputType, array( 'singleproduct', 'hiddenproduct' ) ) && $key == $field->id . '.2' ) || $field->inputType == 'singleshipping' ) { + $input_value = GFCommon::to_number( $input_value ); + } + + $hash = wp_hash( $input_value ); + + if ( strlen( $input_value ) > 0 && $state !== false && ( ( is_array( $state ) && ! in_array( $hash, $state ) ) || ( ! is_array( $state ) && $hash != $state ) ) ) { + return true; + } + } + + return false; + } + + public static function enqueue_scripts() { + global $wp_query; + if ( isset( $wp_query->posts ) && is_array( $wp_query->posts ) ) { + foreach ( $wp_query->posts as $post ) { + $forms = self::get_embedded_forms( $post->post_content, $ajax ); + foreach ( $forms as $form ) { + if ( isset( $form['id'] ) ) { + self::enqueue_form_scripts( $form, $ajax ); + } + } + } + } + } + + public static function get_embedded_forms( $post_content, &$ajax ) { + $forms = array(); + if ( preg_match_all( '/\[gravityform[s]? +.*?((id=.+?)|(name=.+?))\]/is', $post_content, $matches, PREG_SET_ORDER ) ) { + $ajax = false; + foreach ( $matches as $match ) { + //parsing shortcode attributes + $attr = shortcode_parse_atts( $match[1] ); + $form_id = rgar( $attr, 'id' ); + if ( ! is_numeric( $form_id ) ) { + $form_id = RGFormsModel::get_form_id( rgar( $attr, 'name' ) ); + } + + if ( ! empty( $form_id ) ){ + $forms[] = RGFormsModel::get_form_meta( $form_id ); + $ajax = isset( $attr['ajax'] ) && strtolower( substr( $attr['ajax'], 0, 4 ) ) == 'true'; + } + } + } + + return $forms; + } + + public static function enqueue_form_scripts( $form, $ajax = false ) { + + // adding pre enqueue scripts hook so that scripts can be added first if a need exists + do_action( "gform_pre_enqueue_scripts_{$form['id']}", do_action( 'gform_pre_enqueue_scripts', $form, $ajax ), $ajax ); + + if ( ! get_option( 'rg_gforms_disable_css' ) ) { + + wp_enqueue_style( 'gforms_reset_css', GFCommon::get_base_url() . '/css/formreset.css', null, GFCommon::$version ); + + if ( self::has_datepicker_field( $form ) ) { + wp_enqueue_style( 'gforms_datepicker_css', GFCommon::get_base_url() . '/css/datepicker.css', null, GFCommon::$version ); + } + + wp_enqueue_style( 'gforms_formsmain_css', GFCommon::get_base_url() . '/css/formsmain.css', null, GFCommon::$version ); + wp_enqueue_style( 'gforms_ready_class_css', GFCommon::get_base_url() . '/css/readyclass.css', null, GFCommon::$version ); + wp_enqueue_style( 'gforms_browsers_css', GFCommon::get_base_url() . '/css/browsers.css', null, GFCommon::$version ); + + if ( is_rtl() ) { + wp_enqueue_style( 'gforms_rtl_css', GFCommon::get_base_url() . '/css/rtl.css', null, GFCommon::$version ); + } + } + + if ( self::has_conditional_logic( $form ) ) { + wp_enqueue_script( 'gform_conditional_logic' ); + } + + if ( self::has_datepicker_field( $form ) ) { + wp_enqueue_script( 'gform_datepicker_init' ); + } + + if ( $ajax || self::has_price_field( $form ) || self::has_password_strength( $form ) || GFCommon::has_list_field( $form ) || GFCommon::has_credit_card_field( $form ) || self::has_conditional_logic( $form ) || self::has_currency_format_number_field( $form ) || self::has_calculation_field( $form ) ) { + wp_enqueue_script( 'gform_gravityforms' ); + } + + if ( GFCommon::has_multifile_fileupload_field( $form ) ) { + wp_enqueue_script( 'plupload-all' ); + GFCommon::localize_gform_gravityforms_multifile(); + } + + if ( self::has_enhanced_dropdown( $form ) || self::has_pages( $form ) || self::has_fileupload_field( $form ) ) { + wp_enqueue_script( 'gform_json' ); + wp_enqueue_script( 'gform_gravityforms' ); + } + + if ( self::has_character_counter( $form ) ) { + wp_enqueue_script( 'gform_textarea_counter' ); + } + + if ( self::has_input_mask( $form ) ) { + wp_enqueue_script( 'gform_masked_input' ); + } + + if ( self::has_enhanced_dropdown( $form ) && ! wp_script_is( 'chosen' ) ) { + wp_enqueue_script( 'gform_chosen' ); + } + + if ( self::has_enhanced_dropdown( $form ) ) { + if ( wp_script_is( 'chosen', 'registered' ) ) { + wp_enqueue_script( 'chosen' ); + } else { + wp_enqueue_script( 'gform_chosen' ); + } + } + + if ( self::has_placeholder( $form ) ) { + wp_enqueue_script( 'gform_placeholder' ); + } + + do_action( 'gform_enqueue_scripts', $form, $ajax ); + do_action( "gform_enqueue_scripts_{$form['id']}", $form, $ajax ); + + // enqueue jQuery every time form is displayed to allow 'gform_post_render' js hook + // to be available to users even when GF is not using it + wp_enqueue_script( 'jquery' ); + + } + + private static $printed_scripts = array(); + + public static function print_form_scripts( $form, $ajax ) { + + if ( ! get_option( 'rg_gforms_disable_css' ) ) { + + if ( ! wp_style_is( 'gforms_css' ) ) { + + wp_enqueue_style( 'gforms_reset_css', GFCommon::get_base_url() . '/css/formreset.css', null, GFCommon::$version ); + wp_print_styles( array( 'gforms_reset_css' ) ); + + wp_enqueue_style( 'gforms_formsmain_css', GFCommon::get_base_url() . '/css/formsmain.css', null, GFCommon::$version ); + wp_print_styles( array( 'gforms_formsmain_css' ) ); + + wp_enqueue_style( 'gforms_ready_class_css', GFCommon::get_base_url() . '/css/readyclass.css', null, GFCommon::$version ); + wp_print_styles( array( 'gforms_ready_class_css' ) ); + + wp_enqueue_style( 'gforms_browsers_css', GFCommon::get_base_url() . '/css/browsers.css', null, GFCommon::$version ); + wp_print_styles( array( 'gforms_browsers_css' ) ); + + if ( self::has_datepicker_field( $form ) ) { + wp_enqueue_style( 'gforms_datepicker_css', GFCommon::get_base_url() . '/css/datepicker.css', null, GFCommon::$version ); + wp_print_styles( array( 'gforms_datepicker_css' ) ); + } + + if ( is_rtl() ) { + wp_enqueue_style( 'gforms_rtl_css', GFCommon::get_base_url() . '/css/rtl.css', null, GFCommon::$version ); + wp_print_styles( array( 'gforms_rtl_css' ) ); + } + } + } + + $scripts = array(); + + if ( ( $ajax || self::has_enhanced_dropdown( $form ) || self::has_price_field( $form ) || self::has_password_strength( $form ) || self::has_pages( $form ) || self::has_password_strength( $form ) || GFCommon::has_list_field( $form ) || GFCommon::has_credit_card_field( $form ) || self::has_calculation_field( $form ) ) && ! wp_script_is( 'gform_gravityforms' ) ) { + $scripts[] = 'gform_gravityforms'; + } - $confirmation = ""; - if($is_valid && $page_number == 0){ + if ( self::has_conditional_logic( $form ) && ! wp_script_is( 'gform_conditional_logic' ) ) { + $scripts[] = 'gform_conditional_logic'; + } + if ( self::has_datepicker_field( $form ) && ! wp_script_is( 'gform_datepicker_init' ) ) { + $scripts[] = 'gform_datepicker_init'; + } - $ajax = isset($_POST["gform_ajax"]); + if ( self::has_pages( $form ) && ! wp_script_is( 'gform_json' ) ) { + $scripts[] = 'gform_json'; + } - //adds honeypot field if configured - if(rgar($form,"enableHoneypot")) - $form["fields"][] = self::get_honeypot_field($form); + if ( self::has_character_counter( $form ) && ! wp_script_is( 'gform_textarea_counter' ) ) { + $scripts[] = 'gform_textarea_counter'; + } - $failed_honeypot = rgar($form,"enableHoneypot") && !self::validate_honeypot($form); + if ( self::has_input_mask( $form ) && ! wp_script_is( 'gform_masked_input' ) ) { + $scripts[] = 'gform_masked_input'; + } - if($failed_honeypot){ + if ( self::has_enhanced_dropdown( $form ) && ! wp_script_is( 'gform_chosen' ) && ! wp_script_is( 'chosen' ) ) { + if ( wp_script_is( 'chosen', 'registered' ) ) { + $scripts[] = 'chosen'; + } else { + $scripts[] = 'gform_chosen'; + } + } - GFCommon::log_debug("Failed Honeypot validation. Displaying confirmation and aborting"); + if ( ! wp_script_is( 'jquery' ) ) { + $scripts[] = 'jquery'; + } - //display confirmation but doesn't process the form when honeypot fails - $confirmation = self::handle_confirmation($form, $lead, $ajax); - $is_valid = false; - } - else{ + foreach ( $scripts as $script ) { + wp_enqueue_script( $script ); + } - GFCommon::log_debug("Submission is valid. Moving forward."); + wp_print_scripts( $scripts ); - $form = self::update_confirmation($form); + if ( wp_script_is( 'gform_gravityforms' ) ) { + echo ''; + } - //pre submission action - do_action("gform_pre_submission", $form); - do_action("gform_pre_submission_{$form["id"]}", $form); + } - //pre submission filter - $form = apply_filters("gform_pre_submission_filter_{$form["id"]}", apply_filters("gform_pre_submission_filter", $form)); + public static function has_conditional_logic( $form ) { + $has_conditional_logic = self::has_conditional_logic_legwork( $form ); - //handle submission - $confirmation = self::handle_submission($form, $lead, $ajax); + return apply_filters( 'gform_has_conditional_logic', $has_conditional_logic, $form ); + } - //after submission hook - do_action("gform_after_submission", $lead, $form); - do_action("gform_after_submission_{$form["id"]}", $lead, $form); + private static function has_conditional_logic_legwork( $form ) { - } + if ( empty( $form ) ) { + return false; + } - if(is_array($confirmation) && isset($confirmation["redirect"])){ - header("Location: {$confirmation["redirect"]}"); - do_action("gform_post_submission", $lead, $form); - do_action("gform_post_submission_{$form["id"]}", $lead, $form); + if ( isset( $form['button']['conditionalLogic'] ) ) { + return true; + } - GFFormsModel::delete_password( $lead, $form ); + if ( is_array( rgar( $form, 'fields' ) ) ) { + foreach ( rgar( $form, 'fields' ) as $field ) { + if ( ! empty( $field->conditionalLogic ) ) { + return true; + } else if ( isset( $field->nextButton ) && ! empty( $field->nextButton['conditionalLogic'] ) ) { + return true; + } + } + } - exit; - } - else{ + return false; + } - GFFormsModel::delete_password( $lead, $form ); + private static function get_conditional_logic( $form, $field_values = array() ) { + $logics = ''; + $dependents = ''; + $fields_with_logic = array(); + $default_values = array(); - } - } + foreach ( $form['fields'] as $field ) { - if(!isset(self::$submission[$form_id])) - self::$submission[$form_id] = array(); + /* @var GF_Field $field */ - self::set_submission_if_null($form_id, "is_valid", $is_valid); - self::set_submission_if_null($form_id, "form", $form); - self::set_submission_if_null($form_id, "lead", $lead); - self::set_submission_if_null($form_id, "confirmation_message", $confirmation); - self::set_submission_if_null($form_id, "page_number", $page_number); - self::set_submission_if_null($form_id, "source_page_number", $source_page_number); + //use section's logic if one exists + $section = RGFormsModel::get_section( $form, $field->id ); + $section_logic = ! empty( $section ) ? rgar( $section, 'conditionalLogic' ) : null; - do_action("gform_post_process", $form, $page_number, $source_page_number ); - do_action("gform_post_process_{$form["id"]}", $form, $page_number, $source_page_number ); + $field_logic = $field->type != 'page' ? $field->conditionalLogic : null; //page break conditional logic will be handled during the next button click - } + $next_button_logic = ! empty( $field->nextButton ) && ! empty( $field->nextButton['conditionalLogic'] ) ? $field->nextButton['conditionalLogic'] : null; - private static function set_submission_if_null($form_id, $key, $val){ - if(!isset(self::$submission[$form_id][$key])) - self::$submission[$form_id][$key] = $val; - } + if ( ! empty( $field_logic ) || ! empty( $next_button_logic ) ) { - private static function upload_files($form, $files){ + $field_section_logic = array( 'field' => $field_logic, 'nextButton' => $next_button_logic, 'section' => $section_logic ); - //Creating temp folder if it does not exist - $target_path = RGFormsModel::get_upload_path($form["id"]) . "/tmp/"; - wp_mkdir_p($target_path); + $logics .= $field->id . ': ' . GFCommon::json_encode( $field_section_logic ) . ','; - foreach($form["fields"] as $field){ - $input_name = "input_{$field["id"]}"; + $fields_with_logic[] = $field->id; - //skip fields that are not file upload fields or that don't have a file to be uploaded or that have failed validation - $input_type = RGFormsModel::get_input_type($field); - if(!in_array($input_type, array("fileupload", "post_image")) || $field["failed_validation"] || empty($_FILES[$input_name]["name"])){ - GFCommon::log_debug("upload_files() - skipping field: {$field["label"]}({$field["id"]} - {$field["type"]})"); - continue; - } + $peers = $field->type == 'section' ? GFCommon::get_section_fields( $form, $field->id ) : array( $field ); + $peer_ids = array(); - if(rgar($field,"multipleFiles")) - continue; + foreach ( $peers as $peer ) { + $peer_ids[] = $peer->id; + } - $file_info = RGFormsModel::get_temp_filename($form["id"], $input_name); - GFCommon::log_debug("upload_files() - temp file info: " . print_r($file_info, true)); + $dependents .= $field->id . ': ' . GFCommon::json_encode( $peer_ids ) . ','; + } - if($file_info && move_uploaded_file($_FILES[$input_name]['tmp_name'], $target_path . $file_info["temp_filename"])){ - GFFormsModel::set_permissions( $target_path . $file_info['temp_filename'] ); - $files[$input_name] = $file_info["uploaded_filename"]; - GFCommon::log_debug("upload_files() - file uploaded successfully: {$file_info["uploaded_filename"]}"); - } - else{ - GFCommon::log_error("upload_files() - file could not be uploaded: tmp_name: {$_FILES[$input_name]['tmp_name']} - target location: " . $target_path . $file_info["temp_filename"]); - } - } - - return $files; - } - - public static function get_state($form, $field_values){ - $product_fields = array(); - foreach($form["fields"] as $field){ - if(GFCommon::is_product_field($field["type"]) || $field["type"] == "donation"){ - $value = RGFormsModel::get_field_value($field, $field_values, false); - $value = self::default_if_empty($field, $value); - - switch($field["inputType"]){ - case "calculation" : - case "singleproduct" : - case "hiddenproduct" : - $price = !is_array($value) || empty($value[$field["id"] . ".2"]) ? $field["basePrice"] : $value[$field["id"] . ".2"]; - if(empty($price)) - $price = 0; - - $price = GFCommon::to_number($price); - - $product_name = !is_array($value) || empty($value[$field["id"] . ".1"]) ? $field["label"] : $value[$field["id"] . ".1"]; - $product_fields[$field["id"]. ".1"] = wp_hash(GFFormsModel::maybe_trim_input($product_name, $form["id"], $field)); - $product_fields[$field["id"]. ".2"] = wp_hash(GFFormsModel::maybe_trim_input($price, $form["id"], $field)); - break; + //-- Saving default values so that they can be restored when toggling conditional logic --- + $field_val = ''; + $input_type = RGFormsModel::get_input_type( $field ); - case "singleshipping" : - $price = !empty($value) ? $value : $field["basePrice"]; - $price = GFCommon::to_number($price); + //get parameter value if pre-populate is enabled + if ( $field->allowsPrepopulate ) { + if ( is_array( $field->inputs ) ) { + $field_val = array(); + foreach ( $field->inputs as $input ) { + $field_val[ "input_{$input['id']}" ] = RGFormsModel::get_parameter_value( rgar( $input, 'name' ), $field_values, $field ); + } + } else if ( $input_type == 'time' ) { // maintained for backwards compatibility. The Time field now has an inputs array. + $parameter_val = RGFormsModel::get_parameter_value( $field->inputName, $field_values, $field ); + if ( ! empty( $parameter_val ) && preg_match( '/^(\d*):(\d*) ?(.*)$/', $parameter_val, $matches ) ) { + $field_val = array(); + $field_val[] = esc_attr( $matches[1] ); //hour + $field_val[] = esc_attr( $matches[2] ); //minute + $field_val[] = rgar( $matches, 3 ); //am or pm + } + } else if ( $input_type == 'list' ) { + $parameter_val = RGFormsModel::get_parameter_value( $field->inputName, $field_values, $field ); + $field_val = is_array( $parameter_val ) ? $parameter_val : explode( ',', str_replace( '|', ',', $parameter_val ) ); + } else { + $field_val = RGFormsModel::get_parameter_value( $field->inputName, $field_values, $field ); + } + } - $product_fields[$field["id"]] = wp_hash(GFFormsModel::maybe_trim_input($price, $form["id"], $field)); - break; - case "radio" : - case "select" : - $product_fields[$field["id"]] = array(); - foreach($field["choices"] as $choice){ - $field_value = !empty($choice["value"]) || rgar($field,"enableChoiceValue") ? $choice["value"] : $choice["text"]; - if($field["enablePrice"]) - $field_value .= "|" . GFCommon::to_number(rgar($choice,"price")); + //use default value if pre-populated value is empty + $field_val = $field->get_value_default_if_empty( $field_val ); - $product_fields[$field["id"]][] = wp_hash(GFFormsModel::maybe_trim_input($field_value, $form["id"], $field)); - } - break; - case "checkbox" : - $index = 1; - foreach($field["choices"] as $choice){ - $field_value = !empty($choice["value"]) || $field["enableChoiceValue"] ? $choice["value"] : $choice["text"]; - if($field["enablePrice"]) - $field_value .= "|" . GFCommon::to_number(rgar($choice,"price")); + if ( is_array( $field->choices ) && $input_type != 'list' ) { - if($index % 10 == 0) //hack to skip numbers ending in 0. so that 5.1 doesn't conflict with 5.10 - $index++; + //radio buttons start at 0 and checkboxes start at 1 + $choice_index = $input_type == 'radio' ? 0 : 1; + $is_pricing_field = GFCommon::is_pricing_field( $field->type ); - $product_fields[$field["id"] . "." . $index++] = wp_hash(GFFormsModel::maybe_trim_input($field_value, $form["id"], $field)); - } - break; + foreach ( $field->choices as $choice ) { - } - } - } + if ( $input_type == 'checkbox' && ( $choice_index % 10 ) == 0 ){ + $choice_index++; + } - $hash = json_encode($product_fields); - $checksum = wp_hash(crc32($hash)); - return base64_encode(json_encode(array($hash, $checksum))); - - } - - private static function has_pages($form){ - return GFCommon::has_pages($form); - } - - private static function has_character_counter($form){ - - if(!is_array($form["fields"])) - return false; - - foreach($form["fields"] as $field){ - if(rgar($field, "maxLength") && !rgar($field, "inputMask")) - return true; - } - - return false; - } - - - private static function has_enhanced_dropdown($form){ - - if(!is_array($form["fields"])) - return false; - - foreach($form["fields"] as $field){ - if(in_array(RGFormsModel::get_input_type($field), array("select", "multiselect")) && rgar($field, "enableEnhancedUI")) - return true; - } - - return false; - } - - private static function has_password_strength($form){ - - if(!is_array($form["fields"])) - return false; - - foreach($form["fields"] as $field){ - if($field["type"] == "password" && RGForms::get("passwordStrengthEnabled", $field)) - return true; - } - - return false; - } - - private static function has_other_choice($form){ - - if(!is_array($form["fields"])) - return false; - - foreach($form["fields"] as $field){ - if($field["type"] == "radio" && rgget("enableOtherChoice", $field)) - return true; - } - - return false; - } - - - public static function get_target_page($form, $current_page, $field_values){ - $page_number = RGForms::post("gform_target_page_number_{$form["id"]}"); - $page_number = !is_numeric($page_number) ? 1 : $page_number; - - $direction = $page_number >= $current_page ? 1 : -1; - - //Finding next page that is not hidden by conditional logic - while(RGFormsModel::is_page_hidden($form, $page_number, $field_values)){ - $page_number += $direction; - } + if ( rgar( $choice, 'isSelected' ) && $input_type == 'select' ) { + $val = $is_pricing_field && $field->type != 'quantity' ? $choice['value'] . '|' . GFCommon::to_number( rgar( $choice, 'price' ) ): $choice['value']; + $default_values[ $field->id ] = $val; + } else if ( rgar( $choice, 'isSelected' ) ) { + if ( ! isset( $default_values[ $field->id ] ) ) { + $default_values[ $field->id ] = array(); + } - //If all following pages are hidden, submit the form - if($page_number > self::get_max_page_number($form)) - $page_number = 0; + $default_values[ $field->id ][] = "choice_{$form['id']}_{$field->id}_{$choice_index}"; + } + $choice_index ++; + } + } else if ( ! empty( $field_val ) ) { + + if ( GFFormsModel::get_input_type( $field ) == 'date' ) { + //format date + $format = empty( $field->dateFormat ) ? 'mdy' : esc_attr( $field->dateFormat ); + $date_info = GFcommon::parse_date( $field_val, $format ); + switch ( $format ) { + case 'mdy': + $field_val = $date_info['month'] . '/' . $date_info['day'] . '/' . $date_info['year']; + break; + case 'dmy': + $field_val = $date_info['day'] . '/' . $date_info['month'] . '/' . $date_info['year']; + break; + case 'ymd': + $field_val = $date_info['year'] . '/' . $date_info['month'] . '/' . $date_info['day']; + break; + } + } + $default_values[ $field->id ] = $field_val; + } + } - return $page_number; - } + $button_conditional_script = ''; - public static function get_source_page($form_id){ - $page_number = RGForms::post("gform_source_page_number_{$form_id}"); - return !is_numeric($page_number) ? 1 : $page_number; - } + //adding form button conditional logic if enabled + if ( isset( $form['button']['conditionalLogic'] ) ) { + $logics .= '0: ' . GFCommon::json_encode( array( 'field' => $form['button']['conditionalLogic'], 'section' => null ) ) . ','; + $dependents .= '0: ' . GFCommon::json_encode( array( 0 ) ) . ','; + $fields_with_logic[] = 0; - public static function set_current_page($form_id, $page_number){ - self::$submission[$form_id]["page_number"] = $page_number; - } + $button_conditional_script = "jQuery('#gform_{$form['id']}').submit(" . + "function(event, isButtonPress){" . + " var visibleButton = jQuery('.gform_next_button:visible, .gform_button:visible, .gform_image_button:visible');" . + " return visibleButton.length > 0 || isButtonPress == true;" . + "}" . + ");"; + } - public static function get_current_page($form_id){ - $page_number = isset(self::$submission[$form_id]) ? intval(self::$submission[$form_id]["page_number"]) : 1; - return $page_number; - } + if ( ! empty( $logics ) ) { + $logics = substr( $logics, 0, strlen( $logics ) - 1 ); + } //removing last comma; - private static function is_page_active($form_id, $page_number){ - return intval(self::get_current_page($form_id)) == intval($page_number); - } - - /** - * Determine if the last page for the current form object is being submitted or rendered (depending on the provided $mode). - * - * @param array $form A Gravity Forms form object. - * @param string $mode Mode to check for: 'submit' or 'render' - * @return boolean - */ - public static function is_last_page( $form, $mode = 'submit' ) { - - $page_number = self::get_source_page( $form['id'] ); - $field_values = GFForms::post( 'gform_field_values' ); - $target_page = self::get_target_page( $form, $page_number, $field_values ); - - if( $mode == 'render' ) { - $is_last_page = $target_page == self::get_max_page_number( $form ); - } else { - $is_last_page = (string) $target_page === '0'; - } - - return $is_last_page; - } - - private static function get_limit_period_dates($period){ - if(empty($period)) - return array("start_date" => null, "end_date" => null); - - switch($period){ - case "day" : - return array( - "start_date" => gmdate("Y-m-d"), - "end_date" => gmdate("Y-m-d 23:59:59")); - break; - - case "week" : - return array( - "start_date" => gmdate("Y-m-d", strtotime("Monday this week")), - "end_date" => gmdate("Y-m-d 23:59:59", strtotime("next Sunday"))); - break; - - case "month" : - $month_start = gmdate("Y-m-1"); - return array( - "start_date" => $month_start, - "end_date" => gmdate("Y-m-d H:i:s", strtotime("{$month_start} +1 month -1 second"))); - break; - - case "year" : - return array( - "start_date" => gmdate("Y-1-1"), - "end_date" => gmdate("Y-12-31 23:59:59")); - break; - } - } - - public static function get_form($form_id, $display_title=true, $display_description=true, $force_display=false, $field_values=null, $ajax=false, $tabindex = 1){ - - - //looking up form id by form name - if(!is_numeric($form_id)) - $form_id = RGFormsModel::get_form_id($form_id); - - //reading form metadata - $form = RGFormsModel::get_form_meta($form_id, true); - $form = RGFormsModel::add_default_properties($form); - - //disable ajax if form has a reCAPTCHA field (not supported). - if($ajax && self::has_recaptcha_field($form)) - $ajax = false; - - $is_postback = false; - $is_valid = true; - $confirmation_message = ""; - $page_number = 1; - - $view_counter_disabled = apply_filters( 'gform_disable_view_counter', false ); - $view_counter_disabled = apply_filters( "gform_disable_view_counter_{$form_id}", $view_counter_disabled ); - - //If form was submitted, read variables set during form submission procedure - $submission_info = isset(self::$submission[$form_id]) ? self::$submission[$form_id] : false; - if($submission_info){ - $is_postback = true; - $is_valid = rgar($submission_info, "is_valid") || rgar($submission_info, "is_confirmation"); - $form = $submission_info["form"]; - $lead = $submission_info["lead"]; - $confirmation_message = rgget("confirmation_message", $submission_info); - - if($is_valid && !RGForms::get("is_confirmation", $submission_info)){ - - if($submission_info["page_number"] == 0){ - //post submission hook - do_action("gform_post_submission", $lead, $form); - do_action("gform_post_submission_{$form["id"]}", $lead, $form); - } - else{ - //change page hook - do_action("gform_post_paging", $form, $submission_info["source_page_number"], $submission_info["page_number"]); - do_action("gform_post_paging_{$form["id"]}", $form, $submission_info["source_page_number"], $submission_info["page_number"]); - } - } - } - else if(!current_user_can("administrator") && !$view_counter_disabled){ - RGFormsModel::insert_form_view($form_id, $_SERVER['REMOTE_ADDR']); - } - - if(rgar($form,"enableHoneypot")) - $form["fields"][] = self::get_honeypot_field($form); - - //Fired right before the form rendering process. Allow users to manipulate the form object before it gets displayed in the front end - $form = apply_filters( "gform_pre_render_{$form_id}", apply_filters( 'gform_pre_render', $form, $ajax, $field_values ), $ajax, $field_values ); - - if($form == null) - return "

    " . __("Oops! We could not locate your form.", "gravityforms") . "

    "; - - $has_pages = self::has_pages($form); - - //calling tab index filter - GFCommon::$tab_index = apply_filters("gform_tabindex_{$form_id}", apply_filters("gform_tabindex", $tabindex, $form), $form); - - //Don't display inactive forms - if(!$force_display && !$is_postback) { - - $form_info = RGFormsModel::get_form($form_id); - if(!$form_info->is_active) - return ""; - - // If form requires login, check if user is logged in - if(rgar($form, "requireLogin")) { - if(!is_user_logged_in()) - return empty($form["requireLoginMessage"]) ? "

    " . __("Sorry. You must be logged in to view this form.", "gravityforms"). "

    " : "

    " . GFCommon::gform_do_shortcode($form["requireLoginMessage"]) . "

    "; - } - - } - - // show the form regardless of the following validations when force display is set to true - if(!$force_display || $is_postback) { - - $form_schedule_validation = self::validate_form_schedule($form); - - // if form schedule validation fails AND this is not a postback, display the validation error - // if form schedule validation fails AND this is a postback, make sure is not a valid submission (enables display of confirmation message) - if( ($form_schedule_validation && !$is_postback) || ($form_schedule_validation && $is_postback && !$is_valid) ) - return $form_schedule_validation; + if ( ! empty( $dependents ) ) { + $dependents = substr( $dependents, 0, strlen( $dependents ) - 1 ); + } //removing last comma; - $entry_limit_validation = self::validate_entry_limit($form); + $animation = rgar( $form, 'enableAnimation' ) ? '1' : '0'; + global $wp_locale; + $number_format = $wp_locale->number_format['decimal_point'] == ',' ? 'decimal_comma' : 'decimal_dot'; - // refer to form schedule condition notes above - if( ($entry_limit_validation && !$is_postback) || ($entry_limit_validation && $is_postback && !$is_valid) ) - return $entry_limit_validation; + $str = "if(window['jQuery']){" . - } + "if(!window['gf_form_conditional_logic'])" . + "window['gf_form_conditional_logic'] = new Array();" . + "window['gf_form_conditional_logic'][{$form['id']}] = {'logic' : {" . $logics . " }, 'dependents' : {" . $dependents . " }, 'animation' : " . $animation . " , 'defaults' : " . json_encode( $default_values ) . ' }; ' . + "if(!window['gf_number_format'])" . + "window['gf_number_format'] = '" . $number_format . "';" . - $form_string = ""; + "jQuery(document).ready(function(){" . + "gf_apply_rules({$form['id']}, " . json_encode( $fields_with_logic ) . ', true);' . + "jQuery('#gform_wrapper_{$form['id']}').show();" . + "jQuery(document).trigger('gform_post_conditional_logic', [{$form['id']}, null, true]);" . + $button_conditional_script . - //When called via a template, this will enqueue the proper scripts - //When called via a shortcode, this will be ignored (too late to enqueue), but the scripts will be enqueued via the enqueue_scripts event - self::enqueue_form_scripts($form, $ajax); + "} );" . - if(empty($confirmation_message)){ - $wrapper_css_class = GFCommon::get_browser_class() . " gform_wrapper"; + "} "; - if(!$is_valid) - $wrapper_css_class .=" gform_validation_error"; + return $str; + } - //Hidding entire form if conditional logic is on to prevent "hidden" fields from blinking. Form will be set to visible in the conditional_logic.php after the rules have been applied. - $style = self::has_conditional_logic($form) ? "style='display:none'" : ""; - $custom_wrapper_css_class = !empty($form["cssClass"]) ? " {$form["cssClass"]}_wrapper": ""; - $form_string .= " -
    "; - $action = add_query_arg(array()); - $default_anchor = $has_pages || $ajax ? true : false; - $use_anchor = apply_filters("gform_confirmation_anchor_{$form["id"]}", apply_filters("gform_confirmation_anchor", $default_anchor)); - if($use_anchor !== false){ - $form_string .=""; - $action .= "#gf_$form_id"; - } - $target = $ajax ? "target='gform_ajax_frame_{$form_id}'" : ""; - - $form_css_class = !empty($form["cssClass"]) ? "class='{$form["cssClass"]}'": ""; + /** + * Enqueue and retrieve all inline scripts that should be executed when the form is rendered. + * Use add_init_script() function to enqueue scripts. + * + * @param array $form + * @param array $field_values + * @param bool $is_ajax + */ + private static function register_form_init_scripts( $form, $field_values = array(), $is_ajax = false ) { + + // adding conditional logic script if conditional logic is configured for this form. + // get_conditional_logic also adds the chosen script for the enhanced dropdown option. + // if this form does not have conditional logic, add chosen script separately + if ( self::has_conditional_logic( $form ) ) { + self::add_init_script( $form['id'], 'conditional_logic', self::ON_PAGE_RENDER, self::get_conditional_logic( $form, $field_values ) ); + } - $action = esc_url($action); - $form_string .= apply_filters("gform_form_tag_{$form_id}", apply_filters("gform_form_tag", "
    ", $form), $form); + //adding currency config if there are any product fields in the form + if ( self::has_price_field( $form ) ) { + self::add_init_script( $form['id'], 'pricing', self::ON_PAGE_RENDER, self::get_pricing_init_script( $form ) ); + } - if($display_title || $display_description){ - $form_string .= " -
    "; - if($display_title){ - $form_string .= " -

    " . $form['title'] . "

    "; - } - if($display_description){ - $form_string .= " - " . rgar($form,'description') .""; - } - $form_string .= " -
    "; - } - - $current_page = self::get_current_page($form_id); - if($has_pages && !IS_ADMIN){ - $page_count = self::get_max_page_number($form); - - if($form["pagination"]["type"] == "percentage"){ - $form_string .= self::get_progress_bar($form, $form_id,$confirmation_message); - } - else if($form["pagination"]["type"] == "steps"){ - $form_string .=" -
    "; - $pages = isset($form["pagination"]["pages"]) ? $form["pagination"]["pages"] : array(); - for($i=0, $count = sizeof($pages); $i<$count; $i++){ - $step_number = $i+1; - $active_class = $step_number == $current_page ? " gf_step_active" : ""; - $first_class = $i==0 ? " gf_step_first" : ""; - $last_class = $i+1 == $count ? " gf_step_last" : ""; - $complete_class = $step_number < $current_page ? " gf_step_completed" : ""; - $previous_class = $step_number + 1 == $current_page ? " gf_step_previous" : ""; - $next_class = $step_number - 1 == $current_page ? " gf_step_next" : ""; - $pending_class = $step_number > $current_page ? " gf_step_pending" : ""; - $classes = "gf_step" . $active_class . $first_class . $last_class . $complete_class . $previous_class . $next_class . $pending_class; - - $classes = GFCommon::trim_all($classes); - - $form_string .=" -
    {$step_number} {$pages[$i]}
    "; - } - - $form_string .=" -
    -
    "; - } - } + if ( self::has_password_strength( $form ) ) { + $password_script = self::get_password_strength_init_script( $form ); + self::add_init_script( $form['id'], 'password', self::ON_PAGE_RENDER, $password_script ); + } + if ( self::has_enhanced_dropdown( $form ) ) { + $chosen_script = self::get_chosen_init_script( $form ); + self::add_init_script( $form['id'], 'chosen', self::ON_PAGE_RENDER, $chosen_script ); + self::add_init_script( $form['id'], 'chosen', self::ON_CONDITIONAL_LOGIC, $chosen_script ); + } - if($is_postback && !$is_valid){ - $validation_message = "
    " . __("There was a problem with your submission.", "gravityforms") . " " . __("Errors have been highlighted below.", "gravityforms") . "
    "; - $form_string .= apply_filters("gform_validation_message_{$form["id"]}", apply_filters("gform_validation_message", $validation_message, $form), $form); - } + if ( self::has_character_counter( $form ) ) { + self::add_init_script( $form['id'], 'character_counter', self::ON_PAGE_RENDER, self::get_counter_init_script( $form ) ); + } - $form_string .= " -
    "; + if ( self::has_input_mask( $form ) ) { + self::add_init_script( $form['id'], 'input_mask', self::ON_PAGE_RENDER, self::get_input_mask_init_script( $form ) ); + } - //add first page if this form has any page fields - if($has_pages){ - $style = self::is_page_active($form_id, 1) ? "" : "style='display:none;'"; - $class = !empty($form["firstPageCssClass"]) ? " {$form["firstPageCssClass"]}" : ""; - $form_string .= "
    -
    "; - } - - $description_class = rgar($form,"descriptionPlacement") == "above" ? "description_above" : "description_below"; - - $form_string .= " -
      "; - - if(is_array($form['fields'])) - { - foreach($form['fields'] as $field){ - $field["conditionalLogicFields"] = self::get_conditional_logic_fields($form, $field["id"]); - $form_string .= self::get_field($field, RGFormsModel::get_field_value($field, $field_values), false, $form, $field_values); - } - } - $form_string .= " -
    "; - - if($has_pages){ - $previous_button = self::get_form_button($form["id"], "gform_previous_button_{$form["id"]}", $form["lastPageButton"], __("Previous", "gravityforms"), "gform_previous_button", __("Previous Page", "gravityforms"), self::get_current_page($form_id) -1); - $previous_button = apply_filters("gform_previous_button", $previous_button, $form); - $previous_button = apply_filters("gform_previous_button_{$form["id"]}", $previous_button, $form); - $form_string .= "
    " . self::gform_footer($form, "gform_page_footer " . $form['labelPlacement'], $ajax, $field_values, $previous_button, $display_title, $display_description, $is_postback) . " -
    "; //closes gform_page - } - - $form_string .= "
    "; //closes gform_body - - //suppress form footer for multi-page forms (footer will be included on the last page - if(!$has_pages) - $form_string .= self::gform_footer($form, "gform_footer " . $form['labelPlacement'], $ajax, $field_values, "", $display_title, $display_description, $tabindex); - - $form_string .= " -
    -
    "; + if ( self::has_calculation_field( $form ) ) { + self::add_init_script( $form['id'], 'calculation', self::ON_PAGE_RENDER, self::get_calculations_init_script( $form ) ); + } - if($ajax && $is_postback){ - global $wp_scripts; + if ( self::has_currency_format_number_field( $form ) ) { + self::add_init_script( $form['id'], 'currency_format', self::ON_PAGE_RENDER, self::get_currency_format_init_script( $form ) ); + } - $form_string = apply_filters('gform_ajax_iframe_content', "" . - "" . $form_string . ""); + if ( self::has_currency_copy_values_option( $form ) ) { + self::add_init_script( $form['id'], 'copy_values', self::ON_PAGE_RENDER, self::get_copy_values_init_script( $form ) ); + } - } + if ( self::has_placeholder( $form ) ) { + self::add_init_script( $form['id'], 'placeholders', self::ON_PAGE_RENDER, self::get_placeholders_init_script( $form ) ); + } - if($ajax && !$is_postback){ - $spinner_url = apply_filters("gform_ajax_spinner_url_{$form_id}", apply_filters("gform_ajax_spinner_url", GFCommon::get_base_url() . "/images/spinner.gif", $form), $form); - $scroll_position = array('default' => '', 'confirmation' => ''); + if ( isset( $form['fields'] ) && is_array( $form['fields'] ) ) { + foreach ( $form['fields'] as $field ) { + /* @var GF_Field $field */ + if ( is_subclass_of( $field, 'GF_Field' ) ) { + $field->register_form_init_scripts( $form ); + } + } + } - if($use_anchor !== false) { - $scroll_position['default'] = is_numeric($use_anchor) ? "jQuery(document).scrollTop(" . intval($use_anchor) . ");" : "jQuery(document).scrollTop(jQuery('#gform_wrapper_{$form_id}').offset().top);"; - $scroll_position['confirmation'] = is_numeric($use_anchor) ? "jQuery(document).scrollTop(" . intval($use_anchor) . ");" : "jQuery(document).scrollTop(jQuery('#gforms_confirmation_message').offset().top);"; - } + do_action( 'gform_register_init_scripts', $form, $field_values, $is_ajax ); + do_action( 'gform_register_init_scripts_' . $form['id'], $form, $field_values, $is_ajax ); - $iframe_style = defined( 'GF_DEBUG' ) && GF_DEBUG ? 'display:block;width:600px;height:300px;border:1px solid #eee;' : 'display:none;width:0px;height:0px;'; + } - $form_string .=" - - "; - } - - $is_first_load = !$is_postback; - - if((!$ajax || $is_first_load)) { - - self::register_form_init_scripts( $form, $field_values, $ajax ); - - if(apply_filters("gform_init_scripts_footer", false)){ - add_action("wp_footer", create_function('', 'GFFormDisplay::footer_init_scripts(' . $form['id'] . ');'), 20); - add_action("gform_preview_footer", create_function('', 'GFFormDisplay::footer_init_scripts(' . $form['id'] . ');')); - } - else{ - $form_string .= self::get_form_init_scripts($form); - $form_string .= ""; - } - } - - return apply_filters("gform_get_form_filter_{$form["id"]}",apply_filters('gform_get_form_filter',$form_string, $form), $form); - } - else{ - $progress_confirmation = ""; + public static function get_form_init_scripts( $form ) { - //check admin setting for whether the progress bar should start at zero - $start_at_zero = rgars($form, "pagination/display_progressbar_on_confirmation"); - $start_at_zero = apply_filters("gform_progressbar_start_at_zero", $start_at_zero, $form); - - //show progress bar on confirmation - if( $start_at_zero && $has_pages && ! IS_ADMIN && ( $form["confirmation"]["type"] == "message" && $form["pagination"]["type"] == "percentage" ) ) - { - $progress_confirmation = self::get_progress_bar($form, $form_id,$confirmation_message); - if($ajax) - $progress_confirmation = "" . $progress_confirmation . ""; - - } - else - { - //return regular confirmation message - if($ajax) - { - $progress_confirmation = apply_filters('gform_ajax_iframe_content', "" . $confirmation_message . ""); - } - else - { - $progress_confirmation = $confirmation_message; - } - } - - return $progress_confirmation; - } - } - - public static function footer_init_scripts($form_id){ - global $_init_forms; - - $form = RGFormsModel::get_form_meta($form_id); - $form_string = self::get_form_init_scripts($form); - $current_page = self::get_current_page($form_id); - $form_string .= ""; - - $form_string = apply_filters( 'gform_footer_init_scripts_filter', $form_string, $form, $current_page ); - $form_string = apply_filters( 'gform_footer_init_scripts_filter_' . $form['id'], $form_string, $form, $current_page ); - - if(!isset($_init_forms[$form_id])){ - echo $form_string; - if(!is_array($_init_forms)) - $_init_forms = array(); - - $_init_forms[$form_id] = true; - } - } - - public static function add_init_script($form_id, $script_name, $location, $script){ - $key = $script_name . "_" . $location; - - if(!isset(self::$init_scripts[$form_id])) - self::$init_scripts[$form_id] = array(); - - //add script if it hasn't been added before - if(!array_key_exists($key, self::$init_scripts[$form_id])) - self::$init_scripts[$form_id][$key] = array("location" => $location, "script" => $script); - } - - private static function get_form_button($form_id, $button_input_id, $button, $default_text, $class, $alt, $target_page_number){ - $tabindex = GFCommon::get_tabindex(); - $input_type='submit'; - $onclick=""; - if(!empty($target_page_number)){ - $onclick = "onclick='jQuery(\"#gform_target_page_number_{$form_id}\").val(\"{$target_page_number}\"); jQuery(\"#gform_{$form_id}\").trigger(\"submit\",[true]); '"; - $input_type='button'; - } - else{ - //to prevent multiple form submissions when button is pressed multiple times - if(GFFormsModel::is_html5_enabled()) - $set_submitting = "if( !jQuery(\"#gform_{$form_id}\")[0].checkValidity || jQuery(\"#gform_{$form_id}\")[0].checkValidity()){window[\"gf_submitting_{$form_id}\"]=true;}"; - else - $set_submitting = "window[\"gf_submitting_{$form_id}\"]=true;"; - - $onclick="onclick='if(window[\"gf_submitting_{$form_id}\"]){return false;} $set_submitting '"; - } - - if($button["type"] == "text" || empty($button["imageUrl"])){ - $class .= ' button'; - $button_text = !empty($button["text"]) ? $button["text"] : $default_text; - $button_input = ""; - } - else{ - $imageUrl = $button["imageUrl"]; - $class .= ' gform_image_button'; - $button_input= ""; - } - return $button_input; - } - - private static function gform_footer($form, $class, $ajax, $field_values, $previous_button, $display_title, $display_description, $tabindex = 1){ - $form_id = $form["id"]; - $footer = " -
    "; - $button_input = self::get_form_button($form["id"], "gform_submit_button_{$form["id"]}", $form["button"], __("Submit", "gravityforms"), "gform_button", __("Submit", "gravityforms"), 0); - $button_input = apply_filters("gform_submit_button", $button_input, $form); - $button_input = apply_filters("gform_submit_button_{$form_id}", $button_input, $form); - $footer .= $previous_button . " " . $button_input; - - if($ajax){ - $footer .= ""; - } - - $current_page = self::get_current_page($form_id); - $next_page = $current_page + 1; - $next_page = $next_page > self::get_max_page_number($form) ? 0 : $next_page; - $field_values_str = is_array($field_values) ? http_build_query($field_values) : $field_values; - $files_input = ""; - if(GFCommon::has_multifile_fileupload_field($form) || !empty(RGFormsModel::$uploaded_files[$form_id])){ - $files = !empty(RGFormsModel::$uploaded_files[$form_id]) ? GFCommon::json_encode(RGFormsModel::$uploaded_files[$form_id]) : ""; - $files_input = ""; - } - - $footer .=" - - - - - - - - {$files_input} -
    "; + $script_string = ''; - return $footer; - } - - private static function get_max_page_number($form){ - $page_number = 0; - foreach($form["fields"] as $field){ - if($field["type"] == "page"){ - $page_number++; - } - } - return $page_number == 0 ? 0 : $page_number + 1; - } - - - private static function get_honeypot_field($form){ - $max_id = self::get_max_field_id($form); - $labels = self::get_honeypot_labels(); - return array("type" => "honeypot", "label" => $labels[rand(0, 3)], "id" => $max_id + 1, "cssClass" => "gform_validation_container", "description" => __("This field is for validation purposes and should be left unchanged.", "gravityforms")); - } - - private static function get_max_field_id($form){ - $max = 0; - foreach($form["fields"] as $field){ - if(floatval($field["id"]) > $max) - $max = floatval($field["id"]); - } - return $max; - } - - private static function get_honeypot_labels(){ - return array("Name", "Email", "Phone", "Comments"); - } - - public static function is_empty($field, $form_id=0){ - - if(empty($_POST["is_submit_" . $field["formId"]])){ - return true; - } - - switch(RGFormsModel::get_input_type($field)){ - case "post_image" : - case "fileupload" : - $input_name = "input_" . $field["id"]; - - if(rgar($field, "multipleFiles")){ - $uploaded_files = GFFormsModel::$uploaded_files[$form_id]; - $file_info = rgar($uploaded_files, $input_name); - return empty($file_info); - } else { - $file_info = GFFormsModel::get_temp_filename($form_id, $input_name); - return !$file_info && empty($_FILES[$input_name]['name']); - } - break; - - case "list" : - $value = rgpost("input_" . $field["id"]); - if(is_array($value)){ - //empty if all inputs are empty (for inputs with the same name) - foreach($value as $input){ - if(strlen(trim($input)) > 0 ) - return false; - } - } - - return true; - - } - - if(is_array($field["inputs"])) - { - foreach($field["inputs"] as $input){ - $value = rgpost("input_" . str_replace('.', '_', $input["id"])); - if(is_array($value) && !empty($value)){ - return false; - } - - $strlen = strlen(trim($value)); - if(!is_array($value) && strlen(trim($value)) > 0) - return false; - } - return true; - } - else{ - $value = rgpost("input_" . $field["id"]); - if(is_array($value)){ - //empty if any of the inputs are empty (for inputs with the same name) - foreach($value as $input){ - if(strlen(trim($input)) <= 0 ) - return true; - } - return false; - } - else if($field["enablePrice"]){ - list($label, $price) = explode("|", $value); - $is_empty = (strlen(trim($price)) <= 0); - return $is_empty; - } - else{ - $is_empty = (strlen(trim($value)) <= 0) || ($field["type"] == "post_category" && $value < 0); - return $is_empty; - } - } - } - - - /** - * Validates the range of the number according to the field settings. - * - * @param array $field - * @param array $value A decimal_dot formatted string - * @return true|false True on valid or false on invalid - */ - private static function validate_range($field, $value){ - - if( !GFCommon::is_numeric($value, "decimal_dot") ) - return false; - - if( (is_numeric($field["rangeMin"]) && $value < $field["rangeMin"]) || - (is_numeric($field["rangeMax"]) && $value > $field["rangeMax"]) - ) - return false; - else - return true; - } - - private static function validate_honeypot($form){ - $honeypot_id = self::get_max_field_id($form); - return rgempty("input_{$honeypot_id}"); - } - - public static function handle_submission($form, &$lead, $ajax=false){ - - $lead_id = apply_filters("gform_entry_id_pre_save_lead{$form["id"]}", apply_filters("gform_entry_id_pre_save_lead", null, $form), $form); - - if(!empty($lead_id)){ - if(empty($lead)){ - $lead = array(); - } - $lead["id"] = $lead_id; + // temporary solution for output gf_global obj until wp min version raised to 3.3 + if ( wp_script_is( 'gform_gravityforms' ) ) { + $gf_global_script = "if(typeof gf_global == 'undefined') " . GFCommon::gf_global( false ); } - //creating entry in DB - RGFormsModel::save_lead($form, $lead); + /* rendering initialization scripts */ + $init_scripts = rgar( self::$init_scripts, $form['id'] ); - //reading entry that was just saved - $lead = RGFormsModel::get_lead($lead["id"]); + if ( ! empty( $init_scripts ) ) { + $script_string = + "'; + } - RGFormsModel::set_current_lead($lead); + return $script_string; + } - if(!$is_spam){ - GFCommon::create_post($form, $lead); - //send notifications - GFCommon::send_form_submission_notifications($form, $lead); + public static function get_chosen_init_script( $form ) { + $chosen_fields = array(); + foreach ( $form['fields'] as $field ) { + $input_type = GFFormsModel::get_input_type( $field ); + if ( $field->enableEnhancedUI && in_array( $input_type, array( 'select', 'multiselect' ) ) ) { + $chosen_fields[] = "#input_{$form['id']}_{$field->id}"; + } } - self::clean_up_files($form); - - //display confirmation message or redirect to confirmation page - return self::handle_confirmation($form, $lead, $ajax); + return "gformInitChosenFields('" . implode( ',', $chosen_fields ) . "','" . esc_attr( apply_filters( "gform_dropdown_no_results_text_{$form['id']}", apply_filters( 'gform_dropdown_no_results_text', __( 'No results matched', 'gravityforms' ), $form['id'] ), $form['id'] ) ) . "');"; } - public static function clean_up_files($form){ - $unique_form_id = rgpost("gform_unique_id"); - if(!ctype_alnum($unique_form_id)) - return false; - $target_path = RGFormsModel::get_upload_path($form["id"]) . "/tmp/"; - $filename = $target_path . $unique_form_id . "_input_*"; - $files = glob($filename); - if (is_array($files)){ - array_map('unlink', $files); + public static function get_currency_format_init_script( $form ) { + $currency_fields = array(); + foreach ( $form['fields'] as $field ) { + if ( $field->numberFormat == 'currency' ) { + $currency_fields[] = "#input_{$form['id']}_{$field->id}"; + } } - // clean up file from abandoned submissions older than 48 hours - $files = glob($target_path."*"); - if (is_array($files)){ - foreach($files as $file) { - if(is_file($file) && time() - filemtime($file) >= 2*24*60*60) { - unlink($file); - } - } - } - } + return "gformInitCurrencyFormatFields('" . implode( ',', $currency_fields ) . "');"; + } - public static function handle_confirmation($form, $lead, $ajax=false){ + public static function get_copy_values_init_script( $form ) { + $script = "jQuery('.copy_values_activated').on('click', function(){ + var inputId = this.id.replace('_copy_values_activated', ''); + jQuery('#' + inputId).toggle(!this.checked); + });"; - GFCommon::log_debug("Sending confirmation"); + return $script; + } - //run the function to populate the legacy confirmation format to be safe - $form = self::update_confirmation($form, $lead); - - if($form["confirmation"]["type"] == "message"){ - $default_anchor = self::has_pages($form) ? 1 : 0; - $anchor = apply_filters("gform_confirmation_anchor_{$form["id"]}", apply_filters("gform_confirmation_anchor", $default_anchor)) ? "" : ""; - $nl2br = rgar($form["confirmation"],"disableAutoformat") ? false : true; - $cssClass = rgar($form, "cssClass"); - $confirmation = empty($form["confirmation"]["message"]) ? "{$anchor} " : "{$anchor}
    " . GFCommon::replace_variables($form["confirmation"]["message"], $form, $lead, false, true, $nl2br) . "
    "; - } - else{ - if ( ! empty( $form['confirmation']['pageId'] ) ) { - $url = get_permalink( $form['confirmation']['pageId'] ); + public static function get_placeholders_init_script( $form ) { - } else { - $url = GFCommon::replace_variables( trim( $form['confirmation']['url'] ), $form, $lead, false, true, true, 'text' ); + $script = "if(typeof Placeholders != 'undefined'){ + Placeholders.enable(); + }"; + + return $script; + } + + public static function get_counter_init_script( $form ) { + + $script = ''; + foreach ( $form['fields'] as $field ) { + $max_length = $field->maxLength; + $field_id = "input_{$form['id']}_{$field->id}"; + if ( ! empty( $max_length ) && ! $field->adminOnly ) { + $field_script = + "jQuery('#{$field_id}').textareaCount(" . + " {" . + " 'maxCharacterSize': {$max_length}," . + " 'originalStyle': 'ginput_counter'," . + " 'displayFormat' : '#input " . __( 'of', 'gravityforms' ) . ' #max ' . __( 'max characters', 'gravityforms' ) . "'" . + " } );"; + + $script .= apply_filters( "gform_counter_script_{$form['id']}", apply_filters( 'gform_counter_script', $field_script, $form['id'], $field_id, $max_length ), $form['id'], $field_id, $max_length ); } + } - $url_info = parse_url( $url ); - $query_string = rgar( $url_info, 'query' ); - $dynamic_query = GFCommon::replace_variables( trim( $form['confirmation']['queryString'] ), $form, $lead, true, false, false, 'text' ); - $query_string .= rgempty( 'query', $url_info ) || empty( $dynamic_query ) ? $dynamic_query : '&' . $dynamic_query; + return $script; + } + public static function get_pricing_init_script( $form ) { - if ( ! empty( $url_info['fragment'] ) ) { - $query_string .= '#' . rgar( $url_info, 'fragment' ); - } + if ( ! class_exists( 'RGCurrency' ) ) { + require_once( 'currency.php' ); + } - $url = $url_info['scheme'] . '://' . rgar( $url_info, 'host' ); - if ( ! empty( $url_info['port'] ) ) { - $url .= ':' . rgar( $url_info, 'port' ); - } + return "if(window[\"gformInitPriceFields\"]) jQuery(document).ready(function(){gformInitPriceFields();} );"; + } - $url .= rgar( $url_info, 'path' ); - if ( ! empty( $query_string ) ) { - $url .= "?{$query_string}"; - } + public static function get_password_strength_init_script( $form ) { + $field_script = "if(!window['gf_text']){window['gf_text'] = new Array();} window['gf_text']['password_blank'] = '" . __( 'Strength indicator', 'gravityforms' ) . "'; window['gf_text']['password_mismatch'] = '" . __( 'Mismatch', 'gravityforms' ) . "';window['gf_text']['password_bad'] = '" . __( 'Bad', 'gravityforms' ) . "'; window['gf_text']['password_short'] = '" . __( 'Short', 'gravityforms' ) . "'; window['gf_text']['password_good'] = '" . __( 'Good', 'gravityforms' ) . "'; window['gf_text']['password_strong'] = '" . __( 'Strong', 'gravityforms' ) . "';"; - if ( headers_sent() || $ajax ) { - //Perform client side redirect for AJAX forms, of if headers have already been sent - $confirmation = self::get_js_redirect_confirmation( $url, $ajax ); - } else { - $confirmation = array( 'redirect' => $url ); + foreach ( $form['fields'] as $field ) { + if ( $field->type == 'password' && $field->passwordStrengthEnabled ) { + $field_id = "input_{$form['id']}_{$field->id}"; + $field_script .= "gformShowPasswordStrength(\"$field_id\");"; } - } + } - $confirmation = apply_filters("gform_confirmation_{$form["id"]}", apply_filters("gform_confirmation", $confirmation, $form, $lead, $ajax), $form, $lead, $ajax); + return $field_script; + } - if(!is_array($confirmation)){ - $confirmation = GFCommon::gform_do_shortcode($confirmation); //enabling shortcodes - } - else if(headers_sent() || $ajax){ - //Perform client side redirect for AJAX forms, of if headers have already been sent - $confirmation = self::get_js_redirect_confirmation($confirmation["redirect"], $ajax); //redirecting via client side - } + public static function get_input_mask_init_script( $form ) { - GFCommon::log_debug("Confirmation: " . print_r($confirmation, true)); + $script_str = ''; - return $confirmation; - } - - private static function get_js_redirect_confirmation($url, $ajax){ - $confirmation = ""; - - return $confirmation; - } - - public static function send_emails($form, $lead){ - _deprecated_function("send_emails", "1.7", "GFCommon::send_form_submission_notifications"); - GFCommon::send_form_submission_notifications($form, $lead); - } - - public static function checkdate($month, $day, $year){ - if(empty($month) || !is_numeric($month) || empty($day) || !is_numeric($day) || empty($year) || !is_numeric($year) || strlen($year) != 4) - return false; - - return checkdate($month, $day, $year); - } - - public static function validate(&$form, $field_values, $page_number=0, &$failed_validation_page=0){ - - $form = apply_filters('gform_pre_validation', $form); - - // validate form schedule - if(self::validate_form_schedule($form)) - return false; - - // validate entry limit - if(self::validate_entry_limit($form)) - return false; - - if(empty($_POST["is_submit_" . $form["id"]])){ - return false; - } - - foreach($form["fields"] as &$field){ - - //If a page number is specified, only validates fields that are on current page - $field_in_other_page = $page_number > 0 && $field["pageNumber"] != $page_number; - - //validate fields with "no duplicate" functionality when they are present on pages before the current page. - $validate_duplicate_feature = $field["noDuplicates"] && $page_number > 0 && $field["pageNumber"] <= $page_number; - - //if(($page_number > 0 && $field["pageNumber"] != $page_number) && $field["noDuplicates"] <> "1"){ - if($field_in_other_page && !$validate_duplicate_feature){ - continue; - } - - //ignore validation if field is hidden or admin only - if(RGFormsModel::is_field_hidden($form, $field, $field_values) || $field["adminOnly"]){ - continue; - } - - $value = RGFormsModel::get_field_value($field); - - //display error message if field is marked as required and the submitted value is empty - if($field["isRequired"] && self::is_empty($field, $form["id"])){ - $field["failed_validation"] = true; - $field["validation_message"] = empty($field["errorMessage"]) ? __("This field is required.", "gravityforms") : $field["errorMessage"]; - } - //display error if field does not allow duplicates and the submitted value already exists - else if($field["noDuplicates"] && RGFormsModel::is_duplicate($form["id"], $field, $value)){ - $field["failed_validation"] = true; - //set page number so the failed field displays if on multi-page form - $failed_validation_page = $field["pageNumber"]; - - $input_type = RGFormsModel::get_input_type($field); - switch($input_type){ - case "date" : - $default_message = __("This date has already been taken. Please select a new date.", "gravityforms"); - break; - - default: - $default_message = is_array($value) ? __("This field requires a unique entry and the values you entered have been already been used.", "gravityforms") : - sprintf(__("This field requires a unique entry and '%s' has already been used", "gravityforms"), $value); - break; - } - - $field["validation_message"] = apply_filters( "gform_duplicate_message_{$form["id"]}", apply_filters("gform_duplicate_message", $default_message, $form, $field, $value ), $form, $field, $value ); - - } - else{ - if(self::failed_state_validation($form["id"], $field, $value)){ - $field["failed_validation"] = true; - $field["validation_message"] = in_array($field["inputType"], array("singleproduct", "singleshipping", "hiddenproduct")) ? __("Please enter a valid value.", "gravityforms") : __("Invalid selection. Please select one of the available choices.", "gravityforms"); - } - else{ - switch(RGFormsModel::get_input_type($field)){ - case "password" : - $password = $_POST["input_" . $field["id"]]; - $confirm = $_POST["input_" . $field["id"] . "_2"]; - if($password != $confirm){ - $field["failed_validation"] = true; - $field["validation_message"] = __("Your passwords do not match.", "gravityforms"); - } - else if(rgar($field,"passwordStrengthEnabled") && !rgempty("minPasswordStrength",$field) && !empty($password)){ - $strength = $_POST["input_" . $field["id"] . "_strength"]; - - $levels = array("short" => 1, "bad" => 2, "good" => 3, "strong" => 4); - if($levels[$strength] < $levels[$field["minPasswordStrength"]]){ - $field["failed_validation"] = true; - $field["validation_message"] = empty($field["errorMessage"]) ? __("Your password does not meet the required strength.
    Hint: To make it stronger, use upper and lower case letters, numbers and symbols like ! \" ? $ % ^ & ).", "gravityforms") : $field["errorMessage"]; - } - } - break; - - case "name" : - if($field["isRequired"] && $field["nameFormat"] != "simple") - { - $first = $_POST["input_" . $field["id"] . "_3"]; - $last = $_POST["input_" . $field["id"] . "_6"]; - if(empty($first) || empty($last)){ - $field["failed_validation"] = true; - $field["validation_message"] = empty($field["errorMessage"]) ? __("This field is required. Please enter the first and last name.", "gravityforms") : $field["errorMessage"]; - } - } - - break; - - case "address" : - if($field["isRequired"]) - { - $street = $_POST["input_" . $field["id"] . "_1"]; - $city = $_POST["input_" . $field["id"] . "_3"]; - $state = $_POST["input_" . $field["id"] . "_4"]; - $zip = $_POST["input_" . $field["id"] . "_5"]; - $country = $_POST["input_" . $field["id"] . "_6"]; - if(empty($street) || empty($city) || empty($zip) || (empty($state) && !$field["hideState"] ) || (empty($country) && !$field["hideCountry"])){ - $field["failed_validation"] = true; - $field["validation_message"] = empty($field["errorMessage"]) ? __("This field is required. Please enter a complete address.", "gravityforms") : $field["errorMessage"]; - } - } - - break; - - case "creditcard" : - $card_number = rgpost("input_" . $field["id"] . "_1"); - $expiration_date = rgpost("input_" . $field["id"] . "_2"); - $security_code = rgpost("input_" . $field["id"] . "_3"); - - if(rgar($field, "isRequired") && (empty($card_number) || empty($security_code) || empty($expiration_date[0]) || empty($expiration_date[1]))){ - $field["failed_validation"] = true; - $field["validation_message"] = empty($field["errorMessage"]) ? __("Please enter your credit card information.", "gravityforms") : $field["errorMessage"]; - } - else if(!empty($card_number)){ - $card_type = GFCommon::get_card_type($card_number); - $security_code = rgpost("input_" . $field["id"] . "_3"); - - if(empty($security_code)){ - $field["failed_validation"] = true; - $field["validation_message"] = __("Please enter your card's security code.", "gravityforms"); - } - else if(!$card_type){ - $field["failed_validation"] = true; - $field["validation_message"] = __("Invalid credit card number.", "gravityforms"); - } - else if(!GFCommon::is_card_supported($field, $card_type["slug"])){ - $field["failed_validation"] = true; - $field["validation_message"] = $card_type["name"] . " " . __("is not supported. Please enter one of the supported credit cards.", "gravityforms"); - } - } - break; - - case "email" : - if(!rgblank($value) && !GFCommon::is_valid_email($value)){ - $field["failed_validation"] = true; - $field["validation_message"] = empty($field["errorMessage"]) ? __("Please enter a valid email address.", "gravityforms"): $field["errorMessage"]; - } - else if(rgget("emailConfirmEnabled", $field) && !empty($value)){ - $confirm = rgpost("input_" . $field["id"] . "_2"); - if($confirm != $value){ - $field["failed_validation"] = true; - $field["validation_message"] = __("Your emails do not match.", "gravityforms"); - } - } - break; - - case "donation" : - case "price" : - - if(!class_exists("RGCurrency")) - require_once("currency.php"); - - $donation = GFCommon::to_number($value); - if(!rgblank($value) && ($donation === false || $donation < 0)){ - $field["failed_validation"] = true; - $field["validation_message"] = empty($field["errorMessage"]) ? __("Please enter a valid amount.", "gravityforms") : $field["errorMessage"]; - - } - break; - - case "number" : - - // the POST value has already been converted from currency or decimal_comma to decimal_dot and then cleaned in get_field_value() - - $value = GFCommon::maybe_add_leading_zero($value); - $raw_value = $_POST["input_" . $field["id"]]; //Raw value will be tested against the is_numeric() function to make sure it is in the right format. - - $requires_valid_number = !rgblank($raw_value) && !GFCommon::has_field_calculation($field); - $is_valid_number = self::validate_range($field, $value) && GFCommon::is_numeric($raw_value, $field["numberFormat"]); - - if( $requires_valid_number && !$is_valid_number ) { - $field["failed_validation"] = true; - $field["validation_message"] = empty($field["errorMessage"]) ? GFCommon::get_range_message($field) : $field["errorMessage"]; - } - else if( $field['type'] == 'quantity' ) { - if( intval( $value ) != $value ) { - $field['failed_validation'] = true; - $field['validation_message'] = empty( $field['errorMessage'] ) ? __( 'Please enter a valid quantity. Quantity cannot contain decimals.', 'gravityforms' ) : $field['errorMessage']; - } else if( ! empty( $value ) && ( ! is_numeric( $value ) || intval( $value ) != floatval( $value ) || intval( $value ) < 0 ) ) { - $field['failed_validation'] = true; - $field['validation_message'] = empty( $field['errorMessage'] ) ? __( 'Please enter a valid quantity', 'gravityforms' ) : $field['errorMessage']; - } - } - - break; - - case "phone" : - - $regex = '/^\D?(\d{3})\D?\D?(\d{3})\D?(\d{4})$/'; - if($field["phoneFormat"] == "standard" && $value !== "" && $value !== 0 && !preg_match($regex, $value)){ - $field["failed_validation"] = true; - if(!empty($field["errorMessage"])) - $field["validation_message"] = $field["errorMessage"]; - } - break; - - case "date" : - if(is_array($value) && rgempty(0, $value) && rgempty(1, $value)&& rgempty(2, $value)) - $value = null; - - if(!empty($value)){ - $format = empty($field["dateFormat"]) ? "mdy" : $field["dateFormat"]; - $date = GFCommon::parse_date($value, $format); - - if(empty($date) || !self::checkdate($date["month"], $date["day"], $date["year"])){ - $field["failed_validation"] = true; - $format_name = ""; - switch($format){ - case "mdy" : - $format_name = "mm/dd/yyyy"; - break; - case "dmy" : - $format_name = "dd/mm/yyyy"; - break; - case "dmy_dash" : - $format_name = "dd-mm-yyyy"; - break; - case "dmy_dot" : - $format_name = "dd.mm.yyyy"; - break; - case "ymd_slash" : - $format_name = "yyyy/mm/dd"; - break; - case "ymd_dash" : - $format_name = "yyyy-mm-dd"; - break; - case "ymd_dot" : - $format_name = "yyyy.mm.dd"; - break; - } - $message = $field["dateType"] == "datepicker" ? sprintf(__("Please enter a valid date in the format (%s).", "gravityforms"), $format_name) : __("Please enter a valid date.", "gravityforms"); - $field["validation_message"] = empty($field["errorMessage"]) ? $message : $field["errorMessage"]; - } - } - break; - - case "time" : - - //create variable values if time came in one field - if(!is_array($value) && !empty($value)){ - preg_match('/^(\d*):(\d*) ?(.*)$/', $value, $matches); - $value = array(); - $value[0] = $matches[1]; - $value[1] = $matches[2]; - } - - $hour = $value[0]; - $minute = $value[1]; - - if(empty($hour) && empty($minute)) - break; - - $is_valid_format = is_numeric($hour) && is_numeric($minute); - - $min_hour = rgar($field, "timeFormat") == "24" ? 0 : 1; - $max_hour = rgar($field, "timeFormat") == "24" ? 23 : 12; - - if(!$is_valid_format || $hour < $min_hour || $hour > $max_hour || $minute < 0 || $minute >= 60) - { - $field["failed_validation"] = true; - $field["validation_message"] = empty($field["errorMessage"]) ? __("Please enter a valid time." , "gravityforms"): $field["errorMessage"]; - } - break; - - case "website" : - if(empty($value) || $value == "http://"){ - $value = ""; - if($field["isRequired"]){ - $field["failed_validation"] = true; - $field["validation_message"] = empty($field["errorMessage"]) ? __("This field is required.", "gravityforms") : $field["errorMessage"]; - } - } - - if(!empty($value) && !GFCommon::is_valid_url($value)){ - $field["failed_validation"] = true; - $field["validation_message"] = empty($field["errorMessage"]) ? __("Please enter a valid Website URL (i.e. http://www.gravityforms.com).", "gravityforms") : $field["errorMessage"]; - } - break; - - case "captcha" : - switch($field["captchaType"]){ - case "simple_captcha" : - if(class_exists("ReallySimpleCaptcha")){ - $prefix = $_POST["input_captcha_prefix_{$field["id"]}"]; - $captcha_obj = GFCommon::get_simple_captcha(); - - if(!$captcha_obj->check($prefix, str_replace(" ", "", $value))){ - $field["failed_validation"] = true; - $field["validation_message"] = empty($field["errorMessage"]) ? __("The CAPTCHA wasn't entered correctly. Go back and try it again.", "gravityforms") : $field["errorMessage"]; - } - - //removes old files in captcha folder (older than 1 hour); - $captcha_obj->cleanup(); - } - break; - - case "math" : - $prefixes = explode(",", $_POST["input_captcha_prefix_{$field["id"]}"]); - $captcha_obj = GFCommon::get_simple_captcha(); - - //finding first number - $first = 0; - for($first=0; $first<10; $first++){ - if($captcha_obj->check($prefixes[0], $first)) - break; - } - - //finding second number - $second = 0; - for($second=0; $second<10; $second++){ - if($captcha_obj->check($prefixes[2], $second)) - break; - } - - //if it is a +, perform the sum - if($captcha_obj->check($prefixes[1], "+")) - $result = $first + $second; - else - $result = $first - $second; - - - if(intval($result) != intval($value)){ - $field["failed_validation"] = true; - $field["validation_message"] = empty($field["errorMessage"]) ? __("The CAPTCHA wasn't entered correctly. Go back and try it again.", "gravityforms") : $field["errorMessage"]; - } - - //removes old files in captcha folder (older than 1 hour); - $captcha_obj->cleanup(); - - break; - - default : - if(!function_exists("recaptcha_get_html")){ - require_once(GFCommon::get_base_path() . '/recaptchalib.php'); - } - - $privatekey = get_option("rg_gforms_captcha_private_key"); - $resp = recaptcha_check_answer ($privatekey, - $_SERVER["REMOTE_ADDR"], - $_POST["recaptcha_challenge_field"], - $_POST["recaptcha_response_field"]); - - if (!$resp->is_valid) { - $field["failed_validation"] = true; - $field["validation_message"] = empty($field["errorMessage"]) ? __("The reCAPTCHA wasn't entered correctly. Go back and try it again.", "gravityforms") : $field["errorMessage"]; - } - } - break; - - case "fileupload" : - case "post_image" : - $input_name = "input_" . $field["id"]; - - if(rgar($field, "multipleFiles")){ - $file_names = isset(GFFormsModel::$uploaded_files[$form["id"]][$input_name]) ? GFFormsModel::$uploaded_files[$form["id"]][$input_name] : array(); - } else { - $max_upload_size_in_bytes = isset($field["maxFileSize"]) && $field["maxFileSize"] > 0 ? $field["maxFileSize"] * 1048576: wp_max_upload_size(); - $max_upload_size_in_mb = $max_upload_size_in_bytes / 1048576; - if(!empty($_FILES[$input_name]["name"]) && $_FILES[$input_name]["error"] > 0){ - $uploaded_file_name = isset(GFFormsModel::$uploaded_files[$form["id"]][$input_name]) ? GFFormsModel::$uploaded_files[$form["id"]][$input_name] : ""; - if(empty($uploaded_file_name)){ - $field["failed_validation"] = true; - switch($_FILES[$input_name]["error"]){ - case UPLOAD_ERR_INI_SIZE : - case UPLOAD_ERR_FORM_SIZE : - $fileupload_validation_message = sprintf(__("File exceeds size limit. Maximum file size: %dMB", "gravityforms"), $max_upload_size_in_mb); - break; - default : - $fileupload_validation_message = sprintf(__("There was an error while uploading the file. Error code: %d", "gravityforms"), $_FILES[$input_name]["error"]); - } - $field["validation_message"] = empty($field["errorMessage"]) ? $fileupload_validation_message : $field["errorMessage"]; - break; - } - - } elseif ( $_FILES[ $input_name ]['size'] > 0 && $_FILES[ $input_name ]['size'] > $max_upload_size_in_bytes ) { - $field["failed_validation"] = true; - $field["validation_message"] = sprintf( __( 'File exceeds size limit. Maximum file size: %dMB', 'gravityforms' ), $max_upload_size_in_mb ); - } - $single_file_name = $_FILES[$input_name]["name"]; - $file_names = array(array("uploaded_filename" => $single_file_name)); - - } - - foreach($file_names as $file_name){ - $info = pathinfo(rgar($file_name, "uploaded_filename")); - $allowed_extensions = isset($field["allowedExtensions"]) && !empty($field["allowedExtensions"]) ? GFCommon::clean_extensions(explode(",", strtolower($field["allowedExtensions"]))) : array(); - - if( empty( $field["allowedExtensions"] ) && GFCommon::file_name_has_disallowed_extension( rgar( $file_name, 'uploaded_filename' ) ) ){ - $field["failed_validation"] = true; - $field["validation_message"] = empty($field["errorMessage"]) ? __("The uploaded file type is not allowed.", "gravityforms") : $field["errorMessage"]; - } - else if(!empty($field["allowedExtensions"]) && !empty($info["basename"]) && ! GFCommon::match_file_extension( rgar( $file_name, 'uploaded_filename' ), $allowed_extensions )){ - $field["failed_validation"] = true; - $field["validation_message"] = empty($field["errorMessage"]) ? sprintf(__("The uploaded file type is not allowed. Must be one of the following: %s", "gravityforms"), strtolower($field["allowedExtensions"]) ) : $field["errorMessage"]; - } - } + foreach ( $form['fields'] as $field ) { - break; - - case "calculation" : - case "singleproduct" : - case "hiddenproduct" : - $quantity_id = $field["id"] . ".3"; - $quantity = rgget($quantity_id, $value); - - if($field["isRequired"] && rgblank($quantity) && !rgar($field, "disableQuantity") ){ - $field["failed_validation"] = true; - $field["validation_message"] = rgempty("errorMessage", $field) ? __("This field is required.", "gravityforms") : rgar($field, "errorMessage"); - } - else if(!empty($quantity) && (!is_numeric($quantity) || intval($quantity) != floatval($quantity) || intval($quantity) < 0) ) { - $field["failed_validation"] = true; - $field["validation_message"] = __("Please enter a valid quantity", "gravityforms"); - } - - break; - - case "radio" : - - if(rgar($field, 'enableOtherChoice') && $value == 'gf_other_choice') - $value = rgpost("input_{$field['id']}_other"); - - if($field["isRequired"] && rgar($field, 'enableOtherChoice') && $value == GFCommon::get_other_choice_value()) { - $field["failed_validation"] = true; - $field["validation_message"] = empty($field["errorMessage"]) ? __("This field is required.", "gravityforms") : $field["errorMessage"]; - } - - break; - } - } - } - - $custom_validation_result = apply_filters("gform_field_validation", array("is_valid"=> rgar($field, "failed_validation") ? false : true, "message"=>rgar($field, "validation_message")), $value, $form, $field); - $custom_validation_result = apply_filters("gform_field_validation_{$form["id"]}", $custom_validation_result, $value, $form, $field); - $custom_validation_result = apply_filters("gform_field_validation_{$form["id"]}_{$field["id"]}", $custom_validation_result, $value, $form, $field); - - $field["failed_validation"] = rgar($custom_validation_result, "is_valid") ? false : true; - $field["validation_message"] = rgar($custom_validation_result, "message"); - } - - $is_valid = true; - foreach($form["fields"] as $f){ - if(rgar($f,"failed_validation")){ - $is_valid = false; - break; - } - } - - $validation_result = apply_filters("gform_validation_{$form["id"]}", apply_filters("gform_validation", array("is_valid" => $is_valid, "form" => $form)) ); - $is_valid = $validation_result["is_valid"]; - $form = $validation_result["form"]; - - return $is_valid; - } - - public static function failed_state_validation($form_id, $field, $value){ - - global $_gf_state; - - //if field can be populated dynamically, disable state validation - if(rgar($field,"allowsPrepopulate")) { - return false; - } else if(!GFCommon::is_product_field($field["type"] && $field["type"] != "donation")) { - return false; - } else if (!in_array($field["inputType"], array("singleshipping", "singleproduct", "hiddenproduct", "checkbox", "radio", "select"))) { - return false; - } - - if(!isset($_gf_state)){ - $state = json_decode(base64_decode($_POST["state_{$form_id}"]), true); - - if(!$state || sizeof($state) != 2) - return true; - - //making sure state wasn't tampered with by validating checksum - $checksum = wp_hash(crc32($state[0])); - - if($checksum !== $state[1]){ - return true; - } - - $_gf_state = json_decode($state[0], true); - } - - if(!is_array($value)){ - $value = array($field["id"] => $value); - } - - foreach($value as $key => $input_value){ - $state = isset($_gf_state[$key]) ? $_gf_state[$key] : false; - - //converting price to a number for single product fields and single shipping fields - if( (in_array($field["inputType"], array("singleproduct", "hiddenproduct")) && $key == $field["id"] . ".2") || $field["inputType"] == "singleshipping") - $input_value = GFCommon::to_number($input_value); - - $hash = wp_hash($input_value); - - if(strlen($input_value) > 0 && $state !== false && ((is_array($state) && !in_array($hash, $state)) || (!is_array($state) && $hash != $state)) ){ - return true; - } - } - return false; - } - - public static function enqueue_scripts(){ - global $wp_query; - if(isset($wp_query->posts) && is_array($wp_query->posts)){ - foreach($wp_query->posts as $post){ - $forms = self::get_embedded_forms($post->post_content, $ajax); - foreach($forms as $form){ - if(isset($form["id"])) - self::enqueue_form_scripts($form, $ajax); - } - } - } - } - - public static function get_embedded_forms($post_content, &$ajax){ - $forms = array(); - if(preg_match_all('/\[gravityform[s]? +.*?((id=.+?)|(name=.+?))\]/is', $post_content, $matches, PREG_SET_ORDER)){ - $ajax = false; - foreach($matches as $match){ - //parsing shortcode attributes - $attr = shortcode_parse_atts($match[1]); - $form_id = rgar($attr, "id"); - if(!is_numeric($form_id)){ - $form_id = RGFormsModel::get_form_id( rgar($attr, "name") ); - } + if ( ! $field->inputMask || ! $field->inputMaskValue ) { + continue; + } - if(!empty($form_id)){ - $forms[] = RGFormsModel::get_form_meta($form_id); - $ajax = isset($attr["ajax"]) && strtolower(substr($attr["ajax"],0, 4)) == "true"; - } - } - } - return $forms; - } + $mask = $field->inputMaskValue; + $script = "jQuery('#input_{$form['id']}_{$field->id}').mask('" . esc_js( $mask ) . "').bind('keypress', function(e){if(e.which == 13){jQuery(this).blur();} } );"; - public static function enqueue_form_scripts( $form, $ajax = false ){ + $script_str .= apply_filters( "gform_input_mask_script_{$form['id']}", apply_filters( 'gform_input_mask_script', $script, $form['id'], $field->id, $mask ), $form['id'], $field->id, $mask ); + } - // adding pre enqueue scripts hook so that scripts can be added first if a need exists - do_action("gform_pre_enqueue_scripts_{$form["id"]}", do_action("gform_pre_enqueue_scripts", $form, $ajax), $ajax); + return $script_str; + } - if(!get_option('rg_gforms_disable_css')){ + public static function get_calculations_init_script( $form ) { + require_once( GFCommon::get_base_path() . '/currency.php' ); - wp_enqueue_style("gforms_reset_css", GFCommon::get_base_url() . "/css/formreset.css", null, GFCommon::$version); + $formula_fields = array(); - if( self::has_datepicker_field( $form ) ) { - wp_enqueue_style("gforms_datepicker_css", GFCommon::get_base_url() . "/css/datepicker.css", null, GFCommon::$version); - } + foreach ( $form['fields'] as $field ) { - wp_enqueue_style("gforms_formsmain_css", GFCommon::get_base_url() . "/css/formsmain.css", null, GFCommon::$version); - wp_enqueue_style("gforms_ready_class_css", GFCommon::get_base_url() . "/css/readyclass.css", null, GFCommon::$version); - wp_enqueue_style("gforms_browsers_css", GFCommon::get_base_url() . "/css/browsers.css", null, GFCommon::$version); + if ( ! $field->enableCalculation || ! $field->calculationFormula ) { + continue; + } - if(is_rtl()){ - wp_enqueue_style("gforms_rtl_css", GFCommon::get_base_url() . "/css/rtl.css", null, GFCommon::$version); - } + $formula_fields[] = array( 'field_id' => $field->id, 'formula' => $field->calculationFormula, 'rounding' => $field->calculationRounding ); - } + } - if( self::has_conditional_logic( $form ) ) { - wp_enqueue_script( 'gform_conditional_logic' ); - } + if ( empty( $formula_fields ) ) { + return ''; + } - if( self::has_datepicker_field( $form ) ) { - wp_enqueue_script( 'gform_datepicker_init' ); - } + $script = self::get_number_formats_script( $form ); + $script .= 'new GFCalc(' . $form['id'] . ', ' . GFCommon::json_encode( $formula_fields ) . ');'; - if( $ajax || self::has_price_field( $form ) || self::has_password_strength( $form ) || GFCommon::has_list_field( $form ) || GFCommon::has_credit_card_field($form) || self::has_conditional_logic( $form ) || self::has_currency_format_number_field($form) || self::has_calculation_field( $form ) ) { - wp_enqueue_script( 'gform_gravityforms' ); - } + return $script; + } - if(GFCommon::has_multifile_fileupload_field($form)){ - wp_enqueue_script( 'plupload-all' ); - GFCommon::localize_gform_gravityforms_multifile(); - } + /** + * Generates a map of fields IDs and their corresponding number formats used by the GFCalc JS object for correctly + * converting field values to clean numbers. + * + * - Number fields have a 'numberFormat' setting (w/ UI). + * - Single-input product fields (i.e. 'singleproduct', 'calculation', 'price' and 'hiddenproduct') should default to + * the number format of the configured currency. + * - All other product fields will default to 'decimal_dot' for the number format. + * - All other fields will have no format (false) and inherit the format of the formula field when the formula is + * calculated. + * + * @param mixed $form + * @return string + */ + public static function get_number_formats_script( $form ) { + + $number_formats = array(); + $currency = RGCurrency::get_currency( GFCommon::get_currency() ); + + foreach ( $form['fields'] as $field ) { + + // default format is false, fields with no format will inherit the format of the formula field when calculated + $format = false; + + switch ( GFFormsModel::get_input_type( $field ) ) { + case 'number': + $format = $field->numberFormat ? $field->numberFormat : 'decimal_dot'; + break; + case 'singleproduct': + case 'calculation': + case 'price': + case 'hiddenproduct': + case 'singleshipping': + $format = $currency['decimal_separator'] == ',' ? 'decimal_comma' : 'decimal_dot'; + break; + default: + + // we check above for all single-input product types, for all other products, assume decimal format + if ( in_array( $field->type, array( 'product', 'option', 'shipping' ) ) ) { + $format = 'decimal_dot'; + } + } - if( self::has_enhanced_dropdown( $form ) || self::has_pages( $form ) || self::has_fileupload_field( $form ) ) { - wp_enqueue_script( 'gform_json' ); - wp_enqueue_script( 'gform_gravityforms' ); - } + $number_formats[ $field->id ] = $format; - if( self::has_character_counter( $form ) ) { - wp_enqueue_script( 'gform_textarea_counter' ); - } + } - if( self::has_input_mask( $form ) ) { - wp_enqueue_script( 'gform_masked_input' ); - } + return 'gf_global["number_formats"][' . $form['id'] . '] = ' . json_encode( $number_formats ) . ';'; + } - if( self::has_enhanced_dropdown( $form ) ) { - if( wp_script_is( 'chosen', 'registered' ) ) { - wp_enqueue_script( 'chosen' ); - } else { - wp_enqueue_script( 'gform_chosen' ); - } - } + private static function has_datepicker_field( $form ) { + if ( is_array( $form['fields'] ) ) { + foreach ( $form['fields'] as $field ) { - do_action( 'gform_enqueue_scripts', $form, $ajax ); - do_action( "gform_enqueue_scripts_{$form['id']}", $form, $ajax ); + if ( RGFormsModel::get_input_type( $field ) == 'date' && $field->dateType == 'datepicker' ) { + return true; + } + } + } - // enqueue jQuery every time form is displayed to allow "gform_post_render" js hook - // to be available to users even when GF is not using it - wp_enqueue_script( 'jquery' ); + return false; + } - } + private static function has_price_field( $form ) { + $price_fields = GFCommon::get_fields_by_type( $form, array( 'product', 'donation' ) ); - private static $printed_scripts = array(); + return ! empty( $price_fields ); + } - public static function print_form_scripts( $form, $ajax ) { + private static function has_fileupload_field( $form ) { + if ( is_array( $form['fields'] ) ) { + foreach ( $form['fields'] as $field ) { + $input_type = RGFormsModel::get_input_type( $field ); + if ( in_array( $input_type, array( 'fileupload', 'post_image' ) ) ) { + return true; + } + } + } - if( ! get_option( 'rg_gforms_disable_css' ) ) { + return false; + } - if( ! wp_style_is( 'gforms_css' ) ) { + private static function has_currency_format_number_field( $form ) { + if ( is_array( $form['fields'] ) ) { + foreach ( $form['fields'] as $field ) { + $input_type = RGFormsModel::get_input_type( $field ); + if ( $input_type == 'number' && $field->numberFormat == 'currency' ) { + return true; + } + } + } - wp_enqueue_style("gforms_reset_css", GFCommon::get_base_url() . "/css/formreset.css", null, GFCommon::$version); - wp_enqueue_style("gforms_formsmain_css", GFCommon::get_base_url() . "/css/formsmain.css", null, GFCommon::$version); - wp_enqueue_style("gforms_ready_class_css", GFCommon::get_base_url() . "/css/readyclass.css", null, GFCommon::$version); - wp_enqueue_style("gforms_browsers_css", GFCommon::get_base_url() . "/css/browsers.css", null, GFCommon::$version); + return false; + } - wp_print_styles(array("gforms_reset_css")); + private static function has_currency_copy_values_option( $form ) { + if ( is_array( $form['fields'] ) ) { + foreach ( $form['fields'] as $field ) { + if ( $field->enableCopyValuesOption == true ) { + return true; + } + } + } - if( self::has_datepicker_field( $form ) ) { - wp_enqueue_style("gforms_datepicker_css", GFCommon::get_base_url() . "/css/datepicker.css", null, GFCommon::$version); - wp_print_styles(array("gforms_datepicker_css")); - } + return false; + } - wp_print_styles(array("gforms_formsmain_css")); - wp_print_styles(array("gforms_ready_class_css")); - wp_print_styles(array("gforms_browsers_css")); + private static function has_recaptcha_field( $form ) { + if ( is_array( $form['fields'] ) ) { + foreach ( $form['fields'] as $field ) { + if ( ( $field->type == 'captcha' || $field->inputType == 'captcha' ) && ! in_array( $field->captchaType, array( 'simple_captcha', 'math' ) ) ) { + return true; + } + } + } - if( is_rtl() ) { - wp_enqueue_style("gforms_rtl_css", GFCommon::get_base_url() . "/css/rtl.css", null, GFCommon::$version); - wp_print_styles(array("gforms_rtl_css")); - } + return false; + } - } - } + public static function has_input_mask( $form, $field = false ) { - $scripts = array(); + if ( $field ) { + if ( self::has_field_input_mask( $field ) ) { + return true; + } + } else { - if( ( $ajax || self::has_enhanced_dropdown( $form ) || self::has_price_field( $form ) || self::has_password_strength( $form ) || self::has_pages( $form ) || self::has_password_strength( $form ) || GFCommon::has_list_field( $form ) || GFCommon::has_credit_card_field( $form ) || self::has_calculation_field( $form ) ) && ! wp_script_is( 'gform_gravityforms' ) ) { - $scripts[] = 'gform_gravityforms'; - } + if ( ! is_array( $form['fields'] ) ) { + return false; + } - if( self::has_conditional_logic( $form ) && ! wp_script_is( 'gform_conditional_logic' ) ) { - $scripts[] = 'gform_conditional_logic'; - } + foreach ( $form['fields'] as $field ) { + if ( self::has_field_input_mask( $field ) ) { + return true; + } + } + } - if( self::has_datepicker_field( $form ) && ! wp_script_is( 'gform_datepicker_init' ) ) { - $scripts[] = 'gform_datepicker_init'; - } + return false; + } - if( self::has_pages( $form ) && ! wp_script_is( 'gform_json' ) ) { - $scripts[] = 'gform_json'; - } + public static function has_field_input_mask( $field ) { - if( self::has_character_counter( $form ) && ! wp_script_is( 'gform_textarea_counter' ) ) { - $scripts[] = 'gform_textarea_counter'; - } + $type = GFFormsModel::get_input_type( $field ); + if ( $type == 'phone' && $field->phoneFormat == 'standard' ) { + return true; + } - if( self::has_input_mask( $form ) && ! wp_script_is( 'gform_masked_input' ) ) { - $scripts[] = 'gform_masked_input'; - } + if ( $field->inputMask && $field->inputMaskValue && ! $field->enablePasswordInput ) { + return true; + } - if( self::has_enhanced_dropdown( $form ) && ! wp_script_is( 'gform_chosen' ) && ! wp_script_is( 'chosen' ) ) { - if( wp_script_is( 'chosen', 'registered' ) ) { - $scripts[] = 'chosen'; - } else { - $scripts[] = 'gform_chosen'; - } - } + return false; + } - if( ! wp_script_is( 'jquery' ) ) { - $scripts[] = 'jquery'; - } + public static function has_calculation_field( $form ) { - foreach( $scripts as $script ) { - wp_enqueue_script( $script ); - } + if ( ! is_array( $form['fields'] ) ) { + return false; + } - wp_print_scripts( $scripts ); + foreach ( $form['fields'] as $field ) { + /* @var $field GF_Field */ + if ( $field->has_calculation() ) { + return true; + } + } - if( wp_script_is( 'gform_gravityforms' ) ) { - echo ''; - } + return false; + } - } + //Getting all fields that have a rule based on the specified field id + public static function get_conditional_logic_fields( $form, $fieldId ) { + $fields = array(); - public static function has_conditional_logic( $form ) { - $has_conditional_logic = self::has_conditional_logic_legwork( $form ); - return apply_filters( 'gform_has_conditional_logic', $has_conditional_logic, $form ); - } + //adding submit button field if enabled + if ( isset( $form['button']['conditionalLogic'] ) ) { + $fields[] = 0; + } - private static function has_conditional_logic_legwork($form){ + foreach ( $form['fields'] as $field ) { - if(empty($form)) - return false; + if ( $field->type != 'page' && ! empty( $field->conditionalLogic ) ) { + foreach ( $field->conditionalLogic['rules'] as $rule ) { + if ( $rule['fieldId'] == $fieldId ) { + $fields[] = floatval( $field->id ); - if(isset($form["button"]["conditionalLogic"])) - return true; + //if field is a section, add all fields in the section that have conditional logic (to support nesting) + if ( $field->type == 'section' ) { + $section_fields = GFCommon::get_section_fields( $form, $field->id ); + foreach ( $section_fields as $section_field ) { + if ( ! empty( $section_field['conditionalLogic'] ) ) { + $fields[] = floatval( $section_field['id'] ); + } + } + } + break; + } + } + } + //adding fields with next button logic + if ( ! empty( $field->nextButton['conditionalLogic'] ) ) { + foreach ( $field->nextButton['conditionalLogic']['rules'] as $rule ) { + if ( $rule['fieldId'] == $fieldId && ! in_array( $fieldId, $fields ) ) { + $fields[] = floatval( $field->id ); + break; + } + } + } + } - if(is_array(rgar($form,"fields"))){ - foreach(rgar($form,"fields") as $field){ - if(!empty($field["conditionalLogic"])){ - return true; - } - else if(isset($field["nextButton"]) && !empty($field["nextButton"]["conditionalLogic"])){ - return true; - } - } - } + return $fields; + } - return false; - } - - private static function get_conditional_logic($form, $field_values = array()){ - $logics = ""; - $dependents = ""; - $fields_with_logic = array(); - $default_values = array(); + public static function get_field( $field, $value = '', $force_frontend_label = false, $form = null, $field_values = null ) { + $is_form_editor = GFCommon::is_form_editor(); + $is_entry_detail = GFCommon::is_entry_detail(); + $is_admin = $is_form_editor || $is_entry_detail; + + $custom_class = $is_admin ? '' : $field->cssClass; + + if ( $field->type == 'page' ) { + if ( $is_entry_detail ) { + return; //ignore page breaks in the entry detail page + } else if ( ! $is_form_editor ) { + $save_button = rgars( $form, 'save/enabled' ) ? self::get_form_button( $form['id'], "gform_save_{$form['id']}", $form['save']['button'], rgars( $form, 'save/button/text' ), 'gform_save_link', rgars( $form, 'save/button/text' ), 0, "jQuery(\"#gform_save_{$form['id']}\").val(1);" ) : ''; + + $next_button = self::get_form_button( $form['id'], "gform_next_button_{$form['id']}_{$field->id}", $field->nextButton, __( 'Next', 'gravityforms' ), 'gform_next_button', __( 'Next Page', 'gravityforms' ), $field->pageNumber ); + $next_button = apply_filters( 'gform_next_button', $next_button, $form ); + $next_button = apply_filters( "gform_next_button_{$form['id']}", $next_button, $form ); + $previous_button = $field->pageNumber == 2 ? '' : self::get_form_button( $form['id'], "gform_previous_button_{$form['id']}_{$field->id}", $field->previousButton, __( 'Previous', 'gravityforms' ), 'gform_previous_button', __( 'Previous Page', 'gravityforms' ), $field->pageNumber - 2 ); + if ( ! empty( $previous_button ) ) { + $previous_button = apply_filters( 'gform_previous_button', $previous_button, $form ); + $previous_button = apply_filters( "gform_previous_button_{$form['id']}", $previous_button, $form ); + } + $style = self::is_page_active( $form['id'], $field->pageNumber ) ? '' : "style='display:none;'"; + $custom_class = ! empty( $custom_class ) ? " {$custom_class}" : ''; + $html = " +
    + +
    +
    pageNumber}' class='gform_page{$custom_class}' {$style}> +
    +
      "; - foreach($form["fields"] as $field){ - - //use section's logic if one exists - $section = RGFormsModel::get_section($form, $field["id"]); - $section_logic = !empty($section) ? rgar($section,"conditionalLogic") : null; - - $field_logic = $field["type"] != "page" ? RGForms::get("conditionalLogic", $field) : null; //page break conditional logic will be handled during the next button click + return $html; + } + } - $next_button_logic = isset($field["nextButton"]) && isset($field["nextButton"]["conditionalLogic"]) ? $field["nextButton"]["conditionalLogic"] : null; - - if(!empty($field_logic) || !empty($next_button_logic)){ + if ( ! $is_admin && $field->adminOnly ) { + if ( $field->allowsPrepopulate ) { + $field->inputType = 'adminonly_hidden'; + } else { + return; + } + } - $field_section_logic = array("field" => $field_logic, "nextButton" => $next_button_logic, "section" => $section_logic); + $id = $field->id; - $logics .= $field["id"] . ": " . GFCommon::json_encode($field_section_logic) . ","; + $input_type = GFFormsModel::get_input_type( $field ); - $fields_with_logic[] = $field["id"]; - - $peers = $field["type"] == "section" ? GFCommon::get_section_fields($form, $field["id"]) : array($field); - $peer_ids = array(); - - foreach ($peers as $peer) - $peer_ids[] = $peer["id"]; - - $dependents .= $field["id"] . ": " . GFCommon::json_encode($peer_ids) . ","; - } + $error_class = $field->failed_validation ? 'gfield_error' : ''; + $admin_only_class = $field->adminOnly ? 'field_admin_only' : ''; + $selectable_class = $is_admin ? 'selectable' : ''; + $hidden_class = in_array( $input_type, array( 'hidden', 'hiddenproduct' ) ) ? 'gform_hidden' : ''; - //-- Saving default values so that they can be restored when toggling conditional logic --- - $field_val = ""; - $input_type = RGFormsModel::get_input_type($field); + $section_class = $field->type == 'section' ? 'gsection' : ''; + $page_class = $field->type == 'page' ? 'gpage' : ''; + $html_block_class = $field->type == 'html' ? 'gfield_html' : ''; + $html_formatted_class = $field->type == 'html' && ! $is_admin && ! $field->disableMargins ? 'gfield_html_formatted' : ''; + $html_no_follows_desc_class = $field->type == 'html' && ! $is_admin && ! self::prev_field_has_description( $form, $field->id ) ? 'gfield_no_follows_desc' : ''; - //get parameter value if pre-populate is enabled - if(rgar($field, "allowsPrepopulate")){ - if(is_array(rgar($field, "inputs"))){ - $field_val = array(); - foreach($field["inputs"] as $input){ - $field_val["input_{$input["id"]}"] = RGFormsModel::get_parameter_value(rgar($input, "name"), $field_values, $field); - } - } - else if($input_type == "time"){ - $parameter_val = RGFormsModel::get_parameter_value(rgar($field, "inputName"), $field_values, $field); - if(!empty($parameter_val) && preg_match('/^(\d*):(\d*) ?(.*)$/', $parameter_val, $matches)){ - $field_val = array(); - $field_val[] = esc_attr($matches[1]); //hour - $field_val[] = esc_attr($matches[2]); //minute - $field_val[] = rgar($matches,3); //am or pm - } - } - else if($input_type == "list"){ - $parameter_val = RGFormsModel::get_parameter_value(rgar($field, "inputName"), $field_values, $field); - $field_val = is_array($parameter_val) ? $parameter_val : explode(",", str_replace("|", ",", $parameter_val)); - } - else { - $field_val = RGFormsModel::get_parameter_value(rgar($field, "inputName"), $field_values, $field); - } - } + $calculation_class = $input_type == 'calculation' || ( $input_type == 'number' && $field->has_calculation() ) ? 'gfield_calculation' : ''; - //use default value if pre-populated value is empty - $field_val = self::default_if_empty($field, $field_val); + $product_suffix = "_{$form['id']}_" . $field->productField; + $option_class = $field->type == 'option' ? "gfield_price gfield_price{$product_suffix} gfield_option{$product_suffix}" : ''; + $quantity_class = $field->type == 'quantity' ? "gfield_price gfield_price{$product_suffix} gfield_quantity{$product_suffix}" : ''; + $shipping_class = $field->type == 'shipping' ? "gfield_price gfield_shipping gfield_shipping_{$form['id']}" : ''; + $product_class = $field->type == 'product' ? "gfield_price gfield_price_{$form['id']}_{$field->id} gfield_product_{$form['id']}_{$field->id}" : ''; + $hidden_product_class = $input_type == 'hiddenproduct' ? 'gfield_hidden_product' : ''; + $donation_class = $field->type == 'donation' ? "gfield_price gfield_price_{$form['id']}_{$field->id} gfield_donation_{$form['id']}_{$field->id}" : ''; + $required_class = $field->isRequired ? 'gfield_contains_required' : ''; + $creditcard_warning_class = $input_type == 'creditcard' && ! GFCommon::is_ssl() ? 'gfield_creditcard_warning' : ''; - if(is_array(rgar($field, "choices")) && $input_type != "list"){ - - //radio buttons start at 0 and checkboxes start at 1 - $choice_index = $input_type == "radio" ? 0 : 1; - $is_pricing_field = GFCommon::is_pricing_field( $field['type'] ); - - foreach($field["choices"] as $choice){ - - if( $input_type == "checkbox" && ($choice_index % 10) == 0){ - $choice_index++; - } + $form_sublabel_setting = rgempty( 'subLabelPlacement', $form ) ? 'below' : $form['subLabelPlacement']; + $sublabel_setting = ! isset( $field->subLabelPlacement ) || empty( $field->subLabelPlacement ) ? $form_sublabel_setting : $field->subLabelPlacement; + $sublabel_class = "field_sublabel_{$sublabel_setting}"; - if(rgar($choice,"isSelected") && $input_type == "select"){ - $val = $is_pricing_field && $field['type'] != 'quantity' ? $choice["value"] . "|" . GFCommon::to_number($choice["price"]) : $choice["value"]; - $default_values[$field["id"]] = $val; - } - else if(rgar($choice,"isSelected")){ - if(!isset($default_values[$field["id"]])) - $default_values[$field["id"]] = array(); - - $default_values[$field["id"]][] = "choice_{$field["id"]}_{$choice_index}"; - } - $choice_index++; - } - } - else if(!empty($field_val)){ - - if(GFFormsModel::get_input_type($field) == "date"){ - //format date - $format = empty($field["dateFormat"]) ? "mdy" : esc_attr($field["dateFormat"]); - $date_info = GFcommon::parse_date($field_val, $format); - switch($format){ - case "mdy": - $field_val = rgar($date_info, "month") . "/" . rgar($date_info, "day") . "/" . rgar($date_info, "year"); - break; - case "dmy": - $field_val = rgar($date_info, "day" ) . "/" . rgar($date_info, "month" ) . "/" . rgar($date_info, "year" ); - break; - case "ymd": - $field_val = rgar($date_info, "year") . "/" . rgar($date_info, "month" ) . "/" . rgar($date_info, "day" ); - break; - } - } - - - - $default_values[$field["id"]] = $field_val; - } - } - - $button_conditional_script = ""; - - //adding form button conditional logic if enabled - if(isset($form["button"]["conditionalLogic"])){ - $logics .= "0: " . GFCommon::json_encode(array("field"=>$form["button"]["conditionalLogic"], "section" => null)) . ","; - $dependents .= "0: " . GFCommon::json_encode(array(0)) . ","; - $fields_with_logic[] = 0; - - $button_conditional_script = "jQuery('#gform_{$form['id']}').submit(" . - "function(event, isButtonPress){" . - " var visibleButton = jQuery('.gform_next_button:visible, .gform_button:visible, .gform_image_button:visible');" . - " return visibleButton.length > 0 || isButtonPress == true;" . - "}" . - ");"; - } - - if(!empty($logics)) - $logics = substr($logics, 0, strlen($logics) - 1); //removing last comma; - - if(!empty($dependents)) - $dependents = substr($dependents, 0, strlen($dependents) - 1); //removing last comma; - - $animation = rgar($form,"enableAnimation") ? "1" : "0"; - global $wp_locale; - $number_format = $wp_locale->number_format['decimal_point'] == "," ? "decimal_comma" : "decimal_dot"; - - $str = "if(window['jQuery']){" . - - "if(!window['gf_form_conditional_logic'])" . - "window['gf_form_conditional_logic'] = new Array();" . - "window['gf_form_conditional_logic'][{$form['id']}] = {'logic' : {" . $logics . " }, 'dependents' : {" . $dependents . " }, 'animation' : " . $animation . " , 'defaults' : " . json_encode($default_values) . " }; ". - "if(!window['gf_number_format'])" . - "window['gf_number_format'] = '" . $number_format . "';" . - - "jQuery(document).ready(function(){" . - "gf_apply_rules({$form['id']}, " . json_encode($fields_with_logic) . ", true);" . - "jQuery('#gform_wrapper_{$form['id']}').show();" . - "jQuery(document).trigger('gform_post_conditional_logic', [{$form['id']}, null, true]);" . - $button_conditional_script . - - "} );" . - - "} "; - - return $str; - } - - - /** - * Enqueue and retrieve all inline scripts that should be executed when the form is rendered. - * Use add_init_script() function to enqueue scripts. - * - * @param mixed $form - */ - private static function register_form_init_scripts( $form, $field_values = array(), $is_ajax = false ) { - - // adding conditional logic script if conditional logic is configured for this form. - // get_conditional_logic also adds the chosen script for the enhanced dropdown option. - // if this form does not have conditional logic, add chosen script separately - if(self::has_conditional_logic($form)){ - self::add_init_script($form["id"], "conditional_logic", self::ON_PAGE_RENDER, self::get_conditional_logic($form, $field_values)); - } - - //adding currency config if there are any product fields in the form - if(self::has_price_field($form)){ - self::add_init_script($form["id"], "pricing", self::ON_PAGE_RENDER, self::get_pricing_init_script($form)); - } - - if(self::has_password_strength($form)){ - $password_script = self::get_password_strength_init_script($form); - self::add_init_script($form["id"], "password", self::ON_PAGE_RENDER, $password_script); - } - - if(self::has_enhanced_dropdown($form) ){ - $chosen_script = self::get_chosen_init_script($form); - self::add_init_script($form["id"], "chosen", self::ON_PAGE_RENDER, $chosen_script); - self::add_init_script($form["id"], "chosen", self::ON_CONDITIONAL_LOGIC, $chosen_script); - } - - if(GFCommon::has_credit_card_field($form)) { - self::add_init_script($form["id"], "credit_card", self::ON_PAGE_RENDER, self::get_credit_card_init_script($form)); - } - - if(self::has_character_counter($form)){ - self::add_init_script($form['id'], 'character_counter', self::ON_PAGE_RENDER, self::get_counter_init_script($form)); - } - - if(self::has_input_mask($form)) { - self::add_init_script($form['id'], 'input_mask', self::ON_PAGE_RENDER, self::get_input_mask_init_script($form)); - } - - if(self::has_calculation_field($form)) { - self::add_init_script($form['id'], 'calculation', self::ON_PAGE_RENDER, self::get_calculations_init_script($form)); - } - - if(self::has_currency_format_number_field($form)) { - self::add_init_script($form['id'], 'currency_format', self::ON_PAGE_RENDER, self::get_currency_format_init_script($form)); - } - - do_action( 'gform_register_init_scripts', $form, $field_values, $is_ajax ); - do_action( 'gform_register_init_scripts_' . $form['id'], $form, $field_values, $is_ajax ); - - - } - - public static function get_form_init_scripts($form) { - - $script_string = ''; - - // temporary solution for output gf_global obj until wp min version raised to 3.3 - if(wp_script_is("gform_gravityforms")) { - $gf_global_script = "if(typeof gf_global == 'undefined') " . GFCommon::gf_global(false); - } + $form_description_setting = rgempty( 'descriptionPlacement', $form ) ? 'below' : $form['descriptionPlacement']; + $description_setting = ! isset( $field->descriptionPlacement ) || empty( $field->descriptionPlacement ) ? $form_description_setting : $field->descriptionPlacement; + $description_class = "field_description_{$description_setting}"; - /* rendering initialization scripts */ - $init_scripts = rgar(self::$init_scripts, $form["id"]); + $field_setting_label_placement = $field->labelPlacement; + $label_placement = empty( $field_setting_label_placement ) ? '' : $field_setting_label_placement; - if(!empty($init_scripts)){ - $script_string = - ""; - } + return $field_markup; + } - return $script_string; - } + private static function prev_field_has_description( $form, $field_id ) { + if ( ! is_array( $form['fields'] ) ) { + return false; + } - public static function get_chosen_init_script($form){ - $chosen_fields = array(); - foreach($form["fields"] as $field){ - $input_type = GFFormsModel::get_input_type($field); - if(rgar($field, "enableEnhancedUI") && in_array($input_type, array("select", "multiselect"))) - $chosen_fields[] = "#input_{$form["id"]}_{$field["id"]}"; - } - return "gformInitChosenFields('" . implode(",", $chosen_fields) . "','" . esc_attr(apply_filters("gform_dropdown_no_results_text_{$form["id"]}", apply_filters("gform_dropdown_no_results_text", __("No results matched", "gravityforms"), $form["id"]), $form["id"])) . "');"; - } + $prev = null; + foreach ( $form['fields'] as $field ) { + if ( $field->id == $field_id ) { + return $prev != null && ! empty( $prev['description'] ); + } + $prev = $field; + } - public static function get_currency_format_init_script($form){ - $currency_fields = array(); - foreach($form["fields"] as $field){ - if(rgar($field, "numberFormat") == "currency") - $currency_fields[] = "#input_{$form["id"]}_{$field["id"]}"; - } + return false; + } - return "gformInitCurrencyFormatFields('" . implode(",", $currency_fields) . "');"; - } + /** + * @param GF_Field $field + * @param string $value + * @param bool $force_frontend_label + * @param int $form_id + * @param null|array $form + * + * @return string + */ + public static function get_field_content( $field, $value = '', $force_frontend_label = false, $form_id = 0, $form = null ) { + + $field_label = $field->get_field_label( $form, $value ); + $admin_buttons = $field->get_admin_buttons(); + + $input_type = GFFormsModel::get_input_type( $field ); + + $is_form_editor = GFCommon::is_form_editor(); + $is_entry_detail = GFCommon::is_entry_detail(); + $is_admin = $is_form_editor || $is_entry_detail; + + if ( $input_type == 'adminonly_hidden' ) { + $field_content = ! $is_admin ? '{FIELD}' : sprintf( "%s{FIELD}", $admin_buttons, esc_html( $field_label ) ); + } else { + $field_content = $field->get_field_content( $value, $force_frontend_label, $form ); + } - public static function get_counter_init_script($form){ + if ( $input_type == 'creditcard' && ! GFCommon::is_ssl() && ! $is_admin ) { + $field_content = "
      " . __( 'This page is unsecured. Do not enter a real credit card number. Use this field only for testing purposes. ', 'gravityforms' ) . '
      ' . $field_content; + } - $script = ""; - foreach($form["fields"] as $field){ - $max_length = rgar($field,"maxLength"); - $field_id = "input_{$form["id"]}_{$field["id"]}"; - if(!empty($max_length) && !rgar($field,"adminOnly")) - { - $field_script = - "jQuery('#{$field_id}').textareaCount(" . - " {" . - " 'maxCharacterSize': {$max_length}," . - " 'originalStyle': 'ginput_counter'," . - " 'displayFormat' : '#input " . __("of", "gravityforms") . " #max " . __("max characters", "gravityforms") . "'" . - " } );"; + $value = $field->get_value_default_if_empty( $value ); - $script .= apply_filters("gform_counter_script_{$form["id"]}", apply_filters("gform_counter_script", $field_script, $form["id"], $field_id, $max_length), $form["id"], $field_id, $max_length); - } - } - return $script; - } + $field_content = str_replace( '{FIELD}', GFCommon::get_field_input( $field, $value, 0, $form_id, $form ), $field_content ); - public static function get_credit_card_init_script($form) { + $field_content = apply_filters( 'gform_field_content', $field_content, $field, $value, 0, $form_id ); - $script = ""; + return $field_content; + } - foreach($form["fields"] as $field){ - if($field['type'] != 'creditcard') - continue; - $field_id = "input_{$form["id"]}_{$field["id"]}"; - $field_script = "jQuery(document).ready(function(){ { gformMatchCard(\"{$field_id}_1\"); } } );"; - if(rgar($field, "forceSSL") && !GFCommon::is_ssl() && !GFCommon::is_preview()) - $field_script = "document.location.href='" . esc_js( RGFormsModel::get_current_page_url(true) ) . "';"; + private static function get_progress_bar( $form, $form_id, $confirmation_message ) { - $script .= $field_script; - } + $progress_complete = false; + $progress_bar = ''; + $page_count = self::get_max_page_number( $form ); + $current_page = self::get_current_page( $form_id ); + $page_name = rgar( rgar( $form['pagination'], 'pages' ), $current_page - 1 ); + $page_name = ! empty( $page_name ) ? ' - ' . $page_name : ''; + $style = $form['pagination']['style']; + $color = $style == 'custom' ? " color:{$form['pagination']['color']};" : ''; + $bgcolor = $style == 'custom' ? " background-color:{$form['pagination']['backgroundColor']};" : ''; - $card_rules = self::get_credit_card_rules(); - $script = "if(!window['gf_cc_rules']){window['gf_cc_rules'] = new Array(); } window['gf_cc_rules'] = " . GFCommon::json_encode($card_rules) . "; $script"; + if ( ! empty( $confirmation_message ) ) { + $progress_complete = true; + } + //check admin setting for whether the progress bar should start at zero + $start_at_zero = rgars( $form, 'pagination/display_progressbar_on_confirmation' ); + //check for filter + $start_at_zero = apply_filters( 'gform_progressbar_start_at_zero', $start_at_zero, $form ); + $progressbar_page_count = $start_at_zero ? $current_page - 1 : $current_page; + $percent = ! $progress_complete ? floor( ( ( $progressbar_page_count ) / $page_count ) * 100 ) . '%' : '100%'; + $percent_number = ! $progress_complete ? floor( ( ( $progressbar_page_count ) / $page_count ) * 100 ) . '' : '100'; - return $script; - } + if ( $progress_complete ) { + $wrapper_css_class = GFCommon::get_browser_class() . ' gform_wrapper'; - public static function get_pricing_init_script($form) { + //add on surrounding wrapper class when confirmation page + $progress_bar = "
      "; + $page_name = ! empty( $form['pagination']['progressbar_completion_text'] ) ? $form['pagination']['progressbar_completion_text'] : ''; + } - if(!class_exists("RGCurrency")) - require_once("currency.php"); - return "if(window[\"gformInitPriceFields\"]) jQuery(document).ready(function(){gformInitPriceFields();} );"; - } + $progress_bar .= " +
      +

      "; + $progress_bar .= ! $progress_complete ? __( 'Step', 'gravityforms' ) . " {$current_page} " . __( 'of', 'gravityforms' ) . " {$page_count}{$page_name}" : "{$page_name}"; + $progress_bar .= " +

      +
      +
      {$percent}
      +
      "; + //close div for surrounding wrapper class when confirmation page + $progress_bar .= $progress_complete ? $confirmation_message . '
      ' : ''; - public static function get_password_strength_init_script($form) { + return $progress_bar; + } - $field_script = "if(!window['gf_text']){window['gf_text'] = new Array();} window['gf_text']['password_blank'] = '" . __("Strength indicator", "gravityforms") . "'; window['gf_text']['password_mismatch'] = '" . __("Mismatch", "gravityforms") . "';window['gf_text']['password_bad'] = '" . __("Bad", "gravityforms") . "'; window['gf_text']['password_short'] = '" . __("Short", "gravityforms") . "'; window['gf_text']['password_good'] = '" . __("Good", "gravityforms") . "'; window['gf_text']['password_strong'] = '" . __("Strong", "gravityforms") . "';"; + /** + * Validates the form's entry limit settings. Returns the entry limit message if entry limit exceeded. + * + * @param array $form current GF form object + * + * @return string If entry limit exceeded returns entry limit setting. + */ + public static function validate_entry_limit( $form ) { + + //If form has a limit of entries, check current entry count + if ( rgar( $form, 'limitEntries' ) ) { + $period = rgar( $form, 'limitEntriesPeriod' ); + $range = self::get_limit_period_dates( $period ); + $entry_count = RGFormsModel::get_lead_count( $form['id'], '', null, null, $range['start_date'], $range['end_date'] ); + + if ( $entry_count >= $form['limitEntriesCount'] ) { + return empty( $form['limitEntriesMessage'] ) ? "

      " . __( 'Sorry. This form is no longer accepting new submissions.', 'gravityforms' ) . '

      ' : '

      ' . GFCommon::gform_do_shortcode( $form['limitEntriesMessage'] ) . '

      '; + } + } - foreach($form['fields'] as $field) { - if($field['type'] == 'password' && rgar($field, 'passwordStrengthEnabled')) { - $field_id = "input_{$form["id"]}_{$field["id"]}"; - $field_script .= "gformShowPasswordStrength(\"$field_id\");"; - } - } + } - return $field_script; - } + public static function validate_form_schedule( $form ) { - public static function get_input_mask_init_script($form) { + //If form has a schedule, make sure it is within the configured start and end dates + if ( rgar( $form, 'scheduleForm' ) ) { + $local_time_start = sprintf( '%s %02d:%02d %s', $form['scheduleStart'], $form['scheduleStartHour'], $form['scheduleStartMinute'], $form['scheduleStartAmpm'] ); + $local_time_end = sprintf( '%s %02d:%02d %s', $form['scheduleEnd'], $form['scheduleEndHour'], $form['scheduleEndMinute'], $form['scheduleEndAmpm'] ); + $timestamp_start = strtotime( $local_time_start . ' +0000' ); + $timestamp_end = strtotime( $local_time_end . ' +0000' ); + $now = current_time( 'timestamp' ); - $script_str = ''; + if ( ! empty( $form['scheduleStart'] ) && $now < $timestamp_start ) { + return empty( $form['schedulePendingMessage'] ) ? '

      ' . __( 'This form is not yet available.', 'gravityforms' ) . '

      ' : '

      ' . GFCommon::gform_do_shortcode( $form['schedulePendingMessage'] ) . '

      '; + } elseif ( ! empty( $form['scheduleEnd'] ) && $now > $timestamp_end ) { + return empty( $form['scheduleMessage'] ) ? '

      ' . __( 'Sorry. This form is no longer available.', 'gravityforms' ) . '

      ' : '

      ' . GFCommon::gform_do_shortcode( $form['scheduleMessage'] ) . '

      '; + } + } - foreach($form['fields'] as $field) { + } - if(!rgar($field, 'inputMask') || !rgar($field, 'inputMaskValue')) - continue; + public static function update_confirmation( $form, $lead = null, $event = '' ) { + if ( ! is_array( rgar( $form, 'confirmations' ) ) ) { + return $form; + } - $mask = rgar($field, 'inputMaskValue'); - $script = "jQuery('#input_{$form['id']}_{$field['id']}').mask('" . esc_js($mask). "').bind('keypress', function(e){if(e.which == 13){jQuery(this).blur();} } );"; + if ( ! empty( $event ) ) { + $confirmations = wp_filter_object_list( $form['confirmations'], array( 'event' => $event ) ); + } else { + $confirmations = $form['confirmations']; + } - $script_str .= apply_filters("gform_input_mask_script_{$form['id']}", apply_filters("gform_input_mask_script", $script, $form['id'], $field['id'], $mask), $form['id'], $field['id'], $mask); - } + // if there is only one confirmation, don't bother with the conditional logic, just return it + // this is here mostly to avoid the semi-costly GFFormsModel::create_lead() function unless we really need it + if ( is_array( $form['confirmations'] ) && count( $confirmations ) <= 1 ) { + $form['confirmation'] = reset( $confirmations ); - return $script_str; - } + return $form; + } - public static function get_calculations_init_script($form) { - require_once(GFCommon::get_base_path() . '/currency.php'); + if ( empty( $lead ) ) { + $lead = GFFormsModel::create_lead( $form ); + } - $formula_fields = array(); + foreach ( $confirmations as $confirmation ) { - foreach($form['fields'] as $field) { + if ( rgar( $confirmation, 'event' ) != $event ) { + continue; + } - if(!rgar($field, 'enableCalculation') || !rgar($field, 'calculationFormula')) - continue; + if ( rgar( $confirmation, 'isDefault' ) ) { + continue; + } - $formula_fields[] = array('field_id' => $field['id'], 'formula' => rgar($field, 'calculationFormula'), 'rounding' => rgar($field, 'calculationRounding') ); + if ( isset( $confirmation['isActive'] ) && ! $confirmation['isActive'] ) { + continue; + } - } + $logic = rgar( $confirmation, 'conditionalLogic' ); + if ( GFCommon::evaluate_conditional_logic( $logic, $form, $lead ) ) { + $form['confirmation'] = $confirmation; - if( empty( $formula_fields ) ) - return ''; - - $script = self::get_number_formats_script( $form ); - $script .= 'new GFCalc(' . $form['id'] . ', ' . GFCommon::json_encode( $formula_fields ) . ');'; - - return $script; - } + return $form; + } + } - /** - * Generates a map of fields IDs and their corresponding number formats used by the GFCalc JS object for correctly - * converting field values to clean numbers. - * - * - Number fields have a 'numberFormat' setting (w/ UI). - * - Single-input product fields (i.e. 'singleproduct', 'calculation', 'price' and 'hiddenproduct') should default to - * the number format of the configured currency. - * - All other product fields will default to 'decimal_dot' for the number format. - * - All other fields will have no format (false) and inherit the format of the formula field when the formula is - * calculated. - * - * @param mixed $form - */ - public static function get_number_formats_script( $form ) { + $filtered_list = wp_filter_object_list( $form['confirmations'], array( 'isDefault' => true ) ); - $number_formats = array(); - $currency = RGCurrency::get_currency( GFCommon::get_currency() ); + $form['confirmation'] = reset( $filtered_list ); - foreach( $form['fields'] as $field ) { + return $form; + } - // default format is false, fields with no format will inherit the format of the formula field when calculated - $format = false; + public static function process_send_resume_link() { - switch( GFFormsModel::get_input_type( $field ) ) { - case 'number': - $format = rgar( $field, 'numberFormat' ) ? rgar( $field, 'numberFormat' ) : 'decimal_dot'; - break; - case 'singleproduct': - case 'singleproduct': - case 'calculation': - case 'price': - case 'hiddenproduct': - case 'singleshipping': - $format = $currency['decimal_separator'] == ',' ? 'decimal_comma' : 'decimal_dot'; - break; - default: + $form_id = rgpost( 'gform_send_resume_link' ); + $email = rgpost( 'gform_resume_email' ); + $resume_token = rgpost( 'gform_resume_token' ); - // we check above for all single-input product types, for all other products, assume decimal format - if( in_array( $field['type'], array( 'product', 'option', 'shipping' ) ) ) - $format = 'decimal_dot'; + if ( empty( $form_id ) || empty( $email ) || empty( $resume_token ) || ! GFCommon::is_valid_email( $email ) ) { + return; + } - } - - $number_formats[$field['id']] = $format; - - } - - return 'gf_global["number_formats"][' . $form['id'] . '] = ' . json_encode( $number_formats ) . ';'; - } - - private static function has_datepicker_field($form){ - if(is_array($form["fields"])){ - foreach($form["fields"] as $field){ - - if(RGFormsModel::get_input_type($field) == "date" && rgar($field, "dateType") == "datepicker") - return true; - } - } - return false; - } - - private static function has_price_field($form){ - $price_fields = GFCommon::get_fields_by_type($form, array("product", "donation")); - return !empty($price_fields); - } - - private static function has_fileupload_field($form){ - if(is_array($form["fields"])){ - foreach($form["fields"] as $field){ - $input_type = RGFormsModel::get_input_type($field); - if(in_array($input_type, array("fileupload", "post_image"))) - return true; - } - } - return false; - } - - private static function has_currency_format_number_field($form){ - if(is_array($form["fields"])){ - foreach($form["fields"] as $field){ - $input_type = RGFormsModel::get_input_type($field); - if($input_type == "number" && rgar($field, "numberFormat") == "currency") - return true; - } - } - return false; - } - - private static function has_recaptcha_field($form){ - if(is_array($form["fields"])){ - foreach($form["fields"] as $field){ - if(($field["type"] == "captcha" || $field["inputType"] == "captcha") && !in_array($field["captchaType"], array("simple_captcha", "math"))) - return true; - } - } - return false; - } - - public static function has_input_mask($form, $field = false){ - - if($field) { - if(self::has_field_input_mask($field)) - return true; - } else { - - if(!is_array($form["fields"])) - return false; - - foreach($form["fields"] as $field){ - if(rgar($field, "inputMask") && rgar($field, "inputMaskValue") && !rgar($field, "enablePasswordInput")) - return true; - } - - } - - return false; - } - - public static function has_field_input_mask($field){ - if(rgar($field, "inputMask") && rgar($field, "inputMaskValue") && !rgar($field, "enablePasswordInput")) - return true; - - return false; - } - - public static function has_calculation_field($form) { - - if(!is_array($form["fields"])) - return false; - - foreach($form['fields'] as $field) { - if(GFCommon::has_field_calculation($field)) - return true; - } - return false; - } - - //Getting all fields that have a rule based on the specified field id - public static function get_conditional_logic_fields($form, $fieldId){ - $fields = array(); - - //adding submit button field if enabled - if(isset($form["button"]["conditionalLogic"])){ - $fields[] = 0; - } - - foreach($form["fields"] as $field){ - - if($field["type"] != "page" && !empty($field["conditionalLogic"])){ - foreach($field["conditionalLogic"]["rules"] as $rule){ - if($rule["fieldId"] == $fieldId){ - $fields[] = floatval($field["id"]); - - //if field is a section, add all fields in the section that have conditional logic (to support nesting) - if($field["type"] == "section"){ - $section_fields = GFCommon::get_section_fields($form, $field["id"]); - foreach($section_fields as $section_field) - if(!empty($section_field["conditionalLogic"])) - $fields[] = floatval($section_field["id"]); - } - break; - } - } - } - //adding fields with next button logic - if(!empty($field["nextButton"]["conditionalLogic"])){ - foreach($field["nextButton"]["conditionalLogic"]["rules"] as $rule){ - if($rule["fieldId"] == $fieldId && !in_array($fieldId, $fields)){ - $fields[] = floatval($field["id"]); - break; - } - } - } - } - return $fields; - } - - public static function get_field($field, $value="", $force_frontend_label = false, $form=null, $field_values=null){ - $custom_class = IS_ADMIN ? "" : rgget("cssClass", $field); - - if($field["type"] == "page"){ - if(IS_ADMIN && RG_CURRENT_VIEW == "entry"){ - return; //ignore page breaks in the entry detail page - } - else if(!IS_ADMIN){ - $next_button = self::get_form_button($form["id"], "gform_next_button_{$form["id"]}_{$field["id"]}", $field["nextButton"], __("Next", "gravityforms"), "gform_next_button", __("Next Page", "gravityforms"), $field["pageNumber"]); - $next_button = apply_filters("gform_next_button", $next_button, $form); - $next_button = apply_filters("gform_next_button_{$form["id"]}", $next_button, $form); - $previous_button = $field["pageNumber"] == 2 ? "" : self::get_form_button($form["id"], "gform_previous_button_{$form["id"]}_{$field["id"]}", $field["previousButton"], __("Previous", "gravityforms"), "gform_previous_button", __("Previous Page", "gravityforms"), $field["pageNumber"]-2); - if(!empty($previous_button)){ - $previous_button = apply_filters("gform_previous_button", $previous_button, $form); - $previous_button = apply_filters("gform_previous_button_{$form["id"]}", $previous_button, $form); - } - $style = self::is_page_active($form["id"], $field["pageNumber"]) ? "" : "style='display:none;'"; - $custom_class = !empty($custom_class) ? " {$custom_class}" : ""; - $html = "
    -
    - -
    -
    -
    -
      "; + $form = GFFormsModel::get_form_meta( $form_id ); - return $html; - } - } + if ( empty( $form ) ) { + return; + } - if($field["type"] == "post_category") { + $incomplete_submission = GFFormsModel::get_incomplete_submission_values( $resume_token ); + $submission = json_decode( $incomplete_submission['submission'], true ); + $partial_entry = $submission['partial_entry']; - } + $notifications_to_send = GFCommon::get_notifications_to_send( 'form_save_email_requested', $form, $partial_entry ); - if(!IS_ADMIN && rgar($field,"adminOnly")) - { - if($field["allowsPrepopulate"]) - $field["inputType"] = "adminonly_hidden"; - else - return; - } + $log_notification_event = empty( $notifications_to_send ) ? 'No notifications to process' : 'Processing notifications'; + GFCommon::log_debug( "GFFormDisplay::process_send_resume_link(): {$log_notification_event} for form_save_email_requested event." ); - $id = $field["id"]; - $type = $field["type"]; - $input_type = RGFormsModel::get_input_type($field); + foreach ( $notifications_to_send as $notification ) { + if ( isset( $notification['isActive'] ) && ! $notification['isActive'] ) { + GFCommon::log_debug( "GFFormDisplay::process_send_resume_link(): Notification is inactive, not processing notification (#{$notification['id']} - {$notification['name']})." ); + continue; + } + if ( $notification['toType'] == 'hidden' ) { + $notification['to'] = $email; + } + $notification['message'] = self::replace_save_variables( $notification['message'], $form, $resume_token, $email ); + GFCommon::send_notification( $notification, $form, $partial_entry ); + } - $error_class = rgget("failed_validation", $field) ? "gfield_error" : ""; - $admin_only_class = rgget("adminOnly", $field) ? "field_admin_only" : ""; - $selectable_class = IS_ADMIN ? "selectable" : ""; - $hidden_class = in_array($input_type, array("hidden", "hiddenproduct")) ? "gform_hidden" : ""; + GFFormsModel::add_email_to_incomplete_sumbmission( $resume_token, $email ); + } - $section_class = $field["type"] == "section" ? "gsection" : ""; - $page_class = $field["type"] == "page" ? "gpage" : ""; - $html_block_class = $field["type"] == "html" ? "gfield_html" : ""; - $html_formatted_class = $field["type"] == "html" && !IS_ADMIN && !rgget("disableMargins", $field) ? "gfield_html_formatted" : ""; - $html_no_follows_desc_class = $field["type"] == "html" && !IS_ADMIN && !self::prev_field_has_description($form, $field["id"]) ? "gfield_no_follows_desc" : ""; + public static function replace_save_variables( $text, $form, $resume_token, $email = null ) { - $calculation_class = RGFormsModel::get_input_type($field) == 'number' && GFCommon::has_field_calculation($field) ? 'gfield_calculation' : ''; - $calculation_class = RGFormsModel::get_input_type($field) == 'calculation' ? 'gfield_calculation' : ''; + $form_id = intval( $form['id'] ); - $product_suffix = "_{$form["id"]}_" . rgget("productField", $field); - $option_class = $field["type"] == "option" ? "gfield_price gfield_price{$product_suffix} gfield_option{$product_suffix}" : ""; - $quantity_class = $field["type"] == "quantity" ? "gfield_price gfield_price{$product_suffix} gfield_quantity{$product_suffix}" : ""; - $shipping_class = $field["type"] == "shipping" ? "gfield_price gfield_shipping gfield_shipping_{$form["id"]}" : ""; - $product_class = $field["type"] == "product" ? "gfield_price gfield_price_{$form["id"]}_{$field["id"]} gfield_product_{$form["id"]}_{$field["id"]}" : ""; - $hidden_product_class = $input_type == "hiddenproduct" ? "gfield_hidden_product" : ""; - $donation_class = $field["type"] == "donation" ? "gfield_price gfield_price_{$form["id"]}_{$field["id"]} gfield_donation_{$form["id"]}_{$field["id"]}" : ""; - $required_class = rgar($field, "isRequired") ? "gfield_contains_required" : ""; - $creditcard_warning_class = $input_type == "creditcard" && !GFCommon::is_ssl() ? "gfield_creditcard_warning" : ""; - - $css_class = "$selectable_class gfield $error_class $section_class $admin_only_class $custom_class $hidden_class $html_block_class $html_formatted_class $html_no_follows_desc_class $option_class $quantity_class $product_class $donation_class $shipping_class $page_class $required_class $hidden_product_class $creditcard_warning_class $calculation_class"; - $css_class = apply_filters("gform_field_css_class_{$form["id"]}", apply_filters("gform_field_css_class", trim($css_class), $field, $form), $field, $form); + $resume_url = apply_filters( 'gform_save_and_continue_resume_url', add_query_arg( array( 'gf_token' => $resume_token ), GFFormsModel::get_current_page_url() ), $form, $resume_token, $email ); + $resume_url = esc_url( $resume_url ); + $resume_link = "{$resume_url}"; + $text = str_replace( '{save_link}', $resume_link, $text ); + $text = str_replace( '{save_token}', $resume_token, $text ); - $style = !empty($form) && !IS_ADMIN && RGFormsModel::is_field_hidden($form, $field, $field_values) ? "style='display:none;'" : ""; - - $field_id = IS_ADMIN || empty($form) ? "field_$id" : "field_" . $form["id"] . "_$id"; - - $field_content = self::get_field_content( $field, $value, $force_frontend_label, $form == null ? 0 : $form['id'] ); - $field_container = "
    • {FIELD_CONTENT}
    • "; - - $field_container = apply_filters( 'gform_field_container', $field_container, $field, $form, $css_class, $style, $field_content ); - $field_container = apply_filters( "gform_field_container_{$form['id']}", $field_container, $field, $form, $css_class, $style, $field_content ); - $field_container = apply_filters( "gform_field_container_{$form['id']}_{$field['id']}", $field_container, $field, $form, $css_class, $style, $field_content ); - - $field_markup = str_replace( '{FIELD_CONTENT}', $field_content, $field_container ); - - return $field_markup; - - } - - private static function prev_field_has_description($form, $field_id){ - if(!is_array($form["fields"])) - return false; - - $prev = null; - foreach($form["fields"] as $field){ - if($field["id"] == $field_id){ - return $prev != null && !empty($prev["description"]); - } - $prev = $field; - } - return false; - } - - public static function get_field_content($field, $value="", $force_frontend_label = false, $form_id=0){ - $id = $field["id"]; - $size = rgar($field,"size"); - $validation_message = (rgget("failed_validation", $field) && !empty($field["validation_message"])) ? sprintf("
      %s
      ", $field["validation_message"]) : ""; - - $duplicate_disabled = array('captcha', 'post_title', 'post_content', 'post_excerpt', 'total', 'shipping', 'creditcard'); - $duplicate_field_link = !in_array($field['type'], $duplicate_disabled) ? "" : ""; - $duplicate_field_link = apply_filters("gform_duplicate_field_link", $duplicate_field_link); - - $delete_field_link = ""; - $delete_field_link = apply_filters("gform_delete_field_link", $delete_field_link); - $field_type_title = GFCommon::get_field_type_title($field["type"]); - $admin_buttons = IS_ADMIN ? "
      {$field_type_title} : " . __("Field ID", "gravityforms") . " {$field["id"]}
      " . $delete_field_link . $duplicate_field_link . "
      " : ""; - - $field_label = $force_frontend_label ? $field["label"] : GFCommon::get_label($field); - if( (rgar($field, "inputType") == "singleproduct" || rgar($field, "inputType") == "calculation" ) && !rgempty($field["id"] . ".1", $value)){ - $field_label = rgar($value, $field["id"] . ".1"); - } - - - $field_id = IS_ADMIN || $form_id == 0 ? "input_$id" : "input_" . $form_id . "_$id"; - - $required_div = IS_ADMIN || rgar($field, "isRequired") ? sprintf("%s", rgar($field, "isRequired") ? "*" : "") : ""; - $target_input_id = ""; - $is_description_above = rgar($field, "descriptionPlacement") == "above"; - - switch(RGFormsModel::get_input_type($field)){ - case "section" : - $description = self::get_description(rgget("description", $field), "gsection_description"); - $field_content = sprintf("%s

      %s

      %s", $admin_buttons, esc_html($field_label), $description); - break; - - case "page" : - //only executed on the form editor in the admin - // removed images to make page breaks translatable - $page_label = __("Page Break", "gravityforms"); - $field_content = "{$admin_buttons}
      " . __("end of page", "gravityforms") . "
      " . __("PAGE BREAK", "gravityforms") . "
      " . __("top of new page", "gravityforms") . "
      "; - break; - - case "adminonly_hidden": - case "hidden" : - case "html" : - $field_content = !IS_ADMIN ? "{FIELD}" : $field_content = sprintf("%s{FIELD}", $admin_buttons, $field_id, esc_html($field_label)); - break; - - case "checkbox": - case "radio": - $description = self::get_description(rgget("description", $field),"gfield_description"); - if($is_description_above) - $field_content = sprintf("%s%s{FIELD}%s", $admin_buttons, esc_html($field_label), $required_div , $description, $validation_message); - else - $field_content = sprintf("%s{FIELD}%s%s", $admin_buttons, esc_html($field_label), $required_div , $description, $validation_message); - break; - - case "name" : - switch(rgar($field, "nameFormat")){ - case "simple" : - $target_input_id = $field_id; - break; - - case "extended" : - $target_input_id = $field_id . "_2"; - break; - - default : - $target_input_id = $field_id . "_3"; - } - - case "address" : - if(empty($target_input_id)){ - $target_input_id = $field_id . "_1"; - } + $text = str_replace( '{save_url}', $resume_url, $text ); - case 'list': - if(empty($target_input_id)) - $target_input_id = sprintf( 'input_%s_%s_shim', $form_id, $field['id'] ); - - default : - if(empty($target_input_id)) - $target_input_id = $field_id; - - $description = self::get_description(rgget("description", $field),"gfield_description"); - if($is_description_above) - $field_content = sprintf("%s%s{FIELD}%s", $admin_buttons, $target_input_id, esc_html($field_label), $required_div , $description, $validation_message); - else - $field_content = sprintf("%s{FIELD}%s%s", $admin_buttons, $target_input_id, esc_html($field_label), $required_div , $description, $validation_message); - break; - } - - if(RGFormsModel::get_input_type($field) == "creditcard" && !GFCommon::is_ssl() && !IS_ADMIN){ - $field_content = "
      " . __("This page is unsecured. Do not enter a real credit card number. Use this field only for testing purposes. ", "gravityforms") . "
      " . $field_content; - } - - $value = self::default_if_empty($field, $value); - - $field_content = str_replace("{FIELD}", GFCommon::get_field_input($field, $value, 0, $form_id), $field_content); - - $field_content = apply_filters("gform_field_content", $field_content, $field, $value, 0, $form_id); - - return $field_content; - } - - private static function default_if_empty($field, $value){ - - if(!GFCommon::is_empty_array($value)) - return $value; - - if(IS_ADMIN){ - $value = rgget("defaultValue", $field); - } - else{ - $value = rgar($field, "defaultValue"); - if(!is_array($value)) - $value = GFCommon::replace_variables_prepopulate(rgget("defaultValue", $field)); - } - - return $value; - } - - private static function get_description($description, $css_class){ - return IS_ADMIN || !empty($description) ? "
      " . $description . "
      " : ""; - } - - public static function get_credit_card_rules() { - - $cards = GFCommon::get_card_types(); - //$supported_cards = //TODO: Only include enabled cards - $rules = array(); - - foreach($cards as $card) { - $prefixes = explode(',', $card['prefixes']); - foreach($prefixes as $prefix) { - $rules[$card['slug']][] = $prefix; - } - } - - return $rules; - } - - private static function get_progress_bar($form, $form_id,$confirmation_message) { - - $progress_complete = false; - $progress_bar = ""; - $page_count = self::get_max_page_number($form); - $current_page = self::get_current_page($form_id); - $page_name = rgar(rgar($form["pagination"],"pages"), $current_page -1); - $page_name = !empty($page_name) ? " - " . $page_name : ""; - $style = $form["pagination"]["style"]; - $color = $style == "custom" ? " color:{$form["pagination"]["color"]};" : ""; - $bgcolor = $style == "custom" ? " background-color:{$form["pagination"]["backgroundColor"]};" : ""; - - if (!empty($confirmation_message)) - { - $progress_complete = true; - } - //check admin setting for whether the progress bar should start at zero - $start_at_zero = rgars($form, "pagination/display_progressbar_on_confirmation"); - //check for filter - $start_at_zero = apply_filters("gform_progressbar_start_at_zero", $start_at_zero, $form); - $progressbar_page_count = $start_at_zero ? $current_page - 1 : $current_page; - $percent = !$progress_complete ? floor(( ($progressbar_page_count) / $page_count ) * 100) . "%" : "100%"; - $percent_number = !$progress_complete ? floor(( ($progressbar_page_count) / $page_count ) * 100) . "" : "100"; + $email_esc = esc_attr( $email ); + $text = str_replace( '{save_email}', $email_esc, $text ); - if ($progress_complete) - { - $wrapper_css_class = GFCommon::get_browser_class() . " gform_wrapper"; + $resume_submit_button_text = __( 'Send Email', 'gravityforms' ); + $resume_email_validation_message = __( 'Please enter a valid email address.', 'gravityforms' ); - //add on surrounding wrapper class when confirmation page - $progress_bar = "
      "; - $page_name = !empty($form["pagination"]["progressbar_completion_text"]) ? $form["pagination"]["progressbar_completion_text"] : ""; - } + // The {save_email_input} accepts shortcode-style options button_text and validation_message. E.g., + // {save_email_input: button_text="Send the link to my email address" validation_message="The link couldn't be sent because the email address is not valid."} + preg_match_all( '/\{save_email_input:(.*?)\}/', $text, $matches, PREG_SET_ORDER ); + if ( is_array( $matches ) && isset( $matches[0] ) && isset( $matches[0][1] ) ) { + $options_string = isset( $matches[0][1] ) ? $matches[0][1] : ''; + $options = shortcode_parse_atts( $options_string ); + if ( isset( $options['button_text'] ) ) { + $resume_submit_button_text = $options['button_text']; + } + if ( isset( $options['validation_message'] ) ) { + $resume_email_validation_message = $options['validation_message']; + } + $full_tag = $matches[0][0]; + $text = str_replace( $full_tag, '{save_email_input}', $text ); + } - $progress_bar .=" -
      -

      "; - $progress_bar .= !$progress_complete ? __("Step", "gravityforms") . " {$current_page} " . __("of", "gravityforms") . " {$page_count}{$page_name}" : "{$page_name}"; - $progress_bar .= " -

      -
      -
      {$percent}
      -
      "; - //close div for surrounding wrapper class when confirmation page - $progress_bar .= $progress_complete ? $confirmation_message . "
      " : ""; + $action = esc_url( remove_query_arg( 'gf_token' ) ); - return $progress_bar; - } + $html_input_type = RGFormsModel::is_html5_enabled() ? 'email' : 'text'; - /** - * Validates the form's entry limit settings. Returns the entry limit message if entry limit exceeded. - * - * @param array $form current GF form object - * @return string If entry limit exceeded returns entry limit setting. - */ - public static function validate_entry_limit($form) { + $resume_token = esc_attr( $resume_token ); - //If form has a limit of entries, check current entry count - if(rgar($form,"limitEntries")) { - $period = rgar($form, "limitEntriesPeriod"); - $range = self::get_limit_period_dates($period); - $entry_count = RGFormsModel::get_lead_count($form['id'], "", null, null, $range["start_date"], $range["end_date"]); + $validation_message = ! is_null( $email ) && ! GFCommon::is_valid_email( $email ) ? sprintf( '
      %s
      ', $resume_email_validation_message ) : ''; - if($entry_count >= $form["limitEntriesCount"]) - return empty($form["limitEntriesMessage"]) ? "

      " . __("Sorry. This form is no longer accepting new submissions.", "gravityforms"). "

      " : "

      " . GFCommon::gform_do_shortcode($form["limitEntriesMessage"]) . "

      "; - } + $resume_form = "
      +
      + + + + + {$validation_message} +
      +
      "; - } + $text = str_replace( '{save_email_input}', $resume_form, $text ); - public static function validate_form_schedule($form) { - //If form has a schedule, make sure it is within the configured start and end dates - if(rgar($form, "scheduleForm")){ - $local_time_start = sprintf("%s %02d:%02d %s", $form["scheduleStart"], $form["scheduleStartHour"], $form["scheduleStartMinute"], $form["scheduleStartAmpm"]); - $local_time_end = sprintf("%s %02d:%02d %s", $form["scheduleEnd"], $form["scheduleEndHour"], $form["scheduleEndMinute"], $form["scheduleEndAmpm"]); - $timestamp_start = strtotime($local_time_start . ' +0000'); - $timestamp_end = strtotime($local_time_end . ' +0000'); - $now = current_time("timestamp"); - if (!empty($form["scheduleStart"]) && $now < $timestamp_start) - return empty($form["schedulePendingMessage"]) ? "

      " . __("This form is not yet available.", "gravityforms") . "

      " : "

      " . GFCommon::gform_do_shortcode($form["schedulePendingMessage"]) . "

      "; - elseif(!empty($form["scheduleEnd"]) && $now > $timestamp_end) - return empty($form["scheduleMessage"]) ? "

      " . __("Sorry. This form is no longer available.", "gravityforms") . "

      " : "

      " . GFCommon::gform_do_shortcode($form["scheduleMessage"]) . "

      "; - } + return $text; + } - } + public static function handle_save_email_confirmation( $form, $ajax ) { + $resume_email = $_POST['gform_resume_email']; + if ( ! GFCommon::is_valid_email( $resume_email ) ) { + GFCommon::log_debug( 'GFFormDisplay::handle_save_email_confirmation(): Invalid email address: ' . $resume_email ); + return new WP_Error( 'invalid_email' ); + } + $resume_token = $_POST['gform_resume_token']; + $submission_details = GFFormsModel::get_incomplete_submission_values( $resume_token ); + $submission_json = $submission_details['submission']; + $submission = json_decode( $submission_json, true ); + $entry = $submission['partial_entry']; + $form = self::update_confirmation( $form, $entry, 'form_save_email_sent' ); - public static function update_confirmation($form, $lead=null) { - if(!is_array(rgar($form, "confirmations"))) - return $form; + $confirmation = '
      ' . rgar( $form['confirmation'], 'message' ) . '
      '; + $nl2br = rgar( $form['confirmation'], 'disableAutoformat' ) ? false : true; + $save_email_confirmation = self::replace_save_variables( $confirmation, $form, $resume_token, $resume_email ); - // if there is only one confirmation, don't bother with the conditional logic, just return it - // this is here mostly to avoid the semi-costly GFFormsModel::create_lead() function unless we really need it - if(is_array($form["confirmations"]) && count($form['confirmations']) <= 1) { - $form['confirmation'] = reset($form['confirmations']); - return $form; - } + $save_email_confirmation = GFCommon::replace_variables( $save_email_confirmation, $form, $entry, false, true, $nl2br ); - if (empty($lead)){ - $lead = GFFormsModel::create_lead($form); + if ( $ajax ) { + $save_email_confirmation = "" . $save_email_confirmation . ''; } - foreach($form['confirmations'] as $confirmation) { - - if( rgar($confirmation, 'isDefault') ){ - continue; - } + GFCommon::log_debug( 'GFFormDisplay::handle_save_email_confirmation(): Confirmation => ' . print_r( $save_email_confirmation, true ) ); - if(isset($confirmation['isActive']) && ! $confirmation['isActive']) - continue; + return $save_email_confirmation; + } - $logic = rgar($confirmation, "conditionalLogic"); - if(GFCommon::evaluate_conditional_logic($logic, $form, $lead)) { - $form['confirmation'] = $confirmation; - return $form; - } + public static function handle_save_confirmation( $form, $resume_token, $confirmation_message, $ajax ) { + $resume_email = isset( $_POST['gform_resume_email'] ) ? $_POST['gform_resume_email'] : null; + $confirmation_message = self::replace_save_variables( $confirmation_message, $form, $resume_token, $resume_email ); + $confirmation_message = "
      " . $confirmation_message . '
      '; + if ( $ajax ) { + $confirmation_message = "" . $confirmation_message . ''; + } - } - $filtered_list = wp_filter_object_list($form['confirmations'], array('isDefault' => true)); - $form['confirmation'] = reset($filtered_list); + GFCommon::log_debug( 'GFFormDisplay::handle_save_confirmation(): Confirmation => ' . print_r( $confirmation_message, true ) ); - return $form; - } + return $confirmation_message; + } } \ No newline at end of file diff --git a/form_list.php b/form_list.php index 425c1c8..c4988b6 100644 --- a/form_list.php +++ b/form_list.php @@ -1,640 +1,678 @@ - - - - - - - - - - - - -
      - -

      - - -

      - - -

      - - -
      - - - - - - - -
      -
      - - - - '; - echo apply_filters("gform_form_apply_button", $apply_button); - ?> - -
      - -
      -
      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 0){ - $alternate_row = false; - foreach($forms as $form){ - $conversion = "0%"; - if($form->view_count > 0){ - $conversion = (number_format($form->lead_count / $form->view_count, 3) * 100) . "%"; - } - $gf_form_locking = new GFFormLocking(); - ?> - ' valign="top" data-id="id) ?>"> - - - - - - - - - - - - - - - - - -
      lock_indicator();?> - - <?php echo $form->is_active ? __(" title="is_active ? __("Active", "gravityforms") : __("Inactive", "gravityforms");?>" onclick="ToggleActive(this, id ?>); " /> - - id ?> - title; - else : - ?> - ">title ?> - lock_info($form->id); - endif - ?> -
      - - __("Restore", "gravityforms"), - 'title' => __("Restore", "gravityforms"), - 'url' => 'javascript:RestoreForm(' . $form->id . ');', - 'capabilities' => "gravityforms_delete_forms", - 'priority' => 600 - ); - $form_actions['delete'] = array( - 'label' => __("Delete permanently", "gravityforms"), - 'title' => __("Delete permanently", "gravityforms"), - 'menu_class' => 'delete', - 'url' => 'javascript: if(confirm("' . __("WARNING: You are about to delete this form and ALL entries associated with it. ", "gravityforms") . __('\"Cancel\" to stop, \"OK\" to delete.', "gravityforms") . '")){ DeleteForm(' . $form->id . ');}', - 'capabilities' => "gravityforms_delete_forms", - 'priority' => 500 - ); - - } else { - require_once(GFCommon::get_base_path() . '/form_settings.php'); - - $form_actions = GFForms::get_toolbar_menu_items($form->id, true); - - $form_actions['duplicate'] = array( - 'label' => __("Duplicate", "gravityforms"), - 'title' => __("Duplicate this form", "gravityforms"), - 'url' => 'javascript:DuplicateForm(' . $form->id . ');', - 'capabilities' => "gravityforms_create_form", - 'priority' => 600 - ); - - $form_actions['trash'] = array( - 'label' => __("Trash", "gravityforms"), - 'title' => __("Move this form to the trash", "gravityforms"), - 'url' => 'javascript:TrashForm(' . $form->id . ');', - 'capabilities' => "gravityforms_delete_forms", - 'menu_class' => 'trash', - 'priority' => 500 - ); - - } - - $form_actions = apply_filters("gform_form_actions", $form_actions, $form->id); - - echo GFForms::format_toolbar_menu_items($form_actions, true); - - ?> - -
      -
      view_count ?> - - lead_count > 0 && !$trash) { ?> - id}"); ?>">lead_count; ?> - lead_count; - } ?> - -
      - ', ""); - - ?> -
      -
      -
      - - - - '; - echo apply_filters("gform_form_apply_button", $apply_button); - } - ?> -
      -
      -
      -
      -
      - __('There was an issue creating your form.', 'gravityforms') ) ) ); - } - - GFFormsModel::ensure_tables_exist(); - - require_once(GFCommon::get_base_path() . '/form_detail.php'); - - $form_json = rgpost('form'); - - $form = json_decode($form_json, true); - - if( empty( $form['title'] ) ) { - $result = array( 'error' => __( 'Please enter a form title.', 'gravityforms' ) ); - die( json_encode( $result ) ); - } - - /* - * This is now added in JavaScript using jQuery.toJSON(). See the DocBlock GFFormDetail::save_form_info() for details. - * - $form['labelPlacement'] = 'top_label'; - $form['descriptionPlacement'] = 'below'; - $form['button'] = array( - 'type' => 'text', - 'text' => __("Submit", "gravityforms"), - 'imageUrl' => '' - ); - $form['fields'] = array(); - */ - - $result = GFFormDetail::save_form_info( 0, $form_json ); - - switch(rgar($result, 'status')){ - case 'invalid_json': - $result['error'] = __('There was an issue creating your form.', 'gravityforms'); - die(json_encode($result)); - - case 'duplicate_title': - $result['error'] = __('Please enter a unique form title.', 'gravityforms'); - die(json_encode($result)); - - default: - $form_id = abs($result['status']); - die( json_encode( array('redirect' => admin_url("admin.php?page=gf_edit_forms&id={$form_id}")) ) ); - } - - } +class GFFormList { + + public static function form_list_page() { + global $wpdb; + + if ( ! GFCommon::ensure_wp_version() ) { + return; + } + + echo GFCommon::get_remote_message(); + + $action = RGForms::post( 'action' ); + $bulk_action = RGForms::post( 'bulk_action' ); + $bulk_action = ! empty( $bulk_action ) ? $bulk_action : RGForms::post( 'bulk_action2' ); + + if ( $action == 'trash' ) { + check_admin_referer( 'gforms_update_forms', 'gforms_update_forms' ); + $form_id = RGForms::post( 'action_argument' ); + RGFormsModel::trash_form( $form_id ); + $message = __( 'Form moved to the trash.', 'gravityforms' ); + } else if ( $action == 'restore' ) { + check_admin_referer( 'gforms_update_forms', 'gforms_update_forms' ); + $form_id = RGForms::post( 'action_argument' ); + RGFormsModel::restore_form( $form_id ); + $message = __( 'Form restored.', 'gravityforms' ); + } else if ( $action == 'delete' ) { + check_admin_referer( 'gforms_update_forms', 'gforms_update_forms' ); + $form_id = RGForms::post( 'action_argument' ); + if ( GFCommon::current_user_can_any( 'gravityforms_delete_forms' ) ) { + RGFormsModel::delete_form( $form_id ); + $message = __( 'Form deleted.', 'gravityforms' ); + } else { + $message = __( "You don't have adequate permission to delete forms.", 'gravityforms' ); + } + } else if ( $action == 'duplicate' ) { + check_admin_referer( 'gforms_update_forms', 'gforms_update_forms' ); + $form_id = RGForms::post( 'action_argument' ); + RGFormsModel::duplicate_form( $form_id ); + $message = __( 'Form duplicated.', 'gravityforms' ); + } + + if ( $bulk_action ) { + + check_admin_referer( 'gforms_update_forms', 'gforms_update_forms' ); + $form_ids = is_array( rgpost( 'form' ) ) ? rgpost( 'form' ) : array(); + $form_count = count( $form_ids ); + + switch ( $bulk_action ) { + case 'trash': + GFFormsModel::trash_forms( $form_ids ); + $message = _n( '%s form moved to the trash.', '%s forms moved to the trash.', $form_count, 'gravityforms' ); + break; + case 'restore': + GFFormsModel::restore_forms( $form_ids ); + $message = _n( '%s form restored.', '%s forms restored.', $form_count, 'gravityforms' ); + break; + case 'delete': + if ( GFCommon::current_user_can_any( 'gravityforms_delete_forms' ) ) { + GFFormsModel::delete_forms( $form_ids ); + $message = _n( '%s form deleted.', '%s forms deleted.', $form_count, 'gravityforms' ); + } else { + $message = __( "You don't have adequate permissions to delete forms.", 'gravityforms' ); + } + break; + case 'reset_views': + foreach ( $form_ids as $form_id ) { + GFFormsModel::delete_views( $form_id ); + } + $message = _n( 'Views for %s form have been reset.', 'Views for %s forms have been reset.', $form_count, 'gravityforms' ); + break; + case 'delete_entries': + if ( GFCommon::current_user_can_any( 'gravityforms_delete_entries' ) ) { + foreach ( $form_ids as $form_id ) { + GFFormsModel::delete_leads_by_form( $form_id ); + } + $message = _n( 'Entries for %s form have been deleted.', 'Entries for %s forms have been deleted.', $form_count, 'gravityforms' ); + } else { + $message = __( "You don't have adequate permission to delete entries.", 'gravityforms' ); + } + + break; + case 'activate': + foreach ( $form_ids as $form_id ) { + GFFormsModel::update_form_active( $form_id, 1 ); + } + $message = _n( '%s form has been marked as active.', '%s forms have been marked as active.', $form_count, 'gravityforms' ); + break; + case 'deactivate': + foreach ( $form_ids as $form_id ) { + GFFormsModel::update_form_active( $form_id, 0 ); + } + $message = _n( '%s form has been marked as inactive.', '%s forms have been marked as inactive.', $form_count, 'gravityforms' ); + break; + } + + if ( isset( $message ) ) + $message = sprintf( $message, $form_count ); + + } + $sort_column = empty( $_GET['sort'] ) ? 'title' : $_GET['sort']; + $sort_direction = empty( $_GET['dir'] ) ? 'ASC' : $_GET['dir']; + $active = RGForms::get( 'active' ) == '' ? null : RGForms::get( 'active' ); + $trash = RGForms::get( 'trash' ) == '' ? false : RGForms::get( 'trash' ); + $trash = esc_attr( $trash ); + $forms = RGFormsModel::get_forms( $active, $sort_column, $sort_direction, $trash ); + + $form_count = RGFormsModel::get_form_count(); + + // - new form modal - // + + wp_print_styles( array( 'thickbox' ) ); + + /*wp_enqueue_script( 'form_admin' ); + wp_print_scripts( array( 'form_admin' ) );*/ + + ?> + + + + + + + + + + + + +
      + +

      + + +

      + + +

      + + +
      + + + + + + + +
      +
      + + + + '; + echo apply_filters( 'gform_form_apply_button', $apply_button ); + ?> + +
      + +
      +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 ) { + $alternate_row = false; + foreach ( $forms as $form ) { + $conversion = '0%'; + if ( $form->view_count > 0 ) { + $conversion = ( number_format( $form->lead_count / $form->view_count, 3 ) * 100 ) . '%'; + } + $gf_form_locking = new GFFormLocking(); + ?> + ' valign="top" data-id="id ) ?>"> + + + + + + + + + + + + + + + + + +
      + +
      + +
      + lock_indicator(); ?> + + + <?php echo $form->is_active ? __( 'Active', 'gravityforms' ) : __( 'Inactive', 'gravityforms' ); ?> + + id ?> + title; + else : + ?> + title ?> + lock_info( $form->id ); + endif + ?> +
      + + __( 'Restore', 'gravityforms' ), + 'title' => __( 'Restore', 'gravityforms' ), + 'url' => 'javascript:RestoreForm(' . $form->id . ');', + 'capabilities' => 'gravityforms_delete_forms', + 'priority' => 600, + ); + $form_actions['delete'] = array( + 'label' => __( 'Delete permanently', 'gravityforms' ), + 'title' => __( 'Delete permanently', 'gravityforms' ), + 'menu_class' => 'delete', + 'url' => 'javascript: if(confirm("' . __( 'WARNING: You are about to delete this form and ALL entries associated with it. ', 'gravityforms' ) . __( '\"Cancel\" to stop, \"OK\" to delete.', 'gravityforms' ) . '")){ DeleteForm(' . $form->id . ');}', + 'capabilities' => 'gravityforms_delete_forms', + 'priority' => 500, + ); + + } else { + require_once( GFCommon::get_base_path() . '/form_settings.php' ); + + $form_actions = GFForms::get_toolbar_menu_items( $form->id, true ); + + $form_actions['duplicate'] = array( + 'label' => __( 'Duplicate', 'gravityforms' ), + 'title' => __( 'Duplicate this form', 'gravityforms' ), + 'url' => 'javascript:DuplicateForm(' . $form->id . ');', + 'capabilities' => 'gravityforms_create_form', + 'priority' => 600, + ); + + $form_actions['trash'] = array( + 'label' => __( 'Trash', 'gravityforms' ), + 'title' => __( 'Move this form to the trash', 'gravityforms' ), + 'url' => 'javascript:TrashForm(' . $form->id . ');', + 'capabilities' => 'gravityforms_delete_forms', + 'menu_class' => 'trash', + 'priority' => 500, + ); + + } + + $form_actions = apply_filters( 'gform_form_actions', $form_actions, $form->id ); + + echo GFForms::format_toolbar_menu_items( $form_actions, true ); + + ?> + +
      +
      view_count ?> + + lead_count > 0 && ! $trash ) { ?> + id}" ); ?>">lead_count; ?> + lead_count; + } ?> + +
      + ', '' ); + + ?> +
      +
      +
      + + + + '; + echo apply_filters( 'gform_form_apply_button', $apply_button ); + } + ?> +
      +
      +
      +
      +
      + __( 'There was an issue creating your form.', 'gravityforms' ) ) ) ); + } + + GFFormsModel::ensure_tables_exist(); + + require_once( GFCommon::get_base_path() . '/form_detail.php' ); + + $form_json = rgpost( 'form' ); + + $form = json_decode( $form_json, true ); + + if ( empty( $form['title'] ) ) { + $result = array( 'error' => __( 'Please enter a form title.', 'gravityforms' ) ); + die( json_encode( $result ) ); + } + + $result = GFFormDetail::save_form_info( 0, $form_json ); + + switch ( rgar( $result, 'status' ) ) { + case 'invalid_json': + $result['error'] = __( 'There was an issue creating your form.', 'gravityforms' ); + die( json_encode( $result ) ); + + case 'duplicate_title': + $result['error'] = __( 'Please enter a unique form title.', 'gravityforms' ); + die( json_encode( $result ) ); + + default: + $form_id = abs( $result['status'] ); + die( json_encode( array( 'redirect' => admin_url( "admin.php?page=gf_edit_forms&id={$form_id}" ) ) ) ); + } + } } diff --git a/form_settings.php b/form_settings.php index 68669d6..59401cd 100644 --- a/form_settings.php +++ b/form_settings.php @@ -1,495 +1,543 @@ + self::page_header( __( 'Form Settings', 'gravityforms' ) ); - - - -
      -

      - - ', '') ?> -

      -
      - -
      -

      - -

      -
      - -
      -

      - -

      -
      - + + + + +
      +

      + + ', '' ) ?> +

      +
      + +
      +

      + +

      +
      + +
      +

      + +

      +
      +
      '; - $subsetting_close = ' + $subsetting_close = '
      '; - - //create form settings table rows and put them into an array - //form title - $tr_form_title = ' + //create form settings table rows and put them into an array + //form title + $tr_form_title = ' ' . - __("Form title", "gravityforms") . ' ' . - gform_tooltip("form_title", "", true) . - ' - - - + __( 'Form title', 'gravityforms' ) . ' ' . + gform_tooltip( 'form_title', '', true ) . + ' + + + '; - //form description - $tr_form_description = ' + //form description + $tr_form_description = ' ' . - __("Form description", "gravityforms") . ' ' . - gform_tooltip("form_description", "", true) . - ' - - - + __( 'Form description', 'gravityforms' ) . ' ' . + gform_tooltip( 'form_description', '', true ) . + ' + + + '; - //form label placement - $alignment_options = array( - 'top_label' => __("Top aligned", "gravityforms"), - 'left_label' => __("Left aligned", "gravityforms"), - 'right_label' => __("Right aligned", "gravityforms") - ); + //form label placement + $alignment_options = array( + 'top_label' => __( 'Top aligned', 'gravityforms' ), + 'left_label' => __( 'Left aligned', 'gravityforms' ), + 'right_label' => __( 'Right aligned', 'gravityforms' ) + ); - $label_dd = ""; - foreach($alignment_options as $value => $label) { - $selected = $form['labelPlacement'] == $value ? 'selected="selected"' : ''; + $label_dd = ''; + foreach ( $alignment_options as $value => $label ) { + $selected = $form['labelPlacement'] == $value ? 'selected="selected"' : ''; - $label_dd .= ''; - } - $tr_form_label_placement = ' + $label_dd .= ''; + } + $tr_form_label_placement = ' ' . - __("Label placement", "gravityforms") . ' ' . - gform_tooltip("form_label_placement", "", true) . - ' - - - - - '; - - //form description placement - $style = $form['labelPlacement'] != 'top_label' ? 'display:none;' : ''; - $description_dd = ""; - $description_options = array( - 'below' => __("Below inputs", "gravityforms"), - 'above' => __("Above inputs", "gravityforms") - ); - foreach($description_options as $value => $label) { - $selected = rgar( $form, 'descriptionPlacement' ) == $value ? 'selected="selected"' : ''; - - $description_dd .= ''; - } - $tr_form_description_placement = ' + __( 'Label placement', 'gravityforms' ) . ' ' . + gform_tooltip( 'form_label_placement', '', true ) . + ' + + + + + '; + + //form description placement + $style = $form['labelPlacement'] != 'top_label' ? 'display:none;' : ''; + $description_dd = ''; + $description_options = array( + 'below' => __( 'Below inputs', 'gravityforms' ), + 'above' => __( 'Above inputs', 'gravityforms' ) + ); + foreach ( $description_options as $value => $label ) { + $selected = rgar( $form, 'descriptionPlacement' ) == $value ? 'selected="selected"' : ''; + + $description_dd .= ''; + } + $tr_form_description_placement = ' ' . - __("Description placement", "gravityforms") . ' ' . - gform_tooltip("form_description_placement", "", true) . - ' - - - - - '; - - - - //css class name - $tr_css_class_name = ' + __( 'Description placement', 'gravityforms' ) . ' ' . + gform_tooltip( 'form_description_placement', '', true ) . + ' + + + + + '; + + + //Sub Label placement + $sub_label_placement_dd = ''; + $sub_label_placement_options = array( + 'below' => __( 'Below inputs', 'gravityforms' ), + 'above' => __( 'Above inputs', 'gravityforms' ) + ); + foreach ( $sub_label_placement_options as $value => $label ) { + $selected = rgar( $form, 'subLabelPlacement' ) == $value ? 'selected="selected"' : ''; + + $sub_label_placement_dd .= ''; + } + $tr_sub_label_placement = ' + + + ' . + __( 'Sub-label placement', 'gravityforms' ) . ' ' . + gform_tooltip( 'form_sub_label_placement', '', true ) . + ' + + + + + '; + + + //css class name + $tr_css_class_name = ' - - - + __( 'CSS Class Name', 'gravityforms' ) . ' ' . + gform_tooltip( 'form_css_class', '', true ) . + ' + + + '; - - //create form advanced settings table rows - //create form button rows - $form_button_type = rgars($form, 'button/type'); - $text_button_checked = ""; - $image_button_checked = ""; - $text_style_display = ""; - $image_style_display = ""; - if ($form_button_type == "text"){ + //create form advanced settings table rows + //create form button rows + $form_button_type = rgars( $form, 'button/type' ); + $text_button_checked = ''; + $image_button_checked = ''; + $text_style_display = ''; + $image_style_display = ''; + if ( $form_button_type == 'text' ) { $text_button_checked = 'checked="checked"'; - $image_style_display = "display:none;"; - } - else if ($form_button_type == "image"){ + $image_style_display = 'display:none;'; + } else if ( $form_button_type == 'image' ) { $image_button_checked = 'checked="checked"'; - $text_style_display = "display:none;"; + $text_style_display = 'display:none;'; } - //form button - $tr_form_button = ' + //form button + $tr_form_button = ' - ' . __("Input type", "gravityforms") . ' + ' . __( 'Input type', 'gravityforms' ) . ' + __( 'Text', 'gravityforms' ) . + ' -    +    - + + __( 'Image', 'gravityforms' ) . ' '; - //form button text - $tr_form_button_text = $subsetting_open . ' + //form button text + $tr_form_button_text = $subsetting_open . ' ' . - __("Button text", "gravityforms") . ' ' . - gform_tooltip("form_button_text", "", true) . - ' - - - + __( 'Button text', 'gravityforms' ) . ' ' . + gform_tooltip( 'form_button_text', '', true ) . + ' + + + '; - //form button image path - $tr_form_button_image_path = ' + //form button image path + $tr_form_button_image_path = ' ' . - __("Button image path", "gravityforms") . ' ' . - gform_tooltip("form_button_image", "", true) . - ' - - - + __( 'Button image path', 'gravityforms' ) . ' ' . + gform_tooltip( 'form_button_image', '', true ) . + ' + + + ' . $subsetting_close; - //form button conditional logic - $button_conditional_checked = ""; - if (rgars($form, 'button/conditionalLogic')){ + //form button conditional logic + $button_conditional_checked = ''; + if ( rgars( $form, 'button/conditionalLogic' ) ) { $button_conditional_checked = 'checked="checked"'; - } + } - $tr_form_button_conditional = ' + $tr_form_button_conditional = ' - ' . __("Button conditional logic", "gravityforms") . ' ' . gform_tooltip("form_button_conditional_logic", "", true) . ' + ' . __( 'Button conditional logic', 'gravityforms' ) . ' ' . gform_tooltip( 'form_button_conditional_logic', '', true ) . ' - - + + @@ -502,1068 +550,1306 @@ function ShowAdvancedFormSettings() { '; - //limit entries - $limit_entry_checked = ""; - $limit_entry_style = ""; - $limit_entries_dd = ""; - if(rgar($form, 'limitEntries')){ - $limit_entry_checked = 'checked="checked"'; + //create save and continue rows + + $save_enabled_checked = ''; + $save_enabled_style = ''; + + if ( rgars( $form, 'save/enabled' ) ) { + $save_enabled_checked = 'checked="checked"'; + } else { + $save_enabled_style = 'style="display:none;"'; + } - } - else{ - $limit_entry_style = "display:none"; - } - - $limit_periods = array( - '' => __('total entries', 'gravityforms'), - 'day' => __('per day', 'gravityforms'), - 'week' => __('per week', 'gravityforms'), - 'month' => __('per month', 'gravityforms'), - 'year' => __('per year', 'gravityforms') - ); - foreach($limit_periods as $value => $label) { - $selected = rgar($form, 'limitEntriesPeriod') == $value ? 'selected="selected"' : ''; - $limit_entries_dd .= ''; - } - - $tr_limit_entries = ' + $save_button_text = isset( $form['save']['button']['text'] ) ? esc_attr( rgars( $form, 'save/button/text' ) ) : __( 'Save and Continue Later', 'gravityforms' ); + + $tr_enable_save = ' - ' . __("Limit number of entries", "gravityforms") . ' ' . gform_tooltip("form_limit_entries", "", true) . ' + ' . __( 'Save and Continue', 'gravityforms' ) . ' ' . gform_tooltip( 'form_enable_save', '', true ) . ' - - + + '; - //limit entries count - $tr_limit_entries_count = ' - + // Warning + $tr_save_warning = ' + ' . $subsetting_open . ' + + + +
      +
      + + '. __('This feature stores potentially private and sensitive data on this server and protects it with a unique link which is displayed to the user on the page in plain, unencrypted text. The link is similar to a password so it\'s strongly advisable to ensure that the page enforces a secure connection (HTTPS) before activating this setting.', 'gravityforms'). + '
      +
      +
      + + '. __('When this setting is activated two confirmations and one notification are automatically generated and can be modified in their respective editors. When this setting is deactivated the confirmations and the notification will be deleted automatically and any modifications will be lost.', 'gravityforms'). + '
      +
      + + + '; + + //save button text + $tr_save_button_text = ' + ' . - __("Number of Entries", "gravityforms") . - ' + __( 'Link text', 'gravityforms' ) . ' ' . + gform_tooltip( 'form_save_button_text', '', true ) . + ' + + + + + ' . $subsetting_close . ' + '; + + //limit entries + $limit_entry_checked = ''; + $limit_entry_style = ''; + $limit_entries_dd = ''; + if ( rgar( $form, 'limitEntries' ) ) { + $limit_entry_checked = 'checked="checked"'; + + } else { + $limit_entry_style = 'display:none'; + } + + $limit_periods = array( + '' => __( 'total entries', 'gravityforms' ), + 'day' => __( 'per day', 'gravityforms' ), + 'week' => __( 'per week', 'gravityforms' ), + 'month' => __( 'per month', 'gravityforms' ), + 'year' => __( 'per year', 'gravityforms' ) + ); + foreach ( $limit_periods as $value => $label ) { + $selected = rgar( $form, 'limitEntriesPeriod' ) == $value ? 'selected="selected"' : ''; + $limit_entries_dd .= ''; + } + + $tr_limit_entries = ' + + + ' . __( 'Limit number of entries', 'gravityforms' ) . ' ' . gform_tooltip( 'form_limit_entries', '', true ) . ' - + + + + '; + + //limit entries count + $tr_limit_entries_count = ' + + ' . $subsetting_open . ' + + ' . + __( 'Number of Entries', 'gravityforms' ) . + ' + + +   - - ' . $subsetting_close . ' + $limit_entries_dd . + ' + + ' . $subsetting_close . ' '; - //limit entries message - $tr_limit_entries_message = ' + //limit entries message + $tr_limit_entries_message = ' ' . $subsetting_open . ' - - - + __( 'Entry Limit Reached Message', 'gravityforms' ) . + ' + + + ' . $subsetting_close . ' '; - //schedule form - $schedule_form_checked = ""; - $schedule_form_style = ""; - $start_hour_dd = ""; - $start_minute_dd = ""; - $start_am_selected = ""; - $start_pm_selected = ""; - $end_hour_dd = ""; - $end_minute_dd = ""; - $end_am_selected = ""; - $end_pm_selected = ""; - - if (rgar($form, 'scheduleForm')){ + //schedule form + $schedule_form_checked = ''; + $schedule_form_style = ''; + $start_hour_dd = ''; + $start_minute_dd = ''; + $start_am_selected = ''; + $start_pm_selected = ''; + $end_hour_dd = ''; + $end_minute_dd = ''; + $end_am_selected = ''; + $end_pm_selected = ''; + + if ( rgar( $form, 'scheduleForm' ) ) { $schedule_form_checked = 'checked="checked"'; - } - else{ - $schedule_form_style = "display:none"; - } + } else { + $schedule_form_style = 'display:none'; + } //create start hour dd options - for($i = 1; $i <= 12; $i++) { - $selected = rgar($form, 'scheduleStartHour') == $i ? 'selected="selected"' : ''; - $start_hour_dd .= ''; + for ( $i = 1; $i <= 12; $i ++ ) { + $selected = rgar( $form, 'scheduleStartHour' ) == $i ? 'selected="selected"' : ''; + $start_hour_dd .= ''; } //create start minute dd options - foreach(array('00', '15', '30', '45') as $value) { - $selected = rgar($form, 'scheduleStartMinute') == $value ? 'selected="selected"' : ''; - $start_minute_dd .= ''; - } - //set start am/pm - if (rgar($form, 'scheduleStartAmpm') == 'am') { - $start_am_selected = 'selected="selected"'; - } - elseif (rgar($form, 'scheduleStartAmpm') == 'pm'){ + foreach ( array( '00', '15', '30', '45' ) as $value ) { + $selected = rgar( $form, 'scheduleStartMinute' ) == $value ? 'selected="selected"' : ''; + $start_minute_dd .= ''; + } + //set start am/pm + if ( rgar( $form, 'scheduleStartAmpm' ) == 'am' ) { + $start_am_selected = 'selected="selected"'; + } elseif ( rgar( $form, 'scheduleStartAmpm' ) == 'pm' ) { $start_pm_selected = 'selected="selected"'; - } - //create end hour dd options - for($i = 1; $i <= 12; $i++) { - $selected = rgar($form, 'scheduleEndHour') == $i ? 'selected="selected"' : ''; - $end_hour_dd .= ''; + } + //create end hour dd options + for ( $i = 1; $i <= 12; $i ++ ) { + $selected = rgar( $form, 'scheduleEndHour' ) == $i ? 'selected="selected"' : ''; + $end_hour_dd .= ''; } //create end minute dd options - foreach(array('00', '15', '30', '45') as $value) { - $selected = rgar($form, 'scheduleEndMinute') == $value ? 'selected="selected"' : ''; - $end_minute_dd .= ''; + foreach ( array( '00', '15', '30', '45' ) as $value ) { + $selected = rgar( $form, 'scheduleEndMinute' ) == $value ? 'selected="selected"' : ''; + $end_minute_dd .= ''; } //set end am/pm - if (rgar($form, 'scheduleEndAmpm') == 'am') { - $end_am_selected = 'selected="selected"'; - } - elseif (rgar($form, 'scheduleEndAmpm') == 'pm'){ + if ( rgar( $form, 'scheduleEndAmpm' ) == 'am' ) { + $end_am_selected = 'selected="selected"'; + } elseif ( rgar( $form, 'scheduleEndAmpm' ) == 'pm' ) { $end_pm_selected = 'selected="selected"'; - } + } - //schedule form - $tr_schedule_form = ' + //schedule form + $tr_schedule_form = ' - ' . __("Schedule form", "gravityforms") . ' ' . gform_tooltip("form_schedule_form", "", true) . ' + ' . __( 'Schedule form', 'gravityforms' ) . ' ' . gform_tooltip( 'form_schedule_form', '', true ) . ' - + '; - //schedule start - $tr_schedule_start = ' + //schedule start + $tr_schedule_start = ' ' . $subsetting_open . ' - + - +    - : - - + : + + ' . $subsetting_close . ' '; - //schedule end - $tr_schedule_end = ' - + //schedule end + $tr_schedule_end = ' + ' . $subsetting_open . ' - ' . __("Schedule Form End Date/Time", "gravityforms") . ' + ' . __( 'Schedule Form End Date/Time', 'gravityforms' ) . ' - +    - : - - + : + + ' . $subsetting_close . ' '; - //schedule message - $tr_schedule_pending_message = ' - + //schedule message + $tr_schedule_pending_message = ' + ' . $subsetting_open . ' - ' . __("Form Pending Message", "gravityforms") . ' + ' . __( 'Form Pending Message', 'gravityforms' ) . ' - + ' . $subsetting_close . ' '; - //schedule message - $tr_schedule_message = ' - + //schedule message + $tr_schedule_message = ' + ' . $subsetting_open . ' - ' . __("Form Expired Message", "gravityforms") . ' + ' . __( 'Form Expired Message', 'gravityforms' ) . ' - + ' . $subsetting_close . ' '; - //honey pot - $honey_pot_checked = ""; - if (rgar($form, 'enableHoneypot')){ + //honey pot + $honey_pot_checked = ''; + if ( rgar( $form, 'enableHoneypot' ) ) { $honey_pot_checked = 'checked="checked"'; - } - $tr_honey_pot = ' + } + $tr_honey_pot = ' - ' . __("Anti-spam honeypot", "gravityforms") . ' ' . gform_tooltip("form_honeypot", "", true) . ' + ' . __( 'Anti-spam honeypot', 'gravityforms' ) . ' ' . gform_tooltip( 'form_honeypot', '', true ) . ' - + '; - //enable animation - $enable_animation_checked = ""; - if (rgar($form, 'enableAnimation')){ + //enable animation + $enable_animation_checked = ''; + if ( rgar( $form, 'enableAnimation' ) ) { $enable_animation_checked = 'checked="checked"'; - } - $tr_enable_animation = ' + } + $tr_enable_animation = ' - ' . __("Animated transitions", "gravityforms") . ' ' . gform_tooltip("form_animation", "", true) . ' + ' . __( 'Animated transitions', 'gravityforms' ) . ' ' . gform_tooltip( 'form_animation', '', true ) . ' - + '; - //require login - $require_login_checked = ""; - $require_login_style = ""; - if (rgar($form, 'requireLogin')){ + //require login + $require_login_checked = ''; + $require_login_style = ''; + if ( rgar( $form, 'requireLogin' ) ) { $require_login_checked = 'checked="checked"'; - } - else{ - $require_login_style = "display:none"; - } - $tr_requires_login = ' + } else { + $require_login_style = 'display:none'; + } + $tr_requires_login = ' - ' . __("Require user to be logged in", "gravityforms") . ' ' . gform_tooltip("form_require_login", "", true) . ' + ' . __( 'Require user to be logged in', 'gravityforms' ) . ' ' . gform_tooltip( 'form_require_login', '', true ) . ' - + '; - //require login message - $tr_requires_login_message = ' - + //require login message + $tr_requires_login_message = ' + ' . $subsetting_open . ' - ' . __("Require Login Message", "gravityforms") . ' ' . gform_tooltip("form_require_login_message", "", true) . ' + ' . __( 'Require Login Message', 'gravityforms' ) . ' ' . gform_tooltip( 'form_require_login_message', '', true ) . ' - + ' . $subsetting_close . ' '; - //populate arrays with table rows - $form_basics = array("form_title" => $tr_form_title, "form_description" => $tr_form_description); - $form_layout = array("form_label_placement" => $tr_form_label_placement, "form_description_placement" => $tr_form_description_placement, "css_class_name" => $tr_css_class_name); - $form_button = array("form_button_type" => $tr_form_button, "form_button_text" => $tr_form_button_text, "form_button_image_path" => $tr_form_button_image_path, "form_button_conditional" => $tr_form_button_conditional); - $form_restrictions = array("limit_entries" => $tr_limit_entries, "number_of_entries" => $tr_limit_entries_count, "entry_limit_message" => $tr_limit_entries_message, "schedule_form" => $tr_schedule_form, "schedule_start" => $tr_schedule_start, "schedule_end" => $tr_schedule_end, "schedule_pending_message" => $tr_schedule_pending_message, "schedule_message" => $tr_schedule_message, "requires_login" => $tr_requires_login, "requires_login_message" => $tr_requires_login_message); - $form_options = array("honey_pot" => $tr_honey_pot, "enable_animation" => $tr_enable_animation); - - $form_settings = array( - __("Form Basics", "gravityforms") => $form_basics, - __("Form Layout", "gravityforms") => $form_layout, - __("Form Button", "gravityforms") => $form_button, - __("Restrictions", "gravityforms") => $form_restrictions, - __("Form Options", "gravityforms") => $form_options); - - $form_settings = apply_filters("gform_form_settings", $form_settings, $form); - ?> - -
      - -

      - -
      - - - $value) { - ?> - - - - $tr_form_title, 'form_description' => $tr_form_description ); + $form_layout = array( 'form_label_placement' => $tr_form_label_placement, 'form_description_placement' => $tr_form_description_placement, 'form_sub_label_placement' => $tr_sub_label_placement, 'css_class_name' => $tr_css_class_name ); + $form_button = array( 'form_button_type' => $tr_form_button, 'form_button_text' => $tr_form_button_text, 'form_button_image_path' => $tr_form_button_image_path, 'form_button_conditional' => $tr_form_button_conditional ); + $save_button = array( 'save_enabled' => $tr_enable_save, 'save_warning' => $tr_save_warning, 'save_button_text' => $tr_save_button_text ); + $form_restrictions = array( 'limit_entries' => $tr_limit_entries, 'number_of_entries' => $tr_limit_entries_count, 'entry_limit_message' => $tr_limit_entries_message, 'schedule_form' => $tr_schedule_form, 'schedule_start' => $tr_schedule_start, 'schedule_end' => $tr_schedule_end, 'schedule_pending_message' => $tr_schedule_pending_message, 'schedule_message' => $tr_schedule_message, 'requires_login' => $tr_requires_login, 'requires_login_message' => $tr_requires_login_message ); + $form_options = array( 'honey_pot' => $tr_honey_pot, 'enable_animation' => $tr_enable_animation ); + + $form_settings = array( + __( 'Form Basics', 'gravityforms' ) => $form_basics, + __( 'Form Layout', 'gravityforms' ) => $form_layout, + __( 'Form Button', 'gravityforms' ) => $form_button, + __( 'Save and Continue', 'gravityforms' ) => $save_button, + __( 'Restrictions', 'gravityforms' ) => $form_restrictions, + __( 'Form Options', 'gravityforms' ) => $form_options, + ); + + $form_settings = apply_filters( 'gform_form_settings', $form_settings, $form ); + ?> + +
      + +

      + + + +

      + $value ) { + ?> + + + + -
      +

      +
      + } + } + ?> + -
      - - - - - - +
      + + + + + + - - - - - - - - + + + + + + + + -
      +
      - - - + + + -
      + -
      +
    - 0 ) ); + ?> - self::page_header(__('Confirmations', 'gravityforms')); +

    + +

    - $add_new_url = add_query_arg(array("cid" => 0)); - ?> + -

    + - var mysack = new sack("" ); - mysack.execute = 1; - mysack.method = 'POST'; - mysack.setVar( "action", "rg_update_confirmation_active" ); - mysack.setVar( "rg_update_confirmation_active", "" ); - mysack.setVar( "form_id", ); - mysack.setVar( "confirmation_id", confirmation_id); - mysack.setVar( "is_active", is_active ? 0 : 1); - mysack.onError = function() { alert('' )}; - mysack.runAJAX(); + prepare_items(); + ?> - return true; - } - +
    - prepare_items(); - ?> + display(); ?> - + + - display(); ?> + - - +
    - + + public static function confirmations_edit_page( $form_id, $confirmation_id ) { - - $confirmation = self::handle_confirmation_edit_submission( rgar($form["confirmations"], $confirmation_id), $form ); + + - + -
    +
    -
    + - - -
    + + +
    - + - - - " /> - + + + + -

    - -

    +

    + +

    - + -
    + -
    +
    -
    - +
    '; - $subsetting_close = ' + $subsetting_close = '
    '; - $ui_settings = array(); - $confirmation_type = rgar($confirmation, 'type') ? rgar($confirmation, 'type') : 'message'; - $is_valid = !empty(GFCommon::$errors); - $is_default = rgar($confirmation, 'isDefault'); + $ui_settings = array(); + $confirmation_type = rgar( $confirmation, 'type' ) ? rgar( $confirmation, 'type' ) : 'message'; + $is_valid = ! empty( GFCommon::$errors ); + $is_default = rgar( $confirmation, 'isDefault' ); + + $form_id = rgget( 'id' ); + $form = RGFormsModel::get_form_meta( $form_id ); + + ob_start(); ?> + + + + class=""> + + + + + + + + + + + + value="message" onclick="ToggleConfirmation();" /> + +    + value="page" onclick="ToggleConfirmation();" /> + +    + value="redirect" onclick="ToggleConfirmation();" /> + + + + + + + > + + + + + false, 'editor_class' => 'merge-tag-support mt-wp_editor mt-manual_position mt-position-right' ) ); + } else { + ?> + +
    + /> + +
    + + + + + + + + class=""> + + + + 'form_confirmation_page', 'selected' => rgar( $confirmation, 'pageId' ), 'show_option_none' => __( 'Select a page', 'gravityforms' ) ) ); ?> + + + + + + class=""> + + + + onclick="TogglePageQueryString()" /> + + +
    > +
    + +
    +
    + + + + + + + > + + + + + + + + + + + > + + + + onclick="ToggleQueryString()" /> + + +
    > +
    + +
    +
    + + + + + + + > + + + + +
    + +
    + + + + + + - ob_start(); ?> +
    +

    + ID: : +

    + - - class=""> - - - - + +
    +
      + $tab['name'] ); + if ( isset( $tab['query'] ) ) + $query = array_merge( $query, $tab['query'] ); - - - - value="message" onclick="ToggleConfirmation();" /> - -    - value="page" onclick="ToggleConfirmation();" /> - -    - value="redirect" onclick="ToggleConfirmation();" /> - - - - + ?> +
    • > + +
    • + +
    +
    +
    - > - - - - -
    - /> - -
    - - - - + +
    + +
    + +
    + - - class=""> - - - - "form_confirmation_page", "selected" => rgar($confirmation, 'pageId'), "show_option_none" => __("Select a page", "gravityforms"))); ?> - - - - +
    - class=""> - - - - onclick="TogglePageQueryString()"/> -
    > -
    -
    -
    - - - - - - - > - - - - " style="width:98%;" /> - - - - +
    + - > - - - - onclick="ToggleQueryString()"/> -
    > -
    -
    -
    - - - - + > - - - -
    - -
    - - - + $setting_tabs = array( + '10' => array( 'name' => 'settings', 'label' => __( 'Form Settings', 'gravityforms' ) ), + '20' => array( 'name' => 'confirmation', 'label' => __( 'Confirmations', 'gravityforms' ), 'query' => array( 'cid' => null, 'duplicatedcid' => null ) ), + '30' => array( 'name' => 'notification', 'label' => __( 'Notifications', 'gravityforms' ), 'query' => array( 'nid' => null ) ) + ); + $setting_tabs = apply_filters( 'gform_form_settings_menu', $setting_tabs, $form_id ); + ksort( $setting_tabs, SORT_NUMERIC ); - + // if is default confirmation, override any submitted conditional logic with empty array + $confirmation['conditionalLogic'] = $confirmation['isDefault'] ? array() : json_decode( rgpost( 'conditional_logic' ), ARRAY_A ); -
    -

    ID: :

    + $failed_validation = false; - + if ( ! $confirmation['name'] ) { + $failed_validation = true; + GFCommon::add_error_message( __( 'You must specify a Confirmation Name.', 'gravityforms' ) ); + } - + switch ( $confirmation['type'] ) { + case 'page': + if ( empty( $confirmation['pageId'] ) ) { + $failed_validation = true; + GFCommon::add_error_message( __( 'You must select a Confirmation Page.', 'gravityforms' ) ); + } + break; + case 'redirect': + if ( empty( $confirmation['url'] ) || ! GFCommon::is_valid_url( $confirmation['url'] ) ) { + $failed_validation = true; + GFCommon::add_error_message( __( 'You must specify a valid Redirect URL.', 'gravityforms' ) ); + } + break; + } -
    -
      - $tab["name"]); - if(isset($tab["query"])) - $query = array_merge($query, $tab["query"]); + if ( $failed_validation ) + return $confirmation; - ?> -
    • > - -
    • - -
    + // allow user to filter confirmation before save + $confirmation = apply_filters( "gform_pre_confirmation_save_{$form['id']}", apply_filters( 'gform_pre_confirmation_save', $confirmation, $form, $is_new_confirmation ), $form, $is_new_confirmation ); -
    -
    + // trim values + $confirmation = GFFormsModel::trim_conditional_logic_values_from_element( $confirmation, $form ); - -
    -
    -
    + // save updated confirmations array + $result = GFFormsModel::save_form_confirmations( $form['id'], $form['confirmations'] ); -
    + if ( $result !== false ) { + GFCommon::add_message( sprintf( __( 'Confirmation saved successfully. %sBack to confirmations.%s', 'gravityforms' ), '', '' ) ); + } else { + GFCommon::add_error_message( __( 'There was an issue saving this confirmation.', 'gravityforms' ) ); + } -
    + return $confirmation; + } - + public static function maybe_process_confirmation_list_action() { - array("name" => "settings", "label" => __("Form Settings", "gravityforms")), - "20" => array("name" => "confirmation" , "label" => __("Confirmations", "gravityforms"), "query" => array("cid"=>null, "duplicatedcid"=>null)), - "30" => array("name" => "notification", "label" => __("Notifications", "gravityforms"), "query" => array("nid"=>null)) - ); + switch ( $action ) { + case 'delete': + $confirmation_deleted = self::delete_confirmation( $object_id, rgget( 'id' ) ); + if ( $confirmation_deleted ) { + GFCommon::add_message( __( 'Confirmation deleted.', 'gravityforms' ) ); + } else { + GFCommon::add_error_message( __( 'There was an issue deleting this confirmation.', 'gravityforms' ) ); + } + break; + } - $setting_tabs = apply_filters("gform_form_settings_menu", $setting_tabs, $form_id); - ksort($setting_tabs, SORT_NUMERIC); + } - return $setting_tabs; - } + /** + * Delete a form confirmation by ID. + * + * @param mixed $confirmation_id + * @param mixed $form_id Can pass a form ID or a form object + * + * @return mixed The result of the database operation + */ + public static function delete_confirmation( $confirmation_id, $form_id ) { + if ( ! $form_id ) + return false; - /* Ajax Functions */ + $form = ! is_array( $form_id ) ? RGFormsModel::get_form_meta( $form_id ) : $form_id; - public static function handle_confirmation_edit_submission($confirmation, $form) { + do_action( 'gform_pre_confirmation_deleted', $form['confirmations'][ $confirmation_id ], $form ); - if( empty($_POST) || !check_admin_referer('gform_confirmation_edit', 'gform_confirmation_edit') ) - return $confirmation; + unset( $form['confirmations'][ $confirmation_id ] ); - $is_new_confirmation = !$confirmation; + // clear form cache so next retrieval of form meta will reflect deleted notification + RGFormsModel::flush_current_forms(); - if($is_new_confirmation) - $confirmation['id'] = uniqid(); + return RGFormsModel::save_form_confirmations( $form['id'], $form['confirmations'] ); + } - $confirmation['name'] = rgpost('form_confirmation_name'); - $confirmation['type'] = rgpost('form_confirmation'); - $confirmation['message'] = rgpost('form_confirmation_message'); - $confirmation['disableAutoformat'] = rgpost('form_disable_autoformatting'); - $confirmation['pageId'] = rgpost('form_confirmation_page'); - $confirmation['url'] = rgpost('form_confirmation_url'); - $confirmation['queryString'] = '' != rgpost('form_redirect_querystring') ? rgpost('form_redirect_querystring') : rgpost('form_page_querystring'); - $confirmation['isDefault'] = rgpost('is_default'); + public static function output( $a ) { + echo $a; + } - // if is default confirmation, override any submitted conditional logic with empty array - $confirmation['conditionalLogic'] = $confirmation['isDefault'] ? array() : json_decode(rgpost('conditional_logic'), ARRAY_A); + public static function is_unique_name( $name, $confirmations ) { - $failed_validation = false; + foreach ( $confirmations as $confirmation ) { + if ( strtolower( rgar( $confirmation, 'name' ) ) == strtolower( $name ) ) + return false; + } - if(!$confirmation['name']) { - $failed_validation = true; - GFCommon::add_error_message(__('You must specify a Confirmation Name.', 'gravityforms')); - } + return true; + } - switch($confirmation['type']) { - case 'page': - if(empty($confirmation['pageId'])) { - $failed_validation = true; - GFCommon::add_error_message( __('You must select a Confirmation Page.', 'gravityforms') ); - } - break; - case 'redirect': - if(empty($confirmation['url'])) { - $failed_validation = true; - GFCommon::add_error_message( __('You must specify a Redirect URL.', 'gravityforms') ); - } - break; - } + public static function output_field_scripts( $echo = true ){ + $script_str = ''; + $conditional_logic_fields = array(); - if($failed_validation) - return $confirmation; + foreach ( GF_Fields::get_all() as $gf_field ) { + if ( $gf_field->is_conditional_logic_supported() ) { + $conditional_logic_fields[] = $gf_field->type; + } - // allow user to filter confirmation before save - $confirmation = apply_filters("gform_pre_confirmation_save_{$form['id']}", apply_filters('gform_pre_confirmation_save', $confirmation, $form), $form); + } - // trim values - $confirmation = GFFormsModel::trim_conditional_logic_values_from_element($confirmation, $form); + $script_str .= sprintf( 'function GetConditionalLogicFields(){return %s;}', json_encode( $conditional_logic_fields ) ) . PHP_EOL; - // add current confirmation to confirmations array - $form['confirmations'][$confirmation['id']] = $confirmation; + if ( ! empty( $script_str ) && $echo ){ + echo $script_str; + } - // save updated confirmations array - $result = GFFormsModel::save_form_confirmations($form['id'], $form['confirmations']); + return $script_str; + } - if($result !== false) { - GFCommon::add_message( sprintf( __('Confirmation saved successfully. %sBack to confirmations.%s', 'gravityforms'), '', '') ); - } else { - GFCommon::add_error_message(__('There was an issue saving this confirmation.', 'gravityforms')); - } + public static function activate_save( $form ) { - return $confirmation; - } + $form_id = $form['id']; - public static function maybe_process_confirmation_list_action() { + $has_save_notification = false; + foreach ( $form['notifications'] as $notification ) { + if ( rgar( $notification, 'event' ) == 'form_save_email_requested' ) { + $has_save_notification = true; + break; + } + } + if ( ! $has_save_notification ) { + $notification_id = uniqid(); + $form['notifications'][ $notification_id ] = array( + 'id' => $notification_id, + 'isDefault' => true, + 'name' => __( 'Save and Continue Email', 'gravityforms' ), + 'event' => 'form_save_email_requested', + 'toType' => 'hidden', + 'from' => '{admin_email}', + 'subject' => __( 'Link to continue {form_title}' ), + 'message' => __( 'Thank you for saving {form_title}. Please use the unique link below to return to the form from any computer.

    {save_link}

    Remember that the link will expire after 30 days so please return via the provided link to complete your form submission.', 'gravityforms' ), + ); + GFFormsModel::save_form_notifications( $form_id, $form['notifications'] ); + } - if( empty($_POST) || !check_admin_referer('gform_confirmation_list_action', 'gform_confirmation_list_action') ) - return; - $action = rgpost('action'); - $object_id = rgpost('action_argument'); + $has_save_confirmation = false; + foreach ( $form['confirmations'] as $confirmation ) { + if ( rgar( $confirmation, 'event' ) == 'form_saved' ) { + $has_save_confirmation = true; + break; + } + } - switch($action) { - case 'delete': - $confirmation_deleted = self::delete_confirmation($object_id, rgget('id')); - if($confirmation_deleted) { - GFCommon::add_message( __('Confirmation deleted.', 'gravityforms') ); - } else { - GFCommon::add_error_message( __('There was an issue deleting this confirmation.', 'gravityforms') ); - } - break; - } + if ( ! $has_save_confirmation ) { + $confirmation_id = uniqid(); + $form['confirmations'][ $confirmation_id ] = array( + 'id' => $confirmation_id, + 'event' => 'form_saved', + 'name' => __( 'Save and Continue Confirmation', 'gravityforms' ), + 'isDefault' => true, + 'type' => 'message', + 'message' => __( 'Please use the following link to return to your form from any computer.
    {save_link}
    This link will expire after 30 days.
    Enter your email address to send the link by email.
    {save_email_input}', 'gravityforms' ), + 'url' => '', + 'pageId' => '', + 'queryString' => '', + ); + $confirmation_id = uniqid(); + $form['confirmations'][ $confirmation_id ] = array( + 'id' => $confirmation_id, + 'event' => 'form_save_email_sent', + 'name' => __( 'Save and Continue Email Sent Confirmation', 'gravityforms' ), + 'isDefault' => true, + 'type' => 'message', + 'message' => __( 'The link was sent to the following email address: {save_email}', 'gravityforms' ), + 'url' => '', + 'pageId' => '', + 'queryString' => '', + ); + GFFormsModel::save_form_confirmations( $form_id, $form['confirmations'] ); + } + return $form; + } - } + public static function deactivate_save( $form ) { - /** - * Delete a form confirmation by ID. - * - * @param mixed $confirmation_id - * @param mixed $form_id Can pass a form ID or a form object - */ - public static function delete_confirmation($confirmation_id, $form_id) { + $form_id = $form['id']; - if(!$form_id) - return false; + foreach ( $form['notifications'] as $notification_id => $notification ) { + if ( rgar( $notification, 'isDefault' ) && rgar( $notification, 'event' ) == 'form_save_email_requested' ) { + unset( $form['notifications'][ $notification_id ] ); + GFFormsModel::save_form_notifications( $form_id, $form['notifications'] ); + break; + } + } - $form = !is_array($form_id) ? RGFormsModel::get_form_meta($form_id) : $form_id; - unset($form['confirmations'][$confirmation_id]); - - // clear form cache so next retrieval of form meta will reflect deleted notification - RGFormsModel::flush_current_forms(); - - return RGFormsModel::save_form_confirmations($form['id'], $form['confirmations']); - } - - public static function output($a) { - echo $a; - } - - public static function is_unique_name($name, $confirmations){ - - foreach ($confirmations as $confirmation){ - if(strtolower(rgar($confirmation, "name")) == strtolower($name)) - return false; - } - - return true; - } + $changed = false; + foreach ( $form['confirmations'] as $confirmation_id => $confirmation ) { + $event = rgar( $confirmation, 'event' ); + if ( rgar( $confirmation, 'isDefault' ) && ( $event == 'form_saved' || $event == 'form_save_email_sent' ) ) { + unset( $form['confirmations'][ $confirmation_id ] ); + $changed = true; + } + } + if ( $changed ) { + GFFormsModel::save_form_confirmations( $form_id, $form['confirmations'] ); + } + return $form; + } } - -require_once(ABSPATH . '/wp-admin/includes/class-wp-list-table.php'); +require_once( ABSPATH . '/wp-admin/includes/class-wp-list-table.php' ); class GFConfirmationTable extends WP_List_Table { - public $form; + public $form; + + function __construct( $form ) { + + $this->form = $form; + + $this->_column_headers = array( + array( + 'cb' => '', + 'name' => __( 'Name', 'gravityforms' ), + 'type' => __( 'Type', 'gravityforms' ), + 'content' => __( 'Content', 'gravityforms' ) + ), + array(), + array(), + ); + + parent::__construct(); + } + + function prepare_items() { + $this->items = $this->form['confirmations']; + } + + function display() { + $singular = rgar( $this->_args, 'singular' ); + ?> + + + + print_column_headers(); ?> + + + + + + print_column_headers( false ); ?> + + + + > + + display_rows_or_placeholder(); ?> + + +
    + + '; + echo $this->single_row_columns( $item ); + echo ''; + } + + function column_content( $item ) { + return self::get_column_content( $item ); + } + + function column_default( $item, $column ) { + echo rgar( $item, $column ); + } + + function column_type( $item ) { + return self::get_column_type( $item ); + } + + function column_cb( $item ) { + if ( isset( $item['isDefault'] ) && $item['isDefault'] ) + return; + + $is_active = isset( $item['isActive'] ) ? $item['isActive'] : true; + ?> + <?php $is_active ? __( 'Active', 'gravityforms' ) : __( 'Inactive', 'gravityforms' ); ?> + $item['id'] ) ); + $duplicate_url = add_query_arg( array( 'cid' => 0, 'duplicatedcid' => $item['id'] ) ); + $actions = apply_filters( + 'gform_confirmation_actions', array( + 'edit' => '' . __( 'Edit', 'gravityforms' ) . '', + 'duplicate' => '' . __( 'Duplicate', 'gravityforms' ) . '', + 'delete' => '' . __( 'Delete', 'gravityforms' ) . '' + ) + ); + + if ( isset( $item['isDefault'] ) && $item['isDefault'] ){ + unset( $actions['delete'] ); + } + - function __construct($form) { + ?> - $this->form = $form; + +
    - $this->_column_headers = array( - array( - 'cb' => '', - 'name' => __('Name','gravityforms'), - 'type' => __('Type','gravityforms'), - 'content' => __('Content','gravityforms') - ), - array(), - array() - ); - - parent::__construct(); - } - - function prepare_items() { - $this->items = $this->form['confirmations']; - } - - function display() { - //extract( $this->_args ); - - $singular = $this->_args['singular']; - - ?> - - - - print_column_headers(); ?> - - - - - - print_column_headers( false ); ?> - - - - > - - display_rows_or_placeholder(); ?> - - -
    - - '; - echo $this->single_row_columns( $item ); - echo ''; - } - - function column_content($item) { - return self::get_column_content($item); - } - - function column_default($item, $column) { - echo rgar($item, $column); - } - - function column_type($item) { - return self::get_column_type($item); - } - - function column_cb($item) { - if(isset($item['isDefault']) && $item['isDefault']) - return; - - $is_active = isset($item["isActive"]) ? $item["isActive"] : true; - ?> - <?php $is_active ? __(" title="" onclick="ToggleActive(this, ''); " /> - $item["id"])); - $duplicate_url = add_query_arg(array("cid" => 0, "duplicatedcid" => $item["id"])); - $actions = apply_filters('gform_confirmation_actions', array( - 'edit' => '' . __('Edit', 'gravityforms') . '', - 'duplicate' => '' . __('Duplicate', 'gravityforms') . '', - 'delete' => '' . __('Delete', 'gravityforms') . '' - )); - - if(isset($item['isDefault']) && $item['isDefault']) - unset($actions['delete']); - - ?> - - -
    - - $html) { - $divider = $key == $last_key ? '' : " | "; - ?> - + $html ) { + $divider = $key == $last_key ? '' : ' | '; + ?> + - - -
    - - ' . strip_tags($item['message']) . ''; - - case 'page': - - $page = get_post($item['pageId']); - if(empty($page)) - return __('This page does not exist.', 'gravityforms'); - - return '' . $page->post_title . ''; - - case 'redirect': - $url_pieces = parse_url($item['url']); - $url_connector = rgar($url_pieces, 'query') ? '&' : '?'; - $url = rgar($item, 'queryString') ? "{$item['url']}{$url_connector}{$item['queryString']}" : $item['url']; - return '' . $url . ''; - } - - return ''; - } - - public static function get_column_type($item) { - switch($item['type']) { - case 'message': - $type = __('Text', 'gravityforms'); - break; - case 'page': - $type = __('Page', 'gravityforms'); - break; - case 'redirect': - $type = __('Redirect', 'gravityforms'); - break; - } - return $type; - } + + +
    + + ' . strip_tags( $item['message'] ) . ''; + + case 'page': + + $page = get_post( $item['pageId'] ); + if ( empty( $page ) ) + return __( 'This page does not exist.', 'gravityforms' ); + + return '' . $page->post_title . ''; + + case 'redirect': + $url_pieces = parse_url( $item['url'] ); + $url_connector = rgar( $url_pieces, 'query' ) ? '&' : '?'; + $url = rgar( $item, 'queryString' ) ? "{$item['url']}{$url_connector}{$item['queryString']}" : $item['url']; + + return '' . $url . ''; + } + + return ''; + } + + public static function get_column_type( $item ) { + switch ( $item['type'] ) { + case 'message': + $type = __( 'Text', 'gravityforms' ); + break; + case 'page': + $type = __( 'Page', 'gravityforms' ); + break; + case 'redirect': + $type = __( 'Redirect', 'gravityforms' ); + break; + } + return $type; + } } \ No newline at end of file diff --git a/forms_model.php b/forms_model.php index 56c2d4f..4c73240 100644 --- a/forms_model.php +++ b/forms_model.php @@ -1,3003 +1,3099 @@ prefix . "rg_form"; - } + public static function get_form_table_name() { + global $wpdb; - public static function get_meta_table_name(){ - global $wpdb; - return $wpdb->prefix . "rg_form_meta"; - } + return $wpdb->prefix . 'rg_form'; + } - public static function get_form_view_table_name(){ - global $wpdb; - return $wpdb->prefix . "rg_form_view"; - } + public static function get_meta_table_name() { + global $wpdb; - public static function get_lead_table_name(){ - global $wpdb; - return $wpdb->prefix . "rg_lead"; - } + return $wpdb->prefix . 'rg_form_meta'; + } - public static function get_lead_meta_table_name(){ - global $wpdb; - return $wpdb->prefix . "rg_lead_meta"; - } + public static function get_form_view_table_name() { + global $wpdb; - public static function get_lead_notes_table_name(){ - global $wpdb; - return $wpdb->prefix . "rg_lead_notes"; - } + return $wpdb->prefix . 'rg_form_view'; + } - public static function get_lead_details_table_name(){ - global $wpdb; - return $wpdb->prefix . "rg_lead_detail"; - } + public static function get_lead_table_name() { + global $wpdb; - public static function get_lead_details_long_table_name(){ - global $wpdb; - return $wpdb->prefix . "rg_lead_detail_long"; - } + return $wpdb->prefix . 'rg_lead'; + } - public static function get_lead_view_name(){ - global $wpdb; - return $wpdb->prefix . "rg_lead_view"; - } + public static function get_lead_meta_table_name() { + global $wpdb; - public static function get_forms($is_active = null, $sort_column = "title", $sort_dir = "ASC", $is_trash = false){ - global $wpdb; - $form_table_name = self::get_form_table_name(); - $lead_table_name = self::get_lead_table_name(); - $view_table_name = self::get_form_view_table_name(); + return $wpdb->prefix . 'rg_lead_meta'; + } + + public static function get_lead_notes_table_name() { + global $wpdb; + + return $wpdb->prefix . 'rg_lead_notes'; + } + + public static function get_lead_details_table_name() { + global $wpdb; + + return $wpdb->prefix . 'rg_lead_detail'; + } + + public static function get_lead_details_long_table_name() { + global $wpdb; + + return $wpdb->prefix . 'rg_lead_detail_long'; + } + + public static function get_lead_view_name() { + global $wpdb; + + return $wpdb->prefix . 'rg_lead_view'; + } + + public static function get_incomplete_submissions_table_name() { + global $wpdb; + + return $wpdb->prefix . 'rg_incomplete_submissions'; + } - $where_arr = array(); - $where_arr[] = $wpdb->prepare("is_trash=%d", $is_trash); - if($is_active !== null) - $where_arr[] = $wpdb->prepare("is_active=%d", $is_active); + public static function get_forms( $is_active = null, $sort_column = 'title', $sort_dir = 'ASC', $is_trash = false ) { + global $wpdb; + $form_table_name = self::get_form_table_name(); + $lead_table_name = self::get_lead_table_name(); + $view_table_name = self::get_form_view_table_name(); + + $where_arr = array(); + $where_arr[] = $wpdb->prepare( 'is_trash=%d', $is_trash ); + if ( $is_active !== null ) { + $where_arr[] = $wpdb->prepare( 'is_active=%d', $is_active ); + } - $where_clause = "WHERE " . join(" AND ", $where_arr); - $sort_keyword = $sort_dir == "ASC" ? "ASC" : "DESC"; - $sort_column = ESC_SQL($sort_column); - $order_by = !empty($sort_column) ? "ORDER BY $sort_column $sort_keyword" : ""; + $where_clause = 'WHERE ' . join( ' AND ', $where_arr ); + $sort_keyword = $sort_dir == 'ASC' ? 'ASC' : 'DESC'; + $sort_column = ESC_SQL( $sort_column ); + $order_by = ! empty( $sort_column ) ? "ORDER BY $sort_column $sort_keyword" : ''; - $sql = "SELECT f.id, f.title, f.date_created, f.is_active, 0 as lead_count, 0 view_count + $sql = "SELECT f.id, f.title, f.date_created, f.is_active, 0 as lead_count, 0 view_count FROM $form_table_name f $where_clause $order_by"; - //Getting all forms - $forms = $wpdb->get_results($sql); + //Getting all forms + $forms = $wpdb->get_results( $sql ); - //Getting entry count per form - $sql = "SELECT form_id, count(id) as lead_count FROM $lead_table_name l WHERE status='active' GROUP BY form_id"; - $entry_count = $wpdb->get_results($sql); + //Getting entry count per form + $sql = "SELECT form_id, count(id) as lead_count FROM $lead_table_name l WHERE status='active' GROUP BY form_id"; + $entry_count = $wpdb->get_results( $sql ); - //Getting view count per form - $sql = "SELECT form_id, sum(count) as view_count FROM $view_table_name GROUP BY form_id"; - $view_count = $wpdb->get_results($sql); + //Getting view count per form + $sql = "SELECT form_id, sum(count) as view_count FROM $view_table_name GROUP BY form_id"; + $view_count = $wpdb->get_results( $sql ); - //Adding entry counts and to form array - foreach($forms as &$form){ - foreach($view_count as $count){ - if($count->form_id == $form->id){ - $form->view_count = $count->view_count; - break; - } - } + //Adding entry counts and to form array + foreach ( $forms as &$form ) { + foreach ( $view_count as $count ) { + if ( $count->form_id == $form->id ) { + $form->view_count = $count->view_count; + break; + } + } - foreach($entry_count as $count){ - if($count->form_id == $form->id){ - $form->lead_count = $count->lead_count; - break; - } - } - } + foreach ( $entry_count as $count ) { + if ( $count->form_id == $form->id ) { + $form->lead_count = $count->lead_count; + break; + } + } + } - return $forms; - } + return $forms; + } - public static function get_forms_by_id($ids){ - _deprecated_function('get_forms_by_id', '1.7', 'get_form_meta_by_id'); - return self::get_form_meta_by_id($ids); - } + public static function get_forms_by_id( $ids ) { + _deprecated_function( 'get_forms_by_id', '1.7', 'get_form_meta_by_id' ); - public static function get_form_payment_totals($form_id){ - global $wpdb; - $lead_table_name = self::get_lead_table_name(); + return self::get_form_meta_by_id( $ids ); + } - $sql = $wpdb->prepare(" SELECT sum(payment_amount) revenue, count(l.id) orders + public static function get_form_payment_totals( $form_id ) { + global $wpdb; + $lead_table_name = self::get_lead_table_name(); + + $sql = $wpdb->prepare( + " SELECT sum(payment_amount) revenue, count(l.id) orders FROM $lead_table_name l - WHERE form_id=%d AND payment_amount IS NOT null", $form_id); + WHERE form_id=%d AND payment_amount IS NOT null", $form_id + ); - $totals = $wpdb->get_row($sql, ARRAY_A); + $totals = $wpdb->get_row( $sql, ARRAY_A ); - $active = $wpdb->get_var($wpdb->prepare(" SELECT count(id) as active + $active = $wpdb->get_var( + $wpdb->prepare( + " SELECT count(id) as active FROM $lead_table_name - WHERE form_id=%d AND payment_status='Active'", $form_id)); + WHERE form_id=%d AND payment_status='Active'", $form_id + ) + ); - if(empty($active)) - $active = 0; + if ( empty( $active ) ) { + $active = 0; + } - $totals["active"] = $active; + $totals['active'] = $active; - return $totals; - } + return $totals; + } - public static function get_form_counts($form_id){ - global $wpdb; - $lead_table_name = self::get_lead_table_name(); - $sql = $wpdb->prepare( - "SELECT + public static function get_form_counts( $form_id ) { + global $wpdb; + $lead_table_name = self::get_lead_table_name(); + $sql = $wpdb->prepare( + "SELECT (SELECT count(0) FROM $lead_table_name WHERE form_id=%d AND status='active') as total, (SELECT count(0) FROM $lead_table_name WHERE is_read=0 AND status='active' AND form_id=%d) as unread, (SELECT count(0) FROM $lead_table_name WHERE is_starred=1 AND status='active' AND form_id=%d) as starred, (SELECT count(0) FROM $lead_table_name WHERE status='spam' AND form_id=%d) as spam, (SELECT count(0) FROM $lead_table_name WHERE status='trash' AND form_id=%d) as trash", - $form_id, $form_id, $form_id, $form_id, $form_id); + $form_id, $form_id, $form_id, $form_id, $form_id + ); - $results = $wpdb->get_results($sql, ARRAY_A); + $results = $wpdb->get_results( $sql, ARRAY_A ); - return $results[0]; + return $results[0]; - } + } - public static function get_form_summary(){ - global $wpdb; - $form_table_name = self::get_form_table_name(); - $lead_table_name = self::get_lead_table_name(); + public static function get_form_summary() { + global $wpdb; + $form_table_name = self::get_form_table_name(); + $lead_table_name = self::get_lead_table_name(); - $sql = "SELECT l.form_id, count(l.id) as unread_count + $sql = "SELECT l.form_id, count(l.id) as unread_count FROM $lead_table_name l WHERE is_read=0 AND status='active' GROUP BY form_id"; - //getting number of unread and total leads for all forms - $unread_results = $wpdb->get_results($sql, ARRAY_A); + //getting number of unread and total leads for all forms + $unread_results = $wpdb->get_results( $sql, ARRAY_A ); - $sql = "SELECT l.form_id, max(l.date_created) as last_lead_date, count(l.id) as total_leads + $sql = "SELECT l.form_id, max(l.date_created) as last_lead_date, count(l.id) as total_leads FROM $lead_table_name l WHERE status='active' GROUP BY form_id"; - $lead_date_results = $wpdb->get_results($sql, ARRAY_A); + $lead_date_results = $wpdb->get_results( $sql, ARRAY_A ); - $sql = "SELECT id, title, '' as last_lead_date, 0 as unread_count + $sql = "SELECT id, title, '' as last_lead_date, 0 as unread_count FROM $form_table_name WHERE is_active=1 ORDER BY title"; - $forms = $wpdb->get_results($sql, ARRAY_A); + $forms = $wpdb->get_results( $sql, ARRAY_A ); - for($i=0; $count = sizeof($forms), $i<$count; $i++){ - if(is_array($unread_results)){ - foreach($unread_results as $unread_result){ - if($unread_result["form_id"] == $forms[$i]["id"]){ - $forms[$i]["unread_count"] = $unread_result["unread_count"]; - break; - } - } - } - - if(is_array($lead_date_results)){ - foreach($lead_date_results as $lead_date_result){ - if($lead_date_result["form_id"] == $forms[$i]["id"]){ - $forms[$i]["last_lead_date"] = $lead_date_result["last_lead_date"]; - $forms[$i]["total_leads"] = $lead_date_result["total_leads"]; - break; - } - } - } - - } + for ( $i = 0; $count = sizeof( $forms ), $i < $count; $i ++ ) { + if ( is_array( $unread_results ) ) { + foreach ( $unread_results as $unread_result ) { + if ( $unread_result['form_id'] == $forms[ $i ]['id'] ) { + $forms[ $i ]['unread_count'] = $unread_result['unread_count']; + break; + } + } + } + + if ( is_array( $lead_date_results ) ) { + foreach ( $lead_date_results as $lead_date_result ) { + if ( $lead_date_result['form_id'] == $forms[ $i ]['id'] ) { + $forms[ $i ]['last_lead_date'] = $lead_date_result['last_lead_date']; + $forms[ $i ]['total_leads'] = $lead_date_result['total_leads']; + break; + } + } + } + } - return $forms; - } + return $forms; + } - public static function get_form_count(){ - global $wpdb; - $form_table_name = self::get_form_table_name(); - $results = $wpdb->get_results(" + public static function get_form_count() { + global $wpdb; + $form_table_name = self::get_form_table_name(); + $results = $wpdb->get_results( + " SELECT (SELECT count(0) FROM $form_table_name WHERE is_trash = 0) as total, (SELECT count(0) FROM $form_table_name WHERE is_active=1 AND is_trash = 0 ) as active, (SELECT count(0) FROM $form_table_name WHERE is_active=0 AND is_trash = 0 ) as inactive, (SELECT count(0) FROM $form_table_name WHERE is_trash=1) as trash - "); + " + ); + + return array( + 'total' => intval( $results[0]->total ), + 'active' => intval( $results[0]->active ), + 'inactive' => intval( $results[0]->inactive ), + 'trash' => intval( $results[0]->trash ) + ); + } - return array( "total" => intval($results[0]->total), - "active" => intval($results[0]->active), - "inactive" => intval($results[0]->inactive), - "trash" => intval($results[0]->trash) - ); - } + public static function get_form_id( $form_title ) { + $forms = self::get_forms(); + foreach ( $forms as $form ) { + $sanitized_name = str_replace( '[', '', str_replace( ']', '', $form->title ) ); + if ( $form->title == $form_title || $sanitized_name == $form_title ) { + return $form->id; + } + } - public static function get_form_id($form_title){ - $forms = self::get_forms(); - foreach($forms as $form){ - $sanitized_name = str_replace("[", "", str_replace("]","", $form->title)); - if($form->title == $form_title || $sanitized_name == $form_title) - return $form->id; - } - return 0; - } + return 0; + } - public static function get_form($form_id, $allow_trash = false){ - global $wpdb; - $table_name = self::get_form_table_name(); - $trash_clause = $allow_trash ? "" : "AND is_trash = 0"; - $results = $wpdb->get_results($wpdb->prepare("SELECT * FROM $table_name WHERE id=%d {$trash_clause}", $form_id)); - return isset($results[0]) ? $results[0] : false; - } + public static function get_form( $form_id, $allow_trash = false ) { + global $wpdb; + $table_name = self::get_form_table_name(); + $trash_clause = $allow_trash ? '' : 'AND is_trash = 0'; + $results = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $table_name WHERE id=%d {$trash_clause}", $form_id ) ); - public static function unserialize($string){ + return isset( $results[0] ) ? $results[0] : false; + } - if(is_serialized($string)){ - $obj = @unserialize($string); - } - else{ - $obj = json_decode($string, true); - } + public static function unserialize( $string ) { - return $obj; - } + if ( is_serialized( $string ) ) { + $obj = @unserialize( $string ); + } else { + $obj = json_decode( $string, true ); + } - public static function get_form_meta($form_id){ - global $wpdb; + return $obj; + } - // return cached version if form meta has been previously retrieved for this form - if(isset(self::$_current_forms[$form_id])){ - return self::$_current_forms[$form_id]; + public static function get_form_meta( $form_id ) { + global $wpdb; + + // return cached version if form meta has been previously retrieved for this form + if ( isset( self::$_current_forms[ $form_id ] ) ) { + return self::$_current_forms[ $form_id ]; } - $table_name = self::get_meta_table_name(); - $form_row = $wpdb->get_row($wpdb->prepare("SELECT display_meta, notifications FROM {$table_name} WHERE form_id=%d", $form_id), ARRAY_A); + $table_name = self::get_meta_table_name(); + $form_row = $wpdb->get_row( $wpdb->prepare( "SELECT display_meta, notifications FROM {$table_name} WHERE form_id=%d", $form_id ), ARRAY_A ); - //Loading main form object (supports serialized strings as well as JSON strings) - $form = self::unserialize($form_row["display_meta"]); + //Loading main form object (supports serialized strings as well as JSON strings) + $form = self::unserialize( $form_row['display_meta'] ); - if(!$form) - return null; + if ( ! $form ) { + return null; + } - //loading notifications - $form["notifications"] = self::unserialize($form_row["notifications"]); + //loading notifications + $form['notifications'] = self::unserialize( $form_row['notifications'] ); + //creating field objects and copying some form variables down to fields for easier access + $form = self::convert_field_objects( $form ); - //copying some form variables down to fields for easier access - $page_number = 1; - $description_placement = rgar($form, "descriptionPlacement") == "above" ? "above" : "below"; - if(is_array(rgar($form,"fields"))){ - foreach($form["fields"] as &$field){ - $field["label"] = !isset($field["label"]) ? "" : $field["label"]; - $field["formId"] = $form["id"]; - $field["pageNumber"] = $page_number; - $field["descriptionPlacement"] = $description_placement; - if($field["type"] == "page"){ - $page_number++; - $field["pageNumber"] = $page_number; - } - } - } + // loading confirmations from legacy structure into new structure + $form = self::load_confirmations( $form ); + + //only migrate legacy notification if there isn't any notification configured in new structure + if ( ! isset( $form['notifications'] ) ) { + $form = self::load_notifications_from_legacy( $form ); //moving notification data from legacy structure into new 'notifications' array + } - // loading confirmations from legacy structure into new structure - $form = self::load_confirmations($form); + //load notifications to legacy structure to maintain backward compatibility with legacy hooks and functions + $form = self::load_notifications_to_legacy( $form ); - //only migrate legacy notification if there isn't any notification configured in new structure - if(!isset($form["notifications"])){ - $form = self::load_notifications_from_legacy($form); //moving notification data from legacy structure into new "notifications" array - } + $form = apply_filters( 'gform_form_post_get_meta', $form ); - //load notifications to legacy structure to maintain backward compatibility with legacy hooks and functions - $form = self::load_notifications_to_legacy($form); + // cached form meta for cheaper retrieval on subsequent requests + self::$_current_forms[ $form_id ] = $form; - $form = apply_filters('gform_form_post_get_meta', $form); + return $form; + } - // cached form meta for cheaper retrieval on subsequent requests - self::$_current_forms[$form_id] = $form; + public static function convert_field_objects( $form ) { + $page_number = 1; + if ( is_array( rgar( $form, 'fields' ) ) ) { + foreach ( $form['fields'] as &$field ) { + $field = GF_Fields::create( $field ); + if ( isset( $form['id'] ) ) { + $field->formId = $form['id']; + } + $field->pageNumber = $page_number; + if ( $field->type == 'page' ) { + $page_number ++; + $field->pageNumber = $page_number; + } + } + } - return $form; - } + return $form; + } - public static function get_form_meta_by_id($ids){ - global $wpdb; - $form_table_name = self::get_form_table_name(); - $meta_table_name = self::get_meta_table_name(); + public static function get_form_meta_by_id( $ids ) { + global $wpdb; + $form_table_name = self::get_form_table_name(); + $meta_table_name = self::get_meta_table_name(); - if(is_array($ids)) - $ids = implode(",", array_map('intval', $ids ) ); - else - $ids = intval($ids); + if ( is_array( $ids ) ) { + $ids = implode( ',', array_map( 'intval', $ids ) ); + } else { + $ids = intval( $ids ); + } - $results = $wpdb->get_results(" SELECT display_meta, confirmations, notifications FROM {$form_table_name} f + $results = $wpdb->get_results( + " SELECT display_meta, confirmations, notifications FROM {$form_table_name} f INNER JOIN {$meta_table_name} m ON f.id = m.form_id - WHERE id in({$ids})", ARRAY_A); + WHERE id in({$ids})", ARRAY_A + ); + + foreach ( $results as &$result ) { + $form = self::unserialize( $result['display_meta'] ); + $form['confirmations'] = self::unserialize( $result['confirmations'] ); + $form['notifications'] = self::unserialize( $result['notifications'] ); + //creating field objects and copying some form variables down to fields for easier access + $form = self::convert_field_objects( $form ); + $result = $form; + } - foreach ($results as &$result) { - $form = self::unserialize($result["display_meta"]); - $form['confirmations'] = self::unserialize($result["confirmations"]); - $form['notifications'] = self::unserialize($result["notifications"]); - $result = $form; - } + return $results; - return $results; + } - } + private static function load_notifications_to_legacy( $form ) { + if ( ! is_array( rgar( $form, 'notifications' ) ) ) { + return $form; + } - private static function load_notifications_to_legacy($form){ - if(!is_array(rgar($form, "notifications"))) - return $form; + foreach ( $form['notifications'] as $notification ) { + if ( ! in_array( rgar( $notification, 'type' ), array( 'user', 'admin' ) ) ) { + continue; + } + + $legacy_notification = $notification; + + if ( $notification['toType'] == 'field' ) { + $legacy_notification['toField'] = $notification['to']; + unset( $legacy_notification['to'] ); + } + + //unsetting new properties + unset( $legacy_notification['toType'] ); + unset( $legacy_notification['id'] ); + unset( $legacy_notification['event'] ); + unset( $legacy_notification['name'] ); + if ( isset( $legacy_notification['type'] ) ) { + unset( $legacy_notification['type'] ); + } + + //saving into form object + $property = $notification['type'] == 'user' ? 'autoResponder' : 'notification'; + $form[ $property ] = $legacy_notification; + } - foreach($form["notifications"] as $notification){ - if(!in_array(rgar($notification,"type"), array("user", "admin"))) - continue; + return $form; + } - $legacy_notification = $notification; + private static function load_notifications_from_legacy( $form ) { - if($notification["toType"] == "field"){ - $legacy_notification["toField"] = $notification["to"]; - unset($legacy_notification["to"]); - } + $form['notifications'] = array(); + if ( GFCommon::has_admin_notification( $form ) ) { + $admin_notification = $form['notification']; - //unsetting new properties - unset($legacy_notification["toType"]); - unset($legacy_notification["id"]); - unset($legacy_notification["event"]); - unset($legacy_notification["name"]); - if(isset($legacy_notification["type"])) - unset($legacy_notification["type"]); - - //saving into form object - $property = $notification["type"] == "user" ? "autoResponder" : "notification"; - $form[$property] = $legacy_notification; - } + //if there is a fromField configured, move it to 'from' as a merge tag + $admin_notification = self::convert_property_to_merge_tag( $form, $admin_notification, 'from', 'fromField' ); - return $form; - } + //if there is a fromNameField configured, move it to 'fromName' as a merge tag + $admin_notification = self::convert_property_to_merge_tag( $form, $admin_notification, 'fromName', 'fromNameField' ); - private static function load_notifications_from_legacy($form){ + //if there is a replyToField configured, move it to 'replyTo' as a merge tag + $admin_notification = self::convert_property_to_merge_tag( $form, $admin_notification, 'replyTo', 'replyToField' ); - $form["notifications"] = array(); - if(GFCommon::has_admin_notification($form)){ - $admin_notification = $form["notification"]; + //if routing is configured, set toType to routing, otherwise, set it to email + $admin_notification['toType'] = ! rgempty( 'routing', $admin_notification ) ? 'routing' : 'email'; - //if there is a fromField configured, move it to "from" as a merge tag - $admin_notification = self::convert_property_to_merge_tag($form, $form["notification"], "from", "fromField"); + $notification_id = uniqid(); - //if there is a fromNameField configured, move it to "fromName" as a merge tag - $admin_notification = self::convert_property_to_merge_tag($form, $form["notification"], "fromName", "fromNameField"); + //assigning this notification to the form_submission action + $admin_notification['event'] = 'form_submission'; + $admin_notification['name'] = __( 'Admin Notification', 'gravityforms' ); + $admin_notification['type'] = 'admin'; + $admin_notification['id'] = $notification_id; - //if there is a replyToField configured, move it to "replyTo" as a merge tag - $admin_notification = self::convert_property_to_merge_tag($form, $form["notification"], "replyTo", "replyToField"); + //copying admin notification as an item in the new notifications array + $form['notifications'][ $notification_id ] = $admin_notification; + } - //if routing is configured, set toType to routing, otherwise, set it to email - $admin_notification["toType"] = !rgempty("routing", $admin_notification) ? "routing" : "email"; + if ( GFCommon::has_user_notification( $form ) ) { - $notification_id = uniqid(); + $user_notification = $form['autoResponder']; - //assigning this notification to the form_submission action - $admin_notification["event"] = "form_submission"; - $admin_notification["name"] = __("Admin Notification", "gravityforms"); - $admin_notification["type"] = "admin"; - $admin_notification["id"] = $notification_id; + //if there is a toField configured, set toType to field, if not, set it toemail + $to_field = rgar( $user_notification, 'toField' ); + if ( ! empty( $to_field ) ) { + $user_notification['toType'] = 'field'; + $user_notification['to'] = $to_field; + } else { + $user_notification['toType'] = 'email'; + } - //copying admin notification as an item in the new notifications array - $form["notifications"][$notification_id] = $admin_notification; - } + $notification_id = uniqid(); + //assigning this notification to the form_submission action + $user_notification['event'] = 'form_submission'; + $user_notification['name'] = __( 'User Notification', 'gravityforms' ); + $user_notification['type'] = 'user'; + $user_notification['id'] = $notification_id; - if(GFCommon::has_user_notification($form)){ + //copying user notification as an item in the new notifications array + $form['notifications'][ $notification_id ] = $user_notification; + } - $user_notification = $form["autoResponder"]; + self::save_form_notifications( $form['id'], $form['notifications'] ); - //if there is a toField configured, set toType to field, if not, set it toemail - $to_field = rgar($user_notification, "toField"); - if(!empty($to_field)){ - $user_notification["toType"] = "field"; - $user_notification["to"] = $to_field; - } - else{ - $user_notification["toType"] = "email"; - } + return $form; + } - $notification_id = uniqid(); - //assigning this notification to the form_submission action - $user_notification["event"] = "form_submission"; - $user_notification["name"] = __("User Notification", "gravityforms"); - $user_notification["type"] = "user"; - $user_notification["id"] = $notification_id; + private static function convert_property_to_merge_tag( $form, $array, $target_property, $source_property ) { + $merge_tag = self::get_field_merge_tag( $form, rgar( $array, $source_property ) ); + if ( $merge_tag ) { + $array[ $target_property ] = $merge_tag; + unset( $array[ $source_property ] ); + } - //copying user notification as an item in the new notifications array - $form["notifications"][$notification_id] = $user_notification; - } + return $array; + } - self::save_form_notifications($form["id"], $form["notifications"]); + private static function get_field_merge_tag( $form, $field_id ) { + $field = self::get_field( $form, $field_id ); + if ( ! $field ) { + return false; + } - return $form; - } + return '{' . GFCommon::get_label( $field, $field_id ) . ':' . $field_id . '}'; + } - private static function convert_property_to_merge_tag($form, $array, $target_property, $source_property){ - $merge_tag = self::get_field_merge_tag($form, rgar($array, $source_property)); - if($merge_tag){ - $array[$target_property] = $merge_tag; - unset($array[$source_property]); - } + public static function add_default_properties( $form ) { + _deprecated_function( 'GFFormsModel::add_default_properties', '1.9' ); + + if ( is_array( rgar( $form, 'fields' ) ) ) { + $all_fields = array( + 'adminLabel' => '', 'adminOnly' => '', 'allowsPrepopulate' => '', 'defaultValue' => '', 'description' => '', 'content' => '', 'cssClass' => '', + 'errorMessage' => '', 'id' => '', 'inputName' => '', 'isRequired' => '', 'label' => '', 'noDuplicates' => '', + 'size' => '', 'type' => '', 'postCustomFieldName' => '', 'displayAllCategories' => '', 'displayCaption' => '', 'displayDescription' => '', + 'displayTitle' => '', 'inputType' => '', 'rangeMin' => '', 'rangeMax' => '', 'calendarIconType' => '', + 'calendarIconUrl' => '', 'dateType' => '', 'dateFormat' => '', 'phoneFormat' => '', 'addressType' => '', 'defaultCountry' => '', 'defaultProvince' => '', + 'defaultState' => '', 'hideAddress2' => '', 'hideCountry' => '', 'hideState' => '', 'inputs' => '', 'nameFormat' => '', 'allowedExtensions' => '', + 'captchaType' => '', 'pageNumber' => '', 'captchaTheme' => '', 'simpleCaptchaSize' => '', 'simpleCaptchaFontColor' => '', 'simpleCaptchaBackgroundColor' => '', + 'failed_validation' => '', 'productField' => '', 'enablePasswordInput' => '', 'maxLength' => '', 'enablePrice' => '', 'basePrice' => '', + ); + + foreach ( $form['fields'] as &$field ) { + if ( is_array( $field ) ) { + $field = wp_parse_args( $field, $all_fields ); + } + } + } - return $array; - } + return $form; + } - private static function get_field_merge_tag($form, $field_id){ - $field = self::get_field($form, $field_id); - if(!$field) - return false; + public static function get_grid_column_meta( $form_id ) { + global $wpdb; - return "{" . GFCommon::get_label($field, $field_id) . ":" . $field_id . "}"; - } + $table_name = self::get_meta_table_name(); - public static function add_default_properties($form){ - if(is_array(rgar($form,"fields"))){ - $all_fields = array("adminLabel"=>"","adminOnly"=>"","allowsPrepopulate"=>"","defaultValue"=>"","description"=>"","content"=>"","cssClass"=>"", - "errorMessage"=>"","id"=>"","inputName"=>"","isRequired"=>"","label"=>"","noDuplicates"=>"", - "size"=>"","type"=>"","postCustomFieldName"=>"","displayAllCategories"=>"","displayCaption"=>"","displayDescription"=>"", - "displayTitle"=>"","inputType"=>"","rangeMin"=>"","rangeMax"=>"","calendarIconType"=>"", - "calendarIconUrl"=>"", "dateType"=>"","dateFormat"=>"","phoneFormat"=>"","addressType"=>"","defaultCountry"=>"","defaultProvince"=>"", - "defaultState"=>"","hideAddress2"=>"","hideCountry"=>"","hideState"=>"","inputs"=>"","nameFormat"=>"","allowedExtensions"=>"", - "captchaType"=>"","pageNumber"=>"","captchaTheme"=>"","simpleCaptchaSize"=>"","simpleCaptchaFontColor"=>"","simpleCaptchaBackgroundColor"=>"", - "failed_validation"=>"", "productField" => "", "enablePasswordInput" => "", "maxLength" => "", "enablePrice" => "", "basePrice" => ""); - - foreach($form["fields"] as &$field) - $field = wp_parse_args($field, $all_fields); - } - return $form; - } + return maybe_unserialize( $wpdb->get_var( $wpdb->prepare( "SELECT entries_grid_meta FROM $table_name WHERE form_id=%d", $form_id ) ) ); + } - public static function get_grid_column_meta($form_id){ - global $wpdb; + public static function update_grid_column_meta( $form_id, $columns ) { + global $wpdb; - $table_name = self::get_meta_table_name(); - return maybe_unserialize($wpdb->get_var($wpdb->prepare("SELECT entries_grid_meta FROM $table_name WHERE form_id=%d", $form_id))); - } + $table_name = self::get_meta_table_name(); + $meta = maybe_serialize( stripslashes_deep( $columns ) ); + $wpdb->query( $wpdb->prepare( "UPDATE $table_name SET entries_grid_meta=%s WHERE form_id=%d", $meta, $form_id ) ); + } - public static function update_grid_column_meta($form_id, $columns){ - global $wpdb; + public static function get_lead_detail_id( $current_fields, $field_number ) { + foreach ( $current_fields as $field ) { + if ( $field->field_number == $field_number ) { + return $field->id; + } + } - $table_name = self::get_meta_table_name(); - $meta = maybe_serialize(stripslashes_deep($columns) ); - $wpdb->query( $wpdb->prepare("UPDATE $table_name SET entries_grid_meta=%s WHERE form_id=%d", $meta, $form_id) ); - } + return 0; + } - public static function get_lead_detail_id($current_fields, $field_number){ - foreach($current_fields as $field) - if($field->field_number == $field_number) - return $field->id; + public static function update_form_active( $form_id, $is_active ) { + global $wpdb; + $form_table = self::get_form_table_name(); + $sql = $wpdb->prepare( "UPDATE $form_table SET is_active=%d WHERE id=%d", $is_active, $form_id ); + $wpdb->query( $sql ); - return 0; - } + if ( $is_active ) { + do_action( 'gform_post_form_activated', $form_id ); + } else { + do_action( 'gform_post_form_deactivated', $form_id ); + } + } - public static function update_form_active($form_id, $is_active){ - global $wpdb; - $form_table = self::get_form_table_name(); - $sql = $wpdb->prepare("UPDATE $form_table SET is_active=%d WHERE id=%d", $is_active, $form_id); - $wpdb->query($sql); - } + public static function update_notification_active( $form_id, $notification_id, $is_active ) { + $form = GFFormsModel::get_form_meta( $form_id ); - public static function update_notification_active($form_id, $notification_id, $is_active){ - $form = GFFormsModel::get_form_meta($form_id); + if ( ! isset( $form['notifications'][ $notification_id ] ) ) { + return new WP_Error( 'not_found', __( 'Notification not found', 'gravityforms' ) ); + } - if(!isset($form["notifications"][$notification_id])) - return new WP_Error("not_found", __("Notification not found", "gravityforms")); + $form['notifications'][ $notification_id ]['isActive'] = (bool) $is_active; - $form["notifications"][$notification_id]["isActive"] = (bool) $is_active; + if ( (bool) $is_active ) { + do_action( 'gform_pre_notification_activated', $form['notifications'][ $notification_id ], $form ); + } else { + do_action( 'gform_pre_notification_deactivated', $form['notifications'][ $notification_id ], $form ); + } - $result = GFFormsModel::update_form_meta($form_id, $form["notifications"], "notifications"); - return $result; - } + $result = GFFormsModel::update_form_meta( $form_id, $form['notifications'], 'notifications' ); - public static function update_confirmation_active($form_id, $confirmation_id, $is_active){ - $form = GFFormsModel::get_form_meta($form_id); + return $result; + } - if(!isset($form["confirmations"][$confirmation_id])) - return new WP_Error("not_found", __("Notification not found", "gravityforms")); + public static function update_confirmation_active( $form_id, $confirmation_id, $is_active ) { + $form = GFFormsModel::get_form_meta( $form_id ); - $form["confirmations"][$confirmation_id]["isActive"] = (bool) $is_active; + if ( ! isset( $form['confirmations'][ $confirmation_id ] ) ) { + return new WP_Error( 'not_found', __( 'Notification not found', 'gravityforms' ) ); + } - $result = GFFormsModel::update_form_meta($form_id, $form["confirmations"], "confirmations"); - return $result; - } + $form['confirmations'][ $confirmation_id ]['isActive'] = (bool) $is_active; - public static function update_forms_active($forms, $is_active){ - foreach($forms as $form_id) - self::update_form_active($form_id, $is_active); - } - public static function update_leads_property($leads, $property_name, $property_value){ - foreach($leads as $lead) - self::update_lead_property($lead, $property_name, $property_value); - } - public static function update_lead_property($lead_id, $property_name, $property_value, $update_akismet=true, $disable_hook=false){ - global $wpdb; - $lead_table = self::get_lead_table_name(); + $result = GFFormsModel::update_form_meta( $form_id, $form['confirmations'], 'confirmations' ); - $lead = self::get_lead($lead_id); + return $result; + } - //marking entry as "spam" or "not spam" with Akismet if the plugin is installed - if($update_akismet && GFCommon::akismet_enabled($lead["form_id"]) && $property_name == "status" && in_array($property_value, array("active", "spam"))){ + public static function update_forms_active( $forms, $is_active ) { + foreach ( $forms as $form_id ) { + self::update_form_active( $form_id, $is_active ); + } + } - $current_status = $lead["status"]; - if($current_status == "spam" && $property_value == "active"){ - $form = self::get_form_meta($lead["form_id"]); - GFCommon::mark_akismet_spam($form, $lead, false); - } - else if($current_status == "active" && $property_value == "spam"){ - $form = self::get_form_meta($lead["form_id"]); - GFCommon::mark_akismet_spam($form, $lead, true); - } - } + public static function update_leads_property( $leads, $property_name, $property_value ) { + foreach ( $leads as $lead ) { + self::update_lead_property( $lead, $property_name, $property_value ); + } + } - //updating lead - $result = $wpdb->update($lead_table, array($property_name => $property_value ), array("id" => $lead_id)); + public static function update_lead_property( $lead_id, $property_name, $property_value, $update_akismet = true, $disable_hook = false ) { + global $wpdb; + $lead_table = self::get_lead_table_name(); - if(!$disable_hook){ + $lead = self::get_lead( $lead_id ); - $previous_value = rgar($lead, $property_name); + //marking entry as 'spam' or 'not spam' with Akismet if the plugin is installed + if ( $update_akismet && GFCommon::akismet_enabled( $lead['form_id'] ) && $property_name == 'status' && in_array( $property_value, array( 'active', 'spam' ) ) ) { - if($previous_value != $property_value) { + $current_status = $lead['status']; + if ( $current_status == 'spam' && $property_value == 'active' ) { + $form = self::get_form_meta( $lead['form_id'] ); + GFCommon::mark_akismet_spam( $form, $lead, false ); + } else if ( $current_status == 'active' && $property_value == 'spam' ) { + $form = self::get_form_meta( $lead['form_id'] ); + GFCommon::mark_akismet_spam( $form, $lead, true ); + } + } - // if property is status, prev value is spam and new value is active - if($property_name == 'status' && $previous_value == 'spam' && $property_value == 'active' && !rgar($lead, 'post_id')) { - $lead[$property_name] = $property_value; - $lead['post_id'] = GFCommon::create_post($form, $lead); - } + //updating lead + $result = $wpdb->update( $lead_table, array( $property_name => $property_value ), array( 'id' => $lead_id ) ); - do_action("gform_update_{$property_name}", $lead_id, $property_value, $previous_value); - } - } + if ( ! $disable_hook ) { - return $result; - } + $previous_value = rgar( $lead, $property_name ); - public static function update_lead($lead){ + if ( $previous_value != $property_value ) { - _deprecated_function("GFFormsModel::update_lead()", "1.8.8", "GFAPI::update_entry()"); + // if property is status, prev value is spam and new value is active + if ( $property_name == 'status' && $previous_value == 'spam' && $property_value == 'active' && ! rgar( $lead, 'post_id' ) ) { + $lead[ $property_name ] = $property_value; + $lead['post_id'] = GFCommon::create_post( $form, $lead ); + } - global $wpdb; - $lead_table = self::get_lead_table_name(); - - $payment_date = strtotime(rgar($lead,"payment_date")) ? "'" . gmdate( 'Y-m-d H:i:s', strtotime("{$lead["payment_date"]}") ) . "'" : "NULL"; - $payment_amount = !rgblank(rgar($lead, "payment_amount")) ? (float) rgar($lead, "payment_amount") : "NULL"; - $transaction_type = !rgempty("transaction_type", $lead) ? intval($lead["transaction_type"]) : "NULL"; - - $status = !rgempty("status", $lead) ? $lead["status"] : "active"; - $source_url = self::truncate(rgar($lead,"source_url"), 200); - $user_agent = self::truncate(rgar($lead,"user_agent"), 250); - - $sql = $wpdb->prepare("UPDATE $lead_table SET - form_id=%d, - post_id=%d, - is_starred=%d, - is_read=%d, - ip=%s, - source_url=%s, - user_agent=%s, - currency=%s, - payment_status=%s, - payment_date={$payment_date}, - payment_amount={$payment_amount}, - transaction_id=%s, - is_fulfilled=%d, - transaction_type={$transaction_type}, - payment_method=%s, - status='{$status}' - WHERE id=%d", rgar($lead,"form_id"), rgar($lead,"post_id"), rgar($lead,"is_starred"), rgar($lead,"is_read"), rgar($lead,"ip"), $source_url, $user_agent, - rgar($lead,"currency"), rgar($lead,"payment_status"), rgar($lead,"transaction_id"), rgar($lead,"is_fulfilled"), rgar($lead, "payment_method"), rgar($lead,"id")); - $wpdb->query($sql); - - self::set_current_lead($lead); - } + do_action( "gform_update_{$property_name}", $lead_id, $property_value, $previous_value ); + } + } - private static function truncate($str, $length){ - if(strlen($str) > $length){ - $str = substr($str, 0, $length); - } - return $str; - } + return $result; + } - public static function delete_leads($leads){ - foreach($leads as $lead_id) - self::delete_lead($lead_id); - } + public static function update_lead( $lead ) { - public static function delete_forms($forms){ - foreach($forms as $form_id) - self::delete_form($form_id); - } + _deprecated_function( 'GFFormsModel::update_lead()', '1.8.8', 'GFAPI::update_entry()' ); - public static function trash_forms($form_ids){ - foreach($form_ids as $form_id) - self::trash_form($form_id); - } + global $wpdb; + $lead_table = self::get_lead_table_name(); + + $payment_date = strtotime( rgar( $lead, 'payment_date' ) ) ? "'" . gmdate( 'Y-m-d H:i:s', strtotime( "{$lead['payment_date']}" ) ) . "'" : 'NULL'; + $payment_amount = ! rgblank( rgar( $lead, 'payment_amount' ) ) ? (float) rgar( $lead, 'payment_amount' ) : 'NULL'; + $transaction_type = ! rgempty( 'transaction_type', $lead ) ? intval( $lead['transaction_type'] ) : 'NULL'; + + $status = ! rgempty( 'status', $lead ) ? $lead['status'] : 'active'; + $source_url = self::truncate( rgar( $lead, 'source_url' ), 200 ); + $user_agent = self::truncate( rgar( $lead, 'user_agent' ), 250 ); + + $sql = $wpdb->prepare( + "UPDATE $lead_table SET + form_id=%d, + post_id=%d, + is_starred=%d, + is_read=%d, + ip=%s, + source_url=%s, + user_agent=%s, + currency=%s, + payment_status=%s, + payment_date={$payment_date}, + payment_amount={$payment_amount}, + transaction_id=%s, + is_fulfilled=%d, + transaction_type={$transaction_type}, + payment_method=%s, + status='{$status}' + WHERE id=%d", rgar( $lead, 'form_id' ), rgar( $lead, 'post_id' ), rgar( $lead, 'is_starred' ), rgar( $lead, 'is_read' ), rgar( $lead, 'ip' ), $source_url, $user_agent, + rgar( $lead, 'currency' ), rgar( $lead, 'payment_status' ), rgar( $lead, 'transaction_id' ), rgar( $lead, 'is_fulfilled' ), rgar( $lead, 'payment_method' ), rgar( $lead, 'id' ) + ); + $wpdb->query( $sql ); + + self::set_current_lead( $lead ); + } - public static function restore_forms($form_ids){ - foreach($form_ids as $form_id) - self::restore_form($form_id); - } + private static function truncate( $str, $length ) { + if ( strlen( $str ) > $length ) { + $str = substr( $str, 0, $length ); + } - public static function delete_leads_by_form($form_id, $status=""){ - global $wpdb; + return $str; + } + + public static function delete_leads( $leads ) { + foreach ( $leads as $lead_id ) { + self::delete_lead( $lead_id ); + } + } + + public static function delete_forms( $forms ) { + foreach ( $forms as $form_id ) { + self::delete_form( $form_id ); + } + } + + public static function trash_forms( $form_ids ) { + foreach ( $form_ids as $form_id ) { + self::trash_form( $form_id ); + } + } + + public static function restore_forms( $form_ids ) { + foreach ( $form_ids as $form_id ) { + self::restore_form( $form_id ); + } + } - $lead_table = self::get_lead_table_name(); - $lead_notes_table = self::get_lead_notes_table_name(); - $lead_detail_table = self::get_lead_details_table_name(); - $lead_detail_long_table = self::get_lead_details_long_table_name(); - $lead_meta_table = self::get_lead_meta_table_name(); + public static function delete_leads_by_form( $form_id, $status = '' ) { + global $wpdb; + + $lead_table = self::get_lead_table_name(); + $lead_notes_table = self::get_lead_notes_table_name(); + $lead_detail_table = self::get_lead_details_table_name(); + $lead_detail_long_table = self::get_lead_details_long_table_name(); + $lead_meta_table = self::get_lead_meta_table_name(); - do_action("gform_delete_entries", $form_id, $status); + do_action( 'gform_delete_entries', $form_id, $status ); - //deleting uploaded files - self::delete_files_by_form($form_id, $status); + //deleting uploaded files + self::delete_files_by_form( $form_id, $status ); - $status_filter = empty($status) ? "" : $wpdb->prepare("AND status=%s", $status); + $status_filter = empty( $status ) ? '' : $wpdb->prepare( 'AND status=%s', $status ); - //Delete from detail long - $sql = $wpdb->prepare(" DELETE FROM $lead_detail_long_table + //Delete from detail long + $sql = $wpdb->prepare( + " DELETE FROM $lead_detail_long_table WHERE lead_detail_id IN( SELECT ld.id FROM $lead_detail_table ld INNER JOIN $lead_table l ON l.id = ld.lead_id WHERE l.form_id=%d AND ld.form_id=%d {$status_filter} - )", $form_id, $form_id); - $wpdb->query($sql); + )", $form_id, $form_id + ); + $wpdb->query( $sql ); - //Delete from lead details - $sql = $wpdb->prepare(" DELETE FROM $lead_detail_table + //Delete from lead details + $sql = $wpdb->prepare( + " DELETE FROM $lead_detail_table WHERE lead_id IN ( SELECT id FROM $lead_table WHERE form_id=%d {$status_filter} - )", $form_id); - $wpdb->query($sql); + )", $form_id + ); + $wpdb->query( $sql ); - //Delete from lead notes - $sql = $wpdb->prepare(" DELETE FROM $lead_notes_table + //Delete from lead notes + $sql = $wpdb->prepare( + " DELETE FROM $lead_notes_table WHERE lead_id IN ( SELECT id FROM $lead_table WHERE form_id=%d {$status_filter} - )", $form_id); - $wpdb->query($sql); + )", $form_id + ); + $wpdb->query( $sql ); - //Delete from lead meta - $sql = $wpdb->prepare(" DELETE FROM $lead_meta_table + //Delete from lead meta + $sql = $wpdb->prepare( + " DELETE FROM $lead_meta_table WHERE lead_id IN ( SELECT id FROM $lead_table WHERE form_id=%d {$status_filter} - )", $form_id); - $wpdb->query($sql); + )", $form_id + ); + $wpdb->query( $sql ); - //Delete from lead - $sql = $wpdb->prepare("DELETE FROM $lead_table WHERE form_id=%d {$status_filter}", $form_id); - $wpdb->query($sql); - } + //Delete from lead + $sql = $wpdb->prepare( "DELETE FROM $lead_table WHERE form_id=%d {$status_filter}", $form_id ); + $wpdb->query( $sql ); + } - public static function delete_views($form_id){ - global $wpdb; + public static function delete_views( $form_id ) { + global $wpdb; - $form_view_table = self::get_form_view_table_name(); + $form_view_table = self::get_form_view_table_name(); - //Delete form view - $sql = $wpdb->prepare("DELETE FROM $form_view_table WHERE form_id=%d", $form_id); - $wpdb->query($sql); - } + //Delete form view + $sql = $wpdb->prepare( "DELETE FROM $form_view_table WHERE form_id=%d", $form_id ); + $wpdb->query( $sql ); - public static function delete_form($form_id){ - global $wpdb; + do_action( 'gform_post_form_views_deleted', $form_id ); + } - do_action("gform_before_delete_form", $form_id); + public static function delete_form( $form_id ) { + global $wpdb; - $form_meta_table = self::get_meta_table_name(); - $form_table = self::get_form_table_name(); + do_action( 'gform_before_delete_form', $form_id ); - //Deleting form Entries - self::delete_leads_by_form($form_id); + $form_meta_table = self::get_meta_table_name(); + $form_table = self::get_form_table_name(); - //Delete form meta - $sql = $wpdb->prepare("DELETE FROM $form_meta_table WHERE form_id=%d", $form_id); - $wpdb->query($sql); + //Deleting form Entries + self::delete_leads_by_form( $form_id ); - //Deleting form Views - self::delete_views($form_id); + //Delete form meta + $sql = $wpdb->prepare( "DELETE FROM $form_meta_table WHERE form_id=%d", $form_id ); + $wpdb->query( $sql ); - //Delete form - $sql = $wpdb->prepare("DELETE FROM $form_table WHERE id=%d", $form_id); - $wpdb->query($sql); + //Deleting form Views + self::delete_views( $form_id ); - do_action("gform_after_delete_form", $form_id); - } + //Delete form + $sql = $wpdb->prepare( "DELETE FROM $form_table WHERE id=%d", $form_id ); + $wpdb->query( $sql ); - public static function trash_form($form_id){ - global $wpdb; - $form_table_name = self::get_form_table_name(); - $sql = $wpdb->prepare("UPDATE $form_table_name SET is_trash=1 WHERE id=%d", $form_id) ; - $result = $wpdb->query($sql); + do_action( 'gform_after_delete_form', $form_id ); + } - self::$_current_forms[$form_id] = null; - $success = $result == false; - return $success; - } + public static function trash_form( $form_id ) { + global $wpdb; + $form_table_name = self::get_form_table_name(); + $sql = $wpdb->prepare( "UPDATE $form_table_name SET is_trash=1 WHERE id=%d", $form_id ); + $result = $wpdb->query( $sql ); - public static function restore_form($form_id){ - global $wpdb; - $form_table_name = self::get_form_table_name(); - $sql = $wpdb->prepare("UPDATE $form_table_name SET is_trash=0 WHERE id=%d", $form_id) ; - $result = $wpdb->query($sql); + self::$_current_forms[ $form_id ] = null; - self::$_current_forms[$form_id] = null; - $success = $result == false; - return $success; - } + $success = $result == false; - public static function duplicate_form($form_id){ - global $wpdb; + do_action( 'gform_post_form_trashed', $form_id ); - if(!GFCommon::current_user_can_any("gravityforms_create_form")) - die(__("You don't have adequate permission to create forms.", "gravityforms")); + return $success; + } - //finding unique title - $form = self::get_form($form_id); - $count = 2; - $title = $form->title . " - Copy 1"; - while(!self::is_unique_title($title)){ - $title = $form->title . " - Copy $count"; - $count++; - } + public static function restore_form( $form_id ) { + global $wpdb; + $form_table_name = self::get_form_table_name(); + $sql = $wpdb->prepare( "UPDATE $form_table_name SET is_trash=0 WHERE id=%d", $form_id ); + $result = $wpdb->query( $sql ); - //creating new form - $new_id = self::insert_form($title); + self::$_current_forms[ $form_id ] = null; - //copying form meta - $meta = self::get_form_meta($form_id); - $meta["title"] = $title; - $meta["id"] = $new_id; + $success = $result == false; - $notifications = $meta["notifications"]; - $confirmations = $meta["confirmations"]; - unset($meta["notifications"]); - unset($meta["confirmations"]); - self::update_form_meta($new_id, $meta); + do_action( 'gform_post_form_restored', $form_id ); - //copying notification meta - self::update_form_meta($new_id, $notifications, "notifications"); + return $success; + } - //copying confirmation meta - self::update_form_meta($new_id, $confirmations, "confirmations"); + public static function duplicate_form( $form_id ) { + global $wpdb; - do_action("gform_after_duplicate_form", $form_id, $new_id); + if ( ! GFCommon::current_user_can_any( 'gravityforms_create_form' ) ) { + die( __( "You don't have adequate permission to create forms.", 'gravityforms' ) ); + } - return $new_id; - } + //finding unique title + $form = self::get_form( $form_id ); + $count = 2; + $title = $form->title . ' - Copy 1'; + while ( ! self::is_unique_title( $title ) ) { + $title = $form->title . " - Copy $count"; + $count ++; + } - public static function is_unique_title($title){ - $forms = self::get_forms(); - foreach($forms as $form){ - if(strtolower($form->title) == strtolower($title)) - return false; - } + //creating new form + $new_id = self::insert_form( $title ); - return true; - } + //copying form meta + $meta = self::get_form_meta( $form_id ); + $meta['title'] = $title; + $meta['id'] = $new_id; - public static function ensure_tables_exist(){ - global $wpdb; - $form_table_name = self::get_form_table_name(); - $form_count = $wpdb->get_var("SELECT count(0) FROM {$form_table_name}"); - if($wpdb->last_error){ - GFCommon::log_debug("Blog " . get_current_blog_id() . " - Form database table does not exist. Forcing database setup."); - GFForms::setup_database(); - } - } + $notifications = $meta['notifications']; + $confirmations = $meta['confirmations']; + unset( $meta['notifications'] ); + unset( $meta['confirmations'] ); + self::update_form_meta( $new_id, $meta ); - public static function insert_form($form_title){ - global $wpdb; - $form_table_name = $wpdb->prefix . "rg_form"; + //copying notification meta + self::update_form_meta( $new_id, $notifications, 'notifications' ); - //creating new form - $wpdb->query($wpdb->prepare("INSERT INTO $form_table_name(title, date_created) VALUES(%s, utc_timestamp())", $form_title)); + //copying confirmation meta + self::update_form_meta( $new_id, $confirmations, 'confirmations' ); - //returning newly created form id - return $wpdb->insert_id; - } + // The gform_after_duplicate_form action is deprecated since version 1.9. Please use gform_post_form_duplicated instead + do_action( 'gform_after_duplicate_form', $form_id, $new_id ); - public static function update_form_meta( $form_id, $form_meta, $meta_name = 'display_meta' ) { - global $wpdb; + do_action( 'gform_post_form_duplicated', $form_id, $new_id ); - $form_meta = apply_filters( 'gform_form_update_meta', $form_meta, $form_id, $meta_name ); - $form_meta = apply_filters( "gform_form_update_meta_{$form_id}", $form_meta, $form_id, $meta_name ); - $meta_table_name = self::get_meta_table_name(); - $form_meta = json_encode( $form_meta ); + return $new_id; + } - if(intval($wpdb->get_var($wpdb->prepare("SELECT count(0) FROM $meta_table_name WHERE form_id=%d", $form_id))) > 0) - $result = $wpdb->query( $wpdb->prepare("UPDATE $meta_table_name SET $meta_name=%s WHERE form_id=%d", $form_meta, $form_id) ); - else - $result = $wpdb->query( $wpdb->prepare("INSERT INTO $meta_table_name(form_id, $meta_name) VALUES(%d, %s)", $form_id, $form_meta ) ); + public static function is_unique_title( $title ) { + $forms = self::get_forms(); + foreach ( $forms as $form ) { + if ( strtolower( $form->title ) == strtolower( $title ) ) { + return false; + } + } - self::$_current_forms[$form_id] = null; + return true; + } - do_action( 'gform_post_update_form_meta', $form_meta, $form_id, $meta_name ); - do_action( "gform_post_update_form_meta_{$form_id}", $form_meta, $form_id, $meta_name ); + public static function ensure_tables_exist() { + global $wpdb; + $form_table_name = self::get_form_table_name(); + $form_count = $wpdb->get_var( "SELECT count(0) FROM {$form_table_name}" ); + if ( $wpdb->last_error ) { + GFCommon::log_debug( 'GFFormsModel::ensure_tables_exist(): Blog ' . get_current_blog_id() . ' - Form database table does not exist. Forcing database setup.' ); + GFForms::setup_database(); + } + } - return $result; - } + public static function insert_form( $form_title ) { + global $wpdb; + $form_table_name = $wpdb->prefix . 'rg_form'; - public static function delete_files($lead_id, $form=null){ - $lead = self::get_lead($lead_id); - - if($form == null) - $form = self::get_form_meta($lead["form_id"]); - - $fields = GFCommon::get_fields_by_type($form, array("fileupload", "post_image")); - if(is_array($fields)){ - foreach($fields as $field){ - if(rgar($field, "multipleFiles")){ - $value_json = self::get_lead_field_value($lead, $field); - if(!empty($value_json)){ - $files = json_decode($value_json, true); - if(false === empty($files) && is_array($files)){ - foreach ($files as $file){ - self::delete_physical_file($file); - } - } - } - } else { - $value = self::get_lead_field_value($lead, $field); - self::delete_physical_file($value); - } - } - } - } + //creating new form + $wpdb->query( $wpdb->prepare( "INSERT INTO $form_table_name(title, date_created) VALUES(%s, utc_timestamp())", $form_title ) ); - public static function delete_files_by_form($form_id, $status=""){ - global $wpdb; - $form = self::get_form_meta($form_id); - $fields = GFCommon::get_fields_by_type($form, array("fileupload", "post_image")); - if(empty($fields)) - return; + //returning newly created form id + return $wpdb->insert_id; - $status_filter = empty($status) ? "" : $wpdb->prepare("AND status=%s", $status); - $results = $wpdb->get_results($wpdb->prepare("SELECT id FROM {$wpdb->prefix}rg_lead WHERE form_id=%d {$status_filter}", $form_id), ARRAY_A); + } - foreach($results as $result){ - self::delete_files($result["id"], $form); - } - } + public static function update_form_meta( $form_id, $form_meta, $meta_name = 'display_meta' ) { + global $wpdb; - public static function delete_file($entry_id, $field_id, $file_index = 0){ - global $wpdb; + $form_meta = apply_filters( 'gform_form_update_meta', $form_meta, $form_id, $meta_name ); + $form_meta = apply_filters( "gform_form_update_meta_{$form_id}", $form_meta, $form_id, $meta_name ); - if($entry_id == 0 || $field_id == 0) - return; + $meta_table_name = self::get_meta_table_name(); + $form_meta = json_encode( $form_meta ); - $entry = self::get_lead($entry_id); - $form_id = $entry["form_id"]; - $form = self::get_form_meta($form_id); - $field = self::get_field($form, $field_id); - $multiple_files = rgar($field, "multipleFiles"); - if($multiple_files){ - $file_urls = json_decode($entry[$field_id], true); - $file_url = $file_urls[$file_index]; - unset($file_urls[$file_index]); - $file_urls = array_values($file_urls); - $field_value = empty($file_urls) ? "" : json_encode($file_urls); - } else { - $file_url = $entry[$field_id]; - $field_value = ""; - } + if ( intval( $wpdb->get_var( $wpdb->prepare( "SELECT count(0) FROM $meta_table_name WHERE form_id=%d", $form_id ) ) ) > 0 ) { + $result = $wpdb->query( $wpdb->prepare( "UPDATE $meta_table_name SET $meta_name=%s WHERE form_id=%d", $form_meta, $form_id ) ); + } else { + $result = $wpdb->query( $wpdb->prepare( "INSERT INTO $meta_table_name(form_id, $meta_name) VALUES(%d, %s)", $form_id, $form_meta ) ); + } - self::delete_physical_file($file_url); + self::$_current_forms[ $form_id ] = null; - // update lead field value - simulate form submission + do_action( 'gform_post_update_form_meta', $form_meta, $form_id, $meta_name ); + do_action( "gform_post_update_form_meta_{$form_id}", $form_meta, $form_id, $meta_name ); - $lead_detail_table = self::get_lead_details_table_name(); - $sql = $wpdb->prepare("SELECT id FROM $lead_detail_table WHERE lead_id=%d AND field_number BETWEEN %s AND %s", $entry_id, doubleval($field_id) - 0.001, doubleval($field_id) + 0.001); - $entry_detail_id = $wpdb->get_var($sql); + return $result; + } - self::update_lead_field_value($form, $entry, $field, $entry_detail_id, $field_id, $field_value); + public static function delete_files( $lead_id, $form = null ) { + $lead = self::get_lead( $lead_id ); - } + if ( $form == null ) { + $form = self::get_form_meta( $lead['form_id'] ); + } - private static function delete_physical_file($file_url){ - $ary = explode("|:|", $file_url); - $url = rgar($ary,0); - if(empty($url)) - return; + $fields = GFCommon::get_fields_by_type( $form, array( 'fileupload', 'post_image' ) ); + if ( is_array( $fields ) ) { + foreach ( $fields as $field ) { + if ( $field->multipleFiles ) { + $value_json = self::get_lead_field_value( $lead, $field ); + if ( ! empty( $value_json ) ) { + $files = json_decode( $value_json, true ); + if ( false === empty( $files ) && is_array( $files ) ) { + foreach ( $files as $file ) { + self::delete_physical_file( $file ); + } + } + } + } else { + $value = self::get_lead_field_value( $lead, $field ); + self::delete_physical_file( $value ); + } + } + } + } - //Convert from url to physical path - if (is_multisite() && get_site_option( 'ms_files_rewriting' )) { - $file_path = preg_replace("|^(.*?)/files/gravity_forms/|", BLOGUPLOADDIR . "gravity_forms/", $url); - } else { - $file_path = str_replace(WP_CONTENT_URL, WP_CONTENT_DIR, $url); - } + public static function delete_files_by_form( $form_id, $status = '' ) { + global $wpdb; + $form = self::get_form_meta( $form_id ); + $fields = GFCommon::get_fields_by_type( $form, array( 'fileupload', 'post_image' ) ); + if ( empty( $fields ) ) { + return; + } - if(file_exists($file_path)){ - unlink($file_path); - } - } + $status_filter = empty( $status ) ? '' : $wpdb->prepare( 'AND status=%s', $status ); + $results = $wpdb->get_results( $wpdb->prepare( "SELECT id FROM {$wpdb->prefix}rg_lead WHERE form_id=%d {$status_filter}", $form_id ), ARRAY_A ); - public static function delete_field($form_id, $field_id){ - global $wpdb; + foreach ( $results as $result ) { + self::delete_files( $result['id'], $form ); + } + } - if($form_id == 0) - return; + public static function delete_file( $entry_id, $field_id, $file_index = 0 ) { + global $wpdb; - do_action("gform_before_delete_field", $form_id, $field_id); + if ( $entry_id == 0 || $field_id == 0 ) { + return; + } - $lead_table = self::get_lead_table_name(); - $lead_detail_table = self::get_lead_details_table_name(); - $lead_detail_long_table = self::get_lead_details_long_table_name(); + $entry = self::get_lead( $entry_id ); + $form_id = $entry['form_id']; + $form = self::get_form_meta( $form_id ); + $field = self::get_field( $form, $field_id ); + $multiple_files = $field->multipleFiles; + if ( $multiple_files ) { + $file_urls = json_decode( $entry[ $field_id ], true ); + $file_url = $file_urls[ $file_index ]; + unset( $file_urls[ $file_index ] ); + $file_urls = array_values( $file_urls ); + $field_value = empty( $file_urls ) ? '' : json_encode( $file_urls ); + } else { + $file_url = $entry[ $field_id ]; + $field_value = ''; + } + self::delete_physical_file( $file_url ); - $form = self::get_form_meta($form_id); + // update lead field value - simulate form submission - $field_type = ""; + $lead_detail_table = self::get_lead_details_table_name(); + $sql = $wpdb->prepare( "SELECT id FROM $lead_detail_table WHERE lead_id=%d AND field_number BETWEEN %s AND %s", $entry_id, doubleval( $field_id ) - 0.0001, doubleval( $field_id ) + 0.0001 ); + $entry_detail_id = $wpdb->get_var( $sql ); - //Deleting field from form meta - $count = sizeof($form["fields"]); - for($i = $count-1; $i >= 0; $i--){ - $field = $form["fields"][$i]; + self::update_lead_field_value( $form, $entry, $field, $entry_detail_id, $field_id, $field_value ); - //Deleting associated conditional logic rules - if(!empty($field["conditionalLogic"])){ - $rule_count = sizeof($field["conditionalLogic"]["rules"]); - for($j = $rule_count-1; $j >= 0; $j--){ - if($field["conditionalLogic"]["rules"][$j]["fieldId"] == $field_id){ - unset($form["fields"][$i]["conditionalLogic"]["rules"][$j]); - } - } - $form["fields"][$i]["conditionalLogic"]["rules"] = array_values($form["fields"][$i]["conditionalLogic"]["rules"]); + } - //If there aren't any rules, remove the conditional logic - if(sizeof($form["fields"][$i]["conditionalLogic"]["rules"]) == 0){ - $form["fields"][$i]["conditionalLogic"] = false; - } - } + private static function delete_physical_file( $file_url ) { + $ary = explode( '|:|', $file_url ); + $url = rgar( $ary, 0 ); + if ( empty( $url ) ) { + return; + } - //Deleting field from form meta - if($field["id"] == $field_id){ - $field_type = $field["type"]; - unset($form["fields"][$i]); - } + //Convert from url to physical path + if ( is_multisite() && get_site_option( 'ms_files_rewriting' ) ) { + $file_path = preg_replace( "|^(.*?)/files/gravity_forms/|", BLOGUPLOADDIR . 'gravity_forms/', $url ); + } else { + $file_path = str_replace( WP_CONTENT_URL, WP_CONTENT_DIR, $url ); + } - } + if ( file_exists( $file_path ) ) { + unlink( $file_path ); + } + } - //removing post content and title template if the field being deleted is a post content field or post title field - if($field_type == "post_content"){ - $form["postContentTemplateEnabled"] = false; - $form["postContentTemplate"] = ""; - } - else if($field_type == "post_title"){ - $form["postTitleTemplateEnabled"] = false; - $form["postTitleTemplate"] = ""; - } + public static function delete_field( $form_id, $field_id ) { + global $wpdb; - //Deleting associated routing rules - if(!empty($form["notification"]["routing"])){ - $routing_count = sizeof($form["notification"]["routing"]); - for($j = $routing_count-1; $j >= 0; $j--){ - if(intval($form["notification"]["routing"][$j]["fieldId"]) == $field_id){ - unset($form["notification"]["routing"][$j]); - } - } - $form["notification"]["routing"] = array_values($form["notification"]["routing"]); + if ( $form_id == 0 ) { + return; + } - //If there aren't any routing, remove it - if(sizeof($form["notification"]["routing"]) == 0){ - $form["notification"]["routing"] = null; - } - } + do_action( 'gform_before_delete_field', $form_id, $field_id ); - $form["fields"] = array_values($form["fields"]); - self::update_form_meta($form_id, $form); + $lead_table = self::get_lead_table_name(); + $lead_detail_table = self::get_lead_details_table_name(); + $lead_detail_long_table = self::get_lead_details_long_table_name(); - //Delete from grid column meta - $columns = self::get_grid_column_meta($form_id); - $count = sizeof($columns); - for($i = $count -1; $i >=0; $i--) - { - if(intval(rgar($columns,$i)) == intval($field_id)){ - unset($columns[$i]); - } - } - self::update_grid_column_meta($form_id, $columns); - //Delete from detail long - $sql = $wpdb->prepare(" DELETE FROM $lead_detail_long_table + $form = self::get_form_meta( $form_id ); + + $field_type = ''; + + //Deleting field from form meta + $count = sizeof( $form['fields'] ); + for ( $i = $count - 1; $i >= 0; $i -- ) { + $field = $form['fields'][ $i ]; + + //Deleting associated conditional logic rules + if ( ! empty( $field->conditionalLogic ) ) { + $rule_count = sizeof( $field->conditionalLogic['rules'] ); + for ( $j = $rule_count - 1; $j >= 0; $j -- ) { + if ( $field->conditionalLogic['rules'][ $j ]['fieldId'] == $field_id ) { + unset( $form['fields'][ $i ]->conditionalLogic['rules'][ $j ] ); + } + } + $form['fields'][ $i ]->conditionalLogic['rules'] = array_values( $form['fields'][ $i ]->conditionalLogic['rules'] ); + + //If there aren't any rules, remove the conditional logic + if ( sizeof( $form['fields'][ $i ]->conditionalLogic['rules'] ) == 0 ) { + $form['fields'][ $i ]->conditionalLogic = false; + } + } + + //Deleting field from form meta + if ( $field->id == $field_id ) { + $field_type = $field->type; + unset( $form['fields'][ $i ] ); + } + } + + //removing post content and title template if the field being deleted is a post content field or post title field + if ( $field_type == 'post_content' ) { + $form['postContentTemplateEnabled'] = false; + $form['postContentTemplate'] = ''; + } else if ( $field_type == 'post_title' ) { + $form['postTitleTemplateEnabled'] = false; + $form['postTitleTemplate'] = ''; + } + + //Deleting associated routing rules + if ( ! empty( $form['notification']['routing'] ) ) { + $routing_count = sizeof( $form['notification']['routing'] ); + for ( $j = $routing_count - 1; $j >= 0; $j -- ) { + if ( intval( $form['notification']['routing'][ $j ]['fieldId'] ) == $field_id ) { + unset( $form['notification']['routing'][ $j ] ); + } + } + $form['notification']['routing'] = array_values( $form['notification']['routing'] ); + + //If there aren't any routing, remove it + if ( sizeof( $form['notification']['routing'] ) == 0 ) { + $form['notification']['routing'] = null; + } + } + + $form['fields'] = array_values( $form['fields'] ); + self::update_form_meta( $form_id, $form ); + + //Delete from grid column meta + $columns = self::get_grid_column_meta( $form_id ); + $count = sizeof( $columns ); + for ( $i = $count - 1; $i >= 0; $i -- ) { + if ( intval( rgar( $columns, $i ) ) == intval( $field_id ) ) { + unset( $columns[ $i ] ); + } + } + self::update_grid_column_meta( $form_id, $columns ); + + //Delete from detail long + $sql = $wpdb->prepare( + " DELETE FROM $lead_detail_long_table WHERE lead_detail_id IN( SELECT id FROM $lead_detail_table WHERE form_id=%d AND field_number >= %d AND field_number < %d - )", $form_id, $field_id, $field_id + 1); - $wpdb->query($sql); + )", $form_id, $field_id, $field_id + 1 + ); + $wpdb->query( $sql ); - //Delete from lead details - $sql = $wpdb->prepare("DELETE FROM $lead_detail_table WHERE form_id=%d AND field_number >= %d AND field_number < %d", $form_id, $field_id, $field_id + 1); - $wpdb->query($sql); + //Delete from lead details + $sql = $wpdb->prepare( "DELETE FROM $lead_detail_table WHERE form_id=%d AND field_number >= %d AND field_number < %d", $form_id, $field_id, $field_id + 1 ); + $wpdb->query( $sql ); - //Delete leads with no details - $sql = $wpdb->prepare(" DELETE FROM $lead_table + //Delete leads with no details + $sql = $wpdb->prepare( + " DELETE FROM $lead_table WHERE form_id=%d AND id NOT IN( SELECT DISTINCT(lead_id) FROM $lead_detail_table WHERE form_id=%d - )", $form_id, $form_id); - $wpdb->query($sql); + )", $form_id, $form_id + ); + $wpdb->query( $sql ); - do_action("gform_after_delete_field", $form_id, $field_id); - } + do_action( 'gform_after_delete_field', $form_id, $field_id ); + } - public static function delete_lead($lead_id){ - global $wpdb; + public static function delete_lead( $lead_id ) { + global $wpdb; - do_action("gform_delete_lead", $lead_id); + do_action( 'gform_delete_lead', $lead_id ); - $lead_table = self::get_lead_table_name(); - $lead_notes_table = self::get_lead_notes_table_name(); - $lead_detail_table = self::get_lead_details_table_name(); - $lead_detail_long_table = self::get_lead_details_long_table_name(); + $lead_table = self::get_lead_table_name(); + $lead_notes_table = self::get_lead_notes_table_name(); + $lead_detail_table = self::get_lead_details_table_name(); + $lead_detail_long_table = self::get_lead_details_long_table_name(); - //deleting uploaded files - self::delete_files($lead_id); + //deleting uploaded files + self::delete_files( $lead_id ); - //Delete from detail long - $sql = $wpdb->prepare(" DELETE FROM $lead_detail_long_table + //Delete from detail long + $sql = $wpdb->prepare( + " DELETE FROM $lead_detail_long_table WHERE lead_detail_id IN( SELECT id FROM $lead_detail_table WHERE lead_id=%d - )", $lead_id); - $wpdb->query($sql); + )", $lead_id + ); + $wpdb->query( $sql ); - //Delete from lead details - $sql = $wpdb->prepare("DELETE FROM $lead_detail_table WHERE lead_id=%d", $lead_id); - $wpdb->query($sql); + //Delete from lead details + $sql = $wpdb->prepare( "DELETE FROM $lead_detail_table WHERE lead_id=%d", $lead_id ); + $wpdb->query( $sql ); - //Delete from lead notes - $sql = $wpdb->prepare("DELETE FROM $lead_notes_table WHERE lead_id=%d", $lead_id); - $wpdb->query($sql); + //Delete from lead notes + $sql = $wpdb->prepare( "DELETE FROM $lead_notes_table WHERE lead_id=%d", $lead_id ); + $wpdb->query( $sql ); - //Delete from lead meta - gform_delete_meta($lead_id); + //Delete from lead meta + gform_delete_meta( $lead_id ); - //Delete from lead - $sql = $wpdb->prepare("DELETE FROM $lead_table WHERE id=%d", $lead_id); - $wpdb->query($sql); + //Delete from lead + $sql = $wpdb->prepare( "DELETE FROM $lead_table WHERE id=%d", $lead_id ); + $wpdb->query( $sql ); - } + } - public static function add_note($lead_id, $user_id, $user_name, $note, $note_type = "note"){ - global $wpdb; + public static function add_note( $lead_id, $user_id, $user_name, $note, $note_type = 'note' ) { + global $wpdb; - $table_name = self::get_lead_notes_table_name(); - $sql = $wpdb->prepare("INSERT INTO $table_name(lead_id, user_id, user_name, value, note_type, date_created) values(%d, %d, %s, %s, %s, utc_timestamp())", $lead_id, $user_id, $user_name, $note, $note_type); + $table_name = self::get_lead_notes_table_name(); + $sql = $wpdb->prepare( "INSERT INTO $table_name(lead_id, user_id, user_name, value, note_type, date_created) values(%d, %d, %s, %s, %s, utc_timestamp())", $lead_id, $user_id, $user_name, $note, $note_type ); - $wpdb->query($sql); - } + $wpdb->query( $sql ); - public static function delete_note($note_id){ - global $wpdb; + do_action( 'gform_post_note_added', $wpdb->insert_id, $lead_id, $user_id, $user_name, $note, $note_type ); + } - if(!GFCommon::current_user_can_any("gravityforms_edit_entry_notes")) - die(__("You don't have adequate permission to delete notes.", "gravityforms")); + public static function delete_note( $note_id ) { + global $wpdb; - $table_name = self::get_lead_notes_table_name(); - $sql = $wpdb->prepare("DELETE FROM $table_name WHERE id=%d", $note_id); - $wpdb->query($sql); - } + $table_name = self::get_lead_notes_table_name(); - public static function delete_notes($notes){ - if(!is_array($notes)) - return; + $lead_id = $wpdb->get_var( $wpdb->prepare( "SELECT lead_id FROM $table_name WHERE id = %d", $note_id ) ); + do_action( 'gform_pre_note_deleted', $note_id, $lead_id ); - foreach($notes as $note_id){ - self::delete_note($note_id); - } - } + $sql = $wpdb->prepare( "DELETE FROM $table_name WHERE id=%d", $note_id ); + $wpdb->query( $sql ); + } - public static function get_ip(){ + public static function delete_notes( $notes ) { + if ( ! is_array( $notes ) ) { + return; + } - $ip = ''; - $headers = array( 'HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'REMOTE_ADDR' ); + foreach ( $notes as $note_id ) { + self::delete_note( $note_id ); + } + } - foreach( $headers as $header ) { - $ip = rgar( $_SERVER, $header ); - if( $ip ) - break; - } + public static function get_ip() { - // HTTP_X_FORWARDED_FOR can return a comma separated list of IPs; using the first one - $ips = explode( ',', $ip ); + $ip = ''; + $headers = array( 'HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'REMOTE_ADDR' ); - return $ips[0]; - } + foreach ( $headers as $header ) { + $ip = rgar( $_SERVER, $header ); + if ( $ip ) { + break; + } + } - public static function save_lead($form, &$lead){ - global $wpdb; + // HTTP_X_FORWARDED_FOR can return a comma separated list of IPs; using the first one + $ips = explode( ',', $ip ); - GFCommon::log_debug("Saving entry."); + return $ips[0]; + } - if(IS_ADMIN && !GFCommon::current_user_can_any("gravityforms_edit_entries")) - die(__("You don't have adequate permission to edit entries.", "gravityforms")); + public static function save_lead( $form, &$lead ) { + global $wpdb; - $lead_detail_table = self::get_lead_details_table_name(); - $is_new_lead = $lead == null; + GFCommon::log_debug( 'GFFormsModel::save_lead(): Saving entry.' ); - //Inserting lead if null - if( $is_new_lead ) { + $is_form_editor = GFCommon::is_form_editor(); + $is_entry_detail = GFCommon::is_entry_detail(); + $is_admin = $is_form_editor || $is_entry_detail; - global $current_user; - $user_id = $current_user && $current_user->ID ? $current_user->ID : 'NULL'; + if ( $is_admin && ! GFCommon::current_user_can_any( 'gravityforms_edit_entries' ) ) { + die( __( "You don't have adequate permission to edit entries.", 'gravityforms' ) ); + } - $lead_table = RGFormsModel::get_lead_table_name(); - $user_agent = self::truncate($_SERVER["HTTP_USER_AGENT"], 250); - $currency = GFCommon::get_currency(); - $source_url = self::truncate(self::get_current_page_url(), 200); + $lead_detail_table = self::get_lead_details_table_name(); + $is_new_lead = $lead == null; - $wpdb->query($wpdb->prepare("INSERT INTO $lead_table(form_id, ip, source_url, date_created, user_agent, currency, created_by) VALUES(%d, %s, %s, utc_timestamp(), %s, %s, {$user_id})", $form["id"], self::get_ip(), $source_url, $user_agent, $currency)); + //Inserting lead if null + if ( $is_new_lead ) { + global $current_user; + $user_id = $current_user && $current_user->ID ? $current_user->ID : 'NULL'; - //reading newly created lead id - $lead_id = $wpdb->insert_id; - $lead = array( 'id' => $lead_id ); + $lead_table = RGFormsModel::get_lead_table_name(); + $user_agent = self::truncate( $_SERVER['HTTP_USER_AGENT'], 250 ); + $currency = GFCommon::get_currency(); + $source_url = self::truncate( self::get_current_page_url(), 200 ); - GFCommon::log_debug("Entry record created in the database. ID: {$lead_id}"); - } + $wpdb->query( $wpdb->prepare( "INSERT INTO $lead_table(form_id, ip, source_url, date_created, user_agent, currency, created_by) VALUES(%d, %s, %s, utc_timestamp(), %s, %s, {$user_id})", $form['id'], self::get_ip(), $source_url, $user_agent, $currency ) ); - $current_fields = $wpdb->get_results($wpdb->prepare("SELECT id, field_number FROM $lead_detail_table WHERE lead_id=%d", $lead["id"])); - $total_fields = array(); - $calculation_fields = array(); - $recalculate_total = false; + //reading newly created lead id + $lead_id = $wpdb->insert_id; + $lead = array( 'id' => $lead_id ); - GFCommon::log_debug("Saving entry fields."); + GFCommon::log_debug( "GFFormsModel::save_lead(): Entry record created in the database. ID: {$lead_id}." ); + } - foreach($form["fields"] as $field){ + $current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT id, field_number FROM $lead_detail_table WHERE lead_id=%d", $lead['id'] ) ); - //Ignore fields that are marked as display only - if(rgget("displayOnly", $field) && $field["type"] != "password"){ - continue; - } + $total_fields = array(); + /* @var $calculation_fields GF_Field[] */ + $calculation_fields = array(); + $recalculate_total = false; - //ignore pricing fields in the entry detail - if(RG_CURRENT_VIEW == "entry" && GFCommon::is_pricing_field($field["type"])){ - continue; - } + GFCommon::log_debug( 'GFFormsModel::save_lead(): Saving entry fields.' ); + foreach ( $form['fields'] as $field ) { + /* @var $field GF_Field */ - //process total field after all fields have been saved - if($field["type"] == "total"){ - $total_fields[] = $field; - continue; - } + //Ignore fields that are marked as display only + if ( $field->displayOnly && $field->type != 'password' ) { + continue; + } + + //ignore pricing fields in the entry detail + if ( RG_CURRENT_VIEW == 'entry' && GFCommon::is_pricing_field( $field->type ) ) { + continue; + } + + + //process total field after all fields have been saved + if ( $field->type == 'total' ) { + $total_fields[] = $field; + continue; + } $is_entry_update = RG_CURRENT_VIEW == 'entry' || ! $is_new_lead; $read_value_from_post = $is_new_lead || ! isset( $lead[ 'date_created' ] ); - //only save fields that are not hidden (except on entry screen) - if( $is_entry_update || ! GFFormsModel::is_field_hidden( $form, $field, array(), $read_value_from_post ? null : $lead ) ) { + //only save fields that are not hidden (except when updating an entry) + if( $is_entry_update || ! GFFormsModel::is_field_hidden( $form, $field, array(), $read_value_from_post ? null : $lead ) ) { - // process calculation fields after all fields have been saved (moved after the is hidden check) - if( GFCommon::has_field_calculation($field) ) { - $calculation_fields[] = $field; - continue; - } + // process calculation fields after all fields have been saved (moved after the is hidden check) + if ( $field->has_calculation() ) { + $calculation_fields[] = $field; + continue; + } - GFCommon::log_debug("Saving field {$field["label"]}"); + GFCommon::log_debug( "GFFormsModel::save_lead(): Saving field {$field->label}(#{$field->id} - {$field->type})." ); - if($field['type'] == 'post_category') - $field = GFCommon::add_categories_as_choices($field, ''); + if ( $field->type == 'post_category' ) { + $field = GFCommon::add_categories_as_choices( $field, '' ); + } - if(isset($field["inputs"]) && is_array($field["inputs"])){ + $inputs = $field->get_entry_inputs(); - foreach($field["inputs"] as $input) - self::save_input($form, $field, $lead, $current_fields, $input["id"]); - } - else{ - self::save_input($form, $field, $lead, $current_fields, $field["id"]); - } - } - } + if ( is_array( $inputs ) ) { + foreach ( $inputs as $input ) { + self::save_input( $form, $field, $lead, $current_fields, $input['id'] ); + } + } else { + self::save_input( $form, $field, $lead, $current_fields, $field->id ); + } + } + } - if(!empty($calculation_fields)) { - foreach($calculation_fields as $calculation_field) { + if ( ! empty( $calculation_fields ) ) { + foreach ( $calculation_fields as $calculation_field ) { - GFCommon::log_debug("Saving calculated field {$calculation_field["label"]}"); + GFCommon::log_debug( "GFFormsModel::save_lead(): Saving calculated field {$calculation_field->label}(#{$calculation_field->id} - {$calculation_field->type})." ); - if(isset($calculation_field["inputs"]) && is_array($calculation_field["inputs"])){ - foreach($calculation_field["inputs"] as $input) { - self::save_input($form, $calculation_field, $lead, $current_fields, $input["id"]); - self::refresh_lead_field_value($lead["id"], $input["id"]); - } - } - else{ - self::save_input($form, $calculation_field, $lead, $current_fields, $calculation_field["id"]); - self::refresh_lead_field_value($lead["id"], $calculation_field["id"]); - } + $inputs = $calculation_field->get_entry_inputs(); - } - self::refresh_product_cache($form, $lead = RGFormsModel::get_lead($lead['id'])); - } + if ( is_array( $inputs ) ) { + foreach ( $inputs as $input ) { + self::save_input( $form, $calculation_field, $lead, $current_fields, $input['id'] ); + self::refresh_lead_field_value( $lead['id'], $input['id'] ); + } + } else { + self::save_input( $form, $calculation_field, $lead, $current_fields, $calculation_field->id ); + self::refresh_lead_field_value( $lead['id'], $calculation_field->id ); + } + } + self::refresh_product_cache( $form, $lead = RGFormsModel::get_lead( $lead['id'] ) ); + } - //saving total field as the last field of the form. - if(!empty($total_fields)) { - foreach($total_fields as $total_field){ - GFCommon::log_debug("Saving total field."); - self::save_input($form, $total_field, $lead, $current_fields, $total_field["id"]); - self::refresh_lead_field_value($lead["id"], $total_field["id"]); - } - } - } + //saving total field as the last field of the form. + if ( ! empty( $total_fields ) ) { + foreach ( $total_fields as $total_field ) { + GFCommon::log_debug( 'GFFormsModel::save_lead(): Saving total field.' ); + self::save_input( $form, $total_field, $lead, $current_fields, $total_field->id ); + self::refresh_lead_field_value( $lead['id'], $total_field['id'] ); + } + } + } - public static function create_lead($form) { - global $current_user; + public static function create_lead( $form ) { + global $current_user; + + $total_fields = array(); + $calculation_fields = array(); + + $lead = array(); + $lead['id'] = null; + $lead['post_id'] = null; + $lead['date_created'] = null; + $lead['form_id'] = $form['id']; + $lead['ip'] = self::get_ip(); + $lead['source_url'] = self::truncate( self::get_current_page_url(), 200 ); + $lead['user_agent'] = strlen( $_SERVER['HTTP_USER_AGENT'] ) > 250 ? substr( $_SERVER['HTTP_USER_AGENT'], 0, 250 ) : $_SERVER['HTTP_USER_AGENT']; + $lead['currency'] = GFCommon::get_currency(); + $lead['created_by'] = $current_user && $current_user->ID ? $current_user->ID : 'NULL'; + + foreach ( $form['fields'] as $field ) { + /* @var $field GF_Field */ + + // ignore fields that are marked as display only + if ( $field->displayOnly && $field->type != 'password' ) { + continue; + } + + // process total field after all fields have been saved + if ( $field->type == 'total' ) { + $total_fields[] = $field; + continue; + } + + // process calculation fields after all fields have been saved + if ( $field->has_calculation() ) { + $calculation_fields[] = $field; + continue; + } + + // only save fields that are not hidden + if ( ! RGFormsModel::is_field_hidden( $form, $field, array() ) ) { + + if ( $field->type == 'post_category' ) { + $field = GFCommon::add_categories_as_choices( $field, '' ); + } - $total_fields = array(); - $calculation_fields = array(); - - $lead = array(); - $lead['id'] = null; - $lead['post_id'] = null; - $lead['date_created'] = null; - $lead['form_id'] = $form['id']; - $lead['ip'] = self::get_ip(); - $lead['source_url'] = self::truncate(self::get_current_page_url(), 200); - $lead['user_agent'] = strlen($_SERVER['HTTP_USER_AGENT']) > 250 ? substr($_SERVER['HTTP_USER_AGENT'], 0, 250) : $_SERVER['HTTP_USER_AGENT']; - $lead['currency'] = GFCommon::get_currency(); - $lead['created_by'] = $current_user && $current_user->ID ? $current_user->ID : 'NULL'; - - foreach($form['fields'] as $field) { - - // ignore fields that are marked as display only - if(rgget('displayOnly', $field) && $field['type'] != 'password'){ - continue; - } + $inputs = $field->get_entry_inputs(); - // process total field after all fields have been saved - if($field['type'] == 'total'){ - $total_fields[] = $field; - continue; - } + if ( is_array( $inputs ) ) { + foreach ( $field->inputs as $input ) { + $lead[ (string) $input['id'] ] = self::get_prepared_input_value( $form, $field, $lead, $input['id'] ); + } + } else { + $lead[ $field->id ] = self::get_prepared_input_value( $form, $field, $lead, $field->id ); + } + } + } - // process calculation fields after all fields have been saved - if(GFCommon::has_field_calculation($field)) { - $calculation_fields[] = $field; - continue; - } + if ( ! empty( $calculation_fields ) ) { + foreach ( $calculation_fields as $field ) { + /* @var $field GF_Field */ - // only save fields that are not hidden - if(!RGFormsModel::is_field_hidden($form, $field, array()) ){ + // only save fields that are not hidden + if ( RGFormsModel::is_field_hidden( $form, $field, array() ) ) { + continue; + } - if($field['type'] == 'post_category') - $field = GFCommon::add_categories_as_choices($field, ''); + $inputs = $field->get_entry_inputs(); - if(isset($field['inputs']) && is_array($field['inputs'])){ - foreach($field['inputs'] as $input) { - $lead[(string)$input['id']] = self::get_prepared_input_value($form, $field, $lead, $input["id"]); - } - } - else { - $lead[$field['id']] = self::get_prepared_input_value($form, $field, $lead, $field["id"]); - } - } - } + if ( is_array( $inputs ) ) { + foreach ( $inputs as $input ) { + $lead[ (string) $input['id'] ] = self::get_prepared_input_value( $form, $field, $lead, $input['id'] ); + } + } else { + $lead[ $field->id ] = self::get_prepared_input_value( $form, $field, $lead, $field->id ); + } + } + self::refresh_product_cache( $form, $lead ); + } - if(!empty($calculation_fields)) { - foreach($calculation_fields as $field) { + // saving total field as the last field of the form. + if ( ! empty( $total_fields ) ) { + foreach ( $total_fields as $total_field ) { + $lead[ $total_field->id ] = self::get_prepared_input_value( $form, $total_field, $lead, $total_field->id ); + } + } - // only save fields that are not hidden - if(RGFormsModel::is_field_hidden($form, $field, array()) ) - continue; + return $lead; + } - if(isset($field["inputs"]) && is_array($field["inputs"])){ - foreach($field["inputs"] as $input) { - $lead[(string)$input['id']] = self::get_prepared_input_value($form, $field, $lead, $input["id"]); - } - } - else{ - $lead[$field['id']] = self::get_prepared_input_value($form, $field, $lead, $field["id"]); - } + public static function get_prepared_input_value( $form, $field, $lead, $input_id ) { - } - self::refresh_product_cache($form, $lead); - } + $input_name = 'input_' . str_replace( '.', '_', $input_id ); + $value = rgpost( $input_name ); - // saving total field as the last field of the form. - if( ! empty( $total_fields ) ) { - foreach( $total_fields as $total_field ) { - $lead[$total_field['id']] = self::get_prepared_input_value( $form, $total_field, $lead, $total_field['id'] ); - } - } + $is_form_editor = GFCommon::is_form_editor(); + $is_entry_detail = GFCommon::is_entry_detail(); + $is_admin = $is_form_editor || $is_entry_detail; - return $lead; - } + if ( empty( $value ) && $field->adminOnly && ! $is_admin ) { + $value = self::get_default_value( $field, $input_id ); + } - public static function get_prepared_input_value($form, $field, $lead, $input_id) { + switch ( self::get_input_type( $field ) ) { - $input_name = "input_" . str_replace('.', '_', $input_id); - $value = rgpost($input_name); + case 'post_image': + $file_info = self::get_temp_filename( $form['id'], $input_name ); + if ( ! empty( $file_info ) ) { + $file_path = self::get_file_upload_path( $form['id'], $file_info['uploaded_filename'] ); + $url = $file_path['url']; - if(empty($value) && rgar($field, "adminOnly") && !IS_ADMIN){ - $value = self::get_default_value($field, $input_id); - } + $image_title = isset( $_POST[ "{$input_name}_1" ] ) ? strip_tags( $_POST[ "{$input_name}_1" ] ) : ''; + $image_caption = isset( $_POST[ "{$input_name}_4" ] ) ? strip_tags( $_POST[ "{$input_name}_4" ] ) : ''; + $image_description = isset( $_POST[ "{$input_name}_7" ] ) ? strip_tags( $_POST[ "{$input_name}_7" ] ) : ''; - switch(self::get_input_type($field)) { + $value = ! empty( $url ) ? $url . '|:|' . $image_title . '|:|' . $image_caption . '|:|' . $image_description : ''; + } + break; - case "post_image": - $file_info = self::get_temp_filename($form['id'], $input_name); - $file_path = self::get_file_upload_path($form['id'], $file_info["uploaded_filename"]); - $url = $file_path['url']; + case 'fileupload' : + if ( $field->multipleFiles ) { + if ( ! empty( $value ) ) { + $value = json_encode( $value ); + } + } else { + $file_info = self::get_temp_filename( $form['id'], $input_name ); + if ( ! empty( $file_info ) ) { + $file_path = self::get_file_upload_path( $form['id'], $file_info['uploaded_filename'] ); + $value = $file_path['url']; + } + } - $image_title = isset($_POST["{$input_name}_1"]) ? strip_tags($_POST["{$input_name}_1"]) : ""; - $image_caption = isset($_POST["{$input_name}_4"]) ? strip_tags($_POST["{$input_name}_4"]) : ""; - $image_description = isset($_POST["{$input_name}_7"]) ? strip_tags($_POST["{$input_name}_7"]) : ""; + break; - $value = !empty($url) ? $url . "|:|" . $image_title . "|:|" . $image_caption . "|:|" . $image_description : ""; - break; + default: - case "fileupload" : - if(rgar($field, "multipleFiles")){ - $value = json_encode($value); - } else{ - $file_info = self::get_temp_filename($form['id'], $input_name); - $file_path = self::get_file_upload_path($form['id'], $file_info["uploaded_filename"]); - $value = $file_path['url']; - } + // processing values so that they are in the correct format for each input type + $value = self::prepare_value( $form, $field, $value, $input_name, rgar( $lead, 'id' ), $lead ); - break; + } - default: + return apply_filters( 'gform_save_field_value', $value, $lead, $field, $form, $input_id ); + } - // processing values so that they are in the correct format for each input type - $value = self::prepare_value($form, $field, $value, $input_name, rgar($lead, 'id'), $lead); + public static function refresh_product_cache( $form, $lead, $use_choice_text = false, $use_admin_label = false ) { + + $cache_options = array( + array( false, false ), + array( false, true ), + array( true, false ), + array( true, true ), + ); + + foreach ( $form['fields'] as $field ) { + /* @var $field GF_Field */ + if ( $field->has_calculation() ) { + //deleting field value cache for calculated fields + $cache_key = 'GFFormsModel::get_lead_field_value_' . $lead['id'] . '_' . $field->id; + GFCache::delete( $cache_key ); + } + } - } + foreach ( $cache_options as $cache_option ) { + list( $use_choice_text, $use_admin_label ) = $cache_option; + if ( gform_get_meta( rgar( $lead, 'id' ), "gform_product_info_{$use_choice_text}_{$use_admin_label}" ) ) { + gform_delete_meta( rgar( $lead, 'id' ), "gform_product_info_{$use_choice_text}_{$use_admin_label}" ); + GFCommon::get_product_fields( $form, $lead, $use_choice_text, $use_admin_label ); + } + } - return apply_filters( 'gform_save_field_value', $value, $lead, $field, $form, $input_id ); - } + } - public static function refresh_product_cache($form, $lead, $use_choice_text = false, $use_admin_label = false) { + /** + * Check whether a field is hidden via conditional logic. + * + * @param array $form Form object. + * @param GF_Field $field Field object. + * @param array $field_values Default field values for this form. Used when form has not yet been submitted. Pass an array if no default field values are avilable/required. + * @param array $lead Optional, default is null. If lead object is available, pass the lead. + * + * @return mixed + */ + public static function is_field_hidden( $form, $field, $field_values, $lead = null ) { - $cache_options = array( - array(false, false), - array(false, true), - array(true, false), - array(true, true) - ); + if ( empty( $field ) ) { + return false; + } - foreach($form["fields"] as $field){ - if(GFCommon::has_field_calculation($field)){ - //deleting field value cache for calculated fields - $cache_key = "GFFormsModel::get_lead_field_value_" . $lead["id"] . "_" . $field["id"]; - GFCache::delete($cache_key); - } - } + $cache_key = 'GFFormsModel::is_field_hidden_' . $form['id'] . '_' . $field->id; + $display = GFCache::get( $cache_key ); + if ( $display !== false ) { + return $display; + } - foreach($cache_options as $cache_option) { - list($use_choice_text, $use_admin_label) = $cache_option; - if( gform_get_meta( rgar($lead,'id'), "gform_product_info_{$use_choice_text}_{$use_admin_label}") ) { - gform_delete_meta(rgar($lead,'id'), "gform_product_info_{$use_choice_text}_{$use_admin_label}"); - GFCommon::get_product_fields($form, $lead, $use_choice_text, $use_admin_label); - } - } + $section = self::get_section( $form, $field->id ); + $section_display = self::get_field_display( $form, $section, $field_values, $lead ); - } + //if section is hidden, hide field no matter what. if section is visible, see if field is supposed to be visible + if ( $section_display == 'hide' ) { + $display = 'hide'; + } else if ( self::is_page_hidden( $form, $field->pageNumber, $field_values, $lead ) ) { + $display = 'hide'; + } else { + $display = self::get_field_display( $form, $field, $field_values, $lead ); - /** - * Check whether a field is hidden via conditional logic. - * - * @param array $form Form object. - * @param array $field Field object. - * @param array $field_values Default field values for this form. Used when form has not yet been submitted. Pass an array if no default field values are avilable/required. - * @return array $lead Optional, default is null. If lead object is available, pass the lead. - */ - public static function is_field_hidden($form, $field, $field_values, $lead=null){ - - $cache_key = "GFFormsModel::is_field_hidden_" . $form["id"] . "_" . $field["id"]; - $display = GFCache::get($cache_key); - if($display !== false) - return $display; - - $section = self::get_section($form, $field["id"]); - $section_display = self::get_field_display($form, $section, $field_values, $lead); - - //if section is hidden, hide field no matter what. if section is visible, see if field is supposed to be visible - if($section_display == "hide"){ - $display = "hide"; - } - else if(self::is_page_hidden($form, rgar($field,"pageNumber"), $field_values, $lead)){ - $display = "hide"; - } - else{ - $display = self::get_field_display($form, $field, $field_values, $lead); - return $display == "hide"; - } + return $display == 'hide'; + } - GFCache::set($cache_key, $display); + GFCache::set( $cache_key, $display ); - return $display == "hide"; - } + return $display == 'hide'; + } - public static function is_page_hidden($form, $page_number, $field_values, $lead=null){ - $page = self::get_page_by_number($form, $page_number); + public static function is_page_hidden( $form, $page_number, $field_values, $lead = null ) { + $page = self::get_page_by_number( $form, $page_number ); - if(!$page) - return false; + if ( ! $page ) { + return false; + } - $display = self::get_field_display($form, $page, $field_values, $lead); - return $display == "hide"; - } + $display = self::get_field_display( $form, $page, $field_values, $lead ); - public static function get_page_by_number($form, $page_number){ - foreach($form["fields"] as $field){ - if($field["type"] == "page" && $field["pageNumber"] == $page_number) - return $field; - } - return null; - } + return $display == 'hide'; + } - public static function get_page_by_field($form, $field){ - return get_page_by_number($field["pageNumber"]); - } + public static function get_page_by_number( $form, $page_number ) { + foreach ( $form['fields'] as $field ) { + if ( $field->type == 'page' && $field->pageNumber == $page_number ) { + return $field; + } + } - //gets the section that the specified field belongs to, or null if none - public static function get_section($form, $field_id){ - $current_section = null; - foreach($form["fields"] as $field){ - if($field["type"] == "section") - $current_section = $field; + return null; + } - //stop section at a page break (sections don't go cross page) - if($field["type"] == "page") - $current_section = null; + //gets the section that the specified field belongs to, or null if none + public static function get_section( $form, $field_id ) { + $current_section = null; + foreach ( $form['fields'] as $field ) { + if ( $field->type == 'section' ) { + $current_section = $field; + } + + //stop section at a page break (sections don't go cross page) + if ( $field->type == 'page' ) { + $current_section = null; + } + + if ( $field->id == $field_id ) { + return $current_section; + } + } - if($field["id"] == $field_id) - return $current_section; - } + return null; + } - return null; - } + public static function is_value_match( $field_value, $target_value, $operation = 'is', $source_field = null, $rule = null, $form = null ) { - public static function is_value_match( $field_value, $target_value, $operation="is", $source_field = null, $rule = null, $form = null ) { + $is_match = false; - $is_match = false; + if ( $source_field && is_subclass_of( $source_field, 'GF_Field' ) && $source_field->type == 'post_category' ) { + $field_value = GFCommon::prepare_post_category_value( $field_value, $source_field, 'conditional_logic' ); + } - if($source_field && $source_field["type"] == "post_category") - $field_value = GFCommon::prepare_post_category_value($field_value, $source_field, "conditional_logic"); + if ( ! empty( $field_value ) && ! is_array( $field_value ) && is_subclass_of( $source_field, 'GF_Field' ) && $source_field->type == 'multiselect' ) { + $field_value = explode( ',', $field_value ); + } // convert the comma-delimited string into an array - if (!empty($field_value) && !is_array($field_value) && $source_field["type"] == "multiselect") - $field_value = explode(",", $field_value); // convert the comma-delimited string into an array + $form_id = $source_field instanceof GF_Field ? $source_field->formId : 0; - $target_value = GFFormsModel::maybe_trim_input($target_value, rgar($source_field, "formId"),$source_field); + $target_value = GFFormsModel::maybe_trim_input( $target_value, $form_id, $source_field ); - if(is_array($field_value)){ - $field_value = array_values($field_value); //returning array values, ignoring keys if array is associative - $match_count = 0; - foreach($field_value as $val){ - $val = GFFormsModel::maybe_trim_input(GFCommon::get_selection_value($val), rgar($source_field,"formId"),$source_field); - if(self::matches_operation($val, $target_value, $operation)){ - $match_count++; - } - } - // if operation is Is Not, none of the values in the array can match the target value. - $is_match = $operation == "isnot" ? $match_count == count($field_value) : $match_count > 0; - } - else if(self::matches_operation(GFFormsModel::maybe_trim_input(GFCommon::get_selection_value($field_value), rgar($source_field,"formId"),$source_field), $target_value, $operation)){ - $is_match = true; - } - return apply_filters( 'gform_is_value_match', $is_match, $field_value, $target_value, $operation, $source_field, $rule, $form ); - } + if ( is_array( $field_value ) ) { + $field_value = array_values( $field_value ); //returning array values, ignoring keys if array is associative + $match_count = 0; + foreach ( $field_value as $val ) { + $val = GFFormsModel::maybe_trim_input( GFCommon::get_selection_value( $val ), rgar( $source_field, 'formId' ), $source_field ); + if ( self::matches_operation( $val, $target_value, $operation ) ) { + $match_count ++; + } + } + // if operation is Is Not, none of the values in the array can match the target value. + $is_match = $operation == 'isnot' ? $match_count == count( $field_value ) : $match_count > 0; + } else if ( self::matches_operation( GFFormsModel::maybe_trim_input( GFCommon::get_selection_value( $field_value ), $form_id, $source_field ), $target_value, $operation ) ) { + $is_match = true; + } - private static function try_convert_float($text){ - global $wp_locale; - $number_format = $wp_locale->number_format['decimal_point'] == "," ? "decimal_comma" : "decimal_dot"; + return apply_filters( 'gform_is_value_match', $is_match, $field_value, $target_value, $operation, $source_field, $rule ); + } - if(is_numeric($text) && $number_format == "decimal_comma"){ - return GFCommon::format_number($text, "decimal_comma"); - } - else if(GFCommon::is_numeric($text, $number_format)){ - return GFCommon::clean_number($text, $number_format); - } + private static function try_convert_float( $text ) { + global $wp_locale; + $number_format = $wp_locale->number_format['decimal_point'] == ',' ? 'decimal_comma' : 'decimal_dot'; - return $text; - } + if ( is_numeric( $text ) && $number_format == 'decimal_comma' ) { + return GFCommon::format_number( $text, 'decimal_comma' ); + } else if ( GFCommon::is_numeric( $text, $number_format ) ) { + return GFCommon::clean_number( $text, $number_format ); + } - public static function matches_operation($val1, $val2, $operation){ + return $text; + } - $val1 = !rgblank($val1) ? strtolower($val1) : ""; - $val2 = !rgblank($val2) ? strtolower($val2) : ""; + public static function matches_operation( $val1, $val2, $operation ) { - switch($operation){ - case "is" : - return $val1 == $val2; - break; + $val1 = ! rgblank( $val1 ) ? strtolower( $val1 ) : ''; + $val2 = ! rgblank( $val2 ) ? strtolower( $val2 ) : ''; - case "isnot" : - return $val1 != $val2; - break; + switch ( $operation ) { + case 'is' : + return $val1 == $val2; + break; - case "greater_than": - case ">" : - $val1 = self::try_convert_float($val1); - $val2 = self::try_convert_float($val2); + case 'isnot' : + return $val1 != $val2; + break; - return $val1 > $val2; - break; + case 'greater_than': + case '>' : + $val1 = self::try_convert_float( $val1 ); + $val2 = self::try_convert_float( $val2 ); - case "less_than": - case "<" : - $val1 = self::try_convert_float($val1); - $val2 = self::try_convert_float($val2); + return $val1 > $val2; + break; - return $val1 < $val2; - break; + case 'less_than': + case '<' : + $val1 = self::try_convert_float( $val1 ); + $val2 = self::try_convert_float( $val2 ); - case "contains" : - return !empty($val2) && strpos($val1, $val2) !== false; - break; + return $val1 < $val2; + break; - case "starts_with" : - return !rgblank($val2) && strpos($val1, $val2) === 0; - break; + case 'contains' : + return ! empty( $val2 ) && strpos( $val1, $val2 ) !== false; + break; - case "ends_with" : - $start = strlen($val1) - strlen($val2); - if($start < 0) - return false; + case 'starts_with' : + return ! rgblank( $val2 ) && strpos( $val1, $val2 ) === 0; + break; - $tail = substr($val1, $start); - return $val2 == $tail; - break; - } + case 'ends_with' : + $start = strlen( $val1 ) - strlen( $val2 ); + if ( $start < 0 ) { + return false; + } + $tail = substr( $val1, $start ); - return false; - } + return $val2 == $tail; + break; + } - private static function get_field_display($form, $field, $field_values, $lead=null){ - $logic = rgar($field, "conditionalLogic"); + return false; + } - //if this field does not have any conditional logic associated with it, it won't be hidden - if(empty($logic)) - return "show"; + /** + * @param $form + * @param GF_Field $field + * @param $field_values + * @param null $lead + * + * @return string + */ + private static function get_field_display( $form, $field, $field_values, $lead = null ) { - $match_count = 0; - foreach($logic["rules"] as $rule){ - $source_field = RGFormsModel::get_field($form, $rule["fieldId"]); - $field_value = empty($lead) ? self::get_field_value($source_field, $field_values) : self::get_lead_field_value($lead, $source_field); + if ( empty( $field ) ) { + return 'show'; + } - $is_value_match = self::is_value_match( $field_value, $rule['value'], $rule['operator'], $source_field, $rule, $form ); + $logic = $field->conditionalLogic; - if($is_value_match) - $match_count++; - } + //if this field does not have any conditional logic associated with it, it won't be hidden + if ( empty( $logic ) ) { + return 'show'; + } - $do_action = ($logic["logicType"] == "all" && $match_count == sizeof($logic["rules"]) ) || ($logic["logicType"] == "any" && $match_count > 0); - $is_hidden = ($do_action && $logic["actionType"] == "hide") || (!$do_action && $logic["actionType"] == "show"); - return $is_hidden ? "hide" : "show"; - } + $match_count = 0; + foreach ( $logic['rules'] as $rule ) { + $source_field = RGFormsModel::get_field( $form, $rule['fieldId'] ); + $field_value = empty( $lead ) ? self::get_field_value( $source_field, $field_values ) : self::get_lead_field_value( $lead, $source_field ); - public static function get_custom_choices(){ - $choices = get_option("gform_custom_choices"); - if(!$choices) - $choices = array(); + $is_value_match = self::is_value_match( $field_value, $rule['value'], $rule['operator'], $source_field, $rule, $form ); - return $choices; - } + if ( $is_value_match ) { + $match_count ++; + } + } - public static function delete_custom_choice($name){ - $choices = self::get_custom_choices(); - if(array_key_exists($name, $choices)) - unset($choices[$name]); + $do_action = ( $logic['logicType'] == 'all' && $match_count == sizeof( $logic['rules'] ) ) || ( $logic['logicType'] == 'any' && $match_count > 0 ); + $is_hidden = ( $do_action && $logic['actionType'] == 'hide' ) || ( ! $do_action && $logic['actionType'] == 'show' ); - update_option("gform_custom_choices", $choices); - } + return $is_hidden ? 'hide' : 'show'; + } - public static function save_custom_choice($previous_name, $new_name, $choices){ - $all_choices = self::get_custom_choices(); + public static function get_custom_choices() { + $choices = get_option( 'gform_custom_choices' ); + if ( ! $choices ) { + $choices = array(); + } - if(array_key_exists($previous_name, $all_choices)) - unset($all_choices[$previous_name]); + return $choices; + } - $all_choices[$new_name] = $choices; + public static function delete_custom_choice( $name ) { + $choices = self::get_custom_choices(); + if ( array_key_exists( $name, $choices ) ) { + unset( $choices[ $name ] ); + } - update_option("gform_custom_choices", $all_choices); - } + update_option( 'gform_custom_choices', $choices ); + } - public static function get_field_value(&$field, $field_values = array(), $get_from_post=true){ - - if($field['type'] == 'post_category') - $field = GFCommon::add_categories_as_choices($field, ''); - - $value = array(); - switch(RGFormsModel::get_input_type($field)){ - case "post_image" : - $value[$field["id"] . ".1"] = self::get_input_value($field, "input_" . $field["id"] . "_1", $get_from_post); - $value[$field["id"] . ".4"] = self::get_input_value($field, "input_" . $field["id"] . "_4", $get_from_post); - $value[$field["id"] . ".7"] = self::get_input_value($field, "input_" . $field["id"] . "_7", $get_from_post); - break; - case "checkbox" : - $parameter_values = self::get_parameter_value( rgar( $field, 'inputName' ), $field_values, $field); - if(!empty($parameter_values) && !is_array($parameter_values)){ - $parameter_values = explode(",", $parameter_values); - } - - if(!is_array($field["inputs"])) - return ""; - - $choice_index = 0; - foreach($field["inputs"] as $input){ - if(!empty($_POST["is_submit_" . $field["formId"]]) && $get_from_post){ - $value[strval($input["id"])] = rgpost("input_" . str_replace('.', '_', strval($input["id"]))); - } - else{ - if(is_array($parameter_values)){ - foreach($parameter_values as $item){ - $item = trim($item); - if(self::choice_value_match($field, $field["choices"][$choice_index], $item)) - { - $value[$input["id"] . ""] = $item; - break; - } - } - } - } - $choice_index++; - } - - break; - - case "list" : - $value = self::get_input_value($field, "input_" . $field["id"], rgar($field, "inputName"), $field_values, $get_from_post); - $value = self::create_list_array($field, $value); - break; - - case "number" : - $value = self::get_input_value($field, "input_" . $field["id"], rgar($field, "inputName"), $field_values, $get_from_post); - $value = trim($value); - if($field["numberFormat"] == "currency"){ - require_once(GFCommon::get_base_path() . '/currency.php'); - $currency = new RGCurrency(GFCommon::get_currency()); - $value = $currency->to_number( $value ); - } - else if($field["numberFormat"] == "decimal_comma"){ - $value = GFCommon::clean_number($value, "decimal_comma"); - } - else if($field["numberFormat"] == "decimal_dot"){ - $value = GFCommon::clean_number($value, "decimal_dot"); - } - break; - - case "radio" : - $value = self::get_input_value($field, "input_" . $field["id"], rgar($field, "inputName"), $field_values, $get_from_post); - if ($value == "gf_other_choice"){ - //get value from text box - $value = self::get_input_value($field, "input_" . $field["id"] . "_other", rgar($field, "inputName"), $field_values, $get_from_post); - } - break; - - default: - - if(isset($field["inputs"]) && is_array($field["inputs"])){ - foreach($field["inputs"] as $input){ - $value[strval($input["id"])] = self::get_input_value($field, "input_" . str_replace('.', '_', strval($input["id"])), RGForms::get("name", $input), $field_values, $get_from_post); - } - } - else{ - $value = self::get_input_value($field, "input_" . $field["id"], rgar($field, "inputName"), $field_values, $get_from_post); - } - break; - } + public static function save_custom_choice( $previous_name, $new_name, $choices ) { + $all_choices = self::get_custom_choices(); - return $value; - } + if ( array_key_exists( $previous_name, $all_choices ) ) { + unset( $all_choices[ $previous_name ] ); + } - public static function maybe_trim_input($value, $form_id, $field){ - $trim_value = apply_filters("gform_trim_input_value", true, $form_id, $field); + $all_choices[ $new_name ] = $choices; - if($trim_value) - $value = is_array($value) ? array_map('trim', $value) : trim($value); + update_option( 'gform_custom_choices', $all_choices ); + } - return $value; - } - private static function get_input_value($field, $standard_name, $custom_name = "", $field_values=array(), $get_from_post=true){ - $form_id = rgar($field,"formId"); - if(!empty($_POST["is_submit_" . $form_id]) && $get_from_post){ - $value = rgpost($standard_name); - $value = self::maybe_trim_input($value, $form_id, $field); - return $value; - } - else if(rgar($field, "allowsPrepopulate")){ - return self::get_parameter_value($custom_name, $field_values, $field); - } - } + /** + * @param GF_Field $field + * @param array $field_values + * @param bool $get_from_post Whether to get the value from the $_POST array as opposed to $field_values + * + * @return array|mixed|string|void + */ + public static function get_field_value( &$field, $field_values = array(), $get_from_post = true ) { - public static function get_parameter_value($name, $field_values, $field){ - $value = stripslashes(rgget($name)); - if(empty($value)) - $value = rgget($name, $field_values); + if ( ! $field instanceof GF_Field ) { + $field = GF_Fields::create( $field ); + } - //converting list format - if(RGFormsModel::get_input_type($field) == "list"){ + if ( $field->type == 'post_category' ) { + $field = GFCommon::add_categories_as_choices( $field, '' ); + } - //transforms this: col1|col2,col1b|col2b into this: col1,col2,col1b,col2b - $column_count = count(rgar($field,"choices")); + $value = $field->get_value_submission( $field_values, $get_from_post ); - $rows = explode(",", $value); - $ary_rows = array(); - if(!empty($rows)){ - foreach($rows as $row) - $ary_rows = array_merge($ary_rows, rgexplode("|", $row, $column_count)); + return $value; + } - $value = $ary_rows; - } - } + public static function purge_expired_incomplete_submissions( $expiration_days = 30 ) { + global $wpdb; - return apply_filters( "gform_field_value_$name", apply_filters( 'gform_field_value', $value, $field, $name ), $field, $name ); - } + $expiration_days = apply_filters( 'gform_incomplete_submissions_expiration_days', $expiration_days ); - public static function get_default_value($field, $input_id){ - if(!is_array(rgar($field,"choices"))){ - if(is_array(rgar($field, "inputs"))){ - $input = RGFormsModel::get_input($field, $input_id); - return rgar($input, "defaultValue"); - } - else{ - return IS_ADMIN ? $field["defaultValue"] : GFCommon::replace_variables_prepopulate($field["defaultValue"]); - } - } - else if($field["type"] == "checkbox"){ - for($i=0, $count=sizeof($field["inputs"]); $i<$count; $i++){ - $input = $field["inputs"][$i]; - $choice = $field["choices"][$i]; - if($input["id"] == $input_id && rgar($choice, "isSelected")){ - return $choice["value"]; - } - } - return ""; - } - else{ - foreach($field["choices"] as $choice){ - if(rgar($choice,"isSelected") || $field["type"] == "post_category") - return $choice["value"]; - } - return ""; - } + $expiration_date = gmdate( 'Y-m-d H:i:s', time() - ( $expiration_days * 24 * 60 * 60 ) ); - } + $table = self::get_incomplete_submissions_table_name(); + $result = $wpdb->query( "DELETE FROM $table WHERE date_created < '$expiration_date'" ); - public static function get_input_type($field){ - return empty($field["inputType"]) ? rgar($field,"type") : $field["inputType"]; - } + return $result; + } - private static function get_post_field_value($field, $lead){ + public static function delete_incomplete_submission( $token ) { + global $wpdb; - if(isset($field["inputs"]) && is_array($field["inputs"])){ - $value = array(); - foreach($field["inputs"] as $input){ - $val = isset($lead[strval($input["id"])]) ? $lead[strval($input["id"])] : ""; - if(!empty($val)) { + $table = self::get_incomplete_submissions_table_name(); + $result = $wpdb->query( $wpdb->prepare( "DELETE FROM $table WHERE uuid = %s", $token ) ); - // replace commas in individual values to prevent individual value from being split into multiple values (checkboxes, multiselects) - if( in_array(RGFormsModel::get_input_type($field), array('checkbox', 'multiselect')) ) - $val = str_replace(',', ',', $val); + return $result; + } - $value[] = $val; - } - } - $value = implode(",", $value); - } - else{ - $value = isset($lead[$field["id"]]) ? $lead[$field["id"]] : ""; - } - return $value; - } + public static function save_incomplete_submission( $form, $entry, $field_values, $page_number, $files, $form_unique_id, $ip, $source_url, $resume_token = '' ) { + if ( ! is_array( $form['fields'] ) ) { + return; + } + global $wpdb; - private static function get_post_fields($form, $lead) { + $submitted_values = array(); + foreach ( $form['fields'] as $field ) { + /* @var GF_Field $field */ + $submitted_values[ $field->id ] = RGFormsModel::get_field_value( $field, $field_values ); + } - $post_data = array(); - $post_data["post_custom_fields"] = array(); - $post_data["tags_input"] = array(); - $categories = array(); - $images = array(); + $submitted_values = apply_filters( 'gform_submission_values_pre_save', $submitted_values, $form ); + + $submission['submitted_values'] = $submitted_values; + $submission['partial_entry'] = $entry; + $submission['field_values'] = $field_values; + $submission['page_number'] = $page_number; + $submission['files'] = $files; + $submission['gform_unique_id'] = $form_unique_id; + if ( empty( $resume_token ) ) { + $resume_token = self::get_uuid(); + + $result = $wpdb->insert( + self::get_incomplete_submissions_table_name(), + array( + 'uuid' => $resume_token, + 'form_id' => $form['id'], + 'date_created' => current_time( 'mysql', true ), + 'submission' => json_encode( $submission ), + 'ip' => $ip, + 'source_url' => $source_url, + ), + array( + '%s', + '%d', + '%s', + '%s', + '%s', + '%s', + ) + ); + } else { + $result = $wpdb->update( + self::get_incomplete_submissions_table_name(), + array( + 'form_id' => $form['id'], + 'date_created' => current_time( 'mysql', true ), + 'submission' => json_encode( $submission ), + 'ip' => $ip, + 'source_url' => $source_url, + ), + array( 'uuid' => $resume_token ), + array( + '%d', + '%s', + '%s', + '%s', + '%s', + ), + array( '%s' ) ); + } - foreach($form["fields"] as $field){ + do_action( 'gform_incomplete_submission_post_save', $submission, $resume_token, $form, $entry ); - if($field['type'] == 'post_category') - $field = GFCommon::add_categories_as_choices($field, ''); + return $result ? $resume_token : $result; + } - $value = self::get_post_field_value($field, $lead); + /** + * Returns a UUID. Uses openssl_random_pseudo_bytes() if available and falls back to mt_rand(). + * + * source: http://stackoverflow.com/questions/2040240/php-function-to-generate-v4-uuid + * + * @param string $s The separator e.g. '-' + * + * @return string + */ + public static function get_uuid( $s = '' ) { - switch($field["type"]){ - case "post_title" : - case "post_excerpt" : - case "post_content" : - $post_data[$field["type"]] = $value; - break; + if ( function_exists( 'openssl_random_pseudo_bytes' ) ) { // PHP 5 >= 5.3.0 + $data = openssl_random_pseudo_bytes( 16 ); - case "post_tags" : - $tags = explode(",", $value); - if(is_array($tags) && sizeof($tags) > 0) - $post_data["tags_input"] = array_merge($post_data["tags_input"], $tags) ; - break; + $data[6] = chr( ord( $data[6] ) & 0x0f | 0x40 ); // set version to 0100 + $data[8] = chr( ord( $data[8] ) & 0x3f | 0x80 ); // set bits 6-7 to 10 - case "post_custom_field" : + return vsprintf( "%s%s{$s}%s{$s}%s{$s}%s{$s}%s%s%s", str_split( bin2hex( $data ), 4 ) ); + } else { + return sprintf( + "%04x%04x{$s}%04x{$s}%04x{$s}%04x{$s}%04x%04x%04x", + // 32 bits for "time_low" + mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ), + + // 16 bits for 'time_mid' + mt_rand( 0, 0xffff ), + + // 16 bits for 'time_hi_and_version', + // four most significant bits holds version number 4 + mt_rand( 0, 0x0fff ) | 0x4000, + + // 16 bits, 8 bits for 'clk_seq_hi_res', + // 8 bits for 'clk_seq_low', + // two most significant bits holds zero and one for variant DCE1.1 + mt_rand( 0, 0x3fff ) | 0x8000, + + // 48 bits for 'node' + mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ) + ); + } - $type = self::get_input_type($field); - if("fileupload" === $type && rgar($field, "multipleFiles")) - $value = json_decode($value, true); + } - $meta_name = $field["postCustomFieldName"]; + public static function get_incomplete_submission_values( $token ) { + global $wpdb; - if(!isset($post_data["post_custom_fields"][$meta_name])){ - $post_data["post_custom_fields"][$meta_name] = $value; - } - else if(!is_array($post_data["post_custom_fields"][$meta_name])){ - $post_data["post_custom_fields"][$meta_name] = array($post_data["post_custom_fields"][$meta_name], $value); - } - else{ - $post_data["post_custom_fields"][$meta_name][] = $value; - } + self::purge_expired_incomplete_submissions(); - break; + $table = self::get_incomplete_submissions_table_name(); + $sql = $wpdb->prepare( "SELECT date_created, form_id, submission FROM {$table} WHERE uuid = %s", $token ); + $row = $wpdb->get_row( $sql, ARRAY_A ); - case "post_category" : - GFCommon::log_debug('post category:' . $value); - foreach(explode(',', $value) as $cat_string) { - list($cat_name, $cat_id) = rgexplode(":", $cat_string, 2); - GFCommon::log_debug("adding cat:{$cat_name}({$cat_id})"); - array_push($categories, $cat_id); - } - break; + return $row; + } - case "post_image" : - $ary = !empty($value) ? explode("|:|", $value) : array(); - $url = count($ary) > 0 ? $ary[0] : ""; - $title = count($ary) > 1 ? $ary[1] : ""; - $caption = count($ary) > 2 ? $ary[2] : ""; - $description = count($ary) > 3 ? $ary[3] : ""; + public static function add_email_to_incomplete_sumbmission( $token, $email ) { + global $wpdb; + self::purge_expired_incomplete_submissions(); + $table = self::get_incomplete_submissions_table_name(); + $sql = $wpdb->prepare( "UPDATE $table SET email = %s WHERE uuid = %s", $email, $token ); + $result = $wpdb->query( $sql ); - array_push($images, array("field_id" => $field["id"], "url" => $url, "title" => $title, "description" => $description, "caption" => $caption)); - break; - } - } + return $result; + } - $post_data["post_status"] = rgar($form, "postStatus"); - $post_data["post_category"] = !empty($categories) ? $categories : array(rgar($form, 'postCategory')); - $post_data["images"] = $images; + public static function maybe_trim_input( $value, $form_id, $field ) { + $trim_value = apply_filters( 'gform_trim_input_value', true, $form_id, $field ); - //setting current user as author depending on settings - $post_data["post_author"] = $form["useCurrentUserAsAuthor"] && !empty($lead["created_by"]) ? $lead["created_by"] : $form["postAuthor"]; + if ( $trim_value ) { + $value = is_array( $value ) ? array_map( 'trim', $value ) : trim( $value ); + } - return $post_data; - } + return $value; + } - public static function get_custom_field_names(){ - global $wpdb; - $keys = $wpdb->get_col( " - SELECT meta_key - FROM $wpdb->postmeta - WHERE meta_key NOT LIKE '\_%' - GROUP BY meta_key - ORDER BY meta_id DESC"); + public static function get_parameter_value( $name, $field_values, $field ) { + $value = stripslashes( rgget( $name ) ); + if ( empty( $value ) ) { + $value = rgget( $name, $field_values ); + } - if ( $keys ) - natcasesort($keys); + //converting list format + if ( RGFormsModel::get_input_type( $field ) == 'list' ) { - return $keys; - } + //transforms this: col1|col2,col1b|col2b into this: col1,col2,col1b,col2b + $column_count = count( $field->choices ); - public static function get_input_masks(){ + $rows = explode( ',', $value ); + $ary_rows = array(); + if ( ! empty( $rows ) ) { + foreach ( $rows as $row ) { + $ary_rows = array_merge( $ary_rows, rgexplode( '|', $row, $column_count ) ); + } - $masks = array( - 'US Phone' => '(999) 999-9999', - 'US Phone + Ext' => '(999) 999-9999? x99999', - 'Date' => '99/99/9999', - 'Tax ID' => '99-9999999', - 'SSN' => '999-99-9999', - 'Zip Code' => '99999', - 'Full Zip Code' => '99999?-9999' - ); + $value = $ary_rows; + } + } - return apply_filters('gform_input_masks', $masks); - } + return apply_filters( "gform_field_value_$name", apply_filters( 'gform_field_value', $value, $field, $name ), $field, $name ); + } - private static function get_default_post_title(){ - global $wpdb; - $title = "Untitled"; - $count = 1; - - $titles = $wpdb->get_col("SELECT post_title FROM $wpdb->posts WHERE post_title like '%Untitled%'"); - $titles = array_values($titles); - while(in_array($title, $titles)){ - $title = "Untitled_$count"; - $count++; - } - return $title; - } + public static function get_default_value( $field, $input_id ) { + if ( ! is_array( $field->choices ) ) { + if ( is_array( $field->inputs ) ) { + $input = RGFormsModel::get_input( $field, $input_id ); + + return rgar( $input, 'defaultValue' ); + } else { + return IS_ADMIN ? $field->defaultValue : GFCommon::replace_variables_prepopulate( $field->defaultValue ); + } + } else if ( $field->type == 'checkbox' ) { + for ( $i = 0, $count = sizeof( $field->inputs ); $i < $count; $i ++ ) { + $input = $field->inputs[ $i ]; + $choice = $field->choices[ $i ]; + if ( $input['id'] == $input_id && rgar( $choice, 'isSelected' ) ) { + return $choice['value']; + } + } - public static function prepare_date($date_format, $value){ - $format = empty($date_format) ? "mdy" : $date_format; - $date_info = GFCommon::parse_date($value, $format); - if(!empty($date_info) && !GFCommon::is_empty_array($date_info)) - $value = sprintf("%s-%02d-%02d", $date_info["year"], $date_info["month"], $date_info["day"]); - else - $value = ""; + return ''; + } else { + foreach ( $field->choices as $choice ) { + if ( rgar( $choice, 'isSelected' ) || $field->type == 'post_category' ) { + return $choice['value']; + } + } - return $value; - } + return ''; + } - /** - * Prepare the value before saving it to the lead. - * - * @param mixed $form - * @param mixed $field - * @param mixed $value - * @param mixed $input_name - * @param mixed $lead_id the current lead ID, used for fields that are processed after other fields have been saved (ie Total, Calculations) - * @param mixed $lead passed by the RGFormsModel::create_lead() method, lead ID is not available for leads created by this function - */ - public static function prepare_value($form, $field, $value, $input_name, $lead_id, $lead = array()){ - $form_id = $form["id"]; - - $input_type = self::get_input_type($field); - switch($input_type) - { - case "total" : - $lead = empty($lead) ? RGFormsModel::get_lead($lead_id) : $lead; - $value = GFCommon::get_order_total($form, $lead); - break; - - case "calculation" : - // ignore submitted value and recalculate price in backend - list(,,$input_id) = rgexplode("_", $input_name, 3); - if($input_id == 2) { - require_once(GFCommon::get_base_path() . '/currency.php'); - $currency = new RGCurrency(GFCommon::get_currency()); - $lead = empty($lead) ? RGFormsModel::get_lead($lead_id) : $lead; - $value = $currency->to_money(GFCommon::calculate($field, $form, $lead)); - } - break; - - case "phone" : - if($field["phoneFormat"] == "standard" && preg_match('/^\D?(\d{3})\D?\D?(\d{3})\D?(\d{4})$/', $value, $matches)) - $value = sprintf("(%s)%s-%s", $matches[1], $matches[2], $matches[3]); - break; - - case "time": - - if(!is_array($value) && !empty($value)){ - preg_match('/^(\d*):(\d*) ?(.*)$/', $value, $matches); - $value = array(); - $value[0] = $matches[1]; - $value[1] = $matches[2]; - $value[2] = rgar($matches,3); - } - - $hour = empty($value[0]) ? "0" : strip_tags($value[0]); - $minute = empty($value[1]) ? "0" : strip_tags($value[1]); - $ampm = strip_tags(rgar($value,2)); - if(!empty($ampm)) - $ampm = " $ampm"; - - if(!(empty($hour) && empty($minute))) - $value = sprintf("%02d:%02d%s", $hour, $minute, $ampm); - else - $value = ""; - - break; - - case "date" : - $value = self::prepare_date( rgar( $field, 'dateFormat' ), $value); - - break; - - case "post_image": - $url = self::get_fileupload_value($form_id, $input_name); - $image_title = isset($_POST["{$input_name}_1"]) ? strip_tags($_POST["{$input_name}_1"]) : ""; - $image_caption = isset($_POST["{$input_name}_4"]) ? strip_tags($_POST["{$input_name}_4"]) : ""; - $image_description = isset($_POST["{$input_name}_7"]) ? strip_tags($_POST["{$input_name}_7"]) : ""; - - $value = !empty($url) ? $url . "|:|" . $image_title . "|:|" . $image_caption . "|:|" . $image_description : ""; - break; - - case "fileupload" : - if(rgar($field, "multipleFiles")){ - - global $_gf_uploaded_files; - - if ( isset( $_gf_uploaded_files[ $input_name ] ) ) { - $value = $_gf_uploaded_files[ $input_name ]; - } else { - if ( isset( GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] ) ) { - $uploaded_temp_files = GFFormsModel::$uploaded_files[ $form_id ][ $input_name ]; - $uploaded_files = array(); - foreach ( $uploaded_temp_files as $i => $file_info ) { - $temp_filepath = self::get_upload_path( $form_id ) . '/tmp/' . $file_info['temp_filename']; - if ( $file_info && file_exists( $temp_filepath ) ) { - $uploaded_files[ $i ] = self::move_temp_file( $form_id, $file_info ); - } - } - - if ( ! empty( $value ) ) { // merge with existing files (admin edit entry) - $value = json_decode( $value, true ); - $value = array_merge( $value, $uploaded_files ); - $value = json_encode( $value ); - } else { - $value = json_encode( $uploaded_files ); - } - } else { - $value = ''; - } - $_gf_uploaded_files[ $input_name ] = $value; - } - - } else { - $value = self::get_fileupload_value($form_id, $input_name); - } - break; - - case "number" : - - $value = GFCommon::maybe_add_leading_zero($value); - - $is_hidden = RGFormsModel::is_field_hidden($form, $field, array()); - $lead = empty($lead) ? RGFormsModel::get_lead($lead_id) : $lead; - $value = GFCommon::has_field_calculation($field) ? GFCommon::round_number(GFCommon::calculate($field, $form, $lead), rgar($field, "calculationRounding")) : GFCommon::clean_number($value, rgar($field, "numberFormat")); - //return the value as a string when it is zero and a calc so that the "==" comparison done when checking if the field has changed isn't treated as false - if (GFCommon::has_field_calculation($field) && $value == 0){ - $value = "0"; - } - break; - - case "website" : - if($value == "http://") - $value = ""; - break; - - case "list" : - - if(rgar($field, "adminOnly") && rgar($field, "allowsPrepopulate")) - $value = json_decode($value); - - if(GFCommon::is_empty_array($value)){ - $value = ""; + } + + /** + * @param GF_Field $field + * + * @return string + */ + public static function get_input_type( $field ) { + if ( ! $field instanceof GF_Field ) { + return empty( $field['inputType'] ) ? $field['type'] : $field['inputType']; + } + + return empty( $field->inputType ) ? $field->type : $field->inputType; + } + + private static function get_post_field_value( $field, $lead ) { + + if ( is_array( $field->inputs ) ) { + $value = array(); + foreach ( $field->inputs as $input ) { + $val = isset( $lead[ strval( $input['id'] ) ] ) ? $lead[ strval( $input['id'] ) ] : ''; + if ( ! empty( $val ) ) { + + // replace commas in individual values to prevent individual value from being split into multiple values (checkboxes, multiselects) + if ( in_array( RGFormsModel::get_input_type( $field ), array( 'checkbox', 'multiselect' ) ) ) { + $val = str_replace( ',', ',', $val ); + } + + $value[] = $val; } - else{ + } + $value = implode( ',', $value ); + } else { + $value = isset( $lead[ $field->id ] ) ? $lead[ $field->id ] : ''; + } + + return $value; + } + + private static function get_post_fields( $form, $lead ) { + + $post_data = array(); + $post_data['post_custom_fields'] = array(); + $post_data['tags_input'] = array(); + $categories = array(); + $images = array(); + + foreach ( $form['fields'] as $field ) { + + if ( $field->type == 'post_category' ) { + $field = GFCommon::add_categories_as_choices( $field, '' ); + } + + $value = self::get_post_field_value( $field, $lead ); - foreach( $value as &$val ){ - $val = self::sanitize_entry_value( $field, $val, $input_type, $form_id ); + switch ( $field->type ) { + case 'post_title' : + case 'post_excerpt' : + case 'post_content' : + $post_data[ $field->type ] = $value; + break; + + case 'post_tags' : + $tags = explode( ',', $value ); + if ( is_array( $tags ) && sizeof( $tags ) > 0 ) { + $post_data['tags_input'] = array_merge( $post_data['tags_input'], $tags ); } + break; - $value = self::create_list_array($field, $value); - $value = serialize($value); - } - break; + case 'post_custom_field' : - case "radio" : - if(rgar($field, 'enableOtherChoice') && $value == 'gf_other_choice'){ - $value = rgpost("input_{$field['id']}_other"); - } - $value = self::sanitize_entry_value( $field, $value, $input_type, $form_id); + $type = self::get_input_type( $field ); + if ( 'fileupload' === $type && $field->multipleFiles ) { + $value = json_decode( $value, true ); + } - break; + $meta_name = $field->postCustomFieldName; - case "multiselect" : - $value = empty($value) ? "" : is_array($value) ? implode(",", $value) : $value; + if ( ! isset( $post_data['post_custom_fields'][ $meta_name ] ) ) { + $post_data['post_custom_fields'][ $meta_name ] = $value; + } else if ( ! is_array( $post_data['post_custom_fields'][ $meta_name ] ) ) { + $post_data['post_custom_fields'][ $meta_name ] = array( $post_data['post_custom_fields'][ $meta_name ], $value ); + } else { + $post_data['post_custom_fields'][ $meta_name ][] = $value; + } - $value = self::sanitize_entry_value( $field, $value, $input_type, $form_id ); + break; - break; + case 'post_category' : + foreach ( explode( ',', $value ) as $cat_string ) { + list( $cat_name, $cat_id ) = rgexplode( ':', $cat_string, 2 ); + array_push( $categories, $cat_id ); + } + break; + + case 'post_image' : + $ary = ! empty( $value ) ? explode( '|:|', $value ) : array(); + $url = count( $ary ) > 0 ? $ary[0] : ''; + $title = count( $ary ) > 1 ? $ary[1] : ''; + $caption = count( $ary ) > 2 ? $ary[2] : ''; + $description = count( $ary ) > 3 ? $ary[3] : ''; + + array_push( $images, array( 'field_id' => $field->id, 'url' => $url, 'title' => $title, 'description' => $description, 'caption' => $caption ) ); + break; + } + } - case "creditcard" : - //saving last 4 digits of credit card - list($input_token, $field_id_token, $input_id) = rgexplode("_", $input_name, 3); - if($input_id == "1"){ - $value = str_replace(" ", "", $value); - $card_number_length = strlen($value); - $value = substr($value, -4, 4); - $value = str_pad($value, $card_number_length, "X", STR_PAD_LEFT); - } - else if( $input_id == '4' ) { + $post_data['post_status'] = rgar( $form, 'postStatus' ); + $post_data['post_category'] = ! empty( $categories ) ? $categories : array( rgar( $form, 'postCategory' ) ); + $post_data['images'] = $images; - $value = rgpost( "input_{$field_id_token}_4" ); + //setting current user as author depending on settings + $post_data['post_author'] = $form['useCurrentUserAsAuthor'] && ! empty( $lead['created_by'] ) ? $lead['created_by'] : $form['postAuthor']; - if( ! $value ) { - $card_number = rgpost( "input_{$field_id_token}_1" ); - $card_type = GFCommon::get_card_type( $card_number ); - $value = $card_type ? $card_type['name'] : ''; - } + return $post_data; + } - } - else{ - $value = ""; - } + public static function get_custom_field_names() { + global $wpdb; + $keys = $wpdb->get_col( + " + SELECT meta_key + FROM $wpdb->postmeta + WHERE meta_key NOT LIKE '\_%' + GROUP BY meta_key + ORDER BY meta_id DESC" + ); - break; + if ( $keys ) { + natcasesort( $keys ); + } - case 'password': + return $keys; + } - $encrypt_password = apply_filters( 'gform_encrypt_password', false, $field, $form ); - if( $encrypt_password ) { - $value = GFCommon::encrypt( $value ); - self::set_encrypted_fields( $lead_id, $field['id'] ); - } + public static function get_input_masks() { - break; + $masks = array( + 'US Phone' => '(999) 999-9999', + 'US Phone + Ext' => '(999) 999-9999? x99999', + 'Date' => '99/99/9999', + 'Tax ID' => '99-9999999', + 'SSN' => '999-99-9999', + 'Zip Code' => '99999', + 'Full Zip Code' => '99999?-9999', + ); - default: + return apply_filters( 'gform_input_masks', $masks ); + } - // only filter HTML on non-array based values - if( ! is_array( $value ) ) { - $value = self::sanitize_entry_value( $field, $value, $input_type, $form_id ); - } + private static function get_default_post_title() { + global $wpdb; + $title = 'Untitled'; + $count = 1; + + $titles = $wpdb->get_col( "SELECT post_title FROM $wpdb->posts WHERE post_title like '%Untitled%'" ); + $titles = array_values( $titles ); + while ( in_array( $title, $titles ) ) { + $title = "Untitled_$count"; + $count ++; + } - break; - } + return $title; + } - // special format for Post Category fields - if($field['type'] == 'post_category') { + public static function prepare_date( $date_format, $value ) { + $format = empty( $date_format ) ? 'mdy' : $date_format; + $date_info = GFCommon::parse_date( $value, $format ); + if ( ! empty( $date_info ) && ! GFCommon::is_empty_array( $date_info ) ) { + $value = sprintf( '%s-%02d-%02d', $date_info['year'], $date_info['month'], $date_info['day'] ); + } else { + $value = ''; + } - $full_values = array(); + return $value; + } - if(!is_array($value)) - $value = explode(',', $value); + /** + * Prepare the value before saving it to the lead. + * + * @param mixed $form + * @param GF_Field $field + * @param mixed $value + * @param mixed $input_name + * @param mixed $lead_id the current lead ID, used for fields that are processed after other fields have been saved (ie Total, Calculations) + * @param mixed $lead passed by the RGFormsModel::create_lead() method, lead ID is not available for leads created by this function + * + * @return mixed + */ + public static function prepare_value( $form, $field, $value, $input_name, $lead_id, $lead = array() ) { - foreach($value as $cat_id) { - $cat = get_term($cat_id, 'category'); - $full_values[] = !is_wp_error($cat) && is_object($cat) ? $cat->name . ":" . $cat_id : ""; - } + $value = $field->get_value_save_entry( $value, $form, $input_name, $lead_id, $lead ); - $value = implode(',', $full_values); - } - //do not save price fields with blank price - if(rgar($field, "enablePrice")){ - $ary = explode("|", $value); - $label = count($ary) > 0 ? $ary[0] : ""; - $price = count($ary) > 1 ? $ary[1] : ""; + // special format for Post Category fields + if ( $field->type == 'post_category' ) { - $is_empty = (strlen(trim($price)) <= 0); - if($is_empty) - $value = ""; - } + $full_values = array(); - return $value; - } + if ( ! is_array( $value ) ) { + $value = explode( ',', $value ); + } - public static function strip_script_tag( $string ){ - - $do_strip = apply_filters("gform_strip_script_tag", true, $string); - if ( ! $do_strip ){ - return $string; - } - - $allowable_tags = '


    - - - - - - - - - - _slug, array( $this, 'results_cron' ), 10, 3 ); + + return; + } + parent::__construct(); + } + + public function init_ajax() { + parent::init_ajax(); + add_action( 'wp_ajax_gfwebapi_qrcode', array( $this, 'ajax_qrcode' ) ); + } + + public function init_admin() { + parent::init_admin(); + // update the cache meta + add_action( 'gform_after_update_entry', array( $this, 'entry_updated' ), 10, 2 ); + add_action( 'gform_update_status', array( $this, 'update_entry_status' ), 10, 2 ); + add_action( 'gform_after_save_form', array( $this, 'after_save_form' ), 10, 2 ); + } + + + public function init_frontend() { + $settings = $this->get_plugin_settings(); + $this->_enabled = rgar( $settings, 'enabled' ); + $this->_public_key = rgar( $settings, 'public_key' ); + $this->_private_key = rgar( $settings, 'private_key' ); + + if ( false == $this->_enabled ) { + return; } - else{ + + add_filter( 'option_rewrite_rules', array( $this, 'rewrite_rules' ) ); + + add_filter( 'query_vars', array( $this, 'query_vars' ) ); + + add_filter( 'pre_get_posts', array( $this, 'handle_page_request' ) ); + + // update the cache + add_action( 'gform_entry_created', array( $this, 'entry_created' ), 10, 2 ); + } + + // Scripts + public function scripts() { + $scripts = array( + array( + 'handle' => 'gfwebapi_hmac_sha1', + 'src' => 'https://crypto-js.googlecode.com/svn/tags/3.1.2/build/rollups/hmac-sha1.js', + 'enqueue' => array( + array( 'admin_page' => array( 'plugin_settings' ) ), + ) + ), + array( + 'handle' => 'gfwebapi_enc_base64', + 'src' => 'https://crypto-js.googlecode.com/svn/tags/3.1.2/build/components/enc-base64-min.js', + 'deps' => array( 'gfwebapi_hmac_sha1' ), + 'callback' => array( $this, 'localize_form_settings_scripts' ), + 'enqueue' => array( + array( 'admin_page' => array( 'plugin_settings' ) ), + ) + ), + array( + 'handle' => 'gfwebapi_settings.js', + 'src' => GFCommon::get_base_url() . '/includes/webapi/js/gfwebapi_settings.js', + 'version' => $this->_version, + 'deps' => array( 'jquery', 'thickbox' ), + 'enqueue' => array( + array( 'admin_page' => array( 'plugin_settings' ) ), + ) + ), + ); + + return array_merge( parent::scripts(), $scripts ); + } + + public function styles() { + $styles = array( + array( + 'handle' => 'gfwebap_settings', + 'src' => GFCommon::get_base_url() . '/includes/webapi/css/gfwebapi_settings.css', + 'version' => $this->_version, + 'deps' => array( 'thickbox' ), + 'enqueue' => array( + array( 'admin_page' => array( 'plugin_settings' ) ), + ) + ), + ); + + return array_merge( parent::scripts(), $styles ); + } + + public function render_uninstall() { + } + + // ------- Plugin settings ------- + + public function plugin_settings_title() { + return __( 'Gravity Forms API Settings', 'gravityforms' ); + } + + public function plugin_settings_fields() { + + $args = apply_filters( 'gform_webapi_get_users_settings_page', array( 'number' => 200 ) ); + + $accounts = get_users( $args ); + + $account_choices = array(); + foreach ( $accounts as $account ) { + $account_choices[] = array( 'label' => $account->user_login, 'value' => $account->ID ); + } + $permalink_structure = get_option( 'permalink_structure' ); + if ( ! $permalink_structure ) { + return array( + array( + 'description' => __( 'The Gravity Forms API allows developers to interact with this install via a JSON REST API.', 'gravityforms' ), + 'fields' => array( + array( + 'name' => 'requirements_check', + 'label' => __( 'Requirements check', 'gravityforms' ), + 'type' => 'requirements_check', + ), + ) + ), + ); + } + + + return array( + array( + 'description' => __( 'The Gravity Forms API allows developers to interact with this install via a JSON REST API.', 'gravityforms' ), + 'fields' => array( + array( + 'type' => 'checkbox', + 'label' => __( 'Enable access to the API', 'gravityforms' ), + 'name' => 'activate', + 'onclick' => 'gfapiToggleSettings(jQuery(this).prop("checked"))', + 'choices' => array( + array( 'label' => __( 'Enabled', 'gravityforms' ), 'name' => 'enabled' ), + ) + ), + array( + 'name' => 'public_key', + 'label' => __( 'Public API Key', 'gravityforms' ), + 'type' => 'text', + 'default_value' => substr( wp_hash( site_url() ), 0, 10 ), + 'class' => 'medium', + 'feedback_callback' => array( $this, 'is_valid_public_key' ), + ), + array( + 'name' => 'private_key', + 'label' => __( 'Private API Key', 'gravityforms' ), + 'type' => 'text', + 'default_value' => substr( wp_hash( get_bloginfo( 'admin_email' ) ), 0, 15 ), + 'class' => 'medium', + 'feedback_callback' => array( $this, 'is_valid_private_key' ) + ), + array( + 'name' => 'qrcode', + 'label' => __( 'QR Code', 'gravityforms' ), + 'type' => 'qrcode', + 'dependency' => array( 'field' => 'private_key', 'values' => array( '_notempty_' ) ) + ), + array( + 'name' => 'impersonate_account', + 'label' => __( 'Impersonate account', 'gravityforms' ), + 'type' => 'select', + 'choices' => $account_choices, + ), + array( + 'name' => 'developer_tools', + 'label' => __( 'Developer tools', 'gravityforms' ), + 'type' => 'developer_tools', + 'dependency' => array( 'field' => 'private_key', 'values' => array( '_notempty_' ) ) + ), + ) + ), + ); + } + + public function settings_requirements_check() { + $permalinks_url = admin_url( 'options-permalink.php' ); + echo " Permalinks are not in the correct format.
    Change the WordPress Permalink Settings from default to any of the other options to get started."; + } + + public function settings_qrcode() { + ?> + + + + + + + + + + + die_not_authorized(); + } + + $account_id = $settings['impersonate_account']; + wp_set_current_user( $account_id ); + + $route_parts = pathinfo( $route ); + + $format = rgar( $route_parts, 'extension' ); + if ( $format ) { + $route = str_replace( '.' . $format, '', $route ); + } + + $path_array = explode( '/', $route ); + $collection = strtolower( rgar( $path_array, 0 ) ); + + $id = rgar( $path_array, 1 ); + + if ( strpos( $id, ';' ) !== false ) { + $id = explode( ';', $id ); + } + + $collection2 = strtolower( rgar( $path_array, 2 ) ); + $id2 = rgar( $path_array, 3 ); + + if ( strpos( $id2, ';' ) !== false ) { + $id2 = explode( ';', $id2 ); + } + + + if ( empty( $format ) ) { + $format = 'json'; + } + + $schema = strtolower( ( rgget( 'schema' ) ) ); + $offset = isset( $_GET['paging']['offset'] ) ? strtolower( $_GET['paging']['offset'] ) : 0; + $page_size = isset( $_GET['paging']['page_size'] ) ? strtolower( $_GET['paging']['page_size'] ) : 10; + + $method = strtoupper( $_SERVER['REQUEST_METHOD'] ); + $args = compact( 'offset', 'page_size', 'schema' ); + if ( empty( $collection2 ) ) { + do_action( 'gform_webapi_' . strtolower( $method ) . '_' . $collection, $id, $format, $args ); + } else { + do_action( 'gform_webapi_' . strtolower( $method ) . '_' . $collection . '_' . $collection2, $id, $id2, $format, $args ); + } + + if ( ! isset( $HTTP_RAW_POST_DATA ) ) { + $HTTP_RAW_POST_DATA = file_get_contents( 'php://input' ); + } + + GFCommon::log_debug( 'GFWebAPI::handle_page_request(): HTTP_RAW_POST_DATA = ' . $HTTP_RAW_POST_DATA ); + + + $data = json_decode( $HTTP_RAW_POST_DATA, true ); + + switch ( $collection ) { + case 'forms' : + switch ( $collection2 ) { + case 'results' : + switch ( $method ) { + case 'GET' : + $this->get_results( $id ); + break; + case 'DELETE': + case 'PUT': + case 'POST': + default: + $this->die_bad_request(); + } + break; + case 'properties' : + switch ( $method ) { + case 'PUT' : + $this->put_forms_properties( $data, $id ); + break; + default: + $this->die_bad_request(); + } + break; + case 'feeds' : + if ( false == empty( $id2 ) ) { + $this->die_bad_request(); + } + switch ( $method ) { + case 'GET' : + $this->get_feeds( null, $id ); + break; + case 'DELETE' : + $this->delete_feeds( null, $id ); + break; + case 'PUT' : + $this->die_not_implemented(); + break; + case 'POST' : + $this->post_feeds( $data, $id ); + break; + default : + $this->die_bad_request(); + } + break; + case 'entries' : + if ( false == empty( $id2 ) ) { + $this->die_bad_request(); + } + switch ( $method ) { + case 'GET' : + $this->get_entries( null, $id, $schema ); + break; + case 'POST' : + $this->post_entries( $data, $id ); + break; + case 'PUT' : + case 'DELETE' : + $this->die_not_implemented(); + break; + default: + $this->die_bad_request(); + } + break; + + case '' : + switch ( $method ) { + case 'GET': + $this->get_forms( $id, $schema ); + break; + case 'DELETE': + $this->delete_forms( $id ); + break; + case 'PUT': + $this->put_forms( $data, $id, $id2 ); + break; + case 'POST': + if ( false === empty( $id ) ) { + $this->die_bad_request(); + } + $this->post_forms( $data, $id ); + break; + default: + $this->die_bad_request(); + } + break; + default : + $this->die_bad_request(); + break; + + } + break; + case 'entries' : // route = /entries/{id} + switch ( $method ) { + case 'GET': + switch ( $collection2 ) { + case 'fields' : // route = /entries/{id}/fields/{id2} + $this->get_entries( $id, null, $schema, $id2 ); + break; + case '' : + $this->get_entries( $id, null, $schema ); + break; + default : + $this->die_bad_request(); + } + + break; + case 'DELETE' : + $this->delete_entries( $id ); + break; + case 'PUT' : + switch ( $collection2 ) { + case 'properties' : // route = /entries/{id}/properties/{id2} + $this->put_entry_properties( $data, $id ); + break; + case '' : + $this->put_entries( $data, $id ); + break; + } + + break; + case 'POST' : + if ( false === empty( $id ) ) { + $this->die_bad_request(); + } + $this->post_entries( $data ); + break; + default: + $this->die_bad_request(); + } + break; + case 'feeds' : + switch ( $method ) { + case 'GET' : + $this->get_feeds( $id ); + break; + case 'DELETE' : + if ( empty( $id ) ) { + $this->die_bad_request(); + } + $this->delete_feeds( $id ); + break; + case 'PUT' : + $this->put_feeds( $data, $id ); + break; + case 'POST' : + if ( false === empty( $id ) ) { + $this->die_bad_request(); + } + $this->post_feeds( $data ); + break; + default : + $this->die_bad_request(); + } + break; + default : + $this->die_bad_request(); + break; + } + + + $this->die_bad_request(); + + } + + public function authorize( $caps = array() ) { + + if ( GFCommon::current_user_can_any( $caps ) ) { + + GFCommon::add_api_call(); + + return true; + } + + $this->die_permission_denied(); + } + + //----- Feeds ------ + + public function get_feeds( $feed_ids, $form_id = null ) { + + $this->authorize( 'gravityforms_edit_forms' ); + + $addon_slug = rgget( 'addon' ); + $output = GFAPI::get_feeds( $feed_ids, $form_id, $addon_slug ); + if ( is_wp_error( $output ) ) { + $this->die_not_found(); + } + + $response = false === empty( $feed_ids ) && false === is_array( $feed_ids ) && is_array( $output ) ? array_shift( $output ) : ''; + + $this->end( 200, $response ); + + } + + + public function delete_feeds( $feed_ids, $form_id = null ) { + + self::authorize( 'gravityforms_edit_forms' ); + + $count = 0; + if ( empty( $feed_ids ) ) { + $feeds = GFAPI::get_feeds( null, $form_id ); + foreach ( $feeds as $feed ) { + $result = GFAPI::delete_feed( $feed['id'] ); + if ( is_wp_error( $result ) ) { + break; + } + $count ++; + } + } else { + if ( is_array( $feed_ids ) ) { + foreach ( $feed_ids as $feed_id ) { + $result = GFAPI::delete_feed( $feed_id ); + if ( is_wp_error( $result ) ) { + break; + } + $count ++; + } + } else { + $result = GFAPI::delete_feed( $feed_ids ); + $count ++; + } + } + + if ( isset( $result ) && is_wp_error( $result ) ) { + $response = $this->get_error_response( $result ); + $status = $this->get_error_status( $result ); + } else { + $status = 200; + $response = sprintf( __( 'Feeds deleted successfully: %d', 'gravityforms' ), $count ); + } + + $this->end( $status, $response ); + } + + public function put_feeds( $feed_data, $feed_id = null ) { + + self::authorize( 'gravityforms_edit_forms' ); + + $count = 0; + $result = array(); + if ( empty( $feed_id ) ) { + foreach ( $feed_data as $feed ) { + //todo: validate feed id and form id + $result = GFAPI::update_feed( $feed['id'], $feed['meta'], $feed['form_id'] ); + if ( is_wp_error( $result ) ) { + break; + } + $count ++; + } + } else { + $result = GFAPI::update_feed( $feed_id, $feed_data['meta'], $feed_data['form_id'] ); + $count ++; + } + + + if ( isset( $results ) && is_wp_error( $result ) ) { + $response = $this->get_error_response( $result ); + $status = $this->get_error_status( $result ); + } else { + $status = 200; + $response = sprintf( __( 'Feeds updated: %d', 'gravityforms' ), $count ); + } + + $this->end( $status, $response ); + } + + public function post_feeds( $feeds, $form_id = null ) { + + $this->authorize( 'gravityforms_edit_forms' ); + + $feed_ids = array(); + $result = array(); + foreach ( $feeds as $feed ) { + $addon_slug = isset( $feed['addon_slug'] ) ? $feed['addon_slug'] : rgget( 'addon' ); + $f_id = empty( $form_id ) ? $feed['form_id'] : $form_id; + if ( empty( $f_id ) ) { + $result = new WP_Error( 'missing_form_id', __( 'Missing form id', 'gravityforms' ) ); + break; + } + $result = GFAPI::add_feed( $f_id, $feed['meta'], $addon_slug ); + if ( is_wp_error( $result ) ) { + break; + } + $feed_ids[] = $result; + } + if ( is_wp_error( $result ) ) { + $response = $this->get_error_response( $result ); + $status = $this->get_error_status( $result ); + } else { + $status = 201; + $response = $feed_ids; - public function query_vars($query_vars) { + } - $query_vars[] = GFWEBAPI_ROUTE_VAR; + $this->end( $status, $response ); + } - return $query_vars; - } + //----- Forms ------ + public function delete_forms( $form_ids ) { - public function handle_page_request() { + $this->authorize( 'gravityforms_delete_forms' ); - global $HTTP_RAW_POST_DATA; + $count = 0; + if ( is_array( $form_ids ) ) { + foreach ( $form_ids as $form_id ) { + $result = GFAPI::delete_form( $form_id ); + if ( is_wp_error( $result ) ) { + break; + } + $count ++; + } + } else { + $result = GFAPI::delete_form( $form_ids ); + $count ++; + } - $route = get_query_var(GFWEBAPI_ROUTE_VAR); - if (false == $route) - return; + if ( isset( $result ) && is_wp_error( $result ) ) { + $response = $this->get_error_response( $result ); + $status = $this->get_error_status( $result ); + } else { + $status = 200; + $response = sprintf( __( 'Forms deleted successfully: %d', 'gravityforms' ), $count ); - self::authenticate(); + } - $test_mode = rgget("test"); - if ($test_mode) - die("test mode"); + $this->end( $status, $response ); + } - $settings = get_option('gravityformsaddon_gravityformswebapi_settings'); - - if (empty($settings)){ - $this->die_not_authorized(); - } - - $account_id = $settings["impersonate_account"]; - wp_set_current_user($account_id); - - $route_parts = pathinfo($route); - - $format = rgar($route_parts, 'extension'); - if ($format) - $route = str_replace("." . $format, "", $route); - - $path_array = explode("/", $route); - $collection = strtolower(rgar($path_array, 0)); - - $id = rgar($path_array, 1); - - if (strpos($id, ";") !== false) - $id = explode(";", $id); - - $collection2 = strtolower(rgar($path_array, 2)); - $id2 = rgar($path_array, 3); - - if (strpos($id2, ";") !== false) - $id2 = explode(";", $id2); - - - if (empty($format)) - $format = "json"; - - $schema = strtolower((rgget("schema"))); - $offset = isset($_GET["paging"]["offset"]) ? strtolower($_GET["paging"]["offset"]) : 0; - $page_size = isset($_GET["paging"]["page_size"]) ? strtolower($_GET["paging"]["page_size"]) : 10; - - $method = strtoupper($_SERVER['REQUEST_METHOD']); - $args = compact("offset", "page_size", "schema"); - if(empty($collection2)){ - do_action("gform_webapi_" . strtolower($method) . "_" . $collection, $id, $format, $args); - } else { - do_action("gform_webapi_" . strtolower($method) . "_" . $collection . "_" . $collection2, $id, $id2, $format, $args); - } - - if (!isset($HTTP_RAW_POST_DATA)) { - $HTTP_RAW_POST_DATA = file_get_contents('php://input'); - } - - GFCommon::log_debug("WebAPI: HTTP_RAW_POST_DATA = " . $HTTP_RAW_POST_DATA); - - - $data = json_decode($HTTP_RAW_POST_DATA, true); - - - // todo: tidy up this mess - - switch ($collection) { - case "forms" : - switch ($collection2) { - case "results" : - switch ($method) { - case 'GET' : - $this->get_results($id); - break; - case 'DELETE': - case 'PUT': - case 'POST': - default: - $this->die_bad_request(); - } - break; - case "properties" : - switch ($method) { - case 'PUT' : - $this->put_forms_properties($data, $id); - break; - default: - $this->die_bad_request(); - } - break; - case "feeds" : - if (false == empty($id2)) - $this->die_bad_request(); - switch ($method) { - case 'GET' : - $this->get_feeds(null, $id); - break; - case 'DELETE' : - $this->delete_feeds(null, $id); - break; - case 'PUT' : - $this->die_not_implemented(); - break; - case 'POST' : - $this->post_feeds($data, $id); - break; - default : - $this->die_bad_request(); - } - break; - case "entries" : - if (false == empty($id2)) - $this->die_bad_request(); - switch ($method) { - case 'GET' : - $this->get_entries(null, $id, $schema); - break; - case 'POST' : - $this->post_entries($data, $id); - break; - case 'PUT' : - case 'DELETE' : - case 'POST' : - $this->die_not_implemented(); - break; - default: - $this->die_bad_request(); - } - break; - - case "" : - switch ($method) { - case 'GET': - $this->get_forms($id, $schema); - break; - case 'DELETE': - $this->delete_forms($id); - break; - case 'PUT': - $this->put_forms($data, $id, $id2); - break; - case 'POST': - if (false === empty($id)) - $this->die_bad_request(); - $this->post_forms($data, $id); - break; - default: - $this->die_bad_request(); - } - break; - default : - $this->die_bad_request(); - break; - - } - break; - case "entries" : // route = /entries/{id} - switch ($method) { - case 'GET': - switch ($collection2) { - case "fields" : // route = /entries/{id}/fields/{id2} - $this->get_entries($id, null, $schema, $id2); - break; - case "" : - $this->get_entries($id, null, $schema); - break; - default : - $this->die_bad_request(); - } - - break; - case 'DELETE' : - $this->delete_entries($id); - break; - case 'PUT' : - switch ($collection2) { - case "properties" : // route = /entries/{id}/properties/{id2} - $this->put_entry_properties($data, $id); - break; - case "" : - $this->put_entries($data, $id); - break; - } - - break; - case 'POST' : - if (false === empty($id)) - $this->die_bad_request(); - $this->post_entries($data); - break; - default: - $this->die_bad_request(); - } - break; - case "feeds" : - switch ($method) { - case 'GET' : - $this->get_feeds($id); - break; - case 'DELETE' : - if (empty($id)) - $this->die_bad_request(); - $this->delete_feeds($id); - break; - case 'PUT' : - $this->put_feeds($data, $id); - break; - case 'POST' : - if (false === empty($id)) - $this->die_bad_request(); - $this->post_feeds($data); - break; - default : - $this->die_bad_request(); - } - break; - default : - $this->die_bad_request(); - break; - } - - - $this->die_bad_request(); - - } - - public function authorize($caps = array()) { - - if (GFCommon::current_user_can_any($caps)) { - - GFCommon::add_api_call(); - - return true; - } - - $this->die_permission_denied(); - } - - //----- Feeds ------ - - public function get_feeds($feed_ids, $form_id = null) { - - $this->authorize("gravityforms_edit_forms"); - - $addon_slug = rgget("addon"); - $output = GFAPI::get_feeds($feed_ids, $form_id, $addon_slug); - if (is_wp_error($output)) - $this->die_not_found(); - - $response = false === empty($feed_ids) && false === is_array($feed_ids) && is_array($output) ? array_shift($output) : ""; - - $this->end(200, $response); - - } - - - public function delete_feeds($feed_ids, $form_id = null) { - - self::authorize("gravityforms_edit_forms"); - - $count = 0; - if (empty($feed_ids)) { - $feeds = GFAPI::get_feeds(null, $form_id); - foreach ($feeds as $feed) { - $result = GFAPI::delete_feed($feed["id"]); - if (is_wp_error($result)) - break; - $count++; - } - } else { - if (is_array($feed_ids)) { - foreach ($feed_ids as $feed_id) { - $result = GFAPI::delete_feed($feed_id); - if (is_wp_error($result)) - break; - $count++; - } - } else { - $result = GFAPI::delete_feed($feed_ids); - $count++; - } - } - - if (isset($result) && is_wp_error($result)) { - $response = $this->get_error_response($result); - $status = $this->get_error_status($result); - } else { - $status = 200; - $response = sprintf(__("Feeds deleted successfully: %d", "gravityforms"), $count); - } - - $this->end($status, $response); - } - - public function put_feeds($feed_data, $feed_id = null) { - - self::authorize("gravityforms_edit_forms"); - - $count = 0; - $result = array(); - if (empty($feed_id)) { - foreach ($feed_data as $feed) { - //todo: validate feed id and form id - $result = GFAPI::update_feed($feed["id"], $feed["meta"], $feed["form_id"]); - if (is_wp_error($result)) - break; - $count++; - } - } else { - $result = GFAPI::update_feed($feed_id, $feed_data["meta"], $feed_data["form_id"]); - $count++; - } - - - if (isset($results) && is_wp_error($result)) { - $response = $this->get_error_response($result); - $status = $this->get_error_status($result); - } else { - $status = 200; - $response = sprintf(__("Feeds updated: %d", "gravityforms"), $count); - } - - $this->end($status, $response); - } - - public function post_feeds($feeds, $form_id = null) { - - $this->authorize("gravityforms_edit_forms"); - - $feed_ids = array(); - $result = array(); - foreach ($feeds as $feed) { - $addon_slug = isset($feed["addon_slug"]) ? $feed["addon_slug"] : rgget("addon"); - $f_id = empty($form_id) ? $feed["form_id"] : $form_id; - if (empty($f_id)) { - $result = new WP_Error("missing_form_id", __("Missing form id", "gravityforms")); - break; - } - $result = GFAPI::add_feed($f_id, $feed["meta"], $addon_slug); - if (is_wp_error($result)) - break; - $feed_ids[] = $result; - } - if (is_wp_error($result)) { - $response = $this->get_error_response($result); - $status = $this->get_error_status($result); - } else { - $status = 201; - $response = $feed_ids; - - } - - $this->end($status, $response); - } - - //----- Forms ------ - - public function delete_forms($form_ids) { - - $this->authorize("gravityforms_delete_forms"); - - $count = 0; - if (is_array($form_ids)) { - foreach ($form_ids as $form_id) { - $result = GFAPI::delete_form($form_id); - if (is_wp_error($result)) - break; - $count++; - } - } else { - $result = GFAPI::delete_form($form_ids); - $count++; - } - - if (isset($result) && is_wp_error($result)) { - $response = $this->get_error_response($result); - $status = $this->get_error_status($result); - } else { - $status = 200; - $response = sprintf(__("Forms deleted successfully: %d", "gravityforms"), $count); - - } - - $this->end($status, $response); - } - - public function post_entries($data, $form_id = null) { - - $this->authorize("gravityforms_edit_entries"); - - $result = GFAPI::add_entries($data, $form_id); - - if (is_wp_error($result)) { - $response = $this->get_error_response($result); - $status = $this->get_error_status($result); - } else { - $status = 201; - $response = $result; - } - - $this->end($status, $response); - } - - public function put_entries($data, $entry_id = null) { - - $this->authorize("gravityforms_edit_entries"); - - $result = empty($entry_id) ? GFAPI::update_entries($data) : $result = GFAPI::update_entry($data, $entry_id);; - - if (is_wp_error($result)) { - $response = $this->get_error_response($result); - $status = $this->get_error_status($result); - } else { - $status = 200; - $response = empty($entry_id) ? __("Entries updated successfully", "gravityforms") : __("Entry updated successfully", "gravityforms"); - } - - $this->end($status, $response); - } - - public function put_forms_properties($property_values, $form_id){ - $this->authorize("gravityforms_edit_forms"); - - foreach($property_values as $key => $property_value){ - $result = GFAPI::update_form_property($form_id, $key, $property_value); - if(is_wp_error($result)){ - break; - } - } - - if (is_wp_error($result)) { - $response = $this->get_error_response($result); - $status = $this->get_error_status($result); - } else { - $status = 200; - $response = __("Success", "gravityforms"); - } - - $this->end($status, $response); - - } - - public function put_entry_properties($property_values, $entry_id){ - $this->authorize("gravityforms_edit_entries"); - - if(is_array($property_values)){ - foreach($property_values as $key => $property_value){ - $result = GFAPI::update_entry_property($entry_id, $key, $property_value); - if(is_wp_error($result)){ - break; - } - } - - if (is_wp_error($result)) { - $response = $this->get_error_response($result); - $status = $this->get_error_status($result); - } else { - $status = 200; - $response = __("Success", "gravityforms"); - } - - } else { - $status = 400; - if(empty($property_values)){ - $response = __("No property values were found in the request body", "gravityforms"); - } else { - $response = __("Property values should be sent as an array", "gravityforms"); - } - } - - $this->end($status, $response); - - } - - public function post_forms($data) { - - $this->authorize("gravityforms_create_form"); - - $form_ids = GFAPI::add_forms($data); - - if (is_wp_error($form_ids) || count($form_ids) == 0) { - $response = $this->get_error_response($form_ids); - $status = $this->get_error_status($form_ids); - } else { - $status = 201; - $response = $form_ids; - } - - $this->end($status, $response); - } - - public function put_forms($data, $form_id = null) { - - $this->authorize("gravityforms_create_form"); - - if (empty($form_id)) - $result = GFAPI::update_forms($data); - else - $result = GFAPI::update_form($data, $form_id); - - if (is_wp_error($result)) { - $response = $this->get_error_response($result); - $status = $this->get_error_status($result); - } else { - $status = 200; - $response = empty($form_id) ? __("Forms updated successfully", "gravityforms") : __("Form updated successfully", "gravityforms"); - } - - $this->end($status, $response); - } - - public function delete_entries($entry_ids) { - - $this->authorize("gravityforms_delete_entries"); - - $count = 0; - if (is_array($entry_ids)) { - foreach ($entry_ids as $entry_id) { - $result = GFAPI::delete_entry($entry_id); - if (is_wp_error($result)) - break; - $count++; - } - } else { - $result = GFAPI::delete_entry($entry_ids); - $count++; - } - - if (isset($result) && is_wp_error($result)) { - $response = $this->get_error_response($result); - $status = $this->get_error_status($result); - } else { - $status = 200; - $response = sprintf(__("Entries deleted successfully: %d", "gravityforms"), $count); - } - - $this->end($status, $response); - } - - public function get_entries($entry_ids, $form_ids = null, $schema = "", $field_ids = array()) { - - $this->authorize("gravityforms_view_entries"); - $status = 200; - $response = array(); - $result = array(); - if ($entry_ids) { - - if (is_array($entry_ids)) { - foreach ($entry_ids as $entry_id) { - $result = GFAPI::get_entry($entry_id); - if (!is_wp_error($result)) { - $response[$entry_id] = $result; - if (!empty($field_ids) && (!empty($response[$entry_id]))) - $response[$entry_id] = $this->filter_entry_object($response[$entry_id], $field_ids); - } - } - } else { - $result = GFAPI::get_entry($entry_ids); - if (!is_wp_error($result)) { - $response = $result; - if (!empty($field_ids) && (!empty($response))) - $response = $this->filter_entry_object($response, $field_ids); - } - - } - - if ($schema == "mtd") - $response = self::mtd_transform_entry_data($response); - - } else { - - //sorting parameters - $sort_key = isset($_GET["sorting"]["key"]) && !empty($_GET["sorting"]["key"]) ? $_GET["sorting"]["key"] : "id"; - $sort_dir = isset($_GET["sorting"]["direction"]) && !empty($_GET["sorting"]["direction"]) ? $_GET["sorting"]["direction"] : "DESC"; - $sorting = array('key' => $sort_key, 'direction' => $sort_dir); - if(isset($_GET["sorting"]["is_numeric"])){ - $sorting["is_numeric"] = $_GET["sorting"]["is_numeric"]; - } - - //paging parameters - $page_size = isset($_GET["paging"]["page_size"]) ? intval($_GET["paging"]["page_size"]) : 10; - if (isset($_GET["paging"]["current_page"])) { - $current_page = intval($_GET["paging"]["current_page"]); - $offset = $page_size * ($current_page - 1); - } else { - $offset = isset($_GET["paging"]["offset"]) ? intval($_GET["paging"]["offset"]) : 0; - } - - $paging = array('offset' => $offset, 'page_size' => $page_size); - - $search = isset($_GET["search"]) ? $_GET["search"] : array(); - if (empty($form_ids)) - $form_ids = 0; // all forms - - $entry_count = GFAPI::count_entries($form_ids, $search); - - $result = $entry_count > 0 ? GFAPI::get_entries($form_ids, $search, $sorting, $paging) : array(); - - if (!is_wp_error($result)) { - $response = array("total_count" => $entry_count, "entries" => $result); - - if ($schema == "mtd") - $response = $this->mtd_transform_entries_data($response, $form_ids); - } - - } - - if (is_wp_error($result)) { - $response = $this->get_error_response($result); - $status = $this->get_error_status($result); - } - - $this->end($status, $response); - } - - public static function filter_entry_object($entry, $field_ids) { - - if (!is_array($field_ids)) - $field_ids = array($field_ids); - $new_entry = array(); - foreach ($entry as $key => $val) { - if (in_array($key, $field_ids) || (is_numeric($key) && in_array(intval($key), $field_ids))) - $new_entry[$key] = $val; - } - - return $new_entry; - } - - public function get_forms($form_ids = null, $schema = "") { - - $this->authorize("gravityforms_edit_forms"); - $status = 200; - $response = array(); - if (empty($form_ids)) { - $forms = RGFormsModel::get_forms(true); - foreach ($forms as $form) { - $form_id = $form->id; - $totals = GFFormsModel::get_form_counts($form_id); - $form_info = array( - "id" => $form_id, - "title" => $form->title, - "entries" => rgar($totals, "total") - ); - $response[$form_id] = $form_info; - } - if ($schema == "mtd") - $response = $this->mtd_transform_forms_data($response); - } else { - if (is_array($form_ids)) { - foreach ($form_ids as $form_id) { - $response[$form_id] = GFAPI::get_form($form_id); - } - } else { - $result = GFAPI::get_form($form_ids); - if (is_wp_error($result)) { - $response = $this->get_error_response($result); - $status = $this->get_error_status($result); - } elseif (!$result) { - $this->die_not_found(); - } else { - $response = $result; - } + public function post_entries( $data, $form_id = null ) { - } + $this->authorize( 'gravityforms_edit_entries' ); - } + $result = GFAPI::add_entries( $data, $form_id ); - $this->end($status, $response); - } + if ( is_wp_error( $result ) ) { + $response = $this->get_error_response( $result ); + $status = $this->get_error_status( $result ); + } else { + $status = 201; + $response = $result; + } + $this->end( $status, $response ); + } - // RESULTS - // todo: move to GFAPI or GFResults once stable + public function put_entries( $data, $entry_id = null ) { - public function get_results_cache_key($form_id, $fields, $search_criteria) { + $this->authorize( 'gravityforms_edit_entries' ); - $key = $this->get_results_cache_key_prefix($form_id); - $key .= wp_hash(json_encode($fields) . json_encode($search_criteria)); + $result = empty( $entry_id ) ? GFAPI::update_entries( $data ) : $result = GFAPI::update_entry( $data, $entry_id );; - return $key; - } + if ( is_wp_error( $result ) ) { + $response = $this->get_error_response( $result ); + $status = $this->get_error_status( $result ); + } else { + $status = 200; + $response = empty( $entry_id ) ? __( 'Entries updated successfully', 'gravityforms' ) : __( 'Entry updated successfully', 'gravityforms' ); + } - public function get_results_cache_key_prefix($form_id) { - global $blog_id; + $this->end( $status, $response ); + } - $key = is_multisite() ? $blog_id . '-' : ""; + public function put_forms_properties( $property_values, $form_id ) { + $this->authorize( 'gravityforms_edit_forms' ); - $key .= sprintf("%s-cache-%s-", $this->_slug, $form_id); + foreach ( $property_values as $key => $property_value ) { + $result = GFAPI::update_form_property( $form_id, $key, $property_value ); + if ( is_wp_error( $result ) ) { + break; + } + } - // The option_name column in the options table has a max length of 64 chars. - // Truncate the key if it's too long for column and allow space for the "tmp" prefix - $key = substr($key, 0, 60); + if ( is_wp_error( $result ) ) { + $response = $this->get_error_response( $result ); + $status = $this->get_error_status( $result ); + } else { + $status = 200; + $response = __( 'Success', 'gravityforms' ); + } - return $key; - } + $this->end( $status, $response ); + + } + + public function put_entry_properties( $property_values, $entry_id ) { + $this->authorize( 'gravityforms_edit_entries' ); + + if ( is_array( $property_values ) ) { + foreach ( $property_values as $key => $property_value ) { + $result = GFAPI::update_entry_property( $entry_id, $key, $property_value ); + if ( is_wp_error( $result ) ) { + break; + } + } + + if ( is_wp_error( $result ) ) { + $response = $this->get_error_response( $result ); + $status = $this->get_error_status( $result ); + } else { + $status = 200; + $response = __( 'Success', 'gravityforms' ); + } + } else { + $status = 400; + if ( empty( $property_values ) ) { + $response = __( 'No property values were found in the request body', 'gravityforms' ); + } else { + $response = __( 'Property values should be sent as an array', 'gravityforms' ); + } + } - public function update_entry_status($lead_id) { - $lead = RGFormsModel::get_lead($lead_id); - $form_id = $lead["form_id"]; - $form = GFFormsModel::get_form_meta($form_id); - $this->maybe_update_results_cache_meta($form); - } + $this->end( $status, $response ); - public function entry_updated($form, $lead_id) { - $this->maybe_update_results_cache_meta($form); - } + } - public function entry_created($entry, $form) { - $this->maybe_update_results_cache_meta($form); - } + public function post_forms( $data ) { - public function after_save_form($form, $is_new) { - if ($is_new) - return; - $form_id = $form["id"]; + $this->authorize( 'gravityforms_create_form' ); - // only need cache meta when a cache exists - if (false === $this->results_cache_exists($form_id)) - return; + $form_ids = GFAPI::add_forms( $data ); - $fields = rgar($form, "fields"); - $current_fields_hash = wp_hash(json_encode($fields)); + if ( is_wp_error( $form_ids ) || count( $form_ids ) == 0 ) { + $response = $this->get_error_response( $form_ids ); + $status = $this->get_error_status( $form_ids ); + } else { + $status = 201; + $response = $form_ids; + } - $cache_meta = $this->get_results_cache_meta($form_id); - $cached_fields_hash = rgar($cache_meta, "fields_hash"); + $this->end( $status, $response ); + } - if ($current_fields_hash !== $cached_fields_hash) { - // delete the meta for this form - $this->delete_results_cache_meta($form_id); - // delete all cached results for this form - $this->delete_cached_results($form_id); - } - } + public function put_forms( $data, $form_id = null ) { - public function results_cache_exists($form_id) { - global $wpdb; + $this->authorize( 'gravityforms_create_form' ); - $key = $this->get_results_cache_key_prefix($form_id); + if ( empty( $form_id ) ) { + $result = GFAPI::update_forms( $data ); + } else { + $result = GFAPI::update_form( $data, $form_id ); + } - $key = "%" . GFCommon::esc_like( $key ) . "%"; + if ( is_wp_error( $result ) ) { + $response = $this->get_error_response( $result ); + $status = $this->get_error_status( $result ); + } else { + $status = 200; + $response = empty( $form_id ) ? __( 'Forms updated successfully', 'gravityforms' ) : __( 'Form updated successfully', 'gravityforms' ); + } - $sql = $wpdb->prepare("SELECT count(option_id) FROM $wpdb->options WHERE option_name LIKE %s", $key); + $this->end( $status, $response ); + } + + public function delete_entries( $entry_ids ) { + + $this->authorize( 'gravityforms_delete_entries' ); + + $count = 0; + if ( is_array( $entry_ids ) ) { + foreach ( $entry_ids as $entry_id ) { + $result = GFAPI::delete_entry( $entry_id ); + if ( is_wp_error( $result ) ) { + break; + } + $count ++; + } + } else { + $result = GFAPI::delete_entry( $entry_ids ); + $count ++; + } - $result = $wpdb->get_var($sql); + if ( isset( $result ) && is_wp_error( $result ) ) { + $response = $this->get_error_response( $result ); + $status = $this->get_error_status( $result ); + } else { + $status = 200; + $response = sprintf( __( 'Entries deleted successfully: %d', 'gravityforms' ), $count ); + } - return $result > 0; + $this->end( $status, $response ); + } + + public function get_entries( $entry_ids, $form_ids = null, $schema = '', $field_ids = array() ) { + + $this->authorize( 'gravityforms_view_entries' ); + $status = 200; + $response = array(); + $result = array(); + if ( $entry_ids ) { + + if ( is_array( $entry_ids ) ) { + foreach ( $entry_ids as $entry_id ) { + $result = GFAPI::get_entry( $entry_id ); + if ( ! is_wp_error( $result ) ) { + $response[ $entry_id ] = $result; + if ( ! empty( $field_ids ) && ( ! empty( $response[ $entry_id ] ) ) ) { + $response[ $entry_id ] = $this->filter_entry_object( $response[ $entry_id ], $field_ids ); + } + } + } + } else { + $result = GFAPI::get_entry( $entry_ids ); + if ( ! is_wp_error( $result ) ) { + $response = $result; + if ( ! empty( $field_ids ) && ( ! empty( $response ) ) ) { + $response = $this->filter_entry_object( $response, $field_ids ); + } + } + } + + if ( $schema == 'mtd' ) { + $response = self::mtd_transform_entry_data( $response ); + } + } else { + + //sorting parameters + $sort_key = isset( $_GET['sorting']['key'] ) && ! empty( $_GET['sorting']['key'] ) ? $_GET['sorting']['key'] : 'id'; + $sort_dir = isset( $_GET['sorting']['direction'] ) && ! empty( $_GET['sorting']['direction'] ) ? $_GET['sorting']['direction'] : 'DESC'; + $sorting = array( 'key' => $sort_key, 'direction' => $sort_dir ); + if ( isset( $_GET['sorting']['is_numeric'] ) ) { + $sorting['is_numeric'] = $_GET['sorting']['is_numeric']; + } + + //paging parameters + $page_size = isset( $_GET['paging']['page_size'] ) ? intval( $_GET['paging']['page_size'] ) : 10; + if ( isset( $_GET['paging']['current_page'] ) ) { + $current_page = intval( $_GET['paging']['current_page'] ); + $offset = $page_size * ( $current_page - 1 ); + } else { + $offset = isset( $_GET['paging']['offset'] ) ? intval( $_GET['paging']['offset'] ) : 0; + } + + $paging = array( 'offset' => $offset, 'page_size' => $page_size ); + + $search = isset( $_GET['search'] ) ? $_GET['search'] : array(); + if ( empty( $form_ids ) ) { + $form_ids = 0; + } // all forms + + $entry_count = GFAPI::count_entries( $form_ids, $search ); + + $result = $entry_count > 0 ? GFAPI::get_entries( $form_ids, $search, $sorting, $paging ) : array(); + + if ( ! is_wp_error( $result ) ) { + $response = array( 'total_count' => $entry_count, 'entries' => $result ); + + if ( $schema == 'mtd' ) { + $response = $this->mtd_transform_entries_data( $response, $form_ids ); + } + } + } - } + if ( is_wp_error( $result ) ) { + $response = $this->get_error_response( $result ); + $status = $this->get_error_status( $result ); + } - public function delete_cached_results($form_id) { - global $wpdb; + $this->end( $status, $response ); + } - $form = GFAPI::get_form($form_id); - if (!($form) || !is_array($form)) - return; + public static function filter_entry_object( $entry, $field_ids ) { - $key = $this->get_results_cache_key_prefix($form_id); + if ( ! is_array( $field_ids ) ) { + $field_ids = array( $field_ids ); + } + $new_entry = array(); + foreach ( $entry as $key => $val ) { + if ( in_array( $key, $field_ids ) || ( is_numeric( $key ) && in_array( intval( $key ), $field_ids ) ) ) { + $new_entry[ $key ] = $val; + } + } - $key = "%" . GFCommon::esc_like( $key ) . "%"; + return $new_entry; + } + + public function get_forms( $form_ids = null, $schema = '' ) { + + $this->authorize( 'gravityforms_edit_forms' ); + $status = 200; + $response = array(); + if ( empty( $form_ids ) ) { + $forms = RGFormsModel::get_forms( true ); + foreach ( $forms as $form ) { + $form_id = $form->id; + $totals = GFFormsModel::get_form_counts( $form_id ); + $form_info = array( + 'id' => $form_id, + 'title' => $form->title, + 'entries' => rgar( $totals, 'total' ) + ); + $response[ $form_id ] = $form_info; + } + if ( $schema == 'mtd' ) { + $response = $this->mtd_transform_forms_data( $response ); + } + } else { + if ( is_array( $form_ids ) ) { + foreach ( $form_ids as $form_id ) { + $response[ $form_id ] = GFAPI::get_form( $form_id ); + } + } else { + $result = GFAPI::get_form( $form_ids ); + if ( is_wp_error( $result ) ) { + $response = $this->get_error_response( $result ); + $status = $this->get_error_status( $result ); + } elseif ( ! $result ) { + $this->die_not_found(); + } else { + $response = $result; + } + } + } - $sql = $wpdb->prepare("DELETE FROM $wpdb->options WHERE option_name LIKE %s", $key); + $this->end( $status, $response ); + } - $result = $wpdb->query($sql); - return $result; - } + // RESULTS - // When entries are added or updated the cache needs to be expired and rebuilt. - // This cache meta records the last updated time for each form and a hash of the fields array. - // Each time results are requested this value is checked to make sure the cache is still valid. - public function maybe_update_results_cache_meta($form) { - $form_id = $form["id"]; + public function get_results_cache_key( $form_id, $fields, $search_criteria ) { - // only need to expire the cache when a cache already exists - if (false === $this->results_cache_exists($form_id)) - return; + $key = $this->get_results_cache_key_prefix( $form_id ); + $key .= wp_hash( json_encode( $fields ) . json_encode( $search_criteria ) ); - $this->update_results_cache_meta($form_id, rgar($form, "fields")); - } + return $key; + } - public function update_results_cache_meta($form_id, $fields, $expiry = null) { + public function get_results_cache_key_prefix( $form_id ) { + global $blog_id; - if (empty($expiry)) - $expiry = time(); + $key = is_multisite() ? $blog_id . '-' : ''; - $data = array( - "fields_hash" => wp_hash(json_encode($fields)), - "timestamp" => $expiry - ); + $key .= sprintf( '%s-cache-%s-', $this->_slug, $form_id ); - $key = $this->get_results_cache_meta_key($form_id); + // The option_name column in the options table has a max length of 64 chars. + // Truncate the key if it's too long for column and allow space for the 'tmp' prefix + $key = substr( $key, 0, 60 ); - $this->update_results_cache($key, $data); + return $key; + } - } + public function update_entry_status( $lead_id ) { + $lead = RGFormsModel::get_lead( $lead_id ); + $form_id = $lead['form_id']; + $form = GFFormsModel::get_form_meta( $form_id ); + $this->maybe_update_results_cache_meta( $form ); + } - public function delete_results_cache_meta($form_id) { + public function entry_updated( $form, $lead_id ) { + $this->maybe_update_results_cache_meta( $form ); + } - $key = $this->get_results_cache_meta_key($form_id); + public function entry_created( $entry, $form ) { + $this->maybe_update_results_cache_meta( $form ); + } - delete_option($key); + public function after_save_form( $form, $is_new ) { + if ( $is_new ) { + return; + } + $form_id = $form['id']; - } + // only need cache meta when a cache exists + if ( false === $this->results_cache_exists( $form_id ) ) { + return; + } - public function get_results_cache_meta_key($form_id) { - global $blog_id; + $fields = rgar( $form, 'fields' ); + $current_fields_hash = wp_hash( json_encode( $fields ) ); - $key = is_multisite() ? $blog_id . '-' : ""; - $key .= "gfresults-cache-meta-form-" . $form_id; + $cache_meta = $this->get_results_cache_meta( $form_id ); + $cached_fields_hash = rgar( $cache_meta, 'fields_hash' ); - return $key; - } + if ( $current_fields_hash !== $cached_fields_hash ) { + // delete the meta for this form + $this->delete_results_cache_meta( $form_id ); + // delete all cached results for this form + $this->delete_cached_results( $form_id ); + } + } - public function get_results_cache_meta($form_id) { + public function results_cache_exists( $form_id ) { + global $wpdb; - $key = $this->get_results_cache_meta_key($form_id); - $cache_meta = get_option($key); + $key = $this->get_results_cache_key_prefix( $form_id ); - return $cache_meta; - } + $key = '%' . GFCommon::esc_like( $key ) . '%'; - public function update_results_cache($key, $data) { + $sql = $wpdb->prepare( "SELECT count(option_id) FROM $wpdb->options WHERE option_name LIKE %s", $key ); - delete_option($key); + $result = $wpdb->get_var( $sql ); - $result = add_option($key, $data, '', 'no'); + return $result > 0; - return $result; - } + } - // Recursive wp_cron task to continue the calculation of results - public function results_cron($form, $fields, $search_criteria) { + public function delete_cached_results( $form_id ) { + global $wpdb; - $form_id = $form["id"]; - $key = $this->get_results_cache_key($form_id, $fields, $search_criteria); - $key_tmp = "tmp" . $key; - $state = get_option($key_tmp, array()); + $form = GFAPI::get_form( $form_id ); + if ( ! ( $form ) || ! is_array( $form ) ) { + return; + } - if (!empty($state)) { - if (!class_exists("GFResults")) - require_once(GFCommon::get_base_path() . "/includes/addon/class-gf-results.php"); - $gf_results = new GFResults($this->_slug, array()); - $results = $gf_results->get_results_data($form, $fields, $search_criteria, $state); - if ("complete" == $results["status"]) { - if (isset($results["progress"])) - unset($results["progress"]); - $this->update_results_cache($key, $results); - if (false == empty($state)) - delete_option($key_tmp); + $key = $this->get_results_cache_key_prefix( $form_id ); - } else { - $this->update_results_cache($key_tmp, $results); + $key = '%' . GFCommon::esc_like( $key ) . '%'; - $data = get_option($key); - if ($data) { - $data["progress"] = $results["progress"]; - $this->update_results_cache($key, $data); - } + $sql = $wpdb->prepare( "DELETE FROM $wpdb->options WHERE option_name LIKE %s", $key ); - $this->schedule_results_cron($form, $fields, $search_criteria); - } - } - } + $result = $wpdb->query( $sql ); - // Returns an array with the results for all the fields in the form. - // If the results can be calculated within the time allowed in GFResults then the results are returned and nothing is cached. - // If the calculation has not finished then a single recursive wp_cron task will be scheduled for immediate execution. - // While the cache is being built by the wp_cron task this function will return the expired cache results if available or the latest step in the cache build. - // Add-On-specific results are not included e.g. grade frequencies in the Quiz Add-On. - public function get_results($form_id) { + return $result; + } - $this->authorize("gravityforms_view_entries"); + // When entries are added or updated the cache needs to be expired and rebuilt. + // This cache meta records the last updated time for each form and a hash of the fields array. + // Each time results are requested this value is checked to make sure the cache is still valid. + public function maybe_update_results_cache_meta( $form ) { + $form_id = $form['id']; - $s = rgget("s"); // search criteria + // only need to expire the cache when a cache already exists + if ( false === $this->results_cache_exists( $form_id ) ) { + return; + } - $search_criteria = false === empty($s) && is_array($s) ? $s : array(); + $this->update_results_cache_meta( $form_id, rgar( $form, 'fields' ) ); + } - $form = GFAPI::get_form($form_id); + public function update_results_cache_meta( $form_id, $fields, $expiry = null ) { - if (!$form) - self::die_not_found(); + if ( empty( $expiry ) ) { + $expiry = time(); + } - // for the Web API return all fields - $fields = rgar($form, "fields"); + $data = array( + 'fields_hash' => wp_hash( json_encode( $fields ) ), + 'timestamp' => $expiry, + ); - $form_id = $form["id"]; - $key = $this->get_results_cache_key($form_id, $fields, $search_criteria); - $key_tmp = "tmp" . $key; + $key = $this->get_results_cache_meta_key( $form_id ); - $data = get_option($key, array()); + $this->update_results_cache( $key, $data ); - $cache_meta = $this->get_results_cache_meta($form_id); + } - // add the cache meta early so form editor updates can test for valid field hash - if (empty($cache_meta)) - $this->update_results_cache_meta($form_id, $fields, 0); + public function delete_results_cache_meta( $form_id ) { - $cache_expiry = rgar($cache_meta, "timestamp"); - $cache_timestamp = isset($data["timestamp"]) ? $data["timestamp"] : 0; - $cache_expired = $cache_expiry ? $cache_expiry > $cache_timestamp : false; + $key = $this->get_results_cache_meta_key( $form_id ); - // check for valid cached results first - if (!empty($data) && "complete" == rgar($data, "status") && !$cache_expired) { - $results = $data; - $status = 200; - if (isset($results["progress"])) - unset($results["progress"]); - } else { - - $state = get_option($key_tmp); - - if (empty($state) || ("complete" == rgar($data, "status") && $cache_expired)) { - if (!class_exists("GFResults")) - require_once(GFCommon::get_base_path() . "/includes/addon/class-gf-results.php"); - $gf_results = new GFResults($this->_slug, array()); - $max_execution_time = 5; - $results = $gf_results->get_results_data($form, $fields, $search_criteria, $state, $max_execution_time); - if ("complete" == $results["status"]) { - $status = 200; - if (false == empty($state)) - delete_option($key_tmp); - } else { - - if (false === empty($data) && "complete" == rgar($data, "status") && $cache_expired) { - $data["status"] = "expired"; - $data["progress"] = $results["progress"]; - $this->update_results_cache($key, $data); - } - - $this->update_results_cache($key_tmp, $results); - - $this->schedule_results_cron($form, $fields, $search_criteria); - - if ($data) - $results = $data; - - $status = 202; - } - } else { - - // The cron task is recursive, not periodic, so system restarts, script timeouts and memory issues can prevent the cron from restarting. - // Check timestamp and kick off the cron again if it appears to have stopped - $state_timestamp = rgar($state, "timestamp"); - $state_age = time() - $state_timestamp; - if ($state_age > 180 && !$this->results_cron_is_scheduled($form, $fields, $search_criteria)) { - $this->schedule_results_cron($form, $fields, $search_criteria); - } + delete_option( $key ); - if (false === empty($data) && "expired" == rgar($data, "status")) - $results = $data; - else - $results = $state; - $status = 202; - } - } + } - $fields = $results["field_data"]; + public function get_results_cache_meta_key( $form_id ) { + global $blog_id; - // add choice labels to the results so the client doesn't need to cross-reference with the form object - $results["field_data"] = $this->results_data_add_labels($form, $fields); + $key = is_multisite() ? $blog_id . '-' : ''; + $key .= 'gfresults-cache-meta-form-' . $form_id; - $this->end($status, $results); - } + return $key; + } - public function schedule_results_cron($form, $fields, $search_criteria, $delay_in_seconds = 10) { - // reduces problems with concurrency - wp_cache_delete('alloptions', 'options'); + public function get_results_cache_meta( $form_id ) { - $args = array($form, $fields, $search_criteria); + $key = $this->get_results_cache_meta_key( $form_id ); + $cache_meta = get_option( $key ); - wp_schedule_single_event(time() + $delay_in_seconds, $this->get_results_cron_hook(), $args); - } + return $cache_meta; + } - public function results_cron_is_scheduled($form, $fields, $search_criteria) { - $args = array($form, $fields, $search_criteria); + public function update_results_cache( $key, $data ) { - return wp_next_scheduled($this->get_results_cron_hook(), $args); - } + delete_option( $key ); - public function get_results_cron_hook() { - return 'gravityforms_results_cron_' . $this->_slug; - } + $result = add_option( $key, $data, '', 'no' ); - public function results_data_add_labels($form, $fields) { + return $result; + } - // replace the values/ids with text labels - foreach ($fields as $field_id => $choice_counts) { - $field = GFFormsModel::get_field($form, $field_id); - $type = GFFormsModel::get_input_type($field); - if (is_array($choice_counts)) { - $i = 0; - foreach ($choice_counts as $choice_value => $choice_count) { - if (class_exists("GFSurvey") && "likert" == $type && rgar($field, "gsurveyLikertEnableMultipleRows")) { - $row_text = GFSurvey::get_likert_row_text($field, $i++); - $counts_for_row = array(); - foreach ($choice_count as $col_val => $col_count) { - $text = GFSurvey::get_likert_column_text($field, $choice_value . ":" . $col_val); - $counts_for_row[$col_val] = array("text" => $text, "data" => $col_count); - } - $counts_for_row[$choice_value]["data"] = $counts_for_row; - $fields[$field_id][$choice_value] = array("text" => $row_text, "value" => "$choice_value", "count" => $counts_for_row); + // Recursive wp_cron task to continue the calculation of results + public function results_cron( $form, $fields, $search_criteria ) { - } else { - $text = GFFormsModel::get_choice_text($field, $choice_value); - $fields[$field_id][$choice_value] = array("text" => $text, "value" => "$choice_value", "count" => $choice_count); - } + $form_id = $form['id']; + $key = $this->get_results_cache_key( $form_id, $fields, $search_criteria ); + $key_tmp = 'tmp' . $key; + $state = get_option( $key_tmp, array() ); - } - } + if ( ! empty( $state ) ) { + if ( ! class_exists( 'GFResults' ) ) { + require_once( GFCommon::get_base_path() . '/includes/addon/class-gf-results.php' ); + } + $gf_results = new GFResults( $this->_slug, array() ); + $results = $gf_results->get_results_data( $form, $fields, $search_criteria, $state ); + if ( 'complete' == $results['status'] ) { + if ( isset( $results['progress'] ) ) { + unset( $results['progress'] ); + } + $this->update_results_cache( $key, $results ); + if ( false == empty( $state ) ) { + delete_option( $key_tmp ); + } + } else { + $this->update_results_cache( $key_tmp, $results ); - } + $data = get_option( $key ); + if ( $data ) { + $data['progress'] = $results['progress']; + $this->update_results_cache( $key, $data ); + } - return $fields; - } + $this->schedule_results_cron( $form, $fields, $search_criteria ); + } + } + } - // ----- end RESULTS + // Returns an array with the results for all the fields in the form. + // If the results can be calculated within the time allowed in GFResults then the results are returned and nothing is cached. + // If the calculation has not finished then a single recursive wp_cron task will be scheduled for immediate execution. + // While the cache is being built by the wp_cron task this function will return the expired cache results if available or the latest step in the cache build. + // Add-On-specific results are not included e.g. grade frequencies in the Quiz Add-On. + public function get_results( $form_id ) { + $this->authorize( 'gravityforms_view_entries' ); - private function authenticate() { - $authenticated = false; - if (isset($_GET["api_key"])) { - if (rgget("api_key") == $this->_public_key) { - if (self::check_signature()) - $authenticated = true; - } - } + $s = rgget( 's' ); // search criteria - if ($authenticated) - return true; + $search_criteria = false === empty( $s ) && is_array( $s ) ? $s : array(); - $this->die_not_authorized(); - } + $form = GFAPI::get_form( $form_id ); - private function check_signature() { - if (false === GFWEBAPI_REQUIRE_SIGNATURE) - return true; + if ( ! $form ) { + self::die_not_found(); + } - $expires = (int)rgget("expires"); + // for the Web API return all fields + $fields = rgar( $form, 'fields' ); - $api_key = rgget("api_key"); - $path = strtolower(get_query_var(GFWEBAPI_ROUTE_VAR)); - $method = strtoupper($_SERVER['REQUEST_METHOD']); + $form_id = $form['id']; + $key = $this->get_results_cache_key( $form_id, $fields, $search_criteria ); + $key_tmp = 'tmp' . $key; - $signature = rgget("signature"); + $data = get_option( $key, array() ); - $string_to_check = sprintf("%s:%s:%s:%s", $api_key, $method, $path, $expires); + $cache_meta = $this->get_results_cache_meta( $form_id ); - $calculated_sig = $this->calculate_signature($string_to_check); + // add the cache meta early so form editor updates can test for valid field hash + if ( empty( $cache_meta ) ) { + $this->update_results_cache_meta( $form_id, $fields, 0 ); + } - if (time() >= $expires) - return false; + $cache_expiry = rgar( $cache_meta, 'timestamp' ); + $cache_timestamp = isset( $data['timestamp'] ) ? $data['timestamp'] : 0; + $cache_expired = $cache_expiry ? $cache_expiry > $cache_timestamp : false; + + // check for valid cached results first + if ( ! empty( $data ) && 'complete' == rgar( $data, 'status' ) && ! $cache_expired ) { + $results = $data; + $status = 200; + if ( isset( $results['progress'] ) ) { + unset( $results['progress'] ); + } + } else { + + $state = get_option( $key_tmp ); + + if ( empty( $state ) || ( 'complete' == rgar( $data, 'status' ) && $cache_expired ) ) { + if ( ! class_exists( 'GFResults' ) ) { + require_once( GFCommon::get_base_path() . '/includes/addon/class-gf-results.php' ); + } + $gf_results = new GFResults( $this->_slug, array() ); + $max_execution_time = 5; + $results = $gf_results->get_results_data( $form, $fields, $search_criteria, $state, $max_execution_time ); + if ( 'complete' == $results['status'] ) { + $status = 200; + if ( false == empty( $state ) ) { + delete_option( $key_tmp ); + } + } else { + + if ( false === empty( $data ) && 'complete' == rgar( $data, 'status' ) && $cache_expired ) { + $data['status'] = 'expired'; + $data['progress'] = $results['progress']; + $this->update_results_cache( $key, $data ); + } + + $this->update_results_cache( $key_tmp, $results ); + + $this->schedule_results_cron( $form, $fields, $search_criteria ); + + if ( $data ) { + $results = $data; + } + + $status = 202; + } + } else { + + // The cron task is recursive, not periodic, so system restarts, script timeouts and memory issues can prevent the cron from restarting. + // Check timestamp and kick off the cron again if it appears to have stopped + $state_timestamp = rgar( $state, 'timestamp' ); + $state_age = time() - $state_timestamp; + if ( $state_age > 180 && ! $this->results_cron_is_scheduled( $form, $fields, $search_criteria ) ) { + $this->schedule_results_cron( $form, $fields, $search_criteria ); + } + + if ( false === empty( $data ) && 'expired' == rgar( $data, 'status' ) ) { + $results = $data; + } else { + $results = $state; + } + $status = 202; + } + } + + $fields = $results['field_data']; + + // add choice labels to the results so the client doesn't need to cross-reference with the form object + $results['field_data'] = $this->results_data_add_labels( $form, $fields ); + + $this->end( $status, $results ); + } + + public function schedule_results_cron( $form, $fields, $search_criteria, $delay_in_seconds = 10 ) { + // reduces problems with concurrency + wp_cache_delete( 'alloptions', 'options' ); + + $args = array( $form, $fields, $search_criteria ); + + wp_schedule_single_event( time() + $delay_in_seconds, $this->get_results_cron_hook(), $args ); + } + + public function results_cron_is_scheduled( $form, $fields, $search_criteria ) { + $args = array( $form, $fields, $search_criteria ); + + return wp_next_scheduled( $this->get_results_cron_hook(), $args ); + } + + public function get_results_cron_hook() { + return 'gravityforms_results_cron_' . $this->_slug; + } + + public function results_data_add_labels( $form, $fields ) { + + // replace the values/ids with text labels + foreach ( $fields as $field_id => $choice_counts ) { + $field = GFFormsModel::get_field( $form, $field_id ); + $type = GFFormsModel::get_input_type( $field ); + if ( is_array( $choice_counts ) ) { + $i = 0; + foreach ( $choice_counts as $choice_value => $choice_count ) { + if ( class_exists( 'GFSurvey' ) && 'likert' == $type && rgar( $field, 'gsurveyLikertEnableMultipleRows' ) ) { + $row_text = GFSurvey::get_likert_row_text( $field, $i ++ ); + $counts_for_row = array(); + foreach ( $choice_count as $col_val => $col_count ) { + $text = GFSurvey::get_likert_column_text( $field, $choice_value . ':' . $col_val ); + $counts_for_row[ $col_val ] = array( 'text' => $text, 'data' => $col_count ); + } + $counts_for_row[ $choice_value ]['data'] = $counts_for_row; + $fields[ $field_id ][ $choice_value ] = array( 'text' => $row_text, 'value' => "$choice_value", 'count' => $counts_for_row ); + + } else { + $text = GFFormsModel::get_choice_text( $field, $choice_value ); + $fields[ $field_id ][ $choice_value ] = array( 'text' => $text, 'value' => "$choice_value", 'count' => $choice_count ); + } + } + } + } + + return $fields; + } + + // ----- end RESULTS - $is_valid = $signature == $calculated_sig || $signature == rawurlencode($calculated_sig); - return $is_valid; - } + private function authenticate() { + $authenticated = false; + if ( isset( $_GET['api_key'] ) ) { + if ( rgget( 'api_key' ) == $this->_public_key ) { + if ( self::check_signature() ) { + $authenticated = true; + } + } + } + + if ( $authenticated ) { + return true; + } + + $this->die_not_authorized(); + } + + private function check_signature() { + if ( false === GFWEBAPI_REQUIRE_SIGNATURE ) { + return true; + } + + $expires = (int) rgget( 'expires' ); + + $api_key = rgget( 'api_key' ); + $path = strtolower( get_query_var( GFWEBAPI_ROUTE_VAR ) ); + $method = strtoupper( $_SERVER['REQUEST_METHOD'] ); + + $signature = rgget( 'signature' ); + + $string_to_check = sprintf( '%s:%s:%s:%s', $api_key, $method, $path, $expires ); + + $calculated_sig = $this->calculate_signature( $string_to_check ); + + if ( time() >= $expires ) { + return false; + } + + $is_valid = $signature == $calculated_sig || $signature == rawurlencode( $calculated_sig ); + + return $is_valid; + } + + private function calculate_signature( $string ) { + $hash = hash_hmac( 'sha1', $string, $this->_private_key, true ); + $sig = base64_encode( $hash ); + + return $sig; + } + + public static function end( $status, $response ) { + $output['status'] = $status; + $output['response'] = $response; + + // PHP > 5.3 + if ( function_exists( 'header_remove' ) ) { + header_remove( 'X-Pingback' ); + } + + + header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ), true ); + $output_json = json_encode( $output ); + + echo $output_json; + die(); + } + + public function die_not_authorized() { + $this->end( 401, __( 'Not authorized', 'gravityforms' ) ); + } + + public function die_permission_denied() { + $this->end( 401, __( 'Permission denied', 'gravityforms' ) ); + } + + public function die_bad_request() { + $this->end( 400, __( 'Bad request', 'gravityforms' ) ); + } + + public function die_not_found() { + $this->end( 404, __( 'Not found', 'gravityforms' ) ); + } + + public function die_not_implemented() { + $this->end( 501, __( 'Not implemented', 'gravityforms' ) ); + } + + public function die_error() { + $this->end( 500, __( 'Internal Error', 'gravityforms' ) ); + } + + public function get_error_response( $wp_error ) { + $response['code'] = $wp_error->get_error_code(); + $response['message'] = $wp_error->get_error_message(); + $data = $wp_error->get_error_data(); + if ( $data ) { + $output['data'] = $data; + } + + return $response; + } + + public function get_error_status( $wp_error ) { + $error_code = $wp_error->get_error_code(); + $mappings = array( + 'not_found' => 404, + 'not_allowed' => 401, + ); + $http_code = isset( $mappings[ $error_code ] ) ? $mappings[ $error_code ] : 400; + + return $http_code; + } + + public static function get_form_metas() { + $form_ids = array(); + $forms = RGFormsModel::get_forms( true ); + foreach ( $forms as $form ) { + $form_ids[] = $form->id; + } + $form_metas = GFFormsModel::get_form_meta_by_id( $form_ids ); + + return $form_metas; + } + + public static function ajax_qrcode() { + require_once GFCommon::get_base_path() . '/includes/phpqrcode/phpqrcode.php'; + $settings = get_option( 'gravityformsaddon_gravityformswebapi_settings' ); + if ( empty( $settings ) ) { + die(); + } + + $data['url'] = site_url(); + $data['name'] = get_bloginfo(); + $data['public_key'] = rgar( $settings, 'public_key' ); + $data['private_key'] = rgar( $settings, 'private_key' ); + + QRcode::png( json_encode( $data ), false, QR_ECLEVEL_L, 4, 1, false ); + die(); + } + + /** + * Support for MonoTouch.Dialog + */ + // todo: support array of form ids + public function mtd_transform_entries_data( $output, $form_id ) { + $form = GFFormsModel::get_form_meta( $form_id ); + $form_element = array(); + $form_element['title'] = $form['title']; + $form_element['type'] = 'root'; + $form_element['id'] = 'id-form-' . $form_id; + $form_element['count'] = rgar( $output, 'total_count' ); + $entries = rgar( $output, 'entries' ); + + $section['header'] = 'Entries'; + $entry_elements = array(); + if ( is_array( $entries ) ) { + foreach ( $entries as $entry ) { + $entry_element['type'] = 'root'; + $entry_element['title'] = $entry['id'] . ': ' . $entry['date_created']; + $entry_element['id'] = $entry['id']; + $entry_element['url'] = GFWEBAPI_API_BASE_URL . '/entries/' . rgar( $entry, 'id' ) . '?schema=mtd'; + $entry_elements[] = $entry_element; + } + } + + $section['elements'] = $entry_elements; + $form_element['sections'][] = $section; + + return $form_element; + } + + public function mtd_transform_forms_data( $forms ) { + $data = array(); + $data['title'] = 'Forms'; + $data['type'] = 'root'; + $data['id'] = 'forms'; + + foreach ( $forms as $form ) { + $element = array(); + $element['title'] = $form['title']; + $element['type'] = 'root'; + $element['id'] = 'id-form-' . $form['id']; + $element['url'] = GFWEBAPI_API_BASE_URL . '/forms/' . $form['id'] . '/entries.json?schema=mtd'; + $section = array(); + $section['elements'][] = $element; + $data['sections'][] = $section; + } + + return $data; + } + + public static function mtd_transform_entry_data( $entry ) { + $data = array(); + $root_element['type'] = 'root'; + $root_element['title'] = $entry['id'] . ': ' . $entry['date_created']; + $root_element['id'] = 'id-entry-' . $entry['id']; + + $form_id = rgar( $entry, 'form_id' ); + $form = RGFormsModel::get_form_meta( $form_id ); + $fields = $form['fields']; + + foreach ( $fields as $field ) { + $field_data = array(); + $field_data['header'] = $field['label']; + $elements = array(); + $value = RGFormsModel::get_lead_field_value( $entry, $field ); + + if ( is_array( $value ) && isset( $field['choices'] ) ) { + $choices = rgar( $field, 'choices' ); + + foreach ( $choices as $choice ) { + $found = false; + foreach ( $value as $item ) { + if ( $item == rgar( $choice, 'value' ) ) { + $found = true; + break; + } + } + $element = array(); + + $element['type'] = 'checkbox'; + $element['caption'] = $choice['text']; + $element['value'] = $found; + $elements[] = $element; + } + } else { + $element = array(); + $element['type'] = 'string'; + $element['caption'] = GFFormsModel::get_choice_text( $field, $value ); + + $elements[] = $element; + } + $field_data['elements'] = $elements; + $data[] = $field_data; + } + $root_element['sections'] = $data; - private function calculate_signature($string) { - $hash = hash_hmac("sha1", $string, $this->_private_key, true); - $sig = base64_encode($hash); + return $root_element; + } - return $sig; - } + } - public static function end($status, $response) { - $output["status"] = $status; - $output["response"] = $response; - - // PHP > 5.3 - if (function_exists("header_remove")) - header_remove("X-Pingback"); - - - header('Content-Type: application/json; charset=' . get_option('blog_charset'), true); - $output_json = json_encode($output); - - echo $output_json; - die(); - } - - public function die_not_authorized() { - $this->end(401, __("Not authorized", "gravityforms")); - } - - public function die_permission_denied() { - $this->end(401, __("Permission denied", "gravityforms")); - } - - public function die_bad_request() { - $this->end(400, __("Bad request", "gravityforms")); - } - - public function die_not_found() { - $this->end(404, __("Not found", "gravityforms")); - } - - public function die_not_implemented() { - $this->end(501, __("Not implemented", "gravityforms")); - } - - public function die_error() { - $this->end(500, __("Internal Error", "gravityforms")); - } - - public function get_error_response($wp_error) { - $response["code"] = $wp_error->get_error_code(); - $response["message"] = $wp_error->get_error_message(); - $data = $wp_error->get_error_data(); - if ($data) - $output["data"] = $data; - - return $response; - } - - public function get_error_status($wp_error) { - $error_code = $wp_error->get_error_code(); - $mappings = array( - "not_found" => 404, - "not_allowed" => 401 - ); - $http_code = isset($mappings[$error_code]) ? $mappings[$error_code] : 400; - - return $http_code; - } - - public static function get_form_metas() { - $form_ids = array(); - $forms = RGFormsModel::get_forms(true); - foreach ($forms as $form) { - $form_ids[] = $form->id; - } - $form_metas = GFFormsModel::get_form_meta_by_id($form_ids); - - return $form_metas; - } - - public static function ajax_qrcode() { - require_once GFCommon::get_base_path() . "/includes/phpqrcode/phpqrcode.php"; - $settings = get_option("gravityformsaddon_gravityformswebapi_settings"); - if (empty($settings)) - die(); - - $data["url"] = site_url(); - $data["name"] = get_bloginfo(); - $data["public_key"] = rgar($settings, "public_key"); - $data["private_key"] = rgar($settings, "private_key"); - - QRcode::png(json_encode($data), false, QR_ECLEVEL_L, 4, 1, false); - die(); - } - - /** - * Support for MonoTouch.Dialog - */ - // todo: support array of form ids - public function mtd_transform_entries_data($output, $form_id) { - $form = GFFormsModel::get_form_meta($form_id); - $form_element = array(); - $form_element["title"] = $form["title"]; - $form_element["type"] = "root"; - $form_element["id"] = "id-form-" . $form_id; - $form_element["count"] = rgar($output, "total_count"); - $entries = rgar($output, "entries"); - - $section["header"] = "Entries"; - $entry_elements = array(); - if (is_array($entries)) { - foreach ($entries as $entry) { - $entry_element["type"] = "root"; - $entry_element["title"] = $entry["id"] . ": " . $entry["date_created"]; - $entry_element["id"] = $entry["id"]; - $entry_element["url"] = GFWEBAPI_API_BASE_URL . "/entries/" . rgar($entry, "id") . "?schema=mtd"; - $entry_elements[] = $entry_element; - } - } - - $section["elements"] = $entry_elements; - $form_element["sections"][] = $section; - - return $form_element; - } - - public function mtd_transform_forms_data($forms) { - $data = array(); - $data["title"] = "Forms"; - $data["type"] = "root"; - $data["id"] = "forms"; - - foreach ($forms as $form) { - $element = array(); - $element["title"] = $form["title"]; - $element["type"] = "root"; - $element["id"] = "id-form-" . $form["id"]; - $element["url"] = GFWEBAPI_API_BASE_URL . "/forms/" . $form["id"] . "/entries.json?schema=mtd"; - $section = array(); - $section["elements"][] = $element; - $data["sections"][] = $section; - } - - return $data; - } - - public static function mtd_transform_entry_data($entry) { - $data = array(); - $root_element["type"] = "root"; - $root_element["title"] = $entry["id"] . ": " . $entry["date_created"]; - $root_element["id"] = "id-entry-" . $entry["id"]; - - $form_id = rgar($entry, "form_id"); - $form = RGFormsModel::get_form_meta($form_id); - $fields = $form["fields"]; - - foreach ($fields as $field) { - $field_data = array(); - $field_data["header"] = $field["label"]; - $elements = array(); - $value = RGFormsModel::get_lead_field_value($entry, $field); - - if (is_array($value) && isset($field["choices"])) { - $choices = rgar($field, "choices"); - - foreach ($choices as $choice) { - $found = false; - foreach ($value as $item) { - if ($item == rgar($choice, "value")) { - $found = true; - break; - } - } - $element = array(); - - $element["type"] = "checkbox"; - $element["caption"] = $choice["text"]; - $element["value"] = $found; - $elements[] = $element; - } - } else { - $element = array(); - $element["type"] = "string"; - $element["caption"] = GFFormsModel::get_choice_text($field, $value); - - $elements[] = $element; - } - $field_data["elements"] = $elements; - $data[] = $field_data; - } - $root_element["sections"] = $data; - - return $root_element; - } - - } - - new GFWebAPI(); + new GFWebAPI(); } diff --git a/index.php b/index.php new file mode 100644 index 0000000..12c197f --- /dev/null +++ b/index.php @@ -0,0 +1,2 @@ + - + - \ No newline at end of file + \ No newline at end of file diff --git a/js/conditional_logic.js b/js/conditional_logic.js index 8b31ffb..4b1abb9 100644 --- a/js/conditional_logic.js +++ b/js/conditional_logic.js @@ -179,14 +179,14 @@ function gf_matches_operation(val1, val2, operation){ val2 = gf_try_convert_float(val2); return gformIsNumber(val1) && gformIsNumber(val2) ? val1 > val2 : false; - break; + break; case "<" : val1 = gf_try_convert_float(val1); val2 = gf_try_convert_float(val2); return gformIsNumber(val1) && gformIsNumber(val2) ? val1 < val2 : false; - break; + break; case "contains" : return val1.indexOf(val2) >=0; @@ -240,49 +240,62 @@ function gf_do_next_button_action(formId, action, fieldId, isInit){ function gf_do_action(action, targetId, useAnimation, defaultValues, isInit, callback){ var $target = jQuery(targetId); if(action == "show"){ - if(useAnimation && !isInit){ - if($target.length > 0){ + + // reset tabindex for selects + $target.find( 'select' ).each( function() { + $select = jQuery( this ); + $select.attr( 'tabindex', $select.data( 'tabindex' ) ); + } ); + + if(useAnimation && !isInit){ + if($target.length > 0){ $target.slideDown(callback); } else if(callback){ callback(); } - } - else{ + } + else{ //$target.show(); //Getting around an issue with Chrome on Android. Does not like jQuery('xx').show() ... - if ($target.hasClass('gf_inline')) { + if ($target.is('.gf_inline, input.button')) { $target.css('display', 'inline-block'); } else { $target.css('display', 'block'); } - if(callback){ + if(callback){ callback(); } - } - } - else{ - //if field is not already hidden, reset its values to the default - var child = $target.children().first(); + } + } + else{ + //if field is not already hidden, reset its values to the default + var child = $target.children().first(); if (child.length > 0){ - if(!gformIsHidden(child)){ - gf_reset_to_default(targetId, defaultValues); - } + if(!gformIsHidden(child)){ + gf_reset_to_default(targetId, defaultValues); + } } - if(useAnimation && !isInit){ - if($target.length > 0 && $target.is(":visible")) { + // remove tabindex and stash as a data attr for selects + $target.find( 'select' ).each( function() { + $select = jQuery( this ); + $select.data( 'tabindex', $select.attr( 'tabindex' ) ).removeAttr( 'tabindex' ); + } ); + + if(useAnimation && !isInit){ + if($target.length > 0 && $target.is(":visible")) { $target.slideUp(callback); } else if(callback) { - callback(); + callback(); } - } else{ + } else{ $target.hide(); - if(callback){ - callback(); + if(callback){ + callback(); } - } - } + } + } } function gf_reset_to_default(targetId, defaultValue){ @@ -382,4 +395,4 @@ function gf_reset_to_default(targetId, defaultValue){ } }); -} +} \ No newline at end of file diff --git a/js/datepicker.js b/js/datepicker.js index 15ff1b1..6e01a1b 100644 --- a/js/datepicker.js +++ b/js/datepicker.js @@ -1,46 +1,45 @@ jQuery(document).ready(gformInitDatepicker); -function gformInitDatepicker(){ - jQuery('.datepicker').each( - function (){ - var element = jQuery(this); - var format = "mm/dd/yy"; - - if(element.hasClass("mdy")) - format = "mm/dd/yy"; - else if(element.hasClass("dmy")) - format = "dd/mm/yy"; - else if(element.hasClass("dmy_dash")) - format = "dd-mm-yy"; - else if(element.hasClass("dmy_dot")) - format = "dd.mm.yy"; - else if(element.hasClass("ymd_slash")) - format = "yy/mm/dd"; - else if(element.hasClass("ymd_dash")) - format = "yy-mm-dd"; - else if(element.hasClass("ymd_dot")) - format = "yy.mm.dd"; - - var image = ""; - var showOn = "focus"; - if(element.hasClass("datepicker_with_icon")){ - showOn = "both"; - image = jQuery('#gforms_calendar_icon_' + this.id).val(); - } - - element.datepicker( { - yearRange: '-100:+20', - showOn: showOn, - buttonImage: image, - buttonImageOnly: true, - dateFormat: format, - changeMonth: true, - changeYear: true, +function gformInitDatepicker() { + jQuery('.datepicker').each(function () { + var element = jQuery(this), + inputId = this.id, + optionsObj = { + yearRange: '-100:+20', + showOn: 'focus', + dateFormat: 'mm/dd/yy', + changeMonth: true, + changeYear: true, onClose: function () { element.closest('li').nextAll('li:visible:first').find(':input:first').focus(); } - } ); + }; + + if (element.hasClass('dmy')) { + optionsObj.dateFormat = 'dd/mm/yy'; + } else if (element.hasClass('dmy_dash')) { + optionsObj.dateFormat = 'dd-mm-yy'; + } else if (element.hasClass('dmy_dot')) { + optionsObj.dateFormat = 'dd.mm.yy'; + } else if (element.hasClass('ymd_slash')) { + optionsObj.dateFormat = 'yy/mm/dd'; + } else if (element.hasClass('ymd_dash')) { + optionsObj.dateFormat = 'yy-mm-dd'; + } else if (element.hasClass('ymd_dot')) { + optionsObj.dateFormat = 'yy.mm.dd'; } - ); -} + if (element.hasClass('datepicker_with_icon')) { + optionsObj.showOn = 'both'; + optionsObj.buttonImage = jQuery('#gforms_calendar_icon_' + inputId).val(); + optionsObj.buttonImageOnly = true; + } + + inputId = inputId.split('_'); + + // allow the user to override the datepicker options object + optionsObj = gform.applyFilters('gform_datepicker_options_pre_init', optionsObj, inputId[1], inputId[2]); + + element.datepicker(optionsObj); + }); +} \ No newline at end of file diff --git a/js/form_admin.js b/js/form_admin.js index e7ff428..11e58a3 100644 --- a/js/form_admin.js +++ b/js/form_admin.js @@ -1,4 +1,3 @@ - /** * Common JS functions for form settings and form editor pages. */ @@ -22,7 +21,6 @@ jQuery(document).ready(function($){ FormatCurrency(this); }); }); - }); function FormatCurrency(element){ @@ -55,35 +53,36 @@ function ToggleConditionalLogic(isInit, objectType){ } function GetConditionalObject(objectType){ - var obj = false; + + var object = false; switch(objectType){ case "page": case "field": - obj = GetSelectedField(); + object = GetSelectedField(); break; case "next_button" : var field = GetSelectedField(); - obj = field["nextButton"]; + object = field["nextButton"]; break; case "confirmation": - obj = confirmation; + object = confirmation; break; case "notification": - obj = current_notification; + object = current_notification; break; default: - obj = typeof form != 'undefined' ? form.button : false; + object = typeof form != 'undefined' ? form.button : false; break; } - obj = gform.applyFilters( 'gform_conditional_object', obj, objectType ) + object = gform.applyFilters( 'gform_conditional_object', object, objectType ) - return obj; + return object; } function CreateConditionalLogic(objectType, obj){ @@ -117,18 +116,17 @@ function CreateConditionalLogic(objectType, obj){ var descPiecesArr = makeArray( descPieces ); var str = descPiecesArr.join(' '); - var str = gform.applyFilters( 'gform_conditional_logic_description', str, descPieces, objectType, obj ); + str = gform.applyFilters( 'gform_conditional_logic_description', str, descPieces, objectType, obj ); var i, rule; for(i=0; i < obj.conditionalLogic.rules.length; i++){ rule = obj.conditionalLogic.rules[i]; - str += "
    "; str += GetRuleFields(objectType, i, rule.fieldId); str += GetRuleOperators(objectType, i, rule.fieldId, rule.operator); str += GetRuleValues(objectType, i, rule.fieldId, rule.value); - str += ""; + str += ""; if(obj.conditionalLogic.rules.length > 1 ) - str += ""; + str += ""; str += "
    "; } @@ -230,12 +228,11 @@ function GetEntryMetaFields( selectedFieldId ) { function IsConditionalLogicField(field){ var inputType = field.inputType ? field.inputType : field.type; - var supported_fields = ["checkbox", "radio", "select", "text", "website", "textarea", "email", "hidden", "number", "phone", "multiselect", "post_title", - "post_tags", "post_custom_field", "post_content", "post_excerpt"]; + var supported_fields = GetConditionalLogicFields(); var index = jQuery.inArray(inputType, supported_fields); var isConditionalLogicField = index >= 0 ? true : false; - isConditionalLogicField = gform.applyFilters( 'gform_is_conditional_logic_field', isConditionalLogicField, field ); + isConditionalLogicField = gform.applyFilters( 'gform_is_conditional_logic_field', isConditionalLogicField, field ); return isConditionalLogicField; } @@ -338,8 +335,9 @@ function GetRuleValuesDropDown(choices, objectType, ruleIndex, selectedValue, in var selected = isSelected ? "selected='selected'" : ""; if(isSelected) isAnySelected = true; - - str += ""; + choiceValue = choiceValue.replace(/'/g, "'"); + var choiceText = jQuery.trim(jQuery('
    '+choices[i].text+'
    ').text()) === '' ? choiceValue : choices[i].text; + str += ""; } if(!isAnySelected && selectedValue && selectedValue != "") @@ -350,6 +348,10 @@ function GetRuleValuesDropDown(choices, objectType, ruleIndex, selectedValue, in return str; } +function isEmpty(str){ + return +} + function SetRuleProperty(objectType, ruleIndex, name, value){ var obj = GetConditionalObject(objectType); @@ -422,11 +424,11 @@ function gfAjaxSpinner(elem, imageSrc, inlineStyles) { this.spinner = jQuery(this.image); jQuery(this.elem).after(this.spinner); return this; - } + }; this.destroy = function() { jQuery(this.spinner).remove(); - } + }; return this.init(); } @@ -436,20 +438,21 @@ function InsertVariable(element_id, callback, variable) { if(!variable) variable = jQuery('#' + element_id + '_variable_select').val(); - var messageElement = jQuery("#" + element_id); + var input = document.getElementById (element_id); + var $input = jQuery(input); if(document.selection) { // Go the IE way - messageElement[0].focus(); + $input[0].focus(); document.selection.createRange().text=variable; } - else if(messageElement[0].selectionStart) { - // Go the Gecko way - obj = messageElement[0] - obj.value = obj.value.substr(0, obj.selectionStart) + variable + obj.value.substr(obj.selectionEnd, obj.value.length); - } - else { - messageElement.val(variable + messageElement.val()); + else if('selectionStart' in input) { + var startPos = input.selectionStart; + input.value = input.value.substr(0, startPos) + variable + input.value.substr(input.selectionEnd, input.value.length); + input.selectionStart = startPos + input.value.length; + input.selectionEnd = startPos + input.value.length; + } else { + $input.val(variable + messageElement.val()); } var variableSelect = jQuery('#' + element_id + '_variable_select'); @@ -569,7 +572,6 @@ function DuplicateConfirmation(confirmationId) { function SetConfirmationConditionalLogic() { confirmation['conditionalLogic'] = jQuery('#conditional_logic').val() ? jQuery.parseJSON(jQuery('#conditional_logic').val()) : new ConditionalLogic(); - } function ToggleConfirmation() { @@ -709,7 +711,7 @@ function ConfirmationObj() { $("#single_action").val("delete"); $("#single_action_argument").val(id); $("#gform-settings").submit(); - } + }; function isValidJson(str) { try { @@ -767,7 +769,8 @@ var gfMergeTagsObj = function(form) { jQuery( ".merge-tag-support" ) // don't navigate away from the field on tab when selecting an item .bind( "keydown", function( event ) { - if ( event.keyCode === jQuery.ui.keyCode.TAB && jQuery( this ).data( "autocomplete" ).menu.active ) { + var menuActive = jQuery( this ).data( "autocomplete" ) && jQuery( this ).data( "autocomplete" ).menu ? jQuery( this ).data( "autocomplete" ).menu.active : false; + if ( event.keyCode === jQuery.ui.keyCode.TAB && menuActive ) { event.preventDefault(); } }) @@ -855,8 +858,7 @@ var gfMergeTagsObj = function(form) { InsertVariable( input.attr('id'), null, value ); } - // trigger the change event to fire any functions tied to this input's onchange - input.change(); + input.trigger('input').trigger('propertychange'); gfMergeTags.mergeTagList.hide(); @@ -881,19 +883,19 @@ var gfMergeTagsObj = function(form) { gfMergeTags.mergeTagList.hide(); }); - } + }; this.split = function( val ) { return val.split(' '); - } + }; this.extractLast = function( term ) { return this.split( term ).pop(); - } + }; this.startsWith = function(string, value) { return string.indexOf(value) === 0; - } + }; this.getMergeTags = function(fields, elementId, hideAllFields, excludeFieldTypes, isPrepop, option) { @@ -933,21 +935,38 @@ var gfMergeTagsObj = function(form) { case 'name': var requiredField = Copy(field); + var prefix, middle, suffix, optionalField; if(field['nameFormat'] == 'extended') { - var prefix = GetInput(field, field.id + '.2'); - var suffix = GetInput(field, field.id + '.8'); + prefix = GetInput(field, field.id + '.2'); + suffix = GetInput(field, field.id + '.8'); - var optionalField = Copy(field); + optionalField = Copy(field); optionalField['inputs'] = [prefix, suffix]; // add optional name fields to optional list optionalFields.push(optionalField); - // remove option name fields from required list + // remove optional name fields from required list delete requiredField.inputs[0]; delete requiredField.inputs[3]; + } else if(field['nameFormat'] == 'advanced') { + + prefix = GetInput(field, field.id + '.2'); + middle = GetInput(field, field.id + '.4'); + suffix = GetInput(field, field.id + '.8'); + + optionalField = Copy(field); + optionalField['inputs'] = [prefix, middle, suffix]; + + // add optional name fields to optional list + optionalFields.push(optionalField); + + // remove optional name fields from required list + delete requiredField.inputs[0]; + delete requiredField.inputs[2]; + delete requiredField.inputs[4]; } requiredFields.push(requiredField); @@ -1065,12 +1084,12 @@ var gfMergeTagsObj = function(form) { label: this.getMergeGroupLabel('custom'), tags: customGroup } - } + }; mergeTags = gform.applyFilters('gform_merge_tags', mergeTags, elementId, hideAllFields, excludeFieldTypes, isPrepop, option, this ); return mergeTags; - } + }; this.getMergeTagLabel = function(tag) { @@ -1091,11 +1110,11 @@ var gfMergeTagsObj = function(form) { } return ''; - } + }; this.getMergeGroupLabel = function(group) { return gf_vars.mergeTags[group].label; - } + }; this.getFieldMergeTags = function(field, option) { @@ -1107,6 +1126,10 @@ var gfMergeTagsObj = function(form) { var tagArgs = inputType == "list" ? ":" + option : ""; //option currently only supported by list field var value = '', label = ''; + if(jQuery.inArray(inputType, ['date', 'email', 'time', 'password'])>-1){ + field['inputs'] = null; + } + if( typeof field['inputs'] != 'undefined' && jQuery.isArray(field['inputs']) ) { if(inputType == 'checkbox') { @@ -1136,7 +1159,7 @@ var gfMergeTagsObj = function(form) { } return mergeTags; - } + }; this.getCustomMergeTags = function() { for(groupName in gf_vars.mergeTags) { @@ -1147,7 +1170,7 @@ var gfMergeTagsObj = function(form) { return gf_vars.mergeTags[groupName]; } return []; - } + }; this.getAutoCompleteMergeTags = function(elem) { @@ -1180,7 +1203,7 @@ var gfMergeTagsObj = function(form) { } return autoCompleteTags; - } + }; this.getMergeTagListItems = function(elem) { @@ -1226,7 +1249,7 @@ var gfMergeTagsObj = function(form) { } return optionsHTML; - } + }; this.hasMultipleGroups = function(mergeTags) { var count = 0; @@ -1239,7 +1262,7 @@ var gfMergeTagsObj = function(form) { count++; } return count > 1; - } + }; /** * Merge Tag inputs support a system for setting various properties for the merge tags via classes. @@ -1293,16 +1316,16 @@ var gfMergeTagsObj = function(form) { } return ''; - } + }; this.isWpEditor = function( mergeTagIcon ) { var mergeTagIcon = jQuery( mergeTagIcon ); return this.getClassProperty( mergeTagIcon, 'wp_editor' ) == true; - } + }; this.init(); -} +}; var FeedConditionObj = function( args ) { @@ -1324,10 +1347,20 @@ var FeedConditionObj = function( args ) { jQuery('input#feed_condition_conditional_logic_object').val( JSON.stringify( fcobj.logicObject ) ); }); - } + }; this.init(); +}; + +function SimpleConditionObject( object, objectType ) { + + if( objectType.indexOf('simple_condition') < 0 ) + return object; + + var objectName = objectType.substring(17) + "_object"; + + return window[objectName]; } function FeedConditionConditionalObject( object, objectType ) { @@ -1350,16 +1383,6 @@ function FeedConditionConditionalDescription( description, descPieces, objectTyp return descPiecesArr.join(' '); } -function SimpleConditionObject( object, objectType ) { - - if( objectType.indexOf('simple_condition') < 0 ) - return object; - - var objectName = objectType.substring(17) + "_object"; - - return window[objectName]; -} - function makeArray( object ) { var array = []; for( i in object ) { @@ -1369,7 +1392,5 @@ function makeArray( object ) { } function isSet( $var ) { - if (typeof $var != 'undefined') - return true - return false + return typeof $var != 'undefined'; } \ No newline at end of file diff --git a/js/form_editor.js b/js/form_editor.js index a7e9992..6f7fe3e 100644 --- a/js/form_editor.js +++ b/js/form_editor.js @@ -5,13 +5,108 @@ jQuery(document).ready(function() { - setTimeout("CloseStatus();", 5000) + setTimeout("CloseStatus();", 5000); + + jQuery('.field_type input').each(function(){ + var $this = jQuery(this); + var type = $this.data('type'); + var onClick = $this.attr('onclick'); + if(typeof type =='undefined'){ + // deprecate buttons without the type data attribute + + if(onClick.indexOf('StartAddField') > -1){ + if (/StartAddField\([ ]?'(.*?)[ ]?'/.test( onClick )){ + type = onClick.match( /'(.*?)'/ )[1]; + $this.data('type', type); + } + } + + if(window.console){ + console.log('Deprecated button for the ' + this.value + ' field. Since v1.9 the field type must be specified in the "type" data attribute.'); + } + } + if(typeof type != 'undefined' && (typeof onClick == 'undefined' || onClick == '')){ + jQuery(this).click(function(){ + StartAddField(type); + }) + } + }); jQuery('#gform_fields').sortable({ - axis: 'y', cancel: '#field_settings', handle: '.gfield_admin_icons', - start: function(event, ui){gforms_dragging = ui.item[0].id;} + start: function(event, ui){ + gforms_dragging = ui.item[0].id; + }, + containment: 'document', + tolerance: "pointer", + over: function( event, ui ) { + jQuery('#no-fields').hide(); + if(ui.helper.hasClass('ui-draggable-dragging')){ + ui.helper.data('original_width', ui.helper.width()) + ui.helper.data('original_height', ui.helper.height()) + ui.helper.width(ui.sender.width()-25); + ui.helper.height(ui.placeholder.height()); + } else { + var h = ui.helper.height(); + if(h > 300){ + h = 300; + } + ui.placeholder.height(h); + } + }, + out: function( event, ui ) { + jQuery('#no-fields').show(); + if(ui.helper && ui.helper.hasClass('ui-draggable-dragging')){ + ui.helper.width(ui.helper.data('original_width')); + ui.helper.height(ui.helper.data('original_height')); + } + }, + placeholder: "field-drop-zone", + beforeStop: function( event, ui ) { + + jQuery('#no-fields').remove(); + jQuery('#gform_fields').height('100%'); + + var type = ui.helper.data('type'); + + if(typeof type == 'undefined'){ + return; + } + + var li = "
  • "; + var index = ui.item.index(); + ui.item.replaceWith( li ); + StartAddField(type, index); + } + }); + + jQuery('#no-fields').droppable({ + over: function (event, ui) { + jQuery('#gform_fields').height(jQuery('#no-fields').height()); + jQuery('#no-fields').hide(); + }, + out : function (event, ui) { + jQuery('#no-fields').show(); + } + }); + + jQuery('.field_type input').draggable({ + connectToSortable: "#gform_fields", + helper: function(){ + return jQuery(this).clone(true); + }, + revert: 'invalid', + cancel: false, + appendTo: '#wpbody', + containment: 'document', + start: function(event, ui){ + + if(gf_vars["currentlyAddingField"] == true){ + return false; + } + + } }); jQuery('#field_choices').sortable({ @@ -24,6 +119,20 @@ jQuery(document).ready(function() { } }); + jQuery('.field_input_choices').sortable({ + axis: 'y', + handle: '.field-choice-handle', + update: function(event, ui){ + var fromIndex = ui.item.data("index"); + var toIndex = ui.item.index(); + var inputId = ui.item.data("input_id"); + var $ul = ui.item.parent(); + MoveInputChoice($ul, inputId, fromIndex, toIndex); + } + }); + + + if(typeof gf_global['view'] == 'undefined' || gf_global['view'] != 'settings') InitializeForm(form); @@ -51,12 +160,247 @@ jQuery(document).ready(function() { jQuery(this).data('previousValue', jQuery(this).val()); }); + InitializeFieldSettings(); }); function CloseStatus(){ jQuery('.updated_base, .error_base').slideUp(); } +function InitializeFieldSettings(){ + + jQuery('#field_max_file_size').on('input propertychange', function(){ + var $this = jQuery(this), + inputValue = parseInt($this.val()); + var value = inputValue ? inputValue : ''; + + SetFieldProperty('maxFileSize', value); + + }).on('change', function(){ + var field = GetSelectedField(); + var value = field.maxFileSize ? field.maxFileSize : ''; + var maskedValue = value === '' ? '' : value + "MB" + this.value = maskedValue; + }); + jQuery(document).on('input propertychange', '.field_default_value', function(){ + SetFieldDefaultValue(this.value); + }); + jQuery(document).on('input propertychange', '.field_placeholder, .field_placeholder_textarea', function(){ + SetFieldPlaceholder(this.value); + }); + + jQuery('#field_choices').on('change' , '.field-choice-price', function() { + var field = GetSelectedField(); + var i = jQuery(this).parent('li').index(); + var price = field.choices[i].price; + this.value = price; + }); + + jQuery('.field_input_choices') + .on('input propertychange', 'input', function () { + var $li = jQuery(this).closest('li'), + index = $li.data('index'), + inputId = $li.data('input_id'), + value = $li.find('.field-choice-value').val(), + text = $li.find('.field-choice-text').val(); + SetInputChoice(inputId, index, value, text); + }) + .on('click', 'input:radio, input:checkbox', function () { + var $li = jQuery(this).closest('li'), + index = $li.data('index'), + inputId = $li.data('input_id'), + value = $li.find('.field-choice-value').val(), + text = $li.find('.field-choice-text').val(); + SetInputChoice(inputId, index, value, text); + }) + .on('click', '.field-input-insert-choice', function () { + var $li = jQuery(this).closest('li'), + $ul = $li.closest('ul'), + index = $li.data('index'), + inputId = $li.data('input_id'); + InsertInputChoice($ul, inputId, index + 1); + }) + .on('click', '.field-input-delete-choice', function () { + var $li = jQuery(this).closest('li'), + $ul = $li.closest('ul'), + index = $li.data('index'), + inputId = $li.data('input_id'); + DeleteInputChoice($ul, inputId, index); + }); + + jQuery('.field_input_choice_values_enabled').on('click', function(){ + var $container = jQuery(this).parent().siblings('.gfield_settings_input_choices_container'); + ToggleInputChoiceValue($container, this.checked); + var $ul = $container.find('ul'); + SetInputChoices($ul); + }); + + jQuery('.input_placeholders_setting') + .on('input propertychange', '.input_placeholder', function(){ + var inputId = jQuery(this).closest('.input_placeholder_row').data('input_id'); + SetInputPlaceholder(this.value, inputId); + }) + .on('input propertychange', '#field_single_placeholder', function(){ + SetFieldPlaceholder(this.value); + }); + + jQuery('.prepopulate_field_setting') + .on('input propertychange', '.field_input_name', function(){ + var inputId = jQuery(this).closest('.field_input_name_row').data('input_id'); + SetInputName(this.value, inputId); + }) + .on('input propertychange', '#field_input_name', function(){ + SetInputName(this.value); + }); + + jQuery('.custom_inputs_setting, .custom_inputs_sub_setting, .sub_labels_setting') + .on('click', '.input_active_icon', function(){ + var inputId = jQuery(this).closest('.field_custom_input_row').data('input_id'); + ToggleInputHidden(this, inputId); + }) + .on('input propertychange', '.field_custom_input_default_label', function(){ + var inputId = jQuery(this).closest('.field_custom_input_row').data('input_id'); + SetInputCustomLabel(this.value, inputId); + }) + .on('input propertychange', '#field_single_custom_label', function(){ + SetInputCustomLabel(this.value); + }); + + jQuery('.default_input_values_setting') + .on('input propertychange', '.default_input_value', function(){ + var inputId = jQuery(this).closest('.default_input_value_row').data('input_id'); + SetInputDefaultValue(this.value, inputId); + }) + .on('input', '#field_single_default_value', function(){ + SetFieldDefaultValue(this.value); + }); + + + jQuery('.choices_setting, .columns_setting') + .on('input propertychange', '.field-choice-input', function(e){ + var $this = jQuery(this); + var li = $this.closest('li.field-choice-row'); + var inputType = li.data('input_type'); + var i = li.data('index'); + SetFieldChoice( inputType, i); + if($this.hasClass('field-choice-text') || $this.hasClass('field-choice-value')){ + CheckChoiceConditionalLogicDependency(this); + e.stopPropagation(); + } + + }); + + jQuery('#field_enable_copy_values_option').on('click', function(){ + SetCopyValuesOptionProperties(this.checked); + ToggleCopyValuesOption(false); + + if(this.checked == false){ + ToggleCopyValuesActivated(false); + } + }); + + jQuery('#field_copy_values_option_label').on('input propertychange', function(){ + SetCopyValuesOptionLabel(this.value); + }); + + jQuery('#field_copy_values_option_field').on('change', function(){ + SetFieldProperty('copyValuesOptionField', jQuery(this).val()); + }); + + jQuery('#field_copy_values_option_default').on('change', function(){ + SetFieldProperty('copyValuesOptionDefault', this.checked == true ? 1 : 0); + ToggleCopyValuesActivated(this.checked); + }); + + jQuery('#field_label').on('input propertychange', function(){ + SetFieldLabel(this.value); + }); + + jQuery('#field_description').on('input propertychange', function(){ + SetFieldDescription(this.value); + }); + + jQuery('#field_content').on('input propertychange', function(){ + SetFieldProperty('content', this.value); + }); + + jQuery('#next_button_text_input, #next_button_image_url').on('input propertychange', function(){ + SetPageButton('next'); + }); + + jQuery('#previous_button_image_url, #previous_button_text_input').on('input propertychange', function(){ + SetPageButton('previous'); + }); + + jQuery('#field_custom_field_name_text').on('input propertychange', function(){ + SetFieldProperty('postCustomFieldName', this.value); + }); + + jQuery('#field_customfield_content_template').on('input propertychange', function(){ + SetCustomFieldTemplate(); + }); + + jQuery('#gfield_calendar_icon_url').on('input propertychange', function(){ + SetFieldProperty('calendarIconUrl', this.value); + }); + + jQuery('#field_max_files').on('input propertychange', function(){ + SetFieldProperty('maxFiles', this.value); + }); + + jQuery('#field_maxrows').on('input propertychange', function(){ + SetFieldProperty('maxRows', this.value); + }); + + jQuery('#field_mask_text').on('input propertychange', function(){ + SetFieldProperty('inputMaskValue', this.value); + }); + + jQuery('#field_file_extension').on('input propertychange', function(){ + SetFieldProperty('allowedExtensions', this.value); + }); + + jQuery('#field_maxlen') + .on('keypress', function(){ + return ValidateKeyPress(event, GetMaxLengthPattern(), false) + }) + .on('change keyup', function(){ + SetMaxLength(this); + }); + + jQuery('#field_range_min').on('input propertychange', function(){ + SetFieldProperty('rangeMin', this.value); + }); + + jQuery('#field_range_max').on('input propertychange', function(){ + SetFieldProperty('rangeMax', this.value); + }); + + jQuery('#field_calculation_formula').on('input propertychange', function(){ + SetFieldProperty('calculationFormula', this.value.trim()); + }); + + jQuery('#field_error_message').on('input propertychange', function(){ + SetFieldProperty('errorMessage', this.value); + }); + + jQuery('#field_css_class').on('input propertychange', function(){ + SetFieldProperty('cssClass', this.value); + }); + + jQuery('#field_admin_label').on('input propertychange', function(){ + SetFieldProperty('adminLabel', this.value); + }); + + jQuery('#field_add_icon_url').on('input propertychange', function(){ + SetFieldProperty('addIconUrl', this.value); + }); + + jQuery('#field_delete_icon_url').on('input propertychange', function(){ + SetFieldProperty('deleteIconUrl', this.value); + }); +} + function InitializeForm(form){ if(form.lastPageButton && form.lastPageButton.type == "image") @@ -77,8 +421,6 @@ function InitializeForm(form){ //default to checked if(form.useCurrentUserAsAuthor == undefined) form.useCurrentUserAsAuthor = true; - else if(form.useCurrentUserAsAuthor == '0') - form.useCurrentUserAsAuthor = false; jQuery('#gfield_current_user_as_author').prop('checked', form.useCurrentUserAsAuthor ? true : false); @@ -88,7 +430,7 @@ function InitializeForm(form){ if(form.postFormat) jQuery('#field_post_format').val(form.postFormat); - if(form.postContentTemplateEnabled && form.postContentTemplateEnabled != '0' ){ + if(form.postContentTemplateEnabled){ jQuery('#gfield_post_content_enabled').prop("checked", true); jQuery('#field_post_content_template').val(form.postContentTemplate); } @@ -98,7 +440,7 @@ function InitializeForm(form){ } TogglePostContentTemplate(true); - if(form.postTitleTemplateEnabled && form.postTitleTemplateEnabled != '0'){ + if(form.postTitleTemplateEnabled){ jQuery('#gfield_post_title_enabled').prop("checked", true); jQuery('#field_post_title_template').val(form.postTitleTemplate); } @@ -168,10 +510,34 @@ function LoadFieldSettings(){ jQuery('#field_force_ssl').prop('checked', field.forceSSL ? true : false); jQuery('#credit_card_style').val(field.creditCardStyle ? field.creditCardStyle : "style1"); - if(field.adminOnly) + if(typeof field.labelPlacement == 'undefined'){ + field.labelPlacement = ''; + } + if(typeof field.descriptionPlacement == 'undefined'){ + field.descriptionPlacement = ''; + } + if(typeof field.subLabelPlacement == 'undefined'){ + field.subLabelPlacement = ''; + } + jQuery("#field_label_placement").val(field.labelPlacement); + jQuery("#field_description_placement").val(field.descriptionPlacement); + jQuery("#field_sub_label_placement").val(field.subLabelPlacement); + if((field.labelPlacement == 'left_label' || field.labelPlacement == 'right_label' || (field.labelPlacement == '' && form.labelPlacement != 'top_label'))){ + jQuery('#field_description_placement_container').hide(); + } else { + jQuery('#field_description_placement_container').show(); + } + + if(field.adminOnly){ jQuery("#field_visibility_admin").prop("checked", true); - else + } else { jQuery("#field_visibility_everyone").prop("checked", true); + } + + if(typeof field.placeholder == 'undefined'){ + field.placeholder = ''; + } + jQuery("#field_placeholder, #field_placeholder_textarea").val(field.placeholder); jQuery("#field_file_extension").val(field.allowedExtensions == undefined ? "" : field.allowedExtensions); jQuery("#field_multiple_files").prop("checked", field.multipleFiles ? true : false); @@ -180,22 +546,6 @@ function LoadFieldSettings(){ ToggleMultiFile(true); - jQuery(document).on('change', '#field_max_file_size', function(){ - var $this = jQuery(this), - inputValue = parseInt($this.val()); - var value = inputValue ? inputValue : ''; - var maskedValue = value === '' ? '' : value + "MB" - SetFieldProperty('maxFileSize', value); - $this.val( maskedValue ); - }); - - jQuery(document).on('onkeyup', '#field_max_file_size', function(){ - var value = parseInt(jQuery(this).val()) ? parseInt(jQuery(this).val()) : ''; - SetFieldProperty('maxFileSize', value); - }); - - - jQuery("#field_phone_format").val(field.phoneFormat); jQuery("#field_error_message").val(field.errorMessage); jQuery('#field_captcha_theme').val(field.captchaTheme == undefined ? "red" : field.captchaTheme); @@ -245,15 +595,14 @@ function LoadFieldSettings(){ var rounding = gformIsNumber(field.calculationRounding) ? field.calculationRounding : "norounding"; jQuery('#field_calculation_rounding').val(rounding); - - jQuery("#option_field_type").val(field.inputType); var productFieldType = jQuery("#product_field_type"); productFieldType.val(field.inputType); - if(has_entry(field.id)) + if(has_entry(field.id)){ productFieldType.prop("disabled", true); - else + } else{ productFieldType.prop("disabled", false); + } jQuery("#donation_field_type").val(field.inputType); jQuery("#quantity_field_type").val(field.inputType); @@ -264,6 +613,8 @@ function LoadFieldSettings(){ SetBasePrice(basePrice); } + jQuery("#shipping_field_type").val(field.inputType); + jQuery("#field_disable_quantity").prop("checked", field.disableQuantity == true ? true : false); SetDisableQuantity(field.disableQuantity == true); @@ -275,8 +626,17 @@ function LoadFieldSettings(){ var addressType = field.addressType == undefined ? "international" : field.addressType; jQuery('#field_address_type').val(addressType); - jQuery("#field_address_hide_address2").prop("checked", field.hideAddress2 == true ? true : false); - jQuery("#field_address_hide_state_" + addressType).prop("checked", field.hideState == true ? true : false); + + if(field.type == 'address'){ + field = UpgradeAddressField(field); + } + + if(field.type == 'email'){ + field = UpgradeEmailField(field); + } + if(field.type == 'password'){ + field = UpgradePasswordField(field); + } var defaultState = field.defaultState == undefined ? "" : field.defaultState; var defaultProvince = field.defaultProvince == undefined ? "" : field.defaultProvince; //for backwards compatibility @@ -284,7 +644,6 @@ function LoadFieldSettings(){ jQuery("#field_address_default_state_" + addressType).val(defaultStateProvince); jQuery("#field_address_default_country_" + addressType).val(field.defaultCountry == undefined ? "" : field.defaultCountry); - jQuery("#field_address_hide_country_" + addressType).prop("checked", field.hideCountry == true ? true : false); SetAddressType(true); @@ -343,6 +702,7 @@ function LoadFieldSettings(){ ToggleInputMaskOptions(true); if(inputType == "creditcard"){ + field = UpgradeCreditCardField(field); if(!field.creditCards || field.creditCards.length <= 0) field.creditCards = ['amex', 'visa', 'discover', 'mastercard']; @@ -354,8 +714,23 @@ function LoadFieldSettings(){ } } - if(!field["dateType"] && inputType == "date") + if(field.type == 'date'){ + field = UpgradeDateField(field); + } + + if(field.type == 'time'){ + field = UpgradeTimeField(field); + } + + CreateDefaultValuesUI(field); + CreatePlaceholdersUI(field); + CreateCustomizeInputsUI(field); + CreateInputLabelsUI(field); + + + if(!field["dateType"] && inputType == "date"){ field["dateType"] = "datepicker"; + } jQuery("#field_date_input_type").val(field["dateType"]); jQuery("#gfield_calendar_icon_url").val(field["calendarIconUrl"] == undefined ? "" : field["calendarIconUrl"]); @@ -374,6 +749,8 @@ function LoadFieldSettings(){ CreateInputNames(field); ToggleInputName(true); + + var canHaveConditionalLogic = GetFirstRuleField() > 0; if(field["type"] == "page"){ LoadFieldConditionalLogic(canHaveConditionalLogic, "next_button"); @@ -383,6 +760,21 @@ function LoadFieldSettings(){ LoadFieldConditionalLogic(canHaveConditionalLogic, "field"); } + jQuery("#field_enable_copy_values_option").prop("checked", field.enableCopyValuesOption == true ? true : false); + jQuery("#field_copy_values_option_default").prop("checked", field.copyValuesOptionDefault == true ? true : false); + var copyValueOptions = GetCopyValuesFieldsOptions(field.copyValuesFieldId, field); + if(copyValueOptions.length>0){ + jQuery("#field_enable_copy_values_option").prop("disabled", false); + jQuery("#field_copy_values_disabled").hide(); + jQuery("#field_copy_values_option_field").html(copyValueOptions); + + } else { + jQuery("#field_enable_copy_values_option").prop("disabled", true); + jQuery("#field_copy_values_disabled").show(); + } + + ToggleCopyValuesOption(field.enableCopyValuesOption, true); + if(field.nextButton){ if(field.nextButton.type == "image") @@ -420,9 +812,9 @@ function LoadFieldSettings(){ }); if(has_entry(field.id)) - jQuery("#field_type, #field_name_format, #field_multiple_files").prop("disabled", true); + jQuery("#field_type, #field_multiple_files").prop("disabled", true); else - jQuery("#field_type, #field_name_format, #field_multiple_files").prop("disabled", false); + jQuery("#field_type, #field_multiple_files").prop("disabled", false); jQuery("#field_custom_field_name").val(field.postCustomFieldName); @@ -493,11 +885,31 @@ function LoadFieldSettings(){ jQuery(".customfield_content_template_setting").show(); } + if(field["type"] == "name"){ - //Display default value setting and size setting for simple name field - if(field["type"] == "name" && field["nameFormat"] == "simple"){ - jQuery(".default_value_setting").show(); - jQuery(".size_setting").show(); + if(typeof field["nameFormat"] == 'undefined' || field["nameFormat"] != "advanced"){ + field = MaybeUpgradeNameField(field); + } else { + SetUpAdvancedNameField(); + } + + if(field["nameFormat"] == "simple"){ + jQuery(".default_value_setting").show(); + jQuery(".size_setting").show(); + jQuery('#field_name_fields_container').html('').hide(); + jQuery('.sub_label_placement_setting').hide(); + jQuery('.name_prefix_choices_setting').hide(); + jQuery('.name_format_setting').hide(); + jQuery('.name_setting').hide(); + jQuery('.default_input_values_setting').hide(); + jQuery('.default_value_setting').show(); + } else if(field["nameFormat"] == "extended") { + jQuery('.name_format_setting').show(); + jQuery('.name_prefix_choices_setting').hide(); + jQuery('.name_setting').hide(); + jQuery('.default_input_values_setting').hide(); + jQuery('.input_placeholders_setting').hide(); + } } // if a product or option field, hide "other choice" setting @@ -520,13 +932,19 @@ function LoadFieldSettings(){ if(field.type == 'product') { if(field.inputType == 'singleproduct') { - var ff=jQuery(".admin_label_setting"); jQuery(".admin_label_setting").hide(); } else { jQuery(".admin_label_setting").show(); } } + if(inputType == "date"){ + ToggleDateSettings(field); + } + + if(inputType == "email"){ + ToggleEmailSettings(field); + } jQuery(document).trigger('gform_load_field_settings', [field, form]); @@ -540,9 +958,101 @@ function LoadFieldSettings(){ SetProductField(field); + + var tabsToHide = []; + + // Hide the appearance tab if it has no settings + var $appearanceSettings = jQuery("#gform_tab_3 li.field_setting").filter(function() { + return jQuery(this).is(':hidden') && jQuery(this).css('display') != 'none'; + }); + if($appearanceSettings.length == 0){ + tabsToHide.push(1); + } + + // Hide the advanced tab if it has no settings + var $advancedSettings = jQuery("#gform_tab_2 li.field_setting").filter(function() { + return jQuery(this).is(':hidden') && jQuery(this).css('display') != 'none'; + }); + if($advancedSettings.length == 0){ + tabsToHide.push(2); + } + + + if(tabsToHide.length > 0){ + jQuery("#field_settings").tabs({disabled:tabsToHide}); + } else { + jQuery("#field_settings").tabs({disabled:[]}); + } + + Placeholders.enable(); } +function ToggleDateSettings(field){ + var isDateField = field["dateType"] == "datefield"; + var isDatePicker = field["dateType"] == "datepicker"; + var isDateDropDown = field["dateType"] == "datedropdown"; + jQuery('.placeholder_setting').toggle(isDatePicker); + jQuery('.default_value_setting').toggle(isDatePicker); + jQuery('.sub_label_placement_setting').toggle(isDateField); + jQuery('.sub_labels_setting').toggle(isDateField); + jQuery('.default_input_values_setting').toggle(isDateDropDown || isDateField); + jQuery('.input_placeholders_setting').toggle(isDateDropDown || isDateField); + +} + +function SetUpAdvancedNameField(){ + field = GetSelectedField(); + jQuery('.name_format_setting').hide(); + jQuery('.name_setting').show(); + jQuery('.name_prefix_choices_setting').show(); + var nameFields = GetCustomizeInputsUI(field); + jQuery('#field_name_fields_container').html(nameFields).show(); + + var prefixInput = GetInput(field, field.id + '.2'); + var prefixChoices = GetInputChoices(prefixInput); + jQuery('#field_prefix_choices').html(prefixChoices); + + ToggleNamePrefixUI(!prefixInput.isHidden); + + jQuery('.name_setting .custom_inputs_setting').on('click', '.input_active_icon', function(){ + var inputId = jQuery(this).data('input_id'); + if(inputId.toString().indexOf(".2") >=0){ + var isActive = this.src.indexOf("active1.png") >=0; + ToggleNamePrefixUI(isActive); + } + }); + + jQuery('.default_value_setting').hide(); + jQuery('.default_input_values_setting').show(); + jQuery('.input_placeholders_setting').show(); + + CreateDefaultValuesUI(field); + CreatePlaceholdersUI(field); + CreateInputNames(field); +} + +function GetCopyValuesFieldsOptions(selectedFieldId, currentField){ + var options = [], label, field, option, currentType = GetInputType(currentField), selected; + + for(var i = 0; i < form.fields.length;i++){ + field = form.fields[i]; + if(field.id != currentField.id && GetInputType(field) == currentType && !field.enableCopyValuesOption){ + label = GetLabel(field); + selected = selectedFieldId == field.id ? 'selected="selected"' : ''; + option = ''; + options.push(option); + } + } + + return options.join(''); + +} + +function ToggleNamePrefixUI(isActive){ + jQuery('.name_prefix_choices_setting').toggle(isActive); +} + function TogglePageBreakSettings(){ if(HasPageBreak()){ @@ -580,6 +1090,24 @@ function SetBasePrice(number){ jQuery(".field_selected .ginput_amount").val(price); } +function ChangeAddressType(){ + field = GetSelectedField(); + + if(field["type"] != "address") + return; + var addressType = jQuery("#field_address_type").val(); + var countryInput = GetInput(field, field.id + ".6"); + var country = jQuery("#field_address_country_" + addressType).val(); + if(country == ''){ + countryInput.isHidden = false + } else { + countryInput.isHidden = true; + } + + + SetAddressType(false); +} + function SetAddressType(isInit){ field = GetSelectedField(); @@ -590,30 +1118,45 @@ function SetAddressType(isInit){ jQuery(".gfield_address_type_container").hide(); var speed = isInit ? "" : "slow"; jQuery("#address_type_container_" + jQuery("#field_address_type").val()).show(speed); + CreatePlaceholdersUI(field); } function UpdateAddressFields(){ var addressType = jQuery("#field_address_type").val(); field = GetSelectedField(); + var address_fields_str = GetCustomizeInputsUI(field); + jQuery("#field_address_fields_container").html(address_fields_str); + //change zip label + var zipInput = GetInput(field, field.id + ".5"); var zip_label = jQuery("#field_address_zip_label_" + addressType).val(); - jQuery(".field_selected #input_" + field["id"] + "_5_label").html(zip_label); + jQuery("#field_custom_input_default_label_" + field.id + "_5").text(zip_label); + jQuery("#field_custom_input_label_" + field.id + "\\.5").attr("placeholder", zip_label); + if(!zipInput.customLabel){ + jQuery(".field_selected #input_" + field["id"] + "_5_label").html(zip_label); + } //change state label + var stateInput = GetInput(field, field.id + ".4"); var state_label = jQuery("#field_address_state_label_" + addressType).val(); - jQuery(".field_selected #input_" + field["id"] + "_4_label").html(state_label); + jQuery("#field_custom_input_default_label_" + field.id + "_4").text(state_label); + jQuery("#field_custom_input_label_" + field.id + "\\.4").attr("placeholder", state_label); + if(!stateInput.customLabel){ + jQuery(".field_selected #input_" + field["id"] + "_4_label").html(state_label); + } //hide country drop down if this address type applies to a specific country - var hide_country = jQuery("#field_address_country_" + addressType).val() != "" || jQuery("#field_address_hide_country_" + addressType).is(":checked"); + var countryInput = GetInput(field, field.id + ".6"); + var hide_country = jQuery("#field_address_country_" + addressType).val() != "" || countryInput.isHidden; + if(hide_country){ - //hides country drop down - jQuery(".field_selected #input_" + field["id"] + "_6_container").hide(); - } - else{ + jQuery('.field_custom_input_row_' + field.id + '_6').hide(); + } else { //selects default country and displays drop down jQuery(".field_selected #input_" + field["id"] + "_6").val(jQuery("#field_address_default_country_" + addressType).val()); jQuery(".field_selected #input_" + field["id"] + "_6_container").show(); + jQuery('.field_selected .field_custom_input_row_' + field.id + '_6').show(); } var has_state_drop_down = jQuery("#field_address_has_states_" + addressType).val() != ""; @@ -626,34 +1169,22 @@ function UpdateAddressFields(){ } else{ jQuery(".field_selected .state_dropdown").hide(); - jQuery(".field_selected .state_text").val("").show(); + jQuery(".field_selected .state_text").show(); } - - //hide/show address line 2 - if(jQuery("#field_address_hide_address2").is(":checked")) - jQuery(".field_selected #input_" + field["id"] + "_2_container").hide(); - else - jQuery(".field_selected #input_" + field["id"] + "_2_container").show(); - - //hide/show state field - if(jQuery("#field_address_hide_state_" + addressType).is(":checked")) - jQuery(".field_selected #input_" + field["id"] + "_4_container").hide(); - else - jQuery(".field_selected #input_" + field["id"] + "_4_container").show(); } function SetAddressProperties(){ + field = GetSelectedField(); + var addressType = jQuery("#field_address_type").val(); SetFieldProperty("addressType", addressType); - SetFieldProperty("hideAddress2", jQuery("#field_address_hide_address2").is(":checked")); - SetFieldProperty("hideState", jQuery("#field_address_hide_state_" + addressType).is(":checked")); SetFieldProperty("defaultState", jQuery("#field_address_default_state_" + addressType).val()); SetFieldProperty("defaultProvince",""); //for backwards compatibility //Only save the hide country property for address types that have that option (ones with no country) var country = jQuery("#field_address_country_" + addressType).val(); + if(country == ""){ - SetFieldProperty("hideCountry",jQuery("#field_address_hide_country_" + addressType).is(":checked")); country = jQuery("#field_address_default_country_" + addressType).val(); } @@ -662,6 +1193,101 @@ function SetAddressProperties(){ UpdateAddressFields(); } +function MaybeUpgradeNameField(field){ + + if(typeof field.nameFormat == 'undefined' || field.nameFormat == '' || field.nameFormat == 'normal' || (field.nameFormat == 'simple' && !has_entry(field.id))){ + field = UpgradeNameField(field, true, true, true); + } + + return field; +} + +function UpgradeNameField(field, prefixHiddex, middleHidden, suffixHidden){ + + field.nameFormat = 'advanced'; + field.inputs = MergeInputArrays(GetAdvancedNameFieldInputs(field, prefixHiddex, middleHidden, suffixHidden), field.inputs); + + RefreshSelectedFieldPreview(function(){ + SetUpAdvancedNameField(); + }); + + return field; +} + +function UpgradeDateField(field){ + if(field.type != 'date'){ + return field; + } + + if(typeof field.dateType != 'undefined' && field.dateType != 'datepicker' && !field.inputs){ + field.inputs = GetDateFieldInputs(field); + } + + return field; +} + +function UpgradeTimeField(field){ + if(field.type != 'time'){ + return field; + } + + if(!field.inputs){ + field.inputs = GetTimeFieldInputs(field); + } + + return field; +} + +function UpgradeEmailField(field){ + if(field.type != 'email'){ + return field; + } + + if(field.emailConfirmEnabled && !field.inputs){ + field.inputs = GetEmailFieldInputs(field); + field.inputs[0].placeholder = field.placeholder + } + + return field; +} + +function UpgradePasswordField(field){ + if(field.type != 'password'){ + return field; + } + + if(!field.inputs){ + field.inputs = GetPasswordFieldInputs(field); + field.inputs[0].placeholder = field.placeholder + } + + return field; +} + +function UpgradeAddressField(field){ + + if(field.hideCountry){ + var countryInput = GetInput(field, field.id + ".6"); + countryInput.isHidden = true; + } + delete field.hideCountry; + + if(field.hideAddress2){ + var address2Input = GetInput(field, field.id + ".2"); + address2Input.isHidden = true; + } + delete field.hideAddress2; + + if(field.hideState){ + var stateInput = GetInput(field, field.id + ".4"); + stateInput.isHidden = true; + } + delete field.hideState; + + return field; +} + + function TogglePasswordStrength(isInit){ var speed = isInit ? "" : "slow"; @@ -687,6 +1313,11 @@ function ToggleCategory(isInit){ } } +function SetCopyValuesOptionLabel(value){ + SetFieldProperty('copyValuesOptionLabel', value); + jQuery('.field_selected .copy_values_option_label').html(value); +} + function SetCustomFieldTemplate(){ var enabled = jQuery("#gfield_customfield_content_enabled").is(":checked"); SetFieldProperty("customFieldTemplate", enabled ? jQuery("#field_customfield_content_template").val() : null); @@ -782,6 +1413,28 @@ function ToggleChoiceValue(isInit){ } } +function ToggleInputChoiceValue($container, enabled){ + if(typeof enabled == 'undefined'){ + enabled = false; + } + var field = GetSelectedField(); + var inputId = $container.find('li').data('input_id'); + var input = GetInput(field, inputId); + input.enableChoiceValue = enabled; + //removing all classes + $container.removeClass("choice_with_value"); + + if(enabled){ + $container.addClass("choice_with_value"); + } +} + +function ToggleCopyValuesActivated(isActivated){ + jQuery('.field_selected .copy_values_activated').prop('checked', isActivated); + var field = GetSelectedField(); + jQuery('#input_'+ field.id).toggle(!isActivated); +} + function TogglePageButton(button_name, isInit){ var isText = jQuery("#" + button_name + "_button_text").is(":checked"); show_element = isText ? "#" + button_name + "_button_text_container" : "#" + button_name + "_button_image_container" @@ -1375,18 +2028,31 @@ function GetNextFieldId(){ return parseFloat(max) + 1; } -function EndAddField(field, fieldString){ +function EndAddField(field, fieldString, index){ gf_vars["currentlyAddingField"] = false; + jQuery('#gform_adding_field_spinner').remove(); + //sets up DOM for new field - jQuery("#gform_fields").append(fieldString); + if(typeof index != 'undefined'){ + form.fields.splice(index, 0, field); + if (index === 0) { + jQuery("#gform_fields").prepend(fieldString); + } else { + jQuery("#gform_fields").children().eq(index - 1).after(fieldString); + } + } else { + jQuery("#gform_fields").append(fieldString); + //creates new javascript field + form.fields.push(field); + } + var newFieldElement = jQuery("#field_" + field.id); newFieldElement.animate({ backgroundColor: '#FFFBCC' }, 'fast', function(){jQuery(this).animate({backgroundColor: '#FFF'}, 'fast', function(){jQuery(this).css('background-color', '');})}) newFieldElement.bind("click", function(){FieldClick(this);}); - //creates new javascript field - form.fields.push(field); + jQuery('#no-fields').hide(); //Unselects all fields @@ -1414,9 +2080,7 @@ function EndAddField(field, fieldString){ function StartChangeNameFormat(format){ field = GetSelectedField(); - field["nameFormat"] = format; - SetFieldProperty('nameFormat', format); - jQuery("#field_settings").slideUp(function(){StartChangeInputType(field["type"], field);}); + UpgradeNameField(field, false, true, false); } function StartChangeCaptchaType(captchaType){ @@ -1471,7 +2135,8 @@ function StartChangePostCategoryType(type){ } -function EndChangeInputType(fieldId, fieldType, fieldString){ +function EndChangeInputType(params){ + var fieldId = params.id, fieldType = params.type, fieldString = params.fieldString; jQuery("#field_" + fieldId).html(fieldString); @@ -1490,8 +2155,6 @@ function EndChangeInputType(fieldId, fieldType, fieldString){ InitializeFields(); LoadFieldSettings(); - - //UpdateDescriptionPlacement(); } function InitializeFields(){ @@ -1514,7 +2177,7 @@ function InitializeFields(){ event.stopPropagation(); }); - //UpdateLabelPlacement(true); + } function FieldClick(field){ @@ -1680,6 +2343,16 @@ function LoadFieldChoices(field){ gform.doAction('gform_load_field_choices', [field]); } +function LoadInputChoices($ul, input){ + + //loading ui + var $container = $ul.parent(); + $container.find('.field_input_choice_values_enabled').prop("checked", input.enableChoiceValue ? true : false); + ToggleInputChoiceValue($container, input.enableChoiceValue); + + jQuery($ul).html(GetInputChoices(input)); +} + function LoadBulkChoices(field){ LoadCustomChoices(); @@ -1716,7 +2389,7 @@ function LoadCustomChoices(){ jQuery(".choice_section_header, .bulk_custom_choice").remove(); if(!IsEmpty(gform_custom_choices)){ - var str = "
  • Custom Choices
  • "; + var str = "
  • " + gf_vars.customChoices + "
  • "; for(key in gform_custom_choices){ if(!gform_custom_choices.hasOwnProperty(key)) @@ -1724,7 +2397,7 @@ function LoadCustomChoices(){ str += "
  • " + key + "
  • "; } - str += "
  • Predefined Choices
  • "; + str += "
  • " + gf_vars.predefinedChoices + "
  • "; jQuery("#bulk_items").prepend(str); } } @@ -1822,12 +2495,9 @@ function IsEmpty(array){ function SetFieldChoice(inputType, index){ - text = jQuery("#" + inputType + "_choice_text_" + index).val(); - value = jQuery("#" + inputType + "_choice_value_" + index).val(); - price = jQuery("#" + inputType + "_choice_price_" + index).val(); - - var element = jQuery("#" + inputType + "_choice_selected_" + index); - isSelected = element.is(":checked"); + var text = jQuery("#" + inputType + "_choice_text_" + index).val(); + var value = jQuery("#" + inputType + "_choice_value_" + index).val(); + var price = jQuery("#" + inputType + "_choice_price_" + index).val(); field = GetSelectedField(); @@ -1841,7 +2511,7 @@ function SetFieldChoice(inputType, index){ price = ""; field.choices[index]["price"] = price; - jQuery("#" + inputType + "_choice_price_" + index).val(price); + //jQuery("#" + inputType + "_choice_price_" + index).val(price); } //set field selections @@ -1854,6 +2524,22 @@ function SetFieldChoice(inputType, index){ UpdateFieldChoices(GetInputType(field)); } +function SetInputChoice(inputId, index, value, text){ + var field = GetSelectedField(); + var input = GetInput(field, inputId); + inputId = inputId.toString().replace('.', '_'); + + input.choices[index].text = text; + input.choices[index].value = input.enableChoiceValue ? value : text; + + //set field selections + jQuery(".field-input-choice-" + inputId + ":radio, .field-input-choice-" + inputId + ":checkbox").each(function(index){ + input.choices[index].isSelected = this.checked; + }); + + UpdateInputChoices(input); +} + function UpdateFieldChoices(fieldType){ var choices = ''; var selector = ''; @@ -1941,6 +2627,19 @@ function UpdateFieldChoices(fieldType){ jQuery(".field_selected " + selector).html(choices); } +function UpdateInputChoices(input){ + var choices = ''; + + for(var i=0; i" + input.choices[i].text + ""; + } + var inputId = input.id.toString().replace('.', '_'); + + jQuery(".field_selected #input_" + inputId).html(choices); +} + function InsertFieldChoice(index){ field = GetSelectedField(); @@ -1955,6 +2654,18 @@ function InsertFieldChoice(index){ UpdateFieldChoices(GetInputType(field)); } +function InsertInputChoice($ul, inputId, index){ + var field = GetSelectedField(); + var input = GetInput(field, inputId); + + var new_choice = new Choice("", ""); + + input.choices.splice(index, 0, new_choice); + + LoadInputChoices($ul, input); + UpdateInputChoices(input); +} + function DeleteFieldChoice(index){ field = GetSelectedField(); @@ -1970,6 +2681,16 @@ function DeleteFieldChoice(index){ UpdateFieldChoices(GetInputType(field)); } +function DeleteInputChoice($ul, inputId, index){ + var field = GetSelectedField(); + var input = GetInput(field, inputId); + + input.choices.splice(index, 1); + + LoadInputChoices($ul, input); + UpdateInputChoices(input); +} + function MoveFieldChoice(fromIndex, toIndex){ field = GetSelectedField(); var choice = field.choices[fromIndex]; @@ -1984,6 +2705,21 @@ function MoveFieldChoice(fromIndex, toIndex){ UpdateFieldChoices(GetInputType(field)); } +function MoveInputChoice($ul, inputId, fromIndex, toIndex){ + var field = GetSelectedField(); + var input = GetInput(field, inputId); + var choice = input.choices[fromIndex]; + + //deleting from old position + input.choices.splice(fromIndex, 1); + + //inserting into new position + input.choices.splice(toIndex, 0, choice); + + LoadInputChoices($ul, input); + UpdateInputChoices(input); +} + function GetFieldType(fieldId){ return fieldId.substr(0, fieldId.lastIndexOf("_")); } @@ -2029,11 +2765,22 @@ function SetTimeFormat(format){ } function LoadTimeInputs(){ + var field = GetSelectedField(); + if(field.type != 'time'){ + return; + } var format = jQuery("#field_time_format").val(); - if(format == "24") + + + if(format == "24"){ + jQuery('#input_default_value_row_input_' + field.id +'_3').hide(); jQuery(".field_selected .gfield_time_ampm").hide(); - else + } else { + jQuery('#input_default_value_row_input_' + field.id +'_3').show(); jQuery(".field_selected .gfield_time_ampm").show(); + } + jQuery('#input_placeholder_row_input_' + field.id +'_3').hide(); // no support for placeholder + jQuery('.field_custom_input_row_' + field.id +'_3').hide(); } function SetDateFormat(format){ @@ -2135,7 +2882,17 @@ function SetDateInputType(type){ if(GetInputType(field) != "date") return; - SetFieldProperty('dateType', type); + field.dateType = type; + field.inputs = GetDateFieldInputs(field); + + CreateDefaultValuesUI(field); + CreatePlaceholdersUI(field); + CreateInputLabelsUI(field); + ToggleDateSettings(field); + + ResetDefaultInputValues(field); + ResetInputPlaceholders(field); + ToggleDateCalendar(); LoadDateInputs(); } @@ -2179,9 +2936,6 @@ function SetFeaturedImage() { } } - - - function SetFieldProperty(name, value){ if(value == undefined) value = ""; @@ -2202,7 +2956,127 @@ function SetInputName(value, inputId){ for(var i=0; i div > input, .field_selected > div > textarea").val(defaultValue); + + jQuery(".field_selected > div > input:visible, .field_selected > div > textarea:visible, .field_selected > div > select:visible").val(defaultValue); + SetFieldProperty('defaultValue', defaultValue); } +function SetFieldPlaceholder(placeholder){ + + jQuery(".field_selected > div > input:visible, .field_selected > div > textarea:visible, .field_selected > div > select:visible").each(function(){ + var type = this.nodeName; + var $this = jQuery(this); + if(type == 'INPUT' || type == 'TEXTAREA'){ + jQuery(this).prop("placeholder", placeholder); + } else if (type == 'SELECT'){ + var $option = $this.find('option[value=""]'); + if($option.length>0){ + if(placeholder.length > 0){ + $option.text(placeholder); + } else { + $option.remove(); + } + + } else { + $this.prepend(''); + $this.val(''); + } + } + }); + + SetFieldProperty('placeholder', placeholder); +} + function SetFieldDescription(description){ if(description == undefined) description = ""; @@ -2309,7 +3245,18 @@ function SetPasswordStrength(isEnabled){ SetFieldProperty('passwordStrengthEnabled', isEnabled); } +function ToggleEmailSettings(field){ + var isConfirmEnabled = typeof field.emailConfirmEnabled != 'undefined' && field.emailConfirmEnabled == true; + jQuery('.placeholder_setting').toggle(!isConfirmEnabled); + jQuery('.default_value_setting').toggle(!isConfirmEnabled); + jQuery('.sub_label_placement_setting').toggle(isConfirmEnabled); + jQuery('.sub_labels_setting').toggle(isConfirmEnabled); + jQuery('.default_input_values_setting').toggle(isConfirmEnabled); + jQuery('.input_placeholders_setting').toggle(isConfirmEnabled); +} + function SetEmailConfirmation(isEnabled){ + var field = GetSelectedField(); if(isEnabled){ jQuery(".field_selected .ginput_single_email").hide(); jQuery(".field_selected .ginput_confirm_email").show(); @@ -2319,8 +3266,16 @@ function SetEmailConfirmation(isEnabled){ jQuery(".field_selected .ginput_single_email").show(); } - SetFieldProperty('emailConfirmEnabled', isEnabled); - //UpdateDescriptionPlacement(); + field['emailConfirmEnabled'] = isEnabled; + field.inputs = GetEmailFieldInputs(field); + CreateDefaultValuesUI(field); + CreatePlaceholdersUI(field); + CreateCustomizeInputsUI(field); + CreateInputLabelsUI(field); + + + ToggleEmailSettings(field); + } @@ -2508,6 +3463,29 @@ function SetFieldChoices(){ } } +function SetInputChoices($ul){ + var field = GetSelectedField(), $this, value, text, inputId; + $ul.find('li').each(function(i){ + $this = jQuery(this); + inputId = $this.data('input_id'); + value = $this.find('.field-choice-value').val(); + text = $this.find('.field-choice-text').val(); + SetInputChoice(inputId, i, value, text); + }); +} + +function MergeInputArrays(inputs1, inputs2){ + var inputA, inputB; + for(var i=0; i"); + select.push(""; return str; } - function getFilterValues (filter) { + function getFilterValues (filter, selectedOperator) { var i, val, text, str, options = ""; - str = ""; - if (filter) { - if (filter.values) { - for (i = 0; i < filter.values.length; i++) { - val = filter.values[i].value; - text = filter.values[i].text; - options += "".format(val, text); - } - str = "".format(options); + if ( filter && filter.values && selectedOperator != 'contains' ) { + for (i = 0; i < filter.values.length; i++) { + val = filter.values[i].value; + text = filter.values[i].text; + options += ''.format(val, text); } + str = "".format(options); + } else { + str = ""; } return str; @@ -166,8 +203,8 @@ if(!allowMultiple) return str; - str += "{1}".format(imagesURL, gf_vars.addFieldFilter, gf_vars.addFieldFilter); - str += "" + gf_vars.removeFieldFilter + ""; + str += "{1}".format(imagesURL, gf_vars.addFieldFilter, gf_vars.addFieldFilter); + str += "" + gf_vars.removeFieldFilter + ""; return str; } @@ -201,7 +238,7 @@ function displayNoFiltersMessage () { var str = ""; - str += "
    " + gf_vars.addFieldFilter; + str += "
    " + gf_vars.addFieldFilter; str += "{1}
    ".format(imagesURL, gf_vars.addFieldFilter, gf_vars.addFieldFilter); $("#gform-field-filters").html(str); if(isResizable){ @@ -239,7 +276,7 @@ $filterRow.after(getFilterMode()); } - gfFilterUI.addNewFieldFilter = function (el) { + function addNewFieldFilter (el) { var $el, $filterRow; $el = $(el); if($el.is("img")) @@ -248,14 +285,17 @@ $filterRow = $el; $filterRow.after(getNewFilterRow()); - $filterRow.next("div").find(".gform-filter-field").change(); - if ($(".gform-field-filter").length == 1) + $filterRow.next("div") + .find(".gform-filter-field").change() + .find(".gform-filter-operator").change(); + if ($(".gform-field-filter").length == 1){ addFilterMode($filterRow); + } maybeMakeResizable(); } - gfFilterUI.removeFieldFilter = function (img) { + function removeFieldFilter (img) { $(img).parent().remove(); if ($(".gform-field-filter").length == 0) displayNoFiltersMessage(); diff --git a/js/gravityforms.js b/js/gravityforms.js index 8b7c587..006e0f1 100644 --- a/js/gravityforms.js +++ b/js/gravityforms.js @@ -4,8 +4,8 @@ if( typeof jQuery.fn.prop === 'undefined' ) { jQuery.fn.prop = jQuery.fn.attr; } -//Formatting free form currency fields to currency jQuery(document).ready(function(){ + //Formatting free form currency fields to currency jQuery(document).bind('gform_post_render', gformBindFormatPricingFields); }); @@ -19,7 +19,6 @@ function gformBindFormatPricingFields(){ }); } - //------------------------------------------------ //---------- CURRENCY ---------------------------- //------------------------------------------------ @@ -43,15 +42,22 @@ function Currency(currency){ number = number + ""; negative = ""; if(number[0] == "-"){ - negative = "-"; + number = parseFloat(number.substr(1)); + negative = '-'; } money = this.numberFormat(number, this.currency["decimals"], this.currency["decimal_separator"], this.currency["thousand_separator"]); + if ( money == '0.00' ){ + negative = ''; + } + var symbol_left = this.currency["symbol_left"] ? this.currency["symbol_left"] + this.currency["symbol_padding"] : ""; var symbol_right = this.currency["symbol_right"] ? this.currency["symbol_padding"] + this.currency["symbol_right"] : ""; - money = negative + this.htmlDecode(symbol_left) + money + this.htmlDecode(symbol_right); - return money; + + money = negative + this.htmlDecode(symbol_left) + money + this.htmlDecode(symbol_right); + + return money; }; this.numberFormat = function(number, decimals, dec_point, thousands_sep, padded){ @@ -276,9 +282,17 @@ function gformCalculateTotalPrice(formId){ //updating total var totalElement = jQuery(".ginput_total_" + formId); - if(totalElement.length > 0){ - totalElement.next().val(price); - totalElement.html(gformFormatMoney(price)); + if( totalElement.length > 0 ) { + + var currentTotal = totalElement.next().val(); + + if( currentTotal == price ) { + return; + } + + totalElement.next().val( price ).change(); + totalElement.html( gformFormatMoney( price ) ); + } } @@ -324,6 +338,7 @@ function gformCalculateProductPrice(form_id, productFieldId){ var label = gformGetOptionLabel(choice_element, choice_element.val(), selected_price, form_id, field_id); choice_element.html(label); }); + dropdown_field.trigger('chosen:updated'); }); @@ -331,7 +346,7 @@ function gformCalculateProductPrice(form_id, productFieldId){ jQuery(".gfield_option" + suffix).find(".gfield_checkbox").find("input").each(function(){ var checkbox_item = jQuery(this); var id = checkbox_item.attr("id"); - var field_id = id.split("_")[2]; + var field_id = id.split("_")[3]; var label_id = id.replace("choice_", "#label_"); var label_element = jQuery(label_id); var label = gformGetOptionLabel(label_element, checkbox_item.val(), 0, form_id, field_id); @@ -344,7 +359,7 @@ function gformCalculateProductPrice(form_id, productFieldId){ var selected_price = 0; var radio_field = jQuery(this); var id = radio_field.attr("id"); - var fieldId = id.split("_")[2]; + var fieldId = id.split("_")[3]; var selected_value = radio_field.find("input:checked").val(); if(selected_value) @@ -628,7 +643,12 @@ function gformAddListItem(element, max){ var tr = jQuery(element).closest('tr'); var clone = tr.clone(); - clone.find("input, select").val("").attr("tabindex", clone.find('input:last').attr("tabindex")); + var tabindex = clone.find(":input:last").attr("tabindex"); + + clone.find("input, select").attr("tabindex", tabindex).not(":checkbox, :radio").val(""); + clone.find(":checkbox, :radio").prop("checked", false); + clone = gform.applyFilters( 'gform_list_item_pre_add', clone ); + tr.after(clone); gformToggleIcons(tr.parent(), max); gformAdjustClasses(tr.parent()); @@ -737,9 +757,14 @@ function gformToggleCreditCard(){ function gformInitChosenFields(fieldList, noResultsText){ return jQuery(fieldList).each(function(){ - var element = jQuery(this); + var element = jQuery( this ); - //only initialize once + // RTL support + if( jQuery( 'html' ).attr( 'dir' ) == 'rtl' ) { + element.addClass( 'chosen-rtl chzn-rtl' ); + } + + // only initialize once if( element.is(":visible") && element.siblings(".chosen-container").length == 0 ){ var options = gform.applyFilters( 'gform_chosen_options', { no_results_text: noResultsText }, element ); element.chosen( options ); @@ -901,6 +926,9 @@ var GFCalc = function(formId, formulaFields){ }); } + // allow users to add custom methods for triggering calculations + gform.doAction( 'gform_post_calculation_events', matches[i], formulaField, formId, calcObj ); + } } @@ -963,6 +991,8 @@ var GFCalc = function(formId, formulaFields){ var decimalSeparator = gformGetDecimalSeparator(numberFormat); + // allow users to modify value with their own function + value = gform.applyFilters( 'gform_merge_tag_value_pre_calculation', value, matches[i], isVisible, formulaField, formId ); value = gformCleanNumber( value, '', '', decimalSeparator ); if( ! value ) @@ -1108,7 +1138,7 @@ var gform = { $(document).ready(function () { if((typeof adminpage !== 'undefined' && adminpage === 'toplevel_page_gf_edit_forms')|| typeof plupload == 'undefined'){ $(".gform_button_select_files").prop("disabled", true); - } else if (typeof adminpage !== 'undefined'){ + } else if (typeof adminpage !== 'undefined' && adminpage === 'forms_page_gf_entries' ){ $(".gform_fileupload_multifile").each(function(){ setup(this); }); @@ -1128,11 +1158,12 @@ var gform = { return false; } }); - if(pendingUploads){ - alert(strings.currently_uploading); - window["gf_submitting_" + formID] = false; - return false; - } + if(pendingUploads){ + alert(strings.currently_uploading); + window["gf_submitting_" + formID] = false; + $('#gform_ajax_spinner_' + formID).remove(); + return false; + } }); } @@ -1217,6 +1248,7 @@ var gform = { + ' (' + size + ') ' + '' + strings.cancel + '' + '
    '; + $('#' + up.settings.filelist).prepend(status); totalCount++; @@ -1238,11 +1270,13 @@ var gform = { $uid.val(uniqueID); } + if(max > 0 && totalCount >= max){ - addMessage(up.settings.gf_vars.message_id, strings.max_reached) gfMultiFileUploader.toggleDisabled(up.settings, true); + addMessage(up.settings.gf_vars.message_id, strings.max_reached) } + up.settings.multipart_params.gform_unique_id = uniqueID; up.start(); @@ -1265,9 +1299,9 @@ var gform = { (err.file ? ", File: " + err.file.name : "") + ""; - addMessage(up.settings.gf_vars.message_id, m); + addMessage(up.settings.gf_vars.message_id, m); } - $('#' + err.file.id ).html(''); + $('#' + err.file.id ).html(''); up.refresh(); // Reposition Flash }); @@ -1275,9 +1309,9 @@ var gform = { uploader.bind('FileUploaded', function(up, file, result) { var response = $.secureEvalJSON(result.response); if(response.status == "error"){ - addMessage(up.settings.gf_vars.message_id, file.name + " - " + response.error.message); - $('#' + file.id ).html(''); - return; + addMessage(up.settings.gf_vars.message_id, file.name + " - " + response.error.message); + $('#' + file.id ).html(''); + return; } var html = '' + file.name + ''; @@ -1292,7 +1326,9 @@ var gform = { + "' /> " + html; - $('#' + file.id ).html(html); + html = gform.applyFilters( 'gform_file_upload_markup', html, file, up, strings, imagesUrl ); + + $( '#' + file.id ).html( html ); var fieldID = up.settings.multipart_params["field_id"]; @@ -1300,10 +1336,12 @@ var gform = { if(response.status && response.status == 'ok'){ addFile(fieldID, response.data); } else { - addMessage(up.settings.gf_vars.message_id, strings.unknown_error); + addMessage(up.settings.gf_vars.message_id, strings.unknown_error + ': ' + file.name); } } + + }); @@ -1373,7 +1411,6 @@ var gform = { }(window.gfMultiFileUploader = window.gfMultiFileUploader || {}, jQuery)); - //---------------------------------------- //------ GENERAL FUNCTIONS ------- //---------------------------------------- diff --git a/js/gravityforms.min.js b/js/gravityforms.min.js new file mode 100644 index 0000000..4484743 --- /dev/null +++ b/js/gravityforms.min.js @@ -0,0 +1 @@ +function gformBindFormatPricingFields(){jQuery(".ginput_amount, .ginput_donation_amount").bind("change",function(){gformFormatPricingField(this)}),jQuery(".ginput_amount, .ginput_donation_amount").each(function(){gformFormatPricingField(this)})}function Currency(a){this.currency=a,this.toNumber=function(a){return this.isNumeric(a)?parseFloat(a):gformCleanNumber(a,this.currency.symbol_right,this.currency.symbol_left,this.currency.decimal_separator)},this.toMoney=function(a){if(this.isNumeric(a)||(a=this.toNumber(a)),a===!1)return"";a+="",negative="","-"==a[0]&&(a=parseFloat(a.substr(1)),negative="-"),money=this.numberFormat(a,this.currency.decimals,this.currency.decimal_separator,this.currency.thousand_separator),"0.00"==money&&(negative="");var b=this.currency.symbol_left?this.currency.symbol_left+this.currency.symbol_padding:"",c=this.currency.symbol_right?this.currency.symbol_padding+this.currency.symbol_right:"";return money=negative+this.htmlDecode(b)+money+this.htmlDecode(c),money},this.numberFormat=function(a,b,c,d,e){var e="undefined"==typeof e;a=(a+"").replace(",","").replace(" ","");var f=isFinite(+a)?+a:0,g=isFinite(+b)?Math.abs(b):0,h="undefined"==typeof d?",":d,i="undefined"==typeof c?".":c,j="",k=function(a,b){var c=Math.pow(10,b);return""+Math.round(a*c)/c};return j="0"==b?(""+Math.round(f)).split("."):-1==b?(""+f).split("."):k(f,g).split("."),j[0].length>3&&(j[0]=j[0].replace(/\B(?=(?:\d{3})+(?!\d))/g,h)),e&&(j[1]||"").length=-32768&&65535>=b?d.replace(c,String.fromCharCode(b)):d.replace(c,"");return d}}function gformCleanNumber(a,b,c,d){a+=" ",a=a.replace(/&.*?;/,"",a),a=a.replace(b,""),a=a.replace(c,"");for(var e="",f=!1,g=0;g=0&&parseInt(h)<=9||h==d?e+=h:"-"==h&&(f=!0)}for(var i="",g=0;g="0"&&"9">=j?i+=j:j==d&&(i+=".")}return f&&(i="-"+i),gformIsNumber(i)?parseFloat(i):!1}function gformGetDecimalSeparator(a){var b;switch(a){case"currency":var c=new Currency(gf_global.gf_currency_config);b=c.currency.decimal_separator;break;case"decimal_comma":b=",";break;default:b="."}return b}function gformIsNumber(a){return!isNaN(parseFloat(a))&&isFinite(a)}function gformIsNumeric(a,b){switch(b){case"decimal_dot":var c=new RegExp("^(-?[0-9]{1,3}(?:,?[0-9]{3})*(?:.[0-9]+)?)$");return c.test(a);case"decimal_comma":var c=new RegExp("^(-?[0-9]{1,3}(?:.?[0-9]{3})*(?:,[0-9]+)?)$");return c.test(a)}return!1}function gformDeleteUploadedFile(a,b,c){var d=jQuery("#field_"+a+"_"+b),e=jQuery(c).parent().index();d.find(".ginput_preview").eq(e).remove(),d.find('input[type="file"]').removeClass("gform_hidden"),d.find(".ginput_post_image_file").show(),d.find('input[type="text"]').val("");var f=jQuery.secureEvalJSON(jQuery("#gform_uploaded_files_"+a).val());if(f){var g="input_"+b,h=d.find("#gform_multifile_upload_"+a+"_"+b);if(h.length>0){f[g].splice(e,1);var i=h.data("settings"),j=i.gf_vars.max_files;jQuery("#"+i.gf_vars.message_id).html(""),f[g].length0){var f=e.next().val();if(f==b)return;e.next().val(b).change(),e.html(gformFormatMoney(b))}}}function gformGetShippingPrice(a){var b=jQuery(".gfield_shipping_"+a+' input[type="hidden"], .gfield_shipping_'+a+" select, .gfield_shipping_"+a+" input:checked"),c=0;return 1!=b.length||gformIsHidden(b)||(c=b.attr("type")&&"hidden"==b.attr("type").toLowerCase()?b.val():gformGetPrice(b.val())),gformToNumber(c)}function gformGetFieldId(a){var b=jQuery(a).attr("id"),c=b.split("_");if(c.length<=0)return 0;var d=c[c.length-1];return d}function gformCalculateProductPrice(a,b){var c=gformGetBasePrice(a,b),d="_"+a+"_"+b;jQuery(".gfield_option"+d+", .gfield_shipping_"+a).find("select").each(function(){var b=jQuery(this),c=gformGetPrice(b.val()),d=b.attr("id").split("_")[2];b.children("option").each(function(){var b=jQuery(this),e=gformGetOptionLabel(b,b.val(),c,a,d);b.html(e)}),b.trigger("chosen:updated")}),jQuery(".gfield_option"+d).find(".gfield_checkbox").find("input").each(function(){var b=jQuery(this),c=b.attr("id"),d=c.split("_")[3],e=c.replace("choice_","#label_"),f=jQuery(e),g=gformGetOptionLabel(f,b.val(),0,a,d);f.html(g)}),jQuery(".gfield_option"+d+", .gfield_shipping_"+a).find(".gfield_radio").each(function(){var b=0,c=jQuery(this),d=c.attr("id"),e=d.split("_")[3],f=c.find("input:checked").val();f&&(b=gformGetPrice(f)),jQuery(this).find("input").each(function(){var c=jQuery(this),d=c.attr("id").replace("choice_","#label_"),f=jQuery(d),g=gformGetOptionLabel(f,c.val(),b,a,e);f.html(g)})}),jQuery(".gfield_option"+d).find("input:checked, select").each(function(){gformIsHidden(jQuery(this))||(c+=gformGetPrice(jQuery(this).val()))});var e=gformGetProductQuantity(a,b);return e>0&&(_anyProductSelected=!0),c*=e,c=Math.round(100*c)/100}function gformGetProductQuantity(a,b){var c,d=jQuery("#ginput_quantity_"+a+"_"+b);return d.length>0?c=gformIsNumber(d.val())?d.val():0:(quantityElement=jQuery(".gfield_quantity_"+a+"_"+b),c=1,quantityElement.find("select").length>0?c=quantityElement.find("select").val():quantityElement.find("input").length>0&&(c=quantityElement.find("input").val()),gformIsNumber(c)||(c=0)),c=parseFloat(c)}function gformGetBasePrice(a,b){var c="_"+a+"_"+b,d=0,e=jQuery("#ginput_base_price"+c+", .gfield_donation"+c+' input[type="text"], .gfield_product'+c+" .ginput_amount");if(e.length>0)d=e.val(),gformIsHidden(e)&&(d=0);else{e=jQuery(".gfield_product"+c+" select, .gfield_product"+c+" input:checked, .gfield_donation"+c+" select, .gfield_donation"+c+" input:checked");var f=e.val();f&&(f=f.split("|"),d=f.length>1?f[1]:0),gformIsHidden(e)&&(d=0)}var g=new Currency(gf_global.gf_currency_config);return d=g.toNumber(d),d===!1?0:d}function gformFormatMoney(a){if(!gf_global.gf_currency_config)return a;var b=new Currency(gf_global.gf_currency_config);return b.toMoney(a)}function gformFormatPricingField(a){if(gf_global.gf_currency_config){var b=new Currency(gf_global.gf_currency_config),c=b.toMoney(jQuery(a).val());jQuery(a).val(c)}}function gformToNumber(a){var b=new Currency(gf_global.gf_currency_config);return b.toNumber(a)}function gformGetPriceDifference(a,b){var c=parseFloat(b)-parseFloat(a);return price=gformFormatMoney(c),c>0&&(price="+"+price),price}function gformGetOptionLabel(a,b,c,d,e){a=jQuery(a);var f=gformGetPrice(b),g=a.attr("price"),h=a.html().replace(//i,"").replace(g,""),i=gformGetPriceDifference(c,f);i=0==gformToNumber(i)?"":" "+i,a.attr("price",i);var j="option"==a[0].tagName.toLowerCase()?" "+i:""+i+"",k=h+j;return window.gform_format_option_label&&(k=gform_format_option_label(k,h,j,c,f,d,e)),k}function gformGetProductIds(a,b){for(var c=jQuery(b).hasClass(a)?jQuery(b).attr("class").split(" "):jQuery(b).parents("."+a).attr("class").split(" "),d=0;d1&&c.toNumber(b[1])!==!1?c.toNumber(b[1]):0}function gformRegisterPriceField(a){_gformPriceFields[a.formId]||(_gformPriceFields[a.formId]=new Array);for(var b=0;b<_gformPriceFields[a.formId].length;b++)if(_gformPriceFields[a.formId][b]==a.productFieldId)return;_gformPriceFields[a.formId].push(a.productFieldId)}function gformInitPriceFields(){jQuery(".gfield_price").each(function(){var a=gformGetProductIds("gfield_price",this);gformRegisterPriceField(a),jQuery(this).find('input[type="text"], input[type="number"], select').change(function(){var a=gformGetProductIds("gfield_price",this);0==a.formId&&(a=gformGetProductIds("gfield_shipping",this)),jQuery(document).trigger("gform_price_change",[a,this]),gformCalculateTotalPrice(a.formId)}),jQuery(this).find('input[type="radio"], input[type="checkbox"]').click(function(){var a=gformGetProductIds("gfield_price",this);0==a.formId&&(a=gformGetProductIds("gfield_shipping",this)),jQuery(document).trigger("gform_price_change",[a,this]),gformCalculateTotalPrice(a.formId)})});for(formId in _gformPriceFields)_gformPriceFields.hasOwnProperty(formId)&&gformCalculateTotalPrice(formId)}function gformShowPasswordStrength(a){var b=jQuery("#"+a).val(),c=jQuery("#"+a+"_2").val(),d=gformPasswordStrength(b,c),e=window.gf_text["password_"+d];jQuery("#"+a+"_strength").val(d),jQuery("#"+a+"_strength_indicator").removeClass("blank mismatch short good bad strong").addClass(d).html(e)}function gformPasswordStrength(a,b){var c,d,e=0;return a.length<=0?"blank":a!=b&&b.length>0?"mismatch":a.length<4?"short":(a.match(/[0-9]/)&&(e+=10),a.match(/[a-z]/)&&(e+=26),a.match(/[A-Z]/)&&(e+=26),a.match(/[^a-zA-Z0-9]/)&&(e+=31),c=Math.log(Math.pow(e,a.length)),d=c/Math.LN2,40>d?"bad":56>d?"good":"strong")}function gformAddListItem(a,b){if(!jQuery(a).hasClass("gfield_icon_disabled")){var c=jQuery(a).closest("tr"),d=c.clone(),e=d.find(":input:last").attr("tabindex");d.find("input, select").attr("tabindex",e).not(":checkbox, :radio").val(""),d.find(":checkbox, :radio").prop("checked",!1),d=gform.applyFilters("gform_list_item_pre_add",d),c.after(d),gformToggleIcons(c.parent(),b),gformAdjustClasses(c.parent())}}function gformDeleteListItem(a,b){var c=jQuery(a).parent().parent(),d=c.parent();c.remove(),gformToggleIcons(d,b),gformAdjustClasses(d)}function gformAdjustClasses(a){for(var b=a.children(),c=0;c0&&c>=b)gfield_original_title=a.find(".add_list_item:first").attr("title"),a.find(".add_list_item").addClass("gfield_icon_disabled").attr("title","");else{var d=a.find(".add_list_item");d.removeClass("gfield_icon_disabled"),gfield_original_title&&d.attr("title",gfield_original_title)}}function gformMatchCard(a){var b=gformFindCardType(jQuery("#"+a).val()),c=jQuery("#"+a).parents(".gfield").find(".gform_card_icon_container");b?(jQuery(c).find(".gform_card_icon").removeClass("gform_card_icon_selected").addClass("gform_card_icon_inactive"),jQuery(c).find(".gform_card_icon_"+b).removeClass("gform_card_icon_inactive").addClass("gform_card_icon_selected")):jQuery(c).find(".gform_card_icon").removeClass("gform_card_icon_selected gform_card_icon_inactive")}function gformFindCardType(a){if(a.length<4)return!1;var b=window.gf_cc_rules,c=new Array;for(type in b)if(b.hasOwnProperty(type))for(i in b[type])if(b[type].hasOwnProperty(i)&&0===b[type][i].indexOf(a.substring(0,b[type][i].length))){c[c.length]=type;break}return 1==c.length?c[0].toLowerCase():!1}function gformToggleCreditCard(){jQuery("#gform_payment_method_creditcard").is(":checked")?jQuery(".gform_card_fields_container").slideDown():jQuery(".gform_card_fields_container").slideUp()}function gformInitChosenFields(a,b){return jQuery(a).each(function(){var a=jQuery(this);if("rtl"==jQuery("html").attr("dir")&&a.addClass("chosen-rtl chzn-rtl"),a.is(":visible")&&0==a.siblings(".chosen-container").length){var c=gform.applyFilters("gform_chosen_options",{no_results_text:b},a);a.chosen(c)}})}function gformInitCurrencyFormatFields(a){jQuery(a).each(function(){var a=jQuery(this);a.val(gformFormatMoney(jQuery(this).val()))}).change(function(){jQuery(this).val(gformFormatMoney(jQuery(this).val()))})}function gformFormatNumber(a,b,c,d){if("undefined"==typeof c)if(window.gf_global){var e=new Currency(gf_global.gf_currency_config);c=e.currency.decimal_separator}else c=".";if("undefined"==typeof d)if(window.gf_global){var e=new Currency(gf_global.gf_currency_config);d=e.currency.thousand_separator}else d=",";var e=new Currency;return e.numberFormat(a,b,c,d,!1)}function gformToNumber(a){var b=new Currency(gf_global.gf_currency_config);return b.toNumber(a)}function getMatchGroups(a,b){for(var c=new Array;b.test(a);){var d=c.length;c[d]=b.exec(a),a=a.replace(""+c[d][0],"")}return c}function gformInitSpinner(a,b){"undefined"!=typeof b&&b||(b=gform.applyFilters("gform_spinner_url",gf_global.spinnerUrl,a)),jQuery("#gform_"+a).submit(function(){0==jQuery("#gform_ajax_spinner_"+a).length&&jQuery("#gform_submit_button_"+a+", #gform_wrapper_"+a+" .gform_next_button").after('')})}"undefined"==typeof jQuery.fn.prop&&(jQuery.fn.prop=jQuery.fn.attr),jQuery(document).ready(function(){jQuery(document).bind("gform_post_render",gformBindFormatPricingFields)});var _gformPriceFields=new Array,_anyProductSelected,gfield_original_title="",GFCalc=function(formId,formulaFields){this.patt=/{[^{]*?:(\d+(\.\d+)?)(:(.*?))?}/i,this.exprPatt=/^[0-9 -/*\(\)]+$/i,this.isCalculating={},this.init=function(a,b){var c=this;jQuery(document).bind("gform_post_conditional_logic",function(){for(var d=0;d1||"checkbox"==h.prop("type"))&&(h=h.filter(":checked"));var j=window.gf_check_field_rule?"show"==gf_check_field_rule(a,f,!0,""):!0;if(h.length>0&&j){var k=h.val();k=k.split("|"),g=k.length>1?k[1]:h.val()}var l=gf_global.number_formats[a][f];l||(l=gf_global.number_formats[a][c.field_id]);var m=gformGetDecimalSeparator(l);g=gform.applyFilters("gform_merge_tag_value_pre_calculation",g,d[i],j,c,a),g=gformCleanNumber(g,"","",m),g||(g=0),b=b.replace(d[i][0],g)}return b},this.init(formId,formulaFields)},gform={hooks:{action:{},filter:{}},addAction:function(a,b,c,d){gform.addHook("action",a,b,c,d)},addFilter:function(a,b,c,d){gform.addHook("filter",a,b,c,d)},doAction:function(a){gform.doHook("action",a,arguments)},applyFilters:function(a){return gform.doHook("filter",a,arguments)},removeAction:function(a,b){gform.removeHook("action",a,b)},removeFilter:function(a,b,c){gform.removeHook("filter",a,b,c)},addHook:function(a,b,c,d,e){void 0==gform.hooks[a][b]&&(gform.hooks[a][b]=[]);var f=gform.hooks[a][b];void 0==e&&(e=b+"_"+f.length),gform.hooks[a][b].push({tag:e,callable:c,priority:d})},doHook:function(a,b,c){if(c=Array.prototype.slice.call(c,1),void 0!=gform.hooks[a][b]){var d,e=gform.hooks[a][b];e.sort(function(a,b){return a.priority-b.priority});for(var f=0;f=0;f--)void 0!=d&&d!=e[f].tag||void 0!=c&&c!=e[f].priority||e.splice(f,1)}};!function(a,b){function c(c){function g(a,c){b("#"+a).prepend("
  • "+c+"
  • ")}function h(){var a,c="#gform_uploaded_files_"+q,d=b(c);return a=d.val(),a=""===a?{}:b.parseJSON(a)}function i(a){var b=h(),c=m(a);return"undefined"==typeof b[c]&&(b[c]=[]),b[c]}function j(a){var b=i(a);return b.length}function k(a,b){var c=i(a);c.unshift(b),l(a,c)}function l(a,c){var d=h(),e=b("#gform_uploaded_files_"+q),f=m(a);d[f]=c,e.val(b.toJSON(d))}function m(a){return"input_"+a}function n(a){a.preventDefault()}var o=b(c).data("settings"),p=new plupload.Uploader(o);q=p.settings.multipart_params.form_id,a.uploaders[o.container]=p;var q,r;p.bind("Init",function(c){c.features.dragdrop||b(".gform_drop_instructions").hide();var d=c.settings.multipart_params.field_id,e=parseInt(c.settings.gf_vars.max_files),f=j(d);e>0&&f>=e&&a.toggleDisabled(c.settings,!0)}),a.toggleDisabled=function(a,c){var d=b("string"==typeof a.browse_button?"#"+a.browse_button:a.browse_button);d.prop("disabled",c)},p.init(),p.bind("FilesAdded",function(c,f){var h,i=parseInt(c.settings.gf_vars.max_files),k=c.settings.multipart_params.field_id,l=j(k),m=c.settings.gf_vars.disallowed_extensions;if(i>0&&l>=i)return void b.each(f,function(a,b){c.removeFile(b)});b.each(f,function(a,d){if(h=d.name.split(".").pop(),b.inArray(h,m)>-1)return g(c.settings.gf_vars.message_id,d.name+" - "+e.illegal_extension),void c.removeFile(d);if(d.status==plupload.FAILED||i>0&&l>=i)return void c.removeFile(d);var f="undefined"!=typeof d.size?plupload.formatSize(d.size):e.in_progress,j='
    '+d.name+" ("+f+') "+e.cancel+"
    ";b("#"+c.settings.filelist).prepend(j),l++}),c.refresh();var n="form#gform_"+q,o="input:hidden[name='gform_unique_id']",p=n+" "+o,s=b(p);0==s.length&&(s=b(o)),r=s.val(),""===r&&(r=d(),s.val(r)),i>0&&l>=i&&(a.toggleDisabled(c.settings,!0),g(c.settings.gf_vars.message_id,e.max_reached)),c.settings.multipart_params.gform_unique_id=r,c.start()}),p.bind("UploadProgress",function(a,c){var d=c.percent+"%";b("#"+c.id+" b").html(d)}),p.bind("Error",function(a,c){if(c.code===plupload.FILE_EXTENSION_ERROR){var d="undefined"!=typeof a.settings.filters.mime_types?a.settings.filters.mime_types[0].extensions:a.settings.filters[0].extensions;g(a.settings.gf_vars.message_id,c.file.name+" - "+e.invalid_file_extension+" "+d)}else if(c.code===plupload.FILE_SIZE_ERROR)g(a.settings.gf_vars.message_id,c.file.name+" - "+e.file_exceeds_limit);else{var f="
  • Error: "+c.code+", Message: "+c.message+(c.file?", File: "+c.file.name:"")+"
  • ";g(a.settings.gf_vars.message_id,f)}b("#"+c.file.id).html(""),a.refresh()}),p.bind("FileUploaded",function(a,c,d){var h=b.secureEvalJSON(d.response);if("error"==h.status)return g(a.settings.gf_vars.message_id,c.name+" - "+h.error.message),void b("#"+c.id).html("");var i=""+c.name+"",j=a.settings.multipart_params.form_id,l=a.settings.multipart_params.field_id;i=""+e.delete_file+" "+i,i=gform.applyFilters("gform_file_upload_markup",i,c,a,e,f),b("#"+c.id).html(i);var m=a.settings.multipart_params.field_id;100==c.percent&&(h.status&&"ok"==h.status?k(m,h.data):g(a.settings.gf_vars.message_id,e.unknown_error+": "+c.name))}),b("#"+o.drop_element).on({dragenter:n,dragover:n})}function d(){return"xxxxxxxx".replace(/[xy]/g,function(a){var b=16*Math.random()|0,c="x"==a?b:3&b|8;return c.toString(16)})}a.uploaders={};var e="undefined"!=typeof gform_gravityforms?gform_gravityforms.strings:{},f="undefined"!=typeof gform_gravityforms?gform_gravityforms.vars.images_url:"";b(document).ready(function(){"undefined"!=typeof adminpage&&"toplevel_page_gf_edit_forms"===adminpage||"undefined"==typeof plupload?b(".gform_button_select_files").prop("disabled",!0):"undefined"!=typeof adminpage&&"forms_page_gf_entries"===adminpage?b(".gform_fileupload_multifile").each(function(){c(this)}):(b(document).bind("gform_post_render",function(d,f){b("form#gform_"+f+" .gform_fileupload_multifile").each(function(){c(this)});var g=b("form#gform_"+f);g.length>0&&g.submit(function(){var c=!1;return b.each(a.uploaders,function(a,b){return b.total.queued>0?(c=!0,!1):void 0}),c?(alert(e.currently_uploading),window["gf_submitting_"+f]=!1,b("#gform_ajax_spinner_"+f).remove(),!1):void 0})}),b(document).bind("gform_post_conditional_logic",function(c,d,e,f){f||b.each(a.uploaders,function(a,b){b.refresh()})}))})}(window.gfMultiFileUploader=window.gfMultiFileUploader||{},jQuery); \ No newline at end of file diff --git a/js/index.php b/js/index.php new file mode 100644 index 0000000..12c197f --- /dev/null +++ b/js/index.php @@ -0,0 +1,2 @@ +r;r++)if(t[r]===e)return!0;return!1}function n(t,e){var r;t.createTextRange?(r=t.createTextRange(),r.move("character",e),r.select()):t.selectionStart&&(t.focus(),t.setSelectionRange(e,e))}function a(t,e){try{return t.type=e,!0}catch(r){return!1}}t.Placeholders={Utils:{addEventListener:e,inArray:r,moveCaret:n,changeType:a}}})(this),function(t){"use strict";function e(){}function r(t,e){var r,n,a=!!e&&t.value!==e,u=t.value===t.getAttribute(V);return(a||u)&&"true"===t.getAttribute(D)?(t.setAttribute(D,"false"),t.value=t.value.replace(t.getAttribute(V),""),t.className=t.className.replace(R,""),n=t.getAttribute(z),n&&(t.setAttribute("maxLength",n),t.removeAttribute(z)),r=t.getAttribute(I),r&&(t.type=r),!0):!1}function n(t){var e,r,n=t.getAttribute(V);return""===t.value&&n?(t.setAttribute(D,"true"),t.value=n,t.className+=" "+k,r=t.getAttribute(z),r||(t.setAttribute(z,t.maxLength),t.removeAttribute("maxLength")),e=t.getAttribute(I),e?t.type="text":"password"===t.type&&K.changeType(t,"text")&&t.setAttribute(I,"password"),!0):!1}function a(t,e){var r,n,a,u,i;if(t&&t.getAttribute(V))e(t);else for(r=t?t.getElementsByTagName("input"):p,n=t?t.getElementsByTagName("textarea"):h,i=0,u=r.length+n.length;u>i;i++)a=r.length>i?r[i]:n[i-r.length],e(a)}function u(t){a(t,r)}function i(t){a(t,n)}function l(t){return function(){b&&t.value===t.getAttribute(V)&&"true"===t.getAttribute(D)?K.moveCaret(t,0):r(t)}}function o(t){return function(){n(t)}}function c(t){return function(e){return m=t.value,"true"===t.getAttribute(D)&&m===t.getAttribute(V)&&K.inArray(C,e.keyCode)?(e.preventDefault&&e.preventDefault(),!1):void 0}}function s(t){return function(){r(t,m),""===t.value&&(t.blur(),K.moveCaret(t,0))}}function d(t){return function(){t===document.activeElement&&t.value===t.getAttribute(V)&&"true"===t.getAttribute(D)&&K.moveCaret(t,0)}}function g(t){return function(){u(t)}}function v(t){t.form&&(L=t.form,L.getAttribute(P)||(K.addEventListener(L,"submit",g(L)),L.setAttribute(P,"true"))),K.addEventListener(t,"focus",l(t)),K.addEventListener(t,"blur",o(t)),b&&(K.addEventListener(t,"keydown",c(t)),K.addEventListener(t,"keyup",s(t)),K.addEventListener(t,"click",d(t))),t.setAttribute(U,"true"),t.setAttribute(V,E),n(t)}var p,h,b,f,m,A,y,E,x,L,T,N,S,w=["text","search","url","tel","email","password","number","textarea"],C=[27,33,34,35,36,37,38,39,40,8,46],B="#ccc",k="placeholdersjs",R=RegExp("(?:^|\\s)"+k+"(?!\\S)"),V="data-placeholder-value",D="data-placeholder-active",I="data-placeholder-type",P="data-placeholder-submit",U="data-placeholder-bound",j="data-placeholder-focus",q="data-placeholder-live",z="data-placeholder-maxlength",F=document.createElement("input"),G=document.getElementsByTagName("head")[0],H=document.documentElement,J=t.Placeholders,K=J.Utils;if(J.nativeSupport=void 0!==F.placeholder,!J.nativeSupport){for(p=document.getElementsByTagName("input"),h=document.getElementsByTagName("textarea"),b="false"===H.getAttribute(j),f="false"!==H.getAttribute(q),A=document.createElement("style"),A.type="text/css",y=document.createTextNode("."+k+" { color:"+B+"; }"),A.styleSheet?A.styleSheet.cssText=y.nodeValue:A.appendChild(y),G.insertBefore(A,G.firstChild),S=0,N=p.length+h.length;N>S;S++)T=p.length>S?p[S]:h[S-p.length],E=T.attributes.placeholder,E&&(E=E.nodeValue,E&&K.inArray(w,T.type)&&v(T));x=setInterval(function(){for(S=0,N=p.length+h.length;N>S;S++)T=p.length>S?p[S]:h[S-p.length],E=T.attributes.placeholder,E&&(E=E.nodeValue,E&&K.inArray(w,T.type)&&(T.getAttribute(U)||v(T),(E!==T.getAttribute(V)||"password"===T.type&&!T.getAttribute(I))&&("password"===T.type&&!T.getAttribute(I)&&K.changeType(T,"text")&&T.setAttribute(I,"password"),T.value===T.getAttribute(V)&&(T.value=E),T.setAttribute(V,E))));f||clearInterval(x)},100)}J.disable=J.nativeSupport?e:u,J.enable=J.nativeSupport?e:i}(this); \ No newline at end of file diff --git a/js/placeholders.jquery.min.js b/js/placeholders.jquery.min.js new file mode 100644 index 0000000..02845bf --- /dev/null +++ b/js/placeholders.jquery.min.js @@ -0,0 +1,2 @@ +/* Placeholders.js v3.0.2 */ +(function(t){"use strict";function e(t,e,r){return t.addEventListener?t.addEventListener(e,r,!1):t.attachEvent?t.attachEvent("on"+e,r):void 0}function r(t,e){var r,n;for(r=0,n=t.length;n>r;r++)if(t[r]===e)return!0;return!1}function n(t,e){var r;t.createTextRange?(r=t.createTextRange(),r.move("character",e),r.select()):t.selectionStart&&(t.focus(),t.setSelectionRange(e,e))}function a(t,e){try{return t.type=e,!0}catch(r){return!1}}t.Placeholders={Utils:{addEventListener:e,inArray:r,moveCaret:n,changeType:a}}})(this),function(t){"use strict";function e(){}function r(){try{return document.activeElement}catch(t){}}function n(t,e){var r,n,a=!!e&&t.value!==e,u=t.value===t.getAttribute(V);return(a||u)&&"true"===t.getAttribute(P)?(t.removeAttribute(P),t.value=t.value.replace(t.getAttribute(V),""),t.className=t.className.replace(R,""),n=t.getAttribute(z),parseInt(n,10)>=0&&(t.setAttribute("maxLength",n),t.removeAttribute(z)),r=t.getAttribute(D),r&&(t.type=r),!0):!1}function a(t){var e,r,n=t.getAttribute(V);return""===t.value&&n?(t.setAttribute(P,"true"),t.value=n,t.className+=" "+I,r=t.getAttribute(z),r||(t.setAttribute(z,t.maxLength),t.removeAttribute("maxLength")),e=t.getAttribute(D),e?t.type="text":"password"===t.type&&K.changeType(t,"text")&&t.setAttribute(D,"password"),!0):!1}function u(t,e){var r,n,a,u,i,l,o;if(t&&t.getAttribute(V))e(t);else for(a=t?t.getElementsByTagName("input"):f,u=t?t.getElementsByTagName("textarea"):h,r=a?a.length:0,n=u?u.length:0,o=0,l=r+n;l>o;o++)i=r>o?a[o]:u[o-r],e(i)}function i(t){u(t,n)}function l(t){u(t,a)}function o(t){return function(){b&&t.value===t.getAttribute(V)&&"true"===t.getAttribute(P)?K.moveCaret(t,0):n(t)}}function c(t){return function(){a(t)}}function s(t){return function(e){return A=t.value,"true"===t.getAttribute(P)&&A===t.getAttribute(V)&&K.inArray(C,e.keyCode)?(e.preventDefault&&e.preventDefault(),!1):void 0}}function d(t){return function(){n(t,A),""===t.value&&(t.blur(),K.moveCaret(t,0))}}function v(t){return function(){t===r()&&t.value===t.getAttribute(V)&&"true"===t.getAttribute(P)&&K.moveCaret(t,0)}}function g(t){return function(){i(t)}}function p(t){t.form&&(T=t.form,"string"==typeof T&&(T=document.getElementById(T)),T.getAttribute(U)||(K.addEventListener(T,"submit",g(T)),T.setAttribute(U,"true"))),K.addEventListener(t,"focus",o(t)),K.addEventListener(t,"blur",c(t)),b&&(K.addEventListener(t,"keydown",s(t)),K.addEventListener(t,"keyup",d(t)),K.addEventListener(t,"click",v(t))),t.setAttribute(j,"true"),t.setAttribute(V,x),(b||t!==r())&&a(t)}var f,h,b,m,A,y,E,x,L,T,S,N,w,B=["text","search","url","tel","email","password","number","textarea"],C=[27,33,34,35,36,37,38,39,40,8,46],k="#ccc",I="placeholdersjs",R=RegExp("(?:^|\\s)"+I+"(?!\\S)"),V="data-placeholder-value",P="data-placeholder-active",D="data-placeholder-type",U="data-placeholder-submit",j="data-placeholder-bound",q="data-placeholder-focus",Q="data-placeholder-live",z="data-placeholder-maxlength",F=document.createElement("input"),G=document.getElementsByTagName("head")[0],H=document.documentElement,J=t.Placeholders,K=J.Utils;if(J.nativeSupport=void 0!==F.placeholder,!J.nativeSupport){for(f=document.getElementsByTagName("input"),h=document.getElementsByTagName("textarea"),b="false"===H.getAttribute(q),m="false"!==H.getAttribute(Q),y=document.createElement("style"),y.type="text/css",E=document.createTextNode("."+I+" { color:"+k+"; }"),y.styleSheet?y.styleSheet.cssText=E.nodeValue:y.appendChild(E),G.insertBefore(y,G.firstChild),w=0,N=f.length+h.length;N>w;w++)S=f.length>w?f[w]:h[w-f.length],x=S.attributes.placeholder,x&&(x=x.nodeValue,x&&K.inArray(B,S.type)&&p(S));L=setInterval(function(){for(w=0,N=f.length+h.length;N>w;w++)S=f.length>w?f[w]:h[w-f.length],x=S.attributes.placeholder,x?(x=x.nodeValue,x&&K.inArray(B,S.type)&&(S.getAttribute(j)||p(S),(x!==S.getAttribute(V)||"password"===S.type&&!S.getAttribute(D))&&("password"===S.type&&!S.getAttribute(D)&&K.changeType(S,"text")&&S.setAttribute(D,"password"),S.value===S.getAttribute(V)&&(S.value=x),S.setAttribute(V,x)))):S.getAttribute(P)&&(n(S),S.removeAttribute(V));m||clearInterval(L)},100)}K.addEventListener(t,"beforeunload",function(){J.disable()}),J.disable=J.nativeSupport?e:i,J.enable=J.nativeSupport?e:l}(this),function(t){"use strict";var e=t.fn.val,r=t.fn.prop;Placeholders.nativeSupport||(t.fn.val=function(t){var r=e.apply(this,arguments),n=this.eq(0).data("placeholder-value");return void 0===t&&this.eq(0).data("placeholder-active")&&r===n?"":r},t.fn.prop=function(t,e){return void 0===e&&this.eq(0).data("placeholder-active")&&"value"===t?"":r.apply(this,arguments)})}(jQuery); \ No newline at end of file diff --git a/js/shortcode-ui.js b/js/shortcode-ui.js new file mode 100755 index 0000000..4c0c7a8 --- /dev/null +++ b/js/shortcode-ui.js @@ -0,0 +1,678 @@ +var GformShortcodeUI; + +( function (gfShortCodeUI, $) { + + var sui = window.GformShortcodeUI = { + models: {}, + collections: {}, + views: {}, + utils: {}, + strings: {} + } + + /** + * Shortcode Attribute Model. + */ + sui.models.ShortcodeAttribute = Backbone.Model.extend({ + defaults: { + attr: '', + label: '', + type: '', + section: '', + description: '', + default: '', + value: '', + }, + }); + + /** + * Shortcode Attributes collection. + */ + sui.models.ShortcodeAttributes = Backbone.Collection.extend({ + model: sui.models.ShortcodeAttribute, + // Deep Clone. + clone: function () { + return new this.constructor(_.map(this.models, function (m) { + return m.clone(); + })); + } + + }); + + /** + * Shortcode Model + */ + sui.models.Shortcode = Backbone.Model.extend({ + + defaults: { + label: '', + shortcode_tag: '', + action_tag: '', + attrs: sui.models.ShortcodeAttributes, + }, + + /** + * Custom set method. + * Handles setting the attribute collection. + */ + set: function (attributes, options) { + + if (attributes.attrs !== undefined && !( attributes.attrs instanceof sui.models.ShortcodeAttributes )) { + + _.each(attributes.attrs, function (attr) { + if (attr.default != undefined) { + attr.value = attr.default + } + }); + + attributes.attrs = new sui.models.ShortcodeAttributes(attributes.attrs); + } + + return Backbone.Model.prototype.set.call(this, attributes, options); + }, + + /** + * Custom toJSON. + * Handles converting the attribute collection to JSON. + */ + toJSON: function (options) { + options = Backbone.Model.prototype.toJSON.call(this, options); + if (options.attrs !== undefined && ( options.attrs instanceof sui.models.ShortcodeAttributes )) { + options.attrs = options.attrs.toJSON(); + } + return options; + }, + + /** + * Custom clone + * Make sure we don't clone a reference to attributes. + */ + clone: function () { + var clone = Backbone.Model.prototype.clone.call(this); + clone.set('attrs', clone.get('attrs').clone()); + return clone; + }, + + /** + * Get the shortcode as... a shortcode! + * + * @return string eg [shortcode attr1=value] + */ + formatShortcode: function () { + + var template, shortcodeAttributes, attrs = [], content, action = '', actions = []; + + this.get('attrs').each(function (attr) { + + var val = attr.get('value'); + var type = attr.get('type'); + var def = attr.get('default'); + + // Skip empty attributes. + // Skip unchecked checkboxes that have don't have default='true'. + if (( ( !val || val.length < 1 ) && type != 'checkbox') || ( type == 'checkbox' && def != 'true' && !val )) { + return; + } + + // Handle content attribute as a special case. + if (attr.get('attr') === 'content') { + content = attr.get('value'); + } else { + attrs.push(attr.get('attr') + '="' + val + '"'); + } + + }); + + + template = "[{{ shortcode }} {{ attributes }}]" + + if (content && content.length > 0) { + template += "{{ content }}[/{{ shortcode }}]" + } + + template = template.replace(/{{ shortcode }}/g, this.get('shortcode_tag')); + template = template.replace(/{{ attributes }}/g, attrs.join(' ')); + template = template.replace(/{{ content }}/g, content); + + return template; + + }, + + validate: function (shortcode) { + var errors = []; + var id = shortcode.attrs.findWhere({attr: 'id'}); + if (!id.get('value')) { + errors.push({'id': sui.strings.pleaseSelectAForm}); + } + + return errors.length ? errors : null; + } + + }); + + // Shortcode Collection + sui.collections.Shortcodes = Backbone.Collection.extend({ + model: sui.models.Shortcode + }); + + + /** + * Single edit shortcode content view. + */ + sui.views.editShortcodeForm = wp.Backbone.View.extend({ + + el: '#gform-shortcode-ui-container', + + template: wp.template('gf-shortcode-default-edit-form'), + + hasAdvancedValue: false, + + events: { + 'click #gform-update-shortcode': 'insertShortcode', + 'click #gform-insert-shortcode': 'insertShortcode', + 'click #gform-cancel-shortcode': 'cancelShortcode' + }, + + initialize: function () { + + _.bindAll(this, 'beforeRender', 'render', 'afterRender'); + + var t = this; + this.render = _.wrap(this.render, function (render) { + t.beforeRender(); + render(); + t.afterRender(); + return t; + }); + + + this.model.get('attrs').each(function (attr) { + switch (attr.get('section')) { + case 'required': + t.views.add( + '.gf-edit-shortcode-form-required-attrs', + new sui.views.editAttributeField({model: attr, parent: t}) + ); + break; + case 'standard': + t.views.add( + '.gf-edit-shortcode-form-standard-attrs', + new sui.views.editAttributeField({model: attr, parent: t}) + ); + break; + default: + t.views.add( + '.gf-edit-shortcode-form-advanced-attrs', + new sui.views.editAttributeField({model: attr, parent: t}) + ); + if (!t.hasAdvancedVal) { + t.hasAdvancedVal = attr.get('value') !== ''; + } + } + }); + + this.listenTo(this.model, 'change', this.render); + }, + + beforeRender: function () { + // + }, + + afterRender: function () { + gform_initialize_tooltips(); + + $('#gform-insert-shortcode').toggle(this.options.viewMode == 'insert'); + $('#gform-update-shortcode').toggle(this.options.viewMode != 'insert'); + $('#gf-edit-shortcode-form-advanced-attrs').toggle(this.hasAdvancedVal); + }, + + insertShortcode: function (e) { + + var isValid = this.model.isValid({validate: true}); + + if (isValid) { + send_to_editor(this.model.formatShortcode()); + tb_remove(); + + this.dispose(); + + } else { + _.each(this.model.validationError, function (error) { + _.each(error, function (message, attr) { + alert(message); + }); + }); + } + }, + cancelShortcode: function (e) { + tb_remove(); + this.dispose(); + }, + dispose: function () { + this.remove(); + $('#gform-shortcode-ui-wrap').append('
    '); + } + }); + + sui.views.editAttributeField = Backbone.View.extend({ + + tagName: "div", + + initialize: function (options) { + this.parent = options.parent; + }, + + events: { + 'keyup input[type="text"]': 'updateValue', + 'keyup textarea': 'updateValue', + 'change select': 'updateValue', + 'change #gf-shortcode-attr-action': 'updateAction', + 'change input[type=checkbox]': 'updateCheckbox', + 'change input[type=radio]': 'updateValue', + 'change input[type=email]': 'updateValue', + 'change input[type=number]': 'updateValue', + 'change input[type=date]': 'updateValue', + 'change input[type=url]': 'updateValue', + + }, + + + render: function () { + this.template = wp.media.template('gf-shortcode-ui-field-' + this.model.get('type')); + return this.$el.html(this.template(this.model.toJSON())); + }, + + /** + * Input Changed Update Callback. + * + * If the input field that has changed is for content or a valid attribute, + * then it should update the model. + */ + updateValue: function (e) { + var $el = $(e.target); + this.model.set('value', $el.val()); + }, + + updateCheckbox: function (e) { + var $el = $(e.target); + var val = $el.prop('checked'); + + this.model.set('value', val); + }, + + updateAction: function (e) { + var $el = $(e.target), + val = $el.val(); + + this.model.set('value', val); + var m = this.parent.model; + var newShortcodeModel = sui.shortcodes.findWhere({shortcode_tag: 'gravityform', action_tag: val}); + + // copy over values to new shortcode model + + + var currentAttrs = m.get('attrs'); + newShortcodeModel.get('attrs').each(function (attr) { + var newAt = attr.get('attr'); + var currentAtModel = currentAttrs.findWhere({attr: newAt}); + if (typeof currentAtModel != 'undefined') { + var currentAt = currentAtModel.get('attr'); + if (newAt == currentAt) { + var currentVal = currentAtModel.get('value'); + attr.set( + 'value', + String(currentVal) + ); + } + } + + + }); + $(this.parent.el).empty(); + var viewMode = this.parent.options.viewMode; + this.parent.dispose(); + this.parent.model.set(newShortcodeModel); + GformShortcodeUI = new sui.views.editShortcodeForm({model: newShortcodeModel, viewMode: viewMode}); + GformShortcodeUI.render(); + + } + + }); + + /** + * Generic shortcode mce view constructor. + * This is cloned and used by each shortcode when registering a view. + */ + sui.utils.shortcodeViewConstructor = { + + View: { + overlay: true, + + shortcodeHTML: false, + + setContent: function (html, option) { + this.getNodes(function (editor, node, content) { + var el = ( option === 'wrap' || option === 'replace' ) ? node : content, + insert = html; + + if (_.isString(insert)) { + insert = editor.dom.createFragment(insert); + } + + if (option === 'replace') { + editor.dom.replace(insert, el); + } else if (option === 'remove') { + node.parentNode.insertBefore(insert, node.nextSibling); + $(node).remove(); + } else { + el.innerHTML = ''; + el.appendChild(insert); + } + }); + }, + + + initialize: function (options) { + var actionTag = typeof options.shortcode.attrs.named.action != 'undefined' ? options.shortcode.attrs.named.action : ''; + var shortcodeModel = sui.shortcodes.findWhere({action_tag: actionTag}); + + if (!shortcodeModel) { + this.shortcodeHTML = decodeURIComponent(options.encodedText); + this.shortcode = false; + return; + } + + var shortcode = shortcodeModel.clone(); + + shortcode.get('attrs').each(function (attr) { + + if (attr.get('attr') in options.shortcode.attrs.named) { + attr.set( + 'value', + options.shortcode.attrs.named[attr.get('attr')] + ); + } + + if (attr.get('attr') === 'content' && ( 'content' in options.shortcode )) { + attr.set('value', options.shortcode.content); + } + + }); + + this.shortcode = shortcode; + }, + + loadingPlaceholder: function () { + return '' + + '
    ' + + '
    ' + + '
    ' + + '
    '; + }, + + /** + * @see wp.mce.View.getEditors + */ + getEditors: function (callback) { + var editors = []; + + _.each(tinymce.editors, function (editor) { + if (editor.plugins.wpview) { + if (callback) { + callback(editor); + } + + editors.push(editor); + } + }, this); + + return editors; + }, + + /** + * @see wp.mce.View.getNodes + */ + getNodes: function (callback) { + var nodes = [], + self = this; + + this.getEditors(function (editor) { + $(editor.getBody()) + .find('[data-wpview-text="' + self.encodedText + '"]') + .each(function (i, node) { + if (callback) { + callback(editor, node, $(node).find('.wpview-content').get(0)); + } + + nodes.push(node); + }); + }); + + return nodes; + }, + + /** + * Set the HTML. Modeled after wp.mce.View.setIframes + * + */ + setIframes: function (body) { + var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver; + + if (body.indexOf(' Visual. + setTimeout(function () { + iframe = dom.add(content, 'iframe', { + src: tinymce.Env.ie ? 'javascript:""' : '', + frameBorder: '0', + id: 'gf-shortcode-preview-' + new Date().getTime(), + allowTransparency: 'true', + scrolling: 'no', + 'class': 'wpview-sandbox', + style: { + width: '100%', + display: 'block' + } + }); + + iframeDoc = iframe.contentWindow.document; + + iframeDoc.open(); + iframeDoc.write( + '' + + '' + + '' + + '' + + head + + styles + + '' + + '' + + '' + + body + + '' + + '' + ); + iframeDoc.close(); + + resize = function () { + // Make sure the iframe still exists. + iframe.contentWindow && $(iframe).height($(iframeDoc.body).height()); + }; + + if (MutationObserver) { + new MutationObserver(_.debounce(function () { + resize(); + }, 100)) + .observe(iframeDoc.body, { + attributes: true, + childList: true, + subtree: true + }); + } else { + for (i = 1; i < 6; i++) { + setTimeout(resize, i * 700); + } + } + + resize(); + + editor.on('wp-body-class-change', function () { + iframeDoc.body.className = editor.getBody().className; + }); + + + }, 50); + }); + + }, + + /** + * Render the shortcode + * + * To ensure consistent rendering - this makes an ajax request to the admin and displays. + * @return string html + */ + getHtml: function () { + + if (!this.shortcode) { + this.setContent(this.shortcodeHTML, 'remove'); + return; + } + + var data; + + if (false === this.shortcodeHTML) { + var attr = this.shortcode.get('attrs').findWhere({attr: 'id'}); + var formId = attr.get('value'); + data = { + action: 'gf_do_shortcode', + post_id: $('#post_ID').val(), + form_id: formId, + shortcode: this.shortcode.formatShortcode(), + nonce: gfShortcodeUIData.previewNonce + }; + + $.post(ajaxurl, data, $.proxy(this.setIframes, this)); + + } + + return this.shortcodeHTML; + + }, + + }, + + edit: function (node) { + + var shortcodeString, model, attr, action; + + shortcodeString = decodeURIComponent($(node).attr('data-wpview-text')); + + var parsedShortcode = wp.shortcode.next('gravityform', shortcodeString); + + if (!parsedShortcode) { + return; + } + + action = parsedShortcode.shortcode.attrs.named.action ? parsedShortcode.shortcode.attrs.named.action : ''; + + var defaultShortcode = sui.shortcodes.findWhere({ + shortcode_tag: parsedShortcode.shortcode.tag, + action_tag: action + }); + + if (!defaultShortcode) { + return; + } + + var currentShortcode = defaultShortcode.clone(); + + // convert attribute strings to object. + _.each(parsedShortcode.shortcode.attrs.named, function (val, key) { + attr = currentShortcode.get('attrs').findWhere({attr: key}); + if (attr) { + attr.set('value', val); + } + }); + + + var idAttr = currentShortcode.get('attrs').findWhere({attr: 'id'}); + var formId = idAttr.get('value'); + $('#add_form_id').val(formId); + + GformShortcodeUI = new sui.views.editShortcodeForm({model: currentShortcode, viewMode: 'update'}); + GformShortcodeUI.render(); + + $('#gform-insert-shortcode').hide(); + $('#gform-update-shortcode').show(); + tb_show("Edit Gravity Form", "#TB_inline?inlineId=select_gravity_form&width=753&height=686", ""); + } + + }; + + $(document).ready(function () { + + sui.strings = gfShortcodeUIData.strings; + + sui.shortcodes = new sui.collections.Shortcodes( gfShortcodeUIData.shortcodes ); + + if( ! gfShortcodeUIData.previewDisabled ){ + wp.mce.views.register( 'gravityform', $.extend(true, {}, sui.utils.shortcodeViewConstructor) ); + } + + $(document).on('click', '.gform_media_link', function () { + sui.shortcodes = new sui.collections.Shortcodes(gfShortcodeUIData.shortcodes); + var shortcode = sui.shortcodes.findWhere({shortcode_tag: 'gravityform', action_tag: ''}); + GformShortcodeUI = new sui.views.editShortcodeForm({model: shortcode, viewMode: 'insert'}); + GformShortcodeUI.render(); + tb_show("Insert Gravity Form", "#TB_inline?inlineId=select_gravity_form&width=753&height=686", ""); + }); + + }); + +}(window.gfShortcodeUI = window.gfShortcodeUI || {}, jQuery)); + diff --git a/js/tooltip_init.js b/js/tooltip_init.js index a12a350..5352818 100644 --- a/js/tooltip_init.js +++ b/js/tooltip_init.js @@ -1,9 +1,13 @@ jQuery(document).ready(function() { + gform_initialize_tooltips(); +}); + +function gform_initialize_tooltips(){ jQuery( ".gf_tooltip" ).tooltip({ - show: 500, - hide: 1000, - content: function () { - return jQuery(this).prop('title'); - } - }); -}); \ No newline at end of file + show: 500, + hide: 1000, + content: function () { + return jQuery(this).prop('title'); + } + }); +} \ No newline at end of file diff --git a/languages/gravityforms-ar.mo b/languages/gravityforms-ar.mo new file mode 100644 index 0000000..748bb56 Binary files /dev/null and b/languages/gravityforms-ar.mo differ diff --git a/languages/gravityforms-da_DK.mo b/languages/gravityforms-da_DK.mo index 10d2e57..8c474d2 100644 Binary files a/languages/gravityforms-da_DK.mo and b/languages/gravityforms-da_DK.mo differ diff --git a/languages/gravityforms-de_DE.mo b/languages/gravityforms-de_DE.mo index e313967..80c0682 100644 Binary files a/languages/gravityforms-de_DE.mo and b/languages/gravityforms-de_DE.mo differ diff --git a/languages/gravityforms-es_ES.mo b/languages/gravityforms-es_ES.mo index 8ab8663..b80732c 100644 Binary files a/languages/gravityforms-es_ES.mo and b/languages/gravityforms-es_ES.mo differ diff --git a/languages/gravityforms-fi.mo b/languages/gravityforms-fi.mo index 9086576..d9b60a7 100644 Binary files a/languages/gravityforms-fi.mo and b/languages/gravityforms-fi.mo differ diff --git a/languages/gravityforms-sv_SE.mo b/languages/gravityforms-sv_SE.mo index 4b1a3fc..cb9f58e 100644 Binary files a/languages/gravityforms-sv_SE.mo and b/languages/gravityforms-sv_SE.mo differ diff --git a/languages/gravityforms.pot b/languages/gravityforms.pot index 77abca6..2bf58cb 100644 --- a/languages/gravityforms.pot +++ b/languages/gravityforms.pot @@ -1,7443 +1,7759 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# +# Copyright 2009-2015 Rocketgenius, Inc. msgid "" msgstr "" -"Project-Id-Version: Gravity Forms\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-10-24 16:42-0500\n" -"PO-Revision-Date: 2014-10-24 16:42-0500\n" -"Last-Translator: Dana Cobb \n" -"Language-Team: Rocketgenius \n" -"Language: en_EN\n" +"Project-Id-Version: Gravity Forms 1.9\n" +"Report-Msgid-Bugs-To: http://www.gravtiyhelp.com\n" +"POT-Creation-Date: 2015-01-28 19:55:54+00:00\n" "MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" +"Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Poedit-KeywordsList: _e;__;_x:1,2c\n" -"X-Poedit-Basepath: .\n" -"X-Generator: Poedit 1.6.10\n" +"PO-Revision-Date: 2015-MO-DA HO:MI+ZONE\n" +"Last-Translator: Rocketgenius \n" +"Language-Team: Rocketgenius \n" +"X-Generator: Gravity Forms Build Server\n" +"X-Poedit-KeywordsList: " +"__;_e;_x:1,2c;_ex:1,2c;_n:1,2;_nx:1,2,4c;_n_noop:1,2;_nx_noop:1,2,3c;esc_" +"attr__;esc_html__;esc_attr_e;esc_html_e;esc_attr_x:1,2c;esc_html_x:1,2c;\n" +"Project-Id-Version: Gravity Forms\n" +"Language: en_US\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -"X-Poedit-SearchPath-0: ..\n" - -#: ../common.php:274 ../common.php:550 ../form_detail.php:2222 +"X-Poedit-Basepath: ../\n" +"X-Poedit-Bookmarks: \n" +"X-Poedit-Country: United States\n" +"X-Poedit-SearchPath-0: .\n" +"X-Poedit-SourceCharset: utf-8\n" +"X-Textdomain-Support: yes\n" + +#: common.php:316 common.php:626 form_detail.php:2562 msgid "Insert Merge Tag" msgstr "" -#: ../common.php:328 ../js.php:900 +#: common.php:377 js.php:1204 msgid "All Submitted Fields" msgstr "" -#: ../common.php:397 +#: common.php:447 msgid "All Pricing Fields" msgstr "" -#: ../common.php:405 ../form_detail.php:2224 -msgid "Client IP Address" +#: common.php:455 form_detail.php:2564 js.php:1204 +msgid "User IP Address" msgstr "" -#: ../common.php:406 ../common.php:407 ../common.php:2306 -#: ../entry_detail.php:985 ../form_detail.php:701 ../form_detail.php:1580 -#: ../form_detail.php:2225 ../form_detail.php:2226 -#: ../includes/addon/class-gf-payment-addon.php:1686 ../js.php:510 -#: ../js.php:900 +#: common.php:456 common.php:457 entry_detail.php:1034 form_detail.php:748 +#: form_detail.php:1662 form_detail.php:2565 form_detail.php:2566 +#: includes/addon/class-gf-payment-addon.php:1704 +#: includes/fields/class-gf-field-date.php:13 js.php:658 js.php:1204 msgid "Date" msgstr "" -#: ../common.php:408 ../form_detail.php:2227 +#: common.php:458 form_detail.php:2567 msgid "Embed Post/Page Id" msgstr "" -#: ../common.php:409 ../form_detail.php:2228 +#: common.php:459 form_detail.php:2568 msgid "Embed Post/Page Title" msgstr "" -#: ../common.php:410 ../form_detail.php:2229 +#: common.php:460 form_detail.php:2569 msgid "Embed URL" msgstr "" -#: ../common.php:411 ../entry_detail.php:345 ../export.php:761 -#: ../select_columns.php:92 +#: common.php:461 entry_detail.php:374 export.php:779 select_columns.php:164 msgid "Entry Id" msgstr "" -#: ../common.php:412 +#: common.php:462 msgid "Entry URL" msgstr "" -#: ../common.php:413 +#: common.php:463 msgid "Form Id" msgstr "" -#: ../common.php:414 ../form_list.php:241 -#: ../includes/addon/class-gf-addon.php:1641 ../js.php:900 ../tooltips.php:33 +#: common.php:464 form_list.php:272 includes/addon/class-gf-addon.php:1694 +#: js.php:1204 tooltips.php:33 msgid "Form Title" msgstr "" -#: ../common.php:415 ../form_detail.php:2230 +#: common.php:465 form_detail.php:2570 msgid "HTTP User Agent" msgstr "" -#: ../common.php:416 ../form_detail.php:2231 +#: common.php:466 form_detail.php:2571 msgid "HTTP Referer URL" msgstr "" -#: ../common.php:419 ../export.php:769 +#: common.php:469 export.php:787 msgid "Post Id" msgstr "" -#: ../common.php:420 +#: common.php:470 msgid "Post Edit URL" msgstr "" -#: ../common.php:423 ../form_detail.php:2232 +#: common.php:473 form_detail.php:2572 msgid "User Display Name" msgstr "" -#: ../common.php:424 ../form_detail.php:2233 +#: common.php:474 form_detail.php:2573 msgid "User Email" msgstr "" -#: ../common.php:425 ../form_detail.php:2234 +#: common.php:475 form_detail.php:2574 msgid "User Login" msgstr "" -#: ../common.php:435 +#: common.php:487 msgid "Required form fields" msgstr "" -#: ../common.php:439 +#: common.php:491 msgid "Optional form fields" msgstr "" -#: ../common.php:443 +#: common.php:495 msgid "Pricing form fields" msgstr "" -#: ../common.php:447 ../common.php:5026 ../form_detail.php:1346 -#: ../form_detail.php:1348 +#: common.php:499 common.php:3016 form_detail.php:1420 form_detail.php:1422 msgid "Other" msgstr "" -#: ../common.php:451 ../common.php:580 ../form_detail.php:249 -#: ../form_detail.php:1554 +#: common.php:503 common.php:657 form_detail.php:259 form_detail.php:1634 msgid "Custom" msgstr "" -#: ../common.php:516 +#: common.php:591 msgid "Select image size" msgstr "" -#: ../common.php:517 +#: common.php:592 msgid "Thumbnail" msgstr "" -#: ../common.php:518 +#: common.php:593 msgid "Thumbnail - Left Aligned" msgstr "" -#: ../common.php:519 +#: common.php:594 msgid "Thumbnail - Centered" msgstr "" -#: ../common.php:520 +#: common.php:595 msgid "Thumbnail - Right Aligned" msgstr "" -#: ../common.php:522 ../form_detail.php:752 ../form_detail.php:1358 -#: ../form_detail.php:1757 +#: common.php:597 form_detail.php:799 form_detail.php:1432 form_detail.php:1983 msgid "Medium" msgstr "" -#: ../common.php:523 +#: common.php:598 msgid "Medium - Left Aligned" msgstr "" -#: ../common.php:524 +#: common.php:599 msgid "Medium - Centered" msgstr "" -#: ../common.php:525 +#: common.php:600 msgid "Medium - Right Aligned" msgstr "" -#: ../common.php:527 ../form_detail.php:753 ../form_detail.php:1358 -#: ../form_detail.php:1758 +#: common.php:602 form_detail.php:800 form_detail.php:1432 form_detail.php:1984 msgid "Large" msgstr "" -#: ../common.php:528 +#: common.php:603 msgid "Large - Left Aligned" msgstr "" -#: ../common.php:529 +#: common.php:604 msgid "Large - Centered" msgstr "" -#: ../common.php:530 +#: common.php:605 msgid "Large - Right Aligned" msgstr "" -#: ../common.php:532 +#: common.php:607 msgid "Full Size" msgstr "" -#: ../common.php:533 +#: common.php:608 msgid "Full Size - Left Aligned" msgstr "" -#: ../common.php:534 +#: common.php:609 msgid "Full Size - Centered" msgstr "" -#: ../common.php:535 +#: common.php:610 msgid "Full Size - Right Aligned" msgstr "" -#: ../common.php:551 +#: common.php:627 msgid "Allowable form fields" msgstr "" -#: ../common.php:1167 ../entry_detail.php:851 +#: common.php:1176 entry_detail.php:905 msgid "Order" msgstr "" -#: ../common.php:1198 ../common.php:2350 ../entry_detail.php:926 -#: ../gravityforms.php:1318 ../includes/addon/class-gf-payment-addon.php:1500 -#: ../js.php:612 +#: common.php:1208 entry_detail.php:980 gravityforms.php:1391 +#: includes/addon/class-gf-payment-addon.php:1516 +#: includes/fields/class-gf-field-total.php:24 js.php:760 msgid "Total" msgstr "" -#: ../common.php:1215 ../common.php:2342 ../entry_detail.php:863 +#: common.php:1225 entry_detail.php:917 +#: includes/fields/class-gf-field-product.php:13 msgid "Product" msgstr "" -#: ../common.php:1216 ../entry_detail.php:864 +#: common.php:1226 entry_detail.php:918 msgid "Qty" msgstr "" -#: ../common.php:1217 ../entry_detail.php:865 +#: common.php:1227 entry_detail.php:919 msgid "Unit Price" msgstr "" -#: ../common.php:1218 ../common.php:3014 ../entry_detail.php:866 -#: ../form_detail.php:527 ../form_detail.php:1325 ../js.php:589 ../js.php:648 +#: common.php:1228 entry_detail.php:920 form_detail.php:572 +#: form_detail.php:1399 includes/fields/class-gf-field-calculation.php:86 +#: includes/fields/class-gf-field-singleproduct.php:91 js.php:737 js.php:796 msgid "Price" msgstr "" -#: ../common.php:1270 +#: common.php:1280 msgid "Total:" msgstr "" -#: ../common.php:1910 -#, php-format +#: common.php:1915 msgid "" -"Gravity Forms require WordPress %s or greater. You must upgrade WordPress in " -"order to use Gravity Forms" +"Gravity Forms require WordPress %s or greater. You must upgrade WordPress " +"in order to use Gravity Forms" msgstr "" -#: ../common.php:2013 -#, php-format +#: common.php:2028 msgid "%s ago" msgstr "" -#: ../common.php:2015 ../common.php:2018 -#, php-format +#: common.php:2030 common.php:2033 msgid "%1$s at %2$s" msgstr "" -#: ../common.php:2200 ../common.php:2273 -#, php-format -msgid "%d of %d items shown. Edit field to view all" +#: common.php:2507 +msgid "Product fields are not editable" msgstr "" -#: ../common.php:2282 -msgid "Single Line Text" +#: common.php:2509 +msgid "Donations are not editable" msgstr "" -#: ../common.php:2284 ../form_detail.php:692 -msgid "Paragraph Text" +#: common.php:3501 form_list.php:325 form_list.php:387 form_list.php:508 +#: form_settings.php:1006 form_settings.php:1770 +#: includes/addon/class-gf-feed-addon.php:1137 js.php:257 js.php:317 +#: notification.php:446 notification.php:1184 +msgid "Active" msgstr "" -#: ../common.php:2286 ../form_detail.php:501 ../form_detail.php:518 -#: ../form_detail.php:552 ../form_detail.php:566 ../form_detail.php:581 -#: ../form_detail.php:693 ../form_detail.php:720 ../form_detail.php:914 -msgid "Drop Down" +#: common.php:3502 form_list.php:321 form_list.php:391 form_list.php:508 +#: form_settings.php:1002 form_settings.php:1770 +#: includes/addon/class-gf-feed-addon.php:1137 js.php:257 js.php:321 +#: notification.php:442 notification.php:1184 +msgid "Inactive" msgstr "" -#: ../common.php:2288 ../form_detail.php:694 ../form_detail.php:721 -#: ../form_detail.php:917 -msgid "Multi Select" +#: common.php:3503 common.php:3532 form_detail.php:1472 select_columns.php:228 +msgid "Save" msgstr "" -#: ../common.php:2290 ../form_detail.php:580 ../form_detail.php:695 -#: ../js.php:495 -msgid "Number" +#: common.php:3504 entry_detail.php:484 +msgid "Update" msgstr "" -#: ../common.php:2292 ../form_detail.php:553 ../form_detail.php:696 -#: ../form_detail.php:722 ../form_detail.php:915 -msgid "Checkboxes" +#: common.php:3505 form_display.php:754 form_display.php:2237 js.php:548 +msgid "Previous" msgstr "" -#: ../common.php:2294 ../form_detail.php:502 ../form_detail.php:519 -#: ../form_detail.php:554 ../form_detail.php:568 ../form_detail.php:697 -#: ../form_detail.php:723 ../form_detail.php:916 -msgid "Radio Buttons" +#: common.php:3506 +msgid "Select a format" msgstr "" -#: ../common.php:2296 ../form_detail.php:504 ../form_detail.php:582 -#: ../form_detail.php:698 -msgid "Hidden" +#: common.php:3507 +msgid "5 of %d items shown. Edit field to view all" msgstr "" -#: ../common.php:2298 -msgid "HTML" +#: common.php:3508 +msgid "Enter a value" msgstr "" -#: ../common.php:2300 ../js.php:383 -msgid "Section Break" +#: common.php:3509 +msgid "Untitled Form" msgstr "" -#: ../common.php:2302 ../form_display.php:2567 -msgid "Page Break" +#: common.php:3510 +msgid "" +"We would love to hear from you! Please fill out this form and we will get " +"in touch with you shortly." msgstr "" -#: ../common.php:2304 ../form_settings.php:1418 -#: ../includes/addon/class-gf-payment-addon.php:1076 -#: ../includes/addon/class-gf-payment-addon.php:1137 -#: ../includes/addon/class-gf-payment-addon.php:1141 ../js.php:414 -#: ../js.php:589 ../notification.php:509 ../notification.php:1033 -msgid "Name" +#: common.php:3511 common.php:3540 form_detail.php:2751 +msgid "Thanks for contacting us! We will get in touch with you shortly." msgstr "" -#: ../common.php:2308 ../form_detail.php:702 ../js.php:515 -msgid "Time" +#: common.php:3512 form_display.php:956 form_list.php:169 +msgid "Submit" msgstr "" -#: ../common.php:2310 ../form_detail.php:703 ../js.php:504 -msgid "Phone" +#: common.php:3513 notification.php:313 +msgid "Loading..." msgstr "" -#: ../common.php:2312 ../includes/addon/class-gf-payment-addon.php:1419 -#: ../js.php:469 -msgid "Address" +#: common.php:3514 +msgid "this field if" msgstr "" -#: ../common.php:2314 ../form_detail.php:704 ../js.php:520 -msgid "Website" +#: common.php:3515 +msgid "this page" msgstr "" -#: ../common.php:2316 ../form_detail.php:705 -#: ../includes/addon/class-gf-payment-addon.php:1418 ../js.php:488 -msgid "Email" +#: common.php:3516 +msgid "this form button if" msgstr "" -#: ../common.php:2318 ../js.php:526 -msgid "Password" +#: common.php:3517 +msgid "Show" msgstr "" -#: ../common.php:2320 ../form_detail.php:706 -msgid "File Upload" +#: common.php:3518 +msgid "Hide" msgstr "" -#: ../common.php:2322 -msgid "CAPTCHA" +#: common.php:3519 entry_list.php:773 form_list.php:383 +msgid "All" msgstr "" -#: ../common.php:2324 ../form_detail.php:707 ../js.php:406 -msgid "List" +#: common.php:3520 includes/addon/class-gf-payment-addon.php:1901 +msgid "Any" msgstr "" -#: ../common.php:2326 ../js.php:476 -msgid "Credit Card" +#: common.php:3521 +msgid "of the following match:" msgstr "" -#: ../common.php:2328 ../common.php:3289 ../common.php:4545 -#: ../form_detail.php:1026 ../form_list.php:409 ../form_list.php:427 -#: ../gravityforms.php:1316 ../widget.php:75 -msgid "Title" +#: common.php:3522 includes/addon/class-gf-addon.php:1958 notification.php:193 +#: notification.php:712 +msgid "is" msgstr "" -#: ../common.php:2330 -msgid "Body" +#: common.php:3523 includes/addon/class-gf-addon.php:1962 notification.php:194 +#: notification.php:713 +msgid "is not" msgstr "" -#: ../common.php:2332 -msgid "Excerpt" +#: common.php:3524 includes/addon/class-gf-addon.php:1966 notification.php:195 +#: notification.php:714 +msgid "greater than" msgstr "" -#: ../common.php:2334 -msgid "Tags" +#: common.php:3525 includes/addon/class-gf-addon.php:1970 notification.php:196 +#: notification.php:715 +msgid "less than" msgstr "" -#: ../common.php:2336 ../form_detail.php:926 -msgid "Category" +#: common.php:3526 includes/addon/class-gf-addon.php:1974 notification.php:197 +#: notification.php:716 +msgid "contains" msgstr "" -#: ../common.php:2338 ../form_detail.php:421 ../form_detail.php:614 -#: ../form_detail.php:651 ../form_settings.php:445 ../gravityforms.php:1437 -msgid "Image" +#: common.php:3527 includes/addon/class-gf-addon.php:1978 notification.php:198 +#: notification.php:717 +msgid "starts with" msgstr "" -#: ../common.php:2340 -msgid "Custom Field" +#: common.php:3528 includes/addon/class-gf-addon.php:1982 notification.php:199 +#: notification.php:718 +msgid "ends with" msgstr "" -#: ../common.php:2344 ../js.php:589 ../js.php:659 -msgid "Quantity" +#: common.php:3530 +msgid "Use this confirmation if" msgstr "" -#: ../common.php:2346 ../js.php:618 -msgid "Option" +#: common.php:3531 +msgid "Send this notification if" msgstr "" -#: ../common.php:2348 ../js.php:601 -msgid "Shipping" +#: common.php:3533 +msgid "Saving..." msgstr "" -#: ../common.php:2462 -msgid "Afghanistan" +#: common.php:3534 +msgid "Are you sure you wish to cancel these changes?" msgstr "" -#: ../common.php:2462 -msgid "Albania" +#: common.php:3535 form_settings.php:1508 +msgid "There was an issue saving this confirmation." msgstr "" -#: ../common.php:2462 -msgid "Algeria" +#: common.php:3536 +msgid "Are you sure you wish to delete this confirmation?" msgstr "" -#: ../common.php:2462 -msgid "American Samoa" +#: common.php:3537 form_settings.php:1528 +msgid "There was an issue deleting this confirmation." msgstr "" -#: ../common.php:2462 -msgid "Andorra" +#: common.php:3538 +msgid "" +"There are unsaved changes to the current confirmation. Would you like to " +"discard these changes?" msgstr "" -#: ../common.php:2462 -msgid "Angola" +#: common.php:3539 +msgid "Untitled Confirmation" msgstr "" -#: ../common.php:2462 -msgid "Antigua and Barbuda" +#: common.php:3541 +msgid "Please select a page." msgstr "" -#: ../common.php:2462 -msgid "Argentina" +#: common.php:3542 +msgid "Please enter a URL." msgstr "" -#: ../common.php:2462 -msgid "Armenia" +#: common.php:3543 +msgid "Please enter a confirmation name." msgstr "" -#: ../common.php:2462 ../form_detail.php:1340 -msgid "Australia" +#: common.php:3545 +msgid "" +"This form contains conditional logic dependent upon this field. Are you " +"sure you want to delete this field? 'OK' to delete, 'Cancel' to abort." msgstr "" -#: ../common.php:2462 -msgid "Austria" +#: common.php:3546 +msgid "" +"This form contains conditional logic dependent upon this choice. Are you " +"sure you want to delete this choice? 'OK' to delete, 'Cancel' to abort." msgstr "" -#: ../common.php:2462 -msgid "Azerbaijan" +#: common.php:3547 +msgid "" +"This form contains conditional logic dependent upon this choice. Are you " +"sure you want to modify this choice? 'OK' to delete, 'Cancel' to abort." msgstr "" -#: ../common.php:2462 -msgid "Bahamas" +#: common.php:3549 +msgid "" +"
    Merge Tags
    Merge tags allow you to dynamically populate submitted " +"field values in your form content wherever this merge tag icon is present." msgstr "" -#: ../common.php:2462 -msgid "Bahrain" +#: common.php:3557 +msgid "Add a condition" msgstr "" -#: ../common.php:2462 -msgid "Bangladesh" +#: common.php:3558 +msgid "Remove a condition" msgstr "" -#: ../common.php:2462 -msgid "Barbados" +#: common.php:3559 +msgid "Include results if {0} match:" msgstr "" -#: ../common.php:2462 -msgid "Belarus" +#: common.php:3561 +msgid "Custom Choices" msgstr "" -#: ../common.php:2462 -msgid "Belgium" +#: common.php:3562 +msgid "Predefined Choices" msgstr "" -#: ../common.php:2462 -msgid "Belize" +#: common.php:3696 +msgid "Any form field" msgstr "" -#: ../common.php:2462 -msgid "Benin" +#: common.php:3800 +msgid "Entry ID" msgstr "" -#: ../common.php:2462 -msgid "Bermuda" +#: common.php:3804 export.php:780 includes/addon/class-gf-addon.php:1691 +#: select_columns.php:165 +msgid "Entry Date" msgstr "" -#: ../common.php:2462 -msgid "Bhutan" +#: common.php:3806 +msgid "yyyy-mm-dd" msgstr "" -#: ../common.php:2462 -msgid "Bolivia" +#: common.php:3809 entry_list.php:781 +msgid "Starred" msgstr "" -#: ../common.php:2462 -msgid "Bosnia and Herzegovina" +#: common.php:3823 +msgid "IP Address" msgstr "" -#: ../common.php:2462 -msgid "Botswana" +#: common.php:3827 +msgid "Source URL" msgstr "" -#: ../common.php:2462 -msgid "Brazil" +#: common.php:3831 entry_detail.php:405 export.php:785 select_columns.php:168 +msgid "Payment Status" msgstr "" -#: ../common.php:2462 -msgid "Brunei" +#: common.php:3857 entry_detail.php:410 export.php:784 select_columns.php:171 +msgid "Payment Date" msgstr "" -#: ../common.php:2462 -msgid "Bulgaria" +#: common.php:3861 entry_detail.php:422 export.php:783 +#: includes/addon/class-gf-payment-addon.php:1211 +#: includes/addon/class-gf-payment-addon.php:1216 select_columns.php:170 +msgid "Payment Amount" msgstr "" -#: ../common.php:2462 -msgid "Burkina Faso" +#: common.php:3865 +msgid "Transaction ID" msgstr "" -#: ../common.php:2462 -msgid "Burundi" +#: common.php:3869 entry_detail.php:382 select_columns.php:172 +msgid "User" msgstr "" -#: ../common.php:2462 -msgid "Cambodia" +#: common.php:3958 +msgid "This type of file is not allowed. Must be one of the following: " msgstr "" -#: ../common.php:2462 -msgid "Cameroon" +#: common.php:3959 +msgid "Delete this file" msgstr "" -#: ../common.php:2462 -msgid "Canada" +#: common.php:3960 +msgid "in progress" msgstr "" -#: ../common.php:2462 -msgid "Cape Verde" +#: common.php:3961 +msgid "File exceeds size limit" msgstr "" -#: ../common.php:2462 -msgid "Cayman Islands" +#: common.php:3962 +msgid "This type of file is not allowed." msgstr "" -#: ../common.php:2462 -msgid "Central African Republic" +#: common.php:3963 +msgid "Maximum number of files reached" msgstr "" -#: ../common.php:2462 -msgid "Chad" +#: common.php:3964 +msgid "There was a problem while saving the file on the server" msgstr "" -#: ../common.php:2462 -msgid "Chile" +#: common.php:3965 +msgid "Please wait for the uploading to complete" msgstr "" -#: ../common.php:2462 -msgid "China" +#: common.php:3966 entry_detail.php:491 form_detail.php:1463 +#: form_detail.php:1473 includes/addon/class-gf-results.php:326 +#: includes/locking/class-gf-locking.php:198 +#: includes/templates/edit-shortcode-form.tpl.php:22 select_columns.php:229 +msgid "Cancel" msgstr "" -#: ../common.php:2462 -msgid "Colombia" +#: common.php:3967 +msgid "Cancel this upload" msgstr "" -#: ../common.php:2462 -msgid "Comoros" +#: common.php:3968 +msgid "Cancelled" msgstr "" -#: ../common.php:2462 -msgid "Congo, Democratic Republic of the" +#: currency.php:111 +msgid "Australian Dollar" msgstr "" -#: ../common.php:2462 -msgid "Congo, Republic of the" +#: currency.php:112 +msgid "Brazilian Real" msgstr "" -#: ../common.php:2462 -msgid "Costa Rica" +#: currency.php:113 +msgid "Canadian Dollar" msgstr "" -#: ../common.php:2462 -msgid "Côte d'Ivoire" +#: currency.php:114 +msgid "Czech Koruna" msgstr "" -#: ../common.php:2462 -msgid "Croatia" +#: currency.php:115 +msgid "Danish Krone" msgstr "" -#: ../common.php:2462 -msgid "Cuba" +#: currency.php:116 +msgid "Euro" msgstr "" -#: ../common.php:2462 -msgid "Cyprus" +#: currency.php:117 +msgid "Hong Kong Dollar" msgstr "" -#: ../common.php:2462 -msgid "Czech Republic" +#: currency.php:118 +msgid "Hungarian Forint" msgstr "" -#: ../common.php:2462 -msgid "Denmark" +#: currency.php:119 +msgid "Israeli New Sheqel" msgstr "" -#: ../common.php:2462 -msgid "Djibouti" +#: currency.php:120 +msgid "Japanese Yen" msgstr "" -#: ../common.php:2462 -msgid "Dominica" +#: currency.php:121 +msgid "Malaysian Ringgit" msgstr "" -#: ../common.php:2462 -msgid "Dominican Republic" +#: currency.php:122 +msgid "Mexican Peso" msgstr "" -#: ../common.php:2462 -msgid "East Timor" +#: currency.php:123 +msgid "Norwegian Krone" msgstr "" -#: ../common.php:2462 -msgid "Ecuador" +#: currency.php:124 +msgid "New Zealand Dollar" msgstr "" -#: ../common.php:2462 -msgid "Egypt" +#: currency.php:125 +msgid "Philippine Peso" msgstr "" -#: ../common.php:2462 -msgid "El Salvador" +#: currency.php:126 +msgid "Polish Zloty" msgstr "" -#: ../common.php:2462 -msgid "Equatorial Guinea" +#: currency.php:127 +msgid "Pound Sterling" msgstr "" -#: ../common.php:2462 -msgid "Eritrea" +#: currency.php:128 +msgid "Russian Ruble" msgstr "" -#: ../common.php:2462 -msgid "Estonia" +#: currency.php:129 +msgid "Singapore Dollar" msgstr "" -#: ../common.php:2462 -msgid "Ethiopia" +#: currency.php:130 +msgid "South African Rand" msgstr "" -#: ../common.php:2462 -msgid "Fiji" +#: currency.php:131 +msgid "Swedish Krona" msgstr "" -#: ../common.php:2462 -msgid "Finland" +#: currency.php:132 +msgid "Swiss Franc" msgstr "" -#: ../common.php:2462 -msgid "France" +#: currency.php:133 +msgid "Taiwan New Dollar" msgstr "" -#: ../common.php:2462 -msgid "French Polynesia" +#: currency.php:134 +msgid "Thai Baht" msgstr "" -#: ../common.php:2462 -msgid "Gabon" +#: currency.php:135 +msgid "U.S. Dollar" msgstr "" -#: ../common.php:2463 -msgid "Gambia" +#: entry_detail.php:100 +msgid "Oops! We couldn't find your entry. Please try again" msgstr "" -#: ../common.php:2463 -msgctxt "Country" -msgid "Georgia" +#: entry_detail.php:161 +msgid "You don't have adequate permission to delete notes." msgstr "" -#: ../common.php:2463 -msgid "Germany" +#: entry_detail.php:189 entry_list.php:102 entry_list.php:122 form_list.php:84 +msgid "You don't have adequate permission to delete entries." msgstr "" -#: ../common.php:2463 -msgid "Ghana" +#: entry_detail.php:212 +msgid "" +"'Would you like to delete this file? \\'Cancel\\' to stop. \\'OK\\' to " +"delete'" msgstr "" -#: ../common.php:2463 -msgid "Greece" +#: entry_detail.php:223 js.php:514 +msgid "Ajax error while deleting field." msgstr "" -#: ../common.php:2463 -msgid "Greenland" +#: entry_detail.php:278 entry_list.php:430 +msgid "You must select at least one type of notification to resend." msgstr "" -#: ../common.php:2463 -msgid "Grenada" +#: entry_detail.php:296 +msgid "Notifications were resent successfully." msgstr "" -#: ../common.php:2463 -msgid "Guam" +#: entry_detail.php:342 +msgid "Entry #" msgstr "" -#: ../common.php:2463 -msgid "Guatemala" +#: entry_detail.php:342 entry_list.php:758 form_detail.php:148 +#: form_settings.php:1377 includes/addon/class-gf-results.php:236 +msgid "Form Name" msgstr "" -#: ../common.php:2463 -msgid "Guinea" +#: entry_detail.php:367 +msgid "Entry" msgstr "" -#: ../common.php:2463 -msgid "Guinea-Bissau" +#: entry_detail.php:375 +msgid "Submitted on" msgstr "" -#: ../common.php:2463 -msgid "Guyana" +#: entry_detail.php:377 export.php:789 includes/addon/class-gf-addon.php:1692 +#: select_columns.php:166 +msgid "User IP" msgstr "" -#: ../common.php:2463 -msgid "Haiti" +#: entry_detail.php:383 +msgid "View user profile" msgstr "" -#: ../common.php:2463 -msgid "Honduras" +#: entry_detail.php:389 +msgid "Embed Url" msgstr "" -#: ../common.php:2463 -msgid "Hong Kong" +#: entry_detail.php:396 +msgid "Edit Post" msgstr "" -#: ../common.php:2463 -msgid "Hungary" +#: entry_detail.php:397 +msgid "Click to edit post" msgstr "" -#: ../common.php:2463 -msgid "Iceland" +#: entry_detail.php:405 +msgid "Subscription Status" msgstr "" -#: ../common.php:2463 -msgid "India" +#: entry_detail.php:410 entry_detail.php:1034 +msgid "Start Date" msgstr "" -#: ../common.php:2463 -msgid "Indonesia" +#: entry_detail.php:416 entry_detail.php:1044 export.php:782 +#: select_columns.php:169 +msgid "Transaction Id" msgstr "" -#: ../common.php:2463 -msgid "Iran" +#: entry_detail.php:416 +msgid "Subscriber Id" msgstr "" -#: ../common.php:2463 -msgid "Iraq" +#: entry_detail.php:422 +msgid "Subscription Amount" msgstr "" -#: ../common.php:2463 -msgid "Ireland" +#: entry_detail.php:440 entry_list.php:823 entry_list.php:1131 +#: entry_list.php:1263 +msgid "Not Spam" msgstr "" -#: ../common.php:2463 -msgid "Israel" +#: entry_detail.php:446 entry_detail.php:459 +msgid "" +"You are about to delete this entry. \\'Cancel\\' to stop, \\'OK\\' to " +"delete." msgstr "" -#: ../common.php:2463 -msgid "Italy" +#: entry_detail.php:446 entry_detail.php:459 entry_list.php:817 +#: entry_list.php:827 entry_list.php:1115 entry_list.php:1140 +#: entry_list.php:1257 entry_list.php:1267 +msgid "Delete Permanently" msgstr "" -#: ../common.php:2463 -msgid "Jamaica" +#: entry_detail.php:454 entry_list.php:813 entry_list.php:1106 +#: entry_list.php:1253 form_list.php:410 form_list.php:530 form_list.php:531 +#: form_list.php:619 +msgid "Restore" msgstr "" -#: ../common.php:2463 -msgid "Japan" +#: entry_detail.php:468 entry_list.php:1289 form_detail.php:2364 +msgid "Move to Trash" msgstr "" -#: ../common.php:2463 -msgid "Jordan" +#: entry_detail.php:474 +msgid "Mark as Spam" msgstr "" -#: ../common.php:2463 -msgid "Kazakhstan" +#: entry_detail.php:484 form_list.php:520 form_settings.php:1779 +#: gravityforms.php:2459 includes/addon/class-gf-feed-addon.php:723 +#: notification.php:1192 +msgid "Edit" msgstr "" -#: ../common.php:2463 -msgid "Kenya" +#: entry_detail.php:513 form_settings.php:1434 notification.php:115 +#: notification.php:429 notification.php:433 +msgid "Notifications" msgstr "" -#: ../common.php:2463 -msgid "Kiribati" +#: entry_detail.php:524 +msgid "" +"You cannot resend notifications for this entry because this form does not " +"currently have any notifications configured." msgstr "" -#: ../common.php:2463 -msgid "North Korea" +#: entry_detail.php:526 entry_list.php:879 +msgid "Configure Notifications" msgstr "" -#: ../common.php:2463 -msgid "South Korea" +#: entry_detail.php:542 entry_list.php:898 notification.php:597 +msgid "Send To" msgstr "" -#: ../common.php:2463 -msgid "Kosovo" +#: entry_detail.php:548 entry_list.php:386 entry_list.php:838 +#: entry_list.php:903 entry_list.php:1278 +msgid "Resend Notifications" msgstr "" -#: ../common.php:2463 -msgid "Kuwait" +#: entry_detail.php:551 entry_list.php:905 +msgid "Resending..." msgstr "" -#: ../common.php:2463 -msgid "Kyrgyzstan" +#: entry_detail.php:565 entry_list.php:839 entry_list.php:941 +msgid "Print" msgstr "" -#: ../common.php:2463 -msgid "Laos" +#: entry_detail.php:568 +msgid "include notes" msgstr "" -#: ../common.php:2463 -msgid "Latvia" +#: entry_detail.php:593 +msgid "Notes" msgstr "" -#: ../common.php:2463 -msgid "Lebanon" +#: entry_detail.php:632 +msgid "Entry Updated." msgstr "" -#: ../common.php:2463 -msgid "Lesotho" +#: entry_detail.php:644 +msgid "Details" msgstr "" -#: ../common.php:2463 -msgid "Liberia" +#: entry_detail.php:703 +msgid " Bulk action" msgstr "" -#: ../common.php:2463 -msgid "Libya" +#: entry_detail.php:705 entry_list.php:808 entry_list.php:1248 +msgid " Bulk action " msgstr "" -#: ../common.php:2463 -msgid "Liechtenstein" +#: entry_detail.php:706 form_detail.php:1474 form_settings.php:1781 +#: includes/addon/class-gf-feed-addon.php:691 +#: includes/addon/class-gf-feed-addon.php:724 notification.php:1194 +msgid "Delete" msgstr "" -#: ../common.php:2463 -msgid "Lithuania" +#: entry_detail.php:709 entry_list.php:856 entry_list.php:1295 +#: form_list.php:421 form_list.php:630 +msgid "Apply" msgstr "" -#: ../common.php:2463 -msgid "Luxembourg" +#: entry_detail.php:758 +msgid "added on" msgstr "" -#: ../common.php:2463 -msgid "Macedonia" +#: entry_detail.php:773 +msgid "Add Note" msgstr "" -#: ../common.php:2463 -msgid "Madagascar" +#: entry_detail.php:781 +msgid "Also email this note to" msgstr "" -#: ../common.php:2463 -msgid "Malawi" +#: entry_detail.php:789 +msgid "Subject:" msgstr "" -#: ../common.php:2463 -msgid "Malaysia" +#: entry_detail.php:820 print-entry.php:91 +msgid "Entry # " msgstr "" -#: ../common.php:2463 -msgid "Maldives" +#: entry_detail.php:829 +msgid "show empty fields" msgstr "" -#: ../common.php:2463 -msgid "Mali" +#: entry_detail.php:1013 +msgid "Subscription Details" msgstr "" -#: ../common.php:2463 -msgid "Malta" +#: entry_detail.php:1013 +msgid "Payment Details" msgstr "" -#: ../common.php:2463 -msgid "Marshall Islands" +#: entry_detail.php:1024 +msgid "Status" msgstr "" -#: ../common.php:2463 -msgid "Mauritania" +#: entry_detail.php:1044 +msgid "Subscription Id" msgstr "" -#: ../common.php:2463 -msgid "Mauritius" +#: entry_detail.php:1054 includes/addon/class-gf-payment-addon.php:1168 +#: includes/addon/class-gf-payment-addon.php:1172 +msgid "Recurring Amount" msgstr "" -#: ../common.php:2463 -msgid "Mexico" +#: entry_detail.php:1054 includes/addon/class-gf-payment-addon.php:1079 +msgid "Amount" msgstr "" -#: ../common.php:2463 -msgid "Micronesia" +#: entry_list.php:20 +msgid "You don't have any active forms. Let's go %screate one%s" msgstr "" -#: ../common.php:2463 -msgid "Moldova" +#: entry_list.php:100 +msgid "Entry deleted." msgstr "" -#: ../common.php:2463 -msgid "Monaco" +#: entry_list.php:114 +msgid "%d entries" msgstr "" -#: ../common.php:2463 -msgid "Mongolia" +#: entry_list.php:114 +msgid "1 entry" msgstr "" -#: ../common.php:2463 -msgid "Montenegro" +#: entry_list.php:120 +msgid "%s deleted." msgstr "" -#: ../common.php:2463 -msgid "Morocco" +#: entry_list.php:128 +msgid "%s moved to Trash." msgstr "" -#: ../common.php:2463 -msgid "Mozambique" +#: entry_list.php:133 +msgid "%s restored from the Trash." msgstr "" -#: ../common.php:2463 -msgid "Myanmar" +#: entry_list.php:138 +msgid "%s restored from the spam." msgstr "" -#: ../common.php:2463 -msgid "Namibia" +#: entry_list.php:143 +msgid "%s marked as spam." msgstr "" -#: ../common.php:2463 -msgid "Nauru" +#: entry_list.php:148 +msgid "%s marked as read." msgstr "" -#: ../common.php:2463 -msgid "Nepal" +#: entry_list.php:153 +msgid "%s marked as unread." msgstr "" -#: ../common.php:2463 -msgid "Netherlands" +#: entry_list.php:158 +msgid "%s starred." msgstr "" -#: ../common.php:2463 -msgid "New Zealand" +#: entry_list.php:163 +msgid "%s unstarred." msgstr "" -#: ../common.php:2464 -msgid "Nicaragua" +#: entry_list.php:225 +msgid "«" msgstr "" -#: ../common.php:2464 -msgid "Niger" +#: entry_list.php:226 +msgid "»" msgstr "" -#: ../common.php:2464 -msgid "Nigeria" +#: entry_list.php:324 +msgid "Ajax error while setting lead property" msgstr "" -#: ../common.php:2464 -msgid "Norway" +#: entry_list.php:378 +msgid "Please select at least one entry." msgstr "" -#: ../common.php:2464 -msgid "Northern Mariana Islands" +#: entry_list.php:392 entry_list.php:1279 +msgid "Print Entries" msgstr "" -#: ../common.php:2464 -msgid "Oman" +#: entry_list.php:455 +msgid "Notifications for %s were resent successfully." msgstr "" -#: ../common.php:2464 -msgid "Pakistan" +#: entry_list.php:457 +msgid "entry" msgstr "" -#: ../common.php:2464 -msgid "Palau" +#: entry_list.php:457 +msgid "entries" msgstr "" -#: ../common.php:2464 -msgid "Palestine" +#: entry_list.php:560 +msgid "All %s{0}%s entries on this page are selected." msgstr "" -#: ../common.php:2464 -msgid "Panama" +#: entry_list.php:561 +msgid "Select all %s{0}%s entries." msgstr "" -#: ../common.php:2464 -msgid "Papua New Guinea" +#: entry_list.php:562 +msgid "All %s{0}%s entries have been selected." msgstr "" -#: ../common.php:2464 -msgid "Paraguay" +#: entry_list.php:563 +msgid "Clear selection" msgstr "" -#: ../common.php:2464 -msgid "Peru" +#: entry_list.php:648 +msgid "Entry List" msgstr "" -#: ../common.php:2464 -msgid "Philippines" +#: entry_list.php:758 form_list.php:459 form_list.php:479 gravityforms.php:1048 +#: gravityforms.php:2491 +msgid "Entries" msgstr "" -#: ../common.php:2464 -msgid "Poland" +#: entry_list.php:777 gravityforms.php:1389 +msgid "Unread" msgstr "" -#: ../common.php:2464 -msgid "Portugal" +#: entry_list.php:788 entry_list.php:844 entry_list.php:1163 +#: entry_list.php:1283 +msgid "Spam" msgstr "" -#: ../common.php:2464 -msgid "Puerto Rico" +#: entry_list.php:795 entry_list.php:850 entry_list.php:1172 form_list.php:395 +#: form_list.php:559 +msgid "Trash" msgstr "" -#: ../common.php:2464 -msgid "Qatar" +#: entry_list.php:799 +msgid "Search" msgstr "" -#: ../common.php:2464 -msgid "Romania" +#: entry_list.php:806 entry_list.php:1246 form_list.php:406 form_list.php:408 +#: form_list.php:615 form_list.php:617 +msgid "Bulk action" msgstr "" -#: ../common.php:2464 -msgid "Russia" +#: entry_list.php:834 entry_list.php:1274 +msgid "Mark as Read" msgstr "" -#: ../common.php:2464 -msgid "Rwanda" +#: entry_list.php:835 entry_list.php:1275 +msgid "Mark as Unread" msgstr "" -#: ../common.php:2464 -msgid "Saint Kitts and Nevis" +#: entry_list.php:836 entry_list.php:1276 +msgid "Add Star" msgstr "" -#: ../common.php:2464 -msgid "Saint Lucia" +#: entry_list.php:837 entry_list.php:1277 +msgid "Remove Star" msgstr "" -#: ../common.php:2464 -msgid "Saint Vincent and the Grenadines" +#: entry_list.php:860 +msgid "" +"WARNING! This operation cannot be undone. Empty trash? \\'Ok\\' to empty " +"trash. \\'Cancel\\' to abort." msgstr "" -#: ../common.php:2464 -msgid "Samoa" +#: entry_list.php:860 +msgid "" +"WARNING! This operation cannot be undone. Permanently delete all spam? " +"\\'Ok\\' to delete. \\'Cancel\\' to abort." msgstr "" -#: ../common.php:2464 -msgid "San Marino" +#: entry_list.php:861 +msgid "Empty Trash" msgstr "" -#: ../common.php:2464 -msgid "Sao Tome and Principe" +#: entry_list.php:861 +msgid "Delete All Spam" msgstr "" -#: ../common.php:2464 -msgid "Saudi Arabia" +#: entry_list.php:877 +msgid "" +"You cannot resend notifications for these entries because this form does " +"not currently have any notifications configured." msgstr "" -#: ../common.php:2464 -msgid "Senegal" +#: entry_list.php:883 +msgid "" +"Specify which notifications you would like to resend for the selected " +"entries." msgstr "" -#: ../common.php:2464 -msgid "Serbia and Montenegro" +#: entry_list.php:914 +msgid "Close Window" msgstr "" -#: ../common.php:2464 -msgid "Seychelles" +#: entry_list.php:929 +msgid "Print all of the selected entries at once." msgstr "" -#: ../common.php:2464 -msgid "Sierra Leone" +#: entry_list.php:933 +msgid "Include notes" msgstr "" -#: ../common.php:2464 -msgid "Singapore" +#: entry_list.php:938 +msgid "Add page break between entries" msgstr "" -#: ../common.php:2464 -msgid "Slovakia" +#: entry_list.php:981 entry_list.php:1005 +msgid "click to select columns to display" msgstr "" -#: ../common.php:2464 -msgid "Slovenia" +#: entry_list.php:1101 entry_list.php:1126 entry_list.php:1152 +msgid "View this entry" msgstr "" -#: ../common.php:2464 -msgid "Solomon Islands" +#: entry_list.php:1101 entry_list.php:1126 entry_list.php:1152 +#: includes/addon/class-gf-payment-addon.php:1894 +msgid "View" msgstr "" -#: ../common.php:2464 -msgid "Somalia" +#: entry_list.php:1106 +msgid "Restore this entry" msgstr "" -#: ../common.php:2464 -msgid "South Africa" +#: entry_list.php:1115 entry_list.php:1140 +msgid "Delete this entry permanently" msgstr "" -#: ../common.php:2464 -msgid "Spain" +#: entry_list.php:1131 +msgid "Mark this entry as not spam" msgstr "" -#: ../common.php:2464 -msgid "Sri Lanka" +#: entry_list.php:1156 +msgid "Mark read" msgstr "" -#: ../common.php:2464 -msgid "Sudan" +#: entry_list.php:1156 +msgid "Mark this entry as unread" msgstr "" -#: ../common.php:2464 -msgid "Sudan, South" +#: entry_list.php:1156 +msgid "Mark unread" msgstr "" -#: ../common.php:2464 -msgid "Suriname" +#: entry_list.php:1163 +msgid "Mark this entry as spam" msgstr "" -#: ../common.php:2464 -msgid "Swaziland" +#: entry_list.php:1172 +msgid "Move this entry to the trash" msgstr "" -#: ../common.php:2464 -msgid "Sweden" +#: entry_list.php:1210 +msgid "This form does not have any unread entries matching the search criteria." msgstr "" -#: ../common.php:2464 -msgid "Switzerland" +#: entry_list.php:1210 +msgid "This form does not have any unread entries." msgstr "" -#: ../common.php:2464 -msgid "Syria" +#: entry_list.php:1214 +msgid "This form does not have any starred entries matching the search criteria." msgstr "" -#: ../common.php:2464 -msgid "Taiwan" +#: entry_list.php:1214 +msgid "This form does not have any starred entries." msgstr "" -#: ../common.php:2464 -msgid "Tajikistan" +#: entry_list.php:1218 +msgid "This form does not have any spam." msgstr "" -#: ../common.php:2464 -msgid "Tanzania" +#: entry_list.php:1223 +msgid "" +"This form does not have any entries in the trash matching the search " +"criteria." msgstr "" -#: ../common.php:2464 -msgid "Thailand" +#: entry_list.php:1223 +msgid "This form does not have any entries in the trash." msgstr "" -#: ../common.php:2464 -msgid "Togo" +#: entry_list.php:1228 +msgid "This form does not have any entries matching the search criteria." msgstr "" -#: ../common.php:2464 -msgid "Tonga" +#: entry_list.php:1228 +msgid "This form does not have any entries yet." msgstr "" -#: ../common.php:2464 -msgid "Trinidad and Tobago" +#: entry_list.php:1437 +msgid "Displaying %s - %s of %s" msgstr "" -#: ../common.php:2464 -msgid "Tunisia" +#: export.php:16 export.php:459 +msgid "Please select the fields to be exported" msgstr "" -#: ../common.php:2464 -msgid "Turkey" +#: export.php:39 +msgid "Please select the forms to be exported" msgstr "" -#: ../common.php:2464 -msgid "Turkmenistan" +#: export.php:306 +msgid "" +"Forms could not be imported. Please make sure your export file is in the " +"correct format." msgstr "" -#: ../common.php:2464 -msgid "Tuvalu" +#: export.php:308 +msgid "" +"Forms could not be imported. Your export file is not compatible with your " +"current version of Gravity Forms." msgstr "" -#: ../common.php:2464 -msgid "Uganda" +#: export.php:310 +msgid "forms" msgstr "" -#: ../common.php:2464 -msgid "Ukraine" +#: export.php:310 +msgid "form" msgstr "" -#: ../common.php:2464 -msgid "United Arab Emirates" +#: export.php:311 +msgid "Edit Form" msgstr "" -#: ../common.php:2464 -msgid "United Kingdom" +#: export.php:317 export.php:882 +msgid "Import Forms" msgstr "" -#: ../common.php:2465 ../common.php:4343 -msgid "United States" +#: export.php:322 +msgid "" +"Select the Gravity Forms export file you would like to import. When you " +"click the import button below, Gravity Forms will import the forms." msgstr "" -#: ../common.php:2465 -msgid "Uruguay" +#: export.php:333 tooltips.php:148 +msgid "Select File" msgstr "" -#: ../common.php:2465 -msgid "Uzbekistan" +#: export.php:339 +msgid "Import" msgstr "" -#: ../common.php:2465 -msgid "Vanuatu" +#: export.php:355 export.php:881 +msgid "Export Forms" msgstr "" -#: ../common.php:2465 -msgid "Vatican City" +#: export.php:359 +msgid "" +"Select the forms you would like to export. When you click the download " +"button below, Gravity Forms will create a JSON file for you to save to your " +"computer. Once you've saved the download file, you can use the Import tool " +"to import the forms." msgstr "" -#: ../common.php:2465 -msgid "Venezuela" +#: export.php:366 +msgid "Select Forms" msgstr "" -#: ../common.php:2465 -msgid "Vietnam" +#: export.php:387 export.php:539 +msgid "Download Export File" msgstr "" -#: ../common.php:2465 -msgid "Virgin Islands, British" +#: export.php:403 export.php:550 export.php:877 +msgid "Export Entries" msgstr "" -#: ../common.php:2465 -msgid "Virgin Islands, U.S." +#: export.php:428 +msgid "Ajax error while selecting a form" msgstr "" -#: ../common.php:2465 -msgid "Yemen" +#: export.php:444 +msgid "Deselect All" msgstr "" -#: ../common.php:2465 -msgid "Zambia" +#: export.php:444 +msgid "Select All" msgstr "" -#: ../common.php:2465 -msgid "Zimbabwe" +#: export.php:453 +msgid "Export entries if {0} of the following match:" msgstr "" -#: ../common.php:2472 -msgid "AFGHANISTAN" +#: export.php:468 +msgid "" +"Select a form below to export entries. Once you have selected a form you " +"may select the fields you would like to export and then define optional " +"filters for field values and the date range. When you click the download " +"button below, Gravity Forms will create a CSV file for you to save to your " +"computer." msgstr "" -#: ../common.php:2473 -msgid "ALBANIA" +#: export.php:476 gravityforms.php:2351 +msgid "Select A Form" msgstr "" -#: ../common.php:2474 -msgid "ALGERIA" +#: export.php:481 +msgid "Select a form" msgstr "" -#: ../common.php:2475 -msgid "AMERICAN SAMOA" +#: export.php:496 +msgid "Select Fields" msgstr "" -#: ../common.php:2476 -msgid "ANDORRA" +#: export.php:505 form_settings.php:1326 +#: includes/addon/class-gf-payment-addon.php:1256 +#: includes/addon/class-gf-payment-addon.php:1258 notification.php:880 +#: tooltips.php:108 tooltips.php:122 tooltips.php:145 +msgid "Conditional Logic" msgstr "" -#: ../common.php:2477 -msgid "ANGOLA" +#: export.php:516 +msgid "Select Date Range" msgstr "" -#: ../common.php:2478 -msgid "ANTIGUA AND BARBUDA" +#: export.php:522 includes/addon/class-gf-results.php:270 +msgid "Start" msgstr "" -#: ../common.php:2479 -msgid "ARGENTINA" +#: export.php:527 includes/addon/class-gf-results.php:278 +msgid "End" msgstr "" -#: ../common.php:2480 -msgid "ARMENIA" +#: export.php:531 +msgid "" +"Date Range is optional, if no date range is selected all entries will be " +"exported." msgstr "" -#: ../common.php:2481 -msgid "AUSTRALIA" +#: export.php:541 +msgid "Exporting entries. Please wait..." msgstr "" -#: ../common.php:2482 -msgid "AUSTRIA" +#: export.php:778 +msgid "Created By (User Id)" msgstr "" -#: ../common.php:2483 -msgid "AZERBAIJAN" +#: export.php:781 includes/addon/class-gf-addon.php:1693 select_columns.php:167 +msgid "Source Url" msgstr "" -#: ../common.php:2484 -msgid "BAHAMAS" +#: export.php:788 +msgid "User Agent" msgstr "" -#: ../common.php:2485 -msgid "BAHRAIN" +#: form_detail.php:145 gravityforms.php:1046 +msgid "New Form" msgstr "" -#: ../common.php:2486 -msgid "BANGLADESH" +#: form_detail.php:148 gravityforms.php:2459 +msgid "Form Editor" msgstr "" -#: ../common.php:2487 -msgid "BARBADOS" +#: form_detail.php:159 form_detail.php:2383 form_settings.php:289 +msgid "There was an error while saving your form." msgstr "" -#: ../common.php:2488 -msgid "BELARUS" +#: form_detail.php:160 form_detail.php:2384 form_settings.php:290 +msgid "Please %scontact our support team%s." msgstr "" -#: ../common.php:2489 -msgid "BELGIUM" +#: form_detail.php:168 +msgid "" +"The form title you have entered is already taken. Please enter a unique " +"form title." msgstr "" -#: ../common.php:2490 -msgid "BELIZE" +#: form_detail.php:176 form_detail.php:2379 +msgid "Form updated successfully." msgstr "" -#: ../common.php:2491 -msgid "BENIN" +#: form_detail.php:202 +msgid "click to edit page options" msgstr "" -#: ../common.php:2492 -msgid "BERMUDA" +#: form_detail.php:207 +msgid "begin form" msgstr "" -#: ../common.php:2493 -msgid "BHUTAN" +#: form_detail.php:208 +msgid "START PAGING" msgstr "" -#: ../common.php:2494 -msgid "BOLIVIA" +#: form_detail.php:209 +msgid "top of the first page" msgstr "" -#: ../common.php:2495 -msgid "BOSNIA AND HERZEGOVINA" +#: form_detail.php:215 form_detail.php:417 +msgid "Properties" msgstr "" -#: ../common.php:2496 -msgid "BOTSWANA" +#: form_detail.php:217 form_detail.php:498 form_detail.php:1186 +msgid "Advanced" msgstr "" -#: ../common.php:2497 -msgid "BRAZIL" +#: form_detail.php:224 tooltips.php:114 +msgid "Progress Indicator" msgstr "" -#: ../common.php:2498 -msgid "BRUNEI" +#: form_detail.php:231 +msgid "Progress Bar" msgstr "" -#: ../common.php:2499 -msgid "BULGARIA" +#: form_detail.php:236 +msgid "Steps" msgstr "" -#: ../common.php:2500 -msgid "BURKINA FASO" +#: form_detail.php:241 form_detail.php:1536 +msgid "None" msgstr "" -#: ../common.php:2501 -msgid "BURUNDI" +#: form_detail.php:250 +msgid "Style" msgstr "" -#: ../common.php:2502 -msgid "CAMBODIA" +#: form_detail.php:254 +msgid "Blue" msgstr "" -#: ../common.php:2503 -msgid "CAMEROON" +#: form_detail.php:255 +msgid "Gray" msgstr "" -#: ../common.php:2504 -msgid "CANADA" +#: form_detail.php:256 form_detail.php:1420 +msgid "Green" msgstr "" -#: ../common.php:2505 -msgid "CAPE VERDE" +#: form_detail.php:257 +msgid "Orange" msgstr "" -#: ../common.php:2506 -msgid "CAYMAN ISLANDS" +#: form_detail.php:258 form_detail.php:832 +msgid "Red" msgstr "" -#: ../common.php:2507 -msgid "CENTRAL AFRICAN REPUBLIC" +#: form_detail.php:265 +msgid "Text Color" msgstr "" -#: ../common.php:2508 -msgid "CHAD" +#: form_detail.php:272 form_detail.php:817 +msgid "Background Color" msgstr "" -#: ../common.php:2509 -msgid "CHILE" +#: form_detail.php:279 tooltips.php:116 +msgid "Page Names" msgstr "" -#: ../common.php:2510 -msgid "CHINA" +#: form_detail.php:291 +msgid "Display completed progress bar on confirmation" msgstr "" -#: ../common.php:2511 -msgid "COLOMBIA" +#: form_detail.php:299 +msgid "Completion Text" msgstr "" -#: ../common.php:2512 -msgid "COMOROS" +#: form_detail.php:311 form_settings.php:452 tooltips.php:104 +msgid "CSS Class Name" msgstr "" -#: ../common.php:2513 -msgid "CONGO, DEMOCRATIC REPUBLIC OF THE" +#: form_detail.php:331 +msgid "" +"This form doesn't have any fields yet. Follow the steps below to get " +"started." msgstr "" -#: ../common.php:2514 -msgid "CONGO, REPUBLIC OF THE" +#: form_detail.php:336 +msgid "Select A Field Type" msgstr "" -#: ../common.php:2515 -msgid "COSTA RICA" +#: form_detail.php:338 +msgid "Start by seleting a field type from the nifty floating panels on the right." msgstr "" -#: ../common.php:2516 -msgid "C&OCIRC;TE D'IVOIRE" +#: form_detail.php:341 +msgid "Start Over There" msgstr "" -#: ../common.php:2517 -msgid "CROATIA" +#: form_detail.php:342 +msgid "Pick a field.. any field. Don't be shy." msgstr "" -#: ../common.php:2518 -msgid "CUBA" +#: form_detail.php:347 +msgid "Click to Add A Field" msgstr "" -#: ../common.php:2519 -msgid "CYPRUS" +#: form_detail.php:349 +msgid "" +"Once you've found the field type you want, click to add it to the form " +"editor here on the left side of your screen." msgstr "" -#: ../common.php:2520 -msgid "CZECH REPUBLIC" +#: form_detail.php:352 +msgid "Now your new field magically appears over here." msgstr "" -#: ../common.php:2521 -msgid "DENMARK" +#: form_detail.php:357 +msgid "Edit Field Options" msgstr "" -#: ../common.php:2522 -msgid "DJIBOUTI" +#: form_detail.php:359 +msgid "Click on the edit link to configure the various field options" msgstr "" -#: ../common.php:2523 -msgid "DOMINICA" +#: form_detail.php:362 +msgid "Preview your changes up here." msgstr "" -#: ../common.php:2524 -msgid "DOMINICAN REPUBLIC" +#: form_detail.php:363 +msgid "Edit the field options. Go ahead.. go crazy." msgstr "" -#: ../common.php:2525 -msgid "EAST TIMOR" +#: form_detail.php:364 +msgid "If you get stuck, mouseover the tool tips for a little help." msgstr "" -#: ../common.php:2526 -msgid "ECUADOR" +#: form_detail.php:369 +msgid "Drag to Arrange Fields" msgstr "" -#: ../common.php:2527 -msgid "EGYPT" +#: form_detail.php:371 +msgid "Drag the fields to arrange them the way you prefer" msgstr "" -#: ../common.php:2528 -msgid "EL SALVADOR" +#: form_detail.php:374 +msgid "Grab here with your cursor." msgstr "" -#: ../common.php:2529 -msgid "EQUATORIAL GUINEA" +#: form_detail.php:375 +msgid "Drag up or down to arrange your fields." msgstr "" -#: ../common.php:2530 -msgid "ERITREA" +#: form_detail.php:380 +msgid "Save Your Form" msgstr "" -#: ../common.php:2531 -msgid "ESTONIA" +#: form_detail.php:382 +msgid "" +"Once you're happy with your form, remember to click on the "update " +"form" button to save all your hard work." msgstr "" -#: ../common.php:2532 -msgid "ETHIOPIA" +#: form_detail.php:385 +msgid "Save Your New Form" msgstr "" -#: ../common.php:2533 -msgid "FIJI" +#: form_detail.php:386 +msgid "You're done. That's it." msgstr "" -#: ../common.php:2534 -msgid "FINLAND" +#: form_detail.php:404 +msgid "Edit Last Page" msgstr "" -#: ../common.php:2535 -msgid "FRANCE" +#: form_detail.php:408 +msgid "end of last page" msgstr "" -#: ../common.php:2536 -msgid "GABON" +#: form_detail.php:409 +msgid "END PAGING" msgstr "" -#: ../common.php:2537 -msgid "GAMBIA" +#: form_detail.php:410 +msgid "end of form" msgstr "" -#: ../common.php:2538 -msgctxt "Country" -msgid "GEORGIA" +#: form_detail.php:423 form_detail.php:685 +msgid "Previous Button" msgstr "" -#: ../common.php:2539 -msgid "GERMANY" +#: form_detail.php:430 form_detail.php:654 form_detail.php:692 +msgid "Default" msgstr "" -#: ../common.php:2540 -msgid "GHANA" +#: form_detail.php:436 form_detail.php:660 form_detail.php:698 +#: form_settings.php:493 gravityforms.php:1521 +msgid "Image" msgstr "" -#: ../common.php:2541 -msgid "GREECE" +#: form_detail.php:442 form_detail.php:666 form_detail.php:704 +msgid "Text:" msgstr "" -#: ../common.php:2542 -msgid "GREENLAND" +#: form_detail.php:449 form_detail.php:673 form_detail.php:711 +msgid "Image Path:" msgstr "" -#: ../common.php:2543 -msgid "GRENADA" +#: form_detail.php:463 +msgid "You have successfully saved your form!" msgstr "" -#: ../common.php:2544 -msgid "GUAM" +#: form_detail.php:465 +msgid "What would you like to do next?" msgstr "" -#: ../common.php:2545 -msgid "GUATEMALA" +#: form_detail.php:468 form_detail.php:2380 gravityforms.php:2508 +msgid "Preview this form" msgstr "" -#: ../common.php:2546 -msgid "GUINEA" +#: form_detail.php:468 +msgid "Preview this Form" msgstr "" -#: ../common.php:2547 -msgid "GUINEA-BISSAU" +#: form_detail.php:473 +msgid "Setup email notifications for this form" msgstr "" -#: ../common.php:2548 -msgid "GUYANA" +#: form_detail.php:473 +msgid "Setup Email Notifications for this Form" msgstr "" -#: ../common.php:2549 -msgid "HAITI" +#: form_detail.php:478 +msgid "Continue editing this form" msgstr "" -#: ../common.php:2550 -msgid "HONDURAS" +#: form_detail.php:478 +msgid "Continue Editing this Form" msgstr "" -#: ../common.php:2551 -msgid "HONG KONG" +#: form_detail.php:482 +msgid "I am done. Take me back to form list" msgstr "" -#: ../common.php:2552 -msgid "HUNGARY" +#: form_detail.php:482 +msgid "Return to Form List" msgstr "" -#: ../common.php:2553 -msgid "ICELAND" +#: form_detail.php:492 +msgid "General" msgstr "" -#: ../common.php:2554 -msgid "INDIA" +#: form_detail.php:495 +msgid "Appearance" msgstr "" -#: ../common.php:2555 -msgid "INDONESIA" +#: form_detail.php:508 tooltips.php:48 tooltips.php:49 +msgid "Field Label" msgstr "" -#: ../common.php:2556 -msgid "IRAN" +#: form_detail.php:519 form_detail.php:1085 +#: includes/fields/class-gf-field-post-image.php:84 +#: includes/fields/class-gf-field-post-image.php:126 +msgid "Description" msgstr "" -#: ../common.php:2557 -msgid "IRAQ" +#: form_detail.php:529 +msgid "Product Field Mapping" msgstr "" -#: ../common.php:2558 -msgid "IRELAND" +#: form_detail.php:541 form_detail.php:558 form_detail.php:593 +#: form_detail.php:607 form_detail.php:621 form_detail.php:733 +#: form_detail.php:762 form_detail.php:959 +msgid "Field Type" msgstr "" -#: ../common.php:2559 -msgid "ISRAEL" +#: form_detail.php:545 +msgid "Single Product" msgstr "" -#: ../common.php:2560 -msgid "ITALY" +#: form_detail.php:546 form_detail.php:563 form_detail.php:597 +#: form_detail.php:611 form_detail.php:626 form_detail.php:740 +#: form_detail.php:767 form_detail.php:963 +#: includes/fields/class-gf-field-select.php:13 +msgid "Drop Down" msgstr "" -#: ../common.php:2561 -msgid "JAMAICA" +#: form_detail.php:547 form_detail.php:564 form_detail.php:599 +#: form_detail.php:613 form_detail.php:744 form_detail.php:770 +#: form_detail.php:965 includes/fields/class-gf-field-radio.php:13 +msgid "Radio Buttons" msgstr "" -#: ../common.php:2562 -msgid "JAPAN" +#: form_detail.php:548 form_detail.php:612 +msgid "User Defined Price" msgstr "" -#: ../common.php:2563 -msgid "JORDAN" +#: form_detail.php:549 form_detail.php:627 form_detail.php:745 +#: form_detail.php:1896 form_detail.php:1932 +#: includes/fields/class-gf-field-hidden.php:13 +msgid "Hidden" msgstr "" -#: ../common.php:2564 -msgid "KAZAKHSTAN" +#: form_detail.php:550 +msgid "Calculation" msgstr "" -#: ../common.php:2565 -msgid "KENYA" +#: form_detail.php:562 +msgid "Single Method" msgstr "" -#: ../common.php:2566 -msgid "KIRIBATI" +#: form_detail.php:583 +msgid "Disable quantity field" msgstr "" -#: ../common.php:2567 -msgid "NORTH KOREA" +#: form_detail.php:598 form_detail.php:743 form_detail.php:769 +#: form_detail.php:964 includes/fields/class-gf-field-checkbox.php:13 +msgid "Checkboxes" msgstr "" -#: ../common.php:2568 -msgid "SOUTH KOREA" +#: form_detail.php:625 form_detail.php:742 +#: includes/fields/class-gf-field-number.php:13 js.php:643 +msgid "Number" msgstr "" -#: ../common.php:2569 -msgid "KOSOVO" +#: form_detail.php:636 form_settings.php:1703 tooltips.php:134 +msgid "Content" msgstr "" -#: ../common.php:2570 -msgid "KUWAIT" +#: form_detail.php:648 +msgid "Next Button" msgstr "" -#: ../common.php:2571 -msgid "KYRGYZSTAN" +#: form_detail.php:724 +msgid "Disable default margins" msgstr "" -#: ../common.php:2572 -msgid "LAOS" +#: form_detail.php:737 form_detail.php:2326 tooltips.php:139 +msgid "Standard Fields" msgstr "" -#: ../common.php:2573 -msgid "LATVIA" +#: form_detail.php:738 form_detail.php:766 +msgid "Single line text" msgstr "" -#: ../common.php:2574 -msgid "LEBANON" +#: form_detail.php:739 includes/fields/class-gf-field-textarea.php:13 +msgid "Paragraph Text" msgstr "" -#: ../common.php:2575 -msgid "LESOTHO" +#: form_detail.php:741 form_detail.php:768 form_detail.php:966 +#: includes/fields/class-gf-field-multiselect.php:13 +msgid "Multi Select" msgstr "" -#: ../common.php:2576 -msgid "LIBERIA" +#: form_detail.php:747 form_detail.php:2327 tooltips.php:140 +msgid "Advanced Fields" msgstr "" -#: ../common.php:2577 -msgid "LIBYA" +#: form_detail.php:749 includes/fields/class-gf-field-time.php:13 js.php:663 +msgid "Time" msgstr "" -#: ../common.php:2578 -msgid "LIECHTENSTEIN" +#: form_detail.php:750 includes/fields/class-gf-field-phone.php:13 js.php:652 +msgid "Phone" msgstr "" -#: ../common.php:2579 -msgid "LITHUANIA" +#: form_detail.php:751 includes/fields/class-gf-field-website.php:13 js.php:668 +msgid "Website" msgstr "" -#: ../common.php:2580 -msgid "LUXEMBOURG" +#: form_detail.php:752 includes/addon/class-gf-payment-addon.php:1433 +#: includes/fields/class-gf-field-email.php:13 js.php:636 +msgid "Email" msgstr "" -#: ../common.php:2581 -msgid "MACEDONIA" +#: form_detail.php:753 includes/fields/class-gf-field-fileupload.php:13 +msgid "File Upload" msgstr "" -#: ../common.php:2582 -msgid "MADAGASCAR" +#: form_detail.php:754 includes/fields/class-gf-field-list.php:13 js.php:559 +msgid "List" msgstr "" -#: ../common.php:2583 -msgid "MALAWI" +#: form_detail.php:781 form_settings.php:1702 +msgid "Type" msgstr "" -#: ../common.php:2584 -msgid "MALAYSIA" +#: form_detail.php:785 +msgid "reCAPTCHA" msgstr "" -#: ../common.php:2585 -msgid "MALDIVES" +#: form_detail.php:786 +msgid "Really Simple CAPTCHA" msgstr "" -#: ../common.php:2586 -msgid "MALI" +#: form_detail.php:787 +msgid "Math Challenge" msgstr "" -#: ../common.php:2587 -msgid "MALTA" +#: form_detail.php:795 form_detail.php:1432 +msgid "Size" msgstr "" -#: ../common.php:2588 -msgid "MARSHALL ISLANDS" +#: form_detail.php:798 form_detail.php:1432 form_detail.php:1982 +msgid "Small" msgstr "" -#: ../common.php:2589 -msgid "MAURITANIA" +#: form_detail.php:808 +msgid "Font Color" msgstr "" -#: ../common.php:2590 -msgid "MAURITIUS" +#: form_detail.php:828 +msgid "Theme" msgstr "" -#: ../common.php:2591 -msgid "MEXICO" +#: form_detail.php:833 +msgid "White" msgstr "" -#: ../common.php:2592 -msgid "MICRONESIA" +#: form_detail.php:834 +msgid "Black Glass" msgstr "" -#: ../common.php:2593 -msgid "MOLDOVA" +#: form_detail.php:835 +msgid "Clean" msgstr "" -#: ../common.php:2594 -msgid "MONACO" +#: form_detail.php:843 tooltips.php:53 +msgid "Custom Field Name" msgstr "" -#: ../common.php:2595 -msgid "MONGOLIA" +#: form_detail.php:850 +msgid "Existing" msgstr "" -#: ../common.php:2596 -msgid "MONTENEGRO" +#: form_detail.php:856 +msgid "New" msgstr "" -#: ../common.php:2597 -msgid "MOROCCO" +#: form_detail.php:862 +msgid "Select an existing custom field" msgstr "" -#: ../common.php:2598 -msgid "MOZAMBIQUE" +#: form_detail.php:879 tooltips.php:124 +msgid "Post Status" msgstr "" -#: ../common.php:2599 -msgid "MYANMAR" +#: form_detail.php:899 +msgid "Default Post Author" msgstr "" -#: ../common.php:2600 -msgid "NAMIBIA" +#: form_detail.php:909 +msgid "Use logged in user as author" msgstr "" -#: ../common.php:2601 -msgid "NAURU" +#: form_detail.php:921 tooltips.php:126 +msgid "Post Format" msgstr "" -#: ../common.php:2602 -msgid "NEPAL" +#: form_detail.php:947 js.php:528 tooltips.php:123 tooltips.php:129 +msgid "Post Category" msgstr "" -#: ../common.php:2603 -msgid "NETHERLANDS" +#: form_detail.php:975 includes/fields/class-gf-field-post-category.php:12 +msgid "Category" msgstr "" -#: ../common.php:2604 -msgid "NEW ZEALAND" +#: form_detail.php:981 +msgid "All Categories" msgstr "" -#: ../common.php:2605 -msgid "NICARAGUA" +#: form_detail.php:987 +msgid "Select Categories" msgstr "" -#: ../common.php:2606 -msgid "NIGER" +#: form_detail.php:1010 +msgid "Display placeholder" msgstr "" -#: ../common.php:2607 -msgid "NIGERIA" +#: form_detail.php:1016 +msgid "Placeholder Label" msgstr "" -#: ../common.php:2608 -msgid "NORTHERN MARIANA ISLANDS" +#: form_detail.php:1026 form_detail.php:1043 form_detail.php:1057 +msgid "Create content template" msgstr "" -#: ../common.php:2609 -msgid "NORWAY" +#: form_detail.php:1072 +msgid "Image Metadata" msgstr "" -#: ../common.php:2610 -msgid "OMAN" +#: form_detail.php:1075 form_list.php:457 form_list.php:477 +#: gravityforms.php:1387 includes/fields/class-gf-field-post-image.php:76 +#: includes/fields/class-gf-field-post-image.php:124 +#: includes/fields/class-gf-field-post-title.php:13 widget.php:77 +msgid "Title" msgstr "" -#: ../common.php:2611 -msgid "PAKISTAN" +#: form_detail.php:1080 includes/fields/class-gf-field-post-image.php:80 +#: includes/fields/class-gf-field-post-image.php:125 +msgid "Caption" msgstr "" -#: ../common.php:2612 -msgid "PALAU" +#: form_detail.php:1095 tooltips.php:132 +msgid "Set as Featured Image" msgstr "" -#: ../common.php:2613 -msgid "PALESTINE" +#: form_detail.php:1107 tooltips.php:58 +msgid "Address Type" msgstr "" -#: ../common.php:2614 -msgid "PANAMA" +#: form_detail.php:1122 tooltips.php:93 +msgid "Address Fields" msgstr "" -#: ../common.php:2615 -msgid "PAPUA NEW GUINEA" +#: form_detail.php:1133 includes/addon/class-gf-payment-addon.php:1437 +#: includes/fields/class-gf-field-address.php:120 +#: includes/fields/class-gf-field-address.php:385 +msgid "State" msgstr "" -#: ../common.php:2616 -msgid "PARAGUAY" +#: form_detail.php:1137 includes/fields/class-gf-field-address.php:386 +msgid "Postal Code" msgstr "" -#: ../common.php:2617 -msgid "PERU" +#: form_detail.php:1145 +msgid "Default %s" msgstr "" -#: ../common.php:2618 -msgid "PHILIPPINES" +#: form_detail.php:1160 tooltips.php:61 +msgid "Default Country" msgstr "" -#: ../common.php:2619 -msgid "POLAND" +#: form_detail.php:1181 +msgid "Name Format" msgstr "" -#: ../common.php:2620 -msgid "PORTUGAL" +#: form_detail.php:1185 +msgid "Extended" msgstr "" -#: ../common.php:2621 -msgid "PUERTO RICO" +#: form_detail.php:1195 tooltips.php:91 +msgid "Name Fields" msgstr "" -#: ../common.php:2622 -msgid "QATAR" +#: form_detail.php:1210 tooltips.php:57 +msgid "Date Input Type" msgstr "" -#: ../common.php:2623 -msgid "ROMANIA" +#: form_detail.php:1214 +msgid "Date Field" msgstr "" -#: ../common.php:2624 -msgid "RUSSIA" +#: form_detail.php:1215 +msgid "Date Picker" msgstr "" -#: ../common.php:2625 -msgid "RWANDA" +#: form_detail.php:1216 +msgid "Date Drop Down" msgstr "" -#: ../common.php:2626 -msgid "SAINT KITTS AND NEVIS" +#: form_detail.php:1223 +msgid "No Icon" msgstr "" -#: ../common.php:2627 -msgid "SAINT LUCIA" +#: form_detail.php:1228 +msgid "Calendar Icon" msgstr "" -#: ../common.php:2628 -msgid "SAINT VINCENT AND THE GRENADINES" +#: form_detail.php:1233 +msgid "Custom Icon" msgstr "" -#: ../common.php:2629 -msgid "SAMOA" +#: form_detail.php:1238 +msgid "Image Path: " msgstr "" -#: ../common.php:2630 -msgid "SAN MARINO" +#: form_detail.php:1242 +msgid "Preview this form to see your custom icon." msgstr "" -#: ../common.php:2631 -msgid "SAO TOME AND PRINCIPE" +#: form_detail.php:1251 +msgid "Date Format" msgstr "" -#: ../common.php:2632 -msgid "SAUDI ARABIA" +#: form_detail.php:1269 +msgid "Customize Fields" msgstr "" -#: ../common.php:2633 -msgid "SENEGAL" +#: form_detail.php:1281 +msgid "Allowed file extensions" msgstr "" -#: ../common.php:2634 -msgid "SERBIA AND MONTENEGRO" +#: form_detail.php:1287 +msgid "Separated with commas (i.e. jpg, gif, png, pdf)" msgstr "" -#: ../common.php:2635 -msgid "SEYCHELLES" +#: form_detail.php:1296 tooltips.php:74 +msgid "Enable Multi-File Upload" msgstr "" -#: ../common.php:2636 -msgid "SIERRA LEONE" +#: form_detail.php:1305 tooltips.php:75 +msgid "Maximum Number of Files" msgstr "" -#: ../common.php:2637 -msgid "SINGAPORE" +#: form_detail.php:1319 tooltips.php:76 +msgid "Maximum File Size" msgstr "" -#: ../common.php:2638 -msgid "SLOVAKIA" +#: form_detail.php:1336 +msgid "Enable multiple columns" msgstr "" -#: ../common.php:2639 -msgid "SLOVENIA" +#: form_detail.php:1349 tooltips.php:56 +msgid "Maximum Rows" msgstr "" -#: ../common.php:2640 -msgid "SOLOMON ISLANDS" +#: form_detail.php:1361 tooltips.php:72 +msgid "Time Format" msgstr "" -#: ../common.php:2641 -msgid "SOMALIA" +#: form_detail.php:1365 +msgid "12 hour" msgstr "" -#: ../common.php:2642 -msgid "SOUTH AFRICA" +#: form_detail.php:1366 +msgid "24 hour" msgstr "" -#: ../common.php:2643 -msgid "SPAIN" +#: form_detail.php:1376 +msgid "Phone Format" msgstr "" -#: ../common.php:2644 -msgid "SRI LANKA" +#: form_detail.php:1381 includes/fields/class-gf-field-address.php:384 +msgid "International" msgstr "" -#: ../common.php:2645 -msgid "SUDAN" +#: form_detail.php:1391 +msgid "show values" msgstr "" -#: ../common.php:2646 -msgid "SUDAN, SOUTH" +#: form_detail.php:1394 +msgid "Choices" msgstr "" -#: ../common.php:2647 -msgid "SURINAME" +#: form_detail.php:1399 form_detail.php:2035 +msgid "Label" msgstr "" -#: ../common.php:2648 -msgid "SWAZILAND" +#: form_detail.php:1399 form_detail.php:2035 +msgid "Value" msgstr "" -#: ../common.php:2649 -msgid "SWEDEN" +#: form_detail.php:1403 +msgid "Bulk Add / Predefined Choices" msgstr "" -#: ../common.php:2650 -msgid "SWITZERLAND" +#: form_detail.php:1411 +msgid "Countries" msgstr "" -#: ../common.php:2651 -msgid "SYRIA" +#: form_detail.php:1412 +msgid "U.S. States" msgstr "" -#: ../common.php:2652 -msgid "TAIWAN" +#: form_detail.php:1413 +msgid "Canadian Province/Territory" msgstr "" -#: ../common.php:2653 -msgid "TAJIKISTAN" +#: form_detail.php:1414 +msgid "Continents" msgstr "" -#: ../common.php:2654 -msgid "TANZANIA" +#: form_detail.php:1414 +msgid "Africa" msgstr "" -#: ../common.php:2655 -msgid "THAILAND" +#: form_detail.php:1414 +msgid "Antarctica" msgstr "" -#: ../common.php:2656 -msgid "TOGO" +#: form_detail.php:1414 +msgid "Asia" msgstr "" -#: ../common.php:2657 -msgid "TONGA" +#: form_detail.php:1414 includes/fields/class-gf-field-address.php:447 +msgid "Australia" msgstr "" -#: ../common.php:2658 -msgid "TRINIDAD AND TOBAGO" +#: form_detail.php:1414 +msgid "Europe" msgstr "" -#: ../common.php:2659 -msgid "TUNISIA" +#: form_detail.php:1414 +msgid "North America" msgstr "" -#: ../common.php:2660 -msgid "TURKEY" +#: form_detail.php:1414 +msgid "South America" msgstr "" -#: ../common.php:2661 -msgid "TURKMENISTAN" +#: form_detail.php:1415 +msgid "Gender" msgstr "" -#: ../common.php:2662 -msgid "TUVALU" +#: form_detail.php:1415 +msgid "Male" msgstr "" -#: ../common.php:2663 -msgid "UGANDA" +#: form_detail.php:1415 +msgid "Female" msgstr "" -#: ../common.php:2664 -msgid "UKRAINE" +#: form_detail.php:1415 form_detail.php:1416 form_detail.php:1418 +#: form_detail.php:1421 form_detail.php:1422 +msgid "Prefer Not to Answer" msgstr "" -#: ../common.php:2665 -msgid "UNITED ARAB EMIRATES" +#: form_detail.php:1416 +msgid "Age" msgstr "" -#: ../common.php:2666 -msgid "UNITED KINGDOM" +#: form_detail.php:1416 +msgid "Under 18" msgstr "" -#: ../common.php:2667 -msgid "UNITED STATES" +#: form_detail.php:1416 +msgid "18-24" msgstr "" -#: ../common.php:2668 -msgid "URUGUAY" +#: form_detail.php:1416 +msgid "25-34" msgstr "" -#: ../common.php:2669 -msgid "UZBEKISTAN" +#: form_detail.php:1416 +msgid "35-44" msgstr "" -#: ../common.php:2670 -msgid "VANUATU" +#: form_detail.php:1416 +msgid "45-54" msgstr "" -#: ../common.php:2671 -msgid "VATICAN CITY" +#: form_detail.php:1416 +msgid "55-64" msgstr "" -#: ../common.php:2672 -msgid "VENEZUELA" +#: form_detail.php:1416 +msgid "65 or Above" msgstr "" -#: ../common.php:2673 -msgid "VIRGIN ISLANDS, BRITISH" +#: form_detail.php:1417 +msgid "Marital Status" msgstr "" -#: ../common.php:2674 -msgid "VIRGIN ISLANDS, U.S." +#: form_detail.php:1417 +msgid "Single" msgstr "" -#: ../common.php:2675 -msgid "VIETNAM" +#: form_detail.php:1417 +msgid "Married" msgstr "" -#: ../common.php:2676 -msgid "YEMEN" +#: form_detail.php:1417 +msgid "Divorced" msgstr "" -#: ../common.php:2677 -msgid "ZAMBIA" +#: form_detail.php:1417 +msgid "Widowed" msgstr "" -#: ../common.php:2678 -msgid "ZIMBABWE" +#: form_detail.php:1418 +msgid "Employment" msgstr "" -#: ../common.php:2685 ../common.php:2705 -msgid "Alabama" +#: form_detail.php:1418 +msgid "Employed Full-Time" msgstr "" -#: ../common.php:2685 ../common.php:2706 -msgid "Alaska" +#: form_detail.php:1418 +msgid "Employed Part-Time" msgstr "" -#: ../common.php:2685 ../common.php:2707 -msgid "Arizona" +#: form_detail.php:1418 +msgid "Self-employed" msgstr "" -#: ../common.php:2685 ../common.php:2708 -msgid "Arkansas" +#: form_detail.php:1418 +msgid "Not employed but looking for work" msgstr "" -#: ../common.php:2686 ../common.php:2709 -msgid "California" +#: form_detail.php:1418 +msgid "Not employed and not looking for work" msgstr "" -#: ../common.php:2686 ../common.php:2710 -msgid "Colorado" +#: form_detail.php:1418 +msgid "Homemaker" msgstr "" -#: ../common.php:2686 ../common.php:2711 -msgid "Connecticut" +#: form_detail.php:1418 +msgid "Retired" msgstr "" -#: ../common.php:2686 ../common.php:2712 -msgid "Delaware" +#: form_detail.php:1418 +msgid "Student" msgstr "" -#: ../common.php:2687 ../common.php:2713 -msgid "District of Columbia" +#: form_detail.php:1419 +msgid "Job Type" msgstr "" -#: ../common.php:2687 ../common.php:2714 -msgid "Florida" +#: form_detail.php:1419 +msgid "Full-Time" msgstr "" -#: ../common.php:2687 ../common.php:2715 -msgctxt "US State" -msgid "Georgia" +#: form_detail.php:1419 +msgid "Part-Time" msgstr "" -#: ../common.php:2688 ../common.php:2716 -msgid "Hawaii" +#: form_detail.php:1419 +msgid "Per Diem" msgstr "" -#: ../common.php:2688 ../common.php:2717 -msgid "Idaho" +#: form_detail.php:1419 +msgid "Employee" msgstr "" -#: ../common.php:2688 ../common.php:2718 -msgid "Illinois" +#: form_detail.php:1419 +msgid "Temporary" msgstr "" -#: ../common.php:2688 ../common.php:2719 -msgid "Indiana" +#: form_detail.php:1419 +msgid "Contract" msgstr "" -#: ../common.php:2689 ../common.php:2720 -msgid "Iowa" +#: form_detail.php:1419 +msgid "Intern" msgstr "" -#: ../common.php:2689 ../common.php:2721 -msgid "Kansas" +#: form_detail.php:1419 +msgid "Seasonal" msgstr "" -#: ../common.php:2689 ../common.php:2722 -msgid "Kentucky" +#: form_detail.php:1420 +msgid "Industry" msgstr "" -#: ../common.php:2689 ../common.php:2723 -msgid "Louisiana" +#: form_detail.php:1420 +msgid "Accounting/Finance" msgstr "" -#: ../common.php:2690 ../common.php:2724 -msgid "Maine" +#: form_detail.php:1420 +msgid "Advertising/Public Relations" msgstr "" -#: ../common.php:2690 ../common.php:2725 -msgid "Maryland" +#: form_detail.php:1420 +msgid "Aerospace/Aviation" msgstr "" -#: ../common.php:2690 ../common.php:2726 -msgid "Massachusetts" +#: form_detail.php:1420 +msgid "Arts/Entertainment/Publishing" msgstr "" -#: ../common.php:2690 ../common.php:2727 -msgid "Michigan" +#: form_detail.php:1420 +msgid "Automotive" msgstr "" -#: ../common.php:2691 ../common.php:2728 -msgid "Minnesota" +#: form_detail.php:1420 +msgid "Banking/Mortgage" msgstr "" -#: ../common.php:2691 ../common.php:2729 -msgid "Mississippi" +#: form_detail.php:1420 +msgid "Business Development" msgstr "" -#: ../common.php:2691 ../common.php:2730 -msgid "Missouri" +#: form_detail.php:1420 +msgid "Business Opportunity" msgstr "" -#: ../common.php:2691 ../common.php:2731 -msgid "Montana" +#: form_detail.php:1420 +msgid "Clerical/Administrative" msgstr "" -#: ../common.php:2692 ../common.php:2732 -msgid "Nebraska" +#: form_detail.php:1420 +msgid "Construction/Facilities" msgstr "" -#: ../common.php:2692 ../common.php:2733 -msgid "Nevada" +#: form_detail.php:1420 +msgid "Consumer Goods" msgstr "" -#: ../common.php:2692 ../common.php:2734 -msgid "New Hampshire" +#: form_detail.php:1420 +msgid "Customer Service" msgstr "" -#: ../common.php:2692 ../common.php:2735 -msgid "New Jersey" +#: form_detail.php:1420 +msgid "Education/Training" msgstr "" -#: ../common.php:2693 ../common.php:2736 -msgid "New Mexico" +#: form_detail.php:1420 +msgid "Energy/Utilities" msgstr "" -#: ../common.php:2693 ../common.php:2737 -msgid "New York" +#: form_detail.php:1420 +msgid "Engineering" msgstr "" -#: ../common.php:2693 ../common.php:2738 -msgid "North Carolina" +#: form_detail.php:1420 +msgid "Government/Military" msgstr "" -#: ../common.php:2694 ../common.php:2739 -msgid "North Dakota" +#: form_detail.php:1420 +msgid "Healthcare" msgstr "" -#: ../common.php:2694 ../common.php:2740 -msgid "Ohio" +#: form_detail.php:1420 +msgid "Hospitality/Travel" msgstr "" -#: ../common.php:2694 ../common.php:2741 -msgid "Oklahoma" +#: form_detail.php:1420 +msgid "Human Resources" msgstr "" -#: ../common.php:2694 ../common.php:2742 -msgid "Oregon" +#: form_detail.php:1420 +msgid "Installation/Maintenance" msgstr "" -#: ../common.php:2695 ../common.php:2743 -msgid "Pennsylvania" +#: form_detail.php:1420 +msgid "Insurance" msgstr "" -#: ../common.php:2695 ../common.php:2744 -msgid "Rhode Island" +#: form_detail.php:1420 +msgid "Internet" msgstr "" -#: ../common.php:2695 ../common.php:2745 -msgid "South Carolina" +#: form_detail.php:1420 +msgid "Job Search Aids" msgstr "" -#: ../common.php:2696 ../common.php:2746 -msgid "South Dakota" +#: form_detail.php:1420 +msgid "Law Enforcement/Security" msgstr "" -#: ../common.php:2696 ../common.php:2747 -msgid "Tennessee" +#: form_detail.php:1420 +msgid "Legal" msgstr "" -#: ../common.php:2696 ../common.php:2748 -msgid "Texas" +#: form_detail.php:1420 +msgid "Management/Executive" msgstr "" -#: ../common.php:2696 ../common.php:2749 -msgid "Utah" +#: form_detail.php:1420 +msgid "Manufacturing/Operations" msgstr "" -#: ../common.php:2697 ../common.php:2750 -msgid "Vermont" +#: form_detail.php:1420 +msgid "Marketing" msgstr "" -#: ../common.php:2697 ../common.php:2751 -msgid "Virginia" +#: form_detail.php:1420 +msgid "Non-Profit/Volunteer" msgstr "" -#: ../common.php:2697 ../common.php:2752 -msgid "Washington" +#: form_detail.php:1420 +msgid "Pharmaceutical/Biotech" msgstr "" -#: ../common.php:2697 ../common.php:2753 -msgid "West Virginia" +#: form_detail.php:1420 +msgid "Professional Services" msgstr "" -#: ../common.php:2698 ../common.php:2754 -msgid "Wisconsin" +#: form_detail.php:1420 +msgid "QA/Quality Control" msgstr "" -#: ../common.php:2698 ../common.php:2755 -msgid "Wyoming" +#: form_detail.php:1420 +msgid "Real Estate" msgstr "" -#: ../common.php:2698 ../common.php:2756 -msgid "Armed Forces Americas" +#: form_detail.php:1420 +msgid "Restaurant/Food Service" msgstr "" -#: ../common.php:2699 ../common.php:2757 -msgid "Armed Forces Europe" +#: form_detail.php:1420 +msgid "Retail" msgstr "" -#: ../common.php:2699 ../common.php:2758 -msgid "Armed Forces Pacific" +#: form_detail.php:1420 +msgid "Sales" msgstr "" -#: ../common.php:2768 -msgid "Alberta" +#: form_detail.php:1420 +msgid "Science/Research" msgstr "" -#: ../common.php:2768 -msgid "British Columbia" +#: form_detail.php:1420 +msgid "Skilled Labor" msgstr "" -#: ../common.php:2768 -msgid "Manitoba" +#: form_detail.php:1420 +msgid "Technology" msgstr "" -#: ../common.php:2768 -msgid "New Brunswick" +#: form_detail.php:1420 +msgid "Telecommunications" msgstr "" -#: ../common.php:2768 -msgid "Newfoundland & Labrador" +#: form_detail.php:1420 +msgid "Transportation/Logistics" msgstr "" -#: ../common.php:2768 -msgid "Northwest Territories" +#: form_detail.php:1421 +msgid "Income" msgstr "" -#: ../common.php:2768 -msgid "Nova Scotia" +#: form_detail.php:1421 +msgid "Under $20,000" msgstr "" -#: ../common.php:2768 -msgid "Nunavut" +#: form_detail.php:1421 +msgid "$20,000 - $30,000" msgstr "" -#: ../common.php:2768 -msgid "Ontario" +#: form_detail.php:1421 +msgid "$30,000 - $40,000" msgstr "" -#: ../common.php:2768 -msgid "Prince Edward Island" +#: form_detail.php:1421 +msgid "$40,000 - $50,000" msgstr "" -#: ../common.php:2768 -msgid "Quebec" +#: form_detail.php:1421 +msgid "$50,000 - $75,000" msgstr "" -#: ../common.php:2768 -msgid "Saskatchewan" +#: form_detail.php:1421 +msgid "$75,000 - $100,000" msgstr "" -#: ../common.php:2768 -msgid "Yukon" +#: form_detail.php:1421 +msgid "$100,000 - $150,000" msgstr "" -#: ../common.php:2828 -#, php-format -msgid "Please enter a value between %s and %s." +#: form_detail.php:1421 +msgid "$150,000 or more" msgstr "" -#: ../common.php:2830 -#, php-format -msgid "Please enter a value greater than or equal to %s." +#: form_detail.php:1422 +msgid "Education" msgstr "" -#: ../common.php:2832 -#, php-format -msgid "Please enter a value less than or equal to %s." +#: form_detail.php:1422 +msgid "High School" msgstr "" -#: ../common.php:2834 -msgid "Please enter a valid number" +#: form_detail.php:1422 +msgid "Associate Degree" msgstr "" -#: ../common.php:2872 ../common.php:4070 -#: ../includes/addon/class-gf-payment-addon.php:1672 -#: ../includes/addon/class-gf-payment-addon.php:1673 -msgid "Month" +#: form_detail.php:1422 +msgid "Bachelor's Degree" msgstr "" -#: ../common.php:2876 ../includes/addon/class-gf-payment-addon.php:1685 -#: ../includes/addon/class-gf-payment-addon.php:1686 -msgid "Day" +#: form_detail.php:1422 +msgid "Graduate of Professional Degree" msgstr "" -#: ../common.php:2882 ../common.php:4080 -msgid "Year" +#: form_detail.php:1422 +msgid "Some College" msgstr "" -#: ../common.php:2956 -msgid "Product fields are not editable" +#: form_detail.php:1423 +msgid "Days of the Week" msgstr "" -#: ../common.php:2959 -msgid "Donations are not editable" +#: form_detail.php:1423 +msgid "Sunday" msgstr "" -#: ../common.php:2999 ../common.php:3003 -msgid "Quantity:" +#: form_detail.php:1423 +msgid "Monday" msgstr "" -#: ../common.php:3082 ../common.php:3090 ../notification.php:564 -msgid "Enter Email" +#: form_detail.php:1423 +msgid "Tuesday" msgstr "" -#: ../common.php:3082 ../common.php:3090 -msgid "Confirm Email" +#: form_detail.php:1423 +msgid "Wednesday" msgstr "" -#: ../common.php:3115 -msgid "HTML Content" +#: form_detail.php:1423 +msgid "Thursday" msgstr "" -#: ../common.php:3115 -msgid "" -"This is a content placeholder. HTML content is not displayed in the form " -"admin. Preview this form to view the content." +#: form_detail.php:1423 +msgid "Friday" msgstr "" -#: ../common.php:3190 ../js.php:891 -msgid "Phone format:" +#: form_detail.php:1423 +msgid "Saturday" msgstr "" -#: ../common.php:3279 -msgid "delete" +#: form_detail.php:1424 +msgid "Months of the Year" msgstr "" -#: ../common.php:3283 ../js.php:531 -msgid "File" +#: form_detail.php:1424 +msgid "January" msgstr "" -#: ../common.php:3292 ../common.php:4546 ../form_detail.php:1031 -msgid "Caption" +#: form_detail.php:1424 +msgid "February" msgstr "" -#: ../common.php:3295 ../common.php:4547 ../form_detail.php:1036 -#: ../form_detail.php:1493 -msgid "Description" +#: form_detail.php:1424 +msgid "March" msgstr "" -#: ../common.php:3305 -msgid "Click to select..." +#: form_detail.php:1424 +msgid "April" msgstr "" -#: ../common.php:3344 ../form_display.php:2194 -msgid "Strength indicator" +#: form_detail.php:1424 includes/addon/class-gf-payment-addon.php:1779 +msgid "May" msgstr "" -#: ../common.php:3351 -msgid "Enter Password" +#: form_detail.php:1424 +msgid "June" msgstr "" -#: ../common.php:3351 -msgid "Confirm Password" +#: form_detail.php:1424 +msgid "July" msgstr "" -#: ../common.php:3371 ../js.php:420 -msgid "Prefix" +#: form_detail.php:1424 +msgid "August" msgstr "" -#: ../common.php:3371 ../common.php:3380 ../js.php:420 ../js.php:426 -msgid "First" +#: form_detail.php:1424 +msgid "September" msgstr "" -#: ../common.php:3371 ../common.php:3380 ../js.php:420 ../js.php:426 -msgid "Last" +#: form_detail.php:1424 +msgid "October" msgstr "" -#: ../common.php:3371 ../js.php:420 -msgid "Suffix" +#: form_detail.php:1424 +msgid "November" msgstr "" -#: ../common.php:3404 ../common.php:4343 ../form_detail.php:1073 -#: ../includes/addon/class-gf-payment-addon.php:1422 -msgid "State" +#: form_detail.php:1424 +msgid "December" msgstr "" -#: ../common.php:3405 -msgid "Zip Code" +#: form_detail.php:1425 +msgid "How Often" msgstr "" -#: ../common.php:3425 ../js.php:470 -msgid "Street Address" +#: form_detail.php:1425 +msgid "Everyday" msgstr "" -#: ../common.php:3432 ../js.php:470 -msgid "Address Line 2" +#: form_detail.php:1425 +msgid "Once a week" msgstr "" -#: ../common.php:3442 ../common.php:3458 -#: ../includes/addon/class-gf-payment-addon.php:1421 ../js.php:470 -msgid "City" +#: form_detail.php:1425 +msgid "2 to 3 times a week" msgstr "" -#: ../common.php:3479 ../includes/addon/class-gf-payment-addon.php:1424 -#: ../js.php:471 -msgid "Country" +#: form_detail.php:1425 +msgid "Once a month" msgstr "" -#: ../common.php:3501 ../common.php:3543 ../common.php:3560 ../common.php:3574 -#: ../common.php:3627 -msgid "MM" +#: form_detail.php:1425 +msgid " 2 to 3 times a month" msgstr "" -#: ../common.php:3502 ../common.php:3538 ../common.php:3565 ../common.php:3579 -msgid "DD" +#: form_detail.php:1425 +msgid "Less than once a month" msgstr "" -#: ../common.php:3503 ../common.php:3548 ../common.php:3556 ../common.php:3584 -msgid "YYYY" +#: form_detail.php:1426 +msgid "How Long" msgstr "" -#: ../common.php:3625 -msgid "AM" +#: form_detail.php:1426 +msgid "Less than a month" msgstr "" -#: ../common.php:3625 -msgid "PM" +#: form_detail.php:1426 +msgid "1-6 months" msgstr "" -#: ../common.php:3627 -msgid "HH" +#: form_detail.php:1426 +msgid "1-3 years" msgstr "" -#: ../common.php:3663 ../common.php:3682 -msgid "Allowed Files" +#: form_detail.php:1426 +msgid "Over 3 Years" msgstr "" -#: ../common.php:3695 -msgid "Drop files here or" +#: form_detail.php:1426 +msgid "Never used" msgstr "" -#: ../common.php:3695 -msgid "Select files" +#: form_detail.php:1427 +msgid "Satisfaction" msgstr "" -#: ../common.php:3723 -msgid "Download file" +#: form_detail.php:1427 +msgid "Very Satisfied" msgstr "" -#: ../common.php:3723 -msgid "Delete file" +#: form_detail.php:1427 +msgid "Satisfied" msgstr "" -#: ../common.php:3789 -msgid "To use the reCaptcha field you must first do the following:" +#: form_detail.php:1427 +msgid "Neutral" msgstr "" -#: ../common.php:3789 -#, php-format -msgid "Sign up%s for a free reCAPTCHA account" +#: form_detail.php:1427 +msgid "Unsatisfied" msgstr "" -#: ../common.php:3789 -#, php-format -msgid "Enter your reCAPTCHA keys in the %ssettings page%s" +#: form_detail.php:1427 +msgid "Very Unsatisfied" msgstr "" -#: ../common.php:3879 ../common.php:3903 -msgid "Only digits are allowed" +#: form_detail.php:1428 +msgid "Importance" msgstr "" -#: ../common.php:3880 ../js.php:478 -msgid "Card Number" +#: form_detail.php:1428 +msgid "Very Important" msgstr "" -#: ../common.php:3896 ../js.php:479 -msgid "Expiration Date" +#: form_detail.php:1428 form_settings.php:1105 +msgid "Important" msgstr "" -#: ../common.php:3907 ../js.php:480 -msgid "Security Code" +#: form_detail.php:1428 +msgid "Somewhat Important" msgstr "" -#: ../common.php:3912 -msgid "Cardholder Name" +#: form_detail.php:1428 +msgid "Not Important" msgstr "" -#: ../common.php:4000 -msgid "Add another row" +#: form_detail.php:1429 +msgid "Agreement" msgstr "" -#: ../common.php:4000 -msgid "Add a row" +#: form_detail.php:1429 +msgid "Strongly Agree" msgstr "" -#: ../common.php:4001 -msgid "Remove this row" +#: form_detail.php:1429 +msgid "Agree" msgstr "" -#: ../common.php:4342 ../form_detail.php:1307 -msgid "International" +#: form_detail.php:1429 +msgid "Disagree" msgstr "" -#: ../common.php:4342 ../js.php:471 -msgid "ZIP / Postal Code" +#: form_detail.php:1429 +msgid "Strongly Disagree" msgstr "" -#: ../common.php:4342 -msgid "State / Province / Region" +#: form_detail.php:1430 +msgid "Comparison" msgstr "" -#: ../common.php:4343 -msgid "ZIP Code" +#: form_detail.php:1430 +msgid "Much Better" msgstr "" -#: ../common.php:4344 -msgid "Canadian" +#: form_detail.php:1430 +msgid "Somewhat Better" msgstr "" -#: ../common.php:4344 ../form_detail.php:1077 -msgid "Postal Code" +#: form_detail.php:1430 +msgid "About the Same" msgstr "" -#: ../common.php:4344 -msgid "Province" +#: form_detail.php:1430 +msgid "Somewhat Worse" msgstr "" -#: ../common.php:4551 ../common.php:4572 ../entry_list.php:1040 -#: ../entry_list.php:1062 -msgid "Click to view" +#: form_detail.php:1430 +msgid "Much Worse" msgstr "" -#: ../common.php:4611 -msgid "Qty: " +#: form_detail.php:1431 +msgid "Would You" msgstr "" -#: ../common.php:4611 -msgid "Price: " +#: form_detail.php:1431 +msgid "Definitely" msgstr "" -#: ../common.php:5467 ../form_list.php:293 ../form_list.php:349 -#: ../form_list.php:456 ../form_settings.php:897 ../form_settings.php:1489 -#: ../includes/addon/class-gf-feed-addon.php:1023 ../notification.php:416 -#: ../notification.php:1095 -msgid "Active" +#: form_detail.php:1431 +msgid "Probably" msgstr "" -#: ../common.php:5468 ../form_list.php:289 ../form_list.php:350 -#: ../form_list.php:456 ../form_settings.php:893 ../form_settings.php:1489 -#: ../includes/addon/class-gf-feed-addon.php:1023 ../notification.php:412 -#: ../notification.php:1095 -msgid "Inactive" +#: form_detail.php:1431 +msgid "Not Sure" msgstr "" -#: ../common.php:5469 ../common.php:5498 ../form_detail.php:1393 -#: ../select_columns.php:153 -msgid "Save" +#: form_detail.php:1431 +msgid "Probably Not" msgstr "" -#: ../common.php:5470 ../entry_detail.php:451 -msgid "Update" +#: form_detail.php:1431 +msgid "Definitely Not" msgstr "" -#: ../common.php:5471 ../form_display.php:609 ../form_display.php:2435 -#: ../js.php:395 -msgid "Previous" +#: form_detail.php:1432 +msgid "Extra Small" msgstr "" -#: ../common.php:5472 -msgid "Select a format" +#: form_detail.php:1432 +msgid "Extra Large" msgstr "" -#: ../common.php:5473 -#, php-format -msgid "5 of %d items shown. Edit field to view all" +#: form_detail.php:1441 +msgid "" +"Select a category and customize the predefined choices or paste your own " +"list to bulk add choices." msgstr "" -#: ../common.php:5474 -msgid "Enter a value" +#: form_detail.php:1462 +msgid "Insert Choices" msgstr "" -#: ../common.php:5475 -msgid "Untitled Form" +#: form_detail.php:1467 +msgid "Save as new custom choice" msgstr "" -#: ../common.php:5476 -msgid "" -"We would love to hear from you! Please fill out this form and we will get in " -"touch with you shortly." +#: form_detail.php:1470 +msgid "Save as" msgstr "" -#: ../common.php:5477 ../common.php:5506 ../form_detail.php:2375 -msgid "Thanks for contacting us! We will get in touch with you shortly." +#: form_detail.php:1471 +msgid "Enter name" msgstr "" -#: ../common.php:5478 ../form_display.php:804 ../form_list.php:174 -msgid "Submit" +#: form_detail.php:1471 +msgid "enter name" msgstr "" -#: ../common.php:5479 ../notification.php:292 -msgid "Loading..." +#: form_detail.php:1498 +msgid "Enable \"other\" choice" msgstr "" -#: ../common.php:5480 -msgid "this field if" +#: form_detail.php:1511 +msgid "Enable Email Confirmation" msgstr "" -#: ../common.php:5481 -msgid "this page" +#: form_detail.php:1521 +msgid "Enable Password Strength" msgstr "" -#: ../common.php:5482 -msgid "this form button" +#: form_detail.php:1532 +msgid "Minimum Strength" msgstr "" -#: ../common.php:5483 -msgid "Show" +#: form_detail.php:1537 form_display.php:1951 +msgid "Short" msgstr "" -#: ../common.php:5484 -msgid "Hide" +#: form_detail.php:1538 form_display.php:1951 +msgid "Bad" msgstr "" -#: ../common.php:5485 ../entry_list.php:747 ../form_list.php:348 -msgid "All" +#: form_detail.php:1539 form_display.php:1951 +msgid "Good" msgstr "" -#: ../common.php:5486 -msgid "Any" +#: form_detail.php:1540 form_display.php:1951 +msgid "Strong" msgstr "" -#: ../common.php:5487 -msgid "of the following match:" +#: form_detail.php:1550 tooltips.php:68 +msgid "Number Format" msgstr "" -#: ../common.php:5488 ../includes/addon/class-gf-addon.php:1895 -#: ../notification.php:172 ../notification.php:659 -msgid "is" +#: form_detail.php:1556 settings.php:256 tooltips.php:155 +msgid "Currency" msgstr "" -#: ../common.php:5489 ../includes/addon/class-gf-addon.php:1899 -#: ../notification.php:173 ../notification.php:660 -msgid "is not" +#: form_detail.php:1565 tooltips.php:86 +msgid "Sub-Labels" msgstr "" -#: ../common.php:5490 ../includes/addon/class-gf-addon.php:1903 -#: ../notification.php:174 ../notification.php:661 -msgid "greater than" +#: form_detail.php:1581 +msgid "Supported Credit Cards" msgstr "" -#: ../common.php:5491 ../includes/addon/class-gf-addon.php:1907 -#: ../notification.php:175 ../notification.php:662 -msgid "less than" +#: form_detail.php:1602 +msgid "Card Icon Style" msgstr "" -#: ../common.php:5492 ../includes/addon/class-gf-addon.php:1911 -#: ../notification.php:176 ../notification.php:663 -msgid "contains" +#: form_detail.php:1606 form_detail.php:1628 +msgid "Standard" msgstr "" -#: ../common.php:5493 ../includes/addon/class-gf-addon.php:1915 -#: ../notification.php:177 ../notification.php:664 -msgid "starts with" +#: form_detail.php:1607 +msgid "3D" msgstr "" -#: ../common.php:5494 ../includes/addon/class-gf-addon.php:1919 -#: ../notification.php:178 ../notification.php:665 -msgid "ends with" +#: form_detail.php:1617 tooltips.php:138 +msgid "Input Mask" msgstr "" -#: ../common.php:5496 -msgid "Use this confirmation if" +#: form_detail.php:1643 +msgid "Enter a custom mask" msgstr "" -#: ../common.php:5497 -msgid "Send this notification if" +#: form_detail.php:1644 +msgid "Custom Mask Instructions" msgstr "" -#: ../common.php:5499 -msgid "Saving..." +#: form_detail.php:1644 gravityforms.php:1065 +msgid "Help" msgstr "" -#: ../common.php:5500 -msgid "Are you sure you wish to cancel these changes?" +#: form_detail.php:1650 +msgid "Usage" msgstr "" -#: ../common.php:5501 ../form_settings.php:1340 -msgid "There was an issue saving this confirmation." +#: form_detail.php:1652 +msgid "Use a '9' to indicate a numerical character." msgstr "" -#: ../common.php:5502 -msgid "Are you sure you wish to delete this confirmation?" +#: form_detail.php:1653 +msgid "Use a lower case 'a' to indicate an alphabetical character." msgstr "" -#: ../common.php:5503 ../form_settings.php:1360 -msgid "There was an issue deleting this confirmation." +#: form_detail.php:1654 +msgid "Use an asterick '*' to indicate any alphanumeric character." msgstr "" -#: ../common.php:5504 +#: form_detail.php:1655 msgid "" -"There are unsaved changes to the current confirmation. Would you like to " -"discard these changes?" +"Use a question mark '?' to indicate optional characters. " +"Note: All characters after the question mark will be optional." msgstr "" -#: ../common.php:5505 -msgid "Untitled Confirmation" +#: form_detail.php:1656 +msgid "All other characters are literal values and will be displayed automatically." msgstr "" -#: ../common.php:5507 -msgid "Please select a page." +#: form_detail.php:1659 +msgid "Examples" msgstr "" -#: ../common.php:5508 -msgid "Please enter a URL." +#: form_detail.php:1663 form_detail.php:1669 form_detail.php:1676 +#: form_detail.php:1683 form_detail.php:1690 +msgid "Mask" msgstr "" -#: ../common.php:5509 -msgid "Please enter a confirmation name." +#: form_detail.php:1664 form_detail.php:1671 form_detail.php:1678 +#: form_detail.php:1685 form_detail.php:1692 +msgid "Valid Input" msgstr "" -#: ../common.php:5511 -msgid "" -"This form contains conditional logic dependent upon this field. Are you sure " -"you want to delete this field? 'OK' to delete, 'Cancel' to abort." +#: form_detail.php:1668 +msgid "Social Security Number" msgstr "" -#: ../common.php:5512 -msgid "" -"This form contains conditional logic dependent upon this choice. Are you " -"sure you want to delete this choice? 'OK' to delete, 'Cancel' to abort." +#: form_detail.php:1675 +msgid "Course Code" msgstr "" -#: ../common.php:5513 -msgid "" -"This form contains conditional logic dependent upon this choice. Are you " -"sure you want to modify this choice? 'OK' to delete, 'Cancel' to abort." +#: form_detail.php:1682 +msgid "License Key" msgstr "" -#: ../common.php:5515 -msgid "" -"
    Merge Tags
    Merge tags allow you to dynamically populate submitted " -"field values in your form content wherever this merge tag icon is present." +#: form_detail.php:1689 +msgid "Zip Code w/ Optional Plus Four" msgstr "" -#: ../common.php:5523 -msgid "Add a condition" +#: form_detail.php:1701 +msgid "Select a Mask" msgstr "" -#: ../common.php:5524 -msgid "Remove a condition" +#: form_detail.php:1720 tooltips.php:55 +msgid "Maximum Characters" msgstr "" -#: ../common.php:5525 -msgid "Include results if {0} match:" +#: form_detail.php:1730 +msgid "Range" msgstr "" -#: ../common.php:5644 -msgid "Any form field" +#: form_detail.php:1736 +msgid "Min" msgstr "" -#: ../common.php:5748 -msgid "Entry ID" +#: form_detail.php:1742 +msgid "Max" msgstr "" -#: ../common.php:5752 ../export.php:762 -#: ../includes/addon/class-gf-addon.php:1638 ../select_columns.php:93 -msgid "Entry Date" +#: form_detail.php:1758 tooltips.php:82 +msgid "Enable Calculation" msgstr "" -#: ../common.php:5754 -msgid "yyyy-mm-dd" +#: form_detail.php:1766 tooltips.php:83 +msgid "Formula" msgstr "" -#: ../common.php:5757 ../entry_list.php:749 -msgid "Starred" +#: form_detail.php:1780 +msgid "The formula appears to be valid." msgstr "" -#: ../common.php:5771 -msgid "IP Address" +#: form_detail.php:1780 +msgid "There appears to be a problem with the formula." msgstr "" -#: ../common.php:5775 -msgid "Source URL" +#: form_detail.php:1780 +msgid "Validate Formula" msgstr "" -#: ../common.php:5779 ../entry_detail.php:373 ../export.php:767 -#: ../select_columns.php:96 -msgid "Payment Status" +#: form_detail.php:1784 tooltips.php:84 +msgid "Rounding" msgstr "" -#: ../common.php:5801 ../entry_detail.php:377 ../export.php:766 -#: ../select_columns.php:99 -msgid "Payment Date" +#: form_detail.php:1808 +msgid "Rules" msgstr "" -#: ../common.php:5805 ../entry_detail.php:389 ../export.php:765 -#: ../includes/addon/class-gf-payment-addon.php:1210 -#: ../includes/addon/class-gf-payment-addon.php:1215 ../select_columns.php:98 -msgid "Payment Amount" +#: form_detail.php:1811 +msgid "Required" msgstr "" -#: ../common.php:5809 -msgid "Transaction ID" +#: form_detail.php:1818 tooltips.php:80 +msgid "No Duplicates" msgstr "" -#: ../common.php:5813 ../entry_detail.php:353 ../select_columns.php:100 -msgid "User" +#: form_detail.php:1836 form_detail.php:1846 js.php:213 tooltips.php:96 +msgid "Placeholder" msgstr "" -#: ../common.php:5897 -msgid "This type of file is not allowed. Must be one of the following: " +#: form_detail.php:1857 tooltips.php:97 +msgid "Placeholders" msgstr "" -#: ../common.php:5898 -msgid "Delete this file" +#: form_detail.php:1872 form_settings.php:367 +msgid "Left aligned" msgstr "" -#: ../common.php:5899 -msgid "in progress" +#: form_detail.php:1875 form_settings.php:368 +msgid "Right aligned" msgstr "" -#: ../common.php:5900 -msgid "File exceeds size limit" +#: form_detail.php:1879 form_settings.php:366 +msgid "Top aligned" msgstr "" -#: ../common.php:5901 -msgid "This type of file is not allowed." +#: form_detail.php:1886 form_detail.php:1909 form_detail.php:1919 +#: form_detail.php:1931 form_settings.php:397 form_settings.php:424 +msgid "Above inputs" msgstr "" -#: ../common.php:5902 -msgid "Maximum number of files reached" +#: form_detail.php:1886 form_detail.php:1908 form_detail.php:1919 +#: form_detail.php:1930 form_settings.php:396 form_settings.php:423 +msgid "Below inputs" msgstr "" -#: ../common.php:5903 -msgid "There was a problem while saving the file on the server" +#: form_detail.php:1890 +msgid "Field Label Visibility" msgstr "" -#: ../common.php:5904 -msgid "Please wait for the uploading to complete" +#: form_detail.php:1895 +msgid "Visible (%s)" msgstr "" -#: ../common.php:5905 ../entry_detail.php:456 ../form_detail.php:1386 -#: ../form_detail.php:1394 ../gravityforms.php:1225 -#: ../includes/addon/class-gf-results.php:326 -#: ../includes/locking/class-gf-locking.php:198 ../select_columns.php:154 -msgid "Cancel" +#: form_detail.php:1901 tooltips.php:36 tooltips.php:88 +msgid "Description Placement" msgstr "" -#: ../common.php:5906 -msgid "Cancel this upload" +#: form_detail.php:1907 form_detail.php:1929 +msgid "Use Form Setting (%s)" msgstr "" -#: ../common.php:5907 -msgid "Cancelled" +#: form_detail.php:1923 tooltips.php:37 tooltips.php:89 +msgid "Sub-Label Placement" msgstr "" -#: ../currency.php:99 -msgid "Australian Dollar" +#: form_detail.php:1942 +msgid "Custom Validation Message" msgstr "" -#: ../currency.php:100 -msgid "Brazilian Real" +#: form_detail.php:1954 +msgid "Custom CSS Class" msgstr "" -#: ../currency.php:101 -msgid "Canadian Dollar" +#: form_detail.php:1967 +msgid "Enable enhanced user interface" msgstr "" -#: ../currency.php:102 -msgid "Czech Koruna" +#: form_detail.php:1978 tooltips.php:90 +msgid "Field Size" msgstr "" -#: ../currency.php:103 -msgid "Danish Krone" +#: form_detail.php:1997 +msgid "Admin Field Label" msgstr "" -#: ../currency.php:104 -msgid "Euro" +#: form_detail.php:2011 form_detail.php:2021 js.php:189 tooltips.php:94 +msgid "Default Value" msgstr "" -#: ../currency.php:105 -msgid "Hong Kong Dollar" +#: form_detail.php:2030 +msgid "Prefix Choices" msgstr "" -#: ../currency.php:106 -msgid "Hungarian Forint" +#: form_detail.php:2046 tooltips.php:95 +msgid "Default Values" msgstr "" -#: ../currency.php:107 -msgid "Israeli New Sheqel" +#: form_detail.php:2061 +msgid "Display option to use the values submitted in different field" msgstr "" -#: ../currency.php:108 -msgid "Japanese Yen" +#: form_detail.php:2067 +msgid "To activate this option, please add a field to be used as the source." msgstr "" -#: ../currency.php:109 -msgid "Malaysian Ringgit" +#: form_detail.php:2073 tooltips.php:99 +msgid "Option Label" msgstr "" -#: ../currency.php:110 -msgid "Mexican Peso" +#: form_detail.php:2078 tooltips.php:100 +msgid "Source Field" msgstr "" -#: ../currency.php:111 -msgid "Norwegian Krone" +#: form_detail.php:2088 +msgid "Activated by default" msgstr "" -#: ../currency.php:112 -msgid "New Zealand Dollar" +#: form_detail.php:2101 tooltips.php:70 +msgid "Credit Card Icon Style" msgstr "" -#: ../currency.php:113 -msgid "Philippine Peso" +#: form_detail.php:2122 +msgid "Language" msgstr "" -#: ../currency.php:114 -msgid "Polish Zloty" +#: form_detail.php:2126 +msgid "English" msgstr "" -#: ../currency.php:115 -msgid "Pound Sterling" +#: form_detail.php:2127 +msgid "Dutch" msgstr "" -#: ../currency.php:116 -msgid "Singapore Dollar" +#: form_detail.php:2128 +msgid "French" msgstr "" -#: ../currency.php:117 -msgid "Swedish Krona" +#: form_detail.php:2129 +msgid "German" msgstr "" -#: ../currency.php:118 -msgid "Swiss Franc" +#: form_detail.php:2130 +msgid "Portuguese" msgstr "" -#: ../currency.php:119 -msgid "Taiwan New Dollar" +#: form_detail.php:2131 +msgid "Russian" msgstr "" -#: ../currency.php:120 -msgid "Thai Baht" +#: form_detail.php:2132 +msgid "Spanish" msgstr "" -#: ../currency.php:121 -msgid "U.S. Dollar" +#: form_detail.php:2133 +msgid "Turkish" msgstr "" -#: ../entry_detail.php:96 -msgid "Oops! We couldn't find your entry. Please try again" +#: form_detail.php:2142 tooltips.php:41 +msgid "Add Icon URL" msgstr "" -#: ../entry_detail.php:172 ../entry_list.php:98 ../entry_list.php:118 -#: ../form_list.php:89 -msgid "You don't have adequate permissions to delete entries." +#: form_detail.php:2152 tooltips.php:42 +msgid "Delete Icon URL" msgstr "" -#: ../entry_detail.php:194 -msgid "" -"'Would you like to delete this file? \\'Cancel\\' to stop. \\'OK\\' to " -"delete'" +#: form_detail.php:2162 +msgid "Enable Password Input" msgstr "" -#: ../entry_detail.php:204 ../js.php:362 -msgid "Ajax error while deleting field." +#: form_detail.php:2170 tooltips.php:69 +msgid "Force SSL" msgstr "" -#: ../entry_detail.php:258 ../entry_list.php:425 -msgid "You must select at least one type of notification to resend." +#: form_detail.php:2177 tooltips.php:105 +msgid "Visibility" msgstr "" -#: ../entry_detail.php:276 -msgid "Notifications were resent successfully." +#: form_detail.php:2182 +msgid "Everyone" msgstr "" -#: ../entry_detail.php:319 -msgid "Entry #" +#: form_detail.php:2187 +msgid "Admin Only" msgstr "" -#: ../entry_detail.php:340 -msgid "Entry" +#: form_detail.php:2197 +msgid "Allow field to be populated dynamically" msgstr "" -#: ../entry_detail.php:346 -msgid "Submitted on" +#: form_detail.php:2209 form_settings.php:540 +msgid "Enable Conditional Logic" msgstr "" -#: ../entry_detail.php:348 ../export.php:771 -#: ../includes/addon/class-gf-addon.php:1639 ../select_columns.php:94 -msgid "User IP" +#: form_detail.php:2222 +msgid "Enable Page Conditional Logic" msgstr "" -#: ../entry_detail.php:353 -msgid "View user profile" +#: form_detail.php:2235 +msgid "Enable Next Button Conditional Logic" msgstr "" -#: ../entry_detail.php:359 -msgid "Embed Url" +#: form_detail.php:2328 tooltips.php:141 +msgid "Post Fields" msgstr "" -#: ../entry_detail.php:365 -msgid "Edit Post" +#: form_detail.php:2332 tooltips.php:142 +msgid "Pricing Fields" msgstr "" -#: ../entry_detail.php:365 -msgid "Click to edit post" +#: form_detail.php:2364 form_list.php:560 +msgid "Move this form to the trash" msgstr "" -#: ../entry_detail.php:373 -msgid "Subscription Status" +#: form_detail.php:2364 +msgid "" +"Would you like to move this form to the trash? \\'Cancel\\' to stop. " +"\\'OK\\' to continue" msgstr "" -#: ../entry_detail.php:377 ../entry_detail.php:985 -msgid "Start Date" +#: form_detail.php:2369 includes/templates/edit-shortcode-form.tpl.php:20 +msgid "Update Form" msgstr "" -#: ../entry_detail.php:383 -msgid "Subscriber Id" +#: form_detail.php:2369 +msgid "Save Form" msgstr "" -#: ../entry_detail.php:383 ../entry_detail.php:995 ../export.php:764 -#: ../select_columns.php:97 -msgid "Transaction Id" +#: form_detail.php:2380 gravityforms.php:2506 +msgid "Preview" msgstr "" -#: ../entry_detail.php:389 -msgid "Subscription Amount" +#: form_detail.php:2730 forms_model.php:453 +msgid "Admin Notification" msgstr "" -#: ../entry_detail.php:406 ../entry_list.php:783 ../entry_list.php:1171 -#: ../entry_list.php:1307 -msgid "Not Spam" +#: form_detail.php:2733 +msgid "New submission from" msgstr "" -#: ../entry_detail.php:412 ../entry_detail.php:425 -msgid "" -"You are about to delete this entry. \\'Cancel\\' to stop, \\'OK\\' to delete." +#: form_detail.php:2748 forms_model.php:3896 +msgid "Default Confirmation" msgstr "" -#: ../entry_detail.php:412 ../entry_detail.php:425 ../entry_list.php:777 -#: ../entry_list.php:787 ../entry_list.php:1155 ../entry_list.php:1181 -#: ../entry_list.php:1301 ../entry_list.php:1311 -msgid "Delete Permanently" +#: form_display.php:587 +msgid "Oops! We could not locate your form." msgstr "" -#: ../entry_detail.php:420 ../entry_list.php:773 ../entry_list.php:1145 -#: ../entry_list.php:1297 ../form_list.php:364 ../form_list.php:478 -#: ../form_list.php:479 ../form_list.php:567 -msgid "Restore" +#: form_display.php:606 +msgid "Sorry. You must be logged in to view this form." msgstr "" -#: ../entry_detail.php:434 ../entry_list.php:1333 ../form_detail.php:2039 -msgid "Move to Trash" +#: form_display.php:715 +msgid "There was a problem with your submission." msgstr "" -#: ../entry_detail.php:440 -msgid "Mark as Spam" +#: form_display.php:715 +msgid "Errors have been highlighted below." msgstr "" -#: ../entry_detail.php:451 ../form_list.php:468 ../form_settings.php:1497 -#: ../gravityforms.php:2293 ../includes/addon/class-gf-feed-addon.php:621 -#: ../notification.php:1102 -msgid "Edit" +#: form_display.php:754 form_display.php:2237 +msgid "Previous Page" msgstr "" -#: ../entry_detail.php:477 ../form_settings.php:1266 ../notification.php:107 -#: ../notification.php:401 ../notification.php:405 -msgid "Notifications" +#: form_display.php:1015 +msgid "This field is for validation purposes and should be left unchanged." msgstr "" -#: ../entry_detail.php:485 -msgid "" -"You cannot resend notifications for this entry because this form does not " -"currently have any notifications configured." +#: form_display.php:1269 includes/addon/class-gf-addon.php:2242 +#: includes/fields/class-gf-field-calculation.php:32 +#: includes/fields/class-gf-field-hiddenproduct.php:28 +#: includes/fields/class-gf-field-radio.php:45 +#: includes/fields/class-gf-field-singleproduct.php:34 +#: includes/fields/class-gf-field-website.php:44 +msgid "This field is required." msgstr "" -#: ../entry_detail.php:487 ../entry_list.php:839 -msgid "Configure Notifications" +#: form_display.php:1278 +msgid "This date has already been taken. Please select a new date." msgstr "" -#: ../entry_detail.php:503 ../entry_list.php:858 ../notification.php:556 -msgid "Send To" +#: form_display.php:1282 +msgid "" +"This field requires a unique entry and the values you entered have been " +"already been used." msgstr "" -#: ../entry_detail.php:509 ../entry_list.php:381 ../entry_list.php:798 -#: ../entry_list.php:863 ../entry_list.php:1322 -msgid "Resend Notifications" +#: form_display.php:1283 +msgid "This field requires a unique entry and '%s' has already been used" msgstr "" -#: ../entry_detail.php:511 ../entry_list.php:865 -msgid "Resending..." +#: form_display.php:1292 +msgid "Please enter a valid value." msgstr "" -#: ../entry_detail.php:525 ../entry_list.php:799 ../entry_list.php:900 -msgid "Print" +#: form_display.php:1292 +msgid "Invalid selection. Please select one of the available choices." msgstr "" -#: ../entry_detail.php:528 -msgid "include notes" +#: form_display.php:1886 +msgid "No results matched" msgstr "" -#: ../entry_detail.php:551 -msgid "Notes" +#: form_display.php:1930 form_display.php:2418 gravityforms.php:1522 +msgid "of" msgstr "" -#: ../entry_detail.php:589 -msgid "Entry Updated." +#: form_display.php:1930 +msgid "max characters" msgstr "" -#: ../entry_detail.php:601 -msgid "Details" +#: form_display.php:1951 includes/fields/class-gf-field-password.php:87 +msgid "Strength indicator" msgstr "" -#: ../entry_detail.php:656 -msgid " Bulk action" +#: form_display.php:1951 +msgid "Mismatch" msgstr "" -#: ../entry_detail.php:658 ../entry_list.php:768 ../entry_list.php:1292 -msgid " Bulk action " +#: form_display.php:2234 js.php:546 +msgid "Next" msgstr "" -#: ../entry_detail.php:659 ../form_detail.php:1395 ../form_settings.php:1499 -#: ../includes/addon/class-gf-feed-addon.php:590 -#: ../includes/addon/class-gf-feed-addon.php:622 ../notification.php:1104 -msgid "Delete" +#: form_display.php:2234 +msgid "Next Page" msgstr "" -#: ../entry_detail.php:662 ../entry_list.php:816 ../entry_list.php:1339 -#: ../form_list.php:375 ../form_list.php:578 -msgid "Apply" +#: form_display.php:2368 +msgid "" +"This page is unsecured. Do not enter a real credit card number. Use this " +"field only for testing purposes. " msgstr "" -#: ../entry_detail.php:710 -msgid "added on" +#: form_display.php:2418 +msgid "Step" msgstr "" -#: ../entry_detail.php:724 -msgid "Add Note" +#: form_display.php:2446 +msgid "Sorry. This form is no longer accepting new submissions." msgstr "" -#: ../entry_detail.php:731 -msgid "Also email this note to" +#: form_display.php:2463 +msgid "This form is not yet available." msgstr "" -#: ../entry_detail.php:739 -msgid "Subject:" +#: form_display.php:2465 +msgid "Sorry. This form is no longer available." msgstr "" -#: ../entry_detail.php:769 ../print-entry.php:87 -msgid "Entry # " +#: form_display.php:2580 +msgid "Send Email" msgstr "" -#: ../entry_detail.php:775 -msgid "show empty fields" +#: form_display.php:2581 includes/fields/class-gf-field-email.php:54 +msgid "Please enter a valid email address." msgstr "" -#: ../entry_detail.php:964 -msgid "Subscription Details" +#: form_list.php:26 +msgid "Form moved to the trash." msgstr "" -#: ../entry_detail.php:964 -msgid "Payment Details" +#: form_list.php:31 +msgid "Form restored." msgstr "" -#: ../entry_detail.php:975 -msgid "Status" +#: form_list.php:37 +msgid "Form deleted." msgstr "" -#: ../entry_detail.php:995 -msgid "Subscription Id" +#: form_list.php:39 +msgid "You don't have adequate permission to delete forms." msgstr "" -#: ../entry_detail.php:1005 ../includes/addon/class-gf-payment-addon.php:1167 -#: ../includes/addon/class-gf-payment-addon.php:1171 -msgid "Recurring Amount" +#: form_list.php:45 +msgid "Form duplicated." msgstr "" -#: ../entry_detail.php:1005 ../includes/addon/class-gf-payment-addon.php:1078 -msgid "Amount" -msgstr "" +#: form_list.php:57 +msgid "%s form moved to the trash." +msgid_plural "%s forms moved to the trash." +msgstr[0] "" +msgstr[1] "" -#: ../entry_list.php:20 -#, php-format -msgid "You don't have any active forms. Let's go %screate one%s" -msgstr "" +#: form_list.php:61 +msgid "%s form restored." +msgid_plural "%s forms restored." +msgstr[0] "" +msgstr[1] "" -#: ../entry_list.php:96 -msgid "Entry deleted." -msgstr "" +#: form_list.php:66 +msgid "%s form deleted." +msgid_plural "%s forms deleted." +msgstr[0] "" +msgstr[1] "" -#: ../entry_list.php:110 -#, php-format -msgid "%d entries" +#: form_list.php:68 +msgid "You don't have adequate permissions to delete forms." msgstr "" -#: ../entry_list.php:110 -msgid "1 entry" -msgstr "" +#: form_list.php:75 +msgid "Views for %s form have been reset." +msgid_plural "Views for %s forms have been reset." +msgstr[0] "" +msgstr[1] "" -#: ../entry_list.php:116 -#, php-format -msgid "%s deleted." -msgstr "" +#: form_list.php:82 +msgid "Entries for %s form have been deleted." +msgid_plural "Entries for %s forms have been deleted." +msgstr[0] "" +msgstr[1] "" -#: ../entry_list.php:124 -#, php-format -msgid "%s moved to Trash." -msgstr "" +#: form_list.php:92 +msgid "%s form has been marked as active." +msgid_plural "%s forms have been marked as active." +msgstr[0] "" +msgstr[1] "" -#: ../entry_list.php:129 -#, php-format -msgid "%s restored from the Trash." +#: form_list.php:98 +msgid "%s form has been marked as inactive." +msgid_plural "%s forms have been marked as inactive." +msgstr[0] "" +msgstr[1] "" + +#: form_list.php:146 +msgid "Create a New Form" msgstr "" -#: ../entry_list.php:134 -#, php-format -msgid "%s restored from the spam." +#: form_list.php:160 +msgid "Creating Form..." msgstr "" -#: ../entry_list.php:139 -#, php-format -msgid "%s marked as spam." +#: form_list.php:192 +msgid "Saved! Redirecting..." msgstr "" -#: ../entry_list.php:144 -#, php-format -msgid "%s marked as read." +#: form_list.php:278 tooltips.php:34 +msgid "Form Description" msgstr "" -#: ../entry_list.php:149 -#, php-format -msgid "%s marked as unread." +#: form_list.php:283 +msgid "Create Form" msgstr "" -#: ../entry_list.php:154 -#, php-format -msgid "%s starred." +#: form_list.php:339 +msgid "Ajax error while updating form" msgstr "" -#: ../entry_list.php:159 -#, php-format -msgid "%s unstarred." +#: form_list.php:354 +msgid "" +"WARNING: You are about to delete these forms and ALL entries associated " +"with them. " msgstr "" -#: ../entry_list.php:219 -msgid "«" +#: form_list.php:354 form_list.php:358 form_settings.php:1781 +#: includes/addon/class-gf-feed-addon.php:724 notification.php:1194 +msgid "\\'Cancel\\' to stop, \\'OK\\' to delete." msgstr "" -#: ../entry_list.php:220 -msgid "»" +#: form_list.php:356 +msgid "Are you sure you would like to reset the Views for the selected forms? " msgstr "" -#: ../entry_list.php:318 -msgid "Ajax error while setting lead property" +#: form_list.php:356 +msgid "\\'Cancel\\' to stop, \\'OK\\' to reset." msgstr "" -#: ../entry_list.php:373 -msgid "Please select at least one entry." +#: form_list.php:358 +msgid "" +"WARNING: You are about to delete ALL entries associated with the selected " +"forms. " msgstr "" -#: ../entry_list.php:387 ../entry_list.php:1323 -msgid "Print Entries" +#: form_list.php:368 gravityforms.php:1041 gravityforms.php:1044 +#: gravityforms.php:1373 +msgid "Forms" msgstr "" -#: ../entry_list.php:450 -#, php-format -msgid "Notifications for %s were resent successfully." +#: form_list.php:369 form_settings.php:990 +#: includes/addon/class-gf-feed-addon.php:472 +#: includes/addon/class-gf-feed-addon.php:575 notification.php:434 +msgid "Add New" msgstr "" -#: ../entry_list.php:452 -msgid "entry" +#: form_list.php:411 form_list.php:537 form_list.php:538 form_list.php:620 +msgid "Delete permanently" msgstr "" -#: ../entry_list.php:452 -msgid "entries" +#: form_list.php:413 form_list.php:622 +msgid "Mark as Active" msgstr "" -#: ../entry_list.php:551 -#, php-format -msgid "All %s{0}%s entries on this page are selected." +#: form_list.php:414 form_list.php:623 +msgid "Mark as Inactive" msgstr "" -#: ../entry_list.php:552 -#, php-format -msgid "Select all %s{0}%s entries." +#: form_list.php:415 form_list.php:624 +msgid "Reset Views" msgstr "" -#: ../entry_list.php:553 -#, php-format -msgid "All %s{0}%s entries have been selected." +#: form_list.php:416 form_list.php:625 +msgid "Permanently Delete Entries" msgstr "" -#: ../entry_list.php:554 -msgid "Clear selection" +#: form_list.php:417 form_list.php:626 +msgid "Move to trash" msgstr "" -#: ../entry_list.php:639 -msgid "Entry List" +#: form_list.php:452 form_list.php:476 +msgid "Id" msgstr "" -#: ../entry_list.php:734 ../form_list.php:411 ../form_list.php:429 -#: ../gravityforms.php:971 ../gravityforms.php:2325 -msgid "Entries" +#: form_list.php:458 form_list.php:478 +msgid "Views" msgstr "" -#: ../entry_list.php:734 ../form_detail.php:141 ../form_settings.php:1213 -msgid "Form Name" +#: form_list.php:460 form_list.php:480 +msgid "Conversion" msgstr "" -#: ../entry_list.php:748 ../gravityforms.php:1317 -msgid "Unread" +#: form_list.php:540 +msgid "" +"WARNING: You are about to delete this form and ALL entries associated with " +"it. " msgstr "" -#: ../entry_list.php:753 ../entry_list.php:804 ../entry_list.php:1204 -#: ../entry_list.php:1327 -msgid "Spam" +#: form_list.php:540 +msgid "\\\"Cancel\\\" to stop, \\\"OK\\\" to delete." msgstr "" -#: ../entry_list.php:757 ../entry_list.php:810 ../entry_list.php:1214 -#: ../form_list.php:351 ../form_list.php:507 -msgid "Trash" +#: form_list.php:551 form_settings.php:1780 notification.php:1193 +msgid "Duplicate" msgstr "" -#: ../entry_list.php:760 -msgid "Search" +#: form_list.php:552 +msgid "Duplicate this form" msgstr "" -#: ../entry_list.php:766 ../entry_list.php:1290 ../form_list.php:360 -#: ../form_list.php:362 ../form_list.php:563 ../form_list.php:565 -msgid "Bulk action" +#: form_list.php:598 +msgid "There are no forms in the trash." msgstr "" -#: ../entry_list.php:794 ../entry_list.php:1318 -msgid "Mark as Read" +#: form_list.php:600 +msgid "You don't have any forms. Let's go %screate one%s!" msgstr "" -#: ../entry_list.php:795 ../entry_list.php:1319 -msgid "Mark as Unread" +#: form_list.php:645 form_list.php:665 +msgid "There was an issue creating your form." msgstr "" -#: ../entry_list.php:796 ../entry_list.php:1320 -msgid "Add Star" +#: form_list.php:657 +msgid "Please enter a form title." msgstr "" -#: ../entry_list.php:797 ../entry_list.php:1321 -msgid "Remove Star" +#: form_list.php:669 +msgid "Please enter a unique form title." msgstr "" -#: ../entry_list.php:820 -msgid "" -"WARNING! This operation cannot be undone. Empty trash? \\'Ok\\' to empty " -"trash. \\'Cancel\\' to abort." +#: form_settings.php:110 form_settings.php:907 form_settings.php:1432 +#: gravityforms.php:2474 +msgid "Form Settings" msgstr "" -#: ../entry_list.php:820 +#: form_settings.php:300 msgid "" -"WARNING! This operation cannot be undone. Permanently delete all spam? \\'Ok" -"\\' to delete. \\'Cancel\\' to abort." +"The form title you have entered has already been used. Please enter a " +"unique form title." msgstr "" -#: ../entry_list.php:821 -msgid "Empty Trash" +#: form_settings.php:311 +msgid "Form settings updated successfully." msgstr "" -#: ../entry_list.php:821 -msgid "Delete All Spam" +#: form_settings.php:341 +msgid "Form title" msgstr "" -#: ../entry_list.php:837 -msgid "" -"You cannot resend notifications for these entries because this form does not " -"currently have any notifications configured." +#: form_settings.php:355 +msgid "Form description" msgstr "" -#: ../entry_list.php:844 -msgid "" -"Specify which notifications you would like to resend for the selected " -"entries." +#: form_settings.php:381 +msgid "Label placement" msgstr "" -#: ../entry_list.php:874 -msgid "Close Window" +#: form_settings.php:408 +msgid "Description placement" msgstr "" -#: ../entry_list.php:888 -msgid "Print all of the selected entries at once." +#: form_settings.php:435 +msgid "Sub-label placement" msgstr "" -#: ../entry_list.php:892 -msgid "Include notes" +#: form_settings.php:480 +msgid "Input type" msgstr "" -#: ../entry_list.php:897 -msgid "Add page break between entries" +#: form_settings.php:486 form_settings.php:1218 form_settings.php:1843 +msgid "Text" msgstr "" -#: ../entry_list.php:936 ../entry_list.php:959 -msgid "click to select columns to display" +#: form_settings.php:504 +msgid "Button text" msgstr "" -#: ../entry_list.php:1050 -#, php-format -msgid "%d files" +#: form_settings.php:518 +msgid "Button image path" msgstr "" -#: ../entry_list.php:1140 ../entry_list.php:1166 ../entry_list.php:1193 -msgid "View this entry" +#: form_settings.php:536 +msgid "Button conditional logic" msgstr "" -#: ../entry_list.php:1140 ../entry_list.php:1166 ../entry_list.php:1193 -#: ../includes/addon/class-gf-payment-addon.php:1863 -msgid "View" +#: form_settings.php:564 +msgid "Save and Continue Later" msgstr "" -#: ../entry_list.php:1145 -msgid "Restore this entry" +#: form_settings.php:569 form_settings.php:897 +msgid "Save and Continue" msgstr "" -#: ../entry_list.php:1155 ../entry_list.php:1181 -msgid "Delete this entry permanently" +#: form_settings.php:573 +msgid "Enable Save and Continue" msgstr "" -#: ../entry_list.php:1171 -msgid "Mark this entry as not spam" +#: form_settings.php:587 +msgid "" +"This feature stores potentially private and sensitive data on this server " +"and protects it with a unique link which is displayed to the user on the " +"page in plain, unencrypted text. The link is similar to a password so it's " +"strongly advisable to ensure that the page enforces a secure connection " +"(HTTPS) before activating this setting." msgstr "" -#: ../entry_list.php:1197 -msgid "Mark read" +#: form_settings.php:592 +msgid "" +"When this setting is activated two confirmations and one notification are " +"automatically generated and can be modified in their respective editors. " +"When this setting is deactivated the confirmations and the notification " +"will be deleted automatically and any modifications will be lost." msgstr "" -#: ../entry_list.php:1197 -msgid "Mark this entry as unread" +#: form_settings.php:604 +msgid "Link text" msgstr "" -#: ../entry_list.php:1197 -msgid "Mark unread" +#: form_settings.php:626 +msgid "total entries" msgstr "" -#: ../entry_list.php:1204 -msgid "Mark this entry as spam" +#: form_settings.php:627 +msgid "per day" msgstr "" -#: ../entry_list.php:1214 -msgid "Move this entry to the trash" +#: form_settings.php:628 +msgid "per week" msgstr "" -#: ../entry_list.php:1254 -msgid "" -"This form does not have any unread entries matching the search criteria." +#: form_settings.php:629 +msgid "per month" msgstr "" -#: ../entry_list.php:1254 -msgid "This form does not have any unread entries." +#: form_settings.php:630 +msgid "per year" msgstr "" -#: ../entry_list.php:1258 -msgid "" -"This form does not have any starred entries matching the search criteria." +#: form_settings.php:640 +msgid "Limit number of entries" msgstr "" -#: ../entry_list.php:1258 -msgid "This form does not have any starred entries." +#: form_settings.php:644 +msgid "Enable entry limit" msgstr "" -#: ../entry_list.php:1262 -msgid "This form does not have any spam." +#: form_settings.php:654 +msgid "Number of Entries" msgstr "" -#: ../entry_list.php:1267 -msgid "" -"This form does not have any entries in the trash matching the search " -"criteria." +#: form_settings.php:673 +msgid "Entry Limit Reached Message" msgstr "" -#: ../entry_list.php:1267 -msgid "This form does not have any entries in the trash." +#: form_settings.php:737 form_settings.php:741 +msgid "Schedule form" msgstr "" -#: ../entry_list.php:1272 -msgid "This form does not have any entries matching the search criteria." +#: form_settings.php:750 +msgid "Schedule Start Date/Time" msgstr "" -#: ../entry_list.php:1272 -msgid "This form does not have any entries yet." +#: form_settings.php:775 +msgid "Schedule Form End Date/Time" msgstr "" -#: ../entry_list.php:1487 -#, php-format -msgid "Displaying %s - %s of %s" +#: form_settings.php:800 +msgid "Form Pending Message" msgstr "" -#: ../export.php:16 ../export.php:462 -msgid "Please select the fields to be exported" +#: form_settings.php:813 +msgid "Form Expired Message" msgstr "" -#: ../export.php:39 -msgid "Please select the forms to be exported" +#: form_settings.php:829 +msgid "Anti-spam honeypot" msgstr "" -#: ../export.php:313 -msgid "" -"Forms could not be imported. Please make sure your XML export file is in the " -"correct format." +#: form_settings.php:833 +msgid "Enable anti-spam honeypot" msgstr "" -#: ../export.php:316 -msgid "" -"Forms could not be imported. Your XML export file is not compatible with " -"your current version of Gravity Forms." +#: form_settings.php:845 +msgid "Animated transitions" msgstr "" -#: ../export.php:320 -msgid "forms" +#: form_settings.php:849 +msgid "Enable animations" msgstr "" -#: ../export.php:320 -msgid "form" +#: form_settings.php:864 form_settings.php:868 tooltips.php:111 +msgid "Require user to be logged in" msgstr "" -#: ../export.php:321 -msgid "Edit Form" +#: form_settings.php:877 tooltips.php:112 +msgid "Require Login Message" msgstr "" -#: ../export.php:327 ../export.php:900 -msgid "Import Forms" +#: form_settings.php:894 +msgid "Form Basics" msgstr "" -#: ../export.php:332 -msgid "" -"Select the Gravity Forms XML file you would like to import. When you click " -"the import button below, Gravity Forms will import the forms." +#: form_settings.php:895 +msgid "Form Layout" msgstr "" -#: ../export.php:342 ../tooltips.php:133 -msgid "Select File" +#: form_settings.php:896 +msgid "Form Button" msgstr "" -#: ../export.php:347 -msgid "Import" +#: form_settings.php:898 +msgid "Restrictions" msgstr "" -#: ../export.php:362 ../export.php:899 -msgid "Export Forms" +#: form_settings.php:899 +msgid "Form Options" msgstr "" -#: ../export.php:366 -msgid "" -"Select the forms you would like to export. When you click the download " -"button below, Gravity Forms will create an XML file for you to save to your " -"computer. Once you've saved the download file, you can use the Import tool " -"to import the forms." +#: form_settings.php:957 +msgid "Update Form Settings" msgstr "" -#: ../export.php:372 -msgid "Select Forms" +#: form_settings.php:984 form_settings.php:989 form_settings.php:1081 +#: form_settings.php:1433 +msgid "Confirmations" msgstr "" -#: ../export.php:392 ../export.php:533 -msgid "Download Export File" +#: form_settings.php:1018 +msgid "Ajax error while updating confirmation" msgstr "" -#: ../export.php:407 ../export.php:544 ../export.php:895 -msgid "Export Entries" +#: form_settings.php:1105 +msgid "" +"Ensure that the conditional logic for this confirmation is different from " +"all the other confirmations for this form and then press save to create the " +"new confirmation." msgstr "" -#: ../export.php:431 -msgid "Ajax error while selecting a form" +#: form_settings.php:1120 notification.php:149 +msgid "Save & Continue Link" msgstr "" -#: ../export.php:447 -msgid "Deselect All" +#: form_settings.php:1121 notification.php:150 +msgid "Save & Continue Token" msgstr "" -#: ../export.php:447 -msgid "Select All" +#: form_settings.php:1125 +msgid "Save & Continue Email Input" msgstr "" -#: ../export.php:456 -msgid "Export entries if {0} of the following match:" +#: form_settings.php:1161 +msgid "Save Confirmation" msgstr "" -#: ../export.php:471 -msgid "" -"Select a form below to export entries. Once you have selected a form you may " -"select the fields you would like to export and then define optional filters " -"for field values and the date range. When you click the download button " -"below, Gravity Forms will create a CSV file for you to save to your computer." +#: form_settings.php:1204 +msgid "Confirmation Name" msgstr "" -#: ../export.php:478 ../gravityforms.php:2190 -msgid "Select A Form" +#: form_settings.php:1214 +msgid "Confirmation Type" msgstr "" -#: ../export.php:482 -msgid "Select a form" +#: form_settings.php:1224 form_settings.php:1266 form_settings.php:1846 +#: includes/fields/class-gf-field-page.php:12 js.php:84 +msgid "Page" msgstr "" -#: ../export.php:496 -msgid "Select Fields" +#: form_settings.php:1230 form_settings.php:1849 +msgid "Redirect" msgstr "" -#: ../export.php:503 ../form_settings.php:1167 -#: ../includes/addon/class-gf-payment-addon.php:1255 -#: ../includes/addon/class-gf-payment-addon.php:1257 ../notification.php:814 -#: ../tooltips.php:93 ../tooltips.php:107 ../tooltips.php:130 -msgid "Conditional Logic" +#: form_settings.php:1241 notification.php:832 +msgid "Message" msgstr "" -#: ../export.php:512 -msgid "Select Date Range" +#: form_settings.php:1254 +msgid "Disable Auto-formatting" msgstr "" -#: ../export.php:517 ../includes/addon/class-gf-results.php:269 -msgid "Start" +#: form_settings.php:1268 +msgid "Select a page" msgstr "" -#: ../export.php:522 ../includes/addon/class-gf-results.php:277 -msgid "End" +#: form_settings.php:1277 form_settings.php:1308 +msgid "Redirect Query String" msgstr "" -#: ../export.php:525 -msgid "" -"Date Range is optional, if no date range is selected all entries will be " -"exported." +#: form_settings.php:1280 form_settings.php:1311 +msgid "Pass Field Data Via Query String" msgstr "" -#: ../export.php:535 -msgid "Exporting entries. Please wait..." +#: form_settings.php:1285 form_settings.php:1316 +msgid "Sample: phone={Phone:1}&email={Email:2}" msgstr "" -#: ../export.php:760 -msgid "Created By (User Id)" +#: form_settings.php:1296 +msgid "Redirect URL" msgstr "" -#: ../export.php:763 ../includes/addon/class-gf-addon.php:1640 -#: ../select_columns.php:95 -msgid "Source Url" +#: form_settings.php:1472 +msgid "You must specify a Confirmation Name." msgstr "" -#: ../export.php:770 -msgid "User Agent" +#: form_settings.php:1479 +msgid "You must select a Confirmation Page." msgstr "" -#: ../form_detail.php:139 ../gravityforms.php:969 -msgid "New Form" +#: form_settings.php:1485 +msgid "You must specify a valid Redirect URL." msgstr "" -#: ../form_detail.php:141 ../gravityforms.php:2293 -msgid "Form Editor" +#: form_settings.php:1506 +msgid "Confirmation saved successfully. %sBack to confirmations.%s" msgstr "" -#: ../form_detail.php:151 ../form_detail.php:2058 ../form_settings.php:263 -msgid "There was an error while saving your form." +#: form_settings.php:1526 +msgid "Confirmation deleted." msgstr "" -#: ../form_detail.php:152 ../form_detail.php:2059 ../form_settings.php:264 -#, php-format -msgid "Please %scontact our support team%s." +#: form_settings.php:1610 +msgid "Save and Continue Email" msgstr "" -#: ../form_detail.php:160 +#: form_settings.php:1614 +msgid "Link to continue {form_title}" +msgstr "" + +#: form_settings.php:1615 msgid "" -"The form title you have entered is already taken. Please enter a unique form " -"title." +"Thank you for saving {form_title}. Please use the unique link below to " +"return to the form from any computer.

    {save_link}

    " +"Remember that the link will expire after 30 days so please return via the " +"provided link to complete your form submission." msgstr "" -#: ../form_detail.php:168 ../form_detail.php:2054 -msgid "Form updated successfully." +#: form_settings.php:1634 +msgid "Save and Continue Confirmation" msgstr "" -#: ../form_detail.php:194 -msgid "click to edit page options" +#: form_settings.php:1637 +msgid "" +"Please use the following link to return to your form from any computer.
    {save_link}
    This link will expire after 30 days.
    Enter your " +"email address to send the link by email.
    {save_email_input}" msgstr "" -#: ../form_detail.php:200 -msgid "begin form" +#: form_settings.php:1646 +msgid "Save and Continue Email Sent Confirmation" msgstr "" -#: ../form_detail.php:201 -msgid "START PAGING" +#: form_settings.php:1649 +msgid "The link was sent to the following email address: {save_email}" msgstr "" -#: ../form_detail.php:202 -msgid "top of the first page" +#: form_settings.php:1701 includes/addon/class-gf-payment-addon.php:1077 +#: includes/addon/class-gf-payment-addon.php:1138 +#: includes/addon/class-gf-payment-addon.php:1142 +#: includes/fields/class-gf-field-name.php:12 js.php:567 js.php:737 +#: notification.php:542 notification.php:1122 +msgid "Name" msgstr "" -#: ../form_detail.php:207 ../form_detail.php:403 ../form_detail.php:466 -msgid "Properties" +#: form_settings.php:1779 notification.php:1192 +msgid "Edit this item" msgstr "" -#: ../form_detail.php:208 ../form_detail.php:467 -msgid "Advanced" +#: form_settings.php:1780 +msgid "Duplicate this confirmation" msgstr "" -#: ../form_detail.php:215 ../tooltips.php:99 -msgid "Progress Indicator" +#: form_settings.php:1781 +msgid "Delete this item" msgstr "" -#: ../form_detail.php:221 -msgid "Progress Bar" +#: form_settings.php:1781 +msgid "WARNING: You are about to delete this confirmation." msgstr "" -#: ../form_detail.php:226 -msgid "Steps" +#: form_settings.php:1825 +msgid "This page does not exist." msgstr "" -#: ../form_detail.php:231 ../form_detail.php:1464 -msgid "None" +#: forms_model.php:477 +msgid "User Notification" msgstr "" -#: ../form_detail.php:240 -msgid "Style" +#: forms_model.php:577 forms_model.php:597 +msgid "Notification not found" msgstr "" -#: ../form_detail.php:244 -msgid "Blue" +#: forms_model.php:865 +msgid "You don't have adequate permission to create forms." msgstr "" -#: ../form_detail.php:245 -msgid "Gray" +#: forms_model.php:1271 +msgid "You don't have adequate permission to edit entries." msgstr "" -#: ../form_detail.php:246 ../form_detail.php:1346 -msgid "Green" +#: gravityforms.php:1037 +msgid "Update Available" msgstr "" -#: ../form_detail.php:247 -msgid "Orange" +#: gravityforms.php:1056 gravityforms.php:1311 gravityforms.php:2474 +#: includes/addon/class-gf-addon.php:2701 +#: includes/addon/class-gf-addon.php:2916 +#: includes/addon/class-gf-addon.php:3074 +#: includes/addon/class-gf-addon.php:3249 settings.php:474 +msgid "Settings" msgstr "" -#: ../form_detail.php:248 ../form_detail.php:785 -msgid "Red" +#: gravityforms.php:1058 +msgid "Import/Export" msgstr "" -#: ../form_detail.php:255 -msgid "Text Color" +#: gravityforms.php:1061 +msgid "Updates" msgstr "" -#: ../form_detail.php:262 ../form_detail.php:770 -msgid "Background Color" +#: gravityforms.php:1062 help.php:49 +msgid "Add-Ons" msgstr "" -#: ../form_detail.php:269 ../tooltips.php:101 -msgid "Page Names" +#: gravityforms.php:1125 +msgid "%1$s ‹ %2$s — WordPress" msgstr "" -#: ../form_detail.php:280 -msgid "Display completed progress bar on confirmation" +#: gravityforms.php:1236 gravityforms.php:1259 +msgid "Add Gravity Form" msgstr "" -#: ../form_detail.php:288 -msgid "Completion Text" +#: gravityforms.php:1259 +msgid "Add Form" msgstr "" -#: ../form_detail.php:300 ../form_detail.php:1835 ../form_settings.php:402 -#: ../tooltips.php:89 -msgid "CSS Class Name" +#: gravityforms.php:1271 +msgid "Please select a form" msgstr "" -#: ../form_detail.php:322 -msgid "" -"This form doesn't have any fields yet. Follow the steps below to get started." +#: gravityforms.php:1325 update.php:38 +msgid "There is a new version of Gravity Forms available." msgstr "" -#: ../form_detail.php:326 -msgid "Select A Field Type" +#: gravityforms.php:1325 includes/addon/class-gf-auto-upgrade.php:60 +#: includes/addon/class-gf-auto-upgrade.php:148 +msgid "View version %s Details" msgstr "" -#: ../form_detail.php:327 +#: gravityforms.php:1357 msgid "" -"Start by seleting a field type from the nifty floating panels on the right." +"Oops!! Something went wrong.
    Please try again or contact us." msgstr "" -#: ../form_detail.php:330 -msgid "Start Over There" +#: gravityforms.php:1403 gravityforms.php:1409 +msgid "View All Entries" msgstr "" -#: ../form_detail.php:331 -msgid "Pick a field.. any field. Don't be shy." +#: gravityforms.php:1406 +msgid "Last Entry: %s" msgstr "" -#: ../form_detail.php:336 -msgid "Click to Add A Field" +#: gravityforms.php:1421 +msgid "View All Forms" msgstr "" -#: ../form_detail.php:337 -msgid "" -"Once you've found the field type you want, click to add it to the form " -"editor here on the left side of your screen." +#: gravityforms.php:1428 +msgid "You don't have any forms. Let's go %s create one %s!" msgstr "" -#: ../form_detail.php:340 -msgid "Now your new field magically appears over here." +#: gravityforms.php:1459 +msgid "There is an update available for Gravity Forms. %sView Details%s %s" msgstr "" -#: ../form_detail.php:345 -msgid "Edit Field Options" +#: gravityforms.php:1462 +msgid "Dismiss" msgstr "" -#: ../form_detail.php:346 -msgid "Click on the edit link to configure the various field options" +#: gravityforms.php:1519 +msgid "Next >" msgstr "" -#: ../form_detail.php:349 -msgid "Preview your changes up here." +#: gravityforms.php:1520 +msgid "< Prev" msgstr "" -#: ../form_detail.php:350 -msgid "Edit the field options. Go ahead.. go crazy." +#: gravityforms.php:1523 +msgid "Close" msgstr "" -#: ../form_detail.php:351 -msgid "If you get stuck, mouseover the tool tips for a little help." +#: gravityforms.php:1524 +msgid "" +"This feature requires inline frames. You have iframes disabled or your " +"browser does not support them." msgstr "" -#: ../form_detail.php:356 -msgid "Drag to Arrange Fields" +#: gravityforms.php:1664 +msgid "Please select a form." msgstr "" -#: ../form_detail.php:357 -msgid "Drag the fields to arrange them the way you prefer" +#: gravityforms.php:1852 +msgid "Add-On browser is currently unavailable. Please try again later." msgstr "" -#: ../form_detail.php:360 -msgid "Grab here with your cursor." +#: gravityforms.php:2038 +msgid "There was an error while resending the notifications." msgstr "" -#: ../form_detail.php:361 -msgid "Drag up or down to arrange your fields." +#: gravityforms.php:2044 +msgid "" +"No notifications have been selected. Please select a notification to be " +"sent." msgstr "" -#: ../form_detail.php:366 -msgid "Save Your Form" +#: gravityforms.php:2048 +msgid "The Send To email address provided is not valid." msgstr "" -#: ../form_detail.php:367 -msgid "" -"Once you're happy with your form, remember to click on the "update " -"form" button to save all your hard work." +#: gravityforms.php:2357 +msgid "Switch Form" msgstr "" -#: ../form_detail.php:370 -msgid "Save Your New Form" +#: gravityforms.php:2461 +msgid "Edit this form" msgstr "" -#: ../form_detail.php:371 -msgid "You're done. That's it." +#: gravityforms.php:2476 +msgid "Edit settings for this form" msgstr "" -#: ../form_detail.php:390 -msgid "Edit Last Page" +#: gravityforms.php:2493 +msgid "View entries generated by this form" msgstr "" -#: ../form_detail.php:394 -msgid "end of last page" +#: gravityforms.php:2624 widget.php:27 +msgid "Form" msgstr "" -#: ../form_detail.php:395 -msgid "END PAGING" +#: gravityforms.php:2712 includes/locking/class-gf-locking.php:206 +msgid "Error" msgstr "" -#: ../form_detail.php:396 -msgid "end of form" +#: gravityforms.php:2791 widget.php:81 +msgid "Select a Form" msgstr "" -#: ../form_detail.php:409 ../form_detail.php:639 -msgid "Previous Button" +#: gravityforms.php:2798 +msgid "Select a form below to add it to your post or page." msgstr "" -#: ../form_detail.php:415 ../form_detail.php:608 ../form_detail.php:645 -msgid "Default" +#: gravityforms.php:2799 +msgid "Select a form from the list to add it to your post or page." msgstr "" -#: ../form_detail.php:427 ../form_detail.php:620 ../form_detail.php:657 -msgid "Text:" +#: gravityforms.php:2803 +msgid "Can't find your form? Make sure it is active." msgstr "" -#: ../form_detail.php:434 ../form_detail.php:627 ../form_detail.php:664 -msgid "Image Path:" +#: gravityforms.php:2807 widget.php:97 +msgid "Display form title" msgstr "" -#: ../form_detail.php:448 -msgid "You have successfully saved your form!" +#: gravityforms.php:2812 +msgid "Whether or not do display the form title." msgstr "" -#: ../form_detail.php:449 -msgid "What would you like to do next?" +#: gravityforms.php:2815 widget.php:99 +msgid "Display form description" msgstr "" -#: ../form_detail.php:450 ../form_detail.php:2055 ../gravityforms.php:2342 -msgid "Preview this form" +#: gravityforms.php:2820 +msgid "Whether or not do display the form description." msgstr "" -#: ../form_detail.php:450 -msgid "Preview this Form" +#: gravityforms.php:2823 widget.php:106 +msgid "Enable AJAX" msgstr "" -#: ../form_detail.php:453 -msgid "Setup email notifications for this form" +#: gravityforms.php:2827 +msgid "Specify whether or not to use AJAX to submit the form." msgstr "" -#: ../form_detail.php:453 -msgid "Setup Email Notifications for this Form" +#: gravityforms.php:2833 +msgid "Specify the starting tab index for the fields of this form." msgstr "" -#: ../form_detail.php:456 -msgid "Continue editing this form" +#: gravityforms.php:2841 +msgid "Select an action" msgstr "" -#: ../form_detail.php:456 -msgid "Continue Editing this Form" +#: gravityforms.php:2853 +msgid "Select an action for this shortcode. Actions are added by some add-ons." msgstr "" -#: ../form_detail.php:458 -msgid "I am done. Take me back to form list" +#: help.php:18 +msgid "Gravity Forms Help" msgstr "" -#: ../form_detail.php:458 -msgid "Return to Form List" +#: help.php:23 +msgid "" +"IMPORTANT NOTICE: We do not provide support via e-mail. " +"Please open a " +"support ticket." msgstr "" -#: ../form_detail.php:476 ../tooltips.php:47 ../tooltips.php:48 -msgid "Field Label" +#: help.php:25 +msgid "" +"Please review the plugin documentation and frequently " +"asked questions (FAQ) first. If you still can't find the answer open a support " +"ticket and we will be happy to answer your questions and assist you " +"with any problems. Please note: If you have not purchased a " +"license from us, you won't have access to these help resources." msgstr "" -#: ../form_detail.php:484 ../tooltips.php:122 -msgid "Product Field" +#: help.php:30 +msgid "Gravity Forms Documentation" msgstr "" -#: ../form_detail.php:496 ../form_detail.php:513 ../form_detail.php:548 -#: ../form_detail.php:562 ../form_detail.php:576 ../form_detail.php:686 -#: ../form_detail.php:715 ../form_detail.php:910 -msgid "Field Type" +#: help.php:39 +msgid "Documentation (please select a topic)" msgstr "" -#: ../form_detail.php:500 -msgid "Single Product" +#: help.php:41 +msgid "Getting Started" msgstr "" -#: ../form_detail.php:503 ../form_detail.php:567 -msgid "User Defined Price" +#: help.php:43 +msgid "Using Gravity Forms" msgstr "" -#: ../form_detail.php:505 -msgid "Calculation" +#: help.php:45 +msgid "Design and Layout" msgstr "" -#: ../form_detail.php:517 -msgid "Single Method" +#: help.php:47 +msgid "Developer Docs" msgstr "" -#: ../form_detail.php:538 -msgid "Disable quantity field" +#: help.php:51 +msgid "How To" msgstr "" -#: ../form_detail.php:591 ../form_settings.php:1420 ../tooltips.php:119 -msgid "Content" +#: help.php:56 help.php:83 help.php:110 +msgid "GO" msgstr "" -#: ../form_detail.php:603 -msgid "Next Button" +#: help.php:65 +msgid "Gravity Forms FAQ" msgstr "" -#: ../form_detail.php:677 -msgid "Disable default margins" +#: help.php:73 +msgid "FAQ (please select a topic)" msgstr "" -#: ../form_detail.php:690 ../form_detail.php:2007 ../tooltips.php:124 -msgid "Standard Fields" +#: help.php:74 +msgid "Installation Questions" msgstr "" -#: ../form_detail.php:691 ../form_detail.php:719 -msgid "Single line text" +#: help.php:75 +msgid "Formatting/Styling Questions" msgstr "" -#: ../form_detail.php:700 ../form_detail.php:2008 ../tooltips.php:125 -msgid "Advanced Fields" +#: help.php:76 +msgid "Notification Questions" msgstr "" -#: ../form_detail.php:734 ../form_settings.php:1419 -msgid "Type" +#: help.php:77 +msgid "General Questions" msgstr "" -#: ../form_detail.php:738 -msgid "reCAPTCHA" +#: help.php:93 +msgid "Gravity Forms Downloads" msgstr "" -#: ../form_detail.php:739 -msgid "Really Simple CAPTCHA" +#: help.php:94 +msgid "" +"Please Note: Only licensed Gravity Forms customers are " +"granted access to the downloads section." msgstr "" -#: ../form_detail.php:740 -msgid "Math Challenge" +#: help.php:102 +msgid "Downloads (please select a product)" msgstr "" -#: ../form_detail.php:748 ../form_detail.php:1358 -msgid "Size" +#. Plugin Name of the plugin/theme +msgid "Gravity Forms" msgstr "" -#: ../form_detail.php:751 ../form_detail.php:1358 ../form_detail.php:1756 -msgid "Small" +#: help.php:104 +msgid "Gravity Forms Add-Ons" msgstr "" -#: ../form_detail.php:761 -msgid "Font Color" +#: help.php:121 +msgid "Gravity Forms Tutorials & Resources" msgstr "" -#: ../form_detail.php:781 -msgid "Theme" +#: help.php:122 +msgid "" +"Please note: The Gravity Forms support team does not " +"provide support for third party scripts, widgets, etc." msgstr "" -#: ../form_detail.php:786 -msgid "White" +#: includes/addon/class-gf-addon.php:1032 +msgid "Field type '%s' has not been implemented" msgstr "" -#: ../form_detail.php:787 -msgid "Black Glass" +#: includes/addon/class-gf-addon.php:1280 +msgid "Settings updated" msgstr "" -#: ../form_detail.php:788 -msgid "Clean" +#: includes/addon/class-gf-addon.php:1286 +msgid "There was an error while saving your settings" msgstr "" -#: ../form_detail.php:796 ../tooltips.php:52 -msgid "Custom Field Name" +#: includes/addon/class-gf-addon.php:1639 +#: includes/addon/class-gf-addon.php:1793 +msgid "Form Field" msgstr "" -#: ../form_detail.php:802 -msgid "Existing" +#: includes/addon/class-gf-addon.php:1680 +msgid "Field" msgstr "" -#: ../form_detail.php:808 -msgid "New" +#: includes/addon/class-gf-addon.php:1709 +#: includes/addon/class-gf-addon.php:1713 +#: includes/addon/class-gf-addon.php:1873 +#: includes/addon/class-gf-addon.php:1877 +msgid "Full" msgstr "" -#: ../form_detail.php:814 -msgid "Select an existing custom field" +#: includes/addon/class-gf-addon.php:1717 +#: includes/addon/class-gf-addon.php:1881 +msgid "Selected" msgstr "" -#: ../form_detail.php:831 ../tooltips.php:109 -msgid "Post Status" +#: includes/addon/class-gf-addon.php:1778 +msgid "Add Custom" msgstr "" -#: ../form_detail.php:850 -msgid "Default Post Author" +#: includes/addon/class-gf-addon.php:1912 +msgid "Update Settings" msgstr "" -#: ../form_detail.php:860 -msgid "Use logged in user as author" +#: includes/addon/class-gf-addon.php:2277 settings.php:188 +msgid "Validation Error" msgstr "" -#: ../form_detail.php:872 ../tooltips.php:111 -msgid "Post Format" +#: includes/addon/class-gf-addon.php:2829 +#: includes/addon/class-gf-addon.php:2835 +msgid "You don't have adequate permission to view this page" msgstr "" -#: ../form_detail.php:898 ../js.php:375 ../tooltips.php:108 -#: ../tooltips.php:114 -msgid "Post Category" +#: includes/addon/class-gf-addon.php:2935 +msgid "This add-on needs to be updated. Please contact the developer." msgstr "" -#: ../form_detail.php:932 -msgid "All Categories" +#: includes/addon/class-gf-addon.php:2974 +msgid "%s Settings" msgstr "" -#: ../form_detail.php:938 -msgid "Select Categories" +#: includes/addon/class-gf-addon.php:3079 settings.php:491 +msgid "Uninstall" msgstr "" -#: ../form_detail.php:961 -msgid "Display placeholder" +#: includes/addon/class-gf-addon.php:3107 +#: includes/addon/class-gf-addon.php:3117 +msgid "Uninstall %" msgstr "" -#: ../form_detail.php:967 -msgid "Placeholder Label" +#: includes/addon/class-gf-addon.php:3112 settings.php:105 +msgid "Warning" msgstr "" -#: ../form_detail.php:977 ../form_detail.php:994 ../form_detail.php:1008 -msgid "Create content template" +#: includes/addon/class-gf-addon.php:3115 +msgid "Warning! This operation deletes ALL settings and data." msgstr "" -#: ../form_detail.php:1023 -msgid "Image Metadata" +#: includes/addon/class-gf-addon.php:3117 +msgid "" +"Warning! ALL settings will be deleted. This cannot be undone. \\'OK\\' to " +"delete, \\'Cancel\\' to stop" msgstr "" -#: ../form_detail.php:1046 ../tooltips.php:117 -msgid "Set as Featured Image" +#: includes/addon/class-gf-addon.php:3380 +msgid "Uninstall %s Add-On" msgstr "" -#: ../form_detail.php:1058 ../tooltips.php:57 -msgid "Address Type" +#: includes/addon/class-gf-addon.php:3386 +msgid "Uninstall Add-On" msgstr "" -#: ../form_detail.php:1086 -#, php-format -msgid "Default %s" +#: includes/addon/class-gf-addon.php:3397 +msgid "" +"%sThis operation deletes ALL %s settings%s. If you continue, you will NOT " +"be able to retrieve these settings." msgstr "" -#: ../form_detail.php:1102 ../tooltips.php:60 -msgid "Default Country" +#: includes/addon/class-gf-addon.php:3401 +msgid "" +"Warning! ALL %s settings will be deleted. This cannot be undone. \\'OK\\' " +"to delete, \\'Cancel\\' to stop" msgstr "" -#: ../form_detail.php:1112 -msgid "Hide Country Field" +#: includes/addon/class-gf-auto-upgrade.php:61 +msgid "" +"%sRegister%s your copy of Gravity Forms to receive access to automatic " +"upgrades and support. Need a license key? %sPurchase one now%s." msgstr "" -#: ../form_detail.php:1124 -#, php-format -msgid "Hide %s Field" +#: includes/addon/class-gf-auto-upgrade.php:177 +msgid "Oops!! Something went wrong.%sPlease try again or %scontact us%s." msgstr "" -#: ../form_detail.php:1136 -msgid "Hide Address Line 2 Field" +#: includes/addon/class-gf-auto-upgrade.php:234 +msgid "" +"There is a new version of %1$s available. View version %4$s details." msgstr "" -#: ../form_detail.php:1146 -msgid "Name Format" +#: includes/addon/class-gf-auto-upgrade.php:238 update.php:42 +msgid "" +"

    You can update to the latest version automatically or download the " +"update and install it manually. %sUpdate Automatically%s %sDownload Update%s" msgstr "" -#: ../form_detail.php:1150 -msgid "Normal" +#: includes/addon/class-gf-auto-upgrade.php:246 +msgid "Your version of %s is up to date." msgstr "" -#: ../form_detail.php:1151 -msgid "Extended" +#: includes/addon/class-gf-feed-addon.php:477 +#: includes/addon/class-gf-feed-addon.php:575 +msgid "%s Feeds" msgstr "" -#: ../form_detail.php:1152 -msgid "Simple" +#: includes/addon/class-gf-feed-addon.php:516 +msgid "Feed Settings" msgstr "" -#: ../form_detail.php:1160 ../tooltips.php:56 -msgid "Date Input Type" +#: includes/addon/class-gf-feed-addon.php:626 +msgid "Feed updated successfully." msgstr "" -#: ../form_detail.php:1164 -msgid "Date Field" +#: includes/addon/class-gf-feed-addon.php:632 +msgid "" +"There was an error updating this feed. Please review all errors below and " +"try again." msgstr "" -#: ../form_detail.php:1165 -msgid "Date Picker" +#: includes/addon/class-gf-feed-addon.php:723 +msgid "Edit this feed" msgstr "" -#: ../form_detail.php:1166 -msgid "Date Drop Down" +#: includes/addon/class-gf-feed-addon.php:724 +msgid "Delete this feed" msgstr "" -#: ../form_detail.php:1172 -msgid "No Icon" +#: includes/addon/class-gf-feed-addon.php:724 +msgid "WARNING: You are about to delete this item." msgstr "" -#: ../form_detail.php:1177 -msgid "Calendar Icon" +#: includes/addon/class-gf-feed-addon.php:739 +msgid "You don't have any feeds configured. Let's go %screate one%s!" msgstr "" -#: ../form_detail.php:1182 -msgid "Custom Icon" +#: includes/addon/class-gf-feed-addon.php:785 +msgid "Enable Condition" msgstr "" -#: ../form_detail.php:1187 -msgid "Image Path: " +#: includes/addon/class-gf-feed-addon.php:811 +msgid "Process this feed if" msgstr "" -#: ../form_detail.php:1190 -msgid "Preview this form to see your custom icon." +#: includes/addon/class-gf-feed-addon.php:1048 +msgid "Checkbox" msgstr "" -#: ../form_detail.php:1199 -msgid "Date Format" +#: includes/addon/class-gf-feed-addon.php:1062 +msgid "feed" msgstr "" -#: ../form_detail.php:1217 -msgid "Allowed file extensions" +#: includes/addon/class-gf-feed-addon.php:1063 +msgid "feeds" msgstr "" -#: ../form_detail.php:1221 -msgid "Separated with commas (i.e. jpg, gif, png, pdf)" +#: includes/addon/class-gf-payment-addon.php:407 +msgid "Payment failed to be captured. Reason: %s" msgstr "" -#: ../form_detail.php:1229 ../tooltips.php:73 -msgid "Enable Multi-File Upload" +#: includes/addon/class-gf-payment-addon.php:425 +msgid "Initial payment" msgstr "" -#: ../form_detail.php:1236 ../tooltips.php:74 -msgid "Maximum Number of Files" +#: includes/addon/class-gf-payment-addon.php:432 +msgid "%s has been captured successfully. Amount: %s. Transaction Id: %s" msgstr "" -#: ../form_detail.php:1250 ../tooltips.php:75 -msgid "Maximum File Size" +#: includes/addon/class-gf-payment-addon.php:437 +msgid "Failed to capture %s. Reason: %s." msgstr "" -#: ../form_detail.php:1263 -msgid "Enable multiple columns" +#: includes/addon/class-gf-payment-addon.php:451 +msgid "Subscription failed to be created. Reason: %s" msgstr "" -#: ../form_detail.php:1275 ../tooltips.php:55 -msgid "Maximum Rows" +#: includes/addon/class-gf-payment-addon.php:606 +msgid "options: " msgstr "" -#: ../form_detail.php:1287 ../tooltips.php:71 -msgid "Time Format" +#: includes/addon/class-gf-payment-addon.php:724 +msgid "This webhook has already been processed (Event Id: %s)" msgstr "" -#: ../form_detail.php:1291 -msgid "12 hour" +#: includes/addon/class-gf-payment-addon.php:820 +msgid "Payment is pending. Amount: %s. Transaction Id: %s." msgstr "" -#: ../form_detail.php:1292 -msgid "24 hour" +#: includes/addon/class-gf-payment-addon.php:854 +msgid "Payment has been completed. Amount: %s. Transaction Id: %s." msgstr "" -#: ../form_detail.php:1302 -msgid "Phone Format" +#: includes/addon/class-gf-payment-addon.php:878 +msgid "Payment has been refunded. Amount: %s. Transaction Id: %s." msgstr "" -#: ../form_detail.php:1317 -msgid "show values" +#: includes/addon/class-gf-payment-addon.php:898 +msgid "Payment has failed. Amount: %s." msgstr "" -#: ../form_detail.php:1320 -msgid "Choices" +#: includes/addon/class-gf-payment-addon.php:914 +msgid "Authorization has been voided. Transaction Id: %s" msgstr "" -#: ../form_detail.php:1325 -msgid "Label" +#: includes/addon/class-gf-payment-addon.php:944 +msgid "Subscription has been created. Subscription Id: %s." msgstr "" -#: ../form_detail.php:1325 -msgid "Value" +#: includes/addon/class-gf-payment-addon.php:968 +msgid "Subscription has been paid. Amount: %s. Subscription Id: %s" msgstr "" -#: ../form_detail.php:1329 -msgid "Bulk Add / Predefined Choices" +#: includes/addon/class-gf-payment-addon.php:985 +msgid "Subscription payment has failed. Amount: %s. Subscription Id: %s." msgstr "" -#: ../form_detail.php:1337 -msgid "Countries" +#: includes/addon/class-gf-payment-addon.php:1001 +msgid "Subscription has been cancelled. Subscription Id: %s." msgstr "" -#: ../form_detail.php:1338 -msgid "U.S. States" +#: includes/addon/class-gf-payment-addon.php:1023 +msgid "Subscription has expired. Subscriber Id: %s" msgstr "" -#: ../form_detail.php:1339 -msgid "Canadian Province/Territory" +#: includes/addon/class-gf-payment-addon.php:1078 +#: includes/addon/class-gf-payment-addon.php:1146 +#: includes/addon/class-gf-payment-addon.php:1154 +msgid "Transaction Type" msgstr "" -#: ../form_detail.php:1340 -msgid "Continents" +#: includes/addon/class-gf-payment-addon.php:1086 +#: includes/addon/class-gf-payment-addon.php:1152 +msgid "Subscription" msgstr "" -#: ../form_detail.php:1340 -msgid "Africa" +#: includes/addon/class-gf-payment-addon.php:1089 +#: includes/addon/class-gf-payment-addon.php:1151 +msgid "Products and Services" msgstr "" -#: ../form_detail.php:1340 -msgid "Antarctica" +#: includes/addon/class-gf-payment-addon.php:1092 +msgid "Donations" msgstr "" -#: ../form_detail.php:1340 -msgid "Asia" +#: includes/addon/class-gf-payment-addon.php:1096 +msgid "Unsupported transaction type" msgstr "" -#: ../form_detail.php:1340 -msgid "Europe" +#: includes/addon/class-gf-payment-addon.php:1103 +#: includes/addon/class-gf-payment-addon.php:1408 +#: includes/addon/class-gf-payment-addon.php:1416 +msgid "Form Total" msgstr "" -#: ../form_detail.php:1340 -msgid "North America" +#: includes/addon/class-gf-payment-addon.php:1125 +msgid "" +"You must add a Credit Card field to your form before creating a feed. Let's " +"go %sadd one%s!" msgstr "" -#: ../form_detail.php:1340 -msgid "South America" +#: includes/addon/class-gf-payment-addon.php:1142 +msgid "Enter a feed name to uniquely identify this setup." msgstr "" -#: ../form_detail.php:1341 -msgid "Gender" +#: includes/addon/class-gf-payment-addon.php:1150 +#: includes/addon/class-gf-payment-addon.php:1154 +msgid "Select a transaction type" msgstr "" -#: ../form_detail.php:1341 -msgid "Male" +#: includes/addon/class-gf-payment-addon.php:1172 +msgid "" +"Select which field determines the recurring payment amount, or select 'Form " +"Total' to use the total of all pricing fields as the recurring amount." msgstr "" -#: ../form_detail.php:1341 -msgid "Female" +#: includes/addon/class-gf-payment-addon.php:1176 +#: includes/addon/class-gf-payment-addon.php:1178 +msgid "Billing Cycle" msgstr "" -#: ../form_detail.php:1341 ../form_detail.php:1342 ../form_detail.php:1344 -#: ../form_detail.php:1347 ../form_detail.php:1348 -msgid "Prefer Not to Answer" +#: includes/addon/class-gf-payment-addon.php:1178 +msgid "" +"Select your billing cycle. This determines how often the recurring payment " +"should occur." msgstr "" -#: ../form_detail.php:1342 -msgid "Age" +#: includes/addon/class-gf-payment-addon.php:1182 +#: includes/addon/class-gf-payment-addon.php:1185 +msgid "Recurring Times" msgstr "" -#: ../form_detail.php:1342 -msgid "Under 18" +#: includes/addon/class-gf-payment-addon.php:1184 +msgid "infinite" msgstr "" -#: ../form_detail.php:1342 -msgid "18-24" +#: includes/addon/class-gf-payment-addon.php:1185 +msgid "" +"Select how many times the recurring payment should be made. The default is " +"to bill the customer until the subscription is canceled." msgstr "" -#: ../form_detail.php:1342 -msgid "25-34" +#: includes/addon/class-gf-payment-addon.php:1189 +msgid "Setup Fee" msgstr "" -#: ../form_detail.php:1342 -msgid "35-44" +#: includes/addon/class-gf-payment-addon.php:1194 +msgid "Trial" msgstr "" -#: ../form_detail.php:1342 -msgid "45-54" +#: includes/addon/class-gf-payment-addon.php:1197 +msgid "Trial Period" msgstr "" -#: ../form_detail.php:1342 -msgid "55-64" +#: includes/addon/class-gf-payment-addon.php:1197 +msgid "" +"Enable a trial period. The users recurring payment will not begin until " +"after this trial period." msgstr "" -#: ../form_detail.php:1342 -msgid "65 or Above" +#: includes/addon/class-gf-payment-addon.php:1216 +msgid "" +"Select which field determines the payment amount, or select 'Form Total' to " +"use the total of all pricing fields as the payment amount." msgstr "" -#: ../form_detail.php:1343 -msgid "Marital Status" +#: includes/addon/class-gf-payment-addon.php:1222 +msgid "Other Settings" msgstr "" -#: ../form_detail.php:1343 -msgid "Single" +#: includes/addon/class-gf-payment-addon.php:1237 +#: includes/addon/class-gf-payment-addon.php:1240 +msgid "Billing Information" msgstr "" -#: ../form_detail.php:1343 -msgid "Married" +#: includes/addon/class-gf-payment-addon.php:1240 +msgid "Map your Form Fields to the available listed fields." msgstr "" -#: ../form_detail.php:1343 -msgid "Divorced" +#: includes/addon/class-gf-payment-addon.php:1248 +msgid "Options" msgstr "" -#: ../form_detail.php:1343 -msgid "Widowed" +#: includes/addon/class-gf-payment-addon.php:1258 +msgid "" +"When conditions are enabled, form submissions will only be sent to the " +"payment gateway when the conditions are met. When disabled, all form " +"submissions will be sent to the payment gateway." msgstr "" -#: ../form_detail.php:1344 -msgid "Employment" +#: includes/addon/class-gf-payment-addon.php:1319 +#: includes/addon/class-gf-payment-addon.php:1364 +#: includes/webapi/webapi.php:186 +msgid "Enabled" msgstr "" -#: ../form_detail.php:1344 -msgid "Employed Full-Time" +#: includes/addon/class-gf-payment-addon.php:1376 +msgid "Enter an amount" msgstr "" -#: ../form_detail.php:1344 -msgid "Employed Part-Time" +#: includes/addon/class-gf-payment-addon.php:1424 +msgid "Sample Option" msgstr "" -#: ../form_detail.php:1344 -msgid "Self-employed" +#: includes/addon/class-gf-payment-addon.php:1434 +#: includes/fields/class-gf-field-address.php:12 js.php:613 +msgid "Address" msgstr "" -#: ../form_detail.php:1344 -msgid "Not employed" +#: includes/addon/class-gf-payment-addon.php:1435 +msgid "Address 2" msgstr "" -#: ../form_detail.php:1344 -msgid " but looking for work" +#: includes/addon/class-gf-payment-addon.php:1436 +#: includes/fields/class-gf-field-address.php:149 js.php:614 +msgid "City" msgstr "" -#: ../form_detail.php:1344 -msgid "Not employed and not looking for work" +#: includes/addon/class-gf-payment-addon.php:1438 +msgid "Zip" msgstr "" -#: ../form_detail.php:1344 -msgid "Homemaker" +#: includes/addon/class-gf-payment-addon.php:1439 +#: includes/fields/class-gf-field-address.php:153 js.php:615 +msgid "Country" msgstr "" -#: ../form_detail.php:1344 -msgid "Retired" +#: includes/addon/class-gf-payment-addon.php:1457 +msgid "day(s)" msgstr "" -#: ../form_detail.php:1344 -msgid "Student" +#: includes/addon/class-gf-payment-addon.php:1458 +msgid "week(s)" msgstr "" -#: ../form_detail.php:1345 -msgid "Job Type" +#: includes/addon/class-gf-payment-addon.php:1459 +msgid "month(s)" msgstr "" -#: ../form_detail.php:1345 -msgid "Full-Time" +#: includes/addon/class-gf-payment-addon.php:1460 +msgid "year(s)" msgstr "" -#: ../form_detail.php:1345 -msgid "Part-Time" +#: includes/addon/class-gf-payment-addon.php:1469 +msgid "Select a product field" msgstr "" -#: ../form_detail.php:1345 -msgid "Per Diem" +#: includes/addon/class-gf-payment-addon.php:1513 +msgid "Today" msgstr "" -#: ../form_detail.php:1345 -msgid "Employee" +#: includes/addon/class-gf-payment-addon.php:1514 +msgid "Yesterday" msgstr "" -#: ../form_detail.php:1345 -msgid "Temporary" +#: includes/addon/class-gf-payment-addon.php:1515 +msgid "Last 30 Days" msgstr "" -#: ../form_detail.php:1345 -msgid "Contract" +#: includes/addon/class-gf-payment-addon.php:1522 +#: includes/addon/class-gf-payment-addon.php:1529 +#: includes/addon/class-gf-payment-addon.php:1537 +#: includes/addon/class-gf-payment-addon.php:1544 +msgid "subscriptions" msgstr "" -#: ../form_detail.php:1345 -msgid "Intern" +#: includes/addon/class-gf-payment-addon.php:1523 +#: includes/addon/class-gf-payment-addon.php:1530 +#: includes/addon/class-gf-payment-addon.php:1538 +#: includes/addon/class-gf-payment-addon.php:1545 +msgid "orders" msgstr "" -#: ../form_detail.php:1345 -msgid "Seasonal" +#: includes/addon/class-gf-payment-addon.php:1553 +msgid "There aren't any transactions that match your criteria." msgstr "" -#: ../form_detail.php:1346 -msgid "Industry" +#: includes/addon/class-gf-payment-addon.php:1657 +#: includes/addon/class-gf-payment-addon.php:1658 +msgid "Revenue" msgstr "" -#: ../form_detail.php:1346 -msgid "Accounting/Finance" +#: includes/addon/class-gf-payment-addon.php:1658 +msgid "Orders" msgstr "" -#: ../form_detail.php:1346 -msgid "Advertising/Public Relations" +#: includes/addon/class-gf-payment-addon.php:1658 +msgid "Subscriptions" msgstr "" -#: ../form_detail.php:1346 -msgid "Aerospace/Aviation" +#: includes/addon/class-gf-payment-addon.php:1658 +msgid "Recurring Payments" msgstr "" -#: ../form_detail.php:1346 -msgid "Arts/Entertainment/Publishing" +#: includes/addon/class-gf-payment-addon.php:1658 +msgid "Refunds" msgstr "" -#: ../form_detail.php:1346 -msgid "Automotive" +#: includes/addon/class-gf-payment-addon.php:1677 +#: includes/addon/class-gf-payment-addon.php:1678 +msgid "Week" msgstr "" -#: ../form_detail.php:1346 -msgid "Banking/Mortgage" +#: includes/addon/class-gf-payment-addon.php:1690 +#: includes/addon/class-gf-payment-addon.php:1691 +#: includes/fields/class-gf-field-creditcard.php:280 +#: includes/fields/class-gf-field-date.php:440 js.php:866 js.php:867 +msgid "Month" msgstr "" -#: ../form_detail.php:1346 -msgid "Business Development" +#: includes/addon/class-gf-payment-addon.php:1703 +#: includes/addon/class-gf-payment-addon.php:1704 +#: includes/fields/class-gf-field-date.php:448 js.php:869 +msgid "Day" msgstr "" -#: ../form_detail.php:1346 -msgid "Business Opportunity" +#: includes/addon/class-gf-payment-addon.php:1779 +msgid "Jan" msgstr "" -#: ../form_detail.php:1346 -msgid "Clerical/Administrative" +#: includes/addon/class-gf-payment-addon.php:1779 +msgid "Feb" msgstr "" -#: ../form_detail.php:1346 -msgid "Construction/Facilities" +#: includes/addon/class-gf-payment-addon.php:1779 +msgid "Mar" msgstr "" -#: ../form_detail.php:1346 -msgid "Consumer Goods" +#: includes/addon/class-gf-payment-addon.php:1779 +msgid "Apr" msgstr "" -#: ../form_detail.php:1346 -msgid "Customer Service" +#: includes/addon/class-gf-payment-addon.php:1779 +msgid "Jun" msgstr "" -#: ../form_detail.php:1346 -msgid "Education/Training" +#: includes/addon/class-gf-payment-addon.php:1779 +msgid "Jul" msgstr "" -#: ../form_detail.php:1346 -msgid "Energy/Utilities" +#: includes/addon/class-gf-payment-addon.php:1779 +msgid "Aug" msgstr "" -#: ../form_detail.php:1346 -msgid "Engineering" +#: includes/addon/class-gf-payment-addon.php:1779 +msgid "Sep" msgstr "" -#: ../form_detail.php:1346 -msgid "Government/Military" +#: includes/addon/class-gf-payment-addon.php:1779 +msgid "Oct" msgstr "" -#: ../form_detail.php:1346 -msgid "Healthcare" +#: includes/addon/class-gf-payment-addon.php:1779 +msgid "Nov" msgstr "" -#: ../form_detail.php:1346 -msgid "Hospitality/Travel" +#: includes/addon/class-gf-payment-addon.php:1779 +msgid "Dec" msgstr "" -#: ../form_detail.php:1346 -msgid "Human Resources" +#: includes/addon/class-gf-payment-addon.php:1889 +msgid "Daily" msgstr "" -#: ../form_detail.php:1346 -msgid "Installation/Maintenance" +#: includes/addon/class-gf-payment-addon.php:1890 +msgid "Weekly" msgstr "" -#: ../form_detail.php:1346 -msgid "Insurance" +#: includes/addon/class-gf-payment-addon.php:1891 +msgid "Monthly" msgstr "" -#: ../form_detail.php:1346 -msgid "Internet" +#: includes/addon/class-gf-payment-addon.php:1894 +msgid "

    View
    Select how you would like the sales data to be displayed." msgstr "" -#: ../form_detail.php:1346 -msgid "Job Search Aids" +#: includes/addon/class-gf-payment-addon.php:1910 +msgid "Payment Method" msgstr "" -#: ../form_detail.php:1346 -msgid "Law Enforcement/Security" +#: includes/addon/class-gf-payment-addon.php:1966 +msgid "" +"Warning! This subscription will be canceled. This cannot be undone. 'OK' to " +"cancel subscription, 'Cancel' to stop" msgstr "" -#: ../form_detail.php:1346 -msgid "Legal" +#: includes/addon/class-gf-payment-addon.php:1968 +msgid "Canceled" msgstr "" -#: ../form_detail.php:1346 -msgid "Management/Executive" +#: includes/addon/class-gf-payment-addon.php:1969 +msgid "The subscription could not be canceled. Please try again later." msgstr "" -#: ../form_detail.php:1346 -msgid "Manufacturing/Operations" +#: includes/addon/class-gf-payment-addon.php:2013 +msgid "Cancel Subscription" msgstr "" -#: ../form_detail.php:1346 -msgid "Marketing" +#: includes/addon/class-gf-payment-addon.php:2121 +msgid "sale" msgstr "" -#: ../form_detail.php:1346 -msgid "Non-Profit/Volunteer" +#: includes/addon/class-gf-payment-addon.php:2122 +msgid "sales" msgstr "" -#: ../form_detail.php:1346 -msgid "Pharmaceutical/Biotech" +#: includes/addon/class-gf-payment-addon.php:2136 +msgid "There hasn't been any sales in the specified date range." msgstr "" -#: ../form_detail.php:1346 -msgid "Professional Services" -msgstr "" +#: includes/addon/class-gf-payment-addon.php:2155 +msgid "1 item" +msgid_plural "%s items" +msgstr[0] "" +msgstr[1] "" -#: ../form_detail.php:1346 -msgid "QA/Quality Control" +#: includes/addon/class-gf-payment-addon.php:2172 +msgid "Go to the first page" msgstr "" -#: ../form_detail.php:1346 -msgid "Real Estate" +#: includes/addon/class-gf-payment-addon.php:2179 +msgid "Go to the previous page" msgstr "" -#: ../form_detail.php:1346 -msgid "Restaurant/Food Service" +#: includes/addon/class-gf-payment-addon.php:2193 +msgid "Go to the next page" msgstr "" -#: ../form_detail.php:1346 -msgid "Retail" +#: includes/addon/class-gf-payment-addon.php:2201 +msgid "Go to the last page" msgstr "" -#: ../form_detail.php:1346 -msgid "Sales" +#: includes/addon/class-gf-results.php:21 +msgid "Results Filters" msgstr "" -#: ../form_detail.php:1346 -msgid "Science/Research" +#: includes/addon/class-gf-results.php:82 +msgid "Error retrieving results. If the problem persists, please contact support." msgstr "" -#: ../form_detail.php:1346 -msgid "Skilled Labor" +#: includes/addon/class-gf-results.php:128 +#: includes/addon/class-gf-results.php:158 +msgid "View results generated by this form" msgstr "" -#: ../form_detail.php:1346 -msgid "Technology" +#: includes/addon/class-gf-results.php:150 +#: includes/addon/class-gf-results.php:156 +msgid "Results" msgstr "" -#: ../form_detail.php:1346 -msgid "Telecommunications" +#: includes/addon/class-gf-results.php:259 +#: includes/addon/class-gf-results.php:348 +msgid "Filters" msgstr "" -#: ../form_detail.php:1346 -msgid "Transportation/Logistics" +#: includes/addon/class-gf-results.php:266 +#: includes/addon/class-gf-results.php:347 +msgid "Date Range" msgstr "" -#: ../form_detail.php:1347 -msgid "Income" +#: includes/addon/class-gf-results.php:307 +msgid "Apply filters" msgstr "" -#: ../form_detail.php:1347 -msgid "Under $20,000" +#: includes/addon/class-gf-results.php:310 +msgid "Clear" msgstr "" -#: ../form_detail.php:1347 -msgid "$20,000 - $30,000" +#: includes/addon/class-gf-results.php:315 +msgid "Loading" msgstr "" -#: ../form_detail.php:1347 -msgid "$30,000 - $40,000" +#: includes/addon/class-gf-results.php:336 +msgid "This form does not have any fields that can be used for results" msgstr "" -#: ../form_detail.php:1347 -msgid "$40,000 - $50,000" +#: includes/addon/class-gf-results.php:345 +#: includes/addon/class-gf-results.php:648 +msgid "Total Score" msgstr "" -#: ../form_detail.php:1347 -msgid "$50,000 - $75,000" +#: includes/addon/class-gf-results.php:345 +msgid "" +"Scores are weighted calculations. Items ranked higher are given a greater " +"score than items that are ranked lower. The total score for each item is " +"the sum of the weighted scores." msgstr "" -#: ../form_detail.php:1347 -msgid "$75,000 - $100,000" +#: includes/addon/class-gf-results.php:346 +#: includes/addon/class-gf-results.php:651 +msgid "Aggregate Rank" msgstr "" -#: ../form_detail.php:1347 -msgid "$100,000 - $150,000" +#: includes/addon/class-gf-results.php:346 +msgid "" +"The aggregate rank is the overall rank for all entries based on the " +"weighted scores for each item." msgstr "" -#: ../form_detail.php:1347 -msgid "$150,000 or more" +#: includes/addon/class-gf-results.php:347 +msgid "Date Range is optional, if no date range is specified it will be ignored." msgstr "" -#: ../form_detail.php:1348 -msgid "Education" +#: includes/addon/class-gf-results.php:348 +msgid "" +"Narrow the results by adding filters. Note that some field types support " +"more options than others." msgstr "" -#: ../form_detail.php:1348 -msgid "High School" +#: includes/addon/class-gf-results.php:349 +msgid "Average Row Score" msgstr "" -#: ../form_detail.php:1348 -msgid "Associate Degree" +#: includes/addon/class-gf-results.php:349 +msgid "" +"The average (mean) score for each row: the sum of all the scores for each " +"row divided by the total number of entries." msgstr "" -#: ../form_detail.php:1348 -msgid "Bachelor's Degree" +#: includes/addon/class-gf-results.php:350 +msgid "Average Global Score" msgstr "" -#: ../form_detail.php:1348 -msgid "Graduate of Professional Degree" +#: includes/addon/class-gf-results.php:350 +msgid "" +"The average (mean) score for the whole field. The sum of the total scores " +"divided by the number of entries." msgstr "" -#: ../form_detail.php:1348 -msgid "Some College" +#: includes/addon/class-gf-results.php:351 +#: includes/addon/class-gf-results.php:572 +msgid "Average Score" msgstr "" -#: ../form_detail.php:1349 -msgid "Days of the Week" +#: includes/addon/class-gf-results.php:351 +msgid "" +"The average (mean) score: The sum of the scores divided by the number of " +"entries." msgstr "" -#: ../form_detail.php:1349 -msgid "Sunday" +#: includes/addon/class-gf-results.php:372 +msgid "No results." msgstr "" -#: ../form_detail.php:1349 -msgid "Monday" +#: includes/addon/class-gf-results.php:396 +msgid "There was an error while processing the entries. Please contact support." msgstr "" -#: ../form_detail.php:1349 -msgid "Tuesday" +#: includes/addon/class-gf-results.php:410 +msgid "Entries processed: %1$d of %2$d" msgstr "" -#: ../form_detail.php:1349 -msgid "Wednesday" +#: includes/addon/class-gf-results.php:427 +msgid "No results" msgstr "" -#: ../form_detail.php:1349 -msgid "Thursday" +#: includes/addon/class-gf-results.php:481 +#: includes/addon/class-gf-results.php:495 +msgid "No entries for this field" msgstr "" -#: ../form_detail.php:1349 -msgid "Friday" +#: includes/addon/class-gf-results.php:502 +msgid "Choice" msgstr "" -#: ../form_detail.php:1349 -msgid "Saturday" +#: includes/addon/class-gf-results.php:502 +#: includes/addon/class-gf-results.php:531 +msgid "Frequency" msgstr "" -#: ../form_detail.php:1350 -msgid "Months of the Year" +#: includes/addon/class-gf-results.php:630 +msgid "Average global score" msgstr "" -#: ../form_detail.php:1350 -msgid "January" +#: includes/addon/class-gf-results.php:632 +msgid "Average score" msgstr "" -#: ../form_detail.php:1350 -msgid "February" +#: includes/addon/class-gf-results.php:645 +msgid "Item" msgstr "" -#: ../form_detail.php:1350 -msgid "March" +#: includes/addon/class-gf-results.php:681 +msgid "Latest values:" msgstr "" -#: ../form_detail.php:1350 -msgid "April" +#: includes/addon/class-gf-results.php:689 +msgid "Show more" msgstr "" -#: ../form_detail.php:1350 ../includes/addon/class-gf-payment-addon.php:1759 -msgid "May" +#: includes/api.php:106 +msgid "Form with id: %s not found" msgstr "" -#: ../form_detail.php:1350 -msgid "June" +#: includes/api.php:152 includes/api.php:313 +msgid "Invalid form object" msgstr "" -#: ../form_detail.php:1350 -msgid "July" +#: includes/api.php:173 includes/webapi/webapi.php:692 +msgid "Missing form id" msgstr "" -#: ../form_detail.php:1350 -msgid "August" +#: includes/api.php:179 +msgid "Form not found" msgstr "" -#: ../form_detail.php:1350 -msgid "September" +#: includes/api.php:189 +msgid "Error updating form" msgstr "" -#: ../form_detail.php:1350 -msgid "October" +#: includes/api.php:195 +msgid "Error updating form confirmations" msgstr "" -#: ../form_detail.php:1350 -msgid "November" +#: includes/api.php:202 +msgid "Error updating form notifications" msgstr "" -#: ../form_detail.php:1350 -msgid "December" +#: includes/api.php:210 +msgid "Error updating title" msgstr "" -#: ../form_detail.php:1351 -msgid "How Often" +#: includes/api.php:284 +msgid "Invalid form objects" msgstr "" -#: ../form_detail.php:1351 -msgid "Everyday" +#: includes/api.php:317 +msgid "The form title is missing" msgstr "" -#: ../form_detail.php:1351 -msgid "Once a week" +#: includes/api.php:352 +msgid "There was a problem while inserting the form" msgstr "" -#: ../form_detail.php:1351 -msgid "2 to 3 times a week" +#: includes/api.php:486 +msgid "Entry with id %s not found" msgstr "" -#: ../form_detail.php:1351 -msgid "Once a month" +#: includes/api.php:566 +msgid "Missing entry id" msgstr "" -#: ../form_detail.php:1351 -msgid " 2 to 3 times a month" +#: includes/api.php:572 +msgid "Entry not found" msgstr "" -#: ../form_detail.php:1351 -msgid "Less than once a month" +#: includes/api.php:586 includes/api.php:755 +msgid "The form for this entry does not exist" msgstr "" -#: ../form_detail.php:1352 -msgid "How Long" +#: includes/api.php:646 +msgid "There was a problem while updating the entry properties" msgstr "" -#: ../form_detail.php:1352 -msgid "Less than a month" +#: includes/api.php:669 +msgid "There was a problem while updating one of the input values for the entry" msgstr "" -#: ../form_detail.php:1352 -msgid "1-6 months" +#: includes/api.php:682 includes/api.php:718 +msgid "There was a problem while updating the field values" msgstr "" -#: ../form_detail.php:1352 -msgid "1-3 years" +#: includes/api.php:745 +msgid "The entry object must be an array" msgstr "" -#: ../form_detail.php:1352 -msgid "Over 3 Years" +#: includes/api.php:751 +msgid "The form id must be specified" msgstr "" -#: ../form_detail.php:1352 -msgid "Never used" +#: includes/api.php:795 +msgid "There was a problem while inserting the entry properties" msgstr "" -#: ../form_detail.php:1353 -msgid "Satisfaction" +#: includes/api.php:814 +msgid "There was a problem while inserting one of the input values for the entry" msgstr "" -#: ../form_detail.php:1353 -msgid "Very Satisfied" +#: includes/api.php:823 +msgid "There was a problem while inserting the field values" msgstr "" -#: ../form_detail.php:1353 -msgid "Satisfied" +#: includes/api.php:856 +msgid "Invalid entry id: %s" msgstr "" -#: ../form_detail.php:1353 -msgid "Neutral" +#: includes/api.php:957 +msgid "Feed not found" msgstr "" -#: ../form_detail.php:1353 -msgid "Unsatisfied" +#: includes/api.php:988 +msgid "There was an an error while deleting feed id %s" msgstr "" -#: ../form_detail.php:1353 -msgid "Very Unsatisfied" +#: includes/api.php:992 includes/api.php:1016 +msgid "Feed id %s not found" msgstr "" -#: ../form_detail.php:1354 -msgid "Importance" +#: includes/api.php:1012 +msgid "There was an an error while updating feed id %s" msgstr "" -#: ../form_detail.php:1354 -msgid "Very Important" +#: includes/api.php:1045 +msgid "There was an an error while inserting a feed" msgstr "" -#: ../form_detail.php:1354 ../form_settings.php:989 -msgid "Important" +#: includes/fields/class-gf-field-address.php:34 +msgid "This field is required. Please enter a complete address." msgstr "" -#: ../form_detail.php:1354 -msgid "Somewhat Important" +#: includes/fields/class-gf-field-address.php:121 +msgid "Zip Code" msgstr "" -#: ../form_detail.php:1354 -msgid "Not Important" +#: includes/fields/class-gf-field-address.php:143 js.php:614 +msgid "Street Address" msgstr "" -#: ../form_detail.php:1355 -msgid "Agreement" +#: includes/fields/class-gf-field-address.php:145 js.php:614 +msgid "Address Line 2" msgstr "" -#: ../form_detail.php:1355 -msgid "Strongly Agree" +#: includes/fields/class-gf-field-address.php:384 js.php:615 +msgid "ZIP / Postal Code" msgstr "" -#: ../form_detail.php:1355 -msgid "Agree" +#: includes/fields/class-gf-field-address.php:384 +msgid "State / Province / Region" msgstr "" -#: ../form_detail.php:1355 -msgid "Disagree" +#: includes/fields/class-gf-field-address.php:385 +#: includes/fields/class-gf-field-address.php:450 +msgid "United States" msgstr "" -#: ../form_detail.php:1355 -msgid "Strongly Disagree" +#: includes/fields/class-gf-field-address.php:385 +msgid "ZIP Code" msgstr "" -#: ../form_detail.php:1356 -msgid "Comparison" +#: includes/fields/class-gf-field-address.php:386 +msgid "Canadian" msgstr "" -#: ../form_detail.php:1356 -msgid "Much Better" +#: includes/fields/class-gf-field-address.php:386 +msgid "Province" msgstr "" -#: ../form_detail.php:1356 -msgid "Somewhat Better" +#: includes/fields/class-gf-field-address.php:447 +msgid "Afghanistan" msgstr "" -#: ../form_detail.php:1356 -msgid "About the Same" +#: includes/fields/class-gf-field-address.php:447 +msgid "Albania" msgstr "" -#: ../form_detail.php:1356 -msgid "Somewhat Worse" +#: includes/fields/class-gf-field-address.php:447 +msgid "Algeria" msgstr "" -#: ../form_detail.php:1356 -msgid "Much Worse" +#: includes/fields/class-gf-field-address.php:447 +msgid "American Samoa" msgstr "" -#: ../form_detail.php:1357 -msgid "Would You" +#: includes/fields/class-gf-field-address.php:447 +msgid "Andorra" msgstr "" -#: ../form_detail.php:1357 -msgid "Definitely" +#: includes/fields/class-gf-field-address.php:447 +msgid "Angola" msgstr "" -#: ../form_detail.php:1357 -msgid "Probably" +#: includes/fields/class-gf-field-address.php:447 +msgid "Antigua and Barbuda" msgstr "" -#: ../form_detail.php:1357 -msgid "Not Sure" +#: includes/fields/class-gf-field-address.php:447 +msgid "Argentina" msgstr "" -#: ../form_detail.php:1357 -msgid "Probably Not" +#: includes/fields/class-gf-field-address.php:447 +msgid "Armenia" msgstr "" -#: ../form_detail.php:1357 -msgid "Definitely Not" +#: includes/fields/class-gf-field-address.php:447 +msgid "Austria" msgstr "" -#: ../form_detail.php:1358 -msgid "Extra Small" +#: includes/fields/class-gf-field-address.php:447 +msgid "Azerbaijan" msgstr "" -#: ../form_detail.php:1358 -msgid "Extra Large" +#: includes/fields/class-gf-field-address.php:447 +msgid "Bahamas" msgstr "" -#: ../form_detail.php:1367 -msgid "" -"Select a category and customize the predefined choices or paste your own " -"list to bulk add choices." +#: includes/fields/class-gf-field-address.php:447 +msgid "Bahrain" msgstr "" -#: ../form_detail.php:1385 -msgid "Insert Choices" +#: includes/fields/class-gf-field-address.php:447 +msgid "Bangladesh" msgstr "" -#: ../form_detail.php:1390 -msgid "Save as new custom choice" +#: includes/fields/class-gf-field-address.php:447 +msgid "Barbados" msgstr "" -#: ../form_detail.php:1392 -msgid "Save as" +#: includes/fields/class-gf-field-address.php:447 +msgid "Belarus" msgstr "" -#: ../form_detail.php:1392 -msgid "Enter name" +#: includes/fields/class-gf-field-address.php:447 +msgid "Belgium" msgstr "" -#: ../form_detail.php:1392 -msgid "enter name" +#: includes/fields/class-gf-field-address.php:447 +msgid "Belize" msgstr "" -#: ../form_detail.php:1419 -msgid "Enable \"other\" choice" +#: includes/fields/class-gf-field-address.php:447 +msgid "Benin" msgstr "" -#: ../form_detail.php:1432 -msgid "Enable Email Confirmation" +#: includes/fields/class-gf-field-address.php:447 +msgid "Bermuda" msgstr "" -#: ../form_detail.php:1442 -msgid "Enable Password Strength" +#: includes/fields/class-gf-field-address.php:447 +msgid "Bhutan" msgstr "" -#: ../form_detail.php:1453 -msgid "Enable enhanced user interface" +#: includes/fields/class-gf-field-address.php:447 +msgid "Bolivia" msgstr "" -#: ../form_detail.php:1460 -msgid "Minimum Strength" +#: includes/fields/class-gf-field-address.php:447 +msgid "Bosnia and Herzegovina" msgstr "" -#: ../form_detail.php:1465 ../form_display.php:2194 -msgid "Short" +#: includes/fields/class-gf-field-address.php:447 +msgid "Botswana" msgstr "" -#: ../form_detail.php:1466 ../form_display.php:2194 -msgid "Bad" +#: includes/fields/class-gf-field-address.php:447 +msgid "Brazil" msgstr "" -#: ../form_detail.php:1467 ../form_display.php:2194 -msgid "Good" +#: includes/fields/class-gf-field-address.php:447 +msgid "Brunei" msgstr "" -#: ../form_detail.php:1468 ../form_display.php:2194 -msgid "Strong" +#: includes/fields/class-gf-field-address.php:447 +msgid "Bulgaria" msgstr "" -#: ../form_detail.php:1478 ../tooltips.php:67 -msgid "Number Format" +#: includes/fields/class-gf-field-address.php:447 +msgid "Burkina Faso" msgstr "" -#: ../form_detail.php:1484 ../settings.php:219 ../tooltips.php:140 -msgid "Currency" +#: includes/fields/class-gf-field-address.php:447 +msgid "Burundi" msgstr "" -#: ../form_detail.php:1502 -msgid "Supported Credit Cards" +#: includes/fields/class-gf-field-address.php:447 +msgid "Cambodia" msgstr "" -#: ../form_detail.php:1522 -msgid "Card Icon Style" +#: includes/fields/class-gf-field-address.php:447 +msgid "Cameroon" msgstr "" -#: ../form_detail.php:1526 ../form_detail.php:1548 -msgid "Standard" +#: includes/fields/class-gf-field-address.php:447 +msgid "Canada" msgstr "" -#: ../form_detail.php:1527 -msgid "3D" +#: includes/fields/class-gf-field-address.php:447 +msgid "Cape Verde" msgstr "" -#: ../form_detail.php:1537 ../tooltips.php:123 -msgid "Input Mask" +#: includes/fields/class-gf-field-address.php:447 +msgid "Cayman Islands" msgstr "" -#: ../form_detail.php:1562 -msgid "Enter a custom mask" +#: includes/fields/class-gf-field-address.php:447 +msgid "Central African Republic" msgstr "" -#: ../form_detail.php:1563 -msgid "Custom Mask Instructions" +#: includes/fields/class-gf-field-address.php:447 +msgid "Chad" msgstr "" -#: ../form_detail.php:1563 ../gravityforms.php:987 -msgid "Help" +#: includes/fields/class-gf-field-address.php:447 +msgid "Chile" msgstr "" -#: ../form_detail.php:1568 -msgid "Usage" +#: includes/fields/class-gf-field-address.php:447 +msgid "China" msgstr "" -#: ../form_detail.php:1570 -msgid "Use a '9' to indicate a numerical character." +#: includes/fields/class-gf-field-address.php:447 +msgid "Colombia" msgstr "" -#: ../form_detail.php:1571 -msgid "Use a lower case 'a' to indicate an alphabetical character." +#: includes/fields/class-gf-field-address.php:447 +msgid "Comoros" msgstr "" -#: ../form_detail.php:1572 -msgid "Use an asterick '*' to indicate any alphanumeric character." +#: includes/fields/class-gf-field-address.php:447 +msgid "Congo, Democratic Republic of the" msgstr "" -#: ../form_detail.php:1573 -msgid "" -"Use a question mark '?' to indicate optional characters. Note: All characters after the question mark will be optional." +#: includes/fields/class-gf-field-address.php:447 +msgid "Congo, Republic of the" msgstr "" -#: ../form_detail.php:1574 -msgid "" -"All other characters are literal values and will be displayed automatically." +#: includes/fields/class-gf-field-address.php:447 +msgid "Costa Rica" msgstr "" -#: ../form_detail.php:1577 -msgid "Examples" +#: includes/fields/class-gf-field-address.php:447 +msgid "Côte d'Ivoire" msgstr "" -#: ../form_detail.php:1581 ../form_detail.php:1586 ../form_detail.php:1591 -#: ../form_detail.php:1596 ../form_detail.php:1601 -msgid "Mask" +#: includes/fields/class-gf-field-address.php:447 +msgid "Croatia" msgstr "" -#: ../form_detail.php:1582 ../form_detail.php:1587 ../form_detail.php:1592 -#: ../form_detail.php:1597 ../form_detail.php:1602 -msgid "Valid Input" +#: includes/fields/class-gf-field-address.php:447 +msgid "Cuba" msgstr "" -#: ../form_detail.php:1585 -msgid "Social Security Number" +#: includes/fields/class-gf-field-address.php:447 +msgid "Cyprus" msgstr "" -#: ../form_detail.php:1590 -msgid "Course Code" +#: includes/fields/class-gf-field-address.php:447 +msgid "Czech Republic" msgstr "" -#: ../form_detail.php:1595 -msgid "License Key" +#: includes/fields/class-gf-field-address.php:447 +msgid "Denmark" msgstr "" -#: ../form_detail.php:1600 -msgid "Zip Code w/ Optional Plus Four" +#: includes/fields/class-gf-field-address.php:447 +msgid "Djibouti" msgstr "" -#: ../form_detail.php:1610 -msgid "Select a Mask" +#: includes/fields/class-gf-field-address.php:447 +msgid "Dominica" msgstr "" -#: ../form_detail.php:1629 ../tooltips.php:54 -msgid "Maximum Characters" +#: includes/fields/class-gf-field-address.php:447 +msgid "Dominican Republic" msgstr "" -#: ../form_detail.php:1639 -msgid "Range" +#: includes/fields/class-gf-field-address.php:447 +msgid "East Timor" msgstr "" -#: ../form_detail.php:1645 -msgid "Min" +#: includes/fields/class-gf-field-address.php:447 +msgid "Ecuador" msgstr "" -#: ../form_detail.php:1651 -msgid "Max" +#: includes/fields/class-gf-field-address.php:447 +msgid "Egypt" msgstr "" -#: ../form_detail.php:1667 ../tooltips.php:81 -msgid "Enable Calculation" +#: includes/fields/class-gf-field-address.php:447 +msgid "El Salvador" msgstr "" -#: ../form_detail.php:1675 ../tooltips.php:82 -msgid "Formula" +#: includes/fields/class-gf-field-address.php:447 +msgid "Equatorial Guinea" msgstr "" -#: ../form_detail.php:1688 -msgid "The formula appears to be valid." +#: includes/fields/class-gf-field-address.php:447 +msgid "Eritrea" msgstr "" -#: ../form_detail.php:1688 -msgid "There appears to be a problem with the formula." +#: includes/fields/class-gf-field-address.php:447 +msgid "Estonia" msgstr "" -#: ../form_detail.php:1688 -msgid "Validate Formula" +#: includes/fields/class-gf-field-address.php:447 +msgid "Ethiopia" msgstr "" -#: ../form_detail.php:1691 ../tooltips.php:83 -msgid "Rounding" +#: includes/fields/class-gf-field-address.php:447 +msgid "Fiji" msgstr "" -#: ../form_detail.php:1715 -msgid "Rules" +#: includes/fields/class-gf-field-address.php:447 +msgid "Finland" msgstr "" -#: ../form_detail.php:1718 -msgid "Required" +#: includes/fields/class-gf-field-address.php:447 +msgid "France" msgstr "" -#: ../form_detail.php:1724 ../tooltips.php:79 -msgid "No Duplicates" +#: includes/fields/class-gf-field-address.php:447 +msgid "French Polynesia" msgstr "" -#: ../form_detail.php:1742 ../tooltips.php:84 -msgid "Admin Label" +#: includes/fields/class-gf-field-address.php:447 +msgid "Gabon" msgstr "" -#: ../form_detail.php:1752 ../tooltips.php:85 -msgid "Field Size" +#: includes/fields/class-gf-field-address.php:448 +msgid "Gambia" msgstr "" -#: ../form_detail.php:1766 ../form_detail.php:1776 ../tooltips.php:86 -msgid "Default Value" +#: includes/fields/class-gf-field-address.php:448 +msgid "Germany" msgstr "" -#: ../form_detail.php:1786 ../tooltips.php:87 -msgid "Validation Message" +#: includes/fields/class-gf-field-address.php:448 +msgid "Ghana" msgstr "" -#: ../form_detail.php:1796 ../tooltips.php:69 -msgid "Credit Card Icon Style" +#: includes/fields/class-gf-field-address.php:448 +msgid "Greece" msgstr "" -#: ../form_detail.php:1816 -msgid "Language" +#: includes/fields/class-gf-field-address.php:448 +msgid "Greenland" msgstr "" -#: ../form_detail.php:1820 -msgid "English" +#: includes/fields/class-gf-field-address.php:448 +msgid "Grenada" msgstr "" -#: ../form_detail.php:1821 -msgid "Dutch" +#: includes/fields/class-gf-field-address.php:448 +msgid "Guam" msgstr "" -#: ../form_detail.php:1822 -msgid "French" +#: includes/fields/class-gf-field-address.php:448 +msgid "Guatemala" msgstr "" -#: ../form_detail.php:1823 -msgid "German" +#: includes/fields/class-gf-field-address.php:448 +msgid "Guinea" msgstr "" -#: ../form_detail.php:1824 -msgid "Portuguese" +#: includes/fields/class-gf-field-address.php:448 +msgid "Guinea-Bissau" msgstr "" -#: ../form_detail.php:1825 -msgid "Russian" +#: includes/fields/class-gf-field-address.php:448 +msgid "Guyana" msgstr "" -#: ../form_detail.php:1826 -msgid "Spanish" +#: includes/fields/class-gf-field-address.php:448 +msgid "Haiti" msgstr "" -#: ../form_detail.php:1827 -msgid "Turkish" +#: includes/fields/class-gf-field-address.php:448 +msgid "Honduras" msgstr "" -#: ../form_detail.php:1845 ../tooltips.php:40 -msgid "Add Icon URL" +#: includes/fields/class-gf-field-address.php:448 +msgid "Hong Kong" msgstr "" -#: ../form_detail.php:1855 ../tooltips.php:41 -msgid "Delete Icon URL" +#: includes/fields/class-gf-field-address.php:448 +msgid "Hungary" msgstr "" -#: ../form_detail.php:1864 -msgid "Enable Password Input" +#: includes/fields/class-gf-field-address.php:448 +msgid "Iceland" msgstr "" -#: ../form_detail.php:1871 ../tooltips.php:68 -msgid "Force SSL" +#: includes/fields/class-gf-field-address.php:448 +msgid "India" msgstr "" -#: ../form_detail.php:1878 ../tooltips.php:90 -msgid "Visibility" +#: includes/fields/class-gf-field-address.php:448 +msgid "Indonesia" msgstr "" -#: ../form_detail.php:1882 -msgid "Everyone" +#: includes/fields/class-gf-field-address.php:448 +msgid "Iran" msgstr "" -#: ../form_detail.php:1887 -msgid "Admin Only" +#: includes/fields/class-gf-field-address.php:448 +msgid "Iraq" msgstr "" -#: ../form_detail.php:1897 -msgid "Allow field to be populated dynamically" +#: includes/fields/class-gf-field-address.php:448 +msgid "Ireland" msgstr "" -#: ../form_detail.php:1907 ../form_settings.php:492 -msgid "Enable Conditional Logic" +#: includes/fields/class-gf-field-address.php:448 +msgid "Israel" msgstr "" -#: ../form_detail.php:1918 -msgid "Enable Page Conditional Logic" +#: includes/fields/class-gf-field-address.php:448 +msgid "Italy" msgstr "" -#: ../form_detail.php:1930 -msgid "Enable Next Button Conditional Logic" +#: includes/fields/class-gf-field-address.php:448 +msgid "Jamaica" msgstr "" -#: ../form_detail.php:2009 ../tooltips.php:126 -msgid "Post Fields" +#: includes/fields/class-gf-field-address.php:448 +msgid "Japan" msgstr "" -#: ../form_detail.php:2013 ../tooltips.php:127 -msgid "Pricing Fields" +#: includes/fields/class-gf-field-address.php:448 +msgid "Jordan" msgstr "" -#: ../form_detail.php:2039 ../form_list.php:508 -msgid "Move this form to the trash" +#: includes/fields/class-gf-field-address.php:448 +msgid "Kazakhstan" msgstr "" -#: ../form_detail.php:2039 -msgid "" -"Would you like to move this form to the trash? \\'Cancel\\' to stop. \\'OK" -"\\' to continue" +#: includes/fields/class-gf-field-address.php:448 +msgid "Kenya" msgstr "" -#: ../form_detail.php:2044 -msgid "Update Form" +#: includes/fields/class-gf-field-address.php:448 +msgid "Kiribati" msgstr "" -#: ../form_detail.php:2044 -msgid "Save Form" +#: includes/fields/class-gf-field-address.php:448 +msgid "North Korea" msgstr "" -#: ../form_detail.php:2055 ../gravityforms.php:2340 -msgid "Preview" +#: includes/fields/class-gf-field-address.php:448 +msgid "South Korea" msgstr "" -#: ../form_detail.php:2355 ../forms_model.php:410 -msgid "Admin Notification" +#: includes/fields/class-gf-field-address.php:448 +msgid "Kosovo" msgstr "" -#: ../form_detail.php:2358 -msgid "New submission from" +#: includes/fields/class-gf-field-address.php:448 +msgid "Kuwait" msgstr "" -#: ../form_detail.php:2372 ../forms_model.php:3678 -msgid "Default Confirmation" +#: includes/fields/class-gf-field-address.php:448 +msgid "Kyrgyzstan" msgstr "" -#: ../form_display.php:455 -msgid "Oops! We could not locate your form." +#: includes/fields/class-gf-field-address.php:448 +msgid "Laos" msgstr "" -#: ../form_display.php:472 -msgid "Sorry. You must be logged in to view this form." +#: includes/fields/class-gf-field-address.php:448 +msgid "Latvia" msgstr "" -#: ../form_display.php:578 -msgid "There was a problem with your submission." +#: includes/fields/class-gf-field-address.php:448 +msgid "Lebanon" msgstr "" -#: ../form_display.php:578 -msgid "Errors have been highlighted below." +#: includes/fields/class-gf-field-address.php:448 +msgid "Lesotho" msgstr "" -#: ../form_display.php:609 ../form_display.php:2435 -msgid "Previous Page" +#: includes/fields/class-gf-field-address.php:448 +msgid "Liberia" msgstr "" -#: ../form_display.php:851 -msgid "This field is for validation purposes and should be left unchanged." +#: includes/fields/class-gf-field-address.php:448 +msgid "Libya" msgstr "" -#: ../form_display.php:1164 ../form_display.php:1406 ../form_display.php:1544 -#: ../form_display.php:1560 ../includes/addon/class-gf-addon.php:2169 -msgid "This field is required." +#: includes/fields/class-gf-field-address.php:448 +msgid "Liechtenstein" msgstr "" -#: ../form_display.php:1175 -msgid "This date has already been taken. Please select a new date." +#: includes/fields/class-gf-field-address.php:448 +msgid "Lithuania" msgstr "" -#: ../form_display.php:1179 -msgid "" -"This field requires a unique entry and the values you entered have been " -"already been used." +#: includes/fields/class-gf-field-address.php:448 +msgid "Luxembourg" msgstr "" -#: ../form_display.php:1180 -#, php-format -msgid "This field requires a unique entry and '%s' has already been used" +#: includes/fields/class-gf-field-address.php:448 +msgid "Macedonia" msgstr "" -#: ../form_display.php:1190 -msgid "Please enter a valid value." +#: includes/fields/class-gf-field-address.php:448 +msgid "Madagascar" msgstr "" -#: ../form_display.php:1190 -msgid "Invalid selection. Please select one of the available choices." +#: includes/fields/class-gf-field-address.php:448 +msgid "Malawi" msgstr "" -#: ../form_display.php:1199 -msgid "Your passwords do not match." +#: includes/fields/class-gf-field-address.php:448 +msgid "Malaysia" msgstr "" -#: ../form_display.php:1207 -msgid "" -"Your password does not meet the required strength.
    Hint: To make it " -"stronger, use upper and lower case letters, numbers and symbols like ! \" ? " -"$ % ^ & )." +#: includes/fields/class-gf-field-address.php:448 +msgid "Maldives" msgstr "" -#: ../form_display.php:1219 -msgid "This field is required. Please enter the first and last name." +#: includes/fields/class-gf-field-address.php:448 +msgid "Mali" msgstr "" -#: ../form_display.php:1235 -msgid "This field is required. Please enter a complete address." +#: includes/fields/class-gf-field-address.php:448 +msgid "Malta" msgstr "" -#: ../form_display.php:1248 -msgid "Please enter your credit card information." +#: includes/fields/class-gf-field-address.php:448 +msgid "Marshall Islands" msgstr "" -#: ../form_display.php:1256 -msgid "Please enter your card's security code." +#: includes/fields/class-gf-field-address.php:448 +msgid "Mauritania" msgstr "" -#: ../form_display.php:1260 -msgid "Invalid credit card number." +#: includes/fields/class-gf-field-address.php:448 +msgid "Mauritius" msgstr "" -#: ../form_display.php:1264 -msgid "is not supported. Please enter one of the supported credit cards." +#: includes/fields/class-gf-field-address.php:448 +msgid "Mexico" msgstr "" -#: ../form_display.php:1272 -msgid "Please enter a valid email address." +#: includes/fields/class-gf-field-address.php:448 +msgid "Micronesia" msgstr "" -#: ../form_display.php:1278 -msgid "Your emails do not match." +#: includes/fields/class-gf-field-address.php:448 +msgid "Moldova" msgstr "" -#: ../form_display.php:1292 -msgid "Please enter a valid amount." +#: includes/fields/class-gf-field-address.php:448 +msgid "Monaco" msgstr "" -#: ../form_display.php:1314 -msgid "Please enter a valid quantity. Quantity cannot contain decimals." +#: includes/fields/class-gf-field-address.php:448 +msgid "Mongolia" msgstr "" -#: ../form_display.php:1317 ../form_display.php:1548 -msgid "Please enter a valid quantity" +#: includes/fields/class-gf-field-address.php:448 +msgid "Montenegro" msgstr "" -#: ../form_display.php:1367 -#, php-format -msgid "Please enter a valid date in the format (%s)." +#: includes/fields/class-gf-field-address.php:448 +msgid "Morocco" msgstr "" -#: ../form_display.php:1367 -msgid "Please enter a valid date." +#: includes/fields/class-gf-field-address.php:448 +msgid "Mozambique" msgstr "" -#: ../form_display.php:1397 -msgid "Please enter a valid time." +#: includes/fields/class-gf-field-address.php:448 +msgid "Myanmar" msgstr "" -#: ../form_display.php:1412 -msgid "Please enter a valid Website URL (i.e. http://www.gravityforms.com)." +#: includes/fields/class-gf-field-address.php:448 +msgid "Namibia" msgstr "" -#: ../form_display.php:1425 ../form_display.php:1460 -msgid "The CAPTCHA wasn't entered correctly. Go back and try it again." +#: includes/fields/class-gf-field-address.php:448 +msgid "Nauru" msgstr "" -#: ../form_display.php:1481 -msgid "The reCAPTCHA wasn't entered correctly. Go back and try it again." +#: includes/fields/class-gf-field-address.php:448 +msgid "Nepal" msgstr "" -#: ../form_display.php:1502 ../form_display.php:1513 ../includes/upload.php:72 -#, php-format -msgid "File exceeds size limit. Maximum file size: %dMB" +#: includes/fields/class-gf-field-address.php:448 +msgid "Netherlands" msgstr "" -#: ../form_display.php:1505 -#, php-format -msgid "There was an error while uploading the file. Error code: %d" +#: includes/fields/class-gf-field-address.php:448 +msgid "New Zealand" msgstr "" -#: ../form_display.php:1526 ../includes/upload.php:77 -msgid "The uploaded file type is not allowed." +#: includes/fields/class-gf-field-address.php:449 +msgid "Nicaragua" msgstr "" -#: ../form_display.php:1530 ../includes/upload.php:80 -#, php-format -msgid "The uploaded file type is not allowed. Must be one of the following: %s" +#: includes/fields/class-gf-field-address.php:449 +msgid "Niger" msgstr "" -#: ../form_display.php:2125 -msgid "No results matched" +#: includes/fields/class-gf-field-address.php:449 +msgid "Nigeria" msgstr "" -#: ../form_display.php:2151 ../form_display.php:2708 ../gravityforms.php:1438 -msgid "of" +#: includes/fields/class-gf-field-address.php:449 +msgid "Northern Mariana Islands" msgstr "" -#: ../form_display.php:2151 -msgid "max characters" +#: includes/fields/class-gf-field-address.php:449 +msgid "Norway" msgstr "" -#: ../form_display.php:2194 -msgid "Mismatch" +#: includes/fields/class-gf-field-address.php:449 +msgid "Oman" msgstr "" -#: ../form_display.php:2432 ../js.php:393 -msgid "Next" +#: includes/fields/class-gf-field-address.php:449 +msgid "Pakistan" msgstr "" -#: ../form_display.php:2432 -msgid "Next Page" +#: includes/fields/class-gf-field-address.php:449 +msgid "Palau" msgstr "" -#: ../form_display.php:2538 -msgid "click to duplicate this field" +#: includes/fields/class-gf-field-address.php:449 +msgid "Palestine, State of" msgstr "" -#: ../form_display.php:2541 -msgid "click to delete this field" +#: includes/fields/class-gf-field-address.php:449 +msgid "Panama" msgstr "" -#: ../form_display.php:2544 -msgid "Field ID" +#: includes/fields/class-gf-field-address.php:449 +msgid "Papua New Guinea" msgstr "" -#: ../form_display.php:2544 -msgid "click to expand and edit the options for this field" +#: includes/fields/class-gf-field-address.php:449 +msgid "Paraguay" msgstr "" -#: ../form_display.php:2568 -msgid "end of page" +#: includes/fields/class-gf-field-address.php:449 +msgid "Peru" msgstr "" -#: ../form_display.php:2568 -msgid "PAGE BREAK" +#: includes/fields/class-gf-field-address.php:449 +msgid "Philippines" msgstr "" -#: ../form_display.php:2568 -msgid "top of new page" +#: includes/fields/class-gf-field-address.php:449 +msgid "Poland" msgstr "" -#: ../form_display.php:2622 -msgid "" -"This page is unsecured. Do not enter a real credit card number. Use this " -"field only for testing purposes. " +#: includes/fields/class-gf-field-address.php:449 +msgid "Portugal" msgstr "" -#: ../form_display.php:2708 -msgid "Step" +#: includes/fields/class-gf-field-address.php:449 +msgid "Puerto Rico" msgstr "" -#: ../form_display.php:2735 -msgid "Sorry. This form is no longer accepting new submissions." +#: includes/fields/class-gf-field-address.php:449 +msgid "Qatar" msgstr "" -#: ../form_display.php:2751 -msgid "This form is not yet available." +#: includes/fields/class-gf-field-address.php:449 +msgid "Romania" msgstr "" -#: ../form_display.php:2753 -msgid "Sorry. This form is no longer available." +#: includes/fields/class-gf-field-address.php:449 +msgid "Russia" msgstr "" -#: ../form_list.php:26 -msgid "Form moved to the trash." +#: includes/fields/class-gf-field-address.php:449 +msgid "Rwanda" msgstr "" -#: ../form_list.php:32 -msgid "Form restored." +#: includes/fields/class-gf-field-address.php:449 +msgid "Saint Kitts and Nevis" msgstr "" -#: ../form_list.php:40 -msgid "Form deleted." +#: includes/fields/class-gf-field-address.php:449 +msgid "Saint Lucia" msgstr "" -#: ../form_list.php:42 ../form_list.php:73 -msgid "You don't have adequate permissions to delete forms." +#: includes/fields/class-gf-field-address.php:449 +msgid "Saint Vincent and the Grenadines" msgstr "" -#: ../form_list.php:50 -msgid "Form duplicated." +#: includes/fields/class-gf-field-address.php:449 +msgid "Samoa" msgstr "" -#: ../form_list.php:151 -msgid "Create a New Form" +#: includes/fields/class-gf-field-address.php:449 +msgid "San Marino" msgstr "" -#: ../form_list.php:165 -msgid "Creating Form..." +#: includes/fields/class-gf-field-address.php:449 +msgid "Sao Tome and Principe" msgstr "" -#: ../form_list.php:197 -msgid "Saved! Redirecting..." +#: includes/fields/class-gf-field-address.php:449 +msgid "Saudi Arabia" msgstr "" -#: ../form_list.php:246 ../tooltips.php:34 -msgid "Form Description" +#: includes/fields/class-gf-field-address.php:449 +msgid "Senegal" msgstr "" -#: ../form_list.php:251 -msgid "Create Form" +#: includes/fields/class-gf-field-address.php:449 +msgid "Serbia and Montenegro" msgstr "" -#: ../form_list.php:306 -msgid "Ajax error while updating form" +#: includes/fields/class-gf-field-address.php:449 +msgid "Seychelles" msgstr "" -#: ../form_list.php:320 -msgid "" -"WARNING: You are about to delete these forms and ALL entries associated with " -"them. " +#: includes/fields/class-gf-field-address.php:449 +msgid "Sierra Leone" msgstr "" -#: ../form_list.php:320 ../form_list.php:324 ../form_settings.php:1499 -#: ../includes/addon/class-gf-feed-addon.php:622 ../notification.php:1104 -msgid "\\'Cancel\\' to stop, \\'OK\\' to delete." +#: includes/fields/class-gf-field-address.php:449 +msgid "Singapore" msgstr "" -#: ../form_list.php:322 -msgid "Are you sure you would like to reset the Views for the selected forms? " +#: includes/fields/class-gf-field-address.php:449 +msgid "Slovakia" msgstr "" -#: ../form_list.php:322 -msgid "\\'Cancel\\' to stop, \\'OK\\' to reset." +#: includes/fields/class-gf-field-address.php:449 +msgid "Slovenia" msgstr "" -#: ../form_list.php:324 -msgid "" -"WARNING: You are about to delete ALL entries associated with the selected " -"forms. " +#: includes/fields/class-gf-field-address.php:449 +msgid "Solomon Islands" msgstr "" -#: ../form_list.php:334 ../gravityforms.php:964 ../gravityforms.php:967 -#: ../gravityforms.php:1303 -msgid "Forms" +#: includes/fields/class-gf-field-address.php:449 +msgid "Somalia" msgstr "" -#: ../form_list.php:335 ../form_settings.php:882 -#: ../includes/addon/class-gf-feed-addon.php:394 -#: ../includes/addon/class-gf-feed-addon.php:484 ../notification.php:405 -msgid "Add New" +#: includes/fields/class-gf-field-address.php:449 +msgid "South Africa" msgstr "" -#: ../form_list.php:365 ../form_list.php:485 ../form_list.php:486 -#: ../form_list.php:568 -msgid "Delete permanently" +#: includes/fields/class-gf-field-address.php:449 +msgid "Spain" msgstr "" -#: ../form_list.php:367 ../form_list.php:570 -msgid "Mark as Active" +#: includes/fields/class-gf-field-address.php:449 +msgid "Sri Lanka" msgstr "" -#: ../form_list.php:368 ../form_list.php:571 -msgid "Mark as Inactive" +#: includes/fields/class-gf-field-address.php:449 +msgid "Sudan" msgstr "" -#: ../form_list.php:369 ../form_list.php:572 -msgid "Reset Views" +#: includes/fields/class-gf-field-address.php:449 +msgid "Sudan, South" msgstr "" -#: ../form_list.php:370 ../form_list.php:573 -msgid "Permanently Delete Entries" +#: includes/fields/class-gf-field-address.php:449 +msgid "Suriname" msgstr "" -#: ../form_list.php:371 ../form_list.php:574 -msgid "Move to trash" +#: includes/fields/class-gf-field-address.php:449 +msgid "Swaziland" msgstr "" -#: ../form_list.php:404 ../form_list.php:426 -msgid "Id" +#: includes/fields/class-gf-field-address.php:449 +msgid "Sweden" msgstr "" -#: ../form_list.php:410 ../form_list.php:428 -msgid "Views" +#: includes/fields/class-gf-field-address.php:449 +msgid "Switzerland" msgstr "" -#: ../form_list.php:412 ../form_list.php:430 -msgid "Conversion" +#: includes/fields/class-gf-field-address.php:449 +msgid "Syria" msgstr "" -#: ../form_list.php:488 -msgid "" -"WARNING: You are about to delete this form and ALL entries associated with " -"it. " +#: includes/fields/class-gf-field-address.php:449 +msgid "Taiwan" msgstr "" -#: ../form_list.php:488 -msgid "\\\"Cancel\\\" to stop, \\\"OK\\\" to delete." +#: includes/fields/class-gf-field-address.php:449 +msgid "Tajikistan" msgstr "" -#: ../form_list.php:499 ../form_settings.php:1498 ../notification.php:1103 -msgid "Duplicate" +#: includes/fields/class-gf-field-address.php:449 +msgid "Tanzania" msgstr "" -#: ../form_list.php:500 -msgid "Duplicate this form" +#: includes/fields/class-gf-field-address.php:449 +msgid "Thailand" msgstr "" -#: ../form_list.php:546 -msgid "There are no forms in the trash." +#: includes/fields/class-gf-field-address.php:449 +msgid "Togo" msgstr "" -#: ../form_list.php:548 -#, php-format -msgid "You don't have any forms. Let's go %screate one%s!" +#: includes/fields/class-gf-field-address.php:449 +msgid "Tonga" msgstr "" -#: ../form_list.php:593 ../form_list.php:626 -msgid "There was an issue creating your form." +#: includes/fields/class-gf-field-address.php:449 +msgid "Trinidad and Tobago" msgstr "" -#: ../form_list.php:605 -msgid "Please enter a form title." +#: includes/fields/class-gf-field-address.php:449 +msgid "Tunisia" msgstr "" -#: ../form_list.php:630 -msgid "Please enter a unique form title." +#: includes/fields/class-gf-field-address.php:449 +msgid "Turkey" msgstr "" -#: ../form_settings.php:97 ../form_settings.php:800 ../form_settings.php:1264 -#: ../gravityforms.php:2308 -msgid "Form Settings" +#: includes/fields/class-gf-field-address.php:449 +msgid "Turkmenistan" msgstr "" -#: ../form_settings.php:274 -msgid "" -"The form title you have entered has already been used. Please enter a unique " -"form title." +#: includes/fields/class-gf-field-address.php:449 +msgid "Tuvalu" msgstr "" -#: ../form_settings.php:285 -msgid "Form settings updated successfully." +#: includes/fields/class-gf-field-address.php:449 +msgid "Uganda" msgstr "" -#: ../form_settings.php:317 -msgid "Form title" +#: includes/fields/class-gf-field-address.php:449 +msgid "Ukraine" msgstr "" -#: ../form_settings.php:331 -msgid "Form description" +#: includes/fields/class-gf-field-address.php:449 +msgid "United Arab Emirates" msgstr "" -#: ../form_settings.php:342 -msgid "Top aligned" +#: includes/fields/class-gf-field-address.php:449 +msgid "United Kingdom" msgstr "" -#: ../form_settings.php:343 -msgid "Left aligned" +#: includes/fields/class-gf-field-address.php:450 +msgid "Uruguay" msgstr "" -#: ../form_settings.php:344 -msgid "Right aligned" +#: includes/fields/class-gf-field-address.php:450 +msgid "Uzbekistan" msgstr "" -#: ../form_settings.php:357 -msgid "Label placement" +#: includes/fields/class-gf-field-address.php:450 +msgid "Vanuatu" msgstr "" -#: ../form_settings.php:372 -msgid "Below inputs" +#: includes/fields/class-gf-field-address.php:450 +msgid "Vatican City" msgstr "" -#: ../form_settings.php:373 -msgid "Above inputs" +#: includes/fields/class-gf-field-address.php:450 +msgid "Venezuela" msgstr "" -#: ../form_settings.php:384 -msgid "Description placement" +#: includes/fields/class-gf-field-address.php:450 +msgid "Vietnam" msgstr "" -#: ../form_settings.php:432 -msgid "Input type" +#: includes/fields/class-gf-field-address.php:450 +msgid "Virgin Islands, British" msgstr "" -#: ../form_settings.php:438 ../form_settings.php:1079 -#: ../form_settings.php:1557 -msgid "Text" +#: includes/fields/class-gf-field-address.php:450 +msgid "Virgin Islands, U.S." msgstr "" -#: ../form_settings.php:456 -msgid "Button text" +#: includes/fields/class-gf-field-address.php:450 +msgid "Yemen" msgstr "" -#: ../form_settings.php:470 -msgid "Button image path" +#: includes/fields/class-gf-field-address.php:450 +msgid "Zambia" msgstr "" -#: ../form_settings.php:488 -msgid "Button conditional logic" +#: includes/fields/class-gf-field-address.php:450 +msgid "Zimbabwe" msgstr "" -#: ../form_settings.php:518 -msgid "total entries" +#: includes/fields/class-gf-field-address.php:457 +msgid "AFGHANISTAN" msgstr "" -#: ../form_settings.php:519 -msgid "per day" +#: includes/fields/class-gf-field-address.php:458 +msgid "ALBANIA" msgstr "" -#: ../form_settings.php:520 -msgid "per week" +#: includes/fields/class-gf-field-address.php:459 +msgid "ALGERIA" msgstr "" -#: ../form_settings.php:521 -msgid "per month" +#: includes/fields/class-gf-field-address.php:460 +msgid "AMERICAN SAMOA" msgstr "" -#: ../form_settings.php:522 -msgid "per year" +#: includes/fields/class-gf-field-address.php:461 +msgid "ANDORRA" msgstr "" -#: ../form_settings.php:532 -msgid "Limit number of entries" +#: includes/fields/class-gf-field-address.php:462 +msgid "ANGOLA" msgstr "" -#: ../form_settings.php:536 -msgid "Enable entry limit" +#: includes/fields/class-gf-field-address.php:463 +msgid "ANTIGUA AND BARBUDA" msgstr "" -#: ../form_settings.php:546 -msgid "Number of Entries" +#: includes/fields/class-gf-field-address.php:464 +msgid "ARGENTINA" msgstr "" -#: ../form_settings.php:565 -msgid "Entry Limit Reached Message" +#: includes/fields/class-gf-field-address.php:465 +msgid "ARMENIA" msgstr "" -#: ../form_settings.php:632 ../form_settings.php:636 -msgid "Schedule form" +#: includes/fields/class-gf-field-address.php:466 +msgid "AUSTRALIA" msgstr "" -#: ../form_settings.php:645 -msgid "Schedule Start Date/Time" +#: includes/fields/class-gf-field-address.php:467 +msgid "AUSTRIA" msgstr "" -#: ../form_settings.php:670 -msgid "Schedule Form End Date/Time" +#: includes/fields/class-gf-field-address.php:468 +msgid "AZERBAIJAN" msgstr "" -#: ../form_settings.php:695 -msgid "Form Pending Message" +#: includes/fields/class-gf-field-address.php:469 +msgid "BAHAMAS" msgstr "" -#: ../form_settings.php:708 -msgid "Form Expired Message" +#: includes/fields/class-gf-field-address.php:470 +msgid "BAHRAIN" msgstr "" -#: ../form_settings.php:724 -msgid "Anti-spam honeypot" +#: includes/fields/class-gf-field-address.php:471 +msgid "BANGLADESH" msgstr "" -#: ../form_settings.php:728 -msgid "Enable anti-spam honeypot" +#: includes/fields/class-gf-field-address.php:472 +msgid "BARBADOS" msgstr "" -#: ../form_settings.php:740 -msgid "Animated transitions" +#: includes/fields/class-gf-field-address.php:473 +msgid "BELARUS" msgstr "" -#: ../form_settings.php:744 -msgid "Enable animations" +#: includes/fields/class-gf-field-address.php:474 +msgid "BELGIUM" msgstr "" -#: ../form_settings.php:760 ../form_settings.php:764 ../tooltips.php:96 -msgid "Require user to be logged in" +#: includes/fields/class-gf-field-address.php:475 +msgid "BELIZE" msgstr "" -#: ../form_settings.php:773 ../tooltips.php:97 -msgid "Require Login Message" +#: includes/fields/class-gf-field-address.php:476 +msgid "BENIN" msgstr "" -#: ../form_settings.php:789 -msgid "Form Basics" +#: includes/fields/class-gf-field-address.php:477 +msgid "BERMUDA" msgstr "" -#: ../form_settings.php:790 -msgid "Form Layout" +#: includes/fields/class-gf-field-address.php:478 +msgid "BHUTAN" msgstr "" -#: ../form_settings.php:791 -msgid "Form Button" +#: includes/fields/class-gf-field-address.php:479 +msgid "BOLIVIA" msgstr "" -#: ../form_settings.php:792 -msgid "Restrictions" +#: includes/fields/class-gf-field-address.php:480 +msgid "BOSNIA AND HERZEGOVINA" msgstr "" -#: ../form_settings.php:793 -msgid "Form Options" +#: includes/fields/class-gf-field-address.php:481 +msgid "BOTSWANA" msgstr "" -#: ../form_settings.php:849 -msgid "Update Form Settings" +#: includes/fields/class-gf-field-address.php:482 +msgid "BRAZIL" msgstr "" -#: ../form_settings.php:877 ../form_settings.php:882 ../form_settings.php:970 -#: ../form_settings.php:1265 -msgid "Confirmations" +#: includes/fields/class-gf-field-address.php:483 +msgid "BRUNEI" msgstr "" -#: ../form_settings.php:908 -msgid "Ajax error while updating confirmation" +#: includes/fields/class-gf-field-address.php:484 +msgid "BULGARIA" msgstr "" -#: ../form_settings.php:989 -msgid "" -"Ensure that the conditional logic for this confirmation is different from " -"all the other confirmations for this form and then press save to create the " -"new confirmation." +#: includes/fields/class-gf-field-address.php:485 +msgid "BURKINA FASO" msgstr "" -#: ../form_settings.php:1025 -msgid "Save Confirmation" +#: includes/fields/class-gf-field-address.php:486 +msgid "BURUNDI" msgstr "" -#: ../form_settings.php:1068 -msgid "Confirmation Name" +#: includes/fields/class-gf-field-address.php:487 +msgid "CAMBODIA" msgstr "" -#: ../form_settings.php:1075 -msgid "Confirmation Type" +#: includes/fields/class-gf-field-address.php:488 +msgid "CAMEROON" msgstr "" -#: ../form_settings.php:1085 ../form_settings.php:1117 -#: ../form_settings.php:1560 ../js.php:84 -msgid "Page" +#: includes/fields/class-gf-field-address.php:489 +msgid "CANADA" msgstr "" -#: ../form_settings.php:1091 ../form_settings.php:1563 -msgid "Redirect" +#: includes/fields/class-gf-field-address.php:490 +msgid "CAPE VERDE" msgstr "" -#: ../form_settings.php:1101 ../notification.php:771 -msgid "Message" +#: includes/fields/class-gf-field-address.php:491 +msgid "CAYMAN ISLANDS" msgstr "" -#: ../form_settings.php:1106 -msgid "Disable Auto-formatting" +#: includes/fields/class-gf-field-address.php:492 +msgid "CENTRAL AFRICAN REPUBLIC" msgstr "" -#: ../form_settings.php:1119 -msgid "Select a page" +#: includes/fields/class-gf-field-address.php:493 +msgid "CHAD" msgstr "" -#: ../form_settings.php:1127 ../form_settings.php:1153 -msgid "Redirect Query String" +#: includes/fields/class-gf-field-address.php:494 +msgid "CHILE" msgstr "" -#: ../form_settings.php:1129 ../form_settings.php:1155 -msgid "Pass Field Data Via Query String" +#: includes/fields/class-gf-field-address.php:495 +msgid "CHINA" msgstr "" -#: ../form_settings.php:1132 ../form_settings.php:1158 -msgid "Sample: phone={Phone:1}&email={Email:2}" +#: includes/fields/class-gf-field-address.php:496 +msgid "COLOMBIA" msgstr "" -#: ../form_settings.php:1142 -msgid "Redirect URL" +#: includes/fields/class-gf-field-address.php:497 +msgid "COMOROS" msgstr "" -#: ../form_settings.php:1304 -msgid "You must specify a Confirmation Name." +#: includes/fields/class-gf-field-address.php:498 +msgid "CONGO, DEMOCRATIC REPUBLIC OF THE" msgstr "" -#: ../form_settings.php:1311 -msgid "You must select a Confirmation Page." +#: includes/fields/class-gf-field-address.php:499 +msgid "CONGO, REPUBLIC OF THE" msgstr "" -#: ../form_settings.php:1317 -msgid "You must specify a Redirect URL." +#: includes/fields/class-gf-field-address.php:500 +msgid "COSTA RICA" msgstr "" -#: ../form_settings.php:1338 -#, php-format -msgid "Confirmation saved successfully. %sBack to confirmations.%s" +#: includes/fields/class-gf-field-address.php:501 +msgid "C&OCIRC;TE D'IVOIRE" msgstr "" -#: ../form_settings.php:1358 -msgid "Confirmation deleted." +#: includes/fields/class-gf-field-address.php:502 +msgid "CROATIA" msgstr "" -#: ../form_settings.php:1497 ../notification.php:1102 -msgid "Edit this item" +#: includes/fields/class-gf-field-address.php:503 +msgid "CUBA" msgstr "" -#: ../form_settings.php:1498 -msgid "Duplicate this confirmation" +#: includes/fields/class-gf-field-address.php:504 +msgid "CYPRUS" msgstr "" -#: ../form_settings.php:1499 -msgid "Delete this item" +#: includes/fields/class-gf-field-address.php:505 +msgid "CZECH REPUBLIC" msgstr "" -#: ../form_settings.php:1499 -msgid "WARNING: You are about to delete this confirmation." +#: includes/fields/class-gf-field-address.php:506 +msgid "DENMARK" msgstr "" -#: ../form_settings.php:1540 -msgid "This page does not exist." +#: includes/fields/class-gf-field-address.php:507 +msgid "DJIBOUTI" msgstr "" -#: ../forms_model.php:435 -msgid "User Notification" +#: includes/fields/class-gf-field-address.php:508 +msgid "DOMINICA" msgstr "" -#: ../forms_model.php:517 ../forms_model.php:529 -msgid "Notification not found" +#: includes/fields/class-gf-field-address.php:509 +msgid "DOMINICAN REPUBLIC" msgstr "" -#: ../forms_model.php:767 -msgid "You don't have adequate permission to create forms." +#: includes/fields/class-gf-field-address.php:510 +msgid "EAST TIMOR" msgstr "" -#: ../forms_model.php:1109 -msgid "You don't have adequate permission to delete notes." +#: includes/fields/class-gf-field-address.php:511 +msgid "ECUADOR" msgstr "" -#: ../forms_model.php:1148 -msgid "You don't have adequate permission to edit entries." +#: includes/fields/class-gf-field-address.php:512 +msgid "EGYPT" msgstr "" -#: ../gravityforms.php:962 -msgid "Update Available" +#: includes/fields/class-gf-field-address.php:513 +msgid "EL SALVADOR" msgstr "" -#: ../gravityforms.php:978 ../gravityforms.php:1243 ../gravityforms.php:2308 -#: ../includes/addon/class-gf-addon.php:2616 -#: ../includes/addon/class-gf-addon.php:2822 -#: ../includes/addon/class-gf-addon.php:2975 -#: ../includes/addon/class-gf-addon.php:3146 ../settings.php:423 -msgid "Settings" +#: includes/fields/class-gf-field-address.php:514 +msgid "EQUATORIAL GUINEA" msgstr "" -#: ../gravityforms.php:980 -msgid "Import/Export" +#: includes/fields/class-gf-field-address.php:515 +msgid "ERITREA" msgstr "" -#: ../gravityforms.php:983 -msgid "Updates" +#: includes/fields/class-gf-field-address.php:516 +msgid "ESTONIA" msgstr "" -#: ../gravityforms.php:984 ../help.php:48 -msgid "Add-Ons" +#: includes/fields/class-gf-field-address.php:517 +msgid "ETHIOPIA" msgstr "" -#: ../gravityforms.php:1048 -#, php-format -msgid "%1$s ‹ %2$s — WordPress" +#: includes/fields/class-gf-field-address.php:518 +msgid "FIJI" msgstr "" -#: ../gravityforms.php:1152 ../gravityforms.php:1167 -msgid "Add Gravity Form" +#: includes/fields/class-gf-field-address.php:519 +msgid "FINLAND" msgstr "" -#: ../gravityforms.php:1167 -msgid "Add Form" +#: includes/fields/class-gf-field-address.php:520 +msgid "FRANCE" msgstr "" -#: ../gravityforms.php:1179 -msgid "Please select a form" +#: includes/fields/class-gf-field-address.php:521 +msgid "GABON" msgstr "" -#: ../gravityforms.php:1199 -msgid "Insert A Form" +#: includes/fields/class-gf-field-address.php:522 +msgid "GAMBIA" msgstr "" -#: ../gravityforms.php:1201 -msgid "Select a form below to add it to your post or page." +#: includes/fields/class-gf-field-address.php:524 +msgid "GERMANY" msgstr "" -#: ../gravityforms.php:1206 ../widget.php:79 -msgid "Select a Form" +#: includes/fields/class-gf-field-address.php:525 +msgid "GHANA" msgstr "" -#: ../gravityforms.php:1216 -msgid "Can't find your form? Make sure it is active." +#: includes/fields/class-gf-field-address.php:526 +msgid "GREECE" msgstr "" -#: ../gravityforms.php:1219 ../widget.php:93 -msgid "Display form title" +#: includes/fields/class-gf-field-address.php:527 +msgid "GREENLAND" msgstr "" -#: ../gravityforms.php:1220 ../widget.php:94 -msgid "Display form description" +#: includes/fields/class-gf-field-address.php:528 +msgid "GRENADA" msgstr "" -#: ../gravityforms.php:1221 ../widget.php:100 -msgid "Enable AJAX" +#: includes/fields/class-gf-field-address.php:529 +msgid "GUAM" msgstr "" -#: ../gravityforms.php:1224 -msgid "Insert Form" +#: includes/fields/class-gf-field-address.php:530 +msgid "GUATEMALA" msgstr "" -#: ../gravityforms.php:1257 ../update.php:33 -msgid "There is a new version of Gravity Forms available." +#: includes/fields/class-gf-field-address.php:531 +msgid "GUINEA" msgstr "" -#: ../gravityforms.php:1257 ../includes/addon/class-gf-auto-upgrade.php:59 -#: ../includes/addon/class-gf-auto-upgrade.php:143 -#, php-format -msgid "View version %s Details" +#: includes/fields/class-gf-field-address.php:532 +msgid "GUINEA-BISSAU" msgstr "" -#: ../gravityforms.php:1259 -msgid "Please try again or contact us." +#: includes/fields/class-gf-field-address.php:534 +msgid "HAITI" msgstr "" -#: ../gravityforms.php:1330 ../gravityforms.php:1333 -msgid "View All Entries" +#: includes/fields/class-gf-field-address.php:535 +msgid "HONDURAS" msgstr "" -#: ../gravityforms.php:1332 -#, php-format -msgid "Last Entry: %s" +#: includes/fields/class-gf-field-address.php:536 +msgid "HONG KONG" msgstr "" -#: ../gravityforms.php:1344 -msgid "View All Forms" +#: includes/fields/class-gf-field-address.php:537 +msgid "HUNGARY" msgstr "" -#: ../gravityforms.php:1352 -#, php-format -msgid "You don't have any forms. Let's go %s create one %s!" +#: includes/fields/class-gf-field-address.php:538 +msgid "ICELAND" msgstr "" -#: ../gravityforms.php:1382 -#, php-format -msgid "There is an update available for Gravity Forms. %sView Details%s %s" +#: includes/fields/class-gf-field-address.php:539 +msgid "INDIA" msgstr "" -#: ../gravityforms.php:1385 -msgid "Dismiss" +#: includes/fields/class-gf-field-address.php:540 +msgid "INDONESIA" msgstr "" -#: ../gravityforms.php:1435 -msgid "Next >" +#: includes/fields/class-gf-field-address.php:541 +msgid "IRAN" msgstr "" -#: ../gravityforms.php:1436 -msgid "< Prev" +#: includes/fields/class-gf-field-address.php:542 +msgid "IRAQ" msgstr "" -#: ../gravityforms.php:1439 -msgid "Close" +#: includes/fields/class-gf-field-address.php:543 +msgid "IRELAND" msgstr "" -#: ../gravityforms.php:1440 -msgid "" -"This feature requires inline frames. You have iframes disabled or your " -"browser does not support them." +#: includes/fields/class-gf-field-address.php:544 +msgid "ISRAEL" msgstr "" -#: ../gravityforms.php:1721 -msgid "Add-On browser is currently unavailable. Please try again later." +#: includes/fields/class-gf-field-address.php:545 +msgid "ITALY" msgstr "" -#: ../gravityforms.php:1896 -msgid "There was an error while resending the notifications." +#: includes/fields/class-gf-field-address.php:546 +msgid "JAMAICA" msgstr "" -#: ../gravityforms.php:1902 -msgid "" -"No notifications have been selected. Please select a notification to be sent." +#: includes/fields/class-gf-field-address.php:547 +msgid "JAPAN" msgstr "" -#: ../gravityforms.php:1905 -msgid "The Send To email address provided is not valid." +#: includes/fields/class-gf-field-address.php:548 +msgid "JORDAN" msgstr "" -#: ../gravityforms.php:2195 -msgid "Switch Form" +#: includes/fields/class-gf-field-address.php:549 +msgid "KAZAKHSTAN" msgstr "" -#: ../gravityforms.php:2295 -msgid "Edit this form" +#: includes/fields/class-gf-field-address.php:550 +msgid "KENYA" msgstr "" -#: ../gravityforms.php:2310 -msgid "Edit settings for this form" +#: includes/fields/class-gf-field-address.php:551 +msgid "KIRIBATI" msgstr "" -#: ../gravityforms.php:2327 -msgid "View entries generated by this form" +#: includes/fields/class-gf-field-address.php:552 +msgid "NORTH KOREA" msgstr "" -#: ../help.php:17 -msgid "Gravity Forms Help" +#: includes/fields/class-gf-field-address.php:553 +msgid "SOUTH KOREA" msgstr "" -#: ../help.php:22 -msgid "" -"IMPORTANT NOTICE: We do not provide support via e-mail. " -"Please open a " -"support ticket." +#: includes/fields/class-gf-field-address.php:554 +msgid "KOSOVO" msgstr "" -#: ../help.php:24 -msgid "" -"Please review the plugin documentation and frequently asked questions (FAQ) first. " -"If you still can't find the answer open a support ticket and we will be happy to " -"answer your questions and assist you with any problems. Please note:" -" If you have not purchased a license from us, you won't have access to " -"these help resources." +#: includes/fields/class-gf-field-address.php:555 +msgid "KUWAIT" msgstr "" -#: ../help.php:29 -msgid "Gravity Forms Documentation" +#: includes/fields/class-gf-field-address.php:556 +msgid "KYRGYZSTAN" msgstr "" -#: ../help.php:38 -msgid "Documentation (please select a topic)" +#: includes/fields/class-gf-field-address.php:557 +msgid "LAOS" msgstr "" -#: ../help.php:40 -msgid "Getting Started" +#: includes/fields/class-gf-field-address.php:558 +msgid "LATVIA" msgstr "" -#: ../help.php:42 -msgid "Using Gravity Forms" +#: includes/fields/class-gf-field-address.php:559 +msgid "LEBANON" msgstr "" -#: ../help.php:44 -msgid "Design and Layout" +#: includes/fields/class-gf-field-address.php:560 +msgid "LESOTHO" msgstr "" -#: ../help.php:46 -msgid "Developer Docs" +#: includes/fields/class-gf-field-address.php:561 +msgid "LIBERIA" msgstr "" -#: ../help.php:50 -msgid "How To" +#: includes/fields/class-gf-field-address.php:562 +msgid "LIBYA" msgstr "" -#: ../help.php:55 ../help.php:82 ../help.php:109 -msgid "GO" +#: includes/fields/class-gf-field-address.php:563 +msgid "LIECHTENSTEIN" msgstr "" -#: ../help.php:64 -msgid "Gravity Forms FAQ" +#: includes/fields/class-gf-field-address.php:564 +msgid "LITHUANIA" msgstr "" -#: ../help.php:72 -msgid "FAQ (please select a topic)" +#: includes/fields/class-gf-field-address.php:565 +msgid "LUXEMBOURG" msgstr "" -#: ../help.php:73 -msgid "Installation Questions" +#: includes/fields/class-gf-field-address.php:566 +msgid "MACEDONIA" msgstr "" -#: ../help.php:74 -msgid "Formatting/Styling Questions" +#: includes/fields/class-gf-field-address.php:567 +msgid "MADAGASCAR" msgstr "" -#: ../help.php:75 -msgid "Notification Questions" +#: includes/fields/class-gf-field-address.php:568 +msgid "MALAWI" msgstr "" -#: ../help.php:76 -msgid "General Questions" +#: includes/fields/class-gf-field-address.php:569 +msgid "MALAYSIA" msgstr "" -#: ../help.php:92 -msgid "Gravity Forms Downloads" +#: includes/fields/class-gf-field-address.php:570 +msgid "MALDIVES" msgstr "" -#: ../help.php:93 -msgid "" -"Please Note: Only licensed Gravity Forms customers are " -"granted access to the downloads section." +#: includes/fields/class-gf-field-address.php:571 +msgid "MALI" msgstr "" -#: ../help.php:101 -msgid "Downloads (please select a product)" +#: includes/fields/class-gf-field-address.php:572 +msgid "MALTA" msgstr "" -#: ../help.php:102 -msgid "Gravity Forms" +#: includes/fields/class-gf-field-address.php:573 +msgid "MARSHALL ISLANDS" msgstr "" -#: ../help.php:103 -msgid "Gravity Forms Add-Ons" +#: includes/fields/class-gf-field-address.php:574 +msgid "MAURITANIA" msgstr "" -#: ../help.php:120 -msgid "Gravity Forms Tutorials & Resources" +#: includes/fields/class-gf-field-address.php:575 +msgid "MAURITIUS" msgstr "" -#: ../help.php:121 -msgid "" -"Please note: The Gravity Forms support team does not " -"provide support for third party scripts, widgets, etc." +#: includes/fields/class-gf-field-address.php:576 +msgid "MEXICO" msgstr "" -#: ../includes/addon/class-gf-addon.php:996 -#, php-format -msgid "Field type '%s' has not been implemented" +#: includes/fields/class-gf-field-address.php:577 +msgid "MICRONESIA" msgstr "" -#: ../includes/addon/class-gf-addon.php:1237 -msgid "Settings updated" +#: includes/fields/class-gf-field-address.php:578 +msgid "MOLDOVA" msgstr "" -#: ../includes/addon/class-gf-addon.php:1242 -msgid "There was an error while saving your settings" +#: includes/fields/class-gf-field-address.php:579 +msgid "MONACO" msgstr "" -#: ../includes/addon/class-gf-addon.php:1587 -#: ../includes/addon/class-gf-addon.php:1729 -msgid "Form Field" +#: includes/fields/class-gf-field-address.php:580 +msgid "MONGOLIA" msgstr "" -#: ../includes/addon/class-gf-addon.php:1627 -msgid "Field" +#: includes/fields/class-gf-field-address.php:581 +msgid "MONTENEGRO" msgstr "" -#: ../includes/addon/class-gf-addon.php:1656 -#: ../includes/addon/class-gf-addon.php:1660 -#: ../includes/addon/class-gf-addon.php:1805 -#: ../includes/addon/class-gf-addon.php:1809 -msgid "Full" +#: includes/fields/class-gf-field-address.php:582 +msgid "MOROCCO" msgstr "" -#: ../includes/addon/class-gf-addon.php:1664 -#: ../includes/addon/class-gf-addon.php:1813 -msgid "Selected" +#: includes/fields/class-gf-field-address.php:583 +msgid "MOZAMBIQUE" msgstr "" -#: ../includes/addon/class-gf-addon.php:1714 -msgid "Add Custom" +#: includes/fields/class-gf-field-address.php:584 +msgid "MYANMAR" msgstr "" -#: ../includes/addon/class-gf-addon.php:1850 -msgid "Update Settings" +#: includes/fields/class-gf-field-address.php:585 +msgid "NAMIBIA" msgstr "" -#: ../includes/addon/class-gf-addon.php:2200 ../settings.php:165 -msgid "Validation Error" +#: includes/fields/class-gf-field-address.php:586 +msgid "NAURU" msgstr "" -#: ../includes/addon/class-gf-addon.php:2741 -#: ../includes/addon/class-gf-addon.php:2747 -msgid "You don't have adequate permissions to view this page" +#: includes/fields/class-gf-field-address.php:587 +msgid "NEPAL" msgstr "" -#: ../includes/addon/class-gf-addon.php:2876 -#, php-format -msgid "%s Settings" +#: includes/fields/class-gf-field-address.php:588 +msgid "NETHERLANDS" msgstr "" -#: ../includes/addon/class-gf-addon.php:2980 ../settings.php:440 -msgid "Uninstall" +#: includes/fields/class-gf-field-address.php:589 +msgid "NEW ZEALAND" msgstr "" -#: ../includes/addon/class-gf-addon.php:3006 -#: ../includes/addon/class-gf-addon.php:3012 -msgid "Uninstall %" +#: includes/fields/class-gf-field-address.php:590 +msgid "NICARAGUA" msgstr "" -#: ../includes/addon/class-gf-addon.php:3009 ../settings.php:93 -msgid "Warning" +#: includes/fields/class-gf-field-address.php:591 +msgid "NIGER" msgstr "" -#: ../includes/addon/class-gf-addon.php:3010 -msgid "Warning! This operation deletes ALL settings and data." +#: includes/fields/class-gf-field-address.php:592 +msgid "NIGERIA" msgstr "" -#: ../includes/addon/class-gf-addon.php:3012 -#: ../includes/addon/class-gf-addon.php:3276 -msgid "" -"Warning! ALL settings will be deleted. This cannot be undone. \\'OK\\' to " -"delete, \\'Cancel\\' to stop" +#: includes/fields/class-gf-field-address.php:593 +msgid "NORTHERN MARIANA ISLANDS" msgstr "" -#: ../includes/addon/class-gf-addon.php:3273 -msgid "Uninstall Add-On" +#: includes/fields/class-gf-field-address.php:594 +msgid "NORWAY" msgstr "" -#: ../includes/addon/class-gf-addon.php:3274 -msgid "Warning! This operation deletes ALL settings." +#: includes/fields/class-gf-field-address.php:595 +msgid "OMAN" msgstr "" -#: ../includes/addon/class-gf-addon.php:3276 -msgid "Uninstall Add-On" +#: includes/fields/class-gf-field-address.php:596 +msgid "PAKISTAN" msgstr "" -#: ../includes/addon/class-gf-addon.php:3311 -msgid "You don't have adequate permission to uninstall this addon: " +#: includes/fields/class-gf-field-address.php:597 +msgid "PALAU" msgstr "" -#: ../includes/addon/class-gf-addon.php:3395 -#: ../includes/addon/class-gf-auto-upgrade.php:52 -msgid "Gravity Forms " +#: includes/fields/class-gf-field-address.php:598 +msgid "PALESTINE, STATE OF" msgstr "" -#: ../includes/addon/class-gf-auto-upgrade.php:60 -#, php-format -msgid "" -"%sRegister%s your copy of Gravity Forms to receive access to automatic " -"upgrades and support. Need a license key? %sPurchase one now%s." +#: includes/fields/class-gf-field-address.php:599 +msgid "PANAMA" msgstr "" -#: ../includes/addon/class-gf-auto-upgrade.php:163 -#, php-format -msgid "Oops!! Something went wrong.%sPlease try again or %scontact us%s." +#: includes/fields/class-gf-field-address.php:600 +msgid "PAPUA NEW GUINEA" msgstr "" -#: ../includes/addon/class-gf-feed-addon.php:399 -#: ../includes/addon/class-gf-feed-addon.php:484 -#, php-format -msgid "%s Feeds" +#: includes/fields/class-gf-field-address.php:601 +msgid "PARAGUAY" msgstr "" -#: ../includes/addon/class-gf-feed-addon.php:428 -msgid "Feed Settings" +#: includes/fields/class-gf-field-address.php:602 +msgid "PERU" msgstr "" -#: ../includes/addon/class-gf-feed-addon.php:528 -msgid "Feed updated successfully." +#: includes/fields/class-gf-field-address.php:603 +msgid "PHILIPPINES" msgstr "" -#: ../includes/addon/class-gf-feed-addon.php:533 -msgid "" -"There was an error updating this feed. Please review all errors below and " -"try again." +#: includes/fields/class-gf-field-address.php:604 +msgid "POLAND" msgstr "" -#: ../includes/addon/class-gf-feed-addon.php:621 -msgid "Edit this feed" +#: includes/fields/class-gf-field-address.php:605 +msgid "PORTUGAL" msgstr "" -#: ../includes/addon/class-gf-feed-addon.php:622 -msgid "Delete this feed" +#: includes/fields/class-gf-field-address.php:606 +msgid "PUERTO RICO" msgstr "" -#: ../includes/addon/class-gf-feed-addon.php:622 -msgid "WARNING: You are about to delete this item." +#: includes/fields/class-gf-field-address.php:607 +msgid "QATAR" msgstr "" -#: ../includes/addon/class-gf-feed-addon.php:637 -#, php-format -msgid "You don't have any feeds configured. Let's go %screate one%s!" +#: includes/fields/class-gf-field-address.php:608 +msgid "ROMANIA" msgstr "" -#: ../includes/addon/class-gf-feed-addon.php:684 -msgid "Enable Condition" +#: includes/fields/class-gf-field-address.php:609 +msgid "RUSSIA" msgstr "" -#: ../includes/addon/class-gf-feed-addon.php:710 -msgid "Process this feed if" +#: includes/fields/class-gf-field-address.php:610 +msgid "RWANDA" msgstr "" -#: ../includes/addon/class-gf-feed-addon.php:781 -msgid "Process " +#: includes/fields/class-gf-field-address.php:611 +msgid "SAINT KITTS AND NEVIS" msgstr "" -#: ../includes/addon/class-gf-feed-addon.php:938 -msgid "Checkbox" +#: includes/fields/class-gf-field-address.php:612 +msgid "SAINT LUCIA" msgstr "" -#: ../includes/addon/class-gf-feed-addon.php:951 -msgid "feed" +#: includes/fields/class-gf-field-address.php:613 +msgid "SAINT VINCENT AND THE GRENADINES" msgstr "" -#: ../includes/addon/class-gf-feed-addon.php:952 -msgid "feeds" +#: includes/fields/class-gf-field-address.php:614 +msgid "SAMOA" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:400 -#, php-format -msgid "Payment failed to be captured. Reason: %s" +#: includes/fields/class-gf-field-address.php:615 +msgid "SAN MARINO" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:416 -msgid "Initial payment" +#: includes/fields/class-gf-field-address.php:616 +msgid "SAO TOME AND PRINCIPE" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:423 -#, php-format -msgid "%s has been captured successfully. Amount: %s. Transaction Id: %s" +#: includes/fields/class-gf-field-address.php:617 +msgid "SAUDI ARABIA" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:429 -#, php-format -msgid "Failed to capture %s. Reason: %s." +#: includes/fields/class-gf-field-address.php:618 +msgid "SENEGAL" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:444 -#, php-format -msgid "Subscription failed to be created. Reason: %s" +#: includes/fields/class-gf-field-address.php:619 +msgid "SERBIA AND MONTENEGRO" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:610 -msgid "options: " +#: includes/fields/class-gf-field-address.php:620 +msgid "SEYCHELLES" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:731 -#, php-format -msgid "This webhook has already been processed (Event Id: %s)" +#: includes/fields/class-gf-field-address.php:621 +msgid "SIERRA LEONE" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:822 -#, php-format -msgid "Payment is pending. Amount: %s. Transaction Id: %s." +#: includes/fields/class-gf-field-address.php:622 +msgid "SINGAPORE" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:858 -#, php-format -msgid "Payment has been completed. Amount: %s. Transaction Id: %s." +#: includes/fields/class-gf-field-address.php:623 +msgid "SLOVAKIA" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:883 -#, php-format -msgid "Payment has been refunded. Amount: %s. Transaction Id: %s." +#: includes/fields/class-gf-field-address.php:624 +msgid "SLOVENIA" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:902 -#, php-format -msgid "Payment has failed. Amount: %s." +#: includes/fields/class-gf-field-address.php:625 +msgid "SOLOMON ISLANDS" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:917 -#, php-format -msgid "Authorization has been voided. Transaction Id: %s" +#: includes/fields/class-gf-field-address.php:626 +msgid "SOMALIA" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:947 -#, php-format -msgid "Subscription has been created. Subscription Id: %s." +#: includes/fields/class-gf-field-address.php:627 +msgid "SOUTH AFRICA" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:969 -#, php-format -msgid "Subscription has been paid. Amount: %s. Subscription Id: %s" +#: includes/fields/class-gf-field-address.php:628 +msgid "SPAIN" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:986 -#, php-format -msgid "Subscription payment has failed. Amount: %s. Subscription Id: %s." +#: includes/fields/class-gf-field-address.php:629 +msgid "SRI LANKA" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:1002 -#, php-format -msgid "Subscription has been cancelled. Subscription Id: %s." +#: includes/fields/class-gf-field-address.php:630 +msgid "SUDAN" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:1021 -#, php-format -msgid "Subscription has expired. Subscriber Id: %s" +#: includes/fields/class-gf-field-address.php:631 +msgid "SUDAN, SOUTH" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:1077 -#: ../includes/addon/class-gf-payment-addon.php:1145 -#: ../includes/addon/class-gf-payment-addon.php:1153 -msgid "Transaction Type" +#: includes/fields/class-gf-field-address.php:632 +msgid "SURINAME" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:1085 -#: ../includes/addon/class-gf-payment-addon.php:1151 -msgid "Subscription" +#: includes/fields/class-gf-field-address.php:633 +msgid "SWAZILAND" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:1088 -#: ../includes/addon/class-gf-payment-addon.php:1150 -msgid "Products and Services" +#: includes/fields/class-gf-field-address.php:634 +msgid "SWEDEN" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:1091 -msgid "Donations" +#: includes/fields/class-gf-field-address.php:635 +msgid "SWITZERLAND" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:1095 -msgid "Unsupported transaction type" +#: includes/fields/class-gf-field-address.php:636 +msgid "SYRIA" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:1102 -#: ../includes/addon/class-gf-payment-addon.php:1393 -#: ../includes/addon/class-gf-payment-addon.php:1401 -msgid "Form Total" +#: includes/fields/class-gf-field-address.php:637 +msgid "TAIWAN" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:1124 -#, php-format -msgid "" -"You must add a Credit Card field to your form before creating a feed. Let's " -"go %sadd one%s!" +#: includes/fields/class-gf-field-address.php:638 +msgid "TAJIKISTAN" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:1141 -msgid "Enter a feed name to uniquely identify this setup." +#: includes/fields/class-gf-field-address.php:639 +msgid "TANZANIA" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:1149 -#: ../includes/addon/class-gf-payment-addon.php:1153 -msgid "Select a transaction type" +#: includes/fields/class-gf-field-address.php:640 +msgid "THAILAND" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:1171 -msgid "" -"Select which field determines the recurring payment amount, or select 'Form " -"Total' to use the total of all pricing fields as the recurring amount." +#: includes/fields/class-gf-field-address.php:641 +msgid "TOGO" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:1175 -#: ../includes/addon/class-gf-payment-addon.php:1177 -msgid "Billing Cycle" +#: includes/fields/class-gf-field-address.php:642 +msgid "TONGA" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:1177 -msgid "" -"Select your billing cycle. This determines how often the recurring payment " -"should occur." +#: includes/fields/class-gf-field-address.php:643 +msgid "TRINIDAD AND TOBAGO" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:1181 -#: ../includes/addon/class-gf-payment-addon.php:1184 -msgid "Recurring Times" +#: includes/fields/class-gf-field-address.php:644 +msgid "TUNISIA" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:1184 -msgid "" -"Select how many times the recurring payment should be made. The default is " -"to bill the customer until the subscription is canceled." +#: includes/fields/class-gf-field-address.php:645 +msgid "TURKEY" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:1188 -msgid "Setup Fee" +#: includes/fields/class-gf-field-address.php:646 +msgid "TURKMENISTAN" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:1193 -msgid "Trial" +#: includes/fields/class-gf-field-address.php:647 +msgid "TUVALU" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:1196 -msgid "Trial Period" +#: includes/fields/class-gf-field-address.php:648 +msgid "UGANDA" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:1196 -msgid "" -"Enable a trial period. The users recurring payment will not begin until " -"after this trial period." +#: includes/fields/class-gf-field-address.php:649 +msgid "UKRAINE" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:1215 -msgid "" -"Select which field determines the payment amount, or select 'Form Total' to " -"use the total of all pricing fields as the payment amount." +#: includes/fields/class-gf-field-address.php:650 +msgid "UNITED ARAB EMIRATES" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:1221 -msgid "Other Settings" +#: includes/fields/class-gf-field-address.php:651 +msgid "UNITED KINGDOM" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:1236 -#: ../includes/addon/class-gf-payment-addon.php:1239 -msgid "Billing Information" +#: includes/fields/class-gf-field-address.php:652 +msgid "UNITED STATES" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:1239 -msgid "Map your Form Fields to the available listed fields." +#: includes/fields/class-gf-field-address.php:653 +msgid "URUGUAY" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:1247 -msgid "Options" +#: includes/fields/class-gf-field-address.php:654 +msgid "UZBEKISTAN" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:1257 -msgid "" -"When conditions are enabled, form submissions will only be sent to the " -"payment gateway when the conditions are met. When disabled, all form " -"submissions will be sent to the payment gateway." +#: includes/fields/class-gf-field-address.php:655 +msgid "VANUATU" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:1309 -#: ../includes/addon/class-gf-payment-addon.php:1351 -#: ../includes/webapi/webapi.php:190 -msgid "Enabled" +#: includes/fields/class-gf-field-address.php:656 +msgid "VATICAN CITY" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:1362 -msgid "Enter an amount" +#: includes/fields/class-gf-field-address.php:657 +msgid "VENEZUELA" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:1409 -msgid "Sample Option" +#: includes/fields/class-gf-field-address.php:658 +msgid "VIRGIN ISLANDS, BRITISH" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:1420 -msgid "Address 2" +#: includes/fields/class-gf-field-address.php:659 +msgid "VIRGIN ISLANDS, U.S." msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:1423 -msgid "Zip" +#: includes/fields/class-gf-field-address.php:660 +msgid "VIETNAM" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:1441 -msgid "day(s)" +#: includes/fields/class-gf-field-address.php:661 +msgid "YEMEN" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:1442 -msgid "week(s)" +#: includes/fields/class-gf-field-address.php:662 +msgid "ZAMBIA" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:1443 -msgid "month(s)" +#: includes/fields/class-gf-field-address.php:663 +msgid "ZIMBABWE" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:1444 -msgid "year(s)" +#: includes/fields/class-gf-field-address.php:672 +#: includes/fields/class-gf-field-address.php:693 +msgid "Alabama" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:1453 -msgid "Select a product field" +#: includes/fields/class-gf-field-address.php:672 +#: includes/fields/class-gf-field-address.php:694 +msgid "Alaska" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:1469 -msgctxt "toolbar label" -msgid "Sales" +#: includes/fields/class-gf-field-address.php:672 +#: includes/fields/class-gf-field-address.php:695 +msgid "Arizona" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:1470 -msgctxt "metabox title" -msgid "Filter" +#: includes/fields/class-gf-field-address.php:672 +#: includes/fields/class-gf-field-address.php:696 +msgid "Arkansas" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:1497 -msgid "Today" +#: includes/fields/class-gf-field-address.php:673 +#: includes/fields/class-gf-field-address.php:697 +msgid "California" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:1498 -msgid "Yesterday" +#: includes/fields/class-gf-field-address.php:673 +#: includes/fields/class-gf-field-address.php:698 +msgid "Colorado" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:1499 -msgid "Last 30 Days" +#: includes/fields/class-gf-field-address.php:673 +#: includes/fields/class-gf-field-address.php:699 +msgid "Connecticut" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:1506 -#: ../includes/addon/class-gf-payment-addon.php:1513 -#: ../includes/addon/class-gf-payment-addon.php:1521 -#: ../includes/addon/class-gf-payment-addon.php:1528 -msgid "subscriptions" +#: includes/fields/class-gf-field-address.php:673 +#: includes/fields/class-gf-field-address.php:700 +msgid "Delaware" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:1507 -#: ../includes/addon/class-gf-payment-addon.php:1514 -#: ../includes/addon/class-gf-payment-addon.php:1522 -#: ../includes/addon/class-gf-payment-addon.php:1529 -msgid "orders" +#: includes/fields/class-gf-field-address.php:674 +#: includes/fields/class-gf-field-address.php:701 +msgid "District of Columbia" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:1537 -msgid "There aren't any transactions that match your criteria." +#: includes/fields/class-gf-field-address.php:674 +#: includes/fields/class-gf-field-address.php:702 +msgid "Florida" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:1639 -#: ../includes/addon/class-gf-payment-addon.php:1640 -msgid "Revenue" +#: includes/fields/class-gf-field-address.php:675 +#: includes/fields/class-gf-field-address.php:704 +msgid "Hawaii" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:1640 -msgid "Orders" +#: includes/fields/class-gf-field-address.php:675 +#: includes/fields/class-gf-field-address.php:705 +msgid "Idaho" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:1640 -msgid "Subscriptions" +#: includes/fields/class-gf-field-address.php:675 +#: includes/fields/class-gf-field-address.php:706 +msgid "Illinois" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:1640 -msgid "Recurring Payments" +#: includes/fields/class-gf-field-address.php:675 +#: includes/fields/class-gf-field-address.php:707 +msgid "Indiana" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:1640 -msgid "Refunds" +#: includes/fields/class-gf-field-address.php:676 +#: includes/fields/class-gf-field-address.php:708 +msgid "Iowa" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:1659 -#: ../includes/addon/class-gf-payment-addon.php:1660 -msgid "Week" +#: includes/fields/class-gf-field-address.php:676 +#: includes/fields/class-gf-field-address.php:709 +msgid "Kansas" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:1759 -msgid "Jan" +#: includes/fields/class-gf-field-address.php:676 +#: includes/fields/class-gf-field-address.php:710 +msgid "Kentucky" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:1759 -msgid "Feb" +#: includes/fields/class-gf-field-address.php:676 +#: includes/fields/class-gf-field-address.php:711 +msgid "Louisiana" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:1759 -msgid "Mar" +#: includes/fields/class-gf-field-address.php:677 +#: includes/fields/class-gf-field-address.php:712 +msgid "Maine" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:1759 -msgid "Apr" +#: includes/fields/class-gf-field-address.php:677 +#: includes/fields/class-gf-field-address.php:713 +msgid "Maryland" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:1759 -msgid "Jun" +#: includes/fields/class-gf-field-address.php:677 +#: includes/fields/class-gf-field-address.php:714 +msgid "Massachusetts" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:1759 -msgid "Jul" +#: includes/fields/class-gf-field-address.php:677 +#: includes/fields/class-gf-field-address.php:715 +msgid "Michigan" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:1759 -msgid "Aug" +#: includes/fields/class-gf-field-address.php:678 +#: includes/fields/class-gf-field-address.php:716 +msgid "Minnesota" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:1759 -msgid "Sep" +#: includes/fields/class-gf-field-address.php:678 +#: includes/fields/class-gf-field-address.php:717 +msgid "Mississippi" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:1759 -msgid "Oct" +#: includes/fields/class-gf-field-address.php:678 +#: includes/fields/class-gf-field-address.php:718 +msgid "Missouri" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:1759 -msgid "Nov" +#: includes/fields/class-gf-field-address.php:678 +#: includes/fields/class-gf-field-address.php:719 +msgid "Montana" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:1759 -msgid "Dec" +#: includes/fields/class-gf-field-address.php:679 +#: includes/fields/class-gf-field-address.php:720 +msgid "Nebraska" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:1858 -msgid "Daily" +#: includes/fields/class-gf-field-address.php:679 +#: includes/fields/class-gf-field-address.php:721 +msgid "Nevada" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:1859 -msgid "Weekly" +#: includes/fields/class-gf-field-address.php:679 +#: includes/fields/class-gf-field-address.php:722 +msgid "New Hampshire" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:1860 -msgid "Monthly" +#: includes/fields/class-gf-field-address.php:679 +#: includes/fields/class-gf-field-address.php:723 +msgid "New Jersey" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:1863 -msgid "
    View
    Select how you would like the sales data to be displayed." +#: includes/fields/class-gf-field-address.php:680 +#: includes/fields/class-gf-field-address.php:724 +msgid "New Mexico" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:1870 -msgctxt "regarding a payment method" -msgid "Any" +#: includes/fields/class-gf-field-address.php:680 +#: includes/fields/class-gf-field-address.php:725 +msgid "New York" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:1879 -msgid "Payment Method" +#: includes/fields/class-gf-field-address.php:680 +#: includes/fields/class-gf-field-address.php:726 +msgid "North Carolina" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:1933 -msgid "" -"Warning! This subscription will be canceled. This cannot be undone. 'OK' to " -"cancel subscription, 'Cancel' to stop" +#: includes/fields/class-gf-field-address.php:681 +#: includes/fields/class-gf-field-address.php:727 +msgid "North Dakota" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:1935 -msgid "Canceled" +#: includes/fields/class-gf-field-address.php:681 +#: includes/fields/class-gf-field-address.php:728 +msgid "Ohio" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:1936 -msgid "The subscription could not be canceled. Please try again later." +#: includes/fields/class-gf-field-address.php:681 +#: includes/fields/class-gf-field-address.php:729 +msgid "Oklahoma" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:1978 -msgid "Cancel Subscription" +#: includes/fields/class-gf-field-address.php:681 +#: includes/fields/class-gf-field-address.php:730 +msgid "Oregon" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:2098 -msgid "sale" +#: includes/fields/class-gf-field-address.php:682 +#: includes/fields/class-gf-field-address.php:731 +msgid "Pennsylvania" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:2099 -msgid "sales" +#: includes/fields/class-gf-field-address.php:682 +#: includes/fields/class-gf-field-address.php:732 +msgid "Rhode Island" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:2112 -msgid "There hasn't been any sales in the specified date range." +#: includes/fields/class-gf-field-address.php:682 +#: includes/fields/class-gf-field-address.php:733 +msgid "South Carolina" msgstr "" -#: ../includes/addon/class-gf-payment-addon.php:2156 -#, php-format -msgctxt "paging" -msgid "%1$s of %2$s" +#: includes/fields/class-gf-field-address.php:683 +#: includes/fields/class-gf-field-address.php:734 +msgid "South Dakota" msgstr "" -#: ../includes/addon/class-gf-results.php:21 -msgid "Results Filters" +#: includes/fields/class-gf-field-address.php:683 +#: includes/fields/class-gf-field-address.php:735 +msgid "Tennessee" msgstr "" -#: ../includes/addon/class-gf-results.php:81 -msgid "" -"Error retrieving results. If the problem persists, please contact support." +#: includes/fields/class-gf-field-address.php:683 +#: includes/fields/class-gf-field-address.php:736 +msgid "Texas" msgstr "" -#: ../includes/addon/class-gf-results.php:127 -#: ../includes/addon/class-gf-results.php:158 -msgid "View results generated by this form" +#: includes/fields/class-gf-field-address.php:683 +#: includes/fields/class-gf-field-address.php:737 +msgid "Utah" msgstr "" -#: ../includes/addon/class-gf-results.php:150 -#: ../includes/addon/class-gf-results.php:156 -msgid "Results" +#: includes/fields/class-gf-field-address.php:684 +#: includes/fields/class-gf-field-address.php:738 +msgid "Vermont" msgstr "" -#: ../includes/addon/class-gf-results.php:255 -#: ../includes/addon/class-gf-results.php:348 -msgid "Filters" +#: includes/fields/class-gf-field-address.php:684 +#: includes/fields/class-gf-field-address.php:739 +msgid "Virginia" msgstr "" -#: ../includes/addon/class-gf-results.php:264 -#: ../includes/addon/class-gf-results.php:347 -msgid "Date Range" +#: includes/fields/class-gf-field-address.php:684 +#: includes/fields/class-gf-field-address.php:740 +msgid "Washington" msgstr "" -#: ../includes/addon/class-gf-results.php:305 -msgid "Apply filters" +#: includes/fields/class-gf-field-address.php:684 +#: includes/fields/class-gf-field-address.php:741 +msgid "West Virginia" msgstr "" -#: ../includes/addon/class-gf-results.php:307 -msgid "Clear" +#: includes/fields/class-gf-field-address.php:685 +#: includes/fields/class-gf-field-address.php:742 +msgid "Wisconsin" msgstr "" -#: ../includes/addon/class-gf-results.php:336 -msgid "This form does not have any fields that can be used for results" +#: includes/fields/class-gf-field-address.php:685 +#: includes/fields/class-gf-field-address.php:743 +msgid "Wyoming" msgstr "" -#: ../includes/addon/class-gf-results.php:345 -#: ../includes/addon/class-gf-results.php:615 -msgid "Total Score" +#: includes/fields/class-gf-field-address.php:685 +#: includes/fields/class-gf-field-address.php:744 +msgid "Armed Forces Americas" msgstr "" -#: ../includes/addon/class-gf-results.php:345 -msgid "" -"Scores are weighted calculations. Items ranked higher are given a greater " -"score than items that are ranked lower. The total score for each item is the " -"sum of the weighted scores." +#: includes/fields/class-gf-field-address.php:686 +#: includes/fields/class-gf-field-address.php:745 +msgid "Armed Forces Europe" msgstr "" -#: ../includes/addon/class-gf-results.php:346 -#: ../includes/addon/class-gf-results.php:618 -msgid "Aggregate Rank" +#: includes/fields/class-gf-field-address.php:686 +#: includes/fields/class-gf-field-address.php:746 +msgid "Armed Forces Pacific" msgstr "" -#: ../includes/addon/class-gf-results.php:346 -msgid "" -"The aggregate rank is the overall rank for all entries based on the weighted " -"scores for each item." +#: includes/fields/class-gf-field-address.php:756 +msgid "Alberta" msgstr "" -#: ../includes/addon/class-gf-results.php:347 -msgid "" -"Date Range is optional, if no date range is specified it will be ignored." +#: includes/fields/class-gf-field-address.php:756 +msgid "British Columbia" +msgstr "" + +#: includes/fields/class-gf-field-address.php:756 +msgid "Manitoba" +msgstr "" + +#: includes/fields/class-gf-field-address.php:756 +msgid "New Brunswick" +msgstr "" + +#: includes/fields/class-gf-field-address.php:756 +msgid "Newfoundland & Labrador" msgstr "" -#: ../includes/addon/class-gf-results.php:348 +#: includes/fields/class-gf-field-address.php:756 +msgid "Northwest Territories" +msgstr "" + +#: includes/fields/class-gf-field-address.php:756 +msgid "Nova Scotia" +msgstr "" + +#: includes/fields/class-gf-field-address.php:756 +msgid "Nunavut" +msgstr "" + +#: includes/fields/class-gf-field-address.php:756 +msgid "Ontario" +msgstr "" + +#: includes/fields/class-gf-field-address.php:756 +msgid "Prince Edward Island" +msgstr "" + +#: includes/fields/class-gf-field-address.php:756 +msgid "Quebec" +msgstr "" + +#: includes/fields/class-gf-field-address.php:756 +msgid "Saskatchewan" +msgstr "" + +#: includes/fields/class-gf-field-address.php:756 +msgid "Yukon" +msgstr "" + +#: includes/fields/class-gf-field-calculation.php:35 +#: includes/fields/class-gf-field-hiddenproduct.php:31 +#: includes/fields/class-gf-field-number.php:78 +#: includes/fields/class-gf-field-singleproduct.php:37 +msgid "Please enter a valid quantity" +msgstr "" + +#: includes/fields/class-gf-field-calculation.php:66 +#: includes/fields/class-gf-field-singleproduct.php:71 +msgid "Quantity:" +msgstr "" + +#: includes/fields/class-gf-field-calculation.php:98 +#: includes/fields/class-gf-field-singleproduct.php:103 +msgid "Qty: " +msgstr "" + +#: includes/fields/class-gf-field-calculation.php:98 +#: includes/fields/class-gf-field-singleproduct.php:103 +msgid "Price: " +msgstr "" + +#: includes/fields/class-gf-field-captcha.php:13 +msgid "CAPTCHA" +msgstr "" + +#: includes/fields/class-gf-field-captcha.php:42 +#: includes/fields/class-gf-field-captcha.php:79 +msgid "The CAPTCHA wasn't entered correctly. Go back and try it again." +msgstr "" + +#: includes/fields/class-gf-field-captcha.php:102 +msgid "The reCAPTCHA wasn't entered correctly. Go back and try it again." +msgstr "" + +#: includes/fields/class-gf-field-captcha.php:153 +msgid "To use the reCaptcha field you must first do the following:" +msgstr "" + +#: includes/fields/class-gf-field-captcha.php:153 +msgid "Sign up%s for a free reCAPTCHA account" +msgstr "" + +#: includes/fields/class-gf-field-captcha.php:153 +msgid "Enter your reCAPTCHA keys in the %ssettings page%s" +msgstr "" + +#: includes/fields/class-gf-field-checkbox.php:255 +#: includes/fields/class-gf-field-radio.php:145 +msgid "%d of %d items shown. Edit field to view all" +msgstr "" + +#: includes/fields/class-gf-field-creditcard.php:13 js.php:620 +msgid "Credit Card" +msgstr "" + +#: includes/fields/class-gf-field-creditcard.php:47 +msgid "Please enter your credit card information." +msgstr "" + +#: includes/fields/class-gf-field-creditcard.php:53 +msgid "Please enter your card's security code." +msgstr "" + +#: includes/fields/class-gf-field-creditcard.php:56 +msgid "Invalid credit card number." +msgstr "" + +#: includes/fields/class-gf-field-creditcard.php:59 +msgid "is not supported. Please enter one of the supported credit cards." +msgstr "" + +#: includes/fields/class-gf-field-creditcard.php:175 +#: includes/fields/class-gf-field-creditcard.php:238 +msgid "Only digits are allowed" +msgstr "" + +#: includes/fields/class-gf-field-creditcard.php:176 js.php:623 +msgid "Card Number" +msgstr "" + +#: includes/fields/class-gf-field-creditcard.php:203 js.php:625 js.php:921 +msgid "Expiration Date" +msgstr "" + +#: includes/fields/class-gf-field-creditcard.php:236 js.php:627 +msgid "Security Code" +msgstr "" + +#: includes/fields/class-gf-field-creditcard.php:258 js.php:629 js.php:925 +msgid "Cardholder Name" +msgstr "" + +#: includes/fields/class-gf-field-creditcard.php:294 +#: includes/fields/class-gf-field-date.php:456 js.php:870 js.php:871 +msgid "Year" +msgstr "" + +#: includes/fields/class-gf-field-date.php:72 +msgid "Please enter a valid date in the format (%s)." +msgstr "" + +#: includes/fields/class-gf-field-date.php:72 +msgid "Please enter a valid date." +msgstr "" + +#: includes/fields/class-gf-field-date.php:133 +#: includes/fields/class-gf-field-time.php:135 js.php:861 js.php:885 +msgid "MM" +msgstr "" + +#: includes/fields/class-gf-field-date.php:134 js.php:862 +msgid "DD" +msgstr "" + +#: includes/fields/class-gf-field-date.php:135 js.php:863 +msgid "YYYY" +msgstr "" + +#: includes/fields/class-gf-field-donation.php:45 +#: includes/fields/class-gf-field-price.php:37 +msgid "Please enter a valid amount." +msgstr "" + +#: includes/fields/class-gf-field-email.php:50 +msgid "Your emails do not match." +msgstr "" + +#: includes/fields/class-gf-field-email.php:87 js.php:899 notification.php:605 +msgid "Enter Email" +msgstr "" + +#: includes/fields/class-gf-field-email.php:89 js.php:900 +msgid "Confirm Email" +msgstr "" + +#: includes/fields/class-gf-field-fileupload.php:48 +#: includes/fields/class-gf-field-fileupload.php:58 includes/upload.php:101 +msgid "File exceeds size limit. Maximum file size: %dMB" +msgstr "" + +#: includes/fields/class-gf-field-fileupload.php:51 +msgid "There was an error while uploading the file. Error code: %d" +msgstr "" + +#: includes/fields/class-gf-field-fileupload.php:71 includes/upload.php:106 +msgid "The uploaded file type is not allowed." +msgstr "" + +#: includes/fields/class-gf-field-fileupload.php:74 includes/upload.php:109 +msgid "The uploaded file type is not allowed. Must be one of the following: %s" +msgstr "" + +#: includes/fields/class-gf-field-fileupload.php:140 +#: includes/fields/class-gf-field-fileupload.php:159 +msgid "Allowed Files" +msgstr "" + +#: includes/fields/class-gf-field-fileupload.php:171 +msgid "Drop files here or" +msgstr "" + +#: includes/fields/class-gf-field-fileupload.php:172 +msgid "Select files" +msgstr "" + +#: includes/fields/class-gf-field-fileupload.php:211 +msgid "Download file" +msgstr "" + +#: includes/fields/class-gf-field-fileupload.php:212 +msgid "Delete file" +msgstr "" + +#: includes/fields/class-gf-field-fileupload.php:361 +msgid "%d files" +msgstr "" + +#: includes/fields/class-gf-field-fileupload.php:373 +#: includes/fields/class-gf-field-fileupload.php:390 +#: includes/fields/class-gf-field-post-image.php:106 +#: includes/fields/class-gf-field-post-image.php:130 +msgid "Click to view" +msgstr "" + +#: includes/fields/class-gf-field-html.php:12 +msgid "HTML" +msgstr "" + +#: includes/fields/class-gf-field-html.php:31 +msgid "HTML Content" +msgstr "" + +#: includes/fields/class-gf-field-html.php:32 msgid "" -"Narrow the results by adding filters. Note that some field types support " -"more options than others." +"This is a content placeholder. HTML content is not displayed in the form " +"admin. Preview this form to view the content." +msgstr "" + +#: includes/fields/class-gf-field-list.php:128 +msgid "Add another row" +msgstr "" + +#: includes/fields/class-gf-field-list.php:128 +msgid "Add a row" +msgstr "" + +#: includes/fields/class-gf-field-list.php:129 +msgid "Remove this row" +msgstr "" + +#: includes/fields/class-gf-field-multiselect.php:55 +msgid "Click to select..." +msgstr "" + +#: includes/fields/class-gf-field-name.php:23 +msgid "This field is required. Please enter the first and last name." +msgstr "" + +#: includes/fields/class-gf-field-name.php:105 js.php:836 +msgid "Prefix" +msgstr "" + +#: includes/fields/class-gf-field-name.php:106 +#: includes/fields/class-gf-field-name.php:227 js.php:840 +msgid "First" +msgstr "" + +#: includes/fields/class-gf-field-name.php:107 js.php:841 +msgid "Middle" +msgstr "" + +#: includes/fields/class-gf-field-name.php:108 +#: includes/fields/class-gf-field-name.php:228 js.php:844 +msgid "Last" msgstr "" -#: ../includes/addon/class-gf-results.php:364 -msgid "No results." +#: includes/fields/class-gf-field-name.php:109 js.php:845 +msgid "Suffix" msgstr "" -#: ../includes/addon/class-gf-results.php:386 -msgid "" -"There was an error while processing the entries. Please contact support." +#: includes/fields/class-gf-field-number.php:75 +msgid "Please enter a valid quantity. Quantity cannot contain decimals." msgstr "" -#: ../includes/addon/class-gf-results.php:400 -#, php-format -msgid "Entries processed: %1$d of %2$d" +#: includes/fields/class-gf-field-number.php:112 +msgid "Please enter a value between %s and %s." msgstr "" -#: ../includes/addon/class-gf-results.php:418 -msgid "No results" +#: includes/fields/class-gf-field-number.php:114 +msgid "Please enter a value greater than or equal to %s." msgstr "" -#: ../includes/addon/class-gf-results.php:470 -#: ../includes/addon/class-gf-results.php:484 -msgid "No entries for this field" +#: includes/fields/class-gf-field-number.php:116 +msgid "Please enter a value less than or equal to %s." msgstr "" -#: ../includes/addon/class-gf-results.php:491 -msgid "Choice" +#: includes/fields/class-gf-field-number.php:118 +msgid "Please enter a valid number" msgstr "" -#: ../includes/addon/class-gf-results.php:491 -#: ../includes/addon/class-gf-results.php:520 -msgid "Frequency" +#: includes/fields/class-gf-field-option.php:29 js.php:766 +msgid "Option" msgstr "" -#: ../includes/addon/class-gf-results.php:601 -msgid "Average score: " +#: includes/fields/class-gf-field-page.php:27 +msgid "end of page" msgstr "" -#: ../includes/addon/class-gf-results.php:612 -msgid "Item" +#: includes/fields/class-gf-field-page.php:27 +msgid "PAGE BREAK" msgstr "" -#: ../includes/addon/class-gf-results.php:646 -msgid "Latest values:" +#: includes/fields/class-gf-field-page.php:27 +msgid "top of new page" msgstr "" -#: ../includes/api.php:105 -#, php-format -msgid "Form with id: %s not found" +#: includes/fields/class-gf-field-password.php:14 js.php:674 +msgid "Password" msgstr "" -#: ../includes/api.php:149 ../includes/api.php:274 -msgid "Invalid form object" +#: includes/fields/class-gf-field-password.php:48 +msgid "Your passwords do not match." msgstr "" -#: ../includes/api.php:165 ../includes/webapi/webapi.php:679 -msgid "Missing form id" +#: includes/fields/class-gf-field-password.php:55 +msgid "" +"Your password does not meet the required strength.
    Hint: To make it " +"stronger, use upper and lower case letters, numbers and symbols like ! \" ? " +"$ % ^ & )." msgstr "" -#: ../includes/api.php:169 -msgid "Error updating form" +#: includes/fields/class-gf-field-password.php:106 js.php:909 +msgid "Enter Password" msgstr "" -#: ../includes/api.php:175 -msgid "Error updating title" +#: includes/fields/class-gf-field-password.php:109 js.php:910 +msgid "Confirm Password" msgstr "" -#: ../includes/api.php:247 -msgid "Invalid form objects" +#: includes/fields/class-gf-field-phone.php:64 js.php:1195 +msgid "Phone format:" msgstr "" -#: ../includes/api.php:277 -msgid "The form title is missing" +#: includes/fields/class-gf-field-post-content.php:12 +msgid "Body" msgstr "" -#: ../includes/api.php:311 -msgid "There was a problem while inserting the form" +#: includes/fields/class-gf-field-post-custom-field.php:12 +msgid "Custom Field" msgstr "" -#: ../includes/api.php:441 -#, php-format -msgid "Entry with id %s not found" +#: includes/fields/class-gf-field-post-excerpt.php:12 +msgid "Excerpt" msgstr "" -#: ../includes/api.php:514 -msgid "Missing entry id" +#: includes/fields/class-gf-field-post-image.php:13 js.php:711 +msgid "Post Image" msgstr "" -#: ../includes/api.php:519 -msgid "Entry not found" +#: includes/fields/class-gf-field-post-image.php:64 +msgid "delete" msgstr "" -#: ../includes/api.php:531 ../includes/api.php:684 -msgid "The form for this entry does not exist" +#: includes/fields/class-gf-field-post-image.php:68 js.php:679 +msgid "File" msgstr "" -#: ../includes/api.php:586 -msgid "There was a problem while updating the entry properties" +#: includes/fields/class-gf-field-post-tags.php:12 +msgid "Tags" msgstr "" -#: ../includes/api.php:606 -msgid "" -"There was a problem while updating one of the input values for the entry" +#: includes/fields/class-gf-field-quantity.php:29 js.php:737 js.php:807 +msgid "Quantity" msgstr "" -#: ../includes/api.php:616 ../includes/api.php:648 -msgid "There was a problem while updating the field values" +#: includes/fields/class-gf-field-section.php:12 +msgid "Section" msgstr "" -#: ../includes/api.php:674 -msgid "The entry object must be an array" +#: includes/fields/class-gf-field-shipping.php:26 js.php:749 +msgid "Shipping" msgstr "" -#: ../includes/api.php:680 -msgid "The form id must be specified" +#: includes/fields/class-gf-field-text.php:13 +msgid "Single Line Text" msgstr "" -#: ../includes/api.php:719 -msgid "There was a problem while inserting the entry properties" +#: includes/fields/class-gf-field-time.php:60 +msgid "Please enter a valid time." msgstr "" -#: ../includes/api.php:737 -msgid "" -"There was a problem while inserting one of the input values for the entry" +#: includes/fields/class-gf-field-time.php:115 +msgid "AM" msgstr "" -#: ../includes/api.php:745 -msgid "There was a problem while inserting the field values" +#: includes/fields/class-gf-field-time.php:116 +msgid "PM" msgstr "" -#: ../includes/api.php:776 -#, php-format -msgid "Invalid entry id: %s" +#: includes/fields/class-gf-field-time.php:134 js.php:884 +msgid "HH" msgstr "" -#: ../includes/api.php:840 -msgid "Feed not found" +#: includes/fields/class-gf-field-website.php:50 +msgid "Please enter a valid Website URL (i.e. http://www.gravityforms.com)." msgstr "" -#: ../includes/api.php:870 -#, php-format -msgid "There was an an error while deleting feed id %s" +#: includes/fields/class-gf-field.php:222 +msgid "click to duplicate this field" msgstr "" -#: ../includes/api.php:873 ../includes/api.php:894 -#, php-format -msgid "Feed id %s not found" +#: includes/fields/class-gf-field.php:225 +msgid "click to delete this field" msgstr "" -#: ../includes/api.php:891 -#, php-format -msgid "There was an an error while updating feed id %s" +#: includes/fields/class-gf-field.php:233 +msgid "Field ID" msgstr "" -#: ../includes/api.php:922 -msgid "There was an an error while inserting a feed" +#: includes/fields/class-gf-field.php:233 +msgid "click to expand and edit the options for this field" msgstr "" -#: ../includes/locking/class-gf-locking.php:196 -#, php-format +#: includes/locking/class-gf-locking.php:196 msgid "" "This page is currently locked. Click on the \"Request Control\" button to " "let %s know you'd like to take over." msgstr "" -#: ../includes/locking/class-gf-locking.php:197 +#: includes/locking/class-gf-locking.php:197 msgid "Accept" msgstr "" -#: ../includes/locking/class-gf-locking.php:199 -#, php-format +#: includes/locking/class-gf-locking.php:199 msgid "%s is currently editing" msgstr "" -#: ../includes/locking/class-gf-locking.php:200 -#, php-format +#: includes/locking/class-gf-locking.php:200 msgid "%s has taken over and is currently editing." msgstr "" -#: ../includes/locking/class-gf-locking.php:201 -#, php-format +#: includes/locking/class-gf-locking.php:201 msgid "%s has requested permission to take over control." msgstr "" -#: ../includes/locking/class-gf-locking.php:202 -#: ../includes/locking/class-gf-locking.php:275 +#: includes/locking/class-gf-locking.php:202 +#: includes/locking/class-gf-locking.php:282 msgid "You now have control" msgstr "" -#: ../includes/locking/class-gf-locking.php:203 +#: includes/locking/class-gf-locking.php:203 msgid "Pending" msgstr "" -#: ../includes/locking/class-gf-locking.php:204 +#: includes/locking/class-gf-locking.php:204 msgid "No response" msgstr "" -#: ../includes/locking/class-gf-locking.php:205 +#: includes/locking/class-gf-locking.php:205 msgid "Request again" msgstr "" -#: ../includes/locking/class-gf-locking.php:206 -msgid "Error" -msgstr "" - -#: ../includes/locking/class-gf-locking.php:207 +#: includes/locking/class-gf-locking.php:207 msgid "Your request was rejected" msgstr "" -#: ../includes/locking/class-gf-locking.php:280 -#, php-format +#: includes/locking/class-gf-locking.php:287 msgid "Your request has been sent to %s." msgstr "" -#: ../includes/locking/class-gf-locking.php:475 +#: includes/locking/class-gf-locking.php:487 msgid "Take Over" msgstr "" -#: ../includes/locking/class-gf-locking.php:476 +#: includes/locking/class-gf-locking.php:488 msgid "Request Control" msgstr "" -#: ../includes/locking/class-gf-locking.php:493 +#: includes/locking/class-gf-locking.php:505 msgid "Reject Request" msgstr "" -#: ../includes/locking/locking.php:20 -#, php-format +#: includes/locking/locking.php:20 msgid "" "This form is currently locked. Click on the \"Request Control\" button to " "let %s know you'd like to take over." msgstr "" -#: ../includes/locking/locking.php:24 -#, php-format +#: includes/locking/locking.php:24 msgid "%s has requested permission to take over control of this form." msgstr "" -#: ../includes/locking/locking.php:59 -#, php-format +#: includes/locking/locking.php:59 msgid "" "This entry is currently locked. Click on the \"Request Control\" button to " "let %s know you'd like to take over." msgstr "" -#: ../includes/locking/locking.php:62 -#, php-format +#: includes/locking/locking.php:62 msgid "%s has requested permission to take over control of this entry." msgstr "" -#: ../includes/locking/locking.php:102 -#, php-format +#: includes/locking/locking.php:103 msgid "" "These form settings are currently locked. Click on the \"Request Control\" " "button to let %s know you'd like to take over." msgstr "" -#: ../includes/locking/locking.php:105 ../includes/locking/locking.php:142 -#, php-format +#: includes/locking/locking.php:106 includes/locking/locking.php:146 msgid "%s has requested permission to take over control of these settings." msgstr "" -#: ../includes/locking/locking.php:139 -#, php-format +#: includes/locking/locking.php:143 msgid "" -"These settings are currently locked. Click on the \"Request Control\" button " -"to let %s know you'd like to take over." +"These settings are currently locked. Click on the \"Request Control\" " +"button to let %s know you'd like to take over." +msgstr "" + +#: includes/templates/edit-shortcode-form.tpl.php:5 +msgid "Insert A Form" +msgstr "" + +#: includes/templates/edit-shortcode-form.tpl.php:14 +msgid "Advanced Options" +msgstr "" + +#: includes/templates/edit-shortcode-form.tpl.php:21 +msgid "Insert Form" msgstr "" -#: ../includes/upload.php:32 +#: includes/upload.php:37 includes/upload.php:53 msgid "Failed to upload file." msgstr "" -#: ../includes/upload.php:102 +#: includes/upload.php:133 msgid "Failed to open temp directory." msgstr "" -#: ../includes/upload.php:126 ../includes/upload.php:151 +#: includes/upload.php:160 includes/upload.php:184 msgid "Failed to open input stream." msgstr "" -#: ../includes/upload.php:133 ../includes/upload.php:157 +#: includes/upload.php:167 includes/upload.php:190 msgid "Failed to open output stream." msgstr "" -#: ../includes/upload.php:137 +#: includes/upload.php:170 msgid "Failed to move uploaded file." msgstr "" -#: ../includes/upload.php:172 +#: includes/upload.php:204 msgid "Upload unsuccessful:" msgstr "" -#: ../includes/webapi/webapi.php:89 ../includes/webapi/webapi.php:150 +#: includes/webapi/webapi.php:146 msgid "Gravity Forms API Settings" msgstr "" -#: ../includes/webapi/webapi.php:167 ../includes/webapi/webapi.php:182 +#: includes/webapi/webapi.php:163 includes/webapi/webapi.php:178 msgid "" "The Gravity Forms API allows developers to interact with this install via a " "JSON REST API." msgstr "" -#: ../includes/webapi/webapi.php:171 +#: includes/webapi/webapi.php:167 msgid "Requirements check" msgstr "" -#: ../includes/webapi/webapi.php:186 +#: includes/webapi/webapi.php:182 msgid "Enable access to the API" msgstr "" -#: ../includes/webapi/webapi.php:195 +#: includes/webapi/webapi.php:191 msgid "Public API Key" msgstr "" -#: ../includes/webapi/webapi.php:203 +#: includes/webapi/webapi.php:199 msgid "Private API Key" msgstr "" -#: ../includes/webapi/webapi.php:211 +#: includes/webapi/webapi.php:207 msgid "QR Code" msgstr "" -#: ../includes/webapi/webapi.php:217 +#: includes/webapi/webapi.php:213 msgid "Impersonate account" msgstr "" -#: ../includes/webapi/webapi.php:223 +#: includes/webapi/webapi.php:219 msgid "Developer tools" msgstr "" -#: ../includes/webapi/webapi.php:240 +#: includes/webapi/webapi.php:236 msgid "Show/hide QR Code" msgstr "" -#: ../includes/webapi/webapi.php:256 +#: includes/webapi/webapi.php:252 msgid "Open developer tools" msgstr "" -#: ../includes/webapi/webapi.php:632 -#, php-format +#: includes/webapi/webapi.php:644 msgid "Feeds deleted successfully: %d" msgstr "" -#: ../includes/webapi/webapi.php:663 -#, php-format +#: includes/webapi/webapi.php:676 msgid "Feeds updated: %d" msgstr "" -#: ../includes/webapi/webapi.php:723 -#, php-format +#: includes/webapi/webapi.php:738 msgid "Forms deleted successfully: %d" msgstr "" -#: ../includes/webapi/webapi.php:758 +#: includes/webapi/webapi.php:773 msgid "Entries updated successfully" msgstr "" -#: ../includes/webapi/webapi.php:758 +#: includes/webapi/webapi.php:773 msgid "Entry updated successfully" msgstr "" -#: ../includes/webapi/webapi.php:779 ../includes/webapi/webapi.php:802 +#: includes/webapi/webapi.php:794 includes/webapi/webapi.php:817 msgid "Success" msgstr "" -#: ../includes/webapi/webapi.php:808 +#: includes/webapi/webapi.php:822 msgid "No property values were found in the request body" msgstr "" -#: ../includes/webapi/webapi.php:810 +#: includes/webapi/webapi.php:824 msgid "Property values should be sent as an array" msgstr "" -#: ../includes/webapi/webapi.php:849 +#: includes/webapi/webapi.php:864 msgid "Forms updated successfully" msgstr "" -#: ../includes/webapi/webapi.php:849 +#: includes/webapi/webapi.php:864 msgid "Form updated successfully" msgstr "" -#: ../includes/webapi/webapi.php:877 -#, php-format +#: includes/webapi/webapi.php:893 msgid "Entries deleted successfully: %d" msgstr "" -#: ../includes/webapi/webapi.php:1425 +#: includes/webapi/webapi.php:1460 msgid "Not authorized" msgstr "" -#: ../includes/webapi/webapi.php:1429 +#: includes/webapi/webapi.php:1464 msgid "Permission denied" msgstr "" -#: ../includes/webapi/webapi.php:1433 +#: includes/webapi/webapi.php:1468 msgid "Bad request" msgstr "" -#: ../includes/webapi/webapi.php:1437 +#: includes/webapi/webapi.php:1472 msgid "Not found" msgstr "" -#: ../includes/webapi/webapi.php:1441 +#: includes/webapi/webapi.php:1476 msgid "Not implemented" msgstr "" -#: ../includes/webapi/webapi.php:1445 +#: includes/webapi/webapi.php:1480 msgid "Internal Error" msgstr "" -#: ../js.php:12 +#: js.php:12 msgid "Delete this custom choice list? 'OK' to delete, 'Cancel' to abort." msgstr "" -#: ../js.php:26 +#: js.php:26 msgid "Item has been deleted." msgstr "" -#: ../js.php:33 +#: js.php:33 msgid "Please enter name." msgstr "" -#: ../js.php:37 +#: js.php:37 msgid "This custom choice name is already in use. Please enter another name." msgstr "" -#: ../js.php:56 +#: js.php:56 msgid "Item has been saved." msgstr "" -#: ../js.php:67 ../js.php:229 +#: js.php:67 js.php:379 msgid "" "To use conditional logic, please create a field that supports conditional " "logic." msgstr "" -#: ../js.php:119 +#: js.php:119 msgid "Completed" msgstr "" -#: ../js.php:152 +#: js.php:152 msgid "Select a category" msgstr "" -#: ../js.php:165 +#: js.php:165 msgid "Parameter Name:" msgstr "" -#: ../js.php:194 +#: js.php:169 +msgid "Parameter Name" +msgstr "" + +#: js.php:185 +msgid "Default Value:" +msgstr "" + +#: js.php:209 +msgid "Placeholder:" +msgstr "" + +#: js.php:239 +msgid "Sub-Label:" +msgstr "" + +#: js.php:247 +msgid "Custom Sub-Label" +msgstr "" + +#: js.php:289 +msgid "Same as previous" +msgstr "" + +#: js.php:344 msgid "" "This field is not associated with a product. Please add a Product Field to " "the form." msgstr "" -#: ../js.php:212 +#: js.php:362 msgid "Deleted Field" msgstr "" -#: ../js.php:250 +#: js.php:400 msgid "Column 1" msgstr "" -#: ../js.php:250 +#: js.php:400 msgid "Column 2" msgstr "" -#: ../js.php:250 +#: js.php:400 msgid "Column 3" msgstr "" -#: ../js.php:266 +#: js.php:415 msgid "" -"The form title you have entered is already taken. Please enter a unique form " -"title" +"The form title you have entered is already taken. Please enter a unique " +"form title" msgstr "" -#: ../js.php:272 +#: js.php:421 msgid "" "Please enter a Title for this form. When adding the form to a page or post, " "you will have the option to hide the title." msgstr "" -#: ../js.php:283 +#: js.php:432 msgid "" "Your form currently has one ore more pages without any fields in it. Blank " "pages are a result of Page Breaks that are positioned as the first or last " @@ -7445,955 +7761,999 @@ msgid "" "Breaks and try again." msgstr "" -#: ../js.php:291 +#: js.php:440 msgid "" -"Your form currently has a product field with a blank label. \\nPlease enter " -"a label for all product fields." +"Your form currently has a product field with a blank label. \\n" +"Please enter a label for all product fields." msgstr "" -#: ../js.php:300 +#: js.php:449 msgid "" -"Your form currently has an option field without a product field.\\nYou must " -"add a product field to your form." +"Your form currently has an option field without a product field.\\n" +"You must add a product field to your form." msgstr "" -#: ../js.php:343 +#: js.php:493 msgid "Ajax error while saving form" msgstr "" -#: ../js.php:352 +#: js.php:503 msgid "" -"Warning! Deleting this field will also delete all entry data associated with " -"it. \\'Cancel\\' to stop. \\'OK\\' to delete" +"Warning! Deleting this field will also delete all entry data associated " +"with it. \\'Cancel\\' to stop. \\'OK\\' to delete" +msgstr "" + +#: js.php:536 +msgid "Section Break" msgstr "" -#: ../js.php:399 +#: js.php:552 msgid "HTML Block" msgstr "" -#: ../js.php:433 ../js.php:446 ../js.php:458 ../js.php:678 +#: js.php:577 js.php:590 js.php:602 js.php:826 msgid "Untitled" msgstr "" -#: ../js.php:436 ../js.php:450 ../js.php:451 ../js.php:462 ../js.php:463 +#: js.php:580 js.php:594 js.php:595 js.php:606 js.php:607 msgid "First Choice" msgstr "" -#: ../js.php:436 ../js.php:450 ../js.php:451 ../js.php:462 ../js.php:463 +#: js.php:580 js.php:594 js.php:595 js.php:606 js.php:607 msgid "Second Choice" msgstr "" -#: ../js.php:436 ../js.php:450 ../js.php:451 ../js.php:462 ../js.php:463 +#: js.php:580 js.php:594 js.php:595 js.php:606 js.php:607 msgid "Third Choice" msgstr "" -#: ../js.php:471 +#: js.php:615 msgid "State / Province" msgstr "" -#: ../js.php:481 -msgid "Card Type" +#: js.php:624 js.php:920 +msgid "Expiration Month" +msgstr "" + +#: js.php:626 js.php:922 +msgid "Expiration Year" msgstr "" -#: ../js.php:482 -msgid "Cardholder\\'s Name" +#: js.php:628 +msgid "Card Type" msgstr "" -#: ../js.php:536 +#: js.php:684 msgid "Hidden Field" msgstr "" -#: ../js.php:540 +#: js.php:688 msgid "Post Title" msgstr "" -#: ../js.php:544 +#: js.php:692 msgid "Post Body" msgstr "" -#: ../js.php:548 +#: js.php:696 msgid "Post Excerpt" msgstr "" -#: ../js.php:553 +#: js.php:701 msgid "Post Tags" msgstr "" -#: ../js.php:560 +#: js.php:708 msgid "Post Custom Field" msgstr "" -#: ../js.php:563 -msgid "Post Image" -msgstr "" - -#: ../js.php:571 +#: js.php:719 msgid "Captcha" msgstr "" -#: ../js.php:579 +#: js.php:727 msgid "Product Name" msgstr "" -#: ../js.php:624 +#: js.php:772 msgid "First Option" msgstr "" -#: ../js.php:624 +#: js.php:772 msgid "Second Option" msgstr "" -#: ../js.php:624 +#: js.php:772 msgid "Third Option" msgstr "" -#: ../js.php:635 +#: js.php:783 msgid "Donation" msgstr "" -#: ../js.php:709 -msgid "Only one reCAPTCHA field can be added to the form." +#: js.php:886 +msgid "AM/PM" +msgstr "" + +#: js.php:932 +msgid "Mr." +msgstr "" + +#: js.php:932 +msgid "Mrs." msgstr "" -#: ../js.php:720 +#: js.php:932 +msgid "Miss" +msgstr "" + +#: js.php:932 +msgid "Ms." +msgstr "" + +#: js.php:932 +msgid "Dr." +msgstr "" + +#: js.php:932 +msgid "Prof." +msgstr "" + +#: js.php:932 +msgid "Rev." +msgstr "" + +#: js.php:957 +msgid "Only one reCAPTCHA field can be added to the form" +msgstr "" + +#: js.php:964 msgid "Only one Shipping field can be added to the form" msgstr "" -#: ../js.php:727 +#: js.php:971 msgid "Only one Post Content field can be added to the form" msgstr "" -#: ../js.php:733 +#: js.php:977 msgid "Only one Post Title field can be added to the form" msgstr "" -#: ../js.php:739 +#: js.php:983 msgid "Only one Post Excerpt field can be added to the form" msgstr "" -#: ../js.php:745 +#: js.php:989 msgid "Only one credit card field can be added to the form" msgstr "" -#: ../js.php:752 +#: js.php:996 msgid "You must add a product field to the form first" msgstr "" -#: ../js.php:779 +#: js.php:1030 msgid "Ajax error while adding field" msgstr "" -#: ../js.php:805 -msgid "Ajax error while duplicating field" -msgstr "" - -#: ../js.php:829 +#: js.php:1100 msgid "Ajax error while changing input type" msgstr "" -#: ../js.php:900 +#: js.php:1204 msgid "Select a field" msgstr "" -#: ../js.php:900 -msgid "User IP Address" -msgstr "" - -#: ../notification.php:100 -#, php-format +#: notification.php:109 msgid "Notification saved successfully. %sBack to notifications.%s" msgstr "" -#: ../notification.php:103 +#: notification.php:111 msgid "" "Notification could not be updated. Please enter all required information " "below." msgstr "" -#: ../notification.php:169 ../notification.php:656 +#: notification.php:190 notification.php:707 msgid "Send to" msgstr "" -#: ../notification.php:170 ../notification.php:657 +#: notification.php:191 notification.php:709 msgid "if" msgstr "" -#: ../notification.php:317 ../notification.php:946 +#: notification.php:337 notification.php:1023 msgid "Enter value" msgstr "" -#: ../notification.php:381 +#: notification.php:409 msgid "Save Notification" msgstr "" -#: ../notification.php:381 +#: notification.php:409 msgid "Update Notification" msgstr "" -#: ../notification.php:427 +#: notification.php:458 msgid "Ajax error while updating notification" msgstr "" -#: ../notification.php:465 +#: notification.php:498 msgid "Notification deleted." msgstr "" -#: ../notification.php:467 +#: notification.php:500 msgid "There was an issue deleting this notification." msgstr "" -#: ../notification.php:473 +#: notification.php:506 msgid "Notification duplicates." msgstr "" -#: ../notification.php:475 +#: notification.php:508 msgid "There was an issue duplicating this notification." msgstr "" -#: ../notification.php:520 +#: notification.php:554 msgid "Form is submitted" msgstr "" -#: ../notification.php:526 +#: notification.php:556 +msgid "Form is saved" +msgstr "" + +#: notification.php:557 +msgid "Save and continue email is requested" +msgstr "" + +#: notification.php:565 msgid "Event" msgstr "" -#: ../notification.php:569 +#: notification.php:610 msgid "Select a Field" msgstr "" -#: ../notification.php:574 +#: notification.php:615 msgid "Configure Routing" msgstr "" -#: ../notification.php:583 +#: notification.php:630 msgid "Send to Email" msgstr "" -#: ../notification.php:591 +#: notification.php:638 msgid "Please enter a valid email address" msgstr "" -#: ../notification.php:601 +#: notification.php:649 msgid "Send to Field" msgstr "" -#: ../notification.php:607 +#: notification.php:655 msgid "Select an email field" msgstr "" -#: ../notification.php:620 +#: notification.php:669 msgid "" "Your form does not have an email field. Add an email field to your form and " "try again." msgstr "" -#: ../notification.php:638 +#: notification.php:689 msgid "" "To use notification routing, your form must have a field supported by " "conditional logic." msgstr "" -#: ../notification.php:679 -msgid "" -"Please enter a valid email address for all highlighted routing rules above." +#: notification.php:733 +msgid "Please enter a valid email address for all highlighted routing rules above." msgstr "" -#: ../notification.php:694 ../tooltips.php:25 +#: notification.php:749 tooltips.php:25 msgid "From Name" msgstr "" -#: ../notification.php:707 +#: notification.php:763 msgid "From Email" msgstr "" -#: ../notification.php:720 ../tooltips.php:26 +#: notification.php:777 tooltips.php:26 msgid "Reply To" msgstr "" -#: ../notification.php:733 +#: notification.php:791 msgid "BCC" msgstr "" -#: ../notification.php:750 ../notification.php:1034 +#: notification.php:809 notification.php:1123 msgid "Subject" msgstr "" -#: ../notification.php:757 +#: notification.php:817 msgid "Please enter a subject for the notification email" msgstr "" -#: ../notification.php:787 +#: notification.php:849 msgid "Please enter a message for the notification email" msgstr "" -#: ../notification.php:797 +#: notification.php:860 msgid "Auto-formatting" msgstr "" -#: ../notification.php:804 +#: notification.php:867 msgid "Disable auto-formatting" msgstr "" -#: ../notification.php:819 +#: notification.php:885 msgid "Enable conditional logic" msgstr "" -#: ../notification.php:1103 +#: notification.php:1193 msgid "Duplicate this notification" msgstr "" -#: ../notification.php:1104 +#: notification.php:1194 msgid "Delete this notification" msgstr "" -#: ../notification.php:1104 +#: notification.php:1194 msgid "WARNING: You are about to delete this notification." msgstr "" -#: ../notification.php:1137 -#, php-format +#: notification.php:1229 msgid "This form doesn't have any notifications. Let's go %screate one%s." msgstr "" -#: ../preview.php:21 +#: preview.php:21 msgid "You don't have adequate permission to preview forms." msgstr "" -#: ../preview.php:29 ../preview.php:62 +#: preview.php:30 preview.php:64 msgid "Form Preview" msgstr "" -#: ../preview.php:62 ../print-entry.php:102 +#: preview.php:64 print-entry.php:107 msgid "close window" msgstr "" -#: ../preview.php:64 +#: preview.php:67 msgid "" "Note: This is a simple form preview. This form may display differently when " "added to your page based on inheritance from individual theme styles." msgstr "" -#: ../print-entry.php:21 +#: print-entry.php:21 msgid "You don't have adequate permission to view entries." msgstr "" -#: ../print-entry.php:68 +#: print-entry.php:71 msgid "Form Id and Lead Id are required parameters." msgstr "" -#: ../print-entry.php:102 +#: print-entry.php:107 msgid "Print Preview" msgstr "" -#: ../select_columns.php:24 +#: select_columns.php:24 msgid "Oops! We could not locate your form. Please try again." msgstr "" -#: ../select_columns.php:104 +#: select_columns.php:177 msgid "" "Drag & drop to order and select which columns are displayed in the entries " "table." msgstr "" -#: ../select_columns.php:107 +#: select_columns.php:180 msgid "Active Columns" msgstr "" -#: ../select_columns.php:122 +#: select_columns.php:195 msgid "Inactive Columns" msgstr "" -#: ../settings.php:51 ../settings.php:90 ../settings.php:97 +#: settings.php:59 settings.php:101 settings.php:113 msgid "Uninstall Gravity Forms" msgstr "" -#: ../settings.php:55 +#: settings.php:63 msgid "You don't have adequate permission to uninstall Gravity Forms." msgstr "" -#: ../settings.php:82 -#, php-format +#: settings.php:93 msgid "" "Gravity Forms have been successfully uninstalled. It can be re-activated " "from the %splugins page%s." msgstr "" -#: ../settings.php:94 +#: settings.php:109 msgid "This operation deletes ALL Gravity Forms data." msgstr "" -#: ../settings.php:94 +#: settings.php:109 msgid "" "If you continue, You will not be able to retrieve or restore your forms or " "entries." msgstr "" -#: ../settings.php:97 +#: settings.php:113 msgid "" "Warning! ALL Gravity Forms data, including form entries will be deleted. " "This cannot be undone. \\'OK\\' to delete, \\'Cancel\\' to stop" msgstr "" -#: ../settings.php:124 +#: settings.php:141 msgid "You don't have adequate permission to edit settings." msgstr "" -#: ../settings.php:145 +#: settings.php:165 msgid "Settings Updated" msgstr "" -#: ../settings.php:152 ../settings.php:156 +#: settings.php:173 settings.php:177 msgid "General Settings" msgstr "" -#: ../settings.php:159 +#: settings.php:181 msgid "Support License Key" msgstr "" -#: ../settings.php:165 +#: settings.php:188 msgid "" "There was an error while validating your license key. Gravity Forms will " "continue to work, but automatic upgrades will not be available. Please " "contact support to resolve this issue." msgstr "" -#: ../settings.php:167 +#: settings.php:190 msgid "Valid Key : Your license key has been successfully validated." msgstr "" -#: ../settings.php:169 +#: settings.php:192 msgid "" -"Invalid or Expired Key : Please make sure you have entered the correct value " -"and that your key is not expired." +"Invalid or Expired Key : Please make sure you have entered the correct " +"value and that your key is not expired." msgstr "" -#: ../settings.php:174 +#: settings.php:198 msgid "The license key is used for access to automatic upgrades and support." msgstr "" -#: ../settings.php:178 ../tooltips.php:135 +#: settings.php:203 tooltips.php:150 msgid "Output CSS" msgstr "" -#: ../settings.php:180 ../settings.php:188 ../settings.php:211 +#: settings.php:206 settings.php:217 settings.php:246 msgid "Yes" msgstr "" -#: ../settings.php:181 ../settings.php:189 ../settings.php:212 +#: settings.php:207 settings.php:218 settings.php:247 msgid "No" msgstr "" -#: ../settings.php:182 +#: settings.php:209 msgid "" "Set this to No if you would like to disable the plugin from outputting the " "form CSS." msgstr "" -#: ../settings.php:186 ../tooltips.php:136 +#: settings.php:214 tooltips.php:151 msgid "Output HTML5" msgstr "" -#: ../settings.php:190 +#: settings.php:220 msgid "" -"Set this to No if you would like to disable the plugin from outputting HTML5 " -"form fields." +"Set this to No if you would like to disable the plugin from outputting " +"HTML5 form fields." msgstr "" -#: ../settings.php:195 ../tooltips.php:137 +#: settings.php:226 tooltips.php:152 msgid "No-Conflict Mode" msgstr "" -#: ../settings.php:197 +#: settings.php:229 settings.php:285 msgid "On" msgstr "" -#: ../settings.php:198 +#: settings.php:230 settings.php:286 msgid "Off" msgstr "" -#: ../settings.php:199 +#: settings.php:232 msgid "" "Set this to ON to prevent extraneous scripts and styles from being printed " "on Gravity Forms admin pages, reducing conflicts with other plugins and " "themes." msgstr "" -#: ../settings.php:205 ../tooltips.php:141 +#: settings.php:239 tooltips.php:156 msgid "Akismet Integration" msgstr "" -#: ../settings.php:213 ../tooltips.php:141 +#: settings.php:249 tooltips.php:156 msgid "Protect your form entries from spam using Akismet." msgstr "" -#: ../settings.php:226 +#: settings.php:264 msgid "Select a Currency" msgstr "" -#: ../settings.php:245 +#: settings.php:282 +msgid "Background updates" +msgstr "" + +#: settings.php:288 +msgid "" +"Set this to ON to allow Gravity Forms to download and install bug fixes and " +"security updates automatically in the background. Requires a valid license " +"key." +msgstr "" + +#: settings.php:295 msgid "reCAPTCHA Settings" msgstr "" -#: ../settings.php:247 +#: settings.php:297 msgid "" "Gravity Forms integrates with reCAPTCHA, a free CAPTCHA service that helps " "to digitize books while protecting your forms from spam bots. " msgstr "" -#: ../settings.php:247 +#: settings.php:298 msgid "Read more about reCAPTCHA" msgstr "" -#: ../settings.php:253 +#: settings.php:305 msgid "reCAPTCHA Public Key" msgstr "" -#: ../settings.php:256 ../settings.php:263 +#: settings.php:309 settings.php:318 msgid "Required only if you decide to use the reCAPTCHA field." msgstr "" -#: ../settings.php:256 ../settings.php:263 -#, php-format +#: settings.php:309 settings.php:318 msgid "%sSign up%s for a free account to get the key." msgstr "" -#: ../settings.php:260 +#: settings.php:314 msgid "reCAPTCHA Private Key" msgstr "" -#: ../settings.php:272 +#: settings.php:327 msgid "Save Settings" msgstr "" -#: ../settings.php:296 +#: settings.php:351 msgid "Installation Status" msgstr "" -#: ../settings.php:300 +#: settings.php:355 msgid "PHP Version" msgstr "" -#: ../settings.php:314 +#: settings.php:368 msgid "Gravity Forms requires PHP 5 or above." msgstr "" -#: ../settings.php:321 +#: settings.php:375 msgid "MySQL Version" msgstr "" -#: ../settings.php:335 +#: settings.php:388 msgid "Gravity Forms requires MySQL 5 or above." msgstr "" -#: ../settings.php:342 +#: settings.php:395 msgid "WordPress Version" msgstr "" -#: ../settings.php:356 -#, php-format +#: settings.php:408 msgid "" "Gravity Forms requires WordPress v%s or greater. You must upgrade WordPress " "in order to use this version of Gravity Forms." msgstr "" -#: ../settings.php:363 +#: settings.php:415 msgid "Gravity Forms Version" msgstr "" -#: ../settings.php:375 -#, php-format +#: settings.php:426 msgid "" -"New version %s available. Automatic upgrade available on the %splugins page%s" +"New version %s available. Automatic upgrade available on the %splugins " +"page%s" msgstr "" -#: ../tooltips.php:21 +#: tooltips.php:21 msgid "Send To Email Address" msgstr "" -#: ../tooltips.php:21 +#: tooltips.php:21 msgid "Enter the email address you would like the notification email sent to." msgstr "" -#: ../tooltips.php:22 ../tooltips.php:43 +#: tooltips.php:22 tooltips.php:44 msgid "Disable Auto-Formatting" msgstr "" -#: ../tooltips.php:22 +#: tooltips.php:22 msgid "" "When enabled, auto-formatting will insert paragraph breaks automatically. " -"Disable auto-formatting when using HTML to create email notification content." +"Disable auto-formatting when using HTML to create email notification " +"content." msgstr "" -#: ../tooltips.php:23 +#: tooltips.php:23 msgid "Routing" msgstr "" -#: ../tooltips.php:23 +#: tooltips.php:23 msgid "" "Allows notification to be sent to different email addresses depending on " "values selected in the form." msgstr "" -#: ../tooltips.php:24 +#: tooltips.php:24 msgid "From Email Address" msgstr "" -#: ../tooltips.php:24 +#: tooltips.php:24 msgid "" "Enter the email address you would like the notification email sent from, or " "select the email from available email form fields." msgstr "" -#: ../tooltips.php:25 +#: tooltips.php:25 msgid "" "Enter the name you would like the notification email sent from, or select " "the name from available name fields." msgstr "" -#: ../tooltips.php:26 +#: tooltips.php:26 msgid "" "Enter the email address you would like to be used as the reply to address " "for the notification email." msgstr "" -#: ../tooltips.php:27 +#: tooltips.php:27 msgid "Blind Carbon Copy Addresses" msgstr "" -#: ../tooltips.php:27 +#: tooltips.php:27 msgid "" "Enter a comma separated list of email addresses you would like to receive a " "BCC of the notification email." msgstr "" -#: ../tooltips.php:28 +#: tooltips.php:28 msgid "Limit Form Activity" msgstr "" -#: ../tooltips.php:28 +#: tooltips.php:28 msgid "" "Limit the number of entries a form can generate and/or schedule a time " "period the form is active." msgstr "" -#: ../tooltips.php:29 +#: tooltips.php:29 msgid "Limit Number of Entries" msgstr "" -#: ../tooltips.php:29 +#: tooltips.php:29 msgid "" -"Enter a number in the input box below to limit the number of entries allowed " -"for this form. The form will become inactive when that number is reached." +"Enter a number in the input box below to limit the number of entries " +"allowed for this form. The form will become inactive when that number is " +"reached." msgstr "" -#: ../tooltips.php:30 +#: tooltips.php:30 msgid "Schedule Form" msgstr "" -#: ../tooltips.php:30 +#: tooltips.php:30 msgid "Schedule a time period the form is active." msgstr "" -#: ../tooltips.php:31 +#: tooltips.php:31 msgid "Enable Anti-spam honeypot" msgstr "" -#: ../tooltips.php:31 +#: tooltips.php:31 msgid "" "Enables the honeypot spam protection technique, which is an alternative to " "the reCAPTCHA field." msgstr "" -#: ../tooltips.php:32 +#: tooltips.php:32 msgid "Enable Animation" msgstr "" -#: ../tooltips.php:32 +#: tooltips.php:32 msgid "" "Check this option to enable a sliding animation when displaying/hiding " "conditional logic fields." msgstr "" -#: ../tooltips.php:33 +#: tooltips.php:33 msgid "Enter the title of your form." msgstr "" -#: ../tooltips.php:34 -msgid "" -"Enter a description for your form. This may be used for user instructions." +#: tooltips.php:34 +msgid "Enter a description for your form. This may be used for user instructions." msgstr "" -#: ../tooltips.php:35 +#: tooltips.php:35 msgid "Form Label Placement" msgstr "" -#: ../tooltips.php:35 +#: tooltips.php:35 msgid "" -"Select the label placement. Labels can be top aligned above a field, left " -"aligned to the left of a field, or right aligned to the left of a field." +"Select the default label placement. Labels can be top aligned above a " +"field, left aligned to the left of a field, or right aligned to the left of " +"a field. This setting can be overridden in the advanced settings for each " +"field." msgstr "" -#: ../tooltips.php:36 -msgid "Description Placement" +#: tooltips.php:36 +msgid "" +"Select the default description placement. Descriptions can be placed above " +"the field inputs or below the field inputs. This setting can be overridden " +"in the advanced settings for each field." msgstr "" -#: ../tooltips.php:36 +#: tooltips.php:37 msgid "" -"Select the description placement. Descriptions can be placed above the " -"field inputs or below the field inputs." +"Select the default sub-label placement. Sub-labels can be placed above the " +"field inputs or below the field inputs. This setting can be overridden in " +"the advanced settings for each field." msgstr "" -#: ../tooltips.php:37 +#: tooltips.php:38 msgid "Form Button Text" msgstr "" -#: ../tooltips.php:37 +#: tooltips.php:38 msgid "Enter the text you would like to appear on the form submit button." msgstr "" -#: ../tooltips.php:38 +#: tooltips.php:39 msgid "Form Button Image" msgstr "" -#: ../tooltips.php:38 -msgid "" -"Enter the path to an image you would like to use as the form submit button." +#: tooltips.php:39 +msgid "Enter the path to an image you would like to use as the form submit button." msgstr "" -#: ../tooltips.php:39 +#: tooltips.php:40 msgid "Form CSS Class Name" msgstr "" -#: ../tooltips.php:39 +#: tooltips.php:40 msgid "" "Enter the CSS class name you would like to use in order to override the " "default styles for this form." msgstr "" -#: ../tooltips.php:40 +#: tooltips.php:41 msgid "Enter the URL of a custom image to replace the default 'add item' icon." msgstr "" -#: ../tooltips.php:41 -msgid "" -"Enter the URL of a custom image to replace the default 'delete item' icon." +#: tooltips.php:42 +msgid "Enter the URL of a custom image to replace the default 'delete item' icon." msgstr "" -#: ../tooltips.php:42 +#: tooltips.php:43 msgid "Confirmation Message Text" msgstr "" -#: ../tooltips.php:42 +#: tooltips.php:43 msgid "" "Enter the text you would like the user to see on the confirmation page of " "this form." msgstr "" -#: ../tooltips.php:43 +#: tooltips.php:44 msgid "" "When enabled, auto-formatting will insert paragraph breaks automatically. " "Disable auto-formatting when using HTML to create the confirmation content." msgstr "" -#: ../tooltips.php:44 +#: tooltips.php:45 msgid "Redirect Form to Page" msgstr "" -#: ../tooltips.php:44 +#: tooltips.php:45 msgid "" "Select the page you would like the user to be redirected to after they have " "submitted the form." msgstr "" -#: ../tooltips.php:45 +#: tooltips.php:46 msgid "Redirect Form to URL" msgstr "" -#: ../tooltips.php:45 +#: tooltips.php:46 msgid "" "Enter the URL of the webpage you would like the user to be redirected to " "after they have submitted the form." msgstr "" -#: ../tooltips.php:46 +#: tooltips.php:47 msgid "Pass Data Via Query String" msgstr "" -#: ../tooltips.php:46 +#: tooltips.php:47 msgid "" "To pass field data to the confirmation page, build a Query String using the " -"'Insert Merge Tag' drop down. ..more info on querystrings »" +"'Insert Merge Tag' drop down. ..more " +"info on querystrings »" msgstr "" -#: ../tooltips.php:47 +#: tooltips.php:48 msgid "" "Enter the label of the form field. This is the field title the user will " "see when filling out the form." msgstr "" -#: ../tooltips.php:48 +#: tooltips.php:49 msgid "" "Enter the label for this HTML block. It will help you identify your HTML " "blocks in the form editor, but it will not be displayed on the form." msgstr "" -#: ../tooltips.php:49 +#: tooltips.php:50 msgid "Disable Default Margins" msgstr "" -#: ../tooltips.php:49 +#: tooltips.php:50 msgid "" "When enabled, margins are added to properly align the HTML content with " "other form fields." msgstr "" -#: ../tooltips.php:50 +#: tooltips.php:51 msgid "Recaptcha Theme" msgstr "" -#: ../tooltips.php:50 +#: tooltips.php:51 msgid "" -"Select the visual theme for the reCAPTCHA field the available options to " -"better match your site design." +"Select the visual theme for the reCAPTCHA field from the available options " +"to better match your site design." msgstr "" -#: ../tooltips.php:51 +#: tooltips.php:52 msgid "CAPTCHA Type" msgstr "" -#: ../tooltips.php:51 +#: tooltips.php:52 msgid "Select the type of CAPTCHA you would like to use." msgstr "" -#: ../tooltips.php:52 +#: tooltips.php:53 msgid "" -"Select the custom field name from available existing custom fields, or enter " -"a new custom field name." +"Select the custom field name from available existing custom fields, or " +"enter a new custom field name." msgstr "" -#: ../tooltips.php:53 +#: tooltips.php:54 msgid "Field type" msgstr "" -#: ../tooltips.php:53 +#: tooltips.php:54 msgid "Select the type of field from the available form fields." msgstr "" -#: ../tooltips.php:54 -msgid "" -"Enter the maximum number of characters that this field is allowed to have." +#: tooltips.php:55 +msgid "Enter the maximum number of characters that this field is allowed to have." msgstr "" -#: ../tooltips.php:55 +#: tooltips.php:56 msgid "Enter the maximum number of rows that users are allowed to add." msgstr "" -#: ../tooltips.php:56 +#: tooltips.php:57 msgid "" "Select the type of inputs you would like to use for the date field. Date " "Picker will let users select a date from a calendar. Date Field will let " "users free type the date." msgstr "" -#: ../tooltips.php:57 +#: tooltips.php:58 msgid "Select the type of address you would like to use." msgstr "" -#: ../tooltips.php:58 +#: tooltips.php:59 msgid "Default State" msgstr "" -#: ../tooltips.php:58 +#: tooltips.php:59 msgid "" -"Select the state you would like to be selected by default when the form gets " -"displayed." +"Select the state you would like to be selected by default when the form " +"gets displayed." msgstr "" -#: ../tooltips.php:59 +#: tooltips.php:60 msgid "Default Province" msgstr "" -#: ../tooltips.php:59 +#: tooltips.php:60 msgid "" "Select the province you would like to be selected by default when the form " "gets displayed." msgstr "" -#: ../tooltips.php:60 +#: tooltips.php:61 msgid "" "Select the country you would like to be selected by default when the form " "gets displayed." msgstr "" -#: ../tooltips.php:61 +#: tooltips.php:62 msgid "Hide Country" msgstr "" -#: ../tooltips.php:61 +#: tooltips.php:62 msgid "" "For addresses that only apply to one country, you can choose to not display " "the country drop down. Entries will still be recorded with the selected " "country." msgstr "" -#: ../tooltips.php:62 +#: tooltips.php:63 msgid "Hide Address Line 2" msgstr "" -#: ../tooltips.php:62 +#: tooltips.php:63 msgid "" "Check this box to prevent the extra address input (Address Line 2) from " "being displayed in the form." msgstr "" -#: ../tooltips.php:63 +#: tooltips.php:64 msgid "Hide State Field" msgstr "" -#: ../tooltips.php:63 -msgid "" -"Check this box to prevent the State field from being displayed in the form." +#: tooltips.php:64 +msgid "Check this box to prevent the State field from being displayed in the form." msgstr "" -#: ../tooltips.php:64 +#: tooltips.php:65 msgid "Hide Province Field" msgstr "" -#: ../tooltips.php:64 -msgid "" -"Check this box to prevent Province field from being displayed in the form." +#: tooltips.php:65 +msgid "Check this box to prevent Province field from being displayed in the form." msgstr "" -#: ../tooltips.php:65 +#: tooltips.php:66 msgid "Hide State/Province/Region" msgstr "" -#: ../tooltips.php:65 +#: tooltips.php:66 msgid "" "Check this box to prevent the State/Province/Region from being displayed in " "the form." msgstr "" -#: ../tooltips.php:66 +#: tooltips.php:67 msgid "Field Name Format" msgstr "" -#: ../tooltips.php:66 +#: tooltips.php:67 msgid "" "Select the format you would like to use for the Name field. There are 3 " "options, Normal which includes First and Last Name, Extended which adds " "Prefix and Suffix, or Simple which is a single input field." msgstr "" -#: ../tooltips.php:67 +#: tooltips.php:68 msgid "" "Select the format of numbers that are allowed in this field. You have the " "option to use a comma or a dot as the decimal separator." msgstr "" -#: ../tooltips.php:68 +#: tooltips.php:69 msgid "" "Check this box to prevent this field from being displayed in a non-secure " "page (i.e. not https://). It will redirect the page to the same URL, but " @@ -8401,199 +8761,301 @@ msgid "" "SSL certificate." msgstr "" -#: ../tooltips.php:69 +#: tooltips.php:70 msgid "Select the style you would like to use for the credit card icons." msgstr "" -#: ../tooltips.php:70 +#: tooltips.php:71 msgid "Field Date Format" msgstr "" -#: ../tooltips.php:70 +#: tooltips.php:71 msgid "" "Select the format you would like to use for the date input. Available " "options are MM/DD/YYYY and DD/MM/YYYY." msgstr "" -#: ../tooltips.php:71 +#: tooltips.php:72 msgid "" "Select the format you would like to use for the time field. Available " "options are 12 hour (i.e. 8:30 pm) and 24 hour (i.e. 20:30)." msgstr "" -#: ../tooltips.php:72 +#: tooltips.php:73 msgid "Allowed File Extensions" msgstr "" -#: ../tooltips.php:72 +#: tooltips.php:73 msgid "" "Enter the allowed file extensions for file uploads. This will limit the " "type of files a user may upload." msgstr "" -#: ../tooltips.php:73 -msgid "" -"Select this option to enable multiple files to be uploaded for this field." +#: tooltips.php:74 +msgid "Select this option to enable multiple files to be uploaded for this field." msgstr "" -#: ../tooltips.php:74 +#: tooltips.php:75 msgid "" "Specify the maximum number of files that can be uploaded using this field. " "Leave blank for unlimited. Note that the actual number of files permitted " "may be limited by this server's specifications and configuration." msgstr "" -#: ../tooltips.php:75 -msgid "" -"Specify the maximum file size in megabytes allowed for each of the files." +#: tooltips.php:76 +msgid "Specify the maximum file size in megabytes allowed for each of the files." msgstr "" -#: ../tooltips.php:76 +#: tooltips.php:77 msgid "Phone Number Format" msgstr "" -#: ../tooltips.php:76 +#: tooltips.php:77 msgid "" "Select the format you would like to use for the phone input. Available " "options are domestic US/CANADA style phone number and international long " "format phone number." msgstr "" -#: ../tooltips.php:77 +#: tooltips.php:78 msgid "Field Description" msgstr "" -#: ../tooltips.php:77 +#: tooltips.php:78 msgid "" "Enter the description for the form field. This will be displayed to the " "user and provide some direction on how the field should be filled out or " "selected." msgstr "" -#: ../tooltips.php:78 +#: tooltips.php:79 msgid "Required Field" msgstr "" -#: ../tooltips.php:78 +#: tooltips.php:79 msgid "" "Select this option to make the form field required. A required field will " "prevent the form from being submitted if it is not filled out or selected." msgstr "" -#: ../tooltips.php:79 +#: tooltips.php:80 msgid "" "Select this option to limit user input to unique values only. This will " "require that a value entered in a field does not currently exist in the " "entry database for that field." msgstr "" -#: ../tooltips.php:80 +#: tooltips.php:81 msgid "Number Range" msgstr "" -#: ../tooltips.php:80 +#: tooltips.php:81 msgid "" -"Enter the minimum and maximum values for this form field. This will require " -"that the value entered by the user must fall within this range." +"Enter the minimum and maximum values for this form field. This will " +"require that the value entered by the user must fall within this range." msgstr "" -#: ../tooltips.php:81 +#: tooltips.php:82 msgid "" -"Enabling caculations will allow the value of this field to be dynamically " +"Enabling calculations will allow the value of this field to be dynamically " "calculated based on a mathematical formula." msgstr "" -#: ../tooltips.php:82 +#: tooltips.php:83 msgid "" "Specify a mathematical formula. The result of this formula will be " "dynamically populated as the value for this field." msgstr "" -#: ../tooltips.php:83 +#: tooltips.php:84 msgid "Specify how many decimal places the number should be rounded to." msgstr "" -#: ../tooltips.php:84 +#: tooltips.php:85 +msgid "Admin Label" +msgstr "" + +#: tooltips.php:85 msgid "" "Enter the admin label of the form field. Entering a value in this field " "will override the Field Label when displayed in the Gravity Forms " "administration tool." msgstr "" -#: ../tooltips.php:85 +#: tooltips.php:86 +msgid "Enter values in this setting to override the Sub-Label for each field." +msgstr "" + +#: tooltips.php:87 +msgid "Label Visibility" +msgstr "" + +#: tooltips.php:87 +msgid "" +"Select the label visibility for this field. Labels can either inherit the " +"form setting or be hidden." +msgstr "" + +#: tooltips.php:88 +msgid "" +"Select the description placement. Descriptions can be placed above the " +"field inputs or below the field inputs." +msgstr "" + +#: tooltips.php:89 +msgid "" +"Select the sub-label placement. Sub-labels can be placed above the field " +"inputs or below the field inputs." +msgstr "" + +#: tooltips.php:90 +msgid "" +"Select a form field size from the available options. This will set the " +"width of the field." +msgstr "" + +#: tooltips.php:91 +msgid "" +"Select the fields you'd like to use in this Name field and customize the " +"Sub-Labels by entering new ones." +msgstr "" + +#: tooltips.php:92 +msgid "Name Prefix Choices" +msgstr "" + +#: tooltips.php:92 +msgid "" +"Add Choices to this field. You can mark a choice as selected by default by " +"using the radio buttons on the left." +msgstr "" + +#: tooltips.php:93 msgid "" -"Select a form field size from the available options. This will set the width " -"of the field." +"Select the fields you'd like to use in this Address Field and customize the " +"Sub-Labels by entering new ones." msgstr "" -#: ../tooltips.php:86 +#: tooltips.php:94 msgid "If you would like to pre-populate the value of a field, enter it here." msgstr "" -#: ../tooltips.php:87 +#: tooltips.php:95 +msgid "If you would like to pre-populate the value of a field, select this option." +msgstr "" + +#: tooltips.php:96 +msgid "" +"The Placeholder will not be submitted along with the form. Use the " +"Placeholder to give a hint at the expected value or format." +msgstr "" + +#: tooltips.php:97 +msgid "" +"Placeholders will not be submitted along with the form. Use Placeholders to " +"give a hint at the expected value or format." +msgstr "" + +#: tooltips.php:98 +msgid "Use Values Submitted in a Different Field" +msgstr "" + +#: tooltips.php:98 +msgid "" +"Activate this option to allow users to skip this field and submit the " +"values entered in the associated field. For example, this is useful for " +"shipping and billing address fields." +msgstr "" + +#: tooltips.php:99 +msgid "" +"Enter the label to be displayed next to the check box. For example, " +""same as shipping address"." +msgstr "" + +#: tooltips.php:100 +msgid "Select the field to be used as the source for the values for this field." +msgstr "" + +#: tooltips.php:101 +msgid "Activated by Default" +msgstr "" + +#: tooltips.php:101 +msgid "" +"Select this setting to display the option as activated by default when the " +"form first loads." +msgstr "" + +#: tooltips.php:102 +msgid "Validation Message" +msgstr "" + +#: tooltips.php:102 msgid "" "If you would like to override the default error validation for a field, " "enter it here. This message will be displayed if there is an error with " "this field when the user submits the form." msgstr "" -#: ../tooltips.php:88 +#: tooltips.php:103 msgid "reCaptcha Language" msgstr "" -#: ../tooltips.php:88 +#: tooltips.php:103 msgid "" -"Select the language you would like to use for the reCAPTCHA display from the " -"available options." +"Select the language you would like to use for the reCAPTCHA display from " +"the available options." msgstr "" -#: ../tooltips.php:89 +#: tooltips.php:104 msgid "" "Enter the CSS class name you would like to use in order to override the " "default styles for this field." msgstr "" -#: ../tooltips.php:90 +#: tooltips.php:105 msgid "" "Select the visibility for this field. Field visibility set to Everyone will " "be visible by the user submitting the form. Form field visibility set to " -"Admin Only will only be visible within the Gravity Forms administration tool." -"

    Setting a field to Admin Only is useful for creating fields that " -"can be used to set a status or priority level on submitted entries." +"Admin Only will only be visible within the Gravity Forms administration " +"tool.

    Setting a field to Admin Only is useful for creating " +"fields that can be used to set a status or priority level on submitted " +"entries." msgstr "" -#: ../tooltips.php:91 +#: tooltips.php:106 msgid "Field Choices" msgstr "" -#: ../tooltips.php:91 +#: tooltips.php:106 msgid "" -"Add Choices to this field. You can mark each choice as checked by default by " -"using the radio/checkbox fields on the left." +"Add Choices to this field. You can mark each choice as checked by default " +"by using the radio/checkbox fields on the left." msgstr "" -#: ../tooltips.php:92 +#: tooltips.php:107 msgid "Enable Choice Values" msgstr "" -#: ../tooltips.php:92 +#: tooltips.php:107 msgid "" "Check this option to specify a value for each choice. Choice values are not " -"displayed to the user viewing the form, but are accessible to administrators " -"when viewing the entry." +"displayed to the user viewing the form, but are accessible to " +"administrators when viewing the entry." msgstr "" -#: ../tooltips.php:93 +#: tooltips.php:108 msgid "" "Create rules to dynamically display or hide this field based on values from " -"another field" +"another field." msgstr "" -#: ../tooltips.php:94 +#: tooltips.php:109 msgid "Enable Enhanced UI" msgstr "" -#: ../tooltips.php:94 +#: tooltips.php:109 msgid "" "By selecting this option, the Chosen jQuery script will be applied to this field, " @@ -8601,448 +9063,481 @@ msgid "" "interface for Multi Select fields." msgstr "" -#: ../tooltips.php:95 +#: tooltips.php:110 msgid "\"Other\" Choice" msgstr "" -#: ../tooltips.php:95 +#: tooltips.php:110 msgid "" "Check this option to add a text input as the final choice of your radio " "button field. This allows the user to specify a value that is not a " "predefined choice." msgstr "" -#: ../tooltips.php:96 -msgid "Check this option to require a user to be logged in to view this form" +#: tooltips.php:111 +msgid "Check this option to require a user to be logged in to view this form." msgstr "" -#: ../tooltips.php:97 +#: tooltips.php:112 msgid "" "Enter a message to be displayed to users who are not logged in (shortcodes " -"and HTML are supported)" +"and HTML are supported)." msgstr "" -#: ../tooltips.php:98 +#: tooltips.php:113 msgid "Page Conditional Logic" msgstr "" -#: ../tooltips.php:98 +#: tooltips.php:113 msgid "" "Create rules to dynamically display or hide this page based on values from " -"another field" +"another field." msgstr "" -#: ../tooltips.php:99 +#: tooltips.php:114 msgid "" "Select which type of visual progress indicator you would like to display. " -"Progress Bar, Steps or None" +"Progress Bar, Steps or None." msgstr "" -#: ../tooltips.php:100 +#: tooltips.php:115 msgid "Progress Bar Style" msgstr "" -#: ../tooltips.php:100 +#: tooltips.php:115 msgid "" "Select which progress bar style you would like to use. Select custom to " -"choose your own text and background color" +"choose your own text and background color." msgstr "" -#: ../tooltips.php:101 +#: tooltips.php:116 msgid "" "Name each of the pages on your form. Page names are displayed with the " -"selected progress indicator" +"selected progress indicator." msgstr "" -#: ../tooltips.php:102 +#: tooltips.php:117 msgid "Next Button Text" msgstr "" -#: ../tooltips.php:102 -msgid "Enter the text you would like to appear on the page next button" +#: tooltips.php:117 +msgid "Enter the text you would like to appear on the page next button." msgstr "" -#: ../tooltips.php:103 +#: tooltips.php:118 msgid "Next Button Image" msgstr "" -#: ../tooltips.php:103 -msgid "" -"Enter the path to an image you would like to use as the page next button" +#: tooltips.php:118 +msgid "Enter the path to an image you would like to use as the page next button." msgstr "" -#: ../tooltips.php:104 +#: tooltips.php:119 msgid "Previous Button Text" msgstr "" -#: ../tooltips.php:104 -msgid "Enter the text you would like to appear on the page previous button" +#: tooltips.php:119 +msgid "Enter the text you would like to appear on the page previous button." msgstr "" -#: ../tooltips.php:105 +#: tooltips.php:120 msgid "Previous Button Image" msgstr "" -#: ../tooltips.php:105 +#: tooltips.php:120 msgid "" -"Enter the path to an image you would like to use as the page previous button" +"Enter the path to an image you would like to use as the page previous " +"button." msgstr "" -#: ../tooltips.php:106 +#: tooltips.php:121 msgid "Next Button Conditional Logic" msgstr "" -#: ../tooltips.php:106 +#: tooltips.php:121 msgid "" "Create rules to dynamically display or hide the page's Next Button based on " -"values from another field" +"values from another field." msgstr "" -#: ../tooltips.php:107 +#: tooltips.php:122 msgid "" "Create rules to dynamically display or hide the submit button based on " -"values from another field" +"values from another field." msgstr "" -#: ../tooltips.php:108 +#: tooltips.php:123 msgid "" -"Select which categories are displayed. You can choose to display all of them " -"or select individual ones." +"Select which categories are displayed. You can choose to display all of " +"them or select individual ones." msgstr "" -#: ../tooltips.php:109 +#: tooltips.php:124 msgid "" -"Select the post status that will be used for the post that is created by the " -"form entry." +"Select the post status that will be used for the post that is created by " +"the form entry." msgstr "" -#: ../tooltips.php:110 +#: tooltips.php:125 msgid "Post Author" msgstr "" -#: ../tooltips.php:110 +#: tooltips.php:125 msgid "" -"Select the author that will be used for the post that is created by the form " -"entry." +"Select the author that will be used for the post that is created by the " +"form entry." msgstr "" -#: ../tooltips.php:111 +#: tooltips.php:126 msgid "" -"Select the post format that will be used for the post that is created by the " -"form entry." +"Select the post format that will be used for the post that is created by " +"the form entry." msgstr "" -#: ../tooltips.php:112 +#: tooltips.php:127 msgid "Post Content Template" msgstr "" -#: ../tooltips.php:112 -msgid "" -"Check this option to format and insert merge tags into the Post Content." +#: tooltips.php:127 +msgid "Check this option to format and insert merge tags into the Post Content." msgstr "" -#: ../tooltips.php:113 +#: tooltips.php:128 msgid "Post Title Template" msgstr "" -#: ../tooltips.php:113 +#: tooltips.php:128 msgid "Check this option to format and insert merge tags into the Post Title." msgstr "" -#: ../tooltips.php:114 +#: tooltips.php:129 msgid "" "Select the category that will be used for the post that is created by the " "form entry." msgstr "" -#: ../tooltips.php:115 +#: tooltips.php:130 msgid "Use Current User as Author" msgstr "" -#: ../tooltips.php:115 +#: tooltips.php:130 msgid "" "Selecting this option will set the post author to the WordPress user that " "submitted the form." msgstr "" -#: ../tooltips.php:116 +#: tooltips.php:131 msgid "Image Meta" msgstr "" -#: ../tooltips.php:116 +#: tooltips.php:131 msgid "" -"Select one or more image metadata field to be displayed along with the image " -"upload field. They enable users to enter additional information about the " -"uploaded image." +"Select one or more image metadata field to be displayed along with the " +"image upload field. They enable users to enter additional information about " +"the uploaded image." msgstr "" -#: ../tooltips.php:117 +#: tooltips.php:132 msgid "Check this option to set this image as the post's Featured Image." msgstr "" -#: ../tooltips.php:118 +#: tooltips.php:133 msgid "Incoming Field Data" msgstr "" -#: ../tooltips.php:118 +#: tooltips.php:133 msgid "" "Check this option to enable data to be passed to the form and pre-populate " -"this field dynamically. Data can be passed via Query Strings, Shortcode and/" -"or Hooks" +"this field dynamically. Data can be passed via Query Strings, Shortcode " +"and/or Hooks." msgstr "" -#: ../tooltips.php:119 +#: tooltips.php:134 msgid "Enter the content (Text or HTML) to be displayed on the form." msgstr "" -#: ../tooltips.php:120 +#: tooltips.php:135 msgid "Base Price" msgstr "" -#: ../tooltips.php:120 +#: tooltips.php:135 msgid "Enter the base price for this product." msgstr "" -#: ../tooltips.php:121 +#: tooltips.php:136 msgid "Disable Quantity" msgstr "" -#: ../tooltips.php:121 +#: tooltips.php:136 msgid "" -"Disables the quantity field. A quantity of 1 will be assumed or you can add " -"a Quantity field to your form from the Pricing Fields." +"Disables the quantity field. A quantity of 1 will be assumed or you can " +"add a Quantity field to your form from the Pricing Fields." +msgstr "" + +#: tooltips.php:137 +msgid "Product Field" msgstr "" -#: ../tooltips.php:122 +#: tooltips.php:137 msgid "Select which Product this field is tied to." msgstr "" -#: ../tooltips.php:123 +#: tooltips.php:138 msgid "" "Input masks provide a visual guide allowing users to more easily enter data " "in a specific format such as dates and phone numbers." msgstr "" -#: ../tooltips.php:124 +#: tooltips.php:139 msgid "Standard Fields provide basic form functionality." msgstr "" -#: ../tooltips.php:125 +#: tooltips.php:140 msgid "" "Advanced Fields are for specific uses. They enable advanced formatting of " "regularly used fields such as Name, Email, Address, etc." msgstr "" -#: ../tooltips.php:126 +#: tooltips.php:141 msgid "" "Post Fields allow you to add fields to your form that create Post Drafts in " "WordPress from the submitted data." msgstr "" -#: ../tooltips.php:127 +#: tooltips.php:142 msgid "" "Pricing fields allow you to add fields to your form that calculate pricing " "for selling goods and services." msgstr "" -#: ../tooltips.php:128 +#: tooltips.php:143 msgid "Export Selected Form" msgstr "" -#: ../tooltips.php:128 +#: tooltips.php:143 msgid "" "Select the form you would like to export entry data from. You may only " "export data from one form at a time." msgstr "" -#: ../tooltips.php:129 +#: tooltips.php:144 msgid "Export Selected Forms" msgstr "" -#: ../tooltips.php:129 +#: tooltips.php:144 msgid "Select the forms you would like to export." msgstr "" -#: ../tooltips.php:130 +#: tooltips.php:145 msgid "Filter the entries by adding conditions." msgstr "" -#: ../tooltips.php:131 +#: tooltips.php:146 msgid "Export Selected Fields" msgstr "" -#: ../tooltips.php:131 +#: tooltips.php:146 msgid "Select the fields you would like to include in the export." msgstr "" -#: ../tooltips.php:132 +#: tooltips.php:147 msgid "Export Date Range" msgstr "" -#: ../tooltips.php:132 +#: tooltips.php:147 msgid "" "Select a date range. Setting a range will limit the export to entries " "submitting during that date range. If no range is set, all entries will be " "exported." msgstr "" -#: ../tooltips.php:133 +#: tooltips.php:148 msgid "" -"Click the Choose File button to upload a Gravity Forms XML file from your " -"computer" +"Click the Choose File button to upload a Gravity Forms export file from " +"your computer." msgstr "" -#: ../tooltips.php:134 +#: tooltips.php:149 msgid "Settings License Key" msgstr "" -#: ../tooltips.php:134 +#: tooltips.php:149 msgid "" "Your Gravity Forms support license key is used to verify your support " "package, enable automatic updates and receive support." msgstr "" -#: ../tooltips.php:135 +#: tooltips.php:150 msgid "" "Select yes or no to enable or disable CSS output. Setting this to no will " "disable the standard Gravity Forms CSS from being included in your theme." msgstr "" -#: ../tooltips.php:136 +#: tooltips.php:151 msgid "" "Select yes or no to enable or disable HTML5 output. Setting this to no will " "disable the standard Gravity Forms HTML5 form field output." msgstr "" -#: ../tooltips.php:137 +#: tooltips.php:152 msgid "" "Select On or Off to enable or disable no-conflict mode. Setting this to On " "will prevent extraneous scripts and styles from being printed on Gravity " "Forms admin pages, reducing conflicts with other plugins and themes." msgstr "" -#: ../tooltips.php:138 +#: tooltips.php:153 msgid "reCaptcha Public Key" msgstr "" -#: ../tooltips.php:138 +#: tooltips.php:153 msgid "" "Enter your reCAPTCHA Public Key, if you do not have a key you can register " "for one at the provided link. reCAPTCHA is a free service." msgstr "" -#: ../tooltips.php:139 +#: tooltips.php:154 msgid "reCaptcha Private Key" msgstr "" -#: ../tooltips.php:139 +#: tooltips.php:154 msgid "" "Enter your reCAPTCHA Private Key, if you do not have a key you can register " "for one at the provided link. reCAPTCHA is a free service." msgstr "" -#: ../tooltips.php:140 +#: tooltips.php:155 msgid "" "Please select the currency for your location. Currency is used for pricing " "fields and price calculations." msgstr "" -#: ../tooltips.php:142 +#: tooltips.php:157 msgid "Entries Conversion" msgstr "" -#: ../tooltips.php:142 +#: tooltips.php:157 msgid "" "Conversion is the percentage of form views that generated an entry. If a " "form was viewed twice, and one entry was generated, the conversion will be " "50%." msgstr "" -#: ../tooltips.php:143 +#: tooltips.php:158 msgid "Tab Index Start Value" msgstr "" -#: ../tooltips.php:143 ../widget.php:104 +#: tooltips.php:158 widget.php:111 msgid "" "If you have other forms on the page (i.e. Comments Form), specify a higher " -"tabindex start value so that your Gravity Form does not end up with the same " -"tabindices as your other forms. To disable the tabindex, enter 0 (zero)." +"tabindex start value so that your Gravity Form does not end up with the " +"same tabindices as your other forms. To disable the tabindex, enter 0 " +"(zero)." msgstr "" -#: ../tooltips.php:144 +#: tooltips.php:159 msgid "Override Notifications" msgstr "" -#: ../tooltips.php:144 +#: tooltips.php:159 msgid "" "Enter a comma separated list of email addresses you would like to receive " "the selected notification emails." msgstr "" -#: ../tooltips.php:145 +#: tooltips.php:160 msgid "Progress Bar Confirmation Display" msgstr "" -#: ../tooltips.php:145 +#: tooltips.php:160 msgid "" "Check this box if you would like the progress bar to display with the " "confirmation text." msgstr "" -#: ../tooltips.php:146 +#: tooltips.php:161 msgid "Progress Bar Completion Text" msgstr "" -#: ../tooltips.php:146 +#: tooltips.php:161 msgid "Enter text to display at the top of the progress bar." msgstr "" -#: ../update.php:10 +#: update.php:10 msgid "You don't have permissions to view this page" msgstr "" -#: ../update.php:22 +#: update.php:27 msgid "Gravity Forms Updates" msgstr "" -#: ../update.php:37 -#, php-format -msgid "" -"

    You can update to the latest version automatically or download the update " -"and install it manually. %sUpdate Automatically%s %sDownload Update%s" -msgstr "" - -#: ../update.php:45 -msgid "" -"Register your copy of Gravity " -"Forms to receive access to automatic updates and support. Need a license " -"key? Purchase one now." -msgstr "" - -#: ../update.php:58 +#: update.php:60 msgid "Your version of Gravity Forms is up to date." msgstr "" -#: ../widget.php:22 +#: widget.php:25 msgid "Gravity Forms Widget" msgstr "" -#: ../widget.php:23 -msgid "Form" -msgstr "" - -#: ../widget.php:72 +#: widget.php:74 msgid "Contact Us" msgstr "" -#: ../widget.php:97 +#: widget.php:102 msgid "advanced options" msgstr "" -#: ../widget.php:101 +#: widget.php:108 msgid "Disable script output" msgstr "" -#: ../widget.php:102 +#: widget.php:109 msgid "Tab Index Start" msgstr "" + +#. Plugin URI of the plugin/theme +msgid "http://www.gravityforms.com" +msgstr "" + +#. Description of the plugin/theme +msgid "Easily create web forms and manage form entries within the WordPress admin." +msgstr "" + +#. Author of the plugin/theme +msgid "rocketgenius" +msgstr "" + +#. Author URI of the plugin/theme +msgid "http://www.rocketgenius.com" +msgstr "" + +#: includes/addon/class-gf-payment-addon.php:1485 +msgctxt "toolbar label" +msgid "Sales" +msgstr "" + +#: includes/addon/class-gf-payment-addon.php:1486 +msgctxt "metabox title" +msgid "Filter" +msgstr "" + +#: includes/addon/class-gf-payment-addon.php:2188 +msgctxt "paging" +msgid "%1$s of %2$s" +msgstr "" + +#: includes/fields/class-gf-field-address.php:448 +msgctxt "Country" +msgid "Georgia" +msgstr "" + +#: includes/fields/class-gf-field-address.php:523 +msgctxt "Country" +msgid "GEORGIA" +msgstr "" + +#: includes/fields/class-gf-field-address.php:674 +#: includes/fields/class-gf-field-address.php:703 +msgctxt "US State" +msgid "Georgia" +msgstr "" \ No newline at end of file diff --git a/languages/index.php b/languages/index.php new file mode 100644 index 0000000..12c197f --- /dev/null +++ b/languages/index.php @@ -0,0 +1,2 @@ + $notification){ - if($id == $notification_id){ - return $notification; - } - } - return array(); - } - - public static function notification_page() { - $form_id = rgget('id'); - $notification_id = rgget("nid"); - if(!rgblank($notification_id)) - self::notification_edit_page($form_id, $notification_id); - else - self::notification_list_page($form_id); - } - - public static function notification_edit_page($form_id, $notification_id) { - - if(!rgempty("gform_notification_id")) - $notification_id = rgpost("gform_notification_id"); - - $form = RGFormsModel::get_form_meta($form_id); - - $form = apply_filters("gform_form_notification_page_{$form_id}", apply_filters("gform_form_notification_page", $form, $notification_id), $notification_id); - - $notification = !$notification_id ? array() : self::get_notification($form, $notification_id); - - // added second condition to account for new notifications with errors as notification ID will - // be available in $_POST but the notification has not actually been saved yet - $is_new_notification = empty($notification_id) || empty($notification); - - $is_valid = true; - $is_update = false; - if(rgpost("save")){ - - check_admin_referer('gforms_save_notification', 'gforms_save_notification'); - - //clear out notification because it could have legacy data populated - $notification = array( 'isActive' => isset( $notification['isActive'] ) ? rgar( $notification, 'isActive') : true ); - - $is_update = true; - - if($is_new_notification){ - $notification_id = uniqid(); - $notification["id"] = $notification_id; - } - else { - $notification["id"] = $notification_id; - } - - $notification["name"] = rgpost("gform_notification_name"); - $notification["event"] = rgpost("gform_notification_event"); - $notification["to"] = rgpost("gform_notification_to_type") == "field" ? rgpost("gform_notification_to_field") : rgpost("gform_notification_to_email"); - $notification["toType"] = rgpost("gform_notification_to_type"); - $notification["bcc"] = rgpost("gform_notification_bcc"); - $notification["subject"] = rgpost("gform_notification_subject"); - $notification["message"] = rgpost("gform_notification_message"); - $notification["from"] = rgpost("gform_notification_from"); - $notification["fromName"] = rgpost("gform_notification_from_name"); - $notification["replyTo"] = rgpost("gform_notification_reply_to"); - $notification["routing"] = !rgempty("gform_routing_meta") ? GFCommon::json_decode(rgpost("gform_routing_meta"), true) : null; - $notification["conditionalLogic"] = !rgempty("gform_conditional_logic_meta") ? GFCommon::json_decode(rgpost("gform_conditional_logic_meta"), true) : null; - $notification["disableAutoformat"] = rgpost("gform_notification_disable_autoformat"); - - $notification = apply_filters( 'gform_pre_notification_save', apply_filters( "gform_pre_notification_save{$form['id']}", $notification, $form ), $form ); - - //validating input... - $is_valid = self::validate_notification(); - if($is_valid){ - //input valid, updating... - //emptying notification email if it is supposed to be disabled - if($_POST["gform_notification_to_type"] == "routing") - $notification["to"] = ""; - else - $notification["routing"] = null; - - // trim values - $notification = GFFormsModel::trim_conditional_logic_values_from_element($notification, $form); - - $form["notifications"][$notification_id] = $notification; - - RGFormsModel::save_form_notifications($form_id, $form['notifications']); - } - } - - if($is_update && $is_valid){ - GFCommon::add_message( sprintf( __('Notification saved successfully. %sBack to notifications.%s', 'gravityforms'), '', '') ); - } - else if($is_update && !$is_valid){ - GFCommon::add_error_message(__('Notification could not be updated. Please enter all required information below.', 'gravityforms')); - } - - // moved page header loading here so the admin messages can be set upon saving and available for the header to print out - GFFormSettings::page_header(__('Notifications', 'gravityforms')); - - $notification_ui_settings = self::get_notification_ui_settings($notification); - - ?> - - - - - - - - - - - - - -
    - -

    - '; - echo apply_filters("gform_save_notification_button", $notification_button); - ?> -

    - - - 0)); - ?> - -

    - - - prepare_items(); - ?> - -
    - - display(); ?> - - - - - - -
    - - -
    - - '; - $subsetting_close = ' - -
    -
    - '; - - $ui_settings = array(); - $form_id = rgget('id'); - $form = RGFormsModel::get_form_meta($form_id); - $form = apply_filters("gform_admin_pre_render_" . $form_id, apply_filters("gform_admin_pre_render", $form)); - $is_valid = empty(GFCommon::$errors); - - ob_start(); ?> - - - - - - - "/> - - - - - __("Form is submitted", "gravityforms"))); - $event_style = count($notification_events) == 1 ? "style='display:none'" : ""; - ?> - > - - - - - - - - - - - - - - - - - - value="email" onclick="jQuery('.notification_to_container').hide(); jQuery('#gform_notification_to_email_container').show('slow');"/> - -    - value="field" onclick="jQuery('.notification_to_container').hide(); jQuery('#gform_notification_to_field_container').show('slow');"/> - -    - value="routing" onclick="jQuery('.notification_to_container').hide(); jQuery('#gform_notification_to_routing_container').show('slow');"/> - - - - - - > - - - - - - - - - - - - - - - - > - - - - - - -

    - - - - - - - > - - -
    - -
    -

    -
    - -
    > - " onkeyup="SetRouting();"/> - - - - - - - 1 ){ ?> - remove this email routing - -
    - - - - - -
    - - - - - - - - - - - "/> - - - - - - - - - - "/> - - - - - - - - - - " class="fieldwidth-2" /> - - - - - - - - - - " class="fieldwidth-1" /> - - - - - - > - - - - - " /> - - - - - - - - > - - - - - - - - false, "editor_class" => "merge-tag-support mt-wp_editor mt-manual_position mt-position-right" ) ); - } - else{?> - - - - - - - - - - - - /> - - - - - - - - - - - /> - -
    - - - - -
    - -
    - - - - - - " . $field_label . ""; - } - } - return $str; - } - - private static function get_field_values($i, $form, $field_id, $selected_value, $max_field_length = 16){ - if(empty($field_id)) - $field_id = self::get_first_routing_field($form); - - if(empty($field_id)) - return ""; - - $field = RGFormsModel::get_field($form, $field_id); - $is_any_selected = false; - $str = ""; - - if (!$field) - return ""; - - if ($field["type"] == "post_category" && rgar($field, "displayAllCategories") == true) - { - $str .= wp_dropdown_categories(array("class"=>"gfield_routing_select gfield_category_dropdown gfield_routing_value_dropdown", "orderby"=> "name", "id"=> "routing_value_" . $i, "selected"=>$selected_value, "hierarchical"=>true, "hide_empty"=>0, "echo"=>false)); - } - elseif (rgar($field,"choices")) { - $str .= ""; - } - else - { - //create a text field for fields that don't have choices (i.e text, textarea, number, email, etc...) - $str = ""; - } - - return $str; - } - - public static function get_post_category_values(){ - - $id = "routing_value_" . rgpost("ruleIndex"); - $selected = rgempty("selectedValue") ? 0 : rgpost("selectedValue"); - - $dropdown = wp_dropdown_categories(array("class"=>"gfield_routing_select gfield_routing_value_dropdown gfield_category_dropdown", "orderby"=> "name", "id"=> $id, "selected"=>$selected, "hierarchical"=>true, "hide_empty"=>0, "echo"=>false)); - die($dropdown); - } - - /** - * Delete a form notification by ID. - * - * @param mixed $notification_id - * @param mixed $form_id Can pass a form ID or a form object - */ - public static function delete_notification($notification_id, $form_id) { - - if(!$form_id) - return false; - - $form = !is_array($form_id) ? RGFormsModel::get_form_meta($form_id) : $form_id; - unset($form['notifications'][$notification_id]); - - // clear Form cache so next retrieval of form meta will reflect deleted notification - RGFormsModel::flush_current_forms(); - - return RGFormsModel::save_form_notifications($form['id'], $form['notifications']); - } - - public static function duplicate_notification($notification_id, $form_id) { - - if(!$form_id) - return false; - - $form = !is_array($form_id) ? RGFormsModel::get_form_meta($form_id) : $form_id; - - $new_notification = $form['notifications'][$notification_id]; - $name = rgar($new_notification, "name"); - $new_id = uniqid(); - - $count = 2; - $new_name = $name . " - Copy 1"; - while(!self::is_unique_name($new_name, $form['notifications'])){ - $new_name = $name . " - Copy $count"; - $count++; - } - $new_notification["name"] = $new_name; - $new_notification["id"] = $new_id; - $form['notifications'][$new_id] = $new_notification; - - // clear Form cache so next retrieval of form meta will return duplicated notification - RGFormsModel::flush_current_forms(); - - return RGFormsModel::save_form_notifications($form['id'], $form['notifications']); - } - - public static function is_unique_name($name, $notifications){ - - foreach ($notifications as $notification){ - if(strtolower(rgar($notification, "name")) == strtolower($name)) - return false; - } - - return true; - } - -} - - - -class GFNotificationTable extends WP_List_Table { - - public $form; - - function __construct($form) { - - $this->form = $form; - - $this->_column_headers = array( - array( - 'cb' => '', - 'name' => __('Name', 'gravityforms'), - 'subject' => __('Subject', 'gravityforms') - ), - array(), - array() - ); - - parent::__construct(); - } - - function prepare_items() { - $this->items = $this->form['notifications']; - } - - function display() { - - // ...causing issue: Notice: Indirect modification of overloaded property GFNotificationTable::$_args has no effect - //extract( $this->_args ); // gives us $plural, $singular, $ajax, $screen - - $singular = $this->_args['singular']; - - ?> - - - - - print_column_headers(); ?> - - - - - - print_column_headers( false ); ?> - - - - > - - display_rows_or_placeholder(); ?> - - -
    - - '; - echo $this->single_row_columns( $item ); - echo ''; - } - - function column_default($item, $column) { - echo rgar($item, $column); - } - - function column_cb($item) { - $is_active = isset($item["isActive"]) ? $item["isActive"] : true; - ?> - <?php $is_active ? __(" title="" onclick="ToggleActive(this, ''); " /> - $item["id"])); - $actions = apply_filters('gform_notification_actions', array( - 'edit' => '' . __('Edit', 'gravityforms') . '', - 'duplicate' => '' . __('Duplicate', 'gravityforms') . '', - 'delete' => '' . __('Delete', 'gravityforms') . '' - )); - - if(isset($item['isDefault']) && $item['isDefault']) - unset($actions['delete']); - - ?> - - -
    - - $html) { - $divider = $key == $last_key ? '' : " | "; - ?> - - - - - -
    - - 0)) . "'>", ""); - } -} - -?> \ No newline at end of file + $notification ) { + if ( $id == $notification_id ) { + return $notification; + } + } + + return array(); + } + + public static function notification_page() { + $form_id = rgget( 'id' ); + $notification_id = rgget( 'nid' ); + if ( ! rgblank( $notification_id ) ) { + self::notification_edit_page( $form_id, $notification_id ); + } else { + self::notification_list_page( $form_id ); + } + } + + public static function notification_edit_page( $form_id, $notification_id ) { + + if ( ! rgempty( 'gform_notification_id' ) ) { + $notification_id = rgpost( 'gform_notification_id' ); + } + + $form = RGFormsModel::get_form_meta( $form_id ); + + $form = apply_filters( "gform_form_notification_page_{$form_id}", apply_filters( 'gform_form_notification_page', $form, $notification_id ), $notification_id ); + + $notification = ! $notification_id ? array() : self::get_notification( $form, $notification_id ); + + // added second condition to account for new notifications with errors as notification ID will + // be available in $_POST but the notification has not actually been saved yet + $is_new_notification = empty( $notification_id ) || empty( $notification ); + + $is_valid = true; + $is_update = false; + if ( rgpost( 'save' ) ) { + + check_admin_referer( 'gforms_save_notification', 'gforms_save_notification' ); + + //clear out notification because it could have legacy data populated + $notification = array( 'isActive' => isset( $notification['isActive'] ) ? rgar( $notification, 'isActive' ) : true ); + + + $is_update = true; + + if ( $is_new_notification ) { + $notification_id = uniqid(); + $notification['id'] = $notification_id; + } else { + $notification['id'] = $notification_id; + } + + $notification['name'] = rgpost( 'gform_notification_name' ); + $notification['event'] = rgpost( 'gform_notification_event' ); + $notification['to'] = rgpost( 'gform_notification_to_type' ) == 'field' ? rgpost( 'gform_notification_to_field' ) : rgpost( 'gform_notification_to_email' ); + $notification['toType'] = rgpost( 'gform_notification_to_type' ); + $notification['bcc'] = rgpost( 'gform_notification_bcc' ); + $notification['subject'] = rgpost( 'gform_notification_subject' ); + $notification['message'] = rgpost( 'gform_notification_message' ); + $notification['from'] = rgpost( 'gform_notification_from' ); + $notification['fromName'] = rgpost( 'gform_notification_from_name' ); + $notification['replyTo'] = rgpost( 'gform_notification_reply_to' ); + $notification['routing'] = ! rgempty( 'gform_routing_meta' ) ? GFCommon::json_decode( rgpost( 'gform_routing_meta' ), true ) : null; + $notification['conditionalLogic'] = ! rgempty( 'gform_conditional_logic_meta' ) ? GFCommon::json_decode( rgpost( 'gform_conditional_logic_meta' ), true ) : null; + $notification['disableAutoformat'] = rgpost( 'gform_notification_disable_autoformat' ); + + if ( rgpost( 'gform_is_default' ) ) { + $notification['isDefault'] = true; + } + $notification = apply_filters( 'gform_pre_notification_save', apply_filters( "gform_pre_notification_save{$form['id']}", $notification, $form, $is_new_notification ), $form, $is_new_notification ); + + //validating input... + $is_valid = self::validate_notification(); + if ( $is_valid ) { + //input valid, updating... + //emptying notification email if it is supposed to be disabled + if ( $_POST['gform_notification_to_type'] == 'routing' ) { + $notification['to'] = ''; + } else { + $notification['routing'] = null; + } + + // trim values + $notification = GFFormsModel::trim_conditional_logic_values_from_element( $notification, $form ); + + $form['notifications'][ $notification_id ] = $notification; + + RGFormsModel::save_form_notifications( $form_id, $form['notifications'] ); + } + } + + if ( $is_update && $is_valid ) { + GFCommon::add_message( sprintf( __( 'Notification saved successfully. %sBack to notifications.%s', 'gravityforms' ), '', '' ) ); + } else if ( $is_update && ! $is_valid ) { + GFCommon::add_error_message( __( 'Notification could not be updated. Please enter all required information below.', 'gravityforms' ) ); + } + + // moved page header loading here so the admin messages can be set upon saving and available for the header to print out + GFFormSettings::page_header( __( 'Notifications', 'gravityforms' ) ); + + $notification_ui_settings = self::get_notification_ui_settings( $notification ); + + ?> + + + + +
    + + + '; + } + + ?> + + + + + + +
    + +

    + '; + echo apply_filters( 'gform_save_notification_button', $notification_button ); + ?> +

    +
    + + 0 ) ); + ?> + +

    + +

    + + + prepare_items(); + ?> + +
    + + display(); ?> + + + + + + +
    + + +
    + + '; + $subsetting_close = ' + +
    +
    + '; + + $ui_settings = array(); + $form_id = rgget( 'id' ); + $form = RGFormsModel::get_form_meta( $form_id ); + $form = apply_filters( 'gform_admin_pre_render_' . $form_id, apply_filters( 'gform_admin_pre_render', $form ) ); + $is_valid = empty( GFCommon::$errors ); + + ob_start(); ?> + + > + + + + + + + + + + __( 'Form is submitted', 'gravityforms' ) ); + if ( rgars( $form, 'save/enabled' ) ) { + $notification_events['form_saved'] = __( 'Form is saved', 'gravityforms' ); + $notification_events['form_save_email_requested'] = __( 'Save and continue email is requested', 'gravityforms' ); + } + $notification_events = apply_filters( 'gform_notification_events', $notification_events ); + $event_style = count( $notification_events ) == 1 || rgar( $notification, 'isDefault' ) ? "style='display:none'" : ''; + ?> + > + + + + + + + + + + + + > + + + + + + value="email" onclick="jQuery('.notification_to_container').hide(); jQuery('#gform_notification_to_email_container').show('slow');" /> + +    + value="field" onclick="jQuery('.notification_to_container').hide(); jQuery('#gform_notification_to_field_container').show('slow');" /> + +    + value="routing" onclick="jQuery('.notification_to_container').hide(); jQuery('#gform_notification_to_routing_container').show('slow');" /> + + + + '; + } + ?> + + > + + + + + + + + . + + + + + + + + > + + + + + + +
    +

    +
    + + + + + + + > + + +
    + +
    +

    +
    + +
    > + + + + + + + + + + 1 ) { ?> + remove this email routing + +
    + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + > + + + + + + + + + + + + + > + + + + + + + + false, 'editor_class' => 'merge-tag-support mt-wp_editor mt-manual_position mt-position-right' ) ); + } else { + ?> + + + + + + + + + + + + /> + + + + + + > + + + + + /> + +
    + + + + +
    + +
    + + + + + + id; + } + } + + return 0; + } + + private static function get_routing_fields( $form, $selected_field_id ) { + $str = ''; + foreach ( $form['fields'] as $field ) { + $input_type = RGFormsModel::get_input_type( $field ); + $field_label = RGFormsModel::get_label( $field ); + if ( in_array( $input_type, self::$supported_fields ) ) { + $selected = $field->id == $selected_field_id ? "selected='selected'" : ''; + $str .= "'; + } + } + + return $str; + } + + private static function get_field_values( $i, $form, $field_id, $selected_value, $max_field_length = 16 ) { + if ( empty( $field_id ) ) { + $field_id = self::get_first_routing_field( $form ); + } + + if ( empty( $field_id ) ) { + return ''; + } + + $field = RGFormsModel::get_field( $form, $field_id ); + $is_any_selected = false; + $str = ''; + + if ( ! $field ) { + return ''; + } + + if ( $field->type == 'post_category' && $field->displayAllCategories == true ) { + $str .= wp_dropdown_categories( array( 'class' => 'gfield_routing_select gfield_category_dropdown gfield_routing_value_dropdown', 'orderby' => 'name', 'id' => 'routing_value_' . $i, 'selected' => $selected_value, 'hierarchical' => true, 'hide_empty' => 0, 'echo' => false ) ); + } elseif ( $field->choices ) { + $str .= "'; + } else { + //create a text field for fields that don't have choices (i.e text, textarea, number, email, etc...) + $str = ""; + } + + return $str; + } + + public static function get_post_category_values() { + + $id = 'routing_value_' . rgpost( 'ruleIndex' ); + $selected = rgempty( 'selectedValue' ) ? 0 : rgpost( 'selectedValue' ); + + $dropdown = wp_dropdown_categories( array( 'class' => 'gfield_routing_select gfield_routing_value_dropdown gfield_category_dropdown', 'orderby' => 'name', 'id' => $id, 'selected' => $selected, 'hierarchical' => true, 'hide_empty' => 0, 'echo' => false ) ); + die( $dropdown ); + } + + /** + * Delete a form notification by ID. + * + * @param mixed $notification_id + * @param mixed $form_id Can pass a form ID or a form object + * + * @return mixed + */ + public static function delete_notification( $notification_id, $form_id ) { + + if ( ! $form_id ) { + return false; + } + + $form = ! is_array( $form_id ) ? RGFormsModel::get_form_meta( $form_id ) : $form_id; + + do_action( 'gform_pre_notification_deleted', $form['notifications'][ $notification_id ], $form ); + + unset( $form['notifications'][ $notification_id ] ); + + // clear Form cache so next retrieval of form meta will reflect deleted notification + RGFormsModel::flush_current_forms(); + + return RGFormsModel::save_form_notifications( $form['id'], $form['notifications'] ); + } + + public static function duplicate_notification( $notification_id, $form_id ) { + + if ( ! $form_id ) { + return false; + } + + $form = ! is_array( $form_id ) ? RGFormsModel::get_form_meta( $form_id ) : $form_id; + + $new_notification = $form['notifications'][ $notification_id ]; + $name = rgar( $new_notification, 'name' ); + $new_id = uniqid(); + + $count = 2; + $new_name = $name . ' - Copy 1'; + while ( ! self::is_unique_name( $new_name, $form['notifications'] ) ) { + $new_name = $name . " - Copy $count"; + $count ++; + } + $new_notification['name'] = $new_name; + $new_notification['id'] = $new_id; + unset( $new_notification['isDefault'] ); + if ( $new_notification['toType'] == 'hidden' ) { + $new_notification['toType'] = 'email'; + } + + $form['notifications'][ $new_id ] = $new_notification; + + // clear Form cache so next retrieval of form meta will return duplicated notification + RGFormsModel::flush_current_forms(); + + return RGFormsModel::save_form_notifications( $form['id'], $form['notifications'] ); + } + + public static function is_unique_name( $name, $notifications ) { + + foreach ( $notifications as $notification ) { + if ( strtolower( rgar( $notification, 'name' ) ) == strtolower( $name ) ) { + return false; + } + } + + return true; + } + +} + + +class GFNotificationTable extends WP_List_Table { + + public $form; + + function __construct( $form ) { + + $this->form = $form; + + $this->_column_headers = array( + array( + 'cb' => '', + 'name' => __( 'Name', 'gravityforms' ), + 'subject' => __( 'Subject', 'gravityforms' ) + ), + array(), + array(), + ); + + parent::__construct(); + } + + function prepare_items() { + $this->items = $this->form['notifications']; + } + + function display() { + $singular = rgar( $this->_args, 'singular' ); + ?> + + + + + print_column_headers(); ?> + + + + + + print_column_headers( false ); ?> + + + + > + + display_rows_or_placeholder(); ?> + + +
    + + '; + echo $this->single_row_columns( $item ); + echo ''; + } + + function column_default( $item, $column ) { + echo rgar( $item, $column ); + } + + function column_cb( $item ) { + if ( rgar( $item, 'isDefault' ) ) { + return; + } + $is_active = isset( $item['isActive'] ) ? $item['isActive'] : true; + ?> + <?php $is_active ? __( 'Active', 'gravityforms' ) : __( 'Inactive', 'gravityforms' ); ?> + $item['id'] ) ); + $actions = apply_filters( + 'gform_notification_actions', array( + 'edit' => '' . __( 'Edit', 'gravityforms' ) . '', + 'duplicate' => '' . __( 'Duplicate', 'gravityforms' ) . '', + 'delete' => '' . __( 'Delete', 'gravityforms' ) . '' + ) + ); + + if ( isset( $item['isDefault'] ) && $item['isDefault'] ) { + unset( $actions['delete'] ); + } + + ?> + + +
    + + $html ) { + $divider = $key == $last_key ? '' : ' | '; + ?> + + + + + +
    + + 0 ) ) . "'>", '' ); + } +} \ No newline at end of file diff --git a/preview.php b/preview.php index 80122cf..c950025 100644 --- a/preview.php +++ b/preview.php @@ -2,75 +2,78 @@ //For backwards compatibility, load wordpress if it hasn't been loaded yet //Will be used if this file is being called directly -if(!class_exists("RGForms")){ - for ( $i = 0; $i < $depth = 10; $i++ ) { - $wp_root_path = str_repeat( '../', $i ); +if ( ! class_exists( 'RGForms' ) ) { + for ( $i = 0; $i < $depth = 10; $i ++ ) { + $wp_root_path = str_repeat( '../', $i ); - if ( file_exists("{$wp_root_path}wp-load.php" ) ) { - require_once("{$wp_root_path}wp-load.php"); - require_once("{$wp_root_path}wp-admin/includes/admin.php"); - break; - } - } + if ( file_exists( "{$wp_root_path}wp-load.php" ) ) { + require_once( "{$wp_root_path}wp-load.php" ); + require_once( "{$wp_root_path}wp-admin/includes/admin.php" ); + break; + } + } - //redirect to the login page if user is not authenticated - auth_redirect(); + //redirect to the login page if user is not authenticated + auth_redirect(); } -if(!GFCommon::current_user_can_any(array("gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms"))) - die(__("You don't have adequate permission to preview forms.", "gravityforms")); +if ( ! GFCommon::current_user_can_any( array( 'gravityforms_edit_forms', 'gravityforms_create_form', 'gravityforms_preview_forms' ) ) ) { + die( __( 'You don\'t have adequate permission to preview forms.', 'gravityforms' ) ); +} ?> > - - - - <?php _e("Form Preview", "gravityforms") ?> - - - - - - + + + + <?php _e( 'Form Preview', 'gravityforms' ) ?> + + + + + + - - - + + + - - /css/preview.css' type='text/css' /> + + $styles = apply_filters( 'gform_preview_styles', array(), $form ); +if ( ! empty( $styles ) ) { + wp_print_styles( $styles ); +} +?> - - -
    -
    -
    -
    -
    -
    -
    - + +
    +
    +
    +

    +
    +
    +
    +
    +
    + -
    - - + ?> +
    + + \ No newline at end of file diff --git a/print-entry.php b/print-entry.php index 36b1eb5..e6e0d3c 100644 --- a/print-entry.php +++ b/print-entry.php @@ -2,132 +2,140 @@ //For backwards compatibility, load wordpress if it hasn't been loaded yet //Will be used if this file is being called directly -if(!class_exists("RGForms")){ - for ( $i = 0; $i < $depth = 10; $i++ ) { - $wp_root_path = str_repeat( '../', $i ); - - if ( file_exists("{$wp_root_path}wp-load.php" ) ) { - require_once("{$wp_root_path}wp-load.php"); - require_once("{$wp_root_path}wp-admin/includes/admin.php"); - break; - } - } - - //redirect to the login page if user is not authenticated - auth_redirect(); +if ( ! class_exists( 'RGForms' ) ) { + for ( $i = 0; $i < $depth = 10; $i ++ ) { + $wp_root_path = str_repeat( '../', $i ); + + if ( file_exists( "{$wp_root_path}wp-load.php" ) ) { + require_once( "{$wp_root_path}wp-load.php" ); + require_once( "{$wp_root_path}wp-admin/includes/admin.php" ); + break; + } + } + + //redirect to the login page if user is not authenticated + auth_redirect(); +} + +if ( ! GFCommon::current_user_can_any( 'gravityforms_view_entries' ) ) { + die( __( "You don't have adequate permission to view entries.", 'gravityforms' ) ); } -if(!GFCommon::current_user_can_any("gravityforms_view_entries")) - die(__("You don't have adequate permission to view entries.", "gravityforms")); - -$form_id = absint(rgget("fid")); -$leads = rgget("lid"); -if(0 == $leads){ - // get all the lead ids for the current filter / search - $filter = rgget("filter"); - $search = rgget("search"); - $star = $filter == "star" ? 1 : null; - $read = $filter == "unread" ? 0 : null; - $status = in_array($filter, array("trash", "spam")) ? $filter : "active"; - $search_criteria["status"] = $status; - - if($star) - $search_criteria["field_filters"][] = array("key" => "is_starred", "value" => (bool) $star ); - if(!is_null($read)) - $search_criteria["field_filters"][] = array("key" => "is_read", "value" => (bool) $read ); - - $search_field_id = rgget("field_id"); - $search_operator = rgget("operator"); - if(isset($_GET["field_id"]) && $_GET["field_id"] !== ''){ - $key = $search_field_id; - $val = rgget("s"); - $strpos_row_key = strpos($search_field_id, "|"); - if ($strpos_row_key !== false) { //multi-row - $key_array = explode("|", $search_field_id); - $key = $key_array[0]; - $val = $key_array[1] . ":" . $val; - } - $search_criteria["field_filters"][] = array( - "key" => $key, - "operator" => rgempty("operator", $_GET) ? "is" : rgget("operator"), - "value" => $val - ); - } - $lead_ids = GFFormsModel::search_lead_ids($form_id, $search_criteria); +$form_id = absint( rgget( 'fid' ) ); +$leads = rgget( 'lid' ); +if ( 0 == $leads ) { + // get all the lead ids for the current filter / search + $filter = rgget( 'filter' ); + $search = rgget( 'search' ); + $star = $filter == 'star' ? 1 : null; + $read = $filter == 'unread' ? 0 : null; + $status = in_array( $filter, array( 'trash', 'spam' ) ) ? $filter : 'active'; + $search_criteria['status'] = $status; + + if ( $star ) { + $search_criteria['field_filters'][] = array( 'key' => 'is_starred', 'value' => (bool) $star ); + } + if ( ! is_null( $read ) ) { + $search_criteria['field_filters'][] = array( 'key' => 'is_read', 'value' => (bool) $read ); + } + + $search_field_id = rgget( 'field_id' ); + $search_operator = rgget( 'operator' ); + if ( isset( $_GET['field_id'] ) && $_GET['field_id'] !== '' ) { + $key = $search_field_id; + $val = rgget( 's' ); + $strpos_row_key = strpos( $search_field_id, '|' ); + if ( $strpos_row_key !== false ) { //multi-row + $key_array = explode( '|', $search_field_id ); + $key = $key_array[0]; + $val = $key_array[1] . ':' . $val; + } + $search_criteria['field_filters'][] = array( + 'key' => $key, + 'operator' => rgempty( 'operator', $_GET ) ? 'is' : rgget( 'operator' ), + 'value' => $val, + ); + } + $lead_ids = GFFormsModel::search_lead_ids( $form_id, $search_criteria ); } else { - $lead_ids = explode(',', $leads); + $lead_ids = explode( ',', $leads ); } -$page_break = rgget("page_break") ? 'print-page-break' : false; +$page_break = rgget( 'page_break' ) ? 'print-page-break' : false; // sort lead IDs numerically -sort($lead_ids); +sort( $lead_ids ); -if(empty($form_id) || empty($lead_ids)) - die(__("Form Id and Lead Id are required parameters.", "gravityforms")); +if ( empty( $form_id ) || empty( $lead_ids ) ) { + die( __( 'Form Id and Lead Id are required parameters.', 'gravityforms' ) ); +} -$form = RGFormsModel::get_form_meta($form_id); +$form = RGFormsModel::get_form_meta( $form_id ); ?> + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> - - - - - - - - Print Preview : - <?php echo $form["title"] ?> : - <?php echo count($lead_ids) > 1 ? __("Entry # ", "gravityforms") . $lead_ids[0] : 'Bulk Print' ?> - - - + + + + + + + Print Preview : + <?php echo $form['title'] ?> : + <?php echo count( $lead_ids ) > 1 ? __( 'Entry # ', 'gravityforms' ) . $lead_ids[0] : 'Bulk Print' ?> + + + - - - -
    - + + + + +
    +
    '; + // output entry divider/page break + if ( array_search( $lead_id, $lead_ids ) < count( $lead_ids ) - 1 ) { + echo ''; + } - do_action("gform_print_entry_footer", $form, $lead); - } + do_action( 'gform_print_entry_footer', $form, $lead ); +} - ?> -
    - +?> +
    + \ No newline at end of file diff --git a/recaptchalib.php b/recaptchalib.php index 6a2ab0f..8f5935d 100644 --- a/recaptchalib.php +++ b/recaptchalib.php @@ -45,13 +45,13 @@ * @return string - encoded request */ function _recaptcha_qsencode ($data) { - $req = ""; - foreach ( $data as $key => $value ) - $req .= $key . '=' . urlencode( stripslashes($value) ) . '&'; + $req = ""; + foreach ( $data as $key => $value ) + $req .= $key . '=' . urlencode( stripslashes($value) ) . '&'; - // Cut the last '&' - $req=substr($req,0,strlen($req)-1); - return $req; + // Cut the last '&' + $req=substr($req,0,strlen($req)-1); + return $req; } @@ -66,29 +66,29 @@ function _recaptcha_qsencode ($data) { */ function _recaptcha_http_post($host, $path, $data, $port = 80) { - $req = _recaptcha_qsencode ($data); + $req = _recaptcha_qsencode ($data); - $http_request = "POST $path HTTP/1.0\r\n"; - $http_request .= "Host: $host\r\n"; - $http_request .= "Content-Type: application/x-www-form-urlencoded;\r\n"; - $http_request .= "Content-Length: " . strlen($req) . "\r\n"; - $http_request .= "User-Agent: reCAPTCHA/PHP\r\n"; - $http_request .= "\r\n"; - $http_request .= $req; + $http_request = "POST $path HTTP/1.0\r\n"; + $http_request .= "Host: $host\r\n"; + $http_request .= "Content-Type: application/x-www-form-urlencoded;\r\n"; + $http_request .= "Content-Length: " . strlen($req) . "\r\n"; + $http_request .= "User-Agent: reCAPTCHA/PHP\r\n"; + $http_request .= "\r\n"; + $http_request .= $req; - $response = ''; - if( false == ( $fs = @fsockopen($host, $port, $errno, $errstr, 10) ) ) { - die ('Could not open socket'); - } + $response = ''; + if( false == ( $fs = @fsockopen($host, $port, $errno, $errstr, 10) ) ) { + die ('Could not open socket'); + } - fwrite($fs, $http_request); + fwrite($fs, $http_request); - while ( !feof($fs) ) - $response .= fgets($fs, 1160); // One TCP-IP packet - fclose($fs); - $response = explode("\r\n\r\n", $response, 2); + while ( !feof($fs) ) + $response .= fgets($fs, 1160); // One TCP-IP packet + fclose($fs); + $response = explode("\r\n\r\n", $response, 2); - return $response; + return $response; } @@ -106,20 +106,20 @@ function _recaptcha_http_post($host, $path, $data, $port = 80) { function recaptcha_get_html ($pubkey, $error = null, $use_ssl = false, $lang='en') { if ($pubkey == null || $pubkey == '') { - die ("To use reCAPTCHA you must get an API key from https://www.google.com/recaptcha/admin/create"); + die ("To use reCAPTCHA you must get an API key from https://www.google.com/recaptcha/admin"); } if ($use_ssl) { - $server = RECAPTCHA_API_SECURE_SERVER; - } else { - $server = RECAPTCHA_API_SERVER; - } + $server = RECAPTCHA_API_SECURE_SERVER; + } else { + $server = RECAPTCHA_API_SERVER; + } - $errorpart = ""; - if ($error) { - $errorpart = "&error=" . $error; - } - return ' + $errorpart = ""; + if ($error) { + $errorpart = "&error=" . $error; + } + return '