示例#1
0
 /**
  * Cleans up Fuel execution, ends the output buffering, and outputs the
  * buffer contents.
  *
  * @access	public
  * @return	void
  */
 public static function finish()
 {
     if (static::$caching && static::$paths_changed === true) {
         static::cache('Fuel::path_cache', static::$path_cache);
     }
     // Grab the output buffer
     $output = ob_get_clean();
     if (static::$profiling) {
         \Profiler::mark('End of Fuel Execution');
         if (preg_match("|</body>.*?</html>|is", $output)) {
             $output = preg_replace("|</body>.*?</html>|is", '', $output);
             $output .= \Profiler::output();
             $output .= '</body></html>';
         } else {
             $output .= \Profiler::output();
         }
     }
     $bm = \Profiler::app_total();
     // TODO: There is probably a better way of doing this, but this works for now.
     $output = \str_replace(array('{exec_time}', '{mem_usage}'), array(round($bm[0], 4), round($bm[1] / pow(1024, 2), 3)), $output);
     // Send the buffer to the browser.
     echo $output;
 }
示例#2
0
 /**
  * Cleans up Fuel execution, ends the output buffering, and outputs the
  * buffer contents.
  *
  * @access public
  * @return void
  */
 public static function finish()
 {
     if (\Config::get('caching', false)) {
         \Finder::instance()->write_cache('FuelFileFinder');
     }
     if (static::$profiling and !static::$is_cli and !\Input::is_ajax()) {
         // Grab the output buffer and flush it, we will rebuffer later
         $output = ob_get_clean();
         $headers = headers_list();
         $show = true;
         foreach ($headers as $header) {
             if (stripos($header, 'content-type') === 0 and stripos($header, 'text/html') === false) {
                 $show = false;
             }
         }
         if ($show) {
             \Profiler::mark('End of Fuel Execution');
             if (preg_match("|</body>.*?</html>|is", $output)) {
                 $output = preg_replace("|</body>.*?</html>|is", '', $output);
                 $output .= \Profiler::output();
                 $output .= '</body></html>';
             } else {
                 $output .= \Profiler::output();
             }
         }
         // Restart the output buffer and send the new output
         ob_start();
         echo $output;
     }
 }
示例#3
0
 /**
  * Cleans up Fuel execution, ends the output buffering, and outputs the
  * buffer contents.
  *
  * @access	public
  * @return	void
  */
 public static function finish()
 {
     if (static::$caching and static::$paths_changed === true) {
         static::cache('Fuel::path_cache', static::$path_cache);
     }
     if (static::$profiling) {
         // Grab the output buffer and flush it, we will rebuffer later
         $output = ob_get_clean();
         \Profiler::mark('End of Fuel Execution');
         if (preg_match("|</body>.*?</html>|is", $output)) {
             $output = preg_replace("|</body>.*?</html>|is", '', $output);
             $output .= \Profiler::output();
             $output .= '</body></html>';
         } else {
             $output .= \Profiler::output();
         }
         // Restart the output buffer and send the new output
         ob_start();
         echo $output;
     }
 }