dptw = $dptw; } public function update(){ $urls = null; $results = ""; $words = []; $key = isset($_GET["key"]) ? $_GET["key"] : null; try{ isset($_GET["urls"]) && ($urls = ($json = json_decode($urls = base64_decode($_GET["urls"]), true)) ? $json : [$urls]); }catch(Exception $exception){}; !$urls && ($urls = is_array($urls = $this->dptw->settings("dictionary_urls")) ? $urls : [$urls]); foreach($urls as $url) $results .= file_get_contents($url); $results = "[\s]*)).+<\/' . $tag . '>/i', "", $results); $results = preg_replace('/<[^<>]+>/', " ", $results); foreach(preg_split('/\s+/', $results) as $word) if(strlen($word) > 1 && !preg_match('/[^a-záéúíóàèùìòäëüïÖâêûîôÁÉÚÍÓÀÈÙÌÒÄËÜÏÖÂÊÛÎÔñçÑÇ]/i', $word) && !in_array($word, $words)) $words[] = $word; $words = json_encode([ "urls" => $urls, "words" => $words ], JSON_UNESCAPED_UNICODE); $key && DPTW::save_file(__DIR__ . "/../Public/data/json/" . $key . ".json", $words); header("content-type: application/json"); echo $words; } };