Elgg  Version 2.3
caching.php
Go to the documentation of this file.
1 <?php
6 // simple cache
7 $is_simple_cache_on = (bool)elgg_get_config('simplecache_enabled');
8 $simple_cache_disabled_class = $is_simple_cache_on ? '' : 'elgg-state-disabled';
9 
10 $params = array(
11  'label' => elgg_echo('installation:simplecache:label'),
12  'name' => 'simplecache_enabled',
13  'checked' => $is_simple_cache_on,
14 );
15 
16 $simple_cache_warning = '<p class="elgg-text-help">' . elgg_echo('installation:simplecache:description') . '</p>';
17 if ($GLOBALS['_ELGG']->simplecache_enabled_in_settings) {
18  $params['class'] = 'elgg-state-disabled';
19  $params['label_class'] = 'elgg-state-disabled';
20 
21  $simple_cache_warning .= "<span class=\"elgg-text-help\">" . elgg_echo('admin:settings:in_settings_file') . "</span>";
22 }
23 $simple_cache_input = elgg_view("input/checkbox", $params);
24 
26 $params = array(
27  'label' => elgg_echo('installation:cache_symlink:label'),
28  'name' => 'cache_symlink_enabled',
29  'checked' => $cache_symlinked,
31  'label_class' => $simple_cache_disabled_class,
32 );
33 $symlink_warning = '<p class="elgg-text-help">' . elgg_echo('installation:cache_symlink:description') . '</p>';
34 if ($cache_symlinked) {
35  $params['class'] = 'elgg-state-disabled';
36  $params['label_class'] = 'elgg-state-disabled';
37 
38  $symlink_warning .= elgg_format_element('span', ['class' => 'elgg-text-help'], elgg_echo('installation:cache_symlink:warning'));
39 }
40 
41 $symlink_input = elgg_view('input/checkbox', $params);
43 $symlink_target = elgg_get_cache_path() . 'views_simplecache/';
44 $symlink_paths_help = elgg_echo('installation:cache_symlink:paths', [$symlink_source, $symlink_target]);
45 $symlink_warning .= elgg_format_element('span', ['class' => 'elgg-text-help'], $symlink_paths_help);
46 
47 // minify
48 $minify_description = elgg_echo('installation:minify:description');
49 $minify_js_input = elgg_view("input/checkbox", array(
50  'label' => elgg_echo('installation:minify_js:label'),
51  'name' => 'simplecache_minify_js',
52  'checked' => (bool)elgg_get_config('simplecache_minify_js'),
53  'label_class' => $simple_cache_disabled_class,
54 ));
55 
56 $minify_css_input = elgg_view("input/checkbox", array(
57  'label' => elgg_echo('installation:minify_css:label'),
58  'name' => 'simplecache_minify_css',
59  'checked' => (bool)elgg_get_config('simplecache_minify_css'),
60  'label_class' => $simple_cache_disabled_class,
61 ));
62 
64  '#type' => 'checkbox',
65  'label' => elgg_echo('installation:systemcache:label'),
66  'help' => elgg_echo('installation:systemcache:description'),
67  'name' => 'system_cache_enabled',
68  'checked' => elgg_is_system_cache_enabled(),
69  '#class' => 'mtm',
70 ]);
71 
72 $body = <<<BODY
73  <div>
76  </div>
77  <div>
80  </div>
81  <div>
83  $minify_js_input<br />
85  </div>
86 
88 BODY;
89 
90 echo elgg_view_module('inline', elgg_echo('admin:legend:caching'), $body, ['id' => 'elgg-settings-advanced-caching']);
$params
Definition: caching.php:10
elgg_get_config($name, $site_guid=0)
Get an Elgg configuration value.
_elgg_is_cache_symlinked()
Checks if /cache directory has been symlinked to views simplecache directory.
Definition: cache.php:235
elgg_view_field(array $params=[])
Renders a form field, usually with a wrapper element, a label, help text, etc.
Definition: views.php:1424
if($cache_symlinked) $symlink_input
Definition: caching.php:41
elgg_echo($message_key, $args=array(), $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
$minify_css_input
Definition: caching.php:56
$symlink_warning
Definition: caching.php:33
$symlink_paths_help
Definition: caching.php:44
$is_simple_cache_on
Advanced site settings, caching section.
Definition: caching.php:7
$minify_js_input
Definition: caching.php:49
$symlink_source
Definition: caching.php:42
$system_cache_input
Definition: caching.php:63
if($GLOBALS['_ELGG']->simplecache_enabled_in_settings) $simple_cache_input
Definition: caching.php:23
elgg_format_element($tag_name, array $attributes=array(), $text= '', array $options=array())
Format an HTML element.
Definition: output.php:208
$simple_cache_disabled_class
Definition: caching.php:8
$minify_description
Definition: caching.php:48
elgg_get_cache_path()
Get the cache directory path for this installation.
$symlink_target
Definition: caching.php:43
fieldset div
Definition: admin.css.php:485
elgg_get_root_path()
Get the root directory path for this installation.
elgg echo
Translates a string.
Definition: languages.js:48
elgg_view($view, $vars=array(), $ignore1=false, $ignore2=false, $viewtype= '')
Return a parsed view.
Definition: views.php:336
p
Definition: admin.css.php:118
elgg_view_module($type, $title, $body, array $vars=array())
Wrapper function for the module display pattern.
Definition: views.php:1250
elgg_is_system_cache_enabled()
Is system cache enabled.
Definition: cache.php:60
$cache_symlinked
Definition: caching.php:25
$simple_cache_warning
Definition: caching.php:16
$body
Definition: caching.php:72