当前位置: 首页>>代码示例>>PHP>>正文


PHP date::timespan_short方法代码示例

本文整理汇总了PHP中date::timespan_short方法的典型用法代码示例。如果您正苦于以下问题:PHP date::timespan_short方法的具体用法?PHP date::timespan_short怎么用?PHP date::timespan_short使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在date的用法示例。


在下文中一共展示了date::timespan_short方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __

			<?php 
}
?>
			</span>

			<span class="details">
			<?php 
echo __(':user, :ago ago', array(':user' => html::user($post->author_id, $post->author_name), ':ago' => html::time(date::timespan_short($post->created), $post->created)));
?>
			<?php 
if ($post->modifies > 0) {
    ?>
			<br />
			<?php 
    echo __('Edited :ago ago', array(':ago' => html::time(date::timespan_short($post->modified), $post->modified)));
    ?>
			<?php 
}
?>
			<?php 
if ($post->parent_id) {
    $parent_topic = $post->parent->forum_topic;
    ?>
			<br />
			<?php 
    echo __('Replying to :parent', array(':parent' => html::anchor(url::model($parent_topic) . '/' . $post->parent_id . '#post-' . $post->parent_id, text::title($parent_topic->name))));
    ?>
			<?php 
}
?>
开发者ID:anqqa,项目名称:Anqh,代码行数:30,代码来源:post.php

示例2: _view

 /**
  * User profile
  */
 public function _view()
 {
     $this->tab_id = 'profile';
     $owner = $this->user && $this->member->id == $this->user->id;
     if ($owner && $this->user->newcomments) {
         $this->user->newcomments = 0;
         $this->user->save();
     }
     // Actions
     if ($this->member->has_access(User_Model::ACCESS_EDIT)) {
         $this->page_actions[] = array('link' => url::user($this->member) . '/edit', 'text' => __('Settings'), 'class' => 'settings');
     }
     // Picture
     widget::add('side', View_Mod::factory('member/member', array('mod_class' => 'member member-' . $this->member->id, 'user' => $this->member)));
     // Comments
     if ($this->member->has_access(User_Model::ACCESS_COMMENT)) {
         $comment = new User_Comment_Model();
         $form_values = $comment->as_array();
         $form_errors = array();
         // check post
         if (csrf::valid() && ($post = $this->input->post())) {
             $comment->user_id = $this->member->id;
             $comment->author_id = $this->user->id;
             $comment->comment = $post['comment'];
             if (isset($post['private'])) {
                 $comment->private = 1;
             }
             try {
                 $comment->save();
                 if (!$owner) {
                     $this->member->newcomments += 1;
                     $this->member->save();
                 }
                 $this->user->commentsleft += 1;
                 $this->user->save();
                 if (!request::is_ajax()) {
                     url::redirect(url::current());
                 }
             } catch (ORM_Validation_Exception $e) {
                 $form_errors = $e->validation->errors();
                 $form_values = arr::overwrite($form_values, $post);
             }
         }
         // Handle pagination
         $per_page = 25;
         $page_num = $this->uri->segment('page') ? $this->uri->segment('page') : 1;
         $page_offset = ($page_num - 1) * $per_page;
         $total_comments = $this->member->get_comment_count();
         $comments = $this->member->find_comments($page_num, $per_page, $this->user);
         $pagination = new Pagination(array('items_per_page' => $per_page, 'total_items' => $total_comments));
         $view = View::factory('generic/comments', array('delete' => '/member/comment/%d/delete/?token=' . csrf::token(), 'private' => '/member/comment/%d/private/?token=' . csrf::token(), 'comments' => $comments, 'errors' => $form_errors, 'values' => $form_values, 'pagination' => $pagination, 'user' => $this->user));
         if (request::is_ajax()) {
             echo $view;
             return;
         }
         widget::add('main', $view);
     }
     // Basic info
     $basic_info = array();
     if (!empty($this->member->name)) {
         $basic_info[__('Name')] = html::specialchars($this->member->name);
     }
     if (!empty($this->member->city_name)) {
         $basic_info[__('City')] = html::specialchars($this->member->city_name);
     }
     if (!empty($this->member->dob) && $this->member->dob != '0000-00-00') {
         $basic_info[__('Date of Birth')] = __(':dob (:years years)', array(':dob' => date::format('DMYYYY', $this->member->dob), ':years' => date::timespan(strtotime($this->member->dob), null, 'years')));
     }
     if (!empty($this->member->gender)) {
         $basic_info[__('Gender')] = $this->member->gender == 'm' ? __('Male') : __('Female');
     }
     if (!empty($this->member->latitude) && !empty($this->member->longitude)) {
         $basic_info[__('Location')] = $this->member->latitude . ', ' . $this->member->longitude;
         $basic_info[__('Location')] = html::anchor('#map', __('Toggle map'), array('class' => 'expander', 'title' => __('Show/hide'))) . '<div id="map" style="display: none">' . __('Map loading') . '</div>';
         $map = new Gmap('map', array('ScrollWheelZoom' => true));
         $map->center($this->member->latitude, $this->member->longitude, 15)->controls('small')->types();
         $map->add_marker($this->member->latitude, $this->member->longitude, html::avatar($this->member->avatar, $this->member->username) . html::user($this->member));
         widget::add('foot', html::script_source($map->render('gmaps/jquery_event')));
         widget::add('foot', html::script_source("\$('a[href*=\"#map\"]:first').click(function() { \$('#map').toggle('normal', gmap_open); return false; });"));
     }
     // Site info
     $site_info = array(__('Registered') => date::format('DMYYYY_HM', $this->member->created) . ' [#' . $this->member->id . ']', __('Logins') => __(':logins (:ago ago)', array(':logins' => number_format($this->member->logins, 0), ':ago' => '<abbr title="' . date::format('DMYYYY_HM', $this->member->last_login) . '">' . date::timespan_short($this->member->last_login) . '</abbr>')), __('Posts') => number_format($this->member->posts, 0), __('Comments') => number_format($this->member->commentsleft, 0));
     // Initialize tabs
     $tabs = array('basic-info' => array('href' => '#basic-info', 'title' => __('Basic info'), 'tab' => new View('generic/list_info', array('id' => 'basic-info', 'title' => __('Basic info'), 'list' => $basic_info))), 'site-info' => array('href' => '#site-info', 'title' => __('Site info'), 'tab' => new View('generic/list_info', array('id' => 'site-info', 'title' => __('Site info'), 'list' => $site_info))));
     widget::add('side', View::factory('generic/tabs', array('id' => 'info-tab', 'tabs' => $tabs)));
     $this->_side_views();
 }
