2021-10-11 22:29:11 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
include_once '/vhosts/beta/wp-load.php';
|
|
|
|
|
|
2021-12-28 21:37:04 +03:00
|
|
|
function filterHtml($html) {
|
|
|
|
|
|
|
|
|
|
$html = trim($html);
|
|
|
|
|
$html = preg_replace('/(\>)\s*(\<)/m', '$1$2', $html);
|
|
|
|
|
return preg_replace('/<!--(.*?)-->/', '', $html);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2021-10-11 22:29:11 +03:00
|
|
|
date_default_timezone_set('Europe/Moscow');
|
|
|
|
|
|
|
|
|
|
$posts = get_posts( array(
|
2022-01-11 23:06:02 +03:00
|
|
|
'numberposts' => 20,
|
2021-10-11 22:29:11 +03:00
|
|
|
'category' => 2,
|
|
|
|
|
'orderby' => 'date',
|
|
|
|
|
'order' => 'DESC',
|
|
|
|
|
'include' => array(),
|
|
|
|
|
'exclude' => array(),
|
|
|
|
|
'meta_key' => '',
|
|
|
|
|
'meta_value' =>'',
|
|
|
|
|
'post_type' => 'post',
|
|
|
|
|
'suppress_filters' => true, // подавление работы фильтров изменения SQL запроса
|
|
|
|
|
));
|
|
|
|
|
|
2022-02-21 13:53:43 +03:00
|
|
|
|
|
|
|
|
// Яндекс Новости
|
|
|
|
|
create_rss_file($posts, 'views/rss/yanews.php', '/vhosts/beta/rss/yanews.xml');
|
|
|
|
|
|
|
|
|
|
// Общая лента
|
2022-02-21 14:14:36 +03:00
|
|
|
create_rss_file($posts, 'views/rss/rssnews.php', '/vhosts/beta/rss/news.xml');
|
2022-02-21 13:53:43 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
exit;
|
|
|
|
|
|
2021-10-11 22:29:11 +03:00
|
|
|
if( $posts ){
|
|
|
|
|
|
2022-02-15 21:00:14 +03:00
|
|
|
|
|
|
|
|
ob_start();
|
|
|
|
|
include('views/rss/yanews.php');
|
|
|
|
|
$result = ob_get_contents();
|
|
|
|
|
ob_end_clean();
|
|
|
|
|
|
|
|
|
|
$result = trim($result);
|
|
|
|
|
|
|
|
|
|
if ($result !== ''){
|
|
|
|
|
file_put_contents('/vhosts/beta/rss/yanews.xml', trim($result));
|
|
|
|
|
}
|
|
|
|
|
|
2021-10-11 22:29:11 +03:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2022-02-21 13:53:43 +03:00
|
|
|
|
|
|
|
|
function create_rss_file($posts, $temp, $file){
|
|
|
|
|
|
|
|
|
|
if( $posts ){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ob_start();
|
|
|
|
|
include($temp);
|
|
|
|
|
$result = ob_get_contents();
|
|
|
|
|
ob_end_clean();
|
|
|
|
|
|
|
|
|
|
$result = trim($result);
|
|
|
|
|
|
|
|
|
|
if ($result !== ''){
|
|
|
|
|
file_put_contents($file, trim($result));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2021-10-11 22:29:11 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|