', $data["type"]);
}
if ($data["image"] != "") {
@@ -94,15 +99,19 @@ function bb_attachment($return, $simplehtml = false, $tryoembed = true)
if (($data["type"] == "photo") && ($data["url"] != "") && ($data["image"] != "")) {
$return .= sprintf('
', $data["url"], proxy_url($data["image"]), $data["title"]);
} else {
- $return .= sprintf('[bookmark=%s]%s[/bookmark]', $data['url'], $data['title']);
+ $return .= sprintf('
', $data['url'], $data['title']);
}
- if (trim($data["description"]) != "") {
+ if ($data["description"] != "" && $data["description"] != $data["title"]) {
$return .= sprintf('
%s
', trim(bbcode($data["description"])));
}
+ if ($data["type"] == "link") {
+ $return .= sprintf('
%s', $data['url'], parse_url($data['url'], PHP_URL_HOST));
+ }
+
if ($simplehtml != 4) {
- $return .= '';
+ $return .= '
';
}
}
}
@@ -112,7 +121,7 @@ function bb_attachment($return, $simplehtml = false, $tryoembed = true)
function bb_remove_share_information($Text, $plaintext = false, $nolink = false) {
- $data = get_attachment_data($Text);
+ $data = BBCode::getAttachmentData($Text);
if (!$data) {
return $Text;
@@ -276,7 +285,7 @@ function bb_find_open_close($s, $open, $close, $occurence = 1) {
return false;
}
- $res = array( 'start' => $start_pos, 'end' => $end_pos );
+ $res = [ 'start' => $start_pos, 'end' => $end_pos ];
return $res;
}
@@ -312,16 +321,16 @@ function get_bb_tag_pos($s, $name, $occurence = 1) {
return false;
}
- $res = array(
- 'start' => array(
+ $res = [
+ 'start' => [
'open' => $start_open,
'close' => $start_close
- ),
- 'end' => array(
+ ],
+ 'end' => [
'open' => $end_open,
'close' => $end_open + strlen('[/' . $name . ']')
- ),
- );
+ ],
+ ];
if ($start_equal !== false) {
$res['start']['equal'] = $start_equal + 1;
@@ -356,7 +365,7 @@ function bb_tag_preg_replace($pattern, $replace, $name, $s) {
function bb_extract_images($body) {
- $saved_image = array();
+ $saved_image = [];
$orig_body = $body;
$new_body = '';
@@ -394,7 +403,7 @@ function bb_extract_images($body) {
$new_body = $new_body . $orig_body;
- return array('body' => $new_body, 'images' => $saved_image);
+ return ['body' => $new_body, 'images' => $saved_image];
}
function bb_replace_images($body, $images) {
@@ -406,7 +415,7 @@ function bb_replace_images($body, $images) {
// We're depending on the property of 'foreach' (specified on the PHP website) that
// it loops over the array starting from the first element and going sequentially
// to the last element
- $newbody = str_replace('[$#saved_image' . $cnt . '#$]', '