Файл: core/autoload/_parser.php
Строк: 96
<?
function newsfront($url) {
$html = file_get_contents($url);
preg_match_all('#<div class="article__content">(.+?)</div>#is', $html, $arr);
preg_match_all( "|<title>(.*)</title>|sUSi", $html, $arr3);
$title = $arr3[1][0];
$text = $arr[1];
$text = preg_replace("/<p>/", "n", $text);
$text = preg_replace("/<.*?>/", " ", $text);
$text = preg_replace("/«/", "«", $text);
$text = preg_replace("/»/", "»", $text);
$text = preg_replace("/—/", "-", $text);
$text = preg_replace("/"/", '"', $text);
$text = preg_replace("/ /", '—', $text);
$title = preg_replace("/«/", "«", $title);
$title = preg_replace("/»/", "»", $title);
$title = preg_replace("/"/", '"', $title);
$title = preg_replace("/ /", '—', $title);
$text = preg_replace("/(Обязательно)(.*)/","", $text);
$text = $text[0];
preg_match_all('/<img[^>]+src="?'?([^"']+)"?'?[^>]*>/i', $html, $images, PREG_SET_ORDER);
$img = $images[10][1];
return "{$text}::{$img}::{$title}";
}
function newsfrontlistOLD($url = false) {
$content = file_get_html($url);
$div = $content->find('.sidebar', 0);
foreach($div->find('a') as $link) {
if ($link->href == '/category/actualnie-novosti/'){
continue;
}
$plink[] = $link->href;
}
return $plink;
}
function newsfrontlist($url = false) {
$content = file_get_html($url);
$div = $content->find('.articles-list, .articles-list--mb10, .articles-list--mobile-table', 0);
foreach($div->find('a') as $link) {
if ($link->href == '/category/actualnie-novosti/'){
continue;
}
$plink[] = $link->href;
}
return $plink;
}
function newsfrontConfig() {
$RazdData = [
'1::Россия::https://news-front.info/category/news/russia/::russia' ,
'2::ДНР и ЛНР::https://news-front.info/category/dnr-lnr/::dnr-lnr' ,
'3::Украина::https://news-front.info/category/news/ukraine/::ukraine' ,
'4::Мир::https://news-front.info/category/news/world/::world' ,
'5::Балканы::https://news-front.info/category/balkany/::balkany' ,
'6::Молдавия::https://news-front.info/category/moldaviya/::moldaviya' ,
'7::Белоруссия::https://news-front.info/category/belorussiya/::belorussiya' ,
'8::Центральная Азия::https://news-front.info/category/central-asia/::central-asia' ,
];
return $RazdData;
}