<?php define("WP_USE_THEMES", false); $appRoot = dirname(dirname(dirname(dirname(__DIR__)))); require $appRoot . "/vendor/wordpress/wordpress/wp-blog-header.php"; // Get fields from sources // eventually hook this into an admin page $feeds = array(array("label" => "wse", "url" => "http://" . ENV . ".jhu.edu/assets/plugins/wp-fos-import/wse.php"), array("label" => "ksas", "url" => "http://" . ENV . ".jhu.edu/assets/plugins/wp-fos-import/ksas.php")); $http = new \HttpExchange\Adapters\Resty(new Resty()); // Get the data $getter = new \wpfos\classes\Getter($http, $feeds); $fields = $getter->get(); // Clean and combine the data into a single array $combined = array(); foreach ($fields as $school => $fos) { $cleanerName = "\\wpfos\\cleaners\\" . ucfirst($school); $cleaner = new $cleanerName(); // Clean $cleaned = $cleaner->clean($fos); // Combine foreach ($cleaned as $field) { $combined[] = $field; } } // echo count($combined); die(); if (isset($_GET['csv'])) { if (isset($_GET['download'])) { header("Content-type: text/csv; charset=utf-8"); header("Content-Disposition: attachment; filename=studyfields.csv"); header("Pragma: no-cache"); header("Expires: 0");
protected function getData($feeds) { $getter = new \wpfos\classes\Getter(); return $getter->get($feeds); }