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

Public Member Functions

 getContentSource ()
 getContent ($path)
 init ()
 getBrowserCacheTimeByFileName ($filename=null)

Public Attributes

 $sourceSettings
 $sourceClass
 $homePage
 $startPageFallback = 'index.html'
 $startPageDynamic = true
 $localizedAttributeName = 'startpageurl_'
 $cacheTime
 $staticFileCacheControl

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.

Module for working with File System Content Renderer and Dynamic Content Renderer. Configuration example: 'contentSource' => array( 'class' => 'site.common.modules.contentSource.ContentSourceModule', 'sourceSettings' => array( 'DynamicContentSource' => array( 'storageFolder' => '/var/www/gPortal/DCR' ), 'FileSystemContentSource' => array( 'sourceFolder' => '/var/www/gPortal/FSCR' ), ), 'sourceClass' => 'DynamicContentSource' )

Definition at line 25 of file ContentSourceModule.php.

Member Function Documentation

ContentSourceModule::getBrowserCacheTimeByFileName (   $filename = null)

Tries to find a browser cache time by path from the config, see $staticFileCacheControl

Parameters
string$filename
Returns
int cachetime

Definition at line 143 of file ContentSourceModule.php.

References AppHelper\isNullOrEmptyString().

{
// return -1 if we didn't find any valid cache time in the config
$defaultStaticCacheTime = -1;
if (!AppHelper::isNullOrEmptyString($filename) && !empty($this->staticFileCacheControl) && is_array($this->staticFileCacheControl)) {
// get file mimetype
$mimetype = CFileHelper::getMimeTypeByExtension($filename);
// if we found a valid mimetype we search if we got a cache time specifies in the browser cache config
if (isset($this->staticFileCacheControl[$mimetype]) && is_numeric($this->staticFileCacheControl[$mimetype])) {
$defaultStaticCacheTime = $this->staticFileCacheControl[$mimetype];
}
}
return $defaultStaticCacheTime;
}
ContentSourceModule::getContent (   $path)

Get static resource content. For example images, css, js

Parameters
string$pathcontent path
Returns
Content content

Definition at line 116 of file ContentSourceModule.php.

References getContentSource().

{
return $this->getContentSource()->getContent($path);
}
ContentSourceModule::getContentSource ( )

Get object which represents Content Source

Returns
ContentSource

Definition at line 97 of file ContentSourceModule.php.

Referenced by getContent().

{
if (!$this->_contentSource) {
$settings = $this->sourceSettings[$this->sourceClass];
$settings['class'] = $this->sourceClass;
$this->_contentSource = Yii::createComponent($settings);
$this->_contentSource->init();
}
return $this->_contentSource;
}
ContentSourceModule::init ( )

Module initial function

Returns
void

Definition at line 126 of file ContentSourceModule.php.

{
$this->setImport(
array(
'contentSource.components.*'
)
);
}

Member Data Documentation

ContentSourceModule::$localizedAttributeName = 'startpageurl_'

Name of content attribute for locale $localizedAttributeName . $locale

string

Definition at line 63 of file ContentSourceModule.php.

ContentSourceModule::$startPageDynamic = true

Method of displaying startpage to user. Can take following values: false - redirect user to the page true - (no redirect - just display/include the page without changing the URL)

string

Definition at line 55 of file ContentSourceModule.php.

ContentSourceModule::$startPageFallback = 'index.html'

This value is used when startpage for some folder doesnt exists

string

Definition at line 46 of file ContentSourceModule.php.


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