|
11 | 11 | */ |
12 | 12 | class Plugin |
13 | 13 | { |
14 | | - public static $name = 'SSL Certificates'; |
15 | | - public static $description = 'Allows selling of SSL Certificates Module'; |
16 | | - public static $help = ''; |
17 | | - public static $module = 'ssl'; |
18 | | - public static $type = 'module'; |
19 | | - public static $settings = [ |
20 | | - 'SERVICE_ID_OFFSET' => 3000, |
21 | | - 'USE_REPEAT_INVOICE' => false, |
22 | | - 'USE_PACKAGES' => true, |
23 | | - 'BILLING_DAYS_OFFSET' => 0, |
24 | | - 'IMGNAME' => 'security-ssl.png', |
25 | | - 'REPEAT_BILLING_METHOD' => PRORATE_BILLING, |
26 | | - 'DELETE_PENDING_DAYS' => 45, |
27 | | - 'SUSPEND_DAYS' => 14, |
28 | | - 'SUSPEND_WARNING_DAYS' => 7, |
29 | | - 'TITLE' => 'SSL Certificates', |
30 | | - 'MENUNAME' => 'SSL', |
31 | | - 'EMAIL_FROM' => 'support@inssl.net', |
32 | | - 'TBLNAME' => 'SSL', |
33 | | - 'TABLE' => 'ssl_certs', |
34 | | - 'TITLE_FIELD' => 'ssl_hostname', |
35 | | - 'PREFIX' => 'ssl']; |
| 14 | + public static $name = 'SSL Certificates'; |
| 15 | + public static $description = 'Allows selling of SSL Certificates Module'; |
| 16 | + public static $help = ''; |
| 17 | + public static $module = 'ssl'; |
| 18 | + public static $type = 'module'; |
| 19 | + public static $settings = [ |
| 20 | + 'SERVICE_ID_OFFSET' => 3000, |
| 21 | + 'USE_REPEAT_INVOICE' => false, |
| 22 | + 'USE_PACKAGES' => true, |
| 23 | + 'BILLING_DAYS_OFFSET' => 0, |
| 24 | + 'IMGNAME' => 'security-ssl.png', |
| 25 | + 'REPEAT_BILLING_METHOD' => PRORATE_BILLING, |
| 26 | + 'DELETE_PENDING_DAYS' => 45, |
| 27 | + 'SUSPEND_DAYS' => 14, |
| 28 | + 'SUSPEND_WARNING_DAYS' => 7, |
| 29 | + 'TITLE' => 'SSL Certificates', |
| 30 | + 'MENUNAME' => 'SSL', |
| 31 | + 'EMAIL_FROM' => 'support@inssl.net', |
| 32 | + 'TBLNAME' => 'SSL', |
| 33 | + 'TABLE' => 'ssl_certs', |
| 34 | + 'TITLE_FIELD' => 'ssl_hostname', |
| 35 | + 'PREFIX' => 'ssl']; |
36 | 36 |
|
37 | | - /** |
38 | | - * Plugin constructor. |
39 | | - */ |
40 | | - public function __construct() |
41 | | - { |
42 | | - } |
| 37 | + /** |
| 38 | + * Plugin constructor. |
| 39 | + */ |
| 40 | + public function __construct() |
| 41 | + { |
| 42 | + } |
43 | 43 |
|
44 | | - /** |
45 | | - * @return array |
46 | | - */ |
47 | | - public static function getHooks() |
48 | | - { |
49 | | - return [ |
50 | | - self::$module.'.load_processing' => [__CLASS__, 'loadProcessing'], |
51 | | - self::$module.'.settings' => [__CLASS__, 'getSettings'] |
52 | | - ]; |
53 | | - } |
| 44 | + /** |
| 45 | + * @return array |
| 46 | + */ |
| 47 | + public static function getHooks() |
| 48 | + { |
| 49 | + return [ |
| 50 | + self::$module.'.load_processing' => [__CLASS__, 'loadProcessing'], |
| 51 | + self::$module.'.settings' => [__CLASS__, 'getSettings'] |
| 52 | + ]; |
| 53 | + } |
54 | 54 |
|
55 | | - /** |
56 | | - * @param \Symfony\Component\EventDispatcher\GenericEvent $event |
57 | | - */ |
58 | | - public static function loadProcessing(GenericEvent $event) |
59 | | - { |
60 | | - /** |
61 | | - * @var \ServiceHandler $service |
62 | | - */ |
63 | | - $service = $event->getSubject(); |
64 | | - $service->setModule(self::$module) |
65 | | - ->setActivationStatuses(['pending', 'pendapproval', 'active']) |
66 | | - ->setEnable(function ($service) { |
67 | | - $serviceTypes = run_event('get_service_types', false, self::$module); |
68 | | - $serviceInfo = $service->getServiceInfo(); |
69 | | - $settings = get_module_settings(self::$module); |
70 | | - $db = get_module_db(self::$module); |
71 | | - $db->query("update {$settings['TABLE']} set {$settings['PREFIX']}_status='active' where {$settings['PREFIX']}_id='{$serviceInfo[$settings['PREFIX'].'_id']}'", __LINE__, __FILE__); |
72 | | - $GLOBALS['tf']->history->add($settings['TABLE'], 'change_status', 'active', $serviceInfo[$settings['PREFIX'].'_id'], $serviceInfo[$settings['PREFIX'].'_custid']); |
73 | | - $smarty = new \TFSmarty; |
74 | | - $smarty->assign('ssl_hostname', $serviceInfo[$settings['PREFIX'].'_hostname']); |
75 | | - $smarty->assign('ssl_name', $serviceTypes[$serviceInfo[$settings['PREFIX'].'_type']]['services_name']); |
76 | | - $email = $smarty->fetch('email/admin/ssl_created.tpl'); |
77 | | - $subject = 'New SSL Certificate Created '.$serviceInfo[$settings['TITLE_FIELD']]; |
78 | | - (new \MyAdmin\Mail())->adminMail($subject, $email, false, 'admin/ssl_created.tpl'); |
79 | | - })->setReactivate(function ($service) { |
80 | | - $serviceTypes = run_event('get_service_types', false, self::$module); |
81 | | - $serviceInfo = $service->getServiceInfo(); |
82 | | - $settings = get_module_settings(self::$module); |
83 | | - $db = get_module_db(self::$module); |
84 | | - $db->query("update {$settings['TABLE']} set {$settings['PREFIX']}_status='active' where {$settings['PREFIX']}_id='{$serviceInfo[$settings['PREFIX'].'_id']}'", __LINE__, __FILE__); |
85 | | - $GLOBALS['tf']->history->add($settings['TABLE'], 'change_status', 'active', $serviceInfo[$settings['PREFIX'].'_id'], $serviceInfo[$settings['PREFIX'].'_custid']); |
86 | | - $smarty = new \TFSmarty; |
87 | | - $smarty->assign('ssl_hostname', $serviceInfo[$settings['PREFIX'].'_hostname']); |
88 | | - $smarty->assign('ssl_name', $serviceTypes[$serviceInfo[$settings['PREFIX'].'_type']]['services_name']); |
89 | | - $email = $smarty->fetch('email/admin/ssl_reactivated.tpl'); |
90 | | - $subject = $serviceInfo[$settings['TITLE_FIELD']].' '.$serviceTypes[$serviceInfo[$settings['PREFIX'].'_type']]['services_name'].' '.$settings['TBLNAME'].' Reactivated'; |
91 | | - (new \MyAdmin\Mail())->adminMail($subject, $email, false, 'admin/ssl_reactivated.tpl'); |
92 | | - })->setDisable(function () { |
93 | | - })->register(); |
94 | | - } |
| 55 | + /** |
| 56 | + * @param \Symfony\Component\EventDispatcher\GenericEvent $event |
| 57 | + */ |
| 58 | + public static function loadProcessing(GenericEvent $event) |
| 59 | + { |
| 60 | + /** |
| 61 | + * @var \ServiceHandler $service |
| 62 | + */ |
| 63 | + $service = $event->getSubject(); |
| 64 | + $service->setModule(self::$module) |
| 65 | + ->setActivationStatuses(['pending', 'pendapproval', 'active']) |
| 66 | + ->setEnable(function ($service) { |
| 67 | + $serviceTypes = run_event('get_service_types', false, self::$module); |
| 68 | + $serviceInfo = $service->getServiceInfo(); |
| 69 | + $settings = get_module_settings(self::$module); |
| 70 | + $db = get_module_db(self::$module); |
| 71 | + $db->query("update {$settings['TABLE']} set {$settings['PREFIX']}_status='active' where {$settings['PREFIX']}_id='{$serviceInfo[$settings['PREFIX'].'_id']}'", __LINE__, __FILE__); |
| 72 | + $GLOBALS['tf']->history->add($settings['TABLE'], 'change_status', 'active', $serviceInfo[$settings['PREFIX'].'_id'], $serviceInfo[$settings['PREFIX'].'_custid']); |
| 73 | + $smarty = new \TFSmarty(); |
| 74 | + $smarty->assign('ssl_hostname', $serviceInfo[$settings['PREFIX'].'_hostname']); |
| 75 | + $smarty->assign('ssl_name', $serviceTypes[$serviceInfo[$settings['PREFIX'].'_type']]['services_name']); |
| 76 | + $email = $smarty->fetch('email/admin/ssl_created.tpl'); |
| 77 | + $subject = 'New SSL Certificate Created '.$serviceInfo[$settings['TITLE_FIELD']]; |
| 78 | + (new \MyAdmin\Mail())->adminMail($subject, $email, false, 'admin/ssl_created.tpl'); |
| 79 | + })->setReactivate(function ($service) { |
| 80 | + $serviceTypes = run_event('get_service_types', false, self::$module); |
| 81 | + $serviceInfo = $service->getServiceInfo(); |
| 82 | + $settings = get_module_settings(self::$module); |
| 83 | + $db = get_module_db(self::$module); |
| 84 | + $db->query("update {$settings['TABLE']} set {$settings['PREFIX']}_status='active' where {$settings['PREFIX']}_id='{$serviceInfo[$settings['PREFIX'].'_id']}'", __LINE__, __FILE__); |
| 85 | + $GLOBALS['tf']->history->add($settings['TABLE'], 'change_status', 'active', $serviceInfo[$settings['PREFIX'].'_id'], $serviceInfo[$settings['PREFIX'].'_custid']); |
| 86 | + $smarty = new \TFSmarty(); |
| 87 | + $smarty->assign('ssl_hostname', $serviceInfo[$settings['PREFIX'].'_hostname']); |
| 88 | + $smarty->assign('ssl_name', $serviceTypes[$serviceInfo[$settings['PREFIX'].'_type']]['services_name']); |
| 89 | + $email = $smarty->fetch('email/admin/ssl_reactivated.tpl'); |
| 90 | + $subject = $serviceInfo[$settings['TITLE_FIELD']].' '.$serviceTypes[$serviceInfo[$settings['PREFIX'].'_type']]['services_name'].' '.$settings['TBLNAME'].' Reactivated'; |
| 91 | + (new \MyAdmin\Mail())->adminMail($subject, $email, false, 'admin/ssl_reactivated.tpl'); |
| 92 | + })->setDisable(function () { |
| 93 | + })->register(); |
| 94 | + } |
95 | 95 |
|
96 | | - /** |
97 | | - * @param \Symfony\Component\EventDispatcher\GenericEvent $event |
98 | | - */ |
99 | | - public static function getSettings(GenericEvent $event) |
100 | | - { |
101 | | - /** |
102 | | - * @var \MyAdmin\Settings $settings |
103 | | - **/ |
104 | | - $settings = $event->getSubject(); |
105 | | - $settings->add_dropdown_setting(self::$module, _('General'), 'outofstock_ssl', _('Out Of Stock Ssl'), _('Enable/Disable Sales Of This Type'), $settings->get_setting('OUTOFSTOCK_SSL'), ['0', '1'], ['No', 'Yes']); |
106 | | - } |
| 96 | + /** |
| 97 | + * @param \Symfony\Component\EventDispatcher\GenericEvent $event |
| 98 | + */ |
| 99 | + public static function getSettings(GenericEvent $event) |
| 100 | + { |
| 101 | + /** |
| 102 | + * @var \MyAdmin\Settings $settings |
| 103 | + **/ |
| 104 | + $settings = $event->getSubject(); |
| 105 | + $settings->add_dropdown_setting(self::$module, _('General'), 'outofstock_ssl', _('Out Of Stock Ssl'), _('Enable/Disable Sales Of This Type'), $settings->get_setting('OUTOFSTOCK_SSL'), ['0', '1'], ['No', 'Yes']); |
| 106 | + } |
107 | 107 | } |
0 commit comments