/var/www/(Del)hsihk.com/wp-content/plugins/ninja-forms/includes/display/form/response-message.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
<?php
/*
 * Outputs the HTML for displaying success messages or error messages set to display at location 'general'
 *
 */

function ninja_forms_display_response_message$form_id ){
    global 
$ninja_forms_processing;

    
$plugin_settings nf_get_settings();

    
$form_row ninja_forms_get_form_by_id($form_id);
    if( isset( 
$form_row['data']['ajax'] ) ){
        
$ajax $form_row['data']['ajax'];
    }else{
        
$ajax 0;
    }

    if( 
$ajax == AND ( is_object$ninja_forms_processing ) AND !$ninja_forms_processing->get_all_errors() AND !$ninja_forms_processing->get_all_success_msgs() ) ){
        
$display 'display:none;';
    }else{
        
$display '';
    }

    if( 
is_object$ninja_forms_processing ) ){
        if( 
$ninja_forms_processing->get_errors_by_location('general') ){
            
$class 'ninja-forms-error-msg';
        }else if( 
$ninja_forms_processing->get_all_success_msgs() ){
            
$class 'ninja-forms-success-msg';
        }else{
            
$class '';
        }
    }else{
        
$class '';
    }

    
//if ( $class != '' ) {
        
echo '<div id="ninja_forms_form_' $form_id '_response_msg" style="' $display '" class="ninja-forms-response-msg '.$class.'">';
            
        if ( isset ( 
$ninja_forms_processing ) && $ninja_forms_processing->get_form_ID() == $form_id ) {
                
            if( 
is_object$ninja_forms_processing ) ){
                if( 
$ninja_forms_processing->get_form_ID() == $form_id ){
                    if( 
$ninja_forms_processing->get_errors_by_location('general') ){
                        foreach(
$ninja_forms_processing->get_errors_by_location('general') as $error){
                            echo 
'<div>';
                            echo 
$error['msg'];
                            echo 
'</div>';
                        }
                    }


                    if( 
$ninja_forms_processing->get_all_success_msgs()){
                        foreach(
$ninja_forms_processing->get_all_success_msgs() as $success){
                            echo 
'<div>';
                            echo 
$success;
                            echo 
'</div>';
                        }
                    }
                }
            }
        }
            


        echo 
'</div>';        
    
//}

    
}

add_action'ninja_forms_display_before_form''ninja_forms_display_response_message'10 );