Completed
Pull Request — master (#36)
by Mark
12s
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
         }
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
         $RSSstart .= '<feed xmlns="http://www.w3.org/2005/Atom" xmlns:georss="http://www.georss.org/georss" ';
86 86
         $RSSstart .= 'xmlns:dc="http://purl.org/dc/elements/1.1/">' . DOKU_LF;
87 87
         $RSSstart .= '<title>' . $conf['title'] . ' spatial feed</title>' . DOKU_LF;
88
-        if(!empty($conf['tagline'])) {
88
+        if (!empty($conf['tagline'])) {
89 89
             $RSSstart .= '<subtitle>' . $conf['tagline'] . '</subtitle>' . DOKU_LF;
90 90
         }
91 91
         $RSSstart .= '<dc:publisher>' . $conf['title'] . '</dc:publisher>' . DOKU_LF;
@@ -104,12 +104,12 @@  discard block
 block discarded – undo
104 104
         $fh = fopen(mediaFN($mediaID), 'wb');
105 105
         fwrite($fh, $RSSstart);
106 106
 
107
-        foreach($this->spatial_idx as $idxEntry) {
107
+        foreach ($this->spatial_idx as $idxEntry) {
108 108
             // get list of id's
109
-            foreach($idxEntry as $id) {
109
+            foreach ($idxEntry as $id) {
110 110
                 // for document item in the index
111
-                if(strpos($id, 'media__', 0) !== 0) {
112
-                    if($this->skipPage($id, $namespace)) {
111
+                if (strpos($id, 'media__', 0) !== 0) {
112
+                    if ($this->skipPage($id, $namespace)) {
113 113
                         continue;
114 114
                     }
115 115
 
@@ -123,11 +123,11 @@  discard block
 block discarded – undo
123 123
                     $entry .= '  <summary>' . $desc . '</summary>' . DOKU_LF;
124 124
                     $entry .= '  <georss:point>' . $meta['geo']['lat'] . ' ' . $meta['geo']['lon']
125 125
                         . '</georss:point>' . DOKU_LF;
126
-                    if(!empty($meta['geo']['alt'])) {
126
+                    if (!empty($meta['geo']['alt'])) {
127 127
                         $entry .= '  <georss:elev>' . $meta['geo']['alt'] . '</georss:elev>' . DOKU_LF;
128 128
                     }
129 129
                     $entry .= '  <link href="' . wl($id) . '" rel="alternate" type="text/html" />' . DOKU_LF;
130
-                    if(empty($meta['creator'])) {
130
+                    if (empty($meta['creator'])) {
131 131
                         $meta['creator'] = $conf['title'];
132 132
                     }
133 133
                     $entry .= '  <author><name>' . $meta['creator'] . '</name></author>' . DOKU_LF;
@@ -150,16 +150,16 @@  discard block
 block discarded – undo
150 150
      */
151 151
     private function skipPage(string $id, string $namespace): bool {
152 152
         dbglog("helper_plugin_spatialhelper_sitemap::skipPage, check for $id in $namespace");
153
-        if(isHiddenPage($id)) {
153
+        if (isHiddenPage($id)) {
154 154
             return true;
155 155
         }
156
-        if(auth_aclcheck($id, '', null) < AUTH_READ) {
156
+        if (auth_aclcheck($id, '', null) < AUTH_READ) {
157 157
             return true;
158 158
         }
159 159
 
160
-        if(!empty($namespace)) {
160
+        if (!empty($namespace)) {
161 161
             // only if id is in or below namespace
162
-            if(0 !== strpos(getNS($id), $namespace)) {
162
+            if (0 !== strpos(getNS($id), $namespace)) {
163 163
                 // dbglog("helper_plugin_spatialhelper_sitemap::skipPage, skipping $id, not in $namespace");
164 164
                 return true;
165 165
             }
@@ -199,12 +199,12 @@  discard block
 block discarded – undo
199 199
         $fh = fopen(mediaFN($mediaID), 'wb');
200 200
         fwrite($fh, $KMLstart);
201 201
 
202
-        foreach($this->spatial_idx as $idxEntry) {
202
+        foreach ($this->spatial_idx as $idxEntry) {
203 203
             // get list of id's
204
-            foreach($idxEntry as $id) {
204
+            foreach ($idxEntry as $id) {
205 205
                 // for document item in the index
206
-                if(strpos($id, 'media__', 0) !== 0) {
207
-                    if($this->skipPage($id, $namespace)) {
206
+                if (strpos($id, 'media__', 0) !== 0) {
207
+                    if ($this->skipPage($id, $namespace)) {
208 208
                         continue;
209 209
                     }
210 210
 
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
                     // TODO escape quotes in: title="' . $meta['title'] . '"
221 221
                     $plcm .= '  <atom:link href="' . wl($id, '' . true) . '" rel="alternate" type="text/html" />'
222 222
                         . DOKU_LF;
223
-                    if(!empty($meta['creator'])) {
223
+                    if (!empty($meta['creator'])) {
224 224
                         $plcm .= '  <atom:author><atom:name>' . $meta['creator'] . '</atom:name></atom:author>'
225 225
                             . DOKU_LF;
226 226
                     }
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
                     $plcm .= '  <styleUrl>#icon</styleUrl>' . DOKU_LF;
230 230
 
231 231
                     $plcm .= '  <Point><coordinates>' . $meta['geo']['lon'] . ',' . $meta['geo']['lat'];
232
-                    if(!empty($meta['geo']['alt'])) {
232
+                    if (!empty($meta['geo']['alt'])) {
233 233
                         $plcm .= ',' . $meta['geo']['alt'];
234 234
                     }
235 235
                     $plcm .= '</coordinates></Point>' . DOKU_LF;
Please login to merge, or discard this patch.