-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDelete.php
258 lines (197 loc) · 5.19 KB
/
Delete.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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
<?php
/**
* This class contains methods that delete parameters.
* It is used in many occasions such as uninstall.php or custom buttons
*
*
* @@version 1.02.01
* @@author pmoraitop
*
*
*
*
*Every Parameter has the following structure
*
*If a Parameter specified by entity id then
*
* name_of_the_parameter + _ + id
*
*General Parameter
* name_of_the_parameter
*
*
*/
require_once WPPA_PLUGIN_DIR . '/modules/contactForm/CntcFormData.php';
require_once WPPA_PLUGIN_DIR . '/library/entityhelp.php';
class Delete{
/**********************
* Constants Section
**********************
*
* On this section it is declared arrays for many types of
* parameters. If you add new parameter ( that it saves in DB)
* then just add its name to the correct array.
*
*
*
*/
/*
* mainAdminPageGeneralConfigurationParameters -->
*
*
* This array contains all parameters on Main Admin Page
* Basically these parameters does not refer to a spesific entity
* such as Contact Form.
*
*
*/
public Array $mainAdminPageGeneralConfigurationParameters = array(
'apicode_main',
'baseurl_main',
'loginuri_main',
'pylonusername_main',
'pylonpassword_',
'applicationname_main',
'databasealias_main',
'cntcenabled_main',
'postdatauri_main',
'choice',
'pylonapienabled'
);
/*
*
* cntcFormParameters -->
*
* This array contains all parameters that are used in Main Page Admin
* and they refer to a Contact Form Object.
*
*/
public Array $cntcFormParameters = array(
'apicode',
'baseurl',
'loginuri',
'pylonusername',
'pylonpassword',
'applicationname',
'databasealias',
'cntcenabled',
'entitycode',
'postdatauri',
'willsenduser'
);
/*
* supppageParameters -->
*
*
* This array contains all parameters that are declared on
* Admin Page for Support Pafe Form For Sign Up Users.
*
*
*
*/
public Array $supppageParameters = array(
'supppageselect',
'supppageenable',
'redirectpageselect'
);
/**********************
*
* Methods Section
*
**********************
*
*
*On this section methods are developed. These are the main functions for
*reading data and delete them
*
*
*
*
*/
public function __construct(){
}
/*
* deleteEverything() -->
*
* As its name mention, this function delete all info for IS Connectivity Plugin
*
*
*/
public function deleteEverything(){
$this->wpisc_delete_supppage_parameters();
$this->wpisc_delete_all_CntcForm_parameters();
$this->wpisc_delete_admin_main_page_general_configuration_parameters();
}
/*
*
* wpisc_delete_supppage_parameters()-->
*
*
*
* This method deletes all parameters for Support Page for Signed Up users
*
*/
public function wpisc_delete_supppage_parameters(){
foreach( $this->supppageParameters as $parameter ){
$this->wpisc_delete_specific_parameter( $parameter );
}
}
/*
* wpisc_delete_admin_main_page_general_configuration_parameters() -->
*
*
* This method delete all main Page General Configuration Parameters
*
*
*/
public function wpisc_delete_admin_main_page_general_configuration_parameters(){
foreach( $this->mainAdminPageGeneralConfigurationParameters as $generalParameter ){
$this->wpisc_delete_specific_parameter( $generalParameter );
}
}
/*
* wpisc_delete_all_CntcForm_parameters() -->
*
*
* Delete all Parameters are being saved for All Contact Forms Entitys
*
*
*/
public function wpisc_delete_all_CntcForm_parameters(){
$cntcForms = new CntcFormData();
$cntcdata = $cntcForms->__getData();
foreach( $cntcdata as $id => $title ){
$this->wpisc_delete_spesific_CntcForm_parameters( $id );
}
}
/*
* wpisc_delete_spesific_CntcForm_parameters( ) -->
*
*
* It deletes all parameters are being saved for a specific Contact Form Entity ID
*/
public function wpisc_delete_spesific_CntcForm_parameters( $id ){
foreach( $this->cntcFormParameters as $parameter ){
$this->wpisc_delete_specific_parameter( $parameter, $id );
}
}
/*
* wpisc_delete_specific_parameter() -->
*
*
* Fondamental function to delete a given parameter.
* Whe can declare a name for the parameter if it is a general parameter (require)
* or id for a parameter that it is used for an entity (entitys id) (optional)
*
*/
public function wpisc_delete_specific_parameter( $parameter, $id=''){
$underscore='';
if( $id!='' ){
$underscore = '_';
}
if( entityhelp::option_exists( $parameter . $underscore . $id ) == true ){
delete_option( $parameter . $underscore . $id );
}
}
}
$Delete = new Delete();