You are here

function jqp_scan_dir in jQuery Plugin Handler (JQP) 6

Same name and namespace in other branches
  1. 6.2 jqp.module \jqp_scan_dir()

Scan the 'plugins' directories for .js and .css files

Return value

an array where key is file name and value is file path

Example: array('color.js' => 'sites/all/plugins/twolibrary/color.js')

If there are multiple plugins with the same filename in the directory, the LAST file read will be used. Example: plugins/onelibrary/color.js plugins/twolibrary/color.js <-- this file will *probably* get used

LIKE MODULES, plugins should have unique file names

3 calls to jqp_scan_dir()
jqp_add_css in ./jqp.module
Add a shared CSS file from the plugins directory
jqp_add_js in ./jqp.module
Add a shared Javascript file from the plugins directory
jqp_plugin_exists in ./jqp.module
Check the existence of a given plugin in the plugins directory

File

./jqp.module, line 80

Code

function jqp_scan_dir() {
  static $files;
  if (!isset($files)) {
    if ($cache = cache_get('jqp_plugins')) {
      $files = $cache->data;
    }
    else {
      $files = drupal_system_listing('(\\.js$|\\.css$)', 'plugins', 'basename', 0);
      cache_set('jqp_plugins', $files);
    }
  }
  return $files;
}