', '' ) ?>

'; $subsetting_close = '
'; //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 description $tr_form_description = ' ' . __( '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' ) ); $label_dd = ''; foreach ( $alignment_options as $value => $label ) { $selected = $form['labelPlacement'] == $value ? 'selected="selected"' : ''; $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 = ' ' . __( '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 = ' '; //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_button_checked = 'checked="checked"'; $text_style_display = 'display:none;'; } //form button $tr_form_button = ' ' . __( 'Input type', 'gravityforms' ) . '    '; //form button text $tr_form_button_text = $subsetting_open . ' ' . __( 'Button text', 'gravityforms' ) . ' ' . gform_tooltip( 'form_button_text', '', true ) . ' '; //form button image path $tr_form_button_image_path = ' ' . __( 'Button image path', 'gravityforms' ) . ' ' . gform_tooltip( 'form_button_image', '', true ) . ' ' . $subsetting_close; //form button conditional logic $button_conditional_checked = ''; if ( rgars( $form, 'button/conditionalLogic' ) ) { $button_conditional_checked = 'checked="checked"'; } $tr_form_button_conditional = ' ' . __( 'Button conditional logic', 'gravityforms' ) . ' ' . gform_tooltip( 'form_button_conditional_logic', '', true ) . ' '; //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;"'; } $save_button_text = isset( $form['save']['button']['text'] ) ? esc_attr( rgars( $form, 'save/button/text' ) ) : __( 'Save and Continue Later', 'gravityforms' ); $tr_enable_save = ' ' . __( 'Save and Continue', 'gravityforms' ) . ' ' . gform_tooltip( 'form_enable_save', '', true ) . ' '; // 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 = ' ' . __( '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 message $tr_limit_entries_message = ' ' . $subsetting_open . ' ' . $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_checked = 'checked="checked"'; } 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 .= ''; } //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' ) { $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 minute dd options 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' ) { $end_pm_selected = 'selected="selected"'; } //schedule form $tr_schedule_form = ' ' . __( 'Schedule form', 'gravityforms' ) . ' ' . gform_tooltip( 'form_schedule_form', '', true ) . ' '; //schedule start $tr_schedule_start = ' ' . $subsetting_open . '    : ' . $subsetting_close . ' '; //schedule end $tr_schedule_end = ' ' . $subsetting_open . ' ' . __( 'Schedule Form End Date/Time', 'gravityforms' ) . '    : ' . $subsetting_close . ' '; //schedule message $tr_schedule_pending_message = ' ' . $subsetting_open . ' ' . __( 'Form Pending Message', 'gravityforms' ) . ' ' . $subsetting_close . ' '; //schedule message $tr_schedule_message = ' ' . $subsetting_open . ' ' . __( 'Form Expired Message', 'gravityforms' ) . ' ' . $subsetting_close . ' '; //honey pot $honey_pot_checked = ''; if ( rgar( $form, 'enableHoneypot' ) ) { $honey_pot_checked = 'checked="checked"'; } $tr_honey_pot = ' ' . __( 'Anti-spam honeypot', 'gravityforms' ) . ' ' . gform_tooltip( 'form_honeypot', '', true ) . ' '; //enable animation $enable_animation_checked = ''; if ( rgar( $form, 'enableAnimation' ) ) { $enable_animation_checked = 'checked="checked"'; } $tr_enable_animation = ' ' . __( 'Animated transitions', 'gravityforms' ) . ' ' . gform_tooltip( 'form_animation', '', true ) . ' '; //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 = ' ' . __( 'Require user to be logged in', 'gravityforms' ) . ' ' . gform_tooltip( 'form_require_login', '', true ) . ' '; //require login message $tr_requires_login_message = ' ' . $subsetting_open . ' ' . __( '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, '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 ) ); ?>

prepare_items(); ?>
display(); ?>

'; $subsetting_close = '
'; $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()" />
>
>

