SimplePie::get_longitude()publicWP 1.0

Get the longitude coordinates for the feed

Compatible with the W3C WGS84 Basic Geo and GeoRSS specifications

Uses <geo:long>, <geo:lon> or <georss:point>

Method of the class: SimplePie{}

No Hooks.

Return

String|null.

Usage

$SimplePie = new SimplePie();
$SimplePie->get_longitude();

Changelog

Since 1.0 Introduced.

SimplePie::get_longitude() code WP 6.5.2

public function get_longitude()
{
	if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'long'))
	{
		return (float) $return[0]['data'];
	}
	elseif ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lon'))
	{
		return (float) $return[0]['data'];
	}
	elseif (($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', trim($return[0]['data']), $match))
	{
		return (float) $match[2];
	}

	return null;
}