View source
<?php
function at_tools_flush_caches() {
if (variable_get('preprocess_css', '') == 1) {
$themes_array = array(
'adaptivetheme',
);
$themes = list_themes(TRUE);
foreach ($themes as $key => $theme_name) {
if ($key == 'adaptivetheme') {
foreach ($theme_name->sub_themes as $sub_theme_key => $sub_theme_name) {
$array[] = $sub_theme_key;
}
}
foreach ($array as $name) {
if ($name == $key) {
if ($theme_name->status == 1) {
$themes_array[] = $key;
}
}
}
}
module_load_include('inc', 'system', 'system.admin');
foreach ($themes_array as $theme_name) {
$form_state = form_state_defaults();
$form_state['build_info']['args'][0] = $theme_name;
$form_state['values'] = array();
drupal_form_submit('system_theme_settings', $form_state);
}
}
}