Exemple #1
0
 public function render()
 {
     global $sioc_nick, $count;
     $uri = $this->uri;
     $content = $this->data['content'];
     $ocontent = strip_tags($content);
     $author = $this->data['author'];
     $creator = $this->data['creator'];
     $date = $this->data['date'];
     $name = $this->data['name'];
     $reply_of = $this->data['reply_of'];
     $reply_of_of = $this->data['reply_of_of'];
     $presence = $this->data['presence'];
     $location = $this->data['location'];
     $locname = $this->data['locname'];
     $star = $this->get_star();
     $pic = SMOBTools::either($this->data['depiction'], SMOB_ROOT . 'img/avatar-blank.jpg');
     $class = strpos($uri, SMOB_ROOT) !== FALSE ? "post internal" : "post external";
     $ht .= "<div about=\"{$presence}\" rel=\"opo:customMessage\">\n";
     $ht .= "<div class=\"{$class}\" typeof=\"sioct:MicroblogPost\" about=\"{$uri}\">\n";
     $ht .= "<span style=\"display:none;\" rel=\"sioc:has_container\" href=\"" . SMOB_ROOT . "\"></span>\n";
     $ht .= "<img about=\"{$author}\" rel=\"foaf:depiction\" href=\"{$pic}\" src=\"{$pic}\" class=\"depiction\" alt=\"Depiction for {$name}\"/>";
     $ht .= "  <span class=\"content\" property=\"content:encoded\">{$content}</span>\n";
     $ht .= "  <span style=\"display:none;\" property=\"sioc:content\">{$ocontent}</span>\n";
     $ht .= '  <div class="infos">';
     $ht .= "  by <a class=\"author\" rel=\"foaf:maker\" href=\"{$author}\"><span property=\"foaf:name\">{$name}</span></a> - \n";
     if ($location) {
         $ht .= "  location: <span about=\"{$presence}\"><a rel=\"opo:currentLocation\" href=\"{$location}\"><span property=\"rdfs:label\">{$locname}</span></a></span><br/>\n";
     } else {
         $ht .= "  location: <span about=\"{$presence}\">unspecified</span><br/>\n";
     }
     $ht .= "  <div style=\"margin: 2px;\"></div> ";
     $ht .= "  <div id=\"star{$count}\" class=\"rating\">&nbsp;</div>";
     $ht .= "  <span style=\"display:none;\" rel=\"sioc:has_creator\" href=\"{$creator}\"></span>\n";
     $ht .= "  <a href=\"{$uri}\" class=\"date\" property=\"dcterms:created\">{$date}</a>\n";
     if (strpos($uri, 'http://twitter.com/') !== FALSE) {
         $ex = explode('/', $uri);
         $data = SMOB_ROOT . 'data/twitter/' . $ex[5];
     } else {
         $data = str_replace('post', 'data', $uri);
     }
     $ht .= " [<a href=\"{$data}\">RDF</a>]\n";
     if (SMOBAuth::check()) {
         if (strpos($uri, SMOB_ROOT) !== FALSE) {
             $ex = explode('/', $uri);
             error_log("DEBUG: post delete path: " . join(' ', $ex), 0);
             error_log("DEBUG: post uri: " . $uri, 0);
             $action = SMOB_ROOT . 'delete/' . $ex[5];
             // the previous line doesn't work as the post is in the position 4
             $action = str_replace('post', 'delete', $uri);
             error_log("DEBUG: is going to be run the action: " . $action, 0);
             $ht .= " [<a href=\"{$action}\" onclick=\"javascript:return confirm('Are you sure ? This cannot be undone.')\">Delete post</a>]";
         }
         $action = $this->get_publish_uri();
         $ht .= " [<a href=\"{$action}\">Post a reply</a>]\n";
     }
     if ($reply_of) {
         $action = SMOBTools::get_uri($reply_of, 'post');
         $ht .= " [<a href=\"{$action}\">Replied message</a>]\n";
     }
     if ($reply_of_of) {
         $action = SMOBTools::get_uri($reply_of_of, 'post');
         $ht .= " [<a href=\"{$action}\">Replies</a>]\n";
     }
     $ht .= '  </div>';
     $ht .= '</div>';
     $ht .= "</div>\n\n";
     $ht .= "<script type=\"text/javascript\">\n\$(document).ready(function(){\n\t\$('#star{$count}').rating('ajax/star.php?u={$uri}', {maxvalue: 1, curvalue: {$star}});\n\t});\n</script>";
     return $ht;
 }
Exemple #2
0
 public function person($person, $uri)
 {
     $names = SMOBTools::either($person['names'], array("Anonymous"));
     $imgs = SMOBTools::either($person['images'], array(SMOB_ROOT . '../img/avatar-blank.jpg'));
     $homepage = $person['homepage'];
     $weblog = $person['weblog'];
     $knows = $person['knows'];
     $name = $names[0];
     $pic = $imgs[0];
     $ht = "<div class=\"person\">\n";
     $ht .= "<img src=\"{$pic}\" class=\"depiction\" alt=\"Depiction\" />";
     $ht .= "{$name}\n";
     foreach ($homepage as $h) {
         $ht .= " [<a href=\"{$h}\">Website</a>]\n";
     }
     foreach ($weblog as $w) {
         $ht .= " [<a href=\"{$w}\">Blog</a>]\n";
     }
     foreach ($knows as $k) {
         $enc = get_uri($k, 'user');
         $ht .= " [<a href=\"{$enc}\">Friend</a>]\n";
     }
     $ht .= "</div>\n\n";
     return $ht;
 }