function displayPlugins($location) { global $pluginForm; $allPlugins = Plugins::get_plugins(); $pluginNames = array(); $pluginHandler = array(); $pluginHeadings = array("All Plugins"); foreach ($allPlugins as $id => $value) { $curPlugin = new Plugins($id); if ($curPlugin->get_location() == $location && $curPlugin->get_enabled() == true) { if ($curPlugin->get_icon_path() != "NONE") { $iconPath = str_replace(" ", "%20", $curPlugin->get_icon_path()); array_push($pluginNames, "<img class='plugIcon' src='" . $iconPath . "'></img>" . $curPlugin->get_name()); } else { array_push($pluginNames, $curPlugin->get_name()); } array_push($pluginHandler, "handleEvent('plugins.php?pluginaction=showPlugin&pluginID=" . $id . "&className=" . $curPlugin->get_class_name() . "')"); } } $pluginForm->setHeadings($pluginHeadings); $pluginForm->setTableWidth("150px"); $pluginForm->setEventHandler($pluginHandler); $pluginForm->setTitles($pluginNames); $pluginForm->setSortable(true); return $pluginForm->showAll(); }
public function plugins() { $plugins_in_folder = Plugins::get_plugins(); $plugins = Plugin::where('active', '=', 1)->get(); $data = array('plugins' => $plugins, 'plugins_available' => $plugins_in_folder); return View::make('admin.sections.plugins', $data); }
function checkPlugin($location) { $allPlugins = Plugins::get_plugins(); $location = strtolower($location); $pluginNames = array(); $pluginHeadings = array("All Plugins"); foreach ($allPlugins as $id => $value) { $curPlugin = new Plugins($id); $plugLocation = strtolower($curPlugin->get_location()); if ($plugLocation == $location && $curPlugin->get_enabled() == true) { $pluginNames[$id] = $curPlugin->get_name(); } } return $pluginNames; }
function updatePlugins() { global $tool, $propertyForm; $enabledPlugins = $_POST['list']; //print_r($enabledWidgets); $plugins = Plugins::get_plugins(); $update = true; foreach ($plugins as $id => $value) { $isEnabled = false; $curPlugin = new Plugins($id); foreach ($enabledPlugins as $eID => $eValue) { if ($id == $eValue) { $curPlugin->set_enabled(true); $isEnabled = true; } } if (!$isEnabled) { $curPlugin->set_enabled(false); } if ($curPlugin->update_plugin()) { $update = true; } else { $update = false; $error = $curPlugin->get_error(); break; } } if ($update) { $status = "success"; echo "<script language='javascript'>LoadPage(\"configurations.php?action=plugins&mode=edit&update=" . $status . "\", 'settingsInfo');</script>"; } else { $propertyForm->error("Warning: Failed to enable plugins. Reason: " . $error); } }