Passed
Pull Request — master (#30)
by Mark
04:40
created
action.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
     public function handleTplMetaheaderOutput(Doku_Event $event, $param): void {
56 56
         global $ID, $conf, $INFO;
57 57
 
58
-        if(!page_exists($ID)) {
58
+        if (!page_exists($ID)) {
59 59
             return;
60 60
         }
61 61
 
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
         );
78 78
 
79 79
         $desc = p_get_metadata($ID, 'description', true);
80
-        if(!empty($desc)) {
80
+        if (!empty($desc)) {
81 81
             $desc                  = str_replace("\n", " ", $desc['abstract']);
82 82
             $event->data['meta'][] = array(
83 83
                 'name'    => 'twitter:description',
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
             );
86 86
         }
87 87
 
88
-        if($this->getConf('twitterUserName') !== '') {
88
+        if ($this->getConf('twitterUserName') !== '') {
89 89
             $event->data['meta'][] = array(
90 90
                 'name'    => 'twitter:creator',
91 91
                 'content' => $this->getConf('twitterUserName'),
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
             'property' => 'og:title',
133 133
             'content'  => p_get_metadata($ID, 'title', true),
134 134
         );
135
-        if(!empty($desc)) {
135
+        if (!empty($desc)) {
136 136
             $event->data['meta'][] = array(
137 137
                 'property' => 'og:description',
138 138
                 'content'  => $desc,
@@ -172,11 +172,11 @@  discard block
 block discarded – undo
172 172
 //            'content'  => p_get_metadata($ID, 'user', true),
173 173
 //        );
174 174
         $_subject = p_get_metadata($ID, 'subject', true);
175
-        if(!empty($_subject)) {
176
-            if(!is_array($_subject)) {
175
+        if (!empty($_subject)) {
176
+            if (!is_array($_subject)) {
177 177
                 $_subject = array($_subject);
178 178
             }
179
-            foreach($_subject as $tag) {
179
+            foreach ($_subject as $tag) {
180 180
                 $event->data['meta'][] = array(
181 181
                     'property' => 'article:tag',
182 182
                     'content'  => $tag,
@@ -186,10 +186,10 @@  discard block
 block discarded – undo
186 186
 
187 187
         // place namespace http://ogp.me/ns/place#
188 188
         $geotags = p_get_metadata($ID, 'geo', true);
189
-        if(is_array($geotags)) {
189
+        if (is_array($geotags)) {
190 190
             $lat = $geotags['lat'] ?? 0;
191 191
             $lon = $geotags['lon'] ?? 0;
192
-            if(!(empty($lat) && empty($lon))) {
192
+            if (!(empty($lat) && empty($lon))) {
193 193
                 $event->data['meta'][] = array(
194 194
                     'property' => 'place:location:latitude',
195 195
                     'content'  => $lat,
@@ -201,9 +201,9 @@  discard block
 block discarded – undo
201 201
             }
202 202
             // see https://developers.facebook.com/docs/opengraph/property-types/#geopoint
203 203
             $alt = $geotags['alt'] ?? 0;
204
-            if(!empty($alt)) {
204
+            if (!empty($alt)) {
205 205
                 // facebook expects feet...
206
-                $alt                   *= 3.2808;
206
+                $alt *= 3.2808;
207 207
                 $event->data['meta'][] = array(
208 208
                     'property' => 'place:location:altitude',
209 209
                     'content'  => $alt,
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 
228 228
         // optional facebook app ID
229 229
         $appId = $this->getConf('fbAppId');
230
-        if(!empty($appId)) {
230
+        if (!empty($appId)) {
231 231
             $event->data['meta'][] = array(
232 232
                 'property' => 'fb:app_id',
233 233
                 'content'  => $appId,
@@ -246,9 +246,9 @@  discard block
 block discarded – undo
246 246
         $rel = p_get_metadata($ID, 'relation', true);
247 247
         $img = $rel['firstimage'];
248 248
 
249
-        if(empty($img)) {
249
+        if (empty($img)) {
250 250
             $img = $this->getConf('fallbackImage');
251
-            if(strpos($img, "http") === 0) {
251
+            if (strpos($img, "http") === 0) {
252 252
                 // don't use ml() as this results in a HTTP redirect after
253 253
                 //   hitting the wiki making the card image fail.
254 254
                 return $img;
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
         $imgID = $rel['firstimage'];
271 271
         $alt   = "";
272 272
 
273
-        if(!empty($imgID)) {
273
+        if (!empty($imgID)) {
274 274
             require_once(DOKU_INC . 'inc/JpegMeta.php');
275 275
             $jpegmeta = new JpegMeta(mediaFN($imgID));
276 276
             $tags     = array(
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
                 'IPTC.Headline',
282 282
                 'Xmp.dc:title'
283 283
             );
284
-            $alt      = media_getTag($tags, $jpegmeta, "");
284
+            $alt = media_getTag($tags, $jpegmeta, "");
285 285
         }
286 286
         return htmlspecialchars($alt);
287 287
     }
Please login to merge, or discard this patch.