Completed
Pull Request — master (#32)
by Mark
30s
created
helper/sitemap.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -33,9 +33,9 @@  discard block
 block discarded – undo
33 33
     public function __construct() {
34 34
         global $conf;
35 35
         $idx_dir = $conf['indexdir'];
36
-        if(!@file_exists($idx_dir . '/spatial.idx')) {
36
+        if (!@file_exists($idx_dir . '/spatial.idx')) {
37 37
             $indexer = plugin_load('helper', 'spatialhelper_index');
38
-            if($indexer !== null) {
38
+            if ($indexer !== null) {
39 39
                 $indexer->generateSpatialIndex();
40 40
             }
41 41
         }
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
         $RSSstart .= '<feed xmlns="http://www.w3.org/2005/Atom" xmlns:georss="http://www.georss.org/georss" ';
83 83
         $RSSstart .= 'xmlns:dc="http://purl.org/dc/elements/1.1/">' . DOKU_LF;
84 84
         $RSSstart .= '<title>' . $conf['title'] . ' spatial feed</title>' . DOKU_LF;
85
-        if(!empty($conf['tagline'])) {
85
+        if (!empty($conf['tagline'])) {
86 86
             $RSSstart .= '<subtitle>' . $conf['tagline'] . '</subtitle>' . DOKU_LF;
87 87
         }
88 88
         $RSSstart .= '<dc:publisher>' . $conf['title'] . '</dc:publisher>' . DOKU_LF;
@@ -101,12 +101,12 @@  discard block
 block discarded – undo
101 101
         $fh = fopen(mediaFN($mediaID), 'wb');
102 102
         fwrite($fh, $RSSstart);
103 103
 
104
-        foreach($this->spatial_idx as $idxEntry) {
104
+        foreach ($this->spatial_idx as $idxEntry) {
105 105
             // get list of id's
106
-            foreach($idxEntry as $id) {
106
+            foreach ($idxEntry as $id) {
107 107
                 // for document item in the index
108
-                if(strpos($id, 'media__', 0) !== 0) {
109
-                    if($this->skipPage($id, $namespace)) {
108
+                if (strpos($id, 'media__', 0) !== 0) {
109
+                    if ($this->skipPage($id, $namespace)) {
110 110
                         continue;
111 111
                     }
112 112
 
@@ -120,11 +120,11 @@  discard block
 block discarded – undo
120 120
                     $entry .= '  <summary>' . $desc . '</summary>' . DOKU_LF;
121 121
                     $entry .= '  <georss:point>' . $meta['geo']['lat'] . ' ' . $meta['geo']['lon']
122 122
                         . '</georss:point>' . DOKU_LF;
123
-                    if(isset($meta['geo']['alt'])) {
123
+                    if (isset($meta['geo']['alt'])) {
124 124
                         $entry .= '  <georss:elev>' . $meta['geo']['alt'] . '</georss:elev>' . DOKU_LF;
125 125
                     }
126 126
                     $entry .= '  <link href="' . wl($id) . '" rel="alternate" type="text/html" />' . DOKU_LF;
127
-                    if(empty($meta['creator'])) {
127
+                    if (empty($meta['creator'])) {
128 128
                         $meta['creator'] = $conf['title'];
129 129
                     }
130 130
                     $entry .= '  <author><name>' . $meta['creator'] . '</name></author>' . DOKU_LF;
@@ -147,16 +147,16 @@  discard block
 block discarded – undo
147 147
      */
148 148
     private function skipPage(string $id, string $namespace): bool {
149 149
         dbglog("helper_plugin_spatialhelper_sitemap::skipPage, check for $id in $namespace");
150
-        if(isHiddenPage($id)) {
150
+        if (isHiddenPage($id)) {
151 151
             return true;
152 152
         }
153
-        if(auth_aclcheck($id, '', null) < AUTH_READ) {
153
+        if (auth_aclcheck($id, '', null) < AUTH_READ) {
154 154
             return true;
155 155
         }
156 156
 
157
-        if(!empty($namespace)) {
157
+        if (!empty($namespace)) {
158 158
             // only if id is in or below namespace
159
-            if(0 !== strpos(getNS($id), $namespace)) {
159
+            if (0 !== strpos(getNS($id), $namespace)) {
160 160
                 // dbglog("helper_plugin_spatialhelper_sitemap::skipPage, skipping $id, not in $namespace");
161 161
                 return true;
162 162
             }
@@ -196,12 +196,12 @@  discard block
 block discarded – undo
196 196
         $fh = fopen(mediaFN($mediaID), 'wb');
197 197
         fwrite($fh, $KMLstart);
198 198
 
199
-        foreach($this->spatial_idx as $idxEntry) {
199
+        foreach ($this->spatial_idx as $idxEntry) {
200 200
             // get list of id's
201
-            foreach($idxEntry as $id) {
201
+            foreach ($idxEntry as $id) {
202 202
                 // for document item in the index
203
-                if(strpos($id, 'media__', 0) !== 0) {
204
-                    if($this->skipPage($id, $namespace)) {
203
+                if (strpos($id, 'media__', 0) !== 0) {
204
+                    if ($this->skipPage($id, $namespace)) {
205 205
                         continue;
206 206
                     }
207 207
 
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
                     // TODO escape quotes in: title="' . $meta['title'] . '"
218 218
                     $plcm .= '  <atom:link href="' . wl($id, '' . true) . '" rel="alternate" type="text/html" />'
219 219
                         . DOKU_LF;
220
-                    if(!empty($meta['creator'])) {
220
+                    if (!empty($meta['creator'])) {
221 221
                         $plcm .= '  <atom:author><atom:name>' . $meta['creator'] . '</atom:name></atom:author>'
222 222
                             . DOKU_LF;
223 223
                     }
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
                     $plcm .= '  <styleUrl>#icon</styleUrl>' . DOKU_LF;
227 227
 
228 228
                     $plcm .= '  <Point><coordinates>' . $meta['geo']['lon'] . ',' . $meta['geo']['lat'];
229
-                    if(isset($meta['geo']['alt'])) {
229
+                    if (isset($meta['geo']['alt'])) {
230 230
                         $plcm .= ',' . $meta['geo']['alt'];
231 231
                     }
232 232
                     $plcm .= '</coordinates></Point>' . DOKU_LF;
Please login to merge, or discard this patch.