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


PHP MainWP_Utility::isWebsiteAvailable方法代码示例

本文整理汇总了PHP中MainWP_Utility::isWebsiteAvailable方法的典型用法代码示例。如果您正苦于以下问题:PHP MainWP_Utility::isWebsiteAvailable方法的具体用法?PHP MainWP_Utility::isWebsiteAvailable怎么用?PHP MainWP_Utility::isWebsiteAvailable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MainWP_Utility的用法示例。


在下文中一共展示了MainWP_Utility::isWebsiteAvailable方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: performCheck

 public static function performCheck($website, $sendOnline = false, &$emailOutput = null)
 {
     $result = MainWP_Utility::isWebsiteAvailable($website);
     if (!$result || isset($result['error']) && $result['error'] != '' || $result['httpCode'] != '200') {
         MainWP_DB::Instance()->updateWebsiteValues($website->id, array('offline_check_result' => '-1', 'offline_checks_last' => time()));
         $body = 'We\'ve had some issues trying to reach your website <a href="' . $website->url . '">' . stripslashes($website->name) . '</a>. ' . (isset($result['error']) && $result['error'] != '' ? ' Error message: ' . $result['error'] . '.' : 'Received HTTP-code: ' . $result['httpCode'] . ($result['httpCodeString'] != '' ? ' (' . $result['httpCodeString'] . ').' : ''));
         if ($emailOutput === null) {
             $email = MainWP_DB::Instance()->getUserNotificationEmail($website->userid);
             wp_mail($email, 'Down Time Alert - MainWP', MainWP_Utility::formatEmail($email, $body . '<br /><br />Please take a look at the <a href="' . $website->url . '">website</a> and make sure everything is ok.'), array('From: "' . get_option('admin_email') . '" <' . get_option('admin_email') . '>', 'content-type: text/html'));
         } else {
             $emailOutput .= ($emailOutput != '' ? '<br />' : '') . $body;
         }
         return false;
     } else {
         MainWP_DB::Instance()->updateWebsiteValues($website->id, array('offline_check_result' => '1', 'offline_checks_last' => time()));
         $userExtension = MainWP_DB::Instance()->getUserExtensionByUserId($website->userid);
         if ($sendOnline || $userExtension->offlineChecksOnlineNotification == 1) {
             $body = 'Your website <a href="' . $website->url . '">' . stripslashes($website->name) . '</a> is up and responding as expected!';
             //if set in config!
             if ($emailOutput === null) {
                 $email = MainWP_DB::Instance()->getUserNotificationEmail($website->userid);
                 wp_mail($email, 'Up Time Alert - MainWP', MainWP_Utility::formatEmail($email, $body), array('From: "' . get_option('admin_email') . '" <' . get_option('admin_email') . '>', 'content-type: text/html'));
             } else {
                 $emailOutput .= ($emailOutput != '' ? '<br />' : '') . $body;
             }
         }
         return true;
     }
 }
开发者ID:jexmex,项目名称:mainwp,代码行数:29,代码来源:page-mainwp-offline-checks.php


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