当前位置: 首页>>代码示例>>PHP>>正文


PHP plugin::get_config方法代码示例

本文整理汇总了PHP中plugin::get_config方法的典型用法代码示例。如果您正苦于以下问题:PHP plugin::get_config方法的具体用法?PHP plugin::get_config怎么用?PHP plugin::get_config使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在plugin的用法示例。


在下文中一共展示了plugin::get_config方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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
     			);
     */
 }
开发者ID:kelubo,项目名称:OpenQRM,代码行数:99,代码来源:appliance.edit.class.php

示例2: 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'] = '&#160;';
     $h['type']['sortable'] = '&#160;';
     $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'] = "&#160;";
     $h['configure']['sortable'] = false;
     $h['enabled']['title'] = "&#160;";
     $h['enabled']['sortable'] = false;
     $h['enabled_n']['title'] = $this->lang['table_enabled'];
     $h['enabled_n']['hidden'] = true;
     $h['started']['title'] = "&#160;";
     $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'] = '&#160;';
                 $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'] = '&#160;';
                     $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();
//.........这里部分代码省略.........
开发者ID:kelubo,项目名称:OpenQRM,代码行数:101,代码来源:aa_plugins.select.class.php

示例3: action

 function action()
 {
     $msg = '';
     $event = new event();
     $server = new openqrm_server();
     $plugin = new plugin();
     $identifier = $this->response->html->request()->get($this->identifier_name);
     $enabled = $plugin->enabled();
     if ($identifier !== '') {
         foreach ($identifier as $id) {
             if (in_array($id, $enabled)) {
                 $error = false;
                 // check dependencies
                 foreach ($enabled as $v) {
                     if ($v !== $id) {
                         $tmp = $plugin->get_dependencies($v);
                         if ($tmp !== '' && isset($tmp['dependencies']) && $tmp['dependencies'] !== '') {
                             if (strpos($tmp['dependencies'], $id) !== false) {
                                 $msg .= sprintf($this->lang['error_dependencies'], $id, $v) . '<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_in_use'], $id) . '<br>';
                                     $error = true;
                                 }
                             }
                             break;
                     }
                 }
                 if ($error === false) {
                     $return = $server->send_command("openqrm_server_plugin_command " . $id . " uninstall " . $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_disable'], $id) . '<br>';
                     }
                 }
             }
         }
     }
     $this->response->redirect($this->response->get_url($this->actions_name, 'select', $this->message_param, $msg));
 }
开发者ID:kelubo,项目名称:OpenQRM,代码行数:59,代码来源:aa_plugins.disable.class.php

示例4: select


//.........这里部分代码省略.........
                // add link to continue if appliance has unfinished wizard
                $disabled = array();
                if (isset($appliance->wizard) && strpos($appliance->wizard, 'wizard') !== false) {
                    $params = explode(',', $appliance->wizard);
                    $wizard_step = explode('=', $params[0]);
                    $wizard_user = explode('=', $params[1]);
                    if ($wizard_user[1] === $this->user->name) {
                        // continue button
                        $a = $this->response->html->a();
                        $a->title = $this->lang['action_continue'];
                        $a->label = $this->lang['action_continue'];
                        $a->handler = 'onclick="wait();"';
                        $a->css = 'badge continue';
                        $a->href = $this->response->get_url($this->actions_name, $wizard_step[1]) . '&appliance_wizard_id=' . $appliance->id . '' . $tp;
                        $appliance_comment = $a->get_string();
                    } else {
                        $appliance_comment = sprintf($this->lang['appliance_create_in_progress'], $wizard_user[1]);
                    }
                    // disable all buttons
                    $disabled[] = $appliance->id;
                    $strEdit = '';
                    $strStart = '';
                    $strStop = '';
                    $release_resource = '';
                } else {
                    $plugin = new plugin();
                    $enabled_plugins = $plugin->enabled();
                    foreach ($enabled_plugins as $index => $plugin_name) {
                        $plugin_appliance_link_section_hook = $this->openqrm->get('webdir') . "/plugins/" . $plugin_name . "/openqrm-" . $plugin_name . "-appliance-link-hook.php";
                        if (file_exists($plugin_appliance_link_section_hook)) {
                            require_once "{$plugin_appliance_link_section_hook}";
                            $appliance_get_link_function = str_replace("-", "_", "get_" . "{$plugin_name}" . "_appliance_link");
                            if (function_exists($appliance_get_link_function)) {
                                $p = $plugin->get_config($plugin_name);
                                $alink = $appliance_get_link_function($appliance->id);
                                if (is_object($alink)) {
                                    //	$alink->handler = $alink->handler.' onclick="wait();"';
                                    $alink->css = 'enable';
                                    $alink->title = preg_replace('~(.*?)<a.*>(.*?)</a>(.*?)~i', '$1$2$3', $p['description']);
                                    $alink = $alink->get_string();
                                }
                                $appliance_link_section .= $alink;
                            }
                        }
                    }
                    if ($appliance_db["appliance_comment"] !== '') {
                        $appliance_comment = $appliance_db["appliance_comment"];
                        $appliance_comment .= "<hr>";
                        $appliance_comment .= $appliance_link_section;
                    } else {
                        $appliance_comment = $appliance_link_section;
                    }
                }
                $b[] = array('appliance_state' => $state_icon, 'appliance_id' => $appliance_db["appliance_id"], 'appliance_name' => $appliance_db["appliance_name"], 'appliance_values' => $str, 'appliance_comment' => $appliance_comment, 'appliance_virtualization' => $appliance_db["appliance_virtualization"], 'appliance_edit' => $strEdit . '' . $strStart . '' . $release_resource);
            }
        }
        // Filter
        $virtulization_types = new virtualization();
        $list = $virtulization_types->get_list();
        $filter = array();
        $filter[] = array('', '');
        foreach ($list as $l) {
            $filter[] = array($l['label'], $l['value']);
        }
        asort($filter);
        $select = $this->response->html->select();
开发者ID:kelubo,项目名称:OpenQRM,代码行数:67,代码来源:appliance.select.class.php


注:本文中的plugin::get_config方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。