Version 4.6.0
This commit is contained in:
1 parent
f79dcf067a
commit
517a5e1f70
2036 files changed
+110041
-26162
No files matched your search
+46
-44
@@ -89,6 +89,10 @@ abstract class _Email
|
||||
{
|
||||
return 'IPS\Email\Outgoing\Smtp';
|
||||
}
|
||||
elseif ( \IPS\CIC2 )
|
||||
{
|
||||
return 'IPS\Cicloud\Email';
|
||||
}
|
||||
elseif ( \IPS\CIC )
|
||||
{
|
||||
return 'IPS\Email\Outgoing\IpsCic';
|
||||
@@ -142,15 +146,27 @@ abstract class _Email
|
||||
* @param string $subject Subject
|
||||
* @param string $htmlContent HTML Version
|
||||
* @param string|NULL $plaintextContent Plaintext version. If not provided, one will be built automatically based off $htmlContent.
|
||||
* @param string $type See TYPE_* constants. While it defaults to "transactional", this is to maintain backwards compatibility and a type should always be specified.
|
||||
* @param string $type See TYPE_* constants.
|
||||
* @param bool $useWrapper If TRUE, the email will be wrapped in the default wrapper template
|
||||
* @param string $emailKey Key used to identify the email, used for tracking purposes
|
||||
* @param bool $trackingEnabled TRUE by default, pass FALSE to explicitly disable log/view tracking. Useful with mergeAndSend()'s default behavior of rebuilding an already built email
|
||||
* @return \IPS\Email
|
||||
* @deprecated Not specifying an argument for $type is deprecated
|
||||
*/
|
||||
public static function buildFromContent( $subject, $htmlContent='', $plaintextContent=NULL, $type = 'transactional', $useWrapper=TRUE, $emailKey=NULL, $trackingEnabled=TRUE )
|
||||
public static function buildFromContent( $subject, $htmlContent='', $plaintextContent=NULL, $type = NULL, $useWrapper=TRUE, $emailKey=NULL, $trackingEnabled=TRUE )
|
||||
{
|
||||
if( !$type )
|
||||
{
|
||||
if( \IPS\IN_DEV )
|
||||
{
|
||||
trigger_error( "The email type must be specified when calling buildFromContent()", E_USER_ERROR );
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$type = static::TYPE_TRANSACTIONAL;
|
||||
}
|
||||
}
|
||||
|
||||
$email = static::factory( $type );
|
||||
$email->type = $type;
|
||||
$email->subject = $subject;
|
||||
@@ -188,13 +204,25 @@ abstract class _Email
|
||||
* @param string $app Application key
|
||||
* @param string $key Email template key
|
||||
* @param array $parameters Parameters for the template
|
||||
* @param string $type See TYPE_* constants. While it defaults to "transactional", this is to maintain backwards compatibility and a type should always be specified.
|
||||
* @param string $type See TYPE_* constants.
|
||||
* @param bool $useWrapper If TRUE, the email will be wrapped in the default wrapper template
|
||||
* @return \IPS\Email
|
||||
* @deprecated Not specifying an argument for $type is deprecated
|
||||
*/
|
||||
public static function buildFromTemplate( $app, $key, $parameters=array(), $type = 'transactional', $useWrapper=TRUE )
|
||||
public static function buildFromTemplate( $app, $key, $parameters=array(), $type = NULL, $useWrapper=TRUE )
|
||||
{
|
||||
if( !$type )
|
||||
{
|
||||
if( \IPS\IN_DEV )
|
||||
{
|
||||
trigger_error( "The email type must be specified when calling buildFromTemplate()", E_USER_ERROR );
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$type = static::TYPE_TRANSACTIONAL;
|
||||
}
|
||||
}
|
||||
|
||||
$email = static::factory( $type );
|
||||
$email->type = $type;
|
||||
$email->templateApp = $app;
|
||||
@@ -532,8 +560,8 @@ abstract class _Email
|
||||
$return .= $eol;
|
||||
|
||||
$return .= $this->_compileMessage( static::_getMemberFromRecipients( $to ), $boundary, $eol, $lineLimit );
|
||||
|
||||
return $return;
|
||||
|
||||
return str_replace( "\n", $eol, str_replace( [ "\r\n", "\r" ], "\n", $return ) );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -549,7 +577,7 @@ abstract class _Email
|
||||
* @param string $boundary The boundary that will be used between parts
|
||||
* @return string
|
||||
*/
|
||||
public function _compileHeaders( $subject, $to, $cc=array(), $bcc=array(), $fromEmail, $fromName = NULL, $additionalHeaders = array(), $boundary )
|
||||
public function _compileHeaders( $subject, $to, $cc=array(), $bcc=array(), $fromEmail = NULL, $fromName = NULL, $additionalHeaders = array(), $boundary = '' )
|
||||
{
|
||||
/* Work out From details */
|
||||
$fromEmail = $fromEmail ?: \IPS\Settings::i()->email_out;
|
||||
@@ -609,14 +637,14 @@ abstract class _Email
|
||||
/**
|
||||
* Build the email message
|
||||
*
|
||||
* @param \IPS\Member $member If the email is going to a member, the member object. Ensures correct language is used.
|
||||
* @param string $boundary The boundary used in the Content-Type header
|
||||
* @param string $eol EOL character to use
|
||||
* @param int|NULL $lineLimit Maximum line length
|
||||
* @param \IPS\Member|NULL $member If the email is going to a member, the member object. Ensures correct language is used.
|
||||
* @param string $boundary The boundary used in the Content-Type header
|
||||
* @param string $eol EOL character to use
|
||||
* @param int|NULL $lineLimit Maximum line length
|
||||
* @return bool
|
||||
* @throws \IPS\Email\Outgoing\Exception
|
||||
*/
|
||||
protected function _compileMessage( \IPS\Member $member = NULL, $boundary, $eol, $lineLimit = 998 )
|
||||
protected function _compileMessage( ?\IPS\Member $member, $boundary, $eol, $lineLimit = 998 )
|
||||
{
|
||||
$return = '';
|
||||
|
||||
@@ -684,6 +712,7 @@ abstract class _Email
|
||||
|
||||
/* Sent successfully, remove notification */
|
||||
\IPS\core\AdminNotification::remove( 'core', 'ConfigurationError', 'failedMail' );
|
||||
\IPS\Db::i()->update( 'core_mail_error_logs', array( 'mlog_notification_sent' => TRUE ) );
|
||||
|
||||
/* Update the ad impression count if appropriate */
|
||||
if( $updateAds === TRUE )
|
||||
@@ -798,7 +827,7 @@ abstract class _Email
|
||||
* @param \IPS\Lang $language The language the email content should be in
|
||||
* @return int Number of successful sends
|
||||
*/
|
||||
public function mergeAndSend( $recipients, $fromEmail = NULL, $fromName = NULL, $additionalHeaders = array(), \IPS\Lang $language )
|
||||
public function mergeAndSend( $recipients, $fromEmail = NULL, $fromName = NULL, $additionalHeaders = array(), \IPS\Lang $language = NULL )
|
||||
{
|
||||
$return = 0;
|
||||
|
||||
@@ -1451,7 +1480,8 @@ abstract class _Email
|
||||
*/
|
||||
protected static function _parseElementForEmailImage( \DOMElement &$node, \DOMNode $parent, \IPS\Lang $language )
|
||||
{
|
||||
$maxImageDims = \IPS\Settings::i()->attachment_image_size ? explode( 'x', \IPS\Settings::i()->attachment_image_size ) : array( 1000, 750 );
|
||||
/* In this case, set max size to default of 1000x750 if display setting is 'unlimited' */
|
||||
$maxImageDims = \IPS\Settings::i()->attachment_image_size !== '0x0' ? explode( 'x', \IPS\Settings::i()->attachment_image_size ) : array( 1000, 750 );
|
||||
|
||||
/* Set the max image height and width */
|
||||
$node->setAttribute( 'style', "max-width:{$maxImageDims[0]}px;max-height:{$maxImageDims[1]}px;" . $node->getAttribute('style') ) ;
|
||||
@@ -1549,34 +1579,6 @@ abstract class _Email
|
||||
|
||||
return $cell;
|
||||
}
|
||||
|
||||
/* !Deprecated */
|
||||
|
||||
/**
|
||||
* Build an unsubscribe link
|
||||
*
|
||||
* @deprecated Use setUnsubscribe() instead
|
||||
* @param string $type Type of unsubscribe link to automatically build. Valid values are 'bulk' and 'notification'.
|
||||
* @param string|\IPS\Member $data Data necessary for unsubscribe link. For 'bulk' type this is a member object. For 'notification' type this is the notification key.
|
||||
* @return \IPS\Email
|
||||
*/
|
||||
public function buildUnsubscribe( $type, $data )
|
||||
{
|
||||
switch ( $type )
|
||||
{
|
||||
case 'bulk':
|
||||
$this->setUnsubscribe( 'core', 'unsubscribeBulk', array() );
|
||||
break;
|
||||
case 'notification':
|
||||
$this->setUnsubscribe( 'core', 'unsubscribeNotification', array( $data ) );
|
||||
break;
|
||||
case 'follow':
|
||||
$this->setUnsubscribe( 'core', 'unsubscribeFollow', array( $data ) );
|
||||
break;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Store database counts
|
||||
|
||||
Reference in new issue
Block a user