/var/www/(Del)hsihk.com/wp-content/plugins/ninja-forms/classes/form.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
<?php
/**
 * Handles the output of our form, as well as interacting with its settings.
 *
 * @package     Ninja Forms
 * @subpackage  Classes/Form
 * @copyright   Copyright (c) 2014, WPNINJAS
 * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
 * @since       2.7
*/

class NF_Form {

    
/**
     * @var form_id
     * @since 2.7
     */
    
var $form_id;

    
/**
     * @var settings - Form Settings
     * @since 2.7
     */
    
var $settings = array();

    
/**
     * @var fields - Form Fields
     * @since 2.7
     */
    
var $fields = array();

    
/**
     * @var fields - Fields List
     * @since 2.7
     */
    
var $field_keys = array();

    
/**
     * @var errors - Form errors
     * @since 2.7
     */
    
var $errors = array();

    
/**
     * Get things started
     * 
     * @access public
     * @since 2.7
     * @return void
     */
    
public function __construct$form_id ) {
        
// Set our current form id.
        
$this->form_id $form_id;

        
$this->fields nf_get_fields_by_form_id$form_id );
        
$this->settings nf_get_form_settings$form_id );
    }

    
/**
     * Get one of our form settings.
     * 
     * @access public
     * @since 2.7
     * @return string $setting
     */
    
public function get_setting$setting ) {
        if ( isset ( 
$this->settings$setting ] ) ) {
            return 
$this->settings$setting ];
        } else {
            return 
false;
        }
    }

    
/**
     * Update a form setting (this doesn't update anything in the database)
     * Changes are only applied to this object.
     * 
     * @access public
     * @param string $setting
     * @param mixed $value
     * @return bool
     */
    
public function update_setting$setting$value ) {
        
$this->settings$setting ] = $value;
        return 
true;
    }

    
/**
     * Get all the submissions for this form
     * 
     * @access public
     * @since 2.7
     * @return array $sub_ids
     */
    
public function get_subs$args = array() ) {
        
$args['form_id'] = $this->form_id;
        return 
Ninja_Forms()->subs()->get$args );
    }

    
/**
     * Return a count of the submissions this form has had
     * 
     * @access public
     * @param array $args
     * @since 2.7
     * @return int $count
     */
    
public function sub_count$args = array() ) {
        return 
count$this->get_subs$args ) );
    }

}