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);
}