/var/www/(Del)hsihk.com/wp-content/plugins/ninja-forms/includes/admin/display-screen-options.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<?php

function ninja_forms_load_screen_options_tab() {
    global 
$ninja_forms_help_screen_tabs$ninja_forms_screen_options;
    
$current_tab ninja_forms_get_current_tab();
    
$current_page esc_html$_REQUEST['page'] );
    
$screen get_current_screen();

    if(isset(
$ninja_forms_help_screen_tabs['_universal_'])){
        foreach(
$ninja_forms_help_screen_tabs['_universal_'] as $key => $tab){
            
$screen->add_help_tab( array(
                
'id'      => $key// This should be unique for the screen.
                
'title'   => $tab['title'],
                
'callback' => $tab['content'],
                
// Use 'callback' instead of 'content' for a function callback that renders the tab content.
            
) );
        }
    }

    if(isset(
$ninja_forms_help_screen_tabs[$current_page]['_universal_'])){
        foreach(
$ninja_forms_help_screen_tabs[$current_page]['_universal_'] as $key => $tab){
            
$screen->add_help_tab( array(
                
'id'      => $key// This should be unique for the screen.
                
'title'   => $tab['title'],
                
'callback' => $tab['content'],
                
// Use 'callback' instead of 'content' for a function callback that renders the tab content.
            
) );
        }
    }

    if(isset(
$ninja_forms_help_screen_tabs[$current_page][$current_tab])){
        foreach(
$ninja_forms_help_screen_tabs[$current_page][$current_tab] as $key => $tab){
            
$screen->add_help_tab( array(
                
'id'      => $key// This should be unique for the screen.
                
'title'   => $tab['title'],
                
'callback' => $tab['content'],
                
// Use 'callback' instead of 'content' for a function callback that renders the tab content.
            
) );
        }
    }

    if(isset(
$ninja_forms_screen_options['_universal_']) OR isset($ninja_forms_screen_options[$current_page]['_universal_']) OR isset($ninja_forms_screen_options[$current_page][$current_tab]) ){
        
add_filter('screen_layout_columns''ninja_forms_display_screen_options');
        
$screen->add_option('ninja_forms''');
    }
}

function 
ninja_forms_display_screen_options($content){
    global 
$ninja_forms_help_screen_tabs$ninja_forms_screen_options;
    
$current_page esc_html$_REQUEST['page'] );
    
$current_tab ninja_forms_get_current_tab();
    
ninja_forms_update_screen_options();

    if(isset(
$ninja_forms_screen_options['_universal_']) OR isset($ninja_forms_screen_options[$current_page]['_universal_']) OR isset($ninja_forms_screen_options[$current_page][$current_tab])){

        if(isset(
$ninja_forms_screen_options['_universal_'])){
            foreach(
$ninja_forms_screen_options['_universal_'] as $option){
                
$display_function $option['display_function'];
                
$arguments func_get_args();
                
array_shift($arguments); // We need to remove the first arg ($function_name)
                
call_user_func_array($display_function$arguments);
            }
        }

        if(isset(
$ninja_forms_screen_options[$current_page]['_universal_'])){
            foreach(
$ninja_forms_screen_options[$current_page]['_universal_'] as $option){
                
$display_function $option['display_function'];
                
$arguments func_get_args();
                
array_shift($arguments); // We need to remove the first arg ($function_name)
                
call_user_func_array($display_function$arguments);
            }
        }

        if(isset(
$ninja_forms_screen_options[$current_page][$current_tab])){
            foreach(
$ninja_forms_screen_options[$current_page][$current_tab] as $option){
                
$display_function $option['display_function'];
                
$arguments func_get_args();
                
array_shift($arguments); // We need to remove the first arg ($function_name)
                
call_user_func_array($display_function$arguments);
            }
        }

        
?>
        <br class="clear">
        <input type="hidden" name="ninja_forms_save_screen_options" value="1">
        <?php wp_nonce_field('ninja_forms_update_options'); ?>
        <input name="Submit" type="submit" class="button-primary" value="<?php _e'Save Options''ninja-forms' ); ?>">
        <?php
    
}
}

function 
ninja_forms_update_screen_options(){
    global 
$ninja_forms_screen_options;
    
$current_tab ninja_forms_get_current_tab();
    if(isset(
$_POST['_wpnonce'])){
        
$nonce $_POST['_wpnonce'];
    }else{
        
$nonce '';
    }
    if(!empty(
$_POST) AND $_POST['ninja_forms_save_screen_options'] == AND wp_verify_nonce($nonce'ninja_forms_update_options') AND check_admin_referer'ninja_forms_update_options''_wpnonce' )){
        if(!empty(
$ninja_forms_screen_options) AND is_array($ninja_forms_screen_options)){
            
//print_r($ninja_forms_screen_options);
            
if(isset($ninja_forms_screen_options['_universal_']) AND is_array($ninja_forms_screen_options['_universal_'])){
                foreach(
$ninja_forms_screen_options['_universal_'] as $slug => $option){
                    
$save_function $option['save_function'];
                    
$arguments func_get_args();
                    
array_shift($arguments); // We need to remove the first arg ($function_name)
                    
call_user_func_array($save_function$arguments);
                }
            }
            if(isset(
$ninja_forms_screen_options[$current_tab]) AND is_array($ninja_forms_screen_options[$current_tab])){
                foreach(
$ninja_forms_screen_options[$current_tab] as $slug => $option){
                    
$save_function $option['save_function'];
                    
$arguments func_get_args();
                    
array_shift($arguments); // We need to remove the first arg ($function_name)
                    
call_user_func_array($save_function$arguments);
                }
            }
        }
    }
}