Skip to content

Commit

Permalink
feat: use wp_date() to replace date()
Browse files Browse the repository at this point in the history
  • Loading branch information
seatonjiang committed Apr 29, 2022
1 parent 19b2118 commit 3704666
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
6 changes: 3 additions & 3 deletions footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* 主题页脚
* @author Seaton Jiang <[email protected]>
* @license GPL-3.0 License
* @version 2022.01.26
* @version 2022.04.29
*/
?>
<div class="k-footer">
Expand Down Expand Up @@ -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>';
Expand All @@ -63,4 +63,4 @@
<?php wp_footer(); ?>
</body>

</html>
</html>
4 changes: 2 additions & 2 deletions inc/theme-options.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* 主题选项
* @author Seaton Jiang <[email protected]>
* @license GPL-3.0 License
* @version 2022.03.28
* @version 2022.04.29
*/

defined('ABSPATH') || exit;
Expand Down Expand Up @@ -1033,7 +1033,7 @@ function getrobots()
'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.',
),
),
));
Expand Down
6 changes: 3 additions & 3 deletions inc/theme-smtp.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* SMTP 配置
* @author Seaton Jiang <[email protected]>
* @license GPL-3.0 License
* @version 2022.01.26
* @version 2022.04.29
*/

if (kratos_option('m_smtp', false)) {
Expand Down Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down
11 changes: 6 additions & 5 deletions inc/theme-widgets.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* 侧栏小工具
* @author Seaton Jiang <[email protected]>
* @license GPL-3.0 License
* @version 2022.01.26
* @version 2022.04.29
*/

// 添加小工具
Expand Down Expand Up @@ -77,11 +77,12 @@ function archive_count_span($links)
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;
Expand Down Expand Up @@ -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>
Expand Down

0 comments on commit 3704666

Please sign in to comment.