new time arriah

This commit is contained in:
2022-08-18 23:27:06 +03:00
parent a13b193d5b
commit 0400315cfc

View File

@@ -51,24 +51,41 @@ function arriah_parser(){
else { else {
$date = (string)$item->pubDate; $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 = (string)$item->title;
$title = wp_strip_all_tags($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 = (string)$item->description;
$text = str_replace('src="/local/', 'src="https://new.arriah.ru/local/', $text); $text = str_replace('src="/local/', 'src="https://new.arriah.ru/local/', $text);
//$text = replace_br($text); //$text = replace_br($text);
//$text = delete_p($text); //$text = delete_p($text);
$text = str_replace('<br>', '<br><br>', $text); $text = str_replace('<br>', '<br><br>', $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); $result = $wpdb->get_results($sql);
if ($result) { if ($result) {
//echo "Y: $title: $mysqldate\n";
continue; continue;
} }
//echo "N: $slug\n";
continue;
$my_post = [ $my_post = [
'post_title' => $title, 'post_title' => $title,