本文整理汇总了PHP中AEPlatform::get_administrator_emails方法的典型用法代码示例。如果您正苦于以下问题:PHP AEPlatform::get_administrator_emails方法的具体用法?PHP AEPlatform::get_administrator_emails怎么用?PHP AEPlatform::get_administrator_emails使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AEPlatform
的用法示例。
在下文中一共展示了AEPlatform::get_administrator_emails方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mail_administrators
/**
* Sends an email to the administrators
* @return bool
*/
private function mail_administrators()
{
$this->setStep('Processing emails to administrators');
$this->setSubstep('');
// Skip email for back-end backups
if(AEPlatform::get_backup_origin() == 'backend' ) return true;
$must_email = AEPlatform::get_platform_configuration_option('frontend_email_on_finish', 0) != 0;
if(!$must_email) return true;
AEUtilLogger::WriteLog(_AE_LOG_DEBUG, "Preparing to send e-mail to administrators");
$email = AEPlatform::get_platform_configuration_option('frontend_email_address', '');
$email = trim($email);
if( !empty($email) )
{
$emails = array($email);
}
else
{
$emails = AEPlatform::get_administrator_emails();
}
if(!empty($emails))
{
// Fetch user's preferences
$subject = trim(AEPlatform::get_platform_configuration_option('frontend_email_subject',''));
$body = trim(AEPlatform::get_platform_configuration_option('frontend_email_body',''));
// Get the statistics
$statistics =& AEFactory::getStatistics();
$stat = $statistics->getRecord();
$parts = AEUtilStatistics::get_all_filenames($stat, false);
$profile_number = AEPlatform::get_active_profile();
$profile_name = AEPlatform::get_profile_name($profile_number);
$parts = AEUtilStatistics::get_all_filenames($stat, false);
$stat = (object)$stat;
$num_parts = $stat->multipart;
if($num_parts == 0) $num_parts = 1; // Non-split archives have a part count of 0
$parts_list = '';
if(!empty($parts)) foreach($parts as $file) {
$parts_list .= "\t".basename($file)."\n";
}
// Do we need a default subject?
if(empty($subject)) {
// Get the default subject
$subject = AEPlatform::translate('EMAIL_SUBJECT_OK');
} else {
// Post-process the subject
$subject = AEUtilFilesystem::replace_archive_name_variables($subject);
}
// Do we need a default body?
if(empty($body)) {
$body = AEPlatform::translate('EMAIL_BODY_OK');
$info_source = AEPlatform::translate('EMAIL_BODY_INFO');
$body .= "\n\n" . sprintf($info_source, $profile_number, $num_parts) . "\n\n";
$body .= $parts_list;
} else {
// Post-process the body
$body = AEUtilFilesystem::replace_archive_name_variables($body);
$body = str_replace('[PROFILENUMBER]', $profile_number, $body);
$body = str_replace('[PROFILENAME]', $profile_name, $body);
$body = str_replace('[PARTCOUNT]', $num_parts, $body);
$body = str_replace('[FILELIST]', $parts_list, $body);
}
// Sometimes $body contains literal \n instead of newlines
$body = str_replace('\\n',"\n", $body);
foreach($emails as $email)
{
AEUtilLogger::WriteLog(_AE_LOG_DEBUG, "Sending email to $email");
AEPlatform::send_email($email, $subject, $body);
}
}
return true;
}