function at_theme_conditional_script

cis7 load.inc at_theme_conditional_script($filepath)
cle7 load.inc at_theme_conditional_script($filepath)
elmsmedia7 load.inc at_theme_conditional_script($filepath)
icor7 load.inc at_theme_conditional_script($filepath)
meedjum_blog7 load.inc at_theme_conditional_script($filepath)
mooc7 load.inc at_theme_conditional_script($filepath)

Return a themed script. Since Drupal 7 does not (yet) support the 'browser' option in drupal_add_js() Adaptivetheme provides a way to load scripts inside conditional comments. This function wraps a file in script elements and returns a string.

Parameters

$filepath, path to the file.:

1 call to at_theme_conditional_script()
at_load_polyfills in sites/all/themes/ulmus/adaptivetheme/at_core/inc/load.inc
Load Polyfill Scripts Conditional scripts are returned to the preprocess function - in AT Core that means adaptivetheme_preprocess_html() and adaptivetheme_preprocess_maintenance_page(). There are two sources for conditional scripts - the subtheme…

File

sites/all/themes/ulmus/adaptivetheme/at_core/inc/load.inc, line 564
Provides frequently used functions that load something, ususally CSS or JS files, or that provide assistance to those loaders.

Code

function at_theme_conditional_script($filepath) {
  $script = '';

  // We need the default query string for cache control finger printing
  $query_string = variable_get('css_js_query_string', '0');

  if (file_exists($filepath)) {
    $file = file_create_url($filepath);
    $script = '<script src="' . $file . '?' . $query_string . '"></script>';
  }

  return $script;
}