kws_gf_load_functions

The Gravity Forms Directory & Addons kws gf load functions function.

Description

kws_gf_load_functions(); 

Usage

  1. if ( !function_exists( 'kws_gf_load_functions' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'gravity-forms-directory-addons/gravity-forms-addons.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = kws_gf_load_functions(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/gravity-forms-addons.php  
  1. function kws_gf_load_functions() { 
  2.  
  3. // If Gravity Forms is installed and exists 
  4. if(defined('RG_CURRENT_PAGE')) { 
  5.  
  6. function gf_field_value($leadid, $fieldid, $form = array()) { 
  7. echo get_gf_field_value($leadid, $fieldid, $form); 
  8.  
  9.  
  10. // To retrieve textarea inputs from a lead 
  11. // Example: get_gf_field_value_long(22, '14'); 
  12. function get_gf_field_value_long($leadid, $fieldid, $form = array(), $apply_filter=true) { 
  13. return RGFormsModel::get_field_value_long($leadid, $fieldid, $form, $apply_filter); 
  14.  
  15. // To retrieve textarea inputs from a lead 
  16. // Example: get_gf_field_value_long(22, '14'); 
  17. function get_gf_field_value($leadid, $fieldid, $form = array()) { 
  18. $lead = RGFormsModel::get_lead($leadid); 
  19. $fieldid = floatval($fieldid); 
  20. if(is_numeric($fieldid)) { 
  21. $result = $lead["$fieldid"]; 
  22.  
  23. $max_length = GFORMS_MAX_FIELD_LENGTH; 
  24.  
  25. if(strlen($result) >= ($max_length - 50)) { 
  26. $result = get_gf_field_value_long($lead["id"], $fieldid, $form); 
  27. $result = trim($result); 
  28.  
  29. if(!empty($result)) { return $result; } 
  30. return false; 
  31.  
  32. function gf_field_value_long($leadid, $fieldid, $form = array()) { 
  33. echo get_gf_field_value_long($leadid, $fieldid, $form); 
  34.  
  35.  
  36. // Gives you the label for a form input (such as First Name). Enter in the form and the field ID to access the label. 
  37. // Example: echo get_gf_field_label(1, 1.3); 
  38. // Gives you the label for a form input (such as First Name). Enter in the form and the field ID to access the label. 
  39. // Example: echo get_gf_field_label(1, 1.3); 
  40. function get_gf_field_label($form_id, $field_id) { 
  41. $form = RGFormsModel::get_form_meta($form_id); 
  42. foreach($form["fields"] as $field) { 
  43. if($field['id'] == $field_id) { 
  44. # $output = RGForms::escape_text($field['label']); // No longer used 
  45. $output = esc_html($field['label']); // Using esc_html(), a WP function 
  46. }elseif(is_array($field['inputs'])) { 
  47. foreach($field["inputs"] as $input) { 
  48. if($input['id'] == $field_id) { 
  49. if(class_exists('GFCommon')) { 
  50. $output = esc_html(GFCommon::get_label($field, $field_id)); 
  51. } else { 
  52. #$output = RGForms::escape_text(RGForms::get_label($field, $field_id)); // No longer used 
  53. $output = esc_html(RGForms::get_label($field, $field_id)); // No longer used 
  54. return $output; 
  55. function gf_field_label($form_id, $field_id) { 
  56. echo get_gf_field_label($form_id, $field_id); 
  57.  
  58. // Returns a form using php instead of shortcode 
  59. function get_gf_form($id, $display_title=true, $display_description=true, $force_display=false, $field_values=null) { 
  60. if(class_exists('GFFormDisplay')) { 
  61. return GFFormDisplay::get_form($id, $display_title=true, $display_description=true, $force_display=false, $field_values=null); 
  62. } else { 
  63. return RGFormsModel::get_form($id, $display_title, $display_description); 
  64. function gf_form($id, $display_title=true, $display_description=true, $force_display=false, $field_values=null) { 
  65. echo get_gf_form($id, $display_title, $display_description, $force_display, $field_values); 
  66.  
  67. // Returns array of leads for a specific form 
  68. function get_gf_leads($form_id, $sort_field_number=0, $sort_direction='DESC', $search='', $offset=0, $page_size=3000, $star=null, $read=null, $is_numeric_sort = false, $start_date=null, $end_date=null, $status = 'active', $approvedcolumn = false, $limituser = false) { 
  69. return GFDirectory::get_leads($form_id, $sort_field_number, $sort_direction, $search, $offset, $page_size, $star, $read, $is_numeric_sort, $start_date, $end_date, $status, $approvedcolumn, $limituser); 
  70.  
  71. function gf_leads($form_id, $sort_field_number=0, $sort_direction='DESC', $search='', $offset=0, $page_size=3000, $star=null, $read=null, $is_numeric_sort = false, $start_date=null, $end_date=null) { 
  72. echo get_gf_leads($form_id, $sort_field_number, $sort_direction, $search, $offset, $page_size, $star, $read, $is_numeric_sort, $start_date, $end_date); 
  73.  
  74. function kws_gf_directory($atts) { 
  75. GFDirectory::make_directory($atts); 
  76.  
  77.  
  78. if(!function_exists('kws_print_r')) { 
  79. function kws_print_r($content, $die = false) { 
  80. echo '<pre>'.print_r($content, true).'</pre>'; 
  81. if($die) { die(); } 
  82. return $content; 
  83.