本文整理汇总了PHP中get_timeago函数的典型用法代码示例。如果您正苦于以下问题:PHP get_timeago函数的具体用法?PHP get_timeago怎么用?PHP get_timeago使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_timeago函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: utf8_decode
$blog_write_up = $row['writeup'];
$blog_write_up = utf8_decode($blog_write_up);
$blog_write_up = utf8_decode($blog_write_up);
$blog_write_up = str_replace('???', "\"", $blog_write_up);
$blog_write_up = substr(urldecode($blog_write_up), 0, 140) . '...';
$blog_write_up_full = $blog_write_up;
}
$blogentry = $row['blogentry'];
$current_likes = $row['rate'];
if ($subscriber_view = true && isset($_COOKIE['user_name'])) {
//$if_logged_in = '<a href="#'.$rand_id.'" onclick="likePost('.$blog_id.', '.$current_likes.' , \''.$user_name_session.'\')" class="btn btn-success btn-xs" role="button"><span class="glyphicon glyphicon-save"></span> - SAVE</a>';
} else {
$if_logged_in = '';
}
$submission_date = date('l, F d', strtotime($row['submission_date']));
$submission_date = get_timeago(strtotime($submission_date));
//$rand_id = rand(111111,999999);
$rand_id = $blog_id;
$blog_write_up_embedd = '';
if ($row['writeup']) {
$blog_write_up_embedd = '<p style="color:#fff;text-shadow:0px 0px 15px #000;" >' . $blog_write_up . '</p>
<hr>';
$blog_write_up_full = '<p style="color:#fff;text-shadow:0px 0px 15px #000;" >' . $blog_write_up_full . '</p>
<hr>';
}
$blog_write_up_embedd = '';
$blog_write_up_full = '';
// TWEET SHARE MESSAGE
$tweet_blog = urlencode("[#FLMAG] " . $twitter . "\n\n" . $blogtitle . " \n\n" . str_replace('http://', '', $blog_story_url) . "\n\n" . $twitpic);
$link = 'http://freelabel.net/' . $twitter . '/' . $rand_id;
echo '
示例2: array
if ($num_visits == 1) {
$inputs = array();
$inputs[] = " We have not visited this system before.";
$inputs[] = " This is our first time visiting this system.";
shuffle($inputs);
$va_text .= $inputs[0];
} elseif ($num_visits == 2) {
$vis_res = mysqli_query($GLOBALS["___mysqli_ston"], "\tSELECT visit\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM user_visited_systems\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE system_name = '" . mysqli_real_escape_string($GLOBALS["___mysqli_ston"], $curSys["name"]) . "'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tORDER BY visit ASC\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tLIMIT 1") or write_log(mysqli_error($GLOBALS["___mysqli_ston"]), __FILE__, __LINE__);
$vis_arr = mysqli_fetch_assoc($vis_res);
$first_vis = get_timeago(strtotime($vis_arr["visit"]));
$va_text .= " We have visited this system once before. That was " . $first_vis . ".";
} else {
$vis_res = mysqli_query($GLOBALS["___mysqli_ston"], "\tSELECT visit\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM user_visited_systems\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE system_name = '" . mysqli_real_escape_string($GLOBALS["___mysqli_ston"], $curSys["name"]) . "'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tORDER BY visit ASC\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tLIMIT 1") or write_log(mysqli_error($GLOBALS["___mysqli_ston"]), __FILE__, __LINE__);
$vis_arr = mysqli_fetch_assoc($vis_res);
$num_vis = $num_visits - 1;
$first_vis = get_timeago(strtotime($vis_arr["visit"]));
$va_text .= " We have visited this system " . $num_vis . " times before. Our first visit was " . $first_vis . ".";
}
}
echo $va_text;
is_null($___mysqli_res = mysqli_close($link)) ? false : $___mysqli_res;
exit;
}
/*
* Closest Station
*/
if (isset($_GET["cs"])) {
if (valid_coordinates($curSys["x"], $curSys["y"], $curSys["z"])) {
$usex = $curSys["x"];
$usey = $curSys["y"];
$usez = $curSys["z"];
示例3: urlencode
echo '<a href="System.php?system_name=' . urlencode($system) . '" style="color:inherit">' . $system . '</a>' . $screenshots . '<br />No additional information';
} else {
$logres = mysqli_query($GLOBALS["___mysqli_ston"], "\tSELECT id, LEFT(log_entry , 100) AS text\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM user_log\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE system_name = '" . mysqli_real_escape_string($GLOBALS["___mysqli_ston"], $system) . "'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tORDER BY stardate\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tLIMIT 1") or write_log(mysqli_error($GLOBALS["___mysqli_ston"]), __FILE__, __LINE__);
$logged = mysqli_num_rows($logres);
if (isset($visit)) {
$visit = date_create($visit);
$visit_date = date_modify($visit, "+1286 years");
$visit = date_format($visit_date, "d.m.Y, H:i");
}
if ($text != null) {
echo "" . $text . "<br />";
}
if (!empty($visit)) {
$visits = mysqli_num_rows(mysqli_query($GLOBALS["___mysqli_ston"], "\tSELECT id\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM user_visited_systems\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE system_name = '" . mysqli_real_escape_string($GLOBALS["___mysqli_ston"], $system) . "'"));
$visit_unix = strtotime($visit_og);
$visit_ago = get_timeago($visit_unix);
echo "<a href=\"/System.php?system_name=" . urlencode($system) . "\" style=\"color:inherit;\">" . $system . "</a>" . $screenshots . " | \n\t\t\tTotal visits: " . $visits . " | First visit: " . $visit . " (" . $visit_ago . ")";
} else {
echo "<a href=\"/System.php?system_name=" . urlencode($system) . "\" style=\"color:inherit;\">" . $system . "</a>";
}
if ($logged > 0) {
$logarr = mysqli_fetch_assoc($logres);
$text = $logarr["text"];
echo '<br />
<a href="/log.php?system=' . urlencode($system) . '" style="color:inherit;font-weight:bold" title="View the log for this system">
' . $text . ' ...
</a>';
}
}
exit;
}
示例4: foreach
<?php
foreach ($posts as $post) {
$post['embed'] = '<audio controls preload="metadata"><source src="' . $post['trackmp3'] . '"></audio>';
if ($post['trackmp3'] == '') {
$post['embed'] = '<br><br><button class="btn btn-primary" >View</button>';
// = '<audio controls preload="metadata"><source src="'.$post['trackmp3'].'"></audio>';
}
echo '
<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12 text-center post" style="background-image:url(\'' . $post['photo'] . '\');" data-img=\'' . $post['photo'] . '\'>
<div class="background-tint">
<a class="story-img" href="' . $post['blog_story_url'] . '"><h1>' . $post['blogtitle'] . '</h1></a>
<a class="story-img" href="' . $post['blog_story_url'] . '"><h3 class="post-twitter">' . $post['twitter'] . '</h3></a>
<a class="story-img" href="' . $post['blog_story_url'] . '"><h6 class="post-twitter">' . get_timeago(strtotime($post['submission_date'])) . '</h6></a>
<a class="story-img" href="' . $post['blog_story_url'] . '"><img src="' . $post['photo'] . '" style="width:100%;" class=""></a>
' . $post['embed'] . '
</div>
</div>
';
}
?>
<br><br>
<button class='col-md-12 load-more-button' ><a class='btn btn-primary' >Load Next (<?php
echo $next_page_read;
?>
)</a></button>
示例5: file_get_contents
$new_file = "-1";
if (file_exists($newfile)) {
$new_file = file_get_contents($newfile);
}
if ($new_file != $old_file) {
mysqli_query($GLOBALS["___mysqli_ston"], "\tUPDATE edtb_common\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tSET unixtime = UNIX_TIMESTAMP()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE name = 'last_galnet_new'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tLIMIT 1") or write_log(mysqli_error($GLOBALS["___mysqli_ston"]), __FILE__, __LINE__);
}
}
$in++;
}
}
/*
* update last_update time
*/
mysqli_query($GLOBALS["___mysqli_ston"], "\tUPDATE edtb_common\n\t\t\t\t\t\t\t\t\t\t\t\tSET unixtime = UNIX_TIMESTAMP()\n\t\t\t\t\t\t\t\t\t\t\t\tWHERE name = 'last_galnet_update'\n\t\t\t\t\t\t\t\t\t\t\t\tLIMIT 1") or write_log(mysqli_error($GLOBALS["___mysqli_ston"]), __FILE__, __LINE__);
}
/*
* fetch last check time and last new article time
*/
$last_galnet_check = edtb_common("last_galnet_check", "unixtime");
$last_galnet_new = edtb_common("last_galnet_new", "unixtime");
if ($last_galnet_new < $last_galnet_check) {
echo "No new GalNet articles have been published since you last asked " . get_timeago($last_galnet_check, false) . ".";
} else {
echo "New GalNet articles have been published since you last asked. Would you like me to read them to you?";
}
/*
* update last check time
*/
mysqli_query($GLOBALS["___mysqli_ston"], "\tUPDATE edtb_common\n\t\t\t\t\t\t\t\t\t\t\tSET unixtime = UNIX_TIMESTAMP()\n\t\t\t\t\t\t\t\t\t\t\tWHERE name = 'last_galnet_check'\n\t\t\t\t\t\t\t\t\t\t\tLIMIT 1") or write_log(mysqli_error($GLOBALS["___mysqli_ston"]), __FILE__, __LINE__);
is_null($___mysqli_res = mysqli_close($link)) ? false : $___mysqli_res;
示例6: get_timeago
<i class="mdi mdi-menu-right"></i>
<a href="/user/<?php
echo $post->uid;
?>
/"><?php
echo $post->r_fn;
?>
</a>
</p>
</span>
<span id="post-date" class="time" title="<?php
echo $post->date;
?>
"><?php
echo get_timeago($post->date);
?>
</span>
</div>
<?php
}
?>
<br>
<div class="ui left aligned">
<?php
if ($post->status == "2") {
?>
<div class="ui warning message">
This post is private, only you can see it, you can change that by clicking <a id="post-publish" href="#"> here.</a>
</div>
<?php
示例7: foreach
$html_content = '<div class="alert alert-warning" role="alert"><span class="label label-warning">OOPS..</span> No available snippet found under this category.</div>';
}
} else {
// authenticated == true
$query = "SELECT * FROM " . DBTABLE_SNIPPETS . " WHERE category_tag='" . $snippet_cat . "'";
$total_found = $db->num_rows($query);
if ($total_found > 0) {
$results = $db->get_results($query);
$html_content = '<div class="alert alert-info" role="alert"><span class="label label-info">INFO</span> This category contains <strong>' . $total_found . '</strong> snippets, but some snippets will not be listed here due to private visibility.</div>';
$html_content .= '<div class="list-group snippet-list">';
foreach ($results as $row) {
if ($row['visibility'] == 'private' && $row['user_id'] == $user_loggedin_id) {
$html_content .= '<a href="view_snippet.php?id=' . $row['id'] . '" class="list-group-item"><span class="snippet-title">' . $row['name'] . '</span><span class="by-creator"> by <strong>' . get_username($row['user_id']) . '</strong></span> · <span class="created-date">' . get_timeago($row['updated_time']) . '</span><br><span class="private-snippet"><i class="fa fa-info-circle"></i> This is your private snippet. Only you can see this!</span></a>';
} else {
if ($row['visibility'] == 'public') {
$html_content .= '<a href="view_snippet.php?id=' . $row['id'] . '" class="list-group-item"><span class="snippet-title">' . $row['name'] . '</span><span class="by-creator"> by <strong>' . get_username($row['user_id']) . '</strong></span> · <span class="created-date">' . get_timeago($row['updated_time']) . '</span></a>';
}
}
}
$html_content .= '</div>';
} else {
$html_content = '<div class="alert alert-warning" role="alert"><span class="label label-warning">OOPS..</span> No available snippet found under this category.</div>';
}
}
} else {
// ID not numeric
header('Location: 404.php?error=invalid_category');
exit;
}
$category_title = get_category_title($snippet_cat);
$category_color = get_category_color($snippet_cat);
示例8: get_timeago
?>
/"><img src="<?php
echo $u->img_path;
?>
"></a>
</div>
<div class="content">
<a href="<?php
echo BASE_URL . 'user/' . $u->id;
?>
/" class="header"><?php
echo $u->username;
?>
</a>
<div class="time"><?php
echo get_timeago($u->register_date);
?>
</div>
</div>
</div>
<?php
}
?>
</div>
</div>
</div>
</div>
<div class="ui grid">
<div class="eight wide column">
<div class="ui segment purple cp_segs sections">
<div class="seg_title">
示例9: get_audio
/**
* Get audio log files
*
* @param object $obj
* @return string
*/
private function get_audio($obj)
{
$logdata .= '<div class="audio" id="' . $obj->id . '" style="display:none">';
$audio_files = explode(", ", $obj->audio);
foreach ($audio_files as $audio_file) {
$file = $_SERVER["DOCUMENT_ROOT"] . "/audio_logs/" . $audio_file;
$file_src = "/audio_logs/" . $audio_file;
if (file_exists($file)) {
$timestamp = filemtime($file) + $this->time_difference * 60 * 60;
$record_date = date("Y-m-d H:i:s", $timestamp);
$date = date_create($record_date);
$record = date_modify($date, "+1286 years");
$record_added = date_format($record, "j M Y, H:i");
$added_ago = get_timeago($timestamp);
$logdata .= '<div style="margin-bottom:4px;margin-top:6px;margin-left:3px">';
$logdata .= 'Added: ' . $record_added . ' (' . $added_ago . ')';
$logdata .= '</div>';
$logdata .= '<div>';
$logdata .= '<audio controls>';
$logdata .= '<source src="' . $file_src . '" type="audio/mp3">';
$logdata .= 'Your browser does not support the audio element.';
$logdata .= '</audio>';
$logdata .= '</div>';
}
}
unset($audio_file);
$logdata .= '</div>';
return $logdata;
}
示例10: get_timeago
echo $post->thread->link;
?>
'"><div class="itemheadfull">
<i><img src="<?php
echo $post->author->avatar->small->permalink;
?>
" width="40" height="40" class="img-circle" /></i>
<?php
echo $post->author->username;
?>
posted in
<b><?php
echo $post->thread->title;
?>
</b>
(<?php
echo $this->category_code[$post->thread->category];
?>
)
<span><i class="fa fa-fw fa-clock-o"></i> <?php
echo get_timeago(strtotime(str_replace('T', ' ', $post->createdAt)));
?>
</span>
<div class="discuss_postmessage">
<?php
echo $post->message;
?>
</div>
</div></div>
<?php
}
示例11: number_format
$ls_from_star = $station_obj->ls_from_star;
$max_landing_pad_size = $station_obj->max_landing_pad_size;
$s_faction = $station_obj->faction == "" ? "" : "<strong>Faction:</strong> " . $station_obj->faction;
$s_distance_from_star = $ls_from_star == 0 ? "" : "" . number_format($ls_from_star, 0) . " ls - ";
$s_information = '<span style="float:right;margin-right:8px">└ ' . $s_distance_from_star . 'Landing pad: ' . $max_landing_pad_size . '</span><br />';
$s_government = $station_obj->government == "" ? "Government unknown" : $station_obj->government;
$s_allegiance = $station_obj->allegiance == "" ? "Allegiance unknown" : $station_obj->allegiance;
$s_state = $station_obj->state == "" ? "" : "<strong>State:</strong> " . $station_obj->state . "<br />";
$type = $station_obj->type == "" ? "Type unknown" : $station_obj->type;
$economies = $station_obj->economies == "" ? "Economies unknown" : $station_obj->economies;
$economies = $economies == "" ? "Economies unknown" : $economies;
$import_commodities = $station_obj->import_commodities == "" ? "" : "<br /><strong>Import commodities:</strong> " . $station_obj->import_commodities . "<br />";
$export_commodities = $station_obj->export_commodities == "" ? "" : "<strong>Export commodities:</strong> " . $station_obj->export_commodities . "<br />";
$prohibited_commodities = $station_obj->prohibited_commodities == "" ? "" : "<strong>Prohibited commodities:</strong> " . $station_obj->prohibited_commodities . "<br />";
$outfitting_updated_ago = !empty($station_obj->outfitting_updated_at) ? 'Outfitting last updated: ' . get_timeago($station_obj->outfitting_updated_at, true, true) : "";
$shipyard_updated_ago = !empty($station_obj->shipyard_updated_at) ? ' (updated ' . get_timeago($station_obj->shipyard_updated_at, true, true) . ')' : "";
$selling_ships = $station_obj->selling_ships == "" ? "" : "<br /><br /><strong>Selling ships:</strong> " . str_replace("'", "", $station_obj->selling_ships) . $shipyard_updated_ago;
$selling_modules = "";
/**
* Information about the modules sold at the station
*/
if (!empty($station_obj->selling_modules)) {
$modules = $station_obj->selling_modules;
$modules_s = explode("-", $modules);
$modules_t = "";
$last_class = "";
$last_module_name = "";
$last_category_name = "";
$mod_cat = [];
$i = 0;
foreach ($modules_s as $mods) {
示例12: number_format
$va_text .= " It has " . $count . " spaceports, the nearest one is " . $first_station_name . " " . number_format(round($first_station_ls_from_star)) . " light seconds away.";
} else {
$va_text .= " It has " . $count . " spaceports.";
}
}
if ($num_visits == 1) {
$inputs = [];
$inputs[] = " We have not visited this system before.";
$inputs[] = " This is our first time visiting this system.";
shuffle($inputs);
$va_text .= $inputs[0];
} else {
$query = " SELECT visit\n FROM user_visited_systems\n WHERE system_name = '{$esc_sysname}'\n ORDER BY visit ASC\n LIMIT 1";
$result = $mysqli->query($query) or write_log($mysqli->error, __FILE__, __LINE__);
$vis_arr = $result->fetch_object();
$first_vis = get_timeago(strtotime($vis_arr->visit));
$result->close();
if ($num_visits == 2) {
$va_text .= " We have visited this system once before. That was " . $first_vis . ".";
} else {
$va_text .= " We have visited this system " . $num_visits . " times before. Our first visit was " . $first_vis . ".";
}
}
}
echo $va_text;
exit;
}
/**
* Nearest Station
*/
if (isset($_GET["cs"])) {
示例13: get_timeago
<div class="itemheadfull">
<i class="<?php
echo $this->icons[$type];
?>
" style="color:<?php
echo $this->colors[$type];
?>
"></i>
<a href="r/<?php
echo $r['_id'];
?>
"><?php
echo $rs['uploader'];
?>
<span><i class="fa fa-fw fa-clock-o"></i> <?php
echo get_timeago(strtotime(str_replace('.000Z', '', $rs['date'])));
?>
</span><br>
<span>ran flow</span> <?php
echo $rs['run_flow']['name'];
?>
<span>on task</span> <?php
echo $rs['run_task']['tasktype']['name'];
?>
on data set <?php
echo $rs['run_task']['source_data']['name'];
?>
</a>
</div>
<div class="runStats statLine">
<?php
示例14: strtotime
/users/<?php
echo $img;
?>
">
</div>
<div class="col-sm-9 col-md-10">
<div class="row">
<?php
$curenttime = $comment['comment_created_time'];
$time_ago = strtotime($curenttime);
?>
<h4><span class="viewername"><?php
echo $comment['user_name'];
?>
</span> <span class="view-hr viewername"><?php
echo get_timeago($time_ago);
?>
</span></h4>
<p>
<?php
echo $comment['comment'];
?>
</p>
<?php
if ($comment['id'] == $this->session->userdata('user_id')) {
?>
<a href="<?php
echo site_url('home/comment_delete/' . $comment['comment_id'] . '/' . $product['id'] . '');
?>
示例15: get_timeago
<td><?php
echo $user->full_name;
?>
</td>
<td title="<?php
echo $user->register_date;
?>
"><?php
echo get_timeago($user->register_date);
?>
</td>
<td title="<?php
echo $user->activity;
?>
"><?php
echo get_timeago($user->activity);
?>
</td>
<td><?php
echo $user->ip_address;
?>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
<br>
<?php
echo $pag->display(true);