Пример #1
0
	function fetch_news($id) {
		$worker = new Read_News();
		$worker->get_item($id);
		$news = $worker->get_data('items');
		$news = current($news);

		$news['template'] = 'news';
		$news['navi'] = '/news/';
		return $news;
	}
Пример #2
0
	function convert_news($item) {
		$worker = new Read_News();
		$worker->get_item($item['id']);
		$news = $worker->get_data('items');
		$item = current($news);
		$item['type'] = 'news';

		$item['rss_base'] = 'http://'.$_SERVER['HTTP_HOST'].'/';
		$item['rss_link'] = 'http://'.$_SERVER['HTTP_HOST'].'/news/'.$item['url'].'/';
		$item['text'] = str_replace('href="/go?','href="',$item['text']);
		$item['text'] = $this->replace_spoilers($item['text'],$item['rss_link']);
		$item['text'] = preg_replace('/\{\{\{(.*)\}\}\}/ueU','get_include_contents("templates$1")',$item['text']);
		$item['comments_link'] = $item['rss_link'].'comments/all/';
		return $item;
	}