public function handler() { global $clientsecret, $clientid; switch ($this->get('action')) { case 'compare_version': if (!$this->get('version') || !$this->get('repo')) { break; } $lang = strlen($this->get('lang')) ? $this->get('lang') : 'en'; $strCacheName = md5($this->get('repo') . '_' . $this->get('version') . '_' . $lang); $strCacheFolder = 'cache/data/'; if (file_exists($strCacheFolder . $strCacheName . '.txt') && filemtime($strCacheFolder . $strCacheName . '.txt') + 3600 > time()) { $arrText = unserialize(file_get_contents($strCacheFolder . $strCacheName . '.txt')); } else { $eqdkp = new GitHub('EQdkpPlus', $this->get('repo'), $clientid, $clientsecret); $arrText = $this->compareVersion($this->get('version'), $eqdkp->getLatestVersion(), $lang, $this->get('repo')); file_put_contents($strCacheFolder . $strCacheName . '.txt', serialize($arrText)); } $this->displayImage($arrText); break; } }