codestyle
[disclosr.git] / documents / template.inc.php
blob:a/documents/template.inc.php -> blob:b/documents/template.inc.php
--- a/documents/template.inc.php
+++ b/documents/template.inc.php
@@ -98,9 +98,12 @@
                 _gaq.push(['_trackPageview']);
 
                 (function() {
-                    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+                    var ga = document.createElement('script');
+                    ga.type = 'text/javascript';
+                    ga.async = true;
                     ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
-                    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+                    var s = document.getElementsByTagName('script')[0];
+                    s.parentNode.insertBefore(ga, s);
                 })();
 
             </script>
@@ -146,9 +149,12 @@
 function displayLogEntry($row, $idtoname) {
     $result = "";
     $result .= '<div itemscope itemtype="http://schema.org/Article">';
-    $result .= '<h2> <span itemprop="datePublished">' . $row->value->date . "</span>: <span itemprop='name headline'>" . truncate($row->value->title, 120)."</span>";
+    $result .= '<h2> <span itemprop="datePublished">' . $row->value->date . "</span>: <span itemprop='name headline'>" . truncate($row->value->title, 120) . "</span>";
     $result .= '(<span itemprop="author publisher creator">' . $idtoname[$row->value->agencyID] . '</span>)</h2>';
-    $result .= "<p itemprop='description articleBody text'> Title" . $row->value->title . "<br/>" . str_replace("\n", "<br>", $row->value->description);
+    $result .= "<p itemprop='description articleBody text'> Title" . $row->value->title . "<br/>";
+    if (isset($row->value->description)) {
+        $result .= str_replace("\n", "<br>", $row->value->description);
+    }
     if (isset($row->value->notes)) {
         $result .= " <br>Note: " . $row->value->notes;
     }
@@ -157,7 +163,7 @@
     if (isset($row->value->links)) {
         $result .= '<h3>Links/Documents</h3><ul itemprop="associatedMedia">';
         foreach ($row->value->links as $link) {
-            $result .= '<li itemscope itemtype="http://schema.org/MediaObject"><a href='.$link.' itemprop="url contentURL">' . urlencode($link) . "</a></li>";
+            $result .= '<li itemscope itemtype="http://schema.org/MediaObject"><a href=' . $link . ' itemprop="url contentURL">' . urlencode($link) . "</a></li>";
         }
 
         $result .= "</ul>";