New addon "appnetpost" to post to app.net

This commit is contained in:
Michael Vogel 2013-10-05 15:35:14 +02:00
parent 67244bb9ea
commit b6aa4fd753
4 changed files with 428 additions and 76 deletions

View file

@ -267,32 +267,6 @@ function gpluspost_original_url($url, $depth=1) {
return($url);
}
function gpluspost_ShareAttributes($match) {
$attributes = $match[1];
$author = "";
preg_match("/author='(.*?)'/ism", $attributes, $matches);
if ($matches[1] != "")
$author = $matches[1];
preg_match('/author="(.*?)"/ism', $attributes, $matches);
if ($matches[1] != "")
$author = $matches[1];
$headline = '<div class="shared_header">';
$headline .= sprintf(t('%s:'), $author);
$headline .= "</div>";
//$text = "<br />".$headline."</strong><blockquote>".$match[2]."</blockquote>";
//$text = "\n\t".$match[2].":\t";
$text = html_entity_decode("&#x2672; ", ENT_QUOTES, 'UTF-8').$author.": ".$match[2];
return($text);
}
function gpluspost_feeditem($pid, $uid) {
global $a;
@ -327,10 +301,13 @@ function gpluspost_feeditem($pid, $uid) {
$multiplelinks = (strpos($item['body'], "[bookmark") != strrpos($item['body'], "[bookmark"));
$body = $item['body'];
$body = preg_replace_callback("/\[share(.*?)\]\s?(.*?)\s?\[\/share\]/ism","gpluspost_ShareAttributes", $body);
$html = bbcode($body, false, false);
// At first convert the text to html
$html = bbcode($body, false, false, 2);
// Then convert it to plain text
$msg = trim(html2plain($html, 0, true));
$msg = html_entity_decode($msg,ENT_QUOTES,'UTF-8');
// If there is no bookmark element then take the first link
if ($link == '') {