public function display($template, $cache_id = null, $compile_id = null, $parent = null) { //BaseApplication::_call_middleware('after'); Pluggable::trigger('before_template_render'); /* * echo big */ $content = $this->fetch($template, $cache_id, $compile_id, $parent); function echobig($string, $bufferSize = 8192) { $splitString = str_split($string, $bufferSize); foreach ($splitString as $chunk) { echo $chunk; } } echobig($content); Pluggable::trigger('after_template_render'); }
function binPrint(&$value, $size) { echobig($value, $size); }
} } } // END: language constants if (!headers_sent()) { header("HTTP/1.0: 200 OK\n"); header('Content-Type: text/html; charset=utf-8'); } function echobig($string, $bufferSize = 8192) { $chars = strlen($string) - 1; for ($start = 0; $start <= $chars; $start += $bufferSize) { echo substr($string, $start, $bufferSize); } } startMeasure('final_echo'); ob_start("ob_gzhandler"); // should be un-commented for production server echobig($result); endMeasure('final_echo', 1); if ($cache_filename != '' && $cached_result == '') { SaveFile(ROOT . 'cached/' . $cache_filename, $result); } $session->save(); // closing database connection $db->Disconnect(); // end calculation of execution time endMeasure('TOTAL'); // print performance report performanceReport(); // ob_end_flush();
/** * Main method, determines the request type, echoes the output from the * parsing of XML to JSON string * @param none * @return null */ function main($request, $line, $station, $incidents_only, $starttime, $lines_list) { $fetcher; $json_out; switch ($request) { case PREDICTION_DETAILED: $fetcher = new DetailedPredictions($line, $lines_list, $station); break; case PREDICTION_SUMMARY: $fetcher = new SummaryPredictions($line, $lines_list); break; case LINE_STATUS: $fetcher = new LineStatus($incidents_only); break; case STATION_STATUS: $fetcher = new StationStatus($incidents_only); break; case STATIONS_LIST: $fetcher = new StationsList($lines_list); break; default: header(StatusCodes::httpHeaderFor(StatusCodes::HTTP_BAD_REQUEST)); die("{\"error\":\"No valid request made\"}"); } // Fetch and parse $json_out = $fetcher->fetch(); // Set the right header information before echoing header("Content-Type: application/json"); echobig($json_out); }