}
/**
- * @brief Returns the profile based on a ID
+ * @brief Returns default profile for a given user ID and ID
+ *
+ * @param int $uid The contact ID
+ * @param int $id The contact owner ID
+ * @param array $fields The selected fields
+ *
+ * @return array Profile data for the ID
+ * @throws \Exception
+ */
+ public static function getById(int $uid, int $id, array $fields = [])
+ {
+ return DBA::selectFirst('profile', $fields, ['uid' => $uid, 'id' => $id]);
+ }
+
+ /**
+ * @brief Returns profile data for the contact owner
*
* @param int $uid The User ID
- * @param int $id The id of the profile (optional)
* @param array $fields The fields to retrieve
*
* @return array Array of profile data
* @throws \Exception
*/
- public static function get(int $uid, int $id = null, array $fields = [])
+ public static function getListByUser(int $uid, array $fields = [])
{
- if (empty($id)) {
- return DBA::select('profile', $fields, ['uid' => $uid]);
- } else {
- return DBA::select('profile', $fields, ['uid' => $uid, 'id' => $id]);
- }
+ return DBA::selectToArray('profile', $fields, ['uid' => $uid]);
}
/**
$p['address'] = BBCode::convert($p['address']);
}
+ if (isset($p['gender'])) {
+ $p['gender'] = L10n::t($p['gender']);
+ }
+
+ if (isset($p['marital'])) {
+ $p['marital'] = L10n::t($p['marital']);
+ }
+
if (isset($p['photo'])) {
$p['photo'] = ProxyUtils::proxifyUrl($p['photo'], false, ProxyUtils::SIZE_SMALL);
}
return $uid;
}
- /**
- * Strip zrl parameter from a string.
- *
- * @param string $s The input string.
- * @return string The zrl.
- */
- public static function stripZrls($s)
- {
- return preg_replace('/[\?&]zrl=(.*?)([\?&]|$)/is', '', $s);
- }
-
- /**
- * Strip query parameter from a string.
- *
- * @param string $s The input string.
- * @param $param
- * @return string The query parameter.
- */
- public static function stripQueryParam($s, $param)
- {
- return preg_replace('/[\?&]' . $param . '=(.*?)(&|$)/ism', '$2', $s);
- }
-
/**
* search for Profiles
*