ID: :


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 ); return $setting_tabs; } public static function handle_confirmation_edit_submission( $confirmation, $form ) { if ( empty( $_POST ) || ! check_admin_referer( 'gform_confirmation_edit', 'gform_confirmation_edit' ) ) return $confirmation; $is_new_confirmation = ! $confirmation; if ( $is_new_confirmation ) { $confirmation['id'] = uniqid(); } $name = sanitize_text_field( rgpost( 'form_confirmation_name' ) ); $confirmation['name'] = $name; $type = rgpost( 'form_confirmation' ); if ( ! in_array( $type, array( 'message', 'page', 'redirect' ) ) ) { $type = 'message'; } $confirmation['type'] = $type; $confirmation['message'] = rgpost( 'form_confirmation_message' ); $confirmation['disableAutoformat'] = (bool) rgpost( 'form_disable_autoformatting' ); $confirmation['pageId'] = absint( rgpost( 'form_confirmation_page' ) ); $confirmation['url'] = rgpost( 'form_confirmation_url' ); $query_string = '' != rgpost( 'form_redirect_querystring' ) ? rgpost( 'form_redirect_querystring' ) : rgpost( 'form_page_querystring' ); $confirmation['queryString'] = wp_strip_all_tags( $query_string ); $confirmation['isDefault'] = (bool) rgpost( 'is_default' ); // if is default confirmation, override any submitted conditional logic with empty array $confirmation['conditionalLogic'] = $confirmation['isDefault'] ? array() : json_decode( rgpost( 'conditional_logic' ), ARRAY_A ); $confirmation['conditionalLogic'] = GFFormsModel::sanitize_conditional_logic( $confirmation['conditionalLogic'] ); $failed_validation = false; if ( ! $confirmation['name'] ) { $failed_validation = true; GFCommon::add_error_message( __( 'You must specify a Confirmation Name.', 'gravityforms' ) ); } switch ( $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'] ) ) && ! GFCommon::has_merge_tag( $confirmation['url'] ) ) { $failed_validation = true; GFCommon::add_error_message( __( 'You must specify a valid Redirect URL.', 'gravityforms' ) ); } break; } if ( $failed_validation ) return $confirmation; // allow user to filter confirmation before save $confirmation = gf_apply_filters( 'gform_pre_confirmation_save', $form['id'], $confirmation, $form, $is_new_confirmation ); // trim values $confirmation = GFFormsModel::trim_conditional_logic_values_from_element( $confirmation, $form ); // add current confirmation to confirmations array $form['confirmations'][ $confirmation['id'] ] = $confirmation; // save updated confirmations array $result = GFFormsModel::save_form_confirmations( $form['id'], $form['confirmations'] ); if ( $result !== false ) { $url = remove_query_arg( array( 'cid', 'duplicatedcid' ) ); 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() { if ( empty( $_POST ) || ! check_admin_referer( 'gform_confirmation_list_action', 'gform_confirmation_list_action' ) ) return; $action = rgpost( 'action' ); $object_id = rgpost( 'action_argument' ); 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; } } /** * 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; $form = ! is_array( $form_id ) ? RGFormsModel::get_form_meta( $form_id ) : $form_id; do_action( 'gform_pre_confirmation_deleted', $form['confirmations'][ $confirmation_id ], $form ); 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; } public static function output_field_scripts( $echo = true ){ $script_str = ''; $conditional_logic_fields = array(); foreach ( GF_Fields::get_all() as $gf_field ) { if ( $gf_field->is_conditional_logic_supported() ) { $conditional_logic_fields[] = $gf_field->type; } } $script_str .= sprintf( 'function GetConditionalLogicFields(){return %s;}', json_encode( $conditional_logic_fields ) ) . PHP_EOL; if ( ! empty( $script_str ) && $echo ){ echo $script_str; } return $script_str; } public static function activate_save( $form ) { $form_id = $form['id']; $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'] ); } $has_save_confirmation = false; foreach ( $form['confirmations'] as $confirmation ) { if ( rgar( $confirmation, 'event' ) == 'form_saved' ) { $has_save_confirmation = true; break; } } if ( ! $has_save_confirmation ) { $confirmation_id = uniqid( 'sc1' ); $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( 'sc2' ); $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 ) { $form_id = $form['id']; 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; } } $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' ); class GFConfirmationTable extends WP_List_Table { 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(), 'name', ); 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 get_columns() { return $this->_column_headers[0]; } 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'] ); } ?>
$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; } }