本文整理汇总了PHP中PluginManager::getPlugin方法的典型用法代码示例。如果您正苦于以下问题:PHP PluginManager::getPlugin方法的具体用法?PHP PluginManager::getPlugin怎么用?PHP PluginManager::getPlugin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PluginManager
的用法示例。
在下文中一共展示了PluginManager::getPlugin方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: return_column_plugins
public static function return_column_plugins($c, $setting)
{
$col = array();
foreach ($c->getPluginsBySetting($setting) as $name => $settings) {
try {
$col[] = PluginManager::getPlugin($name)->setSettings($settings);
} catch (Exception $e) {
Kohana::log('debug', $e->getMessage());
}
}
return $col;
}
示例2: edit
function edit($id, $name, $descr, $state, $strict, $type, $alarm_id, $others)
{
if (!isset($state)) {
$state = 0;
}
if (!isset($strict)) {
$strict = 0;
}
$pm = new PluginManager(PluginManager::PLUGIN_TYPE_CONTROL);
$plugin = $pm->getPlugin($type);
$plugin->storeForm($others);
$code = $plugin->storeConfig();
$sth = $this->pdo->prepare("UPDATE controllers SET name = ?, descr = ?, enabled = ?, strict = ?, control_type = ?, control_code = ?, alarm_id = ? WHERE id = ?");
$res = $sth->execute(array($name, $descr, $state, $strict, $type, $code, $alarm_id, $id));
if ($res == 0) {
$errorInfo = $sth->errorInfo();
throw new Exception("Impossible de modifier ce contrôleur: " . print_r($errorInfo, true));
}
$_SESSION["message"] = array("type" => "success", "title" => "Modification terminée", "descr" => "Le contrôleur a bien été modifié");
header('Location: ' . '/monitoring/?v=dashboard&cat=controllers');
}
示例3: __checkPluginControl
private function __checkPluginControl($request)
{
$pm = new PluginManager(PluginManager::PLUGIN_TYPE_CONTROL);
$controlName = $request["controlname"];
$plugin = $pm->getPlugin($controlName);
try {
$res = $plugin->testControl();
if ($res == false) {
throw new Exception("Control has returned a FALSE value");
}
} catch (Exception $ex) {
echo "0";
}
echo "1";
exit(0);
}
示例4: ajax
/**
* get a plugin (via ajax)
*
* @return void
* @author Andy Bennett
*/
function ajax()
{
if ($this->uri->segment(3) == 'get_plugin_row') {
$name = $this->input->post('name');
$pm = new PluginManager();
$plugin = $pm->getPlugin($name);
$v = new View('plugin-row');
$v->set('aplugin', $plugin);
$v->aname = $name;
$v->render(TRUE);
}
}
示例5: get_plugins
/**
* get the plugins based on a setting
*
* @param string $setting
* @return void
* @author Andy Bennett
*/
public function get_plugins($setting)
{
if (!is_numeric($this->container_id)) {
throw new Kohana_User_Exception("Containers Error", "The container has not been initialised");
}
$col = array();
$res = $this->model->get_plugins_by_setting($this->container_id, $setting);
foreach ($res as $plugin) {
$name = $plugin->plugin_name;
$settings = (array) $plugin;
try {
$col[] = PluginManager::getPlugin($name)->setSettings($settings);
} catch (Exception $e) {
Kohana::log('debug', $e->getMessage());
}
}
return $col;
}
示例6: assignCategoryControllers
function assignCategoryControllers($tpl)
{
$action = isset($_REQUEST["a"]) ? $_REQUEST["a"] : "list";
if ($action == "list") {
$sth = $this->pdo->prepare("SELECT id, name, alarm_count, enabled FROM controllers");
$sth->execute();
$res = $sth->fetchAll();
$tpl->assign('controllers_data', $res);
$tpl->assign('view', 'view_dashboard_controllers');
} else {
if ($action == "add") {
$item = array("id" => -1, "name" => "", "descr" => "", "enabled" => 1, "strict" => 0, "control_type" => "", "control_code" => "", "alarm_id" => 1);
// Request for alarms
$sth = $this->pdo->prepare("SELECT id, name FROM alarms");
$sth->execute();
$alarms = $sth->fetchAll();
// Request for controls
$pm = new PluginManager(PluginManager::PLUGIN_TYPE_CONTROL);
$plugins = $pm->getPlugins();
// Request current control
$key = array_keys($plugins);
$key = $key[0];
$plugin = $plugins[$key];
$ffh = new FieldFormHelper();
$ffh->putFields($plugin->loadForm());
$subformHtml = $ffh->getHTML();
$tpl->assign('action', $action);
$tpl->assign('item', $item);
$tpl->assign('alarms_data', $alarms);
$tpl->assign('controls_data', $plugins);
$tpl->assign('subform_html', $subformHtml);
$tpl->assign('view', 'view_dashboard_controllers_form');
} else {
if ($action == "edit") {
$sth = $this->pdo->prepare("SELECT id, name, descr, enabled, strict, control_type, control_code, alarm_id FROM controllers WHERE id = ?");
$sth->execute(array($_REQUEST["id"]));
$res = $sth->fetch(PDO::FETCH_ASSOC);
$item = $res;
// Request for alarms
$sth = $this->pdo->prepare("SELECT id, name FROM alarms");
$sth->execute();
$alarms = $sth->fetchAll();
// Request for controls
$pm = new PluginManager(PluginManager::PLUGIN_TYPE_CONTROL);
$plugins = $pm->getPlugins();
// Request current control
$plugin = $pm->getPlugin($item["control_type"]);
$plugin->loadConfig($item["control_code"]);
$ffh = new FieldFormHelper();
$ffh->putFields($plugin->loadForm());
$subformHtml = $ffh->getHTML();
$tpl->assign('action', $action);
$tpl->assign('item', $item);
$tpl->assign('alarms_data', $alarms);
$tpl->assign('controls_data', $plugins);
$tpl->assign('subform_html', $subformHtml);
$tpl->assign('view', 'view_dashboard_controllers_form');
}
}
}
}
示例7: get_page_plugins
/**
* get page plugins
*
* @param string $pid
* @return array
* @author Andy Bennett
*/
public static function get_page_plugins($pid, $plugin_name = NULL)
{
$plug_table = Kohana::config('appconf.page_plugins_table');
if (is_null($plug_table)) {
$plug_table = 'page_plugins';
}
$db = new SteamDatabase();
$db->select('*')->from($plug_table)->where(array('pid' => $pid));
if (isset($plugin_name)) {
$db->orwhere(array('plugin_name' => $plugin_name));
}
$db->orderby('order');
$c = $db->get_result();
$col = array();
foreach ($c as $p) {
$name = $p->plugin_name;
$settings = array();
// $settings['column'] = $p->column;
$settings['order'] = $p->order;
$settings['template'] = $p->template;
try {
$col[] = PluginManager::getPlugin($name)->setSettings($settings);
} catch (Exception $e) {
Kohana::log('debug', $e->getMessage());
}
}
return $col;
}
示例8: display
/**
* Sends data to ViewManager
*
* @access private
* @param array Result
*/
private function display($result)
{
$request = $this->pluginManager->getPlugin('router')->getRequest();
$view = $request['view'];
$vm = new ViewManager($view, $result, $this->user);
}