diff --git a/include/bbcode.php b/include/bbcode.php
index ee066f05a..186caad7b 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -322,7 +322,7 @@ function bb_ShareAttributes($match) {
if ($avatar != "")
$headline .= '
';
- $headline .= sprintf(t('%s wrote the following post'.$reldate.':'), $profile, $author, $link);
+ $headline .= sprintf(t('%s wrote the following post'.$reldate.':'), $profile, $author, $link);
$headline .= "";
@@ -369,7 +369,7 @@ function bb_ShareAttributesDiaspora($match) {
$headline .= ''.html_entity_decode("♲ ", ENT_QUOTES, 'UTF-8').$userid.':';
//$headline .= sprintf(t(''.
// html_entity_decode("♲ ", ENT_QUOTES, 'UTF-8').
- // '%s%s:'), $profile, $userid, $posted);
+ // '%s%s:'), $profile, $userid, $posted);
$headline .= "";
$text = trim($match[1]);
@@ -423,7 +423,7 @@ function bb_ShareAttributesForExport($match) {
$headline = '
";
$text = trim($match[1]);
@@ -533,6 +533,23 @@ function GetProfileUsername($profile, $username) {
return($username);
}
+function RemovePictureLinks($match) {
+ $ch = @curl_init($match[2]);
+ @curl_setopt($ch, CURLOPT_NOBODY, true);
+ @curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+ @curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (compatible; Friendica)");
+ @curl_exec($ch);
+ $curl_info = @curl_getinfo($ch);
+
+ if (substr($curl_info["content_type"], 0, 6) == "image/")
+ $text = "[url=".$match[2]."]".$match[2]."[/url]";
+ else
+ $text = "[url=".$match[1]."]".$match[1]."[/url]";
+
+ return($text);
+}
+
+
// BBcode 2 HTML was written by WAY2WEB.net
// extended to work with Mistpark/Friendica - Mike Macgirvin
@@ -632,19 +649,21 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal
// if the HTML is used to generate plain text, then don't do this search, but replace all URL of that kind to text
if (!$forplaintext)
- $Text = preg_replace("/([^\]\='".'"'."]|^)(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)/ism", '$1$2', $Text);
- else
- $Text = preg_replace("(\[url\](.*?)\[\/url\])ism"," $1 ",$Text);
+ $Text = preg_replace("/([^\]\='".'"'."]|^)(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)/ism", '$1$2', $Text);
+ else {
+ $Text = preg_replace("(\[url\]([$URLSearchString]*)\[\/url\])ism"," $1 ",$Text);
+ $Text = preg_replace_callback("&\[url=([^\[\]]*)\]\[img\](.*)\[\/img\]\[\/url\]&Usi", 'RemovePictureLinks', $Text);
+ }
if ($tryoembed)
$Text = preg_replace_callback("/\[url\]([$URLSearchString]*)\[\/url\]/ism",'tryoembed',$Text);
- $Text = preg_replace("/\[url\]([$URLSearchString]*)\[\/url\]/ism", '$1', $Text);
- $Text = preg_replace("/\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism", '$2', $Text);
+ $Text = preg_replace("/\[url\]([$URLSearchString]*)\[\/url\]/ism", '$1', $Text);
+ $Text = preg_replace("/\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism", '$2', $Text);
//$Text = preg_replace("/\[url\=([$URLSearchString]*)\]([$URLSearchString]*)\[\/url\]/ism", '$2', $Text);
// Red compatibility, though the link can't be authenticated on Friendica
- $Text = preg_replace("/\[zrl\=([$URLSearchString]*)\](.*?)\[\/zrl\]/ism", '$2', $Text);
+ $Text = preg_replace("/\[zrl\=([$URLSearchString]*)\](.*?)\[\/zrl\]/ism", '$2', $Text);
// we may need to restrict this further if it picks up too many strays
@@ -812,9 +831,9 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal
$Text = preg_replace_callback("/\[audio\](.*?)\[\/audio\]/ism", 'tryoembed', $Text);
} else {
$Text = preg_replace("/\[video\](.*?)\[\/video\]/",
- '$1', $Text);
+ '$1', $Text);
$Text = preg_replace("/\[audio\](.*?)\[\/audio\]/",
- '$1', $Text);
+ '$1', $Text);
}
// html5 video and audio
@@ -840,7 +859,7 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal
$Text = preg_replace("/\[youtube\]([A-Za-z0-9\-_=]+)(.*?)\[\/youtube\]/ism", '', $Text);
else
$Text = preg_replace("/\[youtube\]([A-Za-z0-9\-_=]+)(.*?)\[\/youtube\]/ism",
- 'https://www.youtube.com/watch?v=$1', $Text);
+ 'https://www.youtube.com/watch?v=$1', $Text);
if ($tryoembed) {
$Text = preg_replace_callback("/\[vimeo\](https?:\/\/player.vimeo.com\/video\/[0-9]+).*?\[\/vimeo\]/ism",'tryoembed',$Text);
@@ -854,7 +873,7 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal
$Text = preg_replace("/\[vimeo\]([0-9]+)(.*?)\[\/vimeo\]/ism", '', $Text);
else
$Text = preg_replace("/\[vimeo\]([0-9]+)(.*?)\[\/vimeo\]/ism",
- 'https://vimeo.com/$1', $Text);
+ 'https://vimeo.com/$1', $Text);
// $Text = preg_replace("/\[youtube\](.*?)\[\/youtube\]/", '', $Text);
diff --git a/include/conversation.php b/include/conversation.php
index 5b9a11bde..8e868afec 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -558,13 +558,13 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
$tag["url"] = $searchpath.strtolower($tag["term"]);
if ($tag["type"] == TERM_HASHTAG) {
- $hashtags[] = "#".$tag["term"]."";
+ $hashtags[] = "#".$tag["term"]."";
$prefix = "#";
} elseif ($tag["type"] == TERM_MENTION) {
- $mentions[] = "@".$tag["term"]."";
+ $mentions[] = "@".$tag["term"]."";
$prefix = "@";
}
- $tags[] = $prefix."".$tag["term"]."";
+ $tags[] = $prefix."".$tag["term"]."";
}
/*foreach(explode(',',$item['tag']) as $tag){
diff --git a/include/text.php b/include/text.php
index a47e352ba..0638f9e24 100644
--- a/include/text.php
+++ b/include/text.php
@@ -964,7 +964,7 @@ if(! function_exists('linkify')) {
* @param string $s
*/
function linkify($s) {
- $s = preg_replace("/(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\'\%\$\!\+]*)/", ' $1', $s);
+ $s = preg_replace("/(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\'\%\$\!\+]*)/", ' $1', $s);
$s = preg_replace("/\<(.*?)(src|href)=(.*?)\&\;(.*?)\>/ism",'<$1$2=$3&$4>',$s);
return($s);
}}
@@ -1297,13 +1297,13 @@ function prepare_body(&$item,$attach = false) {
$tag["url"] = $searchpath.strtolower($tag["term"]);
if ($tag["type"] == TERM_HASHTAG) {
- $hashtags[] = "#".$tag["term"]."";
+ $hashtags[] = "#".$tag["term"]."";
$prefix = "#";
} elseif ($tag["type"] == TERM_MENTION) {
- $mentions[] = "@".$tag["term"]."";
+ $mentions[] = "@".$tag["term"]."";
$prefix = "@";
}
- $tags[] = $prefix."".$tag["term"]."";
+ $tags[] = $prefix."".$tag["term"]."";
}
}
@@ -1414,7 +1414,7 @@ function prepare_body(&$item,$attach = false) {
$title = ((strlen(trim($mtch[4]))) ? escape_tags(trim($mtch[4])) : escape_tags($mtch[1]));
$title .= ' ' . $mtch[2] . ' ' . t('bytes');
- $as .= '' . $icon . '';
+ $as .= '' . $icon . '';
}
}
}
diff --git a/view/templates/event.tpl b/view/templates/event.tpl
index 4788dcb38..961f0155b 100644
--- a/view/templates/event.tpl
+++ b/view/templates/event.tpl
@@ -8,7 +8,7 @@
{{if $event.item.author_name}}
{{$event.item.author_name}}{{/if}}
{{$event.html}}
- {{if $event.item.plink}}{{/if}}
+ {{if $event.item.plink}}{{/if}}
{{if $event.edit}}{{/if}}
diff --git a/view/templates/events.tpl b/view/templates/events.tpl
index 054200ca2..f798a8e37 100644
--- a/view/templates/events.tpl
+++ b/view/templates/events.tpl
@@ -21,7 +21,7 @@
{{if $event.is_first}}
{{$event.d}}
{{/if}}
{{if $event.item.author_name}}
{{$event.item.author_name}}{{/if}}
{{$event.html}}
- {{if $event.item.plink}}{{/if}}
+ {{if $event.item.plink}}{{/if}}
{{if $event.edit}}{{/if}}
diff --git a/view/templates/profile_vcard.tpl b/view/templates/profile_vcard.tpl
index 3f4d3c711..4734f5525 100644
--- a/view/templates/profile_vcard.tpl
+++ b/view/templates/profile_vcard.tpl
@@ -34,7 +34,7 @@
{{if $marital}}- ♥{{$marital}}
- {{$profile.marital}}
{{/if}}
- {{if $homepage}}- {{$homepage}}
- {{$profile.homepage}}
{{/if}}
+ {{if $homepage}}- {{$homepage}}
- {{$profile.homepage}}
{{/if}}
{{include file="diaspora_vcard.tpl"}}
diff --git a/view/templates/wall_thread.tpl b/view/templates/wall_thread.tpl
index c0e30c4cb..6dc9e5c3a 100644
--- a/view/templates/wall_thread.tpl
+++ b/view/templates/wall_thread.tpl
@@ -75,7 +75,7 @@
{{/if}}
{{if $item.plink}}
-
+
{{/if}}
{{if $item.edpost}}
diff --git a/view/theme/vier/templates/profile_vcard.tpl b/view/theme/vier/templates/profile_vcard.tpl
index 9e0da287c..0a5464252 100644
--- a/view/theme/vier/templates/profile_vcard.tpl
+++ b/view/theme/vier/templates/profile_vcard.tpl
@@ -52,7 +52,7 @@
{{if $marital}}- ♥{{$marital}}
- {{$profile.marital}}
{{/if}}
- {{if $homepage}}- {{$homepage}}
- {{$profile.homepage}}
{{/if}}
+ {{if $homepage}}- {{$homepage}}
- {{$profile.homepage}}
{{/if}}
{{include file="diaspora_vcard.tpl"}}