@@ -80,8 +80,8 @@ discard block |
||
80 | 80 | /* -- Methods to manage plugin ------------------------------------------ */ |
81 | 81 | |
82 | 82 | /** |
83 | - * Register its handlers with the DokuWiki's event controller |
|
84 | - */ |
|
83 | + * Register its handlers with the DokuWiki's event controller |
|
84 | + */ |
|
85 | 85 | public function register(Doku_Event_Handler $controller) |
86 | 86 | { |
87 | 87 | //print_r(headers_list()); die(); |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | } |
147 | 147 | |
148 | 148 | /** |
149 | - */ |
|
149 | + */ |
|
150 | 150 | public function createRdfLink($event = null, $param = null) |
151 | 151 | { |
152 | 152 | global $ID, $INFO, $conf; |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | |
501 | 501 | // create container object |
502 | 502 | $wikicontainer = new SIOCDokuWikiContainer($ID, |
503 | - normalizeUri($exporter->siocURL('container', $ID)) |
|
503 | + normalizeUri($exporter->siocURL('container', $ID)) |
|
504 | 504 | ); |
505 | 505 | |
506 | 506 | /* container is type=wiki */ if ($ID == $conf['start']) $wikicontainer->isWiki(); |
@@ -563,10 +563,10 @@ discard block |
||
563 | 563 | // create user object |
564 | 564 | //print_r($userinfo); die(); |
565 | 565 | $wikiuser = new SIOCDokuWikiUser($ID, |
566 | - normalizeUri($exporter->siocURL('user', $ID)), |
|
567 | - $userid, |
|
568 | - $userinfo['name'], |
|
569 | - $userinfo['mail']); |
|
566 | + normalizeUri($exporter->siocURL('user', $ID)), |
|
567 | + $userid, |
|
568 | + $userinfo['name'], |
|
569 | + $userinfo['mail']); |
|
570 | 570 | /* TODO: avatar (using Gravatar) */ |
571 | 571 | /* TODO: creator_of */ |
572 | 572 | // 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 { |
@@ -87,9 +87,9 @@ discard block |
||
87 | 87 | //print_r(headers_list()); die(); |
88 | 88 | |
89 | 89 | // test the requested action |
90 | - $controller->register_hook('ACTION_ACT_PREPROCESS', 'BEFORE', $this, 'checkAction', $controller); |
|
90 | + $controller->register_hook('ACTION_ACT_PREPROCESS', 'BEFORE', $this, 'checkAction', $controller); |
|
91 | 91 | // pingthesemanticweb.com |
92 | - if ($this->getConf('pingsw')) $controller->register_hook('ACTION_SHOW_REDIRECT', 'BEFORE', $this, 'pingService', $controller); |
|
92 | + if ($this->getConf('pingsw')) $controller->register_hook('ACTION_SHOW_REDIRECT', 'BEFORE', $this, 'pingService', $controller); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | /* -- Event handlers ---------------------------------------------------- */ |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | // give back rdf |
106 | 106 | $this->exportSioc(); |
107 | 107 | } |
108 | - elseif (($action->data == 'show' || $action->data == 'index') && $INFO['perm'] && !defined('DOKU_MEDIADETAIL') && ($INFO['exists'] || getDwUserInfo($INFO['id'],$this)) && !isHiddenPage($INFO['id'])) |
|
108 | + elseif (($action->data == 'show' || $action->data == 'index') && $INFO['perm'] && !defined('DOKU_MEDIADETAIL') && ($INFO['exists'] || getDwUserInfo($INFO['id'], $this)) && !isHiddenPage($INFO['id'])) |
|
109 | 109 | { |
110 | 110 | if ($this->isRdfXmlRequest()) |
111 | 111 | { |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | else |
119 | 119 | { |
120 | 120 | // add meta link to html head |
121 | - $controller->register_hook('TPL_METAHEADER_OUTPUT', 'BEFORE', $this, 'createRdfLink'); |
|
121 | + $controller->register_hook('TPL_METAHEADER_OUTPUT', 'BEFORE', $this, 'createRdfLink'); |
|
122 | 122 | } |
123 | 123 | } |
124 | 124 | /* |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | //die('http://pingthesemanticweb.com/rest/?url='.urlencode(getAbsUrl(wl($data->data['id'])))); |
141 | 141 | //$ping = fopen('http://pingthesemanticweb.com/rest/?url='.urlencode(getAbsUrl(wl($data->data['id']))),'r'); |
142 | 142 | // it must be a post, and it's the last revision |
143 | - $ping = @fopen('http://pingthesemanticweb.com/rest/?url='.urlencode(normalizeUri(getAbsUrl(exportlink($data->data['id'], 'siocxml', array('type'=>'post'), false, '&')))),'r'); |
|
143 | + $ping = @fopen('http://pingthesemanticweb.com/rest/?url='.urlencode(normalizeUri(getAbsUrl(exportlink($data->data['id'], 'siocxml', array('type'=>'post'), false, '&')))), 'r'); |
|
144 | 144 | @fclose($ping); |
145 | 145 | } |
146 | 146 | } |
@@ -180,19 +180,19 @@ discard block |
||
180 | 180 | switch ($sioc_type) |
181 | 181 | { |
182 | 182 | case 'container': |
183 | - $title = htmlentities("Container '".(isset($INFO['meta']['title'])?$INFO['meta']['title']:$ID)."' (SIOC document as RDF/XML)"); |
|
183 | + $title = htmlentities("Container '".(isset($INFO['meta']['title']) ? $INFO['meta']['title'] : $ID)."' (SIOC document as RDF/XML)"); |
|
184 | 184 | $queryAttr = array('type'=>'container'); |
185 | 185 | break; |
186 | 186 | |
187 | 187 | case 'user': |
188 | 188 | $title = htmlentities("User account '".$userinfo['name']."' (SIOC document as RDF/XML)"); |
189 | - $queryAttr = array('type'=>'user'); |
|
189 | + $queryAttr = array('type'=>'user'); |
|
190 | 190 | break; |
191 | 191 | |
192 | 192 | case 'post': |
193 | 193 | default: |
194 | 194 | $title = htmlentities("Article '".$INFO['meta']['title']."' (SIOC document as RDF/XML)"); |
195 | - $queryAttr = array('type'=>'post'); |
|
195 | + $queryAttr = array('type'=>'post'); |
|
196 | 196 | if (isset($_GET['rev']) && $_GET['rev'] == intval($_GET['rev'])) |
197 | 197 | $queryAttr['rev'] = $_GET['rev']; |
198 | 198 | break; |
@@ -304,17 +304,17 @@ discard block |
||
304 | 304 | return true; |
305 | 305 | } |
306 | 306 | |
307 | - if (count($accepted)>0) |
|
307 | + if (count($accepted) > 0) |
|
308 | 308 | { |
309 | 309 | // hard check, only serve RDF if it is requested first or equal to first type |
310 | 310 | |
311 | 311 | // extract accepting ratio |
312 | 312 | $test_accept = array(); |
313 | - foreach($accepted as $format) |
|
313 | + foreach ($accepted as $format) |
|
314 | 314 | { |
315 | - $formatspec = explode(';',$format); |
|
315 | + $formatspec = explode(';', $format); |
|
316 | 316 | $k = trim($formatspec[0]); |
317 | - if (count($formatspec)==2) |
|
317 | + if (count($formatspec) == 2) |
|
318 | 318 | { |
319 | 319 | $test_accept[$k] = trim($formatspec[1]); |
320 | 320 | } |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | { |
378 | 378 | global $ID, $INFO, $REV, $conf; |
379 | 379 | |
380 | - $exporter->setParameters('Article: '.$INFO['meta']['title'].($REV?' (rev '.$REV.')':''), |
|
380 | + $exporter->setParameters('Article: '.$INFO['meta']['title'].($REV ? ' (rev '.$REV.')' : ''), |
|
381 | 381 | $this->_getDokuUrl(), |
382 | 382 | $this->_getDokuUrl().'doku.php?', |
383 | 383 | 'utf-8', |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | |
387 | 387 | // create user object |
388 | 388 | // $id, $uri, $name, $email, $homepage='', $foaf_uri='', $role=false, $nick='', $sioc_url='', $foaf_url='' |
389 | - $dwuserpage_id = cleanID($this->getConf('userns')).($conf['useslash']?'/':':').$INFO['editor']; |
|
389 | + $dwuserpage_id = cleanID($this->getConf('userns')).($conf['useslash'] ? '/' : ':').$INFO['editor']; |
|
390 | 390 | /* |
391 | 391 | if ($INFO['editor'] && $this->getConf('userns')) |
392 | 392 | $pageuser = new SIOCUser($INFO['editor'], |
@@ -403,14 +403,14 @@ discard block |
||
403 | 403 | |
404 | 404 | // create wiki page object |
405 | 405 | $wikipage = new SIOCDokuWikiArticle($ID, // id |
406 | - normalizeUri($exporter->siocURL('post', $ID.($REV?$exporter->_urlseparator.'rev'.$exporter->_urlequal.$REV:''))), // url |
|
407 | - $INFO['meta']['title'].($REV?' (rev '.$REV.')':''), // subject |
|
408 | - rawWiki($ID,$REV) // body (content) |
|
406 | + normalizeUri($exporter->siocURL('post', $ID.($REV ? $exporter->_urlseparator.'rev'.$exporter->_urlequal.$REV : ''))), // url |
|
407 | + $INFO['meta']['title'].($REV ? ' (rev '.$REV.')' : ''), // subject |
|
408 | + rawWiki($ID, $REV) // body (content) |
|
409 | 409 | ); |
410 | - /* encoded content */ $wikipage->addContentEncoded(p_cached_output(wikiFN($ID,$REV),'xhtml')); |
|
410 | + /* encoded content */ $wikipage->addContentEncoded(p_cached_output(wikiFN($ID, $REV), 'xhtml')); |
|
411 | 411 | /* created */ if (isset($INFO['meta']['date']['created'])) $wikipage->addCreated(date('c', $INFO['meta']['date']['created'])); |
412 | 412 | /* or modified */ if (isset($INFO['meta']['date']['modified'])) $wikipage->addModified(date('c', $INFO['meta']['date']['modified'])); |
413 | - /* creator/modifier */ if ($INFO['editor'] && $this->getConf('userns')) $wikipage->addCreator(array('foaf:maker'=>'#'.$INFO['editor'],'sioc:modifier'=>$dwuserpage_id)); |
|
413 | + /* creator/modifier */ if ($INFO['editor'] && $this->getConf('userns')) $wikipage->addCreator(array('foaf:maker'=>'#'.$INFO['editor'], 'sioc:modifier'=>$dwuserpage_id)); |
|
414 | 414 | /* is creator */ if (isset($INFO['meta']['date']['created'])) $wikipage->isCreator(); |
415 | 415 | /* intern wiki links */ $wikipage->addLinks($INFO['meta']['relation']['references']); |
416 | 416 | |
@@ -418,8 +418,8 @@ discard block |
||
418 | 418 | if (!$REV && $this->getConf('userns') && isset($INFO['meta']['contributor'])) |
419 | 419 | { |
420 | 420 | $cont_temp = array(); |
421 | - $cont_ns = $this->getConf('userns').($conf['useslash']?'/':':'); |
|
422 | - foreach($INFO['meta']['contributor'] as $cont_id => $cont_name) |
|
421 | + $cont_ns = $this->getConf('userns').($conf['useslash'] ? '/' : ':'); |
|
422 | + foreach ($INFO['meta']['contributor'] as $cont_id => $cont_name) |
|
423 | 423 | $cont_temp[$cont_ns.$cont_id] = $cont_name; |
424 | 424 | $wikipage->addContributors($cont_temp); |
425 | 425 | } |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | |
437 | 437 | /* previous and next revision */ |
438 | 438 | $changelog = new PageChangeLog($ID); |
439 | - $pagerevs = $changelog->getRevisions(0,$conf['recent']+1); |
|
439 | + $pagerevs = $changelog->getRevisions(0, $conf['recent'] + 1); |
|
440 | 440 | $prevrev = false; $nextrev = false; |
441 | 441 | if (!$REV) |
442 | 442 | { |
@@ -453,9 +453,9 @@ discard block |
||
453 | 453 | $nextrev = $currentrev - 1; |
454 | 454 | } |
455 | 455 | } |
456 | - if ($prevrev !== false && $prevrev > -1 && page_exists($ID,$pagerevs[$prevrev])) |
|
456 | + if ($prevrev !== false && $prevrev > -1 && page_exists($ID, $pagerevs[$prevrev])) |
|
457 | 457 | /* previous revision*/ $wikipage->addVersionPrevious($pagerevs[$prevrev]); |
458 | - if ($nextrev !== false && $nextrev > -1 && page_exists($ID,$pagerevs[$nextrev])) |
|
458 | + if ($nextrev !== false && $nextrev > -1 && page_exists($ID, $pagerevs[$nextrev])) |
|
459 | 459 | /* next revision*/ $wikipage->addVersionNext($pagerevs[$nextrev]); |
460 | 460 | |
461 | 461 | /* latest revision */ if ($REV) $wikipage->addVersionLatest(); |
@@ -509,11 +509,11 @@ discard block |
||
509 | 509 | |
510 | 510 | // search next level entries (posts, sub containers) in container |
511 | 511 | require_once(DOKU_INC.'inc/search.php'); |
512 | - $dir = utf8_encodeFN(str_replace(':','/',$ID)); |
|
512 | + $dir = utf8_encodeFN(str_replace(':', '/', $ID)); |
|
513 | 513 | $entries = array(); |
514 | 514 | $posts = array(); |
515 | 515 | $containers = array(); |
516 | - search($entries,$conf['datadir'],'search_index',array('ns' => $ID),$dir); |
|
516 | + search($entries, $conf['datadir'], 'search_index', array('ns' => $ID), $dir); |
|
517 | 517 | foreach ($entries as $entry) |
518 | 518 | { |
519 | 519 | if ($entry['type'] === 'f') |
@@ -521,7 +521,7 @@ discard block |
||
521 | 521 | // wikisite |
522 | 522 | $posts[] = $entry; |
523 | 523 | } |
524 | - elseif($entry['type'] === 'd') |
|
524 | + elseif ($entry['type'] === 'd') |
|
525 | 525 | { |
526 | 526 | // sub container |
527 | 527 | $containers[] = $entry; |
@@ -532,8 +532,8 @@ discard block |
||
532 | 532 | if (count($posts) + count($containers) == 0) |
533 | 533 | $this->_exit("HTTP/1.0 404 Not Found"); |
534 | 534 | |
535 | - if (count($posts)>0) $wikicontainer->addArticles($posts); |
|
536 | - if (count($containers)>0) $wikicontainer->addContainers($containers); |
|
535 | + if (count($posts) > 0) $wikicontainer->addArticles($posts); |
|
536 | + if (count($containers) > 0) $wikicontainer->addContainers($containers); |
|
537 | 537 | |
538 | 538 | //print_r($containers);die(); |
539 | 539 | |
@@ -548,7 +548,7 @@ discard block |
||
548 | 548 | global $ID; |
549 | 549 | |
550 | 550 | // get user info |
551 | - $userinfo = getDwUserInfo($ID,$this); |
|
551 | + $userinfo = getDwUserInfo($ID, $this); |
|
552 | 552 | |
553 | 553 | // no userinfo means there is n user space or user does not exists |
554 | 554 | if ($userinfo === false) |
@@ -582,22 +582,22 @@ discard block |
||
582 | 582 | die(); |
583 | 583 | } |
584 | 584 | |
585 | - private function _getDokuUrl($url=null) |
|
585 | + private function _getDokuUrl($url = null) |
|
586 | 586 | { |
587 | 587 | return getAbsUrl($url); |
588 | 588 | } |
589 | 589 | |
590 | - private function _getDate($date, $date_alt=null) |
|
590 | + private function _getDate($date, $date_alt = null) |
|
591 | 591 | { |
592 | 592 | if (!$date) $date = $date_alt; |
593 | - return date('c',$date); |
|
593 | + return date('c', $date); |
|
594 | 594 | } |
595 | 595 | |
596 | 596 | } |
597 | 597 | |
598 | 598 | if (!function_exists('getAbsUrl')) |
599 | 599 | { |
600 | - function getAbsUrl($url=null) |
|
600 | + function getAbsUrl($url = null) |
|
601 | 601 | { |
602 | 602 | if ($url == null) $url = DOKU_BASE; |
603 | 603 | return str_replace(DOKU_BASE, DOKU_URL, $url); |
@@ -629,7 +629,7 @@ discard block |
||
629 | 629 | if (!$pobj->getConf('userns')) return false; |
630 | 630 | |
631 | 631 | // get user id |
632 | - $userid = str_replace(cleanID($pobj->getConf('userns')).($conf['useslash']?'/':':'),'',$id); |
|
632 | + $userid = str_replace(cleanID($pobj->getConf('userns')).($conf['useslash'] ? '/' : ':'), '', $id); |
|
633 | 633 | |
634 | 634 | if ($info = $auth->getUserData($userid)) |
635 | 635 | { |
@@ -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 { |
@@ -89,7 +93,9 @@ discard block |
||
89 | 93 | // test the requested action |
90 | 94 | $controller->register_hook('ACTION_ACT_PREPROCESS', 'BEFORE', $this, 'checkAction', $controller); |
91 | 95 | // pingthesemanticweb.com |
92 | - if ($this->getConf('pingsw')) $controller->register_hook('ACTION_SHOW_REDIRECT', 'BEFORE', $this, 'pingService', $controller); |
|
96 | + if ($this->getConf('pingsw')) { |
|
97 | + $controller->register_hook('ACTION_SHOW_REDIRECT', 'BEFORE', $this, 'pingService', $controller); |
|
98 | + } |
|
93 | 99 | } |
94 | 100 | |
95 | 101 | /* -- Event handlers ---------------------------------------------------- */ |
@@ -104,18 +110,18 @@ discard block |
||
104 | 110 | { |
105 | 111 | // give back rdf |
106 | 112 | $this->exportSioc(); |
107 | - } |
|
108 | - elseif (($action->data == 'show' || $action->data == 'index') && $INFO['perm'] && !defined('DOKU_MEDIADETAIL') && ($INFO['exists'] || getDwUserInfo($INFO['id'],$this)) && !isHiddenPage($INFO['id'])) |
|
113 | + } elseif (($action->data == 'show' || $action->data == 'index') && $INFO['perm'] && !defined('DOKU_MEDIADETAIL') && ($INFO['exists'] || getDwUserInfo($INFO['id'],$this)) && !isHiddenPage($INFO['id'])) |
|
109 | 114 | { |
110 | 115 | if ($this->isRdfXmlRequest()) |
111 | 116 | { |
112 | 117 | // forward to rdfxml document if requested |
113 | 118 | // print_r(headers_list()); die(); |
114 | 119 | $location = $this->createRdfLink(); |
115 | - if (function_exists('header_remove')) header_remove(); |
|
120 | + if (function_exists('header_remove')) { |
|
121 | + header_remove(); |
|
122 | + } |
|
116 | 123 | header('Location: '.$location['href'], true, 303); exit(); |
117 | - } |
|
118 | - else |
|
124 | + } else |
|
119 | 125 | { |
120 | 126 | // add meta link to html head |
121 | 127 | $controller->register_hook('TPL_METAHEADER_OUTPUT', 'BEFORE', $this, 'createRdfLink'); |
@@ -153,8 +159,9 @@ discard block |
||
153 | 159 | |
154 | 160 | // Test for hidden pages |
155 | 161 | |
156 | - if (isHiddenPage($ID)) |
|
157 | - return false; |
|
162 | + if (isHiddenPage($ID)) { |
|
163 | + return false; |
|
164 | + } |
|
158 | 165 | |
159 | 166 | // Get type of SIOC content |
160 | 167 | |
@@ -162,13 +169,16 @@ discard block |
||
162 | 169 | |
163 | 170 | // Test for valid types |
164 | 171 | |
165 | - if (!(($sioc_type == 'post' && $INFO['exists']) || $sioc_type == 'user' || $sioc_type == 'container')) |
|
166 | - return false; |
|
172 | + if (!(($sioc_type == 'post' && $INFO['exists']) || $sioc_type == 'user' || $sioc_type == 'container')) { |
|
173 | + return false; |
|
174 | + } |
|
167 | 175 | |
168 | 176 | // Test for permission |
169 | 177 | |
170 | - if (!$INFO['perm']) // not enough rights to see the wiki page |
|
178 | + if (!$INFO['perm']) { |
|
179 | + // not enough rights to see the wiki page |
|
171 | 180 | return false; |
181 | + } |
|
172 | 182 | |
173 | 183 | $userinfo = getDwUserInfo($ID, $this); |
174 | 184 | |
@@ -193,8 +203,9 @@ discard block |
||
193 | 203 | default: |
194 | 204 | $title = htmlentities("Article '".$INFO['meta']['title']."' (SIOC document as RDF/XML)"); |
195 | 205 | $queryAttr = array('type'=>'post'); |
196 | - if (isset($_GET['rev']) && $_GET['rev'] == intval($_GET['rev'])) |
|
197 | - $queryAttr['rev'] = $_GET['rev']; |
|
206 | + if (isset($_GET['rev']) && $_GET['rev'] == intval($_GET['rev'])) { |
|
207 | + $queryAttr['rev'] = $_GET['rev']; |
|
208 | + } |
|
198 | 209 | break; |
199 | 210 | } |
200 | 211 | |
@@ -206,8 +217,9 @@ discard block |
||
206 | 217 | $event->data['link'][] = $metalink; |
207 | 218 | |
208 | 219 | // set canocial link for type URIs to prevent indexing double content |
209 | - if ($_GET['type']) |
|
210 | - $event->data['link'][] = array('rel'=>'canonical', 'href'=>getAbsUrl(wl($ID))); |
|
220 | + if ($_GET['type']) { |
|
221 | + $event->data['link'][] = array('rel'=>'canonical', 'href'=>getAbsUrl(wl($ID))); |
|
222 | + } |
|
211 | 223 | } |
212 | 224 | |
213 | 225 | return $metalink; |
@@ -221,8 +233,9 @@ discard block |
||
221 | 233 | |
222 | 234 | // Test for hidden pages |
223 | 235 | |
224 | - if (isHiddenPage($ID)) |
|
225 | - $this->_exit("HTTP/1.0 404 Not Found"); |
|
236 | + if (isHiddenPage($ID)) { |
|
237 | + $this->_exit("HTTP/1.0 404 Not Found"); |
|
238 | + } |
|
226 | 239 | |
227 | 240 | // Get type of SIOC content |
228 | 241 | |
@@ -230,16 +243,21 @@ discard block |
||
230 | 243 | |
231 | 244 | // Test for valid types |
232 | 245 | |
233 | - if (!(($sioc_type == 'post' && $INFO['exists']) || $sioc_type == 'user' || $sioc_type == 'container')) |
|
234 | - $this->_exit("HTTP/1.0 404 Not Found"); |
|
246 | + if (!(($sioc_type == 'post' && $INFO['exists']) || $sioc_type == 'user' || $sioc_type == 'container')) { |
|
247 | + $this->_exit("HTTP/1.0 404 Not Found"); |
|
248 | + } |
|
235 | 249 | |
236 | 250 | // Test for permission |
237 | 251 | |
238 | - if (!$INFO['perm']) // not enough rights to see the wiki page |
|
252 | + if (!$INFO['perm']) { |
|
253 | + // not enough rights to see the wiki page |
|
239 | 254 | $this->_exit("HTTP/1.0 401 Unauthorized"); |
255 | + } |
|
240 | 256 | |
241 | 257 | // Forward to URI with explicit type attribut |
242 | - if (!isset($_GET['type'])) header('Location:'.$_SERVER['REQUEST_URI'].'&type='.$sioc_type, true, 302); |
|
258 | + if (!isset($_GET['type'])) { |
|
259 | + header('Location:'.$_SERVER['REQUEST_URI'].'&type='.$sioc_type, true, 302); |
|
260 | + } |
|
243 | 261 | |
244 | 262 | // Include SIOC libs |
245 | 263 | |
@@ -271,8 +289,9 @@ discard block |
||
271 | 289 | } |
272 | 290 | |
273 | 291 | // export |
274 | - if ($this->getConf('noindx')) |
|
275 | - header("X-Robots-Tag: noindex", true); |
|
292 | + if ($this->getConf('noindx')) { |
|
293 | + header("X-Robots-Tag: noindex", true); |
|
294 | + } |
|
276 | 295 | $rdf->export(); |
277 | 296 | |
278 | 297 | //print_r(headers_list()); die(); |
@@ -317,8 +336,7 @@ discard block |
||
317 | 336 | if (count($formatspec)==2) |
318 | 337 | { |
319 | 338 | $test_accept[$k] = trim($formatspec[1]); |
320 | - } |
|
321 | - else |
|
339 | + } else |
|
322 | 340 | { |
323 | 341 | $test_accept[$k] = 'q=1.0'; |
324 | 342 | } |
@@ -353,18 +371,15 @@ discard block |
||
353 | 371 | if ($userinfo) |
354 | 372 | { |
355 | 373 | $type = 'user'; |
356 | - } |
|
357 | - elseif (isset($_GET['do']) && $_GET['do'] == 'index') |
|
374 | + } elseif (isset($_GET['do']) && $_GET['do'] == 'index') |
|
358 | 375 | { |
359 | 376 | $type = 'container'; |
360 | - } |
|
361 | - else |
|
377 | + } else |
|
362 | 378 | { |
363 | 379 | $type = 'post'; |
364 | 380 | } |
365 | 381 | |
366 | - } |
|
367 | - else |
|
382 | + } else |
|
368 | 383 | { |
369 | 384 | $type = $_GET['type']; |
370 | 385 | } |
@@ -408,10 +423,18 @@ discard block |
||
408 | 423 | rawWiki($ID,$REV) // body (content) |
409 | 424 | ); |
410 | 425 | /* encoded content */ $wikipage->addContentEncoded(p_cached_output(wikiFN($ID,$REV),'xhtml')); |
411 | - /* created */ if (isset($INFO['meta']['date']['created'])) $wikipage->addCreated(date('c', $INFO['meta']['date']['created'])); |
|
412 | - /* or modified */ if (isset($INFO['meta']['date']['modified'])) $wikipage->addModified(date('c', $INFO['meta']['date']['modified'])); |
|
413 | - /* creator/modifier */ if ($INFO['editor'] && $this->getConf('userns')) $wikipage->addCreator(array('foaf:maker'=>'#'.$INFO['editor'],'sioc:modifier'=>$dwuserpage_id)); |
|
414 | - /* is creator */ if (isset($INFO['meta']['date']['created'])) $wikipage->isCreator(); |
|
426 | + /* created */ if (isset($INFO['meta']['date']['created'])) { |
|
427 | + $wikipage->addCreated(date('c', $INFO['meta']['date']['created'])); |
|
428 | + } |
|
429 | + /* or modified */ if (isset($INFO['meta']['date']['modified'])) { |
|
430 | + $wikipage->addModified(date('c', $INFO['meta']['date']['modified'])); |
|
431 | + } |
|
432 | + /* creator/modifier */ if ($INFO['editor'] && $this->getConf('userns')) { |
|
433 | + $wikipage->addCreator(array('foaf:maker'=>'#'.$INFO['editor'],'sioc:modifier'=>$dwuserpage_id)); |
|
434 | + } |
|
435 | + /* is creator */ if (isset($INFO['meta']['date']['created'])) { |
|
436 | + $wikipage->isCreator(); |
|
437 | + } |
|
415 | 438 | /* intern wiki links */ $wikipage->addLinks($INFO['meta']['relation']['references']); |
416 | 439 | |
417 | 440 | // contributors - only for last revision b/c of wrong meta data for older revisions |
@@ -419,8 +442,9 @@ discard block |
||
419 | 442 | { |
420 | 443 | $cont_temp = array(); |
421 | 444 | $cont_ns = $this->getConf('userns').($conf['useslash']?'/':':'); |
422 | - foreach($INFO['meta']['contributor'] as $cont_id => $cont_name) |
|
423 | - $cont_temp[$cont_ns.$cont_id] = $cont_name; |
|
445 | + foreach($INFO['meta']['contributor'] as $cont_id => $cont_name) { |
|
446 | + $cont_temp[$cont_ns.$cont_id] = $cont_name; |
|
447 | + } |
|
424 | 448 | $wikipage->addContributors($cont_temp); |
425 | 449 | } |
426 | 450 | |
@@ -429,7 +453,9 @@ discard block |
||
429 | 453 | { |
430 | 454 | require_once(DOKU_INC.'inc/fulltext.php'); |
431 | 455 | $backlinks = ft_backlinks($ID); |
432 | - if (count($backlinks) > 0) $wikipage->addBacklinks($backlinks); |
|
456 | + if (count($backlinks) > 0) { |
|
457 | + $wikipage->addBacklinks($backlinks); |
|
458 | + } |
|
433 | 459 | } |
434 | 460 | |
435 | 461 | // TODO: addLinksExtern |
@@ -442,8 +468,7 @@ discard block |
||
442 | 468 | { |
443 | 469 | // latest revision, previous rev is on top in array |
444 | 470 | $prevrev = 0; |
445 | - } |
|
446 | - else |
|
471 | + } else |
|
447 | 472 | { |
448 | 473 | // other revision |
449 | 474 | $currentrev = array_search($REV, $pagerevs); |
@@ -453,15 +478,23 @@ discard block |
||
453 | 478 | $nextrev = $currentrev - 1; |
454 | 479 | } |
455 | 480 | } |
456 | - if ($prevrev !== false && $prevrev > -1 && page_exists($ID,$pagerevs[$prevrev])) |
|
457 | - /* previous revision*/ $wikipage->addVersionPrevious($pagerevs[$prevrev]); |
|
458 | - if ($nextrev !== false && $nextrev > -1 && page_exists($ID,$pagerevs[$nextrev])) |
|
459 | - /* next revision*/ $wikipage->addVersionNext($pagerevs[$nextrev]); |
|
481 | + if ($prevrev !== false && $prevrev > -1 && page_exists($ID,$pagerevs[$prevrev])) { |
|
482 | + /* previous revision*/ $wikipage->addVersionPrevious($pagerevs[$prevrev]); |
|
483 | + } |
|
484 | + if ($nextrev !== false && $nextrev > -1 && page_exists($ID,$pagerevs[$nextrev])) { |
|
485 | + /* next revision*/ $wikipage->addVersionNext($pagerevs[$nextrev]); |
|
486 | + } |
|
460 | 487 | |
461 | - /* latest revision */ if ($REV) $wikipage->addVersionLatest(); |
|
488 | + /* latest revision */ if ($REV) { |
|
489 | + $wikipage->addVersionLatest(); |
|
490 | + } |
|
462 | 491 | // TODO: topics |
463 | - /* has_container */ if ($INFO['namespace']) $wikipage->addContainer($INFO['namespace']); |
|
464 | - /* has_space */ if ($this->getConf('owners')) $wikipage->addSite($this->getConf('owners')); |
|
492 | + /* has_container */ if ($INFO['namespace']) { |
|
493 | + $wikipage->addContainer($INFO['namespace']); |
|
494 | + } |
|
495 | + /* has_space */ if ($this->getConf('owners')) { |
|
496 | + $wikipage->addSite($this->getConf('owners')); |
|
497 | + } |
|
465 | 498 | // TODO: dc:contributor / has_modifier |
466 | 499 | // TODO: attachment (e.g. pictures in that dwns) |
467 | 500 | |
@@ -480,12 +513,10 @@ discard block |
||
480 | 513 | if ($ID == $conf['start']) |
481 | 514 | { |
482 | 515 | $title = $conf['title']; |
483 | - } |
|
484 | - elseif (isset($INFO['meta']['title'])) |
|
516 | + } elseif (isset($INFO['meta']['title'])) |
|
485 | 517 | { |
486 | 518 | $title = $INFO['meta']['title']; |
487 | - } |
|
488 | - else |
|
519 | + } else |
|
489 | 520 | { |
490 | 521 | $title = $ID; |
491 | 522 | } |
@@ -503,9 +534,15 @@ discard block |
||
503 | 534 | normalizeUri($exporter->siocURL('container', $ID)) |
504 | 535 | ); |
505 | 536 | |
506 | - /* container is type=wiki */ if ($ID == $conf['start']) $wikicontainer->isWiki(); |
|
507 | - /* sioc:name */ if ($INFO['exists']) $wikicontainer->addTitle($INFO['meta']['title']); |
|
508 | - /* has_parent */ if ($INFO['namespace']) $wikicontainer->addParent($INFO['namespace']); |
|
537 | + /* container is type=wiki */ if ($ID == $conf['start']) { |
|
538 | + $wikicontainer->isWiki(); |
|
539 | + } |
|
540 | + /* sioc:name */ if ($INFO['exists']) { |
|
541 | + $wikicontainer->addTitle($INFO['meta']['title']); |
|
542 | + } |
|
543 | + /* has_parent */ if ($INFO['namespace']) { |
|
544 | + $wikicontainer->addParent($INFO['namespace']); |
|
545 | + } |
|
509 | 546 | |
510 | 547 | // search next level entries (posts, sub containers) in container |
511 | 548 | require_once(DOKU_INC.'inc/search.php'); |
@@ -520,8 +557,7 @@ discard block |
||
520 | 557 | { |
521 | 558 | // wikisite |
522 | 559 | $posts[] = $entry; |
523 | - } |
|
524 | - elseif($entry['type'] === 'd') |
|
560 | + } elseif($entry['type'] === 'd') |
|
525 | 561 | { |
526 | 562 | // sub container |
527 | 563 | $containers[] = $entry; |
@@ -529,11 +565,16 @@ discard block |
||
529 | 565 | } |
530 | 566 | |
531 | 567 | // without sub content it can't be a container (so it does not exist as a container) |
532 | - if (count($posts) + count($containers) == 0) |
|
533 | - $this->_exit("HTTP/1.0 404 Not Found"); |
|
568 | + if (count($posts) + count($containers) == 0) { |
|
569 | + $this->_exit("HTTP/1.0 404 Not Found"); |
|
570 | + } |
|
534 | 571 | |
535 | - if (count($posts)>0) $wikicontainer->addArticles($posts); |
|
536 | - if (count($containers)>0) $wikicontainer->addContainers($containers); |
|
572 | + if (count($posts)>0) { |
|
573 | + $wikicontainer->addArticles($posts); |
|
574 | + } |
|
575 | + if (count($containers)>0) { |
|
576 | + $wikicontainer->addContainers($containers); |
|
577 | + } |
|
537 | 578 | |
538 | 579 | //print_r($containers);die(); |
539 | 580 | |
@@ -551,8 +592,9 @@ discard block |
||
551 | 592 | $userinfo = getDwUserInfo($ID,$this); |
552 | 593 | |
553 | 594 | // no userinfo means there is n user space or user does not exists |
554 | - if ($userinfo === false) |
|
555 | - $this->_exit("HTTP/1.0 404 Not Found"); |
|
595 | + if ($userinfo === false) { |
|
596 | + $this->_exit("HTTP/1.0 404 Not Found"); |
|
597 | + } |
|
556 | 598 | |
557 | 599 | $exporter->setParameters('Account: '.$userinfo['name'], |
558 | 600 | getAbsUrl(), |
@@ -589,7 +631,9 @@ discard block |
||
589 | 631 | |
590 | 632 | private function _getDate($date, $date_alt=null) |
591 | 633 | { |
592 | - if (!$date) $date = $date_alt; |
|
634 | + if (!$date) { |
|
635 | + $date = $date_alt; |
|
636 | + } |
|
593 | 637 | return date('c',$date); |
594 | 638 | } |
595 | 639 | |
@@ -599,7 +643,9 @@ discard block |
||
599 | 643 | { |
600 | 644 | function getAbsUrl($url=null) |
601 | 645 | { |
602 | - if ($url == null) $url = DOKU_BASE; |
|
646 | + if ($url == null) { |
|
647 | + $url = DOKU_BASE; |
|
648 | + } |
|
603 | 649 | return str_replace(DOKU_BASE, DOKU_URL, $url); |
604 | 650 | } |
605 | 651 | } |
@@ -612,8 +658,7 @@ discard block |
||
612 | 658 | if ($info = $auth->getUserData($user)) |
613 | 659 | { |
614 | 660 | return $info['mail']; |
615 | - } |
|
616 | - else |
|
661 | + } else |
|
617 | 662 | { |
618 | 663 | return false; |
619 | 664 | } |
@@ -626,7 +671,9 @@ discard block |
||
626 | 671 | { |
627 | 672 | global $auth, $conf; |
628 | 673 | |
629 | - if (!$pobj->getConf('userns')) return false; |
|
674 | + if (!$pobj->getConf('userns')) { |
|
675 | + return false; |
|
676 | + } |
|
630 | 677 | |
631 | 678 | // get user id |
632 | 679 | $userid = str_replace(cleanID($pobj->getConf('userns')).($conf['useslash']?'/':':'),'',$id); |
@@ -636,13 +683,11 @@ discard block |
||
636 | 683 | if ($key) |
637 | 684 | { |
638 | 685 | return $info['key']; |
639 | - } |
|
640 | - else |
|
686 | + } else |
|
641 | 687 | { |
642 | 688 | return $info; |
643 | 689 | } |
644 | - } |
|
645 | - else |
|
690 | + } else |
|
646 | 691 | { |
647 | 692 | return false; |
648 | 693 | } |
@@ -664,7 +709,9 @@ discard block |
||
664 | 709 | |
665 | 710 | // test separator |
666 | 711 | $sep = '&'; |
667 | - if (strpos($query, '&') !== false) $sep = '&'; |
|
712 | + if (strpos($query, '&') !== false) { |
|
713 | + $sep = '&'; |
|
714 | + } |
|
668 | 715 | $attr = explode($sep, $query); |
669 | 716 | |
670 | 717 | sort($attr); |