开发者ID:anqqa,项目名称:Anqh,代码行数:90,代码来源:member.php

示例3: __

							<li class="unit size1of2"><?php 
            echo html::icon_value(array(':topics' => $area->topics), ':topics topic', ':topics topics', 'topics');
            ?>
</li>
							<li class="unit size1of2"><?php 
            echo html::icon_value(array(':posts' => $area->posts), ':posts post', ':posts posts', 'posts');
            ?>
</li>
						</ul>
					</header>
					<footer>
						<?php 
            if ($area->topics > 0) {
                ?>
						<?php 
                echo __('Last post in :area by :user :ago ago', array(':area' => html::anchor(url::model($area->last_topic) . '/page/last#last', text::limit_chars(text::title($area->last_topic->name), 20, '&hellip;', true), array('title' => html::specialchars($area->last_topic->name))), ':user' => html::user(null, $area->last_topic->last_poster), ':ago' => html::time(date::timespan_short($area->last_topic->last_posted), $area->last_topic->last_posted)));
                ?>
						<?php 
            } else {
                ?>
						<sup><?php 
                echo __('No topics found');
                ?>
</sup>
						<?php 
            }
            ?>
					</footer>
				</article>

				<?php 
开发者ID:anqqa,项目名称:Anqh,代码行数:31,代码来源:groups.php

