Elgg
Version 3.0
Main Page
Related Pages
Namespaces
Classes
Files
Examples
File List
File Members
engine
classes
Elgg
Assets
CssCompiler.php
Go to the documentation of this file.
1
<?php
2
3
namespace
Elgg\Assets
;
4
5
use
Elgg\Config
;
6
use
Elgg\Includer
;
7
use
Elgg\PluginHooksService
;
8
use
Elgg\Project\Paths
;
9
15
class
CssCompiler
{
16
20
protected
$config
;
21
25
protected
$hooks
;
26
33
public
function
__construct
(
Config
$config
,
PluginHooksService
$hooks
) {
34
$this->config =
$config
;
35
$this->hooks =
$hooks
;
36
}
37
46
public
function
compile
(
$css
, array
$options
= []) {
47
$defaults
= [
48
'minify'
=>
false
,
// minify handled by _elgg_views_minify
49
'formatter'
=>
'single-line'
,
// shows lowest byte size
50
'versioning'
=>
false
,
// versioning done by Elgg
51
'rewrite_import_urls'
=>
false
,
52
];
53
54
$config
= (array) $this->config->css_compiler_options;
55
56
$options
= array_merge(
$defaults
,
$config
,
$options
);
57
58
$default_vars = $this->
getDefaultVars
();
59
$custom_vars = (array)
elgg_extract
(
'vars'
,
$options
, []);
60
$vars
= array_merge($default_vars, $custom_vars);
61
62
$options
[
'vars'
] = $this->hooks->trigger(
'vars:compiler'
,
'css'
,
$options
,
$vars
);
63
64
return
csscrush_string(
$css
,
$options
);
65
}
66
71
protected
function
getDefaultVars
() {
72
$file
=
Paths::elgg
() .
'engine/theme.php'
;
73
return
Includer::includeFile
(
$file
);
74
}
75
}
Paths
Elgg\Includer\includeFile
static includeFile($file)
Include a file with as little context as possible.
Definition:
Includer.php:18
$file
if(!array_key_exists($filename, $text_files)) $file
Definition:
plugin_text_file.php:29
Elgg\Project\Paths\elgg
static elgg()
Get the Elgg codebase path with "/".
Definition:
Paths.php:44
$defaults
$defaults
Definition:
autocomplete.php:29
Elgg\Config
Definition:
Config.php:121
Elgg\Assets
Definition:
CssCompiler.php:3
Elgg\Assets\CssCompiler\getDefaultVars
getDefaultVars()
Default Elgg theme variables.
Definition:
CssCompiler.php:71
Elgg\Config
Definition:
DatarootSettingMigrator.php:3
$css
$css
Definition:
maintenance.php:16
$options
$options
Elgg admin footer.
Definition:
footer.php:6
Elgg\Assets\CssCompiler\__construct
__construct(Config $config, PluginHooksService $hooks)
Constructor.
Definition:
CssCompiler.php:33
Elgg\Assets\CssCompiler\$hooks
$hooks
Definition:
CssCompiler.php:25
PluginHooksService
Elgg\Assets\CssCompiler\compile
compile($css, array $options=[])
Compile CSS.
Definition:
CssCompiler.php:46
elgg_extract
elgg_extract($key, $array, $default=null, $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
Definition:
elgglib.php:1131
Elgg\Assets\CssCompiler
Compile CSS with CSSCrush.
Definition:
CssCompiler.php:15
Elgg\Assets\CssCompiler\$config
$config
Definition:
CssCompiler.php:20
Elgg\PluginHooksService
Plugin Hooks.
Definition:
PluginHooksService.php:11
Includer
$vars
$vars['type']
Definition:
save.php:11
Generated on Mon Mar 8 2021 00:00:16 for Elgg by
1.8.11