本文整理汇总了PHP中Date::short_span方法的典型用法代码示例。如果您正苦于以下问题:PHP Date::short_span方法的具体用法?PHP Date::short_span怎么用?PHP Date::short_span使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Date
的用法示例。
在下文中一共展示了Date::short_span方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: content
/**
* Render view.
*
* @return string
*/
public function content()
{
if (!$this->topics) {
return '';
}
ob_start();
?>
<ul class="unstyled">
<?php
foreach ($this->topics as $topic) {
?>
<li>
<small class="ago"><?php
echo HTML::time(Date::short_span($topic->last_posted, true), $topic->last_posted);
?>
</small>
<?php
echo HTML::anchor(Route::model($topic), '<i class="muted iconic-upload"></i>', array('title' => __('First post')));
?>
<?php
echo HTML::anchor(Route::model($topic, '?page=last#last'), HTML::chars($topic->name), array('title' => $topic->name));
?>
</li>
<?php
}
?>
</ul>
<?php
return ob_get_clean();
}
示例2: content
/**
* Render view.
*
* @return string
*/
public function content()
{
ob_start();
// Title
if ($this->area->description) {
echo $this->area->description . '<hr>';
}
if ($this->area->topic_count) {
// Area has topics
$last_topic = $this->area->last_topic();
$last_poster = $last_topic->last_post()->author();
?>
<div class="media">
<div class="pull-left">
<?php
echo HTML::avatar($last_poster ? $last_poster['avatar'] : null, $last_poster ? $last_poster['username'] : null, false);
?>
</div>
<div class="media-body">
<small class="ago"><?php
echo HTML::time(Date::short_span($last_topic->last_posted, true, true), $last_topic->last_posted);
?>
</small>
<?php
echo $last_poster ? HTML::user($last_poster) : HTML::chars($last_topic->last_poster);
?>
<br>
<?php
echo HTML::anchor(Route::model($last_topic, '?page=last#last'), Forum::topic($last_topic), array('title' => HTML::chars($last_topic->name)));
?>
<br />
</div>
</div>
<small class="stats muted">
<i class="icon-comments"></i> <?php
echo Num::format($this->area->topic_count, 0);
?>
<i class="icon-comment"></i> <?php
echo Num::format($this->area->post_count, 0);
?>
</small>
<?php
} else {
// Empty area
echo __('No topics yet.');
}
return ob_get_clean();
}
示例3: content
/**
* Render newsfeed.
*
* @return string
*/
public function content()
{
if ($items = $this->_items()) {
ob_start();
?>
<ul class="media-list">
<?php
foreach ($items as $item) {
?>
<li class="media">
<div class="pull-left">
<?php
echo HTML::avatar($item['user']['avatar'], $item['user']['username'], $this->mini);
?>
</div>
<div class="media-body">
<?php
echo HTML::user($item['user']);
?>
<small class="pull-right"><?php
echo HTML::time(Date::short_span($item['stamp'], true, true), $item['stamp']);
?>
</small>
<?php
echo $item['text'];
?>
</div>
</li>
<?php
}
?>
</ul>
<?php
return ob_get_clean();
}
return __('Whoa, we are totally out of news items for you!');
}
示例4: content
/**
* Render view.
*
* @return string
*/
public function content()
{
ob_start();
$friends = array();
foreach ($this->user->find_friends() as $friend_id) {
$friend = Model_User::find_user_light($friend_id);
$friends[$friend['username']] = $friend;
}
ksort($friends, SORT_LOCALE_STRING);
?>
<ul class="unstyled">
<?php
foreach ($friends as $friend) {
?>
<li class="row-fluid">
<?php
echo HTML::avatar($friend['avatar'], $friend['username']);
?>
<?php
echo HTML::user($friend);
?>
<?php
if ($friend['last_login']) {
echo '<small class="ago">' . HTML::time(Date::short_span($friend['last_login'], true, true), $friend['last_login']) . '</small>';
}
?>
</li>
<?php
}
?>
</ul>
<?php
return ob_get_clean();
}
示例5: content
/**
* Render newsfeed.
*
* @return string
*/
public function content()
{
if ($items = $this->_items()) {
ob_start();
?>
<ul class="unstyled">
<?php
foreach ($items as $item) {
?>
<li class="row-fluid">
<?php
echo HTML::avatar($item['user']['avatar'], $item['user']['username'], $this->mini);
?>
<?php
echo HTML::user($item['user']);
?>
<small class="ago"><?php
echo HTML::time(Date::short_span($item['stamp'], true, true), $item['stamp']);
?>
</small>
<?php
echo $item['text'];
?>
</li>
<?php
}
?>
</ul>
<?php
return ob_get_clean();
}
return __('Whoa, we are totally out of news items for you!');
}
示例6: content
/**
* Render view.
*
* @return string
*/
public function content()
{
ob_start();
if (count($this->topics)) {
?>
<table class="table">
<thead>
<tr>
<th class="span1 from"><?php
echo __('From');
?>
</th>
<th class="span5 topic"><?php
echo __('Topic');
?>
</th>
<th class="span1 replies"><?php
echo __('Replies');
?>
</th>
<th class="span2 latest"><?php
echo __('Latest post');
?>
</th>
</tr>
</thead>
<tbody>
<?php
foreach ($this->topics as $topic) {
?>
<tr>
<td class="from">
<?php
echo HTML::user($topic->author_id, $topic->author_name);
?>
</td>
<td class="topic">
<?php
echo HTML::anchor(Route::model($topic, '?page=last#last'), '<i class="' . (($recipients = $topic->recipient_count) < 3 ? 'icon-envelope' : 'icon-comment') . ' icon-white"></i> ' . HTML::chars($topic->name), array('title' => $recipients < 3 ? __('Personal message') : __(':recipients recipients', array(':recipients' => Num::format($recipients, 0)))));
?>
</td>
<td class="replies">
<?php
echo Num::format($topic->post_count - 1, 0);
?>
</td>
<td class="latest">
<small class="ago"><?php
echo HTML::time(Date::short_span($topic->last_posted, true, true), $topic->last_posted);
?>
</small>
<?php
echo HTML::user($topic->last_poster, $topic->last_poster);
?>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
<?php
} else {
// Empty area
echo new View_Alert(__('Here be nothing yet.'), null, View_Alert::INFO);
}
return ob_get_clean();
}
示例7: content
/**
* Render view.
*
* @return string
*/
public function content()
{
ob_start();
$areas = $this->group->areas();
if (count($areas)) {
?>
<table class="table">
<thead>
<tr>
<th class="span4"><h3><?php
echo HTML::anchor(Route::model($this->group), HTML::chars($this->group->name));
?>
</h3></th>
<th class="span1"><?php
echo __('Topics');
?>
</th>
<th class="span1"><?php
echo __('Posts');
?>
</th>
<th class="span2"><?php
echo __('Latest post');
?>
</th>
</tr>
</thead>
<tbody>
<?php
foreach ($areas as $area) {
?>
<?php
if (Permission::has($area, Model_Forum_Area::PERMISSION_READ, self::$_user)) {
?>
<tr>
<td>
<h4><?php
echo HTML::anchor(Route::model($area), HTML::chars($area->name));
?>
</h4>
<?php
echo $area->description;
?>
</td>
<td><?php
echo Num::format($area->topic_count, 0);
?>
</td>
<td><?php
echo Num::format($area->post_count, 0);
?>
</td>
<td>
<?php
if ($area->topic_count > 0) {
$last_topic = $area->last_topic();
?>
<small class="ago"><?php
echo HTML::time(Date::short_span($last_topic->last_posted, true, true), $last_topic->last_posted);
?>
</small>
<?php
echo HTML::user($last_topic->last_post()->author_id, $last_topic->last_poster);
?>
<br />
<?php
echo HTML::anchor(Route::model($last_topic), '<i class="muted iconic-upload"></i>', array('title' => __('First post')));
?>
<?php
echo HTML::anchor(Route::model($last_topic, '?page=last#last'), HTML::chars($last_topic->name), array('title' => HTML::chars($last_topic->name)));
?>
<?php
} else {
?>
<sup><?php
echo __('No topics yet.');
?>
</sup>
<?php
}
?>
</td>
</tr>
//.........这里部分代码省略.........
示例8: implode
?>
" class="<?php
echo implode(' ', $classes);
?>
">
<?php
echo HTML::avatar($author['avatar'], $author['username'], true);
?>
<?php
echo HTML::user($author);
?>
<small class="ago"><?php
echo in_array('new', $classes) ? __('New') : '';
?>
<?php
echo HTML::time(Date::short_span($comment->created, true, true), $comment->created);
?>
</small>
<?php
if ($user && $comment->user_id == $user->id || $mine) {
?>
<nav class="actions inline">
<?php
if ($private && !$comment->private) {
?>
<?php
echo HTML::anchor(sprintf($private, $comment->id), __('Set as private'), array('class' => 'action small comment-private'));
?>
<?php
}
示例9: content
/**
* Render view.
*
* @return string
*/
public function content()
{
if (!$this->groups) {
return new View_Alert(__('No groups available..'), __('Oh snap!'), View_Alert::ERROR);
}
ob_start();
?>
<ol class="list-unstyled">
<?php
foreach ($this->groups as $group) {
?>
<li>
<h4><?php
echo HTML::chars($group->name);
?>
</h4>
<ol class="list-unstyled">
<?php
$areas = $group->areas();
if (count($areas)) {
foreach ($areas as $area) {
?>
<li>
<?php
if (Permission::has($area, Model_Forum_Area::PERMISSION_READ)) {
// Can read area
if ($area->topic_count > 0) {
$last_topic = $area->last_topic();
if ($last_topic->last_posted) {
echo '<small class="pull-right muted">' . HTML::time(Date::short_span($last_topic->last_posted, true, true), $last_topic->last_posted) . '</small>';
}
}
echo HTML::anchor(Route::model($area), HTML::chars($area->name), array('class' => 'hoverable'));
} elseif ($area->status != Model_Forum_Area::STATUS_HIDDEN) {
// Can't read area
echo HTML::chars($area->name);
}
?>
</li>
<?php
}
} else {
?>
<li>
<?php
echo __('No areas available.');
?>
<br>
<?php
if (Permission::has($group, Model_Forum_Group::PERMISSION_UPDATE)) {
?>
<?php
echo HTML::anchor(Route::model($group, 'edit'), '<i class="icon-edit"></i> ' . __('Edit group'), array('class' => 'btn btn-inverse'));
?>
<?php
}
?>
<?php
if (Permission::has($group, Model_Forum_Group::PERMISSION_CREATE_AREA)) {
?>
<?php
echo HTML::anchor(Route::model($group, 'add'), '<i class="icon-plus-sign"></i> ' . __('New area'), array('class' => 'btn btn-primary'));
?>
<?php
}
?>
</li>
<?php
}
?>
</ol>
</li>
<?php
}
?>
</ol>
<?php
return ob_get_clean();
}
示例10: content
/**
* Render view.
*
* @return string
*/
public function content()
{
ob_start();
?>
<div class="pull-left">
<?php
if ($this->author) {
?>
<?php
echo HTML::avatar($this->author->avatar, $this->author->username);
?>
<p>
<small><?php
echo __('Posts: :posts', array(':posts' => '<var>' . Num::format($this->author->post_count, 0) . '</var>'));
?>
</small>
</p>
<?php
} else {
?>
<?php
echo HTML::avatar(false);
?>
<?php
}
?>
</div>
<div class="arrow"></div>
<div class="media-body">
<header<?php
echo $this->forum_post->id == $this->forum_topic->last_post_id ? ' id="last"' : '';
?>
>
<small class="ago">
<?php
echo HTML::anchor(Route::url($this->private ? 'forum_private_post' : 'forum_post', array('id' => Route::model_id($this->forum_post), 'topic_id' => Route::model_id($this->forum_topic))) . '#post-' . $this->forum_post->id, '#' . $this->nth, array('title' => __('Permalink')));
?>
•
<?php
if (Permission::has($this->forum_post, Model_Forum_Post::PERMISSION_UPDATE, self::$_user)) {
echo HTML::anchor(Route::url($this->private ? 'forum_private_post' : 'forum_post', array('id' => Route::model_id($this->forum_post), 'topic_id' => Route::model_id($this->forum_topic), 'action' => 'edit')), __('Edit'), array('class' => 'post-edit')) . ' • ';
}
?>
<?php
if (Permission::has($this->forum_post, Model_Forum_Post::PERMISSION_DELETE, self::$_user)) {
echo HTML::anchor(Route::url($this->private ? 'forum_private_post' : 'forum_post', array('id' => Route::model_id($this->forum_post), 'topic_id' => Route::model_id($this->forum_topic), 'action' => 'delete')) . '?token=' . Security::csrf(), __('Delete'), array('class' => 'post-delete')) . ' • ';
}
?>
<?php
if (Permission::has($this->forum_topic, Model_Forum_Topic::PERMISSION_POST, self::$_user)) {
echo HTML::anchor(Route::url($this->private ? 'forum_private_post' : 'forum_post', array('id' => Route::model_id($this->forum_post), 'topic_id' => Route::model_id($this->forum_topic), 'action' => 'quote')), __('Reply'), array('class' => 'post-quote')) . ' • ';
}
?>
<?php
echo HTML::time(Date::short_span($this->forum_post->created, true, true), $this->forum_post->created);
?>
</small>
<?php
if ($this->author) {
echo HTML::user($this->author->light_array());
if ($this->author->title) {
echo ' <small>“' . HTML::chars($this->author->title) . '”</small>';
}
} else {
echo $this->forum_post->author_name;
echo ' <small>“' . __('Guest') . '”</small>';
}
?>
</header>
<?php
if ($this->forum_post->parent_id) {
echo __('Replying to :parent', array(':parent' => HTML::anchor(Route::url($this->private ? 'forum_private_post' : 'forum_post', array('topic_id' => Route::model_id($this->forum_topic), 'id' => $this->forum_post->parent_id)) . '#post-' . $this->forum_post->parent_id, HTML::chars($this->forum_post->parent()->topic()->name))));
}
?>
<?php
echo BB::factory($this->forum_post->post)->render();
?>
<footer>
<?php
//.........这里部分代码省略.........
示例11: __
echo __('Guest');
?>
</small>
<?php
}
?>
</section>
<section class="post-content grid6">
<header<?php
echo $post->id == $topic->last_post_id ? ' id="last"' : '';
?>
>
<small class="ago">
<?php
echo HTML::time(Date::short_span($post->created, true, true), $post->created);
?>
</small>
<nav class="actions">
<?php
echo HTML::anchor(Route::get($private ? 'forum_private_post' : 'forum_post')->uri(array('id' => Route::model_id($post), 'topic_id' => Route::model_id($topic))) . '#post-' . $post->id, '#' . $number, array('title' => __('Permalink')));
?>
<?php
if (Permission::has($post, Model_Forum_Post::PERMISSION_UPDATE, $user)) {
echo HTML::anchor(Route::get($private ? 'forum_private_post' : 'forum_post')->uri(array('id' => Route::model_id($post), 'topic_id' => Route::model_id($topic), 'action' => 'edit')), __('Edit'), array('class' => 'action post-edit small'));
}
?>
<?php
示例12: array
?>
<article>
<header class="grid6 first topic">
<?php
echo HTML::anchor(Route::model($topic, '?page=last#last'), Forum::topic($topic), array('class' => 'grid5 first'));
?>
<span class="grid1 replies"><?php
echo Num::format($topic->post_count - 1, 0);
?>
</span>
</header>
<p class="grid2 latest">
<small class="ago"><?php
echo HTML::time(Date::short_span($topic->last_posted, true, true), $topic->last_posted);
?>
</small>
<?php
echo HTML::user($topic->last_poster, $topic->last_poster);
?>
</p>
</article>
<?php
}
?>
<?php
} else {
?>
示例13: foreach
* @copyright (c) 2010 Antti Qvickström
* @license http://www.opensource.org/licenses/mit-license.php MIT license
*/
?>
<ul>
<?php
foreach ($newsfeed as $item) {
?>
<li class="group">
<?php
echo HTML::avatar($item['user']->avatar, $item['user']->username, isset($mini) && $mini);
?>
<?php
echo HTML::user($item['user']);
?>
<small class="ago"><?php
echo HTML::time(Date::short_span($item['stamp'], true, true), $item['stamp']);
?>
</small>
<?php
echo $item['text'];
?>
</li>
<?php
}
?>
</ul>
示例14: __
* @license http://www.opensource.org/licenses/mit-license.php MIT license
*/
?>
<?php
if (empty($topics)) {
?>
<span class="notice"><?php
echo __('No topics found');
?>
</span>
<?php
} else {
?>
<ul>
<?php
foreach ($topics as $topic) {
?>
<li>
<?php
echo HTML::anchor(Route::model($topic, '?page=last#last'), HTML::chars($topic->name), array('title' => '[' . Date::short_span($topic->last_posted, false) . '] ' . $topic->name));
?>
</li>
<?php
}
?>
</ul>
<?php
}
示例15: content
/**
* Render view.
*
* @return string
*/
public function content()
{
ob_start();
if (count($this->topics)) {
?>
<table class="table">
<thead>
<tr>
<th class="span4 topic"><?php
echo __('Topic');
?>
</th>
<th class="span1 replies"><?php
echo __('Replies');
?>
</th>
<th class="span2 latest"><?php
echo __('Latest post');
?>
</th>
</tr>
</thead>
<tbody>
<?php
foreach ($this->topics as $topic) {
?>
<tr>
<td class="topic">
<?php
echo HTML::anchor(Route::model($topic), Forum::topic($topic));
?>
<?php
echo HTML::anchor(Route::model($topic, '?page=last#last'), '<i class="muted iconic-download"></i>', array('title' => __('Last post')));
?>
</td>
<td class="replies">
<?php
echo Num::format($topic->post_count - 1, 0);
?>
</td>
<td class="latest">
<small class="ago"><?php
echo HTML::time(Date::short_span($topic->last_posted, true, true), $topic->last_posted);
?>
</small>
<?php
echo HTML::user($topic->last_poster, $topic->last_poster);
?>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
<?php
} else {
// Empty area
echo new View_Alert(__('Here be nothing yet.'), null, View_Alert::INFO);
}
return ob_get_clean();
}