private function onCSVExport() { GWF_Website::plaintext(); $flags = WC_Warflag::getByWarbox($this->warbox, 'wf_order ASC'); echo self::CSV_COLUMNS . PHP_EOL; foreach ($flags as $flag) { $flag instanceof WC_Warflag; $input = array($flag->getVar('wf_order'), $flag->getVar('wf_cat'), $flag->getVar('wf_score'), $flag->getVar('wf_title'), $flag->getVar('wf_url'), $flag->getVar('wf_authors'), $flag->getVar('wf_status'), $flag->getVar('wf_login'), '', $flag->isWarchall() ? 'SSH' : 'WEB'); echo GWF_Array::toCSV($input) . PHP_EOL; } die(0); }
private function genConfig() { $vars = array('site_id', 'site_name', 'site_classname', 'wb_id', 'wb_name', 'wb_levels', 'wb_port', 'wb_host', 'wb_user', 'wb_pass', 'wb_weburl', 'wb_ip', 'wb_whitelist', 'wb_blacklist', 'wb_launched_at'); $output = GWF_Array::toCSV($vars) . "\n"; foreach ($this->getWarboxes(true) as $warbox) { $warbox instanceof WC_Warbox; $data = array(); foreach ($vars as $var) { $data[] = $warbox->getVar($var); } $output .= GWF_Array::toCSV($data) . "\n"; } // $format = '%5s, %15s, %5s, %2s, %64s, %24s, %s'."\n"; // $output = vsprintf('#'.$format, explode(',', 'CLS,IP,prt,RS,warhost,displayname,webhost')); // foreach ($this->getWarboxes(true) as $warbox) // { // $warbox instanceof WC_Warbox; // $output .= sprintf(' '.$format, // $warbox->getVar('site_classname'), $warbox->getWarIP(), // $warbox->getWarPort(), $warbox->getWarReduceScore(), // $warbox->getWarHost(), $warbox->getSitename(), $warbox->getURL())."\n"; // } $_GET['ajax'] = 1; GWF_Website::plaintext(); return $output; }