echo $service->getJSON($Config); unset($service); break; case "nas": $nas = new NAS(); echo $nas->getNasList(); unset($nas); break; case "switch": $switch = new Switches(); echo $switch->getJSON(); unset($switch); break; case "ping_switch": if (isset($_POST["ip"])) { $switch = new Switches(); echo $switch->do_ping($_POST["ip"]); unset($switch); } break; case "get_ping": if ($_POST["type"] == "sw") { $text = file_get_contents("DS/store/sw/sw_data_{$_POST["sid"]}.json", "r"); $text = trim($text, " \"."); echo $text; } elseif ($_POST["type"] == "nas") { $text = file_get_contents("DS/store/nas/nas_data_{$_POST["sid"]}.json", "r"); $text = trim($text, " \"."); echo $text; } break;
/** * Begins execution of the plugin. * * Since everything within the plugin is registered via hooks, * then kicking off the plugin from this point in the file does * not affect the page life cycle. * * @since 1.0.0 */ function run_switches() { $plugin = new Switches(); $plugin->run(); }