Skip to content

Instantly share code, notes, and snippets.

@proframework
Created July 5, 2014 23:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save proframework/79dd529afbbad4d84ea0 to your computer and use it in GitHub Desktop.
Save proframework/79dd529afbbad4d84ea0 to your computer and use it in GitHub Desktop.
$name = md5(site_url());
$name = substr($name, 0, 15);
if (!empty($_GET[$name . '-css']) == 'css') {
header('Content-Type: text/css');
$generate_settings = get_option( 'generate_settings', generate_get_defaults() );
$space = ' ';
// Start the magic
$visual_css = array (
// Body CSS
'body' => array(
'background-color' => $generate_settings['background_color'],
'color' => $generate_settings['text_color']
),
);
// Output the above CSS
$output = '';
foreach($visual_css as $k => $properties) {
if(!count($properties))
continue;
$temporary_output = $k . ' {';
$elements_added = 0;
foreach($properties as $p => $v) {
if(empty($v))
continue;
$elements_added++;
$temporary_output .= $p . ': ' . $v . '; ';
}
$temporary_output .= "}";
if($elements_added > 0)
$output .= $temporary_output;
}
$output = str_replace(array("\r", "\n"), '', $output);
echo $output;
exit;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment