new time arriah
This commit is contained in:
27
arriah.php
27
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('<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);
|
||||
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user