mirror of
https://github.com/friendica/friendica
synced 2025-04-23 07:10:14 +00:00
Replaced all preg calls in the calls with the new function
This commit is contained in:
parent
eeb8bee1b7
commit
4e77321be8
3 changed files with 19 additions and 87 deletions
|
@ -1199,37 +1199,12 @@ class OStatus
|
|||
*/
|
||||
private static function getResharedGuid(array $item)
|
||||
{
|
||||
$body = trim($item["body"]);
|
||||
|
||||
// Skip if it isn't a pure repeated messages
|
||||
// Does it start with a share?
|
||||
if (strpos($body, "[share") > 0) {
|
||||
return "";
|
||||
$reshared = Item::getShareArray($item);
|
||||
if (empty($reshared['guid']) || !empty($reshared['comment'])) {
|
||||
return '';
|
||||
}
|
||||
|
||||
// Does it end with a share?
|
||||
if (strlen($body) > (strrpos($body, "[/share]") + 8)) {
|
||||
return "";
|
||||
}
|
||||
|
||||
$attributes = preg_replace("/\[share(.*?)\]\s?(.*?)\s?\[\/share\]\s?/ism", "$1", $body);
|
||||
// Skip if there is no shared message in there
|
||||
if ($body == $attributes) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$guid = "";
|
||||
preg_match("/guid='(.*?)'/ism", $attributes, $matches);
|
||||
if (!empty($matches[1])) {
|
||||
$guid = $matches[1];
|
||||
}
|
||||
|
||||
preg_match('/guid="(.*?)"/ism', $attributes, $matches);
|
||||
if (!empty($matches[1])) {
|
||||
$guid = $matches[1];
|
||||
}
|
||||
|
||||
return $guid;
|
||||
return $reshared['guid'];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue