- $headline = '<div class="shared_header">';
- //$headline = '<br /><div class="shared_header">';
-
- if ($avatar != "")
- $headline .= '<img src="'.$avatar.'" height="32" width="32" >';
-
- $headline .= sprintf(t('<span><a href="%s" target="_blank">%s</a> wrote the following <a href="%s" target="_blank">post</a>'.$reldate.':</span>'), $profile, $author, $link);
-
- $headline .= "</div>";
-
- $text = $headline.'<blockquote class="shared_content">'.trim($match[2])."</blockquote>";
-
- 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 = '<div class="shared_header">';
- $headline .= '<span><b>'.html_entity_decode("♲ ", ENT_QUOTES, 'UTF-8').$userid.':</b></span>';
- //$headline .= sprintf(t('<span><b>'.
- // html_entity_decode("♲ ", ENT_QUOTES, 'UTF-8').
- // '<a href="%s" target="_blank">%s</a>%s:</b></span>'), $profile, $userid, $posted);
- $headline .= "</div>";
-
- $text = trim($match[1]);
-
- if ($text != "")
- $text .= "<hr />";
-
- $text .= $headline.'<blockquote class="shared_content">'.trim($match[3])."</blockquote><br />";
- //$text .= $headline."<br />".trim($match[3])."<br />";
-
- return($text);
-}
-
-// Optimized for Libertree, Wordpress, Tumblr, ...
-function bb_ShareAttributesForExport($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];
-
- $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];
-
- if ($link == "")
- $link = $profile;
-
- $userid = GetProfileUsername($profile,$author);
-
- $headline = '<div class="shared_header">';
- $headline .= sprintf(t('<span><b>'.
- html_entity_decode("♲ ", ENT_QUOTES, 'UTF-8').
- '<a href="%s" target="_blank">%s</a>%s:</b></span>'), $link, $userid, $posted);
- $headline .= "</div>";
-
- $text = trim($match[1]);
-
- if ($text != "")
- $text .= "<hr />";
-
- $text .= $headline.'<blockquote class="shared_content">'.trim($match[3])."</blockquote><br />";
-
- return($text);
-}
-
-// Still in use?
-function bb_ShareAttributesSimple($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];
-
- $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];
-
- $userid = GetProfileUsername($profile,$author);
-
- $text = "<br />".html_entity_decode("♲ ", ENT_QUOTES, 'UTF-8').' <a href="'.$profile.'">'.$userid."</a>: <br />»".$match[2]."«";
-
- return($text);
-}
-
-// Used for text exports (Twitter, Facebook, Google+)
-function bb_ShareAttributesSimple2($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];
-
- $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];
-
- $userid = GetProfileUsername($profile,$author);
-
- //$text = "<br />".html_entity_decode("♲ ", ENT_QUOTES, 'UTF-8').' <a href="'.$profile.'">'.$userid."</a>: <br />".$match[2];
- $text = "<br />".html_entity_decode("♲ ", ENT_QUOTES, 'UTF-8').' '.$userid.": <br />".$match[2];
-
- return($text);
+ $userid = GetProfileUsername($profile,$author, false);
+ $userid_compact = GetProfileUsername($profile,$author, true);
+
+ $preshare = trim($share[1]);
+
+ if ($preshare != "")
+ $preshare .= "<br /><br />";
+
+ switch ($simplehtml) {
+ case 1:
+ $text = $preshare.html_entity_decode("♲ ", ENT_QUOTES, 'UTF-8').' <a href="'.$profile.'">'.$userid."</a>: <br />»".$share[3]."«";
+ break;
+ case 2:
+ $text = $preshare.html_entity_decode("♲ ", ENT_QUOTES, 'UTF-8').' '.$userid_compact.": <br />".$share[3];
+ break;
+ case 3: // Diaspora
+ $headline = '<div class="shared_header">';
+ $headline .= '<span><b>'.html_entity_decode("♲ ", ENT_QUOTES, 'UTF-8').$userid.':</b></span>';
+ $headline .= "</div>";
+
+ $text = trim($share[1]);
+
+ if ($text != "")
+ $text .= "<hr />";
+
+ if (substr(normalise_link($link), 0, 19) != "http://twitter.com/") {
+ $text .= $headline.'<blockquote class="shared_content">'.trim($share[3])."</blockquote><br />";
+
+ if ($link != "")
+ $text .= '<br /><a href="'.$link.'">[l]</a>';
+ } else
+ $text .= '<br /><a href="'.$link.'">'.$link.'</a>';
+
+ break;
+ case 4:
+ $headline = '<div class="shared_header">';
+ $headline .= '<span><b>'.html_entity_decode("♲ ", ENT_QUOTES, 'UTF-8');
+ $headline .= sprintf(t('<a href="%1$s" target="_blank">%2$s</a> %3$s'), $link, $userid, $posted);
+ $headline .= ":</b></span></div>";
+
+ $text = trim($share[1]);
+
+ if ($text != "")
+ $text .= "<hr />";
+
+ $text .= $headline.'<blockquote class="shared_content">'.trim($share[3])."</blockquote><br />";
+
+ break;
+ case 5:
+ $text = $preshare.html_entity_decode("♲ ", ENT_QUOTES, 'UTF-8').' '.$userid_compact.": <br />".$share[3];
+ break;
+ case 6: // app.net
+ $text = $preshare.">> @".$userid_compact.": <br />".$share[3];
+ break;
+ case 7: // statusnet/GNU Social
+ $text = $preshare.html_entity_decode("♲ ", ENT_QUOTES, 'UTF-8')." @".$userid_compact.": ".$share[3];
+ break;
+ case 8: // twitter
+ $text = $preshare."RT @".$userid_compact.": ".$share[3];
+ break;
+ case 9: // Google+/Facebook
+ $text = $preshare.html_entity_decode("♲ ", ENT_QUOTES, 'UTF-8').' '.$userid_compact.": <br />".$share[3];
+
+ if ($link != "")
+ $text .= "<br /><br />".$link;
+ break;
+ default:
+ $headline = trim($share[1]).'<div class="shared_header">';
+ if ($avatar != "")
+ $headline .= '<img src="'.$avatar.'" height="32" width="32" >';
+
+ $headline .= sprintf(t('<span><a href="%s" target="_blank">%s</a> wrote the following <a href="%s" target="_blank">post</a>'.$reldate.':</span>'), $profile, $author, $link);
+ $headline .= "</div>";
+ $text = $headline.'<blockquote class="shared_content">'.trim($share[3])."</blockquote>";
+ break;
+ }
+ return($text);