removed some parentheses, but left them in where a string was concated

Signed-off-by: Roland Haeder <roland@mxchange.org>
This commit is contained in:
Roland Häder 2017-04-14 15:23:10 +02:00
parent 3feece56dc
commit 83d6d68efd
No known key found for this signature in database
GPG Key ID: B72F8185C6C7BD78
1 changed files with 76 additions and 64 deletions

View File

@ -10,7 +10,7 @@ require_once 'include/plaintext.php';
function bb_PictureCacheExt($matches) { function bb_PictureCacheExt($matches) {
if (strpos($matches[3], "data:image/") === 0) { if (strpos($matches[3], "data:image/") === 0) {
return ($matches[0]); return $matches[0];
} }
$matches[3] = proxy_url($matches[3]); $matches[3] = proxy_url($matches[3]);
@ -19,7 +19,7 @@ function bb_PictureCacheExt($matches) {
function bb_PictureCache($matches) { function bb_PictureCache($matches) {
if (strpos($matches[1], "data:image/") === 0) { if (strpos($matches[1], "data:image/") === 0) {
return ($matches[0]); return $matches[0];
} }
$matches[1] = proxy_url($matches[1]); $matches[1] = proxy_url($matches[1]);
@ -165,7 +165,7 @@ function cleancss($input) {
} }
} }
return($cleaned); return $cleaned;
} }
function stripcode_br_cb($s) { function stripcode_br_cb($s) {
@ -542,85 +542,94 @@ function bb_ShareAttributes($share, $simplehtml) {
); );
break; break;
} }
return($text);
return $text;
} }
function GetProfileUsername($profile, $username, $compact = false, $getnetwork = false) { function GetProfileUsername($profile, $username, $compact = false, $getnetwork = false) {
$twitter = preg_replace("=https?://twitter.com/(.*)=ism", "$1@twitter.com", $profile); $twitter = preg_replace("=https?://twitter.com/(.*)=ism", "$1@twitter.com", $profile);
if ($twitter != $profile) { if ($twitter != $profile) {
if ($getnetwork) if ($getnetwork) {
return(NETWORK_TWITTER); return NETWORK_TWITTER;
elseif ($compact) } elseif ($compact) {
return($twitter); return $twitter;
else } else {
return($username." (".$twitter.")"); return ($username . " (" . $twitter . ")");
}
} }
$appnet = preg_replace("=https?://alpha.app.net/(.*)=ism", "$1@alpha.app.net", $profile); $appnet = preg_replace("=https?://alpha.app.net/(.*)=ism", "$1@alpha.app.net", $profile);
if ($appnet != $profile) { if ($appnet != $profile) {
if ($getnetwork) if ($getnetwork) {
return(NETWORK_APPNET); return NETWORK_APPNET;
elseif ($compact) } elseif ($compact) {
return($appnet); return $appnet;
else } else {
return($username." (".$appnet.")"); return ($username . " (" . $appnet . ")");
}
} }
$gplus = preg_replace("=https?://plus.google.com/(.*)=ism", "$1@plus.google.com", $profile); $gplus = preg_replace("=https?://plus.google.com/(.*)=ism", "$1@plus.google.com", $profile);
if ($gplus != $profile) { if ($gplus != $profile) {
if ($getnetwork) if ($getnetwork) {
return(NETWORK_GPLUS); return NETWORK_GPLUS);
elseif ($compact) } elseif ($compact) {
return($gplususername." (".$username.")"); return ($gplususername . " (" . $username . ")");
else } else {
return($username." (".$gplus.")"); return ($username . " (" . $gplus . ")");
}
} }
$friendica = preg_replace("=https?://(.*)/profile/(.*)=ism", "$2@$1", $profile); $friendica = preg_replace("=https?://(.*)/profile/(.*)=ism", "$2@$1", $profile);
if ($friendica != $profile) { if ($friendica != $profile) {
if ($getnetwork) if ($getnetwork) {
return(NETWORK_DFRN); return NETWORK_DFRN;
elseif ($compact) } elseif ($compact) {
return($friendica); return $friendica;
else } else {
return($username." (".$friendica.")"); return ($username . " (" . $friendica . ")");
}
} }
$diaspora = preg_replace("=https?://(.*)/u/(.*)=ism", "$2@$1", $profile); $diaspora = preg_replace("=https?://(.*)/u/(.*)=ism", "$2@$1", $profile);
if ($diaspora != $profile) { if ($diaspora != $profile) {
if ($getnetwork) if ($getnetwork) {
return(NETWORK_DIASPORA); return NETWORK_DIASPORA;
elseif ($compact) } elseif ($compact) {
return($diaspora); return $diaspora;
else } else {
return($username." (".$diaspora.")"); return ($username . " (" . $diaspora . ")");
}
} }
$red = preg_replace("=https?://(.*)/channel/(.*)=ism", "$2@$1", $profile); $red = preg_replace("=https?://(.*)/channel/(.*)=ism", "$2@$1", $profile);
if ($red != $profile) { if ($red != $profile) {
if ($getnetwork) if ($getnetwork) {
// red is identified as Diaspora - friendica can't connect directly to it // red is identified as Diaspora - friendica can't connect directly to it
return(NETWORK_DIASPORA); return NETWORK_DIASPORA;
elseif ($compact) } elseif ($compact) {
return($red); return $red;
else } else {
return($username." (".$red.")"); return ($username . " (" . $red . ")");
}
} }
$StatusnetHost = preg_replace("=https?://(.*)/user/(.*)=ism", "$1", $profile); $StatusnetHost = preg_replace("=https?://(.*)/user/(.*)=ism", "$1", $profile);
if ($StatusnetHost != $profile) { if ($StatusnetHost != $profile) {
$StatusnetUser = preg_replace("=https?://(.*)/user/(.*)=ism", "$2", $profile); $StatusnetUser = preg_replace("=https?://(.*)/user/(.*)=ism", "$2", $profile);
if ($StatusnetUser != $profile) { if ($StatusnetUser != $profile) {
/// @TODO Some hosts run on https, not just http and sometimes http is disabled, let's support both here
$UserData = fetch_url("http://".$StatusnetHost."/api/users/show.json?user_id=".$StatusnetUser); $UserData = fetch_url("http://".$StatusnetHost."/api/users/show.json?user_id=".$StatusnetUser);
$user = json_decode($UserData); $user = json_decode($UserData);
if ($user) { if ($user) {
if ($getnetwork) if ($getnetwork) {
return(NETWORK_STATUSNET); return NETWORK_STATUSNET;
elseif ($compact) } elseif ($compact) {
return($user->screen_name."@".$StatusnetHost); return ($user->screen_name . "@" . $StatusnetHost);
else } else {
return($username." (".$user->screen_name."@".$StatusnetHost.")"); return ($username . " (" . $user->screen_name . "@" . $StatusnetHost . ")");
}
} }
} }
} }
@ -630,16 +639,17 @@ function GetProfileUsername($profile, $username, $compact = false, $getnetwork =
if ($rest == "") { if ($rest == "") {
$pumpio = preg_replace("=https?://([\.\w]+)/([\.\w]+)(.*)=ism", "$2@$1", $profile); $pumpio = preg_replace("=https?://([\.\w]+)/([\.\w]+)(.*)=ism", "$2@$1", $profile);
if ($pumpio != $profile) { if ($pumpio != $profile) {
if ($getnetwork) if ($getnetwork) {
return(NETWORK_PUMPIO); return NETWORK_PUMPIO;
elseif ($compact) } elseif ($compact) {
return($pumpio); return $pumpio;
else } else {
return($username." (".$pumpio.")"); return ($username . " (" . $pumpio . ")");
}
} }
} }
return($username); return $username;
} }
function bb_DiasporaLinks($match) { function bb_DiasporaLinks($match) {
@ -690,14 +700,16 @@ function bb_RemovePictureLinks($match) {
} }
Cache::set($match[1],$text); Cache::set($match[1],$text);
} }
return($text);
return $text;
} }
function bb_expand_links($match) { function bb_expand_links($match) {
if (($match[3] == "") OR ($match[2] == $match[3]) OR stristr($match[2], $match[3])) if (($match[3] == "") OR ($match[2] == $match[3]) OR stristr($match[2], $match[3])) {
return ($match[1]."[url]".$match[2]."[/url]"); return ($match[1] . "[url]" . $match[2] . "[/url]");
else } else {
return ($match[1].$match[3]." [url]".$match[2]."[/url]"); return ($match[1] . $match[3] . " [url]" . $match[2] . "[/url]");
}
} }
function bb_CleanPictureLinksSub($match) { function bb_CleanPictureLinksSub($match) {
@ -745,12 +757,13 @@ function bb_CleanPictureLinksSub($match) {
} }
Cache::set($match[1],$text); Cache::set($match[1],$text);
} }
return($text);
return $text;
} }
function bb_CleanPictureLinks($text) { function bb_CleanPictureLinks($text) {
$text = preg_replace_callback("&\[url=([^\[\]]*)\]\[img\](.*)\[\/img\]\[\/url\]&Usi", 'bb_CleanPictureLinksSub', $text); $text = preg_replace_callback("&\[url=([^\[\]]*)\]\[img\](.*)\[\/img\]\[\/url\]&Usi", 'bb_CleanPictureLinksSub', $text);
return ($text); return $text;
} }
function bb_highlight($match) { function bb_highlight($match) {
@ -1121,15 +1134,14 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $simplehtml = fa
// Shared content // Shared content
$Text = preg_replace_callback("/(.*?)\[share(.*?)\](.*?)\[\/share\]/ism", $Text = preg_replace_callback("/(.*?)\[share(.*?)\](.*?)\[\/share\]/ism",
function ($match) use ($simplehtml){ function ($match) use ($simplehtml) {
return(bb_ShareAttributes($match, $simplehtml)); return bb_ShareAttributes($match, $simplehtml);
}, $Text); }, $Text);
$Text = preg_replace("/\[crypt\](.*?)\[\/crypt\]/ism", '<br/><img src="' .App::get_baseurl() . '/images/lock_icon.gif" alt="' . t('Encrypted content') . '" title="' . t('Encrypted content') . '" /><br />', $Text); $Text = preg_replace("/\[crypt\](.*?)\[\/crypt\]/ism", '<br/><img src="' .App::get_baseurl() . '/images/lock_icon.gif" alt="' . t('Encrypted content') . '" title="' . t('Encrypted content') . '" /><br />', $Text);
$Text = preg_replace("/\[crypt(.*?)\](.*?)\[\/crypt\]/ism", '<br/><img src="' .App::get_baseurl() . '/images/lock_icon.gif" alt="' . t('Encrypted content') . '" title="' . '$1' . ' ' . t('Encrypted content') . '" /><br />', $Text); $Text = preg_replace("/\[crypt(.*?)\](.*?)\[\/crypt\]/ism", '<br/><img src="' .App::get_baseurl() . '/images/lock_icon.gif" alt="' . t('Encrypted content') . '" title="' . '$1' . ' ' . t('Encrypted content') . '" /><br />', $Text);
//$Text = preg_replace("/\[crypt=(.*?)\](.*?)\[\/crypt\]/ism", '<br/><img src="' .App::get_baseurl() . '/images/lock_icon.gif" alt="' . t('Encrypted content') . '" title="' . '$1' . ' ' . t('Encrypted content') . '" /><br />', $Text); //$Text = preg_replace("/\[crypt=(.*?)\](.*?)\[\/crypt\]/ism", '<br/><img src="' .App::get_baseurl() . '/images/lock_icon.gif" alt="' . t('Encrypted content') . '" title="' . '$1' . ' ' . t('Encrypted content') . '" /><br />', $Text);
// Try to Oembed // Try to Oembed
if ($tryoembed) { if ($tryoembed) {
$Text = preg_replace("/\[video\](.*?\.(ogg|ogv|oga|ogm|webm|mp4))\[\/video\]/ism", '<video src="$1" controls="controls" width="' . $a->videowidth . '" height="' . $a->videoheight . '"><a href="$1">$1</a></video>', $Text); $Text = preg_replace("/\[video\](.*?\.(ogg|ogv|oga|ogm|webm|mp4))\[\/video\]/ism", '<video src="$1" controls="controls" width="' . $a->videowidth . '" height="' . $a->videoheight . '"><a href="$1">$1</a></video>', $Text);
@ -1199,7 +1211,7 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $simplehtml = fa
// Summary (e.g. title) is required, earlier revisions only required description (in addition to // Summary (e.g. title) is required, earlier revisions only required description (in addition to
// start which is always required). Allow desc with a missing summary for compatibility. // start which is always required). Allow desc with a missing summary for compatibility.
if((x($ev, 'desc') || x($ev, 'summary')) && x($ev, 'start')) { if ((x($ev, 'desc') || x($ev, 'summary')) && x($ev, 'start')) {
$sub = format_event_html($ev, $simplehtml); $sub = format_event_html($ev, $simplehtml);
$Text = preg_replace("/\[event\-summary\](.*?)\[\/event\-summary\]/ism", '', $Text); $Text = preg_replace("/\[event\-summary\](.*?)\[\/event\-summary\]/ism", '', $Text);