Page Menu
Home
Code
Search
Configure Global Search
Log In
Files
F15624045
Engine.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
Engine.php
View Options
<?php
namespace
Zed\Engines\Templates\Smarty
;
use
Smarty
;
class
Engine
{
///
/// Private members
///
/**
* @var Smarty
*/
private
$smarty
;
/**
* @var Configuration
*/
private
$config
;
///
/// Singleton
///
/**
* @var Engine
*/
private
static
$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
());
$smarty
->
config_vars
+=
[
'StaticContentURL'
=>
$this
->
config
->
getStaticContentURL
(),
];
return
$smarty
;
}
///
/// Getters
///
public
function
getSmarty
()
:
Smarty
{
return
$this
->
smarty
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Thu, Nov 26, 04:19 (1 d, 6 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
24250
Default Alt Text
Engine.php (1 KB)
Attached To
Mode
rZED Zed
Attached
Detach File
Event Timeline
Log In to Comment