- $attribute_string = $matches[2];
- foreach (['author', 'profile', 'avatar', 'link', 'posted', 'guid'] as $field) {
- preg_match("/$field=(['\"])(.+?)\\1/ism", $attribute_string, $matches);
+ $attributes = self::extractShareAttributes($matches[2]);
+
+ $attributes['comment'] = trim($matches[1]);
+ $attributes['shared'] = trim($matches[3]);
+
+ DI::profiler()->stopRecording();
+ return $attributes;
+ }
+
+ /**
+ * @see BBCode::fetchShareAttributes()
+ * @param string $shareString Internal opening share tag string matched by the regular expression
+ * @return array A fixed attribute array where missing attribute are represented by empty strings
+ */
+ private static function extractShareAttributes(string $shareString): array
+ {
+ $attributes = [];
+ foreach (['author', 'profile', 'avatar', 'link', 'posted', 'guid', 'message_id'] as $field) {
+ preg_match("/$field=(['\"])(.+?)\\1/ism", $shareString, $matches);