mirror of
https://github.com/friendica/friendica
synced 2025-04-27 06:30:12 +00:00
Merge pull request #8883 from annando/replace-getdetails
Replaced "getDetailsByURL" with "getByURL/getByURLForUser"
This commit is contained in:
commit
631095eefd
31 changed files with 84 additions and 291 deletions
|
@ -130,7 +130,7 @@ class Item
|
|||
// Checking for the alias that is used for OStatus
|
||||
$pattern = '/[@!]\[url\=(.*?)\](.*?)\[\/url\]/ism';
|
||||
if (preg_match($pattern, $tag, $matches)) {
|
||||
$data = Contact::getDetailsByURL($matches[1]);
|
||||
$data = Contact::getByURL($matches[1], false, ['alias', 'nick']);
|
||||
|
||||
if ($data['alias'] != '') {
|
||||
$newtag = '@[url=' . $data['alias'] . ']' . $data['nick'] . '[/url]';
|
||||
|
@ -149,15 +149,8 @@ class Item
|
|||
$name = $nameparts[0];
|
||||
|
||||
// Try to detect the contact in various ways
|
||||
if (strpos($name, 'http://')) {
|
||||
// At first we have to ensure that the contact exists
|
||||
Contact::getIdForURL($name);
|
||||
|
||||
// Now we should have something
|
||||
$contact = Contact::getDetailsByURL($name, $profile_uid);
|
||||
} elseif (strpos($name, '@')) {
|
||||
// This function automatically probes when no entry was found
|
||||
$contact = Contact::getDetailsByAddr($name, $profile_uid);
|
||||
if (strpos($name, 'http://') || strpos($name, '@')) {
|
||||
$contact = Contact::getByURLForUser($name, $profile_uid);
|
||||
} else {
|
||||
$contact = false;
|
||||
$fields = ['id', 'url', 'nick', 'name', 'alias', 'network', 'forum', 'prv'];
|
||||
|
|
|
@ -983,7 +983,7 @@ class BBCode
|
|||
$attributes[$field] = html_entity_decode($matches[2] ?? '', ENT_QUOTES, 'UTF-8');
|
||||
}
|
||||
|
||||
$author_contact = Contact::getByURL($attributes['profile'], 0, ['url', 'addr', 'name', 'micro'], false);
|
||||
$author_contact = Contact::getByURL($attributes['profile'], false, ['url', 'addr', 'name', 'micro']);
|
||||
$author_contact['url'] = ($author_contact['url'] ?? $attributes['profile']);
|
||||
$author_contact['addr'] = ($author_contact['addr'] ?? '') ?: Protocol::getAddrFromProfileUrl($attributes['profile']);
|
||||
|
||||
|
@ -1061,7 +1061,7 @@ class BBCode
|
|||
default:
|
||||
$text = ($is_quote_share? "\n" : '');
|
||||
|
||||
$contact = Contact::getByURL($attributes['profile'], 0, ['network'], false);
|
||||
$contact = Contact::getByURL($attributes['profile'], false, ['network']);
|
||||
$network = $contact['network'] ?? Protocol::PHANTOM;
|
||||
|
||||
$tpl = Renderer::getMarkupTemplate('shared_content.tpl');
|
||||
|
@ -1975,11 +1975,7 @@ class BBCode
|
|||
*/
|
||||
private static function bbCodeMention2DiasporaCallback($match)
|
||||
{
|
||||
$contact = Contact::getDetailsByURL($match[3]);
|
||||
|
||||
if (empty($contact['addr'])) {
|
||||
$contact = Probe::uri($match[3]);
|
||||
}
|
||||
$contact = Contact::getByURL($match[3], null, ['addr']);
|
||||
|
||||
if (empty($contact['addr'])) {
|
||||
return $match[0];
|
||||
|
|
|
@ -83,7 +83,7 @@ class Markdown
|
|||
return '';
|
||||
}
|
||||
|
||||
$data = Contact::getDetailsByAddr($matches[3]);
|
||||
$data = Contact::getByURL($matches[3]);
|
||||
|
||||
if (empty($data)) {
|
||||
return '';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue