feat: use wp_date() to replace date()

pull/506/head
Seaton Jiang 2022-04-29 12:22:58 +08:00
parent 19b2118573
commit 3704666d5e
No known key found for this signature in database
GPG Key ID: B79682F6FE8D30E3
4 changed files with 14 additions and 13 deletions

View File

@ -4,7 +4,7 @@
* 主题页脚
* @author Seaton Jiang <hi@seatonjiang.com>
* @license GPL-3.0 License
* @version 2022.01.26
* @version 2022.04.29
*/
?>
<div class="k-footer">
@ -44,7 +44,7 @@
?>
</p>
<?php
echo '<p>' . kratos_option('s_copyright', 'COPYRIGHT © ' . date('Y') . ' ' . get_bloginfo('name') . '. ALL RIGHTS RESERVED.') . '</p>';
echo '<p>' . kratos_option('s_copyright', 'COPYRIGHT © ' . wp_date('Y') . ' ' . get_bloginfo('name') . '. ALL RIGHTS RESERVED.') . '</p>';
echo '<p>Theme <a href="https://github.com/seatonjiang/kratos" target="_blank" rel="nofollow">Kratos</a> Made By <a href="https://seatonjiang.com" target="_blank" rel="nofollow">Seaton Jiang</a></p>';
if (kratos_option('s_icp')) {
echo '<p><a href="https://beian.miit.gov.cn/" target="_blank" rel="nofollow">' . kratos_option('s_icp') . '</a></p>';
@ -63,4 +63,4 @@
<?php wp_footer(); ?>
</body>
</html>
</html>

View File

@ -4,7 +4,7 @@
* 主题选项
* @author Seaton Jiang <hi@seatonjiang.com>
* @license GPL-3.0 License
* @version 2022.03.28
* @version 2022.04.29
*/
defined('ABSPATH') || exit;
@ -1033,7 +1033,7 @@ CSF::createSection($prefix, array(
'id' => 's_copyright',
'type' => 'textarea',
'title' => __('版权信息', 'kratos'),
'default' => 'COPYRIGHT © ' . date('Y') . ' ' . get_bloginfo('name') . '. ALL RIGHTS RESERVED.',
'default' => 'COPYRIGHT © ' . wp_date('Y') . ' ' . get_bloginfo('name') . '. ALL RIGHTS RESERVED.',
),
),
));

View File

@ -4,7 +4,7 @@
* SMTP 配置
* @author Seaton Jiang <hi@seatonjiang.com>
* @license GPL-3.0 License
* @version 2022.01.26
* @version 2022.04.29
*/
if (kratos_option('m_smtp', false)) {
@ -66,7 +66,7 @@ function comment_approved($comment)
<div style="font-size:13px;color:#a0a0a0;padding-top:10px">' . __('该邮件由系统自动发出,如果不是您本人操作,请忽略此邮件。', 'kratos') . '</div>
<div class="qmSysSign" style="padding-top:20px;font-size:12px;color:#a0a0a0;">
<p style="color:#a0a0a0;line-height:18px;font-size:12px;margin:5px 0;">' . htmlspecialchars_decode(get_option('blogname'), ENT_QUOTES) . '</p>
<p style="color:#a0a0a0;line-height:18px;font-size:12px;margin:5px 0;"><span style="border-bottom:1px dashed #ccc;" t="5" times="">' . date("Y年m月d日", time()) . '</span></p>
<p style="color:#a0a0a0;line-height:18px;font-size:12px;margin:5px 0;"><span style="border-bottom:1px dashed #ccc;" t="5" times="">' . wp_date("Y年m月d日", time()) . '</span></p>
</div>
</div>
</div>
@ -118,7 +118,7 @@ function comment_notify($comment_id)
<div style="font-size:13px;color:#a0a0a0;padding-top:10px">' . __('该邮件由系统自动发出,如果不是您本人操作,请忽略此邮件。', 'kratos') . '</div>
<div class="qmSysSign" style="padding-top:20px;font-size:12px;color:#a0a0a0;">
<p style="color:#a0a0a0;line-height:18px;font-size:12px;margin:5px 0;">' . htmlspecialchars_decode(get_option('blogname'), ENT_QUOTES) . '</p>
<p style="color:#a0a0a0;line-height:18px;font-size:12px;margin:5px 0;"><span style="border-bottom:1px dashed #ccc;" t="5" times="">' . date("Y年m月d日", time()) . '</span></p>
<p style="color:#a0a0a0;line-height:18px;font-size:12px;margin:5px 0;"><span style="border-bottom:1px dashed #ccc;" t="5" times="">' . wp_date("Y年m月d日", time()) . '</span></p>
</div>
</div>
</div>

View File

@ -4,7 +4,7 @@
* 侧栏小工具
* @author Seaton Jiang <hi@seatonjiang.com>
* @license GPL-3.0 License
* @version 2022.01.26
* @version 2022.04.29
*/
// 添加小工具
@ -77,11 +77,12 @@ add_filter('get_archives_link', 'archive_count_span');
function most_comm_posts($days = 30, $nums = 6)
{
global $wpdb;
date_default_timezone_set("PRC");
$today = date("Y-m-d H:i:s");
$daysago = date("Y-m-d H:i:s", strtotime($today) - ($days * 24 * 60 * 60));
$today = wp_date("Y-m-d H:i:s");
$daysago = wp_date("Y-m-d H:i:s", strtotime($today) - ($days * 24 * 60 * 60));
$result = $wpdb->get_results($wpdb->prepare("SELECT comment_count, ID, post_title, post_date FROM $wpdb->posts WHERE post_date BETWEEN %s AND %s and post_type = 'post' AND post_status = 'publish' ORDER BY comment_count DESC LIMIT 0, %d", $daysago, $today, $nums));
$output = '';
if (!empty($result)) {
foreach ($result as $topten) {
$postid = $topten->ID;
@ -150,7 +151,7 @@ function latest_comments($list_number = 5, $cut_length = 50)
<div class="meta clearfix">
<div class="avatar float-left">' . get_avatar($comment, 60) . '</div>
<div class="profile d-block">
<span class="date">' . $nickname . ' ' . __('发布于 ', 'kratos') . timeago($comment->comment_date) . '' . date(__('m月d日', 'kratos'), strtotime($comment->comment_date)) . '</span>
<span class="date">' . $nickname . ' ' . __('发布于 ', 'kratos') . timeago($comment->comment_date) . '' . wp_date(__('m月d日', 'kratos'), strtotime($comment->comment_date)) . '</span>
<span class="message d-block">' . convert_smilies(esc_attr(string_cut(strip_tags($comment->comment_content), $cut_length))) . '</span>
</div>
</div>