本文整理汇总了PHP中MainWP_Utility::formatTimestamp方法的典型用法代码示例。如果您正苦于以下问题:PHP MainWP_Utility::formatTimestamp方法的具体用法?PHP MainWP_Utility::formatTimestamp怎么用?PHP MainWP_Utility::formatTimestamp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MainWP_Utility
的用法示例。
在下文中一共展示了MainWP_Utility::formatTimestamp方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: column_details
function column_details($item)
{
$output = '<strong>' . __('LAST RUN MANUALLY: ', 'mainwp') . '</strong>' . ($item->last_run_manually == 0 ? '-' : MainWP_Utility::formatTimestamp(MainWP_Utility::getTimestamp($item->last_run_manually))) . '<br />';
$output .= '<strong>' . __('LAST RUN: ', 'mainwp') . '</strong>' . ($item->last_run == 0 ? '-' : MainWP_Utility::formatTimestamp(MainWP_Utility::getTimestamp($item->last_run))) . '<br />';
$output .= '<strong>' . __('LAST COMPLETED: ', 'mainwp') . '</strong>' . ($item->completed == 0 ? '-' : MainWP_Utility::formatTimestamp(MainWP_Utility::getTimestamp($item->completed))) . '<br />';
$output .= '<strong>' . __('NEXT RUN: ', 'mainwp') . '</strong>' . ($item->last_run == 0 ? __('Any minute', 'mainwp') : MainWP_Utility::formatTimestamp(($item->schedule == 'daily' ? 60 * 60 * 24 : ($item->schedule == 'weekly' ? 60 * 60 * 24 * 7 : 60 * 60 * 24 * 30)) + MainWP_Utility::getTimestamp($item->last_run)));
$output .= '<strong>';
if ($item->last_run != 0 && $item->completed < $item->last_run) {
$output .= __('<br />CURRENTLY RUNNING: ', 'mainwp') . '</strong>';
$completed_sites = $item->completed_sites;
if ($completed_sites != '') {
$completed_sites = json_decode($completed_sites, 1);
}
if (!is_array($completed_sites)) {
$completed_sites = array();
}
$output .= count($completed_sites) . ' / ' . count($item->the_sites);
}
return $output;
}
示例2: PostsSearch_handler
public static function PostsSearch_handler($data, $website, &$output)
{
if (preg_match('/<mainwp>(.*)<\\/mainwp>/', $data, $results) > 0) {
$posts = unserialize(base64_decode($results[1]));
unset($results);
foreach ($posts as $post) {
if (isset($post['dts'])) {
if (!stristr($post['dts'], '-')) {
$post['dts'] = MainWP_Utility::formatTimestamp(MainWP_Utility::getTimestamp($post['dts']));
}
}
if (!isset($post['title']) || $post['title'] == '') {
$post['title'] = '(No Title)';
}
ob_start();
?>
<tr id="post-1"
class="post-1 post type-post status-publish format-standard hentry category-uncategorized alternate iedit author-self"
valign="top">
<th scope="row" class="check-column"><input type="checkbox" name="post[]" value="1"></th>
<td class="post-title page-title column-title">
<input class="postId" type="hidden" name="id" value="<?php
echo $post['id'];
?>
"/>
<input class="allowedBulkActions" type="hidden" name="allowedBulkActions" value="|trash|delete|<?php
if ($post['status'] == 'publish') {
echo 'unpublish|';
}
if ($post['status'] == 'pending') {
echo 'approve|';
}
if ($post['status'] == 'trash') {
echo 'restore|';
}
if ($post['status'] == 'future' || $post['status'] == 'draft') {
echo 'publish|';
}
?>
"/>
<input class="websiteId" type="hidden" name="id" value="<?php
echo $website->id;
?>
"/>
<strong>
<abbr title="<?php
echo $post['title'];
?>
">
<?php
if ($post['status'] != 'trash') {
?>
<a class="row-title"
href="admin.php?page=SiteOpen&websiteid=<?php
echo $website->id;
?>
&location=<?php
echo base64_encode('post.php?post=' . $post['id'] . '&action=edit');
?>
"
title="Edit '<?php
echo $post['title'];
?>
'"><?php
echo $post['title'];
?>
</a>
<?php
} else {
?>
<?php
echo $post['title'];
?>
<?php
}
?>
</abbr>
</strong>
<div class="row-actions">
<?php
if ($post['status'] != 'trash') {
?>
<span class="edit"><a
href="admin.php?page=SiteOpen&websiteid=<?php
echo $website->id;
?>
&location=<?php
echo base64_encode('post.php?post=' . $post['id'] . '&action=edit');
?>
"
title="Edit this item"><?php
_e('Edit', 'mainwp');
?>
</a></span>
<span class="trash">
| <a class="post_submitdelete" title="Move this item to the Trash" href="#"><?php
_e('Trash', 'mainwp');
?>
//.........这里部分代码省略.........
示例3: showBackups
public static function showBackups(&$website, $fullBackups, $dbBackups)
{
$output = '';
echo '<table>';
$mwpDir = MainWP_Utility::getMainWPDir();
$mwpDir = $mwpDir[0];
foreach ($fullBackups as $key => $fullBackup) {
$downloadLink = admin_url('?sig=' . md5(filesize($fullBackup)) . '&mwpdl=' . rawurlencode(str_replace($mwpDir, '', $fullBackup)));
$output .= '<tr><td style="width: 400px;">' . MainWP_Utility::formatTimestamp(MainWP_Utility::getTimestamp(filemtime($fullBackup))) . ' - ' . MainWP_Utility::human_filesize(filesize($fullBackup));
$output .= '</td><td><a title="' . basename($fullBackup) . '" href="' . $downloadLink . '" class="button">Download</a></td>';
$output .= '<td><a href="admin.php?page=SiteRestore&websiteid=' . $website->id . '&f=' . base64_encode($downloadLink) . '&size=' . filesize($fullBackup) . '" class="mainwp-upgrade-button button" target="_blank" title="' . basename($fullBackup) . '">Restore</a></td></tr>';
}
if ($output == '') {
echo '<br />' . __('No full backup has been taken yet', 'mainwp') . '<br />';
} else {
echo '<strong style="font-size: 14px">' . __('Last backups from your files:', 'mainwp') . '</strong>' . $output;
}
echo '</table><br/><table>';
$output = '';
foreach ($dbBackups as $key => $dbBackup) {
$downloadLink = admin_url('?sig=' . md5(filesize($dbBackup)) . '&mwpdl=' . rawurlencode(str_replace($mwpDir, '', $dbBackup)));
$output .= '<tr><td style="width: 400px;">' . MainWP_Utility::formatTimestamp(MainWP_Utility::getTimestamp(filemtime($dbBackup))) . ' - ' . MainWP_Utility::human_filesize(filesize($dbBackup)) . '</td><td><a title="' . basename($dbBackup) . '" href="' . $downloadLink . '" download class="button">Download</a></td></tr>';
}
if ($output == '') {
echo '<br />' . __('No database only backup has been taken yet', 'mainwp') . '<br /><br />';
} else {
echo '<strong style="font-size: 14px">' . __('Last backups from your database:', 'mainwp') . '</strong>' . $output;
}
echo '</table>';
}
示例4: column_last_post
function column_last_post($item)
{
$output = '';
if ($item['last_post_gmt'] != 0) {
$output .= MainWP_Utility::formatTimestamp(MainWP_Utility::getTimestamp($item['last_post_gmt'])) . '<br />';
}
$output .= sprintf('<a href="admin.php?page=PostBulkAdd&select=%s">' . '<i class="fa fa-plus"></i> ' . __('Add New', 'mainwp') . '</a>', $item['id']);
return $output;
}
示例5: renderCron
public static function renderCron()
{
self::renderHeader('ServerInformationCron');
$schedules = array('Backups' => 'mainwp_cron_last_backups', 'Backups continue' => 'mainwp_cron_last_backups_continue', 'Updates check' => 'mainwp_cron_last_updatescheck', 'Stats' => 'mainwp_cron_last_stats', 'Ping childs' => 'mainwp_cron_last_ping', 'Offline checks' => 'mainwp_cron_last_offlinecheck', 'Conflicts update' => 'mainwp_cron_last_cronconflicts');
?>
<table id="mainwp-table" class="wp-list-table widefat" cellspacing="0">
<thead>
<tr>
<th scope="col" class="manage-column sorted" style=""><span><?php
_e('Schedule', 'mainwp');
?>
</span>
</th>
<th scope="col" class="manage-column column-posts" style="">
<span><?php
_e('Last run', 'mainwp');
?>
</span></th>
</tr>
</thead>
<tbody>
<?php
foreach ($schedules as $schedule => $option) {
?>
<tr>
<td><?php
echo $schedule;
?>
</td>
<td><?php
echo get_option($option) === false || get_option($option) == 0 ? 'Never run' : MainWP_Utility::formatTimestamp(MainWP_Utility::getTimestamp(get_option($option)));
?>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
<br/>
<?php
$cron_array = _get_cron_array();
$schedules = wp_get_schedules();
?>
<table id="mainwp-table" class="wp-list-table widefat" cellspacing="0">
<thead>
<tr>
<th scope="col" class="manage-column sorted" style=""><span><?php
_e('Next due', 'mainwp');
?>
</span>
</th>
<th scope="col" class="manage-column column-posts" style="">
<span><?php
_e('Schedule', 'mainwp');
?>
</span></th>
<th scope="col" class="manage-column column-posts" style="">
<span><?php
_e('Hook', 'mainwp');
?>
</span></th>
</tr>
</thead>
<tbody id="the-sites-list" class="list:sites">
<?php
foreach ($cron_array as $time => $cron) {
foreach ($cron as $hook => $cron_info) {
foreach ($cron_info as $key => $schedule) {
?>
<tr>
<td><?php
echo MainWP_Utility::formatTimestamp(MainWP_Utility::getTimestamp($time));
?>
</td>
<td><?php
echo isset($schedules[$schedule['schedule']]) ? $schedules[$schedule['schedule']]['display'] : '';
?>
</td>
<td><?php
echo $hook;
?>
</td>
</tr>
<?php
}
}
}
?>
</tbody>
</table>
<?php
self::renderFooter('ServerInformationCron');
}
示例6: renderSites
public static function renderSites()
{
$sql = MainWP_DB::Instance()->getSQLWebsitesForCurrentUser();
$websites = MainWP_DB::Instance()->query($sql);
if (!$websites) {
return;
}
$all_sites_synced = true;
$top_row = true;
?>
<div class="clear">
<div id="wp_syncs">
<?php
ob_start();
@MainWP_DB::data_seek($websites, 0);
while ($websites && ($website = @MainWP_DB::fetch_object($websites))) {
if (empty($website) || $website->sync_errors != '') {
continue;
}
if (time() - $website->dtsSync < 60 * 60 * 24) {
continue;
}
$all_sites_synced = false;
$lastSyncTime = !empty($website->dtsSync) ? MainWP_Utility::formatTimestamp(MainWP_Utility::getTimestamp($website->dtsSync)) : '';
?>
<div class="<?php
echo $top_row ? 'mainwp-row-top' : 'mainwp-row';
?>
mainwp_wp_sync" site_id="<?php
echo $website->id;
?>
" site_name="<?php
echo rawurlencode($website->name);
?>
">
<span class="mainwp-left-col"><a href="<?php
echo admin_url('admin.php?page=managesites&dashboard=' . $website->id);
?>
"><?php
echo stripslashes($website->name);
?>
</a><input type="hidden" id="wp_sync<?php
echo $website->id;
?>
" /></span>
<span class="mainwp-mid-col wordpressInfo" id="wp_sync_<?php
echo $website->id;
?>
">
<?php
echo $lastSyncTime;
?>
</span>
<span class="mainwp-right-col wordpressAction">
<div id="wp_syncs_<?php
echo $website->id;
?>
">
<a class="mainwp-upgrade-button button" onClick="rightnow_wp_sync('<?php
echo $website->id;
?>
')"><?php
_e('Sync Now', 'mainwp');
?>
</a>
</div>
</span>
</div>
<?php
$top_row = false;
}
$output = ob_get_clean();
if ($all_sites_synced) {
echo esc_html__('All sites have been synced within the last 24 hours', 'mainwp') . ".";
} else {
echo '<div class="mainwp_info-box-red">' . esc_html__('Sites not synced in the last 24 hours.', 'mainwp') . '</div>';
echo $output;
}
?>
</div>
</div>
<?php
@MainWP_DB::free_result($websites);
}
示例7: renderLastUpdate
public static function renderLastUpdate()
{
$currentwp = MainWP_Utility::get_current_wpid();
if (!empty($currentwp)) {
$website = MainWP_DB::Instance()->getWebsiteById($currentwp);
$dtsSync = $website->dtsSync;
} else {
$dtsSync = MainWP_DB::Instance()->getFirstSyncedSite();
}
if ($dtsSync == 0) {
//No settings saved!
return;
} else {
echo __('(Last complete sync: ', 'mainwp') . MainWP_Utility::formatTimestamp(MainWP_Utility::getTimestamp($dtsSync)) . ')';
}
}
示例8: renderSites
public static function renderSites($renew, $pExit = true)
{
$current_wpid = MainWP_Utility::get_current_wpid();
if ($current_wpid) {
$sql = MainWP_DB::Instance()->getSQLWebsiteById($current_wpid);
} else {
$sql = MainWP_DB::Instance()->getSQLWebsitesForCurrentUser();
}
$websites = MainWP_DB::Instance()->query($sql);
$allPages = array();
if ($websites) {
while ($websites && ($website = @MainWP_DB::fetch_object($websites))) {
if ($website->recent_pages == '') {
continue;
}
$pages = json_decode($website->recent_pages, 1);
if (count($pages) == 0) {
continue;
}
foreach ($pages as $page) {
$page['website'] = (object) array('id' => $website->id, 'url' => $website->url);
$allPages[] = $page;
}
}
@MainWP_DB::free_result($websites);
}
$recent_pages_published = MainWP_Utility::getSubArrayHaving($allPages, 'status', 'publish');
$recent_pages_published = MainWP_Utility::sortmulti($recent_pages_published, 'dts', 'desc');
$recent_pages_draft = MainWP_Utility::getSubArrayHaving($allPages, 'status', 'draft');
$recent_pages_draft = MainWP_Utility::sortmulti($recent_pages_draft, 'dts', 'desc');
$recent_pages_pending = MainWP_Utility::getSubArrayHaving($allPages, 'status', 'pending');
$recent_pages_pending = MainWP_Utility::sortmulti($recent_pages_pending, 'dts', 'desc');
$recent_pages_trash = MainWP_Utility::getSubArrayHaving($allPages, 'status', 'trash');
$recent_pages_trash = MainWP_Utility::sortmulti($recent_pages_trash, 'dts', 'desc');
?>
<div class="clear">
<a href="<?php
echo admin_url('admin.php?page=PageBulkAdd&select=' . ($current_wpid ? $current_wpid : 'all'));
?>
" class="button-primary" style="float: right"><?php
_e('Add New', 'mainwp');
?>
</a>
<a class="mainwp_action left mainwp_action_down recent_posts_published_lnk" href="#"><?php
_e('Published', 'mainwp');
?>
(<?php
echo count($recent_pages_published);
?>
)</a><a class="mainwp_action mid recent_posts_draft_lnk" href="#"><?php
_e('Draft', 'mainwp');
?>
(<?php
echo count($recent_pages_draft);
?>
)</a><a class="mainwp_action mid recent_posts_pending_lnk" href="#"><?php
_e('Pending', 'mainwp');
?>
(<?php
echo count($recent_pages_pending);
?>
)</a><a class="mainwp_action right recent_posts_trash_lnk" href="#"><?php
_e('Trash', 'mainwp');
?>
(<?php
echo count($recent_pages_trash);
?>
)</a><br/><br/>
<div class="recent_posts_published">
<?php
for ($i = 0; $i < count($recent_pages_published) && $i < 5; $i++) {
if (!isset($recent_pages_published[$i]['title']) || $recent_pages_published[$i]['title'] == '') {
$recent_pages_published[$i]['title'] = '(No Title)';
}
if (isset($recent_pages_published[$i]['dts'])) {
if (!stristr($recent_pages_published[$i]['dts'], '-')) {
$recent_pages_published[$i]['dts'] = MainWP_Utility::formatTimestamp(MainWP_Utility::getTimestamp($recent_pages_published[$i]['dts']));
}
}
?>
<div class="mainwp-row mainwp-recent">
<input class="postId" type="hidden" name="id" value="<?php
echo $recent_pages_published[$i]['id'];
?>
"/>
<input class="websiteId" type="hidden" name="id" value="<?php
echo $recent_pages_published[$i]['website']->id;
?>
"/>
<span class="mainwp-left-col" style="width: 60% !important; margin-right: 1em;"><a href="<?php
echo $recent_pages_published[$i]['website']->url;
?>
?p=<?php
echo $recent_pages_published[$i]['id'];
?>
" target="_blank"><?php
echo htmlentities($recent_pages_published[$i]['title'], ENT_COMPAT | ENT_HTML401, 'UTF-8');
?>
</a></span>
//.........这里部分代码省略.........
示例9: renderSettings
public static function renderSettings()
{
$userExtension = MainWP_DB::Instance()->getUserExtension();
$pluginDir = $userExtension == null || ($userExtension->pluginDir == null || $userExtension->pluginDir == '') ? 'default' : $userExtension->pluginDir;
$user_email = MainWP_Utility::getNotificationEmail();
$siteview = $userExtension->site_view;
$snAutomaticDailyUpdate = get_option('mainwp_automaticDailyUpdate');
$backup_before_upgrade = get_option('mainwp_backup_before_upgrade');
$lastAutomaticUpdate = MainWP_DB::Instance()->getWebsitesLastAutomaticSync();
if ($lastAutomaticUpdate == 0) {
$nextAutomaticUpdate = 'Any minute';
} else {
if (MainWP_DB::Instance()->getWebsitesCountWhereDtsAutomaticSyncSmallerThenStart() > 0 || MainWP_DB::Instance()->getWebsitesCheckUpdatesCount() > 0) {
$nextAutomaticUpdate = 'Processing your websites.';
} else {
$nextAutomaticUpdate = MainWP_Utility::formatTimestamp(MainWP_Utility::getTimestamp(mktime(0, 0, 0, date('n'), date('j') + 1)));
}
}
if ($lastAutomaticUpdate == 0) {
$lastAutomaticUpdate = 'Never';
} else {
$lastAutomaticUpdate = MainWP_Utility::formatTimestamp(MainWP_Utility::getTimestamp($lastAutomaticUpdate));
}
?>
<div class="postbox" id="mainwp-hide-child-plugin-settings">
<h3 class="mainwp_box_title">
<span><i class="fa fa-cog"></i> <?php
_e('Network Optimization', 'mainwp');
?>
</span></h3>
<div class="inside">
<div class="mainwp_info-box-red" style="margin-top: 5px;"><?php
_e('<strong>STOP BEFORE TURNING ON!</strong> Hiding the Child Plugin does require the plugin to make changes to your .htaccess file that in rare instances or server configurations could cause problems.', 'mainwp');
?>
</div>
<table class="form-table">
<tbody>
<tr>
<th scope="row"><?php
_e('Hide MainWP Child Plugin from Search Engines', 'mainwp');
?>
<br/>
<em style="font-size: 12px;">(<?php
_e('does not hide from users', 'mainwp');
?>
)</em>
</th>
<td>
<table>
<tr>
<td valign="top" style="padding-left: 0; padding-right: 5px; padding-top: 0px; padding-bottom: 0px; vertical-align: top;">
<div class="mainwp-checkbox">
<input type="checkbox" value="hidden" name="mainwp_options_footprint_plugin_folder" id="mainwp_options_footprint_plugin_folder_default" <?php
echo $pluginDir == 'hidden' ? 'checked="true"' : '';
?>
/><label for="mainwp_options_footprint_plugin_folder_default"></label>
</div>
</td>
<td valign="top" style="padding: 0">
<label for="mainwp_options_footprint_plugin_folder_default">
<em><?php
_e('This will make anyone including Search Engines trying find your Child Plugin encounter a 404 page. Hiding the Child Plugin does require the plugin to make changes to your .htaccess file that in rare instances or server configurations could cause problems.', 'mainwp');
?>
</em>
</label>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<th scope="row"><?php
_e('Optimize for Shared Hosting or Big Networks', 'mainwp');
?>
<?php
MainWP_Utility::renderToolTip(__('Updates will be cached for quick loading. A manual refresh from the Dashboard is required to view new plugins, themes, pages or users. Recommended for Networks over 50 sites.', 'mainwp'));
?>
</th>
<td>
<div class="mainwp-checkbox">
<input type="checkbox" name="mainwp_optimize"
id="mainwp_optimize" <?php
echo get_option('mainwp_optimize') == 1 ? 'checked="true"' : '';
?>
/>
<label for="mainwp_optimize"></label>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="postbox" id="mainwp-global-options-settings">
<h3 class="mainwp_box_title">
<span><i class="fa fa-cog"></i> <?php
_e('Global Options', 'mainwp');
?>
//.........这里部分代码省略.........
示例10: 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 != '') {
//.........这里部分代码省略.........
示例11: render
public static function render()
{
$tasks = MainWP_DB::Instance()->getBackupTasksForUser();
if (count($tasks) == 0) {
echo 'You have no scheduled backup tasks. <a href="admin.php?page=ManageBackupsAddNew">Go create one!</a>';
} else {
?>
<div class"mainwp-row-top" style="text-align: right; margin-bottom: 1em;">
<a href="admin.php?page=ManageBackups" class="button" ><?php
_e('Manage Backups', 'mainwp');
?>
</a>
<?php
if (mainwp_current_user_can('dashboard', 'add_backup_tasks')) {
?>
<a href="admin.php?page=ManageBackupsAddNew" class="button-primary" ><?php
_e('Add New Task', 'mainwp');
?>
</a>
<?php
}
?>
</div>
<div id="mainwp-backup-tasks-widget">
<style>
@keyframes blinker {
0% { background: #7fb100 ;}
100% { background: #446200 ;}
}
@-webkit-keyframes blinker {
0% { background: #7fb100 ;}
100% { background: #446200 ;}
}
.mainwp-blink-me {
animation: blinker 1s linear 0s infinite alternate;
-webkit-animation: blinker 1s linear 0s infinite alternate;
}
</style>
<?php
foreach ($tasks as $task) {
$sites = array();
if ($task->groups != '') {
$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;
}
}
} else {
if ($task->sites != '') {
$sites = explode(',', $task->sites);
}
}
?>
<div class="mainwp-row mainwp-recent">
<span class="mainwp-left-col" style="width: 40%">
<strong><a href="admin.php?page=ManageBackups&id=<?php
echo $task->id;
?>
"><?php
echo $task->name;
?>
</a></strong><br />
<span style="font-size: 11px">(<?php
echo strtoupper($task->schedule);
?>
- <?php
echo $task->type == 'db' ? __('Database Backup', 'mainwp') : __('Full Backup', 'mainwp');
?>
)</span>
</span>
<span class="mainwp-mid-col">
<?php
if ($task->paused == 1) {
echo '<span title="Paused" style="background: #999; padding: .3em 1em; color: white; border-radius: 15px; -moz-border-radius: 15px; -webkit-border-radius: 15px;">' . count($sites) . '</span>';
} else {
if (count($sites) == 0) {
echo '<span title="0 Scheduled Websites" style="background: #c80000; padding: .3em 1em; color: white; border-radius: 15px; -moz-border-radius: 15px; -webkit-border-radius: 15px;">0</span>';
} else {
if ($task->last_run != 0 && $task->completed < $task->last_run) {
echo '<span title="Backup in Progress" class="mainwp-blink-me" style="padding: .3em 1em; color: white; border-radius: 15px; -moz-border-radius: 15px; -webkit-border-radius: 15px;">' . count($sites) . '</span>';
} else {
echo '<span title="Scheduled Websites" style="background: #7fb100; padding: .3em 1em; color: white; border-radius: 15px; -moz-border-radius: 15px; -webkit-border-radius: 15px;">' . count($sites) . '</span>';
}
}
}
?>
</span>
<span class="mainwp-right-col" style="width: 40%; text-align: left;">
<strong><?php
_e('LAST RUN: ', 'mainwp');
?>
</strong> <?php
echo $task->last_run == 0 ? '-' : MainWP_Utility::formatTimestamp(MainWP_Utility::getTimestamp($task->last_run));
?>
//.........这里部分代码省略.........