2017-11-19 22:55:28 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
2017-12-07 14:57:35 +01:00
|
|
|
* @file src/Model/Profile.php
|
2017-11-19 22:55:28 +01:00
|
|
|
*/
|
|
|
|
|
2017-12-07 14:57:35 +01:00
|
|
|
namespace Friendica\Model;
|
2017-11-19 22:55:28 +01:00
|
|
|
|
2017-12-07 14:57:35 +01:00
|
|
|
class Profile
|
2017-11-19 22:55:28 +01:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @brief Returns a formatted location string from the given profile array
|
|
|
|
*
|
|
|
|
* @param array $profile Profile array (Generated from the "profile" table)
|
|
|
|
*
|
|
|
|
* @return string Location string
|
|
|
|
*/
|
|
|
|
public static function formatLocation(array $profile)
|
|
|
|
{
|
|
|
|
$location = '';
|
|
|
|
|
|
|
|
if ($profile['locality']) {
|
|
|
|
$location .= $profile['locality'];
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($profile['region'] && ($profile['locality'] != $profile['region'])) {
|
|
|
|
if ($location) {
|
|
|
|
$location .= ', ';
|
|
|
|
}
|
|
|
|
|
|
|
|
$location .= $profile['region'];
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($profile['country-name']) {
|
|
|
|
if ($location) {
|
|
|
|
$location .= ', ';
|
|
|
|
}
|
|
|
|
|
|
|
|
$location .= $profile['country-name'];
|
|
|
|
}
|
|
|
|
|
|
|
|
return $location;
|
|
|
|
}
|
|
|
|
}
|