@@ -191,6 +191,32 @@ public static function generate_commentdata( $commentdata ) {
191191 $ properties ['syndication ' ] = $ rels ['syndication ' ];
192192 }
193193
194+ // Check and parse for location property
195+ if ( array_key_exists ( 'location ' , $ properties ) ) {
196+ $ location = $ properties ['location ' ];
197+ if ( is_array ( $ location ) ) {
198+ if ( array_key_exists ( 'latitude ' , $ location ) ) {
199+ $ commentdata ['comment_meta ' ]['geo_latitude ' ] = $ location ['latitude ' ];
200+ }
201+ if ( array_key_exists ( 'longitude ' , $ location ) ) {
202+ $ commentdata ['comment_meta ' ]['geo_longitude ' ] = $ location ['longitude ' ];
203+ }
204+ if ( array_key_exists ( 'name ' , $ location ) ) {
205+ $ commentdata ['comment_meta ' ]['geo_address ' ] = $ location ['name ' ];
206+ }
207+ } else {
208+ if ( substr ( $ location , 0 , 4 ) == 'geo: ' ) {
209+ $ geo = explode ( ': ' , substr ( urldecode ( $ location ), 4 ) );
210+ $ geo = explode ( '; ' , $ geo [0 ] );
211+ $ coords = explode ( ', ' , $ geo [0 ] );
212+ $ commentdata ['comment_meta ' ]['geo_latitude ' ] = trim ( $ coords [0 ] );
213+ $ commentdata ['comment_meta ' ]['geo_longitude ' ] = trim ( $ coords [1 ] );
214+ } else {
215+ $ commentdata ['comment_meta ' ]['geo_address ' ] = $ location ;
216+ }
217+ }
218+ }
219+
194220 // check rsvp property
195221 if ( isset ( $ properties ['rsvp ' ] ) ) {
196222 $ commentdata ['comment_meta ' ]['semantic_linkbacks_type ' ] = wp_slash ( 'rsvp: ' . $ properties ['rsvp ' ] );
@@ -223,7 +249,7 @@ public static function get_property( $key, $properties ) {
223249 }
224250 return null ;
225251 }
226-
252+
227253 /**
228254 * Is string a URL.
229255 *
0 commit comments