Page Menu
Home
Code
Search
Configure Global Search
Log In
Files
F1138163
Engine.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
Engine.php
View Options
<?php
namespace
Zed\Engines\Templates\Smarty
;
use
Smarty
;
class
Engine
{
///
/// Private members
///
private
Smarty
$smarty
;
private
Configuration
$config
;
///
/// Singleton
///
private
static
?
Engine
$instance
=
null
;
public
static
function
load
()
:
Engine
{
if
(
self
::
$instance
===
null
)
{
self
::
$instance
=
new
self
;
}
return
self
::
$instance
;
}
///
/// Constructor
///
public
function
__construct
(
?
Smarty
$smarty
=
null
,
?
Configuration
$config
=
null
)
{
$this
->
config
=
$config
??
Configuration
::
load
();
$this
->
smarty
=
$smarty
??
$this
->
buildDefaultSmarty
();
}
///
/// Factory methods
///
private
function
buildDefaultSmarty
()
:
Smarty
{
$smarty
=
new
Smarty
();
$smarty
->
setCacheDir
(
$this
->
config
->
getCacheDirectory
())
->
setCompileDir
(
$this
->
config
->
getCompileDirectory
())
->
setTemplateDir
(
$this
->
config
->
getTemplateDirectory
())
->
setConfigDir
(
$this
->
config
->
getApplicationDirectory
())
->
addPluginsDir
(
$this
->
config
->
getPluginsDirectory
());
self
::
initializeDefaultVariables
(
$smarty
);
$smarty
->
config_vars
+=
[
'StaticContentURL'
=>
$this
->
config
->
getStaticContentURL
(),
];
return
$smarty
;
}
private
static
function
initializeDefaultVariables
(
Smarty
$smarty
):
void
{
$smarty
->
assign
(
"PAGE_CSS"
,
[]);
$smarty
->
assign
(
"PAGE_JS"
,
[]);
}
///
/// Getters
///
public
function
getSmarty
()
:
Smarty
{
return
$this
->
smarty
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, Jul 15, 22:12 (1 w, 6 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
23290
Default Alt Text
Engine.php (1 KB)
Attached To
rZED Zed
Event Timeline
Log In to Comment