Files
hub-insurance/wp-content/plugins/gravitysmtp/includes/apps/config/class-settings-config.php
T
2026-07-02 15:54:39 -06:00

630 lines
32 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
namespace Gravity_Forms\Gravity_SMTP\Apps\Config;
use Gravity_Forms\Gravity_SMTP\Gravity_SMTP;
use Gravity_Forms\Gravity_SMTP\Connectors\Connector_Service_Provider;
use Gravity_Forms\Gravity_SMTP\Connectors\Endpoints\Save_Plugin_Settings_Endpoint;
use Gravity_Forms\Gravity_SMTP\Users\Roles;
use Gravity_Forms\Gravity_SMTP\Utils\Booliesh;
use Gravity_Forms\Gravity_Tools\Config;
use Gravity_Forms\Gravity_Tools\License\License_Statuses;
use Gravity_Forms\Gravity_Tools\Updates\Updates_Service_Provider;
class Settings_Config extends Config {
protected $script_to_localize = 'gravitysmtp_scripts_admin';
protected $name = 'gravitysmtp_admin_config';
protected $overwrite = false;
public function should_enqueue() {
if ( ! is_admin() ) {
return false;
}
$page = filter_input( INPUT_GET, 'page' );
if ( ! is_string( $page ) ) {
return false;
}
$page = htmlspecialchars( $page );
if ( $page !== 'gravitysmtp-settings' ) {
return false;
}
return true;
}
public function data() {
$container = Gravity_SMTP::container();
$plugin_data_store = $container->get( Connector_Service_Provider::DATA_STORE_ROUTER );
$license_key = $plugin_data_store->get_plugin_setting( Save_Plugin_Settings_Endpoint::PARAM_LICENSE_KEY, '' );
$key_is_empty = empty( $license_key );
$is_valid = null;
if ( ! $key_is_empty ) {
$license_info = $container->get( Updates_Service_Provider::LICENSE_API_CONNECTOR )->check_license( $license_key );
$is_valid = License_Statuses::VALID_KEY === $license_info->get_status();
}
$email_log_enabled = Booliesh::get( $plugin_data_store->get_plugin_setting( Save_Plugin_Settings_Endpoint::PARAM_EVENT_LOG_ENABLED, 'true' ) );
$save_email_body_enabled = Booliesh::get( $plugin_data_store->get_plugin_setting( Save_Plugin_Settings_Endpoint::PARAM_SAVE_EMAIL_BODY_ENABLED, 'true' ) );
$save_attachments_enabled = Booliesh::get( $plugin_data_store->get_plugin_setting( Save_Plugin_Settings_Endpoint::PARAM_SAVE_ATTACHMENTS_ENABLED, 'false' ) );
$email_log_retention = $plugin_data_store->get_plugin_setting( Save_Plugin_Settings_Endpoint::PARAM_EVENT_LOG_RETENTION, 7 );
$max_records_value = $plugin_data_store->get_plugin_setting( Save_Plugin_Settings_Endpoint::PARAM_MAX_EVENT_RECORDS, 0 );
$debug_log_enabled = $plugin_data_store->get_plugin_setting( Save_Plugin_Settings_Endpoint::PARAM_DEBUG_LOG_ENABLED, 'false' );
$debug_log_enabled = ! empty( $debug_log_enabled ) ? $debug_log_enabled !== 'false' : false;
$debug_log_retention = $plugin_data_store->get_plugin_setting( Save_Plugin_Settings_Endpoint::PARAM_DEBUG_LOG_RETENTION, 7 );
$notifications_email_digest_enabled = $plugin_data_store->get_plugin_setting( Save_Plugin_Settings_Endpoint::PARAM_NOTIFICATIONS_EMAIL_DIGEST_ENABLED, 'false' );
$notifications_email_digest_enabled = ! empty( $notifications_email_digest_enabled ) ? $notifications_email_digest_enabled !== 'false' : false;
$notifications_email_digest_frequency = $plugin_data_store->get_plugin_setting( Save_Plugin_Settings_Endpoint::PARAM_NOTIFICATIONS_EMAIL_DIGEST_FREQUENCY, 7 );
$primary_locked = defined( 'GRAVITYSMTP_INTEGRATION_PRIMARY' );
$backup_locked = defined( 'GRAVITYSMTP_INTEGRATION_BACKUP' );
// @translators: %d is an integer representing the maximum number of records to store in the log.
$max_records_message = esc_html__( 'The Email Log is set to store a maximum of %d records. Any records over that limit will be deleted, starting with oldest records first.', 'gravitysmtp' );
return array(
'components' => array(
'settings' => array(
'i18n' => array(
'error_alert_title' => esc_html__( 'Error Saving', 'gravitysmtp' ),
'error_alert_generic_message' => esc_html__( 'Could not save, please check your logs.', 'gravitysmtp' ),
'error_alert_close_text' => esc_html__( 'Close', 'gravitysmtp' ),
'debug_messages' => array(
/* translators: %1$s is the body of the ajax request. */
'uninstalling_plugin' => esc_html__( 'Uninstalling plugin: %1$s', 'gravitysmtp' ),
/* translators: %1$s is the error. */
'uninstalling_plugin_error' => esc_html__( 'Error uninstalling plugin: %1$s', 'gravitysmtp' ),
),
'unsaved_changes_title' => esc_html__( 'Unsaved Changes', 'gravitysmtp' ),
'unsaved_changes_message' => esc_html__( 'You have unsaved changes. Are you sure you want to leave this page?', 'gravitysmtp' ),
'settings' =>
array(
'top_heading' => esc_html__( 'Settings', 'gravitysmtp' ),
'top_content' => '',
'license_box_heading' => esc_html__( 'License', 'gravitysmtp' ),
'license_box_content' => esc_html__( 'A valid license key is required for access to automatic plugin upgrades and product support.', 'gravitysmtp' ),
'license_box_input_label' => esc_html__( 'License Key', 'gravitysmtp' ),
'license_box_input_help_text' => esc_html__( 'Enter your license key to gain access to plugin updates.', 'gravitysmtp' ),
'license_box_input_link_text' => esc_html__( 'Already purchased?', 'gravitysmtp' ),
'license_box_button_text' => esc_html__( 'Save License', 'gravitysmtp' ),
'license_valid' => esc_html__( 'License key successfully validated!', 'gravitysmtp' ),
'license_invalid' => esc_html__( 'Invalid license key entered. Please check your license key and try again.', 'gravitysmtp' ),
'experiments_box_heading' => esc_html__( 'Experimental Features', 'gravitysmtp' ),
'experiments_box_content' => esc_html__( 'These features are works-in-progress, so you may find some bugs along the way.', 'gravitysmtp' ),
'experiments_box_toggle_label' => esc_html__( 'Alerts', 'gravitysmtp' ),
'experiments_box_toggle_help_text' => esc_html__( 'Get notified via webhook or SMS (Twilio) when emails fail to send.', 'gravitysmtp' ),
'test_mode_box_heading' => esc_html__( 'Test Mode', 'gravitysmtp' ),
/* translators: %s: opening and closing anchor tags */
'test_mode_box_content_1' => esc_html__( 'When test mode is on, your site will not send out any emails. If you turn on %semail logging%s, all emails will be stored in the Email Logs.', 'gravitysmtp' ),
'test_mode_box_toggle_help_text' => esc_html__( 'Note: Some WordPress plugins use their own email delivery system instead of the standard wp_mail() function. Test mode might not block emails sent by these plugins. Consult their documentation to learn how to enable test emails.', 'gravitysmtp' ),
'test_mode_box_toggle_label' => esc_html__( 'Enable Test Mode', 'gravitysmtp' ),
'general_settings_box_heading' => esc_html__( 'General Settings', 'gravitysmtp' ),
'uninstall_box_heading' => esc_html__( 'Uninstall', 'gravitysmtp' ),
'uninstall_box_content' => esc_html__( 'This operation deletes ALL Gravity SMTP settings. If you continue, you will NOT be able to retrieve these settings.', 'gravitysmtp' ),
'uninstall_box_button_label' => esc_html__( 'Erase ALL Gravity SMTP Data', 'gravitysmtp' ),
'uninstall_dialog_confirm_change_heading' => esc_html__( 'Confirm Delete', 'gravitysmtp' ),
'uninstall_dialog_confirm_change_content' => esc_html__( 'This operation deletes ALL Gravity SMTP settings. If you continue, you will NOT be able to retrieve these settings.', 'gravitysmtp' ),
'uninstall_dialog_confirm_change_confirm' => esc_html__( 'Delete', 'gravitysmtp' ),
'error_uninstalling_message' => esc_html__( 'There was an error uninstalling Gravity SMTP', 'gravitysmtp' ),
),
'integrations' =>
array(
'top_heading' => esc_html__( 'Integrations', 'gravitysmtp' ),
'top_content' => esc_html__( 'Manage all your email connections. Click the + icon to add an integration; you can connect one or multiple services to handle your sites emails.', 'gravitysmtp' ),
'card_more_settings' => esc_html__( 'More Settings', 'gravitysmtp' ),
'card_settings' => esc_html__( 'Settings', 'gravitysmtp' ),
'card_primary' => esc_html__( 'Primary', 'gravitysmtp' ),
'card_backup' => esc_html__( 'Backup', 'gravitysmtp' ),
'integration_settings_error' => esc_html__( 'There was an error saving your settings', 'gravitysmtp' ),
/* translators: %1$s is the integration name */
'set_primary_integration' => esc_html__( '%1$s set as primary integration', 'gravitysmtp' ),
/* translators: %1$s is the integration name */
'set_backup_integration' => esc_html__( '%1$s set as backup integration', 'gravitysmtp' ),
'primary_disabled_heading' => esc_html__( 'Primary Integration Disabled', 'gravitysmtp' ),
'primary_disabled_content' => esc_html__( 'You have disabled your primary email integration. To continue sending emails via Gravity SMTP, please enable a backup integration or set and enable a new primary integration.', 'gravitysmtp' ),
/* translators: %1$s is the integration name */
'integration_disabled' => esc_html__( '%1$s integration has been disabled', 'gravitysmtp' ),
'flyout' => array(
'screen01' => array(
'heading' => esc_html__( 'New Connection', 'gravitysmtp' ),
/* translators: {{suggest_link}} tags are replaced by opening and closing tags for a link to our suggest integration page */
'description' => __( "Select and configure the integration you would like to use to send emails from this site. Don't see an integration you're looking for? {{suggest_link}}Suggest an integration.{{suggest_link}}", 'gravitysmtp' ),
'search_placeholder' => esc_html__( 'Search integration', 'gravitysmtp' ),
'search_label' => esc_html__( 'Search integration', 'gravitysmtp' ),
),
'screen02' => array(
'back_button_label' => esc_html__( 'Back', 'gravitysmtp' ),
'save_button_label' => esc_html__( 'Save Settings', 'gravitysmtp' ),
'save_enable_button_label' => __( 'Save & Enable', 'gravitysmtp' ),
),
),
),
'emails' =>
array(
'top_heading' => esc_html__( 'Email Management', 'gravitysmtp' ),
'top_content' => __( "WordPress, by default, will send out emails for many events on your site. Using the toggles below, you can decide exactly which emails you'd like enabled.", 'gravitysmtp' ),
'email_notifications_box_heading' => esc_html__( 'Manage Emails', 'gravitysmtp' ),
),
'logging' =>
array(
'top_heading' => esc_html__( 'Logging', 'gravitysmtp' ),
'top_content' => '',
'logging_box_heading' => esc_html__( 'Email Logging', 'gravitysmtp' ),
'logging_box_content' => esc_html__( 'Email logging keeps copies of all emails sent from your WordPress site, so you can review your sent emails and check their delivery status.', 'gravitysmtp' ),
'enable_log_label' => esc_html__( 'Enable Log', 'gravitysmtp' ),
'enable_log_helper_text' => esc_html__( 'Keep copies of all emails sent from your site.', 'gravitysmtp' ),
'save_email_body_label' => esc_html__( 'Save Email Body', 'gravitysmtp' ),
'save_email_body_helper_text' => esc_html__( 'Store the email body for all emails sent from your site.', 'gravitysmtp' ),
'save_attachments_label' => esc_html__( 'Save Attachments', 'gravitysmtp' ),
'save_attachments_helper_text' => esc_html__( 'Store attachments on the server in the uploads folder.', 'gravitysmtp' ),
'email_log_retention_label' => esc_html__( 'Log Retention Period', 'gravitysmtp' ),
'email_log_retention_helper_text' => esc_html__( 'Email logs older than the selected timeframe will be permanently deleted.', 'gravitysmtp' ),
'email_log_max_records_helper_text' => sprintf( $max_records_message, $max_records_value ),
/* translators: {{docs_link}} tags are replaced by opening and closing tags for a link to our log file retention periods documentation */
'email_log_resources_alert' => __( 'Large log files can quickly consume server resources and may impact site performance, especially on shared hosting. We recommend reviewing our {{docs_link}}log file retention periods article{{docs_link}} before enabling extended logging.', 'gravitysmtp' ),
'error_saving_snackbar_message' => esc_html__( 'There was an error saving the settings', 'gravitysmtp' ),
'debug_logging_box_heading' => esc_html__( 'Debug Logging', 'gravitysmtp' ),
'enable_debug_log_label' => esc_html__( 'Enable Debug Log', 'gravitysmtp' ),
'enable_debug_log_helper_text' => esc_html__( 'When enabled email sending errors debugging events will be logged, allowing you to detect email sending issues.', 'gravitysmtp' ),
'debug_log_retention_label' => esc_html__( 'Debug Log Retention Period', 'gravitysmtp' ),
'debug_log_retention_helper_text' => esc_html__( 'Debug events older than the selected period will be permanently deleted from the database.', 'gravitysmtp' ),
/* translators: {{docs_link}} tags are replaced by opening and closing tags for a link to our log file retention periods documentation */
'debug_log_resources_alert' => __( 'Debug logging should only be enabled temporarily when troubleshooting specific issues. Continuous logging can quickly consume server resources and may impact site performance, especially on shared hosting. We recommend reviewing our {{docs_link}}log file retention periods article{{docs_link}} before enabling debug logging.', 'gravitysmtp' ),
'view_activity_log_button_text' => esc_html__( 'View Email Log', 'gravitysmtp' ),
'delete_activity_log_button_text' => esc_html__( 'Delete Email Log', 'gravitysmtp' ),
'view_debug_log_button_text' => esc_html__( 'View Debug Log', 'gravitysmtp' ),
'copy_debug_log_button_text' => esc_html__( 'Copy Debug Log Link', 'gravitysmtp' ),
'delete_debug_log_button_text' => esc_html__( 'Delete Debug Log', 'gravitysmtp' ),
'delete_debug_log_dialog_confirm_change_heading' => esc_html__( 'Confirm Delete', 'gravitysmtp' ),
'delete_email_log_dialog_confirm_change_content' => esc_html__( 'This operation deletes ALL email logs. If you continue, you will NOT be able to retrieve these logs.', 'gravitysmtp' ),
'delete_debug_log_dialog_confirm_change_content' => esc_html__( 'This operation deletes ALL debug logs. If you continue, you will NOT be able to retrieve these logs.', 'gravitysmtp' ),
'delete_debug_log_dialog_confirm_change_confirm' => esc_html__( 'Delete', 'gravitysmtp' ),
),
'notifications' =>
array(
'email_digest_box_heading' => esc_html__( 'Email Activity Digest', 'gravitysmtp' ),
'email_digest_box_enabled_label' => esc_html__( 'Email Activity Digest', 'gravitysmtp' ),
'email_digest_box_enabled_helper_text' => __( 'Get a summary of your site\'s recent email activity delivered to your inbox. Includes key metrics like send volume, failures, and top emails.', 'gravitysmtp' ),
'email_digest_box_frequency_label' => esc_html__( 'Send Digest', 'gravitysmtp' ),
'email_digest_box_frequency_helper_text' => esc_html__( 'Select how often you want the email activity digest to be sent.', 'gravitysmtp' ),
'email_digest_box_send_preview_button_text' => esc_html__( 'Send Email Preview', 'gravitysmtp' ),
'error_sending_email_digest_preview_message' => esc_html__( 'Error sending email preview.', 'gravitysmtp' ),
'success_sending_email_digest_preview_message' => esc_html__( 'Email preview successfully sent!', 'gravitysmtp' ),
),
),
'data' => array(
'license_key' => $license_key,
'license_key_is_valid' => $is_valid,
'version' => GF_GRAVITY_SMTP_VERSION,
'email_log_settings' => array(
'email_log_enabled' => $email_log_enabled,
'email_log_retention' => $email_log_retention,
'email_log_url' => admin_url( 'admin.php?page=gravitysmtp-activity-log' ),
'log_retention_period_enabled' => ! Booliesh::get( $max_records_value ),
'max_records' => $max_records_value,
'max_records_set' => Booliesh::get( $max_records_value ),
'retention_options' => $this->get_email_log_retention_options( $email_log_retention ),
'save_attachments_enabled' => $save_attachments_enabled,
'save_email_body_enabled' => $save_email_body_enabled,
),
'debug_log_settings' => array(
'debug_log_enabled' => $debug_log_enabled,
'debug_log_retention' => $debug_log_retention,
'debug_log_url' => admin_url( 'admin.php?page=gravitysmtp-tools&tab=debug-log' ),
'retention_options' => $this->get_debug_log_retention_options( $debug_log_retention ),
),
'notifications_settings' => array(
'email_digest_enabled' => $notifications_email_digest_enabled,
'email_digest_frequency' => $notifications_email_digest_frequency,
'email_digest_frequency_options' => $this->get_notifications_email_digest_frequency_options(),
),
'caps' => array(
Roles::DELETE_DEBUG_LOG => current_user_can( Roles::DELETE_DEBUG_LOG ),
Roles::DELETE_EMAIL_LOG => current_user_can( Roles::DELETE_EMAIL_LOG ),
Roles::EDIT_ALERTS => current_user_can( Roles::EDIT_ALERTS ),
Roles::EDIT_ALERTS_SLACK_SETTINGS => current_user_can( Roles::EDIT_ALERTS_SLACK_SETTINGS ),
Roles::EDIT_ALERTS_TWILIO_SETTINGS => current_user_can( Roles::EDIT_ALERTS_TWILIO_SETTINGS ),
Roles::EDIT_DEBUG_LOG_SETTINGS => current_user_can( Roles::EDIT_DEBUG_LOG_SETTINGS ),
Roles::EDIT_EMAIL_LOG_SETTINGS => current_user_can( Roles::EDIT_EMAIL_LOG_SETTINGS ),
Roles::EDIT_EMAIL_MANAGEMENT_SETTINGS => current_user_can( Roles::EDIT_EMAIL_MANAGEMENT_SETTINGS ),
Roles::EDIT_INTEGRATIONS => current_user_can( Roles::EDIT_INTEGRATIONS ),
Roles::EDIT_LICENSE_KEY => current_user_can( Roles::EDIT_LICENSE_KEY ),
Roles::EDIT_EXPERIMENTAL_FEATURES => current_user_can( Roles::EDIT_EXPERIMENTAL_FEATURES ),
Roles::EDIT_NOTIFICATIONS_SETTINGS => current_user_can( Roles::EDIT_NOTIFICATIONS_SETTINGS ),
Roles::EDIT_TEST_MODE => current_user_can( Roles::EDIT_TEST_MODE ),
Roles::EDIT_UNINSTALL => current_user_can( Roles::EDIT_UNINSTALL ),
Roles::EDIT_USAGE_ANALYTICS => current_user_can( Roles::EDIT_USAGE_ANALYTICS ),
Roles::VIEW_ALERTS => current_user_can( Roles::VIEW_ALERTS ),
Roles::VIEW_ALERTS_SLACK_SETTINGS => current_user_can( Roles::VIEW_ALERTS_SLACK_SETTINGS ),
Roles::VIEW_ALERTS_TWILIO_SETTINGS => current_user_can( Roles::VIEW_ALERTS_TWILIO_SETTINGS ),
Roles::VIEW_DEBUG_LOG => current_user_can( Roles::VIEW_DEBUG_LOG ),
Roles::VIEW_DEBUG_LOG_SETTINGS => current_user_can( Roles::VIEW_DEBUG_LOG_SETTINGS ),
Roles::VIEW_EMAIL_LOG => current_user_can( Roles::VIEW_EMAIL_LOG ),
Roles::VIEW_EMAIL_LOG_SETTINGS => current_user_can( Roles::VIEW_EMAIL_LOG_SETTINGS ),
Roles::VIEW_EMAIL_MANAGEMENT_SETTINGS => current_user_can( Roles::VIEW_EMAIL_MANAGEMENT_SETTINGS ),
Roles::VIEW_INTEGRATIONS => current_user_can( Roles::VIEW_INTEGRATIONS ),
Roles::VIEW_LICENSE_KEY => current_user_can( Roles::VIEW_LICENSE_KEY ),
Roles::VIEW_EXPERIMENTAL_FEATURES => current_user_can( Roles::VIEW_EXPERIMENTAL_FEATURES ),
Roles::VIEW_NOTIFICATIONS_SETTINGS => current_user_can( Roles::VIEW_NOTIFICATIONS_SETTINGS ),
Roles::VIEW_TEST_MODE => current_user_can( Roles::VIEW_TEST_MODE ),
Roles::VIEW_UNINSTALL => current_user_can( Roles::VIEW_UNINSTALL ),
Roles::VIEW_USAGE_ANALYTICS => current_user_can( Roles::VIEW_USAGE_ANALYTICS ),
),
'email_digest_notifications' => array(
'email_digest_summary' => array(
'checked' => true,
'name' => 'email_digest_summary',
),
'notification_day' => array(
'options' => array(
array(
'label' => esc_html__( 'Every Day', 'gravitysmtp' ),
'value' => 'daily',
),
array(
'label' => esc_html__( 'Every Week', 'gravitysmtp' ),
'value' => 'weekly',
),
array(
'label' => esc_html__( 'Every Month', 'gravitysmtp' ),
'value' => 'monthly',
),
array(
'label' => esc_html__( 'Every Year', 'gravitysmtp' ),
'value' => 'yearly',
),
),
'name' => 'notification_day',
),
'notification_email_addresses' => array(
'value' => 'olivia@gravity.com, carl@hancock.io',
'name' => 'notification_email_addresses',
),
'enable_html_mode' => array(
'checked' => true,
'name' => 'enable_html_mode',
),
),
'route_path' => admin_url( 'admin.php' ),
'plugins_url' => admin_url( 'plugins.php' ),
'nav_item_param_key' => 'tab',
'nav_items' => array(
array(
'param' => 'settings',
'label' => esc_html__( 'Settings', 'gravitysmtp' ),
'icon' => 'settings',
),
array(
'param' => 'integrations',
'label' => esc_html__( 'Integrations', 'gravitysmtp' ),
'icon' => 'cloud1',
),
array(
'param' => 'alerts',
'label' => esc_html__( 'Alerts', 'gravitysmtp' ),
'icon' => 'exclamation-triangle',
),
array(
'param' => 'emails',
'label' => esc_html__( 'Emails', 'gravitysmtp' ),
'icon' => 'mail',
),
array(
'param' => 'logging',
'label' => esc_html__( 'Logging', 'gravitysmtp' ),
'icon' => 'circle-tool',
),
array(
'param' => 'routing',
'label' => esc_html__( 'Routing', 'gravitysmtp' ),
'icon' => 'routing',
),
),
'integrations_actions' => array(
0 =>
array(
'key' => 'edit',
'props' => array(
'element' => 'button',
'iconBefore' => 'api',
'iconPrefix' => 'gravity-admin-icon',
'label' => esc_html__( 'API Settings', 'gravitysmtp' ),
),
),
1 =>
array(
'key' => 'send-a-test',
'props' => array(
'customAttributes' => array(
'href' => admin_url( 'admin.php?page=gravitysmtp-tools&tab=send-a-test' ),
'data-test-id' => 'send-a-test-action'
),
'element' => 'link',
'iconBefore' => 'paper-plane',
'iconPrefix' => 'gravity-admin-icon',
'label' => esc_html__( 'Send A Test', 'gravitysmtp' ),
),
),
2 =>
array(
'key' => 'set-as-primary',
'props' => array(
'element' => 'button',
'iconBefore' => 'primary',
'iconPrefix' => 'gravity-admin-icon',
'label' => esc_html__( 'Set As Primary', 'gravitysmtp' ),
),
),
3 =>
array(
'key' => 'set-as-backup',
'props' => array(
'element' => 'button',
'iconBefore' => 'circle-lightning-bolt',
'iconPrefix' => 'gravity-admin-icon',
'label' => esc_html__( 'Set As Backup', 'gravitysmtp' ),
),
),
4 =>
array(
'key' => 'remove',
'props' => array(
'element' => 'button',
'iconBefore' => 'trash',
'iconPrefix' => 'gravity-admin-icon',
'label' => esc_html__( 'Remove Integration', 'gravitysmtp' ),
'style' => 'error',
),
),
),
'email_notifications' => array(
array(
'title' => esc_html__( 'Change of Admin Email', 'gravitysmtp' ),
'settings' => array(
array(
'label' => esc_html__( 'Site Admin Email Change Attempt', 'gravitysmtp' ),
'checked' => true,
'name' => 'site_admin_email_change_attempt',
),
array(
'label' => esc_html__( 'Site Admin Email Changed', 'gravitysmtp' ),
'checked' => false,
'name' => 'site_admin_email_changed',
),
),
),
array(
'title' => esc_html__( 'Change of User Email or Password', 'gravitysmtp' ),
'settings' => array(
array(
'label' => esc_html__( 'Reset Password Request', 'gravitysmtp' ),
'checked' => false,
'name' => 'reset_password_request',
),
array(
'label' => esc_html__( 'Password Reset Successfully', 'gravitysmtp' ),
'checked' => false,
'name' => 'password_reset_successfully',
),
array(
'label' => esc_html__( 'Password Changed', 'gravitysmtp' ),
'checked' => false,
'name' => 'password_changed',
),
array(
'label' => esc_html__( 'Email Change Attempt', 'gravitysmtp' ),
'checked' => false,
'name' => 'email_change_attempt',
),
array(
'label' => esc_html__( 'Email Changed', 'gravitysmtp' ),
'checked' => true,
'name' => 'email_changed',
),
),
),
array(
'title' => esc_html__( 'Personal Data Requests', 'gravitysmtp' ),
'settings' => array(
array(
'label' => esc_html__( 'User Confirmed Export / Erasure Request', 'gravitysmtp' ),
'checked' => true,
'name' => 'user_confirmed_export_erasure_request',
),
array(
'label' => esc_html__( 'Admin Erased Data', 'gravitysmtp' ),
'checked' => true,
'name' => 'admin_erased_data',
),
array(
'label' => esc_html__( 'Admin Sent Link to Export Data', 'gravitysmtp' ),
'checked' => false,
'name' => 'admin_sent_link_to_export_data',
),
),
),
array(
'title' => esc_html__( 'Automatic Updates', 'gravitysmtp' ),
'settings' => array(
array(
'label' => esc_html__( 'Plugin Status', 'gravitysmtp' ),
'checked' => true,
'name' => 'plugin_status',
),
array(
'label' => esc_html__( 'Theme Status', 'gravitysmtp' ),
'checked' => true,
'name' => 'theme_status',
),
array(
'label' => esc_html__( 'WP Core Status', 'gravitysmtp' ),
'checked' => true,
'name' => 'wp_core_status',
),
array(
'label' => esc_html__( 'Full Log', 'gravitysmtp' ),
'checked' => false,
'name' => 'full_log',
),
),
),
array(
'title' => esc_html__( 'New User', 'gravitysmtp' ),
'settings' => array(
array(
'label' => esc_html__( 'Created (Admin)', 'gravitysmtp' ),
'checked' => false,
'name' => 'created_admin',
),
array(
'label' => esc_html__( 'Created (User)', 'gravitysmtp' ),
'checked' => false,
'name' => 'created_user',
),
),
),
array(
'title' => esc_html__( 'Comments', 'gravitysmtp' ),
'settings' => array(
array(
'label' => esc_html__( 'Awaiting Moderation', 'gravitysmtp' ),
'checked' => false,
'name' => 'awaiting_moderation',
),
array(
'label' => esc_html__( 'Published', 'gravitysmtp' ),
'checked' => false,
'name' => 'published',
),
),
),
array(
'title' => esc_html__( 'WooCommerce', 'gravitysmtp' ),
'settings' => array(
array(
'label' => esc_html__( 'Purchase Receipt', 'gravitysmtp' ),
'checked' => true,
'name' => 'purchase_receipt',
),
array(
'label' => esc_html__( 'Password Change', 'gravitysmtp' ),
'checked' => true,
'name' => 'password_change',
),
),
),
),
'primary_locked' => $primary_locked,
'backup_locked' => $backup_locked,
),
'endpoints' => array(),
),
)
);
}
public function get_email_log_retention_options( $retention ) {
$options = array(
array(
'label' => esc_html__( '1 Day', 'gravitysmtp' ),
'value' => 1,
),
array(
'label' => esc_html__( '1 Week', 'gravitysmtp' ),
'value' => 7,
),
array(
'label' => esc_html__( '1 Month', 'gravitysmtp' ),
'value' => 30,
),
array(
'label' => esc_html__( '3 Months', 'gravitysmtp' ),
'value' => 90,
),
array(
'label' => esc_html__( '6 Months', 'gravitysmtp' ),
'value' => 180,
),
array(
'label' => esc_html__( '1 Year', 'gravitysmtp' ),
'value' => 365,
),
array(
'label' => esc_html__( 'Never Delete', 'gravitysmtp' ),
'value' => 0,
),
);
$values = array_column( $options, 'value' );
if ( in_array( $retention, $values ) ) {
return apply_filters( 'gravitysmtp_email_log_retention_options', $options );
}
return apply_filters(
'gravitysmtp_email_log_retention_options',
array(
array(
'label' => esc_html( sprintf( _n( '%s Day', '%s Days', $retention, 'gravitysmtp' ), $retention ) ),
'value' => $retention,
),
)
);
}
public function get_debug_log_retention_options( $retention ) {
$options = array(
array(
'label' => esc_html__( '1 Week', 'gravitysmtp' ),
'value' => 7,
),
array(
'label' => esc_html__( '1 Month', 'gravitysmtp' ),
'value' => 30,
),
);
$values = array_column( $options, 'value' );
if ( in_array( $retention, $values ) ) {
return apply_filters( 'gravitysmtp_debug_log_retention_options', $options );
}
return apply_filters(
'gravitysmtp_debug_log_retention_options',
array(
array(
'label' => esc_html( sprintf( _n( '%s Day', '%s Days', $retention, 'gravitysmtp' ), $retention ) ),
'value' => $retention,
),
)
);
}
public function get_notifications_email_digest_frequency_options() {
$options = array(
array(
'label' => esc_html__( 'Daily', 'gravitysmtp' ),
'value' => 1,
),
array(
'label' => esc_html__( 'Weekly (recommended)', 'gravitysmtp' ),
'value' => 7,
),
array(
'label' => esc_html__( 'Monthly', 'gravitysmtp' ),
'value' => 30,
),
);
return apply_filters( 'gravitysmtp_notifications_email_digest_frequency_options', $options );
}
}