-function best_link_url($item, &$sparkle, $url = '') {
-
- $best_url = '';
- $sparkle = false;
-
- $clean_url = normalise_link($item['author-link']);
-
- if (local_user()) {
- $condition = [
- 'network' => NETWORK_DFRN,
- 'uid' => local_user(),
- 'nurl' => normalise_link($clean_url),
- 'pending' => false
- ];
- $contact = dba::selectFirst('contact', ['id'], $condition);
- if (DBM::is_result($contact)) {
- $best_url = 'redir/' . $contact['id'];
- $sparkle = true;
- if ($url != '') {
- $hostname = get_app()->get_hostname();
- if (!strstr($url, $hostname)) {
- $best_url .= "?url=".$url;
- } else {
- $best_url = $url;
- }
- }
- }
- }
- if (!$best_url) {
- if ($url != '') {
- $best_url = $url;
- } elseif (strlen($item['author-link'])) {
- $best_url = $item['author-link'];
- } else {
- $best_url = $item['url'];
- }
- }
-
- return $best_url;
-}
-
-