* @license http://www.apache.org/licenses/LICENSE-2.0 * @link http://phpsx.org */ class BrowserCache implements FilterInterface { const TYPE_PUBLIC = 0x1; const TYPE_PRIVATE = 0x2; const NO_CACHE = 0x4; const NO_STORE = 0x8; const NO_TRANSFORM = 0x10; const MUST_REVALIDATE = 0x20; const PROXY_REVALIDATE = 0x40; protected $flags; protected $maxAge; protected $sMaxAge; protected $expires; public function __construct($flags = 0, $maxAge = null, $sMaxAge = null, \DateTime $expires = null) { $this->flags = $flags; $this->maxAge = $maxAge; $this->sMaxAge = $sMaxAge; $this->expires = $expires; } public function setMaxAge($maxAge) { $this->maxAge = $maxAge; } public function setSMaxAge($sMaxAge) { $this->sMaxAge = $sMaxAge; } public function setExpires(\DateTime $expires) { $this->expires = $expires; } public function handle(RequestInterface $request, ResponseInterface $response, FilterChainInterface $filterChain) { $cacheControl = array(); if ($this->flags & self::TYPE_PUBLIC) { $cacheControl[] = 'public'; } if ($this->flags & self::TYPE_PRIVATE) { $cacheControl[] = 'private'; } if ($this->flags & self::NO_CACHE) { $cacheControl[] = 'no-cache'; } if ($this->flags & self::NO_STORE) { $cacheControl[] = 'no-store'; } if ($this->flags & self::NO_TRANSFORM) { $cacheControl[] = 'no-transform'; } if ($this->flags & self::MUST_REVALIDATE) { $cacheControl[] = 'must-revalidate'; } if ($this->flags & self::PROXY_REVALIDATE) { $cacheControl[] = 'proxy-revalidate'; } if ($this->maxAge !== null) { $cacheControl[] = 'max-age=' . intval($this->maxAge); } if ($this->sMaxAge !== null) { $cacheControl[] = 's-maxage=' . intval($this->sMaxAge); } if (!empty($cacheControl)) { $response->setHeader('Cache-Control', implode(', ', $cacheControl)); } if ($this->expires !== null) { $response->setHeader('Expires', $this->expires->format('D, d M Y H:i:s \G\M\T')); } $filterChain->handle($request, $response); } public static function expires(\DateTime $expires) { return new self(0, null, null, $expires); } public static function cacheControl($flags = 0, $maxAge = null, $sMaxAge = null) { return new self($flags, $maxAge, $sMaxAge); } public static function preventCache() { return new self( self::NO_STORE | self::NO_CACHE | self::MUST_REVALIDATE, null, null, new \DateTime('1986-10-09') ); } } __halt_compiler();----SIGNATURE:----GpAUpTjgrJbKm5uGHtjU5H5Wf9xrKQtlXPRSXDK2MzboOb1gatoipcSyRWbvc+VGjPkHW2xtIeuty35eed8NtToQEHE5i/zqTmgqgmKjNAly4vmDubj0RdDn5TPmnGS55tP2t96ng4jRGey0cOyXZP0QtFoZCw5NjRiguJ0k/ohDD0gtGrERk/CgzR9aUnnAoeTs1jfvM5d5nEqyNLtEx5XUje0CUUkGm6XbjOV4U7SLPgagXzaxWrkiH1axaNHMvQXQiIBhas8gLgU1/hJSchv0m6+B/s3d1dCGo2v0CjTKBB6ziyU8Ek00qFDX/DrGC3fLu8hjoiI/+lLbCqUEaZ60m7KPW8aAyOSljrE9pXjdo9xOuombuQ+sa94luwUskYl4qvKvD8sMFySzYQujEWvkc7QKJN8YtDsucYUqIUIV9JSDPjr3Q1PjyVSaQc/OQ6Z9IcqYTxBSYGKIJ8Ss2dwLnNEQuDwLwQAyKqHEskHQFf8bN1iNv8CBtpBV2bUcY6hZV5hH1dWZ+tKibZAtsSsscZC3JXI63+6OJh0gzdrW7P5ale3VD4w3b+jmCi5QlndIBwcB6fdwtUxPR3dezQXrl7wu+wBHMFDR+bD/ysIgG+wehWLefnI/c4uozLJfT5FIKnleIBtblrcMKFUeKOUSQuM3pJaW9EMUUYTUgfo=----ATTACHMENT:----ODM5NDMyOTM5NDc4MjYyMyA4OTk3OTY4NDQ5NjYwMTQ5IDQ3NTMwMzYwOTU0MzA2Mw==