Changeset - 7e1be644afac
[Not reviewed]
default
0 1 0
Nathan Brink (binki) - 15 years ago 2011-01-27 20:01:01
ohnobinki@ohnopublishing.net
Rework HTTP Accept: header handling so that browsers which don't send Accept: headers get XHTML.
1 file changed with 2 insertions and 3 deletions:
0 comments (0 inline, 0 general)
inc/class.page.php
Show inline comments
 
@@ -110,27 +110,26 @@ class page
 
    $this->headCode['jValidate'] = '<script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery.validate/1.7/jquery.validate.pack.js"></script>';
 
    $this->headCode['qTip'] = '<script type="text/javascript" src="http://ohnopub.net/js/jquery.qtip-1.0.min.js"></script>';
 
    $this->headCode['schedInput'] = '<script type="text/javascript" src="scripts/scheduleInput.js"></script>';
 
    $this->headCode['outputPrintStyle'] = '<link rel="stylesheet" href="styles/print.css" type="text/css" media="screen" charset="utf-8" />';
 
    $this->headCode['outputStyle'] = '<link rel="stylesheet" href="styles/output.css" type="text/css" media="screen" charset="utf-8" />'; 
 
    $this->headCode['gliderHeadcode'] = '<link rel="stylesheet" href="styles/glider.css" type="text/css" media="screen" charset="utf-8" />'; 
 
    $this->headCode['uiTabsKeyboard'] = '<script type="text/javascript" src="scripts/uiTabsKeyboard.js"></script>';
 
    $this->headCode['displayTables'] = '<script type="text/javascript" src="scripts/displayTables.js"></script>';
 
    $this->pagetitle = $ntitle;
 
    $this->scripts = $nscripts;
 

	
 
   /* Compliant browsers which care, such as gecko, explicitly request xhtml: */
 
   if(!empty($_SERVER['HTTP_ACCEPT'])
 
      && (strpos($_SERVER['HTTP_ACCEPT'], 'application/xhtml+xml') !== FALSE
 
	  || !strlen($_SERVER['HTTP_ACCEPT'])) /* then the browser doesn't care :-) */)
 
   if(empty($_SERVER['HTTP_ACCEPT'])  /* then the browser doesn't care :-) */
 
      || strpos($_SERVER['HTTP_ACCEPT'], 'application/xhtml+xml') !== FALSE)
 
     {
 
       $this->xhtml = TRUE;
 
       header('Content-Type: application/xhtml+xml; charset=utf-8');
 
     }
 
   else
 
     header('Content-Type: text/html; charset=utf-8');
 

	
 
   if (count($ga_trackers))
 
     {
 
       $ga_www = 'http://www.';
 
       if ($_SERVER['SERVER_PORT'] != 80)
 
	 $ga_www = 'https://ssl.';
0 comments (0 inline, 0 general)