/**
  * A private method to return a list of plugin files in a given plugin module,
  * or a given module/package.
  *
  * @static
  * @access private
  * @param string $module The plugin module name (i.e. /plugins/module directory).
  * @param string $package An optional plugin package name (i.e. /plugins/module/package
  *                        directory). If not given, the search for plugin files will
  *                        start at the module directory level.
  * @param mixed $recursive If the boolean 'true', returns all plugin files in the
  *                         given directory and all subdirectories.
  *                         If an integer, returns all plugin files in the given
  *                         directory and subdirectories down to the depth
  *                         specified by the parameter.
  * @return array An array of the plugin files found, indexed by "directory:filename",
  *               where "directory" is the relative directory path below the
  *               given directory parameter, and "filename" is the filename
  *               before the MAX_PLUGINS_EXTENSION extension of the file.
  */
 function _getPluginsFiles($module, $package = null, $recursive = 1)
 {
     $aConf = $GLOBALS['_MAX']['CONF'];
     $pluginsDir = MAX_PATH . MAX_PLUGINS_PATH;
     if (!empty($package)) {
         $dir = $pluginsDir . '/' . $module . '/' . $package;
     } else {
         $dir = $pluginsDir . '/' . $module;
     }
     return MAX_Plugin::_getPluginsFilesFromDirectory($dir, $recursive);
 }
 /**
  * A method to test the _getPluginsFilesFromDirectory() method.
  */
 function test_getPluginsFilesFromDirectory()
 {
     // Test on a non-existant directory
     $result = MAX_Plugin::_getPluginsFilesFromDirectory(MAX_PATH . '/thisDoesNotExist');
     $this->assertTrue(is_array($result));
     $this->assertEqual(count($result), 0);
     // Test on a directory with no plugins
     $result = MAX_Plugin::_getPluginsFilesFromDirectory(MAX_PATH . '/etc');
     $this->assertTrue(is_array($result));
     $this->assertEqual(count($result), 0);
     // Test on a directory with plugins, but with a search depth that doesn't
     // reach down to the level where the plugins are stored
     $result = MAX_Plugin::_getPluginsFilesFromDirectory(MAX_PATH . '/plugins/reports', 0);
     $this->assertTrue(is_array($result));
     $this->assertEqual(count($result), 0);
     // Test on a directory with plugins, with a search depth that does
     // reach down to the level where the plugins are stored
     $result = MAX_Plugin::_getPluginsFilesFromDirectory(MAX_PATH . '/plugins/reports', 1);
     $this->assertTrue(is_array($result));
     $this->assertEqual(count($result), 5);
     $this->assertEqual($result['standard:advertisingAnalysisReport'], MAX_PATH . '/plugins/reports/standard/advertisingAnalysisReport' . MAX_PLUGINS_EXTENSION);
 }