@@ -80,22 +80,22 @@ discard block |
||
80 | 80 | /* -- Methods to manage plugin ------------------------------------------ */ |
81 | 81 | |
82 | 82 | /** |
83 | - * return some info |
|
84 | - */ |
|
83 | + * return some info |
|
84 | + */ |
|
85 | 85 | function getInfo(){ |
86 | 86 | return array( |
87 | - 'author' => 'Michael Haschke', |
|
88 | - 'email' => '[email protected]', |
|
89 | - 'date' => '2010-05-01', |
|
90 | - 'name' => 'DokuSIOC', |
|
91 | - 'desc' => 'DokuSIOC makes your wiki part of the Semantic Web! It integrates the SIOC ontology within DokuWiki and provides an alternate RDF/XML export of the wiki pages.', |
|
92 | - 'url' => 'http://eye48.com/go/dokusioc' |
|
93 | - ); |
|
87 | + 'author' => 'Michael Haschke', |
|
88 | + 'email' => '[email protected]', |
|
89 | + 'date' => '2010-05-01', |
|
90 | + 'name' => 'DokuSIOC', |
|
91 | + 'desc' => 'DokuSIOC makes your wiki part of the Semantic Web! It integrates the SIOC ontology within DokuWiki and provides an alternate RDF/XML export of the wiki pages.', |
|
92 | + 'url' => 'http://eye48.com/go/dokusioc' |
|
93 | + ); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | /** |
97 | - * Register its handlers with the DokuWiki's event controller |
|
98 | - */ |
|
97 | + * Register its handlers with the DokuWiki's event controller |
|
98 | + */ |
|
99 | 99 | function register(&$controller) |
100 | 100 | { |
101 | 101 | //print_r(headers_list()); die(); |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | } |
161 | 161 | |
162 | 162 | /** |
163 | - */ |
|
163 | + */ |
|
164 | 164 | function createRdfLink(&$event = null, $param = null) |
165 | 165 | { |
166 | 166 | global $ID, $INFO, $conf; |
@@ -514,7 +514,7 @@ discard block |
||
514 | 514 | |
515 | 515 | // create container object |
516 | 516 | $wikicontainer = new SIOCDokuWikiContainer($ID, |
517 | - normalizeUri($exporter->siocURL('container', $ID)) |
|
517 | + normalizeUri($exporter->siocURL('container', $ID)) |
|
518 | 518 | ); |
519 | 519 | |
520 | 520 | /* container is type=wiki */ if ($ID == $conf['start']) $wikicontainer->isWiki(); |
@@ -577,10 +577,10 @@ discard block |
||
577 | 577 | // create user object |
578 | 578 | //print_r($userinfo); die(); |
579 | 579 | $wikiuser = new SIOCDokuWikiUser($ID, |
580 | - normalizeUri($exporter->siocURL('user', $ID)), |
|
581 | - $userid, |
|
582 | - $userinfo['name'], |
|
583 | - $userinfo['mail']); |
|
580 | + normalizeUri($exporter->siocURL('user', $ID)), |
|
581 | + $userid, |
|
582 | + $userinfo['name'], |
|
583 | + $userinfo['mail']); |
|
584 | 584 | /* TODO: avatar (using Gravatar) */ |
585 | 585 | /* TODO: creator_of */ |
586 | 586 | // add user to exporter |
@@ -68,8 +68,8 @@ discard block |
||
68 | 68 | * - proof of concept release under CC-BY-SA |
69 | 69 | **/ |
70 | 70 | |
71 | -if(!defined('DOKU_INC')) die(); |
|
72 | -if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); |
|
71 | +if (!defined('DOKU_INC')) die(); |
|
72 | +if (!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN', DOKU_INC.'lib/plugins/'); |
|
73 | 73 | require_once(DOKU_PLUGIN.'action.php'); |
74 | 74 | |
75 | 75 | class action_plugin_dokusioc extends DokuWiki_Action_Plugin { |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | /** |
83 | 83 | * return some info |
84 | 84 | */ |
85 | - function getInfo(){ |
|
85 | + function getInfo() { |
|
86 | 86 | return array( |
87 | 87 | 'author' => 'Michael Haschke', |
88 | 88 | 'email' => '[email protected]', |
@@ -101,9 +101,9 @@ discard block |
||
101 | 101 | //print_r(headers_list()); die(); |
102 | 102 | |
103 | 103 | // test the requested action |
104 | - $controller->register_hook('ACTION_ACT_PREPROCESS', 'BEFORE', $this, 'checkAction', $controller); |
|
104 | + $controller->register_hook('ACTION_ACT_PREPROCESS', 'BEFORE', $this, 'checkAction', $controller); |
|
105 | 105 | // pingthesemanticweb.com |
106 | - if ($this->getConf('pingsw')) $controller->register_hook('ACTION_SHOW_REDIRECT', 'BEFORE', $this, 'pingService', $controller); |
|
106 | + if ($this->getConf('pingsw')) $controller->register_hook('ACTION_SHOW_REDIRECT', 'BEFORE', $this, 'pingService', $controller); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | /* -- Event handlers ---------------------------------------------------- */ |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | // give back rdf |
120 | 120 | $this->exportSioc(); |
121 | 121 | } |
122 | - elseif (($action->data == 'show' || $action->data == 'index') && $INFO['perm'] && !defined('DOKU_MEDIADETAIL') && ($INFO['exists'] || getDwUserInfo($INFO['id'],$this)) && !isHiddenPage($INFO['id'])) |
|
122 | + elseif (($action->data == 'show' || $action->data == 'index') && $INFO['perm'] && !defined('DOKU_MEDIADETAIL') && ($INFO['exists'] || getDwUserInfo($INFO['id'], $this)) && !isHiddenPage($INFO['id'])) |
|
123 | 123 | { |
124 | 124 | if ($this->isRdfXmlRequest()) |
125 | 125 | { |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | else |
133 | 133 | { |
134 | 134 | // add meta link to html head |
135 | - $controller->register_hook('TPL_METAHEADER_OUTPUT', 'BEFORE', $this, 'createRdfLink'); |
|
135 | + $controller->register_hook('TPL_METAHEADER_OUTPUT', 'BEFORE', $this, 'createRdfLink'); |
|
136 | 136 | } |
137 | 137 | } |
138 | 138 | /* |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | //die('http://pingthesemanticweb.com/rest/?url='.urlencode(getAbsUrl(wl($data->data['id'])))); |
155 | 155 | //$ping = fopen('http://pingthesemanticweb.com/rest/?url='.urlencode(getAbsUrl(wl($data->data['id']))),'r'); |
156 | 156 | // it must be a post, and it's the last revision |
157 | - $ping = @fopen('http://pingthesemanticweb.com/rest/?url='.urlencode(normalizeUri(getAbsUrl(exportlink($data->data['id'], 'siocxml', array('type'=>'post'), false, '&')))),'r'); |
|
157 | + $ping = @fopen('http://pingthesemanticweb.com/rest/?url='.urlencode(normalizeUri(getAbsUrl(exportlink($data->data['id'], 'siocxml', array('type'=>'post'), false, '&')))), 'r'); |
|
158 | 158 | @fclose($ping); |
159 | 159 | } |
160 | 160 | } |
@@ -194,19 +194,19 @@ discard block |
||
194 | 194 | switch ($sioc_type) |
195 | 195 | { |
196 | 196 | case 'container': |
197 | - $title = htmlentities("Container '".(isset($INFO['meta']['title'])?$INFO['meta']['title']:$ID)."' (SIOC document as RDF/XML)"); |
|
197 | + $title = htmlentities("Container '".(isset($INFO['meta']['title']) ? $INFO['meta']['title'] : $ID)."' (SIOC document as RDF/XML)"); |
|
198 | 198 | $queryAttr = array('type'=>'container'); |
199 | 199 | break; |
200 | 200 | |
201 | 201 | case 'user': |
202 | 202 | $title = htmlentities("User account '".$userinfo['name']."' (SIOC document as RDF/XML)"); |
203 | - $queryAttr = array('type'=>'user'); |
|
203 | + $queryAttr = array('type'=>'user'); |
|
204 | 204 | break; |
205 | 205 | |
206 | 206 | case 'post': |
207 | 207 | default: |
208 | 208 | $title = htmlentities("Article '".$INFO['meta']['title']."' (SIOC document as RDF/XML)"); |
209 | - $queryAttr = array('type'=>'post'); |
|
209 | + $queryAttr = array('type'=>'post'); |
|
210 | 210 | if (isset($_GET['rev']) && $_GET['rev'] == intval($_GET['rev'])) |
211 | 211 | $queryAttr['rev'] = $_GET['rev']; |
212 | 212 | break; |
@@ -318,17 +318,17 @@ discard block |
||
318 | 318 | return true; |
319 | 319 | } |
320 | 320 | |
321 | - if (count($accepted)>0) |
|
321 | + if (count($accepted) > 0) |
|
322 | 322 | { |
323 | 323 | // hard check, only serve RDF if it is requested first or equal to first type |
324 | 324 | |
325 | 325 | // extract accepting ratio |
326 | 326 | $test_accept = array(); |
327 | - foreach($accepted as $format) |
|
327 | + foreach ($accepted as $format) |
|
328 | 328 | { |
329 | - $formatspec = explode(';',$format); |
|
329 | + $formatspec = explode(';', $format); |
|
330 | 330 | $k = trim($formatspec[0]); |
331 | - if (count($formatspec)==2) |
|
331 | + if (count($formatspec) == 2) |
|
332 | 332 | { |
333 | 333 | $test_accept[$k] = trim($formatspec[1]); |
334 | 334 | } |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | { |
392 | 392 | global $ID, $INFO, $REV, $conf; |
393 | 393 | |
394 | - $exporter->setParameters('Article: '.$INFO['meta']['title'].($REV?' (rev '.$REV.')':''), |
|
394 | + $exporter->setParameters('Article: '.$INFO['meta']['title'].($REV ? ' (rev '.$REV.')' : ''), |
|
395 | 395 | $this->_getDokuUrl(), |
396 | 396 | $this->_getDokuUrl().'doku.php?', |
397 | 397 | 'utf-8', |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | |
401 | 401 | // create user object |
402 | 402 | // $id, $uri, $name, $email, $homepage='', $foaf_uri='', $role=false, $nick='', $sioc_url='', $foaf_url='' |
403 | - $dwuserpage_id = cleanID($this->getConf('userns')).($conf['useslash']?'/':':').$INFO['editor']; |
|
403 | + $dwuserpage_id = cleanID($this->getConf('userns')).($conf['useslash'] ? '/' : ':').$INFO['editor']; |
|
404 | 404 | /* |
405 | 405 | if ($INFO['editor'] && $this->getConf('userns')) |
406 | 406 | $pageuser = new SIOCUser($INFO['editor'], |
@@ -417,14 +417,14 @@ discard block |
||
417 | 417 | |
418 | 418 | // create wiki page object |
419 | 419 | $wikipage = new SIOCDokuWikiArticle($ID, // id |
420 | - normalizeUri($exporter->siocURL('post', $ID.($REV?$exporter->_urlseparator.'rev'.$exporter->_urlequal.$REV:''))), // url |
|
421 | - $INFO['meta']['title'].($REV?' (rev '.$REV.')':''), // subject |
|
422 | - rawWiki($ID,$REV) // body (content) |
|
420 | + normalizeUri($exporter->siocURL('post', $ID.($REV ? $exporter->_urlseparator.'rev'.$exporter->_urlequal.$REV : ''))), // url |
|
421 | + $INFO['meta']['title'].($REV ? ' (rev '.$REV.')' : ''), // subject |
|
422 | + rawWiki($ID, $REV) // body (content) |
|
423 | 423 | ); |
424 | - /* encoded content */ $wikipage->addContentEncoded(p_cached_output(wikiFN($ID,$REV),'xhtml')); |
|
424 | + /* encoded content */ $wikipage->addContentEncoded(p_cached_output(wikiFN($ID, $REV), 'xhtml')); |
|
425 | 425 | /* created */ if (isset($INFO['meta']['date']['created'])) $wikipage->addCreated(date('c', $INFO['meta']['date']['created'])); |
426 | 426 | /* or modified */ if (isset($INFO['meta']['date']['modified'])) $wikipage->addModified(date('c', $INFO['meta']['date']['modified'])); |
427 | - /* creator/modifier */ if ($INFO['editor'] && $this->getConf('userns')) $wikipage->addCreator(array('foaf:maker'=>'#'.$INFO['editor'],'sioc:modifier'=>$dwuserpage_id)); |
|
427 | + /* creator/modifier */ if ($INFO['editor'] && $this->getConf('userns')) $wikipage->addCreator(array('foaf:maker'=>'#'.$INFO['editor'], 'sioc:modifier'=>$dwuserpage_id)); |
|
428 | 428 | /* is creator */ if (isset($INFO['meta']['date']['created'])) $wikipage->isCreator(); |
429 | 429 | /* intern wiki links */ $wikipage->addLinks($INFO['meta']['relation']['references']); |
430 | 430 | |
@@ -432,8 +432,8 @@ discard block |
||
432 | 432 | if (!$REV && $this->getConf('userns') && isset($INFO['meta']['contributor'])) |
433 | 433 | { |
434 | 434 | $cont_temp = array(); |
435 | - $cont_ns = $this->getConf('userns').($conf['useslash']?'/':':'); |
|
436 | - foreach($INFO['meta']['contributor'] as $cont_id => $cont_name) |
|
435 | + $cont_ns = $this->getConf('userns').($conf['useslash'] ? '/' : ':'); |
|
436 | + foreach ($INFO['meta']['contributor'] as $cont_id => $cont_name) |
|
437 | 437 | $cont_temp[$cont_ns.$cont_id] = $cont_name; |
438 | 438 | $wikipage->addContributors($cont_temp); |
439 | 439 | } |
@@ -450,7 +450,7 @@ discard block |
||
450 | 450 | |
451 | 451 | /* previous and next revision */ |
452 | 452 | $changelog = new PageChangeLog($ID); |
453 | - $pagerevs = $changelog->getRevisions(0,$conf['recent']+1); |
|
453 | + $pagerevs = $changelog->getRevisions(0, $conf['recent'] + 1); |
|
454 | 454 | $prevrev = false; $nextrev = false; |
455 | 455 | if (!$REV) |
456 | 456 | { |
@@ -467,9 +467,9 @@ discard block |
||
467 | 467 | $nextrev = $currentrev - 1; |
468 | 468 | } |
469 | 469 | } |
470 | - if ($prevrev !== false && $prevrev > -1 && page_exists($ID,$pagerevs[$prevrev])) |
|
470 | + if ($prevrev !== false && $prevrev > -1 && page_exists($ID, $pagerevs[$prevrev])) |
|
471 | 471 | /* previous revision*/ $wikipage->addVersionPrevious($pagerevs[$prevrev]); |
472 | - if ($nextrev !== false && $nextrev > -1 && page_exists($ID,$pagerevs[$nextrev])) |
|
472 | + if ($nextrev !== false && $nextrev > -1 && page_exists($ID, $pagerevs[$nextrev])) |
|
473 | 473 | /* next revision*/ $wikipage->addVersionNext($pagerevs[$nextrev]); |
474 | 474 | |
475 | 475 | /* latest revision */ if ($REV) $wikipage->addVersionLatest(); |
@@ -523,11 +523,11 @@ discard block |
||
523 | 523 | |
524 | 524 | // search next level entries (posts, sub containers) in container |
525 | 525 | require_once(DOKU_INC.'inc/search.php'); |
526 | - $dir = utf8_encodeFN(str_replace(':','/',$ID)); |
|
526 | + $dir = utf8_encodeFN(str_replace(':', '/', $ID)); |
|
527 | 527 | $entries = array(); |
528 | 528 | $posts = array(); |
529 | 529 | $containers = array(); |
530 | - search($entries,$conf['datadir'],'search_index',array('ns' => $ID),$dir); |
|
530 | + search($entries, $conf['datadir'], 'search_index', array('ns' => $ID), $dir); |
|
531 | 531 | foreach ($entries as $entry) |
532 | 532 | { |
533 | 533 | if ($entry['type'] === 'f') |
@@ -535,7 +535,7 @@ discard block |
||
535 | 535 | // wikisite |
536 | 536 | $posts[] = $entry; |
537 | 537 | } |
538 | - elseif($entry['type'] === 'd') |
|
538 | + elseif ($entry['type'] === 'd') |
|
539 | 539 | { |
540 | 540 | // sub container |
541 | 541 | $containers[] = $entry; |
@@ -546,8 +546,8 @@ discard block |
||
546 | 546 | if (count($posts) + count($containers) == 0) |
547 | 547 | $this->_exit("HTTP/1.0 404 Not Found"); |
548 | 548 | |
549 | - if (count($posts)>0) $wikicontainer->addArticles($posts); |
|
550 | - if (count($containers)>0) $wikicontainer->addContainers($containers); |
|
549 | + if (count($posts) > 0) $wikicontainer->addArticles($posts); |
|
550 | + if (count($containers) > 0) $wikicontainer->addContainers($containers); |
|
551 | 551 | |
552 | 552 | //print_r($containers);die(); |
553 | 553 | |
@@ -562,7 +562,7 @@ discard block |
||
562 | 562 | global $ID; |
563 | 563 | |
564 | 564 | // get user info |
565 | - $userinfo = getDwUserInfo($ID,$this); |
|
565 | + $userinfo = getDwUserInfo($ID, $this); |
|
566 | 566 | |
567 | 567 | // no userinfo means there is n user space or user does not exists |
568 | 568 | if ($userinfo === false) |
@@ -596,22 +596,22 @@ discard block |
||
596 | 596 | die(); |
597 | 597 | } |
598 | 598 | |
599 | - function _getDokuUrl($url=null) |
|
599 | + function _getDokuUrl($url = null) |
|
600 | 600 | { |
601 | 601 | return getAbsUrl($url); |
602 | 602 | } |
603 | 603 | |
604 | - function _getDate($date, $date_alt=null) |
|
604 | + function _getDate($date, $date_alt = null) |
|
605 | 605 | { |
606 | 606 | if (!$date) $date = $date_alt; |
607 | - return date('c',$date); |
|
607 | + return date('c', $date); |
|
608 | 608 | } |
609 | 609 | |
610 | 610 | } |
611 | 611 | |
612 | 612 | if (!function_exists('getAbsUrl')) |
613 | 613 | { |
614 | - function getAbsUrl($url=null) |
|
614 | + function getAbsUrl($url = null) |
|
615 | 615 | { |
616 | 616 | if ($url == null) $url = DOKU_BASE; |
617 | 617 | return str_replace(DOKU_BASE, DOKU_URL, $url); |
@@ -643,7 +643,7 @@ discard block |
||
643 | 643 | if (!$pobj->getConf('userns')) return false; |
644 | 644 | |
645 | 645 | // get user id |
646 | - $userid = str_replace(cleanID($pobj->getConf('userns')).($conf['useslash']?'/':':'),'',$id); |
|
646 | + $userid = str_replace(cleanID($pobj->getConf('userns')).($conf['useslash'] ? '/' : ':'), '', $id); |
|
647 | 647 | |
648 | 648 | if ($info = $auth->getUserData($userid)) |
649 | 649 | { |
@@ -68,8 +68,12 @@ discard block |
||
68 | 68 | * - proof of concept release under CC-BY-SA |
69 | 69 | **/ |
70 | 70 | |
71 | -if(!defined('DOKU_INC')) die(); |
|
72 | -if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); |
|
71 | +if(!defined('DOKU_INC')) { |
|
72 | + die(); |
|
73 | +} |
|
74 | +if(!defined('DOKU_PLUGIN')) { |
|
75 | + define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); |
|
76 | +} |
|
73 | 77 | require_once(DOKU_PLUGIN.'action.php'); |
74 | 78 | |
75 | 79 | class action_plugin_dokusioc extends DokuWiki_Action_Plugin { |
@@ -103,7 +107,9 @@ discard block |
||
103 | 107 | // test the requested action |
104 | 108 | $controller->register_hook('ACTION_ACT_PREPROCESS', 'BEFORE', $this, 'checkAction', $controller); |
105 | 109 | // pingthesemanticweb.com |
106 | - if ($this->getConf('pingsw')) $controller->register_hook('ACTION_SHOW_REDIRECT', 'BEFORE', $this, 'pingService', $controller); |
|
110 | + if ($this->getConf('pingsw')) { |
|
111 | + $controller->register_hook('ACTION_SHOW_REDIRECT', 'BEFORE', $this, 'pingService', $controller); |
|
112 | + } |
|
107 | 113 | } |
108 | 114 | |
109 | 115 | /* -- Event handlers ---------------------------------------------------- */ |
@@ -118,18 +124,18 @@ discard block |
||
118 | 124 | { |
119 | 125 | // give back rdf |
120 | 126 | $this->exportSioc(); |
121 | - } |
|
122 | - elseif (($action->data == 'show' || $action->data == 'index') && $INFO['perm'] && !defined('DOKU_MEDIADETAIL') && ($INFO['exists'] || getDwUserInfo($INFO['id'],$this)) && !isHiddenPage($INFO['id'])) |
|
127 | + } elseif (($action->data == 'show' || $action->data == 'index') && $INFO['perm'] && !defined('DOKU_MEDIADETAIL') && ($INFO['exists'] || getDwUserInfo($INFO['id'],$this)) && !isHiddenPage($INFO['id'])) |
|
123 | 128 | { |
124 | 129 | if ($this->isRdfXmlRequest()) |
125 | 130 | { |
126 | 131 | // forward to rdfxml document if requested |
127 | 132 | // print_r(headers_list()); die(); |
128 | 133 | $location = $this->createRdfLink(); |
129 | - if (function_exists('header_remove')) header_remove(); |
|
134 | + if (function_exists('header_remove')) { |
|
135 | + header_remove(); |
|
136 | + } |
|
130 | 137 | header('Location: '.$location['href'], true, 303); exit(); |
131 | - } |
|
132 | - else |
|
138 | + } else |
|
133 | 139 | { |
134 | 140 | // add meta link to html head |
135 | 141 | $controller->register_hook('TPL_METAHEADER_OUTPUT', 'BEFORE', $this, 'createRdfLink'); |
@@ -167,8 +173,9 @@ discard block |
||
167 | 173 | |
168 | 174 | // Test for hidden pages |
169 | 175 | |
170 | - if (isHiddenPage($ID)) |
|
171 | - return false; |
|
176 | + if (isHiddenPage($ID)) { |
|
177 | + return false; |
|
178 | + } |
|
172 | 179 | |
173 | 180 | // Get type of SIOC content |
174 | 181 | |
@@ -176,13 +183,16 @@ discard block |
||
176 | 183 | |
177 | 184 | // Test for valid types |
178 | 185 | |
179 | - if (!(($sioc_type == 'post' && $INFO['exists']) || $sioc_type == 'user' || $sioc_type == 'container')) |
|
180 | - return false; |
|
186 | + if (!(($sioc_type == 'post' && $INFO['exists']) || $sioc_type == 'user' || $sioc_type == 'container')) { |
|
187 | + return false; |
|
188 | + } |
|
181 | 189 | |
182 | 190 | // Test for permission |
183 | 191 | |
184 | - if (!$INFO['perm']) // not enough rights to see the wiki page |
|
192 | + if (!$INFO['perm']) { |
|
193 | + // not enough rights to see the wiki page |
|
185 | 194 | return false; |
195 | + } |
|
186 | 196 | |
187 | 197 | $userinfo = getDwUserInfo($ID, $this); |
188 | 198 | |
@@ -207,8 +217,9 @@ discard block |
||
207 | 217 | default: |
208 | 218 | $title = htmlentities("Article '".$INFO['meta']['title']."' (SIOC document as RDF/XML)"); |
209 | 219 | $queryAttr = array('type'=>'post'); |
210 | - if (isset($_GET['rev']) && $_GET['rev'] == intval($_GET['rev'])) |
|
211 | - $queryAttr['rev'] = $_GET['rev']; |
|
220 | + if (isset($_GET['rev']) && $_GET['rev'] == intval($_GET['rev'])) { |
|
221 | + $queryAttr['rev'] = $_GET['rev']; |
|
222 | + } |
|
212 | 223 | break; |
213 | 224 | } |
214 | 225 | |
@@ -220,8 +231,9 @@ discard block |
||
220 | 231 | $event->data['link'][] = $metalink; |
221 | 232 | |
222 | 233 | // set canocial link for type URIs to prevent indexing double content |
223 | - if ($_GET['type']) |
|
224 | - $event->data['link'][] = array('rel'=>'canonical', 'href'=>getAbsUrl(wl($ID))); |
|
234 | + if ($_GET['type']) { |
|
235 | + $event->data['link'][] = array('rel'=>'canonical', 'href'=>getAbsUrl(wl($ID))); |
|
236 | + } |
|
225 | 237 | } |
226 | 238 | |
227 | 239 | return $metalink; |
@@ -235,8 +247,9 @@ discard block |
||
235 | 247 | |
236 | 248 | // Test for hidden pages |
237 | 249 | |
238 | - if (isHiddenPage($ID)) |
|
239 | - $this->_exit("HTTP/1.0 404 Not Found"); |
|
250 | + if (isHiddenPage($ID)) { |
|
251 | + $this->_exit("HTTP/1.0 404 Not Found"); |
|
252 | + } |
|
240 | 253 | |
241 | 254 | // Get type of SIOC content |
242 | 255 | |
@@ -244,16 +257,21 @@ discard block |
||
244 | 257 | |
245 | 258 | // Test for valid types |
246 | 259 | |
247 | - if (!(($sioc_type == 'post' && $INFO['exists']) || $sioc_type == 'user' || $sioc_type == 'container')) |
|
248 | - $this->_exit("HTTP/1.0 404 Not Found"); |
|
260 | + if (!(($sioc_type == 'post' && $INFO['exists']) || $sioc_type == 'user' || $sioc_type == 'container')) { |
|
261 | + $this->_exit("HTTP/1.0 404 Not Found"); |
|
262 | + } |
|
249 | 263 | |
250 | 264 | // Test for permission |
251 | 265 | |
252 | - if (!$INFO['perm']) // not enough rights to see the wiki page |
|
266 | + if (!$INFO['perm']) { |
|
267 | + // not enough rights to see the wiki page |
|
253 | 268 | $this->_exit("HTTP/1.0 401 Unauthorized"); |
269 | + } |
|
254 | 270 | |
255 | 271 | // Forward to URI with explicit type attribut |
256 | - if (!isset($_GET['type'])) header('Location:'.$_SERVER['REQUEST_URI'].'&type='.$sioc_type, true, 302); |
|
272 | + if (!isset($_GET['type'])) { |
|
273 | + header('Location:'.$_SERVER['REQUEST_URI'].'&type='.$sioc_type, true, 302); |
|
274 | + } |
|
257 | 275 | |
258 | 276 | // Include SIOC libs |
259 | 277 | |
@@ -285,8 +303,9 @@ discard block |
||
285 | 303 | } |
286 | 304 | |
287 | 305 | // export |
288 | - if ($this->getConf('noindx')) |
|
289 | - header("X-Robots-Tag: noindex", true); |
|
306 | + if ($this->getConf('noindx')) { |
|
307 | + header("X-Robots-Tag: noindex", true); |
|
308 | + } |
|
290 | 309 | $rdf->export(); |
291 | 310 | |
292 | 311 | //print_r(headers_list()); die(); |
@@ -331,8 +350,7 @@ discard block |
||
331 | 350 | if (count($formatspec)==2) |
332 | 351 | { |
333 | 352 | $test_accept[$k] = trim($formatspec[1]); |
334 | - } |
|
335 | - else |
|
353 | + } else |
|
336 | 354 | { |
337 | 355 | $test_accept[$k] = 'q=1.0'; |
338 | 356 | } |
@@ -367,18 +385,15 @@ discard block |
||
367 | 385 | if ($userinfo) |
368 | 386 | { |
369 | 387 | $type = 'user'; |
370 | - } |
|
371 | - elseif (isset($_GET['do']) && $_GET['do'] == 'index') |
|
388 | + } elseif (isset($_GET['do']) && $_GET['do'] == 'index') |
|
372 | 389 | { |
373 | 390 | $type = 'container'; |
374 | - } |
|
375 | - else |
|
391 | + } else |
|
376 | 392 | { |
377 | 393 | $type = 'post'; |
378 | 394 | } |
379 | 395 | |
380 | - } |
|
381 | - else |
|
396 | + } else |
|
382 | 397 | { |
383 | 398 | $type = $_GET['type']; |
384 | 399 | } |
@@ -422,10 +437,18 @@ discard block |
||
422 | 437 | rawWiki($ID,$REV) // body (content) |
423 | 438 | ); |
424 | 439 | /* encoded content */ $wikipage->addContentEncoded(p_cached_output(wikiFN($ID,$REV),'xhtml')); |
425 | - /* created */ if (isset($INFO['meta']['date']['created'])) $wikipage->addCreated(date('c', $INFO['meta']['date']['created'])); |
|
426 | - /* or modified */ if (isset($INFO['meta']['date']['modified'])) $wikipage->addModified(date('c', $INFO['meta']['date']['modified'])); |
|
427 | - /* creator/modifier */ if ($INFO['editor'] && $this->getConf('userns')) $wikipage->addCreator(array('foaf:maker'=>'#'.$INFO['editor'],'sioc:modifier'=>$dwuserpage_id)); |
|
428 | - /* is creator */ if (isset($INFO['meta']['date']['created'])) $wikipage->isCreator(); |
|
440 | + /* created */ if (isset($INFO['meta']['date']['created'])) { |
|
441 | + $wikipage->addCreated(date('c', $INFO['meta']['date']['created'])); |
|
442 | + } |
|
443 | + /* or modified */ if (isset($INFO['meta']['date']['modified'])) { |
|
444 | + $wikipage->addModified(date('c', $INFO['meta']['date']['modified'])); |
|
445 | + } |
|
446 | + /* creator/modifier */ if ($INFO['editor'] && $this->getConf('userns')) { |
|
447 | + $wikipage->addCreator(array('foaf:maker'=>'#'.$INFO['editor'],'sioc:modifier'=>$dwuserpage_id)); |
|
448 | + } |
|
449 | + /* is creator */ if (isset($INFO['meta']['date']['created'])) { |
|
450 | + $wikipage->isCreator(); |
|
451 | + } |
|
429 | 452 | /* intern wiki links */ $wikipage->addLinks($INFO['meta']['relation']['references']); |
430 | 453 | |
431 | 454 | // contributors - only for last revision b/c of wrong meta data for older revisions |
@@ -433,8 +456,9 @@ discard block |
||
433 | 456 | { |
434 | 457 | $cont_temp = array(); |
435 | 458 | $cont_ns = $this->getConf('userns').($conf['useslash']?'/':':'); |
436 | - foreach($INFO['meta']['contributor'] as $cont_id => $cont_name) |
|
437 | - $cont_temp[$cont_ns.$cont_id] = $cont_name; |
|
459 | + foreach($INFO['meta']['contributor'] as $cont_id => $cont_name) { |
|
460 | + $cont_temp[$cont_ns.$cont_id] = $cont_name; |
|
461 | + } |
|
438 | 462 | $wikipage->addContributors($cont_temp); |
439 | 463 | } |
440 | 464 | |
@@ -443,7 +467,9 @@ discard block |
||
443 | 467 | { |
444 | 468 | require_once(DOKU_INC.'inc/fulltext.php'); |
445 | 469 | $backlinks = ft_backlinks($ID); |
446 | - if (count($backlinks) > 0) $wikipage->addBacklinks($backlinks); |
|
470 | + if (count($backlinks) > 0) { |
|
471 | + $wikipage->addBacklinks($backlinks); |
|
472 | + } |
|
447 | 473 | } |
448 | 474 | |
449 | 475 | // TODO: addLinksExtern |
@@ -456,8 +482,7 @@ discard block |
||
456 | 482 | { |
457 | 483 | // latest revision, previous rev is on top in array |
458 | 484 | $prevrev = 0; |
459 | - } |
|
460 | - else |
|
485 | + } else |
|
461 | 486 | { |
462 | 487 | // other revision |
463 | 488 | $currentrev = array_search($REV, $pagerevs); |
@@ -467,15 +492,23 @@ discard block |
||
467 | 492 | $nextrev = $currentrev - 1; |
468 | 493 | } |
469 | 494 | } |
470 | - if ($prevrev !== false && $prevrev > -1 && page_exists($ID,$pagerevs[$prevrev])) |
|
471 | - /* previous revision*/ $wikipage->addVersionPrevious($pagerevs[$prevrev]); |
|
472 | - if ($nextrev !== false && $nextrev > -1 && page_exists($ID,$pagerevs[$nextrev])) |
|
473 | - /* next revision*/ $wikipage->addVersionNext($pagerevs[$nextrev]); |
|
495 | + if ($prevrev !== false && $prevrev > -1 && page_exists($ID,$pagerevs[$prevrev])) { |
|
496 | + /* previous revision*/ $wikipage->addVersionPrevious($pagerevs[$prevrev]); |
|
497 | + } |
|
498 | + if ($nextrev !== false && $nextrev > -1 && page_exists($ID,$pagerevs[$nextrev])) { |
|
499 | + /* next revision*/ $wikipage->addVersionNext($pagerevs[$nextrev]); |
|
500 | + } |
|
474 | 501 | |
475 | - /* latest revision */ if ($REV) $wikipage->addVersionLatest(); |
|
502 | + /* latest revision */ if ($REV) { |
|
503 | + $wikipage->addVersionLatest(); |
|
504 | + } |
|
476 | 505 | // TODO: topics |
477 | - /* has_container */ if ($INFO['namespace']) $wikipage->addContainer($INFO['namespace']); |
|
478 | - /* has_space */ if ($this->getConf('owners')) $wikipage->addSite($this->getConf('owners')); |
|
506 | + /* has_container */ if ($INFO['namespace']) { |
|
507 | + $wikipage->addContainer($INFO['namespace']); |
|
508 | + } |
|
509 | + /* has_space */ if ($this->getConf('owners')) { |
|
510 | + $wikipage->addSite($this->getConf('owners')); |
|
511 | + } |
|
479 | 512 | // TODO: dc:contributor / has_modifier |
480 | 513 | // TODO: attachment (e.g. pictures in that dwns) |
481 | 514 | |
@@ -494,12 +527,10 @@ discard block |
||
494 | 527 | if ($ID == $conf['start']) |
495 | 528 | { |
496 | 529 | $title = $conf['title']; |
497 | - } |
|
498 | - elseif (isset($INFO['meta']['title'])) |
|
530 | + } elseif (isset($INFO['meta']['title'])) |
|
499 | 531 | { |
500 | 532 | $title = $INFO['meta']['title']; |
501 | - } |
|
502 | - else |
|
533 | + } else |
|
503 | 534 | { |
504 | 535 | $title = $ID; |
505 | 536 | } |
@@ -517,9 +548,15 @@ discard block |
||
517 | 548 | normalizeUri($exporter->siocURL('container', $ID)) |
518 | 549 | ); |
519 | 550 | |
520 | - /* container is type=wiki */ if ($ID == $conf['start']) $wikicontainer->isWiki(); |
|
521 | - /* sioc:name */ if ($INFO['exists']) $wikicontainer->addTitle($INFO['meta']['title']); |
|
522 | - /* has_parent */ if ($INFO['namespace']) $wikicontainer->addParent($INFO['namespace']); |
|
551 | + /* container is type=wiki */ if ($ID == $conf['start']) { |
|
552 | + $wikicontainer->isWiki(); |
|
553 | + } |
|
554 | + /* sioc:name */ if ($INFO['exists']) { |
|
555 | + $wikicontainer->addTitle($INFO['meta']['title']); |
|
556 | + } |
|
557 | + /* has_parent */ if ($INFO['namespace']) { |
|
558 | + $wikicontainer->addParent($INFO['namespace']); |
|
559 | + } |
|
523 | 560 | |
524 | 561 | // search next level entries (posts, sub containers) in container |
525 | 562 | require_once(DOKU_INC.'inc/search.php'); |
@@ -534,8 +571,7 @@ discard block |
||
534 | 571 | { |
535 | 572 | // wikisite |
536 | 573 | $posts[] = $entry; |
537 | - } |
|
538 | - elseif($entry['type'] === 'd') |
|
574 | + } elseif($entry['type'] === 'd') |
|
539 | 575 | { |
540 | 576 | // sub container |
541 | 577 | $containers[] = $entry; |
@@ -543,11 +579,16 @@ discard block |
||
543 | 579 | } |
544 | 580 | |
545 | 581 | // without sub content it can't be a container (so it does not exist as a container) |
546 | - if (count($posts) + count($containers) == 0) |
|
547 | - $this->_exit("HTTP/1.0 404 Not Found"); |
|
582 | + if (count($posts) + count($containers) == 0) { |
|
583 | + $this->_exit("HTTP/1.0 404 Not Found"); |
|
584 | + } |
|
548 | 585 | |
549 | - if (count($posts)>0) $wikicontainer->addArticles($posts); |
|
550 | - if (count($containers)>0) $wikicontainer->addContainers($containers); |
|
586 | + if (count($posts)>0) { |
|
587 | + $wikicontainer->addArticles($posts); |
|
588 | + } |
|
589 | + if (count($containers)>0) { |
|
590 | + $wikicontainer->addContainers($containers); |
|
591 | + } |
|
551 | 592 | |
552 | 593 | //print_r($containers);die(); |
553 | 594 | |
@@ -565,8 +606,9 @@ discard block |
||
565 | 606 | $userinfo = getDwUserInfo($ID,$this); |
566 | 607 | |
567 | 608 | // no userinfo means there is n user space or user does not exists |
568 | - if ($userinfo === false) |
|
569 | - $this->_exit("HTTP/1.0 404 Not Found"); |
|
609 | + if ($userinfo === false) { |
|
610 | + $this->_exit("HTTP/1.0 404 Not Found"); |
|
611 | + } |
|
570 | 612 | |
571 | 613 | $exporter->setParameters('Account: '.$userinfo['name'], |
572 | 614 | getAbsUrl(), |
@@ -603,7 +645,9 @@ discard block |
||
603 | 645 | |
604 | 646 | function _getDate($date, $date_alt=null) |
605 | 647 | { |
606 | - if (!$date) $date = $date_alt; |
|
648 | + if (!$date) { |
|
649 | + $date = $date_alt; |
|
650 | + } |
|
607 | 651 | return date('c',$date); |
608 | 652 | } |
609 | 653 | |
@@ -613,7 +657,9 @@ discard block |
||
613 | 657 | { |
614 | 658 | function getAbsUrl($url=null) |
615 | 659 | { |
616 | - if ($url == null) $url = DOKU_BASE; |
|
660 | + if ($url == null) { |
|
661 | + $url = DOKU_BASE; |
|
662 | + } |
|
617 | 663 | return str_replace(DOKU_BASE, DOKU_URL, $url); |
618 | 664 | } |
619 | 665 | } |
@@ -626,8 +672,7 @@ discard block |
||
626 | 672 | if ($info = $auth->getUserData($user)) |
627 | 673 | { |
628 | 674 | return $info['mail']; |
629 | - } |
|
630 | - else |
|
675 | + } else |
|
631 | 676 | { |
632 | 677 | return false; |
633 | 678 | } |
@@ -640,7 +685,9 @@ discard block |
||
640 | 685 | { |
641 | 686 | global $auth, $conf; |
642 | 687 | |
643 | - if (!$pobj->getConf('userns')) return false; |
|
688 | + if (!$pobj->getConf('userns')) { |
|
689 | + return false; |
|
690 | + } |
|
644 | 691 | |
645 | 692 | // get user id |
646 | 693 | $userid = str_replace(cleanID($pobj->getConf('userns')).($conf['useslash']?'/':':'),'',$id); |
@@ -650,13 +697,11 @@ discard block |
||
650 | 697 | if ($key) |
651 | 698 | { |
652 | 699 | return $info['key']; |
653 | - } |
|
654 | - else |
|
700 | + } else |
|
655 | 701 | { |
656 | 702 | return $info; |
657 | 703 | } |
658 | - } |
|
659 | - else |
|
704 | + } else |
|
660 | 705 | { |
661 | 706 | return false; |
662 | 707 | } |
@@ -678,7 +723,9 @@ discard block |
||
678 | 723 | |
679 | 724 | // test separator |
680 | 725 | $sep = '&'; |
681 | - if (strpos($query, '&') !== false) $sep = '&'; |
|
726 | + if (strpos($query, '&') !== false) { |
|
727 | + $sep = '&'; |
|
728 | + } |
|
682 | 729 | $attr = explode($sep, $query); |
683 | 730 | |
684 | 731 | sort($attr); |
@@ -6,16 +6,16 @@ discard block |
||
6 | 6 | */ |
7 | 7 | |
8 | 8 | // must be run within DokuWiki |
9 | -if(!defined('DOKU_INC')) die(); |
|
9 | +if (!defined('DOKU_INC')) die(); |
|
10 | 10 | |
11 | -if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); |
|
11 | +if (!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN', DOKU_INC.'lib/plugins/'); |
|
12 | 12 | require_once(DOKU_PLUGIN.'syntax.php'); |
13 | 13 | |
14 | 14 | /** |
15 | 15 | */ |
16 | 16 | class syntax_plugin_dokusioc extends DokuWiki_Syntax_Plugin { |
17 | 17 | |
18 | - function getInfo(){ |
|
18 | + function getInfo() { |
|
19 | 19 | return array( |
20 | 20 | 'author' => 'Michael Haschke', |
21 | 21 | 'email' => '[email protected]', |
@@ -28,8 +28,8 @@ discard block |
||
28 | 28 | |
29 | 29 | function getType() { return 'substition'; } |
30 | 30 | function getSort() { return 999; } |
31 | - function connectTo($mode) { $this->Lexer->addSpecialPattern('\[SIOCCOMMENTS\]',$mode,'plugin_dokusioc'); } |
|
32 | - function handle($match, $state, $pos, &$handler){ return array($match, $state, $pos); } |
|
31 | + function connectTo($mode) { $this->Lexer->addSpecialPattern('\[SIOCCOMMENTS\]', $mode, 'plugin_dokusioc'); } |
|
32 | + function handle($match, $state, $pos, &$handler) { return array($match, $state, $pos); } |
|
33 | 33 | function render($mode, &$renderer, $data) { |
34 | 34 | /* |
35 | 35 | if($mode == 'xhtml'){ |
@@ -6,9 +6,13 @@ |
||
6 | 6 | */ |
7 | 7 | |
8 | 8 | // must be run within DokuWiki |
9 | -if(!defined('DOKU_INC')) die(); |
|
9 | +if(!defined('DOKU_INC')) { |
|
10 | + die(); |
|
11 | +} |
|
10 | 12 | |
11 | -if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); |
|
13 | +if(!defined('DOKU_PLUGIN')) { |
|
14 | + define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); |
|
15 | +} |
|
12 | 16 | require_once(DOKU_PLUGIN.'syntax.php'); |
13 | 17 | |
14 | 18 | /** |
@@ -266,7 +266,7 @@ |
||
266 | 266 | $this->_sha1 = sha1("mailto:".$email); |
267 | 267 | } |
268 | 268 | } |
269 | - } |
|
269 | + } |
|
270 | 270 | |
271 | 271 | function getContent( &$exp ) { |
272 | 272 | $rdf = "<sioc:UserAccount rdf:about=\"" . clean($this->_url, true) ."\">\n"; |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | function addCreator($creator) { $this->_creator = $creator; } |
48 | 48 | function addContributors($contributors) { $this->_contributors = $contributors; } |
49 | 49 | function isCreator() { $this->_is_creator = true; } |
50 | - function addLinks($links) { if (is_array($links) && count($links)>0) $this->_links = $links; } |
|
50 | + function addLinks($links) { if (is_array($links) && count($links) > 0) $this->_links = $links; } |
|
51 | 51 | function addBacklinks($links) { $this->_backlinks = $links; } |
52 | 52 | //function addLinksExtern($links) { if (is_array($links) && count($links)>0) $this->_ext_links = $links; } |
53 | 53 | function addVersionPrevious($rev) { $this->_previous_version = $rev; } |
@@ -58,12 +58,12 @@ discard block |
||
58 | 58 | function addSite($url) { $this->_has_space = $url; } |
59 | 59 | |
60 | 60 | |
61 | - function getContent( &$exp ) |
|
61 | + function getContent(&$exp) |
|
62 | 62 | { |
63 | - $rdf = '<'.$this->_type." rdf:about=\"" . clean($this->_url, true) . "\">\n"; |
|
63 | + $rdf = '<'.$this->_type." rdf:about=\"".clean($this->_url, true)."\">\n"; |
|
64 | 64 | if ($this->_subject) |
65 | 65 | { |
66 | - $rdf .= "\t<dc:title>" . clean($this->_subject) . "</dc:title>\n"; |
|
66 | + $rdf .= "\t<dc:title>".clean($this->_subject)."</dc:title>\n"; |
|
67 | 67 | // if(strcmp($this->_has_container, 'http://en.wikipedia.org')===0) |
68 | 68 | // $rdf .= "\t<foaf:primaryTopic rdf:resource=\"".clean('http://dbpedia.org/resource/'.$this->_subject)."\"/>\n"; |
69 | 69 | } |
@@ -72,9 +72,9 @@ discard block |
||
72 | 72 | |
73 | 73 | if (count($this->_contributors) > 0) |
74 | 74 | { |
75 | - foreach($this->_contributors as $cont_id => $cont_name) |
|
75 | + foreach ($this->_contributors as $cont_id => $cont_name) |
|
76 | 76 | { |
77 | - if(!isset($this->_creator['sioc:modifier']) || ($this->_creator['sioc:modifier'] != $cont_id)) |
|
77 | + if (!isset($this->_creator['sioc:modifier']) || ($this->_creator['sioc:modifier'] != $cont_id)) |
|
78 | 78 | $rdf .= "\t<sioc:has_modifier rdf:resource=\"".normalizeUri($exp->siocURL('user', $cont_id))."\" rdfs:label=\"".clean($cont_name)."\"/>\n"; |
79 | 79 | } |
80 | 80 | |
@@ -97,12 +97,12 @@ discard block |
||
97 | 97 | |
98 | 98 | if ($this->_created) |
99 | 99 | { |
100 | - $rdf .= "\t<dcterms:created>" . $this->_created . "</dcterms:created>\n"; |
|
100 | + $rdf .= "\t<dcterms:created>".$this->_created."</dcterms:created>\n"; |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | if ($this->_modified) |
104 | 104 | { |
105 | - $rdf .= "\t<dcterms:modified>" . $this->_modified . "</dcterms:modified>\n"; |
|
105 | + $rdf .= "\t<dcterms:modified>".$this->_modified."</dcterms:modified>\n"; |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | if ($this->_has_space) |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | // TODO: rdfs:label |
112 | 112 | } |
113 | 113 | |
114 | - if($this->_has_container) |
|
114 | + if ($this->_has_container) |
|
115 | 115 | { |
116 | 116 | $rdf .= "\t<sioc:has_container rdf:resource=\"".normalizeUri($exp->siocURL('container', $this->_has_container))."\" />\n"; |
117 | 117 | // TODO: rdfs:label |
@@ -119,12 +119,12 @@ discard block |
||
119 | 119 | |
120 | 120 | if ($this->_content) |
121 | 121 | { |
122 | - $rdf .= "\t<sioc:content><![CDATA[" . pureContent($this->_content) . "]]></sioc:content>\n"; |
|
122 | + $rdf .= "\t<sioc:content><![CDATA[".pureContent($this->_content)."]]></sioc:content>\n"; |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | if ($this->_content_encoded) |
126 | 126 | { |
127 | - $rdf .= "\t<content:encoded><![CDATA[" . $this->_content_encoded . "]]></content:encoded>\n"; |
|
127 | + $rdf .= "\t<content:encoded><![CDATA[".$this->_content_encoded."]]></content:encoded>\n"; |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | /* |
@@ -142,25 +142,25 @@ discard block |
||
142 | 142 | } |
143 | 143 | */ |
144 | 144 | |
145 | - if (is_array($this->_links) && count($this->_links)>0) |
|
145 | + if (is_array($this->_links) && count($this->_links) > 0) |
|
146 | 146 | { |
147 | - foreach($this->_links as $link_id => $link_exists) |
|
147 | + foreach ($this->_links as $link_id => $link_exists) |
|
148 | 148 | { |
149 | 149 | if ($link_exists && !isHiddenPage($link_id)) |
150 | 150 | { |
151 | - $rdf .= "\t<sioc:links_to rdf:resource=\"". normalizeUri($exp->siocURL('post', $link_id)) ."\"/>\n"; |
|
151 | + $rdf .= "\t<sioc:links_to rdf:resource=\"".normalizeUri($exp->siocURL('post', $link_id))."\"/>\n"; |
|
152 | 152 | // TODO: rdfs:label |
153 | 153 | } |
154 | 154 | } |
155 | 155 | } |
156 | 156 | |
157 | - if (count($this->_backlinks)>0) |
|
157 | + if (count($this->_backlinks) > 0) |
|
158 | 158 | { |
159 | - foreach($this->_backlinks as $link_id) |
|
159 | + foreach ($this->_backlinks as $link_id) |
|
160 | 160 | { |
161 | 161 | if (!isHiddenPage($link_id)) |
162 | 162 | { |
163 | - $rdf .= "\t<dcterms:isReferencedBy rdf:resource=\"". normalizeUri($exp->siocURL('post', $link_id)) ."\"/>\n"; |
|
163 | + $rdf .= "\t<dcterms:isReferencedBy rdf:resource=\"".normalizeUri($exp->siocURL('post', $link_id))."\"/>\n"; |
|
164 | 164 | // TODO: rdfs:label |
165 | 165 | } |
166 | 166 | } |
@@ -174,27 +174,27 @@ discard block |
||
174 | 174 | } |
175 | 175 | */ |
176 | 176 | |
177 | - if($this->_previous_version) { |
|
178 | - $rdf .= "\t<sioc:previous_version rdf:resource=\"". normalizeUri($exp->siocURL('post', $this->_id.$exp->_urlseparator.'rev'.$exp->_urlequal.$this->_previous_version)) ."\"/>\n"; |
|
177 | + if ($this->_previous_version) { |
|
178 | + $rdf .= "\t<sioc:previous_version rdf:resource=\"".normalizeUri($exp->siocURL('post', $this->_id.$exp->_urlseparator.'rev'.$exp->_urlequal.$this->_previous_version))."\"/>\n"; |
|
179 | 179 | // TODO: rdfs:label |
180 | 180 | |
181 | 181 | /* If there is support for inference and transitivity the following is not needed */ |
182 | - $rdf .= "\t<sioc:earlier_version rdf:resource=\"". normalizeUri($exp->siocURL('post', $this->_id.$exp->_urlseparator.'rev'.$exp->_urlequal.$this->_previous_version)) ."\"/>\n"; |
|
182 | + $rdf .= "\t<sioc:earlier_version rdf:resource=\"".normalizeUri($exp->siocURL('post', $this->_id.$exp->_urlseparator.'rev'.$exp->_urlequal.$this->_previous_version))."\"/>\n"; |
|
183 | 183 | // TODO: rdfs:label |
184 | 184 | |
185 | 185 | } |
186 | 186 | |
187 | - if($this->_next_version) { |
|
188 | - $rdf .= "\t<sioc:next_version rdf:resource=\"". normalizeUri($exp->siocURL('post', $this->_id.$exp->_urlseparator.'rev'.$exp->_urlequal.$this->_next_version)) ."\"/>\n"; |
|
187 | + if ($this->_next_version) { |
|
188 | + $rdf .= "\t<sioc:next_version rdf:resource=\"".normalizeUri($exp->siocURL('post', $this->_id.$exp->_urlseparator.'rev'.$exp->_urlequal.$this->_next_version))."\"/>\n"; |
|
189 | 189 | // TODO: rdfs:label |
190 | 190 | |
191 | 191 | /* If there is support for inference and transitivity the following is not needed */ |
192 | - $rdf .= "\t<sioc:later_version rdf:resource=\"". normalizeUri($exp->siocURL('post', $this->_id.$exp->_urlseparator.'rev'.$exp->_urlequal.$this->_next_version)) ."\"/>\n"; |
|
192 | + $rdf .= "\t<sioc:later_version rdf:resource=\"".normalizeUri($exp->siocURL('post', $this->_id.$exp->_urlseparator.'rev'.$exp->_urlequal.$this->_next_version))."\"/>\n"; |
|
193 | 193 | // TODO: rdfs:label |
194 | 194 | } |
195 | 195 | |
196 | - if($this->_latest_version) { |
|
197 | - $rdf .= "\t<sioc:latest_version rdf:resource=\"". normalizeUri($exp->siocURL('post', $this->_id)) ."\"/>\n"; |
|
196 | + if ($this->_latest_version) { |
|
197 | + $rdf .= "\t<sioc:latest_version rdf:resource=\"".normalizeUri($exp->siocURL('post', $this->_id))."\"/>\n"; |
|
198 | 198 | // TODO: rdfs:label |
199 | 199 | } |
200 | 200 | |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | } |
223 | 223 | */ |
224 | 224 | |
225 | - $rdf .= "</".$this->_type.">\n"; |
|
225 | + $rdf .= "</".$this->_type.">\n"; |
|
226 | 226 | return $rdf; |
227 | 227 | } |
228 | 228 | } |
@@ -268,25 +268,25 @@ discard block |
||
268 | 268 | } |
269 | 269 | } |
270 | 270 | |
271 | - function getContent( &$exp ) { |
|
272 | - $rdf = "<sioc:UserAccount rdf:about=\"" . clean($this->_url, true) ."\">\n"; |
|
273 | - if($this->_nick) $rdf .= "\t<sioc:name>" . clean($this->_nick) . "</sioc:name>\n"; |
|
274 | - if($this->_email) { |
|
275 | - if ($exp->_export_email) { $rdf .= "\t<sioc:email rdf:resource=\"" . $this->_email ."\"/>\n"; } |
|
276 | - $rdf .= "\t<sioc:email_sha1>" . $this->_sha1 . "</sioc:email_sha1>\n"; |
|
271 | + function getContent(&$exp) { |
|
272 | + $rdf = "<sioc:UserAccount rdf:about=\"".clean($this->_url, true)."\">\n"; |
|
273 | + if ($this->_nick) $rdf .= "\t<sioc:name>".clean($this->_nick)."</sioc:name>\n"; |
|
274 | + if ($this->_email) { |
|
275 | + if ($exp->_export_email) { $rdf .= "\t<sioc:email rdf:resource=\"".$this->_email."\"/>\n"; } |
|
276 | + $rdf .= "\t<sioc:email_sha1>".$this->_sha1."</sioc:email_sha1>\n"; |
|
277 | 277 | } |
278 | - if($this->_role) { |
|
278 | + if ($this->_role) { |
|
279 | 279 | $rdf .= "\t<sioc:has_function>\n"; |
280 | 280 | $rdf .= "\t\t<sioc:Role>\n"; |
281 | - $rdf .= "\t\t\t<sioc:name>" . $this->_role . "</sioc:name>\n"; |
|
281 | + $rdf .= "\t\t\t<sioc:name>".$this->_role."</sioc:name>\n"; |
|
282 | 282 | $rdf .= "\t\t</sioc:Role>\n"; |
283 | 283 | $rdf .= "\t</sioc:has_function>\n"; |
284 | 284 | } |
285 | 285 | $rdf .= "\t<sioc:account_of>\n"; |
286 | 286 | $rdf .= "\t\t<foaf:Person>\n"; |
287 | - if($this->_name) $rdf .= "\t\t\t<foaf:name>". clean($this->_name) . "</foaf:name>\n"; |
|
288 | - if($this->_email) { $rdf .= "\t\t\t<foaf:mbox_sha1sum>" . $this->_sha1 . "</foaf:mbox_sha1sum>\n"; } |
|
289 | - if($this->_foaf_url) { $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"". $this->_foaf_url ."\"/>\n"; } |
|
287 | + if ($this->_name) $rdf .= "\t\t\t<foaf:name>".clean($this->_name)."</foaf:name>\n"; |
|
288 | + if ($this->_email) { $rdf .= "\t\t\t<foaf:mbox_sha1sum>".$this->_sha1."</foaf:mbox_sha1sum>\n"; } |
|
289 | + if ($this->_foaf_url) { $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"".$this->_foaf_url."\"/>\n"; } |
|
290 | 290 | $rdf .= "\t\t</foaf:Person>\n"; |
291 | 291 | $rdf .= "\t</sioc:account_of>\n"; |
292 | 292 | //if($this->_sioc_url) { $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"". $this->_sioc_url ."\"/>\n"; } |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | var $_has_parent = null; |
314 | 314 | var $_title = null; |
315 | 315 | |
316 | - function SIOCDokuWikiContainer ($id, $url) |
|
316 | + function SIOCDokuWikiContainer($id, $url) |
|
317 | 317 | { |
318 | 318 | $this->_id = $id; |
319 | 319 | $this->_url = $url; |
@@ -325,30 +325,30 @@ discard block |
||
325 | 325 | function addTitle($title) { $this->_title = $title; } |
326 | 326 | function addParent($id) { $this->_has_parent = $id; } |
327 | 327 | |
328 | - function getContent( &$exp ) { |
|
329 | - $rdf = '<'.$this->_type." rdf:about=\"" . normalizeUri(clean($this->_url, true)) . "\" >\n"; |
|
328 | + function getContent(&$exp) { |
|
329 | + $rdf = '<'.$this->_type." rdf:about=\"".normalizeUri(clean($this->_url, true))."\" >\n"; |
|
330 | 330 | |
331 | 331 | if ($this->_title) |
332 | 332 | { |
333 | 333 | $rdf .= "\t<sioc:name>".clean($this->_title)."</sioc:name>\n"; |
334 | 334 | } |
335 | 335 | |
336 | - if($this->_has_parent) |
|
336 | + if ($this->_has_parent) |
|
337 | 337 | { |
338 | 338 | $rdf .= "\t<sioc:has_parent rdf:resource=\"".normalizeUri($exp->siocURL('container', $this->_has_parent))."\" />\n"; |
339 | 339 | // TODO: rdfs:label |
340 | 340 | } |
341 | 341 | |
342 | - foreach($this->_posts as $article) |
|
342 | + foreach ($this->_posts as $article) |
|
343 | 343 | { |
344 | 344 | // TODO: test permission before? |
345 | - $rdf .= "\t<sioc:container_of rdf:resource=\"".normalizeUri($exp->siocURL('post',$article['id']))."\"/>\n"; |
|
345 | + $rdf .= "\t<sioc:container_of rdf:resource=\"".normalizeUri($exp->siocURL('post', $article['id']))."\"/>\n"; |
|
346 | 346 | // TODO: inluding title/name |
347 | 347 | } |
348 | 348 | |
349 | - foreach($this->_subcontainers as $container) |
|
349 | + foreach ($this->_subcontainers as $container) |
|
350 | 350 | { |
351 | - $rdf .= "\t<sioc:parent_of rdf:resource=\"".normalizeUri($exp->siocURL('container',$container['id']))."\"/>\n"; |
|
351 | + $rdf .= "\t<sioc:parent_of rdf:resource=\"".normalizeUri($exp->siocURL('container', $container['id']))."\"/>\n"; |
|
352 | 352 | // TODO: inluding title/name |
353 | 353 | } |
354 | 354 |
@@ -47,7 +47,10 @@ discard block |
||
47 | 47 | function addCreator($creator) { $this->_creator = $creator; } |
48 | 48 | function addContributors($contributors) { $this->_contributors = $contributors; } |
49 | 49 | function isCreator() { $this->_is_creator = true; } |
50 | - function addLinks($links) { if (is_array($links) && count($links)>0) $this->_links = $links; } |
|
50 | + function addLinks($links) { if (is_array($links) && count($links)>0) { |
|
51 | + $this->_links = $links; |
|
52 | + } |
|
53 | + } |
|
51 | 54 | function addBacklinks($links) { $this->_backlinks = $links; } |
52 | 55 | //function addLinksExtern($links) { if (is_array($links) && count($links)>0) $this->_ext_links = $links; } |
53 | 56 | function addVersionPrevious($rev) { $this->_previous_version = $rev; } |
@@ -74,8 +77,9 @@ discard block |
||
74 | 77 | { |
75 | 78 | foreach($this->_contributors as $cont_id => $cont_name) |
76 | 79 | { |
77 | - if(!isset($this->_creator['sioc:modifier']) || ($this->_creator['sioc:modifier'] != $cont_id)) |
|
78 | - $rdf .= "\t<sioc:has_modifier rdf:resource=\"".normalizeUri($exp->siocURL('user', $cont_id))."\" rdfs:label=\"".clean($cont_name)."\"/>\n"; |
|
80 | + if(!isset($this->_creator['sioc:modifier']) || ($this->_creator['sioc:modifier'] != $cont_id)) { |
|
81 | + $rdf .= "\t<sioc:has_modifier rdf:resource=\"".normalizeUri($exp->siocURL('user', $cont_id))."\" rdfs:label=\"".clean($cont_name)."\"/>\n"; |
|
82 | + } |
|
79 | 83 | } |
80 | 84 | |
81 | 85 | if (isset($this->_contributors[$this->_creator['sioc:modifier']])) |
@@ -90,8 +94,12 @@ discard block |
||
90 | 94 | // $rdf .= "\t<foaf:maker rdf:resource=\"".clean($this->_creator['foaf:maker'])."\"/>\n"; |
91 | 95 | if ($this->_creator['sioc:modifier']) |
92 | 96 | { |
93 | - if ($this->_is_creator === false) $rdf .= "\t<sioc:has_modifier rdf:resource=\"".normalizeUri($exp->siocURL('user', $this->_creator['sioc:modifier']))."\" $creator_name/>\n"; |
|
94 | - if ($this->_is_creator === true) $rdf .= "\t<sioc:has_creator rdf:resource=\"".normalizeUri($exp->siocURL('user', $this->_creator['sioc:modifier']))."\" $creator_name/>\n"; |
|
97 | + if ($this->_is_creator === false) { |
|
98 | + $rdf .= "\t<sioc:has_modifier rdf:resource=\"".normalizeUri($exp->siocURL('user', $this->_creator['sioc:modifier']))."\" $creator_name/>\n"; |
|
99 | + } |
|
100 | + if ($this->_is_creator === true) { |
|
101 | + $rdf .= "\t<sioc:has_creator rdf:resource=\"".normalizeUri($exp->siocURL('user', $this->_creator['sioc:modifier']))."\" $creator_name/>\n"; |
|
102 | + } |
|
95 | 103 | } |
96 | 104 | } |
97 | 105 | |
@@ -270,7 +278,9 @@ discard block |
||
270 | 278 | |
271 | 279 | function getContent( &$exp ) { |
272 | 280 | $rdf = "<sioc:UserAccount rdf:about=\"" . clean($this->_url, true) ."\">\n"; |
273 | - if($this->_nick) $rdf .= "\t<sioc:name>" . clean($this->_nick) . "</sioc:name>\n"; |
|
281 | + if($this->_nick) { |
|
282 | + $rdf .= "\t<sioc:name>" . clean($this->_nick) . "</sioc:name>\n"; |
|
283 | + } |
|
274 | 284 | if($this->_email) { |
275 | 285 | if ($exp->_export_email) { $rdf .= "\t<sioc:email rdf:resource=\"" . $this->_email ."\"/>\n"; } |
276 | 286 | $rdf .= "\t<sioc:email_sha1>" . $this->_sha1 . "</sioc:email_sha1>\n"; |
@@ -284,7 +294,9 @@ discard block |
||
284 | 294 | } |
285 | 295 | $rdf .= "\t<sioc:account_of>\n"; |
286 | 296 | $rdf .= "\t\t<foaf:Person>\n"; |
287 | - if($this->_name) $rdf .= "\t\t\t<foaf:name>". clean($this->_name) . "</foaf:name>\n"; |
|
297 | + if($this->_name) { |
|
298 | + $rdf .= "\t\t\t<foaf:name>". clean($this->_name) . "</foaf:name>\n"; |
|
299 | + } |
|
288 | 300 | if($this->_email) { $rdf .= "\t\t\t<foaf:mbox_sha1sum>" . $this->_sha1 . "</foaf:mbox_sha1sum>\n"; } |
289 | 301 | if($this->_foaf_url) { $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"". $this->_foaf_url ."\"/>\n"; } |
290 | 302 | $rdf .= "\t\t</foaf:Person>\n"; |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | $this->_sioc_url = $sioc_url; |
79 | 79 | $this->_encoding = $encoding; |
80 | 80 | $this->_generator = $generator; |
81 | - $this->_export_email = $export_email; |
|
81 | + $this->_export_email = $export_email; |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | // Assigns some objects to the exporter |
@@ -86,8 +86,8 @@ discard block |
||
86 | 86 | $this->_objects[] = &$obj; |
87 | 87 | } |
88 | 88 | |
89 | - // TS: Used to replace _url4id in the siocURL for a given type (site, forum, etc.) with a parameter ($name) of your choice |
|
90 | - // E.g. b2evo exporter uses "blog=" instead of "sioc_id=" in the siocURL of a forum |
|
89 | + // TS: Used to replace _url4id in the siocURL for a given type (site, forum, etc.) with a parameter ($name) of your choice |
|
90 | + // E.g. b2evo exporter uses "blog=" instead of "sioc_id=" in the siocURL of a forum |
|
91 | 91 | function setURLTypeParm($type, $name) { |
92 | 92 | $this->_type_table[$type] = $name; |
93 | 93 | } |
@@ -96,27 +96,27 @@ discard block |
||
96 | 96 | $this->_ignore_suffix[$type] = 1; |
97 | 97 | } |
98 | 98 | |
99 | - function siocURL($type, $id, $page=""){ |
|
100 | - $type_part = $this->_url4type .$this->_urlequal . $type ; |
|
99 | + function siocURL($type, $id, $page=""){ |
|
100 | + $type_part = $this->_url4type .$this->_urlequal . $type ; |
|
101 | 101 | |
102 | - if ($id) { |
|
103 | - if ( isset($this->_type_table[$type]) ) |
|
104 | - $myID = $this->_type_table[$type] ; |
|
105 | - else |
|
106 | - $myID = (($this->_url_usetype) ? $type . '_' : '') . $this->_url4id ; |
|
102 | + if ($id) { |
|
103 | + if ( isset($this->_type_table[$type]) ) |
|
104 | + $myID = $this->_type_table[$type] ; |
|
105 | + else |
|
106 | + $myID = (($this->_url_usetype) ? $type . '_' : '') . $this->_url4id ; |
|
107 | 107 | |
108 | - $id_part = $this->_urlseparator . $myID . $this->_urlequal . $id ; |
|
109 | - } else { |
|
110 | - $id_part = ''; |
|
111 | - } |
|
108 | + $id_part = $this->_urlseparator . $myID . $this->_urlequal . $id ; |
|
109 | + } else { |
|
110 | + $id_part = ''; |
|
111 | + } |
|
112 | 112 | |
113 | - ($page) ? $page_part = $this->_urlseparator . $this->_url4page . $this->_urlequal . $page : $page_part='' ; |
|
113 | + ($page) ? $page_part = $this->_urlseparator . $this->_url4page . $this->_urlequal . $page : $page_part='' ; |
|
114 | 114 | |
115 | - ($this->_url_suffix && !isset($this->_ignore_suffix[$type])) ? $suffix = $this->_urlseparator . $this->_url_suffix : $suffix = ''; |
|
115 | + ($this->_url_suffix && !isset($this->_ignore_suffix[$type])) ? $suffix = $this->_urlseparator . $this->_url_suffix : $suffix = ''; |
|
116 | 116 | |
117 | - $siocURL = $this->_sioc_url . $type_part . $id_part . $page_part . $suffix ; |
|
118 | - return clean($siocURL, true); |
|
119 | - } |
|
117 | + $siocURL = $this->_sioc_url . $type_part . $id_part . $page_part . $suffix ; |
|
118 | + return clean($siocURL, true); |
|
119 | + } |
|
120 | 120 | |
121 | 121 | function export( $rdf_content='' ) { |
122 | 122 | header('Content-Type: application/rdf+xml; charset='.$this->_encoding, true, 200); |
@@ -204,10 +204,10 @@ discard block |
||
204 | 204 | $this->_description = $description; |
205 | 205 | $this->_forums = array(); |
206 | 206 | $this->_users = array(); |
207 | - $this->_page = $page; |
|
208 | - $this->_next_users = false; |
|
209 | - $this->_next_forums = false; |
|
210 | - $this->_usergroup_uri = $usergroup_uri; |
|
207 | + $this->_page = $page; |
|
208 | + $this->_next_users = false; |
|
209 | + $this->_next_forums = false; |
|
210 | + $this->_usergroup_uri = $usergroup_uri; |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | function addForum($id, $url) { |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | $this->_users[$id] = $url; |
219 | 219 | } |
220 | 220 | |
221 | - function setNextPageUsers($next) { |
|
221 | + function setNextPageUsers($next) { |
|
222 | 222 | $this->_next_users = $next; |
223 | 223 | } |
224 | 224 | |
@@ -236,14 +236,14 @@ discard block |
||
236 | 236 | $rdf .= "\t<sioc:host_of rdf:resource=\"" . clean($url) . "\"/>\n"; |
237 | 237 | } |
238 | 238 | } |
239 | - if($this->_next_forums) { |
|
239 | + if($this->_next_forums) { |
|
240 | 240 | $rdf .= "\t<rdfs:seeAlso rdf:resource=\"" . $exp->siocURL('site', "", $this->_page+1) ."\"/>\n"; |
241 | 241 | } |
242 | - if($this->_usergroup_uri) { |
|
243 | - $rdf .= "\t<sioc:has_Usergroup rdf:resource=\"" . $this->_usergroup_uri . "\"/>\n"; |
|
244 | - } else { |
|
245 | - $rdf .= "\t<sioc:has_Usergroup rdf:nodeID=\"" . AUTHORS_NODE . "\"/>\n"; |
|
246 | - } |
|
242 | + if($this->_usergroup_uri) { |
|
243 | + $rdf .= "\t<sioc:has_Usergroup rdf:resource=\"" . $this->_usergroup_uri . "\"/>\n"; |
|
244 | + } else { |
|
245 | + $rdf .= "\t<sioc:has_Usergroup rdf:nodeID=\"" . AUTHORS_NODE . "\"/>\n"; |
|
246 | + } |
|
247 | 247 | $rdf .= "</sioc:Site>\n"; |
248 | 248 | // Forums |
249 | 249 | if($this->_forums) { |
@@ -258,11 +258,11 @@ discard block |
||
258 | 258 | // Usergroup |
259 | 259 | if($this->_users) { |
260 | 260 | $rdf .= "\n"; |
261 | - if($this->_usergroup_uri) { |
|
262 | - $rdf .= '<sioc:UserAccountgroup rdf:about="' . $this->_usergroup_uri . "\">\n"; |
|
263 | - } else { |
|
264 | - $rdf .= '<sioc:UserAccountgroup rdf:nodeID="' . AUTHORS_NODE . "\">\n"; |
|
265 | - } |
|
261 | + if($this->_usergroup_uri) { |
|
262 | + $rdf .= '<sioc:UserAccountgroup rdf:about="' . $this->_usergroup_uri . "\">\n"; |
|
263 | + } else { |
|
264 | + $rdf .= '<sioc:UserAccountgroup rdf:nodeID="' . AUTHORS_NODE . "\">\n"; |
|
265 | + } |
|
266 | 266 | $rdf .= "\t<sioc:name>Authors for \"" . clean($this->_name) . "\"</sioc:name>\n"; |
267 | 267 | foreach ($this->_users as $id => $url) { |
268 | 268 | $rdf .= "\t<sioc:has_member>\n"; |
@@ -271,9 +271,9 @@ discard block |
||
271 | 271 | $rdf .= "\t\t</sioc:UserAccount>\n"; |
272 | 272 | $rdf .= "\t</sioc:has_member>\n"; |
273 | 273 | } |
274 | - if($this->_next_users) { |
|
274 | + if($this->_next_users) { |
|
275 | 275 | $rdf .= "\t<rdfs:seeAlso rdf:resource=\"" . $exp->siocURL('site', "", $this->_page+1) ."\"/>\n"; |
276 | - } |
|
276 | + } |
|
277 | 277 | $rdf .= "</sioc:UserAccountgroup>\n"; |
278 | 278 | } |
279 | 279 | |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | $this->_posts[$id] = array("url" => $url, "prev" => $prev, "next" => $next); |
394 | 394 | } |
395 | 395 | |
396 | - // add links to things that are similar to this via sioc:related_to |
|
396 | + // add links to things that are similar to this via sioc:related_to |
|
397 | 397 | function addRelated($id, $url) { |
398 | 398 | $this->_related[$id] = $url; |
399 | 399 | } |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | $this->_next = $next; |
403 | 403 | } |
404 | 404 | |
405 | - function addParentForum($id, $url) { |
|
405 | + function addParentForum($id, $url) { |
|
406 | 406 | $this->_parents[$id] = $url; |
407 | 407 | } |
408 | 408 | |
@@ -411,51 +411,51 @@ discard block |
||
411 | 411 | $rdf .= "\t<sioc:link rdf:resource=\"" . clean($this->_url) . "\"/>\n"; |
412 | 412 | if ($this->_views) $rdf .= "\t<sioc:num_views>" . $this->_views . "</sioc:num_views>\n"; |
413 | 413 | if ($this->_note) $rdf .= "\t<rdfs:comment>" . $this->_note . "</rdfs:comment>\n"; |
414 | - if ($this->_subject) { $rdf .= "\t<dc:title>" . $this->_subject . "</dc:title>\n"; } |
|
414 | + if ($this->_subject) { $rdf .= "\t<dc:title>" . $this->_subject . "</dc:title>\n"; } |
|
415 | 415 | if ($this->_created) { $rdf .= "\t<dcterms:created>" . $this->_created . "</dcterms:created>\n"; } |
416 | 416 | if ($this->_parents) { |
417 | - foreach($this->_parents as $id => $uri) { |
|
418 | - $rdf .= "\t<sioc:has_parent>\n"; |
|
419 | - $rdf .= "\t\t<sioc:Forum rdf:about=\"" .clean($uri) ."\">\n"; |
|
420 | - $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"" . $exp->siocURL('forum', $id) . "\"/>\n"; |
|
421 | - $rdf .= "\t\t</sioc:Forum>\n"; |
|
422 | - $rdf .= "\t</sioc:has_parent>\n"; |
|
423 | - } |
|
424 | - } |
|
425 | - // here the tags are just used as keywords for dc:subject |
|
417 | + foreach($this->_parents as $id => $uri) { |
|
418 | + $rdf .= "\t<sioc:has_parent>\n"; |
|
419 | + $rdf .= "\t\t<sioc:Forum rdf:about=\"" .clean($uri) ."\">\n"; |
|
420 | + $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"" . $exp->siocURL('forum', $id) . "\"/>\n"; |
|
421 | + $rdf .= "\t\t</sioc:Forum>\n"; |
|
422 | + $rdf .= "\t</sioc:has_parent>\n"; |
|
423 | + } |
|
424 | + } |
|
425 | + // here the tags are just used as keywords for dc:subject |
|
426 | 426 | if ($this->_tags) { |
427 | 427 | foreach ($this->_tags as $id => $tag) { |
428 | 428 | $rdf .= "\t<dc:subject>" . $tag . "</dc:subject>\n"; |
429 | 429 | } |
430 | 430 | } |
431 | - // here the tags are used by creating a tag object with a blank node, with the keyword as moat:name - if you use this insert prefixes for moat and tags |
|
432 | - // if ($this->_tags) { |
|
433 | - // $i=1; |
|
431 | + // here the tags are used by creating a tag object with a blank node, with the keyword as moat:name - if you use this insert prefixes for moat and tags |
|
432 | + // if ($this->_tags) { |
|
433 | + // $i=1; |
|
434 | 434 | // foreach ($this->_tags as $id => $tag) { |
435 | - // $rdf .= "\t<tags:taggedWithTag>\n"; |
|
436 | - // $rdf .= "\t\t<moat:tag rdf:nodeID=\"b$i\">\n"; |
|
437 | - // // actually, the best way is to have 'reference URIs' for tags, e.g. URIs for all the platform (http://tags.example.org/tag/soccer |
|
435 | + // $rdf .= "\t<tags:taggedWithTag>\n"; |
|
436 | + // $rdf .= "\t\t<moat:tag rdf:nodeID=\"b$i\">\n"; |
|
437 | + // // actually, the best way is to have 'reference URIs' for tags, e.g. URIs for all the platform (http://tags.example.org/tag/soccer |
|
438 | 438 | // $rdf .= "\t\t\t<moat:name>" . $tag . "</moat:name>\n"; |
439 | - // $rdf .= "\t\t</moat:tag>\n"; |
|
440 | - // $rdf .= "\t</moat:taggedWithTag>\n"; |
|
441 | - // $i++; |
|
439 | + // $rdf .= "\t\t</moat:tag>\n"; |
|
440 | + // $rdf .= "\t</moat:taggedWithTag>\n"; |
|
441 | + // $i++; |
|
442 | 442 | // } |
443 | 443 | // } |
444 | 444 | |
445 | - // here the tags are used are used for sioc:topic, each topic needs to have a URI |
|
446 | - /*if($this->_tags) { |
|
445 | + // here the tags are used are used for sioc:topic, each topic needs to have a URI |
|
446 | + /*if($this->_tags) { |
|
447 | 447 | foreach($this->_tags as $url=>$topic) { |
448 | 448 | $rdf .= "\t<sioc:topic rdfs:label=\"$topic\" rdf:resource=\"" . clean($url) ."\"/>\n"; |
449 | 449 | } |
450 | 450 | } |
451 | 451 | */ |
452 | - if ($this->_related) { |
|
453 | - foreach ($this->_related as $id => $url) { |
|
454 | - $rdf .= "\t<sioc:related_to>\n"; |
|
455 | - $rdf .= "\t\t<sioc:Thread rdf:about=\"" .clean($url) ."\"/>\n"; |
|
456 | - $rdf .= "\t</sioc:related_to>\n"; // todo - each topic needs to have a URI |
|
457 | - } |
|
458 | - } |
|
452 | + if ($this->_related) { |
|
453 | + foreach ($this->_related as $id => $url) { |
|
454 | + $rdf .= "\t<sioc:related_to>\n"; |
|
455 | + $rdf .= "\t\t<sioc:Thread rdf:about=\"" .clean($url) ."\"/>\n"; |
|
456 | + $rdf .= "\t</sioc:related_to>\n"; // todo - each topic needs to have a URI |
|
457 | + } |
|
458 | + } |
|
459 | 459 | |
460 | 460 | if ($this->_posts) { |
461 | 461 | foreach($this->_posts as $id => $data) { |
@@ -510,23 +510,23 @@ discard block |
||
510 | 510 | $this->_next = false; |
511 | 511 | $this->_blog_title = $title; |
512 | 512 | $this->_description = $descr; |
513 | - $this->_threads = array(); |
|
514 | - $this->_parents = array(); |
|
515 | - $this->_type = $type; |
|
516 | - $this->_creator = $creator; |
|
517 | - $this->_administrator = $admin; |
|
518 | - $this->_links = $links; |
|
513 | + $this->_threads = array(); |
|
514 | + $this->_parents = array(); |
|
515 | + $this->_type = $type; |
|
516 | + $this->_creator = $creator; |
|
517 | + $this->_administrator = $admin; |
|
518 | + $this->_links = $links; |
|
519 | 519 | } |
520 | 520 | |
521 | 521 | function addPost($id, $url) { |
522 | 522 | $this->_posts[$id] = $url; |
523 | 523 | } |
524 | 524 | |
525 | - function addThread($id, $url) { |
|
525 | + function addThread($id, $url) { |
|
526 | 526 | $this->_threads[$id] = $url; |
527 | 527 | } |
528 | 528 | |
529 | - function addParentForum($id, $url) { |
|
529 | + function addParentForum($id, $url) { |
|
530 | 530 | $this->_parents[$id] = $url; |
531 | 531 | } |
532 | 532 | |
@@ -536,31 +536,31 @@ discard block |
||
536 | 536 | |
537 | 537 | function getContent( &$exp) { |
538 | 538 | $rdf .= '<'.$this->_type. ' rdf:about="' . clean($this->_url) . "\">\n"; |
539 | - if ($this->_type != 'sioc:Forum') $rdf .= "\t<rdf:type rdf:resource=\"http://rdfs.org/sioc/ns#Forum\" />\n"; |
|
539 | + if ($this->_type != 'sioc:Forum') $rdf .= "\t<rdf:type rdf:resource=\"http://rdfs.org/sioc/ns#Forum\" />\n"; |
|
540 | 540 | $rdf .= "\t<sioc:link rdf:resource=\"" . clean($this->_url) . "\"/>\n"; |
541 | 541 | if ($this->_blog_title) $rdf .= "\t<dc:title>" . $this->_blog_title . "</dc:title>\n"; |
542 | 542 | if ($this->_description) $rdf .= "\t<dc:description>" . $this->_description . "</dc:description>\n"; |
543 | 543 | if ($this->_note) $rdf .= "\t<rdfs:comment>" . $this->_note . "</rdfs:comment>\n"; |
544 | 544 | |
545 | - if ($this->_parents) { |
|
546 | - foreach($this->_parents as $id => $uri) { |
|
547 | - $rdf .= "\t<sioc:has_parent>\n"; |
|
548 | - $rdf .= "\t\t<sioc:Forum rdf:about=\"" .clean($uri) ."\">\n"; |
|
549 | - $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"" . $exp->siocURL('forum', $id) . "\"/>\n"; |
|
550 | - $rdf .= "\t\t</sioc:Forum>\n"; |
|
551 | - $rdf .= "\t</sioc:has_parent>\n"; |
|
545 | + if ($this->_parents) { |
|
546 | + foreach($this->_parents as $id => $uri) { |
|
547 | + $rdf .= "\t<sioc:has_parent>\n"; |
|
548 | + $rdf .= "\t\t<sioc:Forum rdf:about=\"" .clean($uri) ."\">\n"; |
|
549 | + $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"" . $exp->siocURL('forum', $id) . "\"/>\n"; |
|
550 | + $rdf .= "\t\t</sioc:Forum>\n"; |
|
551 | + $rdf .= "\t</sioc:has_parent>\n"; |
|
552 | 552 | } |
553 | - } |
|
553 | + } |
|
554 | 554 | |
555 | - if ($this->_threads) { |
|
556 | - foreach($this->_threads as $id => $uri) { |
|
557 | - $rdf .= "\t<sioc:parent_of>\n"; |
|
558 | - $rdf .= "\t\t<sioc:Thread rdf:about=\"" .clean($uri) ."\">\n"; |
|
559 | - $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"" . $exp->siocURL('thread', $id) . "\"/>\n"; |
|
560 | - $rdf .= "\t\t</sioc:Thread>\n"; |
|
561 | - $rdf .= "\t</sioc:parent_of>\n"; |
|
555 | + if ($this->_threads) { |
|
556 | + foreach($this->_threads as $id => $uri) { |
|
557 | + $rdf .= "\t<sioc:parent_of>\n"; |
|
558 | + $rdf .= "\t\t<sioc:Thread rdf:about=\"" .clean($uri) ."\">\n"; |
|
559 | + $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"" . $exp->siocURL('thread', $id) . "\"/>\n"; |
|
560 | + $rdf .= "\t\t</sioc:Thread>\n"; |
|
561 | + $rdf .= "\t</sioc:parent_of>\n"; |
|
562 | 562 | } |
563 | - } |
|
563 | + } |
|
564 | 564 | |
565 | 565 | if($this->_posts) { |
566 | 566 | foreach($this->_posts as $id => $url) { |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | } |
573 | 573 | } |
574 | 574 | |
575 | - if ($this->_creator) { |
|
575 | + if ($this->_creator) { |
|
576 | 576 | if ($this->_creator->_id) { |
577 | 577 | $rdf .= "\t<sioc:has_creator>\n"; |
578 | 578 | $rdf .= "\t\t<sioc:UserAccount rdf:about=\"" . clean($this->_creator->_uri) ."\">\n"; |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | } |
598 | 598 | } |
599 | 599 | |
600 | - if ($this->_administrator) { |
|
600 | + if ($this->_administrator) { |
|
601 | 601 | if ($this->_administrator->_id) { |
602 | 602 | $rdf .= "\t<sioc:has_administrator>\n"; |
603 | 603 | $rdf .= "\t\t<sioc:UserAccount rdf:about=\"" . clean($this->_administrator->_uri) ."\">\n"; |
@@ -607,7 +607,7 @@ discard block |
||
607 | 607 | $rdf .= "\t</sioc:has_administrator>\n"; |
608 | 608 | } |
609 | 609 | } |
610 | - if ($this->_links) { |
|
610 | + if ($this->_links) { |
|
611 | 611 | foreach($this->_links as $url=>$link) { |
612 | 612 | $rdf .= "\t<sioc:links_to rdfs:label=\"$link\" rdf:resource=\"" . clean($url) ."\"/>\n"; |
613 | 613 | } |
@@ -616,7 +616,7 @@ discard block |
||
616 | 616 | if($this->_next) { |
617 | 617 | $rdf .= "\r<rdfs:seeAlso rdf:resource=\"" . $exp->siocURL('forum', $this->_id, $this->_page+1) ."\"/>\n"; |
618 | 618 | } |
619 | - $rdf .= "</".$this->_type.">"; |
|
619 | + $rdf .= "</".$this->_type.">"; |
|
620 | 620 | |
621 | 621 | return $rdf; |
622 | 622 | } |
@@ -657,8 +657,8 @@ discard block |
||
657 | 657 | $this->_links = $links; |
658 | 658 | $this->_comments = array(); |
659 | 659 | $this->_reply_of = array(); |
660 | - $this->_type = $type; |
|
661 | - $this->_has_part = $has_part; |
|
660 | + $this->_type = $type; |
|
661 | + $this->_has_part = $has_part; |
|
662 | 662 | } |
663 | 663 | |
664 | 664 | function addComment($id, $url) { |
@@ -712,11 +712,11 @@ discard block |
||
712 | 712 | $rdf .= "\t<sioc:links_to rdfs:label=\"$link\" rdf:resource=\"" . clean($url) ."\"/>\n"; |
713 | 713 | } |
714 | 714 | } |
715 | - if($this->_has_part) { |
|
715 | + if($this->_has_part) { |
|
716 | 716 | foreach($this->_has_part as $id=>$url) { |
717 | 717 | $rdf .= "\t<dcterms:hasPart>\n"; |
718 | - $rdf .= "\t\t<dcmitype:Image rdf:about=\"" . clean($url) . "\"/>\n"; |
|
719 | - $rdf .= "\t</dcterms:hasPart>\n"; |
|
718 | + $rdf .= "\t\t<dcmitype:Image rdf:about=\"" . clean($url) . "\"/>\n"; |
|
719 | + $rdf .= "\t</dcterms:hasPart>\n"; |
|
720 | 720 | } |
721 | 721 | } |
722 | 722 | if($this->_reply_of) { |
@@ -779,9 +779,9 @@ discard block |
||
779 | 779 | $this->_topics = $topics; |
780 | 780 | $this->_links = $links; |
781 | 781 | $this->_ext_links = $ext_links; |
782 | - $this->_type = $type; |
|
782 | + $this->_type = $type; |
|
783 | 783 | $this->_previous_version = $prev_vers; |
784 | - $this->_next_version = $next_vers; |
|
784 | + $this->_next_version = $next_vers; |
|
785 | 785 | $this->_latest_version = $latest_vers; |
786 | 786 | $this->_has_discussion = $has_discuss; |
787 | 787 | $this->_has_container = $container; |
@@ -971,7 +971,7 @@ discard block |
||
971 | 971 | |
972 | 972 | function SIOCWiki ($url, $type='sioct:Wiki') { |
973 | 973 | $this->_url = $url; |
974 | - $this->_type = $type; |
|
974 | + $this->_type = $type; |
|
975 | 975 | } |
976 | 976 | |
977 | 977 | function getContent( &$exp ) { |
@@ -992,7 +992,7 @@ discard block |
||
992 | 992 | |
993 | 993 | function SIOCCategory ($url, $type='sioct:Category') { |
994 | 994 | $this->_url = $url; |
995 | - $this->_type = $type; |
|
995 | + $this->_type = $type; |
|
996 | 996 | } |
997 | 997 | |
998 | 998 | function getContent( &$exp ) { |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * @author Fabrizio Orlandi <[email protected]> (addition of SIOCWIki SIOCWikiArticle SIOCCategory) |
12 | 12 | */ |
13 | 13 | |
14 | -define('FORUM_NODE', 'forum'); // TODO: Not used at the moment, remove it? |
|
14 | +define('FORUM_NODE', 'forum'); // TODO: Not used at the moment, remove it? |
|
15 | 15 | define('AUTHORS_NODE', 'authors'); |
16 | 16 | |
17 | 17 | define('EXPORTER_URL', 'http://wiki.sioc-project.org/index.php/PHPExportAPI'); |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | $this->_objects = array(); |
63 | 63 | } |
64 | 64 | |
65 | - function setURLParameters($type='type', $id='id', $page='page', $url_usetype = true, $urlseparator='&', $urlequal='=', $suffix='') { |
|
65 | + function setURLParameters($type = 'type', $id = 'id', $page = 'page', $url_usetype = true, $urlseparator = '&', $urlequal = '=', $suffix = '') { |
|
66 | 66 | $this->_urlseparator = $urlseparator; |
67 | 67 | $this->_urlequal = $urlequal; |
68 | 68 | $this->_url4type = $type; |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | $this->_url_suffix = $suffix; |
73 | 73 | } |
74 | 74 | |
75 | - function setParameters($title, $url, $sioc_url, $encoding, $generator, $export_email=false) { |
|
75 | + function setParameters($title, $url, $sioc_url, $encoding, $generator, $export_email = false) { |
|
76 | 76 | $this->_title = $title; |
77 | 77 | $this->_blog_url = $url; |
78 | 78 | $this->_sioc_url = $sioc_url; |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | } |
83 | 83 | |
84 | 84 | // Assigns some objects to the exporter |
85 | - function addObject( &$obj ) { |
|
85 | + function addObject(&$obj) { |
|
86 | 86 | $this->_objects[] = &$obj; |
87 | 87 | } |
88 | 88 | |
@@ -96,34 +96,34 @@ discard block |
||
96 | 96 | $this->_ignore_suffix[$type] = 1; |
97 | 97 | } |
98 | 98 | |
99 | - function siocURL($type, $id, $page=""){ |
|
100 | - $type_part = $this->_url4type .$this->_urlequal . $type ; |
|
99 | + function siocURL($type, $id, $page = "") { |
|
100 | + $type_part = $this->_url4type.$this->_urlequal.$type; |
|
101 | 101 | |
102 | 102 | if ($id) { |
103 | - if ( isset($this->_type_table[$type]) ) |
|
104 | - $myID = $this->_type_table[$type] ; |
|
103 | + if (isset($this->_type_table[$type])) |
|
104 | + $myID = $this->_type_table[$type]; |
|
105 | 105 | else |
106 | - $myID = (($this->_url_usetype) ? $type . '_' : '') . $this->_url4id ; |
|
106 | + $myID = (($this->_url_usetype) ? $type.'_' : '').$this->_url4id; |
|
107 | 107 | |
108 | - $id_part = $this->_urlseparator . $myID . $this->_urlequal . $id ; |
|
108 | + $id_part = $this->_urlseparator.$myID.$this->_urlequal.$id; |
|
109 | 109 | } else { |
110 | 110 | $id_part = ''; |
111 | 111 | } |
112 | 112 | |
113 | - ($page) ? $page_part = $this->_urlseparator . $this->_url4page . $this->_urlequal . $page : $page_part='' ; |
|
113 | + ($page) ? $page_part = $this->_urlseparator.$this->_url4page.$this->_urlequal.$page : $page_part = ''; |
|
114 | 114 | |
115 | - ($this->_url_suffix && !isset($this->_ignore_suffix[$type])) ? $suffix = $this->_urlseparator . $this->_url_suffix : $suffix = ''; |
|
115 | + ($this->_url_suffix && !isset($this->_ignore_suffix[$type])) ? $suffix = $this->_urlseparator.$this->_url_suffix : $suffix = ''; |
|
116 | 116 | |
117 | - $siocURL = $this->_sioc_url . $type_part . $id_part . $page_part . $suffix ; |
|
117 | + $siocURL = $this->_sioc_url.$type_part.$id_part.$page_part.$suffix; |
|
118 | 118 | return clean($siocURL, true); |
119 | 119 | } |
120 | 120 | |
121 | - function export( $rdf_content='' ) { |
|
121 | + function export($rdf_content = '') { |
|
122 | 122 | header('Content-Type: application/rdf+xml; charset='.$this->_encoding, true, 200); |
123 | 123 | echo $this->makeRDF($rdf_content); |
124 | 124 | } |
125 | 125 | |
126 | - function makeRDF( $rdf_content='' ) { |
|
126 | + function makeRDF($rdf_content = '') { |
|
127 | 127 | $rdf = '<?xml version="1.0" encoding="'.$this->_encoding.'" ?>'."\n"; |
128 | 128 | $rdf .= ' |
129 | 129 | <rdf:RDF |
@@ -141,14 +141,14 @@ discard block |
||
141 | 141 | xmlns:owl="http://www.w3.org/2002/07/owl"> |
142 | 142 | <foaf:Document rdf:about="'.clean($this->_profile_url, true).'"> |
143 | 143 | <dc:title>"'.clean($this->_title).'" (SIOC profile)</dc:title> |
144 | - <foaf:primaryTopic rdf:resource="'.clean($this->_objects[0]->_url,true).'"/> |
|
144 | + <foaf:primaryTopic rdf:resource="'.clean($this->_objects[0]->_url, true).'"/> |
|
145 | 145 | <admin:generatorAgent rdf:resource="'.clean($this->_generator, true).'"/> |
146 | 146 | <admin:generatorAgent rdf:resource="'.clean(EXPORTER_URL, true).'?version='.EXPORTER_VERSION.'"/> |
147 | 147 | </foaf:Document>'."\n"; |
148 | 148 | if ($rdf_content) $rdf .= $rdf_content; |
149 | 149 | if (sizeof($this->_objects)) { |
150 | - foreach($this->_objects as $object) { |
|
151 | - if($object) $rdf .= $object->getContent( $this ); |
|
150 | + foreach ($this->_objects as $object) { |
|
151 | + if ($object) $rdf .= $object->getContent($this); |
|
152 | 152 | } |
153 | 153 | } |
154 | 154 | $rdf .= "\n</rdf:RDF>"; |
@@ -168,8 +168,8 @@ discard block |
||
168 | 168 | $this->_note = $note; |
169 | 169 | } |
170 | 170 | |
171 | - function getContent( &$exp ) { |
|
172 | - $rdf = "<sioc:Object>\n"; |
|
171 | + function getContent(&$exp) { |
|
172 | + $rdf = "<sioc:Object>\n"; |
|
173 | 173 | $rdf .= "\t<rdfs:comment>Generic SIOC Object</rdfs:comment>\n"; |
174 | 174 | $rdf .= "</sioc:Object>\n"; |
175 | 175 | return $rdf; |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | var $_next_forums; |
199 | 199 | var $_usergroup_uri; |
200 | 200 | |
201 | - function SIOCSite($url, $name, $description, $page='', $usergroup_uri='') { |
|
201 | + function SIOCSite($url, $name, $description, $page = '', $usergroup_uri = '') { |
|
202 | 202 | $this->_url = $url; |
203 | 203 | $this->_name = $name; |
204 | 204 | $this->_description = $description; |
@@ -226,53 +226,53 @@ discard block |
||
226 | 226 | $this->_next_forums = $next; |
227 | 227 | } |
228 | 228 | |
229 | - function getContent( &$exp ) { |
|
230 | - $rdf = "<sioc:Site rdf:about=\"" . clean($this->_url) ."\">\n"; |
|
231 | - $rdf .="\t<dc:title>" . clean($this->_name) . "</dc:title>\n"; |
|
232 | - $rdf .= "\t<dc:description>" . clean($this->_description) . "</dc:description>\n"; |
|
233 | - $rdf .= "\t<sioc:link rdf:resource=\"" . clean($this->_url) ."\"/>\n"; |
|
234 | - if($this->_forums) { |
|
229 | + function getContent(&$exp) { |
|
230 | + $rdf = "<sioc:Site rdf:about=\"".clean($this->_url)."\">\n"; |
|
231 | + $rdf .= "\t<dc:title>".clean($this->_name)."</dc:title>\n"; |
|
232 | + $rdf .= "\t<dc:description>".clean($this->_description)."</dc:description>\n"; |
|
233 | + $rdf .= "\t<sioc:link rdf:resource=\"".clean($this->_url)."\"/>\n"; |
|
234 | + if ($this->_forums) { |
|
235 | 235 | foreach ($this->_forums as $id => $url) { |
236 | - $rdf .= "\t<sioc:host_of rdf:resource=\"" . clean($url) . "\"/>\n"; |
|
236 | + $rdf .= "\t<sioc:host_of rdf:resource=\"".clean($url)."\"/>\n"; |
|
237 | 237 | } |
238 | 238 | } |
239 | - if($this->_next_forums) { |
|
240 | - $rdf .= "\t<rdfs:seeAlso rdf:resource=\"" . $exp->siocURL('site', "", $this->_page+1) ."\"/>\n"; |
|
239 | + if ($this->_next_forums) { |
|
240 | + $rdf .= "\t<rdfs:seeAlso rdf:resource=\"".$exp->siocURL('site', "", $this->_page + 1)."\"/>\n"; |
|
241 | 241 | } |
242 | - if($this->_usergroup_uri) { |
|
243 | - $rdf .= "\t<sioc:has_Usergroup rdf:resource=\"" . $this->_usergroup_uri . "\"/>\n"; |
|
242 | + if ($this->_usergroup_uri) { |
|
243 | + $rdf .= "\t<sioc:has_Usergroup rdf:resource=\"".$this->_usergroup_uri."\"/>\n"; |
|
244 | 244 | } else { |
245 | - $rdf .= "\t<sioc:has_Usergroup rdf:nodeID=\"" . AUTHORS_NODE . "\"/>\n"; |
|
245 | + $rdf .= "\t<sioc:has_Usergroup rdf:nodeID=\"".AUTHORS_NODE."\"/>\n"; |
|
246 | 246 | } |
247 | 247 | $rdf .= "</sioc:Site>\n"; |
248 | 248 | // Forums |
249 | - if($this->_forums) { |
|
249 | + if ($this->_forums) { |
|
250 | 250 | $rdf .= "\n"; |
251 | 251 | foreach ($this->_forums as $id => $url) { |
252 | - $rdf .= '<sioc:Forum rdf:about="' . clean($url) ."\">\n"; |
|
253 | - $rdf .= "\t<sioc:link rdf:resource=\"" . clean($url) . "\"/>\n"; |
|
254 | - $rdf .= "\t<rdfs:seeAlso rdf:resource=\"" . $exp->siocURL('forum', $id) ."\"/>\n"; |
|
252 | + $rdf .= '<sioc:Forum rdf:about="'.clean($url)."\">\n"; |
|
253 | + $rdf .= "\t<sioc:link rdf:resource=\"".clean($url)."\"/>\n"; |
|
254 | + $rdf .= "\t<rdfs:seeAlso rdf:resource=\"".$exp->siocURL('forum', $id)."\"/>\n"; |
|
255 | 255 | $rdf .= "</sioc:Forum>\n"; |
256 | 256 | } |
257 | 257 | } |
258 | 258 | // Usergroup |
259 | - if($this->_users) { |
|
259 | + if ($this->_users) { |
|
260 | 260 | $rdf .= "\n"; |
261 | - if($this->_usergroup_uri) { |
|
262 | - $rdf .= '<sioc:UserAccountgroup rdf:about="' . $this->_usergroup_uri . "\">\n"; |
|
261 | + if ($this->_usergroup_uri) { |
|
262 | + $rdf .= '<sioc:UserAccountgroup rdf:about="'.$this->_usergroup_uri."\">\n"; |
|
263 | 263 | } else { |
264 | - $rdf .= '<sioc:UserAccountgroup rdf:nodeID="' . AUTHORS_NODE . "\">\n"; |
|
264 | + $rdf .= '<sioc:UserAccountgroup rdf:nodeID="'.AUTHORS_NODE."\">\n"; |
|
265 | 265 | } |
266 | - $rdf .= "\t<sioc:name>Authors for \"" . clean($this->_name) . "\"</sioc:name>\n"; |
|
266 | + $rdf .= "\t<sioc:name>Authors for \"".clean($this->_name)."\"</sioc:name>\n"; |
|
267 | 267 | foreach ($this->_users as $id => $url) { |
268 | 268 | $rdf .= "\t<sioc:has_member>\n"; |
269 | - $rdf .= "\t\t<sioc:UserAccount rdf:about=\"" . clean($url) ."\">\n"; |
|
270 | - $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"" . $exp->siocURL('user', $id). "\"/>\n"; |
|
269 | + $rdf .= "\t\t<sioc:UserAccount rdf:about=\"".clean($url)."\">\n"; |
|
270 | + $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"".$exp->siocURL('user', $id)."\"/>\n"; |
|
271 | 271 | $rdf .= "\t\t</sioc:UserAccount>\n"; |
272 | 272 | $rdf .= "\t</sioc:has_member>\n"; |
273 | 273 | } |
274 | - if($this->_next_users) { |
|
275 | - $rdf .= "\t<rdfs:seeAlso rdf:resource=\"" . $exp->siocURL('site', "", $this->_page+1) ."\"/>\n"; |
|
274 | + if ($this->_next_users) { |
|
275 | + $rdf .= "\t<rdfs:seeAlso rdf:resource=\"".$exp->siocURL('site', "", $this->_page + 1)."\"/>\n"; |
|
276 | 276 | } |
277 | 277 | $rdf .= "</sioc:UserAccountgroup>\n"; |
278 | 278 | } |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | var $_sioc_url; |
304 | 304 | var $_foaf_url; |
305 | 305 | |
306 | - function SIOCUser($id, $uri, $name, $email, $homepage='', $foaf_uri='', $role=false, $nick='', $sioc_url='', $foaf_url='') { |
|
306 | + function SIOCUser($id, $uri, $name, $email, $homepage = '', $foaf_uri = '', $role = false, $nick = '', $sioc_url = '', $foaf_url = '') { |
|
307 | 307 | $this->_id = $id; |
308 | 308 | $this->_uri = $uri; |
309 | 309 | $this->_name = $name; |
@@ -326,26 +326,26 @@ discard block |
||
326 | 326 | $this->_sioc_url = $sioc_url; |
327 | 327 | } |
328 | 328 | |
329 | - function getContent( &$exp ) { |
|
330 | - $rdf = "<foaf:Person rdf:about=\"" . clean($this->_foaf_uri) . "\">\n"; |
|
331 | - if($this->_name) $rdf .= "\t<foaf:name>". $this->_name . "</foaf:name>\n"; |
|
332 | - if($this->_email) { $rdf .= "\t<foaf:mbox_sha1sum>" . $this->_sha1 . "</foaf:mbox_sha1sum>\n"; } |
|
333 | - if($this->_foaf_url) { $rdf .= "\t<rdfs:seeAlso rdf:resource=\"". $this->_foaf_url ."\"/>\n"; } |
|
329 | + function getContent(&$exp) { |
|
330 | + $rdf = "<foaf:Person rdf:about=\"".clean($this->_foaf_uri)."\">\n"; |
|
331 | + if ($this->_name) $rdf .= "\t<foaf:name>".$this->_name."</foaf:name>\n"; |
|
332 | + if ($this->_email) { $rdf .= "\t<foaf:mbox_sha1sum>".$this->_sha1."</foaf:mbox_sha1sum>\n"; } |
|
333 | + if ($this->_foaf_url) { $rdf .= "\t<rdfs:seeAlso rdf:resource=\"".$this->_foaf_url."\"/>\n"; } |
|
334 | 334 | $rdf .= "\t<foaf:holdsAccount>\n"; |
335 | - $rdf .= "\t\t<sioc:UserAccount rdf:about=\"" . clean($this->_uri) ."\">\n"; |
|
336 | - if($this->_nick) $rdf .= "\t\t\t<sioc:name>" . $this->_nick . "</sioc:name>\n"; |
|
337 | - if($this->_email) { |
|
338 | - if ($exp->_export_email) { $rdf .= "\t\t\t<sioc:email rdf:resource=\"" . $this->_email ."\"/>\n"; } |
|
339 | - $rdf .= "\t\t\t<sioc:email_sha1>" . $this->_sha1 . "</sioc:email_sha1>\n"; |
|
335 | + $rdf .= "\t\t<sioc:UserAccount rdf:about=\"".clean($this->_uri)."\">\n"; |
|
336 | + if ($this->_nick) $rdf .= "\t\t\t<sioc:name>".$this->_nick."</sioc:name>\n"; |
|
337 | + if ($this->_email) { |
|
338 | + if ($exp->_export_email) { $rdf .= "\t\t\t<sioc:email rdf:resource=\"".$this->_email."\"/>\n"; } |
|
339 | + $rdf .= "\t\t\t<sioc:email_sha1>".$this->_sha1."</sioc:email_sha1>\n"; |
|
340 | 340 | } |
341 | - if($this->_role) { |
|
341 | + if ($this->_role) { |
|
342 | 342 | $rdf .= "\t\t\t<sioc:has_function>\n"; |
343 | 343 | $rdf .= "\t\t\t\t<sioc:Role>\n"; |
344 | - $rdf .= "\t\t\t\t\t<sioc:name>" . $this->_role . "</sioc:name>\n"; |
|
344 | + $rdf .= "\t\t\t\t\t<sioc:name>".$this->_role."</sioc:name>\n"; |
|
345 | 345 | $rdf .= "\t\t\t\t</sioc:Role>\n"; |
346 | 346 | $rdf .= "\t\t\t</sioc:has_function>\n"; |
347 | 347 | } |
348 | - if($this->_sioc_url) { $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"". $this->_sioc_url ."\"/>\n"; } |
|
348 | + if ($this->_sioc_url) { $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"".$this->_sioc_url."\"/>\n"; } |
|
349 | 349 | $rdf .= "\t\t</sioc:UserAccount>\n"; |
350 | 350 | $rdf .= "\t</foaf:holdsAccount>\n"; |
351 | 351 | $rdf .= "</foaf:Person>\n"; |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | var $_created; |
377 | 377 | var $_parents; |
378 | 378 | |
379 | - function SIOCThread($id, $url, $page, $views='', $tags=array(), $subject='', $created='' ) { |
|
379 | + function SIOCThread($id, $url, $page, $views = '', $tags = array(), $subject = '', $created = '') { |
|
380 | 380 | $this->_id = $id; |
381 | 381 | $this->_url = $url; |
382 | 382 | $this->_page = $page; |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | $this->_created = $created; |
390 | 390 | } |
391 | 391 | |
392 | - function addPost($id, $url, $prev='', $next='') { |
|
392 | + function addPost($id, $url, $prev = '', $next = '') { |
|
393 | 393 | $this->_posts[$id] = array("url" => $url, "prev" => $prev, "next" => $next); |
394 | 394 | } |
395 | 395 | |
@@ -406,18 +406,18 @@ discard block |
||
406 | 406 | $this->_parents[$id] = $url; |
407 | 407 | } |
408 | 408 | |
409 | - function getContent( &$exp) { |
|
410 | - $rdf .= '<sioc:Thread rdf:about="' . clean($this->_url) . "\">\n"; |
|
411 | - $rdf .= "\t<sioc:link rdf:resource=\"" . clean($this->_url) . "\"/>\n"; |
|
412 | - if ($this->_views) $rdf .= "\t<sioc:num_views>" . $this->_views . "</sioc:num_views>\n"; |
|
413 | - if ($this->_note) $rdf .= "\t<rdfs:comment>" . $this->_note . "</rdfs:comment>\n"; |
|
414 | - if ($this->_subject) { $rdf .= "\t<dc:title>" . $this->_subject . "</dc:title>\n"; } |
|
415 | - if ($this->_created) { $rdf .= "\t<dcterms:created>" . $this->_created . "</dcterms:created>\n"; } |
|
409 | + function getContent(&$exp) { |
|
410 | + $rdf .= '<sioc:Thread rdf:about="'.clean($this->_url)."\">\n"; |
|
411 | + $rdf .= "\t<sioc:link rdf:resource=\"".clean($this->_url)."\"/>\n"; |
|
412 | + if ($this->_views) $rdf .= "\t<sioc:num_views>".$this->_views."</sioc:num_views>\n"; |
|
413 | + if ($this->_note) $rdf .= "\t<rdfs:comment>".$this->_note."</rdfs:comment>\n"; |
|
414 | + if ($this->_subject) { $rdf .= "\t<dc:title>".$this->_subject."</dc:title>\n"; } |
|
415 | + if ($this->_created) { $rdf .= "\t<dcterms:created>".$this->_created."</dcterms:created>\n"; } |
|
416 | 416 | if ($this->_parents) { |
417 | - foreach($this->_parents as $id => $uri) { |
|
417 | + foreach ($this->_parents as $id => $uri) { |
|
418 | 418 | $rdf .= "\t<sioc:has_parent>\n"; |
419 | - $rdf .= "\t\t<sioc:Forum rdf:about=\"" .clean($uri) ."\">\n"; |
|
420 | - $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"" . $exp->siocURL('forum', $id) . "\"/>\n"; |
|
419 | + $rdf .= "\t\t<sioc:Forum rdf:about=\"".clean($uri)."\">\n"; |
|
420 | + $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"".$exp->siocURL('forum', $id)."\"/>\n"; |
|
421 | 421 | $rdf .= "\t\t</sioc:Forum>\n"; |
422 | 422 | $rdf .= "\t</sioc:has_parent>\n"; |
423 | 423 | } |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | // here the tags are just used as keywords for dc:subject |
426 | 426 | if ($this->_tags) { |
427 | 427 | foreach ($this->_tags as $id => $tag) { |
428 | - $rdf .= "\t<dc:subject>" . $tag . "</dc:subject>\n"; |
|
428 | + $rdf .= "\t<dc:subject>".$tag."</dc:subject>\n"; |
|
429 | 429 | } |
430 | 430 | } |
431 | 431 | // here the tags are used by creating a tag object with a blank node, with the keyword as moat:name - if you use this insert prefixes for moat and tags |
@@ -452,24 +452,24 @@ discard block |
||
452 | 452 | if ($this->_related) { |
453 | 453 | foreach ($this->_related as $id => $url) { |
454 | 454 | $rdf .= "\t<sioc:related_to>\n"; |
455 | - $rdf .= "\t\t<sioc:Thread rdf:about=\"" .clean($url) ."\"/>\n"; |
|
455 | + $rdf .= "\t\t<sioc:Thread rdf:about=\"".clean($url)."\"/>\n"; |
|
456 | 456 | $rdf .= "\t</sioc:related_to>\n"; // todo - each topic needs to have a URI |
457 | 457 | } |
458 | 458 | } |
459 | 459 | |
460 | 460 | if ($this->_posts) { |
461 | - foreach($this->_posts as $id => $data) { |
|
461 | + foreach ($this->_posts as $id => $data) { |
|
462 | 462 | $rdf .= "\t<sioc:container_of>\n"; |
463 | - $rdf .= "\t\t<sioc:Post rdf:about=\"" .clean($data[url]) ."\">\n"; |
|
464 | - $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"" . $exp->siocURL('post', $id) . "\"/>\n"; |
|
465 | - if ($data[prev]) { $rdf .= "\t\t\t<sioc:previous_by_date rdf:resource=\"" . clean($data[prev]) . "\"/>\n"; } |
|
466 | - if ($data[next]) { $rdf .= "\t\t\t<sioc:next_by_date rdf:resource=\"" . clean($data[next]) . "\"/>\n"; } |
|
463 | + $rdf .= "\t\t<sioc:Post rdf:about=\"".clean($data[url])."\">\n"; |
|
464 | + $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"".$exp->siocURL('post', $id)."\"/>\n"; |
|
465 | + if ($data[prev]) { $rdf .= "\t\t\t<sioc:previous_by_date rdf:resource=\"".clean($data[prev])."\"/>\n"; } |
|
466 | + if ($data[next]) { $rdf .= "\t\t\t<sioc:next_by_date rdf:resource=\"".clean($data[next])."\"/>\n"; } |
|
467 | 467 | $rdf .= "\t\t</sioc:Post>\n"; |
468 | 468 | $rdf .= "\t</sioc:container_of>\n"; |
469 | 469 | } |
470 | 470 | } |
471 | - if($this->_next) { |
|
472 | - $rdf .= "\r<rdfs:seeAlso rdf:resource=\"" . $exp->siocURL('thread', $this->_id, $this->_page+1) ."\"/>\n"; |
|
471 | + if ($this->_next) { |
|
472 | + $rdf .= "\r<rdfs:seeAlso rdf:resource=\"".$exp->siocURL('thread', $this->_id, $this->_page + 1)."\"/>\n"; |
|
473 | 473 | } |
474 | 474 | $rdf .= "</sioc:Thread>\n"; |
475 | 475 | return $rdf; |
@@ -502,7 +502,7 @@ discard block |
||
502 | 502 | var $_creator; |
503 | 503 | var $_administrator; |
504 | 504 | |
505 | - function SIOCForum($id, $url, $page, $title='', $descr='', $type='sioc:Forum', $creator='', $admin='', $links=array() ) { |
|
505 | + function SIOCForum($id, $url, $page, $title = '', $descr = '', $type = 'sioc:Forum', $creator = '', $admin = '', $links = array()) { |
|
506 | 506 | $this->_id = $id; |
507 | 507 | $this->_url = $url; |
508 | 508 | $this->_page = $page; |
@@ -534,39 +534,39 @@ discard block |
||
534 | 534 | $this->_next = $next; |
535 | 535 | } |
536 | 536 | |
537 | - function getContent( &$exp) { |
|
538 | - $rdf .= '<'.$this->_type. ' rdf:about="' . clean($this->_url) . "\">\n"; |
|
537 | + function getContent(&$exp) { |
|
538 | + $rdf .= '<'.$this->_type.' rdf:about="'.clean($this->_url)."\">\n"; |
|
539 | 539 | if ($this->_type != 'sioc:Forum') $rdf .= "\t<rdf:type rdf:resource=\"http://rdfs.org/sioc/ns#Forum\" />\n"; |
540 | - $rdf .= "\t<sioc:link rdf:resource=\"" . clean($this->_url) . "\"/>\n"; |
|
541 | - if ($this->_blog_title) $rdf .= "\t<dc:title>" . $this->_blog_title . "</dc:title>\n"; |
|
542 | - if ($this->_description) $rdf .= "\t<dc:description>" . $this->_description . "</dc:description>\n"; |
|
543 | - if ($this->_note) $rdf .= "\t<rdfs:comment>" . $this->_note . "</rdfs:comment>\n"; |
|
540 | + $rdf .= "\t<sioc:link rdf:resource=\"".clean($this->_url)."\"/>\n"; |
|
541 | + if ($this->_blog_title) $rdf .= "\t<dc:title>".$this->_blog_title."</dc:title>\n"; |
|
542 | + if ($this->_description) $rdf .= "\t<dc:description>".$this->_description."</dc:description>\n"; |
|
543 | + if ($this->_note) $rdf .= "\t<rdfs:comment>".$this->_note."</rdfs:comment>\n"; |
|
544 | 544 | |
545 | 545 | if ($this->_parents) { |
546 | - foreach($this->_parents as $id => $uri) { |
|
546 | + foreach ($this->_parents as $id => $uri) { |
|
547 | 547 | $rdf .= "\t<sioc:has_parent>\n"; |
548 | - $rdf .= "\t\t<sioc:Forum rdf:about=\"" .clean($uri) ."\">\n"; |
|
549 | - $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"" . $exp->siocURL('forum', $id) . "\"/>\n"; |
|
548 | + $rdf .= "\t\t<sioc:Forum rdf:about=\"".clean($uri)."\">\n"; |
|
549 | + $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"".$exp->siocURL('forum', $id)."\"/>\n"; |
|
550 | 550 | $rdf .= "\t\t</sioc:Forum>\n"; |
551 | 551 | $rdf .= "\t</sioc:has_parent>\n"; |
552 | 552 | } |
553 | 553 | } |
554 | 554 | |
555 | 555 | if ($this->_threads) { |
556 | - foreach($this->_threads as $id => $uri) { |
|
556 | + foreach ($this->_threads as $id => $uri) { |
|
557 | 557 | $rdf .= "\t<sioc:parent_of>\n"; |
558 | - $rdf .= "\t\t<sioc:Thread rdf:about=\"" .clean($uri) ."\">\n"; |
|
559 | - $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"" . $exp->siocURL('thread', $id) . "\"/>\n"; |
|
558 | + $rdf .= "\t\t<sioc:Thread rdf:about=\"".clean($uri)."\">\n"; |
|
559 | + $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"".$exp->siocURL('thread', $id)."\"/>\n"; |
|
560 | 560 | $rdf .= "\t\t</sioc:Thread>\n"; |
561 | 561 | $rdf .= "\t</sioc:parent_of>\n"; |
562 | 562 | } |
563 | 563 | } |
564 | 564 | |
565 | - if($this->_posts) { |
|
566 | - foreach($this->_posts as $id => $url) { |
|
565 | + if ($this->_posts) { |
|
566 | + foreach ($this->_posts as $id => $url) { |
|
567 | 567 | $rdf .= "\t<sioc:container_of>\n"; |
568 | - $rdf .= "\t\t<sioc:Post rdf:about=\"" .clean($url) ."\">\n"; |
|
569 | - $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"" . $exp->siocURL('post', $id) . "\"/>\n"; |
|
568 | + $rdf .= "\t\t<sioc:Post rdf:about=\"".clean($url)."\">\n"; |
|
569 | + $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"".$exp->siocURL('post', $id)."\"/>\n"; |
|
570 | 570 | $rdf .= "\t\t</sioc:Post>\n"; |
571 | 571 | $rdf .= "\t</sioc:container_of>\n"; |
572 | 572 | } |
@@ -575,23 +575,23 @@ discard block |
||
575 | 575 | if ($this->_creator) { |
576 | 576 | if ($this->_creator->_id) { |
577 | 577 | $rdf .= "\t<sioc:has_creator>\n"; |
578 | - $rdf .= "\t\t<sioc:UserAccount rdf:about=\"" . clean($this->_creator->_uri) ."\">\n"; |
|
579 | - if($this->_creator->_sioc_url) { $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"". $this->_creator->_sioc_url ."\"/>\n"; } |
|
580 | - else $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"" . $exp->siocURL('user', $this->_creator->_id). "\"/>\n"; |
|
578 | + $rdf .= "\t\t<sioc:UserAccount rdf:about=\"".clean($this->_creator->_uri)."\">\n"; |
|
579 | + if ($this->_creator->_sioc_url) { $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"".$this->_creator->_sioc_url."\"/>\n"; } |
|
580 | + else $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"".$exp->siocURL('user', $this->_creator->_id)."\"/>\n"; |
|
581 | 581 | $rdf .= "\t\t</sioc:UserAccount>\n"; |
582 | 582 | $rdf .= "\t</sioc:has_creator>\n"; |
583 | 583 | $rdf .= "\t<foaf:maker>\n"; |
584 | - $rdf .= "\t\t<foaf:Person rdf:about=\"" . clean($this->_creator->_foaf_uri) ."\">\n"; |
|
585 | - if($this->_creator->_foaf_url) { $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"". $this->_creator->_foaf_url ."\"/>\n"; } |
|
586 | - else $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"" . $exp->siocURL('user', $this->_creator->_id). "\"/>\n"; |
|
584 | + $rdf .= "\t\t<foaf:Person rdf:about=\"".clean($this->_creator->_foaf_uri)."\">\n"; |
|
585 | + if ($this->_creator->_foaf_url) { $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"".$this->_creator->_foaf_url."\"/>\n"; } |
|
586 | + else $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"".$exp->siocURL('user', $this->_creator->_id)."\"/>\n"; |
|
587 | 587 | $rdf .= "\t\t</foaf:Person>\n"; |
588 | 588 | $rdf .= "\t</foaf:maker>\n"; |
589 | 589 | } else { |
590 | 590 | $rdf .= "\t<foaf:maker>\n"; |
591 | 591 | $rdf .= "\t\t<foaf:Person"; |
592 | - if($this->_creator->_name) $rdf .= " foaf:name=\"" . $this->_creator->_name ."\""; |
|
593 | - if($this->_creator->_sha1) $rdf .= " foaf:mbox_sha1sum=\"" . $this->_creator->_sha1 ."\""; |
|
594 | - if($this->_creator->_name) $rdf .= ">\n\t\t\t<foaf:homepage rdf:resource=\"" . $this->_creator->_homepage ."\"/>\n\t\t</foaf:Person>\n"; |
|
592 | + if ($this->_creator->_name) $rdf .= " foaf:name=\"".$this->_creator->_name."\""; |
|
593 | + if ($this->_creator->_sha1) $rdf .= " foaf:mbox_sha1sum=\"".$this->_creator->_sha1."\""; |
|
594 | + if ($this->_creator->_name) $rdf .= ">\n\t\t\t<foaf:homepage rdf:resource=\"".$this->_creator->_homepage."\"/>\n\t\t</foaf:Person>\n"; |
|
595 | 595 | else $rdf .= "/>\n"; |
596 | 596 | $rdf .= "\t</foaf:maker>\n"; |
597 | 597 | } |
@@ -600,23 +600,23 @@ discard block |
||
600 | 600 | if ($this->_administrator) { |
601 | 601 | if ($this->_administrator->_id) { |
602 | 602 | $rdf .= "\t<sioc:has_administrator>\n"; |
603 | - $rdf .= "\t\t<sioc:UserAccount rdf:about=\"" . clean($this->_administrator->_uri) ."\">\n"; |
|
604 | - if($this->_administrator->_sioc_url) { $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"". $this->_administrator->_sioc_url ."\"/>\n"; } |
|
605 | - else $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"" . $exp->siocURL('user', $this->_administrator->_id). "\"/>\n"; |
|
603 | + $rdf .= "\t\t<sioc:UserAccount rdf:about=\"".clean($this->_administrator->_uri)."\">\n"; |
|
604 | + if ($this->_administrator->_sioc_url) { $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"".$this->_administrator->_sioc_url."\"/>\n"; } |
|
605 | + else $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"".$exp->siocURL('user', $this->_administrator->_id)."\"/>\n"; |
|
606 | 606 | $rdf .= "\t\t</sioc:UserAccount>\n"; |
607 | 607 | $rdf .= "\t</sioc:has_administrator>\n"; |
608 | 608 | } |
609 | 609 | } |
610 | 610 | if ($this->_links) { |
611 | - foreach($this->_links as $url=>$link) { |
|
612 | - $rdf .= "\t<sioc:links_to rdfs:label=\"$link\" rdf:resource=\"" . clean($url) ."\"/>\n"; |
|
611 | + foreach ($this->_links as $url=>$link) { |
|
612 | + $rdf .= "\t<sioc:links_to rdfs:label=\"$link\" rdf:resource=\"".clean($url)."\"/>\n"; |
|
613 | 613 | } |
614 | 614 | } |
615 | 615 | |
616 | - if($this->_next) { |
|
617 | - $rdf .= "\r<rdfs:seeAlso rdf:resource=\"" . $exp->siocURL('forum', $this->_id, $this->_page+1) ."\"/>\n"; |
|
616 | + if ($this->_next) { |
|
617 | + $rdf .= "\r<rdfs:seeAlso rdf:resource=\"".$exp->siocURL('forum', $this->_id, $this->_page + 1)."\"/>\n"; |
|
618 | 618 | } |
619 | - $rdf .= "</".$this->_type.">"; |
|
619 | + $rdf .= "</".$this->_type.">"; |
|
620 | 620 | |
621 | 621 | return $rdf; |
622 | 622 | } |
@@ -645,7 +645,7 @@ discard block |
||
645 | 645 | var $_type; |
646 | 646 | var $_has_part; |
647 | 647 | |
648 | - function SIOCPost($url, $subject, $content, $encoded, $creator, $created, $updated="", $topics=array(), $links=array(), $type='sioc:Post', $has_part=array() ) { |
|
648 | + function SIOCPost($url, $subject, $content, $encoded, $creator, $created, $updated = "", $topics = array(), $links = array(), $type = 'sioc:Post', $has_part = array()) { |
|
649 | 649 | $this->_url = $url; |
650 | 650 | $this->_subject = $subject; |
651 | 651 | $this->_content = $content; |
@@ -669,77 +669,77 @@ discard block |
||
669 | 669 | $this->_reply_of[$id] = $url; |
670 | 670 | } |
671 | 671 | |
672 | - function getContent( &$exp ) { |
|
673 | - $rdf = '<'.$this->_type." rdf:about=\"" . clean($this->_url) . "\">\n"; |
|
672 | + function getContent(&$exp) { |
|
673 | + $rdf = '<'.$this->_type." rdf:about=\"".clean($this->_url)."\">\n"; |
|
674 | 674 | if ($this->_type != 'sioc:Post') $rdf .= "\t<rdf:type rdf:resource=\"http://rdfs.org/sioc/ns#Post\" />\n"; |
675 | - if ($this->_subject) { $rdf .= "\t<dc:title>" . $this->_subject . "</dc:title>\n"; } |
|
675 | + if ($this->_subject) { $rdf .= "\t<dc:title>".$this->_subject."</dc:title>\n"; } |
|
676 | 676 | if ($this->_creator) { |
677 | 677 | if ($this->_creator->_id) { |
678 | 678 | $rdf .= "\t<sioc:has_creator>\n"; |
679 | - $rdf .= "\t\t<sioc:UserAccount rdf:about=\"" . clean($this->_creator->_uri) ."\">\n"; |
|
680 | - if($this->_creator->_sioc_url) { $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"". $this->_creator->_sioc_url ."\"/>\n"; } |
|
681 | - else $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"" . $exp->siocURL('user', $this->_creator->_id). "\"/>\n"; |
|
679 | + $rdf .= "\t\t<sioc:UserAccount rdf:about=\"".clean($this->_creator->_uri)."\">\n"; |
|
680 | + if ($this->_creator->_sioc_url) { $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"".$this->_creator->_sioc_url."\"/>\n"; } |
|
681 | + else $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"".$exp->siocURL('user', $this->_creator->_id)."\"/>\n"; |
|
682 | 682 | $rdf .= "\t\t</sioc:UserAccount>\n"; |
683 | 683 | $rdf .= "\t</sioc:has_creator>\n"; |
684 | 684 | $rdf .= "\t<foaf:maker>\n"; |
685 | - $rdf .= "\t\t<foaf:Person rdf:about=\"" . clean($this->_creator->_foaf_uri) ."\">\n"; |
|
686 | - if($this->_creator->_foaf_url) { $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"". $this->_creator->_foaf_url ."\"/>\n"; } |
|
687 | - else $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"" . $exp->siocURL('user', $this->_creator->_id). "\"/>\n"; |
|
685 | + $rdf .= "\t\t<foaf:Person rdf:about=\"".clean($this->_creator->_foaf_uri)."\">\n"; |
|
686 | + if ($this->_creator->_foaf_url) { $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"".$this->_creator->_foaf_url."\"/>\n"; } |
|
687 | + else $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"".$exp->siocURL('user', $this->_creator->_id)."\"/>\n"; |
|
688 | 688 | $rdf .= "\t\t</foaf:Person>\n"; |
689 | 689 | $rdf .= "\t</foaf:maker>\n"; |
690 | 690 | } else { |
691 | 691 | $rdf .= "\t<foaf:maker>\n"; |
692 | 692 | $rdf .= "\t\t<foaf:Person"; |
693 | - if($this->_creator->_name) $rdf .= " foaf:name=\"" . $this->_creator->_name ."\""; |
|
694 | - if($this->_creator->_sha1) $rdf .= " foaf:mbox_sha1sum=\"" . $this->_creator->_sha1 ."\""; |
|
695 | - if($this->_creator->_name) $rdf .= ">\n\t\t\t<foaf:homepage rdf:resource=\"" . $this->_creator->_homepage ."\"/>\n\t\t</foaf:Person>\n"; |
|
693 | + if ($this->_creator->_name) $rdf .= " foaf:name=\"".$this->_creator->_name."\""; |
|
694 | + if ($this->_creator->_sha1) $rdf .= " foaf:mbox_sha1sum=\"".$this->_creator->_sha1."\""; |
|
695 | + if ($this->_creator->_name) $rdf .= ">\n\t\t\t<foaf:homepage rdf:resource=\"".$this->_creator->_homepage."\"/>\n\t\t</foaf:Person>\n"; |
|
696 | 696 | else $rdf .= "/>\n"; |
697 | 697 | $rdf .= "\t</foaf:maker>\n"; |
698 | 698 | } |
699 | 699 | } |
700 | - $rdf .= "\t<dcterms:created>" . $this->_created . "</dcterms:created>\n"; |
|
701 | - if ($this->_updated AND ($this->_created != $this->_updated) ) $rdf .= "\t<dcterms:modified>" . $this->_updated . "</dcterms:modified>\n"; |
|
702 | - $rdf .= "\t<sioc:content>" . pureContent($this->_content) . "</sioc:content>\n"; |
|
700 | + $rdf .= "\t<dcterms:created>".$this->_created."</dcterms:created>\n"; |
|
701 | + if ($this->_updated AND ($this->_created != $this->_updated)) $rdf .= "\t<dcterms:modified>".$this->_updated."</dcterms:modified>\n"; |
|
702 | + $rdf .= "\t<sioc:content>".pureContent($this->_content)."</sioc:content>\n"; |
|
703 | 703 | |
704 | - $rdf .= "\t<content:encoded><![CDATA[" . $this->_encoded . "]]></content:encoded>\n"; |
|
705 | - if($this->_topics) { |
|
706 | - foreach($this->_topics as $url=>$topic) { |
|
707 | - $rdf .= "\t<sioc:topic rdfs:label=\"$topic\" rdf:resource=\"" . clean($url) ."\"/>\n"; |
|
704 | + $rdf .= "\t<content:encoded><![CDATA[".$this->_encoded."]]></content:encoded>\n"; |
|
705 | + if ($this->_topics) { |
|
706 | + foreach ($this->_topics as $url=>$topic) { |
|
707 | + $rdf .= "\t<sioc:topic rdfs:label=\"$topic\" rdf:resource=\"".clean($url)."\"/>\n"; |
|
708 | 708 | } |
709 | 709 | } |
710 | - if($this->_links) { |
|
711 | - foreach($this->_links as $url=>$link) { |
|
712 | - $rdf .= "\t<sioc:links_to rdfs:label=\"$link\" rdf:resource=\"" . clean($url) ."\"/>\n"; |
|
710 | + if ($this->_links) { |
|
711 | + foreach ($this->_links as $url=>$link) { |
|
712 | + $rdf .= "\t<sioc:links_to rdfs:label=\"$link\" rdf:resource=\"".clean($url)."\"/>\n"; |
|
713 | 713 | } |
714 | 714 | } |
715 | - if($this->_has_part) { |
|
716 | - foreach($this->_has_part as $id=>$url) { |
|
715 | + if ($this->_has_part) { |
|
716 | + foreach ($this->_has_part as $id=>$url) { |
|
717 | 717 | $rdf .= "\t<dcterms:hasPart>\n"; |
718 | - $rdf .= "\t\t<dcmitype:Image rdf:about=\"" . clean($url) . "\"/>\n"; |
|
718 | + $rdf .= "\t\t<dcmitype:Image rdf:about=\"".clean($url)."\"/>\n"; |
|
719 | 719 | $rdf .= "\t</dcterms:hasPart>\n"; |
720 | 720 | } |
721 | 721 | } |
722 | - if($this->_reply_of) { |
|
723 | - foreach($this->_reply_of as $id => $url) { |
|
722 | + if ($this->_reply_of) { |
|
723 | + foreach ($this->_reply_of as $id => $url) { |
|
724 | 724 | $rdf .= "\t<sioc:reply_of>\n"; |
725 | - $rdf .= "\t\t<sioc:Post rdf:about=\"" . clean($url) . "\">\n"; |
|
726 | - $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"" . $exp->siocURL('post', $id) . "\"/>\n"; |
|
725 | + $rdf .= "\t\t<sioc:Post rdf:about=\"".clean($url)."\">\n"; |
|
726 | + $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"".$exp->siocURL('post', $id)."\"/>\n"; |
|
727 | 727 | $rdf .= "\t\t</sioc:Post>\n"; |
728 | 728 | $rdf .= "\t</sioc:reply_of>\n"; |
729 | 729 | } |
730 | 730 | } |
731 | - if($this->_comments) { |
|
732 | - foreach($this->_comments as $id => $url) { |
|
731 | + if ($this->_comments) { |
|
732 | + foreach ($this->_comments as $id => $url) { |
|
733 | 733 | $rdf .= "\t<sioc:has_reply>\n"; |
734 | - $rdf .= "\t\t<sioc:Post rdf:about=\"" . clean($url) ."\">\n"; |
|
734 | + $rdf .= "\t\t<sioc:Post rdf:about=\"".clean($url)."\">\n"; |
|
735 | 735 | // if($comments->f('comment_trackback')) $rdf .= "\t\t\t<sioc:type>" . POST_TRACKBACK . "</sioc:type>\n"; |
736 | 736 | // else $rdf .= "\t\t\t<sioc:type>" . POST_COMMENT . "</sioc:type>\n"; |
737 | - $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"" . $exp->siocURL('comment', $id) . "\"/>\n"; |
|
737 | + $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"".$exp->siocURL('comment', $id)."\"/>\n"; |
|
738 | 738 | $rdf .= "\t\t</sioc:Post>\n"; |
739 | 739 | $rdf .= "\t</sioc:has_reply>\n"; |
740 | 740 | } |
741 | 741 | } |
742 | - $rdf .= "</".$this->_type.">\n"; |
|
742 | + $rdf .= "</".$this->_type.">\n"; |
|
743 | 743 | return $rdf; |
744 | 744 | } |
745 | 745 | } |
@@ -769,7 +769,7 @@ discard block |
||
769 | 769 | var $_has_discussion; |
770 | 770 | var $_has_container; |
771 | 771 | |
772 | - function SIOCWikiArticle($url, $api, $subject, $redir, $user, $created, $prev_vers, $next_vers, $latest_vers, $has_discuss, $container, $topics=array(), $links=array(), $ext_links=array(), $type='sioct:WikiArticle') { |
|
772 | + function SIOCWikiArticle($url, $api, $subject, $redir, $user, $created, $prev_vers, $next_vers, $latest_vers, $has_discuss, $container, $topics = array(), $links = array(), $ext_links = array(), $type = 'sioct:WikiArticle') { |
|
773 | 773 | $this->_url = $url; |
774 | 774 | $this->_api = $api; |
775 | 775 | $this->_subject = $subject; |
@@ -787,12 +787,12 @@ discard block |
||
787 | 787 | $this->_has_container = $container; |
788 | 788 | } |
789 | 789 | |
790 | - function getContent( &$exp ) { |
|
791 | - $rdf = '<'.$this->_type." rdf:about=\"" . clean($this->_url) . "\">\n"; |
|
790 | + function getContent(&$exp) { |
|
791 | + $rdf = '<'.$this->_type." rdf:about=\"".clean($this->_url)."\">\n"; |
|
792 | 792 | if ($this->_subject) |
793 | 793 | { |
794 | - $rdf .= "\t<dc:title>" . clean($this->_subject) . "</dc:title>\n"; |
|
795 | - if(strcmp($this->_has_container, 'http://en.wikipedia.org')===0) |
|
794 | + $rdf .= "\t<dc:title>".clean($this->_subject)."</dc:title>\n"; |
|
795 | + if (strcmp($this->_has_container, 'http://en.wikipedia.org') === 0) |
|
796 | 796 | $rdf .= "\t<foaf:primaryTopic rdf:resource=\"".clean('http://dbpedia.org/resource/'.$this->_subject)."\"/>\n"; |
797 | 797 | } |
798 | 798 | if ($this->_creator->_nick) { |
@@ -811,14 +811,14 @@ discard block |
||
811 | 811 | $rdf .= "\t</foaf:maker>\n"; |
812 | 812 | } else {*/ |
813 | 813 | $rdf .= "\t<sioc:has_creator>\n"; |
814 | - $rdf .= "\t\t<sioc:UserAccount rdf:about=\"" . clean($this->_creator->_uri) ."\">\n"; |
|
815 | - $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"" . |
|
814 | + $rdf .= "\t\t<sioc:UserAccount rdf:about=\"".clean($this->_creator->_uri)."\">\n"; |
|
815 | + $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"". |
|
816 | 816 | clean('http://ws.sioc-project.org/mediawiki/mediawiki.php?wiki='.$this->_creator->_uri); |
817 | - if ($this->_api) $rdf .= clean("&api=" . $this->_api); |
|
817 | + if ($this->_api) $rdf .= clean("&api=".$this->_api); |
|
818 | 818 | $rdf .= "\"/>\n"; |
819 | 819 | $rdf .= "\t\t</sioc:UserAccount>\n"; |
820 | 820 | $rdf .= "\t</sioc:has_creator>\n"; |
821 | - $rdf .= "\t<dc:contributor>" . clean($this->_creator->_nick) ."</dc:contributor>\n"; |
|
821 | + $rdf .= "\t<dc:contributor>".clean($this->_creator->_nick)."</dc:contributor>\n"; |
|
822 | 822 | /*$rdf .= "\t<foaf:maker>\n"; |
823 | 823 | $rdf .= "\t\t<foaf:Person"; |
824 | 824 | if($this->_creator->_name) $rdf .= " foaf:name=\"" . $this->_creator->_name ."\""; |
@@ -837,55 +837,55 @@ discard block |
||
837 | 837 | } |
838 | 838 | } |
839 | 839 | if ($this->_created) { |
840 | - $rdf .= "\t<dcterms:created>" . $this->_created . "</dcterms:created>\n"; |
|
840 | + $rdf .= "\t<dcterms:created>".$this->_created."</dcterms:created>\n"; |
|
841 | 841 | } |
842 | - if(is_array($this->_topics)) { |
|
843 | - foreach($this->_topics as $topic=>$url) { |
|
842 | + if (is_array($this->_topics)) { |
|
843 | + foreach ($this->_topics as $topic=>$url) { |
|
844 | 844 | $rdf .= "\t<sioc:topic>\n"; |
845 | - $rdf .= "\t\t<sioct:Category rdf:about=\"" . clean($url) ."\">\n"; |
|
846 | - $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"" . |
|
845 | + $rdf .= "\t\t<sioct:Category rdf:about=\"".clean($url)."\">\n"; |
|
846 | + $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"". |
|
847 | 847 | clean('http://ws.sioc-project.org/mediawiki/mediawiki.php?wiki='.$url); |
848 | - if ($this->_api) $rdf .= clean("&api=" . $this->_api); |
|
848 | + if ($this->_api) $rdf .= clean("&api=".$this->_api); |
|
849 | 849 | $rdf .= "\"/>\n"; |
850 | 850 | $rdf .= "\t\t</sioct:Category>\n"; |
851 | 851 | $rdf .= "\t</sioc:topic>\n"; |
852 | 852 | } |
853 | 853 | } |
854 | 854 | if (is_array($this->_links)) { |
855 | - foreach($this->_links as $label=>$url) { |
|
855 | + foreach ($this->_links as $label=>$url) { |
|
856 | 856 | $rdf .= "\t<sioc:links_to>\n"; |
857 | - $rdf .= "\t\t<sioct:WikiArticle rdf:about=\"" . clean($url) ."\">\n"; |
|
858 | - $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"" . |
|
857 | + $rdf .= "\t\t<sioct:WikiArticle rdf:about=\"".clean($url)."\">\n"; |
|
858 | + $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"". |
|
859 | 859 | clean('http://ws.sioc-project.org/mediawiki/mediawiki.php?wiki='.$url); |
860 | - if ($this->_api) $rdf .= clean("&api=" . $this->_api); |
|
860 | + if ($this->_api) $rdf .= clean("&api=".$this->_api); |
|
861 | 861 | $rdf .= "\"/>\n"; |
862 | 862 | $rdf .= "\t\t</sioct:WikiArticle>\n"; |
863 | 863 | $rdf .= "\t</sioc:links_to>\n"; |
864 | 864 | } |
865 | 865 | } else |
866 | - { if($this->_links) |
|
866 | + { if ($this->_links) |
|
867 | 867 | { |
868 | 868 | $rdf .= "\t<sioc:links_to>\n"; |
869 | - $rdf .= "\t\t<sioct:WikiArticle rdf:about=\"" . clean($this->_links) ."\">\n"; |
|
870 | - $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"" . |
|
869 | + $rdf .= "\t\t<sioct:WikiArticle rdf:about=\"".clean($this->_links)."\">\n"; |
|
870 | + $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"". |
|
871 | 871 | clean('http://ws.sioc-project.org/mediawiki/mediawiki.php?wiki='.$this->_links); |
872 | - if ($this->_api) $rdf .= clean("&api=" . $this->_api); |
|
872 | + if ($this->_api) $rdf .= clean("&api=".$this->_api); |
|
873 | 873 | $rdf .= "\"/>\n"; |
874 | 874 | $rdf .= "\t\t</sioct:WikiArticle>\n"; |
875 | 875 | $rdf .= "\t</sioc:links_to>\n"; |
876 | 876 | } |
877 | 877 | } |
878 | - if(is_array($this->_ext_links)) { |
|
879 | - foreach($this->_ext_links as $label=>$url) { |
|
880 | - $rdf .= "\t<sioc:links_to rdf:resource=\"" . clean($url) ."\"/>\n"; |
|
878 | + if (is_array($this->_ext_links)) { |
|
879 | + foreach ($this->_ext_links as $label=>$url) { |
|
880 | + $rdf .= "\t<sioc:links_to rdf:resource=\"".clean($url)."\"/>\n"; |
|
881 | 881 | } |
882 | 882 | } |
883 | - if($this->_previous_version) { |
|
883 | + if ($this->_previous_version) { |
|
884 | 884 | $rdf .= "\t<sioc:previous_version>\n"; |
885 | - $rdf .= "\t\t<sioct:WikiArticle rdf:about=\"" . clean($this->_previous_version) ."\">\n"; |
|
886 | - $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"" . |
|
885 | + $rdf .= "\t\t<sioct:WikiArticle rdf:about=\"".clean($this->_previous_version)."\">\n"; |
|
886 | + $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"". |
|
887 | 887 | clean('http://ws.sioc-project.org/mediawiki/mediawiki.php?wiki='.$this->_previous_version); |
888 | - if ($this->_api) $rdf .= clean("&api=" . $this->_api); |
|
888 | + if ($this->_api) $rdf .= clean("&api=".$this->_api); |
|
889 | 889 | $rdf .= "\"/>\n"; |
890 | 890 | $rdf .= "\t\t</sioct:WikiArticle>\n"; |
891 | 891 | $rdf .= "\t</sioc:previous_version>\n"; |
@@ -900,12 +900,12 @@ discard block |
||
900 | 900 | $rdf .= "\t</sioc:earlier_version>\n"; |
901 | 901 | */ |
902 | 902 | } |
903 | - if($this->_next_version) { |
|
903 | + if ($this->_next_version) { |
|
904 | 904 | $rdf .= "\t<sioc:next_version>\n"; |
905 | - $rdf .= "\t\t<sioct:WikiArticle rdf:about=\"" . clean($this->_next_version) ."\">\n"; |
|
906 | - $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"" . |
|
905 | + $rdf .= "\t\t<sioct:WikiArticle rdf:about=\"".clean($this->_next_version)."\">\n"; |
|
906 | + $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"". |
|
907 | 907 | clean('http://ws.sioc-project.org/mediawiki/mediawiki.php?wiki='.$this->_next_version); |
908 | - if ($this->_api) $rdf .= clean("&api=" . $this->_api); |
|
908 | + if ($this->_api) $rdf .= clean("&api=".$this->_api); |
|
909 | 909 | $rdf .= "\"/>\n"; |
910 | 910 | $rdf .= "\t\t</sioct:WikiArticle>\n"; |
911 | 911 | $rdf .= "\t</sioc:next_version>\n"; |
@@ -920,41 +920,41 @@ discard block |
||
920 | 920 | $rdf .= "\t</sioc:later_version>\n"; |
921 | 921 | */ |
922 | 922 | } |
923 | - if($this->_latest_version) { |
|
923 | + if ($this->_latest_version) { |
|
924 | 924 | $rdf .= "\t<sioc:latest_version>\n"; |
925 | - $rdf .= "\t\t<sioct:WikiArticle rdf:about=\"" . clean($this->_latest_version) ."\">\n"; |
|
926 | - $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"" . |
|
925 | + $rdf .= "\t\t<sioct:WikiArticle rdf:about=\"".clean($this->_latest_version)."\">\n"; |
|
926 | + $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"". |
|
927 | 927 | clean('http://ws.sioc-project.org/mediawiki/mediawiki.php?wiki='.$this->_latest_version); |
928 | - if ($this->_api) $rdf .= clean("&api=" . $this->_api); |
|
928 | + if ($this->_api) $rdf .= clean("&api=".$this->_api); |
|
929 | 929 | $rdf .= "\"/>\n"; |
930 | 930 | $rdf .= "\t\t</sioct:WikiArticle>\n"; |
931 | 931 | $rdf .= "\t</sioc:latest_version>\n"; |
932 | 932 | } |
933 | - if($this->_has_discussion && (strpos($this->_has_discussion, 'Talk:Talk:') == FALSE)) { |
|
933 | + if ($this->_has_discussion && (strpos($this->_has_discussion, 'Talk:Talk:') == FALSE)) { |
|
934 | 934 | $rdf .= "\t<sioc:has_discussion>\n"; |
935 | - $rdf .= "\t\t<sioct:WikiArticle rdf:about=\"" . clean($this->_has_discussion) ."\">\n"; |
|
936 | - $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"" . |
|
935 | + $rdf .= "\t\t<sioct:WikiArticle rdf:about=\"".clean($this->_has_discussion)."\">\n"; |
|
936 | + $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"". |
|
937 | 937 | clean('http://ws.sioc-project.org/mediawiki/mediawiki.php?wiki='.$this->_has_discussion); |
938 | - if ($this->_api) $rdf .= clean("&api=" . $this->_api); |
|
938 | + if ($this->_api) $rdf .= clean("&api=".$this->_api); |
|
939 | 939 | $rdf .= "\"/>\n"; |
940 | 940 | $rdf .= "\t\t</sioct:WikiArticle>\n"; |
941 | 941 | $rdf .= "\t</sioc:has_discussion>\n"; |
942 | 942 | } |
943 | - if($this->_has_container) { |
|
943 | + if ($this->_has_container) { |
|
944 | 944 | $rdf .= "\t<sioc:has_container>\n"; |
945 | - $rdf .= "\t\t<sioct:Wiki rdf:about=\"" . clean($this->_has_container) ."\"/>\n"; |
|
945 | + $rdf .= "\t\t<sioct:Wiki rdf:about=\"".clean($this->_has_container)."\"/>\n"; |
|
946 | 946 | $rdf .= "\t</sioc:has_container>\n"; |
947 | 947 | } |
948 | - if($this->_redirpage) |
|
948 | + if ($this->_redirpage) |
|
949 | 949 | { |
950 | - $rdf .= "\t<owl:sameAs rdf:resource=\"" . clean($this->_redirpage) ."\"/>\n"; |
|
951 | - $rdf .= "\t<rdfs:seeAlso rdf:resource=\"" . |
|
950 | + $rdf .= "\t<owl:sameAs rdf:resource=\"".clean($this->_redirpage)."\"/>\n"; |
|
951 | + $rdf .= "\t<rdfs:seeAlso rdf:resource=\"". |
|
952 | 952 | clean('http://ws.sioc-project.org/mediawiki/mediawiki.php?wiki='.$this->_redirpage); |
953 | - if ($this->_api) $rdf .= clean("&api=" . $this->_api); |
|
953 | + if ($this->_api) $rdf .= clean("&api=".$this->_api); |
|
954 | 954 | $rdf .= "\"/>\n"; |
955 | 955 | } |
956 | 956 | |
957 | - $rdf .= "</".$this->_type.">\n"; |
|
957 | + $rdf .= "</".$this->_type.">\n"; |
|
958 | 958 | return $rdf; |
959 | 959 | } |
960 | 960 | } |
@@ -969,13 +969,13 @@ discard block |
||
969 | 969 | var $_url; |
970 | 970 | var $_type; |
971 | 971 | |
972 | - function SIOCWiki ($url, $type='sioct:Wiki') { |
|
972 | + function SIOCWiki($url, $type = 'sioct:Wiki') { |
|
973 | 973 | $this->_url = $url; |
974 | 974 | $this->_type = $type; |
975 | 975 | } |
976 | 976 | |
977 | - function getContent( &$exp ) { |
|
978 | - $rdf = '<'.$this->_type." rdf:about=\"" . clean($this->_url) . "\"/>\n"; |
|
977 | + function getContent(&$exp) { |
|
978 | + $rdf = '<'.$this->_type." rdf:about=\"".clean($this->_url)."\"/>\n"; |
|
979 | 979 | return $rdf; |
980 | 980 | } |
981 | 981 | } |
@@ -990,13 +990,13 @@ discard block |
||
990 | 990 | var $_url; |
991 | 991 | var $_type; |
992 | 992 | |
993 | - function SIOCCategory ($url, $type='sioct:Category') { |
|
993 | + function SIOCCategory($url, $type = 'sioct:Category') { |
|
994 | 994 | $this->_url = $url; |
995 | 995 | $this->_type = $type; |
996 | 996 | } |
997 | 997 | |
998 | - function getContent( &$exp ) { |
|
999 | - $rdf = '<'.$this->_type." rdf:about=\"" . clean($this->_url) . "\"/>\n"; |
|
998 | + function getContent(&$exp) { |
|
999 | + $rdf = '<'.$this->_type." rdf:about=\"".clean($this->_url)."\"/>\n"; |
|
1000 | 1000 | return $rdf; |
1001 | 1001 | } |
1002 | 1002 | } |
@@ -1008,12 +1008,12 @@ discard block |
||
1008 | 1008 | * Transforms text so that it can be safely put into XML markup |
1009 | 1009 | */ |
1010 | 1010 | if (!function_exists('clean')) { |
1011 | - function clean( $text , $url = false) { |
|
1011 | + function clean($text, $url = false) { |
|
1012 | 1012 | # return htmlentities( $text ); |
1013 | 1013 | # return htmlentities2( $text ); |
1014 | 1014 | // double encoding is preventable now |
1015 | 1015 | // $text = htmlspecialchars_decode($text, ENT_COMPAT); |
1016 | - if ($url) $text = str_replace('&','&', $text); |
|
1016 | + if ($url) $text = str_replace('&', '&', $text); |
|
1017 | 1017 | return htmlspecialchars($text, ENT_COMPAT, 'UTF-8'); |
1018 | 1018 | } |
1019 | 1019 | } |
@@ -1025,9 +1025,9 @@ discard block |
||
1025 | 1025 | */ |
1026 | 1026 | if (!function_exists('htmlentities2')) { |
1027 | 1027 | function htmlentities2($myHTML) { |
1028 | - $translation_table=get_html_translation_table (HTML_ENTITIES,ENT_QUOTES); |
|
1028 | + $translation_table = get_html_translation_table(HTML_ENTITIES, ENT_QUOTES); |
|
1029 | 1029 | $translation_table[chr(38)] = '&'; |
1030 | - return preg_replace("/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,3};)/","&" , strtr($myHTML, $translation_table)); |
|
1030 | + return preg_replace("/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,3};)/", "&", strtr($myHTML, $translation_table)); |
|
1031 | 1031 | //return htmlentities(strtr(str_replace(' ', '%20', $myHTML), $translation_table)); |
1032 | 1032 | } |
1033 | 1033 | } |
@@ -100,10 +100,11 @@ discard block |
||
100 | 100 | $type_part = $this->_url4type .$this->_urlequal . $type ; |
101 | 101 | |
102 | 102 | if ($id) { |
103 | - if ( isset($this->_type_table[$type]) ) |
|
104 | - $myID = $this->_type_table[$type] ; |
|
105 | - else |
|
106 | - $myID = (($this->_url_usetype) ? $type . '_' : '') . $this->_url4id ; |
|
103 | + if ( isset($this->_type_table[$type]) ) { |
|
104 | + $myID = $this->_type_table[$type] ; |
|
105 | + } else { |
|
106 | + $myID = (($this->_url_usetype) ? $type . '_' : '') . $this->_url4id ; |
|
107 | + } |
|
107 | 108 | |
108 | 109 | $id_part = $this->_urlseparator . $myID . $this->_urlequal . $id ; |
109 | 110 | } else { |
@@ -145,10 +146,14 @@ discard block |
||
145 | 146 | <admin:generatorAgent rdf:resource="'.clean($this->_generator, true).'"/> |
146 | 147 | <admin:generatorAgent rdf:resource="'.clean(EXPORTER_URL, true).'?version='.EXPORTER_VERSION.'"/> |
147 | 148 | </foaf:Document>'."\n"; |
148 | - if ($rdf_content) $rdf .= $rdf_content; |
|
149 | + if ($rdf_content) { |
|
150 | + $rdf .= $rdf_content; |
|
151 | + } |
|
149 | 152 | if (sizeof($this->_objects)) { |
150 | 153 | foreach($this->_objects as $object) { |
151 | - if($object) $rdf .= $object->getContent( $this ); |
|
154 | + if($object) { |
|
155 | + $rdf .= $object->getContent( $this ); |
|
156 | + } |
|
152 | 157 | } |
153 | 158 | } |
154 | 159 | $rdf .= "\n</rdf:RDF>"; |
@@ -328,12 +333,16 @@ discard block |
||
328 | 333 | |
329 | 334 | function getContent( &$exp ) { |
330 | 335 | $rdf = "<foaf:Person rdf:about=\"" . clean($this->_foaf_uri) . "\">\n"; |
331 | - if($this->_name) $rdf .= "\t<foaf:name>". $this->_name . "</foaf:name>\n"; |
|
336 | + if($this->_name) { |
|
337 | + $rdf .= "\t<foaf:name>". $this->_name . "</foaf:name>\n"; |
|
338 | + } |
|
332 | 339 | if($this->_email) { $rdf .= "\t<foaf:mbox_sha1sum>" . $this->_sha1 . "</foaf:mbox_sha1sum>\n"; } |
333 | 340 | if($this->_foaf_url) { $rdf .= "\t<rdfs:seeAlso rdf:resource=\"". $this->_foaf_url ."\"/>\n"; } |
334 | 341 | $rdf .= "\t<foaf:holdsAccount>\n"; |
335 | 342 | $rdf .= "\t\t<sioc:UserAccount rdf:about=\"" . clean($this->_uri) ."\">\n"; |
336 | - if($this->_nick) $rdf .= "\t\t\t<sioc:name>" . $this->_nick . "</sioc:name>\n"; |
|
343 | + if($this->_nick) { |
|
344 | + $rdf .= "\t\t\t<sioc:name>" . $this->_nick . "</sioc:name>\n"; |
|
345 | + } |
|
337 | 346 | if($this->_email) { |
338 | 347 | if ($exp->_export_email) { $rdf .= "\t\t\t<sioc:email rdf:resource=\"" . $this->_email ."\"/>\n"; } |
339 | 348 | $rdf .= "\t\t\t<sioc:email_sha1>" . $this->_sha1 . "</sioc:email_sha1>\n"; |
@@ -409,8 +418,12 @@ discard block |
||
409 | 418 | function getContent( &$exp) { |
410 | 419 | $rdf .= '<sioc:Thread rdf:about="' . clean($this->_url) . "\">\n"; |
411 | 420 | $rdf .= "\t<sioc:link rdf:resource=\"" . clean($this->_url) . "\"/>\n"; |
412 | - if ($this->_views) $rdf .= "\t<sioc:num_views>" . $this->_views . "</sioc:num_views>\n"; |
|
413 | - if ($this->_note) $rdf .= "\t<rdfs:comment>" . $this->_note . "</rdfs:comment>\n"; |
|
421 | + if ($this->_views) { |
|
422 | + $rdf .= "\t<sioc:num_views>" . $this->_views . "</sioc:num_views>\n"; |
|
423 | + } |
|
424 | + if ($this->_note) { |
|
425 | + $rdf .= "\t<rdfs:comment>" . $this->_note . "</rdfs:comment>\n"; |
|
426 | + } |
|
414 | 427 | if ($this->_subject) { $rdf .= "\t<dc:title>" . $this->_subject . "</dc:title>\n"; } |
415 | 428 | if ($this->_created) { $rdf .= "\t<dcterms:created>" . $this->_created . "</dcterms:created>\n"; } |
416 | 429 | if ($this->_parents) { |
@@ -536,11 +549,19 @@ discard block |
||
536 | 549 | |
537 | 550 | function getContent( &$exp) { |
538 | 551 | $rdf .= '<'.$this->_type. ' rdf:about="' . clean($this->_url) . "\">\n"; |
539 | - if ($this->_type != 'sioc:Forum') $rdf .= "\t<rdf:type rdf:resource=\"http://rdfs.org/sioc/ns#Forum\" />\n"; |
|
552 | + if ($this->_type != 'sioc:Forum') { |
|
553 | + $rdf .= "\t<rdf:type rdf:resource=\"http://rdfs.org/sioc/ns#Forum\" />\n"; |
|
554 | + } |
|
540 | 555 | $rdf .= "\t<sioc:link rdf:resource=\"" . clean($this->_url) . "\"/>\n"; |
541 | - if ($this->_blog_title) $rdf .= "\t<dc:title>" . $this->_blog_title . "</dc:title>\n"; |
|
542 | - if ($this->_description) $rdf .= "\t<dc:description>" . $this->_description . "</dc:description>\n"; |
|
543 | - if ($this->_note) $rdf .= "\t<rdfs:comment>" . $this->_note . "</rdfs:comment>\n"; |
|
556 | + if ($this->_blog_title) { |
|
557 | + $rdf .= "\t<dc:title>" . $this->_blog_title . "</dc:title>\n"; |
|
558 | + } |
|
559 | + if ($this->_description) { |
|
560 | + $rdf .= "\t<dc:description>" . $this->_description . "</dc:description>\n"; |
|
561 | + } |
|
562 | + if ($this->_note) { |
|
563 | + $rdf .= "\t<rdfs:comment>" . $this->_note . "</rdfs:comment>\n"; |
|
564 | + } |
|
544 | 565 | |
545 | 566 | if ($this->_parents) { |
546 | 567 | foreach($this->_parents as $id => $uri) { |
@@ -576,23 +597,32 @@ discard block |
||
576 | 597 | if ($this->_creator->_id) { |
577 | 598 | $rdf .= "\t<sioc:has_creator>\n"; |
578 | 599 | $rdf .= "\t\t<sioc:UserAccount rdf:about=\"" . clean($this->_creator->_uri) ."\">\n"; |
579 | - if($this->_creator->_sioc_url) { $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"". $this->_creator->_sioc_url ."\"/>\n"; } |
|
580 | - else $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"" . $exp->siocURL('user', $this->_creator->_id). "\"/>\n"; |
|
600 | + if($this->_creator->_sioc_url) { $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"". $this->_creator->_sioc_url ."\"/>\n"; } else { |
|
601 | + $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"" . $exp->siocURL('user', $this->_creator->_id). "\"/>\n"; |
|
602 | + } |
|
581 | 603 | $rdf .= "\t\t</sioc:UserAccount>\n"; |
582 | 604 | $rdf .= "\t</sioc:has_creator>\n"; |
583 | 605 | $rdf .= "\t<foaf:maker>\n"; |
584 | 606 | $rdf .= "\t\t<foaf:Person rdf:about=\"" . clean($this->_creator->_foaf_uri) ."\">\n"; |
585 | - if($this->_creator->_foaf_url) { $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"". $this->_creator->_foaf_url ."\"/>\n"; } |
|
586 | - else $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"" . $exp->siocURL('user', $this->_creator->_id). "\"/>\n"; |
|
607 | + if($this->_creator->_foaf_url) { $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"". $this->_creator->_foaf_url ."\"/>\n"; } else { |
|
608 | + $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"" . $exp->siocURL('user', $this->_creator->_id). "\"/>\n"; |
|
609 | + } |
|
587 | 610 | $rdf .= "\t\t</foaf:Person>\n"; |
588 | 611 | $rdf .= "\t</foaf:maker>\n"; |
589 | 612 | } else { |
590 | 613 | $rdf .= "\t<foaf:maker>\n"; |
591 | 614 | $rdf .= "\t\t<foaf:Person"; |
592 | - if($this->_creator->_name) $rdf .= " foaf:name=\"" . $this->_creator->_name ."\""; |
|
593 | - if($this->_creator->_sha1) $rdf .= " foaf:mbox_sha1sum=\"" . $this->_creator->_sha1 ."\""; |
|
594 | - if($this->_creator->_name) $rdf .= ">\n\t\t\t<foaf:homepage rdf:resource=\"" . $this->_creator->_homepage ."\"/>\n\t\t</foaf:Person>\n"; |
|
595 | - else $rdf .= "/>\n"; |
|
615 | + if($this->_creator->_name) { |
|
616 | + $rdf .= " foaf:name=\"" . $this->_creator->_name ."\""; |
|
617 | + } |
|
618 | + if($this->_creator->_sha1) { |
|
619 | + $rdf .= " foaf:mbox_sha1sum=\"" . $this->_creator->_sha1 ."\""; |
|
620 | + } |
|
621 | + if($this->_creator->_name) { |
|
622 | + $rdf .= ">\n\t\t\t<foaf:homepage rdf:resource=\"" . $this->_creator->_homepage ."\"/>\n\t\t</foaf:Person>\n"; |
|
623 | + } else { |
|
624 | + $rdf .= "/>\n"; |
|
625 | + } |
|
596 | 626 | $rdf .= "\t</foaf:maker>\n"; |
597 | 627 | } |
598 | 628 | } |
@@ -601,8 +631,9 @@ discard block |
||
601 | 631 | if ($this->_administrator->_id) { |
602 | 632 | $rdf .= "\t<sioc:has_administrator>\n"; |
603 | 633 | $rdf .= "\t\t<sioc:UserAccount rdf:about=\"" . clean($this->_administrator->_uri) ."\">\n"; |
604 | - if($this->_administrator->_sioc_url) { $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"". $this->_administrator->_sioc_url ."\"/>\n"; } |
|
605 | - else $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"" . $exp->siocURL('user', $this->_administrator->_id). "\"/>\n"; |
|
634 | + if($this->_administrator->_sioc_url) { $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"". $this->_administrator->_sioc_url ."\"/>\n"; } else { |
|
635 | + $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"" . $exp->siocURL('user', $this->_administrator->_id). "\"/>\n"; |
|
636 | + } |
|
606 | 637 | $rdf .= "\t\t</sioc:UserAccount>\n"; |
607 | 638 | $rdf .= "\t</sioc:has_administrator>\n"; |
608 | 639 | } |
@@ -671,34 +702,47 @@ discard block |
||
671 | 702 | |
672 | 703 | function getContent( &$exp ) { |
673 | 704 | $rdf = '<'.$this->_type." rdf:about=\"" . clean($this->_url) . "\">\n"; |
674 | - if ($this->_type != 'sioc:Post') $rdf .= "\t<rdf:type rdf:resource=\"http://rdfs.org/sioc/ns#Post\" />\n"; |
|
705 | + if ($this->_type != 'sioc:Post') { |
|
706 | + $rdf .= "\t<rdf:type rdf:resource=\"http://rdfs.org/sioc/ns#Post\" />\n"; |
|
707 | + } |
|
675 | 708 | if ($this->_subject) { $rdf .= "\t<dc:title>" . $this->_subject . "</dc:title>\n"; } |
676 | 709 | if ($this->_creator) { |
677 | 710 | if ($this->_creator->_id) { |
678 | 711 | $rdf .= "\t<sioc:has_creator>\n"; |
679 | 712 | $rdf .= "\t\t<sioc:UserAccount rdf:about=\"" . clean($this->_creator->_uri) ."\">\n"; |
680 | - if($this->_creator->_sioc_url) { $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"". $this->_creator->_sioc_url ."\"/>\n"; } |
|
681 | - else $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"" . $exp->siocURL('user', $this->_creator->_id). "\"/>\n"; |
|
713 | + if($this->_creator->_sioc_url) { $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"". $this->_creator->_sioc_url ."\"/>\n"; } else { |
|
714 | + $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"" . $exp->siocURL('user', $this->_creator->_id). "\"/>\n"; |
|
715 | + } |
|
682 | 716 | $rdf .= "\t\t</sioc:UserAccount>\n"; |
683 | 717 | $rdf .= "\t</sioc:has_creator>\n"; |
684 | 718 | $rdf .= "\t<foaf:maker>\n"; |
685 | 719 | $rdf .= "\t\t<foaf:Person rdf:about=\"" . clean($this->_creator->_foaf_uri) ."\">\n"; |
686 | - if($this->_creator->_foaf_url) { $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"". $this->_creator->_foaf_url ."\"/>\n"; } |
|
687 | - else $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"" . $exp->siocURL('user', $this->_creator->_id). "\"/>\n"; |
|
720 | + if($this->_creator->_foaf_url) { $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"". $this->_creator->_foaf_url ."\"/>\n"; } else { |
|
721 | + $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"" . $exp->siocURL('user', $this->_creator->_id). "\"/>\n"; |
|
722 | + } |
|
688 | 723 | $rdf .= "\t\t</foaf:Person>\n"; |
689 | 724 | $rdf .= "\t</foaf:maker>\n"; |
690 | 725 | } else { |
691 | 726 | $rdf .= "\t<foaf:maker>\n"; |
692 | 727 | $rdf .= "\t\t<foaf:Person"; |
693 | - if($this->_creator->_name) $rdf .= " foaf:name=\"" . $this->_creator->_name ."\""; |
|
694 | - if($this->_creator->_sha1) $rdf .= " foaf:mbox_sha1sum=\"" . $this->_creator->_sha1 ."\""; |
|
695 | - if($this->_creator->_name) $rdf .= ">\n\t\t\t<foaf:homepage rdf:resource=\"" . $this->_creator->_homepage ."\"/>\n\t\t</foaf:Person>\n"; |
|
696 | - else $rdf .= "/>\n"; |
|
728 | + if($this->_creator->_name) { |
|
729 | + $rdf .= " foaf:name=\"" . $this->_creator->_name ."\""; |
|
730 | + } |
|
731 | + if($this->_creator->_sha1) { |
|
732 | + $rdf .= " foaf:mbox_sha1sum=\"" . $this->_creator->_sha1 ."\""; |
|
733 | + } |
|
734 | + if($this->_creator->_name) { |
|
735 | + $rdf .= ">\n\t\t\t<foaf:homepage rdf:resource=\"" . $this->_creator->_homepage ."\"/>\n\t\t</foaf:Person>\n"; |
|
736 | + } else { |
|
737 | + $rdf .= "/>\n"; |
|
738 | + } |
|
697 | 739 | $rdf .= "\t</foaf:maker>\n"; |
698 | 740 | } |
699 | 741 | } |
700 | 742 | $rdf .= "\t<dcterms:created>" . $this->_created . "</dcterms:created>\n"; |
701 | - if ($this->_updated AND ($this->_created != $this->_updated) ) $rdf .= "\t<dcterms:modified>" . $this->_updated . "</dcterms:modified>\n"; |
|
743 | + if ($this->_updated AND ($this->_created != $this->_updated) ) { |
|
744 | + $rdf .= "\t<dcterms:modified>" . $this->_updated . "</dcterms:modified>\n"; |
|
745 | + } |
|
702 | 746 | $rdf .= "\t<sioc:content>" . pureContent($this->_content) . "</sioc:content>\n"; |
703 | 747 | |
704 | 748 | $rdf .= "\t<content:encoded><![CDATA[" . $this->_encoded . "]]></content:encoded>\n"; |
@@ -792,8 +836,9 @@ discard block |
||
792 | 836 | if ($this->_subject) |
793 | 837 | { |
794 | 838 | $rdf .= "\t<dc:title>" . clean($this->_subject) . "</dc:title>\n"; |
795 | - if(strcmp($this->_has_container, 'http://en.wikipedia.org')===0) |
|
796 | - $rdf .= "\t<foaf:primaryTopic rdf:resource=\"".clean('http://dbpedia.org/resource/'.$this->_subject)."\"/>\n"; |
|
839 | + if(strcmp($this->_has_container, 'http://en.wikipedia.org')===0) { |
|
840 | + $rdf .= "\t<foaf:primaryTopic rdf:resource=\"".clean('http://dbpedia.org/resource/'.$this->_subject)."\"/>\n"; |
|
841 | + } |
|
797 | 842 | } |
798 | 843 | if ($this->_creator->_nick) { |
799 | 844 | /*if ($this->_creator->_id) { |
@@ -814,7 +859,9 @@ discard block |
||
814 | 859 | $rdf .= "\t\t<sioc:UserAccount rdf:about=\"" . clean($this->_creator->_uri) ."\">\n"; |
815 | 860 | $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"" . |
816 | 861 | clean('http://ws.sioc-project.org/mediawiki/mediawiki.php?wiki='.$this->_creator->_uri); |
817 | - if ($this->_api) $rdf .= clean("&api=" . $this->_api); |
|
862 | + if ($this->_api) { |
|
863 | + $rdf .= clean("&api=" . $this->_api); |
|
864 | + } |
|
818 | 865 | $rdf .= "\"/>\n"; |
819 | 866 | $rdf .= "\t\t</sioc:UserAccount>\n"; |
820 | 867 | $rdf .= "\t</sioc:has_creator>\n"; |
@@ -845,7 +892,9 @@ discard block |
||
845 | 892 | $rdf .= "\t\t<sioct:Category rdf:about=\"" . clean($url) ."\">\n"; |
846 | 893 | $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"" . |
847 | 894 | clean('http://ws.sioc-project.org/mediawiki/mediawiki.php?wiki='.$url); |
848 | - if ($this->_api) $rdf .= clean("&api=" . $this->_api); |
|
895 | + if ($this->_api) { |
|
896 | + $rdf .= clean("&api=" . $this->_api); |
|
897 | + } |
|
849 | 898 | $rdf .= "\"/>\n"; |
850 | 899 | $rdf .= "\t\t</sioct:Category>\n"; |
851 | 900 | $rdf .= "\t</sioc:topic>\n"; |
@@ -857,7 +906,9 @@ discard block |
||
857 | 906 | $rdf .= "\t\t<sioct:WikiArticle rdf:about=\"" . clean($url) ."\">\n"; |
858 | 907 | $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"" . |
859 | 908 | clean('http://ws.sioc-project.org/mediawiki/mediawiki.php?wiki='.$url); |
860 | - if ($this->_api) $rdf .= clean("&api=" . $this->_api); |
|
909 | + if ($this->_api) { |
|
910 | + $rdf .= clean("&api=" . $this->_api); |
|
911 | + } |
|
861 | 912 | $rdf .= "\"/>\n"; |
862 | 913 | $rdf .= "\t\t</sioct:WikiArticle>\n"; |
863 | 914 | $rdf .= "\t</sioc:links_to>\n"; |
@@ -869,7 +920,9 @@ discard block |
||
869 | 920 | $rdf .= "\t\t<sioct:WikiArticle rdf:about=\"" . clean($this->_links) ."\">\n"; |
870 | 921 | $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"" . |
871 | 922 | clean('http://ws.sioc-project.org/mediawiki/mediawiki.php?wiki='.$this->_links); |
872 | - if ($this->_api) $rdf .= clean("&api=" . $this->_api); |
|
923 | + if ($this->_api) { |
|
924 | + $rdf .= clean("&api=" . $this->_api); |
|
925 | + } |
|
873 | 926 | $rdf .= "\"/>\n"; |
874 | 927 | $rdf .= "\t\t</sioct:WikiArticle>\n"; |
875 | 928 | $rdf .= "\t</sioc:links_to>\n"; |
@@ -885,7 +938,9 @@ discard block |
||
885 | 938 | $rdf .= "\t\t<sioct:WikiArticle rdf:about=\"" . clean($this->_previous_version) ."\">\n"; |
886 | 939 | $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"" . |
887 | 940 | clean('http://ws.sioc-project.org/mediawiki/mediawiki.php?wiki='.$this->_previous_version); |
888 | - if ($this->_api) $rdf .= clean("&api=" . $this->_api); |
|
941 | + if ($this->_api) { |
|
942 | + $rdf .= clean("&api=" . $this->_api); |
|
943 | + } |
|
889 | 944 | $rdf .= "\"/>\n"; |
890 | 945 | $rdf .= "\t\t</sioct:WikiArticle>\n"; |
891 | 946 | $rdf .= "\t</sioc:previous_version>\n"; |
@@ -905,7 +960,9 @@ discard block |
||
905 | 960 | $rdf .= "\t\t<sioct:WikiArticle rdf:about=\"" . clean($this->_next_version) ."\">\n"; |
906 | 961 | $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"" . |
907 | 962 | clean('http://ws.sioc-project.org/mediawiki/mediawiki.php?wiki='.$this->_next_version); |
908 | - if ($this->_api) $rdf .= clean("&api=" . $this->_api); |
|
963 | + if ($this->_api) { |
|
964 | + $rdf .= clean("&api=" . $this->_api); |
|
965 | + } |
|
909 | 966 | $rdf .= "\"/>\n"; |
910 | 967 | $rdf .= "\t\t</sioct:WikiArticle>\n"; |
911 | 968 | $rdf .= "\t</sioc:next_version>\n"; |
@@ -925,7 +982,9 @@ discard block |
||
925 | 982 | $rdf .= "\t\t<sioct:WikiArticle rdf:about=\"" . clean($this->_latest_version) ."\">\n"; |
926 | 983 | $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"" . |
927 | 984 | clean('http://ws.sioc-project.org/mediawiki/mediawiki.php?wiki='.$this->_latest_version); |
928 | - if ($this->_api) $rdf .= clean("&api=" . $this->_api); |
|
985 | + if ($this->_api) { |
|
986 | + $rdf .= clean("&api=" . $this->_api); |
|
987 | + } |
|
929 | 988 | $rdf .= "\"/>\n"; |
930 | 989 | $rdf .= "\t\t</sioct:WikiArticle>\n"; |
931 | 990 | $rdf .= "\t</sioc:latest_version>\n"; |
@@ -935,7 +994,9 @@ discard block |
||
935 | 994 | $rdf .= "\t\t<sioct:WikiArticle rdf:about=\"" . clean($this->_has_discussion) ."\">\n"; |
936 | 995 | $rdf .= "\t\t\t<rdfs:seeAlso rdf:resource=\"" . |
937 | 996 | clean('http://ws.sioc-project.org/mediawiki/mediawiki.php?wiki='.$this->_has_discussion); |
938 | - if ($this->_api) $rdf .= clean("&api=" . $this->_api); |
|
997 | + if ($this->_api) { |
|
998 | + $rdf .= clean("&api=" . $this->_api); |
|
999 | + } |
|
939 | 1000 | $rdf .= "\"/>\n"; |
940 | 1001 | $rdf .= "\t\t</sioct:WikiArticle>\n"; |
941 | 1002 | $rdf .= "\t</sioc:has_discussion>\n"; |
@@ -950,7 +1011,9 @@ discard block |
||
950 | 1011 | $rdf .= "\t<owl:sameAs rdf:resource=\"" . clean($this->_redirpage) ."\"/>\n"; |
951 | 1012 | $rdf .= "\t<rdfs:seeAlso rdf:resource=\"" . |
952 | 1013 | clean('http://ws.sioc-project.org/mediawiki/mediawiki.php?wiki='.$this->_redirpage); |
953 | - if ($this->_api) $rdf .= clean("&api=" . $this->_api); |
|
1014 | + if ($this->_api) { |
|
1015 | + $rdf .= clean("&api=" . $this->_api); |
|
1016 | + } |
|
954 | 1017 | $rdf .= "\"/>\n"; |
955 | 1018 | } |
956 | 1019 | |
@@ -1013,7 +1076,9 @@ discard block |
||
1013 | 1076 | # return htmlentities2( $text ); |
1014 | 1077 | // double encoding is preventable now |
1015 | 1078 | // $text = htmlspecialchars_decode($text, ENT_COMPAT); |
1016 | - if ($url) $text = str_replace('&','&', $text); |
|
1079 | + if ($url) { |
|
1080 | + $text = str_replace('&','&', $text); |
|
1081 | + } |
|
1017 | 1082 | return htmlspecialchars($text, ENT_COMPAT, 'UTF-8'); |
1018 | 1083 | } |
1019 | 1084 | } |