Passed
Push — master ( b331d1...623465 )
by Mark
36s queued 12s
created
action.php 1 patch
Braces   +60 added lines, -30 removed lines patch added patch discarded remove patch
@@ -68,8 +68,12 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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');
@@ -197,8 +203,9 @@  discard block
 block discarded – undo
197 203
             default:
198 204
                 $title = htmlentities("Article '".$INFO['meta']['title']."' (SIOC document as RDF/XML)");
199 205
                 $queryAttr = array('type'=>'post');
200
-                if (isset($_GET['rev']) && $_GET['rev'] == intval($_GET['rev']))
201
-                    $queryAttr['rev'] = $_GET['rev'];
206
+                if (isset($_GET['rev']) && $_GET['rev'] == intval($_GET['rev'])) {
207
+                                    $queryAttr['rev'] = $_GET['rev'];
208
+                }
202 209
                 break;
203 210
         }
204 211
     
@@ -416,10 +423,18 @@  discard block
 block discarded – undo
416 423
                                             rawWiki($ID, $REV) // body (content)
417 424
                                             );
418 425
         /* encoded content   */ $wikipage->addContentEncoded(p_cached_output(wikiFN($ID, $REV), 'xhtml'));
419
-        /* created           */ if (isset($INFO['meta']['date']['created'])) $wikipage->addCreated(date('c', $INFO['meta']['date']['created']));
420
-        /* or modified       */ if (isset($INFO['meta']['date']['modified'])) $wikipage->addModified(date('c', $INFO['meta']['date']['modified']));
421
-        /* creator/modifier  */ if ($INFO['editor'] && $this->getConf('userns')) $wikipage->addCreator(array('foaf:maker'=>'#'.$INFO['editor'], 'sioc:modifier'=>$dwuserpage_id));
422
-        /* 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
+        }
423 438
         /* intern wiki links */ $wikipage->addLinks($INFO['meta']['relation']['references']);
424 439
         
425 440
         // contributors - only for last revision b/c of wrong meta data for older revisions
@@ -427,8 +442,9 @@  discard block
 block discarded – undo
427 442
         {
428 443
             $cont_temp = array();
429 444
             $cont_ns = $this->getConf('userns').($conf['useslash'] ? '/' : ':');
430
-            foreach ($INFO['meta']['contributor'] as $cont_id => $cont_name)
431
-                $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
+            }
432 448
             $wikipage->addContributors($cont_temp);
433 449
         }
434 450
         
@@ -462,15 +478,23 @@  discard block
 block discarded – undo
462 478
                 $nextrev = $currentrev - 1;
463 479
             }
464 480
         }
465
-        if ($prevrev !== false && $prevrev > -1 && page_exists($ID, $pagerevs[$prevrev]))
466
-        /* previous revision*/ $wikipage->addVersionPrevious($pagerevs[$prevrev]);
467
-        if ($nextrev !== false && $nextrev > -1 && page_exists($ID, $pagerevs[$nextrev]))
468
-        /* 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
+        }
469 487
 
470
-        /* latest revision   */ if ($REV) $wikipage->addVersionLatest();
488
+        /* latest revision   */ if ($REV) {
489
+          $wikipage->addVersionLatest();
490
+        }
471 491
         // TODO: topics
472
-        /* has_container     */ if ($INFO['namespace']) $wikipage->addContainer($INFO['namespace']); 
473
-        /* 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
+        }
474 498
         // TODO: dc:contributor / has_modifier
475 499
         // TODO: attachment (e.g. pictures in that dwns)
476 500
         
@@ -533,8 +557,7 @@  discard block
 block discarded – undo
533 557
             {
534 558
                 // wikisite
535 559
                 $posts[] = $entry;
536
-            }
537
-            elseif ($entry['type'] === 'd')
560
+            } elseif ($entry['type'] === 'd')
538 561
             {
539 562
                 // sub container
540 563
                 $containers[] = $entry;
@@ -542,11 +565,16 @@  discard block
 block discarded – undo
542 565
         }
543 566
         
544 567
         // without sub content it can't be a container (so it does not exist as a container)
545
-        if (count($posts) + count($containers) == 0)
546
-            $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
+        }
547 571
         
548
-        if (count($posts) > 0) $wikicontainer->addArticles($posts);
549
-        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
+        }
550 578
 
551 579
         //print_r($containers);die();
552 580
         
@@ -603,7 +631,9 @@  discard block
 block discarded – undo
603 631
     
604 632
     private function _getDate($date, $date_alt = null)
605 633
     {
606
-        if (!$date) $date = $date_alt;
634
+        if (!$date) {
635
+          $date = $date_alt;
636
+        }
607 637
         return date('c', $date);
608 638
     }
609 639
     
Please login to merge, or discard this patch.