-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuninstall.php
executable file
·34 lines (29 loc) · 1.06 KB
/
uninstall.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
<?php
/**
* Uninstall Lkn_Antispam_For_GiveWP.
*
* @copyright Copyright (c) 2016, GiveWP
* @license https://opensource.org/licenses/gpl-license GNU Public License
*
* @since 1.0
*/
// Exit if accessed directly.
if ( ! defined('WP_UNINSTALL_PLUGIN')) {
exit;
}
// Pega um array contendo todas as configurações
$lkn_array_antispam_options = give_get_settings();
// Procura pelo array pelas chaves correspondentes as configurações do plugin
// E salva o nome delas
$lkn_array_antispam_options = array_filter($lkn_array_antispam_options, function ($key) {
return strpos($key, 'lkn_antispam_') === 0;
}, \ARRAY_FILTER_USE_KEY);
$lkn_array_antispam_options = array_keys($lkn_array_antispam_options);
// Verifica se as chaves existem
if (count($lkn_array_antispam_options) > 0) {
// Caso existam varre o array selecionando cada opção
for ($c = 0; $c < count($lkn_array_antispam_options); ++$c) {
// utiliza o valor, que é o nome da chave, para deletar a opção do give
give_delete_option($lkn_array_antispam_options[$c]);
}
}