public static function ajax_html()
 {
     $data = json_decode($_POST['jsonData'], true);
     $fnames = array("Title", "Author", "Publisher", "Date", "Related {$data['idtype']}#s");
     $fvals = array_values($data);
     $header = "";
     $row = "";
     $relatedIDs = explode(',', preg_replace("/[^0-9]+/", ',', $fvals[5]));
     $n = count($relatedIDs);
     $urls = \oclc\WorldCatCatalogSearch::getLinks($data['idtype'], $relatedIDs);
     for ($i = 0; $i < $n; ++$i) {
         $id = $relatedIDs[$i];
         if ($urls[$id] !== FALSE) {
             $relatedIDs[$i] = "<a href=\"{$urls[$id]}\" target=\"_blank\">{$id}</a>";
         }
     }
     $fvals[5] = implode("&nbsp;<br/>", $relatedIDs);
     for ($i = 1; $i < 6; $i++) {
         $header .= "<th>{$fnames[$i - 1]}</th>";
         $row .= "<td>{$fvals[$i]}</td>";
     }
     return "<div id='modal-data'><table><thead>{$header}</thead><tbody><tr>{$row}</tr></tbody></table></div>";
 }
<?php

require_once 'autoloader.php';
#\util\PHPProfiler::run();
if (!isset($_POST['idlist'])) {
    header("location: index.php");
}
$list = explode(',', $_POST['idlist']);
$idtype = strtoupper($_POST['idtype']);
$outputFormat = $_POST['outputFormat'];
$flag_hide_unique = $_POST['hideunique'] == 1;
$n = count($list);
for ($i = 0; $i < $n; ++$i) {
    if ($list[$i] == FALSE) {
        unset($list[$i]);
    } else {
        $list[$i] = intval($list[$i]);
    }
}
$list = array_unique($list, SORT_NUMERIC);
$resultset = \oclc\WorldCatCatalogSearch::batchLookup($idtype, $list, $flag_hide_unique);
\output\FormatFactory::make($outputFormat)->display('Results', $resultset);