ninja_forms_import_list_options

The Ninja Forms ninja forms import list options function.

Description

ninja_forms_import_list_options(); 

Usage

  1. if ( !function_exists( 'ninja_forms_import_list_options' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'ninja-forms/deprecated/includes/admin/ajax.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = ninja_forms_import_list_options(); 
  7.  

Defined (1)

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

/deprecated/includes/admin/ajax.php  
  1. function ninja_forms_import_list_options() { 
  2. // Bail if we aren't in the admin 
  3. if ( ! is_admin() ) 
  4. return false; 
  5.  
  6. check_ajax_referer( 'nf_ajax', 'nf_ajax_nonce' ); 
  7.  
  8. $options = $_REQUEST['options']; 
  9. $field_id = absint( $_REQUEST['field_id'] ); 
  10. $options = str_replace('\, ', '-comma-replace-placeholder-', $options ); 
  11. $options = ninja_forms_csv_explode( $options ); 
  12.  
  13. if( is_array( $options ) ) { 
  14. $tmp_array = array(); 
  15. $x = 0; 
  16. foreach( $options as $option ) { 
  17. $label = stripslashes( $option[0] ); 
  18. $value = stripslashes( $option[1] ); 
  19. $calc = stripslashes( $option[2] ); 
  20. $label = str_replace( "''", "", $label ); 
  21. $label = str_replace( "-comma-replace-placeholder-", ", ", $label ); 
  22. $value = str_replace( "''", "", $value ); 
  23. $value = str_replace( "-comma-replace-placeholder-", ", ", $value ); 
  24. $calc = str_replace( "''", "", $calc ); 
  25. $calc = str_replace( "-comma-replace-placeholder-", ", ", $calc ); 
  26. $tmp_array[$x]['label'] = $label; 
  27. $tmp_array[$x]['value'] = $value; 
  28. $tmp_array[$x]['calc'] = $calc; 
  29. $x++; 
  30. $x = 0; 
  31. foreach( $tmp_array as $option ) { 
  32. $hidden = 0; 
  33. ninja_forms_field_list_option_output($field_id, $x, $option, $hidden); 
  34. $x++; 
  35.  
  36. die();