| Total Complexity | 102 |
| Total Lines | 559 |
| Duplicated Lines | 0 % |
| Changes | 4 | ||
| Bugs | 0 | Features | 2 |
Complex classes like action_plugin_dokusioc often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use action_plugin_dokusioc, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 71 | class action_plugin_dokusioc extends DokuWiki_Action_Plugin { |
||
| 72 | |||
| 73 | var $agentlink = 'http://eye48.com/go/dokusioc?v=0.1.2'; |
||
| 74 | |||
| 75 | |||
| 76 | /* -- Methods to manage plugin ------------------------------------------ */ |
||
| 77 | |||
| 78 | /** |
||
| 79 | * Register its handlers with the DokuWiki's event controller |
||
| 80 | */ |
||
| 81 | public function register(Doku_Event_Handler $controller) |
||
| 82 | { |
||
| 83 | //print_r(headers_list()); die(); |
||
| 84 | |||
| 85 | // test the requested action |
||
| 86 | $controller->register_hook('ACTION_ACT_PREPROCESS', 'BEFORE', $this, 'checkAction', $controller); |
||
| 87 | // pingthesemanticweb.com |
||
| 88 | if ($this->getConf('pingsw')) { |
||
| 89 | $controller->register_hook('ACTION_SHOW_REDIRECT', 'BEFORE', $this, 'pingService', $controller); |
||
| 90 | } |
||
| 91 | } |
||
| 92 | |||
| 93 | /* -- Event handlers ---------------------------------------------------- */ |
||
| 94 | |||
| 95 | public function checkAction($action, $controller) |
||
| 120 | } |
||
| 121 | } |
||
| 122 | /* |
||
| 123 | else |
||
| 124 | { |
||
| 125 | print_r(array($action->data, $INFO['perm'], defined('DOKU_MEDIADETAIL'), $INFO['exists'], getDwUserInfo($INFO['id'],$this), isHiddenPage($INFO['id']))); |
||
| 126 | die(); |
||
| 127 | } |
||
| 128 | */ |
||
| 129 | } |
||
| 130 | |||
| 131 | public function pingService($data, $controller) |
||
| 132 | { |
||
| 133 | // TODO: test acl |
||
| 134 | // TODO: write in message queue (?) |
||
| 135 | |||
| 136 | if ($data->data['preact'] == array('save'=>'Save') || $data->data['preact'] == 'save') |
||
| 137 | { |
||
| 138 | //die('http://pingthesemanticweb.com/rest/?url='.urlencode(getAbsUrl(wl($data->data['id'])))); |
||
| 139 | //$ping = fopen('http://pingthesemanticweb.com/rest/?url='.urlencode(getAbsUrl(wl($data->data['id']))),'r'); |
||
| 140 | // it must be a post, and it's the last revision |
||
| 141 | $ping = @fopen('http://pingthesemanticweb.com/rest/?url='.urlencode(normalizeUri(getAbsUrl(exportlink($data->data['id'], 'siocxml', array('type'=>'post'), false, '&')))), 'r'); |
||
|
|
|||
| 142 | @fclose($ping); |
||
| 143 | } |
||
| 144 | } |
||
| 145 | |||
| 146 | /** |
||
| 147 | */ |
||
| 148 | public function createRdfLink($event = null, $param = null) |
||
| 149 | { |
||
| 150 | global $ID, $INFO, $conf; |
||
| 151 | |||
| 152 | // Test for hidden pages |
||
| 153 | |||
| 154 | if (isHiddenPage($ID)) { |
||
| 155 | return false; |
||
| 156 | } |
||
| 157 | |||
| 158 | // Get type of SIOC content |
||
| 159 | |||
| 160 | $sioc_type = $this->_getContenttype(); |
||
| 161 | |||
| 162 | // Test for valid types |
||
| 163 | |||
| 164 | if (!(($sioc_type == 'post' && $INFO['exists']) || $sioc_type == 'user' || $sioc_type == 'container')) { |
||
| 165 | return false; |
||
| 166 | } |
||
| 167 | |||
| 168 | // Test for permission |
||
| 169 | |||
| 170 | if (!$INFO['perm']) { |
||
| 171 | // not enough rights to see the wiki page |
||
| 172 | return false; |
||
| 173 | } |
||
| 174 | |||
| 175 | $userinfo = getDwUserInfo($ID, $this); |
||
| 176 | |||
| 177 | // Create attributes for meta link |
||
| 178 | |||
| 179 | $metalink['type'] = 'application/rdf+xml'; |
||
| 180 | $metalink['rel'] = 'meta'; |
||
| 181 | |||
| 182 | switch ($sioc_type) |
||
| 183 | { |
||
| 184 | case 'container': |
||
| 185 | $title = htmlentities("Container '".(isset($INFO['meta']['title']) ? $INFO['meta']['title'] : $ID)."' (SIOC document as RDF/XML)"); |
||
| 186 | $queryAttr = array('type'=>'container'); |
||
| 187 | break; |
||
| 188 | |||
| 189 | case 'user': |
||
| 190 | $title = htmlentities("User account '".$userinfo['name']."' (SIOC document as RDF/XML)"); |
||
| 191 | $queryAttr = array('type'=>'user'); |
||
| 192 | break; |
||
| 193 | |||
| 194 | case 'post': |
||
| 195 | default: |
||
| 196 | $title = htmlentities("Article '".$INFO['meta']['title']."' (SIOC document as RDF/XML)"); |
||
| 197 | $queryAttr = array('type'=>'post'); |
||
| 198 | if (isset($_GET['rev']) && $_GET['rev'] == intval($_GET['rev'])) { |
||
| 199 | $queryAttr['rev'] = $_GET['rev']; |
||
| 200 | } |
||
| 201 | break; |
||
| 202 | } |
||
| 203 | |||
| 204 | $metalink['title'] = $title; |
||
| 205 | $metalink['href'] = normalizeUri(getAbsUrl(exportlink($ID, 'siocxml', $queryAttr, false, '&'))); |
||
| 206 | |||
| 207 | if ($event !== null) |
||
| 208 | { |
||
| 209 | $event->data['link'][] = $metalink; |
||
| 210 | |||
| 211 | // set canocial link for type URIs to prevent indexing double content |
||
| 212 | if ($_GET['type']) { |
||
| 213 | $event->data['link'][] = array('rel'=>'canonical', 'href'=>getAbsUrl(wl($ID))); |
||
| 214 | } |
||
| 215 | } |
||
| 216 | |||
| 217 | return $metalink; |
||
| 218 | } |
||
| 219 | |||
| 220 | /* -- public class methods ---------------------------------------------- */ |
||
| 221 | |||
| 222 | public function exportSioc() |
||
| 223 | { |
||
| 224 | global $ID, $INFO, $conf, $REV, $auth; |
||
| 225 | |||
| 226 | // Test for hidden pages |
||
| 227 | |||
| 228 | if (isHiddenPage($ID)) { |
||
| 229 | $this->_exit("HTTP/1.0 404 Not Found"); |
||
| 230 | } |
||
| 231 | |||
| 232 | // Get type of SIOC content |
||
| 233 | |||
| 234 | $sioc_type = $this->_getContenttype(); |
||
| 235 | |||
| 236 | // Test for valid types |
||
| 237 | |||
| 238 | if (!(($sioc_type == 'post' && $INFO['exists']) || $sioc_type == 'user' || $sioc_type == 'container')) { |
||
| 239 | $this->_exit("HTTP/1.0 404 Not Found"); |
||
| 240 | } |
||
| 241 | |||
| 242 | // Test for permission |
||
| 243 | |||
| 244 | if (!$INFO['perm']) { |
||
| 245 | // not enough rights to see the wiki page |
||
| 246 | $this->_exit("HTTP/1.0 401 Unauthorized"); |
||
| 247 | } |
||
| 248 | |||
| 249 | // Forward to URI with explicit type attribut |
||
| 250 | if (!isset($_GET['type'])) { |
||
| 251 | header('Location:'.$_SERVER['REQUEST_URI'].'&type='.$sioc_type, true, 302); |
||
| 252 | } |
||
| 253 | |||
| 254 | // Include SIOC libs |
||
| 255 | |||
| 256 | require_once(dirname(__FILE__).DIRECTORY_SEPARATOR.'lib'.DIRECTORY_SEPARATOR.'sioc_inc.php'); |
||
| 257 | require_once(dirname(__FILE__).DIRECTORY_SEPARATOR.'lib'.DIRECTORY_SEPARATOR.'sioc_dokuwiki.php'); |
||
| 258 | |||
| 259 | // Create exporter |
||
| 260 | |||
| 261 | $rdf = new SIOCExporter(); |
||
| 262 | $rdf->_profile_url = normalizeUri(getAbsUrl(exportlink($ID, 'siocxml', array('type'=>$sioc_type), false, '&'))); |
||
| 263 | $rdf->setURLParameters('type', 'id', 'page', false); |
||
| 264 | |||
| 265 | // Create SIOC-RDF content |
||
| 266 | |||
| 267 | switch ($sioc_type) |
||
| 268 | { |
||
| 269 | case 'container': |
||
| 270 | $rdf = $this->_exportContainercontent($rdf); |
||
| 271 | break; |
||
| 272 | |||
| 273 | case 'user': |
||
| 274 | $rdf = $this->_exportUsercontent($rdf); |
||
| 275 | break; |
||
| 276 | |||
| 277 | case 'post': |
||
| 278 | default: |
||
| 279 | $rdf = $this->_exportPostcontent($rdf); |
||
| 280 | break; |
||
| 281 | } |
||
| 282 | |||
| 283 | // export |
||
| 284 | if ($this->getConf('noindx')) { |
||
| 285 | header("X-Robots-Tag: noindex", true); |
||
| 286 | } |
||
| 287 | $rdf->export(); |
||
| 288 | |||
| 289 | //print_r(headers_list()); die(); |
||
| 290 | die(); |
||
| 291 | } |
||
| 292 | |||
| 293 | public function isRdfXmlRequest() |
||
| 294 | { |
||
| 295 | // get accepted types |
||
| 296 | $http_accept = trim($_SERVER['HTTP_ACCEPT']); |
||
| 297 | |||
| 298 | // save accepted types in array |
||
| 299 | $accepted = explode(',', $http_accept); |
||
| 300 | |||
| 301 | /* |
||
| 302 | $debuginfo = implode(' // ', array(date('c',$_SERVER['REQUEST_TIME']), $_SERVER['HTTP_REFERER'], $_SERVER['REMOTE_ADDR'], $_SERVER['REMOTE_HOST'], $_SERVER['HTTP_USER_AGENT'], $_SERVER['HTTP_ACCEPT'])); |
||
| 303 | global $conf; //print_r($conf); die(); |
||
| 304 | //die($debuginfo); |
||
| 305 | $debuglog = @fopen($conf['tmpdir'].DIRECTORY_SEPARATOR.'requests.log', 'ab'); |
||
| 306 | @fwrite($debuglog, $debuginfo."\n"); |
||
| 307 | @fclose($debuglog); |
||
| 308 | @chmod($conf['tmpdir'].DIRECTORY_SEPARATOR.'requests.log', 0777); |
||
| 309 | */ |
||
| 310 | |||
| 311 | // soft check, route to RDF when client requests it (don't check quality of request) |
||
| 312 | |||
| 313 | if ($this->getConf('softck') && strpos($_SERVER['HTTP_ACCEPT'], 'application/rdf+xml') !== false) |
||
| 314 | { |
||
| 315 | return true; |
||
| 316 | } |
||
| 317 | |||
| 318 | if (count($accepted) > 0) |
||
| 319 | { |
||
| 320 | // hard check, only serve RDF if it is requested first or equal to first type |
||
| 321 | |||
| 322 | // extract accepting ratio |
||
| 323 | $test_accept = array(); |
||
| 324 | foreach ($accepted as $format) |
||
| 325 | { |
||
| 326 | $formatspec = explode(';', $format); |
||
| 327 | $k = trim($formatspec[0]); |
||
| 328 | if (count($formatspec) == 2) |
||
| 329 | { |
||
| 330 | $test_accept[$k] = trim($formatspec[1]); |
||
| 331 | } else |
||
| 332 | { |
||
| 333 | $test_accept[$k] = 'q=1.0'; |
||
| 334 | } |
||
| 335 | } |
||
| 336 | |||
| 337 | // sort by ratio |
||
| 338 | arsort($test_accept); $accepted_order = array_keys($test_accept); |
||
| 339 | |||
| 340 | if ($accepted_order[0] == 'application/rdf+xml' || $test_accept['application/rdf+xml'] == 'q=1.0') |
||
| 341 | { |
||
| 342 | return true; |
||
| 343 | } |
||
| 344 | } |
||
| 345 | |||
| 346 | // print_r($accepted_order);print_r($test_accept);die(); |
||
| 347 | |||
| 348 | return false; |
||
| 349 | |||
| 350 | } |
||
| 351 | |||
| 352 | /* -- private helpers --------------------------------------------------- */ |
||
| 353 | |||
| 354 | private function _getContenttype() |
||
| 355 | { |
||
| 356 | global $ID, $conf; |
||
| 357 | |||
| 358 | // check for type if unknown |
||
| 359 | if (!$_GET['type']) |
||
| 360 | { |
||
| 361 | $userinfo = getDwUserInfo($ID, $this); |
||
| 362 | |||
| 363 | if ($userinfo) |
||
| 364 | { |
||
| 365 | $type = 'user'; |
||
| 366 | } elseif (isset($_GET['do']) && $_GET['do'] == 'index') |
||
| 367 | { |
||
| 368 | $type = 'container'; |
||
| 369 | } else |
||
| 370 | { |
||
| 371 | $type = 'post'; |
||
| 372 | } |
||
| 373 | |||
| 374 | } else |
||
| 375 | { |
||
| 376 | $type = $_GET['type']; |
||
| 377 | } |
||
| 378 | |||
| 379 | return $type; |
||
| 380 | |||
| 381 | } |
||
| 382 | |||
| 383 | private function _exportPostcontent($exporter) |
||
| 384 | { |
||
| 385 | global $ID, $INFO, $REV, $conf; |
||
| 386 | |||
| 387 | $exporter->setParameters('Article: '.$INFO['meta']['title'].($REV ? ' (rev '.$REV.')' : ''), |
||
| 388 | $this->_getDokuUrl(), |
||
| 389 | $this->_getDokuUrl().'doku.php?', |
||
| 390 | 'utf-8', |
||
| 391 | $this->agentlink |
||
| 392 | ); |
||
| 393 | |||
| 394 | // create user object |
||
| 395 | // $id, $uri, $name, $email, $homepage='', $foaf_uri='', $role=false, $nick='', $sioc_url='', $foaf_url='' |
||
| 396 | $dwuserpage_id = cleanID($this->getConf('userns')).($conf['useslash'] ? '/' : ':').$INFO['editor']; |
||
| 397 | /* |
||
| 398 | if ($INFO['editor'] && $this->getConf('userns')) |
||
| 399 | $pageuser = new SIOCUser($INFO['editor'], |
||
| 400 | normalizeUri(getAbsUrl(exportlink($dwuserpage_id, 'siocxml', array('type'=>'user'), false, '&'))), // user page |
||
| 401 | $INFO['meta']['contributor'][$INFO['editor']], |
||
| 402 | getDwUserInfo($dwuserpage_id,$this,'mail'), |
||
| 403 | '', // no homepage is saved for dokuwiki user |
||
| 404 | '#'.$INFO['editor'], // local uri |
||
| 405 | false, // no roles right now |
||
| 406 | '', // no nick name is saved for dokuwiki user |
||
| 407 | normalizeUri($exporter->siocURL('user', $dwuserpage_id)) |
||
| 408 | ); |
||
| 409 | */ |
||
| 410 | |||
| 411 | // create wiki page object |
||
| 412 | $wikipage = new SIOCDokuWikiArticle($ID, // id |
||
| 413 | normalizeUri($exporter->siocURL('post', $ID.($REV ? $exporter->_urlseparator.'rev'.$exporter->_urlequal.$REV : ''))), // url |
||
| 414 | $INFO['meta']['title'].($REV ? ' (rev '.$REV.')' : ''), // subject |
||
| 415 | rawWiki($ID, $REV) // body (content) |
||
| 416 | ); |
||
| 417 | /* encoded content */ $wikipage->addContentEncoded(p_cached_output(wikiFN($ID, $REV), 'xhtml')); |
||
| 418 | /* created */ if (isset($INFO['meta']['date']['created'])) { |
||
| 419 | $wikipage->addCreated(date('c', $INFO['meta']['date']['created'])); |
||
| 420 | } |
||
| 421 | /* or modified */ if (isset($INFO['meta']['date']['modified'])) { |
||
| 422 | $wikipage->addModified(date('c', $INFO['meta']['date']['modified'])); |
||
| 423 | } |
||
| 424 | /* creator/modifier */ if ($INFO['editor'] && $this->getConf('userns')) { |
||
| 425 | $wikipage->addCreator(array('foaf:maker'=>'#'.$INFO['editor'], 'sioc:modifier'=>$dwuserpage_id)); |
||
| 426 | } |
||
| 427 | /* is creator */ if (isset($INFO['meta']['date']['created'])) { |
||
| 428 | $wikipage->isCreator(); |
||
| 429 | } |
||
| 430 | /* intern wiki links */ $wikipage->addLinks($INFO['meta']['relation']['references']); |
||
| 431 | |||
| 432 | // contributors - only for last revision b/c of wrong meta data for older revisions |
||
| 433 | if (!$REV && $this->getConf('userns') && isset($INFO['meta']['contributor'])) |
||
| 434 | { |
||
| 435 | $cont_temp = array(); |
||
| 436 | $cont_ns = $this->getConf('userns').($conf['useslash'] ? '/' : ':'); |
||
| 437 | foreach ($INFO['meta']['contributor'] as $cont_id => $cont_name) { |
||
| 438 | $cont_temp[$cont_ns.$cont_id] = $cont_name; |
||
| 439 | } |
||
| 440 | $wikipage->addContributors($cont_temp); |
||
| 441 | } |
||
| 442 | |||
| 443 | // backlinks - only for last revision |
||
| 444 | if (!$REV) |
||
| 445 | { |
||
| 446 | require_once(DOKU_INC.'inc/fulltext.php'); |
||
| 447 | $backlinks = ft_backlinks($ID); |
||
| 448 | if (count($backlinks) > 0) { |
||
| 449 | $wikipage->addBacklinks($backlinks); |
||
| 450 | } |
||
| 451 | } |
||
| 452 | |||
| 453 | // TODO: addLinksExtern |
||
| 454 | |||
| 455 | /* previous and next revision */ |
||
| 456 | $changelog = new PageChangeLog($ID); |
||
| 457 | $pagerevs = $changelog->getRevisions(0, $conf['recent'] + 1); |
||
| 458 | $prevrev = false; $nextrev = false; |
||
| 459 | if (!$REV) |
||
| 460 | { |
||
| 461 | // latest revision, previous rev is on top in array |
||
| 462 | $prevrev = 0; |
||
| 463 | } else |
||
| 464 | { |
||
| 465 | // other revision |
||
| 466 | $currentrev = array_search($REV, $pagerevs); |
||
| 467 | if ($currentrev !== false) |
||
| 468 | { |
||
| 469 | $prevrev = $currentrev + 1; |
||
| 470 | $nextrev = $currentrev - 1; |
||
| 471 | } |
||
| 472 | } |
||
| 473 | if ($prevrev !== false && $prevrev > -1 && page_exists($ID, $pagerevs[$prevrev])) { |
||
| 474 | /* previous revision*/ $wikipage->addVersionPrevious($pagerevs[$prevrev]); |
||
| 475 | } |
||
| 476 | if ($nextrev !== false && $nextrev > -1 && page_exists($ID, $pagerevs[$nextrev])) { |
||
| 477 | /* next revision*/ $wikipage->addVersionNext($pagerevs[$nextrev]); |
||
| 478 | } |
||
| 479 | |||
| 480 | /* latest revision */ if ($REV) { |
||
| 481 | $wikipage->addVersionLatest(); |
||
| 482 | } |
||
| 483 | // TODO: topics |
||
| 484 | /* has_container */ if ($INFO['namespace']) { |
||
| 485 | $wikipage->addContainer($INFO['namespace']); |
||
| 486 | } |
||
| 487 | /* has_space */ if ($this->getConf('owners')) { |
||
| 488 | $wikipage->addSite($this->getConf('owners')); |
||
| 489 | } |
||
| 490 | // TODO: dc:contributor / has_modifier |
||
| 491 | // TODO: attachment (e.g. pictures in that dwns) |
||
| 492 | |||
| 493 | // add wiki page to exporter |
||
| 494 | $exporter->addObject($wikipage); |
||
| 495 | //if ($INFO['editor'] && $this->getConf('userns')) $exporter->addObject($pageuser); |
||
| 496 | |||
| 497 | return $exporter; |
||
| 498 | |||
| 499 | } |
||
| 500 | |||
| 501 | private function _exportContainercontent($exporter) |
||
| 502 | { |
||
| 503 | global $ID, $INFO, $conf; |
||
| 504 | |||
| 505 | if ($ID == $conf['start']) |
||
| 506 | { |
||
| 507 | $title = $conf['title']; |
||
| 508 | } elseif (isset($INFO['meta']['title'])) |
||
| 509 | { |
||
| 510 | $title = $INFO['meta']['title']; |
||
| 511 | } else |
||
| 512 | { |
||
| 513 | $title = $ID; |
||
| 514 | } |
||
| 515 | |||
| 516 | |||
| 517 | $exporter->setParameters('Container: '.$title, |
||
| 518 | getAbsUrl(), |
||
| 519 | getAbsUrl().'doku.php?', |
||
| 520 | 'utf-8', |
||
| 521 | $this->agentlink |
||
| 522 | ); |
||
| 523 | |||
| 524 | // create container object |
||
| 525 | $wikicontainer = new SIOCDokuWikiContainer($ID, |
||
| 526 | normalizeUri($exporter->siocURL('container', $ID)) |
||
| 527 | ); |
||
| 528 | |||
| 529 | /* container is type=wiki */ if ($ID == $conf['start']) { |
||
| 530 | $wikicontainer->isWiki(); |
||
| 531 | } |
||
| 532 | /* sioc:name */ if ($INFO['exists']) { |
||
| 533 | $wikicontainer->addTitle($INFO['meta']['title']); |
||
| 534 | } |
||
| 535 | /* has_parent */ if ($INFO['namespace']) { |
||
| 536 | $wikicontainer->addParent($INFO['namespace']); |
||
| 537 | } |
||
| 538 | |||
| 539 | // search next level entries (posts, sub containers) in container |
||
| 540 | require_once(DOKU_INC.'inc/search.php'); |
||
| 541 | $dir = utf8_encodeFN(str_replace(':', '/', $ID)); |
||
| 542 | $entries = array(); |
||
| 543 | $posts = array(); |
||
| 544 | $containers = array(); |
||
| 545 | search($entries, $conf['datadir'], 'search_index', array('ns' => $ID), $dir); |
||
| 546 | foreach ($entries as $entry) |
||
| 547 | { |
||
| 548 | if ($entry['type'] === 'f') |
||
| 549 | { |
||
| 550 | // wikisite |
||
| 551 | $posts[] = $entry; |
||
| 552 | } elseif ($entry['type'] === 'd') |
||
| 553 | { |
||
| 554 | // sub container |
||
| 555 | $containers[] = $entry; |
||
| 556 | } |
||
| 557 | } |
||
| 558 | |||
| 559 | // without sub content it can't be a container (so it does not exist as a container) |
||
| 560 | if (count($posts) + count($containers) == 0) { |
||
| 561 | $this->_exit("HTTP/1.0 404 Not Found"); |
||
| 562 | } |
||
| 563 | |||
| 564 | if (count($posts) > 0) { |
||
| 565 | $wikicontainer->addArticles($posts); |
||
| 566 | } |
||
| 567 | if (count($containers) > 0) { |
||
| 568 | $wikicontainer->addContainers($containers); |
||
| 569 | } |
||
| 570 | |||
| 571 | //print_r($containers);die(); |
||
| 572 | |||
| 573 | // add container to exporter |
||
| 574 | $exporter->addObject($wikicontainer); |
||
| 575 | |||
| 576 | return $exporter; |
||
| 577 | } |
||
| 578 | |||
| 579 | private function _exportUsercontent($exporter) |
||
| 580 | { |
||
| 581 | global $ID; |
||
| 582 | |||
| 583 | // get user info |
||
| 584 | $userinfo = getDwUserInfo($ID, $this); |
||
| 585 | |||
| 586 | // no userinfo means there is n user space or user does not exists |
||
| 587 | if ($userinfo === false) { |
||
| 588 | $this->_exit("HTTP/1.0 404 Not Found"); |
||
| 589 | } |
||
| 590 | |||
| 591 | $exporter->setParameters('Account: '.$userinfo['name'], |
||
| 592 | getAbsUrl(), |
||
| 593 | getAbsUrl().'doku.php?', |
||
| 594 | 'utf-8', |
||
| 595 | $this->agentlink |
||
| 596 | ); |
||
| 597 | // create user object |
||
| 598 | //print_r($userinfo); die(); |
||
| 599 | $wikiuser = new SIOCDokuWikiUser($ID, |
||
| 600 | normalizeUri($exporter->siocURL('user', $ID)), |
||
| 601 | $userid, |
||
| 602 | $userinfo['name'], |
||
| 603 | $userinfo['mail']); |
||
| 604 | /* TODO: avatar (using Gravatar) */ |
||
| 605 | /* TODO: creator_of */ |
||
| 606 | // add user to exporter |
||
| 607 | $exporter->addObject($wikiuser); |
||
| 608 | |||
| 609 | //print_r(headers_list());die(); |
||
| 610 | return $exporter; |
||
| 611 | } |
||
| 612 | |||
| 613 | private function _exit($headermsg) |
||
| 617 | } |
||
| 618 | |||
| 619 | private function _getDokuUrl($url = null) |
||
| 622 | } |
||
| 623 | |||
| 624 | private function _getDate($date, $date_alt = null) |
||
| 625 | { |
||
| 630 | } |
||
| 631 | |||
| 632 | } |
||
| 633 | |||
| 634 | if (!function_exists('getAbsUrl')) |
||
| 718 |