public static function leads_page($form_id) { global $wpdb; //quit if version of wp is not supported if (!GFCommon::ensure_wp_version()) { return; } $form_id = absint($form_id); echo GFCommon::get_remote_message(); $action = RGForms::post('action'); $filter = rgget('filter'); $search = stripslashes(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 = stripslashes(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 = esc_html__('Entry deleted.', 'gravityforms'); } else { $update_message = esc_html__("You don't have adequate permission 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(esc_html__('%d entries', 'gravityforms'), count($leads)) : esc_html__('1 entry', 'gravityforms'); switch ($bulk_action) { case 'delete': if (GFCommon::current_user_can_any('gravityforms_delete_entries')) { RGFormsModel::delete_leads($leads); $update_message = sprintf(esc_html__('%s deleted.', 'gravityforms'), $entry_count); } else { $update_message = esc_html__("You don't have adequate permission to delete entries.", 'gravityforms'); } break; case 'trash': RGFormsModel::update_leads_property($leads, 'status', 'trash'); $update_message = sprintf(esc_html__('%s moved to Trash.', 'gravityforms'), $entry_count); break; case 'restore': RGFormsModel::update_leads_property($leads, 'status', 'active'); $update_message = sprintf(esc_html__('%s restored from the Trash.', 'gravityforms'), $entry_count); break; case 'unspam': RGFormsModel::update_leads_property($leads, 'status', 'active'); $update_message = sprintf(esc_html__('%s restored from the spam.', 'gravityforms'), $entry_count); break; case 'spam': RGFormsModel::update_leads_property($leads, 'status', 'spam'); $update_message = sprintf(esc_html__('%s marked as spam.', 'gravityforms'), $entry_count); break; case 'mark_read': RGFormsModel::update_leads_property($leads, 'is_read', 1); $update_message = sprintf(esc_html__('%s marked as read.', 'gravityforms'), $entry_count); break; case 'mark_unread': RGFormsModel::update_leads_property($leads, 'is_read', 0); $update_message = sprintf(esc_html__('%s marked as unread.', 'gravityforms'), $entry_count); break; case 'add_star': RGFormsModel::update_leads_property($leads, 'is_starred', 1); $update_message = sprintf(esc_html__('%s starred.', 'gravityforms'), $entry_count); break; case 'remove_star': RGFormsModel::update_leads_property($leads, 'is_starred', 0); $update_message = sprintf(esc_html__('%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']; $sort_field_meta = RGFormsModel::get_field($form, $sort_field); $is_numeric = $sort_field_meta['type'] == 'number'; $page_size = gf_apply_filters('gform_entry_page_size', $form_id, 20, $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=' . esc_attr(urlencode($search)); $sort_qs = empty($sort_field) ? '' : '&sort=' . esc_attr($sort_field); $dir_qs = empty($sort_direction) ? '' : '&dir=' . esc_attr($sort_direction); $star_qs = $star !== null ? '&star=' . esc_attr($star) : ''; $read_qs = $read !== null ? '&read=' . esc_attr($read) : ''; $filter_qs = '&filter=' . esc_attr($filter); $search_field_id_qs = !isset($_GET['field_id']) ? '' : '&field_id=' . esc_attr($search_field_id); $search_operator_urlencoded = urlencode($search_operator); $search_operator_qs = empty($search_operator_urlencoded) ? '' : '&operator=' . esc_attr($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' => esc_html__('«', 'gravityforms'), 'next_text' => esc_html__('»', '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))); $min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG || isset($_GET['gform_debug']) ? '' : '.min'; ?> <script type="text/javascript"> var messageTimeout = false, gformFieldFilters = <?php echo json_encode($field_filters); ?> , gformInitFilter = <?php echo json_encode($init_filter_vars); ?> function ChangeColumns(columns) { jQuery("#action").val("change_columns"); jQuery("#grid_columns").val(jQuery.toJSON(columns)); tb_remove(); jQuery("#lead_form")[0].submit(); } function Search(sort_field_id, sort_direction, form_id, search, star, read, filter, field_id, operator) { var search_qs = search == "" ? "" : "&s=" + encodeURIComponent(search); var star_qs = star == "" ? "" : "&star=" + star; var read_qs = read == "" ? "" : "&read=" + read; var filter_qs = filter == "" ? "" : "&filter=" + filter; var field_id_qs = field_id == "" ? "" : "&field_id=" + field_id; var operator_qs = operator == "" ? "" : "&operator=" + operator; var location = "?page=gf_entries&view=entries&id=" + form_id + "&sort=" + sort_field_id + "&dir=" + sort_direction + search_qs + star_qs + read_qs + filter_qs + field_id_qs + operator_qs; document.location = location; } function ToggleStar(img, lead_id, filter) { var is_starred = img.src.indexOf("star1.png") >= 0; if (is_starred) img.src = img.src.replace("star1.png", "star0.png"); else img.src = img.src.replace("star0.png", "star1.png"); jQuery("#lead_row_" + lead_id).toggleClass("lead_starred"); //if viewing the starred entries, hide the row and adjust the paging counts if (filter == "star") { var title = jQuery("#lead_row_" + lead_id); title.css("display", 'none'); UpdatePagingCounts(1); } UpdateCount("star_count", is_starred ? -1 : 1); UpdateLeadProperty(lead_id, "is_starred", is_starred ? 0 : 1); } function ToggleRead(lead_id, filter) { var title = jQuery("#lead_row_" + lead_id); var marking_read = title.hasClass("lead_unread"); jQuery("#mark_read_" + lead_id).css("display", marking_read ? "none" : "inline"); jQuery("#mark_unread_" + lead_id).css("display", marking_read ? "inline" : "none"); jQuery("#is_unread_" + lead_id).css("display", marking_read ? "inline" : "none"); title.toggleClass("lead_unread"); //if viewing the unread entries, hide the row and adjust the paging counts if (filter == "unread") { title.css("display", "none"); UpdatePagingCounts(1); } UpdateCount("unread_count", marking_read ? -1 : 1); UpdateLeadProperty(lead_id, "is_read", marking_read ? 1 : 0); } function UpdateLeadProperty(lead_id, name, value) { var mysack = new sack("<?php echo admin_url('admin-ajax.php'); ?> "); mysack.execute = 1; mysack.method = 'POST'; mysack.setVar("action", "rg_update_lead_property"); mysack.setVar("rg_update_lead_property", "<?php echo wp_create_nonce('rg_update_lead_property'); ?> "); mysack.setVar("lead_id", lead_id); mysack.setVar("name", name); mysack.setVar("value", value); mysack.onError = function () { alert(<?php echo json_encode(__('Ajax error while setting lead property', 'gravityforms')); ?> ) }; mysack.runAJAX(); return true; } function UpdateCount(element_id, change) { var element = jQuery("#" + element_id); var count = parseInt(element.html()) + change element.html(count + ""); } function UpdatePagingCounts(change) { //update paging header/footer Displaying # - # of #, use counts from header, no need to use footer since they are the same, just update footer paging with header info var paging_range_max_header = jQuery("#paging_range_max_header"); var paging_range_max_footer = jQuery("#paging_range_max_footer"); var range_change_max = parseInt(paging_range_max_header.html()) - change; var paging_total_header = jQuery("#paging_total_header"); var paging_total_footer = jQuery("#paging_total_footer"); var total_change = parseInt(paging_total_header.html()) - change; var paging_range_min_header = jQuery("#paging_range_min_header"); var paging_range_min_footer = jQuery("#paging_range_min_footer"); //if min and max are the same, this is the last entry item on the page, clear out the displaying # - # of # text if (parseInt(paging_range_min_header.html()) == parseInt(paging_range_max_header.html())) { var paging_header = jQuery("#paging_header"); paging_header.html(""); var paging_footer = jQuery("#paging_footer"); paging_footer.html(""); } else { paging_range_max_header.html(range_change_max + ""); paging_range_max_footer.html(range_change_max + ""); paging_total_header.html(total_change + ""); paging_total_footer.html(total_change + ""); } gformVars.countAllEntries = gformVars.countAllEntries - change; setSelectAllText(); } function DeleteLead(lead_id) { jQuery("#action").val("delete"); jQuery("#action_argument").val(lead_id); jQuery("#lead_form")[0].submit(); return true; } function handleBulkApply(actionElement) { var action = jQuery("#" + actionElement).val(); var defaultModalOptions = ''; var leadIds = getLeadIds(); if (leadIds.length == 0) { alert(<?php echo json_encode(__('Please select at least one entry.', 'gravityforms')); ?> ); return false; } switch (action) { case 'resend_notifications': resetResendNotificationsUI(); tb_show(<?php echo json_encode(esc_html__('Resend Notifications', 'gravityforms')); ?> , '#TB_inline?width=350&inlineId=notifications_modal_container', ''); return false; break; case 'print': resetPrintUI(); tb_show(<?php echo json_encode(esc_html__('Print Entries', 'gravityforms')); ?> , '#TB_inline?width=350&height=250&inlineId=print_modal_container', ''); return false; break; default: jQuery('#action').val('bulk'); } } function getLeadIds() { var all = jQuery("#all_entries").val(); //compare string, the boolean isn't correct, even when casting to a boolean the 0 is set to true if (all == "1") return 0; var leads = jQuery(".check-column input[name='lead[]']:checked"); var leadIds = new Array(); jQuery(leads).each(function (i) { leadIds[i] = jQuery(leads[i]).val(); }); return leadIds; } function BulkResendNotifications() { var selectedNotifications = new Array(); jQuery(".gform_notifications:checked").each(function () { selectedNotifications.push(jQuery(this).val()); }); var leadIds = getLeadIds(); var sendTo = jQuery('#notification_override_email').val(); if (selectedNotifications.length <= 0) { displayMessage(<?php echo json_encode(esc_html__('You must select at least one type of notification to resend.', 'gravityforms')); ?> , "error", "#notifications_container"); return; } jQuery('#please_wait_container').fadeIn(); jQuery.post(ajaxurl, { action : "gf_resend_notifications", gf_resend_notifications: '<?php echo wp_create_nonce('gf_resend_notifications'); ?> ', notifications : jQuery.toJSON(selectedNotifications), sendTo : sendTo, leadIds : leadIds, filter : <?php echo json_encode(rgget('filter')); ?> , search : <?php echo json_encode(rgget('s')); ?> , operator : <?php echo json_encode(rgget('operator')); ?> , fieldId : <?php echo json_encode(rgget('field_id')); ?> , formId : <?php echo json_encode($form['id']); ?> }, function (response) { jQuery('#please_wait_container').hide(); if (response) { displayMessage(response, 'error', '#notifications_container'); } else { var message = <?php echo json_encode(__('Notifications for %s were resent successfully.', 'gravityforms')); ?> ; var c = leadIds == 0 ? gformVars.countAllEntries : leadIds.length; displayMessage(message.replace('%s', c + ' ' + getPlural(c, <?php echo json_encode(__('entry', 'gravityforms')); ?> , <?php echo json_encode(__('entries', 'gravityforms')); ?> )), "updated", "#lead_form"); closeModal(true); } } ); } function resetResendNotificationsUI() { jQuery(".gform_notifications").attr('checked', false); jQuery('#notifications_container .message, #notifications_override_settings').hide(); } function BulkPrint() { var leadIds = getLeadIds(); if (leadIds != 0) leadIds = leadIds.join(','); var leadsQS = '&lid=' + leadIds; var notesQS = jQuery('#gform_print_notes').is(':checked') ? '¬es=1' : ''; var pageBreakQS = jQuery('#gform_print_page_break').is(':checked') ? '&page_break=1' : ''; var filterQS = '&filter=' + <?php echo json_encode(rgget('filter')); ?> ; var searchQS = '&s=' + <?php echo json_encode(rgget('s')); ?> ; var searchFieldIdQS = '&field_id=' + <?php echo json_encode(rgget('field_id')); ?> ; var searchOperatorQS = '&operator=' + <?php echo json_encode(rgget('operator')); ?> ; var url = '<?php echo trailingslashit(site_url()); ?> ?gf_page=print-entry&fid=<?php echo absint($form['id']); ?> ' + leadsQS + notesQS + pageBreakQS + filterQS + searchQS + searchFieldIdQS + searchOperatorQS; window.open(url, 'printwindow'); closeModal(true); hideMessage('#lead_form', false); } function resetPrintUI() { jQuery('#print_options input[type="checkbox"]').attr('checked', false); } function displayMessage(message, messageClass, container) { hideMessage(container, true); var messageBox = jQuery('<div class="message ' + messageClass + '" style="display:none;"><p>' + message + '</p></div>'); jQuery(messageBox).prependTo(container).slideDown(); if (messageClass == 'updated') messageTimeout = setTimeout(function () { hideMessage(container, false); }, 10000); } function hideMessage(container, messageQueued) { if (messageTimeout) clearTimeout(messageTimeout); var messageBox = jQuery(container).find('.message'); if (messageQueued) jQuery(messageBox).remove(); else jQuery(messageBox).slideUp(function () { jQuery(this).remove(); }); } function closeModal(isSuccess) { if (isSuccess) jQuery('.check-column input[type="checkbox"]').attr('checked', false); tb_remove(); } function getPlural(count, singular, plural) { return count > 1 ? plural : singular; } function toggleNotificationOverride(isInit) { if (isInit) jQuery('#notification_override_email').val(''); if (jQuery(".gform_notifications:checked").length > 0) { jQuery('#notifications_override_settings').slideDown(); } else { jQuery('#notifications_override_settings').slideUp(function () { jQuery('#notification_override_email').val(''); }); } } // Select All var gformStrings = { "allEntriesOnPageAreSelected": <?php echo json_encode(sprintf(esc_html__('All %s{0}%s entries on this page are selected.', 'gravityforms'), '<strong>', '</strong>')); ?> , "selectAll" : <?php echo json_encode(sprintf(esc_html__('Select all %s{0}%s entries.', 'gravityforms'), '<strong>', '</strong>')); ?> , "allEntriesSelected" : <?php echo json_encode(sprintf(esc_html__('All %s{0}%s entries have been selected.', 'gravityforms'), '<strong>', '</strong>')); ?> , "clearSelection" : <?php echo json_encode(__('Clear selection', 'gravityforms')); ?> } var gformVars = { "countAllEntries": <?php echo intval($total_count); ?> , "perPage" : <?php echo intval($page_size); ?> } function setSelectAllText() { var tr = getSelectAllText(); jQuery("#gform-select-all-message td").html(tr); } function getSelectAllText() { var count; count = jQuery("#gf_entry_list tr:visible:not('#gform-select-all-message')").length; return gformStrings.allEntriesOnPageAreSelected.format(count) + " <a href='javascript:void(0)' onclick='selectAllEntriesOnAllPages();'>" + gformStrings.selectAll.format(gformVars.countAllEntries) + "</a>"; } function getSelectAllTr() { var t = getSelectAllText(); var colspan = jQuery("#gf_entry_list").find("tr:first td").length + 1; return "<tr id='gform-select-all-message' style='display:none;background-color:lightyellow;text-align:center;'><td colspan='{0}'>{1}</td></tr>".format(colspan, t); } function toggleSelectAll(visible) { if (gformVars.countAllEntries <= gformVars.perPage) { jQuery('#gform-select-all-message').hide(); return; } if (visible) setSelectAllText(); jQuery('#gform-select-all-message').toggle(visible); } function clearSelectAllEntries() { jQuery(".check-column input[type=checkbox]").prop('checked', false); clearSelectAllMessage(); } function clearSelectAllMessage() { jQuery("#all_entries").val("0"); jQuery("#gform-select-all-message").hide(); jQuery("#gform-select-all-message td").html(''); } function selectAllEntriesOnAllPages() { var trHtmlClearSelection; trHtmlClearSelection = gformStrings.allEntriesSelected.format(gformVars.countAllEntries) + " <a href='javascript:void(0);' onclick='clearSelectAllEntries();'>" + gformStrings.clearSelection + "</a>"; jQuery("#all_entries").val("1"); jQuery("#gform-select-all-message td").html(trHtmlClearSelection); } function initSelectAllEntries() { if (gformVars.countAllEntries > gformVars.perPage) { var tr = getSelectAllTr(); jQuery("#gf_entry_list").prepend(tr); jQuery(".headercb").click(function () { toggleSelectAll(jQuery(this).prop('checked')); }); jQuery("#gf_entry_list .check-column input[type=checkbox]").click(function () { clearSelectAllMessage(); }) } } String.prototype.format = function () { var args = arguments; return this.replace(/{(\d+)}/g, function (match, number) { return typeof args[number] != 'undefined' ? args[number] : match; }); }; // end Select All jQuery(document).ready(function () { var action = <?php echo json_encode($action); ?> ; var message = <?php echo json_encode($update_message); ?> ; if (action && message) displayMessage(message, 'updated', '#lead_form'); var list = jQuery("#gf_entry_list").wpList({ alt: <?php echo json_encode(esc_html__('Entry List', 'gravityforms')); ?> }); list.bind('wpListDelEnd', function (e, s, list) { var currentStatus = <?php echo json_encode($filter == 'trash' || $filter == 'spam' ? $filter : 'active'); ?> ; var filter = <?php echo json_encode($filter); ?> ; var movingTo = "active"; if (s.data.status == "trash") movingTo = "trash"; else if (s.data.status == "spam") movingTo = "spam"; else if (s.data.status == "delete") movingTo = "delete"; var id = s.data.entry; var title = jQuery("#lead_row_" + id); var isUnread = title.hasClass("lead_unread"); var isStarred = title.hasClass("lead_starred"); if (movingTo != "delete") { //Updating All count var allCount = currentStatus == "active" ? -1 : 1; UpdateCount("all_count", allCount); //Updating Unread count if (isUnread) { var unreadCount = currentStatus == "active" ? -1 : 1; UpdateCount("unread_count", unreadCount); } //Updating Starred count if (isStarred) { var starCount = currentStatus == "active" ? -1 : 1; UpdateCount("star_count", starCount); } } //Updating Spam count if (currentStatus == "spam" || movingTo == "spam") { var spamCount = movingTo == "spam" ? 1 : -1; UpdateCount("spam_count", spamCount); //adjust paging counts if (filter == "spam") { UpdatePagingCounts(1); } else { UpdatePagingCounts(spamCount); } } //Updating trash count if (currentStatus == "trash" || movingTo == "trash") { var trashCount = movingTo == "trash" ? 1 : -1; UpdateCount("trash_count", trashCount); //adjust paging counts if (filter == "trash") { UpdatePagingCounts(1); } else { UpdatePagingCounts(trashCount); } } }); initSelectAllEntries(); jQuery('#entry_filters').gfFilterUI(gformFieldFilters, gformInitFilter, false); jQuery("#entry_filters").on("keypress", ".gform-filter-value", (function (event) { if (event.keyCode == 13) { Search(<?php echo json_encode($sort_field); ?> , <?php echo json_encode($sort_direction); ?> , <?php echo absint($form_id); ?> , jQuery('.gform-filter-value').val(), <?php echo json_encode($star); ?> , <?php echo json_encode($read); ?> , <?php echo json_encode($filter); ?> , jQuery('.gform-filter-field').val(), jQuery('.gform-filter-operator').val()); event.preventDefault(); } })); }); </script> <link rel="stylesheet" href="<?php echo GFCommon::get_base_url(); ?> /css/admin<?php echo $min; ?> .css" type="text/css" /> <style> /*#TB_window { height: 400px !important; } #TB_ajaxContent[style] { height: 370px !important; }*/ .lead_unread a, .lead_unread td { font-weight: bold; } .lead_spam_trash a, .lead_spam_trash td { font-weight: normal; } .row-actions a { font-weight: normal; } .entry_nowrap { overflow: hidden; white-space: nowrap; } .gform-filter-operator { width: 100px } </style> <div class="wrap <?php echo GFCommon::get_browser_class(); ?> "> <h2 class="gf_admin_page_title"> <span><?php esc_html_e('Entries', 'gravityforms'); ?> </span><span class="gf_admin_page_subtitle"><span class="gf_admin_page_formid">ID: <?php echo absint($form['id']); ?> </span><span class="gf_admin_page_formname"><?php esc_html_e('Form Name', 'gravityforms'); ?> : <?php echo esc_html($form['title']); ?> </span></span> </h2> <?php RGForms::top_toolbar(); ?> <form id="lead_form" method="post"> <?php wp_nonce_field('gforms_entry_list', 'gforms_entry_list'); ?> <input type="hidden" value="" name="grid_columns" id="grid_columns" /> <input type="hidden" value="" name="action" id="action" /> <input type="hidden" value="" name="action_argument" id="action_argument" /> <input type="hidden" value="" name="all_entries" id="all_entries" /> <ul class="subsubsub"> <li> <a class="<?php echo empty($filter) ? 'current' : ''; ?> " href="?page=gf_entries&view=entries&id=<?php echo absint($form_id); ?> "><?php _ex('All', 'Entry List', 'gravityforms'); ?> <span class="count">(<span id="all_count"><?php echo $active_lead_count; ?> </span>)</span></a> | </li> <li> <a class="<?php echo $read !== null ? 'current' : ''; ?> " href="?page=gf_entries&view=entries&id=<?php echo absint($form_id); ?> &filter=unread"><?php _ex('Unread', 'Entry List', 'gravityforms'); ?> <span class="count">(<span id="unread_count"><?php echo $unread_count; ?> </span>)</span></a> | </li> <li> <a class="<?php echo $star !== null ? 'current' : ''; ?> " href="?page=gf_entries&view=entries&id=<?php echo absint($form_id); ?> &filter=star"><?php _ex('Starred', 'Entry List', 'gravityforms'); ?> <span class="count">(<span id="star_count"><?php echo $starred_count; ?> </span>)</span></a> | </li> <?php if (GFCommon::spam_enabled($form_id)) { ?> <li> <a class="<?php echo $filter == 'spam' ? 'current' : ''; ?> " href="?page=gf_entries&view=entries&id=<?php echo absint($form_id); ?> &filter=spam"><?php esc_html_e('Spam', 'gravityforms'); ?> <span class="count">(<span id="spam_count"><?php echo esc_html($spam_count); ?> </span>)</span></a> | </li> <?php } ?> <li> <a class="<?php echo $filter == 'trash' ? 'current' : ''; ?> " href="?page=gf_entries&view=entries&id=<?php echo absint($form_id); ?> &filter=trash"><?php esc_html_e('Trash', 'gravityforms'); ?> <span class="count">(<span id="trash_count"><?php echo esc_html($trash_count); ?> </span>)</span></a></li> </ul> <div style="margin-top:12px;float:right;"> <a style="float:right;" class="button" id="lead_search_button" href="javascript:Search('<?php echo esc_js($sort_field); ?> ', '<?php echo esc_js($sort_direction); ?> ', <?php echo absint($form_id); ?> , jQuery('.gform-filter-value').val(), '<?php echo esc_js($star); ?> ', '<?php echo esc_js($read); ?> ', '<?php echo esc_js($filter); ?> ', jQuery('.gform-filter-field').val(), jQuery('.gform-filter-operator').val());"><?php esc_html_e('Search', 'gravityforms'); ?> </a> <div id="entry_filters" style="float:right"></div> </div> <div class="tablenav"> <div class="alignleft actions" style="padding:8px 0 7px 0;"> <label class="hidden" for="bulk_action"> <?php esc_html_e('Bulk action', 'gravityforms'); ?> </label> <select name="bulk_action" id="bulk_action"> <option value=''><?php esc_html_e(' Bulk action ', 'gravityforms'); ?> </option> <?php switch ($filter) { case 'trash': ?> <option value='restore'><?php esc_html_e('Restore', 'gravityforms'); ?> </option> <?php if (GFCommon::current_user_can_any('gravityforms_delete_entries')) { ?> <option value='delete'><?php esc_html_e('Delete Permanently', 'gravityforms'); ?> </option> <?php } break; case 'spam': ?> <option value='unspam'><?php esc_html_e('Not Spam', 'gravityforms'); ?> </option> <?php if (GFCommon::current_user_can_any('gravityforms_delete_entries')) { ?> <option value='delete'><?php esc_html_e('Delete Permanently', 'gravityforms'); ?> </option> <?php } break; default: ?> <option value='mark_read'><?php esc_html_e('Mark as Read', 'gravityforms'); ?> </option> <option value='mark_unread'><?php esc_html_e('Mark as Unread', 'gravityforms'); ?> </option> <option value='add_star'><?php esc_html_e('Add Star', 'gravityforms'); ?> </option> <option value='remove_star'><?php esc_html_e('Remove Star', 'gravityforms'); ?> </option> <option value='resend_notifications'><?php esc_html_e('Resend Notifications', 'gravityforms'); ?> </option> <option value='print'><?php esc_html_e('Print', 'gravityforms'); ?> </option> <?php if (GFCommon::spam_enabled($form_id)) { ?> <option value='spam'><?php esc_html_e('Spam', 'gravityforms'); ?> </option> <?php } if (GFCommon::current_user_can_any('gravityforms_delete_entries')) { ?> <option value='trash'><?php esc_html_e('Trash', 'gravityforms'); ?> </option> <?php } } ?> </select> <?php $apply_button = '<input type="submit" class="button" value="' . esc_attr__('Apply', 'gravityforms') . '" onclick="return handleBulkApply(\'bulk_action\');" />'; /** * Allows for the modification of the Entry apply button HTML (When modifying entries) * * @param string $apply_button The Entry apply button HTML */ echo apply_filters('gform_entry_apply_button', $apply_button); if (in_array($filter, array('trash', 'spam'))) { $message = $filter == 'trash' ? esc_html__("WARNING! This operation cannot be undone. Empty trash? 'Ok' to empty trash. 'Cancel' to abort.", 'gravityforms') : esc_html__("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'); ?> <input type="submit" class="button" name="button_delete_permanently" value="<?php echo esc_attr($button_label); ?> " onclick="return confirm('<?php echo esc_js($message); ?> ');" /> <?php } ?> <div id="notifications_modal_container" style="display:none;"> <div id="notifications_container"> <div id="post_tag" class="tagsdiv"> <div id="resend_notifications_options"> <?php $notifications = GFCommon::get_notifications('resend_notifications', $form); if (!is_array($notifications) || count($form['notifications']) <= 0) { ?> <p class="description"><?php esc_html_e('You cannot resend notifications for these entries because this form does not currently have any notifications configured.', 'gravityforms'); ?> </p> <a href="<?php echo esc_url(admin_url("admin.php?page=gf_edit_forms&view=settings&subview=notification&id={$form['id']}")); ?> " class="button"><?php esc_html_e('Configure Notifications', 'gravityforms'); ?> </a> <?php } else { ?> <p class="description"><?php esc_html_e('Specify which notifications you would like to resend for the selected entries.', 'gravityforms'); ?> </p> <?php foreach ($notifications as $notification) { ?> <input type="checkbox" class="gform_notifications" value="<?php echo esc_attr($notification['id']); ?> " id="notification_<?php echo esc_attr($notification['id']); ?> " onclick="toggleNotificationOverride();" /> <label for="notification_<?php echo esc_attr($notification['id']); ?> "><?php echo esc_html($notification['name']); ?> </label> <br /><br /> <?php } ?> <div id="notifications_override_settings" style="display:none;"> <p class="description" style="padding-top:0; margin-top:0;"> <?php esc_html_e('You may override the default notification settings by entering a comma delimited list of emails to which the selected notifications should be sent.', 'gravityforms'); ?> </p> <label for="notification_override_email"><?php esc_html_e('Send To', 'gravityforms'); ?> <?php gform_tooltip('notification_override_email'); ?> </label><br /> <input type="text" name="notification_override_email" id="notification_override_email" style="width:99%;" /><br /><br /> </div> <input type="button" name="notification_resend" id="notification_resend" value="<?php esc_attr_e('Resend Notifications', 'gravityforms'); ?> " class="button" style="" onclick="BulkResendNotifications();" /> <span id="please_wait_container" style="display:none; margin-left: 5px;"> <i class='gficon-gravityforms-spinner-icon gficon-spin'></i> <?php esc_html_e('Resending...', 'gravityforms'); ?> </span> <?php } ?> </div> <div id="resend_notifications_close" style="display:none;margin:10px 0 0;"> <input type="button" name="resend_notifications_close_button" value="<?php esc_attr_e('Close Window', 'gravityforms'); ?> " class="button" style="" onclick="closeModal(true);" /> </div> </div> </div> </div> <!-- / Resend Notifications --> <div id="print_modal_container" style="display:none;"> <div id="print_container"> <div class="tagsdiv"> <div id="print_options"> <p class="description"><?php esc_html_e('Print all of the selected entries at once.', 'gravityforms'); ?> </p> <?php if (GFCommon::current_user_can_any('gravityforms_view_entry_notes')) { ?> <input type="checkbox" name="gform_print_notes" value="print_notes" checked="checked" id="gform_print_notes" /> <label for="gform_print_notes"><?php esc_html_e('Include notes', 'gravityforms'); ?> </label> <br /><br /> <?php } ?> <input type="checkbox" name="gform_print_page_break" value="print_notes" checked="checked" id="gform_print_page_break" /> <label for="gform_print_page_break"><?php esc_html_e('Add page break between entries', 'gravityforms'); ?> </label> <br /><br /> <input type="button" value="<?php esc_attr_e('Print', 'gravityforms'); ?> " class="button" onclick="BulkPrint();" /> </div> </div> </div> </div> <!-- / Print --> </div> <?php echo self::display_paging_links('header', $page_links, $first_item_index, $page_size, $total_count); ?> <div class="clear"></div> </div> <table class="widefat fixed" cellspacing="0"> <thead> <tr> <th scope="col" id="cb" class="manage-column column-cb check-column"> <input type="checkbox" class="headercb" /></th> <?php if (!in_array($filter, array('spam', 'trash'))) { ?> <th scope="col" id="cb" class="manage-column column-cb check-column"> </th> <?php } foreach ($columns as $field_id => $field_info) { $dir = $field_id == 0 ? 'DESC' : 'ASC'; //default every field so ascending sorting except date_created (id=0) if ($field_id == $sort_field) { //reverting direction if clicking on the currently sorted field $dir = $sort_direction == 'ASC' ? 'DESC' : 'ASC'; } ?> <th scope="col" class="manage-column entry_nowrap" onclick="Search('<?php echo esc_js($field_id); ?> ', '<?php echo esc_js($dir); ?> ', <?php echo absint($form_id); ?> , '<?php echo esc_js($search); ?> ', '<?php echo esc_js($star); ?> ', '<?php echo esc_js($read); ?> ', '<?php echo esc_js($filter); ?> ', '<?php echo esc_js($search_field_id); ?> ', '<?php echo esc_js($search_operator); ?> ');" style="cursor:pointer;"><?php echo esc_html($field_info['label']); ?> </th> <?php } ?> <th scope="col" align="right" width="50"> <a title="<?php esc_attr_e('click to select columns to display', 'gravityforms'); ?> " href="<?php echo trailingslashit(site_url(null, 'admin')); ?> ?gf_page=select_columns&id=<?php echo absint($form_id); ?> &TB_iframe=true&height=365&width=600" class="thickbox entries_edit_icon"><i class="fa fa-cog"></i></a> </th> </tr> </thead> <tfoot> <tr> <th scope="col" id="cb" class="manage-column column-cb check-column" style=""><input type="checkbox" /></th> <?php if (!in_array($filter, array('spam', 'trash'))) { ?> <th scope="col" id="cb" class="manage-column column-cb check-column"> </th> <?php } foreach ($columns as $field_id => $field_info) { $dir = $field_id == 0 ? 'DESC' : 'ASC'; //default every field so ascending sorting except date_created (id=0) if ($field_id == $sort_field) { //reverting direction if clicking on the currently sorted field $dir = $sort_direction == 'ASC' ? 'DESC' : 'ASC'; } ?> <th scope="col" class="manage-column entry_nowrap" onclick="Search('<?php echo esc_js($field_id); ?> ', '<?php echo esc_js($dir); ?> ', <?php echo absint($form_id); ?> , '<?php echo esc_js($search); ?> ', '<?php echo esc_js($star); ?> ', '<?php echo esc_js($read); ?> ', '<?php echo esc_js($filter); ?> ', '<?php echo esc_js($search_field_id); ?> ', '<?php echo esc_js($search_operator); ?> ');" style="cursor:pointer;"><?php echo esc_html($field_info['label']); ?> </th> <?php } ?> <th scope="col" style="width:15px;"> <a title="<?php esc_attr_e('click to select columns to display', 'gravityforms'); ?> " href="<?php echo trailingslashit(site_url()); ?> ?gf_page=select_columns&id=<?php echo absint($form_id); ?> &TB_iframe=true&height=365&width=600" class="thickbox entries_edit_icon"><i class=fa-cog"></i></a> </th> </tr> </tfoot> <tbody data-wp-lists="list:gf_entry" class="user-list" id="gf_entry_list"> <?php if (sizeof($leads) > 0) { $field_ids = array_keys($columns); $gf_entry_locking = new GFEntryLocking(); $alternate_row = false; foreach ($leads as $position => $lead) { $position = $page_size * $page_index + $position; ?> <tr id="lead_row_<?php echo esc_attr($lead['id']); ?> " class='author-self status-inherit <?php echo $lead['is_read'] ? '' : 'lead_unread'; ?> <?php echo $lead['is_starred'] ? 'lead_starred' : ''; ?> <?php echo in_array($filter, array('trash', 'spam')) ? 'lead_spam_trash' : ''; ?> <?php $gf_entry_locking->list_row_class($lead['id']); ?> <?php echo ($alternate_row = !$alternate_row) ? 'alternate' : ''; ?> ' valign="top" data-id="<?php echo esc_attr($lead['id']); ?> "> <th scope="row" class="check-column"> <input type="checkbox" name="lead[]" value="<?php echo esc_attr($lead['id']); ?> " /> <?php $gf_entry_locking->lock_indicator(); ?> </th> <?php if (!in_array($filter, array('spam', 'trash'))) { ?> <td> <img id="star_image_<?php echo esc_attr($lead['id']); ?> " src="<?php echo GFCommon::get_base_url(); ?> /images/star<?php echo intval($lead['is_starred']); ?> .png" onclick="ToggleStar(this, '<?php echo esc_js($lead['id']); ?> ','<?php echo esc_js($filter); ?> ');" /> </td> <?php } $is_first_column = true; $nowrap_class = 'entry_nowrap'; foreach ($field_ids as $field_id) { $field = RGFormsModel::get_field($form, $field_id); $value = rgar($lead, $field_id); if (!empty($field) && $field->type == 'post_category') { $value = GFCommon::prepare_post_category_value($value, $field, 'entry_list'); } //filtering lead value $value = apply_filters('gform_get_field_value', $value, $lead, $field); $input_type = !empty($columns[$field_id]['inputType']) ? $columns[$field_id]['inputType'] : $columns[$field_id]['type']; switch ($input_type) { case 'source_url': $value = "<a href='" . esc_attr($lead['source_url']) . "' target='_blank' alt='" . esc_attr($lead['source_url']) . "' title='" . esc_attr($lead['source_url']) . "'>.../" . esc_attr(GFCommon::truncate_url($lead['source_url'])) . '</a>'; break; case 'date_created': case 'payment_date': $value = GFCommon::format_date($value, false); break; case 'payment_amount': $value = GFCommon::to_money($value, $lead['currency']); break; case 'created_by': if (!empty($value)) { $userdata = get_userdata($value); if (!empty($userdata)) { $value = $userdata->user_login; } } break; default: if ($field !== null) { $value = $field->get_value_entry_list($value, $lead, $field_id, $columns, $form); } else { $value = esc_html($value); } } $value = apply_filters('gform_entries_field_value', $value, $form_id, $field_id, $lead); /* ^ maybe move to function */ $query_string = "gf_entries&view=entry&id={$form_id}&lid={$lead['id']}{$search_qs}{$sort_qs}{$dir_qs}{$filter_qs}&paged=" . ($page_index + 1); if ($is_first_column) { ?> <td class="column-title"> <a href="admin.php?page=gf_entries&view=entry&id=<?php echo absint($form_id); ?> &lid=<?php echo esc_attr($lead['id'] . $search_qs . $sort_qs . $dir_qs . $filter_qs); ?> &paged=<?php echo $page_index + 1; ?> &pos=<?php echo $position; ?> &field_id=<?php echo esc_attr($search_field_id); ?> &operator=<?php echo esc_attr($search_operator); ?> "><?php echo $value; ?> </a> <?php $gf_entry_locking->lock_info($lead['id']); ?> <div class="row-actions"> <?php switch ($filter) { case 'trash': ?> <span class="edit"> <a title="<?php esc_attr_e('View this entry', 'gravityforms'); ?> " href="admin.php?page=gf_entries&view=entry&id=<?php echo absint($form_id); ?> &lid=<?php echo esc_attr($lead['id'] . $search_qs . $sort_qs . $dir_qs . $filter_qs); ?> &paged=<?php echo $page_index + 1; ?> &pos=<?php echo $position; ?> &field_id=<?php echo esc_attr($search_field_id); ?> &operator=<?php echo esc_attr($search_operator); ?> "><?php esc_html_e('View', 'gravityforms'); ?> </a> | </span> <span class="edit"> <a data-wp-lists='delete:gf_entry_list:lead_row_<?php echo esc_attr($lead['id']); ?> ::status=active&entry=<?php echo esc_attr($lead['id']); ?> ' title="<?php esc_attr_e('Restore this entry', 'gravityforms'); ?> " href="<?php echo wp_nonce_url('?page=gf_entries', 'gf_delete_entry'); ?> "><?php esc_html_e('Restore', 'gravityforms'); ?> </a> <?php echo GFCommon::current_user_can_any('gravityforms_delete_entries') ? '|' : ''; ?> </span> <?php if (GFCommon::current_user_can_any('gravityforms_delete_entries')) { ?> <span class="delete"> <?php $delete_link = '<a data-wp-lists="delete:gf_entry_list:lead_row_' . esc_attr($lead['id']) . '::status=delete&entry=' . esc_attr($lead['id']) . '" title="' . esc_attr__('Delete this entry permanently', 'gravityforms') . '" href="' . wp_nonce_url('?page=gf_entries', 'gf_delete_entry') . '">' . esc_html__('Delete Permanently', 'gravityforms') . '</a>'; /** * Allows for modification of a Form entry "delete" link * * @param string $delete_link The Entry Delete Link (Formatted in HTML) */ echo apply_filters('gform_delete_entry_link', $delete_link); ?> </span> <?php } break; case 'spam': ?> <span class="edit"> <a title="<?php esc_attr_e('View this entry', 'gravityforms'); ?> " href="admin.php?page=gf_entries&view=entry&id=<?php echo absint($form_id); ?> &lid=<?php echo esc_attr($lead['id'] . $search_qs . $sort_qs . $dir_qs . $filter_qs); ?> &paged=<?php echo $page_index + 1; ?> &pos=<?php echo $position; ?> "><?php esc_html_e('View', 'gravityforms'); ?> </a> | </span> <span class="unspam"> <a data-wp-lists='delete:gf_entry_list:lead_row_<?php echo esc_attr($lead['id']); ?> ::status=unspam&entry=<?php echo esc_attr($lead['id']); ?> ' title="<?php esc_attr_e('Mark this entry as not spam', 'gravityforms'); ?> " href="<?php echo wp_nonce_url('?page=gf_entries', 'gf_delete_entry'); ?> "><?php esc_html_e('Not Spam', 'gravityforms'); ?> </a> <?php echo GFCommon::current_user_can_any('gravityforms_delete_entries') ? '|' : ''; ?> </span> <?php if (GFCommon::current_user_can_any('gravityforms_delete_entries')) { ?> <span class="delete"> <?php $delete_link = '<a data-wp-lists="delete:gf_entry_list:lead_row_' . esc_attr($lead['id']) . '::status=delete&entry=' . esc_attr($lead['id']) . '" title="' . esc_attr__('Delete this entry permanently', 'gravityforms') . '" href="' . wp_nonce_url('?page=gf_entries', 'gf_delete_entry') . '">' . esc_html__('Delete Permanently', 'gravityforms') . '</a>'; /** * Allows for modification of a Form entry "delete" link * * @param string $delete_link The Entry Delete Link (Formatted in HTML) */ echo apply_filters('gform_delete_entry_link', $delete_link); ?> </span> <?php } break; default: ?> <span class="edit"> <a title="<?php esc_attr_e('View this entry', 'gravityforms'); ?> " href="admin.php?page=gf_entries&view=entry&id=<?php echo absint($form_id); ?> &lid=<?php echo esc_attr($lead['id'] . $search_qs . $sort_qs . $dir_qs . $filter_qs); ?> &paged=<?php echo $page_index + 1; ?> &pos=<?php echo $position; ?> &field_id=<?php echo esc_attr($search_field_id); ?> &operator=<?php echo esc_attr($search_operator); ?> "><?php esc_html_e('View', 'gravityforms'); ?> </a> | </span> <span class="edit"> <a id="mark_read_<?php echo esc_attr($lead['id']); ?> " title="Mark this entry as read" href="javascript:ToggleRead('<?php echo esc_js($lead['id']); ?> ', '<?php echo esc_js($filter); ?> ');" style="display:<?php echo $lead['is_read'] ? 'none' : 'inline'; ?> ;"><?php esc_html_e('Mark read', 'gravityforms'); ?> </a><a id="mark_unread_<?php echo absint($lead['id']); ?> " title="<?php esc_attr_e('Mark this entry as unread', 'gravityforms'); ?> " href="javascript:ToggleRead('<?php echo esc_js($lead['id']); ?> ', '<?php echo esc_js($filter); ?> ');" style="display:<?php echo $lead['is_read'] ? 'inline' : 'none'; ?> ;"><?php esc_html_e('Mark unread', 'gravityforms'); ?> </a> <?php echo GFCommon::current_user_can_any('gravityforms_delete_entries') || GFCommon::akismet_enabled($form_id) ? '|' : ''; ?> </span> <?php if (GFCommon::spam_enabled($form_id)) { ?> <span class="spam"> <a data-wp-lists='delete:gf_entry_list:lead_row_<?php echo esc_attr($lead['id']); ?> ::status=spam&entry=<?php echo esc_attr($lead['id']); ?> ' title="<?php esc_attr_e('Mark this entry as spam', 'gravityforms'); ?> " href="<?php echo wp_nonce_url('?page=gf_entries', 'gf_delete_entry'); ?> "><?php esc_html_e('Spam', 'gravityforms'); ?> </a> <?php echo GFCommon::current_user_can_any('gravityforms_delete_entries') ? '|' : ''; ?> </span> <?php } if (GFCommon::current_user_can_any('gravityforms_delete_entries')) { ?> <span class="trash"> <a data-wp-lists='delete:gf_entry_list:lead_row_<?php echo esc_attr($lead['id']); ?> ::status=trash&entry=<?php echo esc_attr($lead['id']); ?> ' title="<?php esc_attr_e('Move this entry to the trash', 'gravityforms'); ?> " href="<?php echo wp_nonce_url('?page=gf_entries', 'gf_delete_entry'); ?> "><?php esc_html_e('Trash', 'gravityforms'); ?> </a> </span> <?php } break; } do_action('gform_entries_first_column_actions', $form_id, $field_id, $value, $lead, $query_string); ?> </div> <?php do_action('gform_entries_first_column', $form_id, $field_id, $value, $lead, $query_string); ?> </td> <?php } else { ?> <td class="<?php echo $nowrap_class; ?> "> <?php echo apply_filters('gform_entries_column_filter', $value, $form_id, $field_id, $lead, $query_string); ?> <?php do_action('gform_entries_column', $form_id, $field_id, $value, $lead, $query_string); ?> </td> <?php } $is_first_column = false; } ?> <td> </td> </tr> <?php } } else { $column_count = sizeof($columns) + 3; switch ($filter) { case 'unread': $message = isset($_GET['field_id']) ? esc_html__('This form does not have any unread entries matching the search criteria.', 'gravityforms') : esc_html__('This form does not have any unread entries.', 'gravityforms'); break; case 'star': $message = isset($_GET['field_id']) ? esc_html__('This form does not have any starred entries matching the search criteria.', 'gravityforms') : esc_html__('This form does not have any starred entries.', 'gravityforms'); break; case 'spam': $message = esc_html__('This form does not have any spam.', 'gravityforms'); $column_count = sizeof($columns) + 2; break; case 'trash': $message = isset($_GET['field_id']) ? esc_html__('This form does not have any entries in the trash matching the search criteria.', 'gravityforms') : esc_html__('This form does not have any entries in the trash.', 'gravityforms'); $column_count = sizeof($columns) + 2; break; default: $message = isset($_GET['field_id']) ? esc_html__('This form does not have any entries matching the search criteria.', 'gravityforms') : esc_html__('This form does not have any entries yet.', 'gravityforms'); } ?> <tr> <td colspan="<?php echo esc_attr($column_count); ?> " style="padding:20px;"><?php echo esc_html($message); ?> </td> </tr> <?php } ?> </tbody> </table> <div class="clear"></div> <div class="tablenav"> <div class="alignleft actions" style="padding:8px 0 7px 0;"> <label class="hidden" for="bulk_action2"> <?php esc_html_e('Bulk action', 'gravityforms'); ?> </label> <select name="bulk_action2" id="bulk_action2"> <option value=''><?php esc_html_e(' Bulk action ', 'gravityforms'); ?> </option> <?php switch ($filter) { case 'trash': ?> <option value='restore'><?php esc_html_e('Restore', 'gravityforms'); ?> </option> <?php if (GFCommon::current_user_can_any('gravityforms_delete_entries')) { ?> <option value='delete'><?php esc_html_e('Delete Permanently', 'gravityforms'); ?> </option> <?php } break; case 'spam': ?> <option value='unspam'><?php esc_html_e('Not Spam', 'gravityforms'); ?> </option> <?php if (GFCommon::current_user_can_any('gravityforms_delete_entries')) { ?> <option value='delete'><?php esc_html_e('Delete Permanently', 'gravityforms'); ?> </option> <?php } break; default: ?> <option value='mark_read'><?php esc_html_e('Mark as Read', 'gravityforms'); ?> </option> <option value='mark_unread'><?php esc_html_e('Mark as Unread', 'gravityforms'); ?> </option> <option value='add_star'><?php esc_html_e('Add Star', 'gravityforms'); ?> </option> <option value='remove_star'><?php esc_html_e('Remove Star', 'gravityforms'); ?> </option> <option value='resend_notifications'><?php esc_html_e('Resend Notifications', 'gravityforms'); ?> </option> <option value='print'><?php esc_html_e('Print Entries', 'gravityforms'); ?> </option> <?php if (GFCommon::spam_enabled($form_id)) { ?> <option value='spam'><?php esc_html_e('Spam', 'gravityforms'); ?> </option> <?php } if (GFCommon::current_user_can_any('gravityforms_delete_entries')) { ?> <option value='trash'><?php esc_html_e('Move to Trash', 'gravityforms'); ?> </option> <?php } } ?> </select> <?php $apply_button = '<input type="submit" class="button" value="' . esc_attr__('Apply', 'gravityforms') . '" onclick="return handleBulkApply(\'bulk_action2\');" />'; /** * Allows for the modification of the Entry apply button HTML (When modifying entries) * * @param string $apply_button The Entry apply button HTML */ echo apply_filters('gform_entry_apply_button', $apply_button); ?> </div> <?php echo self::display_paging_links('footer', $page_links, $first_item_index, $page_size, $total_count); ?> <div class="clear"></div> </div> </form> </div> <?php }
/** * Returns the field inner markup. * * @param array $form The Form Object currently being processed. * @param string|array $value The field value. From default/dynamic population, $_POST, or a resumed incomplete submission. * @param null|array $entry Null or the Entry Object currently being edited. * * @return string */ public function get_field_input($form, $value = '', $entry = null) { $form_id = absint($form['id']); $is_entry_detail = $this->is_entry_detail(); $is_form_editor = $this->is_form_editor(); $id = $this->id; $field_id = $is_entry_detail || $is_form_editor || $form_id == 0 ? "input_{$id}" : 'input_' . $form_id . "_{$id}"; $logic_event = $this->get_conditional_logic_event('keyup'); $size = $this->size; $class_suffix = $is_entry_detail ? '_admin' : ''; $class = $size . $class_suffix; $css_class = trim(esc_attr($class) . ' gfield_select'); $tabindex = $this->get_tabindex(); $disabled_text = $is_form_editor ? 'disabled="disabled"' : ''; /** * Allow the placeholder used by the enhanced ui to be overridden * * @param string $placeholder The placeholder text. * @param integer $form_id The ID of the current form. */ $placeholder = gf_apply_filters(array('gform_multiselect_placeholder', $form_id, $this->id), __('Click to select...', 'gravityforms'), $form_id, $this); $placeholder = $this->enableEnhancedUI ? "data-placeholder='" . esc_attr($placeholder) . "'" : ''; $size = $this->multiSelectSize; if (empty($size)) { $size = 7; } return sprintf("<div class='ginput_container ginput_container_multiselect'><select multiple='multiple' {$placeholder} size='{$size}' name='input_%d[]' id='%s' {$logic_event} class='%s' {$tabindex} %s>%s</select></div>", $id, esc_attr($field_id), $css_class, $disabled_text, $this->get_choices($value)); }
public function register_init_scripts($form) { if (!$this->has_copy_cat_field($form)) { return; } $copy_fields = $this->get_copy_cat_fields($form); $enable_overwrite = gf_apply_filters('gpcc_overwrite_existing_values', $form['id'], false, $form); $script = 'new gwCopyObj( ' . $form['id'] . ', ' . json_encode($copy_fields) . ', ' . ($enable_overwrite ? 'true' : 'false') . ' );'; GFFormDisplay::add_init_script($form['id'], 'gp-copy-cat', GFFormDisplay::ON_PAGE_RENDER, $script); }
public function get_field_input($form, $value = '', $entry = null) { if (is_array($value)) { $value = array_values($value); } $form_id = $form['id']; $is_entry_detail = $this->is_entry_detail(); $is_form_editor = $this->is_form_editor(); $is_admin = $is_entry_detail || $is_form_editor; $id = (int) $this->id; $field_id = $is_entry_detail || $is_form_editor || $form_id == 0 ? "input_{$id}" : 'input_' . $form_id . "_{$id}"; $class_suffix = $is_entry_detail ? '_admin' : ''; $form_sub_label_placement = rgar($form, 'subLabelPlacement'); $field_sub_label_placement = $this->subLabelPlacement; $is_sub_label_above = $field_sub_label_placement == 'above' || empty($field_sub_label_placement) && $form_sub_label_placement == 'above'; $sub_label_class_attribute = $field_sub_label_placement == 'hidden_label' ? "class='hidden_sub_label screen-reader-text'" : ''; $disabled_text = $is_form_editor ? 'disabled="disabled"' : ''; $first_tabindex = $this->get_tabindex(); $last_tabindex = $this->get_tabindex(); $strength_style = !$this->passwordStrengthEnabled ? "style='display:none;'" : ''; $strength_indicator_label = esc_html__('Strength indicator', 'gravityforms'); $strength = $this->passwordStrengthEnabled || $is_admin ? "<div id='{$field_id}_strength_indicator' class='gfield_password_strength' {$strength_style}>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{$strength_indicator_label}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<input type='hidden' class='gform_hidden' id='{$field_id}_strength' name='input_{$id}_strength' />" : ''; $action = !$is_admin ? "gformShowPasswordStrength(\"{$field_id}\");" : ''; $onchange = $this->passwordStrengthEnabled ? "onchange='{$action}'" : ''; $onkeyup = $this->passwordStrengthEnabled ? "onkeyup='{$action}'" : ''; $confirmation_value = rgpost('input_' . $id . '_2'); $password_value = is_array($value) ? $value[0] : $value; $password_value = esc_attr($password_value); $confirmation_value = esc_attr($confirmation_value); $enter_password_field_input = GFFormsModel::get_input($this, $this->id . ''); $confirm_password_field_input = GFFormsModel::get_input($this, $this->id . '.2'); $enter_password_label = rgar($enter_password_field_input, 'customLabel') != '' ? $enter_password_field_input['customLabel'] : esc_html__('Enter Password', 'gravityforms'); $enter_password_label = gf_apply_filters(array('gform_password', $form_id), $enter_password_label, $form_id); $confirm_password_label = rgar($confirm_password_field_input, 'customLabel') != '' ? $confirm_password_field_input['customLabel'] : esc_html__('Confirm Password', 'gravityforms'); $confirm_password_label = gf_apply_filters(array('gform_password_confirm', $form_id), $confirm_password_label, $form_id); $required_attribute = $this->isRequired ? 'aria-required="true"' : ''; $invalid_attribute = $this->failed_validation ? 'aria-invalid="true"' : 'aria-invalid="false"'; $enter_password_placeholder_attribute = GFCommon::get_input_placeholder_attribute($enter_password_field_input); $confirm_password_placeholder_attribute = GFCommon::get_input_placeholder_attribute($confirm_password_field_input); if ($is_sub_label_above) { return "<div class='ginput_complex{$class_suffix} ginput_container ginput_container_password' id='{$field_id}_container'>\n\t\t\t\t\t<span id='{$field_id}_1_container' class='ginput_left'>\n\t\t\t\t\t\t<label for='{$field_id}' {$sub_label_class_attribute}>{$enter_password_label}</label>\n\t\t\t\t\t\t<input type='password' name='input_{$id}' id='{$field_id}' {$onkeyup} {$onchange} value='{$password_value}' {$first_tabindex} {$enter_password_placeholder_attribute} {$required_attribute} {$invalid_attribute} {$disabled_text}/>\n\t\t\t\t\t</span>\n\t\t\t\t\t<span id='{$field_id}_2_container' class='ginput_right'>\n\t\t\t\t\t\t<label for='{$field_id}_2' {$sub_label_class_attribute}>{$confirm_password_label}</label>\n\t\t\t\t\t\t<input type='password' name='input_{$id}_2' id='{$field_id}_2' {$onkeyup} {$onchange} value='{$confirmation_value}' {$last_tabindex} {$confirm_password_placeholder_attribute} {$required_attribute} {$invalid_attribute} {$disabled_text}/>\n\t\t\t\t\t</span>\n\t\t\t\t\t<div class='gf_clear gf_clear_complex'></div>\n\t\t\t\t</div>{$strength}"; } else { return "<div class='ginput_complex{$class_suffix} ginput_container ginput_container_password' id='{$field_id}_container'>\n\t\t\t\t\t<span id='{$field_id}_1_container' class='ginput_left'>\n\t\t\t\t\t\t<input type='password' name='input_{$id}' id='{$field_id}' {$onkeyup} {$onchange} value='{$password_value}' {$first_tabindex} {$enter_password_placeholder_attribute} {$required_attribute} {$invalid_attribute} {$disabled_text}/>\n\t\t\t\t\t\t<label for='{$field_id}' {$sub_label_class_attribute}>{$enter_password_label}</label>\n\t\t\t\t\t</span>\n\t\t\t\t\t<span id='{$field_id}_2_container' class='ginput_right'>\n\t\t\t\t\t\t<input type='password' name='input_{$id}_2' id='{$field_id}_2' {$onkeyup} {$onchange} value='{$confirmation_value}' {$last_tabindex} {$confirm_password_placeholder_attribute} {$required_attribute} {$invalid_attribute} {$disabled_text}/>\n\t\t\t\t\t\t<label for='{$field_id}_2' {$sub_label_class_attribute}>{$confirm_password_label}</label>\n\t\t\t\t\t</span>\n\t\t\t\t\t<div class='gf_clear gf_clear_complex'></div>\n\t\t\t\t</div>{$strength}"; } }
public function get_field_input($form, $value = '', $entry = null) { $form_id = $form['id']; $is_entry_detail = $this->is_entry_detail(); $is_form_editor = $this->is_form_editor(); $id = (int) $this->id; $field_id = $is_entry_detail || $is_form_editor || $form_id == 0 ? "input_{$id}" : 'input_' . $form_id . "_{$id}"; $product_name = !is_array($value) || empty($value[$this->id . '.1']) ? esc_attr($this->label) : esc_attr($value[$this->id . '.1']); $price = !is_array($value) || empty($value[$this->id . '.2']) ? $this->basePrice : esc_attr($value[$this->id . '.2']); $quantity = is_array($value) ? esc_attr($value[$this->id . '.3']) : ''; if (empty($price)) { $price = 0; } $has_quantity = sizeof(GFCommon::get_product_fields_by_type($form, array('quantity'), $this->id)) > 0; if ($has_quantity) { $this->disableQuantity = true; } $currency = $is_entry_detail && !empty($entry) ? $entry['currency'] : ''; $quantity_field = ''; $disabled_text = $is_form_editor ? 'disabled="disabled"' : ''; $qty_input_type = GFFormsModel::is_html5_enabled() ? 'number' : 'text'; $qty_min_attr = GFFormsModel::is_html5_enabled() ? "min='0'" : ''; $product_quantity_sub_label = gf_apply_filters(array('gform_product_quantity', $form_id, $this->id), esc_html__('Quantity:', 'gravityforms'), $form_id); if ($is_entry_detail || $is_form_editor) { $style = $this->disableQuantity ? "style='display:none;'" : ''; $quantity_field = " <span class='ginput_quantity_label' {$style}>{$product_quantity_sub_label}</span> <input type='{$qty_input_type}' name='input_{$id}.3' value='{$quantity}' id='ginput_quantity_{$form_id}_{$this->id}' class='ginput_quantity' size='10' {$disabled_text}/>"; } else { if (!$this->disableQuantity) { $tabindex = $this->get_tabindex(); $quantity_field .= " <span class='ginput_quantity_label'>" . $product_quantity_sub_label . "</span> <input type='{$qty_input_type}' name='input_{$id}.3' value='{$quantity}' id='ginput_quantity_{$form_id}_{$this->id}' class='ginput_quantity' size='10' {$qty_min_attr} {$tabindex} {$disabled_text}/>"; } else { if (!is_numeric($quantity)) { $quantity = 1; } if (!$has_quantity) { $quantity_field .= "<input type='hidden' name='input_{$id}.3' value='{$quantity}' class='ginput_quantity_{$form_id}_{$this->id} gform_hidden' />"; } } } return "<div class='ginput_container ginput_container_singleproduct'>\n\t\t\t\t\t<input type='hidden' name='input_{$id}.1' value='{$product_name}' class='gform_hidden' />\n\t\t\t\t\t<span class='ginput_product_price_label'>" . gf_apply_filters(array('gform_product_price', $form_id, $this->id), esc_html__('Price', 'gravityforms'), $form_id) . ":</span> <span class='ginput_product_price' id='{$field_id}'>" . esc_html(GFCommon::to_money($price, $currency)) . "</span>\n\t\t\t\t\t<input type='hidden' name='input_{$id}.2' id='ginput_base_price_{$form_id}_{$this->id}' class='gform_hidden' value='" . esc_attr($price) . "'/>\n\t\t\t\t\t{$quantity_field}\n\t\t\t\t</div>"; }
public function get_field_input($form, $value = '', $entry = null) { $form_id = $form['id']; $is_entry_detail = $this->is_entry_detail(); $is_form_editor = $this->is_form_editor(); $is_admin = $is_entry_detail || $is_form_editor; $id = (int) $this->id; $field_id = $is_entry_detail || $is_form_editor || $form_id == 0 ? "input_{$id}" : 'input_' . $form_id . "_{$id}"; $value = esc_attr($value); $size = $this->size; $class_suffix = $is_entry_detail ? '_admin' : ''; $class = $size . $class_suffix; $disabled_text = $is_form_editor ? 'disabled="disabled"' : ''; $title = esc_attr(rgget($this->id . '.1', $value)); $caption = esc_attr(rgget($this->id . '.4', $value)); $description = esc_attr(rgget($this->id . '.7', $value)); //hidding meta fields for admin $hidden_style = "style='display:none;'"; $title_style = !$this->displayTitle && $is_admin ? $hidden_style : ''; $caption_style = !$this->displayCaption && $is_admin ? $hidden_style : ''; $description_style = !$this->displayDescription && $is_admin ? $hidden_style : ''; $file_label_style = $is_admin && !($this->displayTitle || $this->displayCaption || $this->displayDescription) ? $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 = "<span class='ginput_preview'><strong>" . esc_html($file_info['uploaded_filename']) . "</strong> | <a href='javascript:;' onclick='gformDeleteUploadedFile({$form_id}, {$id});'>" . __('delete', 'gravityforms') . '</a></span>'; } //in admin, render all meta fields to allow for immediate feedback, but hide the ones not selected $file_label = $is_admin || $this->displayTitle || $this->displayCaption || $this->displayDescription ? "<label for='{$field_id}' class='ginput_post_image_file' {$file_label_style}>" . gf_apply_filters(array('gform_postimage_file', $form_id), __('File', 'gravityforms'), $form_id) . '</label>' : ''; $tabindex = $this->get_tabindex(); $upload = sprintf("<span class='ginput_full{$class_suffix}'>{$preview}<input name='input_%d' id='%s' type='file' value='%s' class='%s' {$tabindex} %s/>{$file_label}</span>", $id, $field_id, esc_attr($value), esc_attr($class . $hidden_class), $disabled_text); $tabindex = $this->get_tabindex(); $title_field = $this->displayTitle || $is_admin ? sprintf("<span class='ginput_full{$class_suffix} ginput_post_image_title' {$title_style}><input type='text' name='input_%d.1' id='%s_1' value='%s' {$tabindex} %s/><label for='%s_1'>" . gf_apply_filters(array('gform_postimage_title', $form_id), __('Title', 'gravityforms'), $form_id) . '</label></span>', $id, $field_id, $title, $disabled_text, $field_id) : ''; $tabindex = $this->get_tabindex(); $caption_field = $this->displayCaption || $is_admin ? sprintf("<span class='ginput_full{$class_suffix} ginput_post_image_caption' {$caption_style}><input type='text' name='input_%d.4' id='%s_4' value='%s' {$tabindex} %s/><label for='%s_4'>" . gf_apply_filters(array('gform_postimage_caption', $form_id), __('Caption', 'gravityforms'), $form_id) . '</label></span>', $id, $field_id, $caption, $disabled_text, $field_id) : ''; $tabindex = $this->get_tabindex(); $description_field = $this->displayDescription || $is_admin ? sprintf("<span class='ginput_full{$class_suffix} ginput_post_image_description' {$description_style}><input type='text' name='input_%d.7' id='%s_7' value='%s' {$tabindex} %s/><label for='%s_7'>" . gf_apply_filters(array('gform_postimage_description', $form_id), __('Description', 'gravityforms'), $form_id) . '</label></span>', $id, $field_id, $description, $disabled_text, $field_id) : ''; return "<div class='ginput_complex{$class_suffix} ginput_container ginput_container_post_image'>" . $upload . $title_field . $caption_field . $description_field . '</div>'; }
/** * Sends all active notifications for a form given an entry object and an event. * * @param $form * @param $entry * @param string $event Default = 'form_submission' * @param array $data Optional. Array of data which can be used in the notifications via the generic {object:property} merge tag. * * @return array */ public static function send_notifications($form, $entry, $event = 'form_submission', $data = array()) { if (rgempty('notifications', $form) || !is_array($form['notifications'])) { return array(); } $entry_id = rgar($entry, 'id'); GFCommon::log_debug("GFAPI::send_notifications(): Gathering notifications for {$event} event for entry #{$entry_id}."); $notifications_to_send = array(); //running through filters that disable form submission notifications foreach ($form['notifications'] as $notification) { if (rgar($notification, 'event') != $event) { continue; } if ($event == 'form_submission') { if (rgar($notification, 'type') == 'user' && gf_apply_filters(array('gform_disable_user_notification', $form['id']), false, $form, $entry)) { GFCommon::log_debug("GFAPI::send_notifications(): Notification is disabled by gform_disable_user_notification hook, not including notification (#{$notification['id']} - {$notification['name']})."); //skip user notification if it has been disabled by a hook continue; } elseif (rgar($notification, 'type') == 'admin' && gf_apply_filters(array('gform_disable_admin_notification', $form['id']), false, $form, $entry)) { GFCommon::log_debug("GFAPI::send_notifications(): Notification is disabled by gform_disable_admin_notification hook, not including notification (#{$notification['id']} - {$notification['name']})."); //skip admin notification if it has been disabled by a hook continue; } } if (gf_apply_filters(array('gform_disable_notification', $form['id']), false, $notification, $form, $entry)) { GFCommon::log_debug("GFAPI::send_notifications(): Notification is disabled by gform_disable_notification hook, not including notification (#{$notification['id']} - {$notification['name']})."); //skip notifications if it has been disabled by a hook continue; } $notifications_to_send[] = $notification['id']; } GFCommon::send_notifications($notifications_to_send, $form, $entry, true, $event, $data); }
public function get_field_input($form, $value = '', $entry = null) { $is_entry_detail = $this->is_entry_detail(); $is_form_editor = $this->is_form_editor(); $form_id = $form['id']; $id = intval($this->id); $field_id = $is_entry_detail || $is_form_editor || $form_id == 0 ? "input_{$id}" : 'input_' . $form_id . "_{$id}"; $form_id = ($is_entry_detail || $is_form_editor) && empty($form_id) ? rgget('id') : $form_id; $disabled_text = $is_form_editor ? "disabled='disabled'" : ''; $class_suffix = $is_entry_detail ? '_admin' : ''; $form_sub_label_placement = rgar($form, 'subLabelPlacement'); $field_sub_label_placement = $this->subLabelPlacement; $is_sub_label_above = $field_sub_label_placement == 'above' || empty($field_sub_label_placement) && $form_sub_label_placement == 'above'; $sub_label_class_attribute = $field_sub_label_placement == 'hidden_label' ? "class='hidden_sub_label screen-reader-text'" : ''; $card_number = ''; $card_name = ''; $expiration_month = ''; $expiration_year = ''; $security_code = ''; $autocomplete = RGFormsModel::is_html5_enabled() ? "autocomplete='off'" : ''; if (is_array($value)) { $card_number = esc_attr(rgget($this->id . '.1', $value)); $card_name = esc_attr(rgget($this->id . '.5', $value)); $expiration_date = rgget($this->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($this->id . '.3', $value)); } $action = !($is_entry_detail || $is_form_editor) ? "gformMatchCard(\"{$field_id}_1\");" : ''; $onchange = "onchange='{$action}'"; $onkeyup = "onkeyup='{$action}'"; $card_icons = ''; $cards = GFCommon::get_card_types(); $card_style = $this->creditCardStyle ? $this->creditCardStyle : 'style1'; foreach ($cards as $card) { $style = ''; if ($this->is_card_supported($card['slug'])) { $print_card = true; } elseif ($is_form_editor || $is_entry_detail) { $print_card = true; $style = "style='display:none;'"; } else { $print_card = false; } if ($print_card) { $card_icons .= "<div class='gform_card_icon gform_card_icon_{$card['slug']}' {$style}>{$card['name']}</div>"; } } $payment_methods = apply_filters('gform_payment_methods', array(), $this, $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 .= "<div class='gform_payment_option gform_payment_{$payment_method['key']}'><input type='radio' name='gform_payment_method' value='{$payment_method['key']}' id='gform_payment_method_{$payment_method['key']}' onclick='gformToggleCreditCard();' onkeypress='gformToggleCreditCard();' {$checked}/> {$payment_method['label']}</div>"; } } $checked = rgpost('gform_payment_method') == 'creditcard' || rgempty('gform_payment_method') ? "checked='checked'" : ''; $card_radio_button = empty($payment_options) ? '' : "<input type='radio' name='gform_payment_method' id='gform_payment_method_creditcard' value='creditcard' onclick='gformToggleCreditCard();' onkeypress='gformToggleCreditCard();' {$checked}/>"; $card_icons = "{$payment_options}<div class='gform_card_icon_container gform_card_icon_{$card_style}'>{$card_radio_button}{$card_icons}</div>"; //card number fields $tabindex = $this->get_tabindex(); $card_number_field_input = GFFormsModel::get_input($this, $this->id . '.1'); $html5_output = !is_admin() && GFFormsModel::is_html5_enabled() ? "pattern='[0-9]*' title='" . esc_attr__('Only digits are allowed', 'gravityforms') . "'" : ''; $card_number_label = rgar($card_number_field_input, 'customLabel') != '' ? $card_number_field_input['customLabel'] : esc_html__('Card Number', 'gravityforms'); $card_number_label = gf_apply_filters(array('gform_card_number', $form_id), $card_number_label, $form_id); $card_number_placeholder = $this->get_input_placeholder_attribute($card_number_field_input); if ($is_sub_label_above) { $card_field = "<span class='ginput_full{$class_suffix}' id='{$field_id}_1_container' >\n {$card_icons}\n <label for='{$field_id}_1' id='{$field_id}_1_label' {$sub_label_class_attribute}>{$card_number_label}</label>\n <input type='text' name='input_{$id}.1' id='{$field_id}_1' value='{$card_number}' {$tabindex} {$disabled_text} {$onchange} {$onkeyup} {$autocomplete} {$html5_output} {$card_number_placeholder}/>\n </span>"; } else { $card_field = "<span class='ginput_full{$class_suffix}' id='{$field_id}_1_container' >\n {$card_icons}\n <input type='text' name='input_{$id}.1' id='{$field_id}_1' value='{$card_number}' {$tabindex} {$disabled_text} {$onchange} {$onkeyup} {$autocomplete} {$html5_output} {$card_number_placeholder}/>\n <label for='{$field_id}_1' id='{$field_id}_1_label' {$sub_label_class_attribute}>{$card_number_label}</label>\n </span>"; } //expiration date field $expiration_month_tab_index = $this->get_tabindex(); $expiration_year_tab_index = $this->get_tabindex(); $expiration_month_input = GFFormsModel::get_input($this, $this->id . '.2_month'); $expiration_month_placeholder = $this->get_input_placeholder_value($expiration_month_input); $expiration_year_input = GFFormsModel::get_input($this, $this->id . '.2_year'); $expiration_year_placeholder = $this->get_input_placeholder_value($expiration_year_input); $expiration_months = $this->get_expiration_months($expiration_month, $expiration_month_placeholder); $expiration_years = $this->get_expiration_years($expiration_year, $expiration_year_placeholder); $expiration_label = rgar($expiration_month_input, 'customLabel') != '' ? $expiration_month_input['customLabel'] : esc_html__('Expiration Date', 'gravityforms'); $expiration_label = gf_apply_filters(array('gform_card_expiration', $form_id), $expiration_label, $form_id); if ($is_sub_label_above) { $expiration_field = "<span class='ginput_full{$class_suffix} ginput_cardextras' id='{$field_id}_2_container'>\n <span class='ginput_cardinfo_left{$class_suffix}' id='{$field_id}_2_cardinfo_left'>\n <span class='ginput_card_expiration_container ginput_card_field'>\n <label for='{$field_id}_2_month' {$sub_label_class_attribute}>{$expiration_label}</label>\n <select name='input_{$id}.2[]' id='{$field_id}_2_month' {$expiration_month_tab_index} {$disabled_text} class='ginput_card_expiration ginput_card_expiration_month'>\n {$expiration_months}\n </select>\n <select name='input_{$id}.2[]' id='{$field_id}_2_year' {$expiration_year_tab_index} {$disabled_text} class='ginput_card_expiration ginput_card_expiration_year'>\n {$expiration_years}\n </select>\n </span>\n </span>"; } else { $expiration_field = "<span class='ginput_full{$class_suffix} ginput_cardextras' id='{$field_id}_2_container'>\n <span class='ginput_cardinfo_left{$class_suffix}' id='{$field_id}_2_cardinfo_left'>\n <span class='ginput_card_expiration_container ginput_card_field'>\n <select name='input_{$id}.2[]' id='{$field_id}_2_month' {$expiration_month_tab_index} {$disabled_text} class='ginput_card_expiration ginput_card_expiration_month'>\n {$expiration_months}\n </select>\n <select name='input_{$id}.2[]' id='{$field_id}_2_year' {$expiration_year_tab_index} {$disabled_text} class='ginput_card_expiration ginput_card_expiration_year'>\n {$expiration_years}\n </select>\n <label for='{$field_id}_2_month' {$sub_label_class_attribute}>{$expiration_label}</label>\n </span>\n </span>"; } //security code field $tabindex = $this->get_tabindex(); $security_code_field_input = GFFormsModel::get_input($this, $this->id . '.3'); $security_code_label = rgar($security_code_field_input, 'customLabel') != '' ? $security_code_field_input['customLabel'] : esc_html__('Security Code', 'gravityforms'); $security_code_label = gf_apply_filters(array('gform_card_security_code', $form_id), $security_code_label, $form_id); $html5_output = GFFormsModel::is_html5_enabled() ? "pattern='[0-9]*' title='" . esc_attr__('Only digits are allowed', 'gravityforms') . "'" : ''; $security_code_placeholder = $this->get_input_placeholder_attribute($security_code_field_input); if ($is_sub_label_above) { $security_field = "<span class='ginput_cardinfo_right{$class_suffix}' id='{$field_id}_2_cardinfo_right'>\n <label for='{$field_id}_3' {$sub_label_class_attribute}>{$security_code_label}</label>\n <input type='text' name='input_{$id}.3' id='{$field_id}_3' {$tabindex} {$disabled_text} class='ginput_card_security_code' value='{$security_code}' {$autocomplete} {$html5_output} {$security_code_placeholder} />\n <span class='ginput_card_security_code_icon'> </span>\n </span>\n </span>"; } else { $security_field = "<span class='ginput_cardinfo_right{$class_suffix}' id='{$field_id}_2_cardinfo_right'>\n <input type='text' name='input_{$id}.3' id='{$field_id}_3' {$tabindex} {$disabled_text} class='ginput_card_security_code' value='{$security_code}' {$autocomplete} {$html5_output} {$security_code_placeholder}/>\n <span class='ginput_card_security_code_icon'> </span>\n <label for='{$field_id}_3' {$sub_label_class_attribute}>{$security_code_label}</label>\n </span>\n </span>"; } $tabindex = $this->get_tabindex(); $card_name_field_input = GFFormsModel::get_input($this, $this->id . '.5'); $card_name_label = rgar($card_name_field_input, 'customLabel') != '' ? $card_name_field_input['customLabel'] : esc_html__('Cardholder Name', 'gravityforms'); $card_name_label = gf_apply_filters(array('gform_card_name', $form_id), $card_name_label, $form_id); $card_name_placeholder = $this->get_input_placeholder_attribute($card_name_field_input); if ($is_sub_label_above) { $card_name_field = "<span class='ginput_full{$class_suffix}' id='{$field_id}_5_container'>\n <label for='{$field_id}_5' id='{$field_id}_5_label' {$sub_label_class_attribute}>{$card_name_label}</label>\n <input type='text' name='input_{$id}.5' id='{$field_id}_5' value='{$card_name}' {$tabindex} {$disabled_text} {$card_name_placeholder}/>\n </span>"; } else { $card_name_field = "<span class='ginput_full{$class_suffix}' id='{$field_id}_5_container'>\n <input type='text' name='input_{$id}.5' id='{$field_id}_5' value='{$card_name}' {$tabindex} {$disabled_text} {$card_name_placeholder}/>\n <label for='{$field_id}_5' id='{$field_id}_5_label' {$sub_label_class_attribute}>{$card_name_label}</label>\n </span>"; } return "<div class='ginput_complex{$class_suffix} ginput_container ginput_container_creditcard' id='{$field_id}'>" . $card_field . $expiration_field . $security_field . $card_name_field . ' </div>'; }
public function get_field_input($form, $value = '', $entry = null) { $lead_id = absint(rgar($entry, 'id')); $form_id = absint($form['id']); $is_entry_detail = $this->is_entry_detail(); $is_form_editor = $this->is_form_editor(); $id = absint($this->id); $field_id = $is_entry_detail || $is_form_editor || $form_id == 0 ? "input_{$id}" : 'input_' . $form_id . "_{$id}"; $size = $this->size; $class_suffix = $is_entry_detail ? '_admin' : ''; $class = $size . $class_suffix; $disabled_text = $is_form_editor ? 'disabled="disabled"' : ''; $tabindex = $this->get_tabindex(); $multiple_files = $this->multipleFiles; $file_list_id = 'gform_preview_' . $form_id . '_' . $id; $is_entry_detail = $this->is_entry_detail(); $is_form_editor = $this->is_form_editor(); $is_admin = $is_entry_detail || $is_form_editor; $max_upload_size = !$is_admin && $this->maxFileSize > 0 ? $this->maxFileSize * 1048576 : wp_max_upload_size(); $allowed_extensions = !empty($this->allowedExtensions) ? join(',', GFCommon::clean_extensions(explode(',', strtolower($this->allowedExtensions)))) : array(); if (!empty($allowed_extensions)) { $extensions_message = esc_attr(sprintf(__('Accepted file types: %s.', 'gravityforms'), str_replace(',', ', ', $allowed_extensions))); } else { $extensions_message = ''; } if ($multiple_files) { $upload_action_url = trailingslashit(site_url()) . '?gf_page=' . GFCommon::get_upload_page_slug(); $max_files = $this->maxFiles > 0 ? $this->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}"; 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', '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)); if (rgar($form, 'requireLogin')) { $plupload_init['multipart_params']['_gform_file_upload_nonce_' . $form_id] = wp_create_nonce('gform_file_upload_' . $form_id, '_gform_file_upload_nonce_' . $form_id); } // 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 = gf_apply_filters('gform_plupload_settings', $form_id, $plupload_init, $form_id, $this); $drop_files_here_text = esc_html__('Drop files here or', 'gravityforms'); $select_files_text = esc_attr__('Select files', 'gravityforms'); $plupload_init_json = htmlspecialchars(json_encode($plupload_init), ENT_QUOTES, 'UTF-8'); $upload = "<div id='{$container_id}' data-settings='{$plupload_init_json}' class='gform_fileupload_multifile'>\n\t\t\t\t\t\t\t\t\t\t<div id='{$drag_drop_id}' class='gform_drop_area'>\n\t\t\t\t\t\t\t\t\t\t\t<span class='gform_drop_instructions'>{$drop_files_here_text} </span>\n\t\t\t\t\t\t\t\t\t\t\t<input id='{$browse_button_id}' type='button' value='{$select_files_text}' class='button gform_button_select_files' aria-describedby='extensions_message' {$tabindex} />\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</div>"; if (!$is_admin) { $upload .= "<span id='extensions_message' class='screen-reader-text'>{$extensions_message}</span>"; $upload .= "<div class='validation_message'>\n\t\t\t\t\t\t\t\t<ul id='{$messages_id}'>\n\t\t\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t\t</div>"; } if ($is_entry_detail) { $upload .= sprintf('<input type="hidden" name="input_%d" value=\'%s\' />', $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("<input type='hidden' name='MAX_FILE_SIZE' value='%d' />", $max_upload_size); } $upload .= sprintf("<input name='input_%d' id='%s' type='file' class='%s' aria-describedby='extensions_message' {$tabindex} %s/>", $id, $field_id, esc_attr($class), $disabled_text); if (!$is_admin) { $upload .= "<span id='extensions_message' class='screen-reader-text'>{$extensions_message}</span>"; } } if ($is_entry_detail && !empty($value)) { // edit entry $file_urls = $multiple_files ? json_decode($value) : array($value); $upload_display = $multiple_files ? '' : "style='display:none'"; $preview = "<div id='upload_{$id}' {$upload_display}>{$upload}</div>"; $preview .= sprintf("<div id='%s'></div>", $file_list_id); $preview .= sprintf("<div id='preview_existing_files_%d'>", $id); foreach ($file_urls as $file_index => $file_url) { if (GFCommon::is_ssl() && strpos($file_url, 'http:') !== false) { $file_url = str_replace('http:', 'https:', $file_url); } $download_file_text = esc_attr__('Download file', 'gravityforms'); $delete_file_text = esc_attr__('Delete file', 'gravityforms'); $file_index = intval($file_index); $file_url = esc_attr($file_url); $display_file_url = GFCommon::truncate_url($file_url); $download_button_url = GFCommon::get_base_url() . '/images/download.png'; $delete_button_url = GFCommon::get_base_url() . '/images/delete.png'; $preview .= "<div id='preview_file_{$file_index}' class='ginput_preview'>\n\t\t\t\t\t\t\t\t<a href='{$file_url}' target='_blank' alt='{$file_url}' title='{$file_url}'>{$display_file_url}</a>\n\t\t\t\t\t\t\t\t<a href='{$file_url}' target='_blank' alt='{$download_file_text}' title='{$download_file_text}'>\n\t\t\t\t\t\t\t\t<img src='{$download_button_url}' style='margin-left:10px;'/></a><a href='javascript:void(0);' alt='{$delete_file_text}' title='{$delete_file_text}' onclick='DeleteFile({$lead_id},{$id},this);' ><img src='{$delete_button_url}' style='margin-left:10px;'/></a>\n\t\t\t\t\t\t\t</div>"; } $preview .= '</div>'; 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("<div id='%s'>", $file_list_id); $file_infos = $multiple_files ? $uploaded_files : array($file_infos); foreach ($file_infos as $file_info) { $file_upload_markup = apply_filters('gform_file_upload_markup', "<img alt='" . esc_attr__('Delete file', 'gravityforms') . "' title='" . esc_attr__('Delete file', 'gravityforms') . "' class='gform_delete' src='" . GFCommon::get_base_url() . "/images/delete.png' onclick='gformDeleteUploadedFile({$form_id}, {$id}, this);' /> <strong>" . esc_html($file_info['uploaded_filename']) . '</strong>', $file_info, $form_id, $id); $preview .= "<div class='ginput_preview'>{$file_upload_markup}</div>"; } $preview .= '</div>'; if (!$multiple_files) { $upload = str_replace(" class='", " class='gform_hidden ", $upload); } return "<div class='ginput_container ginput_container_fileupload'>" . $upload . " {$preview}</div>"; } else { $preview = $multiple_files ? sprintf("<div id='%s'></div>", $file_list_id) : ''; return "<div class='ginput_container ginput_container_fileupload'>{$upload}</div>" . $preview; } } }
var monthInput = new Input(field.id + ".2_month", <?php echo json_encode(gf_apply_filters(array('gform_card_expiration', rgget('id')), esc_html__('Expiration Month', 'gravityforms'), rgget('id'))); ?> ); monthInput.defaultLabel = <?php echo json_encode(esc_html__('Expiration Date', 'gravityforms')); ?> ; var yearInput = new Input(field.id + ".2_year", <?php echo json_encode(esc_html__('Expiration Year', 'gravityforms')); ?> ); field.inputs.splice(1, 1, monthInput, yearInput); var nameInput = GetInput(field, field.id + ".5"); nameInput.label = <?php echo json_encode(gf_apply_filters(array('gform_card_name', rgget('id')), __('Cardholder Name', 'gravityforms'), rgget('id'))); ?> ; } return field; } function GetDefaultPrefixChoices() { return new Array(new Choice(<?php echo json_encode(esc_html__('Mr.', 'gravityforms')); ?> ), new Choice(<?php echo json_encode(esc_html__('Mrs.', 'gravityforms')); ?> ), new Choice(<?php
public function get_field_input($form, $value = '', $entry = null) { $is_entry_detail = $this->is_entry_detail(); $is_form_editor = $this->is_form_editor(); if (is_array($value)) { $value = array_values($value); } $form_id = absint($form['id']); $id = absint($this->id); $field_id = $is_entry_detail || $is_form_editor || $form_id == 0 ? "input_{$id}" : 'input_' . $form_id . "_{$id}"; $form_id = ($is_entry_detail || $is_form_editor) && empty($form_id) ? rgget('id') : $form_id; $size = $this->size; $disabled_text = $is_form_editor ? "disabled='disabled'" : ''; $class_suffix = $is_entry_detail ? '_admin' : ''; $class = $this->emailConfirmEnabled ? '' : $size . $class_suffix; //Size only applies when confirmation is disabled $form_sub_label_placement = rgar($form, 'subLabelPlacement'); $field_sub_label_placement = $this->subLabelPlacement; $is_sub_label_above = $field_sub_label_placement == 'above' || empty($field_sub_label_placement) && $form_sub_label_placement == 'above'; $sub_label_class_attribute = $field_sub_label_placement == 'hidden_label' ? "class='hidden_sub_label screen-reader-text'" : ''; $html_input_type = RGFormsModel::is_html5_enabled() ? 'email' : 'text'; $required_attribute = $this->isRequired ? 'aria-required="true"' : ''; $invalid_attribute = $this->failed_validation ? 'aria-invalid="true"' : 'aria-invalid="false"'; $enter_email_field_input = GFFormsModel::get_input($this, $this->id . ''); $confirm_field_input = GFFormsModel::get_input($this, $this->id . '.2'); $enter_email_label = rgar($enter_email_field_input, 'customLabel') != '' ? $enter_email_field_input['customLabel'] : esc_html__('Enter Email', 'gravityforms'); $enter_email_label = gf_apply_filters(array('gform_email', $form_id), $enter_email_label, $form_id); $confirm_email_label = rgar($confirm_field_input, 'customLabel') != '' ? $confirm_field_input['customLabel'] : esc_html__('Confirm Email', 'gravityforms'); $confirm_email_label = gf_apply_filters(array('gform_email_confirm', $form_id), $confirm_email_label, $form_id); $single_placeholder_attribute = $this->get_field_placeholder_attribute(); $enter_email_placeholder_attribute = $this->get_input_placeholder_attribute($enter_email_field_input); $confirm_email_placeholder_attribute = $this->get_input_placeholder_attribute($confirm_field_input); if ($is_form_editor) { $single_style = $this->emailConfirmEnabled ? "style='display:none;'" : ''; $confirm_style = $this->emailConfirmEnabled ? '' : "style='display:none;'"; if ($is_sub_label_above) { return "<div class='ginput_container ginput_container_email ginput_single_email' {$single_style}>\n <input name='input_{$id}' type='{$html_input_type}' class='" . esc_attr($class) . "' disabled='disabled' {$single_placeholder_attribute} {$required_attribute} {$invalid_attribute} />\n <div class='gf_clear gf_clear_complex'></div>\n </div>\n <div class='ginput_complex ginput_container ginput_container_email ginput_confirm_email' {$confirm_style} id='{$field_id}_container'>\n <span id='{$field_id}_1_container' class='ginput_left'>\n <label for='{$field_id}' {$sub_label_class_attribute}>{$enter_email_label}</label>\n <input class='{$class}' type='text' name='input_{$id}' id='{$field_id}' disabled='disabled' {$enter_email_placeholder_attribute} {$required_attribute} {$invalid_attribute} />\n </span>\n <span id='{$field_id}_2_container' class='ginput_right'>\n <label for='{$field_id}_2' {$sub_label_class_attribute}>{$confirm_email_label}</label>\n <input class='{$class}' type='text' name='input_{$id}_2' id='{$field_id}_2' disabled='disabled' {$confirm_email_placeholder_attribute} {$required_attribute} {$invalid_attribute} />\n </span>\n <div class='gf_clear gf_clear_complex'></div>\n </div>"; } else { return "<div class='ginput_container ginput_container_email ginput_single_email' {$single_style}>\n <input class='{$class}' name='input_{$id}' type='{$html_input_type}' class='" . esc_attr($class) . "' disabled='disabled' {$single_placeholder_attribute} {$required_attribute} {$invalid_attribute} />\n <div class='gf_clear gf_clear_complex'></div>\n </div>\n <div class='ginput_complex ginput_container ginput_container_email ginput_confirm_email' {$confirm_style} id='{$field_id}_container'>\n <span id='{$field_id}_1_container' class='ginput_left'>\n <input class='{$class}' type='text' name='input_{$id}' id='{$field_id}' disabled='disabled' {$enter_email_placeholder_attribute} {$required_attribute} {$invalid_attribute} />\n <label for='{$field_id}' {$sub_label_class_attribute}>{$enter_email_label}</label>\n </span>\n <span id='{$field_id}_2_container' class='ginput_right'>\n <input class='{$class}' type='text' name='input_{$id}_2' id='{$field_id}_2' disabled='disabled' {$confirm_email_placeholder_attribute} {$required_attribute} {$invalid_attribute} />\n <label for='{$field_id}_2' {$sub_label_class_attribute}>{$confirm_email_label}</label>\n </span>\n <div class='gf_clear gf_clear_complex'></div>\n </div>"; } } else { $logic_event = $this->get_conditional_logic_event('keyup'); if ($this->emailConfirmEnabled && !$is_entry_detail) { $first_tabindex = $this->get_tabindex(); $last_tabindex = $this->get_tabindex(); $email_value = is_array($value) ? $value[0] : $value; $email_value = esc_attr($email_value); $confirmation_value = is_array($value) ? $value[1] : rgpost('input_' . $this->id . '_2'); $confirmation_value = esc_attr($confirmation_value); $confirmation_disabled = $is_entry_detail ? "disabled='disabled'" : $disabled_text; if ($is_sub_label_above) { return "<div class='ginput_complex ginput_container ginput_container_email' id='{$field_id}_container'>\n <span id='{$field_id}_1_container' class='ginput_left'>\n <label for='{$field_id}'>" . $enter_email_label . "</label>\n <input class='{$class}' type='{$html_input_type}' name='input_{$id}' id='{$field_id}' value='{$email_value}' {$first_tabindex} {$logic_event} {$disabled_text} {$enter_email_placeholder_attribute} {$required_attribute} {$invalid_attribute}/>\n </span>\n <span id='{$field_id}_2_container' class='ginput_right'>\n <label for='{$field_id}_2' {$sub_label_class_attribute}>{$confirm_email_label}</label>\n <input class='{$class}' type='{$html_input_type}' name='input_{$id}_2' id='{$field_id}_2' value='{$confirmation_value}' {$last_tabindex} {$confirmation_disabled} {$confirm_email_placeholder_attribute} {$required_attribute} {$invalid_attribute}/>\n </span>\n <div class='gf_clear gf_clear_complex'></div>\n </div>"; } else { return "<div class='ginput_complex ginput_container ginput_container_email' id='{$field_id}_container'>\n <span id='{$field_id}_1_container' class='ginput_left'>\n <input class='{$class}' type='{$html_input_type}' name='input_{$id}' id='{$field_id}' value='{$email_value}' {$first_tabindex} {$logic_event} {$disabled_text} {$enter_email_placeholder_attribute} {$required_attribute} {$invalid_attribute}/>\n <label for='{$field_id}' {$sub_label_class_attribute}>{$enter_email_label}</label>\n </span>\n <span id='{$field_id}_2_container' class='ginput_right'>\n <input class='{$class}' type='{$html_input_type}' name='input_{$id}_2' id='{$field_id}_2' value='{$confirmation_value}' {$last_tabindex} {$confirmation_disabled} {$confirm_email_placeholder_attribute} {$required_attribute} {$invalid_attribute}/>\n <label for='{$field_id}_2' {$sub_label_class_attribute}>{$confirm_email_label}</label>\n </span>\n <div class='gf_clear gf_clear_complex'></div>\n </div>"; } } else { $tabindex = $this->get_tabindex(); $value = esc_attr($value); $class = esc_attr($class); return "<div class='ginput_container ginput_container_email'>\n <input name='input_{$id}' id='{$field_id}' type='{$html_input_type}' value='{$value}' class='{$class}' {$tabindex} {$logic_event} {$disabled_text} {$single_placeholder_attribute}/>\n </div>"; } } }
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 = GFCommon::gform_do_shortcode($confirmation_message); $confirmation_message = "<div class='form_saved_message'><span>" . $confirmation_message . '</span></div>'; $form_id = absint($form['id']); $has_pages = self::has_pages($form); $default_anchor = $has_pages || $ajax ? true : false; $use_anchor = gf_apply_filters(array('gform_confirmation_anchor', $form_id), $default_anchor); if ($use_anchor !== false) { $confirmation_message = "<a id='gf_{$form_id}' class='gform_anchor' ></a>" . $confirmation_message; } $wrapper_css_class = GFCommon::get_browser_class() . ' gform_wrapper'; $confirmation_message = "<div class='{$wrapper_css_class}' id='gform_wrapper_{$form_id}'>" . $confirmation_message . '</div>'; if ($ajax) { $confirmation_message = "<!DOCTYPE html><html><head><meta charset='UTF-8' /></head><body class='GF_AJAX_POSTBACK'>" . $confirmation_message . '</body></html>'; } GFCommon::log_debug('GFFormDisplay::handle_save_confirmation(): Confirmation => ' . print_r($confirmation_message, true)); return $confirmation_message; }
/** * Override this method to implement the appropriate sanitization specific to the field type before the value is saved. * * This base method provides a generic sanitization similar to wp_kses but values are not encoded. * Scripts are stripped out leaving allowed tags if HTMl is allowed. * * @param string $value The field value to be processed. * @param int $form_id The ID of the form currently being processed. * * @return string */ public function sanitize_entry_value($value, $form_id) { if (is_array($value)) { return ''; } //allow HTML for certain field types $allow_html = $this->allow_html(); $allowable_tags = gf_apply_filters(array('gform_allowable_tags', $form_id), $allow_html, $this, $form_id); if ($allowable_tags !== true) { $value = strip_tags($value, $allowable_tags); } $allowed_protocols = wp_allowed_protocols(); $value = wp_kses_no_null($value, array('slash_zero' => 'keep')); $value = wp_kses_hook($value, 'post', $allowed_protocols); $value = wp_kses_split($value, 'post', $allowed_protocols); return $value; }
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); ?> <script type="text/javascript"> jQuery(document).ready( function () { document.location.href = '?page=gf_edit_forms'; } ); </script> <?php exit; } else { if (!rgempty('gform_meta')) { check_admin_referer("gforms_update_form_{$form_id}", 'gforms_update_form'); $update_result = self::save_form_info($form_id, rgpost('gform_meta', false)); } } require_once GFCommon::get_base_path() . '/currency.php'; wp_print_styles(array('thickbox')); /* @var GF_Field_Address $gf_address_field */ $gf_address_field = GF_Fields::get('address'); $min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG || isset($_GET['gform_debug']) ? '' : '.min'; ?> <link rel="stylesheet" href="<?php echo GFCommon::get_base_url(); ?> /css/admin<?php echo $min; ?> .css?ver=<?php echo GFCommon::$version; ?> " type="text/css" /> <script type="text/javascript"> <?php GFCommon::gf_global(); ?> <?php GFCommon::gf_vars(); ?> </script> <script type="text/javascript"> function has_entry(fieldNumber) { var submitted_fields = [<?php echo RGFormsModel::get_submitted_fields($form_id); ?> ]; for (var i = 0; i < submitted_fields.length; i++) { if (submitted_fields[i] == fieldNumber) return true; } return false; } function InsertPostImageVariable(element_id, callback) { var variable = jQuery('#' + element_id + '_image_size_select').attr("variable"); var size = jQuery('#' + element_id + '_image_size_select').val(); if (size) { variable = "{" + variable + ":" + size + "}"; InsertVariable(element_id, callback, variable); jQuery('#' + element_id + '_image_size_select').hide(); jQuery('#' + element_id + '_image_size_select')[0].selectedIndex = 0; } } function InsertPostContentVariable(element_id, callback) { var variable = jQuery('#' + element_id + '_variable_select').val(); var regex = /{([^{]*?: *(\d+\.?\d*).*?)}/; matches = regex.exec(variable); if (!matches) { InsertVariable(element_id, callback); return; } variable = matches[1]; field_id = matches[2]; for (var i = 0; i < form["fields"].length; i++) { if (form["fields"][i]["id"] == field_id) { if (form["fields"][i]["type"] == "post_image") { jQuery('#' + element_id + '_image_size_select').attr("variable", variable); jQuery('#' + element_id + '_image_size_select').show(); return; } } } InsertVariable(element_id, callback); } function IsValidFormula(formula) { if (formula == '') return true; var patt = /{([^}]+)}/i, exprPatt = /^[0-9 -/*\(\)]+$/i, expr = formula.replace(/(\r\n|\n|\r)/gm, ''), match; while (match = patt.exec(expr)) { expr = expr.replace(match[0], 1); } if (exprPatt.test(expr)) { try { var r = eval(expr); return !isNaN(parseFloat(r)) && isFinite(r); } catch (e) { return false; } } else { return false; } } </script> <?php $form = !rgempty('meta', $update_result) ? rgar($update_result, 'meta') : GFFormsModel::get_form_meta($form_id); if (!isset($form['fields']) || !is_array($form['fields'])) { $form['fields'] = array(); } $form = gf_apply_filters(array('gform_admin_pre_render', $form_id), $form); if (isset($form['id'])) { echo "<script type=\"text/javascript\">var form = " . json_encode($form) . ';</script>'; } else { echo "<script type=\"text/javascript\">var form = new Form();</script>"; } ?> <?php echo GFCommon::get_remote_message(); ?> <div class="wrap gforms_edit_form <?php echo GFCommon::get_browser_class(); ?> "> <?php if (empty($form_id)) { ?> <h2 class="gf_admin_page_title"><?php esc_html_e('New Form', 'gravityforms'); ?> </h2> <?php } else { ?> <h2 class="gf_admin_page_title"> <span><?php esc_html_e('Form Editor', 'gravityforms'); ?> </span><span class="gf_admin_page_subtitle"><span class="gf_admin_page_formid">ID: <?php echo absint($form['id']); ?> </span><span class="gf_admin_page_formname"><?php esc_html_e('Form Name', 'gravityforms'); ?> : <?php echo esc_html($form['title']); ?> </span></span> </h2> <?php } ?> <?php RGForms::top_toolbar(); ?> <?php switch (rgar($update_result, 'status')) { case 'invalid_json': ?> <div class="error_base gform_editor_status" id="after_update_error_dialog"> <?php esc_html_e('There was an error while saving your form.', 'gravityforms'); ?> <?php printf(__('Please %scontact our support team%s.', 'gravityforms'), '<a href="http://www.gravityhelp.com">', '</a>'); ?> </div> <?php break; case 'duplicate_title': ?> <div class="error_base gform_editor_status" id="after_update_error_dialog"> <?php esc_html_e('The form title you have entered is already taken. Please enter a unique form title.', 'gravityforms'); ?> </div> <?php break; default: if (!empty($update_result)) { ?> <div class="updated_base gform_editor_status" id="after_update_dialog"> <strong><?php esc_html_e('Form updated successfully.', 'gravityforms'); ?> </strong> </div> <?php } break; } ?> <?php // link to the google webfont library ?> <style type="text/css"> @import url('//fonts.googleapis.com/css?family=Shadows+Into+Light+Two'); </style> <form method="post" id="form_trash"> <?php wp_nonce_field('gforms_trash_form', 'gforms_trash_form'); ?> <input type="hidden" value="trash" name="operation" /> </form> <table width="100%"> <tr> <td class="pad_top" valign="top"> <?php $has_pages = GFCommon::has_pages($form); ?> <div id="gform_pagination" class="selectable gform_settings_container" style="display:<?php echo $has_pages ? 'block' : 'none'; ?> ;"> <div class="settings_control_container"> <a href="javascript:void(0);" class="form_edit_icon edit_icon_collapsed" title="<?php esc_attr_e('click to edit page options', 'gravityforms'); ?> "><i class='fa fa-caret-down fa-lg'></i></a> </div> <div class="gf-pagebreak-first gf-pagebreak-container"> <div class="gf-pagebreak-text-before"><?php esc_html_e('begin form', 'gravityforms'); ?> </div> <div class="gf-pagebreak-text-main"><span><?php esc_html_e('START PAGING', 'gravityforms'); ?> </span></div> <div class="gf-pagebreak-text-after"><?php esc_html_e('top of the first page', 'gravityforms'); ?> </div> </div> <div id="pagination_settings" style="display: none;"> <ul> <li style="width:100px; padding:0px;"> <a href="#gform_pagination_settings_tab_1"><?php esc_html_e('General', 'gravityforms'); ?> </a></li> <li style="width:100px; padding:0px;"> <a href="#gform_pagination_settings_tab_2"><?php esc_html_e('Appearance', 'gravityforms'); ?> </a></li> </ul> <div id="gform_pagination_settings_tab_1"> <ul class="gforms_form_settings"> <li> <label for="pagination_type_container"> <?php esc_html_e('Progress Indicator', 'gravityforms'); ?> <?php gform_tooltip('form_progress_indicator'); ?> </label> <div id="pagination_type_container" class="pagination_container"> <input type="radio" id="pagination_type_percentage" name="pagination_type" value="percentage" onclick='InitPaginationOptions();' /> <label for="pagination_type_percentage" class="inline"> <?php esc_html_e('Progress Bar', 'gravityforms'); ?> </label> <input type="radio" id="pagination_type_steps" name="pagination_type" value="steps" onclick='InitPaginationOptions();' /> <label for="pagination_type_steps" class="inline"> <?php esc_html_e('Steps', 'gravityforms'); ?> </label> <input type="radio" id="pagination_type_none" name="pagination_type" value="none" onclick='InitPaginationOptions();' /> <label for="pagination_type_none" class="inline"> <?php esc_html_e('None', 'gravityforms'); ?> </label> </div> </li> <li id="percentage_style_setting"> <div class="percentage_style_setting" style="float:left; z-index: 99;"> <label for="percentage_style" style="display:block;"> <?php esc_html_e('Style', 'gravityforms'); ?> <?php gform_tooltip('form_percentage_style'); ?> </label> <select id="percentage_style" onchange="TogglePercentageStyle();"> <option value="blue"> <?php esc_html_e('Blue', 'gravityforms'); ?> </option> <option value="gray"> <?php esc_html_e('Gray', 'gravityforms'); ?> </option> <option value="green"> <?php esc_html_e('Green', 'gravityforms'); ?> </option> <option value="orange"> <?php esc_html_e('Orange', 'gravityforms'); ?> </option> <option value="red"> <?php esc_html_e('Red', 'gravityforms'); ?> </option> <option value="custom"> <?php esc_html_e('Custom', 'gravityforms'); ?> </option> </select> </div> <div class="percentage_custom_container" style="float:left; padding-left:20px;"> <label for="percentage_background_color" style="display:block;"> <?php esc_html_e('Text Color', 'gravityforms'); ?> </label> <?php self::color_picker('percentage_style_custom_color', ''); ?> </div> <div class="percentage_custom_container" style="float:left; padding-left:20px;"> <label for="percentage_background_bgcolor" style="display:block;"> <?php esc_html_e('Background Color', 'gravityforms'); ?> </label> <?php self::color_picker('percentage_style_custom_bgcolor', ''); ?> </div> </li> <li id="page_names_setting"> <label for="page_names_container"> <?php esc_html_e('Page Names', 'gravityforms'); ?> <?php gform_tooltip('form_page_names'); ?> </label> <div id="page_names_container" style="margin-top:5px;"> <!-- Populated dynamically from js.php --> </div> </li> <li id="percentage_confirmation_display_setting"> <div class="percentage_confirmation_display_setting"> <input type="checkbox" id="percentage_confirmation_display" onclick="TogglePercentageConfirmationText()"> <label for="percentage_confirmation_display" class="inline"> <?php esc_html_e('Display completed progress bar on confirmation', 'gravityforms'); ?> <?php gform_tooltip('form_percentage_confirmation_display'); ?> </label> </div> </li> <li id="percentage_confirmation_page_name_setting"> <div class="percentage_confirmation_page_name_setting"> <label for="percentage_confirmation_page_name" style="display:block;"> <?php esc_html_e('Completion Text', 'gravityforms'); ?> <?php gform_tooltip('percentage_confirmation_page_name'); ?> </label> <input type="text" id="percentage_confirmation_page_name" class="fieldwidth-3" /> </div> </li> </ul> </div> <div id="gform_pagination_settings_tab_2"> <ul class="gforms_form_settings"> <li> <label for="first_page_css_class" style="display:block;"> <?php esc_html_e('CSS Class Name', 'gravityforms'); ?> <?php gform_tooltip('form_field_css_class'); ?> </label> <input type="text" id="first_page_css_class" size="30" /> </li> </ul> </div> </div> </div> <ul id="gform_fields" class="<?php echo GFCommon::get_ul_classes($form); ?> " style="position: relative;"> <?php if (empty($form['fields'])) { ?> <?php // link to the google webfont library ?> <style type="text/css"> @import url('//fonts.googleapis.com/css?family=Shadows+Into+Light+Two'); </style> <li id="no-fields"> <div class="newform_notice"><?php esc_html_e("This form doesn't have any fields yet. Follow the steps below to get started.", 'gravityforms'); ?> <span></span></div> <?php // first step ?> <h4 class="gf_nofield_header gf_nofield_1">1. <?php esc_html_e('Select A Field Type', 'gravityforms'); ?> </h4> <p><?php esc_html_e('Start by selecting a field type from the nifty floating panels on the right.', 'gravityforms'); ?> </p> <div id="gf_nofield_1_instructions"> <span class="gf_nofield_1_instructions_heading gf_tips"><?php esc_html_e('Start Over There', 'gravityforms'); ?> </span> <span class="gf_nofield_1_instructions_copy gf_tips"><?php esc_html_e('Pick a field.. any field. Don\'t be shy.', 'gravityforms'); ?> </span> </div> <?php // second step ?> <h4 class="gf_nofield_header gf_nofield_2">2. <?php esc_html_e('Click to Add A Field', 'gravityforms'); ?> </h4> <p><?php esc_html_e("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'); ?> </p> <div id="gf_nofield_2_instructions"> <span class="gf_nofield_2_instructions_copy gf_tips"><?php esc_html_e('Now your new field magically appears over here.', 'gravityforms'); ?> </span> </div> <?php // third step ?> <h4 class="gf_nofield_header gf_nofield_3">3. <?php esc_html_e('Edit Field Options', 'gravityforms'); ?> </h4> <p><?php esc_html_e('Click on the edit link to configure the various field options', 'gravityforms'); ?> </p> <div id="gf_nofield_3_instructions"> <span class="gf_nofield_3_instructions_copy_top gf_tips"><?php esc_html_e('Preview your changes up here.', 'gravityforms'); ?> </span> <span class="gf_nofield_3_instructions_copy_mid gf_tips"><?php esc_html_e('Edit the field options. Go ahead.. go crazy.', 'gravityforms'); ?> </span> <span class="gf_nofield_3_instructions_copy_bottom gf_tips"><?php esc_html_e('If you get stuck, mouseover the tool tips for a little help.', 'gravityforms'); ?> </span> </div> <?php // fourth step ?> <h4 class="gf_nofield_header gf_nofield_4">4. <?php esc_html_e('Drag to Arrange Fields', 'gravityforms'); ?> </h4> <p><?php esc_html_e('Drag the fields to arrange them the way you prefer', 'gravityforms'); ?> </p> <div id="gf_nofield_4_instructions"> <span class="gf_nofield_4_instructions_copy_top gf_tips"><?php esc_html_e('Grab here with your cursor.', 'gravityforms'); ?> </span> <span class="gf_nofield_4_instructions_copy_bottom gf_tips"><?php esc_html_e('Drag up or down to arrange your fields.', 'gravityforms'); ?> </span> </div> <?php // fifth step ?> <h4 class="gf_nofield_header gf_nofield_5">5. <?php esc_html_e('Save Your Form', 'gravityforms'); ?> </h4> <p><?php esc_html_e("Once you're happy with your form, remember to click on the 'update form' button to save all your hard work.", 'gravityforms'); ?> </p> <div id="gf_nofield_5_instructions"> <span class="gf_nofield_5_instructions_heading gf_tips"><?php esc_html_e('Save Your New Form', 'gravityforms'); ?> </span> <span class="gf_nofield_5_instructions_copy gf_tips"><?php esc_html_e("You're done. That's it.", 'gravityforms'); ?> </span> </div> </li> <?php } ?> <?php if (is_array(rgar($form, 'fields'))) { require_once GFCommon::get_base_path() . '/form_display.php'; foreach ($form['fields'] as $field) { echo GFFormDisplay::get_field($field, '', true, $form); } } ?> </ul> <div id="gform_last_page_settings" class="selectable gform_settings_container" style="display:<?php echo $has_pages ? 'block' : 'none'; ?> ;"> <div class="settings_control_container"> <a href="javascript:void(0);" class="form_edit_icon edit_icon_collapsed" title="<?php esc_attr_e('Edit Last Page', 'gravityforms'); ?> "><i class='fa fa-caret-down fa-lg'></i></a> </div> <div class="gf-pagebreak-end gf-pagebreak-container"> <div class="gf-pagebreak-text-before"><?php esc_html_e('end of last page', 'gravityforms'); ?> </div> <div class="gf-pagebreak-text-main"><span><?php esc_html_e('END PAGING', 'gravityforms'); ?> </span></div> <div class="gf-pagebreak-text-after"><?php esc_html_e('end of form', 'gravityforms'); ?> </div> </div> <div id="last_page_settings" style="display:none;"> <ul> <li style="width:100px; padding:0px;"> <a href="#gform_last_page_settings_tab_1"><?php esc_html_e('General', 'gravityforms'); ?> </a></li> </ul> <div id="gform_last_page_settings_tab_1"> <ul class="gforms_form_settings"> <li> <label for="last_page_button_container"> <?php esc_html_e('Previous Button', 'gravityforms'); ?> <?php gform_tooltip('form_field_last_page_button'); ?> </label> <div class="last_page_button_options" id="last_page_button_container"> <input type="radio" id="last_page_button_text" name="last_page_button" value="text" onclick="TogglePageButton('last_page');" /> <label for="last_page_button_text" class="inline"> <?php esc_html_e('Default', 'gravityforms'); ?> <?php gform_tooltip('previous_button_text'); ?> </label> <input type="radio" id="last_page_button_image" name="last_page_button" value="image" onclick="TogglePageButton('last_page');" /> <label for="last_page_button_image" class="inline"> <?php esc_html_e('Image', 'gravityforms'); ?> <?php gform_tooltip('previous_button_image'); ?> </label> <div id="last_page_button_text_container" style="margin-top:5px;"> <label for="last_page_button_text_input" class="inline"> <?php esc_html_e('Text:', 'gravityforms'); ?> </label> <input type="text" id="last_page_button_text_input" class="input_size_b" size="40" /> </div> <div id="last_page_button_image_container" style="margin-top:5px;"> <label for="last_page_button_image_url" class="inline"> <?php esc_html_e('Image Path:', 'gravityforms'); ?> </label> <input type="text" id="last_page_button_image_url" size="45" /> </div> </div> </li> </ul> </div> </div> </div> <div> <div id="after_insert_dialog" style="display:none;"> <h3><?php esc_html_e('You have successfully saved your form!', 'gravityforms'); ?> </h3> <p><?php esc_html_e('What would you like to do next?', 'gravityforms'); ?> </p> <div class="new-form-option"> <a title="<?php esc_attr_e('Preview this form', 'gravityforms'); ?> " id="preview_form_link" href="<?php echo esc_url_raw(trailingslashit(site_url())); ?> ?gf_page=preview&id={formid}" target="_blank"><?php esc_html_e('Preview this Form', 'gravityforms'); ?> </a> </div> <?php if (GFCommon::current_user_can_any('gravityforms_edit_forms')) { ?> <div class="new-form-option"> <a title="<?php esc_attr_e('Setup email notifications for this form', 'gravityforms'); ?> " id="notification_form_link" href="#"><?php esc_html_e('Setup Email Notifications for this Form', 'gravityforms'); ?> </a> </div> <?php } ?> <div class="new-form-option"> <a title="<?php esc_attr_e('Continue editing this form', 'gravityforms'); ?> " id="edit_form_link" href="#"><?php esc_html_e('Continue Editing this Form', 'gravityforms'); ?> </a> </div> <div class="new-form-option"> <a title="<?php esc_attr_e('I am done. Take me back to form list', 'gravityforms'); ?> " href="?page=gf_edit_forms"><?php esc_html_e('Return to Form List', 'gravityforms'); ?> </a> </div> </div> </div> <div id="field_settings" style="display: none;"> <ul> <li style="width:100px; padding:0px;"> <a href="#gform_tab_1"><?php esc_html_e('General', 'gravityforms'); ?> </a> </li> <li style="width:100px; padding:0px; "> <a href="#gform_tab_3"><?php esc_html_e('Appearance', 'gravityforms'); ?> </a> </li> <li style="width:100px; padding:0px; "> <a href="#gform_tab_2"><?php esc_html_e('Advanced', 'gravityforms'); ?> </a> </li> </ul> <div id="gform_tab_1"> <ul> <?php do_action('gform_field_standard_settings', 0, $form_id); ?> <li class="label_setting field_setting"> <label for="field_label"> <?php esc_html_e('Field Label', 'gravityforms'); ?> <?php gform_tooltip('form_field_label'); ?> <?php gform_tooltip('form_field_label_html'); ?> </label> <input type="text" id="field_label" class="fieldwidth-3" size="35" /> </li> <?php do_action('gform_field_standard_settings', 10, $form_id); ?> <li class="description_setting field_setting"> <label for="field_description"> <?php esc_html_e('Description', 'gravityforms'); ?> <?php gform_tooltip('form_field_description'); ?> </label> <textarea id="field_description" class="fieldwidth-3 fieldheight-2"></textarea> </li> <?php do_action('gform_field_standard_settings', 20, $form_id); ?> <li class="product_field_setting field_setting"> <label for="product_field"> <?php esc_html_e('Product Field Mapping', 'gravityforms'); ?> <?php gform_tooltip('form_field_product'); ?> </label> <select id="product_field" onchange="SetFieldProperty('productField', jQuery(this).val());"> <!-- will be populated when field is selected (js.php) --> </select> </li> <?php do_action('gform_field_standard_settings', 25, $form_id); ?> <li class="product_field_type_setting field_setting"> <label for="product_field_type"> <?php esc_html_e('Field Type', 'gravityforms'); ?> <?php gform_tooltip('form_field_type'); ?> </label> <select id="product_field_type" onchange="if(jQuery(this).val() == '') return; jQuery('#field_settings').slideUp(function(){StartChangeProductType(jQuery('#product_field_type').val());});"> <option value="singleproduct"><?php esc_html_e('Single Product', 'gravityforms'); ?> </option> <option value="select"><?php esc_html_e('Drop Down', 'gravityforms'); ?> </option> <option value="radio"><?php esc_html_e('Radio Buttons', 'gravityforms'); ?> </option> <option value="price"><?php esc_html_e('User Defined Price', 'gravityforms'); ?> </option> <option value="hiddenproduct"><?php esc_html_e('Hidden', 'gravityforms'); ?> </option> <option value="calculation"><?php esc_html_e('Calculation', 'gravityforms'); ?> </option> </select> </li> <?php do_action('gform_field_standard_settings', 37, $form_id); ?> <li class="shipping_field_type_setting field_setting"> <label for="shipping_field_type"> <?php esc_html_e('Field Type', 'gravityforms'); ?> <?php gform_tooltip('form_field_type'); ?> </label> <select id="shipping_field_type" onchange="if(jQuery(this).val() == '') return; jQuery('#field_settings').slideUp(function(){StartChangeShippingType(jQuery('#shipping_field_type').val());});"> <option value="singleshipping"><?php esc_html_e('Single Method', 'gravityforms'); ?> </option> <option value="select"><?php esc_html_e('Drop Down', 'gravityforms'); ?> </option> <option value="radio"><?php esc_html_e('Radio Buttons', 'gravityforms'); ?> </option> </select> </li> <?php do_action('gform_field_standard_settings', 50, $form_id); ?> <li class="base_price_setting field_setting"> <label for="field_base_price"> <?php esc_html_e('Price', 'gravityforms'); ?> <?php gform_tooltip('form_field_base_price'); ?> </label> <input type="text" id="field_base_price" onchange="SetBasePrice(this.value)" /> </li> <?php do_action('gform_field_standard_settings', 75, $form_id); ?> <li class="disable_quantity_setting field_setting"> <input type="checkbox" name="field_disable_quantity" id="field_disable_quantity" onclick="SetDisableQuantity(jQuery(this).is(':checked'));" /> <label for="field_disable_quantity" class="inline"> <?php esc_html_e('Disable quantity field', 'gravityforms'); ?> <?php gform_tooltip('form_field_disable_quantity'); ?> </label> </li> <?php do_action('gform_field_standard_settings', 100, $form_id); ?> <li class="option_field_type_setting field_setting"> <label for="option_field_type"> <?php esc_html_e('Field Type', 'gravityforms'); ?> <?php gform_tooltip('form_field_type'); ?> </label> <select id="option_field_type" onchange="if(jQuery(this).val() == '') return; jQuery('#field_settings').slideUp(function(){StartChangeInputType(jQuery('#option_field_type').val());});"> <option value="select"><?php esc_html_e('Drop Down', 'gravityforms'); ?> </option> <option value="checkbox"><?php esc_html_e('Checkboxes', 'gravityforms'); ?> </option> <option value="radio"><?php esc_html_e('Radio Buttons', 'gravityforms'); ?> </option> </select> </li> <?php do_action('gform_field_standard_settings', 125, $form_id); ?> <li class="donation_field_type_setting field_setting"> <label for="donation_field_type"> <?php esc_html_e('Field Type', 'gravityforms'); ?> <?php gform_tooltip('form_field_type'); ?> </label> <select id="donation_field_type" onchange="if(jQuery(this).val() == '') return; jQuery('#field_settings').slideUp(function(){StartChangeDonationType(jQuery('#donation_field_type').val());});"> <option value="select"><?php esc_html_e('Drop Down', 'gravityforms'); ?> </option> <option value="donation"><?php esc_html_e('User Defined Price', 'gravityforms'); ?> </option> <option value="radio"><?php esc_html_e('Radio Buttons', 'gravityforms'); ?> </option> </select> </li> <?php do_action('gform_field_standard_settings', 150, $form_id); ?> <li class="quantity_field_type_setting field_setting"> <label for="quantity_field_type"> <?php esc_html_e('Field Type', 'gravityforms'); ?> <?php gform_tooltip('form_field_type'); ?> </label> <select id="quantity_field_type" onchange="if(jQuery(this).val() == '') return; jQuery('#field_settings').slideUp(function(){StartChangeInputType(jQuery('#quantity_field_type').val());});"> <option value="number"><?php esc_html_e('Number', 'gravityforms'); ?> </option> <option value="select"><?php esc_html_e('Drop Down', 'gravityforms'); ?> </option> <option value="hidden"><?php esc_html_e('Hidden', 'gravityforms'); ?> </option> </select> </li> <?php do_action('gform_field_standard_settings', 200, $form_id); ?> <li class="content_setting field_setting"> <label for="field_content"> <?php esc_html_e('Content', 'gravityforms'); ?> <?php gform_tooltip('form_field_content'); ?> </label> <textarea id="field_content" class="fieldwidth-3 fieldheight-1 merge-tag-support mt-position-right mt-prepopulate"></textarea> </li> <?php do_action('gform_field_standard_settings', 225, $form_id); ?> <li class="next_button_setting field_setting"> <label for="next_button_container"> <?php esc_html_e('Next Button', 'gravityforms'); ?> </label> <div class="next_button_options" id="next_button_container"> <input type="radio" id="next_button_text" name="next_button" value="text" onclick="TogglePageButton('next'); SetPageButton('next');" /> <label for="next_button_text" class="inline"> <?php esc_html_e('Default', 'gravityforms'); ?> <?php gform_tooltip('next_button_text'); ?> </label> <input type="radio" id="next_button_image" name="next_button" value="image" onclick="TogglePageButton('next'); SetPageButton('next');" /> <label for="next_button_image" class="inline"> <?php esc_html_e('Image', 'gravityforms'); ?> <?php gform_tooltip('next_button_image'); ?> </label> <div id="next_button_text_container" style="margin-top:5px;"> <label for="next_button_text_input" class="inline"> <?php esc_html_e('Text:', 'gravityforms'); ?> </label> <input type="text" id="next_button_text_input" class="input_size_b" size="40" /> </div> <div id="next_button_image_container" style="margin-top:5px;"> <label for="next_button_image_url" class="inline"> <?php esc_html_e('Image Path:', 'gravityforms'); ?> </label> <input type="text" id="next_button_image_url" size="45" /> </div> </div> </li> <?php do_action('gform_field_standard_settings', 237, $form_id); ?> <li class="previous_button_setting field_setting"> <label for="previous_button_container"> <?php esc_html_e('Previous Button', 'gravityforms'); ?> <?php gform_tooltip('form_field_previous_button'); ?> </label> <div class="previous_button_options" id="previous_button_container"> <input type="radio" id="previous_button_text" name="previous_button" value="text" onclick="TogglePageButton('previous'); SetPageButton('previous');" /> <label for="previous_button_text" class="inline"> <?php esc_html_e('Default', 'gravityforms'); ?> <?php gform_tooltip('previous_button_text'); ?> </label> <input type="radio" id="previous_button_image" name="previous_button" value="image" onclick="TogglePageButton('previous'); SetPageButton('previous');" /> <label for="previous_button_image" class="inline"> <?php esc_html_e('Image', 'gravityforms'); ?> <?php gform_tooltip('previous_button_image'); ?> </label> <div id="previous_button_text_container" style="margin-top:5px;"> <label for="previous_button_text_input" class="inline"> <?php esc_html_e('Text:', 'gravityforms'); ?> </label> <input type="text" id="previous_button_text_input" class="input_size_b" size="40" /> </div> <div id="previous_button_image_container" style="margin-top:5px;"> <label for="previous_button_image_url" class="inline"> <?php esc_html_e('Image Path:', 'gravityforms'); ?> </label> <input type="text" id="previous_button_image_url" size="45" /> </div> </div> </li> <?php do_action('gform_field_standard_settings', 250, $form_id); ?> <li class="disable_margins_setting field_setting"> <input type="checkbox" id="field_margins" onclick="SetFieldProperty('disableMargins', this.checked);" /> <label for="field_disable_margins" class="inline"> <?php esc_html_e('Disable default margins', 'gravityforms'); ?> <?php gform_tooltip('form_field_disable_margins'); ?> </label><br /> </li> <?php do_action('gform_field_standard_settings', 300, $form_id); ?> <li class="post_custom_field_type_setting field_setting"> <label for="post_custom_field_type"> <?php esc_html_e('Field Type', 'gravityforms'); ?> <?php gform_tooltip('form_field_type'); ?> </label> <select id="post_custom_field_type" onchange="if(jQuery(this).val() == '') return; jQuery('#field_settings').slideUp(function(){StartChangeInputType(jQuery('#post_custom_field_type').val());});"> <optgroup class="option_header" label="<?php esc_attr_e('Standard Fields', 'gravityforms'); ?> "> <option value="text"><?php esc_html_e('Single line text', 'gravityforms'); ?> </option> <option value="textarea"><?php esc_html_e('Paragraph Text', 'gravityforms'); ?> </option> <option value="select"><?php esc_html_e('Drop Down', 'gravityforms'); ?> </option> <option value="multiselect"><?php esc_html_e('Multi Select', 'gravityforms'); ?> </option> <option value="number"><?php esc_html_e('Number', 'gravityforms'); ?> </option> <option value="checkbox"><?php esc_html_e('Checkboxes', 'gravityforms'); ?> </option> <option value="radio"><?php esc_html_e('Radio Buttons', 'gravityforms'); ?> </option> <option value="hidden"><?php esc_html_e('Hidden', 'gravityforms'); ?> </option> </optgroup> <optgroup class="option_header" label="<?php esc_html_e('Advanced Fields', 'gravityforms'); ?> "> <option value="date"><?php esc_html_e('Date', 'gravityforms'); ?> </option> <option value="time"><?php esc_html_e('Time', 'gravityforms'); ?> </option> <option value="phone"><?php esc_html_e('Phone', 'gravityforms'); ?> </option> <option value="website"><?php esc_html_e('Website', 'gravityforms'); ?> </option> <option value="email"><?php esc_html_e('Email', 'gravityforms'); ?> </option> <option value="fileupload"><?php esc_html_e('File Upload', 'gravityforms'); ?> </option> <option value="list"><?php esc_html_e('List', 'gravityforms'); ?> </option> </optgroup> </select> </li> <?php do_action('gform_field_standard_settings', 350, $form_id); ?> <li class="post_tag_type_setting field_setting"> <label for="post_tag_type"> <?php esc_html_e('Field Type', 'gravityforms'); ?> <?php gform_tooltip('form_field_type'); ?> </label> <select id="post_tag_type" onchange="if(jQuery(this).val() == '') return; jQuery('#field_settings').slideUp(function(){StartChangeInputType(jQuery('#post_tag_type').val());});"> <option value="text"><?php esc_html_e('Single line text', 'gravityforms'); ?> </option> <option value="select"><?php esc_html_e('Drop Down', 'gravityforms'); ?> </option> <option value="multiselect"><?php esc_html_e('Multi Select', 'gravityforms'); ?> </option> <option value="checkbox"><?php esc_html_e('Checkboxes', 'gravityforms'); ?> </option> <option value="radio"><?php esc_html_e('Radio Buttons', 'gravityforms'); ?> </option> </select> </li> <?php do_action('gform_field_standard_settings', 400, $form_id); ?> <?php if (class_exists('ReallySimpleCaptcha')) { ?> <li class="captcha_type_setting field_setting"> <label for="field_captcha_type"> <?php esc_html_e('Type', 'gravityforms'); ?> <?php gform_tooltip('form_field_captcha_type'); ?> </label> <select id="field_captcha_type" onchange="StartChangeCaptchaType(jQuery(this).val())"> <option value="captcha"><?php esc_html_e('reCAPTCHA', 'gravityforms'); ?> </option> <option value="simple_captcha"><?php esc_html_e('Really Simple CAPTCHA', 'gravityforms'); ?> </option> <option value="math"><?php esc_html_e('Math Challenge', 'gravityforms'); ?> </option> </select> </li> <?php do_action('gform_field_standard_settings', 450, $form_id); ?> <li class="captcha_size_setting field_setting"> <label for="field_captcha_size"> <?php esc_html_e('Size', 'gravityforms'); ?> </label> <select id="field_captcha_size" onchange="SetCaptchaSize(jQuery(this).val());"> <option value="small"><?php esc_html_e('Small', 'gravityforms'); ?> </option> <option value="medium"><?php esc_html_e('Medium', 'gravityforms'); ?> </option> <option value="large"><?php esc_html_e('Large', 'gravityforms'); ?> </option> </select> </li> <?php do_action('gform_field_standard_settings', 500, $form_id); ?> <li class="captcha_fg_setting field_setting"> <label for="field_captcha_fg"> <?php esc_html_e('Font Color', 'gravityforms'); ?> </label> <?php self::color_picker('field_captcha_fg', 'SetCaptchaFontColor'); ?> </li> <?php do_action('gform_field_standard_settings', 550, $form_id); ?> <li class="captcha_bg_setting field_setting"> <label for="field_captcha_bg"> <?php esc_html_e('Background Color', 'gravityforms'); ?> </label> <?php self::color_picker('field_captcha_bg', 'SetCaptchaBackgroundColor'); ?> </li> <?php } do_action('gform_field_standard_settings', 600, $form_id); ?> <li class="captcha_theme_setting field_setting"> <label for="field_captcha_theme"> <?php esc_html_e('Theme', 'gravityforms'); ?> <?php gform_tooltip('form_field_recaptcha_theme'); ?> </label> <select id="field_captcha_theme" onchange="SetCaptchaTheme(this.value, '<?php echo GFCommon::get_base_url(); ?> /images/captcha_' + this.value + '.jpg')"> <option value="red"><?php esc_html_e('Red', 'gravityforms'); ?> </option> <option value="white"><?php esc_html_e('White', 'gravityforms'); ?> </option> <option value="blackglass"><?php esc_html_e('Black Glass', 'gravityforms'); ?> </option> <option value="clean"><?php esc_html_e('Clean', 'gravityforms'); ?> </option> </select> </li> <?php do_action('gform_field_standard_settings', 650, $form_id); ?> <li class="post_custom_field_setting field_setting"> <label for="field_custom_field_name"> <?php esc_html_e('Custom Field Name', 'gravityforms'); ?> <?php gform_tooltip('form_field_custom_field_name'); ?> </label> <div style="width:100px; float:left;"> <input type="radio" name="field_custom" id="field_custom_existing" size="10" onclick="ToggleCustomField();" /> <label for="field_custom_existing" class="inline"> <?php esc_html_e('Existing', 'gravityforms'); ?> </label> </div> <div style="width:100px; float:left;"> <input type="radio" name="field_custom" id="field_custom_new" size="10" onclick="ToggleCustomField();" /> <label for="field_custom_new" class="inline"> <?php esc_html_e('New', 'gravityforms'); ?> </label> </div> <div class="clear"> <input type="text" id="field_custom_field_name_text" size="35" /> <select id="field_custom_field_name_select" onchange="SetFieldProperty('postCustomFieldName', jQuery(this).val());"> <option value=""><?php esc_html_e('Select an existing custom field', 'gravityforms'); ?> </option> <?php $custom_field_names = RGFormsModel::get_custom_field_names(); foreach ($custom_field_names as $name) { ?> <option value="<?php echo esc_attr($name); ?> "><?php echo esc_html($name); ?> </option> <?php } ?> </select> </div> </li> <?php do_action('gform_field_standard_settings', 700, $form_id); ?> <li class="post_status_setting field_setting"> <label for="field_post_status"> <?php esc_html_e('Post Status', 'gravityforms'); ?> <?php gform_tooltip('form_field_post_status'); ?> </label> <select id="field_post_status" name="field_post_status"> <?php $post_stati = apply_filters('gform_post_status_options', array('draft' => 'Draft', 'pending' => 'Pending Review', 'publish' => 'Published')); foreach ($post_stati as $value => $label) { ?> <option value="<?php echo esc_attr($value); ?> "><?php echo esc_html($label); ?> </option> <?php } ?> </select> </li> <?php do_action('gform_field_standard_settings', 750, $form_id); ?> <li class="post_author_setting field_setting"> <label for="field_post_author"> <?php esc_html_e('Default Post Author', 'gravityforms'); ?> <?php gform_tooltip('form_field_post_author'); ?> </label> <?php $args = array('name' => 'field_post_author'); $args = gf_apply_filters(array('gform_author_dropdown_args', rgar($form, 'id')), $args); wp_dropdown_users($args); ?> <div> <input type="checkbox" id="gfield_current_user_as_author" /> <label for="gfield_current_user_as_author" class="inline"><?php esc_html_e('Use logged in user as author', 'gravityforms'); ?> <?php gform_tooltip('form_field_current_user_as_author'); ?> </label> </div> </li> <?php do_action('gform_field_standard_settings', 775, $form_id); ?> <?php if (current_theme_supports('post-formats')) { ?> <li class="post_format_setting field_setting"> <label for="field_post_format"> <?php esc_html_e('Post Format', 'gravityforms'); ?> <?php gform_tooltip('form_field_post_format'); ?> </label> <?php $post_formats = get_theme_support('post-formats'); $post_formats_dropdown = '<option value="0">Standard</option>'; foreach ($post_formats[0] as $post_format) { $post_format_val = esc_attr($post_format); $post_format_text = esc_html($post_format); $post_formats_dropdown .= "<option value='{$post_format_val}'>" . ucfirst($post_format_text) . '</option>'; } echo '<select name="field_post_format" id="field_post_format">' . $post_formats_dropdown . '</select>'; ?> </li> <?php } // if theme supports post formats ?> <?php do_action('gform_field_standard_settings', 800, $form_id); ?> <li class="post_category_setting field_setting"> <label for="field_post_category"> <?php esc_html_e('Post Category', 'gravityforms'); ?> <?php gform_tooltip('form_field_post_category'); ?> </label> <?php wp_dropdown_categories(array('selected' => get_option('default_category'), 'hide_empty' => 0, 'id' => 'field_post_category', 'name' => 'field_post_category', 'orderby' => 'name', 'selected' => 'field_post_category', 'hierarchical' => true)); ?> </li> <?php do_action('gform_field_standard_settings', 825, $form_id); ?> <li class="post_category_field_type_setting field_setting"> <label for="post_category_field_type"> <?php esc_html_e('Field Type', 'gravityforms'); ?> <?php gform_tooltip('form_field_type'); ?> </label> <select id="post_category_field_type" onchange="jQuery('#field_settings').slideUp(function(){StartChangeInputType( jQuery('#post_category_field_type').val() );});"> <option value="select"><?php esc_html_e('Drop Down', 'gravityforms'); ?> </option> <option value="checkbox"><?php esc_html_e('Checkboxes', 'gravityforms'); ?> </option> <option value="radio"><?php esc_html_e('Radio Buttons', 'gravityforms'); ?> </option> <option value="multiselect"><?php esc_html_e('Multi Select', 'gravityforms'); ?> </option> </select> </li> <?php do_action('gform_field_standard_settings', 850, $form_id); ?> <li class="post_category_checkbox_setting field_setting"> <label for="field_post_category"> <?php esc_html_e('Category', 'gravityforms'); ?> <?php gform_tooltip('form_field_post_category_selection'); ?> </label> <input type="radio" id="gfield_category_all" name="gfield_category" value="all" onclick="ToggleCategory();" /> <label for="gfield_category_all" class="inline"> <?php esc_html_e('All Categories', 'gravityforms'); ?> </label> <input type="radio" id="gfield_category_select" name="gfield_category" value="select" onclick="ToggleCategory();" /> <label for="form_button_image" class="inline"> <?php esc_html_e('Select Categories', 'gravityforms'); ?> </label> <div id="gfield_settings_category_container"> <table cellpadding="0" cellspacing="5"> <?php $categories = get_categories(array('hide_empty' => 0)); $count = 0; $category_rows = ''; self::_cat_rows($categories, $count, $category_rows); echo $category_rows; ?> </table> </div> </li> <?php do_action('gform_field_standard_settings', 875, $form_id); ?> <li class="post_category_initial_item_setting field_setting"> <input type="checkbox" id="gfield_post_category_initial_item_enabled" onclick="TogglePostCategoryInitialItem(); SetCategoryInitialItem();" /> <label for="gfield_post_category_initial_item_enabled" class="inline"> <?php esc_html_e('Display placeholder', 'gravityforms'); ?> <?php gform_tooltip('form_field_post_category_initial_item'); ?> </label> </li> <li id="gfield_post_category_initial_item_container"> <label for="field_post_category_initial_item"> <?php esc_html_e('Placeholder Label', 'gravityforms'); ?> </label> <input type="text" id="field_post_category_initial_item" onchange="SetCategoryInitialItem();" class="fieldwidth-3" size="35" /> </li> <?php do_action('gform_field_standard_settings', 900, $form_id); ?> <li class="post_content_template_setting field_setting"> <input type="checkbox" id="gfield_post_content_enabled" onclick="TogglePostContentTemplate();" /> <label for="gfield_post_content_enabled" class="inline"> <?php esc_html_e('Create content template', 'gravityforms'); ?> <?php gform_tooltip('form_field_post_content_template_enable'); ?> </label> <div id="gfield_post_content_container"> <div> <?php GFCommon::insert_post_content_variables($form['fields'], 'field_post_content_template', '', 25); ?> </div> <textarea id="field_post_content_template" class="fieldwidth-3 fieldheight-1"></textarea> </div> </li> <?php do_action('gform_field_standard_settings', 950, $form_id); ?> <li class="post_title_template_setting field_setting"> <input type="checkbox" id="gfield_post_title_enabled" onclick="TogglePostTitleTemplate();" /> <label for="gfield_post_title_enabled" class="inline"> <?php esc_html_e('Create content template', 'gravityforms'); ?> <?php gform_tooltip('form_field_post_title_template_enable'); ?> </label> <div id="gfield_post_title_container"> <input type="text" id="field_post_title_template" class="fieldwidth-3 merge-tag-support mt-position-right mt-hide_all_fields mt-exclude-post_image-fileupload" /> </div> </li> <?php do_action('gform_field_standard_settings', 975, $form_id); ?> <li class="customfield_content_template_setting field_setting"> <input type="checkbox" id="gfield_customfield_content_enabled" onclick="ToggleCustomFieldTemplate(); SetCustomFieldTemplate();" /> <label for="gfield_customfield_content_enabled" class="inline"> <?php esc_html_e('Create content template', 'gravityforms'); ?> <?php gform_tooltip('form_field_customfield_content_template_enable'); ?> </label> <div id="gfield_customfield_content_container"> <div> <?php GFCommon::insert_post_content_variables($form['fields'], 'field_customfield_content_template', 'SetCustomFieldTemplate', 25); ?> </div> <textarea id="field_customfield_content_template" class="fieldwidth-3 fieldheight-1"></textarea> </div> </li> <?php do_action('gform_field_standard_settings', 1000, $form_id); ?> <li class="post_image_setting field_setting"> <label><?php esc_html_e('Image Metadata', 'gravityforms'); ?> <?php gform_tooltip('form_field_image_meta'); ?> </label> <input type="checkbox" id="gfield_display_title" onclick="SetPostImageMeta();" /> <label for="gfield_display_title" class="inline"> <?php esc_html_e('Title', 'gravityforms'); ?> </label> <br /> <input type="checkbox" id="gfield_display_caption" onclick="SetPostImageMeta();" /> <label for="gfield_display_caption" class="inline"> <?php esc_html_e('Caption', 'gravityforms'); ?> </label> <br /> <input type="checkbox" id="gfield_display_description" onclick="SetPostImageMeta();" /> <label for="gfield_display_description" class="inline"> <?php esc_html_e('Description', 'gravityforms'); ?> </label> </li> <?php do_action('gform_field_standard_settings', 1025, $form_id); ?> <li class="post_image_featured_image field_setting"> <input type="checkbox" id="gfield_featured_image" onclick="SetFeaturedImage();" /> <label for="gfield_featured_image" class="inline"><?php esc_html_e('Set as Featured Image', 'gravityforms'); ?> <?php gform_tooltip('form_field_featured_image'); ?> </label> </li> <?php do_action('gform_field_standard_settings', 1050, $form_id); ?> <li class="address_setting field_setting"> <?php $addressTypes = $gf_address_field->get_address_types(rgar($form, 'id')); ?> <label for="field_address_type"> <?php esc_html_e('Address Type', 'gravityforms'); ?> <?php gform_tooltip('form_field_address_type'); ?> </label> <select id="field_address_type" onchange="ChangeAddressType();"> <?php foreach ($addressTypes as $key => $addressType) { ?> <option value="<?php echo esc_attr($key); ?> "><?php echo esc_html($addressType['label']); ?> </option> <?php } ?> </select> <div class="custom_inputs_sub_setting gfield_sub_setting"> <label for="field_address_fields" class="inline"> <?php esc_html_e('Address Fields', 'gravityforms'); ?> <?php gform_tooltip('form_field_address_fields'); ?> </label> <div id="field_address_fields_container" style="padding-top:10px;"> <!-- content dynamically created from js.php --> </div> </div> <?php foreach ($addressTypes as $key => $addressType) { $state_label = isset($addressType['state_label']) ? esc_attr($addressType['state_label']) : __('State', 'gravityforms'); ?> <div id="address_type_container_<?php echo esc_attr($key); ?> " class="gfield_sub_setting gfield_address_type_container"> <input type="hidden" id="field_address_country_<?php echo esc_attr($key); ?> " value="<?php echo isset($addressType['country']) ? esc_attr($addressType['country']) : ''; ?> " /> <input type="hidden" id="field_address_zip_label_<?php echo esc_attr($key); ?> " value="<?php echo isset($addressType['zip_label']) ? esc_attr($addressType['zip_label']) : __('Postal Code', 'gravityforms'); ?> " /> <input type="hidden" id="field_address_state_label_<?php echo esc_attr($key); ?> " value="<?php echo $state_label; ?> " /> <input type="hidden" id="field_address_has_states_<?php echo esc_attr($key); ?> " value="<?php echo is_array(rgget('states', $addressType)) ? '1' : ''; ?> " /> <?php if (isset($addressType['states']) && is_array($addressType['states'])) { ?> <label for="field_address_default_state_<?php echo esc_attr($key); ?> "> <?php echo sprintf(__('Default %s', 'gravityforms'), $state_label); ?> <?php gform_tooltip("form_field_address_default_state_{$key}"); ?> </label> <select id="field_address_default_state_<?php echo esc_attr($key); ?> " class="field_address_default_state" onchange="SetAddressProperties();"> <?php echo $gf_address_field->get_state_dropdown($addressType['states']); ?> </select> <?php } ?> <?php if (!isset($addressType['country'])) { ?> <label for="field_address_default_country_<?php echo $key; ?> "> <?php esc_html_e('Default Country', 'gravityforms'); ?> <?php gform_tooltip('form_field_address_default_country'); ?> </label> <select id="field_address_default_country_<?php echo $key; ?> " class="field_address_default_country" onchange="SetAddressProperties();"> <?php echo $gf_address_field->get_country_dropdown(); ?> </select> <?php } ?> </div> <?php } ?> </li> <?php do_action('gform_field_standard_settings', 1100, $form_id); ?> <li class="name_format_setting field_setting"> <label for="field_name_format"> <?php esc_html_e('Name Format', 'gravityforms'); ?> <?php gform_tooltip('form_field_name_format'); ?> </label> <select id="field_name_format" onchange="StartChangeNameFormat(jQuery(this).val());"> <option value="extended"><?php esc_html_e('Extended', 'gravityforms'); ?> </option> <option value="advanced"><?php esc_html_e('Advanced', 'gravityforms'); ?> </option> </select> </li> <?php do_action('gform_field_standard_settings', 1125, $form_id); ?> <li class="name_setting field_setting"> <div class="custom_inputs_setting gfield_sub_setting"> <label for="field_name_fields" class="inline"> <?php esc_html_e('Name Fields', 'gravityforms'); ?> <?php gform_tooltip('form_field_name_fields'); ?> </label> <div id="field_name_fields_container" style="padding-top:10px;"> <!-- content dynamically created from js.php --> </div> </div> </li> <?php do_action('gform_field_standard_settings', 1150, $form_id); ?> <li class="date_input_type_setting field_setting"> <label for="field_date_input_type"> <?php esc_html_e('Date Input Type', 'gravityforms'); ?> <?php gform_tooltip('form_field_date_input_type'); ?> </label> <select id="field_date_input_type" onchange="SetDateInputType(jQuery(this).val());"> <option value="datefield"><?php esc_html_e('Date Field', 'gravityforms'); ?> </option> <option value="datepicker"><?php esc_html_e('Date Picker', 'gravityforms'); ?> </option> <option value="datedropdown"><?php esc_html_e('Date Drop Down', 'gravityforms'); ?> </option> </select> <div id="date_picker_container"> <input type="radio" id="gsetting_icon_none" name="gsetting_icon" value="none" onclick="SetCalendarIconType(this.value);" /> <label for="gsetting_icon_none" class="inline"> <?php esc_html_e('No Icon', 'gravityforms'); ?> </label> <input type="radio" id="gsetting_icon_calendar" name="gsetting_icon" value="calendar" onclick="SetCalendarIconType(this.value);" /> <label for="gsetting_icon_calendar" class="inline"> <?php esc_html_e('Calendar Icon', 'gravityforms'); ?> </label> <input type="radio" id="gsetting_icon_custom" name="gsetting_icon" value="custom" onclick="SetCalendarIconType(this.value);" /> <label for="gsetting_icon_custom" class="inline"> <?php esc_html_e('Custom Icon', 'gravityforms'); ?> </label> <div id="gfield_icon_url_container"> <label for="gfield_calendar_icon_url" class="inline"> <?php esc_html_e('Image Path: ', 'gravityforms'); ?> </label> <input type="text" id="gfield_calendar_icon_url" size="45" /> <div class="instruction"><?php esc_html_e('Preview this form to see your custom icon.', 'gravityforms'); ?> </div> </div> </div> </li> <?php do_action('gform_field_standard_settings', 1200, $form_id); ?> <li class="date_format_setting field_setting"> <label for="field_date_format"> <?php esc_html_e('Date Format', 'gravityforms'); ?> <?php gform_tooltip('form_field_date_format'); ?> </label> <select id="field_date_format" onchange="SetDateFormat(jQuery(this).val());"> <option value="mdy">mm/dd/yyyy</option> <option value="dmy">dd/mm/yyyy</option> <option value="dmy_dash">dd-mm-yyyy</option> <option value="dmy_dot">dd.mm.yyyy</option> <option value="ymd_slash">yyyy/mm/dd</option> <option value="ymd_dash">yyyy-mm-dd</option> <option value="ymd_dot">yyyy.mm.dd</option> </select> </li> <?php do_action('gform_field_standard_settings', 1225, $form_id); ?> <li class="customize_inputs_setting field_setting"> <label for="field_enable_customize_inputs" class="inline"> <?php esc_html_e('Customize Fields', 'gravityforms'); ?> </label> <?php gform_tooltip('form_field_customize_inputs'); ?> <div id="field_customize_inputs_container" style="padding-top:10px;"> <!-- content dynamically created from js.php --> </div> </li> <?php do_action('gform_field_standard_settings', 1250, $form_id); ?> <li class="file_extensions_setting field_setting"> <label for="field_file_extension"> <?php esc_html_e('Allowed file extensions', 'gravityforms'); ?> <?php gform_tooltip('form_field_fileupload_allowed_extensions'); ?> </label> <input type="text" id="field_file_extension" size="40" /> <div> <small><?php esc_html_e('Separated with commas (i.e. jpg, gif, png, pdf)', 'gravityforms'); ?> </small> </div> </li> <?php do_action('gform_field_standard_settings', 1260, $form_id); ?> <li class="multiple_files_setting field_setting"> <input type="checkbox" id="field_multiple_files" onclick="ToggleMultiFile();" /> <label for="field_multiple_files" class="inline"> <?php esc_html_e('Enable Multi-File Upload', 'gravityforms'); ?> <?php gform_tooltip('form_field_multiple_files'); ?> </label> <div id="gform_multiple_files_options"> <br /> <div> <label for="field_max_files"> <?php esc_html_e('Maximum Number of Files', 'gravityforms'); ?> <?php gform_tooltip('form_field_max_files'); ?> </label> <input type="text" id="field_max_files" size="10" /> </div> <br /> </div> </li> <?php do_action('gform_field_standard_settings', 1267, $form_id); ?> <li class="file_size_setting field_setting"> <label for="field_max_file_size"> <?php esc_html_e('Maximum File Size', 'gravityforms'); ?> <?php gform_tooltip('form_field_max_file_size'); ?> </label> <input type="text" id="field_max_file_size" size="10" placeholder="<?php $max_upload_size = wp_max_upload_size() / 1048576; echo $max_upload_size; ?> MB" /> <div> <small><?php echo __(sprintf('Maximum allowed on this server: %sMB', $max_upload_size), 'gravityforms'); ?> </small> </div> </li> <?php do_action('gform_field_standard_settings', 1275, $form_id); ?> <li class="columns_setting field_setting"> <input type="checkbox" id="field_columns_enabled" onclick="SetFieldProperty('enableColumns', this.checked); ToggleColumns();" /> <label for="field_columns_enabled" class="inline"><?php esc_html_e('Enable multiple columns', 'gravityforms'); gform_tooltip('form_field_columns'); ?> </label> <br /> <div id="gfield_settings_columns_container"> <ul id="field_columns"></ul> </div> </li> <?php do_action('gform_field_standard_settings', 1287, $form_id); ?> <li class="maxrows_setting field_setting"> <label for="field_maxrows"> <?php esc_html_e('Maximum Rows', 'gravityforms'); ?> <?php gform_tooltip('form_field_maxrows'); ?> </label> <input type="text" id="field_maxrows" /> </li> <?php do_action('gform_field_standard_settings', 1300, $form_id); ?> <li class="time_format_setting field_setting"> <label for="field_time_format"> <?php esc_html_e('Time Format', 'gravityforms'); ?> <?php gform_tooltip('form_field_time_format'); ?> </label> <select id="field_time_format" onchange="SetTimeFormat(this.value);"> <option value="12"><?php esc_html_e('12 hour', 'gravityforms'); ?> </option> <option value="24"><?php esc_html_e('24 hour', 'gravityforms'); ?> </option> </select> </li> <?php do_action('gform_field_standard_settings', 1325, $form_id); ?> <li class="phone_format_setting field_setting"> <label for="field_phone_format"> <?php esc_html_e('Phone Format', 'gravityforms'); ?> <?php gform_tooltip('form_field_phone_format'); ?> </label> <select id="field_phone_format" onchange="SetFieldPhoneFormat(jQuery(this).val());"> <option value="standard">(###) ###-####</option> <option value="international"><?php esc_html_e('International', 'gravityforms'); ?> </option> </select> </li> <?php do_action('gform_field_standard_settings', 1350, $form_id); ?> <li class="choices_setting field_setting"> <div style="float:right;"> <input type="checkbox" id="field_choice_values_enabled" onclick="SetFieldProperty('enableChoiceValue', this.checked); ToggleChoiceValue(); SetFieldChoices();" /> <label for="field_choice_values_enabled" class="inline gfield_value_label"><?php esc_html_e('show values', 'gravityforms'); ?> </label> </div> <?php echo apply_filters('gform_choices_setting_title', __('Choices', 'gravityforms')); ?> <?php gform_tooltip('form_field_choices'); ?> <br /> <div id="gfield_settings_choices_container"> <label class="gfield_choice_header_label"><?php esc_html_e('Label', 'gravityforms'); ?> </label><label class="gfield_choice_header_value"><?php esc_html_e('Value', 'gravityforms'); ?> </label><label class="gfield_choice_header_price"><?php esc_html_e('Price', 'gravityforms'); ?> </label> <ul id="field_choices"></ul> </div> <?php $window_title = __('Bulk Add / Predefined Choices', 'gravityforms'); ?> <input type='button' value='<?php echo esc_attr($window_title); ?> ' onclick="tb_show('<?php echo esc_js($window_title); ?> ', '#TB_inline?height=400&width=600&inlineId=gfield_bulk_add', '');" class="button" /> <div id="gfield_bulk_add" style="display:none;"> <div> <?php $predefined_choices = array(__('Countries', 'gravityforms') => $gf_address_field->get_countries(), __('U.S. States', 'gravityforms') => $gf_address_field->get_us_states(), __('Canadian Province/Territory', 'gravityforms') => $gf_address_field->get_canadian_provinces(), __('Continents', 'gravityforms') => array(__('Africa', 'gravityforms'), __('Antarctica', 'gravityforms'), __('Asia', 'gravityforms'), __('Australia', 'gravityforms'), __('Europe', 'gravityforms'), __('North America', 'gravityforms'), __('South America', 'gravityforms')), __('Gender', 'gravityforms') => array(__('Male', 'gravityforms'), __('Female', 'gravityforms'), __('Prefer Not to Answer', 'gravityforms')), __('Age', 'gravityforms') => array(__('Under 18', 'gravityforms'), __('18-24', 'gravityforms'), __('25-34', 'gravityforms'), __('35-44', 'gravityforms'), __('45-54', 'gravityforms'), __('55-64', 'gravityforms'), __('65 or Above', 'gravityforms'), __('Prefer Not to Answer', 'gravityforms')), __('Marital Status', 'gravityforms') => array(__('Single', 'gravityforms'), __('Married', 'gravityforms'), __('Divorced', 'gravityforms'), __('Widowed', 'gravityforms')), __('Employment', 'gravityforms') => array(__('Employed Full-Time', 'gravityforms'), __('Employed Part-Time', 'gravityforms'), __('Self-employed', 'gravityforms'), __('Not employed but looking for work', 'gravityforms'), __('Not employed and not looking for work', 'gravityforms'), __('Homemaker', 'gravityforms'), __('Retired', 'gravityforms'), __('Student', 'gravityforms'), __('Prefer Not to Answer', 'gravityforms')), __('Job Type', 'gravityforms') => array(__('Full-Time', 'gravityforms'), __('Part-Time', 'gravityforms'), __('Per Diem', 'gravityforms'), __('Employee', 'gravityforms'), __('Temporary', 'gravityforms'), __('Contract', 'gravityforms'), __('Intern', 'gravityforms'), __('Seasonal', 'gravityforms')), __('Industry', 'gravityforms') => array(__('Accounting/Finance', 'gravityforms'), __('Advertising/Public Relations', 'gravityforms'), __('Aerospace/Aviation', 'gravityforms'), __('Arts/Entertainment/Publishing', 'gravityforms'), __('Automotive', 'gravityforms'), __('Banking/Mortgage', 'gravityforms'), __('Business Development', 'gravityforms'), __('Business Opportunity', 'gravityforms'), __('Clerical/Administrative', 'gravityforms'), __('Construction/Facilities', 'gravityforms'), __('Consumer Goods', 'gravityforms'), __('Customer Service', 'gravityforms'), __('Education/Training', 'gravityforms'), __('Energy/Utilities', 'gravityforms'), __('Engineering', 'gravityforms'), __('Government/Military', 'gravityforms'), __('Green', 'gravityforms'), __('Healthcare', 'gravityforms'), __('Hospitality/Travel', 'gravityforms'), __('Human Resources', 'gravityforms'), __('Installation/Maintenance', 'gravityforms'), __('Insurance', 'gravityforms'), __('Internet', 'gravityforms'), __('Job Search Aids', 'gravityforms'), __('Law Enforcement/Security', 'gravityforms'), __('Legal', 'gravityforms'), __('Management/Executive', 'gravityforms'), __('Manufacturing/Operations', 'gravityforms'), __('Marketing', 'gravityforms'), __('Non-Profit/Volunteer', 'gravityforms'), __('Pharmaceutical/Biotech', 'gravityforms'), __('Professional Services', 'gravityforms'), __('QA/Quality Control', 'gravityforms'), __('Real Estate', 'gravityforms'), __('Restaurant/Food Service', 'gravityforms'), __('Retail', 'gravityforms'), __('Sales', 'gravityforms'), __('Science/Research', 'gravityforms'), __('Skilled Labor', 'gravityforms'), __('Technology', 'gravityforms'), __('Telecommunications', 'gravityforms'), __('Transportation/Logistics', 'gravityforms'), __('Other', 'gravityforms')), __('Income', 'gravityforms') => array(__('Under $20,000', 'gravityforms'), __('$20,000 - $30,000', 'gravityforms'), __('$30,000 - $40,000', 'gravityforms'), __('$40,000 - $50,000', 'gravityforms'), __('$50,000 - $75,000', 'gravityforms'), __('$75,000 - $100,000', 'gravityforms'), __('$100,000 - $150,000', 'gravityforms'), __('$150,000 or more', 'gravityforms'), __('Prefer Not to Answer', 'gravityforms')), __('Education', 'gravityforms') => array(__('High School', 'gravityforms'), __('Associate Degree', 'gravityforms'), __("Bachelor's Degree", 'gravityforms'), __('Graduate of Professional Degree', 'gravityforms'), __('Some College', 'gravityforms'), __('Other', 'gravityforms'), __('Prefer Not to Answer', 'gravityforms')), __('Days of the Week', 'gravityforms') => array(__('Sunday', 'gravityforms'), __('Monday', 'gravityforms'), __('Tuesday', 'gravityforms'), __('Wednesday', 'gravityforms'), __('Thursday', 'gravityforms'), __('Friday', 'gravityforms'), __('Saturday', 'gravityforms')), __('Months of the Year', 'gravityforms') => array(__('January', 'gravityforms'), __('February', 'gravityforms'), __('March', 'gravityforms'), __('April', 'gravityforms'), __('May', 'gravityforms'), __('June', 'gravityforms'), __('July', 'gravityforms'), __('August', 'gravityforms'), __('September', 'gravityforms'), __('October', 'gravityforms'), __('November', 'gravityforms'), __('December', 'gravityforms')), __('How Often', 'gravityforms') => array(__('Everyday', 'gravityforms'), __('Once a week', 'gravityforms'), __('2 to 3 times a week', 'gravityforms'), __('Once a month', 'gravityforms'), __(' 2 to 3 times a month', 'gravityforms'), __('Less than once a month', 'gravityforms')), __('How Long', 'gravityforms') => array(__('Less than a month', 'gravityforms'), __('1-6 months', 'gravityforms'), __('1-3 years', 'gravityforms'), __('Over 3 Years', 'gravityforms'), __('Never used', 'gravityforms')), __('Satisfaction', 'gravityforms') => array(__('Very Satisfied', 'gravityforms'), __('Satisfied', 'gravityforms'), __('Neutral', 'gravityforms'), __('Unsatisfied', 'gravityforms'), __('Very Unsatisfied', 'gravityforms')), __('Importance', 'gravityforms') => array(__('Very Important', 'gravityforms'), __('Important', 'gravityforms'), __('Somewhat Important', 'gravityforms'), __('Not Important', 'gravityforms')), __('Agreement', 'gravityforms') => array(__('Strongly Agree', 'gravityforms'), __('Agree', 'gravityforms'), __('Disagree', 'gravityforms'), __('Strongly Disagree', 'gravityforms')), __('Comparison', 'gravityforms') => array(__('Much Better', 'gravityforms'), __('Somewhat Better', 'gravityforms'), __('About the Same', 'gravityforms'), __('Somewhat Worse', 'gravityforms'), __('Much Worse', 'gravityforms')), __('Would You', 'gravityforms') => array(__('Definitely', 'gravityforms'), __('Probably', 'gravityforms'), __('Not Sure', 'gravityforms'), __('Probably Not', 'gravityforms'), __('Definitely Not', 'gravityforms')), __('Size', 'gravityforms') => array(__('Extra Small', 'gravityforms'), __('Small', 'gravityforms'), __('Medium', 'gravityforms'), __('Large', 'gravityforms'), __('Extra Large', 'gravityforms'))); $predefined_choices = gf_apply_filters(array('gform_predefined_choices', rgar($form, 'id')), $predefined_choices); $custom_choices = RGFormsModel::get_custom_choices(); ?> <div class="panel-instructions"><?php esc_html_e('Select a category and customize the predefined choices or paste your own list to bulk add choices.', 'gravityforms'); ?> </div> <div class="bulk-left-panel"> <ul id="bulk_items"> <?php foreach (array_keys($predefined_choices) as $name) { $key = str_replace("'", "\\'", $name); ?> <li> <a href="javascript:void(0);" onclick="SelectPredefinedChoice('<?php echo $key; ?> ');" class="bulk-choice"><?php echo $name; ?> </a> <?php } ?> </ul> </div> <div class="bulk-arrow-mid"></div> <textarea id="gfield_bulk_add_input"></textarea> <br style="clear:both;" /> <div class="panel-buttons" style=""> <input type="button" onclick="InsertBulkChoices(jQuery('#gfield_bulk_add_input').val().split('\n')); tb_remove();" class="button-primary" value="<?php esc_attr_e('Insert Choices', 'gravityforms'); ?> " /> <input type="button" onclick="tb_remove();" class="button" value="<?php esc_attr_e('Cancel', 'gravityforms'); ?> " /> </div> <div class="panel-custom" style=""> <a href="javascript:void(0);" onclick="LoadCustomChoicesPanel(true, 'slow');" id="bulk_save_as"><?php esc_html_e('Save as new custom choice', 'gravityforms'); ?> </a> <div id="bulk_custom_edit" style="display:none;"> <?php esc_html_e('Save as', 'gravityforms'); ?> <input type="text" id="custom_choice_name" value="<?php esc_attr_e('Enter name', 'gravityforms'); ?> " onfocus="if(this.value == '<?php echo esc_js(__('enter name', 'gravityforms')); ?> ') this.value='';"> <a href="javascript:void(0);" onclick="SaveCustomChoices();" class="button" id="bulk_save_button"><?php esc_html_e('Save', 'gravityforms'); ?> </a> <a href="javascript:void(0);" onclick="CloseCustomChoicesPanel('slow');" id="bulk_cancel_link"><?php esc_html_e('Cancel', 'gravityforms'); ?> </a> <a href="javascript:void(0);" onclick="DeleteCustomChoice();" id="bulk_delete_link"><?php esc_html_e('Delete', 'gravityforms'); ?> </a> </div> <div id="bulk_custom_message" class="alert_yellow" style="display:none; margin-top:8px; padding: 8px;"> <!--Message will be added via javascript--> </div> </div> <script type="text/javascript"> var gform_selected_custom_choice = ''; var gform_custom_choices = <?php echo GFCommon::json_encode($custom_choices); ?> ; var gform_predefined_choices = <?php echo GFCommon::json_encode($predefined_choices); ?> ; </script> </div> </div> </li> <?php do_action('gform_field_standard_settings', 1362, $form_id); ?> <li class="other_choice_setting field_setting"> <input type="checkbox" id="field_other_choice" onclick="var value = jQuery(this).is(':checked'); SetFieldProperty('enableOtherChoice', value); UpdateFieldChoices(GetInputType(field));" /> <label for="field_other_choice" class="inline"> <?php esc_html_e('Enable "other" choice', 'gravityforms'); ?> <?php gform_tooltip('form_field_other_choice'); ?> </label> </li> <?php do_action('gform_field_standard_settings', 1368, $form_id); ?> <li class="email_confirm_setting field_setting"> <input type="checkbox" id="gfield_email_confirm_enabled" onclick="SetEmailConfirmation(this.checked);" /> <label for="gfield_email_confirm_enabled" class="inline"> <?php esc_html_e('Enable Email Confirmation', 'gravityforms'); ?> <?php gform_tooltip('form_field_email_confirm_enable'); ?> </label> </li> <?php do_action('gform_field_standard_settings', 1375, $form_id); ?> <li class="password_strength_setting field_setting"> <input type="checkbox" id="gfield_password_strength_enabled" onclick="TogglePasswordStrength(); SetPasswordStrength(this.checked);" /> <label for="gfield_password_strength_enabled" class="inline"> <?php esc_html_e('Enable Password Strength', 'gravityforms'); ?> <?php gform_tooltip('form_field_password_strength_enable'); ?> </label> </li> <?php do_action('gform_field_standard_settings', 1387, $form_id); ?> <li id="gfield_min_strength_container"> <label for="gfield_min_strength"> <?php esc_html_e('Minimum Strength', 'gravityforms'); ?> <?php gform_tooltip('form_field_password_strength_enable'); ?> </label> <select id="gfield_min_strength" onchange="SetFieldProperty('minPasswordStrength', jQuery(this).val());"> <option value=""><?php esc_html_e('None', 'gravityforms'); ?> </option> <option value="short"><?php esc_html_e('Short', 'gravityforms'); ?> </option> <option value="bad"><?php esc_html_e('Bad', 'gravityforms'); ?> </option> <option value="good"><?php esc_html_e('Good', 'gravityforms'); ?> </option> <option value="strong"><?php esc_html_e('Strong', 'gravityforms'); ?> </option> </select> </li> <?php do_action('gform_field_standard_settings', 1400, $form_id); ?> <li class="number_format_setting field_setting"> <label for="field_number_format"> <?php esc_html_e('Number Format', 'gravityforms'); ?> <?php gform_tooltip('form_field_number_format'); ?> </label> <select id="field_number_format" onchange="SetFieldProperty('numberFormat', this.value);jQuery('.field_calculation_rounding').toggle(this.value != 'currency');"> <option value="decimal_dot">9,999.99</option> <option value="decimal_comma">9.999,99</option> <option value="currency"><?php esc_html_e('Currency', 'gravityforms'); ?> </option> </select> </li> <?php do_action('gform_field_standard_settings', 1415, $form_id); ?> <li class="sub_labels_setting field_setting"> <label for="field_sub_labels"> <?php esc_html_e('Sub-Labels', 'gravityforms'); ?> <?php gform_tooltip('form_field_sub_labels'); ?> </label> <div id="field_sub_labels_container"> <!-- content dynamically created from js.php --> </div> </li> <?php do_action('gform_field_standard_settings', 1425, $form_id); ?> <?php do_action('gform_field_standard_settings', 1430, $form_id); ?> <li class="credit_card_setting field_setting"> <label> <?php esc_html_e('Supported Credit Cards', 'gravityforms'); ?> <?php gform_tooltip('form_field_credit_cards'); ?> </label> <ul> <?php $cards = GFCommon::get_card_types(); foreach ($cards as $card) { ?> <li> <input type="checkbox" id="field_credit_card_<?php echo esc_attr($card['slug']); ?> " value="<?php echo esc_attr($card['slug']); ?> " onclick="SetCardType(this, this.value);" /> <label for="field_credit_card_<?php echo esc_attr($card['slug']); ?> " class="inline"><?php echo esc_html($card['name']); ?> </label> </li> <?php } ?> </ul> </li> <?php do_action('gform_field_standard_settings', 1435, $form_id); ?> <li class="credit_card_style_setting field_setting"> <label for="credit_card_style"> <?php esc_html_e('Card Icon Style', 'gravityforms'); ?> <?php gform_tooltip('form_field_card_style'); ?> </label> <select id="credit_card_style" onchange="SetFieldProperty('creditCardStyle', this.value);"> <option value="style1"><?php esc_html_e('Standard', 'gravityforms'); ?> </option> <option value="style2"><?php esc_html_e('3D', 'gravityforms'); ?> </option> </select> </li> <?php do_action('gform_field_standard_settings', 1440, $form_id); ?> <li class="input_mask_setting field_setting"> <input type="checkbox" id="field_input_mask" onclick="ToggleInputMask();" /> <label for="field_input_mask" class="inline"> <?php esc_html_e('Input Mask', 'gravityforms'); ?> <?php gform_tooltip('form_field_mask'); ?> </label><br /> <div id="gform_input_mask"> <br /> <div style="width:100px; float:left;"> <input type="radio" name="field_mask_option" id="field_mask_standard" size="10" onclick="ToggleInputMaskOptions();" /> <label for="field_mask_standard" class="inline"> <?php esc_html_e('Standard', 'gravityforms'); ?> </label> </div> <div style="width:100px; float:left;"> <input type="radio" name="field_mask_option" id="field_mask_custom" size="10" onclick="ToggleInputMaskOptions();" /> <label for="field_mask_custom" class="inline"> <?php esc_html_e('Custom', 'gravityforms'); ?> </label> </div> <div class="clear"></div> <input type="text" id="field_mask_text" size="35" /> <p class="mask_text_description" style="margin:5px 0 0;"> <?php esc_html_e('Enter a custom mask', 'gravityforms'); ?> . <a href="javascript:void(0);" onclick="tb_show('<?php echo esc_js(__('Custom Mask Instructions', 'gravityforms')); ?> ', '#TB_inline?width=350&inlineId=custom_mask_instructions', '');"><?php esc_html_e('Help', 'gravityforms'); ?> </a> </p> <div id="custom_mask_instructions" style="display:none;"> <div class="custom_mask_instructions"> <h4><?php esc_html_e('Usage', 'gravityforms'); ?> </h4> <ul class="description-list"> <li><?php esc_html_e("Use a '9' to indicate a numerical character.", 'gravityforms'); ?> </li> <li><?php esc_html_e("Use a lower case 'a' to indicate an alphabetical character.", 'gravityforms'); ?> </li> <li><?php esc_html_e("Use an asterisk '*' to indicate any alphanumeric character.", 'gravityforms'); ?> </li> <li><?php esc_html_e("Use a question mark '?' to indicate optional characters. Note: All characters after the question mark will be optional.", 'gravityforms'); ?> </li> <li><?php esc_html_e('All other characters are literal values and will be displayed automatically.', 'gravityforms'); ?> </li> </ul> <h4><?php esc_html_e('Examples', 'gravityforms'); ?> </h4> <ul class="examples-list"> <li> <h5><?php esc_html_e('Date', 'gravityforms'); ?> </h5> <span class="label"><?php esc_html_e('Mask', 'gravityforms'); ?> </span> <code>99/99/9999</code><br /> <span class="label"><?php esc_html_e('Valid Input', 'gravityforms'); ?> </span> <code>10/21/2011</code> </li> <li> <h5><?php esc_html_e('Social Security Number', 'gravityforms'); ?> </h5> <span class="label"><?php esc_html_e('Mask', 'gravityforms'); ?> </span> <code>999-99-9999</code><br /> <span class="label"><?php esc_html_e('Valid Input', 'gravityforms'); ?> </span> <code>987-65-4329</code> </li> <li> <h5><?php esc_html_e('Course Code', 'gravityforms'); ?> </h5> <span class="label"><?php esc_html_e('Mask', 'gravityforms'); ?> </span> <code>aaa 999</code><br /> <span class="label"><?php esc_html_e('Valid Input', 'gravityforms'); ?> </span> <code>BIO 101</code> </li> <li> <h5><?php esc_html_e('License Key', 'gravityforms'); ?> </h5> <span class="label"><?php esc_html_e('Mask', 'gravityforms'); ?> </span> <code>***-***-***</code><br /> <span class="label"><?php esc_html_e('Valid Input', 'gravityforms'); ?> </span> <code>a9a-f0c-28Q</code> </li> <li> <h5><?php esc_html_e('Zip Code w/ Optional Plus Four', 'gravityforms'); ?> </h5> <span class="label"><?php esc_html_e('Mask', 'gravityforms'); ?> </span> <code>99999?-9999</code><br /> <span class="label"><?php esc_html_e('Valid Input', 'gravityforms'); ?> </span> <code>23462</code> or <code>23462-4062</code> </li> </ul> </div> </div> <select id="field_mask_select" onchange="SetFieldProperty('inputMaskValue', jQuery(this).val());"> <option value=""><?php esc_html_e('Select a Mask', 'gravityforms'); ?> </option> <?php $masks = RGFormsModel::get_input_masks(); foreach ($masks as $mask_name => $mask_value) { ?> <option value="<?php echo esc_attr($mask_value); ?> "><?php echo esc_html($mask_name); ?> </option> <?php } ?> </select> </div> </li> <?php do_action('gform_field_standard_settings', 1450, $form_id); ?> <li class="maxlen_setting field_setting"> <label for="field_maxlen"> <?php esc_html_e('Maximum Characters', 'gravityforms'); ?> <?php gform_tooltip('form_field_maxlength'); ?> </label> <input type="text" id="field_maxlen" /></input> </li> <?php do_action('gform_field_standard_settings', 1500, $form_id); ?> <li class="range_setting field_setting"> <div style="clear:both;"><?php esc_html_e('Range', 'gravityforms'); ?> <?php gform_tooltip('form_field_number_range'); ?> </div> <div style="width:90px; float:left;"> <input type="text" id="field_range_min" size="10" /> <label for="field_range_min"> <?php esc_html_e('Min', 'gravityforms'); ?> </label> </div> <div style="width:90px; float:left;"> <input type="text" id="field_range_max" size="10" /> <label for="field_range_max"> <?php esc_html_e('Max', 'gravityforms'); ?> </label> </div> <br class="clear" /> </li> <?php do_action('gform_field_standard_settings', 1550, $form_id); ?> <li class="calculation_setting field_setting"> <div class="field_enable_calculation"> <input type="checkbox" id="field_enable_calculation" onclick="ToggleCalculationOptions(this.checked, field);" /> <label for="field_enable_calculation" class="inline"> <?php esc_html_e('Enable Calculation', 'gravityforms'); ?> <?php gform_tooltip('form_field_enable_calculation'); ?> </label> </div> <div id="calculation_options" style="display:none;margin-top:10px;"> <label for="field_calculation_formula"> <?php esc_html_e('Formula', 'gravityforms'); ?> <?php gform_tooltip('form_field_calculation_formula'); ?> </label> <div> <?php GFCommon::insert_calculation_variables($form['fields'], 'field_calculation_formula', '', 'FormulaContentCallback', 40); ?> <div class="gf_calculation_buttons"> <?php foreach (array('+', '-', '/', '*', '(', ')', '.') as $button) { ?> <input type="button" value="<?php echo in_array($button, array('.')) ? $button : " {$button} "; ?> " onclick="InsertVariable('field_calculation_formula', 'FormulaContentCallback', this.value);" /> <?php } ?> </div> </div> <textarea id="field_calculation_formula" class="fieldwidth-3 fieldheight-2"></textarea> <br /> <a href="javascript:void(0)" onclick="var field = GetSelectedField(); alert(IsValidFormula(field.calculationFormula) ? '<?php echo esc_js(__('The formula appears to be valid.', 'gravityforms')); ?> ' : '<?php echo esc_js(__('There appears to be a problem with the formula.', 'gravityforms')); ?> ');"><?php esc_html_e('Validate Formula', 'gravityforms'); ?> </a> <div class="field_calculation_rounding"> <label for="field_calculation_rounding" style="margin-top:10px;"> <?php esc_html_e('Rounding', 'gravityforms'); ?> <?php gform_tooltip('form_field_calculation_rounding'); ?> </label> <select id="field_calculation_rounding" onchange="SetFieldProperty('calculationRounding', this.value);"> <option value="0">0</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="norounding">Do not round</option> </select> </div> </div> <br class="clear" /> </li> <?php do_action('gform_field_standard_settings', 1600, $form_id); ?> <li class="rules_setting field_setting"> <?php esc_html_e('Rules', 'gravityforms'); ?> <br /> <input type="checkbox" id="field_required" onclick="SetFieldRequired(this.checked);" /> <label for="field_required" class="inline"> <?php esc_html_e('Required', 'gravityforms'); ?> <?php gform_tooltip('form_field_required'); ?> </label><br /> <div class="duplicate_setting field_setting"> <input type="checkbox" id="field_no_duplicates" onclick="SetFieldProperty('noDuplicates', this.checked);" /> <label for="field_no_duplicates" class="inline"> <?php esc_html_e('No Duplicates', 'gravityforms'); ?> <?php gform_tooltip('form_field_no_duplicate'); ?> </label> </div> </li> <?php do_action('gform_field_standard_settings', -1, $form_id); ?> </ul> </div> <div id="gform_tab_3"> <ul> <?php /** * An action that appears multiple times (labeled with an ID. Eg 0, 20, 50) before each of the setting sections of the appearance settings * * @param int # And ID for a certain part of the appearance settings * @param int $form_id The current form ID */ do_action('gform_field_appearance_settings', 0, $form_id); ?> <li class="placeholder_setting field_setting"> <label for="field_placeholder"> <?php esc_html_e('Placeholder', 'gravityforms'); ?> <?php gform_tooltip('form_field_placeholder'); ?> </label> <input type="text" id="field_placeholder" class="field_placeholder fieldwidth-2 merge-tag-support mt-position-right mt-prepopulate" /> </li> <?php do_action('gform_field_appearance_settings', 20, $form_id); ?> <li class="placeholder_textarea_setting field_setting"> <label for="field_placeholder_textarea"> <?php esc_html_e('Placeholder', 'gravityforms'); ?> <?php gform_tooltip('form_field_placeholder'); ?> </label> <textarea id="field_placeholder_textarea" class="field_placeholder fieldwidth-3 merge-tag-support mt-position-right mt-prepopulate"></textarea> </li> <?php do_action('gform_field_appearance_settings', 50, $form_id); ?> <li class="input_placeholders_setting field_setting"> <label> <?php esc_html_e('Placeholders', 'gravityforms'); ?> <?php gform_tooltip('form_field_input_placeholders'); ?> </label> <div id="field_input_placeholders_container"> <!-- content dynamically created from js.php --> </div> </li> <?php do_action('gform_field_appearance_settings', 100, $form_id); $label_placement_form_setting = rgar($form, 'labelPlacement'); switch ($label_placement_form_setting) { case 'left_label': $label_placement_form_setting_label = __('Left aligned', 'gravityforms'); break; case 'right_label': $label_placement_form_setting_label = __('Right aligned', 'gravityforms'); break; case 'top_label': default: $label_placement_form_setting_label = __('Top aligned', 'gravityforms'); } $enable_label_visiblity_settings = apply_filters('gform_enable_field_label_visibility_settings', false); $description_placement_form_setting = rgar($form, 'descriptionPlacement'); $description_placement_form_setting_label = $description_placement_form_setting == 'above' ? $description_placement_form_setting_label = __('Above inputs', 'gravityforms') : ($description_placement_form_setting_label = __('Below inputs', 'gravityforms')); ?> <li class="label_placement_setting field_setting"> <?php if ($enable_label_visiblity_settings) { ?> <label for="field_label_placement"> <?php esc_html_e('Field Label Visibility', 'gravityforms'); ?> <?php gform_tooltip('form_field_label_placement'); ?> </label> <select id="field_label_placement" onchange="SetFieldLabelPlacement(jQuery(this).val());"> <option value=""><?php printf(__('Visible (%s)', 'gravityforms'), esc_html($label_placement_form_setting_label)); ?> </option> <option value="hidden_label"><?php esc_html_e('Hidden', 'gravityforms'); ?> </option> </select> <?php } ?> <div id="field_description_placement_container" style="display:none; padding-top:10px;"> <label for="field_description_placement"> <?php esc_html_e('Description Placement', 'gravityforms'); ?> <?php gform_tooltip('form_field_description_placement'); ?> </label> <select id="field_description_placement" onchange="SetFieldDescriptionPlacement(jQuery(this).val());"> <option value=""><?php printf(__('Use Form Setting (%s)', 'gravityforms'), esc_html($description_placement_form_setting_label)); ?> </option> <option value="below"><?php esc_html_e('Below inputs', 'gravityforms'); ?> </option> <option value="above"><?php esc_html_e('Above inputs', 'gravityforms'); ?> </option> </select> </div> </li> <?php do_action('gform_field_appearance_settings', 150, $form_id); $sub_label_placement_form_setting = rgar($form, 'subLabelPlacement'); $sub_label_placement_form_setting_label = $sub_label_placement_form_setting == 'above' ? $sub_label_placement_form_setting_label = __('Above inputs', 'gravityforms') : ($sub_label_placement_form_setting_label = __('Below inputs', 'gravityforms')); ?> <li class="sub_label_placement_setting field_setting"> <label for="field_sub_label_placement"> <?php esc_html_e('Sub-Label Placement', 'gravityforms'); ?> <?php gform_tooltip('form_field_sub_label_placement'); ?> </label> <select id="field_sub_label_placement" onchange="SetFieldSubLabelPlacement(jQuery(this).val());"> <option value=""><?php printf(__('Use Form Setting (%s)', 'gravityforms'), esc_html($sub_label_placement_form_setting_label)); ?> </option> <option value="below"><?php esc_html_e('Below inputs', 'gravityforms'); ?> </option> <option value="above"><?php esc_html_e('Above inputs', 'gravityforms'); ?> </option> <?php if ($enable_label_visiblity_settings) { ?> <option value="hidden_label"><?php esc_html_e('Hidden', 'gravityforms'); ?> </option> <?php } ?> </select> </li> <?php do_action('gform_field_appearance_settings', 200, $form_id); ?> <li class="error_message_setting field_setting"> <label for="field_error_message"> <?php esc_html_e('Custom Validation Message', 'gravityforms'); ?> <?php gform_tooltip('form_field_validation_message'); ?> </label> <input type="text" id="field_error_message" class="fieldwidth-2" /> </li> <?php do_action('gform_field_appearance_settings', 250, $form_id); ?> <li class="css_class_setting field_setting"> <label for="field_css_class"> <?php esc_html_e('Custom CSS Class', 'gravityforms'); ?> <?php gform_tooltip('form_field_css_class'); ?> </label> <input type="text" id="field_css_class" size="30" /> </li> <?php do_action('gform_field_appearance_settings', 300, $form_id); ?> <li class="enable_enhanced_ui_setting field_setting"> <input type="checkbox" id="gfield_enable_enhanced_ui" onclick="SetFieldProperty('enableEnhancedUI', jQuery(this).is(':checked') ? 1 : 0);" /> <label for="gfield_enable_enhanced_ui" class="inline"> <?php esc_html_e('Enable enhanced user interface', 'gravityforms'); ?> <?php gform_tooltip('form_field_enable_enhanced_ui'); ?> </label> </li> <?php do_action('gform_field_appearance_settings', 400, $form_id); ?> <li class="size_setting field_setting"> <label for="field_size"> <?php esc_html_e('Field Size', 'gravityforms'); ?> <?php gform_tooltip('form_field_size'); ?> </label> <select id="field_size" onchange="SetFieldSize(jQuery(this).val());"> <option value="small"><?php esc_html_e('Small', 'gravityforms'); ?> </option> <option value="medium"><?php esc_html_e('Medium', 'gravityforms'); ?> </option> <option value="large"><?php esc_html_e('Large', 'gravityforms'); ?> </option> </select> </li> </ul> </div> <div id="gform_tab_2"> <ul> <?php do_action('gform_field_advanced_settings', 0, $form_id); ?> <li class="admin_label_setting field_setting"> <label for="field_admin_label"> <?php esc_html_e('Admin Field Label', 'gravityforms'); ?> <?php gform_tooltip('form_field_admin_label'); ?> </label> <input type="text" id="field_admin_label" size="35" /> </li> <?php do_action('gform_field_advanced_settings', 25, $form_id); do_action('gform_field_advanced_settings', 35, $form_id); do_action('gform_field_advanced_settings', 50, $form_id); do_action('gform_field_advanced_settings', 100, $form_id); do_action('gform_field_advanced_settings', 125, $form_id); ?> <li class="default_value_setting field_setting"> <label for="field_default_value"> <?php esc_html_e('Default Value', 'gravityforms'); ?> <?php gform_tooltip('form_field_default_value'); ?> </label> <input type="text" id="field_default_value" class="field_default_value fieldwidth-2 merge-tag-support mt-position-right mt-prepopulate" /> </li> <?php do_action('gform_field_advanced_settings', 150, $form_id); ?> <li class="default_value_textarea_setting field_setting"> <label for="field_default_value_textarea"> <?php esc_html_e('Default Value', 'gravityforms'); ?> <?php gform_tooltip('form_field_default_value'); ?> </label> <textarea id="field_default_value_textarea" class="field_default_value fieldwidth-3 merge-tag-support mt-position-right mt-prepopulate"></textarea> </li> <?php do_action('gform_field_advanced_settings', 155, $form_id); ?> <li class="name_prefix_choices_setting field_setting" style="display:none;"> <?php esc_html_e('Prefix Choices', 'gravityforms'); ?> <?php gform_tooltip('form_field_name_prefix_choices'); ?> <br /> <div id="gfield_settings_prefix_input_choices_container" class="gfield_settings_input_choices_container"> <label class="gfield_choice_header_label"><?php esc_html_e('Label', 'gravityforms'); ?> </label><label class="gfield_choice_header_value"><?php esc_html_e('Value', 'gravityforms'); ?> </label> <ul id="field_prefix_choices" class="field_input_choices"> <!-- content dynamically created from js.php --> </ul> </div> </li> <?php do_action('gform_field_advanced_settings', 175, $form_id); ?> <li class="default_input_values_setting field_setting"> <label> <?php esc_html_e('Default Values', 'gravityforms'); ?> <?php gform_tooltip('form_field_default_input_values'); ?> </label> <div id="field_default_input_values_container"> <!-- content dynamically created from js.php --> </div> </li> <?php do_action('gform_field_advanced_settings', 185, $form_id); ?> <li class="copy_values_option field_setting"> <input type="checkbox" id="field_enable_copy_values_option" /> <label for="field_enable_copy_values_option" class="inline"> <?php esc_html_e('Display option to use the values submitted in different field', 'gravityforms'); ?> <?php gform_tooltip('form_field_enable_copy_values_option'); ?> </label> <div id="field_copy_values_disabled" style="display:none;padding-top: 10px;"> <span class="instruction" style="margin-left:0"> <?php esc_html_e('To activate this option, please add a field to be used as the source.', 'gravityforms'); ?> <?php gform_tooltip('form_field_enable_copy_values_disabled'); ?> </span> </div> <div id="field_copy_values_container" style="display:none;" class="gfield_sub_setting"> <label for="field_copy_values_option_label"> <?php esc_html_e('Option Label', 'gravityforms'); ?> <?php gform_tooltip('form_field_copy_values_option_label'); ?> </label> <input id="field_copy_values_option_label" type="text" class="fieldwidth-2" /> <label for="field_copy_values_option_field" style="padding-top: 10px;"> <?php esc_html_e('Source Field', 'gravityforms'); ?> <?php gform_tooltip('form_field_copy_values_option_field'); ?> </label> <select id="field_copy_values_option_field"> <!-- content dynamically created --> </select> <div style="padding-top: 10px;"> <input type="checkbox" id="field_copy_values_option_default" /> <label for="field_copy_values_option_default" class="inline"> <?php esc_html_e('Activated by default', 'gravityforms'); ?> <?php gform_tooltip('form_field_copy_values_option_default'); ?> </label> </div> </div> </li> <?php do_action('gform_field_advanced_settings', 200, $form_id); do_action('gform_field_advanced_settings', 225, $form_id); ?> <li class="credit_card_icon_style_setting field_setting"> <label> <?php esc_html_e('Credit Card Icon Style', 'gravityforms'); ?> <?php gform_tooltip('form_field_credit_card_icon_style'); ?> </label> <ul> <?php $cards = GFCommon::get_card_types(); foreach ($cards as $card) { ?> <li> <input type="checkbox" id="field_credit_card_<?php echo esc_attr($card['slug']); ?> " value="<?php echo esc_attr($card['slug']); ?> " onclick="SetCardType(this, this.value);" /> <label for="field_credit_card_<?php echo esc_attr($card['slug']); ?> " class="inline"><?php echo esc_html($card['name']); ?> </label> </li> <?php } ?> </ul> </li> <?php do_action('gform_field_advanced_settings', 250, $form_id); ?> <li class="captcha_language_setting field_setting"> <label for="field_captcha_language"> <?php esc_html_e('Language', 'gravityforms'); ?> <?php gform_tooltip('form_field_recaptcha_language'); ?> </label> <select id="field_captcha_language" onchange="SetFieldProperty('captchaLanguage', this.value);"> <option value="en"><?php esc_html_e('English', 'gravityforms'); ?> </option> <option value="nl"><?php esc_html_e('Dutch', 'gravityforms'); ?> </option> <option value="fr"><?php esc_html_e('French', 'gravityforms'); ?> </option> <option value="de"><?php esc_html_e('German', 'gravityforms'); ?> </option> <option value="pt"><?php esc_html_e('Portuguese', 'gravityforms'); ?> </option> <option value="ru"><?php esc_html_e('Russian', 'gravityforms'); ?> </option> <option value="es"><?php esc_html_e('Spanish', 'gravityforms'); ?> </option> <option value="tr"><?php esc_html_e('Turkish', 'gravityforms'); ?> </option> </select> </li> <?php do_action('gform_field_advanced_settings', 300, $form_id); do_action('gform_field_advanced_settings', 325, $form_id); ?> <li class="add_icon_url_setting field_setting"> <label for="field_add_icon_url"> <?php esc_html_e('Add Icon URL', 'gravityforms'); ?> <?php gform_tooltip('form_field_add_icon_url'); ?> </label> <input type="text" id="field_add_icon_url" class="fieldwidth-2" /> </li> <?php do_action('gform_field_advanced_settings', 337, $form_id); ?> <li class="delete_icon_url_setting field_setting"> <label for="field_delete_icon_url"> <?php esc_html_e('Delete Icon URL', 'gravityforms'); ?> <?php gform_tooltip('form_field_delete_icon_url'); ?> </label> <input type="text" id="field_delete_icon_url" class="fieldwidth-2" /> </li> <?php do_action('gform_field_advanced_settings', 350, $form_id); ?> <li class="password_field_setting field_setting"> <input type="checkbox" id="field_password" onclick="SetPasswordProperty(this.checked);" /> <label for="field_password" class="inline"><?php esc_html_e('Enable Password Input', 'gravityforms'); gform_tooltip('form_field_password'); ?> </label> </li> <?php do_action('gform_field_advanced_settings', 375, $form_id); ?> <li class="force_ssl_field_setting field_setting"> <input type="checkbox" id="field_force_ssl" onclick="SetFieldProperty('forceSSL', this.checked);" /> <label for="field_force_ssl" class="inline"><?php esc_html_e('Force SSL', 'gravityforms'); gform_tooltip('form_field_force_ssl'); ?> </label> </li> <?php do_action('gform_field_advanced_settings', 400, $form_id); ?> <li class="visibility_setting field_setting"> <label><?php esc_html_e('Visibility', 'gravityforms'); ?> <?php gform_tooltip('form_field_visibility'); ?> </label> <div> <input type="radio" name="field_visibility" id="field_visibility_everyone" size="10" onclick="SetFieldAdminOnly(!this.checked);" /> <label for="field_visibility_everyone" class="inline"> <?php esc_html_e('Everyone', 'gravityforms'); ?> </label> <input type="radio" name="field_visibility" id="field_visibility_admin" size="10" onclick="SetFieldAdminOnly(this.checked);" /> <label for="field_visibility_admin" class="inline"> <?php esc_html_e('Admin Only', 'gravityforms'); ?> </label> </div> <br class="clear" /> </li> <?php do_action('gform_field_advanced_settings', 450, $form_id); ?> <li class="prepopulate_field_setting field_setting"> <input type="checkbox" id="field_prepopulate" onclick="SetFieldProperty('allowsPrepopulate', this.checked); ToggleInputName()" /> <label for="field_prepopulate" class="inline"><?php esc_html_e('Allow field to be populated dynamically', 'gravityforms'); ?> <?php gform_tooltip('form_field_prepopulate'); ?> </label> <br /> <div id="field_input_name_container" style="display:none; padding-top:10px;"> <!-- content dynamically created from js.php --> </div> </li> <?php do_action('gform_field_advanced_settings', 500, $form_id); ?> <li class="conditional_logic_field_setting field_setting"> <input type="checkbox" id="field_conditional_logic" onclick="SetFieldProperty('conditionalLogic', this.checked ? new ConditionalLogic() : null); ToggleConditionalLogic(false, 'field');" /> <label for="field_conditional_logic" class="inline"><?php esc_html_e('Enable Conditional Logic', 'gravityforms'); ?> <?php gform_tooltip('form_field_conditional_logic'); ?> </label> <br /> <div id="field_conditional_logic_container" style="display:none; padding-top:10px;"> <!-- content dynamically created from js.php --> </div> </li> <?php do_action('gform_field_advanced_settings', 525, $form_id); ?> <li class="conditional_logic_page_setting field_setting"> <input type="checkbox" id="page_conditional_logic" onclick="SetFieldProperty('conditionalLogic', this.checked ? new ConditionalLogic() : null); ToggleConditionalLogic(false, 'page');" /> <label for="page_conditional_logic" class="inline"><?php esc_html_e('Enable Page Conditional Logic', 'gravityforms'); ?> <?php gform_tooltip('form_page_conditional_logic'); ?> </label> <br /> <div id="page_conditional_logic_container" style="display:none; padding-top:10px;"> <!-- content dynamically created from js.php --> </div> </li> <?php do_action('gform_field_advanced_settings', 550, $form_id); ?> <li class="conditional_logic_nextbutton_setting field_setting"> <input type="checkbox" id="next_button_conditional_logic" onclick="SetNextButtonConditionalLogic(this.checked); ToggleConditionalLogic(false, 'next_button');" /> <label for="next_button_conditional_logic" class="inline"><?php esc_html_e('Enable Next Button Conditional Logic', 'gravityforms'); ?> <?php gform_tooltip('form_nextbutton_conditional_logic'); ?> </label> <br /> <div id="next_button_conditional_logic_container" style="display:none; padding-top:10px;"> <!-- content dynamically created from js.php --> </div> </li> <?php do_action('gform_field_advanced_settings', -1, $form_id); ?> </ul> </div> </div> </td> <td valign="top" align="right"> <div id="add_fields"> <div id="floatMenu"> <!-- begin add button boxes --> <ul id="sidebarmenu1" class="menu collapsible expandfirst"> <?php $standard_fields = array(array('class' => 'button', 'data-type' => 'text', 'value' => GFCommon::get_field_type_title('text')), array('class' => 'button', 'data-type' => 'textarea', 'value' => GFCommon::get_field_type_title('textarea')), array('class' => 'button', 'data-type' => 'select', 'value' => GFCommon::get_field_type_title('select')), array('class' => 'button', 'data-type' => 'multiselect', 'value' => GFCommon::get_field_type_title('multiselect')), array('class' => 'button', 'data-type' => 'number', 'value' => GFCommon::get_field_type_title('number')), array('class' => 'button', 'data-type' => 'checkbox', 'value' => GFCommon::get_field_type_title('checkbox')), array('class' => 'button', 'data-type' => 'radio', 'value' => GFCommon::get_field_type_title('radio')), array('class' => 'button', 'data-type' => 'hidden', 'value' => GFCommon::get_field_type_title('hidden')), array('class' => 'button', 'data-type' => 'html', 'value' => GFCommon::get_field_type_title('html')), array('class' => 'button', 'data-type' => 'section', 'value' => GFCommon::get_field_type_title('section')), array('class' => 'button', 'data-type' => 'page', 'value' => GFCommon::get_field_type_title('page'))); $advanced_fields = array(array('class' => 'button', 'data-type' => 'name', 'value' => GFCommon::get_field_type_title('name')), array('class' => 'button', 'data-type' => 'date', 'value' => GFCommon::get_field_type_title('date')), array('class' => 'button', 'data-type' => 'time', 'value' => GFCommon::get_field_type_title('time')), array('class' => 'button', 'data-type' => 'phone', 'value' => GFCommon::get_field_type_title('phone')), array('class' => 'button', 'data-type' => 'address', 'value' => GFCommon::get_field_type_title('address')), array('class' => 'button', 'data-type' => 'website', 'value' => GFCommon::get_field_type_title('website')), array('class' => 'button', 'data-type' => 'email', 'value' => GFCommon::get_field_type_title('email'))); if (apply_filters('gform_enable_password_field', false)) { $advanced_fields[] = array('class' => 'button', 'data-type' => 'password', 'value' => GFCommon::get_field_type_title('password')); } $advanced_fields[] = array('class' => 'button', 'data-type' => 'fileupload', 'value' => GFCommon::get_field_type_title('fileupload')); $advanced_fields[] = array('class' => 'button', 'data-type' => 'captcha', 'value' => GFCommon::get_field_type_title('captcha')); $advanced_fields[] = array('class' => 'button', 'data-type' => 'list', 'value' => GFCommon::get_field_type_title('list')); $post_fields = array(array('class' => 'button', 'data-type' => 'post_title', 'value' => GFCommon::get_field_type_title('post_title')), array('class' => 'button', 'data-type' => 'post_content', 'value' => GFCommon::get_field_type_title('post_content')), array('class' => 'button', 'data-type' => 'post_excerpt', 'value' => GFCommon::get_field_type_title('post_excerpt')), array('class' => 'button', 'data-type' => 'post_tags', 'value' => GFCommon::get_field_type_title('post_tags')), array('class' => 'button', 'data-type' => 'post_category', 'value' => GFCommon::get_field_type_title('post_category')), array('class' => 'button', 'data-type' => 'post_image', 'value' => GFCommon::get_field_type_title('post_image')), array('class' => 'button', 'data-type' => 'post_custom_field', 'value' => GFCommon::get_field_type_title('post_custom_field'))); $pricing_fields = array(array('class' => 'button', 'data-type' => 'product', 'value' => GFCommon::get_field_type_title('product')), array('class' => 'button', 'data-type' => 'quantity', 'value' => GFCommon::get_field_type_title('quantity')), array('class' => 'button', 'data-type' => 'option', 'value' => GFCommon::get_field_type_title('option')), array('class' => 'button', 'data-type' => 'shipping', 'value' => GFCommon::get_field_type_title('shipping')), array('class' => 'button', 'data-type' => 'total', 'value' => GFCommon::get_field_type_title('total'))); if (apply_filters('gform_enable_credit_card_field', false)) { $pricing_fields[] = array('class' => 'button', 'data-type' => 'creditcard', 'value' => GFCommon::get_field_type_title('creditcard')); } $field_groups = array(array('name' => 'standard_fields', 'label' => __('Standard Fields', 'gravityforms'), 'fields' => $standard_fields, 'tooltip_class' => 'tooltip_bottomleft'), array('name' => 'advanced_fields', 'label' => __('Advanced Fields', 'gravityforms'), 'fields' => $advanced_fields), array('name' => 'post_fields', 'label' => __('Post Fields', 'gravityforms'), 'fields' => $post_fields)); $field_groups[] = array('name' => 'pricing_fields', 'label' => __('Pricing Fields', 'gravityforms'), 'fields' => $pricing_fields); foreach (GF_Fields::get_all() as $gf_field) { $field_groups = $gf_field->add_button($field_groups); } $field_groups = apply_filters('gform_add_field_buttons', $field_groups); foreach ($field_groups as $group) { $tooltip_class = empty($group['tooltip_class']) ? 'tooltip_left' : $group['tooltip_class']; ?> <li id="add_<?php echo esc_attr($group['name']); ?> " class="add_field_button_container"> <div class="button-title-link <?php echo $group['name'] == 'standard_fields' ? 'gf_button_title_active' : ''; ?> "> <div class="add-buttons-title"><?php echo esc_html($group['label']); ?> <?php gform_tooltip("form_{$group['name']}", $tooltip_class); ?> </div> </div> <ul> <li class="add-buttons"> <ol class="field_type"> <?php self::display_buttons($group['fields']); ?> </ol> </li> </ul> </li> <?php } ?> </ul> <br style="clear:both;" /> <!--end add button boxes --> <?php if (GFCommon::current_user_can_any('gravityforms_delete_forms')) { $trash_link = '<a class="submitdelete" title="' . __('Move this form to the trash', 'gravityforms') . '" onclick="if(confirm(\'' . __("Would you like to move this form to the trash? \\'Cancel\\' to stop. \\'OK\\' to continue", 'gravityforms') . '\')){ gf_vars.isFormTrash = true; jQuery(\'#form_trash\')[0].submit();} else{return false;}">' . __('Move to Trash', 'gravityforms') . '</a>'; /** * @deprecated */ $trash_link = apply_filters('gform_form_delete_link', $trash_link); /** * Allows for modification of the Form Trash Link * * @param string $trash_link The Trash link HTML */ 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 = '<input type="button" class="button button-large button-primary update-form" value="' . $button_text . '" onclick="SaveForm(' . $isNew . ');" />'; /** * A filter to aloow you to modify the Form Save button * * @param string $save_button The Form Save button HTML */ $save_button = apply_filters('gform_save_form_button', $save_button); echo $save_button; ?> <span id="please_wait_container" style="display:none;"><i class='gficon-gravityforms-spinner-icon gficon-spin'></i></span> <div class="updated_base" id="after_update_dialog" style="display:none;"> <strong><?php esc_html_e('Form updated successfully.', 'gravityforms'); ?> <a title="<?php esc_html_e('Preview this form', 'gravityforms'); ?> " href="<?php echo esc_url(trailingslashit(site_url())); ?> ?gf_page=preview&id=<?php echo absint(rgar($form, 'id')); ?> " target="_blank"><?php esc_html_e('Preview', 'gravityforms'); ?> </a></strong> </div> <div class="error_base" id="after_update_error_dialog" style="padding:10px 10px 16px 10px; display:none;"> <?php esc_html_e('There was an error while saving your form.', 'gravityforms'); ?> <?php printf(__('Please %scontact our support team%s.', 'gravityforms'), '<a href="http://www.gravityhelp.com">', '</a>'); ?> </div> <!-- this field allows us to force onblur events for field setting inputs that are otherwise not triggered when closing the field settings UI --> <input type="text" id="gform_force_focus" style="position:absolute;left:-9999em;" /> <form method="post" id="gform_update"> <?php wp_nonce_field("gforms_update_form_{$form_id}", 'gforms_update_form'); ?> <input type="hidden" id="gform_meta" name="gform_meta" /> </form> </div> </div> </td> </tr> </table> </div> <!-- // including form setting hooks as a temporary fix to prevent issues where users using the "gform_before_update" hook are expecting form settings to be included on the form editor page --> <div style="display:none;"> <!--form settings--> <?php do_action('gform_properties_settings', 100, $form_id); ?> <?php do_action('gform_properties_settings', 200, $form_id); ?> <?php do_action('gform_properties_settings', 300, $form_id); ?> <?php do_action('gform_properties_settings', 400, $form_id); ?> <?php do_action('gform_properties_settings', 500, $form_id); ?> <!--advanced settings--> <?php do_action('gform_advanced_settings', 100, $form_id); ?> <?php do_action('gform_advanced_settings', 200, $form_id); ?> <?php do_action('gform_advanced_settings', 300, $form_id); ?> <?php do_action('gform_advanced_settings', 400, $form_id); ?> <?php do_action('gform_advanced_settings', 500, $form_id); ?> <?php do_action('gform_advanced_settings', 600, $form_id); ?> <?php do_action('gform_advanced_settings', 700, $form_id); ?> <?php do_action('gform_advanced_settings', 800, $form_id); ?> </div> <?php self::inline_scripts($form); require_once GFCommon::get_base_path() . '/js.php'; }
public function redirect_url($feed, $submission_data, $form, $entry) { //Don't process redirect url if request is a PayPal return if (!rgempty('gf_paypal_return', $_GET)) { return false; } //updating lead's payment_status to Processing GFAPI::update_entry_property($entry['id'], 'payment_status', 'Processing'); //Getting Url (Production or Sandbox) $url = $feed['meta']['mode'] == 'production' ? $this->production_url : $this->sandbox_url; $invoice_id = apply_filters('gform_paypal_invoice', '', $form, $entry); $invoice = empty($invoice_id) ? '' : "&invoice={$invoice_id}"; //Current Currency $currency = GFCommon::get_currency(); //Customer fields $customer_fields = $this->customer_query_string($feed, $entry); //Page style $page_style = !empty($feed['meta']['pageStyle']) ? '&page_style=' . urlencode($feed['meta']['pageStyle']) : ''; //Continue link text $continue_text = !empty($feed['meta']['continueText']) ? '&cbt=' . urlencode($feed['meta']['continueText']) : '&cbt=' . __('Click here to continue', 'gravityformspaypal'); //Set return mode to 2 (PayPal will post info back to page). rm=1 seems to create lots of problems with the redirect back to the site. Defaulting it to 2. $return_mode = '2'; $return_url = '&return=' . urlencode($this->return_url($form['id'], $entry['id'])) . "&rm={$return_mode}"; //Cancel URL $cancel_url = !empty($feed['meta']['cancelUrl']) ? '&cancel_return=' . urlencode($feed['meta']['cancelUrl']) : ''; //Don't display note section $disable_note = !empty($feed['meta']['disableNote']) ? '&no_note=1' : ''; //Don't display shipping section $disable_shipping = !empty($feed['meta']['disableShipping']) ? '&no_shipping=1' : ''; //URL that will listen to notifications from PayPal $ipn_url = urlencode(get_bloginfo('url') . '/?page=gf_paypal_ipn'); $business_email = urlencode(trim($feed['meta']['paypalEmail'])); $custom_field = $entry['id'] . '|' . wp_hash($entry['id']); $url .= "?notify_url={$ipn_url}&charset=UTF-8¤cy_code={$currency}&business={$business_email}&custom={$custom_field}{$invoice}{$customer_fields}{$page_style}{$continue_text}{$cancel_url}{$disable_note}{$disable_shipping}{$return_url}"; $query_string = ''; switch ($feed['meta']['transactionType']) { case 'product': //build query string using $submission_data $query_string = $this->get_product_query_string($submission_data, $entry['id']); break; case 'donation': $query_string = $this->get_donation_query_string($submission_data, $entry['id']); break; case 'subscription': $query_string = $this->get_subscription_query_string($feed, $submission_data, $entry['id']); break; } $query_string = gf_apply_filters('gform_paypal_query', $form['id'], $query_string, $form, $entry, $feed, $submission_data); if (!$query_string) { $this->log_debug(__METHOD__ . '(): NOT sending to PayPal: The price is either zero or the gform_paypal_query filter was used to remove the querystring that is sent to PayPal.'); return ''; } $url .= $query_string; $url = gf_apply_filters('gform_paypal_request', $form['id'], $url, $form, $entry, $feed, $submission_data); //add the bn code (build notation code) $url .= '&bn=Rocketgenius_SP'; $this->log_debug(__METHOD__ . "(): Sending to PayPal: {$url}"); return $url; }
public function get_checkbox_choices($value, $disabled_text, $form_id = 0) { $choices = ''; $is_entry_detail = $this->is_entry_detail(); $is_form_editor = $this->is_form_editor(); if (is_array($this->choices)) { $choice_number = 1; $count = 1; foreach ($this->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 = $this->id . '.' . $choice_number; if ($is_entry_detail || $is_form_editor || $form_id == 0) { $id = $this->id . '_' . $choice_number++; } else { $id = $form_id . '_' . $this->id . '_' . $choice_number++; } if (!isset($_GET['gf_token']) && empty($_POST) && rgar($choice, 'isSelected')) { $checked = "checked='checked'"; } elseif (is_array($value) && RGFormsModel::choice_value_match($this, $choice, rgget($input_id, $value))) { $checked = "checked='checked'"; } elseif (!is_array($value) && RGFormsModel::choice_value_match($this, $choice, $value)) { $checked = "checked='checked'"; } else { $checked = ''; } $logic_event = $this->get_conditional_logic_event('click'); $tabindex = $this->get_tabindex(); $choice_value = $choice['value']; if ($this->enablePrice) { $price = rgempty('price', $choice) ? 0 : GFCommon::to_number(rgar($choice, 'price')); $choice_value .= '|' . $price; } $choice_value = esc_attr($choice_value); $choice_markup = "<li class='gchoice_{$id}'>\n\t\t\t\t\t\t\t\t<input name='input_{$input_id}' type='checkbox' {$logic_event} value='{$choice_value}' {$checked} id='choice_{$id}' {$tabindex} {$disabled_text} />\n\t\t\t\t\t\t\t\t<label for='choice_{$id}' id='label_{$id}'>{$choice['text']}</label>\n\t\t\t\t\t\t\t</li>"; $choices .= gf_apply_filters(array('gform_field_choice_markup_pre_render', $this->formId, $this->id), $choice_markup, $choice, $this, $value); $is_entry_detail = $this->is_entry_detail(); $is_form_editor = $this->is_form_editor(); $is_admin = $is_entry_detail || $is_form_editor; if ($is_admin && RG_CURRENT_VIEW != 'entry' && $count >= 5) { break; } $count++; } $total = sizeof($this->choices); if ($count < $total) { $choices .= "<li class='gchoice_total'>" . sprintf(esc_html__('%d of %d items shown. Edit field to view all', 'gravityforms'), $count, $total) . '</li>'; } } return gf_apply_filters(array('gform_field_choices', $this->formId, $this->id), $choices, $this); }
public function get_address_types($form_id) { $addressTypes = array('international' => array('label' => esc_html__('International', 'gravityforms'), 'zip_label' => gf_apply_filters(array('gform_address_zip', $form_id), esc_html__('ZIP / Postal Code', 'gravityforms'), $form_id), 'state_label' => gf_apply_filters(array('gform_address_state', $form_id), esc_html__('State / Province / Region', 'gravityforms'), $form_id)), 'us' => array('label' => esc_html__('United States', 'gravityforms'), 'zip_label' => gf_apply_filters(array('gform_address_zip', $form_id), esc_html__('ZIP Code', 'gravityforms'), $form_id), 'state_label' => gf_apply_filters(array('gform_address_state', $form_id), esc_html__('State', 'gravityforms'), $form_id), 'country' => 'United States', 'states' => array_merge(array(''), $this->get_us_states())), 'canadian' => array('label' => esc_html__('Canadian', 'gravityforms'), 'zip_label' => gf_apply_filters(array('gform_address_zip', $form_id), esc_html__('Postal Code', 'gravityforms'), $form_id), 'state_label' => gf_apply_filters(array('gform_address_state', $form_id), esc_html__('Province', 'gravityforms'), $form_id), 'country' => 'Canada', 'states' => array_merge(array(''), $this->get_canadian_provinces()))); return gf_apply_filters(array('gform_address_types', $form_id), $addressTypes, $form_id); }
public function get_field_input($form, $value = '', $entry = null) { $is_entry_detail = $this->is_entry_detail(); $is_form_editor = $this->is_form_editor(); $is_admin = $is_entry_detail || $is_form_editor; $form_id = $form['id']; $id = intval($this->id); $field_id = $is_entry_detail || $is_form_editor || $form_id == 0 ? "input_{$id}" : 'input_' . $form_id . "_{$id}"; $form_id = ($is_entry_detail || $is_form_editor) && empty($form_id) ? rgget('id') : $form_id; $size = $this->size; $class_suffix = RG_CURRENT_VIEW == 'entry' ? '_admin' : ''; $class = $size . $class_suffix; $disabled_text = $is_form_editor ? "disabled='disabled'" : ''; $class_suffix = $is_entry_detail ? '_admin' : ''; $form_sub_label_placement = rgar($form, 'subLabelPlacement'); $field_sub_label_placement = $this->subLabelPlacement; $is_sub_label_above = $field_sub_label_placement == 'above' || empty($field_sub_label_placement) && $form_sub_label_placement == 'above'; $sub_label_class_attribute = $field_sub_label_placement == 'hidden_label' ? "class='hidden_sub_label screen-reader-text'" : ''; $prefix = ''; $first = ''; $middle = ''; $last = ''; $suffix = ''; if (is_array($value)) { $prefix = esc_attr(RGForms::get($this->id . '.2', $value)); $first = esc_attr(RGForms::get($this->id . '.3', $value)); $middle = esc_attr(RGForms::get($this->id . '.4', $value)); $last = esc_attr(RGForms::get($this->id . '.6', $value)); $suffix = esc_attr(RGForms::get($this->id . '.8', $value)); } $prefix_input = GFFormsModel::get_input($this, $this->id . '.2'); $first_input = GFFormsModel::get_input($this, $this->id . '.3'); $middle_input = GFFormsModel::get_input($this, $this->id . '.4'); $last_input = GFFormsModel::get_input($this, $this->id . '.6'); $suffix_input = GFFormsModel::get_input($this, $this->id . '.8'); $first_placeholder_attribute = GFCommon::get_input_placeholder_attribute($first_input); $middle_placeholder_attribute = GFCommon::get_input_placeholder_attribute($middle_input); $last_placeholder_attribute = GFCommon::get_input_placeholder_attribute($last_input); $suffix_placeholder_attribute = GFCommon::get_input_placeholder_attribute($suffix_input); // ARIA labels. Prefix is handled in self::get_name_prefix_field(). $first_name_aria_label = esc_attr__('First name', 'gravityforms'); $middle_name_aria_label = esc_attr__('Middle name', 'gravityforms'); $last_name_aria_label = esc_attr__('Last name', 'gravityforms'); $suffix_aria_label = esc_attr__('Name suffix', 'gravityforms'); switch ($this->nameFormat) { case 'advanced': case 'extended': $prefix_tabindex = GFCommon::get_tabindex(); $first_tabindex = GFCommon::get_tabindex(); $middle_tabindex = GFCommon::get_tabindex(); $last_tabindex = GFCommon::get_tabindex(); $suffix_tabindex = GFCommon::get_tabindex(); $prefix_sub_label = rgar($prefix_input, 'customLabel') != '' ? $prefix_input['customLabel'] : gf_apply_filters(array('gform_name_prefix', $form_id), esc_html__('Prefix', 'gravityforms'), $form_id); $first_name_sub_label = rgar($first_input, 'customLabel') != '' ? $first_input['customLabel'] : gf_apply_filters(array('gform_name_first', $form_id), esc_html__('First', 'gravityforms'), $form_id); $middle_name_sub_label = rgar($middle_input, 'customLabel') != '' ? $middle_input['customLabel'] : gf_apply_filters(array('gform_name_middle', $form_id), esc_html__('Middle', 'gravityforms'), $form_id); $last_name_sub_label = rgar($last_input, 'customLabel') != '' ? $last_input['customLabel'] : gf_apply_filters(array('gform_name_last', $form_id), esc_html__('Last', 'gravityforms'), $form_id); $suffix_sub_label = rgar($suffix_input, 'customLabel') != '' ? $suffix_input['customLabel'] : gf_apply_filters(array('gform_name_suffix', $form_id), esc_html__('Suffix', 'gravityforms'), $form_id); $prefix_markup = ''; $first_markup = ''; $middle_markup = ''; $last_markup = ''; $suffix_markup = ''; if ($is_sub_label_above) { $style = $is_admin && rgar($prefix_input, 'isHidden') ? "style='display:none;'" : ''; if ($is_admin || !rgar($prefix_input, 'isHidden')) { $prefix_select_class = isset($prefix_input['choices']) && is_array($prefix_input['choices']) ? 'name_prefix_select' : ''; $prefix_markup = self::get_name_prefix_field($prefix_input, $id, $field_id, $prefix, $disabled_text, $prefix_tabindex); $prefix_markup = "<span id='{$field_id}_2_container' class='name_prefix {$prefix_select_class}' {$style}>\r\n <label for='{$field_id}_2' {$sub_label_class_attribute}>{$prefix_sub_label}</label>\r\n {$prefix_markup}\r\n </span>"; } $style = $is_admin && rgar($first_input, 'isHidden') ? "style='display:none;'" : ''; if ($is_admin || !rgar($first_input, 'isHidden')) { $first_markup = "<span id='{$field_id}_3_container' class='name_first' {$style}>\r\n <label for='{$field_id}_3' {$sub_label_class_attribute}>{$first_name_sub_label}</label>\r\n <input type='text' name='input_{$id}.3' id='{$field_id}_3' value='{$first}' aria-label='{$first_name_aria_label}' {$first_tabindex} {$disabled_text} {$first_placeholder_attribute}/>\r\n </span>"; } $style = $is_admin && (!isset($middle_input['isHidden']) || rgar($middle_input, 'isHidden')) ? "style='display:none;'" : ''; if ($is_admin || isset($middle_input['isHidden']) && $middle_input['isHidden'] == false) { $middle_markup = "<span id='{$field_id}_4_container' class='name_middle' {$style}>\r\n <label for='{$field_id}_4' {$sub_label_class_attribute}>{$middle_name_sub_label}</label>\r\n <input type='text' name='input_{$id}.4' id='{$field_id}_4' value='{$middle}' aria-label='{$middle_name_aria_label}' {$middle_tabindex} {$disabled_text} {$middle_placeholder_attribute}/>\r\n </span>"; } $style = $is_admin && rgar($last_input, 'isHidden') ? "style='display:none;'" : ''; if ($is_admin || !rgar($last_input, 'isHidden')) { $last_markup = "<span id='{$field_id}_6_container' class='name_last' {$style}>\r\n <label for='{$field_id}_6' {$sub_label_class_attribute}>{$last_name_sub_label}</label>\r\n <input type='text' name='input_{$id}.6' id='{$field_id}_6' value='{$last}' aria-label='{$last_name_aria_label}' {$last_tabindex} {$disabled_text} {$last_placeholder_attribute}/>\r\n </span>"; } $style = $is_admin && rgar($suffix_input, 'isHidden') ? "style='display:none;'" : ''; if ($is_admin || !rgar($suffix_input, 'isHidden')) { $suffix_select_class = isset($suffix_input['choices']) && is_array($suffix_input['choices']) ? 'name_suffix_select' : ''; $suffix_markup = "<span id='{$field_id}_8_container' class='name_suffix {$suffix_select_class}' {$style}>\r\n <label for='{$field_id}_8' {$sub_label_class_attribute}>{$suffix_sub_label}</label>\r\n <input type='text' name='input_{$id}.8' id='{$field_id}_8' value='{$suffix}' aria-label='{$suffix_aria_label}' {$suffix_tabindex} {$disabled_text} {$suffix_placeholder_attribute}/>\r\n </span>"; } } else { $style = $is_admin && rgar($prefix_input, 'isHidden') ? "style='display:none;'" : ''; if ($is_admin || !rgar($prefix_input, 'isHidden')) { $prefix_select_class = isset($prefix_input['choices']) && is_array($prefix_input['choices']) ? 'name_prefix_select' : ''; $prefix_markup = self::get_name_prefix_field($prefix_input, $id, $field_id, $prefix, $disabled_text, $prefix_tabindex); $prefix_markup = "<span id='{$field_id}_2_container' class='name_prefix {$prefix_select_class}' {$style}>\r\n {$prefix_markup}\r\n <label for='{$field_id}_2' {$sub_label_class_attribute}>{$prefix_sub_label}</label>\r\n </span>"; } $style = $is_admin && rgar($first_input, 'isHidden') ? "style='display:none;'" : ''; if ($is_admin || !rgar($first_input, 'isHidden')) { $first_markup = "<span id='{$field_id}_3_container' class='name_first' {$style}>\r\n <input type='text' name='input_{$id}.3' id='{$field_id}_3' value='{$first}' aria-label='{$first_name_aria_label}' {$first_tabindex} {$disabled_text} {$first_placeholder_attribute}/>\r\n <label for='{$field_id}_3' {$sub_label_class_attribute}>{$first_name_sub_label}</label>\r\n </span>"; } $style = $is_admin && (!isset($middle_input['isHidden']) || rgar($middle_input, 'isHidden')) ? "style='display:none;'" : ''; if ($is_admin || isset($middle_input['isHidden']) && $middle_input['isHidden'] == false) { $middle_markup = "<span id='{$field_id}_4_container' class='name_middle' {$style}>\r\n <input type='text' name='input_{$id}.4' id='{$field_id}_4' value='{$middle}' aria-label='{$middle_name_aria_label}' {$middle_tabindex} {$disabled_text} {$middle_placeholder_attribute}/>\r\n <label for='{$field_id}_4' {$sub_label_class_attribute}>{$middle_name_sub_label}</label>\r\n </span>"; } $style = $is_admin && rgar($last_input, 'isHidden') ? "style='display:none;'" : ''; if ($is_admin || !rgar($last_input, 'isHidden')) { $last_markup = "<span id='{$field_id}_6_container' class='name_last' {$style}>\r\n <input type='text' name='input_{$id}.6' id='{$field_id}_6' value='{$last}' aria-label='{$last_name_aria_label}' {$last_tabindex} {$disabled_text} {$last_placeholder_attribute}/>\r\n <label for='{$field_id}_6' {$sub_label_class_attribute}>{$last_name_sub_label}</label>\r\n </span>"; } $style = $is_admin && rgar($suffix_input, 'isHidden') ? "style='display:none;'" : ''; if ($is_admin || !rgar($suffix_input, 'isHidden')) { $suffix_select_class = isset($suffix_input['choices']) && is_array($suffix_input['choices']) ? 'name_suffix_select' : ''; $suffix_markup = "<span id='{$field_id}_8_container' class='name_suffix {$suffix_select_class}' {$style}>\r\n <input type='text' name='input_{$id}.8' id='{$field_id}_8' value='{$suffix}' aria-label='{$suffix_aria_label}' {$suffix_tabindex} {$disabled_text} {$suffix_placeholder_attribute}/>\r\n <label for='{$field_id}_8' {$sub_label_class_attribute}>{$suffix_sub_label}</label>\r\n </span>"; } } $css_class = $this->get_css_class(); return "<div class='ginput_complex{$class_suffix} ginput_container {$css_class}' id='{$field_id}'>\r\n {$prefix_markup}\r\n {$first_markup}\r\n {$middle_markup}\r\n {$last_markup}\r\n {$suffix_markup}\r\n </div>"; case 'simple': $value = esc_attr($value); $class = esc_attr($class); $tabindex = GFCommon::get_tabindex(); $placeholder_attribute = GFCommon::get_field_placeholder_attribute($this); return "<div class='ginput_container ginput_container_name'>\r\n <input name='input_{$id}' id='{$field_id}' type='text' value='{$value}' class='{$class}' {$tabindex} {$disabled_text} {$placeholder_attribute}/>\r\n </div>"; default: $first_tabindex = GFCommon::get_tabindex(); $last_tabindex = GFCommon::get_tabindex(); $first_name_sub_label = rgar($first_input, 'customLabel') != '' ? $first_input['customLabel'] : gf_apply_filters(array('gform_name_first', $form_id), esc_html__('First', 'gravityforms'), $form_id); $last_name_sub_label = rgar($last_input, 'customLabel') != '' ? $last_input['customLabel'] : gf_apply_filters(array('gform_name_last', $form_id), esc_html__('Last', 'gravityforms'), $form_id); if ($is_sub_label_above) { $first_markup = ''; $style = $is_admin && rgar($first_input, 'isHidden') ? "style='display:none;'" : ''; if ($is_admin || !rgar($first_input, 'isHidden')) { $first_markup = "<span id='{$field_id}_3_container' class='name_first' {$style}>\r\n <label for='{$field_id}_3' {$sub_label_class_attribute}>{$first_name_sub_label}</label>\r\n <input type='text' name='input_{$id}.3' id='{$field_id}_3' value='{$first}' aria-label='{$first_name_aria_label}' {$first_tabindex} {$disabled_text} {$first_placeholder_attribute}/>\r\n </span>"; } $last_markup = ''; $style = $is_admin && rgar($last_input, 'isHidden') ? "style='display:none;'" : ''; if ($is_admin || !rgar($last_input, 'isHidden')) { $last_markup = "<span id='{$field_id}_6_container' class='name_last' {$style}>\r\n <label for='{$field_id}_6' {$sub_label_class_attribute}>" . $last_name_sub_label . "</label>\r\n <input type='text' name='input_{$id}.6' id='{$field_id}_6' value='{$last}' aria-label='{$last_name_aria_label}' {$last_tabindex} {$disabled_text} {$last_placeholder_attribute}/>\r\n </span>"; } } else { $first_markup = ''; $style = $is_admin && rgar($first_input, 'isHidden') ? "style='display:none;'" : ''; if ($is_admin || !rgar($first_input, 'isHidden')) { $first_markup = "<span id='{$field_id}_3_container' class='name_first' {$style}>\r\n <input type='text' name='input_{$id}.3' id='{$field_id}_3' value='{$first}' aria-label='{$first_name_aria_label}' {$first_tabindex} {$disabled_text} {$first_placeholder_attribute}/>\r\n <label for='{$field_id}_3' {$sub_label_class_attribute}>{$first_name_sub_label}</label>\r\n </span>"; } $last_markup = ''; $style = $is_admin && rgar($last_input, 'isHidden') ? "style='display:none;'" : ''; if ($is_admin || !rgar($last_input, 'isHidden')) { $last_markup = "<span id='{$field_id}_6_container' class='name_last' {$style}>\r\n <input type='text' name='input_{$id}.6' id='{$field_id}_6' value='{$last}' aria-label='{$last_name_aria_label}' {$last_tabindex} {$disabled_text} {$last_placeholder_attribute}/>\r\n <label for='{$field_id}_6' {$sub_label_class_attribute}>{$last_name_sub_label}</label>\r\n </span>"; } } $css_class = $this->get_css_class(); return "<div class='ginput_complex{$class_suffix} ginput_container {$css_class}' id='{$field_id}'>\r\n {$first_markup}\r\n {$last_markup}\r\n <div class='gf_clear gf_clear_complex'></div>\r\n </div>"; } }
public static function lead_detail_grid($form, $lead, $allow_display_empty_fields = false) { $form_id = absint($form['id']); $display_empty_fields = false; if ($allow_display_empty_fields) { $display_empty_fields = rgget('gf_display_empty_fields', $_COOKIE); } /** * A filter to set if empty fields shown be shown in the entry details * * @param bool $display_empty_fields True or false to show the fields * @param array $form The Form object to filter * @param array $lead The Lead object to filter */ $display_empty_fields = apply_filters('gform_entry_detail_grid_display_empty_fields', $display_empty_fields, $form, $lead); ?> <table cellspacing="0" class="widefat fixed entry-detail-view"> <thead> <tr> <th id="details"> <?php $title = sprintf('%s : %s %s', esc_html($form['title']), esc_html__('Entry # ', 'gravityforms'), absint($lead['id'])); echo apply_filters('gform_entry_detail_title', $title, $form, $lead); ?> </th> <th style="width:140px; font-size:10px; text-align: right;"> <?php if ($allow_display_empty_fields) { ?> <input type="checkbox" id="gentry_display_empty_fields" <?php echo $display_empty_fields ? "checked='checked'" : ''; ?> onclick="ToggleShowEmptyFields();" /> <label for="gentry_display_empty_fields"><?php esc_html_e('show empty fields', 'gravityforms'); ?> </label> <?php } ?> </th> </tr> </thead> <tbody> <?php $count = 0; $field_count = sizeof($form['fields']); $has_product_fields = false; foreach ($form['fields'] as $field) { $content = $value = ''; switch ($field->get_input_type()) { case 'section': if (!GFCommon::is_section_empty($field, $form, $lead) || $display_empty_fields) { $count++; $is_last = $count >= $field_count ? ' lastrow' : ''; $content = ' <tr> <td colspan="2" class="entry-view-section-break' . $is_last . '">' . esc_html(GFCommon::get_label($field)) . '</td> </tr>'; } break; case 'captcha': case 'html': case 'password': case 'page': //ignore captcha, html, password, page field break; default: //ignore product fields as they will be grouped together at the end of the grid if (GFCommon::is_product_field($field->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 = ' <tr> <td colspan="2" class="entry-view-field-name">' . esc_html(GFCommon::get_label($field)) . '</td> </tr> <tr> <td colspan="2" class="entry-view-field-value' . $last_row . '">' . $display_value . '</td> </tr>'; } break; } $content = apply_filters('gform_field_content', $content, $field, $value, $lead['id'], $form['id']); echo $content; } $products = array(); if ($has_product_fields) { $products = GFCommon::get_product_fields($form, $lead); if (!empty($products['products'])) { ?> <tr> <td colspan="2" class="entry-view-field-name"><?php echo esc_html(gf_apply_filters(array('gform_order_label', $form_id), __('Order', 'gravityforms'), $form_id)); ?> </td> </tr> <tr> <td colspan="2" class="entry-view-field-value lastrow"> <table class="entry-products" cellspacing="0" width="97%"> <colgroup> <col class="entry-products-col1" /> <col class="entry-products-col2" /> <col class="entry-products-col3" /> <col class="entry-products-col4" /> </colgroup> <thead> <th scope="col"><?php echo gf_apply_filters(array('gform_product', $form_id), __('Product', 'gravityforms'), $form_id); ?> </th> <th scope="col" class="textcenter"><?php echo esc_html(gf_apply_filters(array('gform_product_qty', $form_id), __('Qty', 'gravityforms'), $form_id)); ?> </th> <th scope="col"><?php echo esc_html(gf_apply_filters(array('gform_product_unitprice', $form_id), __('Unit Price', 'gravityforms'), $form_id)); ?> </th> <th scope="col"><?php echo esc_html(gf_apply_filters(array('gform_product_price', $form_id), __('Price', 'gravityforms'), $form_id)); ?> </th> </thead> <tbody> <?php $total = 0; foreach ($products['products'] as $product) { ?> <tr> <td> <div class="product_name"><?php echo esc_html($product['name']); ?> </div> <ul class="product_options"> <?php $price = GFCommon::to_number($product['price']); if (is_array(rgar($product, 'options'))) { $count = sizeof($product['options']); $index = 1; foreach ($product['options'] as $option) { $price += GFCommon::to_number($option['price']); $class = $index == $count ? " class='lastitem'" : ''; $index++; ?> <li<?php echo $class; ?> ><?php echo $option['option_label']; ?> </li> <?php } } $subtotal = floatval($product['quantity']) * $price; $total += $subtotal; ?> </ul> </td> <td class="textcenter"><?php echo esc_html($product['quantity']); ?> </td> <td><?php echo GFCommon::to_money($price, $lead['currency']); ?> </td> <td><?php echo GFCommon::to_money($subtotal, $lead['currency']); ?> </td> </tr> <?php } $total += floatval($products['shipping']['price']); ?> </tbody> <tfoot> <?php if (!empty($products['shipping']['name'])) { ?> <tr> <td colspan="2" rowspan="2" class="emptycell"> </td> <td class="textright shipping"><?php echo esc_html($products['shipping']['name']); ?> </td> <td class="shipping_amount"><?php echo GFCommon::to_money($products['shipping']['price'], $lead['currency']); ?> </td> </tr> <?php } ?> <tr> <?php if (empty($products['shipping']['name'])) { ?> <td colspan="2" class="emptycell"> </td> <?php } ?> <td class="textright grandtotal"><?php esc_html_e('Total', 'gravityforms'); ?> </td> <td class="grandtotal_amount"><?php echo GFCommon::to_money($total, $lead['currency']); ?> </td> </tr> </tfoot> </table> </td> </tr> <?php } } ?> </tbody> </table> <?php }
/** * Override this method to implement the appropriate sanitization specific to the field type before the value is saved. * * This base method provides a generic sanitization similar to wp_kses but values are not encoded. * Scripts are stripped out leaving tags allowed by the gform_allowable_tags filter. * * @param string $value The field value to be processed. * @param int $form_id The ID of the form currently being processed. * * @return string */ public function sanitize_entry_value($value, $form_id) { if (is_array($value)) { return ''; } /** * Provisional filter - may be subject to change or removal. * * @param bool * @param int $form_id * @para GF_Field $this */ $sanitize = apply_filters('gform_sanitize_entry_value', true, $form_id, $this); if (!$sanitize) { return $value; } //allow HTML for certain field types $allow_html = $this->allow_html(); $allowable_tags = gf_apply_filters(array('gform_allowable_tags', $form_id), $allow_html, $this, $form_id); if ($allowable_tags !== true) { $value = strip_tags($value, $allowable_tags); } $allowed_protocols = wp_allowed_protocols(); $value = wp_kses_no_null($value, array('slash_zero' => 'keep')); $value = wp_kses_hook($value, 'post', $allowed_protocols); $value = wp_kses_split($value, 'post', $allowed_protocols); return $value; }
public static function start_export($form) { $form_id = $form['id']; $fields = $_POST['export_field']; $start_date = empty($_POST['export_date_start']) ? '' : self::get_gmt_date($_POST['export_date_start'] . ' 00:00:00'); $end_date = empty($_POST['export_date_end']) ? '' : self::get_gmt_date($_POST['export_date_end'] . ' 23:59:59'); $search_criteria['status'] = 'active'; $search_criteria['field_filters'] = GFCommon::get_field_filters_from_post($form); if (!empty($start_date)) { $search_criteria['start_date'] = $start_date; } if (!empty($end_date)) { $search_criteria['end_date'] = $end_date; } $sorting = array('key' => 'date_created', 'direction' => 'DESC', 'type' => 'info'); GFCommon::log_debug("GFExport::start_export(): Start date: {$start_date}"); GFCommon::log_debug("GFExport::start_export(): End date: {$end_date}"); $form = self::add_default_export_fields($form); $entry_count = GFAPI::count_entries($form_id, $search_criteria); $page_size = 100; $offset = 0; //Adding BOM marker for UTF-8 $lines = chr(239) . chr(187) . chr(191); // set the separater $separator = gf_apply_filters('gform_export_separator', $form_id, ',', $form_id); $field_rows = self::get_field_row_count($form, $fields, $entry_count); //writing header $headers = array(); foreach ($fields as $field_id) { $field = RGFormsModel::get_field($form, $field_id); $label = gf_apply_filters('gform_entries_field_header_pre_export', array($form_id, $field_id), GFCommon::get_label($field, $field_id), $form, $field); $value = str_replace('"', '""', $label); GFCommon::log_debug("GFExport::start_export(): Header for field ID {$field_id}: {$value}"); $headers[$field_id] = $value; $subrow_count = isset($field_rows[$field_id]) ? intval($field_rows[$field_id]) : 0; if ($subrow_count == 0) { $lines .= '"' . $value . '"' . $separator; } else { for ($i = 1; $i <= $subrow_count; $i++) { $lines .= '"' . $value . ' ' . $i . '"' . $separator; } } GFCommon::log_debug("GFExport::start_export(): Lines: {$lines}"); } $lines = substr($lines, 0, strlen($lines) - 1) . "\n"; //paging through results for memory issues while ($entry_count > 0) { $paging = array('offset' => $offset, 'page_size' => $page_size); $leads = GFAPI::get_entries($form_id, $search_criteria, $sorting, $paging); $leads = gf_apply_filters('gform_leads_before_export', $form_id, $leads, $form, $paging); foreach ($leads as $lead) { foreach ($fields as $field_id) { switch ($field_id) { case 'date_created': $lead_gmt_time = mysql2date('G', $lead['date_created']); $lead_local_time = GFCommon::get_local_timestamp($lead_gmt_time); $value = date_i18n('Y-m-d H:i:s', $lead_local_time, true); break; default: $field = RGFormsModel::get_field($form, $field_id); $value = is_object($field) ? $field->get_value_export($lead, $field_id, false, true) : rgar($lead, $field_id); $value = apply_filters('gform_export_field_value', $value, $form_id, $field_id, $lead); GFCommon::log_debug("GFExport::start_export(): Value for field ID {$field_id}: {$value}"); break; } if (isset($field_rows[$field_id])) { $list = empty($value) ? array() : unserialize($value); foreach ($list as $row) { $row_values = array_values($row); $row_str = implode('|', $row_values); $lines .= '"' . str_replace('"', '""', $row_str) . '"' . $separator; } //filling missing subrow columns (if any) $missing_count = intval($field_rows[$field_id]) - count($list); for ($i = 0; $i < $missing_count; $i++) { $lines .= '""' . $separator; } } else { $value = maybe_unserialize($value); if (is_array($value)) { $value = implode('|', $value); } $lines .= '"' . str_replace('"', '""', $value) . '"' . $separator; } } $lines = substr($lines, 0, strlen($lines) - 1); GFCommon::log_debug("GFExport::start_export(): Lines: {$lines}"); $lines .= "\n"; } $offset += $page_size; $entry_count -= $page_size; if (!seems_utf8($lines)) { $lines = utf8_encode($lines); } $lines = apply_filters('gform_export_lines', $lines); echo $lines; $lines = ''; } /** * Fires after exporting all the entries in form * * @param array $form The Form object to get the entries from * @param string $start_date The start date for when the export of entries should take place * @param string $end_date The end date for when the export of entries should stop * @param array $fields The specified fields where the entries should be exported from */ do_action('gform_post_export_entries', $form, $start_date, $end_date, $fields); }
private static function get_notification_ui_settings($notification) { /** * These variables are used to convenient "wrap" child form settings in the appropriate HTML. */ $subsetting_open = ' <td colspan="2" class="gf_sub_settings_cell"> <div class="gf_animate_sub_settings"> <table> <tr>'; $subsetting_close = ' </tr> </table> </div> </td>'; $ui_settings = array(); $form_id = rgget('id'); $form = RGFormsModel::get_form_meta($form_id); $form = gf_apply_filters(array('gform_admin_pre_render', $form_id), $form); $is_valid = empty(GFCommon::$errors); ob_start(); ?> <tr valign="top" <?php echo rgar($notification, 'isDefault') ? "style='display:none'" : ''; ?> > <th scope="row"> <label for="gform_notification_name"> <?php esc_html_e('Name', 'gravityforms'); ?> <?php gform_tooltip('notification_name'); ?> </label> </th> <td> <input type="text" class="fieldwidth-2" name="gform_notification_name" id="gform_notification_name" value="<?php echo esc_attr(rgget('name', $notification)); ?> " /> </td> </tr> <!-- / name --> <?php $ui_settings['notification_name'] = ob_get_contents(); ob_clean(); ?> <?php $notification_events = array('form_submission' => esc_html__('Form is submitted', 'gravityforms')); if (rgars($form, 'save/enabled')) { $notification_events['form_saved'] = esc_html__('Form is saved', 'gravityforms'); $notification_events['form_save_email_requested'] = esc_html__('Save and continue email is requested', 'gravityforms'); } $notification_events = apply_filters('gform_notification_events', $notification_events, $form); $event_style = count($notification_events) == 1 || rgar($notification, 'isDefault') ? "style='display:none'" : ''; ?> <tr valign="top" <?php echo $event_style; ?> > <th scope="row"> <label for="gform_notification_event"> <?php esc_html_e('Event', 'gravityforms'); ?> <?php gform_tooltip('notification_event'); ?> </label> </th> <td> <select name="gform_notification_event" id="gform_notification_event"> <?php foreach ($notification_events as $code => $label) { ?> <option value="<?php echo esc_attr($code); ?> " <?php selected(rgar($notification, 'event'), $code); ?> ><?php echo esc_html($label); ?> </option> <?php } ?> </select> </td> </tr> <!-- / event --> <?php $ui_settings['notification_event'] = ob_get_contents(); ob_clean(); ?> <?php $notification_to_type = !rgempty('gform_notification_to_type') ? rgpost('gform_notification_to_type') : rgar($notification, 'toType'); if (empty($notification_to_type)) { $notification_to_type = 'email'; } $is_invalid_email_to = !$is_valid && !self::is_valid_notification_to(); $send_to_class = $is_invalid_email_to ? 'gfield_error' : ''; ?> <tr valign="top" class='<?php echo esc_attr($send_to_class); ?> ' <?php echo $notification_to_type == 'hidden' ? 'style="display:none;"' : ''; ?> > <th scope="row"> <label for="gform_notification_to_email"> <?php esc_html_e('Send To', 'gravityforms'); ?> <span class="gfield_required">*</span> <?php gform_tooltip('notification_send_to_email'); ?> </label> </th> <td> <input type="radio" id="gform_notification_to_type_email" name="gform_notification_to_type" <?php checked('email', $notification_to_type); ?> value="email" onclick="jQuery('.notification_to_container').hide(); jQuery('#gform_notification_to_email_container').show('slow');" /> <label for="gform_notification_to_type_email" class="inline"> <?php esc_html_e('Enter Email', 'gravityforms'); ?> </label> <input type="radio" id="gform_notification_to_type_field" name="gform_notification_to_type" <?php checked('field', $notification_to_type); ?> value="field" onclick="jQuery('.notification_to_container').hide(); jQuery('#gform_notification_to_field_container').show('slow');" /> <label for="gform_notification_to_type_field" class="inline"> <?php esc_html_e('Select a Field', 'gravityforms'); ?> </label> <input type="radio" id="gform_notification_to_type_routing" name="gform_notification_to_type" <?php checked('routing', $notification_to_type); ?> value="routing" onclick="jQuery('.notification_to_container').hide(); jQuery('#gform_notification_to_routing_container').show('slow');" /> <label for="gform_notification_to_type_routing" class="inline"> <?php esc_html_e('Configure Routing', 'gravityforms'); ?> <?php gform_tooltip('notification_send_to_routing'); ?> </label> </td> </tr> <!-- / to email type --> <?php $ui_settings['notification_to_email_type'] = ob_get_contents(); ob_clean(); if ($notification_to_type == 'hidden') { $ui_settings['notification_to_email_type'] = '<input type="hidden" name="gform_notification_to_type" value="hidden" />'; } ?> <tr id="gform_notification_to_email_container" class="notification_to_container <?php echo esc_attr($send_to_class); ?> " <?php echo $notification_to_type != 'email' ? "style='display:none';" : ''; ?> > <?php echo $subsetting_open; ?> <th scope="row"><?php esc_html_e('Send to Email', 'gravityforms'); ?> </th> <td> <?php $to_email = rgget('toType', $notification) == 'email' ? rgget('to', $notification) : ''; ?> <input type="text" name="gform_notification_to_email" id="gform_notification_to_email" value="<?php echo esc_attr($to_email); ?> " class="fieldwidth-1" /> <?php if (rgpost('gform_notification_to_type') == 'email' && $is_invalid_email_to) { ?> <span class="validation_message"><?php esc_html_e('Please enter a valid email address', 'gravityforms'); ?> .</span> <?php } ?> </td> <?php echo $subsetting_close; ?> </tr> <!-- / to email --> <?php $ui_settings['notification_to_email'] = ob_get_contents(); ob_clean(); ?> <?php $email_fields = gf_apply_filters(array('gform_email_fields_notification_admin', $form['id']), GFCommon::get_email_fields($form), $form); ?> <tr id="gform_notification_to_field_container" class="notification_to_container <?php echo esc_attr($send_to_class); ?> " <?php echo $notification_to_type != 'field' ? "style='display:none';" : ''; ?> > <?php echo $subsetting_open; ?> <th scope="row"><?php esc_html_e('Send to Field', 'gravityforms'); ?> </th> <td> <?php if (!empty($email_fields)) { ?> <select name="gform_notification_to_field" id="gform_notification_to_field"> <option value=""><?php esc_html_e('Select an email field', 'gravityforms'); ?> </option> <?php $to_field = rgget('toType', $notification) == 'field' ? rgget('to', $notification) : ''; foreach ($email_fields as $field) { ?> <option value="<?php echo esc_attr($field->id); ?> " <?php echo selected($field->id, $to_field); ?> ><?php echo GFCommon::get_label($field); ?> </option> <?php } ?> </select> <?php } else { ?> <div class="error_base"> <p><?php esc_html_e('Your form does not have an email field. Add an email field to your form and try again.', 'gravityforms'); ?> </p> </div> <?php } ?> </td> <?php echo $subsetting_close; ?> </tr> <!-- / to email field --> <?php $ui_settings['notification_to_email_field'] = ob_get_contents(); ob_clean(); ?> <tr id="gform_notification_to_routing_container" class="notification_to_container <?php echo esc_attr($send_to_class); ?> " <?php echo $notification_to_type != 'routing' ? "style='display:none';" : ''; ?> > <?php echo $subsetting_open; ?> <td colspan="2"> <div id="gform_notification_to_routing_rules"> <?php $routing_fields = self::get_routing_fields($form, '0'); if (empty($routing_fields)) { ?> <div class="gold_notice"> <p><?php esc_html_e('To use notification routing, your form must have a field supported by conditional logic.', 'gravityforms'); ?> </p> </div> <?php } else { if (empty($notification['routing'])) { $notification['routing'] = array(array()); } $count = sizeof($notification['routing']); $routing_list = ','; for ($i = 0; $i < $count; $i++) { $routing_list .= $i . ','; $routing = $notification['routing'][$i]; $is_invalid_rule = !$is_valid && $_POST['gform_notification_to_type'] == 'routing' && !self::is_valid_notification_email(rgar($routing, 'email')); $class = $is_invalid_rule ? "class='grouting_rule_error'" : ''; ?> <div style='width:99%' <?php echo $class; ?> > <?php esc_html_e('Send to', 'gravityforms'); ?> <input type="text" id="routing_email_<?php echo $i; ?> " value="<?php echo esc_attr(rgar($routing, 'email')); ?> " onkeyup="SetRouting(<?php echo $i; ?> );" /> <?php esc_html_e('if', 'gravityforms'); ?> <select id="routing_field_id_<?php echo $i; ?> " class='gfield_routing_select' onchange='jQuery("#routing_value_<?php echo $i; ?> ").replaceWith(GetRoutingValues(<?php echo $i; ?> , jQuery(this).val())); SetRouting(<?php echo $i; ?> ); '><?php echo self::get_routing_fields($form, rgar($routing, 'fieldId')); ?> </select> <select id="routing_operator_<?php echo $i; ?> " onchange="SetRouting(<?php echo $i; ?> )" class="gform_routing_operator"> <option value="is" <?php echo rgar($routing, 'operator') == 'is' ? "selected='selected'" : ''; ?> ><?php esc_html_e('is', 'gravityforms'); ?> </option> <option value="isnot" <?php echo rgar($routing, 'operator') == 'isnot' ? "selected='selected'" : ''; ?> ><?php esc_html_e('is not', 'gravityforms'); ?> </option> <option value=">" <?php echo rgar($routing, 'operator') == '>' ? "selected='selected'" : ''; ?> ><?php esc_html_e('greater than', 'gravityforms'); ?> </option> <option value="<" <?php echo rgar($routing, 'operator') == '<' ? "selected='selected'" : ''; ?> ><?php esc_html_e('less than', 'gravityforms'); ?> </option> <option value="contains" <?php echo rgar($routing, 'operator') == 'contains' ? "selected='selected'" : ''; ?> ><?php esc_html_e('contains', 'gravityforms'); ?> </option> <option value="starts_with" <?php echo rgar($routing, 'operator') == 'starts_with' ? "selected='selected'" : ''; ?> ><?php esc_html_e('starts with', 'gravityforms'); ?> </option> <option value="ends_with" <?php echo rgar($routing, 'operator') == 'ends_with' ? "selected='selected'" : ''; ?> ><?php esc_html_e('ends with', 'gravityforms'); ?> </option> </select> <?php echo self::get_field_values($i, $form, rgar($routing, 'fieldId'), rgar($routing, 'value')); ?> <a class='gf_insert_field_choice' title='add another rule' onclick='SetRouting(<?php echo $i; ?> ); InsertRouting(<?php echo $i + 1; ?> );'><i class='gficon-add'></i></a> <?php if ($count > 1) { ?> <img src='<?php echo GFCommon::get_base_url(); ?> /images/remove.png' id='routing_delete_<?php echo $i; ?> ' title='remove this email routing' alt='remove this email routing' class='delete_field_choice' style='cursor:pointer;' onclick='DeleteRouting(<?php echo $i; ?> );' /> <?php } ?> </div> <?php } if ($is_invalid_rule) { ?> <span class="validation_message"><?php esc_html_e('Please enter a valid email address for all highlighted routing rules above.', 'gravityforms'); ?> </span> <?php } ?> <input type="hidden" name="routing_count" id="routing_count" value="<?php echo $routing_list; ?> " /> <?php } ?> </div> </td> <?php echo $subsetting_close; ?> </tr> <!-- / to routing --> <?php $ui_settings['notification_to_routing'] = ob_get_contents(); ob_clean(); ?> <tr valign="top"> <th scope="row"> <label for="gform_notification_from_name"> <?php esc_html_e('From Name', 'gravityforms'); ?> <?php gform_tooltip('notification_from_name'); ?> </label> </th> <td> <input type="text" class="fieldwidth-2 merge-tag-support mt-position-right mt-hide_all_fields" name="gform_notification_from_name" id="gform_notification_from_name" value="<?php echo esc_attr(rgget('fromName', $notification)); ?> " /> </td> </tr> <!-- / from name --> <?php $ui_settings['notification_from_name'] = ob_get_contents(); ob_clean(); ?> <tr valign="top"> <th scope="row"> <label for="gform_notification_from"> <?php esc_html_e('From Email', 'gravityforms'); ?> <?php gform_tooltip('notification_from_email'); ?> </label> </th> <td> <input type="text" class="fieldwidth-2 merge-tag-support mt-position-right mt-hide_all_fields" name="gform_notification_from" id="gform_notification_from" value="<?php echo rgempty('from', $notification) ? '{admin_email}' : esc_attr(rgget('from', $notification)); ?> " /> </td> </tr> <!-- / to from email --> <?php $ui_settings['notification_from'] = ob_get_contents(); ob_clean(); ?> <tr valign="top"> <th scope="row"> <label for="gform_notification_reply_to"> <?php $is_invalid_reply_to = !$is_valid && !self::is_valid_notification_email(rgar($notification, 'replyTo')); $class = $is_invalid_reply_to ? ' gfield_error' : ''; ?> <?php esc_html_e('Reply To', 'gravityforms'); ?> <?php gform_tooltip('notification_reply_to'); ?> </label> </th> <td> <input type="text" name="gform_notification_reply_to" id="gform_notification_reply_to" class="merge-tag-support mt-hide_all_fields fieldwidth-2<?php echo $class; ?> " value="<?php echo esc_attr(rgget('replyTo', $notification)); ?> " /> </td> </tr> <!-- / reply to --> <?php $ui_settings['notification_reply_to'] = ob_get_contents(); ob_clean(); ?> <tr valign="top"> <th scope="row"> <label for="gform_notification_bcc"> <?php esc_html_e('BCC', 'gravityforms'); ?> <?php gform_tooltip('notification_bcc'); ?> </label> </th> <td> <?php $is_invalid_bcc = !$is_valid && !self::is_valid_notification_email(rgar($notification, 'bcc')); $class = $is_invalid_bcc ? ' gfield_error' : ''; ?> <input type="text" name="gform_notification_bcc" id="gform_notification_bcc" value="<?php echo esc_attr(rgget('bcc', $notification)); ?> " class="merge-tag-support mt-hide_all_fields fieldwidth-2<?php echo $class; ?> " /> </td> </tr> <!-- / bcc --> <?php $ui_settings['notification_bcc'] = ob_get_contents(); ob_clean(); ?> <?php $is_invalid_subject = !$is_valid && empty($_POST['gform_notification_subject']); $subject_class = $is_invalid_subject ? "class='gfield_error'" : ''; ?> <tr valign="top" <?php echo $subject_class; ?> > <th scope="row"> <label for="gform_notification_subject"> <?php esc_html_e('Subject', 'gravityforms'); ?> <span class="gfield_required">*</span> </label> </th> <td> <input type="text" name="gform_notification_subject" id="gform_notification_subject" class="fieldwidth-1 merge-tag-support mt-hide_all_fields mt-position-right" value="<?php echo esc_attr(rgar($notification, 'subject')); ?> " /> <?php if ($is_invalid_subject) { ?> <span class="validation_message"><?php esc_html_e('Please enter a subject for the notification email', 'gravityforms'); ?> </span><?php } ?> </td> </tr> <!-- / subject --> <?php $ui_settings['notification_subject'] = ob_get_contents(); ob_clean(); ?> <?php $is_invalid_message = !$is_valid && empty($_POST['gform_notification_message']); $message_class = $is_invalid_message ? "class='gfield_error'" : ''; ?> <tr valign="top" <?php echo $message_class; ?> > <th scope="row"> <label for="gform_notification_message"> <?php esc_html_e('Message', 'gravityforms'); ?> <span class="gfield_required">*</span> </label> </th> <td> <span class="mt-gform_notification_message"></span> <?php if (GFCommon::is_wp_version('3.3')) { wp_editor(rgar($notification, 'message'), 'gform_notification_message', array('autop' => false, 'editor_class' => 'merge-tag-support mt-wp_editor mt-manual_position mt-position-right')); } else { ?> <textarea name="gform_notification_message" id="gform_notification_message" class="fieldwidth-1 fieldheight-1"><?php echo esc_html($notification['message']); ?> </textarea><?php } if ($is_invalid_message) { ?> <span class="validation_message"><?php esc_html_e('Please enter a message for the notification email', 'gravityforms'); ?> </span><?php } ?> </td> </tr> <!-- / message --> <?php $ui_settings['notification_message'] = ob_get_contents(); ob_clean(); ?> <tr valign="top"> <th scope="row"> <label for="gform_notification_disable_autoformat"> <?php esc_html_e('Auto-formatting', 'gravityforms'); ?> <?php gform_tooltip('notification_autoformat'); ?> </label> </th> <td> <input type="checkbox" name="gform_notification_disable_autoformat" id="gform_notification_disable_autoformat" value="1" <?php echo empty($notification['disableAutoformat']) ? '' : "checked='checked'"; ?> /> <label for="form_notification_disable_autoformat" class="inline"> <?php esc_html_e('Disable auto-formatting', 'gravityforms'); ?> <?php gform_tooltip('notification_autoformat'); ?> </label> </td> </tr> <!-- / disable autoformat --> <?php $ui_settings['notification_disable_autoformat'] = ob_get_contents(); ob_clean(); ?> <tr valign="top" <?php echo rgar($notification, 'isDefault') ? 'style=display:none;' : ''; ?> > <th scope="row"> <label for="gform_notification_conditional_logic"> <?php esc_html_e('Conditional Logic', 'gravityforms'); gform_tooltip('notification_conditional_logic'); ?> </label> </th> <td> <input type="checkbox" id="notification_conditional_logic" onclick="SetConditionalLogic(this.checked); ToggleConditionalLogic(false, 'notification');" <?php checked(is_array(rgar($notification, 'conditionalLogic')), true); ?> /> <label for="notification_conditional_logic" class="inline"><?php esc_html_e('Enable conditional logic', 'gravityforms'); gform_tooltip('notification_conditional_logic'); ?> </label> <br /> </td> </tr> <!-- / conditional logic --> <tr> <td colspan="2"> <div id="notification_conditional_logic_container" class="gf_animate_sub_settings" style="padding-left:10px;"> <!-- content dynamically created from form_admin.js --> </div> </td> </tr> <?php $ui_settings['notification_conditional_logic'] = ob_get_contents(); ob_clean(); ?> <?php ob_end_clean(); $ui_settings = gf_apply_filters(array('gform_notification_ui_settings', $form_id), $ui_settings, $notification, $form); return $ui_settings; }
/** * Create a new task from a feed. * * @access public * @param int $record_id * @param string $module * @param array $feed * @param array $entry * @param array $form * @return void */ public function create_task($record_id, $module, $feed, $entry, $form) { if (rgars($feed, 'meta/createTask') != '1') { return; } /* Create task object. */ $task = array('Subject' => GFCommon::replace_variables($feed['meta']['taskSubject'], $form, $entry, false, false, false, 'text'), 'Status' => rgars($feed, 'meta/taskStatus'), 'SMOWNERID' => rgars($feed, 'meta/taskOwner'), 'Description' => GFCommon::replace_variables($feed['meta']['taskDescription'], $form, $entry, false, false, false, 'text')); if (rgars($feed, 'meta/taskDueDate')) { $due_date = GFCommon::replace_variables($feed['meta']['taskDueDate'], $form, $entry, false, false, false, 'text'); if (is_numeric($due_date)) { $task['Due Date'] = date('Y-m-d', strtotime('+' . $due_date . ' days')); } } /* Add lead or contact ID. */ if ($module === 'Contacts') { $task['CONTACTID'] = $record_id; } else { if ($module === 'Leads') { $task['SEID'] = $record_id; $task['SEMODULE'] = $module; } } /* Filter task. */ $task = gf_apply_filters('gform_zohocrm_task', $form['id'], $task, $feed, $entry, $form); /* Remove SMOWNERID if not set. */ if (rgblank($task['SMOWNERID'])) { unset($task['SMOWNERID']); } /* Prepare task record XML. */ $task_xml = '<Tasks>' . "\r\n"; $task_xml .= '<row no="1">' . "\r\n"; foreach ($task as $field_key => $field_value) { $task_xml .= $this->get_field_xml($field_key, $field_value); } $task_xml .= '</row>' . "\r\n"; $task_xml .= '</Tasks>' . "\r\n"; $this->log_debug(__METHOD__ . '(): Creating task: ' . print_r($task, true)); $this->log_debug(__METHOD__ . '(): Creating task XML: ' . print_r($task_xml, true)); try { /* Insert task record. */ $task_record = $this->api->insert_record('Tasks', $task_xml); /* Get ID of new task record. */ $task_id = 0; foreach ($task_record->result->recorddetail as $detail) { foreach ($detail->children() as $field) { if ($field['val'] == 'Id') { $task_id = (string) $field; } } } /* Save task ID to entry meta. */ gform_update_meta($entry['id'], 'zohocrm_task_id', $task_id); /* Log that task was created. */ $this->log_debug(__METHOD__ . '(): Task #' . $task_id . ' created and assigned to ' . $module . ' #' . $record_id . '.'); return $task_id; } catch (Exception $e) { $this->log_error(__METHOD__ . '(): Could not create task; ' . $e->getMessage()); return null; } }
public function get_list_input($has_columns, $column, $value, $form_id) { $tabindex = $this->get_tabindex(); $disabled = $this->is_form_editor() ? 'disabled' : ''; $column_index = 1; if ($has_columns && is_array($this->choices)) { foreach ($this->choices as $choice) { if ($choice['text'] == $column['text']) { break; } $column_index++; } } $input_info = array('type' => 'text'); $input_info = gf_apply_filters('gform_column_input', array($form_id, $this->id, $column_index), $input_info, $this, rgar($column, 'text'), $value, $form_id); switch ($input_info['type']) { case 'select': $input = "<select name='input_{$this->id}[]' {$tabindex} {$disabled} >"; if (!is_array($input_info['choices'])) { $input_info['choices'] = explode(',', $input_info['choices']); } foreach ($input_info['choices'] as $choice) { if (is_array($choice)) { $choice_value = $choice['value']; $choice_text = $choice['text']; $choice_selected = array_key_exists('isSelected', $choice) ? $choice['isSelected'] : false; } else { $choice_value = $choice; $choice_text = $choice; $choice_selected = false; } $is_selected = empty($value) ? $choice_selected : $choice_value == $value; $selected = $is_selected ? "selected='selected'" : ''; $input .= "<option value='" . esc_attr($choice_value) . "' {$selected}>" . esc_html($choice_text) . '</option>'; } $input .= '</select>'; break; default: $input = "<input type='text' name='input_{$this->id}[]' value='" . esc_attr($value) . "' {$tabindex} {$disabled}/>"; break; } return gf_apply_filters('gform_column_input_content', array($form_id, $this->id, $column_index), $input, $input_info, $this, rgar($column, 'text'), $value, $form_id); }
public static function is_duplicate($form_id, $field, $value) { global $wpdb; $lead_detail_table_name = self::get_lead_details_table_name(); $lead_table_name = self::get_lead_table_name(); $lead_detail_long = self::get_lead_details_long_table_name(); $is_long = !is_array($value) && strlen($value) > GFORMS_MAX_FIELD_LENGTH - 10; $sql_comparison = $is_long ? '( ld.value = %s OR ldl.value = %s )' : 'ld.value = %s'; switch (GFFormsModel::get_input_type($field)) { case 'time': $value = sprintf("%02d:%02d %s", $value[0], $value[1], $value[2]); break; case 'date': $value = self::prepare_date($field->dateFormat, $value); break; case 'number': $value = GFCommon::clean_number($value, $field->numberFormat); break; case 'phone': $value = str_replace(array(')', '(', '-', ' '), '', $value); $sql_comparison = 'replace( replace( replace( replace( ld.value, ")", "" ), "(", "" ), "-", "" ), " ", "" ) = %s'; break; case 'email': $value = is_array($value) ? rgar($value, 0) : $value; break; } $inner_sql_template = "SELECT %s as input, ld.lead_id\n FROM {$lead_detail_table_name} ld\n INNER JOIN {$lead_table_name} l ON l.id = ld.lead_id\n"; if ($is_long) { $inner_sql_template .= "INNER JOIN {$lead_detail_long} ldl ON ldl.lead_detail_id = ld.id\n"; } $inner_sql_template .= "WHERE l.form_id=%d AND ld.form_id=%d\n AND ld.field_number between %s AND %s\n AND status='active' AND {$sql_comparison}"; $sql = "SELECT count(distinct input) as match_count FROM ( "; $input_count = 1; if (is_array($field->get_entry_inputs())) { $input_count = sizeof($field->inputs); foreach ($field->inputs as $input) { $union = empty($inner_sql) ? '' : ' UNION ALL '; $inner_sql .= $union . $wpdb->prepare($inner_sql_template, $input['id'], $form_id, $form_id, $input['id'] - 0.0001, $input['id'] + 0.0001, $value[$input['id']], $value[$input['id']]); } } else { $inner_sql = $wpdb->prepare($inner_sql_template, $field->id, $form_id, $form_id, doubleval($field->id) - 0.0001, doubleval($field->id) + 0.0001, $value, $value); } $sql .= $inner_sql . "\n ) as count\n GROUP BY lead_id\n ORDER BY match_count DESC"; $count = gf_apply_filters('gform_is_duplicate', $form_id, $wpdb->get_var($sql), $form_id, $field, $value); return $count != null && $count >= $input_count; }
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'), '<a href="' . esc_url($url) . '">', '</a>')); } else { GFCommon::add_error_message(__('There was an issue saving this confirmation.', 'gravityforms')); } return $confirmation; }
public static function select_export_form() { check_ajax_referer('rg_select_export_form', 'rg_select_export_form'); $form_id = intval($_POST['form_id']); $form = RGFormsModel::get_form_meta($form_id); /** * Filters through the Form Export Page * * @param int $form_id The ID of the form to export * @param int $form The Form Object of the form to export */ $form = gf_apply_filters('gform_form_export_page', $form_id, $form); $filter_settings = GFCommon::get_field_filter_settings($form); $filter_settings_json = json_encode($filter_settings); $fields = array(); $form = GFExport::add_default_export_fields($form); if (is_array($form['fields'])) { /* @var GF_Field $field */ foreach ($form['fields'] as $field) { $inputs = $field->get_entry_inputs(); if (is_array($inputs)) { foreach ($inputs as $input) { $fields[] = array($input['id'], GFCommon::get_label($field, $input['id'])); } } else { if (!$field->displayOnly) { $fields[] = array($field->id, GFCommon::get_label($field)); } } } } $field_json = GFCommon::json_encode($fields); die("EndSelectExportForm({$field_json}, {$filter_settings_json});"); }
protected function get_submission_data($feed, $form, $entry) { $submission_data = array(); $submission_data['form_title'] = $form['title']; //getting mapped field data $billing_fields = $this->billing_info_fields(); foreach ($billing_fields as $billing_field) { $field_name = $billing_field['name']; $input_id = rgar($feed['meta'], "billingInformation_{$field_name}"); $submission_data[$field_name] = $this->get_field_value($form, $entry, $input_id); } //getting credit card field data $card_field = $this->get_credit_card_field($form); if ($card_field) { $submission_data['card_number'] = $this->remove_spaces_from_card_number(rgpost("input_{$card_field->id}_1")); $submission_data['card_expiration_date'] = rgpost("input_{$card_field->id}_2"); $submission_data['card_security_code'] = rgpost("input_{$card_field->id}_3"); $submission_data['card_name'] = rgpost("input_{$card_field->id}_5"); } //getting product field data $order_info = $this->get_order_data($feed, $form, $entry); $submission_data = array_merge($submission_data, $order_info); /** * Enables the Submission Data to be modified before it is used during feed processing by the payment add-on. * * @since 1.9.12.8 * * @param array $submission_data The customer and transaction data. * @param array $feed The Feed Object. * @param array $form The Form Object. * @param array $entry The Entry Object. * * @return array $submission_data */ return gf_apply_filters('gform_submission_data_pre_process_payment', $form['id'], $submission_data, $feed, $form, $entry); }
public function ajax_get_results() { // tooltips require_once GFCommon::get_base_path() . '/tooltips.php'; add_filter('gform_tooltips', array($this, 'add_tooltips')); $output = array(); $html = ''; $form_id = rgpost('id'); $form = GFFormsModel::get_form_meta($form_id); $form = gf_apply_filters(array('gform_form_pre_results', $form_id), $form); $search_criteria['status'] = 'active'; $fields = $this->get_fields($form); $total_entries = GFAPI::count_entries($form_id, $search_criteria); if ($total_entries == 0) { $html = esc_html__('No results.', 'gravityforms'); } else { $search_criteria = array(); $search_criteria['field_filters'] = GFCommon::get_field_filters_from_post($form); $start_date = rgpost('start'); $end_date = rgpost('end'); if ($start_date) { $search_criteria['start_date'] = $start_date; } if ($end_date) { $search_criteria['end_date'] = $end_date; } $search_criteria['status'] = 'active'; $output['s'] = http_build_query($search_criteria); $state_array = null; if (isset($_POST['state'])) { $state = $_POST['state']; $posted_check_sum = rgpost('checkSum'); $generated_check_sum = self::generate_checksum($state); $state_array = json_decode(base64_decode($state), true); if ($generated_check_sum !== $posted_check_sum) { $output['status'] = 'complete'; $output['html'] = esc_html__('There was an error while processing the entries. Please contact support.', 'gravityforms'); echo json_encode($output); die; } } $data = isset($this->_callbacks['data']) ? call_user_func($this->_callbacks['data'], $form, $fields, $search_criteria, $state_array) : $this->get_results_data($form, $fields, $search_criteria, $state_array); $entry_count = $data['entry_count']; if ('incomplete' === rgar($data, 'status')) { $state = base64_encode(json_encode($data)); $output['status'] = 'incomplete'; $output['stateObject'] = $state; $output['checkSum'] = self::generate_checksum($state); $output['html'] = sprintf(esc_html__('Entries processed: %1$d of %2$d', 'gravityforms'), rgar($data, 'offset'), $entry_count); echo json_encode($output); die; } if ($total_entries > 0) { $html = isset($this->_callbacks['markup']) ? call_user_func($this->_callbacks['markup'], $html, $data, $form, $fields) : ''; if (empty($html)) { foreach ($fields as $field) { $field_id = $field->id; $html .= "<div class='gresults-results-field' id='gresults-results-field-{$field_id}'>"; $html .= "<div class='gresults-results-field-label'>" . esc_html(GFCommon::get_label($field)) . '</div>'; $html .= '<div>' . self::get_field_results($form_id, $data, $field, $search_criteria) . '</div>'; $html .= '</div>'; } } } else { $html .= esc_html__('No results', 'gravityforms'); } } $output['html'] = $html; $output['status'] = 'complete'; $output['searchCriteria'] = $search_criteria; echo json_encode($output); die; }
/** * Enables use of the gform_SLUG_field_value filter to override the field value. Override this function to prevent the filter being used or to implement a custom filter. * * @param string $field_value * @param array $form * @param array $entry * @param string $field_id * * @return string */ public function maybe_override_field_value($field_value, $form, $entry, $field_id) { /* Get Add-On slug */ $slug = str_replace('gravityforms', '', $this->_slug); return gf_apply_filters(array("gform_{$slug}_field_value", $form['id'], $field_id), $field_value, $form, $entry, $field_id); }