- $text = "[attachment type='" . $data['type'] . "'";
-
- if (empty($data['text'])) {
- $data['text'] = $data['title'];
+ foreach (['type', 'url', 'title', 'alternative_title', 'publisher_name', 'publisher_url', 'publisher_img', 'author_name', 'author_url', 'author_img'] as $field) {
+ if (!empty($data[$field])) {
+ $text .= " " . $field . "='" . str_replace(['[', ']'], ['[', ']'], htmlentities($data[$field], ENT_QUOTES, 'UTF-8', false)) . "'";
+ }