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


PHP TemplateHelper::date方法代码示例

本文整理汇总了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;
 }
开发者ID:postman0,项目名称:1chan,代码行数:25,代码来源:mod.controller.php

示例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();
            ?>
开发者ID:postman0,项目名称:1chan,代码行数:31,代码来源:viewPost.php

示例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');
    }
});
开发者ID:postman0,项目名称:1chan,代码行数:31,代码来源:blogcomments.model.php

示例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>
开发者ID:postman0,项目名称:1chan,代码行数:31,代码来源:viewAll.php

示例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 
开发者ID:postman0,项目名称:1chan,代码行数:31,代码来源:viewThread.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;
 }
开发者ID:postman0,项目名称:1chan,代码行数:21,代码来源:blog.controller.php

示例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;
 }
开发者ID:postman0,项目名称:1chan,代码行数:46,代码来源:board.controller.php

示例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'];
开发者ID:postman0,项目名称:1chan,代码行数:31,代码来源:viewThreads.php


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