X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fbbcode.php;h=d1cb1a9110d3484a48f75e4dc66dd9e5ff379d89;hb=30efb0c1e641b0b9d3aa40a5a79897c6d06ac3ef;hp=d83fe6c12f15efcb40e067d8953b46c7082169b4;hpb=f1c579e74a438bfab6dce15c6bbe0075084bbf68;p=friendica.git diff --git a/include/bbcode.php b/include/bbcode.php index d83fe6c12f..d1cb1a9110 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -1,8 +1,85 @@ ".$st[2].""; +} + +function bb_cleanclass($st) { + return "".$st[2].""; +} + function cleancss($input) { $cleaned = ""; @@ -15,7 +92,7 @@ function cleancss($input) { if (($char >= "a") and ($char <= "z")) $cleaned .= $char; - if (!(strpos(" #;:0123456789", $char) === false)) + if (!(strpos(" #;:0123456789-_", $char) === false)) $cleaned .= $char; } @@ -28,7 +105,12 @@ function stripcode_br_cb($s) { function tryoembed($match){ $url = ((count($match)==2)?$match[1]:$match[2]); -// logger("tryoembed: $url"); + + // Always embed the SSL version + $url = str_replace(array("http://www.youtube.com/", "http://player.vimeo.com/"), + array("https://www.youtube.com/", "https://player.vimeo.com/"), $url); + + //logger("tryoembed: $url"); $o = oembed_fetch_url($url); @@ -206,12 +288,378 @@ function bb_replace_images($body, $images) { return $newbody; }} +function bb_ShareAttributes($match) { + + $attributes = $match[1]; + + $author = ""; + preg_match("/author='(.*?)'/ism", $attributes, $matches); + if ($matches[1] != "") + $author = html_entity_decode($matches[1],ENT_QUOTES,'UTF-8'); + + preg_match('/author="(.*?)"/ism', $attributes, $matches); + if ($matches[1] != "") + $author = $matches[1]; + + $link = ""; + preg_match("/link='(.*?)'/ism", $attributes, $matches); + if ($matches[1] != "") + $link = $matches[1]; + + preg_match('/link="(.*?)"/ism', $attributes, $matches); + if ($matches[1] != "") + $link = $matches[1]; + + $avatar = ""; + preg_match("/avatar='(.*?)'/ism", $attributes, $matches); + if ($matches[1] != "") + $avatar = $matches[1]; + + preg_match('/avatar="(.*?)"/ism', $attributes, $matches); + if ($matches[1] != "") + $avatar = $matches[1]; + + $profile = ""; + preg_match("/profile='(.*?)'/ism", $attributes, $matches); + if ($matches[1] != "") + $profile = $matches[1]; + + preg_match('/profile="(.*?)"/ism', $attributes, $matches); + if ($matches[1] != "") + $profile = $matches[1]; + + $posted = ""; + + $itemcache = get_config("system","itemcache"); + + // relative dates only make sense when they aren't cached + if ($itemcache == "") { + preg_match("/posted='(.*?)'/ism", $attributes, $matches); + if ($matches[1] != "") + $posted = $matches[1]; + + preg_match('/posted="(.*?)"/ism', $attributes, $matches); + if ($matches[1] != "") + $posted = $matches[1]; + + $reldate = (($posted) ? " " . relative_date($posted) : ''); + } + + $headline = '
'.trim($match[2]).""; + + return($text); +} + +// Escpecially for Diaspora (there mustn't be links in the share information) +function bb_ShareAttributesDiaspora($match) { + + $attributes = $match[2]; + + $author = ""; + preg_match("/author='(.*?)'/ism", $attributes, $matches); + if ($matches[1] != "") + $author = html_entity_decode($matches[1],ENT_QUOTES,'UTF-8'); + + preg_match('/author="(.*?)"/ism', $attributes, $matches); + if ($matches[1] != "") + $author = $matches[1]; + + $profile = ""; + preg_match("/profile='(.*?)'/ism", $attributes, $matches); + if ($matches[1] != "") + $profile = $matches[1]; + + preg_match('/profile="(.*?)"/ism', $attributes, $matches); + if ($matches[1] != "") + $profile = $matches[1]; + + $posted = ""; +// preg_match("/posted='(.*?)'/ism", $attributes, $matches); +// if ($matches[1] != "") +// $posted = " ".date("Y-m-d H:i", strtotime($matches[1])); +// +// preg_match('/posted="(.*?)"/ism', $attributes, $matches); +// if ($matches[1] != "") +// $posted = " ".date("Y-m-d H:i", strtotime($matches[1])); + + $userid = GetProfileUsername($profile,$author); + + $headline = '
'.trim($match[3])."
'.trim($match[3])."