-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
boot.php
39 lines (33 loc) · 1.23 KB
/
boot.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
<?php
if (rex::isBackend() && is_object(rex::getUser())) {
rex_perm::register('d2u_guestbook[]', rex_i18n::msg('d2u_guestbook_rights'));
rex_perm::register('d2u_guestbook[settings]', rex_i18n::msg('d2u_guestbook_rights_settings'), rex_perm::OPTIONS);
}
if (rex::isBackend()) {
rex_extension::register('CLANG_DELETED', 'rex_d2u_guestbook_clang_deleted');
}
/**
* Deletes language specific configurations and objects.
* @param rex_extension_point<array<string>> $ep Redaxo extension point
* @return array<string> Warning message as array
*/
function rex_d2u_guestbook_clang_deleted(rex_extension_point $ep)
{
$warning = $ep->getSubject();
$params = $ep->getParams();
$clang_id = $params['id'];
// Delete
$entries = FriendsOfRedaxo\D2UGuestbook\Entry::getAll(false);
foreach ($entries as $entry) {
if ($entry->clang_id === $clang_id) {
$entry->delete();
}
}
// Delete language settings
if (rex_config::has('d2u_guestbook', 'lang_replacement_'. $clang_id)) {
rex_config::remove('d2u_guestbook', 'lang_replacement_'. $clang_id);
}
// Delete language replacements
FriendsOfRedaxo\D2UGuestbook\LangHelper::factory()->uninstall($clang_id);
return $warning;
}