PHP Класс Phrozn\Site\View\Base

Автор: Victor Farazdagi
Наследование: implements Phrozn\Site\View
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$outputFile string Output file path

Открытые методы

Метод Описание
__construct ( string $inputFile = null, string $outputDir = null ) : Phrozn\Site\View Initialize page
addProcessor ( $processor ) : Phrozn\Site\View Add text processor
compile ( array $vars = [] ) : Phrozn\Site\View Create static version of a concrete page
getFrontMatter ( ) : array Get YAML front matter from input view
getInputFile ( ) : string Get input file path
getInputRootDir ( ) : string Get input root directory path
getOutputDir ( ) : string Get output directory path
getOutputFile ( ) : string Get output file path
getParam ( string $param, mixed $default = null ) : mixed Get param value
getParams ( string $param = null, string $default = [] ) : array Get view parameters from both front matter and general site options
getProcessors ( ) : array Get list of registered processors
getSiteConfig ( ) : array Get site configuration
getTemplate ( ) : string Get template content from input view
hasLayout ( boolean $value = null ) : boolean Get/set hasLayout setting. Allows to enable/disable layout for a given view
removeProcessor ( $processor ) : Phrozn\Site\View Remove text processor
render ( array $vars = [] ) : string Render view
setFrontMatter ( array $frontMatter ) : Phrozn\Has\FrontMatter Set front matter
setInputFile ( $path ) : Phrozn\Site\View Set input file path
setInputRootDir ( string $path ) : Phrozn\Site\View Set input root directory path
setOutputDir ( string $path ) : Phrozn\Site\View Set output directory path
setOutputFile ( string $path ) : Phrozn\Site\View Set output file path
setParam ( string $param, mixed $value ) : Phrozn\Has\Param Set param
setSiteConfig ( array $config ) : Phrozn\Has\SiteConfig Set site configuration
setTemplate ( string $template ) : Phrozn\Has\Template Set template

Защищенные методы

Метод Описание
applyLayout ( string $content, array $vars ) : string Two step view is used. View to wrap is provided with content variable.

Приватные методы

Метод Описание
getAppConfig ( )
locateParam ( $params, $param ) : mixed Locate nested param (levels separated with dot) in params array
parse ( ) : Phrozn\Site\View Parses input file into front matter and actual template content
readSourceFile ( ) : string Read input file

Описание методов

__construct() публичный Метод

Initialize page
public __construct ( string $inputFile = null, string $outputDir = null ) : Phrozn\Site\View
$inputFile string Path to page source file
$outputDir string File destination path
Результат Phrozn\Site\View

addProcessor() публичный Метод

Add text processor
public addProcessor ( $processor ) : Phrozn\Site\View
Результат Phrozn\Site\View

applyLayout() защищенный Метод

Two step view is used. View to wrap is provided with content variable.
protected applyLayout ( string $content, array $vars ) : string
$content string View text to wrap into layout
$vars array List of variables passed to processors
Результат string

compile() публичный Метод

Create static version of a concrete page
public compile ( array $vars = [] ) : Phrozn\Site\View
$vars array List of variables passed to template engine
Результат Phrozn\Site\View

getFrontMatter() публичный Метод

Get YAML front matter from input view
public getFrontMatter ( ) : array
Результат array

getInputFile() публичный Метод

Get input file path
public getInputFile ( ) : string
Результат string

getInputRootDir() публичный Метод

Get input root directory path
public getInputRootDir ( ) : string
Результат string

getOutputDir() публичный Метод

Get output directory path
public getOutputDir ( ) : string
Результат string

getOutputFile() публичный Метод

Get output file path
public getOutputFile ( ) : string
Результат string

getParam() публичный Метод

Get param value
public getParam ( string $param, mixed $default = null ) : mixed
$param string Parameter name to obtain value for
$default mixed Default parameter value, if non found in FM
Результат mixed

getParams() публичный Метод

Get view parameters from both front matter and general site options
public getParams ( string $param = null, string $default = [] ) : array
$param string Parameter to get value for. Levels are separated with dots
$default string Default value to fetch if param is not found
Результат array

getProcessors() публичный Метод

Get list of registered processors
public getProcessors ( ) : array
Результат array of \Phrozn\Processor items

getSiteConfig() публичный Метод

Get site configuration
public getSiteConfig ( ) : array
Результат array

getTemplate() публичный Метод

Get template content from input view
public getTemplate ( ) : string
Результат string

hasLayout() публичный Метод

Get/set hasLayout setting. Allows to enable/disable layout for a given view
public hasLayout ( boolean $value = null ) : boolean
$value boolean Value to set to hasLayout option
Результат boolean

removeProcessor() публичный Метод

Remove text processor
public removeProcessor ( $processor ) : Phrozn\Site\View
Результат Phrozn\Site\View

render() публичный Метод

Render view
public render ( array $vars = [] ) : string
$vars array List of variables passed to text processors
Результат string

setFrontMatter() публичный Метод

Set front matter
public setFrontMatter ( array $frontMatter ) : Phrozn\Has\FrontMatter
$frontMatter array Array of options
Результат Phrozn\Has\FrontMatter

setInputFile() публичный Метод

Set input file path
public setInputFile ( $path ) : Phrozn\Site\View
Результат Phrozn\Site\View

setInputRootDir() публичный Метод

Set input root directory path
public setInputRootDir ( string $path ) : Phrozn\Site\View
$path string Directory path
Результат Phrozn\Site\View

setOutputDir() публичный Метод

Set output directory path
public setOutputDir ( string $path ) : Phrozn\Site\View
$path string Directory path
Результат Phrozn\Site\View

setOutputFile() публичный Метод

Set output file path
public setOutputFile ( string $path ) : Phrozn\Site\View
$path string File path
Результат Phrozn\Site\View

setParam() публичный Метод

Set param
public setParam ( string $param, mixed $value ) : Phrozn\Has\Param
$param string Name of the parameter to set
$value mixed Value of the parameter
Результат Phrozn\Has\Param

setSiteConfig() публичный Метод

Set site configuration
public setSiteConfig ( array $config ) : Phrozn\Has\SiteConfig
$config array Array of options
Результат Phrozn\Has\SiteConfig

setTemplate() публичный Метод

Set template
public setTemplate ( string $template ) : Phrozn\Has\Template
$template string Source template
Результат Phrozn\Has\Template

Описание свойств

$outputFile защищенное свойство

Output file path
protected string $outputFile
Результат string