plugin level function (dealing with files)
193986
function cog(glob) {
  if (typeof glob === 'undefined') {
    var glob = '**/*';
  }

  // Collect all files, before we filter stream
  var allFiles = {};
  var collectFilesStream = through.obj(function(file, enc, cb) {
    allFiles[file.relative] = file;
    cb();
  }, function(cb) {
    _.each(allFiles, function(file) {
      collectFilesStream.push(file);
    });
    cb();
  });

  // Get all includes for a file
  function getIncludes(file) {
    var content = String(file.contents);
    var matches = [];

    while (regexMatch = DIRECTIVE_REGEX.exec(content)) {
      matches.push(regexMatch);
    }

    // For every require fetch it's matching files
    var fileLists = _.map(matches, function(match) {
      return globMatch(match, file).sort();
    });

    // Merge all matching file lists into one concat list
    var order = _.reduce(fileLists, function(memo, fileList) {
      return _.union(memo, fileList);
    }, []);

    // And self to include list
    order.push(file.relative);
    return order;
  }

  function getRelativeDir(file) {
    var relativeDir = _.initial(file.relative.split('/')).join('/');
    if (relativeDir.length > 0) {
      relativeDir += '/';
    }
    return relativeDir;
  }

  // Translate an include match to a glob
  function globMatch(match, file) {
    var directiveType = match[1];
    var globPattern = match[2]; // relative file

    // require all files under a directory
    if (directiveType.indexOf('_tree') !== -1) {
      globPattern = globPattern.concat('/**/*');
      directiveType = directiveType.replace('_tree', '');
    }

    // require only first level files in a directory
    if (directiveType.indexOf('_directory') !== -1) {
      globPattern = globPattern.concat('/*');
      directiveType = directiveType.replace('_directory', '');
    }

    // Only require and include directives are allowed
    if (directiveType !== 'require' && directiveType !== 'include') {
      return [];
    }

    // Add file extension to glob pattern if not already set
    var jsExt = '.js';
    if (globPattern.substr(globPattern.length-jsExt.length).indexOf(jsExt) !== 0) {
      globPattern += jsExt;
    } 

    // Append the current dir to include so we can match the glob against the file list
    var relativeDir = getRelativeDir(file);
    globPattern = relativeDir+globPattern;

    var possibleIncludes = [];
    _.each(_.keys(allFiles), function(fileName) {
      // Only process files in the current directory. ../ will not work.
      if (fileName.indexOf(relativeDir) !== 0) {
        return;
      }

      possibleIncludes.push(fileName);
    });
    
    return minimatch.match(possibleIncludes, globPattern);
  }


  // creating a stream through which each file will pass
  var concatFiles = [];
  var buildIncludesStream = through.obj(function(file, enc, cb) {
    if (file.isStream()) {
      this.emit('error', new PluginError(PLUGIN_NAME, 'Streams are not supported!'));
      return cb();
    }

    // Attach includes to masterfile
    file.includes = _.filter(_.map(getIncludes(file), function(filename) {
      return allFiles[filename];
    }, function(file) {
      return !!file;
    }));

    this.push(file);
    cb();
  });

  /*
   * Construct the stream.
   * 
   * Steps:
   * 1. Build a list of all files in the stream for use later
   * 2. Filter files to only desired master concat files
   * 3. Build concat manifests data objects for each of the master files
   */
  var stream = sc(
    collectFilesStream,
    filter(glob),
    buildIncludesStream
  );

  return stream;
}
23284
function parsePlugins(config) {
  let plugins = [];

  function parse(plugins) {
    return plugins.map(plugin => {
      if ('string' == typeof plugin) plugin = path.resolve(plugin);
      return plugin;
    });
  }

  // Handle plugin paths defined in config file
  if (config.plugins) {
    plugins.push(...parse(config.plugins));
    delete config.plugins;
  }
  // Handle plugin paths/functions defined in runtime options
  if (config.runtimeOptions.plugins) {
    plugins.push(...parse(config.runtimeOptions.plugins));
    delete config.runtimeOptions.plugins;
  }

  return plugins;
}
963133
private function _checkfiles()
    {
        if (!file_exists($this->_plugin_base."js/".strtolower($this->_plugin_name).".js")) {
            $this->global_error->addError("file_exists(".$this->_plugin_base."js/".strtolower($this->_plugin_name).".js)", "JS-File for Plugin '".$this->_plugin_name."' is missing!");
        } else {
            if (!is_readable($this->_plugin_base."js/".strtolower($this->_plugin_name).".js")) {
                $this->global_error->addError("is_readable(".$this->_plugin_base."js/".strtolower($this->_plugin_name).".js)", "JS-File for Plugin '".$this->_plugin_name."' is not readable but present!");
            }
        }
        if (!file_exists($this->_plugin_base."lang/en.xml")) {
            $this->global_error->addError("file_exists(".$this->_plugin_base."lang/en.xml)", "At least an english translation must exist for the plugin!");
        } else {
            if (!is_readable($this->_plugin_base."lang/en.xml")) {
                $this->global_error->addError("is_readable(".$this->_plugin_base."js/".$this->_plugin_name.".js)", "The english translation can't be read but is present!");
            }
        }
    }
