/** * @see $indexFile, $transform */ public function __construct(PHPSTL $pstl) { parent::__construct($pstl); $this->providers = $this->pstl->getOption('contentpage_providers', array()); if (!is_array($this->providers)) { throw new InvalidArgumentException('contetpage_providers should be null or an array'); } $path = $this->pstl->getOption('contentpage_path'); if (isset($path)) { if (is_string($path)) { $path = explode(',', $path); } if (!is_array($path)) { throw new InvalidArgumentException('contentpage_path should be a string or array'); } foreach ($path as &$dir) { if (is_dir($dir)) { array_push($this->providers, new PHPSTLDirectoryProvider($this->pstl, $dir)); } } unset($dir); } $this->indexFile = $this->pstl->getOption('contentpage_index_file', 'index.html'); $this->transform = $this->pstl->getOption('contentpage_pathtransform'); if (isset($this->transform) && !is_callable($this->transform)) { throw new InvalidArgumentException('contentpage_pathtransform isn\'t callable'); } }
/** * Creats a new CMSNode template provider * * @param site Site * @param pstl PHPSTL */ public function __construct(Site $site, PHPSTL $pstl) { parent::__construct($pstl); $this->site = $site; }