99 *
1010 * @package Detain\MyAdminServers
1111 */
12- class Plugin {
12+ class Plugin
13+ {
1314 public static $ name = 'Dedicated Servers ' ;
1415 public static $ description = 'Allows selling of Dedicated Servers Module ' ;
1516 public static $ help = '' ;
1617 public static $ module = 'servers ' ;
1718 public static $ type = 'module ' ;
1819 public static $ settings = [
1920 'SERVICE_ID_OFFSET ' => 4000 ,
20- 'USE_REPEAT_INVOICE ' => TRUE ,
21- 'USE_PACKAGES ' => FALSE ,
21+ 'USE_REPEAT_INVOICE ' => true ,
22+ 'USE_PACKAGES ' => false ,
2223 'BILLING_DAYS_OFFSET ' => 0 ,
2324 'IMGNAME ' => 'stack.png ' ,
2425 'REPEAT_BILLING_METHOD ' => PRORATE_BILLING ,
@@ -36,13 +37,15 @@ class Plugin {
3637 /**
3738 * Plugin constructor.
3839 */
39- public function __construct () {
40+ public function __construct ()
41+ {
4042 }
4143
4244 /**
4345 * @return array
4446 */
45- public static function getHooks () {
47+ public static function getHooks ()
48+ {
4649 return [
4750 self ::$ module .'.activate ' => [__CLASS__ , 'getActivate ' ],
4851 self ::$ module .'.load_processing ' => [__CLASS__ , 'loadProcessing ' ],
@@ -54,7 +57,8 @@ public static function getHooks() {
5457 /**
5558 * @param \Symfony\Component\EventDispatcher\GenericEvent $event
5659 */
57- public static function getActivate (GenericEvent $ event ) {
60+ public static function getActivate (GenericEvent $ event )
61+ {
5862 $ serviceClass = $ event ->getSubject ();
5963 myadmin_log (self ::$ module , 'info ' , 'Dedicated Server Activation ' , __LINE__ , __FILE__ );
6064 $ event ->stopPropagation ();
@@ -63,22 +67,23 @@ public static function getActivate(GenericEvent $event) {
6367 /**
6468 * @param \Symfony\Component\EventDispatcher\GenericEvent $event
6569 */
66- public static function loadProcessing (GenericEvent $ event ) {
70+ public static function loadProcessing (GenericEvent $ event )
71+ {
6772 /**
6873 * @var \ServiceHandler $service
6974 */
7075 $ service = $ event ->getSubject ();
7176 $ service ->setModule (self ::$ module )
72- ->setEnable (function ($ service ) {
73- $ serviceTypes = run_event ('get_service_types ' , FALSE , self ::$ module );
77+ ->setEnable (function ($ service ) {
78+ $ serviceTypes = run_event ('get_service_types ' , false , self ::$ module );
7479 $ serviceInfo = $ service ->getServiceInfo ();
7580 $ settings = get_module_settings (self ::$ module );
7681 $ db = get_module_db (self ::$ module );
7782 $ db ->query ("update {$ settings ['TABLE ' ]} set {$ settings ['PREFIX ' ]}_status='active-billing' where {$ settings ['PREFIX ' ]}_id=' {$ serviceInfo [$ settings ['PREFIX ' ].'_id ' ]}' " , __LINE__ , __FILE__ );
7883 $ GLOBALS ['tf ' ]->history ->add (self ::$ module , 'change_status ' , 'active-billing ' , $ serviceInfo [$ settings ['PREFIX ' ].'_id ' ], $ serviceInfo [$ settings ['PREFIX ' ].'_custid ' ]);
7984 admin_email_server_pending_setup ($ serviceInfo [$ settings ['PREFIX ' ].'_id ' ]);
80- })->setReactivate (function ($ service ) {
81- $ serviceTypes = run_event ('get_service_types ' , FALSE , self ::$ module );
85+ })->setReactivate (function ($ service ) {
86+ $ serviceTypes = run_event ('get_service_types ' , false , self ::$ module );
8287 $ serviceInfo = $ service ->getServiceInfo ();
8388 $ settings = get_module_settings (self ::$ module );
8489 $ db = get_module_db (self ::$ module );
@@ -92,15 +97,16 @@ public static function loadProcessing(GenericEvent $event) {
9297 $ headers .= 'MIME-Version: 1.0 ' .PHP_EOL ;
9398 $ headers .= 'Content-type: text/html; charset=UTF-8 ' .PHP_EOL ;
9499 $ headers .= 'From: ' .TITLE .' < ' .EMAIL_FROM .'> ' .PHP_EOL ;
95- admin_mail ($ subject , $ email , $ headers , FALSE , 'admin/server_reactivated.tpl ' );
96- })->setDisable (function () {
100+ admin_mail ($ subject , $ email , $ headers , false , 'admin/server_reactivated.tpl ' );
101+ })->setDisable (function () {
97102 })->register ();
98103 }
99104
100105 /**
101106 * @param \Symfony\Component\EventDispatcher\GenericEvent $event
102107 */
103- public static function getSettings (GenericEvent $ event ) {
108+ public static function getSettings (GenericEvent $ event )
109+ {
104110 $ settings = $ event ->getSubject ();
105111 $ settings ->add_dropdown_setting (self ::$ module , 'General ' , 'outofstock_servers ' , 'Out Of Stock Servers ' , 'Enable/Disable Sales Of This Type ' , $ settings ->get_setting ('OUTOFSTOCK_SERVERS ' ), ['0 ' , '1 ' ], ['No ' , 'Yes ' ]);
106112 }
0 commit comments