示例4: entry

 /**
  * Single blog entry
  *
  * @param  mixed   $entry_id or add
  * @param  string  $action
  */
 public function entry($entry_id, $action = false)
 {
     // Add new entry
     if ($entry_id == 'add') {
         $this->_entry_edit();
         return;
     } else {
         if ($action) {
             switch ($action) {
                 // Delete entry
                 case 'delete':
                     $this->_entry_delete($entry_id);
                     return;
                     // Edit event
                 // Edit event
                 case 'edit':
                     $this->_entry_edit($entry_id);
                     return;
             }
         }
     }
     $entry = new Blog_Entry_Model((int) $entry_id);
     $errors = $entry->id ? array() : __('Blog entry found :entry', array(':entry' => $entry_id));
     if (empty($errors)) {
         $this->breadcrumb[] = html::anchor(url::model($entry), $entry->name);
         $this->page_title = text::title($entry->name);
         $this->page_subtitle = __('By :user :ago ago', array(':user' => html::user($entry->author), ':ago' => html::time(date::timespan_short($entry->created), $entry->created)));
         if ($entry->is_author() || $this->visitor->logged_in('admin')) {
             $this->page_actions[] = array('link' => url::model($entry) . '/delete/?token=' . csrf::token($this->user->id), 'text' => __('Delete entry'), 'class' => 'entry-delete');
             $this->page_actions[] = array('link' => url::model($entry) . '/edit', 'text' => __('Edit entry'), 'class' => 'entry-edit');
         }
         widget::add('main', View::factory('blog/entry', array('entry' => $entry)));
         // Blog comments
         if ($this->visitor->logged_in()) {
             $comment = new Blog_Comment_Model();
             $form_values = $comment->as_array();
             $form_errors = array();
             // check post
             if (csrf::valid() && ($post = $this->input->post())) {
                 $comment->blog_entry_id = $entry->id;
                 $comment->user_id = $entry->author->id;
                 $comment->author_id = $this->user->id;
                 $comment->comment = $post['comment'];
                 if (isset($post['private'])) {
                     $comment->private = 1;
                 }
                 try {
                     $comment->save();
                     $entry->comments++;
                     $entry->newcomments++;
                     $entry->save();
                     if (!$comment->private) {
                         newsfeeditem_blog::comment($this->user, $entry);
                     }
                     if (!request::is_ajax()) {
                         url::redirect(url::current());
                     }
                 } catch (ORM_Validation_Exception $e) {
                     $form_errors = $e->validation->errors();
                     $form_values = arr::overwrite($form_values, $post);
                 }
             }
             $comments = $entry->find_comments();
             $view = View::factory('generic/comments', array('delete' => '/blogs/comment/%d/delete/?token=' . csrf::token(), 'private' => '/blogs/comment/%d/private/?token=' . csrf::token(), 'comments' => $comments, 'errors' => $form_errors, 'values' => $form_values, 'pagination' => null, 'user' => $this->user));
             if (request::is_ajax()) {
                 echo $view;
                 return;
             }
             widget::add('main', $view);
         }
         if (!$entry->is_author()) {
             $entry->views++;
             $entry->save();
         }
     }
     if (count($errors)) {
         $this->_error(Kohana::lang('generic.error'), $errors);
     }
 }
开发者ID:anqqa,项目名称:Anqh,代码行数:85,代码来源:blogs.php

示例5: foreach

 * @author     Antti Qvickström
 * @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="clearfix">
			<?php 
    echo html::avatar($item['user']->avatar, $item['user']->username);
    ?>
			<?php 
    echo html::user($item['user']);
    ?>
			<?php 
    echo $item['text'];
    ?>
			<?php 
    echo __(':ago ago', array(':ago' => html::time(date::timespan_short($item['stamp']), $item['stamp'])));
    ?>
		</li>
	<?php 
}
?>

</ul>
开发者ID:anqqa,项目名称:Anqh,代码行数:30,代码来源:newsfeed.php

示例6: foreach

 *
 * @package    Blog
 * @author     Antti Qvickström
 * @copyright  (c) 2010 Antti Qvickström
 * @license    http://www.opensource.org/licenses/mit-license.php MIT license
 */
?>

<?php 
foreach ($entries as $entry) {
    ?>

<article>
	<header>
		<?php 
    echo html::avatar($entry->author->avatar, $entry->author->username);
    ?>
		<h4><?php 
    echo html::anchor(url::model($entry), text::title($entry->name), array('title' => $entry->name));
    ?>
</h4>
		<span class="details">
		<?php 
    echo __('By :user :ago ago', array(':user' => html::user($entry->author), ':ago' => html::time(date::timespan_short($entry->created), $entry->created)));
    ?>
		</span>
	</header>
</article>

<?php 
}
开发者ID:anqqa,项目名称:Anqh,代码行数:31,代码来源:entries.php

示例7: __

        }
        ?>
					<?php 
        echo html::anchor(sprintf($delete, $comment->id), __('Delete'), array('class' => 'action comment-delete'));
        ?>
				</span>
				<?php 
    }
    ?>

				<?php 
    echo html::nick($comment->author_id, $comment->author->username);
    ?>
