本文整理汇总了PHP中TemplateHelper::date方法的典型用法代码示例。如果您正苦于以下问题:PHP TemplateHelper::date方法的具体用法?PHP TemplateHelper::date怎么用?PHP TemplateHelper::date使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TemplateHelper
的用法示例。
在下文中一共展示了TemplateHelper::date方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getLastCommentsAjaxAction
/**
* Действие просмотра поста комментария:
*/
public function getLastCommentsAjaxAction(Application $application)
{
$cache = KVS::getInstance();
if ($cache->exists(__CLASS__, $_GET['id'], 'preview')) {
return unserialize($cache->get(__CLASS__, $_GET['id'], 'preview'));
}
$comment = Blog_BlogCommentsModel::GetComment($_GET['id']);
$result = false;
if ($comment) {
$post = Blog_BlogPostsModel::GetPost($comment['post_id']);
$comment['post_title'] = $post['title'];
$comment['created_at'] = TemplateHelper::date('d M Y @ H:i', $comment['created_at']);
$comment['author'] = array($comment['author'], HomeBoardHelper::getBoard($comment['author']));
unset($comment['ip']);
$result = $comment;
} elseif ($post = Blog_BlogPostsModel::GetPost($_GET['id'])) {
$result = array('id' => $post['id'], 'post_id' => $post['id'], 'post_title' => $post['title'], 'text' => $post['text'], 'author' => array($post['author'], HomeBoardHelper::getBoard($post['author'])), 'created_at' => TemplateHelper::date('d M Y @ H:i', $post['created_at']), 'post_preview' => true);
}
$cache->set(__CLASS__, $_GET['id'], 'preview', serialize($result));
$cache->expire(__CLASS__, $_GET['id'], 'preview', 60 * 60);
return $result;
}
示例2: foreach
if ($post['comments'] > 0) {
?>
<?php
foreach ($comments as $comment) {
?>
<div class="b-comment<?php
TemplateHelper::isNewComment($comment) and print " m-new";
?>
" id="comment_<?php
echo $comment['id'];
?>
">
<div class="b-comment_b-info">
<?php
echo TemplateHelper::date('d M Y @ H:i', $comment['created_at']);
?>
, <a href="#<?php
echo $comment['id'];
?>
">№</a><a href="javascript://" class="js-paste-link" name="<?php
echo $comment['id'];
?>
"><?php
echo $comment['id'];
?>
</a>
<a href="#" class="js-remove-button g-hidden">
<img src="http://<?php
echo TemplateHelper::getSiteUrl();
?>
示例3: function
return $dbh->delete('1chan_comment', 'id = ' . $dbh->q($id), 1);
}
return false;
}
}
/**
* Обработчики событий:
*/
EventModel::getInstance()->AddEventListener('add_comment', function ($data) {
$session = Session::getInstance();
$session->persistenceSet('last_comment_date', time());
$session->persistenceSet('last_post_text', $data['text_original']);
/**
* Очистка и фильтарция:
*/
$data['created_at'] = TemplateHelper::date('d M Y @ H:i', $data['created_at']);
$data['author'] = array($data['author'], HomeBoardHelper::getBoard($data['author']));
unset($data['ip']);
unset($data['text_original']);
$post = Blog_BlogPostsModel::GetPost($data['post_id']);
EventModel::getInstance()->ClientBroadcast('post_' . $data['post_id'], 'add_post_comment', $data)->ClientBroadcast('post_last_comments', 'add_post_comment', array('post_id' => $post['id'], 'id' => $data['id']))->ClientBroadcast('posts', 'add_post_comment', array('id' => $data['post_id'], 'count' => $post['comments']));
Blog_BlogStatisticsModel::updateGlobalPosting();
})->AddEventListener('remove_comment', function ($data) {
$post = Blog_BlogPostsModel::GetPost($data['post_id']);
EventModel::getInstance()->ClientBroadcast('post_' . $data['post_id'], 'remove_post_comment', array('id' => $data['id']))->ClientBroadcast('post_last_comments', 'remove_post_comment', array('id' => $data['id']))->ClientBroadcast('posts', 'remove_post_comment', array('id' => $data['post_id'], 'count' => $post['comments']));
})->AddEventListener('*_comment', function ($data) {
if (array_key_exists('post_id', $data)) {
$cache = KVS::getInstance();
$cache->remove('Blog_BlogCommentsModel', $data['post_id'], 'comments');
}
});
示例4:
/news/res/<?php
echo $post['id'];
?>
/rate_post/down/" class="js-rate-down-button">
<img src="http://<?php
echo TemplateHelper::getSiteUrl();
?>
/ico/minus_grey.gif" width="9" height="11" alt="" />
</a>
<span>|</span>
<?php
}
?>
<span><?php
echo TemplateHelper::date('d M Y @ H:i', $post['created_at']);
?>
</span>
<span>|</span>
<span>
<a href="http://<?php
echo TemplateHelper::getSiteUrl();
?>
/news/res/<?php
echo $post['id'];
?>
/" class="g-disabled">
№<?php
echo $post['id'];
?>
</a>
示例5: foreach
if ($post['count'] > 0) {
?>
<?php
foreach ($post['posts'] as $comment) {
?>
<div class="b-comment" id="comment_<?php
echo $comment['board_id'];
?>
_<?php
echo $comment['id'];
?>
">
<div class="b-comment_b-info">
<?php
echo TemplateHelper::date(!$ENG ? 'd M Y @ H:i' : 'Y-m-d @ H:i', $comment['created_at']);
?>
, <a href="#<?php
echo $comment['id'];
?>
">№</a><a href="javascript://" class="js-paste-link" name="<?php
echo $comment['id'];
?>
"><?php
echo $comment['id'];
?>
</a>
<a href="#" class="js-remove-button g-hidden"><img src="http://<?php
echo TemplateHelper::getSiteUrl();
?>
/ico/remove.gif" width="16" height="16" alt="<?php
示例6: getPostCommentAjaxAction
/**
* Получение коммента:
*/
public function getPostCommentAjaxAction()
{
$cache = KVS::getInstance();
$comment = Blog_BlogCommentsModel::GetComment($_GET['id']);
$session = Session::getInstance();
$session->activeSet('last_visit_post_' . $comment['post_id'], time());
if ($comment) {
if ($_GET['title']) {
$post = Blog_BlogPostsModel::GetPost($comment['post_id']);
$comment['post_title'] = $post['title'];
}
$comment['created_at'] = TemplateHelper::date('d M Y @ H:i', $comment['created_at']);
$comment['author'] = array($comment['author'], HomeBoardHelper::getBoard($comment['author']));
unset($comment['ip']);
return $comment;
}
return false;
}
示例7: getAjaxAction
/**
* Получение поста(ов) (ajax):
*/
public function getAjaxAction(Application $application)
{
$board = new Board_BoardModel($_GET['board']);
$settings = $board->getSettings();
if (array_key_exists('id', $_GET)) {
if (is_array($_GET['id'])) {
$result = array();
foreach ($_GET['id'] as $id) {
if ($post = $board->getPost($id)) {
$post['created_at'] = TemplateHelper::date($_GET['board'] != 'int' ? 'd M Y @ H:i' : 'Y-m-d @ H:i', $post['created_at']);
$post['board_title'] = $settings['title'];
$post['author'] = array($post['author'] ? $post['author'] : 'anonymous', HomeBoardHelper::getBoard($post['author']));
unset($post['ip']);
$result[] = $post;
}
}
return $result;
} else {
if ($post = $board->getPost($_GET['id'])) {
$post['created_at'] = TemplateHelper::date($_GET['board'] != 'int' ? 'd M Y @ H:i' : 'Y-m-d @ H:i', $post['created_at']);
$post['board_title'] = $settings['title'];
$post['author'] = array($post['author'] ? $post['author'] : 'anonymous', HomeBoardHelper::getBoard($post['author']));
unset($post['ip']);
return $post;
}
return false;
}
}
if (array_key_exists('thread_id', $_GET)) {
if ($thread = $board->getThread($_GET['thread_id'], true)) {
$result = array();
foreach ($thread['posts'] as $id => $post) {
$post['created_at'] = TemplateHelper::date($_GET['board'] != 'int' ? 'd M Y @ H:i' : 'Y-m-d @ H:i', $post['created_at']);
$post['board_title'] = $settings['title'];
$post['author'] = array($post['author'] ? $post['author'] : 'anonymous', HomeBoardHelper::getBoard($post['author']));
unset($post['ip']);
$result[] = $post;
}
return $result;
}
}
return false;
}
示例8: foreach
if ($post['posts']) {
?>
<?php
foreach ($post['posts'] as $tail_post) {
?>
<div class="b-comment" id="comment_<?php
echo $tail_post['board_id'];
?>
_<?php
echo $tail_post['id'];
?>
">
<div class="b-comment_b-info">
<?php
echo TemplateHelper::date(!$ENG ? 'd M Y @ H:i' : 'Y-m-d @ H:i', $tail_post['created_at']);
?>
, <a href="http://<?php
echo TemplateHelper::getSiteUrl();
?>
/<?php
echo $post['board_id'];
?>
/res/<?php
echo $post['id'];
?>
/#<?php
echo $tail_post['id'];
?>
" name="<?php
echo $tail_post['id'];