Replaced all preg calls in the calls with the new function

This commit is contained in:
Michael 2019-12-05 06:42:10 +00:00
parent eeb8bee1b7
commit 4e77321be8
3 changed files with 19 additions and 87 deletions

View file

@ -1401,23 +1401,12 @@ class Transmitter
*/
public static function getAnnounceArray($item)
{
if (!preg_match("/(.*?)\[share(.*?)\]\s?.*?\s?\[\/share\]\s?/ism", $item['body'], $matches)) {
$reshared = Item::getShareArray($item);
if (empty($reshared['guid'])) {
return [];
}
$attributes = $matches[2];
$comment = $matches[1];
preg_match("/guid='(.*?)'/ism", $attributes, $matches);
if (empty($matches[1])) {
preg_match('/guid="(.*?)"/ism', $attributes, $matches);
}
if (empty($matches[1])) {
return [];
}
$reshared_item = Item::selectFirst([], ['guid' => $matches[1]]);
$reshared_item = Item::selectFirst([], ['guid' => $reshared['guid']]);
if (!DBA::isResult($reshared_item)) {
return [];
}
@ -1431,7 +1420,7 @@ class Transmitter
return [];
}
return ['object' => $reshared_item, 'actor' => $profile, 'comment' => trim($comment)];
return ['object' => $reshared_item, 'actor' => $profile, 'comment' => $reshared['comment']];
}
/**