Elgg  Version master
theme.php
Go to the documentation of this file.
1 <?php
2 
4 
5 $vars = (array) get_input('vars', [], false);
6 $vars = array_filter($vars);
7 
8 $available_config = _elgg_services()->cssCompiler->getCssVars([], false);
9 foreach ($vars as $name => $value) {
10  if (empty($value)) {
11  unset($vars[$name]);
12  continue;
13  }
14 
15  if (!array_key_exists($name, $available_config)) {
16  unset($vars[$name]);
17  continue;
18  }
19 
20  if (strtolower($value) === strtolower((string) $available_config[$name])) {
21  unset($vars[$name]);
22  continue;
23  }
24 }
25 
26 if (empty($vars)) {
27  elgg_remove_config('custom_theme_vars');
28 } else {
29  elgg_save_config('custom_theme_vars', $vars);
30 }
31 
33 
34 return elgg_ok_response('', elgg_echo('save:success'));
if(!$user||!$user->canDelete()) $name
Definition: delete.php:22
elgg_ok_response($content= '', string|array $message= '', string $forward_url=null, int $status_code=ELGG_HTTP_OK)
Prepares a successful response to be returned by a page or an action handler.
$available_config
Definition: theme.php:8
elgg_echo(string $message_key, array $args=[], string $language= '')
Elgg language module Functions to manage language and translations.
Definition: languages.php:17
$value
Definition: generic.php:51
get_input(string $variable, $default=null, bool $filter_result=true)
Parameter input functions.
Definition: input.php:20
elgg_invalidate_caches()
Invalidate all the registered caches.
Definition: cache.php:88
elgg_save_config(string $name, $value)
Save a configuration setting.
elgg_remove_config(string $name)
Removes a config setting.
$vars
Definition: theme.php:5
_elgg_services()
Get the global service provider.
Definition: elgglib.php:351