You are here

function jw_player_skins in JW Player 7.2

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

Retrieves information about JW Player skins.

Parameters

string $name: Name of skin for which information will be returned (optional).

Return value

object|array If $name is provided, will return the $file object. Otherwise if $name is NULL, will return an array of $file objects.

2 calls to jw_player_skins()
jw_player_ctools_export_ui_form in plugins/export_ui/jw_player_ctools_export_ui.inc
Implements hook_ctools_export_ui_form().
template_preprocess_jw_player in ./jw_player.module
Process variables for jw_player.tpl.php.

File

./jw_player.module, line 584
Adds a theme function which allows theme developers to use the JW Player.

Code

function jw_player_skins($name = NULL) {
  $skins =& drupal_static(__FUNCTION__);
  if (!isset($skins)) {

    // Get custom JW Player skins stored in 'jwplayer_skins' directory.
    $pattern = jw_player_use_legacy() ? '/\\.xml|\\.swf$/' : '/\\.css$/';
    $directory = libraries_get_path('jwplayer_skins');
    $custom_skins = file_scan_directory($directory, $pattern);
    foreach ($custom_skins as $key => $custom_skin) {
      $custom_skins[$key]->skin_type = 'custom';
    }

    // Get JW Player 7 skins provided with self-hosted version.
    $library_skins = array();
    if (!jw_player_use_legacy() && variable_get('jw_player_hosting', 'self') == 'self') {
      $directory = libraries_get_path('jwplayer');
      $library_skins = file_scan_directory($directory . '/skins', $pattern);
      foreach ($library_skins as $key => $library_skin) {
        $library_skins[$key]->skin_type = 'library';
      }
    }
    $skins = array_merge($library_skins, $custom_skins);
  }
  if ($name) {
    foreach ($skins as $file) {
      if ($file->name == $name) {
        return $file;
      }
    }
  }

  // Sort skin array in alphabetical order.
  asort($skins);
  return $skins;
}