You are here

function mostpopular_settings_form_submit in Drupal Most Popular 6

1 string reference to 'mostpopular_settings_form_submit'
mostpopular_settings_form in ./mostpopular.admin.inc

File

./mostpopular.admin.inc, line 121
Defines all the administration forms for the Most Popular module.

Code

function mostpopular_settings_form_submit($form, &$form_state) {

  // If the max is changing, reset all the service last run times
  if ($form_state['values']['mostpopular_max'] != variable_get('mostpopular_max', 5)) {
    MostPopularLastRun::resetLastRun();
    drupal_set_message(t('The last run times for the services were reset.'));
  }

  // Change the encoding for the path fields
  $basepaths = explode("\n", $form_state['values']['mostpopular_basepaths']);
  $form_state['values']['mostpopular_basepaths'] = array();
  foreach ($basepaths as $path) {
    $path = trim($path);
    if (!empty($path)) {
      $form_state['values']['mostpopular_basepaths'][] = $path;
    }
  }
  $excludepaths = explode("\n", $form_state['values']['mostpopular_exclude_paths']);
  $form_state['values']['mostpopular_exclude_paths'] = array();
  foreach ($excludepaths as $path) {
    $path = trim($path);
    if (!empty($path)) {
      $form_state['values']['mostpopular_exclude_paths'][] = $path;
    }
  }
}