ninja_forms_display_open_form_tag

The Ninja Forms ninja forms display open form tag function.

Description

ninja_forms_display_open_form_tag( $form_id ); 

Parameters (1)

0. $form_id
The form id.

Usage

  1. if ( !function_exists( 'ninja_forms_display_open_form_tag' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'ninja-forms/deprecated/includes/display/form/open-form-tag.php'; 
  3.  
  4. // The form id. 
  5. $form_id = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = ninja_forms_display_open_form_tag($form_id); 
  9.  

Defined (1)

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

/deprecated/includes/display/form/open-form-tag.php  
  1. function ninja_forms_display_open_form_tag( $form_id ) { 
  2. $ajax = Ninja_Forms()->form( $form_id )->get_setting( 'ajax' ); 
  3. $ajax = ! empty ( $ajax ) ? $ajax : 0; 
  4.  
  5. if ( $ajax == 1 ) { 
  6. if( is_ssl() ) { 
  7. $url = admin_url( 'admin-ajax.php', 'https' ); 
  8. else { 
  9. $url = admin_url( 'admin-ajax.php', 'http' ); 
  10. $url = apply_filters( 'ninja_forms_ajax_url', $url, $form_id ); 
  11. $url = esc_url_raw( add_query_arg( 'action', 'ninja_forms_ajax_submit', $url ) ); 
  12. } else { 
  13. if ( is_ssl() ) { 
  14. $url = 'https:/' . htmlspecialchars( $_SERVER["REQUEST_URI"] ); 
  15. } else { 
  16. $url = 'http:/' . htmlspecialchars( $_SERVER["REQUEST_URI"] ); 
  17. $url = ''; 
  18.  
  19. $display = 1; 
  20.  
  21. $display = apply_filters( 'ninja_forms_display_form_visibility', $display, $form_id ); 
  22.  
  23. if ( $display != 1 ) 
  24. $hide_class = " ninja-forms-no-display"; 
  25. else 
  26. $hide_class = ""; 
  27.  
  28. $form_class = ''; 
  29.  
  30. $form_class = apply_filters( 'ninja_forms_form_class', $form_class, $form_id ); 
  31.  
  32. if ( ! empty( $form_class ) ) 
  33. $form_class = ' ' . $form_class; 
  34.  
  35. ?> 
  36. <form id="ninja_forms_form_<?php echo $form_id;?>" enctype="multipart/form-data" method="post" name="" action="<?php echo $url;?>" class="ninja-forms-form<?php echo $form_class;?><?php echo $hide_class;?>"> 
  37.  
  38. <?php