From: Michael Vogel Date: Tue, 11 Feb 2014 22:42:06 +0000 (+0100) Subject: target="_blank" instead of target="external-link" X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=01971428aa30aeef09dd46735da67c9e68fd6d3d;p=friendica.git target="_blank" instead of target="external-link" --- diff --git a/include/bbcode.php b/include/bbcode.php index ee066f05a8..186caad7bc 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 = '
'; $headline .= sprintf(t(''. html_entity_decode("♲ ", ENT_QUOTES, 'UTF-8'). - '%s%s:'), $link, $userid, $posted); + '%s%s:'), $link, $userid, $posted); $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 5b9a11bde1..8e868afec7 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 a47e352bae..0638f9e241 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 4788dcb380..961f0155b5 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 054200ca2d..f798a8e378 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 3f4d3c711c..4734f55255 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 c0e30c4cbf..6dc9e5c3a5 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 9e0da287cf..0a54642528 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"}}