function show_table() { if (isset($_REQUEST['leadid']) && isset($_REQUEST['form'])) { require_once "gravity-forms-addons.php"; $transient = false; if (isset($_REQUEST['post'])) { $transient = get_transient('gf_form_' . $_REQUEST['form'] . '_post_' . $_REQUEST['post'] . '_showadminonly'); } echo "<div class='wrap' style='padding:1.25em .5em'>" . apply_filters('kws_gf_directory_detail', apply_filters('kws_gf_directory_detail_' . (int) $_REQUEST['leadid'], GFDirectory::process_lead_detail(false, '', apply_filters('kws_gf_directory_showadminonly_lightbox', apply_filters('kws_gf_directory_showadminonly_lightbox_' . $_REQUEST['form'], $transient))))) . "</div>"; } }
/** * Generate the output for the IFRAME */ function show_table() { if (isset($_REQUEST['leadid']) && isset($_REQUEST['form'])) { require_once dirname(__FILE__) . "/gravity-forms-addons.php"; $transient = false; if (isset($_REQUEST['post'])) { $transient = get_transient('gf_form_' . $_REQUEST['form'] . '_post_' . $_REQUEST['post'] . '_showadminonly'); } $output = '<style>html, body { margin:0; padding: 0!important; } div.wrap { padding:.25em .5em; }</style>'; $output .= "<div class='wrap'>"; $leadid = (int) $_REQUEST['leadid']; $lightbox = apply_filters('kws_gf_directory_showadminonly_lightbox', apply_filters('kws_gf_directory_showadminonly_lightbox_' . $_REQUEST['form'], $transient, $leadid), $leadid); $detail = GFDirectory::process_lead_detail(false, '', $lightbox, $leadid); $detail = apply_filters('kws_gf_directory_detail', apply_filters('kws_gf_directory_detail_' . $leadid, $detail, $leadid), $leadid); $output .= $detail . "</div>"; echo $output; } }
public static function select_columns_page() { $form_id = $_GET["id"]; if (empty($form_id)) { echo esc_html__("Oops! We could not locate your form. Please try again.", "gravity-forms-addons"); exit; } //reading form metadata $form = RGFormsModel::get_form_meta($form_id); ?> <html> <head> <?php wp_print_styles(array("wp-admin", "colors-fresh")); wp_print_scripts(array("jquery", "sack", "jquery-ui-sortable")); ?> <style type="text/css"> body { font-family:"Lucida Grande",Verdana,Arial,sans-serif; } #wrapper { padding: 10px;} #sortable_available, #sortable_selected { list-style-type: none; margin: 0; padding: 2px; min-height:250px; border:1px solid #eaeaea; -moz-border-radius:4px; -webkit-border-radius:4px; -khtml-border-radius:4px; border-radius:4px; background-color:#FFF; } #sortable_available li, #sortable_selected li { margin: 0 2px 2px 2px; padding:2px; width: 96%; border:1px solid white; cursor:pointer; font-size: 13px;} .field_hover { border: 1px dashed #2175A9!important;} .placeholder{background-color: #FFF0A5; height:20px;} .gcolumn_wrapper { overflow:auto; height:80%; } .gcolumn_container_left, .gcolumn_container_right {width:46%;} .gcolumn_container_left {float:left;} .gcolumn_container_right {float:right;} .gform_select_column_heading{font-weight:bold; padding-bottom:7px; font-size:13px;} .column-arrow-mid { float:left; width:7%; min-width: 27px; height:100%; background: url(<?php echo plugins_url('images/arrow-rightleft.jpg', __FILE__); ?> ) repeat-y top center; /*background-attachment: fixed;*/ margin-top:26px; } .panel-instructions { border-bottom: 1px solid #dfdfdf; color: #555; font-size:12px; margin-bottom:6px; } .panel-instructions p { padding: 0 0 5px 0; margin: 0; } .clear { clear: both; display: block;} div.panel-buttons {margin-top:8px} div.panel-buttons {*margin-top:0px} /* ie specific */ code { font-size: 12px;} </style> <script type="text/javascript"> function equalHeights(makeTheseEqual) { var currentTallest = 0; var $makeTheseEqual = jQuery(makeTheseEqual); $makeTheseEqual.each(function(i){ if (jQuery(this).height() > currentTallest) { currentTallest = jQuery(this).height(); } }); // for ie6, set height since min-height isn't supported if (jQuery.browser.msie && jQuery.browser.version === 6.0) { $makeTheseEqual.css({'height': currentTallest}); } $makeTheseEqual.css({'min-height': currentTallest}); } jQuery(document).ready(function($) { $("#sortable_available, #sortable_selected").sortable({connectWith: '.sortable_connected', placeholder: 'placeholder'}); equalHeights('.gcolumn_wrapper ul, .column-arrow-mid'); $(".sortable_connected li").hover( function(){ $(this).addClass("field_hover"); }, function(){ $(this).removeClass("field_hover"); } ); }); var columns = new Array(); function SelectColumns(){ columns = []; jQuery("#sortable_selected li").each(function(){ columns.push(this.id); }); ChangeColumns(columns); } function ChangeColumns(columns){ var json_columns = JSON.stringify(columns); UpdateColumns(jQuery("body").data('formid'), json_columns); } function UpdateColumns(form_id, columns) { var mysack = new sack("<?php echo admin_url("admin-ajax.php"); ?> " ); mysack.execute = 1; mysack.method = 'POST'; mysack.setVar( "action", "change_directory_columns" ); mysack.setVar( "gforms_directory_columns", "<?php echo wp_create_nonce("gforms_directory_columns"); ?> " ); mysack.setVar( "form_id", form_id); mysack.setVar( "directory_columns", columns); mysack.onCompletion = function() { self.parent.tb_remove(); }; mysack.onError = function() { alert('<?php echo esc_js(__("Ajax error while setting lead property", "gravity-forms-addons")); ?> ' )}; mysack.runAJAX(); return true; } </script> </head> <body data-formid="<?php echo $form_id; ?> "> <div id="wrapper"> <?php $columns = GFDirectory::get_grid_columns($form_id); $field_ids = array_keys($columns); #$form = RGFormsModel::get_form_meta($form_id); array_push($form["fields"], array("id" => "id", "label" => esc_html__("Entry Id", "gravity-forms-addons"))); array_push($form["fields"], array("id" => "date_created", "label" => esc_html__("Entry Date", "gravity-forms-addons"))); array_push($form["fields"], array("id" => "ip", "label" => esc_html__("User IP", "gravity-forms-addons"))); array_push($form["fields"], array("id" => "source_url", "label" => esc_html__("Source Url", "gravity-forms-addons"))); array_push($form["fields"], array("id" => "payment_status", "label" => esc_html__("Payment Status", "gravity-forms-addons"))); array_push($form["fields"], array("id" => "transaction_id", "label" => esc_html__("Transaction Id", "gravity-forms-addons"))); array_push($form["fields"], array("id" => "payment_amount", "label" => esc_html__("Payment Amount", "gravity-forms-addons"))); array_push($form["fields"], array("id" => "payment_date", "label" => esc_html__("Payment Date", "gravity-forms-addons"))); array_push($form["fields"], array("id" => "created_by", "label" => esc_html__("User", "gravity-forms-addons"))); $form = self::get_selectable_entry_meta($form); ?> <div class="panel-instructions"> <p><?php esc_html_e("Drag & drop to order and select which columns are displayed in the Gravity Forms Directory.", "gravity-forms-addons"); ?> </p> <p><?php echo sprintf(esc_html__("Embed the Directory on a post or a page using %s ", "gravity-forms-addons"), '<code>[directory form="' . $_GET['id'] . '"]</code>'); ?> </p> </div> <div class="clear"></div> <div class="gcolumn_wrapper"> <div class="gcolumn_container_left"> <div class="gform_select_column_heading"><?php esc_html_e("Visible Columns", "gravity-forms-addons"); ?> </div> <ul id="sortable_selected" class="sortable_connected"> <?php foreach ($columns as $field_id => $field_info) { ?> <li id="<?php echo $field_id; ?> "><?php echo esc_html($field_info["label"]); ?> </li> <?php } ?> </ul> </div> <div class="column-arrow-mid"></div> <div class="gcolumn_container_right" id="available_column"> <div class="gform_select_column_heading"> <?php esc_html_e("Hidden Columns", "gravity-forms-addons"); ?> </div> <ul id="sortable_available" class="sortable_connected"> <?php $approvedcolumn = GFDirectory::get_approved_column($form); foreach ($form["fields"] as $field) { if (in_array(RGFormsModel::get_input_type($field), array("checkbox", 'address', 'radio', 'name')) && !in_array($field["id"], $field_ids) && floatval($field['id']) !== floor(floatval($approvedcolumn))) { ?> <li id="<?php echo $field["id"]; ?> "><?php echo esc_html(rgar($field, "label")); ?> </li> <?php } if (is_array(rgar($field, "inputs"))) { foreach ($field["inputs"] as $input) { if (!in_array($input["id"], $field_ids) && !($field["type"] == "creditcard" && in_array($input["id"], array(floatval("{$field["id"]}.2"), floatval("{$field["id"]}.3"))))) { ?> <li id="<?php echo $input["id"]; ?> "><?php echo esc_html(GFDirectory::get_label($field, $input["id"])); ?> <span class="description">(<?php echo esc_html(rgar($field, "label")); ?> )</span></li> <?php } } } else { if (!rgar($field, "displayOnly") && !in_array($field["id"], $field_ids)) { ?> <li id="<?php echo $field["id"]; ?> "><?php echo esc_html($field["label"]); ?> </li> <?php } } } ?> </ul> </div> </div> <div class="panel-buttons"> <input type="button" value="<?php esc_attr_e("Save", "gravity-forms-addons"); ?> " class="button-primary" onclick="SelectColumns();"/> <input type="button" value="<?php esc_html_e("Cancel", "gravity-forms-addons"); ?> " class="button" onclick="self.parent.tb_remove();"/> </div> </div> </body> </html> <?php }
public function settings_page() { $message = $validimage = false; global $plugin_page; if (isset($_POST["gf_addons_submit"])) { check_admin_referer("update", "gf_directory_update"); $settings = array("directory" => isset($_POST["gf_addons_directory"]), "referrer" => isset($_POST["gf_addons_referrer"]), "directory_defaults" => GFDirectory::directory_defaults($_POST['gf_addons_directory_defaults'], true), "modify_admin" => isset($_POST["gf_addons_modify_admin"]) ? $_POST["gf_addons_modify_admin"] : array(), "version" => GFDirectory::get_version(), "saved" => true); $message = esc_html__('Settings saved.', 'gravity-forms-addons'); update_option("gf_addons_settings", $settings); } else { $settings = GFDirectory::get_settings(); } ?> <style> .ul-square li { list-style: square!important; } .ol-decimal li { list-style: decimal!important; } .form-table label { font-size: 1em!important; margin: .4em 0; display: block;} li.setting-container { border: none!important; } #kws_gf_donate { float: left; width: 95%; border: 1px solid #ccc; padding: 10px 2.5%; color: #333; margin: 0; margin-bottom: 10px; background: #fff; text-align: center; <?php echo isset($_GET['viewinstructions']) ? 'display:none;' : ''; ?> } #kws_gf_donate div.aligncenter { max-width: 700px; margin: 0 auto; float: none; } #kws_gf_donate * { text-align: left;} #kws_gf_donate h3 { margin: 0; margin-top: 10px; } #kws_gf_donate p, #kws_gf_donate li { font-size: 1.1em; } #kws_gf_donate .email { padding: 5px; font-size: 15px; line-height: 20px; margin-bottom: 10px; } #kws_gf_donate .button-primary { display:block; float:left; margin:5px 0; text-align:center; } #kws_gf_donate img { max-width: 100%; margin: 0 auto 10px; display: block; text-align: center; } </style> <script> jQuery('document').ready(function($) { $('#kws_gf_advanced_settings').show(); $('a:contains(Directory)', $('ul.subsubsub')).css('font-weight', 'bold'); $('.wp-submenu li.current, .wp-submenu li.current a').removeClass('current'); $('a:contains(Directory)', $('.wp-submenu')).addClass('current').parent('li').addClass('current'); $('a.kws_gf_advanced_settings').hide(); //click(function(e) { e.preventDefault(); jQuery('#kws_gf_advanced_settings').slideToggle(); return false; }); $('#kws_gf_advanced_settings').change(function() { if($("#gf_settings_thead:checked").length || $("#gf_settings_tfoot:checked").length) { $('#gf_settings_jssearch').parents('li').show(); } else { $('#gf_settings_jssearch').parents('li').hide(); } }).trigger('change'); $(document).on('load click', 'label[for=gf_addons_directory]', function() { if($('#gf_addons_directory').is(":checked")) { $("tr#directory_settings_row").show(); } else { $("tr#directory_settings_row").hide(); } }); $('#kws_gf_instructions_button').click(function(e) { e.preventDefault(); $('#kws_gf_instructions').slideToggle(function() { var $that = $('#kws_gf_instructions_button'); $that.text(function() { if($('#kws_gf_instructions').is(":visible")) { return '<?php echo esc_js(__('Hide Directory Instructions', 'gravity-forms-addons')); ?> '; } else { return '<?php echo esc_js(__('View Directory Instructions', 'gravity-forms-addons')); ?> '; } }); }); return false; }); $('#message.fade').delay(1000).fadeOut('slow'); }); </script> <div class="wrap"> <?php if ($plugin_page !== 'gf_settings') { echo '<h2>' . esc_html__('Gravity Forms Directory Add-on', "gravity-forms-addons") . '</h2>'; } if ($message) { echo "<div class='fade below-h2 updated' id='message'>" . wpautop($message) . "</div>"; } // if you must, you can filter this out... if (apply_filters('kws_gf_show_donate_box', true)) { ?> <div id="kws_gf_donate"> <div class="aligncenter"> <a href="http://katz.si/gravityview/" title="<?php esc_attr_e('Go to the GravityView Website', 'gravity-forms-addons'); ?> " class="aligncenter"><img src= "<?php echo plugins_url('/images/GravityView.png', __FILE__); ?> " alt="GravityView Logo" /></a> <h2><?php esc_html_e('Better, simpler, more powerful.', 'gravity-forms-addons'); ?> </h2> <h3><?php esc_html_e('A brand-new Directory plugin is here.', 'gravity-forms-addons'); ?> </h3> <?php echo wpautop(sprintf(esc_html__('%sGravityView%s is the best way to display Gravity Forms entries on your website.', 'gravity-forms-addons'), '<a href="http://katz.si/gravityview/">', '</a>')); ?> <ul class="ul-square"> <li><?php esc_html_e('Drag & Drop interface', 'gravity-forms-addons'); ?> </li> <li><?php esc_html_e('Different layout types - display entries as a table or profiles', 'gravity-forms-addons'); ?> </li> <li><?php esc_html_e('Preset templates make it easy to get started', 'gravity-forms-addons'); ?> </li> <li><?php esc_html_e('Great support', 'gravity-forms-addons'); ?> </li> </ul> <?php echo wpautop(sprintf(esc_html__('We re-wrote the Directory plugin from the ground up to be more simple and more powerful. If you like the Directory plugin, you’ll %slove%s GravityView.', 'gravity-forms-addons'), '<em>', '</em>')); ?> <p><a href="http://katz.si/gravityview/" class="button button-hero button-primary"><?php esc_html_e('Check out GravityView', 'gravity-forms-addons'); ?> </a></p> </div> </div> <div class="clear"></div> <?php } // End donate box ?> <p class="submit"><span style="padding-right:.5em;" class="description"><?php esc_html_e('Need help getting started?', 'gravity-forms-addons'); ?> </span> <a href="#" class="button button-secondary" id="kws_gf_instructions_button"><?php if (!empty($settings['saved']) && !isset($_REQUEST['viewinstructions'])) { esc_html_e('View Directory Instructions', 'gravity-forms-addons'); } else { esc_html_e('Hide Directory Instructions', 'gravity-forms-addons'); } ?> </a></p> <div id="kws_gf_instructions"<?php if (!empty($settings['saved']) && !isset($_REQUEST['viewinstructions'])) { ?> class="hide-if-js clear" <?php } ?> > <div class="delete-alert alert_gray"> <div class="alignright" style="margin:1em 1.2em;"> <iframe width="400" height="255" src="http<?php echo is_ssl() ? 's' : ''; ?> ://www.youtube.com/embed/PMI7Jb-RP2I?hd=1" frameborder="0" allowfullscreen></iframe> </div> <h3 style="padding-top:1em;"><?php esc_html_e('To integrate a form with Directory:', 'gravity-forms-addons'); ?> </h3> <ol class="ol-decimal"> <li><?php esc_html_e('Go to the post or page where you would like to add the directory.', 'gravity-forms-addons'); ?> </li> <li><?php esc_html_e('Click the "Add Directory" button above the content area.', 'gravity-forms-addons'); ?> </li> <li><?php esc_html_e('Choose a form from the drop-down menu and configure settings as you would like them.', 'gravity-forms-addons'); ?> </li> <li><?php printf(esc_html__('Click "Insert Directory". A "shortcode" should appear in the content editor that looks similar to %s[directory form="#"]%s', 'gravity-forms-addons'), '<code style="font-size:1em;">', '</code>'); ?> </li> <li><?php esc_html_e('Save the post or page', 'gravity-forms-addons'); ?> </li> </ol> <h4><?php esc_html_e('Configuring Fields & Columns', "gravity-forms-addons"); ?> </h4> <?php echo wpautop(esc_html__('When editing a form, click on a field to expand the field. Next, click the "Directory" tab. There, you will find options to:', "gravity-forms-addons")); ?> <ul class="ul-square"> <li><?php esc_html_e("Choose whether you would like the field to be a link to the Single Entry View;", "gravity-forms-addons"); ?> </li> <li><?php esc_html_e("Hide the field in Directory View; and", "gravity-forms-addons"); ?> </li> <li><?php esc_html_e("Hide the field in Single Entry View", "gravity-forms-addons"); ?> </li> </ul> <h4><?php esc_html_e('Configuring Column Visibility & Order', "gravity-forms-addons"); ?> </h4> <?php echo wpautop(esc_html__('When editing a form in Gravity Forms, click the link near the top-center of the page named "Directory Columns"', "gravity-forms-addons")); ?> <ol class="ol-decimal"> <li><?php esc_html_e('When editing a form in Gravity Forms, click the link near the top-center of the page named "Directory Columns"', "gravity-forms-addons"); ?> </li> <li><?php esc_html_e('Drag and drop columns from the right ("Hidden Columns") side to the left ("Visible Columns") side.', "gravity-forms-addons"); ?> </li> <li><?php esc_html_e('Click the "Save" button', "gravity-forms-addons"); ?> </li> </ol> </div> <div class="hr-divider"></div> </div> <form method="post" action="" class="clear"> <?php wp_nonce_field("update", "gf_directory_update"); ?> <table class="form-table"> <tr> <th scope="row"><label for="gf_addons_directory"><?php esc_html_e("Gravity Forms Directory", "gravity-forms-addons"); ?> </label> </th> <td> <label for="gf_addons_directory" class="howto"><input type="checkbox" id="gf_addons_directory" name="gf_addons_directory" <?php checked($settings["directory"]); ?> /> <?php esc_html_e('Enable Gravity Forms Directory capabilities', 'gravity-forms-addons'); ?> </label> </td> </tr> <tr id="directory_settings_row"> <th scope="row"></th> <td> <h2 style="margin-bottom:0; padding-bottom:0;"><?php esc_html_e("Directory Default Settings", "gravity-forms-addons"); ?> </h2> <h3><?php esc_html_e("These defaults can be over-written when inserting a directory.", "gravity-forms-addons"); ?> </h3> <?php self::make_popup_options(false); ?> <div class="hr-divider"></div> </td> </tr> <tr> <th scope="row"><label for="gf_addons_referrer"><?php esc_html_e("Add Referrer Data to Emails", "gravity-forms-addons"); ?> </label> </th> <td> <label for="gf_addons_referrer"><input type="checkbox" id="gf_addons_referrer" name="gf_addons_referrer" <?php checked($settings["referrer"]); ?> /> <?php esc_html_e("Adds referrer data to entries, including the path the user took to get to the form before submitting.", 'gravity-forms-addons'); ?> </label> </td> </tr> <tr> <th scope="row"><label for="gf_addons_modify_admin"><?php esc_html_e("Modify Gravity Forms Admin", "gravity-forms-addons"); ?> </label> </th> <td> <ul> <li><label for="gf_addons_modify_admin_expand"><input type="checkbox" id="gf_addons_modify_admin_expand" name="gf_addons_modify_admin[expand]" <?php checked(isset($settings["modify_admin"]['expand'])); ?> /> <?php esc_html_e("Show option to expand Form Editor Field boxes", "gravity-forms-addons"); ?> </label></li> <li><label for="gf_addons_modify_admin_toggle"><input type="checkbox" id="gf_addons_modify_admin_toggle" name="gf_addons_modify_admin[toggle]" <?php checked(isset($settings["modify_admin"]['toggle'])); ?> /> <?php esc_html_e('When clicking Form Editor Field boxes, toggle open and closed instead of "accordion mode" (closing all except the clicked box).', "gravity-forms-addons"); ?> </label></li> <li><label for="gf_addons_modify_admin_edit"><input type="checkbox" id="gf_addons_modify_admin_edit" name="gf_addons_modify_admin[edit]" <?php checked(isset($settings["modify_admin"]['edit'])); ?> /> <?php printf(esc_html__("Makes possible direct editing of entries from %sEntries list view%s", "gravity-forms-addons"), '<a href="' . admin_url('admin.php?page=gf_entries') . '">', '</a>'); ?> </label></li> <li><label for="gf_addons_modify_admin_ids"><input type="checkbox" id="gf_addons_modify_admin_ids" name="gf_addons_modify_admin[ids]" <?php checked(isset($settings["modify_admin"]['ids'])); ?> /> <?php printf(esc_html__("Adds a link in the Forms list view to view form IDs", "gravity-forms-addons"), '<a href="' . admin_url('admin.php?page=gf_edit_forms') . '">', '</a>'); ?> </label></li> </ul> </td> </tr> <tr> <td colspan="2" ><input type="submit" name="gf_addons_submit" class="button-primary button-large button-mega" value="<?php esc_attr_e("Save Settings", "gravity-forms-addons"); ?> " /></td> </tr> </table> </form> </div> <?php }
private static function is_gravity_page($page = array()) { return GFDirectory::is_gravity_page($page); }
public static function uninstall() { if (!GFDirectory::has_access("gravityforms_directory_uninstall")) { __("You don't have adequate permission to uninstall Directory Add-On.", "gravity-forms-addons"); } //removing options delete_option("gf_addons_settings"); //Deactivating plugin $plugin = "gravity-forms-addons/gravity-forms-addons.php"; deactivate_plugins($plugin); update_option('recently_activated', array($plugin => time()) + (array) get_option('recently_activated')); }
foreach ($images as $key => $url) { if (!empty($url)) { $image_output[] = GFDirectory::render_image_link($url, $lead, $options); } } if (sizeof($image_output) > 1) { $value = '<ul><li>' . implode('</li><li>', $image_output) . '</li></ul>'; } else { $value = implode('', $image_output); } break; case "post_image": $valueArray = explode("|:|", $value); @(list($url, $title, $caption, $description) = $valueArray); if (!empty($url)) { $value = GFDirectory::render_image_link($url, $lead, $options, $title, $caption, $description); } break; case "source_url": if (in_array('urls', $lightboxsettings) || !empty($lightboxsettings['urls'])) { $lightboxclass .= ' rel="directory_all directory_urls"'; } if ($linkwebsite) { $value = "<a href='" . esc_attr($lead["source_url"]) . "'{$target}{$lightboxclass} title='" . esc_attr($lead["source_url"]) . "'{$nofollow}>.../" . esc_attr(GFCommon::truncate_url($lead["source_url"])) . "</a>"; } else { $value = esc_attr(GFCommon::truncate_url($lead["source_url"])); } break; case "post_title": if (apply_filters('kws_gf_directory_post_title_link', false, $form, $lead) && !empty($lead['post_id'])) { $value = '<a href="' . esc_url(get_permalink($lead['post_id'])) . '" title="' . esc_attr($value) . '" ' . $nofollow . $target . '>' . esc_html($value) . '</a>';