tabs.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php if ( ! defined( 'ABSPATH' ) ) exit;
  2. function ninja_forms_display_tabs(){
  3. global $ninja_forms_tabs;
  4. $current_tab = ninja_forms_get_current_tab();
  5. $current_page = esc_html( $_REQUEST['page'] );
  6. $opt = nf_get_settings();
  7. if(isset($_REQUEST['form_id'])){
  8. $form_id = absint( $_REQUEST['form_id'] );
  9. }else{
  10. $form_id = '';
  11. }
  12. if(isset($ninja_forms_tabs[$current_page]) AND is_array($ninja_forms_tabs[$current_page])){
  13. foreach($ninja_forms_tabs[$current_page] as $slug => $tab){
  14. if((isset($opt['screen_options']['tab'][$slug]['visible']) AND $opt['screen_options']['tab'][$slug]['visible'] == 1) OR !isset($opt['screen_options']['tab'][$slug]['visible'])){
  15. if($tab['add_form_id'] == 1){
  16. $link = remove_query_arg( array( 'update_message','notification-action' ) );
  17. if($form_id != ''){
  18. $link = esc_url( add_query_arg( array( 'tab' => $slug, 'form_id' => $form_id ), $link ) );
  19. }else{
  20. $link = esc_url( add_query_arg( array( 'tab' => $slug ), $link ) );
  21. }
  22. }else{
  23. $link = esc_url( remove_query_arg( array( 'form_id', 'tab', 'update_message' ) ) );
  24. $link = esc_url( add_query_arg( array( 'tab' => $slug ), $link ) );
  25. }
  26. if($tab['disable_no_form_id'] AND ($form_id == '' OR $form_id == 'new')){
  27. $link = '';
  28. }
  29. if( isset( $tab['url'] ) ){
  30. $link = $tab['url'];
  31. }
  32. if( isset( $tab['target'] ) ){
  33. $target = $tab['target'];
  34. }else{
  35. $target = '';
  36. }
  37. if($tab['show_this_tab_link']){
  38. if($current_tab == $slug){
  39. ?>
  40. <span class="nav-tab nav-tab-active <?php echo $tab['active_class'];?>"><?php echo $tab['name'];?></span>
  41. <?php
  42. }else{
  43. ?>
  44. <a href="<?php echo $link;?>" target="<?php echo $target;?>" class="nav-tab <?php echo $tab['inactive_class'];?>"><?php echo $tab['name'];?></a>
  45. <?php
  46. }
  47. }
  48. }
  49. }
  50. }
  51. }
  52. ?>