';print_R($agent);''; $xml = json_decode(file_get_contents('http://www.sanatoriums.com/feed/infogid_cz')); $i=0; $k=0; $pocet = 0; foreach($id_feed as $index => $prispevek){ foreach($xml->CZE_KV->sanatoriums as $polozky){ if($prispevek == $polozky->id){ delete_post_meta($index, 'cena'); delete_post_meta($index, 'hodnoceni'); delete_post_meta($index, 'hodnoceni2'); delete_post_meta($index, 'odkaz'); delete_post_meta($index, 'reference'); add_post_meta($index, 'cena', $polozky->price); add_post_meta($index, 'hodnoceni', $polozky->rating); add_post_meta($index, 'hodnoceni2', $polozky->rating_treatment); add_post_meta($index, 'odkaz', $polozky->link); add_post_meta($index, 'reference', $polozky->link_references); foreach($polozky->references as $komentare){ if(!in_array($komentare->id,$agent)){ $pocet+=1; $data = array( 'comment_post_ID' => $index, 'comment_author' => $komentare->client, 'comment_author_email' => '', 'comment_author_url' => '', 'comment_content' => $komentare->positives. '
' .$komentare->negatives, 'comment_type' => '', 'comment_parent' => 0, 'user_id' => 0, 'comment_author_IP' => '127.0.0.1', 'comment_agent' => $komentare->id, 'comment_date' => $komentare->date, 'comment_approved' => 1, ); wp_insert_comment($data); } } } } }; foreach($id_feed as $index => $prispevek){ foreach($xml->CZE_ML->sanatoriums as $polozky){ if($prispevek == $polozky->id){ delete_post_meta($index, 'cena'); delete_post_meta($index, 'hodnoceni'); delete_post_meta($index, 'hodnoceni2'); delete_post_meta($index, 'odkaz'); delete_post_meta($index, 'reference'); add_post_meta($index, 'cena', $polozky->price); add_post_meta($index, 'hodnoceni', $polozky->rating); add_post_meta($index, 'hodnoceni2', $polozky->rating_treatment); add_post_meta($index, 'odkaz', $polozky->link); add_post_meta($index, 'reference', $polozky->link_references); foreach($polozky->references as $komentare){ if(!in_array($komentare->id,$agent)){ $pocet+=1; $data = array( 'comment_post_ID' => $index, 'comment_author' => $komentare->client, 'comment_author_email' => '', 'comment_author_url' => '', 'comment_content' => $komentare->positives. '
' .$komentare->negatives, 'comment_type' => '', 'comment_parent' => 0, 'user_id' => 0, 'comment_author_IP' => '127.0.0.1', 'comment_agent' => $komentare->id, 'comment_date' => $komentare->date, 'comment_approved' => 1, ); wp_insert_comment($data); } } } } }; foreach($id_feed as $index => $prispevek){ foreach($xml->CZE_JA->sanatoriums as $polozky){ if($prispevek == $polozky->id){ delete_post_meta($index, 'cena'); delete_post_meta($index, 'hodnoceni'); delete_post_meta($index, 'hodnoceni2'); delete_post_meta($index, 'odkaz'); delete_post_meta($index, 'reference'); add_post_meta($index, 'cena', $polozky->price); add_post_meta($index, 'hodnoceni', $polozky->rating); add_post_meta($index, 'hodnoceni2', $polozky->rating_treatment); add_post_meta($index, 'odkaz', $polozky->link); add_post_meta($index, 'reference', $polozky->link_references); foreach($polozky->references as $komentare){ if(!in_array($komentare->id,$agent)){ $pocet+=1; $data = array( 'comment_post_ID' => $index, 'comment_author' => $komentare->client, 'comment_author_email' => '', 'comment_author_url' => '', 'comment_content' => $komentare->positives. '
' .$komentare->negatives, 'comment_type' => '', 'comment_parent' => 0, 'user_id' => 0, 'comment_author_IP' => '127.0.0.1', 'comment_agent' => $komentare->id, 'comment_date' => $komentare->date, 'comment_approved' => 1, ); wp_insert_comment($data); } } } } }; foreach($id_feed as $index => $prispevek){ foreach($xml->CZE_FL->sanatoriums as $polozky){ if($prispevek == $polozky->id){ delete_post_meta($index, 'cena'); delete_post_meta($index, 'hodnoceni'); delete_post_meta($index, 'hodnoceni2'); delete_post_meta($index, 'odkaz'); delete_post_meta($index, 'reference'); add_post_meta($index, 'cena', $polozky->price); add_post_meta($index, 'hodnoceni', $polozky->rating); add_post_meta($index, 'hodnoceni2', $polozky->rating_treatment); add_post_meta($index, 'odkaz', $polozky->link); add_post_meta($index, 'reference', $polozky->link_references); foreach($polozky->references as $komentare){ if(!in_array($komentare->id,$agent)){ $pocet+=1; $data = array( 'comment_post_ID' => $index, 'comment_author' => $komentare->client, 'comment_author_email' => '', 'comment_author_url' => '', 'comment_content' => $komentare->positives. '
' .$komentare->negatives, 'comment_type' => '', 'comment_parent' => 0, 'user_id' => 0, 'comment_author_IP' => '127.0.0.1', 'comment_agent' => $komentare->id, 'comment_date' => $komentare->date, 'comment_approved' => 1, ); wp_insert_comment($data); } } } } } /* $k++; foreach($polozky->references as $komentare){ $data = array( 'comment_post_ID' => $prispevek->ID, 'comment_author' => $komentare->client, 'comment_author_email' => '', 'comment_author_url' => '', 'comment_content' => $komentare->positives. '
' .$komentare->negatives, 'comment_type' => '', 'comment_parent' => 0, 'user_id' => 0, 'comment_author_IP' => '127.0.0.1', 'comment_agent' => $komentare->id, 'comment_date' => $komentare->date, 'comment_approved' => 1, ); // wp_insert_comment($data); } */ // echo '
';print_r($hotely);''; $cas = date('d.m.Y H:i:s'); $obsah = $cas." - ".$pocet." komentářů"; if(file_put_contents("logovani.txt",$obsah."\n", FILE_APPEND | LOCK_EX)){ echo 'OK'; } echo '
Položky byly aktualizovány. Přidáno '.$pocet.' komentářů.
'; ?>