Lines Matching defs:plugin

19     /** @var array all installed plugins and their enabled state [plugin=>enabled] */
38 * the type of plugin to return,
45 * - plugin names when $type = ''
46 * - or plugin component names when a $type is given
71 * Loads the given plugin and creates an object of it
73 * @param $type string type of plugin to load
74 * @param $name string name of the plugin to load
75 * @param $new bool true to return a new instance of the plugin, false to use an already loaded instance
77 * @return PluginInterface|null the plugin object or null on failure
87 [$plugin, /* component */ ] = $this->splitName($name);
90 if (!$disabled && !$this->isEnabled($plugin)) {
97 //plugin already loaded?
108 # the plugin might be in the wrong directory
109 $inf = confToHash(DOKU_PLUGIN . "$plugin/plugin.info.txt");
110 if ($inf['base'] && $inf['base'] != $plugin) {
113 "Plugin installed incorrectly. Rename plugin directory '%s' to '%s'.",
114 hsc($plugin),
121 } elseif (preg_match('/^' . DOKU_PLUGIN_NAME_REGEX . '$/', $plugin) !== 1) {
123 'Plugin name \'%s\' is not a valid plugin name, only the characters a-z and 0-9 are allowed. ' .
124 'Maybe the plugin has been installed in the wrong directory?',
125 hsc($plugin)
132 ErrorHandler::showExceptionMsg($e, sprintf('Failed to load plugin %s', $plugin));
140 * Whether plugin is disabled
142 * @param string $plugin name of plugin
146 public function isDisabled($plugin)
149 return !$this->isEnabled($plugin);
153 * Check whether plugin is disabled
155 * @param string $plugin name of plugin
158 public function isEnabled($plugin)
160 return !empty($this->masterList[$plugin]);
164 * Disable the plugin
166 * @param string $plugin name of plugin
169 public function disable($plugin)
171 if (array_key_exists($plugin, $this->pluginCascade['protected'])) return false;
172 $this->masterList[$plugin] = 0;
177 * Enable the plugin
179 * @param string $plugin name of plugin
182 public function enable($plugin)
184 if (array_key_exists($plugin, $this->pluginCascade['protected'])) return false;
185 $this->masterList[$plugin] = 1;
192 * @return array with arrays of plugin configs
206 while (false !== ($plugin = readdir($dh))) {
207 if ($plugin[0] === '.') continue; // skip hidden entries
208 if (is_file(DOKU_PLUGIN . $plugin)) continue; // skip files, we're only interested in directories
210 if (array_key_exists($plugin, $this->masterList) && $this->masterList[$plugin] == 0) {
211 $all_plugins[$plugin] = 0;
212 } elseif (array_key_exists($plugin, $this->masterList) && $this->masterList[$plugin] == 1) {
213 $all_plugins[$plugin] = 1;
215 $all_plugins[$plugin] = 1;
226 * Includes the plugin config $files
261 $out = "<?php\n/*\n * Local plugin enable/disable settings\n" .
262 " * Auto-generated through plugin/extension manager\n *\n" .
266 foreach ($local_plugins as $plugin => $value) {
267 $out .= "\$plugins['$plugin'] = $value;\n";
331 * Returns a list of available plugin components of given type
333 * @param string $type plugin_type name; the type of plugin to return,
336 * @return array of plugin components of requested type
345 foreach ($master_list as $plugin) {
346 if (file_exists(DOKU_PLUGIN . "$plugin/$type.php")) {
347 $plugins[] = $plugin;
350 $typedir = DOKU_PLUGIN . "$plugin/$type/";
359 $plugins[] = $plugin . '_' . substr($component, 0, -4);
371 * Split name in a plugin name and a component name
375 * - plugin name
404 foreach ($plugins as $plugin) {
405 if (file_exists(DOKU_PLUGIN . $plugin . '/vendor/autoload.php')) {
407 require_once(DOKU_PLUGIN . $plugin . '/vendor/autoload.php');
409 ErrorHandler::showExceptionMsg($e, sprintf('Failed to init plugin %s autoloader', $plugin));