You are here

function boost_admin_boost_performance_page_submit in Boost 6

submit boost_admin_boost_performance_page form submissions.

1 string reference to 'boost_admin_boost_performance_page_submit'
boost_admin_boost_performance_page in ./boost.admin.inc
Form builder; Displays Boost's configuration page.

File

./boost.admin.inc, line 1063
All the code for the Boost module's administrative interface.

Code

function boost_admin_boost_performance_page_submit($form, &$form_state) {
  boost_htaccess_cache_dir_put();

  // Skip if views not enabled
  if (module_exists('views')) {
    $key = 'boost_views_list_custom';
    $op = isset($form_state['values']['op']) ? $form_state['values']['op'] : '';
    if ($op == t('Reset to defaults')) {
      variable_del($key);
    }
    else {
      $defaults = boost_views_generate_default_list();
      $new = $form_state['values'][$key];
      $disable = array_diff($defaults, $new);
      $enable = array_diff($new, $defaults);
      $values = $enable;
      foreach ($disable as $hash => $value) {
        $values[$hash] = $new[$hash];
      }
      unset($values['line-break']);
      if ($values) {
        variable_set($key, $values);
      }
      else {
        variable_del($key);
      }
    }
    unset($form_state['values'][$key]);
  }

  //split white/blacklists into arrays
  $whitelist_values = explode("\n", $form_state['values']['boost_domain_whitelist']);
  $whitelist_values = array_map('trim', $whitelist_values);
  $whitelist = array_combine($whitelist_values, $whitelist_values);
  if ($form_state['values']['boost_domain_whitelist_use_domain'] && function_exists('domain_domains')) {
    $extra_domains = domain_domains();
    foreach ($extra_domains as $key => $extra_domain) {
      $whitelist[$extra_domain['subdomain']] = $extra_domain['subdomain'];
    }
  }
  asort($whitelist);
  variable_set('boost_domain_whitelist', $whitelist);
  unset($form_state['values']['boost_domain_whitelist']);
  $whitelist_wild_values = explode("\n", $form_state['values']['boost_domain_whitelist_wild']);
  $whitelist_wild_values = array_map('trim', $whitelist_wild_values);
  $whitelist_wild = array_combine($whitelist_wild_values, $whitelist_wild_values);
  asort($whitelist_wild);
  variable_set('boost_domain_whitelist_wild', $whitelist_wild);
  unset($form_state['values']['boost_domain_whitelist_wild']);
  $blacklist_values = explode("\n", $form_state['values']['boost_domain_blacklist']);
  $blacklist_values = array_map('trim', $blacklist_values);
  $blacklist = array_combine($blacklist_values, $blacklist_values);
  asort($blacklist);
  variable_set('boost_domain_blacklist', $blacklist);
  unset($form_state['values']['boost_domain_blacklist']);
}