,
				<?php 
    echo __(':ago ago', array(':ago' => html::time(date::timespan_short($comment->created), $comment->created)));
    ?>
			</header>

			<p>
				<?php 
    echo $comment->private ? '<abbr title="' . __('Private comment') . '">' . __('Priv') . '</abbr>: ' : '';
    ?>
				<?php 
    echo text::smileys(text::auto_link_urls(html::specialchars($comment->comment)));
    ?>
			</p>
		</article>

		<?php 
}
开发者ID:anqqa,项目名称:Anqh,代码行数:31,代码来源:comments.php

示例8: __

    ?>
</h4>
		<ul class="details unit size1of6">
			<!-- <li class="unit size1of2"><?php 
    echo html::icon_value(array(':views' => $topic->reads), ':views view', ':views views', 'views');
    ?>
</li> -->
			<li class="unit size1of1"><?php 
    echo html::icon_value(array(':replies' => $topic->posts - 1), ':replies reply', ':replies replies', 'posts');
    ?>
</li>
		</ul>
	</header>
	<footer>
		<?php 
    if (isset($area)) {
        ?>
		<?php 
        echo __('In :area.', array(':area' => html::anchor(url::model($topic->forum_area), text::title($topic->forum_area->name), array('title' => strip_tags($topic->forum_area->description)))));
        ?>
		<?php 
    }
    ?>
		<?php 
    echo __('Last post by :user :ago ago', array(':user' => html::nick(false, $topic->last_poster), ':ago' => html::time(date::timespan_short($topic->last_posted), $topic->last_posted)));
    ?>
	</footer>
</article>

<?php 
}
开发者ID:anqqa,项目名称:Anqh,代码行数:31,代码来源:topics.php

示例9: foreach

 * @author     Antti Qvickström
 * @copyright  (c) 2010 Antti Qvickström
 * @license    http://www.opensource.org/licenses/mit-license.php MIT license
 */
?>

<?php 
foreach ($posts as $post) {
    // Time difference between posts
    $current = strtotime($post->created);
    $difference = isset($previous) ? date::timespan($current, $previous, 'years,months') : array('years' => 0, 'months' => 0);
    if ($difference['years'] || $difference['months']) {
        ?>

<div class="divider post-old"><?php 
        echo __('Previous post over :ago ago', array(':ago' => date::timespan_short($current, $previous)));
        ?>
</div>

<?php 
    }
    $previous = $current;
    echo View::factory('forum/post', array('topic' => $topic, 'post' => $post, 'user' => $user));
}
?>

<?php 
echo html::script_source('
$(function() {
	$("a.post-edit").live("click", function(e) {
		e.preventDefault();
开发者ID:anqqa,项目名称:Anqh,代码行数:31,代码来源:topic.php

示例10: foreach

<ul class="contentlist friends">
	<?php 
foreach ($friends as $friend) {
    ?>
	<li class="member clearfix">
		<?php 
    echo html::avatar($friend->friend->avatar, $friend->friend->username);
    ?>
		<?php 
    echo html::nick($friend->friend->id, $friend->friend->username);
    ?>
<br />
		<?php 
    echo __('Last online :ago ago', array(':ago' => '<abbr title="' . date::format('DMYYYY_HM', $friend->friend->last_login) . '">' . date::timespan_short($friend->friend->last_login) . '</abbr>'));
    ?>
	</li>
	<?php 
}
?>
</ul>
开发者ID:anqqa,项目名称:Anqh,代码行数:20,代码来源:friends.php

示例11: __

	<dl>
		<dt><?php 
echo __('Registered');
?>
:</dt><dd><?php 
echo date::format('DMYYYY_HM', $user->created);
?>
</dd>
		<dt><?php 
echo __('Logins');
?>
:</dt><dd><?php 
echo number_format($user->logins, 0);
?>
 (<?php 
echo __(':ago ago', array(':ago' => '<abbr title="' . date::format('DMYYYY_HM', $user->last_login) . '">' . date::timespan_short($user->last_login) . '</abbr>'));
?>
)</dd>
		<dt><?php 
echo __('Forum posts');
?>
:</dt><dd><?php 
echo number_format($user->posts, 0);
?>
</dd>
		<dt><?php 
echo __('Profile comments');
?>
:</dt><dd><?php 
echo number_format($user->commentsleft, 0);
?>
开发者ID:anqqa,项目名称:Anqh,代码行数:31,代码来源:info.php


注:本文中的date::timespan_short方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。