get_row("SELECT COUNT(*) AS count FROM {$table} WHERE type = 'email'")->count; if ($addEmail) { $rows = array_merge($rows, NotificationsStrings::getAppointmentCustomerNonTimeBasedEmailNotifications()); $rows = array_merge($rows, NotificationsStrings::getAppointmentCustomerTimeBasedEmailNotifications()); $rows = array_merge($rows, NotificationsStrings::getAppointmentProviderNonTimeBasedEmailNotifications()); $rows = array_merge($rows, NotificationsStrings::getAppointmentProviderTimeBasedEmailNotifications()); } $addSMS = !(int)$wpdb->get_row("SELECT COUNT(*) AS count FROM {$table} WHERE type = 'sms'")->count; if ($addSMS) { $rows = array_merge($rows, NotificationsStrings::getAppointmentCustomerNonTimeBasedSMSNotifications()); $rows = array_merge($rows, NotificationsStrings::getAppointmentCustomerTimeBasedSMSNotifications()); $rows = array_merge($rows, NotificationsStrings::getAppointmentProviderNonTimeBasedSMSNotifications()); $rows = array_merge($rows, NotificationsStrings::getAppointmentProviderTimeBasedSMSNotifications()); } $addEvent = !(int)$wpdb->get_row("SELECT COUNT(*) AS count FROM {$table} WHERE entity = 'event'")->count; if ($addEvent) { $rows = array_merge($rows, NotificationsStrings::getEventCustomerNonTimeBasedEmailNotifications()); $rows = array_merge($rows, NotificationsStrings::getEventCustomerTimeBasedEmailNotifications()); $rows = array_merge($rows, NotificationsStrings::getEventProviderNonTimeBasedEmailNotifications()); $rows = array_merge($rows, NotificationsStrings::getEventProviderTimeBasedEmailNotifications()); $rows = array_merge($rows, NotificationsStrings::getEventCustomerNonTimeBasedSMSNotifications()); $rows = array_merge($rows, NotificationsStrings::getEventCustomerTimeBasedSMSNotifications()); $rows = array_merge($rows, NotificationsStrings::getEventProviderNonTimeBasedSMSNotifications()); $rows = array_merge($rows, NotificationsStrings::getEventProviderTimeBasedSMSNotifications()); } $result = []; foreach ($rows as $row) { $result[] = "INSERT INTO {$table} ( `name`, `type`, `time`, `timeBefore`, `timeAfter`, `sendTo`, `subject`, `content`, `entity` ) VALUES ( '{$row['name']}', '{$row['type']}', {$row['time']}, {$row['timeBefore']}, {$row['timeAfter']}, '{$row['sendTo']}', '{$row['subject']}', '{$row['content']}', '{$row['entity']}' )"; } return $result; } }