*/
protected $conf;
+ /**
+ * @var array List of plugin errors.
+ */
+ protected $errors;
+
/**
* Plugins subdirectory.
* @var string $PLUGINS_PATH
public function __construct(&$conf)
{
$this->conf = $conf;
+ $this->errors = array();
}
/**
/**
* Load a single plugin from its files.
+ * Call the init function if it exists, and collect errors.
* Add them in $loadedPlugins if successful.
*
* @param string $dir plugin's directory.
$conf = $this->conf;
include_once $pluginFilePath;
+ $initFunction = $pluginName . '_init';
+ if (function_exists($initFunction)) {
+ $errors = call_user_func($initFunction, $this->conf);
+ if (!empty($errors)) {
+ $this->errors = array_merge($this->errors, $errors);
+ }
+ }
+
$this->loadedPlugins[] = $pluginName;
}
continue;
}
- $metaData[$plugin]['parameters'][$param] = '';
+ $metaData[$plugin]['parameters'][$param]['value'] = '';
+ // Optional parameter description in parameter.PARAM_NAME=
+ if (isset($metaData[$plugin]['parameter.'. $param])) {
+ $metaData[$plugin]['parameters'][$param]['desc'] = $metaData[$plugin]['parameter.'. $param];
+ }
}
}
return $metaData;
}
+
+ /**
+ * Return the list of encountered errors.
+ *
+ * @return array List of errors (empty array if none exists).
+ */
+ public function getErrors()
+ {
+ return $this->errors;
+ }
}
/**