/var/www/(Del)hsihk.com/wp-content/plugins/ninja-forms/classes/notification.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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
<?php
/**
 * Notification
 * 
 * Single notification object.
 * This object lets us call it like: Ninja_Forms()->notification( 33 )->methods()
 *
 * @package     Ninja Forms
 * @subpackage  Classes/Notifications
 * @copyright   Copyright (c) 2014, WPNINJAS
 * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
 * @since       2.8
*/

class NF_Notification
{

    
/**
     * @var notification id
     */
    
var $id '';

    
/**
     * @var type
     */
    
var $type '';

    
/**
     * @var active
     * Holds a boolean value.
     */
    
var $active '';

    
/**
     * @var form_id
     * Holds the id of our form.
     */
    
var $form_id '';


    
/**
     * Get things rolling
     * 
     * @since 2.8
     * @return void
     */
    
function __construct$id ) {
        
$this->id $id;
        
$this->type nf_get_object_meta_value$id'type' );
        
$this->active = ( nf_get_object_meta_value$id'active' ) == ) ? true false;
        
$this->form_id nf_get_object_parent$id );
    }

    
/**
     * Ouptut our admin screen
     * 
     * @access public
     * @since 2.8
     * @return void
     */
    
public function edit_screen() {
        
$type $this->type;
        
// Call our type edit screen.
        
Ninja_Forms()->notification_types$type ]->edit_screen$this->id );
    }

    
/**
     * Delete our notification
     * 
     * @access public
     * @since 2.8
     * @return void
     */
    
public function delete() {
        
nf_delete_notification$this->id );
    }

    
/**
     * Activate our notification
     * 
     * @access public
     * @since 2.8
     * @return void
     */
    
public function activate() {
        
nf_update_object_meta$this->id'active');
        
$this->active true;
    }

    
/**
     * Deactivate our notification
     * 
     * @access public
     * @since 2.8
     * @return void
     */
    
public function deactivate() {
        
nf_update_object_meta$this->id'active');
        
$this->active false;
    }

    
/**
     * Duplicate our notification
     *
     * @access public
     * @since 2.8
     * @return int $n_id
     */
    
public function duplicate() {
        
$n_id Ninja_Forms()->notifications->create$this->form_id );
        
$meta nf_get_notification_by_id$this->id );
        foreach ( 
$meta as $meta_key => $meta_value ) {
            
nf_update_object_meta$n_id$meta_key$meta_value );
        }

        
$name nf_get_object_meta_value$n_id'name' ) . ' - ' __'duplicate''ninja-forms' );
        
nf_update_object_meta$n_id'name'$name );
    }

    
/**
     * Run our notification processing function
     * 
     * @access public
     * @since 2.8
     * @return void
     */
    
public function process() {
        
$type $this->type;
        
Ninja_Forms()->notification_types$type ]->process$this->id );
    }

    
/**
     * Get a notification setting
     * 
     * @access public
     * @since 2.8
     * @return string $meta_value
     */
    
public function get_setting$meta_key ) {
        return 
nf_get_object_meta_value$this->id$meta_key );
    }

    
/**
     * Update a notification setting
     * 
     * @access public
     * @since 2.8
     * @return bool
     */
    
public function update_setting$meta_key$meta_value ) {
        
nf_update_object_meta$this->id$meta_key$meta_value );
        return 
true;
    }

}