Version 5.0.0 release
This commit is contained in:
1 parent
90e8c7e903
commit
a3a4a9ccbd
651 files changed
+7275
-9481
No files matched your search
@@ -13,6 +13,7 @@ namespace IPS\Email\Outgoing;
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
|
||||
use IPS\core\Advertisement;
|
||||
use IPS\core\extensions\core\CommunityEnhancements\SendGrid as SendGridIntegration;
|
||||
use IPS\Db;
|
||||
use IPS\Email;
|
||||
use IPS\Http\Request\Exception;
|
||||
@@ -131,6 +132,27 @@ class SendGrid extends Email
|
||||
throw new Exception( $response['errors'][0]['message'] );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this email class usable?
|
||||
*
|
||||
* @param string $type Email Type
|
||||
* @return bool
|
||||
*/
|
||||
public static function isUsable( string $type ): bool
|
||||
{
|
||||
if( ( new SendGridIntegration() )->enabled )
|
||||
{
|
||||
return match( true )
|
||||
{
|
||||
( $type == Email::TYPE_TRANSACTIONAL OR $type == Email::TYPE_LIST ) AND Settings::i()->sendgrid_use_for == 2 => true,
|
||||
$type == Email::TYPE_BULK AND (int) Settings::i()->sendgrid_use_for > 0 => true,
|
||||
default => false
|
||||
};
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge and Send
|
||||
@@ -251,8 +273,8 @@ class SendGrid extends Email
|
||||
),
|
||||
'tracking_settings' => array(
|
||||
'click_tracking' => array(
|
||||
'enable' => (bool) Settings::i()->sendgrid_click_tracking,
|
||||
'enable_text' => (bool) Settings::i()->sendgrid_click_tracking,
|
||||
'enable' => false,
|
||||
'enable_text' => false,
|
||||
),
|
||||
'open_tracking' => array(
|
||||
'enable' => (bool) Settings::i()->sendgrid_click_tracking,
|
||||
@@ -372,5 +394,25 @@ class SendGrid extends Email
|
||||
{
|
||||
return $this->_api( 'scopes' );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Parse/Save email form settings
|
||||
*
|
||||
* @param array $values settings array
|
||||
* @return array
|
||||
*/
|
||||
public function saveSettings( array $values ): array
|
||||
{
|
||||
if ( isset( $values['mail_method'] ) and $values['mail_method'] != 'sendgrid' and Settings::i()->sendgrid_use_for == 2 )
|
||||
{
|
||||
$values['sendgrid_use_for'] = 1;
|
||||
}
|
||||
elseif ( isset( $values['mail_method'] ) and $values['mail_method'] == 'sendgrid' )
|
||||
{
|
||||
$values['sendgrid_use_for'] = 2;
|
||||
}
|
||||
|
||||
return $values;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user