From b398363a5935541bc2221fc21636c920f4cd57cc Mon Sep 17 00:00:00 2001 From: Feng Date: Mon, 1 Nov 2021 15:41:43 +0800 Subject: [PATCH] =?UTF-8?q?[Fix].=20=E8=8D=89=E7=A8=BF=E6=96=87=E7=AB=A0?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E6=88=B3=E4=B8=BA=E8=B4=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit WordPress 草稿文章 GMT 时间为 “0000-00-00 00:00:00” strtotime 转化后为负数。文章插入报错。 --- WordpressToTypecho/Action.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WordpressToTypecho/Action.php b/WordpressToTypecho/Action.php index df8a0d1..8e3fac6 100644 --- a/WordpressToTypecho/Action.php +++ b/WordpressToTypecho/Action.php @@ -176,7 +176,7 @@ class WordpressToTypecho_Action extends Typecho_Widget implements Widget_Interfa 'cid' => $row['ID'], 'title' => $row['post_title'], 'slug' => Typecho_Common::slugName(urldecode($row['post_name']), $row['ID'], 128), - 'created' => strtotime($row['post_date_gmt']) + $gmtOffset, + 'created' => strtotime($row['post_date_gmt']) + $gmtOffset > 0 ? strtotime($row['post_date_gmt']) + $gmtOffset : 0, 'modified' => strtotime($row['post_modified_gmt']) + $gmtOffset, 'text' => $row['post_content'], 'order' => $row['menu_order'],