本文整理汇总了PHP中timeAgo函数的典型用法代码示例。如果您正苦于以下问题:PHP timeAgo函数的具体用法?PHP timeAgo怎么用?PHP timeAgo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了timeAgo函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: saveComment
function saveComment($name, $hour, $mycomment)
{
$atime = timeAgo($hour);
$putComment = $name . ' | ' . $mycomment . ' | ' . $atime;
$filename = $hour . ".comment";
file_put_contents($filename, $putComment);
}
开发者ID:ramasubbaiya,项目名称:PHP_Term_1_Course_Work,代码行数:7,代码来源:util.php
示例2: bitsList
public function bitsList($bits)
{
$html = '<ul>';
$count = 2;
foreach ($bits as $bit) {
$settings = json_decode($bit->meta);
$sampleCode = $bit->javascript ? $bit->javascript : ($bit->html ? $bit->html : ($bit->css ? $bit->css : false));
if ($sampleCode) {
$compressed = preg_replace("/\n/", '', preg_replace("/\t/", '', substr(base64_decode($sampleCode), 0, 200)));
$sampleCode = '<pre class="sample-code">' . _html($compressed) . '</pre>';
} else {
$sampleCode = '';
}
if ($settings->bit_description) {
$sampleCode = '<pre class="sample-code">' . _html($settings->bit_description) . '</pre>';
}
$klass = $count % 2 == 0 ? 'even' : 'odd';
$html .= '<li class="' . $klass . '"><a href="' . home_url('code/bit/' . $bit->slug . '/' . $bit->latestVersion) . '" class="block-link">';
$html .= '<div class="bit-title group">';
$html .= '<p class="pull-left code-font">' . $settings->bit_title . ' <span>v' . $bit->latestVersion . '</span></p>';
$html .= '<time class="pull-right" datetime="' . $bit->created . '">' . timeAgo($bit->created) . '</time>';
$html .= '</div>';
$html .= '<div class="bit-sample">';
$html .= $sampleCode;
$html .= '</div>';
$html .= '</a></li>';
$count++;
}
$html .= '</ul>';
return $html;
}
开发者ID:juanretamales,项目名称:Bits,代码行数:31,代码来源:format.php
示例3: displayLastCheckin
public function displayLastCheckin()
{
if ($this->lastCheckInTime != null) {
echo timeAgo($this->lastCheckInTime);
} else {
echo "unknown";
}
}
开发者ID:WillVandergrift,项目名称:Omega,代码行数:8,代码来源:device.php
示例4: jsonTimestampOut
function jsonTimestampOut($lastupdate, $offset = 0, $lang, $callback)
{
if ($lastupdate) {
header("Content-Type: text/plain; charset=UTF-8");
$difference = timeAgo(time(), $lastupdate, $offset);
$jsonData = json_encode(array('timestamp' => array('unix' => substr($lastupdate, 0, -1), 'string' => timestampString($lastupdate, $offset)), 'difference' => array('unix' => $difference, 'lang' => $lang, 'string' => timeAgoString($difference))));
// JSONP request?
if (isset($callback)) {
return $callback . '(' . $jsonData . ')';
} else {
return $jsonData;
}
}
return false;
}
开发者ID:duizendnegen,项目名称:OpenRailwayMap,代码行数:15,代码来源:timestamp.php
示例5: processPost
function processPost($post)
{
global $MStudent;
$student = $MStudent->getById($post['from']);
$post['pic'] = $student['photo'];
$post['name'] = $student['name'];
$post['date'] = timeAgo($post['date']);
$post['id'] = $post['id']->{'$id'};
if ($post['parent'] != '') {
$post['parent'] = $post['parent']->{'$id'};
}
$post['liked'] = false;
foreach ($post['likes'] as $key => &$sub_array) {
if ($sub_array['id'] == $post['from']) {
$post['liked'] = true;
break;
}
}
$post['content'] = nl2br(autolink($post['content']));
return $post;
}
开发者ID:edwardshe,项目名称:sublite-1,代码行数:21,代码来源:SocialModel.php
示例6: json_decode
$color = '#2B5B6A;';
?>
<div class="panel panel-default">
<div class="panel-heading" style="background: <?=$color; ?>">
<?php
if ($newsItem['type'] === 'edited_description') {
echo ($newsItem['user_id'] == $_SESSION['user']['id']) ? 'Jag' : "<a href=\"profile?view={$newsItem['user_id']}\">{$newsItem['username']}</a>"; ?> ändrade gruppens beskrivning.
<?php }
if ($newsItem['type'] === 'group_created') {
echo ($newsItem['user_id'] == $_SESSION['user']['id']) ? 'Jag' : "<a href=\"profile?view={$newsItem['user_id']}\">{$newsItem['username']}</a>"; ?> skapade gruppen.
<?php }
if ($newsItem['type'] === 'invited') {
$json = json_decode($newsItem['what'], true);
echo ($newsItem['user_id'] == $_SESSION['user']['id']) ? 'Jag' : "<a href=\"profile?view={$newsItem['user_id']}\">{$newsItem['username']}</a>"; ?> bjöd in <a href="profile?view=<?=$json['id']; ?> " style="color: #FFFFFF;"><?=$json['username']; ?></a>.
<?php }
if ($newsItem['type'] === 'invite_request') { ?>
<a href="profile?view={$newsItem['user_id']}" style="color: #FFFFFF;"><?=$newsItem['username']; ?></a> vill gå med i gruppen.
<div class="panel-body">
<button class="btn btn-info" onClick="window.location.replace('groups?view=<?=$_GET['view']; ?>&show=invite&requests');">Hantera</button>
</div>
<?php }
if ($newsItem['type'] === 'rejected_invite') {
echo ($newsItem['user_id'] == $_SESSION['user']['id']) ? 'Jag' : "<a href=\"profile?view={$newsItem['user_id']}\" style=\"color: #FFFFFF;\">{$newsItem['username']}</a>"; ?> ignorerade inbjudan.
<?php } ?>
</div>
<div class="panel-footer">
<?=timeAgo($newsItem['date']); ?>
</div>
</div>
<?php } ?>
开发者ID:pesa0015,项目名称:greatnonsens,代码行数:31,代码来源:news.php
示例7: getLatestTweets
function getLatestTweets($count = 1)
{
$consumerKey = get_field('twitter_consumer_key', 'option');
$consumerSecret = get_field('twitter_consumer_secret', 'option');
$accessToken = get_field('twitter_access_token', 'option');
$accessSecret = get_field('twitter_access_token_secret', 'option');
$connection = new TwitterOAuth($consumerKey, $consumerSecret, $accessToken, $accessSecret);
$tweetData = $connection->get("https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=atticoos&count={$count}");
$tweets = array();
foreach ($tweetData as $tweet) {
$replace_index = array();
if (!empty($tweet->entities)) {
foreach ($tweet->entities as $area => $items) {
switch ($area) {
case 'hashtags':
$find = 'text';
$prefix = '#';
$url = 'https://twitter.com/search/?src=hash&q=%23';
break;
case 'user_mentions':
$find = 'screen_name';
$prefix = '@';
$url = 'https://twitter.com/';
break;
case 'media':
case 'urls':
$find = 'display_url';
$prefix = '';
$url = '';
break;
default:
break;
}
foreach ($items as $item) {
$text = $tweet->text;
$string = $item->{$find};
$href = $url . $string;
if (!(strpos($href, 'http://') === 0) && !(strpos($href, 'https://') === 0)) {
$href = 'http://' . $href;
}
$replace = substr($text, $item->indices[0], $item->indices[1] - $item->indices[0]);
$with = "<a href=\"{$href}\" target=\"_blank\">{$prefix}{$string}</a>";
$replace_index[$replace] = $with;
}
}
foreach ($replace_index as $replace => $with) {
$tweet->text = str_replace($replace, $with, $tweet->text);
}
}
$tweets[] = array('user' => $tweet->user, 'id' => $tweet->id, 'text' => $tweet->text, 'createdat' => $tweet->created_at, 'timeago' => timeAgo(strtotime($tweet->created_at)));
}
return $tweets;
}
开发者ID:ajwhite,项目名称:Portfolio,代码行数:53,代码来源:functions.php
示例8: getStats
/**
* Echoes the stats of the cache.
*
* Gives the cache hits, cache misses and cache uptime.
*
* @since 6.2.0
*/
public function getStats()
{
if (!$this->enable) {
return false;
}
echo "<p>";
echo "<strong>" . _t('Cache Hits:') . "</strong> " . _file_get_contents($this->_dir . 'cache_hits.txt') . "<br />";
echo "<strong>" . _t('Cache Misses:') . "</strong> " . _file_get_contents($this->_dir . 'cache_misses.txt') . "<br />";
echo "<strong>" . _t('Uptime:') . "</strong> " . timeAgo(file_mod_time($this->_dir)) . "<br />";
echo "</p>";
}
开发者ID:parkerj,项目名称:eduTrac-SIS,代码行数:18,代码来源:etsis_Cache_Cookie.php
示例9: getDataSourceLogs
/**
* getDataSourceLogs
* @author Minh Duc Nguyen <[email protected]>
* @param [POST] data_source_id [POST] offset [POST] count [POST] log_id
*
* @return [json] [logs for the data source]
*/
public function getDataSourceLogs()
{
header('Cache-Control: no-cache, must-revalidate');
header('Content-type: application/json');
// date_default_timezone_set('Australia/Canberra');//???
$this->load->model('data_sources', 'ds');
$post = $this->input->post();
$id = isset($post['id']) ? $post['id'] : 0;
//data source id
if ($id == 0) {
throw new Exception('Data Source ID must be provided');
exit;
}
$offset = isset($post['offset']) ? (int) $post['offset'] : 0;
$count = isset($post['count']) ? (int) $post['count'] : 10;
$logid = isset($post['logid']) ? (int) $post['logid'] : null;
$log_class = isset($post['log_class']) ? $post['log_class'] : 'all';
$log_type = isset($post['log_type']) ? $post['log_type'] : 'all';
$jsonData = array();
$dataSource = $this->ds->getByID($id);
$dataSourceLogs = $dataSource->get_logs($offset, $count, $logid, $log_class, $log_type);
$jsonData['log_size'] = $dataSource->get_log_size($log_type);
if ($jsonData['log_size'] > $offset + $count) {
$jsonData['next_offset'] = $offset + $count;
$jsonData['hasMore'] = true;
} else {
$jsonData['next_offset'] = 'all';
$jsonData['hasMore'] = false;
}
$jsonData['last_log_id'] = '';
$lastLogIdSet = false;
$items = array();
if (sizeof($dataSourceLogs) > 0) {
foreach ($dataSourceLogs as $log) {
$item = array();
$item['type'] = $log['type'];
$item['log_snippet'] = first_line($log['log']);
$item['log'] = $log['log'];
$item['id'] = $log['id'];
if (!$lastLogIdSet) {
$jsonData['last_log_id'] = $log['id'];
$lastLogIdSet = true;
}
$item['date_modified'] = timeAgo($log['date_modified']);
$item['harvester_error_type'] = $log['harvester_error_type'];
if ($log['harvester_error_type'] != 'BENCHMARK_INFO' || $this->user->hasFunction(AUTH_FUNCTION_SUPERUSER)) {
array_push($items, $item);
}
}
}
$jsonData['count'] = $count;
$jsonData['items'] = $items;
echo json_encode($jsonData);
}
开发者ID:aaryani,项目名称:RD-Switchboard-Net,代码行数:61,代码来源:data_source.php
示例10: viewData
function viewData($c, $entry = NULL)
{
global $MMessage;
$messages = array_reverse(iterator_to_array($MMessage->findByParticipant($_SESSION['_id']->{'$id'})));
$replies = array();
$unread = 0;
foreach ($messages as $m) {
$reply = array_pop($m['replies']);
$reply['_id'] = $m['_id'];
$from = $reply['from'];
if (!$reply['read']) {
$reply['read'] = strcmp($from, $_SESSION['_id']) == 0;
}
if (!$reply['read']) {
$unread++;
}
$c->setFromNamePic($reply, $from);
if (strcmp($m['_id'], $entry['_id']) == 0) {
$reply['current'] = true;
} else {
$reply['current'] = false;
}
$reply['time'] = timeAgo($reply['time']);
if (strlen($reply['msg']) > 100) {
$reply['msg'] = substr($reply['msg'], 0, 97) . '...';
}
array_push($replies, $reply);
}
// Handle current message
if (!is_null($entry)) {
$currentreplies = $entry['replies'];
$current = array();
foreach ($currentreplies as $m) {
$c->setFromNamePic($m, $m['from']);
$m['time'] = timeAgo($m['time']);
array_push($current, $m);
}
$to = 'Message To: ' . $c->getName($entry['participants'][0]);
foreach ($entry['participants'] as $p) {
if (strcmp($p, $_SESSION['_id']) != 0) {
$to = 'Message To: ' . $c->getName($p);
}
}
$currentid = $entry['_id'];
} else {
$current = null;
$currentid = null;
$to = '';
}
$data = array('messages' => $replies, 'current' => $current, 'currentid' => $currentid, 'unread' => $unread, 'to' => $to);
if (isset($_GET['msg'])) {
$data['msg'] = $_GET['msg'];
}
return $data;
}
开发者ID:edwardshe,项目名称:sublite-1,代码行数:55,代码来源:MessageController.php
示例11: foreach
<?php
foreach ($answers as $answer) {
?>
<div class="questionsview_userbox">
<?php
echo getUser($answer['userid']);
?>
</div>
<div class="questionsview_details"><span style="color:#999"><?php
echo timeAgo(strtotime($answer['created']));
?>
</span>
</div>
<?php
if ($answer['userid'] == $_SESSION['userid']) {
?>
<div class="questionsview_options"><a href="<?php
echo basePath();
?>
/answers/edit/<?php
echo $answer['id'];
?>
">edit</a></div>
<?php
开发者ID:bg6aer,项目名称:Qwench,代码行数:27,代码来源:view.php
示例12: timeAgo
img/avatar04.png" alt="Avatar Image" >
</a>
<p style="float:right; text-align:right; font-size:10px;"><a href="javascript:;" rel="<?php
echo $post_id;
?>
" class="comment-delete" id="comment_delete_<?php
echo $comment_id;
?>
">X</a></p>
</div>
<div class="acomment-meta">
<a href="#" ><?php
echo $fulln;
?>
</a> <?php
echo timeAgo($comt['commented_date']);
?>
</div>
<div class="acomment-content"><p class="msg_wrap"><?php
echo parse_smileys(make_clickable(nl2br(stripslashes($comt['comment']))), $smiley_folder);
?>
</p></div></li>
<?php
}
?>
</ul>
<?php
if ($total_topics == 0) {
?>
<!--- Topic Code --->
开发者ID:Entellus,项目名称:System,代码行数:31,代码来源:share.php
示例13: timeAgo
echo $repo->html_url;
?>
"><?php
echo $repo->name;
?>
</a> <small><?php
echo $repo->collaborator_count;
?>
Contributors</small>
</h2>
<p><?php
echo $repo->description;
?>
</p>
<p><?php
echo "Last updated " . timeAgo($repo->pushed_at);
?>
</p>
</div>
</div>
<?php
}
?>
</div>
</div>
</div>
</div>
<?php
$this->load->view('include/social_sidebar.php');
?>
开发者ID:kronus7713,项目名称:web2015,代码行数:31,代码来源:projects.php
示例14: timeAgo
"
<?php
}
?>
alt="user photo" class="media-object img-circle width-50" style="height: 50px;" />
</div>
<div class="media-body message">
<h4 class="text-subhead margin-none"><a href="user_view?username=<?php
echo $row['sender'];
?>
"><?php
echo $row['sender'];
?>
</a></h4>
<p class="text-caption text-light"><i class="fa fa-clock-o"></i> <?php
echo timeAgo($row['time']);
?>
</p>
</div>
</div>
<p><?php
echo $row['message'];
?>
</p>
</div>
</div>
<?php
}
//end of while loop
} else {
?>
开发者ID:Osademe-e,项目名称:knotandrings,代码行数:31,代码来源:message_load.php
示例15: formPosts
/**
* Creates an array of posts in a format to print on the page given a mysql
* reponse of posts.
*/
function formPosts($rows)
{
$posts = [];
foreach ($rows as $row) {
$users = Lib::query("SELECT * FROM users WHERE id = ?", $row["user_id"]);
$user = $users[0];
//first and only user
$votes = Lib::query("SELECT * FROM votes WHERE post_id = ?", $row["id"]);
$numberLikes = count($votes);
$userVotes = Lib::query("SELECT * FROM votes WHERE post_id = ? AND user_id = ?", $row["id"], $_SESSION["id"]);
$liked = false;
if (count($userVotes) == 1) {
$liked = true;
}
$topics = Lib::query("SELECT * FROM topics WHERE id = ?", $row["topic_id"]);
$topic = $topics[0];
$posts[] = ["id" => $row["id"], "user" => $user, "date" => timeAgo(strtotime($row["date"])), "text" => $row["text"], "likes" => $numberLikes, "liked" => $liked, "topic" => $topic];
}
return $posts;
}
开发者ID:tomkoker,项目名称:thenetwork,代码行数:24,代码来源:helpers.php
示例16: registry_url
<a href="<?php
echo registry_url('registry_object/view/' . $record->registry_object_id);
?>
">
<img class="class_icon pull-left" style="width:20px;padding-right:10px;" src="<?php
echo registry_url('assets/img/party.png');
?>
">
<div class="pull-left" style="line-height:10px;">
<small>
<?php
echo ellipsis($record->title, 55);
?>
<small class="clearfix muted">Updated <?php
echo timeAgo($record->updated);
?>
</small>
</small>
</div>
<span class="tag pull-right status_<?php
echo $record->status;
?>
"><?php
echo readable($record->status, true);
?>
</span> </a>
<br class="clear"/>
<?php
}
} else {
开发者ID:aaryani,项目名称:RD-Switchboard-Net,代码行数:31,代码来源:dashboard_records.php
示例17: user
//$retweet = $tweet['retweeted_status'];
$isRetweet = !empty($retweet);
# Retweet - get the retweeter's name and screen name
$retweetingUser = $isRetweet ? $tweet['user']['name'] : null;
$retweetingUserScreenName = $isRetweet ? $tweet['user']['screen_name'] : null;
# Tweet source user (could be a retweeted user and not the owner of the timeline)
$user = !$isRetweet ? $tweet['user'] : $retweet['user'];
$userName = $user['name'];
$userScreenName = $user['screen_name'];
$userAvatarURL = stripcslashes($user['profile_image_url']);
$userAccountURL = 'http://twitter.com/' . $userScreenName;
# The tweet
$id = $tweet['id'];
$formattedTweet = !$isRetweet ? formatTweet($tweet['text']) : formatTweet($retweet['text']);
$statusURL = 'http://twitter.com/' . $userScreenName . '/status/' . $id;
$date = timeAgo($tweet['created_at']);
# Reply
$replyID = $tweet['in_reply_to_status_id'];
$isReply = !empty($replyID);
# Tweet actions (uses web intents)
$replyURL = 'https://twitter.com/intent/tweet?in_reply_to=' . $id;
$retweetURL = 'https://twitter.com/intent/retweet?tweet_id=' . $id;
$favoriteURL = 'https://twitter.com/intent/favorite?tweet_id=' . $id;
?>
<!--HERE'S THE RESULT-->
<li >
<a href="<?php
echo $userAccountURL;
?>
"><img src="<?php
echo $userAvatarURL;
开发者ID:jabezmijares,项目名称:Twitter_API_Fetching_Feeds,代码行数:31,代码来源:index.php
示例18: timeAgo
include "exe1.php";
function timeAgo($time)
{
$curtime = time();
$timediff = $curtime - $time;
/* $totaltimedifference= timeAgo((strtotime('01-01-2015 04:30:00 PM')));
if(($totaltimedifference/(3600*24))>1)
echo intval(($totaltimedifference/(3600*24))).' days ago';
else if(($totaltimedifference/(3600))>1)
echo intval(($totaltimedifference/(3600))).' minutes ago';
else
echo intval((($totaltimedifference/60))).' seconds ago'; */
if ($timediff / (3600 * 24) > 1) {
$totaltimediff = intval($timediff / (3600 * 24)) . ' days';
} else {
if ($timediff / 3600 > 1) {
$totaltimediff = intval($timediff / 3600) . ' minutes';
} else {
if ($timediff / 60 > 1) {
$totaltimediff = intval($timediff / 60) . ' seconds';
}
}
}
return $totaltimediff;
}
$actualtimedifference = timeAgo(strtotime('04-01-2014 08:30:55 AM'));
echo $actualtimedifference;
开发者ID:ramasubbaiya,项目名称:PHP_Term_1_Course_Work,代码行数:31,代码来源:exe2.php
示例19: timeAgo
}
?>
" alt="profile image" class="img-circle width-40" />
</div>
<div class="media-body">
<h4 style="margin-bottom: 0px;"><a href="user_view?username=<?php
echo $row['username'];
?>
"><?php
echo $row['username'];
?>
</a>
<br/>
</h4>
<b><?php
echo timeAgo($row['timestamp']);
?>
</b>
<p class="pull-right"><b>
<?php
if ($post_views == '') {
echo "0 view";
} elseif ($post_views == 0 || $post_views == 1) {
echo number_format($post_views) . " view";
} else {
echo number_format($post_views) . " views";
}
?>
</b></p>
</div>
</div>
开发者ID:Osademe-e,项目名称:knotandrings,代码行数:31,代码来源:category.php
示例20: view
function view()
{
global $MSublet;
global $MStudent;
// Validations
$this->startValidations();
$this->validate(isset($_GET['id']) and ($entry = $MSublet->get($id = $_GET['id'])) != NULL, $err, 'unknown sublet');
if ($this->isValid()) {
$this->validate($entry['publish'] or isset($_SESSION['_id']) and $entry['student'] == $_SESSION['_id'], $err, 'access denied');
}
// Code
if ($this->isValid()) {
$data = array('commented' => false);
if (isset($_POST['addcomment'])) {
function dataComment($data)
{
$comment = clean($data['comment']);
return array('comment' => $comment);
}
global $params;
extract($data = dataComment($params));
array_unshift($entry['comments'], array('time' => time(), 'commenter' => $_SESSION['_id'], 'comment' => $comment));
$data['commented'] = true;
// Notify us of the comment
$commenter = $_SESSION['email'];
$message = "\n <b>{$commenter}</b> has commented on <a href=\"http://sublite.net/housing/sublet.php?id={$id}\">{$id}</a>:\n <br /><br />\n {$comment}\n ";
sendgmail(array('[email protected]', '[email protected]'), "[email protected]", 'Comment posted on SubLite!', $message);
// Notify the subletter of the comment
$subletterEmail = StudentModel::getById($entry['student'])['email'];
$subletterName = $_SESSION['name'];
$message = "\n Hey there!\n <br /><br />\n {$subletterName} has commented on your sublet!\n Check it out <a href=\"http://sublite.net/housing/sublet.php?id={$id}\">here</a>.\n <br /><br />\n View your sublet:\n <a href=\"http://sublite.net/housing/sublet.php?id={$id}\">\n http://sublite.net/housing/sublet.php?id={$id}\n </a>\n <br /><br />\n Happy subletting,<br />\n SubLite Team\n ";
sendgmail(array($subletterEmail), "[email protected]", 'You have a new comment on your sublet! | SubLite', $message);
}
$entry['stats']['views']++;
$MSublet->save($entry);
$data = array_merge($entry, $data);
$data['_id'] = $entry['_id'];
$data['mine'] = (isset($_SESSION['_id']) and $entry['student'] == $_SESSION['_id']);
// ANY MODiFICATIONS ON DATA GOES HERE
$s = $MStudent->getById($entry['student']);
if ($s == NULL) {
$entry['publish'] = false;
$MSublet->save($entry);
self::error('this listing is no longer available');
self::render('notice');
return;
}
$data['studentname'] = $s['name'];
$data['studentid'] = $s['_id']->{'$id'};
$data['studentclass'] = $s['class'] > 0 ? " '" . substr($s['class'], -2) : '';
$data['studentschool'] = strlen($s['school']) > 0 ? $s['school'] : 'Undergraduate';
$data['studentpic'] = isset($s['photo']) ? $s['photo'] : $GLOBALS['dirpreFromRoute'] . 'assets/gfx/defaultpic.png';
global $S;
$data['studentcollege'] = $S->nameOf($s['email']);
$data['studentbio'] = isset($s['bio']) ? $s['bio'] : 'Welcome to my profile!';
if (isset($_SESSION['loggedinstudent'])) {
$me = $MStudent->me();
$data['studentmsg'] = "Hi " . $data['studentname'] . ",%0A%0A" . "I am writing to inquire about your listing '" . $data['title'] . "' (http://sublite.net/housing/sublet.php?id=" . $entry['_id'] . ").%0A%0A" . "Best,%0A" . $me['name'];
}
$data['latitude'] = $data['geocode']['latitude'];
$data['longitude'] = $data['geocode']['longitude'];
$data['address'] = $data['address'] . ', ' . $data['city'] . ', ' . $data['state'];
if (count($data['photos']) == 0) {
$data['photos'][] = $GLOBALS['dirpreFromRoute'] . 'assets/gfx/subletnophoto.png';
}
$data['startdate'] = fdate($data['startdate']);
$data['enddate'] = fdate($data['enddate']);
switch ($data['gender']) {
case 'male':
$data['gender'] = 'Male only';
break;
case 'female':
$data['gender'] = 'Female only';
break;
}
for ($i = 0; $i < count($data['comments']); $i++) {
$comment = $data['comments'][$i];
$commenter = $MStudent->getById($comment['commenter']);
$data['comments'][$i] = array('name' => $commenter['name'], 'photo' => $commenter['photo'], 'time' => timeAgo($comment['time']), 'text' => $comment['comment']);
}
self::displayMetatags('sublet');
self::render('student/sublets/viewsublet', $data);
return;
}
self::error($err);
self::render('notice');
}
开发者ID:davidliuliuliu,项目名称:sublite,代码行数:87,代码来源:SubletController.php
注:本文中的timeAgo函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论