PHP Class Newscoop\Service\Implementation\ThemeServiceLocalFileSystem

Inheritance: implements Newscoop\Service\IThemeService
Afficher le fichier Open project: sourcefabric/newscoop Class Usage Examples

Méthodes publiques

Свойство Type Description
$themeConfigFileName string
$themesFolder string

Protected Properties

Свойство Type Description
$cacheThemeConfigs array
$cacheXMLEmelemt array
$errorHandler Newscoop\Service\IErrorHandler
$id Newscoop\Service\Resource\ResourceId

Méthodes publiques

Méthode Description
__construct ( ResourceId $id ) Construct the service based on the provided resource id.
findById ( $id )
getById ( $id ) * ---------------------------------------------------------------
getCount ( Search $search = NULL )
getEntities ( Search $search = NULL, $offset, $limit )
getPresentationImages ( Theme $theme ) * ---------------------------------------------------------------
toFullPath ( Theme | string $theme, string $file = '' ) : string Provides the full path for a theme.

Méthodes protégées

Méthode Description
escapePath ( string $path ) : string Converts the provided path from the OS specific form (if is the cae) to using just forward slashes.
extractRelativePathFrom ( string $path ) : string Extracts from a provided file path the path where that file is located, attention the path needs to be in the escaped form.
filterThemes ( SearchTheme $search, array $themes ) : array Filters the provided array of themes based on the search.
findAllThemesConfigPaths ( ) : array Finds all paths to the configurations XML files for themes, that are located in the theme folder.
getErrorHandler ( ) : Newscoop\Service\IErrorHandler Provides the error handler.
getNodes ( SimpleXMLElement $node, string $tagName, string $attribute = NULL, $value = '' ) : array Finds all the childrens from the provided node that have the provided tag name
getResourceId ( ) : Newscoop\Services\Resource\ResourceId Provides the resource id.
loadTheme ( SimpleXMLElement $nodeTheme, string $id, string $themeConfig ) : Theme Loads the theme object.
loadThemeByPath ( str $themePath ) : Theme Load the theme from the provided relative path.
loadThemes ( array $themesConfigs ) : array Loads the provided theme configuration files.
loadXML ( string $path ) : SimpleXMLElement Loads the XML content into SimpleXMLElement.
readAttribute ( SimpleXMLElement $node, string $attribute ) : string Convienient method for read an attribute from a node.
sort ( array $array, string $property, $ascending ) : array Sort the array.
trim ( array $array, integer $offset, integer $limit ) : array Trims the array based on the offset and limit.

Method Details

__construct() public méthode

Construct the service based on the provided resource id.
public __construct ( ResourceId $id )
$id Newscoop\Service\Resource\ResourceId The resource id, not null not empty

escapePath() protected méthode

Converts the provided path from the OS specific form (if is the cae) to using just forward slashes.
protected escapePath ( string $path ) : string
$path string The path, *(not null not empty).
Résultat string The escaped path.

extractRelativePathFrom() protected méthode

Extracts from a provided file path the path where that file is located, attention the path needs to be in the escaped form.
protected extractRelativePathFrom ( string $path ) : string
$path string The path from which to extract the relative path, *(not null not empty).
Résultat string The relative path for the provided path, not null.

filterThemes() protected méthode

Filters the provided array of themes based on the search.
protected filterThemes ( SearchTheme $search, array $themes ) : array
$search Newscoop\Service\Model\SearchTheme The search to filter the themes by, *(not null not empty).
$themes array The array of Theme objects to be filtered, *(not null not empty).
Résultat array The array containing all themes that respect the search.

findAllThemesConfigPaths() protected méthode

Finds all paths to the configurations XML files for themes, that are located in the theme folder.
protected findAllThemesConfigPaths ( ) : array
Résultat array The array containing as key the id of the theme config and as a value the relative path of the theme configuration XML file in escaped form. The id of a theme is formed based on the publication path with the crec32 applied.

findById() public méthode

public findById ( $id )

getById() public méthode

* ---------------------------------------------------------------
public getById ( $id )

getCount() public méthode

public getCount ( Search $search = NULL )
$search Newscoop\Service\Model\Search\Search

getEntities() public méthode

