public static function performCheck($website, $sendOnline = false, &$emailOutput = null)
 {
     $result = MainWPUtility::isWebsiteAvailable($website);
     if (!$result || isset($result['error']) && $result['error'] != '' || $result['httpCode'] != '200') {
         MainWPDB::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 = MainWPDB::Instance()->getUserNotificationEmail($website->userid);
             wp_mail($email, 'Down Time Alert - MainWP', MainWPUtility::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 {
         MainWPDB::Instance()->updateWebsiteValues($website->id, array('offline_check_result' => '1', 'offline_checks_last' => time()));
         $userExtension = MainWPDB::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 = MainWPDB::Instance()->getUserNotificationEmail($website->userid);
                 wp_mail($email, 'Up Time Alert - MainWP', MainWPUtility::formatEmail($email, $body), array('From: "' . get_option('admin_email') . '" <' . get_option('admin_email') . '>', 'content-type: text/html'));
             } else {
                 $emailOutput .= ($emailOutput != '' ? '<br />' : '') . $body;
             }
         }
         return true;
     }
 }