id = $id; $this->url = $url; $this->subject = $subject; $this->content = $content; } public function addCreated($created) { $this->created = $created; } public function addModified($modified) { $this->modified = $modified; } public function addCreator($creator) { $this->creator = $creator; } public function addContributors($contributors) { $this->contributors = $contributors; } public function isCreator() { $this->is_creator = true; } public function addLinks($links) { if (is_array($links) && count($links) > 0) { $this->links = $links; } } public function addBacklinks($links) { $this->backlinks = $links; } //function addLinksExtern($links) { if (is_array($links) && count($links)>0) $this->ext_links = $links; } public function addVersionPrevious($rev) { $this->previous_version = $rev; } public function addVersionNext($rev) { $this->next_version = $rev; } public function addVersionLatest() { $this->latest_version = true; } public function addContentEncoded($encoded) { $this->content_encoded = $encoded; } public function addContainer($id) { $this->has_container = $id; } public function addSite($url) { $this->has_space = $url; } public function getContent(&$exp): string { $rdf = '<' . $this->type . " rdf:about=\"" . clean($this->url, true) . "\">\n"; if ($this->subject) { $rdf .= " " . clean($this->subject) . "\n"; // if(strcmp($this->has_container, 'http://en.wikipedia.org')===0) // $rdf .= " subject)."\"/>\n"; } $creator_name = null; if (count($this->contributors) > 0) { foreach ($this->contributors as $cont_id => $cont_name) { if (!isset($this->creator['sioc:modifier']) || ($this->creator['sioc:modifier'] != $cont_id)) { $rdf .= " siocURL('user', $cont_id) ) . "\" rdfs:label=\"" . clean($cont_name) . "\"/>\n"; } } if (isset($this->contributors[$this->creator['sioc:modifier']])) { $creator_name = 'rdfs:label="' . clean($this->contributors[$this->creator['sioc:modifier']]) . '"'; } } if (is_array($this->creator)) { // if ($this->creator['foaf:maker']) // $rdf .= " creator['foaf:maker'])."\"/>\n"; if ($this->creator['sioc:modifier']) { if ($this->is_creator === false) { $rdf .= " siocURL('user', $this->creator['sioc:modifier']) ) . "\" $creator_name/>\n"; } if ($this->is_creator === true) { $rdf .= " siocURL('user', $this->creator['sioc:modifier']) ) . "\" $creator_name/>\n"; } } } if ($this->created) { $rdf .= " " . $this->created . "\n"; } if ($this->modified) { $rdf .= " " . $this->modified . "\n"; } if ($this->has_space) { $rdf .= " has_space, true) . "\" />\n"; // TODO: rdfs:label } if ($this->has_container) { $rdf .= " siocURL('container', $this->has_container) ) . "\" />\n"; // TODO: rdfs:label } if ($this->content) { $rdf .= " content) . "]]>\n"; } if ($this->content_encoded) { $rdf .= " content_encoded . "]]>\n"; } /* if(is_array($this->topics)) { foreach($this->topics as $topic=>$url) { $rdf .= " \n"; $rdf .= " \n"; $rdf .= " \n"; // TODO: rdfs:label } } } if (count($this->backlinks) > 0) { foreach ($this->backlinks as $link_id) { if (!isHiddenPage($link_id)) { $rdf .= " siocURL('post', $link_id) ) . "\"/>\n"; // TODO: rdfs:label } } } /* if(is_array($this->ext_links)) { foreach($this->ext_links as $label=>$url) { $rdf .= " \n"; } } */ if ($this->previous_version) { $rdf .= " siocURL( 'post', $this->id . $exp->_urlseparator . 'rev' . $exp->_urlequal . $this->previous_version ) ) . "\"/>\n"; // TODO: rdfs:label /* If there is support for inference and transitivity the following is not needed */ $rdf .= " siocURL( 'post', $this->id . $exp->_urlseparator . 'rev' . $exp->_urlequal . $this->previous_version ) ) . "\"/>\n"; // TODO: rdfs:label } if ($this->next_version) { $rdf .= " siocURL( 'post', $this->id . $exp->_urlseparator . 'rev' . $exp->_urlequal . $this->next_version ) ) . "\"/>\n"; // TODO: rdfs:label /* If there is support for inference and transitivity the following is not needed */ $rdf .= " siocURL( 'post', $this->id . $exp->_urlseparator . 'rev' . $exp->_urlequal . $this->next_version ) ) . "\"/>\n"; // TODO: rdfs:label } if ($this->latest_version) { $rdf .= " siocURL('post', $this->id) ) . "\"/>\n"; // TODO: rdfs:label } /* if($this->has_discussion && (strpos($this->has_discussion, 'Talk:Talk:') == FALSE)) { $rdf .= " \n"; $rdf .= " has_discussion) ."\">\n"; $rdf .= " id = $id; $this->nick = $userid; $this->name = $name; //$this->email = $email; $this->url = $url; if (preg_match_all('/^.+@.+\..+$/Ui', $email, $check, PREG_SET_ORDER)) { if (preg_match_all('/^mailto:(.+@.+\..+$)/Ui', $email, $matches, PREG_SET_ORDER)) { $this->email = $email; $this->sha1 = sha1($email); } else { $this->email = "mailto:" . $email; $this->sha1 = sha1("mailto:" . $email); } } } public function getContent(&$exp): string { $rdf = "url, true) . "\">\n"; if ($this->nick) { $rdf .= " " . clean($this->nick) . "\n"; } if ($this->email) { if ($exp->_export_email) { $rdf .= " email . "\"/>\n"; } $rdf .= " " . $this->sha1 . "\n"; } if ($this->role) { $rdf .= " \n"; $rdf .= " \n"; $rdf .= " " . $this->role . "\n"; $rdf .= " \n"; $rdf .= " \n"; } $rdf .= " \n"; $rdf .= " \n"; if ($this->name) { $rdf .= " " . clean($this->name) . "\n"; } if ($this->email) { $rdf .= " " . $this->sha1 . "\n"; } if ($this->foaf_url) { $rdf .= " foaf_url . "\"/>\n"; } $rdf .= " \n"; $rdf .= " \n"; //if($this->sioc_url) { $rdf .= " sioc_url ."\"/>\n"; } $rdf .= "\n"; return $rdf; } } /** * SIOC::DokuWikiContainer object * * Contains information about a wiki container */ class SIOCDokuWikiContainer extends SIOCObject { private $type = 'sioc:Container'; private $id = null; private $url = null; private $posts = array(); private $subcontainers = array(); private $has_parent = null; private $title = null; public function __construct($id, $url) { $this->id = $id; $this->url = $url; } public function isWiki() { $this->type = 'sioct:Wiki'; } public function addArticles($posts) { $this->posts = $posts; } public function addContainers($containers) { $this->subcontainers = $containers; } public function addTitle($title) { $this->title = $title; } public function addParent($id) { $this->_has_parent = $id; } public function getContent(&$exp): string { $rdf = '<' . $this->type . " rdf:about=\"" . normalizeUri(clean($this->url, true)) . "\" >\n"; if ($this->title) { $rdf .= " " . clean($this->title) . "\n"; } if ($this->_has_parent) { $rdf .= " siocURL('container', $this->_has_parent) ) . "\" />\n"; // TODO: rdfs:label } foreach ($this->posts as $article) { // TODO: test permission before? $rdf .= " siocURL('post', $article['id']) ) . "\"/>\n"; // TODO: inluding title/name } foreach ($this->subcontainers as $container) { $rdf .= " siocURL('container', $container['id']) ) . "\"/>\n"; // TODO: inluding title/name } $rdf .= "type . ">\n"; return $rdf; } }