1054424
function(files, mode) {
				var place    = list ? cwd.find('tbody') : cwd,
					l        = files.length, 
					atmb     = {},
					findNode = function(file) {
						var pointer = cwd.find('[id]:first'), file2;

						while (pointer.length) {
							file2 = fm.file(fm.cwdId2Hash(pointer.attr('id')));
							if (!pointer.hasClass('elfinder-cwd-parent') && file2 && fm.compare(file, file2) < 0) {
								return pointer;
							}
							pointer = pointer.next('[id]');
						}
					},
					findIndex = function(file) {
						var l = buffer.length, i;
						
						for (i =0; i < l; i++) {
							if (fm.compare(file, buffer[i]) < 0) {
								return i;
							}
						}
						return l || -1;
					},
					// created document fragment for jQuery >= 1.12, 2.2, 3.0
					// see Studio-42/elFinder#1544 @ github
					docFlag = $.htmlPrefilter? true : false,
					tempDom = docFlag? $(document.createDocumentFragment()) : $('<div/>'),
					file, hash, node, nodes, ndx;

				if (l > showFiles) {
					// re-render for performance tune
					content();
					selectedFiles = fm.arrayFlip($.map(files, function(f) { return f.hash; }), true);
					trigger();
				} else {
					// add the item immediately
					l && wz.removeClass('elfinder-cwd-wrapper-empty');
					
					while (l--) {
						file = files[l];
						hash = file.hash;
						
						if ($('#'+fm.cwdHash2Id(hash)).length) {
							continue;
						}
						
						if ((node = findNode(file)) && ! node.length) {
							node = null;
						}
						if (! node && (ndx = findIndex(file)) >= 0) {
							buffer.splice(ndx, 0, file);
						} else {
							tempDom.empty().append(itemhtml(file));
							(file.mime === 'directory') && !mobile && makeDroppable(tempDom);
							nodes = docFlag? tempDom : tempDom.children();
							if (node) {
								node.before(nodes);
							} else {
								place.append(nodes);
							}
						}
						
						if ($('#'+fm.cwdHash2Id(hash)).length) {
							if (file.tmb) {
								atmb[hash] = file.tmb;
							}
						}
					}
	
					if (list) {
						setColwidth();
						fixTableHeader({fitWidth: ! colWidth});
					}
					bottomMarkerShow(place);
					if (Object.keys(atmb).length) {
						Object.assign(bufferExt.attachTmbs, atmb);
					}
				}
			}
652956
def filter(self, object, *args, **kw):
    '''
    
    '''
    for plugin in self.plugins:
      object = plugin.handle(object, *args, **kw)
      if object is None:
        return object
    return object
