You are here

function shadowbox_construct_header in Shadowbox 5.2

Same name and namespace in other branches
  1. 5 shadowbox.module \shadowbox_construct_header()
  2. 6.4 shadowbox.module \shadowbox_construct_header()
  3. 6.2 shadowbox.module \shadowbox_construct_header()
  4. 6.3 shadowbox.module \shadowbox_construct_header()

Build the Shadowbox header by adding the necessary CSS and JS files.

1 call to shadowbox_construct_header()
shadowbox_menu in ./shadowbox.module
Implementation of hook_menu().

File

./shadowbox.module, line 672
Shadowbox, a JavaScript media viewer application for displaying content in a modal dialogue.

Code

function shadowbox_construct_header() {
  global $locale;
  $path = drupal_get_path('module', 'shadowbox');
  $images = variable_get('shadowbox_supported_images', shadowbox_get_types('image'));
  $swf = variable_get('shadowbox_supported_swf', shadowbox_get_types('swf'));
  $flv = variable_get('shadowbox_supported_flv', shadowbox_get_types('flv'));
  $quicktime = variable_get('shadowbox_supported_quicktime', shadowbox_get_types('quicktime'));
  $wmp = variable_get('shadowbox_supported_wmp', shadowbox_get_types('wmp'));
  $qtwmp = variable_get('shadowbox_supported_qtwmp', shadowbox_get_types('qtwmp'));
  $iframe = variable_get('shadowbox_supported_iframe', shadowbox_get_types('iframe'));
  $image_support = array_filter($images);
  $swf_support = array_filter($swf);
  $flv_support = array_filter($flv);
  $quicktime_support = array_filter($quicktime);
  $wmp_support = array_filter($wmp);
  $qtwmp_support = array_filter($qtwmp);
  $iframe_support = array_filter($iframe);
  if (shadowbox_active() && variable_get('shadowbox_enabled', TRUE)) {
    drupal_add_js($path . '/shadowbox/build/adapter/shadowbox-jquery.js');
    drupal_add_js($path . '/shadowbox/build/shadowbox.js');
    drupal_add_js($path . '/shadowbox_auto.js');
    drupal_add_js($path . '/shadowbox.js');
    drupal_add_js($path . '/shadowbox/src/skin/classic/skin.js');
    drupal_add_css($path . '/shadowbox/src/skin/classic/skin.css');

    // If language is set to xx (i.e. when using string overrides module) default to English.
    if ($locale == 'xx') {
      $locale = 'en';
    }
    drupal_add_js($path . '/shadowbox/build/lang/shadowbox-' . $locale . '.js');
    if (!empty($image_support)) {
      drupal_add_js($path . '/shadowbox/build/player/shadowbox-img.js');
    }
    if (!empty($flv_support)) {
      drupal_add_js($path . '/shadowbox/build/player/shadowbox-flv.js');
    }
    if (!empty($iframe_support)) {
      drupal_add_js($path . '/shadowbox/build/player/shadowbox-html.js');
      drupal_add_js($path . '/shadowbox/build/player/shadowbox-iframe.js');
    }
    if (!empty($swf_support)) {
      drupal_add_js($path . '/shadowbox/build/player/shadowbox-swf.js');
    }
    if (!empty($wmp_support) || !empty($qtwmp_support)) {
      drupal_add_js($path . '/shadowbox/build/player/shadowbox-wmp.js');
    }
    if (!empty($qtwmp_support)) {
      drupal_add_js($path . '/shadowbox/build/player/shadowbox-qt.js');
    }
    drupal_add_js(shadowbox_get_settings(), 'setting');
  }
}