X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fbbcode.php;h=81536d37200fdd5083a38685c306282856f8d0cb;hb=1053fe91c8a8baf69a74ccb4394442641c7dcc0a;hp=13061958c5f12682deb5bc52f87ea5868f9f5a93;hpb=fc18123082f2e0606066ae18a385db5bffc19142;p=friendica.git diff --git a/include/bbcode.php b/include/bbcode.php index 13061958c5..81536d3720 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -2,7 +2,23 @@ require_once("include/oembed.php"); require_once('include/event.php'); require_once('include/map.php'); +require_once('mod/proxy.php'); +function bb_PictureCacheExt($matches) { + if (strpos($matches[3], "data:image/") === 0) + return ($matches[0]); + + $matches[3] = proxy_url($matches[3]); + return "[img=".$matches[1]."x".$matches[2]."]".$matches[3]."[/img]"; +} + +function bb_PictureCache($matches) { + if (strpos($matches[1], "data:image/") === 0) + return ($matches[0]); + + $matches[1] = proxy_url($matches[1]); + return "[img]".$matches[1]."[/img]"; +} function bb_map_coords($match) { // the extra space in the following line is intentional @@ -101,9 +117,9 @@ function bb_attachment($Text, $simplehtml = false, $tryoembed = true) { $text = $oembed; else { if (($image != "") AND !strstr(strtolower($oembed), "
', $url, $image, $title); + $text .= sprintf('
', $url, proxy_url($image), $title); elseif (($preview != "") AND !strstr(strtolower($oembed), "
', $url, $preview, $title); + $text .= sprintf('
', $url, proxy_url($preview), $title); $text .= $oembed; @@ -455,7 +471,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 . '#$]', '' . t('Image/photo') . '', $newbody); + $newbody = str_replace('[$#saved_image' . $cnt . '#$]', '' . t('Image/photo') . '', $newbody); $cnt++; } @@ -585,7 +601,7 @@ function bb_ShareAttributes($share, $simplehtml) { default: $headline = trim($share[1]).'
'; if ($avatar != "") - $headline .= ''; + $headline .= ''; $headline .= sprintf(t('%s wrote the following post'.$reldate.':'), $profile, $author, $link); $headline .= "
"; @@ -1102,13 +1118,17 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal "
" . $t_wrote . "
$2
", $Text); + // [img=widthxheight]image source[/img] - //$Text = preg_replace("/\[img\=([0-9]*)x([0-9]*)\](.*?)\[\/img\]/ism", '', $Text); + $Text = preg_replace_callback("/\[img\=([0-9]*)x([0-9]*)\](.*?)\[\/img\]/ism", 'bb_PictureCacheExt', $Text); + $Text = preg_replace("/\[img\=([0-9]*)x([0-9]*)\](.*?)\[\/img\]/ism", '', $Text); $Text = preg_replace("/\[zmg\=([0-9]*)x([0-9]*)\](.*?)\[\/zmg\]/ism", '', $Text); // Images // [img]pathtoimage[/img] + $Text = preg_replace_callback("/\[img\](.*?)\[\/img\]/ism", 'bb_PictureCache', $Text); + $Text = preg_replace("/\[img\](.*?)\[\/img\]/ism", '' . t('Image/photo') . '', $Text); $Text = preg_replace("/\[zmg\](.*?)\[\/zmg\]/ism", '' . t('Image/photo') . '', $Text); @@ -1190,7 +1210,7 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal // start which is always required). Allow desc with a missing summary for compatibility. if((x($ev,'desc') || x($ev,'summary')) && x($ev,'start')) { - $sub = format_event_html($ev); + $sub = format_event_html($ev, $simplehtml); $Text = preg_replace("/\[event\-summary\](.*?)\[\/event\-summary\]/ism",'',$Text); $Text = preg_replace("/\[event\-description\](.*?)\[\/event\-description\]/ism",'',$Text);