本文整理汇总了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;
}
}