settings->backgroundcolor)) { $backgroundcolor = $theme->settings->backgroundcolor; } else { $backgroundcolor = null; } $css = formalwhite_set_backgroundcolor($css, $backgroundcolor); // Set the region width if (!empty($theme->settings->regionwidth)) { $regionwidth = $theme->settings->regionwidth; } else { $regionwidth = null; } $css = formalwhite_set_regionwidth($css, $regionwidth); // Set the custom CSS if (!empty($theme->settings->customcss)) { $customcss = $theme->settings->customcss; } else { $customcss = null; } $css = formalwhite_set_customcss($css, $customcss); // Return the CSS return $css; } /** * Sets the background colour variable in CSS * * @param string $css * @param mixed $backgroundcolor * @return string */ function formalwhite_set_backgroundcolor($css, $backgroundcolor) { $tag = '[[setting:backgroundcolor]]'; $replacement = $backgroundcolor; if (is_null($replacement)) { $replacement = '#F7F6F1'; } $css = str_replace($tag, $replacement, $css); return $css; } /** * Sets the region width variable in CSS * * @param string $css * @param mixed $regionwidth * @return string */ function formalwhite_set_regionwidth($css, $regionwidth) { $tag = '[[setting:regionwidth]]'; $doubletag = '[[setting:regionwidthdouble]]'; $replacement = $regionwidth; if (is_null($replacement)) { $replacement = 200; } $css = str_replace($tag, $replacement.'px', $css); $css = str_replace($doubletag, ($replacement*2).'px', $css); $css = str_replace($tag, ($replacement+10).'px', $css); return $css; } /** * Sets the custom css variable in CSS * * @param string $css * @param mixed $customcss * @return string */ function formalwhite_set_customcss($css, $customcss) { $tag = '[[setting:customcss]]'; $replacement = $customcss; if (is_null($replacement)) { $replacement = ''; } $css = str_replace($tag, $replacement, $css); return $css; }