public function plugin($parameter1 = NULL, $parameter2 = NULL)
 {
     switch ($parameter1) {
         case 'showall':
             $return = '';
             $available_plugin = json_decode(available_plugin(), TRUE);
             $plugins = $available_plugin['plugins'];
             foreach ($plugins as $key => $val) {
                 if (is_plugin_active($key)) {
                     $key = '[active] ' . $key;
                 } else {
                     $key = '[deactive] ' . $key;
                 }
                 $return[] = "\t" . $key . "\n";
             }
             return implode('', $return);
             break;
         case 'active':
             if (isset($parameter2)) {
                 $return = disable_plugin('1', $parameter2);
                 $args = json_decode($return, TRUE);
                 return $args['mes'];
             } else {
                 $return = '';
                 $active_plugin = json_decode(list_plugin(1), TRUE);
                 foreach ($active_plugin as $key => $val) {
                     $return[] = "\t" . $val . "\n";
                 }
                 return implode('', $return);
             }
             break;
         case 'deactive':
             if (isset($parameter2)) {
                 return disable_plugin('0', $parameter2);
                 $args = json_decode($return, TRUE);
                 return $args['mes'];
             } else {
                 $return = '';
                 $active_plugin = json_decode(list_plugin(0), TRUE);
                 foreach ($active_plugin as $key => $val) {
                     $return[] = "\t" . $val . "\n";
                 }
                 return implode('', $return);
             }
             break;
         case 'drop':
             if (isset($parameter2)) {
                 return drop_plugin($parameter2);
                 $args = json_decode($return, TRUE);
                 return $args['mes'];
             } else {
                 $mes = _('Vui lòng nhập plugin key muốn xóa');
                 return $mes;
             }
             break;
         default:
             $help = "\tplugin showall : " . _('Hiển thị tất cả plugin hiện có') . "\n" . "\tplugin active : " . _('Hiển thị tất cả plugin đang chạy') . "\n" . "\tplugin active [pluginkey] : " . _('Kích hoạt plugin [pluginkey]') . "\n" . "\tplugin deactive : " . _('Hiển thị tất cả plugin đang tắt') . "\n" . "\tplugin deactive [pluginkey] : " . _('Tắt plugin [pluginkey]') . "\n" . "\tplugin drop [pluginkey]: " . _('Xóa plugin [pluginkey]') . "\n" . "" . "\n";
             return $help;
     }
 }
<?php

/** 
 * Tệp tin xử lý plugin trong admin
 * Vị trí : admin/plugin.php 
 */
if (!defined('BASEPATH')) {
    exit('403');
}
/** gọi tệp tin admin base */
require_once dirname(__FILE__) . '/admin.php';
/** gọi model xử lý plugin */
require_once dirname(__FILE__) . '/plugin/plugin_model.php';
$key = hm_get('key');
$id = hm_get('id');
$action = hm_get('action');
switch ($action) {
    case 'available':
        echo available_plugin();
        break;
    case 'disable_plugin':
        echo disable_plugin(0);
        break;
    case 'active_plugin':
        echo disable_plugin(1);
        break;
}