当前位置: 首页>>代码示例>>PHP>>正文


PHP wfConfig::getAlertLevel方法代码示例

本文整理汇总了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');
 }
开发者ID:ashenkar,项目名称:sanga,代码行数:60,代码来源:wfIssues.php

示例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);
 }
开发者ID:Alpha7Sg,项目名称:wordpress-custom,代码行数:59,代码来源:wfIssues.php

示例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));
     }
 }
开发者ID:adams0917,项目名称:woocommerce_eht,代码行数:80,代码来源:wfIssues.php


注:本文中的wfConfig::getAlertLevel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。