Gentics Portal.Node PHP API
 All Classes Namespaces Functions Variables Pages
Static Public Member Functions | List of all members
HeadersHelper Class Reference

Static Public Member Functions

static forFile ($path, $content=null)
static cache ($seconds)

Detailed Description

Gentics Portal.Node PHP Author & Copyright (c) by Gentics Software GmbH sales.nosp@m.@gen.nosp@m.tics..nosp@m.com http://www.gentics.com Licenses can be found in the LICENSE.txt file in the root-folder of this installation You must not use this software without a valid license agreement.

Class for helping in work with headers

Definition at line 12 of file HeadersHelper.php.

Member Function Documentation

static HeadersHelper::cache (   $seconds)
static

Build cache headers for file

Parameters
int$secondsseconds to cache
Returns
array headers

Definition at line 40 of file HeadersHelper.php.

Referenced by RendererController\actionStatic().

{
$headers = array();
$headers[] = "Pragma: public";
$headers[] = "Expires: " . date("r", time() + $seconds);
$headers[] = "Cache-Control: public";
return $headers;
}
static HeadersHelper::forFile (   $path,
  $content = null 
)
static

Build content headers for file content.

Parameters
string$pathfile path
string$contentfile content
Returns
array headers

Definition at line 23 of file HeadersHelper.php.

Referenced by RendererController\actionStatic().

{
$headers = array();
$headers[] = "Content-Type: " . CFileHelper::getMimeTypeByExtension($path);
if ($content) {
$headers[] = "Content-Length: " . mb_strlen($content);
}
return $headers;
}

The documentation for this class was generated from the following file: