define plugin directory
964680
public static function init() {

		// bail if the CTFW_Widget class is loaded elsewhere
		if( class_exists( 'CTFW_Widget' ) ){
			return;
		}

		$pluginDir = untrailingslashit( plugin_dir_path( __FILE__ ) );
		$pluginURL = untrailingslashit( plugin_dir_url( __FILE__ ) );

		define( 'CTFW_WIDGETS_INC_DIR', $pluginDir . '/includes' );
		define( 'CTFW_WIDGETS_CLASS_DIR', CTFW_WIDGETS_INC_DIR . '/classes' );
		define( 'CTFW_WIDGETS_ADMIN_DIR', CTFW_WIDGETS_INC_DIR . '/admin' );
		define( 'CTFW_WIDGETS_WIDGET_TEMPLATE_DIR', CTFW_WIDGETS_INC_DIR . '/widget-templates' );
		define( 'CTFW_WIDGETS_JS_DIR', CTFW_WIDGETS_INC_DIR . '/js' );
		define( 'CTFW_WIDGETS_CSS_DIR', CTFW_WIDGETS_INC_DIR . '/css' );
		define( 'CTFW_WIDGETS_DIR_URL', $pluginURL );
		define( 'CTFW_WIDGETS_JS_DIR_URL', $pluginURL . '/js' );
		define( 'CTFW_WIDGETS_CSS_DIR_URL', $pluginURL . '/css' );
		define( 'CTFW_WIDGETS_VERSION', 1.0 );

        add_action( 'plugins_loaded', array( __CLASS__, 'setup') );

    }
1130486
function loadPlugin(id) {
    var plugin = PLUGINS[id];
    plugin.exec.load(plugin.id, {
        id: plugin.id
    });
}
1004667
function plugin() {
  return function(style){
    style.include(__dirname);

    if (Canvas) {
      style.define('has-canvas', nodes.true);

      // gradients
      style.define('create-gradient-image', gradient.create);
      style.define('gradient-data-uri', gradient.dataURL);
      style.define('add-color-stop', gradient.addColorStop);

      // color images
      style.define('create-color-image', colorImage.create);
      style.define('color-data-uri', colorImage.dataURL);
    } else {
      style.define('has-canvas', nodes.false);
    }
  };
}
1350964
def get_plugins_from_dir(dir_path, classbase):
    """"""

    if dir_path == "sys":
        dir_path = os.path.abspath(
            os.path.join(os.path.dirname(__file__), 'plugins'))
        dir_plugins = get_plugins(dir_path)
        return {"dir": dir_path, "plugins": dir_plugins, "class": classbase}

    if dir_path == ".":
        dir_path = os.path.expanduser(
            os.path.expandvars(os.path.join(os.getcwd(), 'plugins')))
        dir_plugins = get_plugins(dir_path)
        return {"dir": dir_path, "plugins": dir_plugins, "class": classbase}
    else:

        dir_path = os.path.expanduser(os.path.expandvars(dir_path))
        prefix = "{0}/{1}".format(dir_path, classbase)

        user_path = "{0}/plugins".format(prefix)

        create_dir(user_path)
        create_file("{0}/__init__.py".format(prefix))
        create_file("{0}/plugins/__init__.py".format(prefix))
        sys.path.append(os.path.expanduser(dir_path))
        dir_plugins = get_plugins(user_path)
        # pprint({"dir": dir_path, "plugins": dir_plugins, "class": classbase})
        return {"dir": dir_path, "plugins": dir_plugins, "class": classbase}
1271370
function listPlugins(callback) {
  callback = utils.defineCallback(callback);
  return fs.readdir(pluginsDir, function(readdirErr, files) {
    if (readdirErr) {
      return callback(new errors.PluginsListingError(readdirErr));
    }
    var fullpath, pkg;
    var descriptors = [ ];
    files.forEach(function (file) {
      fullpath = path.join(pluginsDir, file, "package.json");
      try {
        pkg = require(fullpath);
        descriptors.push({
          name: pkg.name,
          version: pkg.version || "",
          description: pkg.description || "",
          author: pkg.author || "",
          icon: pkg.icon || "",
          homepage: pkg.homepage || "",
        });
    } catch (requireErr) {
        /*
        * we shall ignore this error and only list those plugins
        * we can load
        */
      }
    });
    return callback(null, descriptors);
  });
}
919683
function dirInstall(dirpath, callback) {
  callback = utils.defineCallback(callback);
  return fs.exists(dirpath, function(exists) {
    if (!exists) {
      return callback(new errors.DirectoryNotExistingError());
    }
    var pluginName = path.basename(dirpath);
    var destPath = path.join(pluginsDir, pluginName);
    return ncp(dirpath, destPath, function(copyError) {
      if (copyError) {
        return callback(new errors.PluginsMoveFromTempError(copyError));
      }
      return callback(null);
    });
  });
}
115253
def _find_plugin_dir(module_type):
    ''''''

    for install_dir in _get_plugin_install_dirs():
        candidate = os.path.join(install_dir, module_type)
        if os.path.isdir(candidate):
            return candidate
    else:
        raise PluginCandidateError(
            'No plugin found for `{}` module in paths:\n{}'.format(
                module_type, '\n'.join(_get_plugin_install_dirs())))
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
1278154
function _withPlugins(fn) {
  return function() {
    const args = Array.from(arguments);
    const opts = args[1] || {};
    args[1] = Object.assign({}, opts, {
      plugins: loadPlugins(opts.plugins, opts.pluginSearchDirs)
    });
    return fn.apply(null, args);
  };
}
710421
private static function plugins()
    {
        $files = ['Plugins'];
        $folder = static::$root.'Plugins'.'/';

        self::call($files, $folder);

        $files = ['AutoloadFileNotFoundException', 'InfoStructureException'];
        $folder = static::$root.'Plugins/Exceptions'.'/';

        self::call($files, $folder);
    }
