This commit is contained in:
2026-07-02 15:54:39 -06:00
commit 9883323161
17470 changed files with 4470592 additions and 0 deletions
@@ -0,0 +1,29 @@
<?php
namespace Gravity_Forms\Gravity_SMTP\Enums;
use Gravity_Forms\Gravity_SMTP\Connectors\Endpoints\Save_Connector_Settings_Endpoint;
class Connector_Status_Enum {
const ENABLED = 'enabled';
const PRIMARY = 'primary';
const BACKUP = 'backup';
public static function setting_for_status( $status_type ) {
switch( $status_type ) {
case self::ENABLED:
default:
$setting = Save_Connector_Settings_Endpoint::SETTING_ENABLED_CONNECTOR;
break;
case self::PRIMARY:
$setting = Save_Connector_Settings_Endpoint::SETTING_PRIMARY_CONNECTOR;
break;
case self::BACKUP:
$setting = Save_Connector_Settings_Endpoint::SETTING_BACKUP_CONNECTOR;
}
return $setting;
}
}
@@ -0,0 +1,97 @@
<?php
namespace Gravity_Forms\Gravity_SMTP\Enums;
class Integration_Enum {
/**
* Get the title for a given service key.
*
* @param string $service
*
* @return string
*/
public static function title( $service ) {
$title = '';
switch ( $service ) {
case 'amazon-ses':
$title = 'Amazon SES';
break;
case 'brevo':
$title = 'Brevo';
break;
case 'cloudflare':
$title = 'Cloudflare';
break;
case 'generic':
$title = 'Custom SMTP';
break;
case 'elastic_email':
$title = 'Elastic Email';
break;
case 'emailit':
$title = 'Emailit';
break;
case 'google':
$title = 'Google';
break;
case 'mailchimp':
$title = 'Mailchimp';
break;
case 'mailersend':
$title = 'MailerSend';
break;
case 'mailgun':
$title = 'Mailgun';
break;
case 'mailjet':
$title = 'Mailjet';
break;
case 'mandrill':
$title = 'Mandrill';
break;
case 'microsoft':
$title = 'Microsoft';
break;
case 'outlook':
$title = 'Outlook';
break;
case 'postmark':
$title = 'Postmark';
break;
case 'resend':
$title = 'Resend';
break;
case 'sendgrid':
$title = 'SendGrid';
break;
case 'smtp2go':
$title = 'SMTP2GO';
break;
case 'sparkpost':
$title = 'Sparkpost';
break;
case 'zoho-mail':
$title = 'Zoho';
break;
case 'wp_mail':
$title = 'WordPress';
break;
}
return $title;
}
/**
* Get the svg title for the grid cell of an integration.
*
* @param string $service
*
* @return string
*/
public static function svg_title( $service ) {
/* translators: 1: the name of the integration (only used if $service does not equal 'wp_mail'). */
return $service == 'wp_mail' ? esc_html__( 'The default WordPress mailer was used to send this email', 'gravitysmtp' ) : sprintf( esc_html__( 'The %1$s integration was used to send this email', 'gravitysmtp' ), self::title( $service ) );
}
}
@@ -0,0 +1,61 @@
<?php
namespace Gravity_Forms\Gravity_SMTP\Enums;
class Status_Enum {
/**
* Get the label for a given status key.
*
* @param string $key
*
* @return string
*/
public static function label( $key ) {
$labels = self::get_labels();
if ( ! isset( $labels[ $key ] ) ) {
return $key;
}
return $labels[ $key ];
}
/**
* Get the indicator type for a given status key.
*
* @param string $key
*
* @return string
*/
public static function indicator( $key ) {
$indicators = self::get_status_map();
if ( ! isset( $indicators[ $key ] ) ) {
return 'error';
}
return $indicators[ $key ];
}
private static function get_status_map() {
return array(
'pending' => 'warning',
'sent' => 'active',
'failed' => 'error',
'sandboxed' => 'warning',
'suppressed' => 'warning',
);
}
private static function get_labels() {
return array(
'pending' => __( 'Pending', 'gravitysmtp' ),
'sent' => __( 'Sent', 'gravitysmtp' ),
'failed' => __( 'Failed', 'gravitysmtp' ),
'sandboxed' => __( 'Sandboxed', 'gravitysmtp' ),
'suppressed' => __( 'Suppressed', 'gravitysmtp' ),
);
}
}
@@ -0,0 +1,53 @@
<?php
namespace Gravity_Forms\Gravity_SMTP\Enums;
class Suppression_Reason_Enum {
/**
* Get the label for a given suppression key.
*
* @param string $key
*
* @return string
*/
public static function label( $key ) {
$labels = self::get_labels();
if ( ! isset( $labels[ $key ] ) ) {
return $key;
}
return $labels[ $key ];
}
/**
* Get the indicator type for a given suppression key.
*
* @param string $key
*
* @return string
*/
public static function indicator( $key ) {
$indicators = self::get_status_map();
if ( ! isset( $indicators[ $key ] ) ) {
return 'error';
}
return $indicators[ $key ];
}
private static function get_status_map() {
return array(
'manually_added' => 'warning',
);
}
private static function get_labels() {
return array(
'manually_added' => __( 'Manually Suppressed', 'gravitysmtp' ),
);
}
}
@@ -0,0 +1,55 @@
<?php
namespace Gravity_Forms\Gravity_SMTP\Enums;
class Zoho_Datacenters_Enum {
protected static function map() {
return array(
__( 'United States', 'gravitysmtp' ) => 'us',
__( 'Europe', 'gravitysmtp' ) => 'eu',
__( 'India', 'gravitysmtp' ) => 'in',
__( 'Australia', 'gravitysmtp' ) => 'au',
__( 'Japan', 'gravitysmtp' ) => 'jp',
__( 'Canada', 'gravitysmtp' ) => 'ca',
__( 'Saudi Arabia', 'gravitysmtp' ) => 'sa',
);
}
protected static function datacenter_to_url() {
return array(
'us' => 'https://mail.zoho.com',
'eu' => 'https://mail.zoho.uk',
'in' => 'https://mail.zoho.in',
'au' => 'https://mail.zoho.com.au',
'jp' => 'https://mail.zoho.jp',
'ca' => 'https://mail.zoho.ca',
'sa' => 'https://mail.zoho.sa',
);
}
public static function url_for_datacenter( $datacenter ) {
$map = self::datacenter_to_url();
if ( isset( $map[ $datacenter ] ) ) {
return $map[ $datacenter ];
}
return $map['us'];
}
public static function select_component_options() {
$values = self::map();
$return = array();
foreach ( $values as $label => $key ) {
$return[] = array(
'label' => $label,
'value' => $key
);
}
return $return;
}
}