本文整理汇总了PHP中MainWP_Utility::formatEmail方法的典型用法代码示例。如果您正苦于以下问题:PHP MainWP_Utility::formatEmail方法的具体用法?PHP MainWP_Utility::formatEmail怎么用?PHP MainWP_Utility::formatEmail使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MainWP_Utility
的用法示例。
在下文中一共展示了MainWP_Utility::formatEmail方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mainwp_cronupdatescheck_action
//.........这里部分代码省略.........
MainWP_Utility::update_option('mainwp_updatescheck_mail_update_core_new', '');
MainWP_Utility::update_option('mainwp_updatescheck_mail_update_plugins_new', '');
MainWP_Utility::update_option('mainwp_updatescheck_mail_update_themes_new', '');
MainWP_Utility::update_option('mainwp_updatescheck_mail_update_core', '');
MainWP_Utility::update_option('mainwp_updatescheck_mail_update_plugins', '');
MainWP_Utility::update_option('mainwp_updatescheck_mail_update_themes', '');
MainWP_Utility::update_option('mainwp_updatescheck_mail_ignore_core', '');
MainWP_Utility::update_option('mainwp_updatescheck_mail_ignore_plugins', '');
MainWP_Utility::update_option('mainwp_updatescheck_mail_ignore_themes', '');
MainWP_Utility::update_option('mainwp_updatescheck_mail_ignore_core_new', '');
MainWP_Utility::update_option('mainwp_updatescheck_mail_ignore_plugins_new', '');
MainWP_Utility::update_option('mainwp_updatescheck_mail_ignore_themes_new', '');
MainWP_Utility::update_option('mainwp_updatescheck_mail_pluginconflicts', '');
MainWP_Utility::update_option('mainwp_updatescheck_mail_themeconflicts', '');
MainWP_Utility::update_option('mainwp_updatescheck_last', date('d/m/Y'));
if (!$sendMail) {
MainWP_Logger::Instance()->debug('CRON :: updates check :: sendMail is false');
return;
}
if ($mainwpAutomaticDailyUpdate !== false && $mainwpAutomaticDailyUpdate != 0) {
//Create a nice email to send
$email = get_option('mainwp_updatescheck_mail_email');
MainWP_Logger::Instance()->debug('CRON :: updates check :: send mail to ' . $email);
if ($email != false && $email != '') {
$mail = '<div>We noticed the following updates are available on your MainWP Dashboard. (<a href="' . site_url() . '">' . site_url() . '</a>)</div>
<div></div>
' . $mail . '
Update Key: (<strong><span style="color:#008000">Trusted</span></strong>) will be auto updated within 24 hours. (<strong><span style="color:#ff0000">Not Trusted</span></strong>) you will need to log into your Main Dashboard and update
<div> </div>
<div>If your MainWP is configured to use Auto Updates these upgrades will be installed in the next 24 hours. To find out how to enable automatic updates please see the FAQs below.</div>
<div><a href="http://docs.mainwp.com/marking-a-plugin-as-trusted/" style="color:#446200" target="_blank">http://docs.mainwp.com/marking-a-plugin-as-trusted/</a></div>
<div><a href="http://docs.mainwp.com/marking-a-theme-as-trusted/" style="color:#446200" target="_blank">http://docs.mainwp.com/marking-a-theme-as-trusted/</a></div>
<div><a href="http://docs.mainwp.com/marking-a-sites-wp-core-updates-as-trusted/" style="color:#446200" target="_blank">http://docs.mainwp.com/marking-a-sites-wp-core-updates-as-trusted/</a></div>';
wp_mail($email, 'MainWP - Trusted Updates', MainWP_Utility::formatEmail($email, $mail), array('From: "' . get_option('admin_email') . '" <' . get_option('admin_email') . '>', 'content-type: text/html'));
}
}
}
} else {
$userExtension = MainWP_DB::Instance()->getUserExtensionByUserId($userid);
$decodedIgnoredPlugins = json_decode($userExtension->ignored_plugins, true);
if (!is_array($decodedIgnoredPlugins)) {
$decodedIgnoredPlugins = array();
}
$trustedPlugins = json_decode($userExtension->trusted_plugins, true);
if (!is_array($trustedPlugins)) {
$trustedPlugins = array();
}
$decodedIgnoredThemes = json_decode($userExtension->ignored_themes, true);
if (!is_array($decodedIgnoredThemes)) {
$decodedIgnoredThemes = array();
}
$trustedThemes = json_decode($userExtension->trusted_themes, true);
if (!is_array($trustedThemes)) {
$trustedThemes = array();
}
$coreToUpdateNow = array();
$coreToUpdate = array();
$coreNewUpdate = array();
$ignoredCoreToUpdate = array();
$ignoredCoreNewUpdate = array();
$pluginsToUpdateNow = array();
$pluginsToUpdate = array();
$pluginsNewUpdate = array();
$ignoredPluginsToUpdate = array();
$ignoredPluginsNewUpdate = array();
$themesToUpdateNow = array();
示例2: 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;
}
}
示例3: executeBackupTask
public static function executeBackupTask($task, $nrOfSites = 0, $updateRun = true)
{
if ($updateRun) {
MainWP_DB::Instance()->updateBackupRun($task->id);
}
$task = MainWP_DB::Instance()->getBackupTaskById($task->id);
$completed_sites = $task->completed_sites;
if ($completed_sites != '') {
$completed_sites = json_decode($completed_sites, true);
}
if (!is_array($completed_sites)) {
$completed_sites = array();
}
$sites = array();
if ($task->groups == '') {
if ($task->sites != '') {
$sites = explode(',', $task->sites);
}
} else {
$groups = explode(',', $task->groups);
foreach ($groups as $groupid) {
$group_sites = MainWP_DB::Instance()->getWebsitesByGroupId($groupid);
foreach ($group_sites as $group_site) {
if (in_array($group_site->id, $sites)) {
continue;
}
$sites[] = $group_site->id;
}
}
}
$errorOutput = null;
$lastStartNotification = $task->lastStartNotificationSent;
if ($updateRun && get_option('mainwp_notificationOnBackupStart') == 1 && $lastStartNotification < $task->last_run) {
$email = MainWP_DB::Instance()->getUserNotificationEmail($task->userid);
if ($email != '') {
$output = 'A scheduled backup has started with MainWP on ' . MainWP_Utility::formatTimestamp(MainWP_Utility::getTimestamp(time())) . ' for the following ' . count($sites) . ' sites:<br />';
foreach ($sites as $siteid) {
$website = MainWP_DB::Instance()->getWebsiteById($siteid);
$output .= ' • <a href="' . $website->url . '">' . MainWP_Utility::getNiceURL($website->url) . '</a><br />';
}
$output .= '<br />Backup Details:<br /><br />';
$output .= '<strong>Backup Task</strong>' . ' - ' . $task->name . '<br />';
$output .= '<strong>Backup Type</strong>' . ' - ' . ($task->type == 'db' ? 'DATABASE BACKUP' : 'FULL BACKUP') . '<br />';
$output .= '<strong>Backup Schedule</strong>' . ' - ' . strtoupper($task->schedule) . '<br />';
wp_mail($email, 'A Scheduled Backup has been Started - MainWP', MainWP_Utility::formatEmail($email, $output), 'content-type: text/html');
MainWP_DB::Instance()->updateBackupTaskWithValues($task->id, array('lastStartNotificationSent' => time()));
}
}
$currentCount = 0;
foreach ($sites as $siteid) {
if (isset($completed_sites[$siteid]) && $completed_sites[$siteid] == true) {
continue;
}
$website = MainWP_DB::Instance()->getWebsiteById($siteid);
try {
$subfolder = str_replace('%task%', MainWP_Utility::sanitize($task->name), $task->subfolder);
$backupResult = MainWP_Manage_Sites::backupSite($siteid, $task, $subfolder);
//When we receive a timeout, we return false..
if ($backupResult === false) {
continue;
}
if ($errorOutput == null) {
$errorOutput = '';
}
$error = false;
$tmpErrorOutput = '';
if (isset($backupResult['error'])) {
$tmpErrorOutput .= $backupResult['error'] . '<br />';
$error = true;
}
if (isset($backupResult['ftp']) && $backupResult['ftp'] != 'success') {
$tmpErrorOutput .= 'FTP: ' . $backupResult['ftp'] . '<br />';
$error = true;
}
if (isset($backupResult['dropbox']) && $backupResult['dropbox'] != 'success') {
$tmpErrorOutput .= 'Dropbox: ' . $backupResult['dropbox'] . '<br />';
$error = true;
}
if (isset($backupResult['amazon']) && $backupResult['amazon'] != 'success') {
$tmpErrorOutput .= 'Amazon: ' . $backupResult['amazon'] . '<br />';
$error = true;
}
if ($error) {
$errorOutput .= 'Site: <strong>' . MainWP_Utility::getNiceURL($website->url) . '</strong><br />';
$errorOutput .= $tmpErrorOutput . '<br />';
}
} catch (Exception $e) {
if ($errorOutput == null) {
$errorOutput = '';
}
$errorOutput .= 'Site: <strong>' . MainWP_Utility::getNiceURL($website->url) . '</strong><br />';
$errorOutput .= MainWP_Error_Helper::getErrorMessage($e) . '<br />';
$_error_output = MainWP_Error_Helper::getErrorMessage($e);
}
$_backup_result = isset($backupResult) ? $backupResult : (isset($_error_output) ? $_error_output : '');
do_action('mainwp_managesite_schedule_backup', $website, array('type' => $task->type), $_backup_result);
$currentCount++;
$task = MainWP_DB::Instance()->getBackupTaskById($task->id);
$completed_sites = $task->completed_sites;
if ($completed_sites != '') {
//.........这里部分代码省略.........