3 * Build custom CSS elements defined in the Admin pages.
7 * @author Robert Down <robertdown@live.com>
8 * @copyright Copyright (c) 2017 Robert Down
9 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
12 require_once __DIR__
. '/../globals.php';
14 $cssFile = file_get_contents('themeBuilder.css');
16 // Allowed CSS replacements
22 // Build string-replacement array
25 preg_match_all($re, $cssFile, $matches, PREG_SET_ORDER
);
27 foreach ($matches as $match) {
28 $rawString = $match[0];
30 if (!array_key_exists($key, $GLOBALS)) {
31 $msg = sprintf("The key '%s' was not found in the list of global variables", $key);
36 if ($GLOBALS["{$key}"] === '__default__') {
37 $cssFile = str_replace($rawString, '', $cssFile);
41 if (in_array($key, $variables)) {
42 // This is a CSS variable, not a $GLOBAL value replacement
43 $globalVal = $GLOBALS["{$key}"];
44 $attribString = "{$key}: {$globalVal} !important;";
45 $cssFile = str_replace($rawString, $attribString, $cssFile);
47 // $GLOBAL value replacement
48 $cssFile = str_replace($rawString, $GLOBALS["{$key}"], $cssFile);
52 header('Content-Type: text/css');
53 //set headers to NOT cache a page
54 header("Cache-Control: no-cache, must-revalidate"); //HTTP 1.1
55 header("Pragma: no-cache"); //HTTP 1.0
56 header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past