/**
* Load plugins specified by the array $load, containing the leading filenames in the /src/plugins/ folder
* All plugins must be proceeded with *.plugin.php where the asterisk is the name of the respective plugin
*
* @since 0.1
* @param array $load e.g: array("Users", "Products", "Pages")
* @return bool Returns __true__ if successful or __false__ on error.void
*/
public function __construct($load) {
$this->plugin_dir = $_SERVER['DOCUMENT_ROOT'] . "/PlugCMS/src/plugins";
require_once($this->plugin_dir . "/Users.default.php"); // Included by default, and is required to gain access to the dashboard
require_once($this->plugin_dir . "/Pages.default.php"); // You can remove this but you will need to remove the pageLoader.php mod_rewrite rule from .htaccess to get control of the front-end back.
if (is_dir($this->plugin_dir)) {
if (is_array($load)) {
$count = count($load);
for ($i=0; $i < $count; $i++) {
$filename = $this->plugin_dir . "/" . $load[$i] . ".plugin.php";
if (file_exists($filename)) {
if (@require_once($filename)) {
$this->load_output['active'][] = $load[$i];
}
else
{
$this->load_output['failed'][] = $load[$i];
}
}
else
{
$this->load_output['failed'][] = $load[$i];
}
}
}
else
{
$this->load_output['error'][] = "Error: $load must be an array";
}
}
else
{
$this->load_output['error'][] = "PlugCMS has detected the default plugin directory is missing ({$this->plugin_dir}). Please check the installation and try again..";
}
}