public getEntities ( Search $search = NULL, $offset, $limit )
$search Newscoop\Service\Model\Search\Search

getErrorHandler() protected méthode

Provides the error handler.
protected getErrorHandler ( ) : Newscoop\Service\IErrorHandler
Résultat Newscoop\Service\IErrorHandler The error handler to be used.

getNodes() protected méthode

Finds all the childrens from the provided node that have the provided tag name
protected getNodes ( SimpleXMLElement $node, string $tagName, string $attribute = NULL, $value = '' ) : array
$node SimpleXMLElement The node in which to search the childrens, not null.
$tagName string The tag name for the childrens to find, not null.
$attribute string Optional attribute name to search the kids by, beside the tag name.
$value Optional but if $attribute is specified than specify also the value of the attribute to find by.
Résultat array an array containing all the found nodes, not null can be empty.

getPresentationImages() public méthode

* ---------------------------------------------------------------
public getPresentationImages ( Theme $theme )
$theme Newscoop\Entity\Theme

getResourceId() protected méthode

Provides the resource id.
protected getResourceId ( ) : Newscoop\Services\Resource\ResourceId
Résultat Newscoop\Services\Resource\ResourceId The resource id.

loadTheme() protected méthode

Loads the theme object.
protected loadTheme ( SimpleXMLElement $nodeTheme, string $id, string $themeConfig ) : Theme
$nodeTheme SimpleXMLElement The node Theme XML element, *(not null not empty).
$id string The id of the loaded Theme, *(not null not empty).
$themeConfig string The path of the Theme XML file in order to extract the theme path, *(not null not empty).
Résultat Newscoop\Entity\Theme The loaded theme object, NULL if there was an issue.

loadThemeByPath() protected méthode

Load the theme from the provided relative path.
protected loadThemeByPath ( str $themePath ) : Theme
$themePath str The theme relative path.
Résultat Newscoop\Entity\Theme The loaded theme.

loadThemes() protected méthode

Loads the provided theme configuration files.
protected loadThemes ( array $themesConfigs ) : array
$themesConfigs array The array containing as key the ide of the theme config (index) and as a value the relative path of the theme configuration XML file, *(not null not empty).
Résultat array The array containing all the loaded themes.

loadXML() protected méthode

Loads the XML content into SimpleXMLElement.
protected loadXML ( string $path ) : SimpleXMLElement
$path string The path to the XML file, *(not null not empty).
Résultat SimpleXMLElement The XML element, NULL if the XML is not valid.

readAttribute() protected méthode

This method will throw an exception in case the attribute is not specified.
protected readAttribute ( SimpleXMLElement $node, string $attribute ) : string
$node SimpleXMLElement The node to read from, *(not null not empty).
$attribute string The attribute name, *(not null not empty).
Résultat string The attribute value, not null.

sort() protected méthode

Sort the array.
protected sort ( array $array, string $property, $ascending ) : array
$array array The array of elements to be sorted.
$property string The method name that provides the sorting key.
Résultat array The sorted array.

toFullPath() public méthode

Provides the full path for a theme.
public toFullPath ( Theme | string $theme, string $file = '' ) : string
$theme Newscoop\Entity\Theme | string The Theme or path, *(not null not empty).
$file string Optional a file to be appended to the path.
Résultat string The full path to the theme and file if is the case.

trim() protected méthode

Trims the array based on the offset and limit.
protected trim ( array $array, integer $offset, integer $limit ) : array
$array array The array to be trimed, not null.
$offset integer The offset.
$limit integer The limit.
Résultat array The trimed array.

Property Details

$cacheThemeConfigs protected_oe property

protected array $cacheThemeConfigs
Résultat array

$cacheXMLEmelemt protected_oe property

protected array $cacheXMLEmelemt
Résultat array

$errorHandler protected_oe property

protected IErrorHandler,Newscoop\Service $errorHandler
Résultat Newscoop\Service\IErrorHandler

$id protected_oe property

protected ResourceId,Newscoop\Service\Resource $id
Résultat Newscoop\Service\Resource\ResourceId

$themeConfigFileName public_oe property

public string $themeConfigFileName
Résultat string

$themesFolder public_oe property

public string $themesFolder
Résultat string