Function renamed - we don't return an object

This commit is contained in:
Michael 2019-12-04 09:15:03 +00:00
parent ef3664e6d4
commit 276d6fddd1

View file

@ -383,7 +383,7 @@ class Transmitter
// Directly mention the original author upon a quoted reshare. // Directly mention the original author upon a quoted reshare.
// Else just ensure that the original author receives the reshare. // Else just ensure that the original author receives the reshare.
$announce = self::getAnnounceObject($item); $announce = self::getAnnounceArray($item);
if (!empty($announce['comment'])) { if (!empty($announce['comment'])) {
$data['to'][] = $announce['actor']['url']; $data['to'][] = $announce['actor']['url'];
} elseif (!empty($announce)) { } elseif (!empty($announce)) {
@ -768,7 +768,7 @@ class Transmitter
// Only check for a reshare, if it is a real reshare and no quoted reshare // Only check for a reshare, if it is a real reshare and no quoted reshare
if (strpos($item['body'], "[share") === 0) { if (strpos($item['body'], "[share") === 0) {
$announce = self::getAnnounceObject($item); $announce = self::getAnnounceArray($item);
$reshared = !empty($announce); $reshared = !empty($announce);
} }
@ -993,7 +993,7 @@ class Transmitter
} }
} }
$announce = self::getAnnounceObject($item); $announce = self::getAnnounceArray($item);
// Mention the original author upon commented reshares // Mention the original author upon commented reshares
if (!empty($announce['comment'])) { if (!empty($announce['comment'])) {
$tags[] = ['type' => 'Mention', 'href' => $announce['actor']['url'], 'name' => '@' . $announce['actor']['addr']]; $tags[] = ['type' => 'Mention', 'href' => $announce['actor']['url'], 'name' => '@' . $announce['actor']['addr']];
@ -1366,7 +1366,7 @@ class Transmitter
private static function createAnnounce($item, $data) private static function createAnnounce($item, $data)
{ {
$orig_body = $item['body']; $orig_body = $item['body'];
$announce = self::getAnnounceObject($item); $announce = self::getAnnounceArray($item);
if (empty($announce)) { if (empty($announce)) {
$data['type'] = 'Create'; $data['type'] = 'Create';
$data['object'] = self::createNote($item); $data['object'] = self::createNote($item);
@ -1399,7 +1399,7 @@ class Transmitter
* *
* @return array * @return array
*/ */
public static function getAnnounceObject($item) public static function getAnnounceArray($item)
{ {
if (!preg_match("/(.*?)\[share(.*?)\]\s?.*?\s?\[\/share\]\s?/ism", $item['body'], $matches)) { if (!preg_match("/(.*?)\[share(.*?)\]\s?.*?\s?\[\/share\]\s?/ism", $item['body'], $matches)) {
return []; return [];