public function ucitaj_vesti($auto = 0) { $brojac = 0; $rss_array = $this->link_rss(); foreach ($rss_array as $rss) { $raw_rss = file_get_contents($rss["link_rss"]); $xml_rss = new SimpleXMLElement($raw_rss); foreach ($xml_rss->channel->item as $news) { $title = $news->title->__toString(); $desc = $news->description->__toString(); $link = $news->link->__toString(); $vr = $news->pubDate->__toString(); $vr = strtotime($vr); $vreme = date("Y-m-d H:i:s", $vr); if (Vest::da_li_postoji($title)) { continue; } $id = Vest::ubaci_vest($title, $link, 1, $vreme, $desc, $this->id_novina, $auto); $brojac++; $vest = new Vest($id); $reci = $vest->get_words(); foreach ($reci as $rec) { $rez = Vest::find_city($rec); if ($rez['status'] == 'OK') { $vest->dodaj_grad($rez['lat'], $rez['lng'], $rez['naziv'], $rez['partial']); } else { if ($rez['status'] == 'ZERO_RESULTS') { continue; } else { trigger_error($rez['status'], E_USER_ERROR); } } } } } return $brojac; }