1 | <?php |
||
19 | class Website extends Configuration |
||
20 | { |
||
21 | /** |
||
22 | * @var \Staticka\Content\ContentInterface |
||
23 | */ |
||
24 | protected $content; |
||
25 | |||
26 | /** |
||
27 | * @var \Staticka\Helper\HelperInterface[] |
||
28 | */ |
||
29 | protected $helpers = array(); |
||
30 | |||
31 | /** |
||
32 | * @var \Staticka\Filter\FilterInterface[] |
||
33 | */ |
||
34 | protected $filters = array(); |
||
35 | |||
36 | /** |
||
37 | * @var string |
||
38 | */ |
||
39 | protected $output = ''; |
||
40 | |||
41 | /** |
||
42 | * @var \Staticka\Page[] |
||
43 | */ |
||
44 | protected $pages = array(); |
||
45 | |||
46 | /** |
||
47 | * @var \Zapheus\Renderer\RendererInterface |
||
48 | */ |
||
49 | protected $renderer; |
||
50 | |||
51 | /** |
||
52 | * Initializes the Staticka instance. |
||
53 | * |
||
54 | * @param \Zapheus\Renderer\RendererInterface|null $renderer |
||
55 | * @param \Staticka\Content\ContentInterface|null $content |
||
56 | */ |
||
57 | 21 | public function __construct(RendererInterface $renderer = null, ContentInterface $content = null) |
|
63 | |||
64 | /** |
||
65 | * Compiles the specified pages into HTML output. |
||
66 | * |
||
67 | * @param string $output |
||
68 | * @return self |
||
69 | */ |
||
70 | 15 | public function compile($output) |
|
90 | |||
91 | /** |
||
92 | * Returns the content instance. |
||
93 | * |
||
94 | * @return \Staticka\Content\ContentInterface |
||
95 | */ |
||
96 | 6 | public function content() |
|
100 | |||
101 | /** |
||
102 | * Adds a filter instance. |
||
103 | * |
||
104 | * @param \Staticka\Filter\FilterInterface $filter |
||
105 | * @return self |
||
106 | */ |
||
107 | 3 | public function filter(FilterInterface $filter) |
|
113 | |||
114 | /** |
||
115 | * Adds a helper instance. |
||
116 | * |
||
117 | * @param \Staticka\Helper\HelperInterface $helper |
||
118 | * @return self |
||
119 | */ |
||
120 | 3 | public function helper(HelperInterface $helper) |
|
126 | |||
127 | /** |
||
128 | * Returns an array of helpers. |
||
129 | * |
||
130 | * @return \Staticka\Helper\HelperInterface[] |
||
131 | */ |
||
132 | 3 | public function helpers() |
|
136 | |||
137 | /** |
||
138 | * Creates a new page. |
||
139 | * |
||
140 | * @param string $file |
||
141 | * @param array $data |
||
142 | * @return self |
||
143 | */ |
||
144 | 21 | public function page($file, array $data = array()) |
|
150 | |||
151 | /** |
||
152 | * Returns the renderer instance. |
||
153 | * |
||
154 | * @return \Zapheus\Renderer\RendererInterface |
||
155 | */ |
||
156 | 3 | public function renderer() |
|
160 | |||
161 | /** |
||
162 | * Transfers files from a directory into another path. |
||
163 | * |
||
164 | * @param string $source |
||
165 | * @param string|null $path |
||
166 | * @return void |
||
167 | */ |
||
168 | 3 | public function transfer($source, $path = null) |
|
186 | |||
187 | /** |
||
188 | * Removes the files recursively from the specified directory. |
||
189 | * |
||
190 | * @param string $path |
||
191 | * @return void |
||
192 | */ |
||
193 | 15 | protected function clear($path) |
|
207 | |||
208 | /** |
||
209 | * Returns the whole folder path based from specified URIs. |
||
210 | * Also creates the specified folder if it doesn't exists. |
||
211 | * |
||
212 | * @param string $output |
||
213 | * @param array $uris |
||
214 | * @return string |
||
215 | */ |
||
216 | 15 | protected function folder($output, array $uris) |
|
230 | |||
231 | /** |
||
232 | * Converts the specified page into HTML. |
||
233 | * |
||
234 | * @param \Staticka\Page $page |
||
235 | * @return string |
||
236 | */ |
||
237 | 15 | protected function html(Page $page) |
|
255 | |||
256 | /** |
||
257 | * Replaces the slashes with the DIRECTORY_SEPARATOR. |
||
258 | * Also creates the directory if it doesn't exists. |
||
259 | * |
||
260 | * @param string $folder |
||
261 | * @return string |
||
262 | */ |
||
263 | 15 | protected function path($folder) |
|
277 | } |
||
278 |