本文整理匯總了PHP中wfConfig::getAlertLevel方法的典型用法代碼示例。如果您正苦於以下問題:PHP wfConfig::getAlertLevel方法的具體用法?PHP wfConfig::getAlertLevel怎麽用?PHP wfConfig::getAlertLevel使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類wfConfig
的用法示例。
在下文中一共展示了wfConfig::getAlertLevel方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: emailNewIssues
public function emailNewIssues()
{
$level = wfConfig::getAlertLevel();
$emails = wfConfig::getAlertEmails();
$shortSiteURL = preg_replace('/^https?:\\/\\//i', '', site_url());
$subject = "[Wordfence Alert] Problems found on {$shortSiteURL}";
if (sizeof($emails) < 1) {
return;
}
if ($level < 1) {
return;
}
if ($level == 2 && $this->totalCriticalIssues < 1 && $this->totalWarningIssues < 1) {
return;
}
if ($level == 1 && $this->totalCriticalIssues < 1) {
return;
}
$emailedIssues = wfConfig::get_ser('emailedIssuesList', array());
if (!is_array($emailedIssues)) {
$emailedIssues = array();
}
$finalIssues = array();
foreach ($this->newIssues as $newIssue) {
$alreadyEmailed = false;
foreach ($emailedIssues as $emailedIssue) {
if ($newIssue['ignoreP'] == $emailedIssue['ignoreP'] || $newIssue['ignoreC'] == $emailedIssue['ignoreC']) {
$alreadyEmailed = true;
break;
}
}
if (!$alreadyEmailed) {
$finalIssues[] = $newIssue;
}
}
if (sizeof($finalIssues) < 1) {
return;
}
$totalWarningIssues = 0;
$totalCriticalIssues = 0;
foreach ($finalIssues as $i) {
$emailedIssues[] = array('ignoreC' => $i['ignoreC'], 'ignoreP' => $i['ignoreP']);
if ($i['severity'] == 1) {
$totalCriticalIssues++;
} else {
if ($i['severity'] == 2) {
$totalWarningIssues++;
}
}
}
wfConfig::set_ser('emailedIssuesList', $emailedIssues);
if ($level == 2 && $totalCriticalIssues < 1 && $totalWarningIssues < 1) {
return;
}
if ($level == 1 && $totalCriticalIssues < 1) {
return;
}
$content = wfUtils::tmpl('email_newIssues.php', array('isPaid' => wfConfig::get('isPaid'), 'issues' => $finalIssues, 'totalCriticalIssues' => $totalCriticalIssues, 'totalWarningIssues' => $totalWarningIssues, 'level' => $level));
wp_mail(implode(',', $emails), $subject, $content, 'Content-type: text/html');
}
示例2: emailNewIssues
public function emailNewIssues()
{
$level = wfConfig::getAlertLevel();
$emails = wfConfig::getAlertEmails();
$subject = "[Wordfence Alert] Problems found on " . get_bloginfo('name', 'raw');
if (sizeof($emails) < 1) {
return;
}
if ($level < 1) {
return;
}
if ($level == 2 && $this->totalCriticalIssues < 1 && $this->totalWarningIssues < 1) {
return;
}
if ($level == 1 && $this->totalCriticalIssues < 1) {
return;
}
$emailedIssues = wfConfig::get_ser('emailedIssuesList', array());
if (!is_array($emailedIssues)) {
$emailedIssues = array();
}
$finalIssues = array();
foreach ($this->newIssues as $newIssue) {
$alreadyEmailed = false;
foreach ($emailedIssues as $emailedIssue) {
if ($newIssue['ignoreP'] == $emailedIssue['ignoreP'] || $newIssue['ignoreC'] == $emailedIssue['ignoreC']) {
$alreadyEmailed = true;
break;
}
}
if (!$alreadyEmailed) {
$finalIssues[] = $newIssue;
}
}
if (sizeof($finalIssues) < 1) {
return;
}
$totalWarningIssues = 0;
$totalCriticalIssues = 0;
foreach ($finalIssues as $i) {
$emailedIssues[] = array('ignoreC' => $i['ignoreC'], 'ignoreP' => $i['ignoreP']);
if ($i['severity'] == 1) {
$totalCriticalIssues++;
} else {
if ($i['severity'] == 2) {
$totalWarningIssues++;
}
}
}
wfConfig::set_ser('emailedIssuesList', $emailedIssues);
if ($level == 2 && $totalCriticalIssues < 1 && $totalWarningIssues < 1) {
return;
}
if ($level == 1 && $totalCriticalIssues < 1) {
return;
}
$content = wfUtils::tmpl('email_newIssues.php', array('issues' => $finalIssues, 'totalCriticalIssues' => $totalCriticalIssues, 'totalWarningIssues' => $totalWarningIssues, 'level' => $level));
wp_mail(implode(',', $emails), $subject, $content);
}
示例3: emailNewIssues
public function emailNewIssues()
{
$level = wfConfig::getAlertLevel();
$emails = wfConfig::getAlertEmails();
$shortSiteURL = preg_replace('/^https?:\\/\\//i', '', site_url());
$subject = "[Wordfence Alert] Problems found on {$shortSiteURL}";
if (sizeof($emails) < 1) {
return;
}
if ($level < 1) {
return;
}
if ($level == 2 && $this->totalCriticalIssues < 1 && $this->totalWarningIssues < 1) {
return;
}
if ($level == 1 && $this->totalCriticalIssues < 1) {
return;
}
$emailedIssues = wfConfig::get_ser('emailedIssuesList', array());
if (!is_array($emailedIssues)) {
$emailedIssues = array();
}
$finalIssues = array();
foreach ($this->newIssues as $newIssue) {
$alreadyEmailed = false;
foreach ($emailedIssues as $emailedIssue) {
if ($newIssue['ignoreP'] == $emailedIssue['ignoreP'] || $newIssue['ignoreC'] == $emailedIssue['ignoreC']) {
$alreadyEmailed = true;
break;
}
}
if (!$alreadyEmailed) {
$finalIssues[] = $newIssue;
}
}
if (sizeof($finalIssues) < 1) {
return;
}
$totalWarningIssues = 0;
$totalCriticalIssues = 0;
foreach ($finalIssues as $i) {
$emailedIssues[] = array('ignoreC' => $i['ignoreC'], 'ignoreP' => $i['ignoreP']);
if ($i['severity'] == 1) {
$totalCriticalIssues++;
} else {
if ($i['severity'] == 2) {
$totalWarningIssues++;
}
}
}
wfConfig::set_ser('emailedIssuesList', $emailedIssues);
if ($level == 2 && $totalCriticalIssues < 1 && $totalWarningIssues < 1) {
return;
}
if ($level == 1 && $totalCriticalIssues < 1) {
return;
}
$content = wfUtils::tmpl('email_newIssues.php', array('isPaid' => wfConfig::get('isPaid'), 'issues' => $finalIssues, 'totalCriticalIssues' => $totalCriticalIssues, 'totalWarningIssues' => $totalWarningIssues, 'level' => $level));
require_once ABSPATH . WPINC . '/class-phpmailer.php';
require_once ABSPATH . WPINC . '/class-smtp.php';
$mail = new PHPMailer();
// Get the site domain and get rid of www.
$from_email = 'wordpress@' . preg_replace('/^(https?:\\/\\/(www.)?)(.+?)(\\/)?$/', '$3', site_url());
$mail->From = apply_filters('wp_mail_from', $from_email);
$mail->FromName = apply_filters('wp_mail_from_name', 'Wordfence');
foreach ($emails as $email) {
try {
$mail->addAddress($email);
} catch (phpmailerException $e) {
}
}
$mail->Subject = $subject;
$mail->msgHTML($content);
try {
$mail->send();
} catch (phpmailerException $e) {
// use wp_mail if there's a problem (which uses PHPMailer anyways :P)
wp_mail(implode(',', $emails), $subject, strip_tags($content));
}
}