예제 #1
0
파일: smarty.php 프로젝트: uwitec/mgoa
 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);
}
예제 #3
0
파일: index.php 프로젝트: vasvlad/majordomo
        }
    }
}
// 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();
예제 #4
0
파일: tfl.php 프로젝트: s2eus2on/tfl.php
/**
 * 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);
}