-
Notifications
You must be signed in to change notification settings - Fork 2
/
Hook.php
executable file
·53 lines (48 loc) · 1.35 KB
/
Hook.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
<?php
namespace Acms\Plugins\GoogleCalendar;
use ACMS_POST_Form_Submit;
class Hook
{
/**
* POSTモジュール処理前
* $thisModuleのプロパティを参照・操作するなど
*
* @param \ACMS_POST $thisModule
*/
public function afterPostFire($thisModule)
{
// Hook処理動作条件
if (!($thisModule instanceof ACMS_POST_Form_Submit)) {
return;
}
$id = $thisModule->Post->get('id');
if (!$id) {
return;
}
$info = $thisModule->loadForm($id);
if (empty($info)) {
return;
}
if ($info['data']->getChild('mail')->get('calendar_void') !== 'on') {
return;
};
if (!$thisModule->Post->isValidAll()) {
return;
}
$step = $thisModule->Post->get('error');
if (empty($step)) {
$step = $thisModule->Get->get('step');
}
$step = $thisModule->Post->get('step', $step);
if (in_array($step, ['forbidden', 'repeated'])) {
return;
}
$formCode = $thisModule->Post->get('id');
try {
$engine = new Engine($formCode, $thisModule);
$engine->send();
} catch (\Exception $e) {
userErrorLog('ACMS Warning: Google Calendar plugin, ' . $e->getMessage());
}
}
}