コード例 #1
0
ファイル: LiteService.php プロジェクト: lukeme/lite
            return $litefile;
        }
        if (!file_exists($phpfile) || filesize($phpfile) == 0) {
            return $phpfile;
        }
        $phptime = filemtime($phpfile);
        $lite = json_decode(file_get_contents($litefile), true);
        $resources = @$lite[0];
        if (is_array($resources)) {
            foreach ($resources as $spath) {
                $file = $this->root . $spath;
                if (file_exists($file)) {
                    if (filemtime($file) > $phptime) {
                        return $file;
                    }
                } else {
                    return $file;
                }
            }
            return false;
        }
        return $litefile;
    }
}
if (realpath($_SERVER['DOCUMENT_ROOT'] . '/' . $_SERVER['SCRIPT_NAME']) == realpath(__FILE__)) {
    //direct access from remote
    $service = new LiteService();
    $service->execute();
} else {
    //included
}