本文整理汇总了PHP中plugin::available方法的典型用法代码示例。如果您正苦于以下问题:PHP plugin::available方法的具体用法?PHP plugin::available怎么用?PHP plugin::available使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类plugin
的用法示例。
在下文中一共展示了plugin::available方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action
function action()
{
$msg = '';
$event = new event();
$server = new openqrm_server();
$plugin = new plugin();
$identifier = $this->response->html->request()->get($this->identifier_name);
$available = $plugin->available();
if ($identifier !== '') {
foreach ($identifier as $id) {
if (in_array($id, $available)) {
$error = false;
// check dependencies
$tmp = $plugin->get_dependencies($id);
if ($tmp !== '' && isset($tmp['dependencies']) && $tmp['dependencies'] !== '') {
$tmp = str_replace(' ', '', $tmp['dependencies']);
$tmp = explode(',', $tmp);
$enabled = $plugin->enabled();
$result = array_diff($tmp, $enabled);
if (count($result) > 0) {
$msg .= sprintf($this->lang['error_dependencies'], $id, implode(', ', $result)) . '<br>';
$error = true;
}
}
// handle plugin type
if ($error === false) {
$tmp = $plugin->get_config($id);
switch ($tmp['type']) {
case 'storage':
$storage = new storage();
$types = $storage->get_storage_types();
$deployment = new deployment();
$dep = $deployment->get_id_by_storagetype($id);
foreach ($dep as $val) {
if (in_array($val['value'], $types)) {
$msg .= sprintf($this->lang['error_enabled'], $id) . '<br>';
$error = true;
}
}
break;
}
}
if ($error === false) {
$return = $server->send_command("openqrm_server_plugin_command " . $id . " init " . $GLOBALS['OPENQRM_ADMIN']->name . ' ' . $GLOBALS['OPENQRM_ADMIN']->password);
if ($return === true) {
if ($this->__check($id)) {
$msg .= sprintf($this->lang['msg'], $id) . '<br>';
} else {
$msg .= sprintf($this->lang['error_timeout'], $id) . '<br>';
}
} else {
$msg .= sprintf($this->lang['error_enable'], $id) . '<br>';
}
}
}
}
}
$this->response->redirect($this->response->get_url($this->actions_name, 'select', $this->message_param, $msg));
}
示例2: array
function __plugins()
{
/*
$ha = array();
$net = array();
$mgmt = array();
$moni = array();
$misc = array();
$dep = array();
$enter = array();
*/
$return = $this->response->html->div();
$plugin = new plugin();
$plugins = $plugin->available();
foreach ($plugins as $k => $v) {
$p = $plugin->get_config($v);
$link = '';
$hook = $this->openqrm->get('webdir') . "/plugins/" . $v . "/openqrm-" . $v . "-appliance-edit-hook.php";
if ($this->file->exists($hook)) {
require_once $hook;
$function = str_replace("-", "_", 'get_' . $v . '_appliance_edit');
if (function_exists($function)) {
$id = $this->apliance_id;
$link = $function($id, $this->openqrm, $this->response);
if (is_object($link)) {
$link->label = ucfirst($v);
$link->handler = 'onclick="wait();"';
$link->css = "edit";
$link->title = preg_replace('~(.*?)<a.*>(.*?)</a>(.*?)~i', '$1$2$3', $p['description']);
}
}
}
if (isset($link) && $link !== '') {
$return->add($link);
}
}
return $return;
/*
if(isset($link) && $link !== '') {
switch($p['type']) {
case 'HA':
$ha[] = $link;
break;
case 'monitoring':
$moni[] = $link;
break;
case 'management':
$mgmt[] = $link;
break;
case 'misc':
$misc[] = $link;
break;
case 'network':
$net[] = $link;
break;
case 'deployment':
$dep[] = $link;
break;
case 'enterprise':
$enter[] = $link;
break;
}
}
}
if(count($ha) < 1) {
$ha[] = $this->lang['no_plugin_available'];
}
if(count($net) < 1) {
$net[] = $this->lang['no_plugin_available'];
}
if(count($mgmt) < 1) {
$mgmt[] = $this->lang['no_plugin_available'];
}
if(count($moni) < 1) {
$moni[] = $this->lang['no_plugin_available'];
}
if(count($misc) < 1) {
$misc[] = $this->lang['no_plugin_available'];
}
if(count($dep) < 1) {
$dep[] = $this->lang['no_plugin_available'];
}
if(count($enter) < 1) {
$enter[] = $this->lang['no_plugin_available'];
}
return array(
'plugin_ha' => $ha,
'plugin_net' => $net,
'plugin_mgmt' => $mgmt,
'plugin_moni' => $moni,
'plugin_dep' => $dep,
'plugin_misc' => $misc,
'plugin_enter' => $enter
);
*/
}
示例3: plugin
function __get_navi($template, $mode)
{
$response = $this->response;
if ($this->response->html->request()->get('plugin_name') !== '') {
$plugin = new plugin();
$plugins = $plugin->available();
$key = array_keys($plugins, $this->response->html->request()->get('plugin_name'));
$key = $key[0];
$param = 'plugin_name';
}
if ($this->response->html->request()->get('base_name') !== '') {
$plugins = array('aa_server', 'appliance', 'event', 'image', 'kernel', 'plugins', 'resource', 'storage');
$key = array_keys($plugins, $this->response->html->request()->get('base_name'));
$key = $key[0];
$param = 'base_name';
}
$prev = ' ';
$next = ' ';
if ($key === 0) {
$next = $response->html->a();
$next->label = $plugins[1] . ' >>';
$next->href = $this->response->get_url($this->actions_name, $mode) . '&' . $param . '=' . $plugins[1];
$next->handler = 'onclick="wait();"';
} else {
if ($key !== 0 && $key < count($plugins) - 1) {
$prev = $response->html->a();
$prev->label = '<< ' . $plugins[$key - 1];
$prev->href = $this->response->get_url($this->actions_name, $mode) . '&' . $param . '=' . $plugins[$key - 1];
$prev->handler = 'onclick="wait();"';
$next = $response->html->a();
$next->label = $plugins[$key + 1] . ' >>';
$next->href = $this->response->get_url($this->actions_name, $mode) . '&' . $param . '=' . $plugins[$key + 1];
$next->handler = 'onclick="wait();"';
} else {
if ($key === count($plugins) - 1) {
$prev = $response->html->a();
$prev->label = '<< ' . $plugins[$key - 1];
$prev->href = $this->response->get_url($this->actions_name, $mode) . '&' . $param . '=' . $plugins[$key - 1];
$prev->style = "text-decoration: none;";
$prev->handler = 'onclick="wait();"';
}
}
}
$switch = '';
if ($mode !== 'docblock') {
$a = $response->html->a();
$a->label = 'docblock';
$a->href = $this->response->get_url($this->actions_name, 'docblock');
$a->handler = 'onclick="wait();"';
$switch .= $a->get_string();
}
if ($mode !== 'lang') {
$a = $response->html->a();
$a->label = 'lang';
$a->href = $this->response->get_url($this->actions_name, 'lang');
$a->handler = 'onclick="wait();"';
$switch .= $a->get_string();
}
if ($mode !== 'rest') {
$a = $response->html->a();
$a->label = 'rest';
$a->href = $this->response->get_url($this->actions_name, 'rest');
$a->handler = 'onclick="wait();"';
$switch .= $a->get_string();
}
if ($mode !== 'api') {
$a = $response->html->a();
$a->label = 'api';
$a->href = $this->response->get_url($this->actions_name, 'api');
$a->handler = 'onclick="wait();"';
$switch .= $a->get_string();
}
if ($mode !== 'template') {
$a = $response->html->a();
$a->label = 'templates';
$a->href = $this->response->get_url($this->actions_name, 'template');
$a->handler = 'onclick="wait();"';
$switch .= $a->get_string();
}
if ($mode !== 'hooks') {
$a = $response->html->a();
$a->label = 'hooks';
$a->href = $this->response->get_url($this->actions_name, 'hooks');
$a->handler = 'onclick="wait();"';
$switch .= $a->get_string();
}
if ($mode !== 'js') {
$a = $response->html->a();
$a->label = 'js';
$a->href = $this->response->get_url($this->actions_name, 'js');
$a->handler = 'onclick="wait();"';
$switch .= $a->get_string();
}
if ($mode !== 'css') {
$a = $response->html->a();
$a->label = 'css';
$a->href = $this->response->get_url($this->actions_name, 'css');
$a->handler = 'onclick="wait();"';
$switch .= $a->get_string();
}
//.........这里部分代码省略.........
示例4: select
function select()
{
$icon_started = $this->lang['action_stop'];
$icon_stopped = $this->lang['action_start'];
$icon_enabled = $this->lang['action_disable'];
$icon_disabled = $this->lang['action_enable'];
$plugin = new plugin();
$plugins_available = $plugin->available();
$plugins_enabled = $plugin->enabled();
$plugins_started = $plugin->started();
$h = array();
$h['name']['title'] = $this->lang['table_name'];
$h['type']['title'] = ' ';
$h['type']['sortable'] = ' ';
$h['type_n']['title'] = $this->lang['table_type'];
$h['type_n']['hidden'] = true;
$h['description']['title'] = $this->lang['table_description'];
$h['description']['sortable'] = false;
$h['configure']['title'] = " ";
$h['configure']['sortable'] = false;
$h['enabled']['title'] = " ";
$h['enabled']['sortable'] = false;
$h['enabled_n']['title'] = $this->lang['table_enabled'];
$h['enabled_n']['hidden'] = true;
$h['started']['title'] = " ";
$h['started']['sortable'] = false;
$h['started_n']['title'] = $this->lang['table_started'];
$h['started_n']['hidden'] = true;
$table = $this->response->html->tablebuilder('plugins', $this->response->get_array($this->actions_name, 'select'));
$table->max = count($plugins_available);
$table->sort = 'name';
$table->limit = 0;
$table->order = 'ASC';
$table->init();
$tps = $table->get_params();
$tp = '';
foreach ($tps['plugins'] as $k => $v) {
$tp .= '&plugins[' . $k . ']=' . $v;
}
$RootDir = $_SERVER["DOCUMENT_ROOT"] . '/openqrm/base/';
$thisfile = $this->response->html->thisfile;
$b = array();
$plugtype = array();
$i = 0;
$openqrm_version = $this->openqrm->get('config', 'SERVER_VERSION');
foreach ($plugins_available as $index => $plugin_name) {
$tmp = $plugin->get_config($plugin_name);
$plugin_description = $tmp['description'];
$plugin_type = $tmp['type'];
$plugtype[] = $plugin_type;
$plugin_version = $tmp['version'];
$plugin_major = substr($plugin_version, 0, strpos($plugin_version, '.'));
$plugin_minor = substr($plugin_version, strpos($plugin_version, '.') + 1);
$plugin_minor = substr($plugin_minor, 0, strpos($plugin_minor, '.'));
$plugin_base_version = $plugin_major . "." . $plugin_minor;
if (!strlen($this->response->html->request()->get('plugin_filter')) || strstr($this->response->html->request()->get('plugin_filter'), $plugin_type)) {
//
$b[$i] = array();
// plugin version mismatch
if ($openqrm_version != $plugin_base_version) {
$b[$i]['name'] = $plugin_name;
$b[$i]['type'] = '<span class="pill ' . strtolower($plugin_type) . '">' . $plugin_type . '</span>';
$b[$i]['type_n'] = $plugin_type;
$b[$i]['description'] = $plugin_description;
$b[$i]['enabled'] = $this->lang['version_mismatch'];
$b[$i]['enabled_n'] = 'b';
$b[$i]['started'] = ' ';
$b[$i]['started_n'] = 'c';
$b[$i]['configure'] = '';
} else {
// plugin not enabled!
if (!in_array($plugin_name, $plugins_enabled)) {
$a = $this->response->html->a();
$a->label = $icon_disabled;
$a->href = $this->response->get_url($this->actions_name, "enable");
$a->href .= '&' . $this->identifier_name . '[]=' . $plugin_name;
$a->href .= '&plugin_filter=' . $this->response->html->request()->get('plugin_filter');
$a->href .= $tp;
$a->href .= '#' . $plugin_name;
// anchor
$a->name = $plugin_name;
$a->handler = 'onclick="wait();"';
$a->css = 'enable';
$a->title = sprintf($this->lang['title_enable'], $plugin_name);
$b[$i]['name'] = $plugin_name;
$b[$i]['type'] = '<span class="pill ' . strtolower($plugin_type) . '">' . $plugin_type . '</span>';
$b[$i]['type_n'] = $plugin_type;
$b[$i]['description'] = $plugin_description;
$b[$i]['enabled'] = $a->get_string();
$b[$i]['enabled_n'] = 'b';
$b[$i]['started'] = ' ';
$b[$i]['started_n'] = 'c';
} else {
$plugin_icon_path = "{$RootDir}/plugins/{$plugin_name}/img/plugin.png";
$plugin_icon = "/openqrm/base/plugins/{$plugin_name}/img/plugin.png";
$plugin_icon_default = "/openqrm/base/plugins/aa_plugins/img/plugin.png";
if ($this->file->exists($plugin_icon_path)) {
$plugin_icon_default = $plugin_icon;
}
$a = $this->response->html->a();
//.........这里部分代码省略.........
示例5: select
function select()
{
$response = $this->response;
$h['plugin']['title'] = $this->lang['id'];
$h['plugin']['sortable'] = true;
$h['docblock']['title'] = ' ';
$h['docblock']['sortable'] = false;
$h['lang']['title'] = ' ';
$h['lang']['sortable'] = false;
$h['edit']['title'] = ' ';
$h['edit']['sortable'] = false;
$h['api']['title'] = ' ';
$h['api']['sortable'] = false;
$h['hooks']['title'] = ' ';
$h['hooks']['sortable'] = false;
$h['template']['title'] = ' ';
$h['template']['sortable'] = false;
$h['css']['title'] = ' ';
$h['css']['sortable'] = false;
$h['js']['title'] = ' ';
$h['js']['sortable'] = false;
// plugins
$plugin = new plugin();
$result = $plugin->available();
$b = array();
if (is_array($result)) {
foreach ($result as $v) {
$tmp['plugin'] = $v;
$tmp['docblock'] = ' ';
$tmp['edit'] = ' ';
$tmp['api'] = ' ';
$tmp['lang'] = ' ';
$tmp['template'] = ' ';
$tmp['hooks'] = ' ';
$path = $this->openqrm->get('basedir') . '/plugins/' . $v . '/web/class/';
$files = $this->file->get_files($path);
$oop = false;
foreach ($files as $file) {
if (strripos($file['name'], 'controller') !== false && strripos($file['name'], 'about') === false) {
$oop = true;
break;
}
}
if ($oop === true) {
$a = $response->html->a();
$a->href = $response->get_url($this->actions_name, 'docblock') . '&plugin_name=' . $v;
$a->label = $this->lang['action_docblock'];
$a->title = $this->lang['action_docblock'];
$a->handler = 'onclick="wait();"';
$tmp['docblock'] = $a->get_string();
$a = $response->html->a();
$a->href = $response->get_url($this->actions_name, 'lang') . '&plugin_name=' . $v;
$a->label = $this->lang['action_lang'];
$a->title = $this->lang['action_lang'];
$a->handler = 'onclick="wait();"';
$tmp['lang'] = $a->get_string();
$a = $response->html->a();
$a->href = $response->get_url($this->actions_name, 'rest') . '&plugin_name=' . $v;
$a->label = $this->lang['action_rest'];
$a->title = $this->lang['action_rest'];
$a->handler = 'onclick="wait();"';
$tmp['edit'] = $a->get_string();
$a = $response->html->a();
$a->href = $response->get_url($this->actions_name, 'api') . '&plugin_name=' . $v;
$a->label = $this->lang['action_api'];
$a->title = $this->lang['action_api'];
$a->handler = 'onclick="wait();"';
$tmp['api'] = $a->get_string();
$a = $response->html->a();
$a->href = $response->get_url($this->actions_name, 'template') . '&plugin_name=' . $v;
$a->label = $this->lang['action_template'];
$a->title = $this->lang['action_template'];
$a->handler = 'onclick="wait();"';
$tmp['template'] = $a->get_string();
$a = $response->html->a();
$a->href = $response->get_url($this->actions_name, 'hooks') . '&plugin_name=' . $v;
$a->label = $this->lang['action_hooks'];
$a->title = $this->lang['action_hooks'];
$a->handler = 'onclick="wait();"';
$tmp['hooks'] = $a->get_string();
$a = $response->html->a();
$a->href = $response->get_url($this->actions_name, 'js') . '&plugin_name=' . $v;
$a->label = $this->lang['action_js'];
$a->title = $this->lang['action_js'];
$a->handler = 'onclick="wait();"';
$tmp['js'] = $a->get_string();
$a = $response->html->a();
$a->href = $response->get_url($this->actions_name, 'css') . '&plugin_name=' . $v;
$a->label = $this->lang['action_css'];
$a->title = $this->lang['action_css'];
$a->handler = 'onclick="wait();"';
$tmp['css'] = $a->get_string();
}
$b[] = $tmp;
}
}
$table = $this->response->html->tablebuilder('plugins', $this->response->get_array($this->actions_name, 'select'));
$table->offset = 0;
$table->sort = 'plugin';
$table->limit = 0;
//.........这里部分代码省略.........