]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/htmloutputter.php
Remove annoying log msg
[quix0rs-gnu-social.git] / lib / htmloutputter.php
index aa01f6b1d9d268e5855864efe428027cf4aa5916..d267526c8894f4063b3e8d620383a8591a14887a 100644 (file)
@@ -34,9 +34,8 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
 
 require_once INSTALLDIR.'/lib/xmloutputter.php';
 
-define('PAGE_TYPE_PREFS',
-       'text/html,application/xhtml+xml,'.
-       'application/xml;q=0.3,text/xml;q=0.2');
+// Can include XHTML options but these are too fragile in practice.
+define('PAGE_TYPE_PREFS', 'text/html');
 
 /**
  * Low-level generator for HTML
@@ -109,11 +108,13 @@ class HTMLOutputter extends XMLOutputter
         header('Content-Type: '.$type);
 
         $this->extraHeaders();
-        if( ! substr($type,0,strlen('text/html'))=='text/html' ){
-            // Browsers don't like it when <?xml it output for non-xhtml documents
+        if (preg_match("/.*\/.*xml/", $type)) {
+            // Required for XML documents
             $this->xw->startDocument('1.0', 'UTF-8');
         }
-        $this->xw->writeDTD('html');
+        $this->xw->writeDTD('html',
+                            '-//W3C//DTD XHTML 1.0 Strict//EN',
+                            'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd');
 
         $language = $this->getLanguage();
 
@@ -373,8 +374,8 @@ class HTMLOutputter extends XMLOutputter
         $url = parse_url($src);
         if( empty($url->scheme) && empty($url->host) && empty($url->query) && empty($url->fragment))
         {
-            if(file_exists(theme_file($src,$theme))){
-               $src = theme_path($src, $theme) . '?version=' . STATUSNET_VERSION;
+            if(file_exists(Theme::file($src,$theme))){
+               $src = Theme::path($src, $theme) . '?version=' . STATUSNET_VERSION;
             }else{
                $src = common_path($src);
             }
@@ -425,16 +426,12 @@ class HTMLOutputter extends XMLOutputter
     function autofocus($id)
     {
         $this->elementStart('script', array('type' => 'text/javascript'));
-        $this->raw('
-        <!--
-        $(document).ready(function() {
-            var el = $("#' . $id . '");
-            if (el.length) {
-                el.focus();
-            }
-        });
-        -->
-        ');
+        $this->raw('/*<![CDATA[*/'.
+                   ' $(document).ready(function() {'.
+                   ' var el = $("#' . $id . '");'.
+                   ' if (el.length) { el.focus(); }'.
+                   ' });'.
+                   ' /*]]>*/');
         $this->elementEnd('script');
     }
 }