1 | <?php |
||
10 | class AppGlobal |
||
11 | { |
||
12 | /** |
||
13 | * The controller handling the request |
||
14 | * @var \Controller |
||
15 | */ |
||
16 | private $controller; |
||
17 | |||
18 | /** |
||
19 | * Symfony's container |
||
20 | * @var ContainerInterface |
||
21 | */ |
||
22 | private $container; |
||
23 | |||
24 | /** |
||
25 | * Create new AppGlobal |
||
26 | * |
||
27 | * @param \Controller $controller The controller handling the request |
||
28 | * @param ContainerInterface $container Symfony's service container |
||
29 | */ |
||
30 | 1 | public function __construct(\Controller $controller, ContainerInterface $container) |
|
31 | { |
||
32 | 1 | $this->controller = $controller; |
|
33 | 1 | $this->container = $container; |
|
34 | 1 | } |
|
35 | |||
36 | /** |
||
37 | * Get the controller handling the request |
||
38 | * |
||
39 | * @return \Controller |
||
40 | */ |
||
41 | 1 | public function getController() |
|
42 | { |
||
43 | 1 | return $this->controller; |
|
44 | } |
||
45 | |||
46 | /** |
||
47 | * Get the environment of the kernel |
||
48 | * |
||
49 | * @return string |
||
50 | */ |
||
51 | public function getEnvironment() |
||
52 | { |
||
53 | return $this->container->getParameter('kernel.environment'); |
||
54 | } |
||
55 | |||
56 | /** |
||
57 | * Find out whether the kernel has enabled debugging |
||
58 | * |
||
59 | * @return bool |
||
60 | */ |
||
61 | 1 | public function isDebug() |
|
62 | { |
||
63 | 1 | return $this->container->getParameter('kernel.debug'); |
|
64 | } |
||
65 | |||
66 | /** |
||
67 | * Find out whether maintenance mode is enabled for users of the website |
||
68 | * |
||
69 | * @return bool |
||
70 | */ |
||
71 | 1 | public function isMaintenance() |
|
72 | { |
||
73 | 1 | return $this->container->getParameter('bzion.miscellaneous.maintenance'); |
|
74 | } |
||
75 | |||
76 | /** |
||
77 | * Get the name of the website |
||
78 | * |
||
79 | * @return string |
||
80 | */ |
||
81 | 1 | public function getSiteTitle() |
|
82 | { |
||
83 | 1 | return $this->container->getParameter('bzion.site.name'); |
|
84 | } |
||
85 | |||
86 | /** |
||
87 | * Get the name of the website |
||
88 | * |
||
89 | * @return string |
||
90 | */ |
||
91 | 1 | public function getSiteWelcome() |
|
92 | { |
||
93 | 1 | return $this->container->getParameter('bzion.site.welcome'); |
|
94 | } |
||
95 | |||
96 | /** |
||
97 | * Get the name of the website |
||
98 | * |
||
99 | * @return string |
||
100 | */ |
||
101 | 1 | public function getSiteSlug() |
|
102 | { |
||
103 | 1 | return $this->container->getParameter('bzion.site.slug'); |
|
104 | } |
||
105 | |||
106 | /** |
||
107 | * Whether or not the website wide alert is enabled |
||
108 | * |
||
109 | * @return bool |
||
110 | */ |
||
111 | 1 | public function isAlertEnabled() |
|
115 | |||
116 | /** |
||
117 | * Should the alert be collapsible |
||
118 | * |
||
119 | * @return bool |
||
120 | */ |
||
121 | public function isAlertCollapsible() |
||
125 | |||
126 | /** |
||
127 | * The title of the alert |
||
128 | * |
||
129 | * @return string |
||
130 | */ |
||
131 | public function getAlertHeader() |
||
135 | |||
136 | /** |
||
137 | * The message of the alert |
||
138 | * |
||
139 | * @return string |
||
140 | */ |
||
141 | public function getAlertMessage() |
||
145 | |||
146 | /** |
||
147 | * The type of URLs for Models |
||
148 | * |
||
149 | * @return string `vanity` or `permalink` |
||
150 | */ |
||
151 | public function getUrlType() |
||
152 | { |
||
153 | return $this->container->getParameter('bzion.site.url_type'); |
||
155 | |||
156 | /** |
||
157 | * A unique enough identifier of the alert |
||
158 | * |
||
159 | * @return string |
||
160 | */ |
||
161 | 1 | public function getAlertID() |
|
165 | 1 | ||
166 | 1 | /** |
|
167 | * Get information about sockets |
||
168 | * |
||
169 | * @return array |
||
170 | */ |
||
171 | public function getSocket() |
||
180 | 1 | ||
181 | /** |
||
182 | * Get a list of visible pages |
||
183 | * |
||
184 | * @return \Page[] |
||
185 | */ |
||
186 | public function getPages() |
||
192 | } |
||
193 |