mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2025-07-09 18:08:49 +00:00
Preparations for shared posts
This commit is contained in:
parent
c5418789c9
commit
0267222fb4
4 changed files with 43 additions and 2 deletions
|
@ -345,10 +345,34 @@ function fbpost_jot_nets(&$a,&$b) {
|
|||
$fb_defpost = get_pconfig(local_user(),'facebook','post_by_default');
|
||||
$selected = ((intval($fb_defpost) == 1) ? ' checked="checked" ' : '');
|
||||
$b .= '<div class="profile-jot-net"><input type="checkbox" name="facebook_enable"' . $selected . ' value="1" /> '
|
||||
. t('Post to Facebook') . '</div>';
|
||||
. t('Post to Facebook') . '</div>';
|
||||
}
|
||||
}
|
||||
|
||||
function fbpost_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>";
|
||||
|
||||
return($text);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param App $a
|
||||
|
@ -562,6 +586,9 @@ function fbpost_post_hook(&$a,&$b) {
|
|||
$recycle = html_entity_decode("◌ ", ENT_QUOTES, 'UTF-8');
|
||||
$body = preg_replace( '/'.$recycle.'\[url\=(\w+.*?)\](\w+.*?)\[\/url\]/i', "\n\t$2:\t", $body);
|
||||
|
||||
// share element
|
||||
$body = preg_replace_callback("/\[share(.*?)\]\s?(.*?)\s?\[\/share\]/ism","fbpost_ShareAttributes", $body);
|
||||
|
||||
$bodyparts = explode("\t", $body);
|
||||
// Doesn't help with multiple repeats - the problem has to be solved later
|
||||
if (sizeof($bodyparts) == 3) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue