// Determine the word from Twitter // is newer than the newest word in DB if ($d['local'][0]['word'] != '') { $key = $d['local'][0]['word']; $pho = str_replace("'", "ˈ", $d['local'][0]['pho'][0]); if ($d['local'][0]['des'] != '') { $aDes = $d['local'][0]['des']; } if ($d['local'][0]['sen'] != '') { $aSen = $d['local'][0]['sen']; } if ($d['local'][0]['mor'] != '') { $aMor = $d['local'][0]['mor']; } // Lookup the sound from Google Dictionary $soundUrl = VWSCore::gSound($key); // Store word, date, phonogram and sound url to DB $wsql = "INSERT INTO vws_words (`date`, `key`, `pho`, `sound`) VALUES (" . $date . ", '" . $key . "', '" . $pho . "', '" . $soundUrl . "');"; $db->query($wsql); $wid = $db->insert_id(); // Store definiton and part of speech to DB if ($aDes) { for ($i = 0; $i < count($aDes); $i++) { $dpos = $aDes[$i]['p']; $ddef = $aDes[$i]['d']; $dessql = "INSERT INTO vws_des (wid, pos, def) VALUES (" . $wid . ", '" . $dpos . "', '" . $ddef . "');"; $db->query($dessql); unset($aDes); } } // Store example sentences (both English and Chinese)