233004
function resolvePluginFiles (collection, relPath) {
    return Immutable.fromJS(collection.reduce(function (all, item) {
        var full = path.join(relPath, item);
        if (fs.existsSync(full)) {
            all[full] = fs.readFileSync(full, "utf8");
        }
        return all;
    }, {}));
}
969833
def load_plugins(plugins)
      unless plugins.is_a?(Array)
        raise ArgumentError, "load_plugins expects an array, got #{plugins.inspect}"
      end

      plugins.each do |plugin|
        plugin_file = plugin.start_with?("/") ? plugin : File.expand_path("../../#{plugin}", File.dirname(__FILE__))
        unless File.file?(plugin_file)
          raise Errno::ENOENT, "Failed to find plugin #{plugin.inspect} at #{plugin_file}"
        end
        require plugin_file
      end
    end
941111
def start_plugin(file_path=None):
    """"""
    if os.getenv('CONFIG_PATH'):
        file_path = os.getenv('CONFIG_PATH')
    else:
        file_path = file_path
    if file_path is not None:
        config = parse_config(file_path)
        plugin_instance = load_plugin(config)
    else:
        plugin_instance = load_plugin
    return plugin_instance
1190144
function plugin(name) {
  return function(app) {
    var files = app.getViews(name);
    for (var file in files) {
      if (files[file].data.draft) delete files[file];
    }
  };
}
566895
function plugin(opts) {
  opts = objectAssign({
    modulesDirectory: 'dist/node_modules',
    modulesManifestPath: 'dist/require-modules.json',
    dist: true,
    fromDirectory: 'src',
    distDirectory: 'dist'
  }, opts);

  return through.obj(function (file, enc, cb) {
    if (file.isStream()) {
      this.emit('error', new PluginError(PLUGIN_NAME, 'Streams are not supported!'));
      return cb();
    }
    if (file.isBuffer()) {
      var modulesDirectory = path.join(process.cwd(), opts.modulesDirectory);
      var modulesManifestPath = path.join(process.cwd(), opts.modulesManifestPath);
      var distDirectory = opts.distDirectory;

      // get old modulesManifest
      if (fs.existsSync(modulesManifestPath)) {
        var data = fs.readFileSync(modulesManifestPath, 'utf8');
        modulesManifest = JSON.parse(data);
      } else {
        dirname = path.dirname(modulesManifestPath);
        fs.mkdirsSync(dirname);
      }

      var filePath = file.path;
      var contents = file.contents.toString();

      // the path where this file will be disted to
      var distFilePath = filePath;
      if (distDirectory) {
        var cwd = path.join(process.cwd());
        var relativePath = path.relative(path.join(cwd, opts.fromDirectory || ''), filePath);
        var distFilePath = path.join(process.cwd(), distDirectory, relativePath);
      }
      var distFileDirname = path.dirname(distFilePath);

      // modules
      var modules = getModules(contents);
      for (var index in modules) {
        var module = modules[index];

        var modulePath = path_util.modulePath(module, node_modules);
        if (modulePath === null) {
          continue;
        }
        var targetPath = path_util.targetPath(modulePath, node_modules, modulesDirectory);

        if (!modulesManifest.hasOwnProperty(module)) {
          var relativePath = path.relative(process.cwd(), targetPath);
          modulesManifest[module] = relativePath;

          if (!fs.existsSync(targetPath)) {
            transformFile(modulePath, targetPath, modulesDirectory);
          }
        }

        if (opts.dist) { // replace modules with path
          var relativePath = path_util.relativePath(distFileDirname, targetPath);
          var re = eval('\/require\\\(\[\'\"\]' + module + '\[\'\"\]\\\)\/ig');
          contents = contents.replace(re, 'require(\'' + relativePath + '\')');
        }
      }

      // subModules
      var subModules = getSubModules(contents);
      for (var index in subModules) {
        var subModule = subModules[index];
        var subModulePath = path_util.subModulePath(subModule, node_modules);
        if (subModulePath === null) {
          continue;
        }
        var targetPath = path_util.targetPath(subModulePath, node_modules, modulesDirectory);

        if (!modulesManifest.hasOwnProperty(subModule)) {
          var relativePath = path.relative(process.cwd(), targetPath);
          modulesManifest[subModule] = relativePath;

          if (!fs.existsSync(targetPath)) {
            transformFile(subModulePath, targetPath, modulesDirectory);
          }
        }

        if (opts.dist) { // replace modules with path
          var relativePath = path_util.relativePath(distFileDirname, targetPath);
          var subModuleRegex = subModule.replace('/', '\\\/');
          var subModuleRegex = subModuleRegex.replace('.', '\\\.');
          var re = 'require\\\(\[\'\"\]' + subModuleRegex + '\[\'\"\]\\\)';
          var regex = new RegExp(re, 'ig');
          contents = contents.replace(regex, 'require(\'' + relativePath + '\')');
        }
      }
      file.contents = Buffer.from(contents);
      fs.writeFileSync(modulesManifestPath, JSON.stringify(modulesManifest, null, 2), 'utf8');
    }

    // go to next gulp plugin
    this.push(file);
    cb();
  });
}
151442
function plugin(options){
  options = options || {};
  var keys = options.keys || [];

  return function(files, metalsmith, done){
    setImmediate(done);
    Object.keys(files).forEach(function(file){
      debug('checking file: %s', file);
      if (!isHtml(file)) return;
      var data = files[file];
      var dir = dirname(file);
      var html = basename(file, extname(file)) + '.html';
      if ('.' != dir) html = dir + '/' + html;

      debug('Encoding html entities in file: %s', file);

      var reg = /\`\`\`([\s\S]+?)\`\`\`/gi;
      var rep = function(match, group) {
        if (group) {
          return he.encode(group, {useNamedReferences: true});
        }
        else {
          return "";
        }
      };
      var encoded = data.contents.toString().replace(reg, rep);
      data.contents = new Buffer(encoded);

      keys.forEach(function(key) {
        data[key] = data[key].replace(reg, rep);
      });

      delete files[file];
      files[html] = data;
    });
  };
}
478350
function runCompile(file, options) {
  if (!file) {
    throw new PluginError('can-compile', 'Missing file option for can-compile');
  }

  var templatePaths = [],
      latestFile;

  options = options || {};
  
  function bufferStream (file, enc, cb) {
    // ignore empty files
    if (file.isNull()) {
      cb();
      return;
    }

    // can't do streams yet
    if (file.isStream()) {
      this.emit('error', new PluginError('can-compile',  'Streaming not supported for can-compile'));
      cb();
      return;
    }

    // set latest file if not already set,
    // or if the current file was modified more recently.
    if (!latestFile || file.stat && file.stat.mtime > latestFile.stat.mtime) {
      latestFile = file;
    }

    templatePaths.push(file.path);
    cb();
  }

  function endStream(cb) {
    var self = this;

    // no files passed in, no file goes out
    if (!latestFile || !templatePaths.length) {
      cb();
      return;
    }

    compile(templatePaths, options, function (err, result) {
      if (err) {
        self.emit('error', new PluginError('can-compile',  err));
        return cb(err);
      }

      var joinedFile;

      // if file opt was a file path
      // clone everything from the latest file
      if (typeof file === 'string') {
        joinedFile = latestFile.clone({ contents: false });
        joinedFile.path = path.join(latestFile.base, file);
      } else {
        joinedFile = new File(file);
      }

      joinedFile.contents = new Buffer(result);

      self.push(joinedFile);

      cb();
    });
  }

  return through.obj(bufferStream, endStream);
}
1298839
function getPluginResourcePackInfo(pluginResources, packedFiles) {
    var result = {};
    var notPackRes = [];
    pluginResources.forEach(function (item) {
        var packFile = findPackFile(item, packedFiles);
        if (packFile) {
            result[item.id] = {
                file: item,
                packTo: packFile
            };
        }
        else {
            notPackRes.push(item);
        }
    });
    return {
        pack: result,
        notPacks: notPackRes
    };
}
416212
function validateRelativePath(pluginDir) {
  return str => {
    try {
      const stat = fs.statSync(path.join(pluginDir, str));
      return stat.isFile();
    } catch (e) {
      return false;
    }
  };
}
454297
function load($plugin_name,$plugin_param = null)
	{
		$path = WEBPATH.'/swoole_plugin/'.$plugin_name.'/Swoole.plugin.php';
		if(file_exists($path))
		{
			require_once($path);
			$this->plugins[$plugin_name] = $swoole_plugin;
		}
		else Error::info('Plugin not Found!',"Plugin file <b>$path</b> not exists!");
	}
548342
function (text, filePath) {

      // ESLint requires a result to be an array of processable text blocks
      var out = [text];

      if (externalProcessor !== null) {
        out = externalProcessor.preprocess(text, filePath);
      }

      // Retrieve settings for current file
      var settings = settingsGetter(filePath);

      // Do nothing if there is no plugins registered
      if (!settings.plugins.length) return out;

      // Reset file options on start
      delete cache[filePath];

      // -----------------------------------------------------------------------
      // 1. Disable "all except" via inline comments
      // -----------------------------------------------------------------------

      var allExceptInlinePlugins = getInlinePlugins(
        text, DISABLE_ALL_EXCEPT_PATTERN, settings.plugins
      );

      if (allExceptInlinePlugins) {

        if (allExceptInlinePlugins.length) {

          // Keep only plugins mentioned inline and disable the rest
          var pluginsToDisable = settings.plugins.filter(function (plugin) {
            return allExceptInlinePlugins.indexOf(plugin) === -1;
          });

          // Only set if there are plugins to disable
          if (pluginsToDisable.length) {
            cache[filePath] = pluginsToDisable;
          }

        } else {
          // Do nothing if no plugins found, it means all plugins are enabled
        }

        // Return the result
        return out;

      } else {
        // Continue to next option if there is no match for this option
      }

      // -----------------------------------------------------------------------
      // 2. Disable via inline comments
      // -----------------------------------------------------------------------

      var inlinePlugins = getInlinePlugins(
        text, DISABLE_PATTERN, settings.plugins
      );

      if (inlinePlugins) {

        // Disable all plugins if no plugins specified
        var pluginsToDisable = inlinePlugins.length
          ? inlinePlugins
          : settings.plugins;

        // Only set if there are plugins to disable
        if (pluginsToDisable.length) {
          cache[filePath] = pluginsToDisable;
        }

        // Return the result
        return out;

      } else {
        // Continue to next option if there is no match for this option
      }

      // -----------------------------------------------------------------------
      // 3. Disable "all except" via settings
      // -----------------------------------------------------------------------

      var settingsAllExceptPlugins = getSettingsPlugins(
        filePath, settings.allExceptPaths, true,
        settings.plugins, settings.pathsOptions
      );

      if (settingsAllExceptPlugins.length) {

        // Keep only plugins matching settings paths and disable the rest
        var pluginsToDisable = settings.plugins.filter(function (plugin) {
          return settingsAllExceptPlugins.indexOf(plugin) === -1;
        });

        // Only set if there are plugins to disable
        if (pluginsToDisable.length) {
          cache[filePath] = pluginsToDisable;
        }

        // Return the result
        return out;

      } else {
        // Continue to next option if there is no match for this option
      }

      // -----------------------------------------------------------------------
      // 4. Disable via settings
      // -----------------------------------------------------------------------

      var settingsPlugins = getSettingsPlugins(
        filePath, settings.paths, false,
        settings.plugins, settings.pathsOptions
      );

      if (settingsPlugins.length) {

        var pluginsToDisable = settingsPlugins;

        // Only set if there are plugins to disable
        if (pluginsToDisable.length) {
          cache[filePath] = pluginsToDisable;
        }

        // Return the result
        return out;

      } else {
        // No options left, proceed to the end
      }

      // ESLint requires a result to be an array of processable text blocks
      return out;
    }
774536
function Plugin() {
  // return value should be a callable function
  // with strictly defined options passed by markdown-it
  var self = function(md, options) {
    self.options = options
    self.init(md)
  }

  // initialize plugin object
  self.__proto__ = Plugin.prototype

  self.id     = 'render-readme-meta'

  return self
}