/var/www/hkosl.com/aga/wp-content/plugins/contact-form-7/includes/validation.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
<?php

class WPCF7_Validation implements ArrayAccess {
    private 
$invalid_fields = array();
    private 
$container = array();

    public function 
__construct() {
        
$this->container = array(
            
'valid' => true,
            
'reason' => array(),
            
'idref' => array(),
        );
    }

    public function 
invalidate$context$message ) {
        if ( 
$context instanceof WPCF7_FormTag ) {
            
$tag $context;
        } elseif ( 
is_array$context ) ) {
            
$tag = new WPCF7_FormTag$context );
        } elseif ( 
is_string$context ) ) {
            
$tags wpcf7_scan_form_tags( array( 'name' => trim$context ) ) );
            
$tag $tags ? new WPCF7_FormTag$tags[0] ) : null;
        }

        
$name = ! empty( $tag ) ? $tag->name null;

        if ( empty( 
$name )
        or ! 
wpcf7_is_name$name ) ) {
            return;
        }

        if ( 
$this->is_valid$name ) ) {
            
$id $tag->get_id_option();

            if ( empty( 
$id )
            or ! 
wpcf7_is_name$id ) ) {
                
$id null;
            }

            
$this->invalid_fields[$name] = array(
                
'reason' => (string) $message,
                
'idref' => $id,
            );
        }
    }

    public function 
is_valid$name null ) {
        if ( ! empty( 
$name ) ) {
            return ! isset( 
$this->invalid_fields[$name] );
        } else {
            return empty( 
$this->invalid_fields );
        }
    }

    public function 
get_invalid_fields() {
        return 
$this->invalid_fields;
    }

    public function 
offsetSet$offset$value ) {
        if ( isset( 
$this->container[$offset] ) ) {
            
$this->container[$offset] = $value;
        }

        if ( 
'reason' == $offset
        
and is_array$value ) ) {
            foreach ( 
$value as $k => $v ) {
                
$this->invalidate$k$v );
            }
        }
    }

    public function 
offsetGet$offset ) {
        if ( isset( 
$this->container[$offset] ) ) {
            return 
$this->container[$offset];
        }
    }

    public function 
offsetExists$offset ) {
        return isset( 
$this->container[$offset] );
    }

    public function 
offsetUnset$offset ) {
    }
}