You are here

function jstimer_build_js_cache in Javascript Timer 6

Same name and namespace in other branches
  1. 8 jstimer.module \jstimer_build_js_cache()
  2. 7 jstimer.module \jstimer_build_js_cache()

create the timer.js file and put it in the files/jstimer directory.

Return value

string The full path of the file.

4 calls to jstimer_build_js_cache()
jstimer_admin_settings_submit in ./jstimer.admin.inc
jstimer_init in ./jstimer.module
Implementation of hook_init
jst_clock_enable in widgets/jst_clock.module
Implementation of hook_enable().
jst_timer_enable in widgets/jst_timer.module
Implementation of hook_enable().

File

./jstimer.module, line 179
A module which creates javascript timed dhtml things.

Code

function jstimer_build_js_cache() {

  // Create the files/jstimer
  $path = file_create_path('jstimer');
  file_check_directory($path, FILE_CREATE_DIRECTORY);
  $data = jstimer_get_javascript();
  file_save_data($data, $path . '/timer.js', FILE_EXISTS_REPLACE);
  drupal_set_message(t('Countdown Timer javascript file saved to: ') . $path . '/timer.js');
  if (!file_exists($path . '/timer.js')) {
    drupal_set_message(t('File Create Error: timer.js could not be created'), 'error');
  }
  else {
    variable_set('jstimer_timerjs_path', $path . '/timer.js');
  }
  return $path . '/timer.js';
}