You are here

function jqp_list in jQuery Plugin Handler (JQP) 6.2

Fetches all cached libraries from the system table

1 call to jqp_list()
js_library_load in ./jqp.module
Loads a single library

File

./jqp.module, line 500
Used to register and load javascript libraries and plugins from a cetral point

Code

function jqp_list($refresh = FALSE) {
  static $list;
  if ($refresh) {
    $list = array();
  }
  if (empty($list)) {
    $list = array();
    $js_libraries = array();
    $result = db_query("SELECT * FROM {system} WHERE type = '%s'", 'javascript library');
    while ($library = db_fetch_object($result)) {
      $library->info = unserialize($library->info);
      $js_libraries[] = $library;
      foreach (array(
        'stylesheets',
        'scripts',
      ) as $type) {
        if (empty($library->info[$type])) {
          continue;
        }
        foreach ($library->info[$type] as $version => $data) {
          foreach ($data as $file_name => $path) {
            if (file_exists($path)) {
              $library->{$type}[$version][$file_name] = $path;
            }
          }
        }
      }
      $list[$library->name] = $library;
    }
  }
  return $list;
}