* @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:----ZASbbqeme6l+vhbXuM75YHAxWludGtL30EhD7XYG1qw8JALo4vcPYfZwvuGjVwr//1M1RUsJ5/OfP387B2ffeMGTRrtgaFUfxfkR32xQhjMlqtIAOjdh9QKPqReYha/RIkA843bNmO70gO2axvgRUXlOI4fFzWhbVc62/HxSl6cXwXAq1HlQBVwRmAmV+g09lDC/+G26v4G+K697LUIXLbSFujt6pZbtKmc000M/E7Q6kMXg0n3AxiwTcM/w61mVsVn5dP0sP81rbPFwkBPoWMzLBF3CXYY2Q4t/aSlFm31a5+M6LBWoftXroj+RE2XhZGz5YUjp+S28M2gnXwgaKIe3wHHxNQwXOC5GBkxWQ7Kqpry+x6RwERYC3hMLZHy7ASjTTClOiIWmjZrIg9o/r4ZbYDZOZCLmJKpdtQhIGMRWhnns79BQTdXC3BZQRmwV4cWLkWdqrvZIvOuUt6Q7UBMNlDKdZXt5qcjACk5GFmyAyo7kRDtC2Bs/vMZVsH0atLqnt334XVIebXv3D6RVx1L9IClw1lWiykC4PKhiMH0PFMFs8uuVu8WdB4ogJgLogxU5Ej/uvOVmUNFE5nDbQmWXGeR7AwVDtPx3K1ZaWsIteQ4R/Mr6HiSVOXO3Ok4X5V07B+Grmcqr/qNpS5Is9NrAXwwM3IZjp/0K9u8YIkA=----ATTACHMENT:----MTg4NDg4MTQ5ODU3NDIwMCA2Mzc3Nzc2NTU5OTg5NTU5IDc2NDYwOTA1NjcwMTgwMTc=