Example #1
0
 function setUp()
 {
     Flight::init();
 }
Example #2
0
    }
    /**
     * Handles ETag HTTP caching.
     *
     * @param string $id ETag identifier
     * @param string $type ETag type
     */
    public static function _etag($id, $type = 'strong')
    {
        $id = ($type === 'weak' ? 'W/' : '') . $id;
        self::response()->header('ETag', $id);
        if ($_SERVER['HTTP_IF_NONE_MATCH'] === $id) {
            self::halt(304);
        }
    }
    /**
     * Handles last modified HTTP caching.
     *
     * @param int $time Unix timestamp
     */
    public static function _lastModified($time)
    {
        self::response()->header('Last-Modified', date(DATE_RFC1123, $time));
        if (strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) === $time) {
            self::halt(304);
        }
    }
}
// Initialize the framework on include
Flight::init();