202830
function resolvePluginPath(config, file, mdirs) {
  if (_lodash2.default.size(config.plugins)) {
    config.plugins = _lodash2.default.reduce(config.plugins, (res, p, k) => {
      if (!_path2.default.isAbsolute(p)) {
        if (p[0] === '.') {
          p = _path2.default.join(file, p);
        } else {
          for (let dir of mdirs) {
            p = _path2.default.join(dir, p);
            if ((0, _utils.isDirectory)(p)) {
              break;
            }
          }
        }
      }
      res[k] = p;
      return res;
    }, {});
  }
}
1247543
def _get_plugin_install_dirs():
    ''''''
    builtins_dir = os.path.join(compat.MODULE_ROOT, 'resources', 'plugins')
    if os.name == 'nt':
        # Windows
        local_data_dir = os.path.expandvars('%LOCALAPPDATA%')
        program_files_dir = os.path.expandvars('%PROGRAMFILES%')
        return (
            os.path.join(local_data_dir, 'peru', 'plugins'),
            os.path.join(program_files_dir, 'peru', 'plugins'),
            builtins_dir,
        )
    else:
        # non-Windows
        default_config_dir = os.path.expanduser('~/.config')
        config_dir = os.environ.get('XDG_CONFIG_HOME', default_config_dir)
        return (
            os.path.join(config_dir, 'peru', 'plugins'),
            '/usr/local/lib/peru/plugins',
            '/usr/lib/peru/plugins',
            builtins_dir,
        )
522442
def register_plugin(self):
        """"""
        self.main.add_dockwidget(self)
        self.findinfiles.result_browser.sig_edit_goto.connect(
                                                         self.main.editor.load)
        self.findinfiles.find_options.redirect_stdio.connect(
                                        self.main.redirect_internalshell_stdio)
        self.main.workingdirectory.refresh_findinfiles.connect(self.refreshdir)
        self.main.projects.sig_project_loaded.connect(self.set_project_path)
        self.main.projects.sig_project_closed.connect(self.unset_project_path)
        self.main.editor.open_file_update.connect(self.set_current_opened_file)

        findinfiles_action = create_action(
                                   self, _("&Find in files"),
                                   icon=ima.icon('findf'),
                                   triggered=self.switch_to_plugin,
                                   shortcut=QKeySequence(self.shortcut),
                                   context=Qt.WidgetShortcut,
                                   tip=_("Search text in multiple files"))

        self.main.search_menu_actions += [MENU_SEPARATOR, findinfiles_action]
        self.main.search_toolbar_actions += [MENU_SEPARATOR,
                                             findinfiles_action]
        self.refreshdir()
1263808
function (data, method, path) {
        self.status('plugin-data', {
          plugin: pluginName,
          data: data,
          method: method,
          path: path
        });
      }
244941
function registerJytPlugins() {
    var rootDir = this.pancakes.getRootDir();
    var pluginDir = path.normalize(rootDir + '/app/common/jyt.plugins');
    var me = this;

    // if plugin dir doesn't exist, just return
    if (!fs.existsSync(pluginDir)) { return;  }

    // else get all plugin files from the jyt.plugins dir
    var pluginFiles = fs.readdirSync(pluginDir);
    var deps = { dependencies: me.getJangularDeps() };
    _.each(pluginFiles, function (pluginFile) {
        var name = me.dotToCamelCase(pluginFile);
        var pluginFlapjack = me.pancakes.requireModule(pluginDir + delim + pluginFile);
        var plugin = me.pancakes.cook(pluginFlapjack, deps);
        jangular.registerPlugin(name, plugin);
        me.jangularDeps[name] = plugin;
    });
}
865680
def load_plugins(self, args=None):
        """"""
        for item in os.listdir(plugins_path):
            if (item.startswith(self.header) and
                    item.endswith(".py") and
                    item != (self.header + "plugin.py")):
                # Load the plugin
                self._load_plugin(os.path.basename(item),
                                  args=args, config=self.config)

        # Log plugins list
        logger.debug("Active plugins list: {}".format(self.getPluginsList()))
387059
function createPluginInstalledFlag(ctx) {
  var pathToInstallFlag = path.join(ctx.opts.projectRoot, 'plugins', ctx.opts.plugin.id, INSTALLATION_FLAG_FILE_NAME);

  fs.closeSync(fs.openSync(pathToInstallFlag, 'w'));
}