Change called method names

- Add GlobalContact::getRandomUrl
- Rename Contact::getIdForURL
- Rename Diaspora::sendUnshare
- Remove unused parameter $self in Contact::terminateFriendship
This commit is contained in:
Hypolite Petovan 2017-11-19 17:03:39 -05:00
parent b92fc24ff0
commit ec02af593d
48 changed files with 133 additions and 133 deletions

View file

@ -708,7 +708,7 @@ class DFRN
if (trim($profile["locality"].$profile["region"].$profile["country-name"]) != "") {
$element = $doc->createElement("poco:address");
XML::add_element($doc, $element, "poco:formatted", formatted_location($profile));
XML::add_element($doc, $element, "poco:formatted", Profile::formatLocation($profile));
if (trim($profile["locality"]) != "") {
XML::add_element($doc, $element, "poco:locality", $profile["locality"]);
@ -742,8 +742,7 @@ class DFRN
*/
private static function add_entry_author($doc, $element, $contact_url, $item)
{
$contact = get_contact_details_by_url($contact_url, $item["uid"]);
$contact = Contact::getDetailsByURL($contact_url, $item["uid"]);
$author = $doc->createElement($element);
XML::add_element($doc, $author, "name", $contact["name"]);
@ -1373,8 +1372,7 @@ class DFRN
if ($contact['term-date'] > NULL_DATE) {
logger("dfrn_deliver: $url back from the dead - removing mark for death");
include_once 'include/Contact.php';
unmark_for_death($contact);
Contact::unmarkForArchival($contact);
}
$res = parse_xml_string($xml);

View file

@ -950,7 +950,7 @@ class Diaspora
* We haven't found it?
* We use another function for it that will possibly create a contact entry.
*/
$cid = get_contact($handle, $uid);
$cid = Contact::getIdForURL($handle, $uid);
if ($cid > 0) {
/// @TODO Contact retrieval should be encapsulated into an "entity" class like `Contact`
@ -1342,7 +1342,7 @@ class Diaspora
// We are receiving content from a user that possibly is about to be terminated
// This means the user is vital, so we remove a possible termination date.
unmark_for_death($r[0]);
Contact::unmarkForArchival($r[0]);
} else {
$cid = $contact["id"];
$network = NETWORK_DIASPORA;
@ -1521,7 +1521,7 @@ class Diaspora
}
// We now remove the contact
contact_remove($contact["id"]);
Contact::remove($contact["id"]);
return true;
}
@ -2810,7 +2810,7 @@ class Diaspora
case "Person":
/// @todo What should we do with an "unshare"?
// Removing the contact isn't correct since we still can read the public items
contact_remove($contact["id"]);
Contact::remove($contact["id"]);
return true;
default:
@ -3151,11 +3151,11 @@ class Diaspora
add_to_queue($contact["id"], NETWORK_DIASPORA, $envelope, $public_batch);
// The message could not be delivered. We mark the contact as "dead"
mark_for_death($contact);
Contact::markForArchival($contact);
}
} elseif (($return_code >= 200) && ($return_code <= 299)) {
// We successfully delivered a message, the contact is alive
unmark_for_death($contact);
Contact::unmarkForArchival($contact);
}
return(($return_code) ? $return_code : (-1));
@ -3291,7 +3291,7 @@ class Diaspora
*
* @return int The result of the transmission
*/
public static function send_unshare($owner, $contact)
public static function sendUnshare($owner, $contact)
{
$message = array("author" => self::my_handle($owner),
"recipient" => $contact["addr"],
@ -4007,7 +4007,7 @@ class Diaspora
$about = $profile['about'];
$about = strip_tags(bbcode($about));
$location = formatted_location($profile);
$location = Profile::formatLocation($profile);
$tags = '';
if ($profile['pub_keywords']) {
$kw = str_replace(',', ' ', $profile['pub_keywords']);

View file

@ -153,7 +153,7 @@ class OStatus
// Only update the contacts if it is an OStatus contact
if ($r && ($r['id'] > 0) && !$onlyfetch && ($contact["network"] == NETWORK_OSTATUS)) {
// This contact is vital, so we awake it from the dead
unmark_for_death($contact);
Contact::unmarkForArchival($contact);
// Update contact data
@ -208,7 +208,7 @@ class OStatus
}
// Ensure that we are having this contact (with uid=0)
$cid = get_contact($aliaslink, 0);
$cid = Contact::getIdForURL($aliaslink, 0);
if ($cid) {
$fields = array('url', 'nurl', 'name', 'nick', 'alias', 'about', 'location');
@ -2098,7 +2098,7 @@ class OStatus
}
$check_date = datetime_convert('UTC', 'UTC', $last_update, 'Y-m-d H:i:s');
$authorid = get_contact($owner["url"], 0);
$authorid = Contact::getIdForURL($owner["url"], 0);
$items = q(
"SELECT `item`.*, `item`.`id` AS `item_id` FROM `item` USE INDEX (`uid_contactid_created`)

View file

@ -401,7 +401,7 @@ class PortableContact
}
}
$location = formatted_location($noscrape);
$location = Profile::formatLocation($noscrape);
if ($location) {
$contact["location"] = $location;
}