From 0400315cfc2ce61bf98269f8248a2607f812a591 Mon Sep 17 00:00:00 2001 From: AK Delfin Date: Thu, 18 Aug 2022 23:27:06 +0300 Subject: [PATCH] new time arriah --- arriah.php | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/arriah.php b/arriah.php index 741f784..0cc6ab6 100644 --- a/arriah.php +++ b/arriah.php @@ -51,24 +51,41 @@ function arriah_parser(){ else { $date = (string)$item->pubDate; - $mysqldate = date('Y-m-d H:i:s',strtotime($date)); + $mysqldate = date('Y-m-d H:i:s',strtotime("+3 hours", strtotime($date))); + //$mysqldate = date('Y-m-d H:i:s', strtotime($date)); $title = (string)$item->title; $title = wp_strip_all_tags($title); + + $link = (string)$item->link; + $link = trim($link, '/'); + + $find_link = strrpos($link, '/'); + + if ($find_link) { + $slug = substr($link, $find_link + 1); + } + + $slug = trim($slug, '-'); + $text = (string)$item->description; $text = str_replace('src="/local/', 'src="https://new.arriah.ru/local/', $text); //$text = replace_br($text); //$text = delete_p($text); $text = str_replace('
', '

', $text); - $slug = express_slug(vij_slug($title)); + //$slug = express_slug(vij_slug($title)); - $sql = "SELECT `ID` from `wp_posts` WHERE `post_name` = '$slug' and `post_date` = '$mysqldate'"; + $sql = "SELECT `ID` from `wp_posts` WHERE `post_name` = '$slug'"; $result = $wpdb->get_results($sql); if ($result) { + + //echo "Y: $title: $mysqldate\n"; continue; } - + + //echo "N: $slug\n"; + continue; $my_post = [ 'post_title' => $title, @@ -82,7 +99,7 @@ function arriah_parser(){ 'post_category' => array( 37 ) ]; - wp_insert_post( $my_post); + wp_insert_post( $my_post); }