]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/htmloutputter.php
UPDATE ActivityVerb
[quix0rs-gnu-social.git] / lib / htmloutputter.php
index b1aae16fad7a0819b634c4069b60d85837a92c52..5e400379529b1c72e5b8c0631528d9ae78e3c3de 100644 (file)
  * @link      http://status.net/
  */
 
-if (!defined('STATUSNET') && !defined('LACONICA')) {
-    exit(1);
-}
-
-require_once INSTALLDIR.'/lib/xmloutputter.php';
+if (!defined('GNUSOCIAL')) { exit(1); }
 
 // Can include XHTML options but these are too fragile in practice.
 define('PAGE_TYPE_PREFS', 'text/html');
@@ -58,6 +54,9 @@ define('PAGE_TYPE_PREFS', 'text/html');
 
 class HTMLOutputter extends XMLOutputter
 {
+    protected $DTD = array('doctype' => 'html',
+                           'spec'    => '-//W3C//DTD XHTML 1.0 Strict//EN',
+                           'uri'     => 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd');
     /**
      * Constructor
      *
@@ -120,9 +119,8 @@ class HTMLOutputter extends XMLOutputter
             // Required for XML documents
             $this->startXML();
         }
-        $this->xw->writeDTD('html',
-                            '-//W3C//DTD XHTML 1.0 Strict//EN',
-                            'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd');
+
+        $this->writeDTD();
 
         $language = $this->getLanguage();
 
@@ -138,6 +136,18 @@ class HTMLOutputter extends XMLOutputter
         }
     }
 
+    public function setDTD($doctype, $spec, $uri)
+    {
+        $this->DTD = array('doctype' => $doctype, 'spec' => $spec, 'uri' => $uri);
+    }
+
+    protected function writeDTD()
+    {
+        $this->xw->writeDTD($this->DTD['doctype'],
+                            $this->DTD['spec'],
+                            $this->DTD['uri']);
+    }
+
     function getLanguage()
     {
         // FIXME: correct language for interface
@@ -198,6 +208,14 @@ class HTMLOutputter extends XMLOutputter
         }
         $attrs['id'] = $id;
         $attrs['name'] = is_null($name) ? $id : $name;
+        if (array_key_exists('placeholder', $attrs) && (is_null($attrs['placeholder']) || $attrs['placeholder'] === '')) {
+            // If placeholder is type-aware equal to '' or null, unset it as we apparently don't want a placeholder value
+            unset($attrs['placeholder']);
+        } else {
+            // If the placeholder is set use it, or use the label as fallback.
+            $attrs['placeholder'] = isset($attrs['placeholder']) ? $attrs['placeholder'] : $label;
+        }
+
         if (!is_null($value)) { // value can be 0 or ''
             $attrs['value'] = $value;
         }
@@ -386,11 +404,11 @@ class HTMLOutputter extends XMLOutputter
 
                 if (strpos($src, 'plugins/') === 0 || strpos($src, 'local/') === 0) {
 
-                    $src = common_path($src, StatusNet::isHTTPS()) . '?version=' . GNUSOCIAL_VERSION;
+                    $src = common_path($src, GNUsocial::isHTTPS()) . '?version=' . GNUSOCIAL_VERSION;
 
                 } else {
 
-                    if (StatusNet::isHTTPS()) {
+                    if (GNUsocial::isHTTPS()) {
 
                         $sslserver = common_config('javascript', 'sslserver');
 
@@ -493,7 +511,7 @@ class HTMLOutputter extends XMLOutputter
                 if(file_exists(Theme::file($src,$theme))){
                    $src = Theme::path($src, $theme);
                 }else{
-                    $src = common_path($src, StatusNet::isHTTPS());
+                    $src = common_path($src, GNUsocial::isHTTPS());
                 }
                 $src.= '?version=' . GNUSOCIAL_VERSION;
             }