本文整理汇总了PHP中admin_tools::Elapsed方法的典型用法代码示例。如果您正苦于以下问题:PHP admin_tools::Elapsed方法的具体用法?PHP admin_tools::Elapsed怎么用?PHP admin_tools::Elapsed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类admin_tools
的用法示例。
在下文中一共展示了admin_tools::Elapsed方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ShowFiles
/**
* Show files in the cache
*
*/
function ShowFiles()
{
global $page, $langmessage;
$page->head_js[] = '/include/thirdparty/tablesorter/tablesorter.js';
$page->jQueryCode .= '$("table.tablesorter").tablesorter({cssHeader:"gp_header",cssAsc:"gp_header_asc",cssDesc:"gp_header_desc"});';
if (!$this->all_files) {
return;
}
echo '<p>';
echo common::Link('Admin_Cache', 'Empty Cache', 'cmd=EmptyResourceCache', array('data-cmd' => 'cnreq', 'class' => 'gpconfirm', 'title' => 'Empty the resource cache?'));
echo '</p>';
echo '<table class="bordered tablesorter full_width">';
echo '<thead>';
echo '<tr><th>';
echo $langmessage['file_name'];
echo '</th><th>';
echo $langmessage['File Size'];
echo '</th><th>';
echo 'Touched';
echo '</th><th>';
echo $langmessage['options'];
echo '</th></tr>';
echo '</thead>';
$total_size = 0;
echo '<tbody>';
foreach ($this->all_files as $file) {
$full = $this->cache_dir . '/' . $file;
echo '<tr><td>';
echo '<a href="?cmd=ViewFile&file=' . rawurlencode($file) . '">';
echo $file;
echo '</a>';
echo '</td><td>';
$size = filesize($full);
echo '<span style="display:none">' . $size . '</span>';
echo admin_tools::FormatBytes($size);
$total_size += $size;
echo '</td><td>';
$elapsed = admin_tools::Elapsed(time() - filemtime($full));
echo sprintf($langmessage['_ago'], $elapsed);
echo '</td><td>';
echo common::Link('Admin_Cache', $langmessage['delete'], 'cmd=DeleteFile&file=' . rawurlencode($file), array('data-cmd' => 'cnreq', 'class' => 'gpconfirm', 'title' => $langmessage['delete_confirm']));
echo '</tr>';
}
echo '</tbody>';
//totals
echo '<tfoot>';
echo '<tr><td>';
echo number_format(count($this->all_files)) . ' Files';
echo '</td><td>';
echo admin_tools::FormatBytes($total_size);
echo '</td><td>';
echo '</tr>';
echo '</table>';
}
示例2: ViewHistory
/**
* Display the revision history of the current file
*
*/
public function ViewHistory()
{
global $langmessage, $config;
$files = $this->BackupFiles();
$rows = array();
//working draft
if ($this->draft_exists) {
ob_start();
$size = filesize($this->draft_file);
$date = common::date($langmessage['strftime_datetime'], $this->draft_stats['modified']);
echo '<tr><td title="' . htmlspecialchars($date) . '">';
echo '<b>' . $langmessage['Working Draft'] . '</b><br/>';
$elapsed = admin_tools::Elapsed(time() - $this->draft_stats['modified']);
echo sprintf($langmessage['_ago'], $elapsed);
echo '</td><td>';
echo admin_tools::FormatBytes($size);
echo '</td><td>' . $this->draft_stats['username'] . '</td><td>';
echo common::Link($this->title, $langmessage['View']);
echo ' ' . common::Link($this->title, $langmessage['Publish Draft'], 'cmd=PublishDraft', array('data-cmd' => 'cnreq'));
echo '</td></tr>';
$rows[$this->draft_stats['modified']] = ob_get_clean();
}
foreach ($files as $time => $file) {
//remove .gze
if (strpos($file, '.gze') === strlen($file) - 4) {
$file = substr($file, 0, -4);
}
//get info from filename
$name = basename($file);
$parts = explode('.', $name, 3);
$time = array_shift($parts);
$size = array_shift($parts);
$username = false;
$date = common::date($langmessage['strftime_datetime'], $time);
if (count($parts)) {
$username = array_shift($parts);
}
//output row
ob_start();
echo '<tr><td title="' . htmlspecialchars($date) . '">';
$elapsed = admin_tools::Elapsed(time() - $time);
echo sprintf($langmessage['_ago'], $elapsed);
echo '</td><td>';
if ($size && is_numeric($size)) {
echo admin_tools::FormatBytes($size);
}
echo '</td><td>';
echo $username;
echo '</td><td>';
echo common::Link($this->title, $langmessage['View'], 'cmd=ViewRevision&time=' . $time, array('data-cmd' => 'cnreq'));
echo ' ';
echo common::Link($this->title, $langmessage['delete'], 'cmd=DeleteRevision&time=' . $time, array('data-cmd' => 'gpabox', 'class' => 'gpconfirm'));
echo '</td></tr>';
$rows[$time] = ob_get_clean();
}
// current page
// this will likely overwrite one of the history entries
ob_start();
$size = filesize($this->file);
$date = common::date($langmessage['strftime_datetime'], $this->fileModTime);
echo '<tr><td title="' . htmlspecialchars($date) . '">';
echo '<b>' . $langmessage['Current Page'] . '</b><br/>';
$elapsed = admin_tools::Elapsed(time() - $this->fileModTime);
echo sprintf($langmessage['_ago'], $elapsed);
echo '</td><td>';
echo admin_tools::FormatBytes($size);
echo '</td><td>';
if (isset($this->file_stats['username'])) {
echo $this->file_stats['username'];
}
echo '</td><td>';
echo common::Link($this->title, $langmessage['View'], 'cmd=ViewCurrent');
echo '</td></tr>';
$rows[$this->fileModTime] = ob_get_clean();
ob_start();
echo '<h2>' . $langmessage['Revision History'] . '</h2>';
echo '<table class="bordered full_width striped"><tr><th>' . $langmessage['Modified'] . '</th><th>' . $langmessage['File Size'] . '</th><th>' . $langmessage['username'] . '</th><th> </th></tr>';
echo '<tbody>';
krsort($rows);
echo implode('', $rows);
echo '</tbody>';
echo '</table>';
echo '<p>' . $langmessage['history_limit'] . ': ' . $config['history_limit'] . '</p>';
$this->contentBuffer = ob_get_clean();
}
示例3: TrashRow
function TrashRow($trash_index, $info, $show_orphaned = false)
{
global $langmessage;
$class = '';
if (isset($info['orphaned'])) {
$class = 'orphaned';
}
//title
echo '<tr class="' . $class . '"><td>';
echo '<label style="display:block;">';
echo '<input type="checkbox" name="titles[]" value="' . htmlspecialchars($trash_index) . '" />';
echo ' ';
if (isset($info['orphaned'])) {
echo '(Orphaned) ';
}
echo common::Link('Admin_Trash/' . $trash_index, str_replace('_', ' ', $info['title']));
echo '</label>';
//time
echo '</td><td>';
if (!empty($info['time'])) {
$elapsed = admin_tools::Elapsed(time() - $info['time']);
echo sprintf($langmessage['_ago'], $elapsed);
}
echo '</td><td>';
if (isset($info['type'])) {
$this->TitleTypes($info['type']);
}
echo '</td><td>';
if (admin_tools::CheckPostedNewPage($info['title'], $msg)) {
echo common::Link('Admin_Trash', $langmessage['restore'], 'cmd=RestoreDeleted&titles[]=' . rawurlencode($trash_index), array('data-cmd' => 'postlink'));
} else {
echo '<span>' . $langmessage['restore'] . '</span>';
}
echo ' ';
echo common::Link('Admin_Trash', $langmessage['delete'], 'cmd=DeleteFromTrash&titles[]=' . rawurlencode($trash_index), array('data-cmd' => 'postlink'));
echo '</td></tr>';
}
示例4: ErrorLog
/**
* Display the error log
*
*/
function ErrorLog()
{
$error_log = ini_get('error_log');
echo '<h2 class="hmargin">';
echo common::Link('Admin_Errors', 'Fatal Errors');
echo ' <span> | </span>';
echo ' Error Log';
echo '</h2>';
if (!self::ReadableLog()) {
echo '<p>Sorry, an error log could not be found or could not be read.</p>';
echo '<p>Log File: ' . $error_log . '</p>';
return;
}
echo '<p><b>Please Note:</b> The following errors are not limited to your installation of gpEasy.';
echo '</p>';
$lines = file($error_log);
$lines = array_reverse($lines);
$time = null;
$displayed = array();
foreach ($lines as $line) {
$line = trim($line);
if (empty($line)) {
continue;
}
preg_match('#^\\[[a-zA-Z0-9:\\- ]*\\]#', $line, $date);
if (count($date)) {
$date = $date[0];
$line = substr($line, strlen($date));
$date = trim($date, '[]');
$new_time = strtotime($date);
if ($new_time !== $time) {
if ($time) {
echo '</pre>';
}
echo '<p>';
$elapsed = admin_tools::Elapsed(time() - $new_time);
echo sprintf($langmessage['_ago'], $elapsed);
echo ' (' . $date . ')';
echo '</p>';
echo '<pre>';
$time = $new_time;
$displayed = array();
}
}
$line_hash = md5($line);
if (in_array($line_hash, $displayed)) {
continue;
}
echo $line;
$displayed[] = $line_hash;
echo "\n";
}
echo '</pre>';
}