1 |
85ad3d82
|
Assos Assos
|
<?php
|
2 |
|
|
|
3 |
|
|
/**
|
4 |
|
|
* @file
|
5 |
|
|
* Saves a parsable inc file with the full color info array for the active theme.
|
6 |
|
|
*
|
7 |
|
|
* If a custom color scheme has been created in the UI it is injected into the
|
8 |
|
|
* schemes array and saved. You must rename the Custom scheme and give it a
|
9 |
|
|
* unique array key before using the generated file in your theme.
|
10 |
|
|
*
|
11 |
|
|
* Note that color module validates the input of the color form and this is not
|
12 |
74f6bef0
|
Assos Assos
|
* run if there is a problem, e.g. the user inputting non hexadecimal CSS color
|
13 |
85ad3d82
|
Assos Assos
|
* strings, which color module validates to avoid XSS.
|
14 |
|
|
*/
|
15 |
74f6bef0
|
Assos Assos
|
function at_core_submit_color($values, $theme_name, $path) {
|
16 |
|
|
$palette = $values['palette'];
|
17 |
|
|
if ($values['info']['schemes']) {
|
18 |
|
|
$values['info']['schemes']['']['colors'] = $palette;
|
19 |
|
|
}
|
20 |
|
|
$info = $values['info'];
|
21 |
|
|
$color_info = array();
|
22 |
|
|
$color_info[] = "<?php" . "\n";
|
23 |
|
|
$color_info[] = '$info = ';
|
24 |
|
|
$color_info[] = var_export($info, TRUE);
|
25 |
|
|
$color_info[] = ';' . "\n";
|
26 |
|
|
$color_info_export = implode('', $color_info);
|
27 |
|
|
if (!empty($color_info_export)) {
|
28 |
|
|
$filepath = $path . '/' . $theme_name . '_color.inc';
|
29 |
|
|
file_unmanaged_save_data($color_info_export, $filepath, FILE_EXISTS_REPLACE);
|
30 |
|
|
}
|
31 |
85ad3d82
|
Assos Assos
|
} |