本文整理汇总了PHP中html::time方法的典型用法代码示例。如果您正苦于以下问题:PHP html::time方法的具体用法?PHP html::time怎么用?PHP html::time使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类html
的用法示例。
在下文中一共展示了html::time方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
}
示例2: __
<?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
}
?>
示例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, '…', 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
示例4: foreach
<?php
foreach ($galleries as $gallery) {
?>
<li class="unit size1of2">
<div class="thumb unit size2of5">
<?php
echo html::anchor(url::model($gallery), html::image('http://' . Kohana::config('site.image_server') . '/kuvat/' . $gallery->dir . '/thumb_' . $gallery->default_image->legacy_filename));
?>
</div>
<header>
<h4><?php
echo html::anchor(url::model($gallery), text::title($gallery->name));
?>
</h4>
<span class="details">
<?php
echo html::time(date::format('DMYYYY', $gallery->event_date), $gallery->event_date, true);
?>
,
<?php
echo __2(':images image', ':images images', $gallery->image_count, array(':images' => '<var>' . $gallery->image_count . '</var>'));
?>
</span>
</header>
</li>
<?php
}
?>
</ul>
示例5: 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
}
示例6: __
<dt><?php
echo __('Homepage');
?>
</dt><dd><?php
echo html::anchor($event->homepage);
?>
</dd>
<?php
}
?>
<dt><?php
echo __('Opening hours');
?>
</dt><dd><?php
echo $event->end_time ? __('From :from to :to', array(':from' => html::time(date::format('HHMM', $event->start_time), $event->start_time), ':to' => html::time(date::format('HHMM', $event->end_time), $event->end_time))) : __('From :from onwards', array(':from' => html::time(date::format('HHMM', $event->start_time), $event->start_time)));
?>
</dd>
<?php
if ($event->venue_id) {
?>
<dt><?php
echo __('Venue');
?>
</dt><dd><?php
echo html::anchor(url::model($event->venue), $event->venue->name);
?>
, <?php
echo html::specialchars($event->venue->city_name);
?>
示例7: 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>
示例8: event
/**
* Event view
*
* @param mixed $event_id or add
* @param string $action
*/
public function event($event_id, $action = false)
{
$this->tabs = null;
// Add new event
if ($event_id == 'add') {
$this->_event_edit();
return;
} else {
if ($action) {
switch ($action) {
// Delete event
case 'delete':
$this->_event_delete($event_id);
return;
// Edit event
// Edit event
case 'edit':
$this->_event_edit($event_id);
return;
// Add to favorites
// Add to favorites
case 'favorite':
$this->_favorite_add($event_id);
return;
// Remove from favorites
// Remove from favorites
case 'unfavorite':
$this->_favorite_delete($event_id);
return;
}
}
}
$event = new Event_Model((int) $event_id);
$errors = !$event->id ? array(__('Event not found')) : array();
if (empty($errors)) {
$this->breadcrumb[] = html::anchor(url::model($event), $event->name);
// Actions
if ($this->visitor->logged_in()) {
if ($event->is_favorite($this->user)) {
$this->page_actions[] = array('link' => url::model($event) . '/unfavorite/?token=' . csrf::token(), 'text' => __('Remove favorite'), 'class' => 'favorite-delete');
} else {
$this->page_actions[] = array('link' => url::model($event) . '/favorite/?token=' . csrf::token(), 'text' => __('Add favorite'), 'class' => 'favorite-add');
}
if ($event->is_author() || $this->visitor->logged_in(array('admin', 'event moderator'))) {
$this->page_actions[] = array('link' => url::model($event) . '/edit', 'text' => __('Edit event'), 'class' => 'event-edit');
}
}
list($year, $month, $day) = explode('-', date('Y-m-d', strtotime($event->start_time)));
$this->date->setDate($year, $month, $day);
$this->page_title = text::title($event->name);
$this->page_subtitle = html::time(date('l ', strtotime($event->start_time)) . date::format('DDMMYYYY', $event->start_time), $event->start_time, true);
$venue = array();
if ($event->venue_id) {
$venue[] = html::anchor(url::model($event->venue), $event->venue->name);
$venue[] = html::specialchars($event->venue->city_name);
} else {
if ($event->venue_name) {
$venue[] = $event->venue_url ? html::anchor($event->venue_url, $event->venue_name) : html::specialchars($event->venue_name);
if ($event->city_name) {
$venue[] = html::specialchars($event->city_name);
}
} else {
if ($event->city_name) {
$venue[] = html::specialchars($event->city_name);
}
}
}
if (count($venue)) {
$this->page_subtitle .= ' @ ' . implode(', ', $venue);
}
widget::add('main', View::factory('events/event', array('event' => $event)));
widget::add('side', View::factory('events/event_info', array('user' => $this->user, 'event' => $event)));
} else {
$this->_error(__('Error'), $errors);
}
//$this->_side_views();
}
示例9: __
}
?>
<?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
}
示例10: __
?>
</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
}
示例11: foreach
* Shouts
*
* @package Anqh
* @author Antti Qvickström
* @copyright (c) 2010 Antti Qvickström
* @license http://www.opensource.org/licenses/mit-license.php MIT license
*/
?>
<ul>
<?php
foreach ($shouts as $shout) {
?>
<li><?php
echo html::time(date::format('HHMM', $shout->created), $shout->created);
?>
<?php
echo html::user($shout->author);
?>
: <?php
echo html::chars($shout->shout);
?>
</li>
<?php
}
?>
</ul>
<?php