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 ) ) { 
  30. return $result; 
  31.  
  32. return false; 
  33.  
  34. function gf_field_value_long( $leadid, $fieldid, $form = array() ) { 
  35. echo get_gf_field_value_long( $leadid, $fieldid, $form ); 
  36.  
  37.  
  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. // Gives you the label for a form input (such as First Name). Enter in the form and the field ID to access the label. 
  41. // Example: echo get_gf_field_label(1, 1.3); 
  42. function get_gf_field_label( $form_id, $field_id ) { 
  43. $form = RGFormsModel::get_form_meta( $form_id ); 
  44. foreach ( $form["fields"] as $field ) { 
  45. if ( $field['id'] == $field_id ) { 
  46. # $output = RGForms::escape_text($field['label']); // No longer used 
  47. $output = esc_html( $field['label'] ); // Using esc_html(), a WP function 
  48. } elseif ( is_array( $field['inputs'] ) ) { 
  49. foreach ( $field["inputs"] as $input ) { 
  50. if ( $input['id'] == $field_id ) { 
  51. if ( class_exists( 'GFCommon' ) ) { 
  52. $output = esc_html( GFCommon::get_label( $field, $field_id ) ); 
  53. } else { 
  54. #$output = RGForms::escape_text(RGForms::get_label($field, $field_id)); // No longer used 
  55. $output = esc_html( RGForms::get_label( $field, $field_id ) ); // No longer used 
  56.  
  57. return $output; 
  58.  
  59. function gf_field_label( $form_id, $field_id ) { 
  60. echo get_gf_field_label( $form_id, $field_id ); 
  61.  
  62. // Returns a form using php instead of shortcode 
  63. function get_gf_form( $id, $display_title = true, $display_description = true, $force_display = false, $field_values = NULL ) { 
  64. if ( class_exists( 'GFFormDisplay' ) ) { 
  65. return GFFormDisplay::get_form( $id, $display_title = true, $display_description = true, $force_display = false, $field_values = NULL ); 
  66. } else { 
  67. return RGFormsModel::get_form( $id, $display_title, $display_description ); 
  68.  
  69. function gf_form( $id, $display_title = true, $display_description = true, $force_display = false, $field_values = NULL ) { 
  70. echo get_gf_form( $id, $display_title, $display_description, $force_display, $field_values ); 
  71.  
  72. // Returns array of leads for a specific form 
  73. 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 ) { 
  74. 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 ); 
  75.  
  76. 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 ) { 
  77. echo get_gf_leads( $form_id, $sort_field_number, $sort_direction, $search, $offset, $page_size, $star, $read, $is_numeric_sort, $start_date, $end_date ); 
  78.  
  79. function kws_gf_directory( $atts ) { 
  80. GFDirectory::make_directory( $atts ); 
  81.  
  82.  
  83. if ( ! function_exists( 'kws_print_r' ) ) { 
  84. function kws_print_r( $content, $die = false ) { 
  85. echo '<pre>' . print_r( $content, true ) . '</pre>'; 
  86. if ( $die ) { 
  87. die(); 
  88.  
  89. return $content; 
  90.