Esempio n. 1
0
 /**
  * Complete the response by adding final content to the <head> of the document
  * @static
  * @since 2.4.1
  * @param string $buffer html content
  * @return string finalized response
  */
 function BufferOut($buffer)
 {
     global $config, $gp_head_content, $gp_random, $page;
     //get just the head of the buffer to see if we need to add charset
     $pos = strpos($buffer, '</head');
     if ($pos > 0) {
         $head = substr($buffer, 0, $pos);
         gpOutput::DoctypeMeta($head);
     }
     //replace the <head> placeholder with header content
     $head_replacement = '<!-- get_head_placeholder ' . $gp_random . ' -->';
     $buffer = str_replace($head_replacement, $gp_head_content, $buffer);
     //add jquery if needed
     $replacement = '';
     if (strpos($buffer, '<script') !== false) {
         if (isset($config['jquery']) && $config['jquery'] == 'google') {
             $replacement = "\n<script src=\"//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js\" type=\"text/javascript\"></script>";
         } else {
             $replacement = "\n<script type=\"text/javascript\" src=\"" . common::GetDir('/include/thirdparty/js/jquery.js') . "\"></script>";
         }
     }
     $buffer = str_replace('<!-- jquery_placeholder ' . $gp_random . ' -->', $replacement, $buffer);
     //if( gpdebug && count($_GET) == 0 && count($_POST) == 0 ){
     //	$buffer .= '<h3>'.number_format(memory_get_usage()).'</h3>';
     //	$buffer .= '<h3>'.number_format(memory_get_peak_usage()).'</h3>';
     //	$buffer .= '<h2>'.microtime_diff($_SERVER['REQUEST_TIME'],microtime()).'</h2>';
     //}
     return $buffer;
 }