Elgg  Version 2.2
 All Classes Namespaces Files Functions Variables Pages
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 if ($GLOBALS['_ELGG']->simplecache_enabled_in_settings) {
16  $params['class'] = 'elgg-state-disabled';
17  $params['label_class'] = 'elgg-state-disabled';
18 }
19 $simple_cache_input = elgg_view("input/checkbox", $params);
21 
22 if ($GLOBALS['_ELGG']->simplecache_enabled_in_settings) {
23  $warning = elgg_echo('admin:settings:in_settings_file');
24  $simple_cache_warning .= "<span class=\"elgg-text-help\">$warning</span>";
25 }
26 
28 $params = array(
29  'label' => elgg_echo('installation:cache_symlink:label'),
30  'name' => 'cache_symlink_enabled',
31  'checked' => $cache_symlinked,
33  'label_class' => $simple_cache_disabled_class,
34 );
36 if ($cache_symlinked) {
37  $params['class'] = 'elgg-state-disabled';
38  $params['label_class'] = 'elgg-state-disabled';
39 }
40 $symlink_input .= elgg_view("input/checkbox", $params);
41 if ($cache_symlinked) {
42  $symlink_warning .= elgg_format_element('span', ['class' => 'elgg-text-help'], elgg_echo('installation:cache_symlink:warning'));
43 }
45 $symlink_target = elgg_get_cache_path() . 'views_simplecache/';
46 $symlink_paths_help = elgg_echo('installation:cache_symlink:paths', [$symlink_source, $symlink_target]);
47 $symlink_warning .= elgg_format_element('span', ['class' => 'elgg-text-help'], $symlink_paths_help);
48 
49 // minify
50 $minify_js_input = elgg_view("input/checkbox", array(
51  'label' => elgg_echo('installation:minify_js:label'),
52  'name' => 'simplecache_minify_js',
53  'checked' => (bool)elgg_get_config('simplecache_minify_js'),
54  'label_class' => $simple_cache_disabled_class,
55 ));
56 
57 $minify_css_input = elgg_view("input/checkbox", array(
58  'label' => elgg_echo('installation:minify_css:label'),
59  'name' => 'simplecache_minify_css',
60  'checked' => (bool)elgg_get_config('simplecache_minify_css'),
61  'label_class' => $simple_cache_disabled_class,
62 ));
63 
64 $system_cache_input = elgg_view("input/checkbox", array(
65  'label' => elgg_echo('installation:systemcache:label'),
66  'name' => 'system_cache_enabled',
67  'checked' => elgg_is_system_cache_enabled(),
68 ))
69 
70 ?>
71 <fieldset class="elgg-fieldset" id="elgg-settings-advanced-caching">
72  <legend><?php echo elgg_echo('admin:legend:caching'); ?></legend>
73 
74  <div>
75  <?php echo $simple_cache_input; ?>
76  <p class="elgg-text-help"><?php echo elgg_echo('installation:simplecache:description'); ?></p>
77  <?php echo $simple_cache_warning; ?>
78  </div>
79  <div>
80  <?php echo $symlink_input; ?>
81  <p class="elgg-text-help"><?php echo elgg_echo('installation:cache_symlink:description'); ?></p>
82  <?php echo $symlink_warning; ?>
83  </div>
84  <div>
85  <p><?php echo elgg_echo('installation:minify:description'); ?></p>
86  <?php echo $minify_js_input; ?><br />
87  <?php echo $minify_css_input; ?>
88  </div>
89 
90  <div>
91  <?php echo $system_cache_input; ?>
92  <p class="elgg-text-help"><?php echo elgg_echo('installation:systemcache:description'); ?></p>
93  </div>
94 
95 </fieldset>
$params
Definition: caching.php:10
elgg_get_config($name, $site_guid=0)
Get an Elgg configuration value.
if($GLOBALS['_ELGG']->simplecache_enabled_in_settings) $cache_symlinked
Definition: caching.php:27
_elgg_is_cache_symlinked()
Checks if /cache directory has been symlinked to views simplecache directory.
Definition: cache.php:235
if($cache_symlinked) $symlink_input
Definition: caching.php:40
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:57
$symlink_warning
Definition: caching.php:35
$symlink_paths_help
Definition: caching.php:46
$is_simple_cache_on
Advanced site settings, caching section.
Definition: caching.php:7
$minify_js_input
Definition: caching.php:50
$system_cache_input
Definition: caching.php:64
if($GLOBALS['_ELGG']->simplecache_enabled_in_settings) $simple_cache_input
Definition: caching.php:19
elgg_format_element($tag_name, array $attributes=array(), $text= '', array $options=array())
Format an HTML element.
Definition: output.php:218
$simple_cache_disabled_class
Definition: caching.php:8
if($cache_symlinked) $symlink_source
Definition: caching.php:44
elgg_get_cache_path()
Get the cache directory path for this installation.
$symlink_target
Definition: caching.php:45
elgg_get_root_path()
Get the root directory path for this installation.
elgg_view($view, $vars=array(), $ignore1=false, $ignore2=false, $viewtype= '')
Return a parsed view.
Definition: views.php:342
elgg_is_system_cache_enabled()
Is system cache enabled.
Definition: cache.php:60
$simple_cache_warning
Definition: caching.php:20