|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* This file is part of the O2System Framework package. |
|
4
|
|
|
* |
|
5
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
6
|
|
|
* file that was distributed with this source code. |
|
7
|
|
|
* |
|
8
|
|
|
* @author Steeve Andrian Salim |
|
9
|
|
|
* @copyright Copyright (c) Steeve Andrian Salim |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
// ------------------------------------------------------------------------ |
|
13
|
|
|
|
|
14
|
|
|
namespace O2System\Framework\Containers\Modules\DataStructures\Module\Theme; |
|
15
|
|
|
|
|
16
|
|
|
// ------------------------------------------------------------------------ |
|
17
|
|
|
|
|
18
|
|
|
use O2System\Framework\Containers\Modules\DataStructures\Module\Theme\Layout\Partials; |
|
19
|
|
|
use O2System\Spl\Info\SplFileInfo; |
|
20
|
|
|
|
|
21
|
|
|
/** |
|
22
|
|
|
* Class Layout |
|
23
|
|
|
* |
|
24
|
|
|
* @package O2System\Framework\Containers\Modules\DataStructures\Module\Theme |
|
25
|
|
|
*/ |
|
26
|
|
|
class Layout extends SplFileInfo |
|
27
|
|
|
{ |
|
28
|
|
|
/** |
|
29
|
|
|
* Layout::$partials |
|
30
|
|
|
* |
|
31
|
|
|
* @var \O2System\Framework\Containers\Modules\DataStructures\Module\Theme\Layout\Partials |
|
32
|
|
|
*/ |
|
33
|
|
|
protected $partials; |
|
34
|
|
|
|
|
35
|
|
|
// ------------------------------------------------------------------------ |
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* Layout::__construct |
|
39
|
|
|
* |
|
40
|
|
|
* @param string $filePath |
|
41
|
|
|
*/ |
|
42
|
|
|
public function __construct($filePath) |
|
43
|
|
|
{ |
|
44
|
|
|
parent::__construct($filePath); |
|
45
|
|
|
|
|
46
|
|
|
$this->partials = new Partials(); |
|
47
|
|
|
|
|
48
|
|
|
$filenameParts = explode('.', pathinfo($filePath, PATHINFO_BASENAME)); |
|
49
|
|
|
array_shift($filenameParts); |
|
50
|
|
|
|
|
51
|
|
|
$this->partials |
|
52
|
|
|
->setPath($this->getPath() . DIRECTORY_SEPARATOR . 'partials' . DIRECTORY_SEPARATOR) |
|
53
|
|
|
->setExtension(implode('.', $filenameParts)) |
|
54
|
|
|
->autoload(); |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
// ------------------------------------------------------------------------ |
|
58
|
|
|
|
|
59
|
|
|
/** |
|
60
|
|
|
* Layout::getPartials |
|
61
|
|
|
* |
|
62
|
|
|
* @return \O2System\Framework\Containers\Modules\DataStructures\Module\Theme\Layout\Partials |
|
63
|
|
|
*/ |
|
64
|
|
|
public function getPartials() |
|
65
|
|
|
{ |
|
66
|
|
|
return $this->partials; |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
// ------------------------------------------------------------------------ |
|
70
|
|
|
|
|
71
|
|
|
/** |
|
72
|
|
|
* Layout::getContents |
|
73
|
|
|
* |
|
74
|
|
|
* @return false|string |
|
75
|
|
|
*/ |
|
76
|
|
|
public function getContents() |
|
77
|
|
|
{ |
|
78
|
|
|
return file_get_contents($this->getRealPath()); |
|
79
|
|
|
} |
|
80
|
|
|
} |