// Only remove the shared data from "real" reshares
$shared = BBCode::fetchShareAttributes($body);
if (!empty($shared['guid'])) {
- $unshared_body = preg_replace("/\s*\[share .*?\].*?\[\/share\]\s*/ism", '', $body);
+ $unshared_body = BBCode::removeSharedData($body);
}
$attachments = [];
$shared = BBCode::fetchShareAttributes($body);
if (!empty($shared['guid'])) {
// Don't look at the shared content
- $body = preg_replace("/\s*\[share .*?\].*?\[\/share\]\s*/ism", '', $body);
+ $body = BBCode::removeSharedData($body);
}
// Remove all hashtags and mentions
public static function insertFromAttachmentData(int $uriid, string $body)
{
// Don't look at the shared content
- $body = preg_replace("/\s*\[share .*?\].*?\[\/share\]\s*/ism", '', $body);
+ $body = BBCode::removeSharedData($body);
$data = BBCode::getAttachmentData($body);
if (empty($data)) {