X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fbbcode.php;h=81536d37200fdd5083a38685c306282856f8d0cb;hb=ddf3589fc5effa9fb28947e200bfe0a310cef88c;hp=6c5a400ddc307a069ac67a56a57f09c0fc668017;hpb=e839e3e1ec4b4a56ecf9886d8e29e07d6e5a798c;p=friendica.git
diff --git a/include/bbcode.php b/include/bbcode.php
index 6c5a400ddc..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;
@@ -268,6 +284,13 @@ function stripcode_br_cb($s) {
return '[code]' . str_replace('
', '', $s[1]) . '[/code]';
}
+function bb_onelinecode_cb($match) {
+ if (strpos($match[1],"
")===false){
+ return "".$match[1]."
";
+}
+
function tryoembed($match){
//$url = ((count($match)==2)?$match[1]:$match[2]);
$url = $match[1];
@@ -448,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 . '#$]', '', $newbody);
+ $newbody = str_replace('[$#saved_image' . $cnt . '#$]', '
', $newbody);
$cnt++;
}
@@ -578,7 +601,7 @@ function bb_ShareAttributes($share, $simplehtml) {
default:
$headline = trim($share[1]).'
$2", $Text); + // [img=widthxheight]image source[/img] - //$Text = preg_replace("/\[img\=([0-9]*)x([0-9]*)\](.*?)\[\/img\]/ism", '
with
+ $Text = preg_replace_callback("|(?!
]*>)([^<]*)
(?!
]*>)|ism", 'bb_onelinecode_cb', $Text);
+
// Unhide all [noparse] contained bbtags unspacefying them
// and triming the [noparse] tag.
@@ -1203,7 +1238,7 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal
// fix any escaped ampersands that may have been converted into links
$Text = preg_replace("/\<([^>]*?)(src|href)=(.*?)\&\;(.*?)\>/ism",'<$1$2=$3&$4>',$Text);
- $Text = preg_replace("/\<([^>]*?)(src|href)=\"(?!http|ftp|mailto|cid)(.*?)\>/ism",'<$1$2="">',$Text);
+ $Text = preg_replace("/\<([^>]*?)(src|href)=\"(?!http|ftp|mailto|gopher|cid)(.*?)\>/ism",'<$1$2="">',$Text);
if($saved_image)
$Text = bb_replace_images($Text, $saved_image);